@spscommerce/ds-react 8.23.12 → 8.23.14
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.js +17 -17
- package/lib/index.umd.cjs +13 -13
- package/package.json +12 -12
package/lib/index.js
CHANGED
|
@@ -12388,7 +12388,7 @@ const JD = {
|
|
|
12388
12388
|
description: ({ NavigateTo: e }) => /* @__PURE__ */ q.createElement(q.Fragment, null, /* @__PURE__ */ q.createElement("h5", null, "Use a Select:"), /* @__PURE__ */ q.createElement("ul", null, /* @__PURE__ */ q.createElement("li", { className: "mb-2" }, "When a list of predetermined values can be provided.")), /* @__PURE__ */ q.createElement("h5", null, "Do Not Use a Select:"), /* @__PURE__ */ q.createElement("ul", null, /* @__PURE__ */ q.createElement("li", { className: "mb-2" }, "When there are only two possible options. Consider", " ", /* @__PURE__ */ q.createElement(e, { to: "checkbox" }, "Checkboxes"), " or", " ", /* @__PURE__ */ q.createElement(e, { to: "radio-buttons" }, "Radio Buttons"), " insead."), /* @__PURE__ */ q.createElement("li", { className: "mb-2" }, "When it is ideal to display all available options without requiring a click. Consider", " ", /* @__PURE__ */ q.createElement(e, { to: "checkbox" }, "Checkboxes"), " or", " ", /* @__PURE__ */ q.createElement(e, { to: "radio-buttons" }, "Radio Buttons"), " insead.")), /* @__PURE__ */ q.createElement("h5", null, "Using Selects in a Form"), /* @__PURE__ */ q.createElement("p", null, "Reference the ", /* @__PURE__ */ q.createElement(e, { to: "form" }, "Forms"), " page for guidelines for placing inputs in Form layouts"))
|
|
12389
12389
|
},
|
|
12390
12390
|
basic: {
|
|
12391
|
-
label: "Basic
|
|
12391
|
+
label: "Basic Selects",
|
|
12392
12392
|
description: () => /* @__PURE__ */ q.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."),
|
|
12393
12393
|
examples: {
|
|
12394
12394
|
basic: {
|
|
@@ -18042,8 +18042,8 @@ Object.assign(Pu, {
|
|
|
18042
18042
|
});
|
|
18043
18043
|
const SN = {
|
|
18044
18044
|
basic: {
|
|
18045
|
-
label: "Basic
|
|
18046
|
-
description: "info about basic
|
|
18045
|
+
label: "Basic Content Sections",
|
|
18046
|
+
description: "info about basic content sections",
|
|
18047
18047
|
examples: {
|
|
18048
18048
|
basic: {
|
|
18049
18049
|
react: y`
|
|
@@ -18069,7 +18069,7 @@ const SN = {
|
|
|
18069
18069
|
});
|
|
18070
18070
|
|
|
18071
18071
|
return <>
|
|
18072
|
-
<SpsFieldset formMeta={formMeta.fields.myFieldset} legend="
|
|
18072
|
+
<SpsFieldset formMeta={formMeta.fields.myFieldset} legend="Content Section Legend" tooltip="Add a Tooltip">
|
|
18073
18073
|
<div className="sfg-row">
|
|
18074
18074
|
<div className="sfg-col-4">
|
|
18075
18075
|
<SpsLabel for={formMeta.fields.myFieldset.fields.foo}>Foo</SpsLabel>
|
|
@@ -18102,8 +18102,8 @@ const SN = {
|
|
|
18102
18102
|
}
|
|
18103
18103
|
},
|
|
18104
18104
|
b_nested: {
|
|
18105
|
-
label: "Nested
|
|
18106
|
-
description: "info about nested
|
|
18105
|
+
label: "Nested Content Sections",
|
|
18106
|
+
description: "info about nested content sections",
|
|
18107
18107
|
examples: {
|
|
18108
18108
|
nested: {
|
|
18109
18109
|
react: y`
|
|
@@ -18133,7 +18133,7 @@ const SN = {
|
|
|
18133
18133
|
});
|
|
18134
18134
|
|
|
18135
18135
|
return <>
|
|
18136
|
-
<SpsFieldset formMeta={formMeta.fields.topFieldset} legend="
|
|
18136
|
+
<SpsFieldset formMeta={formMeta.fields.topFieldset} legend="Content Section Legend">
|
|
18137
18137
|
<div className="sfg-row">
|
|
18138
18138
|
<div className="sfg-col-4">
|
|
18139
18139
|
<SpsLabel for={formMeta.fields.topFieldset.fields.foo}>Foo</SpsLabel>
|
|
@@ -18143,7 +18143,7 @@ const SN = {
|
|
|
18143
18143
|
></SpsTextInput>
|
|
18144
18144
|
</div>
|
|
18145
18145
|
</div>
|
|
18146
|
-
<SpsFieldset formMeta={formMeta.fields.topFieldset.fields.fsNested} legend="Nested
|
|
18146
|
+
<SpsFieldset formMeta={formMeta.fields.topFieldset.fields.fsNested} legend="Nested Content Section">
|
|
18147
18147
|
<div className="sfg-row">
|
|
18148
18148
|
<div className="sfg-col-4">
|
|
18149
18149
|
<SpsLabel for={formMeta.fields.topFieldset.fields.fsNested.fields.bar}>Bar</SpsLabel>
|
|
@@ -18156,7 +18156,7 @@ const SN = {
|
|
|
18156
18156
|
))}
|
|
18157
18157
|
</div>
|
|
18158
18158
|
</div>
|
|
18159
|
-
<SpsFieldset formMeta={formMeta.fields.topFieldset.fields.fsNested.fields.fsNested2} legend="Doubly Nested
|
|
18159
|
+
<SpsFieldset formMeta={formMeta.fields.topFieldset.fields.fsNested.fields.fsNested2} legend="Doubly Nested Content Section">
|
|
18160
18160
|
<div className="sfg-row">
|
|
18161
18161
|
<div className="sfg-col-4">
|
|
18162
18162
|
<SpsLabel for={formMeta.fields.topFieldset.fields.fsNested.fields.fsNested2.fields.baz}>Baz</SpsLabel>
|
|
@@ -18176,8 +18176,8 @@ const SN = {
|
|
|
18176
18176
|
}
|
|
18177
18177
|
},
|
|
18178
18178
|
c_optional: {
|
|
18179
|
-
label: "Optional
|
|
18180
|
-
description: "info about optional
|
|
18179
|
+
label: "Optional Content Sections",
|
|
18180
|
+
description: "info about optional content sections",
|
|
18181
18181
|
examples: {
|
|
18182
18182
|
optional: {
|
|
18183
18183
|
react: y`
|
|
@@ -18202,7 +18202,7 @@ const SN = {
|
|
|
18202
18202
|
}
|
|
18203
18203
|
|
|
18204
18204
|
return <>
|
|
18205
|
-
<SpsFieldset legend="
|
|
18205
|
+
<SpsFieldset legend="Content Section Legend" formMeta={formMeta.fields.optionalFieldset} optional enabled={false} onToggled={handleToggle}>
|
|
18206
18206
|
<div className="sfg-row">
|
|
18207
18207
|
<div className="sfg-col-4">
|
|
18208
18208
|
<SpsLabel for={formMeta.fields.optionalFieldset.fields.foo}>Foo</SpsLabel>
|
|
@@ -18254,7 +18254,7 @@ const SN = {
|
|
|
18254
18254
|
}, [])
|
|
18255
18255
|
|
|
18256
18256
|
return <>
|
|
18257
|
-
<SpsFieldset formMeta={formMeta.fields.myFieldset} legend="
|
|
18257
|
+
<SpsFieldset formMeta={formMeta.fields.myFieldset} legend="Content Section Legend">
|
|
18258
18258
|
<div className="sfg-row">
|
|
18259
18259
|
<div className="sfg-col-4">
|
|
18260
18260
|
<SpsLabel for={formMeta.fields.myFieldset.fields.foo}>Foo</SpsLabel>
|
|
@@ -18271,8 +18271,8 @@ const SN = {
|
|
|
18271
18271
|
}
|
|
18272
18272
|
},
|
|
18273
18273
|
e_topFieldset: {
|
|
18274
|
-
label: "Validation on
|
|
18275
|
-
description: "info about validation on
|
|
18274
|
+
label: "Validation on Content Section",
|
|
18275
|
+
description: "info about validation on content sections",
|
|
18276
18276
|
examples: {
|
|
18277
18277
|
validationOnFieldset: {
|
|
18278
18278
|
react: y`
|
|
@@ -18320,7 +18320,7 @@ const SN = {
|
|
|
18320
18320
|
|
|
18321
18321
|
return (
|
|
18322
18322
|
<SpsForm formMeta={formMeta}>
|
|
18323
|
-
<SpsFieldset formMeta={formMeta.fields.topFieldset} legend="
|
|
18323
|
+
<SpsFieldset formMeta={formMeta.fields.topFieldset} legend="Content Section Legend">
|
|
18324
18324
|
<div className="sfg-row">
|
|
18325
18325
|
<div className="sfg-col-4">
|
|
18326
18326
|
<SpsLabel for={formMeta.fields.topFieldset.fields.text}>Input</SpsLabel>
|
|
@@ -18331,7 +18331,7 @@ const SN = {
|
|
|
18331
18331
|
</div>
|
|
18332
18332
|
</div>
|
|
18333
18333
|
<SpsFieldset formMeta={formMeta.fields.topFieldset.fields.nestedFieldset}
|
|
18334
|
-
legend="Nested
|
|
18334
|
+
legend="Nested Content Section"
|
|
18335
18335
|
errors={() => formMeta.fields.topFieldset.fields.nestedFieldset.hasError("mustSelectAColor")
|
|
18336
18336
|
&& "If you choose Option B, you must select at least one color."}
|
|
18337
18337
|
>
|
package/lib/index.umd.cjs
CHANGED
|
@@ -1510,7 +1510,7 @@ Valid keys: `+JSON.stringify(Object.keys(W),null," "));var ie=le(oe,ae,U,R,q+".
|
|
|
1510
1510
|
</div>
|
|
1511
1511
|
);
|
|
1512
1512
|
}
|
|
1513
|
-
`}}}},KE=No||Ka,HE={action:"SpsActionMethod",captionKey:"string",comparisonKey:"string",disabled:"boolean",formMeta:"SpsFormFieldMeta<any>",notClearable:"boolean",options:"Eventually<any[]> | (filter?: string) => Eventually<any[]>",onChange:"ChangeEventHandler",onOpen:"OnOpenHandler",placeholder:"string",searchDebounce:"number",searchPlaceholder:"string",tallOptionList:"boolean",textKey:"string",valueKey:"string",value:"any",zeroState:"string",autoFixWidth:"boolean",loading:"boolean",filterByTextAndCaptionKey:"boolean",maxHeightOptionListPx:"number",maxHeightOptionListRem:"number",disableOptionsMemoization:"boolean",onBeforeChange:"(value: string) => boolean | Promise<boolean>"},Yn=o.forwardRef((e,t)=>{const{action:n,autoFixWidth:r=!1,captionKey:a,className:s,comparisonKey:l,disabled:c,formControl:p,formMeta:m,id:f,notClearable:u,options:h,onChange:S,onClick:y,onOpen:T,placeholder:w,searchDebounce:E,searchPlaceholder:N="Search…",tallOptionList:M,textKey:I,valueKey:k,unsafelyReplaceClassName:V,value:B,zeroState:C,loading:P,filterByTextAndCaptionKey:O,maxHeightOptionListPx:K,maxHeightOptionListRem:j,"data-testid":L,disableOptionsMemoization:ee,disableDefaultOptionsFiltering:A,onBeforeChange:te,...$}=e,Z=m||p,{wrapperId:se,controlId:W}=gt(f,Z),z=o.useRef(null),re=o.useRef(null),ne=o.useRef(null),{t:U}=o.useContext(Ke),[R,q]=qt({isOpen:!1,value:B,text:"",keyDown:null,opensUpward:!1,optionIds:""}),[oe,Q]=o.useState();function de(me){q({value:me,text:me&&I?me[I]:me})}async function ae(me){const Se=me&&k&&typeof me=="object"?me[k]:me;te&&!await te(Se)||(de(me),Z&&(Z.setValue(Se),Z.markAsDirty()),S&&S(new gn({value:Se})))}o.useEffect(()=>{de(B)},[B,I]);function le(){ae(void 0)}function ie(){q({isOpen:!1})}function we(me){me.nativeEvent.stopImmediatePropagation(),c||q({isOpen:!R.isOpen})}function Oe(me){c||(["Up","ArrowUp","Down","ArrowDown"," ","Spacebar"].indexOf(me.key)>-1&&me.preventDefault(),Ga.includes(me.key)&&(Q(me),me.preventDefault()),me.persist(),q({keyDown:me}))}function ot(me){q({isOpen:me})}function dt(me){q({opensUpward:me})}function pt(me){me.detail!==se&&q({isOpen:!1})}function it(me){q({optionIds:new Array(me).fill("").map((Se,Be)=>`${se}-options-option-${Be}`).join(",")})}o.useEffect(()=>(document.addEventListener("click",ie),document.addEventListener("DropdownOpened",pt),()=>{document.removeEventListener("click",ie),document.removeEventListener("DropdownOpened",pt)}),[]),o.useLayoutEffect(()=>{if(r&&ne.current&&z.current){z.current.style.width="";const Se=`${z.current.getBoundingClientRect().width+6}px`;z.current.style.width=Se,ne.current.style.width=Se,ne.current.style.maxWidth=Se}}),Ya(()=>{if(R.isOpen){re.current&&KE(re.current,{scrollMode:"if-needed"}),T==null||T();const me=document.createEvent("CustomEvent");me.initCustomEvent("DropdownOpened",!1,!1,se),document.dispatchEvent(me)}},[R.isOpen]),o.useImperativeHandle(t,()=>({focus:()=>{var me;(me=re.current)==null||me.focus()}})),o.useEffect(()=>{let me;return R.isOpen&&(me=()=>{q({isOpen:!1})},window.addEventListener("resize",me)),()=>{me&&window.removeEventListener("resize",me)}},[R.isOpen]),Io({isOpen:R.isOpen,rootRef:re});const Pt=Y(V||"sps-select",R.isOpen&&"sps-select--open",R.isOpen&&"z-stratum-dropdown",R.opensUpward&&"sps-select--opens-upward",s),je=R.text||w||U("design-system:select.defaultPlaceholder");return o.createElement(at,{id:se,className:Pt,onKeyDown:Oe,formControl:p,formMeta:m,ref:re,role:"listbox","aria-owns":R.optionIds,"data-testid":L,onClick:y,...$},o.createElement("div",{className:Y("sps-select__dropctrl",c&&"disabled"),id:W,tabIndex:0,onClick:we,ref:ne,title:je,"data-testid":`${L}-dropctrl`},o.createElement("div",{className:"sps-select__dropctrl-content"},o.createElement("span",{className:Y("sps-select__value",!R.text&&"sps-select__value--placeholder"),"data-testid":`${L}-value`},je),R.value&&!u&&!c&&o.createElement("i",{className:"sps-icon sps-icon-x-circle sps-select__clear-btn",onClick:le,"data-testid":`${L}-clear-value`}),o.createElement("i",{className:"sps-icon sps-icon-chevron-down sps-select__dropctrl-icon"}))),o.createElement(Rr,{id:`${se}-options`,ref:z,attachTo:ne,captionKey:a,comparisonKey:l,isOpen:R.isOpen,keyDown:R.keyDown,options:h,onOptionSelected:ae,onPositionFlip:dt,onSelfToggle:ot,searchDebounce:E,searchPlaceholder:N,selectedOption:R.value,specialAction:n,tall:M,textKey:I,filterByTextAndCaptionKey:O,optionRole:"option",valueKey:k,onOptionListChanged:it,zeroState:C,ignoreWidthStyles:r,loading:P,maxHeightPx:K,maxHeightRem:j,disableOptionsMemoization:ee,disableDefaultOptionsFiltering:A,"data-testid":`${L}-option-list`,typeaheadEvent:oe}))});Object.assign(Yn,{props:HE,displayName:"SpsSelect"});const nu={general:{label:"General Usage",description:({NavigateTo:e})=>x.createElement(x.Fragment,null,x.createElement("h5",null,"Use a Select:"),x.createElement("ul",null,x.createElement("li",{className:"mb-2"},"When a list of predetermined values can be provided.")),x.createElement("h5",null,"Do Not Use a Select:"),x.createElement("ul",null,x.createElement("li",{className:"mb-2"},"When there are only two possible options. Consider"," ",x.createElement(e,{to:"checkbox"},"Checkboxes")," or"," ",x.createElement(e,{to:"radio-buttons"},"Radio Buttons")," insead."),x.createElement("li",{className:"mb-2"},"When it is ideal to display all available options without requiring a click. Consider"," ",x.createElement(e,{to:"checkbox"},"Checkboxes")," or"," ",x.createElement(e,{to:"radio-buttons"},"Radio Buttons")," insead.")),x.createElement("h5",null,"Using Selects in a Form"),x.createElement("p",null,"Reference the ",x.createElement(e,{to:"form"},"Forms")," page for guidelines for placing inputs in Form layouts"))},basic:{label:"Basic
|
|
1513
|
+
`}}}},KE=No||Ka,HE={action:"SpsActionMethod",captionKey:"string",comparisonKey:"string",disabled:"boolean",formMeta:"SpsFormFieldMeta<any>",notClearable:"boolean",options:"Eventually<any[]> | (filter?: string) => Eventually<any[]>",onChange:"ChangeEventHandler",onOpen:"OnOpenHandler",placeholder:"string",searchDebounce:"number",searchPlaceholder:"string",tallOptionList:"boolean",textKey:"string",valueKey:"string",value:"any",zeroState:"string",autoFixWidth:"boolean",loading:"boolean",filterByTextAndCaptionKey:"boolean",maxHeightOptionListPx:"number",maxHeightOptionListRem:"number",disableOptionsMemoization:"boolean",onBeforeChange:"(value: string) => boolean | Promise<boolean>"},Yn=o.forwardRef((e,t)=>{const{action:n,autoFixWidth:r=!1,captionKey:a,className:s,comparisonKey:l,disabled:c,formControl:p,formMeta:m,id:f,notClearable:u,options:h,onChange:S,onClick:y,onOpen:T,placeholder:w,searchDebounce:E,searchPlaceholder:N="Search…",tallOptionList:M,textKey:I,valueKey:k,unsafelyReplaceClassName:V,value:B,zeroState:C,loading:P,filterByTextAndCaptionKey:O,maxHeightOptionListPx:K,maxHeightOptionListRem:j,"data-testid":L,disableOptionsMemoization:ee,disableDefaultOptionsFiltering:A,onBeforeChange:te,...$}=e,Z=m||p,{wrapperId:se,controlId:W}=gt(f,Z),z=o.useRef(null),re=o.useRef(null),ne=o.useRef(null),{t:U}=o.useContext(Ke),[R,q]=qt({isOpen:!1,value:B,text:"",keyDown:null,opensUpward:!1,optionIds:""}),[oe,Q]=o.useState();function de(me){q({value:me,text:me&&I?me[I]:me})}async function ae(me){const Se=me&&k&&typeof me=="object"?me[k]:me;te&&!await te(Se)||(de(me),Z&&(Z.setValue(Se),Z.markAsDirty()),S&&S(new gn({value:Se})))}o.useEffect(()=>{de(B)},[B,I]);function le(){ae(void 0)}function ie(){q({isOpen:!1})}function we(me){me.nativeEvent.stopImmediatePropagation(),c||q({isOpen:!R.isOpen})}function Oe(me){c||(["Up","ArrowUp","Down","ArrowDown"," ","Spacebar"].indexOf(me.key)>-1&&me.preventDefault(),Ga.includes(me.key)&&(Q(me),me.preventDefault()),me.persist(),q({keyDown:me}))}function ot(me){q({isOpen:me})}function dt(me){q({opensUpward:me})}function pt(me){me.detail!==se&&q({isOpen:!1})}function it(me){q({optionIds:new Array(me).fill("").map((Se,Be)=>`${se}-options-option-${Be}`).join(",")})}o.useEffect(()=>(document.addEventListener("click",ie),document.addEventListener("DropdownOpened",pt),()=>{document.removeEventListener("click",ie),document.removeEventListener("DropdownOpened",pt)}),[]),o.useLayoutEffect(()=>{if(r&&ne.current&&z.current){z.current.style.width="";const Se=`${z.current.getBoundingClientRect().width+6}px`;z.current.style.width=Se,ne.current.style.width=Se,ne.current.style.maxWidth=Se}}),Ya(()=>{if(R.isOpen){re.current&&KE(re.current,{scrollMode:"if-needed"}),T==null||T();const me=document.createEvent("CustomEvent");me.initCustomEvent("DropdownOpened",!1,!1,se),document.dispatchEvent(me)}},[R.isOpen]),o.useImperativeHandle(t,()=>({focus:()=>{var me;(me=re.current)==null||me.focus()}})),o.useEffect(()=>{let me;return R.isOpen&&(me=()=>{q({isOpen:!1})},window.addEventListener("resize",me)),()=>{me&&window.removeEventListener("resize",me)}},[R.isOpen]),Io({isOpen:R.isOpen,rootRef:re});const Pt=Y(V||"sps-select",R.isOpen&&"sps-select--open",R.isOpen&&"z-stratum-dropdown",R.opensUpward&&"sps-select--opens-upward",s),je=R.text||w||U("design-system:select.defaultPlaceholder");return o.createElement(at,{id:se,className:Pt,onKeyDown:Oe,formControl:p,formMeta:m,ref:re,role:"listbox","aria-owns":R.optionIds,"data-testid":L,onClick:y,...$},o.createElement("div",{className:Y("sps-select__dropctrl",c&&"disabled"),id:W,tabIndex:0,onClick:we,ref:ne,title:je,"data-testid":`${L}-dropctrl`},o.createElement("div",{className:"sps-select__dropctrl-content"},o.createElement("span",{className:Y("sps-select__value",!R.text&&"sps-select__value--placeholder"),"data-testid":`${L}-value`},je),R.value&&!u&&!c&&o.createElement("i",{className:"sps-icon sps-icon-x-circle sps-select__clear-btn",onClick:le,"data-testid":`${L}-clear-value`}),o.createElement("i",{className:"sps-icon sps-icon-chevron-down sps-select__dropctrl-icon"}))),o.createElement(Rr,{id:`${se}-options`,ref:z,attachTo:ne,captionKey:a,comparisonKey:l,isOpen:R.isOpen,keyDown:R.keyDown,options:h,onOptionSelected:ae,onPositionFlip:dt,onSelfToggle:ot,searchDebounce:E,searchPlaceholder:N,selectedOption:R.value,specialAction:n,tall:M,textKey:I,filterByTextAndCaptionKey:O,optionRole:"option",valueKey:k,onOptionListChanged:it,zeroState:C,ignoreWidthStyles:r,loading:P,maxHeightPx:K,maxHeightRem:j,disableOptionsMemoization:ee,disableDefaultOptionsFiltering:A,"data-testid":`${L}-option-list`,typeaheadEvent:oe}))});Object.assign(Yn,{props:HE,displayName:"SpsSelect"});const nu={general:{label:"General Usage",description:({NavigateTo:e})=>x.createElement(x.Fragment,null,x.createElement("h5",null,"Use a Select:"),x.createElement("ul",null,x.createElement("li",{className:"mb-2"},"When a list of predetermined values can be provided.")),x.createElement("h5",null,"Do Not Use a Select:"),x.createElement("ul",null,x.createElement("li",{className:"mb-2"},"When there are only two possible options. Consider"," ",x.createElement(e,{to:"checkbox"},"Checkboxes")," or"," ",x.createElement(e,{to:"radio-buttons"},"Radio Buttons")," insead."),x.createElement("li",{className:"mb-2"},"When it is ideal to display all available options without requiring a click. Consider"," ",x.createElement(e,{to:"checkbox"},"Checkboxes")," or"," ",x.createElement(e,{to:"radio-buttons"},"Radio Buttons")," insead.")),x.createElement("h5",null,"Using Selects in a Form"),x.createElement("p",null,"Reference the ",x.createElement(e,{to:"form"},"Forms")," page for guidelines for placing inputs in Form layouts"))},basic:{label:"Basic Selects",description:()=>x.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."),examples:{basic:{react:v.code`
|
|
1514
1514
|
import { SpsLabel, SpsSelect, useSpsForm } from "@spscommerce/ds-react";
|
|
1515
1515
|
function DemoComponent() {
|
|
1516
1516
|
const colors = ["red", "blue", "green"];
|
|
@@ -2703,7 +2703,7 @@ var r=n.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_
|
|
|
2703
2703
|
</SpsTable>
|
|
2704
2704
|
)
|
|
2705
2705
|
}
|
|
2706
|
-
`}}}},QE={checked:"boolean",onChange:"ChangeEventHandler",indeterminate:"boolean",disabled:"boolean",options:"Array<SpsActionMethod | [SpsActionDescriptor, () => void]>"};function gi(e){const{options:t,className:n,checked:r,onChange:a,indeterminate:s,disabled:l,"data-testid":c,...p}=e,m=Y("sps-checkbox-dropdown",n);return o.createElement("span",{className:m,"data-testid":c,...p},o.createElement(Fn,{indeterminate:s,checked:r,disabled:l,onChange:a,inline:!0,"data-testid":`${c}__checkbox`}),o.createElement(zn,{disabled:l,options:t,icon:G.SpsIcon.CHEVRON_DOWN,"data-testid":`${c}__dropdown`}))}Object.assign(gi,{props:QE,displayName:"SpsCheckboxDropdown"});const ew={errors:"ReactNodeOrRenderFn",formMeta:"SpsFormSetMeta<any>",legend:"string",hasRequiredFields:"boolean",optional:"boolean",enabled:"boolean",onToggled:"(isEnabled: boolean) => void",tooltip:"string",applyNestedStyles:"boolean"};function bi({children:e,className:t,errors:n,formArray:r,formGroup:a,formMeta:s,legend:l,unsafelyReplaceClassName:c,hasRequiredFields:p=!1,optional:m=!1,enabled:f=!1,onToggled:u,tooltip:h,applyNestedStyles:S,"data-testid":y,errorsTooltipTrigger:T=G.TooltipShowTrigger.CLICK,errorsTooltipPosition:w=G.Position.LEFT_MIDDLE}){const E=a||r,N=o.useRef(null),M=o.useRef(null),[I,k]=o.useState(xe.HIDDEN),[V,B]=o.useState(!1),[C,P]=o.useState(f);Ya(()=>{u==null||u(C)},[C]),o.useEffect(()=>{if(E||s){const j=E&&E.isFocused()||s&&s.isFocused();!V&&j?k(xe.VISIBLE):V&&!j&&k(xe.HIDDEN),B(j||!1)}});const O=Y(c||S?"nested-styles-fieldset":"sps-fieldset",(E&&!E.isPristine()&&E.invalid||s&&(!s.isValid()||!s.contentsAreValid()))&&"sps-fieldset--error",t,m&&!C&&"sps-fieldset--collapsed",p&&"sps-fieldset--required-fields");function K(){k(I===xe.VISIBLE?xe.HIDDEN:xe.VISIBLE)}return o.createElement("div",{className:"sps-fieldset-container"},o.createElement("fieldset",{className:O,"data-testid":y},o.createElement("legend",{className:"sps-fieldset__legend",ref:N,onMouseEnter:()=>k(xe.VISIBLE),onMouseLeave:()=>k(xe.DELAYED_HIDDEN),onClick:K},m&&o.createElement(Fn,{checked:C,className:"d-inline-flex pr-1",onChange:j=>{P(j.target.checked)},"data-testid":`${y}__checkbox`}),l,h&&o.createElement("span",{className:"sps-fieldset__legend-icon",ref:M},o.createElement(Vt,{icon:G.SpsIcon.INFO_CIRCLE,"data-testid":`${y}__info-icon`}))),h&&o.createElement(Lt,{for:M},h),!!n&&o.createElement(Lt,{for:N,kind:G.TooltipKind.ERROR,showOn:T,position:w,isShown:I},bt(n)),e))}Object.assign(bi,{props:ew,displayName:"SpsFieldset"});const bu={basic:{label:"Basic
|
|
2706
|
+
`}}}},QE={checked:"boolean",onChange:"ChangeEventHandler",indeterminate:"boolean",disabled:"boolean",options:"Array<SpsActionMethod | [SpsActionDescriptor, () => void]>"};function gi(e){const{options:t,className:n,checked:r,onChange:a,indeterminate:s,disabled:l,"data-testid":c,...p}=e,m=Y("sps-checkbox-dropdown",n);return o.createElement("span",{className:m,"data-testid":c,...p},o.createElement(Fn,{indeterminate:s,checked:r,disabled:l,onChange:a,inline:!0,"data-testid":`${c}__checkbox`}),o.createElement(zn,{disabled:l,options:t,icon:G.SpsIcon.CHEVRON_DOWN,"data-testid":`${c}__dropdown`}))}Object.assign(gi,{props:QE,displayName:"SpsCheckboxDropdown"});const ew={errors:"ReactNodeOrRenderFn",formMeta:"SpsFormSetMeta<any>",legend:"string",hasRequiredFields:"boolean",optional:"boolean",enabled:"boolean",onToggled:"(isEnabled: boolean) => void",tooltip:"string",applyNestedStyles:"boolean"};function bi({children:e,className:t,errors:n,formArray:r,formGroup:a,formMeta:s,legend:l,unsafelyReplaceClassName:c,hasRequiredFields:p=!1,optional:m=!1,enabled:f=!1,onToggled:u,tooltip:h,applyNestedStyles:S,"data-testid":y,errorsTooltipTrigger:T=G.TooltipShowTrigger.CLICK,errorsTooltipPosition:w=G.Position.LEFT_MIDDLE}){const E=a||r,N=o.useRef(null),M=o.useRef(null),[I,k]=o.useState(xe.HIDDEN),[V,B]=o.useState(!1),[C,P]=o.useState(f);Ya(()=>{u==null||u(C)},[C]),o.useEffect(()=>{if(E||s){const j=E&&E.isFocused()||s&&s.isFocused();!V&&j?k(xe.VISIBLE):V&&!j&&k(xe.HIDDEN),B(j||!1)}});const O=Y(c||S?"nested-styles-fieldset":"sps-fieldset",(E&&!E.isPristine()&&E.invalid||s&&(!s.isValid()||!s.contentsAreValid()))&&"sps-fieldset--error",t,m&&!C&&"sps-fieldset--collapsed",p&&"sps-fieldset--required-fields");function K(){k(I===xe.VISIBLE?xe.HIDDEN:xe.VISIBLE)}return o.createElement("div",{className:"sps-fieldset-container"},o.createElement("fieldset",{className:O,"data-testid":y},o.createElement("legend",{className:"sps-fieldset__legend",ref:N,onMouseEnter:()=>k(xe.VISIBLE),onMouseLeave:()=>k(xe.DELAYED_HIDDEN),onClick:K},m&&o.createElement(Fn,{checked:C,className:"d-inline-flex pr-1",onChange:j=>{P(j.target.checked)},"data-testid":`${y}__checkbox`}),l,h&&o.createElement("span",{className:"sps-fieldset__legend-icon",ref:M},o.createElement(Vt,{icon:G.SpsIcon.INFO_CIRCLE,"data-testid":`${y}__info-icon`}))),h&&o.createElement(Lt,{for:M},h),!!n&&o.createElement(Lt,{for:N,kind:G.TooltipKind.ERROR,showOn:T,position:w,isShown:I},bt(n)),e))}Object.assign(bi,{props:ew,displayName:"SpsFieldset"});const bu={basic:{label:"Basic Content Sections",description:"info about basic content sections",examples:{basic:{react:v.code`
|
|
2707
2707
|
import {
|
|
2708
2708
|
useSpsForm,
|
|
2709
2709
|
SpsFieldset,
|
|
@@ -2726,7 +2726,7 @@ var r=n.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_
|
|
|
2726
2726
|
});
|
|
2727
2727
|
|
|
2728
2728
|
return <>
|
|
2729
|
-
<SpsFieldset formMeta={formMeta.fields.myFieldset} legend="
|
|
2729
|
+
<SpsFieldset formMeta={formMeta.fields.myFieldset} legend="Content Section Legend" tooltip="Add a Tooltip">
|
|
2730
2730
|
<div className="sfg-row">
|
|
2731
2731
|
<div className="sfg-col-4">
|
|
2732
2732
|
<SpsLabel for={formMeta.fields.myFieldset.fields.foo}>Foo</SpsLabel>
|
|
@@ -2754,7 +2754,7 @@ var r=n.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_
|
|
|
2754
2754
|
</SpsFieldset>
|
|
2755
2755
|
</>
|
|
2756
2756
|
}
|
|
2757
|
-
`}}},b_nested:{label:"Nested
|
|
2757
|
+
`}}},b_nested:{label:"Nested Content Sections",description:"info about nested content sections",examples:{nested:{react:v.code`
|
|
2758
2758
|
import {
|
|
2759
2759
|
useSpsForm,
|
|
2760
2760
|
SpsFieldset,
|
|
@@ -2781,7 +2781,7 @@ var r=n.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_
|
|
|
2781
2781
|
});
|
|
2782
2782
|
|
|
2783
2783
|
return <>
|
|
2784
|
-
<SpsFieldset formMeta={formMeta.fields.topFieldset} legend="
|
|
2784
|
+
<SpsFieldset formMeta={formMeta.fields.topFieldset} legend="Content Section Legend">
|
|
2785
2785
|
<div className="sfg-row">
|
|
2786
2786
|
<div className="sfg-col-4">
|
|
2787
2787
|
<SpsLabel for={formMeta.fields.topFieldset.fields.foo}>Foo</SpsLabel>
|
|
@@ -2791,7 +2791,7 @@ var r=n.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_
|
|
|
2791
2791
|
></SpsTextInput>
|
|
2792
2792
|
</div>
|
|
2793
2793
|
</div>
|
|
2794
|
-
<SpsFieldset formMeta={formMeta.fields.topFieldset.fields.fsNested} legend="Nested
|
|
2794
|
+
<SpsFieldset formMeta={formMeta.fields.topFieldset.fields.fsNested} legend="Nested Content Section">
|
|
2795
2795
|
<div className="sfg-row">
|
|
2796
2796
|
<div className="sfg-col-4">
|
|
2797
2797
|
<SpsLabel for={formMeta.fields.topFieldset.fields.fsNested.fields.bar}>Bar</SpsLabel>
|
|
@@ -2804,7 +2804,7 @@ var r=n.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_
|
|
|
2804
2804
|
))}
|
|
2805
2805
|
</div>
|
|
2806
2806
|
</div>
|
|
2807
|
-
<SpsFieldset formMeta={formMeta.fields.topFieldset.fields.fsNested.fields.fsNested2} legend="Doubly Nested
|
|
2807
|
+
<SpsFieldset formMeta={formMeta.fields.topFieldset.fields.fsNested.fields.fsNested2} legend="Doubly Nested Content Section">
|
|
2808
2808
|
<div className="sfg-row">
|
|
2809
2809
|
<div className="sfg-col-4">
|
|
2810
2810
|
<SpsLabel for={formMeta.fields.topFieldset.fields.fsNested.fields.fsNested2.fields.baz}>Baz</SpsLabel>
|
|
@@ -2819,7 +2819,7 @@ var r=n.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_
|
|
|
2819
2819
|
</SpsFieldset>
|
|
2820
2820
|
</>
|
|
2821
2821
|
}
|
|
2822
|
-
`}}},c_optional:{label:"Optional
|
|
2822
|
+
`}}},c_optional:{label:"Optional Content Sections",description:"info about optional content sections",examples:{optional:{react:v.code`
|
|
2823
2823
|
import {
|
|
2824
2824
|
useSpsForm,
|
|
2825
2825
|
SpsFieldset,
|
|
@@ -2841,7 +2841,7 @@ var r=n.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_
|
|
|
2841
2841
|
}
|
|
2842
2842
|
|
|
2843
2843
|
return <>
|
|
2844
|
-
<SpsFieldset legend="
|
|
2844
|
+
<SpsFieldset legend="Content Section Legend" formMeta={formMeta.fields.optionalFieldset} optional enabled={false} onToggled={handleToggle}>
|
|
2845
2845
|
<div className="sfg-row">
|
|
2846
2846
|
<div className="sfg-col-4">
|
|
2847
2847
|
<SpsLabel for={formMeta.fields.optionalFieldset.fields.foo}>Foo</SpsLabel>
|
|
@@ -2884,7 +2884,7 @@ var r=n.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_
|
|
|
2884
2884
|
}, [])
|
|
2885
2885
|
|
|
2886
2886
|
return <>
|
|
2887
|
-
<SpsFieldset formMeta={formMeta.fields.myFieldset} legend="
|
|
2887
|
+
<SpsFieldset formMeta={formMeta.fields.myFieldset} legend="Content Section Legend">
|
|
2888
2888
|
<div className="sfg-row">
|
|
2889
2889
|
<div className="sfg-col-4">
|
|
2890
2890
|
<SpsLabel for={formMeta.fields.myFieldset.fields.foo}>Foo</SpsLabel>
|
|
@@ -2896,7 +2896,7 @@ var r=n.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_
|
|
|
2896
2896
|
</SpsFieldset>
|
|
2897
2897
|
</>
|
|
2898
2898
|
}
|
|
2899
|
-
`}}},e_topFieldset:{label:"Validation on
|
|
2899
|
+
`}}},e_topFieldset:{label:"Validation on Content Section",description:"info about validation on content sections",examples:{validationOnFieldset:{react:v.code`
|
|
2900
2900
|
import {
|
|
2901
2901
|
useSpsForm,
|
|
2902
2902
|
SpsForm,
|
|
@@ -2941,7 +2941,7 @@ var r=n.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_
|
|
|
2941
2941
|
|
|
2942
2942
|
return (
|
|
2943
2943
|
<SpsForm formMeta={formMeta}>
|
|
2944
|
-
<SpsFieldset formMeta={formMeta.fields.topFieldset} legend="
|
|
2944
|
+
<SpsFieldset formMeta={formMeta.fields.topFieldset} legend="Content Section Legend">
|
|
2945
2945
|
<div className="sfg-row">
|
|
2946
2946
|
<div className="sfg-col-4">
|
|
2947
2947
|
<SpsLabel for={formMeta.fields.topFieldset.fields.text}>Input</SpsLabel>
|
|
@@ -2952,7 +2952,7 @@ var r=n.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_
|
|
|
2952
2952
|
</div>
|
|
2953
2953
|
</div>
|
|
2954
2954
|
<SpsFieldset formMeta={formMeta.fields.topFieldset.fields.nestedFieldset}
|
|
2955
|
-
legend="Nested
|
|
2955
|
+
legend="Nested Content Section"
|
|
2956
2956
|
errors={() => formMeta.fields.topFieldset.fields.nestedFieldset.hasError("mustSelectAColor")
|
|
2957
2957
|
&& "If you choose Option B, you must select at least one color."}
|
|
2958
2958
|
>
|
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": "8.23.
|
|
4
|
+
"version": "8.23.14",
|
|
5
5
|
"author": "SPS Commerce",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"repository": "https://github.com/spscommerce/woodland/tree/main/packages/@spscommerce/ds-react",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"moment-timezone": "^0.5.28",
|
|
47
47
|
"react": "^16.9.0",
|
|
48
48
|
"react-dom": "^16.9.0",
|
|
49
|
-
"@sps-woodland/illustrations": "8.23.
|
|
50
|
-
"@sps-woodland/tabs": "8.23.
|
|
51
|
-
"@spscommerce/ds-colors": "8.23.
|
|
52
|
-
"@spscommerce/ds-shared": "8.23.
|
|
53
|
-
"@spscommerce/positioning": "8.23.
|
|
49
|
+
"@sps-woodland/illustrations": "8.23.14",
|
|
50
|
+
"@sps-woodland/tabs": "8.23.14",
|
|
51
|
+
"@spscommerce/ds-colors": "8.23.14",
|
|
52
|
+
"@spscommerce/ds-shared": "8.23.14",
|
|
53
|
+
"@spscommerce/positioning": "8.23.14"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@react-spectrum/provider": "^3.4.1",
|
|
@@ -72,12 +72,12 @@
|
|
|
72
72
|
"raf-stub": "^2.0.2",
|
|
73
73
|
"react": "^16.9.0",
|
|
74
74
|
"react-dom": "^16.9.0",
|
|
75
|
-
"@sps-woodland/illustrations": "8.23.
|
|
76
|
-
"@sps-woodland/tabs": "8.23.
|
|
77
|
-
"@spscommerce/ds-colors": "8.23.
|
|
78
|
-
"@spscommerce/ds-shared": "8.23.
|
|
79
|
-
"@spscommerce/positioning": "8.23.
|
|
80
|
-
"test": "8.23.
|
|
75
|
+
"@sps-woodland/illustrations": "8.23.14",
|
|
76
|
+
"@sps-woodland/tabs": "8.23.14",
|
|
77
|
+
"@spscommerce/ds-colors": "8.23.14",
|
|
78
|
+
"@spscommerce/ds-shared": "8.23.14",
|
|
79
|
+
"@spscommerce/positioning": "8.23.14",
|
|
80
|
+
"test": "8.23.14"
|
|
81
81
|
},
|
|
82
82
|
"scripts": {
|
|
83
83
|
"build": "pnpm run build:js && pnpm run build:types",
|