@mackin.com/styleguide 7.7.2 → 7.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.d.ts +14 -25
  2. package/index.js +129 -63
  3. 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
 
@@ -374,9 +363,11 @@ interface NumberInputProps extends Omit<BaseInputProps, 'type' | 'value' | 'onCh
374
363
  min?: number;
375
364
  max?: number;
376
365
  step?: number;
366
+ /** Clamps the value to min/max for each input. Defaults to 'true'. */
367
+ constrainOnInput?: boolean;
377
368
  onChange: (value: number | undefined, event: React.ChangeEvent<HTMLInputElement>) => void;
378
369
  }
379
- declare const NumberInput: React.ForwardRefExoticComponent<Pick<NumberInputProps, "value" | "onChange" | "min" | "max" | "step" | "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" | "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"> & React.RefAttributes<HTMLInputElement>>;
370
+ declare const NumberInput: React.ForwardRefExoticComponent<Pick<NumberInputProps, "value" | "onChange" | "min" | "max" | "step" | "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" | "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" | "constrainOnInput"> & React.RefAttributes<HTMLInputElement>>;
380
371
 
381
372
  interface TextAreaProps extends Omit<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, 'value' | 'onChange'> {
382
373
  value: string | undefined;
@@ -413,20 +404,17 @@ interface LabelProps {
413
404
  }
414
405
  declare const Label: (props: LabelProps) => JSX.Element;
415
406
 
416
- declare const List: (props: {
417
- children?: any;
407
+ interface ListProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement> {
418
408
  altRowColor?: boolean;
419
409
  noLines?: boolean;
420
- className?: string;
421
410
  items?: (string | JSX.Element)[];
422
- }) => JSX.Element;
423
- declare const ListItem: (props: {
424
- children?: any;
425
- id?: string | number;
411
+ }
412
+ 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>>;
413
+ interface ListItemProps extends React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement> {
426
414
  /** For variant 'full', the content will take up the entire space of the parent (no padding applied by this component). */
427
415
  variant?: 'full';
428
- className?: string;
429
- }) => JSX.Element;
416
+ }
417
+ declare const ListItem: (props: ListItemProps) => JSX.Element;
430
418
 
431
419
  interface ModalProps {
432
420
  show: boolean;
@@ -668,6 +656,7 @@ interface PickerProps<T extends PickerValue> extends SelectProps {
668
656
  type?: 'select';
669
657
  /** @deprecated Use theme.controls.borderRadius (global) or style the components individually. */
670
658
  rounded?: boolean;
659
+ round?: boolean;
671
660
  }
672
661
  declare const Picker: <T extends PickerValue>(props: PickerProps<T>) => JSX.Element;
673
662
 
@@ -992,4 +981,4 @@ declare const WaitingIndicator: (p: {
992
981
  debug?: boolean;
993
982
  }) => JSX.Element;
994
983
 
995
- 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 };
984
+ 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, 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, 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", { id: props.id, tabIndex: props.tabIndex, title: props.title, disabled: disabled, style: props.style, onClick: props.onClick, className: css.cx('button', styles, props.className), onMouseEnter: props.onMouseEnter, onMouseLeave: props.onMouseLeave, onFocus: props.onFocus, onBlur: props.onBlur, type: props.type || '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: p.round || p.rounded ? theme.controls.roundedRadius : theme.controls.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: theme.controls.borderRadius,
875
- borderTopLeftRadius: theme.controls.borderRadius,
923
+ borderTopRightRadius: listBorderRadius,
924
+ borderTopLeftRadius: listBorderRadius,
876
925
  },
877
926
  'li:last-child button': {
878
- borderBottomRightRadius: theme.controls.borderRadius,
879
- borderBottomLeftRadius: theme.controls.borderRadius,
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
- if (!p.minChars || value.length >= p.minChars) {
898
- p.getOptions(value)
899
- .then(vals => {
900
- setValues(vals);
901
- }).catch(err => {
902
- // ignore it
903
- });
904
- }
905
- else {
906
- setValues([]);
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, { className: buttonStyles, onClick: () => {
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';
@@ -2195,7 +2253,7 @@ const DateInput = React__namespace.forwardRef((props, ref) => {
2195
2253
  } })));
2196
2254
  });
