@loopr-ai/craft 0.1.0 → 0.3.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 (41) hide show
  1. package/dist/ButtonBase-750a4103.js +832 -0
  2. package/dist/TransitionGroupContext-e16207d6.js +127 -0
  3. package/dist/assets/theme.css +1 -0
  4. package/dist/chainPropTypes-004bf492.js +8 -0
  5. package/dist/components/cell/AvatarGroup/index.d.ts +31 -0
  6. package/dist/components/cell/AvatarGroup/index.js +390 -0
  7. package/dist/components/cell/Button/index.d.ts +19 -4
  8. package/dist/components/cell/Button/index.js +383 -4
  9. package/dist/components/cell/Chip/index.d.ts +27 -0
  10. package/dist/components/cell/Chip/index.js +483 -0
  11. package/dist/components/cell/ProgressBar/index.d.ts +27 -0
  12. package/dist/components/cell/ProgressBar/index.js +326 -0
  13. package/dist/components/cell/Search/index.d.ts +25 -0
  14. package/dist/components/cell/Search/index.js +26358 -0
  15. package/dist/components/cell/Typography/index.d.ts +20 -0
  16. package/dist/components/cell/Typography/index.js +217 -0
  17. package/dist/createSvgIcon-5dcb7caa.js +184 -0
  18. package/dist/createTheme-95c30431.js +2221 -0
  19. package/dist/emotion-react.browser.esm-ff33c213.js +439 -0
  20. package/dist/exactProp-a28c53c1.js +13 -0
  21. package/dist/global/colors.d.ts +16 -0
  22. package/dist/global/colors.js +22 -0
  23. package/dist/global/constants.js +1 -0
  24. package/dist/global/enums.js +1 -0
  25. package/dist/global/interfaces.d.ts +6 -0
  26. package/dist/global/interfaces.js +1 -0
  27. package/dist/global/theme.d.ts +35 -0
  28. package/dist/global/theme.js +76 -0
  29. package/dist/main.d.ts +8 -2
  30. package/dist/main.js +14 -4
  31. package/dist/providers/CraftThemeProvider.d.ts +16 -0
  32. package/dist/providers/CraftThemeProvider.js +135 -0
  33. package/dist/providers/index.d.ts +2 -0
  34. package/dist/providers/index.js +4 -0
  35. package/dist/styled-05df7dc6.js +699 -0
  36. package/dist/unsupportedProp-3dbf01f6.js +9 -0
  37. package/dist/useTheme-462e5dc6.js +10 -0
  38. package/dist/useThemeWithoutDefault-188598a8.js +950 -0
  39. package/package.json +24 -3
  40. package/dist/components/cell/Input/index.d.ts +0 -5
  41. package/dist/components/cell/Input/index.js +0 -6
