@youversion/design-system-components 0.0.26 → 0.0.27

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @youversion/design-system-components
2
2
 
3
+ ## 0.0.27
4
+
5
+ ### Patch Changes
6
+
7
+ - b135753: Added `ImageUpload` export to the `index.ts` file.
8
+
3
9
  ## 0.0.26
4
10
 
5
11
  ### Patch Changes
@@ -0,0 +1,84 @@
1
+ import { AllHTMLAttributes } from 'react';
2
+ type NativeInputProps = AllHTMLAttributes<HTMLInputElement>;
3
+ type ImageFileTypes = `image/${string}`;
4
+ type ImageUploadShape = 'circle' | 'square' | 'unset';
5
+ type ImageValidation = {
6
+ fileTypes?: Array<ImageFileTypes>;
7
+ imageRatio?: string;
8
+ maxByteSize?: number;
9
+ maxHeight?: number;
10
+ maxWidth?: number;
11
+ minHeight?: number;
12
+ minWidth?: number;
13
+ };
14
+ export interface ImageUploadProps extends Omit<NativeInputProps, 'width' | 'height' | 'className'> {
15
+ /** Allows ability to define which image types to allow to be uploaded. */
16
+ acceptedFileTypes?: Array<ImageFileTypes>;
17
+ /** The label for the button to change an uploaded image. */
18
+ changeImageButtonLabel?: string;
19
+ /** The label for the button to choose an image to upload. */
20
+ chooseImageButtonLabel?: string;
21
+ /** Allows user to pass classNames to customize block. */
22
+ className?: string;
23
+ /** Allows the block to be disabled. */
24
+ disabled?: boolean;
25
+ /** Callback function to be invoked when image is dimissed. */
26
+ dismissCallback?: (src: string | undefined) => void;
27
+ /** Aria label for the dismiss image button. */
28
+ dismissImageAriaLabel?: string;
29
+ /** Adds error message to the botton of the component. */
30
+ error?: string;
31
+ /** Callback function invoked when an image is uploaded. */
32
+ fileCallback?: ((file: File) => Promise<void>) | ((file: File) => void);
33
+ /** Function to throw an error message when the image if larger than the maxByteSize allowed. */
34
+ fileMaxKbSizeError?: (fileName: string, maxKbSize: number) => string;
35
+ /** Function to throw an error message when the image is larger than the maxHeight or maxWidth. */
36
+ fileMaxSizeError?: (fileName: string) => string;
37
+ /** Function to throw an error message when the image is smaller than the minHeight or minWidth. */
38
+ fileMinSizeError?: (fileName: string) => string;
39
+ /** Function to throw an error message when the image is not the right ratio. */
40
+ fileRatioError?: (fileName: string) => string;
41
+ /** Boolean for hero image upload view. */
42
+ hero?: boolean;
43
+ /** Adds a hint message to the block. */
44
+ hint?: string;
45
+ /** The height of the image preview. */
46
+ imageHeight?: number;
47
+ /** Source of image to be rendered with the component. */
48
+ imageSrc?: string;
49
+ /** The width of the image preview. */
50
+ imageWidth?: number;
51
+ /** The label for the image upload block. */
52
+ label?: string;
53
+ /** Adds name of the file input. */
54
+ name?: string;
55
+ /** Function that does any desired preProcessing of a file. */
56
+ preProcessing?: (file: File) => Promise<File>;
57
+ /** Determines the shape of the displayed image. */
58
+ shape?: ImageUploadShape;
59
+ /** Validations to do on the desired image before being uploaded. */
60
+ validation?: ImageValidation;
61
+ }
62
+ /**
63
+ * The **ImageUpload** component is used to allow the user to upload an image.
64
+ *
65
+ * Accepts {@link ImageUploadProps}
66
+ *
67
+ * @returns Renders the **ImageUpload** component to be used.
68
+ *
69
+ * @example
70
+ * ```tsx
71
+ * import { ImageUpload } from '@youversion/design-system-component';
72
+ *
73
+ * function MyComponent() {
74
+ * return (
75
+ * <>
76
+ * <ImageUpload />
77
+ * </>
78
+ * )
79
+ * }
80
+ * ```
81
+ */
82
+ export declare const ImageUpload: import("react").ForwardRefExoticComponent<ImageUploadProps & import("react").RefAttributes<HTMLInputElement>>;
83
+ export {};
84
+ //# sourceMappingURL=ImageUpload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageUpload.d.ts","sourceRoot":"","sources":["../../../src/ImageUpload/ImageUpload.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAoE,MAAM,OAAO,CAAC;AAO5G,KAAK,gBAAgB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,C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AAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IACrE,kGAAkG;IAClG,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IAChD,mGAAmG;IACnG,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IAChD,gFAAgF;IAChF,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9C,0CAA0C;IAC1C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,mDAAmD;IACnD,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,oEAAoE;IACpE,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B;AAiRD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,WAAW,+GAAmC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './ImageUpload';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ImageUpload/index.tsx"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export * from './hooks';
10
10
  export * from './HorizontalLoader';
11
11
  export * from './IconButton';
12
12
  export * from './IconLinkButton';
13
+ export * from './ImageUpload';
13
14
  export * from './Input';
14
15
  export * from './LinkButton';
15
16
  export * from './List';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,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