baseui 0.0.0-next-e90bd38 → 0.0.0-next-a48c2fd

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 (41) hide show
  1. package/banner/types.d.ts +12 -11
  2. package/banner/types.js.flow +13 -11
  3. package/es/layer/layer.js +24 -0
  4. package/es/layer/layers-manager.js +90 -1
  5. package/es/message-card/constants.js +19 -0
  6. package/es/message-card/index.js +10 -0
  7. package/es/message-card/message-card.js +112 -0
  8. package/es/message-card/styled-components.js +108 -0
  9. package/es/message-card/types.js +1 -0
  10. package/es/message-card/utils.js +27 -0
  11. package/esm/layer/layer.js +24 -0
  12. package/esm/layer/layers-manager.js +96 -1
  13. package/esm/message-card/constants.js +20 -0
  14. package/esm/message-card/index.js +10 -0
  15. package/esm/message-card/message-card.js +166 -0
  16. package/esm/message-card/styled-components.js +116 -0
  17. package/esm/message-card/types.js +1 -0
  18. package/esm/message-card/utils.js +26 -0
  19. package/layer/layer.js +24 -0
  20. package/layer/layer.js.flow +25 -0
  21. package/layer/layers-manager.d.ts +8 -0
  22. package/layer/layers-manager.js +96 -1
  23. package/layer/layers-manager.js.flow +84 -1
  24. package/layer/types.d.ts +21 -0
  25. package/layer/types.js.flow +22 -1
  26. package/message-card/constants.d.ts +12 -0
  27. package/message-card/constants.js +25 -0
  28. package/message-card/index.d.ts +4 -0
  29. package/message-card/index.js +60 -0
  30. package/message-card/index.js.flow +72 -0
  31. package/message-card/message-card.d.ts +4 -0
  32. package/message-card/message-card.js +182 -0
  33. package/message-card/package.json +4 -0
  34. package/message-card/styled-components.d.ts +14 -0
  35. package/message-card/styled-components.js +124 -0
  36. package/message-card/types.d.ts +27 -0
  37. package/message-card/types.js +5 -0
  38. package/message-card/utils.d.ts +1 -0
  39. package/message-card/utils.js +36 -0
  40. package/package.json +2 -2
  41. package/tokens/types.js.flow +27 -0
