@pedidopago/ui 1.4.0 → 1.4.3

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 (34) hide show
  1. package/dist/components/Modal/styles.d.ts.map +1 -1
  2. package/dist/components/Modal/styles.js +1 -1
  3. package/dist/components/MultipleSelect/components/OptionsArea/index.d.ts +2 -2
  4. package/dist/components/MultipleSelect/components/OptionsArea/index.d.ts.map +1 -1
  5. package/dist/components/MultipleSelect/components/SelectArea/SelectAreaWrapper.d.ts.map +1 -1
  6. package/dist/components/MultipleSelect/components/SelectArea/index.d.ts +3 -3
  7. package/dist/components/MultipleSelect/components/SelectArea/index.d.ts.map +1 -1
  8. package/dist/components/MultipleSelect/components/SelectArea/index.js +2 -2
  9. package/dist/components/MultipleSelect/components/SelectArea/styles.d.ts +7 -1
  10. package/dist/components/MultipleSelect/components/SelectArea/styles.d.ts.map +1 -1
  11. package/dist/components/MultipleSelect/components/SelectArea/styles.js +11 -3
  12. package/dist/components/MultipleSelect/index.d.ts.map +1 -1
  13. package/dist/components/MultipleSelect/index.js +48 -27
  14. package/dist/components/MultipleSelect/types.d.ts +4 -3
  15. package/dist/components/MultipleSelect/types.d.ts.map +1 -1
  16. package/dist/components/Rating/index.d.ts +3 -4
  17. package/dist/components/Rating/index.d.ts.map +1 -1
  18. package/dist/components/Rating/index.js +143 -58
  19. package/dist/components/Rating/rating.test.d.ts +1 -1
  20. package/dist/components/Rating/rating.test.d.ts.map +1 -1
  21. package/dist/components/Rating/rating.test.js +51 -74
  22. package/dist/components/Rating/styles.d.ts +19 -0
  23. package/dist/components/Rating/styles.d.ts.map +1 -0
  24. package/dist/components/Rating/styles.js +38 -0
  25. package/dist/components/Rating/types.d.ts +16 -25
  26. package/dist/components/Rating/types.d.ts.map +1 -1
  27. package/dist/components/Toast/contexts/ToastProvider.d.ts.map +1 -1
  28. package/dist/components/Toast/contexts/ToastProvider.js +7 -3
  29. package/dist/components/Toast/index.d.ts.map +1 -1
  30. package/dist/components/Toast/index.js +4 -1
  31. package/dist/index.d.ts +1 -1
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +2 -2
  34. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/styles.ts"],"names":[],"mappings":";AACA,OAAO,EAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAG5C,UAAU,mBAAmB;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,cAAc;;;+HAczB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UACjB,OAAO;;;UAsCb,CAAC;AAEH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YACV,OAAO;UAcf,CAAC"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/styles.ts"],"names":[],"mappings":";AACA,OAAO,EAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAG5C,UAAU,mBAAmB;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,cAAc;;;+HAczB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UACjB,OAAO;;;UAuCb,CAAC;AAEH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YACV,OAAO;UAcf,CAAC"}
@@ -36,7 +36,7 @@ var ModalElement = (0, _styled.default)(_framerMotion.motion.div)(function (_ref
36
36
  var theme = _ref2.theme,
37
37
  props = _objectWithoutProperties(_ref2, _excluded2);
38
38
 
39
- return (0, _react.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 100%;\n max-height: ", ";\n border-radius: ", ";\n overflow-y: auto;\n overflow-x: hidden;\n background: ", ";\n box-shadow: ", ";\n transition: all ease ", ";\n\n &::-webkit-scrollbar {\n width: 6px;\n }\n\n &::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &::-webkit-scrollbar-thumb {\n border-radius: ", ";\n background: ", ";\n }\n\n ", "\n "])), props.maxHeight, theme.borderRadius.default, theme.colors.background.light, theme.shadow.level1, theme.transition.speed, theme.borderRadius.default, theme.colors.primary.default, props.hideScrollBar && (0, _react.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ::-webkit-scrollbar {\n display: none;\n }\n\n scrollbar-width: none;\n\n -ms-overflow-style: none;\n "]))));
39
+ return (0, _react.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 100%;\n max-height: ", ";\n border-radius: ", ";\n overflow-y: auto;\n overflow-x: hidden;\n background: ", ";\n box-shadow: ", ";\n transition: all ease ", ";\n scroll-behavior: smooth;\n\n &::-webkit-scrollbar {\n width: 6px;\n }\n\n &::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &::-webkit-scrollbar-thumb {\n border-radius: ", ";\n background: ", ";\n }\n\n ", "\n "])), props.maxHeight, theme.borderRadius.default, theme.colors.background.light, theme.shadow.level1, theme.transition.speed, theme.borderRadius.default, theme.colors.primary.default, props.hideScrollBar && (0, _react.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ::-webkit-scrollbar {\n display: none;\n }\n\n scrollbar-width: none;\n\n -ms-overflow-style: none;\n "]))));
40
40
  });
41
41
  exports.ModalElement = ModalElement;
