@spscommerce/ds-react 6.7.0 → 6.10.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.
Files changed (3) hide show
  1. package/lib/index.cjs.js +404 -242
  2. package/lib/index.es.js +459 -223
  3. package/package.json +11 -11
package/lib/index.es.js CHANGED
@@ -32790,202 +32790,286 @@ const SpsScrollableContainerExamples = {
32790
32790
  }
32791
32791
  };
32792
32792
  const SpsSelectExamples = {
32793
+ general: {
32794
+ label: "General Usage",
32795
+ description: ({ NavigateTo }) => /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("h5", null, "Use a Select:"), /* @__PURE__ */ React__default.createElement("ul", null, /* @__PURE__ */ React__default.createElement("li", {
32796
+ className: "mb-2"
32797
+ }, "When a list of predetermined values can be provided.")), /* @__PURE__ */ React__default.createElement("h5", null, "Do Not Use a Select:"), /* @__PURE__ */ React__default.createElement("ul", null, /* @__PURE__ */ React__default.createElement("li", {
32798
+ className: "mb-2"
32799
+ }, "When there are only two possible options. Consider", " ", /* @__PURE__ */ React__default.createElement(NavigateTo, {
32800
+ to: "checkbox"
32801
+ }, "Checkboxes"), " or", " ", /* @__PURE__ */ React__default.createElement(NavigateTo, {
32802
+ to: "radio-buttons"
32803
+ }, "Radio Buttons"), " insead."), /* @__PURE__ */ React__default.createElement("li", {
32804
+ className: "mb-2"
32805
+ }, "When it is ideal to display all available options without requiring a click. Consider", " ", /* @__PURE__ */ React__default.createElement(NavigateTo, {
32806
+ to: "checkbox"
32807
+ }, "Checkboxes"), " or", " ", /* @__PURE__ */ React__default.createElement(NavigateTo, {
32808
+ to: "radio-buttons"
32809
+ }, "Radio Buttons"), " insead.")), /* @__PURE__ */ React__default.createElement("h5", null, "Using Selects in a Form"), /* @__PURE__ */ React__default.createElement("p", null, "Reference the ", /* @__PURE__ */ React__default.createElement(NavigateTo, {
32810
+ to: "form"
32811
+ }, "Forms"), " page for guidelines for placing inputs in Form layouts"))
32812
+ },
32793
32813
  basic: {
32794
- label: "Basic",
32795
- description: "info about basic selects",
32814
+ label: "Basic Select",
32815
+ description: () => /* @__PURE__ */ React__default.createElement("p", null, "Basic Selects include a label and dropdown menu containing a list of options. The user is allowed to make a single selection."),
32796
32816
  examples: {
32797
- a_simple: {
32798
- description: "Simple value options",
32817
+ basic: {
32799
32818
  react: code`
32800
- function DemoComponent() {
32801
- const colors = ["red", "blue", "green"];
32802
-
32803
- return (
32804
- <SpsSelect id="basic" options={colors}/>
32805
- )
32806
- }
32807
- `
32819
+ function DemoComponent() {
32820
+ const colors = ["red", "blue", "green"];
32821
+
32822
+ return (
32823
+ <div className="sfg-row">
32824
+ <div className="sfg-col-4">
32825
+ <SpsLabel>Color</SpsLabel>
32826
+ <SpsSelect options={colors} />
32827
+ </div>
32828
+ </div>
32829
+ )
32830
+ }
32831
+ `
32808
32832
  },
32809
- b_formHooks: {
32810
- description: "Form hooks",
32833
+ placeholderText: {
32834
+ description: () => /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("h4", null, "Customizable Placeholder Text"), /* @__PURE__ */ React__default.createElement("p", null, "Placeholder text can be customized to specifically reference the content in the dropdown menu.")),
32811
32835
  react: code`
32812
- function DemoComponent() {
32813
- const colors = ["red", "blue", "green"];
32814
- const { formValue, formMeta, updateForm } = useSpsForm({
32815
- color: colors[0]
32816
- });
32817
-
32818
- return <>
32819
- <SpsLabel for={formMeta.fields.color}>Color</SpsLabel>
32820
- <SpsSelect options={colors} formMeta={formMeta.fields.color}
32821
- value={formValue.color}
32822
- />
32823
- </>
32824
- }
32825
- `
32836
+ function DemoComponent() {
32837
+ const colors = ["red", "blue", "green"];
32838
+
32839
+ return (
32840
+ <div className="sfg-row">
32841
+ <div className="sfg-col-4">
32842
+ <SpsLabel>Color</SpsLabel>
32843
+ <SpsSelect options={colors} placeholder="Select a color..." />
32844
+ </div>
32845
+ </div>
32846
+ )
32847
+ }
32848
+ `
32826
32849
  },
32827
- c_placeholder: {
32828
- description: "Custom placeholder text",
32850
+ defaultSelection: {
32851
+ description: () => /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("h4", null, "Default Selection / No Clear Button"), /* @__PURE__ */ React__default.createElement("p", null, "Selects can default to a selection in certain cases. Use Default Selections only when a selection is required and a default selection can be confidently made. Selects with a default selection do not have a clear option.")),
32829
32852
  react: code`
32830
- function DemoComponent() {
32831
- const colors = ["red", "blue", "green"];
32832
-
32833
- return (
32834
- <SpsSelect id="placeholder" options={colors} placeholder="Choose a color…"/>
32835
- )
32836
- }
32837
- `
32853
+ function DemoComponent() {
32854
+ const colors = ["Small", "Medium", "Large"];
32855
+
32856
+ return (
32857
+ <div className="sfg-row">
32858
+ <div className="sfg-col-4">
32859
+ <SpsLabel>Size</SpsLabel>
32860
+ <SpsSelect options={colors} value="Small" notClearable />
32861
+ </div>
32862
+ </div>
32863
+ )
32864
+ }
32865
+ `
32838
32866
  },
32839
- d_notClearable: {
32840
- description: "Not clearable",
32867
+ zeroState: {
32868
+ description: () => /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("h4", null, "Zero State / No Available Options"), /* @__PURE__ */ React__default.createElement("p", null, "If no options are available in the dropdown menu, a zero state message appears. This option is most commonly used with the Select with Filter option.")),
32841
32869
  react: code`
32842
- function DemoComponent() {
32843
- const colors = ["red", "blue", "green"];
32870
+ function DemoComponent() {
32844
32871
 
32845
- return (
32846
- <SpsSelect options={colors} value="red" notClearable />
32847
- )
32848
- }
32849
- `
32872
+ return (
32873
+ <div className="sfg-row">
32874
+ <div className="sfg-col-4">
32875
+ <SpsLabel>Company</SpsLabel>
32876
+ <SpsSelect options={[]} zeroState="We're sorry, there are no options to choose from at this time." />
32877
+ </div>
32878
+ </div>
32879
+ )
32880
+ }
32881
+ `
32850
32882
  },
32851
- e_zeroState: {
32852
- description: "Zero state",
32883
+ formHooks: {
32884
+ description: ({ NavigateTo }) => /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("h4", null, "Form Hooks"), /* @__PURE__ */ React__default.createElement("p", null, "The ", /* @__PURE__ */ React__default.createElement("code", null, "formMeta"), " and ", /* @__PURE__ */ React__default.createElement("code", null, "formValue"), " props are used with the", " ", /* @__PURE__ */ React__default.createElement("code", null, "useSpsForm"), " hook. By using the ", /* @__PURE__ */ React__default.createElement("code", null, "useSpsForm"), " hook you can add validators, get the form value, update the form value, and more. The form is documented on the ", /* @__PURE__ */ React__default.createElement(NavigateTo, {
32885
+ to: "form"
32886
+ }, "Forms"), " page.")),
32853
32887
  react: code`
32854
- function DemoComponent() {
32855
- return (
32856
- <SpsSelect options={[]} zeroState="We're sorry, there are no options to choose from at this time, because reasons." />
32857
- )
32858
- }
32859
- `
32888
+ function DemoComponent() {
32889
+ const colors = ["red", "blue", "green"];
32890
+ const { formValue, formMeta, updateForm } = useSpsForm({
32891
+ color: colors[0]
32892
+ });
32893
+
32894
+ return (
32895
+ <div className="sfg-row">
32896
+ <div className="sfg-col-4">
32897
+ <SpsLabel for={formMeta.fields.color}>Color</SpsLabel>
32898
+ <SpsSelect options={colors} formMeta={formMeta.fields.color} formValue={formValue.color}/>
32899
+ </div>
32900
+ </div>
32901
+ )
32902
+ }
32903
+ `
32860
32904
  }
32861
32905
  }
32862
32906
  },
32863
- b_objectOpts: {
32864
- label: "Object Options",
32865
- description: "info about object options",
32907
+ filter: {
32908
+ label: "Select with Filter",
32909
+ description: () => /* @__PURE__ */ React__default.createElement("p", null, "It can be helpful to add a filter field to dropdown menus that contain a large amount of options to aid the user in finding the option they need."),
32866
32910
  examples: {
32867
- a_basic: {
32868
- description: "Basic use of object options",
32911
+ basic: {
32869
32912
  react: code`
32870
- function DemoComponent() {
32871
- const sizes = [
32872
- { size: "S", price: "10.99" },
32873
- { size: "M", price: "12.99" },
32874
- { size: "L", price: "14.99" }
32875
- ];
32913
+ function DemoComponent() {
32914
+ function colorSearch(search) {
32915
+ return ["red", "orange", "yellow", "green", "blue", "indigo", "violet"].filter(s => (new RegExp(search, "i")).test(s));
32916
+ }
32876
32917
 
32877
- return (
32878
- <SpsSelect options={sizes} textKey="size" />
32879
- )
32880
- }
32881
- `
32918
+ return (
32919
+ <div className="sfg-row">
32920
+ <div className="sfg-col-4">
32921
+ <SpsLabel>Color</SpsLabel>
32922
+ <SpsSelect options={colorSearch} zeroState="While I'm sure that's a lovely color, it's not an option we support.ssssssssss" />
32923
+ </div>
32924
+ </div>
32925
+ )
32926
+ }
32927
+ `
32882
32928
  },
32883
- b_captions: {
32884
- description: "Captions",
32929
+ promise: {
32930
+ description: () => /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("h4", null, "Return a Promise"), /* @__PURE__ */ React__default.createElement("p", null, "A promise should be used when the options are being returned asynchronously. A common use case for this is when the options are being returned as a result of an API call.")),
32885
32931
  react: code`
32886
- function DemoComponent() {
32887
- const lorem = [
32888
- {
32889
- title: "Lorem",
32890
- description: "Ut enim ad minim veniam"
32891
- },
32892
- {
32893
- title: "Ipsum",
32894
- description: "Excepteur sint occaecat cupidatat non proident"
32895
- }
32896
- ];
32932
+ function DemoComponent() {
32933
+ function colorSearch(search) {
32934
+ return new Promise((resolve, reject) => {
32935
+ const result = ["red", "orange", "yellow", "green", "blue", "indigo", "violet"].filter(s => new RegExp(search, "i").test(s));
32936
+ resolve(result);
32937
+ });
32938
+ }
32897
32939
 
32898
- return (
32899
- <SpsSelect options={lorem} textKey="title" captionKey="description" />
32900
- )
32901
- }
32902
- `
32940
+ return (
32941
+ <div className="sfg-row">
32942
+ <div className="sfg-col-4">
32943
+ <SpsLabel>Color</SpsLabel>
32944
+ <SpsSelect options={colorSearch} />
32945
+ </div>
32946
+ </div>
32947
+ )
32948
+ }
32949
+ `
32950
+ },
32951
+ debounce: {
32952
+ description: () => /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("h4", null, "Debounce"), /* @__PURE__ */ React__default.createElement("p", null, "When the options are a result of a search or are not available right away a debounce may be helpful. A debounce adds a delay to the option search so the search function is not getting called repeatedly.")),
32953
+ react: code`
32954
+ function DemoComponent() {
32955
+ function colorSearch(search) {
32956
+ return ["red", "orange", "yellow", "green", "blue", "indigo", "violet"].filter(s => new RegExp(search, "i").test(s));
32957
+ }
32958
+
32959
+ return (
32960
+ <div className="sfg-row">
32961
+ <div className="sfg-col-4">
32962
+ <SpsLabel>Color</SpsLabel>
32963
+ <SpsSelect options={colorSearch} searchDebounce={2000} />
32964
+ </div>
32965
+ </div>
32966
+ )
32967
+ }
32968
+ `
32903
32969
  }
32904
32970
  }
32905
32971
  },
32906
- c_searchable: {
32907
- label: "Search/Filter",
32908
- description: "info about search/filter",
32972
+ objectOptions: {
32973
+ label: "Object Options",
32974
+ description: () => /* @__PURE__ */ React__default.createElement("p", null, "The values in the select menu can be modified to provide more detail to the user or the system, when necessary."),
32909
32975
  examples: {
32910
- a_simple: {
32911
- description: "Simple search function",
32976
+ basic: {
32912
32977
  react: code`
32913
- function DemoComponent() {
32914
- function colorSearch(search) {
32915
- return ["red", "orange", "yellow", "green", "blue", "indigo", "violet"]
32916
- .filter(s => (new RegExp(search, "i")).test(s));
32917
- }
32918
-
32919
- return (
32920
- <SpsSelect id="search-function" options={colorSearch} zeroState="While I'm sure that's a lovely color, it's not an option we support."/>
32921
- )
32922
- }
32923
- `
32978
+ function DemoComponent() {
32979
+ const sizes = [
32980
+ { size: "S", price: "10.99" },
32981
+ { size: "M", price: "12.99" },
32982
+ { size: "S", price: "10.99" },
32983
+ ]
32984
+
32985
+ return (
32986
+ <div className="sfg-row">
32987
+ <div className="sfg-col-4">
32988
+ <SpsLabel>Size</SpsLabel>
32989
+ <SpsSelect options={sizes} textKey="size" />
32990
+ </div>
32991
+ </div>
32992
+ )
32993
+ }
32994
+ `
32924
32995
  },
32925
- b_promise: {
32926
- description: "Search function returning a Promise",
32996
+ extendedDetails: {
32997
+ description: () => /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("h4", null, "Extended Details"), /* @__PURE__ */ React__default.createElement("p", null, "Extended details can be displayed in the dropdown menu. Only the primary detail is displayed as the selection.")),
32927
32998
  react: code`
32928
- function DemoComponent() {
32929
- function colorSearch(search) {
32930
- return new Promise((resolve, reject) => {
32931
- const result = ["red", "orange", "yellow", "green", "blue", "indigo", "violet"]
32932
- .filter(s => new RegExp(search, "i").test(s));
32933
- resolve(result);
32934
- });
32935
- }
32936
-
32937
- return (
32938
- <SpsSelect options={colorSearch}/>
32939
- )
32940
- }
32941
- `
32942
- },
32943
- c_debounce: {
32944
- description: "Search with Debounce",
32999
+ function DemoComponent() {
33000
+ const sizes = [
33001
+ { size: "S", price: "$10.99" },
33002
+ { size: "M", price: "$12.99" },
33003
+ { size: "S", price: "$10.99" },
33004
+ ]
33005
+ return (
33006
+ <div className="sfg-row">
33007
+ <div className="sfg-col-4">
33008
+ <SpsLabel>Size</SpsLabel>
33009
+ <SpsSelect options={sizes} textKey="size" captionKey="price" />
33010
+ </div>
33011
+ </div>
33012
+ )
33013
+ }
33014
+ `
33015
+ }
33016
+ }
33017
+ },
33018
+ selectWithAction: {
33019
+ label: "Select with Action Button",
33020
+ description: () => /* @__PURE__ */ React__default.createElement("p", null, "A Text Button can be added to the bottom of the dropdown menu to provide a specific action."),
33021
+ examples: {
33022
+ basic: {
32945
33023
  react: code`
32946
- function DemoComponent() {
32947
- function colorSearch(search) {
32948
- return ["red", "orange", "yellow", "green", "blue", "indigo", "violet"]
32949
- .filter(s => (new RegExp(search, "i")).test(s));
32950
- }
33024
+ function DemoComponent() {
33025
+ const colors = ["red", "blue", "green"];
33026
+ const [action, updateAction] = useSpsAction(
33027
+ {
33028
+ label: "Go to Overview",
33029
+ icon: "dashboard",
33030
+ href: "#/overview",
33031
+ newTab: true
33032
+ },
33033
+ () => console.log("Action")
33034
+ );
33035
+
33036
+ function handleChange(event) {
33037
+ updateAction({
33038
+ label: "Test Action"
33039
+ });
33040
+ }
32951
33041
 
32952
- return (
32953
- <SpsSelect id="debounce-select" options={colorSearch} searchDebounce={2000}/>
32954
- )
32955
- }
32956
- `
33042
+ return (
33043
+ <div className="sfg-row">
33044
+ <div className="sfg-col-4">
33045
+ <SpsSelect options={colors} action={action} onChange={handleChange} />
33046
+ </div>
33047
+ </div>
33048
+ )
33049
+ }
33050
+ `
32957
33051
  }
32958
33052
  }
32959
33053
  },
32960
- d_specialAction: {
32961
- label: "Simple Action",
32962
- description: "info about simple action selects",
33054
+ disabled: {
33055
+ label: "Disabled State",
33056
+ description: () => /* @__PURE__ */ React__default.createElement("p", null, "In the disabled state, select inputs display the current selection or placeholder text, but cannot be interacted with."),
32963
33057
  examples: {
32964
- a_action: {
32965
- description: "Action",
33058
+ basic: {
32966
33059
  react: code`
32967
- function DemoComponent() {
32968
- const colors = ["red", "orange", "yellow", "blue", "indigo", "violet"];
32969
- const [action, updateAction] = useSpsAction(
32970
- {
32971
- label: "Go to Overview",
32972
- icon: "dashboard",
32973
- href: "#/overview",
32974
- newTab: true
32975
- },
32976
- () => console.log("Action")
32977
- );
32978
- function handleChange(event) {
32979
- updateAction({
32980
- label: "Test Action"
32981
- });
32982
- }
32983
-
32984
- return (
32985
- <SpsSelect id="special-action" options={colors} action={action} onChange={handleChange}/>
32986
- )
32987
- }
32988
- `
33060
+ function DemoComponent() {
33061
+ const colors = ["red", "blue", "green"];
33062
+
33063
+ return (
33064
+ <div className="sfg-row">
33065
+ <div className="sfg-col-4">
33066
+ <SpsLabel>Color</SpsLabel>
33067
+ <SpsSelect options={colors} disabled />
33068
+ </div>
33069
+ </div>
33070
+ )
33071
+ }
33072
+ `
32989
33073
  }
32990
33074
  }
32991
33075
  }
@@ -35944,85 +36028,235 @@ Object.assign(SpsToggle, {
35944
36028
  displayName: "SpsToggle"
35945
36029
  });
35946
36030
  const SpsToggleExamples = {
35947
- small: {
35948
- label: "Small",
36031
+ general: {
36032
+ label: "General Usage",
36033
+ description: ({ NavigateTo }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h5", null, "Use Toggles:"), /* @__PURE__ */ React.createElement("ul", null, /* @__PURE__ */ React.createElement("li", {
36034
+ className: "mb-2"
36035
+ }, 'When an option represents a specific "on/off" state.'), /* @__PURE__ */ React.createElement("li", {
36036
+ className: "mb-2"
36037
+ }, "When the selection causes an imeediate change in the system.")), /* @__PURE__ */ React.createElement("h5", null, "Do Not Use Toggles:"), /* @__PURE__ */ React.createElement("ul", null, /* @__PURE__ */ React.createElement("li", {
36038
+ className: "mb-2"
36039
+ }, "When a selection does not cause an immediate change in the system.", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
36040
+ to: "checkbox"
36041
+ }, "Checkboxes"), " or", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
36042
+ to: "radio-buttons"
36043
+ }, "Radio Buttons"), " instead."), /* @__PURE__ */ React.createElement("li", {
36044
+ className: "mb-2"
36045
+ }, "Inside a form with a save/submit button as this contradicts the immediate change in the system that a toggle controls.")))
36046
+ },
36047
+ basic: {
36048
+ label: "Basic Toggles",
36049
+ description: () => /* @__PURE__ */ React.createElement("p", null, "Basic toggles can appear with or without labels and can include an extended description if necessary."),
35949
36050
  examples: {
35950
- a_small: {
36051
+ basic: {
36052
+ description: () => /* @__PURE__ */ React.createElement("h4", {
36053
+ className: "mb-3"
36054
+ }, "Toggle"),
35951
36055
  react: code`
35952
- function DemoComponent() {
35953
- const { formValue, formMeta, updateForm } = useSpsForm({
35954
- toggle: false
35955
- });
36056
+ function DemoComponent() {
36057
+ const { formValue, formMeta, updateForm } = useSpsForm({
36058
+ toggle: true
36059
+ });
35956
36060
 
35957
- return <SpsToggle formMeta={formMeta.fields.toggle}
35958
- active={formValue.toggle}
35959
- label="Main Label"
35960
- description="Extra descriptive text"
35961
- />;
35962
- }
35963
- `
36061
+ return (
36062
+ <SpsToggle
36063
+ active={formValue.toggle}
36064
+ />
36065
+ )
36066
+ }
36067
+ `
35964
36068
  },
35965
- b_changeHandler: {
35966
- description: "With UseState",
36069
+ label: {
36070
+ description: () => /* @__PURE__ */ React.createElement("h4", {
36071
+ className: "mb-3"
36072
+ }, "Toggle + Label"),
35967
36073
  react: code`
35968
- function DemoComponent() {
35969
- function changeHandler() {
35970
- setActive(!checked);
35971
- }
35972
- const [active, setActive] = React.useState();
35973
- return (
35974
- <SpsToggle active={active} onChange={changeHandler}/>
35975
- )
35976
- }
35977
- `
36074
+ function DemoComponent() {
36075
+ const { formValue, formMeta, updateForm } = useSpsForm({
36076
+ toggle: true
36077
+ });
36078
+
36079
+ return (
36080
+ <SpsToggle
36081
+ active={formValue.toggle}
36082
+ label="Label"
36083
+ />
36084
+ )
36085
+ }
36086
+ `
36087
+ },
36088
+ extendedDescription: {
36089
+ description: () => /* @__PURE__ */ React.createElement("h4", {
36090
+ className: "mb-3"
36091
+ }, "Toggle + Label with Extended Description"),
36092
+ react: code`
36093
+ function DemoComponent() {
36094
+ const { formValue, formMeta, updateForm } = useSpsForm({
36095
+ toggle: true
36096
+ });
36097
+
36098
+ return (
36099
+ <SpsToggle
36100
+ active={formValue.toggle}
36101
+ label="Label"
36102
+ description="(optional extended description)"
36103
+ />
36104
+ )
36105
+ }
36106
+ `
35978
36107
  }
35979
36108
  }
35980
36109
  },
35981
- b_large: {
35982
- label: "Large",
36110
+ groups: {
36111
+ label: "Toggle Groups",
36112
+ description: () => /* @__PURE__ */ React.createElement("p", null, "Toggle Groups can appear as one of the two types listed."),
35983
36113
  examples: {
35984
- a_large: {
36114
+ group: {
36115
+ description: () => /* @__PURE__ */ React.createElement("h4", {
36116
+ className: "mb-3"
36117
+ }, "Toggle Group"),
35985
36118
  react: code`
35986
- function DemoComponent() {
35987
- const { formValue, formMeta, updateForm } = useSpsForm({
35988
- toggle: true
35989
- });
36119
+ function DemoComponent() {
36120
+ const { formValue, formMeta, updateForm } = useSpsForm({
36121
+ toggleLabel: true,
36122
+ toggle1: true,
36123
+ toggle2: true,
36124
+ toggle3: true,
36125
+ });
35990
36126
 
35991
- return <SpsToggle large formMeta={formMeta.fields.toggle}
35992
- active={formValue.toggle}
35993
- />;
35994
- }
35995
- `
36127
+ return (
36128
+ <>
36129
+ <SpsLabel for={formMeta.fields.toggleLabel}>Section Label</SpsLabel>
36130
+ <SpsToggle
36131
+ active={formValue.toggle1}
36132
+ label="Label"
36133
+ description="(optional extended description)"
36134
+ />
36135
+ <SpsToggle
36136
+ active={formValue.toggle2}
36137
+ label="Label"
36138
+ />
36139
+ <SpsToggle
36140
+ active={formValue.toggle3}
36141
+ label="Label"
36142
+ description="(optional extended description)"
36143
+ />
36144
+ </>
36145
+ )
36146
+ }
36147
+ `
36148
+ },
36149
+ alternate: {
36150
+ description: () => /* @__PURE__ */ React.createElement("h4", {
36151
+ className: "mb-3"
36152
+ }, "Toggle Group Alternate"),
36153
+ react: code`
36154
+ function DemoComponent() {
36155
+ const { formValue, formMeta, updateForm } = useSpsForm({
36156
+ toggleLabel: true,
36157
+ toggle1: true,
36158
+ toggle2: true,
36159
+ toggle3: true,
36160
+ });
36161
+
36162
+ return (
36163
+ <>
36164
+ <SpsLabel for={formMeta.fields.toggleLabel}>Section Label</SpsLabel>
36165
+ <div className="sfg-row">
36166
+ <div className="sfg-col-3">
36167
+ <div className="sfg-row">
36168
+ <div className="sfg-col-6">
36169
+ <span>Label</span>
36170
+ </div>
36171
+ <div className="sfg-col-6">
36172
+ <SpsToggle
36173
+ active={formValue.toggle1}
36174
+ />
36175
+ </div>
36176
+ </div>
36177
+ <div className="sfg-row">
36178
+ <div className="sfg-col-6">
36179
+ <span>Label</span>
36180
+ </div>
36181
+ <div className="sfg-col-6">
36182
+ <SpsToggle
36183
+ active={formValue.toggle2}
36184
+ />
36185
+ </div>
36186
+ </div>
36187
+ <div className="sfg-row">
36188
+ <div className="sfg-col-6">
36189
+ <span>Label</span>
36190
+ </div>
36191
+ <div className="sfg-col-6">
36192
+ <SpsToggle
36193
+ active={formValue.toggle3}
36194
+ />
36195
+ </div>
36196
+ </div>
36197
+ </div>
36198
+ </div>
36199
+ </>
36200
+ )
36201
+ }
36202
+ `
35996
36203
  }
35997
36204
  }
35998
36205
  },
35999
- d_disabled: {
36000
- label: "Disabled",
36206
+ disabled: {
36207
+ label: "Disabled States",
36208
+ description: () => /* @__PURE__ */ React.createElement("p", null, "Toggles have a disabled style for each possible state."),
36001
36209
  examples: {
36002
- disabled: {
36210
+ basic: {
36003
36211
  react: code`
36004
- function DemoComponent() {
36005
- const { formValue, formMeta, updateForm } = useSpsForm({
36006
- toggleA: false,
36007
- toggleB: true,
36008
- });
36212
+ function DemoComponent() {
36213
+ const { formValue, formMeta, updateForm } = useSpsForm({
36214
+ toggle: true
36215
+ });
36009
36216
 
36010
- return <>
36011
- <SpsToggle formMeta={formMeta.fields.toggleA}
36012
- active={formValue.toggleA}
36013
- label="Main Label"
36014
- description="Extra descriptive text"
36015
- disabled
36016
- />
36017
- <SpsToggle formMeta={formMeta.fields.toggleB}
36018
- active={formValue.toggleB}
36019
- label="Main Label"
36020
- description="Extra descriptive text"
36021
- disabled
36022
- />
36023
- </>;
36024
- }
36025
- `
36217
+ return (
36218
+ <SpsToggle
36219
+ active={formValue.toggle}
36220
+ disabled
36221
+ />
36222
+ )
36223
+ }
36224
+ `
36225
+ },
36226
+ label: {
36227
+ react: code`
36228
+ function DemoComponent() {
36229
+ const { formValue, formMeta, updateForm } = useSpsForm({
36230
+ toggle: true
36231
+ });
36232
+
36233
+ return (
36234
+ <SpsToggle
36235
+ active={formValue.toggle}
36236
+ label="Label"
36237
+ disabled
36238
+ />
36239
+ )
36240
+ }
36241
+ `
36242
+ },
36243
+ extendedDescription: {
36244
+ react: code`
36245
+ function DemoComponent() {
36246
+ const { formValue, formMeta, updateForm } = useSpsForm({
36247
+ toggle: true
36248
+ });
36249
+
36250
+ return (
36251
+ <SpsToggle
36252
+ active={formValue.toggle}
36253
+ label="Label"
36254
+ description="(optional extended description)"
36255
+ disabled
36256
+ />
36257
+ )
36258
+ }
36259
+ `
36026
36260
  }
36027
36261
  }
36028
36262
  }
@@ -37638,6 +37872,7 @@ const MANIFEST = {
37638
37872
  examples: SpsSearchResultsBarExamples
37639
37873
  },
37640
37874
  Select: {
37875
+ description: "Selects consist off a Label and a dropdown menu from which a user selects a value from a list of pre-defined options.",
37641
37876
  components: [SpsSelect],
37642
37877
  examples: SpsSelectExamples
37643
37878
  },
@@ -37698,6 +37933,7 @@ const MANIFEST = {
37698
37933
  examples: SpsTextareaExamples
37699
37934
  },
37700
37935
  Toggle: {
37936
+ description: () => /* @__PURE__ */ React.createElement("p", null, "Toggles allow a user to immediately turn a setting on or off."),
37701
37937
  components: [SpsToggle],
37702
37938
  examples: SpsToggleExamples
37703
37939
  },