pixel-priya 1.3.38 → 1.3.40

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 (83) hide show
  1. package/lib/components/AllProjectsDropdown/AllProjectsDropdown.js +24 -17
  2. package/lib/components/AllProjectsDropdown/AllProjectsDropdown.js.map +1 -1
  3. package/lib/components/AudioPlayer/AudioPlayer.d.ts +5 -0
  4. package/lib/components/AudioPlayer/AudioPlayer.js +129 -0
  5. package/lib/components/AudioPlayer/AudioPlayer.js.map +1 -0
  6. package/lib/components/AudioPlayer/index.d.ts +2 -0
  7. package/lib/components/AudioPlayer/index.js +3 -0
  8. package/lib/components/AudioPlayer/index.js.map +1 -0
  9. package/lib/components/AudioPlayer/types.d.ts +67 -0
  10. package/lib/components/AudioPlayer/types.js +2 -0
  11. package/lib/components/AudioPlayer/types.js.map +1 -0
  12. package/lib/components/Audioplayercontainer/Audioplayercontainer.d.ts +3 -0
  13. package/lib/components/Audioplayercontainer/Audioplayercontainer.js +68 -0
  14. package/lib/components/Audioplayercontainer/Audioplayercontainer.js.map +1 -0
  15. package/lib/components/CardPanel/CardPanel.d.ts +4 -0
  16. package/lib/components/CardPanel/CardPanel.js +9 -0
  17. package/lib/components/CardPanel/CardPanel.js.map +1 -0
  18. package/lib/components/CardPanel/index.d.ts +1 -0
  19. package/lib/components/CardPanel/index.js +2 -0
  20. package/lib/components/CardPanel/index.js.map +1 -0
  21. package/lib/components/CardPanel/types.d.ts +27 -0
  22. package/lib/components/CardPanel/types.js +2 -0
  23. package/lib/components/CardPanel/types.js.map +1 -0
  24. package/lib/components/Charts/BarChart/BarChart.js +32 -29
  25. package/lib/components/Charts/BarChart/BarChart.js.map +1 -1
  26. package/lib/components/Charts/DashboardDonutChart/DashboardDonutChart.js +17 -12
  27. package/lib/components/Charts/DashboardDonutChart/DashboardDonutChart.js.map +1 -1
  28. package/lib/components/Charts/DashboardDonutChart/types.d.ts +1 -0
  29. package/lib/components/Charts/ScoreChart/ScoreGaugeChart.d.ts +5 -0
  30. package/lib/components/Charts/ScoreChart/ScoreGaugeChart.js +98 -0
  31. package/lib/components/Charts/ScoreChart/ScoreGaugeChart.js.map +1 -0
  32. package/lib/components/Charts/ScoreChart/index.d.ts +1 -0
  33. package/lib/components/Charts/ScoreChart/index.js +2 -0
  34. package/lib/components/Charts/ScoreChart/index.js.map +1 -0
  35. package/lib/components/Charts/ScoreChart/types.d.ts +42 -0
  36. package/lib/components/Charts/ScoreChart/types.js +2 -0
  37. package/lib/components/Charts/ScoreChart/types.js.map +1 -0
  38. package/lib/components/Charts/StackedBarChart/StackedBarChart.js +4 -3
  39. package/lib/components/Charts/StackedBarChart/StackedBarChart.js.map +1 -1
  40. package/lib/components/Chip/Chip.d.ts +1 -1
  41. package/lib/components/Chip/Chip.js +19 -6
  42. package/lib/components/Chip/Chip.js.map +1 -1
  43. package/lib/components/Chip/types.d.ts +1 -0
  44. package/lib/components/Icon/iconList.js +48 -0
  45. package/lib/components/Icon/iconList.js.map +1 -1
  46. package/lib/components/MenuOption/MenuOption.js +3 -1
  47. package/lib/components/MenuOption/MenuOption.js.map +1 -1
  48. package/lib/components/MenuOption/types.d.ts +2 -0
  49. package/lib/components/NLPInput/NlpInput.d.ts +1 -1
  50. package/lib/components/NLPInput/NlpInput.js +3 -3
  51. package/lib/components/NLPInput/NlpInput.js.map +1 -1
  52. package/lib/components/NLPInput/components/NlpDropDown/NlpDropDownType.d.ts +2 -0
  53. package/lib/components/NLPInput/components/NlpDropDown/NlpDropDownType.js.map +1 -1
  54. package/lib/components/NLPInput/components/NlpDropDown/NlpDropdown.d.ts +1 -1
  55. package/lib/components/NLPInput/components/NlpDropDown/NlpDropdown.js +8 -5
  56. package/lib/components/NLPInput/components/NlpDropDown/NlpDropdown.js.map +1 -1
  57. package/lib/components/NLPInput/types.d.ts +2 -0
  58. package/lib/components/SequentialConnectingBranch/SequentialConnectingBranch.js +2 -2
  59. package/lib/components/SequentialConnectingBranch/SequentialConnectingBranch.js.map +1 -1
  60. package/lib/components/SequentialConnectingBranch/types.d.ts +1 -0
  61. package/lib/components/Table/Types.d.ts +6 -0
  62. package/lib/components/Table/components/SortableRow.js +10 -2
  63. package/lib/components/Table/components/SortableRow.js.map +1 -1
  64. package/lib/components/TableWithAccordion/TableWithAccordion.js +8 -24
  65. package/lib/components/TableWithAccordion/TableWithAccordion.js.map +1 -1
  66. package/lib/components/Tabs/Tabs.js +2 -0
  67. package/lib/components/Tabs/Tabs.js.map +1 -1
  68. package/lib/components/Toastify/Toastify.js +1 -1
  69. package/lib/components/Weightagetable/Weightagetable.d.ts +5 -0
  70. package/lib/components/Weightagetable/Weightagetable.js +128 -0
  71. package/lib/components/Weightagetable/Weightagetable.js.map +1 -0
  72. package/lib/components/Weightagetable/index.d.ts +2 -0
  73. package/lib/components/Weightagetable/index.js +3 -0
  74. package/lib/components/Weightagetable/index.js.map +1 -0
  75. package/lib/components/Weightagetable/types.d.ts +161 -0
  76. package/lib/components/Weightagetable/types.js +2 -0
  77. package/lib/components/Weightagetable/types.js.map +1 -0
  78. package/lib/index.d.ts +248 -4
  79. package/lib/index.js +10 -10
  80. package/lib/index.js.map +1 -1
  81. package/lib/styles.css +1 -1
  82. package/lib/tsconfig.tsbuildinfo +1 -1
  83. package/package.json +2 -2
