@mackin.com/styleguide 8.0.0-beta.10 → 8.0.0-beta.13

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 +48 -14
  2. package/index.js +409 -287
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -3,13 +3,39 @@ import * as React from 'react';
3
3
  import React__default, { ReactNode } from 'react';
4
4
  import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
5
5
 
6
- interface AutoCompleteItem {
6
+ declare type HeaderVariant = 'label' | 'link' | 'primary' | 'secondary' | 'omg' | 'primary2' | 'positive' | 'negative';
7
+ interface AccordianProps {
8
+ header: JSX.Element | string;
9
+ children: React.ReactNode;
10
+ variant?: HeaderVariant;
11
+ /** Defaults to 'true'. */
12
+ block?: boolean;
13
+ className?: string;
14
+ /** If true, padding will not be added to the expanded content */
15
+ noPad?: boolean;
16
+ /** The initial state of the Accordian. Defaults to 'false'.
17
+ * Use with onChange to control the state from outside the Accordian.
18
+ */
19
+ open?: boolean;
20
+ disabled?: boolean;
21
+ /** Defaults to 1020px. */
22
+ maxHeight?: string | undefined;
23
+ /** Defaults to 250ms. */
24
+ expandTimeMs?: number;
25
+ /** Defaults to 'ease-in-out'. */
26
+ transitionTimingFunction?: string;
27
+ onChange?: (open: boolean) => void;
28
+ }
29
+ declare const Accordian: (props: AccordianProps) => JSX.Element;
30
+ declare const useAccordianState: (count: number, openIndex?: number | undefined) => [boolean[], (index: number, open: boolean) => void];
31
+
32
+ interface AutoCompleteEntity {
7
33
  id: string | number;
8
34
  name: string;
9
35
  }
10
- declare type AutocompleteValue = string | AutoCompleteItem;
11
- interface AutocompleteProps {
12
- value: AutocompleteValue | undefined;
36
+ declare type AutocompleteValue = string | AutoCompleteEntity;
37
+ interface AutocompleteProps<T extends AutocompleteValue> {
38
+ value: T | undefined;
13
39
  round?: boolean;
14
40
  rightControl?: JSX.Element;
15
41
  placeholder?: string;
@@ -28,11 +54,11 @@ interface AutocompleteProps {
28
54
  /** Defaults to 0ms. */
29
55
  getOptionsDebounceMs?: number;
30
56
  onChange: (value: string) => void;
31
- getOptions: (value: string) => Promise<AutocompleteValue[]>;
32
- onPick: (value: AutocompleteValue) => void;
57
+ getOptions: (value: string) => Promise<T[]>;
58
+ onPick: (value: T) => void;
33
59
  onKeyPress?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
34
60
  }
35
- declare const Autocomplete: (p: AutocompleteProps) => JSX.Element;
61
+ declare const Autocomplete: <T extends AutocompleteValue>(p: AutocompleteProps<T>) => JSX.Element;
36
62
 
37
63
  /** @deprecated Use Backdrop2 going forward. */
38
64
  declare const Backdrop$1: (props: {
@@ -173,17 +199,21 @@ interface FileUploaderProps {
173
199
  instructionMessage?: string;
174
200
  /** For additional info below the instructionMessage. */
175
201
  infoMessage?: string | JSX.Element;
202
+ /** If false, the 'infoMessage' will be hidden when a file is picked. Defaults to 'true' */
203
+ showInfoOnPick?: boolean;
204
+ disabled?: boolean;
176
205
  }
177
- declare const FileUploader: (p: FileUploaderProps) => JSX.Element;
206
+ declare const FileUploader: (p: FileUploaderProps) => JSX.Element;
207
+ declare const getFileSizeDisplay: (size: number) => string;
178
208
 
179
- declare type FormProps = React.ClassAttributes<HTMLFormElement> & React.FormHTMLAttributes<HTMLFormElement>;
180
- interface IProps extends FormProps {
209
+ declare type BaseProps$3 = React.ClassAttributes<HTMLFormElement> & React.FormHTMLAttributes<HTMLFormElement>;
210
+ interface FormProps extends BaseProps$3 {
181
211
  inline?: boolean;
182
212
  /** If true, preventDefault and stopPropagation will be applied prior to onSubmit being called. Defaults to true. */
183
213
  ajax?: boolean;
184
214
  }
185
215
  /** Use this instead of <form> directly. If we need to fight Chrome's autofill, we can do so at a global level. */
186
- declare const Form: React.ForwardRefExoticComponent<Pick<IProps, "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>>;
216
+ 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>>;
187
217
  declare const FormFlexRow: (props: {
188
218
  children: React.ReactNode;
189
219
  className?: string;
@@ -356,9 +386,11 @@ interface TextInputProps extends BaseProps {
356
386
  value?: string;
357
387
  /** Defaults to 'text'. */
358
388
  type?: 'text' | 'email' | 'url' | 'password';
389
+ /** By default all leading and trailing whitespace will be cleared on blur. */
390
+ noTrim?: boolean;
359
391
  onValueChange: (value: string | undefined) => void;
360
392
  }
361
- declare const TextInput: React.ForwardRefExoticComponent<Pick<TextInputProps, "type" | "value" | "rightControl" | "round" | "wrapperClassName" | "key" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "disabled" | "enterKeyHint" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "maxLength" | "minLength" | "multiple" | "name" | "pattern" | "placeholder" | "readOnly" | "required" | "size" | "src" | "width" | "onChange" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "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" | "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" | "onValueChange" | "customError" | "patternErrorMessage"> & React.RefAttributes<HTMLInputElement>>;
393
+ declare const TextInput: React.ForwardRefExoticComponent<Pick<TextInputProps, "type" | "value" | "rightControl" | "round" | "wrapperClassName" | "key" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "disabled" | "enterKeyHint" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "maxLength" | "minLength" | "multiple" | "name" | "pattern" | "placeholder" | "readOnly" | "required" | "size" | "src" | "width" | "onChange" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "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" | "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" | "noTrim" | "onValueChange" | "customError" | "patternErrorMessage"> & React.RefAttributes<HTMLInputElement>>;
362
394
 
363
395
  interface LabelProps {
364
396
  text: string | JSX.Element;
@@ -897,9 +929,11 @@ declare const Text: (props: TextProps) => React.DetailedReactHTMLElement<{
897
929
 
898
930
  interface TextAreaProps extends Omit<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, 'value'> {
899
931
  value?: string;
932
+ /** By default all leading and trailing whitespace will be cleared on blur. */
933
+ noTrim?: boolean;
900
934
  onValueChange: (value: string | undefined) => void;
901
935
  }
902
- declare const TextArea: React.ForwardRefExoticComponent<Pick<TextAreaProps, "value" | "key" | "autoComplete" | "autoFocus" | "cols" | "dirName" | "disabled" | "form" | "maxLength" | "minLength" | "name" | "placeholder" | "readOnly" | "required" | "rows" | "wrap" | "onChange" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "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" | "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" | "onValueChange"> & React.RefAttributes<HTMLTextAreaElement>>;
936
+ declare const TextArea: React.ForwardRefExoticComponent<Pick<TextAreaProps, "value" | "key" | "autoComplete" | "autoFocus" | "cols" | "dirName" | "disabled" | "form" | "maxLength" | "minLength" | "name" | "placeholder" | "readOnly" | "required" | "rows" | "wrap" | "onChange" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "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" | "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" | "noTrim" | "onValueChange"> & React.RefAttributes<HTMLTextAreaElement>>;
903
937
 
904
938
  declare type ToggleButtonVariant = 'primary' | 'secondary' | 'omg' | 'primary2' | 'positive' | 'negative';
905
939
  interface ToggleButtonProps {
@@ -949,4 +983,4 @@ declare const WaitingIndicator: (p: {
949
983
  debug?: boolean;
950
984
  }) => JSX.Element;
951
985
 
952
- 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, Divider, ErrorModal, FileUploader, Form, FormColumnRow, FormFlexRow, 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, useMediaQuery, useThemeSafely };
986
+ export { Accordian, AccordianProps, Alignment, Autocomplete, AutocompleteProps, AutocompleteValue, Backdrop$1 as Backdrop, Backdrop as Backdrop2, BoundMemoryPager, BoundStaticPager, Button, ButtonProps, Calendar, CalendarProps, Checkbox, CheckboxProps, ConfirmModal, ConfirmModalProps, CopyButton, DateInput, DateInputProps, 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, useAccordianState, useMediaQuery, useThemeSafely };
package/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
2
 
3
- var css = require('@emotion/css');
4
- var lodash = require('lodash');
5
3
  var React = require('react');
6
- var nanoid = require('nanoid');
4
+ var css = require('@emotion/css');
7
5
  var proRegularSvgIcons = require('@fortawesome/pro-regular-svg-icons');
8
6
  var proSolidSvgIcons = require('@fortawesome/pro-solid-svg-icons');
9
7
  var proLightSvgIcons = require('@fortawesome/pro-light-svg-icons');
10
8
  var reactFontawesome = require('@fortawesome/react-fontawesome');
9
+ var lodash = require('lodash');
11
10
  var dateFns = require('date-fns');
11
+ var nanoid = require('nanoid');
12
12
  var reactDom = require('react-dom');
13
13
  var reactTinyPopover = require('react-tiny-popover');
14
14
  var reactRouterDom = require('react-router-dom');
@@ -17,29 +17,97 @@ var ReactSlider = require('react-slider');
17
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
18
18
 
19
19
  function _interopNamespace(e) {
20
- if (e && e.__esModule) return e;
21
- var n = Object.create(null);
22
- if (e) {
23
- Object.keys(e).forEach(function (k) {
24
- if (k !== 'default') {
25
- var d = Object.getOwnPropertyDescriptor(e, k);
26
- Object.defineProperty(n, k, d.get ? d : {
27
- enumerable: true,
28
- get: function () {
29
- return e[k];
30
- }
31
- });
32
- }
33
- });
34
- }
35
- n['default'] = e;
36
- return Object.freeze(n);
20
+ if (e && e.__esModule) return e;
21
+ var n = Object.create(null);
22
+ if (e) {
23
+ Object.keys(e).forEach(function (k) {
24
+ if (k !== 'default') {
25
+ var d = Object.getOwnPropertyDescriptor(e, k);
26
+ Object.defineProperty(n, k, d.get ? d : {
27
+ enumerable: true,
28
+ get: function () {
29
+ return e[k];
30
+ }
31
+ });
32
+ }
33
+ });
34
+ }
35
+ n['default'] = e;
36
+ return Object.freeze(n);
37
37
  }
38
38
 
39
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
40
39
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
40
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
41
41
  var ReactSlider__default = /*#__PURE__*/_interopDefaultLegacy(ReactSlider);
42
42
 
43
+ /*! *****************************************************************************
44
+ Copyright (c) Microsoft Corporation.
45
+
46
+ Permission to use, copy, modify, and/or distribute this software for any
47
+ purpose with or without fee is hereby granted.
48
+
49
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
50
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
51
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
52
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
53
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
54
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
55
+ PERFORMANCE OF THIS SOFTWARE.
56
+ ***************************************************************************** */
57
+
58
+ function __rest(s, e) {
59
+ var t = {};
60
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
61
+ t[p] = s[p];
62
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
63
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
64
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
65
+ t[p[i]] = s[p[i]];
66
+ }
67
+ return t;
68
+ }
69
+
70
+ const ICONS = {
71
+ add: proSolidSvgIcons.faPlus,
72
+ delete: proSolidSvgIcons.faTrashAlt,
73
+ save: proSolidSvgIcons.faSave,
74
+ activate: proRegularSvgIcons.faCheckCircle,
75
+ deactivate: proRegularSvgIcons.faCircle,
76
+ online: proLightSvgIcons.faWifi,
77
+ offline: proLightSvgIcons.faWifiSlash,
78
+ noIcon: proSolidSvgIcons.faCrow,
79
+ close: proSolidSvgIcons.faTimes,
80
+ waiting: proSolidSvgIcons.faSync,
81
+ refresh: proSolidSvgIcons.faSync,
82
+ menu: proLightSvgIcons.faBars,
83
+ search: proLightSvgIcons.faSearch,
84
+ expand: proRegularSvgIcons.faChevronDown,
85
+ collapse: proRegularSvgIcons.faChevronUp,
86
+ help: proLightSvgIcons.faQuestionCircle,
87
+ debug: proLightSvgIcons.faNarwhal,
88
+ goTo: proLightSvgIcons.faChevronRight,
89
+ goBack: proLightSvgIcons.faChevronLeft,
90
+ download: proLightSvgIcons.faCloudDownload,
91
+ upload: proLightSvgIcons.faCloudUpload,
92
+ selected: proSolidSvgIcons.faCheckSquare,
93
+ unselected: proRegularSvgIcons.faSquare,
94
+ pagerLeft: proLightSvgIcons.faChevronLeft,
95
+ pagerRight: proLightSvgIcons.faChevronRight,
96
+ sortAsc: proRegularSvgIcons.faChevronUp,
97
+ sortDesc: proRegularSvgIcons.faChevronDown,
98
+ pickDate: proLightSvgIcons.faCalendarAlt,
99
+ copy: proLightSvgIcons.faCopy,
100
+ paste: proLightSvgIcons.faPaste,
101
+ clear: proRegularSvgIcons.faTimesCircle,
102
+ hide: proLightSvgIcons.faEyeSlash,
103
+ show: proLightSvgIcons.faEye
104
+ };
105
+ const Icon = (props) => {
106
+ var _a;
107
+ const icon = (_a = ICONS[props.id]) !== null && _a !== void 0 ? _a : ICONS['noIcon'];
108
+ return React__namespace.createElement(reactFontawesome.FontAwesomeIcon, { style: props.style, onClick: props.onClick, spin: props.spin, className: css.cx('icon', props.className), icon: icon });
109
+ };
110
+
43
111
  /** Call this on your theme after messing with the props. It will re-build things that depend on sizes and colors. */
44
112
  const calcDynamicThemeProps = (theme) => {
45
113
  theme.controls.border = `${theme.controls.borderWidth} solid ${theme.colors.border}`;
@@ -77,7 +145,7 @@ const defaultTheme = {
77
145
  divider: 'rgba(0, 0, 0, 0.50)',
78
146
  nav: '#7851a9',
79
147
  navFont: 'rgba(255, 255, 255, 0.9)',
80
- focusOutline: 'hsl(155deg 67% 85%)',
148
+ focusOutline: 'rgb(0 188 212 / 75%)',
81
149
  progressBg: '#007bff63',
82
150
  progressFill: '#007bff',
83
151
  modalBg: 'white',
@@ -155,190 +223,6 @@ const useThemeSafely = () => {
155
223
  return defaultTheme;
156
224
  };
157
225
 
158
- /** @deprecated Use Backdrop2 going forward. */
159
- const Backdrop$1 = (props) => {
160
- var _a;
161
- const showTimeMs = (_a = props.showTimeMs) !== null && _a !== void 0 ? _a : 250;
162
- const backdropId = React__namespace.useRef('Backdrop' + nanoid.nanoid());
163
- const theme = useThemeSafely();
164
- const backdropStyles = css.css `
165
- opacity: 0;
166
- position: fixed;
167
- top: 0;
168
- left: 0;
169
- right: 0;
170
- bottom: 0;
171
- background-color: ${theme.colors.backdrop};
172
- transition: opacity ${showTimeMs}ms ease-in-out;
173
- visibility: hidden;
174
- user-select: none;
175
- -webkit-tap-highlight-color: transparent;
176
- `;
177
- const showStyles = css.css `
178
- z-index: ${theme.zIndexes.backdrop} !important;
179
- opacity: 1.0 !important;
180
- label:${backdropId.current};
181
- `;
182
- const bodyStyles = css.css `
183
- overflow: hidden !important;
184
- label:${backdropId.current};
185
- `;
186
- const bodyResponsiveStyles = css.css `
187
- label:${backdropId.current};
188
- @media(min-width:${theme.breakpoints.desktop}) {
189
- overflow: auto !important;
190
- }
191
- `;
192
- const bodyReverseResponsiveStyles = css.css `
193
- ${bodyStyles}
194
- overflow: auto !important;
195
- @media(min-width:${theme.breakpoints.desktop}) {
196
- overflow: hidden !important;
197
- }
198
- `;
199
- const styles = css.css `
200
- ${backdropStyles}
201
- ${props.onClick && `
202
- cursor: pointer;
203
- `}
204
- ${props.transparent && `
205
- background-color: transparent;
206
- transition: none;
207
- `}
208
- ${props.children && `
209
- display: flex;
210
- justify-content:center;
211
- align-items: center;
212
- `}
213
- ${props.responsive && `
214
- @media(min-width:${theme.breakpoints.desktop}) {
215
- display: none;
216
- }
217
- `}
218
- ${props.reverseResponsive && `
219
- display: none;
220
- @media(min-width:${theme.breakpoints.desktop}) {
221
- display: flex;
222
- }
223
- `}
224
- `;
225
- const backdrop = React__namespace.useRef(null);
226
- React__namespace.useEffect(() => {
227
- if (backdrop && backdrop.current) {
228
- if (props.show && backdrop.current.style.visibility !== 'visible') {
229
- backdrop.current.style.visibility = 'visible';
230
- backdrop.current.classList.add(showStyles);
231
- if (!props.allowScroll) {
232
- document.body.classList.add(bodyStyles);
233
- if (props.responsive) {
234
- document.body.classList.add(bodyResponsiveStyles);
235
- }
236
- else if (props.reverseResponsive) {
237
- document.body.classList.add(bodyReverseResponsiveStyles);
238
- }
239
- }
240
- }
241
- else if (!props.show && backdrop.current.style.visibility === 'visible') {
242
- backdrop.current.classList.remove(showStyles);
243
- if (backdrop && backdrop.current) {
244
- backdrop.current.style.visibility = 'hidden';
245
- if (!props.allowScroll) {
246
- document.body.classList.remove(bodyStyles);
247
- if (props.responsive) {
248
- document.body.classList.remove(bodyResponsiveStyles);
249
- }
250
- else if (props.reverseResponsive) {
251
- document.body.classList.remove(bodyReverseResponsiveStyles);
252
- }
253
- }
254
- }
255
- }
256
- }
257
- return () => {
258
- if (backdrop && backdrop.current && !props.allowScroll) {
259
- document.body.classList.remove(bodyStyles);
260
- }
261
- };
262
- }, [props.show]);
263
- return (React__namespace.createElement("div", { onMouseDown: e => {
264
- var _a;
265
- e.stopPropagation();
266
- e.preventDefault();
267
- (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props);
268
- }, onClick: e => {
269
- e.stopPropagation();
270
- e.preventDefault();
271
- }, ref: backdrop, className: css.cx('backdrop', styles, props.className) }, props.children));
272
- };
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
-
301
- const ICONS = {
302
- add: proSolidSvgIcons.faPlus,
303
- delete: proSolidSvgIcons.faTrashAlt,
304
- save: proSolidSvgIcons.faSave,
305
- activate: proRegularSvgIcons.faCheckCircle,
306
- deactivate: proRegularSvgIcons.faCircle,
307
- online: proLightSvgIcons.faWifi,
308
- offline: proLightSvgIcons.faWifiSlash,
309
- noIcon: proSolidSvgIcons.faCrow,
310
- close: proSolidSvgIcons.faTimes,
311
- waiting: proSolidSvgIcons.faSync,
312
- refresh: proSolidSvgIcons.faSync,
313
- menu: proLightSvgIcons.faBars,
314
- search: proLightSvgIcons.faSearch,
315
- expand: proRegularSvgIcons.faChevronDown,
316
- collapse: proRegularSvgIcons.faChevronUp,
317
- help: proLightSvgIcons.faQuestionCircle,
318
- debug: proLightSvgIcons.faNarwhal,
319
- goTo: proLightSvgIcons.faChevronRight,
320
- goBack: proLightSvgIcons.faChevronLeft,
321
- download: proLightSvgIcons.faCloudDownload,
322
- upload: proLightSvgIcons.faCloudUpload,
323
- selected: proSolidSvgIcons.faCheckSquare,
324
- unselected: proRegularSvgIcons.faSquare,
325
- pagerLeft: proLightSvgIcons.faChevronLeft,
326
- pagerRight: proLightSvgIcons.faChevronRight,
327
- sortAsc: proRegularSvgIcons.faChevronUp,
328
- sortDesc: proRegularSvgIcons.faChevronDown,
329
- pickDate: proLightSvgIcons.faCalendarAlt,
330
- copy: proLightSvgIcons.faCopy,
331
- paste: proLightSvgIcons.faPaste,
332
- clear: proRegularSvgIcons.faTimesCircle,
333
- hide: proLightSvgIcons.faEyeSlash,
334
- show: proLightSvgIcons.faEye
335
- };
336
- const Icon = (props) => {
337
- var _a;
338
- const icon = (_a = ICONS[props.id]) !== null && _a !== void 0 ? _a : ICONS['noIcon'];
339
- return React__namespace.createElement(reactFontawesome.FontAwesomeIcon, { style: props.style, onClick: props.onClick, spin: props.spin, className: css.cx('icon', props.className), icon: icon });
340
- };
341
-
342
226
  const Button = (props) => {
343
227
  var _a, _b;
344
228
  const nativeProps = __rest(props, ["variant", "textAlign", "block", "round", "rightIcon", "leftIcon", "iconBlock", "small", "readOnly", "waiting", "enforceMinWidth"]);
@@ -513,6 +397,86 @@ const Button = (props) => {
513
397
  props.rightIcon && React__namespace.createElement("span", { className: css.css({ marginLeft: '0.5rem' }) }, props.rightIcon)));
514
398
  };
515
399
 
400
+ const accordianExpandTimeMs = 250;
401
+ const accordianMaxHeight = 1020;
402
+ const accordianTimingFunction = 'ease-in-out';
403
+ // we need to apply the seperately so stuff doesn't hang over during expand/collapse.
404
+ // if we remove this and just keep overflow:hidden, autocompletes will get cut off in the subpanels.
405
+ const visibleStyle = css.css({
406
+ overflow: 'visible'
407
+ });
408
+ const Accordian = (props) => {
409
+ var _a, _b, _c, _d;
410
+ const [open, setOpen] = React__namespace.useState(false);
411
+ const theme = useThemeSafely();
412
+ const content = React__namespace.useRef(null);
413
+ const contentStyles = css.css({
414
+ overflow: 'hidden',
415
+ maxHeight: 0,
416
+ transition: `max-height ${(_a = props.expandTimeMs) !== null && _a !== void 0 ? _a : accordianExpandTimeMs}ms ${(_b = props.transitionTimingFunction) !== null && _b !== void 0 ? _b : accordianTimingFunction}`
417
+ });
418
+ const expandedContentStyles = css.css({
419
+ maxHeight: (_c = props.maxHeight) !== null && _c !== void 0 ? _c : accordianMaxHeight
420
+ });
421
+ const expandedContentWrapperStyles = !props.noPad ? css.css({
422
+ padding: '0 1rem 1rem 1rem'
423
+ }) : undefined;
424
+ React__namespace.useEffect(() => {
425
+ const currentContent = content.current;
426
+ if (currentContent) {
427
+ if (open) {
428
+ currentContent.classList.add(expandedContentStyles);
429
+ window.setTimeout(() => {
430
+ currentContent.classList.add(visibleStyle);
431
+ }, accordianExpandTimeMs);
432
+ }
433
+ else {
434
+ currentContent.classList.remove(visibleStyle, expandedContentStyles);
435
+ }
436
+ }
437
+ }, [open]);
438
+ if (props.open !== undefined) {
439
+ React__namespace.useEffect(() => {
440
+ var _a;
441
+ setOpen((_a = props.open) !== null && _a !== void 0 ? _a : false);
442
+ }, [props.open]);
443
+ }
444
+ return (React__namespace.createElement("div", { className: "accordian" },
445
+ React__namespace.createElement(Button, { readOnly: props.disabled, block: (_d = props.block) !== null && _d !== void 0 ? _d : true, variant: props.variant, className: css.cx(css.css({
446
+ display: 'flex',
447
+ alignItems: 'center',
448
+ justifyContent: 'space-between',
449
+ height: 'auto',
450
+ minHeight: theme.controls.height
451
+ }, props.className)), onClick: e => {
452
+ e.stopPropagation();
453
+ if (props.onChange) {
454
+ props.onChange(!open);
455
+ }
456
+ else {
457
+ setOpen(!open);
458
+ }
459
+ }, rightIcon: !props.disabled ? React__namespace.createElement(Icon, { id: open ? 'collapse' : 'expand' }) : undefined },
460
+ React__namespace.createElement("span", null, props.header)),
461
+ React__namespace.createElement("div", { ref: content, className: css.cx('accordian__body', contentStyles) },
462
+ React__namespace.createElement("div", { className: expandedContentWrapperStyles }, props.children))));
463
+ };
464
+ const useAccordianState = (count, openIndex) => {
465
+ const [panels, setShowPanel] = React__namespace.useState(new Array(count).fill(false).map((b, i) => {
466
+ return i === openIndex;
467
+ }));
468
+ return [
469
+ panels,
470
+ (index, open) => {
471
+ setShowPanel(previousState => {
472
+ const newState = previousState.slice().fill(false);
473
+ newState[index] = open;
474
+ return newState;
475
+ });
476
+ }
477
+ ];
478
+ };
479
+
516
480
  const DEFAULT_DEBOUNCE_MS = 250;
517
481
  const NUMBER_REGEX = /^-?\d+\.?\d*$/;
518
482
  const DATE_REGEX = /(\d{1,2})(?:\/|-)(\d{1,2})(?:\/|-)(\d{4})/;
@@ -854,25 +818,12 @@ const Text = (props) => {
854
818
  }, props.children);
855
819
  };
856
820
 
857
- const DEFAULT_MAX_SHOWN_VALUES = 7;
858
- const getAutocompleteValueText = (v) => {
859
- if (!v) {
860
- return '';
861
- }
862
- if (typeof v === 'string') {
863
- return v;
864
- }
865
- return v.name;
866
- };
867
- const getAutocompleteValueId = (v) => {
868
- if (typeof v === 'string') {
869
- return v;
870
- }
871
- return v.id;
872
- };
873
821
  //TB: FUTURE will need to use the new input
822
+ const defaultMaxShownValues = 7;
823
+ const buttonMarkerClass = 'ListItem__button';
874
824
  const Autocomplete = (p) => {
875
825
  var _a;
826
+ const theme = useThemeSafely();
876
827
  const element = React__namespace.useRef(null);
877
828
  const input = React__namespace.useRef(null);
878
829
  const list = React__namespace.useRef(null);
@@ -880,7 +831,7 @@ const Autocomplete = (p) => {
880
831
  const showValues = React__namespace.useMemo(() => values.length > 0, [values]);
881
832
  const shownValues = React__namespace.useMemo(() => {
882
833
  var _a;
883
- return values.slice(0, (_a = p.maxShownValues) !== null && _a !== void 0 ? _a : DEFAULT_MAX_SHOWN_VALUES);
834
+ return values.slice(0, (_a = p.maxShownValues) !== null && _a !== void 0 ? _a : defaultMaxShownValues);
884
835
  }, [values]);
885
836
  const onChangeForOptions = React__namespace.useRef(lodash.debounce((value) => {
886
837
  if (!p.minChars || value.length >= p.minChars) {
@@ -894,45 +845,7 @@ const Autocomplete = (p) => {
894
845
  else {
895
846
  setValues([]);
896
847
  }
897
- }, (_a = p.getOptionsDebounceMs) !== null && _a !== void 0 ? _a : 0, { leading: true, trailing: true }));
898
- const theme = useThemeSafely();
899
- const baseClass = css.css `
900
- label: Autocomplete;
901
- position: relative;
902
- width: 100%;
903
- `;
904
- let listBorderRadius = '';
905
- if (p.round || theme.controls.borderRadius) {
906
- listBorderRadius = theme.controls.borderRadius || '0.5rem';
907
- }
908
- const listClass = css.css({
909
- position: 'absolute',
910
- width: '100%',
911
- border: theme.controls.border,
912
- borderRadius: listBorderRadius,
913
- boxShadow: theme.controls.boxShadow,
914
- backgroundColor: theme.colors.bg,
915
- marginTop: `-4px !important`,
916
- zIndex: theme.zIndexes.backdrop,
917
- 'li:first-child button': {
918
- borderTopRightRadius: listBorderRadius,
919
- borderTopLeftRadius: listBorderRadius,
920
- },
921
- 'li:last-child button': {
922
- borderBottomRightRadius: listBorderRadius,
923
- borderBottomLeftRadius: listBorderRadius,
924
- }
925
- });
926
- const inputClass = css.css `
927
- ${showValues && `
928
- z-index: ${theme.zIndexes.backdrop};
929
- position: relative;
930
- `}
931
- `;
932
- const buttonStyles = css.css({
933
- borderRadius: 0,
934
- });
935
- const buttonMarkerClass = 'ListItem__button';
848
+ }, (_a = p.getOptionsDebounceMs) !== null && _a !== void 0 ? _a : 0, { leading: false, trailing: true }));
936
849
  const getNextTabElement = (fromIndex, direction) => {
937
850
  var _a, _b, _c;
938
851
  if (fromIndex === -1) {
@@ -952,10 +865,36 @@ const Autocomplete = (p) => {
952
865
  }
953
866
  }
954
867
  };
955
- return (React__namespace.createElement("div", { ref: element, className: css.cx(baseClass, 'autocomplete') },
956
- React__namespace.createElement(Backdrop$1, { onClick: () => setValues([]), show: showValues, allowScroll: true, transparent: true }),
868
+ React__namespace.useEffect(() => {
869
+ const clearItems = () => {
870
+ if (values.length > 0) {
871
+ setValues([]);
872
+ }
873
+ };
874
+ document.addEventListener('click', clearItems);
875
+ return () => {
876
+ document.removeEventListener('click', clearItems);
877
+ };
878
+ }, [values]);
879
+ let listBorderRadius = '';
880
+ if (p.round || theme.controls.borderRadius) {
881
+ listBorderRadius = theme.controls.borderRadius || '0.5rem';
882
+ }
883
+ return (React__namespace.createElement("div", { onClick: e => {
884
+ e.stopPropagation();
885
+ }, onKeyDown: e => {
886
+ var _a;
887
+ if (e.key === 'Escape') {
888
+ setValues([]);
889
+ (_a = input.current) === null || _a === void 0 ? void 0 : _a.focus();
890
+ }
891
+ }, ref: element, className: css.cx(css.css({
892
+ position: 'relative',
893
+ width: '100%',
894
+ label: 'Autocomplete'
895
+ }), 'autocomplete') },
957
896
  React__namespace.createElement(TabLocker, { disabled: !showValues, style: { position: 'relative' } },
958
- React__namespace.createElement(Input, { inputAriaAttributes: p.inputAriaAttributes, ref: input, debounceMs: 0, type: "text", value: getAutocompleteValueText(p.value), round: p.round, 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 => {
897
+ React__namespace.createElement(Input, { inputAriaAttributes: p.inputAriaAttributes, ref: input, debounceMs: 0, type: "text", value: getAutocompleteValueText(p.value), round: p.round, rightControl: p.rightControl, placeholder: p.placeholder, id: p.id, disabled: p.disabled, className: p.className, inputClassName: p.inputClassName, maxLength: p.maxLength, required: p.required, onChange: v => {
959
898
  const value = v;
960
899
  p.onChange(value);
961
900
  onChangeForOptions.current(value);
@@ -974,7 +913,24 @@ const Autocomplete = (p) => {
974
913
  }
975
914
  }
976
915
  }, onKeyPress: e => { var _a; return (_a = p.onKeyPress) === null || _a === void 0 ? void 0 : _a.call(p, e); } }),
977
- showValues && (React__namespace.createElement(List, { ref: list, className: listClass },
916
+ showValues && (React__namespace.createElement(List, { ref: list, className: css.css({
917
+ position: 'absolute',
918
+ width: '100%',
919
+ border: theme.controls.border,
920
+ borderRadius: listBorderRadius,
921
+ boxShadow: theme.controls.boxShadow,
922
+ backgroundColor: theme.colors.bg,
923
+ marginTop: `-4px !important`,
924
+ zIndex: theme.zIndexes.backdrop,
925
+ 'li:first-child button': {
926
+ borderTopRightRadius: listBorderRadius,
927
+ borderTopLeftRadius: listBorderRadius,
928
+ },
929
+ 'li:last-child button': {
930
+ borderBottomRightRadius: listBorderRadius,
931
+ borderBottomLeftRadius: listBorderRadius,
932
+ }
933
+ }) },
978
934
  shownValues.map((value, listItemIndex) => {
979
935
  return (React__namespace.createElement(ListItem, { key: getAutocompleteValueId(value), variant: "full" },
980
936
  React__namespace.createElement(Button, { onKeyDown: e => {
@@ -989,7 +945,9 @@ const Autocomplete = (p) => {
989
945
  e.preventDefault();
990
946
  (_b = getNextTabElement(listItemIndex, -1)) === null || _b === void 0 ? void 0 : _b.focus();
991
947
  }
992
- }, className: css.cx(buttonMarkerClass + listItemIndex, buttonStyles), onClick: () => {
948
+ }, className: css.cx(buttonMarkerClass + listItemIndex, css.css({
949
+ borderRadius: 0,
950
+ })), onClick: () => {
993
951
  p.onPick(value);
994
952
  setValues([]);
995
953
  setTimeout(() => {
@@ -1008,6 +966,137 @@ const Autocomplete = (p) => {
1008
966
  " of ",
1009
967
  values.length.toLocaleString(),
1010
968
  " results."))))))));
969
+ };
970
+ const getAutocompleteValueText = (v) => {
971
+ if (!v) {
972
+ return '';
973
+ }
974
+ if (typeof v === 'string') {
975
+ return v;
976
+ }
977
+ return v.name;
978
+ };
979
+ const getAutocompleteValueId = (v) => {
980
+ if (typeof v === 'string') {
981
+ return v;
982
+ }
983
+ return v.id;
984
+ };
985
+
986
+ /** @deprecated Use Backdrop2 going forward. */
987
+ const Backdrop$1 = (props) => {
988
+ var _a;
989
+ const showTimeMs = (_a = props.showTimeMs) !== null && _a !== void 0 ? _a : 250;
990
+ const backdropId = React__namespace.useRef('Backdrop' + nanoid.nanoid());
991
+ const theme = useThemeSafely();
992
+ const backdropStyles = css.css `
993
+ opacity: 0;
994
+ position: fixed;
995
+ top: 0;
996
+ left: 0;
997
+ right: 0;
998
+ bottom: 0;
999
+ background-color: ${theme.colors.backdrop};
1000
+ transition: opacity ${showTimeMs}ms ease-in-out;
1001
+ visibility: hidden;
1002
+ user-select: none;
1003
+ -webkit-tap-highlight-color: transparent;
1004
+ `;
1005
+ const showStyles = css.css `
1006
+ z-index: ${theme.zIndexes.backdrop} !important;
1007
+ opacity: 1.0 !important;
1008
+ label:${backdropId.current};
1009
+ `;
1010
+ const bodyStyles = css.css `
1011
+ overflow: hidden !important;
1012
+ label:${backdropId.current};
1013
+ `;
1014
+ const bodyResponsiveStyles = css.css `
1015
+ label:${backdropId.current};
1016
+ @media(min-width:${theme.breakpoints.desktop}) {
1017
+ overflow: auto !important;
1018
+ }
1019
+ `;
1020
+ const bodyReverseResponsiveStyles = css.css `
1021
+ ${bodyStyles}
1022
+ overflow: auto !important;
1023
+ @media(min-width:${theme.breakpoints.desktop}) {
1024
+ overflow: hidden !important;
1025
+ }
1026
+ `;
1027
+ const styles = css.css `
1028
+ ${backdropStyles}
1029
+ ${props.onClick && `
1030
+ cursor: pointer;
1031
+ `}
1032
+ ${props.transparent && `
1033
+ background-color: transparent;
1034
+ transition: none;
1035
+ `}
1036
+ ${props.children && `
1037
+ display: flex;
1038
+ justify-content:center;
1039
+ align-items: center;
1040
+ `}
1041
+ ${props.responsive && `
1042
+ @media(min-width:${theme.breakpoints.desktop}) {
1043
+ display: none;
1044
+ }
1045
+ `}
1046
+ ${props.reverseResponsive && `
1047
+ display: none;
1048
+ @media(min-width:${theme.breakpoints.desktop}) {
1049
+ display: flex;
1050
+ }
1051
+ `}
1052
+ `;
1053
+ const backdrop = React__namespace.useRef(null);
1054
+ React__namespace.useEffect(() => {
1055
+ if (backdrop && backdrop.current) {
1056
+ if (props.show && backdrop.current.style.visibility !== 'visible') {
1057
+ backdrop.current.style.visibility = 'visible';
1058
+ backdrop.current.classList.add(showStyles);
1059
+ if (!props.allowScroll) {
1060
+ document.body.classList.add(bodyStyles);
1061
+ if (props.responsive) {
1062
+ document.body.classList.add(bodyResponsiveStyles);
1063
+ }
1064
+ else if (props.reverseResponsive) {
1065
+ document.body.classList.add(bodyReverseResponsiveStyles);
1066
+ }
1067
+ }
1068
+ }
1069
+ else if (!props.show && backdrop.current.style.visibility === 'visible') {
1070
+ backdrop.current.classList.remove(showStyles);
1071
+ if (backdrop && backdrop.current) {
1072
+ backdrop.current.style.visibility = 'hidden';
1073
+ if (!props.allowScroll) {
1074
+ document.body.classList.remove(bodyStyles);
1075
+ if (props.responsive) {
1076
+ document.body.classList.remove(bodyResponsiveStyles);
1077
+ }
1078
+ else if (props.reverseResponsive) {
1079
+ document.body.classList.remove(bodyReverseResponsiveStyles);
1080
+ }
1081
+ }
1082
+ }
1083
+ }
1084
+ }
1085
+ return () => {
1086
+ if (backdrop && backdrop.current && !props.allowScroll) {
1087
+ document.body.classList.remove(bodyStyles);
1088
+ }
1089
+ };
1090
+ }, [props.show]);
1091
+ return (React__namespace.createElement("div", { onMouseDown: e => {
1092
+ var _a;
1093
+ e.stopPropagation();
1094
+ e.preventDefault();
1095
+ (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props);
1096
+ }, onClick: e => {
1097
+ e.stopPropagation();
1098
+ e.preventDefault();
1099
+ }, ref: backdrop, className: css.cx('backdrop', styles, props.className) }, props.children));
1011
1100
  };
1012
1101
 
1013
1102
  const useLogger = (componentName, enabled) => {
@@ -1639,7 +1728,7 @@ const hoverClass = css.css({
1639
1728
  backgroundColor: 'rgba(0,0,0,0.25) !important'
1640
1729
  });
1641
1730
  const FileUploader = (p) => {
1642
- var _a, _b, _c, _d, _e, _f, _g;
1731
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1643
1732
  const [message, setMessage] = React.useState(undefined);
1644
1733
  const [canUpload, setCanUpload] = React.useState(false);
1645
1734
  const [uploading, setUploading] = React.useState(false);
@@ -1655,7 +1744,7 @@ const FileUploader = (p) => {
1655
1744
  filesDisplay = (_b = p.instructionMessage) !== null && _b !== void 0 ? _b : `Click or drag and drop files.`;
1656
1745
  }
1657
1746
  else {
1658
- filesDisplay = `${files.length.toLocaleString()} file${files.length > 1 ? 's' : ''} selected (${getSizeString(totalFileSize)}): ${files.files.map(f => f.name).join(', ')}`;
1747
+ filesDisplay = `${files.length.toLocaleString()} file${files.length > 1 ? 's' : ''} selected (${getFileSizeDisplay(totalFileSize)}): ${files.files.map(f => f.name).join(', ')}`;
1659
1748
  }
1660
1749
  }
1661
1750
  const setAllFiles = (inputFiles) => {
@@ -1677,8 +1766,9 @@ const FileUploader = (p) => {
1677
1766
  maxBytes: p.maxBytes
1678
1767
  });
1679
1768
  };
1769
+ const showInfoOnPick = (_c = p.showInfoOnPick) !== null && _c !== void 0 ? _c : true;
1680
1770
  let infoMessage;
1681
- if (p.infoMessage) {
1771
+ if (p.infoMessage && (!files || showInfoOnPick)) {
1682
1772
  if (typeof p.infoMessage === 'string') {
1683
1773
  infoMessage = React__default['default'].createElement(Text, { noPad: true }, p.infoMessage);
1684
1774
  }
@@ -1695,6 +1785,8 @@ const FileUploader = (p) => {
1695
1785
  padding: '1rem',
1696
1786
  overflow: 'hidden',
1697
1787
  backgroundColor: theme.colors.lightBg,
1788
+ }, p.disabled && {
1789
+ opacity: theme.controls.disabledOpacity
1698
1790
  }), onDragOver: e => {
1699
1791
  var _a, _b;
1700
1792
  e.preventDefault();
@@ -1728,7 +1820,7 @@ const FileUploader = (p) => {
1728
1820
  setCanUpload(false);
1729
1821
  });
1730
1822
  } },
1731
- React__default['default'].createElement("input", { ref: input, className: css.css({
1823
+ React__default['default'].createElement("input", { disabled: p.disabled, ref: input, className: css.css({
1732
1824
  position: 'absolute',
1733
1825
  top: -50,
1734
1826
  left: 0,
@@ -1737,6 +1829,8 @@ const FileUploader = (p) => {
1737
1829
  width: '100%',
1738
1830
  cursor: 'pointer',
1739
1831
  opacity: 0
1832
+ }, p.disabled && {
1833
+ cursor: 'not-allowed'
1740
1834
  }), type: "file", multiple: p.multiple, accept: p.accept, onChange: e => {
1741
1835
  try {
1742
1836
  if (!e.target.files) {
@@ -1759,26 +1853,28 @@ const FileUploader = (p) => {
1759
1853
  zIndex: !!(files === null || files === void 0 ? void 0 : files.length) ? 1 : undefined
1760
1854
  }) },
1761
1855
  !(files === null || files === void 0 ? void 0 : files.length) && React__default['default'].createElement(Icon, { style: { fontSize: '2rem' }, id: "upload" }),
1762
- React__default['default'].createElement(Text, { align: "center", noPad: true, spacedOut: true },
1856
+ React__default['default'].createElement(Text, { align: "center", noPad: true, spacedOut: true, className: css.css({
1857
+ width: '100%'
1858
+ }) },
1763
1859
  filesDisplay,
1764
1860
  !!(files === null || files === void 0 ? void 0 : files.length) && (React__default['default'].createElement(Button, { onClick: e => {
1765
1861
  e.stopPropagation();
1766
1862
  onFilesChange(undefined);
1767
1863
  }, className: css.css({ marginLeft: '1rem', color: theme.colors.negative }), rightIcon: React__default['default'].createElement(Icon, { id: "clear" }), variant: "inlineLink" }, "Clear"))),
1768
1864
  infoMessage,
1769
- !!(files === null || files === void 0 ? void 0 : files.invalidFiles.length) && (React__default['default'].createElement(InfoPanel, { variant: "error" },
1865
+ !!(files === null || files === void 0 ? void 0 : files.invalidFiles.length) && (React__default['default'].createElement(InfoPanel, { variant: "error", className: css.css({ width: '100%' }) },
1770
1866
  "Invalid files: ",
1771
1867
  files.invalidFiles.map(f => f.name).join(', '),
1772
1868
  ".")),
1773
- (files === null || files === void 0 ? void 0 : files.overMaxBytes) && (React__default['default'].createElement(InfoPanel, { variant: "error" },
1869
+ (files === null || files === void 0 ? void 0 : files.overMaxBytes) && (React__default['default'].createElement(InfoPanel, { variant: "error", className: css.css({ width: '100%' }) },
1774
1870
  "Max file size exceeded (",
1775
- getSizeString((_c = p.maxBytes) !== null && _c !== void 0 ? _c : 0),
1871
+ getFileSizeDisplay((_d = p.maxBytes) !== null && _d !== void 0 ? _d : 0),
1776
1872
  ").")))),
1777
1873
  canUpload && !(files === null || files === void 0 ? void 0 : files.hasErrors) && (React__default['default'].createElement(Button, { className: css.css({
1778
- width: (_d = p.buttonWidth) !== null && _d !== void 0 ? _d : '10rem',
1874
+ width: (_e = p.buttonWidth) !== null && _e !== void 0 ? _e : '10rem',
1779
1875
  zIndex: 1,
1780
- }), waiting: uploading, type: "submit", variant: (_e = p.buttonVariant) !== null && _e !== void 0 ? _e : 'primary' }, (_f = p.buttonText) !== null && _f !== void 0 ? _f : 'Upload')),
1781
- message === 'success' && (React__default['default'].createElement(UploadInfoPanel, { variant: "positive", message: (_g = p.successMessage) !== null && _g !== void 0 ? _g : 'Upload successful.', onClear: () => setMessage(undefined) })),
1876
+ }), waiting: uploading, type: "submit", variant: (_f = p.buttonVariant) !== null && _f !== void 0 ? _f : 'primary' }, (_g = p.buttonText) !== null && _g !== void 0 ? _g : 'Upload')),
1877
+ message === 'success' && (React__default['default'].createElement(UploadInfoPanel, { variant: "positive", message: (_h = p.successMessage) !== null && _h !== void 0 ? _h : 'Upload successful.', onClear: () => setMessage(undefined) })),
1782
1878
  message === 'failure' && (React__default['default'].createElement(UploadInfoPanel, { variant: "error", message: fullFailureMessage, onClear: () => setMessage(undefined) }))));
1783
1879
  };
1784
1880
  const UploadInfoPanel = (p) => {
@@ -1792,18 +1888,28 @@ const UploadInfoPanel = (p) => {
1792
1888
  p.onClear();
1793
1889
  }, rightIcon: React__default['default'].createElement(Icon, { id: "clear" }), variant: "inlineLink" }, "Clear")));
1794
1890
  };
1795
- const bytesInMb = 1048576;
1796
- const bytesInKb = 1024;
1797
- const getSizeString = (size) => {
1798
- if (size < bytesInKb) {
1799
- return size.toLocaleString() + ' B';
1800
- }
1801
- else if (size < bytesInMb) {
1802
- return (size / bytesInKb).toLocaleString(undefined, { minimumFractionDigits: 1, maximumFractionDigits: 1 }) + ' KB';
1891
+ // OMG this is dumb. We're sticking with decimals for ease of use.
1892
+ // https://stackoverflow.com/questions/40949135/gigabyte-or-gibibyte-1000-or-1024
1893
+ const getFileSizeDisplay = (size) => {
1894
+ let value = 0;
1895
+ let suffix = '';
1896
+ if (size >= 1000000000) {
1897
+ value = size / 1000000000;
1898
+ suffix = 'GB';
1899
+ }
1900
+ else if (size >= 1000000) {
1901
+ value = size / 1000000;
1902
+ suffix = 'MB';
1903
+ }
1904
+ else if (size >= 1000) {
1905
+ value = size / 1000;
1906
+ suffix = 'KB';
1803
1907
  }
1804
1908
  else {
1805
- return (size / bytesInMb).toLocaleString(undefined, { minimumFractionDigits: 1, maximumFractionDigits: 1 }) + ' MB';
1909
+ value = size;
1910
+ suffix = 'B';
1806
1911
  }
1912
+ return value.toLocaleString(undefined, { minimumFractionDigits: 1, maximumFractionDigits: 1 }) + ` ${suffix}`;
1807
1913
  };
1808
1914
 
1809
1915
  const getCurrencyDisplay = (value, isCents, denomination = '$') => {
@@ -2517,6 +2623,11 @@ const TextInput = React__namespace.forwardRef((props, ref) => {
2517
2623
  if (!e.target.checkValidity()) {
2518
2624
  setLocalValue(undefined);
2519
2625
  }
2626
+ else if (!props.noTrim) {
2627
+ setLocalValue(currentValue => {
2628
+ return currentValue === null || currentValue === void 0 ? void 0 : currentValue.trim();
2629
+ });
2630
+ }
2520
2631
  (_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
2521
2632
  } })));
2522
2633
  });
@@ -3897,6 +4008,14 @@ const TextArea = React__namespace.forwardRef((props, ref) => {
3897
4008
  var _a;
3898
4009
  setLocalValue(e.target.value || undefined);
3899
4010
  (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, e);
4011
+ }, onBlur: e => {
4012
+ var _a;
4013
+ if (!props.noTrim) {
4014
+ setLocalValue(currentValue => {
4015
+ return currentValue === null || currentValue === void 0 ? void 0 : currentValue.trim();
4016
+ });
4017
+ }
4018
+ (_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
3900
4019
  } })),
3901
4020
  React__namespace.createElement(InputErrorDisplay, { error: validationError })));
3902
4021
  });
@@ -4044,6 +4163,7 @@ const WaitingIndicator = (p) => {
4044
4163
  React__default['default'].createElement(Icon, { id: "waiting", spin: true }))));
4045
4164
  };
4046
4165
 
4166
+ exports.Accordian = Accordian;
4047
4167
  exports.Autocomplete = Autocomplete;
4048
4168
  exports.Backdrop = Backdrop$1;
4049
4169
  exports.Backdrop2 = Backdrop;
@@ -4105,6 +4225,8 @@ exports.WaitingIndicator = WaitingIndicator;
4105
4225
  exports.calcDynamicThemeProps = calcDynamicThemeProps;
4106
4226
  exports.defaultTheme = defaultTheme;
4107
4227
  exports.getCurrencyDisplay = getCurrencyDisplay;
4228
+ exports.getFileSizeDisplay = getFileSizeDisplay;
4229
+ exports.useAccordianState = useAccordianState;
4108
4230
  exports.useMediaQuery = useMediaQuery;
4109
4231
  exports.useThemeSafely = useThemeSafely;
4110
4232
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mackin.com/styleguide",
3
- "version": "8.0.0-beta.10",
3
+ "version": "8.0.0-beta.13",
4
4
  "description": "",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",