@mailstep/design-system 0.6.79 → 0.6.80-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailstep/design-system",
3
- "version": "0.6.79",
3
+ "version": "0.6.80-beta.0",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "./ui/index.js",
@@ -18,12 +18,12 @@ import { ImageElement } from './components/ImageElement';
18
18
  import { x } from '@xstyled/styled-components';
19
19
  import { ImageListContainer } from './styles';
20
20
  export var ImageList = function (_a) {
21
- var onImageUpload = _a.onImageUpload, onImageRemove = _a.onImageRemove, lightBoxAction = _a.lightBoxAction, lightBoxActionTitle = _a.lightBoxActionTitle, images = _a.images, isDisabled = _a.isDisabled;
21
+ var onImageUpload = _a.onImageUpload, onImageRemove = _a.onImageRemove, onImageClick = _a.onImageClick, lightBoxAction = _a.lightBoxAction, lightBoxActionTitle = _a.lightBoxActionTitle, images = _a.images, isDisabled = _a.isDisabled;
22
22
  var ref = useRef();
23
23
  var events = useDraggable(ref, { isMounted: !!(images === null || images === void 0 ? void 0 : images.length) }).events;
24
24
  var _b = useLightBox(), isLightBoxOpen = _b.isLightBoxOpen, onCloseLightBox = _b.onCloseLightBox, onOpenLightBox = _b.onOpenLightBox, lightBoxData = _b.lightBoxData;
25
25
  return (_jsxs(x.div, { display: "flex", alignItems: "flex-end", children: [_jsx(AddPhoto, { onImageUpload: onImageUpload, isDisabled: isDisabled }), images && (_jsx(ImageListContainer, __assign({ ref: ref }, events, { children: images.map(function (item, index) {
26
26
  var _a, _b;
27
- return (_jsx(ImageElement, { imageUrl: (_a = item.smallUrl) !== null && _a !== void 0 ? _a : item.url, onImageRemove: onImageRemove === null || onImageRemove === void 0 ? void 0 : onImageRemove(item.id), onOpenLightBox: onOpenLightBox(index), isDisabled: isDisabled, label: item === null || item === void 0 ? void 0 : item.label }, (_b = item.id) !== null && _b !== void 0 ? _b : index));
27
+ return (_jsx(ImageElement, { imageUrl: (_a = item.smallUrl) !== null && _a !== void 0 ? _a : item.url, onImageRemove: onImageRemove === null || onImageRemove === void 0 ? void 0 : onImageRemove(item.id), onClick: onImageClick || onOpenLightBox(index), isDisabled: isDisabled, label: item === null || item === void 0 ? void 0 : item.label }, (_b = item.id) !== null && _b !== void 0 ? _b : index));
28
28
  }) }))), _jsx(LightBox, { initialSlide: lightBoxData === null || lightBoxData === void 0 ? void 0 : lightBoxData.initialSlide, isLightBoxOpen: isLightBoxOpen, onCloseLightBox: onCloseLightBox, lightBoxAction: lightBoxAction, lightBoxActionTitle: lightBoxActionTitle, images: images })] }));
29
29
  };
@@ -2,7 +2,7 @@ import { type FC } from 'react';
2
2
  interface ImageElementProps {
3
3
  label?: string;
4
4
  onImageRemove?: () => void;
5
- onOpenLightBox: () => void;
5
+ onClick: () => void;
6
6
  imageUrl: string | undefined;
7
7
  isDisabled?: boolean;
8
8
  }
@@ -4,8 +4,8 @@ import { ImageTag } from '../ImageTag';
4
4
  import { CloseButton } from '../CloseButton';
5
5
  import { x } from '@xstyled/styled-components';
6
6
  export var ImageElement = function (_a) {
7
- var label = _a.label, onImageRemove = _a.onImageRemove, isDisabled = _a.isDisabled, onOpenLightBox = _a.onOpenLightBox, imageUrl = _a.imageUrl;
7
+ var label = _a.label, onImageRemove = _a.onImageRemove, isDisabled = _a.isDisabled, onClick = _a.onClick, imageUrl = _a.imageUrl;
8
8
  if (!imageUrl)
9
9
  return null;
10
- return (_jsxs(x.div, { position: "relative", pr: "15px", pt: "15px", w: "100px", h: "100px", children: [_jsx(Image, { src: imageUrl, alt: "", width: "85px", height: "85px", onClick: onOpenLightBox }), onImageRemove && _jsx(CloseButton, { onImageRemove: onImageRemove, isDisabled: isDisabled }), _jsx(ImageTag, { label: label })] }));
10
+ return (_jsxs(x.div, { position: "relative", pr: "15px", pt: "15px", w: "100px", h: "100px", children: [_jsx(Image, { src: imageUrl, alt: "", width: "85px", height: "85px", onClick: onClick }), onImageRemove && _jsx(CloseButton, { onImageRemove: onImageRemove, isDisabled: isDisabled }), _jsx(ImageTag, { label: label })] }));
11
11
  };
