@mailstep/design-system 0.6.73-beta.5 → 0.6.74

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.73-beta.5",
3
+ "version": "0.6.74",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "./ui/index.js",
@@ -22,11 +22,11 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  };
23
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
24
  import { useCallback, useState } from 'react';
25
- import { useClickOutside } from '../../../Modal/hooks/useClickOutside';
26
25
  import { Input } from '../../../../Forms/Input/Input';
26
+ import { useClickOutside } from '../../../Modal/hooks/useClickOutside';
27
+ import { useEvent } from '../../hooks/useEvent';
27
28
  import IconList from '../IconList';
28
29
  import { i18n } from '@lingui/core';
29
- import { useEvent } from '../../hooks/useEvent';
30
30
  var OverlayComponentDefault = function (_a) {
31
31
  var children = _a.children;
32
32
  return _jsx("div", { children: children });
@@ -38,25 +38,30 @@ var createNumberComparators = function () { return [
38
38
  {
39
39
  label: i18n._({ id: 'dataGrid.comparator.lessThanOrEquals', message: 'Less than or equals' }),
40
40
  value: 'lte',
41
- icon: 'lessThanEqual',
41
+ icon: 'lessThanEqual'
42
42
  },
43
43
  { label: i18n._({ id: 'dataGrid.comparator.greaterThan', message: 'Greater than' }), value: 'gt', icon: 'greaterThan' },
44
44
  {
45
45
  label: i18n._({ id: 'dataGrid.comparator.greaterThanOrEquals', message: 'Greater than or equal' }),
46
46
  value: 'gte',
47
- icon: 'greaterThanEqual',
48
- },
47
+ icon: 'greaterThanEqual'
48
+ }
49
49
  ]; };
50
50
  var createEqualComparators = [
51
51
  { label: i18n._({ id: 'dataGrid.comparator.equals', message: 'Equals' }), value: 'eq', icon: 'equals' },
52
- { label: i18n._({ id: 'dataGrid.comparator.notEquals', message: 'Not equal' }), value: 'neq', icon: 'notEqual' },
52
+ { label: i18n._({ id: 'dataGrid.comparator.notEquals', message: 'Not equal' }), value: 'neq', icon: 'notEqual' }
53
53
  ];
54
54
  var NumberRange = function (props) {
55
+ var _a;
55
56
  var numberComparators = createNumberComparators();
56
- var name = props.name, _a = props.value, value = _a === void 0 ? {} : _a, label = props.label, onChange = props.onChange, decimals = props.decimals, className = props.className, _b = props.OverlayComponent, OverlayComponent = _b === void 0 ? OverlayComponentDefault : _b, isEqual = props.isEqual, rest = __rest(props, ["name", "value", "label", "onChange", "decimals", "className", "OverlayComponent", "isEqual"]);
57
- var _c = useState(false), isOpen = _c[0], setOpen = _c[1];
58
- var comparator = (value === null || value === void 0 ? void 0 : value.comparator) || numberComparators[0].value;
59
- var renderedComparator = isEqual ? createEqualComparators : numberComparators;
57
+ var name = props.name, _b = props.value, value = _b === void 0 ? {} : _b, label = props.label, onChange = props.onChange, decimals = props.decimals, className = props.className, _c = props.OverlayComponent, OverlayComponent = _c === void 0 ? OverlayComponentDefault : _c, comparators = props.comparators, defaultComparator = props.defaultComparator, isEqual = props.isEqual, rest = __rest(props, ["name", "value", "label", "onChange", "decimals", "className", "OverlayComponent", "comparators", "defaultComparator", "isEqual"]);
58
+ var _d = useState(false), isOpen = _d[0], setOpen = _d[1];
59
+ var comparator = (value === null || value === void 0 ? void 0 : value.comparator) ||
60
+ defaultComparator ||
61
+ ((_a = comparators === null || comparators === void 0 ? void 0 : comparators[0]) === null || _a === void 0 ? void 0 : _a.value) ||
62
+ numberComparators[0].value;
63
+ var defaultComparators = isEqual ? createEqualComparators : numberComparators;
64
+ var comparatorOptions = comparators || defaultComparators;
60
65
  var fieldValue = (value === null || value === void 0 ? void 0 : value.value) || (value === null || value === void 0 ? void 0 : value.value) === 0 ? value.value : '';
61
66
  var onClose = useCallback(function () { return setOpen(false); }, []);
62
67
  var pickerRef = useClickOutside({ onClose: onClose });
@@ -70,6 +75,6 @@ var NumberRange = function (props) {
70
75
  var onChangeComparator = useEvent(function (option) {
71
76
  onChange({ comparator: option.value, value: fieldValue });
72
77
  });
73
- return (_jsxs("div", { ref: pickerRef, children: [_jsx(Input, __assign({ name: name, value: fieldValue, label: label, "data-cy": "".concat(name, "Inp"), onChange: onChangeTextInput, iconOnClick: togglePicker, icon: "ellipsisVertical", iconPlacement: "right", type: "text", className: className, autoComplete: "off" }, rest)), isOpen && (_jsx(OverlayComponent, { children: _jsx(IconList, { list: renderedComparator, selected: comparator, onClick: onChangeComparator }) }))] }));
78
+ return (_jsxs("div", { ref: pickerRef, children: [_jsx(Input, __assign({ name: name, value: fieldValue, label: label, "data-cy": "".concat(name, "Inp"), onChange: onChangeTextInput, iconOnClick: togglePicker, icon: "ellipsisVertical", iconPlacement: "right", type: "text", className: className, autoComplete: "off" }, rest)), isOpen && (_jsx(OverlayComponent, { children: _jsx(IconList, { list: comparatorOptions, selected: comparator, onClick: onChangeComparator }) }))] }));
74
79
  };
75
80
  export default NumberRange;
@@ -1,17 +1,13 @@
1
- import { FilterComponentProps } from '../../types';
1
+ import { Comparator, FilterComponentProps } from '../../types';
2
2
  export type ComparatorValue = 'eq' | 'neq' | 'lt' | 'lte' | 'gt' | 'gte';
3
3
  export type NumberRangeValue = {
4
4
  comparator?: ComparatorValue;
5
5
  value?: string | number;
6
6
  };
7
- export type Comparator = {
8
- label: string;
9
- value: string;
10
- icon: string;
11
- };
12
7
  export type NumberRangeProps = FilterComponentProps<NumberRangeValue> & {
13
8
  decimals?: number;
14
9
  label?: string;
15
10
  className?: string;
16
11
  isEqual?: boolean;
12
+ comparators?: Comparator[];
17
13
  };
@@ -22,12 +22,12 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  };
23
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
24
  import { useCallback, useState } from 'react';
