@superblocksteam/library 2.0.6-next.4 → 2.0.6-next.40

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.
Files changed (88) hide show
  1. package/dist/{allPaths-BtYOw5Ru.js → allPaths-DrkZM5UN.js} +2 -2
  2. package/dist/{allPaths-BtYOw5Ru.js.map → allPaths-DrkZM5UN.js.map} +1 -1
  3. package/dist/{allPaths-CO-aWzss.js → allPaths-DtYnQ-yV.js} +2 -2
  4. package/dist/{allPaths-CO-aWzss.js.map → allPaths-DtYnQ-yV.js.map} +1 -1
  5. package/dist/{allPathsLoader-B3Ii4JGL.js → allPathsLoader-Bt-mJXJw.js} +3 -3
  6. package/dist/{allPathsLoader-KDCEbuYo.js.map → allPathsLoader-Bt-mJXJw.js.map} +1 -1
  7. package/dist/{allPathsLoader-KDCEbuYo.js → allPathsLoader-rDsLNp7q.js} +3 -3
  8. package/dist/{allPathsLoader-B3Ii4JGL.js.map → allPathsLoader-rDsLNp7q.js.map} +1 -1
  9. package/dist/{devtools-consolidated-B1B3uBW_.js → devtools-consolidated-DaYe-zkb.js} +2 -2
  10. package/dist/{devtools-consolidated-B1B3uBW_.js.map → devtools-consolidated-DaYe-zkb.js.map} +1 -1
  11. package/dist/{icons-NrNO8p_u.js → icons-lSlfQ50w.js} +10 -14
  12. package/dist/icons-lSlfQ50w.js.map +1 -0
  13. package/dist/{index-kjgG33Rg.js → index-D9O95zsr.js} +799 -1648
  14. package/dist/{index-kjgG33Rg.js.map → index-D9O95zsr.js.map} +1 -1
  15. package/dist/index.js +2 -2
  16. package/dist/{splitPathsBySizeLoader-Btq5cpt-.js → splitPathsBySizeLoader-DCl0XfAP.js} +2 -2
  17. package/dist/{splitPathsBySizeLoader-Btq5cpt-.js.map → splitPathsBySizeLoader-DCl0XfAP.js.map} +1 -1
  18. package/dist/{splitPathsBySizeLoader-VThmaq3t.js → splitPathsBySizeLoader-HDsWhSbE.js} +2 -2
  19. package/dist/{splitPathsBySizeLoader-VThmaq3t.js.map → splitPathsBySizeLoader-HDsWhSbE.js.map} +1 -1
  20. package/dist-types/edit-mode/dnd/utils.d.ts +4 -0
  21. package/dist-types/edit-mode/iframe-wrappers.d.ts +1 -0
  22. package/dist-types/edit-mode/source-update-api.d.ts +5 -0
  23. package/dist-types/edit-mode/superblocks-editor-bridge.d.ts +1 -0
  24. package/dist-types/lib/internal-details/is-sb-component.d.ts +5 -1
  25. package/dist-types/lib/internal-details/lib/evaluator/base-entity-manager.d.ts +6 -6
  26. package/dist-types/lib/internal-details/lib/evaluator/compute-engines.d.ts +2 -1
  27. package/dist-types/lib/internal-details/lib/evaluator/lazy-function.d.ts +2 -1
  28. package/dist-types/lib/internal-details/lib/features/component-registry.d.ts +5 -0
  29. package/dist-types/lib/internal-details/lib/types.d.ts +3 -0
  30. package/dist-types/lib/triggers/implementations/state/reset-state-var.d.ts +3 -3
  31. package/dist-types/lib/triggers/implementations/state/set-state-var.d.ts +3 -3
  32. package/dist-types/lib/triggers/implementations/timers/control-timer.d.ts +4 -3
  33. package/dist-types/lib/triggers/registry.d.ts +6 -6
  34. package/dist-types/lib/user-facing/build-manifest.d.ts +2 -0
  35. package/dist-types/lib/user-facing/components/button/index.d.ts +26 -26
  36. package/dist-types/lib/user-facing/components/button/props.d.ts +26 -26
  37. package/dist-types/lib/user-facing/components/checkbox/index.d.ts +31 -31
  38. package/dist-types/lib/user-facing/components/checkbox/props.d.ts +31 -31
  39. package/dist-types/lib/user-facing/components/column/index.d.ts +19 -19
  40. package/dist-types/lib/user-facing/components/column/props.d.ts +19 -19
  41. package/dist-types/lib/user-facing/components/container/index.d.ts +21 -21
  42. package/dist-types/lib/user-facing/components/container/props.d.ts +21 -21
  43. package/dist-types/lib/user-facing/components/custom/register-custom-component.d.ts +9 -9
  44. package/dist-types/lib/user-facing/components/date-picker/index.d.ts +48 -48
  45. package/dist-types/lib/user-facing/components/date-picker/props.d.ts +48 -48
  46. package/dist-types/lib/user-facing/components/dropdown/index.d.ts +54 -54
  47. package/dist-types/lib/user-facing/components/dropdown/props.d.ts +54 -54
  48. package/dist-types/lib/user-facing/components/grid/index.d.ts +20 -18
  49. package/dist-types/lib/user-facing/components/icon/index.d.ts +11 -13
  50. package/dist-types/lib/user-facing/components/icon/props.d.ts +11 -13
  51. package/dist-types/lib/user-facing/components/image/index.d.ts +20 -20
  52. package/dist-types/lib/user-facing/components/image/props.d.ts +23 -23
  53. package/dist-types/lib/user-facing/components/input/index.d.ts +63 -63
  54. package/dist-types/lib/user-facing/components/input/props.d.ts +63 -63
  55. package/dist-types/lib/user-facing/components/key-value/properties-props.d.ts +21 -21
  56. package/dist-types/lib/user-facing/components/key-value/props.d.ts +27 -27
  57. package/dist-types/lib/user-facing/components/modal/index.d.ts +27 -27
  58. package/dist-types/lib/user-facing/components/modal/props.d.ts +27 -27
  59. package/dist-types/lib/user-facing/components/page/index.d.ts +13 -13
  60. package/dist-types/lib/user-facing/components/page/props.d.ts +13 -13
  61. package/dist-types/lib/user-facing/components/section/index.d.ts +16 -16
  62. package/dist-types/lib/user-facing/components/section/props.d.ts +16 -16
  63. package/dist-types/lib/user-facing/components/slideout/props.d.ts +11 -11
  64. package/dist-types/lib/user-facing/components/stack/index.d.ts +38 -38
  65. package/dist-types/lib/user-facing/components/switch/index.d.ts +32 -32
  66. package/dist-types/lib/user-facing/components/switch/props.d.ts +32 -32
  67. package/dist-types/lib/user-facing/components/table/column-properties-panel.d.ts +262 -161
  68. package/dist-types/lib/user-facing/components/table/index.d.ts +306 -205
  69. package/dist-types/lib/user-facing/components/table/props.d.ts +306 -205
  70. package/dist-types/lib/user-facing/components/table/table-utilities.d.ts +4 -4
  71. package/dist-types/lib/user-facing/components/table/table-widget.d.ts +5 -1
  72. package/dist-types/lib/user-facing/components/table/types.d.ts +31 -28
  73. package/dist-types/lib/user-facing/components/text/index.d.ts +35 -35
  74. package/dist-types/lib/user-facing/components/text/props.d.ts +35 -35
  75. package/dist-types/lib/user-facing/entities/api/props.d.ts +10 -10
  76. package/dist-types/lib/user-facing/entities/timer/props.d.ts +12 -12
  77. package/dist-types/lib/user-facing/entities/variable/props.d.ts +7 -7
  78. package/dist-types/lib/user-facing/properties-panel/mixins/appearance-properties.d.ts +12 -12
  79. package/dist-types/lib/user-facing/properties-panel/mixins/appearance.d.ts +2 -2
  80. package/dist-types/lib/user-facing/properties-panel/mixins/form-inputs-properties.d.ts +10 -10
  81. package/dist-types/lib/user-facing/properties-panel/mixins/layout-section.d.ts +45 -45
  82. package/dist-types/lib/user-facing/properties-panel/mixins/loading.d.ts +1 -1
  83. package/dist-types/lib/user-facing/properties-panel/props-builder.d.ts +20 -9
  84. package/dist-types/lib/user-facing/sb-event-flow.d.ts +2 -2
  85. package/dist-types/lib/user-facing/sb-provider.d.ts +1 -2
  86. package/package.json +3 -3
  87. package/dist/icons-NrNO8p_u.js.map +0 -1
  88. package/dist-types/lib/user-facing/components/grid/utils.d.ts +0 -1
