@pedidopago/ui 1.4.0 → 1.4.1

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 (37) 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 +2 -2
  7. package/dist/components/MultipleSelect/components/SelectArea/index.d.ts.map +1 -1
  8. package/dist/components/MultipleSelect/components/SelectArea/styles.d.ts +7 -1
  9. package/dist/components/MultipleSelect/components/SelectArea/styles.d.ts.map +1 -1
  10. package/dist/components/MultipleSelect/components/SelectArea/styles.js +11 -3
  11. package/dist/components/MultipleSelect/index.d.ts.map +1 -1
  12. package/dist/components/MultipleSelect/index.js +42 -27
  13. package/dist/components/MultipleSelect/types.d.ts +4 -3
  14. package/dist/components/MultipleSelect/types.d.ts.map +1 -1
  15. package/dist/components/Rating/index.d.ts +3 -4
  16. package/dist/components/Rating/index.d.ts.map +1 -1
  17. package/dist/components/Rating/index.js +143 -58
  18. package/dist/components/Rating/rating.test.d.ts +1 -1
  19. package/dist/components/Rating/rating.test.d.ts.map +1 -1
  20. package/dist/components/Rating/rating.test.js +51 -74
  21. package/dist/components/Rating/styles.d.ts +19 -0
  22. package/dist/components/Rating/styles.d.ts.map +1 -0
  23. package/dist/components/Rating/styles.js +38 -0
  24. package/dist/components/Rating/types.d.ts +16 -25
  25. package/dist/components/Rating/types.d.ts.map +1 -1
  26. package/dist/components/Select/components/OptionsSelect/styles.d.ts +2 -253
  27. package/dist/components/Select/components/OptionsSelect/styles.d.ts.map +1 -1
  28. package/dist/components/Select/components/OptionsSelect/styles.js +2 -3
  29. package/dist/components/Select/index.js +1 -1
  30. package/dist/components/Toast/contexts/ToastProvider.d.ts.map +1 -1
  31. package/dist/components/Toast/contexts/ToastProvider.js +7 -3
  32. package/dist/components/Toast/index.d.ts.map +1 -1
  33. package/dist/components/Toast/index.js +4 -1
  34. package/dist/index.d.ts +1 -1
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +2 -2
  37. 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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alElement = (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,9 +1,9 @@
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;
@@ -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,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,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,CAoIjD,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),
@@ -102,6 +109,7 @@ var MultipleSelect = function MultipleSelect(_ref) {
102
109
  });
103
110
  newSelectedOptions.splice(indexToRemove, 1);
104
111
  setSelectedOptions(newSelectedOptions);
112
+ onChangeValue === null || onChangeValue === void 0 ? void 0 : onChangeValue(newSelectedOptions);
105
113
  }
106
114
 
107
115
  (0, _react.useEffect)(function () {
@@ -139,32 +147,39 @@ var MultipleSelect = function MultipleSelect(_ref) {
139
147
  setShowOptionsArea(false);
140
148
  }
141
149
  }, [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
150
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Flex.default, {
151
+ direction: "column",
152
+ spacing: "1",
153
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.InputWrapper, {
154
+ ref: InputWrapperRef,
155
+ width: width,
156
+ fullWidth: fullWidth,
157
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectArea, {
158
+ disabled: disabled,
159
+ label: label,
160
+ multiple: multiple,
161
+ setShowOptionsArea: setShowOptionsArea,
162
+ removeSelectedOption: removeSelectedOption,
163
+ selectedOptions: selectedOptions,
164
+ setSelectedOptions: setSelectedOptions,
165
+ toggleOptionsAreaView: toggleOptionsAreaView,
166
+ inputAlert: inputAlert,
167
+ placeholder: placeholder,
168
+ dropDownIcon: dropDownIcon
169
+ }), showOptionsArea && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.OptionsArea, {
170
+ AutoComplete: AutoComplete,
171
+ setShowOptionsArea: setShowOptionsArea,
172
+ inputAlert: inputAlert,
173
+ chooseOption: chooseOption,
174
+ selectedOptions: selectedOptions,
175
+ data: data,
176
+ scrollHandler: scrollHandler,
177
+ showOptionsArea: showOptionsArea,
178
+ onChangeSearch: onChangeSearch
179
+ })]
180
+ }), !!helperText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.HelperText, {
181
+ selectType: selectType,
182
+ children: helperText
168
183
  })]
169
184
  });
170
185
  };
@@ -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;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ACxC,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"}