freemium-survey-components 0.1.0

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.
Files changed (57) hide show
  1. package/.eslintrc +24 -0
  2. package/.prettierrc +10 -0
  3. package/.storybook/main.js +59 -0
  4. package/.storybook/manager.js +9 -0
  5. package/.storybook/preview.js +1 -0
  6. package/README.md +3 -0
  7. package/index.ts +3 -0
  8. package/lib/index.cjs.js +1 -0
  9. package/lib/index.esm.js +1 -0
  10. package/lib/types/index.d.ts +3 -0
  11. package/lib/types/src/components/button/index.d.ts +25 -0
  12. package/lib/types/src/components/checkbox/index.d.ts +14 -0
  13. package/lib/types/src/components/index.d.ts +6 -0
  14. package/lib/types/src/components/nps/index.d.ts +23 -0
  15. package/lib/types/src/components/progressbar/index.d.ts +8 -0
  16. package/lib/types/src/components/radio-button/index.d.ts +25 -0
  17. package/lib/types/src/components/text-input/index.d.ts +52 -0
  18. package/lib/types/src/index.d.ts +1 -0
  19. package/lib/types/src/mock.d.ts +215 -0
  20. package/lib/types/src/survey/index.d.ts +4 -0
  21. package/lib/types/src/survey/question.d.ts +3 -0
  22. package/lib/types/src/survey/widget.d.ts +4 -0
  23. package/lib/types/src/utils.d.ts +3 -0
  24. package/package.json +97 -0
  25. package/postcss.config.js +4 -0
  26. package/rollup.config.ts +32 -0
  27. package/src/components/button/button.stories.tsx +23 -0
  28. package/src/components/button/index.tsx +67 -0
  29. package/src/components/button/style.css +41 -0
  30. package/src/components/checkbox/checkbox.stories.tsx +34 -0
  31. package/src/components/checkbox/index.tsx +118 -0
  32. package/src/components/checkbox/style.css +85 -0
  33. package/src/components/index.tsx +6 -0
  34. package/src/components/nps/index.tsx +69 -0
  35. package/src/components/nps/nps.stories.tsx +34 -0
  36. package/src/components/nps/style.css +154 -0
  37. package/src/components/progressbar/index.tsx +21 -0
  38. package/src/components/progressbar/progressbar.stories.tsx +22 -0
  39. package/src/components/progressbar/style.css +14 -0
  40. package/src/components/radio-button/index.tsx +66 -0
  41. package/src/components/radio-button/radio.stories.tsx +26 -0
  42. package/src/components/radio-button/style.css +60 -0
  43. package/src/components/text-input/index.tsx +155 -0
  44. package/src/components/text-input/style.css +102 -0
  45. package/src/components/text-input/text-input.stories.tsx +84 -0
  46. package/src/index.tsx +1 -0
  47. package/src/mock.ts +363 -0
  48. package/src/survey/index.tsx +269 -0
  49. package/src/survey/question.tsx +79 -0
  50. package/src/survey/style.css +58 -0
  51. package/src/survey/survey.stories.tsx +28 -0
  52. package/src/survey/widget.css +46 -0
  53. package/src/survey/widget.tsx +17 -0
  54. package/src/theme/index.css +72 -0
  55. package/src/typings/index.d.ts +1 -0
  56. package/src/utils.tsx +12 -0
  57. package/tsconfig.json +22 -0
