pixel-react 1.4.6 → 1.4.8
Sign up to get free protection for your applications and to get access to all the features.
- package/.yarn/install-state.gz +0 -0
- package/lib/StyleGuide/ColorPalette/ColorPalette.stories.d.ts +6 -0
- package/lib/StyleGuide/Typography/Typography.stories.d.ts +6 -0
- package/lib/components/Accordion/Accordion.stories.d.ts +6 -0
- package/lib/components/AddResourceButton/AddButton.stories.d.ts +8 -0
- package/lib/components/AllProjectsDropdown/AllProjectsDropdown.d.ts +1 -1
- package/lib/components/AllProjectsDropdown/AllProjectsDropdown.stories.d.ts +7 -0
- package/lib/components/AllProjectsDropdown/types.d.ts +2 -0
- package/lib/components/AppHeader/AppHeader.stories.d.ts +7 -0
- package/lib/components/AppHeader/types.d.ts +1 -0
- package/lib/components/AttachmentButton/AttachmentButton.stories.d.ts +9 -0
- package/lib/components/Avatar/Avatar.stories.d.ts +10 -0
- package/lib/components/Button/Button.stories.d.ts +13 -0
- package/lib/components/Charts/DashboardDonutChart/DashboardDonutChart.stories.d.ts +7 -0
- package/lib/components/Charts/DonutChart/DonutChart.stories.d.ts +6 -0
- package/lib/components/Charts/PieChart/PieChart.stories.d.ts +7 -0
- package/lib/components/Charts/RadialChart/RadialChart.stories.d.ts +6 -0
- package/lib/components/Checkbox/Checkbox.stories.d.ts +8 -0
- package/lib/components/Chip/Chip.stories.d.ts +14 -0
- package/lib/components/DatePicker/DatePicker.stories.d.ts +9 -0
- package/lib/components/DragAndDrop/DragAndDrop.stories.d.ts +6 -0
- package/lib/components/Drawer/Drawer.stories.d.ts +12 -0
- package/lib/components/ExcelFile/ColorBarselector/ColorBarSelector.d.ts +8 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/ActiveCell.d.ts +7 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Cell.d.ts +4 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.d.ts +5 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Copied.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/CornerIndicator.d.ts +5 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/DataEditor.d.ts +5 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/DataViewer.d.ts +8 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/FloatingRect.d.ts +10 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/HeaderRow.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Row.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/RowIndicator.d.ts +5 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Selected.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Spreadsheet.d.ts +80 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Table.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/actions.d.ts +174 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/areModelsEqual.d.ts +1 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/context.d.ts +8 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/engine.d.ts +22 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/formula.d.ts +17 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/index.d.ts +2 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-graph.d.ts +21 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-hash.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-set.d.ts +24 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/index.d.ts +13 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/matrix.d.ts +67 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/point-range.d.ts +22 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/point.d.ts +11 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/reducer.d.ts +27 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/selection.d.ts +95 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/types.d.ts +178 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/use-dispatch.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/use-selector.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/util.d.ts +44 -0
- package/lib/components/ExcelFile/ExcelFile/ExcelFile.d.ts +19 -0
- package/lib/components/ExcelFile/ExcelFile.stories.d.ts +6 -0
- package/lib/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.d.ts +12 -0
- package/lib/components/ExcelFile/ExcelToolBar/ExcelToolBar.d.ts +15 -0
- package/lib/components/ExcelFile/Types.d.ts +129 -0
- package/lib/components/ExcelFile/index.d.ts +1 -0
- package/lib/components/ExpandableMenu/ExpandableMenu.stories.d.ts +7 -0
- package/lib/components/FF_Captcha/captcha.stories.d.ts +8 -0
- package/lib/components/FileDropzone/FileDropzone.stories.d.ts +8 -0
- package/lib/components/Form/Form.stories.d.ts +7 -0
- package/lib/components/Form/Forms.d.ts +3 -1
- package/lib/components/GridLayout/GridLayout.stories.d.ts +8 -0
- package/lib/components/HighlightText/HighlightText.stories.d.ts +6 -0
- package/lib/components/Icon/Icon.stories.d.ts +8 -0
- package/lib/components/IconButton/IconButton.stories.d.ts +7 -0
- package/lib/components/IconRadioGroup/IconRadioGroup.stories.d.ts +7 -0
- package/lib/components/Input/Input.d.ts +1 -1
- package/lib/components/Input/Input.stories.d.ts +9 -0
- package/lib/components/Input/types.d.ts +4 -0
- package/lib/components/InputWithDropdown/InputWithDropdown.stories.d.ts +9 -0
- package/lib/components/LabelEditTextField/LabelEditTextField.stories.d.ts +11 -0
- package/lib/components/LazyLoad/LazyLoad.stories.d.ts +6 -0
- package/lib/components/MachineInputField/MachineInputField.stories.d.ts +6 -0
- package/lib/components/MenuOption/MenuOption.stories.d.ts +16 -0
- package/lib/components/MenuOption/types.d.ts +1 -1
- package/lib/components/MiniModal/MiniModal.stories.d.ts +10 -0
- package/lib/components/Modal/Modal.stories.d.ts +7 -0
- package/lib/components/Modal/types.d.ts +4 -2
- package/lib/components/ModulesChip/ModuleChip.stories.d.ts +6 -0
- package/lib/components/MultiSelect/MultiSelect.stories.d.ts +10 -0
- package/lib/components/NLPInput/NlpInput.stories.d.ts +7 -0
- package/lib/components/Paper/Paper.stories.d.ts +11 -0
- package/lib/components/RadioButton/RadioButton.stories.d.ts +10 -0
- package/lib/components/RadioGroup/RadioGroup.stories.d.ts +9 -0
- package/lib/components/Search/Search.stories.d.ts +6 -0
- package/lib/components/Select/Select.stories.d.ts +13 -0
- package/lib/components/Select/components/Dropdown/Dropdown.d.ts +4 -0
- package/lib/components/Select/components/Dropdown/dropdownTypes.d.ts +17 -0
- package/lib/components/SequentialConnectingBranch/SequentialConnectingBranch.stories.d.ts +6 -0
- package/lib/components/StateDropdown/StateDropdown.stories.d.ts +10 -0
- package/lib/components/StatusButton/StatusButton.stories.d.ts +14 -0
- package/lib/components/Table/Table.stories.d.ts +13 -0
- package/lib/components/TableTree/TableTree.d.ts +2 -1
- package/lib/components/TableTree/TableTree.stories.d.ts +7 -0
- package/lib/components/Tabs/Tabs.stories.d.ts +9 -0
- package/lib/components/TextArea/Textarea.stories.d.ts +9 -0
- package/lib/components/Toast/Toast.stories.d.ts +6 -0
- package/lib/components/Toastify/Toastify.stories.d.ts +6 -0
- package/lib/components/Toggle/Toggle.stories.d.ts +12 -0
- package/lib/components/Tooltip/Tooltip.stories.d.ts +15 -0
- package/lib/components/Typography/Typography.stories.d.ts +10 -0
- package/lib/components/VariableInput/VariableInput.stories.d.ts +6 -0
- package/lib/index.d.ts +17 -5
- package/lib/index.esm.js +212 -145
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +212 -145
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/capitalize/capitalize.d.ts +1 -0
- package/lib/utils/checkEmpty/checkEmpty.stories.d.ts +6 -0
- package/lib/utils/compareArrays/compareArrays.stories.d.ts +6 -0
- package/lib/utils/compareObjects/compareObjects.stories.d.ts +6 -0
- package/lib/utils/debounce/debounce.stories.d.ts +6 -0
- package/lib/utils/ffID/ffID.stories.d.ts +6 -0
- package/lib/utils/find/findAndInsert.d.ts +7 -0
- package/lib/utils/find/findAndInsert.stories.d.ts +7 -0
- package/lib/utils/findAndInsert/findAndInsert.stories.d.ts +7 -0
- package/lib/utils/getEncryptedData/getEncryptedData.stories.d.ts +6 -0
- package/lib/utils/getExtension/getExtension.stories.d.ts +6 -0
- package/lib/utils/throttle/throttle.stories.d.ts +6 -0
- package/lib/utils/truncateText/truncateText.stories.d.ts +6 -0
- package/package.json +2 -2
- package/src/StyleGuide/ColorPalette/colorPaletteList.ts +82 -12
- package/src/assets/Themes/BaseTheme.scss +38 -15
- package/src/assets/Themes/DarkTheme.scss +15 -1
- package/src/assets/fonts/Poppins-Bold.woff2 +0 -0
- package/src/assets/fonts/Poppins-Medium.woff2 +0 -0
- package/src/assets/fonts/Poppins-Regular.woff2 +0 -0
- package/src/assets/fonts/Poppins-SemiBold.woff2 +0 -0
- package/src/assets/icons/Header_preset.svg +13 -0
- package/src/assets/icons/add_file.svg +16 -4
- package/src/assets/icons/eye_open_icon.svg +2 -9
- package/src/assets/icons/hide_access_icon.svg +3 -0
- package/src/assets/icons/replace_icon.svg +6 -0
- package/src/assets/styles/_fonts.scss +7 -4
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.scss +58 -8
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.stories.tsx +83 -75
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.tsx +31 -18
- package/src/components/AllProjectsDropdown/types.ts +2 -0
- package/src/components/AppHeader/AppHeader.scss +2 -2
- package/src/components/AppHeader/AppHeader.stories.tsx +5 -1
- package/src/components/AppHeader/AppHeader.tsx +108 -101
- package/src/components/AppHeader/types.ts +1 -0
- package/src/components/AttachmentButton/AttachmentButton.tsx +10 -5
- package/src/components/EditTextField/EditTextField.tsx +3 -5
- package/src/components/Form/Form.stories.tsx +4 -8
- package/src/components/Form/Forms.tsx +11 -4
- package/src/components/Icon/iconList.ts +9 -3
- package/src/components/Input/Input.scss +5 -0
- package/src/components/Input/Input.stories.tsx +44 -0
- package/src/components/Input/Input.tsx +24 -19
- package/src/components/Input/types.ts +4 -0
- package/src/components/MenuOption/MenuOption.scss +24 -27
- package/src/components/MenuOption/MenuOption.stories.tsx +90 -35
- package/src/components/MenuOption/MenuOption.tsx +22 -20
- package/src/components/MenuOption/types.ts +1 -1
- package/src/components/Modal/Modal.stories.tsx +2 -2
- package/src/components/Modal/Modal.tsx +6 -2
- package/src/components/Modal/modal.scss +2 -3
- package/src/components/Modal/types.ts +4 -2
- package/src/components/TableTree/TableTree.scss +22 -7
- package/src/components/TableTree/TableTree.stories.tsx +41 -0
- package/src/components/TableTree/TableTree.tsx +55 -18
- package/src/components/Typography/Typography.scss +4 -4
- package/src/utils/capitalize/capitalize.stories.tsx +44 -0
- package/src/utils/capitalize/capitalize.tsx +4 -0
- package/lib/assets/fonts/Poppins-Bold.ttf +0 -0
- package/lib/assets/fonts/Poppins-Medium.ttf +0 -0
- package/lib/assets/fonts/Poppins-Regular.ttf +0 -0
- package/lib/assets/fonts/Poppins-SemiBold.ttf +0 -0
- /package/lib/components/{Excel → ExcelFile}/ContextMenu/ContextMenu.d.ts +0 -0
@@ -5,6 +5,7 @@ import Typography from '../Typography';
|
|
5
5
|
import HighlightText from '../HighlightText';
|
6
6
|
import Icon from '../Icon';
|
7
7
|
import Tooltip from '../Tooltip';
|
8
|
+
import { capitalize } from '../../utils/capitalize/capitalize';
|
8
9
|
|
9
10
|
const getErrorMessage = (
|
10
11
|
inputValue: string,
|
@@ -91,10 +92,7 @@ const EditTextField: FC<LabelEditTextFieldTypes> = ({
|
|
91
92
|
};
|
92
93
|
|
93
94
|
return (
|
94
|
-
<div
|
95
|
-
className="ff-label-edit-text-field"
|
96
|
-
ref={containerRef}
|
97
|
-
>
|
95
|
+
<div className="ff-label-edit-text-field" ref={containerRef}>
|
98
96
|
{isEditing ? (
|
99
97
|
<div className="ff-label-text-field">
|
100
98
|
<div className="ff-label-text-field-without-dropdown">
|
@@ -159,7 +157,7 @@ const EditTextField: FC<LabelEditTextFieldTypes> = ({
|
|
159
157
|
<HighlightText text={inputValue} highlight={highlightText} />
|
160
158
|
</span>
|
161
159
|
)}
|
162
|
-
<Tooltip title={editIcon?.name ?? '
|
160
|
+
<Tooltip title={capitalize(editIcon?.name || '') ?? 'Edit'}>
|
163
161
|
<Icon
|
164
162
|
color={editIcon?.color ?? 'var(--label-edit-cancel-icon)'}
|
165
163
|
height={editIcon?.height ?? 20}
|
@@ -95,7 +95,7 @@ export const WithDefaultValues: Story = {
|
|
95
95
|
<div>
|
96
96
|
<Input
|
97
97
|
type="text"
|
98
|
-
label=
|
98
|
+
label="Username"
|
99
99
|
disabled={false}
|
100
100
|
{...register('username', {
|
101
101
|
required: {
|
@@ -354,10 +354,10 @@ export const WithSubmissionOutside: Story = {
|
|
354
354
|
formRef.current.clearErrors();
|
355
355
|
};
|
356
356
|
|
357
|
-
const handleReset = () => {
|
357
|
+
const handleReset = () => {
|
358
358
|
formRef.current.reset();
|
359
359
|
formRef.current.clearErrors();
|
360
|
-
}
|
360
|
+
};
|
361
361
|
|
362
362
|
const footerContent = (
|
363
363
|
<>
|
@@ -382,11 +382,7 @@ export const WithSubmissionOutside: Story = {
|
|
382
382
|
onClick={() => setIsDrawerOpen(false)}
|
383
383
|
label="Cancel"
|
384
384
|
/>
|
385
|
-
<Button
|
386
|
-
variant="secondary"
|
387
|
-
onClick={handleReset}
|
388
|
-
label="Reset"
|
389
|
-
/>
|
385
|
+
<Button variant="secondary" onClick={handleReset} label="Reset" />
|
390
386
|
<Button
|
391
387
|
variant="secondary"
|
392
388
|
onClick={handleCreateAndContinue}
|
@@ -4,7 +4,11 @@ import Form from './Form';
|
|
4
4
|
interface FormProps<T extends Form.FieldValues> extends Form.UseFormProps<T> {
|
5
5
|
id?: string;
|
6
6
|
onSubmit: Form.SubmitHandler<T>;
|
7
|
-
children: (
|
7
|
+
children: (
|
8
|
+
methods: ReturnType<typeof Form.useForm<T>> & {
|
9
|
+
Form: typeof Form;
|
10
|
+
}
|
11
|
+
) => React.ReactNode;
|
8
12
|
}
|
9
13
|
|
10
14
|
const Forms = <T extends Form.FieldValues>(
|
@@ -14,15 +18,18 @@ const Forms = <T extends Form.FieldValues>(
|
|
14
18
|
const methods = Form.useForm<T>(rest);
|
15
19
|
|
16
20
|
const { handleSubmit } = methods;
|
17
|
-
|
21
|
+
const extendedMethods = {
|
22
|
+
...methods,
|
23
|
+
Form,
|
24
|
+
};
|
18
25
|
useImperativeHandle(ref, () => ({
|
19
26
|
submit: handleSubmit(onSubmit),
|
20
|
-
...
|
27
|
+
...extendedMethods,
|
21
28
|
}));
|
22
29
|
|
23
30
|
return (
|
24
31
|
<form id={id} onSubmit={handleSubmit(onSubmit)}>
|
25
|
-
{children(
|
32
|
+
{children(extendedMethods)}
|
26
33
|
</form>
|
27
34
|
);
|
28
35
|
};
|
@@ -30,6 +30,7 @@ import FireflinkIcon from '../../assets/Icons/fireflink_icon.svg?react';
|
|
30
30
|
import Tick from '../../assets/Icons/tick_icon.svg?react';
|
31
31
|
import Search from '../../assets/icons/search.svg?react';
|
32
32
|
import Filter from '../../assets/icons/filter.svg?react';
|
33
|
+
|
33
34
|
import RightArrow from '../../assets/icons/right_arrow_icon.svg?react';
|
34
35
|
import LeftArrow from '../../assets/icons/left_arrow_icon.svg?react';
|
35
36
|
import ClockIcon from '../../assets/icons/clock_icon.svg?react';
|
@@ -111,6 +112,7 @@ import AndroidIcon from '../../assets/icons/android_icon.svg?react';
|
|
111
112
|
import NoAccessIcon from '../../assets/icons/no_access_icon.svg?react';
|
112
113
|
import FullAccessIcon from '../../assets/icons/full_access_icon.svg?react';
|
113
114
|
import ViewAccessIcon from '../../assets/icons/view_access_icon.svg?react';
|
115
|
+
import HideAccessIcon from '../../assets/icons/hide_access_icon.svg?react';
|
114
116
|
import AddLocator from '../../assets/icons/add_locator.svg?react';
|
115
117
|
import PlusUserIcon from '../../assets/icons/plus_user_icon.svg?react';
|
116
118
|
|
@@ -203,9 +205,12 @@ import QuickRunSettingIcon from '../../assets/icons/quick_run_setting_icon.svg?r
|
|
203
205
|
import RunManualTestcaseIcon from '../../assets/icons/run_manual_testcase_icon.svg?react';
|
204
206
|
import RunAutomationScriptsIcon from '../../assets/icons/run_automation_scripts_icon.svg?react';
|
205
207
|
import EyeOpenIcon from '../../assets/icons/eye_open_icon.svg?react';
|
208
|
+
import ReplaceIcon from '../../assets/icons/replace_icon.svg?react';
|
209
|
+
import HeaderPreset from '../../assets/icons/Header_preset.svg?react';
|
210
|
+
|
206
211
|
|
207
|
-
Components['delete_info'] = DeleteInfoIcon;
|
208
212
|
Components['success'] = ToastSuccessIcon;
|
213
|
+
Components['delete_info'] = DeleteInfoIcon;
|
209
214
|
Components['warning'] = WarningIcon;
|
210
215
|
Components['toast_info'] = ToastInfoIcon;
|
211
216
|
Components['error'] = ToastErrorIcon;
|
@@ -248,7 +253,6 @@ Components['impactList'] = ImpactListIcon;
|
|
248
253
|
Components['beautify_icon'] = BeautifyIcon;
|
249
254
|
Components['add_variable'] = AddVariable;
|
250
255
|
|
251
|
-
|
252
256
|
Components['formate_painter'] = FormatePainter;
|
253
257
|
Components['bold'] = Bold;
|
254
258
|
Components['italic'] = Italic;
|
@@ -345,6 +349,7 @@ Components['linked_defects'] = LinkedDefects;
|
|
345
349
|
Components['no_access_icon'] = NoAccessIcon;
|
346
350
|
Components['full_access_icon'] = FullAccessIcon;
|
347
351
|
Components['view_access_icon'] = ViewAccessIcon;
|
352
|
+
Components['hide_access_icon'] = HideAccessIcon;
|
348
353
|
Components['eye_closed'] = EyeClosed;
|
349
354
|
Components['attachment_icon'] = AttachmentIcon;
|
350
355
|
Components['authorization_icon'] = AuthorizationIcon;
|
@@ -404,6 +409,7 @@ Components['quick_run_setting'] = QuickRunSettingIcon;
|
|
404
409
|
Components['run_manual_testcase'] = RunManualTestcaseIcon;
|
405
410
|
Components['run_automation_scripts'] = RunAutomationScriptsIcon;
|
406
411
|
Components['eye_open_icon'] = EyeOpenIcon;
|
407
|
-
|
412
|
+
Components['replace_icon']=ReplaceIcon;
|
413
|
+
Components['header_preset'] = HeaderPreset;
|
408
414
|
|
409
415
|
export default Components;
|
@@ -51,6 +51,50 @@ export const DisabledWithValue: Story = {
|
|
51
51
|
},
|
52
52
|
};
|
53
53
|
|
54
|
+
export const WithoutLabel: Story = {
|
55
|
+
render: () => {
|
56
|
+
const [value, setValue] = useState('');
|
57
|
+
const [error, setError] = useState<boolean>(false);
|
58
|
+
const [helperText, setHelperText] = useState<string>();
|
59
|
+
|
60
|
+
const onChangeHandler = (event: ChangeEvent<HTMLInputElement>) => {
|
61
|
+
const value = event.target.value;
|
62
|
+
if (event.target) {
|
63
|
+
if (value.length <= 0) {
|
64
|
+
setError(true);
|
65
|
+
setHelperText(`${event?.target?.name} is required`);
|
66
|
+
} else if (value.length >= 10) {
|
67
|
+
setError(true);
|
68
|
+
setHelperText(`Name should be within 10 characters`);
|
69
|
+
} else {
|
70
|
+
setError(false);
|
71
|
+
setHelperText('');
|
72
|
+
}
|
73
|
+
}
|
74
|
+
setValue(value);
|
75
|
+
};
|
76
|
+
return (
|
77
|
+
<>
|
78
|
+
<Input
|
79
|
+
{...defaultArgs}
|
80
|
+
type="text"
|
81
|
+
onChange={onChangeHandler}
|
82
|
+
disabled={false}
|
83
|
+
value={value}
|
84
|
+
name="Name"
|
85
|
+
label="Name"
|
86
|
+
placeholder="Enter name here"
|
87
|
+
variant="primary"
|
88
|
+
required={true}
|
89
|
+
error={error}
|
90
|
+
helperText={helperText}
|
91
|
+
isLabelRequired={false}
|
92
|
+
/>
|
93
|
+
</>
|
94
|
+
);
|
95
|
+
},
|
96
|
+
};
|
97
|
+
|
54
98
|
export const Controlled: Story = {
|
55
99
|
render: () => {
|
56
100
|
const [value, setValue] = useState('');
|
@@ -24,6 +24,7 @@ const Input = ({
|
|
24
24
|
maxValue = Infinity,
|
25
25
|
transparentBackground = false,
|
26
26
|
size = 'small',
|
27
|
+
isLabelRequired = true,
|
27
28
|
...props
|
28
29
|
}: InputProps) => {
|
29
30
|
const isValueFilled = !checkEmpty(value);
|
@@ -34,26 +35,29 @@ const Input = ({
|
|
34
35
|
'ff-input-container--disabled': !!disabled,
|
35
36
|
})}
|
36
37
|
>
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
{required && <span className="required-asterisk">*</span>}
|
47
|
-
<span
|
48
|
-
className={classNames(`ff-input-label ff-input-label--${variant}`, {
|
49
|
-
'ff-input-label--no-hover': !!value,
|
50
|
-
'ff-input-label--disabled': !!disabled,
|
51
|
-
'ff-input-label--danger': !!error,
|
52
|
-
})}
|
38
|
+
{isLabelRequired && (
|
39
|
+
<label
|
40
|
+
htmlFor={name}
|
41
|
+
className={classNames(
|
42
|
+
`ff-input-label-container ff-input-label-container--${size}`,
|
43
|
+
{
|
44
|
+
'ff-input-label-container--danger': !!error,
|
45
|
+
}
|
46
|
+
)}
|
53
47
|
>
|
54
|
-
{
|
55
|
-
|
56
|
-
|
48
|
+
{required && <span className="required-asterisk">*</span>}
|
49
|
+
<span
|
50
|
+
className={classNames(`ff-input-label ff-input-label--${variant}`, {
|
51
|
+
'ff-input-label--no-hover': !!value,
|
52
|
+
'ff-input-label--disabled': !!disabled,
|
53
|
+
'ff-input-label--danger': !!error,
|
54
|
+
})}
|
55
|
+
>
|
56
|
+
{label}
|
57
|
+
</span>
|
58
|
+
</label>
|
59
|
+
)}
|
60
|
+
|
57
61
|
<input
|
58
62
|
name={name}
|
59
63
|
value={value}
|
@@ -68,6 +72,7 @@ const Input = ({
|
|
68
72
|
'ff-input--disabled': !!disabled,
|
69
73
|
'ff-input--danger': !!error,
|
70
74
|
'ff-input--no-border': !!noBorder,
|
75
|
+
'ff-input--placeholder': !isLabelRequired,
|
71
76
|
},
|
72
77
|
`${className}`
|
73
78
|
)}
|
@@ -47,37 +47,34 @@
|
|
47
47
|
.ff-option-card {
|
48
48
|
position: fixed;
|
49
49
|
margin: 4px;
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
50
|
+
border: 1px solid var(--option-card-border-color);
|
51
|
+
background: var(--option-card-bg-color);
|
52
|
+
overflow: hidden;
|
53
|
+
min-height: 32px;
|
54
|
+
min-width: 112px;
|
55
|
+
width: max-content;
|
56
|
+
border-radius: 4px;
|
57
|
+
.ff-options {
|
58
|
+
@extend .fontSm;
|
59
|
+
cursor: pointer;
|
60
|
+
border-radius: 3px;
|
61
|
+
display: flex;
|
62
|
+
align-items: center;
|
63
|
+
padding: 8px;
|
64
|
+
gap: 8px;
|
65
|
+
&:hover {
|
66
|
+
background-color: var(--hover-color);
|
67
|
+
}
|
68
|
+
label {
|
61
69
|
cursor: pointer;
|
62
|
-
border-radius: 3px;
|
63
|
-
display: flex;
|
64
|
-
align-items: center;
|
65
|
-
padding: 8px;
|
66
|
-
gap: 8px;
|
67
|
-
&:hover {
|
68
|
-
background-color: var(--hover-color);
|
69
|
-
}
|
70
|
-
label {
|
71
|
-
cursor: pointer;
|
72
|
-
}
|
73
70
|
}
|
71
|
+
}
|
74
72
|
|
75
|
-
|
76
|
-
|
73
|
+
.ff-disable-option {
|
74
|
+
opacity: 0.5;
|
75
|
+
cursor: no-drop;
|
76
|
+
label {
|
77
77
|
cursor: no-drop;
|
78
|
-
label {
|
79
|
-
cursor: no-drop;
|
80
|
-
}
|
81
78
|
}
|
82
79
|
}
|
83
80
|
}
|
@@ -13,28 +13,33 @@ const meta: Meta<typeof MenuOption> = {
|
|
13
13
|
argTypes: {
|
14
14
|
iconName: {
|
15
15
|
control: 'text',
|
16
|
+
description: 'Name of the icon to display in the button.',
|
16
17
|
defaultValue: 'more',
|
17
18
|
},
|
18
19
|
labelName: {
|
19
20
|
control: 'text',
|
20
|
-
|
21
|
+
description: 'Label text displayed beside the icon.',
|
22
|
+
defaultValue: 'Menu',
|
21
23
|
},
|
22
24
|
tooltipTitle: {
|
23
25
|
control: 'text',
|
26
|
+
description: 'Tooltip text displayed on hover.',
|
24
27
|
defaultValue: 'Select an option',
|
25
28
|
},
|
26
29
|
tooltipPlacement: {
|
27
30
|
control: {
|
28
|
-
type: '
|
29
|
-
options: ['top', 'down', 'left', 'right'],
|
31
|
+
type: 'text',
|
32
|
+
options: ['top', 'down', 'left', 'right'],
|
30
33
|
},
|
34
|
+
description: 'Placement of the tooltip relative to the button.',
|
31
35
|
defaultValue: 'top',
|
32
36
|
},
|
33
37
|
dropdownPlacement: {
|
34
38
|
control: {
|
35
|
-
type: '
|
36
|
-
options: ['top', 'down', 'left', 'right'],
|
39
|
+
type: 'text',
|
40
|
+
options: ['top', 'down', 'left', 'right'],
|
37
41
|
},
|
42
|
+
description: 'Placement of the dropdown menu relative to the button.',
|
38
43
|
defaultValue: 'down',
|
39
44
|
},
|
40
45
|
},
|
@@ -57,46 +62,96 @@ const handleOptionClick = (option: { label: string }) => {
|
|
57
62
|
alert(`Option clicked: ${option.label}`);
|
58
63
|
};
|
59
64
|
|
60
|
-
|
65
|
+
|
66
|
+
export const ControlledMenuOption: Story = {
|
67
|
+
args: {
|
68
|
+
iconName: 'more',
|
69
|
+
labelName: 'Controlled Menu',
|
70
|
+
tooltipTitle: 'Select an option',
|
71
|
+
dropdownPlacement: "top",
|
72
|
+
},
|
61
73
|
render: (args) => (
|
62
|
-
<MenuOption
|
63
|
-
iconName="more"
|
64
|
-
labelName={args.labelName}
|
65
|
-
options={options}
|
66
|
-
tooltipTitle={args.tooltipTitle}
|
67
|
-
tooltipPlacement={args.tooltipPlacement}
|
68
|
-
dropdownPlacement="top" // Override dropdown position to top
|
69
|
-
onOptionClick={handleOptionClick}
|
70
|
-
/>
|
74
|
+
<MenuOption {...args} options={options} onOptionClick={handleOptionClick} />
|
71
75
|
),
|
76
|
+
parameters: {
|
77
|
+
docs: {
|
78
|
+
description: {
|
79
|
+
story:
|
80
|
+
'A controlled `MenuOption` with customizable tooltip and dropdown placement.',
|
81
|
+
},
|
82
|
+
},
|
83
|
+
},
|
72
84
|
};
|
73
85
|
|
74
|
-
|
86
|
+
|
87
|
+
export const MenuOptionTop: Story = {
|
88
|
+
args: {
|
89
|
+
...ControlledMenuOption.args,
|
90
|
+
dropdownPlacement: 'top',
|
91
|
+
},
|
75
92
|
render: (args) => (
|
76
|
-
<MenuOption
|
77
|
-
iconName="more"
|
78
|
-
labelName={args.labelName}
|
79
|
-
options={options}
|
80
|
-
tooltipTitle={args.tooltipTitle}
|
81
|
-
tooltipPlacement={args.tooltipPlacement}
|
82
|
-
dropdownPlacement="down"
|
83
|
-
onOptionClick={handleOptionClick}
|
84
|
-
/>
|
93
|
+
<MenuOption {...args} options={options} onOptionClick={handleOptionClick} />
|
85
94
|
),
|
95
|
+
parameters: {
|
96
|
+
docs: {
|
97
|
+
description: {
|
98
|
+
story: 'Dropdown menu positioned above the button.',
|
99
|
+
},
|
100
|
+
},
|
101
|
+
},
|
86
102
|
};
|
87
103
|
|
88
|
-
|
104
|
+
|
105
|
+
export const MenuOptionBottom: Story = {
|
106
|
+
args: {
|
107
|
+
...ControlledMenuOption.args,
|
108
|
+
dropdownPlacement: 'down',
|
109
|
+
},
|
89
110
|
render: (args) => (
|
90
|
-
<MenuOption
|
91
|
-
iconName="more"
|
92
|
-
labelName={args.labelName}
|
93
|
-
options={options}
|
94
|
-
tooltipTitle={args.tooltipTitle}
|
95
|
-
tooltipPlacement={args.tooltipPlacement}
|
96
|
-
dropdownPlacement="right"
|
97
|
-
onOptionClick={handleOptionClick}
|
98
|
-
/>
|
111
|
+
<MenuOption {...args} options={options} onOptionClick={handleOptionClick} />
|
99
112
|
),
|
113
|
+
parameters: {
|
114
|
+
docs: {
|
115
|
+
description: {
|
116
|
+
story: 'Dropdown menu positioned below the button.',
|
117
|
+
},
|
118
|
+
},
|
119
|
+
},
|
120
|
+
};
|
121
|
+
|
122
|
+
|
123
|
+
export const MenuOptionLeft: Story = {
|
124
|
+
args: {
|
125
|
+
...ControlledMenuOption.args,
|
126
|
+
dropdownPlacement: 'left',
|
127
|
+
},
|
128
|
+
render: (args) => (
|
129
|
+
<MenuOption {...args} options={options} onOptionClick={handleOptionClick} />
|
130
|
+
),
|
131
|
+
parameters: {
|
132
|
+
docs: {
|
133
|
+
description: {
|
134
|
+
story: 'Dropdown menu positioned to the left of the button.',
|
135
|
+
},
|
136
|
+
},
|
137
|
+
},
|
138
|
+
};
|
139
|
+
|
140
|
+
export const MenuOptionRight: Story = {
|
141
|
+
args: {
|
142
|
+
...ControlledMenuOption.args,
|
143
|
+
dropdownPlacement: 'right',
|
144
|
+
},
|
145
|
+
render: (args) => (
|
146
|
+
<MenuOption {...args} options={options} onOptionClick={handleOptionClick} />
|
147
|
+
),
|
148
|
+
parameters: {
|
149
|
+
docs: {
|
150
|
+
description: {
|
151
|
+
story: 'Dropdown menu positioned to the right of the button.',
|
152
|
+
},
|
153
|
+
},
|
154
|
+
},
|
100
155
|
};
|
101
156
|
|
102
157
|
export default meta;
|
@@ -45,43 +45,45 @@ const OptionCard = ({
|
|
45
45
|
menuRef,
|
46
46
|
closeDropdown,
|
47
47
|
zIndex,
|
48
|
-
|
48
|
+
dropdownPlacement,
|
49
49
|
}: OptionCardProps) => {
|
50
50
|
const themeContext = useContext(ThemeContext);
|
51
51
|
const currentTheme = themeContext?.currentTheme;
|
52
52
|
const [optionsHeight, setOptionsHeight] = useState(0);
|
53
|
+
const [optionsWidth, setOptionsWidth] = useState(0);
|
53
54
|
const optionCardRef = useRef<HTMLDivElement>(null);
|
54
55
|
|
55
56
|
useEffect(() => {
|
56
57
|
if (optionCardRef?.current) {
|
57
58
|
const rect = optionCardRef?.current?.getBoundingClientRect();
|
58
59
|
setOptionsHeight(rect?.height);
|
60
|
+
setOptionsWidth(rect?.width);
|
59
61
|
}
|
60
62
|
}, []);
|
61
63
|
|
62
64
|
useClickOutside(menuRef, closeDropdown, [optionCardRef]);
|
63
65
|
|
64
66
|
const style = (() => {
|
65
|
-
switch (
|
67
|
+
switch (dropdownPlacement) {
|
66
68
|
case 'top':
|
67
69
|
return {
|
68
70
|
top: menuPosition.top - optionsHeight - 7,
|
69
|
-
left: menuPosition.
|
71
|
+
left: menuPosition.left - 4,
|
70
72
|
};
|
71
73
|
case 'down':
|
72
74
|
return {
|
73
|
-
top: menuPosition.
|
74
|
-
left: menuPosition.
|
75
|
+
top: menuPosition.top + 18,
|
76
|
+
left: menuPosition.left - 4,
|
75
77
|
};
|
76
78
|
case 'left':
|
77
79
|
return {
|
78
|
-
top: menuPosition.top,
|
79
|
-
|
80
|
+
top: menuPosition.top - 4,
|
81
|
+
left: menuPosition.left - optionsWidth - 7,
|
80
82
|
};
|
81
83
|
case 'right':
|
82
84
|
return {
|
83
|
-
top: menuPosition.top,
|
84
|
-
left: menuPosition.
|
85
|
+
top: menuPosition.top - 4,
|
86
|
+
left: menuPosition.left + 20,
|
85
87
|
};
|
86
88
|
default:
|
87
89
|
return {
|
@@ -94,14 +96,12 @@ const OptionCard = ({
|
|
94
96
|
return createPortal(
|
95
97
|
<div
|
96
98
|
className={classNames('ff-option-card', currentTheme)}
|
97
|
-
ref={optionCardRef}
|
98
99
|
style={{ ...style, zIndex }}
|
100
|
+
ref={optionCardRef}
|
99
101
|
>
|
100
|
-
|
101
|
-
{
|
102
|
-
|
103
|
-
))}
|
104
|
-
</div>
|
102
|
+
{options.map((opt) => (
|
103
|
+
<Option key={opt.label} option={opt} onClick={onClick} />
|
104
|
+
))}
|
105
105
|
</div>,
|
106
106
|
document.body
|
107
107
|
);
|
@@ -126,10 +126,11 @@ const MenuOption = ({
|
|
126
126
|
const menuRef = useRef<HTMLDivElement>(null);
|
127
127
|
const [menuPosition, setMenuPosition] = useState({
|
128
128
|
top: 0,
|
129
|
-
|
129
|
+
left: 0,
|
130
130
|
height: 0,
|
131
|
-
|
131
|
+
right: 0,
|
132
132
|
rightSpaceAvailable: 0,
|
133
|
+
bottomSpaceAvailable: 0,
|
133
134
|
});
|
134
135
|
|
135
136
|
const closeDropDown = () => setIsClicked(false);
|
@@ -151,10 +152,11 @@ const MenuOption = ({
|
|
151
152
|
|
152
153
|
setMenuPosition({
|
153
154
|
top: rect.top,
|
155
|
+
left: rect.left,
|
154
156
|
height: rect.height,
|
157
|
+
right: rect.right,
|
155
158
|
rightSpaceAvailable: document.body.clientWidth - rect.right,
|
156
|
-
|
157
|
-
fromBottom: window.innerHeight - rect.bottom,
|
159
|
+
bottomSpaceAvailable: window.innerHeight - menuRef.current.offsetTop,
|
158
160
|
});
|
159
161
|
}
|
160
162
|
};
|
@@ -199,7 +201,7 @@ const MenuOption = ({
|
|
199
201
|
menuRef={menuRef}
|
200
202
|
closeDropdown={closeDropDown}
|
201
203
|
zIndex={zIndex}
|
202
|
-
|
204
|
+
dropdownPlacement={dropdownPlacement}
|
203
205
|
/>
|
204
206
|
)}
|
205
207
|
</div>
|
@@ -26,7 +26,7 @@ export const DefaultModalStory: Story = {
|
|
26
26
|
footerContent: <Button variant="primary" label="continue" />,
|
27
27
|
customWidth: '660px',
|
28
28
|
customHeight: 'auto',
|
29
|
-
|
29
|
+
border: '1px solid #E79B0866',
|
30
30
|
},
|
31
31
|
};
|
32
32
|
|
@@ -58,7 +58,7 @@ export const Controlled: Story = {
|
|
58
58
|
footerContent={<Button variant="primary" label="continue" />}
|
59
59
|
customWidth="660px"
|
60
60
|
customHeight="auto"
|
61
|
-
|
61
|
+
border="1px solid #E79B0866"
|
62
62
|
/>
|
63
63
|
)}
|
64
64
|
</>
|
@@ -22,7 +22,9 @@ const Modal: React.FC<ModalProps> = ({
|
|
22
22
|
customHeight = 'auto',
|
23
23
|
children,
|
24
24
|
zIndex = 999,
|
25
|
-
boxShadow = '
|
25
|
+
boxShadow = '',
|
26
|
+
border = '',
|
27
|
+
background='',
|
26
28
|
}) => {
|
27
29
|
useEffect(() => {
|
28
30
|
const handleKeyDown = (e: KeyboardEvent) => {
|
@@ -58,7 +60,9 @@ const Modal: React.FC<ModalProps> = ({
|
|
58
60
|
<div
|
59
61
|
style={{
|
60
62
|
boxShadow: boxShadow,
|
61
|
-
|
63
|
+
border: border,
|
64
|
+
borderRadius: '12px',
|
65
|
+
background: background,
|
62
66
|
}}
|
63
67
|
className="ff-modal-container"
|
64
68
|
>
|