@wix/editor-react-components 1.2489.0 → 1.2490.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.
@@ -23,9 +23,13 @@ type TestCompProps = {
23
23
  alt?: string;
24
24
  className?: string;
25
25
  };
26
+ errorText?: {
27
+ text?: string;
28
+ };
26
29
  };
27
30
  a11y?: A11y;
28
31
  isEnabled?: boolean;
32
+ isError?: boolean;
29
33
  label?: string;
30
34
  count?: number;
31
35
  variant?: string;
@@ -38,7 +38,7 @@ const styles = {
38
38
  functionBtn
39
39
  };
40
40
  const TestComp = (props) => {
41
- var _a, _b, _c, _d, _e, _f;
41
+ var _a, _b, _c, _d, _e, _f, _g;
42
42
  const {
43
43
  id,
44
44
  className,
@@ -47,6 +47,7 @@ const TestComp = (props) => {
47
47
  elementProps = {},
48
48
  a11y = {},
49
49
  isEnabled,
50
+ isError,
50
51
  label,
51
52
  count,
52
53
  variant,
@@ -107,7 +108,8 @@ const TestComp = (props) => {
107
108
  className,
108
109
  styles.root,
109
110
  formatClassNames(semanticClassNames.root, ...customClassNames),
110
- "test-comp-card"
111
+ "test-comp-card",
112
+ isError && "test-comp-card--error"
111
113
  ),
112
114
  ...a11y,
113
115
  dir: direction,
@@ -140,13 +142,14 @@ const TestComp = (props) => {
140
142
  children: ((_d = elementProps.description) == null ? void 0 : _d.text) || "Edit the settings to see values change"
141
143
  }
142
144
  ),
143
- ((_e = elementProps.image) == null ? void 0 : _e.src) && /* @__PURE__ */ jsx(
145
+ isError && /* @__PURE__ */ jsx("p", { className: "card-error-text", children: ((_e = elementProps.errorText) == null ? void 0 : _e.text) || "Something went wrong" }),
146
+ ((_f = elementProps.image) == null ? void 0 : _f.src) && /* @__PURE__ */ jsx(
144
147
  "div",
145
148
  {
146
149
  className: clsx(
147
150
  styles.imageWrapper,
148
151
  "card-image",
149
- (_f = elementProps.image) == null ? void 0 : _f.className
152
+ (_g = elementProps.image) == null ? void 0 : _g.className
150
153
  ),
151
154
  children: /* @__PURE__ */ jsx(
152
155
  "img",
@@ -161,6 +164,7 @@ const TestComp = (props) => {
161
164
  /* @__PURE__ */ jsxs("div", { className: styles.settingsSection, children: [
162
165
  /* @__PURE__ */ jsx("h4", { className: styles.sectionTitle, children: "Settings Panel Values" }),
163
166
  /* @__PURE__ */ jsx(ValueRow, { label: "isEnabled (boolean)", value: String(isEnabled) }),
167
+ /* @__PURE__ */ jsx(ValueRow, { label: "isError (boolean)", value: String(isError) }),
164
168
  /* @__PURE__ */ jsx(ValueRow, { label: "label (text)", value: label }),
165
169
  /* @__PURE__ */ jsx(ValueRow, { label: "count (number)", value: count }),
166
170
  /* @__PURE__ */ jsx(ValueRow, { label: "variant (textEnum)", value: variant }),
@@ -16,5 +16,9 @@ export declare const DesignStates: {
16
16
  readonly displayName: "Featured";
17
17
  readonly className: "test-comp-card--featured";
18
18
  };
19
+ readonly error: {
20
+ readonly displayName: "Error";
21
+ readonly className: "test-comp-card--error";
22
+ };
19
23
  };
20
24
  };
@@ -11,6 +11,10 @@ const DesignStates = {
11
11
  featured: {
12
12
  displayName: "Featured",
13
13
  className: "test-comp-card--featured"
14
+ },
15
+ error: {
16
+ displayName: "Error",
17
+ className: "test-comp-card--error"
14
18
  }
15
19
  }
16
20
  };
@@ -73,6 +77,13 @@ const manifest = {
73
77
  displayName: "Is Enabled",
74
78
  defaultValue: true
75
79
  },
80
+ // Functional state prop — drives error state styling + conditional element rendering.
81
+ // Exposed as booleanValue so Velo/context can bind to it.
82
+ isError: {
83
+ dataType: DATA.DATA_TYPE.booleanValue,
84
+ displayName: "Is Error",
85
+ defaultValue: false
86
+ },
76
87
  // Settings panel: text
77
88
  label: {
78
89
  dataType: DATA.DATA_TYPE.text,
@@ -427,6 +438,7 @@ const manifest = {
427
438
  data: {
428
439
  items: [
429
440
  "isEnabled",
441
+ "isError",
430
442
  "label",
431
443
  "count",
432
444
  "variant",
@@ -513,6 +525,24 @@ const manifest = {
513
525
  borderRadius: {}
514
526
  }
515
527
  }
528
+ },
529
+ // Inner element that only renders when isError is true.
530
+ // Allows separate design (font/color) for the error message text.
531
+ errorText: {
532
+ elementType: ELEMENTS.ELEMENT_TYPE.inlineElement,
533
+ inlineElement: {
534
+ selector: ".card-error-text",
535
+ displayName: "Error Message",
536
+ data: {
537
+ text: {
538
+ dataType: DATA.DATA_TYPE.text
539
+ }
540
+ },
541
+ cssProperties: {
542
+ font: {},
543
+ color: {}
544
+ }
545
+ }
516
546
  }
517
547
  },
518
548
  states: {
@@ -545,6 +575,15 @@ const manifest = {
545
575
  props: {
546
576
  variant: "primary"
547
577
  }
578
+ },
579
+ // Functional state: pins isError=true so the designer sees the error
580
+ // styling + the errorText element while designing this state.
581
+ error: {
582
+ displayName: DesignStates.testCompCard.error.displayName,
583
+ className: DesignStates.testCompCard.error.className,
584
+ props: {
585
+ isError: true
586
+ }
548
587
  }
549
588
  },
550
589
  presets: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/editor-react-components",
3
- "version": "1.2489.0",
3
+ "version": "1.2490.0",
4
4
  "description": "React components for the Wix Editor",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -197,5 +197,5 @@
197
197
  "registry": "https://registry.npmjs.org/",
198
198
  "access": "public"
199
199
  },
200
- "falconPackageHash": "f3112664140b717e04c796a7265fc4964d4d0101048e79cae4bfcb32"
200
+ "falconPackageHash": "098b76ad796b7d15b8fde7637c3dc352e868923dec13088927a6ad44"
201
201
  }