@spscommerce/ds-react 6.4.1 → 6.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.es.js CHANGED
@@ -25442,8 +25442,12 @@ Object.assign(SpsLabel, {
25442
25442
  displayName: "SpsLabel"
25443
25443
  });
25444
25444
  const SpsLabelExamples = {
25445
+ general: {
25446
+ label: "General Usage",
25447
+ description: () => /* @__PURE__ */ React.createElement("p", null, "In almost all cases, input fields should be paired with a label describing the value to be entered into the field. Certain labels can be accompanied by icons to provide additional information or context about that particular field.")
25448
+ },
25445
25449
  basic: {
25446
- label: "Basic",
25450
+ label: "Basic Label",
25447
25451
  examples: {
25448
25452
  basic: {
25449
25453
  react: code`
@@ -25465,31 +25469,9 @@ const SpsLabelExamples = {
25465
25469
  }
25466
25470
  }
25467
25471
  },
25468
- b_suggested: {
25469
- label: "Strongly Suggested",
25470
- examples: {
25471
- basic: {
25472
- react: code`
25473
- function DemoComponent() {
25474
- const { formValue, formMeta, updateForm } = useSpsForm({
25475
- companyName: ""
25476
- });
25477
-
25478
- return <>
25479
- <SpsLabel for={formMeta.fields.companyName} stronglySuggested>
25480
- Company Name
25481
- </SpsLabel>
25482
- <SpsTextInput value={formValue.companyName}
25483
- formMeta={formMeta.fields.companyName}
25484
- ></SpsTextInput>
25485
- </>;
25486
- }
25487
- `
25488
- }
25489
- }
25490
- },
25491
- c_required: {
25492
- label: "Required",
25472
+ required: {
25473
+ label: "Required Labels",
25474
+ description: () => /* @__PURE__ */ React.createElement("p", null, "Many forms contain input fields that require values in order for the form to be submitted. Such fields have an accompanying red asterisk to the left of the Label."),
25493
25475
  examples: {
25494
25476
  basic: {
25495
25477
  react: code`
@@ -25516,11 +25498,12 @@ const SpsLabelExamples = {
25516
25498
  }
25517
25499
  }
25518
25500
  },
25519
- d_help: {
25520
- label: "Help Information",
25501
+ icons: {
25502
+ label: "Labels with Icons",
25503
+ description: () => /* @__PURE__ */ React.createElement("p", null, "Icons can be used with labels to reveal tooltips with additional contextual information or help text. Icons remain visible at all times, even when an input field is in an error state. For more information about error states view the Validation section of this page."),
25521
25504
  examples: {
25522
- a_defaultIcon: {
25523
- description: "<p>Default icon</p>",
25505
+ infoIcon: {
25506
+ description: () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h4", null, "Info Icons"), /* @__PURE__ */ React.createElement("p", null, "Info Icons reveal a tooltip providing more information, such as instructions on correct formatting required for the input field.")),
25524
25507
  react: code`
25525
25508
  function DemoComponent() {
25526
25509
  const { formValue, formMeta, updateForm } = useSpsForm({
@@ -25529,7 +25512,8 @@ const SpsLabelExamples = {
25529
25512
 
25530
25513
  return <>
25531
25514
  <SpsLabel for={formMeta.fields.companyName}
25532
- help="Pretend there's something helpful written here."
25515
+ helpIcon={SpsIcon.INFO}
25516
+ help="This is an informative and instructive tooltip."
25533
25517
  >
25534
25518
  Company Name
25535
25519
  </SpsLabel>
@@ -25540,18 +25524,29 @@ const SpsLabelExamples = {
25540
25524
  }
25541
25525
  `
25542
25526
  },
25543
- b_customIcon: {
25544
- description: "<p>Custom icon</p>",
25527
+ settingsIcon: {
25528
+ description: ({ NavigateTo }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h4", null, "Settings Icons"), /* @__PURE__ */ React.createElement("p", null, "The gear icon can be used to launch a ", /* @__PURE__ */ React.createElement(NavigateTo, {
25529
+ to: "modal"
25530
+ }, "Modal"), " window or ", /* @__PURE__ */ React.createElement(NavigateTo, {
25531
+ to: "focused-task"
25532
+ }, "Focused Task View"), " containing settings or preferences related to a specific input field.")),
25545
25533
  react: code`
25546
25534
  function DemoComponent() {
25547
25535
  const { formValue, formMeta, updateForm } = useSpsForm({
25548
25536
  companyName: ""
25549
25537
  });
25550
25538
 
25539
+ function iconClickHandler(event) {
25540
+ // screen out non-icon clicks
25541
+ if (event.target.tagName !== "I") return;
25542
+ alert("settings action triggered");
25543
+ }
25544
+
25551
25545
  return <>
25552
25546
  <SpsLabel for={formMeta.fields.companyName}
25553
25547
  help="Pretend there's something helpful written here."
25554
- helpIcon={SpsIcon.EXCHANGE} helpIconColor="red200"
25548
+ helpIcon={SpsIcon.GEAR}
25549
+ onClick={iconClickHandler}
25555
25550
  >
25556
25551
  Company Name
25557
25552
  </SpsLabel>
@@ -25561,11 +25556,34 @@ const SpsLabelExamples = {
25561
25556
  </>;
25562
25557
  }
25563
25558
  `
25559
+ },
25560
+ customIcons: {
25561
+ description: () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h4", null, "Custom Icons"), /* @__PURE__ */ React.createElement("p", null, "The icon can be customized, but only in the case when the Info Icon does not properly represent the tooltip message.")),
25562
+ react: code`
25563
+ function DemoComponent() {
25564
+ const { formValue, formMeta, updateForm } = useSpsForm({
25565
+ companyName: ""
25566
+ });
25567
+
25568
+ return <>
25569
+ <SpsLabel for={formMeta.fields.companyName}
25570
+ helpIcon={SpsIcon.BELL}
25571
+ help="This is a custom icon"
25572
+ >
25573
+ Company Name
25574
+ </SpsLabel>
25575
+ <SpsTextInput formMeta={formMeta.fields.companyName}
25576
+ value={formValue.companyName}
25577
+ ></SpsTextInput>
25578
+ </>
25579
+ }
25580
+ `
25564
25581
  }
25565
25582
  }
25566
25583
  },
25567
- e_validation: {
25584
+ validation: {
25568
25585
  label: "Validation",
25586
+ description: () => /* @__PURE__ */ React.createElement("p", null, "When an input field fails validation for any reason, an Error State style is applied, which includes an Error Icon tot he left of the label that reveals instructions for correcting the error."),
25569
25587
  examples: {
25570
25588
  basic: {
25571
25589
  react: code`
@@ -25596,64 +25614,6 @@ const SpsLabelExamples = {
25596
25614
  `
25597
25615
  }
25598
25616
  }
25599
- },
25600
- f_combinations: {
25601
- label: "Combinations",
25602
- examples: {
25603
- a_combo1: {
25604
- react: code`
25605
- function DemoComponent() {
25606
- const { formValue, formMeta, updateForm } = useSpsForm({
25607
- companyName: "Target"
25608
- }, {
25609
- "companyName": [SpsValidators.minLength(7)]
25610
- });
25611
-
25612
- React.useEffect(() => {
25613
- // Make validation error visible for the purpose of this demo
25614
- formMeta.markAsDirty();
25615
- }, []);
25616
-
25617
- return <>
25618
- <SpsLabel for={formMeta.fields.companyName}
25619
- stronglySuggested
25620
- errors={() => formMeta.fields.companyName.hasError("minLength")
25621
- && "Company Name must be at least 7 characters."}
25622
- >
25623
- Company Name
25624
- </SpsLabel>
25625
- <SpsTextInput formMeta={formMeta.fields.companyName}
25626
- value={formValue.companyName}
25627
- ></SpsTextInput>
25628
- </>;
25629
- }
25630
- `
25631
- },
25632
- b_combo2: {
25633
- react: code`
25634
- function DemoComponent() {
25635
- const { formValue, formMeta, updateForm } = useSpsForm({
25636
- companyName: ""
25637
- }, {
25638
- "companyName": [SpsValidators.required]
25639
- });
25640
-
25641
- return <>
25642
- <SpsLabel for={formMeta.fields.companyName}
25643
- help="Pretend there's something helpful written here."
25644
- errors={() => formMeta.fields.companyName.hasError("required")
25645
- && "Please enter a company name."}
25646
- >
25647
- Company Name
25648
- </SpsLabel>
25649
- <SpsTextInput formMeta={formMeta.fields.companyName}
25650
- value={formValue.companyName}
25651
- ></SpsTextInput>
25652
- </>;
25653
- }
25654
- `
25655
- }
25656
- }
25657
25617
  }
25658
25618
  };
25659
25619
  const propsDoc$Y = {
@@ -37667,6 +37627,7 @@ const MANIFEST = {
37667
37627
  examples: SpsKeyValueListExamples
37668
37628
  },
37669
37629
  Label: {
37630
+ description: () => /* @__PURE__ */ React.createElement("p", null, "Labels provide a description for the value to be entered or selected in an accompanying input field."),
37670
37631
  components: [SpsLabel],
37671
37632
  examples: SpsLabelExamples
37672
37633
  },
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": "6.4.1",
4
+ "version": "6.5.0",
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": "6.4.1",
32
- "@spscommerce/ds-illustrations": "6.4.1",
33
- "@spscommerce/ds-shared": "6.4.1",
34
- "@spscommerce/positioning": "6.4.1",
35
- "@spscommerce/utils": "6.4.1",
31
+ "@spscommerce/ds-colors": "6.5.0",
32
+ "@spscommerce/ds-illustrations": "6.5.0",
33
+ "@spscommerce/ds-shared": "6.5.0",
34
+ "@spscommerce/positioning": "6.5.0",
35
+ "@spscommerce/utils": "6.5.0",
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": "6.4.1",
44
- "@spscommerce/ds-illustrations": "6.4.1",
45
- "@spscommerce/ds-shared": "6.4.1",
46
- "@spscommerce/positioning": "6.4.1",
47
- "@spscommerce/utils": "6.4.1",
43
+ "@spscommerce/ds-colors": "6.5.0",
44
+ "@spscommerce/ds-illustrations": "6.5.0",
45
+ "@spscommerce/ds-shared": "6.5.0",
46
+ "@spscommerce/positioning": "6.5.0",
47
+ "@spscommerce/utils": "6.5.0",
48
48
  "@testing-library/react": "^9.3.2",
49
49
  "@types/prop-types": "^15.7.1",
50
50
  "@types/react": "^16.9.0",