@spscommerce/ds-react 5.9.0 → 5.10.3
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.es.js
CHANGED
|
@@ -1639,8 +1639,7 @@ function usePortal(id2, classes = []) {
|
|
|
1639
1639
|
target.classList.add(className);
|
|
1640
1640
|
}
|
|
1641
1641
|
parent.appendChild(target);
|
|
1642
|
-
} else if (target
|
|
1643
|
-
parent.removeChild(target);
|
|
1642
|
+
} else if (!parent.contains(target)) {
|
|
1644
1643
|
parent.appendChild(target);
|
|
1645
1644
|
}
|
|
1646
1645
|
return createPortal(jsx, target);
|
|
@@ -21878,6 +21877,7 @@ function SpsTooltip({
|
|
|
21878
21877
|
const [shown, setShown] = React.useState(false);
|
|
21879
21878
|
const rootElement = React.useRef(null);
|
|
21880
21879
|
const forElementRef = typeof forProp === "string" ? React.useRef(document.getElementById(forProp)) : forProp;
|
|
21880
|
+
const caretRef = React.useRef(null);
|
|
21881
21881
|
const clearHideDelay = React.useCallback(() => {
|
|
21882
21882
|
if (iref.current.hideTimer) {
|
|
21883
21883
|
window.clearTimeout(iref.current.hideTimer);
|
|
@@ -21927,6 +21927,35 @@ function SpsTooltip({
|
|
|
21927
21927
|
clearHideDelay();
|
|
21928
21928
|
iref.current.hideTimer = window.setTimeout(hide2, hideDelay);
|
|
21929
21929
|
}, []);
|
|
21930
|
+
const getSecondaryOffset = React.useCallback((pos) => {
|
|
21931
|
+
var _a, _b, _c, _d, _e, _f;
|
|
21932
|
+
const [primaryPosition, secondaryPosition] = pos.split(" ");
|
|
21933
|
+
const forElementBounds = (_a = forElementRef == null ? void 0 : forElementRef.current) == null ? void 0 : _a.getBoundingClientRect();
|
|
21934
|
+
const caretWidth = caretRef.current ? parseInt(((_b = getComputedStyle(caretRef.current)) == null ? void 0 : _b.width) || "0", 10) : 0;
|
|
21935
|
+
const caretDiagonal = caretWidth * Math.sqrt(2);
|
|
21936
|
+
const caretTransformationMargin = (caretDiagonal - caretWidth) / 2;
|
|
21937
|
+
if (["top", "bottom"].includes(primaryPosition) && secondaryPosition !== "middle") {
|
|
21938
|
+
if (!(forElementBounds == null ? void 0 : forElementBounds.width) || forElementBounds.width > 50) {
|
|
21939
|
+
return 0;
|
|
21940
|
+
}
|
|
21941
|
+
const caretLeft = caretRef.current ? parseInt(((_c = getComputedStyle(caretRef.current)) == null ? void 0 : _c.left) || "0", 10) : 0;
|
|
21942
|
+
const caretRight = caretRef.current ? parseInt(((_d = getComputedStyle(caretRef.current)) == null ? void 0 : _d.right) || "0", 10) : 0;
|
|
21943
|
+
const caretOffsetStart = caretLeft < caretRight ? caretLeft : caretRight;
|
|
21944
|
+
const caretOffsetToMiddle = caretOffsetStart - caretTransformationMargin + caretDiagonal / 2;
|
|
21945
|
+
return forElementBounds.width / 2 - caretOffsetToMiddle;
|
|
21946
|
+
} else if (["left", "right"].includes(primaryPosition) && secondaryPosition !== "middle") {
|
|
21947
|
+
if ((forElementBounds == null ? void 0 : forElementBounds.height) && forElementBounds.height > 50) {
|
|
21948
|
+
return 0;
|
|
21949
|
+
}
|
|
21950
|
+
const caretTop = caretRef.current ? parseInt(((_e = getComputedStyle(caretRef.current)) == null ? void 0 : _e.top) || "0", 10) : 0;
|
|
21951
|
+
const caretBottom = caretRef.current ? parseInt(((_f = getComputedStyle(caretRef.current)) == null ? void 0 : _f.bottom) || "0", 10) : 0;
|
|
21952
|
+
const caretOffsetStart = caretTop < caretBottom ? caretTop : caretBottom;
|
|
21953
|
+
const caretOffsetToMiddle = caretOffsetStart - caretTransformationMargin + caretDiagonal / 2;
|
|
21954
|
+
return forElementBounds.height / 2 - caretOffsetToMiddle;
|
|
21955
|
+
} else {
|
|
21956
|
+
return 0;
|
|
21957
|
+
}
|
|
21958
|
+
}, []);
|
|
21930
21959
|
React.useEffect(() => {
|
|
21931
21960
|
if (typeof forProp === "string") {
|
|
21932
21961
|
forElementRef.current = document.getElementById(forProp);
|
|
@@ -21997,7 +22026,7 @@ function SpsTooltip({
|
|
|
21997
22026
|
const [posStyle, altPositionUsed] = shown ? getPosition(rootElement, forElementRef, position3, __spreadValues({
|
|
21998
22027
|
altPosition,
|
|
21999
22028
|
setMinWidth: false,
|
|
22000
|
-
offsets: [offsets[0] - CARET_SPACING_PX, offsets[1]]
|
|
22029
|
+
offsets: [offsets[0] - CARET_SPACING_PX, offsets[1] + getSecondaryOffset(position3)]
|
|
22001
22030
|
}, portalContext)) : [{}, false];
|
|
22002
22031
|
const classes = clsx(unsafelyReplaceClassName || "sps-tooltip", "z-stratum-tip", `sps-tooltip--${kind}`, `sps-tooltip--pos-${(altPositionUsed ? altPosition : position3).replace(" ", "-")}`, shown && "sps-tooltip--shown", className);
|
|
22003
22032
|
return portal(/* @__PURE__ */ React.createElement("div", {
|
|
@@ -22013,6 +22042,7 @@ function SpsTooltip({
|
|
|
22013
22042
|
}, title) : title), /* @__PURE__ */ React.createElement("span", {
|
|
22014
22043
|
className: "sps-tooltip__body d-block"
|
|
22015
22044
|
}, children), /* @__PURE__ */ React.createElement("span", {
|
|
22045
|
+
ref: caretRef,
|
|
22016
22046
|
className: "sps-tooltip__caret"
|
|
22017
22047
|
})));
|
|
22018
22048
|
}
|
|
@@ -22798,7 +22828,8 @@ function SpsFieldset({
|
|
|
22798
22828
|
optional = false,
|
|
22799
22829
|
enabled,
|
|
22800
22830
|
onToggled,
|
|
22801
|
-
tooltip
|
|
22831
|
+
tooltip,
|
|
22832
|
+
"data-testid": testId
|
|
22802
22833
|
}) {
|
|
22803
22834
|
const formControlSet = formGroup2 || formArray2;
|
|
22804
22835
|
const legendElement = React.useRef(null);
|
|
@@ -22832,7 +22863,8 @@ function SpsFieldset({
|
|
|
22832
22863
|
return /* @__PURE__ */ React.createElement("div", {
|
|
22833
22864
|
className: "sps-fieldset-container"
|
|
22834
22865
|
}, /* @__PURE__ */ React.createElement("fieldset", {
|
|
22835
|
-
className: fieldsetClasses
|
|
22866
|
+
className: fieldsetClasses,
|
|
22867
|
+
"data-testid": testId
|
|
22836
22868
|
}, /* @__PURE__ */ React.createElement("legend", {
|
|
22837
22869
|
className: "sps-fieldset__legend",
|
|
22838
22870
|
ref: legendElement,
|
|
@@ -22844,12 +22876,14 @@ function SpsFieldset({
|
|
|
22844
22876
|
className: "d-inline-flex",
|
|
22845
22877
|
onChange: () => {
|
|
22846
22878
|
setisChecked(!isChecked);
|
|
22847
|
-
}
|
|
22879
|
+
},
|
|
22880
|
+
"data-testid": `${testId}__checkbox`
|
|
22848
22881
|
}), legend, tooltip && /* @__PURE__ */ React.createElement("span", {
|
|
22849
22882
|
className: "sps-fieldset__legend-icon",
|
|
22850
22883
|
ref: infoCircleElement
|
|
22851
22884
|
}, /* @__PURE__ */ React.createElement(SpsI, {
|
|
22852
|
-
icon: SpsIcon.INFO_CIRCLE
|
|
22885
|
+
icon: SpsIcon.INFO_CIRCLE,
|
|
22886
|
+
"data-testid": `${testId}__info-icon`
|
|
22853
22887
|
}))), tooltip && /* @__PURE__ */ React.createElement(SpsTooltip, {
|
|
22854
22888
|
for: infoCircleElement
|
|
22855
22889
|
}, tooltip), /* @__PURE__ */ React.createElement(SpsTooltip, {
|
|
@@ -32065,7 +32099,7 @@ const SpsSideNavBranch = ({
|
|
|
32065
32099
|
onClick: () => {
|
|
32066
32100
|
setIsBranchExpanded(!isBranchExpanded);
|
|
32067
32101
|
if (!branch.subNavItems) {
|
|
32068
|
-
setActiveBranch(branch.name);
|
|
32102
|
+
setActiveBranch(branch.name, branch.key);
|
|
32069
32103
|
}
|
|
32070
32104
|
},
|
|
32071
32105
|
onKeyDown: (event) => {
|
|
@@ -32074,12 +32108,13 @@ const SpsSideNavBranch = ({
|
|
|
32074
32108
|
event.preventDefault();
|
|
32075
32109
|
setIsBranchExpanded(!isBranchExpanded);
|
|
32076
32110
|
if (!branch.subNavItems) {
|
|
32077
|
-
setActiveBranch(branch.name);
|
|
32111
|
+
setActiveBranch(branch.name, branch.key);
|
|
32078
32112
|
}
|
|
32079
32113
|
}
|
|
32080
32114
|
},
|
|
32081
32115
|
role: "tab",
|
|
32082
|
-
tabIndex: 0
|
|
32116
|
+
tabIndex: 0,
|
|
32117
|
+
"aria-selected": branch.name === activeBranch
|
|
32083
32118
|
}, branch.subNavItems && /* @__PURE__ */ React.createElement("i", {
|
|
32084
32119
|
className: clsx("sps-icon sps-side-nav__toggle", isBranchExpanded ? "sps-icon-chevron-down" : "sps-icon-chevron-right")
|
|
32085
32120
|
}), /* @__PURE__ */ React.createElement("span", {
|
|
@@ -32091,14 +32126,17 @@ const SpsSideNavBranch = ({
|
|
|
32091
32126
|
style: { marginTop: "-2px" }
|
|
32092
32127
|
}, branch.tag && /* @__PURE__ */ React.createElement("span", {
|
|
32093
32128
|
className: `sps-tag sps-tag--${branch.tag}`
|
|
32094
|
-
}, branch.tagContent))), branch.subNavItems && isBranchExpanded && branch.subNavItems.map((subNav) =>
|
|
32095
|
-
|
|
32096
|
-
|
|
32097
|
-
|
|
32098
|
-
|
|
32099
|
-
|
|
32100
|
-
|
|
32101
|
-
|
|
32129
|
+
}, branch.tagContent))), branch.subNavItems && isBranchExpanded && branch.subNavItems.map((subNav) => {
|
|
32130
|
+
var _a;
|
|
32131
|
+
return /* @__PURE__ */ React.createElement(SpsSideNavBranch, {
|
|
32132
|
+
branch: __spreadProps(__spreadValues({}, subNav), {
|
|
32133
|
+
expanded: findParentBranches(subNav.subNavItems, activeBranch)
|
|
32134
|
+
}),
|
|
32135
|
+
setActiveBranch,
|
|
32136
|
+
activeBranch,
|
|
32137
|
+
key: (_a = subNav.key) != null ? _a : subNav.name
|
|
32138
|
+
});
|
|
32139
|
+
})));
|
|
32102
32140
|
};
|
|
32103
32141
|
const findParentBranches = (nav, activeTab) => {
|
|
32104
32142
|
if (nav) {
|
|
@@ -32122,10 +32160,10 @@ const SpsSideNav = ({
|
|
|
32122
32160
|
const [activeBranch, setActiveBranch] = useState(activeNavItem);
|
|
32123
32161
|
const [activeTab, setActiveTab] = useState(initialActiveTab || tabs && tabs[0]);
|
|
32124
32162
|
const [filterValue, setFilterValue] = useState("");
|
|
32125
|
-
const handleNavAction = (branch) => {
|
|
32163
|
+
const handleNavAction = (branch, key) => {
|
|
32126
32164
|
setActiveBranch(branch);
|
|
32127
32165
|
if (onNavChange) {
|
|
32128
|
-
onNavChange(branch);
|
|
32166
|
+
onNavChange(branch, key);
|
|
32129
32167
|
}
|
|
32130
32168
|
};
|
|
32131
32169
|
const handleTabAction = (tab2) => {
|
|
@@ -32140,8 +32178,7 @@ const SpsSideNav = ({
|
|
|
32140
32178
|
}
|
|
32141
32179
|
return false;
|
|
32142
32180
|
};
|
|
32143
|
-
const filteredNavOptions = navOptions.map((option) => ({
|
|
32144
|
-
sectionTitle: option.sectionTitle,
|
|
32181
|
+
const filteredNavOptions = navOptions.map((option) => __spreadProps(__spreadValues({}, option), {
|
|
32145
32182
|
navItems: option.navItems.filter((navItem) => navItem.name.toLowerCase().includes(filterValue) || filterChildBranches(navItem.subNavItems))
|
|
32146
32183
|
}));
|
|
32147
32184
|
if (activeNavItem !== previousActiveNavItem.current) {
|
|
@@ -32190,22 +32227,28 @@ const SpsSideNav = ({
|
|
|
32190
32227
|
onChange: (event) => {
|
|
32191
32228
|
setFilterValue(event.target.value);
|
|
32192
32229
|
}
|
|
32193
|
-
})))), filteredNavOptions.map((section) =>
|
|
32194
|
-
|
|
32195
|
-
|
|
32196
|
-
|
|
32197
|
-
|
|
32198
|
-
|
|
32199
|
-
|
|
32200
|
-
|
|
32201
|
-
|
|
32202
|
-
|
|
32203
|
-
|
|
32204
|
-
|
|
32205
|
-
|
|
32206
|
-
|
|
32207
|
-
|
|
32208
|
-
|
|
32230
|
+
})))), filteredNavOptions.map((section) => {
|
|
32231
|
+
var _a;
|
|
32232
|
+
return /* @__PURE__ */ React.createElement("section", {
|
|
32233
|
+
className: "sps-side-nav__section",
|
|
32234
|
+
key: (_a = section.key) != null ? _a : section.sectionTitle
|
|
32235
|
+
}, section.sectionTitle && /* @__PURE__ */ React.createElement("div", {
|
|
32236
|
+
className: "sps-side-nav__section-title",
|
|
32237
|
+
style: { fontWeight: 400 }
|
|
32238
|
+
}, section.sectionTitle), section.navItems.map((item) => {
|
|
32239
|
+
var _a2;
|
|
32240
|
+
return /* @__PURE__ */ React.createElement(SpsSideNavBranch, {
|
|
32241
|
+
branch: __spreadProps(__spreadValues({}, item), {
|
|
32242
|
+
expanded: findParentBranches(item.subNavItems, activeNavItem)
|
|
32243
|
+
}),
|
|
32244
|
+
activeBranch,
|
|
32245
|
+
setActiveBranch: (branchName, key) => {
|
|
32246
|
+
handleNavAction(branchName, key);
|
|
32247
|
+
},
|
|
32248
|
+
key: (_a2 = item.key) != null ? _a2 : item.name
|
|
32249
|
+
});
|
|
32250
|
+
}));
|
|
32251
|
+
})));
|
|
32209
32252
|
};
|
|
32210
32253
|
const SpsSideNavExamples = {
|
|
32211
32254
|
usage: {
|
|
@@ -36781,7 +36824,8 @@ function SpsDatepickerCalendar(props2) {
|
|
|
36781
36824
|
minDate,
|
|
36782
36825
|
onNewSelection,
|
|
36783
36826
|
selectedDate,
|
|
36784
|
-
selectedRange
|
|
36827
|
+
selectedRange,
|
|
36828
|
+
"data-testid": testId
|
|
36785
36829
|
} = _a, rest = __objRest(_a, [
|
|
36786
36830
|
"children",
|
|
36787
36831
|
"className",
|
|
@@ -36789,7 +36833,8 @@ function SpsDatepickerCalendar(props2) {
|
|
|
36789
36833
|
"minDate",
|
|
36790
36834
|
"onNewSelection",
|
|
36791
36835
|
"selectedDate",
|
|
36792
|
-
"selectedRange"
|
|
36836
|
+
"selectedRange",
|
|
36837
|
+
"data-testid"
|
|
36793
36838
|
]);
|
|
36794
36839
|
const { t: t2 } = React.useContext(I18nContext);
|
|
36795
36840
|
const [viewMonth, setViewMonth] = React.useState(() => determineViewMonth(props2));
|
|
@@ -36830,12 +36875,14 @@ function SpsDatepickerCalendar(props2) {
|
|
|
36830
36875
|
}
|
|
36831
36876
|
const classes = clsx(CSS_ELEMENT$1, className);
|
|
36832
36877
|
return viewMonth ? /* @__PURE__ */ React.createElement("div", __spreadProps(__spreadValues({
|
|
36878
|
+
"data-testid": `${testId}`,
|
|
36833
36879
|
className: classes
|
|
36834
36880
|
}, rest), {
|
|
36835
36881
|
onMouseOver: handleMouseEnter
|
|
36836
36882
|
}), /* @__PURE__ */ React.createElement("div", {
|
|
36837
36883
|
className: `${CSS_ELEMENT$1}-head`
|
|
36838
36884
|
}, /* @__PURE__ */ React.createElement("button", {
|
|
36885
|
+
"data-testid": `${testId}_prev_month`,
|
|
36839
36886
|
type: "button",
|
|
36840
36887
|
tabIndex: -1,
|
|
36841
36888
|
disabled: SimpleDateUtils.isSameMonth(viewMonth, minDate),
|
|
@@ -36852,6 +36899,7 @@ function SpsDatepickerCalendar(props2) {
|
|
|
36852
36899
|
className: `${CSS_ELEMENT$1}-head-label-year`
|
|
36853
36900
|
}, viewMonth.year)), /* @__PURE__ */ React.createElement("button", {
|
|
36854
36901
|
type: "button",
|
|
36902
|
+
"data-testid": `${testId}_next_month`,
|
|
36855
36903
|
tabIndex: -1,
|
|
36856
36904
|
disabled: SimpleDateUtils.isSameMonth(viewMonth, maxDate),
|
|
36857
36905
|
title: t2("design-system:datepicker.calendar.nextMonth"),
|
|
@@ -36872,7 +36920,8 @@ function SpsDatepickerCalendar(props2) {
|
|
|
36872
36920
|
}, week.map((date2, j) => /* @__PURE__ */ React.createElement("div", {
|
|
36873
36921
|
key: j,
|
|
36874
36922
|
className: calendarCellClasses(date2),
|
|
36875
|
-
onClick: () => handleCellClick(date2)
|
|
36923
|
+
onClick: () => handleCellClick(date2),
|
|
36924
|
+
"data-testid": `${testId}_${SimpleDateUtils.toString(date2)}`
|
|
36876
36925
|
}, date2 ? date2.date : "")))))) : /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
36877
36926
|
}
|
|
36878
36927
|
Object.assign(SpsDatepickerCalendar, {
|
|
@@ -37068,7 +37117,8 @@ function SpsDateRangePickerV2(_Y) {
|
|
|
37068
37117
|
minDate,
|
|
37069
37118
|
onChange,
|
|
37070
37119
|
presets = DEFAULT_PRESETS,
|
|
37071
|
-
value
|
|
37120
|
+
value,
|
|
37121
|
+
"data-testid": testId
|
|
37072
37122
|
} = _Z, rest = __objRest(_Z, [
|
|
37073
37123
|
"children",
|
|
37074
37124
|
"className",
|
|
@@ -37079,7 +37129,8 @@ function SpsDateRangePickerV2(_Y) {
|
|
|
37079
37129
|
"minDate",
|
|
37080
37130
|
"onChange",
|
|
37081
37131
|
"presets",
|
|
37082
|
-
"value"
|
|
37132
|
+
"value",
|
|
37133
|
+
"data-testid"
|
|
37083
37134
|
]);
|
|
37084
37135
|
const { t: t2 } = React.useContext(I18nContext);
|
|
37085
37136
|
const { wrapperId, controlId } = useFormControlId(id2, formMeta);
|
|
@@ -37194,6 +37245,7 @@ function SpsDateRangePickerV2(_Y) {
|
|
|
37194
37245
|
}, /* @__PURE__ */ React.createElement("i", {
|
|
37195
37246
|
className: clsx("sps-text-input__icon", "sps-icon", "sps-icon-calendar")
|
|
37196
37247
|
}), selectedPreset && /* @__PURE__ */ React.createElement("div", {
|
|
37248
|
+
"data-testid": `${testId}_selected_preset`,
|
|
37197
37249
|
className: "sps-datepicker__selected-preset"
|
|
37198
37250
|
}, /* @__PURE__ */ React.createElement("span", {
|
|
37199
37251
|
className: "sps-tag sps-tag--info"
|
|
@@ -37201,6 +37253,7 @@ function SpsDateRangePickerV2(_Y) {
|
|
|
37201
37253
|
type: "text",
|
|
37202
37254
|
ref: textInput,
|
|
37203
37255
|
className: "sps-text-input__input",
|
|
37256
|
+
"data-testid": `${testId}_date_input`,
|
|
37204
37257
|
id: controlId,
|
|
37205
37258
|
placeholder: !stringValue && !selectedPreset ? FORMAT : void 0,
|
|
37206
37259
|
onChange: handleTextInputChange,
|
|
@@ -37223,6 +37276,7 @@ function SpsDateRangePickerV2(_Y) {
|
|
|
37223
37276
|
}, t2("design-system:datepicker.presetsLabel")), /* @__PURE__ */ React.createElement("div", {
|
|
37224
37277
|
className: "sps-custom-control sps-custom-radio sps-custom-control--no-error"
|
|
37225
37278
|
}, /* @__PURE__ */ React.createElement("input", {
|
|
37279
|
+
"data-testid": `${testId}_presets_custom_input`,
|
|
37226
37280
|
type: "radio",
|
|
37227
37281
|
id: `sps-date-range-picker-${wrapperId}__range-custom`,
|
|
37228
37282
|
className: "sps-custom-control__input",
|
|
@@ -37237,6 +37291,7 @@ function SpsDateRangePickerV2(_Y) {
|
|
|
37237
37291
|
className: "sps-custom-control sps-custom-radio sps-custom-control--no-error"
|
|
37238
37292
|
}, /* @__PURE__ */ React.createElement("input", {
|
|
37239
37293
|
type: "radio",
|
|
37294
|
+
"data-testid": `${testId}_preset_option_${preset2.label}`,
|
|
37240
37295
|
id: `sps-date-range-picker-${wrapperId}__range-${i2}`,
|
|
37241
37296
|
name: `sps-date-range-picker-${wrapperId}__range`,
|
|
37242
37297
|
onChange: () => selectPreset(preset2),
|
|
@@ -37246,6 +37301,7 @@ function SpsDateRangePickerV2(_Y) {
|
|
|
37246
37301
|
className: "sps-custom-control__label",
|
|
37247
37302
|
htmlFor: `sps-date-range-picker-${wrapperId}__range-${i2}`
|
|
37248
37303
|
}, getPresetText(preset2)))))), /* @__PURE__ */ React.createElement(SpsDatepickerCalendar, {
|
|
37304
|
+
"data-testid": `${testId}_calendar`,
|
|
37249
37305
|
selectedRange: Array.isArray(value) ? value : displayRange,
|
|
37250
37306
|
onNewSelection: handleNewSelection,
|
|
37251
37307
|
minDate,
|
|
@@ -38015,4 +38071,4 @@ Object.assign(SpsVr, {
|
|
|
38015
38071
|
propTypes,
|
|
38016
38072
|
displayName: "SpsDescriptionListTerm / SpsDt"
|
|
38017
38073
|
});
|
|
38018
|
-
export { AsTypingErrorKeys, ContentOrderExample, FauxChangeEvent, I18nContext, MANIFEST, OnBlurErrorKeys, PortalContext, PreventativeErrorKeys, SimpleDateUtils, SpsAddRemoveFormRowExamples, SpsAdvancedSearch, SpsAdvancedSearchExamples, SpsAutocomplete, SpsAutocompleteExamples, SpsButton, SpsButtonExamples, SpsButtonGroup, SpsCard, SpsCardExamples, SpsCardTabbedPane, SpsCardV2, SpsCardV2Footer, SpsCardV2Header, SpsCardV2Title, SpsCheckbox, SpsCheckboxDropdown, SpsCheckboxExamples, SpsClickableTag, SpsClickableTagExamples, SpsColumnChooser, SpsColumnChooserColumn, SpsColumnChooserExamples, SpsConditionalField, SpsConditionalFieldExamples, SpsContentRow, SpsContentRowCol, SpsContentRowExamples, SpsContentRowExpansion, SpsCurrencyInput, SpsCurrencyInputExamples, SpsDateRangePicker, SpsDateRangePickerExamples, SpsDateRangePickerV2, SpsDateTime, SpsDatepicker, SpsDatepickerExamples, SpsDatepickerV2, SpsDatetimeExamples, SpsDd, SpsDescriptionList, SpsDescriptionListDefinition, SpsDescriptionListExamples, SpsDescriptionListTerm, SpsDl, SpsDropdown, SpsDropdownExamples, SpsDt, SpsFeedbackBlock, SpsFeedbackBlockExamples, SpsFieldset, SpsFieldsetExamples, SpsFilterPanel, SpsFilterPanelCap, SpsFilterPanelExamples, SpsFilterPanelFilterBox, SpsFilterPanelSection, SpsFilterTile, SpsFilterTileList, SpsFilterTileListExamples, SpsFocusedTask, SpsFocusedTaskActions, SpsFocusedTaskExamples, SpsForm, SpsFormArrayMeta, SpsFormComponentWrapper, SpsFormExamples, SpsFormFieldMeta, SpsFormGroupMeta, SpsFormMetaBase, SpsFormSetMeta, SpsGrowler, SpsGrowlerExamples, SpsI, SpsIconButtonPanel, SpsIncrementor, SpsIncrementorExamples, SpsInputGroup, SpsInsightTile, SpsInsights, SpsKeyValueList, SpsKeyValueListExamples, SpsKeyValueListItem, SpsKeyValueTag, SpsKeyValueTagExamples, SpsLabel, SpsLabelExamples, SpsListActionBar, SpsListActionBarExamples, SpsListToolbar, SpsListToolbarExamples, SpsListToolbarSearch, SpsListToolbarSearchInfo, SpsMicroBlock, SpsMicroBlockExamples, SpsMicroZeroState, SpsModal, SpsModalAction, SpsModalBody, SpsModalExamples, SpsModalFooter, SpsModalHeader, SpsModalOverlay, SpsModalV2, SpsModalV2Footer, SpsMultiSelect, SpsMultiSelectExamples, SpsPageSelector, SpsPageSubtitle, SpsPageTitle, SpsPageTitleExamples, SpsPagination, SpsPaginationExamples, SpsProductBar, SpsProductBarExamples, SpsProductBarTab, SpsProgressBar, SpsProgressBarExamples, SpsProgressRing, SpsRadioButton, SpsRadioButtonExamples, SpsScrollableContainer, SpsScrollableContainerExamples, SpsSearchResultsBar, SpsSearchResultsBarExamples, SpsSelect, SpsSelectExamples, SpsSideNav, SpsSideNavExamples, SpsSlackLink, SpsSlackLinkExamples, SpsSortingHeader, SpsSortingHeaderCell, SpsSortingHeaderExamples, SpsSpinner, SpsSpinnerExamples, SpsSplitButton, SpsSplitButtonExamples, SpsSteppedProgressBar, SpsSteppedProgressBarExamples, SpsSummaryListColumn, SpsSummaryListExamples, SpsSummaryListExpansion, SpsSummaryListRow, SpsTab, SpsTabPanel, SpsTable, SpsTableBody, SpsTableCell, SpsTableExamples, SpsTableHead, SpsTableHeader, SpsTableRow, SpsTabsV2, SpsTag, SpsTagExamples, SpsTaskQueue, SpsTaskQueueExamples, SpsTbody, SpsTd, SpsTextInput, SpsTextInputExamples, SpsTextarea, SpsTextareaExamples, SpsTh, SpsThead, SpsTile, SpsTileList, SpsTileListExamples, SpsToggle, SpsToggleExamples, SpsTooltip, SpsTooltipExamples, SpsTooltipTitle, SpsTr, SpsValidators, SpsVerticalRule, SpsVr, SpsWf, SpsWfDoc, SpsWfDs, SpsWfStep, SpsWizardExamples, SpsWizardSidebar, SpsWizardSubstep, SpsWorkflow, SpsWorkflowDocument, SpsWorkflowDocumentStatus, SpsWorkflowExamples, SpsWorkflowStep, SpsZeroState, SpsZeroStateExamples, TooltipVisibility, contentOf, date, dateConstraint, dateRange, findParentBranches, flipPosition, formArray, formControl, formGroup, getMember, getPosition, selectChildren, toggleTooltipState, useCheckDeprecatedProps, useDidUpdateEffect, useDocumentEventListener, useElementId, useForm, useGrowlers, useInputPopup, usePatchReducer, usePortal, useServerSideValidation, useSpsAction, useSpsForm, validate, weekOfMonth };
|
|
38074
|
+
export { AsTypingErrorKeys, ContentOrderExample, DEFAULT_PRESETS, FauxChangeEvent, I18nContext, MANIFEST, OnBlurErrorKeys, PortalContext, PreventativeErrorKeys, SimpleDateUtils, SpsAddRemoveFormRowExamples, SpsAdvancedSearch, SpsAdvancedSearchExamples, SpsAutocomplete, SpsAutocompleteExamples, SpsButton, SpsButtonExamples, SpsButtonGroup, SpsCard, SpsCardExamples, SpsCardTabbedPane, SpsCardV2, SpsCardV2Footer, SpsCardV2Header, SpsCardV2Title, SpsCheckbox, SpsCheckboxDropdown, SpsCheckboxExamples, SpsClickableTag, SpsClickableTagExamples, SpsColumnChooser, SpsColumnChooserColumn, SpsColumnChooserExamples, SpsConditionalField, SpsConditionalFieldExamples, SpsContentRow, SpsContentRowCol, SpsContentRowExamples, SpsContentRowExpansion, SpsCurrencyInput, SpsCurrencyInputExamples, SpsDateRangePicker, SpsDateRangePickerExamples, SpsDateRangePickerV2, SpsDateTime, SpsDatepicker, SpsDatepickerExamples, SpsDatepickerV2, SpsDatetimeExamples, SpsDd, SpsDescriptionList, SpsDescriptionListDefinition, SpsDescriptionListExamples, SpsDescriptionListTerm, SpsDl, SpsDropdown, SpsDropdownExamples, SpsDt, SpsFeedbackBlock, SpsFeedbackBlockExamples, SpsFieldset, SpsFieldsetExamples, SpsFilterPanel, SpsFilterPanelCap, SpsFilterPanelExamples, SpsFilterPanelFilterBox, SpsFilterPanelSection, SpsFilterTile, SpsFilterTileList, SpsFilterTileListExamples, SpsFocusedTask, SpsFocusedTaskActions, SpsFocusedTaskExamples, SpsForm, SpsFormArrayMeta, SpsFormComponentWrapper, SpsFormExamples, SpsFormFieldMeta, SpsFormGroupMeta, SpsFormMetaBase, SpsFormSetMeta, SpsGrowler, SpsGrowlerExamples, SpsI, SpsIconButtonPanel, SpsIncrementor, SpsIncrementorExamples, SpsInputGroup, SpsInsightTile, SpsInsights, SpsKeyValueList, SpsKeyValueListExamples, SpsKeyValueListItem, SpsKeyValueTag, SpsKeyValueTagExamples, SpsLabel, SpsLabelExamples, SpsListActionBar, SpsListActionBarExamples, SpsListToolbar, SpsListToolbarExamples, SpsListToolbarSearch, SpsListToolbarSearchInfo, SpsMicroBlock, SpsMicroBlockExamples, SpsMicroZeroState, SpsModal, SpsModalAction, SpsModalBody, SpsModalExamples, SpsModalFooter, SpsModalHeader, SpsModalOverlay, SpsModalV2, SpsModalV2Footer, SpsMultiSelect, SpsMultiSelectExamples, SpsPageSelector, SpsPageSubtitle, SpsPageTitle, SpsPageTitleExamples, SpsPagination, SpsPaginationExamples, SpsProductBar, SpsProductBarExamples, SpsProductBarTab, SpsProgressBar, SpsProgressBarExamples, SpsProgressRing, SpsRadioButton, SpsRadioButtonExamples, SpsScrollableContainer, SpsScrollableContainerExamples, SpsSearchResultsBar, SpsSearchResultsBarExamples, SpsSelect, SpsSelectExamples, SpsSideNav, SpsSideNavExamples, SpsSlackLink, SpsSlackLinkExamples, SpsSortingHeader, SpsSortingHeaderCell, SpsSortingHeaderExamples, SpsSpinner, SpsSpinnerExamples, SpsSplitButton, SpsSplitButtonExamples, SpsSteppedProgressBar, SpsSteppedProgressBarExamples, SpsSummaryListColumn, SpsSummaryListExamples, SpsSummaryListExpansion, SpsSummaryListRow, SpsTab, SpsTabPanel, SpsTable, SpsTableBody, SpsTableCell, SpsTableExamples, SpsTableHead, SpsTableHeader, SpsTableRow, SpsTabsV2, SpsTag, SpsTagExamples, SpsTaskQueue, SpsTaskQueueExamples, SpsTbody, SpsTd, SpsTextInput, SpsTextInputExamples, SpsTextarea, SpsTextareaExamples, SpsTh, SpsThead, SpsTile, SpsTileList, SpsTileListExamples, SpsToggle, SpsToggleExamples, SpsTooltip, SpsTooltipExamples, SpsTooltipTitle, SpsTr, SpsValidators, SpsVerticalRule, SpsVr, SpsWf, SpsWfDoc, SpsWfDs, SpsWfStep, SpsWizardExamples, SpsWizardSidebar, SpsWizardSubstep, SpsWorkflow, SpsWorkflowDocument, SpsWorkflowDocumentStatus, SpsWorkflowExamples, SpsWorkflowStep, SpsZeroState, SpsZeroStateExamples, TooltipVisibility, contentOf, date, dateConstraint, dateRange, findParentBranches, flipPosition, formArray, formControl, formGroup, getMember, getPosition, selectChildren, toggleTooltipState, useCheckDeprecatedProps, useDidUpdateEffect, useDocumentEventListener, useElementId, useForm, useGrowlers, useInputPopup, usePatchReducer, usePortal, useServerSideValidation, useSpsAction, useSpsForm, validate, weekOfMonth };
|
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
/** TODO: Fix circular deps, update to follow our patterns, then remove eslint override */
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import type { SpsIcon, TagKind } from "@spscommerce/ds-shared";
|
|
4
|
-
export interface
|
|
4
|
+
export interface SideNavItem {
|
|
5
5
|
name: string;
|
|
6
6
|
tag?: TagKind;
|
|
7
|
+
key?: string | number;
|
|
7
8
|
tagContent?: string;
|
|
8
|
-
subNavItems?:
|
|
9
|
+
subNavItems?: SideNavItem[];
|
|
9
10
|
icon?: SpsIcon;
|
|
10
11
|
}
|
|
11
12
|
export interface SideNavSection {
|
|
12
|
-
sectionTitle
|
|
13
|
-
|
|
13
|
+
sectionTitle?: string;
|
|
14
|
+
key?: string | number;
|
|
15
|
+
navItems: SideNavItem[];
|
|
14
16
|
}
|
|
15
|
-
export interface SideNavBranch extends
|
|
17
|
+
export interface SideNavBranch extends SideNavItem {
|
|
16
18
|
expanded: boolean;
|
|
17
19
|
}
|
|
18
20
|
export interface SpsSideNavProps {
|
|
19
21
|
title?: string;
|
|
20
22
|
titleIcon?: SpsIcon;
|
|
21
23
|
activeNavItem: string;
|
|
22
|
-
onNavChange?: (newNav: string) => void;
|
|
24
|
+
onNavChange?: (newNav: string, newNavKey?: string | number) => void;
|
|
23
25
|
navOptions: SideNavSection[];
|
|
24
26
|
tabs?: string[];
|
|
25
27
|
initialActiveTab?: string;
|
|
@@ -32,5 +34,5 @@ export interface SpsSideNavProps {
|
|
|
32
34
|
* @param nav SideNavItems[] array of navigation branches to be checked
|
|
33
35
|
* @param activeTab string currently active tab
|
|
34
36
|
*/
|
|
35
|
-
export declare const findParentBranches: (nav:
|
|
37
|
+
export declare const findParentBranches: (nav: SideNavItem[], activeTab: string) => boolean;
|
|
36
38
|
export declare const SpsSideNav: React.FC<SpsSideNavProps>;
|
|
@@ -4,6 +4,6 @@ import type { SideNavBranch } from "./SpsSideNav";
|
|
|
4
4
|
export interface SpsSideNavBranchProps {
|
|
5
5
|
branch: SideNavBranch;
|
|
6
6
|
activeBranch: string;
|
|
7
|
-
setActiveBranch: (activeChildBranchName: string) => void;
|
|
7
|
+
setActiveBranch: (activeChildBranchName: string, activeChildBranchKey?: string | number) => void;
|
|
8
8
|
}
|
|
9
9
|
export declare const SpsSideNavBranch: React.FC<SpsSideNavBranchProps>;
|
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.10.3",
|
|
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.10.3",
|
|
32
|
+
"@spscommerce/ds-shared": "5.10.3",
|
|
33
|
+
"@spscommerce/positioning": "5.10.3",
|
|
34
|
+
"@spscommerce/utils": "5.10.3",
|
|
35
35
|
"moment": "^2.25.3",
|
|
36
36
|
"moment-timezone": "^0.5.28",
|
|
37
37
|
"react": "^16.9.0",
|
|
@@ -39,10 +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.
|
|
42
|
+
"@spscommerce/ds-colors": "5.10.3",
|
|
43
|
+
"@spscommerce/ds-shared": "5.10.3",
|
|
44
|
+
"@spscommerce/positioning": "5.10.3",
|
|
45
|
+
"@spscommerce/utils": "5.10.3",
|
|
46
46
|
"@testing-library/react": "^9.3.2",
|
|
47
47
|
"@types/prop-types": "^15.7.1",
|
|
48
48
|
"@types/react": "^16.9.0",
|