42
42
  var Overlay = (0, _styled.default)(_framerMotion.motion.div)(function (props) {
@@ -1,7 +1,7 @@
1
1
  import { UIEvent } from 'react';
2
- import { AlertType, SelectData } from '../../types';
2
+ import { SelectType, SelectData } from '../../types';
3
3
  interface IOptionsAreaProps {
4
- inputAlert: AlertType;
4
+ inputAlert: SelectType;
5
5
  showOptionsArea: boolean;
6
6
  data: SelectData[];
7
7
  selectedOptions: SelectData[];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/MultipleSelect/components/OptionsArea/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,OAAO,EAA4C,MAAM,OAAO,CAAC;AACzF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGpD,UAAU,iBAAiB;IACzB,UAAU,EAAE,SAAS,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,eAAe,EAAE,UAAU,EAAE,CAAC;IAC9B,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IAC3C,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IACpD,kBAAkB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAID,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,aAAa,EACb,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,cAAc,GACf,EAAE,iBAAiB,eAqGnB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/MultipleSelect/components/OptionsArea/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,OAAO,EAA4C,MAAM,OAAO,CAAC;AACzF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGrD,UAAU,iBAAiB;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,eAAe,EAAE,UAAU,EAAE,CAAC;IAC9B,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IAC3C,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IACpD,kBAAkB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAID,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,aAAa,EACb,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,cAAc,GACf,EAAE,iBAAiB,eAqGnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"SelectAreaWrapper.d.ts","sourceRoot":"","sources":["../../../../../src/components/MultipleSelect/components/SelectArea/SelectAreaWrapper.ts"],"names":[],"mappings":";AAGA,OAAO,EAAa,WAAW,EAAE,MAAM,aAAa,CAAC;AAGrD,eAAO,MAAM,iBAAiB;;;uHAoB7B,CAAC"}
1
+ {"version":3,"file":"SelectAreaWrapper.d.ts","sourceRoot":"","sources":["../../../../../src/components/MultipleSelect/components/SelectArea/SelectAreaWrapper.ts"],"names":[],"mappings":";AAGA,OAAO,EAAc,WAAW,EAAE,MAAM,aAAa,CAAC;AAGtD,eAAO,MAAM,iBAAiB;;;uHAoB7B,CAAC"}
@@ -1,14 +1,14 @@
1
- import { AlertType, SelectData } from '../../types';
1
+ import { SelectType, SelectData } from '../../types';
2
2
  import { MouseEvent, ReactElement } from 'react';
3
3
  interface ISelectAreaProps {
4
4
  disabled: boolean;
5
5
  label?: string;
6
- inputAlert?: AlertType;
6
+ inputAlert?: SelectType;
7
7
  dropDownIcon?: ReactElement;
8
8
  multiple?: boolean;
9
9
  placeholder?: string;
10
10
  selectedOptions: SelectData[];
11
- removeSelectedOption: (e: MouseEvent<HTMLElement>, option: SelectData) => void;
11
+ removeSelectedOption: (e: MouseEvent<HTMLElement>, option?: SelectData) => void;
12
12
  setShowOptionsArea: (show: boolean) => void;
13
13
  setSelectedOptions: (array: SelectData[]) => void;
14
14
  toggleOptionsAreaView: (e: MouseEvent<HTMLElement>) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/MultipleSelect/components/SelectArea/index.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGjD,UAAU,gBAAgB;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,UAAU,EAAE,CAAC;IAC9B,oBAAoB,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IAC/E,kBAAkB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,kBAAkB,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;IAClD,qBAAqB,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CAC7D;AAED,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,KAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,UAAU,EACV,QAAQ,EACR,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,WAAW,GACZ,EAAE,gBAAgB,eAoDlB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/MultipleSelect/components/SelectArea/index.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGjD,UAAU,gBAAgB;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,UAAU,EAAE,CAAC;IAC9B,oBAAoB,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAChF,kBAAkB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,kBAAkB,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;IAClD,qBAAqB,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CAC7D;AAED,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,KAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,UAAU,EACV,QAAQ,EACR,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,WAAW,GACZ,EAAE,gBAAgB,eAsDlB"}
@@ -72,8 +72,8 @@ function SelectArea(_ref) {
72
72
  tabIndex: 0,
73
73
  disabled: disabled,
74
74
  show: selectedOptions.length > 0,
75
- onClick: function onClick() {
76
- return setSelectedOptions([]);
75
+ onClick: function onClick(e) {
76
+ removeSelectedOption(e);
77
77
  },
78
78
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
79
79
  name: "x",
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { IStyleProps } from '../../types';
2
+ import { IStyleProps, SelectType } from '../../types';
3
3
  export declare const Label: import("@emotion/styled").StyledComponent<{
4
4
  theme?: import("@emotion/react").Theme | undefined;
5
5
  as?: import("react").ElementType<any> | undefined;
@@ -8,4 +8,10 @@ export declare const Placeholder: import("@emotion/styled").StyledComponent<{
8
8
  theme?: import("@emotion/react").Theme | undefined;
9
9
  as?: import("react").ElementType<any> | undefined;
10
10
  } & IStyleProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {}>;
11
+ export declare const HelperText: import("@emotion/styled").StyledComponent<{
12
+ theme?: import("@emotion/react").Theme | undefined;
13
+ as?: import("react").ElementType<any> | undefined;
14
+ } & {
15
+ selectType: SelectType;
16
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
11
17
  //# sourceMappingURL=styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/MultipleSelect/components/SelectArea/styles.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,eAAO,MAAM,KAAK;;;gIAyBjB,CAAC;AAEF,eAAO,MAAM,WAAW;;;mIAWvB,CAAC"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/MultipleSelect/components/SelectArea/styles.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtD,eAAO,MAAM,KAAK;;;gIAyBjB,CAAC;AAEF,eAAO,MAAM,WAAW;;;mIAWvB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;gBAA6B,UAAU;2GAU7D,CAAC"}
@@ -3,13 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Placeholder = exports.Label = void 0;
6
+ exports.Placeholder = exports.Label = exports.HelperText = void 0;
7
7
 
8
8
  var _styled = _interopRequireDefault(require("@emotion/styled"));
9
9
 
10
10
  var _react = require("@emotion/react");
11
11
 
12
- var _templateObject, _templateObject2, _templateObject3;
12
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
@@ -39,4 +39,12 @@ var Placeholder = _styled.default.p(_templateObject3 || (_templateObject3 = _tag
39
39
  return props.theme.colors.neutral.neutral3;
40
40
  });
41
41
 
42
- exports.Placeholder = Placeholder;
42
+ exports.Placeholder = Placeholder;
43
+
44
+ var HelperText = _styled.default.span(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-size: ", ";\n\n color: ", ";\n padding: 0 20px;\n"])), function (props) {
45
+ return props.theme.fontSizes.xxs;
46
+ }, function (props) {
47
+ return props.selectType && props.selectType !== 'success' ? props.theme.colors[props.selectType].default : props.theme.colorMode === 'dark' ? props.theme.colors.neutral.neutral2 : props.theme.colors.neutral.neutral4;
48
+ });
49
+
50
+ exports.HelperText = HelperText;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/MultipleSelect/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,EAAE,EAOH,MAAM,OAAO,CAAC;AAEf,OAAO,EAAa,iBAAiB,EAAc,MAAM,SAAS,CAAC;AAEnE,aAAK,KAAK,GAAG,wBAAwB,CAAC,GAAG,CAAC,CAAC;AAI3C,QAAA,MAAM,cAAc,EAAE,EAAE,CAAC,iBAAiB,GAAG,KAAK,CA+HjD,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/MultipleSelect/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,EAAE,EAOH,MAAM,OAAO,CAAC;AAIf,OAAO,EAAc,iBAAiB,EAAc,MAAM,SAAS,CAAC;AAEpE,aAAK,KAAK,GAAG,wBAAwB,CAAC,GAAG,CAAC,CAAC;AAI3C,QAAA,MAAM,cAAc,EAAE,EAAE,CAAC,iBAAiB,GAAG,KAAK,CA0IjD,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -7,10 +7,16 @@ exports.default = void 0;
7
7
 
8
8
  var _react = require("react");
9
9
 
10
+ var _Flex = _interopRequireDefault(require("../Flex"));
11
+
10
12
  var _components = require("./components");
11
13
 
14
+ var _styles = require("./components/SelectArea/styles");
15
+
12
16
  var _jsxRuntime = require("react/jsx-runtime");
13
17
 
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
14
20
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
15
21
 
16
22
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -56,7 +62,8 @@ var MultipleSelect = function MultipleSelect(_ref) {
56
62
  dropDownIcon = _ref.dropDownIcon,
57
63
  placeholder = _ref.placeholder,
58
64
  defaultSelectedOptions = _ref.defaultSelectedOptions,
59
- value = _ref.value;
65
+ value = _ref.value,
66
+ helperText = _ref.helperText;
60
67
 
61
68
  var _useState = (0, _react.useState)(selectType),
62
69
  _useState2 = _slicedToArray(_useState, 2),
@@ -95,6 +102,12 @@ var MultipleSelect = function MultipleSelect(_ref) {
95
102
  function removeSelectedOption(event, option) {
96
103
  event.stopPropagation();
97
104
 
105
+ if (!option) {
106
+ setSelectedOptions([]);
107
+ onChangeValue === null || onChangeValue === void 0 ? void 0 : onChangeValue([]);
108
+ return;
109
+ }
110
+
98
111
  var newSelectedOptions = _toConsumableArray(selectedOptions);
99
112
 
100
113
  var indexToRemove = selectedOptions.findIndex(function (chosenOption) {
@@ -102,6 +115,7 @@ var MultipleSelect = function MultipleSelect(_ref) {
102
115
  });
103
116
  newSelectedOptions.splice(indexToRemove, 1);
104
117
  setSelectedOptions(newSelectedOptions);
118
+ onChangeValue === null || onChangeValue === void 0 ? void 0 : onChangeValue(newSelectedOptions);
105
119
  }
106
120
 
107
121
  (0, _react.useEffect)(function () {
@@ -139,32 +153,39 @@ var MultipleSelect = function MultipleSelect(_ref) {
139
153
  setShowOptionsArea(false);
140
154
  }
141
155
  }, [selectedOptions, multiple, setSelectedOptions, maxSelects]);
142
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.InputWrapper, {
143
- ref: InputWrapperRef,
144
- width: width,
145
- fullWidth: fullWidth,
146
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectArea, {
147
- disabled: disabled,
148
- label: label,
149
- multiple: multiple,
150
- setShowOptionsArea: setShowOptionsArea,
151
- removeSelectedOption: removeSelectedOption,
152
- selectedOptions: selectedOptions,
153
- setSelectedOptions: setSelectedOptions,
154
- toggleOptionsAreaView: toggleOptionsAreaView,
155
- inputAlert: inputAlert,
156
- placeholder: placeholder,
157
- dropDownIcon: dropDownIcon
158
- }), showOptionsArea && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.OptionsArea, {
159
- AutoComplete: AutoComplete,
160
- setShowOptionsArea: setShowOptionsArea,
161
- inputAlert: inputAlert,
162
- chooseOption: chooseOption,
163
- selectedOptions: selectedOptions,
164
- data: data,
165
- scrollHandler: scrollHandler,
166
- showOptionsArea: showOptionsArea,
167
- onChangeSearch: onChangeSearch
156
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Flex.default, {
157
+ direction: "column",
158
+ spacing: "1",
159
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.InputWrapper, {
160
+ ref: InputWrapperRef,
161
+ width: width,
162
+ fullWidth: fullWidth,
163
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectArea, {
164
+ disabled: disabled,
165
+ label: label,
166
+ multiple: multiple,
167
+ setShowOptionsArea: setShowOptionsArea,
168
+ removeSelectedOption: removeSelectedOption,
169
+ selectedOptions: selectedOptions,
170
+ setSelectedOptions: setSelectedOptions,
171
+ toggleOptionsAreaView: toggleOptionsAreaView,
172
+ inputAlert: inputAlert,
173
+ placeholder: placeholder,
174
+ dropDownIcon: dropDownIcon
175
+ }), showOptionsArea && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.OptionsArea, {
176
+ AutoComplete: AutoComplete,
177
+ setShowOptionsArea: setShowOptionsArea,
178
+ inputAlert: inputAlert,
179
+ chooseOption: chooseOption,
180
+ selectedOptions: selectedOptions,
181
+ data: data,
182
+ scrollHandler: scrollHandler,
183
+ showOptionsArea: showOptionsArea,
184
+ onChangeSearch: onChangeSearch
185
+ })]
186
+ }), !!helperText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.HelperText, {
187
+ selectType: selectType,
188
+ children: helperText
168
189
  })]
169
190
  });
170
191
  };
@@ -4,7 +4,7 @@ export declare type SelectData = {
4
4
  label: string;
5
5
  value: string;
6
6
  };
7
- export declare type AlertType = 'informative' | 'success' | 'error' | 'warning' | undefined;
7
+ export declare type SelectType = 'success' | 'error' | 'warning' | 'informative' | 'critical' | 'success_secondary' | 'warning_secondary' | undefined;
8
8
  export interface IStyleProps {
9
9
  width?: string;
10
10
  fullWidth?: boolean;
@@ -13,7 +13,7 @@ export interface IStyleProps {
13
13
  show?: boolean;
14
14
  selected?: boolean;
15
15
  itensLength?: number;
16
- selectType?: AlertType;
16
+ selectType?: SelectType;
17
17
  theme?: ExtendThemeProps;
18
18
  active?: boolean;
19
19
  }
@@ -25,10 +25,11 @@ export interface ISelectInputProps {
25
25
  width?: string;
26
26
  fullWidth?: boolean;
27
27
  disabled?: boolean;
28
- selectType?: AlertType;
28
+ selectType?: SelectType;
29
29
  dropDownIcon?: ReactElement;
30
30
  AutoComplete?: boolean;
31
31
  value?: Array<SelectData>;
32
+ helperText?: string;
32
33
  defaultSelectedOptions?: Array<SelectData>;
33
34
  onChangeValue?: (data: Array<SelectData>) => void;
34
35
  onChangeSearch?: (data: string) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/MultipleSelect/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAEvC,oBAAY,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,oBAAY,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAEpF,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,YAAY,CAA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E,KAAK,CAAC,UAAU,CAAC,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sBAAsB,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC3C,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAClD,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACtC"}
@@ -1,5 +1,4 @@
1
- import { FC } from 'react';
2
- import { IInputProps } from './types';
3
- declare const RatingComponent: FC<IInputProps>;
4
- export default RatingComponent;
1
+ import { HTMLAttributes } from 'react';
2
+ import { RatingProps } from './types';
3
+ export declare const Rating: import("react").ForwardRefExoticComponent<RatingProps & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Rating/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAOtC,QAAA,MAAM,eAAe,EAAE,EAAE,CAAC,WAAW,CAoDpC,CAAC;AACF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Rating/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,cAAc,EAEf,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAItC,eAAO,MAAM,MAAM,yIA4FlB,CAAC"}
@@ -1,75 +1,160 @@
1
1
  "use strict";
2
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
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
- exports.default = void 0;
7
-
8
- var _theme = require("../../shared/theme");
8
+ exports.Rating = void 0;
9
9
 
10
- var _react = require("@emotion/react");
10
+ var _react = require("react");
11
11
 
12
- var _RatingWithMultipleValues = require("./components/RatingWithMultipleValues/RatingWithMultipleValues");
12
+ var _Icon = _interopRequireDefault(require("../Icon"));
13
13
 
14
- var _RatingWithSingleValue = require("./components/RatingWithSingleValue/RatingWithSingleValue");
14
+ var S = _interopRequireWildcard(require("./styles"));
15
15
 
16
16
  var _jsxRuntime = require("react/jsx-runtime");
17
17
 
18
- var RatingComponent = function RatingComponent(_ref) {
18
+ var _excluded = ["precision", "value", "quantity", "colorFilledIcon", "colorOutlinedIcon", "size", "readOnly", "filledIcon", "outlinedIcon", "onChange"];
19
+
20
+ 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); }
21
+
22
+ 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; }
23
+
24
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
+
26
+ 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; }
27
+
28
+ 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; }
29
+
30
+ 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; }
31
+
32
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
33
+
34
+ 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."); }
35
+
36
+ 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); }
37
+
38
+ 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; }
39
+
40
+ 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; }
41
+
42
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
43
+
44
+ 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; }
45
+
46
+ 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; }
47
+
48
+ var Rating = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
19
49
  var _ref$precision = _ref.precision,
