pixel-react-excel-sheet 1.0.11 → 1.0.12

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 (201) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/lib/1fb4472b34e4fe07.css +1 -0
  3. package/lib/components/Accordion/Accordion.d.ts +1 -1
  4. package/lib/components/Accordion/types.d.ts +12 -0
  5. package/lib/components/AddVariables/AddVariables.d.ts +5 -0
  6. package/lib/components/AddVariables/index.d.ts +1 -0
  7. package/lib/components/AddVariables/types.d.ts +35 -0
  8. package/lib/components/AppHeader/types.d.ts +2 -0
  9. package/lib/components/AttachImage/AttachImage.d.ts +1 -6
  10. package/lib/components/AttachImage/types.d.ts +8 -0
  11. package/lib/components/Avatar/types.d.ts +9 -1
  12. package/lib/components/Checkbox/types.d.ts +4 -0
  13. package/lib/components/Comment/Comments.d.ts +4 -0
  14. package/lib/components/Comment/comment/Comment.d.ts +11 -0
  15. package/lib/components/Comment/comment/useNode.d.ts +7 -0
  16. package/lib/components/Comment/index.d.ts +1 -0
  17. package/lib/components/Comment/type.d.ts +25 -0
  18. package/lib/components/CreateVariable/CreateVariableSlider.d.ts +5 -0
  19. package/lib/components/CreateVariable/index.d.ts +1 -0
  20. package/lib/components/CreateVariable/types.d.ts +56 -0
  21. package/lib/components/Drawer/Types.d.ts +13 -0
  22. package/lib/components/Editor/constants.d.ts +1 -1
  23. package/lib/components/Editor/types.d.ts +10 -2
  24. package/lib/components/Excel/ExcelFile/ExcelFileComponents/actions.d.ts +8 -1
  25. package/lib/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.d.ts +2 -0
  26. package/lib/components/Excel/ExcelFile/ExcelFileComponents/types.d.ts +13 -6
  27. package/lib/components/IconButton/IconButton.d.ts +1 -2
  28. package/lib/components/IconButton/types.d.ts +1 -0
  29. package/lib/components/Input/Input.d.ts +1 -1
  30. package/lib/components/MiniModal/types.d.ts +7 -0
  31. package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
  32. package/lib/components/PhoneInput/PhoneInput.d.ts +6 -0
  33. package/lib/components/PhoneInput/index.d.ts +1 -0
  34. package/lib/components/PhoneInput/types.d.ts +10 -0
  35. package/lib/components/PopUpModal/types.d.ts +1 -0
  36. package/lib/components/Select/components/types.d.ts +1 -0
  37. package/lib/components/Select/types.d.ts +2 -0
  38. package/lib/components/TableTree/Components/TableBody.d.ts +4 -0
  39. package/lib/components/TableTree/Components/TableCell.d.ts +4 -0
  40. package/lib/components/TableTree/Components/TableHead.d.ts +4 -0
  41. package/lib/components/TableTree/Components/TableRow.d.ts +4 -0
  42. package/lib/components/TableTree/Utils/getAllChildIds.d.ts +1 -0
  43. package/lib/components/TableTree/types.d.ts +38 -5
  44. package/lib/components/TableWithAccordion/TableWithAccordion.d.ts +5 -0
  45. package/lib/components/TableWithAccordion/data.d.ts +8 -0
  46. package/lib/components/TableWithAccordion/index.d.ts +1 -0
  47. package/lib/components/TableWithAccordion/types.d.ts +67 -0
  48. package/lib/index.d.ts +303 -17
  49. package/lib/index.esm.js +3370 -746
  50. package/lib/index.esm.js.map +1 -1
  51. package/lib/index.js +3375 -745
  52. package/lib/index.js.map +1 -1
  53. package/lib/tsconfig.tsbuildinfo +1 -1
  54. package/lib/utils/checkDuplicates/checkDuplicates.d.ts +1 -0
  55. package/package.json +2 -1
  56. package/src/assets/Themes/BaseTheme.scss +14 -0
  57. package/src/assets/Themes/DarkTheme.scss +68 -41
  58. package/src/assets/icons/add_file.svg +4 -17
  59. package/src/assets/icons/add_variable.svg +11 -0
  60. package/src/assets/icons/authorization.svg +4 -0
  61. package/src/assets/icons/authorization_icon.svg +1 -0
  62. package/src/assets/icons/backward.svg +10 -0
  63. package/src/assets/icons/capture_icon.svg +3 -0
  64. package/src/assets/icons/depends_on_script.svg +7 -0
  65. package/src/assets/icons/download_file_icon.svg +2 -9
  66. package/src/assets/icons/email_group.svg +3 -0
  67. package/src/assets/icons/executions_icon.svg +3 -0
  68. package/src/assets/icons/forward.svg +3 -0
  69. package/src/assets/icons/labels.svg +8 -0
  70. package/src/assets/icons/machine_disable_icon.svg +18 -0
  71. package/src/assets/icons/machine_enable_icon.svg +10 -0
  72. package/src/assets/icons/parameters.svg +3 -0
  73. package/src/assets/icons/pre_post_condition.svg +8 -0
  74. package/src/assets/icons/program_element.svg +8 -0
  75. package/src/assets/icons/project_status_icon.svg +10 -0
  76. package/src/assets/icons/refresh_icon.svg +4 -0
  77. package/src/assets/icons/rotate_icon.svg +10 -0
  78. package/src/assets/icons/suites_icon.svg +3 -0
  79. package/src/assets/icons/swipe_icon.svg +9 -0
  80. package/src/assets/icons/tap_icon.svg +4 -0
  81. package/src/assets/icons/test_data.svg +5 -0
  82. package/src/assets/icons/test_data_set.svg +7 -0
  83. package/src/assets/icons/variable_set.svg +5 -0
  84. package/src/assets/styles/_colors.scss +0 -1
  85. package/src/components/Accordion/Accordion.stories.tsx +4 -0
  86. package/src/components/Accordion/Accordion.tsx +7 -1
  87. package/src/components/Accordion/types.ts +12 -0
  88. package/src/components/AddVariables/AddVariables.scss +14 -0
  89. package/src/components/AddVariables/AddVariables.stories.tsx +44 -0
  90. package/src/components/AddVariables/AddVariables.tsx +113 -0
  91. package/src/components/AddVariables/index.ts +1 -0
  92. package/src/components/AddVariables/types.ts +36 -0
  93. package/src/components/AllProjectsDropdown/AllProjectsDropdown.scss +1 -1
  94. package/src/components/AppHeader/AppHeader.scss +40 -1
  95. package/src/components/AppHeader/AppHeader.stories.tsx +133 -5
  96. package/src/components/AppHeader/AppHeader.tsx +111 -112
  97. package/src/components/AppHeader/types.ts +10 -9
  98. package/src/components/AttachImage/AttachImage.stories.tsx +2 -0
  99. package/src/components/AttachImage/AttachImage.tsx +5 -9
  100. package/src/components/AttachImage/types.ts +25 -18
  101. package/src/components/Avatar/Avatar.scss +4 -0
  102. package/src/components/Avatar/Avatar.stories.tsx +38 -18
  103. package/src/components/Avatar/Avatar.tsx +19 -3
  104. package/src/components/Avatar/types.ts +9 -1
  105. package/src/components/Charts/DonutChart/DonutChart.tsx +8 -3
  106. package/src/components/Charts/RadialChart/RadialChart.scss +4 -0
  107. package/src/components/Charts/RadialChart/RadialChart.tsx +51 -45
  108. package/src/components/Checkbox/Checkbox.scss +57 -0
  109. package/src/components/Checkbox/Checkbox.stories.tsx +91 -15
  110. package/src/components/Checkbox/Checkbox.tsx +4 -1
  111. package/src/components/Checkbox/types.ts +4 -0
  112. package/src/components/Comment/Comments.scss +166 -0
  113. package/src/components/Comment/Comments.stories.tsx +212 -0
  114. package/src/components/Comment/Comments.tsx +51 -0
  115. package/src/components/Comment/comment/Comment.tsx +206 -0
  116. package/src/components/Comment/comment/useNode.ts +51 -0
  117. package/src/components/Comment/index.ts +1 -0
  118. package/src/components/Comment/type.ts +36 -0
  119. package/src/components/CreateVariable/CreateVariableSlider.scss +18 -0
  120. package/src/components/CreateVariable/CreateVariableSlider.stories.tsx +66 -0
  121. package/src/components/CreateVariable/CreateVariableSlider.tsx +95 -0
  122. package/src/components/CreateVariable/index.ts +1 -0
  123. package/src/components/CreateVariable/types.ts +58 -0
  124. package/src/components/Drawer/Drawer.scss +3 -2
  125. package/src/components/Drawer/Drawer.stories.tsx +0 -1
  126. package/src/components/Drawer/Drawer.tsx +4 -1
  127. package/src/components/Drawer/Types.ts +13 -0
  128. package/src/components/Editor/Editor.stories.tsx +2 -2
  129. package/src/components/Editor/Editor.tsx +4 -2
  130. package/src/components/Editor/VariableDropdown.scss +8 -2
  131. package/src/components/Editor/VariableDropdown.tsx +15 -7
  132. package/src/components/Editor/constants.ts +1 -1
  133. package/src/components/Editor/types.ts +12 -2
  134. package/src/components/Excel/ExcelFile/ExcelFile.scss +2 -1
  135. package/src/components/Excel/ExcelFile/ExcelFile.tsx +37 -21
  136. package/src/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.tsx +12 -0
  137. package/src/components/Excel/ExcelFile/ExcelFileComponents/Cell.tsx +2 -34
  138. package/src/components/Excel/ExcelFile/ExcelFileComponents/FloatingRect.tsx +26 -1
  139. package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.scss +23 -21
  140. package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.tsx +1 -3
  141. package/src/components/Excel/ExcelFile/ExcelFileComponents/actions.ts +13 -0
  142. package/src/components/Excel/ExcelFile/ExcelFileComponents/reducer.ts +53 -26
  143. package/src/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.ts +81 -14
  144. package/src/components/Excel/ExcelFile/ExcelFileComponents/types.ts +17 -6
  145. package/src/components/Excel/ExcelFile.stories.tsx +4 -4
  146. package/src/components/Excel/ExcelToolBar/ExcelToolBar.tsx +36 -19
  147. package/src/components/Excel/dataConversion.ts +43 -20
  148. package/src/components/FieldSet/FieldSet.scss +2 -1
  149. package/src/components/FieldSet/FieldSet.stories.tsx +2 -1
  150. package/src/components/FileDropzone/FileDropzone.scss +0 -1
  151. package/src/components/Icon/iconList.ts +45 -2
  152. package/src/components/IconButton/IconButton.scss +11 -11
  153. package/src/components/IconButton/IconButton.stories.tsx +1 -0
  154. package/src/components/IconButton/IconButton.tsx +6 -8
  155. package/src/components/IconButton/types.ts +2 -1
  156. package/src/components/IconRadioGroup/IconRadioGroup.scss +2 -1
  157. package/src/components/Input/Input.tsx +99 -88
  158. package/src/components/LabelEditTextField/LabelEditTextField.tsx +1 -1
  159. package/src/components/MiniModal/MiniModal.scss +0 -4
  160. package/src/components/MiniModal/MiniModal.stories.tsx +3 -2
  161. package/src/components/MiniModal/MiniModal.tsx +28 -10
  162. package/src/components/MiniModal/types.ts +7 -0
  163. package/src/components/Modal/Modal.stories.tsx +2 -1
  164. package/src/components/MultiSelect/MultiSelect.scss +29 -0
  165. package/src/components/MultiSelect/MultiSelect.stories.tsx +19 -5
  166. package/src/components/MultiSelect/MultiSelect.tsx +29 -19
  167. package/src/components/PhoneInput/PhoneInput.d.ts +3 -0
  168. package/src/components/PhoneInput/PhoneInput.stories.tsx +95 -0
  169. package/src/components/PhoneInput/PhoneInput.tsx +90 -0
  170. package/src/components/PhoneInput/index.ts +1 -0
  171. package/src/components/PhoneInput/phoneInput.scss +3 -0
  172. package/src/components/PhoneInput/types.ts +10 -0
  173. package/src/components/PopUpModal/PopUpModal.stories.tsx +14 -13
  174. package/src/components/PopUpModal/PopUpModal.tsx +2 -1
  175. package/src/components/PopUpModal/types.ts +14 -13
  176. package/src/components/Select/Select.scss +20 -0
  177. package/src/components/Select/Select.stories.tsx +50 -1
  178. package/src/components/Select/Select.tsx +34 -7
  179. package/src/components/Select/components/Dropdown.scss +9 -0
  180. package/src/components/Select/components/Dropdown.tsx +20 -6
  181. package/src/components/Select/components/types.ts +1 -0
  182. package/src/components/Select/types.ts +12 -2
  183. package/src/components/TableTree/Components/TableBody.tsx +35 -0
  184. package/src/components/TableTree/Components/TableCell.tsx +59 -0
  185. package/src/components/TableTree/Components/TableHead.tsx +39 -0
  186. package/src/components/TableTree/Components/TableRow.tsx +37 -0
  187. package/src/components/TableTree/TableTree.scss +8 -5
  188. package/src/components/TableTree/TableTree.tsx +16 -46
  189. package/src/components/TableTree/Utils/getAllChildIds.ts +12 -0
  190. package/src/components/TableTree/Utils/renderSpaces.ts +0 -0
  191. package/src/components/TableTree/types.ts +43 -5
  192. package/src/components/TableWithAccordion/TableWithAccordion.scss +54 -0
  193. package/src/components/TableWithAccordion/TableWithAccordion.stories.tsx +94 -0
  194. package/src/components/TableWithAccordion/TableWithAccordion.tsx +174 -0
  195. package/src/components/TableWithAccordion/data.ts +37 -0
  196. package/src/components/TableWithAccordion/index.ts +1 -0
  197. package/src/components/TableWithAccordion/types.ts +70 -0
  198. package/src/components/Tabs/Tabs.scss +0 -1
  199. package/src/index.ts +14 -1
  200. package/src/utils/checkDuplicates/CheckDuplicates.stories.tsx +40 -0
  201. package/src/utils/checkDuplicates/checkDuplicates.ts +13 -0