@@ -0,0 +1,154 @@
1
+ .container {
2
+ margin: 0 auto;
3
+ width: 100%;
4
+ }
5
+ .title {
6
+ color: var(--color-elephant-900);
7
+ font-weight: 600;
8
+ }
9
+
10
+ .footer {
11
+ margin-top: 20px;
12
+ border-top: 1px solid var(--color-smoke-50);
13
+ padding-top: 20px;
14
+ display: flex;
15
+ justify-content: center;
16
+ font-size: 12px;
17
+ }
18
+
19
+ .widget span {
20
+ color: #aaa;
21
+ font-size: 12px;
22
+ }
23
+ .widget button {
24
+ display: inline-block;
25
+ font-size: 16px;
26
+ white-space: nowrap;
27
+ vertical-align: middle;
28
+ background: none;
29
+ border: none;
30
+ box-shadow: none;
31
+ cursor: pointer;
32
+ text-align: center;
33
+ font-weight: 500;
34
+ border-radius: 4px;
35
+ margin: 0;
36
+ outline: none;
37
+ margin-left: -1px;
38
+ width: 40px;
39
+ height: 40px;
40
+ transform: scale(1);
41
+ transition: background 0.2s ease-in, color 0.2s ease-in,
42
+ border-color 0.2s ease-in, transform 0.2s cubic-bezier(0.5, 2, 0.5, 0.75);
43
+ }
44
+ .widget button:hover {
45
+ color: white;
46
+ transform: scale(1.15);
47
+ z-index: 2;
48
+ position: relative;
49
+ }
50
+ .widget button.active {
51
+ color: white;
52
+ transform: scale(1.15);
53
+ z-index: 2;
54
+ position: relative;
55
+ }
56
+
57
+ .choices {
58
+ width: 100%;
59
+ display: flex;
60
+ justify-content: space-between;
61
+ }
62
+
63
+ .choice.active,
64
+ .choice:hover:nth-child(1) {
65
+ background: #eb5b56;
66
+ }
67
+ .choice.active,
68
+ .choice:hover:nth-child(2) {
69
+ background: #fb8774;
70
+ }
71
+ .choice.active,
72
+ .choice:hover:nth-child(3) {
73
+ background: #f58f6b;
74
+ }
75
+ .choice.active,
76
+ .choice:hover:nth-child(4) {
77
+ background: #f6996a;
78
+ }
79
+ .choice.active,
80
+ .choice:hover:nth-child(5) {
81
+ background: #eab268;
82
+ }
83
+ .choice.active,
84
+ .choice:hover:nth-child(6) {
85
+ background: #cebb69;
86
+ }
87
+ .choice.active,
88
+ .choice:hover:nth-child(7) {
89
+ background: #bdc46c;
90
+ }
91
+ .choice.active,
92
+ .choice:hover:nth-child(8) {
93
+ background: #a4cd72;
94
+ }
95
+ .choice.active,
96
+ .choice:hover:nth-child(9) {
97
+ background: #77c955;
98
+ }
99
+ .choice.active,
100
+ .choice:hover:nth-child(10) {
101
+ background: #37c248;
102
+ }
103
+
104
+ .widget.highlighted button.active,
105
+ .widget.highlighted button:hover {
106
+ background: var(--color-elephant-800) !important;
107
+ }
108
+ .widget .rounded button {
109
+ border-radius: 100%;
110
+ }
111
+ .widget .boxed button {
112
+ border-radius: 0;
113
+ }
114
+ .widget {
115
+ padding: 35px 0;
116
+ box-sizing: border-box;
117
+ position: relative;
118
+ padding-bottom: 30px;
119
+ }
120
+ .widget .button-container {
121
+ display: flex;
122
+ justify-content: space-between;
123
+ background: var(--color-smoke-50);
124
+ }
125
+ .widget .positive-text,
126
+ .widget .negative-text {
127
+ position: absolute;
128
+ color: var(--color-elephant-500);
129
+ }
130
+ .widget .positive-text {
131
+ right: 0px;
132
+ bottom: 5px;
133
+ text-align: right;
134
+ }
135
+ .widget .negative-text {
136
+ left: 0;
137
+ bottom: 5px;
138
+ text-align: left;
139
+ }
140
+ @media (max-width: 550px) {
141
+ .widget .button-container {
142
+ background: transparent;
143
+ }
144
+ .widget .choices {
145
+ flex-wrap: wrap;
146
+ justify-content: center;
147
+ gap: 16px;
148
+ background: transparent;
149
+ }
150
+ .widget button {
151
+ border-radius: 50%;
152
+ background: #ebeff3;
153
+ }
154
+ }
@@ -0,0 +1,21 @@
1
+ import React from 'react'
2
+ import './style.css'
3
+ interface ProgressBarProps {
4
+ totalSteps: number
5
+ completedSteps: number
6
+ }
7
+ const ProgressBar = (props: ProgressBarProps) => {
8
+ const {totalSteps, completedSteps} = props
9
+ return (
10
+ <div className="progressbar-container">
11
+ <div
12
+ className="progressbar"
13
+ style={{
14
+ width: `${completedSteps > 0 ? 100 / totalSteps : 0}%`,
15
+ transform: `scaleX(${completedSteps})`,
16
+ }}
17
+ ></div>
18
+ </div>
19
+ )
20
+ }
21
+ export {ProgressBar}
@@ -0,0 +1,22 @@
1
+ import {withKnobs} from '@storybook/addon-knobs'
2
+ import {storiesOf} from '@storybook/react'
3
+ import React from 'react'
4
+ import {ProgressBar} from './'
5
+ import {useState} from '@storybook/addons'
6
+
7
+ const stories = storiesOf('ProgressBar', module)
8
+ stories.addDecorator(withKnobs)
9
+ stories.addDecorator((story) => {
10
+ return <div style={{margin: '50px'}}>{story()}</div>
11
+ })
12
+
13
+ stories.add('Basic', () => {
14
+ const [completedSteps, set] = useState(0)
15
+ return (
16
+ <>
17
+ <ProgressBar totalSteps={10} completedSteps={completedSteps} />
18
+ <div style={{marginTop: '40px'}}></div>
19
+ <button onClick={() => set(completedSteps + 1)}>Complete step</button>
20
+ </>
21
+ )
22
+ })
@@ -0,0 +1,14 @@
1
+ .progressbar-container {
2
+ width: 100%;
3
+ height: 6px;
4
+ position: fixed;
5
+ top: 0;
6
+ left: 0;
7
+ z-index: 1;
8
+ }
9
+ .progressbar {
10
+ transition: transform 0.25s linear;
11
+ transform-origin: left;
12
+ height: 100%;
13
+ background-color: var(--brand-color);
14
+ }
@@ -0,0 +1,66 @@
1
+ import React, {Children, forwardRef} from 'react'
2
+ import {withDefaults} from '../../utils'
3
+ import './style.css'
4
+ interface RadioButtonProps {
5
+ checked: boolean
6
+ children: string
7
+ value: string | number
8
+ name: string
9
+ onChange: (e: any) => void
10
+ id?: string
11
+ }
12
+ const defaultProps = {
13
+ checked: false,
14
+ }
15
+ interface RadioGroupInterface {
16
+ options: Array<{id: string; name?: string; label: string}>
17
+ value: string
18
+ name: string
19
+ onChangeHandler: (newValue: string) => void
20
+ }
21
+ const RadioGroup = ({
22
+ name,
23
+ options,
24
+ value,
25
+ onChangeHandler,
26
+ }: RadioGroupInterface) => {
27
+ return (
28
+ <div className="radio-group">
29
+ {options.map((option) => (
30
+ <Radio
31
+ key={option.id}
32
+ value={option.id}
33
+ name={name}
34
+ onChange={(e) => {
35
+ onChangeHandler(e.currentTarget.value)
36
+ }}
37
+ checked={value === option.id}
38
+ >
39
+ {option.label}
40
+ </Radio>
41
+ ))}
42
+ </div>
43
+ )
44
+ }
45
+ const RadioComponent = forwardRef(
46
+ (props: RadioButtonProps, ref?: React.Ref<HTMLInputElement>) => {
47
+ return (
48
+ <label className="radio-label">
49
+ <input
50
+ ref={ref}
51
+ type="radio"
52
+ name={props.name}
53
+ value={props.value}
54
+ checked={props.checked}
55
+ onClick={props.onChange}
56
+ autoFocus={true}
57
+ />
58
+ <div className="radio" />
59
+ <div>{props.children}</div>
60
+ </label>
61
+ )
62
+ },
63
+ )
64
+
65
+ const Radio = withDefaults(RadioComponent, defaultProps)
66
+ export {Radio, RadioGroup}
@@ -0,0 +1,26 @@
1
+ import {withKnobs} from '@storybook/addon-knobs'
2
+ import {storiesOf} from '@storybook/react'
3
+ import React from 'react'
4
+ import {Radio, RadioGroup} from './'
5
+ import {useState} from '@storybook/addons'
6
+
7
+ const stories = storiesOf('Radio', module)
8
+ stories.addDecorator(withKnobs)
9
+ stories.addDecorator((story) => {
10
+ return <div style={{margin: '50px'}}>{story()}</div>
11
+ })
12
+
13
+ stories.add('basic radio button', () => {
14
+ const [checked, setChecked] = useState('')
15
+ return (
16
+ <RadioGroup
17
+ name="radio-group"
18
+ value={checked}
19
+ onChangeHandler={(value) => setChecked(value)}
20
+ options={[
21
+ {id: 'checkA', label: 'Option A'},
22
+ {id: 'checkB', label: 'Option B'},
23
+ ]}
24
+ />
25
+ )
26
+ })
@@ -0,0 +1,60 @@
1
+ .radio-group {
2
+ display: flex;
3
+ align-items: center;
4
+ gap: 12px;
5
+ white-space: nowrap;
6
+ flex-direction: column;
7
+ }
8
+
9
+ .radio {
10
+ background-color: #fff;
11
+ border: 1px solid;
12
+ border-color: var(--input-border-color);
13
+ transition: background-color ease-in 0.2s;
14
+ width: 18px;
15
+ height: 18px;
16
+ border-radius: 50%;
17
+ position: relative;
18
+ margin-right: 12px;
19
+ }
20
+ .radio:before {
21
+ left: 3px;
22
+ top: 3px;
23
+ content: '';
24
+ position: absolute;
25
+ width: 10px;
26
+ height: 10px;
27
+ border-radius: 50%;
28
+ transition: all ease-in 0.2s;
29
+ background-color: #fff;
30
+ }
31
+ .radio-label {
32
+ display: flex;
33
+ align-items: center;
34
+ user-select: none;
35
+ cursor: pointer;
36
+ font-size: 1rem;
37
+ font-weight: 500;
38
+ padding: 16px;
39
+ min-width: 200px;
40
+ border: 1px solid #ebeff3;
41
+ box-shadow: 0px 2px 5px rgb(18 52 77 / 10%);
42
+ border-radius: 4px;
43
+ }
44
+ input[type='radio'] {
45
+ clip: rect(0, 0, 0, 0);
46
+ position: absolute;
47
+ }
48
+ input[type='radio']:focus ~ .radio {
49
+ /* box-shadow: ${pseudo.focus} 0px 0px 0px 3px; */
50
+ box-shadow: var(--input-highlight-color) 0px 0px 0px 3px;
51
+ border-color: transparent;
52
+ }
53
+
54
+ input[type='radio']:checked ~ .radio:before {
55
+ background-color: var(--input-highlight-color);
56
+ }
57
+ .radio-container:hover .radio {
58
+ border-color: var(--input-highlight-color);
59
+ box-shadow: var(--focus-box-shadow-color) 0px 0px 0px 5px;
60
+ }
@@ -0,0 +1,155 @@
1
+ import React, {forwardRef} from 'react'
2
+ import {withDefaults} from '../../utils'
3
+ import './style.css'
4
+
5
+ interface InputProps extends React.HTMLAttributes<HTMLInputElement> {
6
+ isErrored?: boolean
7
+ showCount?: boolean
8
+ errorText?: string
9
+ maxLength?: any
10
+ type?: string
11
+ label: string
12
+ style?: any
13
+ value?: any
14
+ inputStyle?: any
15
+ className?: string
16
+ startLabel?: React.ReactNode | any
17
+ endLabel?: React.ReactNode | any
18
+ isRequired?: boolean
19
+ inline?: boolean
20
+ }
21
+
22
+ interface TextAreaProps extends React.HTMLAttributes<HTMLTextAreaElement> {
23
+ isErrored: boolean
24
+ showCount?: boolean
25
+ maxLength?: any
26
+ errorText?: string
27
+ style?: any
28
+ value?: any
29
+ inputStyle?: any
30
+ className?: string
31
+ label: string
32
+ startLabel?: React.ReactNode | any
33
+ startAdornment?: React.ReactNode | any
34
+ endLabel?: React.ReactNode | any
35
+ endAdornment?: React.ReactNode | any
36
+ isRequired?: boolean
37
+ inline?: boolean
38
+ }
39
+
40
+ const defaultProps = {
41
+ isRequired: false,
42
+ showCount: false,
43
+ isErrored: false,
44
+ inline: false,
45
+ spellCheck: false,
46
+ autoFocus: false,
47
+ }
48
+
49
+ const InputComponent = forwardRef(
50
+ (props: InputProps, ref?: React.Ref<HTMLInputElement>) => {
51
+ const {
52
+ inputStyle,
53
+ style,
54
+ className,
55
+ showCount,
56
+ isErrored,
57
+ startLabel,
58
+ isRequired,
59
+ errorText,
60
+ endLabel,
61
+ maxLength,
62
+ ...rest
63
+ } = props
64
+ console.log(props.value)
65
+ return (
66
+ <div className="input-container" style={style}>
67
+ {props.label && (
68
+ <label className={`input-label ${isRequired ? 'required' : ''}`}>
69
+ {props.label}
70
+ </label>
71
+ )}
72
+ <div>
73
+ {startLabel && <div className="start-label">{startLabel}</div>}
74
+ <div
75
+ className={`input-basic ${isErrored ? 'error' : ''}${
76
+ className || ''
77
+ }`}
78
+ >
79
+ <input
80
+ type="text"
81
+ autoComplete="off"
82
+ {...rest}
83
+ ref={ref}
84
+ style={inputStyle}
85
+ />
86
+ {showCount && maxLength > 0 && (
87
+ <div className="end-max-length">{`${
88
+ (props.value && props.value.length) || 0
89
+ }/${props.maxLength}`}</div>
90
+ )}
91
+ </div>
92
+ {endLabel && <div className="end-label">{endLabel}</div>}
93
+ </div>
94
+ {isErrored && errorText && (
95
+ <span className="input-error">{props.errorText}</span>
96
+ )}
97
+ </div>
98
+ )
99
+ },
100
+ )
101
+
102
+ const TextAreaComponent = forwardRef(
103
+ (props: TextAreaProps, ref?: React.Ref<HTMLTextAreaElement>) => {
104
+ const {
105
+ inputStyle,
106
+ style,
107
+ className,
108
+ showCount,
109
+ maxLength,
110
+ isErrored,
111
+ startLabel,
112
+ isRequired,
113
+ ...rest
114
+ } = props
115
+ console.log(props.value)
116
+ return (
117
+ <>
118
+ <div className="textarea-container" style={style}>
119
+ {props.label && (
120
+ <label className={`input-label ${isRequired ? 'required' : ''}`}>
121
+ {props.label}
122
+ </label>
123
+ )}
124
+ {startLabel && <div className="start-label">{startLabel}</div>}
125
+ <div
126
+ className={`input-basic ${isErrored ? 'error' : ''} ${
127
+ className || ''
128
+ }`}
129
+ >
130
+ <textarea
131
+ autoComplete="off"
132
+ {...rest}
133
+ ref={ref}
134
+ style={inputStyle}
135
+ />
136
+ {showCount && maxLength && maxLength > 0 && (
137
+ <div className="end-max-length">{`${
138
+ (props.value && props.value.length) || 0
139
+ }/${props.maxLength}`}</div>
140
+ )}
141
+ </div>
142
+ {props.endLabel && <div className="end-label">{props.endLabel}</div>}
143
+ </div>
144
+ {props.isErrored && props.errorText && (
145
+ <span className="input-error">{props.errorText}</span>
146
+ )}
147
+ </>
148
+ )
149
+ },
150
+ )
151
+
152
+ const Input = withDefaults(InputComponent, defaultProps)
153
+ const TextArea = withDefaults(TextAreaComponent, defaultProps)
154
+
155
+ export {Input, TextArea}
@@ -0,0 +1,102 @@
1
+ .input-container,
2
+ .textarea-container {
3
+ display: flex;
4
+ flex-direction: column;
5
+ width: 100%;
6
+ border-radius: 4px;
7
+ position: relative;
8
+ }
9
+ label.input-label {
10
+ display: inline-block;
11
+ padding-bottom: 8px;
12
+ padding-left: 2px;
13
+ font-size: 12px;
14
+ font-weight: 400;
15
+ }
16
+ label.required::after {
17
+ content: '*';
18
+ position: relative;
19
+ top: 2px;
20
+ font-weight: 500;
21
+ font-size: 0.85rem;
22
+ padding-left: 3px;
23
+ color: var(--error-highlight-color);
24
+ }
25
+
26
+ .input-basic {
27
+ width: 100%;
28
+ display: flex;
29
+ align-items: center;
30
+ border-radius: var(--border-radius);
31
+ border: 1px solid var(--input-border-color);
32
+ transition: border-color 0.2s linear;
33
+ background: #fff;
34
+ }
35
+ .textarea-container .input-basic {
36
+ flex-direction: column;
37
+ align-items: unset;
38
+ }
39
+ .input-basic.error {
40
+ border: 1px solid var(--error-highlight-color);
41
+ }
42
+ .input-basic.error:hover {
43
+ border: 1px solid var(--error-highlight-color);
44
+ }
45
+ .input-basic.error:focus-within {
46
+ box-shadow: none;
47
+ }
48
+ .input-basic:hover {
49
+ border-color: var(--input-hover-border-color);
50
+ transition: 0.2s linear;
51
+ }
52
+ .input-basic:focus-within {
53
+ border: 1px solid transparent;
54
+ box-shadow: 0 0 0 2px var(--input-highlight-color);
55
+ }
56
+ .end-max-length {
57
+ padding: 0 8px;
58
+ font-size: 0.85rem;
59
+ }
60
+ .textarea-container .end-max-length {
61
+ padding: 8px;
62
+ align-self: flex-end;
63
+ }
64
+ span.input-error {
65
+ display: block;
66
+ padding-left: 2px;
67
+ padding-top: 4px;
68
+ font-size: 0.9rem;
69
+ color: var(--error-highlight-color);
70
+ }
71
+ input[type='text'] {
72
+ padding: 4px 12px;
73
+ flex: 1;
74
+ border: unset;
75
+ height: 32px;
76
+ font-size: 1rem;
77
+ /* line-height: ${typography.input.text.lineHeight}; */
78
+ font-weight: 500;
79
+ border-radius: 4px;
80
+ }
81
+ input[type='text'],
82
+ textarea {
83
+ outline: none;
84
+ border: none;
85
+ }
86
+ input[type='text']::placeholder {
87
+ color: var(--input-placeholder-color);
88
+ }
89
+ textarea {
90
+ min-height: 116px;
91
+ padding: 4px 12px;
92
+ flex: 1;
93
+ border: unset;
94
+ resize: none;
95
+ font-size: 1rem;
96
+ /* line-height: ${typography.input.text.lineHeight}; */
97
+ font-weight: 500;
98
+ border-radius: 4px;
99
+ }
100
+ textarea::placeholder {
101
+ color: var(--input-placeholder-color);
102
+ }
@@ -0,0 +1,84 @@
1
+ import {withKnobs} from '@storybook/addon-knobs'
2
+ import {storiesOf} from '@storybook/react'
3
+ import React from 'react'
4
+ import {Input, TextArea} from '.'
5
+
6
+ const stories = storiesOf('Input', module)
7
+
8
+ stories.addDecorator(withKnobs)
9
+ stories.addDecorator((story) => {
10
+ return <div style={{padding: '50px'}}>{story()}</div>
11
+ })
12
+
13
+ stories.add('Input', () => {
14
+ const [value, setValue] = React.useState('')
15
+ return (
16
+ <div style={{display: 'flex', flexDirection: 'column'}}>
17
+ <Input placeholder="Normal input" label="Standard input element" />
18
+ &nbsp;&nbsp;
19
+ <Input
20
+ placeholder="Accepts 10 chars"
21
+ maxLength={10}
22
+ showCount={true}
23
+ value={value}
24
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
25
+ setValue(e.target.value)
26
+ }
27
+ label="Max Length - showCount false"
28
+ />
29
+ &nbsp;&nbsp;
30
+ <Input
31
+ placeholder="Accepts 10 chars"
32
+ maxLength={10}
33
+ value={value}
34
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
35
+ setValue(e.target.value)
36
+ }
37
+ label="Max Length - showCount true"
38
+ />
39
+ &nbsp;&nbsp;
40
+ <Input
41
+ placeholder="Required input"
42
+ label="Required element"
43
+ isRequired={true}
44
+ />
45
+ &nbsp;&nbsp;
46
+ <Input
47
+ inline={true}
48
+ isErrored={true}
49
+ placeholder="Errored input"
50
+ label="errored input element"
51
+ />{' '}
52
+ &nbsp;&nbsp; &nbsp;&nbsp;
53
+ <Input
54
+ inline={true}
55
+ isErrored={true}
56
+ errorText="Field is required"
57
+ placeholder="Errored input with msg"
58
+ label="With error text"
59
+ />{' '}
60
+ &nbsp;&nbsp; &nbsp;&nbsp;
61
+ </div>
62
+ )
63
+ })
64
+
65
+ stories.add('TextArea', () => (
66
+ <div style={{display: 'flex', flexDirection: 'column'}}>
67
+ <TextArea placeholder="Normal input" label="Standard input element" />
68
+ &nbsp;&nbsp;
69
+ <TextArea
70
+ placeholder="Required input"
71
+ label="Required element"
72
+ isRequired={true}
73
+ />
74
+ &nbsp;&nbsp;
75
+ <TextArea
76
+ inline={true}
77
+ placeholder="Constrained input"
78
+ label="Input element with max length"
79
+ showCount={true}
80
+ maxLength={100}
81
+ />{' '}
82
+ &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;
83
+ </div>
84
+ ))
package/src/index.tsx ADDED
@@ -0,0 +1 @@
1
+ export * from './survey'