@mackin.com/styleguide 7.8.0 → 7.10.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.
- package/index.d.ts +19 -28
- package/index.js +152 -73
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ interface AutocompleteProps {
|
|
|
27
27
|
/** The minimum characters before 'getOptions' is called. No default. */
|
|
28
28
|
minChars?: number;
|
|
29
29
|
inputAriaAttributes?: React.AriaAttributes;
|
|
30
|
+
/** Defaults to 0ms. */
|
|
31
|
+
getOptionsDebounceMs?: number;
|
|
30
32
|
onChange: (value: string) => void;
|
|
31
33
|
getOptions: (value: string) => Promise<AutocompleteValue[]>;
|
|
32
34
|
onPick: (value: AutocompleteValue) => void;
|
|
@@ -59,15 +61,7 @@ declare const Backdrop: (p: {
|
|
|
59
61
|
}) => JSX.Element;
|
|
60
62
|
|
|
61
63
|
declare type ButtonVariant = 'label' | 'circle' | 'icon' | 'link' | 'inlineLink' | 'primary' | 'secondary' | 'omg' | 'primary2' | 'positive' | 'negative';
|
|
62
|
-
interface ButtonProps {
|
|
63
|
-
onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
64
|
-
onMouseLeave?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
65
|
-
onMouseEnter?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
66
|
-
onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;
|
|
67
|
-
onBlur?: (event: React.FocusEvent<HTMLButtonElement>) => void;
|
|
68
|
-
type?: 'button' | 'submit';
|
|
69
|
-
children?: any;
|
|
70
|
-
style?: React.CSSProperties;
|
|
64
|
+
interface ButtonProps extends React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> {
|
|
71
65
|
variant?: ButtonVariant;
|
|
72
66
|
/** Defaults to 'center'. */
|
|
73
67
|
textAlign?: 'left' | 'center' | 'right';
|
|
@@ -76,21 +70,16 @@ interface ButtonProps {
|
|
|
76
70
|
round?: boolean;
|
|
77
71
|
/** @deprecated Use theme.controls.borderRadius (global) or style the components individually. */
|
|
78
72
|
rounded?: boolean;
|
|
79
|
-
className?: string;
|
|
80
73
|
rightIcon?: JSX.Element;
|
|
81
74
|
leftIcon?: JSX.Element;
|
|
82
75
|
/** full width with max space between the text and the icon */
|
|
83
76
|
iconBlock?: boolean;
|
|
84
77
|
small?: boolean;
|
|
85
|
-
disabled?: boolean;
|
|
86
78
|
/** The button will not respond to click or mouse events, but it will appear normal. */
|
|
87
79
|
readonly?: boolean;
|
|
88
80
|
waiting?: boolean;
|
|
89
81
|
/** The minimum button size will be set to the themes' formButtonMinWidth. */
|
|
90
82
|
enforceMinWidth?: boolean;
|
|
91
|
-
title?: string;
|
|
92
|
-
tabIndex?: number;
|
|
93
|
-
id?: string;
|
|
94
83
|
}
|
|
95
84
|
declare const Button: (props: ButtonProps) => JSX.Element;
|
|
96
85
|
|
|
@@ -215,17 +204,21 @@ interface FileUploaderProps {
|
|
|
215
204
|
instructionMessage?: string;
|
|
216
205
|
/** For additional info below the instructionMessage. */
|
|
217
206
|
infoMessage?: string | JSX.Element;
|
|
207
|
+
/** If false, the 'infoMessage' will be hidden when a file is picked. Defaults to 'true' */
|
|
208
|
+
showInfoOnPick?: boolean;
|
|
209
|
+
disabled?: boolean;
|
|
218
210
|
}
|
|
219
|
-
declare const FileUploader: (p: FileUploaderProps) => JSX.Element;
|
|
211
|
+
declare const FileUploader: (p: FileUploaderProps) => JSX.Element;
|
|
212
|
+
declare const getFileSizeDisplay: (size: number) => string;
|
|
220
213
|
|
|
221
|
-
declare type
|
|
222
|
-
interface
|
|
214
|
+
declare type BaseProps = React.ClassAttributes<HTMLFormElement> & React.FormHTMLAttributes<HTMLFormElement>;
|
|
215
|
+
interface FormProps extends BaseProps {
|
|
223
216
|
inline?: boolean;
|
|
224
217
|
/** If true, preventDefault and stopPropagation will be applied prior to onSubmit being called. Defaults to true. */
|
|
225
218
|
ajax?: boolean;
|
|
226
219
|
}
|
|
227
220
|
/** Use this instead of <form> directly. If we need to fight Chrome's autofill, we can do so at a global level. */
|
|
228
|
-
declare const Form: React.ForwardRefExoticComponent<Pick<
|
|
221
|
+
declare const Form: React.ForwardRefExoticComponent<Pick<FormProps, "inline" | "ajax" | "key" | "acceptCharset" | "action" | "autoComplete" | "encType" | "method" | "name" | "noValidate" | "target" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & React.RefAttributes<HTMLFormElement>>;
|
|
229
222
|
declare const FormFlexRow: (props: {
|
|
230
223
|
children: React.ReactNode;
|
|
231
224
|
className?: string;
|
|
@@ -415,20 +408,17 @@ interface LabelProps {
|
|
|
415
408
|
}
|
|
416
409
|
declare const Label: (props: LabelProps) => JSX.Element;
|
|
417
410
|
|
|
418
|
-
|
|
419
|
-
children?: any;
|
|
411
|
+
interface ListProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement> {
|
|
420
412
|
altRowColor?: boolean;
|
|
421
413
|
noLines?: boolean;
|
|
422
|
-
className?: string;
|
|
423
414
|
items?: (string | JSX.Element)[];
|
|
424
|
-
}
|
|
425
|
-
declare const
|
|
426
|
-
|
|
427
|
-
id?: string | number;
|
|
415
|
+
}
|
|
416
|
+
declare const List: React.ForwardRefExoticComponent<Pick<ListProps, "altRowColor" | "noLines" | "items" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & React.RefAttributes<HTMLUListElement>>;
|
|
417
|
+
interface ListItemProps extends React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement> {
|
|
428
418
|
/** For variant 'full', the content will take up the entire space of the parent (no padding applied by this component). */
|
|
429
419
|
variant?: 'full';
|
|
430
|
-
|
|
431
|
-
|
|
420
|
+
}
|
|
421
|
+
declare const ListItem: (props: ListItemProps) => JSX.Element;
|
|
432
422
|
|
|
433
423
|
interface ModalProps {
|
|
434
424
|
show: boolean;
|
|
@@ -670,6 +660,7 @@ interface PickerProps<T extends PickerValue> extends SelectProps {
|
|
|
670
660
|
type?: 'select';
|
|
671
661
|
/** @deprecated Use theme.controls.borderRadius (global) or style the components individually. */
|
|
672
662
|
rounded?: boolean;
|
|
663
|
+
round?: boolean;
|
|
673
664
|
}
|
|
674
665
|
declare const Picker: <T extends PickerValue>(props: PickerProps<T>) => JSX.Element;
|
|
675
666
|
|
|
@@ -994,4 +985,4 @@ declare const WaitingIndicator: (p: {
|
|
|
994
985
|
debug?: boolean;
|
|
995
986
|
}) => JSX.Element;
|
|
996
987
|
|
|
997
|
-
export { Alignment, Autocomplete, AutocompleteProps, AutocompleteValue, Backdrop$1 as Backdrop, Backdrop as Backdrop2, BoundMemoryPager, BoundStaticPager, Button, ButtonProps, Calendar, CalendarProps, Checkbox, CheckboxProps, ConfirmModal, ConfirmModalProps, CopyButton, DateInput, DateInputProps, 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, NumberInput, NumberInputProps, OmniLink, OmniLinkProps, PagedResult, Pager, PagerProps, Picker, PickerProps, Popover, ProgressBar, ProgressBarProps, SearchBox, SearchBoxProps, Slider, TabHeader, TabHeaderProps, TabLocker, Table, Td, TdCurrency, TdNumber, Text, TextArea, TextAreaProps, TextInput, TextInputProps, TextProps, Th, ThSort, ThemeProvider, ToggleButton, ToggleButtonGroup, ToggleButtonGroupProps, ToggleButtonProps, TogglePasswordInput, Tr, WaitingIndicator, calcDynamicThemeProps, defaultTheme, getCurrencyDisplay, mergeClassNames, useMediaQuery, useThemeSafely };
|
|
988
|
+
export { Alignment, Autocomplete, AutocompleteProps, AutocompleteValue, Backdrop$1 as Backdrop, Backdrop as Backdrop2, BoundMemoryPager, BoundStaticPager, Button, ButtonProps, Calendar, CalendarProps, Checkbox, CheckboxProps, ConfirmModal, ConfirmModalProps, CopyButton, DateInput, DateInputProps, DatePicker, DatePickerProps, Divider, ErrorModal, FileUploader, Form, FormColumnRow, FormFlexRow, FormProps, GlobalStyles, Header, Highlight, ICONS, Icon, Image, InfoPanel, InfoTip, InfoTipProps, Input, InputProps, ItemPager, Label, LabelProps, List, ListItem, ListItemProps, ListProps, MackinTheme, Modal, Nav, NumberInput, NumberInputProps, OmniLink, OmniLinkProps, PagedResult, Pager, PagerProps, Picker, PickerProps, Popover, ProgressBar, ProgressBarProps, SearchBox, SearchBoxProps, Slider, TabHeader, TabHeaderProps, TabLocker, Table, Td, TdCurrency, TdNumber, Text, TextArea, TextAreaProps, TextInput, TextInputProps, TextProps, Th, ThSort, ThemeProvider, ToggleButton, ToggleButtonGroup, ToggleButtonGroupProps, ToggleButtonProps, TogglePasswordInput, Tr, WaitingIndicator, calcDynamicThemeProps, defaultTheme, getCurrencyDisplay, getFileSizeDisplay, mergeClassNames, useMediaQuery, useThemeSafely };
|
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
|
|
3
3
|
var css = require('@emotion/css');
|
|
4
|
+
var lodash = require('lodash');
|
|
4
5
|
var React = require('react');
|
|
5
6
|
var nanoid = require('nanoid');
|
|
6
7
|
var proRegularSvgIcons = require('@fortawesome/pro-regular-svg-icons');
|
|
@@ -8,7 +9,6 @@ var proSolidSvgIcons = require('@fortawesome/pro-solid-svg-icons');
|
|
|
8
9
|
var proLightSvgIcons = require('@fortawesome/pro-light-svg-icons');
|
|
9
10
|
var reactFontawesome = require('@fortawesome/react-fontawesome');
|
|
10
11
|
var dateFns = require('date-fns');
|
|
11
|
-
var lodash = require('lodash');
|
|
12
12
|
var reactDom = require('react-dom');
|
|
13
13
|
var reactTinyPopover = require('react-tiny-popover');
|
|
14
14
|
var reactRouterDom = require('react-router-dom');
|
|
@@ -271,6 +271,33 @@ const Backdrop$1 = (props) => {
|
|
|
271
271
|
}, ref: backdrop, className: css.cx('backdrop', styles, props.className) }, props.children));
|
|
272
272
|
};
|
|
273
273
|
|
|
274
|
+
/*! *****************************************************************************
|
|
275
|
+
Copyright (c) Microsoft Corporation.
|
|
276
|
+
|
|
277
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
278
|
+
purpose with or without fee is hereby granted.
|
|
279
|
+
|
|
280
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
281
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
282
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
283
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
284
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
285
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
286
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
287
|
+
***************************************************************************** */
|
|
288
|
+
|
|
289
|
+
function __rest(s, e) {
|
|
290
|
+
var t = {};
|
|
291
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
292
|
+
t[p] = s[p];
|
|
293
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
294
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
295
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
296
|
+
t[p[i]] = s[p[i]];
|
|
297
|
+
}
|
|
298
|
+
return t;
|
|
299
|
+
}
|
|
300
|
+
|
|
274
301
|
const ICONS = {
|
|
275
302
|
add: proSolidSvgIcons.faPlus,
|
|
276
303
|
delete: proSolidSvgIcons.faTrashAlt,
|
|
@@ -313,7 +340,8 @@ const Icon = (props) => {
|
|
|
313
340
|
};
|
|
314
341
|
|
|
315
342
|
const Button = (props) => {
|
|
316
|
-
var _a;
|
|
343
|
+
var _a, _b;
|
|
344
|
+
const nativeProps = __rest(props, ["variant", "textAlign", "block", "round", "rounded", "rightIcon", "leftIcon", "iconBlock", "small", "readonly", "waiting", "enforceMinWidth"]);
|
|
317
345
|
const theme = useThemeSafely();
|
|
318
346
|
const buttonStyles = css.css `
|
|
319
347
|
padding-left: ${theme.controls.padding};
|
|
@@ -482,7 +510,7 @@ const Button = (props) => {
|
|
|
482
510
|
`}
|
|
483
511
|
`;
|
|
484
512
|
const disabled = props.disabled || props.waiting;
|
|
485
|
-
return (React__namespace.createElement("button", {
|
|
513
|
+
return (React__namespace.createElement("button", Object.assign({}, nativeProps, { disabled: disabled, className: css.cx('button', styles, props.className), type: (_b = props.type) !== null && _b !== void 0 ? _b : 'button' }),
|
|
486
514
|
props.leftIcon && React__namespace.createElement("span", { className: css.css({ marginRight: '0.5rem' }) }, props.leftIcon),
|
|
487
515
|
props.waiting ? React__namespace.createElement(Icon, { id: "waiting", spin: true }) : props.children,
|
|
488
516
|
props.rightIcon && React__namespace.createElement("span", { className: css.css({ marginLeft: '0.5rem' }) }, props.rightIcon)));
|
|
@@ -686,9 +714,10 @@ const Input = React__namespace.forwardRef((props, ref) => {
|
|
|
686
714
|
props.rightControl && props.type !== 'textarea' && React__namespace.createElement("div", { className: rightControlStyles }, props.rightControl)));
|
|
687
715
|
});
|
|
688
716
|
|
|
689
|
-
const List = (props) => {
|
|
717
|
+
const List = React__namespace.forwardRef((props, ref) => {
|
|
690
718
|
const children = props.items ? props.items.map((item, i) => React__namespace.createElement(ListItem, { key: i }, item)) : props.children;
|
|
691
719
|
const theme = useThemeSafely();
|
|
720
|
+
const listProps = __rest(props, ["altRowColor", "noLines", "items"]);
|
|
692
721
|
const listStyles = css.css `
|
|
693
722
|
margin: 0;
|
|
694
723
|
padding: 0;
|
|
@@ -704,9 +733,10 @@ const List = (props) => {
|
|
|
704
733
|
}
|
|
705
734
|
`}
|
|
706
735
|
`;
|
|
707
|
-
return (React__namespace.createElement("ul", { className: css.cx('list', listStyles, props.className) }, children));
|
|
708
|
-
};
|
|
736
|
+
return (React__namespace.createElement("ul", Object.assign({}, listProps, { ref: ref, className: css.cx('list', listStyles, props.className) }), children));
|
|
737
|
+
});
|
|
709
738
|
const ListItem = (props) => {
|
|
739
|
+
const liProps = __rest(props, ["variant"]);
|
|
710
740
|
const theme = useThemeSafely();
|
|
711
741
|
const itemStyles = css.css `
|
|
712
742
|
border-bottom: ${theme.controls.border};
|
|
@@ -738,7 +768,7 @@ const ListItem = (props) => {
|
|
|
738
768
|
}
|
|
739
769
|
`}
|
|
740
770
|
`;
|
|
741
|
-
return (React__namespace.createElement("li", { className: css.cx('listItem', itemStyles, props.className) },
|
|
771
|
+
return (React__namespace.createElement("li", Object.assign({}, liProps, { className: css.cx('listItem', itemStyles, props.className) }),
|
|
742
772
|
React__namespace.createElement("div", { className: css.css(contentStyle) }, props.children)));
|
|
743
773
|
};
|
|
744
774
|
|
|
@@ -847,36 +877,55 @@ const getAutocompleteValueId = (v) => {
|
|
|
847
877
|
};
|
|
848
878
|
//TB: will need to use the new input
|
|
849
879
|
const Autocomplete = (p) => {
|
|
880
|
+
var _a;
|
|
850
881
|
const element = React__namespace.useRef(null);
|
|
851
882
|
const input = React__namespace.useRef(null);
|
|
883
|
+
const list = React__namespace.useRef(null);
|
|
852
884
|
const [values, setValues] = React__namespace.useState([]);
|
|
853
885
|
const showValues = React__namespace.useMemo(() => values.length > 0, [values]);
|
|
854
886
|
const shownValues = React__namespace.useMemo(() => {
|
|
855
887
|
var _a;
|
|
856
888
|
return values.slice(0, (_a = p.maxShownValues) !== null && _a !== void 0 ? _a : DEFAULT_MAX_SHOWN_VALUES);
|
|
857
889
|
}, [values]);
|
|
890
|
+
const onChangeForOptions = React__namespace.useRef(lodash.debounce((value) => {
|
|
891
|
+
if (!p.minChars || value.length >= p.minChars) {
|
|
892
|
+
p.getOptions(value)
|
|
893
|
+
.then(vals => {
|
|
894
|
+
setValues(vals);
|
|
895
|
+
}).catch(err => {
|
|
896
|
+
// ignore it
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
else {
|
|
900
|
+
setValues([]);
|
|
901
|
+
}
|
|
902
|
+
}, (_a = p.getOptionsDebounceMs) !== null && _a !== void 0 ? _a : 0, { leading: true, trailing: true }));
|
|
858
903
|
const theme = useThemeSafely();
|
|
859
904
|
const baseClass = css.css `
|
|
860
905
|
label: Autocomplete;
|
|
861
906
|
position: relative;
|
|
862
907
|
width: 100%;
|
|
863
908
|
`;
|
|
909
|
+
let listBorderRadius = '';
|
|
910
|
+
if (p.round || p.rounded || theme.controls.borderRadius) {
|
|
911
|
+
listBorderRadius = theme.controls.borderRadius || '0.5rem';
|
|
912
|
+
}
|
|
864
913
|
const listClass = css.css({
|
|
865
914
|
position: 'absolute',
|
|
866
915
|
width: '100%',
|
|
867
916
|
border: theme.controls.border,
|
|
868
|
-
borderRadius:
|
|
917
|
+
borderRadius: listBorderRadius,
|
|
869
918
|
boxShadow: theme.controls.boxShadow,
|
|
870
919
|
backgroundColor: theme.colors.bg,
|
|
871
920
|
marginTop: `-4px !important`,
|
|
872
921
|
zIndex: theme.zIndexes.backdrop,
|
|
873
922
|
'li:first-child button': {
|
|
874
|
-
borderTopRightRadius:
|
|
875
|
-
borderTopLeftRadius:
|
|
923
|
+
borderTopRightRadius: listBorderRadius,
|
|
924
|
+
borderTopLeftRadius: listBorderRadius,
|
|
876
925
|
},
|
|
877
926
|
'li:last-child button': {
|
|
878
|
-
borderBottomRightRadius:
|
|
879
|
-
borderBottomLeftRadius:
|
|
927
|
+
borderBottomRightRadius: listBorderRadius,
|
|
928
|
+
borderBottomLeftRadius: listBorderRadius,
|
|
880
929
|
}
|
|
881
930
|
});
|
|
882
931
|
const inputClass = css.css `
|
|
@@ -888,28 +937,64 @@ const Autocomplete = (p) => {
|
|
|
888
937
|
const buttonStyles = css.css({
|
|
889
938
|
borderRadius: 0,
|
|
890
939
|
});
|
|
940
|
+
const buttonMarkerClass = 'ListItem__button';
|
|
941
|
+
const getNextTabElement = (fromIndex, direction) => {
|
|
942
|
+
var _a, _b, _c;
|
|
943
|
+
if (fromIndex === -1) {
|
|
944
|
+
let buttonIndex = 0;
|
|
945
|
+
if (direction === -1) {
|
|
946
|
+
buttonIndex = shownValues.length - 1;
|
|
947
|
+
}
|
|
948
|
+
return (_a = list.current) === null || _a === void 0 ? void 0 : _a.querySelector(`.${buttonMarkerClass}${buttonIndex}`);
|
|
949
|
+
}
|
|
950
|
+
else {
|
|
951
|
+
const nextIndex = fromIndex + direction;
|
|
952
|
+
if (nextIndex >= shownValues.length || nextIndex < 0) {
|
|
953
|
+
return (_b = input.current) !== null && _b !== void 0 ? _b : undefined;
|
|
954
|
+
}
|
|
955
|
+
else {
|
|
956
|
+
return (_c = list.current) === null || _c === void 0 ? void 0 : _c.querySelector(`.${buttonMarkerClass}${nextIndex}`);
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
};
|
|
891
960
|
return (React__namespace.createElement("div", { ref: element, className: css.cx(baseClass, 'autocomplete') },
|
|
892
961
|
React__namespace.createElement(Backdrop$1, { onClick: () => setValues([]), show: showValues, allowScroll: true, transparent: true }),
|
|
893
962
|
React__namespace.createElement(TabLocker, { disabled: !showValues, style: { position: 'relative' } },
|
|
894
963
|
React__namespace.createElement(Input, { inputAriaAttributes: p.inputAriaAttributes, ref: input, debounceMs: 0, type: "text", value: getAutocompleteValueText(p.value), round: p.round, rounded: p.rounded, rightControl: p.rightControl, placeholder: p.placeholder, id: p.id, disabled: p.disabled, className: p.className, inputClassName: css.cx(inputClass, p.inputClassName), maxLength: p.maxLength, required: p.required, onChange: v => {
|
|
895
964
|
const value = v;
|
|
896
965
|
p.onChange(value);
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
966
|
+
onChangeForOptions.current(value);
|
|
967
|
+
}, onKeyDown: e => {
|
|
968
|
+
var _a, _b;
|
|
969
|
+
if (showValues) {
|
|
970
|
+
if (e.key === 'ArrowDown') {
|
|
971
|
+
e.preventDefault();
|
|
972
|
+
e.stopPropagation();
|
|
973
|
+
(_a = getNextTabElement(-1, 1)) === null || _a === void 0 ? void 0 : _a.focus();
|
|
974
|
+
}
|
|
975
|
+
else if (e.key === 'ArrowUp') {
|
|
976
|
+
e.preventDefault();
|
|
977
|
+
e.stopPropagation();
|
|
978
|
+
(_b = getNextTabElement(-1, -1)) === null || _b === void 0 ? void 0 : _b.focus();
|
|
979
|
+
}
|
|
907
980
|
}
|
|
908
981
|
}, onKeyPress: e => { var _a; return (_a = p.onKeyPress) === null || _a === void 0 ? void 0 : _a.call(p, e); } }),
|
|
909
|
-
showValues && (React__namespace.createElement(List, { className: listClass },
|
|
910
|
-
shownValues.map(value => {
|
|
982
|
+
showValues && (React__namespace.createElement(List, { ref: list, className: listClass },
|
|
983
|
+
shownValues.map((value, listItemIndex) => {
|
|
911
984
|
return (React__namespace.createElement(ListItem, { key: getAutocompleteValueId(value), variant: "full" },
|
|
912
|
-
React__namespace.createElement(Button, {
|
|
985
|
+
React__namespace.createElement(Button, { onKeyDown: e => {
|
|
986
|
+
var _a, _b;
|
|
987
|
+
if (e.key === 'ArrowDown') {
|
|
988
|
+
e.stopPropagation();
|
|
989
|
+
e.preventDefault();
|
|
990
|
+
(_a = getNextTabElement(listItemIndex, 1)) === null || _a === void 0 ? void 0 : _a.focus();
|
|
991
|
+
}
|
|
992
|
+
else if (e.key === 'ArrowUp') {
|
|
993
|
+
e.stopPropagation();
|
|
994
|
+
e.preventDefault();
|
|
995
|
+
(_b = getNextTabElement(listItemIndex, -1)) === null || _b === void 0 ? void 0 : _b.focus();
|
|
996
|
+
}
|
|
997
|
+
}, className: css.cx(buttonMarkerClass + listItemIndex, buttonStyles), onClick: () => {
|
|
913
998
|
p.onPick(value);
|
|
914
999
|
setValues([]);
|
|
915
1000
|
setTimeout(() => {
|
|
@@ -1138,33 +1223,6 @@ const Calendar = (p) => {
|
|
|
1138
1223
|
cells)));
|
|
1139
1224
|
};
|
|
1140
1225
|
|
|
1141
|
-
/*! *****************************************************************************
|
|
1142
|
-
Copyright (c) Microsoft Corporation.
|
|
1143
|
-
|
|
1144
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
1145
|
-
purpose with or without fee is hereby granted.
|
|
1146
|
-
|
|
1147
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
1148
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
1149
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
1150
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
1151
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
1152
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
1153
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
1154
|
-
***************************************************************************** */
|
|
1155
|
-
|
|
1156
|
-
function __rest(s, e) {
|
|
1157
|
-
var t = {};
|
|
1158
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1159
|
-
t[p] = s[p];
|
|
1160
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1161
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1162
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1163
|
-
t[p[i]] = s[p[i]];
|
|
1164
|
-
}
|
|
1165
|
-
return t;
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
1226
|
const Checkbox = (props) => {
|
|
1169
1227
|
const inputProps = __rest(props, ["checked", "onChange", "label", "checkedIcon", "uncheckedIcon", "checkedThemeColor", "checkedColor", "readonly"]);
|
|
1170
1228
|
const selected = props.checkedIcon || 'selected';
|
|
@@ -1673,7 +1731,7 @@ const hoverClass = css.css({
|
|
|
1673
1731
|
backgroundColor: 'rgba(0,0,0,0.25) !important'
|
|
1674
1732
|
});
|
|
1675
1733
|
const FileUploader = (p) => {
|
|
1676
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1734
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1677
1735
|
const [message, setMessage] = React.useState(undefined);
|
|
1678
1736
|
const [canUpload, setCanUpload] = React.useState(false);
|
|
1679
1737
|
const [uploading, setUploading] = React.useState(false);
|
|
@@ -1689,7 +1747,7 @@ const FileUploader = (p) => {
|
|
|
1689
1747
|
filesDisplay = (_b = p.instructionMessage) !== null && _b !== void 0 ? _b : `Click or drag and drop files.`;
|
|
1690
1748
|
}
|
|
1691
1749
|
else {
|
|
1692
|
-
filesDisplay = `${files.length.toLocaleString()} file${files.length > 1 ? 's' : ''} selected (${
|
|
1750
|
+
filesDisplay = `${files.length.toLocaleString()} file${files.length > 1 ? 's' : ''} selected (${getFileSizeDisplay(totalFileSize)}): ${files.files.map(f => f.name).join(', ')}`;
|
|
1693
1751
|
}
|
|
1694
1752
|
}
|
|
1695
1753
|
const setAllFiles = (inputFiles) => {
|
|
@@ -1711,8 +1769,9 @@ const FileUploader = (p) => {
|
|
|
1711
1769
|
maxBytes: p.maxBytes
|
|
1712
1770
|
});
|
|
1713
1771
|
};
|
|
1772
|
+
const showInfoOnPick = (_c = p.showInfoOnPick) !== null && _c !== void 0 ? _c : true;
|
|
1714
1773
|
let infoMessage;
|
|
1715
|
-
if (p.infoMessage) {
|
|
1774
|
+
if (p.infoMessage && (!files || showInfoOnPick)) {
|
|
1716
1775
|
if (typeof p.infoMessage === 'string') {
|
|
1717
1776
|
infoMessage = React__default['default'].createElement(Text, { noPad: true }, p.infoMessage);
|
|
1718
1777
|
}
|
|
@@ -1729,6 +1788,8 @@ const FileUploader = (p) => {
|
|
|
1729
1788
|
padding: '1rem',
|
|
1730
1789
|
overflow: 'hidden',
|
|
1731
1790
|
backgroundColor: theme.colors.lightBg,
|
|
1791
|
+
}, p.disabled && {
|
|
1792
|
+
opacity: theme.controls.disabledOpacity
|
|
1732
1793
|
}), onDragOver: e => {
|
|
1733
1794
|
var _a, _b;
|
|
1734
1795
|
e.preventDefault();
|
|
@@ -1762,7 +1823,7 @@ const FileUploader = (p) => {
|
|
|
1762
1823
|
setCanUpload(false);
|
|
1763
1824
|
});
|
|
1764
1825
|
} },
|
|
1765
|
-
React__default['default'].createElement("input", { ref: input, className: css.css({
|
|
1826
|
+
React__default['default'].createElement("input", { disabled: p.disabled, ref: input, className: css.css({
|
|
1766
1827
|
position: 'absolute',
|
|
1767
1828
|
top: -50,
|
|
1768
1829
|
left: 0,
|
|
@@ -1771,6 +1832,8 @@ const FileUploader = (p) => {
|
|
|
1771
1832
|
width: '100%',
|
|
1772
1833
|
cursor: 'pointer',
|
|
1773
1834
|
opacity: 0
|
|
1835
|
+
}, p.disabled && {
|
|
1836
|
+
cursor: 'not-allowed'
|
|
1774
1837
|
}), type: "file", multiple: p.multiple, accept: p.accept, onChange: e => {
|
|
1775
1838
|
try {
|
|
1776
1839
|
if (!e.target.files) {
|
|
@@ -1793,26 +1856,28 @@ const FileUploader = (p) => {
|
|
|
1793
1856
|
zIndex: !!(files === null || files === void 0 ? void 0 : files.length) ? 1 : undefined
|
|
1794
1857
|
}) },
|
|
1795
1858
|
!(files === null || files === void 0 ? void 0 : files.length) && React__default['default'].createElement(Icon, { style: { fontSize: '2rem' }, id: "upload" }),
|
|
1796
|
-
React__default['default'].createElement(Text, { align: "center", noPad: true, spacedOut: true
|
|
1859
|
+
React__default['default'].createElement(Text, { align: "center", noPad: true, spacedOut: true, className: css.css({
|
|
1860
|
+
width: '100%'
|
|
1861
|
+
}) },
|
|
1797
1862
|
filesDisplay,
|
|
1798
1863
|
!!(files === null || files === void 0 ? void 0 : files.length) && (React__default['default'].createElement(Button, { onClick: e => {
|
|
1799
1864
|
e.stopPropagation();
|
|
1800
1865
|
onFilesChange(undefined);
|
|
1801
1866
|
}, className: css.css({ marginLeft: '1rem', color: theme.colors.negative }), rightIcon: React__default['default'].createElement(Icon, { id: "clear" }), variant: "inlineLink" }, "Clear"))),
|
|
1802
1867
|
infoMessage,
|
|
1803
|
-
!!(files === null || files === void 0 ? void 0 : files.invalidFiles.length) && (React__default['default'].createElement(InfoPanel, { variant: "error" },
|
|
1868
|
+
!!(files === null || files === void 0 ? void 0 : files.invalidFiles.length) && (React__default['default'].createElement(InfoPanel, { variant: "error", className: css.css({ width: '100%' }) },
|
|
1804
1869
|
"Invalid files: ",
|
|
1805
1870
|
files.invalidFiles.map(f => f.name).join(', '),
|
|
1806
1871
|
".")),
|
|
1807
|
-
(files === null || files === void 0 ? void 0 : files.overMaxBytes) && (React__default['default'].createElement(InfoPanel, { variant: "error" },
|
|
1872
|
+
(files === null || files === void 0 ? void 0 : files.overMaxBytes) && (React__default['default'].createElement(InfoPanel, { variant: "error", className: css.css({ width: '100%' }) },
|
|
1808
1873
|
"Max file size exceeded (",
|
|
1809
|
-
|
|
1874
|
+
getFileSizeDisplay((_d = p.maxBytes) !== null && _d !== void 0 ? _d : 0),
|
|
1810
1875
|
").")))),
|
|
1811
1876
|
canUpload && !(files === null || files === void 0 ? void 0 : files.hasErrors) && (React__default['default'].createElement(Button, { className: css.css({
|
|
1812
|
-
width: (
|
|
1877
|
+
width: (_e = p.buttonWidth) !== null && _e !== void 0 ? _e : '10rem',
|
|
1813
1878
|
zIndex: 1,
|
|
1814
|
-
}), waiting: uploading, type: "submit", variant: (
|
|
1815
|
-
message === 'success' && (React__default['default'].createElement(UploadInfoPanel, { variant: "positive", message: (
|
|
1879
|
+
}), waiting: uploading, type: "submit", variant: (_f = p.buttonVariant) !== null && _f !== void 0 ? _f : 'primary' }, (_g = p.buttonText) !== null && _g !== void 0 ? _g : 'Upload')),
|
|
1880
|
+
message === 'success' && (React__default['default'].createElement(UploadInfoPanel, { variant: "positive", message: (_h = p.successMessage) !== null && _h !== void 0 ? _h : 'Upload successful.', onClear: () => setMessage(undefined) })),
|
|
1816
1881
|
message === 'failure' && (React__default['default'].createElement(UploadInfoPanel, { variant: "error", message: fullFailureMessage, onClear: () => setMessage(undefined) }))));
|
|
1817
1882
|
};
|
|
1818
1883
|
const UploadInfoPanel = (p) => {
|
|
@@ -1826,18 +1891,28 @@ const UploadInfoPanel = (p) => {
|
|
|
1826
1891
|
p.onClear();
|
|
1827
1892
|
}, rightIcon: React__default['default'].createElement(Icon, { id: "clear" }), variant: "inlineLink" }, "Clear")));
|
|
1828
1893
|
};
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
const
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1894
|
+
// OMG this is dumb. We're sticking with decimals for ease of use.
|
|
1895
|
+
// https://stackoverflow.com/questions/40949135/gigabyte-or-gibibyte-1000-or-1024
|
|
1896
|
+
const getFileSizeDisplay = (size) => {
|
|
1897
|
+
let value = 0;
|
|
1898
|
+
let suffix = '';
|
|
1899
|
+
if (size >= 1000000000) {
|
|
1900
|
+
value = size / 1000000000;
|
|
1901
|
+
suffix = 'GB';
|
|
1902
|
+
}
|
|
1903
|
+
else if (size >= 1000000) {
|
|
1904
|
+
value = size / 1000000;
|
|
1905
|
+
suffix = 'MB';
|
|
1906
|
+
}
|
|
1907
|
+
else if (size >= 1000) {
|
|
1908
|
+
value = size / 1000;
|
|
1909
|
+
suffix = 'KB';
|
|
1837
1910
|
}
|
|
1838
1911
|
else {
|
|
1839
|
-
|
|
1912
|
+
value = size;
|
|
1913
|
+
suffix = 'B';
|
|
1840
1914
|
}
|
|
1915
|
+
return value.toLocaleString(undefined, { minimumFractionDigits: 1, maximumFractionDigits: 1 }) + ` ${suffix}`;
|
|
1841
1916
|
};
|
|
1842
1917
|
|
|
1843
1918
|
/** @deprecated This will not work correctly with emotion/css. Use 'cx' for adding multiple class names together. */
|
|
@@ -2678,7 +2753,7 @@ const OmniLink = (props) => {
|
|
|
2678
2753
|
const Picker = (props) => {
|
|
2679
2754
|
const selectProps = __rest(props
|
|
2680
2755
|
// if we put numbers in, we expect them out
|
|
2681
|
-
, ["value", "options", "onChange", "type", "rounded", "readonly"]);
|
|
2756
|
+
, ["value", "options", "onChange", "type", "rounded", "round", "readonly"]);
|
|
2682
2757
|
// if we put numbers in, we expect them out
|
|
2683
2758
|
let isNumber = false;
|
|
2684
2759
|
if (props.options && props.options.length) {
|
|
@@ -2714,6 +2789,9 @@ const Picker = (props) => {
|
|
|
2714
2789
|
${props.rounded && `
|
|
2715
2790
|
border-radius: ${theme.controls.roundedRadius};
|
|
2716
2791
|
`}
|
|
2792
|
+
${props.round && `
|
|
2793
|
+
border-radius: ${theme.controls.roundRadius};
|
|
2794
|
+
`}
|
|
2717
2795
|
${props.readonly && `
|
|
2718
2796
|
background-color: transparent !important;
|
|
2719
2797
|
border: none;
|
|
@@ -3802,6 +3880,7 @@ exports.WaitingIndicator = WaitingIndicator;
|
|
|
3802
3880
|
exports.calcDynamicThemeProps = calcDynamicThemeProps;
|
|
3803
3881
|
exports.defaultTheme = defaultTheme;
|
|
3804
3882
|
exports.getCurrencyDisplay = getCurrencyDisplay;
|
|
3883
|
+
exports.getFileSizeDisplay = getFileSizeDisplay;
|
|
3805
3884
|
exports.mergeClassNames = mergeClassNames;
|
|
3806
3885
|
exports.useMediaQuery = useMediaQuery;
|
|
3807
3886
|
exports.useThemeSafely = useThemeSafely;
|