@mailstep/design-system 0.7.25-beta.5 → 0.7.25-beta.7

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailstep/design-system",
3
- "version": "0.7.25-beta.5",
3
+ "version": "0.7.25-beta.7",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "./ui/index.js",
@@ -92,7 +92,7 @@
92
92
  "react-router": "^5.1.2",
93
93
  "react-router-dom": "^5.1.2",
94
94
  "react-script": "^2.0.5",
95
- "react-select": "^5.8.0",
95
+ "react-select": "^5.10.0",
96
96
  "react-use-draggable-scroll": "^0.4.7",
97
97
  "redux": ">=4.0.5",
98
98
  "reselect": "5.0.0-alpha.2",
@@ -134,7 +134,7 @@
134
134
  "react-redux": ">=4.0.5",
135
135
  "react-router": "^5.1.2",
136
136
  "react-router-dom": "^5.1.2",
137
- "react-select": "^5.8.0",
137
+ "react-select": "^5.10.0",
138
138
  "react-use-draggable-scroll": "^0.4.7",
139
139
  "redux": ">=4.0.5",
140
140
  "reselect": "5.0.0-alpha.2",
@@ -12,5 +12,5 @@ export var GroupItem = styled.div(templateObject_2 || (templateObject_2 = __make
12
12
  var groupsCount = _a.groupsCount;
13
13
  return "calc((100% / ".concat(groupsCount, ") - (").concat(timeIntervalWidth, "px / ").concat(groupsCount, "))");
14
14
  }, th.color('lightGray6'));
15
- export var Gap = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background-color: ", ";\n height: 100%;\n width: ", "px;\n border-right: 1px solid ", ";\n"], ["\n background-color: ", ";\n height: 100%;\n width: ", "px;\n border-right: 1px solid ", ";\n"])), th.color('bgLightGray1'), timeIntervalWidth, th.color('lightGray6'));
15
+ export var Gap = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background-color: ", ";\n height: 100%;\n width: ", "px;\n min-width: ", "px;\n border-right: 1px solid ", ";\n"], ["\n background-color: ", ";\n height: 100%;\n width: ", "px;\n min-width: ", "px;\n border-right: 1px solid ", ";\n"])), th.color('bgLightGray1'), timeIntervalWidth, timeIntervalWidth, th.color('lightGray6'));
16
16
  var templateObject_1, templateObject_2, templateObject_3;
@@ -18,7 +18,7 @@ export var EmptyTimeSlot = styled.div(templateObject_2 || (templateObject_2 = __
18
18
  var isSlotSelected = _a.isSlotSelected, activeTime = _a.activeTime;
19
19
  return (!isSlotSelected && activeTime ? th.color('blue10') : '');
20
20
  });
21
- export var TimeInterval = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-size: 12px;\n font-weight: 500;\n height: ", "px;\n width: ", "px;\n border-right: 1px solid ", ";\n padding: 10px;\n"], ["\n font-size: 12px;\n font-weight: 500;\n height: ", "px;\n width: ", "px;\n border-right: 1px solid ", ";\n padding: 10px;\n"])), minuteHeight * stepInMinutes, timeIntervalWidth, th.color('lightGray6'));
21
+ export var TimeInterval = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-size: 12px;\n font-weight: 500;\n height: ", "px;\n width: ", "px;\n border-right: 1px solid ", ";\n padding: 10px;\n min-width: ", "px;\n"], ["\n font-size: 12px;\n font-weight: 500;\n height: ", "px;\n width: ", "px;\n border-right: 1px solid ", ";\n padding: 10px;\n min-width: ", "px;\n"])), minuteHeight * stepInMinutes, timeIntervalWidth, th.color('lightGray6'), timeIntervalWidth);
22
22
  export var TimeRow = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n background-color: ", ";\n display: flex;\n border-bottom: 1px solid ", ";\n"], ["\n background-color: ", ";\n display: flex;\n border-bottom: 1px solid ", ";\n"])), function (_a) {