@@ -8,6 +8,7 @@ export interface ImageListProps {
8
8
  images: ImageData[] | undefined;
9
9
  onImageUpload?: (props: ImageUploadProps) => Promise<void>;
10
10
  onImageRemove?: (id?: string) => () => void;
11
+ onImageClick?: (id?: string) => void;
11
12
  lightBoxAction?: (id?: string) => () => Promise<void>;
12
13
  lightBoxActionTitle?: string;
13
14
  isDisabled?: boolean;
package/ui/index.es.js CHANGED
@@ -50505,7 +50505,7 @@ const jEe = q.img`
50505
50505
  label: e,
50506
50506
  onImageRemove: t,
50507
50507
  isDisabled: r,
50508
- onOpenLightBox: n,
50508
+ onClick: n,
50509
50509
  imageUrl: i
50510
50510
  }) => i ? /* @__PURE__ */ g.jsxs(it.div, { position: "relative", pr: "15px", pt: "15px", w: "100px", h: "100px", children: [
50511
50511
  /* @__PURE__ */ g.jsx(jEe, { src: i, alt: "", width: "85px", height: "85px", onClick: n }),
@@ -50524,25 +50524,26 @@ const jEe = q.img`
50524
50524
  `, iTe = ({
50525
50525
  onImageUpload: e,
50526
50526
  onImageRemove: t,
50527
- lightBoxAction: r,
50528
- lightBoxActionTitle: n,
50529
- images: i,
50530
- isDisabled: o
50527
+ onImageClick: r,
50528
+ lightBoxAction: n,
50529
+ lightBoxActionTitle: i,
50530
+ images: o,
50531
+ isDisabled: l
50531
50532
  }) => {
50532
- const l = We(), {
50533
- events: c
50534
- } = eSe(l, {
50535
- isMounted: !!(i != null && i.length)
50533
+ const c = We(), {
50534
+ events: u
50535
+ } = eSe(c, {
50536
+ isMounted: !!(o != null && o.length)
50536
50537
  }), {
50537
- isLightBoxOpen: u,
50538
- onCloseLightBox: f,
50539
- onOpenLightBox: p,
50540
- lightBoxData: A
50538
+ isLightBoxOpen: f,
50539
+ onCloseLightBox: p,
50540
+ onOpenLightBox: A,
50541
+ lightBoxData: v
50541
50542
  } = REe();
50542
50543
  return /* @__PURE__ */ g.jsxs(it.div, { display: "flex", alignItems: "flex-end", children: [
50543
- /* @__PURE__ */ g.jsx(VEe, { onImageUpload: e, isDisabled: o }),
50544
- i && /* @__PURE__ */ g.jsx(KEe, { ref: l, ...c, children: i.map((v, m) => /* @__PURE__ */ g.jsx(QEe, { imageUrl: v.smallUrl ?? v.url, onImageRemove: t == null ? void 0 : t(v.id), onOpenLightBox: p(m), isDisabled: o, label: v == null ? void 0 : v.label }, v.id ?? m)) }),
50545
- /* @__PURE__ */ g.jsx(NEe, { initialSlide: A == null ? void 0 : A.initialSlide, isLightBoxOpen: u, onCloseLightBox: f, lightBoxAction: r, lightBoxActionTitle: n, images: i })
50544
+ /* @__PURE__ */ g.jsx(VEe, { onImageUpload: e, isDisabled: l }),
50545
+ o && /* @__PURE__ */ g.jsx(KEe, { ref: c, ...u, children: o.map((m, y) => /* @__PURE__ */ g.jsx(QEe, { imageUrl: m.smallUrl ?? m.url, onImageRemove: t == null ? void 0 : t(m.id), onClick: r || A(y), isDisabled: l, label: m == null ? void 0 : m.label }, m.id ?? y)) }),
50546
+ /* @__PURE__ */ g.jsx(NEe, { initialSlide: v == null ? void 0 : v.initialSlide, isLightBoxOpen: f, onCloseLightBox: p, lightBoxAction: n, lightBoxActionTitle: i, images: o })
50546
50547
  ] });
50547
50548
  }, qEe = q.div`
50548
50549
  cursor: pointer;
package/ui/index.umd.js CHANGED
@@ -3322,7 +3322,7 @@ ${q.current.stack}
3322
3322
  justify-content: center;
3323
3323
  cursor: pointer;
3324
3324
  transition: all 0.2s linear;
3325
- `,XIe=({onImageRemove:e,isDisabled:t})=>g.jsx(JIe,{onClick:t?void 0:e,isDisabled:t,children:g.jsx(xt,{icon:"close",size:"22px",fill:t?"magenta60":"red1"})}),QIe=({label:e,onImageRemove:t,isDisabled:r,onOpenLightBox:n,imageUrl:i})=>i?g.jsxs(tt.div,{position:"relative",pr:"15px",pt:"15px",w:"100px",h:"100px",children:[g.jsx(jIe,{src:i,alt:"",width:"85px",height:"85px",onClick:n}),t&&g.jsx(XIe,{onImageRemove:t,isDisabled:r}),g.jsx(YIe,{label:e})]}):null,KIe=$.div`
3325
+ `,XIe=({onImageRemove:e,isDisabled:t})=>g.jsx(JIe,{onClick:t?void 0:e,isDisabled:t,children:g.jsx(xt,{icon:"close",size:"22px",fill:t?"magenta60":"red1"})}),QIe=({label:e,onImageRemove:t,isDisabled:r,onClick:n,imageUrl:i})=>i?g.jsxs(tt.div,{position:"relative",pr:"15px",pt:"15px",w:"100px",h:"100px",children:[g.jsx(jIe,{src:i,alt:"",width:"85px",height:"85px",onClick:n}),t&&g.jsx(XIe,{onImageRemove:t,isDisabled:r}),g.jsx(YIe,{label:e})]}):null,KIe=$.div`
3326
3326
  display: flex;
3327
3327
  overflow-x: scroll;
3328
3328
  -ms-overflow-style: none;
@@ -3332,7 +3332,7 @@ ${q.current.stack}
3332
3332
  &::-webkit-scrollbar {
3333
3333
  display: none;
3334
3334
  }
3335
- `,qIe=({onImageUpload:e,onImageRemove:t,lightBoxAction:r,lightBoxActionTitle:n,images:i,isDisabled:o})=>{const l=I.useRef(),{events:u}=rEe(l,{isMounted:!!(i!=null&&i.length)}),{isLightBoxOpen:c,onCloseLightBox:f,onOpenLightBox:A,lightBoxData:p}=ZV();return g.jsxs(tt.div,{display:"flex",alignItems:"flex-end",children:[g.jsx(VIe,{onImageUpload:e,isDisabled:o}),i&&g.jsx(KIe,{ref:l,...u,children:i.map((v,m)=>g.jsx(QIe,{imageUrl:v.smallUrl??v.url,onImageRemove:t==null?void 0:t(v.id),onOpenLightBox:A(m),isDisabled:o,label:v==null?void 0:v.label},v.id??m))}),g.jsx(UV,{initialSlide:p==null?void 0:p.initialSlide,isLightBoxOpen:c,onCloseLightBox:f,lightBoxAction:r,lightBoxActionTitle:n,images:i})]})},$Ie=$.div`
3335
+ `,qIe=({onImageUpload:e,onImageRemove:t,onImageClick:r,lightBoxAction:n,lightBoxActionTitle:i,images:o,isDisabled:l})=>{const u=I.useRef(),{events:c}=rEe(u,{isMounted:!!(o!=null&&o.length)}),{isLightBoxOpen:f,onCloseLightBox:A,onOpenLightBox:p,lightBoxData:v}=ZV();return g.jsxs(tt.div,{display:"flex",alignItems:"flex-end",children:[g.jsx(VIe,{onImageUpload:e,isDisabled:l}),o&&g.jsx(KIe,{ref:u,...c,children:o.map((m,y)=>g.jsx(QIe,{imageUrl:m.smallUrl??m.url,onImageRemove:t==null?void 0:t(m.id),onClick:r||p(y),isDisabled:l,label:m==null?void 0:m.label},m.id??y))}),g.jsx(UV,{initialSlide:v==null?void 0:v.initialSlide,isLightBoxOpen:f,onCloseLightBox:A,lightBoxAction:n,lightBoxActionTitle:i,images:o})]})},$Ie=$.div`
3336
3336
  cursor: pointer;
3337
3337
  font-size: 16px;
3338
3338
  display: flex;