@hai-dev/ui-kit 1.1.12 → 1.2.1

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 (56) hide show
  1. package/dist/{Box-TrgOqpYk.js → Box-BgNAyP2L.js} +2 -2
  2. package/dist/{Button-BN3fv8kr.js → Button-DTV8ztWw.js} +5 -5
  3. package/dist/{ButtonBase-CSWuFxUv.js → ButtonBase-C4krg_zd.js} +3 -3
  4. package/dist/{CircularProgress-sPARyPfh.js → CircularProgress-BoaEg4rF.js} +3 -3
  5. package/dist/{Dialog-Cf0d7zi7.js → Dialog-BK9lMUKV.js} +12 -11
  6. package/dist/{DialogTitle-BtvmXSZP.js → DialogTitle-ByUfLB5M.js} +4 -4
  7. package/dist/{Typography-Bjd6ZHeX.js → Typography-BMyz0ZCh.js} +4 -4
  8. package/dist/assets/button.css +1 -1
  9. package/dist/assets/circular-progress-loader.css +1 -1
  10. package/dist/assets/code-input.css +1 -1
  11. package/dist/assets/error-upload-dialog.css +1 -1
  12. package/dist/assets/inter.css +1 -0
  13. package/dist/assets/photo-list.css +1 -1
  14. package/dist/assets/upload-dialog-errors.css +1 -1
  15. package/dist/button.module-C0UNQnBk.js +40 -0
  16. package/dist/chainPropTypes-DgqFdXGi.js +532 -0
  17. package/dist/components/button/button-content.js +11 -11
  18. package/dist/components/button/button.d.ts +18 -0
  19. package/dist/components/button/button.js +42 -35
  20. package/dist/components/button/constants.d.ts +17 -0
  21. package/dist/components/button/constants.js +28 -11
  22. package/dist/components/button/types.d.ts +11 -8
  23. package/dist/components/button/utils/get-button-classnames.d.ts +6 -0
  24. package/dist/components/button/utils/get-button-classnames.js +22 -10
  25. package/dist/components/circular-progress-loader/circular-progress-loader.js +14 -13
  26. package/dist/components/code-input/code-input.js +114 -112
  27. package/dist/components/photo-crop-uploader/components/error-upload-dialog/error-upload-dialog.js +39 -38
  28. package/dist/components/photo-crop-uploader/components/photo-list/constants.d.ts +5 -1
  29. package/dist/components/photo-crop-uploader/components/photo-list/constants.js +6 -2
  30. package/dist/components/photo-crop-uploader/components/photo-list/photo-list.js +136 -33
  31. package/dist/components/photo-crop-uploader/components/photo-list/types.d.ts +2 -0
  32. package/dist/components/photo-crop-uploader/components/photo-list/use-container-size.d.ts +4 -0
  33. package/dist/components/photo-crop-uploader/components/photo-list/use-container-size.js +22 -0
  34. package/dist/components/photo-crop-uploader/components/upload-button/upload-button.js +1 -1
  35. package/dist/components/photo-crop-uploader/components/upload-dialog/constants.d.ts +1 -1
  36. package/dist/components/photo-crop-uploader/components/upload-dialog/constants.js +1 -1
  37. package/dist/components/photo-crop-uploader/components/upload-dialog/upload-dialog-errors.js +4 -3
  38. package/dist/components/photo-crop-uploader/components/upload-dialog/upload-dialog.js +156 -145
  39. package/dist/components/photo-crop-uploader/components/upload-dialog/use-scaled-min-dimension.d.ts +4 -0
  40. package/dist/components/photo-crop-uploader/components/upload-dialog/use-scaled-min-dimension.js +31 -0
  41. package/dist/components/photo-crop-uploader/locale.js +6 -2
  42. package/dist/{createTheme-D8R2Cz2N.js → createTheme-BoOmbNvy.js} +426 -390
  43. package/dist/{extendSxProp-Cw_ym9sl.js → extendSxProp-BaUCVMKV.js} +2 -1
  44. package/dist/{index-CL3JU48X.js → index-h5oTv8GF.js} +3 -3
  45. package/dist/{memoTheme-D5VCpQCz.js → memoTheme-BYBJ2Fe6.js} +1 -1
  46. package/dist/refType-CsohaiiT.js +60 -0
  47. package/dist/{upload-dialog-errors-DHl0bh1n.js → upload-dialog-errors-BwQsTOc3.js} +46 -46
  48. package/dist/useEnhancedEffect-CJGo-L3B.js +5 -0
  49. package/dist/utils/debounce.d.ts +5 -0
  50. package/dist/utils/debounce.js +12 -0
  51. package/dist/utils/index.d.ts +1 -0
  52. package/dist/utils/index.js +4 -0
  53. package/package.json +10 -2
  54. package/dist/button.module-BZPPmSAS.js +0 -21
  55. package/dist/chainPropTypes-DiJb1lGa.js +0 -568
  56. package/dist/refType-CUEs_vK5.js +0 -61
