@czi-sds/components 21.3.0 → 21.5.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 +4 -4
- package/dist/index.cjs.js +59 -41
- package/dist/index.esm.d.ts +4 -4
- package/dist/index.esm.js +59 -41
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/index.cjs.d.ts
CHANGED
|
@@ -447,7 +447,7 @@ interface IconNameToSizes {
|
|
|
447
447
|
BarChartHorizontal3: "xs" | "s";
|
|
448
448
|
BarChartVertical3: "xs" | "s";
|
|
449
449
|
BarChartVertical4: "xs" | "s";
|
|
450
|
-
Book: "l" | "xl";
|
|
450
|
+
Book: "xs" | "s" | "l" | "xl";
|
|
451
451
|
Check: "xs" | "s";
|
|
452
452
|
CheckCircle: "xs" | "s" | "l" | "xl";
|
|
453
453
|
ChevronDown: "xs" | "s" | "l" | "xl";
|
|
@@ -628,7 +628,7 @@ type MenuItemProps<IconName extends keyof IconNameToSmallSizes> = MenuItemExtraP
|
|
|
628
628
|
/**
|
|
629
629
|
* @see https://mui.com/material-ui/react-menu/
|
|
630
630
|
*/
|
|
631
|
-
declare const MenuItem: React.ForwardRefExoticComponent<Omit<MenuItemProps<"Bacteria" | "BarChartHorizontal3" | "BarChartVertical3" | "BarChartVertical4" | "Check" | "CheckCircle" | "ChevronDown" | "ChevronDown2" | "ChevronLeft2" | "ChevronLeft" | "ChevronRight2" | "ChevronRight" | "ChevronUp" | "ChevronUp2" | "CirclesOverlap2" | "Code" | "Copy" | "Cube" | "Document" | "DotsHorizontal" | "Download" | "Edit" | "Envelope" | "ExclamationMarkCircle" | "EyeClosed" | "EyeOpen" | "Filter" | "FlagCheck" | "FlagOutline" | "FlagQuestionMark" | "FlagXMark" | "Gear" | "Globe" | "House" | "InfoCircle" | "LifeRing" | "LightBulb" | "LinesDashed3Solid1" | "LinesHorizontal3" | "Link" | "List" | "Loading" | "Lock" | "LockCircle" | "Minus" | "Open" | "People" | "Percentage" | "Person" | "Pin" | "PinLocation" | "Plus" | "PlusCircle" | "PuzzlePiece" | "Refresh" | "RotateLeft" | "RotateRight" | "Scale" | "Search" | "SearchLinesHorizontal3" | "Starburst" | "Table" | "ThumbsDown" | "ThumbsUp" | "TrashCan" | "TreeHorizontal" | "TreeVertical" | "TriangleDown" | "TriangleLeft" | "TriangleRight" | "TriangleUp" | "XMark" | "XMarkCircle">, "ref"> & React.RefAttributes<HTMLLIElement | null>>;
|
|
631
|
+
declare const MenuItem: React.ForwardRefExoticComponent<Omit<MenuItemProps<"Bacteria" | "BarChartHorizontal3" | "BarChartVertical3" | "BarChartVertical4" | "Book" | "Check" | "CheckCircle" | "ChevronDown" | "ChevronDown2" | "ChevronLeft2" | "ChevronLeft" | "ChevronRight2" | "ChevronRight" | "ChevronUp" | "ChevronUp2" | "CirclesOverlap2" | "Code" | "Copy" | "Cube" | "Document" | "DotsHorizontal" | "Download" | "Edit" | "Envelope" | "ExclamationMarkCircle" | "EyeClosed" | "EyeOpen" | "Filter" | "FlagCheck" | "FlagOutline" | "FlagQuestionMark" | "FlagXMark" | "Gear" | "Globe" | "House" | "InfoCircle" | "LifeRing" | "LightBulb" | "LinesDashed3Solid1" | "LinesHorizontal3" | "Link" | "List" | "Loading" | "Lock" | "LockCircle" | "Minus" | "Open" | "People" | "Percentage" | "Person" | "Pin" | "PinLocation" | "Plus" | "PlusCircle" | "PuzzlePiece" | "Refresh" | "RotateLeft" | "RotateRight" | "Scale" | "Search" | "SearchLinesHorizontal3" | "Starburst" | "Table" | "ThumbsDown" | "ThumbsUp" | "TrashCan" | "TreeHorizontal" | "TreeVertical" | "TriangleDown" | "TriangleLeft" | "TriangleRight" | "TriangleUp" | "XMark" | "XMarkCircle">, "ref"> & React.RefAttributes<HTMLLIElement | null>>;
|
|
632
632
|
interface StyleProps extends CommonThemeProps {
|
|
633
633
|
count?: number;
|
|
634
634
|
icon?: ReactElement;
|
|
@@ -1365,17 +1365,17 @@ declare const Panel: React.ForwardRefExoticComponent<(Omit<BasicPanelProps, "ref
|
|
|
1365
1365
|
// one prop is array of objects: with icon name and tooltip text. They need to make
|
|
1366
1366
|
// first item in array first button, etc
|
|
1367
1367
|
interface SingleButtonDefinition {
|
|
1368
|
+
disabled?: boolean;
|
|
1368
1369
|
icon: keyof IconNameToSizes | React.ReactElement<CustomSVGProps>;
|
|
1369
1370
|
tooltipText?: string;
|
|
1370
1371
|
value: string;
|
|
1371
1372
|
}
|
|
1372
|
-
interface
|
|
1373
|
+
interface SegmentedControlProps extends ToggleButtonGroupProps {
|
|
1373
1374
|
buttonDefinition: SingleButtonDefinition[];
|
|
1374
1375
|
}
|
|
1375
1376
|
/**
|
|
1376
1377
|
* @see https://mui.com/material-ui/react-toggle-button/
|
|
1377
1378
|
*/
|
|
1378
|
-
type SegmentedControlProps = SegmentedControlExtraProps & ToggleButtonGroupProps;
|
|
1379
1379
|
declare const SegmentedControl: (props: SegmentedControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
1380
1380
|
interface SdsTableProps {
|
|
1381
1381
|
children: React.ReactNode;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1330,14 +1330,14 @@ var StyledSubtitle = styled("p")(templateObject_4$o || (templateObject_4$o = __m
|
|
|
1330
1330
|
});
|
|
1331
1331
|
var templateObject_1$V, templateObject_2$A, templateObject_3$s, templateObject_4$o;
|
|
1332
1332
|
|
|
1333
|
-
var _path$
|
|
1334
|
-
function _extends$
|
|
1333
|
+
var _path$2b, _path2$D, _path3$6;
|
|
1334
|
+
function _extends$2g() { _extends$2g = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2g.apply(this, arguments); }
|
|
1335
1335
|
var SvgIconBacteriaLarge = function SvgIconBacteriaLarge(props) {
|
|
1336
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
1336
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$2g({
|
|
1337
1337
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1338
1338
|
width: 24,
|
|
1339
1339
|
height: 24
|
|
1340
|
-
}, props), _path$
|
|
1340
|
+
}, props), _path$2b || (_path$2b = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1341
1341
|
fillRule: "evenodd",
|
|
1342
1342
|
d: "M12.205 14.698a1.956 1.956 0 1 1-3.911 0 1.956 1.956 0 0 1 3.911 0m-1.955.756a.756.756 0 1 0 0-1.512.756.756 0 0 0 0 1.512"
|
|
1343
1343
|
})), _path2$D || (_path2$D = /*#__PURE__*/React__namespace.createElement("path", {
|
|
@@ -1348,14 +1348,14 @@ var SvgIconBacteriaLarge = function SvgIconBacteriaLarge(props) {
|
|
|
1348
1348
|
})));
|
|
1349
1349
|
};
|
|
1350
1350
|
|
|
1351
|
-
var _path$
|
|
1352
|
-
function _extends$
|
|
1351
|
+
var _path$2a, _path2$C;
|
|
1352
|
+
function _extends$2f() { _extends$2f = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2f.apply(this, arguments); }
|
|
1353
1353
|
var SvgIconBacteriaSmall = function SvgIconBacteriaSmall(props) {
|
|
1354
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
1354
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$2f({
|
|
1355
1355
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1356
1356
|
width: 16,
|
|
1357
1357
|
height: 16
|
|
1358
|
-
}, props), _path$
|
|
1358
|
+
}, props), _path$2a || (_path$2a = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1359
1359
|
d: "M7.766 7.265a1.484 1.484 0 1 0-.001-2.968 1.484 1.484 0 0 0 .001 2.968m-1.725 4.287a1.478 1.478 0 1 0-.001-2.955 1.478 1.478 0 0 0 .001 2.955"
|
|
1360
1360
|
})), _path2$C || (_path2$C = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1361
1361
|
fillRule: "evenodd",
|
|
@@ -1363,54 +1363,68 @@ var SvgIconBacteriaSmall = function SvgIconBacteriaSmall(props) {
|
|
|
1363
1363
|
})));
|
|
1364
1364
|
};
|
|
1365
1365
|
|
|
1366
|
+
var _path$29;
|
|
1367
|
+
function _extends$2e() { _extends$2e = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2e.apply(this, arguments); }
|
|
1368
|
+
var SvgIconBarChartHorizontal3Small = function SvgIconBarChartHorizontal3Small(props) {
|
|
1369
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$2e({
|
|
1370
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1371
|
+
width: 16,
|
|
1372
|
+
height: 16
|
|
1373
|
+
}, props), _path$29 || (_path$29 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1374
|
+
fillRule: "evenodd",
|
|
1375
|
+
d: "M1.143 2.434c0-.63.512-1.143 1.143-1.143H9.6c.631 0 1.143.512 1.143 1.143v.857c0 .632-.512 1.143-1.143 1.143H2.286a1.143 1.143 0 0 1-1.143-1.143zm0 5.143c0-.63.512-1.143 1.143-1.143h11.428c.631 0 1.143.512 1.143 1.143v.857c0 .632-.511 1.143-1.143 1.143H2.286a1.143 1.143 0 0 1-1.143-1.143zm0 5.143c0-.63.512-1.143 1.143-1.143h3.2c.63 0 1.142.512 1.142 1.143v.857c0 .632-.511 1.143-1.143 1.143h-3.2a1.143 1.143 0 0 1-1.142-1.143z"
|
|
1376
|
+
})));
|
|
1377
|
+
};
|
|
1378
|
+
|
|
1366
1379
|
var _path$28;
|
|
1367
1380
|
function _extends$2d() { _extends$2d = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2d.apply(this, arguments); }
|
|
1368
|
-
var
|
|
1381
|
+
var SvgIconBarChartVertical3Small = function SvgIconBarChartVertical3Small(props) {
|
|
1369
1382
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$2d({
|
|
1370
1383
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1371
1384
|
width: 16,
|
|
1372
1385
|
height: 16
|
|
1373
1386
|
}, props), _path$28 || (_path$28 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1374
1387
|
fillRule: "evenodd",
|
|
1375
|
-
d: "M1.
|
|
1388
|
+
d: "M1.291 13.714V6.4c0-.631.512-1.143 1.143-1.143h.857c.632 0 1.143.512 1.143 1.143v7.314c0 .631-.511 1.143-1.143 1.143h-.857a1.143 1.143 0 0 1-1.143-1.143m5.143 0V2.286c0-.631.512-1.143 1.143-1.143h.857c.632 0 1.143.512 1.143 1.143v11.428c0 .631-.511 1.143-1.143 1.143h-.857a1.143 1.143 0 0 1-1.143-1.143m5.143 0v-3.2c0-.63.512-1.142 1.143-1.142h.857c.632 0 1.143.511 1.143 1.143v3.2c0 .63-.511 1.142-1.143 1.142h-.857a1.143 1.143 0 0 1-1.143-1.143"
|
|
1376
1389
|
})));
|
|
1377
1390
|
};
|
|
1378
1391
|
|
|
1379
1392
|
var _path$27;
|
|
1380
1393
|
function _extends$2c() { _extends$2c = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2c.apply(this, arguments); }
|
|
1381
|
-
var
|
|
1394
|
+
var SvgIconBarChartVertical4Small = function SvgIconBarChartVertical4Small(props) {
|
|
1382
1395
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$2c({
|
|
1383
1396
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1384
1397
|
width: 16,
|
|
1385
1398
|
height: 16
|
|
1386
1399
|
}, props), _path$27 || (_path$27 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1387
1400
|
fillRule: "evenodd",
|
|
1388
|
-
d: "
|
|
1401
|
+
d: "M6.412 3.094c.545 0 .987.442.987.987v9.96a.987.987 0 1 1-1.974 0v-9.96c0-.545.442-.987.987-.987m-3.14 2.549c.546 0 .988.442.988.987v7.399a.987.987 0 0 1-1.974 0v-7.4c0-.544.442-.986.987-.986Zm6.28-4.614c.545 0 .986.441.986.986V14.03a.987.987 0 1 1-1.973 0V2.015c0-.545.441-.986.987-.986m3.139 4.823c.545 0 .987.442.987.987v7.19a.987.987 0 0 1-1.974 0v-7.19c0-.545.442-.987.987-.987"
|
|
1389
1402
|
})));
|
|
1390
1403
|
};
|
|
1391
1404
|
|
|
1392
1405
|
var _path$26;
|
|
1393
1406
|
function _extends$2b() { _extends$2b = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2b.apply(this, arguments); }
|
|
1394
|
-
var
|
|
1407
|
+
var SvgIconBookLarge = function SvgIconBookLarge(props) {
|
|
1395
1408
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$2b({
|
|
1396
1409
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1397
|
-
width:
|
|
1398
|
-
height:
|
|
1410
|
+
width: 24,
|
|
1411
|
+
height: 24
|
|
1399
1412
|
}, props), _path$26 || (_path$26 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1400
|
-
|
|
1401
|
-
d: "M6.412 3.094c.545 0 .987.442.987.987v9.96a.987.987 0 1 1-1.974 0v-9.96c0-.545.442-.987.987-.987m-3.14 2.549c.546 0 .988.442.988.987v7.399a.987.987 0 0 1-1.974 0v-7.4c0-.544.442-.986.987-.986Zm6.28-4.614c.545 0 .986.441.986.986V14.03a.987.987 0 1 1-1.973 0V2.015c0-.545.441-.986.987-.986m3.139 4.823c.545 0 .987.442.987.987v7.19a.987.987 0 0 1-1.974 0v-7.19c0-.545.442-.987.987-.987"
|
|
1413
|
+
d: "M18.897 1.55H5.867a3.04 3.04 0 0 0-3.042 3.04v14.948a1 1 0 0 0 .025.122 3.04 3.04 0 0 0 3.016 2.798h13.03a2.28 2.28 0 0 0 2.281-2.28V3.83a2.28 2.28 0 0 0-2.28-2.28m.76 2.28v12.668H8.238V3.07h10.659a.76.76 0 0 1 .76.76m-13.79-.76h.85v13.428h-.85a3 3 0 0 0-1.521.423V4.591a1.52 1.52 0 0 1 1.52-1.521Zm13.03 17.868H5.867a1.462 1.462 0 1 1 0-2.92h13.79v2.16c0 .42-.34.76-.76.76M10.896 6.226c0-.42.34-.76.76-.76h4.583a.76.76 0 1 1 0 1.52h-4.583a.76.76 0 0 1-.76-.76"
|
|
1402
1414
|
})));
|
|
1403
1415
|
};
|
|
1404
1416
|
|
|
1405
1417
|
var _path$25;
|
|
1406
1418
|
function _extends$2a() { _extends$2a = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2a.apply(this, arguments); }
|
|
1407
|
-
var
|
|
1419
|
+
var SvgIconBookSmall = function SvgIconBookSmall(props) {
|
|
1408
1420
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$2a({
|
|
1409
1421
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1410
|
-
width:
|
|
1411
|
-
height:
|
|
1422
|
+
width: 16,
|
|
1423
|
+
height: 16
|
|
1412
1424
|
}, props), _path$25 || (_path$25 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1413
|
-
|
|
1425
|
+
fillRule: "evenodd",
|
|
1426
|
+
d: "M12.365.75h-8.73a2 2 0 0 0-2 2v10.5a2 2 0 0 0 2 2h8.73a2 2 0 0 0 1.825-1.18c.067-.15-.055-.305-.212-.353-.379-.113-.668-.428-.668-.866 0-.415.24-.69.566-.822.256-.103.489-.315.489-.59V2.75a2 2 0 0 0-2-2m-9.232 9.851a2.45 2.45 0 0 1 1.085-.255V2.251c-.288 0-.564.097-.767.269a.85.85 0 0 0-.318.648zm8.007-6.708h-3.7a.65.65 0 0 0 0 1.3h3.7a.65.65 0 1 0 0-1.3m1.29 8.058a1.028 1.028 0 0 0 0 1.8H4.033a.9.9 0 1 1 0-1.8z",
|
|
1427
|
+
clipRule: "evenodd"
|
|
1414
1428
|
})));
|
|
1415
1429
|
};
|
|
1416
1430
|
|
|
@@ -3592,7 +3606,7 @@ var iconMap = {
|
|
|
3592
3606
|
},
|
|
3593
3607
|
Book: {
|
|
3594
3608
|
largeIcon: SvgIconBookLarge,
|
|
3595
|
-
smallIcon:
|
|
3609
|
+
smallIcon: SvgIconBookSmall,
|
|
3596
3610
|
},
|
|
3597
3611
|
Check: {
|
|
3598
3612
|
largeIcon: null,
|
|
@@ -7865,36 +7879,40 @@ var doNotForwardProps$1 = ["buttonDefinition"];
|
|
|
7865
7879
|
var StyledSegmentedControl = styled(material.ToggleButtonGroup, {
|
|
7866
7880
|
shouldForwardProp: function (prop) { return !doNotForwardProps$1.includes(prop); },
|
|
7867
7881
|
})(templateObject_1$8 || (templateObject_1$8 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (props) {
|
|
7868
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
7882
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
7869
7883
|
var spaces = getSpaces(props);
|
|
7870
7884
|
var semanticColors = getSemanticColors(props);
|
|
7871
|
-
return "\n .".concat(material.toggleButtonClasses.root, ".").concat(material.toggleButtonClasses.
|
|
7885
|
+
return "\n .".concat(material.toggleButtonClasses.root, ".").concat(material.toggleButtonClasses.disabled, " {\n border-color: ").concat((_a = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _a === void 0 ? void 0 : _a.border, ";\n }\n\n .").concat(material.toggleButtonClasses.root, ".").concat(material.toggleButtonClasses.selected, " {\n background-color: ").concat((_b = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _b === void 0 ? void 0 : _b.fillOpen, ";\n color: ").concat((_c = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.accent) === null || _c === void 0 ? void 0 : _c.iconSelected, ";\n border-color: ").concat((_d = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _d === void 0 ? void 0 : _d.border, ";\n\n &:hover {\n background-color: ").concat((_e = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _e === void 0 ? void 0 : _e.fillHover, ";\n }\n }\n\n .").concat(material.toggleButtonClasses.root, " {\n ").concat(focusVisibleA11yStyle(props), "\n background-color: ").concat((_f = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _f === void 0 ? void 0 : _f.fillPrimary, ";\n border-color: ").concat((_g = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _g === void 0 ? void 0 : _g.border, ";\n line-height: 0px;\n color: ").concat((_h = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _h === void 0 ? void 0 : _h.iconSecondary, ";\n padding: ").concat(((_j = spaces === null || spaces === void 0 ? void 0 : spaces.xs) !== null && _j !== void 0 ? _j : 6) - 1, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n\n &:hover {\n border-color: ").concat((_k = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _k === void 0 ? void 0 : _k.border, ";\n background-color: ").concat((_l = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _l === void 0 ? void 0 : _l.fillHover, ";\n }\n }\n ");
|
|
7872
7886
|
});
|
|
7873
7887
|
var templateObject_1$8;
|
|
7874
7888
|
|
|
7889
|
+
/**
|
|
7890
|
+
* @see https://mui.com/material-ui/react-toggle-button/
|
|
7891
|
+
*/
|
|
7875
7892
|
var SegmentedControl = function (props) {
|
|
7876
7893
|
var _a;
|
|
7877
|
-
var buttonDefinition = props.buttonDefinition;
|
|
7878
|
-
var
|
|
7879
|
-
var _b = React.useState(
|
|
7894
|
+
var buttonDefinition = props.buttonDefinition, valueProp = props.value, onChangeProp = props.onChange, restProps = __rest(props, ["buttonDefinition", "value", "onChange"]);
|
|
7895
|
+
var initialValue = ((_a = buttonDefinition.find(function (button) { return !button.disabled; })) === null || _a === void 0 ? void 0 : _a.value) || null;
|
|
7896
|
+
var _b = React.useState(initialValue), active = _b[0], setActive = _b[1];
|
|
7897
|
+
// (masoudmanson): Add Controlled/Uncontrolled Component pattern
|
|
7898
|
+
var isControlled = valueProp !== undefined;
|
|
7899
|
+
var value = isControlled ? valueProp : active;
|
|
7880
7900
|
var handleActive = function (event, newActive) {
|
|
7881
7901
|
if (newActive !== null) {
|
|
7882
|
-
|
|
7902
|
+
if (!isControlled) {
|
|
7903
|
+
setActive(newActive);
|
|
7904
|
+
}
|
|
7905
|
+
if (onChangeProp) {
|
|
7906
|
+
onChangeProp(event, newActive);
|
|
7907
|
+
}
|
|
7883
7908
|
}
|
|
7884
7909
|
};
|
|
7885
|
-
return (jsxRuntime.jsxs(StyledSegmentedControl, __assign({ "aria-label": "Segmented Control", size: "small", value:
|
|
7886
|
-
var icon = button.icon, tooltipText = button.tooltipText, value = button.
|
|
7887
|
-
var iconItem =
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
}
|
|
7892
|
-
else {
|
|
7893
|
-
return jsxRuntime.jsx(Icon, { sdsIcon: icon, sdsSize: "s", sdsType: "button" });
|
|
7894
|
-
}
|
|
7895
|
-
}
|
|
7896
|
-
};
|
|
7897
|
-
return (jsxRuntime.jsx(Tooltip, { title: tooltipText !== null && tooltipText !== void 0 ? tooltipText : value, sdsStyle: "dark", arrow: true, children: jsxRuntime.jsx(material.ToggleButton, { "aria-label": tooltipText, value: value, children: jsxRuntime.jsx("span", { tabIndex: -1, children: iconItem() }) }) }, value));
|
|
7910
|
+
return (jsxRuntime.jsxs(StyledSegmentedControl, __assign({ "aria-label": "Segmented Control", size: "small", value: value, exclusive: true, onChange: handleActive }, restProps, { children: [buttonDefinition.map(function (button) {
|
|
7911
|
+
var icon = button.icon, tooltipText = button.tooltipText, buttonValue = button.value, _a = button.disabled, disabled = _a === void 0 ? false : _a;
|
|
7912
|
+
var iconItem = icon ? (typeof icon !== "string" ? (icon) : (jsxRuntime.jsx(Icon, { sdsIcon: icon, sdsSize: "s", sdsType: "button" }))) : null;
|
|
7913
|
+
var toggleButton = (jsxRuntime.jsx(material.ToggleButton, { "aria-label": tooltipText !== null && tooltipText !== void 0 ? tooltipText : buttonValue, value: buttonValue, disabled: disabled, children: jsxRuntime.jsx("span", { tabIndex: -1, children: iconItem }) }, buttonValue));
|
|
7914
|
+
// (masoudmanson): If the button is disabled, we don't want to show the tooltip.
|
|
7915
|
+
return disabled ? (toggleButton) : (jsxRuntime.jsx(Tooltip, { title: tooltipText !== null && tooltipText !== void 0 ? tooltipText : buttonValue, sdsStyle: "dark", arrow: true, children: toggleButton }, buttonValue));
|
|
7898
7916
|
}), ";"] })));
|
|
7899
7917
|
};
|
|
7900
7918
|
|
package/dist/index.esm.d.ts
CHANGED
|
@@ -447,7 +447,7 @@ interface IconNameToSizes {
|
|
|
447
447
|
BarChartHorizontal3: "xs" | "s";
|
|
448
448
|
BarChartVertical3: "xs" | "s";
|
|
449
449
|
BarChartVertical4: "xs" | "s";
|
|
450
|
-
Book: "l" | "xl";
|
|
450
|
+
Book: "xs" | "s" | "l" | "xl";
|
|
451
451
|
Check: "xs" | "s";
|
|
452
452
|
CheckCircle: "xs" | "s" | "l" | "xl";
|
|
453
453
|
ChevronDown: "xs" | "s" | "l" | "xl";
|
|
@@ -628,7 +628,7 @@ type MenuItemProps<IconName extends keyof IconNameToSmallSizes> = MenuItemExtraP
|
|
|
628
628
|
/**
|
|
629
629
|
* @see https://mui.com/material-ui/react-menu/
|
|
630
630
|
*/
|
|
631
|
-
declare const MenuItem: React.ForwardRefExoticComponent<Omit<MenuItemProps<"Bacteria" | "BarChartHorizontal3" | "BarChartVertical3" | "BarChartVertical4" | "Check" | "CheckCircle" | "ChevronDown" | "ChevronDown2" | "ChevronLeft2" | "ChevronLeft" | "ChevronRight2" | "ChevronRight" | "ChevronUp" | "ChevronUp2" | "CirclesOverlap2" | "Code" | "Copy" | "Cube" | "Document" | "DotsHorizontal" | "Download" | "Edit" | "Envelope" | "ExclamationMarkCircle" | "EyeClosed" | "EyeOpen" | "Filter" | "FlagCheck" | "FlagOutline" | "FlagQuestionMark" | "FlagXMark" | "Gear" | "Globe" | "House" | "InfoCircle" | "LifeRing" | "LightBulb" | "LinesDashed3Solid1" | "LinesHorizontal3" | "Link" | "List" | "Loading" | "Lock" | "LockCircle" | "Minus" | "Open" | "People" | "Percentage" | "Person" | "Pin" | "PinLocation" | "Plus" | "PlusCircle" | "PuzzlePiece" | "Refresh" | "RotateLeft" | "RotateRight" | "Scale" | "Search" | "SearchLinesHorizontal3" | "Starburst" | "Table" | "ThumbsDown" | "ThumbsUp" | "TrashCan" | "TreeHorizontal" | "TreeVertical" | "TriangleDown" | "TriangleLeft" | "TriangleRight" | "TriangleUp" | "XMark" | "XMarkCircle">, "ref"> & React.RefAttributes<HTMLLIElement | null>>;
|
|
631
|
+
declare const MenuItem: React.ForwardRefExoticComponent<Omit<MenuItemProps<"Bacteria" | "BarChartHorizontal3" | "BarChartVertical3" | "BarChartVertical4" | "Book" | "Check" | "CheckCircle" | "ChevronDown" | "ChevronDown2" | "ChevronLeft2" | "ChevronLeft" | "ChevronRight2" | "ChevronRight" | "ChevronUp" | "ChevronUp2" | "CirclesOverlap2" | "Code" | "Copy" | "Cube" | "Document" | "DotsHorizontal" | "Download" | "Edit" | "Envelope" | "ExclamationMarkCircle" | "EyeClosed" | "EyeOpen" | "Filter" | "FlagCheck" | "FlagOutline" | "FlagQuestionMark" | "FlagXMark" | "Gear" | "Globe" | "House" | "InfoCircle" | "LifeRing" | "LightBulb" | "LinesDashed3Solid1" | "LinesHorizontal3" | "Link" | "List" | "Loading" | "Lock" | "LockCircle" | "Minus" | "Open" | "People" | "Percentage" | "Person" | "Pin" | "PinLocation" | "Plus" | "PlusCircle" | "PuzzlePiece" | "Refresh" | "RotateLeft" | "RotateRight" | "Scale" | "Search" | "SearchLinesHorizontal3" | "Starburst" | "Table" | "ThumbsDown" | "ThumbsUp" | "TrashCan" | "TreeHorizontal" | "TreeVertical" | "TriangleDown" | "TriangleLeft" | "TriangleRight" | "TriangleUp" | "XMark" | "XMarkCircle">, "ref"> & React.RefAttributes<HTMLLIElement | null>>;
|
|
632
632
|
interface StyleProps extends CommonThemeProps {
|
|
633
633
|
count?: number;
|
|
634
634
|
icon?: ReactElement;
|
|
@@ -1365,17 +1365,17 @@ declare const Panel: React.ForwardRefExoticComponent<(Omit<BasicPanelProps, "ref
|
|
|
1365
1365
|
// one prop is array of objects: with icon name and tooltip text. They need to make
|
|
1366
1366
|
// first item in array first button, etc
|
|
1367
1367
|
interface SingleButtonDefinition {
|
|
1368
|
+
disabled?: boolean;
|
|
1368
1369
|
icon: keyof IconNameToSizes | React.ReactElement<CustomSVGProps>;
|
|
1369
1370
|
tooltipText?: string;
|
|
1370
1371
|
value: string;
|
|
1371
1372
|
}
|
|
1372
|
-
interface
|
|
1373
|
+
interface SegmentedControlProps extends ToggleButtonGroupProps {
|
|
1373
1374
|
buttonDefinition: SingleButtonDefinition[];
|
|
1374
1375
|
}
|
|
1375
1376
|
/**
|
|
1376
1377
|
* @see https://mui.com/material-ui/react-toggle-button/
|
|
1377
1378
|
*/
|
|
1378
|
-
type SegmentedControlProps = SegmentedControlExtraProps & ToggleButtonGroupProps;
|
|
1379
1379
|
declare const SegmentedControl: (props: SegmentedControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
1380
1380
|
interface SdsTableProps {
|
|
1381
1381
|
children: React.ReactNode;
|
package/dist/index.esm.js
CHANGED
|
@@ -1310,14 +1310,14 @@ var StyledSubtitle = styled("p")(templateObject_4$o || (templateObject_4$o = __m
|
|
|
1310
1310
|
});
|
|
1311
1311
|
var templateObject_1$V, templateObject_2$A, templateObject_3$s, templateObject_4$o;
|
|
1312
1312
|
|
|
1313
|
-
var _path$
|
|
1314
|
-
function _extends$
|
|
1313
|
+
var _path$2b, _path2$D, _path3$6;
|
|
1314
|
+
function _extends$2g() { _extends$2g = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2g.apply(this, arguments); }
|
|
1315
1315
|
var SvgIconBacteriaLarge = function SvgIconBacteriaLarge(props) {
|
|
1316
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
1316
|
+
return /*#__PURE__*/React.createElement("svg", _extends$2g({
|
|
1317
1317
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1318
1318
|
width: 24,
|
|
1319
1319
|
height: 24
|
|
1320
|
-
}, props), _path$
|
|
1320
|
+
}, props), _path$2b || (_path$2b = /*#__PURE__*/React.createElement("path", {
|
|
1321
1321
|
fillRule: "evenodd",
|
|
1322
1322
|
d: "M12.205 14.698a1.956 1.956 0 1 1-3.911 0 1.956 1.956 0 0 1 3.911 0m-1.955.756a.756.756 0 1 0 0-1.512.756.756 0 0 0 0 1.512"
|
|
1323
1323
|
})), _path2$D || (_path2$D = /*#__PURE__*/React.createElement("path", {
|
|
@@ -1328,14 +1328,14 @@ var SvgIconBacteriaLarge = function SvgIconBacteriaLarge(props) {
|
|
|
1328
1328
|
})));
|
|
1329
1329
|
};
|
|
1330
1330
|
|
|
1331
|
-
var _path$
|
|
1332
|
-
function _extends$
|
|
1331
|
+
var _path$2a, _path2$C;
|
|
1332
|
+
function _extends$2f() { _extends$2f = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2f.apply(this, arguments); }
|
|
1333
1333
|
var SvgIconBacteriaSmall = function SvgIconBacteriaSmall(props) {
|
|
1334
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
1334
|
+
return /*#__PURE__*/React.createElement("svg", _extends$2f({
|
|
1335
1335
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1336
1336
|
width: 16,
|
|
1337
1337
|
height: 16
|
|
1338
|
-
}, props), _path$
|
|
1338
|
+
}, props), _path$2a || (_path$2a = /*#__PURE__*/React.createElement("path", {
|
|
1339
1339
|
d: "M7.766 7.265a1.484 1.484 0 1 0-.001-2.968 1.484 1.484 0 0 0 .001 2.968m-1.725 4.287a1.478 1.478 0 1 0-.001-2.955 1.478 1.478 0 0 0 .001 2.955"
|
|
1340
1340
|
})), _path2$C || (_path2$C = /*#__PURE__*/React.createElement("path", {
|
|
1341
1341
|
fillRule: "evenodd",
|
|
@@ -1343,54 +1343,68 @@ var SvgIconBacteriaSmall = function SvgIconBacteriaSmall(props) {
|
|
|
1343
1343
|
})));
|
|
1344
1344
|
};
|
|
1345
1345
|
|
|
1346
|
+
var _path$29;
|
|
1347
|
+
function _extends$2e() { _extends$2e = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2e.apply(this, arguments); }
|
|
1348
|
+
var SvgIconBarChartHorizontal3Small = function SvgIconBarChartHorizontal3Small(props) {
|
|
1349
|
+
return /*#__PURE__*/React.createElement("svg", _extends$2e({
|
|
1350
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1351
|
+
width: 16,
|
|
1352
|
+
height: 16
|
|
1353
|
+
}, props), _path$29 || (_path$29 = /*#__PURE__*/React.createElement("path", {
|
|
1354
|
+
fillRule: "evenodd",
|
|
1355
|
+
d: "M1.143 2.434c0-.63.512-1.143 1.143-1.143H9.6c.631 0 1.143.512 1.143 1.143v.857c0 .632-.512 1.143-1.143 1.143H2.286a1.143 1.143 0 0 1-1.143-1.143zm0 5.143c0-.63.512-1.143 1.143-1.143h11.428c.631 0 1.143.512 1.143 1.143v.857c0 .632-.511 1.143-1.143 1.143H2.286a1.143 1.143 0 0 1-1.143-1.143zm0 5.143c0-.63.512-1.143 1.143-1.143h3.2c.63 0 1.142.512 1.142 1.143v.857c0 .632-.511 1.143-1.143 1.143h-3.2a1.143 1.143 0 0 1-1.142-1.143z"
|
|
1356
|
+
})));
|
|
1357
|
+
};
|
|
1358
|
+
|
|
1346
1359
|
var _path$28;
|
|
1347
1360
|
function _extends$2d() { _extends$2d = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2d.apply(this, arguments); }
|
|
1348
|
-
var
|
|
1361
|
+
var SvgIconBarChartVertical3Small = function SvgIconBarChartVertical3Small(props) {
|
|
1349
1362
|
return /*#__PURE__*/React.createElement("svg", _extends$2d({
|
|
1350
1363
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1351
1364
|
width: 16,
|
|
1352
1365
|
height: 16
|
|
1353
1366
|
}, props), _path$28 || (_path$28 = /*#__PURE__*/React.createElement("path", {
|
|
1354
1367
|
fillRule: "evenodd",
|
|
1355
|
-
d: "M1.
|
|
1368
|
+
d: "M1.291 13.714V6.4c0-.631.512-1.143 1.143-1.143h.857c.632 0 1.143.512 1.143 1.143v7.314c0 .631-.511 1.143-1.143 1.143h-.857a1.143 1.143 0 0 1-1.143-1.143m5.143 0V2.286c0-.631.512-1.143 1.143-1.143h.857c.632 0 1.143.512 1.143 1.143v11.428c0 .631-.511 1.143-1.143 1.143h-.857a1.143 1.143 0 0 1-1.143-1.143m5.143 0v-3.2c0-.63.512-1.142 1.143-1.142h.857c.632 0 1.143.511 1.143 1.143v3.2c0 .63-.511 1.142-1.143 1.142h-.857a1.143 1.143 0 0 1-1.143-1.143"
|
|
1356
1369
|
})));
|
|
1357
1370
|
};
|
|
1358
1371
|
|
|
1359
1372
|
var _path$27;
|
|
1360
1373
|
function _extends$2c() { _extends$2c = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2c.apply(this, arguments); }
|
|
1361
|
-
var
|
|
1374
|
+
var SvgIconBarChartVertical4Small = function SvgIconBarChartVertical4Small(props) {
|
|
1362
1375
|
return /*#__PURE__*/React.createElement("svg", _extends$2c({
|
|
1363
1376
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1364
1377
|
width: 16,
|
|
1365
1378
|
height: 16
|
|
1366
1379
|
}, props), _path$27 || (_path$27 = /*#__PURE__*/React.createElement("path", {
|
|
1367
1380
|
fillRule: "evenodd",
|
|
1368
|
-
d: "
|
|
1381
|
+
d: "M6.412 3.094c.545 0 .987.442.987.987v9.96a.987.987 0 1 1-1.974 0v-9.96c0-.545.442-.987.987-.987m-3.14 2.549c.546 0 .988.442.988.987v7.399a.987.987 0 0 1-1.974 0v-7.4c0-.544.442-.986.987-.986Zm6.28-4.614c.545 0 .986.441.986.986V14.03a.987.987 0 1 1-1.973 0V2.015c0-.545.441-.986.987-.986m3.139 4.823c.545 0 .987.442.987.987v7.19a.987.987 0 0 1-1.974 0v-7.19c0-.545.442-.987.987-.987"
|
|
1369
1382
|
})));
|
|
1370
1383
|
};
|
|
1371
1384
|
|
|
1372
1385
|
var _path$26;
|
|
1373
1386
|
function _extends$2b() { _extends$2b = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2b.apply(this, arguments); }
|
|
1374
|
-
var
|
|
1387
|
+
var SvgIconBookLarge = function SvgIconBookLarge(props) {
|
|
1375
1388
|
return /*#__PURE__*/React.createElement("svg", _extends$2b({
|
|
1376
1389
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1377
|
-
width:
|
|
1378
|
-
height:
|
|
1390
|
+
width: 24,
|
|
1391
|
+
height: 24
|
|
1379
1392
|
}, props), _path$26 || (_path$26 = /*#__PURE__*/React.createElement("path", {
|
|
1380
|
-
|
|
1381
|
-
d: "M6.412 3.094c.545 0 .987.442.987.987v9.96a.987.987 0 1 1-1.974 0v-9.96c0-.545.442-.987.987-.987m-3.14 2.549c.546 0 .988.442.988.987v7.399a.987.987 0 0 1-1.974 0v-7.4c0-.544.442-.986.987-.986Zm6.28-4.614c.545 0 .986.441.986.986V14.03a.987.987 0 1 1-1.973 0V2.015c0-.545.441-.986.987-.986m3.139 4.823c.545 0 .987.442.987.987v7.19a.987.987 0 0 1-1.974 0v-7.19c0-.545.442-.987.987-.987"
|
|
1393
|
+
d: "M18.897 1.55H5.867a3.04 3.04 0 0 0-3.042 3.04v14.948a1 1 0 0 0 .025.122 3.04 3.04 0 0 0 3.016 2.798h13.03a2.28 2.28 0 0 0 2.281-2.28V3.83a2.28 2.28 0 0 0-2.28-2.28m.76 2.28v12.668H8.238V3.07h10.659a.76.76 0 0 1 .76.76m-13.79-.76h.85v13.428h-.85a3 3 0 0 0-1.521.423V4.591a1.52 1.52 0 0 1 1.52-1.521Zm13.03 17.868H5.867a1.462 1.462 0 1 1 0-2.92h13.79v2.16c0 .42-.34.76-.76.76M10.896 6.226c0-.42.34-.76.76-.76h4.583a.76.76 0 1 1 0 1.52h-4.583a.76.76 0 0 1-.76-.76"
|
|
1382
1394
|
})));
|
|
1383
1395
|
};
|
|
1384
1396
|
|
|
1385
1397
|
var _path$25;
|
|
1386
1398
|
function _extends$2a() { _extends$2a = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2a.apply(this, arguments); }
|
|
1387
|
-
var
|
|
1399
|
+
var SvgIconBookSmall = function SvgIconBookSmall(props) {
|
|
1388
1400
|
return /*#__PURE__*/React.createElement("svg", _extends$2a({
|
|
1389
1401
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1390
|
-
width:
|
|
1391
|
-
height:
|
|
1402
|
+
width: 16,
|
|
1403
|
+
height: 16
|
|
1392
1404
|
}, props), _path$25 || (_path$25 = /*#__PURE__*/React.createElement("path", {
|
|
1393
|
-
|
|
1405
|
+
fillRule: "evenodd",
|
|
1406
|
+
d: "M12.365.75h-8.73a2 2 0 0 0-2 2v10.5a2 2 0 0 0 2 2h8.73a2 2 0 0 0 1.825-1.18c.067-.15-.055-.305-.212-.353-.379-.113-.668-.428-.668-.866 0-.415.24-.69.566-.822.256-.103.489-.315.489-.59V2.75a2 2 0 0 0-2-2m-9.232 9.851a2.45 2.45 0 0 1 1.085-.255V2.251c-.288 0-.564.097-.767.269a.85.85 0 0 0-.318.648zm8.007-6.708h-3.7a.65.65 0 0 0 0 1.3h3.7a.65.65 0 1 0 0-1.3m1.29 8.058a1.028 1.028 0 0 0 0 1.8H4.033a.9.9 0 1 1 0-1.8z",
|
|
1407
|
+
clipRule: "evenodd"
|
|
1394
1408
|
})));
|
|
1395
1409
|
};
|
|
1396
1410
|
|
|
@@ -3572,7 +3586,7 @@ var iconMap = {
|
|
|
3572
3586
|
},
|
|
3573
3587
|
Book: {
|
|
3574
3588
|
largeIcon: SvgIconBookLarge,
|
|
3575
|
-
smallIcon:
|
|
3589
|
+
smallIcon: SvgIconBookSmall,
|
|
3576
3590
|
},
|
|
3577
3591
|
Check: {
|
|
3578
3592
|
largeIcon: null,
|
|
@@ -7845,36 +7859,40 @@ var doNotForwardProps$1 = ["buttonDefinition"];
|
|
|
7845
7859
|
var StyledSegmentedControl = styled(ToggleButtonGroup, {
|
|
7846
7860
|
shouldForwardProp: function (prop) { return !doNotForwardProps$1.includes(prop); },
|
|
7847
7861
|
})(templateObject_1$8 || (templateObject_1$8 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (props) {
|
|
7848
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
7862
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
7849
7863
|
var spaces = getSpaces(props);
|
|
7850
7864
|
var semanticColors = getSemanticColors(props);
|
|
7851
|
-
return "\n .".concat(toggleButtonClasses.root, ".").concat(toggleButtonClasses.
|
|
7865
|
+
return "\n .".concat(toggleButtonClasses.root, ".").concat(toggleButtonClasses.disabled, " {\n border-color: ").concat((_a = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _a === void 0 ? void 0 : _a.border, ";\n }\n\n .").concat(toggleButtonClasses.root, ".").concat(toggleButtonClasses.selected, " {\n background-color: ").concat((_b = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _b === void 0 ? void 0 : _b.fillOpen, ";\n color: ").concat((_c = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.accent) === null || _c === void 0 ? void 0 : _c.iconSelected, ";\n border-color: ").concat((_d = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _d === void 0 ? void 0 : _d.border, ";\n\n &:hover {\n background-color: ").concat((_e = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _e === void 0 ? void 0 : _e.fillHover, ";\n }\n }\n\n .").concat(toggleButtonClasses.root, " {\n ").concat(focusVisibleA11yStyle(props), "\n background-color: ").concat((_f = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _f === void 0 ? void 0 : _f.fillPrimary, ";\n border-color: ").concat((_g = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _g === void 0 ? void 0 : _g.border, ";\n line-height: 0px;\n color: ").concat((_h = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _h === void 0 ? void 0 : _h.iconSecondary, ";\n padding: ").concat(((_j = spaces === null || spaces === void 0 ? void 0 : spaces.xs) !== null && _j !== void 0 ? _j : 6) - 1, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n\n &:hover {\n border-color: ").concat((_k = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _k === void 0 ? void 0 : _k.border, ";\n background-color: ").concat((_l = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _l === void 0 ? void 0 : _l.fillHover, ";\n }\n }\n ");
|
|
7852
7866
|
});
|
|
7853
7867
|
var templateObject_1$8;
|
|
7854
7868
|
|
|
7869
|
+
/**
|
|
7870
|
+
* @see https://mui.com/material-ui/react-toggle-button/
|
|
7871
|
+
*/
|
|
7855
7872
|
var SegmentedControl = function (props) {
|
|
7856
7873
|
var _a;
|
|
7857
|
-
var buttonDefinition = props.buttonDefinition;
|
|
7858
|
-
var
|
|
7859
|
-
var _b = React__default.useState(
|
|
7874
|
+
var buttonDefinition = props.buttonDefinition, valueProp = props.value, onChangeProp = props.onChange, restProps = __rest(props, ["buttonDefinition", "value", "onChange"]);
|
|
7875
|
+
var initialValue = ((_a = buttonDefinition.find(function (button) { return !button.disabled; })) === null || _a === void 0 ? void 0 : _a.value) || null;
|
|
7876
|
+
var _b = React__default.useState(initialValue), active = _b[0], setActive = _b[1];
|
|
7877
|
+
// (masoudmanson): Add Controlled/Uncontrolled Component pattern
|
|
7878
|
+
var isControlled = valueProp !== undefined;
|
|
7879
|
+
var value = isControlled ? valueProp : active;
|
|
7860
7880
|
var handleActive = function (event, newActive) {
|
|
7861
7881
|
if (newActive !== null) {
|
|
7862
|
-
|
|
7882
|
+
if (!isControlled) {
|
|
7883
|
+
setActive(newActive);
|
|
7884
|
+
}
|
|
7885
|
+
if (onChangeProp) {
|
|
7886
|
+
onChangeProp(event, newActive);
|
|
7887
|
+
}
|
|
7863
7888
|
}
|
|
7864
7889
|
};
|
|
7865
|
-
return (jsxs(StyledSegmentedControl, __assign({ "aria-label": "Segmented Control", size: "small", value:
|
|
7866
|
-
var icon = button.icon, tooltipText = button.tooltipText, value = button.
|
|
7867
|
-
var iconItem =
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
}
|
|
7872
|
-
else {
|
|
7873
|
-
return jsx(Icon, { sdsIcon: icon, sdsSize: "s", sdsType: "button" });
|
|
7874
|
-
}
|
|
7875
|
-
}
|
|
7876
|
-
};
|
|
7877
|
-
return (jsx(Tooltip, { title: tooltipText !== null && tooltipText !== void 0 ? tooltipText : value, sdsStyle: "dark", arrow: true, children: jsx(ToggleButton, { "aria-label": tooltipText, value: value, children: jsx("span", { tabIndex: -1, children: iconItem() }) }) }, value));
|
|
7890
|
+
return (jsxs(StyledSegmentedControl, __assign({ "aria-label": "Segmented Control", size: "small", value: value, exclusive: true, onChange: handleActive }, restProps, { children: [buttonDefinition.map(function (button) {
|
|
7891
|
+
var icon = button.icon, tooltipText = button.tooltipText, buttonValue = button.value, _a = button.disabled, disabled = _a === void 0 ? false : _a;
|
|
7892
|
+
var iconItem = icon ? (typeof icon !== "string" ? (icon) : (jsx(Icon, { sdsIcon: icon, sdsSize: "s", sdsType: "button" }))) : null;
|
|
7893
|
+
var toggleButton = (jsx(ToggleButton, { "aria-label": tooltipText !== null && tooltipText !== void 0 ? tooltipText : buttonValue, value: buttonValue, disabled: disabled, children: jsx("span", { tabIndex: -1, children: iconItem }) }, buttonValue));
|
|
7894
|
+
// (masoudmanson): If the button is disabled, we don't want to show the tooltip.
|
|
7895
|
+
return disabled ? (toggleButton) : (jsx(Tooltip, { title: tooltipText !== null && tooltipText !== void 0 ? tooltipText : buttonValue, sdsStyle: "dark", arrow: true, children: toggleButton }, buttonValue));
|
|
7878
7896
|
}), ";"] })));
|
|
7879
7897
|
};
|
|
7880
7898
|
|