@mackin.com/styleguide 7.11.0 → 7.12.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 +18 -4
  2. package/index.js +17 -2
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -289,13 +289,20 @@ interface InfoTipProps {
289
289
  onClose?: () => void;
290
290
  /** Defaults to 'info'. */
291
291
  variant?: 'info' | 'modal';
292
- modalHeader?: string;
293
292
  /** Defaults to nav color. */
294
293
  bgColor?: string;
295
294
  /** Defaults to nav font color. */
296
295
  fontColor?: string;
296
+ /** For variant=modal only. */
297
+ modalHeader?: string;
298
+ /** For variant=modal only. */
297
299
  modalId?: string;
300
+ /** For variant=modal only. */
298
301
  modalDebug?: boolean;
302
+ /** Whether to move the popover on collision with the parent's bounds. Default is false. For variant=info only. */
303
+ reposition?: boolean;
304
+ /** Order of positions as the Popover colides with the window edge. The default order is ['right', 'top', 'left', 'bottom']. For variant=info only. */
305
+ positions?: ("bottom" | "left" | "right" | "top")[] | undefined;
299
306
  }
300
307
  declare const InfoTip: (props: InfoTipProps) => JSX.Element;
301
308
 
@@ -680,7 +687,7 @@ interface PopoverProps {
680
687
  border?: string;
681
688
  /** Popover background. Defaults to theme.colors.bg. */
682
689
  backgroundColor?: string;
683
- /** Order of positions as the Popover colides with the window edge. */
690
+ /** Order of positions as the Popover colides with the window edge. The default order is ['right', 'top', 'left', 'bottom']. */
684
691
  positions?: ("bottom" | "left" | "right" | "top")[] | undefined;
685
692
  }
686
693
  declare const Popover: (p: PopoverProps) => JSX.Element;
@@ -719,7 +726,14 @@ declare const GlobalStyles: () => null;
719
726
 
720
727
  /** @deprecated This will not work correctly with emotion/css. Use 'cx' for adding multiple class names together. */
721
728
  declare const mergeClassNames: (...classes: (string | boolean | undefined)[]) => string | undefined;
722
- declare const getCurrencyDisplay: (value: number, isCents?: boolean | undefined, denomination?: string) => string;
729
+ declare const getCurrencyDisplay: (value: number, isCents?: boolean | undefined, denomination?: string) => string;
730
+ /** Converts an enum to an array of entities with id and name. The enum can be an integer or string enum.*/
731
+ declare const enumToEntities: <T extends {
732
+ [key: string]: string | number;
733
+ }>(enumObj: T) => {
734
+ id: string | number;
735
+ name: string;
736
+ }[];
723
737
 
724
738
  interface MackinTheme {
725
739
  colors: {
@@ -989,4 +1003,4 @@ declare const WaitingIndicator: (p: {
989
1003
  debug?: boolean;
990
1004
  }) => JSX.Element;
991
1005
 
992
- 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, FormProps, 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, getFileSizeDisplay, mergeClassNames, useMediaQuery, useThemeSafely };
1006
+ 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, FormProps, 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, enumToEntities, getCurrencyDisplay, getFileSizeDisplay, mergeClassNames, useMediaQuery, useThemeSafely };
package/index.js CHANGED
@@ -1937,6 +1937,20 @@ const getCurrencyDisplay = (value, isCents, denomination = '$') => {
1937
1937
  };
1938
1938
  const noop = () => {
1939
1939
  // lil' noop would be a great rap name. (thanks linter)
1940
+ };
1941
+ //TB: this will need to be exposed in v8 on the helpers page.
1942
+ /** Converts an enum to an array of entities with id and name. The enum can be an integer or string enum.*/
1943
+ const enumToEntities = (enumObj) => {
1944
+ const entities = [];
1945
+ for (const key in enumObj) {
1946
+ if (isNaN(parseInt(key, 10))) {
1947
+ entities.push({
1948
+ id: enumObj[key],
1949
+ name: key
1950
+ });
1951
+ }
1952
+ }
1953
+ return entities;
1940
1954
  };
1941
1955
 
1942
1956
  const Header = (props) => {
@@ -2061,7 +2075,7 @@ const Image = (props) => {
2061
2075
  };
2062
2076
 
2063
2077
  const InfoTip = (props) => {
2064
- var _a, _b;
2078
+ var _a, _b, _c;
2065
2079
  const [showTip, setShowTip] = React__namespace.useState(false);
2066
2080
  const theme = useThemeSafely();
2067
2081
  const bgColor = (_a = props.bgColor) !== null && _a !== void 0 ? _a : theme.colors.nav;
@@ -2129,7 +2143,7 @@ const InfoTip = (props) => {
2129
2143
  React__namespace.createElement("div", { className: css.css({ padding: '1rem' }) }, props.content))));
2130
2144
  }
2131
2145
  else {
2132
- return (React__namespace.createElement(Popover, { reposition: false, isOpen: showTip, onClickOutside: closeTip, arrorColor: bgColor, border: '', backgroundColor: bgColor, parent: button, content: (React__namespace.createElement("div", { className: css.css({
2146
+ return (React__namespace.createElement(Popover, { positions: props.positions, reposition: (_c = props.reposition) !== null && _c !== void 0 ? _c : false, isOpen: showTip, onClickOutside: closeTip, arrorColor: bgColor, border: '', backgroundColor: bgColor, parent: button, content: (React__namespace.createElement("div", { className: css.css({
2133
2147
  padding: '0.5rem',
2134
2148
  fontSize: '0.75rem',
2135
2149
  maxWidth: '22rem'
@@ -3885,6 +3899,7 @@ exports.Tr = Tr;
3885
3899
  exports.WaitingIndicator = WaitingIndicator;
3886
3900
  exports.calcDynamicThemeProps = calcDynamicThemeProps;
3887
3901
  exports.defaultTheme = defaultTheme;
3902
+ exports.enumToEntities = enumToEntities;
3888
3903
  exports.getCurrencyDisplay = getCurrencyDisplay;
3889
3904
  exports.getFileSizeDisplay = getFileSizeDisplay;
3890
3905
  exports.mergeClassNames = mergeClassNames;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mackin.com/styleguide",
3
- "version": "7.11.0",
3
+ "version": "7.12.0",
4
4
  "description": "",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",