baseui 0.0.0-next-d21676b → 0.0.0-next-699f2d6

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 (216) hide show
  1. package/a11y/a11y.js.flow +2 -2
  2. package/accordion/panel.js.flow +1 -1
  3. package/accordion/stateful-panel-container.js.flow +1 -1
  4. package/accordion/stateful-panel.js.flow +1 -1
  5. package/accordion/stateless-accordion.js.flow +1 -1
  6. package/accordion/styled-components.js.flow +6 -6
  7. package/accordion/types.js.flow +4 -3
  8. package/app-nav-bar/app-nav-bar.js.flow +2 -2
  9. package/app-nav-bar/mobile-menu.js +3 -1
  10. package/app-nav-bar/mobile-menu.js.flow +3 -1
  11. package/app-nav-bar/styled-components.js.flow +3 -3
  12. package/app-nav-bar/types.js.flow +4 -4
  13. package/app-nav-bar/user-menu.js +4 -1
  14. package/app-nav-bar/user-menu.js.flow +5 -2
  15. package/app-nav-bar/user-profile-tile.js.flow +15 -21
  16. package/app-nav-bar/utils.js.flow +5 -5
  17. package/avatar/avatar.js.flow +2 -5
  18. package/avatar/styled-components.js.flow +3 -3
  19. package/block/styled-components.js.flow +12 -12
  20. package/breadcrumbs/breadcrumbs.js.flow +2 -2
  21. package/button/button.js.flow +5 -7
  22. package/button/index.d.ts +6 -0
  23. package/button/styled-components.js +18 -2
  24. package/button/styled-components.js.flow +32 -8
  25. package/button/types.js.flow +7 -0
  26. package/button/utils.js +3 -1
  27. package/button/utils.js.flow +2 -0
  28. package/button-group/button-group.js.flow +3 -3
  29. package/button-group/stateful-container.js.flow +1 -1
  30. package/card/card.js.flow +1 -1
  31. package/checkbox/checkbox.js.flow +2 -2
  32. package/checkbox/stateful-checkbox.js.flow +1 -1
  33. package/checkbox/styled-components.js.flow +6 -6
  34. package/combobox/combobox.js.flow +2 -2
  35. package/combobox/types.js.flow +1 -1
  36. package/data-table/column-anchor.js.flow +3 -3
  37. package/data-table/column-boolean.js.flow +8 -8
  38. package/data-table/column-categorical.js.flow +9 -9
  39. package/data-table/column-custom.js.flow +1 -1
  40. package/data-table/column-datetime.js.flow +20 -20
  41. package/data-table/column-numerical.js.flow +9 -9
  42. package/data-table/column-string.js.flow +4 -4
  43. package/data-table/column.js +1 -0
  44. package/data-table/column.js.flow +1 -0
  45. package/data-table/data-table.js.flow +34 -32
  46. package/data-table/filter-menu.js.flow +10 -10
  47. package/data-table/filter-shell.js.flow +1 -1
  48. package/data-table/header-cell.js.flow +6 -6
  49. package/data-table/index.js.flow +2 -6
  50. package/data-table/measure-column-widths.js.flow +1 -1
  51. package/data-table/stateful-container.js.flow +5 -6
  52. package/data-table/stateful-data-table.js.flow +7 -7
  53. package/data-table/types.js.flow +4 -4
  54. package/datepicker/calendar-header.js.flow +19 -21
  55. package/datepicker/calendar.js.flow +15 -15
  56. package/datepicker/datepicker.js.flow +34 -34
  57. package/datepicker/day.js.flow +3 -3
  58. package/datepicker/month.js.flow +1 -1
  59. package/datepicker/stateful-calendar.js.flow +1 -1
  60. package/datepicker/stateful-container.js.flow +2 -2
  61. package/datepicker/stateful-datepicker.js.flow +1 -1
  62. package/datepicker/styled-components.js.flow +54 -48
  63. package/datepicker/types.js.flow +3 -3
  64. package/datepicker/utils/calendar-header-helpers.js.flow +4 -4
  65. package/datepicker/utils/date-helpers.js.flow +40 -42
  66. package/datepicker/utils/index.js.flow +1 -1
  67. package/dnd-list/list.js.flow +1 -1
  68. package/dnd-list/stateful-list-container.js.flow +1 -1
  69. package/dnd-list/stateful-list.js.flow +1 -1
  70. package/drawer/drawer.js.flow +1 -1
  71. package/drawer/styled-components.js.flow +5 -5
  72. package/es/app-nav-bar/mobile-menu.js +3 -1
  73. package/es/app-nav-bar/user-menu.js +4 -1
  74. package/es/button/styled-components.js +18 -3
  75. package/es/button/utils.js +2 -0
  76. package/es/data-table/column.js +1 -0
  77. package/es/flex-grid/flex-grid.js +1 -0
  78. package/es/input/masked-input.js +1 -0
  79. package/es/modal/modal-button.js +1 -0
  80. package/es/phone-input/base-country-picker.js +1 -0
  81. package/es/phone-input/country-select-dropdown.js +2 -1
  82. package/es/snackbar/snackbar-element.js +1 -0
  83. package/es/styles/__mocks__/styled.js +1 -0
  84. package/es/styles/styled.js +2 -0
  85. package/es/utils/deprecated-component.js +1 -1
  86. package/esm/app-nav-bar/mobile-menu.js +3 -1
  87. package/esm/app-nav-bar/user-menu.js +4 -1
  88. package/esm/button/styled-components.js +18 -2
  89. package/esm/button/utils.js +3 -1
  90. package/esm/data-table/column.js +1 -0
  91. package/esm/flex-grid/flex-grid.js +1 -0
  92. package/esm/input/masked-input.js +1 -0
  93. package/esm/modal/modal-button.js +1 -0
  94. package/esm/phone-input/base-country-picker.js +1 -0
  95. package/esm/phone-input/country-select-dropdown.js +2 -1
  96. package/esm/snackbar/snackbar-element.js +1 -0
  97. package/esm/styles/__mocks__/styled.js +1 -0
  98. package/esm/styles/styled.js +2 -0
  99. package/esm/utils/deprecated-component.js +1 -1
  100. package/file-uploader/file-uploader.js.flow +5 -3
  101. package/file-uploader/styled-components.js.flow +3 -3
  102. package/flex-grid/flex-grid-item.js.flow +8 -7
  103. package/flex-grid/flex-grid.js +1 -0
  104. package/flex-grid/flex-grid.js.flow +20 -17
  105. package/form-control/form-control.js.flow +1 -1
  106. package/form-control/styled-components.js.flow +3 -3
  107. package/header-navigation/styled-components.js.flow +3 -3
  108. package/heading/heading-level.js.flow +1 -1
  109. package/heading/heading.js.flow +1 -1
  110. package/helper/stateful-helper.js.flow +1 -1
  111. package/helper/styled-components.js.flow +2 -2
  112. package/helpers/responsive-helpers.js.flow +1 -1
  113. package/icon/build-icons.js.flow +6 -12
  114. package/input/base-input.js.flow +2 -2
  115. package/input/masked-input.js +1 -0
  116. package/input/masked-input.js.flow +2 -1
  117. package/input/styled-components.js.flow +1 -1
  118. package/layer/layers-manager.js.flow +10 -12
  119. package/layout-grid/styled-components.js.flow +24 -15
  120. package/link/index.js.flow +2 -2
  121. package/list/types.js.flow +2 -2
  122. package/map-marker/fixed-marker.js.flow +2 -4
  123. package/map-marker/floating-marker.js.flow +10 -14
  124. package/map-marker/pin-head.js.flow +1 -1
  125. package/menu/index.d.ts +1 -1
  126. package/menu/maybe-child-menu.js.flow +1 -1
  127. package/menu/menu.js.flow +2 -2
  128. package/menu/nested-menus.js.flow +8 -9
  129. package/menu/option-list.js.flow +3 -3
  130. package/menu/stateful-container.js.flow +3 -5
  131. package/menu/stateful-menu.js.flow +2 -2
  132. package/menu/styled-components.js.flow +5 -5
  133. package/menu/types.js.flow +3 -5
  134. package/modal/modal-button.js +1 -0
  135. package/modal/modal-button.js.flow +1 -0
  136. package/modal/modal.js.flow +1 -1
  137. package/modal/styled-components.js.flow +9 -19
  138. package/package.json +12 -12
  139. package/pagination/pagination.js.flow +2 -2
  140. package/pagination/stateful-pagination.js.flow +1 -1
  141. package/payment-card/payment-card.js.flow +3 -3
  142. package/payment-card/styled-components.js.flow +1 -1
  143. package/phone-input/base-country-picker.js +2 -0
  144. package/phone-input/base-country-picker.js.flow +3 -2
  145. package/phone-input/country-select-dropdown.js +2 -1
  146. package/phone-input/country-select-dropdown.js.flow +4 -4
  147. package/phone-input/country-select.js.flow +1 -1
  148. package/phone-input/index.js.flow +2 -6
  149. package/phone-input/styled-components.js.flow +3 -3
  150. package/phone-input/types.js.flow +1 -1
  151. package/phone-input/utils.js.flow +1 -1
  152. package/pin-code/index.js.flow +1 -3
  153. package/pin-code/pin-code.js.flow +2 -2
  154. package/pin-code/types.js.flow +2 -2
  155. package/popover/popover.js.flow +1 -1
  156. package/popover/stateful-container.js.flow +1 -1
  157. package/popover/stateful-popover.js.flow +1 -1
  158. package/popover/utils.js.flow +1 -1
  159. package/progress-bar/styled-components.js.flow +18 -18
  160. package/radio/radio.js.flow +2 -2
  161. package/radio/stateful-radiogroup.js.flow +1 -1
  162. package/radio/styled-components.js.flow +6 -6
  163. package/rating/emoticon-rating.js.flow +2 -2
  164. package/rating/star-rating.js.flow +2 -2
  165. package/select/dropdown.js.flow +6 -14
  166. package/select/index.js.flow +1 -3
  167. package/select/select-component.js.flow +13 -13
  168. package/select/styled-components.js.flow +74 -65
  169. package/select/types.js.flow +2 -2
  170. package/select/utils/default-filter-options.js.flow +3 -3
  171. package/select/utils/index.js.flow +1 -1
  172. package/side-navigation/nav-item.js.flow +2 -6
  173. package/side-navigation/nav.js.flow +3 -9
  174. package/side-navigation/stateful-nav.js.flow +1 -1
  175. package/side-navigation/styled-components.js.flow +3 -3
  176. package/side-navigation/types.js.flow +2 -2
  177. package/skeleton/styled-components.js.flow +2 -2
  178. package/slider/slider.js.flow +3 -3
  179. package/slider/stateful-slider.js.flow +1 -1
  180. package/slider/styled-components.js.flow +8 -8
  181. package/snackbar/snackbar-context.js.flow +3 -3
  182. package/snackbar/snackbar-element.js +1 -0
  183. package/snackbar/snackbar-element.js.flow +6 -7
  184. package/spinner/styled-components.js.flow +3 -3
  185. package/styles/__mocks__/styled.js +1 -0
  186. package/styles/styled.js +2 -0
  187. package/styles/styled.js.flow +12 -11
  188. package/styles/theme-provider.js.flow +2 -3
  189. package/styles/util.js.flow +1 -1
  190. package/table/styled-components.js.flow +7 -7
  191. package/table-grid/styled-components.js.flow +3 -3
  192. package/table-semantic/table-builder.js.flow +3 -8
  193. package/tabs/styled-components.js.flow +4 -4
  194. package/tabs-motion/stateful-tabs.js.flow +1 -1
  195. package/tabs-motion/tabs.js.flow +8 -10
  196. package/tag/styled-components.js.flow +4 -4
  197. package/tag/tag.js.flow +4 -4
  198. package/tag/utils.js.flow +4 -2
  199. package/textarea/styled-components.js.flow +9 -6
  200. package/timepicker/timepicker.js.flow +4 -4
  201. package/timezonepicker/timezone-picker.js.flow +5 -5
  202. package/timezonepicker/types.js.flow +1 -1
  203. package/toast/styled-components.js.flow +3 -3
  204. package/toast/toast.js.flow +3 -3
  205. package/toast/toaster.js.flow +12 -12
  206. package/tooltip/stateful-tooltip.js.flow +1 -1
  207. package/tooltip/styled-components.js.flow +3 -3
  208. package/tree-view/stateful-container.js.flow +2 -2
  209. package/tree-view/stateful-tree-view.js.flow +1 -1
  210. package/tree-view/tree-label-interactable.js.flow +2 -2
  211. package/tree-view/tree-label.js.flow +1 -1
  212. package/tree-view/tree-view.js.flow +3 -3
  213. package/tree-view/utils.js.flow +1 -1
  214. package/utils/deprecated-component.js +1 -1
  215. package/utils/deprecated-component.js.flow +2 -2
  216. package/utils/focusVisible.js.flow +25 -21
