@spscommerce/ds-react 4.29.1 → 4.31.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.es.js CHANGED
@@ -31,7 +31,7 @@ var __objRest = (source, exclude) => {
31
31
  };
32
32
  import * as React from "react";
33
33
  import React__default, { useRef, useEffect, createContext, useMemo as useMemo$1, useContext, useReducer, useState, useCallback as useCallback$1, useLayoutEffect as useLayoutEffect$1 } from "react";
34
- import { noI18nI18n, ButtonKind, ButtonType, SpsIcon as SpsIcon$1, SpinnerSize, Position, ZStratum, SpsOptionListOption, DropdownKind, SPS_ACTION_DEFAULTS, ClickableTagKind, MultiSelectTagKind, TagKind, SpsIconSize, SelectMode, TooltipKind, TooltipShowTrigger, TOOLTIP_HIDE_DELAY_MS_DEFAULT, FeedbackBlockKind, FeedbackBlockIcons, GrowlerKind, GrowlerIcon, GROWLER_VISIBLE_DURATION_MS, GROWLER_FADEOUT_DURATION_MS, SpsInsightTileKind, SpsInsightTileIcons, SortDirection, ModalKind, ModalSize, DEFAULT_PAGE_SIZE_OPTIONS, StdButtonKind, SpsTaskStatus, TASK_QUEUE_NOTIFICATION_DURATION_MS, SpsTaskStatusIcons, SpsFilterTileKind, RingSize, WizardSubstepConditions } from "@spscommerce/ds-shared";
34
+ import { noI18nI18n, ButtonKind, ButtonType, SpsIcon as SpsIcon$1, SpinnerSize, Position, ZStratum, SpsOptionListOption, DropdownKind, SPS_ACTION_DEFAULTS, ClickableTagKind, MultiSelectTagKind, TagKind, SpsIconSize, SelectMode, TooltipKind, TooltipShowTrigger, TOOLTIP_HIDE_DELAY_MS_DEFAULT, FeedbackBlockKind, FeedbackBlockIcons, GrowlerKind, GrowlerIcon, GROWLER_VISIBLE_DURATION_MS, GROWLER_FADEOUT_DURATION_MS, SpsInsightTileKind, SpsInsightTileIcons, KeyValueListTitleColor, SortDirection, ModalKind, ModalSize, DEFAULT_PAGE_SIZE_OPTIONS, StdButtonKind, SpsTaskStatus, TASK_QUEUE_NOTIFICATION_DURATION_MS, SpsTaskStatusIcons, SpsFilterTileKind, RingSize, WizardSubstepConditions } from "@spscommerce/ds-shared";
35
35
  import { values as values$3, code, debounce, flatten, deepFreeze, setPath, diff, DiffChange, getPath, crumblePath, traversePath, forEachNestedObject, lockToAnimationFrames, constrain } from "@spscommerce/utils";
36
36
  import * as ReactDOM from "react-dom";
37
37
  import { createPortal, unstable_batchedUpdates } from "react-dom";
@@ -25069,26 +25069,30 @@ Object.assign(SpsKeyValueList, {
25069
25069
  displayName: "SpsKeyValueList"
25070
25070
  });
25071
25071
  const propsDoc$12 = {
25072
- itemKey: { type: "string", required: true }
25072
+ itemKey: { type: "string | nodeOrRenderFn", required: true },
25073
+ titleColor: "KeyValueListTitleColor"
25073
25074
  };
25074
25075
  const propTypes$15 = __spreadProps(__spreadValues({}, spsGlobalPropTypes), {
25075
- itemKey: propTypes$1K.exports.string.isRequired
25076
+ itemKey: propTypes$1K.exports.string.isRequired || nodeOrRenderFn.isRequired,
25077
+ titleColor: enumValue(KeyValueListTitleColor)
25076
25078
  });
