pixel-react 1.4.6 → 1.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/lib/StyleGuide/ColorPalette/ColorPalette.stories.d.ts +6 -0
  3. package/lib/StyleGuide/Typography/Typography.stories.d.ts +6 -0
  4. package/lib/components/Accordion/Accordion.stories.d.ts +6 -0
  5. package/lib/components/AddResourceButton/AddButton.stories.d.ts +8 -0
  6. package/lib/components/AllProjectsDropdown/AllProjectsDropdown.d.ts +1 -1
  7. package/lib/components/AllProjectsDropdown/AllProjectsDropdown.stories.d.ts +7 -0
  8. package/lib/components/AllProjectsDropdown/types.d.ts +2 -0
  9. package/lib/components/AppHeader/AppHeader.stories.d.ts +7 -0
  10. package/lib/components/AppHeader/types.d.ts +1 -0
  11. package/lib/components/AttachmentButton/AttachmentButton.stories.d.ts +9 -0
  12. package/lib/components/Avatar/Avatar.stories.d.ts +10 -0
  13. package/lib/components/Button/Button.stories.d.ts +13 -0
  14. package/lib/components/Charts/DashboardDonutChart/DashboardDonutChart.stories.d.ts +7 -0
  15. package/lib/components/Charts/DonutChart/DonutChart.stories.d.ts +6 -0
  16. package/lib/components/Charts/PieChart/PieChart.stories.d.ts +7 -0
  17. package/lib/components/Charts/RadialChart/RadialChart.stories.d.ts +6 -0
  18. package/lib/components/Checkbox/Checkbox.stories.d.ts +8 -0
  19. package/lib/components/Chip/Chip.stories.d.ts +14 -0
  20. package/lib/components/DatePicker/DatePicker.stories.d.ts +9 -0
  21. package/lib/components/DragAndDrop/DragAndDrop.stories.d.ts +6 -0
  22. package/lib/components/Drawer/Drawer.stories.d.ts +12 -0
  23. package/lib/components/ExcelFile/ColorBarselector/ColorBarSelector.d.ts +8 -0
  24. package/lib/components/ExcelFile/ExcelFile/Excel/ActiveCell.d.ts +7 -0
  25. package/lib/components/ExcelFile/ExcelFile/Excel/Cell.d.ts +4 -0
  26. package/lib/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.d.ts +5 -0
  27. package/lib/components/ExcelFile/ExcelFile/Excel/Copied.d.ts +3 -0
  28. package/lib/components/ExcelFile/ExcelFile/Excel/CornerIndicator.d.ts +5 -0
  29. package/lib/components/ExcelFile/ExcelFile/Excel/DataEditor.d.ts +5 -0
  30. package/lib/components/ExcelFile/ExcelFile/Excel/DataViewer.d.ts +8 -0
  31. package/lib/components/ExcelFile/ExcelFile/Excel/FloatingRect.d.ts +10 -0
  32. package/lib/components/ExcelFile/ExcelFile/Excel/HeaderRow.d.ts +3 -0
  33. package/lib/components/ExcelFile/ExcelFile/Excel/Row.d.ts +3 -0
  34. package/lib/components/ExcelFile/ExcelFile/Excel/RowIndicator.d.ts +5 -0
  35. package/lib/components/ExcelFile/ExcelFile/Excel/Selected.d.ts +3 -0
  36. package/lib/components/ExcelFile/ExcelFile/Excel/Spreadsheet.d.ts +80 -0
  37. package/lib/components/ExcelFile/ExcelFile/Excel/Table.d.ts +3 -0
  38. package/lib/components/ExcelFile/ExcelFile/Excel/actions.d.ts +174 -0
  39. package/lib/components/ExcelFile/ExcelFile/Excel/areModelsEqual.d.ts +1 -0
  40. package/lib/components/ExcelFile/ExcelFile/Excel/context.d.ts +8 -0
  41. package/lib/components/ExcelFile/ExcelFile/Excel/engine/engine.d.ts +22 -0
  42. package/lib/components/ExcelFile/ExcelFile/Excel/engine/formula.d.ts +17 -0
  43. package/lib/components/ExcelFile/ExcelFile/Excel/engine/index.d.ts +2 -0
  44. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-graph.d.ts +21 -0
  45. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-hash.d.ts +3 -0
  46. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-set.d.ts +24 -0
  47. package/lib/components/ExcelFile/ExcelFile/Excel/index.d.ts +13 -0
  48. package/lib/components/ExcelFile/ExcelFile/Excel/matrix.d.ts +67 -0
  49. package/lib/components/ExcelFile/ExcelFile/Excel/point-range.d.ts +22 -0
  50. package/lib/components/ExcelFile/ExcelFile/Excel/point.d.ts +11 -0
  51. package/lib/components/ExcelFile/ExcelFile/Excel/reducer.d.ts +27 -0
  52. package/lib/components/ExcelFile/ExcelFile/Excel/selection.d.ts +95 -0
  53. package/lib/components/ExcelFile/ExcelFile/Excel/types.d.ts +178 -0
  54. package/lib/components/ExcelFile/ExcelFile/Excel/use-dispatch.d.ts +3 -0
  55. package/lib/components/ExcelFile/ExcelFile/Excel/use-selector.d.ts +3 -0
  56. package/lib/components/ExcelFile/ExcelFile/Excel/util.d.ts +44 -0
  57. package/lib/components/ExcelFile/ExcelFile/ExcelFile.d.ts +19 -0
  58. package/lib/components/ExcelFile/ExcelFile.stories.d.ts +6 -0
  59. package/lib/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.d.ts +12 -0
  60. package/lib/components/ExcelFile/ExcelToolBar/ExcelToolBar.d.ts +15 -0
  61. package/lib/components/ExcelFile/Types.d.ts +129 -0
  62. package/lib/components/ExcelFile/index.d.ts +1 -0
  63. package/lib/components/ExpandableMenu/ExpandableMenu.stories.d.ts +7 -0
  64. package/lib/components/FF_Captcha/captcha.stories.d.ts +8 -0
  65. package/lib/components/FileDropzone/FileDropzone.stories.d.ts +8 -0
  66. package/lib/components/Form/Form.stories.d.ts +7 -0
  67. package/lib/components/Form/Forms.d.ts +3 -1
  68. package/lib/components/GridLayout/GridLayout.stories.d.ts +8 -0
  69. package/lib/components/HighlightText/HighlightText.stories.d.ts +6 -0
  70. package/lib/components/Icon/Icon.stories.d.ts +8 -0
  71. package/lib/components/IconButton/IconButton.stories.d.ts +7 -0
  72. package/lib/components/IconRadioGroup/IconRadioGroup.stories.d.ts +7 -0
  73. package/lib/components/Input/Input.d.ts +1 -1
  74. package/lib/components/Input/Input.stories.d.ts +9 -0
  75. package/lib/components/Input/types.d.ts +4 -0
  76. package/lib/components/InputWithDropdown/InputWithDropdown.stories.d.ts +9 -0
  77. package/lib/components/LabelEditTextField/LabelEditTextField.stories.d.ts +11 -0
  78. package/lib/components/LazyLoad/LazyLoad.stories.d.ts +6 -0
  79. package/lib/components/MachineInputField/MachineInputField.stories.d.ts +6 -0
  80. package/lib/components/MenuOption/MenuOption.stories.d.ts +16 -0
  81. package/lib/components/MenuOption/types.d.ts +1 -1
  82. package/lib/components/MiniModal/MiniModal.stories.d.ts +10 -0
  83. package/lib/components/Modal/Modal.stories.d.ts +7 -0
  84. package/lib/components/Modal/types.d.ts +4 -2
  85. package/lib/components/ModulesChip/ModuleChip.stories.d.ts +6 -0
  86. package/lib/components/MultiSelect/MultiSelect.stories.d.ts +10 -0
  87. package/lib/components/NLPInput/NlpInput.stories.d.ts +7 -0
  88. package/lib/components/Paper/Paper.stories.d.ts +11 -0
  89. package/lib/components/RadioButton/RadioButton.stories.d.ts +10 -0
  90. package/lib/components/RadioGroup/RadioGroup.stories.d.ts +9 -0
  91. package/lib/components/Search/Search.stories.d.ts +6 -0
  92. package/lib/components/Select/Select.stories.d.ts +13 -0
  93. package/lib/components/Select/components/Dropdown/Dropdown.d.ts +4 -0
  94. package/lib/components/Select/components/Dropdown/dropdownTypes.d.ts +17 -0
  95. package/lib/components/SequentialConnectingBranch/SequentialConnectingBranch.stories.d.ts +6 -0
  96. package/lib/components/StateDropdown/StateDropdown.stories.d.ts +10 -0
  97. package/lib/components/StatusButton/StatusButton.stories.d.ts +14 -0
  98. package/lib/components/Table/Table.stories.d.ts +13 -0
  99. package/lib/components/TableTree/TableTree.d.ts +2 -1
  100. package/lib/components/TableTree/TableTree.stories.d.ts +7 -0
  101. package/lib/components/Tabs/Tabs.stories.d.ts +9 -0
  102. package/lib/components/TextArea/Textarea.stories.d.ts +9 -0
  103. package/lib/components/Toast/Toast.stories.d.ts +6 -0
  104. package/lib/components/Toastify/Toastify.stories.d.ts +6 -0
  105. package/lib/components/Toggle/Toggle.stories.d.ts +12 -0
  106. package/lib/components/Tooltip/Tooltip.stories.d.ts +15 -0
  107. package/lib/components/Typography/Typography.stories.d.ts +10 -0
  108. package/lib/components/VariableInput/VariableInput.stories.d.ts +6 -0
  109. package/lib/index.d.ts +17 -5
  110. package/lib/index.esm.js +212 -145
  111. package/lib/index.esm.js.map +1 -1
  112. package/lib/index.js +212 -145
  113. package/lib/index.js.map +1 -1
  114. package/lib/tsconfig.tsbuildinfo +1 -1
  115. package/lib/utils/capitalize/capitalize.d.ts +1 -0
  116. package/lib/utils/checkEmpty/checkEmpty.stories.d.ts +6 -0
  117. package/lib/utils/compareArrays/compareArrays.stories.d.ts +6 -0
  118. package/lib/utils/compareObjects/compareObjects.stories.d.ts +6 -0
  119. package/lib/utils/debounce/debounce.stories.d.ts +6 -0
  120. package/lib/utils/ffID/ffID.stories.d.ts +6 -0
  121. package/lib/utils/find/findAndInsert.d.ts +7 -0
  122. package/lib/utils/find/findAndInsert.stories.d.ts +7 -0
  123. package/lib/utils/findAndInsert/findAndInsert.stories.d.ts +7 -0
  124. package/lib/utils/getEncryptedData/getEncryptedData.stories.d.ts +6 -0
  125. package/lib/utils/getExtension/getExtension.stories.d.ts +6 -0
  126. package/lib/utils/throttle/throttle.stories.d.ts +6 -0
  127. package/lib/utils/truncateText/truncateText.stories.d.ts +6 -0
  128. package/package.json +2 -2
  129. package/src/StyleGuide/ColorPalette/colorPaletteList.ts +82 -12
  130. package/src/assets/Themes/BaseTheme.scss +38 -15
  131. package/src/assets/Themes/DarkTheme.scss +15 -1
  132. package/src/assets/fonts/Poppins-Bold.woff2 +0 -0
  133. package/src/assets/fonts/Poppins-Medium.woff2 +0 -0
  134. package/src/assets/fonts/Poppins-Regular.woff2 +0 -0
  135. package/src/assets/fonts/Poppins-SemiBold.woff2 +0 -0
  136. package/src/assets/icons/Header_preset.svg +13 -0
  137. package/src/assets/icons/add_file.svg +16 -4
  138. package/src/assets/icons/eye_open_icon.svg +2 -9
  139. package/src/assets/icons/hide_access_icon.svg +3 -0
  140. package/src/assets/icons/replace_icon.svg +6 -0
  141. package/src/assets/styles/_fonts.scss +7 -4
  142. package/src/components/AllProjectsDropdown/AllProjectsDropdown.scss +58 -8
  143. package/src/components/AllProjectsDropdown/AllProjectsDropdown.stories.tsx +83 -75
  144. package/src/components/AllProjectsDropdown/AllProjectsDropdown.tsx +31 -18
  145. package/src/components/AllProjectsDropdown/types.ts +2 -0
  146. package/src/components/AppHeader/AppHeader.scss +2 -2
  147. package/src/components/AppHeader/AppHeader.stories.tsx +5 -1
  148. package/src/components/AppHeader/AppHeader.tsx +108 -101
  149. package/src/components/AppHeader/types.ts +1 -0
  150. package/src/components/AttachmentButton/AttachmentButton.tsx +10 -5
  151. package/src/components/EditTextField/EditTextField.tsx +3 -5
  152. package/src/components/Form/Form.stories.tsx +4 -8
  153. package/src/components/Form/Forms.tsx +11 -4
  154. package/src/components/Icon/iconList.ts +9 -3
  155. package/src/components/Input/Input.scss +5 -0
  156. package/src/components/Input/Input.stories.tsx +44 -0
  157. package/src/components/Input/Input.tsx +24 -19
  158. package/src/components/Input/types.ts +4 -0
  159. package/src/components/MenuOption/MenuOption.scss +24 -27
  160. package/src/components/MenuOption/MenuOption.stories.tsx +90 -35
  161. package/src/components/MenuOption/MenuOption.tsx +22 -20
  162. package/src/components/MenuOption/types.ts +1 -1
  163. package/src/components/Modal/Modal.stories.tsx +2 -2
  164. package/src/components/Modal/Modal.tsx +6 -2
  165. package/src/components/Modal/modal.scss +2 -3
  166. package/src/components/Modal/types.ts +4 -2
  167. package/src/components/TableTree/TableTree.scss +22 -7
  168. package/src/components/TableTree/TableTree.stories.tsx +41 -0
  169. package/src/components/TableTree/TableTree.tsx +55 -18
  170. package/src/components/Typography/Typography.scss +4 -4
  171. package/src/utils/capitalize/capitalize.stories.tsx +44 -0
  172. package/src/utils/capitalize/capitalize.tsx +4 -0
  173. package/lib/assets/fonts/Poppins-Bold.ttf +0 -0
  174. package/lib/assets/fonts/Poppins-Medium.ttf +0 -0
  175. package/lib/assets/fonts/Poppins-Regular.ttf +0 -0
  176. package/lib/assets/fonts/Poppins-SemiBold.ttf +0 -0
  177. /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 ?? 'edit'}>
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='Username'
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: (methods: ReturnType<typeof Form.useForm<T>>) => React.ReactNode;
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
- ...methods,
27
+ ...extendedMethods,
21
28
  }));
