@trops/dash-core 0.1.226 → 0.1.227

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.
package/dist/index.esm.js CHANGED
@@ -6257,73 +6257,7 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
6257
6257
  // eslint-disable-next-line react-hooks/exhaustive-deps
6258
6258
  }, [state.step, state.selectedDashboard]);
6259
6259
 
6260
- // Expose handleCreate and creating state to parent via ref (DASH-183)
6261
- useEffect(function () {
6262
- if (createHandlerRef) {
6263
- createHandlerRef.current = {
6264
- handleCreate: handleCreate,
6265
- creating: creating
6266
- };
6267
- }
6268
- }, [createHandlerRef, handleCreate, creating]);
6269
- var handleNameChange = useCallback(function (val) {
6270
- dispatch({
6271
- type: "SET_CUSTOMIZATION",
6272
- payload: {
6273
- name: val
6274
- }
6275
- });
6276
- }, [dispatch]);
6277
- var handleMenuSelect = useCallback(function (id) {
6278
- dispatch({
6279
- type: "SET_CUSTOMIZATION",
6280
- payload: {
6281
- menuId: id
6282
- }
6283
- });
6284
- setIsCreatingFolder(false);
6285
- setNewFolderName("");
6286
- setNewFolderIcon(null);
6287
- setSubStep(2); // Auto-advance to Theme
6288
- }, [dispatch]);
6289
- var handleThemeSelect = useCallback(function (key) {
6290
- dispatch({
6291
- type: "SET_CUSTOMIZATION",
6292
- payload: {
6293
- theme: key
6294
- }
6295
- });
6296
- }, [dispatch]);
6297
- function handleCancelNewFolder() {
6298
- setIsCreatingFolder(false);
6299
- setNewFolderName("");
6300
- setNewFolderIcon(null);
6301
- }
6302
- function handleSaveNewFolder() {
6303
- if (!newFolderName.trim() || !newFolderIcon) return;
6304
- var newItem = {
6305
- id: Date.now(),
6306
- name: newFolderName.trim(),
6307
- icon: newFolderIcon
6308
- };
6309
- setLocalMenuItems(function (prev) {
6310
- return [].concat(_toConsumableArray(prev), [newItem]);
6311
- });
6312
- dispatch({
6313
- type: "SET_CUSTOMIZATION",
6314
- payload: {
6315
- menuId: newItem.id
6316
- }
6317
- });
6318
- if (onSaveMenuItem) {
6319
- onSaveMenuItem(newItem);
6320
- }
6321
- setIsCreatingFolder(false);
6322
- setNewFolderName("");
6323
- setNewFolderIcon(null);
6324
- }
6325
-
6326
- // --- Create logic ---
6260
+ // --- Create logic (DASH-191: moved above useEffect so ref captures actual function) ---
6327
6261
  var handleCreate = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
6328
6262
  var _state$customization, name, menuId, theme, result, _window$mainApi, installResult, updatedWorkspace, _window$mainApi2, template, layoutObj, widgetOrder, cells, _loop, i, workspace, _t;
6329
6263
  return _regeneratorRuntime.wrap(function (_context2) {
@@ -6475,6 +6409,72 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
6475
6409
  }, _callee, null, [[1, 16, 17, 18]]);
6476
6410
  })), [state, isPrebuilt, onInstallDashboard, onCreateWorkspace, appId]);
6477
6411
 
6412
+ // Expose handleCreate and creating state to parent via ref (DASH-183)
6413
+ useEffect(function () {
6414
+ if (createHandlerRef) {
6415
+ createHandlerRef.current = {
6416
+ handleCreate: handleCreate,
6417
+ creating: creating
6418
+ };
6419
+ }
6420
+ }, [createHandlerRef, handleCreate, creating]);
6421
+ var handleNameChange = useCallback(function (val) {
6422
+ dispatch({
6423
+ type: "SET_CUSTOMIZATION",
6424
+ payload: {
6425
+ name: val
6426
+ }
6427
+ });
6428
+ }, [dispatch]);
6429
+ var handleMenuSelect = useCallback(function (id) {
6430
+ dispatch({
6431
+ type: "SET_CUSTOMIZATION",
6432
+ payload: {
6433
+ menuId: id
6434
+ }
6435
+ });
6436
+ setIsCreatingFolder(false);
6437
+ setNewFolderName("");
6438
+ setNewFolderIcon(null);
6439
+ setSubStep(2); // Auto-advance to Theme
6440
+ }, [dispatch]);
6441
+ var handleThemeSelect = useCallback(function (key) {
6442
+ dispatch({
6443
+ type: "SET_CUSTOMIZATION",
6444
+ payload: {
6445
+ theme: key
6446
+ }
6447
+ });
6448
+ }, [dispatch]);
6449
+ function handleCancelNewFolder() {
6450
+ setIsCreatingFolder(false);
6451
+ setNewFolderName("");
6452
+ setNewFolderIcon(null);
6453
+ }
6454
+ function handleSaveNewFolder() {
6455
+ if (!newFolderName.trim() || !newFolderIcon) return;
6456
+ var newItem = {
6457
+ id: Date.now(),
6458
+ name: newFolderName.trim(),
6459
+ icon: newFolderIcon
6460
+ };
6461
+ setLocalMenuItems(function (prev) {
6462
+ return [].concat(_toConsumableArray(prev), [newItem]);
6463
+ });
6464
+ dispatch({
6465
+ type: "SET_CUSTOMIZATION",
6466
+ payload: {
6467
+ menuId: newItem.id
6468
+ }
6469
+ });
6470
+ if (onSaveMenuItem) {
6471
+ onSaveMenuItem(newItem);
6472
+ }
6473
+ setIsCreatingFolder(false);
6474
+ setNewFolderName("");
6475
+ setNewFolderIcon(null);
6476
+ }
6477
+
6478
6478
  // --- Success state ---
6479
6479
  if (createdDashboard) {
6480
6480
  return /*#__PURE__*/jsx("div", {
@@ -6687,6 +6687,21 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
6687
6687
  })
6688
6688
  }, item.id);
6689
6689
  })]
6690
+ }), /*#__PURE__*/jsx("div", {
6691
+ className: "flex justify-end mt-2",
6692
+ children: /*#__PURE__*/jsx(Button, {
6693
+ onClick: function onClick() {
6694
+ return setSubStep(2);
6695
+ },
6696
+ title: "Next",
6697
+ textSize: "text-sm",
6698
+ padding: "py-1.5 px-4",
6699
+ backgroundColor: "bg-blue-600",
6700
+ textColor: "text-white",
6701
+ hoverTextColor: "hover:text-white",
6702
+ hoverBackgroundColor: "hover:bg-blue-500",
6703
+ icon: "arrow-right"
6704
+ })
6690
6705
  })]
6691
6706
  }), subStep === 2 && /*#__PURE__*/jsxs("div", {
6692
6707
  className: "flex flex-col gap-3",
@@ -48091,6 +48106,10 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
48091
48106
  handleOpenTab(newWorkspace);
48092
48107
  setSidebarCollapsed(true);
48093
48108
  setPreviewMode(false);
48109
+ return {
48110
+ success: true,
48111
+ workspace: newWorkspace
48112
+ };
48094
48113
  } catch (e) {
48095
48114
  }
48096
48115
  }