@procaaso/alphinity-ui-components 1.15.0 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +89 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -2
- package/dist/index.d.ts +26 -2
- package/dist/index.js +89 -36
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1266,6 +1266,20 @@ var DISABLED_BUTTON_BG = "#e5e7eb";
|
|
|
1266
1266
|
var DISABLED_BUTTON_TEXT = "#4b5563";
|
|
1267
1267
|
var DISABLED_BUTTON_BORDER = "#6b7280";
|
|
1268
1268
|
var DISABLED_BUTTON_HATCH = "repeating-linear-gradient(135deg, rgba(0,0,0,0.10) 0px, rgba(0,0,0,0.10) 4px, transparent 4px, transparent 10px)";
|
|
1269
|
+
var START_BUTTON_BG = "#10b981";
|
|
1270
|
+
var STOP_BUTTON_BG = "#ef4444";
|
|
1271
|
+
var COMMAND_VARIANT_STYLES = {
|
|
1272
|
+
start: { backgroundColor: START_BUTTON_BG, color: "#ffffff" },
|
|
1273
|
+
hold: { backgroundColor: "#f59e0b", color: "#1f1300" },
|
|
1274
|
+
cancel: { backgroundColor: "#64748b", color: "#ffffff" }
|
|
1275
|
+
};
|
|
1276
|
+
var COMPLETE_VARIANT_STYLE = {
|
|
1277
|
+
backgroundColor: "#d1fae5",
|
|
1278
|
+
color: "#065f46",
|
|
1279
|
+
border: `2px solid ${START_BUTTON_BG}`,
|
|
1280
|
+
cursor: "default",
|
|
1281
|
+
opacity: 1
|
|
1282
|
+
};
|
|
1269
1283
|
function DeviceControlPanelImpl({
|
|
1270
1284
|
binding,
|
|
1271
1285
|
onClose,
|
|
@@ -1347,6 +1361,7 @@ function DeviceControlPanelImpl({
|
|
|
1347
1361
|
const statusColor = statusEntry.bg;
|
|
1348
1362
|
const isUnknownStatus = normalizeDeviceStatus(binding.state.status) === "unknown";
|
|
1349
1363
|
const startStopRowShown = binding.display?.showStartStop !== false && (activeCapabilities?.canStart === true || activeCapabilities?.canStop === true);
|
|
1364
|
+
const customActionsInRow = binding.display?.customActionsLayout === "row";
|
|
1350
1365
|
const startEnabledNow = activeCapabilities?.canStart === true && activeCapabilities?.startEnabled !== false && !startPending;
|
|
1351
1366
|
const stopEnabledNow = activeCapabilities?.canStop === true && activeCapabilities?.stopEnabled !== false;
|
|
1352
1367
|
const startStopFontPx = Math.max(18, Math.round(18 * fontScale));
|
|
@@ -2164,7 +2179,7 @@ function DeviceControlPanelImpl({
|
|
|
2164
2179
|
},
|
|
2165
2180
|
disabled: !startEnabledNow,
|
|
2166
2181
|
"aria-busy": startPending || void 0,
|
|
2167
|
-
style: startStopButtonStyle(startEnabledNow,
|
|
2182
|
+
style: startStopButtonStyle(startEnabledNow, START_BUTTON_BG),
|
|
2168
2183
|
children: startPending ? "STARTING\u2026" : "START"
|
|
2169
2184
|
}
|
|
2170
2185
|
),
|
|
@@ -2179,48 +2194,86 @@ function DeviceControlPanelImpl({
|
|
|
2179
2194
|
},
|
|
2180
2195
|
disabled: !stopEnabledNow,
|
|
2181
2196
|
"aria-busy": stopPending || void 0,
|
|
2182
|
-
style: startStopButtonStyle(stopEnabledNow,
|
|
2197
|
+
style: startStopButtonStyle(stopEnabledNow, STOP_BUTTON_BG),
|
|
2183
2198
|
children: stopPending ? "STOPPING\u2026" : "STOP"
|
|
2184
2199
|
}
|
|
2185
2200
|
)
|
|
2186
2201
|
]
|
|
2187
2202
|
}
|
|
2188
2203
|
),
|
|
2189
|
-
activeCapabilities?.customActions && activeCapabilities.customActions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
},
|
|
2197
|
-
disabled: actionDisabled,
|
|
2198
|
-
title: actionDisabled ? action.disabledReason : void 0,
|
|
2199
|
-
style: {
|
|
2200
|
-
flex: 1,
|
|
2201
|
-
minWidth: "120px",
|
|
2202
|
-
height: touchSize,
|
|
2203
|
-
backgroundColor: surfaceColor,
|
|
2204
|
-
color: textColor,
|
|
2205
|
-
border: `1px solid ${borderColor}`,
|
|
2206
|
-
borderRadius: "6px",
|
|
2207
|
-
fontSize: "11px",
|
|
2208
|
-
fontWeight: 600,
|
|
2209
|
-
fontFamily: "monospace",
|
|
2210
|
-
letterSpacing: "0.5px",
|
|
2211
|
-
textTransform: "uppercase",
|
|
2212
|
-
cursor: actionDisabled ? "not-allowed" : "pointer",
|
|
2213
|
-
opacity: actionDisabled ? 0.4 : 1,
|
|
2214
|
-
transition: "all 0.15s"
|
|
2215
|
-
},
|
|
2216
|
-
children: [
|
|
2217
|
-
action.icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { marginRight: "6px" }, children: action.icon }),
|
|
2218
|
-
action.label
|
|
2219
|
-
]
|
|
2204
|
+
activeCapabilities?.customActions && activeCapabilities.customActions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2205
|
+
"div",
|
|
2206
|
+
{
|
|
2207
|
+
style: {
|
|
2208
|
+
display: "flex",
|
|
2209
|
+
flexWrap: customActionsInRow ? "nowrap" : "wrap",
|
|
2210
|
+
gap: "8px"
|
|
2220
2211
|
},
|
|
2221
|
-
action
|
|
2222
|
-
|
|
2223
|
-
|
|
2212
|
+
children: activeCapabilities.customActions.map((action) => {
|
|
2213
|
+
const isComplete = action.variant === "complete";
|
|
2214
|
+
const actionDisabled = action.disabled === true || isComplete;
|
|
2215
|
+
const commandStyle = action.variant === "start" || action.variant === "hold" || action.variant === "cancel" ? COMMAND_VARIANT_STYLES[action.variant] : void 0;
|
|
2216
|
+
let variantStyle;
|
|
2217
|
+
if (isComplete) {
|
|
2218
|
+
variantStyle = COMPLETE_VARIANT_STYLE;
|
|
2219
|
+
} else if (commandStyle && actionDisabled) {
|
|
2220
|
+
variantStyle = {
|
|
2221
|
+
backgroundColor: DISABLED_BUTTON_BG,
|
|
2222
|
+
backgroundImage: DISABLED_BUTTON_HATCH,
|
|
2223
|
+
color: DISABLED_BUTTON_TEXT,
|
|
2224
|
+
border: `2px dashed ${DISABLED_BUTTON_BORDER}`,
|
|
2225
|
+
cursor: "not-allowed",
|
|
2226
|
+
opacity: 1
|
|
2227
|
+
};
|
|
2228
|
+
} else if (commandStyle) {
|
|
2229
|
+
variantStyle = {
|
|
2230
|
+
...commandStyle,
|
|
2231
|
+
border: "2px solid transparent",
|
|
2232
|
+
cursor: "pointer",
|
|
2233
|
+
opacity: 1
|
|
2234
|
+
};
|
|
2235
|
+
} else {
|
|
2236
|
+
variantStyle = {
|
|
2237
|
+
backgroundColor: surfaceColor,
|
|
2238
|
+
color: textColor,
|
|
2239
|
+
border: `1px solid ${borderColor}`,
|
|
2240
|
+
cursor: actionDisabled ? "not-allowed" : "pointer",
|
|
2241
|
+
opacity: actionDisabled ? 0.4 : 1
|
|
2242
|
+
};
|
|
2243
|
+
}
|
|
2244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2245
|
+
"button",
|
|
2246
|
+
{
|
|
2247
|
+
type: "button",
|
|
2248
|
+
"data-variant": action.variant,
|
|
2249
|
+
onClick: () => {
|
|
2250
|
+
if (!actionDisabled) onCustomAction?.(action.id);
|
|
2251
|
+
},
|
|
2252
|
+
disabled: actionDisabled,
|
|
2253
|
+
title: action.disabled === true ? action.disabledReason : void 0,
|
|
2254
|
+
style: {
|
|
2255
|
+
...customActionsInRow ? { flex: "1 1 0px", minWidth: 0, paddingLeft: "4px", paddingRight: "4px" } : { flex: 1, minWidth: "120px" },
|
|
2256
|
+
height: touchSize,
|
|
2257
|
+
borderRadius: "6px",
|
|
2258
|
+
fontSize: "11px",
|
|
2259
|
+
fontWeight: 600,
|
|
2260
|
+
fontFamily: "monospace",
|
|
2261
|
+
letterSpacing: "0.5px",
|
|
2262
|
+
textTransform: "uppercase",
|
|
2263
|
+
transition: "all 0.15s",
|
|
2264
|
+
...variantStyle
|
|
2265
|
+
},
|
|
2266
|
+
children: [
|
|
2267
|
+
isComplete && !action.icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { "aria-hidden": "true", style: { marginRight: "6px" }, children: "\u2713" }),
|
|
2268
|
+
action.icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { marginRight: "6px" }, children: action.icon }),
|
|
2269
|
+
action.label
|
|
2270
|
+
]
|
|
2271
|
+
},
|
|
2272
|
+
action.id
|
|
2273
|
+
);
|
|
2274
|
+
})
|
|
2275
|
+
}
|
|
2276
|
+
)
|
|
2224
2277
|
] }),
|
|
2225
2278
|
binding.state.lastCommandResult && showToast && showBuiltInToast && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2226
2279
|
"div",
|