@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.js
CHANGED
|
@@ -197,10 +197,10 @@ function IconButton({
|
|
|
197
197
|
}) {
|
|
198
198
|
const colorScheme = useMemo(() => {
|
|
199
199
|
if (type === "primary") {
|
|
200
|
-
return "
|
|
200
|
+
return "bg-accent text-accent-fg hover:bg-accent-hover";
|
|
201
201
|
}
|
|
202
202
|
if (type === "bordered") {
|
|
203
|
-
return "bg-
|
|
203
|
+
return "bg-surface text-foreground hover:bg-surface-raised border border-border-strong";
|
|
204
204
|
}
|
|
205
205
|
return "";
|
|
206
206
|
}, [type]);
|
|
@@ -210,35 +210,37 @@ function IconButton({
|
|
|
210
210
|
type: buttonType,
|
|
211
211
|
disabled: disabled || loading,
|
|
212
212
|
onClick,
|
|
213
|
-
className: `${size === "sm" ? "p-1" : "p-2"} rounded-lg shadow-
|
|
213
|
+
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`,
|
|
214
214
|
children: loading ? loadingIcon : icon
|
|
215
215
|
}
|
|
216
216
|
);
|
|
217
217
|
}
|
|
218
218
|
var VARIANT_CLASSES = {
|
|
219
219
|
primary: [
|
|
220
|
-
"bg-accent text-
|
|
220
|
+
"bg-accent text-accent-fg",
|
|
221
221
|
"hover:bg-accent-hover",
|
|
222
222
|
"active:bg-accent",
|
|
223
|
-
"disabled:bg-
|
|
223
|
+
"disabled:bg-foreground-muted disabled:text-accent-fg/70 disabled:cursor-not-allowed",
|
|
224
224
|
"focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2"
|
|
225
225
|
].join(" "),
|
|
226
226
|
secondary: [
|
|
227
227
|
"bg-transparent border border-accent text-accent",
|
|
228
|
-
"hover:bg-accent hover:text-
|
|
229
|
-
"active:bg-accent-hover active:text-
|
|
230
|
-
"disabled:border-
|
|
228
|
+
"hover:bg-accent hover:text-accent-fg",
|
|
229
|
+
"active:bg-accent-hover active:text-accent-fg",
|
|
230
|
+
"disabled:border-foreground-muted disabled:text-foreground-muted disabled:cursor-not-allowed",
|
|
231
231
|
"focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2"
|
|
232
232
|
].join(" "),
|
|
233
233
|
ghost: [
|
|
234
|
+
// Semantic tokens handle both light and dark modes — no `dark:`
|
|
235
|
+
// variants needed.
|
|
234
236
|
"bg-transparent text-foreground-secondary",
|
|
235
|
-
"hover:bg-
|
|
236
|
-
"active:bg-
|
|
237
|
-
"disabled:text-
|
|
237
|
+
"hover:bg-surface-raised hover:text-foreground",
|
|
238
|
+
"active:bg-surface",
|
|
239
|
+
"disabled:text-foreground-muted disabled:cursor-not-allowed",
|
|
238
240
|
"focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2"
|
|
239
241
|
].join(" "),
|
|
240
242
|
danger: [
|
|
241
|
-
"bg-status-error text-
|
|
243
|
+
"bg-status-error text-accent-fg",
|
|
242
244
|
"hover:opacity-90",
|
|
243
245
|
"active:opacity-100",
|
|
244
246
|
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
@@ -743,12 +745,14 @@ function ToggleButton({ items, onChange, activeKey }) {
|
|
|
743
745
|
value: item.key,
|
|
744
746
|
"aria-label": typeof item.label === "string" ? item.label : item.key,
|
|
745
747
|
className: [
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
"
|
|
749
|
-
|
|
750
|
-
"
|
|
751
|
-
"
|
|
748
|
+
// Semantic tokens handle both light and dark modes via
|
|
749
|
+
// CSS vars — no `dark:` variants needed.
|
|
750
|
+
index === 0 && "rounded-l-lg border-r border-border",
|
|
751
|
+
index === items.length - 1 && "rounded-r-lg border-l border-border",
|
|
752
|
+
"p-2 cursor-pointer transition-colors duration-150 text-foreground-secondary",
|
|
753
|
+
"focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
|
|
754
|
+
"bg-surface hover:bg-surface-raised",
|
|
755
|
+
"data-[state=on]:bg-accent data-[state=on]:text-accent-fg"
|
|
752
756
|
].filter(Boolean).join(" "),
|
|
753
757
|
children: item.icon ?? item.label
|
|
754
758
|
},
|
|
@@ -940,59 +944,103 @@ function useNotification() {
|
|
|
940
944
|
danger: (props) => open({ type: "danger", ...props })
|
|
941
945
|
};
|
|
942
946
|
}
|
|
947
|
+
var SIZE_MAP = {
|
|
948
|
+
sm: { outer: "w-8 h-8", inner: "w-4 h-4", dot: "w-1 h-1", stroke: "border-2", text: "text-xs" },
|
|
949
|
+
md: { outer: "w-20 h-20", inner: "w-12 h-12", dot: "w-2 h-2", stroke: "border-[3px]", text: "text-2xl" },
|
|
950
|
+
lg: { outer: "w-32 h-32", inner: "w-20 h-20", dot: "w-3 h-3", stroke: "border-4", text: "text-4xl" }
|
|
951
|
+
};
|
|
943
952
|
var containerVariants = {
|
|
944
953
|
hidden: {},
|
|
945
|
-
visible: { transition: { staggerChildren: 0.
|
|
954
|
+
visible: { transition: { staggerChildren: 0.05 } }
|
|
946
955
|
};
|
|
947
956
|
var letterVariants = {
|
|
948
|
-
hidden: { opacity: 0, y:
|
|
949
|
-
visible: { opacity: 1, y: 0, transition: { duration: 0.
|
|
957
|
+
hidden: { opacity: 0, y: 4 },
|
|
958
|
+
visible: { opacity: 1, y: 0, transition: { duration: 0.22, ease: "easeOut" } }
|
|
950
959
|
};
|
|
960
|
+
function SpinnerCore({ size, color }) {
|
|
961
|
+
const dims = SIZE_MAP[size];
|
|
962
|
+
const ringColor = color ?? "var(--color-accent)";
|
|
963
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative flex items-center justify-center", style: { color: ringColor }, children: [
|
|
964
|
+
/* @__PURE__ */ jsx(
|
|
965
|
+
"div",
|
|
966
|
+
{
|
|
967
|
+
className: `${dims.outer} ${dims.stroke} rounded-full border-transparent border-t-current border-r-current animate-spin`,
|
|
968
|
+
style: { animationDuration: "1.4s" },
|
|
969
|
+
"aria-hidden": "true"
|
|
970
|
+
}
|
|
971
|
+
),
|
|
972
|
+
/* @__PURE__ */ jsx(
|
|
973
|
+
"div",
|
|
974
|
+
{
|
|
975
|
+
className: `absolute ${dims.inner} ${dims.stroke} rounded-full border-transparent border-b-current border-l-current animate-spin opacity-60`,
|
|
976
|
+
style: { animationDuration: "0.9s", animationDirection: "reverse" },
|
|
977
|
+
"aria-hidden": "true"
|
|
978
|
+
}
|
|
979
|
+
),
|
|
980
|
+
/* @__PURE__ */ jsx(
|
|
981
|
+
"div",
|
|
982
|
+
{
|
|
983
|
+
className: `absolute ${dims.dot} rounded-full bg-current animate-breathe`,
|
|
984
|
+
"aria-hidden": "true"
|
|
985
|
+
}
|
|
986
|
+
)
|
|
987
|
+
] });
|
|
988
|
+
}
|
|
951
989
|
function LoadingSpinner({
|
|
952
990
|
prompt,
|
|
991
|
+
size = "md",
|
|
992
|
+
inline = false,
|
|
953
993
|
spinnerColor,
|
|
954
994
|
textColor,
|
|
955
|
-
backdropOpacity = 0.
|
|
995
|
+
backdropOpacity = 0.8
|
|
956
996
|
}) {
|
|
957
997
|
const reduced = useReducedMotion();
|
|
958
|
-
const letters = Array.from(prompt);
|
|
959
|
-
|
|
998
|
+
const letters = prompt ? Array.from(prompt) : [];
|
|
999
|
+
const dims = SIZE_MAP[size];
|
|
1000
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1001
|
+
/* @__PURE__ */ jsx(SpinnerCore, { size, color: spinnerColor }),
|
|
1002
|
+
letters.length > 0 && /* @__PURE__ */ jsx(
|
|
1003
|
+
motion.div,
|
|
1004
|
+
{
|
|
1005
|
+
className: `${dims.text} font-semibold tracking-tight select-none`,
|
|
1006
|
+
style: { color: textColor ?? "var(--color-foreground)" },
|
|
1007
|
+
variants: containerVariants,
|
|
1008
|
+
initial: reduced ? "visible" : "hidden",
|
|
1009
|
+
animate: "visible",
|
|
1010
|
+
"aria-hidden": "true",
|
|
1011
|
+
children: letters.map((letter, index) => /* @__PURE__ */ jsx(
|
|
1012
|
+
motion.span,
|
|
1013
|
+
{
|
|
1014
|
+
className: "inline-block whitespace-pre",
|
|
1015
|
+
variants: letterVariants,
|
|
1016
|
+
children: letter
|
|
1017
|
+
},
|
|
1018
|
+
index
|
|
1019
|
+
))
|
|
1020
|
+
}
|
|
1021
|
+
)
|
|
1022
|
+
] });
|
|
1023
|
+
if (inline) {
|
|
1024
|
+
return /* @__PURE__ */ jsx(
|
|
1025
|
+
"div",
|
|
1026
|
+
{
|
|
1027
|
+
role: "status",
|
|
1028
|
+
"aria-live": "polite",
|
|
1029
|
+
"aria-label": prompt ?? "Loading",
|
|
1030
|
+
className: "flex flex-col items-center justify-center gap-3",
|
|
1031
|
+
children: content
|
|
1032
|
+
}
|
|
1033
|
+
);
|
|
1034
|
+
}
|
|
1035
|
+
return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(
|
|
960
1036
|
"div",
|
|
961
1037
|
{
|
|
962
1038
|
role: "status",
|
|
963
1039
|
"aria-live": "polite",
|
|
964
|
-
"aria-label": prompt,
|
|
965
|
-
className: "fixed inset-0 z-[8000000] flex flex-col items-center justify-center gap-6 bg-background",
|
|
1040
|
+
"aria-label": prompt ?? "Loading",
|
|
1041
|
+
className: "fixed inset-0 z-[8000000] flex flex-col items-center justify-center gap-6 bg-background backdrop-blur-sm",
|
|
966
1042
|
style: { opacity: backdropOpacity },
|
|
967
|
-
children:
|
|
968
|
-
/* @__PURE__ */ jsx(
|
|
969
|
-
"div",
|
|
970
|
-
{
|
|
971
|
-
className: "w-20 h-20 rounded-2xl border-[6px] border-transparent border-t-current border-r-current animate-spin",
|
|
972
|
-
style: { color: spinnerColor ?? "var(--color-accent)" },
|
|
973
|
-
"aria-hidden": "true"
|
|
974
|
-
}
|
|
975
|
-
),
|
|
976
|
-
/* @__PURE__ */ jsx(
|
|
977
|
-
motion.div,
|
|
978
|
-
{
|
|
979
|
-
className: "text-3xl font-bold tracking-tight select-none",
|
|
980
|
-
style: { color: textColor ?? "var(--color-foreground)" },
|
|
981
|
-
variants: containerVariants,
|
|
982
|
-
initial: reduced ? "visible" : "hidden",
|
|
983
|
-
animate: "visible",
|
|
984
|
-
children: letters.map((letter, index) => /* @__PURE__ */ jsx(
|
|
985
|
-
motion.span,
|
|
986
|
-
{
|
|
987
|
-
className: "inline-block whitespace-pre",
|
|
988
|
-
variants: letterVariants,
|
|
989
|
-
children: letter
|
|
990
|
-
},
|
|
991
|
-
index
|
|
992
|
-
))
|
|
993
|
-
}
|
|
994
|
-
)
|
|
995
|
-
]
|
|
1043
|
+
children: content
|
|
996
1044
|
}
|
|
997
1045
|
) });
|
|
998
1046
|
}
|
|
@@ -1018,25 +1066,43 @@ function FadingBase({
|
|
|
1018
1066
|
}
|
|
1019
1067
|
}, [isMounted]);
|
|
1020
1068
|
if (!shouldRender) return null;
|
|
1021
|
-
return
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1069
|
+
return (
|
|
1070
|
+
// `calculated-height` and `dark:glassmorphism` were orphaned CSS classes
|
|
1071
|
+
// (never defined anywhere). Replaced with semantic `min-h-full` +
|
|
1072
|
+
// `bg-surface` which works in both light and dark modes via the
|
|
1073
|
+
// ThemeProvider's CSS vars.
|
|
1074
|
+
/* @__PURE__ */ jsx(
|
|
1075
|
+
"div",
|
|
1076
|
+
{
|
|
1077
|
+
className: `w-full min-h-full pl-2 pr-2 pb-2 transition-opacity duration-300 ${visible ? "opacity-100" : "opacity-0"}`,
|
|
1078
|
+
children: /* @__PURE__ */ jsx("div", { className: `bg-surface w-full h-full rounded-lg p-2 ${className}`, children })
|
|
1079
|
+
}
|
|
1080
|
+
)
|
|
1027
1081
|
);
|
|
1028
1082
|
}
|
|
1029
1083
|
function List2({ items, onItemClick, activeKey }) {
|
|
1030
|
-
return /* @__PURE__ */ jsx("div", { role: "listbox", children: items.map((item) =>
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1084
|
+
return /* @__PURE__ */ jsx("div", { role: "listbox", children: items.map((item) => (
|
|
1085
|
+
// tabIndex + Enter/Space onKeyDown makes each option
|
|
1086
|
+
// keyboard-activatable. Previously the items were only mouse-
|
|
1087
|
+
// clickable — keyboard-only users couldn't select anything.
|
|
1088
|
+
/* @__PURE__ */ jsx(
|
|
1089
|
+
"div",
|
|
1090
|
+
{
|
|
1091
|
+
role: "option",
|
|
1092
|
+
"aria-selected": activeKey === item.key,
|
|
1093
|
+
tabIndex: 0,
|
|
1094
|
+
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"}`,
|
|
1095
|
+
onClick: () => onItemClick(item),
|
|
1096
|
+
onKeyDown: (e) => {
|
|
1097
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1098
|
+
e.preventDefault();
|
|
1099
|
+
onItemClick(item);
|
|
1100
|
+
}
|
|
1101
|
+
},
|
|
1102
|
+
children: item.label
|
|
1103
|
+
},
|
|
1104
|
+
item.key
|
|
1105
|
+
)
|
|
1040
1106
|
)) });
|
|
1041
1107
|
}
|
|
1042
1108
|
function ScalableContainer({
|
|
@@ -1066,7 +1132,7 @@ function ScalableContainer({
|
|
|
1066
1132
|
width: isScaled ? "100%" : width,
|
|
1067
1133
|
height: isScaled ? "100%" : height
|
|
1068
1134
|
},
|
|
1069
|
-
className: "rounded-lg bg-
|
|
1135
|
+
className: "rounded-lg bg-surface-raised flex flex-col transition-all duration-300 origin-center",
|
|
1070
1136
|
children: [
|
|
1071
1137
|
/* @__PURE__ */ jsx("div", { className: "p-2 w-max", children: /* @__PURE__ */ jsx(Tooltip, { placement: "right", title: isScaled ? "Collapse" : "Expand", children: /* @__PURE__ */ jsx(
|
|
1072
1138
|
IconButton,
|
|
@@ -1074,10 +1140,10 @@ function ScalableContainer({
|
|
|
1074
1140
|
onClick,
|
|
1075
1141
|
icon: isScaled ? (
|
|
1076
1142
|
/* Collapse (arrows-pointing-in) */
|
|
1077
|
-
/* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "
|
|
1143
|
+
/* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-5 h-5", children: /* @__PURE__ */ 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" }) })
|
|
1078
1144
|
) : (
|
|
1079
1145
|
/* Expand (arrows-pointing-out) */
|
|
1080
|
-
/* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "
|
|
1146
|
+
/* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-5 h-5", children: /* @__PURE__ */ 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" }) })
|
|
1081
1147
|
)
|
|
1082
1148
|
}
|
|
1083
1149
|
) }) }),
|
|
@@ -1253,7 +1319,7 @@ function MenuBarItem({ icon, isActive, title, onClick }) {
|
|
|
1253
1319
|
role: "button",
|
|
1254
1320
|
"aria-label": title,
|
|
1255
1321
|
"aria-current": isActive ? "page" : void 0,
|
|
1256
|
-
className: `transition duration-300 hover:bg-
|
|
1322
|
+
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`,
|
|
1257
1323
|
onClick,
|
|
1258
1324
|
tabIndex: 0,
|
|
1259
1325
|
onKeyDown: (e) => {
|
|
@@ -1267,22 +1333,26 @@ function MenuBarItem({ icon, isActive, title, onClick }) {
|
|
|
1267
1333
|
) });
|
|
1268
1334
|
}
|
|
1269
1335
|
function MenuBar({ items }) {
|
|
1270
|
-
return
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1336
|
+
return (
|
|
1337
|
+
// `calculated-height` was an orphaned CSS class. Replaced with `h-full`
|
|
1338
|
+
// so the MenuBar fills whatever vertical space its parent gives it.
|
|
1339
|
+
/* @__PURE__ */ jsx(
|
|
1340
|
+
"nav",
|
|
1341
|
+
{
|
|
1342
|
+
"aria-label": "Main navigation",
|
|
1343
|
+
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",
|
|
1344
|
+
children: items.map((item) => /* @__PURE__ */ jsx(
|
|
1345
|
+
MenuBarItem,
|
|
1346
|
+
{
|
|
1347
|
+
icon: item.icon,
|
|
1348
|
+
title: item.title,
|
|
1349
|
+
isActive: item.isActive,
|
|
1350
|
+
onClick: item.onClick
|
|
1351
|
+
},
|
|
1352
|
+
item.key
|
|
1353
|
+
))
|
|
1354
|
+
}
|
|
1355
|
+
)
|
|
1286
1356
|
);
|
|
1287
1357
|
}
|
|
1288
1358
|
function ContextMenu({ items, position, visible, onClose }) {
|
|
@@ -1487,8 +1557,8 @@ var SearchInput = React9.forwardRef(function SearchInput2({
|
|
|
1487
1557
|
className: `flex ${layout === "vertical" ? "flex-col" : "flex-row items-center gap-2"}`,
|
|
1488
1558
|
style: style ?? {},
|
|
1489
1559
|
children: [
|
|
1490
|
-
label && /* @__PURE__ */ jsx("label", { className: "text-
|
|
1491
|
-
/* @__PURE__ */ jsxs("div", { className: "bg-
|
|
1560
|
+
label && /* @__PURE__ */ jsx("label", { className: "text-sm font-medium ml-1 max-content text-foreground", htmlFor, children: label }),
|
|
1561
|
+
/* @__PURE__ */ 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: [
|
|
1492
1562
|
/* @__PURE__ */ jsx(
|
|
1493
1563
|
"input",
|
|
1494
1564
|
{
|
|
@@ -1500,12 +1570,12 @@ var SearchInput = React9.forwardRef(function SearchInput2({
|
|
|
1500
1570
|
enterKeyHint: "search",
|
|
1501
1571
|
name,
|
|
1502
1572
|
id: htmlFor,
|
|
1503
|
-
className: "focus:outline-none pl-2 h-9 w-56
|
|
1573
|
+
className: "bg-transparent focus:outline-none pl-2 h-9 w-56 rounded-lg disabled:cursor-not-allowed",
|
|
1504
1574
|
style: inputStyle ?? {},
|
|
1505
1575
|
placeholder: placeholder ?? ""
|
|
1506
1576
|
}
|
|
1507
1577
|
),
|
|
1508
|
-
/* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill:
|
|
1578
|
+
/* @__PURE__ */ 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__ */ 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" }) })
|
|
1509
1579
|
] })
|
|
1510
1580
|
]
|
|
1511
1581
|
}
|
|
@@ -1516,7 +1586,7 @@ function DropdownPill({ value, hasSiblings = false }) {
|
|
|
1516
1586
|
return /* @__PURE__ */ jsx(
|
|
1517
1587
|
"div",
|
|
1518
1588
|
{
|
|
1519
|
-
className: `bg-
|
|
1589
|
+
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`,
|
|
1520
1590
|
children: value
|
|
1521
1591
|
}
|
|
1522
1592
|
);
|
|
@@ -1539,9 +1609,10 @@ function Dropdown({
|
|
|
1539
1609
|
}) {
|
|
1540
1610
|
const [open, setOpen] = useState(false);
|
|
1541
1611
|
const [selectedItems, setSelectedItems] = useState([]);
|
|
1542
|
-
const [hoveredItem, setHoveredItem] = useState(null);
|
|
1543
1612
|
const [searchTerm, setSearchTerm] = useState("");
|
|
1544
1613
|
const [innerItems, setInnerItems] = useState([]);
|
|
1614
|
+
const errorId = useId();
|
|
1615
|
+
const hasError = errorMessage != null;
|
|
1545
1616
|
useEffect(() => {
|
|
1546
1617
|
setInnerItems(items);
|
|
1547
1618
|
}, [items]);
|
|
@@ -1580,7 +1651,7 @@ function Dropdown({
|
|
|
1580
1651
|
label && /* @__PURE__ */ jsx(
|
|
1581
1652
|
"label",
|
|
1582
1653
|
{
|
|
1583
|
-
className: "text-
|
|
1654
|
+
className: "text-sm font-medium ml-1 max-content select-none text-foreground",
|
|
1584
1655
|
htmlFor,
|
|
1585
1656
|
style: labelStyle,
|
|
1586
1657
|
children: label
|
|
@@ -1594,16 +1665,24 @@ function Dropdown({
|
|
|
1594
1665
|
role: "combobox",
|
|
1595
1666
|
"aria-expanded": open,
|
|
1596
1667
|
"aria-haspopup": "listbox",
|
|
1668
|
+
"aria-invalid": hasError || void 0,
|
|
1669
|
+
"aria-describedby": hasError ? errorId : void 0,
|
|
1597
1670
|
style,
|
|
1598
|
-
className: `flex items-center justify-between relative h-9 rounded-lg cursor-pointer select-none ${disabled ? "cursor-not-allowed bg-
|
|
1671
|
+
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" : ""}`,
|
|
1599
1672
|
tabIndex: disabled ? -1 : 0,
|
|
1600
|
-
onKeyDown: (e) =>
|
|
1673
|
+
onKeyDown: (e) => {
|
|
1674
|
+
if (disabled) return;
|
|
1675
|
+
if (e.key === "Enter" || e.key === " " || e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
1676
|
+
e.preventDefault();
|
|
1677
|
+
setOpen(true);
|
|
1678
|
+
}
|
|
1679
|
+
},
|
|
1601
1680
|
children: [
|
|
1602
1681
|
/* @__PURE__ */ jsx(
|
|
1603
1682
|
"div",
|
|
1604
1683
|
{
|
|
1605
|
-
className: `h-7 pl-2 ${!style?.width ? "min-w-[240px]" : ""}
|
|
1606
|
-
children: !value || Array.isArray(value) && value.length === 0 ? /* @__PURE__ */ jsx("span", { className: "text-
|
|
1684
|
+
className: `h-7 pl-2 ${!style?.width ? "min-w-[240px]" : ""} flex items-center gap-1 overflow-hidden`,
|
|
1685
|
+
children: !value || Array.isArray(value) && value.length === 0 ? /* @__PURE__ */ jsx("span", { className: "text-foreground-muted text-sm", children: placeholder }) : Array.isArray(value) ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1607
1686
|
value.slice(0, 1).map((val) => /* @__PURE__ */ jsx(
|
|
1608
1687
|
DropdownPill,
|
|
1609
1688
|
{
|
|
@@ -1616,7 +1695,7 @@ function Dropdown({
|
|
|
1616
1695
|
] }) : /* @__PURE__ */ jsx(DropdownPill, { value: innerItems.find((it) => it.key === value)?.label })
|
|
1617
1696
|
}
|
|
1618
1697
|
),
|
|
1619
|
-
/* @__PURE__ */ jsx("div", { className: `transition-transform duration-
|
|
1698
|
+
/* @__PURE__ */ jsx("div", { className: `transition-transform duration-200 mr-2 ${open ? "rotate-180" : "rotate-0"}`, "aria-hidden": "true", children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "h-4 w-4", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) }) })
|
|
1620
1699
|
]
|
|
1621
1700
|
}
|
|
1622
1701
|
) }),
|
|
@@ -1626,7 +1705,7 @@ function Dropdown({
|
|
|
1626
1705
|
align: "start",
|
|
1627
1706
|
sideOffset: 4,
|
|
1628
1707
|
style: { width: style?.width || 240 },
|
|
1629
|
-
className: "bg-
|
|
1708
|
+
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",
|
|
1630
1709
|
onInteractOutside: () => setOpen(false),
|
|
1631
1710
|
children: [
|
|
1632
1711
|
hasSearch && /* @__PURE__ */ jsx("div", { className: "mb-2", children: /* @__PURE__ */ jsx(
|
|
@@ -1639,34 +1718,50 @@ function Dropdown({
|
|
|
1639
1718
|
placeholder: "Search..."
|
|
1640
1719
|
}
|
|
1641
1720
|
) }),
|
|
1642
|
-
/* @__PURE__ */ jsx("div", { role: "listbox", "aria-multiselectable": isMultiselect, className: "max-h-40 overflow-y-auto", children: innerItems.map((item
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
{
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
strokeWidth: "2",
|
|
1663
|
-
strokeLinecap: "round",
|
|
1664
|
-
strokeLinejoin: "round"
|
|
1721
|
+
/* @__PURE__ */ jsx("div", { role: "listbox", "aria-multiselectable": isMultiselect, className: "max-h-40 overflow-y-auto", children: innerItems.map((item) => (
|
|
1722
|
+
// aria-rowindex was previously set here but
|
|
1723
|
+
// it's invalid ARIA on role="option" (it
|
|
1724
|
+
// belongs on rows of a grid/treegrid). Dropped.
|
|
1725
|
+
// tabIndex={0} + Enter/Space handler makes the
|
|
1726
|
+
// option keyboard-activatable; the full
|
|
1727
|
+
// combobox roving-tabindex pattern is deferred
|
|
1728
|
+
// until the planned Phase-5 rewrite.
|
|
1729
|
+
/* @__PURE__ */ jsxs(
|
|
1730
|
+
"div",
|
|
1731
|
+
{
|
|
1732
|
+
role: "option",
|
|
1733
|
+
"aria-selected": isSelected(item.key),
|
|
1734
|
+
tabIndex: 0,
|
|
1735
|
+
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"}`,
|
|
1736
|
+
onClick: () => selectItem(item.key),
|
|
1737
|
+
onKeyDown: (e) => {
|
|
1738
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1739
|
+
e.preventDefault();
|
|
1740
|
+
selectItem(item.key);
|
|
1665
1741
|
}
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1742
|
+
},
|
|
1743
|
+
children: [
|
|
1744
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
1745
|
+
item.icon && /* @__PURE__ */ jsx("div", { children: item.icon }),
|
|
1746
|
+
item.label
|
|
1747
|
+
] }),
|
|
1748
|
+
isSelected(item.key) && // currentColor — checkmark follows
|
|
1749
|
+
// the item's text colour, which
|
|
1750
|
+
// flips automatically on hover.
|
|
1751
|
+
/* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
1752
|
+
"path",
|
|
1753
|
+
{
|
|
1754
|
+
d: "M4 10l4.5 4.5L16 6",
|
|
1755
|
+
stroke: "currentColor",
|
|
1756
|
+
strokeWidth: "2",
|
|
1757
|
+
strokeLinecap: "round",
|
|
1758
|
+
strokeLinejoin: "round"
|
|
1759
|
+
}
|
|
1760
|
+
) })
|
|
1761
|
+
]
|
|
1762
|
+
},
|
|
1763
|
+
item.key
|
|
1764
|
+
)
|
|
1670
1765
|
)) })
|
|
1671
1766
|
]
|
|
1672
1767
|
}
|
|
@@ -1675,7 +1770,7 @@ function Dropdown({
|
|
|
1675
1770
|
]
|
|
1676
1771
|
}
|
|
1677
1772
|
),
|
|
1678
|
-
/* @__PURE__ */ jsx("div", { className: "text-center text-error
|
|
1773
|
+
hasError && /* @__PURE__ */ jsx("div", { id: errorId, className: "text-center text-status-error text-xs mt-1", children: errorMessage })
|
|
1679
1774
|
] });
|
|
1680
1775
|
}
|
|
1681
1776
|
var DEFAULT_PICKER = [
|
|
@@ -1845,10 +1940,11 @@ function Pagination({
|
|
|
1845
1940
|
isMultiselect: false,
|
|
1846
1941
|
value: displayPerPageKey,
|
|
1847
1942
|
onChange: ({ target: { value } }) => {
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1943
|
+
if (Array.isArray(value)) return;
|
|
1944
|
+
const numKey = typeof value === "number" ? value : Number(value);
|
|
1945
|
+
if (!serverSide) setPerPageKey(numKey);
|
|
1946
|
+
const opt = picker.find((o) => o.key === numKey);
|
|
1947
|
+
onPerPageChange(opt?.label ?? opt?.value ?? numKey);
|
|
1852
1948
|
}
|
|
1853
1949
|
}
|
|
1854
1950
|
)
|
|
@@ -2501,6 +2597,8 @@ function TextInput({
|
|
|
2501
2597
|
errorMessage,
|
|
2502
2598
|
labelColor
|
|
2503
2599
|
}) {
|
|
2600
|
+
const errorId = useId();
|
|
2601
|
+
const hasError = errorMessage != null;
|
|
2504
2602
|
return /* @__PURE__ */ jsxs("div", { className: "relative flex flex-col items-center justify-center", children: [
|
|
2505
2603
|
/* @__PURE__ */ jsxs(
|
|
2506
2604
|
"div",
|
|
@@ -2515,7 +2613,7 @@ function TextInput({
|
|
|
2515
2613
|
"label",
|
|
2516
2614
|
{
|
|
2517
2615
|
style: { color: labelColor || void 0 },
|
|
2518
|
-
className: `text-
|
|
2616
|
+
className: `text-sm font-medium ml-1 max-content ${!labelColor && "text-foreground"}`,
|
|
2519
2617
|
htmlFor,
|
|
2520
2618
|
children: label
|
|
2521
2619
|
}
|
|
@@ -2531,7 +2629,9 @@ function TextInput({
|
|
|
2531
2629
|
type: "text",
|
|
2532
2630
|
name,
|
|
2533
2631
|
id: htmlFor,
|
|
2534
|
-
|
|
2632
|
+
"aria-invalid": hasError || void 0,
|
|
2633
|
+
"aria-describedby": hasError ? errorId : void 0,
|
|
2634
|
+
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`,
|
|
2535
2635
|
style: inputStyle ?? {},
|
|
2536
2636
|
placeholder: placeholder ?? ""
|
|
2537
2637
|
}
|
|
@@ -2539,7 +2639,7 @@ function TextInput({
|
|
|
2539
2639
|
]
|
|
2540
2640
|
}
|
|
2541
2641
|
),
|
|
2542
|
-
/* @__PURE__ */ jsx("div", { className: "text-center text-error
|
|
2642
|
+
hasError && /* @__PURE__ */ jsx("div", { id: errorId, className: "text-center text-status-error text-xs mt-1", children: errorMessage })
|
|
2543
2643
|
] });
|
|
2544
2644
|
}
|
|
2545
2645
|
function NumberInput({
|
|
@@ -2654,17 +2754,15 @@ function Password({
|
|
|
2654
2754
|
iconColor
|
|
2655
2755
|
}) {
|
|
2656
2756
|
const [passwordVisible, setPasswordVisible] = useState(false);
|
|
2657
|
-
const
|
|
2757
|
+
const errorId = useId();
|
|
2758
|
+
const hasError = errorMessage != null;
|
|
2658
2759
|
return /* @__PURE__ */ jsxs("div", { className: "relative flex flex-col items-center justify-center", style: style ?? {}, children: [
|
|
2659
2760
|
/* @__PURE__ */ jsxs("div", { className: `flex ${layout === "vertical" ? "flex-col" : "flex-row items-center gap-2"}`, children: [
|
|
2660
|
-
label &&
|
|
2661
|
-
// <label htmlFor=…> announces as an unlabeled control in
|
|
2662
|
-
// some screen readers.
|
|
2663
|
-
/* @__PURE__ */ jsx(
|
|
2761
|
+
label && /* @__PURE__ */ jsx(
|
|
2664
2762
|
"label",
|
|
2665
2763
|
{
|
|
2666
2764
|
style: { color: labelColor || void 0 },
|
|
2667
|
-
className: `text-
|
|
2765
|
+
className: `text-sm font-medium ml-1 max-content ${!labelColor && "text-foreground"}`,
|
|
2668
2766
|
htmlFor,
|
|
2669
2767
|
children: label
|
|
2670
2768
|
}
|
|
@@ -2681,7 +2779,9 @@ function Password({
|
|
|
2681
2779
|
type: passwordVisible ? "text" : "password",
|
|
2682
2780
|
name,
|
|
2683
2781
|
id: htmlFor,
|
|
2684
|
-
|
|
2782
|
+
"aria-invalid": hasError || void 0,
|
|
2783
|
+
"aria-describedby": hasError ? errorId : void 0,
|
|
2784
|
+
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`,
|
|
2685
2785
|
style: inputStyle ?? {},
|
|
2686
2786
|
placeholder: placeholder ?? ""
|
|
2687
2787
|
}
|
|
@@ -2690,19 +2790,20 @@ function Password({
|
|
|
2690
2790
|
"button",
|
|
2691
2791
|
{
|
|
2692
2792
|
type: "button",
|
|
2693
|
-
className: "cursor-pointer p-1",
|
|
2793
|
+
className: "cursor-pointer p-1 text-foreground-secondary hover:text-foreground rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
|
|
2794
|
+
style: iconColor ? { color: iconColor } : void 0,
|
|
2694
2795
|
onClick: () => setPasswordVisible(!passwordVisible),
|
|
2695
2796
|
"aria-label": passwordVisible ? "Hide password" : "Show password",
|
|
2696
2797
|
children: passwordVisible ? (
|
|
2697
2798
|
/* EyeSlash */
|
|
2698
|
-
/* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill:
|
|
2799
|
+
/* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-6 h-6", children: [
|
|
2699
2800
|
/* @__PURE__ */ 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" }),
|
|
2700
2801
|
/* @__PURE__ */ 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" }),
|
|
2701
2802
|
/* @__PURE__ */ 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" })
|
|
2702
2803
|
] })
|
|
2703
2804
|
) : (
|
|
2704
2805
|
/* Eye */
|
|
2705
|
-
/* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill:
|
|
2806
|
+
/* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-6 h-6", children: [
|
|
2706
2807
|
/* @__PURE__ */ jsx("path", { d: "M12 15a3 3 0 100-6 3 3 0 000 6z" }),
|
|
2707
2808
|
/* @__PURE__ */ 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" })
|
|
2708
2809
|
] })
|
|
@@ -2711,7 +2812,7 @@ function Password({
|
|
|
2711
2812
|
)
|
|
2712
2813
|
] })
|
|
2713
2814
|
] }),
|
|
2714
|
-
/* @__PURE__ */ jsx("div", { className: "text-center text-error
|
|
2815
|
+
hasError && /* @__PURE__ */ jsx("div", { id: errorId, className: "text-center text-status-error text-xs mt-1", children: errorMessage })
|
|
2715
2816
|
] });
|
|
2716
2817
|
}
|
|
2717
2818
|
function Checkbox({
|
|
@@ -2800,22 +2901,25 @@ function Switch({
|
|
|
2800
2901
|
uncheckedIcon
|
|
2801
2902
|
}) {
|
|
2802
2903
|
const id = useId();
|
|
2803
|
-
return /* @__PURE__ */
|
|
2804
|
-
|
|
2805
|
-
{
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2904
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
2905
|
+
"// mr-12 was a hardcoded right margin that broke layouts; spacing // is the parent's responsibility now.",
|
|
2906
|
+
/* @__PURE__ */ jsx("label", { htmlFor: id, className: "flex items-center cursor-pointer select-none", children: /* @__PURE__ */ jsx(
|
|
2907
|
+
SwitchPrimitive.Root,
|
|
2908
|
+
{
|
|
2909
|
+
id,
|
|
2910
|
+
checked,
|
|
2911
|
+
onCheckedChange: (c) => onChange?.({ target: { checked: c } }),
|
|
2912
|
+
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",
|
|
2913
|
+
children: /* @__PURE__ */ jsx(
|
|
2914
|
+
SwitchPrimitive.Thumb,
|
|
2915
|
+
{
|
|
2916
|
+
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]",
|
|
2917
|
+
children: checkedIcon && uncheckedIcon ? checked ? checkedIcon : uncheckedIcon : null
|
|
2918
|
+
}
|
|
2919
|
+
)
|
|
2920
|
+
}
|
|
2921
|
+
) })
|
|
2922
|
+
] });
|
|
2819
2923
|
}
|
|
2820
2924
|
function AutoComplete({
|
|
2821
2925
|
disabled,
|
|
@@ -2845,9 +2949,9 @@ function AutoComplete({
|
|
|
2845
2949
|
className: `flex ${layout === "vertical" ? "flex-col" : "flex-row items-center gap-2"}`,
|
|
2846
2950
|
style: style ?? {},
|
|
2847
2951
|
children: [
|
|
2848
|
-
label && /* @__PURE__ */ jsx("label", { className: "text-
|
|
2952
|
+
label && /* @__PURE__ */ jsx("label", { className: "text-sm font-medium ml-1 max-content text-foreground", children: label }),
|
|
2849
2953
|
/* @__PURE__ */ jsxs(Popover.Root, { open: open && !disabled, onOpenChange: (o) => !disabled && setOpen(o), children: [
|
|
2850
|
-
/* @__PURE__ */ jsx(Popover.Anchor, { asChild: true, children: /* @__PURE__ */ jsxs("div", { className: "bg-
|
|
2954
|
+
/* @__PURE__ */ jsx(Popover.Anchor, { asChild: true, children: /* @__PURE__ */ 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: [
|
|
2851
2955
|
/* @__PURE__ */ jsx(
|
|
2852
2956
|
"input",
|
|
2853
2957
|
{
|
|
@@ -2860,7 +2964,7 @@ function AutoComplete({
|
|
|
2860
2964
|
onFocus: () => setOpen(true),
|
|
2861
2965
|
type: "text",
|
|
2862
2966
|
name,
|
|
2863
|
-
className: "focus:outline-none pl-2 h-9 w-56
|
|
2967
|
+
className: "bg-transparent focus:outline-none pl-2 h-9 w-56 rounded-lg disabled:cursor-not-allowed",
|
|
2864
2968
|
style: inputStyle ?? {},
|
|
2865
2969
|
placeholder: placeholder ?? "",
|
|
2866
2970
|
autoComplete: "off",
|
|
@@ -2869,7 +2973,7 @@ function AutoComplete({
|
|
|
2869
2973
|
"aria-autocomplete": "list"
|
|
2870
2974
|
}
|
|
2871
2975
|
),
|
|
2872
|
-
/* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill:
|
|
2976
|
+
/* @__PURE__ */ 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__ */ 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" }) })
|
|
2873
2977
|
] }) }),
|
|
2874
2978
|
/* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(
|
|
2875
2979
|
Popover.Content,
|
|
@@ -2877,24 +2981,37 @@ function AutoComplete({
|
|
|
2877
2981
|
align: "start",
|
|
2878
2982
|
sideOffset: 4,
|
|
2879
2983
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
2880
|
-
className: "w-64 bg-
|
|
2881
|
-
children: foundItems.length === 0 ? /* @__PURE__ */ jsx("div", { className: "h-full w-full flex flex-col items-center justify-center py-4 text-sm text-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2984
|
+
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",
|
|
2985
|
+
children: foundItems.length === 0 ? /* @__PURE__ */ jsx("div", { className: "h-full w-full flex flex-col items-center justify-center py-4 text-sm text-foreground-secondary", children: emptyText }) : /* @__PURE__ */ jsx("div", { role: "listbox", children: foundItems.map((item) => (
|
|
2986
|
+
// tabIndex + Enter/Space onKeyDown
|
|
2987
|
+
// makes each option keyboard-activatable.
|
|
2988
|
+
// Full roving-tabindex / arrow-key nav
|
|
2989
|
+
// is deferred to the Phase-5 rewrite.
|
|
2990
|
+
/* @__PURE__ */ jsxs(
|
|
2991
|
+
"div",
|
|
2992
|
+
{
|
|
2993
|
+
role: "option",
|
|
2994
|
+
tabIndex: 0,
|
|
2995
|
+
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",
|
|
2996
|
+
onClick: () => handleSelect(item),
|
|
2997
|
+
onKeyDown: (e) => {
|
|
2998
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
2999
|
+
e.preventDefault();
|
|
3000
|
+
handleSelect(item);
|
|
3001
|
+
}
|
|
3002
|
+
},
|
|
3003
|
+
children: [
|
|
3004
|
+
item.icon,
|
|
3005
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
3006
|
+
item.label,
|
|
3007
|
+
" (",
|
|
3008
|
+
item.value,
|
|
3009
|
+
")"
|
|
3010
|
+
] })
|
|
3011
|
+
]
|
|
3012
|
+
},
|
|
3013
|
+
item.key
|
|
3014
|
+
)
|
|
2898
3015
|
)) })
|
|
2899
3016
|
}
|
|
2900
3017
|
) })
|
|
@@ -3069,7 +3186,7 @@ function FileInput({
|
|
|
3069
3186
|
openPicker();
|
|
3070
3187
|
}
|
|
3071
3188
|
},
|
|
3072
|
-
className: "border-2
|
|
3189
|
+
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",
|
|
3073
3190
|
onDragOver: (e) => e.preventDefault(),
|
|
3074
3191
|
onDrop,
|
|
3075
3192
|
children: [
|
|
@@ -3087,28 +3204,28 @@ function FileInput({
|
|
|
3087
3204
|
}
|
|
3088
3205
|
),
|
|
3089
3206
|
files.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full items-center justify-center gap-2", children: [
|
|
3090
|
-
/* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill:
|
|
3091
|
-
/* @__PURE__ */ jsx("div", { className: "text-
|
|
3092
|
-
] }) : /* @__PURE__ */ jsx("div", { className: "flex gap-3 items-center justify-center w-full h-full", children: files.map((file, id) => /* @__PURE__ */ jsxs(
|
|
3207
|
+
/* @__PURE__ */ 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__ */ 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" }) }),
|
|
3208
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm", children: "Click or Drop a file" })
|
|
3209
|
+
] }) : /* @__PURE__ */ jsx("div", { className: "flex gap-3 items-center justify-center w-full h-full p-3", children: files.map((file, id) => /* @__PURE__ */ jsxs(
|
|
3093
3210
|
"div",
|
|
3094
3211
|
{
|
|
3095
|
-
className: "text-xs flex flex-col items-center w-20 h-24 text-center bg-
|
|
3212
|
+
className: "text-xs flex flex-col items-center w-20 h-24 text-center bg-surface-raised text-foreground p-4 rounded-md relative",
|
|
3096
3213
|
children: [
|
|
3097
3214
|
/* @__PURE__ */ jsx(
|
|
3098
3215
|
"button",
|
|
3099
3216
|
{
|
|
3100
3217
|
type: "button",
|
|
3101
3218
|
onClick: removeFile,
|
|
3102
|
-
className: "bg-error rounded-full w-4 h-4 absolute right-[-5px] top-[-5px] cursor-pointer flex items-center justify-center",
|
|
3219
|
+
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",
|
|
3103
3220
|
"aria-label": "Remove file",
|
|
3104
|
-
children: /* @__PURE__ */ jsx("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M15 5L5 15M5 5l10 10", stroke: "#fff", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
3221
|
+
children: /* @__PURE__ */ jsx("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M15 5L5 15M5 5l10 10", stroke: "#fff", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
3105
3222
|
}
|
|
3106
3223
|
),
|
|
3107
|
-
/* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill:
|
|
3224
|
+
/* @__PURE__ */ 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: [
|
|
3108
3225
|
/* @__PURE__ */ 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" }),
|
|
3109
3226
|
/* @__PURE__ */ 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" })
|
|
3110
3227
|
] }),
|
|
3111
|
-
/* @__PURE__ */ jsx("span", { className: "text-ellipsis whitespace-nowrap overflow-hidden w-full
|
|
3228
|
+
/* @__PURE__ */ jsx("span", { className: "text-ellipsis whitespace-nowrap overflow-hidden w-full", children: file.name })
|
|
3112
3229
|
]
|
|
3113
3230
|
},
|
|
3114
3231
|
`${id}${file.name}`
|