@xfers/design-system 3.1.24 → 3.1.25

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.
@@ -34,16 +34,42 @@ var emotion_1 = require("emotion");
34
34
  var breakPoints_1 = require("src/constants/breakPoints");
35
35
  var fontStyles_1 = require("src/constants/fontStyles");
36
36
  var TypographyStyles_1 = require("src/shared/TypographyStyles");
37
+ var ColorStyles_1 = require("src/shared/ColorStyles");
37
38
  var theme_1 = require("src/theme/theme");
39
+ var Typography_1 = require("../Typography");
38
40
  var defaultOverlayStyle = emotion_1.css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n max-width: 200px;\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n color: ", ";\n box-shadow: none;\n\n .ant-tooltip-inner {\n padding: 12px;\n border-radius: 8px;\n box-shadow: none;\n background-color: ", ";\n }\n\n ", " {\n max-width: 250px;\n }\n\n .ant-tooltip-arrow {\n width: 16px;\n height: 16px;\n\n .ant-tooltip-arrow-content {\n background-color: ", ";\n box-shadow: none;\n width: 16px;\n height: 16px;\n }\n }\n\n &.ant-tooltip-placement-topRight .ant-tooltip-arrow,\n &.ant-tooltip-placement-topLeft .ant-tooltip-arrow,\n &.ant-tooltip-placement-top .ant-tooltip-arrow {\n bottom: -3px;\n }\n &.ant-tooltip-placement-bottomRight .ant-tooltip-arrow,\n &.ant-tooltip-placement-bottomLeft .ant-tooltip-arrow,\n &.ant-tooltip-placement-bottom .ant-tooltip-arrow {\n top: -3px;\n }\n &.ant-tooltip-placement-rightBottom .ant-tooltip-arrow,\n &.ant-tooltip-placement-rightTop .ant-tooltip-arrow,\n &.ant-tooltip-placement-right .ant-tooltip-arrow {\n left: -3px;\n }\n &.ant-tooltip-placement-leftBottom .ant-tooltip-arrow,\n &.ant-tooltip-placement-leftTop .ant-tooltip-arrow,\n &.ant-tooltip-placement-left .ant-tooltip-arrow {\n right: -3px;\n }\n"], ["\n max-width: 200px;\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n color: ", ";\n box-shadow: none;\n\n .ant-tooltip-inner {\n padding: 12px;\n border-radius: 8px;\n box-shadow: none;\n background-color: ", ";\n }\n\n ", " {\n max-width: 250px;\n }\n\n .ant-tooltip-arrow {\n width: 16px;\n height: 16px;\n\n .ant-tooltip-arrow-content {\n background-color: ", ";\n box-shadow: none;\n width: 16px;\n height: 16px;\n }\n }\n\n &.ant-tooltip-placement-topRight .ant-tooltip-arrow,\n &.ant-tooltip-placement-topLeft .ant-tooltip-arrow,\n &.ant-tooltip-placement-top .ant-tooltip-arrow {\n bottom: -3px;\n }\n &.ant-tooltip-placement-bottomRight .ant-tooltip-arrow,\n &.ant-tooltip-placement-bottomLeft .ant-tooltip-arrow,\n &.ant-tooltip-placement-bottom .ant-tooltip-arrow {\n top: -3px;\n }\n &.ant-tooltip-placement-rightBottom .ant-tooltip-arrow,\n &.ant-tooltip-placement-rightTop .ant-tooltip-arrow,\n &.ant-tooltip-placement-right .ant-tooltip-arrow {\n left: -3px;\n }\n &.ant-tooltip-placement-leftBottom .ant-tooltip-arrow,\n &.ant-tooltip-placement-leftTop .ant-tooltip-arrow,\n &.ant-tooltip-placement-left .ant-tooltip-arrow {\n right: -3px;\n }\n"])), fontStyles_1.MAIN_FONT, TypographyStyles_1.FONT_SIZE.P1, TypographyStyles_1.FONT_WEIGHT.REGULAR, theme_1.straitsXTheme.text.white, theme_1.straitsXTheme.brand.primary.contrast, breakPoints_1.DESKTOP_BREAKPOINT, theme_1.straitsXTheme.brand.primary.contrast);
39
41
  var Container = styled_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n line-height: 22px;\n"], ["\n line-height: 22px;\n"])));
