@hai-dev/ui-kit 1.0.0 → 1.0.2

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/Button-0AB7oP6Y.js +655 -0
  2. package/dist/ButtonBase-Bw_3RZmN.js +5453 -0
  3. package/dist/CircularProgress-BD6BPlN2.js +290 -0
  4. package/dist/{DialogTitle-1A3dJ174.js → DialogTitle-iOQ7wKEt.js} +78 -78
  5. package/dist/assets/button.css +1 -0
  6. package/dist/assets/upload-button.css +1 -1
  7. package/dist/assets/upload-dialog.css +1 -1
  8. package/dist/button.module-BZPPmSAS.js +21 -0
  9. package/dist/components/button/button-content.d.ts +3 -0
  10. package/dist/components/button/button-content.js +17 -0
  11. package/dist/components/button/button.d.ts +3 -0
  12. package/dist/components/button/button.js +65 -0
  13. package/dist/components/button/button.stories.d.ts +7 -0
  14. package/dist/components/button/constants.d.ts +12 -0
  15. package/dist/components/button/constants.js +15 -0
  16. package/dist/components/button/index.d.ts +1 -0
  17. package/dist/components/button/index.js +4 -0
  18. package/dist/components/button/types.d.ts +38 -0
  19. package/dist/components/button/types.js +1 -0
  20. package/dist/components/button/utils/get-button-classnames.d.ts +2 -0
  21. package/dist/components/button/utils/get-button-classnames.js +17 -0
  22. package/dist/components/button/utils/index.d.ts +1 -0
  23. package/dist/components/button/utils/index.js +4 -0
  24. package/dist/components/index.d.ts +1 -0
  25. package/dist/components/index.js +4 -2
  26. package/dist/components/photo-crop-uploader/components/error-upload-dialog/error-upload-dialog.js +10 -9
  27. package/dist/components/photo-crop-uploader/components/upload-button/constants.d.ts +1 -1
  28. package/dist/components/photo-crop-uploader/components/upload-button/constants.js +1 -1
  29. package/dist/components/photo-crop-uploader/components/upload-button/types.d.ts +5 -1
  30. package/dist/components/photo-crop-uploader/components/upload-button/upload-button.js +81 -58
  31. package/dist/components/photo-crop-uploader/components/upload-dialog/upload-dialog.js +356 -86
  32. package/dist/components/photo-crop-uploader/constants.d.ts +1 -1
  33. package/dist/components/photo-crop-uploader/constants.js +1 -1
  34. package/dist/components/photo-crop-uploader/locale.js +4 -4
  35. package/dist/components/photo-crop-uploader/photo-crop-uploader.js +81 -70
  36. package/dist/components/photo-crop-uploader/types.d.ts +8 -1
  37. package/dist/index-B2JRaoNz.js +48 -0
  38. package/dist/index.d.ts +1 -1
  39. package/dist/index.js +15 -13
  40. package/package.json +73 -73
  41. package/dist/Button-BjNjCLw8.js +0 -6428
