@spscommerce/ds-react 5.21.4 → 5.23.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/lib/index.es.js CHANGED
@@ -23469,14 +23469,14 @@ const SpsFocusedTaskExamples = {
23469
23469
  <div className="sfg-row">
23470
23470
  <div className="sfg-col-3"></div>
23471
23471
  <div className="sfg-col-6">
23472
- <SpsCard>
23472
+ <SpsCardV2>
23473
23473
  <i>pretend there's a form here</i>
23474
- </SpsCard>
23474
+ </SpsCardV2>
23475
23475
  </div>
23476
23476
  <div className="sfg-col-3"></div>
23477
23477
  </div>
23478
23478
  <SpsFocusedTaskActions>
23479
- <SpsButton kind="confirm" onClick={onFormSubmit}>
23479
+ <SpsButton kind={ButtonKind.CONFIRM} onClick={onFormSubmit}>
23480
23480
  Submit
23481
23481
  </SpsButton>
23482
23482
  </SpsFocusedTaskActions>
@@ -23510,14 +23510,14 @@ const SpsFocusedTaskExamples = {
23510
23510
  <div className="sfg-row">
23511
23511
  <div className="sfg-col-3"></div>
23512
23512
  <div className="sfg-col-6">
23513
- <SpsCard>
23513
+ <SpsCardV2>
23514
23514
  <i>pretend there's a form here</i>
23515
- </SpsCard>
23515
+ </SpsCardV2>
23516
23516
  </div>
23517
23517
  <div className="sfg-col-3"></div>
23518
23518
  </div>
23519
23519
  <SpsFocusedTaskActions>
23520
- <SpsButton kind="confirm" onClick={onFormSubmit}>
23520
+ <SpsButton kind={ButtonKind.CONFIRM} onClick={onFormSubmit}>
23521
23521
  Submit
23522
23522
  </SpsButton>
23523
23523
  </SpsFocusedTaskActions>
@@ -25238,27 +25238,27 @@ const SpsInsightTileExamples = {
25238
25238
  jsx: code`
25239
25239
  <SpsInsights>
25240
25240
  <SpsInsightTile
25241
- kind={SpsInsightCardKind.GENERAL}
25241
+ kind={SpsInsightTileKind.GENERAL}
25242
25242
  metric="1234"
25243
25243
  title="Insight Tile Title"
25244
25244
  />
25245
25245
  <SpsInsightTile
25246
- kind={SpsInsightCardKind.PROCESSING}
25246
+ kind={SpsInsightTileKind.PROCESSING}
25247
25247
  metric="1234"
25248
25248
  title="Insight Tile Title"
25249
25249
  />
25250
25250
  <SpsInsightTile
25251
- kind={SpsInsightCardKind.SUCCESS}
25251
+ kind={SpsInsightTileKind.SUCCESS}
25252
25252
  metric="1234"
25253
25253
  title="Insight Tile Title"
25254
25254
  />
25255
25255
  <SpsInsightTile
25256
- kind={SpsInsightCardKind.WARNING}
25256
+ kind={SpsInsightTileKind.WARNING}
25257
25257
  metric="1234"
25258
25258
  title="Insight Tile Title"
25259
25259
  />
25260
25260
  <SpsInsightTile
25261
- kind={SpsInsightCardKind.ERROR}
25261
+ kind={SpsInsightTileKind.ERROR}
25262
25262
  metric="1234"
25263
25263
  title="Insight Tile Title"
25264
25264
  />
@@ -25274,49 +25274,49 @@ const SpsInsightTileExamples = {
25274
25274
  jsx: code`
25275
25275
  <SpsInsights>
25276
25276
  <SpsInsightTile
25277
- kind={SpsInsightCardKind.GENERAL}
25277
+ kind={SpsInsightTileKind.GENERAL}
25278
25278
  metric="1234"
25279
25279
  title="Insight Tile Title"
25280
25280
  >
25281
25281
  <span className="gray600 font-weight-bold">Detail:</span> 792 units
25282
25282
  </SpsInsightTile>
25283
25283
  <SpsInsightTile
25284
- kind={SpsInsightCardKind.PROCESSING}
25284
+ kind={SpsInsightTileKind.PROCESSING}
25285
25285
  metric="1234"
25286
25286
  title="Insight Tile Title"
25287
25287
  >
25288
25288
  <span className="gray600 font-weight-bold">Detail:</span> 792 units
25289
25289
  </SpsInsightTile>
25290
25290
  <SpsInsightTile
25291
- kind={SpsInsightCardKind.SUCCESS}
25291
+ kind={SpsInsightTileKind.SUCCESS}
25292
25292
  metric="1234"
25293
25293
  title="Insight Tile Title"
25294
25294
  >
25295
25295
  <span className="gray600 font-weight-bold">Detail:</span> 792 units
25296
25296
  </SpsInsightTile>
25297
25297
  <SpsInsightTile
25298
- kind={SpsInsightCardKind.WARNING}
25298
+ kind={SpsInsightTileKind.WARNING}
25299
25299
  metric="1234"
25300
25300
  title="Insight Tile Title"
25301
25301
  >
25302
25302
  <span className="gray600 font-weight-bold">Detail:</span> 792 units
25303
25303
  </SpsInsightTile>
25304
25304
  <SpsInsightTile
25305
- kind={SpsInsightCardKind.ERROR}
25305
+ kind={SpsInsightTileKind.ERROR}
25306
25306
  metric="1234"
25307
25307
  title="Insight Tile Title"
25308
25308
  >
25309
25309
  <span className="gray600 font-weight-bold">Detail:</span> 792 units
25310
25310
  </SpsInsightTile>
25311
25311
  <SpsInsightTile
25312
- kind={SpsInsightCardKind.SUCCESS}
25312
+ kind={SpsInsightTileKind.SUCCESS}
25313
25313
  metric="1234"
25314
25314
  title="Insight Tile Title"
25315
25315
  >
25316
25316
  <span className="gray600 font-weight-bold">Detail:</span> 792 units
25317
25317
  </SpsInsightTile>
25318
25318
  <SpsInsightTile
25319
- kind={SpsInsightCardKind.ERROR}
25319
+ kind={SpsInsightTileKind.ERROR}
25320
25320
  metric="1234"
25321
25321
  title="Insight Tile Title"
25322
25322
  >
@@ -25334,35 +25334,35 @@ const SpsInsightTileExamples = {
25334
25334
  jsx: code`
25335
25335
  <SpsInsights>
25336
25336
  <SpsInsightTile
25337
- kind={SpsInsightCardKind.GENERAL}
25337
+ kind={SpsInsightTileKind.GENERAL}
25338
25338
  metric="1234"
25339
25339
  title="Insight Tile Title"
25340
25340
  partnerCount="250"
25341
25341
  totalPartners="250"
25342
25342
  />
25343
25343
  <SpsInsightTile
25344
- kind={SpsInsightCardKind.PROCESSING}
25344
+ kind={SpsInsightTileKind.PROCESSING}
25345
25345
  metric="1234"
25346
25346
  title="Insight Tile Title"
25347
25347
  partnerCount="122"
25348
25348
  totalPartners="250"
25349
25349
  />
25350
25350
  <SpsInsightTile
25351
- kind={SpsInsightCardKind.SUCCESS}
25351
+ kind={SpsInsightTileKind.SUCCESS}
25352
25352
  metric="1234"
25353
25353
  title="Insight Tile Title"
25354
25354
  partnerCount="207"
25355
25355
  totalPartners="250"
25356
25356
  />
25357
25357
  <SpsInsightTile
25358
- kind={SpsInsightCardKind.WARNING}
25358
+ kind={SpsInsightTileKind.WARNING}
25359
25359
  metric="1234"
25360
25360
  title="Insight Tile Title"
25361
25361
  partnerCount="12"
25362
25362
  totalPartners="250"
25363
25363
  />
25364
25364
  <SpsInsightTile
25365
- kind={SpsInsightCardKind.ERROR}
25365
+ kind={SpsInsightTileKind.ERROR}
25366
25366
  metric="1234"
25367
25367
  title="Insight Tile Title"
25368
25368
  partnerCount="94"
@@ -25380,19 +25380,19 @@ const SpsInsightTileExamples = {
25380
25380
  jsx: code`
25381
25381
  <SpsInsights>
25382
25382
  <SpsInsightTile
25383
- kind={SpsInsightCardKind.GENERAL}
25383
+ kind={SpsInsightTileKind.GENERAL}
25384
25384
  metric="1234"
25385
25385
  title="Insight Tile Title"
25386
25386
  onClick={() => console.log("insight tile 1 clicked!")}
25387
25387
  />
25388
25388
  <SpsInsightTile
25389
- kind={SpsInsightCardKind.GENERAL}
25389
+ kind={SpsInsightTileKind.GENERAL}
25390
25390
  metric="1234"
25391
25391
  title="Insight Tile Title"
25392
25392
  onClick={() => console.log("insight tile 2 clicked!")}
25393
25393
  />
25394
25394
  <SpsInsightTile
25395
- kind={SpsInsightCardKind.GENERAL}
25395
+ kind={SpsInsightTileKind.GENERAL}
25396
25396
  metric="1234"
25397
25397
  title="Insight Tile Title"
25398
25398
  onClick={() => console.log("insight tile 3 clicked!")}
@@ -25409,31 +25409,31 @@ const SpsInsightTileExamples = {
25409
25409
  jsx: code`
25410
25410
  <SpsInsights>
25411
25411
  <SpsInsightTile
25412
- kind={SpsInsightCardKind.GENERAL}
25412
+ kind={SpsInsightTileKind.GENERAL}
25413
25413
  metric="1234"
25414
25414
  title="Insight Tile Title"
25415
25415
  icon={SpsIcon.USER}
25416
25416
  />
25417
25417
  <SpsInsightTile
25418
- kind={SpsInsightCardKind.PROCESSING}
25418
+ kind={SpsInsightTileKind.PROCESSING}
25419
25419
  metric="1234"
25420
25420
  title="Insight Tile Title"
25421
25421
  icon={SpsIcon.ASTERISK}
25422
25422
  />
25423
25423
  <SpsInsightTile
25424
- kind={SpsInsightCardKind.SUCCESS}
25424
+ kind={SpsInsightTileKind.SUCCESS}
25425
25425
  metric="1234"
25426
25426
  title="Insight Tile Title"
25427
25427
  icon={SpsIcon.DOLLAR_SIGN}
25428
25428
  />
25429
25429
  <SpsInsightTile
25430
- kind={SpsInsightCardKind.WARNING}
25430
+ kind={SpsInsightTileKind.WARNING}
25431
25431
  metric="1234"
25432
25432
  title="Insight Tile Title"
25433
25433
  icon={SpsIcon.FOLDER_OPEN}
25434
25434
  />
25435
25435
  <SpsInsightTile
25436
- kind={SpsInsightCardKind.ERROR}
25436
+ kind={SpsInsightTileKind.ERROR}
25437
25437
  metric="1234"
25438
25438
  title="Insight Tile Title"
25439
25439
  icon={SpsIcon.BAN}
@@ -25450,7 +25450,7 @@ const SpsInsightTileExamples = {
25450
25450
  jsx: code`
25451
25451
  <SpsInsights>
25452
25452
  <SpsInsightTile
25453
- kind={SpsInsightCardKind.GENERAL}
25453
+ kind={SpsInsightTileKind.GENERAL}
25454
25454
  metric="1234"
25455
25455
  title="Insight Tile Title"
25456
25456
  partnerCount="100"
@@ -25460,7 +25460,7 @@ const SpsInsightTileExamples = {
25460
25460
  <span className="gray600 font-weight-bold">Detail:</span> 792 units
25461
25461
  </SpsInsightTile>
25462
25462
  <SpsInsightTile
25463
- kind={SpsInsightCardKind.PROCESSING}
25463
+ kind={SpsInsightTileKind.PROCESSING}
25464
25464
  metric="1234"
25465
25465
  title="Insight Tile Title"
25466
25466
  partnerCount="100"
@@ -25468,7 +25468,7 @@ const SpsInsightTileExamples = {
25468
25468
  horizontal
25469
25469
  />
25470
25470
  <SpsInsightTile
25471
- kind={SpsInsightCardKind.SUCCESS}
25471
+ kind={SpsInsightTileKind.SUCCESS}
25472
25472
  metric="1234"
25473
25473
  title="Insight Tile Title"
25474
25474
  partnerCount="100"
@@ -25478,7 +25478,7 @@ const SpsInsightTileExamples = {
25478
25478
  <span className="gray600 font-weight-bold">Detail:</span> 792 units
25479
25479
  </SpsInsightTile>
25480
25480
  <SpsInsightTile
25481
- kind={SpsInsightCardKind.WARNING}
25481
+ kind={SpsInsightTileKind.WARNING}
25482
25482
  metric="1234"
25483
25483
  title="Insight Tile Title"
25484
25484
  partnerCount="100"
@@ -25486,7 +25486,7 @@ const SpsInsightTileExamples = {
25486
25486
  horizontal
25487
25487
  />
25488
25488
  <SpsInsightTile
25489
- kind={SpsInsightCardKind.ERROR}
25489
+ kind={SpsInsightTileKind.ERROR}
25490
25490
  metric="1234"
25491
25491
  title="Insight Tile Title"
25492
25492
  partnerCount="100"
@@ -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, calc(100% - ${rightPinnedWidth}px) 0, ${leftPinnedWidth}px 0, calc(100% - ${rightPinnedWidth}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 headElementWidth = `${containerRect.width}px`;
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
- }, /* @__PURE__ */ React.createElement("table", __spreadValues({
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}`
@@ -29190,7 +29261,7 @@ const SpsListToolbarExamples = {
29190
29261
  formMeta={formMeta.fields.searchText}
29191
29262
  placeholder="Search fields"
29192
29263
  />
29193
- <SpsButton kind="icon" icon="search" />
29264
+ <SpsButton kind={ButtonKind.ICON} icon={SpsIcon.SEARCH} />
29194
29265
  </SpsListToolbarSearch>
29195
29266
  </SpsListToolbar>
29196
29267
  );
@@ -34806,7 +34877,8 @@ const propsDoc$v = {
34806
34877
  name: "string",
34807
34878
  onChange: "ChangeEventHandler<HTMLInputElement>",
34808
34879
  placeholder: "string",
34809
- value: "string"
34880
+ value: "string",
34881
+ additionalText: "string"
34810
34882
  };
34811
34883
  const propTypes$x = __spreadProps(__spreadValues({}, spsGlobalPropTypes), {
34812
34884
  disabled: propTypes$1O.exports.bool,
@@ -34816,7 +34888,8 @@ const propTypes$x = __spreadProps(__spreadValues({}, spsGlobalPropTypes), {
34816
34888
  name: propTypes$1O.exports.string,
34817
34889
  onChange: fun(),
34818
34890
  placeholder: propTypes$1O.exports.string,
34819
- value: propTypes$1O.exports.string
34891
+ value: propTypes$1O.exports.string,
34892
+ additionalText: propTypes$1O.exports.string
34820
34893
  });
34821
34894
  const SpsTextInput = React.forwardRef((_G, ref2) => {
34822
34895
  var _H = _G, {
@@ -34832,7 +34905,8 @@ const SpsTextInput = React.forwardRef((_G, ref2) => {
34832
34905
  "data-testid": testId,
34833
34906
  title,
34834
34907
  unsafelyReplaceClassName,
34835
- value = ""
34908
+ value = "",
34909
+ additionalText
34836
34910
  } = _H, rest = __objRest(_H, [
34837
34911
  "className",
34838
34912
  "disabled",
@@ -34846,7 +34920,8 @@ const SpsTextInput = React.forwardRef((_G, ref2) => {
34846
34920
  "data-testid",
34847
34921
  "title",
34848
34922
  "unsafelyReplaceClassName",
34849
- "value"
34923
+ "value",
34924
+ "additionalText"
34850
34925
  ]);
34851
34926
  const meta = formMeta || formControl2;
34852
34927
  const { wrapperId, controlId } = useFormControlId(id2, meta);
@@ -34897,7 +34972,9 @@ const SpsTextInput = React.forwardRef((_G, ref2) => {
34897
34972
  "data-testid": `${testId}__input_clear`,
34898
34973
  className: "sps-icon sps-icon-x-circle sps-form-control__clear-btn",
34899
34974
  onClick: clear
34900
- })));
34975
+ })), additionalText && /* @__PURE__ */ React.createElement("p", {
34976
+ className: "sps-input__additional-text"
34977
+ }, additionalText));
34901
34978
  });
34902
34979
  Object.assign(SpsTextInput, {
34903
34980
  props: propsDoc$v,
@@ -34905,91 +34982,118 @@ Object.assign(SpsTextInput, {
34905
34982
  displayName: "SpsTextInput"
34906
34983
  });
34907
34984
  const SpsTextInputExamples = {
34908
- standard: {
34909
- label: "Standard",
34910
- description: "info about standard text inputs",
34985
+ general: {
34986
+ label: "General Usage",
34987
+ description: ({ NavigateTo }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h5", null, "Use a Text Input:"), /* @__PURE__ */ React.createElement("ul", null, /* @__PURE__ */ React.createElement("li", null, "When the value required is short (a single word or short phrase)."), /* @__PURE__ */ React.createElement("li", null, "When only one value is required or accepted.")), /* @__PURE__ */ React.createElement("h5", null, "Do Not Use a Text Input:"), /* @__PURE__ */ React.createElement("ul", null, /* @__PURE__ */ React.createElement("li", null, "When a value of considerable length (such as a sentence or paragraph) is required or accepted. Use a ", /* @__PURE__ */ React.createElement(NavigateTo, {
34988
+ to: "text-areas"
34989
+ }, "Text Area"), " instead."), /* @__PURE__ */ React.createElement("li", null, "When more than one value is required or accepted in the field. Use", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
34990
+ to: "multi-select"
34991
+ }, "Multi-Select"), " instead."), /* @__PURE__ */ React.createElement("li", null, "When a boolean selection is required (such as on/off, yes/no, etc). Use", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
34992
+ to: "checkbox"
34993
+ }, "Checkboxes"), ",", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
34994
+ to: "radio-buttons"
34995
+ }, "Radio Buttons"), " or", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
34996
+ to: "toggle"
34997
+ }, "Toggles"), " instead.")))
34998
+ },
34999
+ basic: {
35000
+ label: "Basic Text Inputs",
35001
+ description: () => /* @__PURE__ */ React.createElement("p", null, "Basic Text Inputs include a label and an input field."),
34911
35002
  examples: {
34912
35003
  standard: {
34913
35004
  react: code`
34914
35005
  function DemoComponent() {
34915
- const { formValue, formMeta, updateForm } = useSpsForm({ foo: "bar" });
35006
+ const { formValue, formMeta, updateForm } = useSpsForm({ companyName: "" });
34916
35007
 
34917
- return <>
34918
- <SpsLabel for={formMeta.fields.foo}>Foo</SpsLabel>
34919
- <SpsTextInput
34920
- value={formValue.foo}
34921
- formMeta={formMeta.fields.foo}
34922
- />
34923
- </>;
35008
+ return (
35009
+ <div className="sfg-row">
35010
+ <div className="sfg-col-4">
35011
+ <SpsLabel for={formMeta.fields.companyName}>Company Name</SpsLabel>
35012
+ <SpsTextInput
35013
+ value={formValue.companyName}
35014
+ formMeta={formMeta.fields.companyName}
35015
+ />
35016
+ </div>
35017
+ </div>
35018
+ );
34924
35019
  }
34925
35020
  `
34926
35021
  }
34927
35022
  }
34928
35023
  },
34929
- b_placeholder: {
34930
- label: "Placeholder",
34931
- description: "info about text input placeholders",
35024
+ placeholder: {
35025
+ label: "Placeholder Text",
35026
+ description: ({ NavigateTo }) => /* @__PURE__ */ React.createElement("p", null, "Certain inputs may benefit from placeholder text to aid the user in providing a valid value."),
34932
35027
  examples: {
34933
35028
  placeholder: {
34934
35029
  react: code`
34935
35030
  function DemoComponent() {
34936
- const { formValue, formMeta, updateForm } = useSpsForm({ foo: "bar" });
35031
+ const { formValue, formMeta, updateForm } = useSpsForm({ phoneNumber: "" });
34937
35032
 
34938
- return <>
34939
- <SpsLabel for={formMeta.fields.foo}>
34940
- Company Name
34941
- </SpsLabel>
34942
- <SpsTextInput formMeta={formMeta.fields.foo}
34943
- value={formValue.foo}
34944
- placeholder="Enter a company name"
34945
- ></SpsTextInput>
34946
- </>
35033
+ return (
35034
+ <div className="sfg-row">
35035
+ <div className="sfg-col-4">
35036
+ <SpsLabel for={formMeta.fields.phoneNumber}>Phone Number</SpsLabel>
35037
+ <SpsTextInput
35038
+ value={formValue.phoneNumber}
35039
+ formMeta={formMeta.fields.phoneNumber}
35040
+ placeholder="(000) 000-0000"
35041
+ />
35042
+ </div>
35043
+ </div>
35044
+ );
34947
35045
  }
34948
35046
  `
34949
35047
  }
34950
35048
  }
34951
35049
  },
34952
- c_description: {
34953
- label: "Description",
34954
- description: "info about text inputs with descriptions",
35050
+ additional_text: {
35051
+ label: "Additional Descriptive Text",
35052
+ description: ({ NavigateTo }) => /* @__PURE__ */ React.createElement("p", null, "For occasions when additional context beyond a placeholder is required, text in the form of a short phrase can appear below the input."),
34955
35053
  examples: {
34956
- description: {
35054
+ placeholder: {
34957
35055
  react: code`
34958
35056
  function DemoComponent() {
34959
- const { formValue, formMeta, updateForm } = useSpsForm({ foo: "bar" });
35057
+ const { formValue, formMeta, updateForm } = useSpsForm({ password: "" });
34960
35058
 
34961
- return <>
34962
- <SpsLabel for={formMeta.fields.foo}
34963
- value={formValue.foo}
34964
- description="This is a brief description of the field to provide additional context."
34965
- >
34966
- Label
34967
- </SpsLabel>
34968
- <SpsTextInput formMeta={formMeta.fields.foo}/>
34969
- </>
35059
+ return (
35060
+ <div className="sfg-row">
35061
+ <div className="sfg-col-4">
35062
+ <SpsLabel for={formMeta.fields.password}>Password</SpsLabel>
35063
+ <SpsTextInput
35064
+ value={formValue.password}
35065
+ formMeta={formMeta.fields.password}
35066
+ additionalText="Password must be 8-12 characters in length and include: 1 capital letter, 1 number and 1 special character"
35067
+ />
35068
+ </div>
35069
+ </div>
35070
+ );
34970
35071
  }
34971
35072
  `
34972
35073
  }
34973
35074
  }
34974
35075
  },
34975
- d_disabled: {
34976
- label: "Disabled",
34977
- description: "info about disabled text inputs",
35076
+ disabled: {
35077
+ label: "Disabled State",
35078
+ description: () => /* @__PURE__ */ React.createElement("p", null, "The Disabled State prevents a user from modifying the text input while still allowing visibility to its information."),
34978
35079
  examples: {
34979
- disabled: {
35080
+ standard: {
34980
35081
  react: code`
34981
35082
  function DemoComponent() {
34982
- const { formValue, formMeta, updateForm } = useSpsForm({ email: "foo@bar.com" });
35083
+ const { formValue, formMeta, updateForm } = useSpsForm({ companyName: "FGL Sports" });
34983
35084
 
34984
- return <>
34985
- <SpsLabel for={formMeta.fields.email}>
34986
- Email Address
34987
- </SpsLabel>
34988
- <SpsTextInput id="disabledTextInput" disabled
34989
- value={formValue.email}
34990
- formMeta={formMeta.fields.email}
34991
- ></SpsTextInput>
34992
- </>
35085
+ return (
35086
+ <div className="sfg-row">
35087
+ <div className="sfg-col-4">
35088
+ <SpsLabel for={formMeta.fields.companyName}>Company Name</SpsLabel>
35089
+ <SpsTextInput
35090
+ value={formValue.companyName}
35091
+ formMeta={formMeta.fields.companyName}
35092
+ disabled
35093
+ />
35094
+ </div>
35095
+ </div>
35096
+ );
34993
35097
  }
34994
35098
  `
34995
35099
  }
@@ -35003,7 +35107,8 @@ const propsDoc$u = {
35003
35107
  onChange: "ChangeEventHandler",
35004
35108
  placeholder: "string",
35005
35109
  rows: "number",
35006
- value: "string"
35110
+ value: "string",
35111
+ additionalText: "string"
35007
35112
  };
35008
35113
  const propTypes$w = __spreadProps(__spreadValues({}, spsGlobalPropTypes), {
35009
35114
  disabled: propTypes$1O.exports.bool,
@@ -35014,7 +35119,8 @@ const propTypes$w = __spreadProps(__spreadValues({}, spsGlobalPropTypes), {
35014
35119
  placeholder: propTypes$1O.exports.string,
35015
35120
  ref: ref(),
35016
35121
  rows: propTypes$1O.exports.number,
35017
- value: propTypes$1O.exports.string
35122
+ value: propTypes$1O.exports.string,
35123
+ additionalText: propTypes$1O.exports.string
35018
35124
  });
35019
35125
  function SpsTextarea(_I) {
35020
35126
  var _J = _I, {
@@ -35030,7 +35136,8 @@ function SpsTextarea(_I) {
35030
35136
  rows = 2,
35031
35137
  "data-testid": testId,
35032
35138
  unsafelyReplaceClassName,
35033
- value = ""
35139
+ value = "",
35140
+ additionalText
35034
35141
  } = _J, rest = __objRest(_J, [
35035
35142
  "className",
35036
35143
  "disabled",
@@ -35044,7 +35151,8 @@ function SpsTextarea(_I) {
35044
35151
  "rows",
35045
35152
  "data-testid",
35046
35153
  "unsafelyReplaceClassName",
35047
- "value"
35154
+ "value",
35155
+ "additionalText"
35048
35156
  ]);
35049
35157
  const meta = formMeta || formControl2;
35050
35158
  const { wrapperId, controlId } = useFormControlId(id2, meta);
@@ -35092,7 +35200,9 @@ function SpsTextarea(_I) {
35092
35200
  "data-testid": `${testId}__input_clear`,
35093
35201
  className: "sps-icon sps-icon-x-circle sps-form-control__clear-btn",
35094
35202
  onClick: clear
35095
- })));
35203
+ })), additionalText && /* @__PURE__ */ React.createElement("p", {
35204
+ className: "sps-input__additional-text"
35205
+ }, additionalText));
35096
35206
  }
35097
35207
  Object.assign(SpsTextarea, {
35098
35208
  props: propsDoc$u,
@@ -35100,101 +35210,119 @@ Object.assign(SpsTextarea, {
35100
35210
  displayName: "SpsTextarea"
35101
35211
  });
35102
35212
  const SpsTextareaExamples = {
35213
+ general: {
35214
+ label: "General Usage",
35215
+ description: ({ NavigateTo }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h5", null, "Use a Text Area:"), /* @__PURE__ */ React.createElement("ul", null, /* @__PURE__ */ React.createElement("li", null, "When a value of considerable length (such as a sentence or paragraph) is required or accepted.")), /* @__PURE__ */ React.createElement("h5", null, "Do Not Use a Text Area:"), /* @__PURE__ */ React.createElement("ul", null, /* @__PURE__ */ React.createElement("li", null, "When the value required is short (a single word or short phrase). Use a", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
35216
+ to: "text-inputs"
35217
+ }, "Text Input"), " instead."), /* @__PURE__ */ React.createElement("li", null, "When more than one value is required or accepted in the field. Use", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
35218
+ to: "multi-select"
35219
+ }, "Multi-Select"), " instead."), /* @__PURE__ */ React.createElement("li", null, "When a boolean selection is required (such as on/off, yes/no, etc). Use", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
35220
+ to: "checkbox"
35221
+ }, "Checkboxes"), ",", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
35222
+ to: "radio-buttons"
35223
+ }, "Radio Buttons"), " or", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
35224
+ to: "toggle"
35225
+ }, "Toggles"), " instead.")))
35226
+ },
35103
35227
  basic: {
35104
- label: "Basic",
35105
- description: "info about basic text areas",
35228
+ label: "Basic Text Areas",
35229
+ description: () => /* @__PURE__ */ React.createElement("p", null, "Basic Text Areas include a label and a large input field. By default a Text Area is three lines tall, but the height can be adjusted."),
35106
35230
  examples: {
35107
- basic: {
35231
+ standard: {
35108
35232
  react: code`
35109
35233
  function DemoComponent() {
35110
- function numLinesValidator(n) {
35111
- return function(value) {
35112
- const lines = typeof value === "string" ? value.split("\\n").length : 0;
35113
- if (lines !== n) {
35114
- return {
35115
- numLines: {
35116
- actualLines: lines,
35117
- requiredLines: n
35118
- }
35119
- };
35120
- }
35121
- return null;
35122
- };
35123
- }
35234
+ const { formValue, formMeta, updateForm } = useSpsForm({ notes: "" });
35124
35235
 
35125
- const { formValue, formMeta, updateForm } = useSpsForm({
35126
- haiku: ""
35127
- }, {
35128
- "haiku": [numLinesValidator(3)]
35129
- });
35236
+ return (
35237
+ <div className="sfg-row">
35238
+ <div className="sfg-col-4">
35239
+ <SpsLabel for={formMeta.fields.notes}>Notes</SpsLabel>
35240
+ <SpsTextarea
35241
+ value={formValue.notes}
35242
+ formMeta={formMeta.fields.notes}
35243
+ rows={5}
35244
+ />
35245
+ </div>
35246
+ </div>
35247
+ );
35248
+ }
35249
+ `
35250
+ }
35251
+ }
35252
+ },
35253
+ placeholder: {
35254
+ label: "Placeholder Text",
35255
+ description: ({ NavigateTo }) => /* @__PURE__ */ React.createElement("p", null, "Certain inputs may benefit from placeholder text to aid the user in providing a valid value."),
35256
+ examples: {
35257
+ placeholder: {
35258
+ react: code`
35259
+ function DemoComponent() {
35260
+ const { formValue, formMeta, updateForm } = useSpsForm({ companyDescription: "" });
35130
35261
 
35131
- return <>
35132
- <SpsLabel for={formMeta.fields.haiku}
35133
- help="A haiku is a three-line poem of 5, 7, and 5 syllables respectively."
35134
- errors={() =>
35135
- formMeta.fields.haiku.hasError("numLines") && (
35136
- <>
35137
- You need {formMeta.fields.haiku.errors["numLines"].requiredLines} lines,
35138
- but you've only written {formMeta.fields.haiku.errors["numLines"].actualLines} lines!
35139
- </>
35140
- )
35141
- }>
35142
- Haiku
35143
- </SpsLabel>
35144
- <SpsTextarea placeholder="Write a haiku" rows={3}
35145
- formMeta={formMeta.fields.haiku}
35146
- value={formValue.haiku}
35147
- ></SpsTextarea>
35148
- </>
35262
+ return (
35263
+ <div className="sfg-row">
35264
+ <div className="sfg-col-4">
35265
+ <SpsLabel for={formMeta.fields.companyDescription}>Company Description</SpsLabel>
35266
+ <SpsTextarea
35267
+ value={formValue.companyDescription}
35268
+ formMeta={formMeta.fields.companyDescription}
35269
+ placeholder="Describe your company"
35270
+ />
35271
+ </div>
35272
+ </div>
35273
+ );
35149
35274
  }
35150
35275
  `
35151
35276
  }
35152
35277
  }
35153
35278
  },
35154
- b_description: {
35155
- label: "Description",
35156
- description: "info about text areas with descriptions",
35279
+ additional_text: {
35280
+ label: "Additional Descriptive Text",
35281
+ description: ({ NavigateTo }) => /* @__PURE__ */ React.createElement("p", null, "For occasions when additional context beyond a placeholder is required, text in the form of a short phrase can appear below the input."),
35157
35282
  examples: {
35158
- description: {
35283
+ placeholder: {
35159
35284
  react: code`
35160
35285
  function DemoComponent() {
35161
- const { formValue, formMeta, updateForm } = useSpsForm({
35162
- textareaWithDescription: ""
35163
- });
35286
+ const { formValue, formMeta, updateForm } = useSpsForm({ campaignNotes: "" });
35164
35287
 
35165
- return <>
35166
- <SpsLabel for={formMeta.fields.textareaWithDescription}
35167
- description="This is a brief description of the field to provide additional context."
35168
- >
35169
- Label
35170
- </SpsLabel>
35171
- <SpsTextarea formMeta={formMeta.fields.textareaWithDescription}
35172
- value={formValue.textareaWithDescription}
35173
- />
35174
- </>
35288
+ return (
35289
+ <div className="sfg-row">
35290
+ <div className="sfg-col-4">
35291
+ <SpsLabel for={formMeta.fields.campaignNotes}>Campaign Notes</SpsLabel>
35292
+ <SpsTextarea
35293
+ value={formValue.campaignNotes}
35294
+ formMeta={formMeta.fields.campaignNotes}
35295
+ additionalText="List any additional comments, questions or information about this campaign."
35296
+ />
35297
+ </div>
35298
+ </div>
35299
+ );
35175
35300
  }
35176
35301
  `
35177
35302
  }
35178
35303
  }
35179
35304
  },
35180
- c_disabled: {
35181
- label: "Disabled",
35182
- description: "info about disabled text areas",
35305
+ disabled: {
35306
+ label: "Disabled State",
35307
+ description: () => /* @__PURE__ */ React.createElement("p", null, "The Disabled State prevents a user from modifying the text input while still allowing visibility to its information."),
35183
35308
  examples: {
35184
- disabled: {
35309
+ standard: {
35185
35310
  react: code`
35186
35311
  function DemoComponent() {
35187
- const { formValue, formMeta, updateForm } = useSpsForm({
35188
- notes: "This is the value of the textarea but you can't edit it right now"
35189
- });
35312
+ const { formValue, formMeta, updateForm } = useSpsForm({ notes: "Some notes here" });
35190
35313
 
35191
- return <>
35192
- <SpsLabel for={formMeta.fields.notes}>Notes</SpsLabel>
35193
- <SpsTextarea disabled rows={5}
35194
- formMeta={formMeta.fields.notes}
35195
- value={formValue.notes}
35196
- ></SpsTextarea>
35197
- </>
35314
+ return (
35315
+ <div className="sfg-row">
35316
+ <div className="sfg-col-4">
35317
+ <SpsLabel for={formMeta.fields.notes}>Notes</SpsLabel>
35318
+ <SpsTextarea
35319
+ value={formValue.notes}
35320
+ formMeta={formMeta.fields.notes}
35321
+ disabled
35322
+ />
35323
+ </div>
35324
+ </div>
35325
+ );
35198
35326
  }
35199
35327
  `
35200
35328
  }
@@ -36273,13 +36401,13 @@ const SpsWorkflowExamples = {
36273
36401
  basic: {
36274
36402
  jsx: code`
36275
36403
  <div className="col-4">
36276
- <SpsWorkflow icon="list-summary" title="Workflow">
36277
- <SpsWorkflowStep icon="heart" title="Name of Step">
36404
+ <SpsWorkflow icon={SpsIcon.LIST_SUMMARY} title="Workflow">
36405
+ <SpsWorkflowStep icon={SpsIcon.HEART} title="Name of Step">
36278
36406
  <SpsWorkflowDocument>
36279
36407
  <a href="https://github.com/SPSCommerce/ui-angular" target="_blank">
36280
36408
  Document Name
36281
36409
  </a>
36282
- <SpsWorkflowDocumentStatus icon="status-error">
36410
+ <SpsWorkflowDocumentStatus icon={SpsIcon.STATUS_ERROR}>
36283
36411
  Status
36284
36412
  </SpsWorkflowDocumentStatus>
36285
36413
  </SpsWorkflowDocument>
@@ -36290,7 +36418,7 @@ const SpsWorkflowExamples = {
36290
36418
  </SpsWorkflowDocumentStatus>
36291
36419
  </SpsWorkflowDocument>
36292
36420
  </SpsWorkflowStep>
36293
- <SpsWorkflowStep icon="heart" title="Done">
36421
+ <SpsWorkflowStep icon={SpsIcon.HEART} title="Done">
36294
36422
  </SpsWorkflowStep>
36295
36423
  </SpsWorkflow>
36296
36424
  </div>
@@ -36304,13 +36432,13 @@ const SpsWorkflowExamples = {
36304
36432
  withAlias: {
36305
36433
  jsx: code`
36306
36434
  <div className="col-4">
36307
- <SpsWf icon="list-summary" title="Workflow">
36308
- <SpsWfStep icon="heart" title="Name of Step">
36435
+ <SpsWf icon={SpsIcon.LIST_SUMMARY} title="Workflow">
36436
+ <SpsWfStep icon={SpsIcon.HEART} title="Name of Step">
36309
36437
  <SpsWfDoc>
36310
36438
  <a href="https://github.com/SPSCommerce/ui-angular" target="_blank">
36311
36439
  Document Name
36312
36440
  </a>
36313
- <SpsWfDs icon="status-error">Status</SpsWfDs>
36441
+ <SpsWfDs icon={SpsIcon.STATUS_ERROR}>Status</SpsWfDs>
36314
36442
  </SpsWfDoc>
36315
36443
  <SpsWfDoc>
36316
36444
  Document Name
@@ -36319,7 +36447,7 @@ const SpsWorkflowExamples = {
36319
36447
  </SpsWfDs>
36320
36448
  </SpsWfDoc>
36321
36449
  </SpsWfStep>
36322
- <SpsWfStep icon="heart" title="Done">
36450
+ <SpsWfStep icon={SpsIcon.HEART} title="Done">
36323
36451
  </SpsWfStep>
36324
36452
  </SpsWf>
36325
36453
  </div>
@@ -37557,11 +37685,13 @@ const MANIFEST = {
37557
37685
  components: [SpsTaskQueue],
37558
37686
  examples: SpsTaskQueueExamples
37559
37687
  },
37560
- "Text Input": {
37688
+ "Text Inputs": {
37689
+ description: () => /* @__PURE__ */ React.createElement("p", null, "Text Inputs consist of a Label and a field in which a user enters a short value."),
37561
37690
  components: [SpsTextInput],
37562
37691
  examples: SpsTextInputExamples
37563
37692
  },
37564
- Textarea: {
37693
+ "Text Areas": {
37694
+ description: () => /* @__PURE__ */ React.createElement("p", null, "Text Areas consist of a Label and a field in which a user enters a long value."),
37565
37695
  components: [SpsTextarea],
37566
37696
  examples: SpsTextareaExamples
37567
37697
  },