@seeqdev/qomponents 0.0.69 → 0.0.71
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/README.md +135 -135
- package/dist/Button/Button.types.d.ts +1 -5
- package/dist/ButtonWithPopover/ButtonWithPopover.types.d.ts +6 -0
- package/dist/Select/Select.types.d.ts +6 -0
- package/dist/example/.eslintrc.cjs +14 -14
- package/dist/example/README.md +33 -33
- package/dist/example/index.html +13 -13
- package/dist/example/package.json +30 -30
- package/dist/example/src/ComplexSelectExample.tsx +81 -81
- package/dist/example/src/Example.tsx +167 -167
- package/dist/example/src/index.css +102 -102
- package/dist/example/src/main.tsx +10 -10
- package/dist/example/src/vite-env.d.ts +1 -1
- package/dist/example/tsconfig.json +33 -33
- package/dist/example/tsconfig.node.json +12 -12
- package/dist/example/vite.config.ts +12 -12
- package/dist/index.esm.js +45 -28
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +45 -28
- package/dist/index.js.map +1 -1
- package/dist/styles.css +3281 -3272
- package/package.json +83 -83
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Icon, Select } from '@seeqdev/qomponents';
|
|
3
|
-
|
|
4
|
-
export interface SelectOption {
|
|
5
|
-
id: string;
|
|
6
|
-
label: string;
|
|
7
|
-
color: string;
|
|
8
|
-
asset: string;
|
|
9
|
-
type: 'SCALAR' | 'STRING' | 'NUMERIC';
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const options: SelectOption[] = [
|
|
13
|
-
{ id: '1', label: 'Label for the first entry', color: 'pink', asset: 'Asset 1', type: 'NUMERIC' },
|
|
14
|
-
{ id: '2', label: 'Label for the second entry', color: 'green', asset: 'Asset 2', type: 'SCALAR' },
|
|
15
|
-
{ id: '3', label: 'Label for the third entry', color: 'orange', asset: 'Asset 3', type: 'STRING' },
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
interface ComplexSelectExampleProps {
|
|
19
|
-
onChange: (selectedOption: SelectOption) => void;
|
|
20
|
-
value: SelectOption | undefined;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function ComplexSelectExample({ onChange, value }: ComplexSelectExampleProps) {
|
|
24
|
-
const getIcon = (type: string) => {
|
|
25
|
-
switch (type) {
|
|
26
|
-
case 'STRING':
|
|
27
|
-
return 'fa fa-font';
|
|
28
|
-
case 'SCALAR':
|
|
29
|
-
return 'fc-scalar';
|
|
30
|
-
default:
|
|
31
|
-
return 'fc-series';
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* This function formats the select option as desired. You can apply css styling here or use additional qomponents
|
|
36
|
-
* to style the select option display.
|
|
37
|
-
*
|
|
38
|
-
* You can use the same function to format the selected value or use a different one (sometimes having a separate
|
|
39
|
-
* function is helpful if you want to limit the space that is taken up by the selected option).
|
|
40
|
-
*
|
|
41
|
-
* This example shows how to use an additional Icon component (styled in color based on the select option) as well
|
|
42
|
-
* as how to display the properties of the select option
|
|
43
|
-
*/
|
|
44
|
-
const getOptionLabel = (optionValue: SelectOption): React.ReactNode => {
|
|
45
|
-
return (
|
|
46
|
-
<div className="selectOptionWrapperDiv">
|
|
47
|
-
<Icon icon={getIcon(optionValue.type)} type="color" color={optionValue.color} extraClassNames="mr-10" />
|
|
48
|
-
<div className="selectOptionDiv">
|
|
49
|
-
<div className="selectOption">
|
|
50
|
-
<strong>{optionValue.label}</strong>
|
|
51
|
-
</div>
|
|
52
|
-
<div className="selectOptionSubText">{optionValue.asset}</div>
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
const getOptionValue = (option: SelectOption) => {
|
|
58
|
-
return option.id;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
// use the getOptionLabel function to provide a custom render function that determines how the select options
|
|
63
|
-
// are displayed
|
|
64
|
-
// use the getSelectedValueLabel function to provide a custom render function that determines how the selected
|
|
65
|
-
// option is displayed
|
|
66
|
-
<Select
|
|
67
|
-
placeholder="formatted select options"
|
|
68
|
-
extraClassNames="formElementWidth"
|
|
69
|
-
options={options}
|
|
70
|
-
value={value}
|
|
71
|
-
getOptionLabel={getOptionLabel}
|
|
72
|
-
getOptionValue={getOptionValue}
|
|
73
|
-
getSelectedValueLabel={getOptionLabel}
|
|
74
|
-
onChange={(selectedOption: SelectOption) => {
|
|
75
|
-
onChange(selectedOption);
|
|
76
|
-
}}
|
|
77
|
-
/>
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export default ComplexSelectExample;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Icon, Select } from '@seeqdev/qomponents';
|
|
3
|
+
|
|
4
|
+
export interface SelectOption {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
color: string;
|
|
8
|
+
asset: string;
|
|
9
|
+
type: 'SCALAR' | 'STRING' | 'NUMERIC';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const options: SelectOption[] = [
|
|
13
|
+
{ id: '1', label: 'Label for the first entry', color: 'pink', asset: 'Asset 1', type: 'NUMERIC' },
|
|
14
|
+
{ id: '2', label: 'Label for the second entry', color: 'green', asset: 'Asset 2', type: 'SCALAR' },
|
|
15
|
+
{ id: '3', label: 'Label for the third entry', color: 'orange', asset: 'Asset 3', type: 'STRING' },
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
interface ComplexSelectExampleProps {
|
|
19
|
+
onChange: (selectedOption: SelectOption) => void;
|
|
20
|
+
value: SelectOption | undefined;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function ComplexSelectExample({ onChange, value }: ComplexSelectExampleProps) {
|
|
24
|
+
const getIcon = (type: string) => {
|
|
25
|
+
switch (type) {
|
|
26
|
+
case 'STRING':
|
|
27
|
+
return 'fa fa-font';
|
|
28
|
+
case 'SCALAR':
|
|
29
|
+
return 'fc-scalar';
|
|
30
|
+
default:
|
|
31
|
+
return 'fc-series';
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* This function formats the select option as desired. You can apply css styling here or use additional qomponents
|
|
36
|
+
* to style the select option display.
|
|
37
|
+
*
|
|
38
|
+
* You can use the same function to format the selected value or use a different one (sometimes having a separate
|
|
39
|
+
* function is helpful if you want to limit the space that is taken up by the selected option).
|
|
40
|
+
*
|
|
41
|
+
* This example shows how to use an additional Icon component (styled in color based on the select option) as well
|
|
42
|
+
* as how to display the properties of the select option
|
|
43
|
+
*/
|
|
44
|
+
const getOptionLabel = (optionValue: SelectOption): React.ReactNode => {
|
|
45
|
+
return (
|
|
46
|
+
<div className="selectOptionWrapperDiv">
|
|
47
|
+
<Icon icon={getIcon(optionValue.type)} type="color" color={optionValue.color} extraClassNames="mr-10" />
|
|
48
|
+
<div className="selectOptionDiv">
|
|
49
|
+
<div className="selectOption">
|
|
50
|
+
<strong>{optionValue.label}</strong>
|
|
51
|
+
</div>
|
|
52
|
+
<div className="selectOptionSubText">{optionValue.asset}</div>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
const getOptionValue = (option: SelectOption) => {
|
|
58
|
+
return option.id;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
// use the getOptionLabel function to provide a custom render function that determines how the select options
|
|
63
|
+
// are displayed
|
|
64
|
+
// use the getSelectedValueLabel function to provide a custom render function that determines how the selected
|
|
65
|
+
// option is displayed
|
|
66
|
+
<Select
|
|
67
|
+
placeholder="formatted select options"
|
|
68
|
+
extraClassNames="formElementWidth"
|
|
69
|
+
options={options}
|
|
70
|
+
value={value}
|
|
71
|
+
getOptionLabel={getOptionLabel}
|
|
72
|
+
getOptionValue={getOptionValue}
|
|
73
|
+
getSelectedValueLabel={getOptionLabel}
|
|
74
|
+
onChange={(selectedOption: SelectOption) => {
|
|
75
|
+
onChange(selectedOption);
|
|
76
|
+
}}
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export default ComplexSelectExample;
|
|
@@ -1,167 +1,167 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Button, Checkbox, Icon, QTip, Select, TextArea, TextField } from '@seeqdev/qomponents';
|
|
3
|
-
import ComplexSelectExample, { SelectOption } from './ComplexSelectExample';
|
|
4
|
-
|
|
5
|
-
const availableThemes = [
|
|
6
|
-
{ display: 'Analysis', value: 'color_analysis' },
|
|
7
|
-
{ display: 'Topic', value: 'color_topic' },
|
|
8
|
-
{ display: 'DataLab', value: 'color_datalab' },
|
|
9
|
-
];
|
|
10
|
-
|
|
11
|
-
const options = [
|
|
12
|
-
{ value: '1', label: 'Beginner' },
|
|
13
|
-
{ value: '2', label: 'Advanced' },
|
|
14
|
-
{ value: '3', label: 'Expert' },
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
function Example() {
|
|
18
|
-
/**
|
|
19
|
-
* Theming is supported "out of the box". To apply a theme wrap your addOn in a div and assign the class that
|
|
20
|
-
* matched the desired theme:
|
|
21
|
-
* - color_analysis for Analysis styled qomponents (green)
|
|
22
|
-
* - color_topic for Topic styled qomponents (blue)
|
|
23
|
-
* - DataLab for DataLab styled qomponents (orange)
|
|
24
|
-
*/
|
|
25
|
-
const [theme, setTheme] = React.useState('color_analysis');
|
|
26
|
-
/**
|
|
27
|
-
* qomponents also support dark-mode. To render qomponents using dark-mode wrap your addOn in a div and assign the
|
|
28
|
-
* class "tw-dark" for dark-mode or "tw-light" for light mode.
|
|
29
|
-
*/
|
|
30
|
-
const [mode, setMode] = React.useState('tw-light');
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* This example uses controlled inputs (https://blog.logrocket.com/controlled-vs-uncontrolled-components-in-react/)
|
|
34
|
-
*/
|
|
35
|
-
const [textFieldValue, setTextFieldValue] = React.useState('');
|
|
36
|
-
const [textAreaValue, setTextAreaValue] = React.useState('');
|
|
37
|
-
const [selectValue, setSelectValue] = React.useState();
|
|
38
|
-
const [complexSelectedValue, setComplexSelectedValue] = React.useState<SelectOption>();
|
|
39
|
-
const [display, setDisplay] = React.useState('');
|
|
40
|
-
const [easeOfUse, setEaseOfUse] = React.useState(false);
|
|
41
|
-
const [lookAndFeel, setLookAndFeel] = React.useState(false);
|
|
42
|
-
const [speed, setSpeed] = React.useState(false);
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
// outer-wrapper div that assigns the mode (dark-mode or light) as well as the theme
|
|
46
|
-
<div className={`backdrop ${mode} ${theme}`}>
|
|
47
|
-
{/*add the QTip component at the very top level or your application to ensure your tooltips display as expected!*/}
|
|
48
|
-
<QTip />
|
|
49
|
-
<div className="flex-container">
|
|
50
|
-
<div className="scroll-container">
|
|
51
|
-
<div className="header">qomponents - form example</div>
|
|
52
|
-
<div>Use this example to see qomponents in actions.</div>
|
|
53
|
-
No libraries other than Seeq's qomponents (and of course React) are used to create this example, however
|
|
54
|
-
minimal CSS is used to create an appealing form - you can find all that CSS in index.css.
|
|
55
|
-
<p className="mb-10">
|
|
56
|
-
<b>A note on CSS:</b> Seeq's qomponents come fully styled and ready to use. While it is tempting to use the
|
|
57
|
-
available <i>extraClassNames</i> property to provide yet additional styling we strongly advise you to use
|
|
58
|
-
this property to provide only width, margins and padding. This will ensure for a smooth upgrade experience
|
|
59
|
-
when Seeq's look and feel changes. <br />
|
|
60
|
-
Tip: to indicate missing or wrong user input use the <i>showError</i> property available on TextField,
|
|
61
|
-
TextArea, as well as Select.
|
|
62
|
-
</p>
|
|
63
|
-
<p className="mb-10">
|
|
64
|
-
Using FontAwesome? You can pass FontAwesome Icons to the qomponent Icon component
|
|
65
|
-
<Icon icon="fa-regular fa-face-smile" extraClassNames="ml-10" />
|
|
66
|
-
</p>
|
|
67
|
-
<div className="mb-10">
|
|
68
|
-
<a
|
|
69
|
-
href="#"
|
|
70
|
-
onClick={() => setMode(mode === 'tw-light' ? 'tw-dark' : 'tw-light')}
|
|
71
|
-
// this is how you display a q-tip for an element that doesn't come with an "out-of the box" tooltip
|
|
72
|
-
// property:
|
|
73
|
-
data-qtip-text="Toggle Dark/Light Mode."
|
|
74
|
-
// the position is optional and defaults to top
|
|
75
|
-
data-qtip-position="bottom">
|
|
76
|
-
<Icon icon="fc-sun" extraClassNames="mr-10" />
|
|
77
|
-
Click to toggle to {mode === 'tw-light' ? 'Dark Mode' : 'Light Mode'}
|
|
78
|
-
</a>
|
|
79
|
-
</div>
|
|
80
|
-
<div className="formRow">
|
|
81
|
-
<div className="labelWidth">Select theme:</div>
|
|
82
|
-
{availableThemes.map((t) => (
|
|
83
|
-
<Checkbox
|
|
84
|
-
type="radio"
|
|
85
|
-
checked={theme === t.value}
|
|
86
|
-
value={t.value}
|
|
87
|
-
label={t.display}
|
|
88
|
-
onChange={(e) => setTheme(e.target.value)}
|
|
89
|
-
extraClassNames="mr-10"
|
|
90
|
-
/>
|
|
91
|
-
))}
|
|
92
|
-
</div>
|
|
93
|
-
<div className="formRow">
|
|
94
|
-
<div className="labelWidth">AddOn Name</div>
|
|
95
|
-
<TextField
|
|
96
|
-
placeholder="you must enter a name"
|
|
97
|
-
extraClassNames="formElementWidth"
|
|
98
|
-
value={textFieldValue}
|
|
99
|
-
showError={textFieldValue === ''}
|
|
100
|
-
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setTextFieldValue(e.target.value)}
|
|
101
|
-
/>
|
|
102
|
-
</div>
|
|
103
|
-
<div className="formRow">
|
|
104
|
-
<div className="labelWidth">Description</div>
|
|
105
|
-
<TextArea
|
|
106
|
-
value={textAreaValue}
|
|
107
|
-
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setTextAreaValue(e.target.value)}
|
|
108
|
-
extraClassNames="formElementWidth"
|
|
109
|
-
placeholder="provide some text here"
|
|
110
|
-
/>
|
|
111
|
-
</div>
|
|
112
|
-
<div className="formRow">
|
|
113
|
-
<div className="labelWidth">Goals</div>
|
|
114
|
-
<div className="formColumn">
|
|
115
|
-
<div>
|
|
116
|
-
<Checkbox checked={easeOfUse} label="Ease of Use" onChange={() => setEaseOfUse(!easeOfUse)} />
|
|
117
|
-
<Checkbox
|
|
118
|
-
checked={lookAndFeel}
|
|
119
|
-
label="Improved Look & Feel"
|
|
120
|
-
onChange={() => setLookAndFeel(!lookAndFeel)}
|
|
121
|
-
/>
|
|
122
|
-
<Checkbox checked={speed} label="Speedy Development" onChange={() => setSpeed(!speed)} />
|
|
123
|
-
</div>
|
|
124
|
-
</div>
|
|
125
|
-
</div>
|
|
126
|
-
<div className="formRow">
|
|
127
|
-
<div className="labelWidth">Level</div>
|
|
128
|
-
<Select
|
|
129
|
-
value={selectValue}
|
|
130
|
-
extraClassNames="formElementWidth"
|
|
131
|
-
onChange={(selectValue) => setSelectValue(selectValue)}
|
|
132
|
-
options={options}
|
|
133
|
-
placeholder="please choose"
|
|
134
|
-
/>
|
|
135
|
-
</div>
|
|
136
|
-
<div className="formRow">
|
|
137
|
-
<div className="labelWidth">Advanced</div>
|
|
138
|
-
<ComplexSelectExample
|
|
139
|
-
value={complexSelectedValue}
|
|
140
|
-
onChange={(selectedOption: SelectOption) => setComplexSelectedValue(selectedOption)}
|
|
141
|
-
/>
|
|
142
|
-
</div>
|
|
143
|
-
<div className="buttonRow">
|
|
144
|
-
<Button
|
|
145
|
-
label="Cancel"
|
|
146
|
-
onClick={() => {
|
|
147
|
-
setDisplay('cancel');
|
|
148
|
-
}}
|
|
149
|
-
extraClassNames="mr-10"
|
|
150
|
-
/>
|
|
151
|
-
<Button
|
|
152
|
-
label="Submit"
|
|
153
|
-
onClick={() => {
|
|
154
|
-
setDisplay('success');
|
|
155
|
-
}}
|
|
156
|
-
variant="theme"
|
|
157
|
-
/>
|
|
158
|
-
</div>
|
|
159
|
-
{display === 'success' && <div>submit button onClick function was called</div>}
|
|
160
|
-
{display === 'cancel' && <div>cancel button onClick function was called</div>}
|
|
161
|
-
</div>
|
|
162
|
-
</div>
|
|
163
|
-
</div>
|
|
164
|
-
);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export default Example;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button, Checkbox, Icon, QTip, Select, TextArea, TextField } from '@seeqdev/qomponents';
|
|
3
|
+
import ComplexSelectExample, { SelectOption } from './ComplexSelectExample';
|
|
4
|
+
|
|
5
|
+
const availableThemes = [
|
|
6
|
+
{ display: 'Analysis', value: 'color_analysis' },
|
|
7
|
+
{ display: 'Topic', value: 'color_topic' },
|
|
8
|
+
{ display: 'DataLab', value: 'color_datalab' },
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
const options = [
|
|
12
|
+
{ value: '1', label: 'Beginner' },
|
|
13
|
+
{ value: '2', label: 'Advanced' },
|
|
14
|
+
{ value: '3', label: 'Expert' },
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
function Example() {
|
|
18
|
+
/**
|
|
19
|
+
* Theming is supported "out of the box". To apply a theme wrap your addOn in a div and assign the class that
|
|
20
|
+
* matched the desired theme:
|
|
21
|
+
* - color_analysis for Analysis styled qomponents (green)
|
|
22
|
+
* - color_topic for Topic styled qomponents (blue)
|
|
23
|
+
* - DataLab for DataLab styled qomponents (orange)
|
|
24
|
+
*/
|
|
25
|
+
const [theme, setTheme] = React.useState('color_analysis');
|
|
26
|
+
/**
|
|
27
|
+
* qomponents also support dark-mode. To render qomponents using dark-mode wrap your addOn in a div and assign the
|
|
28
|
+
* class "tw-dark" for dark-mode or "tw-light" for light mode.
|
|
29
|
+
*/
|
|
30
|
+
const [mode, setMode] = React.useState('tw-light');
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* This example uses controlled inputs (https://blog.logrocket.com/controlled-vs-uncontrolled-components-in-react/)
|
|
34
|
+
*/
|
|
35
|
+
const [textFieldValue, setTextFieldValue] = React.useState('');
|
|
36
|
+
const [textAreaValue, setTextAreaValue] = React.useState('');
|
|
37
|
+
const [selectValue, setSelectValue] = React.useState();
|
|
38
|
+
const [complexSelectedValue, setComplexSelectedValue] = React.useState<SelectOption>();
|
|
39
|
+
const [display, setDisplay] = React.useState('');
|
|
40
|
+
const [easeOfUse, setEaseOfUse] = React.useState(false);
|
|
41
|
+
const [lookAndFeel, setLookAndFeel] = React.useState(false);
|
|
42
|
+
const [speed, setSpeed] = React.useState(false);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
// outer-wrapper div that assigns the mode (dark-mode or light) as well as the theme
|
|
46
|
+
<div className={`backdrop ${mode} ${theme}`}>
|
|
47
|
+
{/*add the QTip component at the very top level or your application to ensure your tooltips display as expected!*/}
|
|
48
|
+
<QTip />
|
|
49
|
+
<div className="flex-container">
|
|
50
|
+
<div className="scroll-container">
|
|
51
|
+
<div className="header">qomponents - form example</div>
|
|
52
|
+
<div>Use this example to see qomponents in actions.</div>
|
|
53
|
+
No libraries other than Seeq's qomponents (and of course React) are used to create this example, however
|
|
54
|
+
minimal CSS is used to create an appealing form - you can find all that CSS in index.css.
|
|
55
|
+
<p className="mb-10">
|
|
56
|
+
<b>A note on CSS:</b> Seeq's qomponents come fully styled and ready to use. While it is tempting to use the
|
|
57
|
+
available <i>extraClassNames</i> property to provide yet additional styling we strongly advise you to use
|
|
58
|
+
this property to provide only width, margins and padding. This will ensure for a smooth upgrade experience
|
|
59
|
+
when Seeq's look and feel changes. <br />
|
|
60
|
+
Tip: to indicate missing or wrong user input use the <i>showError</i> property available on TextField,
|
|
61
|
+
TextArea, as well as Select.
|
|
62
|
+
</p>
|
|
63
|
+
<p className="mb-10">
|
|
64
|
+
Using FontAwesome? You can pass FontAwesome Icons to the qomponent Icon component
|
|
65
|
+
<Icon icon="fa-regular fa-face-smile" extraClassNames="ml-10" />
|
|
66
|
+
</p>
|
|
67
|
+
<div className="mb-10">
|
|
68
|
+
<a
|
|
69
|
+
href="#"
|
|
70
|
+
onClick={() => setMode(mode === 'tw-light' ? 'tw-dark' : 'tw-light')}
|
|
71
|
+
// this is how you display a q-tip for an element that doesn't come with an "out-of the box" tooltip
|
|
72
|
+
// property:
|
|
73
|
+
data-qtip-text="Toggle Dark/Light Mode."
|
|
74
|
+
// the position is optional and defaults to top
|
|
75
|
+
data-qtip-position="bottom">
|
|
76
|
+
<Icon icon="fc-sun" extraClassNames="mr-10" />
|
|
77
|
+
Click to toggle to {mode === 'tw-light' ? 'Dark Mode' : 'Light Mode'}
|
|
78
|
+
</a>
|
|
79
|
+
</div>
|
|
80
|
+
<div className="formRow">
|
|
81
|
+
<div className="labelWidth">Select theme:</div>
|
|
82
|
+
{availableThemes.map((t) => (
|
|
83
|
+
<Checkbox
|
|
84
|
+
type="radio"
|
|
85
|
+
checked={theme === t.value}
|
|
86
|
+
value={t.value}
|
|
87
|
+
label={t.display}
|
|
88
|
+
onChange={(e) => setTheme(e.target.value)}
|
|
89
|
+
extraClassNames="mr-10"
|
|
90
|
+
/>
|
|
91
|
+
))}
|
|
92
|
+
</div>
|
|
93
|
+
<div className="formRow">
|
|
94
|
+
<div className="labelWidth">AddOn Name</div>
|
|
95
|
+
<TextField
|
|
96
|
+
placeholder="you must enter a name"
|
|
97
|
+
extraClassNames="formElementWidth"
|
|
98
|
+
value={textFieldValue}
|
|
99
|
+
showError={textFieldValue === ''}
|
|
100
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setTextFieldValue(e.target.value)}
|
|
101
|
+
/>
|
|
102
|
+
</div>
|
|
103
|
+
<div className="formRow">
|
|
104
|
+
<div className="labelWidth">Description</div>
|
|
105
|
+
<TextArea
|
|
106
|
+
value={textAreaValue}
|
|
107
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setTextAreaValue(e.target.value)}
|
|
108
|
+
extraClassNames="formElementWidth"
|
|
109
|
+
placeholder="provide some text here"
|
|
110
|
+
/>
|
|
111
|
+
</div>
|
|
112
|
+
<div className="formRow">
|
|
113
|
+
<div className="labelWidth">Goals</div>
|
|
114
|
+
<div className="formColumn">
|
|
115
|
+
<div>
|
|
116
|
+
<Checkbox checked={easeOfUse} label="Ease of Use" onChange={() => setEaseOfUse(!easeOfUse)} />
|
|
117
|
+
<Checkbox
|
|
118
|
+
checked={lookAndFeel}
|
|
119
|
+
label="Improved Look & Feel"
|
|
120
|
+
onChange={() => setLookAndFeel(!lookAndFeel)}
|
|
121
|
+
/>
|
|
122
|
+
<Checkbox checked={speed} label="Speedy Development" onChange={() => setSpeed(!speed)} />
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
<div className="formRow">
|
|
127
|
+
<div className="labelWidth">Level</div>
|
|
128
|
+
<Select
|
|
129
|
+
value={selectValue}
|
|
130
|
+
extraClassNames="formElementWidth"
|
|
131
|
+
onChange={(selectValue) => setSelectValue(selectValue)}
|
|
132
|
+
options={options}
|
|
133
|
+
placeholder="please choose"
|
|
134
|
+
/>
|
|
135
|
+
</div>
|
|
136
|
+
<div className="formRow">
|
|
137
|
+
<div className="labelWidth">Advanced</div>
|
|
138
|
+
<ComplexSelectExample
|
|
139
|
+
value={complexSelectedValue}
|
|
140
|
+
onChange={(selectedOption: SelectOption) => setComplexSelectedValue(selectedOption)}
|
|
141
|
+
/>
|
|
142
|
+
</div>
|
|
143
|
+
<div className="buttonRow">
|
|
144
|
+
<Button
|
|
145
|
+
label="Cancel"
|
|
146
|
+
onClick={() => {
|
|
147
|
+
setDisplay('cancel');
|
|
148
|
+
}}
|
|
149
|
+
extraClassNames="mr-10"
|
|
150
|
+
/>
|
|
151
|
+
<Button
|
|
152
|
+
label="Submit"
|
|
153
|
+
onClick={() => {
|
|
154
|
+
setDisplay('success');
|
|
155
|
+
}}
|
|
156
|
+
variant="theme"
|
|
157
|
+
/>
|
|
158
|
+
</div>
|
|
159
|
+
{display === 'success' && <div>submit button onClick function was called</div>}
|
|
160
|
+
{display === 'cancel' && <div>cancel button onClick function was called</div>}
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export default Example;
|