@spscommerce/ds-react 5.22.0 → 5.23.2
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/lib/index.es.js
CHANGED
|
@@ -277,7 +277,7 @@ function contentOf(nodeOrRenderFn2) {
|
|
|
277
277
|
const propsDoc$1I = __spreadProps(__spreadValues({}, spsFormProps), {
|
|
278
278
|
controlsDisabled: "boolean",
|
|
279
279
|
footerLinks: "ReactNodeOrRenderFn",
|
|
280
|
-
formMeta: "
|
|
280
|
+
formMeta: "SpsFormSetMeta<any>",
|
|
281
281
|
isOpen: "boolean",
|
|
282
282
|
onClear: "() => void",
|
|
283
283
|
onSubmit: "React.FormEventHandler"
|
|
@@ -287,10 +287,7 @@ const propTypes$1M = __spreadProps(__spreadValues(__spreadValues({}, spsGlobalPr
|
|
|
287
287
|
footerLinks: nodeOrRenderFn,
|
|
288
288
|
formArray: impl(),
|
|
289
289
|
formGroup: impl(),
|
|
290
|
-
formMeta:
|
|
291
|
-
impl(),
|
|
292
|
-
impl()
|
|
293
|
-
]),
|
|
290
|
+
formMeta: impl(),
|
|
294
291
|
isOpen: propTypes$1O.exports.bool,
|
|
295
292
|
onClear: fun(),
|
|
296
293
|
onSubmit: fun()
|
|
@@ -1818,6 +1815,7 @@ const propTypes$1K = __spreadProps(__spreadValues(__spreadValues(__spreadValues(
|
|
|
1818
1815
|
async function updateOptions(props2, searchState, searchStatePatch, setOptionList, setAnyOptionHasIcon, promiseRef) {
|
|
1819
1816
|
const options = typeof props2.options === "function" ? props2.options(searchState.value) : props2.options || [];
|
|
1820
1817
|
const areOptionsPromise = options instanceof Promise;
|
|
1818
|
+
const removeSpecialSymbols = (value) => value.replace(/([.?*+^$[\]\\(){}|-])/g, "");
|
|
1821
1819
|
searchStatePatch({ pending: areOptionsPromise });
|
|
1822
1820
|
promiseRef.current = areOptionsPromise ? options : null;
|
|
1823
1821
|
const result = areOptionsPromise ? await options || [] : options || [];
|
|
@@ -1835,13 +1833,15 @@ async function updateOptions(props2, searchState, searchStatePatch, setOptionLis
|
|
|
1835
1833
|
newOpts.unshift(new SpsOptionListOption(null, { text: props2.nullOption }));
|
|
1836
1834
|
}
|
|
1837
1835
|
if (searchState.value) {
|
|
1838
|
-
|
|
1836
|
+
const searchValue = removeSpecialSymbols(searchState.value);
|
|
1837
|
+
searchStatePatch({ replacementPattern: new RegExp(searchValue, "ig") });
|
|
1839
1838
|
newOpts = newOpts.filter((o) => {
|
|
1840
|
-
const regEx = new RegExp(
|
|
1839
|
+
const regEx = new RegExp(searchValue, "i");
|
|
1840
|
+
const optionText = removeSpecialSymbols(o.text);
|
|
1841
1841
|
if (props2.filterByTextAndCaptionKey) {
|
|
1842
|
-
return regEx.test(
|
|
1842
|
+
return regEx.test(optionText) || regEx.test(removeSpecialSymbols(o.caption));
|
|
1843
1843
|
}
|
|
1844
|
-
return regEx.test(
|
|
1844
|
+
return regEx.test(optionText);
|
|
1845
1845
|
});
|
|
1846
1846
|
} else {
|
|
1847
1847
|
searchStatePatch({ replacementPattern: null });
|
|
@@ -25337,36 +25337,36 @@ const SpsInsightTileExamples = {
|
|
|
25337
25337
|
kind={SpsInsightTileKind.GENERAL}
|
|
25338
25338
|
metric="1234"
|
|
25339
25339
|
title="Insight Tile Title"
|
|
25340
|
-
partnerCount=
|
|
25341
|
-
totalPartners=
|
|
25340
|
+
partnerCount={250}
|
|
25341
|
+
totalPartners={250}
|
|
25342
25342
|
/>
|
|
25343
25343
|
<SpsInsightTile
|
|
25344
25344
|
kind={SpsInsightTileKind.PROCESSING}
|
|
25345
25345
|
metric="1234"
|
|
25346
25346
|
title="Insight Tile Title"
|
|
25347
|
-
partnerCount=
|
|
25348
|
-
totalPartners=
|
|
25347
|
+
partnerCount={122}
|
|
25348
|
+
totalPartners={250}
|
|
25349
25349
|
/>
|
|
25350
25350
|
<SpsInsightTile
|
|
25351
25351
|
kind={SpsInsightTileKind.SUCCESS}
|
|
25352
25352
|
metric="1234"
|
|
25353
25353
|
title="Insight Tile Title"
|
|
25354
|
-
partnerCount=
|
|
25355
|
-
totalPartners=
|
|
25354
|
+
partnerCount={207}
|
|
25355
|
+
totalPartners={250}
|
|
25356
25356
|
/>
|
|
25357
25357
|
<SpsInsightTile
|
|
25358
25358
|
kind={SpsInsightTileKind.WARNING}
|
|
25359
25359
|
metric="1234"
|
|
25360
25360
|
title="Insight Tile Title"
|
|
25361
|
-
partnerCount=
|
|
25362
|
-
totalPartners=
|
|
25361
|
+
partnerCount={12}
|
|
25362
|
+
totalPartners={250}
|
|
25363
25363
|
/>
|
|
25364
25364
|
<SpsInsightTile
|
|
25365
25365
|
kind={SpsInsightTileKind.ERROR}
|
|
25366
25366
|
metric="1234"
|
|
25367
25367
|
title="Insight Tile Title"
|
|
25368
|
-
partnerCount=
|
|
25369
|
-
totalPartners=
|
|
25368
|
+
partnerCount={94}
|
|
25369
|
+
totalPartners={250}
|
|
25370
25370
|
/>
|
|
25371
25371
|
</SpsInsights>
|
|
25372
25372
|
`
|
|
@@ -25453,8 +25453,8 @@ const SpsInsightTileExamples = {
|
|
|
25453
25453
|
kind={SpsInsightTileKind.GENERAL}
|
|
25454
25454
|
metric="1234"
|
|
25455
25455
|
title="Insight Tile Title"
|
|
25456
|
-
partnerCount=
|
|
25457
|
-
totalPartners=
|
|
25456
|
+
partnerCount={100}
|
|
25457
|
+
totalPartners={200}
|
|
25458
25458
|
horizontal
|
|
25459
25459
|
>
|
|
25460
25460
|
<span className="gray600 font-weight-bold">Detail:</span> 792 units
|
|
@@ -25463,16 +25463,16 @@ const SpsInsightTileExamples = {
|
|
|
25463
25463
|
kind={SpsInsightTileKind.PROCESSING}
|
|
25464
25464
|
metric="1234"
|
|
25465
25465
|
title="Insight Tile Title"
|
|
25466
|
-
partnerCount=
|
|
25467
|
-
totalPartners=
|
|
25466
|
+
partnerCount={100}
|
|
25467
|
+
totalPartners={200}
|
|
25468
25468
|
horizontal
|
|
25469
25469
|
/>
|
|
25470
25470
|
<SpsInsightTile
|
|
25471
25471
|
kind={SpsInsightTileKind.SUCCESS}
|
|
25472
25472
|
metric="1234"
|
|
25473
25473
|
title="Insight Tile Title"
|
|
25474
|
-
partnerCount=
|
|
25475
|
-
totalPartners=
|
|
25474
|
+
partnerCount={100}
|
|
25475
|
+
totalPartners={200}
|
|
25476
25476
|
horizontal
|
|
25477
25477
|
>
|
|
25478
25478
|
<span className="gray600 font-weight-bold">Detail:</span> 792 units
|
|
@@ -25481,16 +25481,16 @@ const SpsInsightTileExamples = {
|
|
|
25481
25481
|
kind={SpsInsightTileKind.WARNING}
|
|
25482
25482
|
metric="1234"
|
|
25483
25483
|
title="Insight Tile Title"
|
|
25484
|
-
partnerCount=
|
|
25485
|
-
totalPartners=
|
|
25484
|
+
partnerCount={100}
|
|
25485
|
+
totalPartners={200}
|
|
25486
25486
|
horizontal
|
|
25487
25487
|
/>
|
|
25488
25488
|
<SpsInsightTile
|
|
25489
25489
|
kind={SpsInsightTileKind.ERROR}
|
|
25490
25490
|
metric="1234"
|
|
25491
25491
|
title="Insight Tile Title"
|
|
25492
|
-
partnerCount=
|
|
25493
|
-
totalPartners=
|
|
25492
|
+
partnerCount={100}
|
|
25493
|
+
totalPartners={200}
|
|
25494
25494
|
horizontal
|
|
25495
25495
|
>
|
|
25496
25496
|
<span className="gray600 font-weight-bold">Detail:</span> 792 units
|
|
@@ -26166,6 +26166,8 @@ const usePinnedTableBackgroundStyle = (containerRef) => {
|
|
|
26166
26166
|
React.useLayoutEffect(() => {
|
|
26167
26167
|
if (containerRef.current) {
|
|
26168
26168
|
const pinnedThs = containerRef.current.querySelectorAll("table > thead > tr:first-child > .sps-table__cell--pinned");
|
|
26169
|
+
const verticalScrollbarWidth = containerRef.current.offsetWidth - containerRef.current.clientWidth;
|
|
26170
|
+
const horizontalScrollbarHeight = containerRef.current.offsetHeight - containerRef.current.clientHeight;
|
|
26169
26171
|
if (pinnedThs.length > 0) {
|
|
26170
26172
|
const leftPinnedThs = [];
|
|
26171
26173
|
const rightPinnedThs = [];
|
|
@@ -26187,12 +26189,18 @@ const usePinnedTableBackgroundStyle = (containerRef) => {
|
|
|
26187
26189
|
});
|
|
26188
26190
|
const leftPinnedWidth = leftPinnedThs.reduce((acc, th) => acc + th.clientWidth, 0);
|
|
26189
26191
|
const rightPinnedWidth = rightPinnedThs.reduce((acc, th) => acc + th.clientWidth, 0);
|
|
26190
|
-
containerRef.current.style.backgroundPosition = `${leftPinnedWidth}px 0,
|
|
26192
|
+
containerRef.current.style.backgroundPosition = `${leftPinnedWidth}px 0,
|
|
26193
|
+
calc(100% - ${rightPinnedWidth}px) 0,
|
|
26194
|
+
${leftPinnedWidth}px ${-horizontalScrollbarHeight}px,
|
|
26195
|
+
calc(100% - ${rightPinnedWidth + verticalScrollbarWidth}px) ${-horizontalScrollbarHeight}px`;
|
|
26196
|
+
} else {
|
|
26197
|
+
containerRef.current.style.backgroundPosition = `0 0, 100% 0, 0 ${-horizontalScrollbarHeight}px,
|
|
26198
|
+
calc(100% - ${verticalScrollbarWidth}px) ${-horizontalScrollbarHeight}px`;
|
|
26191
26199
|
}
|
|
26192
26200
|
}
|
|
26193
26201
|
});
|
|
26194
26202
|
};
|
|
26195
|
-
const usePinnedTableHeadStyle = (containerRef) => {
|
|
26203
|
+
const usePinnedTableHeadStyle = (containerRef, maxHeight) => {
|
|
26196
26204
|
React.useLayoutEffect(() => {
|
|
26197
26205
|
const container = containerRef.current;
|
|
26198
26206
|
const headElement = container == null ? void 0 : container.querySelector("thead");
|
|
@@ -26205,8 +26213,8 @@ const usePinnedTableHeadStyle = (containerRef) => {
|
|
|
26205
26213
|
let scrollableParent = null;
|
|
26206
26214
|
const resetAppliedStyles = () => {
|
|
26207
26215
|
if (headElement) {
|
|
26208
|
-
headElement.style.position = null;
|
|
26209
|
-
headElement.style.top = null;
|
|
26216
|
+
headElement.style.position = maxHeight ? "sticky" : null;
|
|
26217
|
+
headElement.style.top = maxHeight ? "0" : null;
|
|
26210
26218
|
headElement.style.overflow = null;
|
|
26211
26219
|
headElement.style.maxWidth = null;
|
|
26212
26220
|
headElement.style.width = null;
|
|
@@ -26244,7 +26252,8 @@ const usePinnedTableHeadStyle = (containerRef) => {
|
|
|
26244
26252
|
headElement.style.position = "fixed";
|
|
26245
26253
|
headElement.style.top = `${topPosition}px`;
|
|
26246
26254
|
headElement.style.overflow = "hidden";
|
|
26247
|
-
const
|
|
26255
|
+
const verticalScrollbarWidth = containerRef.current.offsetWidth - containerRef.current.clientWidth;
|
|
26256
|
+
const headElementWidth = `${containerRect.width - verticalScrollbarWidth}px`;
|
|
26248
26257
|
headElement.style.maxWidth = headElementWidth;
|
|
26249
26258
|
headElement.style.width = headElementWidth;
|
|
26250
26259
|
headElement.style.minWidth = headElementWidth;
|
|
@@ -26299,6 +26308,52 @@ const usePinnedTableHeadStyle = (containerRef) => {
|
|
|
26299
26308
|
};
|
|
26300
26309
|
});
|
|
26301
26310
|
};
|
|
26311
|
+
const useMaxHeightTableStyle = (containerRef, maxHeight) => {
|
|
26312
|
+
const applyVerticalScrollShadow = () => {
|
|
26313
|
+
const container = containerRef.current;
|
|
26314
|
+
const tableHead = container == null ? void 0 : container.querySelector("table > thead");
|
|
26315
|
+
const table = container == null ? void 0 : container.querySelector("table");
|
|
26316
|
+
const shadowTop = container == null ? void 0 : container.querySelector(".shadow--top");
|
|
26317
|
+
const shadowBottom = container == null ? void 0 : container.querySelector(".shadow--bottom");
|
|
26318
|
+
if (tableHead && table && shadowTop && shadowBottom) {
|
|
26319
|
+
shadowBottom.style.left = "0";
|
|
26320
|
+
shadowBottom.style.bottom = "0";
|
|
26321
|
+
shadowTop.style.left = "0";
|
|
26322
|
+
const horizontalScrollbarHeight = container.offsetHeight - (container == null ? void 0 : container.clientHeight);
|
|
26323
|
+
const tableHeight = table.getBoundingClientRect().height;
|
|
26324
|
+
const tableHeadHeight = tableHead.getBoundingClientRect().height;
|
|
26325
|
+
const containerScrollTop = container.scrollTop;
|
|
26326
|
+
const containerScrollBottom = tableHeight + horizontalScrollbarHeight - container.getBoundingClientRect().height - container.scrollTop;
|
|
26327
|
+
const containerScrollLeft = container.scrollLeft;
|
|
26328
|
+
shadowBottom.style.bottom = `${-containerScrollTop}px`;
|
|
26329
|
+
shadowBottom.style.left = `${containerScrollLeft}px`;
|
|
26330
|
+
shadowBottom.style.opacity = containerScrollBottom > 0 ? "1" : "0";
|
|
26331
|
+
shadowTop.style.top = `${containerScrollTop + tableHeadHeight}px`;
|
|
26332
|
+
shadowTop.style.left = `${containerScrollLeft}px`;
|
|
26333
|
+
shadowTop.style.opacity = containerScrollTop > 0 ? "1" : "0";
|
|
26334
|
+
}
|
|
26335
|
+
};
|
|
26336
|
+
React.useLayoutEffect(() => {
|
|
26337
|
+
if (containerRef.current && maxHeight) {
|
|
26338
|
+
const tableHead = containerRef.current.querySelector("table > thead");
|
|
26339
|
+
if (tableHead) {
|
|
26340
|
+
tableHead.style.position = "sticky";
|
|
26341
|
+
tableHead.style.top = "0";
|
|
26342
|
+
tableHead.style.zIndex = "2";
|
|
26343
|
+
tableHead.style.backgroundColor = "#fff";
|
|
26344
|
+
}
|
|
26345
|
+
containerRef.current.addEventListener("scroll", applyVerticalScrollShadow);
|
|
26346
|
+
return () => {
|
|
26347
|
+
containerRef.current.removeEventListener("scroll", applyVerticalScrollShadow);
|
|
26348
|
+
};
|
|
26349
|
+
}
|
|
26350
|
+
}, []);
|
|
26351
|
+
React.useLayoutEffect(() => {
|
|
26352
|
+
if (containerRef.current && maxHeight) {
|
|
26353
|
+
applyVerticalScrollShadow();
|
|
26354
|
+
}
|
|
26355
|
+
});
|
|
26356
|
+
};
|
|
26302
26357
|
const propsDoc$13 = {
|
|
26303
26358
|
controlCell: "boolean",
|
|
26304
26359
|
currentSort: "Array<SortedColumn>",
|
|
@@ -26492,12 +26547,16 @@ Object.assign(SpsThead, {
|
|
|
26492
26547
|
const propsDoc$10 = {
|
|
26493
26548
|
sort: "SortedColumn",
|
|
26494
26549
|
onSortChange: "SortChangeHandler",
|
|
26495
|
-
selectable: "boolean"
|
|
26550
|
+
selectable: "boolean",
|
|
26551
|
+
maxHeightPx: "number",
|
|
26552
|
+
maxHeightRem: "number"
|
|
26496
26553
|
};
|
|
26497
26554
|
const propTypes$13 = __spreadProps(__spreadValues({}, spsGlobalPropTypes), {
|
|
26498
26555
|
onSortChange: fun(),
|
|
26499
26556
|
sort: propTypes$1O.exports.arrayOf(impl()),
|
|
26500
|
-
selectable: propTypes$1O.exports.bool
|
|
26557
|
+
selectable: propTypes$1O.exports.bool,
|
|
26558
|
+
maxHeightPx: propTypes$1O.exports.number,
|
|
26559
|
+
maxHeightRem: propTypes$1O.exports.number
|
|
26501
26560
|
});
|
|
26502
26561
|
function SpsTable(props2) {
|
|
26503
26562
|
const _a = props2, {
|
|
@@ -26506,14 +26565,18 @@ function SpsTable(props2) {
|
|
|
26506
26565
|
onSortChange,
|
|
26507
26566
|
sort,
|
|
26508
26567
|
"data-testid": testId,
|
|
26509
|
-
unsafelyReplaceClassName
|
|
26568
|
+
unsafelyReplaceClassName,
|
|
26569
|
+
maxHeightPx,
|
|
26570
|
+
maxHeightRem
|
|
26510
26571
|
} = _a, rest = __objRest(_a, [
|
|
26511
26572
|
"children",
|
|
26512
26573
|
"className",
|
|
26513
26574
|
"onSortChange",
|
|
26514
26575
|
"sort",
|
|
26515
26576
|
"data-testid",
|
|
26516
|
-
"unsafelyReplaceClassName"
|
|
26577
|
+
"unsafelyReplaceClassName",
|
|
26578
|
+
"maxHeightPx",
|
|
26579
|
+
"maxHeightRem"
|
|
26517
26580
|
]);
|
|
26518
26581
|
const [currentSort, setSort] = React.useState(sort);
|
|
26519
26582
|
const updateSortingDisplay = (newSort) => {
|
|
@@ -26535,13 +26598,21 @@ function SpsTable(props2) {
|
|
|
26535
26598
|
currentSort
|
|
26536
26599
|
};
|
|
26537
26600
|
const classes = clsx(unsafelyReplaceClassName || "sps-table-container", className);
|
|
26601
|
+
const maxHeight = maxHeightPx ? maxHeightPx / 16 : maxHeightRem;
|
|
26602
|
+
const tableContainerInlineStyles = maxHeight ? { maxHeight: `${maxHeight}rem` } : {};
|
|
26538
26603
|
const containerRef = React.useRef(null);
|
|
26604
|
+
useMaxHeightTableStyle(containerRef, maxHeight);
|
|
26539
26605
|
usePinnedTableBackgroundStyle(containerRef);
|
|
26540
|
-
usePinnedTableHeadStyle(containerRef);
|
|
26606
|
+
usePinnedTableHeadStyle(containerRef, maxHeight);
|
|
26541
26607
|
return /* @__PURE__ */ React.createElement("div", {
|
|
26542
26608
|
ref: containerRef,
|
|
26543
|
-
className: classes
|
|
26544
|
-
|
|
26609
|
+
className: classes,
|
|
26610
|
+
style: tableContainerInlineStyles
|
|
26611
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
26612
|
+
className: "sps-table__shadow shadow--top"
|
|
26613
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
26614
|
+
className: "sps-table__shadow shadow--bottom"
|
|
26615
|
+
}), /* @__PURE__ */ React.createElement("table", __spreadValues({
|
|
26545
26616
|
className: "sps-table",
|
|
26546
26617
|
role: "table",
|
|
26547
26618
|
"data-testid": `${testId}`
|
|
@@ -27278,10 +27349,10 @@ const SpsTableExamples = {
|
|
|
27278
27349
|
<SpsTable>
|
|
27279
27350
|
<SpsTableHead>
|
|
27280
27351
|
<SpsTableRow>
|
|
27281
|
-
<SpsTableHeader ></SpsTableHeader>
|
|
27282
|
-
<SpsTableHeader
|
|
27352
|
+
<SpsTableHeader controlCell></SpsTableHeader>
|
|
27353
|
+
<SpsTableHeader>Title</SpsTableHeader>
|
|
27283
27354
|
<SpsTableHeader>Year</SpsTableHeader>
|
|
27284
|
-
<SpsTableHeader
|
|
27355
|
+
<SpsTableHeader>Director</SpsTableHeader>
|
|
27285
27356
|
<SpsTableHeader>Countries</SpsTableHeader>
|
|
27286
27357
|
</SpsTableRow>
|
|
27287
27358
|
</SpsTableHead>
|
|
@@ -27289,7 +27360,7 @@ const SpsTableExamples = {
|
|
|
27289
27360
|
{items.map((row, index) => {
|
|
27290
27361
|
return (
|
|
27291
27362
|
<SpsTableRow key={index}>
|
|
27292
|
-
<SpsTableCell><SpsCheckbox/></SpsTableCell>
|
|
27363
|
+
<SpsTableCell controlCell><SpsCheckbox/></SpsTableCell>
|
|
27293
27364
|
<SpsTableCell>{row["title"]}</SpsTableCell>
|
|
27294
27365
|
<SpsTableCell>{row["year"]}</SpsTableCell>
|
|
27295
27366
|
<SpsTableCell>{row["director"]}</SpsTableCell>
|
|
@@ -27378,7 +27449,7 @@ const SpsTableExamples = {
|
|
|
27378
27449
|
<SpsTableCell>{row["year"]}</SpsTableCell>
|
|
27379
27450
|
<SpsTableCell>{row["director"]}</SpsTableCell>
|
|
27380
27451
|
<SpsTableCell className="text-right" buttonCell>
|
|
27381
|
-
<SpsButton kind=
|
|
27452
|
+
<SpsButton kind={ButtonKind.ICON} icon={SpsIcon.ELLIPSES} />
|
|
27382
27453
|
</SpsTableCell>
|
|
27383
27454
|
</SpsTableRow>
|
|
27384
27455
|
);
|
|
@@ -27533,7 +27604,7 @@ const SpsTableExamples = {
|
|
|
27533
27604
|
<SpsTableCell>{row["aspect_ratio"]}</SpsTableCell>
|
|
27534
27605
|
<SpsTableCell>\${row["price"]}</SpsTableCell>
|
|
27535
27606
|
<SpsTableCell className="text-right" buttonCell pinned>
|
|
27536
|
-
<SpsButton kind=
|
|
27607
|
+
<SpsButton kind={ButtonKind.ICON} icon={SpsIcon.ELLIPSES} />
|
|
27537
27608
|
</SpsTableCell>
|
|
27538
27609
|
</SpsTableRow>
|
|
27539
27610
|
)
|
|
@@ -33211,6 +33282,7 @@ const SpsSideNavExamples = {
|
|
|
33211
33282
|
titleIcon={SpsIcon.STATUS_OK}
|
|
33212
33283
|
navOptions={items}
|
|
33213
33284
|
onNavChange={onChange}
|
|
33285
|
+
activeNavItem="Navigation Item 2"
|
|
33214
33286
|
/>
|
|
33215
33287
|
</div>
|
|
33216
33288
|
</div>
|
|
@@ -33564,28 +33636,33 @@ const SpsSpinnerExamples = {
|
|
|
33564
33636
|
basic: {
|
|
33565
33637
|
examples: {
|
|
33566
33638
|
small: {
|
|
33567
|
-
|
|
33568
|
-
|
|
33569
|
-
|
|
33570
|
-
<SpsSpinner size={SpinnerSize.SMALL}/>
|
|
33571
|
-
|
|
33639
|
+
react: code`
|
|
33640
|
+
function Component() {
|
|
33641
|
+
return (
|
|
33642
|
+
<SpsSpinner size={SpinnerSize.SMALL} title="Please wait…" />
|
|
33643
|
+
);
|
|
33644
|
+
}
|
|
33572
33645
|
`
|
|
33573
33646
|
},
|
|
33574
33647
|
medium: {
|
|
33575
|
-
|
|
33576
|
-
|
|
33577
|
-
|
|
33578
|
-
|
|
33579
|
-
|
|
33580
|
-
|
|
33648
|
+
react: code`
|
|
33649
|
+
function Component() {
|
|
33650
|
+
return (
|
|
33651
|
+
<>
|
|
33652
|
+
<SpsSpinner />
|
|
33653
|
+
<SpsSpinner size={SpinnerSize.MEDIUM} title="Please wait…" />
|
|
33654
|
+
</>
|
|
33655
|
+
);
|
|
33656
|
+
}
|
|
33581
33657
|
`
|
|
33582
33658
|
},
|
|
33583
33659
|
large: {
|
|
33584
|
-
|
|
33585
|
-
|
|
33586
|
-
|
|
33587
|
-
<SpsSpinner size={SpinnerSize.LARGE} alt="Loading content…"/>
|
|
33588
|
-
|
|
33660
|
+
react: code`
|
|
33661
|
+
function Component() {
|
|
33662
|
+
return (
|
|
33663
|
+
<SpsSpinner size={SpinnerSize.LARGE} alt="Loading content…" />
|
|
33664
|
+
);
|
|
33665
|
+
}
|
|
33589
33666
|
`
|
|
33590
33667
|
}
|
|
33591
33668
|
}
|
|
@@ -34740,11 +34817,9 @@ const SpsTaskQueueExamples = {
|
|
|
34740
34817
|
}
|
|
34741
34818
|
]);
|
|
34742
34819
|
|
|
34743
|
-
const
|
|
34744
|
-
|
|
34745
|
-
|
|
34746
|
-
})
|
|
34747
|
-
);
|
|
34820
|
+
const { formValue, formMeta } = useSpsForm({
|
|
34821
|
+
blueTooltip: false
|
|
34822
|
+
});
|
|
34748
34823
|
|
|
34749
34824
|
function handleAddTask() {
|
|
34750
34825
|
const newTaskId = generateTaskId();
|
|
@@ -34771,7 +34846,7 @@ const SpsTaskQueueExamples = {
|
|
|
34771
34846
|
setTasks(currentTasks => currentTasks.map(task => ({ ...task, unread: false })));
|
|
34772
34847
|
}
|
|
34773
34848
|
|
|
34774
|
-
const isTooltipBlue =
|
|
34849
|
+
const isTooltipBlue = formValue.blueTooltip;
|
|
34775
34850
|
const tooltipKind = isTooltipBlue ? TooltipKind.HELP : TooltipKind.DEFAULT;
|
|
34776
34851
|
const notificationText = isTooltipBlue
|
|
34777
34852
|
? "There is a new task in your queue. Also the tooltip is blue now :O"
|
|
@@ -34780,7 +34855,7 @@ const SpsTaskQueueExamples = {
|
|
|
34780
34855
|
return (
|
|
34781
34856
|
<div style={{ display: "flex", justifyContent: "space-between" }}>
|
|
34782
34857
|
<div>
|
|
34783
|
-
<SpsCheckbox label="Blue Tooltip"
|
|
34858
|
+
<SpsCheckbox label="Blue Tooltip" formMeta={formMeta.fields.blueTooltip} />
|
|
34784
34859
|
<SpsButton onClick={handleAddTask}>Add a new task to the queue</SpsButton>
|
|
34785
34860
|
</div>
|
|
34786
34861
|
|
|
@@ -35538,9 +35613,9 @@ const SpsTileListExamples = {
|
|
|
35538
35613
|
|
|
35539
35614
|
// custom sort by status
|
|
35540
35615
|
if (key === 'status') {
|
|
35541
|
-
if (a.error + a.warning < b.error + b.warning) {
|
|
35616
|
+
if (+a.error + +a.warning < +b.error + +b.warning) {
|
|
35542
35617
|
return direction === SortDirection.ASCENDING ? -1 : 1;
|
|
35543
|
-
} else if (a.error + a.warning > b.error + b.warning) {
|
|
35618
|
+
} else if (+a.error + +a.warning > +b.error + +b.warning) {
|
|
35544
35619
|
return direction === SortDirection.ASCENDING ? 1 : -1;
|
|
35545
35620
|
}
|
|
35546
35621
|
}
|
|
@@ -37118,16 +37193,13 @@ const SpsFilterPanelExamples = {
|
|
|
37118
37193
|
const propsDoc$c = {
|
|
37119
37194
|
value: "string",
|
|
37120
37195
|
placeholder: "string",
|
|
37121
|
-
formMeta: "
|
|
37196
|
+
formMeta: "SpsFormFieldMeta<string>",
|
|
37122
37197
|
onFilterChange: "ChangeEventHandler<HTMLInputElement>"
|
|
37123
37198
|
};
|
|
37124
37199
|
const propTypes$e = __spreadProps(__spreadValues({}, spsGlobalPropTypes), {
|
|
37125
37200
|
value: propTypes$1O.exports.string,
|
|
37126
37201
|
placeholder: propTypes$1O.exports.string,
|
|
37127
|
-
formMeta:
|
|
37128
|
-
impl(),
|
|
37129
|
-
impl()
|
|
37130
|
-
]),
|
|
37202
|
+
formMeta: impl(),
|
|
37131
37203
|
onFilterChange: fun()
|
|
37132
37204
|
});
|
|
37133
37205
|
function SpsFilterPanelFilterBox(_Q) {
|
package/lib/table/SpsTable.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ declare const propTypes: {
|
|
|
4
4
|
onSortChange: PropTypes.Requireable<SortChangeHandler>;
|
|
5
5
|
sort: PropTypes.Requireable<SortedColumn[]>;
|
|
6
6
|
selectable: PropTypes.Requireable<boolean>;
|
|
7
|
+
maxHeightPx: PropTypes.Requireable<number>;
|
|
8
|
+
maxHeightRem: PropTypes.Requireable<number>;
|
|
7
9
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
8
10
|
className: PropTypes.Requireable<string>;
|
|
9
11
|
"data-testid": PropTypes.Requireable<string>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
export declare const usePinnedCellStyle: (isPinned: boolean, elementRef: React.MutableRefObject<HTMLTableHeaderCellElement | HTMLTableCellElement>) => void;
|
|
3
3
|
export declare const usePinnedTableBackgroundStyle: (containerRef: React.MutableRefObject<HTMLDivElement>) => void;
|
|
4
|
-
export declare const usePinnedTableHeadStyle: (containerRef: React.MutableRefObject<HTMLDivElement
|
|
4
|
+
export declare const usePinnedTableHeadStyle: (containerRef: React.MutableRefObject<HTMLDivElement>, maxHeight: number) => void;
|
|
5
|
+
export declare const useMaxHeightTableStyle: (containerRef: React.MutableRefObject<HTMLDivElement>, maxHeight: number) => void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spscommerce/ds-react",
|
|
3
3
|
"description": "SPS Design System React components",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.23.2",
|
|
5
5
|
"author": "SPS Commerce",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"repository": "https://github.com/spscommerce/design-system/tree/main/packages/@spscommerce/ds-react",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@react-stately/collections": "^3.3.3",
|
|
31
|
-
"@spscommerce/ds-colors": "5.
|
|
32
|
-
"@spscommerce/ds-illustrations": "5.
|
|
33
|
-
"@spscommerce/ds-shared": "5.
|
|
34
|
-
"@spscommerce/positioning": "5.
|
|
35
|
-
"@spscommerce/utils": "5.
|
|
31
|
+
"@spscommerce/ds-colors": "5.23.2",
|
|
32
|
+
"@spscommerce/ds-illustrations": "5.23.2",
|
|
33
|
+
"@spscommerce/ds-shared": "5.23.2",
|
|
34
|
+
"@spscommerce/positioning": "5.23.2",
|
|
35
|
+
"@spscommerce/utils": "5.23.2",
|
|
36
36
|
"moment": "^2.25.3",
|
|
37
37
|
"moment-timezone": "^0.5.28",
|
|
38
38
|
"react": "^16.9.0",
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@react-stately/collections": "^3.3.3",
|
|
43
|
-
"@spscommerce/ds-colors": "5.
|
|
44
|
-
"@spscommerce/ds-illustrations": "5.
|
|
45
|
-
"@spscommerce/ds-shared": "5.
|
|
46
|
-
"@spscommerce/positioning": "5.
|
|
47
|
-
"@spscommerce/utils": "5.
|
|
43
|
+
"@spscommerce/ds-colors": "5.23.2",
|
|
44
|
+
"@spscommerce/ds-illustrations": "5.23.2",
|
|
45
|
+
"@spscommerce/ds-shared": "5.23.2",
|
|
46
|
+
"@spscommerce/positioning": "5.23.2",
|
|
47
|
+
"@spscommerce/utils": "5.23.2",
|
|
48
48
|
"@testing-library/react": "^9.3.2",
|
|
49
49
|
"@types/prop-types": "^15.7.1",
|
|
50
50
|
"@types/react": "^16.9.0",
|