20
- precision = _ref$precision === void 0 ? '0.5' : _ref$precision,
21
- _ref$name = _ref.name,
22
- name = _ref$name === void 0 ? 'star' : _ref$name,
23
- _ref$size = _ref.size,
24
- size = _ref$size === void 0 ? 'medium' : _ref$size,
25
- _ref$disabled = _ref.disabled,
26
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
50
+ precision = _ref$precision === void 0 ? 1 : _ref$precision,
27
51
  _ref$value = _ref.value,
28
52
  value = _ref$value === void 0 ? 0 : _ref$value,
29
- primaryColor = _ref.primaryColor,
30
- secondaryColor = _ref.secondaryColor,
31
- strokeColor = _ref.strokeColor,
32
- _ref$iconsQuantity = _ref.iconsQuantity,
33
- iconsQuantity = _ref$iconsQuantity === void 0 ? 5 : _ref$iconsQuantity,
34
- _ref$defaultValue = _ref.defaultValue,
35
- defaultValue = _ref$defaultValue === void 0 ? 0 : _ref$defaultValue,
53
+ _ref$quantity = _ref.quantity,
54
+ quantity = _ref$quantity === void 0 ? 5 : _ref$quantity,
55
+ _ref$colorFilledIcon = _ref.colorFilledIcon,
56
+ colorFilledIcon = _ref$colorFilledIcon === void 0 ? 'primary.default' : _ref$colorFilledIcon,
57
+ _ref$colorOutlinedIco = _ref.colorOutlinedIcon,
58
+ colorOutlinedIcon = _ref$colorOutlinedIco === void 0 ? 'success.blurred' : _ref$colorOutlinedIco,
59
+ _ref$size = _ref.size,
60
+ size = _ref$size === void 0 ? '24px' : _ref$size,
36
61
  _ref$readOnly = _ref.readOnly,