@@ -0,0 +1,390 @@
1
+ import { jsx as h, jsxs as G } from "react/jsx-runtime";
2
+ import { g as I, _ as l, a as k, P as a } from "../../../createTheme-95c30431.js";
3
+ import * as g from "react";
4
+ import { g as D, s as M, a as E, c as R, b as U, f as F } from "../../../styled-05df7dc6.js";
5
+ import { c as q } from "../../../createSvgIcon-5dcb7caa.js";
6
+ import { c as V } from "../../../chainPropTypes-004bf492.js";
7
+ const B = q(/* @__PURE__ */ h("path", {
8
+ d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"
9
+ }), "Person");
10
+ function H(r) {
11
+ return I("MuiAvatar", r);
12
+ }
13
+ const W = D("MuiAvatar", ["root", "colorDefault", "circular", "rounded", "square", "img", "fallback"]), J = W, K = ["alt", "children", "className", "component", "imgProps", "sizes", "src", "srcSet", "variant"], Q = (r) => {
14
+ const {
15
+ classes: t,
16
+ variant: e,
17
+ colorDefault: o
18
+ } = r;
19
+ return U({
20
+ root: ["root", e, o && "colorDefault"],
21
+ img: ["img"],
22
+ fallback: ["fallback"]
23
+ }, H, t);
24
+ }, X = M("div", {
25
+ name: "MuiAvatar",
26
+ slot: "Root",
27
+ overridesResolver: (r, t) => {
28
+ const {
29
+ ownerState: e
30
+ } = r;
31
+ return [t.root, t[e.variant], e.colorDefault && t.colorDefault];
32
+ }
33
+ })(({
34
+ theme: r,
35
+ ownerState: t
36
+ }) => l({
37
+ position: "relative",
38
+ display: "flex",
39
+ alignItems: "center",
40
+ justifyContent: "center",
41
+ flexShrink: 0,
42
+ width: 40,
43
+ height: 40,
44
+ fontFamily: r.typography.fontFamily,
45
+ fontSize: r.typography.pxToRem(20),
46
+ lineHeight: 1,
47
+ borderRadius: "50%",
48
+ overflow: "hidden",
49
+ userSelect: "none"
50
+ }, t.variant === "rounded" && {
51
+ borderRadius: (r.vars || r).shape.borderRadius
52
+ }, t.variant === "square" && {
53
+ borderRadius: 0
54
+ }, t.colorDefault && l({
55
+ color: (r.vars || r).palette.background.default
56
+ }, r.vars ? {
57
+ backgroundColor: r.vars.palette.Avatar.defaultBg
58
+ } : {
59
+ backgroundColor: r.palette.mode === "light" ? r.palette.grey[400] : r.palette.grey[600]
60
+ }))), Y = M("img", {
61
+ name: "MuiAvatar",
62
+ slot: "Img",
63
+ overridesResolver: (r, t) => t.img
64
+ })({
65
+ width: "100%",
66
+ height: "100%",
67
+ textAlign: "center",
68
+ // Handle non-square image. The property isn't supported by IE11.
69
+ objectFit: "cover",
70
+ // Hide alt text.
71
+ color: "transparent",
72
+ // Hide the image broken icon, only works on Chrome.
73
+ textIndent: 1e4
74
+ }), Z = M(B, {
75
+ name: "MuiAvatar",
76
+ slot: "Fallback",
77
+ overridesResolver: (r, t) => t.fallback
78
+ })({
79
+ width: "75%",
80
+ height: "75%"
81
+ });
82
+ function aa({
83
+ crossOrigin: r,
84
+ referrerPolicy: t,
85
+ src: e,
86
+ srcSet: o
87
+ }) {
88
+ const [n, i] = g.useState(!1);
89
+ return g.useEffect(() => {
90
+ if (!e && !o)
91
+ return;
92
+ i(!1);
93
+ let c = !0;
94
+ const s = new Image();
95
+ return s.onload = () => {
96
+ c && i("loaded");
97
+ }, s.onerror = () => {
98
+ c && i("error");
99
+ }, s.crossOrigin = r, s.referrerPolicy = t, s.src = e, o && (s.srcset = o), () => {
100
+ c = !1;
101
+ };
102
+ }, [r, t, e, o]), n;
103
+ }
104
+ const $ = /* @__PURE__ */ g.forwardRef(function(t, e) {
105
+ const o = E({
106
+ props: t,
107
+ name: "MuiAvatar"
108
+ }), {
109
+ alt: n,
110
+ children: i,
111
+ className: c,
112
+ component: s = "div",
113
+ imgProps: C,
114
+ sizes: y,
115
+ src: x,
116
+ srcSet: p,
117
+ variant: S = "circular"
118
+ } = o, N = k(o, K);
119
+ let m = null;
120
+ const u = aa(l({}, C, {
121
+ src: x,
122
+ srcSet: p
123
+ })), b = x || p, A = b && u !== "error", d = l({}, o, {
124
+ colorDefault: !A,
125
+ component: s,
126
+ variant: S
127
+ }), v = Q(d);
128
+ return A ? m = /* @__PURE__ */ h(Y, l({
129
+ alt: n,
130
+ src: x,
131
+ srcSet: p,
132
+ sizes: y,
133
+ ownerState: d,
134
+ className: v.img
135
+ }, C)) : i != null ? m = i : b && n ? m = n[0] : m = /* @__PURE__ */ h(Z, {
136
+ ownerState: d,
137
+ className: v.fallback
138
+ }), /* @__PURE__ */ h(X, l({
139
+ as: s,
140
+ ownerState: d,
141
+ className: R(v.root, c),
142
+ ref: e
143
+ }, N, {
144
+ children: m
145
+ }));
146
+ });
147
+ process.env.NODE_ENV !== "production" && ($.propTypes = {
148
+ // ----------------------------- Warning --------------------------------
149
+ // | These PropTypes are generated from the TypeScript type definitions |
150
+ // | To update them edit the d.ts file and run "yarn proptypes" |
151
+ // ----------------------------------------------------------------------
152
+ /**
153
+ * Used in combination with `src` or `srcSet` to
154
+ * provide an alt attribute for the rendered `img` element.
155
+ */
156
+ alt: a.string,
157
+ /**
158
+ * Used to render icon or text elements inside the Avatar if `src` is not set.
159
+ * This can be an element, or just a string.
160
+ */
161
+ children: a.node,
162
+ /**
163
+ * Override or extend the styles applied to the component.
164
+ */
165
+ classes: a.object,
166
+ /**
167
+ * @ignore
168
+ */
169
+ className: a.string,
170
+ /**
171
+ * The component used for the root node.
172
+ * Either a string to use a HTML element or a component.
173
+ */
174
+ component: a.elementType,
175
+ /**
176
+ * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attributes) applied to the `img` element if the component is used to display an image.
177
+ * It can be used to listen for the loading error event.
178
+ */
179
+ imgProps: a.object,
180
+ /**
181
+ * The `sizes` attribute for the `img` element.
182
+ */
183
+ sizes: a.string,
184
+ /**
185
+ * The `src` attribute for the `img` element.
186
+ */
187
+ src: a.string,
188
+ /**
189
+ * The `srcSet` attribute for the `img` element.
190
+ * Use this attribute for responsive image display.
191
+ */
192
+ srcSet: a.string,
193
+ /**
194
+ * The system prop that allows defining system overrides as well as additional CSS styles.
195
+ */
196
+ sx: a.oneOfType([a.arrayOf(a.oneOfType([a.func, a.object, a.bool])), a.func, a.object]),
197
+ /**
198
+ * The shape of the avatar.
199
+ * @default 'circular'
200
+ */
201
+ variant: a.oneOfType([a.oneOf(["circular", "rounded", "square"]), a.string])
202
+ });
203
+ const z = $;
204
+ function ra(r) {
205
+ return I("MuiAvatarGroup", r);
206
+ }
207
+ const ta = D("MuiAvatarGroup", ["root", "avatar"]), ea = ta, oa = ["children", "className", "component", "componentsProps", "max", "slotProps", "spacing", "total", "variant"], O = {
208
+ small: -16,
209
+ medium: null
210
+ }, sa = (r) => {
211
+ const {
212
+ classes: t
213
+ } = r;
214
+ return U({
215
+ root: ["root"],
216
+ avatar: ["avatar"]
217
+ }, ra, t);
218
+ }, na = M("div", {
219
+ name: "MuiAvatarGroup",
220
+ slot: "Root",
221
+ overridesResolver: (r, t) => l({
222
+ [`& .${ea.avatar}`]: t.avatar
223
+ }, t.root)
224
+ })(({
225
+ theme: r
226
+ }) => ({
227
+ [`& .${J.root}`]: {
228
+ border: `2px solid ${(r.vars || r).palette.background.default}`,
229
+ boxSizing: "content-box",
230
+ marginLeft: -8,
231
+ "&:last-child": {
232
+ marginLeft: 0
233
+ }
234
+ },
235
+ display: "flex",
236
+ flexDirection: "row-reverse"
237
+ })), la = M(z, {
238
+ name: "MuiAvatarGroup",
239
+ slot: "Avatar",
240
+ overridesResolver: (r, t) => t.avatar
241
+ })(({
242
+ theme: r
243
+ }) => ({
244
+ border: `2px solid ${(r.vars || r).palette.background.default}`,
245
+ boxSizing: "content-box",
246
+ marginLeft: -8,
247
+ "&:last-child": {
248
+ marginLeft: 0
249
+ }
250
+ })), L = /* @__PURE__ */ g.forwardRef(function(t, e) {
251
+ var o;
252
+ const n = E({
253
+ props: t,
254
+ name: "MuiAvatarGroup"
255
+ }), {
256
+ children: i,
257
+ className: c,
258
+ component: s = "div",
259
+ componentsProps: C = {},
260
+ max: y = 5,
261
+ slotProps: x = {},
262
+ spacing: p = "medium",
263
+ total: S,
264
+ variant: N = "circular"
265
+ } = n, m = k(n, oa);
266
+ let u = y < 2 ? 2 : y;
267
+ const b = l({}, n, {
268
+ max: y,
269
+ spacing: p,
270
+ component: s,
271
+ variant: N
272
+ }), A = sa(b), d = g.Children.toArray(i).filter((f) => (process.env.NODE_ENV !== "production" && F.isFragment(f) && console.error(["MUI: The AvatarGroup component doesn't accept a Fragment as a child.", "Consider providing an array instead."].join(`
273
+ `)), /* @__PURE__ */ g.isValidElement(f))), v = S || d.length;
274
+ v === u && (u += 1), u = Math.min(v + 1, u);
275
+ const T = Math.min(d.length, u - 1), j = Math.max(v - u, v - T, 0), w = p && O[p] !== void 0 ? O[p] : -p, P = (o = x.additionalAvatar) != null ? o : C.additionalAvatar;
276
+ return /* @__PURE__ */ G(na, l({
277
+ as: s,
278
+ ownerState: b,
279
+ className: R(A.root, c),
280
+ ref: e
281
+ }, m, {
282
+ children: [j ? /* @__PURE__ */ G(la, l({
283
+ ownerState: b,
284
+ variant: N
285
+ }, P, {
286
+ className: R(A.avatar, P == null ? void 0 : P.className),
287
+ style: l({
288
+ marginLeft: w
289
+ }, P == null ? void 0 : P.style),
290
+ children: ["+", j]
291
+ })) : null, d.slice(0, T).reverse().map((f, _) => /* @__PURE__ */ g.cloneElement(f, {
292
+ className: R(f.props.className, A.avatar),
293
+ style: l({
294
+ // Consistent with "&:last-child" styling for the default spacing,
295
+ // we do not apply custom marginLeft spacing on the last child
296
+ marginLeft: _ === T - 1 ? void 0 : w
297
+ }, f.props.style),
298
+ variant: f.props.variant || N
299
+ }))]
300
+ }));
301
+ });
302
+ process.env.NODE_ENV !== "production" && (L.propTypes = {
303
+ // ----------------------------- Warning --------------------------------
304
+ // | These PropTypes are generated from the TypeScript type definitions |
305
+ // | To update them edit the d.ts file and run "yarn proptypes" |
306
+ // ----------------------------------------------------------------------
307
+ /**
308
+ * The avatars to stack.
309
+ */
310
+ children: a.node,
311
+ /**
312
+ * Override or extend the styles applied to the component.
313
+ */
314
+ classes: a.object,
315
+ /**
316
+ * @ignore
317
+ */
318
+ className: a.string,
319
+ /**
320
+ * The component used for the root node.
321
+ * Either a string to use a HTML element or a component.
322
+ */
323
+ component: a.elementType,
324
+ /**
325
+ * The extra props for the slot components.
326
+ * You can override the existing props or add new ones.
327
+ *
328
+ * This prop is an alias for the `slotProps` prop.
329
+ * It's recommended to use the `slotProps` prop instead, as `componentsProps` will be deprecated in the future.
330
+ *
331
+ * @default {}
332
+ */
333
+ componentsProps: a.shape({
334
+ additionalAvatar: a.object
335
+ }),
336
+ /**
337
+ * Max avatars to show before +x.
338
+ * @default 5
339
+ */
340
+ max: V(a.number, (r) => r.max < 2 ? new Error(["MUI: The prop `max` should be equal to 2 or above.", "A value below is clamped to 2."].join(`
341
+ `)) : null),
342
+ /**
343
+ * The extra props for the slot components.
344
+ * You can override the existing props or add new ones.
345
+ *
346
+ * This prop is an alias for the `componentsProps` prop, which will be deprecated in the future.
347
+ *
348
+ * @default {}
349
+ */
350
+ slotProps: a.shape({
351
+ additionalAvatar: a.object
352
+ }),
353
+ /**
354
+ * Spacing between avatars.
355
+ * @default 'medium'
356
+ */
357
+ spacing: a.oneOfType([a.oneOf(["medium", "small"]), a.number]),
358
+ /**
359
+ * The system prop that allows defining system overrides as well as additional CSS styles.
360
+ */
361
+ sx: a.oneOfType([a.arrayOf(a.oneOfType([a.func, a.object, a.bool])), a.func, a.object]),
362
+ /**
363
+ * The total number of avatars. Used for calculating the number of extra avatars.
364
+ * @default children.length
365
+ */
366
+ total: a.number,
367
+ /**
368
+ * The variant to use.
369
+ * @default 'circular'
370
+ */
371
+ variant: a.oneOfType([a.oneOf(["circular", "rounded", "square"]), a.string])
372
+ });
373
+ const ia = L, ma = ({
374
+ max: r = 4,
375
+ spacing: t = 14,
376
+ imagesArray: e = [],
377
+ sx: o,
378
+ avatarProps: n,
379
+ ...i
380
+ }) => /* @__PURE__ */ h(ia, { max: r, sx: o, spacing: t, ...i, children: e.map((c, s) => /* @__PURE__ */ h(
381
+ z,
382
+ {
383
+ src: c,
384
+ ...n
385
+ },
386
+ s
387
+ )) });
388
+ export {
389
+ ma as default
390
+ };
@@ -1,5 +1,20 @@
1
- import React from 'react';
2
- export interface ButtonProps extends React.HtmlHTMLAttributes<HTMLButtonElement> {
1
+ import { ButtonProps as MuiButtonProps } from "@mui/material/Button";
2
+ import { CraftFC } from "../../../global/interfaces";
3
+ /**
4
+ * This ButtonProps Interface extend MuiButtonProps Interface
5
+ * @param {string} look - "normal" | "modified"
6
+ */
7
+ export interface ButtonProps extends MuiButtonProps {
8
+ look?: "normal" | "modified";
3
9
  }
4
- declare const _default: React.NamedExoticComponent<ButtonProps>;
5
- export default _default;
10
+ /**
11
+ * This Button Component is a wrapper of MuiButton Component with some custom styles for the look props
12
+ * @param {string} variant - "contained" | "outlined" | "text"
13
+ * @param {boolean} disabled - true | false
14
+ * @param {string} look - "normal" | "modified"
15
+ * @param {React.ReactNode} children - React.ReactNode
16
+ * @param {SxProps} sx - SxProps
17
+ * @returns {JSX.Element}
18
+ */
19
+ declare const Button: CraftFC<ButtonProps>;
20
+ export default Button;