@popsure/dirty-swan 0.32.0 → 0.33.1
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.d.ts +1 -1
- package/dist/cjs/index.js +62 -14
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/components/downloadButton/index.d.ts +3 -3
- package/dist/cjs/lib/components/downloadButton/index.stories.d.ts +36 -0
- package/dist/cjs/lib/components/input/checkbox/index.d.ts +17 -0
- package/dist/cjs/lib/components/input/checkbox/index.stories.d.ts +64 -0
- package/dist/cjs/lib/components/input/checkbox/index.test.d.ts +1 -0
- package/dist/cjs/lib/components/markdown/index.d.ts +9 -8
- package/dist/cjs/lib/components/markdown/index.stories.d.ts +44 -0
- package/dist/cjs/lib/components/signaturePad/index.d.ts +4 -4
- package/dist/cjs/lib/components/signaturePad/index.stories.d.ts +21 -0
- package/dist/cjs/lib/index.d.ts +5 -4
- package/dist/esm/components/downloadButton/index.js +1 -1
- package/dist/esm/components/downloadButton/index.js.map +1 -1
- package/dist/esm/components/downloadButton/index.stories.js +47 -0
- package/dist/esm/components/downloadButton/index.stories.js.map +1 -0
- package/dist/esm/components/input/checkbox/index.js +53 -0
- package/dist/esm/components/input/checkbox/index.js.map +1 -0
- package/dist/esm/components/input/checkbox/index.stories.js +153 -0
- package/dist/esm/components/input/checkbox/index.stories.js.map +1 -0
- package/dist/esm/components/input/checkbox/index.test.js +105 -0
- package/dist/esm/components/input/checkbox/index.test.js.map +1 -0
- package/dist/esm/components/markdown/index.js +1 -1
- package/dist/esm/components/markdown/index.js.map +1 -1
- package/dist/esm/components/markdown/index.stories.js +66 -0
- package/dist/esm/components/markdown/index.stories.js.map +1 -0
- package/dist/esm/components/signaturePad/index.js +14 -14
- package/dist/esm/components/signaturePad/index.js.map +1 -1
- package/dist/esm/components/signaturePad/index.stories.js +33 -0
- package/dist/esm/components/signaturePad/index.stories.js.map +1 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +4 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/components/downloadButton/index.d.ts +3 -3
- package/dist/esm/lib/components/downloadButton/index.stories.d.ts +36 -0
- package/dist/esm/lib/components/input/checkbox/index.d.ts +17 -0
- package/dist/esm/lib/components/input/checkbox/index.stories.d.ts +64 -0
- package/dist/esm/lib/components/input/checkbox/index.test.d.ts +1 -0
- package/dist/esm/lib/components/markdown/index.d.ts +9 -8
- package/dist/esm/lib/components/markdown/index.stories.d.ts +44 -0
- package/dist/esm/lib/components/signaturePad/index.d.ts +4 -4
- package/dist/esm/lib/components/signaturePad/index.stories.d.ts +21 -0
- package/dist/esm/lib/index.d.ts +5 -4
- package/dist/index.css +4 -0
- package/dist/index.css.map +1 -1
- package/dist/lib/scss/private/components/_input.scss +4 -0
- package/package.json +1 -1
- package/src/App.tsx +1 -1
- package/src/index.tsx +1 -0
- package/src/lib/components/downloadButton/index.stories.tsx +58 -0
- package/src/lib/components/downloadButton/index.tsx +3 -3
- package/src/lib/components/input/checkbox/index.stories.tsx +214 -0
- package/src/lib/components/input/checkbox/index.test.tsx +110 -0
- package/src/lib/components/input/checkbox/index.tsx +129 -0
- package/src/lib/components/markdown/index.stories.tsx +131 -0
- package/src/lib/components/markdown/index.tsx +11 -9
- package/src/lib/components/signaturePad/index.stories.tsx +35 -0
- package/src/lib/components/signaturePad/index.tsx +6 -6
- package/src/lib/index.tsx +5 -3
- package/src/lib/scss/private/components/_input.scss +4 -0
- package/src/lib/components/downloadButton/index.stories.mdx +0 -59
- package/src/lib/components/markdown/example.md +0 -78
- package/src/lib/components/markdown/index.stories.mdx +0 -22
- package/src/lib/components/signaturePad/index.stories.mdx +0 -17
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
export interface CheckboxWithDescription {
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
icon?: (selected: boolean) => ReactNode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface CheckboxProps<ValueType extends string> {
|
|
11
|
+
options: Record<ValueType, string | CheckboxWithDescription>;
|
|
12
|
+
value?: ValueType[];
|
|
13
|
+
onChange: (value: ValueType[]) => void;
|
|
14
|
+
wide?: boolean;
|
|
15
|
+
inlineLayout?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
labelClassName?: string;
|
|
18
|
+
optionClassName?: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const Checkbox = <ValueType extends string>({
|
|
22
|
+
options,
|
|
23
|
+
value = [],
|
|
24
|
+
onChange,
|
|
25
|
+
wide = false,
|
|
26
|
+
inlineLayout = false,
|
|
27
|
+
className = '',
|
|
28
|
+
labelClassName = '',
|
|
29
|
+
optionClassName = '',
|
|
30
|
+
}: CheckboxProps<ValueType> & { }) => {
|
|
31
|
+
const hasNoneValue = Object.keys(options).includes('NONE');
|
|
32
|
+
|
|
33
|
+
const handleOnChange = (newValue: ValueType) => {
|
|
34
|
+
if (value?.includes(newValue)) {
|
|
35
|
+
const filteredCheckboxValues = value.filter(
|
|
36
|
+
(selectedValue) => selectedValue !== newValue
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
onChange(filteredCheckboxValues);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (hasNoneValue && newValue === 'NONE') {
|
|
44
|
+
onChange([newValue]);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (hasNoneValue && newValue !== 'NONE') {
|
|
49
|
+
const newValues = value
|
|
50
|
+
? [...value.filter((v) => v !== 'NONE'), newValue]
|
|
51
|
+
: [newValue];
|
|
52
|
+
onChange(newValues);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const newValues = value
|
|
57
|
+
? [...value, newValue]
|
|
58
|
+
: [newValue];
|
|
59
|
+
onChange(newValues);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
const entries = Object.entries(options) as [
|
|
64
|
+
ValueType,
|
|
65
|
+
string | CheckboxWithDescription
|
|
66
|
+
][];
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<div
|
|
70
|
+
className={classNames(className, 'd-flex gap8', {
|
|
71
|
+
ws10: wide,
|
|
72
|
+
ws6: !wide,
|
|
73
|
+
'fd-row': inlineLayout,
|
|
74
|
+
'f-wrap': inlineLayout,
|
|
75
|
+
'fd-column': !inlineLayout,
|
|
76
|
+
})}
|
|
77
|
+
>
|
|
78
|
+
{entries.map(([currentValue, label]) => {
|
|
79
|
+
const checked = value?.includes(currentValue);
|
|
80
|
+
const customIcon = (label as CheckboxWithDescription)?.icon;
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<div className={optionClassName} key={currentValue}>
|
|
84
|
+
<input
|
|
85
|
+
className={classNames(
|
|
86
|
+
"p-checkbox", {
|
|
87
|
+
'p-checkbox--no-icon': customIcon
|
|
88
|
+
}
|
|
89
|
+
)}
|
|
90
|
+
id={currentValue}
|
|
91
|
+
type="checkbox"
|
|
92
|
+
value={currentValue}
|
|
93
|
+
onChange={() => handleOnChange(currentValue)}
|
|
94
|
+
checked={checked}
|
|
95
|
+
data-testid={`checkbox-input-${currentValue}`}
|
|
96
|
+
/>
|
|
97
|
+
|
|
98
|
+
<label
|
|
99
|
+
htmlFor={currentValue}
|
|
100
|
+
className={classNames(
|
|
101
|
+
labelClassName,
|
|
102
|
+
'p-label p-label--bordered pr16',
|
|
103
|
+
{
|
|
104
|
+
'jc-center': customIcon,
|
|
105
|
+
'fd-column': customIcon
|
|
106
|
+
}
|
|
107
|
+
)}
|
|
108
|
+
data-cy={`checkbox-${currentValue}`}
|
|
109
|
+
data-testid={`checkbox-${currentValue}`}
|
|
110
|
+
>
|
|
111
|
+
{customIcon && (
|
|
112
|
+
<div className="mt8">{customIcon?.(checked)}</div>
|
|
113
|
+
)}
|
|
114
|
+
|
|
115
|
+
{typeof label === 'string' ? label : (
|
|
116
|
+
<div>
|
|
117
|
+
<p className="p-p">{label.title}</p>
|
|
118
|
+
<span className="d-block p-p p-p--small tc-grey-600">
|
|
119
|
+
{label.description}
|
|
120
|
+
</span>
|
|
121
|
+
</div>
|
|
122
|
+
)}
|
|
123
|
+
</label>
|
|
124
|
+
</div>
|
|
125
|
+
);
|
|
126
|
+
})}
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { Markdown, MarkdownProps } from '.';
|
|
2
|
+
|
|
3
|
+
const story = {
|
|
4
|
+
title: 'JSX/Markdown',
|
|
5
|
+
component: Markdown,
|
|
6
|
+
argTypes: {
|
|
7
|
+
children: {
|
|
8
|
+
description: 'MD content to be rendered in the component.',
|
|
9
|
+
},
|
|
10
|
+
className: {
|
|
11
|
+
defaultValue: '',
|
|
12
|
+
description: 'This property allows to add custom styles to the component.',
|
|
13
|
+
},
|
|
14
|
+
customMDComponents: {
|
|
15
|
+
defaultValue: {},
|
|
16
|
+
description: 'An object that allows creating custom MD components by passing the key to wrap it in, and the logic to render, as a function that returns an HTMLElement.',
|
|
17
|
+
table: {
|
|
18
|
+
type: {
|
|
19
|
+
summary: 'Record<componentKey, (props: HTMLElmentAttributes) => HTMLElement>'
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
paragraphClassName: {
|
|
24
|
+
defaultValue: '',
|
|
25
|
+
description: 'This property allows to add custom styles to the paragraph (`<p>`) component rendered inside Markdown component.',
|
|
26
|
+
},
|
|
27
|
+
openLinksInNewTab: {
|
|
28
|
+
defaultValue: false,
|
|
29
|
+
description: 'Wether link components rendered inside Markdown should open in a new tab (`target="_blank"`).',
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
args: {
|
|
33
|
+
children: '## Title \n This is **our content**.'
|
|
34
|
+
},
|
|
35
|
+
parameters: {
|
|
36
|
+
componentSubtitle: (
|
|
37
|
+
<>
|
|
38
|
+
Display markdown text based on <a href="https://github.com/remarkjs/react-markdown" target='_blank' rel="noreferrer">react-markdown</a> with custom styling.
|
|
39
|
+
</>
|
|
40
|
+
),
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const MarkdownStory = ({ children, className }: MarkdownProps) => (
|
|
45
|
+
<Markdown className={className}>
|
|
46
|
+
{children}
|
|
47
|
+
</Markdown>
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
MarkdownStory.storyName = "Markdown";
|
|
51
|
+
|
|
52
|
+
export const AvailableMDComponents = ({ className }: MarkdownProps) => (
|
|
53
|
+
<Markdown className={className}>
|
|
54
|
+
{`# Headers
|
|
55
|
+
The header options range from h1 to h4.
|
|
56
|
+
|
|
57
|
+
\`\`\`
|
|
58
|
+
# H1
|
|
59
|
+
## H2
|
|
60
|
+
### H3
|
|
61
|
+
#### H4
|
|
62
|
+
\`\`\`
|
|
63
|
+
|
|
64
|
+
# H1 Lorem ipsum non sunt qui sunt
|
|
65
|
+
|
|
66
|
+
## H2 Lorem ipsum non sunt qui sunt
|
|
67
|
+
|
|
68
|
+
### H3 Lorem ipsum non sunt qui sunt
|
|
69
|
+
|
|
70
|
+
#### H4 Lorem ipsum non sunt qui sunt
|
|
71
|
+
|
|
72
|
+
# Emphasis
|
|
73
|
+
|
|
74
|
+
\`\`\`
|
|
75
|
+
Emphasis or italics, use *asterisk* or _underscore_.
|
|
76
|
+
Strong emphasis or bold, use **asterisks** or __underscores__.
|
|
77
|
+
Combined emphasis, use **_asterisks and underscores_**.
|
|
78
|
+
\`\`\`
|
|
79
|
+
|
|
80
|
+
Emphasis or italics, use _asterisk_ or _underscore_.
|
|
81
|
+
|
|
82
|
+
Strong emphasis or bold, use **asterisks** or **underscores**.
|
|
83
|
+
|
|
84
|
+
Combined emphasis, use **_asterisks and underscores_**.
|
|
85
|
+
|
|
86
|
+
# Lists
|
|
87
|
+
|
|
88
|
+
\`\`\`
|
|
89
|
+
1. First ordered list item
|
|
90
|
+
2. Another item
|
|
91
|
+
3. Actual numbers don't matter, just that it's a number
|
|
92
|
+
4. And another item.
|
|
93
|
+
|
|
94
|
+
* Unordered list can use asterisks
|
|
95
|
+
- Or minuses
|
|
96
|
+
+ Or pluses
|
|
97
|
+
\`\`\`
|
|
98
|
+
|
|
99
|
+
1. First ordered list item
|
|
100
|
+
2. Another item
|
|
101
|
+
3. Actual numbers don't matter, just that it's a number
|
|
102
|
+
4. And another item.
|
|
103
|
+
|
|
104
|
+
- Unordered list can use asterisks
|
|
105
|
+
- Or minuses
|
|
106
|
+
- Or pluses
|
|
107
|
+
|
|
108
|
+
# Links
|
|
109
|
+
|
|
110
|
+
For links markdown syntax should be used.
|
|
111
|
+
|
|
112
|
+
\`\`\`
|
|
113
|
+
[This is an inline link](https://feather-insurance.com)
|
|
114
|
+
\`\`\`
|
|
115
|
+
|
|
116
|
+
[This is an inline link](https://feather-insurance.com)
|
|
117
|
+
`}
|
|
118
|
+
</Markdown>
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
export const AddingCustomComponents = ({ className }: MarkdownProps) => (
|
|
122
|
+
<Markdown customMDComponents={{
|
|
123
|
+
h6: (props: any) => (
|
|
124
|
+
<h6 className='tc-red-500'>{props.children}</h6>
|
|
125
|
+
)
|
|
126
|
+
}}>
|
|
127
|
+
###### This is a custom H6 that will always be red
|
|
128
|
+
</Markdown>
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
export default story;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h } from 'hastscript/html.js';
|
|
2
|
-
import
|
|
2
|
+
import { FunctionComponent } from 'react';
|
|
3
3
|
import ReactMarkdown from 'react-markdown';
|
|
4
4
|
import remarkDirective from 'remark-directive';
|
|
5
5
|
import visit from 'unist-util-visit';
|
|
@@ -101,19 +101,21 @@ const Code = (props: any) => {
|
|
|
101
101
|
);
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
+
export interface MarkdownProps {
|
|
105
|
+
children: string;
|
|
106
|
+
customMDComponents?: Record<string, FunctionComponent<any>>;
|
|
107
|
+
className?: string;
|
|
108
|
+
openLinksInNewTab?: boolean;
|
|
109
|
+
paragraphClassName?: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
104
112
|
const Markdown = ({
|
|
105
113
|
children,
|
|
106
114
|
customMDComponents,
|
|
107
115
|
className = '',
|
|
108
116
|
openLinksInNewTab = false,
|
|
109
117
|
paragraphClassName = '',
|
|
110
|
-
}:
|
|
111
|
-
children: string;
|
|
112
|
-
customMDComponents?: Record<string, FunctionComponent<any>>;
|
|
113
|
-
className?: string;
|
|
114
|
-
openLinksInNewTab?: boolean;
|
|
115
|
-
paragraphClassName?: string;
|
|
116
|
-
}) => (
|
|
118
|
+
}: MarkdownProps) => (
|
|
117
119
|
<ReactMarkdown
|
|
118
120
|
children={children}
|
|
119
121
|
className={className}
|
|
@@ -136,4 +138,4 @@ const Markdown = ({
|
|
|
136
138
|
/>
|
|
137
139
|
);
|
|
138
140
|
|
|
139
|
-
export
|
|
141
|
+
export { Markdown};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SignaturePad, SignaturePadProps } from '.';
|
|
2
|
+
|
|
3
|
+
const story = {
|
|
4
|
+
title: 'JSX/SignaturePad',
|
|
5
|
+
component: SignaturePad,
|
|
6
|
+
argTypes: {
|
|
7
|
+
onChange: {
|
|
8
|
+
action: true,
|
|
9
|
+
table: {
|
|
10
|
+
category: "Callbacks",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
parameters: {
|
|
15
|
+
componentSubtitle: 'Signature pad are user interface elements which allow user sign any legal document.',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const SignaturePadStory = ({
|
|
20
|
+
onChange,
|
|
21
|
+
}: SignaturePadProps) => {
|
|
22
|
+
const handleOnChange = (newIndex: string) => {
|
|
23
|
+
onChange?.(newIndex);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<SignaturePad
|
|
28
|
+
onChange={handleOnChange}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
SignaturePadStory.storyName = "SignaturePad";
|
|
34
|
+
|
|
35
|
+
export default story;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import Signature from 'signature_pad';
|
|
4
4
|
|
|
5
5
|
import styles from './style.module.scss';
|
|
6
6
|
|
|
7
7
|
import sign from './img/sign.svg';
|
|
8
8
|
import reset from './img/reset.svg';
|
|
9
9
|
|
|
10
|
-
interface
|
|
10
|
+
export interface SignaturePadProps {
|
|
11
11
|
onChange: (base64signature: string) => void;
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -15,12 +15,12 @@ interface State {
|
|
|
15
15
|
hasContent: boolean;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
class
|
|
18
|
+
class SignaturePad extends Component<SignaturePadProps, State> {
|
|
19
19
|
private canvasRef: React.RefObject<HTMLCanvasElement>;
|
|
20
20
|
private canvas: any;
|
|
21
21
|
private signaturePad: any;
|
|
22
22
|
|
|
23
|
-
constructor(props:
|
|
23
|
+
constructor(props: SignaturePadProps) {
|
|
24
24
|
super(props);
|
|
25
25
|
this.state = {
|
|
26
26
|
hasContent: false,
|
|
@@ -33,7 +33,7 @@ class Signature extends Component<Props, State> {
|
|
|
33
33
|
|
|
34
34
|
public componentDidMount() {
|
|
35
35
|
this.canvas = this.canvasRef.current;
|
|
36
|
-
this.signaturePad = new
|
|
36
|
+
this.signaturePad = new Signature(this.canvas, {
|
|
37
37
|
onEnd: this.notifyOnChange,
|
|
38
38
|
});
|
|
39
39
|
this.resizeCanvas();
|
|
@@ -93,4 +93,4 @@ class Signature extends Component<Props, State> {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
export
|
|
96
|
+
export { SignaturePad };
|
package/src/lib/index.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import DateSelector from './components/dateSelector';
|
|
2
|
-
import SignaturePad from './components/signaturePad';
|
|
2
|
+
import { SignaturePad } from './components/signaturePad';
|
|
3
3
|
import { AutocompleteAddress } from './components/autocompleteAddress';
|
|
4
4
|
import Input from './components/input';
|
|
5
5
|
import MultiDropzone, {
|
|
@@ -8,9 +8,10 @@ import MultiDropzone, {
|
|
|
8
8
|
UploadedFile,
|
|
9
9
|
UploadStatus
|
|
10
10
|
} from './components/multiDropzone';
|
|
11
|
-
import DownloadButton from './components/downloadButton';
|
|
11
|
+
import { DownloadButton } from './components/downloadButton';
|
|
12
12
|
import IbanInput from './components/input/iban';
|
|
13
13
|
import CurrencyInput from './components/input/currency';
|
|
14
|
+
import { Checkbox } from './components/input/checkbox';
|
|
14
15
|
import {
|
|
15
16
|
BottomModal,
|
|
16
17
|
RegularModal,
|
|
@@ -37,7 +38,7 @@ import {
|
|
|
37
38
|
TableHeader,
|
|
38
39
|
} from './components/comparisonTable';
|
|
39
40
|
import { SegmentedControl } from './components/segmentedControl';
|
|
40
|
-
import Markdown from './components/markdown';
|
|
41
|
+
import { Markdown } from './components/markdown';
|
|
41
42
|
import { images } from './util/images';
|
|
42
43
|
|
|
43
44
|
export {
|
|
@@ -69,6 +70,7 @@ export {
|
|
|
69
70
|
TableInfoButton,
|
|
70
71
|
SegmentedControl,
|
|
71
72
|
Markdown,
|
|
73
|
+
Checkbox,
|
|
72
74
|
images,
|
|
73
75
|
};
|
|
74
76
|
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Meta, Preview } from '@storybook/addon-docs/blocks';
|
|
2
|
-
|
|
3
|
-
import DownloadButton from '.';
|
|
4
|
-
|
|
5
|
-
<Meta title="JSX/DownloadButton" component={DownloadButton} />
|
|
6
|
-
|
|
7
|
-
# DownloadButton
|
|
8
|
-
|
|
9
|
-
DownloadButton component displays progress and status of downloading files.
|
|
10
|
-
|
|
11
|
-
## Examples
|
|
12
|
-
|
|
13
|
-
### Idle state
|
|
14
|
-
|
|
15
|
-
<Preview>
|
|
16
|
-
<DownloadButton downloadStatus="INITIAL" onDownload={() => {}} />
|
|
17
|
-
</Preview>
|
|
18
|
-
|
|
19
|
-
### Generating state
|
|
20
|
-
|
|
21
|
-
<Preview>
|
|
22
|
-
<DownloadButton downloadStatus="GENERATING" onDownload={() => {}} />
|
|
23
|
-
</Preview>
|
|
24
|
-
|
|
25
|
-
### Download complete state
|
|
26
|
-
|
|
27
|
-
<Preview>
|
|
28
|
-
<DownloadButton downloadStatus="COMPLETED" onDownload={() => {}} />
|
|
29
|
-
</Preview>
|
|
30
|
-
|
|
31
|
-
### Error state
|
|
32
|
-
|
|
33
|
-
<Preview>
|
|
34
|
-
<DownloadButton downloadStatus="FAILED" onDownload={() => {}} />
|
|
35
|
-
</Preview>
|
|
36
|
-
|
|
37
|
-
### Custom Error state
|
|
38
|
-
|
|
39
|
-
<Preview>
|
|
40
|
-
<DownloadButton
|
|
41
|
-
customFail={
|
|
42
|
-
<>
|
|
43
|
-
An error occured while generating your documents. Please try again or{' '}
|
|
44
|
-
<a
|
|
45
|
-
className='tc-primary-500'
|
|
46
|
-
href={`mailto:help@yourcompany.com`}
|
|
47
|
-
target="_blank"
|
|
48
|
-
rel="noopener noreferrer"
|
|
49
|
-
>
|
|
50
|
-
contact us
|
|
51
|
-
</a>
|
|
52
|
-
.
|
|
53
|
-
</>
|
|
54
|
-
}
|
|
55
|
-
downloadStatus="FAILED"
|
|
56
|
-
onDownload={() => {}}
|
|
57
|
-
/>
|
|
58
|
-
</Preview>
|
|
59
|
-
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
# Headers
|
|
2
|
-
|
|
3
|
-
The header options range from h1 to h4.
|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
# H1
|
|
7
|
-
## H2
|
|
8
|
-
### H3
|
|
9
|
-
#### H4
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
# H1 Lorem ipsum non sunt qui sunt
|
|
13
|
-
|
|
14
|
-
## H2 Lorem ipsum non sunt qui sunt
|
|
15
|
-
|
|
16
|
-
### H3 Lorem ipsum non sunt qui sunt
|
|
17
|
-
|
|
18
|
-
#### H4 Lorem ipsum non sunt qui sunt
|
|
19
|
-
|
|
20
|
-
# Emphasis
|
|
21
|
-
|
|
22
|
-
```
|
|
23
|
-
Emphasis or italics, use *asterisk* or _underscore_.
|
|
24
|
-
Strong emphasis or bold, use **asterisks** or __underscores__.
|
|
25
|
-
Combined emphasis, use **_asterisks and underscores_**.
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Emphasis or italics, use _asterisk_ or _underscore_.
|
|
29
|
-
|
|
30
|
-
Strong emphasis or bold, use **asterisks** or **underscores**.
|
|
31
|
-
|
|
32
|
-
Combined emphasis, use **_asterisks and underscores_**.
|
|
33
|
-
|
|
34
|
-
# Lists
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
1. First ordered list item
|
|
38
|
-
2. Another item
|
|
39
|
-
3. Actual numbers don't matter, just that it's a number
|
|
40
|
-
4. And another item.
|
|
41
|
-
|
|
42
|
-
* Unordered list can use asterisks
|
|
43
|
-
- Or minuses
|
|
44
|
-
+ Or pluses
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
1. First ordered list item
|
|
48
|
-
2. Another item
|
|
49
|
-
3. Actual numbers don't matter, just that it's a number
|
|
50
|
-
4. And another item.
|
|
51
|
-
|
|
52
|
-
- Unordered list can use asterisks
|
|
53
|
-
- Or minuses
|
|
54
|
-
- Or pluses
|
|
55
|
-
|
|
56
|
-
# Links
|
|
57
|
-
|
|
58
|
-
For links markdown syntax should be used.
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
[This is an inline link](https://feather-insurance.com)
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
[This is an inline link](https://feather-insurance.com)
|
|
65
|
-
|
|
66
|
-
# Custom Markdown tags
|
|
67
|
-
|
|
68
|
-
When additional functionality needs to be added to the markdown component, custom tags can be used.
|
|
69
|
-
|
|
70
|
-
```
|
|
71
|
-
Tags in the form of :mytag[value]{attributes} will be converted to the corresponding
|
|
72
|
-
custom HTML tags <mytag ...attributes>value<mytag>.
|
|
73
|
-
|
|
74
|
-
Custom styling for these tags can be provided by passing the customMDComponents prop
|
|
75
|
-
<Markdown customMDComponents={
|
|
76
|
-
mytag: ({ children }) => (<h1>{childrend}</h1>)
|
|
77
|
-
}>
|
|
78
|
-
```
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Meta, Preview } from '@storybook/addon-docs/blocks';
|
|
2
|
-
|
|
3
|
-
import Markdown from '.';
|
|
4
|
-
import example from './example.md';
|
|
5
|
-
|
|
6
|
-
<Meta title="JSX/Markdown" />
|
|
7
|
-
|
|
8
|
-
# Markdown
|
|
9
|
-
|
|
10
|
-
Display markdown text based on [react-markdown](https://github.com/remarkjs/react-markdown) with custom styling.
|
|
11
|
-
|
|
12
|
-
<Preview>
|
|
13
|
-
<Markdown>{example}</Markdown>
|
|
14
|
-
</Preview>
|
|
15
|
-
|
|
16
|
-
| attribute | unit | description | default value | required |
|
|
17
|
-
| ------------------ | ---------------------------------------------- | ------------------------------------------------ | ------------- | -------- |
|
|
18
|
-
| children | string | Markdown source to be rendered | n/a | true |
|
|
19
|
-
| customMDComponents | Record<string, FunctionComponent<any>> | Styling functions for custom tags | n/a | false |
|
|
20
|
-
| className | string | Styles to be applied to the whole markdown block | '' | false |
|
|
21
|
-
| openLinksInNewTab | boolean | Whether the links should open in a new tab | false | false |
|
|
22
|
-
| paragraphClassName | string | Styles to be applied to paragraph tags | '' | false |
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Meta, Preview } from '@storybook/addon-docs/blocks';
|
|
2
|
-
|
|
3
|
-
import Signaturepad from '.';
|
|
4
|
-
|
|
5
|
-
<Meta title="JSX/Signaturepad" component={Signaturepad} />
|
|
6
|
-
|
|
7
|
-
# Signature pad
|
|
8
|
-
|
|
9
|
-
Signature pad are user interface elements which allow user sign any legal document.
|
|
10
|
-
|
|
11
|
-
## Examples
|
|
12
|
-
|
|
13
|
-
### Default example
|
|
14
|
-
|
|
15
|
-
<Preview>
|
|
16
|
-
<Signaturepad onChange={() => {}} />
|
|
17
|
-
</Preview>
|