@mackin.com/styleguide 7.8.0 → 8.0.0-beta.3

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 +1 -24
  2. package/index.js +17 -41
  3. package/package.json +4 -4
package/index.d.ts CHANGED
@@ -11,8 +11,6 @@ declare type AutocompleteValue = string | AutoCompleteItem;
11
11
  interface AutocompleteProps {
12
12
  value: AutocompleteValue | undefined;
13
13
  round?: boolean;
14
- /** @deprecated Use theme.controls.borderRadius (global) or style the components individually. */
15
- rounded?: boolean;
16
14
  rightControl?: JSX.Element;
17
15
  placeholder?: string;
18
16
  id?: string;
@@ -74,8 +72,6 @@ interface ButtonProps {
74
72
  block?: boolean;
75
73
  /** As round as can be. */
76
74
  round?: boolean;
77
- /** @deprecated Use theme.controls.borderRadius (global) or style the components individually. */
78
- rounded?: boolean;
79
75
  className?: string;
80
76
  rightIcon?: JSX.Element;
81
77
  leftIcon?: JSX.Element;
@@ -174,8 +170,6 @@ interface DatePickerProps {
174
170
  required?: boolean;
175
171
  /** Defaults to 250ms */
176
172
  debounceMs?: number;
177
- /** @deprecated Use theme.controls.borderRadius (global) or style the components individually. */
178
- rounded?: boolean;
179
173
  round?: boolean;
180
174
  /** This is the ms from Date.valueOf(). */
181
175
  min?: number;
@@ -331,7 +325,6 @@ interface InputProps {
331
325
  name?: string;
332
326
  style?: React.CSSProperties;
333
327
  value?: InputValue;
334
- rounded?: boolean;
335
328
  placeholder?: string;
336
329
  id?: string;
337
330
  disabled?: boolean;
@@ -477,8 +470,6 @@ interface OmniLinkProps {
477
470
  title?: string;
478
471
  /** Only for button variants. */
479
472
  round?: boolean;
480
- /** @deprecated Use theme.controls.borderRadius (global) or style the components individually. Only for button variants. */
481
- rounded?: boolean;
482
473
  /** Only for button variants. */
483
474
  small?: boolean;
484
475
  /** Overrides the default color (theme.colors.link) for non-button variants. To be used under exceptional circumstances. To change all link colors, override theme.colors.link directly. */
@@ -565,8 +556,6 @@ interface PagerStyleProps {
565
556
  noResultsText?: string;
566
557
  /** Used for localizations. Defaults to 'Page' */
567
558
  pageText?: string;
568
- /** @deprecated Use theme.controls.borderRadius (global) or style the components individually. */
569
- rounded?: boolean;
570
559
  className?: string;
571
560
  leftControls?: JSX.Element;
572
561
  rightControls?: JSX.Element;
@@ -666,10 +655,6 @@ interface PickerProps<T extends PickerValue> extends SelectProps {
666
655
  })[];
667
656
  onChange: (value: T, event: React.ChangeEvent<HTMLSelectElement>) => void;
668
657
  readonly?: boolean;
669
- /** @deprecated Unused. Picker will always render a 'select' element. */
670
- type?: 'select';
671
- /** @deprecated Use theme.controls.borderRadius (global) or style the components individually. */
672
- rounded?: boolean;
673
658
  }
674
659
  declare const Picker: <T extends PickerValue>(props: PickerProps<T>) => JSX.Element;
675
660
 
@@ -713,8 +698,6 @@ interface SearchBoxProps {
713
698
  id?: string;
714
699
  placeholder?: string;
715
700
  round?: boolean;
716
- /** @deprecated Use theme.controls.borderRadius (global) or style the components individually. */
717
- rounded?: boolean;
718
701
  className?: string;
719
702
  onSubmit?: () => Promise<void>;
720
703
  /** Defaults to 250ms */
@@ -726,8 +709,6 @@ declare type Alignment = 'left' | 'right' | 'center';
726
709
 
727
710
  declare const GlobalStyles: () => null;
728
711
 
729
- /** @deprecated This will not work correctly with emotion/css. Use 'cx' for adding multiple class names together. */
730
- declare const mergeClassNames: (...classes: (string | boolean | undefined)[]) => string | undefined;
731
712
  declare const getCurrencyDisplay: (value: number, isCents?: boolean | undefined, denomination?: string) => string;
732
713
 
733
714
  interface MackinTheme {
@@ -793,8 +774,6 @@ interface MackinTheme {
793
774
  focusOutlineShadow: string;
794
775
  focusOutlineRequiredShadow: string;
795
776
  roundRadius: string;
796
- /** @deprecated Use theme.controls.borderRadius (global) or style the components individually. */
797
- roundedRadius: string;
798
777
  disabledOpacity: string;
799
778
  formButtonMinWidth: string;
800
779
  gap: string;
@@ -859,8 +838,6 @@ interface TabHeaderTabProps {
859
838
  interface TabHeaderProps {
860
839
  tabs: TabHeaderTabProps[];
861
840
  id?: string;
862
- /** @deprecated Use theme.controls.borderRadius (global) or style the components individually. */
863
- rounded?: boolean;
864
841
  /** Defaults to 10rem. */
865
842
  maxTabWidth?: string;
866
843
  onTabChanged?: (tabIndex: number) => void;
@@ -994,4 +971,4 @@ declare const WaitingIndicator: (p: {
994
971
  debug?: boolean;
995
972
  }) => JSX.Element;
996
973
 
997
- export { Alignment, Autocomplete, AutocompleteProps, AutocompleteValue, Backdrop$1 as Backdrop, Backdrop as Backdrop2, BoundMemoryPager, BoundStaticPager, Button, ButtonProps, Calendar, CalendarProps, Checkbox, CheckboxProps, ConfirmModal, ConfirmModalProps, CopyButton, DateInput, DateInputProps, DatePicker, DatePickerProps, Divider, ErrorModal, FileUploader, Form, FormColumnRow, FormFlexRow, GlobalStyles, Header, Highlight, ICONS, Icon, Image, InfoPanel, InfoTip, InfoTipProps, Input, InputProps, ItemPager, Label, LabelProps, List, ListItem, MackinTheme, Modal, Nav, NumberInput, NumberInputProps, OmniLink, OmniLinkProps, PagedResult, Pager, PagerProps, Picker, PickerProps, Popover, ProgressBar, ProgressBarProps, SearchBox, SearchBoxProps, Slider, TabHeader, TabHeaderProps, TabLocker, Table, Td, TdCurrency, TdNumber, Text, TextArea, TextAreaProps, TextInput, TextInputProps, TextProps, Th, ThSort, ThemeProvider, ToggleButton, ToggleButtonGroup, ToggleButtonGroupProps, ToggleButtonProps, TogglePasswordInput, Tr, WaitingIndicator, calcDynamicThemeProps, defaultTheme, getCurrencyDisplay, mergeClassNames, useMediaQuery, useThemeSafely };
974
+ 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, useMediaQuery, useThemeSafely };
package/index.js CHANGED
@@ -110,8 +110,6 @@ const defaultTheme = {
110
110
  focusOutlineShadow: '',
111
111
  focusOutlineRequiredShadow: '',
112
112
  roundRadius: '3rem',
113
- /** @deprecated Use theme.controls.borderRadius (global) or style the components individually. */
114
- roundedRadius: '0.5rem',
115
113
  disabledOpacity: '0.5',
116
114
  formButtonMinWidth: '7rem',
117
115
  gap: '1rem',
@@ -469,9 +467,6 @@ const Button = (props) => {
469
467
  ${props.round && `
470
468
  border-radius: ${theme.controls.roundRadius};
471
469
  `}
472
- ${props.rounded && `
473
- border-radius: ${theme.controls.roundedRadius};
474
- `}
475
470
  ${props.block && `
476
471
  width: 100%;
477
472
  `}
@@ -561,8 +556,6 @@ const Input = React__namespace.forwardRef((props, ref) => {
561
556
  borderRadius: theme.controls.roundRadius,
562
557
  paddingLeft: `calc(${theme.controls.padding} * 2)`,
563
558
  paddingRight: `calc(${theme.controls.padding} * 2)`
564
- }, props.rounded && {
565
- borderRadius: theme.controls.roundedRadius
566
559
  }, props.readOnly && {
567
560
  backgroundColor: 'transparent',
568
561
  cursor: 'default',
@@ -861,22 +854,26 @@ const Autocomplete = (p) => {
861
854
  position: relative;
862
855
  width: 100%;
863
856
  `;
857
+ let listBorderRadius = '';
858
+ if (p.round || theme.controls.borderRadius) {
859
+ listBorderRadius = theme.controls.borderRadius || '0.5rem';
860
+ }
864
861
  const listClass = css.css({
865
862
  position: 'absolute',
866
863
  width: '100%',
867
864
  border: theme.controls.border,
868
- borderRadius: p.round || p.rounded ? theme.controls.roundedRadius : theme.controls.borderRadius,
865
+ borderRadius: listBorderRadius,
869
866
  boxShadow: theme.controls.boxShadow,
870
867
  backgroundColor: theme.colors.bg,
871
868
  marginTop: `-4px !important`,
872
869
  zIndex: theme.zIndexes.backdrop,
873
870
  'li:first-child button': {
874
- borderTopRightRadius: theme.controls.borderRadius,
875
- borderTopLeftRadius: theme.controls.borderRadius,
871
+ borderTopRightRadius: listBorderRadius,
872
+ borderTopLeftRadius: listBorderRadius,
876
873
  },
877
874
  'li:last-child button': {
878
- borderBottomRightRadius: theme.controls.borderRadius,
879
- borderBottomLeftRadius: theme.controls.borderRadius,
875
+ borderBottomRightRadius: listBorderRadius,
876
+ borderBottomLeftRadius: listBorderRadius,
880
877
  }
881
878
  });
882
879
  const inputClass = css.css `
@@ -891,7 +888,7 @@ const Autocomplete = (p) => {
891
888
  return (React__namespace.createElement("div", { ref: element, className: css.cx(baseClass, 'autocomplete') },
892
889
  React__namespace.createElement(Backdrop$1, { onClick: () => setValues([]), show: showValues, allowScroll: true, transparent: true }),
893
890
  React__namespace.createElement(TabLocker, { disabled: !showValues, style: { position: 'relative' } },
894
- 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 => {
891
+ 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 => {
895
892
  const value = v;
896
893
  p.onChange(value);
897
894
  if (!p.minChars || value.length >= p.minChars) {
@@ -1840,13 +1837,6 @@ const getSizeString = (size) => {
1840
1837
  }
1841
1838
  };
1842
1839
 
1843
- /** @deprecated This will not work correctly with emotion/css. Use 'cx' for adding multiple class names together. */
1844
- const mergeClassNames = (...classes) => {
1845
- if (!classes) {
1846
- return undefined;
1847
- }
1848
- return classes.filter(c => c).map(c => c).join(' ');
1849
- };
1850
1840
  const getCurrencyDisplay = (value, isCents, denomination = '$') => {
1851
1841
  let actualValue = value || 0;
1852
1842
  if (isCents) {
@@ -2646,9 +2636,6 @@ const OmniLink = (props) => {
2646
2636
  ${props.round && `
2647
2637
  border-radius: ${theme.controls.roundRadius};
2648
2638
  `}
2649
- ${props.rounded && `
2650
- border-radius: ${theme.controls.roundedRadius};
2651
- `}
2652
2639
  ${props.small && `
2653
2640
  font-size: 0.8rem;
2654
2641
  height: ${theme.controls.heightSmall};
@@ -2678,7 +2665,7 @@ const OmniLink = (props) => {
2678
2665
  const Picker = (props) => {
2679
2666
  const selectProps = __rest(props
2680
2667
  // if we put numbers in, we expect them out
2681
- , ["value", "options", "onChange", "type", "rounded", "readonly"]);
2668
+ , ["value", "options", "onChange", "readonly"]);
2682
2669
  // if we put numbers in, we expect them out
2683
2670
  let isNumber = false;
2684
2671
  if (props.options && props.options.length) {
@@ -2711,9 +2698,6 @@ const Picker = (props) => {
2711
2698
  outline: none;
2712
2699
  box-shadow: ${theme.controls.focusOutlineShadow};
2713
2700
  }
2714
- ${props.rounded && `
2715
- border-radius: ${theme.controls.roundedRadius};
2716
- `}
2717
2701
  ${props.readonly && `
2718
2702
  background-color: transparent !important;
2719
2703
  border: none;
@@ -2800,9 +2784,6 @@ const Pager = (props) => {
2800
2784
  @media(min-width: ${theme.breakpoints.tablet}) {
2801
2785
  grid-template-columns: ${theme.controls.height} 1fr 1fr 1fr ${theme.controls.height};
2802
2786
  }
2803
- ${props.rounded && `
2804
- border-radius: ${theme.controls.roundedRadius};
2805
- `}
2806
2787
  `;
2807
2788
  const controlStyles = css.css `
2808
2789
  display: none;
@@ -2837,8 +2818,8 @@ const BoundMemoryPager = (p) => {
2837
2818
  var _a, _b, _c;
2838
2819
  const { pager, showPageText } = p, rest = __rest(p, ["pager", "showPageText"]);
2839
2820
  return (React__namespace.createElement(Pager, Object.assign({}, rest, { pageIndex: p.showPageText ? pager.page : undefined, totalPages: p.showPageText ? pager.totalPages : undefined, canGoNext: pager.hasNext, canGoPrevious: pager.hasPrevious, minItem: pager.minItemIndex + 1, maxItem: pager.maxItemIndex + 1, totalItems: pager.totalItems, leftControls: pager.limitOptions.length > 1 && p.onLimit ? (React__namespace.createElement(Label, { text: (_a = p.limitText) !== null && _a !== void 0 ? _a : 'Limit', orientation: "horizontal" },
2840
- React__namespace.createElement(Picker, { type: "select", value: pager.limit, options: pager.limitOptions, onChange: v => { var _a; return (_a = p.onLimit) === null || _a === void 0 ? void 0 : _a.call(p, v); } }))) : undefined, rightControls: pager.sortOptions.length > 1 && p.onSort ? (React__namespace.createElement(Label, { text: (_b = p.sortText) !== null && _b !== void 0 ? _b : 'Sort', orientation: "horizontalReverse" },
2841
- React__namespace.createElement(Picker, { type: "select", value: (_c = pager.sort) !== null && _c !== void 0 ? _c : '', options: pager.sortOptions, onChange: v => { var _a; return (_a = p.onSort) === null || _a === void 0 ? void 0 : _a.call(p, v); } }))) : undefined, page: d => {
2821
+ React__namespace.createElement(Picker, { value: pager.limit, options: pager.limitOptions, onChange: v => { var _a; return (_a = p.onLimit) === null || _a === void 0 ? void 0 : _a.call(p, v); } }))) : undefined, rightControls: pager.sortOptions.length > 1 && p.onSort ? (React__namespace.createElement(Label, { text: (_b = p.sortText) !== null && _b !== void 0 ? _b : 'Sort', orientation: "horizontalReverse" },
2822
+ React__namespace.createElement(Picker, { value: (_c = pager.sort) !== null && _c !== void 0 ? _c : '', options: pager.sortOptions, onChange: v => { var _a; return (_a = p.onSort) === null || _a === void 0 ? void 0 : _a.call(p, v); } }))) : undefined, page: d => {
2842
2823
  p.onPage(d);
2843
2824
  } })));
2844
2825
  };
@@ -2849,8 +2830,8 @@ const BoundStaticPager = (p) => {
2849
2830
  const showLimit = !!(result.limit && p.limitOptions && p.limitOptions.length > 1 && p.onLimit);
2850
2831
  const showSort = !!(p.sort !== undefined && p.sortOptions && p.sortOptions.length > 1 && p.onSort);
2851
2832
  return (React__namespace.createElement(Pager, Object.assign({}, rest, { pageIndex: p.showPageText ? result.page : undefined, totalPages: p.showPageText ? result.totalPages : undefined, canGoNext: result.hasNext, canGoPrevious: result.hasPrevious, minItem: result.minPageItemIndex + 1, maxItem: result.maxPageItemIndex + 1, totalItems: result.total, leftControls: showLimit ? (React__namespace.createElement(Label, { text: (_a = p.limitText) !== null && _a !== void 0 ? _a : 'Limit', orientation: "horizontal" },
2852
- React__namespace.createElement(Picker, { type: "select", value: (_b = result.limit) !== null && _b !== void 0 ? _b : 1, options: (_c = p.limitOptions) !== null && _c !== void 0 ? _c : [1], onChange: v => { var _a; return (_a = p.onLimit) === null || _a === void 0 ? void 0 : _a.call(p, v); } }))) : undefined, rightControls: showSort ? (React__namespace.createElement(Label, { text: (_d = p.sortText) !== null && _d !== void 0 ? _d : 'Sort', orientation: "horizontalReverse" },
2853
- React__namespace.createElement(Picker, { type: "select", value: (_e = p.sort) !== null && _e !== void 0 ? _e : '', options: (_f = p.sortOptions) !== null && _f !== void 0 ? _f : [], onChange: v => {
2833
+ React__namespace.createElement(Picker, { value: (_b = result.limit) !== null && _b !== void 0 ? _b : 1, options: (_c = p.limitOptions) !== null && _c !== void 0 ? _c : [1], onChange: v => { var _a; return (_a = p.onLimit) === null || _a === void 0 ? void 0 : _a.call(p, v); } }))) : undefined, rightControls: showSort ? (React__namespace.createElement(Label, { text: (_d = p.sortText) !== null && _d !== void 0 ? _d : 'Sort', orientation: "horizontalReverse" },
2834
+ React__namespace.createElement(Picker, { value: (_e = p.sort) !== null && _e !== void 0 ? _e : '', options: (_f = p.sortOptions) !== null && _f !== void 0 ? _f : [], onChange: v => {
2854
2835
  var _a;
2855
2836
  (_a = p.onSort) === null || _a === void 0 ? void 0 : _a.call(p, v);
2856
2837
  } }))) : undefined, page: d => {
@@ -3284,7 +3265,7 @@ const SearchBox = (props) => {
3284
3265
  React__namespace.createElement(Icon, { id: waiting ? 'waiting' : 'search', spin: waiting })));
3285
3266
  //TB: replace with new inputs
3286
3267
  return (React__namespace.createElement(Form, { role: "search", className: css.cx('searchBox', props.className), onSubmit: onSubmit },
3287
- React__namespace.createElement(Input, { id: props.id, debounceMs: props.debounceMs, disabled: waiting, type: "text", value: props.value, placeholder: props.placeholder, round: props.round, rounded: props.rounded, onChange: props.onChange, rightControl: submitButton })));
3268
+ React__namespace.createElement(Input, { id: props.id, debounceMs: props.debounceMs, disabled: waiting, type: "text", value: props.value, placeholder: props.placeholder, round: props.round, onChange: props.onChange, rightControl: submitButton })));
3288
3269
  };
3289
3270
 
3290
3271
  const GlobalStyles = () => {
@@ -3443,10 +3424,6 @@ const TabHeader = (p) => {
3443
3424
  borderBottomRightRadius: 0,
3444
3425
  borderBottom: 'none',
3445
3426
  zIndex: 3,
3446
- }, active && p.rounded && {
3447
- borderRadius: p.rounded && theme.controls.roundedRadius,
3448
- borderBottomLeftRadius: 0,
3449
- borderBottomRightRadius: 0,
3450
3427
  });
3451
3428
  buttonVariant = 'link';
3452
3429
  buttonStyles = css.css({
@@ -3464,7 +3441,7 @@ const TabHeader = (p) => {
3464
3441
  });
3465
3442
  }
3466
3443
  return (React__namespace.createElement("li", { key: index, className: tabStyles },
3467
- React__namespace.createElement(Button, { className: buttonStyles, variant: buttonVariant, title: tab.name, readonly: active, rounded: p.rounded && variant === 'button', onClick: () => {
3444
+ React__namespace.createElement(Button, { className: buttonStyles, variant: buttonVariant, title: tab.name, readonly: active, onClick: () => {
3468
3445
  setTabIndex(index);
3469
3446
  if (p.onTabChanged) {
3470
3447
  p.onTabChanged(index);
@@ -3802,7 +3779,6 @@ exports.WaitingIndicator = WaitingIndicator;
3802
3779
  exports.calcDynamicThemeProps = calcDynamicThemeProps;
3803
3780
  exports.defaultTheme = defaultTheme;
3804
3781
  exports.getCurrencyDisplay = getCurrencyDisplay;
3805
- exports.mergeClassNames = mergeClassNames;
3806
3782
  exports.useMediaQuery = useMediaQuery;
3807
3783
  exports.useThemeSafely = useThemeSafely;
3808
3784
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mackin.com/styleguide",
3
- "version": "7.8.0",
3
+ "version": "8.0.0-beta.3",
4
4
  "description": "",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -10,15 +10,15 @@
10
10
  "devDependencies": {},
11
11
  "dependencies": {},
12
12
  "optionalDependencies": {
13
- "react-router-dom": "^5.1.2",
14
- "react-tiny-popover": "^6.0.5",
13
+ "react-router-dom": "^5.3.0",
14
+ "react-tiny-popover": "^7.0.1",
15
15
  "react-slider": "^1.3.1"
16
16
  },
17
17
  "peerDependencies": {
18
18
  "nanoid": "^3.1.23",
19
19
  "date-fns": "^2.13.0",
20
20
  "lodash": "^4.17.15",
21
- "react": "^16.12.0",
21
+ "react": "^17.0.2",
22
22
  "@emotion/css": "^11.1.3",
23
23
  "@fortawesome/fontawesome-svg-core": "^1.2.35",
24
24
  "@fortawesome/pro-light-svg-icons": "^5.15.3",