@pedidopago/ui 1.2.5 → 1.3.2

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 (122) hide show
  1. package/dist/components/Alert/alert.test.js +8 -8
  2. package/dist/components/Alert/index.d.ts +2 -2
  3. package/dist/components/Alert/index.d.ts.map +1 -1
  4. package/dist/components/Alert/index.js +7 -26
  5. package/dist/components/Alert/styles.d.ts +0 -12
  6. package/dist/components/Alert/styles.d.ts.map +1 -1
  7. package/dist/components/Alert/styles.js +4 -22
  8. package/dist/components/Alert/types.d.ts +5 -22
  9. package/dist/components/Alert/types.d.ts.map +1 -1
  10. package/dist/components/Button/index.d.ts.map +1 -1
  11. package/dist/components/Button/index.js +11 -2
  12. package/dist/components/Button/styles.js +1 -1
  13. package/dist/components/Button/types.d.ts +1 -0
  14. package/dist/components/Button/types.d.ts.map +1 -1
  15. package/dist/components/Card/card.test.tsx.d.ts +2 -0
  16. package/dist/components/Card/card.test.tsx.d.ts.map +1 -0
  17. package/dist/components/Card/card.test.tsx.js +41 -0
  18. package/dist/components/Card/index.d.ts +2 -2
  19. package/dist/components/Card/index.d.ts.map +1 -1
  20. package/dist/components/Card/index.js +25 -69
  21. package/dist/components/Card/styles.d.ts +2 -52
  22. package/dist/components/Card/styles.d.ts.map +1 -1
  23. package/dist/components/Card/styles.js +7 -80
  24. package/dist/components/Card/types.d.ts +12 -37
  25. package/dist/components/Card/types.d.ts.map +1 -1
  26. package/dist/components/DateInput/DateInput-example.d.ts +2 -2
  27. package/dist/components/DateInput/DateInput-example.d.ts.map +1 -1
  28. package/dist/components/DateInput/DateInput-example.js +10 -15
  29. package/dist/components/DateInput/dateInput.test.js +4 -4
  30. package/dist/components/DateInput/index.d.ts +2 -2
  31. package/dist/components/DateInput/index.d.ts.map +1 -1
  32. package/dist/components/DateInput/index.js +65 -136
  33. package/dist/components/DateInput/styles.d.ts +7 -29
  34. package/dist/components/DateInput/styles.d.ts.map +1 -1
  35. package/dist/components/DateInput/styles.js +15 -19
  36. package/dist/components/DateInput/types.d.ts +7 -14
  37. package/dist/components/DateInput/types.d.ts.map +1 -1
  38. package/dist/components/DatePicker/datepicker.test.js +8 -8
  39. package/dist/components/DatePicker/index.d.ts.map +1 -1
  40. package/dist/components/DatePicker/index.js +4 -8
  41. package/dist/components/DatePicker/types.d.ts +3 -4
  42. package/dist/components/DatePicker/types.d.ts.map +1 -1
  43. package/dist/components/Flex/styles.d.ts +1 -0
  44. package/dist/components/Flex/styles.d.ts.map +1 -1
  45. package/dist/components/Grid/styles.d.ts +1 -0
  46. package/dist/components/Grid/styles.d.ts.map +1 -1
  47. package/dist/components/Input/index.d.ts.map +1 -1
  48. package/dist/components/Input/index.js +15 -2
  49. package/dist/components/Input/styles.d.ts +1 -0
  50. package/dist/components/Input/styles.d.ts.map +1 -1
  51. package/dist/components/Input/styles.js +34 -33
  52. package/dist/components/Label/index.d.ts +2 -2
  53. package/dist/components/Label/index.d.ts.map +1 -1
  54. package/dist/components/Label/index.js +12 -23
  55. package/dist/components/Label/label.test.d.ts +2 -0
  56. package/dist/components/Label/label.test.d.ts.map +1 -0
  57. package/dist/components/Label/label.test.js +105 -0
  58. package/dist/components/Label/styles.js +1 -1
  59. package/dist/components/Label/types.d.ts +5 -6
  60. package/dist/components/Label/types.d.ts.map +1 -1
  61. package/dist/components/Modal/index.d.ts +2 -2
  62. package/dist/components/Modal/index.d.ts.map +1 -1
  63. package/dist/components/Modal/index.js +43 -20
  64. package/dist/components/Modal/styles.d.ts +15 -2
  65. package/dist/components/Modal/styles.d.ts.map +1 -1
  66. package/dist/components/Modal/styles.js +25 -7
  67. package/dist/components/Modal/types.d.ts +6 -5
  68. package/dist/components/Modal/types.d.ts.map +1 -1
  69. package/dist/components/MultipleSelect/components/SelectArea/Label.js +1 -1
  70. package/dist/components/Select/index.d.ts.map +1 -1
  71. package/dist/components/Select/index.js +61 -31
  72. package/dist/components/Select/styles.d.ts +13 -0
  73. package/dist/components/Select/styles.d.ts.map +1 -1
  74. package/dist/components/Select/styles.js +22 -4
  75. package/dist/components/Select/types.d.ts +2 -0
  76. package/dist/components/Select/types.d.ts.map +1 -1
  77. package/dist/components/Spinner/styles.d.ts +1 -0
  78. package/dist/components/Spinner/styles.d.ts.map +1 -1
  79. package/dist/components/Table/index.d.ts.map +1 -1
  80. package/dist/components/Table/index.js +13 -3
  81. package/dist/components/Table/styles.d.ts.map +1 -1
  82. package/dist/components/Table/styles.js +53 -8
  83. package/dist/components/Tag/styles.d.ts +3 -0
  84. package/dist/components/Tag/styles.d.ts.map +1 -1
  85. package/dist/components/Toast/components/Toast.d.ts.map +1 -1
  86. package/dist/components/Toast/components/Toast.js +6 -7
  87. package/dist/components/Toast/contexts/ToastProvider.d.ts.map +1 -1
  88. package/dist/components/Toast/contexts/ToastProvider.js +3 -1
  89. package/dist/components/Toast/toast.test.js +10 -10
  90. package/dist/components/Toast/types.d.ts +8 -15
  91. package/dist/components/Toast/types.d.ts.map +1 -1
  92. package/dist/components/Tooltip/components/TooltipLabel.d.ts +4 -0
  93. package/dist/components/Tooltip/components/TooltipLabel.d.ts.map +1 -0
  94. package/dist/components/Tooltip/components/TooltipLabel.js +59 -0
  95. package/dist/components/Tooltip/index.d.ts +2 -2
  96. package/dist/components/Tooltip/index.d.ts.map +1 -1
  97. package/dist/components/Tooltip/index.js +85 -84
  98. package/dist/components/Tooltip/styles.d.ts +6 -14
  99. package/dist/components/Tooltip/styles.d.ts.map +1 -1
  100. package/dist/components/Tooltip/styles.js +9 -38
  101. package/dist/components/Tooltip/types.d.ts +17 -19
  102. package/dist/components/Tooltip/types.d.ts.map +1 -1
  103. package/dist/components/Tooltip/util.d.ts +0 -4
  104. package/dist/components/Tooltip/util.d.ts.map +1 -1
  105. package/dist/components/Tooltip/util.js +1 -87
  106. package/dist/components/Typography/index.js +1 -1
  107. package/dist/components/Typography/styles.d.ts +3 -3
  108. package/dist/index.d.ts +8 -7
  109. package/dist/index.d.ts.map +1 -1
  110. package/dist/index.js +30 -21
  111. package/dist/shared/hooks/useDisableBodyScroll.js +2 -2
  112. package/dist/shared/hooks/useWindowSize.d.ts +5 -0
  113. package/dist/shared/hooks/useWindowSize.d.ts.map +1 -0
  114. package/dist/shared/hooks/useWindowSize.js +46 -0
  115. package/dist/shared/theme/hooks/useTheme.d.ts +1 -0
  116. package/dist/shared/theme/hooks/useTheme.d.ts.map +1 -1
  117. package/dist/shared/theme/theme.d.ts +1 -0
  118. package/dist/shared/theme/theme.d.ts.map +1 -1
  119. package/dist/shared/theme/theme.js +1 -0
  120. package/dist/utils/getColorValue.d.ts +1 -9
  121. package/dist/utils/getColorValue.d.ts.map +1 -1
  122. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Table/styles.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,eAAO,MAAM,WAAW;;;uIAkGtB,CAAC;AAEH,eAAO,MAAM,cAAc;;;yGAG1B,CAAC;AAEF,eAAO,MAAM,aAAa;;;0IA6DxB,CAAC;AAEH,eAAO,MAAM,eAAe;;;yGAE3B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;0IAiBhC,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;yGAoB7B,CAAC;AAEF,eAAO,MAAM,eAAe;;;8HAyB3B,CAAC"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Table/styles.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,eAAO,MAAM,WAAW;;;uIAoGtB,CAAC;AAEH,eAAO,MAAM,cAAc;;;yGAG1B,CAAC;AAEF,eAAO,MAAM,aAAa;;;0IAmExB,CAAC;AAEH,eAAO,MAAM,eAAe;;;yGAE3B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;0IAiBhC,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;yGAiB7B,CAAC;AAEF,eAAO,MAAM,eAAe;;;8HA6B3B,CAAC"}
