@mailstep/design-system 0.6.5-beta.2 → 0.6.5

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 (46) hide show
  1. package/package.json +1 -1
  2. package/ui/Blocks/CommonGrid/CommonGrid.d.ts +5 -2
  3. package/ui/Blocks/CommonGrid/CommonGrid.js +4 -35
  4. package/ui/Blocks/CommonGrid/CommonGridContainer.js +2 -2
  5. package/ui/Blocks/CommonGrid/components/HeadRow.d.ts +3 -3
  6. package/ui/Blocks/CommonGrid/components/HeadRow.js +1 -26
  7. package/ui/Blocks/CommonGrid/components/IconList/IconList.js +5 -5
  8. package/ui/Blocks/CommonGrid/components/ManageColumnForm/ManageColumnForm.d.ts +3 -1
  9. package/ui/Blocks/CommonGrid/components/ManageColumnForm/ManageColumnForm.js +16 -4
  10. package/ui/Blocks/CommonGrid/components/ManageColumnForm/components/ActionRow.d.ts +5 -1
  11. package/ui/Blocks/CommonGrid/components/ManageColumnForm/components/ActionRow.js +5 -4
  12. package/ui/Blocks/CommonGrid/hooks/useManageColumn.d.ts +5 -0
  13. package/ui/Blocks/CommonGrid/hooks/useManageColumn.js +76 -10
  14. package/ui/Blocks/CommonGrid/storybook/stories/loading.stories.js +1 -1
  15. package/ui/Blocks/CommonGrid/storybook/stories/manyColumnsNoScrollLayout.stories.js +1 -1
  16. package/ui/Blocks/CommonGrid/storybook/stories/manyColumnsNormalLayout.stories.js +1 -1
  17. package/ui/Blocks/CommonGrid/storybook/stories/withCustomGridActions.stories.js +1 -1
  18. package/ui/Blocks/CommonGrid/styles.d.ts +3 -1
  19. package/ui/Blocks/CommonGrid/types.d.ts +1 -2
  20. package/ui/Blocks/CommonGrid/utils/index.d.ts +1 -0
  21. package/ui/Blocks/CommonGrid/utils/index.js +13 -0
  22. package/ui/Elements/DropdownMenu/components/MenuItem.js +4 -5
  23. package/ui/Elements/Icon/icons/ArrowDown.d.ts +3 -0
  24. package/ui/Elements/Icon/icons/ArrowDown.js +13 -0
  25. package/ui/Elements/Icon/icons/ArrowUp.d.ts +3 -0
  26. package/ui/Elements/Icon/icons/ArrowUp.js +13 -0
  27. package/ui/Elements/Icon/icons/Cancel.js +1 -1
  28. package/ui/Elements/Icon/icons/index.d.ts +2 -0
  29. package/ui/Elements/Icon/icons/index.js +2 -0
  30. package/ui/Elements/Pagination/Pagination.d.ts +2 -4
  31. package/ui/Elements/Pagination/Pagination.js +15 -11
  32. package/ui/Elements/Pagination/index.d.ts +0 -1
  33. package/ui/Elements/Pagination/stories/Pagination.stories.d.ts +2 -3
  34. package/ui/Elements/Pagination/stories/Pagination.stories.js +2 -28
  35. package/ui/Elements/Select/themes/CustomComponents.js +16 -4
  36. package/ui/Elements/Select/themes/index.js +2 -2
  37. package/ui/Elements/Select/themes/selectStyles.d.ts +42 -0
  38. package/ui/Elements/Select/themes/selectStyles.js +145 -0
  39. package/ui/Elements/Spinner/styles.js +2 -1
  40. package/ui/ThemeProvider/themes/default.js +1 -1
  41. package/ui/index.es.js +15806 -15876
  42. package/ui/index.umd.js +468 -468
  43. package/ui/Elements/Select/themes/baseStyles.d.ts +0 -28
  44. package/ui/Elements/Select/themes/baseStyles.js +0 -87
  45. package/ui/Elements/Select/themes/formStyles.d.ts +0 -24
  46. package/ui/Elements/Select/themes/formStyles.js +0 -102
