@spscommerce/ds-react 5.21.5 → 5.23.1

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: "SpsFormArrayMeta<any> | SpsFormGroupMeta<any>",
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: propTypes$1O.exports.oneOfType([
291
- impl(),
292
- impl()
293
- ]),
290
+ formMeta: impl(),
294
291
  isOpen: propTypes$1O.exports.bool,
295
292
  onClear: fun(),
296
293
  onSubmit: fun()
@@ -25337,36 +25334,36 @@ const SpsInsightTileExamples = {
25337
25334
  kind={SpsInsightTileKind.GENERAL}
25338
25335
  metric="1234"
25339
25336
  title="Insight Tile Title"
25340
- partnerCount="250"
25341
- totalPartners="250"
25337
+ partnerCount={250}
25338
+ totalPartners={250}
25342
25339
  />
25343
25340
  <SpsInsightTile
25344
25341
  kind={SpsInsightTileKind.PROCESSING}
25345
25342
  metric="1234"
25346
25343
  title="Insight Tile Title"
25347
- partnerCount="122"
25348
- totalPartners="250"
25344
+ partnerCount={122}
25345
+ totalPartners={250}
25349
25346
  />
25350
25347
  <SpsInsightTile
25351
25348
  kind={SpsInsightTileKind.SUCCESS}
25352
25349
  metric="1234"
25353
25350
  title="Insight Tile Title"
25354
- partnerCount="207"
25355
- totalPartners="250"
25351
+ partnerCount={207}
25352
+ totalPartners={250}
25356
25353
  />
25357
25354
  <SpsInsightTile
25358
25355
  kind={SpsInsightTileKind.WARNING}
25359
25356
  metric="1234"
25360
25357
  title="Insight Tile Title"
25361
- partnerCount="12"
25362
- totalPartners="250"
25358
+ partnerCount={12}
25359
+ totalPartners={250}
25363
25360
  />
25364
25361
  <SpsInsightTile
25365
25362
  kind={SpsInsightTileKind.ERROR}
25366
25363
  metric="1234"
25367
25364
  title="Insight Tile Title"
25368
- partnerCount="94"
25369
- totalPartners="250"
25365
+ partnerCount={94}
25366
+ totalPartners={250}
25370
25367
  />
25371
25368
  </SpsInsights>
25372
25369
  `
@@ -25453,8 +25450,8 @@ const SpsInsightTileExamples = {
25453
25450
  kind={SpsInsightTileKind.GENERAL}
25454
25451
  metric="1234"
25455
25452
  title="Insight Tile Title"
25456
- partnerCount="100"
25457
- totalPartners="200"
25453
+ partnerCount={100}
25454
+ totalPartners={200}
25458
25455
  horizontal
25459
25456
  >
25460
25457
  <span className="gray600 font-weight-bold">Detail:</span> 792 units
@@ -25463,16 +25460,16 @@ const SpsInsightTileExamples = {
25463
25460
  kind={SpsInsightTileKind.PROCESSING}
25464
25461
  metric="1234"
25465
25462
  title="Insight Tile Title"
25466
- partnerCount="100"
25467
- totalPartners="200"
25463
+ partnerCount={100}
25464
+ totalPartners={200}
25468
25465
  horizontal
25469
25466
  />
25470
25467
  <SpsInsightTile
25471
25468
  kind={SpsInsightTileKind.SUCCESS}
25472
25469
  metric="1234"
25473
25470
  title="Insight Tile Title"
25474
- partnerCount="100"
25475
- totalPartners="200"
25471
+ partnerCount={100}
25472
+ totalPartners={200}
25476
25473
  horizontal
25477
25474
  >
25478
25475
  <span className="gray600 font-weight-bold">Detail:</span> 792 units
@@ -25481,16 +25478,16 @@ const SpsInsightTileExamples = {
25481
25478
  kind={SpsInsightTileKind.WARNING}
25482
25479
  metric="1234"
25483
25480
  title="Insight Tile Title"
25484
- partnerCount="100"
25485
- totalPartners="200"
25481
+ partnerCount={100}
25482
+ totalPartners={200}
25486
25483
  horizontal
25487
25484
  />
25488
25485
  <SpsInsightTile
25489
25486
  kind={SpsInsightTileKind.ERROR}
25490
25487
  metric="1234"
25491
25488
  title="Insight Tile Title"
25492
- partnerCount="100"
25493
- totalPartners="200"
25489
+ partnerCount={100}
25490
+ totalPartners={200}
25494
25491
  horizontal
25495
25492
  >
25496
25493
  <span className="gray600 font-weight-bold">Detail:</span> 792 units
@@ -26166,6 +26163,8 @@ const usePinnedTableBackgroundStyle = (containerRef) => {
26166
26163
  React.useLayoutEffect(() => {
26167
26164
  if (containerRef.current) {
26168
26165
  const pinnedThs = containerRef.current.querySelectorAll("table > thead > tr:first-child > .sps-table__cell--pinned");
26166
+ const verticalScrollbarWidth = containerRef.current.offsetWidth - containerRef.current.clientWidth;
26167
+ const horizontalScrollbarHeight = containerRef.current.offsetHeight - containerRef.current.clientHeight;
26169
26168
  if (pinnedThs.length > 0) {
26170
26169
  const leftPinnedThs = [];
26171
26170
  const rightPinnedThs = [];
@@ -26187,12 +26186,18 @@ const usePinnedTableBackgroundStyle = (containerRef) => {
26187
26186
  });
26188
26187
  const leftPinnedWidth = leftPinnedThs.reduce((acc, th) => acc + th.clientWidth, 0);
26189
26188
  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`;
26189
+ containerRef.current.style.backgroundPosition = `${leftPinnedWidth}px 0,
26190
+ calc(100% - ${rightPinnedWidth}px) 0,
26191
+ ${leftPinnedWidth}px ${-horizontalScrollbarHeight}px,
26192
+ calc(100% - ${rightPinnedWidth + verticalScrollbarWidth}px) ${-horizontalScrollbarHeight}px`;
26193
+ } else {
26194
+ containerRef.current.style.backgroundPosition = `0 0, 100% 0, 0 ${-horizontalScrollbarHeight}px,
26195
+ calc(100% - ${verticalScrollbarWidth}px) ${-horizontalScrollbarHeight}px`;
26191
26196
  }
