@czi-sds/components 23.4.0 → 23.6.0
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/index.cjs.d.ts +29 -4
- package/dist/index.cjs.js +469 -65
- package/dist/index.esm.d.ts +29 -4
- package/dist/index.esm.js +471 -68
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/variables.css +12 -12
- package/dist/variables.scss +12 -12
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -445,12 +445,12 @@ const createAppThemeBorders = (colors, isDarkMode) => {
|
|
|
445
445
|
default: createBorder("indigo", isDarkMode ? 600 : 500, "solid", "default"),
|
|
446
446
|
focused: createBorder("indigo", isDarkMode ? 600 : 500, "solid", "default"),
|
|
447
447
|
hover: createBorder("indigo", isDarkMode ? 700 : 600, "solid", "default"),
|
|
448
|
-
open: createBorder("indigo", isDarkMode ?
|
|
448
|
+
open: createBorder("indigo", isDarkMode ? 800 : 700, "solid", "default"),
|
|
449
449
|
pressed: createBorder("indigo", isDarkMode ? 800 : 700, "solid", "default"),
|
|
450
|
-
selected: createBorder("indigo", isDarkMode ?
|
|
450
|
+
selected: createBorder("indigo", isDarkMode ? 800 : 700, "solid", "default")
|
|
451
451
|
},
|
|
452
452
|
base: {
|
|
453
|
-
default: createBorder("gray",
|
|
453
|
+
default: createBorder("gray", 600, "solid", "default"),
|
|
454
454
|
disabled: createBorder("gray", 300, "solid", "default"),
|
|
455
455
|
divider: createBorder("gray", 200, "solid", "default"),
|
|
456
456
|
dividerOnDark: createBorder("gray", isDarkMode ? 200 : 700, "solid", "default"),
|
|
@@ -480,9 +480,9 @@ const createAppThemeBorders = (colors, isDarkMode) => {
|
|
|
480
480
|
thick: createBorder("red", 600, "solid", "thick")
|
|
481
481
|
},
|
|
482
482
|
neutral: {
|
|
483
|
-
default: createBorder("gray",
|
|
484
|
-
extraThick: createBorder("gray",
|
|
485
|
-
thick: createBorder("gray",
|
|
483
|
+
default: createBorder("gray", 700, "solid", "default"),
|
|
484
|
+
extraThick: createBorder("gray", 700, "solid", "extraThick"),
|
|
485
|
+
thick: createBorder("gray", 700, "solid", "thick")
|
|
486
486
|
},
|
|
487
487
|
none: "none",
|
|
488
488
|
notice: {
|
|
@@ -6474,7 +6474,7 @@ const useDetectUserTabbing = (ref) => {
|
|
|
6474
6474
|
* @see https://mui.com/material-ui/react-text-field/
|
|
6475
6475
|
*/
|
|
6476
6476
|
const InputSearch = React.forwardRef(function InputSearch(props, ref) {
|
|
6477
|
-
const { label, id, placeholder, sdsStyle = "square", intent = "default", handleSubmit, onChange, disabled, classes = EMPTY_OBJECT, className, ...rest } = props;
|
|
6477
|
+
const { label, id, placeholder, sdsStyle = "square", intent = "default", handleSubmit, onChange, disabled, classes = EMPTY_OBJECT, className, value: propValue, ...rest } = props;
|
|
6478
6478
|
const { root: rootClassName, label: labelClassName, input: inputClassName, endAdornment: endAdornmentClassName, startAdornment: startAdornmentClassName, clearButton: clearButtonClassName, searchButton: searchButtonClassName, } = classes;
|
|
6479
6479
|
/**
|
|
6480
6480
|
* (masoudmanson): In case that the ref is not provided, we will create a new one.
|
|
@@ -6489,14 +6489,20 @@ const InputSearch = React.forwardRef(function InputSearch(props, ref) {
|
|
|
6489
6489
|
* user is tabbing, we can apply different styles for :focus and :focus-visible states.
|
|
6490
6490
|
*/
|
|
6491
6491
|
useDetectUserTabbing((ref ? ref : inputRef));
|
|
6492
|
-
const [
|
|
6492
|
+
const [internalValue, setInternalValue] = React.useState("");
|
|
6493
|
+
const isControlled = propValue !== undefined;
|
|
6494
|
+
const value = isControlled ? String(propValue ?? "") : internalValue;
|
|
6493
6495
|
const handleChange = (event) => {
|
|
6494
|
-
|
|
6496
|
+
if (!isControlled) {
|
|
6497
|
+
setInternalValue(event.target.value);
|
|
6498
|
+
}
|
|
6495
6499
|
if (onChange)
|
|
6496
6500
|
onChange(event);
|
|
6497
6501
|
};
|
|
6498
6502
|
const clearInput = () => {
|
|
6499
|
-
|
|
6503
|
+
if (!isControlled) {
|
|
6504
|
+
setInternalValue("");
|
|
6505
|
+
}
|
|
6500
6506
|
if (handleSubmit)
|
|
6501
6507
|
handleSubmit("");
|
|
6502
6508
|
/**
|
|
@@ -7397,6 +7403,9 @@ var SDSWarningTypes;
|
|
|
7397
7403
|
SDSWarningTypes["TooltipInvertStyle"] = "tooltipInvertStyle";
|
|
7398
7404
|
SDSWarningTypes["ContentCardActionsOnlyButtons"] = "contentCardActionsOnlyButtons";
|
|
7399
7405
|
SDSWarningTypes["ClickableContentCardNumberOfButtons"] = "clickableContentCardNumberOfButtons";
|
|
7406
|
+
SDSWarningTypes["SegmentedControlTooltipTextDeprecated"] = "segmentedControlTooltipTextDeprecated";
|
|
7407
|
+
SDSWarningTypes["SegmentedControlMissingIconOrLabel"] = "segmentedControlMissingIconOrLabel";
|
|
7408
|
+
SDSWarningTypes["SegmentedControlIconAndLabelConflict"] = "segmentedControlIconAndLabelConflict";
|
|
7400
7409
|
})(SDSWarningTypes || (SDSWarningTypes = {}));
|
|
7401
7410
|
const SDS_WARNINGS = {
|
|
7402
7411
|
[SDSWarningTypes.ButtonMinimalIsAllCaps]: {
|
|
@@ -7454,6 +7463,21 @@ const SDS_WARNINGS = {
|
|
|
7454
7463
|
[SDSWarningTypes.ClickableContentCardNumberOfButtons]: {
|
|
7455
7464
|
hasWarned: false,
|
|
7456
7465
|
message: "Warning: Clickable Content Cards can only have one or no buttons!"
|
|
7466
|
+
},
|
|
7467
|
+
[SDSWarningTypes.SegmentedControlTooltipTextDeprecated]: {
|
|
7468
|
+
hasWarned: false,
|
|
7469
|
+
message: 'Warning: "tooltipText" in SegmentedControl buttonDefinition is deprecated. ' +
|
|
7470
|
+
'Please use "tooltipProps" instead. Example: { tooltipProps: { title: "My tooltip" } }'
|
|
7471
|
+
},
|
|
7472
|
+
[SDSWarningTypes.SegmentedControlMissingIconOrLabel]: {
|
|
7473
|
+
hasWarned: false,
|
|
7474
|
+
message: 'Warning: Each SegmentedControl button must have either an "icon" or a "label" prop. ' +
|
|
7475
|
+
"A button was found with neither."
|
|
7476
|
+
},
|
|
7477
|
+
[SDSWarningTypes.SegmentedControlIconAndLabelConflict]: {
|
|
7478
|
+
hasWarned: false,
|
|
7479
|
+
message: 'Warning: Each SegmentedControl button should have either an "icon" or a "label", ' +
|
|
7480
|
+
"not both. Please use only one per button."
|
|
7457
7481
|
}
|
|
7458
7482
|
};
|
|
7459
7483
|
const showWarningIfFirstOccurence = (warningType) => {
|
|
@@ -7501,6 +7525,10 @@ const GeneralButtonGroupStyles = (props) => {
|
|
|
7501
7525
|
min-width: fit-content;
|
|
7502
7526
|
z-index: 1;
|
|
7503
7527
|
|
|
7528
|
+
&::before {
|
|
7529
|
+
border-radius: inherit;
|
|
7530
|
+
}
|
|
7531
|
+
|
|
7504
7532
|
&:hover,
|
|
7505
7533
|
&:active,
|
|
7506
7534
|
&:focus {
|
|
@@ -7607,10 +7635,11 @@ const LargeButtonGroupStyles = (props) => {
|
|
|
7607
7635
|
}
|
|
7608
7636
|
}
|
|
7609
7637
|
|
|
7610
|
-
/* Icon-only buttons: has svg but no startIcon/endIcon slots */
|
|
7638
|
+
/* Icon-only buttons: has svg but no startIcon/endIcon slots, or startIcon is the only child (e.g. ButtonToggle) */
|
|
7611
7639
|
.${material.buttonGroupClasses.grouped}:has(svg):not(
|
|
7612
7640
|
:has(.${material.buttonClasses.startIcon})
|
|
7613
|
-
):not(:has(.${material.buttonClasses.endIcon}))
|
|
7641
|
+
):not(:has(.${material.buttonClasses.endIcon})),
|
|
7642
|
+
.${material.buttonGroupClasses.grouped}:has(> .${material.buttonClasses.startIcon}:only-child) {
|
|
7614
7643
|
padding: ${iconOnlyPaddingWide};
|
|
7615
7644
|
|
|
7616
7645
|
${theme?.breakpoints?.down("md")} {
|
|
@@ -7618,8 +7647,10 @@ const LargeButtonGroupStyles = (props) => {
|
|
|
7618
7647
|
}
|
|
7619
7648
|
}
|
|
7620
7649
|
|
|
7621
|
-
/* Text + icon buttons: has startIcon or endIcon */
|
|
7622
|
-
.${material.buttonGroupClasses.grouped}:has(.${material.buttonClasses.startIcon})
|
|
7650
|
+
/* Text + icon buttons: has startIcon or endIcon (excluding icon-only ButtonToggle) */
|
|
7651
|
+
.${material.buttonGroupClasses.grouped}:has(.${material.buttonClasses.startIcon}):not(
|
|
7652
|
+
:has(> .${material.buttonClasses.startIcon}:only-child)
|
|
7653
|
+
),
|
|
7623
7654
|
.${material.buttonGroupClasses.grouped}:has(.${material.buttonClasses.endIcon}) {
|
|
7624
7655
|
${theme?.breakpoints?.down("md")} {
|
|
7625
7656
|
padding: 0 14px;
|
|
@@ -7685,10 +7716,11 @@ const MediumButtonGroupStyles = (props) => {
|
|
|
7685
7716
|
}
|
|
7686
7717
|
}
|
|
7687
7718
|
|
|
7688
|
-
/* Icon-only buttons: has svg but no startIcon/endIcon slots */
|
|
7719
|
+
/* Icon-only buttons: has svg but no startIcon/endIcon slots, or startIcon is the only child (e.g. ButtonToggle) */
|
|
7689
7720
|
.${material.buttonGroupClasses.grouped}:has(svg):not(
|
|
7690
7721
|
:has(.${material.buttonClasses.startIcon})
|
|
7691
|
-
):not(:has(.${material.buttonClasses.endIcon}))
|
|
7722
|
+
):not(:has(.${material.buttonClasses.endIcon})),
|
|
7723
|
+
.${material.buttonGroupClasses.grouped}:has(> .${material.buttonClasses.startIcon}:only-child) {
|
|
7692
7724
|
padding: ${iconOnlyPaddingWide};
|
|
7693
7725
|
|
|
7694
7726
|
${theme?.breakpoints?.down("md")} {
|
|
@@ -7696,8 +7728,10 @@ const MediumButtonGroupStyles = (props) => {
|
|
|
7696
7728
|
}
|
|
7697
7729
|
}
|
|
7698
7730
|
|
|
7699
|
-
/* Text + icon buttons: has startIcon or endIcon -
|
|
7700
|
-
.${material.buttonGroupClasses.grouped}:has(.${material.buttonClasses.startIcon})
|
|
7731
|
+
/* Text + icon buttons: has startIcon or endIcon (excluding icon-only ButtonToggle) */
|
|
7732
|
+
.${material.buttonGroupClasses.grouped}:has(.${material.buttonClasses.startIcon}):not(
|
|
7733
|
+
:has(> .${material.buttonClasses.startIcon}:only-child)
|
|
7734
|
+
),
|
|
7701
7735
|
.${material.buttonGroupClasses.grouped}:has(.${material.buttonClasses.endIcon}) {
|
|
7702
7736
|
padding: 0 10px;
|
|
7703
7737
|
}
|
|
@@ -7761,10 +7795,11 @@ const SmallButtonGroupStyles = (props) => {
|
|
|
7761
7795
|
}
|
|
7762
7796
|
}
|
|
7763
7797
|
|
|
7764
|
-
/* Icon-only buttons: has svg but no startIcon/endIcon slots */
|
|
7798
|
+
/* Icon-only buttons: has svg but no startIcon/endIcon slots, or startIcon is the only child (e.g. ButtonToggle) */
|
|
7765
7799
|
.${material.buttonGroupClasses.grouped}:has(svg):not(
|
|
7766
7800
|
:has(.${material.buttonClasses.startIcon})
|
|
7767
|
-
):not(:has(.${material.buttonClasses.endIcon}))
|
|
7801
|
+
):not(:has(.${material.buttonClasses.endIcon})),
|
|
7802
|
+
.${material.buttonGroupClasses.grouped}:has(> .${material.buttonClasses.startIcon}:only-child) {
|
|
7768
7803
|
padding: ${iconOnlyPaddingWide};
|
|
7769
7804
|
|
|
7770
7805
|
${theme?.breakpoints?.down("md")} {
|
|
@@ -7772,8 +7807,10 @@ const SmallButtonGroupStyles = (props) => {
|
|
|
7772
7807
|
}
|
|
7773
7808
|
}
|
|
7774
7809
|
|
|
7775
|
-
/* Text + icon buttons: has startIcon or endIcon -
|
|
7776
|
-
.${material.buttonGroupClasses.grouped}:has(.${material.buttonClasses.startIcon})
|
|
7810
|
+
/* Text + icon buttons: has startIcon or endIcon (excluding icon-only ButtonToggle) */
|
|
7811
|
+
.${material.buttonGroupClasses.grouped}:has(.${material.buttonClasses.startIcon}):not(
|
|
7812
|
+
:has(> .${material.buttonClasses.startIcon}:only-child)
|
|
7813
|
+
),
|
|
7777
7814
|
.${material.buttonGroupClasses.grouped}:has(.${material.buttonClasses.endIcon}) {
|
|
7778
7815
|
padding: 0 ${spaces?.s}px;
|
|
7779
7816
|
}
|
|
@@ -7822,6 +7859,7 @@ const PrimaryButtonGroupStyles = (props) => {
|
|
|
7822
7859
|
&& .${material.buttonGroupClasses.grouped} {
|
|
7823
7860
|
background-color: transparent;
|
|
7824
7861
|
border: 1px solid ${defaultColor};
|
|
7862
|
+
box-shadow: none;
|
|
7825
7863
|
color: ${defaultColor};
|
|
7826
7864
|
|
|
7827
7865
|
svg {
|
|
@@ -7833,6 +7871,7 @@ const PrimaryButtonGroupStyles = (props) => {
|
|
|
7833
7871
|
color: ${hoverColor};
|
|
7834
7872
|
background-color: ${hoverBgColor};
|
|
7835
7873
|
border: 1px solid ${hoverColor};
|
|
7874
|
+
box-shadow: none;
|
|
7836
7875
|
|
|
7837
7876
|
svg {
|
|
7838
7877
|
color: ${hoverColor};
|
|
@@ -7843,6 +7882,7 @@ const PrimaryButtonGroupStyles = (props) => {
|
|
|
7843
7882
|
color: ${pressedColor};
|
|
7844
7883
|
background-color: ${hoverBgColor};
|
|
7845
7884
|
border: 1px solid ${pressedColor};
|
|
7885
|
+
box-shadow: none;
|
|
7846
7886
|
|
|
7847
7887
|
svg {
|
|
7848
7888
|
color: ${pressedColor};
|
|
@@ -7857,6 +7897,7 @@ const PrimaryButtonGroupStyles = (props) => {
|
|
|
7857
7897
|
color: ${textDisabledColor};
|
|
7858
7898
|
background-color: transparent;
|
|
7859
7899
|
border: 1px solid ${disabledColor};
|
|
7900
|
+
box-shadow: none;
|
|
7860
7901
|
|
|
7861
7902
|
svg {
|
|
7862
7903
|
color: ${ornamentDisabledColor};
|
|
@@ -7910,6 +7951,7 @@ const SecondaryButtonGroupStyles = (props) => {
|
|
|
7910
7951
|
&& .${material.buttonGroupClasses.grouped} {
|
|
7911
7952
|
background-color: transparent;
|
|
7912
7953
|
border: 1px solid ${defaultColor};
|
|
7954
|
+
box-shadow: none;
|
|
7913
7955
|
color: ${textColor};
|
|
7914
7956
|
|
|
7915
7957
|
svg {
|
|
@@ -7921,6 +7963,7 @@ const SecondaryButtonGroupStyles = (props) => {
|
|
|
7921
7963
|
color: ${textColor};
|
|
7922
7964
|
background-color: ${hoverBgColor};
|
|
7923
7965
|
border: 1px solid ${defaultColor};
|
|
7966
|
+
box-shadow: none;
|
|
7924
7967
|
|
|
7925
7968
|
svg {
|
|
7926
7969
|
color: ${ornamentColor};
|
|
@@ -7931,6 +7974,7 @@ const SecondaryButtonGroupStyles = (props) => {
|
|
|
7931
7974
|
color: ${textColor};
|
|
7932
7975
|
background-color: ${pressedBgColor};
|
|
7933
7976
|
border: 1px solid ${defaultColor};
|
|
7977
|
+
box-shadow: none;
|
|
7934
7978
|
|
|
7935
7979
|
svg {
|
|
7936
7980
|
color: ${ornamentColor};
|
|
@@ -7945,6 +7989,7 @@ const SecondaryButtonGroupStyles = (props) => {
|
|
|
7945
7989
|
color: ${textDisabledColor};
|
|
7946
7990
|
background-color: transparent;
|
|
7947
7991
|
border: 1px solid ${disabledColor};
|
|
7992
|
+
box-shadow: none;
|
|
7948
7993
|
|
|
7949
7994
|
svg {
|
|
7950
7995
|
color: ${ornamentDisabledColor};
|
|
@@ -8283,29 +8328,44 @@ const StageOnStyles = (props) => {
|
|
|
8283
8328
|
// So we need to apply the "on" state background to ::before as well
|
|
8284
8329
|
const isSecondary = sdsType === "secondary";
|
|
8285
8330
|
if (isSecondary) {
|
|
8331
|
+
/**
|
|
8332
|
+
* Specificity boost via Emotion's `&&&&` technique.
|
|
8333
|
+
*
|
|
8334
|
+
* Each `&` repeats the component's generated class, producing a selector
|
|
8335
|
+
* like `.css-abc123.css-abc123.css-abc123.css-abc123` — specificity (0,4,0).
|
|
8336
|
+
*
|
|
8337
|
+
* This is needed because ButtonGroup styles its children with
|
|
8338
|
+
* `&& .MuiButtonGroup-grouped` which has specificity (0,3,0).
|
|
8339
|
+
* Without the boost, the sdsStage="on" styles would always lose
|
|
8340
|
+
* the cascade to the ButtonGroup's parent-level overrides.
|
|
8341
|
+
*/
|
|
8286
8342
|
return react.css `
|
|
8287
|
-
|
|
8343
|
+
&&&& {
|
|
8344
|
+
color: ${contentColor};
|
|
8288
8345
|
|
|
8289
|
-
|
|
8290
|
-
|
|
8291
|
-
|
|
8346
|
+
svg {
|
|
8347
|
+
color: ${ornamentColor};
|
|
8348
|
+
}
|
|
8292
8349
|
|
|
8293
|
-
|
|
8294
|
-
|
|
8295
|
-
|
|
8350
|
+
/* Apply "on" state background via ::before to match Button's hover pattern */
|
|
8351
|
+
&::before {
|
|
8352
|
+
background-color: ${sdsStyle === "minimal" && !backgroundOnHover
|
|
8296
8353
|
? "transparent"
|
|
8297
8354
|
: backgroundColor};
|
|
8355
|
+
}
|
|
8298
8356
|
}
|
|
8299
8357
|
`;
|
|
8300
8358
|
}
|
|
8301
8359
|
return react.css `
|
|
8302
|
-
|
|
8360
|
+
&&&& {
|
|
8361
|
+
background-color: ${sdsStyle === "minimal" && !backgroundOnHover
|
|
8303
8362
|
? "transparent"
|
|
8304
8363
|
: backgroundColor};
|
|
8305
|
-
|
|
8364
|
+
color: ${contentColor};
|
|
8306
8365
|
|
|
8307
|
-
|
|
8308
|
-
|
|
8366
|
+
svg {
|
|
8367
|
+
color: ${ornamentColor};
|
|
8368
|
+
}
|
|
8309
8369
|
}
|
|
8310
8370
|
`;
|
|
8311
8371
|
};
|
|
@@ -9326,18 +9386,31 @@ const TableRow = React.forwardRef((props, ref) => {
|
|
|
9326
9386
|
|
|
9327
9387
|
const StyledTableHeader$1 = styled__default.default("thead") `
|
|
9328
9388
|
${(props) => {
|
|
9389
|
+
const { hasFilterRow } = props;
|
|
9329
9390
|
const semanticColors = getSemanticColors(props);
|
|
9330
9391
|
return `
|
|
9331
9392
|
border-bottom: solid 2px ${semanticColors?.base?.borderSecondary};
|
|
9332
9393
|
margin: 0;
|
|
9333
9394
|
padding: 0;
|
|
9395
|
+
|
|
9396
|
+
${hasFilterRow
|
|
9397
|
+
? `
|
|
9398
|
+
> tr:first-of-type {
|
|
9399
|
+
border-bottom: none;
|
|
9400
|
+
|
|
9401
|
+
:after {
|
|
9402
|
+
display: none !important;
|
|
9403
|
+
}
|
|
9404
|
+
}
|
|
9405
|
+
`
|
|
9406
|
+
: ""}
|
|
9334
9407
|
`;
|
|
9335
9408
|
}}
|
|
9336
9409
|
`;
|
|
9337
9410
|
|
|
9338
9411
|
const TableHeader = React.forwardRef((props, ref) => {
|
|
9339
|
-
const { children } = props;
|
|
9340
|
-
return (jsxRuntime.
|
|
9412
|
+
const { children, filterRow } = props;
|
|
9413
|
+
return (jsxRuntime.jsxs(StyledTableHeader$1, __assign({ ref: ref, hasFilterRow: !!filterRow }, props, { children: [jsxRuntime.jsx(TableRow, { hover: false, shouldShowTooltipOnHover: false, children: children }), filterRow] })));
|
|
9341
9414
|
});
|
|
9342
9415
|
|
|
9343
9416
|
const contentPositionMapping = {
|
|
@@ -9381,7 +9454,6 @@ const ShouldTruncate$1 = () => {
|
|
|
9381
9454
|
};
|
|
9382
9455
|
const StyledTableHeader = styled__default.default.div `
|
|
9383
9456
|
${fontHeaderS}
|
|
9384
|
-
${focusVisibleA11yStyle}
|
|
9385
9457
|
|
|
9386
9458
|
${(props) => {
|
|
9387
9459
|
const { active = false, horizontalAlign = "left", hover = true } = props;
|
|
@@ -9394,6 +9466,7 @@ const StyledTableHeader = styled__default.default.div `
|
|
|
9394
9466
|
? semanticColors?.accent?.foregroundInteraction
|
|
9395
9467
|
: semanticColors?.base?.textPrimary;
|
|
9396
9468
|
return `
|
|
9469
|
+
outline: none;
|
|
9397
9470
|
color: ${defaultColor};
|
|
9398
9471
|
padding: ${spaces?.m}px !important;
|
|
9399
9472
|
text-align: ${horizontalAlign};
|
|
@@ -9964,12 +10037,12 @@ const InputCheckbox = (props) => {
|
|
|
9964
10037
|
|
|
9965
10038
|
const StyledCellComponentData = styled__default.default.div `
|
|
9966
10039
|
${fontBodyS$1}
|
|
9967
|
-
${focusVisibleA11yStyle}
|
|
9968
10040
|
|
|
9969
10041
|
${(props) => {
|
|
9970
10042
|
const spaces = getSpaces(props);
|
|
9971
10043
|
const { horizontalAlign = "left", verticalAlign = "top" } = props;
|
|
9972
10044
|
return `
|
|
10045
|
+
outline: none;
|
|
9973
10046
|
align-items: center;
|
|
9974
10047
|
text-align: ${horizontalAlign};
|
|
9975
10048
|
vertical-align: ${verticalAlign};
|
|
@@ -10081,6 +10154,104 @@ const StyledTableWrapper = styled__default.default.div `
|
|
|
10081
10154
|
}
|
|
10082
10155
|
}
|
|
10083
10156
|
}
|
|
10157
|
+
|
|
10158
|
+
td,
|
|
10159
|
+
th {
|
|
10160
|
+
--pinned-gradient-base: transparent;
|
|
10161
|
+
--pinned-gradient-bg: ${semanticColors?.base?.backgroundPrimary};
|
|
10162
|
+
--pinned-gradient-overlay: transparent;
|
|
10163
|
+
}
|
|
10164
|
+
|
|
10165
|
+
tbody tr:hover td,
|
|
10166
|
+
tbody tr:hover th {
|
|
10167
|
+
--pinned-gradient-overlay: ${semanticColors?.base
|
|
10168
|
+
?.fillPrimaryInteraction};
|
|
10169
|
+
}
|
|
10170
|
+
|
|
10171
|
+
tbody tr[aria-selected="true"] td,
|
|
10172
|
+
tbody tr[aria-selected="true"] th {
|
|
10173
|
+
--pinned-gradient-bg: ${semanticColors?.accent?.surfaceSecondary};
|
|
10174
|
+
}
|
|
10175
|
+
|
|
10176
|
+
${sdsStyle === "striped" &&
|
|
10177
|
+
`
|
|
10178
|
+
tbody tr:nth-of-type(odd) td,
|
|
10179
|
+
tbody tr:nth-of-type(odd) th {
|
|
10180
|
+
--pinned-gradient-base: ${semanticColors?.base?.backgroundPrimary};
|
|
10181
|
+
--pinned-gradient-bg: ${semanticColors?.base?.backgroundSecondary};
|
|
10182
|
+
}
|
|
10183
|
+
|
|
10184
|
+
tbody tr:nth-of-type(odd):hover td,
|
|
10185
|
+
tbody tr:nth-of-type(odd):hover th {
|
|
10186
|
+
--pinned-gradient-base: transparent;
|
|
10187
|
+
--pinned-gradient-bg: ${semanticColors?.base?.backgroundPrimary};
|
|
10188
|
+
}
|
|
10189
|
+
|
|
10190
|
+
tbody tr[aria-selected="true"]:nth-of-type(odd) td,
|
|
10191
|
+
tbody tr[aria-selected="true"]:nth-of-type(odd) th {
|
|
10192
|
+
--pinned-gradient-base: transparent;
|
|
10193
|
+
--pinned-gradient-bg: ${semanticColors?.accent?.surfaceSecondary};
|
|
10194
|
+
}
|
|
10195
|
+
|
|
10196
|
+
tbody tr[aria-selected="true"]:nth-of-type(odd):hover td,
|
|
10197
|
+
tbody tr[aria-selected="true"]:nth-of-type(odd):hover th {
|
|
10198
|
+
--pinned-gradient-base: transparent;
|
|
10199
|
+
--pinned-gradient-bg: ${semanticColors?.accent?.surfaceSecondary};
|
|
10200
|
+
}
|
|
10201
|
+
`}
|
|
10202
|
+
|
|
10203
|
+
[data-pinned-edge]::after {
|
|
10204
|
+
content: "";
|
|
10205
|
+
position: absolute;
|
|
10206
|
+
top: 0;
|
|
10207
|
+
bottom: 0;
|
|
10208
|
+
width: 24px;
|
|
10209
|
+
pointer-events: none;
|
|
10210
|
+
opacity: 0;
|
|
10211
|
+
transition: opacity 0.3s ease;
|
|
10212
|
+
}
|
|
10213
|
+
|
|
10214
|
+
[data-pinned-edge="left"]::after {
|
|
10215
|
+
right: 0;
|
|
10216
|
+
transform: translateX(100%);
|
|
10217
|
+
background:
|
|
10218
|
+
linear-gradient(
|
|
10219
|
+
var(--pinned-gradient-overlay),
|
|
10220
|
+
var(--pinned-gradient-overlay)
|
|
10221
|
+
),
|
|
10222
|
+
linear-gradient(var(--pinned-gradient-bg), var(--pinned-gradient-bg)),
|
|
10223
|
+
linear-gradient(
|
|
10224
|
+
var(--pinned-gradient-base),
|
|
10225
|
+
var(--pinned-gradient-base)
|
|
10226
|
+
);
|
|
10227
|
+
-webkit-mask-image: linear-gradient(to right, black, transparent);
|
|
10228
|
+
mask-image: linear-gradient(to right, black, transparent);
|
|
10229
|
+
}
|
|
10230
|
+
|
|
10231
|
+
[data-pinned-edge="right"]::after {
|
|
10232
|
+
left: 0;
|
|
10233
|
+
transform: translateX(-100%);
|
|
10234
|
+
background:
|
|
10235
|
+
linear-gradient(
|
|
10236
|
+
var(--pinned-gradient-overlay),
|
|
10237
|
+
var(--pinned-gradient-overlay)
|
|
10238
|
+
),
|
|
10239
|
+
linear-gradient(var(--pinned-gradient-bg), var(--pinned-gradient-bg)),
|
|
10240
|
+
linear-gradient(
|
|
10241
|
+
var(--pinned-gradient-base),
|
|
10242
|
+
var(--pinned-gradient-base)
|
|
10243
|
+
);
|
|
10244
|
+
-webkit-mask-image: linear-gradient(to left, black, transparent);
|
|
10245
|
+
mask-image: linear-gradient(to left, black, transparent);
|
|
10246
|
+
}
|
|
10247
|
+
|
|
10248
|
+
&[data-scrolled-left="true"] [data-pinned-edge="left"]::after {
|
|
10249
|
+
opacity: 1;
|
|
10250
|
+
}
|
|
10251
|
+
|
|
10252
|
+
&[data-scrolled-right="true"] [data-pinned-edge="right"]::after {
|
|
10253
|
+
opacity: 1;
|
|
10254
|
+
}
|
|
10084
10255
|
`;
|
|
10085
10256
|
}}
|
|
10086
10257
|
`;
|
|
@@ -10132,6 +10303,38 @@ const StyledPaginationWrapper = styled__default.default.div `
|
|
|
10132
10303
|
const StyledSelectionCell = styled__default.default(CellComponent) `
|
|
10133
10304
|
line-height: 22px !important;
|
|
10134
10305
|
`;
|
|
10306
|
+
const StyledFilterRow = styled__default.default("tr") `
|
|
10307
|
+
${(props) => {
|
|
10308
|
+
const semanticColors = getSemanticColors(props);
|
|
10309
|
+
return `
|
|
10310
|
+
background-color: ${semanticColors?.base?.backgroundPrimary};
|
|
10311
|
+
border: none;
|
|
10312
|
+
box-shadow: none;
|
|
10313
|
+
|
|
10314
|
+
td, th {
|
|
10315
|
+
background-color: ${semanticColors?.base?.backgroundPrimary};
|
|
10316
|
+
}
|
|
10317
|
+
|
|
10318
|
+
&:after {
|
|
10319
|
+
display: none !important;
|
|
10320
|
+
}
|
|
10321
|
+
|
|
10322
|
+
&:hover {
|
|
10323
|
+
background-color: ${semanticColors?.base?.backgroundPrimary};
|
|
10324
|
+
}
|
|
10325
|
+
`;
|
|
10326
|
+
}}
|
|
10327
|
+
`;
|
|
10328
|
+
const StyledFilterCell = styled__default.default("th") `
|
|
10329
|
+
${(props) => {
|
|
10330
|
+
const spaces = getSpaces(props);
|
|
10331
|
+
return `
|
|
10332
|
+
padding: 0 ${spaces?.s}px ${spaces?.s}px;
|
|
10333
|
+
vertical-align: middle;
|
|
10334
|
+
width: 100%;
|
|
10335
|
+
`;
|
|
10336
|
+
}}
|
|
10337
|
+
`;
|
|
10135
10338
|
|
|
10136
10339
|
const SELECT_COLUMN_ID = "SdsTableSelectColumn";
|
|
10137
10340
|
function getSize(size = 100, max = Number.MAX_SAFE_INTEGER, min = 40) {
|
|
@@ -10227,11 +10430,78 @@ const getCommonPinningStyles = (column, table) => {
|
|
|
10227
10430
|
};
|
|
10228
10431
|
};
|
|
10229
10432
|
|
|
10433
|
+
/**
|
|
10434
|
+
* Manages gradient vignettes on the inner edges of pinned columns.
|
|
10435
|
+
*
|
|
10436
|
+
* Identifies which columns sit at the boundary of left/right pinned groups
|
|
10437
|
+
* and toggles scroll-aware data attributes on the wrapper so the CSS
|
|
10438
|
+
* gradients in StyledTableWrapper only appear while content scrolls
|
|
10439
|
+
* underneath the pinned columns.
|
|
10440
|
+
*/
|
|
10441
|
+
function usePinnedColumnGradient(table, columns) {
|
|
10442
|
+
const tableWrapperRef = React.useRef(null);
|
|
10443
|
+
const { lastLeftPinnedColumnId, firstRightPinnedColumnId } = React.useMemo(() => {
|
|
10444
|
+
const allCols = table.getAllColumns();
|
|
10445
|
+
const leftPinned = allCols.filter((col) => col.columnDef.meta?.pinning === "left");
|
|
10446
|
+
const rightPinned = allCols.filter((col) => col.columnDef.meta?.pinning === "right");
|
|
10447
|
+
return {
|
|
10448
|
+
firstRightPinnedColumnId: rightPinned.length > 0 ? rightPinned[0].id : null,
|
|
10449
|
+
lastLeftPinnedColumnId: leftPinned.length > 0 ? leftPinned[leftPinned.length - 1].id : null
|
|
10450
|
+
};
|
|
10451
|
+
// (masoudmanson): `columns` is included as a dependency even though only
|
|
10452
|
+
// `table.getAllColumns()`is called inside the callback. The TanStack
|
|
10453
|
+
// Table `table` object can be a stable reference that doesn't change
|
|
10454
|
+
// identity when column definitions change, so `columns` acts as a
|
|
10455
|
+
// reactivity signal to ensure this memo recomputes.
|
|
10456
|
+
//
|
|
10457
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10458
|
+
}, [table, columns]);
|
|
10459
|
+
const getPinnedEdge = React.useCallback((columnId) => {
|
|
10460
|
+
if (columnId === lastLeftPinnedColumnId)
|
|
10461
|
+
return "left";
|
|
10462
|
+
if (columnId === firstRightPinnedColumnId)
|
|
10463
|
+
return "right";
|
|
10464
|
+
return undefined;
|
|
10465
|
+
}, [lastLeftPinnedColumnId, firstRightPinnedColumnId]);
|
|
10466
|
+
React.useEffect(() => {
|
|
10467
|
+
const wrapper = tableWrapperRef.current;
|
|
10468
|
+
if (!wrapper)
|
|
10469
|
+
return;
|
|
10470
|
+
if (!lastLeftPinnedColumnId && !firstRightPinnedColumnId)
|
|
10471
|
+
return;
|
|
10472
|
+
const updateScrollState = () => {
|
|
10473
|
+
const { scrollLeft, scrollWidth, clientWidth } = wrapper;
|
|
10474
|
+
const hasHorizontalScroll = scrollWidth > clientWidth;
|
|
10475
|
+
if (scrollLeft > 0) {
|
|
10476
|
+
wrapper.setAttribute("data-scrolled-left", "true");
|
|
10477
|
+
}
|
|
10478
|
+
else {
|
|
10479
|
+
wrapper.removeAttribute("data-scrolled-left");
|
|
10480
|
+
}
|
|
10481
|
+
if (hasHorizontalScroll && scrollLeft < scrollWidth - clientWidth - 1) {
|
|
10482
|
+
wrapper.setAttribute("data-scrolled-right", "true");
|
|
10483
|
+
}
|
|
10484
|
+
else {
|
|
10485
|
+
wrapper.removeAttribute("data-scrolled-right");
|
|
10486
|
+
}
|
|
10487
|
+
};
|
|
10488
|
+
updateScrollState();
|
|
10489
|
+
wrapper.addEventListener("scroll", updateScrollState, { passive: true });
|
|
10490
|
+
const resizeObserver = new ResizeObserver(() => updateScrollState());
|
|
10491
|
+
resizeObserver.observe(wrapper);
|
|
10492
|
+
return () => {
|
|
10493
|
+
wrapper.removeEventListener("scroll", updateScrollState);
|
|
10494
|
+
resizeObserver.disconnect();
|
|
10495
|
+
};
|
|
10496
|
+
}, [lastLeftPinnedColumnId, firstRightPinnedColumnId]);
|
|
10497
|
+
return { getPinnedEdge, tableWrapperRef };
|
|
10498
|
+
}
|
|
10499
|
+
|
|
10230
10500
|
// Create context for row hover state
|
|
10231
10501
|
const RowHoverContext = React.createContext({
|
|
10232
10502
|
isRowHovered: false
|
|
10233
10503
|
});
|
|
10234
|
-
const
|
|
10504
|
+
const PreComposedTableInner = ({ data, columns, border = true, enableSorting = false, enableRowSelection = false, shouldPinSelectRowToLeft = true, enablePagination = false, enableColumnFiltering = false, enableGlobalFiltering = false, paginationConfig, className, style, tableWidth = "100%", onRowSelect, tableRowProps, sdsStyle = "lined", tableOptions, }, ref) => {
|
|
10235
10505
|
const [sorting, setSorting] = React.useState([]);
|
|
10236
10506
|
const [rowSelection, setRowSelection] = React.useState({});
|
|
10237
10507
|
const [columnVisibility, setColumnVisibility] = React.useState({});
|
|
@@ -10303,10 +10573,35 @@ const PreComposedTable = ({ data, columns, border = true, enableSorting = false,
|
|
|
10303
10573
|
...columnsWithoutSelection,
|
|
10304
10574
|
];
|
|
10305
10575
|
}, [columns, enableRowSelection, shouldPinSelectRowToLeft]);
|
|
10576
|
+
const { onSortingChange: externalOnSortingChange, onRowSelectionChange: externalOnRowSelectionChange, onColumnVisibilityChange: externalOnColumnVisibilityChange, onColumnPinningChange: externalOnColumnPinningChange, onGlobalFilterChange: externalOnGlobalFilterChange, onPaginationChange: externalOnPaginationChange, } = tableOptions ?? {};
|
|
10577
|
+
const handleSortingChange = React.useCallback((updater) => {
|
|
10578
|
+
setSorting(updater);
|
|
10579
|
+
externalOnSortingChange?.(updater);
|
|
10580
|
+
}, [externalOnSortingChange]);
|
|
10581
|
+
const handleRowSelectionChange = React.useCallback((updater) => {
|
|
10582
|
+
setRowSelection(updater);
|
|
10583
|
+
externalOnRowSelectionChange?.(updater);
|
|
10584
|
+
}, [externalOnRowSelectionChange]);
|
|
10585
|
+
const handleColumnVisibilityChange = React.useCallback((updater) => {
|
|
10586
|
+
setColumnVisibility(updater);
|
|
10587
|
+
externalOnColumnVisibilityChange?.(updater);
|
|
10588
|
+
}, [externalOnColumnVisibilityChange]);
|
|
10589
|
+
const handleColumnPinningChange = React.useCallback((updater) => {
|
|
10590
|
+
setColumnPinning(updater);
|
|
10591
|
+
externalOnColumnPinningChange?.(updater);
|
|
10592
|
+
}, [externalOnColumnPinningChange]);
|
|
10593
|
+
const handleGlobalFilterChange = React.useCallback((updater) => {
|
|
10594
|
+
setGlobalFilter(updater);
|
|
10595
|
+
externalOnGlobalFilterChange?.(updater);
|
|
10596
|
+
}, [externalOnGlobalFilterChange]);
|
|
10597
|
+
const handlePaginationChange = React.useCallback((updater) => {
|
|
10598
|
+
setPagination(updater);
|
|
10599
|
+
externalOnPaginationChange?.(updater);
|
|
10600
|
+
}, [externalOnPaginationChange]);
|
|
10306
10601
|
const table = reactTable.useReactTable({
|
|
10602
|
+
...tableOptions,
|
|
10307
10603
|
columns: tableColumns,
|
|
10308
10604
|
data,
|
|
10309
|
-
debugTable: true,
|
|
10310
10605
|
enableColumnFilters: enableColumnFiltering,
|
|
10311
10606
|
enableGlobalFilter: enableGlobalFiltering,
|
|
10312
10607
|
enableRowSelection: enableRowSelection,
|
|
@@ -10315,21 +10610,23 @@ const PreComposedTable = ({ data, columns, border = true, enableSorting = false,
|
|
|
10315
10610
|
getFilteredRowModel: reactTable.getFilteredRowModel(),
|
|
10316
10611
|
getPaginationRowModel: reactTable.getPaginationRowModel(),
|
|
10317
10612
|
getSortedRowModel: reactTable.getSortedRowModel(),
|
|
10318
|
-
onColumnPinningChange:
|
|
10319
|
-
onColumnVisibilityChange:
|
|
10320
|
-
onGlobalFilterChange:
|
|
10321
|
-
onPaginationChange:
|
|
10322
|
-
onRowSelectionChange:
|
|
10323
|
-
onSortingChange:
|
|
10613
|
+
onColumnPinningChange: handleColumnPinningChange,
|
|
10614
|
+
onColumnVisibilityChange: handleColumnVisibilityChange,
|
|
10615
|
+
onGlobalFilterChange: handleGlobalFilterChange,
|
|
10616
|
+
onPaginationChange: handlePaginationChange,
|
|
10617
|
+
onRowSelectionChange: handleRowSelectionChange,
|
|
10618
|
+
onSortingChange: handleSortingChange,
|
|
10324
10619
|
state: {
|
|
10325
10620
|
columnPinning,
|
|
10326
10621
|
columnVisibility,
|
|
10327
10622
|
globalFilter,
|
|
10328
10623
|
pagination,
|
|
10329
10624
|
rowSelection,
|
|
10330
|
-
sorting
|
|
10625
|
+
sorting,
|
|
10626
|
+
...tableOptions?.state
|
|
10331
10627
|
}
|
|
10332
10628
|
});
|
|
10629
|
+
React.useImperativeHandle(ref, () => ({ table }), [table]);
|
|
10333
10630
|
const createInitialPinning = React.useCallback(() => {
|
|
10334
10631
|
const initialPinning = {};
|
|
10335
10632
|
tableColumns.forEach((column) => {
|
|
@@ -10382,6 +10679,7 @@ const PreComposedTable = ({ data, columns, border = true, enableSorting = false,
|
|
|
10382
10679
|
resizeObserver.disconnect();
|
|
10383
10680
|
};
|
|
10384
10681
|
}, [headers, table]);
|
|
10682
|
+
const { tableWrapperRef, getPinnedEdge } = usePinnedColumnGradient(table, tableColumns);
|
|
10385
10683
|
const renderCell = (cell, row) => {
|
|
10386
10684
|
const isRowHovered = hoveredRowId === row.id;
|
|
10387
10685
|
const isPinned = cell.column.columnDef.meta?.pinning;
|
|
@@ -10412,7 +10710,7 @@ const PreComposedTable = ({ data, columns, border = true, enableSorting = false,
|
|
|
10412
10710
|
: cell.column.columnDef.meta?.verticalAlign }));
|
|
10413
10711
|
}
|
|
10414
10712
|
if (isPinned) {
|
|
10415
|
-
return (jsxRuntime.jsx(RowHoverContext.Provider, { value: { isRowHovered }, children: jsxRuntime.jsx("td", { style: {
|
|
10713
|
+
return (jsxRuntime.jsx(RowHoverContext.Provider, { value: { isRowHovered }, children: jsxRuntime.jsx("td", { "data-pinned-edge": getPinnedEdge(cell.column.id), style: {
|
|
10416
10714
|
...pinnedStyle,
|
|
10417
10715
|
width: `${cell.column.getSize()}px`,
|
|
10418
10716
|
verticalAlign: cell.column.columnDef.meta?.verticalAlign
|
|
@@ -10423,16 +10721,41 @@ const PreComposedTable = ({ data, columns, border = true, enableSorting = false,
|
|
|
10423
10721
|
width: `${cell.column.getSize()}px`
|
|
10424
10722
|
}, children: cellContent }) }, cell.id));
|
|
10425
10723
|
};
|
|
10724
|
+
const renderFilterCell = (header) => {
|
|
10725
|
+
const column = header.column;
|
|
10726
|
+
const isPinned = column.columnDef.meta?.pinning;
|
|
10727
|
+
const pinnedStyle = getCommonPinningStyles(column, table);
|
|
10728
|
+
const isSelectionColumn = column.id === SELECT_COLUMN_ID;
|
|
10729
|
+
const cellStyle = {
|
|
10730
|
+
...(isPinned ? pinnedStyle : {}),
|
|
10731
|
+
width: `${column.getSize()}px`
|
|
10732
|
+
};
|
|
10733
|
+
const pinnedEdge = isPinned ? getPinnedEdge(column.id) : undefined;
|
|
10734
|
+
const customFilter = column.columnDef.meta?.filterComponent;
|
|
10735
|
+
if (customFilter && !isSelectionColumn) {
|
|
10736
|
+
return (jsxRuntime.jsx(StyledFilterCell, { "data-pinned-edge": pinnedEdge, style: cellStyle, children: customFilter({ column, table }) }, `filter-${header.id}`));
|
|
10737
|
+
}
|
|
10738
|
+
const canFilter = column.getCanFilter() && !isSelectionColumn;
|
|
10739
|
+
if (!canFilter) {
|
|
10740
|
+
return (jsxRuntime.jsx(StyledFilterCell, { "data-pinned-edge": pinnedEdge, style: cellStyle }, `filter-${header.id}`));
|
|
10741
|
+
}
|
|
10742
|
+
return (jsxRuntime.jsx(StyledFilterCell, { "data-pinned-edge": pinnedEdge, style: cellStyle, children: jsxRuntime.jsx(InputSearch, { id: `filter-${column.id}`, label: `Filter ${typeof column.columnDef.header === "string" ? column.columnDef.header : column.id}`, placeholder: "Search", sdsStyle: "square", value: column.getFilterValue() ?? "", onChange: (e) => column.setFilterValue(e.target.value || undefined) }) }, `filter-${header.id}`));
|
|
10743
|
+
};
|
|
10744
|
+
const renderFilterRow = () => {
|
|
10745
|
+
const flatHeaders = table.getFlatHeaders();
|
|
10746
|
+
return (jsxRuntime.jsx(StyledFilterRow, { children: flatHeaders.map((header) => renderFilterCell(header)) }));
|
|
10747
|
+
};
|
|
10426
10748
|
const renderHeader = (header) => {
|
|
10427
10749
|
const isSortable = enableSorting && header.column.getCanSort();
|
|
10428
10750
|
const isSorted = header.column.getIsSorted();
|
|
10429
10751
|
const sortDirection = header.column.getIsSorted();
|
|
10430
10752
|
const isPinned = header.column.columnDef.meta?.pinning;
|
|
10431
10753
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10432
|
-
const { ref, ...headerCellProps } = header.column.columnDef.meta?.headerCellProps || {};
|
|
10754
|
+
const { ref: headerCellRef, ...headerCellProps } = header.column.columnDef.meta?.headerCellProps || {};
|
|
10433
10755
|
const pinnedStyle = getCommonPinningStyles(header.column, table);
|
|
10756
|
+
const pinnedEdge = isPinned ? getPinnedEdge(header.column.id) : undefined;
|
|
10434
10757
|
if (typeof header.column.columnDef.header === "string") {
|
|
10435
|
-
return (jsxRuntime.jsx(CellHeader, __assign({ colSpan: header.colSpan, style: {
|
|
10758
|
+
return (jsxRuntime.jsx(CellHeader, __assign({ colSpan: header.colSpan, "data-pinned-edge": pinnedEdge, style: {
|
|
10436
10759
|
...(isPinned ? pinnedStyle : {}),
|
|
10437
10760
|
width: `${header.getSize()}px`
|
|
10438
10761
|
}, active: !!isSorted, direction: sortDirection || undefined, hover: isSortable, onClick: header.column.getToggleSortingHandler() }, headerCellProps, { children: header.isPlaceholder ? null : header.column.columnDef.header }), header.id));
|
|
@@ -10440,6 +10763,7 @@ const PreComposedTable = ({ data, columns, border = true, enableSorting = false,
|
|
|
10440
10763
|
else if (header.column.columnDef.header) {
|
|
10441
10764
|
return reactTable.flexRender(header.column.columnDef.header, {
|
|
10442
10765
|
...header.getContext(),
|
|
10766
|
+
"data-pinned-edge": pinnedEdge,
|
|
10443
10767
|
key: header.id,
|
|
10444
10768
|
style: {
|
|
10445
10769
|
...(isPinned ? pinnedStyle : {}),
|
|
@@ -10449,20 +10773,21 @@ const PreComposedTable = ({ data, columns, border = true, enableSorting = false,
|
|
|
10449
10773
|
}
|
|
10450
10774
|
else {
|
|
10451
10775
|
// Fallback for undefined header content
|
|
10452
|
-
return (jsxRuntime.jsx(CellHeader, { colSpan: header.colSpan, style: {
|
|
10776
|
+
return (jsxRuntime.jsx(CellHeader, { colSpan: header.colSpan, "data-pinned-edge": pinnedEdge, style: {
|
|
10453
10777
|
...(isPinned ? pinnedStyle : {}),
|
|
10454
10778
|
width: `${header.getSize()}px`
|
|
10455
10779
|
}, active: !!isSorted, direction: sortDirection || undefined, hover: isSortable, onClick: header.column.getToggleSortingHandler(), children: header.column.id || "Header" }, header.id));
|
|
10456
10780
|
}
|
|
10457
10781
|
};
|
|
10458
|
-
return (jsxRuntime.jsxs(StyledTableContainer$1, { ref: tableContainerRef, className: className, style: { width: tableWidth, ...style }, children: [enableGlobalFiltering && (jsxRuntime.jsx("div", { style: { marginBottom: "16px" }, children: jsxRuntime.jsx(StyledInputSearch, { id: "global-search", label: "Search", placeholder: "Search all columns...", value: globalFilter, onChange: (e) => setGlobalFilter(e.target.value) }) })), jsxRuntime.jsx(StyledTableWrapper, { border: border, sdsStyle: sdsStyle, children: jsxRuntime.jsxs(Table, { children: [jsxRuntime.jsx(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => {
|
|
10782
|
+
return (jsxRuntime.jsxs(StyledTableContainer$1, { ref: tableContainerRef, className: className, style: { width: tableWidth, ...style }, children: [enableGlobalFiltering && (jsxRuntime.jsx("div", { style: { marginBottom: "16px" }, children: jsxRuntime.jsx(StyledInputSearch, { id: "global-search", label: "Search", placeholder: "Search all columns...", value: globalFilter, onChange: (e) => setGlobalFilter(e.target.value) }) })), jsxRuntime.jsx(StyledTableWrapper, { ref: tableWrapperRef, border: border, sdsStyle: sdsStyle, children: jsxRuntime.jsxs(Table, { children: [jsxRuntime.jsx(TableHeader, { filterRow: enableColumnFiltering ? renderFilterRow() : undefined, children: table.getHeaderGroups().map((headerGroup) => {
|
|
10459
10783
|
return (jsxRuntime.jsx(React.Fragment, { children: headerGroup.headers.map((header) => {
|
|
10460
10784
|
return renderHeader(header);
|
|
10461
10785
|
}) }, headerGroup.id));
|
|
10462
|
-
}) }), jsxRuntime.jsx("tbody", { children: table.getRowModel().rows.map((row) => (jsxRuntime.jsx(TableRow, __assign({ onMouseEnter: () => setHoveredRowId(row.id), onMouseLeave: () => setHoveredRowId(null), selected: row.getIsSelected(), "aria-selected": row.getIsSelected() }, tableRowProps, { children: row.getVisibleCells().map((cell) => {
|
|
10786
|
+
}) }), jsxRuntime.jsx("tbody", { children: table.getRowModel().rows.map((row) => (jsxRuntime.jsx(TableRow, __assign({ onMouseEnter: () => setHoveredRowId(row.id), onMouseLeave: () => setHoveredRowId(null), selected: row.getIsSelected(), "aria-selected": row.getIsSelected(), className: "group" }, tableRowProps, { children: row.getVisibleCells().map((cell) => {
|
|
10463
10787
|
return renderCell(cell, row);
|
|
10464
10788
|
}) }), row.id))) })] }) }), enablePagination && (jsxRuntime.jsx(StyledPaginationWrapper, { placement: paginationConfig?.placement, children: jsxRuntime.jsx(Pagination, __assign({ currentPage: table.getState().pagination.pageIndex + 1, onPageChange: (page) => table.setPageIndex(page - 1), onNextPage: () => table.nextPage(), onPreviousPage: () => table.previousPage(), pageSize: table.getState().pagination.pageSize, totalCount: table.getFilteredRowModel().rows.length }, paginationConfig)) }))] }, `table-${columns.length}-${columns.map((col) => col.id || "col").join("-")}`));
|
|
10465
10789
|
};
|
|
10790
|
+
const PreComposedTable = React.forwardRef(PreComposedTableInner);
|
|
10466
10791
|
|
|
10467
10792
|
const doNotForwardProps$v = [
|
|
10468
10793
|
"icon",
|
|
@@ -10551,6 +10876,7 @@ const PrimaryText = styled__default.default("div", {
|
|
|
10551
10876
|
return `
|
|
10552
10877
|
display: block;
|
|
10553
10878
|
font-variant-numeric: ${tabularNums ? TABULAR_NUMS : "normal"};
|
|
10879
|
+
white-space: pre-wrap;
|
|
10554
10880
|
|
|
10555
10881
|
${props.shouldTextWrap
|
|
10556
10882
|
? ShouldWrap(primaryTextWrapLineCount)
|
|
@@ -10571,6 +10897,7 @@ const SecondaryText = styled__default.default("span", {
|
|
|
10571
10897
|
color: ${semanticColors?.base?.textSecondary};
|
|
10572
10898
|
padding-top: 0px;
|
|
10573
10899
|
font-variant-numeric: ${tabularNums ? TABULAR_NUMS : "normal"};
|
|
10900
|
+
white-space: pre-wrap;
|
|
10574
10901
|
|
|
10575
10902
|
${props.shouldTextWrap
|
|
10576
10903
|
? ShouldWrap(secondaryTextWrapLineCount)
|
|
@@ -10592,6 +10919,7 @@ const TertiaryText = styled__default.default("span", {
|
|
|
10592
10919
|
color: ${semanticColors?.base?.textSecondary};
|
|
10593
10920
|
padding-top: ${spaces?.xxxs}px;
|
|
10594
10921
|
font-variant-numeric: ${tabularNums ? TABULAR_NUMS : "normal"};
|
|
10922
|
+
white-space: pre-wrap;
|
|
10595
10923
|
|
|
10596
10924
|
${props.shouldTextWrap
|
|
10597
10925
|
? ShouldWrap(tertiaryTextWrapLineCount)
|
|
@@ -10617,7 +10945,6 @@ const PrimaryTextComponentSlotRightWrapper = styled__default.default("div") `
|
|
|
10617
10945
|
`;
|
|
10618
10946
|
const StyledTableData = styled__default.default.div `
|
|
10619
10947
|
${fontBodyS$1}
|
|
10620
|
-
${focusVisibleA11yStyle}
|
|
10621
10948
|
|
|
10622
10949
|
${(props) => {
|
|
10623
10950
|
const { horizontalAlign = "left", verticalAlign = "top", shouldShowUnderlineOnHover = false, isRowHovered = false, extraRightPadding = 0, } = props;
|
|
@@ -10626,6 +10953,7 @@ const StyledTableData = styled__default.default.div `
|
|
|
10626
10953
|
? (spaces?.m ?? 0) + extraRightPadding
|
|
10627
10954
|
: spaces?.m;
|
|
10628
10955
|
return `
|
|
10956
|
+
outline: none;
|
|
10629
10957
|
padding: ${spaces?.m}px ${paddingRight}px ${spaces?.m}px ${spaces?.m}px !important;
|
|
10630
10958
|
text-align: ${horizontalAlign};
|
|
10631
10959
|
vertical-align: ${verticalAlignCSSMap[verticalAlign]};
|
|
@@ -10633,12 +10961,12 @@ const StyledTableData = styled__default.default.div `
|
|
|
10633
10961
|
|
|
10634
10962
|
&:hover {
|
|
10635
10963
|
${PrimaryText} {
|
|
10636
|
-
${shouldShowUnderlineOnHover ? "text-decoration: underline;" : ""}
|
|
10964
|
+
${shouldShowUnderlineOnHover ? "text-decoration: underline !important;" : ""}
|
|
10637
10965
|
}
|
|
10638
10966
|
}
|
|
10639
10967
|
|
|
10640
10968
|
${PrimaryText} {
|
|
10641
|
-
${isRowHovered && shouldShowUnderlineOnHover ? "text-decoration: underline;" : ""}
|
|
10969
|
+
${isRowHovered && shouldShowUnderlineOnHover ? "text-decoration: underline !important;" : ""}
|
|
10642
10970
|
}
|
|
10643
10971
|
`;
|
|
10644
10972
|
}}
|
|
@@ -18490,11 +18818,28 @@ const StyledHeaderComponent = styled__default.default("div") `
|
|
|
18490
18818
|
top: 0;
|
|
18491
18819
|
z-index: 1000;
|
|
18492
18820
|
background-color: ${semanticColors?.base?.backgroundPrimary};
|
|
18493
|
-
padding-bottom: ${spaces?.
|
|
18821
|
+
padding-bottom: ${spaces?.m}px;
|
|
18822
|
+
margin-bottom: ${spaces?.m}px;
|
|
18494
18823
|
padding-top: ${spaces?.xl}px;
|
|
18495
18824
|
display: flex;
|
|
18496
18825
|
justify-content: space-between;
|
|
18497
|
-
align-items:
|
|
18826
|
+
align-items: center;
|
|
18827
|
+
|
|
18828
|
+
&::after {
|
|
18829
|
+
content: "";
|
|
18830
|
+
position: absolute;
|
|
18831
|
+
bottom: 0;
|
|
18832
|
+
left: 0;
|
|
18833
|
+
right: 0;
|
|
18834
|
+
height: ${spaces?.xl}px;
|
|
18835
|
+
transform: translateY(100%);
|
|
18836
|
+
background: linear-gradient(
|
|
18837
|
+
to bottom,
|
|
18838
|
+
${semanticColors?.base?.backgroundPrimary},
|
|
18839
|
+
transparent
|
|
18840
|
+
);
|
|
18841
|
+
pointer-events: none;
|
|
18842
|
+
}
|
|
18498
18843
|
`;
|
|
18499
18844
|
}}
|
|
18500
18845
|
`;
|
|
@@ -18524,6 +18869,8 @@ const StyledPanelHeaderClose = styled__default.default("div") `
|
|
|
18524
18869
|
align-items: center;
|
|
18525
18870
|
|
|
18526
18871
|
button {
|
|
18872
|
+
height: auto !important;
|
|
18873
|
+
|
|
18527
18874
|
svg {
|
|
18528
18875
|
width: ${iconSizes?.l?.width}px;
|
|
18529
18876
|
height: ${iconSizes?.l?.height}px;
|
|
@@ -18590,6 +18937,41 @@ const Panel = React__namespace.default.forwardRef((props, ref) => {
|
|
|
18590
18937
|
}, slotProps: SLOT_PROPS, hideBackdrop: !isBackdropClickEnabled, children: [isOverlayPanelProps(props) && (jsxRuntime.jsxs(StyledHeaderComponent, { children: [props?.HeaderComponent && (jsxRuntime.jsx(PanelHeader, { children: props?.HeaderComponent })), jsxRuntime.jsx(PanelHeaderClose, { onClick: props?.closeButtonOnClick, CloseButtonComponent: props?.CloseButtonComponent })] })), children] })));
|
|
18591
18938
|
});
|
|
18592
18939
|
|
|
18940
|
+
const StyledPopover = styled__default.default(material.Popover) `
|
|
18941
|
+
& .${material.popoverClasses.paper} {
|
|
18942
|
+
${(props) => {
|
|
18943
|
+
const corners = getCorners(props);
|
|
18944
|
+
const shadows = getShadows(props);
|
|
18945
|
+
const semanticColors = getSemanticColors(props);
|
|
18946
|
+
const borders = getBorders(props);
|
|
18947
|
+
const spaces = getSpaces(props);
|
|
18948
|
+
return `
|
|
18949
|
+
background-color: ${semanticColors?.base?.surfacePrimary};
|
|
18950
|
+
background-image: none;
|
|
18951
|
+
border-radius: ${corners?.l}px;
|
|
18952
|
+
padding: ${spaces?.xs}px ${spaces?.m}px;
|
|
18953
|
+
border: ${borders?.none};
|
|
18954
|
+
outline: 1px solid ${addOpacityToHex(semanticColors?.base?.borderSecondary || "#000000", 15)};
|
|
18955
|
+
box-shadow: ${shadows?.m};
|
|
18956
|
+
box-sizing: border-box;
|
|
18957
|
+
z-index: ${props?.theme?.zIndex?.tooltip ?? 1400};
|
|
18958
|
+
`;
|
|
18959
|
+
}}
|
|
18960
|
+
}
|
|
18961
|
+
`;
|
|
18962
|
+
|
|
18963
|
+
/**
|
|
18964
|
+
* @see https://mui.com/material-ui/react-popover/
|
|
18965
|
+
*/
|
|
18966
|
+
const Popover = React.forwardRef(function Popover(props, ref) {
|
|
18967
|
+
const theme = material.useTheme();
|
|
18968
|
+
const spaces = getSpaces({ theme });
|
|
18969
|
+
return (jsxRuntime.jsx(StyledPopover, __assign({ ref: ref, anchorOrigin: {
|
|
18970
|
+
horizontal: "left",
|
|
18971
|
+
vertical: "bottom"
|
|
18972
|
+
}, transformOrigin: { vertical: -(spaces?.s || 8), horizontal: 0 } }, props)));
|
|
18973
|
+
});
|
|
18974
|
+
|
|
18593
18975
|
const doNotForwardProps = ["buttonDefinition"];
|
|
18594
18976
|
const StyledSegmentedControl = styled__default.default(material.ToggleButtonGroup, {
|
|
18595
18977
|
shouldForwardProp: (prop) => !doNotForwardProps.includes(prop)
|
|
@@ -18631,7 +19013,6 @@ const StyledSegmentedControl = styled__default.default(material.ToggleButtonGrou
|
|
|
18631
19013
|
${focusVisibleA11yStyle(props)}
|
|
18632
19014
|
background-color: transparent;
|
|
18633
19015
|
border: none;
|
|
18634
|
-
line-height: 0px;
|
|
18635
19016
|
color: ${semanticColors?.base?.ornamentSecondary};
|
|
18636
19017
|
padding: ${spaces?.xxs}px ${spaces?.m}px;
|
|
18637
19018
|
border-radius: ${corners?.m}px;
|
|
@@ -18660,6 +19041,14 @@ const StyledToggleButton = styled__default.default(material.ToggleButton, {
|
|
|
18660
19041
|
`;
|
|
18661
19042
|
}}
|
|
18662
19043
|
`;
|
|
19044
|
+
const StyledToggleButtonIcon = styled__default.default("div") `
|
|
19045
|
+
line-height: 0px;
|
|
19046
|
+
`;
|
|
19047
|
+
const StyledToggleButtonLabel = styled__default.default("div") `
|
|
19048
|
+
${fontBodyMediumS}
|
|
19049
|
+
white-space: nowrap;
|
|
19050
|
+
line-height: 16px !important;
|
|
19051
|
+
`;
|
|
18663
19052
|
|
|
18664
19053
|
/**
|
|
18665
19054
|
* @see https://mui.com/material-ui/react-toggle-button/
|
|
@@ -18679,13 +19068,27 @@ const SegmentedControl = (props) => {
|
|
|
18679
19068
|
onChangeProp(event, newActive);
|
|
18680
19069
|
}
|
|
18681
19070
|
};
|
|
18682
|
-
return (jsxRuntime.
|
|
18683
|
-
|
|
18684
|
-
|
|
18685
|
-
|
|
18686
|
-
|
|
18687
|
-
|
|
18688
|
-
|
|
19071
|
+
return (jsxRuntime.jsx(StyledSegmentedControl, __assign({ "aria-label": "Segmented Control", size: "small", value: value, exclusive: true, onChange: handleActive }, restProps, { children: buttonDefinition.map((button) => {
|
|
19072
|
+
const { icon, label, shouldShowTooltip = true, tooltipProps, tooltipText, value: buttonValue, disabled = false, } = button;
|
|
19073
|
+
if (tooltipText) {
|
|
19074
|
+
showWarningIfFirstOccurence(SDSWarningTypes.SegmentedControlTooltipTextDeprecated);
|
|
19075
|
+
}
|
|
19076
|
+
if (!icon && !label) {
|
|
19077
|
+
showWarningIfFirstOccurence(SDSWarningTypes.SegmentedControlMissingIconOrLabel);
|
|
19078
|
+
}
|
|
19079
|
+
if (icon && label) {
|
|
19080
|
+
showWarningIfFirstOccurence(SDSWarningTypes.SegmentedControlIconAndLabelConflict);
|
|
19081
|
+
}
|
|
19082
|
+
const iconItem = icon ? (typeof icon !== "string" ? (icon) : (jsxRuntime.jsx(Icon, { sdsIcon: icon, sdsSize: "s" }))) : null;
|
|
19083
|
+
const buttonContent = label ? (jsxRuntime.jsx(StyledToggleButtonLabel, { children: label })) : iconItem ? (jsxRuntime.jsx(StyledToggleButtonIcon, { children: iconItem })) : (jsxRuntime.jsx(StyledToggleButtonLabel, { children: buttonValue }));
|
|
19084
|
+
const toggleButton = (jsxRuntime.jsx(StyledToggleButton, { "aria-label": tooltipText ?? label ?? buttonValue, value: buttonValue, disabled: disabled, children: jsxRuntime.jsx("span", { tabIndex: -1, children: buttonContent }) }, buttonValue));
|
|
19085
|
+
// Resolve the tooltip title: tooltipText takes priority,
|
|
19086
|
+
// then tooltipProps.title, then label, then falls back to buttonValue.
|
|
19087
|
+
const resolvedTitle = tooltipText ?? tooltipProps?.title ?? label ?? buttonValue;
|
|
19088
|
+
// (masoudmanson): If the button is disabled or shouldShowTooltip
|
|
19089
|
+
// is false, we don't render the tooltip.
|
|
19090
|
+
return disabled || !shouldShowTooltip ? (toggleButton) : (React.createElement(Tooltip, __assign({ arrow: true }, tooltipProps, { title: resolvedTitle, key: buttonValue }), toggleButton));
|
|
19091
|
+
}) })));
|
|
18689
19092
|
};
|
|
18690
19093
|
|
|
18691
19094
|
const TabsContext = React.createContext({ sdsSize: "large" });
|
|
@@ -22590,6 +22993,7 @@ exports.NavigationJumpTo = NavigationJumpTo;
|
|
|
22590
22993
|
exports.Notification = Notification;
|
|
22591
22994
|
exports.Pagination = Pagination;
|
|
22592
22995
|
exports.Panel = Panel;
|
|
22996
|
+
exports.Popover = Popover;
|
|
22593
22997
|
exports.PreComposedTable = PreComposedTable;
|
|
22594
22998
|
exports.RowHoverContext = RowHoverContext;
|
|
22595
22999
|
exports.SDSChooseTheme = SDSChooseTheme;
|