@@ -0,0 +1,182 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _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 _styledComponents = require("./styled-components");
13
+
14
+ var _button = require("../button");
15
+
16
+ var _index = require("../styles/index.js");
17
+
18
+ var _ = require("../");
19
+
20
+ var _utils = require("./utils");
21
+
22
+ var _tokens = require("../tokens");
23
+
24
+ var _overrides = require("../helpers/overrides");
25
+
26
+ var _constants = require("./constants");
27
+
28
+ var _excluded = ["children"];
29
+
30
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
31
+
32
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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; }
33
+
34
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
35
+
36
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
37
+
38
+ 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; }
39
+
40
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
41
+
42
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
43
+
44
+ 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."); }
45
+
46
+ 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); }
47
+
48
+ 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; }
49
+
50
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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; }
51
+
52
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
53
+
54
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
55
+
56
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
57
+
58
+ var ButtonAlwaysLightTheme = function ButtonAlwaysLightTheme(_ref) {
59
+ var children = _ref.children,
60
+ restProps = _objectWithoutProperties(_ref, _excluded);
61
+
62
+ return /*#__PURE__*/React.createElement(_.ThemeProvider, {
63
+ theme: _.LightTheme
64
+ }, /*#__PURE__*/React.createElement(_button.Button, restProps, children));
65
+ };
66
+
67
+ var MessageCard = function MessageCard(_ref2) {
68
+ var _ref2$backgroundColor = _ref2.backgroundColor,
69
+ backgroundColor = _ref2$backgroundColor === void 0 ? _tokens.colors.white : _ref2$backgroundColor,
70
+ backgroundColorTypeProp = _ref2.backgroundColorType,
71
+ _ref2$buttonKind = _ref2.buttonKind,
72
+ buttonKind = _ref2$buttonKind === void 0 ? _constants.BUTTON_KIND.secondary : _ref2$buttonKind,
73
+ buttonLabel = _ref2.buttonLabel,
74
+ heading = _ref2.heading,
75
+ image = _ref2.image,
76
+ onClick = _ref2.onClick,
77
+ _ref2$overrides = _ref2.overrides,
78
+ overrides = _ref2$overrides === void 0 ? {} : _ref2$overrides,
79
+ paragraph = _ref2.paragraph;
80
+
81
+ var _ref3 = image || {},
82
+ src = _ref3.src,
83
+ _ref3$layout = _ref3.layout,
84
+ layout = _ref3$layout === void 0 ? _constants.IMAGE_LAYOUT.top : _ref3$layout,
85
+ backgroundPosition = _ref3.backgroundPosition,
86
+ ariaLabel = _ref3.ariaLabel;
87
+
88
+ var _getOverrides = (0, _overrides.getOverrides)(overrides.Root, _styledComponents.StyledRoot),
89
+ _getOverrides2 = _slicedToArray(_getOverrides, 2),
90
+ Root = _getOverrides2[0],
91
+ RootProps = _getOverrides2[1];
92
+
93
+ var _getOverrides3 = (0, _overrides.getOverrides)(overrides.ContentContainer, _styledComponents.StyledContentContainer),
94
+ _getOverrides4 = _slicedToArray(_getOverrides3, 2),
95
+ ContentContainer = _getOverrides4[0],
96
+ ContentContainerProps = _getOverrides4[1];
97
+
98
+ var _getOverrides5 = (0, _overrides.getOverrides)(overrides.HeadingContainer, _styledComponents.StyledHeadingContainer),
99
+ _getOverrides6 = _slicedToArray(_getOverrides5, 2),
100
+ HeadingContainer = _getOverrides6[0],
101
+ HeadingContainerProps = _getOverrides6[1];
102
+
103
+ var _getOverrides7 = (0, _overrides.getOverrides)(overrides.ParagraphContainer, _styledComponents.StyledParagraphContainer),
104
+ _getOverrides8 = _slicedToArray(_getOverrides7, 2),
105
+ ParagraphContainer = _getOverrides8[0],
106
+ ParagraphContainerProps = _getOverrides8[1];
107
+
108
+ var _getOverrides9 = (0, _overrides.getOverrides)(overrides.Image, _styledComponents.StyledImage),
109
+ _getOverrides10 = _slicedToArray(_getOverrides9, 2),
110
+ Image = _getOverrides10[0],
111
+ ImageProps = _getOverrides10[1];
112
+
113
+ var _getOverrides11 = (0, _overrides.getOverrides)(overrides.Button, ButtonAlwaysLightTheme),
114
+ _getOverrides12 = _slicedToArray(_getOverrides11, 2),
115
+ Button = _getOverrides12[0],
116
+ ButtonProps = _getOverrides12[1];
117
+
118
+ var _useStyletron = (0, _index.useStyletron)(),
119
+ _useStyletron2 = _slicedToArray(_useStyletron, 2),
120
+ theme = _useStyletron2[1];
121
+
122
+ var backgroundColorType = backgroundColorTypeProp || (0, _utils.getBackgroundColorType)(backgroundColor);
123
+
124
+ if (!backgroundColorType) {
125
+ backgroundColorType = _constants.BACKGROUND_COLOR_TYPE.dark;
126
+
127
+ if (process.env.NODE_ENV !== "production") {
128
+ console.warn("The provided value for 'backgroundColor', ".concat(backgroundColor, ", is not recognized as a Base Web primitive color. Please use the 'backgroundColorType' prop to indicate whether this color is light or dark so the rest of the component can be styled accordingly."));
129
+ }
130
+ }
131
+
132
+ var buttonColors;
133
+
134
+ if (buttonKind === _constants.BUTTON_KIND.tertiary && backgroundColorType === _constants.BACKGROUND_COLOR_TYPE.dark) {
135
+ buttonColors = {
136
+ color: theme.colors.contentOnColor,
137
+ backgroundColor: theme.colors.buttonTertiaryFill
138
+ };
139
+ }
140
+
141
+ if (buttonKind !== _constants.BUTTON_KIND.tertiary && backgroundColor !== _tokens.colors.white) {
142
+ buttonColors = {
143
+ color: theme.colors.contentOnColorInverse,
144
+ backgroundColor: theme.colors.backgroundAlwaysLight
145
+ };
146
+ }
147
+
148
+ return /*#__PURE__*/React.createElement(Root, _extends({
149
+ onClick: onClick,
150
+ $backgroundColor: backgroundColor,
151
+ $backgroundColorType: backgroundColorType,
152
+ $imageLayout: layout
153
+ }, RootProps), image && /*#__PURE__*/React.createElement(Image, _extends({
154
+ role: "img",
155
+ ariaLabel: ariaLabel,
156
+ $src: src,
157
+ $imageLayout: layout,
158
+ $backgroundPosition: backgroundPosition
159
+ }, ImageProps)), /*#__PURE__*/React.createElement(ContentContainer, ContentContainerProps, heading && /*#__PURE__*/React.createElement(HeadingContainer, HeadingContainerProps, heading), paragraph && /*#__PURE__*/React.createElement(ParagraphContainer, ParagraphContainerProps, paragraph), buttonLabel && /*#__PURE__*/React.createElement(Button, _extends({
160
+ kind: buttonKind,
161
+ shape: _button.SHAPE.pill,
162
+ size: _button.SIZE.compact,
163
+ role: "none",
164
+ tabIndex: -1,
165
+ colors: buttonColors,
166
+ overrides: {
167
+ BaseButton: {
168
+ style: _objectSpread({
169
+ pointerEvents: 'none'
170
+ }, buttonKind === _constants.BUTTON_KIND.tertiary ? {
171
+ marginTop: theme.sizing.scale100,
172
+ transform: theme.direction === 'rtl' ? "translateX(".concat(theme.sizing.scale500, ")") : "translateX(-".concat(theme.sizing.scale500, ")")
173
+ } : {
174
+ marginTop: theme.sizing.scale500
175
+ })
176
+ }
177
+ }
178
+ }, ButtonProps), buttonLabel)));
179
+ };
180
+
181
+ var _default = MessageCard;
182
+ exports.default = _default;
@@ -0,0 +1,4 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "../esm/message-card/index.js"
4
+ }
@@ -0,0 +1,14 @@
1
+ import { IMAGE_LAYOUT, BACKGROUND_COLOR_TYPE } from './constants';
2
+ export declare const StyledRoot: import("styletron-react").StyletronComponent<"button", {
3
+ $backgroundColor: string;
4
+ $backgroundColorType: keyof typeof BACKGROUND_COLOR_TYPE;
5
+ $imageLayout: keyof typeof IMAGE_LAYOUT | undefined;
6
+ }>;
7
+ export declare const StyledImage: import("styletron-react").StyletronComponent<"div", {
8
+ $src: string;
9
+ $imageLayout: keyof typeof IMAGE_LAYOUT;
10
+ $backgroundPosition: string;
11
+ }>;
12
+ export declare const StyledContentContainer: import("styletron-react").StyletronComponent<"div", {}>;
13
+ export declare const StyledHeadingContainer: import("styletron-react").StyletronComponent<"div", {}>;
14
+ export declare const StyledParagraphContainer: import("styletron-react").StyletronComponent<"div", {}>;
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StyledRoot = exports.StyledParagraphContainer = exports.StyledImage = exports.StyledHeadingContainer = exports.StyledContentContainer = void 0;
7
+
8
+ var _styles = require("../styles");
9
+
10
+ var _constants = require("./constants");
11
+
12
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
+
14
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
15
+
16
+ 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; }
17
+
18
+ var StyledRoot = (0, _styles.styled)('button', function (_ref) {
19
+ var $theme = _ref.$theme,
20
+ $backgroundColor = _ref.$backgroundColor,
21
+ $backgroundColorType = _ref.$backgroundColorType,
22
+ _ref$$imageLayout = _ref.$imageLayout,
23
+ $imageLayout = _ref$$imageLayout === void 0 ? _constants.IMAGE_LAYOUT.top : _ref$$imageLayout;
24
+ var lightBackgroundStyle = {
25
+ color: $theme.colors.contentOnColorInverse,
26
+ borderStyle: 'solid',
27
+ borderWidth: $theme.sizing.scale0,
28
+ borderColor: $theme.colors.borderOpaque
29
+ };
30
+ var darkBackgroundStyle = {
31
+ color: $theme.colors.contentOnColor,
32
+ border: 'none'
33
+ };
34
+ return _objectSpread(_objectSpread({
35
+ alignItems: 'stretch',
36
+ backgroundColor: $backgroundColor,
37
+ borderRadius: $theme.borders.radius400,
38
+ cursor: 'pointer',
39
+ display: 'flex',
40
+ flexDirection: $imageLayout === _constants.IMAGE_LAYOUT.top ? 'column' : 'row',
41
+ overflow: 'hidden',
42
+ padding: '0',
43
+ position: 'relative',
44
+ textAlign: 'start',
45
+ width: '100%',
46
+ boxShadow: "inset 999px 999px 0px ".concat($theme.colors.backgroundOverlayArt)
47
+ }, $backgroundColorType === _constants.BACKGROUND_COLOR_TYPE.light ? lightBackgroundStyle : darkBackgroundStyle), {}, {
48
+ ':focus': {
49
+ outlineWidth: '3px',
50
+ outlineStyle: 'solid',
51
+ outlineColor: $theme.colors.borderAccent,
52
+ outlineOffset: '-3px'
53
+ },
54
+ ':hover:after': {
55
+ content: '""',
56
+ width: '100%',
57
+ height: '100%',
58
+ zIndex: '1',
59
+ position: 'absolute',
60
+ top: '0',
61
+ left: '0',
62
+ backgroundColor: $backgroundColorType === _constants.BACKGROUND_COLOR_TYPE.light ? 'rgba(0, 0, 0, 0.04)' : 'rgba(255, 255, 255, 0.10)'
63
+ },
64
+ ':active:after': {
65
+ content: '""',
66
+ width: '100%',
67
+ height: '100%',
68
+ zIndex: '1',
69
+ position: 'absolute',
70
+ top: '0',
71
+ left: '0',
72
+ backgroundColor: $backgroundColorType === _constants.BACKGROUND_COLOR_TYPE.light ? 'rgba(0, 0, 0, 0.08)' : 'rgba(255, 255, 255, 0.20)'
73
+ }
74
+ });
75
+ });
76
+ exports.StyledRoot = StyledRoot;
77
+ StyledRoot.displayName = "StyledRoot";
78
+ var StyledImage = (0, _styles.styled)('div', function (_ref2) {
79
+ var _ref2$$imageLayout = _ref2.$imageLayout,
80
+ $imageLayout = _ref2$$imageLayout === void 0 ? _constants.IMAGE_LAYOUT.top : _ref2$$imageLayout,
81
+ _ref2$$backgroundPosi = _ref2.$backgroundPosition,
82
+ $backgroundPosition = _ref2$$backgroundPosi === void 0 ? 'center' : _ref2$$backgroundPosi,
83
+ $src = _ref2.$src;
84
+ return _objectSpread({
85
+ backgroundImage: "url(".concat($src, ")"),
86
+ backgroundSize: 'cover',
87
+ backgroundPosition: $backgroundPosition
88
+ }, $imageLayout === _constants.IMAGE_LAYOUT.top ? {
89
+ height: '132px',
90
+ width: '100%'
91
+ } : {
92
+ width: '112px',
93
+ order: '1'
94
+ });
95
+ });
96
+ exports.StyledImage = StyledImage;
97
+ StyledImage.displayName = "StyledImage";
98
+ var StyledContentContainer = (0, _styles.styled)('div', function (_ref3) {
99
+ var $theme = _ref3.$theme;
100
+ return {
101
+ width: '100%',
102
+ boxSizing: 'border-box',
103
+ paddingTop: $theme.sizing.scale600,
104
+ paddingRight: $theme.sizing.scale300,
105
+ paddingBottom: $theme.sizing.scale600,
106
+ paddingLeft: $theme.sizing.scale600
107
+ };
108
+ });
109
+ exports.StyledContentContainer = StyledContentContainer;
110
+ StyledContentContainer.displayName = "StyledContentContainer";
111
+ var StyledHeadingContainer = (0, _styles.styled)('div', function (_ref4) {
112
+ var $theme = _ref4.$theme;
113
+ return _objectSpread({}, $theme.typography.HeadingXSmall);
114
+ });
115
+ exports.StyledHeadingContainer = StyledHeadingContainer;
116
+ StyledHeadingContainer.displayName = "StyledHeadingContainer";
117
+ var StyledParagraphContainer = (0, _styles.styled)('div', function (_ref5) {
118
+ var $theme = _ref5.$theme;
119
+ return _objectSpread(_objectSpread({}, $theme.typography.ParagraphSmall), {}, {
120
+ marginTop: $theme.sizing.scale100
121
+ });
122
+ });
123
+ exports.StyledParagraphContainer = StyledParagraphContainer;
124
+ StyledParagraphContainer.displayName = "StyledParagraphContainer";
@@ -0,0 +1,27 @@
1
+ import type { SyntheticEvent } from 'react';
2
+ import type { Override } from '../helpers/overrides';
3
+ import { BACKGROUND_COLOR_TYPE, IMAGE_LAYOUT, BUTTON_KIND } from './constants';
4
+ export declare type MessageCardOverrides = {
5
+ Root?: Override;
6
+ ContentContainer?: Override;
7
+ HeadingContainer?: Override;
8
+ ParagraphContainer?: Override;
9
+ Button?: Override;
10
+ Image?: Override;
11
+ };
12
+ export interface MessageCardProps {
13
+ onClick: (a: SyntheticEvent<HTMLButtonElement>) => unknown;
14
+ heading?: React.ReactNode;
15
+ paragraph?: React.ReactNode;
16
+ buttonLabel?: React.ReactNode;
17
+ buttonKind?: keyof typeof BUTTON_KIND;
18
+ backgroundColor?: string;
19
+ backgroundColorType?: keyof typeof BACKGROUND_COLOR_TYPE;
20
+ image?: {
21
+ src: string;
22
+ layout?: keyof typeof IMAGE_LAYOUT;
23
+ backgroundPosition?: string;
24
+ ariaLabel: string;
25
+ };
26
+ overrides?: MessageCardOverrides;
27
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1 @@
1
+ export declare function getBackgroundColorType(backgroundColor: string): "dark" | "light";
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getBackgroundColorType = getBackgroundColorType;
7
+
8
+ var _tokens = require("../tokens");
9
+
10
+ var _constants = require("./constants");
11
+
12
+ /*
13
+ Copyright (c) Uber Technologies, Inc.
14
+
15
+ This source code is licensed under the MIT license found in the
16
+ LICENSE file in the root directory of this source tree.
17
+ */
18
+ var LIGHT_COLORS = new Set([_tokens.colors.red50, _tokens.colors.red100, _tokens.colors.red200, _tokens.colors.red300, _tokens.colors.green50, _tokens.colors.green100, _tokens.colors.green200, _tokens.colors.green300, _tokens.colors.teal50, _tokens.colors.teal100, _tokens.colors.teal200, _tokens.colors.teal300, _tokens.colors.blue50, _tokens.colors.blue100, _tokens.colors.blue200, _tokens.colors.blue300, _tokens.colors.cobalt50, _tokens.colors.cobalt100, _tokens.colors.cobalt200, _tokens.colors.purple50, _tokens.colors.purple100, _tokens.colors.purple200, _tokens.colors.purple300, _tokens.colors.magenta50, _tokens.colors.magenta100, _tokens.colors.magenta200, _tokens.colors.magenta300, _tokens.colors.brown50, _tokens.colors.brown100, _tokens.colors.brown200, _tokens.colors.brown300, _tokens.colors.orange50, _tokens.colors.orange100, _tokens.colors.orange200, _tokens.colors.orange300, _tokens.colors.orange400, _tokens.colors.lime50, _tokens.colors.lime100, _tokens.colors.lime200, _tokens.colors.lime300, _tokens.colors.lime400, _tokens.colors.platinum50, _tokens.colors.platinum100, _tokens.colors.platinum200, _tokens.colors.platinum300, _tokens.colors.platinum400, _tokens.colors.yellow50, _tokens.colors.yellow100, _tokens.colors.yellow200, _tokens.colors.yellow300, _tokens.colors.yellow400, _tokens.colors.yellow500, _tokens.colors.white, _tokens.colors.gray50, _tokens.colors.gray100, _tokens.colors.gray200, _tokens.colors.gray300, _tokens.colors.gray400]);
19
+ var DARK_COLORS = new Set([_tokens.colors.red400, _tokens.colors.red500, _tokens.colors.red600, _tokens.colors.red700, _tokens.colors.green400, _tokens.colors.green500, _tokens.colors.green600, _tokens.colors.green700, _tokens.colors.teal400, _tokens.colors.teal500, _tokens.colors.teal600, _tokens.colors.teal700, _tokens.colors.blue400, _tokens.colors.blue500, _tokens.colors.blue600, _tokens.colors.blue700, _tokens.colors.cobalt300, _tokens.colors.cobalt400, _tokens.colors.cobalt500, _tokens.colors.cobalt600, _tokens.colors.cobalt700, _tokens.colors.purple400, _tokens.colors.purple500, _tokens.colors.purple600, _tokens.colors.purple700, _tokens.colors.magenta400, _tokens.colors.magenta500, _tokens.colors.magenta600, _tokens.colors.magenta700, _tokens.colors.brown400, _tokens.colors.brown500, _tokens.colors.brown600, _tokens.colors.brown700, _tokens.colors.orange500, _tokens.colors.orange600, _tokens.colors.orange700, _tokens.colors.lime500, _tokens.colors.lime600, _tokens.colors.lime700, _tokens.colors.platinum500, _tokens.colors.platinum600, _tokens.colors.platinum700, _tokens.colors.platinum800, _tokens.colors.yellow600, _tokens.colors.yellow700, _tokens.colors.gray500, _tokens.colors.gray600, _tokens.colors.gray700, _tokens.colors.gray800, _tokens.colors.gray900, _tokens.colors.black]);
20
+ var POOR_CONTRAST_COLORS = new Set([_tokens.colors.red300, _tokens.colors.gray500, _tokens.colors.yellow600]);
21
+
22
+ function getBackgroundColorType(backgroundColor) {
23
+ if (process.env.NODE_ENV !== "production" && POOR_CONTRAST_COLORS.has(backgroundColor)) {
24
+ console.warn("The provided value for backgroundColor, ".concat(backgroundColor, ", is not supported because it does not pass accessibility contrast tests for either white or black text."));
25
+ }
26
+
27
+ if (LIGHT_COLORS.has(backgroundColor)) {
28
+ return _constants.BACKGROUND_COLOR_TYPE.light;
29
+ }
30
+
31
+ if (DARK_COLORS.has(backgroundColor)) {
32
+ return _constants.BACKGROUND_COLOR_TYPE.dark;
33
+ }
34
+
35
+ return null;
36
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baseui",
3
- "version": "0.0.0-next-e90bd38",
3
+ "version": "0.0.0-next-a48c2fd",
4
4
  "description": "A React Component library implementing the Base design language",
5
5
  "keywords": [
6
6
  "react",
@@ -53,7 +53,7 @@
53
53
  "documentation:build": "run-s prebuild build:cjs next:build next:export",
54
54
  "documentation:serve": "static-server public --port 8081",
55
55
  "next:dev": "next dev documentation-site",
56
- "next:build": "NODE_OPTIONS=--max_old_space_size=4096 next build documentation-site",
56
+ "next:build": "NODE_OPTIONS=--max_old_space_size=8192 next build documentation-site",
57
57
  "next:export": "next export documentation-site -o public",
58
58
  "tsc": "tsc",
59
59
  "validate:examples": "node ./scripts/validate-examples.js"
@@ -39,6 +39,15 @@ export type ColorTokensT = {
39
39
  blue600: string,
40
40
  blue700: string,
41
41
 
42
+ teal50: string,
43
+ teal100: string,
44
+ teal200: string,
45
+ teal300: string,
46
+ teal400: string,
47
+ teal500: string,
48
+ teal600: string,
49
+ teal700: string,
50
+
42
51
  red50: string,
43
52
  red100: string,
44
53
  red200: string,
@@ -66,6 +75,15 @@ export type ColorTokensT = {
66
75
  orange600: string,
67
76
  orange700: string,
68
77
 
78
+ magenta50: string,
79
+ magenta100: string,
80
+ magenta200: string,
81
+ magenta300: string,
82
+ magenta400: string,
83
+ magenta500: string,
84
+ magenta600: string,
85
+ magenta700: string,
86
+
69
87
  purple50: string,
70
88
  purple100: string,
71
89
  purple200: string,
@@ -84,6 +102,15 @@ export type ColorTokensT = {
84
102
  yellow600: string,
85
103
  yellow700: string,
86
104
 
105
+ lime50: string,
106
+ lime100: string,
107
+ lime200: string,
108
+ lime300: string,
109
+ lime400: string,
110
+ lime500: string,
111
+ lime600: string,
112
+ lime700: string,
113
+
87
114
  brown50: string,
88
115
  brown100: string,
89
116
  brown200: string,