@@ -1,123 +1,393 @@
1
- import { jsx as e, jsxs as u } from "react/jsx-runtime";
2
- import { S as y } from "../../../../index-BiffjjQq.js";
3
- import { s as B, a as b, b as P, g as I, C as O, T as S, d as j, P as o, c as C, B as T } from "../../../../Button-BjNjCLw8.js";
4
- import { localizedText as d } from "../../locale.js";
5
- import { EN_LOCALE as A } from "../../../../constants.js";
6
- import { DEFAULT_MIN_DIMENSION as L, DEFAULT_ASPECT_RATIO as R } from "../../constants.js";
7
- import { u as M, e as k, D as v, a as F, b as U, c as H, d as w } from "../../../../DialogTitle-1A3dJ174.js";
8
- import * as z from "react";
9
- import '../../../../assets/upload-dialog.css';function G(m = {}) {
1
+ import { jsxs as B, jsx as n } from "react/jsx-runtime";
2
+ import { S as j } from "../../../../index-BiffjjQq.js";
3
+ import { c as i } from "../../../../index-B2JRaoNz.js";
4
+ import { localizedText as b } from "../../locale.js";
5
+ import { EN_LOCALE as O } from "../../../../constants.js";
6
+ import { DEFAULT_MIN_DIMENSION as D, DEFAULT_ASPECT_RATIO as P } from "../../constants.js";
7
+ import { D as E, d as N, a as k, b as M, c as q } from "../../../../DialogTitle-iOQ7wKEt.js";
8
+ import * as T from "react";
9
+ import { g as U, a as W, u as $, s as A, c as F, b as g, d as V, B as H, P as t, f as Y } from "../../../../ButtonBase-Bw_3RZmN.js";
10
+ import { u as Z, m as z, c as R, C as G } from "../../../../CircularProgress-BD6BPlN2.js";
11
+ import { Button as J } from "../../../button/button.js";
12
+ import '../../../../assets/upload-dialog.css';function K(o) {
13
+ return W("MuiIconButton", o);
14
+ }
15
+ const L = U("MuiIconButton", ["root", "disabled", "colorInherit", "colorPrimary", "colorSecondary", "colorError", "colorInfo", "colorSuccess", "colorWarning", "edgeStart", "edgeEnd", "sizeSmall", "sizeMedium", "sizeLarge", "loading", "loadingIndicator", "loadingWrapper"]), Q = (o) => {
10
16
  const {
11
- themeId: s,
12
- defaultTheme: n,
13
- defaultClassName: l = "MuiBox-root",
14
- generateClassName: c
15
- } = m, p = B("div", {
16
- shouldForwardProp: (a) => a !== "theme" && a !== "sx" && a !== "as"
17
- })(b);
18
- return /* @__PURE__ */ z.forwardRef(function(h, i) {
19
- const r = M(n), {
20
- className: t,
21
- component: g = "div",
22
- ...f
23
- } = k(h);
24
- return /* @__PURE__ */ e(p, {
25
- as: g,
26
- ref: i,
27
- className: P(t, c ? c(l) : l),
28
- theme: s && r[s] || r,
29
- ...f
30
- });
17
+ classes: e,
18
+ disabled: a,
19
+ color: l,
20
+ edge: d,
21
+ size: u,
22
+ loading: m
23
+ } = o, p = {
24
+ root: ["root", m && "loading", a && "disabled", l !== "default" && `color${g(l)}`, d && `edge${g(d)}`, `size${g(u)}`],
25
+ loadingIndicator: ["loadingIndicator"],
26
+ loadingWrapper: ["loadingWrapper"]
27
+ };
28
+ return V(p, K, e);
29
+ }, X = A(H, {
30
+ name: "MuiIconButton",
31
+ slot: "Root",
32
+ overridesResolver: (o, e) => {
33
+ const {
34
+ ownerState: a
35
+ } = o;
36
+ return [e.root, a.loading && e.loading, a.color !== "default" && e[`color${g(a.color)}`], a.edge && e[`edge${g(a.edge)}`], e[`size${g(a.size)}`]];
37
+ }
38
+ })(z(({
39
+ theme: o
40
+ }) => ({
41
+ textAlign: "center",
42
+ flex: "0 0 auto",
43
+ fontSize: o.typography.pxToRem(24),
44
+ padding: 8,
45
+ borderRadius: "50%",
46
+ color: (o.vars || o).palette.action.active,
47
+ transition: o.transitions.create("background-color", {
48
+ duration: o.transitions.duration.shortest
49
+ }),
50
+ variants: [{
51
+ props: (e) => !e.disableRipple,
52
+ style: {
53
+ "--IconButton-hoverBg": o.alpha((o.vars || o).palette.action.active, (o.vars || o).palette.action.hoverOpacity),
54
+ "&:hover": {
55
+ backgroundColor: "var(--IconButton-hoverBg)",
56
+ // Reset on touch devices, it doesn't add specificity
57
+ "@media (hover: none)": {
58
+ backgroundColor: "transparent"
59
+ }
60
+ }
61
+ }
62
+ }, {
63
+ props: {
64
+ edge: "start"
65
+ },
66
+ style: {
67
+ marginLeft: -12
68
+ }
69
+ }, {
70
+ props: {
71
+ edge: "start",
72
+ size: "small"
73
+ },
74
+ style: {
75
+ marginLeft: -3
76
+ }
77
+ }, {
78
+ props: {
79
+ edge: "end"
80
+ },
81
+ style: {
82
+ marginRight: -12
83
+ }
84
+ }, {
85
+ props: {
86
+ edge: "end",
87
+ size: "small"
88
+ },
89
+ style: {
90
+ marginRight: -3
91
+ }
92
+ }]
93
+ })), z(({
94
+ theme: o
95
+ }) => ({
96
+ variants: [{
97
+ props: {
98
+ color: "inherit"
99
+ },
100
+ style: {
101
+ color: "inherit"
102
+ }
103
+ }, ...Object.entries(o.palette).filter(R()).map(([e]) => ({
104
+ props: {
105
+ color: e
106
+ },
107
+ style: {
108
+ color: (o.vars || o).palette[e].main
109
+ }
110
+ })), ...Object.entries(o.palette).filter(R()).map(([e]) => ({
111
+ props: {
112
+ color: e
113
+ },
114
+ style: {
115
+ "--IconButton-hoverBg": o.alpha((o.vars || o).palette[e].main, (o.vars || o).palette.action.hoverOpacity)
116
+ }
117
+ })), {
118
+ props: {
119
+ size: "small"
120
+ },
121
+ style: {
122
+ padding: 5,
123
+ fontSize: o.typography.pxToRem(18)
124
+ }
125
+ }, {
126
+ props: {
127
+ size: "large"
128
+ },
129
+ style: {
130
+ padding: 12,
131
+ fontSize: o.typography.pxToRem(28)
132
+ }
133
+ }],
134
+ [`&.${L.disabled}`]: {
135
+ backgroundColor: "transparent",
136
+ color: (o.vars || o).palette.action.disabled
137
+ },
138
+ [`&.${L.loading}`]: {
139
+ color: "transparent"
140
+ }
141
+ }))), oo = A("span", {
142
+ name: "MuiIconButton",
143
+ slot: "LoadingIndicator"
144
+ })(({
145
+ theme: o
146
+ }) => ({
147
+ display: "none",
148
+ position: "absolute",
149
+ visibility: "visible",
150
+ top: "50%",
151
+ left: "50%",
152
+ transform: "translate(-50%, -50%)",
153
+ color: (o.vars || o).palette.action.disabled,
154
+ variants: [{
155
+ props: {
156
+ loading: !0
157
+ },
158
+ style: {
159
+ display: "flex"
160
+ }
161
+ }]
162
+ })), S = /* @__PURE__ */ T.forwardRef(function(e, a) {
163
+ const l = $({
164
+ props: e,
165
+ name: "MuiIconButton"
166
+ }), {
167
+ edge: d = !1,
168
+ children: u,
169
+ className: m,
170
+ color: p = "default",
171
+ disabled: h = !1,
172
+ disableFocusRipple: f = !1,
173
+ size: C = "medium",
174
+ id: s,
175
+ loading: c = null,
176
+ loadingIndicator: v,
177
+ ...I
178
+ } = l, y = Z(s), x = v ?? /* @__PURE__ */ n(G, {
179
+ "aria-labelledby": y,
180
+ color: "inherit",
181
+ size: 16
182
+ }), _ = {
183
+ ...l,
184
+ edge: d,
185
+ color: p,
186
+ disabled: h,
187
+ disableFocusRipple: f,
188
+ loading: c,
189
+ loadingIndicator: x,
190
+ size: C
191
+ }, w = Q(_);
192
+ return /* @__PURE__ */ B(X, {
193
+ id: c ? y : s,
194
+ className: F(w.root, m),
195
+ centerRipple: !0,
196
+ focusRipple: !f,
197
+ disabled: h || c,
198
+ ref: a,
199
+ ...I,
200
+ ownerState: _,
201
+ children: [typeof c == "boolean" && // use plain HTML span to minimize the runtime overhead
202
+ /* @__PURE__ */ n("span", {
203
+ className: w.loadingWrapper,
204
+ style: {
205
+ display: "contents"
206
+ },
207
+ children: /* @__PURE__ */ n(oo, {
208
+ className: w.loadingIndicator,
209
+ ownerState: _,
210
+ children: c && x
211
+ })
212
+ }), u]
31
213
  });
32
- }
33
- const V = I("MuiBox", ["root"]), W = j(), D = G({
34
- themeId: S,
35
- defaultTheme: W,
36
- defaultClassName: V.root,
37
- generateClassName: O.generate
38
214
  });
39
- process.env.NODE_ENV !== "production" && (D.propTypes = {
215
+ process.env.NODE_ENV !== "production" && (S.propTypes = {
40
216
  // ┌────────────────────────────── Warning ──────────────────────────────┐
41
217
  // │ These PropTypes are generated from the TypeScript type definitions. │
42
218
  // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
43
219
  // └─────────────────────────────────────────────────────────────────────┘
220
+ /**
221
+ * The icon to display.
222
+ */
223
+ children: Y(t.node, (o) => T.Children.toArray(o.children).some((a) => /* @__PURE__ */ T.isValidElement(a) && a.props.onClick) ? new Error(["MUI: You are providing an onClick event listener to a child of a button element.", "Prefer applying it to the IconButton directly.", "This guarantees that the whole <button> will be responsive to click events."].join(`
224
+ `)) : null),
225
+ /**
226
+ * Override or extend the styles applied to the component.
227
+ */
228
+ classes: t.object,
229
+ /**
230
+ * @ignore
231
+ */
232
+ className: t.string,
233
+ /**
234
+ * The color of the component.
235
+ * It supports both default and custom theme colors, which can be added as shown in the
236
+ * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
237
+ * @default 'default'
238
+ */
239
+ color: t.oneOfType([t.oneOf(["inherit", "default", "primary", "secondary", "error", "info", "success", "warning"]), t.string]),
240
+ /**
241
+ * If `true`, the component is disabled.
242
+ * @default false
243
+ */
244
+ disabled: t.bool,
245
+ /**
246
+ * If `true`, the keyboard focus ripple is disabled.
247
+ * @default false
248
+ */
249
+ disableFocusRipple: t.bool,
250
+ /**
251
+ * If `true`, the ripple effect is disabled.
252
+ *
253
+ * ⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure
254
+ * to highlight the element by applying separate styles with the `.Mui-focusVisible` class.
255
+ * @default false
256
+ */
257
+ disableRipple: t.bool,
258
+ /**
259
+ * If given, uses a negative margin to counteract the padding on one
260
+ * side (this is often helpful for aligning the left or right
261
+ * side of the icon with content above or below, without ruining the border
262
+ * size and shape).
263
+ * @default false
264
+ */
265
+ edge: t.oneOf(["end", "start", !1]),
44
266
  /**
45
267
  * @ignore
46
268
  */
47
- children: o.node,
269
+ id: t.string,
270
+ /**
271
+ * If `true`, the loading indicator is visible and the button is disabled.
272
+ * If `true | false`, the loading wrapper is always rendered before the children to prevent [Google Translation Crash](https://github.com/mui/material-ui/issues/27853).
273
+ * @default null
274
+ */
275
+ loading: t.bool,
276
+ /**
277
+ * Element placed before the children if the button is in loading state.
278
+ * The node should contain an element with `role="progressbar"` with an accessible name.
279
+ * By default, it renders a `CircularProgress` that is labeled by the button itself.
280
+ * @default <CircularProgress color="inherit" size={16} />
281
+ */
282
+ loadingIndicator: t.node,
48
283
  /**
49
- * The component used for the root node.
50
- * Either a string to use a HTML element or a component.
284
+ * The size of the component.
285
+ * `small` is equivalent to the dense button styling.
286
+ * @default 'medium'
51
287
  */
52
- component: o.elementType,
288
+ size: t.oneOfType([t.oneOf(["small", "medium", "large"]), t.string]),
53
289
  /**
54
290
  * The system prop that allows defining system overrides as well as additional CSS styles.
55
291
  */
56
- sx: o.oneOfType([o.arrayOf(o.oneOfType([o.func, o.object, o.bool])), o.func, o.object])
292
+ sx: t.oneOfType([t.arrayOf(t.oneOfType([t.func, t.object, t.bool])), t.func, t.object])
57
293
  });
58
- const q = "_dialog_jouds_1", J = "_dialogText_jouds_1", N = {
59
- dialog: q,
60
- dialogText: J
61
- }, eo = (m) => {
294
+ const to = "data:image/svg+xml,%3csvg%20width='46'%20height='46'%20viewBox='0%200%2046%2046'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M17.3434%2015.4595C16.8227%2014.9388%2015.9785%2014.9388%2015.4578%2015.4595C14.9371%2015.9802%2014.9371%2016.8244%2015.4578%2017.3451L21.1146%2023.002L15.4578%2028.6588C14.9371%2029.1795%2014.9371%2030.0237%2015.4578%2030.5444C15.9785%2031.0651%2016.8227%2031.0651%2017.3434%2030.5444L23.0002%2024.8876L28.6571%2030.5444C29.1778%2031.0651%2030.022%2031.0651%2030.5427%2030.5444C31.0634%2030.0237%2031.0634%2029.1795%2030.5427%2028.6588L24.8858%2023.002L30.5427%2017.3451C31.0634%2016.8244%2031.0634%2015.9802%2030.5427%2015.4595C30.022%2014.9388%2029.1778%2014.9388%2028.6571%2015.4595L23.0002%2021.1163L17.3434%2015.4595Z'%20fill='%233AA8FF'/%3e%3c/svg%3e", eo = "_dialog_wdj3q_1", ao = "_topActions_wdj3q_6", no = "_close_wdj3q_12", io = "_botActions_wdj3q_16", ro = "_button_wdj3q_19", so = "_title_wdj3q_22", lo = "_content_wdj3q_28", co = "_crop_wdj3q_36", po = "_dialogText_wdj3q_45", r = {
295
+ dialog: eo,
296
+ topActions: ao,
297
+ close: no,
298
+ botActions: io,
299
+ button: ro,
300
+ title: so,
301
+ content: lo,
302
+ crop: co,
303
+ dialogText: po
304
+ }, _o = (o) => {
62
305
  const {
63
- onCloseDialogHandler: s,
64
- photoSource: n,
306
+ onCloseDialogHandler: e,
307
+ photoSource: a,
65
308
  photoCrop: l,
66
- onCropChange: c = () => {
309
+ onCropChange: d = () => {
67
310
  },
68
- onPhotoLoad: p,
69
- imageRef: x,
70
- photoError: a,
311
+ onPhotoLoad: u,
312
+ imageRef: m,
313
+ photoError: p,
71
314
  onPhotoCrop: h,
72
- minDimension: i = L,
73
- aspectRatio: r = R,
74
- locale: t = A,
75
- circular: g,
76
- keepSelection: f = !0,
77
- className: _,
78
- ...E
79
- } = m;
80
- return /* @__PURE__ */ u(
81
- v,
315
+ minDimension: f = D,
316
+ aspectRatio: C = P,
317
+ locale: s = O,
318
+ circular: c,
319
+ keepSelection: v = !0,
320
+ className: I,
321
+ ...y
322
+ } = o;
323
+ return /* @__PURE__ */ B(
324
+ E,
82
325
  {
83
- className: C(N.dialog, _),
84
- onClose: s,
85
- ...E,
326
+ className: i(r.dialog, I),
327
+ onClose: e,
328
+ ...y,
86
329
  children: [
87
- /* @__PURE__ */ e(F, { children: d[t]["photo-crop"] }),
88
- /* @__PURE__ */ u(U, { children: [
89
- n && /* @__PURE__ */ e(D, { children: /* @__PURE__ */ e(
90
- y,
330
+ /* @__PURE__ */ n(N, { className: i(r.topActions), children: /* @__PURE__ */ n(
331
+ S,
332
+ {
333
+ onClick: e,
334
+ className: i(r.close),
335
+ "aria-label": b[s].back,
336
+ children: /* @__PURE__ */ n(
337
+ "img",
338
+ {
339
+ width: 40,
340
+ height: 40,
341
+ src: to,
342
+ alt: b[s].back
343
+ }
344
+ )
345
+ }
346
+ ) }),
347
+ /* @__PURE__ */ n(k, { className: i(r.title), children: b[s]["photo-crop"] }),
348
+ /* @__PURE__ */ B(M, { className: i(r.content), children: [
349
+ a && /* @__PURE__ */ n(
350
+ j,
91
351
  {
352
+ className: i(r.crop),
92
353
  crop: l,
93
- circularCrop: g,
94
- keepSelection: f,
95
- aspect: r,
96
- minWidth: i,
97
- minHeight: i,
98
- onChange: c,
99
- children: /* @__PURE__ */ e(
354
+ circularCrop: c,
355
+ keepSelection: v,
356
+ aspect: C,
357
+ minWidth: f,
358
+ minHeight: f,
359
+ onChange: d,
360
+ children: /* @__PURE__ */ n(
100
361
  "img",
101
362
  {
102
- onLoad: p,
103
- src: n,
104
- ref: x,
105
- alt: d[t]["photo-crop"],
363
+ onLoad: u,
364
+ src: a,
365
+ ref: m,
366
+ alt: b[s]["photo-crop"],
106
367
  draggable: !1
107
368
  }
108
369
  )
109
370
  }
110
- ) }),
111
- a && /* @__PURE__ */ e(H, { className: C(N.dialogText), children: a })
371
+ ),
372
+ p && /* @__PURE__ */ n(q, { className: i(r.dialogText), children: p })
112
373
  ] }),
113
- /* @__PURE__ */ u(w, { children: [
114
- /* @__PURE__ */ e(T, { onClick: s, children: d[t].back }),
115
- /* @__PURE__ */ e(T, { onClick: h, children: d[t].crop })
116
- ] })
374
+ /* @__PURE__ */ n(N, { className: i(r.botActions), children: /* @__PURE__ */ n(
375
+ J,
376
+ {
377
+ minWidth: "100%",
378
+ buttonSize: "small",
379
+ buttonColor: "blue",
380
+ buttonVariant: "filled",
381
+ buttonWeight: 500,
382
+ className: i(r.button),
383
+ onClick: h,
384
+ children: b[s].crop
385
+ }
386
+ ) })
117
387
  ]
118
388
  }
119
389
  );
120
390
  };
121
391
  export {
122
- eo as UploadDialog
392
+ _o as UploadDialog
123
393
  };
@@ -1,5 +1,5 @@
1
1
  export declare const DEFAULT_ASPECT_RATIO = 1;
2
- export declare const DEFAULT_MIN_DIMENSION = 150;
2
+ export declare const DEFAULT_MIN_DIMENSION = 670;
3
3
  export declare const JPG_IMAGE_EXT = ".jpg";
4
4
  export declare const JPEG_IMAGE_EXT = ".jpeg";
5
5
  export declare const PNG_IMAGE_EXT = ".png";
@@ -1,5 +1,5 @@
1
1
  import { BYTE_TO_KILOBYTE as T } from "../../constants.js";
2
- const S = 1, e = 150, E = ".jpg", _ = ".jpeg", G = ".png", M = ".svg", P = ".bmp", o = ".gif", I = ".ico", A = ".webp", p = [
2
+ const S = 1, e = 670, E = ".jpg", _ = ".jpeg", G = ".png", M = ".svg", P = ".bmp", o = ".gif", I = ".ico", A = ".webp", p = [
3
3
  E,
4
4
  _,
5
5
  G,
@@ -2,8 +2,8 @@ const e = {
2
2
  en: {
3
3
  upload: "Upload a photo",
4
4
  drop: "Drop the file here",
5
- "photo-crop": "Cropping a photo",
6
- crop: "Crop",
5
+ "photo-crop": "Select the display area",
6
+ crop: "Save",
7
7
  back: "Back",
8
8
  "photo-size-error": "The photo size must be at least",
9
9
  pixels: "pixels",
@@ -23,8 +23,8 @@ const e = {
23
23
  ru: {
24
24
  upload: "Загрузить фото",
25
25
  drop: "Отпустите файл здесь",
26
- "photo-crop": "Обрезка фотографии",
27
- crop: "Обрезать",
26
+ "photo-crop": "Выберите отображаемую область",
27
+ crop: "Сохранить",
28
28
  back: "Назад",
29
29
  "photo-size-error": "Размер фотографии должен быть не меньше",
30
30
  pixels: "пикселей",