baseui 11.0.3 → 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/index.d.ts +42 -63
- 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/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 +42 -23
- 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/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 +79 -59
- 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 -99
- 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 +33 -36
- package/select/select-component.js +76 -56
- package/select/select-component.js.flow +39 -32
- 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/spinner/index.d.ts +2 -2
- 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/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
package/badge/index.d.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StyletronComponent } from 'styletron-react';
|
|
3
|
+
import { Override } from '../overrides';
|
|
4
|
+
|
|
5
|
+
export interface HIERARCHY {
|
|
6
|
+
primary: 'primary';
|
|
7
|
+
secondary: 'secondary';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface SHAPE {
|
|
11
|
+
pill: 'pill';
|
|
12
|
+
rectangle: 'rectangle';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface COLOR {
|
|
16
|
+
accent: 'accent';
|
|
17
|
+
primary: 'primary';
|
|
18
|
+
positive: 'positive';
|
|
19
|
+
negative: 'negative';
|
|
20
|
+
warning: 'warning';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface PLACEMENT {
|
|
24
|
+
topLeft: 'topLeft';
|
|
25
|
+
topRight: 'topRight';
|
|
26
|
+
bottomRight: 'bottomRight';
|
|
27
|
+
bottomLeft: 'bottomLeft';
|
|
28
|
+
topLeftEdge: 'topLeftEdge';
|
|
29
|
+
topEdge: 'topEdge';
|
|
30
|
+
topRightEdge: 'topRightEdge';
|
|
31
|
+
bottomRightEdge: 'bottomRightEdge';
|
|
32
|
+
bottomEdge: 'bottomEdge';
|
|
33
|
+
bottomLeftEdge: 'bottomLeftEdge';
|
|
34
|
+
leftTopEdge: 'leftTopEdge';
|
|
35
|
+
rightTopEdge: 'rightTopEdge';
|
|
36
|
+
rightBottomEdge: 'rightBottomEdge';
|
|
37
|
+
leftBottomEdge: 'leftBottomEdge';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type HierarchyT = HIERARCHY[keyof HIERARCHY];
|
|
41
|
+
export type ShapeT = SHAPE[keyof SHAPE];
|
|
42
|
+
export type ColorT = COLOR[keyof COLOR];
|
|
43
|
+
export type PlacementT = PLACEMENT[keyof PLACEMENT];
|
|
44
|
+
|
|
45
|
+
export type BadgeOverridesT = {
|
|
46
|
+
Root?: Override<any>;
|
|
47
|
+
Positioner?: Override<any>;
|
|
48
|
+
Badge?: Override<any>;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export type BadgePropsT = {
|
|
52
|
+
content: React.ReactNode;
|
|
53
|
+
hierarchy?: HierarchyT;
|
|
54
|
+
shape?: ShapeT;
|
|
55
|
+
color?: ColorT;
|
|
56
|
+
placement?: PlacementT;
|
|
57
|
+
hidden?: boolean;
|
|
58
|
+
horizontalOffset?: string;
|
|
59
|
+
verticalOffset?: string;
|
|
60
|
+
overrides?: BadgeOverridesT;
|
|
61
|
+
children?: React.ReactNode;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export type NotificationCirclePropsT = {
|
|
65
|
+
content: React.ReactNode;
|
|
66
|
+
color?: ColorT;
|
|
67
|
+
placement?: PlacementT;
|
|
68
|
+
hidden?: boolean;
|
|
69
|
+
horizontalOffset?: string;
|
|
70
|
+
verticalOffset?: string;
|
|
71
|
+
overrides?: BadgeOverridesT;
|
|
72
|
+
children?: React.ReactNode;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export type HintDotPropsT = {
|
|
76
|
+
color?: ColorT;
|
|
77
|
+
hidden?: boolean;
|
|
78
|
+
horizontalOffset?: string;
|
|
79
|
+
verticalOffset?: string;
|
|
80
|
+
overrides?: BadgeOverridesT;
|
|
81
|
+
children?: React.ReactNode;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const StyledRoot: StyletronComponent<any>;
|
|
85
|
+
export const StyledPositioner: StyletronComponent<any>;
|
|
86
|
+
export const StyledBadge: StyletronComponent<any>;
|
|
87
|
+
export const StyledNotificationCircle: StyletronComponent<any>;
|
|
88
|
+
export const StyledHintDot: StyletronComponent<any>;
|
|
89
|
+
|
|
90
|
+
export const Badge: React.FC<BadgePropsT>;
|
|
91
|
+
export const NotificationCircle: React.FC<NotificationCirclePropsT>;
|
|
92
|
+
export const HintDot: React.FC<HintDotPropsT>;
|
|
93
|
+
|
|
94
|
+
export const HIERARCHY: HIERARCHY;
|
|
95
|
+
export const SHAPE: SHAPE;
|
|
96
|
+
export const COLOR: COLOR;
|
|
97
|
+
export const PLACEMENT: PLACEMENT;
|
package/badge/index.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
Badge: true,
|
|
8
|
+
NotificationCircle: true,
|
|
9
|
+
HintDot: true,
|
|
10
|
+
HIERARCHY: true,
|
|
11
|
+
SHAPE: true,
|
|
12
|
+
COLOR: true,
|
|
13
|
+
PLACEMENT: true
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "Badge", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function get() {
|
|
18
|
+
return _badge.default;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "NotificationCircle", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return _notificationCircle.default;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports, "HintDot", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function get() {
|
|
30
|
+
return _hintDot.default;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "HIERARCHY", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function get() {
|
|
36
|
+
return _constants.HIERARCHY;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, "SHAPE", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function get() {
|
|
42
|
+
return _constants.SHAPE;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
Object.defineProperty(exports, "COLOR", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function get() {
|
|
48
|
+
return _constants.COLOR;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(exports, "PLACEMENT", {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function get() {
|
|
54
|
+
return _constants.PLACEMENT;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
var _badge = _interopRequireDefault(require("./badge.js"));
|
|
59
|
+
|
|
60
|
+
var _notificationCircle = _interopRequireDefault(require("./notification-circle.js"));
|
|
61
|
+
|
|
62
|
+
var _hintDot = _interopRequireDefault(require("./hint-dot.js"));
|
|
63
|
+
|
|
64
|
+
var _constants = require("./constants.js");
|
|
65
|
+
|
|
66
|
+
var _styledComponents = require("./styled-components.js");
|
|
67
|
+
|
|
68
|
+
Object.keys(_styledComponents).forEach(function (key) {
|
|
69
|
+
if (key === "default" || key === "__esModule") return;
|
|
70
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
71
|
+
if (key in exports && exports[key] === _styledComponents[key]) return;
|
|
72
|
+
Object.defineProperty(exports, key, {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function get() {
|
|
75
|
+
return _styledComponents[key];
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
// @flow
|
|
8
|
+
export { default as Badge } from './badge.js';
|
|
9
|
+
export { default as NotificationCircle } from './notification-circle.js';
|
|
10
|
+
export { default as HintDot } from './hint-dot.js';
|
|
11
|
+
|
|
12
|
+
export { HIERARCHY, SHAPE, COLOR, PLACEMENT } from './constants.js';
|
|
13
|
+
|
|
14
|
+
export * from './styled-components.js';
|
|
15
|
+
|
|
16
|
+
export type * from './types.js';
|
|
17
|
+
|
|
18
|
+
declare var __DEV__: boolean;
|
|
19
|
+
declare var __NODE__: boolean;
|
|
20
|
+
declare var __BROWSER__: boolean;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _overrides = require("../helpers/overrides.js");
|
|
13
|
+
|
|
14
|
+
var _styledComponents = require("./styled-components.js");
|
|
15
|
+
|
|
16
|
+
var _constants = require("./constants.js");
|
|
17
|
+
|
|
18
|
+
var _utils = require("./utils.js");
|
|
19
|
+
|
|
20
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
21
|
+
|
|
22
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
|
|
24
|
+
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); }
|
|
25
|
+
|
|
26
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
+
|
|
28
|
+
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."); }
|
|
29
|
+
|
|
30
|
+
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); }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
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; }
|
|
35
|
+
|
|
36
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
|
+
|
|
38
|
+
var NotificationCircle = function NotificationCircle(_ref) {
|
|
39
|
+
var children = _ref.children,
|
|
40
|
+
contentProp = _ref.content,
|
|
41
|
+
color = _ref.color,
|
|
42
|
+
_ref$placement = _ref.placement,
|
|
43
|
+
placement = _ref$placement === void 0 ? _constants.PLACEMENT.topRight : _ref$placement,
|
|
44
|
+
horizontalOffset = _ref.horizontalOffset,
|
|
45
|
+
verticalOffset = _ref.verticalOffset,
|
|
46
|
+
hidden = _ref.hidden,
|
|
47
|
+
_ref$overrides = _ref.overrides,
|
|
48
|
+
overrides = _ref$overrides === void 0 ? {} : _ref$overrides;
|
|
49
|
+
|
|
50
|
+
var _getOverrides = (0, _overrides.getOverrides)(overrides.Badge, _styledComponents.StyledNotificationCircle),
|
|
51
|
+
_getOverrides2 = _slicedToArray(_getOverrides, 2),
|
|
52
|
+
NotificationCircle = _getOverrides2[0],
|
|
53
|
+
NotificationCircleProps = _getOverrides2[1];
|
|
54
|
+
|
|
55
|
+
var _getOverrides3 = (0, _overrides.getOverrides)(overrides.Root, _styledComponents.StyledRoot),
|
|
56
|
+
_getOverrides4 = _slicedToArray(_getOverrides3, 2),
|
|
57
|
+
Root = _getOverrides4[0],
|
|
58
|
+
rootProps = _getOverrides4[1];
|
|
59
|
+
|
|
60
|
+
var _getOverrides5 = (0, _overrides.getOverrides)(overrides.Positioner, _styledComponents.StyledPositioner),
|
|
61
|
+
_getOverrides6 = _slicedToArray(_getOverrides5, 2),
|
|
62
|
+
Positioner = _getOverrides6[0],
|
|
63
|
+
positionerProps = _getOverrides6[1];
|
|
64
|
+
|
|
65
|
+
var anchor = (0, _utils.getAnchorFromChildren)(children);
|
|
66
|
+
|
|
67
|
+
if (process.env.NODE_ENV !== "production") {
|
|
68
|
+
if (typeof contentProp === 'string') {
|
|
69
|
+
console.error("[baseui] NotificationCircle child must be number or icon, found string");
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (placement && placement !== _constants.PLACEMENT.topLeft && placement !== _constants.PLACEMENT.topRight) {
|
|
73
|
+
console.error("[baseui] NotificationCircle must be placed topLeft or topRight, found ".concat(placement));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
var content = contentProp;
|
|
78
|
+
|
|
79
|
+
if (typeof content === 'number' && content > 9) {
|
|
80
|
+
content = '9+';
|
|
81
|
+
} // If there's no anchor, render the badge inline
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
if (!anchor) {
|
|
85
|
+
return /*#__PURE__*/React.createElement(NotificationCircle, _extends({
|
|
86
|
+
$color: color,
|
|
87
|
+
$hidden: hidden
|
|
88
|
+
}, NotificationCircleProps), content);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return /*#__PURE__*/React.createElement(Root, rootProps, anchor, /*#__PURE__*/React.createElement(Positioner, _extends({
|
|
92
|
+
$horizontalOffset: horizontalOffset,
|
|
93
|
+
$verticalOffset: verticalOffset,
|
|
94
|
+
$placement: placement,
|
|
95
|
+
$role: _constants.ROLE.notificationCircle
|
|
96
|
+
}, positionerProps), /*#__PURE__*/React.createElement(NotificationCircle, _extends({}, NotificationCircleProps, {
|
|
97
|
+
$color: color,
|
|
98
|
+
$hidden: hidden
|
|
99
|
+
}), content)));
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
var _default = NotificationCircle;
|
|
103
|
+
exports.default = _default;
|
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
// @flow
|
|
8
|
+
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import { getOverrides } from '../helpers/overrides.js';
|
|
11
|
+
import { StyledNotificationCircle, StyledRoot, StyledPositioner } from './styled-components.js';
|
|
12
|
+
import type { NotificationCirclePropsT } from './types.js';
|
|
13
|
+
import { PLACEMENT, ROLE } from './constants.js';
|
|
14
|
+
import { getAnchorFromChildren } from './utils.js';
|
|
15
|
+
|
|
16
|
+
const NotificationCircle = ({
|
|
17
|
+
children,
|
|
18
|
+
content: contentProp,
|
|
19
|
+
color,
|
|
20
|
+
placement = PLACEMENT.topRight,
|
|
21
|
+
horizontalOffset,
|
|
22
|
+
verticalOffset,
|
|
23
|
+
hidden,
|
|
24
|
+
overrides = {},
|
|
25
|
+
}: NotificationCirclePropsT) => {
|
|
26
|
+
const [NotificationCircle, NotificationCircleProps] = getOverrides(
|
|
27
|
+
overrides.Badge,
|
|
28
|
+
StyledNotificationCircle
|
|
29
|
+
);
|
|
30
|
+
const [Root, rootProps] = getOverrides(overrides.Root, StyledRoot);
|
|
31
|
+
const [Positioner, positionerProps] = getOverrides(overrides.Positioner, StyledPositioner);
|
|
32
|
+
|
|
33
|
+
const anchor = getAnchorFromChildren(children);
|
|
34
|
+
|
|
35
|
+
if (__DEV__) {
|
|
36
|
+
if (typeof contentProp === 'string') {
|
|
37
|
+
console.error(`[baseui] NotificationCircle child must be number or icon, found string`);
|
|
38
|
+
}
|
|
39
|
+
if (placement && placement !== PLACEMENT.topLeft && placement !== PLACEMENT.topRight) {
|
|
40
|
+
console.error(
|
|
41
|
+
`[baseui] NotificationCircle must be placed topLeft or topRight, found ${placement}`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let content = contentProp;
|
|
47
|
+
if (typeof content === 'number' && content > 9) {
|
|
48
|
+
content = '9+';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// If there's no anchor, render the badge inline
|
|
52
|
+
if (!anchor) {
|
|
53
|
+
return (
|
|
54
|
+
<NotificationCircle $color={color} $hidden={hidden} {...NotificationCircleProps}>
|
|
55
|
+
{content}
|
|
56
|
+
</NotificationCircle>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Root {...rootProps}>
|
|
62
|
+
{anchor}
|
|
63
|
+
<Positioner
|
|
64
|
+
$horizontalOffset={horizontalOffset}
|
|
65
|
+
$verticalOffset={verticalOffset}
|
|
66
|
+
$placement={placement}
|
|
67
|
+
$role={ROLE.notificationCircle}
|
|
68
|
+
{...positionerProps}
|
|
69
|
+
>
|
|
70
|
+
<NotificationCircle {...NotificationCircleProps} $color={color} $hidden={hidden}>
|
|
71
|
+
{content}
|
|
72
|
+
</NotificationCircle>
|
|
73
|
+
</Positioner>
|
|
74
|
+
</Root>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
export default NotificationCircle;
|
|
78
|
+
|
|
79
|
+
declare var __DEV__: boolean;
|
|
80
|
+
declare var __NODE__: boolean;
|
|
81
|
+
declare var __BROWSER__: boolean;
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledHintDot = exports.StyledNotificationCircle = exports.StyledBadge = exports.StyledPositioner = exports.StyledRoot = void 0;
|
|
7
|
+
|
|
8
|
+
var _index = require("../styles/index.js");
|
|
9
|
+
|
|
10
|
+
var _constants = require("./constants.js");
|
|
11
|
+
|
|
12
|
+
var _ROLE$badge, _ROLE$notificationCir, _ROLE$hintDot, _Object$freeze;
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
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; }
|
|
19
|
+
|
|
20
|
+
function getColorStyles(_ref) {
|
|
21
|
+
var _HIERARCHY$primary, _HIERARCHY$secondary, _COLOR_STYLES;
|
|
22
|
+
|
|
23
|
+
var $theme = _ref.$theme,
|
|
24
|
+
$hierarchy = _ref.$hierarchy,
|
|
25
|
+
$color = _ref.$color;
|
|
26
|
+
var COLOR_STYLES = (_COLOR_STYLES = {}, _defineProperty(_COLOR_STYLES, _constants.HIERARCHY.primary, (_HIERARCHY$primary = {}, _defineProperty(_HIERARCHY$primary, _constants.COLOR.accent, {
|
|
27
|
+
color: $theme.colors.contentInversePrimary,
|
|
28
|
+
backgroundColor: $theme.colors.backgroundAccent
|
|
29
|
+
}), _defineProperty(_HIERARCHY$primary, _constants.COLOR.primary, {
|
|
30
|
+
color: $theme.colors.contentInversePrimary,
|
|
31
|
+
backgroundColor: $theme.colors.backgroundInversePrimary
|
|
32
|
+
}), _defineProperty(_HIERARCHY$primary, _constants.COLOR.positive, {
|
|
33
|
+
color: $theme.colors.contentInversePrimary,
|
|
34
|
+
backgroundColor: $theme.colors.backgroundPositive
|
|
35
|
+
}), _defineProperty(_HIERARCHY$primary, _constants.COLOR.negative, {
|
|
36
|
+
color: $theme.colors.contentInversePrimary,
|
|
37
|
+
backgroundColor: $theme.colors.backgroundNegative
|
|
38
|
+
}), _defineProperty(_HIERARCHY$primary, _constants.COLOR.warning, {
|
|
39
|
+
color: $theme.colors.primaryA,
|
|
40
|
+
backgroundColor: $theme.colors.backgroundWarning
|
|
41
|
+
}), _HIERARCHY$primary)), _defineProperty(_COLOR_STYLES, _constants.HIERARCHY.secondary, (_HIERARCHY$secondary = {}, _defineProperty(_HIERARCHY$secondary, _constants.COLOR.accent, {
|
|
42
|
+
color: $theme.colors.contentAccent,
|
|
43
|
+
backgroundColor: $theme.colors.backgroundLightAccent
|
|
44
|
+
}), _defineProperty(_HIERARCHY$secondary, _constants.COLOR.primary, {
|
|
45
|
+
color: $theme.colors.primaryA,
|
|
46
|
+
backgroundColor: $theme.colors.backgroundSecondary
|
|
47
|
+
}), _defineProperty(_HIERARCHY$secondary, _constants.COLOR.positive, {
|
|
48
|
+
color: $theme.colors.contentPositive,
|
|
49
|
+
backgroundColor: $theme.colors.backgroundLightPositive
|
|
50
|
+
}), _defineProperty(_HIERARCHY$secondary, _constants.COLOR.negative, {
|
|
51
|
+
color: $theme.colors.contentNegative,
|
|
52
|
+
backgroundColor: $theme.colors.backgroundLightNegative
|
|
53
|
+
}), _defineProperty(_HIERARCHY$secondary, _constants.COLOR.warning, {
|
|
54
|
+
color: $theme.colors.contentWarning,
|
|
55
|
+
backgroundColor: $theme.colors.backgroundLightWarning
|
|
56
|
+
}), _HIERARCHY$secondary)), _COLOR_STYLES);
|
|
57
|
+
return COLOR_STYLES[$hierarchy][$color];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT = {
|
|
61
|
+
top: '-10px',
|
|
62
|
+
right: '-10px'
|
|
63
|
+
};
|
|
64
|
+
var DEFAULT_HINT_DOT_PLACEMENT = {
|
|
65
|
+
top: '-4px',
|
|
66
|
+
right: '-4px'
|
|
67
|
+
};
|
|
68
|
+
var POSITION_STYLES = Object.freeze((_Object$freeze = {}, _defineProperty(_Object$freeze, _constants.ROLE.badge, (_ROLE$badge = {}, _defineProperty(_ROLE$badge, _constants.PLACEMENT.topEdge, {
|
|
69
|
+
top: '-8px',
|
|
70
|
+
left: '50%',
|
|
71
|
+
transform: 'translateX(-50%)'
|
|
72
|
+
}), _defineProperty(_ROLE$badge, _constants.PLACEMENT.bottomEdge, {
|
|
73
|
+
bottom: '-8px',
|
|
74
|
+
left: '50%',
|
|
75
|
+
transform: 'translateX(-50%)'
|
|
76
|
+
}), _defineProperty(_ROLE$badge, _constants.PLACEMENT.topLeft, {
|
|
77
|
+
top: '16px',
|
|
78
|
+
left: '16px'
|
|
79
|
+
}), _defineProperty(_ROLE$badge, _constants.PLACEMENT.topRight, {
|
|
80
|
+
top: '16px',
|
|
81
|
+
right: '16px'
|
|
82
|
+
}), _defineProperty(_ROLE$badge, _constants.PLACEMENT.bottomRight, {
|
|
83
|
+
bottom: '16px',
|
|
84
|
+
right: '16px'
|
|
85
|
+
}), _defineProperty(_ROLE$badge, _constants.PLACEMENT.bottomLeft, {
|
|
86
|
+
bottom: '16px',
|
|
87
|
+
left: '16px'
|
|
88
|
+
}), _defineProperty(_ROLE$badge, _constants.PLACEMENT.topLeftEdge, {
|
|
89
|
+
top: '-8px',
|
|
90
|
+
left: '16px'
|
|
91
|
+
}), _defineProperty(_ROLE$badge, _constants.PLACEMENT.topRightEdge, {
|
|
92
|
+
top: '-8px',
|
|
93
|
+
right: '16px'
|
|
94
|
+
}), _defineProperty(_ROLE$badge, _constants.PLACEMENT.bottomRightEdge, {
|
|
95
|
+
bottom: '-8px',
|
|
96
|
+
right: '16px'
|
|
97
|
+
}), _defineProperty(_ROLE$badge, _constants.PLACEMENT.bottomLeftEdge, {
|
|
98
|
+
bottom: '-8px',
|
|
99
|
+
left: '16px'
|
|
100
|
+
}), _defineProperty(_ROLE$badge, _constants.PLACEMENT.leftTopEdge, {
|
|
101
|
+
top: '16px',
|
|
102
|
+
left: '-8px'
|
|
103
|
+
}), _defineProperty(_ROLE$badge, _constants.PLACEMENT.rightTopEdge, {
|
|
104
|
+
top: '16px',
|
|
105
|
+
right: '-8px'
|
|
106
|
+
}), _defineProperty(_ROLE$badge, _constants.PLACEMENT.rightBottomEdge, {
|
|
107
|
+
bottom: '16px',
|
|
108
|
+
right: '-8px'
|
|
109
|
+
}), _defineProperty(_ROLE$badge, _constants.PLACEMENT.leftBottomEdge, {
|
|
110
|
+
bottom: '16px',
|
|
111
|
+
left: '-8px'
|
|
112
|
+
}), _ROLE$badge)), _defineProperty(_Object$freeze, _constants.ROLE.notificationCircle, (_ROLE$notificationCir = {}, _defineProperty(_ROLE$notificationCir, _constants.PLACEMENT.topLeft, {
|
|
113
|
+
top: '-10px',
|
|
114
|
+
left: '-10px'
|
|
115
|
+
}), _defineProperty(_ROLE$notificationCir, _constants.PLACEMENT.topRight, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, _constants.PLACEMENT.topEdge, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, _constants.PLACEMENT.bottomEdge, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, _constants.PLACEMENT.bottomRight, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, _constants.PLACEMENT.bottomLeft, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, _constants.PLACEMENT.topLeftEdge, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, _constants.PLACEMENT.topRightEdge, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, _constants.PLACEMENT.bottomRightEdge, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, _constants.PLACEMENT.bottomLeftEdge, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, _constants.PLACEMENT.leftTopEdge, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, _constants.PLACEMENT.rightTopEdge, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, _constants.PLACEMENT.rightBottomEdge, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _defineProperty(_ROLE$notificationCir, _constants.PLACEMENT.leftBottomEdge, DEFAULT_NOTIFICATION_CIRCLE_PLACEMENT), _ROLE$notificationCir)), _defineProperty(_Object$freeze, _constants.ROLE.hintDot, (_ROLE$hintDot = {}, _defineProperty(_ROLE$hintDot, _constants.PLACEMENT.topLeft, {
|
|
116
|
+
top: '-4px',
|
|
117
|
+
left: '-4px'
|
|
118
|
+
}), _defineProperty(_ROLE$hintDot, _constants.PLACEMENT.topRight, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, _constants.PLACEMENT.topEdge, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, _constants.PLACEMENT.bottomEdge, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, _constants.PLACEMENT.bottomRight, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, _constants.PLACEMENT.bottomLeft, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, _constants.PLACEMENT.topLeftEdge, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, _constants.PLACEMENT.topRightEdge, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, _constants.PLACEMENT.bottomRightEdge, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, _constants.PLACEMENT.bottomLeftEdge, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, _constants.PLACEMENT.leftTopEdge, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, _constants.PLACEMENT.rightTopEdge, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, _constants.PLACEMENT.rightBottomEdge, DEFAULT_HINT_DOT_PLACEMENT), _defineProperty(_ROLE$hintDot, _constants.PLACEMENT.leftBottomEdge, DEFAULT_HINT_DOT_PLACEMENT), _ROLE$hintDot)), _Object$freeze));
|
|
119
|
+
var StyledRoot = (0, _index.styled)('div', function () {
|
|
120
|
+
return {
|
|
121
|
+
position: 'relative',
|
|
122
|
+
display: 'inline-block',
|
|
123
|
+
lineHeight: 'initial'
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
exports.StyledRoot = StyledRoot;
|
|
127
|
+
StyledRoot.displayName = "StyledRoot";
|
|
128
|
+
var TOP_PLACEMENTS = [_constants.PLACEMENT.topLeft, _constants.PLACEMENT.topRight, _constants.PLACEMENT.topLeftEdge, _constants.PLACEMENT.topEdge, _constants.PLACEMENT.topRightEdge, _constants.PLACEMENT.leftTopEdge, _constants.PLACEMENT.rightTopEdge];
|
|
129
|
+
var BOTTOM_PLACEMENTS = [_constants.PLACEMENT.bottomLeft, _constants.PLACEMENT.bottomRight, _constants.PLACEMENT.bottomLeftEdge, _constants.PLACEMENT.bottomEdge, _constants.PLACEMENT.bottomRightEdge, _constants.PLACEMENT.leftBottomEdge, _constants.PLACEMENT.rightBottomEdge];
|
|
130
|
+
var LEFT_PLACEMENTS = [_constants.PLACEMENT.topLeft, _constants.PLACEMENT.topLeftEdge, _constants.PLACEMENT.topEdge, _constants.PLACEMENT.bottomLeft, _constants.PLACEMENT.bottomLeftEdge, _constants.PLACEMENT.bottomEdge, _constants.PLACEMENT.leftTopEdge, _constants.PLACEMENT.leftBottomEdge];
|
|
131
|
+
var RIGHT_PLACEMENTS = [_constants.PLACEMENT.topRight, _constants.PLACEMENT.topRightEdge, _constants.PLACEMENT.bottomRight, _constants.PLACEMENT.bottomRightEdge, _constants.PLACEMENT.rightTopEdge, _constants.PLACEMENT.rightBottomEdge];
|
|
132
|
+
var StyledPositioner = (0, _index.styled)('div', function (_ref2) {
|
|
133
|
+
var $theme = _ref2.$theme,
|
|
134
|
+
$role = _ref2.$role,
|
|
135
|
+
$placement = _ref2.$placement,
|
|
136
|
+
$horizontalOffset = _ref2.$horizontalOffset,
|
|
137
|
+
$verticalOffset = _ref2.$verticalOffset;
|
|
138
|
+
var positionStyle = POSITION_STYLES[$role][$placement];
|
|
139
|
+
|
|
140
|
+
if ($verticalOffset) {
|
|
141
|
+
if (TOP_PLACEMENTS.includes($placement)) {
|
|
142
|
+
positionStyle = _objectSpread(_objectSpread({}, positionStyle), {}, {
|
|
143
|
+
top: $verticalOffset
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (BOTTOM_PLACEMENTS.includes($placement)) {
|
|
148
|
+
positionStyle = _objectSpread(_objectSpread({}, positionStyle), {}, {
|
|
149
|
+
bottom: $verticalOffset
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if ($horizontalOffset) {
|
|
155
|
+
if (LEFT_PLACEMENTS.includes($placement)) {
|
|
156
|
+
positionStyle = _objectSpread(_objectSpread({}, positionStyle), {}, {
|
|
157
|
+
left: $horizontalOffset
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (RIGHT_PLACEMENTS.includes($placement)) {
|
|
162
|
+
positionStyle = _objectSpread(_objectSpread({}, positionStyle), {}, {
|
|
163
|
+
right: $horizontalOffset
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return _objectSpread(_objectSpread({}, positionStyle), {}, {
|
|
169
|
+
position: 'absolute',
|
|
170
|
+
lineHeight: 'initial'
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
exports.StyledPositioner = StyledPositioner;
|
|
174
|
+
StyledPositioner.displayName = "StyledPositioner";
|
|
175
|
+
var StyledBadge = (0, _index.styled)('div', function (_ref3) {
|
|
176
|
+
var $theme = _ref3.$theme,
|
|
177
|
+
_ref3$$shape = _ref3.$shape,
|
|
178
|
+
$shape = _ref3$$shape === void 0 ? _constants.SHAPE.rectangle : _ref3$$shape,
|
|
179
|
+
_ref3$$color = _ref3.$color,
|
|
180
|
+
$color = _ref3$$color === void 0 ? _constants.COLOR.accent : _ref3$$color,
|
|
181
|
+
_ref3$$hierarchy = _ref3.$hierarchy,
|
|
182
|
+
$hierarchy = _ref3$$hierarchy === void 0 ? _constants.HIERARCHY.primary : _ref3$$hierarchy,
|
|
183
|
+
$hidden = _ref3.$hidden;
|
|
184
|
+
return _objectSpread(_objectSpread({
|
|
185
|
+
visibility: $hidden ? 'hidden' : 'inherit',
|
|
186
|
+
boxSizing: 'border-box',
|
|
187
|
+
height: $theme.sizing.scale700,
|
|
188
|
+
borderRadius: $shape === _constants.SHAPE.rectangle ? $theme.borders.radius200 : $theme.borders.radius500,
|
|
189
|
+
paddingRight: $shape === _constants.SHAPE.rectangle ? $theme.sizing.scale100 : $theme.sizing.scale300,
|
|
190
|
+
paddingLeft: $shape === _constants.SHAPE.rectangle ? $theme.sizing.scale100 : $theme.sizing.scale300,
|
|
191
|
+
display: 'inline-flex',
|
|
192
|
+
alignItems: 'center'
|
|
193
|
+
}, getColorStyles({
|
|
194
|
+
$theme: $theme,
|
|
195
|
+
$hierarchy: $hierarchy,
|
|
196
|
+
$color: $color
|
|
197
|
+
})), $hierarchy === _constants.HIERARCHY.primary ? $theme.typography.LabelSmall : $theme.typography.ParagraphSmall);
|
|
198
|
+
});
|
|
199
|
+
exports.StyledBadge = StyledBadge;
|
|
200
|
+
StyledBadge.displayName = "StyledBadge";
|
|
201
|
+
var StyledNotificationCircle = (0, _index.styled)('div', function (_ref4) {
|
|
202
|
+
var $theme = _ref4.$theme,
|
|
203
|
+
_ref4$$color = _ref4.$color,
|
|
204
|
+
$color = _ref4$$color === void 0 ? _constants.COLOR.accent : _ref4$$color,
|
|
205
|
+
$hidden = _ref4.$hidden;
|
|
206
|
+
return _objectSpread(_objectSpread({
|
|
207
|
+
visibility: $hidden ? 'hidden' : 'inherit',
|
|
208
|
+
height: $theme.sizing.scale700,
|
|
209
|
+
width: $theme.sizing.scale700,
|
|
210
|
+
borderRadius: '20px',
|
|
211
|
+
display: 'inline-flex',
|
|
212
|
+
alignItems: 'center',
|
|
213
|
+
justifyContent: 'center'
|
|
214
|
+
}, getColorStyles({
|
|
215
|
+
$theme: $theme,
|
|
216
|
+
$hierarchy: _constants.HIERARCHY.primary,
|
|
217
|
+
$color: $color
|
|
218
|
+
})), $theme.typography.LabelXSmall);
|
|
219
|
+
});
|
|
220
|
+
exports.StyledNotificationCircle = StyledNotificationCircle;
|
|
221
|
+
StyledNotificationCircle.displayName = "StyledNotificationCircle";
|
|
222
|
+
var StyledHintDot = (0, _index.styled)('div', function (_ref5) {
|
|
223
|
+
var $theme = _ref5.$theme,
|
|
224
|
+
_ref5$$color = _ref5.$color,
|
|
225
|
+
$color = _ref5$$color === void 0 ? _constants.COLOR.accent : _ref5$$color,
|
|
226
|
+
$hidden = _ref5.$hidden;
|
|
227
|
+
return _objectSpread({
|
|
228
|
+
visibility: $hidden ? 'hidden' : 'inherit',
|
|
229
|
+
backgroundColor: $theme.colors[$color],
|
|
230
|
+
boxSizing: 'content-box',
|
|
231
|
+
height: '8px',
|
|
232
|
+
width: '8px',
|
|
233
|
+
borderRadius: '50%',
|
|
234
|
+
border: "4px solid ".concat($theme.colors.backgroundPrimary)
|
|
235
|
+
}, getColorStyles({
|
|
236
|
+
$theme: $theme,
|
|
237
|
+
$hierarchy: _constants.HIERARCHY.primary,
|
|
238
|
+
$color: $color
|
|
239
|
+
}));
|
|
240
|
+
});
|
|
241
|
+
exports.StyledHintDot = StyledHintDot;
|
|
242
|
+
StyledHintDot.displayName = "StyledHintDot";
|