baseui 0.0.0-alpha-c069f75 → 0.0.0-alpha-55228a8

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 (119) hide show
  1. package/button/styled-components.js +1 -1
  2. package/button/styled-components.js.flow +4 -1
  3. package/data-table/data-table.js +13 -3
  4. package/data-table/data-table.js.flow +20 -4
  5. package/data-table/types.js.flow +2 -1
  6. package/datepicker/day.js +1 -0
  7. package/datepicker/day.js.flow +1 -0
  8. package/datepicker/index.d.ts +1 -0
  9. package/datepicker/types.js.flow +1 -0
  10. package/drawer/close-icon.js +3 -2
  11. package/drawer/close-icon.js.flow +2 -2
  12. package/drawer/drawer.js +3 -1
  13. package/drawer/drawer.js.flow +1 -1
  14. package/es/button/styled-components.js +1 -1
  15. package/es/data-table/data-table.js +13 -3
  16. package/es/datepicker/day.js +1 -0
  17. package/es/drawer/close-icon.js +3 -2
  18. package/es/drawer/drawer.js +3 -1
  19. package/es/list/index.js +1 -0
  20. package/es/list/list-heading.js +88 -0
  21. package/es/list/menu-adapter.js +4 -2
  22. package/es/list/styled-components.js +99 -4
  23. package/es/map-marker/constants.js +69 -0
  24. package/es/map-marker/fixed-marker.js +98 -0
  25. package/es/map-marker/floating-marker.js +65 -0
  26. package/es/map-marker/index.js +9 -0
  27. package/es/map-marker/pin-head.js +108 -0
  28. package/es/map-marker/styled-components.js +156 -0
  29. package/es/map-marker/types.js +8 -0
  30. package/es/popover/stateful-container.js +4 -0
  31. package/es/select/select-component.js +16 -2
  32. package/es/select/styled-components.js +34 -4
  33. package/es/spinner/styled-components.js +1 -1
  34. package/es/table-semantic/styled-components.js +6 -4
  35. package/es/table-semantic/table-builder.js +3 -0
  36. package/es/themes/dark-theme/color-semantic-tokens.js +18 -8
  37. package/es/themes/light-theme/color-semantic-tokens.js +14 -4
  38. package/es/tokens/colors.js +3 -3
  39. package/es/tooltip/styled-components.js +8 -0
  40. package/esm/button/styled-components.js +1 -1
  41. package/esm/data-table/data-table.js +13 -3
  42. package/esm/datepicker/day.js +1 -0
  43. package/esm/drawer/close-icon.js +3 -2
  44. package/esm/drawer/drawer.js +3 -1
  45. package/esm/list/index.js +1 -0
  46. package/esm/list/list-heading.js +127 -0
  47. package/esm/list/menu-adapter.js +4 -2
  48. package/esm/list/styled-components.js +98 -4
  49. package/esm/map-marker/constants.js +62 -0
  50. package/esm/map-marker/fixed-marker.js +137 -0
  51. package/esm/map-marker/floating-marker.js +94 -0
  52. package/esm/map-marker/index.js +9 -0
  53. package/esm/map-marker/pin-head.js +144 -0
  54. package/esm/map-marker/styled-components.js +168 -0
  55. package/esm/map-marker/types.js +8 -0
  56. package/esm/popover/stateful-container.js +4 -0
  57. package/esm/select/select-component.js +15 -2
  58. package/esm/select/styled-components.js +28 -4
  59. package/esm/spinner/styled-components.js +1 -1
  60. package/esm/table-semantic/styled-components.js +6 -4
  61. package/esm/table-semantic/table-builder.js +3 -0
  62. package/esm/themes/dark-theme/color-semantic-tokens.js +18 -8
  63. package/esm/themes/light-theme/color-semantic-tokens.js +14 -4
  64. package/esm/tokens/colors.js +3 -3
  65. package/esm/tooltip/styled-components.js +8 -0
  66. package/index.d.ts +1 -0
  67. package/list/index.d.ts +36 -0
  68. package/list/index.js +9 -0
  69. package/list/index.js.flow +1 -0
  70. package/list/list-heading.js +141 -0
  71. package/list/list-heading.js.flow +147 -0
  72. package/list/menu-adapter.js +5 -2
  73. package/list/menu-adapter.js.flow +21 -11
  74. package/list/styled-components.js +106 -5
  75. package/list/styled-components.js.flow +102 -3
  76. package/list/types.js.flow +22 -0
  77. package/map-marker/constants.js +82 -0
  78. package/map-marker/constants.js.flow +74 -0
  79. package/map-marker/fixed-marker.js +152 -0
  80. package/map-marker/fixed-marker.js.flow +137 -0
  81. package/map-marker/floating-marker.js +109 -0
  82. package/map-marker/floating-marker.js.flow +102 -0
  83. package/map-marker/index.d.ts +104 -0
  84. package/map-marker/index.js +55 -0
  85. package/map-marker/index.js.flow +23 -0
  86. package/map-marker/package.json +4 -0
  87. package/map-marker/pin-head.js +159 -0
  88. package/map-marker/pin-head.js.flow +155 -0
  89. package/map-marker/styled-components.js +184 -0
  90. package/map-marker/styled-components.js.flow +177 -0
  91. package/map-marker/types.js +11 -0
  92. package/map-marker/types.js.flow +114 -0
  93. package/menu/index.d.ts +7 -0
  94. package/menu/types.js.flow +12 -0
  95. package/package.json +2 -1
  96. package/popover/stateful-container.js +4 -0
  97. package/popover/stateful-container.js.flow +6 -0
  98. package/select/select-component.js +15 -2
  99. package/select/select-component.js.flow +15 -2
  100. package/select/styled-components.js +28 -4
  101. package/select/styled-components.js.flow +30 -2
  102. package/select/types.js.flow +9 -0
  103. package/spinner/styled-components.js +1 -1
  104. package/spinner/styled-components.js.flow +1 -1
  105. package/table-semantic/index.d.ts +1 -0
  106. package/table-semantic/styled-components.js +6 -4
  107. package/table-semantic/styled-components.js.flow +6 -4
  108. package/table-semantic/table-builder.js +3 -0
  109. package/table-semantic/table-builder.js.flow +3 -0
  110. package/theme.ts +12 -0
  111. package/themes/dark-theme/color-semantic-tokens.js +18 -8
  112. package/themes/dark-theme/color-semantic-tokens.js.flow +18 -7
  113. package/themes/light-theme/color-semantic-tokens.js +14 -4
  114. package/themes/light-theme/color-semantic-tokens.js.flow +14 -3
  115. package/themes/types.js.flow +11 -0
  116. package/tokens/colors.js +3 -3
  117. package/tokens/colors.js.flow +3 -3
  118. package/tooltip/styled-components.js +8 -0
  119. package/tooltip/styled-components.js.flow +8 -0