@@ -0,0 +1,13 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ export var ArrowUp = function (props) { return (_jsx("svg", __assign({ width: "12", height: "7", viewBox: "0 0 12 7", fill: "none", stroke: "#22394E", xmlns: "http://www.w3.org/2000/svg" }, props, { children: _jsx("path", { d: "M1 6L5.64645 1.35355C5.84171 1.15829 6.15829 1.15829 6.35355 1.35355L11 6", strokeWidth: "2", strokeLinecap: "round" }) }))); };
@@ -10,4 +10,4 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
- export var Cancel = function (props) { return (_jsx("svg", __assign({ width: "11", height: "11", viewBox: "0 0 11 11", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props, { children: _jsx("path", { id: "cancel", fillRule: "evenodd", clipRule: "evenodd", d: "M1.61873 0.375917C1.26726 0.0244455 0.697412 0.0244455 0.34594 0.375917C-0.00553197 0.727389 -0.00553197 1.29724 0.34594 1.64871L4.21225 5.51502L0.34594 9.38133C-0.00553159 9.7328 -0.00553156 10.3026 0.34594 10.6541C0.697412 11.0056 1.26726 11.0056 1.61873 10.6541L5.48504 6.78781L9.35135 10.6541C9.70282 11.0056 10.2727 11.0056 10.6241 10.6541C10.9756 10.3026 10.9756 9.7328 10.6241 9.38133L6.75783 5.51502L10.6241 1.64871C10.9756 1.29724 10.9756 0.727391 10.6241 0.375919C10.2727 0.024447 9.70282 0.024447 9.35135 0.375919L5.48504 4.24223L1.61873 0.375917Z", fill: "#22394E" }) }))); };
13
+ export var Cancel = function (props) { return (_jsx("svg", __assign({ width: "11", height: "11", viewBox: "0 0 11 11", fill: "#22394E", xmlns: "http://www.w3.org/2000/svg" }, props, { children: _jsx("path", { id: "cancel", fillRule: "evenodd", clipRule: "evenodd", d: "M1.61873 0.375917C1.26726 0.0244455 0.697412 0.0244455 0.34594 0.375917C-0.00553197 0.727389 -0.00553197 1.29724 0.34594 1.64871L4.21225 5.51502L0.34594 9.38133C-0.00553159 9.7328 -0.00553156 10.3026 0.34594 10.6541C0.697412 11.0056 1.26726 11.0056 1.61873 10.6541L5.48504 6.78781L9.35135 10.6541C9.70282 11.0056 10.2727 11.0056 10.6241 10.6541C10.9756 10.3026 10.9756 9.7328 10.6241 9.38133L6.75783 5.51502L10.6241 1.64871C10.9756 1.29724 10.9756 0.727391 10.6241 0.375919C10.2727 0.024447 9.70282 0.024447 9.35135 0.375919L5.48504 4.24223L1.61873 0.375917Z" }) }))); };
@@ -53,3 +53,5 @@ export { ShoppingBag } from './ShoppingBag';
53
53
  export { Truck } from './Truck';
54
54
  export { TwoUsers } from './TwoUsers';
55
55
  export { Integrations } from './Integrations';
56
+ export { ArrowDown } from './ArrowDown';
57
+ export { ArrowUp } from './ArrowUp';
@@ -53,3 +53,5 @@ export { ShoppingBag } from './ShoppingBag';
53
53
  export { Truck } from './Truck';
54
54
  export { TwoUsers } from './TwoUsers';
55
55
  export { Integrations } from './Integrations';
56
+ export { ArrowDown } from './ArrowDown';
57
+ export { ArrowUp } from './ArrowUp';
@@ -1,11 +1,9 @@
1
- export type PaginationProps = {
1
+ export type Props = {
2
2
  page?: number;
3
3
  itemCount?: number;
4
4
  itemPerPage: number;
5
- radius?: number;
6
- rate?: number;
7
5
  onPageChange?: (number: number, rows: number) => void;
8
6
  customPaginationHandler?: (page: number, rows: number) => void;
9
7
  };
10
- declare const Pagination: ({ onPageChange, itemPerPage, itemCount, page, radius, rate, customPaginationHandler, }: PaginationProps) => JSX.Element;
8
+ declare const Pagination: ({ onPageChange, itemPerPage, itemCount, page, customPaginationHandler }: Props) => JSX.Element;
11
9
  export default Pagination;
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useMemo } from 'react';
3
3
  import { Btn, GoIcon, Wrapper, PageBtn, DotsWrapper } from './styled';
4
4
  var Pagination = function (_a) {
5
- var onPageChange = _a.onPageChange, _b = _a.itemPerPage, itemPerPage = _b === void 0 ? 3 : _b, _c = _a.itemCount, itemCount = _c === void 0 ? 0 : _c, page = _a.page, _d = _a.radius, radius = _d === void 0 ? 5 : _d, _e = _a.rate, rate = _e === void 0 ? 4 : _e, customPaginationHandler = _a.customPaginationHandler;
5
+ var onPageChange = _a.onPageChange, itemPerPage = _a.itemPerPage, itemCount = _a.itemCount, page = _a.page, customPaginationHandler = _a.customPaginationHandler;
6
6
  var setPage = useCallback(function (number) { return function () {
7
7
  if (customPaginationHandler) {
8
8
  customPaginationHandler(number, itemPerPage);
@@ -13,27 +13,31 @@ var Pagination = function (_a) {
13
13
  }
14
14
  }; }, [itemPerPage, onPageChange, customPaginationHandler]);
15
15
  var pageX = page !== null && page !== void 0 ? page : 1;
16
- var pageCount = Math.max(Math.ceil(itemCount / itemPerPage), 1);
16
+ var pageCount = Math.max(Math.ceil((itemCount !== null && itemCount !== void 0 ? itemCount : 0) / (itemPerPage !== null && itemPerPage !== void 0 ? itemPerPage : 3)), 1);
17
17
  var arrayOfPages = useMemo(function () {
18
18
  var pageNumbers = Array.from({ length: pageCount }, function (_, i) { return i + 1; });
19
19
  // first and last page are still visible
20
20
  // if number of pages is less than 6 (display all pages without dots and duplication of first and last char)
21
- if (pageCount < radius + 1) {
21
+ if (pageCount < 6) {
22
22
  return pageNumbers.slice(1, pageCount - 1);
23
- // if current page is less than radius (display first radius pages)
23
+ // if current page is less than 5 (display first 5 pages)
24
24
  }
25
- else if (pageX < radius) {
26
- return pageNumbers.slice(1, Math.min(pageX + rate, radius));
27
- // display last radius pages
25
+ else if (pageX < 5) {
26
+ return pageNumbers.slice(1, 5);
27
+ // display last 5 pages
28
28
  }
29
- else if (pageX > pageCount - Math.floor(radius / 2)) {
30
- return pageNumbers.slice(pageCount - rate - 1, pageCount - 1);
29
+ else if (pageX > pageCount - 4) {
30
+ return pageNumbers.slice(pageCount - 5, pageCount - 1);
31
+ }
32
+ else if (window.innerWidth < 768) {
33
+ // display dispersion of 1 chars from current page (part between dots)
34
+ return pageNumbers.slice(pageX - 2, pageX + 1);
31
35
  }
32
36
  else {
33
37
  // display dispersion of 2 chars from current page (part between dots)
34
- return pageNumbers.slice(pageX - Math.ceil(radius / 2), Math.min(pageX + Math.floor(radius / 2), pageCount - 1));
38
+ return pageNumbers.slice(pageX - 3, pageX + 2);
35
39
  }
36
40
  }, [pageCount, pageX]);
37
- return (_jsxs(Wrapper, { children: [_jsx(Btn, { disabled: pageX <= 1, onClick: setPage(pageX - 1), children: _jsx(GoIcon, { icon: "goLeft", isActive: pageX > 1 }) }), _jsx(PageBtn, { isCurrent: pageX === 1, onClick: setPage(1), children: 1 }), arrayOfPages[0] > 2 && _jsx(DotsWrapper, { children: "..." }), arrayOfPages === null || arrayOfPages === void 0 ? void 0 : arrayOfPages.map(function (number) { return (_jsx(PageBtn, { isCurrent: pageX === number, onClick: setPage(number !== null && number !== void 0 ? number : 1), children: number }, number)); }), arrayOfPages[arrayOfPages.length - 1] < pageCount - 1 && _jsx(DotsWrapper, { children: "..." }), pageCount !== 1 && (_jsx(PageBtn, { isCurrent: pageX === pageCount, onClick: setPage(pageCount), children: pageCount })), _jsx(Btn, { disabled: pageX >= pageCount, onClick: setPage(pageX + 1), children: _jsx(GoIcon, { icon: "goRight", isActive: pageX < pageCount }) })] }));
41
+ return (_jsxs(Wrapper, { children: [_jsx(Btn, { disabled: pageX <= 1, onClick: setPage(pageX - 1), children: _jsx(GoIcon, { icon: "goLeft", isActive: pageX > 1 }) }), _jsx(PageBtn, { isCurrent: pageX === 1, onClick: setPage(1), children: 1 }), pageX >= 5 && pageCount > 6 && _jsx(DotsWrapper, { children: "..." }), arrayOfPages === null || arrayOfPages === void 0 ? void 0 : arrayOfPages.map(function (number) { return (_jsx(PageBtn, { isCurrent: pageX === number, onClick: setPage(number !== null && number !== void 0 ? number : 1), children: number }, number)); }), pageX < pageCount - 3 && pageCount > 6 && _jsx(DotsWrapper, { children: "..." }), pageCount !== 1 && (_jsx(PageBtn, { isCurrent: pageX === pageCount, onClick: setPage(pageCount), children: pageCount })), _jsx(Btn, { disabled: pageX >= pageCount, onClick: setPage(pageX + 1), children: _jsx(GoIcon, { icon: "goRight", isActive: pageX < pageCount }) })] }));
38
42
  };
39
43
  export default Pagination;
@@ -1,4 +1,3 @@
1
1
  import Pagination from './Pagination';
2
- export type { PaginationProps } from './Pagination';
3
2
  export { Pagination };
4
3
  export default Pagination;
@@ -1,8 +1,8 @@
1
+ /// <reference types="react" />
1
2
  import type { StoryObj } from '@storybook/react';
2
- import { PaginationProps } from '../';
3
3
  declare const meta: {
4
4
  title: string;
5
- component: ({ onPageChange, itemPerPage, itemCount, page, radius, rate, customPaginationHandler, }: PaginationProps) => JSX.Element;
5
+ component: ({ onPageChange, itemPerPage, itemCount, page, customPaginationHandler }: import("../Pagination").Props) => JSX.Element;
6
6
  tags: string[];
7
7
  argTypes: {};
8
8
  };
@@ -10,4 +10,3 @@ export default meta;
10
10
  type Story = StoryObj<typeof meta>;
11
11
  export declare const Default: Story;
12
12
  export declare const ManyPages: Story;
13
- export declare const Shorter: Story;
@@ -1,16 +1,3 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import { useState } from 'react';
14
1
  import { Pagination } from '../';
15
2
  var meta = {
16
3
  title: 'Elements/Pagination',
@@ -19,30 +6,17 @@ var meta = {
19
6
  argTypes: {},
20
7
  };
21
8
  export default meta;
22
- var withSetState = function (arg) {
23
- var _a = useState(1), page = _a[0], setPage = _a[1];
24
- return _jsx(Pagination, __assign({}, arg, { page: page, onPageChange: setPage }));
25
- };
26
9
  export var Default = {
27
10
  args: {
28
11
  itemCount: 100,
29
12
  itemPerPage: 8,
13
+ page: 1,
30
14
  },
31
- render: withSetState,
32
15
  };
33
16
  export var ManyPages = {
34
17
  args: {
35
18
  itemCount: 1000,
36
19
  itemPerPage: 8,
20
+ page: 1,
37
21
  },
38
- render: withSetState,
39
- };
40
- export var Shorter = {
41
- args: {
42
- itemCount: 100,
43
- itemPerPage: 8,
44
- radius: 3,
45
- rate: 1,
46
- },
47
- render: withSetState,
48
22
  };
@@ -34,6 +34,8 @@ import Icon from '../../Icon/Icon';
34
34
  import { Paragraph3 } from '../../Typography/Typography';
35
35
  import Checkbox from '../../../Forms/Checkbox/Checkbox';
36
36
  import Toggle from '../../Toggle/Toggle';
37
+ import { ArrowDown } from '../../Icon/icons/ArrowDown';
38
+ import { ArrowUp } from '../../Icon/icons/ArrowUp';
37
39
  // Option for big lists
38
40
  var SimplifiedOptionInner = function (props) {
39
41
  var styles = props.getStyles('option', props);
@@ -43,13 +45,17 @@ var SimplifiedOptionInner = function (props) {
43
45
  };
44
46
  export var SimplifiedOption = memo(SimplifiedOptionInner, function (prevProps, nextProps) { var _a, _b; return prevProps.isFocused === nextProps.isFocused && ((_a = prevProps.data) === null || _a === void 0 ? void 0 : _a.label) === ((_b = nextProps.data) === null || _b === void 0 ? void 0 : _b.label); });
45
47
  // Value container with icon
46
- var IconDiv = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding-left: 12px;\n align-self: center;\n"], ["\n padding-left: 12px;\n align-self: center;\n"])));
48
+ var IconDiv = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding-left: 12px;\n align-self: center;\n & > * {\n color: ", ";\n }\n"], ["\n padding-left: 12px;\n align-self: center;\n & > * {\n color: ", ";\n }\n"])), function (_a) {
49
+ var hasValue = _a.hasValue;
50
+ return (hasValue ? 'black' : '#a3b3c1');
51
+ });
47
52
  export var IconValueContainer = function (props) {
48
53
  var _a;
49
54
  // eslint-disable-next-line react/prop-types
50
55
  var children = props.children, rest = __rest(props, ["children"]);
51
56
  var icon = (_a = rest.selectProps) === null || _a === void 0 ? void 0 : _a.icon;
52
- return (_jsxs(_Fragment, { children: [icon && (_jsx(IconDiv, { className: "inputIcon", children: _jsx(Icon, { icon: icon }) })), _jsx(components.ValueContainer, __assign({}, rest, { children: children }))] }));
57
+ var hasValue = rest.hasValue;
58
+ return (_jsxs(_Fragment, { children: [icon && (_jsx(IconDiv, { className: "inputIcon", hasValue: hasValue, children: _jsx(Icon, { icon: icon }) })), _jsx(components.ValueContainer, __assign({}, rest, { children: children }))] }));
53
59
  };
54
60
  // MultiValue container replacement with count of selected options
55
61
  export var CountMultiValue = function (props) {
@@ -74,12 +80,18 @@ export var ChevronOption = function (props) {
74
80
  return (_jsxs(selectComponents.Option, __assign({}, props, { children: [(showCheckbox || showToggle) && (_jsxs(SelectedIndicator, { children: [showCheckbox && _jsx(Checkbox, { checked: isSelected, size: 2, readOnly: true }), showToggle && _jsx(Toggle, { name: "", onChange: selectOption, checked: isSelected, spaceAround: false, variant: 'grid' })] })), _jsx("span", { className: "label", "data-cy": "dropdownModalOption".concat(data.index), children: children })] })));
75
81
  };
76
82
  // menu with check all and reset config button
77
- var SelectAll = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n margin: 4px 18px -10px 8px;\n padding: ", ";\n font-weight: 400;\n background-color: ", ";\n color: blue2;\n border-radius: 6px;\n height: 36px;\n :hover {\n cursor: pointer;\n background-color: bgLightGray1;\n }\n"], ["\n display: flex;\n margin: 4px 18px -10px 8px;\n padding: ", ";\n font-weight: 400;\n background-color: ", ";\n color: blue2;\n border-radius: 6px;\n height: 36px;\n :hover {\n cursor: pointer;\n background-color: bgLightGray1;\n }\n"])), function (_a) {
83
+ var SelectAll = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n margin: 4px 18px -10px 8px;\n padding: ", ";\n font-weight: 400;\n background-color: ", ";\n color: ", ";\n border-radius: 6px;\n height: 36px;\n :hover {\n cursor: pointer;\n background-color: ", ";\n }\n"], ["\n display: flex;\n margin: 4px 18px -10px 8px;\n padding: ", ";\n font-weight: 400;\n background-color: ", ";\n color: ", ";\n border-radius: 6px;\n height: 36px;\n :hover {\n cursor: pointer;\n background-color: ", ";\n }\n"])), function (_a) {
78
84
  var additionalPadding = _a.additionalPadding;
79
85
  return (additionalPadding ? '8px 27px 8px 10px' : '8px 10px');
80
86
  }, function (_a) {
81
87
  var isSelected = _a.isSelected;
82
88
  return (isSelected ? th.color('red20') : 'transparent');
89
+ }, function (_a) {
90
+ var isSelected = _a.isSelected;
91
+ return (isSelected ? th.color('red1') : th.color('textPrimary'));
92
+ }, function (_a) {
93
+ var isSelected = _a.isSelected;
94
+ return (isSelected ? th.color('red30') : th.color('bgLightGray1'));
83
95
  });
84
96
  var ConfigWrap = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n text-align: center;\n cursor: pointer;\n color: red1;\n text-decoration: underline;\n margin: 0 30px 0 20px;\n padding-bottom: 7px;\n :first-letter {\n text-transform: capitalize;\n }\n :hover {\n color: red3;\n }\n"], ["\n text-align: center;\n cursor: pointer;\n color: red1;\n text-decoration: underline;\n margin: 0 30px 0 20px;\n padding-bottom: 7px;\n :first-letter {\n text-transform: capitalize;\n }\n :hover {\n color: red3;\n }\n"])));
85
97
  export var ConnectedMenu = function (props) {
@@ -120,6 +132,6 @@ export var CustomInput = function (props) {
120
132
  };
121
133
  export var DropdownIndicator = function (props) {
122
134
  var _a = props.selectProps, menuIsOpen = _a.menuIsOpen, name = _a.name;
123
- return (_jsx(selectComponents.DropdownIndicator, __assign({}, props, { children: _jsx(ChevronDiv, { className: "chevron", "data-cy": "".concat(name, "ChevronBtn"), children: _jsx(Icon, { icon: menuIsOpen ? 'goUp' : 'goDown', size: '100%' }) }) })));
135
+ return (_jsx(selectComponents.DropdownIndicator, __assign({}, props, { children: _jsx(ChevronDiv, { className: "chevron", "data-cy": "".concat(name, "ChevronBtn"), children: menuIsOpen ? _jsx(ArrowUp, { width: "16px" }) : _jsx(ArrowDown, { width: "16px" }) }) })));
124
136
  };
125
137
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
@@ -1,5 +1,5 @@
1
1
  import { SimplifiedOption, IconValueContainer, CountMultiValue, ChevronOption, DropdownIndicator, CustomInput, ConnectedMenu, } from './CustomComponents';
2
- import { getCustomTheme as getFormCustomTheme, CustomStyles as FormCustomStyles } from './formStyles';
2
+ import { getCustomTheme as getFormCustomTheme, CustomStyles as SelectCustomStyles } from './selectStyles';
3
3
  import { useTheme } from '@xstyled/styled-components';
4
4
  import { useMemo } from 'react';
5
5
  export var useStylesAndComponents = function (style, optionVariant, multiLabelVariant, containerVariant, useSimplifiedOptions, showSelectAllButton, showResetGridButton) {
@@ -23,7 +23,7 @@ export var useStylesAndComponents = function (style, optionVariant, multiLabelVa
23
23
  }
24
24
  components.Input = CustomInput;
25
25
  var themes = getFormCustomTheme(systemTheme, optionVariant, style == 'gridFilter');
26
- var styles = FormCustomStyles;
26
+ var styles = SelectCustomStyles;
27
27
  components.Option = ChevronOption;
28
28
  components.DropdownIndicator = DropdownIndicator;
29
29
  // performance reasons
@@ -0,0 +1,42 @@
1
+ import { SelectProps } from '../types';
2
+ import { ControlProps, CSSObjectWithLabel } from 'react-select';
3
+ type BaseColors = {
4
+ primary: string;
5
+ optionTextColor: string;
6
+ inputDisabledColor: string;
7
+ inputBorderColor: string;
8
+ whiteBackgroundColor: string;
9
+ inputTextColor: string;
10
+ placeholderTextColor: string;
11
+ activeOptionBackground: string;
12
+ disabledTextColor: string;
13
+ inputBorderHoverColor: string;
14
+ menuHoverBackgroundColor: string;
15
+ dropdownIndicatorColor: string;
16
+ hoverToActiveOptionBackground: string;
17
+ defaultControlColor: string;
18
+ };
19
+ type BaseState<ThemeType = BaseColors> = {
20
+ theme: ThemeType;
21
+ isSelected: boolean;
22
+ isFocused: boolean;
23
+ isDisabled: boolean;
24
+ isMulti: boolean;
25
+ selectProps: SelectProps;
26
+ } & ControlProps;
27
+ type StylesConfig<T = BaseState> = Record<string, (styles: CSSObjectWithLabel, state: T) => CSSObjectWithLabel>;
28
+ type CustomTheme = {
29
+ colors: BaseColors;
30
+ height: string | number;
31
+ focusBoxShadow?: string;
32
+ textWeightNormal: string;
33
+ optionVariant: Required<SelectProps>['optionVariant'];
34
+ borderRadius: string;
35
+ font: string;
36
+ narrowIndicators: boolean;
37
+ };
38
+ type State = BaseState<CustomTheme>;
39
+ export declare const CustomStyles: StylesConfig<State>;
40
+ type ThemeGetter = (theme: any) => CustomTheme;
41
+ export declare const getCustomTheme: (theme: any, optionVariant: Required<SelectProps>['optionVariant'], useFilterSubvariant: boolean) => ThemeGetter;
42
+ export {};
@@ -0,0 +1,145 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { th } from '@xstyled/system';
13
+ // style object https://react-select.com/styles
14
+ export var CustomStyles = {
15
+ control: function (styles, _a) {
16
+ var _b;
17
+ var selectProps = _a.selectProps, theme = _a.theme, isFocused = _a.isFocused, isDisabled = _a.isDisabled;
18
+ var colors = theme.colors;
19
+ return __assign(__assign({}, styles), { borderColor: selectProps.isInvalid ? colors.primary : isFocused ? colors.inputTextColor : colors.inputBorderColor, backgroundColor: colors.whiteBackgroundColor, boxShadow: theme.focusBoxShadow, borderRadius: theme.borderRadius, '& input': {
20
+ fontWeight: theme.textWeightNormal,
21
+ fontFamily: theme.font,
22
+ }, '&:hover': __assign(__assign({}, ((_b = styles['&:hover']) !== null && _b !== void 0 ? _b : {})), { borderColor: colors.inputBorderHoverColor }), fontSize: '14px', minHeight: theme.height, minWidth: selectProps.isMulti ? 'min-content' : 'max-content', '.inputIcon': {
23
+ color: isDisabled ? colors.defaultControlColor : !!selectProps.value ? colors.inputTextColor : colors.defaultControlColor,
24
+ } });
25
+ },
26
+ singleValue: function (styles, _a) {
27
+ var selectProps = _a.selectProps, theme = _a.theme, isDisabled = _a.isDisabled;
28
+ return __assign(__assign({}, styles), { position: 'absolute', top: '50%', transform: 'translateY(-50%)', color: selectProps.isInvalid
29
+ ? theme.colors.primary
30
+ : isDisabled
31
+ ? theme.colors.disabledTextColor
32
+ : theme.colors.inputTextColor, fontSize: '14px', fontWeight: theme.textWeightNormal });
33
+ },
34
+ multiValue: function (styles, state) {
35
+ var theme = state.theme;
36
+ return __assign(__assign({}, styles), { color: theme.colors.inputTextColor, fontWeight: theme.textWeightNormal, backgroundColor: '#E7EBEF', borderRadius: '4px', '& svg': {
37
+ color: theme.colors.inputTextColor,
38
+ }, ' > div': {
39
+ fontSize: '12px',
40
+ } });
41
+ },
42
+ multiValueLabel: function (styles) { return (__assign(__assign({}, styles), { fontSize: 'unset', padding: '5px' })); },
43
+ multiValueRemove: function (styles, _a) {
44
+ var theme = _a.theme;
45
+ return (__assign(__assign({}, styles), { color: theme.colors.inputBorderColor }));
46
+ },
47
+ placeholder: function (styles, state) {
48
+ var theme = state.theme, selectProps = state.selectProps;
49
+ return __assign(__assign({}, styles), { fontSize: '14px', fontWeight: theme.textWeightNormal, textOverflow: 'ellipsis', whiteSpace: 'nowrap', overflow: 'hidden', maxWidth: 'calc(100% - 8px)', color: selectProps.isDarkPlaceholderText ? theme.colors.inputTextColor : theme.colors.placeholderTextColor });
50
+ },
51
+ loadingMessage: function (styles, _a) {
52
+ var theme = _a.theme;
53
+ return (__assign(__assign({}, styles), { color: theme.colors.optionTextColor }));
54
+ },
55
+ noOptionsMessage: function (styles, _a) {
56
+ var theme = _a.theme;
57
+ return (__assign(__assign({}, styles), { color: theme.colors.optionTextColor }));
58
+ },
59
+ input: function (styles, _a) {
60
+ var theme = _a.theme;
61
+ return (__assign(__assign({}, styles), { color: theme.colors.inputTextColor }));
62
+ },
63
+ option: function (styles, _a) {
64
+ var isSelected = _a.isSelected, theme = _a.theme, isDisabled = _a.isDisabled, selectProps = _a.selectProps;
65
+ var defaultColor = theme.colors.optionTextColor;
66
+ return {
67
+ color: isSelected ? theme.colors.primary : defaultColor,
68
+ backgroundColor: isSelected ? theme.colors.activeOptionBackground : undefined,
69
+ fontWeight: theme.textWeightNormal,
70
+ fontSize: '14px',
71
+ cursor: !isDisabled ? 'pointer' : 'default',
72
+ display: 'flex',
73
+ flexDirection: 'row',
74
+ alignItems: 'center',
75
+ padding: '7px 10px',
76
+ height: '36px',
77
+ marginRight: '4px',
78
+ marginBottom: '2px',
79
+ lineHeight: '22px',
80
+ borderRadius: th.radius('ml')({ theme: selectProps === null || selectProps === void 0 ? void 0 : selectProps.systemTheme }),
81
+ '&:hover': {
82
+ backgroundColor: isSelected
83
+ ? theme.colors.hoverToActiveOptionBackground
84
+ : !isDisabled
85
+ ? theme.colors.menuHoverBackgroundColor
86
+ : undefined,
87
+ },
88
+ };
89
+ },
90
+ menu: function (styles, state) {
91
+ var theme = state.theme;
92
+ return __assign(__assign({}, styles), { boxShadow: '0 2px 20px 0 rgba(0, 0, 0, 0.10);', marginTop: '-0', paddingTop: '0', borderRadius: '10px', zIndex: 3, minWidth: 'max-content', backgroundColor: theme.colors.whiteBackgroundColor });
93
+ },
94
+ menuList: function (styles, _a) {
95
+ var theme = _a.theme;
96
+ return __assign(__assign({}, styles), { margin: '8px 4px 8px 8px', '::-webkit-scrollbar-thumb': {
97
+ border: 'none',
98
+ borderRadius: '4px',
99
+ height: '47px',
100
+ backgroundColor: theme.colors.defaultControlColor,
101
+ '&:hover': {
102
+ backgroundColor: theme.colors.dropdownIndicatorColor,
103
+ },
104
+ }, '::-webkit-scrollbar': {
105
+ width: '10px',
106
+ }, '::-webkit-scrollbar-track': {
107
+ backgroundColor: theme.colors.menuHoverBackgroundColor,
108
+ borderRadius: '6px',
109
+ } });
110
+ },
111
+ dropdownIndicator: function (styles, state) {
112
+ var theme = state.theme, isDisabled = state.isDisabled;
113
+ return __assign(__assign({}, styles), { justifyContent: 'center', alignItems: 'center', '& svg': {
114
+ stroke: isDisabled ? theme.colors.dropdownIndicatorColor : theme.colors.inputTextColor,
115
+ }, padding: '0px 5px 0px 0px', '@media (min-width: 1024px)': {
116
+ padding: '0px 10px 0px 1px',
117
+ } });
118
+ },
119
+ clearIndicator: function (styles, state) {
120
+ var theme = state.theme;
121
+ return __assign(__assign({}, styles), { justifyContent: 'center', alignItems: 'center', padding: theme.narrowIndicators ? '0px 0px 0px 2px' : '0px 4px', color: theme.colors.dropdownIndicatorColor });
122
+ },
123
+ };
124
+ export var getCustomTheme = function (theme, optionVariant, useFilterSubvariant) {
125
+ var inputTextColor = th.color('blue2')({ theme: theme });
126
+ var customColors = {
127
+ primary: th.color('red1')({ theme: theme }),
128
+ inputTextColor: inputTextColor,
129
+ whiteBackgroundColor: th.color('white')({ theme: theme }),
130
+ optionTextColor: th.color('blue2')({ theme: theme }),
131
+ menuHoverBackgroundColor: th.color('bgLightGray1')({ theme: theme }),
132
+ inputDisabledColor: th.color('lightGray1')({ theme: theme }),
133
+ inputBorderColor: th.color('lightGray3')({ theme: theme }),
134
+ placeholderTextColor: th.color('lightGray3')({ theme: theme }),
135
+ defaultControlColor: th.color('lightGray5')({ theme: theme }),
136
+ disabledTextColor: th.color('lightGray6')({ theme: theme }),
137
+ dropdownIndicatorColor: th.color('gray1')({ theme: theme }),
138
+ inputBorderHoverColor: th.color('gray5')({ theme: theme }),
139
+ activeOptionBackground: th.color('red20')({ theme: theme }),
140
+ hoverToActiveOptionBackground: th.color('red30')({ theme: theme }),
141
+ };
142
+ return function (reactSelectTheme) {
143
+ return __assign(__assign({}, reactSelectTheme), { colors: customColors, focusBoxShadow: null, height: useFilterSubvariant ? '32px' : '38px', textWeightNormal: th.fontWeight('normal')({ theme: theme }), optionVariant: optionVariant, borderRadius: th.radius('lg')({ theme: theme }), font: th.font('primary')({ theme: theme }), narrowIndicators: !!useFilterSubvariant });
144
+ };
145
+ };
@@ -2,7 +2,8 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
2
2
  if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
3
  return cooked;
4
4
  };
5
- import styled, { th, keyframes } from '@xstyled/styled-components';
5
+ import styled, { th } from '@xstyled/styled-components';
6
+ import { keyframes } from 'styled-components';
6
7
  var KeyframesCircularDash = keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n 0% {\n stroke-dasharray: 1px, 200px;\n stroke-dashoffset: 0px;\n }\n\n 50% {\n stroke-dasharray: 100px, 200px;\n stroke-dashoffset: -15px;\n }\n\n 100% {\n stroke-dasharray: 100px, 200px;\n stroke-dashoffset: -125px;\n }\n"], ["\n 0% {\n stroke-dasharray: 1px, 200px;\n stroke-dashoffset: 0px;\n }\n\n 50% {\n stroke-dasharray: 100px, 200px;\n stroke-dashoffset: -15px;\n }\n\n 100% {\n stroke-dasharray: 100px, 200px;\n stroke-dashoffset: -125px;\n }\n"])));
7
8
  var KeyframesCircularRotate = keyframes(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n 100% {\n transform: rotate(360deg);\n }\n"], ["\n 100% {\n transform: rotate(360deg);\n }\n"])));
8
9
  export var Svg = styled.svg(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: ", "px;\n height: ", "px;\n animation: ", " 1.4s linear infinite;\n"], ["\n width: ", "px;\n height: ", "px;\n animation: ", " 1.4s linear infinite;\n"])), function (_a) {
@@ -64,7 +64,7 @@ var defaultTheme = {
64
64
  yellow2: '#F2E871',
65
65
  red10: '#FFF6F4',
66
66
  red20: '#FFEBE6',
67
- red30: '#fec1cb',
67
+ red30: '#FFDAD1',
68
68
  red50: '#ff7c7b',
69
69
  red70: '#CF2013',
70
70
  red1: '#DB2B19',