25077
25079
  function SpsKeyValueListItem(props2) {
25078
25080
  const _a = props2, {
25079
25081
  children,
25080
25082
  className,
25081
25083
  itemKey,
25084
+ titleColor = KeyValueListTitleColor.LIGHT,
25082
25085
  "data-testid": testId,
25083
25086
  unsafelyReplaceClassName
25084
25087
  } = _a, rest = __objRest(_a, [
25085
25088
  "children",
25086
25089
  "className",
25087
25090
  "itemKey",
25091
+ "titleColor",
25088
25092
  "data-testid",
25089
25093
  "unsafelyReplaceClassName"
25090
25094
  ]);
25091
- const classes = clsx(unsafelyReplaceClassName || "sps-key-value-list__item", className);
25095
+ const classes = clsx(unsafelyReplaceClassName || "sps-key-value-list__item", `sps-key-value-list__item--${titleColor}`, className);
25092
25096
  return /* @__PURE__ */ React.createElement("div", __spreadValues({
25093
25097
  className: classes,
25094
25098
  "data-testid": `${testId}`
@@ -36552,6 +36556,11 @@ function SpsDatepickerV2(_W) {
36552
36556
  updateValue();
36553
36557
  }
36554
36558
  const classes = clsx(CSS_BLOCK$1, "sps-text-input", showPopup && `${CSS_BLOCK$1}--open`, className);
36559
+ React.useEffect(() => {
36560
+ if (!value || SimpleDateUtils.isValid(value)) {
36561
+ setStringValue(SimpleDateUtils.toString(value));
36562
+ }
36563
+ }, [value]);
36555
36564
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SpsFormComponentWrapper, {
36556
36565
  id: wrapperId,
36557
36566
  className: classes,
@@ -36712,7 +36721,9 @@ function SpsDateRangePickerV2(_Y) {
36712
36721
  if (!value) {
36713
36722
  clear();
36714
36723
  } else if (Array.isArray(value)) {
36715
- setStringValue(SimpleDateUtils.toStringRange(value));
36724
+ if (value.every((v2) => SimpleDateUtils.isValid(v2))) {
36725
+ setStringValue(SimpleDateUtils.toStringRange(value));
36726
+ }
36716
36727
  setDisplayRange(null);
36717
36728
  } else if (typeof value.definition === "function") {
36718
36729
  setDisplayRange(value.definition());
@@ -1,6 +1,8 @@
1
+ import { KeyValueListTitleColor } from "@spscommerce/ds-shared";
1
2
  import * as PropTypes from "../prop-types";
2
3
  declare const propTypes: {
3
- itemKey: PropTypes.Validator<string>;
4
+ itemKey: PropTypes.Validator<PropTypes.ReactNodeOrRenderFn>;
5
+ titleColor: PropTypes.Requireable<KeyValueListTitleColor>;
4
6
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
5
7
  className: PropTypes.Requireable<string>;
6
8
  "data-testid": PropTypes.Requireable<string>;
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": "4.29.1",
4
+ "version": "4.31.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": "4.29.1",
32
- "@spscommerce/ds-shared": "4.29.1",
33
- "@spscommerce/positioning": "4.29.1",
34
- "@spscommerce/utils": "4.29.1",
31
+ "@spscommerce/ds-colors": "4.31.0",
32
+ "@spscommerce/ds-shared": "4.31.0",
33
+ "@spscommerce/positioning": "4.31.0",
34
+ "@spscommerce/utils": "4.31.0",
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": "4.29.1",
43
- "@spscommerce/ds-shared": "4.29.1",
44
- "@spscommerce/positioning": "4.29.1",
45
- "@spscommerce/utils": "4.29.1",
42
+ "@spscommerce/ds-colors": "4.31.0",
43
+ "@spscommerce/ds-shared": "4.31.0",
44
+ "@spscommerce/positioning": "4.31.0",
45
+ "@spscommerce/utils": "4.31.0",
46
46
  "@testing-library/jest-dom": "^4.2.4",
47
47
  "@testing-library/react": "^9.3.2",
48
48
  "@types/prop-types": "^15.7.1",