@mackin.com/styleguide 8.6.0 → 8.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.d.ts +8 -3
  2. package/index.js +14 -5
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -484,7 +484,7 @@ declare const OmniLink: (props: OmniLinkProps) => JSX.Element;
484
484
 
485
485
  declare type SortDirection = 'asc' | 'desc';
486
486
  interface PagerSortOption<TItem> {
487
- id: string | number;
487
+ id: string;
488
488
  name?: string;
489
489
  sort: (items: TItem[]) => TItem[];
490
490
  }
@@ -709,11 +709,14 @@ interface SearchBoxProps {
709
709
  id?: string;
710
710
  placeholder?: string;
711
711
  round?: boolean;
712
- className?: string;
713
712
  onSubmit?: () => Promise<void>;
714
713
  /** Defaults to 250ms */
715
714
  debounceMs?: number;
716
715
  autoFocus?: boolean;
716
+ /** This will be applied to the containing element (Form). */
717
+ className?: string;
718
+ buttonClassName?: string;
719
+ inputClassName?: string;
717
720
  }
718
721
  declare const SearchBox: (props: SearchBoxProps) => JSX.Element;
719
722
 
@@ -863,7 +866,9 @@ interface SliderProps<T extends SliderValue> {
863
866
  declare const Slider: <T extends SliderValue>(p: SliderProps<T>) => JSX.Element;
864
867
 
865
868
  interface TabHeaderTabProps {
866
- name: string;
869
+ name: string | JSX.Element;
870
+ /** The HTML title of the tab button. Defaults to 'name' prop. */
871
+ title?: string;
867
872
  }
868
873
  interface TabHeaderProps {
869
874
  tabs: TabHeaderTabProps[];
package/index.js CHANGED
@@ -3772,14 +3772,14 @@ const SearchBox = (props) => {
3772
3772
  return (_c = props.onSubmit) === null || _c === void 0 ? void 0 : _c.call(props);
3773
3773
  });
3774
3774
  const theme = useThemeSafely();
3775
- const submitButton = (React__namespace.createElement(Button, { tabIndex: -1, disabled: waiting, readOnly: !props.onSubmit, type: "submit", className: css.css({
3775
+ const submitButton = (React__namespace.createElement(Button, { tabIndex: -1, disabled: waiting, readOnly: !props.onSubmit, type: "submit", className: css.cx(css.css({
3776
3776
  color: `${theme.colors.font} !important;`,
3777
3777
  fontSize: '1rem'
3778
- }), variant: "icon", small: true },
3778
+ }), props.buttonClassName), variant: "icon", small: true },
3779
3779
  React__namespace.createElement(Icon, { id: waiting ? 'waiting' : 'search', spin: waiting })));
3780
3780
  //TB: FUTURE replace with new inputs
3781
3781
  return (React__namespace.createElement(Form, { role: "search", className: css.cx('searchBox', props.className), onSubmit: onSubmit },
3782
- React__namespace.createElement(Input, { autoFocus: props.autoFocus, id: props.id, debounceMs: props.debounceMs, disabled: waiting, type: "text", value: props.value, placeholder: props.placeholder, round: props.round, onChange: props.onChange, rightControl: submitButton })));
3782
+ React__namespace.createElement(Input, { inputClassName: props.inputClassName, autoFocus: props.autoFocus, id: props.id, debounceMs: props.debounceMs, disabled: waiting, type: "text", value: props.value, placeholder: props.placeholder, round: props.round, onChange: props.onChange, rightControl: submitButton })));
3783
3783
  };
3784
3784
 
3785
3785
  const GlobalStyles = (p) => {
@@ -3955,8 +3955,17 @@ const TabHeader = (p) => {
3955
3955
  overflow: 'hidden',
3956
3956
  });
3957
3957
  }
3958
+ let title = tab.title;
3959
+ let buttonContent;
3960
+ if (typeof tab.name === 'string') {
3961
+ title !== null && title !== void 0 ? title : (title = tab.name);
3962
+ buttonContent = React__namespace.createElement(Text, { tag: "div", align: "center", ellipsis: true }, tab.name);
3963
+ }
3964
+ else {
3965
+ buttonContent = tab.name;
3966
+ }
3958
3967
  return (React__namespace.createElement("li", { key: index, className: css.cx(tabStyles, p.tabClassName) },
3959
- React__namespace.createElement(Button, { disabled: tabsChanging, className: buttonStyles, variant: buttonVariant, title: tab.name, readOnly: active, onClick: () => {
3968
+ React__namespace.createElement(Button, { disabled: tabsChanging, className: buttonStyles, variant: buttonVariant, title: title, readOnly: active, onClick: () => {
3960
3969
  const onChange = () => {
3961
3970
  var _a;
3962
3971
  setTabIndex(index);
@@ -3978,7 +3987,7 @@ const TabHeader = (p) => {
3978
3987
  else {
3979
3988
  onChange();
3980
3989
  }
3981
- } }, tab.name)));
3990
+ } }, buttonContent)));
3982
3991
  })),
3983
3992
  variant === 'tab' && (React__namespace.createElement("div", { className: css.cx(css.css({
3984
3993
  label: 'TabHeaderDivider',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mackin.com/styleguide",
3
- "version": "8.6.0",
3
+ "version": "8.7.0",
4
4
  "description": "",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",