@kaizen/components 0.0.0-canary-stable-bundler-20240515025934 → 0.0.0-canary-stable-bundler-20240515064749
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.
- package/dist/cjs/Table/Table.cjs +17 -23
- package/dist/cjs/Table/Table.module.scss.cjs +2 -1
- package/dist/esm/Table/Table.mjs +17 -23
- package/dist/esm/Table/Table.module.scss.mjs +2 -1
- package/dist/types/Filter/Filter/types.d.ts +0 -1
- package/dist/types/Filter/FilterBar/types.d.ts +0 -1
- package/dist/types/Filter/FilterDatePicker/hooks/useDateValidation.d.ts +0 -1
- package/dist/types/Filter/FilterDateRangePicker/subcomponents/FilterDateRangePickerField/hooks/useEndDateValidation.d.ts +0 -1
- package/dist/types/Modal/GenericModal/context/ModalContext.d.ts +0 -1
- package/dist/types/MultiSelect/types.d.ts +0 -1
- package/dist/types/Notification/ToastNotification/types.d.ts +0 -1
- package/dist/types/RichTextEditor/utils/core/hooks/useRichTextEditor.d.ts +0 -1
- package/dist/types/RichTextEditor/utils/plugins/LinkManager/validation.d.ts +0 -1
- package/dist/types/Table/Table.d.ts +15 -5
- package/dist/types/TitleBlockZen/types.d.ts +0 -1
- package/dist/types/utils/isRefObject.d.ts +0 -1
- package/package.json +11 -8
- package/src/Table/Table.module.scss +68 -8
- package/src/Table/Table.tsx +27 -11
- package/src/Table/_docs/Table.mdx +43 -13
- package/src/Table/_docs/Table.stickersheet.stories.tsx +703 -0
- package/src/Table/_docs/Table.stories.tsx +290 -158
- package/src/TitleBlockZen/_docs/TitleBlockZen.stories.tsx +12 -4
package/dist/cjs/Table/Table.cjs
CHANGED
|
@@ -47,6 +47,7 @@ var ratioToPercent = function (width) {
|
|
|
47
47
|
return width != null ? "".concat(width * 100, "%") : width;
|
|
48
48
|
};
|
|
49
49
|
var TableHeaderRowCell = function (_a) {
|
|
50
|
+
var _b;
|
|
50
51
|
var labelText = _a.labelText,
|
|
51
52
|
onClick = _a.onClick,
|
|
52
53
|
href = _a.href,
|
|
@@ -55,6 +56,7 @@ var TableHeaderRowCell = function (_a) {
|
|
|
55
56
|
icon = _a.icon,
|
|
56
57
|
checkable = _a.checkable,
|
|
57
58
|
checkedStatus = _a.checkedStatus,
|
|
59
|
+
checkboxLabel = _a.checkboxLabel,
|
|
58
60
|
onCheck = _a.onCheck,
|
|
59
61
|
reversed = _a.reversed,
|
|
60
62
|
sortingRaw = _a.sorting,
|
|
@@ -64,37 +66,29 @@ var TableHeaderRowCell = function (_a) {
|
|
|
64
66
|
// cell with a word longer than the column width would push the columns out of
|
|
65
67
|
// alignment? I'm not sure.
|
|
66
68
|
// Anyway, we can override this default behaviour by setting wrapping to "wrap".
|
|
67
|
-
|
|
69
|
+
_c = _a.wrapping,
|
|
68
70
|
// I can't say for certain why "nowrap" was the default value. Normally you wouldn't
|
|
69
71
|
// want to clip off information because it doesn't fit on one line.
|
|
70
72
|
// My assumption is that because since the cell width rows are decoupled, a heading
|
|
71
73
|
// cell with a word longer than the column width would push the columns out of
|
|
72
74
|
// alignment? I'm not sure.
|
|
73
75
|
// Anyway, we can override this default behaviour by setting wrapping to "wrap".
|
|
74
|
-
wrapping =
|
|
75
|
-
|
|
76
|
-
align =
|
|
76
|
+
wrapping = _c === void 0 ? "nowrap" : _c,
|
|
77
|
+
_d = _a.align,
|
|
78
|
+
align = _d === void 0 ? "start" : _d,
|
|
77
79
|
tooltipInfo = _a.tooltipInfo,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
// tooltip icon as the default based on design system tooltip guidelines.
|
|
81
|
-
_d = _a.isTooltipIconHidden,
|
|
82
|
-
// If set, this will hide the tooltip exclamation icon. Useful in situations where
|
|
83
|
-
// the table header does not have enough space. However, we should always show a
|
|
84
|
-
// tooltip icon as the default based on design system tooltip guidelines.
|
|
85
|
-
isTooltipIconHidden = _d === void 0 ? false : _d,
|
|
80
|
+
_e = _a.isTooltipIconHidden,
|
|
81
|
+
isTooltipIconHidden = _e === void 0 ? false : _e,
|
|
86
82
|
tooltipPortalSelector = _a.tooltipPortalSelector,
|
|
87
|
-
// If set, this will show the arrow in the direction provided
|
|
88
|
-
// when the header cell is hovered over.
|
|
89
83
|
sortingArrowsOnHover = _a.sortingArrowsOnHover,
|
|
90
84
|
classNameOverride = _a.classNameOverride,
|
|
91
85
|
// There aren't any other props in the type definition, so I'm unsure why we
|
|
92
86
|
// have this spread.
|
|
93
|
-
otherProps = tslib.__rest(_a, ["labelText", "onClick", "href", "width", "flex", "icon", "checkable", "checkedStatus", "onCheck", "reversed", "sorting", "wrapping", "align", "tooltipInfo", "isTooltipIconHidden", "tooltipPortalSelector", "sortingArrowsOnHover", "classNameOverride"]);
|
|
87
|
+
otherProps = tslib.__rest(_a, ["labelText", "onClick", "href", "width", "flex", "icon", "checkable", "checkedStatus", "checkboxLabel", "onCheck", "reversed", "sorting", "wrapping", "align", "tooltipInfo", "isTooltipIconHidden", "tooltipPortalSelector", "sortingArrowsOnHover", "classNameOverride"]);
|
|
94
88
|
var sorting = sortingRaw;
|
|
95
|
-
var
|
|
96
|
-
isHovered =
|
|
97
|
-
setIsHovered =
|
|
89
|
+
var _f = React__default.default.useState(false),
|
|
90
|
+
isHovered = _f[0],
|
|
91
|
+
setIsHovered = _f[1];
|
|
98
92
|
var updateHoverState = function (hoverState) {
|
|
99
93
|
if (sortingArrowsOnHover && hoverState != isHovered) setIsHovered(hoverState);
|
|
100
94
|
};
|
|
@@ -106,14 +100,14 @@ var TableHeaderRowCell = function (_a) {
|
|
|
106
100
|
className: Table_module.headerRowCellLabelAndIcons
|
|
107
101
|
}, icon && React__default.default.createElement("span", {
|
|
108
102
|
className: Table_module.headerRowCellIcon
|
|
109
|
-
}, React.cloneElement(icon, {
|
|
110
|
-
title: labelText
|
|
111
|
-
|
|
112
|
-
})), checkable && React__default.default.createElement("div", {
|
|
103
|
+
}, React.cloneElement(icon, (_b = {
|
|
104
|
+
title: labelText
|
|
105
|
+
}, _b["aria-label"] = labelText, _b.role = "img", _b))), checkable && React__default.default.createElement("div", {
|
|
113
106
|
className: Table_module.headerRowCellCheckbox
|
|
114
107
|
}, React__default.default.createElement(Checkbox.Checkbox, {
|
|
115
108
|
checkedStatus: checkedStatus,
|
|
116
|
-
onCheck: onCheck
|
|
109
|
+
onCheck: onCheck,
|
|
110
|
+
"aria-label": checkboxLabel
|
|
117
111
|
})), tooltipInfo != null && !isTooltipIconHidden ? React__default.default.createElement("div", {
|
|
118
112
|
className: Table_module.headerRowCellTooltipIcon
|
|
119
113
|
}, React__default.default.createElement(ExclamationIcon.ExclamationIcon, {
|
|
@@ -7,7 +7,7 @@ function _interopDefault(e) {
|
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
9
|
var styleInject__default = /*#__PURE__*/_interopDefault(styleInject);
|
|
10
|
-
var css_248z = ".Table-module_container__w-zFG{margin-bottom:var(--spacing-sm,.75rem);width:100%}.Table-module_headerRowCell__kW0YN{align-items:stretch;display:flex;justify-content:flex-start;padding:8px var(--spacing-md,1.5rem);position:relative;text-align:start}.Table-module_headerRowCellNoWrap__BSuzX .Table-module_headerRowCellLabel__5v6m8{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.Table-module_headerRowCellAlignCenter__cobEI{justify-content:center;text-align:center}.Table-module_headerRowCellAlignEnd__dQOOQ{justify-content:flex-end;text-align:end}.Table-module_headerRowCellCheckbox__CdMiY{margin-inline-end:10px}.Table-module_headerRowCell__kW0YN .Table-module_headerRowCellTooltip__uzbpY{align-items:stretch;display:flex}.Table-module_headerRowCell__kW0YN.Table-module_headerRowCellNoWrap__BSuzX .Table-
|
|
10
|
+
var css_248z = ".Table-module_container__w-zFG{margin-bottom:var(--spacing-sm,.75rem);width:100%}.Table-module_headerRowCell__kW0YN{align-items:stretch;display:flex;justify-content:flex-start;padding:8px var(--spacing-md,1.5rem);position:relative;text-align:start}.Table-module_headerRowCellNoWrap__BSuzX .Table-module_headerRowCellLabel__5v6m8{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.Table-module_headerRowCellAlignCenter__cobEI{justify-content:center;text-align:center}.Table-module_headerRowCellAlignEnd__dQOOQ{justify-content:flex-end;text-align:end}.Table-module_headerRowCellCheckbox__CdMiY{margin-inline-end:10px}.Table-module_headerRowCell__kW0YN .Table-module_headerRowCellTooltip__uzbpY{align-items:stretch;display:flex;max-width:100%}.Table-module_headerRowCell__kW0YN.Table-module_headerRowCellNoWrap__BSuzX .Table-module_headerRowCellContent__IArYC{max-width:100%}.Table-module_headerRowCellButton__uikM7{align-items:stretch;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:none;box-sizing:border-box;color:var(--color-purple-800,#2f2438);display:block;display:flex;font:inherit;margin:0;outline:none;padding:0;text-decoration:none;transition:none;width:100%}.Table-module_headerRowCellButton__uikM7:active,.Table-module_headerRowCellButton__uikM7:focus,.Table-module_headerRowCellButton__uikM7:hover{text-decoration:none}.Table-module_headerRowCellButton__uikM7:focus-visible{outline:none;position:relative}.Table-module_headerRowCellButton__uikM7:focus-visible:after{background:transparent;border-color:var(--color-blue-500,#0168b3);border-radius:var(--border-focus-ring-border-radius,10px);border-style:var(--border-focus-ring-border-style,solid);border-width:var(--border-focus-ring-border-width,2px);content:\"\";height:calc(100% + var(--border-focus-ring-border-width, 2px)*2 + 1px);left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:calc(100% + var(--border-focus-ring-border-width, 2px)*2 + 1px)}.Table-module_headerRowCellButtonReversed__uk87N{color:var(--color-white,#fff)}.Table-module_headerRowCellButtonReversed__uk87N:focus-visible:after{border-color:var(--color-blue-100,#e6f6ff)}.Table-module_headerRowCellNoButton__dqf1B{align-items:stretch;box-sizing:border-box;display:flex;width:100%}.Table-module_headerRowCellLabelAndIcons__OCCVi{align-items:center;display:flex;flex:1 1 100%;width:100%}.Table-module_headerRowCellTooltipIcon__X0ETJ{color:var(--color-blue-500,#0168b3);margin-inline-end:var(--spacing-xs,.375rem)}.Table-module_headerRowCellIcon__gB3zI{color:rgba(var(--color-purple-800-rgb,47,36,56),.7);height:20px}.Table-module_headerRowCellActive__wshmg .Table-module_headerRowCellIcon__gB3zI{color:var(--color-purple-800,#2f2438)}.Table-module_headerRowCellButtonReversed__uk87N .Table-module_headerRowCellIcon__gB3zI{color:var(--color-white,#fff)}.Table-module_card__RGyjC{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;background:var(--color-white,#fff);border:none;border:1px solid rgba(var(--color-purple-700-rgb,74,35,77),.1);box-shadow:0 4px 6px rgba(53,55,74,.04);color:var(--color-purple-800,#2f2438);display:block;font:inherit;margin:0;outline:none;padding:0;text-decoration:none;transition:none;transition:box-shadow var(--animation-duration-rapid,.2s),border-color var(--animation-duration-rapid,.2s),margin var(--animation-duration-rapid,.2s),padding var(--animation-duration-rapid,.2s),width var(--animation-duration-rapid,.2s)}.Table-module_card__RGyjC:active,.Table-module_card__RGyjC:focus,.Table-module_card__RGyjC:hover{text-decoration:none}.Table-module_card__RGyjC:not(:first-child){margin-top:-1px}.Table-module_card__RGyjC:last-child{border-bottom-left-radius:var(--border-solid-border-radius,7px);border-bottom-right-radius:var(--border-solid-border-radius,7px)}.Table-module_card__RGyjC:hover{will-change:box-shadow,border-color,margin,padding,width}.Table-module_card__RGyjC:focus-visible{outline:none;position:relative}.Table-module_card__RGyjC:focus-visible:after{background:transparent;border-color:var(--color-blue-500,#0168b3);border-radius:inherit;border-style:var(--border-focus-ring-border-style,solid);border-width:var(--border-focus-ring-border-width,2px);content:\"\";height:calc(100% + var(--border-focus-ring-border-width, 2px) + 2px);left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:calc(100% + var(--border-focus-ring-border-width, 2px) + 2px)}.Table-module_card__RGyjC.Table-module_well__xQmO5{margin-top:var(--spacing-sm,.75rem)}.Table-module_card__RGyjC:first-child,[role=rowgroup]+.Table-module_card__RGyjC{border-top-left-radius:var(--border-solid-border-radius,7px);border-top-right-radius:var(--border-solid-border-radius,7px);box-shadow:var(--shadow-small-box-shadow,0 1px 3px 0 rgba(0,0,0,.1),0 3px 16px 0 rgba(0,0,0,.06))}.Table-module_row__GYSl1{display:flex}.Table-module_well__xQmO5{background-color:var(--color-gray-300,#eaeaec);border-color:var(--border-borderless-border-color,transparent);border-radius:var(--border-solid-border-radius,7px);box-shadow:none;margin-bottom:var(--spacing-sm,.75rem)}.Table-module_popout__PeAVV{box-shadow:var(--shadow-large-box-shadow,0 3px 9px 0 rgba(0,0,0,.1),0 8px 40px 0 rgba(0,0,0,.08))}.Table-module_expanded__dasr3{margin-left:calc(var(--spacing-sm, .75rem)*-1);margin-right:calc(var(--spacing-sm, .75rem)*-1);padding-left:var(--spacing-sm,.75rem);padding-right:var(--spacing-sm,.75rem);position:relative;z-index:1}.Table-module_hasHoverState__u5n3E{cursor:pointer;text-align:left;width:100%}.Table-module_hasHoverState__u5n3E.Table-module_expanded__dasr3{width:calc(100% + var(--spacing-md, 1.5rem))}.Table-module_hasHoverState__u5n3E:focus,.Table-module_hasHoverState__u5n3E:hover{background-color:var(--color-gray-100,#f9f9f9)}.Table-module_rowCell__A5-2R{align-items:center;color:var(--color-purple-800,#2f2438);display:block;display:flex;min-height:60px;padding:0 var(--spacing-md,1.5rem);text-decoration:none}.Table-module_rowCell__A5-2R:active,.Table-module_rowCell__A5-2R:focus,.Table-module_rowCell__A5-2R:hover{text-decoration:none}.Table-module_defaultSpacing__zq1Ci .Table-module_rowCell__A5-2R{padding:var(--spacing-sm,.75rem) var(--spacing-md,1.5rem)}.Table-module_dataVariant__vBOag .Table-module_rowCell__A5-2R{min-height:48px}.Table-module_rowCellAlignCenter__apkoC{justify-content:center;text-align:center}.Table-module_rowCellAlignEnd__qZfa1{justify-content:flex-end;text-align:right}.Table-module_whiteText__4f-q5{color:var(--color-white,#fff)}";
|
|
11
11
|
var styles = {
|
|
12
12
|
"container": "Table-module_container__w-zFG",
|
|
13
13
|
"headerRowCell": "Table-module_headerRowCell__kW0YN",
|
|
@@ -17,6 +17,7 @@ var styles = {
|
|
|
17
17
|
"headerRowCellAlignEnd": "Table-module_headerRowCellAlignEnd__dQOOQ",
|
|
18
18
|
"headerRowCellCheckbox": "Table-module_headerRowCellCheckbox__CdMiY",
|
|
19
19
|
"headerRowCellTooltip": "Table-module_headerRowCellTooltip__uzbpY",
|
|
20
|
+
"headerRowCellContent": "Table-module_headerRowCellContent__IArYC",
|
|
20
21
|
"headerRowCellButton": "Table-module_headerRowCellButton__uikM7",
|
|
21
22
|
"headerRowCellButtonReversed": "Table-module_headerRowCellButtonReversed__uk87N",
|
|
22
23
|
"headerRowCellNoButton": "Table-module_headerRowCellNoButton__dqf1B",
|
package/dist/esm/Table/Table.mjs
CHANGED
|
@@ -38,6 +38,7 @@ var ratioToPercent = function (width) {
|
|
|
38
38
|
return width != null ? "".concat(width * 100, "%") : width;
|
|
39
39
|
};
|
|
40
40
|
var TableHeaderRowCell = function (_a) {
|
|
41
|
+
var _b;
|
|
41
42
|
var labelText = _a.labelText,
|
|
42
43
|
onClick = _a.onClick,
|
|
43
44
|
href = _a.href,
|
|
@@ -46,6 +47,7 @@ var TableHeaderRowCell = function (_a) {
|
|
|
46
47
|
icon = _a.icon,
|
|
47
48
|
checkable = _a.checkable,
|
|
48
49
|
checkedStatus = _a.checkedStatus,
|
|
50
|
+
checkboxLabel = _a.checkboxLabel,
|
|
49
51
|
onCheck = _a.onCheck,
|
|
50
52
|
reversed = _a.reversed,
|
|
51
53
|
sortingRaw = _a.sorting,
|
|
@@ -55,37 +57,29 @@ var TableHeaderRowCell = function (_a) {
|
|
|
55
57
|
// cell with a word longer than the column width would push the columns out of
|
|
56
58
|
// alignment? I'm not sure.
|
|
57
59
|
// Anyway, we can override this default behaviour by setting wrapping to "wrap".
|
|
58
|
-
|
|
60
|
+
_c = _a.wrapping,
|
|
59
61
|
// I can't say for certain why "nowrap" was the default value. Normally you wouldn't
|
|
60
62
|
// want to clip off information because it doesn't fit on one line.
|
|
61
63
|
// My assumption is that because since the cell width rows are decoupled, a heading
|
|
62
64
|
// cell with a word longer than the column width would push the columns out of
|
|
63
65
|
// alignment? I'm not sure.
|
|
64
66
|
// Anyway, we can override this default behaviour by setting wrapping to "wrap".
|
|
65
|
-
wrapping =
|
|
66
|
-
|
|
67
|
-
align =
|
|
67
|
+
wrapping = _c === void 0 ? "nowrap" : _c,
|
|
68
|
+
_d = _a.align,
|
|
69
|
+
align = _d === void 0 ? "start" : _d,
|
|
68
70
|
tooltipInfo = _a.tooltipInfo,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
// tooltip icon as the default based on design system tooltip guidelines.
|
|
72
|
-
_d = _a.isTooltipIconHidden,
|
|
73
|
-
// If set, this will hide the tooltip exclamation icon. Useful in situations where
|
|
74
|
-
// the table header does not have enough space. However, we should always show a
|
|
75
|
-
// tooltip icon as the default based on design system tooltip guidelines.
|
|
76
|
-
isTooltipIconHidden = _d === void 0 ? false : _d,
|
|
71
|
+
_e = _a.isTooltipIconHidden,
|
|
72
|
+
isTooltipIconHidden = _e === void 0 ? false : _e,
|
|
77
73
|
tooltipPortalSelector = _a.tooltipPortalSelector,
|
|
78
|
-
// If set, this will show the arrow in the direction provided
|
|
79
|
-
// when the header cell is hovered over.
|
|
80
74
|
sortingArrowsOnHover = _a.sortingArrowsOnHover,
|
|
81
75
|
classNameOverride = _a.classNameOverride,
|
|
82
76
|
// There aren't any other props in the type definition, so I'm unsure why we
|
|
83
77
|
// have this spread.
|
|
84
|
-
otherProps = __rest(_a, ["labelText", "onClick", "href", "width", "flex", "icon", "checkable", "checkedStatus", "onCheck", "reversed", "sorting", "wrapping", "align", "tooltipInfo", "isTooltipIconHidden", "tooltipPortalSelector", "sortingArrowsOnHover", "classNameOverride"]);
|
|
78
|
+
otherProps = __rest(_a, ["labelText", "onClick", "href", "width", "flex", "icon", "checkable", "checkedStatus", "checkboxLabel", "onCheck", "reversed", "sorting", "wrapping", "align", "tooltipInfo", "isTooltipIconHidden", "tooltipPortalSelector", "sortingArrowsOnHover", "classNameOverride"]);
|
|
85
79
|
var sorting = sortingRaw;
|
|
86
|
-
var
|
|
87
|
-
isHovered =
|
|
88
|
-
setIsHovered =
|
|
80
|
+
var _f = React.useState(false),
|
|
81
|
+
isHovered = _f[0],
|
|
82
|
+
setIsHovered = _f[1];
|
|
89
83
|
var updateHoverState = function (hoverState) {
|
|
90
84
|
if (sortingArrowsOnHover && hoverState != isHovered) setIsHovered(hoverState);
|
|
91
85
|
};
|
|
@@ -97,14 +91,14 @@ var TableHeaderRowCell = function (_a) {
|
|
|
97
91
|
className: styles.headerRowCellLabelAndIcons
|
|
98
92
|
}, icon && ( /*#__PURE__*/React.createElement("span", {
|
|
99
93
|
className: styles.headerRowCellIcon
|
|
100
|
-
}, /*#__PURE__*/cloneElement(icon, {
|
|
101
|
-
title: labelText
|
|
102
|
-
|
|
103
|
-
}))), checkable && ( /*#__PURE__*/React.createElement("div", {
|
|
94
|
+
}, /*#__PURE__*/cloneElement(icon, (_b = {
|
|
95
|
+
title: labelText
|
|
96
|
+
}, _b["aria-label"] = labelText, _b.role = "img", _b)))), checkable && ( /*#__PURE__*/React.createElement("div", {
|
|
104
97
|
className: styles.headerRowCellCheckbox
|
|
105
98
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
106
99
|
checkedStatus: checkedStatus,
|
|
107
|
-
onCheck: onCheck
|
|
100
|
+
onCheck: onCheck,
|
|
101
|
+
"aria-label": checkboxLabel
|
|
108
102
|
}))), tooltipInfo != null && !isTooltipIconHidden ? ( /*#__PURE__*/React.createElement("div", {
|
|
109
103
|
className: styles.headerRowCellTooltipIcon
|
|
110
104
|
}, /*#__PURE__*/React.createElement(ExclamationIcon, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styleInject from 'style-inject';
|
|
2
|
-
var css_248z = ".Table-module_container__w-zFG{margin-bottom:var(--spacing-sm,.75rem);width:100%}.Table-module_headerRowCell__kW0YN{align-items:stretch;display:flex;justify-content:flex-start;padding:8px var(--spacing-md,1.5rem);position:relative;text-align:start}.Table-module_headerRowCellNoWrap__BSuzX .Table-module_headerRowCellLabel__5v6m8{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.Table-module_headerRowCellAlignCenter__cobEI{justify-content:center;text-align:center}.Table-module_headerRowCellAlignEnd__dQOOQ{justify-content:flex-end;text-align:end}.Table-module_headerRowCellCheckbox__CdMiY{margin-inline-end:10px}.Table-module_headerRowCell__kW0YN .Table-module_headerRowCellTooltip__uzbpY{align-items:stretch;display:flex}.Table-module_headerRowCell__kW0YN.Table-module_headerRowCellNoWrap__BSuzX .Table-
|
|
2
|
+
var css_248z = ".Table-module_container__w-zFG{margin-bottom:var(--spacing-sm,.75rem);width:100%}.Table-module_headerRowCell__kW0YN{align-items:stretch;display:flex;justify-content:flex-start;padding:8px var(--spacing-md,1.5rem);position:relative;text-align:start}.Table-module_headerRowCellNoWrap__BSuzX .Table-module_headerRowCellLabel__5v6m8{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.Table-module_headerRowCellAlignCenter__cobEI{justify-content:center;text-align:center}.Table-module_headerRowCellAlignEnd__dQOOQ{justify-content:flex-end;text-align:end}.Table-module_headerRowCellCheckbox__CdMiY{margin-inline-end:10px}.Table-module_headerRowCell__kW0YN .Table-module_headerRowCellTooltip__uzbpY{align-items:stretch;display:flex;max-width:100%}.Table-module_headerRowCell__kW0YN.Table-module_headerRowCellNoWrap__BSuzX .Table-module_headerRowCellContent__IArYC{max-width:100%}.Table-module_headerRowCellButton__uikM7{align-items:stretch;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:none;box-sizing:border-box;color:var(--color-purple-800,#2f2438);display:block;display:flex;font:inherit;margin:0;outline:none;padding:0;text-decoration:none;transition:none;width:100%}.Table-module_headerRowCellButton__uikM7:active,.Table-module_headerRowCellButton__uikM7:focus,.Table-module_headerRowCellButton__uikM7:hover{text-decoration:none}.Table-module_headerRowCellButton__uikM7:focus-visible{outline:none;position:relative}.Table-module_headerRowCellButton__uikM7:focus-visible:after{background:transparent;border-color:var(--color-blue-500,#0168b3);border-radius:var(--border-focus-ring-border-radius,10px);border-style:var(--border-focus-ring-border-style,solid);border-width:var(--border-focus-ring-border-width,2px);content:\"\";height:calc(100% + var(--border-focus-ring-border-width, 2px)*2 + 1px);left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:calc(100% + var(--border-focus-ring-border-width, 2px)*2 + 1px)}.Table-module_headerRowCellButtonReversed__uk87N{color:var(--color-white,#fff)}.Table-module_headerRowCellButtonReversed__uk87N:focus-visible:after{border-color:var(--color-blue-100,#e6f6ff)}.Table-module_headerRowCellNoButton__dqf1B{align-items:stretch;box-sizing:border-box;display:flex;width:100%}.Table-module_headerRowCellLabelAndIcons__OCCVi{align-items:center;display:flex;flex:1 1 100%;width:100%}.Table-module_headerRowCellTooltipIcon__X0ETJ{color:var(--color-blue-500,#0168b3);margin-inline-end:var(--spacing-xs,.375rem)}.Table-module_headerRowCellIcon__gB3zI{color:rgba(var(--color-purple-800-rgb,47,36,56),.7);height:20px}.Table-module_headerRowCellActive__wshmg .Table-module_headerRowCellIcon__gB3zI{color:var(--color-purple-800,#2f2438)}.Table-module_headerRowCellButtonReversed__uk87N .Table-module_headerRowCellIcon__gB3zI{color:var(--color-white,#fff)}.Table-module_card__RGyjC{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;background:var(--color-white,#fff);border:none;border:1px solid rgba(var(--color-purple-700-rgb,74,35,77),.1);box-shadow:0 4px 6px rgba(53,55,74,.04);color:var(--color-purple-800,#2f2438);display:block;font:inherit;margin:0;outline:none;padding:0;text-decoration:none;transition:none;transition:box-shadow var(--animation-duration-rapid,.2s),border-color var(--animation-duration-rapid,.2s),margin var(--animation-duration-rapid,.2s),padding var(--animation-duration-rapid,.2s),width var(--animation-duration-rapid,.2s)}.Table-module_card__RGyjC:active,.Table-module_card__RGyjC:focus,.Table-module_card__RGyjC:hover{text-decoration:none}.Table-module_card__RGyjC:not(:first-child){margin-top:-1px}.Table-module_card__RGyjC:last-child{border-bottom-left-radius:var(--border-solid-border-radius,7px);border-bottom-right-radius:var(--border-solid-border-radius,7px)}.Table-module_card__RGyjC:hover{will-change:box-shadow,border-color,margin,padding,width}.Table-module_card__RGyjC:focus-visible{outline:none;position:relative}.Table-module_card__RGyjC:focus-visible:after{background:transparent;border-color:var(--color-blue-500,#0168b3);border-radius:inherit;border-style:var(--border-focus-ring-border-style,solid);border-width:var(--border-focus-ring-border-width,2px);content:\"\";height:calc(100% + var(--border-focus-ring-border-width, 2px) + 2px);left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:calc(100% + var(--border-focus-ring-border-width, 2px) + 2px)}.Table-module_card__RGyjC.Table-module_well__xQmO5{margin-top:var(--spacing-sm,.75rem)}.Table-module_card__RGyjC:first-child,[role=rowgroup]+.Table-module_card__RGyjC{border-top-left-radius:var(--border-solid-border-radius,7px);border-top-right-radius:var(--border-solid-border-radius,7px);box-shadow:var(--shadow-small-box-shadow,0 1px 3px 0 rgba(0,0,0,.1),0 3px 16px 0 rgba(0,0,0,.06))}.Table-module_row__GYSl1{display:flex}.Table-module_well__xQmO5{background-color:var(--color-gray-300,#eaeaec);border-color:var(--border-borderless-border-color,transparent);border-radius:var(--border-solid-border-radius,7px);box-shadow:none;margin-bottom:var(--spacing-sm,.75rem)}.Table-module_popout__PeAVV{box-shadow:var(--shadow-large-box-shadow,0 3px 9px 0 rgba(0,0,0,.1),0 8px 40px 0 rgba(0,0,0,.08))}.Table-module_expanded__dasr3{margin-left:calc(var(--spacing-sm, .75rem)*-1);margin-right:calc(var(--spacing-sm, .75rem)*-1);padding-left:var(--spacing-sm,.75rem);padding-right:var(--spacing-sm,.75rem);position:relative;z-index:1}.Table-module_hasHoverState__u5n3E{cursor:pointer;text-align:left;width:100%}.Table-module_hasHoverState__u5n3E.Table-module_expanded__dasr3{width:calc(100% + var(--spacing-md, 1.5rem))}.Table-module_hasHoverState__u5n3E:focus,.Table-module_hasHoverState__u5n3E:hover{background-color:var(--color-gray-100,#f9f9f9)}.Table-module_rowCell__A5-2R{align-items:center;color:var(--color-purple-800,#2f2438);display:block;display:flex;min-height:60px;padding:0 var(--spacing-md,1.5rem);text-decoration:none}.Table-module_rowCell__A5-2R:active,.Table-module_rowCell__A5-2R:focus,.Table-module_rowCell__A5-2R:hover{text-decoration:none}.Table-module_defaultSpacing__zq1Ci .Table-module_rowCell__A5-2R{padding:var(--spacing-sm,.75rem) var(--spacing-md,1.5rem)}.Table-module_dataVariant__vBOag .Table-module_rowCell__A5-2R{min-height:48px}.Table-module_rowCellAlignCenter__apkoC{justify-content:center;text-align:center}.Table-module_rowCellAlignEnd__qZfa1{justify-content:flex-end;text-align:right}.Table-module_whiteText__4f-q5{color:var(--color-white,#fff)}";
|
|
3
3
|
var styles = {
|
|
4
4
|
"container": "Table-module_container__w-zFG",
|
|
5
5
|
"headerRowCell": "Table-module_headerRowCell__kW0YN",
|
|
@@ -9,6 +9,7 @@ var styles = {
|
|
|
9
9
|
"headerRowCellAlignEnd": "Table-module_headerRowCellAlignEnd__dQOOQ",
|
|
10
10
|
"headerRowCellCheckbox": "Table-module_headerRowCellCheckbox__CdMiY",
|
|
11
11
|
"headerRowCellTooltip": "Table-module_headerRowCellTooltip__uzbpY",
|
|
12
|
+
"headerRowCellContent": "Table-module_headerRowCellContent__IArYC",
|
|
12
13
|
"headerRowCellButton": "Table-module_headerRowCellButton__uikM7",
|
|
13
14
|
"headerRowCellButtonReversed": "Table-module_headerRowCellButtonReversed__uk87N",
|
|
14
15
|
"headerRowCellNoButton": "Table-module_headerRowCellNoButton__dqf1B",
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { UseDateValidationArgs, ValidationMessage } from "../../../../FilterDatePicker";
|
|
3
2
|
import { ValidateEndDateBeforeStartDateArgs } from "../utils/validateEndDateBeforeStartDate";
|
|
4
3
|
export type UseEndDateValidationArgs = UseDateValidationArgs;
|
|
@@ -3,6 +3,7 @@ import { CheckedStatus } from "../Checkbox";
|
|
|
3
3
|
import { OverrideClassName } from "../types/OverrideClassName";
|
|
4
4
|
export type TableContainerProps = {
|
|
5
5
|
children?: React.ReactNode;
|
|
6
|
+
/** @default "compact" */
|
|
6
7
|
variant?: "compact" | "default" | "data";
|
|
7
8
|
};
|
|
8
9
|
/**
|
|
@@ -17,6 +18,13 @@ export declare const TableHeader: ({ children, ...otherProps }: TableHeaderProps
|
|
|
17
18
|
export type TableHeaderRowProps = {
|
|
18
19
|
children?: React.ReactNode;
|
|
19
20
|
};
|
|
21
|
+
export type TableHeaderRowCellCheckboxProps = {
|
|
22
|
+
checkable?: boolean;
|
|
23
|
+
checkedStatus?: CheckedStatus;
|
|
24
|
+
/** This will be passed into the aria-label for the checkbox to provide context to the user */
|
|
25
|
+
checkboxLabel?: string;
|
|
26
|
+
onCheck?: (event: React.ChangeEvent<HTMLInputElement>) => any;
|
|
27
|
+
};
|
|
20
28
|
/**
|
|
21
29
|
* @param width value between 1 and 0, to be calculated as a percentage
|
|
22
30
|
* @param flex CSS flex shorthand as a string. Be sure to specify the flex grow,
|
|
@@ -30,9 +38,6 @@ export type TableHeaderRowCellProps = {
|
|
|
30
38
|
flex?: string;
|
|
31
39
|
href?: string;
|
|
32
40
|
icon?: ReactElement;
|
|
33
|
-
checkable?: boolean;
|
|
34
|
-
checkedStatus?: CheckedStatus;
|
|
35
|
-
onCheck?: (event: React.ChangeEvent<HTMLInputElement>) => any;
|
|
36
41
|
reversed?: boolean;
|
|
37
42
|
/**
|
|
38
43
|
* Shows an up or down arrow, to show that the column is sorted.
|
|
@@ -41,14 +46,19 @@ export type TableHeaderRowCellProps = {
|
|
|
41
46
|
wrapping?: "nowrap" | "wrap";
|
|
42
47
|
align?: "start" | "center" | "end";
|
|
43
48
|
tooltipInfo?: string;
|
|
49
|
+
/** If set, this will hide the tooltip exclamation icon. Useful in situations where
|
|
50
|
+
the table header does not have enough space. This should be done with caution as tooltips
|
|
51
|
+
should have a visual indicator to users */
|
|
44
52
|
isTooltipIconHidden?: boolean;
|
|
45
53
|
/**
|
|
46
54
|
* Specify where the tooltip should be rendered.
|
|
47
55
|
*/
|
|
48
56
|
tooltipPortalSelector?: string | undefined;
|
|
57
|
+
/** If set, this will show the arrow in the direction provided
|
|
58
|
+
when the header cell is hovered over. */
|
|
49
59
|
sortingArrowsOnHover?: "ascending" | "descending" | undefined;
|
|
50
|
-
} & OverrideClassName<HTMLAttributes<HTMLElement>>;
|
|
51
|
-
export declare const TableHeaderRowCell: ({ labelText, onClick, href, width, flex, icon, checkable, checkedStatus, onCheck, reversed, sorting: sortingRaw, wrapping, align, tooltipInfo, isTooltipIconHidden, tooltipPortalSelector, sortingArrowsOnHover, classNameOverride, ...otherProps }: TableHeaderRowCellProps) => JSX.Element;
|
|
60
|
+
} & TableHeaderRowCellCheckboxProps & OverrideClassName<HTMLAttributes<HTMLElement>>;
|
|
61
|
+
export declare const TableHeaderRowCell: ({ labelText, onClick, href, width, flex, icon, checkable, checkedStatus, checkboxLabel, onCheck, reversed, sorting: sortingRaw, wrapping, align, tooltipInfo, isTooltipIconHidden, tooltipPortalSelector, sortingArrowsOnHover, classNameOverride, ...otherProps }: TableHeaderRowCellProps) => JSX.Element;
|
|
52
62
|
type ButtonClickEvent = (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
53
63
|
type AnchorClickEvent = (e: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
54
64
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaizen/components",
|
|
3
|
-
"version": "0.0.0-canary-stable-bundler-
|
|
3
|
+
"version": "0.0.0-canary-stable-bundler-20240515064749",
|
|
4
4
|
"description": "Kaizen component library",
|
|
5
5
|
"author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
|
|
6
6
|
"homepage": "https://cultureamp.design",
|
|
@@ -75,7 +75,6 @@
|
|
|
75
75
|
"tslib": "^2.6.2",
|
|
76
76
|
"use-debounce": "^10.0.0",
|
|
77
77
|
"uuid": "^9.0.1",
|
|
78
|
-
"@kaizen/package-bundler": "0.0.0-canary-stable-bundler-20240515025934",
|
|
79
78
|
"@kaizen/hosted-assets": "2.0.3"
|
|
80
79
|
},
|
|
81
80
|
"dependenciesComments": {
|
|
@@ -99,10 +98,15 @@
|
|
|
99
98
|
"svgo": "^3.2.0",
|
|
100
99
|
"tailwindcss": "^3.4.3",
|
|
101
100
|
"ts-jest": "^29.1.2",
|
|
102
|
-
"
|
|
103
|
-
"@kaizen/design-tokens": "
|
|
104
|
-
"@kaizen/package-bundler": "0.0.0-canary-stable-bundler-
|
|
105
|
-
"@kaizen/tailwind": "
|
|
101
|
+
"tsx": "^4.10.2",
|
|
102
|
+
"@kaizen/design-tokens": "0.0.0-canary-stable-bundler-20240515064749",
|
|
103
|
+
"@kaizen/package-bundler": "0.0.0-canary-stable-bundler-20240515064749",
|
|
104
|
+
"@kaizen/tailwind": "0.0.0-canary-stable-bundler-20240515064749"
|
|
105
|
+
},
|
|
106
|
+
"devDependenciesComments": {
|
|
107
|
+
"postcss": "Installed in root",
|
|
108
|
+
"postcss-cli": "Installed in root",
|
|
109
|
+
"postcss-preset-env": "Installed in root"
|
|
106
110
|
},
|
|
107
111
|
"peerDependencies": {
|
|
108
112
|
"@cultureamp/i18n-react-intl": "^2.5.6",
|
|
@@ -110,9 +114,8 @@
|
|
|
110
114
|
"react-intl": "^6.6.6"
|
|
111
115
|
},
|
|
112
116
|
"scripts": {
|
|
113
|
-
"build": "pnpm package-bundler build-ui
|
|
117
|
+
"build": "pnpm package-bundler build-shared-ui && pnpm styles:global",
|
|
114
118
|
"styles:global": "postcss ./styles/global.css --output dist/styles.css",
|
|
115
|
-
"help": "pnpm package-bundler help",
|
|
116
119
|
"test": "FORCE_COLOR=1 jest",
|
|
117
120
|
"test:ci": "pnpm test -- --ci",
|
|
118
121
|
"test:treeshake": "agadoo ./dist/esm/index.mjs",
|
|
@@ -20,10 +20,6 @@ $row-height-data-variant: 48px;
|
|
|
20
20
|
&:focus {
|
|
21
21
|
text-decoration: none;
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
&.headerRowCellButtonReversed {
|
|
25
|
-
color: $color-white;
|
|
26
|
-
}
|
|
27
23
|
}
|
|
28
24
|
|
|
29
25
|
// Special Table-only button reset
|
|
@@ -35,6 +31,7 @@ $row-height-data-variant: 48px;
|
|
|
35
31
|
margin: 0;
|
|
36
32
|
padding: 0;
|
|
37
33
|
transition: none; // override Murmur global styles :(
|
|
34
|
+
outline: none;
|
|
38
35
|
}
|
|
39
36
|
|
|
40
37
|
.container {
|
|
@@ -80,19 +77,55 @@ $row-height-data-variant: 48px;
|
|
|
80
77
|
.headerRowCell .headerRowCellTooltip {
|
|
81
78
|
display: flex;
|
|
82
79
|
align-items: stretch;
|
|
80
|
+
max-width: 100%;
|
|
83
81
|
}
|
|
84
82
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
overflow: hidden;
|
|
83
|
+
.headerRowCell.headerRowCellNoWrap .headerRowCellContent {
|
|
84
|
+
max-width: 100%;
|
|
88
85
|
}
|
|
89
86
|
|
|
90
87
|
.headerRowCellButton {
|
|
91
88
|
@include button-reset;
|
|
92
89
|
@include anchor-reset;
|
|
90
|
+
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: stretch;
|
|
93
|
+
width: 100%;
|
|
94
|
+
// Ensures that the 100% doesn't go outside of the `headerRowCell` width
|
|
95
|
+
box-sizing: border-box;
|
|
96
|
+
|
|
97
|
+
&:focus-visible {
|
|
98
|
+
outline: none;
|
|
99
|
+
position: relative;
|
|
100
|
+
|
|
101
|
+
&::after {
|
|
102
|
+
// This offset provide enough gap on reverse for contrast ratios
|
|
103
|
+
$focus-ring-offset: calc((#{$border-focus-ring-border-width} * 2) + 1px);
|
|
104
|
+
|
|
105
|
+
top: 50%;
|
|
106
|
+
left: 50%;
|
|
107
|
+
transform: translate(-50%, -50%);
|
|
108
|
+
width: calc(100% + #{$focus-ring-offset});
|
|
109
|
+
height: calc(100% + #{$focus-ring-offset});
|
|
110
|
+
content: "";
|
|
111
|
+
position: absolute;
|
|
112
|
+
background: transparent;
|
|
113
|
+
border-color: $color-blue-500;
|
|
114
|
+
border-width: $border-focus-ring-border-width;
|
|
115
|
+
border-style: $border-focus-ring-border-style;
|
|
116
|
+
border-radius: $border-focus-ring-border-radius;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.headerRowCellButtonReversed {
|
|
122
|
+
color: $color-white;
|
|
123
|
+
|
|
124
|
+
&:focus-visible::after {
|
|
125
|
+
border-color: $color-blue-100;
|
|
126
|
+
}
|
|
93
127
|
}
|
|
94
128
|
|
|
95
|
-
.headerRowCellButton,
|
|
96
129
|
.headerRowCellNoButton {
|
|
97
130
|
display: flex;
|
|
98
131
|
align-items: stretch;
|
|
@@ -120,6 +153,10 @@ $row-height-data-variant: 48px;
|
|
|
120
153
|
.headerRowCellActive & {
|
|
121
154
|
color: $color-purple-800;
|
|
122
155
|
}
|
|
156
|
+
|
|
157
|
+
.headerRowCellButtonReversed & {
|
|
158
|
+
color: $color-white;
|
|
159
|
+
}
|
|
123
160
|
}
|
|
124
161
|
|
|
125
162
|
.card {
|
|
@@ -154,6 +191,29 @@ $row-height-data-variant: 48px;
|
|
|
154
191
|
will-change: box-shadow, border-color, margin, padding, width;
|
|
155
192
|
}
|
|
156
193
|
|
|
194
|
+
&:focus-visible {
|
|
195
|
+
outline: none;
|
|
196
|
+
position: relative;
|
|
197
|
+
|
|
198
|
+
&::after {
|
|
199
|
+
// This offset provide enough gap on on reverse for contrast ratios
|
|
200
|
+
$focus-ring-offset: calc(#{$border-focus-ring-border-width} + 2px);
|
|
201
|
+
|
|
202
|
+
top: 50%;
|
|
203
|
+
left: 50%;
|
|
204
|
+
transform: translate(-50%, -50%);
|
|
205
|
+
width: calc(100% + #{$focus-ring-offset});
|
|
206
|
+
height: calc(100% + #{$focus-ring-offset});
|
|
207
|
+
content: "";
|
|
208
|
+
position: absolute;
|
|
209
|
+
background: transparent;
|
|
210
|
+
border-color: $color-blue-500;
|
|
211
|
+
border-width: $border-focus-ring-border-width;
|
|
212
|
+
border-style: $border-focus-ring-border-style;
|
|
213
|
+
border-radius: inherit;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
157
217
|
&.well {
|
|
158
218
|
margin-top: $spacing-sm;
|
|
159
219
|
}
|
package/src/Table/Table.tsx
CHANGED
|
@@ -13,6 +13,7 @@ import styles from "./Table.module.scss"
|
|
|
13
13
|
|
|
14
14
|
export type TableContainerProps = {
|
|
15
15
|
children?: React.ReactNode
|
|
16
|
+
/** @default "compact" */
|
|
16
17
|
variant?: "compact" | "default" | "data"
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
@@ -56,6 +57,14 @@ export type TableHeaderRowProps = {
|
|
|
56
57
|
const ratioToPercent = (width?: number): string | number | undefined =>
|
|
57
58
|
width != null ? `${width * 100}%` : width
|
|
58
59
|
|
|
60
|
+
export type TableHeaderRowCellCheckboxProps = {
|
|
61
|
+
checkable?: boolean
|
|
62
|
+
checkedStatus?: CheckedStatus
|
|
63
|
+
/** This will be passed into the aria-label for the checkbox to provide context to the user */
|
|
64
|
+
checkboxLabel?: string
|
|
65
|
+
onCheck?: (event: React.ChangeEvent<HTMLInputElement>) => any
|
|
66
|
+
}
|
|
67
|
+
|
|
59
68
|
/**
|
|
60
69
|
* @param width value between 1 and 0, to be calculated as a percentage
|
|
61
70
|
* @param flex CSS flex shorthand as a string. Be sure to specify the flex grow,
|
|
@@ -71,9 +80,6 @@ export type TableHeaderRowCellProps = {
|
|
|
71
80
|
flex?: string
|
|
72
81
|
href?: string
|
|
73
82
|
icon?: ReactElement
|
|
74
|
-
checkable?: boolean
|
|
75
|
-
checkedStatus?: CheckedStatus
|
|
76
|
-
onCheck?: (event: React.ChangeEvent<HTMLInputElement>) => any
|
|
77
83
|
reversed?: boolean
|
|
78
84
|
/**
|
|
79
85
|
* Shows an up or down arrow, to show that the column is sorted.
|
|
@@ -82,13 +88,19 @@ export type TableHeaderRowCellProps = {
|
|
|
82
88
|
wrapping?: "nowrap" | "wrap"
|
|
83
89
|
align?: "start" | "center" | "end"
|
|
84
90
|
tooltipInfo?: string
|
|
91
|
+
/** If set, this will hide the tooltip exclamation icon. Useful in situations where
|
|
92
|
+
the table header does not have enough space. This should be done with caution as tooltips
|
|
93
|
+
should have a visual indicator to users */
|
|
85
94
|
isTooltipIconHidden?: boolean
|
|
86
95
|
/**
|
|
87
96
|
* Specify where the tooltip should be rendered.
|
|
88
97
|
*/
|
|
89
98
|
tooltipPortalSelector?: string | undefined
|
|
99
|
+
/** If set, this will show the arrow in the direction provided
|
|
100
|
+
when the header cell is hovered over. */
|
|
90
101
|
sortingArrowsOnHover?: "ascending" | "descending" | undefined
|
|
91
|
-
} &
|
|
102
|
+
} & TableHeaderRowCellCheckboxProps &
|
|
103
|
+
OverrideClassName<HTMLAttributes<HTMLElement>>
|
|
92
104
|
|
|
93
105
|
export const TableHeaderRowCell = ({
|
|
94
106
|
labelText,
|
|
@@ -99,6 +111,7 @@ export const TableHeaderRowCell = ({
|
|
|
99
111
|
icon,
|
|
100
112
|
checkable,
|
|
101
113
|
checkedStatus,
|
|
114
|
+
checkboxLabel,
|
|
102
115
|
onCheck,
|
|
103
116
|
reversed,
|
|
104
117
|
sorting: sortingRaw,
|
|
@@ -111,13 +124,8 @@ export const TableHeaderRowCell = ({
|
|
|
111
124
|
wrapping = "nowrap",
|
|
112
125
|
align = "start",
|
|
113
126
|
tooltipInfo,
|
|
114
|
-
// If set, this will hide the tooltip exclamation icon. Useful in situations where
|
|
115
|
-
// the table header does not have enough space. However, we should always show a
|
|
116
|
-
// tooltip icon as the default based on design system tooltip guidelines.
|
|
117
127
|
isTooltipIconHidden = false,
|
|
118
128
|
tooltipPortalSelector,
|
|
119
|
-
// If set, this will show the arrow in the direction provided
|
|
120
|
-
// when the header cell is hovered over.
|
|
121
129
|
sortingArrowsOnHover,
|
|
122
130
|
classNameOverride,
|
|
123
131
|
// There aren't any other props in the type definition, so I'm unsure why we
|
|
@@ -143,12 +151,20 @@ export const TableHeaderRowCell = ({
|
|
|
143
151
|
<div className={styles.headerRowCellLabelAndIcons}>
|
|
144
152
|
{icon && (
|
|
145
153
|
<span className={styles.headerRowCellIcon}>
|
|
146
|
-
{cloneElement(icon, {
|
|
154
|
+
{cloneElement(icon, {
|
|
155
|
+
title: labelText,
|
|
156
|
+
["aria-label"]: labelText, // title is unreliable so this is a sensible fallback for tables with icons as headers without aria-labels
|
|
157
|
+
role: "img",
|
|
158
|
+
})}
|
|
147
159
|
</span>
|
|
148
160
|
)}
|
|
149
161
|
{checkable && (
|
|
150
162
|
<div className={styles.headerRowCellCheckbox}>
|
|
151
|
-
<Checkbox
|
|
163
|
+
<Checkbox
|
|
164
|
+
checkedStatus={checkedStatus}
|
|
165
|
+
onCheck={onCheck}
|
|
166
|
+
aria-label={checkboxLabel}
|
|
167
|
+
/>
|
|
152
168
|
</div>
|
|
153
169
|
)}
|
|
154
170
|
{tooltipInfo != null && !isTooltipIconHidden ? (
|