package/a11y/a11y.js.flow CHANGED
@@ -28,7 +28,7 @@ function validateNode(node) {
28
28
 
29
29
  function segmentViolationsByNode(violations) {
30
30
  const nodes = violations.reduce((map, violation) => {
31
- violation.nodes.forEach(node => {
31
+ violation.nodes.forEach((node) => {
32
32
  if (!map[node.target]) {
33
33
  map[node.target] = [violation];
34
34
  } else {
@@ -93,7 +93,7 @@ function Violation(props: ViolationPropsT) {
93
93
  <TetherBehavior
94
94
  anchorRef={anchor}
95
95
  popperRef={popper}
96
- onPopperUpdate={update => setOffset(update.popper)}
96
+ onPopperUpdate={(update) => setOffset(update.popper)}
97
97
  placement={TETHER_PLACEMENT.bottom}
98
98
  >
99
99
  <ViolationContainer
@@ -176,7 +176,7 @@ const Panel = ({
176
176
 
177
177
  return (
178
178
  <LocaleContext.Consumer>
179
- {locale => (
179
+ {(locale) => (
180
180
  <PanelContainer {...sharedProps} {...panelContainerProps}>
181
181
  <Header
182
182
  tabIndex={0}
@@ -43,7 +43,7 @@ class StatefulPanelContainer extends React.Component<
43
43
 
44
44
  internalSetState(type: StateChangeTypeT, changes: PanelStateT) {
45
45
  const {stateReducer} = this.props;
46
- this.setState(prevState =>
46
+ this.setState((prevState) =>
47
47
  stateReducer ? stateReducer(type, changes, prevState) : changes,
48
48
  );
49
49
  }
@@ -14,7 +14,7 @@ export default function StatefulPanel(props: StatefulPanelPropsT) {
14
14
  const {children, ...restProps} = props;
15
15
  return (
16
16
  <StatefulContainer {...restProps}>
17
- {componentProps => <Panel {...componentProps}>{children}</Panel>}
17
+ {(componentProps) => <Panel {...componentProps}>{children}</Panel>}
18
18
  </StatefulContainer>
19
19
  );
20
20
  }
@@ -43,7 +43,7 @@ function StatelessAccordion({
43
43
  }
44
44
  } else {
45
45
  if (expanded.includes(key)) {
46
- next = expanded.filter(k => k !== key);
46
+ next = expanded.filter((k) => k !== key);
47
47
  } else {
48
48
  next = [...expanded, key];
49
49
  }
@@ -21,7 +21,7 @@ export const Root = styled('ul', {
21
21
  width: '100%',
22
22
  });
23
23
 
24
- export const PanelContainer = styled<SharedStylePropsArgT>('li', props => {
24
+ export const PanelContainer = styled<SharedStylePropsArgT>('li', (props) => {
25
25
  const {
26
26
  $expanded,
27
27
  $theme: {colors},
@@ -35,7 +35,7 @@ export const PanelContainer = styled<SharedStylePropsArgT>('li', props => {
35
35
  };
36
36
  });
37
37
 
38
- export const Header = styled<SharedStylePropsArgT>('div', props => {
38
+ export const Header = styled<SharedStylePropsArgT>('div', (props) => {
39
39
  const {
40
40
  $disabled,
41
41
  $isFocusVisible,
@@ -65,7 +65,7 @@ export const Header = styled<SharedStylePropsArgT>('div', props => {
65
65
  };
66
66
  });
67
67
 
68
- export const ToggleIcon = styled<SharedStylePropsArgT>('svg', props => {
68
+ export const ToggleIcon = styled<SharedStylePropsArgT>('svg', (props) => {
69
69
  const {$theme, $disabled, $color} = props;
70
70
  return {
71
71
  ...getSvgStyles(props),
@@ -75,7 +75,7 @@ export const ToggleIcon = styled<SharedStylePropsArgT>('svg', props => {
75
75
  };
76
76
  });
77
77
 
78
- export const ToggleIconGroup = styled<SharedStylePropsArgT>('g', props => {
78
+ export const ToggleIconGroup = styled<SharedStylePropsArgT>('g', (props) => {
79
79
  const {$theme, $expanded} = props;
80
80
  return {
81
81
  transform: $expanded ? 'rotate(0)' : 'rotate(-90deg)',
@@ -86,7 +86,7 @@ export const ToggleIconGroup = styled<SharedStylePropsArgT>('g', props => {
86
86
  };
87
87
  });
88
88
 
89
- export const Content = styled<SharedStylePropsArgT>('div', props => {
89
+ export const Content = styled<SharedStylePropsArgT>('div', (props) => {
90
90
  const {
91
91
  $theme: {animation, colors, sizing, typography},
92
92
  $expanded,
@@ -116,7 +116,7 @@ export const Content = styled<SharedStylePropsArgT>('div', props => {
116
116
 
117
117
  export const ContentAnimationContainer = styled<
118
118
  {$height: string | number} & SharedStylePropsArgT,
119
- >('div', props => {
119
+ >('div', (props) => {
120
120
  const {
121
121
  $height,
122
122
  $theme: {animation},
@@ -166,9 +166,10 @@ type SharedStatefulPanelContainerPropsT = {
166
166
  onChange?: OnChangeHandlerT,
167
167
  stateReducer?: PanelStateReducerT,
168
168
  };
169
- export type StatefulPanelContainerPropsT = SharedStatefulPanelContainerPropsT & {
170
- children: (props: $Diff<PanelPropsT, {children: React.Node}>) => React.Node,
171
- };
169
+ export type StatefulPanelContainerPropsT =
170
+ SharedStatefulPanelContainerPropsT & {
171
+ children: (props: $Diff<PanelPropsT, {children: React.Node}>) => React.Node,
172
+ };
172
173
 
173
174
  // Props for stateful panel
174
175
  export type StatefulPanelPropsT = SharedStatefulPanelContainerPropsT &
@@ -129,8 +129,8 @@ export default function AppNavBar(props: AppNavBarPropsT) {
129
129
  const {
130
130
  title,
131
131
  mapItemToNode = defaultMapItemToNode,
132
- onMainItemSelect = item => {},
133
- onUserItemSelect = item => {},
132
+ onMainItemSelect = (item) => {},
133
+ onUserItemSelect = (item) => {},
134
134
  overrides = {},
135
135
  userItems = [],
136
136
  username,
@@ -69,7 +69,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
69
69
 
70
70
  var USER_TITLE_ITEM = 'USER_TITLE_ITEM';
71
71
  var USER_MENU_ITEM = 'USER_MENU_ITEM';
72
- var PARENT_MENU_ITEM = 'PARENT_MENU_ITEM';
72
+ var PARENT_MENU_ITEM = 'PARENT_MENU_ITEM'; // eslint-disable-next-line react/display-name
73
+
73
74
  var MobileNavMenuItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
74
75
  var item = props.item,
75
76
  _props$mapItemToNode = props.mapItemToNode,
@@ -200,6 +201,7 @@ function MobileMenu(props) {
200
201
  boxShadow: 'none'
201
202
  }
202
203
  },
204
+ // eslint-disable-next-line react/display-name
203
205
  ListItem: /*#__PURE__*/React.forwardRef(function (listItemProps, ref) {
204
206
  return /*#__PURE__*/React.createElement(MobileNavMenuItem, _extends({
205
207
  ref: ref
@@ -28,6 +28,7 @@ const USER_TITLE_ITEM = 'USER_TITLE_ITEM';
28
28
  const USER_MENU_ITEM = 'USER_MENU_ITEM';
29
29
  const PARENT_MENU_ITEM = 'PARENT_MENU_ITEM';
30
30
 
31
+ // eslint-disable-next-line react/display-name
31
32
  const MobileNavMenuItem = React.forwardRef((props, ref) => {
32
33
  const {
33
34
  item,
@@ -94,7 +95,7 @@ export default function MobileMenu(props: AppNavBarPropsT) {
94
95
  item: {...rest},
95
96
  label: props.username,
96
97
  [USER_TITLE_ITEM]: true,
97
- children: userItems.map(item => {
98
+ children: userItems.map((item) => {
98
99
  return {
99
100
  ...item,
100
101
  [USER_MENU_ITEM]: true,
@@ -164,6 +165,7 @@ export default function MobileMenu(props: AppNavBarPropsT) {
164
165
  boxShadow: 'none',
165
166
  },
166
167
  },
168
+ // eslint-disable-next-line react/display-name
167
169
  ListItem: React.forwardRef((listItemProps, ref) => {
168
170
  return (
169
171
  <MobileNavMenuItem
@@ -40,7 +40,7 @@ const StyledButton = styled<{$isFocusVisible: boolean}>(
40
40
  }),
41
41
  );
42
42
 
43
- export const StyledRoot = styled<{}>('div', props => {
43
+ export const StyledRoot = styled<{}>('div', (props) => {
44
44
  const {$theme} = props;
45
45
  return {
46
46
  ...$theme.typography.font300,
@@ -58,7 +58,7 @@ export const StyledSubnavContainer = styled<{}>('div', ({$theme}) => {
58
58
  };
59
59
  });
60
60
 
61
- export const StyledSpacing = styled<{}>('div', props => {
61
+ export const StyledSpacing = styled<{}>('div', (props) => {
62
62
  const {$theme} = props;
63
63
  return {
64
64
  boxSizing: 'border-box',
@@ -112,7 +112,7 @@ export const StyledMainMenuItem = styled<{
112
112
  $active?: boolean,
113
113
  $isFocusVisible: boolean,
114
114
  $kind: $Values<typeof KIND>,
115
- }>('div', props => {
115
+ }>('div', (props) => {
116
116
  const {
117
117
  $active,
118
118
  $isFocusVisible,
@@ -54,15 +54,15 @@ export type UserMenuPropsT = {|
54
54
  username?: string,
55
55
  usernameSubtitle?: React.Node,
56
56
  userImgUrl?: string,
57
- onUserItemSelect?: NavItemT => mixed,
57
+ onUserItemSelect?: (NavItemT) => mixed,
58
58
  |};
59
59
 
60
60
  export type AppNavBarPropsT = {|
61
61
  ...UserMenuPropsT,
62
- isMainItemActive?: NavItemT => boolean,
62
+ isMainItemActive?: (NavItemT) => boolean,
63
63
  mainItems?: NavItemT[],
64
- mapItemToNode?: NavItemT => React.Node,
65
- onMainItemSelect?: NavItemT => mixed,
64
+ mapItemToNode?: (NavItemT) => React.Node,
65
+ onMainItemSelect?: (NavItemT) => mixed,
66
66
  overrides?: OverridesT,
67
67
  title?: React.Node,
68
68
  |};
@@ -55,7 +55,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
55
55
 
56
56
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
57
57
 
58
- var MENU_ITEM_WIDTH = '275px';
58
+ var MENU_ITEM_WIDTH = '275px'; // eslint-disable-next-line react/display-name
59
+
59
60
  var UserMenuListItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
60
61
  var item = props.item,
61
62
  _props$mapItemToNode = props.mapItemToNode,
@@ -115,6 +116,7 @@ function UserMenuComponent(props) {
115
116
 
116
117
  userMenuProps.overrides = (0, _overrides.mergeOverrides)({
117
118
  List: {
119
+ // eslint-disable-next-line react/display-name
118
120
  component: /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
119
121
  var children = _ref2.children,
120
122
  restProps = _objectWithoutProperties(_ref2, ["children"]);
@@ -132,6 +134,7 @@ function UserMenuComponent(props) {
132
134
  width: MENU_ITEM_WIDTH
133
135
  }
134
136
  },
137
+ // eslint-disable-next-line react/display-name
135
138
  ListItem: /*#__PURE__*/React.forwardRef(function (listItemProps, ref) {
136
139
  return /*#__PURE__*/React.createElement(UserMenuListItem, _extends({
137
140
  ref: ref
@@ -27,6 +27,7 @@ import {defaultMapItemToNode} from './utils.js';
27
27
 
28
28
  const MENU_ITEM_WIDTH = '275px';
29
29
 
30
+ // eslint-disable-next-line react/display-name
30
31
  const UserMenuListItem = React.forwardRef((props, ref) => {
31
32
  const {item, mapItemToNode = defaultMapItemToNode} = props;
32
33
  // Replace with a user menu item renderer
@@ -46,8 +47,8 @@ const svgStyleOverride = ({$theme}) => ({paddingLeft: $theme.sizing.scale200});
46
47
 
47
48
  export default function UserMenuComponent(props: {|
48
49
  ...UserMenuPropsT,
49
- mapItemToNode: NavItemT => React.Node,
50
- onItemSelect: NavItemT => mixed,
50
+ mapItemToNode: (NavItemT) => React.Node,
51
+ onItemSelect: (NavItemT) => mixed,
51
52
  overrides: OverridesT,
52
53
  |}) {
53
54
  // isOpen is used for displaying different arrow icons in open or closed state
@@ -78,6 +79,7 @@ export default function UserMenuComponent(props: {|
78
79
  userMenuProps.overrides = mergeOverrides(
79
80
  {
80
81
  List: {
82
+ // eslint-disable-next-line react/display-name
81
83
  component: React.forwardRef(({children, ...restProps}, ref) => (
82
84
  <StyledList {...restProps} ref={ref}>
83
85
  <UserMenuProfileListItem {...userMenuProfileListItemProps}>
@@ -94,6 +96,7 @@ export default function UserMenuComponent(props: {|
94
96
  )),
95
97
  style: {width: MENU_ITEM_WIDTH},
96
98
  },
99
+ // eslint-disable-next-line react/display-name
97
100
  ListItem: React.forwardRef((listItemProps, ref) => {
98
101
  return (
99
102
  <UserMenuListItem
@@ -24,29 +24,23 @@ export default function UserProfileTile(props: {|
24
24
  |}) {
25
25
  const {overrides = {}, username, usernameSubtitle, userImgUrl} = props;
26
26
 
27
- const [
28
- UserProfileTileContainer,
29
- userProfileTileContainerProps,
30
- ] = getOverrides(
31
- overrides.UserProfileTileContainer,
32
- StyledUserProfileTileContainer,
33
- );
27
+ const [UserProfileTileContainer, userProfileTileContainerProps] =
28
+ getOverrides(
29
+ overrides.UserProfileTileContainer,
30
+ StyledUserProfileTileContainer,
31
+ );
34
32
 
35
- const [
36
- UserProfilePictureContainer,
37
- userProfilePictureContainerProps,
38
- ] = getOverrides(
39
- overrides.UserProfilePictureContainer,
40
- StyledUserProfilePictureContainer,
41
- );
33
+ const [UserProfilePictureContainer, userProfilePictureContainerProps] =
34
+ getOverrides(
35
+ overrides.UserProfilePictureContainer,
36
+ StyledUserProfilePictureContainer,
37
+ );
42
38
 
43
- const [
44
- UserProfileInfoContainer,
45
- userProfileInfoContainerProps,
46
- ] = getOverrides(
47
- overrides.UserProfileInfoContainer,
48
- StyledUserProfileInfoContainer,
49
- );
39
+ const [UserProfileInfoContainer, userProfileInfoContainerProps] =
40
+ getOverrides(
41
+ overrides.UserProfileInfoContainer,
42
+ StyledUserProfileInfoContainer,
43
+ );
50
44
 
51
45
  return (
52
46
  // Replace with a profile tile renderer: renderUserProfileTile()
@@ -9,7 +9,7 @@ LICENSE file in the root directory of this source tree.
9
9
 
10
10
  import type {NavItemT} from './types.js';
11
11
 
12
- type GetUniqueIdentifierT = NavItemT => string | number;
12
+ type GetUniqueIdentifierT = (NavItemT) => string | number;
13
13
 
14
14
  export function defaultMapItemToNode(item: NavItemT) {
15
15
  if (__DEV__) {
@@ -35,9 +35,9 @@ function defaultGetUniqueIdentifier(item: NavItemT) {
35
35
 
36
36
  export function mapItemsActive(
37
37
  items: NavItemT[],
38
- predicate: NavItemT => boolean,
38
+ predicate: (NavItemT) => boolean,
39
39
  ) {
40
- return items.map<NavItemT>(current => {
40
+ return items.map<NavItemT>((current) => {
41
41
  if (predicate(current)) {
42
42
  current.active = true;
43
43
  } else {
@@ -46,7 +46,7 @@ export function mapItemsActive(
46
46
 
47
47
  if (current.children) {
48
48
  current.children = mapItemsActive(current.children, predicate);
49
- if (current.children.some(child => child.active)) {
49
+ if (current.children.some((child) => child.active)) {
50
50
  current.active = true;
51
51
  }
52
52
  }
@@ -62,7 +62,7 @@ export function setItemActive(
62
62
  ) {
63
63
  return mapItemsActive(
64
64
  items,
65
- current => getUniqueIdentifier(current) === getUniqueIdentifier(item),
65
+ (current) => getUniqueIdentifier(current) === getUniqueIdentifier(item),
66
66
  );
67
67
  }
68
68
 
@@ -19,11 +19,8 @@ import type {PropsT} from './types.js';
19
19
 
20
20
  function getInitials(name) {
21
21
  const words = name.split(' ');
22
- const initials = words.map(word => word[0]);
23
- return initials
24
- .slice(0, 2)
25
- .join('')
26
- .toUpperCase();
22
+ const initials = words.map((word) => word[0]);
23
+ return initials.slice(0, 2).join('').toUpperCase();
27
24
  }
28
25
 
29
26
  export default function Avatar({
@@ -21,7 +21,7 @@ function getSize(props) {
21
21
  return $theme.sizing[size] || size;
22
22
  }
23
23
 
24
- export const Avatar = styled<AvatarStylePropsT>('img', props => {
24
+ export const Avatar = styled<AvatarStylePropsT>('img', (props) => {
25
25
  const themedSize = getSize(props);
26
26
 
27
27
  return {
@@ -37,7 +37,7 @@ export const Avatar = styled<AvatarStylePropsT>('img', props => {
37
37
  };
38
38
  });
39
39
 
40
- export const Initials = styled<InitialsStylePropsT>('div', props => ({
40
+ export const Initials = styled<InitialsStylePropsT>('div', (props) => ({
41
41
  ...props.$theme.typography.font300,
42
42
  color: props.$theme.colors.mono100,
43
43
  alignItems: 'center',
@@ -46,7 +46,7 @@ export const Initials = styled<InitialsStylePropsT>('div', props => ({
46
46
  height: '100%',
47
47
  }));
48
48
 
49
- export const Root = styled<RootStylePropsT>('div', props => {
49
+ export const Root = styled<RootStylePropsT>('div', (props) => {
50
50
  const {$didImageFailToLoad} = props;
51
51
  const themedSize = getSize(props);
52
52
 
@@ -32,7 +32,7 @@ function build(breakpoints: BreakpointsT) {
32
32
  const mediaQueries = getMediaQueries(breakpoints);
33
33
 
34
34
  return {
35
- apply: ({property, transform = x => x, value}: ApplyParams) => {
35
+ apply: ({property, transform = (x) => x, value}: ApplyParams) => {
36
36
  if (value === null || value === undefined) {
37
37
  return;
38
38
  }
@@ -65,17 +65,17 @@ function getFontValue(obj, key) {
65
65
  return obj[key];
66
66
  }
67
67
 
68
- export const StyledBlock = styled<StyledBlockPropsT>('div', props => {
68
+ export const StyledBlock = styled<StyledBlockPropsT>('div', (props) => {
69
69
  const {breakpoints, colors, typography, sizing} = props.$theme;
70
70
 
71
71
  const get = (obj, key) => obj[key];
72
- const getScale = size => sizing[size] || size;
72
+ const getScale = (size) => sizing[size] || size;
73
73
 
74
74
  const styles = build(breakpoints);
75
75
  styles.apply({
76
76
  property: 'color',
77
77
  value: get(props, '$color'),
78
- transform: color => colors[color] || color,
78
+ transform: (color) => colors[color] || color,
79
79
  });
80
80
  styles.apply({
81
81
  property: 'backgroundAttachment',
@@ -88,7 +88,7 @@ export const StyledBlock = styled<StyledBlockPropsT>('div', props => {
88
88
  styles.apply({
89
89
  property: 'backgroundColor',
90
90
  value: get(props, '$backgroundColor'),
91
- transform: backgroundColor => colors[backgroundColor] || backgroundColor,
91
+ transform: (backgroundColor) => colors[backgroundColor] || backgroundColor,
92
92
  });
93
93
  styles.apply({
94
94
  property: 'backgroundImage',
@@ -113,22 +113,22 @@ export const StyledBlock = styled<StyledBlockPropsT>('div', props => {
113
113
  styles.apply({
114
114
  property: 'fontFamily',
115
115
  value: get(props, '$font'),
116
- transform: font => getFontValue(typography[font], 'fontFamily'),
116
+ transform: (font) => getFontValue(typography[font], 'fontFamily'),
117
117
  });
118
118
  styles.apply({
119
119
  property: 'fontWeight',
120
120
  value: get(props, '$font'),
121
- transform: font => getFontValue(typography[font], 'fontWeight'),
121
+ transform: (font) => getFontValue(typography[font], 'fontWeight'),
122
122
  });
123
123
  styles.apply({
124
124
  property: 'fontSize',
125
125
  value: get(props, '$font'),
126
- transform: font => getFontValue(typography[font], 'fontSize'),
126
+ transform: (font) => getFontValue(typography[font], 'fontSize'),
127
127
  });
128
128
  styles.apply({
129
129
  property: 'lineHeight',
130
130
  value: get(props, '$font'),
131
- transform: font => getFontValue(typography[font], 'lineHeight'),
131
+ transform: (font) => getFontValue(typography[font], 'lineHeight'),
132
132
  });
133
133
 
134
134
  styles.apply({
@@ -240,7 +240,7 @@ export const StyledBlock = styled<StyledBlockPropsT>('div', props => {
240
240
  styles.apply({
241
241
  property: 'overflowX',
242
242
  value: get(props, '$overflow'),
243
- transform: overflow => {
243
+ transform: (overflow) => {
244
244
  if (overflow === 'scrollX') {
245
245
  return 'scroll';
246
246
  }
@@ -250,7 +250,7 @@ export const StyledBlock = styled<StyledBlockPropsT>('div', props => {
250
250
  styles.apply({
251
251
  property: 'overflowY',
252
252
  value: get(props, '$overflow'),
253
- transform: overflow => {
253
+ transform: (overflow) => {
254
254
  if (overflow === 'scrollY') {
255
255
  return 'scroll';
256
256
  }
@@ -260,7 +260,7 @@ export const StyledBlock = styled<StyledBlockPropsT>('div', props => {
260
260
  styles.apply({
261
261
  property: 'overflow',
262
262
  value: get(props, '$overflow'),
263
- transform: overflow => {
263
+ transform: (overflow) => {
264
264
  if (overflow !== 'scrollX' && overflow !== 'scrollY') {
265
265
  return overflow;
266
266
  }
@@ -59,7 +59,7 @@ export function Breadcrumbs(props: BreadcrumbsPropsT) {
59
59
  {(showTrailingSeparator || index !== childrenArray.length - 1) && (
60
60
  <Separator {...baseSeparatorProps} key={`separator-${index}`}>
61
61
  <ThemeContext.Consumer>
62
- {theme =>
62
+ {(theme) =>
63
63
  theme.direction === 'rtl' ? (
64
64
  <Left {...baseIconProps} />
65
65
  ) : (
@@ -75,7 +75,7 @@ export function Breadcrumbs(props: BreadcrumbsPropsT) {
75
75
 
76
76
  return (
77
77
  <LocaleContext.Consumer>
78
- {locale => (
78
+ {(locale) => (
79
79
  <Root
80
80
  aria-label={
81
81
  props['aria-label'] ||
@@ -75,13 +75,11 @@ class Button extends React.Component<
75
75
  overrides.LoadingSpinner,
76
76
  StyledLoadingSpinner,
77
77
  );
78
- const [
79
- LoadingSpinnerContainer,
80
- loadingSpinnerContainerProps,
81
- ] = getOverrides(
82
- overrides.LoadingSpinnerContainer,
83
- StyledLoadingSpinnerContainer,
84
- );
78
+ const [LoadingSpinnerContainer, loadingSpinnerContainerProps] =
79
+ getOverrides(
80
+ overrides.LoadingSpinnerContainer,
81
+ StyledLoadingSpinnerContainer,
82
+ );
85
83
  const sharedProps = {
86
84
  ...getSharedProps(this.props),
87
85
  $isFocusVisible: this.state.isFocusVisible,
package/button/index.d.ts CHANGED
@@ -37,8 +37,14 @@ export interface ButtonOverrides {
37
37
  LoadingSpinner?: Override<any>;
38
38
  }
39
39
 
40
+ export interface CustomColorsT {
41
+ backgroundColor: string;
42
+ color: string;
43
+ }
44
+
40
45
  export interface ButtonProps
41
46
  extends StyletronComponentInjectedProps<ButtonProps> {
47
+ colors?: CustomColorsT;
42
48
  href?: string;
43
49
  target?: string;
44
50
  children?: React.ReactNode;
@@ -18,6 +18,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
18
18
  var BaseButton = (0, _index.styled)('button', function (_ref) {
19
19
  var $theme = _ref.$theme,
20
20
  $size = _ref.$size,
21
+ $colors = _ref.$colors,
21
22
  $kind = _ref.$kind,
22
23
  $shape = _ref.$shape,
23
24
  $isLoading = _ref.$isLoading,
@@ -69,8 +70,9 @@ var BaseButton = (0, _index.styled)('button', function (_ref) {
69
70
  $theme: $theme,
70
71
  $size: $size,
71
72
  $shape: $shape
72
- })), getKindStyles({
73
+ })), getColorStyles({
73
74
  $theme: $theme,
75
+ $colors: $colors,
74
76
  $kind: $kind,
75
77
  $isLoading: $isLoading,
76
78
  $isSelected: $isSelected,
@@ -345,13 +347,27 @@ function getPaddingStyles(_ref12) {
345
347
  }
346
348
  }
347
349
 
348
- function getKindStyles(_ref13) {
350
+ function getColorStyles(_ref13) {
349
351
  var $theme = _ref13.$theme,
352
+ $colors = _ref13.$colors,
350
353
  $isLoading = _ref13.$isLoading,
351
354
  $isSelected = _ref13.$isSelected,
352
355
  $kind = _ref13.$kind,
353
356
  $disabled = _ref13.$disabled;
354
357
 
358
+ if ($colors) {
359
+ return {
360
+ color: $colors.color,
361
+ backgroundColor: $colors.backgroundColor,
362
+ ':hover': {
363
+ boxShadow: 'inset 999px 999px 0px rgba(0, 0, 0, 0.04)'
364
+ },
365
+ ':active': {
366
+ boxShadow: 'inset 999px 999px 0px rgba(0, 0, 0, 0.08)'
367
+ }
368
+ };
369
+ }
370
+
355
371
  if ($disabled) {
356
372
  return Object.freeze({});
357
373
  }