22
29
 
23
30
  return (
24
31
  <form id={id} onSubmit={handleSubmit(onSubmit)}>
25
- {children(methods)}
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;
@@ -36,6 +36,11 @@
36
36
  &--no-border {
37
37
  border: none;
38
38
  }
39
+ &--placeholder {
40
+ &::placeholder {
41
+ opacity: 1;
42
+ }
43
+ }
39
44
  }
40
45
 
41
46
  .ff-input-label-container {
@@ -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
- <label
38
- htmlFor={name}
39
- className={classNames(
40
- `ff-input-label-container ff-input-label-container--${size}`,
41
- {
42
- 'ff-input-label-container--danger': !!error,
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
- {label}
55
- </span>
56
- </label>
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
  )}
@@ -78,4 +78,8 @@ export interface InputProps {
78
78
  * size for the input field
79
79
  */
80
80
  size?: 'small' | 'medium';
81
+ /**
82
+ * isLabelRequired for the input field without label,showing placeholder
83
+ */
84
+ isLabelRequired?: boolean;
81
85
  }
@@ -47,37 +47,34 @@
47
47
  .ff-option-card {
48
48
  position: fixed;
49
49
  margin: 4px;
50
-
51
- .ff-option-wrapper {
52
- border: 1px solid var(--option-card-border-color);
53
- background: var(--option-card-bg-color);
54
- overflow: hidden;
55
- min-height: 32px;
56
- min-width: 112px;
57
- width: max-content;
58
- border-radius: 4px;
59
- .ff-options {
60
- @extend .fontSm;
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
- .ff-disable-option {
76
- opacity: 0.5;
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
- defaultValue: 'Controlled Menu',
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: 'select',
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: 'select',
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
- export const ControlledMenuOptionTop: Story = {
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
- export const ControlledMenuOptionBottom: Story = {
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
- export const ControlledMenuOptionRight: Story = {
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
- dropdownPosition,
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 (dropdownPosition) {
67
+ switch (dropdownPlacement) {
66
68
  case 'top':
67
69
  return {
68
70
  top: menuPosition.top - optionsHeight - 7,
69
- left: menuPosition.rightSpaceAvailable + 12,
71
+ left: menuPosition.left - 4,
70
72
  };
71
73
  case 'down':
72
74
  return {
73
- top: menuPosition.bottom - 5,
74
- left: menuPosition.rightSpaceAvailable + 12,
75
+ top: menuPosition.top + 18,
76
+ left: menuPosition.left - 4,
75
77
  };
76
78
  case 'left':
77
79
  return {
78
- top: menuPosition.top,
79
- right: menuPosition.rightSpaceAvailable + 35,
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.rightSpaceAvailable + 35,
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
- <div className="ff-option-wrapper">
101
- {options.map((opt) => (
102
- <Option key={opt.label} option={opt} onClick={onClick} />
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
- bottom: 0,
129
+ left: 0,
130
130
  height: 0,
131
- fromBottom: 0,
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
- bottom: rect.bottom,
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
- dropdownPosition={dropdownPlacement}
204
+ dropdownPlacement={dropdownPlacement}
203
205
  />
204
206
  )}
205
207
  </div>
@@ -90,7 +90,7 @@ interface OptionCardProps {
90
90
  * @type {dropdownPosition}
91
91
  * @optional
92
92
  */
93
- dropdownPosition?: 'top' | 'down' | 'left' | 'right';
93
+ dropdownPlacement?: 'top' | 'down' | 'left' | 'right';
94
94
  }
95
95
 
96
96
  interface MenuOptionProps {
@@ -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
- boxShadow:'0px 1px 4px 0px #FFC600'
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
- boxShadow='0px 1px 4px 0px #FFC600'
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 = '0px 1px 4px 0px #FFC600',
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
- borderRadius: '12px' ,
63
+ border: border,
64
+ borderRadius: '12px',
65
+ background: background,
62
66
  }}
63
67
  className="ff-modal-container"
64
68
  >