@@ -0,0 +1,128 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useId, useState } from 'react';
3
+ import classNames from 'classnames';
4
+ import './WeightageTable.scss';
5
+ import Icon from '../Icon';
6
+ import Input from '../Input';
7
+ import Typography from '../Typography';
8
+ import AutoTruncateText from '../AutoTruncateText';
9
+ import TooltipService from '../TooltipService';
10
+ const DEFAULT_COLUMN_LABELS = {
11
+ principle: 'Principle',
12
+ guidelines: 'Guidelines',
13
+ weightage: 'Weightage in %',
14
+ };
15
+ const MAX_WEIGHTAGE_VALUE = 100;
16
+ const getAccessibleText = (value) => {
17
+ if (value === null || value === undefined || typeof value === 'boolean') {
18
+ return '';
19
+ }
20
+ if (typeof value === 'string' || typeof value === 'number') {
21
+ return String(value);
22
+ }
23
+ if (Array.isArray(value)) {
24
+ return value.map(getAccessibleText).filter(Boolean).join(' ');
25
+ }
26
+ if (React.isValidElement(value)) {
27
+ return getAccessibleText(value.props.children);
28
+ }
29
+ return '';
30
+ };
31
+ const WeightageTable = ({ title = 'Success Criteria Weightage', totalWeightage, principleColumnLabel = DEFAULT_COLUMN_LABELS.principle, guidelinesColumnLabel = DEFAULT_COLUMN_LABELS.guidelines, weightageColumnLabel = DEFAULT_COLUMN_LABELS.weightage, columnLabels, groups = [], onWeightageChange = () => { }, renderWeightageCell, weightageInputWidth = '12%', onReset = () => { }, showResetIcon = true, disabled = false, minValue = 0, maxValue = 100, isAccordion = true, defaultExpanded = false, className = '', style, }) => {
32
+ const baseId = useId().replace(/:/g, '');
33
+ const [isExpanded, setIsExpanded] = useState(defaultExpanded);
34
+ const titleId = `${baseId}-weightage-title`;
35
+ const contentId = `${baseId}-weightage-content`;
36
+ const totalGuidelineCount = groups.reduce((count, group) => count + group.guidelines.length, 0);
37
+ let nextBodyRowIndex = 2;
38
+ const groupStartRowIndexes = groups.map((group) => {
39
+ const startRowIndex = nextBodyRowIndex;
40
+ nextBodyRowIndex += group.guidelines.length;
41
+ return startRowIndex;
42
+ });
43
+ const resolvedColumnLabels = {
44
+ principle: columnLabels?.principle ?? principleColumnLabel,
45
+ guidelines: columnLabels?.guidelines ?? guidelinesColumnLabel,
46
+ weightage: columnLabels?.weightage ?? weightageColumnLabel,
47
+ };
48
+ const weightageColumnAccessibleLabel = getAccessibleText(resolvedColumnLabels.weightage) ||
49
+ DEFAULT_COLUMN_LABELS.weightage;
50
+ const computedTotal = totalWeightage ??
51
+ groups.reduce((sum, group) => sum +
52
+ group.guidelines.reduce((rowSum, row) => rowSum + (row.value || 0), 0), 0);
53
+ const handleRowChange = (groupIndex, rowIndex, row, rowMin, rowMax, event) => {
54
+ const rawValue = event.target.value;
55
+ const numericValue = rawValue === '' ? 0 : Number(rawValue);
56
+ let error = false;
57
+ let helperText = '';
58
+ if (numericValue < rowMin || numericValue > rowMax) {
59
+ error = true;
60
+ helperText = `Value must be between ${rowMin} and ${rowMax}`;
61
+ }
62
+ updateWeightageRow(groupIndex, rowIndex, {
63
+ ...row,
64
+ value: numericValue,
65
+ error,
66
+ helperText,
67
+ });
68
+ };
69
+ const updateWeightageRow = (groupIndex, rowIndex, updatedRow) => {
70
+ onWeightageChange(groupIndex, rowIndex, updatedRow);
71
+ };
72
+ const toggleAccordion = () => {
73
+ setIsExpanded((prev) => !prev);
74
+ };
75
+ const shouldShowContent = !isAccordion || isExpanded;
76
+ const renderDefaultWeightageCell = ({ groupIndex, rowIndex, row, minValue: rowMin, maxValue: rowMax, disabled: isCellDisabled, inputWidth, inputProps, }) => (_jsx("div", { className: "ff-weightage-input", style: { width: inputWidth }, children: _jsx(Input, { type: "number", noBorder // Experimental prop to remove border from input field
77
+ : true, value: row.value, minValue: rowMin, maxValue: rowMax, disabled: isCellDisabled, error: row.error, helperText: row.helperText, placeholder: "", variant: "primary", isLabelRequired: false, disableAfterMaxValueReached: true, size: "small", className: "ff-weightage-input-field", onChange: (event) => handleRowChange(groupIndex, rowIndex, row, rowMin, rowMax, event), setUpdatedNumberValue: (value) => updateWeightageRow(groupIndex, rowIndex, {
78
+ ...row,
79
+ value,
80
+ }), ...inputProps }) }));
81
+ const getWeightageCellContent = (props) => renderWeightageCell
82
+ ? renderWeightageCell(props)
83
+ : renderDefaultWeightageCell(props);
84
+ const renderHeaderCell = (cellClassName, label, columnIndex) => (_jsx("div", { className: cellClassName, role: "columnheader", "aria-colindex": columnIndex, children: _jsx(Typography, { fontWeight: "semi-bold", children: _jsx(AutoTruncateText, { children: label }) }) }));
85
+ const renderGuidelineRow = (group, groupIndex, groupKey, row, rowIndex, ariaRowIndex) => {
86
+ const rowKey = row.key ?? `${groupKey}-${row.label}`;
87
+ const rowConfiguredMax = row.maxValue ?? maxValue;
88
+ const rowMax = Math.min(rowConfiguredMax, MAX_WEIGHTAGE_VALUE);
89
+ const rowMin = Math.min(row.minValue ?? minValue, rowMax);
90
+ const isCellDisabled = disabled || !!row.disabled || !shouldShowContent;
91
+ const rowId = `${baseId}-weightage-row-${groupIndex}-${rowIndex}`;
92
+ const inputErrorId = row.error && row.helperText ? `${rowId}-error` : undefined;
93
+ const weightageCellProps = {
94
+ group,
95
+ row,
96
+ groupIndex,
97
+ rowIndex,
98
+ rowKey,
99
+ minValue: rowMin,
100
+ maxValue: rowMax,
101
+ disabled: isCellDisabled,
102
+ inputWidth: weightageInputWidth,
103
+ inputProps: {
104
+ id: `${rowId}-input`,
105
+ name: rowKey,
106
+ 'aria-label': `${weightageColumnAccessibleLabel} for ${row.label} in ${group.principle}`,
107
+ 'aria-describedby': inputErrorId,
108
+ 'aria-errormessage': inputErrorId,
109
+ 'aria-invalid': row.error || undefined,
110
+ },
111
+ onChange: (updatedRow) => updateWeightageRow(groupIndex, rowIndex, updatedRow),
112
+ };
113
+ return (_jsxs("div", { className: "ff-weightage-row", role: "row", "aria-rowindex": ariaRowIndex, children: [rowIndex === 0 && (_jsx("div", { className: "ff-weightage-principle", role: "rowheader", "aria-colindex": 1, "aria-rowspan": group.guidelines.length, style: {
114
+ gridRow: `span ${group.guidelines.length}`,
115
+ }, children: _jsx(Typography, { fontWeight: "medium", children: _jsx(AutoTruncateText, { children: group.principle }) }) })), _jsx("div", { className: "ff-weightage-guideline", role: "cell", "aria-colindex": 2, children: _jsx(Typography, { children: _jsx(AutoTruncateText, { className: "auto-truncate", children: row.label }) }) }), _jsx("div", { className: "ff-weightage-value", role: "cell", "aria-colindex": 3, children: getWeightageCellContent(weightageCellProps) })] }, rowKey));
116
+ };
117
+ const renderGroup = (group, groupIndex, startRowIndex) => {
118
+ const groupKey = group.key ?? group.principle;
119
+ return (_jsx("div", { className: "ff-weightage-group", role: "rowgroup", "aria-label": group.principle, children: group.guidelines.map((row, rowIndex) => renderGuidelineRow(group, groupIndex, groupKey, row, rowIndex, startRowIndex + rowIndex)) }, groupKey));
120
+ };
121
+ return (_jsxs("div", { className: classNames('ff-weightage-table', className), style: style, children: [_jsx(TooltipService, {}), _jsxs("div", { className: "ff-weightage-head", children: [_jsx("div", { className: "ff-weightage-title", id: titleId, children: _jsx(Typography, { fontWeight: "semi-bold", children: _jsx(AutoTruncateText, { children: title }) }) }), _jsxs("span", { className: "ff-weightage-total", children: [_jsx("span", { className: "ff-weightage-total-value", "aria-live": "polite", "aria-label": `Total weightage ${computedTotal}`, children: _jsx(Typography, { fontWeight: "semi-bold", children: _jsxs(AutoTruncateText, { children: ["Total Weightage : ", computedTotal] }) }) }), showResetIcon && (_jsx("button", { type: "button", className: "ff-weightage-icon-button", onClick: onReset, "aria-label": "Reset weightage values to default", "data-tooltip": "Reset to default value", children: _jsx(Icon, { name: "reset_default_value", withPadding: false }) })), isAccordion && (_jsx("button", { type: "button", className: "ff-weightage-icon-button", onClick: toggleAccordion, "aria-label": isExpanded
122
+ ? 'Collapse weightage table'
123
+ : 'Expand weightage table', "aria-expanded": shouldShowContent, "aria-controls": contentId, "data-tooltip": isExpanded ? 'Collapse' : 'Expand', children: _jsx(Icon, { name: isExpanded ? 'arrow_up' : 'arrow_down', withPadding: false }) }))] })] }), _jsx("div", { className: classNames('ff-weightage-content', {
124
+ 'ff-weightage-content--expanded': shouldShowContent,
125
+ }), id: contentId, "aria-hidden": !shouldShowContent, ...(!shouldShowContent ? { inert: '' } : {}), children: _jsx("div", { className: "ff-weightage-content-inner", children: _jsxs("div", { className: "ff-weightage-grid", role: "table", "aria-labelledby": titleId, "aria-colcount": 3, "aria-rowcount": totalGuidelineCount + 1, children: [_jsxs("div", { className: "ff-weightage-row ff-weightage-row-head", role: "row", "aria-rowindex": 1, children: [renderHeaderCell('ff-weightage-principle', resolvedColumnLabels.principle, 1), renderHeaderCell('ff-weightage-guideline', resolvedColumnLabels.guidelines, 2), renderHeaderCell('ff-weightage-value', resolvedColumnLabels.weightage, 3)] }), groups.map((group, groupIndex) => renderGroup(group, groupIndex, groupStartRowIndexes[groupIndex] ?? 2))] }) }) })] }));
126
+ };
127
+ export default WeightageTable;
128
+ //# sourceMappingURL=Weightagetable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Weightagetable.js","sourceRoot":"","sources":["../../../src/components/Weightagetable/Weightagetable.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAe,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,UAAU,MAAM,YAAY,CAAC;AAQpC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,MAAM,UAAU,CAAC;AAC7B,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AACnD,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAE/C,MAAM,qBAAqB,GAA0B;IACnD,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;IACxB,SAAS,EAAE,gBAAgB;CAC5B,CAAC;AAEF,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC,MAAM,iBAAiB,GAAG,CAAC,KAAsB,EAAU,EAAE;IAC3D,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;QACxE,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC3D,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChE,CAAC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wB,EACxB,oBAAoB,CAAC,UAAU,EAC/B,CAAC,CACF,EACA,gBAAgB,CACf,oBAAoB,EACpB,oBAAoB,CAAC,SAAS,EAC9B,CAAC,CACF,IACG,EACL,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,CAChC,WAAW,CACT,KAAK,EACL,UAAU,EACV,oBAAoB,CAAC,UAAU,CAAC,IAAI,CAAC,CACtC,CACF,IACG,GACF,GACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default } from './Weightagetable';
2
+ export * from './types';
@@ -0,0 +1,3 @@
1
+ export { default } from './Weightagetable';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Weightagetable/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,cAAc,SAAS,CAAC"}
@@ -0,0 +1,161 @@
1
+ import React from 'react';
2
+ export type WeightageColumnLabels = {
3
+ principle: React.ReactNode;
4
+ guidelines: React.ReactNode;
5
+ weightage: React.ReactNode;
6
+ };
7
+ export interface WeightageRow {
8
+ /**
9
+ * Label for the guideline row, e.g. "1.1 - Text alternative"
10
+ */
11
+ label: string;
12
+ /**
13
+ * Weightage value in % for this row
14
+ */
15
+ value: number;
16
+ /**
17
+ * Unique key for the row, falls back to label if not provided
18
+ */
19
+ key?: string;
20
+ /**
21
+ * Disable the input for this row
22
+ */
23
+ disabled?: boolean;
24
+ /**
25
+ * Minimum allowed value for this row's input (passed to Input's minValue)
26
+ */
27
+ minValue?: number;
28
+ /**
29
+ * Maximum allowed value for this row's input (capped at 100)
30
+ */
31
+ maxValue?: number;
32
+ /**
33
+ * Error state for this row's input, controlled internally unless passed in
34
+ */
35
+ error?: boolean;
36
+ /**
37
+ * Helper text for this row's input, controlled internally unless passed in
38
+ */
39
+ helperText?: string;
40
+ }
41
+ export interface WeightageGroup {
42
+ /**
43
+ * Principle / group label, e.g. "1. Perceivable"
44
+ */
45
+ principle: string;
46
+ /**
47
+ * Unique key for the group, falls back to principle if not provided
48
+ */
49
+ key?: string;
50
+ /**
51
+ * Guideline rows belonging to this principle
52
+ */
53
+ guidelines: WeightageRow[];
54
+ }
55
+ export interface WeightageCellRenderProps {
56
+ group: WeightageGroup;
57
+ row: WeightageRow;
58
+ groupIndex: number;
59
+ rowIndex: number;
60
+ rowKey: string;
61
+ minValue: number;
62
+ maxValue: number;
63
+ disabled: boolean;
64
+ inputWidth?: React.CSSProperties['width'];
65
+ inputProps: {
66
+ id: string;
67
+ name: string;
68
+ 'aria-label': string;
69
+ 'aria-describedby'?: string;
70
+ 'aria-errormessage'?: string;
71
+ 'aria-invalid'?: boolean;
72
+ };
73
+ onChange: (updatedRow: WeightageRow) => void;
74
+ }
75
+ export interface WeightageTableProps {
76
+ /**
77
+ * Title shown on the left side of the header bar
78
+ */
79
+ title?: React.ReactNode;
80
+ /**
81
+ * Total weightage value shown on the right side of the header bar, e.g. 100.
82
+ * If not passed, it is auto-computed as the sum of all row values.
83
+ */
84
+ totalWeightage?: number;
85
+ /**
86
+ * Max possible weightage retained for backward compatibility.
87
+ * Use minValue/maxValue for default input validation.
88
+ */
89
+ maxWeightage?: number;
90
+ /**
91
+ * Column heading for the principle column
92
+ */
93
+ principleColumnLabel?: React.ReactNode;
94
+ /**
95
+ * Column heading for the guidelines column
96
+ */
97
+ guidelinesColumnLabel?: React.ReactNode;
98
+ /**
99
+ * Column heading for the weightage column
100
+ */
101
+ weightageColumnLabel?: React.ReactNode;
102
+ /**
103
+ * Preferred API for overriding column labels in one place.
104
+ * Individual label props are still supported for backward compatibility.
105
+ */
106
+ columnLabels?: Partial<WeightageColumnLabels>;
107
+ /**
108
+ * Data for the table body, grouped by principle. This component is controlled —
109
+ * the parent owns this array and updates it inside onWeightageChange.
110
+ */
111
+ groups: WeightageGroup[];
112
+ /**
113
+ * Called whenever a single row's value changes. Only that row's data is passed back —
114
+ * use groupIndex/rowIndex to update just that one row in your state.
115
+ */
116
+ onWeightageChange?: (groupIndex: number, rowIndex: number, updatedRow: WeightageRow) => void;
117
+ /**
118
+ * Optional custom renderer for the weightage cell.
119
+ * If omitted, the component renders its default number Input.
120
+ */
121
+ renderWeightageCell?: (props: WeightageCellRenderProps) => React.ReactNode;
122
+ /**
123
+ * Width of the default weightage Input, e.g. "70px", "12%", or 70.
124
+ */
125
+ weightageInputWidth?: React.CSSProperties['width'];
126
+ /**
127
+ * Called when the refresh/reset icon in the header is clicked
128
+ */
129
+ onReset?: () => void;
130
+ /**
131
+ * Show or hide the refresh/reset icon in the header
132
+ */
133
+ showResetIcon?: boolean;
134
+ /**
135
+ * Makes all weightage inputs disabled/read-only
136
+ */
137
+ disabled?: boolean;
138
+ /**
139
+ * Default minValue applied to every row's Input unless the row overrides it
140
+ */
141
+ minValue?: number;
142
+ /**
143
+ * Default maxValue applied to every row's Input unless the row overrides it.
144
+ * Values above 100 are capped at 100.
145
+ */
146
+ maxValue?: number;
147
+ /**
148
+ * Enables expand/collapse behavior for the table content.
149
+ */
150
+ isAccordion?: boolean;
151
+ /**
152
+ * Initial expanded state when accordion behavior is enabled.
153
+ */
154
+ defaultExpanded?: boolean;
155
+ /**
156
+ * To add styles in WeightageTable
157
+ */
158
+ className?: string;
159
+ style?: React.CSSProperties;
160
+ [key: string]: any;
161
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Weightagetable/types.ts"],"names":[],"mappings":""}