23
23
  var disabled = _a.disabled;
24
24
  return (disabled ? th.color('lightGray7') : 'white');
@@ -0,0 +1,16 @@
1
+ import { type FC } from 'react';
2
+ import { type Option } from '../Select/types';
3
+ import { type SpaceAround } from '../SpaceAround';
4
+ import { type AsyncProps } from 'react-select/async';
5
+ export type AsyncSelectProps = {
6
+ name?: string;
7
+ error?: string;
8
+ label?: string;
9
+ spaceAround?: SpaceAround;
10
+ className?: string;
11
+ style?: 'form' | 'gridFilter';
12
+ optionVariant?: 'default' | 'checkbox' | 'toggle';
13
+ multiLabelVariant?: 'default' | 'count';
14
+ containerVariant?: 'default' | 'search';
15
+ } & AsyncProps<Option, boolean, any>;
16
+ export declare const AsyncSelect: FC<AsyncSelectProps>;
@@ -0,0 +1,34 @@
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
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
+ import ErrorMessage from '../ErrorMessage/ErrorMessage';
25
+ import { FieldLabel } from '../Label';
26
+ import { StyledAsyncSelect, Wrapper } from '../Select/styles';
27
+ import { useStylesAndComponents } from '../Select/themes';
28
+ import SpaceAroundWrap from '../SpaceAround';
29
+ import { i18n } from '@lingui/core';
30
+ export var AsyncSelect = function (_a) {
31
+ var error = _a.error, label = _a.label, className = _a.className, spaceAround = _a.spaceAround, name = _a.name, placeholder = _a.placeholder, _b = _a.style, style = _b === void 0 ? 'form' : _b, _c = _a.optionVariant, optionVariant = _c === void 0 ? 'checkbox' : _c, _d = _a.multiLabelVariant, multiLabelVariant = _d === void 0 ? 'count' : _d, props = __rest(_a, ["error", "label", "className", "spaceAround", "name", "placeholder", "style", "optionVariant", "multiLabelVariant"]);
32
+ var _e = useStylesAndComponents(style, optionVariant, multiLabelVariant), customComponents = _e[0], customTheme = _e[1], customStyles = _e[2];
33
+ return (_jsxs(SpaceAroundWrap, { spaceAround: spaceAround, className: className, children: [_jsxs(Wrapper, { children: [label && _jsx(FieldLabel, { htmlFor: name, children: label }), _jsx(StyledAsyncSelect, __assign({ id: name, name: name, theme: customTheme, components: customComponents, styles: customStyles, classNamePrefix: "react-select", placeholder: placeholder || i18n._({ id: 'components.dropdown.placeholder', message: 'Select...' }) }, props))] }), error && _jsx(ErrorMessage, { children: error })] }));
34
+ };
@@ -0,0 +1,3 @@
1
+ import { AsyncSelect, type AsyncSelectProps } from './AsyncSelect';
2
+ export default AsyncSelect;
3
+ export type { AsyncSelectProps };
@@ -0,0 +1,2 @@
1
+ import { AsyncSelect } from './AsyncSelect';
2
+ export default AsyncSelect;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ declare const meta: {
3
+ title: string;
4
+ component: import("react").FC<import("../AsyncSelect").AsyncSelectProps>;
5
+ tags: string[];
6
+ argTypes: {};
7
+ };
8
+ export default meta;
9
+ export declare const Default: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,83 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import { jsx as _jsx } from "react/jsx-runtime";
38
+ import { AsyncSelect } from '../AsyncSelect';
39
+ var colors = [
40
+ 'red',
41
+ 'blue',
42
+ 'green',
43
+ 'yellow',
44
+ 'purple',
45
+ 'orange',
46
+ 'pink',
47
+ 'brown',
48
+ 'black',
49
+ 'white',
50
+ 'gray',
51
+ 'cyan',
52
+ 'magenta',
53
+ 'teal',
54
+ 'lime',
55
+ 'indigo',
56
+ 'violet',
57
+ 'gold',
58
+ 'silver',
59
+ 'beige'
60
+ ];
61
+ var filterColors = function (inputValue) { return colors.filter(function (value) { return value.includes(inputValue.toLowerCase()); }); };
62
+ var loadOptions = function (inputValue) { return __awaiter(void 0, void 0, void 0, function () {
63
+ return __generator(this, function (_a) {
64
+ switch (_a.label) {
65
+ case 0: return [4 /*yield*/, new Promise(function (resolve) {
66
+ setTimeout(function () {
67
+ resolve(filterColors(inputValue).map(function (color) { return ({ value: color, label: color }); }));
68
+ }, 1000);
69
+ })];
70
+ case 1: return [2 /*return*/, _a.sent()];
71
+ }
72
+ });
73
+ }); };
74
+ var meta = {
75
+ title: 'Elements/AsyncSelect',
76
+ component: AsyncSelect,
77
+ tags: ['autodocs'],
78
+ argTypes: {}
79
+ };
80
+ export default meta;
81
+ export var Default = function () {
82
+ return _jsx(AsyncSelect, { loadOptions: loadOptions, isMulti: true, defaultOptions: true, cacheOptions: true });
83
+ };
@@ -1,3 +1,3 @@
1
- import { StylesConfig, SelectComponentsConfig } from 'react-select';
2
- import { SelectProps } from '../types';
3
- export declare const useStylesAndComponents: (style: SelectProps['style'], optionVariant: SelectProps['optionVariant'], multiLabelVariant: SelectProps['multiLabelVariant'], containerVariant: SelectProps['containerVariant'], useSimplifiedOptions: SelectProps['useSimplifiedOptions'], showSelectAllButton: SelectProps['showSelectAllButton'], showResetGridButton: SelectProps['showResetGridButton']) => [SelectComponentsConfig<unknown, boolean, any>, any, StylesConfig];
1
+ import { type StylesConfig, type SelectComponentsConfig } from 'react-select';
2
+ import { type SelectProps } from '../types';
3
+ export declare const useStylesAndComponents: (style?: SelectProps['style'], optionVariant?: SelectProps['optionVariant'], multiLabelVariant?: SelectProps['multiLabelVariant'], containerVariant?: SelectProps['containerVariant'], useSimplifiedOptions?: SelectProps['useSimplifiedOptions'], showSelectAllButton?: SelectProps['showSelectAllButton'], showResetGridButton?: SelectProps['showResetGridButton']) => [SelectComponentsConfig<unknown, boolean, any>, any, StylesConfig];
@@ -1,22 +1,25 @@
1
+ import { useMemo } from 'react';
2
+ import ChevronOption from '../components/ChevronOption';
1
3
  import ConnectedMenu from '../components/ConnectedMenu';