26192
26197
  }
26193
26198
  });
26194
26199
  };
26195
- const usePinnedTableHeadStyle = (containerRef) => {
26200
+ const usePinnedTableHeadStyle = (containerRef, maxHeight) => {
26196
26201
  React.useLayoutEffect(() => {
26197
26202
  const container = containerRef.current;
26198
26203
  const headElement = container == null ? void 0 : container.querySelector("thead");
@@ -26205,8 +26210,8 @@ const usePinnedTableHeadStyle = (containerRef) => {
26205
26210
  let scrollableParent = null;
26206
26211
  const resetAppliedStyles = () => {
26207
26212
  if (headElement) {
26208
- headElement.style.position = null;
26209
- headElement.style.top = null;
26213
+ headElement.style.position = maxHeight ? "sticky" : null;
26214
+ headElement.style.top = maxHeight ? "0" : null;
26210
26215
  headElement.style.overflow = null;
26211
26216
  headElement.style.maxWidth = null;
26212
26217
  headElement.style.width = null;
@@ -26244,7 +26249,8 @@ const usePinnedTableHeadStyle = (containerRef) => {
26244
26249
  headElement.style.position = "fixed";
26245
26250
  headElement.style.top = `${topPosition}px`;
26246
26251
  headElement.style.overflow = "hidden";
26247
- const headElementWidth = `${containerRect.width}px`;
26252
+ const verticalScrollbarWidth = containerRef.current.offsetWidth - containerRef.current.clientWidth;
26253
+ const headElementWidth = `${containerRect.width - verticalScrollbarWidth}px`;
26248
26254
  headElement.style.maxWidth = headElementWidth;
26249
26255
  headElement.style.width = headElementWidth;
26250
26256
  headElement.style.minWidth = headElementWidth;
@@ -26299,6 +26305,52 @@ const usePinnedTableHeadStyle = (containerRef) => {
26299
26305
  };
26300
26306
  });
26301
26307
  };
26308
+ const useMaxHeightTableStyle = (containerRef, maxHeight) => {
26309
+ const applyVerticalScrollShadow = () => {
26310
+ const container = containerRef.current;
26311
+ const tableHead = container == null ? void 0 : container.querySelector("table > thead");
26312
+ const table = container == null ? void 0 : container.querySelector("table");
26313
+ const shadowTop = container == null ? void 0 : container.querySelector(".shadow--top");
26314
+ const shadowBottom = container == null ? void 0 : container.querySelector(".shadow--bottom");
26315
+ if (tableHead && table && shadowTop && shadowBottom) {
26316
+ shadowBottom.style.left = "0";
26317
+ shadowBottom.style.bottom = "0";
26318
+ shadowTop.style.left = "0";
26319
+ const horizontalScrollbarHeight = container.offsetHeight - (container == null ? void 0 : container.clientHeight);
26320
+ const tableHeight = table.getBoundingClientRect().height;
26321
+ const tableHeadHeight = tableHead.getBoundingClientRect().height;
26322
+ const containerScrollTop = container.scrollTop;
26323
+ const containerScrollBottom = tableHeight + horizontalScrollbarHeight - container.getBoundingClientRect().height - container.scrollTop;
26324
+ const containerScrollLeft = container.scrollLeft;
26325
+ shadowBottom.style.bottom = `${-containerScrollTop}px`;
26326
+ shadowBottom.style.left = `${containerScrollLeft}px`;
26327
+ shadowBottom.style.opacity = containerScrollBottom > 0 ? "1" : "0";
26328
+ shadowTop.style.top = `${containerScrollTop + tableHeadHeight}px`;
26329
+ shadowTop.style.left = `${containerScrollLeft}px`;
26330
+ shadowTop.style.opacity = containerScrollTop > 0 ? "1" : "0";
26331
+ }
26332
+ };
26333
+ React.useLayoutEffect(() => {
26334
+ if (containerRef.current && maxHeight) {
26335
+ const tableHead = containerRef.current.querySelector("table > thead");
26336
+ if (tableHead) {
26337
+ tableHead.style.position = "sticky";
26338
+ tableHead.style.top = "0";
26339
+ tableHead.style.zIndex = "2";
26340
+ tableHead.style.backgroundColor = "#fff";
26341
+ }
26342
+ containerRef.current.addEventListener("scroll", applyVerticalScrollShadow);
26343
+ return () => {
26344
+ containerRef.current.removeEventListener("scroll", applyVerticalScrollShadow);
26345
+ };
26346
+ }
26347
+ }, []);
26348
+ React.useLayoutEffect(() => {
26349
+ if (containerRef.current && maxHeight) {
26350
+ applyVerticalScrollShadow();
26351
+ }
26352
+ });
26353
+ };
26302
26354
  const propsDoc$13 = {
26303
26355
  controlCell: "boolean",
26304
26356
  currentSort: "Array<SortedColumn>",
@@ -26492,12 +26544,16 @@ Object.assign(SpsThead, {
26492
26544
  const propsDoc$10 = {
26493
26545
  sort: "SortedColumn",
26494
26546
  onSortChange: "SortChangeHandler",
26495
- selectable: "boolean"
26547
+ selectable: "boolean",
26548
+ maxHeightPx: "number",
26549
+ maxHeightRem: "number"
26496
26550
  };
26497
26551
  const propTypes$13 = __spreadProps(__spreadValues({}, spsGlobalPropTypes), {
26498
26552
  onSortChange: fun(),
26499
26553
  sort: propTypes$1O.exports.arrayOf(impl()),
26500
- selectable: propTypes$1O.exports.bool
26554
+ selectable: propTypes$1O.exports.bool,
26555
+ maxHeightPx: propTypes$1O.exports.number,
26556
+ maxHeightRem: propTypes$1O.exports.number
26501
26557
  });
26502
26558
  function SpsTable(props2) {
26503
26559
  const _a = props2, {
@@ -26506,14 +26562,18 @@ function SpsTable(props2) {
26506
26562
  onSortChange,
26507
26563
  sort,
26508
26564
  "data-testid": testId,
26509
- unsafelyReplaceClassName
26565
+ unsafelyReplaceClassName,
26566
+ maxHeightPx,
26567
+ maxHeightRem
26510
26568
  } = _a, rest = __objRest(_a, [
26511
26569
  "children",
26512
26570
  "className",
26513
26571
  "onSortChange",
26514
26572
  "sort",
26515
26573
  "data-testid",
26516
- "unsafelyReplaceClassName"
26574
+ "unsafelyReplaceClassName",
26575
+ "maxHeightPx",
26576
+ "maxHeightRem"
26517
26577
  ]);
26518
26578
  const [currentSort, setSort] = React.useState(sort);
26519
26579
  const updateSortingDisplay = (newSort) => {
@@ -26535,13 +26595,21 @@ function SpsTable(props2) {
26535
26595
  currentSort
26536
26596
  };
26537
26597
  const classes = clsx(unsafelyReplaceClassName || "sps-table-container", className);
26598
+ const maxHeight = maxHeightPx ? maxHeightPx / 16 : maxHeightRem;
26599
+ const tableContainerInlineStyles = maxHeight ? { maxHeight: `${maxHeight}rem` } : {};
26538
26600
  const containerRef = React.useRef(null);
26601
+ useMaxHeightTableStyle(containerRef, maxHeight);
26539
26602
  usePinnedTableBackgroundStyle(containerRef);
26540
- usePinnedTableHeadStyle(containerRef);
26603
+ usePinnedTableHeadStyle(containerRef, maxHeight);
26541
26604
  return /* @__PURE__ */ React.createElement("div", {
26542
26605
  ref: containerRef,
26543
- className: classes
26544
- }, /* @__PURE__ */ React.createElement("table", __spreadValues({
26606
+ className: classes,
26607
+ style: tableContainerInlineStyles
26608
+ }, /* @__PURE__ */ React.createElement("div", {
26609
+ className: "sps-table__shadow shadow--top"
26610
+ }), /* @__PURE__ */ React.createElement("div", {
26611
+ className: "sps-table__shadow shadow--bottom"
26612
+ }), /* @__PURE__ */ React.createElement("table", __spreadValues({
26545
26613
  className: "sps-table",
26546
26614
  role: "table",
26547
26615
  "data-testid": `${testId}`
@@ -27278,10 +27346,10 @@ const SpsTableExamples = {
27278
27346
  <SpsTable>
27279
27347
  <SpsTableHead>
27280
27348
  <SpsTableRow>
27281
- <SpsTableHeader ></SpsTableHeader>
27282
- <SpsTableHeader >Title</SpsTableHeader>
27349
+ <SpsTableHeader controlCell></SpsTableHeader>
27350
+ <SpsTableHeader>Title</SpsTableHeader>
27283
27351
  <SpsTableHeader>Year</SpsTableHeader>
27284
- <SpsTableHeader >Director</SpsTableHeader>
27352
+ <SpsTableHeader>Director</SpsTableHeader>
27285
27353
  <SpsTableHeader>Countries</SpsTableHeader>
27286
27354
  </SpsTableRow>
27287
27355
  </SpsTableHead>
@@ -27289,7 +27357,7 @@ const SpsTableExamples = {
27289
27357
  {items.map((row, index) => {
27290
27358
  return (
27291
27359
  <SpsTableRow key={index}>
27292
- <SpsTableCell><SpsCheckbox/></SpsTableCell>
27360
+ <SpsTableCell controlCell><SpsCheckbox/></SpsTableCell>
27293
27361
  <SpsTableCell>{row["title"]}</SpsTableCell>
27294
27362
  <SpsTableCell>{row["year"]}</SpsTableCell>
27295
27363
  <SpsTableCell>{row["director"]}</SpsTableCell>
@@ -27378,7 +27446,7 @@ const SpsTableExamples = {
27378
27446
  <SpsTableCell>{row["year"]}</SpsTableCell>
27379
27447
  <SpsTableCell>{row["director"]}</SpsTableCell>
27380
27448
  <SpsTableCell className="text-right" buttonCell>
27381
- <SpsButton kind="icon" icon="ellipses" />
27449
+ <SpsButton kind={ButtonKind.ICON} icon={SpsIcon.ELLIPSES} />
27382
27450
  </SpsTableCell>
27383
27451
  </SpsTableRow>
27384
27452
  );
@@ -27533,7 +27601,7 @@ const SpsTableExamples = {
27533
27601
  <SpsTableCell>{row["aspect_ratio"]}</SpsTableCell>
27534
27602
  <SpsTableCell>\${row["price"]}</SpsTableCell>
27535
27603
  <SpsTableCell className="text-right" buttonCell pinned>
27536
- <SpsButton kind="icon" icon="ellipses" />
27604
+ <SpsButton kind={ButtonKind.ICON} icon={SpsIcon.ELLIPSES} />
27537
27605
  </SpsTableCell>
27538
27606
  </SpsTableRow>
27539
27607
  )
@@ -33211,6 +33279,7 @@ const SpsSideNavExamples = {
33211
33279
  titleIcon={SpsIcon.STATUS_OK}
33212
33280
  navOptions={items}
33213
33281
  onNavChange={onChange}
33282
+ activeNavItem="Navigation Item 2"
33214
33283
  />
33215
33284
  </div>
33216
33285
  </div>
@@ -33564,28 +33633,33 @@ const SpsSpinnerExamples = {
33564
33633
  basic: {
33565
33634
  examples: {
33566
33635
  small: {
33567
- jsx: code`
33568
- <React.Fragment>
33569
- <SpsSpinner size="small"/>
33570
- <SpsSpinner size={SpinnerSize.SMALL}/>
33571
- </React.Fragment>
33636
+ react: code`
33637
+ function Component() {
33638
+ return (
33639
+ <SpsSpinner size={SpinnerSize.SMALL} title="Please wait…" />
33640
+ );
33641
+ }
33572
33642
  `
33573
33643
  },
33574
33644
  medium: {
33575
- jsx: code`
33576
- <React.Fragment>
33577
- <SpsSpinner />
33578
- <SpsSpinner size="medium" title="Please wait…"/>
33579
- <SpsSpinner size={SpinnerSize.MEDIUM}/>
33580
- </React.Fragment>
33645
+ react: code`
33646
+ function Component() {
33647
+ return (
33648
+ <>
33649
+ <SpsSpinner />
33650
+ <SpsSpinner size={SpinnerSize.MEDIUM} title="Please wait…" />
33651
+ </>
33652
+ );
33653
+ }
33581
33654
  `
33582
33655
  },
33583
33656
  large: {
33584
- jsx: code`
33585
- <React.Fragment>
33586
- <SpsSpinner size="large"/>
33587
- <SpsSpinner size={SpinnerSize.LARGE} alt="Loading content…"/>
33588
- </React.Fragment>
33657
+ react: code`
33658
+ function Component() {
33659
+ return (
33660
+ <SpsSpinner size={SpinnerSize.LARGE} alt="Loading content…" />
33661
+ );
33662
+ }
33589
33663
  `
33590
33664
  }
33591
33665
  }
@@ -34740,11 +34814,9 @@ const SpsTaskQueueExamples = {
34740
34814
  }
34741
34815
  ]);
34742
34816
 
34743
- const form = useForm(
34744
- formGroup({
34745
- blueTooltip: formControl(false)
34746
- })
34747
- );
34817
+ const { formValue, formMeta } = useSpsForm({
34818
+ blueTooltip: false
34819
+ });
34748
34820
 
34749
34821
  function handleAddTask() {
34750
34822
  const newTaskId = generateTaskId();
@@ -34771,7 +34843,7 @@ const SpsTaskQueueExamples = {
34771
34843
  setTasks(currentTasks => currentTasks.map(task => ({ ...task, unread: false })));
34772
34844
  }
34773
34845
 
34774
- const isTooltipBlue = form.get("blueTooltip").getValue();
34846
+ const isTooltipBlue = formValue.blueTooltip;
34775
34847
  const tooltipKind = isTooltipBlue ? TooltipKind.HELP : TooltipKind.DEFAULT;
34776
34848
  const notificationText = isTooltipBlue
34777
34849
  ? "There is a new task in your queue. Also the tooltip is blue now :O"
@@ -34780,7 +34852,7 @@ const SpsTaskQueueExamples = {
34780
34852
  return (
34781
34853
  <div style={{ display: "flex", justifyContent: "space-between" }}>
34782
34854
  <div>
34783
- <SpsCheckbox label="Blue Tooltip" formControl={form.get("blueTooltip")} />
34855
+ <SpsCheckbox label="Blue Tooltip" formMeta={formMeta.fields.blueTooltip} />
34784
34856
  <SpsButton onClick={handleAddTask}>Add a new task to the queue</SpsButton>
34785
34857
  </div>
34786
34858
 
@@ -34806,7 +34878,8 @@ const propsDoc$v = {
34806
34878
  name: "string",
34807
34879
  onChange: "ChangeEventHandler<HTMLInputElement>",
34808
34880
  placeholder: "string",
34809
- value: "string"
34881
+ value: "string",
34882
+ additionalText: "string"
34810
34883
  };
34811
34884
  const propTypes$x = __spreadProps(__spreadValues({}, spsGlobalPropTypes), {
34812
34885
  disabled: propTypes$1O.exports.bool,
@@ -34816,7 +34889,8 @@ const propTypes$x = __spreadProps(__spreadValues({}, spsGlobalPropTypes), {
34816
34889
  name: propTypes$1O.exports.string,
34817
34890
  onChange: fun(),
34818
34891
  placeholder: propTypes$1O.exports.string,
34819
- value: propTypes$1O.exports.string
34892
+ value: propTypes$1O.exports.string,
34893
+ additionalText: propTypes$1O.exports.string
34820
34894
  });
34821
34895
  const SpsTextInput = React.forwardRef((_G, ref2) => {
34822
34896
  var _H = _G, {
@@ -34832,7 +34906,8 @@ const SpsTextInput = React.forwardRef((_G, ref2) => {
34832
34906
  "data-testid": testId,
34833
34907
  title,
34834
34908
  unsafelyReplaceClassName,
34835
- value = ""
34909
+ value = "",
34910
+ additionalText
34836
34911
  } = _H, rest = __objRest(_H, [
34837
34912
  "className",
34838
34913
  "disabled",
@@ -34846,7 +34921,8 @@ const SpsTextInput = React.forwardRef((_G, ref2) => {
34846
34921
  "data-testid",
34847
34922
  "title",
34848
34923
  "unsafelyReplaceClassName",
34849
- "value"
34924
+ "value",
34925
+ "additionalText"
34850
34926
  ]);
34851
34927
  const meta = formMeta || formControl2;
34852
34928
  const { wrapperId, controlId } = useFormControlId(id2, meta);
@@ -34897,7 +34973,9 @@ const SpsTextInput = React.forwardRef((_G, ref2) => {
34897
34973
  "data-testid": `${testId}__input_clear`,
34898
34974
  className: "sps-icon sps-icon-x-circle sps-form-control__clear-btn",
34899
34975
  onClick: clear
34900
- })));
34976
+ })), additionalText && /* @__PURE__ */ React.createElement("p", {
34977
+ className: "sps-input__additional-text"
34978
+ }, additionalText));
34901
34979
  });
34902
34980
  Object.assign(SpsTextInput, {
34903
34981
  props: propsDoc$v,
@@ -34905,91 +34983,118 @@ Object.assign(SpsTextInput, {
34905
34983
  displayName: "SpsTextInput"
34906
34984
  });
34907
34985
  const SpsTextInputExamples = {
34908
- standard: {
34909
- label: "Standard",
34910
- description: "info about standard text inputs",
34986
+ general: {
34987
+ label: "General Usage",
34988
+ 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, {
34989
+ to: "text-areas"
34990
+ }, "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, {
34991
+ to: "multi-select"
34992
+ }, "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, {
34993
+ to: "checkbox"
34994
+ }, "Checkboxes"), ",", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
34995
+ to: "radio-buttons"
34996
+ }, "Radio Buttons"), " or", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
34997
+ to: "toggle"
34998
+ }, "Toggles"), " instead.")))
34999
+ },
35000
+ basic: {
35001
+ label: "Basic Text Inputs",
35002
+ description: () => /* @__PURE__ */ React.createElement("p", null, "Basic Text Inputs include a label and an input field."),
34911
35003
  examples: {
34912
35004
  standard: {
34913
35005
  react: code`
34914
35006
  function DemoComponent() {
34915
- const { formValue, formMeta, updateForm } = useSpsForm({ foo: "bar" });
35007
+ const { formValue, formMeta, updateForm } = useSpsForm({ companyName: "" });
34916
35008
 
34917
- return <>
34918
- <SpsLabel for={formMeta.fields.foo}>Foo</SpsLabel>
34919
- <SpsTextInput
34920
- value={formValue.foo}
34921
- formMeta={formMeta.fields.foo}
34922
- />
34923
- </>;
35009
+ return (
35010
+ <div className="sfg-row">
35011
+ <div className="sfg-col-4">
35012
+ <SpsLabel for={formMeta.fields.companyName}>Company Name</SpsLabel>
35013
+ <SpsTextInput
35014
+ value={formValue.companyName}
35015
+ formMeta={formMeta.fields.companyName}
35016
+ />
35017
+ </div>
35018
+ </div>
35019
+ );
34924
35020
  }
34925
35021
  `
34926
35022
  }
34927
35023
  }
34928
35024
  },
34929
- b_placeholder: {
34930
- label: "Placeholder",
34931
- description: "info about text input placeholders",
35025
+ placeholder: {
35026
+ label: "Placeholder Text",
35027
+ description: ({ NavigateTo }) => /* @__PURE__ */ React.createElement("p", null, "Certain inputs may benefit from placeholder text to aid the user in providing a valid value."),
34932
35028
  examples: {
34933
35029
  placeholder: {
34934
35030
  react: code`
34935
35031
  function DemoComponent() {
34936
- const { formValue, formMeta, updateForm } = useSpsForm({ foo: "bar" });
35032
+ const { formValue, formMeta, updateForm } = useSpsForm({ phoneNumber: "" });
34937
35033
 
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
- </>
35034
+ return (
35035
+ <div className="sfg-row">
35036
+ <div className="sfg-col-4">
35037
+ <SpsLabel for={formMeta.fields.phoneNumber}>Phone Number</SpsLabel>
35038
+ <SpsTextInput
35039
+ value={formValue.phoneNumber}
35040
+ formMeta={formMeta.fields.phoneNumber}
35041
+ placeholder="(000) 000-0000"
35042
+ />
35043
+ </div>
35044
+ </div>
35045
+ );
34947
35046
  }
34948
35047
  `
34949
35048
  }
34950
35049
  }
34951
35050
  },
34952
- c_description: {
34953
- label: "Description",
34954
- description: "info about text inputs with descriptions",
35051
+ additional_text: {
35052
+ label: "Additional Descriptive Text",
35053
+ 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
35054
  examples: {
34956
- description: {
35055
+ placeholder: {
34957
35056
  react: code`
34958
35057
  function DemoComponent() {
34959
- const { formValue, formMeta, updateForm } = useSpsForm({ foo: "bar" });
35058
+ const { formValue, formMeta, updateForm } = useSpsForm({ password: "" });
34960
35059
 
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
- </>
35060
+ return (
35061
+ <div className="sfg-row">
35062
+ <div className="sfg-col-4">
35063
+ <SpsLabel for={formMeta.fields.password}>Password</SpsLabel>
35064
+ <SpsTextInput
35065
+ value={formValue.password}
35066
+ formMeta={formMeta.fields.password}
35067
+ additionalText="Password must be 8-12 characters in length and include: 1 capital letter, 1 number and 1 special character"
35068
+ />
35069
+ </div>
35070
+ </div>
35071
+ );
34970
35072
  }
34971
35073
  `
34972
35074
  }
34973
35075
  }
34974
35076
  },
34975
- d_disabled: {
34976
- label: "Disabled",
34977
- description: "info about disabled text inputs",
35077
+ disabled: {
35078
+ label: "Disabled State",
35079
+ 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
35080
  examples: {
34979
- disabled: {
35081
+ standard: {
34980
35082
  react: code`
34981
35083
  function DemoComponent() {
34982
- const { formValue, formMeta, updateForm } = useSpsForm({ email: "foo@bar.com" });
35084
+ const { formValue, formMeta, updateForm } = useSpsForm({ companyName: "FGL Sports" });
34983
35085
 
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
- </>
35086
+ return (
35087
+ <div className="sfg-row">
35088
+ <div className="sfg-col-4">
35089
+ <SpsLabel for={formMeta.fields.companyName}>Company Name</SpsLabel>
35090
+ <SpsTextInput
35091
+ value={formValue.companyName}
35092
+ formMeta={formMeta.fields.companyName}
35093
+ disabled
35094
+ />
35095
+ </div>
35096
+ </div>
35097
+ );
34993
35098
  }
34994
35099
  `
34995
35100
  }
@@ -35003,7 +35108,8 @@ const propsDoc$u = {
35003
35108
  onChange: "ChangeEventHandler",
35004
35109
  placeholder: "string",
35005
35110
  rows: "number",
35006
- value: "string"
35111
+ value: "string",
35112
+ additionalText: "string"
35007
35113
  };
35008
35114
  const propTypes$w = __spreadProps(__spreadValues({}, spsGlobalPropTypes), {
35009
35115
  disabled: propTypes$1O.exports.bool,
@@ -35014,7 +35120,8 @@ const propTypes$w = __spreadProps(__spreadValues({}, spsGlobalPropTypes), {
35014
35120
  placeholder: propTypes$1O.exports.string,
35015
35121
  ref: ref(),
35016
35122
  rows: propTypes$1O.exports.number,
35017
- value: propTypes$1O.exports.string
35123
+ value: propTypes$1O.exports.string,
35124
+ additionalText: propTypes$1O.exports.string
35018
35125
  });
35019
35126
  function SpsTextarea(_I) {
35020
35127
  var _J = _I, {
@@ -35030,7 +35137,8 @@ function SpsTextarea(_I) {
35030
35137
  rows = 2,
35031
35138
  "data-testid": testId,
35032
35139
  unsafelyReplaceClassName,
35033
- value = ""
35140
+ value = "",
35141
+ additionalText
35034
35142
  } = _J, rest = __objRest(_J, [
35035
35143
  "className",
35036
35144
  "disabled",
@@ -35044,7 +35152,8 @@ function SpsTextarea(_I) {
35044
35152
  "rows",
35045
35153
  "data-testid",
35046
35154
  "unsafelyReplaceClassName",
35047
- "value"
35155
+ "value",
35156
+ "additionalText"
35048
35157
  ]);
35049
35158
  const meta = formMeta || formControl2;
35050
35159
  const { wrapperId, controlId } = useFormControlId(id2, meta);
@@ -35092,7 +35201,9 @@ function SpsTextarea(_I) {
35092
35201
  "data-testid": `${testId}__input_clear`,
35093
35202
  className: "sps-icon sps-icon-x-circle sps-form-control__clear-btn",
35094
35203
  onClick: clear
35095
- })));
35204
+ })), additionalText && /* @__PURE__ */ React.createElement("p", {
35205
+ className: "sps-input__additional-text"
35206
+ }, additionalText));
35096
35207
  }
35097
35208
  Object.assign(SpsTextarea, {
35098
35209
  props: propsDoc$u,
@@ -35100,101 +35211,119 @@ Object.assign(SpsTextarea, {
35100
35211
  displayName: "SpsTextarea"
35101
35212
  });
35102
35213
  const SpsTextareaExamples = {
35214
+ general: {
35215
+ label: "General Usage",
35216
+ 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, {
35217
+ to: "text-inputs"
35218
+ }, "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, {
35219
+ to: "multi-select"
35220
+ }, "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, {
35221
+ to: "checkbox"
35222
+ }, "Checkboxes"), ",", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
35223
+ to: "radio-buttons"
35224
+ }, "Radio Buttons"), " or", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
35225
+ to: "toggle"
35226
+ }, "Toggles"), " instead.")))
35227
+ },
35103
35228
  basic: {
35104
- label: "Basic",
35105
- description: "info about basic text areas",
35229
+ label: "Basic Text Areas",
35230
+ 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
35231
  examples: {
35107
- basic: {
35232
+ standard: {
35108
35233
  react: code`
35109
35234
  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
- }
35235
+ const { formValue, formMeta, updateForm } = useSpsForm({ notes: "" });
35124
35236
 
35125
- const { formValue, formMeta, updateForm } = useSpsForm({
35126
- haiku: ""
35127
- }, {
35128
- "haiku": [numLinesValidator(3)]
35129
- });
35237
+ return (
35238
+ <div className="sfg-row">
35239
+ <div className="sfg-col-4">
35240
+ <SpsLabel for={formMeta.fields.notes}>Notes</SpsLabel>
35241
+ <SpsTextarea
35242
+ value={formValue.notes}
35243
+ formMeta={formMeta.fields.notes}
35244
+ rows={5}
35245
+ />
35246
+ </div>
35247
+ </div>
35248
+ );
35249
+ }
35250
+ `
35251
+ }
35252
+ }
35253
+ },
35254
+ placeholder: {
35255
+ label: "Placeholder Text",
35256
+ description: ({ NavigateTo }) => /* @__PURE__ */ React.createElement("p", null, "Certain inputs may benefit from placeholder text to aid the user in providing a valid value."),
35257
+ examples: {
35258
+ placeholder: {
35259
+ react: code`
35260
+ function DemoComponent() {
35261
+ const { formValue, formMeta, updateForm } = useSpsForm({ companyDescription: "" });
35130
35262
 
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
- </>
35263
+ return (
35264
+ <div className="sfg-row">
35265
+ <div className="sfg-col-4">
35266
+ <SpsLabel for={formMeta.fields.companyDescription}>Company Description</SpsLabel>
35267
+ <SpsTextarea
35268
+ value={formValue.companyDescription}
35269
+ formMeta={formMeta.fields.companyDescription}
35270
+ placeholder="Describe your company"
35271
+ />
35272
+ </div>
35273
+ </div>
35274
+ );
35149
35275
  }
35150
35276
  `
35151
35277
  }
35152
35278
  }
35153
35279
  },
35154
- b_description: {
35155
- label: "Description",
35156
- description: "info about text areas with descriptions",
35280
+ additional_text: {
35281
+ label: "Additional Descriptive Text",
35282
+ 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
35283
  examples: {
35158
- description: {
35284
+ placeholder: {
35159
35285
  react: code`
35160
35286
  function DemoComponent() {
35161
- const { formValue, formMeta, updateForm } = useSpsForm({
35162
- textareaWithDescription: ""
35163
- });
35287
+ const { formValue, formMeta, updateForm } = useSpsForm({ campaignNotes: "" });
35164
35288
 
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
- </>
35289
+ return (
35290
+ <div className="sfg-row">
35291
+ <div className="sfg-col-4">
35292
+ <SpsLabel for={formMeta.fields.campaignNotes}>Campaign Notes</SpsLabel>
35293
+ <SpsTextarea
35294
+ value={formValue.campaignNotes}
35295
+ formMeta={formMeta.fields.campaignNotes}
35296
+ additionalText="List any additional comments, questions or information about this campaign."
35297
+ />
35298
+ </div>
35299
+ </div>
35300
+ );
35175
35301
  }
35176
35302
  `
35177
35303
  }
35178
35304
  }
35179
35305
  },
35180
- c_disabled: {
35181
- label: "Disabled",
35182
- description: "info about disabled text areas",
35306
+ disabled: {
35307
+ label: "Disabled State",
35308
+ 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
35309
  examples: {
35184
- disabled: {
35310
+ standard: {
35185
35311
  react: code`
35186
35312
  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
- });
35313
+ const { formValue, formMeta, updateForm } = useSpsForm({ notes: "Some notes here" });
35190
35314
 
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
- </>
35315
+ return (
35316
+ <div className="sfg-row">
35317
+ <div className="sfg-col-4">
35318
+ <SpsLabel for={formMeta.fields.notes}>Notes</SpsLabel>
35319
+ <SpsTextarea
35320
+ value={formValue.notes}
35321
+ formMeta={formMeta.fields.notes}
35322
+ disabled
35323
+ />
35324
+ </div>
35325
+ </div>
35326
+ );
35198
35327
  }
35199
35328
  `
35200
35329
  }
@@ -35481,9 +35610,9 @@ const SpsTileListExamples = {
35481
35610
 
35482
35611
  // custom sort by status
35483
35612
  if (key === 'status') {
35484
- if (a.error + a.warning < b.error + b.warning) {
35613
+ if (+a.error + +a.warning < +b.error + +b.warning) {
35485
35614
  return direction === SortDirection.ASCENDING ? -1 : 1;
35486
- } else if (a.error + a.warning > b.error + b.warning) {
35615
+ } else if (+a.error + +a.warning > +b.error + +b.warning) {
35487
35616
  return direction === SortDirection.ASCENDING ? 1 : -1;
35488
35617
  }
35489
35618
  }
@@ -37061,16 +37190,13 @@ const SpsFilterPanelExamples = {
37061
37190
  const propsDoc$c = {
37062
37191
  value: "string",
37063
37192
  placeholder: "string",
37064
- formMeta: "SpsFormArrayMeta<any> | SpsFormGroupMeta<any>",
37193
+ formMeta: "SpsFormFieldMeta<string>",
37065
37194
  onFilterChange: "ChangeEventHandler<HTMLInputElement>"
37066
37195
  };
37067
37196
  const propTypes$e = __spreadProps(__spreadValues({}, spsGlobalPropTypes), {
37068
37197
  value: propTypes$1O.exports.string,
37069
37198
  placeholder: propTypes$1O.exports.string,
37070
- formMeta: propTypes$1O.exports.oneOfType([
37071
- impl(),
37072
- impl()
37073
- ]),
37199
+ formMeta: impl(),
37074
37200
  onFilterChange: fun()
37075
37201
  });
37076
37202
  function SpsFilterPanelFilterBox(_Q) {
@@ -37557,11 +37683,13 @@ const MANIFEST = {
37557
37683
  components: [SpsTaskQueue],
37558
37684
  examples: SpsTaskQueueExamples
37559
37685
  },
37560
- "Text Input": {
37686
+ "Text Inputs": {
37687
+ description: () => /* @__PURE__ */ React.createElement("p", null, "Text Inputs consist of a Label and a field in which a user enters a short value."),
37561
37688
  components: [SpsTextInput],
37562
37689
  examples: SpsTextInputExamples
37563
37690
  },
37564
- Textarea: {
37691
+ "Text Areas": {
37692
+ description: () => /* @__PURE__ */ React.createElement("p", null, "Text Areas consist of a Label and a field in which a user enters a long value."),
37565
37693
  components: [SpsTextarea],
37566
37694
  examples: SpsTextareaExamples
37567
37695
  },