@procaaso/alphinity-ui-components 1.16.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 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,
@@ -2165,7 +2179,7 @@ function DeviceControlPanelImpl({
2165
2179
  },
2166
2180
  disabled: !startEnabledNow,
2167
2181
  "aria-busy": startPending || void 0,
2168
- style: startStopButtonStyle(startEnabledNow, "#10b981"),
2182
+ style: startStopButtonStyle(startEnabledNow, START_BUTTON_BG),
2169
2183
  children: startPending ? "STARTING\u2026" : "START"
2170
2184
  }
2171
2185
  ),
@@ -2180,7 +2194,7 @@ function DeviceControlPanelImpl({
2180
2194
  },
2181
2195
  disabled: !stopEnabledNow,
2182
2196
  "aria-busy": stopPending || void 0,
2183
- style: startStopButtonStyle(stopEnabledNow, "#ef4444"),
2197
+ style: startStopButtonStyle(stopEnabledNow, STOP_BUTTON_BG),
2184
2198
  children: stopPending ? "STOPPING\u2026" : "STOP"
2185
2199
  }
2186
2200
  )
@@ -2196,32 +2210,61 @@ function DeviceControlPanelImpl({
2196
2210
  gap: "8px"
2197
2211
  },
2198
2212
  children: activeCapabilities.customActions.map((action) => {
2199
- const actionDisabled = action.disabled === true;
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
+ }
2200
2244
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2201
2245
  "button",
2202
2246
  {
2247
+ type: "button",
2248
+ "data-variant": action.variant,
2203
2249
  onClick: () => {
2204
2250
  if (!actionDisabled) onCustomAction?.(action.id);
2205
2251
  },
2206
2252
  disabled: actionDisabled,
2207
- title: actionDisabled ? action.disabledReason : void 0,
2253
+ title: action.disabled === true ? action.disabledReason : void 0,
2208
2254
  style: {
2209
2255
  ...customActionsInRow ? { flex: "1 1 0px", minWidth: 0, paddingLeft: "4px", paddingRight: "4px" } : { flex: 1, minWidth: "120px" },
2210
2256
  height: touchSize,
2211
- backgroundColor: surfaceColor,
2212
- color: textColor,
2213
- border: `1px solid ${borderColor}`,
2214
2257
  borderRadius: "6px",
2215
2258
  fontSize: "11px",
2216
2259
  fontWeight: 600,
2217
2260
  fontFamily: "monospace",
2218
2261
  letterSpacing: "0.5px",
2219
2262
  textTransform: "uppercase",
2220
- cursor: actionDisabled ? "not-allowed" : "pointer",
2221
- opacity: actionDisabled ? 0.4 : 1,
2222
- transition: "all 0.15s"
2263
+ transition: "all 0.15s",
2264
+ ...variantStyle
2223
2265
  },
2224
2266
  children: [
2267
+ isComplete && !action.icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { "aria-hidden": "true", style: { marginRight: "6px" }, children: "\u2713" }),
2225
2268
  action.icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { marginRight: "6px" }, children: action.icon }),
2226
2269
  action.label
2227
2270
  ]