@@ -1,5 +1,5 @@
1
1
  import * as u from "react";
2
- import { f, h as a, i as m, j as l } from "./createTheme-D8R2Cz2N.js";
2
+ import { f, h as a, i as m, j as l } from "./createTheme-BoOmbNvy.js";
3
3
  function h(t) {
4
4
  return Object.keys(t).length === 0;
5
5
  }
@@ -44,6 +44,7 @@ function j(t) {
44
44
  };
45
45
  }
46
46
  export {
47
+ x as a,
47
48
  j as e,
48
49
  b as u
49
50
  };
@@ -1,8 +1,8 @@
1
1
  import "react";
2
2
  import { jsx as a } from "react/jsx-runtime";
3
- import { u as y, e as m } from "./extendSxProp-Cw_ym9sl.js";
4
- import { P as e, k as d, T as b } from "./createTheme-D8R2Cz2N.js";
5
- import { G as T, d as h } from "./chainPropTypes-DiJb1lGa.js";
3
+ import { u as y, e as m } from "./extendSxProp-BaUCVMKV.js";
4
+ import { P as e, k as d, T as b } from "./createTheme-BoOmbNvy.js";
5
+ import { G as T, d as h } from "./chainPropTypes-DgqFdXGi.js";
6
6
  function E(t) {
7
7
  return t == null || Object.keys(t).length === 0;
8
8
  }
@@ -1,4 +1,4 @@
1
- import { p as s } from "./chainPropTypes-DiJb1lGa.js";
1
+ import { p as s } from "./chainPropTypes-DgqFdXGi.js";
2
2
  const l = {
3
3
  theme: void 0
4
4
  };
@@ -0,0 +1,60 @@
1
+ import * as u from "react";
2
+ import { u as l } from "./useEnhancedEffect-CJGo-L3B.js";
3
+ import { P as a } from "./createTheme-BoOmbNvy.js";
4
+ import { b as p } from "./chainPropTypes-DgqFdXGi.js";
5
+ function h(t) {
6
+ const e = u.useRef(t);
7
+ return l(() => {
8
+ e.current = t;
9
+ }), u.useRef((...c) => (
10
+ // @ts-expect-error hide `this`
11
+ (0, e.current)(...c)
12
+ )).current;
13
+ }
14
+ function C(...t) {
15
+ const e = u.useRef(void 0), c = u.useCallback((r) => {
16
+ const f = t.map((n) => {
17
+ if (n == null)
18
+ return null;
19
+ if (typeof n == "function") {
20
+ const i = n, o = i(r);
21
+ return typeof o == "function" ? o : () => {
22
+ i(null);
23
+ };
24
+ }
25
+ return n.current = r, () => {
26
+ n.current = null;
27
+ };
28
+ });
29
+ return () => {
30
+ f.forEach((n) => n?.());
31
+ };
32
+ }, t);
33
+ return u.useMemo(() => t.every((r) => r == null) ? null : (r) => {
34
+ e.current && (e.current(), e.current = void 0), r != null && (e.current = c(r));
35
+ }, t);
36
+ }
37
+ function s(t) {
38
+ const {
39
+ prototype: e = {}
40
+ } = t;
41
+ return !!e.isReactComponent;
42
+ }
43
+ function d(t, e, c, r, f) {
44
+ const n = t[e], i = f || e;
45
+ if (n == null || // When server-side rendering React doesn't warn either.
46
+ // This is not an accurate check for SSR.
47
+ // This is only in place for emotion compat.
48
+ // TODO: Revisit once https://github.com/facebook/react/issues/20047 is resolved.
49
+ typeof window > "u")
50
+ return null;
51
+ let o;
52
+ return typeof n == "function" && !s(n) && (o = "Did you accidentally provide a plain function component instead?"), n === u.Fragment && (o = "Did you accidentally provide a React.Fragment instead?"), o !== void 0 ? new Error(`Invalid ${r} \`${i}\` supplied to \`${c}\`. Expected an element type that can hold a ref. ${o} For more information see https://v7.mui.com/r/caveat-with-refs-guide`) : null;
53
+ }
54
+ const E = p(a.elementType, d), T = a.oneOfType([a.func, a.object]);
55
+ export {
56
+ h as a,
57
+ E as e,
58
+ T as r,
59
+ C as u
60
+ };
@@ -1,14 +1,15 @@
1
- import { jsx as s, jsxs as g, Fragment as x } from "react/jsx-runtime";
1
+ import { jsx as s, jsxs as g, Fragment as w } from "react/jsx-runtime";
2
2
  import { c } from "./index-YnD2EP-S.js";
