@spscommerce/ds-react 5.4.1 → 5.6.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 +73 -73
- package/lib/index.es.js +47 -19
- package/lib/label/SpsLabel.d.ts +1 -1
- package/lib/multi-select/SpsMultiSelect.d.ts +1 -1
- package/lib/test-util.d.ts +1 -0
- package/package.json +9 -10
- package/lib/setup-jest.d.ts +0 -1
package/lib/index.es.js
CHANGED
|
@@ -1317,7 +1317,8 @@ const SpsOptionList = React.forwardRef((props2, ref2) => {
|
|
|
1317
1317
|
specialAction,
|
|
1318
1318
|
unsafelyReplaceClassName,
|
|
1319
1319
|
loading,
|
|
1320
|
-
filterByTextAndCaptionKey
|
|
1320
|
+
filterByTextAndCaptionKey,
|
|
1321
|
+
"data-testid": testId
|
|
1321
1322
|
} = _a, rest = __objRest(_a, [
|
|
1322
1323
|
"captionKey",
|
|
1323
1324
|
"comparisonKey",
|
|
@@ -1351,7 +1352,8 @@ const SpsOptionList = React.forwardRef((props2, ref2) => {
|
|
|
1351
1352
|
"specialAction",
|
|
1352
1353
|
"unsafelyReplaceClassName",
|
|
1353
1354
|
"loading",
|
|
1354
|
-
"filterByTextAndCaptionKey"
|
|
1355
|
+
"filterByTextAndCaptionKey",
|
|
1356
|
+
"data-testid"
|
|
1355
1357
|
]);
|
|
1356
1358
|
const specialActionOption = React.useMemo(() => specialAction ? new SpsOptionListOption(specialAction, {
|
|
1357
1359
|
textKey: "label",
|
|
@@ -1573,10 +1575,12 @@ const SpsOptionList = React.forwardRef((props2, ref2) => {
|
|
|
1573
1575
|
tabIndex: -1,
|
|
1574
1576
|
ref: rootRef,
|
|
1575
1577
|
style: posStyle,
|
|
1576
|
-
onMouseLeave: () => setHighlightedOptionIndex(-1)
|
|
1578
|
+
onMouseLeave: () => setHighlightedOptionIndex(-1),
|
|
1579
|
+
"data-testid": testId
|
|
1577
1580
|
}, rest), searchElement, /* @__PURE__ */ React.createElement("div", {
|
|
1578
1581
|
className: optionsClasses,
|
|
1579
|
-
ref: optionsRef
|
|
1582
|
+
ref: optionsRef,
|
|
1583
|
+
"data-testid": `${testId}-options`
|
|
1580
1584
|
}, !loading && !searchState.pending && zeroState && (searchState.value || !searchState.isAsync) && optionList.length === 0 && /* @__PURE__ */ React.createElement("div", {
|
|
1581
1585
|
className: "sps-option-list__zero-state"
|
|
1582
1586
|
}, zeroState), (loading || searchState.pending) && /* @__PURE__ */ React.createElement("div", {
|
|
@@ -1593,7 +1597,8 @@ const SpsOptionList = React.forwardRef((props2, ref2) => {
|
|
|
1593
1597
|
onClick: (event) => handleOptionClick(event, option),
|
|
1594
1598
|
onMouseOver: () => setHighlightedOptionIndex(i2),
|
|
1595
1599
|
tabIndex: -1,
|
|
1596
|
-
ref: highlightedOptionIndex === i2 ? highlightedOptionRef : null
|
|
1600
|
+
ref: highlightedOptionIndex === i2 ? highlightedOptionRef : null,
|
|
1601
|
+
"data-testid": `${testId}-option-${i2}`
|
|
1597
1602
|
}, option.value && option.value.icon && /* @__PURE__ */ React.createElement("i", {
|
|
1598
1603
|
className: clsx("sps-icon", "sps-option-list__option-icon", `sps-icon-${String(option.value.icon)}`)
|
|
1599
1604
|
}), (!option.value || !option.value.icon && anyOptionHasIcon) && /* @__PURE__ */ React.createElement("span", {
|
|
@@ -5468,6 +5473,7 @@ function SpsCheckbox(_m) {
|
|
|
5468
5473
|
id: controlId,
|
|
5469
5474
|
checked,
|
|
5470
5475
|
disabled,
|
|
5476
|
+
"data-testId": `${testId}__checkbox-input`,
|
|
5471
5477
|
onChange: handleChange
|
|
5472
5478
|
}, rest)), /* @__PURE__ */ React.createElement("label", {
|
|
5473
5479
|
className: "sps-checkable__label",
|
|
@@ -25173,7 +25179,8 @@ function SpsLabel(_o) {
|
|
|
25173
25179
|
helpIcon = SpsIcon.QUESTION_CIRCLE,
|
|
25174
25180
|
helpIconColor = "blue200",
|
|
25175
25181
|
errors,
|
|
25176
|
-
unsafelyReplaceClassName
|
|
25182
|
+
unsafelyReplaceClassName,
|
|
25183
|
+
"data-testid": testId
|
|
25177
25184
|
} = _p, rest = __objRest(_p, [
|
|
25178
25185
|
"children",
|
|
25179
25186
|
"className",
|
|
@@ -25184,7 +25191,8 @@ function SpsLabel(_o) {
|
|
|
25184
25191
|
"helpIcon",
|
|
25185
25192
|
"helpIconColor",
|
|
25186
25193
|
"errors",
|
|
25187
|
-
"unsafelyReplaceClassName"
|
|
25194
|
+
"unsafelyReplaceClassName",
|
|
25195
|
+
"data-testid"
|
|
25188
25196
|
]);
|
|
25189
25197
|
const { t: t2 } = React.useContext(I18nContext);
|
|
25190
25198
|
const errorIcon = React.useRef();
|
|
@@ -25268,9 +25276,11 @@ function SpsLabel(_o) {
|
|
|
25268
25276
|
formControl: formControl2
|
|
25269
25277
|
}, /* @__PURE__ */ React.createElement("label", __spreadValues({
|
|
25270
25278
|
htmlFor: forProp && "id" in forProp ? forProp.id : void 0,
|
|
25271
|
-
className: classes
|
|
25279
|
+
className: classes,
|
|
25280
|
+
"data-testid": testId
|
|
25272
25281
|
}, rest), /* @__PURE__ */ React.createElement("i", {
|
|
25273
25282
|
ref: suggestedIcon,
|
|
25283
|
+
"data-testid": `${testId}__suggested-icon`,
|
|
25274
25284
|
className: clsx("sps-icon", "sps-icon-exclamation-triangle", "orange200", "sps-form-group__label-suggested-icon", !stronglySuggested && "d-none"),
|
|
25275
25285
|
onClick: handleSuggestedIconClick,
|
|
25276
25286
|
onMouseEnter: () => {
|
|
@@ -25280,6 +25290,7 @@ function SpsLabel(_o) {
|
|
|
25280
25290
|
onMouseLeave: delayedHideTooltips
|
|
25281
25291
|
}), /* @__PURE__ */ React.createElement("i", {
|
|
25282
25292
|
ref: errorIcon,
|
|
25293
|
+
"data-testid": `${testId}__error-icon`,
|
|
25283
25294
|
className: clsx("sps-icon", "sps-icon-exclamation-circle", "sps-form-group__label--error-icon"),
|
|
25284
25295
|
onClick: handleLabelClick,
|
|
25285
25296
|
onMouseEnter: doShowPriorityTooltip,
|
|
@@ -25288,6 +25299,7 @@ function SpsLabel(_o) {
|
|
|
25288
25299
|
className: "sps-form-group__label-content"
|
|
25289
25300
|
}, children), /* @__PURE__ */ React.createElement("i", {
|
|
25290
25301
|
ref: helpIconRef,
|
|
25302
|
+
"data-testid": `${testId}__help-icon`,
|
|
25291
25303
|
className: clsx("sps-icon", `sps-icon-${helpIcon}`, helpIconColor, !help && "d-none"),
|
|
25292
25304
|
onClick: handleHelpClick,
|
|
25293
25305
|
onMouseEnter: () => {
|
|
@@ -25316,7 +25328,8 @@ function SpsLabel(_o) {
|
|
|
25316
25328
|
showOn: TooltipShowTrigger.MANUAL,
|
|
25317
25329
|
isShown: showSuggestedTip
|
|
25318
25330
|
}, t2("design-system:label.stronglySuggested")), description && /* @__PURE__ */ React.createElement("div", {
|
|
25319
|
-
className: "sps-form-control__description"
|
|
25331
|
+
className: "sps-form-control__description",
|
|
25332
|
+
"data-testid": `${testId}__description`
|
|
25320
25333
|
}, description));
|
|
25321
25334
|
}
|
|
25322
25335
|
Object.assign(SpsLabel, {
|
|
@@ -28940,7 +28953,8 @@ function SpsMultiSelect(_w) {
|
|
|
28940
28953
|
value,
|
|
28941
28954
|
zeroState = "There are no matching options.",
|
|
28942
28955
|
loading,
|
|
28943
|
-
icon
|
|
28956
|
+
icon,
|
|
28957
|
+
"data-testid": testId
|
|
28944
28958
|
} = _x, rest = __objRest(_x, [
|
|
28945
28959
|
"action",
|
|
28946
28960
|
"captionKey",
|
|
@@ -28962,7 +28976,8 @@ function SpsMultiSelect(_w) {
|
|
|
28962
28976
|
"value",
|
|
28963
28977
|
"zeroState",
|
|
28964
28978
|
"loading",
|
|
28965
|
-
"icon"
|
|
28979
|
+
"icon",
|
|
28980
|
+
"data-testid"
|
|
28966
28981
|
]);
|
|
28967
28982
|
const meta = formMeta || formControl2;
|
|
28968
28983
|
const { wrapperId, controlId } = useFormControlId(id2, meta);
|
|
@@ -29121,6 +29136,7 @@ function SpsMultiSelect(_w) {
|
|
|
29121
29136
|
}, textKey ? opt[textKey] : opt)), /* @__PURE__ */ React.createElement("input", __spreadValues({
|
|
29122
29137
|
type: "text",
|
|
29123
29138
|
ref: textInput,
|
|
29139
|
+
"data-testid": `${testId}__option-list-input`,
|
|
29124
29140
|
value: state.searchText,
|
|
29125
29141
|
className: "sps-text-input__input",
|
|
29126
29142
|
placeholder: value.length === 0 ? placeholder : void 0,
|
|
@@ -29139,6 +29155,7 @@ function SpsMultiSelect(_w) {
|
|
|
29139
29155
|
}) : null)), /* @__PURE__ */ React.createElement(SpsOptionList, {
|
|
29140
29156
|
id: `${wrapperId}_options`,
|
|
29141
29157
|
ref: optionListRef,
|
|
29158
|
+
"data-testid": `${testId}__option-list`,
|
|
29142
29159
|
attachTo: inputVisual,
|
|
29143
29160
|
captionKey,
|
|
29144
29161
|
disabledOptions: disableSelected ? value : null,
|
|
@@ -29520,7 +29537,8 @@ const SpsSelect = React.forwardRef((props2, ref2) => {
|
|
|
29520
29537
|
value: valueProp,
|
|
29521
29538
|
zeroState,
|
|
29522
29539
|
loading,
|
|
29523
|
-
filterByTextAndCaptionKey
|
|
29540
|
+
filterByTextAndCaptionKey,
|
|
29541
|
+
"data-testid": testId
|
|
29524
29542
|
} = _a, rest = __objRest(_a, [
|
|
29525
29543
|
"action",
|
|
29526
29544
|
"autoFixWidth",
|
|
@@ -29544,7 +29562,8 @@ const SpsSelect = React.forwardRef((props2, ref2) => {
|
|
|
29544
29562
|
"value",
|
|
29545
29563
|
"zeroState",
|
|
29546
29564
|
"loading",
|
|
29547
|
-
"filterByTextAndCaptionKey"
|
|
29565
|
+
"filterByTextAndCaptionKey",
|
|
29566
|
+
"data-testid"
|
|
29548
29567
|
]);
|
|
29549
29568
|
const meta = formMeta || formControl2;
|
|
29550
29569
|
const { wrapperId, controlId } = useFormControlId(id2, meta);
|
|
@@ -29666,21 +29685,25 @@ const SpsSelect = React.forwardRef((props2, ref2) => {
|
|
|
29666
29685
|
formMeta,
|
|
29667
29686
|
ref: rootElement,
|
|
29668
29687
|
role: "listbox",
|
|
29669
|
-
"aria-owns": state.optionIds
|
|
29688
|
+
"aria-owns": state.optionIds,
|
|
29689
|
+
"data-testid": testId
|
|
29670
29690
|
}, rest), /* @__PURE__ */ React.createElement("div", {
|
|
29671
29691
|
className: clsx("sps-select__dropctrl", disabled && "disabled"),
|
|
29672
29692
|
id: controlId,
|
|
29673
29693
|
tabIndex: 0,
|
|
29674
29694
|
onClick: handleControlButtonClick,
|
|
29675
29695
|
ref: controlButton,
|
|
29676
|
-
title: valueText
|
|
29696
|
+
title: valueText,
|
|
29697
|
+
"data-testid": `${testId}-dropctrl`
|
|
29677
29698
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
29678
29699
|
className: "sps-select__dropctrl-content"
|
|
29679
29700
|
}, /* @__PURE__ */ React.createElement("span", {
|
|
29680
|
-
className: clsx("sps-select__value", !state.text && "sps-select__value--placeholder")
|
|
29701
|
+
className: clsx("sps-select__value", !state.text && "sps-select__value--placeholder"),
|
|
29702
|
+
"data-testid": `${testId}-value`
|
|
29681
29703
|
}, valueText), state.value && !notClearable && !disabled && /* @__PURE__ */ React.createElement("i", {
|
|
29682
29704
|
className: "sps-icon sps-icon-x-circle sps-select__clear-btn",
|
|
29683
|
-
onClick: handleClearIconClick
|
|
29705
|
+
onClick: handleClearIconClick,
|
|
29706
|
+
"data-testid": `${testId}-clear-value`
|
|
29684
29707
|
}), /* @__PURE__ */ React.createElement("i", {
|
|
29685
29708
|
className: "sps-icon sps-icon-chevron-down"
|
|
29686
29709
|
}))), /* @__PURE__ */ React.createElement(SpsOptionList, {
|
|
@@ -29708,7 +29731,8 @@ const SpsSelect = React.forwardRef((props2, ref2) => {
|
|
|
29708
29731
|
onOptionListChanged: handleOptionListChanged,
|
|
29709
29732
|
zeroState,
|
|
29710
29733
|
ignoreWidthStyles: autoFixWidth,
|
|
29711
|
-
loading
|
|
29734
|
+
loading,
|
|
29735
|
+
"data-testid": `${testId}-option-list`
|
|
29712
29736
|
}));
|
|
29713
29737
|
});
|
|
29714
29738
|
Object.assign(SpsSelect, {
|
|
@@ -31291,6 +31315,7 @@ function SpsRadioButton(_y) {
|
|
|
31291
31315
|
type: "radio",
|
|
31292
31316
|
ref: inputElement,
|
|
31293
31317
|
className: "sps-checkable__input",
|
|
31318
|
+
"data-testid": `${testId}__radio-input`,
|
|
31294
31319
|
id: controlId,
|
|
31295
31320
|
name,
|
|
31296
31321
|
checked,
|
|
@@ -33803,6 +33828,7 @@ const SpsTextInput = React.forwardRef((_G, ref2) => {
|
|
|
33803
33828
|
value,
|
|
33804
33829
|
disabled
|
|
33805
33830
|
}, rest)), value && !disabled && /* @__PURE__ */ React.createElement("i", {
|
|
33831
|
+
"data-testid": `${testId}__input_clear`,
|
|
33806
33832
|
className: "sps-icon sps-icon-x-circle sps-form-control__clear-btn",
|
|
33807
33833
|
onClick: clear
|
|
33808
33834
|
})));
|
|
@@ -33997,6 +34023,7 @@ function SpsTextarea(_I) {
|
|
|
33997
34023
|
value: value || "",
|
|
33998
34024
|
disabled
|
|
33999
34025
|
}, rest)), value && !disabled && /* @__PURE__ */ React.createElement("i", {
|
|
34026
|
+
"data-testid": `${testId}__input_clear`,
|
|
34000
34027
|
className: "sps-icon sps-icon-x-circle sps-form-control__clear-btn",
|
|
34001
34028
|
onClick: clear
|
|
34002
34029
|
})));
|
|
@@ -34671,7 +34698,8 @@ function SpsToggle(props2) {
|
|
|
34671
34698
|
checked: active || false,
|
|
34672
34699
|
disabled,
|
|
34673
34700
|
onChange: handleChange,
|
|
34674
|
-
"aria-describedby": `${statusLabelID},${descriptionID}
|
|
34701
|
+
"aria-describedby": `${statusLabelID},${descriptionID}`,
|
|
34702
|
+
"data-testid": `${testId}__input`
|
|
34675
34703
|
}, rest)), /* @__PURE__ */ React.createElement("span", {
|
|
34676
34704
|
className: "sps-toggle__slider"
|
|
34677
34705
|
}), label && /* @__PURE__ */ React.createElement("label", {
|
package/lib/label/SpsLabel.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ declare const propTypes: {
|
|
|
16
16
|
unsafelyReplaceClassName: PropTypes.Requireable<string>;
|
|
17
17
|
};
|
|
18
18
|
export declare type SpsLabelProps = PropTypes.InferTS<typeof propTypes, HTMLLabelElement>;
|
|
19
|
-
export declare function SpsLabel({ children, className, description, for: forProp, stronglySuggested, help, helpIcon, helpIconColor, errors, unsafelyReplaceClassName, ...rest }: SpsLabelProps): JSX.Element;
|
|
19
|
+
export declare function SpsLabel({ children, className, description, for: forProp, stronglySuggested, help, helpIcon, helpIconColor, errors, unsafelyReplaceClassName, "data-testid": testId, ...rest }: SpsLabelProps): JSX.Element;
|
|
20
20
|
export {};
|
|
@@ -30,5 +30,5 @@ declare const propTypes: {
|
|
|
30
30
|
unsafelyReplaceClassName: PropTypes.Requireable<string>;
|
|
31
31
|
};
|
|
32
32
|
export declare type SpsMultiSelectProps = PropTypes.InferTS<typeof propTypes, HTMLInputElement>;
|
|
33
|
-
export declare function SpsMultiSelect({ action, captionKey, className, debounce, disabled, disableSelected, comparisonKey, formControl, formMeta, hideSelected, id, onChange, options, placeholder, tallOptionList, textKey, unsafelyReplaceClassName, value, zeroState, loading, icon, ...rest }: SpsMultiSelectProps): JSX.Element;
|
|
33
|
+
export declare function SpsMultiSelect({ action, captionKey, className, debounce, disabled, disableSelected, comparisonKey, formControl, formMeta, hideSelected, id, onChange, options, placeholder, tallOptionList, textKey, unsafelyReplaceClassName, value, zeroState, loading, icon, "data-testid": testId, ...rest }: SpsMultiSelectProps): JSX.Element;
|
|
34
34
|
export {};
|
package/lib/test-util.d.ts
CHANGED
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.6.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,10 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@react-stately/collections": "^3.3.3",
|
|
31
|
-
"@spscommerce/ds-colors": "5.
|
|
32
|
-
"@spscommerce/ds-shared": "5.
|
|
33
|
-
"@spscommerce/positioning": "5.
|
|
34
|
-
"@spscommerce/utils": "5.
|
|
31
|
+
"@spscommerce/ds-colors": "5.6.0",
|
|
32
|
+
"@spscommerce/ds-shared": "5.6.0",
|
|
33
|
+
"@spscommerce/positioning": "5.6.0",
|
|
34
|
+
"@spscommerce/utils": "5.6.0",
|
|
35
35
|
"moment": "^2.25.3",
|
|
36
36
|
"moment-timezone": "^0.5.28",
|
|
37
37
|
"react": "^16.9.0",
|
|
@@ -39,11 +39,10 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@react-stately/collections": "^3.3.3",
|
|
42
|
-
"@spscommerce/ds-colors": "5.
|
|
43
|
-
"@spscommerce/ds-shared": "5.
|
|
44
|
-
"@spscommerce/positioning": "5.
|
|
45
|
-
"@spscommerce/utils": "5.
|
|
46
|
-
"@testing-library/jest-dom": "^4.2.4",
|
|
42
|
+
"@spscommerce/ds-colors": "5.6.0",
|
|
43
|
+
"@spscommerce/ds-shared": "5.6.0",
|
|
44
|
+
"@spscommerce/positioning": "5.6.0",
|
|
45
|
+
"@spscommerce/utils": "5.6.0",
|
|
47
46
|
"@testing-library/react": "^9.3.2",
|
|
48
47
|
"@types/prop-types": "^15.7.1",
|
|
49
48
|
"@types/react": "^16.9.0",
|
package/lib/setup-jest.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|