@mackin.com/styleguide 7.1.0-beta.3 → 7.1.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.
Files changed (3) hide show
  1. package/index.d.ts +4 -0
  2. package/index.js +7 -6
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -761,6 +761,10 @@ interface FileUploaderProps {
761
761
  maxBytes?: number;
762
762
  multiple?: boolean;
763
763
  accept?: string;
764
+ /** Defaults to 'Click or drag and drop files.'*/
765
+ instructionMessage?: string;
766
+ /** For additional info below the instructionMessage. */
767
+ infoMessage?: string | JSX.Element;
764
768
  }
765
769
  declare const FileUploader: (p: FileUploaderProps) => JSX.Element;
766
770
 
package/index.js CHANGED
@@ -2934,7 +2934,7 @@ const hoverClass = css.css({
2934
2934
  backgroundColor: 'rgba(0,0,0,0.25) !important'
2935
2935
  });
2936
2936
  const FileUploader = (p) => {
2937
- var _a, _b, _c, _d, _e, _f;
2937
+ var _a, _b, _c, _d, _e, _f, _g;
2938
2938
  const [message, setMessage] = React.useState(undefined);
2939
2939
  const [canUpload, setCanUpload] = React.useState(false);
2940
2940
  const [uploading, setUploading] = React.useState(false);
@@ -2947,7 +2947,7 @@ const FileUploader = (p) => {
2947
2947
  let filesDisplay = '';
2948
2948
  if (!message) {
2949
2949
  if (!(files === null || files === void 0 ? void 0 : files.length)) {
2950
- filesDisplay = `Click or drag and drop files.`;
2950
+ filesDisplay = (_b = p.instructionMessage) !== null && _b !== void 0 ? _b : `Click or drag and drop files.`;
2951
2951
  }
2952
2952
  else {
2953
2953
  filesDisplay = `${files.length.toLocaleString()} file${files.length > 1 ? 's' : ''} selected (${getSizeString(totalFileSize)}): ${files.files.map(f => f.name).join(', ')}`;
@@ -3047,6 +3047,7 @@ const FileUploader = (p) => {
3047
3047
  !(files === null || files === void 0 ? void 0 : files.length) && React__default['default'].createElement(Icon, { style: { fontSize: '2rem' }, id: "upload" }),
3048
3048
  React__default['default'].createElement(Text, { align: "center", noPad: true, spacedOut: true },
3049
3049
  filesDisplay,
3050
+ p.infoMessage && (React__default['default'].createElement("div", null, p.infoMessage)),
3050
3051
  !!(files === null || files === void 0 ? void 0 : files.length) && (React__default['default'].createElement(Button, { onClick: e => {
3051
3052
  e.stopPropagation();
3052
3053
  onFilesChange(undefined);
@@ -3057,13 +3058,13 @@ const FileUploader = (p) => {
3057
3058
  ".")),
3058
3059
  (files === null || files === void 0 ? void 0 : files.overMaxBytes) && (React__default['default'].createElement(InfoPanel, { variant: "error" },
3059
3060
  "Max file size exceeded (",
3060
- getSizeString((_b = p.maxBytes) !== null && _b !== void 0 ? _b : 0),
3061
+ getSizeString((_c = p.maxBytes) !== null && _c !== void 0 ? _c : 0),
3061
3062
  ").")))),
3062
3063
  canUpload && !(files === null || files === void 0 ? void 0 : files.hasErrors) && (React__default['default'].createElement(Button, { className: css.css({
3063
- width: (_c = p.buttonWidth) !== null && _c !== void 0 ? _c : '10rem',
3064
+ width: (_d = p.buttonWidth) !== null && _d !== void 0 ? _d : '10rem',
3064
3065
  zIndex: 1,
3065
- }), waiting: uploading, type: "submit", variant: (_d = p.buttonVariant) !== null && _d !== void 0 ? _d : 'primary' }, (_e = p.buttonText) !== null && _e !== void 0 ? _e : 'Upload')),
3066
- message === 'success' && (React__default['default'].createElement(UploadInfoPanel, { variant: "positive", message: (_f = p.successMessage) !== null && _f !== void 0 ? _f : 'Upload successful.', onClear: () => setMessage(undefined) })),
3066
+ }), waiting: uploading, type: "submit", variant: (_e = p.buttonVariant) !== null && _e !== void 0 ? _e : 'primary' }, (_f = p.buttonText) !== null && _f !== void 0 ? _f : 'Upload')),
3067
+ message === 'success' && (React__default['default'].createElement(UploadInfoPanel, { variant: "positive", message: (_g = p.successMessage) !== null && _g !== void 0 ? _g : 'Upload successful.', onClear: () => setMessage(undefined) })),
3067
3068
  message === 'failure' && (React__default['default'].createElement(UploadInfoPanel, { variant: "error", message: fullFailureMessage, onClear: () => setMessage(undefined) }))));
3068
3069
  };
3069
3070
  const UploadInfoPanel = (p) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mackin.com/styleguide",
3
- "version": "7.1.0-beta.3",
3
+ "version": "7.1.0",
4
4
  "description": "",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",