@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 +53 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -2
- package/dist/index.d.ts +17 -2
- package/dist/index.js +53 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -510,8 +510,23 @@ interface CustomAction {
|
|
|
510
510
|
label: string;
|
|
511
511
|
/** Optional leading icon / emoji. */
|
|
512
512
|
icon?: string;
|
|
513
|
-
/**
|
|
514
|
-
|
|
513
|
+
/**
|
|
514
|
+
* Visual variant. The ramp variants give the button a colour that shows its
|
|
515
|
+
* function:
|
|
516
|
+
* - `start`: green, the same green as START (for example START RAMP).
|
|
517
|
+
* - `hold`: amber (for example HOLD).
|
|
518
|
+
* - `cancel`: slate grey. Red stays only on STOP, so an operator cannot
|
|
519
|
+
* confuse "cancel the ramp" with "stop the device".
|
|
520
|
+
* - `complete`: a status, not a command. A pale green fill, a solid green
|
|
521
|
+
* border, and a check mark. The operator cannot press it, and it never
|
|
522
|
+
* fires onCustomAction.
|
|
523
|
+
* When `disabled` is true, `start` / `hold` / `cancel` use the same hatched,
|
|
524
|
+
* dashed-border look as a disabled START.
|
|
525
|
+
*
|
|
526
|
+
* `primary` / `secondary` / `alarm` / `warning` are reserved and render as a
|
|
527
|
+
* plain button.
|
|
528
|
+
*/
|
|
529
|
+
variant?: 'primary' | 'secondary' | 'alarm' | 'warning' | 'start' | 'hold' | 'cancel' | 'complete';
|
|
515
530
|
/**
|
|
516
531
|
* When true, the button renders disabled and does NOT fire onCustomAction.
|
|
517
532
|
* Use for actions that are only conditionally available (e.g. a Tare that is
|
package/dist/index.d.ts
CHANGED
|
@@ -510,8 +510,23 @@ interface CustomAction {
|
|
|
510
510
|
label: string;
|
|
511
511
|
/** Optional leading icon / emoji. */
|
|
512
512
|
icon?: string;
|
|
513
|
-
/**
|
|
514
|
-
|
|
513
|
+
/**
|
|
514
|
+
* Visual variant. The ramp variants give the button a colour that shows its
|
|
515
|
+
* function:
|
|
516
|
+
* - `start`: green, the same green as START (for example START RAMP).
|
|
517
|
+
* - `hold`: amber (for example HOLD).
|
|
518
|
+
* - `cancel`: slate grey. Red stays only on STOP, so an operator cannot
|
|
519
|
+
* confuse "cancel the ramp" with "stop the device".
|
|
520
|
+
* - `complete`: a status, not a command. A pale green fill, a solid green
|
|
521
|
+
* border, and a check mark. The operator cannot press it, and it never
|
|
522
|
+
* fires onCustomAction.
|
|
523
|
+
* When `disabled` is true, `start` / `hold` / `cancel` use the same hatched,
|
|
524
|
+
* dashed-border look as a disabled START.
|
|
525
|
+
*
|
|
526
|
+
* `primary` / `secondary` / `alarm` / `warning` are reserved and render as a
|
|
527
|
+
* plain button.
|
|
528
|
+
*/
|
|
529
|
+
variant?: 'primary' | 'secondary' | 'alarm' | 'warning' | 'start' | 'hold' | 'cancel' | 'complete';
|
|
515
530
|
/**
|
|
516
531
|
* When true, the button renders disabled and does NOT fire onCustomAction.
|
|
517
532
|
* Use for actions that are only conditionally available (e.g. a Tare that is
|
package/dist/index.js
CHANGED
|
@@ -1143,6 +1143,20 @@ var DISABLED_BUTTON_BG = "#e5e7eb";
|
|
|
1143
1143
|
var DISABLED_BUTTON_TEXT = "#4b5563";
|
|
1144
1144
|
var DISABLED_BUTTON_BORDER = "#6b7280";
|
|
1145
1145
|
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)";
|
|
1146
|
+
var START_BUTTON_BG = "#10b981";
|
|
1147
|
+
var STOP_BUTTON_BG = "#ef4444";
|
|
1148
|
+
var COMMAND_VARIANT_STYLES = {
|
|
1149
|
+
start: { backgroundColor: START_BUTTON_BG, color: "#ffffff" },
|
|
1150
|
+
hold: { backgroundColor: "#f59e0b", color: "#1f1300" },
|
|
1151
|
+
cancel: { backgroundColor: "#64748b", color: "#ffffff" }
|
|
1152
|
+
};
|
|
1153
|
+
var COMPLETE_VARIANT_STYLE = {
|
|
1154
|
+
backgroundColor: "#d1fae5",
|
|
1155
|
+
color: "#065f46",
|
|
1156
|
+
border: `2px solid ${START_BUTTON_BG}`,
|
|
1157
|
+
cursor: "default",
|
|
1158
|
+
opacity: 1
|
|
1159
|
+
};
|
|
1146
1160
|
function DeviceControlPanelImpl({
|
|
1147
1161
|
binding,
|
|
1148
1162
|
onClose,
|
|
@@ -2042,7 +2056,7 @@ function DeviceControlPanelImpl({
|
|
|
2042
2056
|
},
|
|
2043
2057
|
disabled: !startEnabledNow,
|
|
2044
2058
|
"aria-busy": startPending || void 0,
|
|
2045
|
-
style: startStopButtonStyle(startEnabledNow,
|
|
2059
|
+
style: startStopButtonStyle(startEnabledNow, START_BUTTON_BG),
|
|
2046
2060
|
children: startPending ? "STARTING\u2026" : "START"
|
|
2047
2061
|
}
|
|
2048
2062
|
),
|
|
@@ -2057,7 +2071,7 @@ function DeviceControlPanelImpl({
|
|
|
2057
2071
|
},
|
|
2058
2072
|
disabled: !stopEnabledNow,
|
|
2059
2073
|
"aria-busy": stopPending || void 0,
|
|
2060
|
-
style: startStopButtonStyle(stopEnabledNow,
|
|
2074
|
+
style: startStopButtonStyle(stopEnabledNow, STOP_BUTTON_BG),
|
|
2061
2075
|
children: stopPending ? "STOPPING\u2026" : "STOP"
|
|
2062
2076
|
}
|
|
2063
2077
|
)
|
|
@@ -2073,32 +2087,61 @@ function DeviceControlPanelImpl({
|
|
|
2073
2087
|
gap: "8px"
|
|
2074
2088
|
},
|
|
2075
2089
|
children: activeCapabilities.customActions.map((action) => {
|
|
2076
|
-
const
|
|
2090
|
+
const isComplete = action.variant === "complete";
|
|
2091
|
+
const actionDisabled = action.disabled === true || isComplete;
|
|
2092
|
+
const commandStyle = action.variant === "start" || action.variant === "hold" || action.variant === "cancel" ? COMMAND_VARIANT_STYLES[action.variant] : void 0;
|
|
2093
|
+
let variantStyle;
|
|
2094
|
+
if (isComplete) {
|
|
2095
|
+
variantStyle = COMPLETE_VARIANT_STYLE;
|
|
2096
|
+
} else if (commandStyle && actionDisabled) {
|
|
2097
|
+
variantStyle = {
|
|
2098
|
+
backgroundColor: DISABLED_BUTTON_BG,
|
|
2099
|
+
backgroundImage: DISABLED_BUTTON_HATCH,
|
|
2100
|
+
color: DISABLED_BUTTON_TEXT,
|
|
2101
|
+
border: `2px dashed ${DISABLED_BUTTON_BORDER}`,
|
|
2102
|
+
cursor: "not-allowed",
|
|
2103
|
+
opacity: 1
|
|
2104
|
+
};
|
|
2105
|
+
} else if (commandStyle) {
|
|
2106
|
+
variantStyle = {
|
|
2107
|
+
...commandStyle,
|
|
2108
|
+
border: "2px solid transparent",
|
|
2109
|
+
cursor: "pointer",
|
|
2110
|
+
opacity: 1
|
|
2111
|
+
};
|
|
2112
|
+
} else {
|
|
2113
|
+
variantStyle = {
|
|
2114
|
+
backgroundColor: surfaceColor,
|
|
2115
|
+
color: textColor,
|
|
2116
|
+
border: `1px solid ${borderColor}`,
|
|
2117
|
+
cursor: actionDisabled ? "not-allowed" : "pointer",
|
|
2118
|
+
opacity: actionDisabled ? 0.4 : 1
|
|
2119
|
+
};
|
|
2120
|
+
}
|
|
2077
2121
|
return /* @__PURE__ */ jsxs8(
|
|
2078
2122
|
"button",
|
|
2079
2123
|
{
|
|
2124
|
+
type: "button",
|
|
2125
|
+
"data-variant": action.variant,
|
|
2080
2126
|
onClick: () => {
|
|
2081
2127
|
if (!actionDisabled) onCustomAction?.(action.id);
|
|
2082
2128
|
},
|
|
2083
2129
|
disabled: actionDisabled,
|
|
2084
|
-
title:
|
|
2130
|
+
title: action.disabled === true ? action.disabledReason : void 0,
|
|
2085
2131
|
style: {
|
|
2086
2132
|
...customActionsInRow ? { flex: "1 1 0px", minWidth: 0, paddingLeft: "4px", paddingRight: "4px" } : { flex: 1, minWidth: "120px" },
|
|
2087
2133
|
height: touchSize,
|
|
2088
|
-
backgroundColor: surfaceColor,
|
|
2089
|
-
color: textColor,
|
|
2090
|
-
border: `1px solid ${borderColor}`,
|
|
2091
2134
|
borderRadius: "6px",
|
|
2092
2135
|
fontSize: "11px",
|
|
2093
2136
|
fontWeight: 600,
|
|
2094
2137
|
fontFamily: "monospace",
|
|
2095
2138
|
letterSpacing: "0.5px",
|
|
2096
2139
|
textTransform: "uppercase",
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
transition: "all 0.15s"
|
|
2140
|
+
transition: "all 0.15s",
|
|
2141
|
+
...variantStyle
|
|
2100
2142
|
},
|
|
2101
2143
|
children: [
|
|
2144
|
+
isComplete && !action.icon && /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", style: { marginRight: "6px" }, children: "\u2713" }),
|
|
2102
2145
|
action.icon && /* @__PURE__ */ jsx9("span", { style: { marginRight: "6px" }, children: action.icon }),
|
|
2103
2146
|
action.label
|
|
2104
2147
|
]
|