@wix/editor-react-components 1.2569.0 → 1.2571.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.
@@ -349,6 +349,8 @@ const skeletonMedia = "skeletonMedia__E2zSh";
349
349
  const skeletonTitle = "skeletonTitle__k-L4a";
350
350
  const skeletonLine = "skeletonLine__ReOb6";
351
351
  const sentinel = "sentinel__niAmU";
352
+ const emptyState = "emptyState__cCB1M";
353
+ const emptyStateContent = "emptyStateContent__hVHdj";
352
354
  const loadMoreTrigger = "loadMoreTrigger__IllQ8";
353
355
  const liveAnnouncer = "liveAnnouncer__ZOBRL";
354
356
  const styles = {
@@ -363,6 +365,8 @@ const styles = {
363
365
  skeletonTitle,
364
366
  skeletonLine,
365
367
  sentinel,
368
+ emptyState,
369
+ emptyStateContent,
366
370
  loadMoreTrigger,
367
371
  liveAnnouncer
368
372
  };
@@ -466,6 +470,24 @@ const getItemKey = (item2, index) => {
466
470
  }
467
471
  return (item2 == null ? void 0 : item2._id) ?? (item2 == null ? void 0 : item2.id) ?? index;
468
472
  };
473
+ const RepeaterEmptyState = ({ content }) => /* @__PURE__ */ jsx(
474
+ "div",
475
+ {
476
+ role: "group",
477
+ "data-testid": TestIds.emptyState,
478
+ className: clsx(semanticClassNames.emptyState, styles.emptyState),
479
+ children: /* @__PURE__ */ jsx(
480
+ "div",
481
+ {
482
+ className: clsx(
483
+ semanticClassNames.emptyStateContent,
484
+ styles.emptyStateContent
485
+ ),
486
+ children: content
487
+ }
488
+ )
489
+ }
490
+ );
469
491
  const Repeater = (props) => {
470
492
  var _a;
471
493
  const {
@@ -477,12 +499,13 @@ const Repeater = (props) => {
477
499
  items = DEFAULT_ITEMS,
478
500
  isLoading: isLoadingProp,
479
501
  onLoadMore,
480
- emptyState
502
+ emptyStateContent: emptyStateContent2,
503
+ isEmpty: isEmptyProp
481
504
  } = props;
505
+ const showEmptyState = isEmptyProp === true || items.length === 0;
482
506
  const presetsWrapperProps = ((_a = props.wix) == null ? void 0 : _a.presetsWrapperProps) || {};
483
- const showsEmptyState = items.length === 0 && !!emptyState;
484
507
  const [sentinelRef, isIntersecting] = useLoadMoreObserver(
485
- !!onLoadMore && !showsEmptyState
508
+ !!onLoadMore && !showEmptyState
486
509
  );
487
510
  const { isLoading, load, hasReachedEnd } = useAsyncLoadMore(
488
511
  onLoadMore,
@@ -491,10 +514,7 @@ const Repeater = (props) => {
491
514
  isLoadingProp
492
515
  );
493
516
  const [ulRef, itemsPerRow] = useItemsPerRow(!!onLoadMore);
494
- if (!items.length && emptyState) {
495
- return null;
496
- }
497
- return /* @__PURE__ */ jsx("div", { className: presetWrapperStyles.presetWrapper, ...presetsWrapperProps, children: /* @__PURE__ */ jsxs(
517
+ return /* @__PURE__ */ jsx("div", { className: presetWrapperStyles.presetWrapper, ...presetsWrapperProps, children: /* @__PURE__ */ jsx(
498
518
  "div",
499
519
  {
500
520
  id,
@@ -505,7 +525,7 @@ const Repeater = (props) => {
505
525
  directionStyles.fallbackDirection,
506
526
  className
507
527
  ),
508
- children: [
528
+ children: showEmptyState ? /* @__PURE__ */ jsx(RepeaterEmptyState, { content: emptyStateContent2 }) : /* @__PURE__ */ jsxs(Fragment, { children: [
509
529
  /* @__PURE__ */ jsxs(
510
530
  "ul",
511
531
  {
@@ -570,7 +590,7 @@ const Repeater = (props) => {
570
590
  onLoadMore
571
591
  }
572
592
  )
573
- ]
593
+ ] })
574
594
  }
575
595
  ) });
576
596
  };
@@ -2,16 +2,27 @@ export declare const semanticClassNames: {
2
2
  readonly root: "repeater";
3
3
  readonly itemsContainer: "repeater-items-container";
4
4
  readonly item: "repeater-item";
5
+ readonly emptyState: "repeater-empty-state";
6
+ readonly emptyStateContent: "repeater-empty-state-content";
7
+ };
8
+ export declare const FunctionalStateKeys: {
9
+ readonly empty: "empty";
5
10
  };
6
11
  export declare const TestIds: {
7
12
  readonly skeleton: "repeater-skeleton";
8
13
  readonly sentinel: "repeater-sentinel";
9
14
  readonly emptyState: "repeater-empty-state";
10
- readonly emptyStateTitle: "repeater-empty-state-title";
11
- readonly emptyStateDescription: "repeater-empty-state-description";
15
+ readonly emptyStateBanner: "repeater-empty-state-banner";
12
16
  readonly loadMoreButton: "repeater-load-more-button";
13
17
  readonly liveAnnouncer: "repeater-live-announcer";
14
18
  };
19
+ export declare const EMPTY_STATE_NAMESPACE = "repeater";
20
+ export declare const translationsKeys: {
21
+ readonly editorEmptyStateMessage: "repeater_editor_empty_state_message";
22
+ };
23
+ export declare const defaultTranslations: {
24
+ readonly editorEmptyStateMessage: "No items found in your list";
25
+ };
15
26
  export declare const DEFAULT_ITEMS_PER_ROW = 4;
16
27
  export declare const COLUMN_COUNT_CSS_VAR = "--column-count";
17
28
  export declare const LOADING_ITEM_COUNT_CSS_VAR = "--loading-item-count";
@@ -61,10 +72,20 @@ export declare const DisplayNames: {
61
72
  readonly emptyState_description: "Description";
62
73
  readonly isLoading: "Loading State";
63
74
  readonly loadMore: "Load More";
75
+ readonly emptyStateContent: "Empty State";
64
76
  };
65
77
  readonly customActions: {
66
78
  readonly presets: "Layout";
67
79
  };
80
+ readonly states: {
81
+ readonly empty: "No Items";
82
+ };
83
+ readonly elements: {
84
+ readonly emptyState: "Empty State";
85
+ };
86
+ readonly cssProperties: {
87
+ readonly emptyStateBackground: "Background";
88
+ };
68
89
  readonly presets: {
69
90
  readonly cards: "Cards";
70
91
  readonly cards_off: "Cards Off";
@@ -127,11 +127,19 @@
127
127
  }
128
128
  }
129
129
  .emptyState__cCB1M {
130
- display: flex;
131
- flex-direction: column;
132
- align-items: center;
133
- justify-content: center;
134
- padding: 28px;
130
+ box-sizing: border-box;
131
+ }
132
+
133
+ .emptyStateBanner__W741Z {
134
+ box-sizing: border-box;
135
+ width: 100%;
136
+ padding: 16px;
137
+ text-align: center;
138
+ }
139
+
140
+ .emptyStateContent__hVHdj {
141
+ box-sizing: border-box;
142
+ width: 100%;
135
143
  }
136
144
 
137
145
  .loadMoreTrigger__IllQ8 {
@@ -1,6 +1,6 @@
1
- import { I as INTERACTIONS, L as LAYOUT, a as ACTIONS, C as CSS_PROPERTIES, b as DISPLAY_GROUPS, D as DATA, c as ContainerType, A as Archetype } from "../chunks/chunk-IO6HLVLV.js";
1
+ import { I as INTERACTIONS, L as LAYOUT, a as ACTIONS, C as CSS_PROPERTIES, b as DISPLAY_GROUPS, E as ELEMENTS, D as DATA, c as ContainerType, A as Archetype } from "../chunks/chunk-IO6HLVLV.js";
2
2
  import { g as getSelector } from "../chunks/manifest.js";
3
- import { p as presets, a as DisplayNames, D as DEFAULT_ITEMS_PER_ROW, s as semanticClassNames } from "../chunks/constants23.js";
3
+ import { p as presets, a as DisplayNames, D as DEFAULT_ITEMS_PER_ROW, F as FunctionalStateKeys, s as semanticClassNames } from "../chunks/constants23.js";
4
4
  import { F as FunctionRole } from "../chunks/types.impl.js";
5
5
  const manifest = {
6
6
  id: "3f08612b-67ee-4b00-9340-9323e660aa60",
@@ -108,6 +108,51 @@ const manifest = {
108
108
  }
109
109
  }
110
110
  }
111
+ },
112
+ emptyStateContent: {
113
+ dataType: DATA.DATA_TYPE.container,
114
+ displayName: DisplayNames.root.data.emptyStateContent,
115
+ [DATA.DATA_TYPE.container]: {
116
+ selector: getSelector(semanticClassNames.emptyStateContent),
117
+ containerType: ContainerType.simple,
118
+ simple: {
119
+ behaviors: {
120
+ selectable: true
121
+ },
122
+ layout: {
123
+ containerResizeDirection: LAYOUT.CONTENT_RESIZE_DIRECTION.vertical,
124
+ resizeDirection: LAYOUT.RESIZE_DIRECTION.vertical,
125
+ height: 240
126
+ }
127
+ }
128
+ }
129
+ }
130
+ },
131
+ states: {
132
+ empty: {
133
+ displayName: DisplayNames.root.states.empty,
134
+ props: { isEmpty: true }
135
+ }
136
+ },
137
+ elements: {
138
+ emptyState: {
139
+ elementType: ELEMENTS.ELEMENT_TYPE.inlineElement,
140
+ inlineElement: {
141
+ displayName: DisplayNames.root.elements.emptyState,
142
+ selector: getSelector(semanticClassNames.emptyState),
143
+ behaviors: {
144
+ selectable: true
145
+ },
146
+ visibleState: {
147
+ stateKey: FunctionalStateKeys.empty,
148
+ elementPath: ".root"
149
+ },
150
+ cssProperties: {
151
+ backgroundColor: {
152
+ displayName: DisplayNames.root.cssProperties.emptyStateBackground
153
+ }
154
+ }
155
+ }
111
156
  }
112
157
  },
113
158
  cssProperties: {
@@ -539,7 +584,17 @@ const manifest = {
539
584
  componentUrl: "./site/components/Repeater/component.tsx"
540
585
  },
541
586
  editor: {
542
- componentUrl: "./site/components/Repeater/component.preview.tsx"
587
+ componentUrl: "./site/components/Repeater/component.preview.tsx",
588
+ serviceDependencies: [
589
+ "@wix/viewer-service-environment",
590
+ "@wix/viewer-service-translations"
591
+ ],
592
+ dependencies: {
593
+ serviceDependencies: [
594
+ "@wix/viewer-service-environment",
595
+ "@wix/viewer-service-translations"
596
+ ]
597
+ }
543
598
  }
544
599
  },
545
600
  moduleConfiguration: {
@@ -1,8 +1,4 @@
1
1
  import { A11y, Direction } from '@wix/editor-react-types';
2
- export interface EmptyState {
3
- title?: string;
4
- description?: string;
5
- }
6
2
  export type RepeaterItem = string | {
7
3
  _id?: string;
8
4
  id?: string;
@@ -17,7 +13,8 @@ export interface RepeaterProps {
17
13
  items?: Array<RepeaterItem>;
18
14
  isLoading?: boolean;
19
15
  onLoadMore?: () => Promise<void>;
20
- emptyState?: EmptyState;
16
+ isEmpty?: boolean;
17
+ emptyStateContent?: React.ReactNode;
21
18
  wix?: {
22
19
  presetsWrapperProps?: Record<string, any>;
23
20
  };
@@ -1,11 +1,17 @@
1
1
  const semanticClassNames = {
2
2
  root: "repeater",
3
3
  itemsContainer: "repeater-items-container",
4
- item: "repeater-item"
4
+ item: "repeater-item",
5
+ emptyState: "repeater-empty-state",
6
+ emptyStateContent: "repeater-empty-state-content"
7
+ };
8
+ const FunctionalStateKeys = {
9
+ empty: "empty"
5
10
  };
6
11
  const TestIds = {
7
12
  skeleton: "repeater-skeleton",
8
13
  sentinel: "repeater-sentinel",
14
+ emptyState: "repeater-empty-state",
9
15
  loadMoreButton: "repeater-load-more-button",
10
16
  liveAnnouncer: "repeater-live-announcer"
11
17
  };
@@ -29,11 +35,21 @@ const DisplayNames = {
29
35
  emptyState_title: "Title",
30
36
  emptyState_description: "Description",
31
37
  isLoading: "Loading State",
32
- loadMore: "Load More"
38
+ loadMore: "Load More",
39
+ emptyStateContent: "Empty State"
33
40
  },
34
41
  customActions: {
35
42
  presets: "Layout"
36
43
  },
44
+ states: {
45
+ empty: "No Items"
46
+ },
47
+ elements: {
48
+ emptyState: "Empty State"
49
+ },
50
+ cssProperties: {
51
+ emptyStateBackground: "Background"
52
+ },
37
53
  presets: {
38
54
  cards: "Cards",
39
55
  cards_off: "Cards Off",
@@ -47,6 +63,7 @@ const DisplayNames = {
47
63
  export {
48
64
  COLUMN_COUNT_CSS_VAR as C,
49
65
  DEFAULT_ITEMS_PER_ROW as D,
66
+ FunctionalStateKeys as F,
50
67
  LOADING_ITEM_COUNT_CSS_VAR as L,
51
68
  TestIds as T,
52
69
  DisplayNames as a,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/editor-react-components",
3
- "version": "1.2569.0",
3
+ "version": "1.2571.0",
4
4
  "description": "React components for the Wix Editor",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -84,7 +84,7 @@
84
84
  "@wix/site-service-business-logger": "^1.0.0",
85
85
  "@wix/site-service-configuration": "^1.0.1",
86
86
  "@wix/site-service-rendering-context": "^1.0.1",
87
- "@wix/site-ui": "1.243.0",
87
+ "@wix/site-ui": "1.244.0",
88
88
  "@wix/video": "^1.106.0",
89
89
  "@wix/viewer-service-consent-policy": "^1.0.101",
90
90
  "@wix/web-bi-logger": "^2.1.29",
@@ -116,7 +116,7 @@
116
116
  "@vitejs/plugin-react": "^4.3.4",
117
117
  "@wix/a11y-audit-tool-plugin": "^0.397.0",
118
118
  "@wix/astro": "^2.67.0",
119
- "@wix/business-tools": "^1.0.229",
119
+ "@wix/business-tools": "^1.0.230",
120
120
  "@wix/cli": "^1.1.235",
121
121
  "@wix/cli-app": "^1.1.235",
122
122
  "@wix/component-protocol": "^1.248.0",
@@ -199,5 +199,5 @@
199
199
  "registry": "https://registry.npmjs.org/",
200
200
  "access": "public"
201
201
  },
202
- "falconPackageHash": "36c1b3a8b20c30140b46eba68b0bd385411ad920c753914a47c42dc9"
202
+ "falconPackageHash": "f65de354941b0c120fa7f0e24363b96bfb36428b44cb90dfaa8d1afa"
203
203
  }