3
- import { localizedText as f } from "./components/photo-crop-uploader/locale.js";
4
- import { EN_LOCALE as L, DASH_SYMBOL as S } from "./constants.js";
5
- import { D as I, a as R, b as W } from "./DialogTitle-BtvmXSZP.js";
3
+ import { localizedText as h } from "./components/photo-crop-uploader/locale.js";
4
+ import { EN_LOCALE as S, DASH_SYMBOL as L } from "./constants.js";
5
+ import './assets/inter.css';import './assets/upload-dialog-errors.css';/* empty css */
6
+ import { D as I, a as R, b as W } from "./DialogTitle-ByUfLB5M.js";
6
7
  import * as O from "react";
7
- import { g as V, a as k, c as B, P as r } from "./createTheme-D8R2Cz2N.js";
8
- import { m as C } from "./memoTheme-D5VCpQCz.js";
9
- import { u as $, c as z, s as w } from "./chainPropTypes-DiJb1lGa.js";
10
- import { Button as y } from "./components/button/button.js";
11
- import './assets/upload-dialog-errors.css';function E(e) {
8
+ import { g as V, a as k, c as B, P as r } from "./createTheme-BoOmbNvy.js";
9
+ import { m as y } from "./memoTheme-BYBJ2Fe6.js";
10
+ import { u as $, c as z, s as C } from "./chainPropTypes-DgqFdXGi.js";
11
+ import { Button as x } from "./components/button/button.js";
12
+ function E(e) {
12
13
  return V("MuiDivider", e);
13
14
  }
14
15
  k("MuiDivider", ["root", "absolute", "fullWidth", "inset", "middle", "flexItem", "light", "vertical", "withChildren", "withChildrenVertical", "textAlignRight", "textAlignLeft", "wrapper", "wrapperVertical"]);
@@ -17,17 +18,17 @@ const M = (e) => {
17
18
  absolute: t,
18
19
  children: o,
19
20
  classes: d,
20
- flexItem: h,
21
+ flexItem: m,
21
22
  light: i,
22
23
  orientation: n,
23
24
  textAlign: l,
24
25
  variant: a
25
26
  } = e;
26
27
  return z({
27
- root: ["root", t && "absolute", a, i && "light", n === "vertical" && "vertical", h && "flexItem", o && "withChildren", o && n === "vertical" && "withChildrenVertical", l === "right" && n !== "vertical" && "textAlignRight", l === "left" && n !== "vertical" && "textAlignLeft"],
28
+ root: ["root", t && "absolute", a, i && "light", n === "vertical" && "vertical", m && "flexItem", o && "withChildren", o && n === "vertical" && "withChildrenVertical", l === "right" && n !== "vertical" && "textAlignRight", l === "left" && n !== "vertical" && "textAlignLeft"],
28
29
  wrapper: ["wrapper", n === "vertical" && "wrapperVertical"]
29
30
  }, E, d);
30
- }, U = w("div", {
31
+ }, U = C("div", {
31
32
  name: "MuiDivider",
32
33
  slot: "Root",
33
34
  overridesResolver: (e, t) => {
@@ -36,7 +37,7 @@ const M = (e) => {
36
37
  } = e;
37
38
  return [t.root, o.absolute && t.absolute, t[o.variant], o.light && t.light, o.orientation === "vertical" && t.vertical, o.flexItem && t.flexItem, o.children && t.withChildren, o.children && o.orientation === "vertical" && t.withChildrenVertical, o.textAlign === "right" && o.orientation !== "vertical" && t.textAlignRight, o.textAlign === "left" && o.orientation !== "vertical" && t.textAlignLeft];
38
39
  }
39
- })(C(({
40
+ })(y(({
40
41
  theme: e
41
42
  }) => ({
42
43
  margin: 0,
@@ -168,7 +169,7 @@ const M = (e) => {
168
169
  }
169
170
  }
170
171
  }]
171
- }))), j = w("span", {
172
+ }))), j = C("span", {
172
173
  name: "MuiDivider",
173
174
  slot: "Wrapper",
174
175
  overridesResolver: (e, t) => {
@@ -177,7 +178,7 @@ const M = (e) => {
177
178
  } = e;
178
179
  return [t.wrapper, o.orientation === "vertical" && t.wrapperVertical];
179
180
  }
180
- })(C(({
181
+ })(y(({
181
182
  theme: e
182
183
  }) => ({
183
184
  display: "inline-block",
@@ -193,50 +194,50 @@ const M = (e) => {
193
194
  paddingBottom: `calc(${e.spacing(1)} * 1.2)`
194
195
  }
195
196
  }]
196
- }))), v = /* @__PURE__ */ O.forwardRef(function(t, o) {
197
+ }))), u = /* @__PURE__ */ O.forwardRef(function(t, o) {
197
198
  const d = $({
198
199
  props: t,
199
200
  name: "MuiDivider"
200
201
  }), {
201
- absolute: h = !1,
202
+ absolute: m = !1,
202
203
  children: i,
203
204
  className: n,
204
205
  orientation: l = "horizontal",
205
206
  component: a = i || l === "vertical" ? "div" : "hr",
206
207
  flexItem: b = !1,
207
208
  light: A = !1,
208
- role: m = a !== "hr" ? "separator" : void 0,
209
+ role: f = a !== "hr" ? "separator" : void 0,
209
210
  textAlign: D = "center",
210
211
  variant: N = "fullWidth",
211
212
  ...T
212
- } = d, u = {
213
+ } = d, v = {
213
214
  ...d,
214
- absolute: h,
215
+ absolute: m,
215
216
  component: a,
216
217
  flexItem: b,
217
218
  light: A,
218
219
  orientation: l,
219
- role: m,
220
+ role: f,
220
221
  textAlign: D,
221
222
  variant: N
222
- }, _ = M(u);
223
+ }, _ = M(v);
223
224
  return /* @__PURE__ */ s(U, {
224
225
  as: a,
225
226
  className: B(_.root, n),
226
- role: m,
227
+ role: f,
227
228
  ref: o,
228
- ownerState: u,
229
- "aria-orientation": m === "separator" && (a !== "hr" || l === "vertical") ? l : void 0,
229
+ ownerState: v,
230
+ "aria-orientation": f === "separator" && (a !== "hr" || l === "vertical") ? l : void 0,
230
231
  ...T,
231
232
  children: i ? /* @__PURE__ */ s(j, {
232
233
  className: _.wrapper,
233
- ownerState: u,
234
+ ownerState: v,
234
235
  children: i
235
236
  }) : null
236
237
  });
237
238
  });