2
- import IconValueContainer from '../components/IconValueContainer';
3
- import SimplifiedOption from '../components/SimplifiedOption';
4
4
  import CountMultiValue from '../components/CountMultiValue';
5
- import ChevronOption from '../components/ChevronOption';
6
- import DropdownIndicator from '../components/DropdownIndicator';
7
5
  import CustomInput from '../components/CustomInput';
8
- import { getCustomTheme as getFormCustomTheme, CustomStyles as SelectCustomStyles } from './selectStyles';
6
+ import DropdownIndicator from '../components/DropdownIndicator';
7
+ import IconValueContainer from '../components/IconValueContainer';
8
+ import SimplifiedOption from '../components/SimplifiedOption';
9
9
  import { useTheme } from '@xstyled/styled-components';
10
- import { useMemo } from 'react';
10
+ import { getCustomTheme as getFormCustomTheme, CustomStyles as SelectCustomStyles } from './selectStyles';
11
11
  export var useStylesAndComponents = function (style, optionVariant, multiLabelVariant, containerVariant, useSimplifiedOptions, showSelectAllButton, showResetGridButton) {
12
12
  if (style === void 0) { style = 'form'; }
13
13
  if (optionVariant === void 0) { optionVariant = 'default'; }
14
14
  if (multiLabelVariant === void 0) { multiLabelVariant = 'default'; }
15
15
  if (containerVariant === void 0) { containerVariant = 'default'; }
16
+ if (useSimplifiedOptions === void 0) { useSimplifiedOptions = false; }
17
+ if (showSelectAllButton === void 0) { showSelectAllButton = false; }
18
+ if (showResetGridButton === void 0) { showResetGridButton = false; }
16
19
  var systemTheme = useTheme();
17
20
  return useMemo(function () {
18
21
  var components = {
19
- ValueContainer: IconValueContainer,
22
+ ValueContainer: IconValueContainer
20
23
  };
21
24
  if (multiLabelVariant === 'count') {
22
25
  components.MultiValue = CountMultiValue;
@@ -44,6 +47,6 @@ export var useStylesAndComponents = function (style, optionVariant, multiLabelVa
44
47
  style,
45
48
  useSimplifiedOptions,
46
49
  systemTheme,
47
- optionVariant,
50
+ optionVariant
48
51
  ]);
49
52
  };
package/ui/index.d.ts CHANGED
@@ -11,6 +11,7 @@ import SideMenu from './Blocks/SideMenu';
11
11
  import Stepper from './Blocks/Stepper';
12
12
  import Tabs from './Blocks/Tabs';
13
13
  import Alert from './Elements/Alert';
14
+ import AsyncSelect from './Elements/AsyncSelect';
14
15
  import Avatar from './Elements/Avatar';
15
16
  import Badge from './Elements/Badge';
16
17
  import BorderedBox from './Elements/BorderedBox';
@@ -45,7 +46,7 @@ import RadioButton from './Forms/RadioButton';
45
46
  import TextArea from './Forms/TextArea';
46
47
  import ThemeProvider from './ThemeProvider';
47
48
  import utils from './utils';
48
- export { DropdownSelect, DatePicker, CommonGrid, Popover, SingleSelect, MultiSelect, Select, Card, CornerDialog, ImageList, LightBox, Modal, Tabs, Alert, Avatar, Badge, BorderedBox, Button, Dropdown, ErrorMessage, Icon, Image, Label, Line, Link, Logo, Pagination, Portal, ProgressBar, SimpleLink, SpaceAround, Spinner, Tag, Toast, Toggle, Typography, Checkbox, Input, RadioButton, ThemeProvider, utils, TextArea, LoginPage, LanguageSwitch, SideMenu, Stepper, Scheduler };
49
+ export { DropdownSelect, DatePicker, CommonGrid, Popover, SingleSelect, MultiSelect, Select, Card, CornerDialog, ImageList, LightBox, Modal, Tabs, Alert, Avatar, AsyncSelect, Badge, BorderedBox, Button, Dropdown, ErrorMessage, Icon, Image, Label, Line, Link, Logo, Pagination, Portal, ProgressBar, SimpleLink, SpaceAround, Spinner, Tag, Toast, Toggle, Typography, Checkbox, Input, RadioButton, ThemeProvider, utils, TextArea, LoginPage, LanguageSwitch, SideMenu, Stepper, Scheduler };
49
50
  export * from './Blocks/CornerDialog';
50
51
  export * from './Blocks/ImageList';
51
52
  export * from './Blocks/LightBox';
@@ -54,6 +55,7 @@ export * from './Blocks/Modal';
54
55
  export * from './Blocks/Tabs';
55
56
  export * from './Elements/Alert';
56
57
  export * from './Elements/Avatar';
58
+ export * from './Elements/AsyncSelect';
57
59
  export * from './Elements/Badge';
58
60
  export * from './Elements/BorderedBox';
59
61
  export * from './Elements/Button';