@@ -2,23 +2,19 @@ import React from 'react';
2
2
  import './AttachImage.scss';
3
3
  import Icon from '../Icon/Icon';
4
4
  import Tooltip from '../Tooltip';
5
-
6
- export interface AttachImageProps {
7
- imageSrc: string;
8
- onExpandClick: () => void;
9
- onDeleteClick: () => void;
10
- onDownloadClick: () => void;
11
- }
5
+ import { AttachImageProps } from './types';
12
6
 
13
7
  const AttachImage: React.FC<AttachImageProps> = ({
14
8
  imageSrc,
15
9
  onExpandClick,
16
10
  onDeleteClick,
17
11
  onDownloadClick,
12
+ height = '75px',
13
+ width = '79px',
18
14
  }) => {
19
15
  return (
20
- <div className="ff-attach-image-container">
21
- <div className="ff-image-wrapper">
16
+ <div className="ff-attach-image-container" style={{ height, width }}>
17
+ <div className="ff-image-wrapper" style={{ height, width }}>
22
18
  <img src={imageSrc} alt="Attached" />
23
19
  <div className="ff-hover-icons">
24
20
  <div className="ff-top-icons">
@@ -1,19 +1,26 @@
1
1
  export interface AttachImageProps {
2
- /**
3
- * The image source to display.
4
- */
5
- imageSrc: string;
6
- /**
7
- * Function triggered when the expand icon is clicked.
8
- */
9
- onExpandClick: () => void;
10
- /**
11
- * Function triggered when the delete icon is clicked.
12
- */
13
- onDeleteClick: () => void;
14
- /**
15
- * Function triggered when the download icon is clicked.
16
- */
17
- onDownloadClick: () => void;
18
- }
19
-
2
+ /**
3
+ * The image source to display.
4
+ */
5
+ imageSrc: string;
6
+ /**
7
+ * Function triggered when the expand icon is clicked.
8
+ */
9
+ onExpandClick: () => void;
10
+ /**
11
+ * Function triggered when the delete icon is clicked.
12
+ */
13
+ onDeleteClick: () => void;
14
+ /**
15
+ * Function triggered when the download icon is clicked.
16
+ */
17
+ onDownloadClick: () => void;
18
+ /**
19
+ * Custom height for the component.
20
+ */
21
+ height?: string;
22
+ /**
23
+ * Custom width for the component.
24
+ */
25
+ width?: string;
26
+ }
@@ -20,5 +20,9 @@
20
20
  width: 64px;
21
21
  height: 64px;
22
22
  }