@@ -48,7 +48,7 @@ var BaseButton = (0, _index.styled)('button', function (_ref) {
48
48
  cursor: 'pointer',
49
49
  ':disabled': {
50
50
  cursor: 'not-allowed',
51
- backgroundColor: $theme.colors.buttonDisabledFill,
51
+ backgroundColor: $kind === _constants.KIND.minimal || $kind === _constants.KIND.tertiary ? 'transparent' : $theme.colors.buttonDisabledFill,
52
52
  color: $theme.colors.buttonDisabledText
53
53
  },
54
54
  marginLeft: 0,
@@ -46,7 +46,10 @@ export const BaseButton = styled<SharedStylePropsT>(
46
46
  cursor: 'pointer',
47
47
  ':disabled': {
48
48
  cursor: 'not-allowed',
49
- backgroundColor: $theme.colors.buttonDisabledFill,
49
+ backgroundColor:
50
+ $kind === KIND.minimal || $kind === KIND.tertiary
51
+ ? 'transparent'
52
+ : $theme.colors.buttonDisabledFill,
50
53
  color: $theme.colors.buttonDisabledText,
51
54
  },
52
55
  marginLeft: 0,
@@ -445,11 +445,12 @@ var InnerTableElement = /*#__PURE__*/React.forwardRef(function (props, ref) {
445
445
  viewState = EMPTY;
446
446
  }
447
447
 
448
+ var highlightedRow = ctx.rows[ctx.rowHighlightIndex - 1];
448
449
  return /*#__PURE__*/React.createElement("div", {
449
450
  ref: ref,
450
451
  "data-baseweb": "data-table",
451
452
  style: props.style
452
- }, /*#__PURE__*/React.createElement(Headers, null), viewState === LOADING && /*#__PURE__*/React.createElement(LoadingOrEmptyMessage, null, ctx.loadingMessage), viewState === EMPTY && /*#__PURE__*/React.createElement(LoadingOrEmptyMessage, null, ctx.emptyMessage), viewState === RENDERING && props.children, ctx.rowActions && Boolean(ctx.rowActions.length) && ctx.rowHighlightIndex > 0 && Boolean(ctx.rows[ctx.rowHighlightIndex - 1]) && !ctx.isScrollingX && /*#__PURE__*/React.createElement("div", {
453
+ }, /*#__PURE__*/React.createElement(Headers, null), viewState === LOADING && /*#__PURE__*/React.createElement(LoadingOrEmptyMessage, null, ctx.loadingMessage), viewState === EMPTY && /*#__PURE__*/React.createElement(LoadingOrEmptyMessage, null, ctx.emptyMessage), viewState === RENDERING && props.children, ctx.rowActions && Boolean(ctx.rowActions.length) && ctx.rowHighlightIndex > 0 && Boolean(highlightedRow) && !ctx.isScrollingX && /*#__PURE__*/React.createElement("div", {
453
454
  style: {
454
455
  alignItems: 'center',
455
456
  backgroundColor: theme.colors.backgroundTertiary,
@@ -463,7 +464,12 @@ var InnerTableElement = /*#__PURE__*/React.forwardRef(function (props, ref) {
463
464
  left: theme.direction === 'rtl' ? 0 : 'initial',
464
465
  top: (ctx.rowHighlightIndex - 1) * ctx.rowHeight + HEADER_ROW_HEIGHT
465
466
  }
466
- }, ctx.rowActions.map(function (rowAction) {
467
+ }, (typeof ctx.rowActions === 'function' ? ctx.rowActions(highlightedRow) : ctx.rowActions).map(function (rowAction) {
468
+ if (rowAction.renderButton) {
469
+ var RowActionButton = rowAction.renderButton;
470
+ return /*#__PURE__*/React.createElement(RowActionButton, null);
471
+ }
472
+
467
473
  var RowActionIcon = rowAction.renderIcon;
468
474
  return /*#__PURE__*/React.createElement(_index.Button, {
469
475
  alt: rowAction.label,
@@ -480,7 +486,11 @@ var InnerTableElement = /*#__PURE__*/React.forwardRef(function (props, ref) {
480
486
  overrides: {
481
487
  BaseButton: {
482
488
  style: {
483
- marginLeft: theme.sizing.scale300
489
+ marginLeft: theme.sizing.scale300,
490
+ paddingTop: theme.sizing.scale100,
491
+ paddingRight: theme.sizing.scale100,
492
+ paddingBottom: theme.sizing.scale100,
493
+ paddingLeft: theme.sizing.scale100
484
494
  }
485
495
  }
486
496
  }
@@ -53,7 +53,7 @@ type HeaderContextT = {|
53
53
  onSelectNone: () => void,
54
54
  onSort: number => void,
55
55
  resizableColumnWidths: boolean,
56
- rowActions: RowActionT[],
56
+ rowActions: RowActionT[] | (RowT => RowActionT[]),
57
57
  rowHeight: number,
58
58
  rowHighlightIndex: number,
59
59
  rows: RowT[],
@@ -554,6 +554,8 @@ const InnerTableElement = React.forwardRef<
554
554
  viewState = EMPTY;
555
555
  }
556
556
 
557
+ const highlightedRow = ctx.rows[ctx.rowHighlightIndex - 1];
558
+
557
559
  return (
558
560
  <div ref={ref} data-baseweb="data-table" style={props.style}>
559
561
  <Headers />
@@ -571,7 +573,7 @@ const InnerTableElement = React.forwardRef<
571
573
  {ctx.rowActions &&
572
574
  Boolean(ctx.rowActions.length) &&
573
575
  ctx.rowHighlightIndex > 0 &&
574
- Boolean(ctx.rows[ctx.rowHighlightIndex - 1]) &&
576
+ Boolean(highlightedRow) &&
575
577
  !ctx.isScrollingX && (
576
578
  <div
577
579
  style={{
@@ -589,7 +591,15 @@ const InnerTableElement = React.forwardRef<
589
591
  (ctx.rowHighlightIndex - 1) * ctx.rowHeight + HEADER_ROW_HEIGHT,
590
592
  }}
591
593
  >
592
- {ctx.rowActions.map(rowAction => {
594
+ {(typeof ctx.rowActions === 'function'
595
+ ? ctx.rowActions(highlightedRow)
596
+ : ctx.rowActions
597
+ ).map(rowAction => {
598
+ if (rowAction.renderButton) {
599
+ const RowActionButton = rowAction.renderButton;
600
+ return <RowActionButton />;
601
+ }
602
+
593
603
  const RowActionIcon = rowAction.renderIcon;
594
604
  return (
595
605
  <Button
@@ -606,7 +616,13 @@ const InnerTableElement = React.forwardRef<
606
616
  shape={BUTTON_SHAPES.round}
607
617
  overrides={{
608
618
  BaseButton: {
609
- style: {marginLeft: theme.sizing.scale300},
619
+ style: {
620
+ marginLeft: theme.sizing.scale300,
621
+ paddingTop: theme.sizing.scale100,
622
+ paddingRight: theme.sizing.scale100,
623
+ paddingBottom: theme.sizing.scale100,
624
+ paddingLeft: theme.sizing.scale100,
625
+ },
610
626
  },
611
627
  }}
612
628
  >
@@ -87,6 +87,7 @@ export type RowActionT = {|
87
87
  label: string,
88
88
  onClick: ({event: SyntheticEvent<HTMLButtonElement>, row: RowT}) => mixed,
89
89
  renderIcon: React.AbstractComponent<{|size: number|}>,
90
+ renderButton?: React.AbstractComponent<{||}>,
90
91
  |};
91
92
 
92
93
  export type StatefulDataTablePropsT = {|
@@ -107,7 +108,7 @@ export type StatefulDataTablePropsT = {|
107
108
  onSelectionChange?: (RowT[]) => mixed,
108
109
  resizableColumnWidths?: boolean,
109
110
  rows: RowT[],
110
- rowActions?: RowActionT[],
111
+ rowActions?: RowActionT[] | (RowT => RowActionT[]),
111
112
  rowHeight?: number,
112
113
  rowHighlightIndex?: number,
113
114
  searchable?: boolean,
package/datepicker/day.js CHANGED
@@ -357,6 +357,7 @@ var Day = /*#__PURE__*/function (_React$Component) {
357
357
  $isFocusVisible: this.state.isFocusVisible,
358
358
  $startOfMonth: this.dateHelpers.isStartOfMonth(date),
359
359
  $endOfMonth: this.dateHelpers.isEndOfMonth(date),
360
+ $month: this.getMonthProp(),
360
361
  $outsideMonth: $outsideMonth,
361
362
  $outsideMonthWithinRange: $outsideMonthWithinRange,
362
363
  $peekNextMonth: this.props.peekNextMonth,
@@ -313,6 +313,7 @@ export default class Day<T = Date> extends React.Component<
313
313
  $isFocusVisible: this.state.isFocusVisible,
314
314
  $startOfMonth: this.dateHelpers.isStartOfMonth(date),
315
315
  $endOfMonth: this.dateHelpers.isEndOfMonth(date),
316
+ $month: this.getMonthProp(),
316
317
  $outsideMonth,
317
318
  $outsideMonthWithinRange,
318
319
  $peekNextMonth: this.props.peekNextMonth,
@@ -242,6 +242,7 @@ export type SharedStylePropsT = {
242
242
  $isHeader: boolean;
243
243
  $isHighlighted: boolean;
244
244
  $isHovered: boolean;
245
+ $month: number;
245
246
  $outsideMonth: boolean;
246
247
  $pseudoHighlighted: boolean;
247
248
  $pseudoSelected: boolean;
@@ -231,6 +231,7 @@ export type SharedStylePropsT = {
231
231
  $isHighlighted: ?boolean,
232
232
  $isHovered: ?boolean,
233
233
  $isFocusVisible: ?boolean,
234
+ $month: ?number,
234
235
  $outsideMonth: ?boolean,
235
236
  $outsideMonthWithinRange: ?boolean,
236
237
  $peekNextMonth: ?boolean,
@@ -23,9 +23,10 @@ Copyright (c) Uber Technologies, Inc.
23
23
  This source code is licensed under the MIT license found in the
24
24
  LICENSE file in the root directory of this source tree.
25
25
  */
26
- function CloseIcon() {
26
+ function CloseIcon(props) {
27
27
  return /*#__PURE__*/React.createElement(_delete.default, {
28
28
  size: "inherit",
29
- color: "inherit"
29
+ color: "inherit",
30
+ title: props.title
30
31
  });
31
32
  }
@@ -8,8 +8,8 @@ LICENSE file in the root directory of this source tree.
8
8
  import * as React from 'react';
9
9
  import Delete from '../icon/delete.js';
10
10
 
11
- export function CloseIcon() {
12
- return <Delete size="inherit" color="inherit" />;
11
+ export function CloseIcon(props: {title: string}) {
12
+ return <Delete size="inherit" color="inherit" title={props.title} />;
13
13
  }
14
14
 
15
15
  declare var __DEV__: boolean;
package/drawer/drawer.js CHANGED
@@ -354,7 +354,9 @@ var Drawer = /*#__PURE__*/function (_React$Component) {
354
354
  }, sharedProps, closeProps, {
355
355
  onFocus: (0, _focusVisible.forkFocus)(closeProps, _this3.handleFocus),
356
356
  onBlur: (0, _focusVisible.forkBlur)(closeProps, _this3.handleBlur)
357
- }), /*#__PURE__*/React.createElement(_closeIcon.CloseIcon, null)) : null)));
357
+ }), /*#__PURE__*/React.createElement(_closeIcon.CloseIcon, {
358
+ title: locale.drawer.close
359
+ })) : null)));
358
360
  });
359
361
  }
360
362
  }, {
@@ -278,7 +278,7 @@ class Drawer extends React.Component<DrawerPropsT, DrawerStateT> {
278
278
  onFocus={forkFocus(closeProps, this.handleFocus)}
279
279
  onBlur={forkBlur(closeProps, this.handleBlur)}
280
280
  >
281
- <CloseIcon />
281
+ <CloseIcon title={locale.drawer.close} />
282
282
  </Close>
283
283
  ) : null}
284
284
  </DrawerContainer>
@@ -39,7 +39,7 @@ export const BaseButton = styled('button', ({
39
39
  cursor: 'pointer',
40
40
  ':disabled': {
41
41
  cursor: 'not-allowed',
42
- backgroundColor: $theme.colors.buttonDisabledFill,
42
+ backgroundColor: $kind === KIND.minimal || $kind === KIND.tertiary ? 'transparent' : $theme.colors.buttonDisabledFill,
43
43
  color: $theme.colors.buttonDisabledText
44
44
  },
45
45
  marginLeft: 0,
@@ -360,11 +360,12 @@ const InnerTableElement = /*#__PURE__*/React.forwardRef((props, ref) => {
360
360
  viewState = EMPTY;
361
361
  }
362
362
 
363
+ const highlightedRow = ctx.rows[ctx.rowHighlightIndex - 1];
363
364
  return /*#__PURE__*/React.createElement("div", {
364
365
  ref: ref,
365
366
  "data-baseweb": "data-table",
366
367
  style: props.style
367
- }, /*#__PURE__*/React.createElement(Headers, null), viewState === LOADING && /*#__PURE__*/React.createElement(LoadingOrEmptyMessage, null, ctx.loadingMessage), viewState === EMPTY && /*#__PURE__*/React.createElement(LoadingOrEmptyMessage, null, ctx.emptyMessage), viewState === RENDERING && props.children, ctx.rowActions && Boolean(ctx.rowActions.length) && ctx.rowHighlightIndex > 0 && Boolean(ctx.rows[ctx.rowHighlightIndex - 1]) && !ctx.isScrollingX && /*#__PURE__*/React.createElement("div", {
368
+ }, /*#__PURE__*/React.createElement(Headers, null), viewState === LOADING && /*#__PURE__*/React.createElement(LoadingOrEmptyMessage, null, ctx.loadingMessage), viewState === EMPTY && /*#__PURE__*/React.createElement(LoadingOrEmptyMessage, null, ctx.emptyMessage), viewState === RENDERING && props.children, ctx.rowActions && Boolean(ctx.rowActions.length) && ctx.rowHighlightIndex > 0 && Boolean(highlightedRow) && !ctx.isScrollingX && /*#__PURE__*/React.createElement("div", {
368
369
  style: {
369
370
  alignItems: 'center',
370
371
  backgroundColor: theme.colors.backgroundTertiary,
@@ -378,7 +379,12 @@ const InnerTableElement = /*#__PURE__*/React.forwardRef((props, ref) => {
378
379
  left: theme.direction === 'rtl' ? 0 : 'initial',
379
380
  top: (ctx.rowHighlightIndex - 1) * ctx.rowHeight + HEADER_ROW_HEIGHT
380
381
  }
381
- }, ctx.rowActions.map(rowAction => {
382
+ }, (typeof ctx.rowActions === 'function' ? ctx.rowActions(highlightedRow) : ctx.rowActions).map(rowAction => {
383
+ if (rowAction.renderButton) {
384
+ const RowActionButton = rowAction.renderButton;
385
+ return /*#__PURE__*/React.createElement(RowActionButton, null);
386
+ }
387
+
382
388
  const RowActionIcon = rowAction.renderIcon;
383
389
  return /*#__PURE__*/React.createElement(Button, {
384
390
  alt: rowAction.label,
@@ -393,7 +399,11 @@ const InnerTableElement = /*#__PURE__*/React.forwardRef((props, ref) => {
393
399
  overrides: {
394
400
  BaseButton: {
395
401
  style: {
396
- marginLeft: theme.sizing.scale300
402
+ marginLeft: theme.sizing.scale300,
403
+ paddingTop: theme.sizing.scale100,
404
+ paddingRight: theme.sizing.scale100,
405
+ paddingBottom: theme.sizing.scale100,
406
+ paddingLeft: theme.sizing.scale100
397
407
  }
398
408
  }
399
409
  }
@@ -292,6 +292,7 @@ export default class Day extends React.Component {
292
292
  $isFocusVisible: this.state.isFocusVisible,
293
293
  $startOfMonth: this.dateHelpers.isStartOfMonth(date),
294
294
  $endOfMonth: this.dateHelpers.isEndOfMonth(date),
295
+ $month: this.getMonthProp(),
295
296
  $outsideMonth,
296
297
  $outsideMonthWithinRange,
297
298
  $peekNextMonth: this.props.peekNextMonth,
@@ -6,9 +6,10 @@ LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import * as React from 'react';
8
8
  import Delete from '../icon/delete.js';
9
- export function CloseIcon() {
9
+ export function CloseIcon(props) {
10
10
  return /*#__PURE__*/React.createElement(Delete, {
11
11
  size: "inherit",
12
- color: "inherit"
12
+ color: "inherit",
13
+ title: props.title
13
14
  });
14
15
  }
@@ -264,7 +264,9 @@ class Drawer extends React.Component {
264
264
  }, sharedProps, closeProps, {
265
265
  onFocus: forkFocus(closeProps, this.handleFocus),
266
266
  onBlur: forkBlur(closeProps, this.handleBlur)
267
- }), /*#__PURE__*/React.createElement(CloseIcon, null)) : null)));
267
+ }), /*#__PURE__*/React.createElement(CloseIcon, {
268
+ title: locale.drawer.close
269
+ })) : null)));
268
270
  });
269
271
  }
270
272
 
package/es/list/index.js CHANGED
@@ -6,6 +6,7 @@ LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  export { default as ListItem } from './list-item.js';
8
8
  export { default as ListItemLabel } from './list-item-label.js';
9
+ export { default as ListHeading } from './list-heading.js';
9
10
  export { default as MenuAdapter } from './menu-adapter.js';
10
11
  export { ARTWORK_SIZES, SHAPE } from './constants.js';
11
12
  export * from './styled-components.js';
@@ -0,0 +1,88 @@
1
+ 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); }
2
+
3
+ /*
4
+ Copyright (c) Uber Technologies, Inc.
5
+
6
+ This source code is licensed under the MIT license found in the
7
+ LICENSE file in the root directory of this source tree.
8
+ */
9
+ import React from 'react';
10
+ import * as ReactIs from 'react-is';
11
+ import { getOverrides } from '../helpers/overrides.js';
12
+ import { StyledHeadingRoot, StyledHeadingContent, StyledHeadingContentRow, StyledHeadingEndEnhancerContainer, StyledHeadingEndEnhancerDescriptionContainer, StyledHeadingMainHeading, StyledHeadingSubHeading } from './styled-components.js';
13
+
14
+ function RenderNode(props) {
15
+ const {
16
+ component,
17
+ ...restProps
18
+ } = props;
19
+ const Component = component;
20
+
21
+ if (!Component) {
22
+ return null;
23
+ }
24
+
25
+ if (typeof Component === 'string') {
26
+ return Component;
27
+ }
28
+
29
+ if (ReactIs.isValidElementType(Component)) {
30
+ // $FlowFixMe
31
+ return /*#__PURE__*/React.createElement(Component, restProps);
32
+ } // $FlowFixMe
33
+
34
+
35
+ return Component;
36
+ }
37
+
38
+ function isMaxLinesValid(maxLines) {
39
+ return maxLines === 1 || maxLines === 2;
40
+ }
41
+
42
+ const ListHeading = /*#__PURE__*/React.forwardRef((props, ref) => {
43
+ const {
44
+ overrides = {},
45
+ maxLines
46
+ } = props;
47
+ const EndEnhancer = props.endEnhancer;
48
+ const EndEnhancerDescription = props.endEnhancerDescription;
49
+ const SubHeading = props.subHeading;
50
+ const [Root, rootProps] = getOverrides(overrides.Root, StyledHeadingRoot);
51
+ const [Content, contentProps] = getOverrides(overrides.Content, StyledHeadingContent);
52
+ const [HeadingContainer, headingContainerProps] = getOverrides(overrides.HeadingContainer, StyledHeadingMainHeading);
53
+ const [SubHeadingContainer, subHeadingContainerProps] = getOverrides(overrides.SubHeadingContainer, StyledHeadingSubHeading);
54
+ const [EndEnhancerContainer, endEnhancerContainerProps] = getOverrides(overrides.EndEnhancerContainer, StyledHeadingEndEnhancerContainer);
55
+ const [EndEnhancerDescriptionContainer, endEnhancerDescriptionContainerProps] = getOverrides(overrides.EndEnhancerDescriptionContainer, StyledHeadingEndEnhancerDescriptionContainer);
56
+ const isEndEnhancerString = typeof EndEnhancer === 'string';
57
+
58
+ if (process.env.NODE_ENV !== "production") {
59
+ if (isEndEnhancerString && EndEnhancerDescription) {
60
+ console.warn('endEnhancerDescription will not be rendered if endEnhancer is not a string');
61
+ }
62
+
63
+ if (maxLines && !isMaxLinesValid(maxLines)) {
64
+ console.warn('maxLines must be 1 or 2.');
65
+ }
66
+ }
67
+
68
+ return /*#__PURE__*/React.createElement(Root // eslint-disable-next-line flowtype/no-weak-types
69
+ , _extends({
70
+ ref: ref
71
+ }, rootProps), /*#__PURE__*/React.createElement(Content, contentProps, /*#__PURE__*/React.createElement(StyledHeadingContentRow, null, /*#__PURE__*/React.createElement(HeadingContainer, _extends({
72
+ $maxLines: isMaxLinesValid(maxLines) ? maxLines : 1
73
+ }, headingContainerProps), /*#__PURE__*/React.createElement(RenderNode, {
74
+ component: props.heading
75
+ })), EndEnhancer && /*#__PURE__*/React.createElement(EndEnhancerContainer, _extends({
76
+ $isText: isEndEnhancerString
77
+ }, endEnhancerContainerProps), /*#__PURE__*/React.createElement(RenderNode, {
78
+ component: EndEnhancer
79
+ }))), (SubHeading || EndEnhancerDescription) && /*#__PURE__*/React.createElement(StyledHeadingContentRow, null, /*#__PURE__*/React.createElement(SubHeadingContainer, _extends({
80
+ $maxLines: isMaxLinesValid(maxLines) ? maxLines : 1
81
+ }, subHeadingContainerProps), /*#__PURE__*/React.createElement(RenderNode, {
82
+ component: SubHeading
83
+ })), EndEnhancerDescription && isEndEnhancerString && /*#__PURE__*/React.createElement(EndEnhancerDescriptionContainer, endEnhancerDescriptionContainerProps, /*#__PURE__*/React.createElement(RenderNode, {
84
+ component: EndEnhancerDescription
85
+ })))));
86
+ });
87
+ ListHeading.displayName = 'ListHeading';
88
+ export default ListHeading;
@@ -6,6 +6,7 @@ LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import * as React from 'react';
8
8
  import ListItem from './list-item.js';
9
+ import { mergeOverrides } from '../helpers/overrides.js';
9
10
  const MenuAdapter = /*#__PURE__*/React.forwardRef((props, ref) => {
10
11
  return /*#__PURE__*/React.createElement(ListItem, {
11
12
  ref: ref,
@@ -13,7 +14,8 @@ const MenuAdapter = /*#__PURE__*/React.forwardRef((props, ref) => {
13
14
  artwork: props.artwork,
14
15
  artworkSize: props.artworkSize,
15
16
  endEnhancer: props.endEnhancer,
16
- overrides: {
17
+ overrides: // $FlowFixMe
18
+ mergeOverrides({
17
19
  Root: {
18
20
  props: {
19
21
  onMouseEnter: props.onMouseEnter,
@@ -26,7 +28,7 @@ const MenuAdapter = /*#__PURE__*/React.forwardRef((props, ref) => {
26
28
  cursor: props.$disabled ? 'not-allowed' : 'pointer'
27
29
  })
28
30
  }
29
- }
31
+ }, props.overrides)
30
32
  }, props.children);
31
33
  });
32
34
  MenuAdapter.displayName = 'MenuAdapter';
@@ -37,7 +37,7 @@ export const StyledContent = styled('div', ({
37
37
  borderLeftStyle: 'none',
38
38
  display: 'flex',
39
39
  flexGrow: 1,
40
- minHeight: $sublist ? 'initial' : '64px',
40
+ minHeight: $sublist ? 'initial' : $theme.sizing.scale1600,
41
41
  justifyContent: 'space-between',
42
42
  ...($theme.direction === 'rtl' ? {
43
43
  paddingLeft: $theme.sizing.scale600,
@@ -103,8 +103,103 @@ export const StyledLabelSublistContent = styled('p', ({
103
103
  }) => {
104
104
  return { ...$theme.typography.LabelMedium,
105
105
  color: $theme.colors.contentPrimary,
106
- marginTop: '12px',
107
- marginBottom: '12px'
106
+ marginTop: $theme.sizing.scale500,
107
+ marginBottom: $theme.sizing.scale500
108
108
  };
109
109
  });
110
- StyledLabelSublistContent.displayName = "StyledLabelSublistContent";
110
+ StyledLabelSublistContent.displayName = "StyledLabelSublistContent";
111
+ export const StyledHeadingRoot = styled('div', ({
112
+ $theme
113
+ }) => {
114
+ return {
115
+ display: 'flex',
116
+ alignItems: 'center',
117
+ width: '100%',
118
+ backgroundColor: $theme.colors.backgroundPrimary,
119
+ overflow: 'hidden',
120
+ minHeight: $theme.sizing.scale1600
121
+ };
122
+ });
123
+ StyledHeadingRoot.displayName = "StyledHeadingRoot";
124
+ export const StyledHeadingContent = styled('div', ({
125
+ $theme
126
+ }) => {
127
+ return {
128
+ flexGrow: 1,
129
+ width: '100%',
130
+ minWidth: 0,
131
+ paddingTop: $theme.sizing.scale600,
132
+ paddingBottom: $theme.sizing.scale300,
133
+ ...($theme.direction === 'rtl' ? {
134
+ paddingLeft: $theme.sizing.scale600,
135
+ marginRight: $theme.sizing.scale600
136
+ } : {
137
+ paddingRight: $theme.sizing.scale600,
138
+ marginLeft: $theme.sizing.scale600
139
+ })
140
+ };
141
+ });
142
+ StyledHeadingContent.displayName = "StyledHeadingContent";
143
+ export const StyledHeadingContentRow = styled('div', {
144
+ display: 'flex',
145
+ justifyContent: 'space-between',
146
+ width: '100%'
147
+ });
148
+ StyledHeadingContentRow.displayName = "StyledHeadingContentRow";
149
+ export const StyledHeadingMainHeading = styled('p', // $FlowFixMe - suppressing due to webkit properties
150
+ ({
151
+ $maxLines = 1,
152
+ $theme
153
+ }) => {
154
+ return { ...$theme.typography.HeadingSmall,
155
+ color: $theme.colors.contentPrimary,
156
+ marginTop: 0,
157
+ marginBottom: 0,
158
+ marginRight: $theme.sizing.scale600,
159
+ display: '-webkit-box',
160
+ '-webkit-line-clamp': $maxLines,
161
+ '-webkit-box-orient': 'vertical',
162
+ overflow: 'hidden'
163
+ };
164
+ });
165
+ StyledHeadingMainHeading.displayName = "StyledHeadingMainHeading";
166
+ export const StyledHeadingSubHeading = styled('p', // $FlowFixMe - suppressing due to webkit properties
167
+ ({
168
+ $maxLines = 1,
169
+ $theme
170
+ }) => {
171
+ return { ...$theme.typography.ParagraphLarge,
172
+ color: $theme.colors.contentPrimary,
173
+ marginTop: 0,
174
+ marginBottom: 0,
175
+ marginRight: $theme.sizing.scale600,
176
+ display: '-webkit-box',
177
+ '-webkit-line-clamp': $maxLines,
178
+ '-webkit-box-orient': 'vertical',
179
+ overflow: 'hidden'
180
+ };
181
+ });
182
+ StyledHeadingSubHeading.displayName = "StyledHeadingSubHeading";
183
+ export const StyledHeadingEndEnhancerContainer = styled('div', ({
184
+ $isText,
185
+ $theme
186
+ }) => ({ ...$theme.typography.LabelMedium,
187
+ display: 'flex',
188
+ alignItems: $isText ? 'flex-end' : 'center',
189
+ whiteSpace: 'nowrap',
190
+ overflow: 'hidden',
191
+ textOverflow: 'ellipsis'
192
+ }));
193
+ StyledHeadingEndEnhancerContainer.displayName = "StyledHeadingEndEnhancerContainer";
194
+ export const StyledHeadingEndEnhancerDescriptionContainer = styled('p', ({
195
+ $theme
196
+ }) => ({ ...$theme.typography.ParagraphMedium,
197
+ marginTop: 0,
198
+ marginBottom: 0,
199
+ display: 'flex',
200
+ alignItems: 'flex-start',
201
+ whiteSpace: 'nowrap',
202
+ overflow: 'hidden',
203
+ textOverflow: 'ellipsis'
204
+ }));
205
+ StyledHeadingEndEnhancerDescriptionContainer.displayName = "StyledHeadingEndEnhancerDescriptionContainer";
@@ -0,0 +1,69 @@
1
+ /*
2
+ Copyright (c) Uber Technologies, Inc.
3
+
4
+ This source code is licensed under the MIT license found in the
5
+ LICENSE file in the root directory of this source tree.
6
+ */
7
+ export const NEEDLE_SIZES = Object.freeze({
8
+ none: 'none',
9
+ short: 'short',
10
+ medium: 'medium',
11
+ tall: 'tall'
12
+ });
13
+ export const NEEDLE_HEIGHTS = Object.freeze({
14
+ [NEEDLE_SIZES.none]: 0,
15
+ [NEEDLE_SIZES.short]: 4,
16
+ [NEEDLE_SIZES.medium]: 12,
17
+ [NEEDLE_SIZES.tall]: 20
18
+ });
19
+ export const PINHEAD_SIZES_SHAPES = Object.freeze({
20
+ xSmallCircle: 'x-small-circle',
21
+ xSmallSquare: 'x-small-square',
22
+ small: 'small',
23
+ medium: 'medium',
24
+ large: 'large'
25
+ });
26
+ export const xSmallPinheadDimension = {
27
+ height: 16,
28
+ icon: 4
29
+ };
30
+ export const PINHEAD_DIMENSIONS = Object.freeze({
31
+ [PINHEAD_SIZES_SHAPES.xSmallSquare]: xSmallPinheadDimension,
32
+ [PINHEAD_SIZES_SHAPES.xSmallCircle]: xSmallPinheadDimension,
33
+ [PINHEAD_SIZES_SHAPES.small]: {
34
+ height: 24,
35
+ icon: 16
36
+ },
37
+ [PINHEAD_SIZES_SHAPES.medium]: {
38
+ height: 36,
39
+ icon: 16
40
+ },
41
+ [PINHEAD_SIZES_SHAPES.large]: {
42
+ height: 48,
43
+ icon: 24
44
+ }
45
+ });
46
+ export const PINHEAD_TYPES = Object.freeze({
47
+ floating: 'floating',
48
+ fixed: 'fixed'
49
+ });
50
+ export const FLOATING_MARKER_SIZES = Object.freeze({
51
+ small: 'small',
52
+ medium: 'medium',
53
+ large: 'large'
54
+ });
55
+ export const FLOATING_MARKER_ANCHOR_POSITIONS = Object.freeze({
56
+ none: 'none',
57
+ topLeft: 'top-left',
58
+ topRight: 'top-right',
59
+ bottomRight: 'bottom-right',
60
+ bottomLeft: 'bottom-left'
61
+ });
62
+ export const FLOATING_MARKER_ANCHOR_TYPES = Object.freeze({
63
+ circle: 'circle',
64
+ square: 'square'
65
+ });
66
+ export const dragShadowHeight = 4;
67
+ export const dragShadowMarginTop = 6;
68
+ export const dragShadowWidth = 6;
69
+ export const anchorSize = 16;