@wix/editor-react-components 1.2172.0 → 1.2174.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.
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useRef, useEffect } from "react";
2
+ import { useState, useRef, useEffect } from "react";
3
3
  import { c as clsx } from "../chunks/clsx.js";
4
4
  import { s as selectors } from "../chunks/constants22.js";
5
5
  const root = "root__zTlgX";
@@ -63,13 +63,25 @@ const MultiStateBox = (props) => {
63
63
  activeStateName
64
64
  );
65
65
  const stateKeys = getStateKeys(states);
66
+ const activeKey = stateKeys[activeIndex];
67
+ const [visitedKeys, setVisitedKeys] = useState(
68
+ () => activeKey === void 0 ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([activeKey])
69
+ );
66
70
  const prevActiveIndexRef = useRef(activeIndex);
67
71
  useEffect(() => {
68
72
  if (prevActiveIndexRef.current !== activeIndex) {
69
73
  prevActiveIndexRef.current = activeIndex;
70
74
  onChange == null ? void 0 : onChange();
75
+ setVisitedKeys((prev) => {
76
+ if (activeKey === void 0 || prev.has(activeKey)) {
77
+ return prev;
78
+ }
79
+ const next = new Set(prev);
80
+ next.add(activeKey);
81
+ return next;
82
+ });
71
83
  }
72
- }, [activeIndex, onChange]);
84
+ }, [activeIndex, activeKey, onChange]);
73
85
  return /* @__PURE__ */ jsx(
74
86
  "div",
75
87
  {
@@ -83,13 +95,16 @@ const MultiStateBox = (props) => {
83
95
  className: clsx(selectors.root, styles.root, className),
84
96
  children: states.map((state2, index) => {
85
97
  const isActive = index === activeIndex;
98
+ if (!isActive && !visitedKeys.has(stateKeys[index])) {
99
+ return null;
100
+ }
86
101
  return /* @__PURE__ */ jsx(
87
102
  "div",
88
103
  {
104
+ "data-state-index": index,
89
105
  className: clsx(selectors.stateContainer, styles.state, {
90
106
  [styles["is-active"]]: isActive
91
107
  }),
92
- ...!isActive && { inert: "" },
93
108
  children: state2.content
94
109
  },
95
110
  stateKeys[index]
@@ -4,10 +4,8 @@
4
4
  }
5
5
 
6
6
  .state__BCzGt {
7
- grid-area: 1/1;
8
7
  display: grid;
9
- opacity: 0;
10
8
  }
11
- .state__BCzGt.is-active__8ZJqC {
12
- opacity: 1;
9
+ .state__BCzGt:not(.is-active__8ZJqC) {
10
+ display: none;
13
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/editor-react-components",
3
- "version": "1.2172.0",
3
+ "version": "1.2174.0",
4
4
  "description": "React components for the Wix Editor",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -34,10 +34,8 @@
34
34
  "build": "yarn build:lite && yarn build:janet && yarn build:package",
35
35
  "build:package": "vite build && yarn check:npm-bundle-secrets",
36
36
  "check:npm-bundle-secrets": "node scripts/check-npm-bundle-secrets.mjs",
37
- "lint": "yarn run -T lint:ox:package",
38
- "check:linting": "yarn run lint",
39
- "check:formatting": "yarn run -T oxfmt -c ../../.oxfmtrc.json . --check",
40
- "validate": "yarn run -T turbo check:linting check:formatting",
37
+ "lint": "yarn run -T lint:package",
38
+ "check:lint-and-format": "yarn run -T concurrently yarn:lint yarn:format:check",
41
39
  "build:app": "astro check && wix build",
42
40
  "build:lite": "yarn validate:manifests && yarn build:app",
43
41
  "dev": "yarn validate:manifests && yarn cli-dev",
@@ -61,7 +59,8 @@
61
59
  "generate:manifest-tests": "NODE_NO_WARNINGS=1 tsx scripts/generate-manifest-tests.ts",
62
60
  "generate-css-from-manifest": "generate-css-from-manifest",
63
61
  "validate:manifests": "NODE_NO_WARNINGS=1 tsx scripts/validate-manifests.ts",
64
- "fix:manifests": "NODE_NO_WARNINGS=1 tsx scripts/validate-manifests.ts --fix"
62
+ "fix:manifests": "NODE_NO_WARNINGS=1 tsx scripts/validate-manifests.ts --fix",
63
+ "format:check": "yarn run -T format:package:check"
65
64
  },
66
65
  "peerDependencies": {
67
66
  "@wix/editor-react-types": "^1.0.8",
@@ -179,7 +178,7 @@
179
178
  },
180
179
  "validations": {
181
180
  "postDependenciesBuild": [
182
- "validate"
181
+ "check:lint-and-format"
183
182
  ],
184
183
  "postPublish": [
185
184
  "test:e2e"
@@ -190,5 +189,5 @@
190
189
  "registry": "https://registry.npmjs.org/",
191
190
  "access": "public"
192
191
  },
193
- "falconPackageHash": "0609b109bce275c22f79f35dc48d60f1a089039738c804c3c7e875d7"
192
+ "falconPackageHash": "077ac90001681d86c1baea7cf9f284f4d42f7c8782e19c2e4b0f4734"
194
193
  }