23
+ .ff-avatar-label {
24
+ font-weight: bold;
25
+ text-align: center;
26
+ }
23
27
  }
24
28
 
@@ -9,12 +9,12 @@ const meta: Meta<typeof Avatar> = {
9
9
  layout: 'centered',
10
10
  },
11
11
  argTypes: {
12
- variant: {
13
- control: { type: 'radio' },
14
- options: ['small', 'medium', 'large'],
12
+ variant: {
13
+ control: { type: 'radio' },
14
+ options: ['small', 'medium', 'large'],
15
+ },
15
16
  },
16
- }
17
- }
17
+ };
18
18
  export default meta;
19
19
 
20
20
  type Story = StoryObj<typeof meta>;
@@ -41,16 +41,36 @@ export const Large: Story = {
41
41
  };
42
42
 
43
43
  export const CustomAvatarSize: Story = {
44
- args: {
45
- customAvatarSize: 30,
46
- iconName: 'accordion_header_icon',
47
- },
48
- };
49
-
50
- export const CustomIconSize: Story = {
51
- args: {
52
- customIconSize: 30,
53
- customAvatarSize: 40,
54
- iconName: 'accordion_header_icon',
55
- },
56
- };
44
+ args: {
45
+ customAvatarSize: 30,
46
+ iconName: 'accordion_header_icon',
47
+ },
48
+ };
49
+
50
+ export const CustomIconSize: Story = {
51
+ args: {
52
+ customIconSize: 30,
53
+ customAvatarSize: 40,
54
+ iconName: 'accordion_header_icon',
55
+ },
56
+ };
57
+
58
+ export const WithLabel: Story = {
59
+ args: {
60
+ label: 'AB',
61
+ customAvatarSize: 40,
62
+ labelFontSize: '16px',
63
+ backgroundColor: '#E0E0E0',
64
+ iconColor: '#333',
65
+ },
66
+ };
67
+
68
+ export const LabelWithCustomSize: Story = {
69
+ args: {
70
+ label: 'XY',
71
+ customAvatarSize: 50,
72
+ labelFontSize: '20px',
73
+ backgroundColor: '#F5A623',
74
+ iconColor: '#FFF',
75
+ },
76
+ };
@@ -9,15 +9,31 @@ const Avatar: React.FC<AvatarProps> = ({
9
9
  iconColor= 'var(--avatar-icon-color)',
10
10
  customAvatarSize,
11
11
  customIconSize,
12
- backgroundColor
12
+ backgroundColor,
13
+ label,
14
+ labelFontSize,
13
15
  }) => {
14
-
16
+ const truncatedLabel = label?.slice(0, 2);
15
17
  return (
16
18
  <div
17
19
  className={`ff-avatar ff-avatar--${variant}`}
18
20
  style={{ height: `${customAvatarSize}px`, width: `${customAvatarSize}px`, backgroundColor }}
19
21
  >
20
- <Icon name={iconName} height={customIconSize} width={customIconSize} color={iconColor}/>
22
+ {label ? (
23
+ <span
24
+ className="ff-avatar-label"
25
+ style={{ fontSize: labelFontSize || '14px', color: iconColor }}
26
+ >
27
+ {truncatedLabel}
28
+ </span>
29
+ ) : (
30
+ <Icon
31
+ name={iconName!}
32
+ height={customIconSize}
33
+ width={customIconSize}
34
+ color={iconColor}
35
+ />
36
+ )}
21
37
  </div>
22
38
  );
23
39
  };