25
- import { Trans } from '@lingui/react';
26
- import { useClickOutside } from '../../../Modal/hooks/useClickOutside';
27
25
  import { Input } from '../../../../Forms/Input/Input';
26
+ import { useClickOutside } from '../../../Modal/hooks/useClickOutside';
27
+ import { useEvent } from '../../hooks/useEvent';
28
28
  import IconList from '../IconList/IconList';
29
29
  import { i18n } from '@lingui/core';
30
- import { useEvent } from '../../hooks/useEvent';
30
+ import { Trans } from '@lingui/react';
31
31
  var OverlayComponentDefault = function (_a) {
32
32
  var children = _a.children;
33
33
  return _jsx("div", { children: children });
@@ -39,32 +39,34 @@ var createTextComparators = function () { return [
39
39
  { label: i18n._({ id: 'dataGrid.comparator.equals', message: 'Equals' }), value: 'eq', icon: 'equals' },
40
40
  { label: i18n._({ id: 'dataGrid.comparator.notEquals', message: 'Not equal' }), value: 'neq', icon: 'notEqual' },
41
41
  { label: i18n._({ id: 'dataGrid.comparator.startsWith', message: 'Starts with' }), value: 'startsWith', icon: 'startsWith' },
42
- { label: i18n._({ id: 'dataGrid.comparator.endsWith', message: 'Ends with' }), value: 'endsWith', icon: 'endsWith' },
42
+ { label: i18n._({ id: 'dataGrid.comparator.endsWith', message: 'Ends with' }), value: 'endsWith', icon: 'endsWith' }
43
43
  ]; };
44
44
  var createPresentTextComparators = function () { return [
45
45
  { label: i18n._({ id: 'dataGrid.comparator.contains', message: 'Contains' }), value: 'like', icon: 'check' },
46
- { label: i18n._({ id: 'dataGrid.comparator.equals', message: 'Equals' }), value: 'in', icon: 'equals' },
46
+ { label: i18n._({ id: 'dataGrid.comparator.equals', message: 'Equals' }), value: 'in', icon: 'equals' }
47
47
  ]; };
48
48
  var createEqualComparators = function () { return [
49
49
  { label: i18n._({ id: 'dataGrid.comparator.equals', message: 'Equals' }), value: 'eq', icon: 'equals' },
50
- { label: i18n._({ id: 'dataGrid.comparator.notEquals', message: 'Not equal' }), value: 'neq', icon: 'notEqual' },
50
+ { label: i18n._({ id: 'dataGrid.comparator.notEquals', message: 'Not equal' }), value: 'neq', icon: 'notEqual' }
51
51
  ]; };
52
52
  var validations = {
53
53
  ip: {
54
54
  check: function (value) { return ipv4.test(value.trim()); },
55
- errorMsg: _jsx(Trans, { id: "dataGrid.errors.ipValidationError", message: "Value is not valid ip" }),
56
- },
55
+ errorMsg: _jsx(Trans, { id: "dataGrid.errors.ipValidationError", message: "Value is not valid ip" })
56
+ }
57
57
  };