40
- var FooterContainer = styled_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n margin-top: 20px;\n display: flex;\n justify-content: flex-end;\n\n a {\n margin-left: 20px;\n }\n"], ["\n margin-top: 20px;\n display: flex;\n justify-content: flex-end;\n\n a {\n margin-left: 20px;\n }\n"])));
42
+ var FooterContainer = styled_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n margin-top: 24px;\n display: flex;\n justify-content: flex-end;\n\n a {\n margin-left: 20px;\n }\n"], ["\n margin-top: 24px;\n display: flex;\n justify-content: flex-end;\n\n a {\n margin-left: 20px;\n }\n"])));
43
+ var Badge = styled_1.default.span(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: inline-block;\n margin-left: 8px;\n padding: 2px 6px;\n background-color: ", ";\n color: ", ";\n font-size: ", ";\n font-weight: ", ";\n border-radius: 4px;\n"], ["\n display: inline-block;\n margin-left: 8px;\n padding: 2px 6px;\n background-color: ", ";\n color: ", ";\n font-size: ", ";\n font-weight: ", ";\n border-radius: 4px;\n"])), ColorStyles_1.GREEN_COLORS.G400, theme_1.straitsXTheme.text.white, TypographyStyles_1.FONT_SIZE.SMALL, TypographyStyles_1.FONT_WEIGHT.BOLD);
44
+ var ActionButton = styled_1.default.a(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n font-weight: ", ";\n color: ", ";\n &:hover {\n color: ", ";\n }\n"], ["\n font-weight: ", ";\n color: ", ";\n &:hover {\n color: ", ";\n }\n"])), TypographyStyles_1.FONT_WEIGHT.BOLD, theme_1.straitsXTheme.brand.action.default, theme_1.straitsXTheme.brand.action.hover);
45
+ var DismissButton = styled_1.default.a(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font-weight: ", ";\n color: ", ";\n &:hover {\n color: ", ";\n }\n"], ["\n font-weight: ", ";\n color: ", ";\n &:hover {\n color: ", ";\n }\n"])), TypographyStyles_1.FONT_WEIGHT.BOLD, theme_1.straitsXTheme.text.white, theme_1.straitsXTheme.text.white);
41
46
  function default_1(_a) {
42
- var children = _a.children, _b = _a.placement, placement = _b === void 0 ? 'bottomRight' : _b, _c = _a.overlayClassName, overlayClassName = _c === void 0 ? defaultOverlayStyle : _c, _d = _a.arrowPointAtCenter, arrowPointAtCenter = _d === void 0 ? true : _d, color = _a.color, title = _a.title, footer = _a.footer, _e = _a.mouseEnterDelay, mouseEnterDelay = _e === void 0 ? 0 : _e, _f = _a.mouseLeaveDelay, mouseLeaveDelay = _f === void 0 ? 0 : _f, rest = __rest(_a, ["children", "placement", "overlayClassName", "arrowPointAtCenter", "color", "title", "footer", "mouseEnterDelay", "mouseLeaveDelay"]);
47
+ var children = _a.children, _b = _a.placement, placement = _b === void 0 ? 'bottomRight' : _b, _c = _a.overlayClassName, overlayClassName = _c === void 0 ? defaultOverlayStyle : _c, _d = _a.arrowPointAtCenter, arrowPointAtCenter = _d === void 0 ? true : _d, color = _a.color, title = _a.title, content = _a.content, _e = _a.mouseEnterDelay, mouseEnterDelay = _e === void 0 ? 0 : _e, _f = _a.mouseLeaveDelay, mouseLeaveDelay = _f === void 0 ? 0 : _f, _g = _a.isNew, isNew = _g === void 0 ? false : _g, actionTitle = _a.actionTitle, dismissTitle = _a.dismissTitle, onAction = _a.onAction, onDismiss = _a.onDismiss, rest = __rest(_a, ["children", "placement", "overlayClassName", "arrowPointAtCenter", "color", "title", "content", "mouseEnterDelay", "mouseLeaveDelay", "isNew", "actionTitle", "dismissTitle", "onAction", "onDismiss"]);
48
+ var onDismissButtonClick = function (e) {
49
+ e.preventDefault();
50
+ if (onDismiss) {
51
+ onDismiss();
52
+ }
53
+ };
54
+ var onActionButtonClick = function (e) {
55
+ e.preventDefault();
56
+ if (onAction) {
57
+ onAction();
58
+ }
59
+ };
43
60
  return (react_1.default.createElement(tooltip_1.default, __assign({ overlayClassName: overlayClassName, arrowPointAtCenter: arrowPointAtCenter, color: color, placement: placement, title: react_1.default.createElement(Container, null,
44
- title,
45
- footer && react_1.default.createElement(FooterContainer, null, footer)), mouseEnterDelay: mouseEnterDelay, mouseLeaveDelay: mouseLeaveDelay }, rest), children));
61
+ title && (react_1.default.createElement(Typography_1.P1Bold, { style: {
62
+ fontSize: TypographyStyles_1.FONT_SIZE.P1,
63
+ marginBottom: '16px',
64
+ color: theme_1.straitsXTheme.text.white
65
+ } },
66
+ title,
67
+ isNew === true && react_1.default.createElement(Badge, null, "New"))),
68
+ content,
69
+ (actionTitle || dismissTitle) && (react_1.default.createElement(FooterContainer, null,
70
+ react_1.default.createElement(DismissButton, { onClick: onDismissButtonClick }, dismissTitle),
71
+ react_1.default.createElement(ActionButton, { onClick: onActionButtonClick }, actionTitle)))), mouseEnterDelay: mouseEnterDelay, mouseLeaveDelay: mouseLeaveDelay }, rest), children));
46
72
  }
47
73
  exports.default = default_1;