@@ -10,7 +10,7 @@ export interface AvatarProps {
10
10
  /**
11
11
  * This property specifies the name of the icon to be displayed within the avatar.
12
12
  */
13
- iconName: string;
13
+ iconName?: string;
14
14
  /**
15
15
  * This property allows you to customize the color of the icon within the avatar.
16
16
  */
@@ -24,4 +24,12 @@ export interface AvatarProps {
24
24
  * This property allows you to set a custom size for the icon within the avatar.
25
25
  */
26
26
  customIconSize?: number;
27
+ /**
28
+ * This property specifies the label to display inside the avatar, used as an alternative to the icon.
29
+ */
30
+ label?: string;
31
+ /**
32
+ * This property allows you to customize the font size of the label inside the avatar.
33
+ */
34
+ labelFontSize?: string;
27
35
  }
@@ -51,8 +51,7 @@ const DonutChart: React.FC<DonutChartProps> = ({
51
51
  // Calculate angles and gaps
52
52
  const TOTAL_GAP_ANGLE = gapAngle * nonZeroValues.length;
53
53
  let remainingAngle = 2 * Math.PI - TOTAL_GAP_ANGLE;
54
- let currentAngle = Math.PI / 2;
55
-
54
+ let currentAngle = -Math.PI / 2;
56
55
  const MIN_PERCENTAGE = 1;
57
56
  const MIN_ANGLE = (MIN_PERCENTAGE / 100) * (2 * Math.PI);
58
57
  let minAngleTotal = 0;
@@ -98,7 +97,11 @@ const DonutChart: React.FC<DonutChartProps> = ({
98
97
  strokeWidth={lineWidth}
99
98
  onMouseEnter={() => handleMouseEnter(normalizedStatus)}
100
99
  onMouseLeave={handleMouseLeave}
101
- strokeOpacity={0.8}
100
+ strokeOpacity={
101
+ hoveredStatus === null || hoveredStatus === normalizedStatus
102
+ ? 0.8
103
+ : 0.3
104
+ }
102
105
  />
103
106
  {/* Hover effect */}
104
107
  {hoveredStatus === normalizedStatus && (
@@ -129,6 +132,8 @@ const DonutChart: React.FC<DonutChartProps> = ({
129
132
  ? 'ff-highlighted'
130
133
  : 'ff-fade'
131
134
  }`}
135
+ onMouseEnter={() => handleMouseEnter(statusKey)}
136
+ onMouseLeave={handleMouseLeave}
132
137
  >
133
138
  <div className="ff-status-label">
134
139
  <div
@@ -2,7 +2,11 @@
2
2
 
3
3
  .ff-radial-chart-container {
4
4
  cursor: pointer;
5
+ display: flex;
6
+ justify-content: space-between;
7
+ align-items: center;
5
8
  svg {
9
+ vertical-align: middle;
6
10
  text {
7
11
  @extend .font-size-8;
8
12
  font-size: var(--fontSize) !important;
@@ -6,6 +6,7 @@ import {
6
6
  ArcResult,
7
7
  ArcAnglesResult,
8
8
  } from './types';
9
+ import Tooltip from '../../Tooltip';
9
10
 
10
11
  const useColorMappings = () =>
11
12
  useMemo(() => {
@@ -117,54 +118,59 @@ const RadialChart: React.FC<RadialChartProps> = ({
117
118
  calculateArcAngles(status.value, total, currentAngle, radius);
118
119
  currentAngle = endAngle;
119
120
  return (
120
- <svg
121
- key={status.status}
122
- width={svgSize}
123
- height={svgSize}
124
- viewBox={`0 0 ${svgSize} ${svgSize}`}
125
- onClick={() => onClick(status)}
126
- role="img"
127
- aria-label={`${status.status}: ${Math.round(percentage * 100)}%`}
121
+ <Tooltip
122
+ title={`${status.status}: ${Math.round(percentage * 100)}%`}
123
+ zIndex={1000}
128
124
  >
129
- <g
130
- transform={`translate(${radius + lineWidth}, ${
131
- radius + lineWidth
132
- })`}
125
+ <svg
126
+ key={status.status}
127
+ width={svgSize}
128
+ height={svgSize}
129
+ viewBox={`0 0 ${svgSize} ${svgSize}`}
130
+ onClick={() => onClick(status)}
131
+ role="img"
132
+ aria-label={`${status.status}: ${Math.round(percentage * 100)}%`}
133
133
  >
134
- {/* Background Circle */}
135
- <path
136
- d={backgroundArcPath}
137
- fill="none"
138
- stroke={
139
- backgroundColorMapping[
140
- normalizedStatus as keyof typeof colorMapping
141
- ]
142
- }
143
- strokeWidth={lineWidth}
144
- />
145
- {/* Status Arc */}
146
- <path
147
- d={foregroundArcPath}
148
- fill="none"
149
- stroke={
150
- colorMapping[normalizedStatus as keyof typeof colorMapping]
151
- }
152
- strokeWidth={lineWidth}
153
- />
154
- {/* Percentage Text */}
155
- <text
156
- x="0"
157
- y="0"
158
- fill={
159
- colorMapping[normalizedStatus as keyof typeof colorMapping]
160
- }
161
- textAnchor="middle"
162
- dominantBaseline="central"
134
+ <g
135
+ transform={`translate(${radius + lineWidth}, ${
136
+ radius + lineWidth
137
+ })`}
163
138
  >
164
- {`${Math.round(percentage * 100)}%`}
165
- </text>
166
- </g>
167
- </svg>
139
+ {/* Background Circle */}
140
+ <path
141
+ d={backgroundArcPath}
142
+ fill="none"
143
+ stroke={
144
+ backgroundColorMapping[
145
+ normalizedStatus as keyof typeof colorMapping
146
+ ]
147
+ }
148
+ strokeWidth={lineWidth}
149
+ />
150
+ {/* Status Arc */}
151
+ <path
152
+ d={foregroundArcPath}
153
+ fill="none"
154
+ stroke={
155
+ colorMapping[normalizedStatus as keyof typeof colorMapping]
156
+ }
157
+ strokeWidth={lineWidth}
158
+ />
159
+ {/* Percentage Text */}
160
+ <text
161
+ x="0"
162
+ y="0"
163
+ fill={
164
+ colorMapping[normalizedStatus as keyof typeof colorMapping]
165
+ }
166
+ textAnchor="middle"
167
+ dominantBaseline="central"
168
+ >
169
+ {`${Math.round(percentage * 100)}%`}
170
+ </text>
171
+ </g>
172
+ </svg>
173
+ </Tooltip>
168
174
  );
169
175
  })}
170
176
  </div>
@@ -55,10 +55,49 @@
55
55
  .ff-checkbox-input:checked + .ff-checkbox-custom {
56
56
  background: var(--brand-color);
57
57
  border-color: var(--brand-color);
58
+ &.ff-checkbox-checked {
59
+ &--passed {
60
+ background-color: var(--ff-card-passed-status-bg-color);
61
+ border-color: var(--ff-card-passed-status-bg-color);
62
+ }
63
+ &--failed {
64
+ background-color: var(--ff-card-failed-status-bg-color);
65
+ border-color: var(--ff-card-failed-status-bg-color);
66
+ }
67
+ &--warning {
68
+ background-color: var(--ff-card-warning-status-bg-color);
69
+ border-color: var(--ff-card-warning-status-bg-color);
70
+ }
71
+ &--skipped {
72
+ background-color: var(--ff-card-skipped-status-bg-color);
73
+ border-color: var(--ff-card-skipped-status-bg-color);
74
+ }
75
+ &--flaky {
76
+ background-color: var(-- ff-card-flaky-status-bg-color);
77
+ border-color: var(-- ff-card-flaky-status-bg-color);
78
+ }
79
+ }
58
80
  }
59
81
 
60
82
  .ff-checkbox-input:checked:hover + .ff-checkbox-custom {
61
83
  background: var(--brand-color);
84
+ &.ff-checkbox-checked {
85
+ &--passed {
86
+ background: var(--ff-card-passed-status-bg-color);
87
+ }
88
+ &--failed {
89
+ background: var(--ff-card-failed-status-bg-color);
90
+ }
91
+ &--warning {
92
+ background: var(--ff-card-warning-status-bg-color);
93
+ }
94
+ &--skipped {
95
+ background: var(--ff-card-skipped-status-bg-color);
96
+ }
97
+ &--flaky {
98
+ background: var(-- ff-card-flaky-status-bg-color);
99
+ }
100
+ }
62
101
  &::after {
63
102
  opacity: 1;
64
103
  }
@@ -86,4 +125,22 @@
86
125
  }
87
126
  }
88
127
  }
128
+
129
+ .ff-checkbox {
130
+ &--passed {
131
+ border-color: var(--ff-card-passed-status-bg-color);
132
+ }
133
+ &--failed {
134
+ border-color: var(--ff-card-failed-status-bg-color);
135
+ }
136
+ &--warning {
137
+ border-color: var(--ff-card-warning-status-bg-color);
138
+ }
139
+ &--skipped {
140
+ border-color: var(--ff-card-skipped-status-bg-color);
141
+ }
142
+ &--flaky {
143
+ border-color: var(-- ff-card-flaky-status-bg-color);
144
+ }
145
+ }
89
146
  }
@@ -1,6 +1,6 @@
1
+ import React, { useState } from 'react';
1
2
  import { Meta, StoryObj } from '@storybook/react';
2
3
  import Checkbox from './Checkbox';
3
- import { useState } from 'react';
4
4
 
5
5
  const meta: Meta<typeof Checkbox> = {
6
6
  component: Checkbox,
@@ -10,38 +10,114 @@ const meta: Meta<typeof Checkbox> = {
10
10
  layout: 'centered',
11
11
  },
12
12
  };
13
+
13
14
  export default meta;
14
15
 
15
16
  type Story = StoryObj<typeof meta>;
16
17
 
18
+ const useCheckboxState = (initialState = false) => {
19
+ const [checked, setChecked] = useState(initialState);
20
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
21
+ setChecked(event.target.checked);
22
+ };
23
+ return { checked, handleChange };
24
+ };
25
+
26
+ // Story: Default Checkbox
17
27
  export const Default: Story = {
18
- args: {
19
- label: 'Enter label',
28
+ render: () => {
29
+ const { checked, handleChange } = useCheckboxState();
30
+ return <Checkbox label="Default Checkbox" checked={checked} onChange={handleChange} />;
20
31
  },
21
32
  };
22
33
 
34
+ // Story: Partial Checkbox
23
35
  export const Partial: Story = {
36
+ render: () => {
37
+ const { checked, handleChange } = useCheckboxState();
38
+ const [partial, setPartial] = useState(true);
39
+
40
+ const handlePartialChange = (event: React.ChangeEvent<HTMLInputElement>) => {
41
+ setPartial(!event.target.checked);
42
+ handleChange(event);
43
+ };
44
+
45
+ return (
46
+ <Checkbox
47
+ label="Partially Selected Checkbox"
48
+ partial={partial}
49
+ checked={checked}
50
+ onChange={handlePartialChange}
51
+ />
52
+ );
53
+ },
54
+ };
55
+
56
+ // Story: Disabled Checkbox
57
+ export const Disabled: Story = {
24
58
  args: {
25
- label: 'Enter label',
26
- partial: true,
59
+ label: 'Disabled Checkbox',
60
+ disabled: true,
27
61
  },
28
62
  };
29
63
 
30
- export const Controlled: Story = {
64
+ // Story: Checkbox Variants
65
+ export const Variants: Story = {
31
66
  render: () => {
32
- const [checked, setChecked] = useState(false);
67
+ const variants = ['passed', 'failed', 'warning', 'skipped', 'flaky'] as const;
68
+ const initialStates = variants.reduce((acc, variant) => ({ ...acc, [variant]: false }), {});
69
+ const [checkedStates, setCheckedStates] = useState(initialStates);
33
70
 
34
- const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
35
- setChecked((event.target as HTMLInputElement).checked);
71
+ const handleChange = (variant: string) => (event: React.ChangeEvent<HTMLInputElement>) => {
72
+ setCheckedStates({ ...checkedStates, [variant]: event.target.checked });
36
73
  };
37
74
 
38
75
  return (
39
- <Checkbox
40
- label="click here to proceed with controlled component"
41
- disabled={false}
42
- checked={checked}
43
- onChange={handleChange}
44
- />
76
+ <div style={{ display: 'flex', gap: '16px' }}>
77
+ {variants.map((variant) => (
78
+ <Checkbox
79
+ key={variant}
80
+ label={variant.charAt(0).toUpperCase() + variant.slice(1)}
81
+ variant={variant}
82
+ checked={checkedStates[variant]}
83
+ onChange={handleChange(variant)}
84
+ />
85
+ ))}
86
+ </div>
87
+ );
88
+ },
89
+ };
90
+
91
+ // Story: Controlled Checkbox
92
+ export const Controlled: Story = {
93
+ render: () => {
94
+ const { checked, handleChange } = useCheckboxState();
95
+ return <Checkbox label="Controlled Checkbox" checked={checked} onChange={handleChange} />;
96
+ },
97
+ };
98
+
99
+ // Story: All Features Showcase
100
+ export const AllFeatures: Story = {
101
+ render: () => {
102
+ const { checked: defaultChecked, handleChange: handleDefaultChange } = useCheckboxState();
103
+ const { checked: partialChecked, handleChange: handlePartialChange } = useCheckboxState(true);
104
+ const variants = ['passed', 'failed', 'warning', 'skipped', 'flaky'] as const;
105
+
106
+ return (
107
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
108
+ <Checkbox label="Default Checkbox" checked={defaultChecked} onChange={handleDefaultChange} />
109
+ <Checkbox
110
+ label="Partially Selected"
111
+ partial={partialChecked}
112
+ onChange={handlePartialChange}
113
+ />
114
+ <Checkbox label="Disabled Checkbox" disabled />
115
+ <div style={{ display: 'flex', gap: '16px' }}>
116
+ {variants.map((variant) => (
117
+ <Checkbox key={variant} label={variant} variant={variant} />
118
+ ))}
119
+ </div>
120
+ </div>
45
121
  );
46
122
  },
47
123
  };
@@ -14,6 +14,7 @@ const Checkbox: React.FC<CheckboxProps> = ({
14
14
  checked: initialChecked = false,
15
15
  partial = false,
16
16
  onChange,
17
+ variant
17
18
  }) => {
18
19
  const [checked, setChecked] = useState(initialChecked);
19
20
 
@@ -34,8 +35,10 @@ const Checkbox: React.FC<CheckboxProps> = ({
34
35
  />
35
36
  <span
36
37
  className={classNames('ff-checkbox-custom', {
37
- 'ff-checkbox-checked': checked,
38
+ 'ff-checkbox-checked': checked ,
38
39
  'ff-storybook-checkbox--partial': partial && !checked,
40
+ [`ff-checkbox--${variant}`]: variant,
41
+ [`ff-checkbox-checked--${variant}`]: checked && variant,
39
42
  })}
40
43
  >
41
44
  {checked && (
@@ -27,4 +27,8 @@ export interface CheckboxProps {
27
27
  * For partially checked checkbox
28
28
  */
29
29
  partial?: boolean;
30
+ /**
31
+ * For variant color
32
+ */
33
+ variant?: 'passed' | 'failed' | 'warning' | 'skipped' | 'flaky';
30
34
  }