@@ -17,7 +17,28 @@ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(
17
17
 
18
18
  var StyledTable = _styled.default.table(function (props) {
19
19
  var theme = props.theme;
20
- return (0, _react.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-spacing: 0px;\n\n & > thead {\n & > tr {\n height: 64px;\n\n & > th {\n border-top: 1px solid\n ", ";\n border-bottom: 1px solid\n ", ";\n padding-left: 16px;\n padding-right: 16px;\n\n text-align: left;\n\n color: ", ";\n\n &:first-of-type {\n border-left: 1px solid\n ", ";\n border-radius: 8px 0px 0px 0px;\n }\n\n &:last-child {\n border-right: 1px solid\n ", ";\n border-radius: 0px 8px 0px 0px;\n }\n }\n }\n }\n\n & > tbody {\n tr {\n height: 64px;\n\n &:not(:last-child) {\n & > td {\n border-bottom: 1px solid\n ", ";\n }\n }\n\n &:hover {\n & > td {\n background: ", ";\n\n &:first-of-type {\n border-radius: 4px 0px 0px 4px;\n }\n\n &:last-child {\n border-radius: 0px 4px 4px 0px;\n }\n }\n }\n\n &:focus {\n outline: 2px solid ", ";\n border-radius: 4px;\n }\n\n &[data-selected='true'] {\n & > td {\n background: ", ";\n }\n }\n\n & > td {\n padding-left: 16px;\n padding-right: 16px;\n\n text-align: left;\n\n color: ", ";\n }\n }\n }\n "])), theme.colorMode === 'dark' ? theme.colors.neutral.neutral5 : theme.colors.neutral.neutral2, theme.colorMode === 'dark' ? theme.colors.neutral.neutral5 : theme.colors.neutral.neutral2, theme.colors.neutral.neutral6, theme.colorMode === 'dark' ? theme.colors.neutral.neutral5 : theme.colors.neutral.neutral2, theme.colorMode === 'dark' ? theme.colors.neutral.neutral5 : theme.colors.neutral.neutral2, theme.colorMode === 'dark' ? theme.colors.neutral.neutral5 : theme.colors.neutral.neutral2, theme.colorMode === 'dark' ? theme.colors.neutral.neutral6 : theme.colors.neutral.neutral1, theme.colors.primary.focus, theme.colorMode === 'dark' ? theme.colors.neutral.neutral6 : theme.colors.neutral.neutral1, theme.colors.neutral.neutral5);
20
+ return (0, _react.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-spacing: 0px;\n\n & > thead {\n & > tr {\n height: 64px;\n\n & > th {\n background: hsla(156, 13%, 92%, 0.5);\n border-top: 1px solid\n ", ";\n border-bottom: 1px solid\n ", ";\n padding-left: 16px;\n padding-right: 16px;\n text-align: left;\n\n &:first-of-type {\n border-left: 1px solid\n ", ";\n border-radius: 8px 0px 0px 0px;\n }\n\n &:last-child {\n border-right: 1px solid\n ", ";\n border-radius: 0px 8px 0px 0px;\n }\n }\n }\n }\n\n & > tbody {\n tr {\n height: 64px;\n &:nth-child(even) {\n background: hsla(150, 16%, 97%, 0.75);\n }\n &:not(:last-child) {\n & > td {\n border-bottom: 1px solid\n ", ";\n }\n }\n\n &:hover {\n & > td {\n background: ", ";\n\n &:first-of-type {\n border-radius: 4px 0px 0px 4px;\n }\n\n &:last-child {\n border-radius: 0px 4px 4px 0px;\n }\n }\n }\n\n &:focus {\n outline: 2px solid ", ";\n border-radius: 4px;\n }\n\n &[data-selected='true'] {\n & > td {\n background: ", ";\n }\n }\n\n & > td {\n padding-left: 16px;\n padding-right: 16px;\n\n text-align: left;\n\n color: ", ";\n }\n }\n }\n "])), {
21
+ dark: theme.colors.neutral.neutral5,
22
+ light: theme.colors.neutral.neutral2
23
+ }[theme.colorMode], {
24
+ dark: theme.colors.neutral.neutral5,
25
+ light: theme.colors.neutral.neutral2
26
+ }[theme.colorMode], {
27
+ dark: theme.colors.neutral.neutral5,
28
+ light: theme.colors.neutral.neutral2
29
+ }[theme.colorMode], {
30
+ dark: theme.colors.neutral.neutral5,
31
+ light: theme.colors.neutral.neutral2
32
+ }[theme.colorMode], {
33
+ dark: theme.colors.neutral.neutral5,
34
+ light: theme.colors.neutral.neutral1
35
+ }[theme.colorMode], {
36
+ dark: theme.colors.neutral.neutral6,
37
+ light: theme.colors.neutral.neutral1
38
+ }[theme.colorMode], theme.colors.primary.focus, {
39
+ dark: theme.colors.neutral.neutral6,
40
+ light: theme.colors.neutral.neutral1
41
+ }[theme.colorMode], theme.colors.neutral.neutral5);
21
42
  });
22
43
 
23
44
  exports.StyledTable = StyledTable;
@@ -28,7 +49,22 @@ exports.SelectedHeader = SelectedHeader;
28
49
 
29
50
  var ActionsButton = _styled.default.button(function (props) {
30
51
  var theme = props.theme;
31
- return (0, _react.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n appearance: none;\n font-family: inherit;\n\n display: flex;\n align-items: center;\n gap: 8px;\n\n margin: 0px -2px 0px 0px;\n outline: none;\n border: 2px solid\n ", ";\n padding: 0px 24px;\n\n height: 44px;\n\n white-space: nowrap;\n\n color: ", ";\n background: ", ";\n\n transition: background-color linear ", ";\n\n cursor: pointer;\n -webkit-tap-highlight-color: transparent;\n\n &:first-of-type {\n color: ", ";\n border-radius: 8px 0px 0px 8px;\n }\n\n &:last-of-type {\n border-radius: 0px 8px 8px 0px;\n }\n\n &:only-child {\n border-radius: 8px;\n }\n\n &:hover,\n &:focus {\n z-index: 1;\n\n border-color: ", ";\n background: ", ";\n }\n\n &:active {\n background: ", ";\n }\n "])), theme.colorMode === 'dark' ? theme.colors.neutral.neutral4 : theme.colors.neutral.neutral2, theme.colors.neutral.neutral5, theme.colorMode === 'dark' ? theme.colors.neutral.black : theme.colors.neutral.white, theme.transition.speed, theme.colors.neutral.black, theme.colorMode === 'dark' ? theme.colors.neutral.neutral4 : theme.colors.neutral.neutral3, theme.colorMode === 'dark' ? theme.colors.neutral.neutral5 : theme.colors.neutral.neutral1, theme.colorMode === 'dark' ? theme.colors.neutral.neutral4 : theme.colors.neutral.neutral2);
52
+ return (0, _react.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n appearance: none;\n font-family: inherit;\n\n display: flex;\n align-items: center;\n gap: 8px;\n\n margin: 0px -2px 0px 0px;\n outline: none;\n border: 2px solid\n ", ";\n padding: 0px 24px;\n height: 44px;\n\n white-space: nowrap;\n\n color: ", ";\n background: ", ";\n\n transition: background-color linear ", ";\n\n cursor: pointer;\n -webkit-tap-highlight-color: transparent;\n\n &:first-of-type {\n color: ", ";\n border-radius: 8px 0px 0px 8px;\n }\n\n &:last-of-type {\n border-radius: 0px 8px 8px 0px;\n }\n\n &:only-child {\n border-radius: 8px;\n }\n\n &:hover,\n &:focus {\n z-index: 1;\n\n border-color: ", ";\n background: ", ";\n }\n\n &:active {\n background: ", ";\n }\n "])), {
53
+ dark: theme.colors.neutral.neutral4,
54
+ light: theme.colors.neutral.neutral2
55
+ }[theme.colorMode], theme.colors.neutral.neutral5, {
56
+ dark: theme.colors.neutral.black,
57
+ light: theme.colors.neutral.white
58
+ }[theme.colorMode], theme.transition.speed, theme.colors.neutral.black, {
59
+ dark: theme.colors.neutral.neutral4,
60
+ light: theme.colors.neutral.neutral3
61
+ }[theme.colorMode], {
62
+ dark: theme.colors.neutral.neutral5,
63
+ light: theme.colors.neutral.neutral1
64
+ }[theme.colorMode], {
65
+ dark: theme.colors.neutral.neutral4,
66
+ light: theme.colors.neutral.neutral2
67
+ }[theme.colorMode]);
32
68
  });
33
69
 
34
70
  exports.ActionsButton = ActionsButton;
@@ -47,8 +83,9 @@ exports.VerticalPointsButton = VerticalPointsButton;
47
83
 
48
84
  var MenuItemContainer = _styled.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: ", ";\n position: absolute;\n border-radius: 8px;\n background-color: ", ";\n box-shadow: 0px 8px 24px rgba(0, 0, 0, 0.1);\n right: ", "px;\n top: ", "px;\n padding: 10px;\n\n z-index: ", ";\n"])), function (props) {
49
85
  return props.isOpen ? 'block' : 'none';
50
- }, function (props) {
51
- return props.theme.colorMode === 'dark' ? props.theme.colors.neutral.neutral5 : props.theme.colors.neutral.white;
86
+ }, function (_ref) {
87
+ var theme = _ref.theme;
88
+ return theme.colors.neutral.white;
52
89
  }, function (props) {
53
90
  return props.posRight ? props.posRight : 0;
54
91
  }, function (props) {
@@ -59,12 +96,20 @@ var MenuItemContainer = _styled.default.div(_templateObject6 || (_templateObject
59
96
 
60
97
  exports.MenuItemContainer = MenuItemContainer;
61
98
 
62
- var MenuItemContent = _styled.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n border-radius: 8px;\n padding: 10px 35px;\n cursor: pointer;\n user-select: none;\n font-size: 1rem;\n white-space: nowrap;\n\n color: ", ";\n\n transition: background linear ", ";\n\n &:hover {\n background: ", ";\n }\n"])), function (props) {
63
- return props.theme.colorMode === 'dark' ? props.theme.colors.neutral.white : props.theme.colors.neutral.black;
99
+ var MenuItemContent = _styled.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n border-radius: 8px;\n padding: 10px 35px;\n cursor: pointer;\n user-select: none;\n font-size: 1rem;\n white-space: nowrap;\n\n color: ", ";\n\n transition: background linear ", ";\n\n &:hover {\n background: ", ";\n }\n"])), function (_ref2) {
100
+ var theme = _ref2.theme;
101
+ return {
102
+ dark: theme.colors.neutral.white,
103
+ light: theme.colors.neutral.black
104
+ }[theme.colorMode];
64
105
  }, function (props) {
65
106
  return props.theme.transition.speed;
66
- }, function (props) {
67
- return props.theme.colorMode === 'dark' ? props.theme.colors.neutral.neutral4 : props.theme.colors.neutral.neutral1;
107
+ }, function (_ref3) {
108
+ var theme = _ref3.theme;
109
+ return {
110
+ dark: theme.colors.neutral.neutral4,
111
+ light: theme.colors.neutral.neutral1
112
+ }[theme.colorMode];
68
113
  });
69
114
 
70
115
  exports.MenuItemContent = MenuItemContent;
@@ -8,6 +8,7 @@ export declare const Wrapper: import("@emotion/styled").StyledComponent<{
8
8
  size?: string | undefined;
9
9
  theme?: {
10
10
  fontSizes: {
11
+ tiny: string;
11
12
  xxxs: string;
12
13
  xxs: string;
13
14
  xs: string;
@@ -294,6 +295,7 @@ export declare const Text: import("@emotion/styled").StyledComponent<{
294
295
  } & {
295
296
  theme?: {
296
297
  fontSizes: {
298
+ tiny: string;
297
299
  xxxs: string;
298
300
  xxs: string;
299
301
  xs: string;
@@ -582,6 +584,7 @@ export declare const Close: import("@emotion/styled").StyledComponent<{
582
584
  } & {
583
585
  theme?: {
584
586
  fontSizes: {
587
+ tiny: string;
585
588
  xxxs: string;
586
589
  xxs: string;
587
590
  xs: string;
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Tag/styles.ts"],"names":[],"mappings":";AAIA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yGAoBnB,CAAC;AAEF,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAGN,OAAO;2GASjB,CAAC;AAEF,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qHA2BjB,CAAC"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Tag/styles.ts"],"names":[],"mappings":";AAIA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yGAoBnB,CAAC;AAEF,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAGN,OAAO;2GASjB,CAAC;AAEF,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qHA2BjB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../../src/components/Toast/components/Toast.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAa,MAAM,OAAO,CAAC;AAOtC,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,UAAU,CAAC;AAEhD,QAAA,MAAM,KAAK,EAAE,EAAE,CAAC,WAAW,CA2E1B,CAAC;AAEF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../../src/components/Toast/components/Toast.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAa,MAAM,OAAO,CAAC;AAOtC,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,UAAU,CAAC;AAEhD,QAAA,MAAM,KAAK,EAAE,EAAE,CAAC,WAAW,CAyE1B,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -23,12 +23,12 @@ var Toast = function Toast(_ref) {
23
23
  var type = _ref.type,
24
24
  close = _ref.close,
25
25
  duration = _ref.duration,
26
- message = _ref.message,
26
+ content = _ref.content,
27
+ icon = _ref.icon,
27
28
  id = _ref.toastId,
28
- buttonTitle = _ref.buttonTitle,
29
- onButtonClick = _ref.onButtonClick,
30
29
  title = _ref.title,
31
- position = _ref.position;
30
+ _ref$position = _ref.position,
31
+ position = _ref$position === void 0 ? 'top-right' : _ref$position;
32
32
  (0, _react.useEffect)(function () {
33
33
  var timer = setTimeout(function () {
34
34
  close(id);
@@ -73,12 +73,11 @@ var Toast = function Toast(_ref) {
73
73
  className: "pp-toast-".concat(position),
74
74
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.StyledToastComponent, {
75
75
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Alert.default, {
76
- message: message,
76
+ content: content,
77
77
  title: title,
78
+ icon: icon,
78
79
  variant: "closable",
79
80
  type: type,
80
- buttonTitle: buttonTitle,
81
- onButtonClick: onButtonClick,
82
81
  onClose: handleCloseButtonClick
83
82
  })
84
83
  })
@@ -1 +1 @@
1
- {"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/Toast/contexts/ToastProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,EAAE,EAAyB,MAAM,OAAO,CAAC;AAGjE,OAAO,EAA4B,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAExE,eAAO,MAAM,YAAY,6CAA0C,CAAC;AAEpE,QAAA,MAAM,aAAa,EAAE,EAiCpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/Toast/contexts/ToastProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,EAAE,EAAyB,MAAM,OAAO,CAAC;AAGjE,OAAO,EAA4B,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAExE,eAAO,MAAM,YAAY,6CAA0C,CAAC;AAEpE,QAAA,MAAM,aAAa,EAAE,EAmCpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -53,9 +53,11 @@ var ToastProvider = function ToastProvider(_ref) {
53
53
  var addToast = function addToast(options) {
54
54
  var toastOptions = {
55
55
  config: _objectSpread(_objectSpread({}, options), {}, {
56
+ icon: options.icon || 'info',
56
57
  duration: options.duration || 5000,
57
58
  type: options.type || 'default',
58
- position: options.position || 'bottom'
59
+ position: options.position || 'bottom',
60
+ onClose: options.onClose || undefined
59
61
  }),
60
62
  id: Math.random().toString(36).substring(2, 9)
61
63
  };
@@ -28,7 +28,7 @@ describe('Toast', function () {
28
28
  it('should it render the toast on the screen', function () {
29
29
  var container = setup({
30
30
  title: 'Toast Title',
31
- message: 'Toast Message',
31
+ content: 'Toast Message',
32
32
  type: 'success'
33
33
  });
34
34
  container.getByText('Show toast').click();
@@ -37,7 +37,7 @@ describe('Toast', function () {
37
37
  it('should it render the toast on position top of the screen', function () {
38
38
  var container = setup({
39
39
  title: 'Toast Title',
40
- message: 'Toast Message',
40
+ content: 'Toast Message',
41
41
  type: 'success',
42
42
  position: 'top'
43
43
  });
@@ -47,7 +47,7 @@ describe('Toast', function () {
47
47
  it('should it render the toast on position top-left of the screen', function () {
48
48
  var container = setup({
49
49
  title: 'Toast Title',
50
- message: 'Toast Message',
50
+ content: 'Toast Message',
51
51
  type: 'success',
52
52
  position: 'top-left'
53
53
  });
@@ -57,7 +57,7 @@ describe('Toast', function () {
57
57
  it('should it render the toast on position top-right of the screen', function () {
58
58
  var container = setup({
59
59
  title: 'Toast Title',
60
- message: 'Toast Message',
60
+ content: 'Toast Message',
61
61
  type: 'success',
62
62
  position: 'top-right'
63
63
  });
@@ -67,7 +67,7 @@ describe('Toast', function () {
67
67
  it('should it render the toast on position bottom of the screen', function () {
68
68
  var container = setup({
69
69
  title: 'Toast Title',
70
- message: 'Toast Message',
70
+ content: 'Toast Message',
71
71
  type: 'success',
72
72
  position: 'bottom'
73
73
  });
@@ -77,7 +77,7 @@ describe('Toast', function () {
77
77
  it('should it render the toast on position bottom-left of the screen', function () {
78
78
  var container = setup({
79
79
  title: 'Toast Title',
80
- message: 'Toast Message',
80
+ content: 'Toast Message',
81
81
  type: 'success',
82
82
  position: 'bottom-left'
83
83
  });
@@ -87,7 +87,7 @@ describe('Toast', function () {
87
87
  it('should it render the toast on position bottom-right of the screen', function () {
88
88
  var container = setup({
89
89
  title: 'Toast Title',
90
- message: 'Toast Message',
90
+ content: 'Toast Message',
91
91
  type: 'success',
92
92
  position: 'bottom-right'
93
93
  });
@@ -99,7 +99,7 @@ describe('Toast', function () {
99
99
 
100
100
  var container = setup({
101
101
  title: 'Toast Title',
102
- message: 'Toast Message',
102
+ content: 'Toast Message',
103
103
  type: 'success'
104
104
  });
105
105
  container.getByText('Show toast').click();
@@ -114,7 +114,7 @@ describe('Toast', function () {
114
114
  var onClose = jest.fn();
115
115
  var container = setup({
116
116
  title: 'Toast Title',
117
- message: 'Toast Message',
117
+ content: 'Toast Message',
118
118
  type: 'success',
119
119
  onClose: onClose
120
120
  });
@@ -128,7 +128,7 @@ describe('Toast', function () {
128
128
  var onClose = jest.fn();
129
129
  var container = setup({
130
130
  title: 'Toast Title',
131
- message: 'Toast Message',
131
+ content: 'Toast Message',
132
132
  type: 'success',
133
133
  onClose: onClose
134
134
  });
@@ -1,28 +1,21 @@
1
+ import { ReactNode } from 'react';
2
+ import { IconName } from '../Icon/types';
1
3
  export declare type IToastConfig = {
2
4
  title: string;
3
- message: string;
5
+ content: ReactNode;
4
6
  position?: 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right';
5
7
  type?: 'default' | 'success' | 'warning' | 'error' | 'critical';
6
- buttonTitle?: string;
7
- onButtonClick?: () => void;
8
8
  duration?: number;
9
- onClose?: (id: string) => void;
10
- };
11
- export declare type IToastConfigOnList = {
12
- title: string;
13
- message: string;
14
- position: 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right';
15
- type: 'default' | 'success' | 'warning' | 'error' | 'critical';
16
- buttonTitle?: string;
17
- onButtonClick?: () => void;
18
- duration: number;
9
+ icon?: IconName;
19
10
  onClose?: (id: string) => void;
20
11
  };
21
12
  export declare type IToastList = {
22
13
  id: string;
23
- config: IToastConfigOnList;
14
+ config: Required<Omit<IToastConfig, 'onClose'>> & {
15
+ onClose?: (id: string) => void;
16
+ };
24
17
  };
25
- export declare type Toast = IToastConfigOnList & {
18
+ export declare type Toast = IToastConfig & {
26
19
  toastId: string;
27
20
  close: (id: string) => void;
28
21
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/types.ts"],"names":[],"mappings":"AAAA,oBAAY,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,KAAK,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,cAAc,CAAC;IACxF,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,CAAC;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC,CAAC;AAEF,oBAAY,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,KAAK,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,cAAc,CAAC;IACvF,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,CAAC;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC,CAAC;AAEF,oBAAY,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,kBAAkB,CAAC;CAC5B,CAAC;AAEF,oBAAY,KAAK,GAAG,kBAAkB,GAAG;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B,CAAC;AAEF,oBAAY,kBAAkB,GAAG;IAC/B,GAAG,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IACrC,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,MAAM,EAAE,UAAU,EAAE,CAAC;CACtB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,oBAAY,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,cAAc,CAAC;IACxF,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,CAAC;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC,CAAC;AAEF,oBAAY,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,GAAG;QAChD,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;KAChC,CAAC;CACH,CAAC;AAEF,oBAAY,KAAK,GAAG,YAAY,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B,CAAC;AAEF,oBAAY,kBAAkB,GAAG;IAC/B,GAAG,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IACrC,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,MAAM,EAAE,UAAU,EAAE,CAAC;CACtB,CAAC"}
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { TooltipLabelProps } from '../types';
3
+ export declare function TooltipLabel({ tooltipPositions, handleRepositionTooltip, animationDuration, ...rest }: TooltipLabelProps): JSX.Element;
4
+ //# sourceMappingURL=TooltipLabel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TooltipLabel.d.ts","sourceRoot":"","sources":["../../../../src/components/Tooltip/components/TooltipLabel.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,wBAAgB,YAAY,CAAC,EAC3B,gBAAgB,EAChB,uBAAuB,EACvB,iBAAuB,EACvB,GAAG,IAAI,EACR,EAAE,iBAAiB,eAgCnB"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TooltipLabel = TooltipLabel;
7
+
8
+ var _react = require("react");
9
+
10
+ var _styles = require("../styles");
11
+
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+
14
+ var _excluded = ["tooltipPositions", "handleRepositionTooltip", "animationDuration"];
15
+
16
+ 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; }
17
+
18
+ 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; }
19
+
20
+ 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; }
21
+
22
+ 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; }
23
+
24
+ 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; }
25
+
26
+ function TooltipLabel(_ref) {
27
+ var tooltipPositions = _ref.tooltipPositions,
28
+ handleRepositionTooltip = _ref.handleRepositionTooltip,
29
+ _ref$animationDuratio = _ref.animationDuration,
30
+ animationDuration = _ref$animationDuratio === void 0 ? 0.2 : _ref$animationDuratio,
31
+ rest = _objectWithoutProperties(_ref, _excluded);
32
+
33
+ var labelRef = (0, _react.useRef)(null);
34
+ var animations = {
35
+ enter: {
36
+ opacity: 1
37
+ },
38
+ exit: {
39
+ opacity: 0
40
+ }
41
+ };
42
+ (0, _react.useEffect)(function () {
43
+ if (labelRef.current) {
44
+ handleRepositionTooltip(labelRef.current);
45
+ }
46
+ }, []);
47
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.StyledTooltipLabel, _objectSpread(_objectSpread({
48
+ ref: labelRef,
49
+ initial: animations.exit,
50
+ animate: animations.enter,
51
+ exit: animations.exit,
52
+ transition: {
53
+ duration: animationDuration
54
+ },
55
+ style: tooltipPositions
56
+ }, rest), {}, {
57
+ children: rest.label
58
+ }));
59
+ }
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { IInputProps } from './types';
3
- declare const Tooltip: FC<IInputProps>;
2
+ import { TooltipProps } from './types';
3
+ declare const Tooltip: FC<TooltipProps>;
4
4
  export default Tooltip;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAA+B,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAOtC,QAAA,MAAM,OAAO,EAAE,EAAE,CAAC,WAAW,CAsF5B,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAoB,MAAM,OAAO,CAAC;AAG7C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,QAAA,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CAuF7B,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -5,17 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
+ var _framerMotion = require("framer-motion");
9
+
8
10
  var _react = require("react");
9
11
 
10
- var _theme = require("../../shared/theme");
12
+ var _TooltipLabel = require("./components/TooltipLabel");
11
13
 
12
14
  var _styles = require("./styles");
13
15
 
14
- var _componenteTeste = require("./componenteTeste");
15
-
16
16
  var _jsxRuntime = require("react/jsx-runtime");
17
17
 
18
- var _excluded = ["position", "maxWidth", "label", "labelColor", "animationDuration", "backgroundColor", "width", "children"];
18
+ var _excluded = ["position", "offset"];
19
19
 
20
20
  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; }
21
21
 
@@ -41,100 +41,101 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
41
41
 
42
42
  var Tooltip = function Tooltip(_ref) {
43
43
  var _ref$position = _ref.position,
44
- position = _ref$position === void 0 ? 'top' : _ref$position,
45
- _ref$maxWidth = _ref.maxWidth,
46
- maxWidth = _ref$maxWidth === void 0 ? '280px' : _ref$maxWidth,
47
- _ref$label = _ref.label,
48
- label = _ref$label === void 0 ? 'Testin' : _ref$label,
49
- labelColor = _ref.labelColor,
50
- _ref$animationDuratio = _ref.animationDuration,
51
- animationDuration = _ref$animationDuratio === void 0 ? 0.2 : _ref$animationDuratio,
52
- backgroundColor = _ref.backgroundColor,
53
- width = _ref.width,
54
- children = _ref.children,
55
- rest = _objectWithoutProperties(_ref, _excluded);
56
-
57
- var _useTheme = (0, _theme.useTheme)(),
58
- theme = _useTheme.theme;
44
+ position = _ref$position === void 0 ? 'bottom' : _ref$position,
45
+ _ref$offset = _ref.offset,
46
+ offset = _ref$offset === void 0 ? 10 : _ref$offset,
47
+ props = _objectWithoutProperties(_ref, _excluded);
59
48
 
60
49
  var _useState = (0, _react.useState)(false),
61
50
  _useState2 = _slicedToArray(_useState, 2),
62
51
  showTooltip = _useState2[0],
63
52
  setShowTooltip = _useState2[1];
64
53
 
65
- var motionDiv = (0, _react.useRef)(null);
66
- var componentDiv = (0, _react.useRef)(null);
67
-
68
- function positionTooltip() {
69
- var tooltip = motionDiv.current;
70
-
71
- var tooltipInitialValues = _objectSpread({}, tooltip);
72
-
73
- var container = componentDiv.current;
74
-
75
- if (tooltip !== null && container !== null) {
76
- var tooltipDimensions = tooltip.getBoundingClientRect();
77
- tooltip.style = _objectSpread({}, tooltipInitialValues.style);
78
-
79
- if (window.innerWidth < 500 && (tooltipDimensions.x < 0 || tooltipDimensions.x > window.innerWidth)) {
80
- tooltip.style.top = container.offsetHeight + 5 + 'px';
81
- tooltip.style.left = '0px';
82
- tooltip.style.right = '0px';
83
- } else if (tooltipDimensions.x < 0) {
84
- tooltip.style.left = container.offsetWidth + 5 + 'px';
85
- tooltip.style.width = 'max-content';
86
- tooltip.style.height = 'max-content';
87
- } else if (tooltipDimensions.y < 0 || tooltipDimensions.x > window.innerWidth) {
88
- tooltip.style.height = 'max-content';
89
- tooltip.style.top = container.offsetHeight + 5 + 'px';
90
- tooltip.style.left = container.offsetWidth / 2 - tooltip.offsetWidth / 2 + 'px';
54
+ var _useState3 = (0, _react.useState)({
55
+ top: 0,
56
+ left: 0,
57
+ transform: ''
58
+ }),
59
+ _useState4 = _slicedToArray(_useState3, 2),
60
+ tooltipPositions = _useState4[0],
61
+ setTooltipPositions = _useState4[1];
62
+
63
+ var tooltipContentRef = (0, _react.useRef)(null);
64
+
65
+ function refreshTooltipPosition(newPosition) {
66
+ if (tooltipContentRef.current) {
67
+ var tooltipContentRect = tooltipContentRef.current.getBoundingClientRect();
68
+
69
+ switch (newPosition) {
70
+ case 'top':
71
+ setTooltipPositions({
72
+ top: tooltipContentRect.top - tooltipContentRect.height - offset,
73
+ left: tooltipContentRect.left + tooltipContentRect.width / 2,
74
+ transform: 'translate(-50%, -50%)'
75
+ });
76
+ break;
77
+
78
+ case 'bottom':
79
+ setTooltipPositions({
80
+ top: tooltipContentRect.top + tooltipContentRect.height + offset,
81
+ left: tooltipContentRect.left + tooltipContentRect.width / 2,
82
+ transform: 'translateX(-50%)'
83
+ });
84
+ break;
85
+
86
+ case 'left':
87
+ setTooltipPositions({
88
+ top: tooltipContentRect.top + tooltipContentRect.height / 2,
89
+ left: tooltipContentRect.left - offset,
90
+ transform: 'translate(-100%, -50%)'
91
+ });
92
+ break;
93
+
94
+ case 'right':
95
+ setTooltipPositions({
96
+ top: tooltipContentRect.top + tooltipContentRect.height / 2,
97
+ left: tooltipContentRect.left + tooltipContentRect.width + offset,
98
+ transform: 'translateY(-50%)'
99
+ });
100
+ break;
91
101
  }
92
102
  }
93
103
  }
94
104
 
95
- (0, _react.useEffect)(function () {
96
- positionTooltip();
97
- }, [showTooltip]);
98
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.TooltipComponentWrapper, {
99
- position: position,
100
- backgroundColor: backgroundColor,
101
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.TooltipTarget, {
105
+ function handleRepositionTooltip(element) {
106
+ var elementRect = element.getBoundingClientRect();
107
+ var top = elementRect.top,
108
+ left = elementRect.left,
109
+ width = elementRect.width,
110
+ height = elementRect.height;
111
+
112
+ if (left < 0) {
113
+ refreshTooltipPosition('right');
114
+ } else if (left + width > window.innerWidth) {
115
+ refreshTooltipPosition('left');
116
+ } else if (top < 0) {
117
+ refreshTooltipPosition('bottom');
118
+ } else if (top + height > window.innerHeight) {
119
+ refreshTooltipPosition('top');
120
+ }
121
+ }
122
+
123
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
124
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.TooltipWrapper, {
125
+ ref: tooltipContentRef,
102
126
  onMouseEnter: function onMouseEnter() {
103
- return setShowTooltip(true);
127
+ refreshTooltipPosition(position);
128
+ setShowTooltip(true);
104
129
  },
105
130
  onMouseLeave: function onMouseLeave() {
106
- return setShowTooltip(false);
107
- },
108
- "data-testid": "tooltip-target",
109
- ref: componentDiv,
110
- children: children || /*#__PURE__*/(0, _jsxRuntime.jsx)(_componenteTeste.ComponentTeste, {})
111
- }), showTooltip && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.MotionDiv, {
112
- initial: {
113
- opacity: 0
114
- },
115
- animate: {
116
- opacity: 1
117
- },
118
- exit: {
119
- opacity: 0
120
- },
121
- transition: {
122
- duration: animationDuration
131
+ setShowTooltip(false);
123
132
  },
124
- className: "TooltipArea",
125
- "data-testid": "tooltip-area",
126
- ref: motionDiv,
127
- position: position,
128
- backgroundColor: backgroundColor,
129
- isLabelString: typeof label === 'string' && label.length > 0,
130
- width: width,
131
- maxWidth: maxWidth,
132
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.TooltipWrapper, {
133
- labelColor: labelColor,
134
- children: label || /*#__PURE__*/(0, _jsxRuntime.jsx)(_componenteTeste.TesteComponent, {
135
- theme: theme
136
- })
137
- })
133
+ children: props.children
134
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_framerMotion.AnimatePresence, {
135
+ children: showTooltip && /*#__PURE__*/(0, _jsxRuntime.jsx)(_TooltipLabel.TooltipLabel, _objectSpread({
136
+ tooltipPositions: tooltipPositions,
137
+ handleRepositionTooltip: handleRepositionTooltip
138
+ }, props))
138
139
  })]
139
140
  });
140
141
  };