@mackin.com/styleguide 7.7.1 → 8.0.0-beta.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 +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;
@@ -475,8 +468,6 @@ interface OmniLinkProps {
475
468
  title?: string;
476
469
  /** Only for button variants. */
477
470
  round?: boolean;
478
- /** @deprecated Use theme.controls.borderRadius (global) or style the components individually. Only for button variants. */
479
- rounded?: boolean;
480
471
  /** Only for button variants. */
481
472
  small?: boolean;
482
473
  /** 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. */
@@ -563,8 +554,6 @@ interface PagerStyleProps {
563
554
  noResultsText?: string;
564
555
  /** Used for localizations. Defaults to 'Page' */
565
556
  pageText?: string;
566
- /** @deprecated Use theme.controls.borderRadius (global) or style the components individually. */
567
- rounded?: boolean;
568
557
  className?: string;
569
558
  leftControls?: JSX.Element;
570
559
  rightControls?: JSX.Element;
@@ -664,10 +653,6 @@ interface PickerProps<T extends PickerValue> extends SelectProps {
664
653
  })[];
665
654
  onChange: (value: T, event: React.ChangeEvent<HTMLSelectElement>) => void;
666
655
  readonly?: boolean;
667
- /** @deprecated Unused. Picker will always render a 'select' element. */
668
- type?: 'select';
669
- /** @deprecated Use theme.controls.borderRadius (global) or style the components individually. */
670
- rounded?: boolean;
671
656
  }
672
657
  declare const Picker: <T extends PickerValue>(props: PickerProps<T>) => JSX.Element;
673
658
 
@@ -711,8 +696,6 @@ interface SearchBoxProps {
711
696
  id?: string;
712
697
  placeholder?: string;
713
698
  round?: boolean;
714
- /** @deprecated Use theme.controls.borderRadius (global) or style the components individually. */
715
- rounded?: boolean;
716
699
  className?: string;
717
700
  onSubmit?: () => Promise<void>;
718
701
  /** Defaults to 250ms */
@@ -724,8 +707,6 @@ declare type Alignment = 'left' | 'right' | 'center';
724
707
 
725
708
  declare const GlobalStyles: () => null;
726
709
 
727
- /** @deprecated This will not work correctly with emotion/css. Use 'cx' for adding multiple class names together. */
728
- declare const mergeClassNames: (...classes: (string | boolean | undefined)[]) => string | undefined;
729
710
  declare const getCurrencyDisplay: (value: number, isCents?: boolean | undefined, denomination?: string) => string;
730
711
 
731
712
  interface MackinTheme {
@@ -791,8 +772,6 @@ interface MackinTheme {
791
772
  focusOutlineShadow: string;
792
773
  focusOutlineRequiredShadow: string;
793
774
  roundRadius: string;
794
- /** @deprecated Use theme.controls.borderRadius (global) or style the components individually. */
795
- roundedRadius: string;
796
775
  disabledOpacity: string;
797
776
  formButtonMinWidth: string;
798
777
  gap: string;
@@ -857,8 +836,6 @@ interface TabHeaderTabProps {
857
836
  interface TabHeaderProps {
858
837
  tabs: TabHeaderTabProps[];
859
838
  id?: string;
860
- /** @deprecated Use theme.controls.borderRadius (global) or style the components individually. */
861
- rounded?: boolean;
862
839
  /** Defaults to 10rem. */
863
840
  maxTabWidth?: string;
864
841
  onTabChanged?: (tabIndex: number) => void;
@@ -992,4 +969,4 @@ declare const WaitingIndicator: (p: {
992
969
  debug?: boolean;
993
970
  }) => JSX.Element;
994
971
 
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 };
972
+ 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) {
@@ -2641,9 +2631,6 @@ const OmniLink = (props) => {
2641
2631
  ${props.round && `
2642
2632
  border-radius: ${theme.controls.roundRadius};
2643
2633
  `}
2644
- ${props.rounded && `
2645
- border-radius: ${theme.controls.roundedRadius};
2646
- `}
2647
2634
  ${props.small && `
2648
2635
  font-size: 0.8rem;
2649
2636
  height: ${theme.controls.heightSmall};
@@ -2673,7 +2660,7 @@ const OmniLink = (props) => {
2673
2660
  const Picker = (props) => {
2674
2661
  const selectProps = __rest(props
2675
2662
  // if we put numbers in, we expect them out
2676
- , ["value", "options", "onChange", "type", "rounded", "readonly"]);
2663
+ , ["value", "options", "onChange", "readonly"]);
2677
2664
  // if we put numbers in, we expect them out
2678
2665
  let isNumber = false;
2679
2666
  if (props.options && props.options.length) {
@@ -2706,9 +2693,6 @@ const Picker = (props) => {
2706
2693
  outline: none;
2707
2694
  box-shadow: ${theme.controls.focusOutlineShadow};
2708
2695
  }
2709
- ${props.rounded && `
2710
- border-radius: ${theme.controls.roundedRadius};
2711
- `}
2712
2696
  ${props.readonly && `
2713
2697
  background-color: transparent !important;
2714
2698
  border: none;
@@ -2795,9 +2779,6 @@ const Pager = (props) => {
2795
2779
  @media(min-width: ${theme.breakpoints.tablet}) {
2796
2780
  grid-template-columns: ${theme.controls.height} 1fr 1fr 1fr ${theme.controls.height};
2797
2781
  }
2798
- ${props.rounded && `
2799
- border-radius: ${theme.controls.roundedRadius};
2800
- `}
2801
2782
  `;
2802
2783
  const controlStyles = css.css `
2803
2784
  display: none;
@@ -2832,8 +2813,8 @@ const BoundMemoryPager = (p) => {
2832
2813
  var _a, _b, _c;
2833
2814
  const { pager, showPageText } = p, rest = __rest(p, ["pager", "showPageText"]);
2834
2815
  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" },
2835
- 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" },
2836
- 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 => {
2816
+ 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" },
2817
+ 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 => {
2837
2818
  p.onPage(d);
2838
2819
  } })));
2839
2820
  };
@@ -2844,8 +2825,8 @@ const BoundStaticPager = (p) => {
2844
2825
  const showLimit = !!(result.limit && p.limitOptions && p.limitOptions.length > 1 && p.onLimit);
2845
2826
  const showSort = !!(p.sort !== undefined && p.sortOptions && p.sortOptions.length > 1 && p.onSort);
2846
2827
  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" },
2847
- 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" },
2848
- 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 => {
2828
+ 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" },
2829
+ React__namespace.createElement(Picker, { value: (_e = p.sort) !== null && _e !== void 0 ? _e : '', options: (_f = p.sortOptions) !== null && _f !== void 0 ? _f : [], onChange: v => {
2849
2830
  var _a;
2850
2831
  (_a = p.onSort) === null || _a === void 0 ? void 0 : _a.call(p, v);
2851
2832
  } }))) : undefined, page: d => {
@@ -3279,7 +3260,7 @@ const SearchBox = (props) => {
3279
3260
  React__namespace.createElement(Icon, { id: waiting ? 'waiting' : 'search', spin: waiting })));
3280
3261
  //TB: replace with new inputs
3281
3262
  return (React__namespace.createElement(Form, { role: "search", className: css.cx('searchBox', props.className), onSubmit: onSubmit },
3282
- 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 })));
3263
+ 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 })));
3283
3264
  };
