pixel-react 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. package/lib/assets/utils/functionUtils.d.ts +3 -0
  2. package/lib/components/DatePicker/DatePicker.d.ts +5 -0
  3. package/lib/components/DatePicker/DatePicker.stories.d.ts +9 -0
  4. package/lib/components/DatePicker/Timepicker.d.ts +4 -0
  5. package/lib/components/DatePicker/index.d.ts +1 -0
  6. package/lib/components/DatePicker/types.d.ts +81 -0
  7. package/lib/components/IconButton/IconButton.d.ts +5 -0
  8. package/lib/components/IconButton/IconButton.stories.d.ts +6 -0
  9. package/lib/components/IconButton/index.d.ts +1 -0
  10. package/lib/components/IconButton/types.d.ts +5 -0
  11. package/lib/components/InputWithDropdown/InputWithDropdown.d.ts +1 -1
  12. package/lib/components/InputWithDropdown/types.d.ts +3 -7
  13. package/lib/components/TableTree/TableTree.d.ts +1 -1
  14. package/lib/index.d.ts +65 -14
  15. package/lib/index.esm.js +8536 -227
  16. package/lib/index.esm.js.map +1 -1
  17. package/lib/index.js +8539 -229
  18. package/lib/index.js.map +1 -1
  19. package/lib/tsconfig.tsbuildinfo +1 -1
  20. package/package.json +3 -1
  21. package/src/assets/Themes/BaseTheme.scss +7 -0
  22. package/src/assets/Themes/DarkTheme.scss +7 -1
  23. package/src/assets/icons/add_variable_icon.svg +5 -0
  24. package/src/assets/icons/calendar_icon.svg +9 -0
  25. package/src/assets/icons/clock_icon.svg +11 -0
  26. package/src/assets/icons/info_icon.svg +4 -0
  27. package/src/assets/icons/left_arrow_icon.svg +3 -0
  28. package/src/assets/icons/right_arrow_icon.svg +4 -0
  29. package/src/assets/styles/_mixins.scss +1 -0
  30. package/src/assets/utils/functionUtils.ts +37 -0
  31. package/src/components/DatePicker/DatePicker.scss +387 -0
  32. package/src/components/DatePicker/DatePicker.stories.tsx +161 -0
  33. package/src/components/DatePicker/DatePicker.tsx +438 -0
  34. package/src/components/DatePicker/Timepicker.tsx +372 -0
  35. package/src/components/DatePicker/index.ts +1 -0
  36. package/src/components/DatePicker/types.ts +100 -0
  37. package/src/components/Drawer/Drawer.scss +0 -1
  38. package/src/components/Drawer/Drawer.tsx +10 -14
  39. package/src/components/Icon/iconList.ts +17 -9
  40. package/src/components/{AddButton/AddButton.scss → IconButton/IconButton.scss} +6 -2
  41. package/src/components/IconButton/IconButton.stories.tsx +25 -0
  42. package/src/components/{AddButton/AddButton.tsx → IconButton/IconButton.tsx} +10 -7
  43. package/src/components/IconButton/index.ts +1 -0
  44. package/src/components/{AddButton → IconButton}/types.ts +3 -2
  45. package/src/components/InputWithDropdown/InputWithDropdown.scss +1 -1
  46. package/src/components/InputWithDropdown/InputWithDropdown.stories.tsx +10 -13
  47. package/src/components/InputWithDropdown/InputWithDropdown.tsx +10 -8
  48. package/src/components/InputWithDropdown/types.ts +4 -7
  49. package/src/components/RadioButton/RadioButton.scss +3 -3
  50. package/src/components/Select/Select.scss +1 -1
  51. package/src/components/TableTree/TableTree.tsx +4 -0
  52. package/src/index.ts +5 -2
  53. package/src/assets/icons/expired_license_icon.svg +0 -3
  54. package/src/assets/icons/expiringSoon_license_icon.svg +0 -3
  55. package/src/components/AddButton/AddButton.stories.tsx +0 -24
  56. package/src/components/AddButton/index.ts +0 -1