2197
2255
 
2198
- const parseNumber = (rawValue, step = 0, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) => {
2256
+ const parseNumber = (rawValue, step = 0, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER, applyMinMax) => {
2199
2257
  var _a;
2200
2258
  const decimals = step === 0 ? 0 : (_a = step.toString().split('.')[1]) === null || _a === void 0 ? void 0 : _a.length;
2201
2259
  let value;
@@ -2211,24 +2269,29 @@ const parseNumber = (rawValue, step = 0, min = Number.MIN_SAFE_INTEGER, max = Nu
2211
2269
  else {
2212
2270
  value = parseFloat(value.toFixed(decimals));
2213
2271
  }
2214
- value = Math.max(Math.min(value, max), min);
2272
+ if (applyMinMax) {
2273
+ value = Math.max(Math.min(value, max), min);
2274
+ }
2215
2275
  }
2216
2276
  }
2217
2277
  return [value, value === null || value === void 0 ? void 0 : value.toString()];
2218
2278
  };
2219
2279
  const NumberInput = React__namespace.forwardRef((props, ref) => {
2220
- var _a;
2221
- const { value, onChange } = props, otherProps = __rest(props, ["value", "onChange"]);
2222
- return (React__namespace.createElement(BaseInput, Object.assign({}, otherProps, { ref: ref, maxLength: (_a = props.maxLength) !== null && _a !== void 0 ? _a : 50, type: "number", value: value !== null && value !== void 0 ? value : '', onChange: e => {
2223
- const [v, displayValue] = parseNumber(e.target.value, props.step, props.min, props.max);
2280
+ var _a, _b;
2281
+ const { value, onChange, constrainOnInput } = props, otherProps = __rest(props, ["value", "onChange", "constrainOnInput"]);
2282
+ const applyInputConstraints = (_a = props.constrainOnInput) !== null && _a !== void 0 ? _a : true;
2283
+ return (React__namespace.createElement(BaseInput, Object.assign({}, otherProps, { ref: ref, maxLength: (_b = props.maxLength) !== null && _b !== void 0 ? _b : 50, type: "number", value: value !== null && value !== void 0 ? value : '', onChange: e => {
2284
+ const [v, displayValue] = parseNumber(e.target.value, props.step, props.min, props.max, applyInputConstraints);
2224
2285
  // make sure the displayed value always matches our parsed value.
2225
2286
  e.target.value = displayValue !== null && displayValue !== void 0 ? displayValue : '';
2226
2287
  onChange(v, e);
2227
2288
  }, onBlur: e => {
2228
- // catch all for things we missed.
2229
- // onChange would have been called with undefined, but something strange might remain.
2230
- if (!e.target.checkValidity()) {
2231
- e.target.value = '';
2289
+ if (applyInputConstraints) {
2290
+ // catch all for things we missed.
2291
+ // onChange would have been called with undefined, but something strange might remain.
2292
+ if (!e.target.checkValidity()) {
2293
+ e.target.value = '';
2294
+ }
2232
2295
  }
2233
2296
  } })));
2234
2297
  });
@@ -2673,7 +2736,7 @@ const OmniLink = (props) => {
2673
2736
  const Picker = (props) => {
2674
2737
  const selectProps = __rest(props
2675
2738
  // if we put numbers in, we expect them out
2676
- , ["value", "options", "onChange", "type", "rounded", "readonly"]);
2739
+ , ["value", "options", "onChange", "type", "rounded", "round", "readonly"]);
2677
2740
  // if we put numbers in, we expect them out
2678
2741
  let isNumber = false;
2679
2742
  if (props.options && props.options.length) {
@@ -2709,6 +2772,9 @@ const Picker = (props) => {
2709
2772
  ${props.rounded && `
2710
2773
  border-radius: ${theme.controls.roundedRadius};
2711
2774
  `}
2775
+ ${props.round && `
2776
+ border-radius: ${theme.controls.roundRadius};
2777
+ `}
2712
2778
  ${props.readonly && `
2713
2779
  background-color: transparent !important;
2714
2780
  border: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mackin.com/styleguide",
3
- "version": "7.7.2",
3
+ "version": "7.9.1",
4
4
  "description": "",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",