58
58
  var TextRange = function (props) {
59
- var name = props.name, _a = props.value, value = _a === void 0 ? {} : _a, label = props.label, onChange = props.onChange, className = props.className, _b = props.OverlayComponent, OverlayComponent = _b === void 0 ? OverlayComponentDefault : _b, eqOnly = props.eqOnly, isPresent = props.isPresent, isEqual = props.isEqual, defaultComparator = props.defaultComparator, validationKey = props.validation, rest = __rest(props, ["name", "value", "label", "onChange", "className", "OverlayComponent", "eqOnly", "isPresent", "isEqual", "defaultComparator", "validation"]);
59
+ var _a;
60
+ var name = props.name, _b = props.value, value = _b === void 0 ? {} : _b, label = props.label, onChange = props.onChange, className = props.className, _c = props.OverlayComponent, OverlayComponent = _c === void 0 ? OverlayComponentDefault : _c, eqOnly = props.eqOnly, isPresent = props.isPresent, isEqual = props.isEqual, defaultComparator = props.defaultComparator, comparators = props.comparators, validationKey = props.validation, rest = __rest(props, ["name", "value", "label", "onChange", "className", "OverlayComponent", "eqOnly", "isPresent", "isEqual", "defaultComparator", "comparators", "validation"]);
60
61
  var eqOnlyTxt = i18n._({ id: 'dataGrid.filterTxtEqWarning', message: 'This filter can only do exact match' });
61
- var _c = useState(false), isOpen = _c[0], setOpen = _c[1];
62
+ var _d = useState(false), isOpen = _d[0], setOpen = _d[1];
62
63
  var textComparators = createTextComparators();
63
64
  var presentTextComparators = createPresentTextComparators();
64
65
  var equalComparators = createEqualComparators();
65
- var fallbackComparator = defaultComparator || textComparators[0].value;
66
+ var fallbackComparator = defaultComparator || ((_a = comparators === null || comparators === void 0 ? void 0 : comparators[0]) === null || _a === void 0 ? void 0 : _a.value) || textComparators[0].value;
66
67
  var comparator = eqOnly ? 'eq' : (value === null || value === void 0 ? void 0 : value.comparator) || fallbackComparator;
67
- var renderedComparator = isEqual ? equalComparators : isPresent ? presentTextComparators : textComparators;
68
+ var defaultComparators = isEqual ? equalComparators : isPresent ? presentTextComparators : textComparators;
69
+ var comparatorOptions = comparators || defaultComparators;
68
70
  var fieldValue = (value === null || value === void 0 ? void 0 : value.value) || '';
69
71
  var onClose = useCallback(function () {
70
72
  setOpen(false);
@@ -85,6 +87,6 @@ var TextRange = function (props) {
85
87
  var onChangeComparator = useEvent(function (option) {
86
88
  onChange({ comparator: option.value, value: fieldValue, isInvalid: isInvalid });
87
89
  });
88
- return (_jsxs("div", { ref: pickerRef, children: [_jsx(Input, __assign({ name: name, "data-test": name, "data-cy": "".concat(name, "Inp"), value: fieldValue, label: label, onChange: onChangeTextInput, iconOnClick: !eqOnly ? togglePicker : undefined, icon: !eqOnly ? 'ellipsisVertical' : 'warning', iconPlacement: "right", iconTooltip: eqOnly ? eqOnlyTxt : undefined, type: "text", className: className, error: (!!validation && isInvalid && validation.errorMsg) || '', errorAppearance: 'tooltip', autoComplete: "off" }, rest)), isOpen && (_jsx(OverlayComponent, { children: _jsx(IconList, { list: renderedComparator, selected: comparator, onClick: onChangeComparator }) }))] }));
90
+ return (_jsxs("div", { ref: pickerRef, children: [_jsx(Input, __assign({ name: name, "data-test": name, "data-cy": "".concat(name, "Inp"), value: fieldValue, label: label, onChange: onChangeTextInput, iconOnClick: !eqOnly ? togglePicker : undefined, icon: !eqOnly ? 'ellipsisVertical' : 'warning', iconPlacement: "right", iconTooltip: eqOnly ? eqOnlyTxt : undefined, type: "text", className: className, error: (!!validation && isInvalid && validation.errorMsg) || '', errorAppearance: 'tooltip', autoComplete: "off" }, rest)), isOpen && (_jsx(OverlayComponent, { children: _jsx(IconList, { list: comparatorOptions, selected: comparator, onClick: onChangeComparator }) }))] }));
89
91
  };
90
92
  export default TextRange;
@@ -1,15 +1,10 @@
1
- import { FilterComponentProps } from '../../types';
2
- export type TextRangeComparator = 'like' | 'notLike' | 'eq' | 'neq' | 'startsWith' | 'endsWith';
1
+ import { FilterComponentProps, Comparator } from '../../types';
2
+ export type TextRangeComparator = 'like' | 'notLike' | 'eq' | 'neq' | 'startsWith' | 'endsWith' | 'contains';
3
3
  export type TextRangeValue = {
4
4
  comparator?: TextRangeComparator;
5
5
  value?: string | number;
6
6
  isInvalid?: boolean;
7
7
  };
8
- export type Comparator = {
9
- label: string;
10
- value: string;
11
- icon: string;
12
- };
13
8
  export type Props = FilterComponentProps<TextRangeValue> & {
14
9
  eqOnly?: boolean;
15
10
  isPresent?: boolean;
@@ -18,4 +13,5 @@ export type Props = FilterComponentProps<TextRangeValue> & {
18
13
  validation?: string;
19
14
  className?: string;
20
15
  isEqual?: boolean;
16
+ comparators?: Comparator[];
21
17
  };
@@ -18,11 +18,6 @@ declare const useQuickFilter: ({ gridActions, gridSelectors, quickFilter, displa
18
18
  onClear: () => void;
19
19
  isMobileInputView: boolean;
20
20
  isMobile: boolean;
21
- filter: {
22
- [column: string]: {
23
- value: any;
24
- filterProps: import("../types").FilterProps;
25
- };
26
- } | undefined;
21
+ filter: import("../types").Filtering | undefined;
27
22
  };
28
23
  export default useQuickFilter;
@@ -1,9 +1,9 @@
1
1
  import { useCallback, useEffect, useState } from 'react';
2
+ import { isObject } from 'lodash';
2
3
  import { useCheckDeviceWidth } from '../../../utils/CheckDeviceWidth/checkDeviceWidth';
3
4
  import { createFilterType } from '../utils';
4
- import { useAddFilter } from './useAddFilter';
5
- import { isObject } from 'lodash';
6
5
  import { i18n } from '@lingui/core';
6
+ import { useAddFilter } from './useAddFilter';
7
7
  var defaultVoidFunction = function () {
8
8
  var args = [];
9
9
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -46,7 +46,7 @@ var useQuickFilter = function (_a) {
46
46
  setSearchedValue(e.target.value);
47
47
  var value = {
48
48
  comparator: searchComparator,
49
- value: e.target.value,
49
+ value: e.target.value
50
50
  };
51
51
  searchedColumnsDefinitions && handleAddFilter(value, searchedColumnsDefinitions);
52
52
  }, [setSearchedValue, searchComparator, handleAddFilter, searchedColumnsDefinitions]);
@@ -67,11 +67,11 @@ var useQuickFilter = function (_a) {
67
67
  resetFilters === null || resetFilters === void 0 ? void 0 : resetFilters();
68
68
  setSearchedValue === null || setSearchedValue === void 0 ? void 0 : setSearchedValue('');
69
69
  }, [resetFilters, setSearchedValue]);
70
- var translatedValue = searchedColumnsDefinitions &&
71
- isObject(searchedColumnsDefinitions === null || searchedColumnsDefinitions === void 0 ? void 0 : searchedColumnsDefinitions.title) &&
72
- 'props' in (searchedColumnsDefinitions === null || searchedColumnsDefinitions === void 0 ? void 0 : searchedColumnsDefinitions.title) &&
73
- ((_d = searchedColumnsDefinitions.title) === null || _d === void 0 ? void 0 : _d.props) &&
74
- i18n._({ id: (_f = (_e = searchedColumnsDefinitions.title) === null || _e === void 0 ? void 0 : _e.props) === null || _f === void 0 ? void 0 : _f.id, message: (_g = searchedColumnsDefinitions.title) === null || _g === void 0 ? void 0 : _g.props.message });
70
+ var translatedValue = searchedColumnsDefinitions && isObject(searchedColumnsDefinitions === null || searchedColumnsDefinitions === void 0 ? void 0 : searchedColumnsDefinitions.title)
71
+ ? 'props' in (searchedColumnsDefinitions === null || searchedColumnsDefinitions === void 0 ? void 0 : searchedColumnsDefinitions.title) &&
72
+ ((_d = searchedColumnsDefinitions.title) === null || _d === void 0 ? void 0 : _d.props) &&
73
+ i18n._({ id: (_f = (_e = searchedColumnsDefinitions.title) === null || _e === void 0 ? void 0 : _e.props) === null || _f === void 0 ? void 0 : _f.id, message: (_g = searchedColumnsDefinitions.title) === null || _g === void 0 ? void 0 : _g.props.message })
74
+ : searchedColumnsDefinitions === null || searchedColumnsDefinitions === void 0 ? void 0 : searchedColumnsDefinitions.title;
75
75
  return {
76
76
  searchedValue: searchedValue,
77
77
  translatedValue: translatedValue,
@@ -82,7 +82,7 @@ var useQuickFilter = function (_a) {
82
82
  onClear: onClear,
83
83
  isMobileInputView: isMobileInputView,
84
84
  isMobile: isMobile,
85
- filter: filter,
85
+ filter: filter
86
86
  };
87
87
  };
88
88
  export default useQuickFilter;
@@ -65,13 +65,13 @@ export type FiltersConfig = {
65
65
  };
66
66
  };
67
67
  };
68
- type Filtering = {
68
+ export type Filtering = {
69
69
  [column: string]: {
70
70
  value: any;
71
71
  filterProps: FilterProps;
72
72
  };
73
73
  };
74
- type Sorting = {
74
+ export type Sorting = {
75
75
  column: string;
76
76
  direction: SortingValueType;
77
77
  }[];
@@ -106,7 +106,7 @@ export type ColumnDefinition<ColumnName extends string = string> = ColumnBasePro
106
106
  disableRowTouch?: boolean;
107
107
  filterExtraProps?: {
108
108
  isMulti?: boolean;
109
- comparators?: any;
109
+ comparators?: Comparator[];
110
110
  filterTime?: boolean;
111
111
  decimals?: number;
112
112
  isFloat?: boolean;
@@ -311,4 +311,9 @@ export type FloatingButtonProps = {
311
311
  options?: Item[];
312
312
  onClick?: (value?: string) => void;
313
313
  };
314
+ export type Comparator = {
315
+ label: string;
316
+ value: string;
317
+ icon: string;
318
+ };
314
319
  export {};
@@ -6,7 +6,7 @@ import { SocialLinks } from './components/SocialLinks';
6
6
  import { EMAIL_ADDRESS } from './utils/links';
7
7
  import { Trans } from '@lingui/react';
8
8
  import { x } from '@xstyled/styled-components';
9
- import { Wrapper, MailTo, LanguageBox, LogoWrapper, MainLogo, CardBodyWithLanguage, Version } from './styles';
9
+ import { Wrapper, MailTo, LanguageBox, LogoWrapper, MainLogo, Version, CardBodyWithLanguage } from './styles';
10
10
  var Login = function (_a) {
11
11
  var onSubmit = _a.onSubmit, activeLanguage = _a.activeLanguage, onLanguageChange = _a.onLanguageChange, children = _a.children, brand = _a.brand, brandVariant = _a.brandVariant, isSubmitting = _a.isSubmitting, isSubmitDisabled = _a.isSubmitDisabled, withDistributionCenterSelect = _a.withDistributionCenterSelect, distributionCenterOptions = _a.distributionCenterOptions, selectedDistributionCenter = _a.selectedDistributionCenter, onChangeDistributionCenter = _a.onChangeDistributionCenter, languageItems = _a.languageItems, version = _a.version, backgroundImage = _a.backgroundImage, _b = _a.hasSupport, hasSupport = _b === void 0 ? true : _b, _c = _a.hasSocialLinks, hasSocialLinks = _c === void 0 ? true : _c;
12
12
  return (_jsxs(Wrapper, { backgroundImage: backgroundImage, children: [_jsxs(CardBodyWithLanguage, { children: [_jsx(LogoWrapper, { children: _jsx(MainLogo, { brand: brand, variant: brandVariant }) }), _jsxs(LanguageBox, { children: [hasSupport && (_jsxs(x.div, { mr: 4, children: [_jsx(H6, { color: "gray1", variant: "bold", mt: "8px", mb: "8px", as: "h6", children: _jsx(Trans, { id: "form.heading.support", message: "Support:" }) }), _jsx(MailTo, { href: "mailto:mailstep@mailstep.cz", children: EMAIL_ADDRESS })] })), _jsx(LanguageSwitch, { activeLanguage: activeLanguage, onLanguageChange: onLanguageChange, languageItems: languageItems })] }), _jsx(LoginForm, { onSubmit: onSubmit, isSubmitDisabled: isSubmitDisabled, isSubmitting: isSubmitting, onChangeDistributionCenter: onChangeDistributionCenter, withDistributionCenterSelect: withDistributionCenterSelect, distributionCenterOptions: distributionCenterOptions, selectedDistributionCenter: selectedDistributionCenter })] }), children, version && _jsx(Version, { children: version }), hasSocialLinks && _jsx(SocialLinks, {})] }));
@@ -3,7 +3,7 @@ export declare const Wrapper: import("styled-components").StyledComponent<"div",
3
3
  backgroundImage?: "mailship" | undefined;
4
4
  }, never>;
5
5
  export declare const LanguageBox: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {}, never>;
6
- export declare const CardBodyWithLanguage: import("styled-components").StyledComponent<({ children, ...rest }: import("../../Elements/Card/types").PropsBody) => JSX.Element, import("@xstyled/system").Theme, {}, never>;
6
+ export declare const CardBodyWithLanguage: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {}, never>;
7
7
  export declare const MailTo: import("styled-components").StyledComponent<"a", import("@xstyled/system").Theme, {}, never>;
8
8
  export declare const LogoWrapper: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {}, never>;
9
9
  export declare const MainLogo: import("styled-components").StyledComponent<({ brand, variant, size, width, height, ...rest }: import("../../Elements/Logo/types").LogoProps) => JSX.Element | null, import("@xstyled/system").Theme, {}, never>;
@@ -2,7 +2,6 @@ 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 { CardBody } from '../../Elements/Card/Card';
6
5
  import Logo from '../../Elements/Logo/Logo';
7
6
  import mailship from './assets/mailship.jpg';
8
7
  import styled, { th } from '@xstyled/styled-components';
@@ -14,7 +13,7 @@ export var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTe
14
13
  return "transparent ".concat(backgroundImage && "url(".concat(backgroundImageMap[backgroundImage], ")"), " 50% 0% no-repeat padding-box;");
15
14
  });
16
15
  export var LanguageBox = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n margin: 15px 0;\n align-items: flex-end;\n justify-content: space-between;\n @media (min-width: 1024px) {\n justify-content: flex-end;\n margin: 40px 0;\n }\n"], ["\n display: flex;\n margin: 15px 0;\n align-items: flex-end;\n justify-content: space-between;\n @media (min-width: 1024px) {\n justify-content: flex-end;\n margin: 40px 0;\n }\n"])));
17
- export var CardBodyWithLanguage = styled(CardBody)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n justify-content: start;\n padding: 0 32px 10px 32px;\n flex-grow: 1;\n margin: auto;\n width: 500px;\n @media (min-width: 1024px) {\n display: block;\n flex-grow: 0;\n }\n"], ["\n display: flex;\n justify-content: start;\n padding: 0 32px 10px 32px;\n flex-grow: 1;\n margin: auto;\n width: 500px;\n @media (min-width: 1024px) {\n display: block;\n flex-grow: 0;\n }\n"])));
16
+ export var CardBodyWithLanguage = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n justify-content: start;\n padding: 0 32px 10px 32px;\n flex-grow: 1;\n margin: auto;\n width: 500px;\n @media (min-width: 1024px) {\n display: block;\n flex-grow: 0;\n }\n"], ["\n display: flex;\n justify-content: start;\n padding: 0 32px 10px 32px;\n flex-grow: 1;\n margin: auto;\n width: 500px;\n @media (min-width: 1024px) {\n display: block;\n flex-grow: 0;\n }\n"])));
18
17
  export var MailTo = styled.a(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n color: ", ";\n &:hover {\n color: ", ";\n }\n"], ["\n color: ", ";\n &:hover {\n color: ", ";\n }\n"])), th.color('typoPrimary'), th.color('red1'));
19
18
  export var LogoWrapper = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n margin-top: 30px;\n @media (min-width: 1024px) {\n display: block;\n margin-top: 0;\n }\n"], ["\n display: flex;\n justify-content: center;\n margin-top: 30px;\n @media (min-width: 1024px) {\n display: block;\n margin-top: 0;\n }\n"])));
20
19
  export var MainLogo = styled(Logo)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n width: 50%;\n height: auto;\n"], ["\n width: 50%;\n height: auto;\n"])));
@@ -1,6 +1,4 @@
1
- import { CardComponentProps, CardProps, PropsBody, PropsCardImage } from './types';
2
- export declare const Card: ({ children, block, hasBorder, backgroundColor, ...rest }: CardProps) => JSX.Element;
3
- export declare const CardBody: ({ children, ...rest }: PropsBody) => JSX.Element;
4
- export declare const CardImage: ({ children, color, ...rest }: PropsCardImage) => JSX.Element;
5
- declare const CardComponent: ({ img, body, children, color }: CardComponentProps) => import("react/jsx-runtime").JSX.Element;
6
- export default CardComponent;
1
+ import { FC } from 'react';
2
+ import { CardProps } from './types';
3
+ declare const Card: FC<CardProps>;
4
+ export default Card;
@@ -1,45 +1,7 @@
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);
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { StyledCard } from './styles';
3
+ var Card = function (_a) {
4
+ var children = _a.children, _b = _a.display, display = _b === void 0 ? 'block' : _b, bg = _a.bg, onClick = _a.onClick, maxWidth = _a.maxWidth;
5
+ return (_jsx(StyledCard, { onClick: onClick, bg: bg, display: display, maxWidth: maxWidth, hasOnClick: !!onClick, children: children }));
11
6
  };
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 { th } from '@xstyled/styled-components';
25
- import { useTheme } from '@xstyled/styled-components';
26
- import { StyledCard, CardWrapper, StyledBody, ImageWrapper, StyledImage } from './styles';
27
- export var Card = function (_a) {
28
- var children = _a.children, block = _a.block, _b = _a.hasBorder, hasBorder = _b === void 0 ? true : _b, backgroundColor = _a.backgroundColor, rest = __rest(_a, ["children", "block", "hasBorder", "backgroundColor"]);
29
- return (_jsx(CardWrapper, { block: block, children: _jsx(StyledCard, __assign({ block: block, hasBorder: hasBorder, backgroundColor: backgroundColor }, rest, { children: children })) }));
30
- };
31
- export var CardBody = function (_a) {
32
- var children = _a.children, rest = __rest(_a, ["children"]);
33
- return _jsx(StyledBody, __assign({}, rest, { children: children }));
34
- };
35
- export var CardImage = function (_a) {
36
- var children = _a.children, _b = _a.color, color = _b === void 0 ? 'white' : _b, rest = __rest(_a, ["children", "color"]);
37
- var theme = useTheme();
38
- var themeColor = th.color(color)({ theme: theme });
39
- return (_jsx(ImageWrapper, { color: themeColor, children: _jsx(StyledImage, __assign({}, rest, { children: children })) }));
40
- };
41
- var CardComponent = function (_a) {
42
- var img = _a.img, body = _a.body, children = _a.children, color = _a.color;
43
- return (_jsxs(Card, { children: [img && (_jsx(CardImage, { color: color, children: _jsx("img", { src: img, width: "300" }) })), _jsxs(CardBody, { children: [body, children] })] }));
44
- };
45
- export default CardComponent;
7
+ export default Card;
@@ -1,3 +1,2 @@
1
- import CardComponent from './Card';
2
- export { Card, CardImage, CardBody } from './Card';
3
- export default CardComponent;
1
+ import Card from './Card';
2
+ export default Card;
@@ -1,3 +1,2 @@
1
- import CardComponent from './Card';
2
- export { Card, CardImage, CardBody } from './Card';
3
- export default CardComponent;
1
+ import Card from './Card';
2
+ export default Card;
@@ -2,14 +2,13 @@
2
2
  import type { StoryObj } from '@storybook/react';
3
3
  declare const meta: {
4
4
  title: string;
5
- component: ({ children, block, hasBorder, backgroundColor, ...rest }: import("../types").CardProps) => JSX.Element;
5
+ component: import("react").FC<import("../types").CardProps>;
6
6
  tags: string[];
7
7
  argTypes: {};
8
8
  };
9
9
  export default meta;
10
10
  type Story = StoryObj<typeof meta>;
11
11
  export declare const Default: Story;
12
- export declare const NoBorder: Story;
13
- export declare const WithPadding: Story;
14
- export declare const WithShadow: Story;
15
- export declare const WithBackground: Story;
12
+ export declare const WithOnClick: Story;
13
+ export declare const CustomBg: Story;
14
+ export declare const WithMaxWidth: Story;
@@ -1,43 +1,34 @@
1
- import { Card } from '../Card';
1
+ import Card from '../Card';
2
2
  var longText = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
3
3
  var meta = {
4
4
  title: 'Elements/Card',
5
5
  component: Card,
6
6
  tags: ['autodocs'],
7
- argTypes: {},
7
+ argTypes: {}
8
8
  };
9
9
  export default meta;
10
10
  export var Default = {
11
11
  args: {
12
- children: longText,
13
- },
14
- };
15
- export var NoBorder = {
16
- args: {
17
- children: longText,
18
- hasBorder: false,
19
- },
12
+ children: longText
13
+ }
20
14
  };
21
- export var WithPadding = {
15
+ export var WithOnClick = {
22
16
  args: {
23
17
  children: longText,
24
- p: '20px',
25
- },
18
+ onClick: function () {
19
+ console.log('click');
20
+ }
21
+ }
26
22
  };
27
- export var WithShadow = {
23
+ export var CustomBg = {
28
24
  args: {
29
- display: 'block',
30
- shadow: true,
31
25
  children: longText,
32
- p: '20px',
33
- },
26
+ bg: 'green20'
27
+ }
34
28
  };
35
- export var WithBackground = {
29
+ export var WithMaxWidth = {
36
30
  args: {
37
- display: 'block',
38
- shadow: true,
39
31
  children: longText,
40
- p: '20px',
41
- backgroundColor: 'red2'
42
- },
32
+ maxWidth: '400px'
33
+ }
43
34
  };
@@ -1,14 +1,7 @@
1
- /// <reference types="react" />
2
- export declare const CardWrapper: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {
3
- block?: boolean | undefined;
4
- }, never>;
1
+ import { Display } from './types';
5
2
  export declare const StyledCard: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {
6
- block?: boolean | undefined;
7
- hasBorder?: boolean | undefined;
8
- shadow?: boolean | undefined;
9
- p?: string | undefined;
10
- backgroundColor?: string | undefined;
3
+ display: Display;
4
+ bg?: string | undefined;
5
+ hasOnClick: boolean;
6
+ maxWidth?: string | undefined;
11
7
  }, never>;
12
- export declare const ImageWrapper: import("styled-components").StyledComponent<(props: Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "color">) => import("react").ReactElement<any, "div">, import("@xstyled/system").Theme, import("@xstyled/system").SystemProps<import("@xstyled/system").Theme>, "color">;
13
- export declare const StyledImage: import("styled-components").StyledComponent<(props: Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "color">) => import("react").ReactElement<any, "div">, import("@xstyled/system").Theme, import("@xstyled/system").SystemProps<import("@xstyled/system").Theme>, "color">;
14
- export declare const StyledBody: import("styled-components").StyledComponent<(props: Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "color">) => import("react").ReactElement<any, "div">, import("@xstyled/system").Theme, import("@xstyled/system").SystemProps<import("@xstyled/system").Theme>, "color">;
@@ -2,33 +2,19 @@ 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, { x, css, down } from '@xstyled/styled-components';
5
+ import styled, { css } from '@xstyled/styled-components';
6
6
  import { th } from '@xstyled/styled-components';
7
- var wrapper = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n box-sizing: border-box;\n font-family: ", ";\n :after {\n box-sizing: border-box;\n }\n"], ["\n display: flex;\n box-sizing: border-box;\n font-family: ", ";\n :after {\n box-sizing: border-box;\n }\n"])), th('fonts.primary'));
8
- export var CardWrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", ";\n display: ", ";\n justify-content: center;\n flex-wrap: wrap;\n"], ["\n ", ";\n display: ", ";\n justify-content: center;\n flex-wrap: wrap;\n"])), wrapper, function (_a) {
9
- var block = _a.block;
10
- return (block ? 'block' : 'inline-flex');
11
- });
12
- export var StyledCard = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n justify-content: space-between;\n display: ", ";\n padding: ", ";\n box-shadow: ", ";\n border: ", ";\n background-color: ", ";\n border-color: lightGray3;\n border-radius: 4px;\n"], ["\n justify-content: space-between;\n display: ", ";\n padding: ", ";\n box-shadow: ", ";\n border: ", ";\n background-color: ", ";\n border-color: lightGray3;\n border-radius: 4px;\n"])), function (_a) {
13
- var block = _a.block;
14
- return (block ? 'block' : 'inline-flex');
15
- }, function (_a) {
16
- var p = _a.p;
17
- return p || 'initial';
18
- }, function (_a) {
19
- var shadow = _a.shadow;
20
- return (shadow ? th.shadow('smooth') : 'none');
7
+ export var StyledCard = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: ", ";\n padding: 20px;\n border: 1px solid;\n background-color: ", ";\n border-color: ", ";\n border-radius: 12px;\n width: 100%;\n\n ", "\n\n ", "\n"], ["\n display: ", ";\n padding: 20px;\n border: 1px solid;\n background-color: ", ";\n border-color: ", ";\n border-radius: 12px;\n width: 100%;\n\n ", "\n\n ", "\n"])), function (_a) {
8
+ var display = _a.display;
9
+ return display;
21
10
  }, function (_a) {
22
- var hasBorder = _a.hasBorder;
23
- return (hasBorder ? th.border('slim') : 'none');
11
+ var bg = _a.bg;
12
+ return (bg ? th.color(bg) : 'white');
13
+ }, th.color('lightGray6'), function (_a) {
14
+ var maxWidth = _a.maxWidth;
15
+ return maxWidth && "max-width: ".concat(maxWidth, ";");
24
16
  }, function (_a) {
25
- var backgroundColor = _a.backgroundColor;
26
- return (backgroundColor ? th.color(backgroundColor) : 'initial');
17
+ var hasOnClick = _a.hasOnClick;
18
+ return hasOnClick && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n cursor: pointer;\n &:hover {\n border-color: ", ";\n }\n "], ["\n cursor: pointer;\n &:hover {\n border-color: ", ";\n }\n "])), th.color('gray1'));
27
19
  });