238
- v && (v.muiSkipListHighlight = !0);
239
- process.env.NODE_ENV !== "production" && (v.propTypes = {
239
+ u && (u.muiSkipListHighlight = !0);
240
+ process.env.NODE_ENV !== "production" && (u.propTypes = {
240
241
  // ┌────────────────────────────── Warning ──────────────────────────────┐
241
242
  // │ These PropTypes are generated from the TypeScript type definitions. │
242
243
  // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
@@ -299,7 +300,7 @@ process.env.NODE_ENV !== "production" && (v.propTypes = {
299
300
  */
300
301
  variant: r.oneOfType([r.oneOf(["fullWidth", "inset", "middle"]), r.string])
301
302
  });
302
- const H = "_dialog_n5vpn_1", P = "_dark_n5vpn_1", F = "_errorContent_n5vpn_5", Y = "_errorItem_n5vpn_38", q = "_fileName_n5vpn_45", G = "_topActions_n5vpn_51", J = "_close_n5vpn_57", K = "_botActions_n5vpn_61", Q = "_button_n5vpn_66", X = "_title_n5vpn_70", Z = "_content_n5vpn_76", tt = "_many_n5vpn_84", et = "_photoList_n5vpn_87", ot = "_crop_n5vpn_91", rt = "_dialogText_n5vpn_100", p = {
303
+ const H = "_dialog_9wmpu_1", P = "_dark_9wmpu_5", F = "_errorContent_9wmpu_9", Y = "_errorItem_9wmpu_61", q = "_fileName_9wmpu_68", G = "_topActions_9wmpu_71", J = "_close_9wmpu_77", K = "_botActions_9wmpu_85", Q = "_button_9wmpu_91", X = "_title_9wmpu_96", Z = "_content_9wmpu_103", tt = "_many_9wmpu_125", et = "_crop_9wmpu_129", ot = "_dialogText_9wmpu_177", p = {
303
304
  dialog: H,
304
305
  dark: P,
305
306
  errorContent: F,
@@ -312,50 +313,49 @@ const H = "_dialog_n5vpn_1", P = "_dark_n5vpn_1", F = "_errorContent_n5vpn_5", Y
312
313
  title: X,
313
314
  content: Z,
314
315
  many: tt,
315
- photoList: et,
316
- crop: ot,
317
- dialogText: rt
316
+ crop: et,
317
+ dialogText: ot
318
318
  }, gt = (e) => {
319
319
  const {
320
320
  photoSources: t,
321
321
  errors: o = [],
322
322
  onCloseDialogHandler: d,
323
- onClearErrors: h,
324
- locale: i = L
323
+ onClearErrors: m,
324
+ locale: i = S
325
325
  } = e;
326
- return /* @__PURE__ */ g(x, { children: [
327
- /* @__PURE__ */ s(I, { className: c(p.title), children: t.length ? f[i]["some-not-uploaded"] : f[i]["not-uploaded"] }),
328
- /* @__PURE__ */ s(R, { className: c(p.errorContent), children: o.map(({ photoName: n, errorMessage: l }, a) => /* @__PURE__ */ g(x, { children: [
329
- !!a && /* @__PURE__ */ s(v, {}),
326
+ return /* @__PURE__ */ g(w, { children: [
327
+ /* @__PURE__ */ s(I, { className: c(p.title), children: t.length ? h[i]["some-not-uploaded"] : h[i]["not-uploaded"] }),
328
+ /* @__PURE__ */ s(R, { className: c(p.errorContent), children: o.map(({ photoName: n, errorMessage: l }, a) => /* @__PURE__ */ g(w, { children: [
329
+ !!a && /* @__PURE__ */ s(u, {}),
330
330
  /* @__PURE__ */ g("div", { className: c(p.errorItem), children: [
331
331
  /* @__PURE__ */ s("span", { className: c(p.fileName), children: n }),
332
332
  " ",
333
- ` ${S} ${l}`
333
+ ` ${L} ${l}`
334
334
  ] })
335
335
  ] }, a)) }),
336
336
  /* @__PURE__ */ g(W, { className: c(p.botActions), children: [
337
337
  /* @__PURE__ */ s(
338
- y,
338
+ x,
339
339
  {
340
340
  buttonSize: "small",
341
- buttonColor: "blue",
341
+ buttonColor: "red",
342
342
  buttonVariant: "outlined",
343
343
  buttonWeight: 500,
344
344
  onClick: d,
345
345
  className: c(p.button),
346
- children: f[i].close
346
+ children: h[i].close
347
347
  }
348
348
  ),
349
349
  !!t.length && /* @__PURE__ */ s(
350
- y,
350
+ x,
351
351
  {
352
352
  buttonSize: "small",
353
353
  buttonColor: "blue",
354
- buttonVariant: "filled",
354
+ buttonVariant: "outlined",
355
355
  buttonWeight: 500,
356
- onClick: h,
356
+ onClick: m,
357
357
  className: c(p.button),
358
- children: f[i].continue
358
+ children: h[i].continue
359
359
  }
360
360
  )
361
361
  ] })
@@ -0,0 +1,5 @@
1
+ import * as e from "react";
2
+ const f = typeof window < "u" ? e.useLayoutEffect : e.useEffect;
3
+ export {
4
+ f as u
5
+ };
@@ -0,0 +1,5 @@
1
+ type Debounced<T extends (...args: never[]) => unknown> = ((...args: Parameters<T>) => void) & {
2
+ cancel: () => void;
3
+ };
4
+ export declare const debounce: <T extends (...args: never[]) => unknown>(fn: T, wait: number) => Debounced<T>;
5
+ export {};
@@ -0,0 +1,12 @@
1
+ const d = (t, i) => {
2
+ let e;
3
+ const o = ((...c) => {
4
+ e !== void 0 && clearTimeout(e), e = setTimeout(() => t(...c), i);
5
+ });
6
+ return o.cancel = () => {
7
+ e !== void 0 && (clearTimeout(e), e = void 0);
8
+ }, o;
9
+ };
10
+ export {
11
+ d as debounce
12
+ };
@@ -0,0 +1 @@
1
+ export { debounce } from './debounce';
@@ -0,0 +1,4 @@
1
+ import { debounce as r } from "./debounce.js";
2
+ export {
3
+ r as debounce
4
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hai-dev/ui-kit",
3
3
  "private": false,
4
- "version": "1.1.12",
4
+ "version": "1.2.1",
5
5
  "license": "UNLICENSED",
6
6
  "author": {
7
7
  "name": "Vladislav Knitrunov",
@@ -22,7 +22,15 @@
22
22
  "preview": "vite preview",
23
23
  "storybook": "storybook dev -p 6006",
24
24
  "build-storybook": "storybook build",
25
- "prepare": "husky"
25
+ "prepare": "husky",
26
+ "sync:setup": "node scripts/sync.cjs setup",
27
+ "sync:update": "node scripts/sync.cjs update",
28
+ "sync:pull:all": "node scripts/sync.cjs pull:all",
29
+ "sync:pull:existing": "node scripts/sync.cjs pull:existing",
30
+ "sync:pull:new": "node scripts/sync.cjs pull:new",
31
+ "sync:push:all": "node scripts/sync.cjs push:all",
32
+ "sync:push:new": "node scripts/sync.cjs push:new",
33
+ "sync:push:existing": "node scripts/sync.cjs push:existing"
26
34
  },
27
35
  "peerDependencies": {
28
36
  "@emotion/react": "11.14.0",
@@ -1,21 +0,0 @@
1
- import './assets/button.css';const t = "_button_fufd7_1", _ = "_startContent_fufd7_9", n = "_endContent_fufd7_12", e = "_link_fufd7_15", f = "_description_fufd7_24", s = "_text_fufd7_29", d = "_withDescription_fufd7_33", i = "_specific_fufd7_36", o = "_small_fufd7_46", c = "_filled_fufd7_51", l = "_white_fufd7_51", u = "_blue_fufd7_61", a = "_gray_fufd7_68", r = "_outlined_fufd7_72", p = "_disabled_fufd7_97", b = {
2
- button: t,
3
- startContent: _,
4
- endContent: n,
5
- link: e,
6
- description: f,
7
- text: s,
8
- withDescription: d,
9
- specific: i,
10
- default: "_default_fufd7_40",
11
- small: o,
12
- filled: c,
13
- white: l,
14
- blue: u,
15
- gray: a,
16
- outlined: r,
17
- disabled: p
18
- };
19
- export {
20
- b as s
21
- };