@spscommerce/ds-react 6.31.3 → 6.31.4
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 +71 -74
- package/lib/index.es.js +18 -23
- package/lib/label/SpsLabel.d.ts +1 -7
- package/package.json +9 -9
package/lib/index.es.js
CHANGED
|
@@ -905,14 +905,14 @@ const required = function requiredValidator(value) {
|
|
|
905
905
|
AsTypingErrorKeys.add("required");
|
|
906
906
|
const minLength = function minLengthValidatorFactory(minimumLength) {
|
|
907
907
|
function minLengthValidator(value) {
|
|
908
|
-
return value.length
|
|
908
|
+
return value === void 0 || value.toString().length < minimumLength ? { minLength: minimumLength } : null;
|
|
909
909
|
}
|
|
910
910
|
return (values2) => validateCollectionOfValues(values2, minLengthValidator);
|
|
911
911
|
};
|
|
912
912
|
OnBlurErrorKeys.add("minLength");
|
|
913
913
|
const maxLength = function maxLengthValidatorFactory(maximumLength) {
|
|
914
914
|
function maxLengthValidator(value) {
|
|
915
|
-
return value.length <= maximumLength ? null : { maxLength: maximumLength };
|
|
915
|
+
return value === void 0 || value.toString().length <= maximumLength ? null : { maxLength: maximumLength };
|
|
916
916
|
}
|
|
917
917
|
return (values2) => validateCollectionOfValues(values2, maxLengthValidator);
|
|
918
918
|
};
|
|
@@ -15300,7 +15300,7 @@ function SpsI(props2) {
|
|
|
15300
15300
|
"size",
|
|
15301
15301
|
"unsafelyReplaceClassName"
|
|
15302
15302
|
]);
|
|
15303
|
-
const classes = clsx(unsafelyReplaceClassName || "sps-icon", `sps-icon-${icon}`, `sps-icon--${size}`, className);
|
|
15303
|
+
const classes = clsx(unsafelyReplaceClassName || "sps-icon", `sps-icon-${icon}`, `sps-icon--${size}`, props2.onClick && "interactive-icon", className);
|
|
15304
15304
|
return /* @__PURE__ */ React.createElement("i", __spreadValues({
|
|
15305
15305
|
className: classes,
|
|
15306
15306
|
"aria-hidden": "true",
|
|
@@ -25027,8 +25027,7 @@ const propsDoc$$ = {
|
|
|
25027
25027
|
help: "ReactNodeOrRenderFn",
|
|
25028
25028
|
helpIcon: "SpsIcon",
|
|
25029
25029
|
helpIconColor: "string",
|
|
25030
|
-
errors: "ReactNodeOrRenderFn"
|
|
25031
|
-
interactiveIcons: "Array<{icon: SpsIcon, iconColor: string, onClick: () => void}>"
|
|
25030
|
+
errors: "ReactNodeOrRenderFn"
|
|
25032
25031
|
};
|
|
25033
25032
|
const propTypes$10 = __spreadProps(__spreadValues({}, spsGlobalPropTypes), {
|
|
25034
25033
|
description: propTypes$1I.exports.string,
|
|
@@ -25040,8 +25039,7 @@ const propTypes$10 = __spreadProps(__spreadValues({}, spsGlobalPropTypes), {
|
|
|
25040
25039
|
help: nodeOrRenderFn,
|
|
25041
25040
|
helpIcon: enumValue(SpsIcon),
|
|
25042
25041
|
helpIconColor: propTypes$1I.exports.string,
|
|
25043
|
-
errors: nodeOrRenderFn
|
|
25044
|
-
interactiveIcons: propTypes$1I.exports.arrayOf(impl())
|
|
25042
|
+
errors: nodeOrRenderFn
|
|
25045
25043
|
});
|
|
25046
25044
|
function SpsLabel(_y) {
|
|
25047
25045
|
var _z = _y, {
|
|
@@ -25054,7 +25052,6 @@ function SpsLabel(_y) {
|
|
|
25054
25052
|
helpIcon = SpsIcon.QUESTION_CIRCLE,
|
|
25055
25053
|
helpIconColor = "blue200",
|
|
25056
25054
|
errors,
|
|
25057
|
-
interactiveIcons,
|
|
25058
25055
|
unsafelyReplaceClassName,
|
|
25059
25056
|
"data-testid": testId
|
|
25060
25057
|
} = _z, rest = __objRest(_z, [
|
|
@@ -25067,7 +25064,6 @@ function SpsLabel(_y) {
|
|
|
25067
25064
|
"helpIcon",
|
|
25068
25065
|
"helpIconColor",
|
|
25069
25066
|
"errors",
|
|
25070
|
-
"interactiveIcons",
|
|
25071
25067
|
"unsafelyReplaceClassName",
|
|
25072
25068
|
"data-testid"
|
|
25073
25069
|
]);
|
|
@@ -25165,6 +25161,9 @@ function SpsLabel(_y) {
|
|
|
25165
25161
|
}
|
|
25166
25162
|
return null;
|
|
25167
25163
|
}
|
|
25164
|
+
const [customIcons, otherChildren] = selectChildren(children, [
|
|
25165
|
+
{ type: SpsI }
|
|
25166
|
+
]);
|
|
25168
25167
|
React.useEffect(() => {
|
|
25169
25168
|
if (formMeta == null ? void 0 : formMeta.hasPreventativeErrors()) {
|
|
25170
25169
|
setShowPreventativeErrorTip(TooltipVisibility.VISIBLE);
|
|
@@ -25192,18 +25191,13 @@ function SpsLabel(_y) {
|
|
|
25192
25191
|
}), /* @__PURE__ */ React.createElement("span", {
|
|
25193
25192
|
ref: labelRef,
|
|
25194
25193
|
className: "sps-form-group__label-content"
|
|
25195
|
-
},
|
|
25194
|
+
}, otherChildren), /* @__PURE__ */ React.createElement("i", {
|
|
25196
25195
|
ref: helpIconRef,
|
|
25197
25196
|
"data-testid": `${testId}__help-icon`,
|
|
25198
25197
|
className: clsx("sps-icon", `sps-icon-${helpIcon}`, helpIconColor, !help && "d-none"),
|
|
25199
25198
|
onClick: handleHelpClick,
|
|
25200
25199
|
onMouseLeave: delayedHideTooltips
|
|
25201
|
-
}),
|
|
25202
|
-
key: idx,
|
|
25203
|
-
"data-testid": `${testId}__interactive-icon-${idx}`,
|
|
25204
|
-
className: clsx("sps-icon", `sps-icon-${icon.icon}`, icon.iconColor, "interactive-icon"),
|
|
25205
|
-
onClick: () => icon.onClick()
|
|
25206
|
-
}))), /* @__PURE__ */ React.createElement(SpsTooltip, {
|
|
25200
|
+
}), customIcons), /* @__PURE__ */ React.createElement(SpsTooltip, {
|
|
25207
25201
|
kind: TooltipKind.DEFAULT,
|
|
25208
25202
|
for: helpIconRef,
|
|
25209
25203
|
showOn: TooltipShowTrigger.MANUAL,
|
|
@@ -25348,7 +25342,7 @@ const SpsLabelExamples = {
|
|
|
25348
25342
|
},
|
|
25349
25343
|
interactiveIcons: {
|
|
25350
25344
|
label: "Interactive Icons",
|
|
25351
|
-
description: ({ NavigateTo }) => /* @__PURE__ */ React.createElement("p", null, "
|
|
25345
|
+
description: ({ NavigateTo }) => /* @__PURE__ */ React.createElement("p", null, "Interactive Icons can be used to launch a ", /* @__PURE__ */ React.createElement(NavigateTo, {
|
|
25352
25346
|
to: "modal"
|
|
25353
25347
|
}, "Modal"), " ", "window or ", /* @__PURE__ */ React.createElement(NavigateTo, {
|
|
25354
25348
|
to: "focused-task"
|
|
@@ -25365,13 +25359,10 @@ const SpsLabelExamples = {
|
|
|
25365
25359
|
const [showFocusedTask, setShowFocusedTask] = React.useState(false);
|
|
25366
25360
|
|
|
25367
25361
|
return <>
|
|
25368
|
-
<SpsLabel for={formMeta.fields.companyName}
|
|
25369
|
-
interactiveIcons={[
|
|
25370
|
-
{icon: SpsIcon.GEAR, onClick: () => setShowModal(true)},
|
|
25371
|
-
{icon: SpsIcon.WRENCH, onClick: () => setShowFocusedTask(true), iconColor: "blue200"}
|
|
25372
|
-
]}
|
|
25373
|
-
>
|
|
25362
|
+
<SpsLabel for={formMeta.fields.companyName}>
|
|
25374
25363
|
Company Name
|
|
25364
|
+
<SpsI icon={SpsIcon.GEAR} onClick={() => setShowModal(true)}/>
|
|
25365
|
+
<SpsI icon={SpsIcon.WRENCH} onClick={() => setShowFocusedTask(true)} className="blue200"/>
|
|
25375
25366
|
</SpsLabel>
|
|
25376
25367
|
<SpsTextInput formMeta={formMeta.fields.companyName}
|
|
25377
25368
|
value={formValue.companyName}
|
|
@@ -38456,6 +38447,9 @@ function SpsMultiValueTextInput(_ma) {
|
|
|
38456
38447
|
patchState({ keyDown: event });
|
|
38457
38448
|
}
|
|
38458
38449
|
}
|
|
38450
|
+
function handleBlur(event) {
|
|
38451
|
+
createNewTag(event);
|
|
38452
|
+
}
|
|
38459
38453
|
function handleClearIconClick(event) {
|
|
38460
38454
|
updateValue([]);
|
|
38461
38455
|
event.stopPropagation();
|
|
@@ -38499,6 +38493,7 @@ function SpsMultiValueTextInput(_ma) {
|
|
|
38499
38493
|
className: "sps-text-input__input",
|
|
38500
38494
|
placeholder: state.searchText.length === 0 && value.length === 0 ? placeholder : void 0,
|
|
38501
38495
|
id: controlId,
|
|
38496
|
+
onBlur: handleBlur,
|
|
38502
38497
|
onChange: handleChange,
|
|
38503
38498
|
onKeyDown: handleKeyDown,
|
|
38504
38499
|
disabled,
|
package/lib/label/SpsLabel.d.ts
CHANGED
|
@@ -2,11 +2,6 @@ import { SpsIcon } from "@spscommerce/ds-shared";
|
|
|
2
2
|
import * as PropTypes from "../prop-types";
|
|
3
3
|
import type { SpsFormControl } from "../form/hooks/formControl";
|
|
4
4
|
import { SpsFormMetaBase } from "../form/hooks/useSpsForm";
|
|
5
|
-
interface InteractiveIcon {
|
|
6
|
-
icon: SpsIcon;
|
|
7
|
-
iconColor: string;
|
|
8
|
-
onClick: () => void;
|
|
9
|
-
}
|
|
10
5
|
declare const propTypes: {
|
|
11
6
|
description: PropTypes.Requireable<string>;
|
|
12
7
|
for: PropTypes.Validator<SpsFormMetaBase<any> | SpsFormControl<any>>;
|
|
@@ -15,12 +10,11 @@ declare const propTypes: {
|
|
|
15
10
|
helpIcon: PropTypes.Requireable<SpsIcon>;
|
|
16
11
|
helpIconColor: PropTypes.Requireable<string>;
|
|
17
12
|
errors: PropTypes.Requireable<PropTypes.ReactNodeOrRenderFn>;
|
|
18
|
-
interactiveIcons: PropTypes.Requireable<InteractiveIcon[]>;
|
|
19
13
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
20
14
|
className: PropTypes.Requireable<string>;
|
|
21
15
|
"data-testid": PropTypes.Requireable<string>;
|
|
22
16
|
unsafelyReplaceClassName: PropTypes.Requireable<string>;
|
|
23
17
|
};
|
|
24
18
|
export declare type SpsLabelProps = PropTypes.InferTS<typeof propTypes, HTMLLabelElement>;
|
|
25
|
-
export declare function SpsLabel({ children, className, description, for: forProp, stronglySuggested, help, helpIcon, helpIconColor, errors,
|
|
19
|
+
export declare function SpsLabel({ children, className, description, for: forProp, stronglySuggested, help, helpIcon, helpIconColor, errors, unsafelyReplaceClassName, "data-testid": testId, ...rest }: SpsLabelProps): JSX.Element;
|
|
26
20
|
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": "6.31.
|
|
4
|
+
"version": "6.31.4",
|
|
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,10 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@react-stately/collections": "^3.3.3",
|
|
31
|
-
"@spscommerce/ds-colors": "6.31.
|
|
32
|
-
"@spscommerce/ds-illustrations": "6.31.
|
|
33
|
-
"@spscommerce/ds-shared": "6.31.
|
|
34
|
-
"@spscommerce/positioning": "6.31.
|
|
31
|
+
"@spscommerce/ds-colors": "6.31.4",
|
|
32
|
+
"@spscommerce/ds-illustrations": "6.31.4",
|
|
33
|
+
"@spscommerce/ds-shared": "6.31.4",
|
|
34
|
+
"@spscommerce/positioning": "6.31.4",
|
|
35
35
|
"@spscommerce/utils": "^6.11.3",
|
|
36
36
|
"moment": "^2.25.3",
|
|
37
37
|
"moment-timezone": "^0.5.28",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@react-stately/collections": "^3.3.3",
|
|
43
|
-
"@spscommerce/ds-colors": "6.31.
|
|
44
|
-
"@spscommerce/ds-illustrations": "6.31.
|
|
45
|
-
"@spscommerce/ds-shared": "6.31.
|
|
46
|
-
"@spscommerce/positioning": "6.31.
|
|
43
|
+
"@spscommerce/ds-colors": "6.31.4",
|
|
44
|
+
"@spscommerce/ds-illustrations": "6.31.4",
|
|
45
|
+
"@spscommerce/ds-shared": "6.31.4",
|
|
46
|
+
"@spscommerce/positioning": "6.31.4",
|
|
47
47
|
"@spscommerce/utils": "^6.11.3",
|
|
48
48
|
"@testing-library/react": "^10.4.0",
|
|
49
49
|
"@types/prop-types": "^15.7.1",
|