28
- export var ImageWrapper = styled(x.div)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", ";\n justify-content: center;\n flex-direction: column;\n background-color: ", ";\n ", "\n"], ["\n ", ";\n justify-content: center;\n flex-direction: column;\n background-color: ", ";\n ", "\n"])), wrapper, function (_a) {
29
- var color = _a.color;
30
- return color;
31
- }, down('lg', css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: none;\n "], ["\n display: none;\n "])))));
32
- export var StyledImage = styled(x.div)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n align-self: center;\n justify-content: center;\n object-fit: cover;\n"], ["\n display: flex;\n align-self: center;\n justify-content: center;\n object-fit: cover;\n"])));
33
- export var StyledBody = styled(x.div)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n ", ";\n justify-content: center;\n flex-direction: column;\n"], ["\n ", ";\n justify-content: center;\n flex-direction: column;\n"])), wrapper);
34
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
20
+ var templateObject_1, templateObject_2;
@@ -1,21 +1,9 @@
1
1
  /// <reference types="react" />
2
- import { StyledCard } from './styles';
3
2
  export type CardProps = {
4
3
  children: React.ReactNode;
5
- shadow?: boolean;
6
- block?: boolean;
7
- hasBorder?: boolean;
8
- } & React.ComponentProps<typeof StyledCard>;
9
- export type PropsBody = {
10
- children: React.ReactNode;
11
- };
12
- export type PropsCardImage = {
13
- children: React.ReactNode;
14
- color?: string;
15
- };
16
- export type CardComponentProps = {
17
- img?: string;
18
- children?: React.ReactNode;
19
- body?: React.ReactNode;
20
- color?: string;
4
+ display?: Display;
5
+ onClick?: () => void;
6
+ bg?: string;
7
+ maxWidth?: string;
21
8
  };
9
+ export type Display = 'block' | 'flex';
@@ -8,8 +8,8 @@ import styled, { x } from '@xstyled/styled-components';
8
8
  import { th } from '@xstyled/system';
9
9
  var Btn = styled.button(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n transform: rotate(90deg);\n font-size: 24px;\n margin: -4px 0;\n background-color: transparent !important;\n border: none;\n color: ", ";\n &:disabled:hover {\n color: ", ";\n cursor: default;\n }\n &:hover {\n color: ", ";\n background-color: transparent !important;\n }\n"], ["\n transform: rotate(90deg);\n font-size: 24px;\n margin: -4px 0;\n background-color: transparent !important;\n border: none;\n color: ", ";\n &:disabled:hover {\n color: ", ";\n cursor: default;\n }\n &:hover {\n color: ", ";\n background-color: transparent !important;\n }\n"])), th('colors.lightGray4'), th('colors.lightGray4'), th('colors.red2'));
10
10
  var TimeWrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: baseline;\n justify-content: center;\n border: 1px solid ", ";\n border-radius: 0.7rem;\n padding: 4px 10px;\n margin: 0 10px;\n"], ["\n display: flex;\n align-items: baseline;\n justify-content: center;\n border: 1px solid ", ";\n border-radius: 0.7rem;\n padding: 4px 10px;\n margin: 0 10px;\n"])), th('colors.lightGray2'));
11
- var Hours = styled.input(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-size: 22px;\n font-weight: 700;\n width: 24px;\n margin: 0;\n padding: 0;\n border: none;\n outline: none;\n &:disabled {\n opacity: 0.5;\n }\n"], ["\n font-size: 22px;\n font-weight: 700;\n width: 24px;\n margin: 0;\n padding: 0;\n border: none;\n outline: none;\n &:disabled {\n opacity: 0.5;\n }\n"])));
12
- var Minutes = styled.input(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-weight: 700;\n font-size: 16px;\n width: 20px;\n margin: 0;\n padding: 0;\n border: none;\n outline: none;\n &:disabled {\n opacity: 0.5;\n }\n"], ["\n font-weight: 700;\n font-size: 16px;\n width: 20px;\n margin: 0;\n padding: 0;\n border: none;\n outline: none;\n &:disabled {\n opacity: 0.5;\n }\n"])));
11
+ var Hours = styled.input(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-size: 22px;\n font-weight: 700;\n width: 30px;\n margin: 0;\n padding: 0;\n border: none;\n outline: none;\n &:disabled {\n opacity: 0.5;\n }\n"], ["\n font-size: 22px;\n font-weight: 700;\n width: 30px;\n margin: 0;\n padding: 0;\n border: none;\n outline: none;\n &:disabled {\n opacity: 0.5;\n }\n"])));
12
+ var Minutes = styled.input(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-weight: 700;\n font-size: 16px;\n width: 25px;\n margin: 0;\n padding: 0;\n border: none;\n outline: none;\n &:disabled {\n opacity: 0.5;\n }\n"], ["\n font-weight: 700;\n font-size: 16px;\n width: 25px;\n margin: 0;\n padding: 0;\n border: none;\n outline: none;\n &:disabled {\n opacity: 0.5;\n }\n"])));
13
13
  export var Timepicker = function (_a) {
14
14
  var _b, _c, _d, _e;
15
15
  var setTime = _a.setTime, value = _a.value, disabled = _a.disabled;
package/ui/index.d.ts CHANGED
@@ -55,7 +55,6 @@ export * from './Elements/Avatar';
55
55
  export * from './Elements/Badge';
56
56
  export * from './Elements/BorderedBox';
57
57
  export * from './Elements/Button';
58
- export * from './Elements/Card';
59
58
  export * from './Elements/Dropdown';
60
59
  export * from './Elements/ErrorMessage';
61
60
  export * from './Elements/Icon';