pixel-react 1.0.2 → 1.0.4

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 (94) hide show
  1. package/lib/components/AddButton/AddButton.d.ts +5 -0
  2. package/lib/components/AddButton/AddButton.stories.d.ts +6 -0
  3. package/lib/components/AddButton/index.d.ts +1 -0
  4. package/lib/components/AddButton/types.d.ts +4 -0
  5. package/lib/components/AddResourceButton/type.d.ts +13 -10
  6. package/lib/components/InputWithDropdown/InputWithDropdown.d.ts +1 -1
  7. package/lib/components/InputWithDropdown/InputWithDropdown.stories.d.ts +1 -0
  8. package/lib/components/InputWithDropdown/types.d.ts +4 -0
  9. package/lib/components/MenuOption/types.d.ts +1 -1
  10. package/lib/components/Select/Select.d.ts +1 -1
  11. package/lib/components/Select/types.d.ts +5 -1
  12. package/lib/components/StateDropdown/StateDropdown.d.ts +3 -0
  13. package/lib/components/StateDropdown/StateDropdown.stories.d.ts +10 -0
  14. package/lib/components/StateDropdown/StateDropdownTypes.d.ts +11 -0
  15. package/lib/components/StateDropdown/index.d.ts +1 -0
  16. package/lib/components/StatusButton/StatusButton.d.ts +4 -0
  17. package/lib/components/StatusButton/StatusButton.stories.d.ts +14 -0
  18. package/lib/components/StatusButton/index.d.ts +1 -0
  19. package/lib/components/StatusButton/types.d.ts +35 -0
  20. package/lib/components/Tabs/Tabs.d.ts +1 -1
  21. package/lib/components/Tabs/Tabs.stories.d.ts +1 -0
  22. package/lib/components/Tabs/types.d.ts +6 -2
  23. package/lib/index.d.ts +76 -10
  24. package/lib/index.esm.js +287 -57
  25. package/lib/index.esm.js.map +1 -1
  26. package/lib/index.js +288 -56
  27. package/lib/index.js.map +1 -1
  28. package/lib/tsconfig.tsbuildinfo +1 -1
  29. package/package.json +1 -1
  30. package/src/StyleGuide/ColorPalette/ColorPalette.scss +4 -5
  31. package/src/StyleGuide/Typography/Typography.scss +4 -5
  32. package/src/assets/Themes/BaseTheme.scss +45 -16
  33. package/src/assets/Themes/DarkTheme.scss +48 -10
  34. package/src/assets/Themes/Theme.scss +7 -191
  35. package/src/assets/icons/active_license_icon.svg +3 -0
  36. package/src/assets/icons/delete.svg +2 -16
  37. package/src/assets/icons/delete_info.svg +17 -0
  38. package/src/assets/icons/details.svg +3 -0
  39. package/src/assets/icons/edit_icon.svg +5 -0
  40. package/src/assets/icons/expired_license_icon.svg +3 -0
  41. package/src/assets/icons/expiringSoon_license_icon.svg +3 -0
  42. package/src/assets/icons/export_collection_icon.svg +13 -0
  43. package/src/assets/icons/hide_icon.svg +9 -0
  44. package/src/assets/icons/impactList.svg +6 -0
  45. package/src/assets/icons/run_icon.svg +26 -0
  46. package/src/assets/icons/view_icon.svg +3 -0
  47. package/src/assets/utils/functionUtils.ts +5 -5
  48. package/src/components/Accordion/Accordion.scss +1 -2
  49. package/src/components/AddButton/AddButton.scss +38 -0
  50. package/src/components/AddButton/AddButton.stories.tsx +24 -0
  51. package/src/components/AddButton/AddButton.tsx +25 -0
  52. package/src/components/AddButton/index.ts +1 -0
  53. package/src/components/AddButton/types.ts +4 -0
  54. package/src/components/AddResourceButton/type.ts +42 -10
  55. package/src/components/Button/Button.scss +1 -1
  56. package/src/components/Button/index.ts +1 -1
  57. package/src/components/Charts/DonutChart/DonutChart.scss +1 -1
  58. package/src/components/Charts/RadialChart/RadialChart.scss +1 -1
  59. package/src/components/Drawer/Drawer.scss +9 -10
  60. package/src/components/ExpandableMenu/ExpandableMenu.scss +1 -1
  61. package/src/components/Icon/Icons.scss +5 -6
  62. package/src/components/Icon/iconList.ts +24 -2
  63. package/src/components/Input/Input.stories.tsx +1 -1
  64. package/src/components/InputWithDropdown/InputWithDropdown.stories.tsx +59 -2
  65. package/src/components/InputWithDropdown/InputWithDropdown.tsx +3 -1
  66. package/src/components/InputWithDropdown/types.ts +4 -0
  67. package/src/components/MenuOption/MenuOption.scss +1 -1
  68. package/src/components/MenuOption/types.ts +1 -1
  69. package/src/components/MultiSelect/MultiSelect.scss +1 -1
  70. package/src/components/RadioButton/RadioButton.scss +2 -3
  71. package/src/components/Search/Search.scss +71 -73
  72. package/src/components/Select/Select.tsx +29 -25
  73. package/src/components/Select/types.ts +5 -1
  74. package/src/components/StateDropdown/StateDropdown.stories.tsx +99 -0
  75. package/src/components/StateDropdown/StateDropdown.tsx +223 -0
  76. package/src/components/StateDropdown/StateDropdownTypes.tsx +21 -0
  77. package/src/components/StateDropdown/index.ts +1 -0
  78. package/src/components/StatusButton/StatusButton.scss +90 -0
  79. package/src/components/StatusButton/StatusButton.stories.tsx +91 -0
  80. package/src/components/StatusButton/StatusButton.tsx +40 -0
  81. package/src/components/StatusButton/index.ts +1 -0
  82. package/src/components/StatusButton/types.ts +45 -0
  83. package/src/components/Table/Table.scss +3 -3
  84. package/src/components/Tabs/Tabs.scss +3 -0
  85. package/src/components/Tabs/Tabs.stories.tsx +31 -0
  86. package/src/components/Tabs/Tabs.tsx +6 -1
  87. package/src/components/Tabs/types.ts +6 -2
  88. package/src/components/TextArea/Textarea.scss +1 -2
  89. package/src/components/Toggle/Toggle.scss +5 -4
  90. package/src/components/Tooltip/Tooltip.scss +1 -1
  91. package/src/index.ts +5 -0
  92. package/vite.config.js +1 -1
  93. package/lib/index.css +0 -404
  94. package/lib/index.esm.css +0 -404
