@sendoutcards/quantum-design-ui 1.7.84 → 1.7.85

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/index.es.js CHANGED
@@ -22767,10 +22767,12 @@ var isDragEventType = function (event) {
22767
22767
  return 'dataTransfer' in event;
22768
22768
  };
22769
22769
 
22770
- var useFileUpload = function (props) {
22771
- var _a = React.useState(null),
22772
- error = _a[0],
22773
- setError = _a[1];
22770
+ var ImageUploader = function (props) {
22771
+ var _a, _b;
22772
+
22773
+ var _c = React.useState(null),
22774
+ error = _c[0],
22775
+ setError = _c[1];
22774
22776
 
22775
22777
  var onUpload = props.onUpload;
22776
22778
  var onDrop = useCallback(function (acceptedFiles, rejectedFiles, event) {
@@ -22801,34 +22803,19 @@ var useFileUpload = function (props) {
22801
22803
  var onDragEnter = useCallback(function () {
22802
22804
  setError(null);
22803
22805
  }, []);
22804
- var dropzone = useDropzone({
22806
+
22807
+ var _d = useDropzone({
22805
22808
  onDrop: onDrop,
22806
22809
  accept: parseAcceptedFiles(props.acceptedFiles),
22807
- multiple: props.hasMultiUpload,
22810
+ multiple: props.hasMultiupload,
22808
22811
  maxFiles: props.maxAcceptedFiles,
22809
22812
  maxSize: props.maxFileSize,
22810
22813
  onDragEnter: onDragEnter
22811
- });
22812
- return [__assign({
22813
- onDragEnter: onDragEnter
22814
- }, dropzone), error];
22815
- };
22814
+ }),
22815
+ getRootProps = _d.getRootProps,
22816
+ getInputProps = _d.getInputProps,
22817
+ isDragActive = _d.isDragActive;
22816
22818
 
22817
- var ImageUploader = function (props) {
22818
- var _a, _b;
22819
-
22820
- props.uploadTitle;
22821
- props.backgroundColor;
22822
- var hookProps = __rest(props, ["uploadTitle", "backgroundColor"]);
22823
-
22824
- var _c = useFileUpload(hookProps),
22825
- dropzone = _c[0],
22826
- error = _c[1];
22827
-
22828
- var isDragActive = dropzone.isDragActive,
22829
- getRootProps = dropzone.getRootProps,
22830
- getInputProps = dropzone.getInputProps,
22831
- onDragEnter = dropzone.onDragEnter;
22832
22819
  return jsx(React.Fragment, null, jsx(Flex, {
22833
22820
  inset: "x1",
22834
22821
  flexWrap: "wrap",
@@ -22869,9 +22856,6 @@ var ImageUploader = function (props) {
22869
22856
  }), jsx(Text, {
22870
22857
  type: "largeBody",
22871
22858
  content: (_b = props.uploadTitle) !== null && _b !== void 0 ? _b : 'Upload Photo'
22872
- }), jsx(Text, {
22873
- type: "footnote",
22874
- content: "Drag and Drop Image Here"
22875
22859
  })))), error && jsx(Text, {
22876
22860
  type: "footnote",
22877
22861
  content: error,
@@ -22893,26 +22877,25 @@ var ImageUploadWidget = function (_a) {
22893
22877
  var _b = _a.title,
22894
22878
  title = _b === void 0 ? 'Image Background' : _b,
22895
22879
  onFinished = _a.onFinished,
22880
+ onUpload = _a.onUpload,
22896
22881
  x = _a.x,
22897
22882
  y = _a.y,
22898
22883
  isOpen = _a.isOpen,
22884
+ _c = _a.hasMultiUpload,
22885
+ hasMultiUpload = _c === void 0 ? false : _c,
22899
22886
  userImages = _a.userImages,
22900
22887
  hasMore = _a.hasMore,
22901
22888
  loadMore = _a.loadMore,
22902
22889
  endMessage = _a.endMessage,
22903
22890
  dataLength = _a.dataLength,
22904
- _c = _a.width,
22905
- width = _c === void 0 ? 264 : _c,
22906
- hookProps = __rest(_a, ["title", "onFinished", "x", "y", "isOpen", "userImages", "hasMore", "loadMore", "endMessage", "dataLength", "width"]);
22891
+ _d = _a.width,
22892
+ width = _d === void 0 ? 264 : _d;
22907
22893
 
22908
- var _d = useState(false),
22909
- shouldShowImageGrid = _d[0],
22910
- setShouldShowImageGrid = _d[1];
22894
+ var _e = useState(false),
22895
+ shouldShowImageGrid = _e[0],
22896
+ setShouldShowImageGrid = _e[1];
22911
22897
 
22912
22898
  var inputRef = useRef(null);
22913
- var dropzone = useFileUpload(hookProps)[0];
22914
- var getInputProps = dropzone.getInputProps,
22915
- onDragEnter = dropzone.onDragEnter;
22916
22899
  return jsx(AnimatePresence, null, isOpen && jsx(Div, {
22917
22900
  initial: {
22918
22901
  opacity: 0
@@ -23021,7 +23004,11 @@ var ImageUploadWidget = function (_a) {
23021
23004
  url: image.url
23022
23005
  }
23023
23006
  })));
23024
- }))))) : jsx(ImageUploader, hookProps)), jsx(HStack, {
23007
+ }))))) : jsx(ImageUploader, {
23008
+ onUpload: onUpload,
23009
+ acceptedFiles: ['gif', 'jpeg', 'jpg', 'png'],
23010
+ hasMultiupload: hasMultiUpload
23011
+ })), jsx(HStack, {
23025
23012
  outset: "x1",
23026
23013
  justify: "center",
23027
23014
  gap: "x1"
@@ -23041,10 +23028,23 @@ var ImageUploadWidget = function (_a) {
23041
23028
  size: "small",
23042
23029
  type: "smoke",
23043
23030
  title: "Upload..."
23044
- }), jsx("input", _extends({}, getInputProps(), {
23031
+ }), jsx("input", {
23045
23032
  ref: inputRef,
23046
- onClick: onDragEnter
23047
- }))), jsx(Div, {
23033
+ type: "file",
23034
+ accept: "image/*",
23035
+ style: {
23036
+ display: 'none'
23037
+ },
23038
+ onChange: function (e) {
23039
+ var _a, _b;
23040
+
23041
+ var file = (_b = (_a = e.target) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b[0];
23042
+ if (file) onUpload({
23043
+ accepted: [file],
23044
+ rejected: []
23045
+ });
23046
+ }
23047
+ })), jsx(Div, {
23048
23048
  width: "120px"
23049
23049
  }, jsx(Button, {
23050
23050
  onClick: function () {
@@ -24287,8 +24287,7 @@ var StackedCardHead = function (_a) {
24287
24287
  var cardImage = _a.cardImage,
24288
24288
  cardOrientation = _a.cardOrientation,
24289
24289
  quantity = _a.quantity,
24290
- quantityDescription = _a.quantityDescription,
24291
- secondaryAction = _a.secondaryAction;
24290
+ quantityDescription = _a.quantityDescription;
24292
24291
  return jsx(VStack, {
24293
24292
  gap: "x2"
24294
24293
  }, jsx(StackedCards, {
@@ -24296,7 +24295,7 @@ var StackedCardHead = function (_a) {
24296
24295
  height: cardOrientation === 'vertical' ? 285 : 200,
24297
24296
  stackBackgroundColor: "background",
24298
24297
  backgroundImage: cardImage
24299
- }), secondaryAction && secondaryAction, jsx(Text, {
24298
+ }), jsx(Text, {
24300
24299
  type: "largeBody",
24301
24300
  weight: "bold",
24302
24301
  color: "primaryHeading",
@@ -24313,16 +24312,14 @@ var CardQuantitySlider = function (props) {
24313
24312
  var cardOrientation = props.cardOrientation,
24314
24313
  cardImage = props.cardImage,
24315
24314
  quantityDescription = props.quantityDescription,
24316
- secondaryAction = props.secondaryAction,
24317
- rest = __rest(props, ["cardOrientation", "cardImage", "quantityDescription", "secondaryAction"]);
24315
+ rest = __rest(props, ["cardOrientation", "cardImage", "quantityDescription"]);
24318
24316
 
24319
24317
  return jsx(React.Fragment, null, jsx(QuantitySlider, _extends({}, rest, {
24320
24318
  head: jsx(StackedCardHead, {
24321
24319
  cardOrientation: cardOrientation,
24322
24320
  quantity: rest.quantity,
24323
24321
  quantityDescription: quantityDescription,
24324
- cardImage: cardImage,
24325
- secondaryAction: secondaryAction
24322
+ cardImage: cardImage
24326
24323
  })
24327
24324
  })));
24328
24325
  };
@@ -24348,8 +24345,7 @@ var BulkSend = function (_a) {
24348
24345
  isConfigurable = _a.isConfigurable,
24349
24346
  disableMessage = _a.disableMessage,
24350
24347
  sliderOrientation = _a.sliderOrientation,
24351
- sliderImage = _a.sliderImage,
24352
- secondaryAction = _a.secondaryAction;
24348
+ sliderImage = _a.sliderImage;
24353
24349
 
24354
24350
  var _b = React.useState(false),
24355
24351
  isAddDialogOpen = _b[0],
@@ -24580,8 +24576,7 @@ var BulkSend = function (_a) {
24580
24576
  sliderFill: sliderFill,
24581
24577
  hasIncrement: hasIncrement,
24582
24578
  cardImage: sliderImage,
24583
- cardOrientation: sliderOrientation,
24584
- secondaryAction: secondaryAction
24579
+ cardOrientation: sliderOrientation
24585
24580
  }), jsx(Flex, {
24586
24581
  outset: {
24587
24582
  top: 'x4'
@@ -1,9 +1,8 @@
1
- import React, { FC } from 'react';
1
+ import { FC } from 'react';
2
2
  export declare type StackedCardHeadProps = {
3
3
  cardImage?: string;
4
4
  cardOrientation?: 'vertical' | 'horizontal';
5
5
  quantity: number;
6
6
  quantityDescription: string;
7
- secondaryAction?: React.ReactNode;
8
7
  };
9
8
  export declare const StackedCardHead: FC<StackedCardHeadProps>;
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { UseFileUploadProps } from "../../hooks/useFileUpload";
2
+ import { AcceptedFiles, RejectedFiles } from '../imageUploader/imageUploader';
3
3
  export declare type UserImage = {
4
4
  url: string;
5
5
  onClick: () => void;
@@ -7,8 +7,15 @@ export declare type UserImage = {
7
7
  };
8
8
  export declare type ImageUploadWidgetProps = {
9
9
  title: string;
10
+ maxHeight?: string;
11
+ onClose: () => void;
10
12
  onFinished: () => void;
11
13
  isOpen: boolean;
14
+ onUpload: (files: {
15
+ accepted: AcceptedFiles;
16
+ rejected: RejectedFiles;
17
+ }, fileList?: FileList | null) => void;
18
+ hasMultiUpload?: boolean;
12
19
  userImages?: UserImage[];
13
20
  x: number;
14
21
  y: number;
@@ -17,5 +24,5 @@ export declare type ImageUploadWidgetProps = {
17
24
  hasMore?: boolean;
18
25
  endMessage?: string;
19
26
  width?: number;
20
- } & UseFileUploadProps;
27
+ };
21
28
  export declare const ImageUploadWidget: FC<ImageUploadWidgetProps>;
@@ -1,8 +1,20 @@
1
1
  /// <reference types="react" />
2
+ import { FileRejection } from 'react-dropzone';
2
3
  import { BackgroundColor } from "../../helpers/hoc-types/hocBaseUnion";
3
- import { UseFileUploadProps } from "../../hooks/useFileUpload";
4
+ declare type AcceptedFileType = 'jpg' | 'png' | 'gif' | 'jpeg';
4
5
  export declare type ImageUploaderProps = {
6
+ onUpload: (files: {
7
+ accepted: File[];
8
+ rejected: FileRejection[];
9
+ }, fileList?: FileList | null) => void;
10
+ acceptedFiles: AcceptedFileType[];
11
+ hasMultiupload?: boolean;
12
+ maxFileSize?: number;
13
+ maxAcceptedFiles?: number;
5
14
  uploadTitle?: string;
6
15
  backgroundColor?: BackgroundColor;
7
- } & UseFileUploadProps;
16
+ };
17
+ export declare type AcceptedFiles = File[];
18
+ export declare type RejectedFiles = FileRejection[];
8
19
  export declare const ImageUploader: (props: ImageUploaderProps) => JSX.Element;
20
+ export {};
@@ -1,4 +1,4 @@
1
- import React, { FC } from 'react';
1
+ import { FC } from 'react';
2
2
  import { SliderProgressColor } from "../../../../exports/molecules";
3
3
  import { ConfigurationCardProps, ConfirmDialogProps } from "../../../../exports/organisms";
4
4
  export declare type ConfigurationOptionSection = {
@@ -40,7 +40,6 @@ export declare type BulkSendProps = {
40
40
  disableMessage: string;
41
41
  sliderImage?: string;
42
42
  sliderOrientation?: 'vertical' | 'horizontal';
43
- secondaryAction?: React.ReactNode;
44
43
  };
45
44
  export declare const BulkSend: FC<BulkSendProps>;
46
45
  export {};
@@ -1,9 +1,8 @@
1
- import React, { FC } from 'react';
1
+ import { FC } from 'react';
2
2
  import { QuantitySliderProps } from "../../../../exports/molecules";
3
3
  export declare type CardQuantitySliderProps = {
4
4
  cardImage?: string;
5
5
  cardOrientation?: 'vertical' | 'horizontal';
6
6
  quantityDescription: string;
7
- secondaryAction?: React.ReactNode;
8
7
  } & QuantitySliderProps;
9
8
  export declare const CardQuantitySlider: FC<CardQuantitySliderProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendoutcards/quantum-design-ui",
3
- "version": "1.7.84",
3
+ "version": "1.7.85",
4
4
  "description": "UI component library for Quantum Design System",
5
5
  "module": "dist/index.es.js",
6
6
  "jsnext:main": "dist/index.es.js",
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import { HOCBaseProps } from "../../helpers/hoc-types/hocBasePropTypes";
3
- import { HOCMotionProps } from "../../helpers/hoc-types/hocMotionTypes";
4
- export declare type DivProps = {
5
- children?: React.ReactNode;
6
- outsideClick?: () => void;
7
- clickElementBypass?: string;
8
- } & HOCBaseProps & HOCMotionProps;
9
- export declare const Companion: React.ForwardRefExoticComponent<{
10
- children?: React.ReactNode;
11
- outsideClick?: (() => void) | undefined;
12
- clickElementBypass?: string | undefined;
13
- } & HOCBaseProps & {
14
- className?: string | undefined;
15
- motionKey?: string | number | undefined;
16
- id?: string | undefined;
17
- } & import("framer-motion").MotionProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,32 +0,0 @@
1
- import React from 'react';
2
- import { DropzoneState, FileRejection } from 'react-dropzone';
3
- declare type AcceptedFileType = 'jpg' | 'png' | 'gif' | 'jpeg';
4
- export declare type AcceptedFiles = File[];
5
- export declare type RejectedFiles = FileRejection[];
6
- export declare type UseFileUploadProps = {
7
- onUpload: (files: {
8
- accepted: File[];
9
- rejected: FileRejection[];
10
- }, fileList?: FileList | null) => void;
11
- acceptedFiles: AcceptedFileType[];
12
- hasMultiUpload?: boolean;
13
- maxFileSize?: number;
14
- maxAcceptedFiles?: number;
15
- };
16
- export declare const useFileUpload: (props: UseFileUploadProps) => [import("react-dropzone").DropzoneRef & {
17
- isFocused: boolean;
18
- isDragActive: boolean;
19
- isDragAccept: boolean;
20
- isDragReject: boolean;
21
- isFileDialogActive: boolean;
22
- draggedFiles: File[];
23
- acceptedFiles: File[];
24
- fileRejections: FileRejection[];
25
- rootRef: React.RefObject<HTMLElement>;
26
- inputRef: React.RefObject<HTMLInputElement>;
27
- getRootProps: <T extends import("react-dropzone").DropzoneRootProps>(props?: T | undefined) => T;
28
- getInputProps: <T_1 extends import("react-dropzone").DropzoneInputProps>(props?: T_1 | undefined) => T_1;
29
- } & {
30
- onDragEnter: () => void;
31
- }, string | null];
32
- export {};