@trops/dash-core 0.1.462 → 0.1.463
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 +105 -118
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +105 -118
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7518,11 +7518,12 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
|
|
|
7518
7518
|
};
|
|
7519
7519
|
}, []);
|
|
7520
7520
|
|
|
7521
|
-
//
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7521
|
+
// Cycle 2: the inner pages were promoted to top-level wizard steps
|
|
7522
|
+
// (state.step 1=Name, 2=Folder, 3=Theme, 4=Review). The internal
|
|
7523
|
+
// mini-stepper from DASH-188 is gone — the modal footer's
|
|
7524
|
+
// Next/Back drives advancement now, and the wizard's per-step
|
|
7525
|
+
// canProceed gates each transition.
|
|
7526
|
+
|
|
7526
7527
|
var isPrebuilt = state.path === "prebuilt";
|
|
7527
7528
|
|
|
7528
7529
|
// Initialize customization defaults when stepping into this step
|
|
@@ -7827,7 +7828,6 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
|
|
|
7827
7828
|
setIsCreatingFolder(false);
|
|
7828
7829
|
setNewFolderName("");
|
|
7829
7830
|
setNewFolderIcon(null);
|
|
7830
|
-
setSubStep(2); // Auto-advance to Theme
|
|
7831
7831
|
}, [dispatch]);
|
|
7832
7832
|
var handleThemeSelect = React.useCallback(function (key) {
|
|
7833
7833
|
dispatch({
|
|
@@ -7993,16 +7993,6 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
|
|
|
7993
7993
|
return item.id === state.customization.menuId;
|
|
7994
7994
|
});
|
|
7995
7995
|
var selectedTheme = themes && state.customization.theme ? themes[state.customization.theme] : null;
|
|
7996
|
-
var SUB_STEPS = [{
|
|
7997
|
-
label: "Name",
|
|
7998
|
-
icon: "input-text"
|
|
7999
|
-
}, {
|
|
8000
|
-
label: "Folder",
|
|
8001
|
-
icon: "folder"
|
|
8002
|
-
}, {
|
|
8003
|
-
label: "Theme",
|
|
8004
|
-
icon: "palette"
|
|
8005
|
-
}];
|
|
8006
7996
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
8007
7997
|
className: "flex flex-col gap-4",
|
|
8008
7998
|
children: [/*#__PURE__*/jsxRuntime.jsx("h3", {
|
|
@@ -8056,28 +8046,18 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
|
|
|
8056
8046
|
children: isPrebuilt ? ((_state$selectedDashbo = state.selectedDashboard) === null || _state$selectedDashbo === void 0 ? void 0 : _state$selectedDashbo.displayName) || ((_state$selectedDashbo2 = state.selectedDashboard) === null || _state$selectedDashbo2 === void 0 ? void 0 : _state$selectedDashbo2.name) || "Pre-built dashboard" : "".concat(state.selectedWidgets.length, " widget").concat(state.selectedWidgets.length !== 1 ? "s" : "")
|
|
8057
8047
|
})]
|
|
8058
8048
|
})]
|
|
8059
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
8060
|
-
className: "flex items-
|
|
8061
|
-
children:
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
onClick: function onClick() {
|
|
8069
|
-
return setSubStep(i);
|
|
8070
|
-
},
|
|
8071
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
8072
|
-
icon: s.icon,
|
|
8073
|
-
fixedWidth: true
|
|
8074
|
-
}), s.label]
|
|
8075
|
-
})]
|
|
8076
|
-
}, s.label);
|
|
8077
|
-
})
|
|
8049
|
+
}), error && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
8050
|
+
className: "rounded-lg border border-red-500 bg-red-900 p-3 flex items-start gap-2",
|
|
8051
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
8052
|
+
icon: "circle-exclamation",
|
|
8053
|
+
className: "text-red-400 mt-0.5 flex-shrink-0"
|
|
8054
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
8055
|
+
className: "text-sm text-red-200",
|
|
8056
|
+
children: error
|
|
8057
|
+
})]
|
|
8078
8058
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
8079
8059
|
className: "flex flex-col gap-6",
|
|
8080
|
-
children: [
|
|
8060
|
+
children: [state.step === 1 && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
8081
8061
|
className: "flex flex-col gap-3",
|
|
8082
8062
|
children: [/*#__PURE__*/jsxRuntime.jsxs("label", {
|
|
8083
8063
|
className: "flex items-center gap-2 text-sm font-semibold text-gray-300",
|
|
@@ -8090,24 +8070,8 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
|
|
|
8090
8070
|
onChange: handleNameChange,
|
|
8091
8071
|
placeholder: "My Dashboard",
|
|
8092
8072
|
autoFocus: true
|
|
8093
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
8094
|
-
className: "flex justify-end mt-2",
|
|
8095
|
-
children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
|
|
8096
|
-
onClick: function onClick() {
|
|
8097
|
-
return setSubStep(1);
|
|
8098
|
-
},
|
|
8099
|
-
title: "Next",
|
|
8100
|
-
textSize: "text-sm",
|
|
8101
|
-
padding: "py-1.5 px-4",
|
|
8102
|
-
backgroundColor: state.customization.name.trim() ? "bg-blue-600" : "bg-gray-700",
|
|
8103
|
-
textColor: state.customization.name.trim() ? "text-white" : "text-gray-500",
|
|
8104
|
-
hoverTextColor: state.customization.name.trim() ? "hover:text-white" : "hover:text-gray-500",
|
|
8105
|
-
hoverBackgroundColor: state.customization.name.trim() ? "hover:bg-blue-500" : "hover:bg-gray-700",
|
|
8106
|
-
disabled: !state.customization.name.trim(),
|
|
8107
|
-
icon: "arrow-right"
|
|
8108
|
-
})
|
|
8109
8073
|
})]
|
|
8110
|
-
}),
|
|
8074
|
+
}), state.step === 2 && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
8111
8075
|
className: "flex flex-col gap-3",
|
|
8112
8076
|
children: [/*#__PURE__*/jsxRuntime.jsxs("label", {
|
|
8113
8077
|
className: "flex items-center gap-2 text-sm font-semibold text-gray-300",
|
|
@@ -8199,23 +8163,8 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
|
|
|
8199
8163
|
})
|
|
8200
8164
|
}, item.id);
|
|
8201
8165
|
})]
|
|
8202
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
8203
|
-
className: "flex justify-end mt-2",
|
|
8204
|
-
children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
|
|
8205
|
-
onClick: function onClick() {
|
|
8206
|
-
return setSubStep(2);
|
|
8207
|
-
},
|
|
8208
|
-
title: "Next",
|
|
8209
|
-
textSize: "text-sm",
|
|
8210
|
-
padding: "py-1.5 px-4",
|
|
8211
|
-
backgroundColor: "bg-blue-600",
|
|
8212
|
-
textColor: "text-white",
|
|
8213
|
-
hoverTextColor: "hover:text-white",
|
|
8214
|
-
hoverBackgroundColor: "hover:bg-blue-500",
|
|
8215
|
-
icon: "arrow-right"
|
|
8216
|
-
})
|
|
8217
8166
|
})]
|
|
8218
|
-
}),
|
|
8167
|
+
}), state.step === 3 && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
8219
8168
|
className: "flex flex-col gap-3",
|
|
8220
8169
|
children: [/*#__PURE__*/jsxRuntime.jsxs("label", {
|
|
8221
8170
|
className: "flex items-center gap-2 text-sm font-semibold text-gray-300",
|
|
@@ -8306,6 +8255,21 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
|
|
|
8306
8255
|
})]
|
|
8307
8256
|
})]
|
|
8308
8257
|
})]
|
|
8258
|
+
}), state.step === 4 && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
8259
|
+
className: "flex flex-col gap-3",
|
|
8260
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("label", {
|
|
8261
|
+
className: "flex items-center gap-2 text-sm font-semibold text-gray-300",
|
|
8262
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
8263
|
+
icon: "circle-check",
|
|
8264
|
+
fixedWidth: true
|
|
8265
|
+
}), "Review"]
|
|
8266
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("p", {
|
|
8267
|
+
className: "text-sm text-gray-400",
|
|
8268
|
+
children: ["Confirm the dashboard details above. Click", " ", /*#__PURE__*/jsxRuntime.jsx("strong", {
|
|
8269
|
+
className: "text-gray-200",
|
|
8270
|
+
children: "Create Dashboard"
|
|
8271
|
+
}), " when you're ready \u2014 the modal footer holds the action."]
|
|
8272
|
+
})]
|
|
8309
8273
|
}), authNeeded && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
8310
8274
|
className: "flex flex-col gap-3",
|
|
8311
8275
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -8369,7 +8333,7 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
|
|
|
8369
8333
|
|
|
8370
8334
|
function ownKeys$U(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8371
8335
|
function _objectSpread$U(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$U(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$U(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8372
|
-
var TOTAL_STEPS =
|
|
8336
|
+
var TOTAL_STEPS = 5; // Steps 0-4: Discover, Name, Folder, Theme, Review
|
|
8373
8337
|
|
|
8374
8338
|
var initialState = {
|
|
8375
8339
|
step: 0,
|
|
@@ -8500,16 +8464,26 @@ function widgetCountToTemplate(count) {
|
|
|
8500
8464
|
return "three-by-three";
|
|
8501
8465
|
}
|
|
8502
8466
|
function getCanProceed(state) {
|
|
8467
|
+
// Step semantics (Cycle 2 restructure):
|
|
8468
|
+
// 0 = Discover (browse + select)
|
|
8469
|
+
// 1 = Name
|
|
8470
|
+
// 2 = Folder
|
|
8471
|
+
// 3 = Theme
|
|
8472
|
+
// 4 = Review (final — Create button replaces Next)
|
|
8503
8473
|
switch (state.step) {
|
|
8504
8474
|
case 0:
|
|
8505
8475
|
return state.selectedDashboard !== null || state.selectedWidgets.length > 0;
|
|
8506
8476
|
case 1:
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
|
|
8477
|
+
return state.customization.name.trim().length > 0;
|
|
8478
|
+
case 2:
|
|
8479
|
+
return state.customization.menuId !== null;
|
|
8480
|
+
case 3:
|
|
8481
|
+
return !!state.customization.theme;
|
|
8482
|
+
case 4:
|
|
8483
|
+
// Review is the final step — there's no "next" beyond it. The
|
|
8484
|
+
// modal's footer swaps Next for Create on this step; the actual
|
|
8485
|
+
// gate for *firing* Create is composed there (`canCreate`).
|
|
8486
|
+
return true;
|
|
8513
8487
|
default:
|
|
8514
8488
|
return false;
|
|
8515
8489
|
}
|
|
@@ -8566,11 +8540,17 @@ var useWizardState = function useWizardState() {
|
|
|
8566
8540
|
};
|
|
8567
8541
|
|
|
8568
8542
|
var STEP_LABELS = [{
|
|
8569
|
-
label: "
|
|
8570
|
-
description: "
|
|
8543
|
+
label: "Name",
|
|
8544
|
+
description: "Pick a name"
|
|
8545
|
+
}, {
|
|
8546
|
+
label: "Folder",
|
|
8547
|
+
description: "Where it lives"
|
|
8548
|
+
}, {
|
|
8549
|
+
label: "Theme",
|
|
8550
|
+
description: "How it looks"
|
|
8571
8551
|
}, {
|
|
8572
|
-
label: "
|
|
8573
|
-
description: "
|
|
8552
|
+
label: "Review",
|
|
8553
|
+
description: "Confirm & create"
|
|
8574
8554
|
}];
|
|
8575
8555
|
|
|
8576
8556
|
/**
|
|
@@ -8626,10 +8606,17 @@ var DashboardWizardModal = function DashboardWizardModal(_ref) {
|
|
|
8626
8606
|
if (!canProceed) return;
|
|
8627
8607
|
nextStep();
|
|
8628
8608
|
}, [canProceed, nextStep]);
|
|
8629
|
-
var
|
|
8609
|
+
var isDiscover = state.step === 0;
|
|
8610
|
+
var isLastStep = state.step === 4;
|
|
8630
8611
|
var isCreating = (_createHandlerRef$cur = (_createHandlerRef$cur2 = createHandlerRef.current) === null || _createHandlerRef$cur2 === void 0 ? void 0 : _createHandlerRef$cur2.creating) !== null && _createHandlerRef$cur !== void 0 ? _createHandlerRef$cur : false;
|
|
8631
8612
|
var isCreated = !!((_createHandlerRef$cur3 = createHandlerRef.current) !== null && _createHandlerRef$cur3 !== void 0 && _createHandlerRef$cur3.createdDashboard);
|
|
8632
|
-
|
|
8613
|
+
// Create only fires when every prior step has been validated. The
|
|
8614
|
+
// Review step (canProceed=true by design) doesn't tell us whether
|
|
8615
|
+
// Name/Folder/Theme were filled, so we re-check the underlying
|
|
8616
|
+
// customization here — belt-and-suspenders for clicks that race
|
|
8617
|
+
// the stepper.
|
|
8618
|
+
var customizationComplete = state.customization.name.trim().length > 0 && state.customization.menuId !== null && !!state.customization.theme;
|
|
8619
|
+
var canCreate = customizationComplete && !isCreating;
|
|
8633
8620
|
return /*#__PURE__*/jsxRuntime.jsx(DashReact.Modal, {
|
|
8634
8621
|
isOpen: open,
|
|
8635
8622
|
setIsOpen: setIsOpen,
|
|
@@ -8661,43 +8648,43 @@ var DashboardWizardModal = function DashboardWizardModal(_ref) {
|
|
|
8661
8648
|
})]
|
|
8662
8649
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
8663
8650
|
className: "flex flex-col flex-1 min-h-0 px-6 py-4",
|
|
8664
|
-
children: [/*#__PURE__*/jsxRuntime.
|
|
8665
|
-
|
|
8666
|
-
|
|
8651
|
+
children: [isDiscover ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
8652
|
+
className: "flex-1 min-h-0 overflow-y-auto",
|
|
8653
|
+
children: /*#__PURE__*/jsxRuntime.jsx(WizardDiscoverStep, {
|
|
8654
|
+
state: state,
|
|
8655
|
+
dispatch: dispatch
|
|
8656
|
+
})
|
|
8657
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(DashReact.Stepper, {
|
|
8658
|
+
activeStep: state.step - 1,
|
|
8659
|
+
onStepChange: function onStepChange(s) {
|
|
8660
|
+
return handleStepChange(s + 1);
|
|
8661
|
+
},
|
|
8667
8662
|
showNavigation: false,
|
|
8668
8663
|
className: "flex-1 min-h-0",
|
|
8669
|
-
children:
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
onInstallDashboard: onInstallDashboard,
|
|
8691
|
-
onOpenDashboard: function onOpenDashboard(ws) {
|
|
8692
|
-
handleClose();
|
|
8693
|
-
if (_onOpenDashboard) _onOpenDashboard(ws);
|
|
8694
|
-
if (onReloadWorkspaces) onReloadWorkspaces();
|
|
8695
|
-
},
|
|
8696
|
-
appId: appId,
|
|
8697
|
-
createHandlerRef: createHandlerRef
|
|
8664
|
+
children: STEP_LABELS.map(function (label) {
|
|
8665
|
+
return /*#__PURE__*/jsxRuntime.jsx(DashReact.Stepper.Step, {
|
|
8666
|
+
label: label.label,
|
|
8667
|
+
description: label.description,
|
|
8668
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
8669
|
+
className: "flex-1 min-h-0 overflow-y-auto",
|
|
8670
|
+
children: /*#__PURE__*/jsxRuntime.jsx(WizardCustomizeStep, {
|
|
8671
|
+
state: state,
|
|
8672
|
+
dispatch: dispatch,
|
|
8673
|
+
menuItems: menuItems,
|
|
8674
|
+
onSaveMenuItem: onSaveMenuItem,
|
|
8675
|
+
onCreateWorkspace: onCreateWorkspace,
|
|
8676
|
+
onInstallDashboard: onInstallDashboard,
|
|
8677
|
+
onOpenDashboard: function onOpenDashboard(ws) {
|
|
8678
|
+
handleClose();
|
|
8679
|
+
if (_onOpenDashboard) _onOpenDashboard(ws);
|
|
8680
|
+
if (onReloadWorkspaces) onReloadWorkspaces();
|
|
8681
|
+
},
|
|
8682
|
+
appId: appId,
|
|
8683
|
+
createHandlerRef: createHandlerRef
|
|
8684
|
+
})
|
|
8698
8685
|
})
|
|
8699
|
-
})
|
|
8700
|
-
})
|
|
8686
|
+
}, label.label);
|
|
8687
|
+
})
|
|
8701
8688
|
}), !isCreated && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
8702
8689
|
className: "flex flex-row justify-between items-center pt-4 mt-4 border-t border-gray-700/50",
|
|
8703
8690
|
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
|
|
@@ -8709,9 +8696,9 @@ var DashboardWizardModal = function DashboardWizardModal(_ref) {
|
|
|
8709
8696
|
textColor: "text-gray-300",
|
|
8710
8697
|
hoverTextColor: "hover:text-white",
|
|
8711
8698
|
hoverBackgroundColor: "hover:bg-gray-600"
|
|
8712
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
8699
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
8713
8700
|
className: "text-xs text-gray-500",
|
|
8714
|
-
children:
|
|
8701
|
+
children: isDiscover ? "Browse" : "Step ".concat(state.step, " of ").concat(STEP_LABELS.length)
|
|
8715
8702
|
}), isLastStep ? /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
|
|
8716
8703
|
onClick: function onClick() {
|
|
8717
8704
|
var _createHandlerRef$cur4, _createHandlerRef$cur5;
|