@mackin.com/styleguide 7.1.0-beta.1 → 7.1.1
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/index.d.ts +11 -2
- package/index.js +25 -11
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import React__default from 'react';
|
|
3
|
+
import React__default, { ReactNode } from 'react';
|
|
4
4
|
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
5
5
|
|
|
6
6
|
declare type Alignment = 'left' | 'right' | 'center';
|
|
@@ -735,6 +735,11 @@ declare const defaultTheme: MackinTheme;
|
|
|
735
735
|
/** Returns a user-provided theme if ThemeProvider was used correctly, or the default theme. */
|
|
736
736
|
declare const useThemeSafely: () => MackinTheme;
|
|
737
737
|
|
|
738
|
+
declare const ThemeProvider: <T extends MackinTheme>(p: {
|
|
739
|
+
children?: ReactNode;
|
|
740
|
+
theme: T;
|
|
741
|
+
}) => JSX.Element;
|
|
742
|
+
|
|
738
743
|
declare const TabLocker: (props: {
|
|
739
744
|
disabled?: boolean;
|
|
740
745
|
children?: React.ReactNode;
|
|
@@ -756,6 +761,10 @@ interface FileUploaderProps {
|
|
|
756
761
|
maxBytes?: number;
|
|
757
762
|
multiple?: boolean;
|
|
758
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;
|
|
759
768
|
}
|
|
760
769
|
declare const FileUploader: (p: FileUploaderProps) => JSX.Element;
|
|
761
770
|
|
|
@@ -892,4 +901,4 @@ declare const Backdrop: (p: {
|
|
|
892
901
|
|
|
893
902
|
declare const useMediaQuery: (query: string) => boolean;
|
|
894
903
|
|
|
895
|
-
export { Alignment, Backdrop$1 as Backdrop, Backdrop as Backdrop2, BoundMemoryPager, BoundStaticPager, Button, ButtonProps, Calendar, CalendarProps, Checkbox, CheckboxProps, ConfirmModal, ConfirmModalProps, CopyButton, DatePicker, DatePickerProps, Divider, ErrorModal, FileUploader, Form, FormColumnRow, FormFlexRow, GlobalStyles, Header, Highlight, ICONS, Icon, Image, InfoPanel, InfoTip, InfoTipProps, Input, InputProps, ItemPager, Label, LabelProps, List, ListItem, MackinTheme, Modal, Nav, OmniLink, OmniLinkProps, PagedResult, Pager, PagerProps, Picker, PickerProps, Popover, ProgressBar, ProgressBarProps, SearchBox, SearchBoxProps, Slider, TabHeader, TabHeaderProps, TabLocker, Table, Td, TdCurrency, TdNumber, Text, TextProps, Th, ThSort, ToggleButton, ToggleButtonGroup, ToggleButtonGroupProps, ToggleButtonProps, TogglePasswordInput, Tr, WaitingIndicator, calcDynamicThemeProps, defaultTheme, getCurrencyDisplay, mergeClassNames, useMediaQuery, useThemeSafely };
|
|
904
|
+
export { Alignment, Backdrop$1 as Backdrop, Backdrop as Backdrop2, BoundMemoryPager, BoundStaticPager, Button, ButtonProps, Calendar, CalendarProps, Checkbox, CheckboxProps, ConfirmModal, ConfirmModalProps, CopyButton, DatePicker, DatePickerProps, Divider, ErrorModal, FileUploader, Form, FormColumnRow, FormFlexRow, GlobalStyles, Header, Highlight, ICONS, Icon, Image, InfoPanel, InfoTip, InfoTipProps, Input, InputProps, ItemPager, Label, LabelProps, List, ListItem, MackinTheme, Modal, Nav, OmniLink, OmniLinkProps, PagedResult, Pager, PagerProps, Picker, PickerProps, Popover, ProgressBar, ProgressBarProps, SearchBox, SearchBoxProps, Slider, TabHeader, TabHeaderProps, TabLocker, Table, Td, TdCurrency, TdNumber, Text, TextProps, Th, ThSort, ThemeProvider, ToggleButton, ToggleButtonGroup, ToggleButtonGroupProps, ToggleButtonProps, TogglePasswordInput, Tr, WaitingIndicator, calcDynamicThemeProps, defaultTheme, getCurrencyDisplay, mergeClassNames, useMediaQuery, useThemeSafely };
|
package/index.js
CHANGED
|
@@ -36,8 +36,8 @@ function _interopNamespace(e) {
|
|
|
36
36
|
return Object.freeze(n);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
40
39
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
40
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
41
41
|
var ReactSlider__default = /*#__PURE__*/_interopDefaultLegacy(ReactSlider);
|
|
42
42
|
|
|
43
43
|
/** @deprecated This will not work correctly with emotion/css. Use 'cx' for adding multiple class names together. */
|
|
@@ -153,7 +153,10 @@ const defaultTheme = {
|
|
|
153
153
|
};
|
|
154
154
|
calcDynamicThemeProps(defaultTheme);
|
|
155
155
|
|
|
156
|
-
const ThemeContext = React.createContext(defaultTheme);
|
|
156
|
+
const ThemeContext = React.createContext(defaultTheme);
|
|
157
|
+
const ThemeProvider = (p) => {
|
|
158
|
+
return (React__default['default'].createElement(ThemeContext.Provider, { value: p.theme }, p.children));
|
|
159
|
+
};
|
|
157
160
|
|
|
158
161
|
/** Returns a user-provided theme if ThemeProvider was used correctly, or the default theme. */
|
|
159
162
|
const useThemeSafely = () => {
|
|
@@ -2399,7 +2402,7 @@ const OmniLink = (props) => {
|
|
|
2399
2402
|
line-height: ${theme.controls.heightSmall};
|
|
2400
2403
|
`}
|
|
2401
2404
|
`;
|
|
2402
|
-
const mainClassName = css.cx('omniLink', props.className);
|
|
2405
|
+
const mainClassName = css.cx('omniLink', linkStyles, props.className);
|
|
2403
2406
|
const content = React__namespace.createElement(React__namespace.Fragment, null,
|
|
2404
2407
|
React__namespace.createElement("span", null,
|
|
2405
2408
|
props.leftIcon && React__namespace.createElement("span", { className: css.css({
|
|
@@ -2414,9 +2417,9 @@ const OmniLink = (props) => {
|
|
|
2414
2417
|
verticalAlign: 'middle'
|
|
2415
2418
|
}) }, props.rightIcon));
|
|
2416
2419
|
if (props.noRouter) {
|
|
2417
|
-
return (React__namespace.createElement("a", { title: props.title, target: props.target, className:
|
|
2420
|
+
return (React__namespace.createElement("a", { title: props.title, target: props.target, className: mainClassName, href: props.href, onClick: props.onClick }, content));
|
|
2418
2421
|
}
|
|
2419
|
-
return (React__namespace.createElement(reactRouterDom.Link, { title: props.title, className:
|
|
2422
|
+
return (React__namespace.createElement(reactRouterDom.Link, { title: props.title, className: mainClassName, onClick: props.onClick, to: props.href }, content));
|
|
2420
2423
|
};
|
|
2421
2424
|
|
|
2422
2425
|
const ProgressBar = (props) => {
|
|
@@ -2931,7 +2934,7 @@ const hoverClass = css.css({
|
|
|
2931
2934
|
backgroundColor: 'rgba(0,0,0,0.25) !important'
|
|
2932
2935
|
});
|
|
2933
2936
|
const FileUploader = (p) => {
|
|
2934
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2937
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2935
2938
|
const [message, setMessage] = React.useState(undefined);
|
|
2936
2939
|
const [canUpload, setCanUpload] = React.useState(false);
|
|
2937
2940
|
const [uploading, setUploading] = React.useState(false);
|
|
@@ -2944,7 +2947,7 @@ const FileUploader = (p) => {
|
|
|
2944
2947
|
let filesDisplay = '';
|
|
2945
2948
|
if (!message) {
|
|
2946
2949
|
if (!(files === null || files === void 0 ? void 0 : files.length)) {
|
|
2947
|
-
filesDisplay = `Click or drag and drop files.`;
|
|
2950
|
+
filesDisplay = (_b = p.instructionMessage) !== null && _b !== void 0 ? _b : `Click or drag and drop files.`;
|
|
2948
2951
|
}
|
|
2949
2952
|
else {
|
|
2950
2953
|
filesDisplay = `${files.length.toLocaleString()} file${files.length > 1 ? 's' : ''} selected (${getSizeString(totalFileSize)}): ${files.files.map(f => f.name).join(', ')}`;
|
|
@@ -2969,6 +2972,15 @@ const FileUploader = (p) => {
|
|
|
2969
2972
|
maxBytes: p.maxBytes
|
|
2970
2973
|
});
|
|
2971
2974
|
};
|
|
2975
|
+
let infoMessage;
|
|
2976
|
+
if (p.infoMessage) {
|
|
2977
|
+
if (typeof p.infoMessage === 'string') {
|
|
2978
|
+
infoMessage = React__default['default'].createElement(Text, { noPad: true }, p.infoMessage);
|
|
2979
|
+
}
|
|
2980
|
+
else {
|
|
2981
|
+
infoMessage = p.infoMessage;
|
|
2982
|
+
}
|
|
2983
|
+
}
|
|
2972
2984
|
return (React__default['default'].createElement(Form, { ref: form, className: css.css({
|
|
2973
2985
|
border: theme.controls.border,
|
|
2974
2986
|
borderStyle: 'dashed',
|
|
@@ -3048,19 +3060,20 @@ const FileUploader = (p) => {
|
|
|
3048
3060
|
e.stopPropagation();
|
|
3049
3061
|
onFilesChange(undefined);
|
|
3050
3062
|
}, className: css.css({ marginLeft: '1rem', color: theme.colors.negative }), rightIcon: React__default['default'].createElement(Icon, { id: "clear" }), variant: "inlineLink" }, "Clear"))),
|
|
3063
|
+
infoMessage,
|
|
3051
3064
|
!!(files === null || files === void 0 ? void 0 : files.invalidFiles.length) && (React__default['default'].createElement(InfoPanel, { variant: "error" },
|
|
3052
3065
|
"Invalid files: ",
|
|
3053
3066
|
files.invalidFiles.map(f => f.name).join(', '),
|
|
3054
3067
|
".")),
|
|
3055
3068
|
(files === null || files === void 0 ? void 0 : files.overMaxBytes) && (React__default['default'].createElement(InfoPanel, { variant: "error" },
|
|
3056
3069
|
"Max file size exceeded (",
|
|
3057
|
-
getSizeString((
|
|
3070
|
+
getSizeString((_c = p.maxBytes) !== null && _c !== void 0 ? _c : 0),
|
|
3058
3071
|
").")))),
|
|
3059
3072
|
canUpload && !(files === null || files === void 0 ? void 0 : files.hasErrors) && (React__default['default'].createElement(Button, { className: css.css({
|
|
3060
|
-
width: (
|
|
3073
|
+
width: (_d = p.buttonWidth) !== null && _d !== void 0 ? _d : '10rem',
|
|
3061
3074
|
zIndex: 1,
|
|
3062
|
-
}), waiting: uploading, type: "submit", variant: (
|
|
3063
|
-
message === 'success' && (React__default['default'].createElement(UploadInfoPanel, { variant: "positive", message: (
|
|
3075
|
+
}), waiting: uploading, type: "submit", variant: (_e = p.buttonVariant) !== null && _e !== void 0 ? _e : 'primary' }, (_f = p.buttonText) !== null && _f !== void 0 ? _f : 'Upload')),
|
|
3076
|
+
message === 'success' && (React__default['default'].createElement(UploadInfoPanel, { variant: "positive", message: (_g = p.successMessage) !== null && _g !== void 0 ? _g : 'Upload successful.', onClear: () => setMessage(undefined) })),
|
|
3064
3077
|
message === 'failure' && (React__default['default'].createElement(UploadInfoPanel, { variant: "error", message: fullFailureMessage, onClear: () => setMessage(undefined) }))));
|
|
3065
3078
|
};
|
|
3066
3079
|
const UploadInfoPanel = (p) => {
|
|
@@ -3393,6 +3406,7 @@ exports.TdNumber = TdNumber;
|
|
|
3393
3406
|
exports.Text = Text;
|
|
3394
3407
|
exports.Th = Th;
|
|
3395
3408
|
exports.ThSort = ThSort;
|
|
3409
|
+
exports.ThemeProvider = ThemeProvider;
|
|
3396
3410
|
exports.ToggleButton = ToggleButton;
|
|
3397
3411
|
exports.ToggleButtonGroup = ToggleButtonGroup;
|
|
3398
3412
|
exports.TogglePasswordInput = TogglePasswordInput;
|