baseui 11.0.1 → 11.1.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.
- package/a11y/index.d.ts +1 -1
- package/accordion/index.d.ts +25 -28
- package/app-nav-bar/app-nav-bar.js +33 -40
- package/app-nav-bar/app-nav-bar.js.flow +46 -62
- package/app-nav-bar/index.d.ts +9 -8
- package/app-nav-bar/styled-components.js +49 -29
- package/app-nav-bar/styled-components.js.flow +25 -8
- package/app-nav-bar/types.js.flow +2 -0
- package/aspect-ratio-box/index.d.ts +2 -4
- package/avatar/index.d.ts +6 -12
- package/badge/badge.js +109 -0
- package/badge/badge.js.flow +91 -0
- package/badge/constants.js +54 -0
- package/badge/constants.js.flow +52 -0
- package/badge/hint-dot.js +96 -0
- package/badge/hint-dot.js.flow +68 -0
- package/badge/index.d.ts +97 -0
- package/badge/index.js +80 -0
- package/badge/index.js.flow +20 -0
- package/badge/notification-circle.js +103 -0
- package/badge/notification-circle.js.flow +81 -0
- package/badge/package.json +4 -0
- package/badge/styled-components.js +242 -0
- package/badge/styled-components.js.flow +325 -0
- package/badge/types.js +11 -0
- package/badge/types.js.flow +59 -0
- package/badge/utils.js +33 -0
- package/badge/utils.js.flow +23 -0
- package/banner/banner.js +283 -0
- package/banner/banner.js.flow +253 -0
- package/banner/constants.js +35 -0
- package/banner/constants.js.flow +33 -0
- package/banner/index.d.ts +75 -0
- package/banner/index.js +44 -0
- package/banner/index.js.flow +16 -0
- package/banner/package.json +4 -0
- package/banner/styled-components.js +131 -0
- package/banner/styled-components.js.flow +119 -0
- package/banner/types.js +11 -0
- package/banner/types.js.flow +66 -0
- package/block/index.d.ts +4 -4
- package/breadcrumbs/breadcrumbs.js +5 -1
- package/breadcrumbs/breadcrumbs.js.flow +2 -2
- package/breadcrumbs/index.d.ts +5 -5
- package/button/button.js +2 -1
- package/button/button.js.flow +1 -0
- package/button/index.d.ts +19 -29
- package/button-group/index.d.ts +18 -24
- package/card/index.d.ts +16 -14
- package/checkbox/index.d.ts +17 -21
- package/combobox/index.d.ts +7 -11
- package/data-table/index.d.ts +7 -10
- package/datepicker/calendar.js +16 -11
- package/datepicker/calendar.js.flow +12 -9
- package/datepicker/datepicker.js +58 -58
- package/datepicker/datepicker.js.flow +51 -34
- package/datepicker/index.d.ts +42 -63
- package/datepicker/stateful-calendar.js +6 -1
- package/datepicker/stateful-calendar.js.flow +8 -1
- package/datepicker/stateful-container.js +23 -2
- package/datepicker/stateful-container.js.flow +17 -4
- package/datepicker/stateful-datepicker.js +6 -1
- package/datepicker/stateful-datepicker.js.flow +7 -1
- package/datepicker/types.js.flow +21 -43
- package/datepicker/utils/date-helpers.js +1 -1
- package/datepicker/utils/date-helpers.js.flow +1 -1
- package/dnd-list/index.d.ts +22 -35
- package/drawer/index.d.ts +22 -27
- package/es/app-nav-bar/app-nav-bar.js +9 -19
- package/es/app-nav-bar/styled-components.js +32 -13
- package/es/badge/badge.js +70 -0
- package/es/badge/constants.js +42 -0
- package/es/badge/hint-dot.js +55 -0
- package/es/badge/index.js +11 -0
- package/es/badge/notification-circle.js +65 -0
- package/es/badge/styled-components.js +296 -0
- package/es/badge/types.js +8 -0
- package/es/badge/utils.js +17 -0
- package/es/banner/banner.js +213 -0
- package/es/banner/constants.js +24 -0
- package/es/banner/index.js +9 -0
- package/es/banner/styled-components.js +122 -0
- package/es/banner/types.js +8 -0
- package/es/breadcrumbs/breadcrumbs.js +5 -1
- package/es/button/button.js +1 -0
- package/es/datepicker/calendar.js +15 -10
- package/es/datepicker/datepicker.js +52 -52
- package/es/datepicker/stateful-calendar.js +6 -1
- package/es/datepicker/stateful-container.js +22 -2
- package/es/datepicker/stateful-datepicker.js +6 -1
- package/es/datepicker/utils/date-helpers.js +1 -1
- package/es/helper/helper-steps.js +3 -1
- package/es/input/base-input.js +18 -11
- package/es/input/input.js +15 -10
- package/es/input/masked-input.js +5 -2
- package/es/input/utils.js +4 -2
- package/es/locale/tr_TR.js +115 -0
- package/es/notification/notification.js +16 -1
- package/es/payment-card/custom-cards.config.js +22 -0
- package/es/payment-card/icons/uatp.js +52 -0
- package/es/payment-card/payment-card.js +8 -3
- package/es/popover/popover.js +2 -1
- package/es/popover/stateful-container.js +2 -0
- package/es/popover/styled-components.js +2 -1
- package/es/progress-steps/numbered-step.js +2 -2
- package/es/select/select-component.js +48 -23
- package/es/select/utils/default-filter-options.js +1 -1
- package/es/snackbar/snackbar-context.js +1 -1
- package/es/table-semantic/styled-components.js +14 -0
- package/es/table-semantic/table-builder.js +12 -5
- package/es/textarea/textarea.js +15 -9
- package/es/themes/dark-theme/color-component-tokens.js +8 -0
- package/es/themes/light-theme/color-component-tokens.js +8 -0
- package/es/tree-view/tree-label.js +9 -1
- package/esm/app-nav-bar/app-nav-bar.js +32 -38
- package/esm/app-nav-bar/styled-components.js +46 -28
- package/esm/badge/badge.js +97 -0
- package/esm/badge/constants.js +42 -0
- package/esm/badge/hint-dot.js +83 -0
- package/esm/badge/index.js +11 -0
- package/esm/badge/notification-circle.js +91 -0
- package/esm/badge/styled-components.js +235 -0
- package/esm/badge/types.js +8 -0
- package/esm/badge/utils.js +17 -0
- package/esm/banner/banner.js +271 -0
- package/esm/banner/constants.js +24 -0
- package/esm/banner/index.js +9 -0
- package/esm/banner/styled-components.js +113 -0
- package/esm/banner/types.js +8 -0
- package/esm/breadcrumbs/breadcrumbs.js +5 -1
- package/esm/button/button.js +2 -1
- package/esm/datepicker/calendar.js +16 -11
- package/esm/datepicker/datepicker.js +58 -58
- package/esm/datepicker/stateful-calendar.js +6 -1
- package/esm/datepicker/stateful-container.js +23 -2
- package/esm/datepicker/stateful-datepicker.js +6 -1
- package/esm/datepicker/utils/date-helpers.js +1 -1
- package/esm/helper/helper-steps.js +3 -1
- package/esm/input/base-input.js +18 -11
- package/esm/input/input.js +15 -10
- package/esm/input/masked-input.js +6 -3
- package/esm/input/utils.js +4 -2
- package/esm/locale/tr_TR.js +115 -0
- package/esm/notification/notification.js +17 -1
- package/esm/payment-card/custom-cards.config.js +22 -0
- package/esm/payment-card/icons/uatp.js +53 -0
- package/esm/payment-card/payment-card.js +9 -7
- package/esm/popover/popover.js +2 -1
- package/esm/popover/stateful-container.js +2 -0
- package/esm/popover/styled-components.js +3 -2
- package/esm/progress-steps/numbered-step.js +2 -2
- package/esm/select/select-component.js +85 -59
- package/esm/select/utils/default-filter-options.js +1 -1
- package/esm/snackbar/snackbar-context.js +1 -1
- package/esm/table-semantic/styled-components.js +31 -18
- package/esm/table-semantic/table-builder.js +34 -23
- package/esm/textarea/textarea.js +15 -9
- package/esm/themes/dark-theme/color-component-tokens.js +8 -0
- package/esm/themes/light-theme/color-component-tokens.js +8 -0
- package/esm/tree-view/tree-label.js +10 -2
- package/file-uploader/index.d.ts +11 -11
- package/flex-grid/index.d.ts +3 -3
- package/form-control/index.d.ts +7 -19
- package/header-navigation/index.d.ts +8 -9
- package/heading/index.d.ts +3 -4
- package/helper/helper-steps.js +19 -13
- package/helper/helper-steps.js.flow +3 -1
- package/helper/index.d.ts +7 -7
- package/helpers/base-provider.d.ts +16 -0
- package/helpers/overrides.d.ts +23 -0
- package/icon/index.d.ts +32 -32
- package/index.d.ts +34 -114
- package/input/base-input.js +18 -11
- package/input/base-input.js.flow +18 -6
- package/input/index.d.ts +29 -32
- package/input/input.js +15 -10
- package/input/input.js.flow +10 -5
- package/input/masked-input.js +6 -3
- package/input/masked-input.js.flow +3 -0
- package/input/types.js.flow +4 -0
- package/input/utils.js +4 -2
- package/input/utils.js.flow +2 -1
- package/layer/index.d.ts +6 -11
- package/layout-grid/index.d.ts +25 -7
- package/link/index.d.ts +2 -2
- package/list/index.d.ts +26 -31
- package/{locale.ts → locale/index.d.ts} +8 -0
- package/locale/tr_TR.js +123 -0
- package/locale/tr_TR.js.flow +124 -0
- package/map-marker/index.d.ts +41 -47
- package/menu/index.d.ts +27 -37
- package/modal/index.d.ts +28 -38
- package/notification/index.d.ts +2 -3
- package/notification/notification.js +18 -1
- package/notification/notification.js.flow +15 -1
- package/overrides.ts +2 -22
- package/package.json +26 -17
- package/pagination/index.d.ts +22 -26
- package/payment-card/custom-cards.config.js +30 -0
- package/payment-card/custom-cards.config.js.flow +29 -0
- package/payment-card/icons/uatp.js +67 -0
- package/payment-card/icons/uatp.js.flow +62 -0
- package/payment-card/index.d.ts +8 -8
- package/payment-card/payment-card.js +12 -7
- package/payment-card/payment-card.js.flow +12 -0
- package/phone-input/index.d.ts +261 -269
- package/pin-code/index.d.ts +11 -18
- package/popover/index.d.ts +39 -55
- package/popover/popover.js +2 -1
- package/popover/popover.js.flow +2 -1
- package/popover/stateful-container.js +2 -0
- package/popover/stateful-container.js.flow +2 -0
- package/popover/styled-components.js +3 -2
- package/popover/styled-components.js.flow +2 -1
- package/popover/types.js.flow +1 -0
- package/progress-bar/index.d.ts +11 -12
- package/progress-steps/index.d.ts +16 -16
- package/progress-steps/numbered-step.js.flow +2 -2
- package/radio/index.d.ts +12 -15
- package/rating/index.d.ts +9 -12
- package/select/index.d.ts +34 -36
- package/select/select-component.js +82 -56
- package/select/select-component.js.flow +46 -34
- package/select/types.js.flow +1 -0
- package/select/utils/default-filter-options.js +1 -1
- package/select/utils/default-filter-options.js.flow +1 -1
- package/side-navigation/index.d.ts +11 -13
- package/skeleton/index.d.ts +1 -1
- package/slider/index.d.ts +17 -26
- package/snackbar/index.d.ts +8 -8
- package/snackbar/snackbar-context.js +1 -1
- package/snackbar/snackbar-context.js.flow +1 -1
- package/spinner/index.d.ts +4 -3
- package/styles/index.d.ts +82 -2
- package/table/index.d.ts +16 -16
- package/table-grid/index.d.ts +6 -8
- package/table-semantic/index.d.ts +26 -32
- package/table-semantic/styled-components.js +33 -19
- package/table-semantic/styled-components.js.flow +12 -0
- package/table-semantic/table-builder.js +38 -22
- package/table-semantic/table-builder.js.flow +32 -17
- package/table-semantic/types.js.flow +1 -0
- package/tabs/index.d.ts +20 -23
- package/tabs-motion/index.d.ts +23 -23
- package/tag/index.d.ts +14 -18
- package/tag/types.js.flow +1 -1
- package/textarea/index.d.ts +11 -14
- package/textarea/textarea.js +15 -9
- package/textarea/textarea.js.flow +11 -5
- package/textarea/types.js.flow +1 -0
- package/theme.ts +36 -777
- package/themes/dark-theme/color-component-tokens.js +8 -0
- package/themes/dark-theme/color-component-tokens.js.flow +9 -0
- package/themes/index.d.ts +765 -0
- package/themes/light-theme/color-component-tokens.js +8 -0
- package/themes/light-theme/color-component-tokens.js.flow +9 -0
- package/themes/types.js.flow +9 -0
- package/timepicker/index.d.ts +5 -8
- package/timezonepicker/index.d.ts +5 -8
- package/toast/index.d.ts +26 -40
- package/tokens/index.d.ts +1 -1
- package/tooltip/index.d.ts +7 -9
- package/tree-view/index.d.ts +15 -19
- package/tree-view/tree-label.js +10 -2
- package/tree-view/tree-label.js.flow +4 -4
- package/typography/index.d.ts +37 -37
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
var _ROLE$badge, _ROLE$notificationCir, _ROLE$hintDot, _Object$freeze;
|
|
2
|
+
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6
|
+
|
|
7
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
Copyright (c) Uber Technologies, Inc.
|
|
11
|
+
|
|
12
|
+
This source code is licensed under the MIT license found in the
|
|
13
|
+
LICENSE file in the root directory of this source tree.
|
|
14
|
+
*/
|
|
15
|
+
import { styled } from '../styles/index.js';
|
|
16
|
+
import { COLOR, SHAPE, ROLE, PLACEMENT, HIERARCHY } from './constants.js';
|
|
17
|
+
|
|
18
|
+
function getColorStyles(_ref) {
|
|
19
|
+
var _HIERARCHY$primary, _HIERARCHY$secondary, _COLOR_STYLES;
|
|
20
|
+
|
|
21
|
+
var $theme = _ref.$theme,
|
|
22
|
+
$hierarchy = _ref.$hierarchy,
|
|
23
|
+
$color = _ref.$color;
|
|
24
|
+
var COLOR_STYLES = (_COLOR_STYLES = {}, _defineProperty(_COLOR_STYLES, HIERARCHY.primary, (_HIERARCHY$primary = {}, _defineProperty(_HIERARCHY$primary, COLOR.accent, {
|
|
25
|
+
color: $theme.colors.contentInversePrimary,
|
|
26
|
+
backgroundColor: $theme.colors.backgroundAccent
|
|
27
|
+
}), _defineProperty(_HIERARCHY$primary, COLOR.primary, {
|
|
28
|
+
color: $theme.colors.contentInversePrimary,
|
|
29
|
+
backgroundColor: $theme.colors.backgroundInversePrimary
|
|
30
|
+
}), _defineProperty(_HIERARCHY$primary, COLOR.positive, {
|
|
31
|
+
color: $theme.colors.contentInversePrimary,
|
|
32
|
+
backgroundColor: $theme.colors.backgroundPositive
|
|
33
|
+
}), _defineProperty(_HIERARCHY$primary, COLOR.negative, {
|
|
34
|
+
color: $theme.colors.contentInversePrimary,
|
|
35
|
+
backgroundColor: $theme.colors.backgroundNegative
|
|
36
|
+
}), _defineProperty(_HIERARCHY$primary, COLOR.warning, {
|
|
37
|
+
color: $theme.colors.primaryA,
|
|
38
|
+
backgroundColor: $theme.colors.backgroundWarning
|
|
39
|
+
}), _HIERARCHY$primary)), _defineProperty(_COLOR_STYLES, HIERARCHY.secondary, (_HIERARCHY$secondary = {}, _defineProperty(_HIERARCHY$secondary, COLOR.accent, {
|
|
40
|
+
color: $theme.colors.contentAccent,
|
|
41
|
+
backgroundColor: $theme.colors.backgroundLightAccent
|
|
42
|
+
}), _defineProperty(_HIERARCHY$secondary, COLOR.primary, {
|
|
43
|
+
color: $theme.colors.primaryA,
|
|
44
|
+
backgroundColor: $theme.colors.backgroundSecondary
|
|
45
|
+
}), _defineProperty(_HIERARCHY$secondary, COLOR.positive, {
|
|
46
|
+
color: $theme.colors.contentPositive,
|
|
47
|
+
backgroundColor: $theme.colors.backgroundLightPositive
|
|
48
|
+
}), _defineProperty(_HIERARCHY$secondary, COLOR.negative, {
|
|
49
|
+
color: $theme.colors.contentNegative,
|
|
50
|
+
backgroundColor: $theme.colors.backgroundLightNegative
|
|
51
|
+
}), _defineProperty(_HIERARCHY$secondary, COLOR.warning, {
|
|
52
|
+
color: $theme.colors.contentWarning,
|
|
53
|
+
backgroundColor: $theme.colors.backgroundLightWarning
|
|
54
|
+
}), _HIERARCHY$secondary)), _COLOR_STYLES);
|
|
55
|
+
return COLOR_STYLES[$hierarchy][$color];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT = {
|
|
59
|
+
top: '-10px',
|
|
60
|
+
right: '-10px'
|
|
61
|
+
};
|
|
62
|
+
var DEFAULT_HINT_DOT_PLACEMENT = {
|
|
63
|
+
top: '-4px',
|
|
64
|
+
right: '-4px'
|
|
65
|
+
};
|
|
66
|
+
var POSITION_STYLES = Object.freeze((_Object$freeze = {}, _defineProperty(_Object$freeze, ROLE.badge, (_ROLE$badge = {}, _defineProperty(_ROLE$badge, PLACEMENT.topEdge, {
|
|
67
|
+
top: '-8px',
|
|
68
|
+
left: '50%',
|
|
69
|
+
transform: 'translateX(-50%)'
|
|
70
|
+
}), _defineProperty(_ROLE$badge, PLACEMENT.bottomEdge, {
|
|
71
|
+
bottom: '-8px',
|
|
72
|
+
left: '50%',
|
|
73
|
+
transform: 'translateX(-50%)'
|
|
74
|
+
}), _defineProperty(_ROLE$badge, PLACEMENT.topLeft, {
|
|
75
|
+
top: '16px',
|
|
76
|
+
left: '16px'
|
|
77
|
+
}), _defineProperty(_ROLE$badge, PLACEMENT.topRight, {
|
|
78
|
+
top: '16px',
|
|
79
|
+
right: '16px'
|
|
80
|
+
}), _defineProperty(_ROLE$badge, PLACEMENT.bottomRight, {
|
|
81
|
+
bottom: '16px',
|
|
82
|
+
right: '16px'
|
|
83
|
+
}), _defineProperty(_ROLE$badge, PLACEMENT.bottomLeft, {
|
|
84
|
+
bottom: '16px',
|
|
85
|
+
left: '16px'
|
|
86
|
+
}), _defineProperty(_ROLE$badge, PLACEMENT.topLeftEdge, {
|
|
87
|
+
top: '-8px',
|
|
88
|
+
left: '16px'
|
|
89
|
+
}), _defineProperty(_ROLE$badge, PLACEMENT.topRightEdge, {
|
|
90
|
+
top: '-8px',
|
|
91
|
+
right: '16px'
|
|
92
|
+
}), _defineProperty(_ROLE$badge, PLACEMENT.bottomRightEdge, {
|
|
93
|
+
bottom: '-8px',
|
|
94
|
+
right: '16px'
|
|
95
|
+
}), _defineProperty(_ROLE$badge, PLACEMENT.bottomLeftEdge, {
|
|
96
|
+
bottom: '-8px',
|
|
97
|
+
left: '16px'
|
|
98
|
+
}), _defineProperty(_ROLE$badge, PLACEMENT.leftTopEdge, {
|
|
99
|
+
top: '16px',
|
|
100
|
+
left: '-8px'
|
|
101
|
+
}), _defineProperty(_ROLE$badge, PLACEMENT.rightTopEdge, {
|
|
102
|
+
top: '16px',
|
|
103
|
+
right: '-8px'
|
|
104
|
+
}), _defineProperty(_ROLE$badge, PLACEMENT.rightBottomEdge, {
|
|
105
|
+
bottom: '16px',
|
|
106
|
+
right: '-8px'
|
|
107
|
+
}), _defineProperty(_ROLE$badge, PLACEMENT.leftBottomEdge, {
|
|
108
|
+
bottom: '16px',
|
|
109
|
+
left: '-8px'
|
|
110
|
+
}), _ROLE$badge)), _defineProperty(_Object$freeze, ROLE.notificationCircle, (_ROLE$notificationCir = {}, _defineProperty(_ROLE$notificationCir, PLACEMENT.topLeft, {
|
|
111
|
+
top: '-10px',
|
|
112
|
+
left: '-10px'
|
|
113
|
+
}), _defineProperty(_ROLE$notificationCir, PLACEMENT.topRight, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, PLACEMENT.topEdge, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, PLACEMENT.bottomEdge, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, PLACEMENT.bottomRight, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, PLACEMENT.bottomLeft, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, PLACEMENT.topLeftEdge, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, PLACEMENT.topRightEdge, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, PLACEMENT.bottomRightEdge, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, PLACEMENT.bottomLeftEdge, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, PLACEMENT.leftTopEdge, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, PLACEMENT.rightTopEdge, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, PLACEMENT.rightBottomEdge, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, PLACEMENT.leftBottomEdge, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _ROLE$notificationCir)), _defineProperty(_Object$freeze, ROLE.hintDot, (_ROLE$hintDot = {}, _defineProperty(_ROLE$hintDot, PLACEMENT.topLeft, {
|
|
114
|
+
top: '-4px',
|
|
115
|
+
left: '-4px'
|
|
116
|
+
}), _defineProperty(_ROLE$hintDot, PLACEMENT.topRight, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, PLACEMENT.topEdge, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, PLACEMENT.bottomEdge, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, PLACEMENT.bottomRight, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, PLACEMENT.bottomLeft, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, PLACEMENT.topLeftEdge, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, PLACEMENT.topRightEdge, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, PLACEMENT.bottomRightEdge, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, PLACEMENT.bottomLeftEdge, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, PLACEMENT.leftTopEdge, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, PLACEMENT.rightTopEdge, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, PLACEMENT.rightBottomEdge, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, PLACEMENT.leftBottomEdge, DEFAULT_HINT_DOT_PLACEMENT), _ROLE$hintDot)), _Object$freeze));
|
|
117
|
+
export var StyledRoot = styled('div', function () {
|
|
118
|
+
return {
|
|
119
|
+
position: 'relative',
|
|
120
|
+
display: 'inline-block',
|
|
121
|
+
lineHeight: 'initial'
|
|
122
|
+
};
|
|
123
|
+
});
|
|
124
|
+
StyledRoot.displayName = "StyledRoot";
|
|
125
|
+
var TOP_PLACEMENTS = [PLACEMENT.topLeft, PLACEMENT.topRight, PLACEMENT.topLeftEdge, PLACEMENT.topEdge, PLACEMENT.topRightEdge, PLACEMENT.leftTopEdge, PLACEMENT.rightTopEdge];
|
|
126
|
+
var BOTTOM_PLACEMENTS = [PLACEMENT.bottomLeft, PLACEMENT.bottomRight, PLACEMENT.bottomLeftEdge, PLACEMENT.bottomEdge, PLACEMENT.bottomRightEdge, PLACEMENT.leftBottomEdge, PLACEMENT.rightBottomEdge];
|
|
127
|
+
var LEFT_PLACEMENTS = [PLACEMENT.topLeft, PLACEMENT.topLeftEdge, PLACEMENT.topEdge, PLACEMENT.bottomLeft, PLACEMENT.bottomLeftEdge, PLACEMENT.bottomEdge, PLACEMENT.leftTopEdge, PLACEMENT.leftBottomEdge];
|
|
128
|
+
var RIGHT_PLACEMENTS = [PLACEMENT.topRight, PLACEMENT.topRightEdge, PLACEMENT.bottomRight, PLACEMENT.bottomRightEdge, PLACEMENT.rightTopEdge, PLACEMENT.rightBottomEdge];
|
|
129
|
+
export var StyledPositioner = styled('div', function (_ref2) {
|
|
130
|
+
var $theme = _ref2.$theme,
|
|
131
|
+
$role = _ref2.$role,
|
|
132
|
+
$placement = _ref2.$placement,
|
|
133
|
+
$horizontalOffset = _ref2.$horizontalOffset,
|
|
134
|
+
$verticalOffset = _ref2.$verticalOffset;
|
|
135
|
+
var positionStyle = POSITION_STYLES[$role][$placement];
|
|
136
|
+
|
|
137
|
+
if ($verticalOffset) {
|
|
138
|
+
if (TOP_PLACEMENTS.includes($placement)) {
|
|
139
|
+
positionStyle = _objectSpread(_objectSpread({}, positionStyle), {}, {
|
|
140
|
+
top: $verticalOffset
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (BOTTOM_PLACEMENTS.includes($placement)) {
|
|
145
|
+
positionStyle = _objectSpread(_objectSpread({}, positionStyle), {}, {
|
|
146
|
+
bottom: $verticalOffset
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if ($horizontalOffset) {
|
|
152
|
+
if (LEFT_PLACEMENTS.includes($placement)) {
|
|
153
|
+
positionStyle = _objectSpread(_objectSpread({}, positionStyle), {}, {
|
|
154
|
+
left: $horizontalOffset
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (RIGHT_PLACEMENTS.includes($placement)) {
|
|
159
|
+
positionStyle = _objectSpread(_objectSpread({}, positionStyle), {}, {
|
|
160
|
+
right: $horizontalOffset
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return _objectSpread(_objectSpread({}, positionStyle), {}, {
|
|
166
|
+
position: 'absolute',
|
|
167
|
+
lineHeight: 'initial'
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
StyledPositioner.displayName = "StyledPositioner";
|
|
171
|
+
export var StyledBadge = styled('div', function (_ref3) {
|
|
172
|
+
var $theme = _ref3.$theme,
|
|
173
|
+
_ref3$$shape = _ref3.$shape,
|
|
174
|
+
$shape = _ref3$$shape === void 0 ? SHAPE.rectangle : _ref3$$shape,
|
|
175
|
+
_ref3$$color = _ref3.$color,
|
|
176
|
+
$color = _ref3$$color === void 0 ? COLOR.accent : _ref3$$color,
|
|
177
|
+
_ref3$$hierarchy = _ref3.$hierarchy,
|
|
178
|
+
$hierarchy = _ref3$$hierarchy === void 0 ? HIERARCHY.primary : _ref3$$hierarchy,
|
|
179
|
+
$hidden = _ref3.$hidden;
|
|
180
|
+
return _objectSpread(_objectSpread({
|
|
181
|
+
visibility: $hidden ? 'hidden' : 'inherit',
|
|
182
|
+
boxSizing: 'border-box',
|
|
183
|
+
height: $theme.sizing.scale700,
|
|
184
|
+
borderRadius: $shape === SHAPE.rectangle ? $theme.borders.radius200 : $theme.borders.radius500,
|
|
185
|
+
paddingRight: $shape === SHAPE.rectangle ? $theme.sizing.scale100 : $theme.sizing.scale300,
|
|
186
|
+
paddingLeft: $shape === SHAPE.rectangle ? $theme.sizing.scale100 : $theme.sizing.scale300,
|
|
187
|
+
display: 'inline-flex',
|
|
188
|
+
alignItems: 'center'
|
|
189
|
+
}, getColorStyles({
|
|
190
|
+
$theme: $theme,
|
|
191
|
+
$hierarchy: $hierarchy,
|
|
192
|
+
$color: $color
|
|
193
|
+
})), $hierarchy === HIERARCHY.primary ? $theme.typography.LabelSmall : $theme.typography.ParagraphSmall);
|
|
194
|
+
});
|
|
195
|
+
StyledBadge.displayName = "StyledBadge";
|
|
196
|
+
export var StyledNotificationCircle = styled('div', function (_ref4) {
|
|
197
|
+
var $theme = _ref4.$theme,
|
|
198
|
+
_ref4$$color = _ref4.$color,
|
|
199
|
+
$color = _ref4$$color === void 0 ? COLOR.accent : _ref4$$color,
|
|
200
|
+
$hidden = _ref4.$hidden;
|
|
201
|
+
return _objectSpread(_objectSpread({
|
|
202
|
+
visibility: $hidden ? 'hidden' : 'inherit',
|
|
203
|
+
height: $theme.sizing.scale700,
|
|
204
|
+
width: $theme.sizing.scale700,
|
|
205
|
+
borderRadius: '20px',
|
|
206
|
+
display: 'inline-flex',
|
|
207
|
+
alignItems: 'center',
|
|
208
|
+
justifyContent: 'center'
|
|
209
|
+
}, getColorStyles({
|
|
210
|
+
$theme: $theme,
|
|
211
|
+
$hierarchy: HIERARCHY.primary,
|
|
212
|
+
$color: $color
|
|
213
|
+
})), $theme.typography.LabelXSmall);
|
|
214
|
+
});
|
|
215
|
+
StyledNotificationCircle.displayName = "StyledNotificationCircle";
|
|
216
|
+
export var StyledHintDot = styled('div', function (_ref5) {
|
|
217
|
+
var $theme = _ref5.$theme,
|
|
218
|
+
_ref5$$color = _ref5.$color,
|
|
219
|
+
$color = _ref5$$color === void 0 ? COLOR.accent : _ref5$$color,
|
|
220
|
+
$hidden = _ref5.$hidden;
|
|
221
|
+
return _objectSpread({
|
|
222
|
+
visibility: $hidden ? 'hidden' : 'inherit',
|
|
223
|
+
backgroundColor: $theme.colors[$color],
|
|
224
|
+
boxSizing: 'content-box',
|
|
225
|
+
height: '8px',
|
|
226
|
+
width: '8px',
|
|
227
|
+
borderRadius: '50%',
|
|
228
|
+
border: "4px solid ".concat($theme.colors.backgroundPrimary)
|
|
229
|
+
}, getColorStyles({
|
|
230
|
+
$theme: $theme,
|
|
231
|
+
$hierarchy: HIERARCHY.primary,
|
|
232
|
+
$color: $color
|
|
233
|
+
}));
|
|
234
|
+
});
|
|
235
|
+
StyledHintDot.displayName = "StyledHintDot";
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
import * as React from 'react';
|
|
8
|
+
import { HIERARCHY, SHAPE, COLOR, PLACEMENT, ROLE } from './constants.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
import * as React from 'react';
|
|
8
|
+
export var getAnchorFromChildren = function getAnchorFromChildren(children) {
|
|
9
|
+
var childArray = React.Children.toArray(children);
|
|
10
|
+
|
|
11
|
+
if (childArray.length !== 1) {
|
|
12
|
+
// eslint-disable-next-line no-console
|
|
13
|
+
console.error("[baseui] No more than 1 child may be passed to Badge, found ".concat(childArray.length, " children"));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return childArray[0];
|
|
17
|
+
};
|
|
@@ -0,0 +1,271 @@
|
|
|
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
|
|
5
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
10
|
+
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
12
|
+
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
Copyright (c) Uber Technologies, Inc.
|
|
17
|
+
|
|
18
|
+
This source code is licensed under the MIT license found in the
|
|
19
|
+
LICENSE file in the root directory of this source tree.
|
|
20
|
+
*/
|
|
21
|
+
import * as React from 'react';
|
|
22
|
+
import { Button, SIZE as BUTTON_SIZE, SHAPE as BUTTON_SHAPE } from '../button/index.js';
|
|
23
|
+
import { getOverrides } from '../helpers/overrides.js';
|
|
24
|
+
import { useStyletron } from '../styles/index.js';
|
|
25
|
+
import { ACTION_POSITION, ARTWORK_TYPE, HIERARCHY, KIND } from './constants.js';
|
|
26
|
+
import { StyledRoot, StyledLeadingContent, StyledMessageContent, StyledTitle, StyledMessage, StyledBelowContent, StyledTrailingContent, StyledTrailingButtonContainer, StyledTrailingIconButton } from './styled-components.js';
|
|
27
|
+
|
|
28
|
+
function low(theme, kind) {
|
|
29
|
+
switch (kind) {
|
|
30
|
+
case KIND.negative:
|
|
31
|
+
return {
|
|
32
|
+
actionBackgroundColor: theme.colors.bannerActionLowNegative,
|
|
33
|
+
backgroundColor: theme.colors.backgroundLightNegative,
|
|
34
|
+
color: theme.colors.contentPrimary
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
case KIND.positive:
|
|
38
|
+
return {
|
|
39
|
+
actionBackgroundColor: theme.colors.bannerActionLowPositive,
|
|
40
|
+
backgroundColor: theme.colors.backgroundLightPositive,
|
|
41
|
+
color: theme.colors.contentPrimary
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
case KIND.warning:
|
|
45
|
+
return {
|
|
46
|
+
actionBackgroundColor: theme.colors.bannerActionLowWarning,
|
|
47
|
+
backgroundColor: theme.colors.backgroundLightWarning,
|
|
48
|
+
color: theme.colors.contentPrimary
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
case KIND.info:
|
|
52
|
+
default:
|
|
53
|
+
return {
|
|
54
|
+
actionBackgroundColor: theme.colors.bannerActionLowInfo,
|
|
55
|
+
backgroundColor: theme.colors.backgroundLightAccent,
|
|
56
|
+
color: theme.colors.contentPrimary
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function high(theme, kind) {
|
|
62
|
+
switch (kind) {
|
|
63
|
+
case KIND.negative:
|
|
64
|
+
return {
|
|
65
|
+
actionBackgroundColor: theme.colors.bannerActionHighNegative,
|
|
66
|
+
backgroundColor: theme.colors.backgroundNegative,
|
|
67
|
+
color: theme.colors.contentOnColor
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
case KIND.positive:
|
|
71
|
+
return {
|
|
72
|
+
actionBackgroundColor: theme.colors.bannerActionHighPositive,
|
|
73
|
+
backgroundColor: theme.colors.backgroundPositive,
|
|
74
|
+
color: theme.colors.contentOnColor
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
case KIND.warning:
|
|
78
|
+
return {
|
|
79
|
+
actionBackgroundColor: theme.colors.bannerActionHighWarning,
|
|
80
|
+
backgroundColor: theme.colors.backgroundWarning,
|
|
81
|
+
color: theme.colors.contentPrimary
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
case KIND.info:
|
|
85
|
+
default:
|
|
86
|
+
return {
|
|
87
|
+
actionBackgroundColor: theme.colors.bannerActionHighInfo,
|
|
88
|
+
backgroundColor: theme.colors.backgroundAccent,
|
|
89
|
+
color: theme.colors.contentOnColor
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function Leading(_ref) {
|
|
95
|
+
var artwork = _ref.artwork;
|
|
96
|
+
|
|
97
|
+
var _useStyletron = useStyletron(),
|
|
98
|
+
_useStyletron2 = _slicedToArray(_useStyletron, 2),
|
|
99
|
+
theme = _useStyletron2[1];
|
|
100
|
+
|
|
101
|
+
if (!artwork) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
var size = artwork.type === ARTWORK_TYPE.badge ? theme.sizing.scale1000 : theme.sizing.scale800;
|
|
106
|
+
return artwork.icon({
|
|
107
|
+
size: size
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function Below(_ref2) {
|
|
112
|
+
var action = _ref2.action,
|
|
113
|
+
backgroundColor = _ref2.backgroundColor,
|
|
114
|
+
color = _ref2.color;
|
|
115
|
+
|
|
116
|
+
if (!action || action.position !== ACTION_POSITION.below) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (process.env.NODE_ENV !== "production") {
|
|
121
|
+
if (action.icon) {
|
|
122
|
+
console.error('Banner ACTION_POSITION.below must not have an icon.');
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (action.label) {
|
|
128
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
129
|
+
colors: {
|
|
130
|
+
backgroundColor: backgroundColor,
|
|
131
|
+
color: color
|
|
132
|
+
},
|
|
133
|
+
onClick: action.onClick,
|
|
134
|
+
size: BUTTON_SIZE.compact,
|
|
135
|
+
shape: BUTTON_SHAPE.pill
|
|
136
|
+
}, action.label);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function Trailing(_ref3) {
|
|
143
|
+
var action = _ref3.action,
|
|
144
|
+
backgroundColor = _ref3.backgroundColor,
|
|
145
|
+
color = _ref3.color,
|
|
146
|
+
overrides = _ref3.overrides,
|
|
147
|
+
nested = _ref3.nested;
|
|
148
|
+
|
|
149
|
+
var _useStyletron3 = useStyletron(),
|
|
150
|
+
_useStyletron4 = _slicedToArray(_useStyletron3, 2),
|
|
151
|
+
theme = _useStyletron4[1];
|
|
152
|
+
|
|
153
|
+
if (!action || action.position && action.position !== ACTION_POSITION.trailing) {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
var _getOverrides = getOverrides(overrides.TrailingIconButton, StyledTrailingIconButton),
|
|
158
|
+
_getOverrides2 = _slicedToArray(_getOverrides, 2),
|
|
159
|
+
TrailingIconButton = _getOverrides2[0],
|
|
160
|
+
trailingIconButtonProps = _getOverrides2[1];
|
|
161
|
+
|
|
162
|
+
if (action.icon) {
|
|
163
|
+
return /*#__PURE__*/React.createElement(TrailingIconButton, _extends({
|
|
164
|
+
"aria-label": action.label,
|
|
165
|
+
onClick: action.onClick,
|
|
166
|
+
$nested: nested
|
|
167
|
+
}, trailingIconButtonProps), action.icon({
|
|
168
|
+
size: theme.sizing.scale650
|
|
169
|
+
}));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
var _getOverrides3 = getOverrides(overrides.TrailingButtonContainer, StyledTrailingButtonContainer),
|
|
173
|
+
_getOverrides4 = _slicedToArray(_getOverrides3, 2),
|
|
174
|
+
TrailingButtonContainer = _getOverrides4[0],
|
|
175
|
+
trailingButtonContainerProps = _getOverrides4[1];
|
|
176
|
+
|
|
177
|
+
if (action.label) {
|
|
178
|
+
return /*#__PURE__*/React.createElement(TrailingButtonContainer, trailingButtonContainerProps, /*#__PURE__*/React.createElement(Button, {
|
|
179
|
+
colors: {
|
|
180
|
+
backgroundColor: backgroundColor,
|
|
181
|
+
color: color
|
|
182
|
+
},
|
|
183
|
+
onClick: action.onClick,
|
|
184
|
+
size: BUTTON_SIZE.compact,
|
|
185
|
+
shape: BUTTON_SHAPE.pill
|
|
186
|
+
}, action.label));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export function Banner(_ref4) {
|
|
193
|
+
var action = _ref4.action,
|
|
194
|
+
artwork = _ref4.artwork,
|
|
195
|
+
children = _ref4.children,
|
|
196
|
+
_ref4$hierarchy = _ref4.hierarchy,
|
|
197
|
+
hierarchy = _ref4$hierarchy === void 0 ? HIERARCHY.low : _ref4$hierarchy,
|
|
198
|
+
_ref4$kind = _ref4.kind,
|
|
199
|
+
kind = _ref4$kind === void 0 ? KIND.info : _ref4$kind,
|
|
200
|
+
_ref4$overrides = _ref4.overrides,
|
|
201
|
+
overrides = _ref4$overrides === void 0 ? {} : _ref4$overrides,
|
|
202
|
+
_ref4$nested = _ref4.nested,
|
|
203
|
+
nested = _ref4$nested === void 0 ? false : _ref4$nested,
|
|
204
|
+
title = _ref4.title;
|
|
205
|
+
|
|
206
|
+
var _useStyletron5 = useStyletron(),
|
|
207
|
+
_useStyletron6 = _slicedToArray(_useStyletron5, 2),
|
|
208
|
+
theme = _useStyletron6[1];
|
|
209
|
+
|
|
210
|
+
var styles = hierarchy === HIERARCHY.high ? high(theme, kind) : low(theme, kind);
|
|
211
|
+
var actionPosition = action && action.position ? action.position : ACTION_POSITION.trailing;
|
|
212
|
+
|
|
213
|
+
var _getOverrides5 = getOverrides(overrides.Root, StyledRoot),
|
|
214
|
+
_getOverrides6 = _slicedToArray(_getOverrides5, 2),
|
|
215
|
+
Root = _getOverrides6[0],
|
|
216
|
+
rootProps = _getOverrides6[1];
|
|
217
|
+
|
|
218
|
+
var _getOverrides7 = getOverrides(overrides.LeadingContent, StyledLeadingContent),
|
|
219
|
+
_getOverrides8 = _slicedToArray(_getOverrides7, 2),
|
|
220
|
+
LeadingContent = _getOverrides8[0],
|
|
221
|
+
leadingContentProps = _getOverrides8[1];
|
|
222
|
+
|
|
223
|
+
var _getOverrides9 = getOverrides(overrides.MessageContent, StyledMessageContent),
|
|
224
|
+
_getOverrides10 = _slicedToArray(_getOverrides9, 2),
|
|
225
|
+
MessageContent = _getOverrides10[0],
|
|
226
|
+
messageContentProps = _getOverrides10[1];
|
|
227
|
+
|
|
228
|
+
var _getOverrides11 = getOverrides(overrides.TrailingContent, StyledTrailingContent),
|
|
229
|
+
_getOverrides12 = _slicedToArray(_getOverrides11, 2),
|
|
230
|
+
TrailingContent = _getOverrides12[0],
|
|
231
|
+
trailingContentProps = _getOverrides12[1];
|
|
232
|
+
|
|
233
|
+
var _getOverrides13 = getOverrides(overrides.BelowContent, StyledBelowContent),
|
|
234
|
+
_getOverrides14 = _slicedToArray(_getOverrides13, 2),
|
|
235
|
+
BelowContent = _getOverrides14[0],
|
|
236
|
+
belowContentProps = _getOverrides14[1];
|
|
237
|
+
|
|
238
|
+
var _getOverrides15 = getOverrides(overrides.Title, StyledTitle),
|
|
239
|
+
_getOverrides16 = _slicedToArray(_getOverrides15, 2),
|
|
240
|
+
Title = _getOverrides16[0],
|
|
241
|
+
titleProps = _getOverrides16[1];
|
|
242
|
+
|
|
243
|
+
var _getOverrides17 = getOverrides(overrides.Message, StyledMessage),
|
|
244
|
+
_getOverrides18 = _slicedToArray(_getOverrides17, 2),
|
|
245
|
+
Message = _getOverrides18[0],
|
|
246
|
+
messageProps = _getOverrides18[1];
|
|
247
|
+
|
|
248
|
+
return /*#__PURE__*/React.createElement(Root, _extends({
|
|
249
|
+
$backgroundColor: styles.backgroundColor,
|
|
250
|
+
$color: styles.color,
|
|
251
|
+
$nested: nested
|
|
252
|
+
}, rootProps), /*#__PURE__*/React.createElement(LeadingContent, _extends({
|
|
253
|
+
$includesArtwork: Boolean(artwork)
|
|
254
|
+
}, leadingContentProps), /*#__PURE__*/React.createElement(Leading, {
|
|
255
|
+
artwork: artwork
|
|
256
|
+
})), /*#__PURE__*/React.createElement(MessageContent, _extends({
|
|
257
|
+
$actionPosition: actionPosition
|
|
258
|
+
}, messageContentProps), Boolean(title) && /*#__PURE__*/React.createElement(Title, titleProps, title), Boolean(children) && /*#__PURE__*/React.createElement(Message, messageProps, children)), /*#__PURE__*/React.createElement(TrailingContent, trailingContentProps, /*#__PURE__*/React.createElement(Trailing, {
|
|
259
|
+
action: action,
|
|
260
|
+
backgroundColor: styles.actionBackgroundColor,
|
|
261
|
+
color: styles.color,
|
|
262
|
+
overrides: overrides,
|
|
263
|
+
nested: nested
|
|
264
|
+
})), /*#__PURE__*/React.createElement(BelowContent, _extends({
|
|
265
|
+
$actionPosition: actionPosition
|
|
266
|
+
}, belowContentProps), /*#__PURE__*/React.createElement(Below, {
|
|
267
|
+
action: action,
|
|
268
|
+
backgroundColor: styles.actionBackgroundColor,
|
|
269
|
+
color: styles.color
|
|
270
|
+
})));
|
|
271
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 var ACTION_POSITION = Object.freeze({
|
|
8
|
+
below: 'below',
|
|
9
|
+
trailing: 'trailing'
|
|
10
|
+
});
|
|
11
|
+
export var ARTWORK_TYPE = Object.freeze({
|
|
12
|
+
icon: 'icon',
|
|
13
|
+
badge: 'badge'
|
|
14
|
+
});
|
|
15
|
+
export var HIERARCHY = Object.freeze({
|
|
16
|
+
low: 'low',
|
|
17
|
+
high: 'high'
|
|
18
|
+
});
|
|
19
|
+
export var KIND = Object.freeze({
|
|
20
|
+
info: 'info',
|
|
21
|
+
negative: 'negative',
|
|
22
|
+
positive: 'positive',
|
|
23
|
+
warning: 'warning'
|
|
24
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
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 { Banner } from './banner.js';
|
|
8
|
+
export * from './constants.js';
|
|
9
|
+
export * from './styled-components.js';
|
|
@@ -0,0 +1,113 @@
|
|
|
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
|
+
import { styled } from '../styles/index.js';
|
|
8
|
+
import { ACTION_POSITION } from './constants.js';
|
|
9
|
+
export var StyledRoot = styled('div', function (_ref) {
|
|
10
|
+
var $theme = _ref.$theme,
|
|
11
|
+
$backgroundColor = _ref.$backgroundColor,
|
|
12
|
+
$color = _ref.$color,
|
|
13
|
+
$nested = _ref.$nested;
|
|
14
|
+
var radius = $nested ? $theme.borders.radius300 : $theme.borders.radius400;
|
|
15
|
+
return {
|
|
16
|
+
backgroundColor: $backgroundColor,
|
|
17
|
+
borderStartStartRadius: radius,
|
|
18
|
+
borderStartEndRadius: radius,
|
|
19
|
+
borderEndStartRadius: radius,
|
|
20
|
+
borderEndEndRadius: radius,
|
|
21
|
+
color: $color,
|
|
22
|
+
display: 'grid',
|
|
23
|
+
gridColumnGap: $theme.sizing.scale600,
|
|
24
|
+
gridTemplateColumns: 'min-content auto min-content',
|
|
25
|
+
gridTemplateRows: 'auto min-content',
|
|
26
|
+
margin: $theme.sizing.scale600
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
StyledRoot.displayName = "StyledRoot";
|
|
30
|
+
export var StyledLeadingContent = styled('div', function (_ref2) {
|
|
31
|
+
var $theme = _ref2.$theme,
|
|
32
|
+
$includesArtwork = _ref2.$includesArtwork;
|
|
33
|
+
return {
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
display: 'flex',
|
|
36
|
+
paddingInlineStart: $includesArtwork ? $theme.sizing.scale600 : null
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
StyledLeadingContent.displayName = "StyledLeadingContent";
|
|
40
|
+
export var StyledMessageContent = styled('div', function (_ref3) {
|
|
41
|
+
var $theme = _ref3.$theme,
|
|
42
|
+
$actionPosition = _ref3.$actionPosition;
|
|
43
|
+
return {
|
|
44
|
+
display: 'flex',
|
|
45
|
+
flexDirection: 'column',
|
|
46
|
+
justifyContent: 'center',
|
|
47
|
+
paddingBlockStart: $theme.sizing.scale600,
|
|
48
|
+
paddingBlockEnd: $actionPosition === ACTION_POSITION.trailing ? $theme.sizing.scale600 : null
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
StyledMessageContent.displayName = "StyledMessageContent";
|
|
52
|
+
export var StyledTrailingContent = styled('div', function (_ref4) {
|
|
53
|
+
var $theme = _ref4.$theme;
|
|
54
|
+
return {
|
|
55
|
+
display: 'flex',
|
|
56
|
+
gridRowEnd: 'span 2',
|
|
57
|
+
marginInlineStart: 'auto'
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
StyledTrailingContent.displayName = "StyledTrailingContent";
|
|
61
|
+
export var StyledBelowContent = styled('div', function (_ref5) {
|
|
62
|
+
var $theme = _ref5.$theme,
|
|
63
|
+
$actionPosition = _ref5.$actionPosition;
|
|
64
|
+
return {
|
|
65
|
+
gridColumnStart: 2,
|
|
66
|
+
paddingBlockStart: $actionPosition === ACTION_POSITION.below ? $theme.sizing.scale300 : null,
|
|
67
|
+
paddingBlockEnd: $actionPosition === ACTION_POSITION.below ? $theme.sizing.scale600 : null
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
StyledBelowContent.displayName = "StyledBelowContent";
|
|
71
|
+
export var StyledTitle = styled('div', function (_ref6) {
|
|
72
|
+
var $theme = _ref6.$theme;
|
|
73
|
+
return $theme.typography.LabelMedium;
|
|
74
|
+
});
|
|
75
|
+
StyledTitle.displayName = "StyledTitle";
|
|
76
|
+
export var StyledMessage = styled('div', function (_ref7) {
|
|
77
|
+
var $theme = _ref7.$theme;
|
|
78
|
+
return $theme.typography.ParagraphMedium;
|
|
79
|
+
});
|
|
80
|
+
StyledMessage.displayName = "StyledMessage";
|
|
81
|
+
export var StyledTrailingButtonContainer = styled('div', function (_ref8) {
|
|
82
|
+
var $theme = _ref8.$theme;
|
|
83
|
+
return {
|
|
84
|
+
display: 'flex',
|
|
85
|
+
alignItems: 'center',
|
|
86
|
+
paddingInlineEnd: $theme.sizing.scale600
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
StyledTrailingButtonContainer.displayName = "StyledTrailingButtonContainer";
|
|
90
|
+
export var StyledTrailingIconButton = styled('button', function (_ref9) {
|
|
91
|
+
var $theme = _ref9.$theme,
|
|
92
|
+
$nested = _ref9.$nested;
|
|
93
|
+
var radius = $nested ? $theme.borders.radius300 : $theme.borders.radius400;
|
|
94
|
+
return {
|
|
95
|
+
alignItems: 'center',
|
|
96
|
+
background: 'none',
|
|
97
|
+
border: 'none',
|
|
98
|
+
borderStartEndRadius: radius,
|
|
99
|
+
borderEndEndRadius: radius,
|
|
100
|
+
color: 'inherit',
|
|
101
|
+
cursor: 'pointer',
|
|
102
|
+
display: 'flex',
|
|
103
|
+
paddingInlineStart: $theme.sizing.scale600,
|
|
104
|
+
paddingInlineEnd: $theme.sizing.scale600,
|
|
105
|
+
':hover': {
|
|
106
|
+
boxShadow: 'inset 999px 999px 0px rgba(0, 0, 0, 0.04)'
|
|
107
|
+
},
|
|
108
|
+
':active': {
|
|
109
|
+
boxShadow: 'inset 999px 999px 0px rgba(0, 0, 0, 0.08)'
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
StyledTrailingIconButton.displayName = "StyledTrailingIconButton";
|