@@ -1,11 +1,10 @@
1
- @import '../../assets/styles/colors';
2
- @import '../../assets/styles/fonts';
1
+ @use '../../assets/styles/fonts';
3
2
 
4
3
  .ff-drawer-container {
5
4
  .ff-overlay {
6
5
  position: fixed;
7
6
  inset: 0;
8
- background-color: $drawer-title-color;
7
+ background-color: var(--drawer-title-color);
9
8
  opacity: 0.5;
10
9
  }
11
10
 
@@ -16,7 +15,7 @@
16
15
  top: 0;
17
16
  bottom: 0;
18
17
  min-width: 450px;
19
- background-color: $primary-button-text-color;
18
+ background-color: var(--primary-button-text-color);
20
19
  z-index: 999;
21
20
  transform: translateX(100%);
22
21
  opacity: 0;
@@ -43,19 +42,19 @@
43
42
  &--x-large {
44
43
  transition: all 0.4s ease-in-out;
45
44
  border-radius: 5px;
46
- border: 2px solid $border-color;
45
+ border: 2px solid var(--border-color);
47
46
  }
48
47
 
49
48
  .ff-drawer-header {
50
49
  padding: 10px 8px 10px 8px;
51
50
  display: flex;
52
51
  gap: 10px;
53
- border-bottom: 2px solid $border-color;
52
+ border-bottom: 2px solid var(--border-color);
54
53
 
55
54
  .ff-drawer-title {
56
55
  @extend .fontSm;
57
56
  font-weight: 600;
58
- color: $drawer-title-color;
57
+ color: var(--drawer-title-color);
59
58
  display: flex;
60
59
  align-items: center;
61
60
  gap: 12px;
@@ -75,7 +74,7 @@
75
74
 
76
75
  .ff-expand-collapse-button {
77
76
  cursor: pointer;
78
- background-color: $button-bg-color;
77
+ background-color: var(--button-bg-color);
79
78
  outline: none;
80
79
  border: none;
81
80
  margin: 0;
@@ -91,7 +90,7 @@
91
90
  }
92
91
 
93
92
  .ff-drawer-body {
94
- background-color: $drawer-footer-bg;
93
+ background-color: var(--drawer-footer-bg);
95
94
  padding: 8px;
96
95
  height: calc(100vh - 76px);
97
96
  overflow: hidden auto;
@@ -109,7 +108,7 @@
109
108
  padding: 5px 16px 5px 16px;
110
109
  display: flex;
111
110
  justify-content: space-between;
112
- border-top: 2px solid $drawer-footer-border;
111
+ border-top: 2px solid var(--drawer-footer-border);
113
112
 
114
113
  .button-container {
115
114
  display: flex;
@@ -1,4 +1,4 @@
1
- @import '../../assets/styles/fonts';
1
+ @use '../../assets/styles/fonts';
2
2
 
3
3
  .ff-expandable-chip-menu {
4
4
  display: inline-flex;
@@ -1,4 +1,3 @@
1
- @import '../../assets/styles/colors';
2
1
 
3
2
  .ff-icon-container {
4
3
  display: flex;
@@ -12,10 +11,10 @@
12
11
  box-sizing: content-box;
13
12
  &:hover {
14
13
  border-radius: 50%;
15
- background-color: $drawer-footer-bg;
16
- box-shadow: 0px 0px 16px $toggle-strip-shadow;
14
+ background-color: var(--drawer-footer-bg);
15
+ box-shadow: 0px 0px 16px var(--toggle-strip-shadow);
17
16
  & > svg {
18
- color: $brand-color;
17
+ color: var(--brand-color);
19
18
  }
20
19
  }
21
20
  }
@@ -23,12 +22,12 @@
23
22
  .ff-icon-disabled {
24
23
  cursor: no-drop;
25
24
  & > svg {
26
- color: $toggle-strip-color;
25
+ color: var(--toggle-strip-color);
27
26
  }
28
27
  &:hover {
29
28
  box-shadow: none;
30
29
  & > svg {
31
- color: $toggle-strip-color;
30
+ color: var(--toggle-strip-color);
32
31
  }
33
32
  }
34
33
  }
@@ -5,7 +5,7 @@ import Logo from '../../assets/icons/logo.svg?react';
5
5
  import ArrowUp from '../../assets/icons/arrow_up.svg?react';
6
6
  import ArrowRight from '../../assets/icons/arrow_right.svg?react';
7
7
  import AccordionHeaderIcon from '../../assets/icons/accordion_header_icon.svg?react';
8
- import DeleteIcon from '../../assets/icons/delete.svg?react';
8
+ import DeleteInfoIcon from '../../assets/icons/delete_info.svg?react';
9
9
  import WarningIcon from '../../assets/icons/warning.svg?react';
10
10
  import ToastInfoIcon from '../../assets/icons/info.svg?react';
11
11
  import ToastErrorIcon from '../../assets/icons/error.svg?react';
@@ -29,9 +29,20 @@ import WrongMarkIcon from '../../assets/icons/wrong_mark.svg?react';
29
29
  import Tick from '../../assets/Icons/tick_icon.svg?react';
30
30
  import Search from '../../assets/icons/search.svg?react';
31
31
  import Filter from '../../assets/icons/filter.svg?react';
32
+ import Edit from '../../assets/icons/edit_icon.svg?react';
33
+ import ViewIcon from '../../assets/icons/view_icon.svg?react';
34
+ import HideIcon from '../../assets/icons/hide_icon.svg?react';
35
+ import ExportCollection from '../../assets/icons/export_collection_icon.svg?react';
36
+ import RunIcon from '../../assets/icons/run_icon.svg?react';
32
37
 
38
+ import ActiveLicenseIcon from '../../assets/icons/active_license_icon.svg?react';
39
+ import ExpiredLicenseIcon from '../../assets/icons/expired_license_icon.svg?react';
40
+ import ExpiringSoonLicenseIcon from '../../assets/icons/expiringSoon_license_icon.svg?react';
41
+ import DeleteIcon from '../../assets/icons/delete.svg?react';
42
+ import DetailsIcon from '../../assets/icons/details.svg?react';
43
+ import ImpactListIcon from '../../assets/icons/impactList.svg?react';
33
44
  //icons
34
- Components['delete'] = DeleteIcon;
45
+ Components['delete_info'] = DeleteInfoIcon;
35
46
  Components['success'] = ToastSuccessIcon;
36
47
  Components['warning'] = WarningIcon;
37
48
  Components['info'] = ToastInfoIcon;
@@ -60,5 +71,16 @@ Components['tick'] = Tick;
60
71
  Components['arrow_right'] = ArrowRight;
61
72
  Components['search'] = Search;
62
73
  Components['filter'] = Filter;
74
+ Components['edit'] = Edit;
75
+ Components['view_icon'] = ViewIcon;
76
+ Components['hide_icon'] = HideIcon;
77
+ Components['export_collection'] = ExportCollection;
78
+ Components['run_icon'] = RunIcon;
79
+ Components['active_license_icon'] = ActiveLicenseIcon;
80
+ Components['expired_license_icon'] = ExpiredLicenseIcon;
81
+ Components['expiringSoon_license_icon'] = ExpiringSoonLicenseIcon;
82
+ Components['delete'] = DeleteIcon;
83
+ Components['details'] = DetailsIcon;
84
+ Components['impactList'] = ImpactListIcon;
63
85
 
64
86
  export default Components;
@@ -52,7 +52,7 @@ export const DisabledWithValue: Story = {
52
52
 
53
53
  export const Controlled: Story = {
54
54
  render: () => {
55
- const [value, setValue] = useState<string>('');
55
+ const [value, setValue] = useState('');
56
56
  const [error, setError] = useState<boolean>(false);
57
57
  const [helperText, setHelperText] = useState<string>();
58
58
 
@@ -2,6 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react';
2
2
  import InputWithDropdown from './InputWithDropdown';
3
3
  import { ChangeEvent, useState } from 'react';
4
4
  import { Option } from './types';
5
+ import { checkEmpty } from '../../utils/checkEmpty/checkEmpty';
5
6
 
6
7
  const meta: Meta<typeof InputWithDropdown> = {
7
8
  title: 'Components/InputWithDropdown',
@@ -51,7 +52,7 @@ export const DisabledWithValue: Story = {
51
52
 
52
53
  export const Controlled: Story = {
53
54
  render: () => {
54
- const [value, setValue] = useState<string>('');
55
+ const [value, setValue] = useState<string | number>('');
55
56
  const [error, setError] = useState<boolean>(false);
56
57
  const [helperText, setHelperText] = useState<string>('');
57
58
 
@@ -76,7 +77,6 @@ export const Controlled: Story = {
76
77
  const inputValue = event.target.value;
77
78
  setValue(inputValue);
78
79
 
79
- // Validation logic
80
80
  if (event.target) {
81
81
  if (inputValue.length <= 0) {
82
82
  setError(true);
@@ -111,4 +111,61 @@ export const Controlled: Story = {
111
111
  },
112
112
  };
113
113
 
114
+ export const InputWithStaticLabelWithoutOptions: Story = {
115
+ render: () => {
116
+ const [value, setValue] = useState<string | number>('');
117
+ const [error, setError] = useState<boolean>(false);
118
+ const [helperText, setHelperText] = useState<string>('');
119
+
120
+ const optionsListToPass = [{ label: 'Days', value: 'Days' }];
121
+
122
+ const [selectedOption, setSelectedOption] = useState<Option>({
123
+ label: 'Days',
124
+ value: 'Days',
125
+ });
126
+
127
+ const onDropdownChangeHandler = (option: Option) => {
128
+ setSelectedOption(option);
129
+ setValue('0');
130
+ };
131
+
132
+ const onInputChangeHandler = (event: ChangeEvent<HTMLInputElement>) => {
133
+ const inputValue = event.target.value;
134
+ setValue(inputValue);
135
+
136
+ if (event.target) {
137
+ if (checkEmpty(inputValue)) {
138
+ setError(true);
139
+ setHelperText(`${event.target.name} is required`);
140
+ } else if (parseInt(inputValue, 10) >= 366) {
141
+ setError(true);
142
+ setHelperText(`${event.target.name} should be upto 365`);
143
+ } else {
144
+ setError(false);
145
+ setHelperText('');
146
+ }
147
+ }
148
+ };
149
+
150
+ return (
151
+ <InputWithDropdown
152
+ {...defaultArgs}
153
+ name="Duration"
154
+ label="Duration"
155
+ placeholder={`Enter Duration here`}
156
+ value={value}
157
+ type="number"
158
+ required={true}
159
+ error={error}
160
+ helperText={helperText}
161
+ optionsList={optionsListToPass}
162
+ selectedOption={selectedOption}
163
+ optionsRequired={false}
164
+ onInputChangeHandler={onInputChangeHandler}
165
+ onDropdownChangeHandler={onDropdownChangeHandler}
166
+ />
167
+ );
168
+ },
169
+ };
170
+
114
171
  export default meta;
@@ -18,6 +18,7 @@ const InputWithDropdown = ({
18
18
  selectedOption,
19
19
  onDropdownChangeHandler = () => {},
20
20
  onInputChangeHandler,
21
+ optionsRequired = true,
21
22
  }: InputWithDropdownProps) => {
22
23
  return (
23
24
  <div
@@ -68,7 +69,8 @@ const InputWithDropdown = ({
68
69
  showLabel={false}
69
70
  showBorder={false}
70
71
  onChange={onDropdownChangeHandler}
71
- disabled={disabled}
72
+ disabled={disabled || !optionsRequired}
73
+ optionsRequired={optionsRequired}
72
74
  className={classNames('ff-floating-dropdown', {
73
75
  'ff-floating-dropdown--disabled': !!disabled,
74
76
  'ff-floating-dropdown--error': !!error,
@@ -107,4 +107,8 @@ export interface InputWithDropdownProps {
107
107
  * background of the input field prop
108
108
  */
109
109
  isBackgroundTransparent?: boolean;
110
+ /**
111
+ * optionsRequired:false prop removes options from dropdown & shows static label only
112
+ */
113
+ optionsRequired?: boolean;
110
114
  }
@@ -1,4 +1,4 @@
1
- @import '../../assets/styles/fonts';
1
+ @use '../../assets/styles/fonts';
2
2
 
3
3
  .ff-menu-option-container {
4
4
  cursor: pointer;
@@ -103,7 +103,7 @@ interface MenuOptionProps {
103
103
  * @type {'top' | 'left' | 'right' | 'bottom'}
104
104
  * @optional
105
105
  */
106
- dropdownPlacement?: 'top' | 'left' | 'right' | 'down';
106
+ dropdownPlacement?: string | 'top' | 'left' | 'right' | 'down';
107
107
 
108
108
  /**
109
109
  * Callback function triggered when the icon is clicked.
@@ -1,4 +1,4 @@
1
- @import '../../assets/styles/fonts';
1
+ @use '../../assets/styles/fonts';
2
2
 
3
3
  @mixin flex-center($justify: space-between) {
4
4
  display: flex;
@@ -1,5 +1,4 @@
1
- @import '../../assets/styles/_colors';
2
- @import '../../assets/styles/_fonts';
1
+ @use '../../assets/styles/_fonts';
3
2
 
4
3
  @mixin circle($size, $border: none) {
5
4
  width: $size;
@@ -16,7 +15,7 @@
16
15
  .ff-radio {
17
16
  @extend .fontSm;
18
17
  position: relative;
19
- color: $text-color;
18
+ color: var(--text-color);
20
19
  display: flex;
21
20
  align-items: center;
22
21
  cursor: pointer;
@@ -1,87 +1,85 @@
1
- @import '../../assets/styles/fonts';
2
-
1
+ @use '../../assets/styles/fonts';
3
2
 
4
3
  .ff-search-container {
4
+ display: flex;
5
+ align-items: center;
6
+ justify-content: space-between;
7
+ .ff-search-icon {
5
8
  display: flex;
6
9
  align-items: center;
7
- justify-content: space-between;
8
- .ff-search-icon {
9
- display: flex;
10
- align-items: center;
11
- justify-content: center;
12
- cursor: pointer;
13
- border: 1px solid var(--border-color);
14
- border-radius: 4px;
15
- padding: 5px;
16
- .ff-icon-container {
17
- svg {
18
- path {
19
- fill: var(--brand-color)
20
- }
21
- }
10
+ justify-content: center;
11
+ cursor: pointer;
12
+ border: 1px solid var(--border-color);
13
+ border-radius: 4px;
14
+ padding: 4px;
15
+ .ff-icon-container {
16
+ svg {
17
+ path {
18
+ fill: var(--brand-color);
22
19
  }
20
+ }
21
+ }
22
+ }
23
+ .ff-search-input {
24
+ @extend .fontXs;
25
+ border: none;
26
+ color: var(--tooltip-bg-color);
27
+ line-height: 12px;
28
+ visibility: hidden;
29
+ transition: width 0.4s ease;
30
+ &:focus {
31
+ outline: none;
32
+ border: none;
23
33
  }
24
- .ff-search-input {
25
- @extend .fontXs;
26
- border: none;
27
- color: var(--tooltip-bg-color);
28
- line-height: 12px;
29
- visibility: hidden;
30
- transition: width 0.4s ease;
31
- &:focus {
32
- outline: none;
33
- border: none;
34
- }
35
34
 
36
- &:hover {
37
- border: none;
38
- }
35
+ &:hover {
36
+ border: none;
39
37
  }
40
- &.disabled {
41
- opacity: 0.5;
38
+ }
39
+ &.disabled {
40
+ opacity: 0.5;
41
+ }
42
+ &.expanded {
43
+ border: 1px solid var(--border-color);
44
+ border-radius: 4px;
45
+ .ff-vertical-line {
46
+ height: 8px;
47
+ width: 1px;
48
+ position: relative;
49
+ right: 2px;
50
+ border-radius: 1px;
51
+ margin: 8px 0px;
52
+ background-color: var(--border-color);
42
53
  }
43
- &.expanded {
44
- border: 1px solid var(--border-color);
45
- border-radius: 4px;
46
- .ff-vertical-line {
47
- height: 8px;
48
- width: 1px;
49
- position: relative;
50
- right: 2px;
51
- border-radius: 1px;
52
- margin: 8px 0px;
53
- background-color: var(--border-color);
54
- }
55
- .ff-search-input {
56
- visibility: visible;
57
-
58
- &::placeholder {
59
- color: var(--ff-search-filed-placeholder-text);
60
- }
61
- }
62
- .ff-search-icon {
63
- padding: 4px;
64
- border: none;
65
- cursor: default;
54
+ .ff-search-input {
55
+ visibility: visible;
66
56
 
67
- }
68
- .ff-search-clear-button {
69
- display: grid;
70
- place-items: center;
71
- cursor: pointer;
72
- width: 22px;
73
- }
74
- .ff-search-close-icon {
75
- margin: 4px;
76
- cursor: pointer;
57
+ &::placeholder {
58
+ color: var(--ff-search-filed-placeholder-text);
59
+ }
60
+ }
61
+ .ff-search-icon {
62
+ padding: 4px;
63
+ border: none;
64
+ cursor: default;
65
+ }
66
+ .ff-search-clear-button {
67
+ display: grid;
68
+ place-items: center;
69
+ cursor: pointer;
70
+ width: 22px;
71
+ }
72
+ .ff-search-close-icon {
73
+ margin: 4px;
74
+ cursor: pointer;
77
75
 
78
- .ff-icon-container {
79
- svg {
80
- path {
81
- fill: var(--ff-search-filed-close-Icon)
82
- }
83
- }
84
- }
76
+ .ff-icon-container {
77
+ svg {
78
+ path {
79
+ fill: var(--ff-search-filed-close-Icon);
80
+ }
85
81
  }
82
+ }
86
83
  }
84
+ }
87
85
  }
@@ -114,6 +114,7 @@ const Select = ({
114
114
  borderRadius = true,
115
115
  showBorder = true,
116
116
  required = false,
117
+ optionsRequired = true,
117
118
  }: SelectProps) => {
118
119
  const initialState: SelectState = useMemo(
119
120
  () => ({
@@ -291,17 +292,18 @@ const Select = ({
291
292
  {label}
292
293
  </div>
293
294
  )}
294
-
295
- <Icon
296
- name="arrow_up"
297
- height={7}
298
- width={12}
299
- className={classNames('ff-select-arrow', {
300
- 'ff-select-arrow--down': isIconClick,
301
- 'ff-select-arrow--no-label': !showLabel,
302
- })}
303
- color={iconColor}
304
- />
295
+ {optionsRequired && (
296
+ <Icon
297
+ name="arrow_up"
298
+ height={7}
299
+ width={12}
300
+ className={classNames('ff-select-arrow', {
301
+ 'ff-select-arrow--down': isIconClick,
302
+ 'ff-select-arrow--no-label': !showLabel,
303
+ })}
304
+ color={iconColor}
305
+ />
306
+ )}
305
307
  <fieldset
306
308
  className={classNames('ff-select-fieldset', {
307
309
  'ff-select-fieldset--no-label': !showLabel,
@@ -347,20 +349,22 @@ const Select = ({
347
349
  </Typography>
348
350
  )}
349
351
 
350
- <div ref={DropDownRef}>
351
- {showOptions &&
352
- createPortal(
353
- <Dropdown
354
- onSelectBlur={onSelectBlur}
355
- onSelectOptionSelector={onSelectOptionSelector}
356
- dropdownPosition={dropdownPosition}
357
- options={options}
358
- optionZIndex={optionZIndex}
359
- inputRef={InputRef}
360
- />,
361
- document.body
362
- )}
363
- </div>
352
+ {optionsRequired && (
353
+ <div ref={DropDownRef}>
354
+ {showOptions &&
355
+ createPortal(
356
+ <Dropdown
357
+ onSelectBlur={onSelectBlur}
358
+ onSelectOptionSelector={onSelectOptionSelector}
359
+ dropdownPosition={dropdownPosition}
360
+ options={options}
361
+ optionZIndex={optionZIndex}
362
+ inputRef={InputRef}
363
+ />,
364
+ document.body
365
+ )}
366
+ </div>
367
+ )}
364
368
  </div>
365
369
  );
366
370
  };
@@ -1,4 +1,4 @@
1
- import { ReactNode } from "react";
1
+ import { ReactNode } from 'react';
2
2
 
3
3
  export interface SelectProps {
4
4
  /*
@@ -60,6 +60,10 @@ export interface SelectProps {
60
60
  * Provide the boolean value if the select component is required or not
61
61
  */
62
62
  required?: boolean;
63
+ /**
64
+ * optionsRequired:false prop removes options from dropdown & shows static label only
65
+ */
66
+ optionsRequired?: boolean;
63
67
  }
64
68
 
65
69
  export interface DrowdownPosition {
@@ -0,0 +1,99 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import StateDropdown from './StateDropdown';
3
+
4
+ const meta: Meta<typeof StateDropdown> = {
5
+ title: 'Components/StateDropdown',
6
+ component: StateDropdown,
7
+ parameters: {
8
+ layout: 'centered',
9
+ },
10
+ tags: ['autodocs'],
11
+ };
12
+
13
+ type Story = StoryObj<typeof StateDropdown>;
14
+
15
+ export const Disable: Story = {
16
+ args: {
17
+ value: 'New',
18
+ handleStateValueClick: () => {},
19
+ handleDropdownOptionsClick: () => {},
20
+ isOnlyReviewer: false,
21
+ nodeObj: { label: 'New', value: 'New' },
22
+ isReviewer: true,
23
+ isApprovePage: false,
24
+ disabled: true,
25
+ userHasOnlyViewAccess: true,
26
+ },
27
+ };
28
+
29
+ export const Review: Story = {
30
+ args: {
31
+ value: 'Review',
32
+ handleStateValueClick: () => {},
33
+ handleDropdownOptionsClick: () => {},
34
+ isOnlyReviewer: false,
35
+ nodeObj: { label: 'Review', value: 'Review' },
36
+ isReviewer: true,
37
+ isApprovePage: true,
38
+ disabled: false,
39
+ userHasOnlyViewAccess: false,
40
+ },
41
+ };
42
+
43
+ export const Reject: Story = {
44
+ args: {
45
+ value: 'Rejected',
46
+ handleStateValueClick: () => {},
47
+ handleDropdownOptionsClick: () => {},
48
+ isOnlyReviewer: false,
49
+ nodeObj: { label: 'Rejected', value: 'Rejected' },
50
+ isReviewer: false,
51
+ isApprovePage: false,
52
+ disabled: false,
53
+ userHasOnlyViewAccess: false,
54
+ },
55
+ };
56
+
57
+ export const Approved: Story = {
58
+ args: {
59
+ value: 'Approved',
60
+ handleStateValueClick: () => {},
61
+ handleDropdownOptionsClick: () => {},
62
+ isOnlyReviewer: false,
63
+ nodeObj: { label: 'Approved', value: 'Approved' },
64
+ isReviewer: false,
65
+ isApprovePage: false,
66
+ disabled: false,
67
+ userHasOnlyViewAccess: true,
68
+ },
69
+ };
70
+
71
+ export const NewState: Story = {
72
+ render: () => {
73
+ const value = 'New';
74
+ const state = {
75
+ label: 'New',
76
+ value: 'New',
77
+ };
78
+
79
+ const handleDropdownOptionsClick = () => {};
80
+
81
+ const handleStateValueClick = () => {};
82
+
83
+ return (
84
+ <StateDropdown
85
+ value={value}
86
+ nodeObj={state}
87
+ isReviewer={false}
88
+ isApprovePage={false}
89
+ handleStateValueClick={handleStateValueClick}
90
+ handleDropdownOptionsClick={handleDropdownOptionsClick}
91
+ disabled={false}
92
+ isOnlyReviewer={false}
93
+ userHasOnlyViewAccess={false}
94
+ />
95
+ );
96
+ },
97
+ };
98
+
99
+ export default meta;