3284
3265
 
3285
3266
  const GlobalStyles = () => {
@@ -3438,10 +3419,6 @@ const TabHeader = (p) => {
3438
3419
  borderBottomRightRadius: 0,
3439
3420
  borderBottom: 'none',
3440
3421
  zIndex: 3,
3441
- }, active && p.rounded && {
3442
- borderRadius: p.rounded && theme.controls.roundedRadius,
3443
- borderBottomLeftRadius: 0,
3444
- borderBottomRightRadius: 0,
3445
3422
  });
3446
3423
  buttonVariant = 'link';
3447
3424
  buttonStyles = css.css({
@@ -3459,7 +3436,7 @@ const TabHeader = (p) => {
3459
3436
  });
3460
3437
  }
3461
3438
  return (React__namespace.createElement("li", { key: index, className: tabStyles },
3462
- React__namespace.createElement(Button, { className: buttonStyles, variant: buttonVariant, title: tab.name, readonly: active, rounded: p.rounded && variant === 'button', onClick: () => {
3439
+ React__namespace.createElement(Button, { className: buttonStyles, variant: buttonVariant, title: tab.name, readonly: active, onClick: () => {
3463
3440
  setTabIndex(index);
3464
3441
  if (p.onTabChanged) {
3465
3442
  p.onTabChanged(index);
@@ -3797,7 +3774,6 @@ exports.WaitingIndicator = WaitingIndicator;
3797
3774
  exports.calcDynamicThemeProps = calcDynamicThemeProps;
3798
3775
  exports.defaultTheme = defaultTheme;
3799
3776
  exports.getCurrencyDisplay = getCurrencyDisplay;
3800
- exports.mergeClassNames = mergeClassNames;
3801
3777
  exports.useMediaQuery = useMediaQuery;
3802
3778
  exports.useThemeSafely = useThemeSafely;
3803
3779
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mackin.com/styleguide",
3
- "version": "7.7.1",
3
+ "version": "8.0.0-beta.1",
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",