@mackin.com/styleguide 7.2.1 → 7.3.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 +6 -1
  2. package/index.js +14 -7
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -268,9 +268,11 @@ declare const Header: (props: {
268
268
  toggleMenu?: () => void | undefined;
269
269
  /** If true, will hide menu button on larger screens */
270
270
  responsive?: boolean;
271
- rightElements?: JSX.Element;
272
271
  inline?: boolean;
273
272
  className?: string;
273
+ leftElements?: JSX.Element;
274
+ rightElements?: JSX.Element;
275
+ /** Elements will appear in the center of the header and slightly below. */
274
276
  centerOffsetElements?: JSX.Element;
275
277
  noMenu?: boolean;
276
278
  /** Will fill the title center aligned with wrapping. */
@@ -345,6 +347,7 @@ interface InputProps {
345
347
  debounceMs?: number;
346
348
  /** Defaults to 'off'. */
347
349
  autoComplete?: string;
350
+ autoFocus?: boolean;
348
351
  /** Called with debounce when the input changes. */
349
352
  onChange?: (value: InputValue, name?: string) => void;
350
353
  onFocus?: (event: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
@@ -688,6 +691,8 @@ interface MackinTheme {
688
691
  fonts: {
689
692
  family: string;
690
693
  size: string;
694
+ sizeSmall: string;
695
+ sizeLarge: string;
691
696
  headerFamily: string;
692
697
  };
693
698
  controls: {
package/index.js CHANGED
@@ -108,6 +108,8 @@ const defaultTheme = {
108
108
  fonts: {
109
109
  family: 'Arial, Helvetica, sans-serif',
110
110
  size: '16px',
111
+ sizeSmall: '0.7rem',
112
+ sizeLarge: '1.3rem',
111
113
  headerFamily: 'Arial, Helvetica, sans-serif',
112
114
  },
113
115
  controls: {
@@ -567,7 +569,7 @@ const Text = (props) => {
567
569
  const styles = css.css({
568
570
  userSelect: 'text',
569
571
  label: 'Text'
570
- }, tagStyles[tagChoice], alignStyles[(_a = props.align) !== null && _a !== void 0 ? _a : 'left'], props.smaller && { fontSize: '0.7rem' }, props.larger && { fontSize: '1.3rem' }, props.italics && { fontStyle: 'italic' }, props.ellipsis && {
572
+ }, tagStyles[tagChoice], alignStyles[(_a = props.align) !== null && _a !== void 0 ? _a : 'left'], props.smaller && { fontSize: theme.fonts.sizeSmall }, props.larger && { fontSize: theme.fonts.sizeLarge }, props.italics && { fontStyle: 'italic' }, props.ellipsis && {
571
573
  overflow: 'hidden',
572
574
  whiteSpace: 'nowrap',
573
575
  textOverflow: 'ellipsis'
@@ -800,7 +802,6 @@ const Pager = (props) => {
800
802
  display: block;
801
803
  }
802
804
  `;
803
- //TB: check this after fixing buttons
804
805
  const buttonStyles = css.css({
805
806
  backgroundColor: 'transparent'
806
807
  });
@@ -1636,7 +1637,6 @@ const FormColumnRow = (props) => {
1636
1637
  }), props.className) }, props.children));
1637
1638
  };
1638
1639
 
1639
- //TB: have a sticky variant
1640
1640
  const Header = (props) => {
1641
1641
  const theme = useThemeSafely();
1642
1642
  const bodyStyles = css.css `
@@ -1696,6 +1696,12 @@ const Header = (props) => {
1696
1696
  grid-auto-flow: column;
1697
1697
  align-items: center;
1698
1698
  `;
1699
+ const leftElementStyles = props.leftElements && css.css({
1700
+ display: 'grid',
1701
+ gap: '0.5rem',
1702
+ gridAutoFlow: 'column',
1703
+ alignItems: 'center'
1704
+ });
1699
1705
  const centerElementsStyles = props.centerOffsetElements && css.css `
1700
1706
  position: absolute;
1701
1707
  display: flex;
@@ -1721,6 +1727,7 @@ const Header = (props) => {
1721
1727
  return (React__namespace.createElement("div", { className: css.cx('header', headerStyles, props.className) },
1722
1728
  !props.noMenu && (React__namespace.createElement(Button, { variant: "icon", className: headerButtonStyles, onClick: toggleMenu },
1723
1729
  React__namespace.createElement(Icon, { id: "menu" }))),
1730
+ props.leftElements && React__namespace.createElement("div", { className: leftElementStyles }, props.leftElements),
1724
1731
  title,
1725
1732
  props.rightElements && React__namespace.createElement("div", { className: rightElementStyles }, props.rightElements),
1726
1733
  props.centerOffsetElements && (React__namespace.createElement("div", { className: centerElementsStyles },
@@ -2033,15 +2040,15 @@ const Input = React__namespace.forwardRef((props, ref) => {
2033
2040
  };
2034
2041
  }
2035
2042
  if (props.type === 'number') {
2036
- inputElement = React__namespace.createElement("input", { ref: ref, name: props.name, pattern: props.pattern, style: props.style, autoComplete: autoComplete, tabIndex: props.readOnly ? -1 : undefined, readOnly: props.readOnly,
2043
+ inputElement = React__namespace.createElement("input", { autoFocus: props.autoFocus, ref: ref, name: props.name, pattern: props.pattern, style: props.style, autoComplete: autoComplete, tabIndex: props.readOnly ? -1 : undefined, readOnly: props.readOnly,
2037
2044
  // set fixed default to defeat pasting stupid numbers
2038
2045
  maxLength: 50, min: props.min, max: props.max, required: props.required, disabled: props.disabled, id: props.id, className: css.cx(inputStyles, props.inputClassName), placeholder: props.placeholder, type: "number", value: localValue, onFocus: onFocus, onBlur: onBlur, onChange: localOnChange, onKeyDown: props.onKeyDown, onKeyUp: props.onKeyUp, onKeyPress: props.onKeyPress });
2039
2046
  }
2040
2047
  else if (props.type === 'date') {
2041
- inputElement = React__namespace.createElement("input", { ref: ref, name: props.name, pattern: props.pattern, style: props.style, autoComplete: autoComplete, tabIndex: props.readOnly ? -1 : undefined, readOnly: props.readOnly, maxLength: 10, required: props.required, disabled: props.disabled, id: props.id, className: css.cx(inputStyles, props.inputClassName), placeholder: props.placeholder, type: "text", value: localValue, onFocus: onFocus, onBlur: onBlur, onChange: localOnChange, onKeyDown: props.onKeyDown, onKeyUp: props.onKeyUp, onKeyPress: props.onKeyPress });
2048
+ inputElement = React__namespace.createElement("input", { autoFocus: props.autoFocus, ref: ref, name: props.name, pattern: props.pattern, style: props.style, autoComplete: autoComplete, tabIndex: props.readOnly ? -1 : undefined, readOnly: props.readOnly, maxLength: 10, required: props.required, disabled: props.disabled, id: props.id, className: css.cx(inputStyles, props.inputClassName), placeholder: props.placeholder, type: "text", value: localValue, onFocus: onFocus, onBlur: onBlur, onChange: localOnChange, onKeyDown: props.onKeyDown, onKeyUp: props.onKeyUp, onKeyPress: props.onKeyPress });
2042
2049
  }
2043
2050
  else if (props.type === 'textarea') {
2044
- inputElement = React__namespace.createElement("textarea", { ref: ref, name: props.name, style: props.style, rows: props.rows || 10, autoComplete: autoComplete, tabIndex: props.readOnly ? -1 : undefined, readOnly: props.readOnly, maxLength: props.maxLength || DEFAULT_MAX_LENGTH, required: props.required, disabled: props.disabled, id: props.id, className: css.cx(css.css `
2051
+ inputElement = React__namespace.createElement("textarea", { autoFocus: props.autoFocus, ref: ref, name: props.name, style: props.style, rows: props.rows || 10, autoComplete: autoComplete, tabIndex: props.readOnly ? -1 : undefined, readOnly: props.readOnly, maxLength: props.maxLength || DEFAULT_MAX_LENGTH, required: props.required, disabled: props.disabled, id: props.id, className: css.cx(css.css `
2045
2052
  ${inputStyles}
2046
2053
  max-width: 100%;
2047
2054
  min-height: ${theme.controls.height};
@@ -2050,7 +2057,7 @@ const Input = React__namespace.forwardRef((props, ref) => {
2050
2057
  }
2051
2058
  else {
2052
2059
  // text, password, email, and url
2053
- inputElement = React__namespace.createElement("input", { ref: ref, name: props.name, pattern: props.pattern, style: props.style, autoComplete: autoComplete, tabIndex: props.readOnly ? -1 : undefined, readOnly: props.readOnly, maxLength: props.maxLength || DEFAULT_MAX_LENGTH, required: props.required, disabled: props.disabled, id: props.id, className: css.cx(inputStyles, props.inputClassName), placeholder: props.placeholder, type: props.type, value: localValue, onFocus: onFocus, onBlur: onBlur, onChange: localOnChange, onKeyDown: props.onKeyDown, onKeyUp: props.onKeyUp, onKeyPress: props.onKeyPress });
2060
+ inputElement = React__namespace.createElement("input", { autoFocus: props.autoFocus, ref: ref, name: props.name, pattern: props.pattern, style: props.style, autoComplete: autoComplete, tabIndex: props.readOnly ? -1 : undefined, readOnly: props.readOnly, maxLength: props.maxLength || DEFAULT_MAX_LENGTH, required: props.required, disabled: props.disabled, id: props.id, className: css.cx(inputStyles, props.inputClassName), placeholder: props.placeholder, type: props.type, value: localValue, onFocus: onFocus, onBlur: onBlur, onChange: localOnChange, onKeyDown: props.onKeyDown, onKeyUp: props.onKeyUp, onKeyPress: props.onKeyPress });
2054
2061
  }
2055
2062
  const inputWrapperStyles = css.css `
2056
2063
  width:100%;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mackin.com/styleguide",
3
- "version": "7.2.1",
3
+ "version": "7.3.0",
4
4
  "description": "",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",