@spscommerce/ds-react 5.21.5 → 5.22.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.cjs.js +159 -151
- package/lib/index.es.js +194 -135
- package/lib/text-input/SpsTextInput.d.ts +2 -1
- package/lib/textarea/SpsTextarea.d.ts +2 -1
- package/package.json +11 -11
package/lib/index.es.js
CHANGED
|
@@ -34806,7 +34806,8 @@ const propsDoc$v = {
|
|
|
34806
34806
|
name: "string",
|
|
34807
34807
|
onChange: "ChangeEventHandler<HTMLInputElement>",
|
|
34808
34808
|
placeholder: "string",
|
|
34809
|
-
value: "string"
|
|
34809
|
+
value: "string",
|
|
34810
|
+
additionalText: "string"
|
|
34810
34811
|
};
|
|
34811
34812
|
const propTypes$x = __spreadProps(__spreadValues({}, spsGlobalPropTypes), {
|
|
34812
34813
|
disabled: propTypes$1O.exports.bool,
|
|
@@ -34816,7 +34817,8 @@ const propTypes$x = __spreadProps(__spreadValues({}, spsGlobalPropTypes), {
|
|
|
34816
34817
|
name: propTypes$1O.exports.string,
|
|
34817
34818
|
onChange: fun(),
|
|
34818
34819
|
placeholder: propTypes$1O.exports.string,
|
|
34819
|
-
value: propTypes$1O.exports.string
|
|
34820
|
+
value: propTypes$1O.exports.string,
|
|
34821
|
+
additionalText: propTypes$1O.exports.string
|
|
34820
34822
|
});
|
|
34821
34823
|
const SpsTextInput = React.forwardRef((_G, ref2) => {
|
|
34822
34824
|
var _H = _G, {
|
|
@@ -34832,7 +34834,8 @@ const SpsTextInput = React.forwardRef((_G, ref2) => {
|
|
|
34832
34834
|
"data-testid": testId,
|
|
34833
34835
|
title,
|
|
34834
34836
|
unsafelyReplaceClassName,
|
|
34835
|
-
value = ""
|
|
34837
|
+
value = "",
|
|
34838
|
+
additionalText
|
|
34836
34839
|
} = _H, rest = __objRest(_H, [
|
|
34837
34840
|
"className",
|
|
34838
34841
|
"disabled",
|
|
@@ -34846,7 +34849,8 @@ const SpsTextInput = React.forwardRef((_G, ref2) => {
|
|
|
34846
34849
|
"data-testid",
|
|
34847
34850
|
"title",
|
|
34848
34851
|
"unsafelyReplaceClassName",
|
|
34849
|
-
"value"
|
|
34852
|
+
"value",
|
|
34853
|
+
"additionalText"
|
|
34850
34854
|
]);
|
|
34851
34855
|
const meta = formMeta || formControl2;
|
|
34852
34856
|
const { wrapperId, controlId } = useFormControlId(id2, meta);
|
|
@@ -34897,7 +34901,9 @@ const SpsTextInput = React.forwardRef((_G, ref2) => {
|
|
|
34897
34901
|
"data-testid": `${testId}__input_clear`,
|
|
34898
34902
|
className: "sps-icon sps-icon-x-circle sps-form-control__clear-btn",
|
|
34899
34903
|
onClick: clear
|
|
34900
|
-
}))
|
|
34904
|
+
})), additionalText && /* @__PURE__ */ React.createElement("p", {
|
|
34905
|
+
className: "sps-input__additional-text"
|
|
34906
|
+
}, additionalText));
|
|
34901
34907
|
});
|
|
34902
34908
|
Object.assign(SpsTextInput, {
|
|
34903
34909
|
props: propsDoc$v,
|
|
@@ -34905,91 +34911,118 @@ Object.assign(SpsTextInput, {
|
|
|
34905
34911
|
displayName: "SpsTextInput"
|
|
34906
34912
|
});
|
|
34907
34913
|
const SpsTextInputExamples = {
|
|
34908
|
-
|
|
34909
|
-
label: "
|
|
34910
|
-
description: "
|
|
34914
|
+
general: {
|
|
34915
|
+
label: "General Usage",
|
|
34916
|
+
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, {
|
|
34917
|
+
to: "text-areas"
|
|
34918
|
+
}, "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, {
|
|
34919
|
+
to: "multi-select"
|
|
34920
|
+
}, "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, {
|
|
34921
|
+
to: "checkbox"
|
|
34922
|
+
}, "Checkboxes"), ",", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
|
|
34923
|
+
to: "radio-buttons"
|
|
34924
|
+
}, "Radio Buttons"), " or", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
|
|
34925
|
+
to: "toggle"
|
|
34926
|
+
}, "Toggles"), " instead.")))
|
|
34927
|
+
},
|
|
34928
|
+
basic: {
|
|
34929
|
+
label: "Basic Text Inputs",
|
|
34930
|
+
description: () => /* @__PURE__ */ React.createElement("p", null, "Basic Text Inputs include a label and an input field."),
|
|
34911
34931
|
examples: {
|
|
34912
34932
|
standard: {
|
|
34913
34933
|
react: code`
|
|
34914
34934
|
function DemoComponent() {
|
|
34915
|
-
const { formValue, formMeta, updateForm } = useSpsForm({
|
|
34935
|
+
const { formValue, formMeta, updateForm } = useSpsForm({ companyName: "" });
|
|
34916
34936
|
|
|
34917
|
-
return
|
|
34918
|
-
<
|
|
34919
|
-
|
|
34920
|
-
|
|
34921
|
-
|
|
34922
|
-
|
|
34923
|
-
|
|
34937
|
+
return (
|
|
34938
|
+
<div className="sfg-row">
|
|
34939
|
+
<div className="sfg-col-4">
|
|
34940
|
+
<SpsLabel for={formMeta.fields.companyName}>Company Name</SpsLabel>
|
|
34941
|
+
<SpsTextInput
|
|
34942
|
+
value={formValue.companyName}
|
|
34943
|
+
formMeta={formMeta.fields.companyName}
|
|
34944
|
+
/>
|
|
34945
|
+
</div>
|
|
34946
|
+
</div>
|
|
34947
|
+
);
|
|
34924
34948
|
}
|
|
34925
34949
|
`
|
|
34926
34950
|
}
|
|
34927
34951
|
}
|
|
34928
34952
|
},
|
|
34929
|
-
|
|
34930
|
-
label: "Placeholder",
|
|
34931
|
-
description: "
|
|
34953
|
+
placeholder: {
|
|
34954
|
+
label: "Placeholder Text",
|
|
34955
|
+
description: ({ NavigateTo }) => /* @__PURE__ */ React.createElement("p", null, "Certain inputs may benefit from placeholder text to aid the user in providing a valid value."),
|
|
34932
34956
|
examples: {
|
|
34933
34957
|
placeholder: {
|
|
34934
34958
|
react: code`
|
|
34935
34959
|
function DemoComponent() {
|
|
34936
|
-
|
|
34960
|
+
const { formValue, formMeta, updateForm } = useSpsForm({ phoneNumber: "" });
|
|
34937
34961
|
|
|
34938
|
-
|
|
34939
|
-
|
|
34940
|
-
|
|
34941
|
-
|
|
34942
|
-
|
|
34943
|
-
|
|
34944
|
-
|
|
34945
|
-
|
|
34946
|
-
|
|
34962
|
+
return (
|
|
34963
|
+
<div className="sfg-row">
|
|
34964
|
+
<div className="sfg-col-4">
|
|
34965
|
+
<SpsLabel for={formMeta.fields.phoneNumber}>Phone Number</SpsLabel>
|
|
34966
|
+
<SpsTextInput
|
|
34967
|
+
value={formValue.phoneNumber}
|
|
34968
|
+
formMeta={formMeta.fields.phoneNumber}
|
|
34969
|
+
placeholder="(000) 000-0000"
|
|
34970
|
+
/>
|
|
34971
|
+
</div>
|
|
34972
|
+
</div>
|
|
34973
|
+
);
|
|
34947
34974
|
}
|
|
34948
34975
|
`
|
|
34949
34976
|
}
|
|
34950
34977
|
}
|
|
34951
34978
|
},
|
|
34952
|
-
|
|
34953
|
-
label: "
|
|
34954
|
-
description: "
|
|
34979
|
+
additional_text: {
|
|
34980
|
+
label: "Additional Descriptive Text",
|
|
34981
|
+
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
34982
|
examples: {
|
|
34956
|
-
|
|
34983
|
+
placeholder: {
|
|
34957
34984
|
react: code`
|
|
34958
34985
|
function DemoComponent() {
|
|
34959
|
-
|
|
34986
|
+
const { formValue, formMeta, updateForm } = useSpsForm({ password: "" });
|
|
34960
34987
|
|
|
34961
|
-
|
|
34962
|
-
|
|
34963
|
-
|
|
34964
|
-
|
|
34965
|
-
|
|
34966
|
-
|
|
34967
|
-
|
|
34968
|
-
|
|
34969
|
-
|
|
34988
|
+
return (
|
|
34989
|
+
<div className="sfg-row">
|
|
34990
|
+
<div className="sfg-col-4">
|
|
34991
|
+
<SpsLabel for={formMeta.fields.password}>Password</SpsLabel>
|
|
34992
|
+
<SpsTextInput
|
|
34993
|
+
value={formValue.password}
|
|
34994
|
+
formMeta={formMeta.fields.password}
|
|
34995
|
+
additionalText="Password must be 8-12 characters in length and include: 1 capital letter, 1 number and 1 special character"
|
|
34996
|
+
/>
|
|
34997
|
+
</div>
|
|
34998
|
+
</div>
|
|
34999
|
+
);
|
|
34970
35000
|
}
|
|
34971
35001
|
`
|
|
34972
35002
|
}
|
|
34973
35003
|
}
|
|
34974
35004
|
},
|
|
34975
|
-
|
|
34976
|
-
label: "Disabled",
|
|
34977
|
-
description: "
|
|
35005
|
+
disabled: {
|
|
35006
|
+
label: "Disabled State",
|
|
35007
|
+
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
35008
|
examples: {
|
|
34979
|
-
|
|
35009
|
+
standard: {
|
|
34980
35010
|
react: code`
|
|
34981
35011
|
function DemoComponent() {
|
|
34982
|
-
const { formValue, formMeta, updateForm } = useSpsForm({
|
|
35012
|
+
const { formValue, formMeta, updateForm } = useSpsForm({ companyName: "FGL Sports" });
|
|
34983
35013
|
|
|
34984
|
-
return
|
|
34985
|
-
|
|
34986
|
-
|
|
34987
|
-
|
|
34988
|
-
|
|
34989
|
-
|
|
34990
|
-
|
|
34991
|
-
|
|
34992
|
-
|
|
35014
|
+
return (
|
|
35015
|
+
<div className="sfg-row">
|
|
35016
|
+
<div className="sfg-col-4">
|
|
35017
|
+
<SpsLabel for={formMeta.fields.companyName}>Company Name</SpsLabel>
|
|
35018
|
+
<SpsTextInput
|
|
35019
|
+
value={formValue.companyName}
|
|
35020
|
+
formMeta={formMeta.fields.companyName}
|
|
35021
|
+
disabled
|
|
35022
|
+
/>
|
|
35023
|
+
</div>
|
|
35024
|
+
</div>
|
|
35025
|
+
);
|
|
34993
35026
|
}
|
|
34994
35027
|
`
|
|
34995
35028
|
}
|
|
@@ -35003,7 +35036,8 @@ const propsDoc$u = {
|
|
|
35003
35036
|
onChange: "ChangeEventHandler",
|
|
35004
35037
|
placeholder: "string",
|
|
35005
35038
|
rows: "number",
|
|
35006
|
-
value: "string"
|
|
35039
|
+
value: "string",
|
|
35040
|
+
additionalText: "string"
|
|
35007
35041
|
};
|
|
35008
35042
|
const propTypes$w = __spreadProps(__spreadValues({}, spsGlobalPropTypes), {
|
|
35009
35043
|
disabled: propTypes$1O.exports.bool,
|
|
@@ -35014,7 +35048,8 @@ const propTypes$w = __spreadProps(__spreadValues({}, spsGlobalPropTypes), {
|
|
|
35014
35048
|
placeholder: propTypes$1O.exports.string,
|
|
35015
35049
|
ref: ref(),
|
|
35016
35050
|
rows: propTypes$1O.exports.number,
|
|
35017
|
-
value: propTypes$1O.exports.string
|
|
35051
|
+
value: propTypes$1O.exports.string,
|
|
35052
|
+
additionalText: propTypes$1O.exports.string
|
|
35018
35053
|
});
|
|
35019
35054
|
function SpsTextarea(_I) {
|
|
35020
35055
|
var _J = _I, {
|
|
@@ -35030,7 +35065,8 @@ function SpsTextarea(_I) {
|
|
|
35030
35065
|
rows = 2,
|
|
35031
35066
|
"data-testid": testId,
|
|
35032
35067
|
unsafelyReplaceClassName,
|
|
35033
|
-
value = ""
|
|
35068
|
+
value = "",
|
|
35069
|
+
additionalText
|
|
35034
35070
|
} = _J, rest = __objRest(_J, [
|
|
35035
35071
|
"className",
|
|
35036
35072
|
"disabled",
|
|
@@ -35044,7 +35080,8 @@ function SpsTextarea(_I) {
|
|
|
35044
35080
|
"rows",
|
|
35045
35081
|
"data-testid",
|
|
35046
35082
|
"unsafelyReplaceClassName",
|
|
35047
|
-
"value"
|
|
35083
|
+
"value",
|
|
35084
|
+
"additionalText"
|
|
35048
35085
|
]);
|
|
35049
35086
|
const meta = formMeta || formControl2;
|
|
35050
35087
|
const { wrapperId, controlId } = useFormControlId(id2, meta);
|
|
@@ -35092,7 +35129,9 @@ function SpsTextarea(_I) {
|
|
|
35092
35129
|
"data-testid": `${testId}__input_clear`,
|
|
35093
35130
|
className: "sps-icon sps-icon-x-circle sps-form-control__clear-btn",
|
|
35094
35131
|
onClick: clear
|
|
35095
|
-
}))
|
|
35132
|
+
})), additionalText && /* @__PURE__ */ React.createElement("p", {
|
|
35133
|
+
className: "sps-input__additional-text"
|
|
35134
|
+
}, additionalText));
|
|
35096
35135
|
}
|
|
35097
35136
|
Object.assign(SpsTextarea, {
|
|
35098
35137
|
props: propsDoc$u,
|
|
@@ -35100,101 +35139,119 @@ Object.assign(SpsTextarea, {
|
|
|
35100
35139
|
displayName: "SpsTextarea"
|
|
35101
35140
|
});
|
|
35102
35141
|
const SpsTextareaExamples = {
|
|
35142
|
+
general: {
|
|
35143
|
+
label: "General Usage",
|
|
35144
|
+
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, {
|
|
35145
|
+
to: "text-inputs"
|
|
35146
|
+
}, "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, {
|
|
35147
|
+
to: "multi-select"
|
|
35148
|
+
}, "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, {
|
|
35149
|
+
to: "checkbox"
|
|
35150
|
+
}, "Checkboxes"), ",", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
|
|
35151
|
+
to: "radio-buttons"
|
|
35152
|
+
}, "Radio Buttons"), " or", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
|
|
35153
|
+
to: "toggle"
|
|
35154
|
+
}, "Toggles"), " instead.")))
|
|
35155
|
+
},
|
|
35103
35156
|
basic: {
|
|
35104
|
-
label: "Basic",
|
|
35105
|
-
description: "
|
|
35157
|
+
label: "Basic Text Areas",
|
|
35158
|
+
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
35159
|
examples: {
|
|
35107
|
-
|
|
35160
|
+
standard: {
|
|
35108
35161
|
react: code`
|
|
35109
35162
|
function DemoComponent() {
|
|
35110
|
-
|
|
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
|
-
}
|
|
35163
|
+
const { formValue, formMeta, updateForm } = useSpsForm({ notes: "" });
|
|
35124
35164
|
|
|
35125
|
-
|
|
35126
|
-
|
|
35127
|
-
|
|
35128
|
-
|
|
35129
|
-
|
|
35165
|
+
return (
|
|
35166
|
+
<div className="sfg-row">
|
|
35167
|
+
<div className="sfg-col-4">
|
|
35168
|
+
<SpsLabel for={formMeta.fields.notes}>Notes</SpsLabel>
|
|
35169
|
+
<SpsTextarea
|
|
35170
|
+
value={formValue.notes}
|
|
35171
|
+
formMeta={formMeta.fields.notes}
|
|
35172
|
+
rows={5}
|
|
35173
|
+
/>
|
|
35174
|
+
</div>
|
|
35175
|
+
</div>
|
|
35176
|
+
);
|
|
35177
|
+
}
|
|
35178
|
+
`
|
|
35179
|
+
}
|
|
35180
|
+
}
|
|
35181
|
+
},
|
|
35182
|
+
placeholder: {
|
|
35183
|
+
label: "Placeholder Text",
|
|
35184
|
+
description: ({ NavigateTo }) => /* @__PURE__ */ React.createElement("p", null, "Certain inputs may benefit from placeholder text to aid the user in providing a valid value."),
|
|
35185
|
+
examples: {
|
|
35186
|
+
placeholder: {
|
|
35187
|
+
react: code`
|
|
35188
|
+
function DemoComponent() {
|
|
35189
|
+
const { formValue, formMeta, updateForm } = useSpsForm({ companyDescription: "" });
|
|
35130
35190
|
|
|
35131
|
-
|
|
35132
|
-
|
|
35133
|
-
|
|
35134
|
-
|
|
35135
|
-
|
|
35136
|
-
|
|
35137
|
-
|
|
35138
|
-
|
|
35139
|
-
|
|
35140
|
-
|
|
35141
|
-
|
|
35142
|
-
|
|
35143
|
-
</SpsLabel>
|
|
35144
|
-
<SpsTextarea placeholder="Write a haiku" rows={3}
|
|
35145
|
-
formMeta={formMeta.fields.haiku}
|
|
35146
|
-
value={formValue.haiku}
|
|
35147
|
-
></SpsTextarea>
|
|
35148
|
-
</>
|
|
35191
|
+
return (
|
|
35192
|
+
<div className="sfg-row">
|
|
35193
|
+
<div className="sfg-col-4">
|
|
35194
|
+
<SpsLabel for={formMeta.fields.companyDescription}>Company Description</SpsLabel>
|
|
35195
|
+
<SpsTextarea
|
|
35196
|
+
value={formValue.companyDescription}
|
|
35197
|
+
formMeta={formMeta.fields.companyDescription}
|
|
35198
|
+
placeholder="Describe your company"
|
|
35199
|
+
/>
|
|
35200
|
+
</div>
|
|
35201
|
+
</div>
|
|
35202
|
+
);
|
|
35149
35203
|
}
|
|
35150
35204
|
`
|
|
35151
35205
|
}
|
|
35152
35206
|
}
|
|
35153
35207
|
},
|
|
35154
|
-
|
|
35155
|
-
label: "
|
|
35156
|
-
description: "
|
|
35208
|
+
additional_text: {
|
|
35209
|
+
label: "Additional Descriptive Text",
|
|
35210
|
+
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
35211
|
examples: {
|
|
35158
|
-
|
|
35212
|
+
placeholder: {
|
|
35159
35213
|
react: code`
|
|
35160
35214
|
function DemoComponent() {
|
|
35161
|
-
|
|
35162
|
-
textareaWithDescription: ""
|
|
35163
|
-
});
|
|
35215
|
+
const { formValue, formMeta, updateForm } = useSpsForm({ campaignNotes: "" });
|
|
35164
35216
|
|
|
35165
|
-
|
|
35166
|
-
|
|
35167
|
-
|
|
35168
|
-
|
|
35169
|
-
|
|
35170
|
-
|
|
35171
|
-
|
|
35172
|
-
|
|
35173
|
-
|
|
35174
|
-
|
|
35217
|
+
return (
|
|
35218
|
+
<div className="sfg-row">
|
|
35219
|
+
<div className="sfg-col-4">
|
|
35220
|
+
<SpsLabel for={formMeta.fields.campaignNotes}>Campaign Notes</SpsLabel>
|
|
35221
|
+
<SpsTextarea
|
|
35222
|
+
value={formValue.campaignNotes}
|
|
35223
|
+
formMeta={formMeta.fields.campaignNotes}
|
|
35224
|
+
additionalText="List any additional comments, questions or information about this campaign."
|
|
35225
|
+
/>
|
|
35226
|
+
</div>
|
|
35227
|
+
</div>
|
|
35228
|
+
);
|
|
35175
35229
|
}
|
|
35176
35230
|
`
|
|
35177
35231
|
}
|
|
35178
35232
|
}
|
|
35179
35233
|
},
|
|
35180
|
-
|
|
35181
|
-
label: "Disabled",
|
|
35182
|
-
description: "
|
|
35234
|
+
disabled: {
|
|
35235
|
+
label: "Disabled State",
|
|
35236
|
+
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
35237
|
examples: {
|
|
35184
|
-
|
|
35238
|
+
standard: {
|
|
35185
35239
|
react: code`
|
|
35186
35240
|
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
|
-
});
|
|
35241
|
+
const { formValue, formMeta, updateForm } = useSpsForm({ notes: "Some notes here" });
|
|
35190
35242
|
|
|
35191
|
-
return
|
|
35192
|
-
<
|
|
35193
|
-
|
|
35194
|
-
|
|
35195
|
-
|
|
35196
|
-
|
|
35197
|
-
|
|
35243
|
+
return (
|
|
35244
|
+
<div className="sfg-row">
|
|
35245
|
+
<div className="sfg-col-4">
|
|
35246
|
+
<SpsLabel for={formMeta.fields.notes}>Notes</SpsLabel>
|
|
35247
|
+
<SpsTextarea
|
|
35248
|
+
value={formValue.notes}
|
|
35249
|
+
formMeta={formMeta.fields.notes}
|
|
35250
|
+
disabled
|
|
35251
|
+
/>
|
|
35252
|
+
</div>
|
|
35253
|
+
</div>
|
|
35254
|
+
);
|
|
35198
35255
|
}
|
|
35199
35256
|
`
|
|
35200
35257
|
}
|
|
@@ -37557,11 +37614,13 @@ const MANIFEST = {
|
|
|
37557
37614
|
components: [SpsTaskQueue],
|
|
37558
37615
|
examples: SpsTaskQueueExamples
|
|
37559
37616
|
},
|
|
37560
|
-
"Text
|
|
37617
|
+
"Text Inputs": {
|
|
37618
|
+
description: () => /* @__PURE__ */ React.createElement("p", null, "Text Inputs consist of a Label and a field in which a user enters a short value."),
|
|
37561
37619
|
components: [SpsTextInput],
|
|
37562
37620
|
examples: SpsTextInputExamples
|
|
37563
37621
|
},
|
|
37564
|
-
|
|
37622
|
+
"Text Areas": {
|
|
37623
|
+
description: () => /* @__PURE__ */ React.createElement("p", null, "Text Areas consist of a Label and a field in which a user enters a long value."),
|
|
37565
37624
|
components: [SpsTextarea],
|
|
37566
37625
|
examples: SpsTextareaExamples
|
|
37567
37626
|
},
|
|
@@ -12,11 +12,12 @@ declare const propTypes: {
|
|
|
12
12
|
onChange: PropTypes.Requireable<React.ChangeEventHandler<HTMLInputElement>>;
|
|
13
13
|
placeholder: PropTypes.Requireable<string>;
|
|
14
14
|
value: PropTypes.Requireable<string>;
|
|
15
|
+
additionalText: PropTypes.Requireable<string>;
|
|
15
16
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
16
17
|
className: PropTypes.Requireable<string>;
|
|
17
18
|
"data-testid": PropTypes.Requireable<string>;
|
|
18
19
|
unsafelyReplaceClassName: PropTypes.Requireable<string>;
|
|
19
20
|
};
|
|
20
21
|
export declare type SpsTextInputProps = PropTypes.InferTS<typeof propTypes, HTMLInputElement>;
|
|
21
|
-
export declare const SpsTextInput: React.ForwardRefExoticComponent<Pick<SpsTextInputProps, "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "cite" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "data" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "label" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "nonce" | "noValidate" | "open" | "optimum" | "pattern" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "size" | "sizes" | "span" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "summary" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "icon" | "data-testid" | "unsafelyReplaceClassName" | "formMeta" | "formControl"> & React.RefAttributes<HTMLInputElement>>;
|
|
22
|
+
export declare const SpsTextInput: React.ForwardRefExoticComponent<Pick<SpsTextInputProps, "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "cite" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "data" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "label" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "nonce" | "noValidate" | "open" | "optimum" | "pattern" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "size" | "sizes" | "span" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "summary" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "icon" | "data-testid" | "unsafelyReplaceClassName" | "formMeta" | "formControl" | "additionalText"> & React.RefAttributes<HTMLInputElement>>;
|
|
22
23
|
export {};
|
|
@@ -12,11 +12,12 @@ declare const propTypes: {
|
|
|
12
12
|
ref: PropTypes.Requireable<React.MutableRefObject<HTMLDivElement>>;
|
|
13
13
|
rows: PropTypes.Requireable<number>;
|
|
14
14
|
value: PropTypes.Requireable<string>;
|
|
15
|
+
additionalText: PropTypes.Requireable<string>;
|
|
15
16
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
16
17
|
className: PropTypes.Requireable<string>;
|
|
17
18
|
"data-testid": PropTypes.Requireable<string>;
|
|
18
19
|
unsafelyReplaceClassName: PropTypes.Requireable<string>;
|
|
19
20
|
};
|
|
20
21
|
export declare type SpsTextareaProps = PropTypes.InferTS<typeof propTypes, HTMLTextAreaElement>;
|
|
21
|
-
export declare function SpsTextarea({ className, disabled, formControl, formMeta, id, name, onChange, placeholder, ref, rows, "data-testid": testId, unsafelyReplaceClassName, value, ...rest }: SpsTextareaProps): JSX.Element;
|
|
22
|
+
export declare function SpsTextarea({ className, disabled, formControl, formMeta, id, name, onChange, placeholder, ref, rows, "data-testid": testId, unsafelyReplaceClassName, value, additionalText, ...rest }: SpsTextareaProps): JSX.Element;
|
|
22
23
|
export {};
|
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": "5.
|
|
4
|
+
"version": "5.22.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": "5.
|
|
32
|
-
"@spscommerce/ds-illustrations": "5.
|
|
33
|
-
"@spscommerce/ds-shared": "5.
|
|
34
|
-
"@spscommerce/positioning": "5.
|
|
35
|
-
"@spscommerce/utils": "5.
|
|
31
|
+
"@spscommerce/ds-colors": "5.22.0",
|
|
32
|
+
"@spscommerce/ds-illustrations": "5.22.0",
|
|
33
|
+
"@spscommerce/ds-shared": "5.22.0",
|
|
34
|
+
"@spscommerce/positioning": "5.22.0",
|
|
35
|
+
"@spscommerce/utils": "5.22.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": "5.
|
|
44
|
-
"@spscommerce/ds-illustrations": "5.
|
|
45
|
-
"@spscommerce/ds-shared": "5.
|
|
46
|
-
"@spscommerce/positioning": "5.
|
|
47
|
-
"@spscommerce/utils": "5.
|
|
43
|
+
"@spscommerce/ds-colors": "5.22.0",
|
|
44
|
+
"@spscommerce/ds-illustrations": "5.22.0",
|
|
45
|
+
"@spscommerce/ds-shared": "5.22.0",
|
|
46
|
+
"@spscommerce/positioning": "5.22.0",
|
|
47
|
+
"@spscommerce/utils": "5.22.0",
|
|
48
48
|
"@testing-library/react": "^9.3.2",
|
|
49
49
|
"@types/prop-types": "^15.7.1",
|
|
50
50
|
"@types/react": "^16.9.0",
|