@@ -49,7 +49,7 @@ var __privateMethod = (obj, member, method4) => (__accessCheck(obj, member, "acc
49
49
  var _removeSourceIdElement_dec, _setSourceIdElement_dec, _setActiveRootInstanceId_dec, _init, _cancelApi_dec, _runApi_dec, _init2, _renameWidget_dec, _setWidgetProperty_dec, _setWidgetProperties_dec, _writeRuntimeProperties_dec, _deleteComponents_dec, _dropComponent_dec, _createComponent_dec, _batchUpdate_dec, _clearPendingTransactions_dec, _addPendingTransaction_dec, _executeOrAddToBatch_dec, _init3, _addOptimisticCreateWidget_dec, _processRootWidget_dec, _init4, _refreshPositionsAndGetDropConstraints_dec, _init5, _updateChildPositions_dec, _setWidgetPosition_dec, _setActiveTargetRect_dec, _setActiveDragRect_dec, _setDropTargetId_dec, _setInvalidDropTarget_dec, _setValidRootIds_dec, _cancelNewComponentDrag_dec, _startNewComponentDrag_dec, _setIsDragging_dec, _setWidgetFeatures_dec, _init6;
50
50
  import * as React from "react";
51
51
  import React__default, { isValidElement as isValidElement$1, version as version$2, createContext, useContext, useEffect, useRef, useLayoutEffect as useLayoutEffect$2, Component, useState, useMemo as useMemo$2, useCallback, forwardRef, useImperativeHandle, cloneElement as cloneElement$1, createElement, Suspense, Children, memo, useReducer, useSyncExternalStore, PureComponent, createRef } from "react";
52
- import { S as SvgClose, a as SvgSystemDanger, b as SvgSystemInfo, c as SvgSystemError, d as SvgSystemSuccess, e as SvgPlus, f as SvgHide, g as SvgChevronDown, h as SvgEmptyCheckbox, i as SvgMinus, j as SvgCheckmark, k as SvgCopy, l as SvgExternalLink, m as SvgPlay, n as SvgDownload, o as SvgTrash, p as SvgFilter, q as SvgFreeze, r as SvgSort, s as SvgEllipsis, t as SvgCrossXs, u as SvgClark } from "./icons-NrNO8p_u.js";
52
+ import { S as SvgClose, a as SvgSystemDanger, b as SvgSystemInfo, c as SvgSystemError, d as SvgSystemSuccess, e as SvgPlus, f as SvgHide, g as SvgChevronDown, h as SvgEmptyCheckbox, i as SvgMinus, j as SvgCheckmark, k as SvgPlay, l as SvgDownload, m as SvgTrash, n as SvgFilter, o as SvgFreeze, p as SvgSort, q as SvgEllipsis, r as SvgCrossXs, s as SvgClark } from "./icons-lSlfQ50w.js";
53
53
  import * as ReactDOM from "react-dom";
54
54
  import ReactDOM__default, { unstable_batchedUpdates, flushSync, createPortal } from "react-dom";
55
55
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
@@ -6001,11 +6001,11 @@ function PropertyInfo(value, type5 = "STATIC", extra) {
6001
6001
  const Property = {
6002
6002
  Static: (value) => PropertyInfo(value, "STATIC"),
6003
6003
  Binding: (value) => PropertyInfo(value, "BINDING"),
6004
- Template: (value) => PropertyInfo(value, "TEMPLATE"),
6004
+ Template: (value, args) => PropertyInfo(value, "TEMPLATE", { args }),
6005
6005
  Expression: (value) => PropertyInfo(value, "EXPRESSION"),
6006
6006
  Event: (value) => PropertyInfo(value, "EVENT"),
6007
6007
  Dimension: (value) => PropertyInfo(value, "DIMENSION"),
6008
- Computed: (value, args) => PropertyInfo(value, "COMPUTED", Array.isArray(args) && args.length > 0 ? { args } : {}),
6008
+ Computed: (value, args) => PropertyInfo(value, "COMPUTED", { args }),
6009
6009
  Any: (value, type5 = "STATIC") => PropertyInfo(value, type5)
6010
6010
  };
6011
6011
  function isPropertyInfo(value) {
@@ -6025,6 +6025,18 @@ function withBindingIdentifier(params, identifier2) {
6025
6025
  [BindingMetaSymbol]: identifier2
6026
6026
  };
6027
6027
  }
6028
+ function getSingleArgString(arg) {
6029
+ if (Array.isArray(arg)) {
6030
+ return `{ ${arg.map(getSingleArgString).join(", ")} }`;
6031
+ }
6032
+ return arg.name;
6033
+ }
6034
+ function getComputedArgsString(args) {
6035
+ if (!args || args.length === 0) {
6036
+ return "";
6037
+ }
6038
+ return args.map(getSingleArgString).join(", ");
6039
+ }
6028
6040
  const isDimension = (value) => {
6029
6041
  return typeof value === "object" && value !== null && "mode" in value && ["px", "fit", "fill", "%", "columns", "rows"].includes(value.mode) && (value.mode === "fit" || "value" in value);
6030
6042
  };
@@ -78418,7 +78430,7 @@ const ShowAlertTrigger = {
78418
78430
  const ResetStateVarTrigger = {
78419
78431
  type: TriggerStepType.RESET_STATE_VAR,
78420
78432
  async execute(context2, step) {
78421
- if (step.state === void 0) {
78433
+ if (step.variable === void 0) {
78422
78434
  return;
78423
78435
  }
78424
78436
  context2.rootStore.entityManager.runCode({
@@ -78426,22 +78438,22 @@ const ResetStateVarTrigger = {
78426
78438
  name: context2.name,
78427
78439
  func: () => {
78428
78440
  var _a2;
78429
- return (_a2 = step.state) == null ? void 0 : _a2.set(step.state.defaultValue);
78441
+ return (_a2 = step.variable) == null ? void 0 : _a2.set(step.variable.defaultValue);
78430
78442
  },
78431
78443
  args: []
78432
78444
  });
78433
78445
  },
78434
- create(stateVar) {
78446
+ create(variable) {
78435
78447
  return {
78436
78448
  type: TriggerStepType.RESET_STATE_VAR,
78437
- state: stateVar
78449
+ variable
78438
78450
  };
78439
78451
  }
78440
78452
  };
78441
78453
  const SetStateVarTrigger = {
78442
78454
  type: TriggerStepType.SET_STATE_VAR,
78443
78455
  async execute(context2, step) {
78444
- if (step.state === void 0) {
78456
+ if (step.variable === void 0) {
78445
78457
  return;
78446
78458
  }
78447
78459
  const value = context2.rootStore.entityManager.computeValue({
@@ -78455,15 +78467,15 @@ const SetStateVarTrigger = {
78455
78467
  func: (state, value2) => {
78456
78468
  var _a2;
78457
78469
  if (!state) return;
78458
- (_a2 = step.state) == null ? void 0 : _a2.set(value2);
78470
+ (_a2 = step.variable) == null ? void 0 : _a2.set(value2);
78459
78471
  },
78460
78472
  args: [value]
78461
78473
  });
78462
78474
  },
78463
- create(stateVar, value) {
78475
+ create(variable, value) {
78464
78476
  return {
78465
78477
  type: TriggerStepType.SET_STATE_VAR,
78466
- state: stateVar,
78478
+ variable,
78467
78479
  value
78468
78480
  };
78469
78481
  }
@@ -78471,12 +78483,14 @@ const SetStateVarTrigger = {
78471
78483
  const ControlTimerTrigger = {
78472
78484
  type: TriggerStepType.CONTROL_TIMER,
78473
78485
  async execute(_context, step) {
78474
- console.log("ControlTimerTrigger", step);
78486
+ if (step.timer) {
78487
+ step.timer[step.action]();
78488
+ }
78475
78489
  },
78476
- create(timerId, action2) {
78490
+ create(timer, action2) {
78477
78491
  return {
78478
78492
  type: TriggerStepType.CONTROL_TIMER,
78479
- timerId,
78493
+ timer,
78480
78494
  action: action2
78481
78495
  };
78482
78496
  }
@@ -82973,6 +82987,11 @@ class Prop {
82973
82987
  this.prop.nestedBindings = true;
82974
82988
  throw new Error("Nested bindings are not supported yet");
82975
82989
  }
82990
+ contextual(computedArgs) {
82991
+ this.prop.contextual = true;
82992
+ this.prop.computedArgs = computedArgs;
82993
+ return this;
82994
+ }
82976
82995
  validate(validateFn) {
82977
82996
  this.prop.validate = validateFn;
82978
82997
  return this;
@@ -83094,6 +83113,9 @@ class Prop {
83094
83113
  ...rest
83095
83114
  };
83096
83115
  }
83116
+ if (this.prop.computedArgs) {
83117
+ propertiesPanelDisplay.computedArgs = typeof this.prop.computedArgs === "function" ? this.prop.computedArgs(entity) : this.prop.computedArgs;
83118
+ }
83097
83119
  const propertiesPanelDisplayWithPanelConfig = {
83098
83120
  ...propertiesPanelDisplay,
83099
83121
  ...panelConfig && { panelConfig }
@@ -83504,7 +83526,7 @@ function registerStores(stores) {
83504
83526
  internalStores = { ...internalStores, ...stores };
83505
83527
  if (SUPPORTED_MODES.includes("production")) {
83506
83528
  if (Object.keys(internalStores).length === Object.keys(stores).length) {
83507
- import("./devtools-consolidated-B1B3uBW_.js").then(({ initializeCustomDevTools, setRegisteredStores }) => {
83529
+ import("./devtools-consolidated-DaYe-zkb.js").then(({ initializeCustomDevTools, setRegisteredStores }) => {
83508
83530
  setRegisteredStores(internalStores);
83509
83531
  initializeCustomDevTools();
83510
83532
  }).catch((error) => {
@@ -83517,7 +83539,7 @@ function registerStores(stores) {
83517
83539
  }
83518
83540
  }
83519
83541
  const DevToolsInternal = React__default.lazy(() => {
83520
- return import("./devtools-consolidated-B1B3uBW_.js").then((module2) => ({
83542
+ return import("./devtools-consolidated-DaYe-zkb.js").then((module2) => ({
83521
83543
  default: module2.CustomDevTools
83522
83544
  }));
83523
83545
  });
@@ -83610,9 +83632,32 @@ class EvalComputeEngine {
83610
83632
  })()
83611
83633
  }`
83612
83634
  ));
83635
+ __publicField(this, "statementFunctionNoSnapshot", new Function(
83636
+ ARGS_VAR_NAME,
83637
+ USER_JS_CODE_VAR_NAME,
83638
+ /*js*/
83639
+ `return (() => {
83640
+ "use strict";
83641
+ return eval("(" + ${USER_JS_CODE_VAR_NAME} + ")").call(this, ...${ARGS_VAR_NAME});
83642
+ })()`
83643
+ ));
83613
83644
  }
83614
- compute({ snapshot, entityName, func, args, path: path2 }) {
83645
+ compute({
83646
+ snapshot,
83647
+ entityName,
83648
+ func,
83649
+ args,
83650
+ path: path2,
83651
+ excludeState
83652
+ }) {
83615
83653
  try {
83654
+ if (excludeState) {
83655
+ return this.statementFunctionNoSnapshot.call(
83656
+ snapshot[entityName.value],
83657
+ args || [],
83658
+ func.toString()
83659
+ );
83660
+ }
83616
83661
  const globalScope = createGlobalObject({ snapshot });
83617
83662
  return this.statementFunction.call(
83618
83663
  snapshot[entityName.value],
@@ -83874,11 +83919,11 @@ class SbEventFlow {
83874
83919
  controlModal(modal, action2) {
83875
83920
  return this.addStep(EventRegistry.controlModal.create(modal, action2));
83876
83921
  }
83877
- static controlTimer(timerId, action2) {
83878
- return SbEventFlow.start().controlTimer(timerId, action2);
83922
+ static controlTimer(stateTimer, action2) {
83923
+ return SbEventFlow.start().controlTimer(stateTimer, action2);
83879
83924
  }
83880
- controlTimer(timerId, action2) {
83881
- return this.addStep(EventRegistry.controlTimer.create(timerId, action2));
83925
+ controlTimer(stateTimer, action2) {
83926
+ return this.addStep(EventRegistry.controlTimer.create(stateTimer, action2));
83882
83927
  }
83883
83928
  static runApis(apis, onSuccess, onError2) {
83884
83929
  return SbEventFlow.start().runApis(apis, onSuccess, onError2);
@@ -84016,7 +84061,7 @@ const isLazyFunction = (value) => {
84016
84061
  return typeof value === "function" && value[lazyFunctionSymbol];
84017
84062
  };
84018
84063
  const LazyFunction = (source2, args = []) => {
84019
- const argsObj = `{ ${args.join(", ")} }`;
84064
+ const argsObj = getComputedArgsString(args);
84020
84065
  const func = new Function(argsObj, source2);
84021
84066
  func[lazyFunctionSymbol] = true;
84022
84067
  return func;
@@ -84351,7 +84396,6 @@ class EntityManager {
84351
84396
  }
84352
84397
  addProperty(scopeId, name, prop, eov) {
84353
84398
  if (prop.split(".").includes(RECORD_PATH_IDENTIFIER)) {
84354
- console.log(`ALERT: Cannot add a property with a record path (${prop})`);
84355
84399
  return;
84356
84400
  }
84357
84401
  const entity = this.getScope(scopeId).getEntity(name);
@@ -84407,6 +84451,14 @@ class EntityManager {
84407
84451
  }
84408
84452
  return;
84409
84453
  }
84454
+ let finalProp = prop;
84455
+ if (isNested) {
84456
+ finalProp = this.componentRegistry.getPropertyWithRecordIdentifier(
84457
+ entityType,
84458
+ prop
84459
+ );
84460
+ }
84461
+ const managedProp = this.componentRegistry.getManagedProps(entityType).find((p) => p.path === finalProp);
84410
84462
  const getValue2 = computed(() => {
84411
84463
  let ret = null;
84412
84464
  try {
@@ -84415,18 +84467,30 @@ class EntityManager {
84415
84467
  ret = metaParent[finalSegment];
84416
84468
  } else {
84417
84469
  if (isComputed) {
84418
- ret = computeEngine.compute({
84419
- snapshot: snapshot(scopeId),
84420
- entityName: name,
84421
- func: eov.value,
84422
- path: prop
84423
- });
84470
+ if (managedProp == null ? void 0 : managedProp.contextual) {
84471
+ ret = function(context2) {
84472
+ return computeEngine.compute({
84473
+ snapshot: snapshot(scopeId),
84474
+ entityName: name,
84475
+ func: eov.value,
84476
+ path: prop,
84477
+ args: [context2],
84478
+ excludeState: true
84479
+ });
84480
+ };
84481
+ } else {
84482
+ ret = computeEngine.compute({
84483
+ snapshot: snapshot(scopeId),
84484
+ entityName: name,
84485
+ func: eov.value,
84486
+ path: prop
84487
+ });
84488
+ }
84424
84489
  } else {
84425
84490
  ret = eov.value;
84426
84491
  }
84427
84492
  }
84428
- const managedProp = this.componentRegistry.getManagedProps(entityType).find((p) => p.path === prop);
84429
- if (managedProp == null ? void 0 : managedProp.validate) {
84493
+ if ((managedProp == null ? void 0 : managedProp.validate) && typeof ret !== "function") {
84430
84494
  const currentState = snapshot(scopeId);
84431
84495
  const entity2 = currentState[name.value];
84432
84496
  const validationResult = managedProp.validate(ret, entity2);
@@ -84444,13 +84508,13 @@ class EntityManager {
84444
84508
  if (!validationResult.valid) {
84445
84509
  return void 0;
84446
84510
  }
84447
- return validationResult.result;
84511
+ ret = validationResult.result;
84448
84512
  }
84513
+ return ret;
84449
84514
  } catch (_e2) {
84450
84515
  console.log("Could not compute property value");
84451
84516
  return void 0;
84452
84517
  }
84453
- return ret;
84454
84518
  });
84455
84519
  const setValue = (value) => {
84456
84520
  const metaParent = getMetaParent();
@@ -84970,6 +85034,12 @@ const _SuperblocksEditorBridge = class _SuperblocksEditorBridge {
84970
85034
  }
84971
85035
  });
84972
85036
  }
85037
+ socketError(message2) {
85038
+ this.sendImmediate({
85039
+ type: "socket/error",
85040
+ payload: { message: message2 }
85041
+ });
85042
+ }
84973
85043
  // Private implementation details
84974
85044
  queueMessage(message2) {
84975
85045
  if (!this.connectedToParent) {
@@ -85448,7 +85518,7 @@ class ApiManager {
85448
85518
  scopeId,
85449
85519
  this.apiNameToDepCandidates[apiName] ?? []
85450
85520
  );
85451
- const orchestratorUrl = `${this.baseUrl}v2/execute`;
85521
+ const orchestratorUrl = new URL("v2/execute", this.baseUrl).href;
85452
85522
  const events2 = [];
85453
85523
  await ((_a2 = this.rootStore.editStore) == null ? void 0 : _a2.operationManager.ensureFilesSynced());
85454
85524
  const abortController = new AbortController();
@@ -85911,6 +85981,24 @@ class ComponentRegistry {
85911
85981
  getComponent(type5) {
85912
85982
  return this._typeRegistry.get(type5) ?? this._customComponentRegistry.get(type5);
85913
85983
  }
85984
+ /**
85985
+ * Get the property path with the record identifier if it exists. For example,
85986
+ * `columns.columnName.label` becomes `columns.*.label`, for record properties.
85987
+ */
85988
+ getPropertyWithRecordIdentifier(type5, path2) {
85989
+ const managedProps = this.getManagedProps(type5);
85990
+ const splitPath = path2.split(".");
85991
+ if (splitPath.length === 1) {
85992
+ return path2;
85993
+ }
85994
+ const [parentKey, _maybeTheRecordKey, ...rest] = splitPath;
85995
+ for (const prop of managedProps) {
85996
+ if (prop.path.startsWith(parentKey) && prop.path.includes(RECORD_PATH_IDENTIFIER) && rest.length > 0 && prop.path.endsWith(rest.join("."))) {
85997
+ return [parentKey, RECORD_PATH_IDENTIFIER, rest.join(".")].join(".");
85998
+ }
85999
+ }
86000
+ return path2;
86001
+ }
85914
86002
  }
85915
86003
  const DEFAULT_ANONYMOUS_SOURCE_ID = "SB--anon-src";
85916
86004
  const DEFAULT_ROOT_KEY = Symbol("DEFAULT_KEY");
@@ -86150,24 +86238,50 @@ class OperationAPI {
86150
86238
  });
86151
86239
  this.serverUrl = serverUrl;
86152
86240
  }
86241
+ /**
86242
+ * @throws {Error} if the websocket connection can't be initiated after 3 attempts
86243
+ */
86153
86244
  async connect(peerId, userId) {
86154
- const socket = await connectSocket(this.serverUrl, {
86155
- peerId,
86156
- userId,
86157
- onClose: () => {
86158
- var _a2;
86159
- console.log("App<>Dev box Socket closed, retrying...");
86160
- (_a2 = rootStore.editStore) == null ? void 0 : _a2.connectionManager.disconnect();
86161
- if (this.retryAttempts < 3) {
86162
- this.connect(peerId, userId);
86163
- } else {
86164
- this.socket = void 0;
86165
- }
86166
- this.retryAttempts++;
86245
+ try {
86246
+ const socket = await connectSocket(this.serverUrl, {
86247
+ peerId,
86248
+ userId,
86249
+ onClose: this.handleSocketClose(peerId, userId)
86250
+ });
86251
+ this.retryAttempts = 0;
86252
+ this.socket = socket;
86253
+ } catch {
86254
+ this.retryAttempts++;
86255
+ console.info(
86256
+ `App<>Dev box initial connection failed, retrying attempt ${this.retryAttempts}...`
86257
+ );
86258
+ await this.retryConnection(peerId, userId);
86259
+ }
86260
+ }
86261
+ // Happens after initial connection
86262
+ handleSocketClose(peerId, userId) {
86263
+ return async () => {
86264
+ var _a2;
86265
+ console.info(
86266
+ `App<>Dev box Socket closed, retrying attempt ${this.retryAttempts + 1}...`
86267
+ );
86268
+ (_a2 = rootStore.editStore) == null ? void 0 : _a2.connectionManager.disconnect();
86269
+ await this.retryConnection(peerId, userId);
86270
+ if (this.retryAttempts >= 3) {
86271
+ this.socket = void 0;
86167
86272
  }
86168
- });
86169
- this.retryAttempts = 0;
86170
- this.socket = socket;
86273
+ this.retryAttempts++;
86274
+ };
86275
+ }
86276
+ async retryConnection(peerId, userId) {
86277
+ if (this.retryAttempts < 3) {
86278
+ await this.connect(peerId, userId);
86279
+ } else {
86280
+ console.info(
86281
+ `App<>Dev box Socket closed, failed to reconnect after 3 attempts. Throwing error.`
86282
+ );
86283
+ throw new Error("Failed to reconnect after 3 attempts");
86284
+ }
86171
86285
  }
86172
86286
  }
86173
86287
  const sourceUpdateApi = new OperationAPI(
@@ -86305,12 +86419,13 @@ async function connectSocket(serverUrl, {
86305
86419
  }
86306
86420
  );
86307
86421
  const socket = createISocketClient(isocket);
86422
+ console.log("connected to socket");
86308
86423
  (_b2 = rootStore.editStore) == null ? void 0 : _b2.connectionManager.connect();
86309
86424
  return socket;
86310
86425
  } catch (error) {
86311
86426
  console.error("Error connecting to socket", error);
86312
86427
  (_c2 = rootStore.editStore) == null ? void 0 : _c2.connectionManager.disconnect();
86313
- return void 0;
86428
+ throw error;
86314
86429
  }
86315
86430
  }
86316
86431
  _executeOrAddToBatch_dec = [action], _addPendingTransaction_dec = [action], _clearPendingTransactions_dec = [action], _batchUpdate_dec = [action], _createComponent_dec = [action], _dropComponent_dec = [action], _deleteComponents_dec = [action], _writeRuntimeProperties_dec = [action], _setWidgetProperties_dec = [action], _setWidgetProperty_dec = [action], _renameWidget_dec = [action];
@@ -86905,7 +87020,10 @@ function getPropertyValue$1({
86905
87020
  }
86906
87021
  if (property.type === "COMPUTED" && typeof property.value === "string" && scopeId && name) {
86907
87022
  try {
86908
- return LazyFunction(getRuntimeComputedExpression(property.value));
87023
+ return LazyFunction(
87024
+ getRuntimeComputedExpression(property.value),
87025
+ property.args
87026
+ );
86909
87027
  } catch (e3) {
86910
87028
  console.error("Error generating computed value", e3);
86911
87029
  const entity = rootStore.entityManager.getEntity(scopeId, name);
@@ -86952,7 +87070,7 @@ function getPropertyValue$1({
86952
87070
  return property.value;
86953
87071
  }
86954
87072
  function getSbEventFlow(step, scopeId) {
86955
- var _a2, _b2, _c2, _d2, _e2, _f2;
87073
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
86956
87074
  if (!isValidStepDef(step)) {
86957
87075
  return void 0;
86958
87076
  }
@@ -87025,27 +87143,33 @@ function getSbEventFlow(step, scopeId) {
87025
87143
  return SbEventFlow.controlModal(modalEntity, step.direction);
87026
87144
  }
87027
87145
  case "controlTimer": {
87028
- const timerEntity = getEntity(step.name);
87146
+ const timerStep = step;
87147
+ if (!((_a2 = timerStep.timer) == null ? void 0 : _a2.name)) {
87148
+ return void 0;
87149
+ }
87150
+ const timerEntity = getEntity(timerStep.timer.name);
87029
87151
  if (!timerEntity) return void 0;
87030
- return SbEventFlow.controlTimer(step.name, step.command);
87152
+ return SbEventFlow.controlTimer(timerEntity, step.command ?? "start");
87031
87153
  }
87032
87154
  case "setStateVar": {
87033
- const stateEntity = getEntity((_a2 = step.state) == null ? void 0 : _a2.name);
87155
+ const variableStep = step;
87156
+ const stateEntity = getEntity((_b2 = variableStep.variable) == null ? void 0 : _b2.name);
87034
87157
  if (!stateEntity) return void 0;
87035
- const value = isPropertyInfo(step.value) ? getPropertyValue$1({
87036
- property: step.value,
87158
+ const value = isPropertyInfo(variableStep.value) ? getPropertyValue$1({
87159
+ property: variableStep.value,
87037
87160
  scopeId,
87038
- name: getName((_b2 = step.state) == null ? void 0 : _b2.name)
87161
+ name: getName((_c2 = variableStep.variable) == null ? void 0 : _c2.name)
87039
87162
  }) : step.value;
87040
87163
  return SbEventFlow.setStateVar(stateEntity, value);
87041
87164
  }
87042
87165
  case "resetStateVar": {
87043
- const resetStateEntity = getEntity((_c2 = step.state) == null ? void 0 : _c2.name);
87166
+ const variableStep = step;
87167
+ const resetStateEntity = getEntity((_d2 = variableStep.variable) == null ? void 0 : _d2.name);
87044
87168
  if (!resetStateEntity) return void 0;
87045
87169
  return SbEventFlow.resetStateVar(resetStateEntity);
87046
87170
  }
87047
87171
  case "resetComponent": {
87048
- const resetWidgetEntity = getEntity((_d2 = step.widget) == null ? void 0 : _d2.name);
87172
+ const resetWidgetEntity = getEntity((_e2 = step.widget) == null ? void 0 : _e2.name);
87049
87173
  if (!resetWidgetEntity) return void 0;
87050
87174
  return SbEventFlow.resetComponent(
87051
87175
  step.widget,
@@ -87054,7 +87178,7 @@ function getSbEventFlow(step, scopeId) {
87054
87178
  );
87055
87179
  }
87056
87180
  case "setComponentProperty": {
87057
- const setWidgetEntity = getEntity((_e2 = step.widget) == null ? void 0 : _e2.name);
87181
+ const setWidgetEntity = getEntity((_f2 = step.widget) == null ? void 0 : _f2.name);
87058
87182
  if (!setWidgetEntity) return void 0;
87059
87183
  return SbEventFlow.setComponentProperty(
87060
87184
  step.widget,
@@ -87072,7 +87196,7 @@ function getSbEventFlow(step, scopeId) {
87072
87196
  case "setProfile":
87073
87197
  return SbEventFlow.setProfile(step.profileId, step.profileAction);
87074
87198
  case "triggerEvent":
87075
- return SbEventFlow.triggerEvent((_f2 = step.event) == null ? void 0 : _f2.name, step.eventPayload);
87199
+ return SbEventFlow.triggerEvent((_g2 = step.event) == null ? void 0 : _g2.name, step.eventPayload);
87076
87200
  default:
87077
87201
  console.warn("Unhandled runtime step type", step.type);
87078
87202
  return void 0;
@@ -87394,8 +87518,9 @@ class RuntimeEntitiesManager {
87394
87518
  const { width, height, marginLeft, marginTop } = pendingResize;
87395
87519
  merged.props = {
87396
87520
  ...merged.props || {},
87397
- ...width && { width },
87398
- ...height && { height },
87521
+ ...width && merged.type !== "SbIcon" && { width },
87522
+ ...height && merged.type !== "SbIcon" && { height },
87523
+ ...width && merged.type === "SbIcon" && { size: width },
87399
87524
  ...marginLeft && { marginLeft },
87400
87525
  ...marginTop && { marginTop }
87401
87526
  };
@@ -87773,22 +87898,27 @@ function shouldWrapInSectionAndColumn(type5, parentType) {
87773
87898
  return parentType === "SbPage" && type5 !== "SbSection" || parentType === "SbSection" && type5 !== "SbColumn";
87774
87899
  }
87775
87900
  const filterSafeStackDimensionProperties = (existingProps) => {
87776
- const { width, height } = existingProps;
87901
+ const { width, height, size: size2 } = existingProps;
87777
87902
  let safeHeight;
87778
87903
  let safeWidth;
87904
+ let safeSize;
87779
87905
  if ((height == null ? void 0 : height.mode) === "px" || (height == null ? void 0 : height.mode) === "fit" || (height == null ? void 0 : height.mode) === "fill") {
87780
87906
  safeHeight = Property.Dimension(height);
87781
87907
  }
87782
87908
  if ((width == null ? void 0 : width.mode) === "px" || (width == null ? void 0 : width.mode) === "fit" || (width == null ? void 0 : width.mode) === "fill") {
87783
87909
  safeWidth = Property.Dimension(width);
87784
87910
  }
87911
+ if ((size2 == null ? void 0 : size2.mode) === "px") {
87912
+ safeSize = Property.Dimension(size2);
87913
+ }
87785
87914
  return {
87786
87915
  width: safeWidth,
87787
- height: safeHeight
87916
+ height: safeHeight,
87917
+ size: safeSize
87788
87918
  };
87789
87919
  };
87790
87920
  const filterSafeGridDimensionProperties = (existingProps) => {
87791
- const { width, height } = existingProps;
87921
+ const { width, height, size: size2 } = existingProps;
87792
87922
  const safeDimensions = {};
87793
87923
  if ((height == null ? void 0 : height.mode) === "rows" || (height == null ? void 0 : height.mode) === "fit") {
87794
87924
  safeDimensions.height = Property.Dimension(height);
@@ -87796,6 +87926,9 @@ const filterSafeGridDimensionProperties = (existingProps) => {
87796
87926
  if ((width == null ? void 0 : width.mode) === "columns") {
87797
87927
  safeDimensions.width = Property.Dimension(width);
87798
87928
  }
87929
+ if ((size2 == null ? void 0 : size2.mode) === "columns") {
87930
+ safeDimensions.size = Property.Dimension(size2);
87931
+ }
87799
87932
  return safeDimensions;
87800
87933
  };
87801
87934
  const defaultSizeForComponent = (componentType, isFreeform, draggedDimensions) => {
@@ -88755,7 +88888,7 @@ class ResizingManager {
88755
88888
  return this._activeResizes.get(selectedSourceId);
88756
88889
  }
88757
88890
  startResizing(dragStartX, dragStartY, instanceId, position2) {
88758
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i, _j, _k, _l2, _m2, _n2, _o2;
88891
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i, _j, _k, _l2, _m2, _n2, _o2, _p2, _q;
88759
88892
  const widget = (_a2 = this.root.editStore) == null ? void 0 : _a2.runtimeEntitiesManager.getEditorWidgetMeta(
88760
88893
  instanceId
88761
88894
  );
@@ -88794,10 +88927,10 @@ class ResizingManager {
88794
88927
  dragStartX,
88795
88928
  dragStartY,
88796
88929
  start: {
88797
- width: ((_i = (_h2 = widget == null ? void 0 : widget.props) == null ? void 0 : _h2.width) == null ? void 0 : _i.value) ?? 0,
88798
- height: ((_k = (_j = widget == null ? void 0 : widget.props) == null ? void 0 : _j.height) == null ? void 0 : _k.value) ?? 0,
88799
- marginLeft: ((_m2 = (_l2 = widget == null ? void 0 : widget.props) == null ? void 0 : _l2.marginLeft) == null ? void 0 : _m2.value) ?? 0,
88800
- marginTop: ((_o2 = (_n2 = widget == null ? void 0 : widget.props) == null ? void 0 : _n2.marginTop) == null ? void 0 : _o2.value) ?? 0
88930
+ width: ((_i = (_h2 = widget == null ? void 0 : widget.props) == null ? void 0 : _h2.width) == null ? void 0 : _i.value) ?? ((_k = (_j = widget == null ? void 0 : widget.props) == null ? void 0 : _j.size) == null ? void 0 : _k.value) ?? 0,
88931
+ height: ((_m2 = (_l2 = widget == null ? void 0 : widget.props) == null ? void 0 : _l2.height) == null ? void 0 : _m2.value) ?? 0,
88932
+ marginLeft: ((_o2 = (_n2 = widget == null ? void 0 : widget.props) == null ? void 0 : _n2.marginLeft) == null ? void 0 : _o2.value) ?? 0,
88933
+ marginTop: ((_q = (_p2 = widget == null ? void 0 : widget.props) == null ? void 0 : _p2.marginTop) == null ? void 0 : _q.value) ?? 0
88801
88934
  },
88802
88935
  resizedPosition: position2,
88803
88936
  widthToUpdate: null,
@@ -88935,21 +89068,34 @@ class ResizingManager {
88935
89068
  });
88936
89069
  }
88937
89070
  resizeWidget(currentX, currentY, instanceId, canResizeWidth2, canResizeHeight2) {
88938
- var _a2, _b2, _c2, _d2, _e2, _f2;
89071
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i, _j, _k;
88939
89072
  const sourceId = (_a2 = this.root.editStore) == null ? void 0 : _a2.runtimeEntitiesManager.getEditorWidgetSourceId(
88940
89073
  instanceId
88941
89074
  );
89075
+ const type5 = (_b2 = this.root.editStore) == null ? void 0 : _b2.runtimeEntitiesManager.getEditorWidgetType(
89076
+ instanceId
89077
+ );
88942
89078
  const resizeState = sourceId && this._activeResizes.get(sourceId);
88943
89079
  if (!resizeState) {
88944
89080
  return;
88945
89081
  }
88946
- const widget = (_b2 = this.root.editStore) == null ? void 0 : _b2.runtimeEntitiesManager.getEditorWidgetMeta(
89082
+ const widget = (_c2 = this.root.editStore) == null ? void 0 : _c2.runtimeEntitiesManager.getEditorWidgetMeta(
88947
89083
  instanceId
88948
89084
  );
88949
- const widthMode = (_d2 = (_c2 = widget == null ? void 0 : widget.props) == null ? void 0 : _c2.width) == null ? void 0 : _d2.mode;
88950
- const heightMode = (_f2 = (_e2 = widget == null ? void 0 : widget.props) == null ? void 0 : _e2.height) == null ? void 0 : _f2.mode;
89085
+ let widthMode = (_e2 = (_d2 = widget == null ? void 0 : widget.props) == null ? void 0 : _d2.width) == null ? void 0 : _e2.mode;
89086
+ const heightMode = (_g2 = (_f2 = widget == null ? void 0 : widget.props) == null ? void 0 : _f2.height) == null ? void 0 : _g2.mode;
88951
89087
  const deltaX = currentX - resizeState.dragStartX;
88952
89088
  const deltaY = currentY - resizeState.dragStartY;
89089
+ if (type5 === "SbIcon") {
89090
+ widthMode = (_i = (_h2 = widget == null ? void 0 : widget.props) == null ? void 0 : _h2.size) == null ? void 0 : _i.mode;
89091
+ if (!widthMode) {
89092
+ const parentInstanceId = widget == null ? void 0 : widget.parentInstanceId;
89093
+ const parentWidget = parentInstanceId && ((_j = this.root.editStore) == null ? void 0 : _j.runtimeEntitiesManager.getEditorWidgetMeta(
89094
+ parentInstanceId
89095
+ ));
89096
+ widthMode = ((_k = parentWidget == null ? void 0 : parentWidget.props) == null ? void 0 : _k.layout) === "freeform" ? "columns" : "px";
89097
+ }
89098
+ }
88953
89099
  const updateWidth = this.handleResizeDimension({
88954
89100
  resizeState,
88955
89101
  dimension: "width",
@@ -89004,22 +89150,28 @@ class ResizingManager {
89004
89150
  );
89005
89151
  }
89006
89152
  applyResize(instanceId) {
89007
- var _a2, _b2;
89153
+ var _a2, _b2, _c2;
89008
89154
  const sourceId = (_a2 = this.root.editStore) == null ? void 0 : _a2.runtimeEntitiesManager.getEditorWidgetSourceId(
89009
89155
  instanceId
89010
89156
  );
89157
+ const type5 = (_b2 = this.root.editStore) == null ? void 0 : _b2.runtimeEntitiesManager.getEditorWidgetType(
89158
+ instanceId
89159
+ );
89011
89160
  const resizeState = sourceId && this._activeResizes.get(sourceId);
89012
89161
  if (!resizeState) {
89013
89162
  return;
89014
89163
  }
89015
89164
  resizeState.isApplyingResize = true;
89016
89165
  const properties2 = {
89017
- ...resizeState.heightToUpdate && {
89166
+ ...resizeState.heightToUpdate && type5 !== "SbIcon" && {
89018
89167
  height: Property.Dimension(resizeState.heightToUpdate)
89019
89168
  },
89020
- ...resizeState.widthToUpdate && {
89169
+ ...resizeState.widthToUpdate && type5 !== "SbIcon" && {
89021
89170
  width: Property.Dimension(resizeState.widthToUpdate)
89022
89171
  },
89172
+ ...resizeState.widthToUpdate && type5 === "SbIcon" && {
89173
+ size: Property.Dimension(resizeState.widthToUpdate)
89174
+ },
89023
89175
  ...resizeState.marginLeftToUpdate && {
89024
89176
  marginLeft: Property.Dimension(resizeState.marginLeftToUpdate)
89025
89177
  },
@@ -89028,7 +89180,7 @@ class ResizingManager {
89028
89180
  }
89029
89181
  };
89030
89182
  if (Object.keys(properties2).length > 0) {
89031
- (_b2 = this.root.editStore) == null ? void 0 : _b2.operationManager.setWidgetProperties({
89183
+ (_c2 = this.root.editStore) == null ? void 0 : _c2.operationManager.setWidgetProperties({
89032
89184
  sourceId: resizeState.sourceId,
89033
89185
  properties: properties2,
89034
89186
  callback: () => {
@@ -91039,14 +91191,14 @@ function getLoaderFn$1(options) {
91039
91191
  if (!(loader === "all")) return [3, 3];
91040
91192
  return [4, import(
91041
91193
  /* webpackChunkName: "blueprint-icons-all-paths-loader" */
91042
- "./allPathsLoader-KDCEbuYo.js"
91194
+ "./allPathsLoader-Bt-mJXJw.js"
91043
91195
  )];
91044
91196
  case 2:
91045
91197
  return [2, _b2.sent().allPathsLoader];
91046
91198
  case 3:
91047
91199
  return [4, import(
91048
91200
  /* webpackChunkName: "blueprint-icons-split-paths-by-size-loader" */
91049
- "./splitPathsBySizeLoader-VThmaq3t.js"
91201
+ "./splitPathsBySizeLoader-HDsWhSbE.js"
91050
91202
  )];
91051
91203
  case 4:
91052
91204
  return [2, _b2.sent().splitPathsBySizeLoader];
@@ -111681,14 +111833,18 @@ const ReactiveComponent = observer(function Component2({
111681
111833
  const reactiveProps = useShallowMobxObserver(safeProps);
111682
111834
  const stylePropWithSize = useStyleWithSize(reactiveProps);
111683
111835
  const styleProp = useMemo$2(() => {
111836
+ const styleWithOverflow = {
111837
+ overflow: "auto",
111838
+ ...stylePropWithSize
111839
+ };
111684
111840
  if (reactiveProps.isVisible === false) {
111685
111841
  const existingOpacity = lodashExports.isNumber(stylePropWithSize.opacity) ? stylePropWithSize.opacity : 1;
111686
111842
  return {
111687
- ...stylePropWithSize,
111843
+ ...styleWithOverflow,
111688
111844
  opacity: existingOpacity * INVISIBLE_OPACITY
111689
111845
  };
111690
111846
  }
111691
- return stylePropWithSize;
111847
+ return styleWithOverflow;
111692
111848
  }, [reactiveProps.isVisible, stylePropWithSize]);
111693
111849
  const { setStyle, getFallbackStyle } = useComponentSuspenseStyle();
111694
111850
  useEffect(() => {
@@ -111848,28 +112004,52 @@ const size$2 = ({
111848
112004
  controlType: "WIDTH_DROPDOWN",
111849
112005
  defaultValue: defaults2 == null ? void 0 : defaults2.minWidth,
111850
112006
  defaultOnAdd: defaultsOnAdd == null ? void 0 : defaultsOnAdd.minWidth,
111851
- isVisible: showMinWidth
112007
+ isVisible: function(s3) {
112008
+ var _a2;
112009
+ const hideWidth = ((_a2 = this == null ? void 0 : this.width) == null ? void 0 : _a2.mode) === "px";
112010
+ return Boolean(
112011
+ (showMinWidth ? showMinWidth == null ? void 0 : showMinWidth.call(this, s3) : true) && !hideWidth
112012
+ );
112013
+ }
111852
112014
  });
111853
112015
  const maxWidthProperty = getSizeProp({
111854
112016
  label: "Max width",
111855
112017
  controlType: "WIDTH_DROPDOWN",
111856
112018
  defaultValue: defaults2 == null ? void 0 : defaults2.maxWidth,
111857
112019
  defaultOnAdd: defaultsOnAdd == null ? void 0 : defaultsOnAdd.maxWidth,
111858
- isVisible: showMaxWidth
112020
+ isVisible: function(s3) {
112021
+ var _a2;
112022
+ const hideWidth = ((_a2 = this == null ? void 0 : this.width) == null ? void 0 : _a2.mode) === "px";
112023
+ return Boolean(
112024
+ (showMaxWidth ? showMaxWidth == null ? void 0 : showMaxWidth.call(this, s3) : true) && !hideWidth
112025
+ );
112026
+ }
111859
112027
  });
111860
112028
  const minHeightProperty = getSizeProp({
111861
112029
  label: "Min height",
111862
112030
  controlType: "HEIGHT_DROPDOWN",
111863
112031
  defaultValue: defaults2 == null ? void 0 : defaults2.minHeight,
111864
112032
  defaultOnAdd: defaultsOnAdd == null ? void 0 : defaultsOnAdd.minHeight,
111865
- isVisible: showMinHeight
112033
+ isVisible: function(s3) {
112034
+ var _a2;
112035
+ const hideHeight = ((_a2 = this == null ? void 0 : this.height) == null ? void 0 : _a2.mode) === "px";
112036
+ return Boolean(
112037
+ (showMinHeight ? showMinHeight == null ? void 0 : showMinHeight.call(this, s3) : true) && !hideHeight
112038
+ );
112039
+ }
111866
112040
  });
111867
112041
  const maxHeightProperty = getSizeProp({
111868
112042
  label: "Max height",
111869
112043
  controlType: "HEIGHT_DROPDOWN",
111870
112044
  defaultValue: defaults2 == null ? void 0 : defaults2.maxHeight,
111871
112045
  defaultOnAdd: defaultsOnAdd == null ? void 0 : defaultsOnAdd.maxHeight,
111872
- isVisible: showMaxHeight
112046
+ isVisible: function(s3) {
112047
+ var _a2;
112048
+ const hideHeight = ((_a2 = this == null ? void 0 : this.height) == null ? void 0 : _a2.mode) === "px";
112049
+ return Boolean(
112050
+ (showMaxHeight ? showMaxHeight == null ? void 0 : showMaxHeight.call(this, s3) : true) && !hideHeight
112051
+ );
112052
+ }
111873
112053
  });
111874
112054
  let heightProperty = Prop.dimension().readAndWrite().propertiesPanel({
111875
112055
  label: "Height",
@@ -112111,7 +112291,8 @@ const containerLayout = (sizeProps) => Prop.union({
112111
112291
  sourceId: child.sourceId,
112112
112292
  element: (_b3 = (_a3 = editStore2.interactionLayerManager.getSourceIdElements(
112113
112293
  child.sourceId
112114
- )) == null ? void 0 : _a3[0]) == null ? void 0 : _b3.element
112294
+ )) == null ? void 0 : _a3[0]) == null ? void 0 : _b3.element,
112295
+ type: child.type
112115
112296
  };
112116
112297
  }).filter(({ element }) => !!element)) ?? [];
112117
112298
  if ("layout" in updates && updates.layout.value === "freeform") {
@@ -112123,7 +112304,7 @@ const containerLayout = (sizeProps) => Prop.union({
112123
112304
  return baseUpdate;
112124
112305
  }
112125
112306
  const updatesBySourceId = {};
112126
- elements.forEach(({ sourceId: sourceId2, element, currentProps }) => {
112307
+ elements.forEach(({ sourceId: sourceId2, element, currentProps, type: type5 }) => {
112127
112308
  const elementRect = element.getBoundingClientRect();
112128
112309
  const gridPosition = editStore2.ui.dnd.grid.getGridPositionInfo({
112129
112310
  positionRect: elementRect,
@@ -112136,8 +112317,14 @@ const containerLayout = (sizeProps) => Prop.union({
112136
112317
  props: {
112137
112318
  marginTop: Property.Dimension(Dim.row(gridPosition.yGU)),
112138
112319
  marginLeft: Property.Dimension(Dim.col(gridPosition.xGU)),
112139
- width: Property.Dimension(Dim.col(gridPosition.widthGU)),
112140
- height: isHeightFit ? Property.Dimension(Dim.fit()) : Property.Dimension(Dim.row(gridPosition.heightGU))
112320
+ ...type5 === "SbIcon" ? {
112321
+ size: Property.Dimension(Dim.col(gridPosition.widthGU))
112322
+ } : {
112323
+ width: Property.Dimension(
112324
+ Dim.col(gridPosition.widthGU)
112325
+ ),
112326
+ height: isHeightFit ? Property.Dimension(Dim.fit()) : Property.Dimension(Dim.row(gridPosition.heightGU))
112327
+ }
112141
112328
  },
112142
112329
  meta: {}
112143
112330
  };
@@ -112154,7 +112341,7 @@ const containerLayout = (sizeProps) => Prop.union({
112154
112341
  };
112155
112342
  } else if (previousProps.layout === "freeform" && (newProps.layout === "vertical" || newProps.layout === "horizontal")) {
112156
112343
  const updatesBySourceId = {};
112157
- elements.forEach(({ sourceId: sourceId2, element, currentProps }) => {
112344
+ elements.forEach(({ sourceId: sourceId2, element, currentProps, type: type5 }) => {
112158
112345
  const elementRect = element.getBoundingClientRect();
112159
112346
  const isHeightFit = isDimension(currentProps == null ? void 0 : currentProps.height) && currentProps.height.mode === "fit";
112160
112347
  updatesBySourceId[sourceId2] = {
@@ -112162,8 +112349,12 @@ const containerLayout = (sizeProps) => Prop.union({
112162
112349
  marginTop: Property.Static(""),
112163
112350
  marginLeft: Property.Static(""),
112164
112351
  constraintTop: Property.Static(""),
112165
- width: Property.Dimension(Dim.px(elementRect.width)),
112166
- height: isHeightFit ? Property.Dimension(Dim.fit()) : Property.Dimension(Dim.px(elementRect.height))
112352
+ ...type5 === "SbIcon" ? {
112353
+ size: Property.Dimension(Dim.px(elementRect.width))
112354
+ } : {
112355
+ width: Property.Dimension(Dim.px(elementRect.width)),
112356
+ height: isHeightFit ? Property.Dimension(Dim.fit()) : Property.Dimension(Dim.px(elementRect.height))
112357
+ }
112167
112358
  },
112168
112359
  meta: {}
112169
112360
  };
@@ -116894,6 +117085,7 @@ const handleGridDropWithinCanvas = (params) => {
116894
117085
  const editStore2 = getEditStore();
116895
117086
  const dropSourceId = editStore2.runtimeEntitiesManager.getEditorWidgetSourceId(dropTargetId);
116896
117087
  const draggedSourceId = editStore2.runtimeEntitiesManager.getEditorWidgetSourceId(draggedId);
117088
+ const draggedType = editStore2.runtimeEntitiesManager.getEditorWidgetType(draggedId);
116897
117089
  if (!dropSourceId || !draggedSourceId) {
116898
117090
  throw new Error(`Missing IDs: dragging ${draggedId} to ${dropTargetId}`);
116899
117091
  }
@@ -116913,15 +117105,16 @@ const handleGridDropWithinCanvas = (params) => {
116913
117105
  const droppedWidgetProps = (_a2 = editStore2.runtimeEntitiesManager.getEditorWidgetMeta(draggedId)) == null ? void 0 : _a2.props;
116914
117106
  const safeExistingDimensions = filterSafeGridDimensionProperties({
116915
117107
  width: droppedWidgetProps == null ? void 0 : droppedWidgetProps.width,
116916
- height: droppedWidgetProps == null ? void 0 : droppedWidgetProps.height
117108
+ height: droppedWidgetProps == null ? void 0 : droppedWidgetProps.height,
117109
+ size: droppedWidgetProps == null ? void 0 : droppedWidgetProps.size
116917
117110
  });
116918
117111
  const width = safeExistingDimensions.width ?? Property.Dimension(Dim.col(droppedWidgetConstraints.width));
116919
117112
  const height = safeExistingDimensions.height ?? Property.Dimension(Dim.rows(droppedWidgetConstraints.height));
117113
+ const size2 = safeExistingDimensions.size ?? Property.Dimension(Dim.col(droppedWidgetConstraints.width));
116920
117114
  const propsToChange = droppedWidgetConstraints ? {
116921
117115
  marginTop: Property.Dimension(Dim.row(droppedWidgetConstraints.top)),
116922
117116
  marginLeft: Property.Dimension(Dim.col(droppedWidgetConstraints.left)),
116923
- width,
116924
- height,
117117
+ ...draggedType === "SbIcon" ? { size: size2 } : { width, height },
116925
117118
  constraintTop: Property.Expression(
116926
117119
  JSON.stringify(droppedWidgetConstraints.constraintTop)
116927
117120
  )
@@ -116987,13 +117180,18 @@ const handleGridDrop = async ({
116987
117180
  });
116988
117181
  }
116989
117182
  };
116990
- const mergeDroppedDimensions = (draggedProps, activeDragRect) => {
117183
+ const mergeDroppedDimensions = (draggedType, draggedProps, activeDragRect) => {
116991
117184
  const safeExistingDimensions = filterSafeStackDimensionProperties({
116992
117185
  width: draggedProps == null ? void 0 : draggedProps.width,
116993
- height: draggedProps == null ? void 0 : draggedProps.height
117186
+ height: draggedProps == null ? void 0 : draggedProps.height,
117187
+ size: draggedProps == null ? void 0 : draggedProps.size
116994
117188
  });
116995
117189
  const width = safeExistingDimensions.width ?? ((activeDragRect == null ? void 0 : activeDragRect.width) ? Property.Dimension(Dim.px(activeDragRect.width)) : Property.Static(""));
116996
117190
  const height = safeExistingDimensions.height ?? ((activeDragRect == null ? void 0 : activeDragRect.height) ? Property.Dimension(Dim.px(activeDragRect.height)) : Property.Static(""));
117191
+ if (draggedType === "SbIcon") {
117192
+ const size2 = safeExistingDimensions.size ?? ((activeDragRect == null ? void 0 : activeDragRect.height) ? Property.Dimension(Dim.px(activeDragRect.height)) : Property.Static(""));
117193
+ return { size: size2 };
117194
+ }
116997
117195
  return {
116998
117196
  width,
116999
117197
  height
@@ -117046,7 +117244,7 @@ const handleStackDropWithinCanvas = (params) => {
117046
117244
  marginTop: Property.Static(""),
117047
117245
  marginLeft: Property.Static(""),
117048
117246
  constraintTop: Property.Static(""),
117049
- ...mergeDroppedDimensions(draggedProps, activeDragRect)
117247
+ ...mergeDroppedDimensions(draggedType, draggedProps, activeDragRect)
117050
117248
  }
117051
117249
  });
117052
117250
  }
@@ -117089,7 +117287,7 @@ const dropComponentInWrappingSectionOrColumn = async (params) => {
117089
117287
  marginTop: Property.Static(""),
117090
117288
  marginLeft: Property.Static(""),
117091
117289
  constraintTop: Property.Static(""),
117092
- ...mergeDroppedDimensions(draggedProps, activeDragRect)
117290
+ ...mergeDroppedDimensions(dropTargetType, draggedProps, activeDragRect)
117093
117291
  }
117094
117292
  });
117095
117293
  };
@@ -117530,12 +117728,18 @@ const AddSectionButton = ({
117530
117728
  sectionInstanceId
117531
117729
  }) => {
117532
117730
  const indexForNewSection = placement === "above" ? indexForBaseSection : indexForBaseSection + 1;
117533
- const createSection = useCallback(() => {
117534
- createComponent({
117731
+ const createSection = useCallback(async () => {
117732
+ const newSectionSourceId = await createComponent({
117535
117733
  componentType: "SbSection",
117536
117734
  parent: { id: sectionParentSourceId, index: indexForNewSection },
117537
117735
  scopeName: sectionParentScopeName
117538
117736
  });
117737
+ if (newSectionSourceId) {
117738
+ const newSectionInstanceId = getEditStore().runtimeEntitiesManager.widgets.getAnyInstanceIdForSourceId(
117739
+ newSectionSourceId
117740
+ );
117741
+ getEditStore().ui.selectWidget(newSectionInstanceId);
117742
+ }
117539
117743
  }, [sectionParentSourceId, indexForNewSection, sectionParentScopeName]);
117540
117744
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
117541
117745
  Wrapper$2,
@@ -117626,10 +117830,17 @@ const canResizeHeight = (heightMode) => {
117626
117830
  return heightMode === "px" || heightMode === "rows" || heightMode === "gridUnit";
117627
117831
  };
117628
117832
  const useResizeCapabilities = (instanceId) => {
117629
- var _a2, _b2, _c2, _d2, _e2;
117833
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
117630
117834
  const widget = (_a2 = rootStore.editStore) == null ? void 0 : _a2.runtimeEntitiesManager.getEditorWidgetMeta(instanceId);
117631
- const widthMode = (_c2 = (_b2 = widget == null ? void 0 : widget.props) == null ? void 0 : _b2.width) == null ? void 0 : _c2.mode;
117632
- const heightMode = (_e2 = (_d2 = widget == null ? void 0 : widget.props) == null ? void 0 : _d2.height) == null ? void 0 : _e2.mode;
117835
+ if ((widget == null ? void 0 : widget.type) === "SbIcon") {
117836
+ const sizeMode = (_c2 = (_b2 = widget.props) == null ? void 0 : _b2.size) == null ? void 0 : _c2.mode;
117837
+ return {
117838
+ canResizeWidth: sizeMode != null && sizeMode !== "fit",
117839
+ canResizeHeight: false
117840
+ };
117841
+ }
117842
+ const widthMode = (_e2 = (_d2 = widget == null ? void 0 : widget.props) == null ? void 0 : _d2.width) == null ? void 0 : _e2.mode;
117843
+ const heightMode = (_g2 = (_f2 = widget == null ? void 0 : widget.props) == null ? void 0 : _f2.height) == null ? void 0 : _g2.mode;
117633
117844
  return {
117634
117845
  canResizeWidth: canResizeWidth(widthMode),
117635
117846
  canResizeHeight: canResizeHeight(heightMode)
@@ -117654,7 +117865,9 @@ const HandlesWrapper = qe$1.div`
117654
117865
  pointer-events: none;
117655
117866
  `;
117656
117867
  const InteractionRectHandles = (props2) => {
117868
+ var _a2;
117657
117869
  const { instanceId, isDragging, selectionType } = props2;
117870
+ const type5 = (_a2 = rootStore.editStore) == null ? void 0 : _a2.runtimeEntitiesManager.getEditorWidgetType(instanceId);
117658
117871
  const [showPopover, setShowPopover] = useState(null);
117659
117872
  const { canResizeWidth: canResizeWidth2, canResizeHeight: canResizeHeight2 } = useResizeCapabilities(instanceId);
117660
117873
  const timeoutRef = useRef(null);
@@ -117667,8 +117880,8 @@ const InteractionRectHandles = (props2) => {
117667
117880
  }, []);
117668
117881
  const throttledResizeWidget = useMemo$2(
117669
117882
  () => lodashExports.throttle((e3) => {
117670
- var _a2;
117671
- (_a2 = rootStore.editStore) == null ? void 0 : _a2.ui.resizing.resizeWidget(
117883
+ var _a3;
117884
+ (_a3 = rootStore.editStore) == null ? void 0 : _a3.ui.resizing.resizeWidget(
117672
117885
  e3.clientX,
117673
117886
  e3.clientY,
117674
117887
  instanceId,
@@ -117685,14 +117898,14 @@ const InteractionRectHandles = (props2) => {
117685
117898
  [throttledResizeWidget]
117686
117899
  );
117687
117900
  const handlePointerUp = useCallback(() => {
117688
- var _a2;
117689
- (_a2 = rootStore.editStore) == null ? void 0 : _a2.ui.resizing.applyResize(instanceId);
117901
+ var _a3;
117902
+ (_a3 = rootStore.editStore) == null ? void 0 : _a3.ui.resizing.applyResize(instanceId);
117690
117903
  window.removeEventListener("pointermove", handlePointerMove);
117691
117904
  window.removeEventListener("pointerup", handlePointerUp);
117692
117905
  }, [handlePointerMove, instanceId]);
117693
117906
  const handlePointerDown = useCallback(
117694
117907
  (e3, position2) => {
117695
- var _a2;
117908
+ var _a3;
117696
117909
  e3.stopPropagation();
117697
117910
  e3.preventDefault();
117698
117911
  if (timeoutRef.current) {
@@ -117710,7 +117923,7 @@ const InteractionRectHandles = (props2) => {
117710
117923
  return;
117711
117924
  }
117712
117925
  setShowPopover(null);
117713
- (_a2 = rootStore.editStore) == null ? void 0 : _a2.ui.resizing.startResizing(
117926
+ (_a3 = rootStore.editStore) == null ? void 0 : _a3.ui.resizing.startResizing(
117714
117927
  e3.clientX,
117715
117928
  e3.clientY,
117716
117929
  instanceId,
@@ -117798,7 +118011,7 @@ const InteractionRectHandles = (props2) => {
117798
118011
  }
117799
118012
  }
117800
118013
  },
117801
- content: /* @__PURE__ */ jsxRuntimeExports.jsx(NotifierTooltipBody, { children: pos2 === "left" || pos2 === "right" ? "Width cannot be resized. Change width to pixel to enable manual resizing." : pos2 === "top" || pos2 === "bottom" ? "Height cannot be resized. Change height to pixel to enable manual resizing." : "" }),
118014
+ content: /* @__PURE__ */ jsxRuntimeExports.jsx(NotifierTooltipBody, { children: pos2 === "left" || pos2 === "right" ? "Width cannot be resized. Change width to pixel to enable manual resizing." : pos2 === "top" || pos2 === "bottom" ? type5 === "SbIcon" ? "Icons can be resized by changing its width." : "Height cannot be resized. Change height to pixel to enable manual resizing." : "" }),
117802
118015
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { width: "100%", height: "100%" } })
117803
118016
  }
117804
118017
  )
@@ -119023,7 +119236,7 @@ function useTypographyStyling({
119023
119236
  };
119024
119237
  }
119025
119238
  const DEFAULT_ICON_SPACING = 8;
119026
- const DEFAULT_ICON_SIZE$1 = 16;
119239
+ const DEFAULT_ICON_SIZE = 16;
119027
119240
  const ICON_POSITION_OPTIONS = [
119028
119241
  {
119029
119242
  icon: "ICON_LEFT_ALIGN",
@@ -119814,7 +120027,7 @@ const getStackChildStyle = ({
119814
120027
  parentWidth
119815
120028
  }) => {
119816
120029
  const height = (childProps == null ? void 0 : childProps.height) ?? Dim.fit();
119817
- const heightCss = (
120030
+ let heightCss = (
119818
120031
  // using 100% height when there is only one child and user's intention to set the child height as exact 100%, e.g. an image with large original height
119819
120032
  // if parent height is fit-content, child height 100% will cause unexpected height if child is empty container
119820
120033
  childCount === 1 && (height == null ? void 0 : height.mode) === "fill" && (parentHeight == null ? void 0 : parentHeight.mode) !== "fit" ? { height: "100%" } : dimToCSS(height, "height", primary === "height")
@@ -119822,23 +120035,18 @@ const getStackChildStyle = ({
119822
120035
  const width = (childProps == null ? void 0 : childProps.width) ?? (["SbText", "SbButton", "SbCheckbox", "SbSwitch"].includes(
119823
120036
  (childProps == null ? void 0 : childProps.type) ?? ""
119824
120037
  ) ? Dim.fit() : Dim.fill());
119825
- const widthCss = childCount === 1 && (width == null ? void 0 : width.mode) === "fill" && (parentWidth == null ? void 0 : parentWidth.mode) !== "fit" ? { width: "100%" } : dimToCSS(width, "width", primary === "width");
119826
- const minWidthCss = getMinMaxCss(
119827
- childProps == null ? void 0 : childProps.minWidth,
119828
- "minWidth"
119829
- );
119830
- const maxWidthCss = getMinMaxCss(
119831
- childProps == null ? void 0 : childProps.maxWidth,
119832
- "maxWidth"
119833
- );
119834
- const minHeightCss = getMinMaxCss(
119835
- childProps == null ? void 0 : childProps.minHeight,
119836
- "minHeight"
119837
- );
119838
- const maxHeightCss = getMinMaxCss(
119839
- childProps == null ? void 0 : childProps.maxHeight,
119840
- "maxHeight"
119841
- );
120038
+ let widthCss = childCount === 1 && (width == null ? void 0 : width.mode) === "fill" && (parentWidth == null ? void 0 : parentWidth.mode) !== "fit" ? { width: "100%" } : dimToCSS(width, "width", primary === "width");
120039
+ if ((childProps == null ? void 0 : childProps.type) === "SbIcon") {
120040
+ heightCss = dimToCSS(Dim.fit(), "height", false);
120041
+ widthCss = dimToCSS(Dim.fit(), "width", false);
120042
+ }
120043
+ const widthInPx = (width == null ? void 0 : width.mode) === "px";
120044
+ const heightInPx = (height == null ? void 0 : height.mode) === "px";
120045
+ const shouldNotShrink = widthInPx && primary === "width" || heightInPx && primary === "height";
120046
+ const minWidthCss = widthInPx ? {} : getMinMaxCss(childProps == null ? void 0 : childProps.minWidth, "minWidth");
120047
+ const maxWidthCss = widthInPx ? {} : getMinMaxCss(childProps == null ? void 0 : childProps.maxWidth, "maxWidth");
120048
+ const minHeightCss = heightInPx ? {} : getMinMaxCss(childProps == null ? void 0 : childProps.minHeight, "minHeight");
120049
+ const maxHeightCss = heightInPx ? {} : getMinMaxCss(childProps == null ? void 0 : childProps.maxHeight, "maxHeight");
119842
120050
  const margin2 = (childProps == null ? void 0 : childProps.margin) ?? {
119843
120051
  top: Dim.px(0),
119844
120052
  bottom: Dim.px(0),
@@ -119848,6 +120056,7 @@ const getStackChildStyle = ({
119848
120056
  const marginCss = { margin: generatePaddingStyle(margin2) };
119849
120057
  const stickyCss = (childProps == null ? void 0 : childProps.sticky) ? { position: "sticky", top: "0px", zIndex: Layers$1.stickySections } : {};
119850
120058
  const style2 = {
120059
+ ...shouldNotShrink ? { flexShrink: 0 } : {},
119851
120060
  ...heightCss,
119852
120061
  ...widthCss,
119853
120062
  ...minHeightCss,
@@ -120058,20 +120267,16 @@ const generateClassName = (seed2) => {
120058
120267
  return `superblocks_widget_${seed2}`;
120059
120268
  };
120060
120269
  const getCanvasClassName = () => "canvas";
120061
- const getChildName = (child) => {
120062
- var _a2;
120063
- return ((_a2 = getBindingIdentifier(child.props.bind)) == null ? void 0 : _a2.entityName) ?? child.props[WIDGET_SOURCE_ID_ATTRIBUTE];
120064
- };
120065
120270
  const calculateRowPositions = (orderedNames, childrenArray, rowHeight, pxHeights) => {
120066
120271
  return orderedNames.reduce(
120067
120272
  (acc, name) => {
120068
120273
  var _a2;
120069
- const child = childrenArray.find((child2) => getChildName(child2) === name);
120274
+ const child = childrenArray.find((child2) => child2.name === name);
120070
120275
  if (!child) {
120071
120276
  return acc;
120072
120277
  }
120073
- const marginTopPx = (((_a2 = child.props.marginTop) == null ? void 0 : _a2.value) ?? 0) * rowHeight;
120074
- const constraintTop = child.props.constraintTop;
120278
+ const marginTopPx = (((_a2 = child.marginTop) == null ? void 0 : _a2.value) ?? 0) * rowHeight;
120279
+ const constraintTop = child.constraintTop;
120075
120280
  const bottomFunc = (name2) => {
120076
120281
  const topRow = acc[name2];
120077
120282
  const pxHeight = pxHeights[name2];
@@ -120096,16 +120301,16 @@ const calculateRowPositions = (orderedNames, childrenArray, rowHeight, pxHeights
120096
120301
  const orderConstraints = (children) => {
120097
120302
  const childrenMap = children.reduce(
120098
120303
  (acc, child) => {
120099
- acc[getChildName(child)] = child;
120304
+ acc[child.name] = child;
120100
120305
  return acc;
120101
120306
  },
120102
120307
  {}
120103
120308
  );
120104
120309
  const constraintsMap = children.reduce(
120105
120310
  (acc, child) => {
120106
- if (child.props.constraintTop) {
120107
- const constraints = Array.isArray(child.props.constraintTop) ? child.props.constraintTop : [child.props.constraintTop];
120108
- acc[getChildName(child)] = constraints.filter(
120311
+ if (child.constraintTop) {
120312
+ const constraints = Array.isArray(child.constraintTop) ? child.constraintTop : [child.constraintTop];
120313
+ acc[child.name] = constraints.filter(
120109
120314
  (constraint) => !!childrenMap[constraint]
120110
120315
  );
120111
120316
  }
@@ -120117,24 +120322,24 @@ const orderConstraints = (children) => {
120117
120322
  const foundItems = /* @__PURE__ */ new Set();
120118
120323
  const itemsLeft = /* @__PURE__ */ new Set();
120119
120324
  children.forEach((child) => {
120120
- const constraints = constraintsMap[getChildName(child)] ?? [];
120325
+ const constraints = constraintsMap[child.name] ?? [];
120121
120326
  const hasNoConstraints = constraints.length === 0;
120122
120327
  if (hasNoConstraints) {
120123
- foundItems.add(getChildName(child));
120124
- orderedNames.push(getChildName(child));
120328
+ foundItems.add(child.name);
120329
+ orderedNames.push(child.name);
120125
120330
  } else {
120126
120331
  itemsLeft.add(child);
120127
120332
  }
120128
120333
  });
120129
120334
  while (itemsLeft.size > 0) {
120130
120335
  itemsLeft.forEach((child) => {
120131
- const constraints = constraintsMap[getChildName(child)] ?? [];
120336
+ const constraints = constraintsMap[child.name] ?? [];
120132
120337
  const constraintsLeft = constraints.filter(
120133
120338
  (constraint) => !foundItems.has(constraint)
120134
120339
  );
120135
120340
  if (constraintsLeft.length === 0) {
120136
- foundItems.add(getChildName(child));
120137
- orderedNames.push(getChildName(child));
120341
+ foundItems.add(child.name);
120342
+ orderedNames.push(child.name);
120138
120343
  itemsLeft.delete(child);
120139
120344
  }
120140
120345
  });
@@ -120185,99 +120390,148 @@ const heightReducer = (state, action2) => {
120185
120390
  }
120186
120391
  };
120187
120392
  const EMPTY_ARRAY$1 = [];
120188
- const InternalGrid = ({
120189
- children = EMPTY_ARRAY$1,
120190
- ...props2
120191
- }) => {
120192
- var _a2, _b2;
120193
- const isEditing = Boolean((_a2 = rootStore.editStore) == null ? void 0 : _a2.isInitialized);
120194
- const { style: style2, ...passThroughProps } = usePassthroughProps(props2);
120195
- const rowHeight = ((_b2 = props2.rowHeight) == null ? void 0 : _b2.value) ?? 12;
120196
- const childrenArray = useMemo$2(() => {
120197
- let childrenArray2 = Array.isArray(children) ? children : [children];
120198
- if (!isEditing) {
120199
- childrenArray2 = childrenArray2.filter(
120200
- (child) => child.props.isVisible !== false
120201
- );
120202
- }
120203
- return childrenArray2;
120204
- }, [children, isEditing]);
120205
- const columns = props2.columns ?? 12;
120206
- const [pxHeights, dispatchHeight] = React__default.useReducer(heightReducer, {});
120207
- const gridPositions = useMemo$2(() => {
120208
- const orderedNames = orderConstraints(childrenArray);
120209
- const rowPos = calculateRowPositions(
120210
- orderedNames,
120211
- childrenArray,
120212
- rowHeight,
120213
- pxHeights
120214
- );
120215
- const positions = childrenArray.reduce(
120216
- (acc, child) => {
120217
- var _a3, _b3, _c2;
120218
- let width = ((_a3 = child.props.width) == null ? void 0 : _a3.value) ?? (child.type.sbType === "SbTable" || child.type.sbType === "SbContainer" ? 6 : 2);
120219
- if (((_b3 = child.props.width) == null ? void 0 : _b3.mode) === "fill") {
120220
- width = columns;
120221
- }
120222
- acc[getChildName(child)] = {
120223
- top: rowPos[getChildName(child)],
120224
- left: ((_c2 = child.props.marginLeft) == null ? void 0 : _c2.value) ?? 0,
120225
- width,
120226
- height: Math.ceil(pxHeights[getChildName(child)] / rowHeight)
120227
- };
120228
- return acc;
120229
- },
120230
- {}
120231
- );
120232
- return positions;
120233
- }, [columns, childrenArray, rowHeight, pxHeights]);
120234
- const gridStyle = React__default.useMemo(() => {
120235
- const spacingValue = 0;
120236
- const columnsSize = `calc(${100 / columns}% - ${(columns - 1) * spacingValue / columns}px)`;
120237
- return {
120238
- display: "grid",
120239
- gridAutoRows: `${rowHeight}px`,
120240
- gap: `${spacingValue}px`,
120241
- gridTemplateColumns: `repeat(${columns}, ${columnsSize})`,
120242
- ...style2
120243
- };
120244
- }, [columns, rowHeight, style2]);
120245
- return /* @__PURE__ */ jsxRuntimeExports.jsx(DragDisplay, { passThroughProps, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: gridStyle, className: props2.className, children: childrenArray.map((child) => {
120246
- var _a3, _b3;
120247
- const heightMode = ((_a3 = child.props.height) == null ? void 0 : _a3.mode) ?? "fit";
120248
- const top2 = gridPositions[getChildName(child)].top;
120249
- const left2 = gridPositions[getChildName(child)].left;
120250
- const rows = gridPositions[getChildName(child)].height;
120251
- const columns2 = gridPositions[getChildName(child)].width;
120252
- const Component3 = heightMode === "fit" ? MeasuredComponent : StaticComponent;
120393
+ const GridChild = observer(
120394
+ ({
120395
+ childProps,
120396
+ gridPositions,
120397
+ rowHeight,
120398
+ dispatchHeight,
120399
+ childElement
120400
+ }) => {
120401
+ var _a2, _b2;
120402
+ const heightMode = ((_a2 = childProps.height) == null ? void 0 : _a2.mode) ?? "fit";
120403
+ const top2 = gridPositions[childProps.name].top;
120404
+ const left2 = gridPositions[childProps.name].left;
120405
+ const rows = gridPositions[childProps.name].height;
120406
+ const columns = gridPositions[childProps.name].width;
120407
+ const Component3 = heightMode === "fit" || childProps.sbType === "SbIcon" ? MeasuredComponent : StaticComponent;
120253
120408
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
120254
120409
  "div",
120255
120410
  {
120256
120411
  style: {
120257
120412
  gridRow: `${top2 + 1} / span ${Math.max(1, rows)}`,
120258
- gridColumn: `${left2 + 1} / span ${Math.max(1, columns2)}`,
120413
+ gridColumn: `${left2 + 1} / span ${Math.max(1, columns)}`,
120259
120414
  width: "100%",
120260
120415
  maxWidth: "100%"
120261
120416
  },
120262
120417
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
120263
120418
  Component3,
120264
120419
  {
120265
- staticHeight: (((_b3 = child.props.height) == null ? void 0 : _b3.value) ?? 0) * rowHeight,
120420
+ staticHeight: (((_b2 = childProps.height) == null ? void 0 : _b2.value) ?? 0) * rowHeight,
120421
+ style: childProps.sbType === "SbIcon" ? {
120422
+ aspectRatio: "1"
120423
+ } : void 0,
120266
120424
  onHeightChanged: (height) => {
120267
120425
  dispatchHeight({
120268
120426
  type: "SET_HEIGHT",
120269
- name: getChildName(child),
120427
+ name: childProps.name,
120270
120428
  height
120271
120429
  });
120272
120430
  },
120273
- children: child
120431
+ children: childElement
120274
120432
  }
120275
120433
  )
120276
120434
  },
120277
- getChildName(child)
120435
+ childProps.name
120278
120436
  );
120279
- }) }) });
120280
- };
120437
+ }
120438
+ );
120439
+ const InternalGrid = observer(
120440
+ ({ children = EMPTY_ARRAY$1, ...props2 }) => {
120441
+ var _a2;
120442
+ const { style: style2, ...passThroughProps } = usePassthroughProps(props2);
120443
+ const rowHeight = ((_a2 = props2.rowHeight) == null ? void 0 : _a2.value) ?? 12;
120444
+ const childrenArray = useObserverMemo(() => {
120445
+ var _a3;
120446
+ const childrenArray2 = Array.isArray(children) ? children : [children];
120447
+ const isEditing = Boolean((_a3 = rootStore.editStore) == null ? void 0 : _a3.isInitialized);
120448
+ const withEvaluatedProps = childrenArray2.reduce((acc, child) => {
120449
+ const bindingIdentifier = getBindingIdentifier(child.props.bind);
120450
+ const entity = bindingIdentifier ? rootStore.entityManager.getEntity(bindingIdentifier.scopeId, {
120451
+ value: bindingIdentifier.entityName,
120452
+ isAnonymous: false
120453
+ }) : null;
120454
+ const sbType = isSbComponent(child) ? child.type.sbType : void 0;
120455
+ const marginTop = (entity == null ? void 0 : entity.marginTop) ?? (isDimension(child.props.marginTop) ? child.props.marginTop : void 0);
120456
+ const marginLeft = (entity == null ? void 0 : entity.marginLeft) ?? (isDimension(child.props.marginLeft) ? child.props.marginLeft : void 0);
120457
+ let width = (entity == null ? void 0 : entity.width) ?? (isDimension(child.props.width) ? child.props.width : void 0);
120458
+ if (sbType === "SbIcon") {
120459
+ width = (entity == null ? void 0 : entity.size) ?? (isDimension(child.props.size) ? child.props.size : void 0);
120460
+ }
120461
+ const height = (entity == null ? void 0 : entity.height) ?? (isDimension(child.props.height) ? child.props.height : void 0);
120462
+ const constraintTop = (entity == null ? void 0 : entity.constraintTop) ?? child.props.constraintTop;
120463
+ const isVisible2 = (entity == null ? void 0 : entity.isVisible) ?? child.props.isVisible;
120464
+ const gridChild = {
120465
+ marginTop,
120466
+ marginLeft,
120467
+ width,
120468
+ height,
120469
+ constraintTop,
120470
+ name: (bindingIdentifier == null ? void 0 : bindingIdentifier.entityName) ?? child.props[WIDGET_SOURCE_ID_ATTRIBUTE],
120471
+ // source ID as a fallback
120472
+ sbType,
120473
+ element: child
120474
+ };
120475
+ if (isVisible2 !== false || isEditing) {
120476
+ acc.push(gridChild);
120477
+ }
120478
+ return acc;
120479
+ }, []);
120480
+ return withEvaluatedProps;
120481
+ }, [children]);
120482
+ const columns = props2.columns ?? 12;
120483
+ const [pxHeights, dispatchHeight] = React__default.useReducer(heightReducer, {});
120484
+ const gridPositions = useMemo$2(() => {
120485
+ const orderedNames = orderConstraints(childrenArray);
120486
+ const rowPos = calculateRowPositions(
120487
+ orderedNames,
120488
+ childrenArray,
120489
+ rowHeight,
120490
+ pxHeights
120491
+ );
120492
+ const positions = childrenArray.reduce(
120493
+ (acc, child) => {
120494
+ var _a3, _b2, _c2;
120495
+ let width = ((_a3 = child.width) == null ? void 0 : _a3.value) ?? (child.sbType === "SbTable" || child.sbType === "SbContainer" ? 6 : 2);
120496
+ if (((_b2 = child.width) == null ? void 0 : _b2.mode) === "fill") {
120497
+ width = columns;
120498
+ }
120499
+ acc[child.name] = {
120500
+ top: rowPos[child.name],
120501
+ left: ((_c2 = child.marginLeft) == null ? void 0 : _c2.value) ?? 0,
120502
+ width,
120503
+ height: Math.ceil(pxHeights[child.name] / rowHeight)
120504
+ };
120505
+ return acc;
120506
+ },
120507
+ {}
120508
+ );
120509
+ return positions;
120510
+ }, [columns, childrenArray, rowHeight, pxHeights]);
120511
+ const gridStyle = React__default.useMemo(() => {
120512
+ const spacingValue = 0;
120513
+ const columnsSize = `calc(${100 / columns}% - ${(columns - 1) * spacingValue / columns}px)`;
120514
+ return {
120515
+ display: "grid",
120516
+ gridAutoRows: `${rowHeight}px`,
120517
+ gap: `${spacingValue}px`,
120518
+ gridTemplateColumns: `repeat(${columns}, ${columnsSize})`,
120519
+ ...style2
120520
+ };
120521
+ }, [columns, rowHeight, style2]);
120522
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(DragDisplay, { passThroughProps, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: gridStyle, className: props2.className, children: childrenArray.map((child) => /* @__PURE__ */ jsxRuntimeExports.jsx(
120523
+ GridChild,
120524
+ {
120525
+ childProps: child,
120526
+ childElement: child.element,
120527
+ gridPositions,
120528
+ rowHeight,
120529
+ dispatchHeight
120530
+ },
120531
+ child.name
120532
+ )) }) });
120533
+ }
120534
+ );
120281
120535
  const DragDisplay = (props2) => {
120282
120536
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
120283
120537
  "div",
@@ -126201,9 +126455,9 @@ const getIconPositionStyle = ({
126201
126455
  right: offsetRight === "auto" ? offsetRight : `${offsetRight}px`
126202
126456
  };
126203
126457
  };
126204
- const getIconPadding = (paddingValue = INPUT_PADDING.right, iconSize = DEFAULT_ICON_SIZE$1, withSpacing = true) => {
126458
+ const getIconPadding = (paddingValue = INPUT_PADDING.right, iconSize = DEFAULT_ICON_SIZE, withSpacing = true) => {
126205
126459
  const spacing2 = withSpacing ? DEFAULT_ICON_SPACING : 0;
126206
- const baseValue = iconSize ? iconSize + spacing2 : DEFAULT_ICON_SIZE$1;
126460
+ const baseValue = iconSize ? iconSize + spacing2 : DEFAULT_ICON_SIZE;
126207
126461
  return Dim.px(baseValue + (paddingValue.value ?? 0));
126208
126462
  };
126209
126463
  const DEFAULT_LABEL_WIDTH_IN_PERCENT = 30;
@@ -126957,7 +127211,7 @@ const useInputIconSize = ({
126957
127211
  textStyleVariant: textStyle2.variant,
126958
127212
  defaultTextStyleVariant: DEFAULT_INPUT_TEXT_STYLE_VARIANT
126959
127213
  })
126960
- ) : DEFAULT_ICON_SIZE$1;
127214
+ ) : DEFAULT_ICON_SIZE;
126961
127215
  };
126962
127216
  const useInputGroupStylingProps = (props2) => {
126963
127217
  const { theme } = useTheme$1();
@@ -127174,7 +127428,7 @@ const _InputComponent = class _InputComponent extends React__default.Component {
127174
127428
  (padding2, iconPosition, iconSize) => {
127175
127429
  var _a2, _b2;
127176
127430
  let adjustedForIcon = {};
127177
- const horizontalPadding = iconSize ? iconSize + DEFAULT_ICON_SPACING : DEFAULT_ICON_SIZE$1;
127431
+ const horizontalPadding = iconSize ? iconSize + DEFAULT_ICON_SPACING : DEFAULT_ICON_SIZE;
127178
127432
  if (iconPosition === "left") {
127179
127433
  adjustedForIcon = {
127180
127434
  left: Dim.px(horizontalPadding + (((_a2 = padding2.left) == null ? void 0 : _a2.value) ?? 0))
@@ -127260,7 +127514,7 @@ const _InputComponent = class _InputComponent extends React__default.Component {
127260
127514
  );
127261
127515
  });
127262
127516
  __publicField(this, "passwordIconComponent", () => {
127263
- const iconSize = this.props.iconSize ?? DEFAULT_ICON_SIZE$1;
127517
+ const iconSize = this.props.iconSize ?? DEFAULT_ICON_SIZE;
127264
127518
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
127265
127519
  Button$4,
127266
127520
  {
@@ -127317,7 +127571,7 @@ const _InputComponent = class _InputComponent extends React__default.Component {
127317
127571
  });
127318
127572
  __publicField(this, "renderInputComponent", (inputType) => isNumericInput(inputType) ? this.numericInputComponent() : this.textInputComponent());
127319
127573
  __publicField(this, "renderIcon", () => {
127320
- const iconSize = this.props.iconSize ?? DEFAULT_ICON_SIZE$1;
127574
+ const iconSize = this.props.iconSize ?? DEFAULT_ICON_SIZE;
127321
127575
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
127322
127576
  "div",
127323
127577
  {
@@ -134884,7 +135138,7 @@ function requireButton() {
134884
135138
  }
134885
135139
  var buttonExports = /* @__PURE__ */ requireButton();
134886
135140
  const AntdButton = /* @__PURE__ */ getDefaultExportFromCjs(buttonExports);
134887
- const StyledButton$1 = qe$1(AntdButton)`
135141
+ const StyledButton = qe$1(AntdButton)`
134888
135142
  color: ${(props2) => props2.color};
134889
135143
  ${({ $width }) => $width ? `width: ${$width}` : ""};
134890
135144
  ${({ $bordered }) => !$bordered ? "border: 0px;" : ""};
@@ -134899,7 +135153,7 @@ const Button$2 = memo(
134899
135153
  forwardRef(
134900
135154
  ({ bordered = true, width, children, ...buttonProps }, ref2) => {
134901
135155
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
134902
- StyledButton$1,
135156
+ StyledButton,
134903
135157
  {
134904
135158
  $bordered: bordered,
134905
135159
  $width: width,
@@ -135680,8 +135934,7 @@ const RowDensity = {
135680
135934
  };
135681
135935
  const HorizontalAlignment = {
135682
135936
  left: "left",
135683
- right: "right",
135684
- center: "center"
135937
+ right: "right"
135685
135938
  };
135686
135939
  const VerticalAlignment = {
135687
135940
  center: "center"
@@ -135798,7 +136051,7 @@ const PARSED_INPUT_TYPES = [
135798
136051
  EditInputType.Number,
135799
136052
  EditInputType.Checkbox
135800
136053
  ];
135801
- const TextBoxEditTypes = [
136054
+ [
135802
136055
  EditInputType.Text,
135803
136056
  EditInputType.Number,
135804
136057
  EditInputType.Email
@@ -135900,15 +136153,26 @@ const tableColumnTypes = [
135900
136153
  value: ColumnType.EMAIL
135901
136154
  }
135902
136155
  ];
136156
+ const currentRowArg = (entity) => {
136157
+ return {
136158
+ name: "currentRow",
136159
+ description: "Current row of the table. Use this to access the current row's data.",
136160
+ type: "object",
136161
+ schema: entity.tableData && Array.isArray(entity.tableData) && entity.tableData.length > 0 ? entity.tableData[0] : {}
136162
+ };
136163
+ };
136164
+ const tableContextualArgs = function(entity) {
136165
+ return [[currentRowArg(entity)]];
136166
+ };
135903
136167
  const cellIconProps = {
135904
- cellIcon: Prop.string().readAndWrite().propertiesPanel({
136168
+ cellIcon: Prop.string().readAndWrite().contextual(tableContextualArgs).propertiesPanel({
135905
136169
  label: "Cell icon",
135906
136170
  controlType: "ICON_SELECTOR",
135907
136171
  isRemovable: true,
135908
136172
  visibility: "SHOW_NAME",
135909
136173
  defaultOnAdd: "info"
135910
136174
  }),
135911
- cellIconPosition: Prop.string().default("left").readAndWrite().propertiesPanel({
136175
+ cellIconPosition: Prop.string().default("left").contextual(tableContextualArgs).readAndWrite().propertiesPanel({
135912
136176
  label: "Cell icon position",
135913
136177
  controlType: "RADIO_BUTTON_GROUP",
135914
136178
  options: [
@@ -135925,7 +136189,7 @@ const cellIconProps = {
135925
136189
  ]
135926
136190
  })
135927
136191
  };
135928
- const horizontalAlignProp = () => Prop.string().readAndWrite().propertiesPanel({
136192
+ const horizontalAlignProp = () => Prop.string().readAndWrite().contextual(tableContextualArgs).propertiesPanel({
135929
136193
  label: "Horizontal alignment",
135930
136194
  controlType: "RADIO_BUTTON_GROUP",
135931
136195
  options: [
@@ -135934,7 +136198,7 @@ const horizontalAlignProp = () => Prop.string().readAndWrite().propertiesPanel({
135934
136198
  { value: "right", icon: "RIGHT_ALIGN" }
135935
136199
  ]
135936
136200
  }).default("left");
135937
- const verticalAlignProp = () => Prop.string().readAndWrite().propertiesPanel({
136201
+ const verticalAlignProp = () => Prop.string().readAndWrite().contextual(tableContextualArgs).propertiesPanel({
135938
136202
  label: "Vertical alignment",
135939
136203
  controlType: "RADIO_BUTTON_GROUP",
135940
136204
  options: [
@@ -135945,7 +136209,7 @@ const verticalAlignProp = () => Prop.string().readAndWrite().propertiesPanel({
135945
136209
  }).default("center");
135946
136210
  const cellBackgroundProp = colorProp({
135947
136211
  label: "Background color"
135948
- }).default(() => Theme.colors.neutral).readAndWrite();
136212
+ }).contextual(tableContextualArgs).default(() => Theme.colors.neutral).readAndWrite();
135949
136213
  const textStyleProps = {
135950
136214
  horizontalAlign: horizontalAlignProp(),
135951
136215
  verticalAlign: verticalAlignProp(),
@@ -135953,7 +136217,7 @@ const textStyleProps = {
135953
136217
  propertiesPanel: {
135954
136218
  label: "Cell text style"
135955
136219
  }
135956
- }).default(() => ({
136220
+ }).contextual(tableContextualArgs).default(() => ({
135957
136221
  variant: DEFAULT_CELL_TEXT_STYLE_VARIANT
135958
136222
  })),
135959
136223
  cellBackground: cellBackgroundProp
@@ -135968,22 +136232,22 @@ const computedValueUnion = Prop.union({
135968
136232
  },
135969
136233
  {
135970
136234
  isDerived: Prop.literal(true),
135971
- computedValue: Prop.string().readAndWrite().propertiesPanel({
136235
+ computedValue: Prop.string().contextual(tableContextualArgs).readAndWrite().propertiesPanel({
135972
136236
  label: "Computed value"
135973
- // todo: add special control that can use currentRow
135974
136237
  })
135975
136238
  }
135976
136239
  ]
135977
136240
  }).getProps();
135978
136241
  const textColumnProperties = {
135979
136242
  general: {
135980
- displayedValue: Prop.string().readAndWrite().propertiesPanel({
136243
+ displayedValue: Prop.string().contextual(tableContextualArgs).readAndWrite().propertiesPanel({
135981
136244
  label: "Displayed value",
135982
136245
  controlType: "COMPUTE_TABLE_VALUE"
135983
136246
  })
135984
136247
  },
135985
136248
  presentation: {
135986
- textWrap: Prop.boolean().readAndWrite().propertiesPanel({
136249
+ ...cellIconProps,
136250
+ textWrap: Prop.boolean().contextual(tableContextualArgs).readAndWrite().propertiesPanel({
135987
136251
  label: "Wrap text",
135988
136252
  controlType: "SWITCH"
135989
136253
  }),
@@ -135993,23 +136257,25 @@ const textColumnProperties = {
135993
136257
  const emailColumnProperties = { ...textColumnProperties };
135994
136258
  const buttonColumnProperties = {
135995
136259
  general: {
135996
- buttonLabel: Prop.string().default("Action").readAndWrite().propertiesPanel({
136260
+ buttonLabel: Prop.string().default("Action").contextual(tableContextualArgs).readAndWrite().propertiesPanel({
135997
136261
  label: "Button label",
135998
136262
  controlType: "COMPUTE_TABLE_VALUE"
135999
136263
  }),
136000
- isDisabled: Prop.boolean().readAndWrite().propertiesPanel({
136264
+ isDisabled: Prop.boolean().readAndWrite().contextual(tableContextualArgs).propertiesPanel({
136001
136265
  label: "Disabled",
136002
136266
  controlType: "SWITCH"
136003
136267
  })
136004
136268
  },
136005
136269
  presentation: {
136006
- buttonIcon: Prop.string().readAndWrite().propertiesPanel({
136270
+ buttonIcon: Prop.string().readAndWrite().contextual(tableContextualArgs).propertiesPanel({
136007
136271
  label: "Button icon",
136008
136272
  controlType: "ICON_SELECTOR",
136009
136273
  isRemovable: true,
136010
136274
  visibility: "SHOW_NAME"
136011
136275
  }),
136012
- buttonIconPosition: Prop.string().readAndWrite().default("left").propertiesPanel({
136276
+ buttonIconPosition: Prop.string().readAndWrite().contextual(
136277
+ tableContextualArgs
136278
+ ).default("left").propertiesPanel({
136013
136279
  label: "Cell icon position",
136014
136280
  controlType: "RADIO_BUTTON_GROUP",
136015
136281
  options: [
@@ -136025,7 +136291,9 @@ const buttonColumnProperties = {
136025
136291
  }
136026
136292
  ]
136027
136293
  }),
136028
- buttonVariant: Prop.string().default("primary").readAndWrite().propertiesPanel({
136294
+ buttonVariant: Prop.string().default("primary").contextual(
136295
+ tableContextualArgs
136296
+ ).readAndWrite().propertiesPanel({
136029
136297
  label: "Button variant",
136030
136298
  controlType: "DROP_DOWN",
136031
136299
  options: [
@@ -136043,7 +136311,9 @@ const buttonColumnProperties = {
136043
136311
  }
136044
136312
  ]
136045
136313
  }),
136046
- buttonTextStyle: textStyleProp().default(function() {
136314
+ buttonTextStyle: textStyleProp().contextual(
136315
+ tableContextualArgs
136316
+ ).default(function() {
136047
136317
  return {
136048
136318
  variant: "buttonLabel",
136049
136319
  textColor: {
@@ -136061,28 +136331,32 @@ const buttonColumnProperties = {
136061
136331
  defaultOnAdd: function() {
136062
136332
  return getButtonThemeDefaultBackgroundColor(Theme, "primary");
136063
136333
  }
136064
- }).readAndWrite(),
136334
+ }).contextual(
136335
+ tableContextualArgs
136336
+ ).readAndWrite(),
136065
136337
  buttonBorder: border({
136066
136338
  defaultOnAdd: SECONDARY_BUTTON_BORDER_OBJECT,
136067
136339
  treatDefaultAsNull: function() {
136068
136340
  return true;
136069
136341
  }
136070
- }).default(getDefaultBorderObject)
136342
+ }).readAndWrite().contextual(
136343
+ tableContextualArgs
136344
+ ).default(getDefaultBorderObject)
136071
136345
  }
136072
136346
  };
136073
136347
  const numberColumnProperties = {
136074
136348
  general: {
136075
- notation: Prop.string().readAndWrite().propertiesPanel({
136349
+ notation: Prop.string().readAndWrite().contextual(tableContextualArgs).propertiesPanel({
136076
136350
  label: "Number format",
136077
136351
  controlType: "DROP_DOWN",
136078
136352
  options: NUMBER_FORMATTING_OPTIONS
136079
136353
  }),
136080
- minimumFractionDigits: Prop.number().readAndWrite().propertiesPanel({
136354
+ minimumFractionDigits: Prop.number().contextual(tableContextualArgs).readAndWrite().propertiesPanel({
136081
136355
  label: "Minimum fraction digits",
136082
136356
  isRemovable: true,
136083
136357
  visibility: "SHOW_NAME"
136084
136358
  }),
136085
- maximumFractionDigits: Prop.number().readAndWrite().propertiesPanel({
136359
+ maximumFractionDigits: Prop.number().contextual(tableContextualArgs).readAndWrite().propertiesPanel({
136086
136360
  label: "Maximum fraction digits",
136087
136361
  isRemovable: true,
136088
136362
  visibility: "SHOW_NAME"
@@ -136090,7 +136364,7 @@ const numberColumnProperties = {
136090
136364
  },
136091
136365
  presentation: {
136092
136366
  ...cellIconProps,
136093
- textWrap: Prop.boolean().readAndWrite().propertiesPanel({
136367
+ textWrap: Prop.boolean().contextual(tableContextualArgs).readAndWrite().propertiesPanel({
136094
136368
  label: "Wrap text",
136095
136369
  controlType: "SWITCH"
136096
136370
  }),
@@ -136103,7 +136377,9 @@ const percentageColumnProperties = {
136103
136377
  };
136104
136378
  const currencyColumnProperties = {
136105
136379
  general: {
136106
- currency: Prop.string().default("USD").readAndWrite().propertiesPanel({
136380
+ currency: Prop.string().default("USD").contextual(
136381
+ tableContextualArgs
136382
+ ).readAndWrite().propertiesPanel({
136107
136383
  label: "Currency",
136108
136384
  controlType: "DROP_DOWN",
136109
136385
  options: CurrencyList.map((currency) => ({
@@ -136117,12 +136393,11 @@ const currencyColumnProperties = {
136117
136393
  };
136118
136394
  const linkColumnProperties = {
136119
136395
  general: {
136120
- // todo: re-add when we have a way to access currentRow
136121
- // linkUrl: Prop.string().readAndWrite().propertiesPanel({
136122
- // label: "Link URL",
136123
- // controlType: "COMPUTE_TABLE_VALUE",
136124
- // }),
136125
- linkLabel: Prop.string().readAndWrite().propertiesPanel({
136396
+ linkUrl: Prop.string().readAndWrite().contextual(tableContextualArgs).propertiesPanel({
136397
+ label: "Link URL",
136398
+ controlType: "COMPUTE_TABLE_VALUE"
136399
+ }),
136400
+ linkLabel: Prop.string().contextual(tableContextualArgs).readAndWrite().propertiesPanel({
136126
136401
  label: "Link label",
136127
136402
  controlType: "COMPUTE_TABLE_VALUE"
136128
136403
  })
@@ -136138,13 +136413,15 @@ const linkColumnProperties = {
136138
136413
  };
136139
136414
  const imageColumnProperties = {
136140
136415
  general: {
136141
- openImageUrl: Prop.boolean().default(false).readAndWrite().propertiesPanel({
136416
+ openImageUrl: Prop.boolean().contextual(tableContextualArgs).default(false).readAndWrite().propertiesPanel({
136142
136417
  label: "Open URL on click",
136143
136418
  controlType: "SWITCH"
136144
136419
  })
136145
136420
  },
136146
136421
  presentation: {
136147
- imageSize: Prop.string().readAndWrite().propertiesPanel({
136422
+ imageSize: Prop.string().readAndWrite().contextual(
136423
+ tableContextualArgs
136424
+ ).propertiesPanel({
136148
136425
  label: "Image sizing",
136149
136426
  controlType: "DROP_DOWN",
136150
136427
  options: [
@@ -136170,14 +136447,14 @@ const imageColumnProperties = {
136170
136447
  }
136171
136448
  ]
136172
136449
  }),
136173
- imageBorderRadius: borderRadius(),
136174
- horizontalAlign: horizontalAlignProp(),
136450
+ imageBorderRadius: borderRadius().contextual(tableContextualArgs),
136451
+ horizontalAlign: horizontalAlignProp().contextual(tableContextualArgs),
136175
136452
  cellBackground: cellBackgroundProp
136176
136453
  }
136177
136454
  };
136178
136455
  const manageTimezoneUnion = Prop.union({
136179
136456
  shared: {
136180
- manageTimezone: Prop.boolean().default(false).readAndWrite().propertiesPanel({
136457
+ manageTimezone: Prop.boolean().default(false).contextual(tableContextualArgs).readAndWrite().propertiesPanel({
136181
136458
  label: "Manage timezone",
136182
136459
  controlType: "SWITCH"
136183
136460
  })
@@ -136188,12 +136465,12 @@ const manageTimezoneUnion = Prop.union({
136188
136465
  },
136189
136466
  {
136190
136467
  manageTimezone: Prop.literal(true),
136191
- valueTimezone: Prop.string().readAndWrite().propertiesPanel({
136468
+ valueTimezone: Prop.string().contextual(tableContextualArgs).readAndWrite().propertiesPanel({
136192
136469
  label: "Value timezone",
136193
136470
  controlType: "DROP_DOWN",
136194
136471
  options: TIMEZONE_OPTIONS
136195
136472
  }),
136196
- displayTimezone: Prop.string().readAndWrite().propertiesPanel({
136473
+ displayTimezone: Prop.string().contextual(tableContextualArgs).readAndWrite().propertiesPanel({
136197
136474
  label: "Display timezone",
136198
136475
  controlType: "DROP_DOWN",
136199
136476
  options: TIMEZONE_OPTIONS
@@ -136203,12 +136480,12 @@ const manageTimezoneUnion = Prop.union({
136203
136480
  }).getProps();
136204
136481
  const dateColumnProperties = {
136205
136482
  general: {
136206
- inputFormat: Prop.string().readAndWrite().propertiesPanel({
136483
+ inputFormat: Prop.string().contextual(tableContextualArgs).readAndWrite().propertiesPanel({
136207
136484
  label: "Value format",
136208
136485
  controlType: "DROP_DOWN",
136209
136486
  options: DATE_INPUT_FORMATS
136210
136487
  }),
136211
- outputFormat: Prop.string().readAndWrite().propertiesPanel({
136488
+ outputFormat: Prop.string().contextual(tableContextualArgs).readAndWrite().propertiesPanel({
136212
136489
  label: "Display format",
136213
136490
  controlType: "DROP_DOWN",
136214
136491
  options: DATE_OUTPUT_FORMATS
@@ -136217,7 +136494,7 @@ const dateColumnProperties = {
136217
136494
  },
136218
136495
  presentation: {
136219
136496
  ...cellIconProps,
136220
- textWrap: Prop.boolean().readAndWrite().propertiesPanel({
136497
+ textWrap: Prop.boolean().readAndWrite().contextual(tableContextualArgs).propertiesPanel({
136221
136498
  label: "Wrap text",
136222
136499
  controlType: "SWITCH"
136223
136500
  }),
@@ -136273,7 +136550,7 @@ const tagsColumnProperties = {
136273
136550
  horizontalAlign: horizontalAlignProp(),
136274
136551
  verticalAlign: verticalAlignProp(),
136275
136552
  cellBackground: cellBackgroundProp,
136276
- tagsWrap: Prop.boolean().readAndWrite().propertiesPanel({
136553
+ tagsWrap: Prop.boolean().readAndWrite().contextual(tableContextualArgs).propertiesPanel({
136277
136554
  label: "Wrap tags",
136278
136555
  controlType: "SWITCH"
136279
136556
  }),
@@ -138323,7 +138600,9 @@ const ColumnHeaderWrapper = qe$1.div`
138323
138600
  gap: 4px;
138324
138601
  justify-content: ${(props2) => {
138325
138602
  var _a2, _b2;
138326
- return ((_a2 = props2 == null ? void 0 : props2.columnProperties) == null ? void 0 : _a2.horizontalAlign) && JUSTIFY_CONTENT[(_b2 = props2 == null ? void 0 : props2.columnProperties) == null ? void 0 : _b2.horizontalAlign];
138603
+ return ((_a2 = props2 == null ? void 0 : props2.columnProperties) == null ? void 0 : _a2.horizontalAlign) && JUSTIFY_CONTENT[getFirstPropertyValue(
138604
+ (_b2 = props2 == null ? void 0 : props2.columnProperties) == null ? void 0 : _b2.horizontalAlign
138605
+ ) ?? HorizontalAlignment.left];
138327
138606
  }};
138328
138607
  align-items: center;
138329
138608
  overflow: hidden;
@@ -138338,7 +138617,9 @@ const HeaderCellContentWrapper = qe$1.div`
138338
138617
  flex: 1;
138339
138618
  justify-content: ${(props2) => {
138340
138619
  var _a2, _b2;
138341
- return ((_a2 = props2 == null ? void 0 : props2.columnProperties) == null ? void 0 : _a2.horizontalAlign) && JUSTIFY_CONTENT[(_b2 = props2 == null ? void 0 : props2.columnProperties) == null ? void 0 : _b2.horizontalAlign];
138620
+ return ((_a2 = props2 == null ? void 0 : props2.columnProperties) == null ? void 0 : _a2.horizontalAlign) && JUSTIFY_CONTENT[getFirstPropertyValue(
138621
+ (_b2 = props2 == null ? void 0 : props2.columnProperties) == null ? void 0 : _b2.horizontalAlign
138622
+ ) ?? HorizontalAlignment.left];
138342
138623
  }};
138343
138624
  `;
138344
138625
  const TableIconWrapper = qe$1.div`
@@ -145512,14 +145793,14 @@ function getLoaderFn(options) {
145512
145793
  if (!(loader === "all")) return [3, 3];
145513
145794
  return [4, import(
145514
145795
  /* webpackChunkName: "blueprint-icons-all-paths-loader" */
145515
- "./allPathsLoader-B3Ii4JGL.js"
145796
+ "./allPathsLoader-rDsLNp7q.js"
145516
145797
  )];
145517
145798
  case 2:
145518
145799
  return [2, _b2.sent().allPathsLoader];
145519
145800
  case 3:
145520
145801
  return [4, import(
145521
145802
  /* webpackChunkName: "blueprint-icons-split-paths-by-size-loader" */
145522
- "./splitPathsBySizeLoader-Btq5cpt-.js"
145803
+ "./splitPathsBySizeLoader-DCl0XfAP.js"
145523
145804
  )];
145524
145805
  case 4:
145525
145806
  return [2, _b2.sent().splitPathsBySizeLoader];
@@ -153352,7 +153633,7 @@ const getClearableIconRight = memoizeOne$1(
153352
153633
  }
153353
153634
  const iconPadding = getIconPadding(
153354
153635
  inputPadding == null ? void 0 : inputPadding.right,
153355
- iconSize ?? DEFAULT_ICON_SIZE$1,
153636
+ iconSize ?? DEFAULT_ICON_SIZE,
153356
153637
  false
153357
153638
  );
153358
153639
  return iconPadding.value;
@@ -153866,7 +154147,7 @@ class DatePickerComponent extends React__default.Component {
153866
154147
  DynamicSVG,
153867
154148
  {
153868
154149
  iconName: this.props.icon,
153869
- size: this.props.iconSize ?? DEFAULT_ICON_SIZE$1
154150
+ size: this.props.iconSize ?? DEFAULT_ICON_SIZE
153870
154151
  }
153871
154152
  )
153872
154153
  }
@@ -153899,258 +154180,6 @@ class DatePickerComponent extends React__default.Component {
153899
154180
  );
153900
154181
  }
153901
154182
  }
153902
- const DEFAULT_ICON_SIZE = 18;
153903
- const DropdownEntireObjectOption$1 = "$$ENTIRE_OBJECT";
153904
- const INVALID_LABEL_MSG = "Invalid label, should be a string";
153905
- const extractDropdownOptions = (options, transformation) => {
153906
- let opts = options;
153907
- if (!Array.isArray(options)) {
153908
- opts = [options];
153909
- }
153910
- let defaultLabelKey;
153911
- const useEntireObjectAsValue = (transformation == null ? void 0 : transformation.value) === DropdownEntireObjectOption$1;
153912
- const optionWithDefaultKey = (option) => {
153913
- var _a2;
153914
- if (defaultLabelKey) {
153915
- return {
153916
- label: typeof option[defaultLabelKey] === "object" ? INVALID_LABEL_MSG : option[defaultLabelKey],
153917
- value: option
153918
- };
153919
- } else {
153920
- defaultLabelKey = (_a2 = Object.keys(option).sort()) == null ? void 0 : _a2[0];
153921
- return {
153922
- label: typeof option[defaultLabelKey] === "object" ? INVALID_LABEL_MSG : option[defaultLabelKey],
153923
- value: option
153924
- };
153925
- }
153926
- };
153927
- return opts.map((option) => {
153928
- if (!option) {
153929
- return null;
153930
- }
153931
- if (typeof option !== "object") {
153932
- return { label: option, value: option };
153933
- }
153934
- if (transformation) {
153935
- if (option[transformation.label] == null || !useEntireObjectAsValue && option[transformation.value] == null) {
153936
- return optionWithDefaultKey(option);
153937
- }
153938
- return {
153939
- label: typeof option[transformation.label] === "object" ? INVALID_LABEL_MSG : option[transformation.label],
153940
- value: useEntireObjectAsValue ? option : option[transformation.value]
153941
- };
153942
- }
153943
- if (option.label == null || option.value == null) {
153944
- return optionWithDefaultKey(option);
153945
- }
153946
- return option;
153947
- }).filter((opt) => opt && opt.value != null && opt.label != null);
153948
- };
153949
- const CellStyle = Ae$1`
153950
- border-radius: 4px;
153951
- z-index: 3;
153952
- ${({ $position }) => {
153953
- return Ae$1`
153954
- width: ${($position == null ? void 0 : $position.width) ? ($position == null ? void 0 : $position.width) - 2 : ""}px;
153955
- `;
153956
- }};
153957
- box-shadow:
153958
- 0px 0px 1px rgba(27, 30, 34, 0.24),
153959
- 0px 1px 3px rgba(27, 30, 34, 0.12),
153960
- 0px 12px 24px rgba(27, 30, 34, 0.12);
153961
- .bp5-control-group:not(.bp5-vertical) > *:not(.bp5-divider) {
153962
- margin-right: 0px;
153963
- }
153964
- .bp5-control-group {
153965
- // TODO(wylie): Follow the instructions here for removing .bp5-popover-wrapper
153966
- // https://github.com/palantir/blueprint/wiki/Popover2-migration
153967
- .bp5-input-group::before {
153968
- top: 2px;
153969
- height: 100%;
153970
- }
153971
- }
153972
- &&& {
153973
- .bp5-input,
153974
- .bp5-multi-select {
153975
- border: none !important; // blueprint border style is important, need to override
153976
- .bp5-tag-input-values {
153977
- margin-top: 0px;
153978
- }
153979
- }
153980
- }
153981
-
153982
- &&&&& {
153983
- .bp5-tag {
153984
- margin-top: 1px;
153985
- }
153986
- }
153987
-
153988
- position: absolute;
153989
- top: 0px;
153990
- left: 0px;
153991
- `;
153992
- const InputCellWrapper = qe$1.div`
153993
- ${CellStyle}
153994
- position: absolute;
153995
- top: 0;
153996
- left: 0;
153997
- &&&&& {
153998
- textarea {
153999
- padding-top: 0px;
154000
- padding-bottom: 0px;
154001
- }
154002
- input {
154003
- ${(props2) => {
154004
- var _a2, _b2;
154005
- const height = ((_a2 = props2.$position) == null ? void 0 : _a2.height) != null ? (_b2 = props2.$position) == null ? void 0 : _b2.height : 0;
154006
- if (height) {
154007
- return `height: ${height}px;`;
154008
- }
154009
- }}
154010
- }
154011
- textarea,
154012
- input {
154013
- padding-left: 10px;
154014
- min-height: ${({ $position, $rowDensity }) => {
154015
- const minHeight = ($position == null ? void 0 : $position.height) != null ? ($position == null ? void 0 : $position.height) - TABLE_SIZES[$rowDensity].ROW_PADDING * 2 : 0;
154016
- return `${minHeight}px`;
154017
- }};
154018
- text-align: ${(props2) => {
154019
- var _a2;
154020
- if ((_a2 = props2 == null ? void 0 : props2.cellProperties) == null ? void 0 : _a2.horizontalAlign) {
154021
- return TEXT_ALIGN[props2.cellProperties.horizontalAlign];
154022
- }
154023
- }};
154024
- font-size: ${(props2) => {
154025
- return `${TABLE_SIZES[props2.$rowDensity].ROW_FONT_SIZE}px`;
154026
- }};
154027
- line-height: 1.5;
154028
- border: none;
154029
- &:focus {
154030
- border: none;
154031
- box-shadow: none;
154032
- }
154033
- }
154034
- }
154035
- `;
154036
- const DropdownCellWrapper = qe$1.div`
154037
- ${CellStyle};
154038
- height: 100%;
154039
- .${CONTROL_GROUP} {
154040
- height: 100%;
154041
- }
154042
-
154043
- &&&&& .${POPOVER_OPEN$1} input {
154044
- ${({ clearable }) => clearable && "padding-right: 50px"}
154045
- }
154046
-
154047
- .dropdown-wrapper {
154048
- height: 100%;
154049
- *:not(.${CLASS_NAMES.DROPDOWN_CLEAR_ICON}) {
154050
- height: 100%;
154051
- }
154052
- .${CLASS_NAMES.INPUT}::before {
154053
- top: calc(50% + 1px);
154054
- transform: translateY(-50%);
154055
- height: ${DEFAULT_ICON_SIZE}px;
154056
- }
154057
-
154058
- input {
154059
- height: 100%;
154060
- }
154061
- }
154062
- `;
154063
- const DateCellWrapper = qe$1(DropdownCellWrapper)`
154064
- ${CellStyle}
154065
- height: 100%;
154066
- .${CONTROL_GROUP} {
154067
- height: 100%;
154068
- }
154069
- .${POPOVER_TARGET$1} {
154070
- height: 100%;
154071
- * {
154072
- height: 100%;
154073
- }
154074
- }
154075
- &&&&& {
154076
- input {
154077
- height: 100%;
154078
- min-height: 100%;
154079
- top: 0px;
154080
- padding-top: 0px;
154081
- padding-bottom: 0px;
154082
- }
154083
- }
154084
- `;
154085
- const EditDateCell = (props2) => {
154086
- const { value, editProps, inputPosition } = props2;
154087
- const { handleEditStop, editMinDate, editMaxDate, editTwentyFourHourTime } = editProps;
154088
- const {
154089
- inputFormat,
154090
- outputFormat,
154091
- timezone,
154092
- manageTimezone,
154093
- displayTimezone
154094
- } = props2.cellProps;
154095
- const [date4, setDate2] = useState(value);
154096
- const [closed, setClosed] = useState(false);
154097
- const handleDateChange = useCallback(
154098
- (date22) => {
154099
- setDate2(date22);
154100
- },
154101
- [setDate2]
154102
- );
154103
- const handleDatepickerClose = useCallback(() => {
154104
- if (closed) return;
154105
- setClosed(true);
154106
- handleEditStop({ shouldSave: true, value: date4, validationErrors: [] });
154107
- }, [handleEditStop, closed, date4]);
154108
- useEffect(() => {
154109
- return () => {
154110
- handleEditStop({ shouldSave: false });
154111
- };
154112
- }, []);
154113
- const formattedMinDate = useMemo$2(() => {
154114
- if (editMinDate) {
154115
- return hooks(editMinDate, ISO_DATE_FORMAT).format(ISO_DATE_FORMAT);
154116
- }
154117
- }, [editMinDate]);
154118
- const formattedMaxDate = useMemo$2(() => {
154119
- if (editMaxDate) {
154120
- return hooks(editMaxDate, ISO_DATE_FORMAT).format(ISO_DATE_FORMAT);
154121
- }
154122
- }, [editMaxDate]);
154123
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
154124
- DateCellWrapper,
154125
- {
154126
- $position: inputPosition,
154127
- $rowDensity: props2.rowDensity,
154128
- cellProperties: props2.cellProps.cellProperties,
154129
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
154130
- DatePickerComponent,
154131
- {
154132
- label: "",
154133
- dateFormat: inputFormat,
154134
- displayDateFormat: outputFormat,
154135
- datePickerType: DatePickerType.DATE_PICKER,
154136
- onDateSelected: handleDateChange,
154137
- isLoading: false,
154138
- isDisabled: false,
154139
- selectedDate: date4,
154140
- forceOpen: true,
154141
- onDatePickerClosed: handleDatepickerClose,
154142
- use24HourTime: editTwentyFourHourTime ?? true,
154143
- minDate: formattedMinDate,
154144
- maxDate: formattedMaxDate,
154145
- timezone: manageTimezone ? timezone : void 0,
154146
- displayTimezone: manageTimezone ? displayTimezone : void 0,
154147
- showTimezone: false,
154148
- errorMessagePlacement: "tooltip"
154149
- }
154150
- )
154151
- }
154152
- );
154153
- };
154154
154183
  function usePointerDownOutside({
154155
154184
  wrapperRefs,
154156
154185
  wrapperIds,
@@ -154197,385 +154226,6 @@ function usePointerDownOutside({
154197
154226
  };
154198
154227
  }, [wrapperRefs, wrapperIds, wrapperSelectors, onClickOutside]);
154199
154228
  }
154200
- const EditInputCell = (props2) => {
154201
- var _a2, _b2, _c2;
154202
- const { value, editProps, targetCellRef, inputPosition } = props2;
154203
- const {
154204
- handleEditStop,
154205
- editInputType,
154206
- editCustomValidationRule,
154207
- editCustomErrorMessage,
154208
- editMaxLength,
154209
- editMinLength,
154210
- editIsRequired,
154211
- handleEditChange
154212
- } = editProps;
154213
- const [inputValue, setInputValue] = useState(
154214
- typeof value === "object" && value ? JSON.stringify(value, null, 2) : value
154215
- );
154216
- const inputMemo = useRef(inputValue);
154217
- const [validationErrors, setValidationErrors] = useState([]);
154218
- const inputWrapperRef = useRef(null);
154219
- const validateValue = useCallback(
154220
- (toValidate) => {
154221
- const errors2 = getInputValidationErrors({
154222
- inputType: editInputType ?? "TEXT",
154223
- text: String(toValidate ?? ""),
154224
- emailRegex: new RegExp(`^${EmailRegexString}$`),
154225
- customValidationRule: String(editCustomValidationRule),
154226
- customErrorMessage: editCustomErrorMessage,
154227
- maxLength: editMaxLength,
154228
- minLength: editMinLength,
154229
- isRequired: editIsRequired ?? false
154230
- });
154231
- const validationErrors2 = getErrorMessages(errors2);
154232
- setValidationErrors(validationErrors2);
154233
- return validationErrors2;
154234
- },
154235
- [
154236
- editInputType,
154237
- editCustomValidationRule,
154238
- editCustomErrorMessage,
154239
- editMaxLength,
154240
- editMinLength,
154241
- editIsRequired
154242
- ]
154243
- );
154244
- useEffect(() => {
154245
- validateValue(inputMemo.current);
154246
- }, [validateValue]);
154247
- const debouncedValidation = c(validateValue, 50);
154248
- const handleValueChange = useCallback(
154249
- (val) => {
154250
- setInputValue(val);
154251
- inputMemo.current = val;
154252
- handleEditChange(val);
154253
- debouncedValidation(val);
154254
- },
154255
- [debouncedValidation, handleEditChange]
154256
- );
154257
- const handleKeyDown = useCallback(
154258
- (e3) => {
154259
- if (e3.key === "Enter") {
154260
- e3.preventDefault();
154261
- const errors2 = validateValue(inputMemo.current);
154262
- handleEditStop({
154263
- shouldSave: true,
154264
- value: inputMemo.current,
154265
- validationErrors: errors2
154266
- });
154267
- }
154268
- if (e3.key !== "Tab" && e3.key !== "Escape" && e3.key !== "Enter") {
154269
- e3.stopPropagation();
154270
- }
154271
- },
154272
- [handleEditStop, validateValue]
154273
- );
154274
- const saveChange = useCallback(() => {
154275
- handleEditStop({
154276
- shouldSave: true,
154277
- value: inputValue,
154278
- validationErrors
154279
- });
154280
- }, [handleEditStop, inputValue, validationErrors]);
154281
- usePointerDownOutside({
154282
- wrapperRefs: [inputWrapperRef],
154283
- wrapperSelectors: ["[data-test=table-edit-input]"],
154284
- onClickOutside: saveChange
154285
- });
154286
- useEffect(() => {
154287
- return () => {
154288
- handleEditStop({ shouldSave: false });
154289
- };
154290
- }, []);
154291
- if (!targetCellRef.current || typeof (inputPosition == null ? void 0 : inputPosition.top) === "undefined" || // Validate that the intended element exists
154292
- !((_c2 = (_b2 = (_a2 = targetCellRef.current.childNodes) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.getAttribute) == null ? void 0 : _c2.call(
154293
- _b2,
154294
- "data-superblocks"
154295
- ))) {
154296
- return null;
154297
- }
154298
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
154299
- Popper,
154300
- {
154301
- targetNode: targetCellRef.current.childNodes[0],
154302
- isOpen: true,
154303
- placement: "auto",
154304
- useDefaultModifiers: false,
154305
- zIndex: 1,
154306
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
154307
- InputCellWrapper,
154308
- {
154309
- "data-test": `table-edit-input`,
154310
- $position: inputPosition,
154311
- $rowDensity: props2.rowDensity,
154312
- cellProperties: props2.cellProps.cellProperties,
154313
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
154314
- "input",
154315
- {
154316
- value: inputValue,
154317
- onChange: handleValueChange,
154318
- onKeyDown: handleKeyDown
154319
- }
154320
- )
154321
- }
154322
- )
154323
- }
154324
- );
154325
- };
154326
- const EditMultiSelectCell = (props2) => {
154327
- const dropdownRef = useRef(null);
154328
- const { editProps, inputPosition, cellProps } = props2;
154329
- const {
154330
- currentEditValue,
154331
- handleEditStop,
154332
- handleEditChange,
154333
- editIsRequired,
154334
- editOptions = [],
154335
- transformation,
154336
- onDropdownSearchTextChanged
154337
- // editDropdownClientSideFiltering,
154338
- // currentEditDropdownSearchText,
154339
- // dropdownOptionsLoading,
154340
- } = editProps;
154341
- const selectedOptions = useMemo$2(() => {
154342
- return Array.isArray(currentEditValue) ? currentEditValue : currentEditValue != null ? [currentEditValue] : [];
154343
- }, [currentEditValue]);
154344
- const transformedEditOptions = useMemo$2(() => {
154345
- return extractDropdownOptions(editOptions, transformation);
154346
- }, [editOptions, transformation]);
154347
- useMemo$2(() => {
154348
- return selectedOptions ? selectedOptions.map((o) => lodashExports.findIndex(transformedEditOptions, { value: o })).filter((ind) => ind !== -1) : [];
154349
- }, [selectedOptions, transformedEditOptions]);
154350
- useCallback(
154351
- (selectedOption) => {
154352
- if (selectedOption) {
154353
- const isAlreadySelected = selectedOptions.includes(
154354
- selectedOption.value
154355
- );
154356
- if (!isAlreadySelected) {
154357
- handleEditChange(
154358
- [...selectedOptions, selectedOption.value],
154359
- [
154360
- {
154361
- label: selectedOption.label,
154362
- value: JSON.stringify(selectedOption.value)
154363
- }
154364
- ]
154365
- );
154366
- } else {
154367
- handleEditChange(
154368
- selectedOptions.filter(
154369
- (opt) => opt !== selectedOption.value,
154370
- [selectedOption]
154371
- )
154372
- );
154373
- }
154374
- }
154375
- },
154376
- [handleEditChange, selectedOptions]
154377
- );
154378
- useCallback(
154379
- (removedIndex) => {
154380
- const newSelectedValues = selectedOptions.filter(
154381
- (value) => lodashExports.findIndex(transformedEditOptions, { value }) !== removedIndex
154382
- );
154383
- handleEditChange(newSelectedValues);
154384
- },
154385
- [handleEditChange, selectedOptions, transformedEditOptions]
154386
- );
154387
- useCallback(
154388
- (options) => {
154389
- handleEditChange(
154390
- options.map(({ value }) => value),
154391
- options.map((val) => ({ ...val, value: JSON.stringify(val.value) }))
154392
- );
154393
- },
154394
- [handleEditChange]
154395
- );
154396
- useCallback(
154397
- (query) => {
154398
- onDropdownSearchTextChanged == null ? void 0 : onDropdownSearchTextChanged(query);
154399
- },
154400
- [onDropdownSearchTextChanged]
154401
- );
154402
- const handleDropdownClose = useCallback(() => {
154403
- const validationErrors = selectedOptions.length === 0 && editIsRequired ? ["This field is required"] : [];
154404
- handleEditStop({
154405
- shouldSave: true,
154406
- value: selectedOptions,
154407
- validationErrors
154408
- });
154409
- }, [handleEditStop, selectedOptions, editIsRequired]);
154410
- usePointerDownOutside({
154411
- onClickOutside: handleDropdownClose,
154412
- wrapperRefs: [dropdownRef],
154413
- wrapperSelectors: [".bp5-multi-select-popover"]
154414
- });
154415
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
154416
- DropdownCellWrapper,
154417
- {
154418
- $position: inputPosition,
154419
- $rowDensity: props2.rowDensity,
154420
- ref: dropdownRef,
154421
- cellProperties: cellProps.cellProperties
154422
- }
154423
- );
154424
- };
154425
- const EditSingleSelectCell = (props2) => {
154426
- const { value, editProps, inputPosition } = props2;
154427
- const {
154428
- handleEditStop,
154429
- // editIsRequired,
154430
- editOptions = [],
154431
- transformation,
154432
- onDropdownSearchTextChanged,
154433
- editDropdownClientSideFiltering,
154434
- // currentEditDropdownSearchText,
154435
- // dropdownOptionsLoading,
154436
- allowClearing
154437
- } = editProps;
154438
- const transformedEditOptions = useMemo$2(() => {
154439
- return extractDropdownOptions(editOptions, transformation);
154440
- }, [editOptions, transformation]);
154441
- useMemo$2(() => {
154442
- return transformedEditOptions.findIndex((opt) => opt.value === value);
154443
- }, [value, transformedEditOptions]);
154444
- useCallback(
154445
- (val) => {
154446
- handleEditStop({
154447
- shouldSave: true,
154448
- value: val == null ? void 0 : val.value,
154449
- validationErrors: [],
154450
- dropdownOption: {
154451
- ...val,
154452
- value: (val == null ? void 0 : val.value) ? JSON.stringify(val == null ? void 0 : val.value) : ""
154453
- }
154454
- });
154455
- },
154456
- [handleEditStop]
154457
- );
154458
- useCallback(
154459
- (query) => {
154460
- onDropdownSearchTextChanged == null ? void 0 : onDropdownSearchTextChanged(query);
154461
- },
154462
- [onDropdownSearchTextChanged]
154463
- );
154464
- useEffect(() => {
154465
- return () => {
154466
- if (editDropdownClientSideFiltering) {
154467
- handleEditStop({ shouldSave: false });
154468
- }
154469
- };
154470
- }, [editDropdownClientSideFiltering]);
154471
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
154472
- DropdownCellWrapper,
154473
- {
154474
- $rowDensity: props2.rowDensity,
154475
- cellProperties: props2.cellProps.cellProperties,
154476
- $position: inputPosition,
154477
- clearable: allowClearing
154478
- }
154479
- );
154480
- };
154481
- const useGetInputPosition = (tableEl, cellEl) => {
154482
- const firstRender = useRef(true);
154483
- const [tableRect, setTableRect] = useState();
154484
- const [cellRect, setCellRect] = useState();
154485
- const measureTable = useCallback(() => {
154486
- if (tableEl) {
154487
- setTableRect(tableEl.getBoundingClientRect());
154488
- }
154489
- }, [tableEl]);
154490
- const measureCell = useCallback(() => {
154491
- if (cellEl) {
154492
- setCellRect(cellEl.getBoundingClientRect());
154493
- }
154494
- }, [cellEl]);
154495
- const measureCellAndTable = useCallback(() => {
154496
- measureCell();
154497
- measureTable();
154498
- }, [measureCell, measureTable]);
154499
- const debouncedMeasureCellAndTable = c(
154500
- measureCellAndTable,
154501
- 10
154502
- );
154503
- const debouncedMeasureCell = c(measureCell, 10);
154504
- useLayoutEffect$2(measureTable, [measureTable]);
154505
- useLayoutEffect$2(measureCell, [measureCell]);
154506
- if (firstRender.current) {
154507
- firstRender.current = false;
154508
- measureTable();
154509
- measureCell();
154510
- }
154511
- useEffect(() => {
154512
- if (debouncedMeasureCell) {
154513
- tableEl == null ? void 0 : tableEl.addEventListener("scroll", debouncedMeasureCell);
154514
- }
154515
- return () => {
154516
- if (debouncedMeasureCell) {
154517
- tableEl == null ? void 0 : tableEl.removeEventListener("scroll", debouncedMeasureCell);
154518
- }
154519
- };
154520
- }, [tableEl, debouncedMeasureCell]);
154521
- useResizeObserver(
154522
- tableEl,
154523
- debouncedMeasureCellAndTable ?? measureCellAndTable
154524
- );
154525
- useResizeObserver(cellEl, debouncedMeasureCell ?? measureCell);
154526
- const top2 = cellRect && tableRect && tableEl ? cellRect.top - tableRect.top + tableEl.scrollTop : void 0;
154527
- const left2 = cellRect && tableRect && tableEl ? cellRect.left - tableRect.left + tableEl.scrollLeft : void 0;
154528
- return {
154529
- width: (cellRect == null ? void 0 : cellRect.width) && left2 === 0 ? (cellRect == null ? void 0 : cellRect.width) - 10 : cellRect == null ? void 0 : cellRect.width,
154530
- height: cellRect == null ? void 0 : cellRect.height,
154531
- top: top2,
154532
- left: left2 === 0 ? 10 : left2,
154533
- maxHeight: tableRect && top2 ? (tableRect == null ? void 0 : tableRect.height) - top2 : void 0
154534
- };
154535
- };
154536
- const EditCell = (props2) => {
154537
- var _a2;
154538
- const tableRef = useRef(
154539
- document == null ? void 0 : document.querySelector(
154540
- `[data-test=table-component-${props2.tableName}] tbody`
154541
- )
154542
- );
154543
- const inputPosition = useGetInputPosition(
154544
- tableRef == null ? void 0 : tableRef.current,
154545
- (_a2 = props2.targetCellRef) == null ? void 0 : _a2.current
154546
- );
154547
- const propsToPass = useMemo$2(() => {
154548
- return {
154549
- editProps: props2.editProps,
154550
- value: props2.value,
154551
- rowDensity: props2.rowDensity,
154552
- cellProps: props2.cellProps,
154553
- inputPosition,
154554
- theme: props2.theme
154555
- };
154556
- }, [
154557
- inputPosition,
154558
- props2.cellProps,
154559
- props2.rowDensity,
154560
- props2.editProps,
154561
- props2.value,
154562
- props2.theme
154563
- ]);
154564
- switch (props2.editProps.editInputType) {
154565
- case EditInputType.Dropdown:
154566
- if (props2.editProps.editMultiSelect) {
154567
- return /* @__PURE__ */ jsxRuntimeExports.jsx(EditMultiSelectCell, { ...propsToPass });
154568
- }
154569
- return /* @__PURE__ */ jsxRuntimeExports.jsx(EditSingleSelectCell, { ...propsToPass });
154570
- case EditInputType.Date:
154571
- return /* @__PURE__ */ jsxRuntimeExports.jsx(EditDateCell, { ...propsToPass });
154572
- case EditInputType.Email:
154573
- case EditInputType.Number:
154574
- case EditInputType.Text:
154575
- default:
154576
- return /* @__PURE__ */ jsxRuntimeExports.jsx(EditInputCell, { ...propsToPass, targetCellRef: props2.targetCellRef });
154577
- }
154578
- };
154579
154229
  const CheckboxInput = ({
154580
154230
  isChecked,
154581
154231
  isDisabled,
@@ -154626,279 +154276,6 @@ const CheckboxInput = ({
154626
154276
  }
154627
154277
  );
154628
154278
  };
154629
- const StyledCellWrapper = qe$1(CellWrapper)`
154630
- ${(props2) => {
154631
- var _a2, _b2;
154632
- return ((_a2 = props2 == null ? void 0 : props2.cellProperties) == null ? void 0 : _a2.horizontalAlign) === HorizontalAlignment.right ? "padding-right: 10px;" : ((_b2 = props2 == null ? void 0 : props2.cellProperties) == null ? void 0 : _b2.horizontalAlign) === HorizontalAlignment.center ? "padding-left: 19px;" : "";
154633
- }};
154634
-
154635
- > div {
154636
- width: unset !important;
154637
- }
154638
-
154639
- .checkbox-container {
154640
- display: none;
154641
- }
154642
-
154643
- .read-mode-component {
154644
- display: flex;
154645
- }
154646
-
154647
- &[data-is-focused="true"] {
154648
- .read-mode-component {
154649
- display: none;
154650
- }
154651
-
154652
- .checkbox-container {
154653
- display: flex;
154654
- }
154655
- }
154656
-
154657
- &:hover:not([data-is-focused="true"]) {
154658
- .read-mode-component {
154659
- display: none;
154660
- }
154661
-
154662
- .checkbox-container {
154663
- display: flex;
154664
- }
154665
- }
154666
- `;
154667
- const EditCheckboxCell = (props2) => {
154668
- var _a2;
154669
- const {
154670
- value,
154671
- editProps,
154672
- readModeComponent,
154673
- isFocused: propsIsFocused
154674
- } = props2;
154675
- const { handleOneClickEdit } = editProps;
154676
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
154677
- StyledCellWrapper,
154678
- {
154679
- rowDensity: props2.rowDensity,
154680
- cellProperties: props2.cellProperties,
154681
- "data-is-focused": propsIsFocused,
154682
- "data-test": `edit-checkbox-active-${value}`,
154683
- style: {
154684
- height: ((_a2 = TABLE_SIZES == null ? void 0 : TABLE_SIZES[props2.rowDensity]) == null ? void 0 : _a2.ROW_HEIGHT) - 8
154685
- },
154686
- children: [
154687
- /* @__PURE__ */ jsxRuntimeExports.jsx(
154688
- "div",
154689
- {
154690
- className: "read-mode-component",
154691
- "data-test": `edit-checkbox-${value}`,
154692
- style: {
154693
- height: "100%",
154694
- alignItems: "center"
154695
- },
154696
- children: readModeComponent
154697
- }
154698
- ),
154699
- /* @__PURE__ */ jsxRuntimeExports.jsx(
154700
- CheckboxInput,
154701
- {
154702
- isChecked: value,
154703
- isValid: true,
154704
- isDisabled: false,
154705
- onClick: handleOneClickEdit
154706
- }
154707
- )
154708
- ]
154709
- }
154710
- );
154711
- };
154712
- const LinkLike = qe$1.div`
154713
- cursor: pointer;
154714
- `;
154715
- const IconStyles = Ae$1`
154716
- height: ${({ rowDensity }) => {
154717
- var _a2;
154718
- return ((_a2 = TABLE_SIZES[rowDensity]) == null ? void 0 : _a2.LINK_MENU_HEIGHT) ?? 32;
154719
- }}px;
154720
- padding: ${({ rowDensity }) => rowDensity === RowDensity["extra-small"] ? "7px" : rowDensity === RowDensity.small ? "9px" : "10px"};
154721
- `;
154722
- const StyledButton = qe$1(Button$5)`
154723
- border: none;
154724
- ${IconStyles}
154725
- `;
154726
- const LinkMenu = qe$1.div`
154727
- display: flex;
154728
- align-items: center;
154729
- a {
154730
- ${IconStyles}
154731
- }
154732
-
154733
- svg > path {
154734
- fill: none !important;
154735
- }
154736
- `;
154737
- const OpenLinkButton = ({
154738
- url: url2,
154739
- openInNewTab,
154740
- rowDensity
154741
- }) => {
154742
- var _a2, _b2, _c2, _d2;
154743
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$2, { title: "Open", children: openInNewTab === void 0 || openInNewTab === true ? (
154744
- // todo laura: ask omar about how linking should work
154745
- /* @__PURE__ */ jsxRuntimeExports.jsx(
154746
- "a",
154747
- {
154748
- href: url2,
154749
- target: "_blank",
154750
- "aria-disabled": true,
154751
- "data-test": "table-cell-link-open",
154752
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
154753
- SvgExternalLink,
154754
- {
154755
- style: {
154756
- height: ((_a2 = TABLE_SIZES[rowDensity]) == null ? void 0 : _a2.LINK_MENU_ICON_SIZE) ?? 16,
154757
- width: ((_b2 = TABLE_SIZES[rowDensity]) == null ? void 0 : _b2.LINK_MENU_ICON_SIZE) ?? 16
154758
- }
154759
- }
154760
- )
154761
- }
154762
- )
154763
- ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
154764
- PlainLink,
154765
- {
154766
- href: url2,
154767
- rel: "noreferrer nofollow",
154768
- target: "_parent",
154769
- "data-test": "table-cell-link-open",
154770
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
154771
- SvgExternalLink,
154772
- {
154773
- style: {
154774
- height: ((_c2 = TABLE_SIZES[rowDensity]) == null ? void 0 : _c2.LINK_MENU_ICON_SIZE) ?? 16,
154775
- width: ((_d2 = TABLE_SIZES[rowDensity]) == null ? void 0 : _d2.LINK_MENU_ICON_SIZE) ?? 16
154776
- }
154777
- }
154778
- )
154779
- }
154780
- ) });
154781
- };
154782
- const EditableLinkCell = (props2) => {
154783
- const {
154784
- isHidden: isHidden2,
154785
- url: url2,
154786
- label,
154787
- openInNewTab,
154788
- isEdited,
154789
- value,
154790
- cellProperties,
154791
- rowDensity,
154792
- isFocused,
154793
- defaultValue: defaultValue2,
154794
- maxLinesPerRow,
154795
- isMultiselecting
154796
- } = props2;
154797
- const [isMenuOpen, setIsMenuOpen] = useState(false);
154798
- const cellRef = useRef(null);
154799
- const popperRef = useRef(null);
154800
- useEffect(() => {
154801
- if (isMenuOpen && !isFocused) {
154802
- setIsMenuOpen(false);
154803
- } else if (!isMenuOpen && isFocused) {
154804
- setIsMenuOpen(true);
154805
- }
154806
- }, [isFocused, isMenuOpen]);
154807
- const { cellTextStyle, horizontalAlign, verticalAlign, textWrap } = cellProperties;
154808
- const [className, styles] = useMemo$2(() => {
154809
- const options = {
154810
- canWrap: textWrap,
154811
- maxLines: maxLinesPerRow
154812
- };
154813
- return [
154814
- getCellClass(options),
154815
- {
154816
- ...getCellWrapStyles(options),
154817
- ...buildCellStyles({
154818
- cellTextStyle,
154819
- horizontalAlign,
154820
- verticalAlign
154821
- })
154822
- }
154823
- ];
154824
- }, [textWrap, maxLinesPerRow, cellTextStyle, horizontalAlign, verticalAlign]);
154825
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
154826
- CellWrapper,
154827
- {
154828
- ref: cellRef,
154829
- isHidden: isHidden2,
154830
- cellProperties,
154831
- rowDensity,
154832
- className,
154833
- style: styles,
154834
- children: [
154835
- !value && defaultValue2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(DefaultValueWrapper, { children: defaultValue2 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
154836
- LinkLike,
154837
- {
154838
- style: {
154839
- height: "100%",
154840
- display: "flex",
154841
- alignItems: "center"
154842
- },
154843
- className: CLASS_NAMES.LINK,
154844
- children: isEdited ? value : label
154845
- }
154846
- ),
154847
- isMenuOpen && /* @__PURE__ */ jsxRuntimeExports.jsx(
154848
- Popper,
154849
- {
154850
- zIndex: 3,
154851
- isOpen: isMenuOpen,
154852
- targetNode: cellRef.current || void 0,
154853
- placement: "bottom-start",
154854
- ref: popperRef,
154855
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
154856
- LinkMenu,
154857
- {
154858
- "data-test": "table-cell-link-menu",
154859
- rowDensity,
154860
- className: CLASS_NAMES.POPOVER_WRAPPER,
154861
- style: isMultiselecting ? {
154862
- display: "none"
154863
- } : void 0,
154864
- children: [
154865
- /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$2, { title: "Copy", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
154866
- StyledButton,
154867
- {
154868
- rowDensity,
154869
- onClick: () => {
154870
- copy$1(url2);
154871
- },
154872
- "data-test": "table-cell-link-copy",
154873
- type: "link",
154874
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
154875
- SvgCopy,
154876
- {
154877
- style: {
154878
- height: 16,
154879
- width: 16
154880
- }
154881
- }
154882
- )
154883
- }
154884
- ) }),
154885
- /* @__PURE__ */ jsxRuntimeExports.jsx(
154886
- OpenLinkButton,
154887
- {
154888
- url: url2,
154889
- openInNewTab,
154890
- rowDensity
154891
- }
154892
- )
154893
- ]
154894
- }
154895
- )
154896
- }
154897
- )
154898
- ]
154899
- }
154900
- );
154901
- };
154902
154279
  var lib = {};
154903
154280
  var players = {};
154904
154281
  var utils = {};
@@ -161183,7 +160560,7 @@ const formatByType = (value, type5, options) => {
161183
160560
  return text;
161184
160561
  }
161185
160562
  };
161186
- const StyledEditableDiv = qe$1.div`
160563
+ qe$1.div`
161187
160564
  position: relative;
161188
160565
  height: 100%;
161189
160566
  width: 100%;
@@ -161207,20 +160584,20 @@ const StyledEditableDiv = qe$1.div`
161207
160584
  }
161208
160585
  }
161209
160586
  `;
161210
- const EditableCellWrapper = qe$1.div`
160587
+ qe$1.div`
161211
160588
  position: relative;
161212
160589
  height: 100%;
161213
160590
  width: 100%;
161214
160591
  padding: 0px;
161215
160592
  `;
161216
- const StyledCheckmarkWrapper = qe$1.div`
160593
+ qe$1.div`
161217
160594
  position: relative;
161218
160595
  height: 100%;
161219
160596
  width: 100%;
161220
160597
  border-radius: 4px;
161221
160598
  overflow: hidden;
161222
160599
  `;
161223
- const EditMarker = qe$1.div`
160600
+ qe$1.div`
161224
160601
  position: absolute;
161225
160602
  top: 0px;
161226
160603
  left: 0px;
@@ -161229,180 +160606,17 @@ const EditMarker = qe$1.div`
161229
160606
  border-style: solid;
161230
160607
  border-width: 10px 10px 0 0;
161231
160608
  `;
161232
- const StyledChevronDown = qe$1(SvgChevronDown)`
160609
+ qe$1(SvgChevronDown)`
161233
160610
  width: 16px;
161234
160611
  height: 16px;
161235
160612
  flex-shrink: 0;
161236
160613
  visibility: hidden;
161237
160614
  `;
161238
- const EditingCellWrapper = qe$1.div`
160615
+ qe$1.div`
161239
160616
  width: 100%;
161240
160617
  height: 100%;
161241
160618
  position: relative;
161242
160619
  `;
161243
- const EditableCell = (props2) => {
161244
- const cellRef = useRef(null);
161245
- const { theme } = props2;
161246
- const {
161247
- validationErrors,
161248
- isEdited,
161249
- isEditFocused,
161250
- handleEditStart,
161251
- editInputType
161252
- } = props2.editProps;
161253
- const isDropdownType = editInputType === EditInputType.Dropdown || editInputType === EditInputType.Date;
161254
- const onEditableCellClick = useCallback(() => {
161255
- if (!isEditFocused && isDropdownType) {
161256
- handleEditStart();
161257
- }
161258
- }, [isEditFocused, isDropdownType, handleEditStart]);
161259
- const onEditableCellDoubleClick = useCallback(
161260
- (e3) => {
161261
- if (!isEditFocused && !isDropdownType) {
161262
- e3.stopPropagation();
161263
- handleEditStart();
161264
- }
161265
- },
161266
- [handleEditStart, isDropdownType, isEditFocused]
161267
- );
161268
- if (editInputType === EditInputType.Checkbox) {
161269
- return /* @__PURE__ */ jsxRuntimeExports.jsx(EditableCellWrapper, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(StyledCheckmarkWrapper, { className: "editable-cell", children: [
161270
- isEdited && /* @__PURE__ */ jsxRuntimeExports.jsx(
161271
- EditMarker,
161272
- {
161273
- style: {
161274
- borderColor: `${theme.colors.primary500} transparent transparent transparent`,
161275
- top: (theme.defaultBorder.borderRadius.value ?? 0) > 8 ? 2 : 0,
161276
- left: (theme.defaultBorder.borderRadius.value ?? 0) > 8 ? 2 : 0
161277
- }
161278
- }
161279
- ),
161280
- /* @__PURE__ */ jsxRuntimeExports.jsx(
161281
- EditCheckboxCell,
161282
- {
161283
- editProps: props2.editProps,
161284
- value: props2.rawValue,
161285
- rowDensity: props2.rowDensity,
161286
- cellProperties: props2.cellProps.cellProperties,
161287
- isFocused: props2.cellProps.isFocused,
161288
- readModeComponent: renderCell({
161289
- value: props2.value,
161290
- columnType: props2.columnType,
161291
- cellProps: props2.cellProps,
161292
- position: props2.position,
161293
- theme
161294
- })
161295
- }
161296
- )
161297
- ] }) });
161298
- }
161299
- if (isEditFocused) {
161300
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(EditingCellWrapper, { ref: cellRef, className: "editing-cell-wrapper", children: [
161301
- /* @__PURE__ */ jsxRuntimeExports.jsx(
161302
- "div",
161303
- {
161304
- "data-superblocks": "table-editor",
161305
- style: { position: "absolute", top: 0, left: 0 }
161306
- }
161307
- ),
161308
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { visibility: "hidden" }, children: renderCell({
161309
- value: props2.value,
161310
- columnType: props2.columnType,
161311
- cellProps: props2.cellProps,
161312
- position: props2.position,
161313
- maxLinesPerRow: props2.maxLinesPerRow,
161314
- theme
161315
- }) }),
161316
- /* @__PURE__ */ jsxRuntimeExports.jsx(
161317
- EditCell,
161318
- {
161319
- targetCellRef: cellRef,
161320
- editProps: props2.editProps,
161321
- value: props2.editProps.editInputType && TextBoxEditTypes.includes(
161322
- props2.editProps.editInputType
161323
- ) ? props2.editProps.currentEditValue : props2.rawValue,
161324
- tableName: props2.tableName,
161325
- rowDensity: props2.rowDensity,
161326
- cellProps: props2.cellProps,
161327
- theme
161328
- }
161329
- )
161330
- ] });
161331
- }
161332
- const { linkUrl, linkLabel, openInNewTab } = props2.cellProps.cellProperties;
161333
- const defaultValue2 = props2.isInserted ? `Set ${props2.columnName}...` : "";
161334
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
161335
- EditableCellWrapper,
161336
- {
161337
- onClick: onEditableCellClick,
161338
- onDoubleClick: onEditableCellDoubleClick,
161339
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
161340
- StyledEditableDiv,
161341
- {
161342
- $isValid: validationErrors.length === 0,
161343
- "data-test": props2.columnType === "link" ? `editable-link-${props2.tableName}-${props2.value}` : `editable-cell-${props2.tableName}-${props2.value}`,
161344
- className: `editable-cell ${isDropdownType ? "dropdown-preview" : ""}`,
161345
- "data-align": props2.cellProps.cellProperties.verticalAlign,
161346
- hoverColor: theme.colors.neutral,
161347
- style: {
161348
- borderRadius: styleFromDimension(theme.defaultBorder.borderRadius),
161349
- ...validationErrors.length === 0 ? {} : {
161350
- border: generateBorderStyle(theme.defaultBorder),
161351
- borderColor: theme.colors.danger
161352
- }
161353
- },
161354
- children: [
161355
- isEdited && /* @__PURE__ */ jsxRuntimeExports.jsx(
161356
- EditMarker,
161357
- {
161358
- style: {
161359
- borderColor: `${theme.colors.primary500} transparent transparent transparent`,
161360
- top: (theme.defaultBorder.borderRadius.value ?? 0) > 8 ? 2 : 0,
161361
- left: (theme.defaultBorder.borderRadius.value ?? 0) > 8 ? 2 : 0
161362
- }
161363
- }
161364
- ),
161365
- props2.columnType === "link" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
161366
- EditableLinkCell,
161367
- {
161368
- url: linkUrl ?? "",
161369
- label: linkLabel ?? linkUrl ?? "",
161370
- openInNewTab,
161371
- isHidden: props2.cellProps.isHidden,
161372
- isEdited,
161373
- value: props2.rawValue,
161374
- cellProperties: props2.cellProps.cellProperties,
161375
- rowDensity: props2.rowDensity,
161376
- isFocused: props2.cellProps.isFocused,
161377
- position: props2.position,
161378
- defaultValue: defaultValue2,
161379
- maxLinesPerRow: props2.maxLinesPerRow,
161380
- isMultiselecting: props2.cellProps.isMultiselecting
161381
- }
161382
- ) : renderCell({
161383
- value: props2.value,
161384
- columnType: props2.columnType,
161385
- editInputType: props2.editProps.editInputType,
161386
- cellProps: props2.cellProps,
161387
- position: props2.position,
161388
- defaultValue: defaultValue2,
161389
- maxLinesPerRow: props2.maxLinesPerRow,
161390
- theme
161391
- }),
161392
- (editInputType === EditInputType.Dropdown || editInputType === EditInputType.Date) && /* @__PURE__ */ jsxRuntimeExports.jsx(
161393
- StyledChevronDown,
161394
- {
161395
- style: {
161396
- color: theme.colors.neutral300
161397
- }
161398
- }
161399
- )
161400
- ]
161401
- }
161402
- )
161403
- }
161404
- );
161405
- };
161406
160620
  const getCellClassAndStyleMemo = lodashExports.memoize(
161407
160621
  (canWrap, maxLines, cellTextStyle, horizontalAlign, verticalAlign) => {
161408
160622
  const options = {
@@ -161424,18 +160638,13 @@ const getCellClassAndStyleMemo = lodashExports.memoize(
161424
160638
  // Custom resolver to create a unique key based on nested properties
161425
160639
  (...args) => JSON.stringify(args)
161426
160640
  );
161427
- function getCellProperties(tableCellTextStyle, columnProperties, rowIndex) {
161428
- var _a2, _b2, _c2, _d2, _e2, _f2;
161429
- const cellTextStyleVariant = getPropertyValue(
161430
- (_b2 = (_a2 = columnProperties.cellProps) == null ? void 0 : _a2.textStyle) == null ? void 0 : _b2.variant,
161431
- rowIndex
161432
- );
161433
- const cellTextStyleColor = getPropertyValue(
161434
- (_e2 = (_d2 = (_c2 = columnProperties.cellProps) == null ? void 0 : _c2.textStyle) == null ? void 0 : _d2.textColor) == null ? void 0 : _e2.default,
161435
- rowIndex
161436
- );
160641
+ function getCellProperties(tableCellTextStyle, columnProperties, currentRow = {}) {
160642
+ var _a2, _b2, _c2;
160643
+ const cellProps = getPropertyValue(columnProperties.cellProps, currentRow);
160644
+ const cellTextStyleColor = (_b2 = (_a2 = cellProps == null ? void 0 : cellProps.textStyle) == null ? void 0 : _a2.textColor) == null ? void 0 : _b2.default;
160645
+ const cellTextStyleVariant = (_c2 = cellProps == null ? void 0 : cellProps.textStyle) == null ? void 0 : _c2.variant;
161437
160646
  const cellTextStyleForRow = {
161438
- ...(_f2 = columnProperties == null ? void 0 : columnProperties.cellProps) == null ? void 0 : _f2.textStyle,
160647
+ ...cellProps == null ? void 0 : cellProps.textStyle,
161439
160648
  variant: cellTextStyleVariant,
161440
160649
  textColor: cellTextStyleColor ? {
161441
160650
  default: cellTextStyleColor
@@ -161443,95 +160652,92 @@ function getCellProperties(tableCellTextStyle, columnProperties, rowIndex) {
161443
160652
  };
161444
160653
  const cellTextStyle = cellTextStyleForRow ?? tableCellTextStyle;
161445
160654
  const cellProperties = {
161446
- isDisabled: getPropertyValue(columnProperties.isDisabled, rowIndex),
160655
+ isDisabled: getPropertyValue(columnProperties.isDisabled, currentRow),
161447
160656
  horizontalAlign: getPropertyValue(
161448
160657
  columnProperties.horizontalAlign,
161449
- rowIndex
160658
+ currentRow
160659
+ ),
160660
+ verticalAlign: getPropertyValue(columnProperties.verticalAlign, currentRow),
160661
+ cellBackground: getPropertyValue(
160662
+ columnProperties.cellBackground,
160663
+ currentRow
161450
160664
  ),
161451
- verticalAlign: getPropertyValue(columnProperties.verticalAlign, rowIndex),
161452
- cellBackground: getPropertyValue(columnProperties.cellBackground, rowIndex),
161453
160665
  buttonBackgroundColor: getPropertyValue(
161454
160666
  columnProperties.buttonBackgroundColor,
161455
- rowIndex
161456
- ),
161457
- buttonBorder: getPropertyValue(
161458
- columnProperties.buttonBorder,
161459
- rowIndex,
161460
- true
160667
+ currentRow
161461
160668
  ),
161462
- buttonVariant: getPropertyValue(columnProperties.buttonVariant, rowIndex),
160669
+ buttonBorder: getPropertyValue(columnProperties.buttonBorder, currentRow),
160670
+ buttonVariant: getPropertyValue(columnProperties.buttonVariant, currentRow),
161463
160671
  buttonTextStyle: getPropertyValue(
161464
160672
  columnProperties.buttonTextStyle,
161465
- rowIndex,
161466
- true
160673
+ currentRow
161467
160674
  ),
161468
160675
  cellIcon: getPropertyValue(
161469
160676
  columnProperties.columnType === "button" ? columnProperties.buttonIcon : columnProperties.cellIcon,
161470
- rowIndex
160677
+ currentRow
161471
160678
  ),
161472
160679
  cellIconPosition: getPropertyValue(
161473
160680
  columnProperties.columnType === "button" ? columnProperties.buttonIconPosition : columnProperties.cellIconPosition,
161474
- rowIndex
160681
+ currentRow
161475
160682
  ) ?? "left",
161476
- buttonLabel: getPropertyValue(columnProperties.buttonLabel, rowIndex, true),
161477
- linkUrl: getPropertyValue(columnProperties.linkUrl, rowIndex, true),
161478
- linkLabel: getPropertyValue(columnProperties.linkLabel, rowIndex, true),
161479
- openInNewTab: getPropertyValue(
161480
- columnProperties.openInNewTab,
161481
- rowIndex,
161482
- true
161483
- ),
160683
+ buttonLabel: getPropertyValue(columnProperties.buttonLabel, currentRow),
160684
+ linkUrl: getPropertyValue(columnProperties.linkUrl, currentRow),
160685
+ linkLabel: getPropertyValue(columnProperties.linkLabel, currentRow),
160686
+ openInNewTab: getPropertyValue(columnProperties.openInNewTab, currentRow),
161484
160687
  cellTextStyle,
161485
160688
  displayedValue: getPropertyValue(
161486
160689
  columnProperties.displayedValue,
161487
- rowIndex,
161488
- true
160690
+ currentRow
161489
160691
  ),
161490
- tagsWrap: getPropertyValue(columnProperties.tagsWrap, rowIndex, true),
161491
- textWrap: getPropertyValue(columnProperties.textWrap, rowIndex, true),
161492
- imageSize: getPropertyValue(columnProperties.imageSize, rowIndex),
160692
+ tagsWrap: getPropertyValue(columnProperties.tagsWrap, currentRow),
160693
+ textWrap: getPropertyValue(columnProperties.textWrap, currentRow),
160694
+ imageSize: getPropertyValue(columnProperties.imageSize, currentRow),
161493
160695
  imageBorderRadius: getPropertyValue(
161494
160696
  columnProperties.imageBorderRadius,
161495
- rowIndex,
161496
- true
161497
- ),
161498
- openImageUrl: getPropertyValue(
161499
- columnProperties.openImageUrl,
161500
- rowIndex,
161501
- true
160697
+ currentRow
161502
160698
  ),
160699
+ openImageUrl: getPropertyValue(columnProperties.openImageUrl, currentRow),
161503
160700
  minimumFractionDigits: getPropertyValue(
161504
160701
  columnProperties.minimumFractionDigits,
161505
- rowIndex
160702
+ currentRow
161506
160703
  ),
161507
160704
  maximumFractionDigits: getPropertyValue(
161508
160705
  columnProperties.maximumFractionDigits,
161509
- rowIndex
160706
+ currentRow
161510
160707
  ),
161511
- currency: getPropertyValue(columnProperties.currency, rowIndex, true),
161512
- inputFormat: getPropertyValue(columnProperties.inputFormat, rowIndex, true),
161513
- outputFormat: getPropertyValue(columnProperties.outputFormat, rowIndex),
160708
+ currency: getPropertyValue(columnProperties.currency, currentRow),
160709
+ inputFormat: getPropertyValue(columnProperties.inputFormat, currentRow),
160710
+ outputFormat: getPropertyValue(columnProperties.outputFormat, currentRow),
161514
160711
  manageTimezone: columnProperties.manageTimezone,
161515
- timezone: getPropertyValue(columnProperties.timezone, rowIndex, true),
160712
+ timezone: getPropertyValue(columnProperties.timezone, currentRow),
161516
160713
  displayTimezone: getPropertyValue(
161517
160714
  columnProperties.displayTimezone,
161518
- rowIndex
160715
+ currentRow
161519
160716
  )
161520
160717
  };
161521
160718
  return cellProperties;
161522
160719
  }
161523
- function getPropertyValue(value, index2, preserveDataType = false) {
161524
- if (value && Array.isArray(value)) {
161525
- if (value[index2]) return value[index2].toString();
161526
- return value[index2];
161527
- } else if (value && !preserveDataType) {
161528
- return value.toString();
161529
- } else {
161530
- return value;
160720
+ function isContextualFunction(value) {
160721
+ return typeof value === "function";
160722
+ }
160723
+ function getPropertyValue(value, currentRow) {
160724
+ if (isContextualFunction(value) && currentRow) {
160725
+ try {
160726
+ return value({ currentRow });
160727
+ } catch (error) {
160728
+ console.error("Error evaluating context-aware property:", error);
160729
+ return void 0;
160730
+ }
160731
+ } else if (isContextualFunction(value)) {
160732
+ return value({ currentRow: {} });
161531
160733
  }
160734
+ return value;
161532
160735
  }
161533
160736
  function getFirstPropertyValue(value) {
161534
- return Array.isArray(value) ? value.find(Boolean) : value;
160737
+ if (isContextualFunction(value)) {
160738
+ return value({ currentRow: {} });
160739
+ }
160740
+ return value;
161535
160741
  }
161536
160742
  const renderCell = ({
161537
160743
  value,
@@ -162715,7 +161921,7 @@ const propertiesDefinition$9 = {
162715
161921
  placeholder: '[{ "col1": "val1" }]',
162716
161922
  isJSConvertible: false,
162717
161923
  helpText: "Takes in an array of objects to display rows in the table. Bind data from an API using {{}}",
162718
- controlType: "COMPUTED_CODE_EDITOR"
161924
+ controlType: "FUNCTION_CODE_EDITOR"
162719
161925
  }),
162720
161926
  // do not let users set the id property
162721
161927
  // id is managed internally by the table (it's always the key of the column)
@@ -162752,11 +161958,12 @@ const propertiesDefinition$9 = {
162752
161958
  helpText: "Enable per column filtering"
162753
161959
  }),
162754
161960
  defaultFilters: Prop.any().readAndWrite().propertiesPanel({
162755
- controlType: "COMPUTED_CODE_EDITOR",
161961
+ controlType: "FUNCTION_CODE_EDITOR",
162756
161962
  label: "Default filters",
162757
161963
  visibility: "SHOW_NAME",
162758
161964
  isJSConvertible: false,
162759
161965
  isRemovable: true,
161966
+ defaultOnAdd: () => Property.Computed(""),
162760
161967
  helpText: "Allows specifying the filters that will be used on page load",
162761
161968
  isVisible: function() {
162762
161969
  return this.isFilterable && this.pageType !== "server-side";
@@ -162833,6 +162040,8 @@ const propertiesDefinition$9 = {
162833
162040
  label: "Default sort",
162834
162041
  helpText: "Allows specifying the sort options that will be used on page load",
162835
162042
  controlType: "DEFAULT_TABLE_SORT",
162043
+ isRemovable: true,
162044
+ visibility: "SHOW_NAME",
162836
162045
  childrenDisplayMode: {
162837
162046
  type: "popover",
162838
162047
  title: "Default sort"
@@ -162841,6 +162050,8 @@ const propertiesDefinition$9 = {
162841
162050
  defaultSearchText: Prop.string().readAndWrite().propertiesPanel({
162842
162051
  label: "Default search",
162843
162052
  helpText: "Sets the default search text",
162053
+ isRemovable: true,
162054
+ visibility: "SHOW_NAME",
162844
162055
  isVisible: function() {
162845
162056
  return this.enableClientSideSearch !== false;
162846
162057
  }
@@ -172713,11 +171924,13 @@ const downloadTableData = ({
172713
171924
  );
172714
171925
  const headerData = visibleColumns.map((column2) => column2.Header).map((v2) => sanitizeItem(v2));
172715
171926
  const rowData = data2.map(
172716
- (item, index2) => visibleColumns.map((column2) => {
171927
+ (_15, index2) => visibleColumns.map((column2) => {
171928
+ const itemIndex = (filteredOrderMap == null ? void 0 : filteredOrderMap[index2]) ?? index2;
171929
+ const item = data2[itemIndex];
172717
171930
  const cellProperties = getCellProperties(
172718
171931
  tableCellTextStyle,
172719
171932
  column2.columnProperties,
172720
- (filteredOrderMap == null ? void 0 : filteredOrderMap[index2]) ?? index2
171933
+ item
172721
171934
  );
172722
171935
  const value = item[column2.columnProperties.id];
172723
171936
  return formatByType(value, column2.columnProperties.columnType, {
@@ -174030,7 +173243,7 @@ function getUniqueValues({
174030
173243
  formattedValue: formatByType(
174031
173244
  value,
174032
173245
  columnProperties.columnType,
174033
- getCellProperties(tableCellTextStyle, columnProperties, i3)
173246
+ getCellProperties(tableCellTextStyle, columnProperties, row)
174034
173247
  ),
174035
173248
  rawValue: value,
174036
173249
  index: 0
@@ -174046,7 +173259,7 @@ function getUniqueValues({
174046
173259
  formattedValue: formatByType(
174047
173260
  rawValue,
174048
173261
  columnProperties.columnType,
174049
- getCellProperties(tableCellTextStyle, columnProperties, i3)
173262
+ getCellProperties(tableCellTextStyle, columnProperties, row)
174050
173263
  ),
174051
173264
  rawValue,
174052
173265
  index: 0
@@ -176777,6 +175990,23 @@ const _TableWidget = class _TableWidget extends React__default.Component {
176777
175990
  onComplete();
176778
175991
  }
176779
175992
  });
175993
+ __publicField(this, "columnPropertyFunctionMap", /* @__PURE__ */ new WeakMap());
175994
+ __publicField(this, "functionCounter", 0);
175995
+ __publicField(this, "getColumnPropertiesString", (columnProperties) => {
175996
+ return Object.keys(columnProperties).reduce((acc, key2) => {
175997
+ const val = columnProperties[key2];
175998
+ if (typeof val === "function") {
175999
+ if (!this.columnPropertyFunctionMap.has(val)) {
176000
+ this.columnPropertyFunctionMap.set(
176001
+ val,
176002
+ `__func_${this.functionCounter++}`
176003
+ );
176004
+ }
176005
+ return acc + `${key2} ${this.columnPropertyFunctionMap.get(val)}`;
176006
+ }
176007
+ return acc + `${key2}: ${JSON.stringify(val)}`;
176008
+ });
176009
+ });
176780
176010
  __publicField(this, "getEmptyRow", () => {
176781
176011
  const columnKeys = getAllTableColumnKeys(this.props.tableData);
176782
176012
  const selectedRow = {};
@@ -176846,7 +176076,7 @@ const _TableWidget = class _TableWidget extends React__default.Component {
176846
176076
  }
176847
176077
  return getPropertyValue(
176848
176078
  this.props.columns[columnId].cellBackground,
176849
- originalRowIndex
176079
+ this.props.tableData[originalRowIndex]
176850
176080
  );
176851
176081
  });
176852
176082
  __publicField(this, "getIsLoading", () => {
@@ -177586,7 +176816,6 @@ const _TableWidget = class _TableWidget extends React__default.Component {
177586
176816
  const columnsArray = [];
177587
176817
  const { sortedColumn, columnOrder, columnSizeMap, columns, columnFreezes } = this.props;
177588
176818
  let allColumns = columns;
177589
- const tableProps = this.props;
177590
176819
  const sortColumn = sortedColumn == null ? void 0 : sortedColumn.column;
177591
176820
  const sortOrder = sortedColumn == null ? void 0 : sortedColumn.asc;
177592
176821
  allColumns = reorderColumns(allColumns, columnOrder ?? [], columnFreezes);
@@ -177690,212 +176919,16 @@ const _TableWidget = class _TableWidget extends React__default.Component {
177690
176919
  index: this.props.multiRowSelection ? columnProperties.index + 1 : columnProperties.index,
177691
176920
  notation: columnNotation
177692
176921
  },
177693
- Cell: (props2) => {
177694
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i, _j, _k, _l2, _m2, _n2, _o2, _p2, _q, _r2, _s2, _t2, _u2, _v, _w, _x, _y;
177695
- const currentRowIndex = props2.cell.row.index;
177696
- const originalRowIndex = ((_a2 = this.props.filteredOrderMap) == null ? void 0 : _a2[currentRowIndex]) ?? currentRowIndex;
177697
- const isEdited = ((_b2 = this.props.editOverrides) == null ? void 0 : _b2[originalRowIndex]) != null && columnProperties.id in this.props.editOverrides[originalRowIndex];
177698
- const isInserted = this.getIsRowInserted(originalRowIndex);
177699
- const isDeleted = this.getIsRowDeleted(originalRowIndex);
177700
- const indexInTableDataWithInserts = ((_c2 = this.props.tableDataWithInsertsOrderMap) == null ? void 0 : _c2[originalRowIndex]) ?? originalRowIndex;
177701
- const cellProperties = getCellProperties(
177702
- (_e2 = (_d2 = this.props) == null ? void 0 : _d2.cellProps) == null ? void 0 : _e2.textStyle,
177703
- columnProperties,
177704
- indexInTableDataWithInserts
177705
- );
177706
- const isEditable = !isDeleted && (isInserted ? columnProperties.isEditableOnInsertion : columnProperties.isEditable);
177707
- if (isEditable) {
177708
- let rawValue;
177709
- if (isInserted) {
177710
- rawValue = (_h2 = (_g2 = (_f2 = this.props.inserts) == null ? void 0 : _f2.insertedRowsById) == null ? void 0 : _g2[originalRowIndex]) == null ? void 0 : _h2[columnProperties.id];
177711
- } else if (isEdited) {
177712
- rawValue = (_j = (_i = this.props.editOverrides) == null ? void 0 : _i[originalRowIndex]) == null ? void 0 : _j[columnProperties.id].value;
177713
- } else if (columnProperties.isDerived) {
177714
- rawValue = props2.cell.value;
177715
- } else {
177716
- rawValue = (_l2 = (_k = this.props.tableData) == null ? void 0 : _k[originalRowIndex]) == null ? void 0 : _l2[columnProperties.id];
177717
- }
177718
- const value = isInserted ? rawValue ?? "" : props2.cell.value;
177719
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
177720
- EditableCell,
177721
- {
177722
- theme: this.props.theme,
177723
- value,
177724
- rawValue,
177725
- columnType: columnProperties.columnType,
177726
- isInserted,
177727
- columnName: columnProperties.label,
177728
- cellProps: {
177729
- isHidden: isHidden2,
177730
- cellProperties,
177731
- tagsColorAssignment: (_m2 = this.cachedTagColorAssignment) == null ? void 0 : _m2[columnProperties.id],
177732
- notation: columnNotation,
177733
- currency: columnProperties.currency,
177734
- minimumFractionDigits: columnProperties.minimumFractionDigits,
177735
- maximumFractionDigits: columnProperties.maximumFractionDigits,
177736
- booleanStyleFalse: columnProperties.booleanStyleFalse,
177737
- rowDensity: this.props.rowDensity,
177738
- isFocused: props2.isFocused,
177739
- displayedValue: this.getDisplayedValueForEditCell({
177740
- columnId: columnProperties.id,
177741
- rawValue,
177742
- displayedValue: cellProperties.displayedValue,
177743
- useLabelAsDisplayValue: columnProperties.useLabelAsDisplayValue
177744
- }),
177745
- cellIcon: getPropertyValue(
177746
- columnProperties.cellIcon,
177747
- indexInTableDataWithInserts,
177748
- true
177749
- ),
177750
- cellIconPosition: columnProperties.cellIconPosition ?? "left",
177751
- inputFormat: getPropertyValue(
177752
- columnProperties.inputFormat,
177753
- indexInTableDataWithInserts,
177754
- true
177755
- ),
177756
- outputFormat: getPropertyValue(
177757
- columnProperties.outputFormat,
177758
- indexInTableDataWithInserts,
177759
- true
177760
- ),
177761
- manageTimezone: columnProperties.manageTimezone,
177762
- timezone: getPropertyValue(
177763
- columnProperties.timezone,
177764
- indexInTableDataWithInserts,
177765
- true
177766
- ),
177767
- displayTimezone: getPropertyValue(
177768
- columnProperties.displayTimezone,
177769
- indexInTableDataWithInserts,
177770
- true
177771
- ),
177772
- isMultiselecting: this.currentCellFocus.length > 1
177773
- },
177774
- editProps: {
177775
- handleEditStart: this.handleEditStart.bind(
177776
- this,
177777
- originalRowIndex,
177778
- columnProperties.id,
177779
- this.getCellValue(
177780
- originalRowIndex,
177781
- columnProperties.id
177782
- )
177783
- ),
177784
- handleEditChange: this.debouncedEditChange,
177785
- handleEditStop: this.onEditStop.bind(
177786
- this,
177787
- columnProperties,
177788
- currentRowIndex
177789
- ),
177790
- onDropdownSearchTextChanged: () => props2.onDropdownSearchTextChanged(),
177791
- currentEditDropdownSearchText: this.props.currentEditDropdownSearchText,
177792
- handleOneClickEdit: this.handleOneClickEdit.bind(
177793
- this,
177794
- columnProperties,
177795
- originalRowIndex
177796
- ),
177797
- isEditFocused: ((_n2 = this.props.currentEditFocus) == null ? void 0 : _n2.row) === originalRowIndex && ((_o2 = this.props.currentEditFocus) == null ? void 0 : _o2.columnId) === columnProperties.id,
177798
- isEdited,
177799
- currentEditValue: this.props.currentEditValue,
177800
- editInputType: columnProperties.editInputType,
177801
- editCustomValidationRule: this.customEditValidation[columnProperties.id],
177802
- editCustomErrorMessage: this.customEditMessage[columnProperties.id],
177803
- editMaxLength: columnProperties.editMaxLength,
177804
- editMinLength: columnProperties.editMinLength,
177805
- editIsRequired: isInserted ? columnProperties.isRequiredOnInsertion : columnProperties.editIsRequired,
177806
- editMultiSelect: columnProperties.editMultiSelect,
177807
- allowClearing: columnProperties.allowClearing,
177808
- dropdownOptionsLoading: this.getDropdownOptionsLoading(),
177809
- editDropdownClientSideFiltering: columnProperties.editDropdownClientSideFiltering,
177810
- editOptions: this.editOptions[columnProperties.id],
177811
- transformation: columnProperties.transformation,
177812
- validationErrors: isInserted ? ((_r2 = (_q = (_p2 = this.props.inserts) == null ? void 0 : _p2.insertedRowValidations) == null ? void 0 : _q[originalRowIndex]) == null ? void 0 : _r2[columnProperties.id]) ?? [] : ((_u2 = (_t2 = (_s2 = this.props.editOverrides) == null ? void 0 : _s2[originalRowIndex]) == null ? void 0 : _t2[columnProperties.id]) == null ? void 0 : _u2.validationErrors) ?? [],
177813
- editMinDate: columnProperties.editMinDate,
177814
- editMaxDate: columnProperties.editMaxDate,
177815
- editTwentyFourHourTime: columnProperties.editTwentyFourHourTime
177816
- },
177817
- tableName: this.props.widgetName,
177818
- rowDensity: getRowDensity(this.props.rowDensity),
177819
- maxLinesPerRow: this.props.maxLinesPerRow,
177820
- position: {
177821
- currentRowIndex,
177822
- columnId: columnProperties.id,
177823
- originalRowIndex
177824
- }
177825
- }
177826
- );
177827
- } else if (columnProperties.columnType === ColumnType.BUTTON) {
177828
- const buttonProps = {
177829
- rowIndex: currentRowIndex,
177830
- isSelected: !!props2.row.isSelected,
177831
- isDisabled: cellProperties.isDisabled,
177832
- onClick: (onComplete) => {
177833
- this.handleTableButtonClick(columnProperties.id, onComplete);
177834
- },
177835
- handleRowSelect: this.handleRowSelect,
177836
- backgroundColor: cellProperties.buttonBackgroundColor,
177837
- buttonBorder: cellProperties.buttonBorder,
177838
- buttonVariant: cellProperties.buttonVariant ?? "primary",
177839
- buttonTextStyle: cellProperties.buttonTextStyle,
177840
- cellIcon: getPropertyValue(
177841
- columnProperties.buttonIcon,
177842
- indexInTableDataWithInserts
177843
- ),
177844
- cellIconPosition: cellProperties.cellIconPosition ?? "left",
177845
- rowDensity: this.props.rowDensity,
177846
- id: columnProperties.id,
177847
- buttonLabel: cellProperties.buttonLabel ?? "Action",
177848
- isHidden: isHidden2,
177849
- theme: this.props.theme
177850
- };
177851
- return /* @__PURE__ */ jsxRuntimeExports.jsx(TableButton, { ...buttonProps });
177852
- } else if (columnProperties.columnType === "link") {
177853
- return renderLink({
177854
- cellProperties,
177855
- isHidden: isHidden2,
177856
- rowDensity: this.props.rowDensity,
177857
- position: {
177858
- columnId: columnProperties.id
177859
- },
177860
- maxLinesPerRow: this.props.maxLinesPerRow,
177861
- tableCellTextStyle: (_v = this.props.cellProps) == null ? void 0 : _v.textStyle,
177862
- value: props2.cell.value
177863
- });
177864
- } else {
177865
- return renderCell({
177866
- theme: this.props.theme,
177867
- value: props2.cell.value,
177868
- columnType: columnProperties.columnType,
177869
- editInputType: columnProperties.editInputType,
177870
- maxLinesPerRow: this.props.maxLinesPerRow,
177871
- tableCellTextStyle: (_w = this.props.cellProps) == null ? void 0 : _w.textStyle,
177872
- typographies: this.props.theme.typographies,
177873
- cellProps: {
177874
- // since these are overridden by the cellProperties
177875
- ...columnProperties,
177876
- ...getCellProperties(
177877
- (_x = tableProps == null ? void 0 : tableProps.cellProps) == null ? void 0 : _x.textStyle,
177878
- columnProperties,
177879
- indexInTableDataWithInserts
177880
- ),
177881
- isHidden: isHidden2,
177882
- cellProperties,
177883
- tagsColorAssignment: (_y = this.cachedTagColorAssignment) == null ? void 0 : _y[columnProperties.id],
177884
- booleanStyleFalse: columnProperties.booleanStyleFalse,
177885
- rowDensity: this.props.rowDensity,
177886
- isFocused: props2.isFocused,
177887
- isMultiselecting: this.currentCellFocus.length > 1
177888
- },
177889
- position: {
177890
- columnId: columnProperties.id
177891
- }
177892
- });
177893
- }
177894
- }
176922
+ Cell: this.createTableCell(columnProperties, isHidden2)
177895
176923
  };
177896
176924
  columnsArray.push(columnData);
177897
176925
  }
177898
- const columnString = JSON.stringify(columnsArray);
176926
+ const columnString = JSON.stringify(columnsArray, (key2, value) => {
176927
+ if (key2 === "columnProperties") {
176928
+ return this.getColumnPropertiesString(value);
176929
+ }
176930
+ return value;
176931
+ });
177899
176932
  if (columnString === this.previousColumnsString) {
177900
176933
  return this.previousColumns;
177901
176934
  }
@@ -177903,6 +176936,85 @@ const _TableWidget = class _TableWidget extends React__default.Component {
177903
176936
  this.previousColumns = columnsArray;
177904
176937
  return columnsArray;
177905
176938
  }
176939
+ createTableCell(columnProperties, isHidden2) {
176940
+ return (props2) => {
176941
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
176942
+ const currentRowIndex = props2.cell.row.index;
176943
+ ((_a2 = this.props.filteredOrderMap) == null ? void 0 : _a2[currentRowIndex]) ?? currentRowIndex;
176944
+ const cellProperties = getCellProperties(
176945
+ (_c2 = (_b2 = this.props) == null ? void 0 : _b2.cellProps) == null ? void 0 : _c2.textStyle,
176946
+ columnProperties,
176947
+ props2.cell.row.original
176948
+ );
176949
+ if (columnProperties.columnType === ColumnType.BUTTON) {
176950
+ const buttonProps = {
176951
+ rowIndex: currentRowIndex,
176952
+ isSelected: !!props2.row.isSelected,
176953
+ isDisabled: cellProperties.isDisabled,
176954
+ onClick: (onComplete) => {
176955
+ this.handleTableButtonClick(columnProperties.id, onComplete);
176956
+ },
176957
+ handleRowSelect: this.handleRowSelect,
176958
+ backgroundColor: cellProperties.buttonBackgroundColor,
176959
+ buttonBorder: cellProperties.buttonBorder,
176960
+ buttonVariant: cellProperties.buttonVariant ?? "primary",
176961
+ buttonTextStyle: cellProperties.buttonTextStyle,
176962
+ cellIcon: getPropertyValue(
176963
+ columnProperties.buttonIcon,
176964
+ props2.cell.row.original
176965
+ ),
176966
+ cellIconPosition: cellProperties.cellIconPosition ?? "left",
176967
+ rowDensity: this.props.rowDensity,
176968
+ id: columnProperties.id,
176969
+ buttonLabel: cellProperties.buttonLabel ?? "Action",
176970
+ isHidden: isHidden2,
176971
+ theme: this.props.theme
176972
+ };
176973
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(TableButton, { ...buttonProps });
176974
+ } else if (columnProperties.columnType === "link") {
176975
+ return renderLink({
176976
+ cellProperties,
176977
+ isHidden: isHidden2,
176978
+ rowDensity: this.props.rowDensity,
176979
+ position: {
176980
+ columnId: columnProperties.id
176981
+ },
176982
+ maxLinesPerRow: this.props.maxLinesPerRow,
176983
+ tableCellTextStyle: (_d2 = this.props.cellProps) == null ? void 0 : _d2.textStyle,
176984
+ value: props2.cell.value
176985
+ });
176986
+ } else {
176987
+ return renderCell({
176988
+ theme: this.props.theme,
176989
+ value: props2.cell.value,
176990
+ columnType: columnProperties.columnType,
176991
+ editInputType: columnProperties.editInputType,
176992
+ maxLinesPerRow: this.props.maxLinesPerRow,
176993
+ tableCellTextStyle: (_e2 = this.props.cellProps) == null ? void 0 : _e2.textStyle,
176994
+ typographies: this.props.theme.typographies,
176995
+ cellProps: {
176996
+ // since these are overridden by the cellProperties
176997
+ ...columnProperties,
176998
+ ...getCellProperties(
176999
+ (_g2 = (_f2 = this.props) == null ? void 0 : _f2.cellProps) == null ? void 0 : _g2.textStyle,
177000
+ columnProperties,
177001
+ props2.cell.row.original
177002
+ ),
177003
+ isHidden: isHidden2,
177004
+ cellProperties,
177005
+ tagsColorAssignment: (_h2 = this.cachedTagColorAssignment) == null ? void 0 : _h2[columnProperties.id],
177006
+ booleanStyleFalse: columnProperties.booleanStyleFalse,
177007
+ rowDensity: this.props.rowDensity,
177008
+ isFocused: props2.isFocused,
177009
+ isMultiselecting: this.currentCellFocus.length > 1
177010
+ },
177011
+ position: {
177012
+ columnId: columnProperties.id
177013
+ }
177014
+ });
177015
+ }
177016
+ };
177017
+ }
177906
177018
  static getParsedComputedValues(value) {
177907
177019
  let computedValues = [];
177908
177020
  if (lodashExports.isString(value)) {
@@ -181244,8 +180356,8 @@ const StyledCrossIcon = qe$1(SvgCrossXs)`
181244
180356
  right: ${({ right: right2 }) => `${right2}px`};
181245
180357
  top: 50%;
181246
180358
  transform: translateY(-50%);
181247
- height: ${({ iconSize }) => `${iconSize ?? DEFAULT_ICON_SIZE$1}px`};
181248
- width: ${({ iconSize }) => `${iconSize ?? DEFAULT_ICON_SIZE$1}px`};
180359
+ height: ${({ iconSize }) => `${iconSize ?? DEFAULT_ICON_SIZE}px`};
180360
+ width: ${({ iconSize }) => `${iconSize ?? DEFAULT_ICON_SIZE}px`};
181249
180361
  z-index: 4; // TODO: do we need to use Layers?
181250
180362
  cursor: pointer;
181251
180363
  `;
@@ -182001,7 +181113,7 @@ const propertiesDefinition$8 = {
182001
181113
  isJSConvertible: false,
182002
181114
  helpText: "Allows users to select either a single option or multiple options. Values must be unique.",
182003
181115
  placeholder: "[{label: 'Option 1', value: 'option1'}]",
182004
- controlType: "COMPUTED_CODE_EDITOR"
181116
+ controlType: "FUNCTION_CODE_EDITOR"
182005
181117
  }),
182006
181118
  defaultOptionValue: Prop.string().propertiesPanel({
182007
181119
  label: "Default selected value",
@@ -183481,13 +182593,7 @@ const propertiesDefinition$4 = {
183481
182593
  size: Prop.dimension().readAndWrite().propertiesPanel({
183482
182594
  label: "Size",
183483
182595
  controlType: "WIDTH_DROPDOWN"
183484
- }).default(Dim.px(24)),
183485
- width: Prop.dimension().readAndWrite().default(function() {
183486
- return this.size;
183487
- }),
183488
- height: Prop.dimension().readAndWrite().default(function() {
183489
- return this.size;
183490
- })
182596
+ }).default(Dim.fit())
183491
182597
  }).add(margin()).add(visible()),
183492
182598
  appearance: Section.category(PropsPanelCategory.Appearance).children({
183493
182599
  color: colorProp({
@@ -183513,7 +182619,7 @@ const SbIcon = registerSbComponent(
183513
182619
  },
183514
182620
  (props2) => {
183515
182621
  const [isLoading, setIsLoading] = useState(false);
183516
- const { icon, style: style2, color, onClick } = props2;
182622
+ const { icon, style: style2, color, size: size2, onClick } = props2;
183517
182623
  const { style: passthroughStyle, ...passThroughProps } = usePassthroughProps(props2);
183518
182624
  const inlineStyles = useMemo$2(() => {
183519
182625
  const minWidthStyle = !icon ? {
@@ -183525,7 +182631,8 @@ const SbIcon = registerSbComponent(
183525
182631
  ...passthroughStyle,
183526
182632
  color,
183527
182633
  cursor: onClick ? "pointer" : "inherit",
183528
- ...style2
182634
+ ...style2,
182635
+ height: "100%"
183529
182636
  };
183530
182637
  }, [style2, color, onClick, passthroughStyle, icon]);
183531
182638
  const handleClick = useCallback(async () => {
@@ -183551,7 +182658,8 @@ const SbIcon = registerSbComponent(
183551
182658
  disablePointerEvents: true,
183552
182659
  iconName: icon,
183553
182660
  color,
183554
- fill: true
182661
+ fill: (size2 == null ? void 0 : size2.mode) !== "px",
182662
+ size: (size2 == null ? void 0 : size2.mode) === "px" ? size2.value : void 0
183555
182663
  }
183556
182664
  )
183557
182665
  }
@@ -183845,8 +182953,8 @@ const SbVariable = registerSbEntity(
183845
182953
  );
183846
182954
  const propertiesDefinition$1 = {
183847
182955
  general: Section.category(PropsPanelCategory.Uncategorized).propertiesPanel({ showHeader: false }).children({
183848
- intervalMs: Prop.number().default(3e5).readAndWrite().propertiesPanel({
183849
- label: "Interval (ms)",
182956
+ intervalMs: Prop.number().default(300).readAndWrite().propertiesPanel({
182957
+ label: "Interval",
183850
182958
  helpText: "Sets the interval of the timer",
183851
182959
  placeholder: "1000",
183852
182960
  isJSConvertible: false,
@@ -184638,6 +183746,7 @@ function listenForUrlChange() {
184638
183746
  return observer2;
184639
183747
  }
184640
183748
  const IframeConnected = observer(function IframeConnected2(props2) {
183749
+ var _a2;
184641
183750
  useEffect(() => {
184642
183751
  if (!isEmbeddedBySuperblocksFirstParty()) {
184643
183752
  return;
@@ -184647,7 +183756,18 @@ const IframeConnected = observer(function IframeConnected2(props2) {
184647
183756
  editStore.setIsInitialized(true);
184648
183757
  editorBridge.connected();
184649
183758
  rootStore.setEditStore(editStore);
184650
- await sourceUpdateApi.connect(data2.payload.peerId, data2.payload.userId);
183759
+ try {
183760
+ await sourceUpdateApi.connect(data2.payload.peerId, data2.payload.userId);
183761
+ } catch (error) {
183762
+ console.error(
183763
+ "Error connecting to internal socket from library",
183764
+ error
183765
+ );
183766
+ editorBridge.socketError(
183767
+ "Error connecting to the remote dev server, please refresh the page"
183768
+ );
183769
+ return;
183770
+ }
184651
183771
  editorBridge.updatePropertiesPanels(
184652
183772
  editStore.propertiesPanelManager.getNonDynamicPropertiesPanels()
184653
183773
  );
@@ -184676,6 +183796,10 @@ const IframeConnected = observer(function IframeConnected2(props2) {
184676
183796
  };
184677
183797
  }, []);
184678
183798
  const isPossiblyEditor = useMemo$2(isEmbeddedBySuperblocksFirstParty, []);
183799
+ const connectionStatus = (_a2 = rootStore.editStore) == null ? void 0 : _a2.connectionManager.connectionStatus;
183800
+ if (connectionStatus === "pre-init" || connectionStatus === "connecting") {
183801
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(FullPageSpinner, {});
183802
+ }
184679
183803
  if (isPossiblyEditor && editStore.isInitialized && typeof window !== "undefined") {
184680
183804
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(DnDProvider, { children: [
184681
183805
  /* @__PURE__ */ jsxRuntimeExports.jsx(NewComponentsDragLayer, {}),
@@ -186111,9 +185235,9 @@ const generateDropdownStyles = (theme) => {
186111
185235
  transform: translateY(-50%);
186112
185236
  z-index: 99;
186113
185237
  background-repeat: no-repeat;
186114
- background-size: ${DEFAULT_ICON_SIZE$1}px;
186115
- width: ${DEFAULT_ICON_SIZE$1}px;
186116
- height: ${DEFAULT_ICON_SIZE$1}px;
185238
+ background-size: ${DEFAULT_ICON_SIZE}px;
185239
+ width: ${DEFAULT_ICON_SIZE}px;
185240
+ height: ${DEFAULT_ICON_SIZE}px;
186117
185241
  display: block;
186118
185242
  position: absolute;
186119
185243
  cursor: pointer;
@@ -186705,14 +185829,38 @@ console.log = (...args) => {
186705
185829
  } catch {
186706
185830
  }
186707
185831
  };
185832
+ const loadApisIntoLibrary = async function loadApisIntoLibrary2() {
185833
+ var _a2, _b2;
185834
+ {
185835
+ try {
185836
+ const mod2 = await import("./user-facing/build-manifest.js");
185837
+ const apis = ((_a2 = mod2.default) == null ? void 0 : _a2.apis) ?? {};
185838
+ const apiDependencies = ((_b2 = mod2.default) == null ? void 0 : _b2.apiDependencies) ?? [];
185839
+ rootStore.apis.setAllApis(apis);
185840
+ apiDependencies.forEach((dep) => {
185841
+ rootStore.apis.setApiDepCandidates(dep.apiName, dep.params);
185842
+ rootStore.apis.setApiReferences(dep.apiName, dep.dependencies);
185843
+ });
185844
+ } catch (error) {
185845
+ console.error("Error loading apis into library", error);
185846
+ }
185847
+ }
185848
+ };
186708
185849
  const SbProvider = function SbProvider2({
186709
185850
  name = "codemode",
186710
185851
  settings,
186711
- preloadedData,
186712
185852
  children
186713
185853
  }) {
186714
185854
  var _a2, _b2;
186715
185855
  const isEmbedded = typeof window !== "undefined" && window.parent !== window.self;
185856
+ const [isApisInitialized, setIsApisInitialized] = useState(false);
185857
+ const runApiInitialization = useCallback(async () => {
185858
+ await loadApisIntoLibrary();
185859
+ setIsApisInitialized(true);
185860
+ }, []);
185861
+ useEffect(() => {
185862
+ runApiInitialization();
185863
+ }, [runApiInitialization]);
186716
185864
  const [userAccessibleTheme, setUserAccessibleTheme] = useState(DEFAULT_THEME);
186717
185865
  useEffect(() => {
186718
185866
  const mergedTheme = lodashExports.merge(BASE_THEME_V5, settings == null ? void 0 : settings.theme);
@@ -186724,7 +185872,10 @@ const SbProvider = function SbProvider2({
186724
185872
  }, [settings == null ? void 0 : settings.theme, settings == null ? void 0 : settings.themeOverrides]);
186725
185873
  useEffect(() => {
186726
185874
  initializeStyles(name);
186727
- }, [preloadedData, name]);
185875
+ }, [name]);
185876
+ if (!isApisInitialized) {
185877
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(FullPageSpinner, {});
185878
+ }
186728
185879
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
186729
185880
  "div",
186730
185881
  {
@@ -198333,4 +197484,4 @@ export {
198333
197484
  SbTimer as y,
198334
197485
  SbApi as z
198335
197486
  };
198336
- //# sourceMappingURL=index-kjgG33Rg.js.map
197487
+ //# sourceMappingURL=index-D9O95zsr.js.map