37
62
  readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
38
- onChangeValue = _ref.onChangeValue,
39
- onChange = _ref.onChange;
40
-
41
- var _useTheme = (0, _theme.useTheme)(),
42
- theme = _useTheme.theme;
43
-
44
- var parsedSize = size === 'small' ? '16px' : size === 'medium' ? '24px' : size === 'large' ? '32px' : size;
45
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.ThemeProvider, {
46
- theme: theme,
47
- children: name !== 'satisfaction' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_RatingWithMultipleValues.RatingWithMultipleValues, {
48
- name: name,
49
- defaultValue: defaultValue,
50
- disabled: disabled,
51
- iconsQuantity: iconsQuantity,
52
- precision: precision,
53
- readOnly: readOnly,
54
- primaryColor: primaryColor,
55
- secondaryColor: secondaryColor,
56
- strokeColor: strokeColor,
57
- value: value,
58
- size: parsedSize,
59
- onChangeValue: onChangeValue,
60
- onChange: onChange
61
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_RatingWithSingleValue.RatingWithSingleValue, {
62
- disabled: disabled,
63
- size: parsedSize,
64
- onChange: onChange,
65
- primaryColor: primaryColor,
66
- secondaryColor: secondaryColor,
67
- strokeColor: strokeColor,
68
- onChangeValue: onChangeValue,
69
- readOnly: readOnly
70
- })
71
- });
72
- };
63
+ _ref$filledIcon = _ref.filledIcon,
64
+ filledIcon = _ref$filledIcon === void 0 ? 'ecc-star' : _ref$filledIcon,
65
+ _ref$outlinedIcon = _ref.outlinedIcon,
66
+ outlinedIcon = _ref$outlinedIcon === void 0 ? 'star' : _ref$outlinedIcon,
67
+ onChange = _ref.onChange,
68
+ rest = _objectWithoutProperties(_ref, _excluded);
69
+
70
+ var _useState = (0, _react.useState)(value),
71
+ _useState2 = _slicedToArray(_useState, 2),
72
+ activeStar = _useState2[0],
73
+ setActiveStar = _useState2[1];
74
+
75
+ var _useState3 = (0, _react.useState)(0),
76
+ _useState4 = _slicedToArray(_useState3, 2),
77
+ hoverActiveStar = _useState4[0],
78
+ setHoverActiveStar = _useState4[1];
79
+
80
+ var _useState5 = (0, _react.useState)(false),
81
+ _useState6 = _slicedToArray(_useState5, 2),
82
+ isHovered = _useState6[0],
83
+ setIsHovered = _useState6[1];
84
+
85
+ var ratingContainerRef = (0, _react.useRef)(null);
86
+ var activeState = isHovered ? hoverActiveStar : activeStar;
87
+ var isActiveRating = activeState !== 1;
88
+ var isRatingWithPrecision = activeState % 1 !== 0;
89
+
90
+ function calculateRating(clientX) {
91
+ if (!ratingContainerRef.current) return 0;
73
92
 
74
- var _default = RatingComponent;
75
- exports.default = _default;
93
+ var _ratingContainerRef$c = ratingContainerRef.current.getBoundingClientRect(),
94
+ width = _ratingContainerRef$c.width,
95
+ left = _ratingContainerRef$c.left;
96
+
97
+ var percent = (clientX - left) / width;
98
+ var numberInStars = percent * quantity;
99
+ return Math.round((numberInStars + precision / 2) / precision) * precision;
100
+ }
101
+
102
+ function handleClick(e) {
103
+ var targetRating = calculateRating(e.clientX);
104
+ setIsHovered(false);
105
+ setActiveStar(targetRating);
106
+ onChange === null || onChange === void 0 ? void 0 : onChange(calculateRating(targetRating));
107
+ }
108
+
109
+ function handleMouseMove(e) {
110
+ setIsHovered(true);
111
+ setHoverActiveStar(calculateRating(e.clientX));
112
+ }
113
+
114
+ function handleMouseLeave() {
115
+ setHoverActiveStar(0);
116
+ setIsHovered(false);
117
+ }
118
+
119
+ (0, _react.useImperativeHandle)(ref, function () {
120
+ return ratingContainerRef.current;
121
+ });
122
+ (0, _react.useEffect)(function () {
123
+ setActiveStar(value);
124
+ }, [value]);
125
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(S.RatingContainer, _objectSpread(_objectSpread({
126
+ readOnly: readOnly,
127
+ onClick: handleClick,
128
+ onMouseMove: handleMouseMove,
129
+ onMouseLeave: handleMouseLeave,
130
+ ref: ratingContainerRef
131
+ }, rest), {}, {
132
+ children: Array.from(Array(quantity).keys()).map(function (_, index) {
133
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(S.ContainerIcon, {
134
+ readOnly: readOnly,
135
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(S.ContainerFilled, {
136
+ role: "button",
137
+ showRatingWithPrecision: isActiveRating && isRatingWithPrecision && Math.ceil(activeState) === index + 1,
138
+ activeState: activeState,
139
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
140
+ name: filledIcon,
141
+ color: colorFilledIcon,
142
+ size: size
143
+ })
144
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
145
+ children: activeState === 0 || activeState < index + 1 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
146
+ name: outlinedIcon,
147
+ color: colorOutlinedIcon,
148
+ size: size
149
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
150
+ name: filledIcon,
151
+ color: colorFilledIcon,
152
+ size: size
153
+ })
154
+ })]
155
+ }, index);
156
+ })
157
+ }));
158
+ });
159
+ exports.Rating = Rating;
160
+ Rating.displayName = 'Rating';
@@ -1,2 +1,2 @@
1
- import '@testing-library/jest-dom/extend-expect';
1
+ import '@testing-library/jest-dom';
2
2
  //# sourceMappingURL=rating.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rating.test.d.ts","sourceRoot":"","sources":["../../../src/components/Rating/rating.test.tsx"],"names":[],"mappings":"AAGA,OAAO,yCAAyC,CAAC"}
