@geomak/ui 1.7.4 → 1.8.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 +314 -197
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +82 -41
- package/dist/index.d.ts +82 -41
- package/dist/index.js +314 -197
- package/dist/index.js.map +1 -1
- package/dist/styles.css +91 -129
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -229,10 +229,10 @@ function IconButton({
|
|
|
229
229
|
}) {
|
|
230
230
|
const colorScheme = React9.useMemo(() => {
|
|
231
231
|
if (type === "primary") {
|
|
232
|
-
return "
|
|
232
|
+
return "bg-accent text-accent-fg hover:bg-accent-hover";
|
|
233
233
|
}
|
|
234
234
|
if (type === "bordered") {
|
|
235
|
-
return "bg-
|
|
235
|
+
return "bg-surface text-foreground hover:bg-surface-raised border border-border-strong";
|
|
236
236
|
}
|
|
237
237
|
return "";
|
|
238
238
|
}, [type]);
|
|
@@ -242,35 +242,37 @@ function IconButton({
|
|
|
242
242
|
type: buttonType,
|
|
243
243
|
disabled: disabled || loading,
|
|
244
244
|
onClick,
|
|
245
|
-
className: `${size === "sm" ? "p-1" : "p-2"} rounded-lg shadow-
|
|
245
|
+
className: `${size === "sm" ? "p-1" : "p-2"} rounded-lg shadow-md transition-colors duration-150 ${colorScheme} disabled:bg-surface-raised disabled:text-foreground-muted disabled:cursor-not-allowed focus:outline-none focus-visible:ring-2 focus-visible:ring-accent`,
|
|
246
246
|
children: loading ? loadingIcon : icon
|
|
247
247
|
}
|
|
248
248
|
);
|
|
249
249
|
}
|
|
250
250
|
var VARIANT_CLASSES = {
|
|
251
251
|
primary: [
|
|
252
|
-
"bg-accent text-
|
|
252
|
+
"bg-accent text-accent-fg",
|
|
253
253
|
"hover:bg-accent-hover",
|
|
254
254
|
"active:bg-accent",
|
|
255
|
-
"disabled:bg-
|
|
255
|
+
"disabled:bg-foreground-muted disabled:text-accent-fg/70 disabled:cursor-not-allowed",
|
|
256
256
|
"focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2"
|
|
257
257
|
].join(" "),
|
|
258
258
|
secondary: [
|
|
259
259
|
"bg-transparent border border-accent text-accent",
|
|
260
|
-
"hover:bg-accent hover:text-
|
|
261
|
-
"active:bg-accent-hover active:text-
|
|
262
|
-
"disabled:border-
|
|
260
|
+
"hover:bg-accent hover:text-accent-fg",
|
|
261
|
+
"active:bg-accent-hover active:text-accent-fg",
|
|
262
|
+
"disabled:border-foreground-muted disabled:text-foreground-muted disabled:cursor-not-allowed",
|
|
263
263
|
"focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2"
|
|
264
264
|
].join(" "),
|
|
265
265
|
ghost: [
|
|
266
|
+
// Semantic tokens handle both light and dark modes — no `dark:`
|
|
267
|
+
// variants needed.
|
|
266
268
|
"bg-transparent text-foreground-secondary",
|
|
267
|
-
"hover:bg-
|
|
268
|
-
"active:bg-
|
|
269
|
-
"disabled:text-
|
|
269
|
+
"hover:bg-surface-raised hover:text-foreground",
|
|
270
|
+
"active:bg-surface",
|
|
271
|
+
"disabled:text-foreground-muted disabled:cursor-not-allowed",
|
|
270
272
|
"focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2"
|
|
271
273
|
].join(" "),
|
|
272
274
|
danger: [
|
|
273
|
-
"bg-status-error text-
|
|
275
|
+
"bg-status-error text-accent-fg",
|
|
274
276
|
"hover:opacity-90",
|
|
275
277
|
"active:opacity-100",
|
|
276
278
|
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
@@ -775,12 +777,14 @@ function ToggleButton({ items, onChange, activeKey }) {
|
|
|
775
777
|
value: item.key,
|
|
776
778
|
"aria-label": typeof item.label === "string" ? item.label : item.key,
|
|
777
779
|
className: [
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
"
|
|
781
|
-
|
|
782
|
-
"
|
|
783
|
-
"
|
|
780
|
+
// Semantic tokens handle both light and dark modes via
|
|
781
|
+
// CSS vars — no `dark:` variants needed.
|
|
782
|
+
index === 0 && "rounded-l-lg border-r border-border",
|
|
783
|
+
index === items.length - 1 && "rounded-r-lg border-l border-border",
|
|
784
|
+
"p-2 cursor-pointer transition-colors duration-150 text-foreground-secondary",
|
|
785
|
+
"focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
|
|
786
|
+
"bg-surface hover:bg-surface-raised",
|
|
787
|
+
"data-[state=on]:bg-accent data-[state=on]:text-accent-fg"
|
|
784
788
|
].filter(Boolean).join(" "),
|
|
785
789
|
children: item.icon ?? item.label
|
|
786
790
|
},
|
|
@@ -972,59 +976,103 @@ function useNotification() {
|
|
|
972
976
|
danger: (props) => open({ type: "danger", ...props })
|
|
973
977
|
};
|
|
974
978
|
}
|
|
979
|
+
var SIZE_MAP = {
|
|
980
|
+
sm: { outer: "w-8 h-8", inner: "w-4 h-4", dot: "w-1 h-1", stroke: "border-2", text: "text-xs" },
|
|
981
|
+
md: { outer: "w-20 h-20", inner: "w-12 h-12", dot: "w-2 h-2", stroke: "border-[3px]", text: "text-2xl" },
|
|
982
|
+
lg: { outer: "w-32 h-32", inner: "w-20 h-20", dot: "w-3 h-3", stroke: "border-4", text: "text-4xl" }
|
|
983
|
+
};
|
|
975
984
|
var containerVariants = {
|
|
976
985
|
hidden: {},
|
|
977
|
-
visible: { transition: { staggerChildren: 0.
|
|
986
|
+
visible: { transition: { staggerChildren: 0.05 } }
|
|
978
987
|
};
|
|
979
988
|
var letterVariants = {
|
|
980
|
-
hidden: { opacity: 0, y:
|
|
981
|
-
visible: { opacity: 1, y: 0, transition: { duration: 0.
|
|
989
|
+
hidden: { opacity: 0, y: 4 },
|
|
990
|
+
visible: { opacity: 1, y: 0, transition: { duration: 0.22, ease: "easeOut" } }
|
|
982
991
|
};
|
|
992
|
+
function SpinnerCore({ size, color }) {
|
|
993
|
+
const dims = SIZE_MAP[size];
|
|
994
|
+
const ringColor = color ?? "var(--color-accent)";
|
|
995
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex items-center justify-center", style: { color: ringColor }, children: [
|
|
996
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
997
|
+
"div",
|
|
998
|
+
{
|
|
999
|
+
className: `${dims.outer} ${dims.stroke} rounded-full border-transparent border-t-current border-r-current animate-spin`,
|
|
1000
|
+
style: { animationDuration: "1.4s" },
|
|
1001
|
+
"aria-hidden": "true"
|
|
1002
|
+
}
|
|
1003
|
+
),
|
|
1004
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1005
|
+
"div",
|
|
1006
|
+
{
|
|
1007
|
+
className: `absolute ${dims.inner} ${dims.stroke} rounded-full border-transparent border-b-current border-l-current animate-spin opacity-60`,
|
|
1008
|
+
style: { animationDuration: "0.9s", animationDirection: "reverse" },
|
|
1009
|
+
"aria-hidden": "true"
|
|
1010
|
+
}
|
|
1011
|
+
),
|
|
1012
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1013
|
+
"div",
|
|
1014
|
+
{
|
|
1015
|
+
className: `absolute ${dims.dot} rounded-full bg-current animate-breathe`,
|
|
1016
|
+
"aria-hidden": "true"
|
|
1017
|
+
}
|
|
1018
|
+
)
|
|
1019
|
+
] });
|
|
1020
|
+
}
|
|
983
1021
|
function LoadingSpinner({
|
|
984
1022
|
prompt,
|
|
1023
|
+
size = "md",
|
|
1024
|
+
inline = false,
|
|
985
1025
|
spinnerColor,
|
|
986
1026
|
textColor,
|
|
987
|
-
backdropOpacity = 0.
|
|
1027
|
+
backdropOpacity = 0.8
|
|
988
1028
|
}) {
|
|
989
1029
|
const reduced = framerMotion.useReducedMotion();
|
|
990
|
-
const letters = Array.from(prompt);
|
|
991
|
-
|
|
1030
|
+
const letters = prompt ? Array.from(prompt) : [];
|
|
1031
|
+
const dims = SIZE_MAP[size];
|
|
1032
|
+
const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1033
|
+
/* @__PURE__ */ jsxRuntime.jsx(SpinnerCore, { size, color: spinnerColor }),
|
|
1034
|
+
letters.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1035
|
+
framerMotion.motion.div,
|
|
1036
|
+
{
|
|
1037
|
+
className: `${dims.text} font-semibold tracking-tight select-none`,
|
|
1038
|
+
style: { color: textColor ?? "var(--color-foreground)" },
|
|
1039
|
+
variants: containerVariants,
|
|
1040
|
+
initial: reduced ? "visible" : "hidden",
|
|
1041
|
+
animate: "visible",
|
|
1042
|
+
"aria-hidden": "true",
|
|
1043
|
+
children: letters.map((letter, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1044
|
+
framerMotion.motion.span,
|
|
1045
|
+
{
|
|
1046
|
+
className: "inline-block whitespace-pre",
|
|
1047
|
+
variants: letterVariants,
|
|
1048
|
+
children: letter
|
|
1049
|
+
},
|
|
1050
|
+
index
|
|
1051
|
+
))
|
|
1052
|
+
}
|
|
1053
|
+
)
|
|
1054
|
+
] });
|
|
1055
|
+
if (inline) {
|
|
1056
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1057
|
+
"div",
|
|
1058
|
+
{
|
|
1059
|
+
role: "status",
|
|
1060
|
+
"aria-live": "polite",
|
|
1061
|
+
"aria-label": prompt ?? "Loading",
|
|
1062
|
+
className: "flex flex-col items-center justify-center gap-3",
|
|
1063
|
+
children: content
|
|
1064
|
+
}
|
|
1065
|
+
);
|
|
1066
|
+
}
|
|
1067
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
992
1068
|
"div",
|
|
993
1069
|
{
|
|
994
1070
|
role: "status",
|
|
995
1071
|
"aria-live": "polite",
|
|
996
|
-
"aria-label": prompt,
|
|
997
|
-
className: "fixed inset-0 z-[8000000] flex flex-col items-center justify-center gap-6 bg-background",
|
|
1072
|
+
"aria-label": prompt ?? "Loading",
|
|
1073
|
+
className: "fixed inset-0 z-[8000000] flex flex-col items-center justify-center gap-6 bg-background backdrop-blur-sm",
|
|
998
1074
|
style: { opacity: backdropOpacity },
|
|
999
|
-
children:
|
|
1000
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1001
|
-
"div",
|
|
1002
|
-
{
|
|
1003
|
-
className: "w-20 h-20 rounded-2xl border-[6px] border-transparent border-t-current border-r-current animate-spin",
|
|
1004
|
-
style: { color: spinnerColor ?? "var(--color-accent)" },
|
|
1005
|
-
"aria-hidden": "true"
|
|
1006
|
-
}
|
|
1007
|
-
),
|
|
1008
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1009
|
-
framerMotion.motion.div,
|
|
1010
|
-
{
|
|
1011
|
-
className: "text-3xl font-bold tracking-tight select-none",
|
|
1012
|
-
style: { color: textColor ?? "var(--color-foreground)" },
|
|
1013
|
-
variants: containerVariants,
|
|
1014
|
-
initial: reduced ? "visible" : "hidden",
|
|
1015
|
-
animate: "visible",
|
|
1016
|
-
children: letters.map((letter, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1017
|
-
framerMotion.motion.span,
|
|
1018
|
-
{
|
|
1019
|
-
className: "inline-block whitespace-pre",
|
|
1020
|
-
variants: letterVariants,
|
|
1021
|
-
children: letter
|
|
1022
|
-
},
|
|
1023
|
-
index
|
|
1024
|
-
))
|
|
1025
|
-
}
|
|
1026
|
-
)
|
|
1027
|
-
]
|
|
1075
|
+
children: content
|
|
1028
1076
|
}
|
|
1029
1077
|
) });
|
|
1030
1078
|
}
|
|
@@ -1050,25 +1098,43 @@ function FadingBase({
|
|
|
1050
1098
|
}
|
|
1051
1099
|
}, [isMounted]);
|
|
1052
1100
|
if (!shouldRender) return null;
|
|
1053
|
-
return
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1101
|
+
return (
|
|
1102
|
+
// `calculated-height` and `dark:glassmorphism` were orphaned CSS classes
|
|
1103
|
+
// (never defined anywhere). Replaced with semantic `min-h-full` +
|
|
1104
|
+
// `bg-surface` which works in both light and dark modes via the
|
|
1105
|
+
// ThemeProvider's CSS vars.
|
|
1106
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1107
|
+
"div",
|
|
1108
|
+
{
|
|
1109
|
+
className: `w-full min-h-full pl-2 pr-2 pb-2 transition-opacity duration-300 ${visible ? "opacity-100" : "opacity-0"}`,
|
|
1110
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: `bg-surface w-full h-full rounded-lg p-2 ${className}`, children })
|
|
1111
|
+
}
|
|
1112
|
+
)
|
|
1059
1113
|
);
|
|
1060
1114
|
}
|
|
1061
1115
|
function List2({ items, onItemClick, activeKey }) {
|
|
1062
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { role: "listbox", children: items.map((item) =>
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1116
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { role: "listbox", children: items.map((item) => (
|
|
1117
|
+
// tabIndex + Enter/Space onKeyDown makes each option
|
|
1118
|
+
// keyboard-activatable. Previously the items were only mouse-
|
|
1119
|
+
// clickable — keyboard-only users couldn't select anything.
|
|
1120
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1121
|
+
"div",
|
|
1122
|
+
{
|
|
1123
|
+
role: "option",
|
|
1124
|
+
"aria-selected": activeKey === item.key,
|
|
1125
|
+
tabIndex: 0,
|
|
1126
|
+
className: `hover:bg-surface-raised cursor-pointer p-3 border-b border-border transition-colors duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent ${activeKey === item.key ? "bg-surface-raised text-foreground" : "text-foreground-secondary"}`,
|
|
1127
|
+
onClick: () => onItemClick(item),
|
|
1128
|
+
onKeyDown: (e) => {
|
|
1129
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1130
|
+
e.preventDefault();
|
|
1131
|
+
onItemClick(item);
|
|
1132
|
+
}
|
|
1133
|
+
},
|
|
1134
|
+
children: item.label
|
|
1135
|
+
},
|
|
1136
|
+
item.key
|
|
1137
|
+
)
|
|
1072
1138
|
)) });
|
|
1073
1139
|
}
|
|
1074
1140
|
function ScalableContainer({
|
|
@@ -1098,7 +1164,7 @@ function ScalableContainer({
|
|
|
1098
1164
|
width: isScaled ? "100%" : width,
|
|
1099
1165
|
height: isScaled ? "100%" : height
|
|
1100
1166
|
},
|
|
1101
|
-
className: "rounded-lg bg-
|
|
1167
|
+
className: "rounded-lg bg-surface-raised flex flex-col transition-all duration-300 origin-center",
|
|
1102
1168
|
children: [
|
|
1103
1169
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 w-max", children: /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { placement: "right", title: isScaled ? "Collapse" : "Expand", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1104
1170
|
IconButton,
|
|
@@ -1106,10 +1172,10 @@ function ScalableContainer({
|
|
|
1106
1172
|
onClick,
|
|
1107
1173
|
icon: isScaled ? (
|
|
1108
1174
|
/* Collapse (arrows-pointing-in) */
|
|
1109
|
-
/* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "
|
|
1175
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-5 h-5", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M3.22 3.22a.75.75 0 011.06 0l3.97 3.97V4.5a.75.75 0 011.5 0V9a.75.75 0 01-.75.75H4.5a.75.75 0 010-1.5h2.69L3.22 4.28a.75.75 0 010-1.06zm17.56 0a.75.75 0 010 1.06l-3.97 3.97h2.69a.75.75 0 010 1.5H15a.75.75 0 01-.75-.75V4.5a.75.75 0 011.5 0v2.69l3.97-3.97a.75.75 0 011.06 0zM3.75 15a.75.75 0 01.75-.75H9a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-2.69l-3.97 3.97a.75.75 0 01-1.06-1.06l3.97-3.97H4.5a.75.75 0 01-.75-.75zm10.5 0a.75.75 0 01.75-.75h4.5a.75.75 0 01.75.75 .75.75 0 01-.75.75h-2.69l3.97 3.97a.75.75 0 11-1.06 1.06l-3.97-3.97v2.69a.75.75 0 01-1.5 0V15z", clipRule: "evenodd" }) })
|
|
1110
1176
|
) : (
|
|
1111
1177
|
/* Expand (arrows-pointing-out) */
|
|
1112
|
-
/* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "
|
|
1178
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-5 h-5", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M15 3a.75.75 0 01.75-.75h5.25A.75.75 0 0121 3v5.25a.75.75 0 01-1.5 0V4.81l-5.72 5.72a.75.75 0 11-1.06-1.06L18.19 3.75H15.75A.75.75 0 0115 3zM3 15a.75.75 0 01.75-.75h2.44l5.72-5.72a.75.75 0 111.06 1.06l-5.72 5.72v2.44a.75.75 0 01-1.5 0V15.75A.75.75 0 013 15zm0-11.25A.75.75 0 013.75 3h5.25a.75.75 0 010 1.5H4.81l5.72 5.72a.75.75 0 11-1.06 1.06L3.75 5.56V8.25a.75.75 0 01-1.5 0V3.75A.75.75 0 013 3zm18 12a.75.75 0 01-.75.75h-5.25a.75.75 0 010-1.5h2.44l-5.72-5.72a.75.75 0 111.06-1.06l5.72 5.72v-2.44a.75.75 0 011.5 0V15z", clipRule: "evenodd" }) })
|
|
1113
1179
|
)
|
|
1114
1180
|
}
|
|
1115
1181
|
) }) }),
|
|
@@ -1285,7 +1351,7 @@ function MenuBarItem({ icon, isActive, title, onClick }) {
|
|
|
1285
1351
|
role: "button",
|
|
1286
1352
|
"aria-label": title,
|
|
1287
1353
|
"aria-current": isActive ? "page" : void 0,
|
|
1288
|
-
className: `transition duration-300 hover:bg-
|
|
1354
|
+
className: `transition duration-300 hover:bg-accent hover:text-accent-fg ${isActive ? "bg-accent text-accent-fg" : "text-foreground-secondary"} rounded-lg p-2 cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-accent`,
|
|
1289
1355
|
onClick,
|
|
1290
1356
|
tabIndex: 0,
|
|
1291
1357
|
onKeyDown: (e) => {
|
|
@@ -1299,22 +1365,26 @@ function MenuBarItem({ icon, isActive, title, onClick }) {
|
|
|
1299
1365
|
) });
|
|
1300
1366
|
}
|
|
1301
1367
|
function MenuBar({ items }) {
|
|
1302
|
-
return
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1368
|
+
return (
|
|
1369
|
+
// `calculated-height` was an orphaned CSS class. Replaced with `h-full`
|
|
1370
|
+
// so the MenuBar fills whatever vertical space its parent gives it.
|
|
1371
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1372
|
+
"nav",
|
|
1373
|
+
{
|
|
1374
|
+
"aria-label": "Main navigation",
|
|
1375
|
+
className: "w-16 h-full bg-surface-raised rounded-tr-lg rounded-br-lg flex flex-col gap-2 items-center p-2 z-50",
|
|
1376
|
+
children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1377
|
+
MenuBarItem,
|
|
1378
|
+
{
|
|
1379
|
+
icon: item.icon,
|
|
1380
|
+
title: item.title,
|
|
1381
|
+
isActive: item.isActive,
|
|
1382
|
+
onClick: item.onClick
|
|
1383
|
+
},
|
|
1384
|
+
item.key
|
|
1385
|
+
))
|
|
1386
|
+
}
|
|
1387
|
+
)
|
|
1318
1388
|
);
|
|
1319
1389
|
}
|
|
1320
1390
|
function ContextMenu({ items, position, visible, onClose }) {
|
|
@@ -1519,8 +1589,8 @@ var SearchInput = React9__default.default.forwardRef(function SearchInput2({
|
|
|
1519
1589
|
className: `flex ${layout === "vertical" ? "flex-col" : "flex-row items-center gap-2"}`,
|
|
1520
1590
|
style: style ?? {},
|
|
1521
1591
|
children: [
|
|
1522
|
-
label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-
|
|
1523
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-
|
|
1592
|
+
label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium ml-1 max-content text-foreground", htmlFor, children: label }),
|
|
1593
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-surface text-foreground flex items-center gap-1 rounded-lg border border-border pr-2 focus-within:ring-2 focus-within:ring-accent transition-colors", children: [
|
|
1524
1594
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1525
1595
|
"input",
|
|
1526
1596
|
{
|
|
@@ -1532,12 +1602,12 @@ var SearchInput = React9__default.default.forwardRef(function SearchInput2({
|
|
|
1532
1602
|
enterKeyHint: "search",
|
|
1533
1603
|
name,
|
|
1534
1604
|
id: htmlFor,
|
|
1535
|
-
className: "focus:outline-none pl-2 h-9 w-56
|
|
1605
|
+
className: "bg-transparent focus:outline-none pl-2 h-9 w-56 rounded-lg disabled:cursor-not-allowed",
|
|
1536
1606
|
style: inputStyle ?? {},
|
|
1537
1607
|
placeholder: placeholder ?? ""
|
|
1538
1608
|
}
|
|
1539
1609
|
),
|
|
1540
|
-
/* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill:
|
|
1610
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-5 h-5 text-foreground-muted", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M10.5 3.75a6.75 6.75 0 100 13.5 6.75 6.75 0 000-13.5zM2.25 10.5a8.25 8.25 0 1114.59 5.28l4.69 4.69a.75.75 0 11-1.06 1.06l-4.69-4.69A8.25 8.25 0 012.25 10.5z", clipRule: "evenodd" }) })
|
|
1541
1611
|
] })
|
|
1542
1612
|
]
|
|
1543
1613
|
}
|
|
@@ -1548,7 +1618,7 @@ function DropdownPill({ value, hasSiblings = false }) {
|
|
|
1548
1618
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1549
1619
|
"div",
|
|
1550
1620
|
{
|
|
1551
|
-
className: `bg-
|
|
1621
|
+
className: `bg-accent text-accent-fg text-sm text-ellipsis ${hasSiblings ? "w-24" : "w-max"} p-1 px-2 rounded-lg whitespace-nowrap overflow-hidden`,
|
|
1552
1622
|
children: value
|
|
1553
1623
|
}
|
|
1554
1624
|
);
|
|
@@ -1571,9 +1641,10 @@ function Dropdown({
|
|
|
1571
1641
|
}) {
|
|
1572
1642
|
const [open, setOpen] = React9.useState(false);
|
|
1573
1643
|
const [selectedItems, setSelectedItems] = React9.useState([]);
|
|
1574
|
-
const [hoveredItem, setHoveredItem] = React9.useState(null);
|
|
1575
1644
|
const [searchTerm, setSearchTerm] = React9.useState("");
|
|
1576
1645
|
const [innerItems, setInnerItems] = React9.useState([]);
|
|
1646
|
+
const errorId = React9.useId();
|
|
1647
|
+
const hasError = errorMessage != null;
|
|
1577
1648
|
React9.useEffect(() => {
|
|
1578
1649
|
setInnerItems(items);
|
|
1579
1650
|
}, [items]);
|
|
@@ -1612,7 +1683,7 @@ function Dropdown({
|
|
|
1612
1683
|
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1613
1684
|
"label",
|
|
1614
1685
|
{
|
|
1615
|
-
className: "text-
|
|
1686
|
+
className: "text-sm font-medium ml-1 max-content select-none text-foreground",
|
|
1616
1687
|
htmlFor,
|
|
1617
1688
|
style: labelStyle,
|
|
1618
1689
|
children: label
|
|
@@ -1626,16 +1697,24 @@ function Dropdown({
|
|
|
1626
1697
|
role: "combobox",
|
|
1627
1698
|
"aria-expanded": open,
|
|
1628
1699
|
"aria-haspopup": "listbox",
|
|
1700
|
+
"aria-invalid": hasError || void 0,
|
|
1701
|
+
"aria-describedby": hasError ? errorId : void 0,
|
|
1629
1702
|
style,
|
|
1630
|
-
className: `flex items-center justify-between relative h-9 rounded-lg cursor-pointer select-none ${disabled ? "cursor-not-allowed bg-
|
|
1703
|
+
className: `flex items-center justify-between relative h-9 rounded-lg border border-border cursor-pointer select-none focus:outline-none focus-visible:ring-2 focus-visible:ring-accent ${disabled ? "cursor-not-allowed bg-surface-raised text-foreground-muted" : "bg-surface text-foreground"} ${hasError ? "border-status-error" : ""}`,
|
|
1631
1704
|
tabIndex: disabled ? -1 : 0,
|
|
1632
|
-
onKeyDown: (e) =>
|
|
1705
|
+
onKeyDown: (e) => {
|
|
1706
|
+
if (disabled) return;
|
|
1707
|
+
if (e.key === "Enter" || e.key === " " || e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
1708
|
+
e.preventDefault();
|
|
1709
|
+
setOpen(true);
|
|
1710
|
+
}
|
|
1711
|
+
},
|
|
1633
1712
|
children: [
|
|
1634
1713
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1635
1714
|
"div",
|
|
1636
1715
|
{
|
|
1637
|
-
className: `h-7 pl-2 ${!style?.width ? "min-w-[240px]" : ""}
|
|
1638
|
-
children: !value || Array.isArray(value) && value.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-
|
|
1716
|
+
className: `h-7 pl-2 ${!style?.width ? "min-w-[240px]" : ""} flex items-center gap-1 overflow-hidden`,
|
|
1717
|
+
children: !value || Array.isArray(value) && value.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground-muted text-sm", children: placeholder }) : Array.isArray(value) ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1639
1718
|
value.slice(0, 1).map((val) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1640
1719
|
DropdownPill,
|
|
1641
1720
|
{
|
|
@@ -1648,7 +1727,7 @@ function Dropdown({
|
|
|
1648
1727
|
] }) : /* @__PURE__ */ jsxRuntime.jsx(DropdownPill, { value: innerItems.find((it) => it.key === value)?.label })
|
|
1649
1728
|
}
|
|
1650
1729
|
),
|
|
1651
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `transition-transform duration-
|
|
1730
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `transition-transform duration-200 mr-2 ${open ? "rotate-180" : "rotate-0"}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "h-4 w-4", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) }) })
|
|
1652
1731
|
]
|
|
1653
1732
|
}
|
|
1654
1733
|
) }),
|
|
@@ -1658,7 +1737,7 @@ function Dropdown({
|
|
|
1658
1737
|
align: "start",
|
|
1659
1738
|
sideOffset: 4,
|
|
1660
1739
|
style: { width: style?.width || 240 },
|
|
1661
|
-
className: "bg-
|
|
1740
|
+
className: "bg-surface text-foreground border border-border rounded-lg shadow-md z-50 p-2 animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
1662
1741
|
onInteractOutside: () => setOpen(false),
|
|
1663
1742
|
children: [
|
|
1664
1743
|
hasSearch && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1671,34 +1750,50 @@ function Dropdown({
|
|
|
1671
1750
|
placeholder: "Search..."
|
|
1672
1751
|
}
|
|
1673
1752
|
) }),
|
|
1674
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { role: "listbox", "aria-multiselectable": isMultiselect, className: "max-h-40 overflow-y-auto", children: innerItems.map((item
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
{
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
strokeWidth: "2",
|
|
1695
|
-
strokeLinecap: "round",
|
|
1696
|
-
strokeLinejoin: "round"
|
|
1753
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { role: "listbox", "aria-multiselectable": isMultiselect, className: "max-h-40 overflow-y-auto", children: innerItems.map((item) => (
|
|
1754
|
+
// aria-rowindex was previously set here but
|
|
1755
|
+
// it's invalid ARIA on role="option" (it
|
|
1756
|
+
// belongs on rows of a grid/treegrid). Dropped.
|
|
1757
|
+
// tabIndex={0} + Enter/Space handler makes the
|
|
1758
|
+
// option keyboard-activatable; the full
|
|
1759
|
+
// combobox roving-tabindex pattern is deferred
|
|
1760
|
+
// until the planned Phase-5 rewrite.
|
|
1761
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1762
|
+
"div",
|
|
1763
|
+
{
|
|
1764
|
+
role: "option",
|
|
1765
|
+
"aria-selected": isSelected(item.key),
|
|
1766
|
+
tabIndex: 0,
|
|
1767
|
+
className: `flex items-center justify-between p-2 hover:bg-accent hover:text-accent-fg transition-colors duration-150 text-sm rounded-lg cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-accent ${selectedItems.includes(item.key) ? "bg-surface-raised text-foreground" : "text-foreground"}`,
|
|
1768
|
+
onClick: () => selectItem(item.key),
|
|
1769
|
+
onKeyDown: (e) => {
|
|
1770
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1771
|
+
e.preventDefault();
|
|
1772
|
+
selectItem(item.key);
|
|
1697
1773
|
}
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1774
|
+
},
|
|
1775
|
+
children: [
|
|
1776
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
1777
|
+
item.icon && /* @__PURE__ */ jsxRuntime.jsx("div", { children: item.icon }),
|
|
1778
|
+
item.label
|
|
1779
|
+
] }),
|
|
1780
|
+
isSelected(item.key) && // currentColor — checkmark follows
|
|
1781
|
+
// the item's text colour, which
|
|
1782
|
+
// flips automatically on hover.
|
|
1783
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1784
|
+
"path",
|
|
1785
|
+
{
|
|
1786
|
+
d: "M4 10l4.5 4.5L16 6",
|
|
1787
|
+
stroke: "currentColor",
|
|
1788
|
+
strokeWidth: "2",
|
|
1789
|
+
strokeLinecap: "round",
|
|
1790
|
+
strokeLinejoin: "round"
|
|
1791
|
+
}
|
|
1792
|
+
) })
|
|
1793
|
+
]
|
|
1794
|
+
},
|
|
1795
|
+
item.key
|
|
1796
|
+
)
|
|
1702
1797
|
)) })
|
|
1703
1798
|
]
|
|
1704
1799
|
}
|
|
@@ -1707,7 +1802,7 @@ function Dropdown({
|
|
|
1707
1802
|
]
|
|
1708
1803
|
}
|
|
1709
1804
|
),
|
|
1710
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-error
|
|
1805
|
+
hasError && /* @__PURE__ */ jsxRuntime.jsx("div", { id: errorId, className: "text-center text-status-error text-xs mt-1", children: errorMessage })
|
|
1711
1806
|
] });
|
|
1712
1807
|
}
|
|
1713
1808
|
var DEFAULT_PICKER = [
|
|
@@ -1877,10 +1972,11 @@ function Pagination({
|
|
|
1877
1972
|
isMultiselect: false,
|
|
1878
1973
|
value: displayPerPageKey,
|
|
1879
1974
|
onChange: ({ target: { value } }) => {
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1975
|
+
if (Array.isArray(value)) return;
|
|
1976
|
+
const numKey = typeof value === "number" ? value : Number(value);
|
|
1977
|
+
if (!serverSide) setPerPageKey(numKey);
|
|
1978
|
+
const opt = picker.find((o) => o.key === numKey);
|
|
1979
|
+
onPerPageChange(opt?.label ?? opt?.value ?? numKey);
|
|
1884
1980
|
}
|
|
1885
1981
|
}
|
|
1886
1982
|
)
|
|
@@ -2533,6 +2629,8 @@ function TextInput({
|
|
|
2533
2629
|
errorMessage,
|
|
2534
2630
|
labelColor
|
|
2535
2631
|
}) {
|
|
2632
|
+
const errorId = React9.useId();
|
|
2633
|
+
const hasError = errorMessage != null;
|
|
2536
2634
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col items-center justify-center", children: [
|
|
2537
2635
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2538
2636
|
"div",
|
|
@@ -2547,7 +2645,7 @@ function TextInput({
|
|
|
2547
2645
|
"label",
|
|
2548
2646
|
{
|
|
2549
2647
|
style: { color: labelColor || void 0 },
|
|
2550
|
-
className: `text-
|
|
2648
|
+
className: `text-sm font-medium ml-1 max-content ${!labelColor && "text-foreground"}`,
|
|
2551
2649
|
htmlFor,
|
|
2552
2650
|
children: label
|
|
2553
2651
|
}
|
|
@@ -2563,7 +2661,9 @@ function TextInput({
|
|
|
2563
2661
|
type: "text",
|
|
2564
2662
|
name,
|
|
2565
2663
|
id: htmlFor,
|
|
2566
|
-
|
|
2664
|
+
"aria-invalid": hasError || void 0,
|
|
2665
|
+
"aria-describedby": hasError ? errorId : void 0,
|
|
2666
|
+
className: `${hasError ? "border border-status-error" : "border border-border"} bg-surface text-foreground p-2 h-9 w-60 mt-1 rounded-lg disabled:bg-surface-raised disabled:text-foreground-muted disabled:cursor-not-allowed focus:outline-none focus-visible:ring-2 focus-visible:ring-accent transition-colors`,
|
|
2567
2667
|
style: inputStyle ?? {},
|
|
2568
2668
|
placeholder: placeholder ?? ""
|
|
2569
2669
|
}
|
|
@@ -2571,7 +2671,7 @@ function TextInput({
|
|
|
2571
2671
|
]
|
|
2572
2672
|
}
|
|
2573
2673
|
),
|
|
2574
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-error
|
|
2674
|
+
hasError && /* @__PURE__ */ jsxRuntime.jsx("div", { id: errorId, className: "text-center text-status-error text-xs mt-1", children: errorMessage })
|
|
2575
2675
|
] });
|
|
2576
2676
|
}
|
|
2577
2677
|
function NumberInput({
|
|
@@ -2686,17 +2786,15 @@ function Password({
|
|
|
2686
2786
|
iconColor
|
|
2687
2787
|
}) {
|
|
2688
2788
|
const [passwordVisible, setPasswordVisible] = React9.useState(false);
|
|
2689
|
-
const
|
|
2789
|
+
const errorId = React9.useId();
|
|
2790
|
+
const hasError = errorMessage != null;
|
|
2690
2791
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col items-center justify-center", style: style ?? {}, children: [
|
|
2691
2792
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex ${layout === "vertical" ? "flex-col" : "flex-row items-center gap-2"}`, children: [
|
|
2692
|
-
label &&
|
|
2693
|
-
// <label htmlFor=…> announces as an unlabeled control in
|
|
2694
|
-
// some screen readers.
|
|
2695
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2793
|
+
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2696
2794
|
"label",
|
|
2697
2795
|
{
|
|
2698
2796
|
style: { color: labelColor || void 0 },
|
|
2699
|
-
className: `text-
|
|
2797
|
+
className: `text-sm font-medium ml-1 max-content ${!labelColor && "text-foreground"}`,
|
|
2700
2798
|
htmlFor,
|
|
2701
2799
|
children: label
|
|
2702
2800
|
}
|
|
@@ -2713,7 +2811,9 @@ function Password({
|
|
|
2713
2811
|
type: passwordVisible ? "text" : "password",
|
|
2714
2812
|
name,
|
|
2715
2813
|
id: htmlFor,
|
|
2716
|
-
|
|
2814
|
+
"aria-invalid": hasError || void 0,
|
|
2815
|
+
"aria-describedby": hasError ? errorId : void 0,
|
|
2816
|
+
className: `${hasError ? "border border-status-error" : "border border-border"} bg-surface text-foreground p-2 h-9 w-52 mt-1 rounded-lg disabled:bg-surface-raised disabled:text-foreground-muted disabled:cursor-not-allowed focus:outline-none focus-visible:ring-2 focus-visible:ring-accent transition-colors`,
|
|
2717
2817
|
style: inputStyle ?? {},
|
|
2718
2818
|
placeholder: placeholder ?? ""
|
|
2719
2819
|
}
|
|
@@ -2722,19 +2822,20 @@ function Password({
|
|
|
2722
2822
|
"button",
|
|
2723
2823
|
{
|
|
2724
2824
|
type: "button",
|
|
2725
|
-
className: "cursor-pointer p-1",
|
|
2825
|
+
className: "cursor-pointer p-1 text-foreground-secondary hover:text-foreground rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
|
|
2826
|
+
style: iconColor ? { color: iconColor } : void 0,
|
|
2726
2827
|
onClick: () => setPasswordVisible(!passwordVisible),
|
|
2727
2828
|
"aria-label": passwordVisible ? "Hide password" : "Show password",
|
|
2728
2829
|
children: passwordVisible ? (
|
|
2729
2830
|
/* EyeSlash */
|
|
2730
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill:
|
|
2831
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-6 h-6", children: [
|
|
2731
2832
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3.53 2.47a.75.75 0 00-1.06 1.06l18 18a.75.75 0 101.06-1.06l-18-18zM22.676 12.553a11.249 11.249 0 01-2.631 4.31l-3.099-3.099a5.25 5.25 0 00-6.71-6.71L7.759 4.577a11.217 11.217 0 014.242-.827c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113z" }),
|
|
2732
2833
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15.75 12c0 .18-.013.357-.037.53l-4.244-4.243A3.75 3.75 0 0115.75 12zM12.53 15.713l-4.243-4.244a3.75 3.75 0 004.243 4.243z" }),
|
|
2733
2834
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.75 12c0-.619.107-1.213.304-1.764l-3.1-3.1a11.25 11.25 0 00-2.63 4.31c-.12.362-.12.752 0 1.114 1.489 4.467 5.704 7.69 10.675 7.69 1.5 0 2.933-.294 4.242-.827l-2.477-2.477A5.25 5.25 0 016.75 12z" })
|
|
2734
2835
|
] })
|
|
2735
2836
|
) : (
|
|
2736
2837
|
/* Eye */
|
|
2737
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill:
|
|
2838
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-6 h-6", children: [
|
|
2738
2839
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 15a3 3 0 100-6 3 3 0 000 6z" }),
|
|
2739
2840
|
/* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M1.323 11.447C2.811 6.976 7.028 3.75 12.001 3.75c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113-1.487 4.471-5.705 7.697-10.677 7.697-4.97 0-9.186-3.223-10.675-7.69a1.762 1.762 0 010-1.113zM17.25 12a5.25 5.25 0 11-10.5 0 5.25 5.25 0 0110.5 0z", clipRule: "evenodd" })
|
|
2740
2841
|
] })
|
|
@@ -2743,7 +2844,7 @@ function Password({
|
|
|
2743
2844
|
)
|
|
2744
2845
|
] })
|
|
2745
2846
|
] }),
|
|
2746
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-error
|
|
2847
|
+
hasError && /* @__PURE__ */ jsxRuntime.jsx("div", { id: errorId, className: "text-center text-status-error text-xs mt-1", children: errorMessage })
|
|
2747
2848
|
] });
|
|
2748
2849
|
}
|
|
2749
2850
|
function Checkbox({
|
|
@@ -2832,22 +2933,25 @@ function Switch({
|
|
|
2832
2933
|
uncheckedIcon
|
|
2833
2934
|
}) {
|
|
2834
2935
|
const id = React9.useId();
|
|
2835
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
2836
|
-
|
|
2837
|
-
{
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2936
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2937
|
+
"// mr-12 was a hardcoded right margin that broke layouts; spacing // is the parent's responsibility now.",
|
|
2938
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "flex items-center cursor-pointer select-none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2939
|
+
SwitchPrimitive__namespace.Root,
|
|
2940
|
+
{
|
|
2941
|
+
id,
|
|
2942
|
+
checked,
|
|
2943
|
+
onCheckedChange: (c) => onChange?.({ target: { checked: c } }),
|
|
2944
|
+
className: "relative inline-flex h-6 w-14 items-center rounded-full bg-foreground-secondary data-[state=checked]:bg-accent transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2",
|
|
2945
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2946
|
+
SwitchPrimitive__namespace.Thumb,
|
|
2947
|
+
{
|
|
2948
|
+
className: "pointer-events-none inline-flex h-8 w-8 items-center justify-center rounded-full bg-background text-foreground shadow transition-transform duration-200 data-[state=checked]:translate-x-[22px] data-[state=unchecked]:translate-x-[-4px]",
|
|
2949
|
+
children: checkedIcon && uncheckedIcon ? checked ? checkedIcon : uncheckedIcon : null
|
|
2950
|
+
}
|
|
2951
|
+
)
|
|
2952
|
+
}
|
|
2953
|
+
) })
|
|
2954
|
+
] });
|
|
2851
2955
|
}
|
|
2852
2956
|
function AutoComplete({
|
|
2853
2957
|
disabled,
|
|
@@ -2877,9 +2981,9 @@ function AutoComplete({
|
|
|
2877
2981
|
className: `flex ${layout === "vertical" ? "flex-col" : "flex-row items-center gap-2"}`,
|
|
2878
2982
|
style: style ?? {},
|
|
2879
2983
|
children: [
|
|
2880
|
-
label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-
|
|
2984
|
+
label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium ml-1 max-content text-foreground", children: label }),
|
|
2881
2985
|
/* @__PURE__ */ jsxRuntime.jsxs(Popover__namespace.Root, { open: open && !disabled, onOpenChange: (o) => !disabled && setOpen(o), children: [
|
|
2882
|
-
/* @__PURE__ */ jsxRuntime.jsx(Popover__namespace.Anchor, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-
|
|
2986
|
+
/* @__PURE__ */ jsxRuntime.jsx(Popover__namespace.Anchor, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-surface text-foreground flex items-center gap-1 rounded-lg border border-border pr-2 focus-within:ring-2 focus-within:ring-accent transition-colors", children: [
|
|
2883
2987
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2884
2988
|
"input",
|
|
2885
2989
|
{
|
|
@@ -2892,7 +2996,7 @@ function AutoComplete({
|
|
|
2892
2996
|
onFocus: () => setOpen(true),
|
|
2893
2997
|
type: "text",
|
|
2894
2998
|
name,
|
|
2895
|
-
className: "focus:outline-none pl-2 h-9 w-56
|
|
2999
|
+
className: "bg-transparent focus:outline-none pl-2 h-9 w-56 rounded-lg disabled:cursor-not-allowed",
|
|
2896
3000
|
style: inputStyle ?? {},
|
|
2897
3001
|
placeholder: placeholder ?? "",
|
|
2898
3002
|
autoComplete: "off",
|
|
@@ -2901,7 +3005,7 @@ function AutoComplete({
|
|
|
2901
3005
|
"aria-autocomplete": "list"
|
|
2902
3006
|
}
|
|
2903
3007
|
),
|
|
2904
|
-
/* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill:
|
|
3008
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-5 h-5 flex-shrink-0 text-foreground-muted", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M10.5 3.75a6.75 6.75 0 100 13.5 6.75 6.75 0 000-13.5zM2.25 10.5a8.25 8.25 0 1114.59 5.28l4.69 4.69a.75.75 0 11-1.06 1.06l-4.69-4.69A8.25 8.25 0 012.25 10.5z", clipRule: "evenodd" }) })
|
|
2905
3009
|
] }) }),
|
|
2906
3010
|
/* @__PURE__ */ jsxRuntime.jsx(Popover__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2907
3011
|
Popover__namespace.Content,
|
|
@@ -2909,24 +3013,37 @@ function AutoComplete({
|
|
|
2909
3013
|
align: "start",
|
|
2910
3014
|
sideOffset: 4,
|
|
2911
3015
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
2912
|
-
className: "w-64 bg-
|
|
2913
|
-
children: foundItems.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full flex flex-col items-center justify-center py-4 text-sm text-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
3016
|
+
className: "w-64 bg-surface border border-border rounded-lg mt-1 shadow-md z-50 overflow-y-auto max-h-36 animate-in fade-in-0 zoom-in-95",
|
|
3017
|
+
children: foundItems.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full flex flex-col items-center justify-center py-4 text-sm text-foreground-secondary", children: emptyText }) : /* @__PURE__ */ jsxRuntime.jsx("div", { role: "listbox", children: foundItems.map((item) => (
|
|
3018
|
+
// tabIndex + Enter/Space onKeyDown
|
|
3019
|
+
// makes each option keyboard-activatable.
|
|
3020
|
+
// Full roving-tabindex / arrow-key nav
|
|
3021
|
+
// is deferred to the Phase-5 rewrite.
|
|
3022
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3023
|
+
"div",
|
|
3024
|
+
{
|
|
3025
|
+
role: "option",
|
|
3026
|
+
tabIndex: 0,
|
|
3027
|
+
className: "text-sm flex items-center gap-2 p-2 transition-colors duration-150 hover:bg-surface-raised cursor-pointer text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
|
|
3028
|
+
onClick: () => handleSelect(item),
|
|
3029
|
+
onKeyDown: (e) => {
|
|
3030
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
3031
|
+
e.preventDefault();
|
|
3032
|
+
handleSelect(item);
|
|
3033
|
+
}
|
|
3034
|
+
},
|
|
3035
|
+
children: [
|
|
3036
|
+
item.icon,
|
|
3037
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
3038
|
+
item.label,
|
|
3039
|
+
" (",
|
|
3040
|
+
item.value,
|
|
3041
|
+
")"
|
|
3042
|
+
] })
|
|
3043
|
+
]
|
|
3044
|
+
},
|
|
3045
|
+
item.key
|
|
3046
|
+
)
|
|
2930
3047
|
)) })
|
|
2931
3048
|
}
|
|
2932
3049
|
) })
|
|
@@ -3101,7 +3218,7 @@ function FileInput({
|
|
|
3101
3218
|
openPicker();
|
|
3102
3219
|
}
|
|
3103
3220
|
},
|
|
3104
|
-
className: "border-2
|
|
3221
|
+
className: "border-2 border-dashed border-border hover:border-accent w-full h-full rounded-md transition-colors duration-200 cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-accent text-foreground-secondary hover:text-foreground",
|
|
3105
3222
|
onDragOver: (e) => e.preventDefault(),
|
|
3106
3223
|
onDrop,
|
|
3107
3224
|
children: [
|
|
@@ -3119,28 +3236,28 @@ function FileInput({
|
|
|
3119
3236
|
}
|
|
3120
3237
|
),
|
|
3121
3238
|
files.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col h-full items-center justify-center gap-2", children: [
|
|
3122
|
-
/* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill:
|
|
3123
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-
|
|
3124
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3 items-center justify-center w-full h-full", children: files.map((file, id) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3239
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-16 h-16", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M11.47 2.47a.75.75 0 011.06 0l4.5 4.5a.75.75 0 01-1.06 1.06l-3.22-3.22V16.5a.75.75 0 01-1.5 0V4.81L8.03 8.03a.75.75 0 01-1.06-1.06l4.5-4.5zM3 15.75a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z", clipRule: "evenodd" }) }),
|
|
3240
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm", children: "Click or Drop a file" })
|
|
3241
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3 items-center justify-center w-full h-full p-3", children: files.map((file, id) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3125
3242
|
"div",
|
|
3126
3243
|
{
|
|
3127
|
-
className: "text-xs flex flex-col items-center w-20 h-24 text-center bg-
|
|
3244
|
+
className: "text-xs flex flex-col items-center w-20 h-24 text-center bg-surface-raised text-foreground p-4 rounded-md relative",
|
|
3128
3245
|
children: [
|
|
3129
3246
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3130
3247
|
"button",
|
|
3131
3248
|
{
|
|
3132
3249
|
type: "button",
|
|
3133
3250
|
onClick: removeFile,
|
|
3134
|
-
className: "bg-error rounded-full w-4 h-4 absolute right-[-5px] top-[-5px] cursor-pointer flex items-center justify-center",
|
|
3251
|
+
className: "bg-status-error rounded-full w-4 h-4 absolute right-[-5px] top-[-5px] cursor-pointer flex items-center justify-center focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
|
|
3135
3252
|
"aria-label": "Remove file",
|
|
3136
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15 5L5 15M5 5l10 10", stroke: "#fff", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
3253
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15 5L5 15M5 5l10 10", stroke: "#fff", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
3137
3254
|
}
|
|
3138
3255
|
),
|
|
3139
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill:
|
|
3256
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-10 h-10", "aria-hidden": "true", children: [
|
|
3140
3257
|
/* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M5.625 1.5c-1.036 0-1.875.84-1.875 1.875v17.25c0 1.035.84 1.875 1.875 1.875h12.75c1.035 0 1.875-.84 1.875-1.875V12.75A3.75 3.75 0 0016.5 9h-1.875a1.875 1.875 0 01-1.875-1.875V5.25A3.75 3.75 0 009 1.5H5.625z", clipRule: "evenodd" }),
|
|
3141
3258
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12.971 1.816A5.23 5.23 0 0114.25 5.25v1.875c0 .207.168.375.375.375H16.5a5.23 5.23 0 013.434 1.279 9.768 9.768 0 00-6.963-6.963z" })
|
|
3142
3259
|
] }),
|
|
3143
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ellipsis whitespace-nowrap overflow-hidden w-full
|
|
3260
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ellipsis whitespace-nowrap overflow-hidden w-full", children: file.name })
|
|
3144
3261
|
]
|
|
3145
3262
|
},
|
|
3146
3263
|
`${id}${file.name}`
|