@popsure/dirty-swan 0.33.3 → 0.33.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.
- package/dist/cjs/index.js +31 -18
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/components/dateSelector/index.d.ts +11 -11
- package/dist/cjs/lib/components/dateSelector/index.stories.d.ts +65 -0
- package/dist/cjs/lib/components/modal/bottomModal/index.d.ts +1 -2
- package/dist/cjs/lib/components/modal/bottomOrRegularModal/index.d.ts +1 -2
- package/dist/cjs/lib/components/modal/index.d.ts +3 -3
- package/dist/cjs/lib/components/modal/index.stories.d.ts +62 -0
- package/dist/cjs/lib/components/modal/regularModal/index.d.ts +1 -2
- package/dist/cjs/lib/components/multiDropzone/index.d.ts +4 -4
- package/dist/cjs/lib/components/multiDropzone/index.stories.d.ts +72 -0
- package/dist/cjs/lib/index.d.ts +2 -2
- package/dist/cjs/lib/util/images/index.d.ts +12 -0
- package/dist/esm/components/dateSelector/index.js +6 -2179
- package/dist/esm/components/dateSelector/index.js.map +1 -1
- package/dist/esm/components/dateSelector/index.stories.js +92 -0
- package/dist/esm/components/dateSelector/index.stories.js.map +1 -0
- package/dist/esm/components/dateSelector/index.test.js +1 -1
- package/dist/esm/components/dateSelector/index.test.js.map +1 -1
- package/dist/esm/components/input/checkbox/index.stories.js +1 -1
- package/dist/esm/components/modal/bottomModal/index.js +3 -3
- package/dist/esm/components/modal/bottomModal/index.js.map +1 -1
- package/dist/esm/components/modal/bottomOrRegularModal/index.js +5 -5
- package/dist/esm/components/modal/bottomOrRegularModal/index.js.map +1 -1
- package/dist/esm/components/modal/index.stories.js +118 -0
- package/dist/esm/components/modal/index.stories.js.map +1 -0
- package/dist/esm/components/modal/regularModal/index.js +3 -3
- package/dist/esm/components/modal/regularModal/index.js.map +1 -1
- package/dist/esm/components/multiDropzone/index.js +3 -3
- package/dist/esm/components/multiDropzone/index.js.map +1 -1
- package/dist/esm/components/multiDropzone/index.stories.js +147 -0
- package/dist/esm/components/multiDropzone/index.stories.js.map +1 -0
- package/dist/esm/components/multiDropzone/index.test.js +2 -2
- package/dist/esm/components/multiDropzone/index.test.js.map +1 -1
- package/dist/esm/index-31224f74.js +26 -0
- package/dist/esm/index-31224f74.js.map +1 -0
- package/dist/esm/index-639cf8b3.js +2179 -0
- package/dist/esm/index-639cf8b3.js.map +1 -0
- package/dist/esm/index.js +6 -6
- package/dist/esm/lib/components/dateSelector/index.d.ts +11 -11
- package/dist/esm/lib/components/dateSelector/index.stories.d.ts +65 -0
- package/dist/esm/lib/components/modal/bottomModal/index.d.ts +1 -2
- package/dist/esm/lib/components/modal/bottomOrRegularModal/index.d.ts +1 -2
- package/dist/esm/lib/components/modal/index.d.ts +3 -3
- package/dist/esm/lib/components/modal/index.stories.d.ts +62 -0
- package/dist/esm/lib/components/modal/regularModal/index.d.ts +1 -2
- package/dist/esm/lib/components/multiDropzone/index.d.ts +4 -4
- package/dist/esm/lib/components/multiDropzone/index.stories.d.ts +72 -0
- package/dist/esm/lib/index.d.ts +2 -2
- package/dist/esm/lib/util/images/index.d.ts +12 -0
- package/dist/esm/util/images/index.stories.js +7 -4
- package/dist/esm/util/images/index.stories.js.map +1 -1
- package/package.json +1 -1
- package/src/App.tsx +1 -1
- package/src/lib/components/dateSelector/index.stories.tsx +104 -0
- package/src/lib/components/dateSelector/index.test.tsx +2 -2
- package/src/lib/components/dateSelector/index.tsx +14 -14
- package/src/lib/components/modal/bottomModal/index.tsx +1 -1
- package/src/lib/components/modal/bottomOrRegularModal/index.tsx +2 -2
- package/src/lib/components/modal/index.stories.tsx +254 -0
- package/src/lib/components/modal/index.ts +3 -3
- package/src/lib/components/modal/regularModal/index.tsx +1 -1
- package/src/lib/components/multiDropzone/index.stories.tsx +228 -0
- package/src/lib/components/multiDropzone/index.test.tsx +1 -1
- package/src/lib/components/multiDropzone/index.tsx +6 -6
- package/src/lib/index.tsx +3 -2
- package/src/lib/util/images/index.stories.tsx +20 -12
- package/src/lib/util/images/index.ts +23 -9
- package/dist/esm/index-db2e797f.js +0 -13
- package/dist/esm/index-db2e797f.js.map +0 -1
- package/src/lib/components/dateSelector/index.stories.mdx +0 -106
- package/src/lib/components/modal/index.stories.mdx +0 -313
- package/src/lib/components/multiDropzone/index.stories.mdx +0 -187
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { DateSelectorProps } from '.';
|
|
2
|
+
declare const story: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ value, onChange, yearBoundaries, displayCalendar, placeholders, dayjsLocale, firstDayOfWeek, }: DateSelectorProps) => JSX.Element;
|
|
5
|
+
decorators: ((Story: any) => JSX.Element)[];
|
|
6
|
+
argTypes: {
|
|
7
|
+
yearBoundaries: {
|
|
8
|
+
description: string;
|
|
9
|
+
defaultValue: {
|
|
10
|
+
min: number;
|
|
11
|
+
max: number;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
displayCalendar: {
|
|
15
|
+
description: string;
|
|
16
|
+
defaultValue: boolean;
|
|
17
|
+
};
|
|
18
|
+
onChange: {
|
|
19
|
+
description: string;
|
|
20
|
+
action: boolean;
|
|
21
|
+
table: {
|
|
22
|
+
category: string;
|
|
23
|
+
type: {
|
|
24
|
+
summary: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
value: {
|
|
29
|
+
defaultValue: string;
|
|
30
|
+
description: string;
|
|
31
|
+
table: {
|
|
32
|
+
type: {
|
|
33
|
+
summary: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
dayjsLocale: {
|
|
38
|
+
description: string;
|
|
39
|
+
};
|
|
40
|
+
placeholders: {
|
|
41
|
+
description: string;
|
|
42
|
+
};
|
|
43
|
+
firstDayOfWeek: {
|
|
44
|
+
description: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
parameters: {
|
|
48
|
+
componentSubtitle: string;
|
|
49
|
+
design: {
|
|
50
|
+
url: string;
|
|
51
|
+
type: string;
|
|
52
|
+
};
|
|
53
|
+
docs: {
|
|
54
|
+
source: {
|
|
55
|
+
excludeDecorators: boolean;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export declare const DateSelectorStory: {
|
|
61
|
+
({ displayCalendar, onChange, yearBoundaries, value }: DateSelectorProps): JSX.Element;
|
|
62
|
+
storyName: string;
|
|
63
|
+
};
|
|
64
|
+
export declare const DateSelectorLocalisation: ({ onChange, value, yearBoundaries }: DateSelectorProps) => JSX.Element;
|
|
65
|
+
export default story;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { Props } from '..';
|
|
2
|
-
declare const
|
|
3
|
-
export default _default;
|
|
2
|
+
export declare const BottomModal: ({ title, isOpen, children, onClose, className, dismissible, }: Props) => JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import BottomModal from './bottomModal';
|
|
3
|
-
import RegularModal from './regularModal';
|
|
4
|
-
import BottomOrRegularModal from './bottomOrRegularModal';
|
|
2
|
+
import { BottomModal } from './bottomModal';
|
|
3
|
+
import { RegularModal } from './regularModal';
|
|
4
|
+
import { BottomOrRegularModal } from './bottomOrRegularModal';
|
|
5
5
|
export interface Props {
|
|
6
6
|
title?: string;
|
|
7
7
|
isOpen: boolean;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Props } from '.';
|
|
2
|
+
declare const story: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ isOpen, ...props }: Props) => JSX.Element;
|
|
5
|
+
argTypes: {
|
|
6
|
+
title: {
|
|
7
|
+
defaultValue: string;
|
|
8
|
+
description: string;
|
|
9
|
+
};
|
|
10
|
+
isOpen: {
|
|
11
|
+
defaultValue: boolean;
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
dismissible: {
|
|
15
|
+
defaultValue: boolean;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
className: {
|
|
19
|
+
defaultValue: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
children: {
|
|
23
|
+
defaultValue: string;
|
|
24
|
+
description: string;
|
|
25
|
+
type: string;
|
|
26
|
+
table: {
|
|
27
|
+
type: {
|
|
28
|
+
summary: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
onClose: {
|
|
33
|
+
description: string;
|
|
34
|
+
action: boolean;
|
|
35
|
+
table: {
|
|
36
|
+
category: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
parameters: {
|
|
41
|
+
componentSubtitle: string;
|
|
42
|
+
docs: {
|
|
43
|
+
description: {
|
|
44
|
+
component: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export declare const BottomOrRegularModalStory: {
|
|
50
|
+
({ children, className, dismissible, isOpen, onClose, title, }: Props): JSX.Element;
|
|
51
|
+
storyName: string;
|
|
52
|
+
};
|
|
53
|
+
export declare const RegularModalStory: {
|
|
54
|
+
({ children, isOpen, onClose, title, }: Props): JSX.Element;
|
|
55
|
+
storyName: string;
|
|
56
|
+
};
|
|
57
|
+
export declare const BottomModalStory: {
|
|
58
|
+
({ children, isOpen, onClose, title, }: Props): JSX.Element;
|
|
59
|
+
storyName: string;
|
|
60
|
+
};
|
|
61
|
+
export declare const NonDismissibleModal: ({ children, isOpen, onClose, title, }: Props) => JSX.Element;
|
|
62
|
+
export default story;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { Props } from '..';
|
|
2
|
-
declare const
|
|
3
|
-
export default _default;
|
|
2
|
+
export declare const RegularModal: ({ title, isOpen, children, onClose, className, dismissible, }: Props) => JSX.Element;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { AcceptType, FileType, TextOverrides, UploadedFile, UploadStatus } from './types';
|
|
2
2
|
interface MultiDropzoneProps {
|
|
3
|
-
accept?: AcceptType;
|
|
4
|
-
onFileSelect: (files: File[]) => void;
|
|
5
3
|
uploadedFiles: UploadedFile[];
|
|
6
4
|
uploading: boolean;
|
|
5
|
+
onFileSelect: (files: File[]) => void;
|
|
7
6
|
onRemoveFile: (id: string) => void;
|
|
7
|
+
accept?: AcceptType;
|
|
8
8
|
isCondensed?: boolean;
|
|
9
9
|
maxFiles?: number;
|
|
10
10
|
maxSize?: number;
|
|
11
11
|
textOverrides?: TextOverrides;
|
|
12
12
|
}
|
|
13
|
-
declare const
|
|
13
|
+
declare const MultiDropzone: ({ uploadedFiles, onFileSelect, onRemoveFile, uploading, isCondensed, accept, maxFiles, maxSize, textOverrides, }: MultiDropzoneProps) => JSX.Element;
|
|
14
14
|
export type { FileType, MultiDropzoneProps, UploadedFile, UploadStatus };
|
|
15
|
-
export
|
|
15
|
+
export { MultiDropzone };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { MultiDropzoneProps } from '.';
|
|
2
|
+
declare const story: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ uploadedFiles, onFileSelect, onRemoveFile, uploading, isCondensed, accept, maxFiles, maxSize, textOverrides, }: MultiDropzoneProps) => JSX.Element;
|
|
5
|
+
argTypes: {
|
|
6
|
+
uploadedFiles: {
|
|
7
|
+
defaultValue: {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
}[];
|
|
11
|
+
description: string;
|
|
12
|
+
};
|
|
13
|
+
uploading: {
|
|
14
|
+
defaultValue: boolean;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
isCondensed: {
|
|
18
|
+
defaultValue: boolean;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
maxFiles: {
|
|
22
|
+
description: string;
|
|
23
|
+
table: {
|
|
24
|
+
category: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
maxSize: {
|
|
28
|
+
description: string;
|
|
29
|
+
table: {
|
|
30
|
+
category: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
accept: {
|
|
34
|
+
description: string;
|
|
35
|
+
table: {
|
|
36
|
+
category: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
onRemoveFile: {
|
|
40
|
+
description: string;
|
|
41
|
+
action: boolean;
|
|
42
|
+
table: {
|
|
43
|
+
category: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
onFileSelect: {
|
|
47
|
+
description: string;
|
|
48
|
+
action: boolean;
|
|
49
|
+
table: {
|
|
50
|
+
category: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
textOverrides: {
|
|
54
|
+
description: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
parameters: {
|
|
58
|
+
componentSubtitle: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export declare const MultiDropzoneStory: {
|
|
62
|
+
({ onFileSelect, onRemoveFile, uploading, uploadedFiles, isCondensed, maxFiles, maxSize, textOverrides, }: MultiDropzoneProps): JSX.Element;
|
|
63
|
+
storyName: string;
|
|
64
|
+
};
|
|
65
|
+
export declare const UploadingState: () => JSX.Element;
|
|
66
|
+
export declare const CondensedView: () => JSX.Element;
|
|
67
|
+
export declare const ErrorState: () => JSX.Element;
|
|
68
|
+
export declare const AcceptingOnlyImages: () => JSX.Element;
|
|
69
|
+
export declare const AcceptingOnlyDocuments: () => JSX.Element;
|
|
70
|
+
export declare const LimitingFileSizeTo2MB: () => JSX.Element;
|
|
71
|
+
export declare const I18nSupport: () => JSX.Element;
|
|
72
|
+
export default story;
|
package/dist/esm/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import DateSelector from './components/dateSelector';
|
|
1
|
+
import { DateSelector } from './components/dateSelector';
|
|
2
2
|
import { SignaturePad } from './components/signaturePad';
|
|
3
3
|
import { AutocompleteAddress } from './components/autocompleteAddress';
|
|
4
4
|
import Input from './components/input';
|
|
5
|
-
import MultiDropzone,
|
|
5
|
+
import { MultiDropzone, FileType, MultiDropzoneProps, UploadedFile, UploadStatus } from './components/multiDropzone';
|
|
6
6
|
import { DownloadButton } from './components/downloadButton';
|
|
7
7
|
import IbanInput from './components/input/iban';
|
|
8
8
|
import CurrencyInput from './components/input/currency';
|
|
@@ -2,10 +2,22 @@ declare const images: {
|
|
|
2
2
|
readonly aid: "https://assets.cdn.feather-insurance.com/assets/images/aid.svg";
|
|
3
3
|
readonly bed: "https://assets.cdn.feather-insurance.com/assets/images/bed.svg";
|
|
4
4
|
readonly bigDog: "https://assets.cdn.feather-insurance.com/assets/images/bigDog.svg";
|
|
5
|
+
readonly verticalIcons: {
|
|
6
|
+
readonly dogLiability: "https://assets.cdn.feather-insurance.com/assets/images/dogLiabilityIcon.png";
|
|
7
|
+
readonly dogLiability2x: "https://assets.cdn.feather-insurance.com/assets/images/dogLiabilityIcon2x.png";
|
|
8
|
+
readonly dogLiability3x: "https://assets.cdn.feather-insurance.com/assets/images/dogLiabilityIcon3x.png";
|
|
9
|
+
readonly lifeIcon: "https://assets.cdn.feather-insurance.com/assets/images/lifeIcon.png";
|
|
10
|
+
readonly lifeIcon2x: "https://assets.cdn.feather-insurance.com/assets/images/lifeIcon2x.png";
|
|
11
|
+
readonly lifeIcon3x: "https://assets.cdn.feather-insurance.com/assets/images/lifeIcon3x.png";
|
|
12
|
+
};
|
|
5
13
|
readonly brokenAquarium: "https://assets.cdn.feather-insurance.com/assets/images/brokenAquarium.svg";
|
|
6
14
|
readonly brokenGlass: "https://assets.cdn.feather-insurance.com/assets/images/brokenGlass.svg";
|
|
7
15
|
readonly damagedLaptop: "https://assets.cdn.feather-insurance.com/assets/images/damagedLaptop.svg";
|
|
8
16
|
readonly moneyIncome: "https://assets.cdn.feather-insurance.com/assets/images/moneyIncome.svg";
|
|
9
17
|
readonly washingMachine: "https://assets.cdn.feather-insurance.com/assets/images/washingMachine.svg";
|
|
18
|
+
readonly bill: "https://assets.cdn.feather-insurance.com/assets/images/bill.svg";
|
|
19
|
+
readonly books: "https://assets.cdn.feather-insurance.com/assets/images/books.svg";
|
|
20
|
+
readonly finalExpenses: "https://assets.cdn.feather-insurance.com/assets/images/finalExpenses.svg";
|
|
21
|
+
readonly mortgage: "https://assets.cdn.feather-insurance.com/assets/images/mortgage.svg";
|
|
10
22
|
};
|
|
11
23
|
export { images };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as __assign } from '../../tslib.es6-5bc94358.js';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { i as images } from '../../index-
|
|
3
|
+
import { i as images } from '../../index-31224f74.js';
|
|
4
4
|
|
|
5
5
|
var story = {
|
|
6
6
|
title: 'Utils/Images',
|
|
@@ -10,11 +10,14 @@ var story = {
|
|
|
10
10
|
component: 'Use the `images` object export to access our list of available images.',
|
|
11
11
|
},
|
|
12
12
|
},
|
|
13
|
-
}
|
|
13
|
+
},
|
|
14
14
|
};
|
|
15
|
-
var Images = function () { return (jsx("div", __assign({ className:
|
|
15
|
+
var Images = function () { return (jsx("div", __assign({ className: "d-flex gap8 f-wrap" }, { children: Object.entries(images).map(function (_a) {
|
|
16
16
|
var key = _a[0], value = _a[1];
|
|
17
|
-
|
|
17
|
+
if (typeof value !== 'string') {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return (jsxs("div", __assign({ className: "ws3 d-flex fd-column ai-center br4 p24 pt16 pb16 bg-grey-100" }, { children: [jsx("span", __assign({ className: "p-p--small mb8" }, { children: key }), void 0),
|
|
18
21
|
jsx("img", { alt: key, src: value }, void 0)] }), key));
|
|
19
22
|
}) }), void 0)); };
|
|
20
23
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.stories.js","sources":["../../../../../src/lib/util/images/index.stories.tsx"],"sourcesContent":["import { images } from
|
|
1
|
+
{"version":3,"file":"index.stories.js","sources":["../../../../../src/lib/util/images/index.stories.tsx"],"sourcesContent":["import { images } from '../../util/images';\n\nconst story = {\n title: 'Utils/Images',\n parameters: {\n docs: {\n description: {\n component:\n 'Use the `images` object export to access our list of available images.',\n },\n },\n },\n};\n\nexport const Images = () => (\n <div className=\"d-flex gap8 f-wrap\">\n {Object.entries(images).map(([key, value]) => {\n if (typeof value !== 'string') {\n return null;\n }\n return (\n <div\n key={key}\n className=\"ws3 d-flex fd-column ai-center br4 p24 pt16 pb16 bg-grey-100\"\n >\n <span className=\"p-p--small mb8\">{key}</span>\n\n <img alt={key} src={value} />\n </div>\n );\n })}\n </div>\n);\n\nexport default story;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;IAEM,KAAK,GAAG;IACZ,KAAK,EAAE,cAAc;IACrB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,SAAS,EACP,wEAAwE;aAC3E;SACF;KACF;EACD;IAEW,MAAM,GAAG,cAAM,QAC1BA,sBAAK,SAAS,EAAC,oBAAoB,gBAChC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,UAAC,EAAY;YAAX,GAAG,QAAA,EAAE,KAAK,QAAA;QACtC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,OAAO,IAAI,CAAC;SACb;QACD,QACEC,uBAEE,SAAS,EAAC,8DAA8D,iBAExED,uBAAM,SAAS,EAAC,gBAAgB,gBAAE,GAAG,YAAQ;gBAE7CA,aAAK,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,WAAI,MALxB,GAAG,CAMJ,EACN;KACH,CAAC,YACE;;;;;"}
|
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './lib/scss/index.scss';
|
|
3
3
|
|
|
4
|
-
import DateSelector from './lib/components/dateSelector';
|
|
4
|
+
import { DateSelector } from './lib/components/dateSelector';
|
|
5
5
|
import { SignaturePad } from './lib/components/signaturePad';
|
|
6
6
|
import { CardWithLeftIcon } from './lib/components/cards';
|
|
7
7
|
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { DateSelector, DateSelectorProps } from '.';
|
|
2
|
+
import de from 'dayjs/locale/de';
|
|
3
|
+
|
|
4
|
+
const story = {
|
|
5
|
+
title: 'JSX/DateSelector',
|
|
6
|
+
component: DateSelector,
|
|
7
|
+
decorators: [
|
|
8
|
+
(Story: any) => (
|
|
9
|
+
<div style={{ minHeight: '320px', paddingTop: '80px' }}>
|
|
10
|
+
<Story />
|
|
11
|
+
</div>
|
|
12
|
+
),
|
|
13
|
+
],
|
|
14
|
+
argTypes: {
|
|
15
|
+
yearBoundaries: {
|
|
16
|
+
description: 'Object containing the min and max year boundaries to show.',
|
|
17
|
+
defaultValue: {
|
|
18
|
+
min: 1920,
|
|
19
|
+
max: 2001
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
displayCalendar: {
|
|
23
|
+
description: 'Whether the calendar icon/button trigger should show',
|
|
24
|
+
defaultValue: false
|
|
25
|
+
},
|
|
26
|
+
onChange: {
|
|
27
|
+
description: 'Called when the value is changed. Must be a valid date to be triggered',
|
|
28
|
+
action: true,
|
|
29
|
+
table: {
|
|
30
|
+
category: 'Callbacks',
|
|
31
|
+
type: {
|
|
32
|
+
summary: '(date: YYYY-MM-DD) => void'
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
value: {
|
|
37
|
+
defaultValue: '2000-12-12',
|
|
38
|
+
description: 'Value of the input',
|
|
39
|
+
table: {
|
|
40
|
+
type: {
|
|
41
|
+
summary: 'YYYY-MM-DD'
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
dayjsLocale: {
|
|
46
|
+
description: `Property used to localize the calendar of the DateSelector. If no dayjsLocale is supplied, the default locale 'en' will be used. Additional locales can be imported from dayjs like import de from 'dayjs/locale/de'; and then passed on to the component.`
|
|
47
|
+
},
|
|
48
|
+
placeholders: {
|
|
49
|
+
description: 'Properties used to localize the calendar of the DateSelector. `placeholders` object can be used to change the text of the different dropdowns.'
|
|
50
|
+
},
|
|
51
|
+
firstDayOfWeek: {
|
|
52
|
+
description: `Index of the first day of the week (0 = Sunday, 1 = Monday, etc.)`
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
parameters: {
|
|
56
|
+
componentSubtitle: 'Date selector are user interface elements which allow user to select a date in the `YYYY-MM-DD` format.',
|
|
57
|
+
design: {
|
|
58
|
+
url: 'https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FMKs4cbojdVOBKUxv7okb93%2FDirty-Swan-Design-System%3Fnode-id%3D293%253A169',
|
|
59
|
+
type: 'figma'
|
|
60
|
+
},
|
|
61
|
+
docs: {
|
|
62
|
+
source: {
|
|
63
|
+
excludeDecorators: true,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const DateSelectorStory = ({
|
|
70
|
+
displayCalendar,
|
|
71
|
+
onChange,
|
|
72
|
+
yearBoundaries,
|
|
73
|
+
value
|
|
74
|
+
}: DateSelectorProps) => (
|
|
75
|
+
<DateSelector
|
|
76
|
+
onChange={onChange}
|
|
77
|
+
displayCalendar={displayCalendar}
|
|
78
|
+
yearBoundaries={yearBoundaries}
|
|
79
|
+
value={value}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
DateSelectorStory.storyName = "DateSelector";
|
|
84
|
+
|
|
85
|
+
export const DateSelectorLocalisation = ({ onChange, value, yearBoundaries }: DateSelectorProps) => (
|
|
86
|
+
<>
|
|
87
|
+
{/** import de from 'dayjs/locale/de'; */}
|
|
88
|
+
<DateSelector
|
|
89
|
+
value={value}
|
|
90
|
+
yearBoundaries={yearBoundaries}
|
|
91
|
+
onChange={onChange}
|
|
92
|
+
displayCalendar={true}
|
|
93
|
+
placeholders={{
|
|
94
|
+
day: 'Tag',
|
|
95
|
+
month: 'Monat',
|
|
96
|
+
year: 'Jahr',
|
|
97
|
+
}}
|
|
98
|
+
dayjsLocale={de}
|
|
99
|
+
firstDayOfWeek={2}
|
|
100
|
+
/>
|
|
101
|
+
</>
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
export default story;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { render
|
|
1
|
+
import { render } from '../../util/testUtils';
|
|
2
2
|
|
|
3
|
-
import DateSelector from '.';
|
|
3
|
+
import { DateSelector } from '.';
|
|
4
4
|
|
|
5
5
|
const setup = (date: string, onChange: (date: string) => void = () => {}) => {
|
|
6
6
|
return render(
|
|
@@ -51,27 +51,29 @@ export const daysInMonthOfYear = ({
|
|
|
51
51
|
return dayjs(`${year}-${month}`).daysInMonth();
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
value,
|
|
56
|
-
onChange,
|
|
57
|
-
yearBoundaries,
|
|
58
|
-
displayCalendar,
|
|
59
|
-
placeholders,
|
|
60
|
-
dayjsLocale,
|
|
61
|
-
firstDayOfWeek = 0,
|
|
62
|
-
}: {
|
|
54
|
+
export interface DateSelectorProps {
|
|
63
55
|
value?: string;
|
|
64
56
|
onChange: (date: string) => void;
|
|
65
57
|
yearBoundaries: { min: number; max: number };
|
|
66
58
|
displayCalendar?: boolean;
|
|
59
|
+
dayjsLocale?: ILocale;
|
|
67
60
|
placeholders?: {
|
|
68
61
|
day?: string;
|
|
69
62
|
month?: string;
|
|
70
63
|
year?: string;
|
|
71
64
|
};
|
|
72
|
-
dayjsLocale?: ILocale;
|
|
73
65
|
firstDayOfWeek?: number;
|
|
74
|
-
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export const DateSelector = ({
|
|
69
|
+
value,
|
|
70
|
+
onChange,
|
|
71
|
+
yearBoundaries,
|
|
72
|
+
displayCalendar,
|
|
73
|
+
placeholders,
|
|
74
|
+
dayjsLocale,
|
|
75
|
+
firstDayOfWeek = 0,
|
|
76
|
+
}: DateSelectorProps) => {
|
|
75
77
|
const calendarDateValue = value ? isoStringtoCalendarDate(value) : undefined;
|
|
76
78
|
const daysInSelectedDate = calendarDateValue
|
|
77
79
|
? daysInMonthOfYear({
|
|
@@ -277,6 +279,4 @@ const DateSelector = ({
|
|
|
277
279
|
)}
|
|
278
280
|
</div>
|
|
279
281
|
);
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
export default DateSelector;
|
|
282
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { Props, RegularModal } from '..';
|
|
4
|
-
import BottomModal from '../bottomModal';
|
|
4
|
+
import { BottomModal } from '../bottomModal';
|
|
5
5
|
|
|
6
6
|
import styles from './style.module.scss';
|
|
7
7
|
|
|
8
|
-
export
|
|
8
|
+
export const BottomOrRegularModal = ({ isOpen, ...props }: Props) => {
|
|
9
9
|
const mobileRef = useRef<HTMLDivElement>(null);
|
|
10
10
|
const [visibleSize, setVisibleSize] = useState<'desktop' | 'mobile'>(
|
|
11
11
|
'desktop'
|