@seeqdev/qomponents 0.0.1 → 0.0.3
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 +33 -13
- package/dist/Checkbox/Checkbox.d.ts +7 -0
- package/dist/Checkbox/Checkbox.stories.d.ts +5 -0
- package/dist/Checkbox/Checkbox.test.d.ts +1 -0
- package/dist/Checkbox/Checkbox.types.d.ts +15 -0
- package/dist/Checkbox/index.d.ts +1 -0
- package/dist/TextArea/TextArea.d.ts +7 -0
- package/dist/TextArea/TextArea.stories.d.ts +5 -0
- package/dist/TextArea/TextArea.test.d.ts +1 -0
- package/dist/TextArea/TextArea.types.d.ts +26 -0
- package/dist/TextArea/index.d.ts +1 -0
- package/dist/TextField/TextField.types.d.ts +0 -2
- package/dist/index.d.ts +6 -0
- package/dist/index.esm.js +93 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +95 -13
- package/dist/index.js.map +1 -1
- package/dist/sharedTypes.d.ts +1 -0
- package/dist/styles.css +271 -0
- package/package.json +2 -1
- package/dist/Button/Button.js +0 -44
- package/dist/Button/Button.js.map +0 -1
- package/dist/Button/Button.stories.js +0 -49
- package/dist/Button/Button.stories.js.map +0 -1
- package/dist/Button/Button.test.js +0 -49
- package/dist/Button/Button.test.js.map +0 -1
- package/dist/Button/Button.types.js +0 -4
- package/dist/Button/Button.types.js.map +0 -1
- package/dist/Button/index.js +0 -2
- package/dist/Button/index.js.map +0 -1
- package/dist/Icon/Icon.js +0 -38
- package/dist/Icon/Icon.js.map +0 -1
- package/dist/Icon/Icon.stories.js +0 -35
- package/dist/Icon/Icon.stories.js.map +0 -1
- package/dist/Icon/Icon.test.js +0 -55
- package/dist/Icon/Icon.test.js.map +0 -1
- package/dist/Icon/Icon.types.js +0 -16
- package/dist/Icon/Icon.types.js.map +0 -1
- package/dist/Icon/index.js +0 -2
- package/dist/Icon/index.js.map +0 -1
- package/dist/TextField/TextField.js +0 -45
- package/dist/TextField/TextField.js.map +0 -1
- package/dist/TextField/TextField.stories.js +0 -25
- package/dist/TextField/TextField.stories.js.map +0 -1
- package/dist/TextField/TextField.test.js +0 -35
- package/dist/TextField/TextField.test.js.map +0 -1
- package/dist/TextField/TextField.types.js +0 -2
- package/dist/TextField/TextField.types.js.map +0 -1
- package/dist/TextField/index.js +0 -2
- package/dist/TextField/index.js.map +0 -1
- package/dist/Tooltip/Tooltip.js +0 -30
- package/dist/Tooltip/Tooltip.js.map +0 -1
- package/dist/Tooltip/Tooltip.stories.js +0 -32
- package/dist/Tooltip/Tooltip.stories.js.map +0 -1
- package/dist/Tooltip/Tooltip.types.js +0 -3
- package/dist/Tooltip/Tooltip.types.js.map +0 -1
- package/dist/Tooltip/index.js +0 -2
- package/dist/Tooltip/index.js.map +0 -1
- package/dist/utils/browserId.js +0 -29
- package/dist/utils/browserId.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,28 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- markdownlint-disable-next-line -->
|
|
2
|
+
<p align="center">
|
|
3
|
+
<img width="150" src="https://seeq.com/sites/default/files/seeq-content/seeq-logo-blue-web-33h.svg" alt="Seeq logo">
|
|
4
|
+
</p>
|
|
5
|
+
<h1 align="center">qomponents</h1>
|
|
2
6
|
|
|
3
|
-
## Development
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
Seeq qomponents are a collection of UI components, including a Button, a TextField, an Icon, as well as a Tooltip
|
|
9
|
+
React component (more coming soon!)
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
These components are used by Seeq's application and are made publicly available for Developers who want to expand
|
|
12
|
+
the Seeq eco-system with their own plugins and add-ons without having to worry about creating a cohesive Seeq UX
|
|
13
|
+
experience. Every component comes fully styled (and with dark mode support).
|
|
8
14
|
|
|
9
|
-
|
|
10
|
-
npm run dev
|
|
11
|
-
```
|
|
15
|
+
## Installation
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
Seeq qomponents are available on npm.
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
**npm:**
|
|
16
20
|
|
|
21
|
+
```sh
|
|
22
|
+
npm install @seeqdev/qomponents
|
|
17
23
|
```
|
|
18
|
-
|
|
24
|
+
|
|
25
|
+
**yarn:**
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
yarn add @seeqdev/qomponents
|
|
19
29
|
```
|
|
20
30
|
|
|
21
|
-
|
|
31
|
+
## Getting started with Seeq qomponents
|
|
22
32
|
|
|
23
|
-
|
|
33
|
+
Here is an example of a basic app using the `Button` component:
|
|
24
34
|
|
|
25
|
-
|
|
35
|
+
```jsx
|
|
36
|
+
import * as React from 'react';
|
|
37
|
+
import {Button} from '@seeqdev/qomponents';
|
|
26
38
|
|
|
39
|
+
function App() {
|
|
40
|
+
return <Button variant="theme" label="Seeq Rocks" />;
|
|
41
|
+
}
|
|
42
|
+
```
|
|
27
43
|
|
|
44
|
+
To make sure all styles are properly applied be sure to inclue the qomponents css file in your main css file.
|
|
28
45
|
|
|
46
|
+
```css
|
|
47
|
+
@import '@seeqdev/qomponents/dist/styles.css';
|
|
48
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface CheckboxProps {
|
|
2
|
+
extraClassNames?: string;
|
|
3
|
+
extraLabelClassNames?: string;
|
|
4
|
+
type?: 'radio' | 'checkbox';
|
|
5
|
+
id?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
checked: boolean;
|
|
8
|
+
value?: string | number;
|
|
9
|
+
label?: string | React.ReactNode;
|
|
10
|
+
onChange?: React.ChangeEventHandler<FormControlElement>;
|
|
11
|
+
onKeyDown?: React.KeyboardEventHandler<FormControlElement>;
|
|
12
|
+
onClick?: React.MouseEventHandler<FormControlElement>;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
testId?: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Checkbox as default } from './Checkbox';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface TextAreaProps {
|
|
2
|
+
/** extra class names to be placed on the TextArea component */
|
|
3
|
+
extraClassNames?: string;
|
|
4
|
+
/** id of TextArea */
|
|
5
|
+
id?: string;
|
|
6
|
+
/** name of TextArea */
|
|
7
|
+
name?: string;
|
|
8
|
+
/** function that will be called when TextArea value changes */
|
|
9
|
+
onChange?: React.ChangeEventHandler<FormControlElement>;
|
|
10
|
+
/** function that will be called on key up within the TextArea */
|
|
11
|
+
onKeyUp?: React.KeyboardEventHandler<FormControlElement>;
|
|
12
|
+
/** placeholder text displayed when TextArea is empty */
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
/** set readonly to true if TextArea can not be edited */
|
|
15
|
+
readonly?: boolean;
|
|
16
|
+
/** specifies the visible number of lines in the TextArea */
|
|
17
|
+
rows?: number;
|
|
18
|
+
/** specifies the visible width of the TextArea */
|
|
19
|
+
cols?: number;
|
|
20
|
+
/** set this to true to focus the TextArea when page loads */
|
|
21
|
+
autofocus?: boolean;
|
|
22
|
+
/** id that will be used in the data-testid attribute on the TextArea */
|
|
23
|
+
testId?: string;
|
|
24
|
+
/** value of the TextArea */
|
|
25
|
+
value?: string | string[] | number;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TextArea as default } from './TextArea';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
declare type FormControlElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
|
|
2
1
|
export interface TextFieldProps {
|
|
3
2
|
readonly?: boolean;
|
|
4
3
|
onChange?: React.ChangeEventHandler<FormControlElement>;
|
|
@@ -13,4 +12,3 @@ export interface TextFieldProps {
|
|
|
13
12
|
testId?: string;
|
|
14
13
|
ref?: any;
|
|
15
14
|
}
|
|
16
|
-
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import Button from './Button';
|
|
2
2
|
import TextField from './TextField';
|
|
3
|
+
import Checkbox from './Checkbox';
|
|
4
|
+
import TextArea from './TextArea';
|
|
3
5
|
import Tooltip from './Tooltip';
|
|
6
|
+
import Icon from './Icon';
|
|
4
7
|
export { Button };
|
|
5
8
|
export { TextField };
|
|
9
|
+
export { TextArea };
|
|
6
10
|
export { Tooltip };
|
|
11
|
+
export { Checkbox };
|
|
12
|
+
export { Icon };
|
package/dist/index.esm.js
CHANGED
|
@@ -69,7 +69,7 @@ const Icon = ({ onClick, icon, type = 'theme', extraClassNames, id, large, small
|
|
|
69
69
|
: 'Icon with prop color must have type="color".';
|
|
70
70
|
return React.createElement("div", { className: "tw-text-sq-danger-color" }, errorMessage);
|
|
71
71
|
}
|
|
72
|
-
const
|
|
72
|
+
const colorClassesThemeLight = {
|
|
73
73
|
'theme': 'tw-text-sq-color-dark',
|
|
74
74
|
'white': 'tw-text-white',
|
|
75
75
|
'dark-gray': 'tw-text-sq-fairly-dark-gray',
|
|
@@ -84,9 +84,25 @@ const Icon = ({ onClick, icon, type = 'theme', extraClassNames, id, large, small
|
|
|
84
84
|
'theme-light': 'tw-text-sq-color-light',
|
|
85
85
|
'success': 'tw-text-sq-success-color',
|
|
86
86
|
};
|
|
87
|
+
const colorClassesThemeDark = {
|
|
88
|
+
'theme': 'dark:tw-text-sq-color-dark-dark',
|
|
89
|
+
'white': '',
|
|
90
|
+
'dark-gray': 'tw-text-sq-fairly-dark-gray',
|
|
91
|
+
'warning': '',
|
|
92
|
+
'darkish-gray': 'tw-text-sq-darkish-gray',
|
|
93
|
+
'gray': 'dark:tw-text-sq-dark-disabled-gray',
|
|
94
|
+
'color': '',
|
|
95
|
+
'info': 'dark:tw-text-sq-link-dark',
|
|
96
|
+
'text': 'dark:tw-text-sq-dark-text',
|
|
97
|
+
'inherit': '',
|
|
98
|
+
'danger': 'tw-text-sq-danger-color',
|
|
99
|
+
'theme-light': 'tw-text-sq-color-light',
|
|
100
|
+
'success': 'tw-text-sq-success-color',
|
|
101
|
+
};
|
|
87
102
|
const iconPrefix = icon.startsWith('fc') ? 'fc' : 'fa';
|
|
88
103
|
const style = type === 'color' && color ? { color } : {};
|
|
89
|
-
const appliedClassNames = `${iconPrefix} ${icon} ${small ? 'fa-sm' : ''} ${large ? 'fa-lg' : ''}
|
|
104
|
+
const appliedClassNames = `${iconPrefix} ${icon} ${small ? 'fa-sm' : ''} ${large ? 'fa-lg' : ''}
|
|
105
|
+
${colorClassesThemeLight[type]} ${colorClassesThemeDark[type]} ${onClick ? 'cursor-pointer' : ''} ${extraClassNames}`;
|
|
90
106
|
const iconTag = (React.createElement("i", { className: appliedClassNames, style: style, onClick: onClick, "data-testid": testId, "data-customid": customId, id: id, "data-number": number }));
|
|
91
107
|
return !hasExternalTooltipHandler && tooltip && tooltip !== '' ? (React.createElement(Tooltip, { text: tooltip, delay: tooltipDelay, position: tooltipPlacement }, iconTag)) : (iconTag);
|
|
92
108
|
};
|
|
@@ -98,7 +114,15 @@ const Icon = ({ onClick, icon, type = 'theme', extraClassNames, id, large, small
|
|
|
98
114
|
*/
|
|
99
115
|
const Button = ({ onClick, label, variant = 'outline', type = 'button', size = 'sm', disabled, extraClassNames, id, testId, stopPropagation = true, tooltip, tooltipOptions, iconStyle = 'text', icon, iconColor, }) => {
|
|
100
116
|
const baseClasses = 'tw-py-1 tw-px-2.5 tw-rounded-sm focus:tw-ring-0 disabled:tw-pointer-events-none';
|
|
101
|
-
const
|
|
117
|
+
const baseClassesByVariant = {
|
|
118
|
+
'outline': 'tw-border-solid tw-border',
|
|
119
|
+
'theme': 'disabled:tw-bg-opacity-50',
|
|
120
|
+
'danger': 'tw-bg-sq-danger-color hover:tw-bg-sq-danger-color-hover disabled:tw-bg-opacity-50',
|
|
121
|
+
'theme-light': 'disabled:tw-bg-opacity-50',
|
|
122
|
+
'no-border': '',
|
|
123
|
+
'warning': 'tw-bg-sq-warning-color',
|
|
124
|
+
};
|
|
125
|
+
const textClassesByVariantLightTheme = {
|
|
102
126
|
'outline': 'tw-text-sq-text-color',
|
|
103
127
|
'theme': 'tw-text-white',
|
|
104
128
|
'theme-light': 'tw-text-white',
|
|
@@ -106,25 +130,44 @@ const Button = ({ onClick, label, variant = 'outline', type = 'button', size = '
|
|
|
106
130
|
'no-border': 'tw-text-sq-text-color',
|
|
107
131
|
'warning': 'tw-text-white',
|
|
108
132
|
};
|
|
109
|
-
const
|
|
110
|
-
'outline': '
|
|
133
|
+
const textClassesByVariantDarkTheme = {
|
|
134
|
+
'outline': 'dark:tw-text-sq-dark-text',
|
|
135
|
+
'theme': 'dark:tw-text-white',
|
|
136
|
+
'theme-light': 'dark:tw-text-white',
|
|
137
|
+
'danger': 'dark:tw-text-white',
|
|
138
|
+
'no-border': 'dark:tw-text-sq-dark-text',
|
|
139
|
+
'warning': 'dark:tw-text-white',
|
|
140
|
+
};
|
|
141
|
+
const classesByVariantLightTheme = {
|
|
142
|
+
'outline': 'tw-border-sq-disabled-gray hover:tw-bg-sq-light-gray' +
|
|
111
143
|
' focus:tw-bg-sq-dark-gray active:tw-bg-sq-dark-gray focus:tw-border-sq-color-dark active:tw-border-sq-color-dark',
|
|
112
|
-
'theme': 'tw-bg-sq-color-dark hover:tw-bg-sq-color-highlight
|
|
113
|
-
'danger': '
|
|
114
|
-
'theme-light': 'tw-bg-sq-icon hover:tw-bg-sq-link
|
|
144
|
+
'theme': 'tw-bg-sq-color-dark hover:tw-bg-sq-color-highlight',
|
|
145
|
+
'danger': '',
|
|
146
|
+
'theme-light': 'tw-bg-sq-icon hover:tw-bg-sq-link',
|
|
115
147
|
'no-border': '',
|
|
116
148
|
'warning': 'tw-bg-sq-warning-color',
|
|
117
149
|
};
|
|
150
|
+
const classesByVariantDarkTheme = {
|
|
151
|
+
'outline': 'dark:tw-border-sq-dark-disabled-gray dark:hover:tw-bg-sq-highlight-color-dark' +
|
|
152
|
+
' dark:focus:tw-bg-sq-dark-gray dark:active:tw-bg-sq-dark-gray dark:focus:tw-border-sq-color-dark' +
|
|
153
|
+
' dark:active:tw-border-sq-color-dark',
|
|
154
|
+
'theme': 'dark:tw-bg-sq-color-dark dark:hover:tw-bg-sq-color-highlight',
|
|
155
|
+
'danger': '',
|
|
156
|
+
'theme-light': 'dark:tw-bg-sq-icon-dark dark:hover:tw-bg-sq-link-dark',
|
|
157
|
+
'no-border': '',
|
|
158
|
+
'warning': '',
|
|
159
|
+
};
|
|
118
160
|
const sizeClasses = {
|
|
119
161
|
sm: 'tw-text-sm',
|
|
120
162
|
lg: 'tw-text-xl',
|
|
121
163
|
};
|
|
122
|
-
const appliedClasses = `${baseClasses} ${sizeClasses[size]} ${
|
|
164
|
+
const appliedClasses = `${baseClasses} ${baseClassesByVariant[variant]} ${sizeClasses[size]} ${classesByVariantLightTheme[variant]} ${classesByVariantDarkTheme[variant]} ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]} ${extraClassNames}`;
|
|
123
165
|
const button = (React.createElement("button", { id: id, disabled: disabled, "data-testid": testId, type: type === 'link' || (type === 'submit' && browserIsFirefox) ? 'button' : type, onClick: (e) => {
|
|
124
166
|
stopPropagation && e.stopPropagation();
|
|
125
167
|
onClick && onClick();
|
|
126
168
|
}, className: appliedClasses },
|
|
127
|
-
icon && (React.createElement(Icon, { icon: icon, type: iconStyle, color: iconColor, extraClassNames: label ?
|
|
169
|
+
icon && (React.createElement(Icon, { icon: icon, type: iconStyle, color: iconColor, extraClassNames: label ?
|
|
170
|
+
`tw-mr-1 ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]}` : '', testId: `${id}_spinner` })),
|
|
128
171
|
label));
|
|
129
172
|
return tooltip ? (React.createElement(Tooltip, { text: tooltip, ...tooltipOptions }, button)) : (button);
|
|
130
173
|
};
|
|
@@ -162,15 +205,51 @@ const TextField = React.forwardRef((props, ref) => {
|
|
|
162
205
|
}
|
|
163
206
|
}, [value]);
|
|
164
207
|
const baseClasses = 'tw-height-34 tw-leading-normal tw-outline-none tw-py-1 tw-px-3 tw-rounded-sm disabled:tw-pointer-events-none' +
|
|
165
|
-
' disabled:tw-cursor-not-allowed tw-p-1 tw-border-
|
|
166
|
-
|
|
208
|
+
' disabled:tw-cursor-not-allowed tw-p-1 tw-border-solid tw-border';
|
|
209
|
+
const darkTheme = 'dark:tw-border-sq-dark-disabled-gray dark:tw-bg-sq-dark-background dark:tw-text-sq-dark-text' +
|
|
210
|
+
' dark:focus:tw-border-sq-color-dark-dark dark:active:tw-border-sq-color-dark-dark';
|
|
211
|
+
const lightTheme = 'tw-border-sq-disabled-gray tw-text-sq-text-color focus:tw-border-sq-color-dark active:tw-border-sq-color-dark';
|
|
167
212
|
const sizeClasses = {
|
|
168
213
|
sm: 'tw-text-sm',
|
|
169
214
|
lg: 'tw-text-xl',
|
|
170
215
|
};
|
|
171
|
-
const appliedClasses = `${baseClasses} ${sizeClasses[size]} ${extraClassNames}`;
|
|
216
|
+
const appliedClasses = `${baseClasses} ${sizeClasses[size]} ${extraClassNames} ${lightTheme} ${darkTheme}`;
|
|
172
217
|
return (React.createElement("input", { ref: setAllRefs, "data-testid": testId, name: name, id: id, type: type, value: value, className: appliedClasses, placeholder: placeholder, disabled: readonly, autoComplete: "none", onChange: handleChange, onKeyUp: onKeyUp }));
|
|
173
218
|
});
|
|
174
219
|
|
|
175
|
-
|
|
220
|
+
const alignment = 'tw-flex tw-items-center';
|
|
221
|
+
const labelClasses = 'tw-ml-1.5 tw-text-sm';
|
|
222
|
+
const baseClasses$1 = 'tw-border-1 tw-h-3.5 tw-w-3.5 focus:tw-ring-0 focus:tw-ring-offset-0 tw-outline-none focus:tw-outline-none' +
|
|
223
|
+
' dark:tw-bg-sq-dark-background dark:tw-border-sq-dark-text dark:checked:tw-bg-sq-dark-text' +
|
|
224
|
+
' checked:tw-text-sq-text-color' +
|
|
225
|
+
' disabled:tw-text-sq-fairly-dark-gray';
|
|
226
|
+
const checkboxClasses = `tw-form-checkbox tw-rounded ${baseClasses$1}`;
|
|
227
|
+
const radioClasses = `tw-form-radio ${baseClasses$1}`;
|
|
228
|
+
/**
|
|
229
|
+
* Checkbox and Radio Box Component.
|
|
230
|
+
*/
|
|
231
|
+
const Checkbox = (props) => {
|
|
232
|
+
const { type = 'checkbox', value, disabled = false, label, onChange, onClick, onKeyDown, checked, id, name, extraClassNames, extraLabelClassNames, testId, } = props;
|
|
233
|
+
const assignedId = id ?? 'checkbox_' + Math.random();
|
|
234
|
+
return (React.createElement("span", { className: `${alignment} ${extraClassNames}` },
|
|
235
|
+
React.createElement("input", { value: value, type: type, "data-testid": testId, name: name, id: assignedId, checked: checked, className: `${type === 'checkbox' ? checkboxClasses : radioClasses} ${disabled ? 'tw-cursor-not-allowed' : 'tw-cursor-pointer'}`, disabled: disabled, onClick: onClick, onChange: onChange, onKeyDown: onKeyDown }),
|
|
236
|
+
React.createElement("label", { htmlFor: assignedId, className: `${labelClasses} ${extraLabelClassNames} ${disabled
|
|
237
|
+
? 'tw-cursor-not-allowed dark:tw-text-sq-fairly-dark-gray tw-text-sq-fairly-dark-gray'
|
|
238
|
+
: 'tw-cursor-pointer tw-text-sq-text-color dark:tw-text-sq-dark-text'}` }, label)));
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
const baseClasses = 'tw-leading-normal tw-outline-none tw-py-1 tw-px-3 tw-rounded-sm' +
|
|
242
|
+
' disabled:tw-cursor-not-allowed tw-p-1 tw-border-solid tw-border';
|
|
243
|
+
const darkTheme = 'dark:tw-border-sq-dark-disabled-gray dark:tw-bg-sq-dark-background dark:tw-text-sq-dark-text' +
|
|
244
|
+
' dark:focus:tw-border-sq-color-dark-dark dark:active:tw-border-sq-color-dark-dark';
|
|
245
|
+
const lightTheme = 'tw-border-sq-disabled-gray tw-text-sq-text-color focus:tw-border-sq-color-dark active:tw-border-sq-color-dark';
|
|
246
|
+
/**
|
|
247
|
+
* TextArea.
|
|
248
|
+
*/
|
|
249
|
+
const TextArea = ({ readonly = false, onChange, onKeyUp, id, name, rows = 3, cols = undefined, value, placeholder, extraClassNames, testId, autofocus = false, }) => {
|
|
250
|
+
const appliedClasses = `${baseClasses} ${extraClassNames} ${lightTheme} ${darkTheme}`;
|
|
251
|
+
return (React.createElement("textarea", { "data-testid": testId, name: name, id: id, value: value, className: appliedClasses, placeholder: placeholder, disabled: readonly, onChange: onChange, onKeyUp: onKeyUp, rows: rows, cols: cols, autoFocus: autofocus }));
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
export { Button, Checkbox, Icon, TextArea, TextField, Tooltip };
|
|
176
255
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/utils/browserId.ts","../src/Tooltip/Tooltip.types.ts","../src/Tooltip/Tooltip.tsx","../src/Icon/Icon.tsx","../src/Button/Button.tsx","../src/TextField/TextField.tsx"],"sourcesContent":["/**\n * @exports the browser id (i.e., 'IE 11' 'Chrome 90')\n * @see http://stackoverflow.com/questions/2400935/browser-detection-in-javascript\n */\nexport const browserId: string = (function () {\n let tem;\n const ua = navigator.userAgent;\n let M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\\/))\\/?\\s*(\\d+)/i) || [];\n if (/trident/i.test(M[1])) {\n tem = /\\brv[ :]+(\\d+)/g.exec(ua) || [];\n return `IE ${tem[1] || ''}`;\n }\n\n if (M[1] === 'Chrome') {\n tem = ua.match(/\\b(OPR|Edge?)\\/(\\d+)/);\n if (tem !== null) {\n return tem.slice(1).join(' ').replace('OPR', 'Opera').replace('Edg ', 'Edge ');\n }\n }\n\n M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];\n if ((tem = ua.match(/version\\/(\\d+)/i)) !== null) {\n M.splice(1, 1, tem[1]);\n }\n\n return M.join(' ');\n})();\nexport const browserName = browserId && browserId.split(' ', 2)[0];\nexport const browserVersion = browserId && parseInt(browserId.split(' ', 2)[1], 10);\nexport const browserIsFirefox = browserId && browserName === 'Firefox';\nexport const browserIsEdgeBeforeChromium =\n browserName && browserVersion && browserName === 'Edge' && browserVersion < 70;\n","export const DEFAULT_TOOL_TIP_DELAY = 1000;\nexport const tooltipPositions = ['top', 'left', 'right', 'bottom'] as const;\n\nexport type TooltipPosition = typeof tooltipPositions[number];\n\nexport interface TooltipProps {\n position?: TooltipPosition;\n children?: JSX.Element | string;\n text: JSX.Element | string;\n delay?: number;\n}\n","import React from 'react';\nimport '../styles.css';\nimport { DEFAULT_TOOL_TIP_DELAY, TooltipProps } from './Tooltip.types';\n\n/**\n * This component displays a Tooltip for the provided children.\n */\nexport const Tooltip: React.FunctionComponent<TooltipProps> = ({\n position = 'bottom',\n children,\n text,\n delay = DEFAULT_TOOL_TIP_DELAY,\n}) => {\n const arrowBaseClasses = \"before:tw-content-[''] before:tw-absolute before:tw-border-8\";\n const centerArrowVertically = 'before:tw-top-1/2 before:-tw-translate-y-1/2';\n const centerArrowHorizontally = 'before:tw-left-1/2 before:-tw-translate-x-1/2';\n const arrowRight = `${arrowBaseClasses} ${centerArrowVertically} before:tw-right-[100%] before:tw-border-y-transparent \n before:tw-border-l-transparent before:tw-border-r-black`;\n\n const arrowLeft = `${arrowBaseClasses} ${centerArrowVertically} before:tw-left-[100%] before:tw-border-y-transparent\n before:tw-border-l-black before:tw-border-r-transparent`;\n\n const arrowBottom = `${arrowBaseClasses} ${centerArrowHorizontally} before:-tw-top-4 before:tw-border-b-black \n before:tw-border-r-transparent before:tw-border-l-transparent before:tw-border-t-transparent`;\n const arrowTop = `${arrowBaseClasses} ${centerArrowHorizontally} before:-tw-bottom-4 before:tw-border-b-transparent \n before:tw-border-t-black before:tw-border-l-transparent before:tw-border-r-transparent`;\n\n const placements = {\n top: `-tw-top-2 -tw-translate-y-full tw-left-1/2 -tw-translate-x-1/2 ${arrowTop}`,\n left: `-tw-translate-x-full -tw-left-3 -tw-translate-y-1/2 tw-top-1/2 ${arrowLeft}`,\n right: `tw-translate-x-full -tw-right-3 -tw-translate-y-1/2 tw-top-1/2 ${arrowRight}`,\n bottom: `-tw-bottom-2 tw-translate-y-full tw-left-1/2 -tw-translate-x-1/2 ${arrowBottom}`,\n };\n\n return (\n <div className=\"tw-group tw-relative tw-inline-block\">\n {children}\n <div\n className={`tw-z-50 tw-whitespace-nowrap tw-hidden group-hover:tw-inline-block group-hover:tw-delay-[${delay}ms] \n tw-absolute tw-opacity-0 group-hover:tw-opacity-100 tw-rounded tw-bg-black tw-p-2 tw-text-xs tw-text-white ${placements[position]}`}>\n {text}\n </div>\n </div>\n );\n};\n","import React from 'react';\nimport '../styles.css';\nimport { IconProps } from './Icon.types';\nimport Tooltip from '../Tooltip';\n\n/**\n * Icon:\n * - access to Seeq custom icons by providing the desired icon\n * - leverage \"type\" to style your icon\n */\nconst Icon: React.FunctionComponent<IconProps> = ({\n onClick,\n icon,\n type = 'theme',\n extraClassNames,\n id,\n large,\n small,\n color,\n testId,\n customId,\n tooltip,\n tooltipDelay,\n tooltipPlacement,\n number,\n hasExternalTooltipHandler = false,\n}) => {\n if ((type === 'color' && (color === undefined || color === '')) || (color && type !== 'color')) {\n const errorMessage =\n color === undefined || color === ''\n ? 'Icon with type=\"color\" must have prop color specified.'\n : 'Icon with prop color must have type=\"color\".';\n return <div className=\"tw-text-sq-danger-color\">{errorMessage}</div>;\n }\n\n const colorClasses = {\n 'theme': 'tw-text-sq-color-dark',\n 'white': 'tw-text-white',\n 'dark-gray': 'tw-text-sq-fairly-dark-gray',\n 'warning': 'tw-text-sq-warning-color',\n 'darkish-gray': 'tw-text-sq-darkish-gray',\n 'gray': 'tw-text-sq-disabled-gray',\n 'color': '',\n 'info': 'tw-text-sq-link',\n 'text': 'tw-text-sq-text-color',\n 'inherit': '',\n 'danger': 'tw-text-sq-danger-color',\n 'theme-light': 'tw-text-sq-color-light',\n 'success': 'tw-text-sq-success-color',\n };\n\n const iconPrefix = icon.startsWith('fc') ? 'fc' : 'fa';\n const style = type === 'color' && color ? { color } : {};\n const appliedClassNames = `${iconPrefix} ${icon} ${small ? 'fa-sm' : ''} ${large ? 'fa-lg' : ''} ${\n colorClasses[type]\n } ${onClick ? 'cursor-pointer' : ''} ${extraClassNames}`;\n\n const iconTag = (\n <i\n className={appliedClassNames}\n style={style}\n onClick={onClick}\n data-testid={testId}\n data-customid={customId}\n id={id}\n data-number={number}\n />\n );\n\n return !hasExternalTooltipHandler && tooltip && tooltip !== '' ? (\n <Tooltip text={tooltip} delay={tooltipDelay} position={tooltipPlacement}>\n {iconTag}\n </Tooltip>\n ) : (\n iconTag\n );\n};\nexport default Icon;\n","import React from 'react';\nimport { ButtonProps } from './Button.types';\nimport '../styles.css';\nimport { browserIsFirefox } from '../utils/browserId';\nimport Tooltip from '../Tooltip';\nimport Icon from '../Icon';\n\n/**\n * All-in-one Button:\n * - use \"variant\" to achieve the desired style\n * - include tooltips and/or icons\n */\nconst Button: React.FunctionComponent<ButtonProps> = ({\n onClick,\n label,\n variant = 'outline',\n type = 'button',\n size = 'sm',\n disabled,\n extraClassNames,\n id,\n testId,\n stopPropagation = true,\n tooltip,\n tooltipOptions,\n iconStyle = 'text',\n icon,\n iconColor,\n}) => {\n const baseClasses = 'tw-py-1 tw-px-2.5 tw-rounded-sm focus:tw-ring-0 disabled:tw-pointer-events-none';\n const textClassesByVariant = {\n 'outline': 'tw-text-sq-text-color',\n 'theme': 'tw-text-white',\n 'theme-light': 'tw-text-white',\n 'danger': 'tw-text-white',\n 'no-border': 'tw-text-sq-text-color',\n 'warning': 'tw-text-white',\n };\n const classesByVariant = {\n 'outline':\n 'tw-border-sq-disabled-gray tw-border-solid tw-border hover:tw-bg-sq-light-gray' +\n ' focus:tw-bg-sq-dark-gray active:tw-bg-sq-dark-gray focus:tw-border-sq-color-dark active:tw-border-sq-color-dark',\n 'theme': 'tw-bg-sq-color-dark hover:tw-bg-sq-color-highlight disabled:tw-bg-opacity-50',\n 'danger': 'tw-bg-sq-danger-color hover:tw-bg-sq-danger-color-hover disabled:tw-bg-opacity-50',\n 'theme-light': 'tw-bg-sq-icon hover:tw-bg-sq-link disabled:tw-bg-opacity-50',\n 'no-border': '',\n 'warning': 'tw-bg-sq-warning-color',\n };\n const sizeClasses = {\n sm: 'tw-text-sm',\n lg: 'tw-text-xl',\n };\n const appliedClasses = `${baseClasses} ${sizeClasses[size]} ${classesByVariant[variant]} ${textClassesByVariant[variant]} ${extraClassNames}`;\n\n const button = (\n <button\n id={id}\n disabled={disabled}\n data-testid={testId}\n type={type === 'link' || (type === 'submit' && browserIsFirefox) ? 'button' : type}\n onClick={(e) => {\n stopPropagation && e.stopPropagation();\n onClick && onClick();\n }}\n className={appliedClasses}>\n {icon && (\n <Icon\n icon={icon}\n type={iconStyle}\n color={iconColor}\n extraClassNames={label ? `tw-mr-1 ${textClassesByVariant[variant]}` : ''}\n testId={`${id}_spinner`}\n />\n )}\n {label}\n </button>\n );\n\n return tooltip ? (\n <Tooltip text={tooltip} {...tooltipOptions}>\n {button}\n </Tooltip>\n ) : (\n button\n );\n};\nexport default Button;\n","import React, { useEffect, useRef, useState } from 'react';\nimport { TextFieldProps } from './TextField.types';\nimport '../styles.css';\n\n/**\n * Textfield.\n */\nexport const TextField: React.FunctionComponent<TextFieldProps> = React.forwardRef<HTMLInputElement, TextFieldProps>(\n (props, ref: any) => {\n const {\n readonly = false,\n onChange,\n onKeyUp,\n id,\n name,\n size = 'sm',\n value,\n placeholder,\n extraClassNames,\n testId,\n type = 'text',\n } = props;\n\n const internalRef = useRef<HTMLInputElement | null>(null);\n const [cursor, setCursor] = useState(null);\n\n const setAllRefs = (receivedRef: any) => {\n if (ref) ref.current = receivedRef;\n internalRef.current = receivedRef;\n };\n\n useEffect(() => {\n const input = internalRef.current! as unknown as HTMLInputElement;\n if (input) input.setSelectionRange(cursor, cursor);\n }, [ref, cursor, value]);\n\n const handleChange = (e: any) => {\n setCursor(e.target.selectionStart);\n onChange && onChange(e);\n };\n\n useEffect(() => {\n /**\n * we need to change the value only if it's different since the internal state of \"input\" will change it anyway\n * this will only be the case when the value has been changed externally via store (undo / redo)\n */\n if (value !== null && value !== undefined && value !== internalRef.current?.value && internalRef.current) {\n // we need to use this method because using the value props directly will switch the input to a \"controlled\"\n // component\n internalRef.current.value = `${value}`;\n }\n }, [value]);\n\n const baseClasses =\n 'tw-height-34 tw-leading-normal tw-outline-none tw-py-1 tw-px-3 tw-rounded-sm disabled:tw-pointer-events-none' +\n ' disabled:tw-cursor-not-allowed tw-p-1 tw-border-sq-disabled-gray tw-border-solid tw-border' +\n ' tw-text-sq-text-color focus:tw-border-sq-color-dark active:tw-border-sq-color-dark';\n\n const sizeClasses = {\n sm: 'tw-text-sm',\n lg: 'tw-text-xl',\n };\n\n const appliedClasses = `${baseClasses} ${sizeClasses[size]} ${extraClassNames}`;\n\n return (\n <input\n ref={setAllRefs}\n data-testid={testId}\n name={name}\n id={id}\n type={type}\n value={value}\n className={appliedClasses}\n placeholder={placeholder}\n disabled={readonly}\n autoComplete=\"none\"\n onChange={handleChange}\n onKeyUp={onKeyUp}\n />\n );\n },\n);\n"],"names":[],"mappings":";;AAAA;;;AAGG;AACI,MAAM,SAAS,GAAW,CAAC,YAAA;AAChC,IAAA,IAAI,GAAG,CAAC;AACR,IAAA,MAAM,EAAE,GAAG,SAAS,CAAC,SAAS,CAAC;IAC/B,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,8DAA8D,CAAC,IAAI,EAAE,CAAC;IACvF,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;QACzB,GAAG,GAAG,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;QACvC,OAAO,CAAA,GAAA,EAAM,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;AAC7B,KAAA;AAED,IAAA,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;AACrB,QAAA,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,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AAK,EAAE,CAAC;AACxC,SAAA;AACH,KAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,MAAM,WAAW,GACf,8GAA8G;QAC9G,6FAA6F;AAC7F,QAAA,qFAAqF,CAAC;AAExF,IAAA,MAAM,WAAW,GAAG;AAClB,QAAA,EAAE,EAAE,YAAY;AAChB,QAAA,EAAE,EAAE,YAAY;KACjB,CAAC;AAEF,IAAA,MAAM,cAAc,GAAG,CAAG,EAAA,WAAW,CAAI,CAAA,EAAA,WAAW,CAAC,IAAI,CAAC,CAAA,CAAA,EAAI,eAAe,CAAA,CAAE,CAAC;IAEhF,QACE,+BACE,GAAG,EAAE,UAAU,EACF,aAAA,EAAA,MAAM,EACnB,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,cAAc,EACzB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAC,MAAM,EACnB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,OAAO,EAChB,CAAA,EACF;AACJ,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/utils/browserId.ts","../src/Tooltip/Tooltip.types.ts","../src/Tooltip/Tooltip.tsx","../src/Icon/Icon.tsx","../src/Button/Button.tsx","../src/TextField/TextField.tsx","../src/Checkbox/Checkbox.tsx","../src/TextArea/TextArea.tsx"],"sourcesContent":["/**\n * @exports the browser id (i.e., 'IE 11' 'Chrome 90')\n * @see http://stackoverflow.com/questions/2400935/browser-detection-in-javascript\n */\nexport const browserId: string = (function () {\n let tem;\n const ua = navigator.userAgent;\n let M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\\/))\\/?\\s*(\\d+)/i) || [];\n if (/trident/i.test(M[1])) {\n tem = /\\brv[ :]+(\\d+)/g.exec(ua) || [];\n return `IE ${tem[1] || ''}`;\n }\n\n if (M[1] === 'Chrome') {\n tem = ua.match(/\\b(OPR|Edge?)\\/(\\d+)/);\n if (tem !== null) {\n return tem.slice(1).join(' ').replace('OPR', 'Opera').replace('Edg ', 'Edge ');\n }\n }\n\n M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];\n if ((tem = ua.match(/version\\/(\\d+)/i)) !== null) {\n M.splice(1, 1, tem[1]);\n }\n\n return M.join(' ');\n})();\nexport const browserName = browserId && browserId.split(' ', 2)[0];\nexport const browserVersion = browserId && parseInt(browserId.split(' ', 2)[1], 10);\nexport const browserIsFirefox = browserId && browserName === 'Firefox';\nexport const browserIsEdgeBeforeChromium =\n browserName && browserVersion && browserName === 'Edge' && browserVersion < 70;\n","export const DEFAULT_TOOL_TIP_DELAY = 1000;\nexport const tooltipPositions = ['top', 'left', 'right', 'bottom'] as const;\n\nexport type TooltipPosition = typeof tooltipPositions[number];\n\nexport interface TooltipProps {\n position?: TooltipPosition;\n children?: JSX.Element | string;\n text: JSX.Element | string;\n delay?: number;\n}\n","import React from 'react';\nimport '../styles.css';\nimport { DEFAULT_TOOL_TIP_DELAY, TooltipProps } from './Tooltip.types';\n\n/**\n * This component displays a Tooltip for the provided children.\n */\nexport const Tooltip: React.FunctionComponent<TooltipProps> = ({\n position = 'bottom',\n children,\n text,\n delay = DEFAULT_TOOL_TIP_DELAY,\n}) => {\n const arrowBaseClasses = \"before:tw-content-[''] before:tw-absolute before:tw-border-8\";\n const centerArrowVertically = 'before:tw-top-1/2 before:-tw-translate-y-1/2';\n const centerArrowHorizontally = 'before:tw-left-1/2 before:-tw-translate-x-1/2';\n const arrowRight = `${arrowBaseClasses} ${centerArrowVertically} before:tw-right-[100%] before:tw-border-y-transparent \n before:tw-border-l-transparent before:tw-border-r-black`;\n\n const arrowLeft = `${arrowBaseClasses} ${centerArrowVertically} before:tw-left-[100%] before:tw-border-y-transparent\n before:tw-border-l-black before:tw-border-r-transparent`;\n\n const arrowBottom = `${arrowBaseClasses} ${centerArrowHorizontally} before:-tw-top-4 before:tw-border-b-black \n before:tw-border-r-transparent before:tw-border-l-transparent before:tw-border-t-transparent`;\n const arrowTop = `${arrowBaseClasses} ${centerArrowHorizontally} before:-tw-bottom-4 before:tw-border-b-transparent \n before:tw-border-t-black before:tw-border-l-transparent before:tw-border-r-transparent`;\n\n const placements = {\n top: `-tw-top-2 -tw-translate-y-full tw-left-1/2 -tw-translate-x-1/2 ${arrowTop}`,\n left: `-tw-translate-x-full -tw-left-3 -tw-translate-y-1/2 tw-top-1/2 ${arrowLeft}`,\n right: `tw-translate-x-full -tw-right-3 -tw-translate-y-1/2 tw-top-1/2 ${arrowRight}`,\n bottom: `-tw-bottom-2 tw-translate-y-full tw-left-1/2 -tw-translate-x-1/2 ${arrowBottom}`,\n };\n\n return (\n <div className=\"tw-group tw-relative tw-inline-block\">\n {children}\n <div\n className={`tw-z-50 tw-whitespace-nowrap tw-hidden group-hover:tw-inline-block group-hover:tw-delay-[${delay}ms] \n tw-absolute tw-opacity-0 group-hover:tw-opacity-100 tw-rounded tw-bg-black tw-p-2 tw-text-xs tw-text-white ${placements[position]}`}>\n {text}\n </div>\n </div>\n );\n};\n","import React from 'react';\nimport '../styles.css';\nimport { IconProps } from './Icon.types';\nimport Tooltip from '../Tooltip';\n\n/**\n * Icon:\n * - access to Seeq custom icons by providing the desired icon\n * - leverage \"type\" to style your icon\n */\nconst Icon: React.FunctionComponent<IconProps> = ({\n onClick,\n icon,\n type = 'theme',\n extraClassNames,\n id,\n large,\n small,\n color,\n testId,\n customId,\n tooltip,\n tooltipDelay,\n tooltipPlacement,\n number,\n hasExternalTooltipHandler = false,\n}) => {\n if ((type === 'color' && (color === undefined || color === '')) || (color && type !== 'color')) {\n const errorMessage =\n color === undefined || color === ''\n ? 'Icon with type=\"color\" must have prop color specified.'\n : 'Icon with prop color must have type=\"color\".';\n return <div className=\"tw-text-sq-danger-color\">{errorMessage}</div>;\n }\n\n const colorClassesThemeLight = {\n 'theme': 'tw-text-sq-color-dark',\n 'white': 'tw-text-white',\n 'dark-gray': 'tw-text-sq-fairly-dark-gray',\n 'warning': 'tw-text-sq-warning-color',\n 'darkish-gray': 'tw-text-sq-darkish-gray',\n 'gray': 'tw-text-sq-disabled-gray',\n 'color': '',\n 'info': 'tw-text-sq-link',\n 'text': 'tw-text-sq-text-color',\n 'inherit': '',\n 'danger': 'tw-text-sq-danger-color',\n 'theme-light': 'tw-text-sq-color-light',\n 'success': 'tw-text-sq-success-color',\n };\n\n const colorClassesThemeDark = {\n 'theme': 'dark:tw-text-sq-color-dark-dark',\n 'white': '',\n 'dark-gray': 'tw-text-sq-fairly-dark-gray',\n 'warning': '',\n 'darkish-gray': 'tw-text-sq-darkish-gray',\n 'gray': 'dark:tw-text-sq-dark-disabled-gray',\n 'color': '',\n 'info': 'dark:tw-text-sq-link-dark',\n 'text': 'dark:tw-text-sq-dark-text',\n 'inherit': '',\n 'danger': 'tw-text-sq-danger-color',\n 'theme-light': 'tw-text-sq-color-light',\n 'success': 'tw-text-sq-success-color',\n };\n\n const iconPrefix = icon.startsWith('fc') ? 'fc' : 'fa';\n const style = type === 'color' && color ? { color } : {};\n const appliedClassNames = `${iconPrefix} ${icon} ${small ? 'fa-sm' : ''} ${large ? 'fa-lg' : ''} \n ${colorClassesThemeLight[type]} ${colorClassesThemeDark[type]} ${onClick ? 'cursor-pointer' : ''} ${extraClassNames}`;\n\n const iconTag = (\n <i\n className={appliedClassNames}\n style={style}\n onClick={onClick}\n data-testid={testId}\n data-customid={customId}\n id={id}\n data-number={number}\n />\n );\n\n return !hasExternalTooltipHandler && tooltip && tooltip !== '' ? (\n <Tooltip text={tooltip} delay={tooltipDelay} position={tooltipPlacement}>\n {iconTag}\n </Tooltip>\n ) : (\n iconTag\n );\n};\nexport default Icon;\n","import React from 'react';\nimport { ButtonProps } from './Button.types';\nimport '../styles.css';\nimport { browserIsFirefox } from '../utils/browserId';\nimport Tooltip from '../Tooltip';\nimport Icon from '../Icon';\n\n/**\n * All-in-one Button:\n * - use \"variant\" to achieve the desired style\n * - include tooltips and/or icons\n */\nconst Button: React.FunctionComponent<ButtonProps> = ({\n onClick,\n label,\n variant = 'outline',\n type = 'button',\n size = 'sm',\n disabled,\n extraClassNames,\n id,\n testId,\n stopPropagation = true,\n tooltip,\n tooltipOptions,\n iconStyle = 'text',\n icon,\n iconColor,\n}) => {\n const baseClasses = 'tw-py-1 tw-px-2.5 tw-rounded-sm focus:tw-ring-0 disabled:tw-pointer-events-none';\n const baseClassesByVariant = {\n 'outline':\n 'tw-border-solid tw-border',\n 'theme': 'disabled:tw-bg-opacity-50',\n 'danger': 'tw-bg-sq-danger-color hover:tw-bg-sq-danger-color-hover disabled:tw-bg-opacity-50',\n 'theme-light': 'disabled:tw-bg-opacity-50',\n 'no-border': '',\n 'warning': 'tw-bg-sq-warning-color',\n };\n const textClassesByVariantLightTheme = {\n 'outline': 'tw-text-sq-text-color',\n 'theme': 'tw-text-white',\n 'theme-light': 'tw-text-white',\n 'danger': 'tw-text-white',\n 'no-border': 'tw-text-sq-text-color',\n 'warning': 'tw-text-white',\n };\n const textClassesByVariantDarkTheme = {\n 'outline': 'dark:tw-text-sq-dark-text',\n 'theme': 'dark:tw-text-white',\n 'theme-light': 'dark:tw-text-white',\n 'danger': 'dark:tw-text-white',\n 'no-border': 'dark:tw-text-sq-dark-text',\n 'warning': 'dark:tw-text-white',\n };\n\n const classesByVariantLightTheme = {\n 'outline':\n 'tw-border-sq-disabled-gray hover:tw-bg-sq-light-gray' +\n ' focus:tw-bg-sq-dark-gray active:tw-bg-sq-dark-gray focus:tw-border-sq-color-dark active:tw-border-sq-color-dark',\n 'theme': 'tw-bg-sq-color-dark hover:tw-bg-sq-color-highlight',\n 'danger': '',\n 'theme-light': 'tw-bg-sq-icon hover:tw-bg-sq-link',\n 'no-border': '',\n 'warning': 'tw-bg-sq-warning-color',\n };\n\n const classesByVariantDarkTheme = {\n 'outline':\n 'dark:tw-border-sq-dark-disabled-gray dark:hover:tw-bg-sq-highlight-color-dark' +\n ' dark:focus:tw-bg-sq-dark-gray dark:active:tw-bg-sq-dark-gray dark:focus:tw-border-sq-color-dark' +\n ' dark:active:tw-border-sq-color-dark',\n 'theme': 'dark:tw-bg-sq-color-dark dark:hover:tw-bg-sq-color-highlight',\n 'danger': '',\n 'theme-light': 'dark:tw-bg-sq-icon-dark dark:hover:tw-bg-sq-link-dark',\n 'no-border': '',\n 'warning': '',\n };\n const sizeClasses = {\n sm: 'tw-text-sm',\n lg: 'tw-text-xl',\n };\n const appliedClasses = `${baseClasses} ${baseClassesByVariant[variant]} ${sizeClasses[size]} ${classesByVariantLightTheme[variant]} ${classesByVariantDarkTheme[variant]} ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]} ${extraClassNames}`;\n\n const button = (\n <button\n id={id}\n disabled={disabled}\n data-testid={testId}\n type={type === 'link' || (type === 'submit' && browserIsFirefox) ? 'button' : type}\n onClick={(e) => {\n stopPropagation && e.stopPropagation();\n onClick && onClick();\n }}\n className={appliedClasses}>\n {icon && (\n <Icon\n icon={icon}\n type={iconStyle}\n color={iconColor}\n extraClassNames={label ?\n `tw-mr-1 ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]}` : ''}\n testId={`${id}_spinner`}\n />\n )}\n {label}\n </button>\n );\n\n return tooltip ? (\n <Tooltip text={tooltip} {...tooltipOptions}>\n {button}\n </Tooltip>\n ) : (\n button\n );\n};\nexport default Button;\n","import React, { useEffect, useRef, useState } from 'react';\nimport { TextFieldProps } from './TextField.types';\nimport '../styles.css';\n\n/**\n * Textfield.\n */\nexport const TextField: React.FunctionComponent<TextFieldProps> = React.forwardRef<HTMLInputElement, TextFieldProps>(\n (props, ref: any) => {\n const {\n readonly = false,\n onChange,\n onKeyUp,\n id,\n name,\n size = 'sm',\n value,\n placeholder,\n extraClassNames,\n testId,\n type = 'text',\n } = props;\n\n const internalRef = useRef<HTMLInputElement | null>(null);\n const [cursor, setCursor] = useState(null);\n\n const setAllRefs = (receivedRef: any) => {\n if (ref) ref.current = receivedRef;\n internalRef.current = receivedRef;\n };\n\n useEffect(() => {\n const input = internalRef.current! as unknown as HTMLInputElement;\n if (input) input.setSelectionRange(cursor, cursor);\n }, [ref, cursor, value]);\n\n const handleChange = (e: any) => {\n setCursor(e.target.selectionStart);\n onChange && onChange(e);\n };\n\n useEffect(() => {\n /**\n * we need to change the value only if it's different since the internal state of \"input\" will change it anyway\n * this will only be the case when the value has been changed externally via store (undo / redo)\n */\n if (value !== null && value !== undefined && value !== internalRef.current?.value && internalRef.current) {\n // we need to use this method because using the value props directly will switch the input to a \"controlled\"\n // component\n internalRef.current.value = `${value}`;\n }\n }, [value]);\n\n const baseClasses =\n 'tw-height-34 tw-leading-normal tw-outline-none tw-py-1 tw-px-3 tw-rounded-sm disabled:tw-pointer-events-none' +\n ' disabled:tw-cursor-not-allowed tw-p-1 tw-border-solid tw-border';\n\n const darkTheme = 'dark:tw-border-sq-dark-disabled-gray dark:tw-bg-sq-dark-background dark:tw-text-sq-dark-text' +\n ' dark:focus:tw-border-sq-color-dark-dark dark:active:tw-border-sq-color-dark-dark';\n const lightTheme = 'tw-border-sq-disabled-gray tw-text-sq-text-color focus:tw-border-sq-color-dark active:tw-border-sq-color-dark';\n\n const sizeClasses = {\n sm: 'tw-text-sm',\n lg: 'tw-text-xl',\n };\n\n const appliedClasses = `${baseClasses} ${sizeClasses[size]} ${extraClassNames} ${lightTheme} ${darkTheme}`;\n\n return (\n <input\n ref={setAllRefs}\n data-testid={testId}\n name={name}\n id={id}\n type={type}\n value={value}\n className={appliedClasses}\n placeholder={placeholder}\n disabled={readonly}\n autoComplete=\"none\"\n onChange={handleChange}\n onKeyUp={onKeyUp}\n />\n );\n },\n);\n","import React from 'react';\nimport { CheckboxProps } from './Checkbox.types';\nimport '../styles.css';\n\nconst alignment = 'tw-flex tw-items-center';\nconst labelClasses = 'tw-ml-1.5 tw-text-sm';\n\nconst baseClasses =\n 'tw-border-1 tw-h-3.5 tw-w-3.5 focus:tw-ring-0 focus:tw-ring-offset-0 tw-outline-none focus:tw-outline-none' +\n ' dark:tw-bg-sq-dark-background dark:tw-border-sq-dark-text dark:checked:tw-bg-sq-dark-text' +\n ' checked:tw-text-sq-text-color' +\n ' disabled:tw-text-sq-fairly-dark-gray';\n\nconst checkboxClasses = `tw-form-checkbox tw-rounded ${baseClasses}`;\n\nconst radioClasses = `tw-form-radio ${baseClasses}`;\n\n/**\n * Checkbox and Radio Box Component.\n */\nexport const Checkbox: React.FunctionComponent<CheckboxProps> = (props) => {\n const {\n type = 'checkbox',\n value,\n disabled = false,\n label,\n onChange,\n onClick,\n onKeyDown,\n checked,\n id,\n name,\n extraClassNames,\n extraLabelClassNames,\n testId,\n } = props;\n\n const assignedId = id ?? 'checkbox_' + Math.random();\n\n return (\n <span className={`${alignment} ${extraClassNames}`}>\n <input\n value={value}\n type={type}\n data-testid={testId}\n name={name}\n id={assignedId}\n checked={checked}\n className={`${type === 'checkbox' ? checkboxClasses : radioClasses} ${\n disabled ? 'tw-cursor-not-allowed' : 'tw-cursor-pointer'\n }`}\n disabled={disabled}\n onClick={onClick}\n onChange={onChange}\n onKeyDown={onKeyDown}\n />\n <label\n htmlFor={assignedId}\n className={`${labelClasses} ${extraLabelClassNames} ${\n disabled\n ? 'tw-cursor-not-allowed dark:tw-text-sq-fairly-dark-gray tw-text-sq-fairly-dark-gray'\n : 'tw-cursor-pointer tw-text-sq-text-color dark:tw-text-sq-dark-text'\n }`}>\n {label}\n </label>\n </span>\n );\n};\n","import React from 'react';\nimport { TextAreaProps } from './TextArea.types';\nimport '../styles.css';\n\nconst baseClasses =\n 'tw-leading-normal tw-outline-none tw-py-1 tw-px-3 tw-rounded-sm' +\n ' disabled:tw-cursor-not-allowed tw-p-1 tw-border-solid tw-border';\n\nconst darkTheme =\n 'dark:tw-border-sq-dark-disabled-gray dark:tw-bg-sq-dark-background dark:tw-text-sq-dark-text' +\n ' dark:focus:tw-border-sq-color-dark-dark dark:active:tw-border-sq-color-dark-dark';\nconst lightTheme =\n 'tw-border-sq-disabled-gray tw-text-sq-text-color focus:tw-border-sq-color-dark active:tw-border-sq-color-dark';\n\n/**\n * TextArea.\n */\nexport const TextArea: React.FunctionComponent<TextAreaProps> = ({\n readonly = false,\n onChange,\n onKeyUp,\n id,\n name,\n rows = 3,\n cols = undefined,\n value,\n placeholder,\n extraClassNames,\n testId,\n autofocus = false,\n}) => {\n const appliedClasses = `${baseClasses} ${extraClassNames} ${lightTheme} ${darkTheme}`;\n\n return (\n <textarea\n data-testid={testId}\n name={name}\n id={id}\n value={value}\n className={appliedClasses}\n placeholder={placeholder}\n disabled={readonly}\n onChange={onChange}\n onKeyUp={onKeyUp}\n rows={rows}\n cols={cols}\n autoFocus={autofocus}\n />\n );\n};\n"],"names":["baseClasses"],"mappings":";;AAAA;;;AAGG;AACI,MAAM,SAAS,GAAW,CAAC,YAAA;AAChC,IAAA,IAAI,GAAG,CAAC;AACR,IAAA,MAAM,EAAE,GAAG,SAAS,CAAC,SAAS,CAAC;IAC/B,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,8DAA8D,CAAC,IAAI,EAAE,CAAC;IACvF,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;QACzB,GAAG,GAAG,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;QACvC,OAAO,CAAA,GAAA,EAAM,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;AAC7B,KAAA;AAED,IAAA,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;AACrB,QAAA,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QACvC,IAAI,GAAG,KAAK,IAAI,EAAE;YAChB,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAA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,CAAC;AAElH;;AAEG;AACU,MAAA,QAAQ,GAA2C,CAAC,EAC/D,QAAQ,GAAG,KAAK,EAChB,QAAQ,EACR,OAAO,EACP,EAAE,EACF,IAAI,EACJ,IAAI,GAAG,CAAC,EACR,IAAI,GAAG,SAAS,EAChB,KAAK,EACL,WAAW,EACX,eAAe,EACf,MAAM,EACN,SAAS,GAAG,KAAK,GAClB,KAAI;IACH,MAAM,cAAc,GAAG,CAAA,EAAG,WAAW,CAAA,CAAA,EAAI,eAAe,CAAA,CAAA,EAAI,UAAU,CAAA,CAAA,EAAI,SAAS,CAAA,CAAE,CAAC;IAEtF,QACE,iDACe,MAAM,EACnB,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,cAAc,EACzB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,CAAA,EACF;AACJ;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -71,7 +71,7 @@ const Icon = ({ onClick, icon, type = 'theme', extraClassNames, id, large, small
|
|
|
71
71
|
: 'Icon with prop color must have type="color".';
|
|
72
72
|
return React.createElement("div", { className: "tw-text-sq-danger-color" }, errorMessage);
|
|
73
73
|
}
|
|
74
|
-
const
|
|
74
|
+
const colorClassesThemeLight = {
|
|
75
75
|
'theme': 'tw-text-sq-color-dark',
|
|
76
76
|
'white': 'tw-text-white',
|
|
77
77
|
'dark-gray': 'tw-text-sq-fairly-dark-gray',
|
|
@@ -86,9 +86,25 @@ const Icon = ({ onClick, icon, type = 'theme', extraClassNames, id, large, small
|
|
|
86
86
|
'theme-light': 'tw-text-sq-color-light',
|
|
87
87
|
'success': 'tw-text-sq-success-color',
|
|
88
88
|
};
|
|
89
|
+
const colorClassesThemeDark = {
|
|
90
|
+
'theme': 'dark:tw-text-sq-color-dark-dark',
|
|
91
|
+
'white': '',
|
|
92
|
+
'dark-gray': 'tw-text-sq-fairly-dark-gray',
|
|
93
|
+
'warning': '',
|
|
94
|
+
'darkish-gray': 'tw-text-sq-darkish-gray',
|
|
95
|
+
'gray': 'dark:tw-text-sq-dark-disabled-gray',
|
|
96
|
+
'color': '',
|
|
97
|
+
'info': 'dark:tw-text-sq-link-dark',
|
|
98
|
+
'text': 'dark:tw-text-sq-dark-text',
|
|
99
|
+
'inherit': '',
|
|
100
|
+
'danger': 'tw-text-sq-danger-color',
|
|
101
|
+
'theme-light': 'tw-text-sq-color-light',
|
|
102
|
+
'success': 'tw-text-sq-success-color',
|
|
103
|
+
};
|
|
89
104
|
const iconPrefix = icon.startsWith('fc') ? 'fc' : 'fa';
|
|
90
105
|
const style = type === 'color' && color ? { color } : {};
|
|
91
|
-
const appliedClassNames = `${iconPrefix} ${icon} ${small ? 'fa-sm' : ''} ${large ? 'fa-lg' : ''}
|
|
106
|
+
const appliedClassNames = `${iconPrefix} ${icon} ${small ? 'fa-sm' : ''} ${large ? 'fa-lg' : ''}
|
|
107
|
+
${colorClassesThemeLight[type]} ${colorClassesThemeDark[type]} ${onClick ? 'cursor-pointer' : ''} ${extraClassNames}`;
|
|
92
108
|
const iconTag = (React.createElement("i", { className: appliedClassNames, style: style, onClick: onClick, "data-testid": testId, "data-customid": customId, id: id, "data-number": number }));
|
|
93
109
|
return !hasExternalTooltipHandler && tooltip && tooltip !== '' ? (React.createElement(Tooltip, { text: tooltip, delay: tooltipDelay, position: tooltipPlacement }, iconTag)) : (iconTag);
|
|
94
110
|
};
|
|
@@ -100,7 +116,15 @@ const Icon = ({ onClick, icon, type = 'theme', extraClassNames, id, large, small
|
|
|
100
116
|
*/
|
|
101
117
|
const Button = ({ onClick, label, variant = 'outline', type = 'button', size = 'sm', disabled, extraClassNames, id, testId, stopPropagation = true, tooltip, tooltipOptions, iconStyle = 'text', icon, iconColor, }) => {
|
|
102
118
|
const baseClasses = 'tw-py-1 tw-px-2.5 tw-rounded-sm focus:tw-ring-0 disabled:tw-pointer-events-none';
|
|
103
|
-
const
|
|
119
|
+
const baseClassesByVariant = {
|
|
120
|
+
'outline': 'tw-border-solid tw-border',
|
|
121
|
+
'theme': 'disabled:tw-bg-opacity-50',
|
|
122
|
+
'danger': 'tw-bg-sq-danger-color hover:tw-bg-sq-danger-color-hover disabled:tw-bg-opacity-50',
|
|
123
|
+
'theme-light': 'disabled:tw-bg-opacity-50',
|
|
124
|
+
'no-border': '',
|
|
125
|
+
'warning': 'tw-bg-sq-warning-color',
|
|
126
|
+
};
|
|
127
|
+
const textClassesByVariantLightTheme = {
|
|
104
128
|
'outline': 'tw-text-sq-text-color',
|
|
105
129
|
'theme': 'tw-text-white',
|
|
106
130
|
'theme-light': 'tw-text-white',
|
|
@@ -108,25 +132,44 @@ const Button = ({ onClick, label, variant = 'outline', type = 'button', size = '
|
|
|
108
132
|
'no-border': 'tw-text-sq-text-color',
|
|
109
133
|
'warning': 'tw-text-white',
|
|
110
134
|
};
|
|
111
|
-
const
|
|
112
|
-
'outline': '
|
|
135
|
+
const textClassesByVariantDarkTheme = {
|
|
136
|
+
'outline': 'dark:tw-text-sq-dark-text',
|
|
137
|
+
'theme': 'dark:tw-text-white',
|
|
138
|
+
'theme-light': 'dark:tw-text-white',
|
|
139
|
+
'danger': 'dark:tw-text-white',
|
|
140
|
+
'no-border': 'dark:tw-text-sq-dark-text',
|
|
141
|
+
'warning': 'dark:tw-text-white',
|
|
142
|
+
};
|
|
143
|
+
const classesByVariantLightTheme = {
|
|
144
|
+
'outline': 'tw-border-sq-disabled-gray hover:tw-bg-sq-light-gray' +
|
|
113
145
|
' focus:tw-bg-sq-dark-gray active:tw-bg-sq-dark-gray focus:tw-border-sq-color-dark active:tw-border-sq-color-dark',
|
|
114
|
-
'theme': 'tw-bg-sq-color-dark hover:tw-bg-sq-color-highlight
|
|
115
|
-
'danger': '
|
|
116
|
-
'theme-light': 'tw-bg-sq-icon hover:tw-bg-sq-link
|
|
146
|
+
'theme': 'tw-bg-sq-color-dark hover:tw-bg-sq-color-highlight',
|
|
147
|
+
'danger': '',
|
|
148
|
+
'theme-light': 'tw-bg-sq-icon hover:tw-bg-sq-link',
|
|
117
149
|
'no-border': '',
|
|
118
150
|
'warning': 'tw-bg-sq-warning-color',
|
|
119
151
|
};
|
|
152
|
+
const classesByVariantDarkTheme = {
|
|
153
|
+
'outline': 'dark:tw-border-sq-dark-disabled-gray dark:hover:tw-bg-sq-highlight-color-dark' +
|
|
154
|
+
' dark:focus:tw-bg-sq-dark-gray dark:active:tw-bg-sq-dark-gray dark:focus:tw-border-sq-color-dark' +
|
|
155
|
+
' dark:active:tw-border-sq-color-dark',
|
|
156
|
+
'theme': 'dark:tw-bg-sq-color-dark dark:hover:tw-bg-sq-color-highlight',
|
|
157
|
+
'danger': '',
|
|
158
|
+
'theme-light': 'dark:tw-bg-sq-icon-dark dark:hover:tw-bg-sq-link-dark',
|
|
159
|
+
'no-border': '',
|
|
160
|
+
'warning': '',
|
|
161
|
+
};
|
|
120
162
|
const sizeClasses = {
|
|
121
163
|
sm: 'tw-text-sm',
|
|
122
164
|
lg: 'tw-text-xl',
|
|
123
165
|
};
|
|
124
|
-
const appliedClasses = `${baseClasses} ${sizeClasses[size]} ${
|
|
166
|
+
const appliedClasses = `${baseClasses} ${baseClassesByVariant[variant]} ${sizeClasses[size]} ${classesByVariantLightTheme[variant]} ${classesByVariantDarkTheme[variant]} ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]} ${extraClassNames}`;
|
|
125
167
|
const button = (React.createElement("button", { id: id, disabled: disabled, "data-testid": testId, type: type === 'link' || (type === 'submit' && browserIsFirefox) ? 'button' : type, onClick: (e) => {
|
|
126
168
|
stopPropagation && e.stopPropagation();
|
|
127
169
|
onClick && onClick();
|
|
128
170
|
}, className: appliedClasses },
|
|
129
|
-
icon && (React.createElement(Icon, { icon: icon, type: iconStyle, color: iconColor, extraClassNames: label ?
|
|
171
|
+
icon && (React.createElement(Icon, { icon: icon, type: iconStyle, color: iconColor, extraClassNames: label ?
|
|
172
|
+
`tw-mr-1 ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]}` : '', testId: `${id}_spinner` })),
|
|
130
173
|
label));
|
|
131
174
|
return tooltip ? (React.createElement(Tooltip, { text: tooltip, ...tooltipOptions }, button)) : (button);
|
|
132
175
|
};
|
|
@@ -164,17 +207,56 @@ const TextField = React.forwardRef((props, ref) => {
|
|
|
164
207
|
}
|
|
165
208
|
}, [value]);
|
|
166
209
|
const baseClasses = 'tw-height-34 tw-leading-normal tw-outline-none tw-py-1 tw-px-3 tw-rounded-sm disabled:tw-pointer-events-none' +
|
|
167
|
-
' disabled:tw-cursor-not-allowed tw-p-1 tw-border-
|
|
168
|
-
|
|
210
|
+
' disabled:tw-cursor-not-allowed tw-p-1 tw-border-solid tw-border';
|
|
211
|
+
const darkTheme = 'dark:tw-border-sq-dark-disabled-gray dark:tw-bg-sq-dark-background dark:tw-text-sq-dark-text' +
|
|
212
|
+
' dark:focus:tw-border-sq-color-dark-dark dark:active:tw-border-sq-color-dark-dark';
|
|
213
|
+
const lightTheme = 'tw-border-sq-disabled-gray tw-text-sq-text-color focus:tw-border-sq-color-dark active:tw-border-sq-color-dark';
|
|
169
214
|
const sizeClasses = {
|
|
170
215
|
sm: 'tw-text-sm',
|
|
171
216
|
lg: 'tw-text-xl',
|
|
172
217
|
};
|
|
173
|
-
const appliedClasses = `${baseClasses} ${sizeClasses[size]} ${extraClassNames}`;
|
|
218
|
+
const appliedClasses = `${baseClasses} ${sizeClasses[size]} ${extraClassNames} ${lightTheme} ${darkTheme}`;
|
|
174
219
|
return (React.createElement("input", { ref: setAllRefs, "data-testid": testId, name: name, id: id, type: type, value: value, className: appliedClasses, placeholder: placeholder, disabled: readonly, autoComplete: "none", onChange: handleChange, onKeyUp: onKeyUp }));
|
|
175
220
|
});
|
|
176
221
|
|
|
222
|
+
const alignment = 'tw-flex tw-items-center';
|
|
223
|
+
const labelClasses = 'tw-ml-1.5 tw-text-sm';
|
|
224
|
+
const baseClasses$1 = 'tw-border-1 tw-h-3.5 tw-w-3.5 focus:tw-ring-0 focus:tw-ring-offset-0 tw-outline-none focus:tw-outline-none' +
|
|
225
|
+
' dark:tw-bg-sq-dark-background dark:tw-border-sq-dark-text dark:checked:tw-bg-sq-dark-text' +
|
|
226
|
+
' checked:tw-text-sq-text-color' +
|
|
227
|
+
' disabled:tw-text-sq-fairly-dark-gray';
|
|
228
|
+
const checkboxClasses = `tw-form-checkbox tw-rounded ${baseClasses$1}`;
|
|
229
|
+
const radioClasses = `tw-form-radio ${baseClasses$1}`;
|
|
230
|
+
/**
|
|
231
|
+
* Checkbox and Radio Box Component.
|
|
232
|
+
*/
|
|
233
|
+
const Checkbox = (props) => {
|
|
234
|
+
const { type = 'checkbox', value, disabled = false, label, onChange, onClick, onKeyDown, checked, id, name, extraClassNames, extraLabelClassNames, testId, } = props;
|
|
235
|
+
const assignedId = id ?? 'checkbox_' + Math.random();
|
|
236
|
+
return (React.createElement("span", { className: `${alignment} ${extraClassNames}` },
|
|
237
|
+
React.createElement("input", { value: value, type: type, "data-testid": testId, name: name, id: assignedId, checked: checked, className: `${type === 'checkbox' ? checkboxClasses : radioClasses} ${disabled ? 'tw-cursor-not-allowed' : 'tw-cursor-pointer'}`, disabled: disabled, onClick: onClick, onChange: onChange, onKeyDown: onKeyDown }),
|
|
238
|
+
React.createElement("label", { htmlFor: assignedId, className: `${labelClasses} ${extraLabelClassNames} ${disabled
|
|
239
|
+
? 'tw-cursor-not-allowed dark:tw-text-sq-fairly-dark-gray tw-text-sq-fairly-dark-gray'
|
|
240
|
+
: 'tw-cursor-pointer tw-text-sq-text-color dark:tw-text-sq-dark-text'}` }, label)));
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
const baseClasses = 'tw-leading-normal tw-outline-none tw-py-1 tw-px-3 tw-rounded-sm' +
|
|
244
|
+
' disabled:tw-cursor-not-allowed tw-p-1 tw-border-solid tw-border';
|
|
245
|
+
const darkTheme = 'dark:tw-border-sq-dark-disabled-gray dark:tw-bg-sq-dark-background dark:tw-text-sq-dark-text' +
|
|
246
|
+
' dark:focus:tw-border-sq-color-dark-dark dark:active:tw-border-sq-color-dark-dark';
|
|
247
|
+
const lightTheme = 'tw-border-sq-disabled-gray tw-text-sq-text-color focus:tw-border-sq-color-dark active:tw-border-sq-color-dark';
|
|
248
|
+
/**
|
|
249
|
+
* TextArea.
|
|
250
|
+
*/
|
|
251
|
+
const TextArea = ({ readonly = false, onChange, onKeyUp, id, name, rows = 3, cols = undefined, value, placeholder, extraClassNames, testId, autofocus = false, }) => {
|
|
252
|
+
const appliedClasses = `${baseClasses} ${extraClassNames} ${lightTheme} ${darkTheme}`;
|
|
253
|
+
return (React.createElement("textarea", { "data-testid": testId, name: name, id: id, value: value, className: appliedClasses, placeholder: placeholder, disabled: readonly, onChange: onChange, onKeyUp: onKeyUp, rows: rows, cols: cols, autoFocus: autofocus }));
|
|
254
|
+
};
|
|
255
|
+
|
|
177
256
|
exports.Button = Button;
|
|
257
|
+
exports.Checkbox = Checkbox;
|
|
258
|
+
exports.Icon = Icon;
|
|
259
|
+
exports.TextArea = TextArea;
|
|
178
260
|
exports.TextField = TextField;
|
|
179
261
|
exports.Tooltip = Tooltip;
|
|
180
262
|
//# sourceMappingURL=index.js.map
|