@mailstep/design-system 0.6.77-beta.0 → 0.6.78

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.6.77-beta.0",
3
+ "version": "0.6.78",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "./ui/index.js",
@@ -15,6 +15,7 @@ export type Props = Omit<SelectProps, 'onChange' | 'loadOptions'> & {
15
15
  initialOptions?: Option[];
16
16
  loadOptions?: (fulltext: string, byId: boolean) => Promise<Option[]>;
17
17
  form?: any;
18
+ shouldReloadOptions?: boolean;
18
19
  };
19
20
  declare const SingleSelect: (props: Props) => JSX.Element;
20
21
  export default SingleSelect;
@@ -81,8 +81,8 @@ var getOptionValue = function (selectedOption) {
81
81
  };
82
82
  var loadingMessage = function () { return i18n._({ id: 'components.dropdown.loading', message: 'Loading...' }); };
83
83
  var SingleSelect = function (props) {
84
- var name = props.name, onChange = props.onChange, onBlur = props.onBlur, onValueChange = props.onValueChange, loadOptions = props.loadOptions, _a = props.asyncLoadMinChars, asyncLoadMinChars = _a === void 0 ? 0 : _a, isLocked = props.isLocked, _b = props.lockedText, lockedText = _b === void 0 ? i18n._({ id: 'components.dropdown.notReact', message: 'Select related values first...' }) : _b, disabled = props.disabled, _c = props.placeholder, placeholder = _c === void 0 ? i18n._({ id: 'components.dropdown.placeholder', message: 'Select...' }) : _c, preload = props.preload, initialOptions = props.initialOptions, onCreateOption = props.onCreateOption, options = props.options, filterOption = props.filterOption;
85
- var _d = useState(false), isCreating = _d[0], setIsCreating = _d[1];
84
+ var name = props.name, onChange = props.onChange, onBlur = props.onBlur, onValueChange = props.onValueChange, loadOptions = props.loadOptions, _a = props.asyncLoadMinChars, asyncLoadMinChars = _a === void 0 ? 0 : _a, isLocked = props.isLocked, _b = props.lockedText, lockedText = _b === void 0 ? i18n._({ id: 'components.dropdown.notReact', message: 'Select related values first...' }) : _b, disabled = props.disabled, _c = props.placeholder, placeholder = _c === void 0 ? i18n._({ id: 'components.dropdown.placeholder', message: 'Select...' }) : _c, preload = props.preload, initialOptions = props.initialOptions, onCreateOption = props.onCreateOption, options = props.options, filterOption = props.filterOption, _d = props.shouldReloadOptions, shouldReloadOptions = _d === void 0 ? false : _d;
85
+ var _e = useState(false), isCreating = _e[0], setIsCreating = _e[1];
86
86
  var asAsync = !!loadOptions || !!onCreateOption;
87
87
  var noOptionsMessage = useCallback(function (inputValue) {
88
88
  return loadOptions && inputValue.length < asyncLoadMinChars
@@ -111,13 +111,13 @@ var SingleSelect = function (props) {
111
111
  return loadOptions(inputValue, false);
112
112
  }
113
113
  }, [onCreateOption, loadOptions, asyncLoadMinChars, options]);
114
- var _e = useState(options || []), loadedDefaultOptions = _e[0], setLoadedDefaultOptions = _e[1];
114
+ var _f = useState(options || []), loadedDefaultOptions = _f[0], setLoadedDefaultOptions = _f[1];
115
115
  useEffect(function () {
116
116
  if (loadOptions && preload && !props.value)
117
117
  loadOptions('', false).then(setLoadedDefaultOptions);
118
118
  // eslint-disable-next-line react-hooks/exhaustive-deps
119
119
  }, [loadOptions]); // this is intentional
120
- var _f = useState(null), storedSelectedOption = _f[0], setStoredSelectedOption = _f[1];
120
+ var _g = useState(null), storedSelectedOption = _g[0], setStoredSelectedOption = _g[1];
121
121
  useEffect(function () {
122
122
  if (initialOptions && initialOptions.length) {
123
123
  var selectedOption = initialOptions.find(function (option) { return option.value == props.value; }) || null;
@@ -129,6 +129,11 @@ var SingleSelect = function (props) {
129
129
  // ignored because of props.value, this only finds option for initial value
130
130
  // eslint-disable-next-line react-hooks/exhaustive-deps
131
131
  }, [initialOptions, setStoredSelectedOption]);
132
+ useEffect(function () {
133
+ if (shouldReloadOptions) {
134
+ setLoadedDefaultOptions(options || []);
135
+ }
136
+ }, [options]);
132
137
  var handleChange = useCallback(function (option) { return __awaiter(void 0, void 0, void 0, function () {
133
138
  var value, newOption;
134
139
  var _a, _b, _c, _d;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import type { StoryObj } from '@storybook/react';
3
+ declare const meta: {
4
+ title: string;
5
+ component: ({ closeToast, title, text, type, autoClose }: import("../Toast").CustomToastProps) => JSX.Element;
6
+ tags: string[];
7
+ argTypes: {};
8
+ };
9
+ export default meta;
10
+ type Story = StoryObj<typeof meta>;
11
+ export declare const Info: Story;
12
+ export declare const Success: Story;
13
+ export declare const Error: Story;
14
+ export declare const Warning: Story;
@@ -0,0 +1,36 @@
1
+ import Toast from '../Toast';
2
+ var meta = {
3
+ title: 'Elements/Toast',
4
+ component: Toast,
5
+ tags: ['autodocs'],
6
+ argTypes: {}
7
+ };
8
+ export default meta;
9
+ export var Info = {
10
+ args: {
11
+ type: 'info',
12
+ title: 'Title of info toast',
13
+ text: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vivamus ac leo pretium faucibus. Aenean placerat. In convallis. Ut tempus purus at lorem. Pellentesque arcu. '
14
+ }
15
+ };
16
+ export var Success = {
17
+ args: {
18
+ type: 'success',
19
+ title: 'Title of success toast',
20
+ text: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vivamus ac leo pretium faucibus. Aenean placerat. In convallis. Ut tempus purus at lorem. Pellentesque arcu. '
21
+ }
22
+ };
23
+ export var Error = {
24
+ args: {
25
+ type: 'error',
26
+ title: 'Title of error toast',
27
+ text: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vivamus ac leo pretium faucibus. Aenean placerat. In convallis. Ut tempus purus at lorem. Pellentesque arcu. '
28
+ }
29
+ };
30
+ export var Warning = {
31
+ args: {
32
+ type: 'warning',
33
+ title: 'Title of warning toast',
34
+ text: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vivamus ac leo pretium faucibus. Aenean placerat. In convallis. Ut tempus purus at lorem. Pellentesque arcu. '
35
+ }
36
+ };
@@ -6,7 +6,7 @@ import styled, { css, keyframes, th } from '@xstyled/styled-components';
6
6
  export var Title = styled.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: block;\n margin-bottom: 5px;\n line-height: 18px;\n font-weight: 700;\n color: ", ";\n"], ["\n display: block;\n margin-bottom: 5px;\n line-height: 18px;\n font-weight: 700;\n color: ", ";\n"])), th('colors.blue2'));
7
7
  export var Text = styled.span(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: block;\n font-size: 12px;\n line-height: 18px;\n font-weight: 500;\n color: ", ";\n"], ["\n display: block;\n font-size: 12px;\n line-height: 18px;\n font-weight: 500;\n color: ", ";\n"])), th('colors.gray1'));
8
8
  export var ContentWrapper = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n"], ["\n display: flex;\n justify-content: space-between;\n"])));
9
- export var CloseWrapper = styled.span(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n margin-left: 15px;\n\n svg {\n cursor: pointer;\n }\n"], ["\n display: flex;\n align-items: center;\n margin-left: 15px;\n\n svg {\n cursor: pointer;\n }\n"])));
9
+ export var CloseWrapper = styled.span(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n align-items: flex-start;\n margin-left: 15px;\n\n svg {\n cursor: pointer;\n }\n"], ["\n display: flex;\n align-items: flex-start;\n margin-left: 15px;\n\n svg {\n cursor: pointer;\n }\n"])));
10
10
  var timerAnimation = keyframes(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n to {\n transform: scaleX(0)\n }\n"], ["\n to {\n transform: scaleX(0)\n }\n"])));
11
11
  var after = function (autoClose) { return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n &:after {\n position: absolute;\n bottom: 0;\n left: 0;\n content: '';\n height: 4px;\n width: 100%;\n transform-origin: left center;\n animation: ", " ", "ms linear;\n border-radius: ", ";\n background-color: ", ";\n }\n"], ["\n &:after {\n position: absolute;\n bottom: 0;\n left: 0;\n content: '';\n height: 4px;\n width: 100%;\n transform-origin: left center;\n animation: ", " ", "ms linear;\n border-radius: ", ";\n background-color: ", ";\n }\n"])), timerAnimation, autoClose, th.radius('lg'), th.color('lightGray5')); };
12
12
  export var Container = styled.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n display: flex;\n position: relative;\n background-color: white;\n border-radius: ", ";\n box-shadow: ", ";\n padding: 10px;\n\n @media ", " {\n font-size: 14px;\n }\n\n &:before {\n position: absolute;\n top: 5px;\n bottom: 5px;\n left: 5px;\n content: '';\n width: 4px;\n ", ";\n border-radius: ", ";\n background-color: ", ";\n }\n\n ", ";\n"], ["\n display: flex;\n position: relative;\n background-color: white;\n border-radius: ", ";\n box-shadow: ", ";\n padding: 10px;\n\n @media ", " {\n font-size: 14px;\n }\n\n &:before {\n position: absolute;\n top: 5px;\n bottom: 5px;\n left: 5px;\n content: '';\n width: 4px;\n ", ";\n border-radius: ", ";\n background-color: ", ";\n }\n\n ", ";\n"])), th.radius('lg'), th.shadow('cornerDialogShadow'), '(max-width: 576px)', function (_a) {