@sendoutcards/quantum-design-ui 1.7.82 → 1.7.84

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,12 +22767,10 @@ var isDragEventType = function (event) {
22767
22767
  return 'dataTransfer' in event;
22768
22768
  };
22769
22769
 
22770
- var ImageUploader = function (props) {
22771
- var _a, _b;
22772
-
22773
- var _c = React.useState(null),
22774
- error = _c[0],
22775
- setError = _c[1];
22770
+ var useFileUpload = function (props) {
22771
+ var _a = React.useState(null),
22772
+ error = _a[0],
22773
+ setError = _a[1];
22776
22774
 
22777
22775
  var onUpload = props.onUpload;
22778
22776
  var onDrop = useCallback(function (acceptedFiles, rejectedFiles, event) {
@@ -22803,19 +22801,34 @@ var ImageUploader = function (props) {
22803
22801
  var onDragEnter = useCallback(function () {
22804
22802
  setError(null);
22805
22803
  }, []);
22806
-
22807
- var _d = useDropzone({
22804
+ var dropzone = useDropzone({
22808
22805
  onDrop: onDrop,
22809
22806
  accept: parseAcceptedFiles(props.acceptedFiles),
22810
- multiple: props.hasMultiupload,
22807
+ multiple: props.hasMultiUpload,
22811
22808
  maxFiles: props.maxAcceptedFiles,
22812
22809
  maxSize: props.maxFileSize,
22813
22810
  onDragEnter: onDragEnter
22814
- }),
22815
- getRootProps = _d.getRootProps,
22816
- getInputProps = _d.getInputProps,
22817
- isDragActive = _d.isDragActive;
22811
+ });
22812
+ return [__assign({
22813
+ onDragEnter: onDragEnter
22814
+ }, dropzone), error];
22815
+ };
22818
22816
 
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;
22819
22832
  return jsx(React.Fragment, null, jsx(Flex, {
22820
22833
  inset: "x1",
22821
22834
  flexWrap: "wrap",
@@ -22856,6 +22869,9 @@ var ImageUploader = function (props) {
22856
22869
  }), jsx(Text, {
22857
22870
  type: "largeBody",
22858
22871
  content: (_b = props.uploadTitle) !== null && _b !== void 0 ? _b : 'Upload Photo'
22872
+ }), jsx(Text, {
22873
+ type: "footnote",
22874
+ content: "Drag and Drop Image Here"
22859
22875
  })))), error && jsx(Text, {
22860
22876
  type: "footnote",
22861
22877
  content: error,
@@ -22877,24 +22893,26 @@ var ImageUploadWidget = function (_a) {
22877
22893
  var _b = _a.title,
22878
22894
  title = _b === void 0 ? 'Image Background' : _b,
22879
22895
  onFinished = _a.onFinished,
22880
- onUpload = _a.onUpload,
22881
22896
  x = _a.x,
22882
22897
  y = _a.y,
22883
22898
  isOpen = _a.isOpen,
22884
- _c = _a.hasMultiUpload,
22885
- hasMultiUpload = _c === void 0 ? false : _c,
22886
22899
  userImages = _a.userImages,
22887
22900
  hasMore = _a.hasMore,
22888
22901
  loadMore = _a.loadMore,
22889
22902
  endMessage = _a.endMessage,
22890
22903
  dataLength = _a.dataLength,
22891
- _d = _a.width,
22892
- width = _d === void 0 ? 264 : _d;
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"]);
22893
22907
 
22894
- var _e = useState(false),
22895
- shouldShowImageGrid = _e[0],
22896
- setShouldShowImageGrid = _e[1];
22908
+ var _d = useState(false),
22909
+ shouldShowImageGrid = _d[0],
22910
+ setShouldShowImageGrid = _d[1];
22897
22911
 
22912
+ var inputRef = useRef(null);
22913
+ var dropzone = useFileUpload(hookProps)[0];
22914
+ var getInputProps = dropzone.getInputProps,
22915
+ onDragEnter = dropzone.onDragEnter;
22898
22916
  return jsx(AnimatePresence, null, isOpen && jsx(Div, {
22899
22917
  initial: {
22900
22918
  opacity: 0
@@ -23003,11 +23021,7 @@ var ImageUploadWidget = function (_a) {
23003
23021
  url: image.url
23004
23022
  }
23005
23023
  })));
23006
- }))))) : jsx(ImageUploader, {
23007
- onUpload: onUpload,
23008
- acceptedFiles: ['gif', 'jpeg', 'jpg', 'png'],
23009
- hasMultiupload: hasMultiUpload
23010
- })), jsx(HStack, {
23024
+ }))))) : jsx(ImageUploader, hookProps)), jsx(HStack, {
23011
23025
  outset: "x1",
23012
23026
  justify: "center",
23013
23027
  gap: "x1"
@@ -23015,13 +23029,22 @@ var ImageUploadWidget = function (_a) {
23015
23029
  width: "120px"
23016
23030
  }, jsx(Button, {
23017
23031
  onClick: function () {
23018
- return setShouldShowImageGrid(false);
23032
+ var _a;
23033
+
23034
+ setShouldShowImageGrid(false);
23035
+
23036
+ if (inputRef.current) {
23037
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
23038
+ }
23019
23039
  },
23020
23040
  fullWidth: true,
23021
23041
  size: "small",
23022
23042
  type: "smoke",
23023
23043
  title: "Upload..."
23024
- })), jsx(Div, {
23044
+ }), jsx("input", _extends({}, getInputProps(), {
23045
+ ref: inputRef,
23046
+ onClick: onDragEnter
23047
+ }))), jsx(Div, {
23025
23048
  width: "120px"
23026
23049
  }, jsx(Button, {
23027
23050
  onClick: function () {
@@ -24264,7 +24287,8 @@ var StackedCardHead = function (_a) {
24264
24287
  var cardImage = _a.cardImage,
24265
24288
  cardOrientation = _a.cardOrientation,
24266
24289
  quantity = _a.quantity,
24267
- quantityDescription = _a.quantityDescription;
24290
+ quantityDescription = _a.quantityDescription,
24291
+ secondaryAction = _a.secondaryAction;
24268
24292
  return jsx(VStack, {
24269
24293
  gap: "x2"
24270
24294
  }, jsx(StackedCards, {
@@ -24272,7 +24296,7 @@ var StackedCardHead = function (_a) {
24272
24296
  height: cardOrientation === 'vertical' ? 285 : 200,
24273
24297
  stackBackgroundColor: "background",
24274
24298
  backgroundImage: cardImage
24275
- }), jsx(Text, {
24299
+ }), secondaryAction && secondaryAction, jsx(Text, {
24276
24300
  type: "largeBody",
24277
24301
  weight: "bold",
24278
24302
  color: "primaryHeading",
@@ -24289,14 +24313,16 @@ var CardQuantitySlider = function (props) {
24289
24313
  var cardOrientation = props.cardOrientation,
24290
24314
  cardImage = props.cardImage,
24291
24315
  quantityDescription = props.quantityDescription,
24292
- rest = __rest(props, ["cardOrientation", "cardImage", "quantityDescription"]);
24316
+ secondaryAction = props.secondaryAction,
24317
+ rest = __rest(props, ["cardOrientation", "cardImage", "quantityDescription", "secondaryAction"]);
24293
24318
 
24294
24319
  return jsx(React.Fragment, null, jsx(QuantitySlider, _extends({}, rest, {
24295
24320
  head: jsx(StackedCardHead, {
24296
24321
  cardOrientation: cardOrientation,
24297
24322
  quantity: rest.quantity,
24298
24323
  quantityDescription: quantityDescription,
24299
- cardImage: cardImage
24324
+ cardImage: cardImage,
24325
+ secondaryAction: secondaryAction
24300
24326
  })
24301
24327
  })));
24302
24328
  };
@@ -24322,7 +24348,8 @@ var BulkSend = function (_a) {
24322
24348
  isConfigurable = _a.isConfigurable,
24323
24349
  disableMessage = _a.disableMessage,
24324
24350
  sliderOrientation = _a.sliderOrientation,
24325
- sliderImage = _a.sliderImage;
24351
+ sliderImage = _a.sliderImage,
24352
+ secondaryAction = _a.secondaryAction;
24326
24353
 
24327
24354
  var _b = React.useState(false),
24328
24355
  isAddDialogOpen = _b[0],
@@ -24553,7 +24580,8 @@ var BulkSend = function (_a) {
24553
24580
  sliderFill: sliderFill,
24554
24581
  hasIncrement: hasIncrement,
24555
24582
  cardImage: sliderImage,
24556
- cardOrientation: sliderOrientation
24583
+ cardOrientation: sliderOrientation,
24584
+ secondaryAction: secondaryAction
24557
24585
  }), jsx(Flex, {
24558
24586
  outset: {
24559
24587
  top: 'x4'
@@ -0,0 +1,17 @@
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>>;
@@ -0,0 +1,32 @@
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 {};
@@ -1,8 +1,9 @@
1
- import { FC } from 'react';
1
+ import React, { 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;
7
8
  };
8
9
  export declare const StackedCardHead: FC<StackedCardHeadProps>;
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { AcceptedFiles, RejectedFiles } from '../imageUploader/imageUploader';
2
+ import { UseFileUploadProps } from "../../hooks/useFileUpload";
3
3
  export declare type UserImage = {
4
4
  url: string;
5
5
  onClick: () => void;
@@ -7,15 +7,8 @@ export declare type UserImage = {
7
7
  };
8
8
  export declare type ImageUploadWidgetProps = {
9
9
  title: string;
10
- maxHeight?: string;
11
- onClose: () => void;
12
10
  onFinished: () => void;
13
11
  isOpen: boolean;
14
- onUpload: (files: {
15
- accepted: AcceptedFiles;
16
- rejected: RejectedFiles;
17
- }, fileList?: FileList | null) => void;
18
- hasMultiUpload?: boolean;
19
12
  userImages?: UserImage[];
20
13
  x: number;
21
14
  y: number;
@@ -24,5 +17,5 @@ export declare type ImageUploadWidgetProps = {
24
17
  hasMore?: boolean;
25
18
  endMessage?: string;
26
19
  width?: number;
27
- };
20
+ } & UseFileUploadProps;
28
21
  export declare const ImageUploadWidget: FC<ImageUploadWidgetProps>;
@@ -1,20 +1,8 @@
1
1
  /// <reference types="react" />
2
- import { FileRejection } from 'react-dropzone';
3
2
  import { BackgroundColor } from "../../helpers/hoc-types/hocBaseUnion";
4
- declare type AcceptedFileType = 'jpg' | 'png' | 'gif' | 'jpeg';
3
+ import { UseFileUploadProps } from "../../hooks/useFileUpload";
5
4
  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;
14
5
  uploadTitle?: string;
15
6
  backgroundColor?: BackgroundColor;
16
- };
17
- export declare type AcceptedFiles = File[];
18
- export declare type RejectedFiles = FileRejection[];
7
+ } & UseFileUploadProps;
19
8
  export declare const ImageUploader: (props: ImageUploaderProps) => JSX.Element;
20
- export {};
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import React, { 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,6 +40,7 @@ export declare type BulkSendProps = {
40
40
  disableMessage: string;
41
41
  sliderImage?: string;
42
42
  sliderOrientation?: 'vertical' | 'horizontal';
43
+ secondaryAction?: React.ReactNode;
43
44
  };
44
45
  export declare const BulkSend: FC<BulkSendProps>;
45
46
  export {};
@@ -1,8 +1,9 @@
1
- import { FC } from 'react';
1
+ import React, { 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;
7
8
  } & QuantitySliderProps;
8
9
  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.82",
3
+ "version": "1.7.84",
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",