48
- var templateObject_1, templateObject_2, templateObject_3;
74
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
49
75
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Tooltip/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAyB;AACzB,2CAAqC;AACrC,qCAAkC;AAElC,0CAAoC;AACpC,mCAA6B;AAC7B,yDAA8D;AAC9D,uDAAoD;AACpD,gEAAoE;AACpE,yCAA+C;AA+B/C,IAAM,mBAAmB,GAAG,aAAG,mzCAAA,wCAEd,EAAS,kBACX,EAAY,oBACV,EAAmB,cACzB,EAAwB,8IAOX,EAAoC,cAGxD,EAAkB,6JASI,EAAoC,60BA2B7D,KAjDgB,sBAAS,EACX,4BAAS,CAAC,EAAE,EACV,8BAAW,CAAC,OAAO,EACzB,qBAAa,CAAC,IAAI,CAAC,KAAK,EAOX,qBAAa,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAGxD,gCAAkB,EASI,qBAAa,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CA2B7D,CAAA;AAED,IAAM,SAAS,GAAG,gBAAM,CAAC,GAAG,6FAAA,0BAE3B,IAAA,CAAA;AAED,IAAM,eAAe,GAAG,gBAAM,CAAC,GAAG,kLAAA,+GAQjC,IAAA,CAAA;AAED,mBAAwB,EAWhB;IAVN,IAAA,QAAQ,cAAA,EACR,iBAAyB,EAAzB,SAAS,mBAAG,aAAa,KAAA,EACzB,wBAAsC,EAAtC,gBAAgB,mBAAG,mBAAmB,KAAA,EACtC,0BAAyB,EAAzB,kBAAkB,mBAAG,IAAI,KAAA,EACzB,KAAK,WAAA,EACL,KAAK,WAAA,EACL,MAAM,YAAA,EACN,uBAAmB,EAAnB,eAAe,mBAAG,CAAC,KAAA,EACnB,uBAAmB,EAAnB,eAAe,mBAAG,CAAC,KAAA,EAChB,IAAI,cAVe,qIAWvB,CADQ;IAEP,OAAO,CACL,8BAAC,iBAAO,aACN,gBAAgB,EAAE,gBAAgB,EAClC,kBAAkB,EAAE,kBAAkB,EACtC,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,KAAK,EACH,8BAAC,SAAS;YACP,KAAK;YACL,MAAM,IAAI,8BAAC,eAAe,QAAE,MAAM,CAAmB,CAC5C,EAEd,eAAe,EAAE,eAAe,EAChC,eAAe,EAAE,eAAe,IAC5B,IAAI,GAEP,QAAQ,CACD,CACX,CAAA;AACH,CAAC;AA/BD,4BA+BC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Tooltip/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAyB;AACzB,2CAAqC;AACrC,qCAAkC;AAElC,0CAAoC;AACpC,mCAA6B;AAC7B,yDAA8D;AAC9D,uDAAoD;AACpD,gEAAoE;AACpE,sDAAqD;AACrD,yCAA+C;AAC/C,4CAAsC;AAkCtC,IAAM,mBAAmB,GAAG,aAAG,mzCAAA,wCAEd,EAAS,kBACX,EAAY,oBACV,EAAmB,cACzB,EAAwB,8IAOX,EAAoC,cAGxD,EAAkB,6JASI,EAAoC,60BA2B7D,KAjDgB,sBAAS,EACX,4BAAS,CAAC,EAAE,EACV,8BAAW,CAAC,OAAO,EACzB,qBAAa,CAAC,IAAI,CAAC,KAAK,EAOX,qBAAa,CAAC,KAAK,CAA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+1,9 @@
1
1
  import React from 'react';
2
2
  import 'antd/es/tooltip/style/css';
3
3
  declare type TooltipPlacement = 'top' | 'left' | 'right' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom';
4
- declare type RenderFunction = () => React.ReactNode;
5
4
  declare type Props = {
6
5
  children: React.ReactElement;
7
- title: React.ReactNode | RenderFunction;
8
- footer?: React.ReactNode | RenderFunction;
6
+ isNew?: boolean;
9
7
  placement?: TooltipPlacement;
10
8
  overlayClassName?: string;
11
9
  mouseEnterDelay?: number;
@@ -13,6 +11,12 @@ declare type Props = {
13
11
  arrowPointAtCenter?: boolean;
14
12
  color?: string;
15
13
  overlayStyle?: object;
14
+ title?: string;
15
+ content?: string | React.ReactElement;
16
+ actionTitle?: string;
17
+ dismissTitle?: string;
18
+ onAction?: () => void;
19
+ onDismiss?: () => void;
16
20
  };
17
- export default function ({ children, placement, overlayClassName, arrowPointAtCenter, color, title, footer, mouseEnterDelay, mouseLeaveDelay, ...rest }: Props): JSX.Element;
21
+ export default function ({ children, placement, overlayClassName, arrowPointAtCenter, color, title, content, mouseEnterDelay, mouseLeaveDelay, isNew, actionTitle, dismissTitle, onAction, onDismiss, ...rest }: Props): JSX.Element;
18
22
  export {};