@@ -14,7 +14,7 @@
14
14
  .ff-floating-label-input-container {
15
15
  .ff-floating-label {
16
16
  position: absolute;
17
- z-index: 99;
17
+ z-index: 9;
18
18
  color: var(--input-default-border-color);
19
19
  top: 7px;
20
20
  left: 7px;
@@ -43,8 +43,7 @@ export const DisabledWithValue: Story = {
43
43
  args: {
44
44
  ...defaultArgs,
45
45
  variant: 'primary',
46
- type: 'text',
47
- value: 'Disabled',
46
+ value: 12345,
48
47
  disabled: true,
49
48
  required: true,
50
49
  },
@@ -52,7 +51,7 @@ export const DisabledWithValue: Story = {
52
51
 
53
52
  export const Controlled: Story = {
54
53
  render: () => {
55
- const [value, setValue] = useState<string | number>('');
54
+ const [value, setValue] = useState<number>(0);
56
55
  const [error, setError] = useState<boolean>(false);
57
56
  const [helperText, setHelperText] = useState<string>('');
58
57
 
@@ -70,18 +69,18 @@ export const Controlled: Story = {
70
69
 
71
70
  const onDropdownChangeHandler = (option: Option) => {
72
71
  setSelectedOption(option);
73
- setValue('0');
72
+ setValue(0);
74
73
  };
75
74
 
76
75
  const onInputChangeHandler = (event: ChangeEvent<HTMLInputElement>) => {
77
- const inputValue = event.target.value;
76
+ const inputValue = parseInt(event.target.value);
78
77
  setValue(inputValue);
79
78
 
80
79
  if (event.target) {
81
- if (inputValue.length <= 0) {
80
+ if (inputValue < 0 || checkEmpty(value)) {
82
81
  setError(true);
83
82
  setHelperText(`${event.target.name} is required`);
84
- } else if (inputValue.length > 4) {
83
+ } else if (inputValue > 999) {
85
84
  setError(true);
86
85
  setHelperText(`${event.target.name} should be upto 999`);
87
86
  } else {
@@ -98,7 +97,6 @@ export const Controlled: Story = {
98
97
  label="ImplicitTime"
99
98
  placeholder={`Enter ImplicitTime here`}
100
99
  value={value}
101
- type="number"
102
100
  required={true}
103
101
  error={error}
104
102
  helperText={helperText}
@@ -113,7 +111,7 @@ export const Controlled: Story = {
113
111
 
114
112
  export const InputWithStaticLabelWithoutOptions: Story = {
115
113
  render: () => {
116
- const [value, setValue] = useState<string | number>('');
114
+ const [value, setValue] = useState<number>(0);
117
115
  const [error, setError] = useState<boolean>(false);
118
116
  const [helperText, setHelperText] = useState<string>('');
119
117
 
@@ -126,18 +124,18 @@ export const InputWithStaticLabelWithoutOptions: Story = {
126
124
 
127
125
  const onDropdownChangeHandler = (option: Option) => {
128
126
  setSelectedOption(option);
129
- setValue('0');
127
+ setValue(0);
130
128
  };
131
129
 
132
130
  const onInputChangeHandler = (event: ChangeEvent<HTMLInputElement>) => {
133
- const inputValue = event.target.value;
131
+ const inputValue = parseInt(event.target.value);
134
132
  setValue(inputValue);
135
133
 
136
134
  if (event.target) {
137
135
  if (checkEmpty(inputValue)) {
138
136
  setError(true);
139
137
  setHelperText(`${event.target.name} is required`);
140
- } else if (parseInt(inputValue, 10) >= 366) {
138
+ } else if (inputValue >= 366) {
141
139
  setError(true);
142
140
  setHelperText(`${event.target.name} should be upto 365`);
143
141
  } else {
@@ -154,7 +152,6 @@ export const InputWithStaticLabelWithoutOptions: Story = {
154
152
  label="Duration"
155
153
  placeholder={`Enter Duration here`}
156
154
  value={value}
157
- type="number"
158
155
  required={true}
159
156
  error={error}
160
157
  helperText={helperText}
@@ -8,7 +8,6 @@ const InputWithDropdown = ({
8
8
  name = '',
9
9
  label,
10
10
  value,
11
- type,
12
11
  disabled = false,
13
12
  required = false,
14
13
  placeholder,
@@ -18,18 +17,20 @@ const InputWithDropdown = ({
18
17
  selectedOption,
19
18
  onDropdownChangeHandler = () => {},
20
19
  onInputChangeHandler,
20
+ onInputBlurHandler,
21
21
  optionsRequired = true,
22
22
  }: InputWithDropdownProps) => {
23
+ const isValueFilled = value !== undefined && value >= 0;
23
24
  return (
24
25
  <div
25
26
  className={classNames('ff-input-with-dropdown-container', {
26
- 'ff-input-with-dropdown-container--filled': !!value,
27
+ 'ff-input-with-dropdown-container--filled': isValueFilled,
27
28
  })}
28
29
  >
29
30
  <fieldset
30
31
  className={classNames('ff-input-with-dropdown', {
31
- 'ff-input-with-dropdown--filled': !!value,
32
- 'ff-input-with-dropdown--no-hover': !!value,
32
+ 'ff-input-with-dropdown--filled': isValueFilled,
33
+ 'ff-input-with-dropdown--no-hover': isValueFilled,
33
34
  'ff-input-with-dropdown--disabled': !!disabled,
34
35
  'ff-input-with-dropdown--error': !!error,
35
36
  })}
@@ -39,8 +40,8 @@ const InputWithDropdown = ({
39
40
  as="label"
40
41
  htmlFor={name}
41
42
  className={classNames('ff-floating-label', {
42
- 'ff-floating-label--filled': !!value,
43
- 'ff-floating-label--no-hover': !!value,
43
+ 'ff-floating-label--filled': isValueFilled,
44
+ 'ff-floating-label--no-hover': isValueFilled,
44
45
  'ff-floating-label--error': !!error,
45
46
  })}
46
47
  >
@@ -49,15 +50,16 @@ const InputWithDropdown = ({
49
50
  </Typography>
50
51
  <input
51
52
  name={name}
52
- type={type}
53
+ type="number"
53
54
  id={name}
54
55
  value={value}
55
56
  onChange={onInputChangeHandler}
57
+ onBlur={onInputBlurHandler}
56
58
  placeholder={placeholder}
57
59
  required={required}
58
60
  disabled={disabled}
59
61
  className={classNames('ff-floating-input', {
60
- 'ff-floating-input--filled': !!value,
62
+ 'ff-floating-input--filled': isValueFilled,
61
63
  'ff-floating-input--disabled': !!disabled,
62
64
  'ff-floating-input--error': !!error,
63
65
  })}
@@ -19,17 +19,14 @@ export interface InputWithDropdownProps {
19
19
  /**
20
20
  * value | input field value
21
21
  */
22
- value: string | number;
22
+ value?: number;
23
23
 
24
24
  /**
25
25
  * variants to set color/style of the input field
26
26
  */
27
27
  variant?: 'default' | 'primary';
28
28
 
29
- /**
30
- * type to set the input field type
31
- */
32
- type: 'text' | 'password' | 'number' | 'time';
29
+
33
30
 
34
31
  /**
35
32
  * error | If true, error message will be displayed
@@ -82,9 +79,9 @@ export interface InputWithDropdownProps {
82
79
  onDropdownChangeHandler?: (option: Option) => void;
83
80
 
84
81
  /**
85
- * onFocus action for input field
82
+ * onInputBlurHandler action for input field
86
83
  */
87
- onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
84
+ onInputBlurHandler?: (event: React.FocusEvent<HTMLInputElement>) => void;
88
85
 
89
86
  /**
90
87
  * id to select the input field uniquely
@@ -23,15 +23,15 @@
23
23
  display: none;
24
24
  }
25
25
  .ff-radio-custom {
26
- box-sizing: border-box;
27
- @include circle(16px, 1px solid var(--radio-button-border)); //todo
26
+ box-sizing: content-box;
27
+ @include circle(14px, 1px solid var(--radio-button-border)); //todo
28
28
  position: relative;
29
29
  margin-right: 8px;
30
30
  @include transition(border-color, background-color);
31
31
 
32
32
  &::before {
33
33
  content: '';
34
- @include circle(14px);
34
+ @include circle(12px);
35
35
  background: #fbfdff; //todo
36
36
  position: absolute;
37
37
  top: 50%;
@@ -112,7 +112,7 @@
112
112
  @include absolute-position(6px, auto, auto, auto);
113
113
  width: calc(100% - 38px);
114
114
  min-height: calc(100% - 8px);
115
- padding: 0 28px 0 8px;
115
+ padding: 0 8px;
116
116
  border-radius: 4px;
117
117
  border: 1px solid transparent;
118
118
  z-index: 100;
@@ -6,6 +6,8 @@ import { prepareData } from '../../utils/TableCell/TableCell';
6
6
  import Icon from '../Icon';
7
7
  import { checkEmpty } from '../../utils/checkEmpty/checkEmpty';
8
8
 
9
+ import Checkbox from '../Checkbox';
10
+
9
11
  interface ColumnDataProps {
10
12
  name: string;
11
13
  accessor: string;
@@ -32,6 +34,7 @@ interface TableTreeProps {
32
34
  const TableTree = ({
33
35
  columnsData,
34
36
  treeData,
37
+ withCheckBox,
35
38
  onClick = () => {},
36
39
  }: TableTreeProps) => {
37
40
  const [expandedNodes, setExpandedNodes] = useState<Set<ObjectProps>>(
@@ -140,6 +143,7 @@ const TableTree = ({
140
143
  style={{ fontWeight: node.folder ? 600 : 400 }}
141
144
  onClick={(event) => onClick(event, node)}
142
145
  >
146
+ {withCheckBox && <Checkbox />}
143
147
  {prepareData(node, column)}
144
148
  </div>
145
149
  </td>
package/src/index.ts CHANGED
@@ -36,8 +36,9 @@ import Tabs from './components/Tabs';
36
36
  import HighlightText from './components/HighlightText';
37
37
  import Checkbox from './components/Checkbox';
38
38
  import Search from './components/Search/Search';
39
+ import DatePicker from './components/DatePicker';
39
40
  import StateDropdown from './components/StateDropdown';
40
- import AddButton from './components/AddButton';
41
+ import IconButton from './components/IconButton';
41
42
 
42
43
  // Utils imports
43
44
  import { checkEmpty } from './utils/checkEmpty/checkEmpty';
@@ -46,6 +47,7 @@ import {
46
47
  getExtensionWithPeriod,
47
48
  } from './utils/getExtension/getExtension';
48
49
 
50
+
49
51
  export {
50
52
  Button,
51
53
  Tooltip,
@@ -83,9 +85,10 @@ export {
83
85
  Tabs,
84
86
  Checkbox,
85
87
  Search,
88
+ DatePicker,
86
89
  StateDropdown,
87
90
  StatusButton,
88
- AddButton,
91
+ IconButton,
89
92
 
90
93
 
91
94
  // utils exports
@@ -1,3 +0,0 @@
1
- <svg width="18" height="20" viewBox="0 0 18 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M15.867 6.20329C15.873 6.44806 15.6805 6.65267 15.4358 6.65874C15.191 6.6648 14.9864 6.47232 14.9803 6.22754C14.9614 5.5887 14.7704 4.99913 14.4362 4.50352C14.1035 4.01018 13.6268 3.6093 13.0373 3.34938L9.25273 1.6784C8.81623 1.48592 8.37519 1.38891 7.93489 1.38891C7.49459 1.38891 7.05355 1.48516 6.61705 1.6784L2.8325 3.34938C2.22626 3.61688 1.73974 4.03216 1.4063 4.54368C1.07285 5.0552 0.890218 5.66903 0.890218 6.33212V10.8867C0.890218 12.5144 1.66622 13.9633 2.70367 15.1729C3.76613 16.4127 5.10752 17.4047 6.18965 18.0912C6.73527 18.4368 7.33242 18.6111 7.92579 18.6126C8.52294 18.6141 9.12087 18.4436 9.66801 18.1018C9.87489 17.9722 10.1485 18.0351 10.2788 18.2428C10.4084 18.4497 10.3455 18.7232 10.1378 18.8536C9.44672 19.2863 8.68663 19.5023 7.92663 19.5C7.16276 19.4977 6.40191 19.2787 5.71387 18.843C4.57715 18.1223 3.16452 17.075 2.02943 15.751C0.868459 14.3975 0 12.7591 0 10.8874V6.33289C0 5.49627 0.234914 4.71724 0.663091 4.06096C1.09049 3.4047 1.70887 2.87423 2.47579 2.53624L6.26033 0.865263C6.81203 0.62125 7.37356 0.5 7.93661 0.5C8.49965 0.5 9.06045 0.622008 9.61288 0.865263L13.3974 2.53624C14.1439 2.86588 14.7494 3.37589 15.1753 4.0079C15.6004 4.63916 15.8452 5.39166 15.8687 6.20553L15.867 6.20329ZM10.8191 12.7675C10.6448 12.5932 10.6448 12.312 10.8191 12.1377C10.9934 11.9634 11.2745 11.9634 11.4488 12.1377L12.5408 13.229L14.8242 10.9456C14.9985 10.7713 15.2797 10.7713 15.454 10.9456C15.6282 11.1199 15.6282 11.401 15.454 11.5753L12.8561 14.1732C12.6818 14.3475 12.4006 14.3475 12.2264 14.1732L10.8199 12.7667L10.8191 12.7675ZM13.1356 7.7159C14.4732 7.7159 15.6842 8.25775 16.5609 9.13453C17.4377 10.0113 17.9795 11.2224 17.9795 12.5598C17.9795 13.8972 17.4369 15.1084 16.5609 15.985C15.6841 16.8618 14.4731 17.4037 13.1356 17.4037C11.7981 17.4037 10.5871 16.8618 9.71038 15.985C8.83359 15.1083 8.29175 13.8972 8.29175 12.5598C8.29175 11.2224 8.83435 10.0112 9.71038 9.13453C10.5872 8.25775 11.7982 7.7159 13.1356 7.7159ZM15.9312 9.76435C15.2158 9.04897 14.2276 8.6064 13.1356 8.6064C12.0436 8.6064 11.0554 9.04895 10.3401 9.76435C9.62482 10.4797 9.18215 11.4679 9.18215 12.5599C9.18215 13.6519 9.62471 14.6401 10.3401 15.3554C11.0555 16.0707 12.0436 16.5134 13.1356 16.5134C14.2276 16.5134 15.2159 16.0708 15.9312 15.3554C16.6464 14.64 17.0891 13.6519 17.0891 12.5599C17.0891 11.4679 16.6466 10.4796 15.9312 9.76435Z" fill="currentColor"/>
3
- </svg>
@@ -1,3 +0,0 @@
1
- <svg width="18" height="20" viewBox="0 0 18 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M15.867 6.20329C15.873 6.44806 15.6805 6.65267 15.4358 6.65874C15.191 6.6648 14.9864 6.47232 14.9803 6.22754C14.9614 5.5887 14.7704 4.99913 14.4362 4.50352C14.1035 4.01018 13.6268 3.6093 13.0373 3.34938L9.25273 1.6784C8.81623 1.48592 8.37519 1.38891 7.93489 1.38891C7.49459 1.38891 7.05355 1.48516 6.61705 1.6784L2.8325 3.34938C2.22626 3.61688 1.73974 4.03216 1.4063 4.54368C1.07285 5.0552 0.890218 5.66903 0.890218 6.33212V10.8867C0.890218 12.5144 1.66622 13.9633 2.70367 15.1729C3.76613 16.4127 5.10752 17.4047 6.18965 18.0912C6.73527 18.4368 7.33242 18.6111 7.92579 18.6126C8.52294 18.6141 9.12087 18.4436 9.66801 18.1018C9.87489 17.9722 10.1485 18.0351 10.2788 18.2428C10.4084 18.4497 10.3455 18.7232 10.1378 18.8536C9.44672 19.2863 8.68663 19.5023 7.92663 19.5C7.16276 19.4977 6.40191 19.2787 5.71387 18.843C4.57715 18.1223 3.16452 17.075 2.02943 15.751C0.868459 14.3975 0 12.7591 0 10.8874V6.33289C0 5.49627 0.234914 4.71724 0.663091 4.06096C1.09049 3.4047 1.70887 2.87423 2.47579 2.53624L6.26033 0.865263C6.81203 0.62125 7.37356 0.5 7.93661 0.5C8.49965 0.5 9.06045 0.622008 9.61288 0.865263L13.3974 2.53624C14.1439 2.86588 14.7494 3.37589 15.1753 4.0079C15.6004 4.63916 15.8452 5.39166 15.8687 6.20553L15.867 6.20329ZM10.8191 12.7675C10.6448 12.5932 10.6448 12.312 10.8191 12.1377C10.9934 11.9634 11.2745 11.9634 11.4488 12.1377L12.5408 13.229L14.8242 10.9456C14.9985 10.7713 15.2797 10.7713 15.454 10.9456C15.6282 11.1199 15.6282 11.401 15.454 11.5753L12.8561 14.1732C12.6818 14.3475 12.4006 14.3475 12.2264 14.1732L10.8199 12.7667L10.8191 12.7675ZM13.1356 7.7159C14.4732 7.7159 15.6842 8.25775 16.5609 9.13453C17.4377 10.0113 17.9795 11.2224 17.9795 12.5598C17.9795 13.8972 17.4369 15.1084 16.5609 15.985C15.6841 16.8618 14.4731 17.4037 13.1356 17.4037C11.7981 17.4037 10.5871 16.8618 9.71038 15.985C8.83359 15.1083 8.29175 13.8972 8.29175 12.5598C8.29175 11.2224 8.83435 10.0112 9.71038 9.13453C10.5872 8.25775 11.7982 7.7159 13.1356 7.7159ZM15.9312 9.76435C15.2158 9.04897 14.2276 8.6064 13.1356 8.6064C12.0436 8.6064 11.0554 9.04895 10.3401 9.76435C9.62482 10.4797 9.18215 11.4679 9.18215 12.5599C9.18215 13.6519 9.62471 14.6401 10.3401 15.3554C11.0555 16.0707 12.0436 16.5134 13.1356 16.5134C14.2276 16.5134 15.2159 16.0708 15.9312 15.3554C16.6464 14.64 17.0891 13.6519 17.0891 12.5599C17.0891 11.4679 16.6466 10.4796 15.9312 9.76435Z" fill="currentColor"/>
3
- </svg>
@@ -1,24 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import AddButton from './AddButton';
3
-
4
- const meta: Meta<typeof AddButton> = {
5
- title: 'Components/AddButton',
6
- component: AddButton,
7
- parameters: {
8
- layout: 'centered',
9
- },
10
- tags: ['autodocs'],
11
- };
12
-
13
- type Story = StoryObj<typeof AddButton>;
14
-
15
- export const PrimaryAddButton: Story = {
16
- render: () => {
17
- const name = 'Project';
18
- const onClick = () => {};
19
-
20
- return <AddButton name={name} onClick={onClick} />;
21
- },
22
- };
23
-
24
- export default meta;
@@ -1 +0,0 @@
1
- export { default } from './AddButton';