1
+ {"version":3,"file":"rating.test.d.ts","sourceRoot":"","sources":["../../../src/components/Rating/rating.test.tsx"],"names":[],"mappings":"AAEA,OAAO,2BAA2B,CAAC"}
@@ -1,102 +1,79 @@
1
1
  "use strict";
2
2
 
3
+ var _index = require("./index");
4
+
5
+ require("@testing-library/jest-dom");
6
+
3
7
  var _testUtils = require("../../shared/tests/test-utils");
4
8
 
5
9
  var _react = require("@testing-library/react");
6
10
 
7
- require("@testing-library/jest-dom/extend-expect");
8
-
9
- var _ = _interopRequireDefault(require("."));
11
+ var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
10
12
 
11
13
  var _jsxRuntime = require("react/jsx-runtime");
12
14
 
13
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
16
 
15
- 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; }
16
-
17
- 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; }
18
-
19
- 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; }
20
-
21
- var setup = function setup() {
22
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
23
- var utils = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, _objectSpread({}, props)));
24
- var RatingWrapper = utils.getByTestId('rating-wrapper');
25
- var RatingIcon = utils.getByTestId('rating-icon-0');
26
- return _objectSpread({
27
- RatingWrapper: RatingWrapper,
28
- RatingIcon: RatingIcon
29
- }, utils);
30
- };
31
-
32
17
  describe('Rating', function () {
33
- it('Should be Rendered', function () {
34
- var _setup = setup(),
35
- RatingWrapper = _setup.RatingWrapper;
36
-
37
- expect(RatingWrapper).toBeInTheDocument();
38
- expect(RatingWrapper.querySelectorAll('svg').length).toBeGreaterThan(1);
18
+ it('should be rendered', function () {
19
+ (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Rating, {}));
20
+ expect(_react.screen.getAllByRole('button')[4]).toBeInTheDocument();
39
21
  });
40
- it('should be able to render a icon with name prop', function () {
41
- var iconName = 'heart';
22
+ it('should be call onChange when onChange prop is provided', function () {
23
+ var onChange = jest.fn();
24
+ (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Rating, {
25
+ value: 5,
26
+ onChange: onChange
27
+ }));
42
28
 
43
- var _setup2 = setup({
44
- name: iconName
45
- }),
46
- RatingWrapper = _setup2.RatingWrapper;
29
+ _userEvent.default.click(_react.screen.getAllByRole('button')[4]);
47
30
 
48
- var oneSVG = RatingWrapper.querySelector('svg');
49
- var svgName = oneSVG === null || oneSVG === void 0 ? void 0 : oneSVG.getAttribute('name');
50
- expect(svgName).toBe(iconName);
31
+ expect(onChange).toHaveBeenCalled();
51
32
  });
52
- it('should be able to render any quantity of icons', function () {
53
- var _setup3 = setup({
54
- name: 'star',
55
- iconsQuantity: 8
56
- }),
57
- RatingWrapper = _setup3.RatingWrapper;
58
-
59
- var icons = RatingWrapper.querySelectorAll('svg');
60
- var iconsQuantity = icons.length;
61
- expect(iconsQuantity).toEqual(8);
33
+ it('should be able to render any quantity of icons ', function () {
34
+ (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Rating, {
35
+ value: 4,
36
+ quantity: 7
37
+ }));
38
+ expect(_react.screen.getAllByRole('button')[6]).toBeInTheDocument();
62
39
  });
63
40
  it('should be able to fill svg if hover', function () {
64
- var _setup4 = setup({
65
- name: 'star'
66
- }),
67
- RatingIcon = _setup4.RatingIcon;
41
+ (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Rating, {}));
68
42
 
69
- var RatingIconPath = RatingIcon.querySelector('path');
43
+ var RatingIcon = _react.screen.getAllByRole('button')[4];
70
44
 
71
- _react.fireEvent.mouseMove(RatingIconPath);
45
+ _react.fireEvent.mouseMove(RatingIcon);
72
46
 
73
- expect(RatingIcon === null || RatingIcon === void 0 ? void 0 : RatingIcon.style.fill).toBe('url(#star_gradient)');
47
+ expect(RatingIcon === null || RatingIcon === void 0 ? void 0 : RatingIcon.style.fill).not.toBe('none');
74
48
  });
75
49
  it('should be able to change precision', function () {
76
- var _setup5 = setup({
77
- name: 'star',
78
- precision: '1'
79
- }),
80
- RatingIcon = _setup5.RatingIcon;
81
-
82
- var RatingIconPath = RatingIcon.querySelector('path');
83
-
84
- _react.fireEvent.mouseMove(RatingIconPath);
85
-
86
- expect(RatingIcon === null || RatingIcon === void 0 ? void 0 : RatingIcon.style.fill).toBe('yellow');
50
+ (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Rating, {
51
+ value: 4.5,
52
+ precision: 0.5
53
+ }));
54
+ expect(_react.screen.getAllByRole('button')[4]).toBeInTheDocument();
87
55
  });
88
- it('should be able to change primary color', function () {
89
- var _setup6 = setup({
90
- name: 'star',
91
- precision: '1',
92
- primaryColor: 'red'
93
- }),
94
- RatingIcon = _setup6.RatingIcon;
95
-
96
- var RatingIconPath = RatingIcon.querySelector('path');
56
+ it('should be able to change color', function () {
57
+ (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Rating, {
58
+ value: 5,
59
+ colorFilledIcon: "neutral.neutral5"
60
+ }));
97
61
 
98
- _react.fireEvent.mouseMove(RatingIconPath);
62
+ var RatingIcon = _react.screen.getAllByRole('button')[0];
99
63
 
100
- expect(RatingIcon === null || RatingIcon === void 0 ? void 0 : RatingIcon.style.fill).toBe('red');
64
+ expect(RatingIcon.firstChild).toHaveStyle('fill: #587169;');
65
+ });
66
+ it('should be able to change size 40px', function () {
67
+ (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Rating, {
68
+ value: 5,
69
+ size: "40px"
70
+ }));
71
+
72
+ var RatingIcons = _react.screen.getAllByRole('button')[0];
73
+
74
+ expect(RatingIcons.firstChild).toHaveStyle({
75
+ width: 40,
76
+ height: 40
77
+ });
101
78
  });
102
79
  });
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ import { ContainerIconsProps } from './types';
3
+ export declare const RatingContainer: import("@emotion/styled").StyledComponent<{
4
+ theme?: import("@emotion/react").Theme | undefined;
5
+ as?: import("react").ElementType<any> | undefined;
6
+ } & {
7
+ readOnly: boolean;
8
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
9
+ export declare const ContainerIcon: import("@emotion/styled").StyledComponent<{
10
+ theme?: import("@emotion/react").Theme | undefined;
11
+ as?: import("react").ElementType<any> | undefined;
12
+ } & {
13
+ readOnly: boolean;
14
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
15
+ export declare const ContainerFilled: import("@emotion/styled").StyledComponent<{
16
+ theme?: import("@emotion/react").Theme | undefined;
17
+ as?: import("react").ElementType<any> | undefined;
18
+ } & ContainerIconsProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
19
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Rating/styles.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,eAAO,MAAM,eAAe;;;;cAA0B,OAAO;yGAQ5D,CAAC;AAEF,eAAO,MAAM,aAAa;;;;cAA0B,OAAO;yGAM1D,CAAC;AAEF,eAAO,MAAM,eAAe;;;+HAM3B,CAAC"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.RatingContainer = exports.ContainerIcon = exports.ContainerFilled = void 0;
7
+
8
+ var _styled = _interopRequireDefault(require("@emotion/styled"));
9
+
10
+ var _react = require("@emotion/react");
11
+
12
+ var _templateObject, _templateObject2, _templateObject3;
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
17
+
18
+ var RatingContainer = _styled.default.div(function (_ref) {
19
+ var readOnly = _ref.readOnly;
20
+ return (0, _react.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n position: relative;\n cursor: pointer;\n pointer-events: ", ";\n text-align: left;\n "])), readOnly ? 'none' : 'auto');
21
+ });
22
+
23
+ exports.RatingContainer = RatingContainer;
24
+
25
+ var ContainerIcon = _styled.default.div(function (_ref2) {
26
+ var readOnly = _ref2.readOnly;
27
+ return (0, _react.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n cursor: pointer;\n pointer-events: ", ";\n "])), readOnly ? 'none' : 'auto');
28
+ });
29
+
30
+ exports.ContainerIcon = ContainerIcon;
31
+
32
+ var ContainerFilled = _styled.default.div(function (_ref3) {
33
+ var showRatingWithPrecision = _ref3.showRatingWithPrecision,
34
+ activeState = _ref3.activeState;
35
+ return (0, _react.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: ", ";\n overflow: hidden;\n position: absolute;\n "])), showRatingWithPrecision ? "".concat(activeState % 1 * 100, "%") : '0%');
36
+ });
37
+
38
+ exports.ContainerFilled = ContainerFilled;
@@ -1,29 +1,20 @@
1
- import { ExtendThemeProps } from '../../shared/theme';
2
- import { GradientIconName } from './components/GradientIcon/types';
3
- export declare type SizeType = 'small' | 'medium' | 'large';
4
- export declare type IStyleProps = {
5
- primaryColor?: string;
6
- secondaryColor?: string;
7
- theme?: ExtendThemeProps;
8
- disabled?: boolean;
9
- active?: boolean;
10
- size?: SizeType;
11
- isActive?: boolean;
12
- SwitchType?: 'success' | 'error' | 'warning' | 'informative' | 'critical' | 'success_secondary' | 'warning_secondary';
13
- };
14
- export declare type IInputProps = {
15
- name: GradientIconName;
1
+ import { GlobalColorsProps } from '../../shared/theme';
2
+ import { IconName } from '../Icon/types';
3
+ export interface RatingProps {
4
+ precision?: 1 | 0.5 | 0.25;
16
5
  value?: number;
17
- defaultValue?: number;
18
- iconsQuantity?: number;
19
- precision?: '1' | '0.5';
20
- size?: SizeType;
6
+ quantity?: number;
7
+ colorFilledIcon?: GlobalColorsProps | (string & {});
8
+ colorOutlinedIcon?: GlobalColorsProps | (string & {});
9
+ size?: string;
21
10
  readOnly?: boolean;
22
- disabled?: boolean;
23
- primaryColor?: string;
24
- secondaryColor?: string;
25
- strokeColor?: string;
26
- onChangeValue?: (value: number) => void;
11
+ filledIcon?: IconName;
12
+ outlinedIcon?: IconName;
27
13
  onChange?: (value: number) => void;
28
- };
14
+ }
15
+ export interface ContainerIconsProps {
16
+ showRatingWithPrecision?: boolean;
17
+ showEmptyIcon?: boolean;
18
+ activeState: number;
19
+ }
29
20
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Rating/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,oBAAY,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEpD,oBAAY,WAAW,GAAG;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EACP,SAAS,GACT,OAAO,GACP,SAAS,GACT,aAAa,GACb,UAAU,GACV,mBAAmB,GACnB,mBAAmB,CAAC;CACzB,CAAC;AAEF,oBAAY,WAAW,GAAG;IACxB,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC;IACxB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Rating/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IACpD,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,QAAQ,CAAC;IACtB,YAAY,CAAC,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,MAAM,WAAW,mBAAmB;IAClC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB"}
@@ -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,EAmCpB,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,EAqCpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -65,12 +65,16 @@ var ToastProvider = function ToastProvider(_ref) {
65
65
  }, []);
66
66
  var remoteToast = (0, _react.useCallback)(function (id) {
67
67
  setToasts(function (prevState) {
68
- var _filterToast$0$config, _filterToast$0$config2;
69
-
70
68
  var filterToast = prevState.filter(function (toast) {
71
69
  return toast.id === id;
72
70
  });
73
- (_filterToast$0$config = (_filterToast$0$config2 = filterToast[0].config).onClose) === null || _filterToast$0$config === void 0 ? void 0 : _filterToast$0$config.call(_filterToast$0$config2, id);
71
+
72
+ if (filterToast[0]) {
73
+ var _filterToast$0$config, _filterToast$0$config2;
74
+
75
+ (_filterToast$0$config = (_filterToast$0$config2 = filterToast[0].config).onClose) === null || _filterToast$0$config === void 0 ? void 0 : _filterToast$0$config.call(_filterToast$0$config2, id);
76
+ }
77
+
74
78
  return prevState.filter(function (toast) {
75
79
  return toast.id !== id;
76
80
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/index.tsx"],"names":[],"mappings":";AAcA,QAAA,MAAM,cAAc,mBAuFnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/index.tsx"],"names":[],"mappings":";AAeA,QAAA,MAAM,cAAc,mBAuFnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -11,6 +11,8 @@ var _framerMotion = require("framer-motion");
11
11
 
12
12
  var _Toast = _interopRequireDefault(require("./components/Toast"));
13
13
 
14
+ var _ReactPortal = require("../ReactPortal");
15
+
14
16
  var _ToastProvider = require("./contexts/ToastProvider");
15
17
 
16
18
  var _styles = require("./styles");
@@ -30,7 +32,8 @@ var ToastContainer = function ToastContainer() {
30
32
  toasts = _useContext.toasts,
31
33
  remove = _useContext.remove;
32
34
 
33
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Fragment, {
35
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ReactPortal.ReactPortal, {
36
+ wrapperId: "toast-root",
34
37
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.StyledToastContainerOverlay, {
35
38
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.StyledToastManagerOverlay, {
36
39
  position: "top",
package/dist/index.d.ts CHANGED
@@ -19,7 +19,7 @@ export { default as List } from './components/List';
19
19
  export { Modal } from './components/Modal';
20
20
  export { Pagination } from './components/Pagination';
21
21
  export { default as Progress } from './components/Progress';
22
- export { default as Rating } from './components/Rating';
22
+ export { Rating } from './components/Rating';
23
23
  export { default as Skeleton } from './components/Skeleton';
24
24
  export { default as Slider } from './components/Slider';
25
25
  export { default as Spinner } from './components/Spinner';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,oBAAoB,CAAC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AAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,+CAA+C,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAGrF,cAAc,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -207,7 +207,7 @@ Object.defineProperty(exports, "Radio", {
207
207
  Object.defineProperty(exports, "Rating", {
208
208
  enumerable: true,
209
209
  get: function get() {
210
- return _Rating.default;
210
+ return _Rating.Rating;
211
211
  }
212
212
  });
213
213
  Object.defineProperty(exports, "ReactPortal", {
@@ -347,7 +347,7 @@ var _Pagination = require("./components/Pagination");
347
347
 
348
348
  var _Progress = _interopRequireDefault(require("./components/Progress"));
349
349
 
350
- var _Rating = _interopRequireDefault(require("./components/Rating"));
350
+ var _Rating = require("./components/Rating");
351
351
 
352
352
  var _Skeleton = _interopRequireDefault(require("./components/Skeleton"));
353
353
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pedidopago/ui",
3
- "version": "1.4.0",
3
+ "version": "1.4.3",
4
4
  "description": "Quick build beatiful Pedido Pago apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",