@gem-sdk/core 1.23.0-staging.339 → 1.23.0-staging.344

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.
@@ -163,15 +163,7 @@ const ComponentToolbarPreview = ({ ...props })=>{
163
163
  return false;
164
164
  };
165
165
  const toolbarName = ()=>{
166
- const tag = props.tag;
167
- if (tag === 'IconListV2') {
168
- return 'Item list';
169
- }
170
- if (tag === 'IconList') {
171
- return 'Advanced list';
172
- }
173
- const name = props.customLabel || props.label;
174
- return name;
166
+ return props.customLabel || props.label;
175
167
  };
176
168
  const onZoomOut = (e)=>{
177
169
  e.preventDefault();
@@ -424,6 +424,30 @@ const createBuilderPreviewProvider = (args, isThemeSectionEditor)=>zustand.creat
424
424
  }
425
425
  });
426
426
  }
427
+ },
428
+ updateItemAttribute: (id, value, attr)=>{
429
+ if (!attr || ![
430
+ 'label',
431
+ 'customLabel'
432
+ ].includes(attr)) return;
433
+ const state = get().state;
434
+ const item = state[id];
435
+ // Ignore section
436
+ if (item?.type === 'section') return;
437
+ if (item) {
438
+ const dateModified = Date.now();
439
+ item.dateModified = dateModified;
440
+ const updatedItem = {
441
+ ...item,
442
+ [attr]: value
443
+ };
444
+ set({
445
+ state: {
446
+ ...state,
447
+ [id]: updatedItem
448
+ }
449
+ });
450
+ }
427
451
  }
428
452
  }));
429
453
  const BuilderPreviewProvider = ({ children, state, isThemeSectionEditor, lazy, ...passProps })=>{
@@ -161,15 +161,7 @@ const ComponentToolbarPreview = ({ ...props })=>{
161
161
  return false;
162
162
  };
163
163
  const toolbarName = ()=>{
164
- const tag = props.tag;
165
- if (tag === 'IconListV2') {
166
- return 'Item list';
167
- }
168
- if (tag === 'IconList') {
169
- return 'Advanced list';
170
- }
171
- const name = props.customLabel || props.label;
172
- return name;
164
+ return props.customLabel || props.label;
173
165
  };
174
166
  const onZoomOut = (e)=>{
175
167
  e.preventDefault();
@@ -422,6 +422,30 @@ const createBuilderPreviewProvider = (args, isThemeSectionEditor)=>createStore((
422
422
  }
423
423
  });
424
424
  }
425
+ },
426
+ updateItemAttribute: (id, value, attr)=>{
427
+ if (!attr || ![
428
+ 'label',
429
+ 'customLabel'
430
+ ].includes(attr)) return;
431
+ const state = get().state;
432
+ const item = state[id];
433
+ // Ignore section
434
+ if (item?.type === 'section') return;
435
+ if (item) {
436
+ const dateModified = Date.now();
437
+ item.dateModified = dateModified;
438
+ const updatedItem = {
439
+ ...item,
440
+ [attr]: value
441
+ };
442
+ set({
443
+ state: {
444
+ ...state,
445
+ [id]: updatedItem
446
+ }
447
+ });
448
+ }
425
449
  }
426
450
  }));
427
451
  const BuilderPreviewProvider = ({ children, state, isThemeSectionEditor, lazy, ...passProps })=>{
@@ -1251,6 +1251,9 @@ type ControlUI = {
1251
1251
  tooltip?: {
1252
1252
  icon?: string;
1253
1253
  content?: string;
1254
+ iconClass?: string;
1255
+ containerClass?: string;
1256
+ enableTeleport?: boolean;
1254
1257
  };
1255
1258
  hideOnDevices?: {
1256
1259
  desktop?: boolean;
@@ -7701,6 +7704,7 @@ type BuilderPreviewContextProps = {
7701
7704
  initState: (data: BuilderEntityNested | BuilderEntityNested[]) => void;
7702
7705
  getParents: (id: string, limit?: number) => BuilderEntity[];
7703
7706
  updateItemName: (id: string, name: string) => void;
7707
+ updateItemAttribute: (id: string, value: string, attr: string) => void;
7704
7708
  };
7705
7709
  type BuilderPreviewProviderProps = Pick<BuilderPreviewContextProps, 'state'> & {
7706
7710
  children: React.ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "1.23.0-staging.339",
3
+ "version": "1.23.0-staging.344",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "devDependencies": {
27
27
  "@gem-sdk/adapter-shopify": "1.23.0-staging.26",
28
- "@gem-sdk/styles": "1.23.0-staging.321"
28
+ "@gem-sdk/styles": "1.23.0-staging.344"
29
29
  },
30
30
  "dependencies": {
31
31
  "react-error-boundary": "4.0.10",