@geomak/ui 1.7.0 → 1.7.2

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.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { colors_default } from './chunk-GKXP6OJJ.js';
2
2
  export { colors_default as COLORS, PALETTE as palette, semanticTokens, vars } from './chunk-GKXP6OJJ.js';
3
- import React10, { createContext, useState, useEffect, useMemo, useContext, useRef, useCallback, useId } from 'react';
4
- import { createPortal } from 'react-dom';
5
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
+ import React9, { createContext, useState, useEffect, useMemo, useContext, useRef, useCallback, useId } from 'react';
5
+ import { createPortal } from 'react-dom';
6
6
  import * as Dialog from '@radix-ui/react-dialog';
7
7
  import { useReducedMotion, AnimatePresence, motion } from 'framer-motion';
8
8
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
@@ -14,18 +14,6 @@ import * as Popover from '@radix-ui/react-popover';
14
14
  import * as SwitchPrimitive from '@radix-ui/react-switch';
15
15
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
16
16
 
17
- function Portal({ children, target }) {
18
- const [resolved, setResolved] = useState(null);
19
- useEffect(() => {
20
- if (target === null) {
21
- setResolved(null);
22
- return;
23
- }
24
- const node = typeof target === "function" ? target() : target ?? document.body;
25
- setResolved(node ?? null);
26
- }, [target]);
27
- return resolved ? createPortal(children, resolved) : null;
28
- }
29
17
  var Moon = ({ color = "gray" }) => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: color, viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: color, className: "w-8 h-8", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M21.752 15.002A9.718 9.718 0 0118 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 003 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 009.002-5.998z" }) });
30
18
  var Sun = ({ color = "yellow" }) => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: color, viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: color, className: "w-8 h-8", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 3v2.25m6.364.386l-1.591 1.591M21 12h-2.25m-.386 6.364l-1.591-1.591M12 18.75V21m-4.773-4.227l-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z" }) });
31
19
  var CheckCircle = ({ color = "#fff", size = 28 }) => /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 28 28", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M14 0.25C6.40625 0.25 0.25 6.40625 0.25 14C0.25 21.5937 6.40625 27.75 14 27.75C21.5937 27.75 27.75 21.5937 27.75 14C27.75 6.40625 21.5937 0.25 14 0.25ZM19.96 11.675C20.0697 11.5496 20.1533 11.4034 20.2057 11.2452C20.2582 11.087 20.2784 10.9199 20.2653 10.7537C20.2522 10.5876 20.206 10.4257 20.1295 10.2777C20.0529 10.1296 19.9475 9.99838 19.8194 9.89168C19.6914 9.78497 19.5433 9.70495 19.3839 9.65633C19.2244 9.6077 19.0569 9.59145 18.8911 9.60853C18.7253 9.62562 18.5646 9.67568 18.4184 9.75579C18.2723 9.8359 18.1436 9.94443 18.04 10.075L12.665 16.5237L9.88375 13.7412C9.648 13.5136 9.33224 13.3876 9.0045 13.3904C8.67675 13.3933 8.36324 13.5247 8.13148 13.7565C7.89972 13.9882 7.76825 14.3018 7.76541 14.6295C7.76256 14.9572 7.88855 15.273 8.11625 15.5087L11.8662 19.2587C11.9891 19.3815 12.1361 19.4773 12.298 19.5401C12.4599 19.6028 12.6331 19.6312 12.8066 19.6233C12.98 19.6154 13.15 19.5715 13.3055 19.4943C13.4611 19.4171 13.5988 19.3084 13.71 19.175L19.96 11.675Z", fill: color }) });
@@ -185,6 +173,18 @@ Icon.Save = Save;
185
173
  Icon.Copy = Copy;
186
174
  Icon.CircleStack = CircleStack;
187
175
  var icons_default = Icon;
176
+ function Portal({ children, target }) {
177
+ const [resolved, setResolved] = useState(null);
178
+ useEffect(() => {
179
+ if (target === null) {
180
+ setResolved(null);
181
+ return;
182
+ }
183
+ const node = typeof target === "function" ? target() : target ?? document.body;
184
+ setResolved(node ?? null);
185
+ }, [target]);
186
+ return resolved ? createPortal(children, resolved) : null;
187
+ }
188
188
  function IconButton({
189
189
  icon,
190
190
  onClick,
@@ -300,7 +300,8 @@ function Button({
300
300
  );
301
301
  }
302
302
  function Modal({
303
- size = [600, 400],
303
+ width,
304
+ size,
304
305
  isOpen = false,
305
306
  onClose,
306
307
  onOk,
@@ -312,6 +313,7 @@ function Modal({
312
313
  children
313
314
  }) {
314
315
  const reduced = useReducedMotion();
316
+ const maxWidth = width ?? size?.[0] ?? 600;
315
317
  return /* @__PURE__ */ jsx(Dialog.Root, { open: isOpen, onOpenChange: (open) => {
316
318
  if (!open) onClose?.();
317
319
  }, children: /* @__PURE__ */ jsxs(Dialog.Portal, { forceMount: true, children: [
@@ -330,7 +332,7 @@ function Modal({
330
332
  {
331
333
  className: "fixed left-1/2 top-1/2 z-modal flex flex-col w-[calc(100%-2rem)] max-h-[90dvh] bg-surface rounded-2xl shadow-xl overflow-hidden focus:outline-none",
332
334
  style: {
333
- maxWidth: size[0],
335
+ maxWidth,
334
336
  x: "-50%",
335
337
  y: "-50%"
336
338
  },
@@ -355,7 +357,7 @@ function Modal({
355
357
  }
356
358
  ) })
357
359
  ] }),
358
- /* @__PURE__ */ jsx("div", { className: `flex-1 overflow-y-auto p-5 ${hasFooter ? "" : "pb-5"}`, children: isOpen && children }),
360
+ /* @__PURE__ */ jsx("div", { className: `flex-1 overflow-y-auto p-5 ${hasFooter ? "" : "pb-5"}`, children }),
359
361
  hasFooter && /* @__PURE__ */ jsxs("div", { className: "flex flex-shrink-0 items-center justify-end gap-3 border-t border-border px-5 py-3", children: [
360
362
  /* @__PURE__ */ jsx(
361
363
  Button,
@@ -437,7 +439,7 @@ function Drawer({
437
439
  }
438
440
  ) })
439
441
  ] }),
440
- /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-5", children: isOpen && children }),
442
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-5", children }),
441
443
  hasFooter && /* @__PURE__ */ jsxs("div", { className: `flex flex-shrink-0 items-center gap-3 border-t border-border px-5 py-3 ${isRight ? "justify-start" : "justify-end"}`, children: [
442
444
  /* @__PURE__ */ jsx(Button, { style: { width: 90 }, content: cancelText, onClick: onCancel }),
443
445
  /* @__PURE__ */ jsx(Button, { style: { width: 90 }, content: okText, onClick: onOk })
@@ -556,29 +558,46 @@ function Tabs({
556
558
  {
557
559
  "aria-label": "Tabs",
558
560
  className: "flex-1 flex items-center gap-1 overflow-x-auto overflow-y-hidden rounded-lg scroll-smooth snap-x snap-mandatory hidden-scrollbar",
559
- children: tabs.map((tab) => /* @__PURE__ */ jsxs(
560
- TabsPrimitive.Trigger,
561
- {
562
- value: tab.key,
563
- className: "snap-start snap-always flex items-center justify-between gap-2 px-3 py-2 rounded-3xl cursor-pointer transition-all duration-200 select-none h-10 flex-1 min-w-[120px] max-w-[220px] flex-shrink-0\n text-foreground-secondary bg-surface-raised\n hover:bg-surface hover:text-foreground\n data-[state=active]:bg-accent data-[state=active]:text-accent-foreground\n focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
564
- children: [
565
- /* @__PURE__ */ jsx("span", { className: "truncate text-sm", children: tab.title }),
566
- tabsClosable && /* @__PURE__ */ jsx(
567
- "span",
568
- {
569
- role: "button",
570
- "aria-label": `Close ${tab.title}`,
571
- onClick: (e) => {
572
- e.stopPropagation();
573
- onTabClose?.(tab.key);
574
- },
575
- className: "flex-shrink-0 rounded hover:bg-black/10 p-0.5 transition-colors",
576
- children: /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M15 5L5 15M5 5l10 10", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
577
- }
578
- )
579
- ]
580
- },
581
- tab.key
561
+ children: tabs.map((tab) => (
562
+ // Trigger + close button are SIBLINGS, not nested.
563
+ // Nesting a clickable element inside <button> is invalid
564
+ // HTML and breaks keyboard activation of the inner one.
565
+ // The wrapper carries `group` so the close button can
566
+ // react to the trigger's `data-state=active` for styling.
567
+ /* @__PURE__ */ jsxs(
568
+ "div",
569
+ {
570
+ className: "snap-start snap-always relative flex items-center flex-1 min-w-[120px] max-w-[220px] flex-shrink-0 group",
571
+ children: [
572
+ /* @__PURE__ */ jsx(
573
+ TabsPrimitive.Trigger,
574
+ {
575
+ value: tab.key,
576
+ className: `w-full ${tabsClosable ? "pr-8" : "pr-3"} pl-3 py-2 rounded-3xl cursor-pointer transition-all duration-200 select-none h-10 text-left
577
+ text-foreground-secondary bg-surface-raised
578
+ hover:bg-surface hover:text-foreground
579
+ data-[state=active]:bg-accent data-[state=active]:text-accent-foreground
580
+ focus:outline-none focus-visible:ring-2 focus-visible:ring-accent`,
581
+ children: /* @__PURE__ */ jsx("span", { className: "truncate text-sm block", children: tab.title })
582
+ }
583
+ ),
584
+ tabsClosable && /* @__PURE__ */ jsx(
585
+ "button",
586
+ {
587
+ type: "button",
588
+ "aria-label": `Close ${tab.title}`,
589
+ onClick: (e) => {
590
+ e.stopPropagation();
591
+ onTabClose?.(tab.key);
592
+ },
593
+ className: "absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-0.5 text-foreground-secondary group-data-[state=active]:text-accent-foreground hover:bg-black/10 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
594
+ children: /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M15 5L5 15M5 5l10 10", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
595
+ }
596
+ )
597
+ ]
598
+ },
599
+ tab.key
600
+ )
582
601
  ))
583
602
  }
584
603
  ),
@@ -641,40 +660,41 @@ function TreeNodeItem({
641
660
  defaultValue: initialOpen,
642
661
  style: { paddingLeft: depth * 12 },
643
662
  children: /* @__PURE__ */ jsxs(Accordion.Item, { value: item.key, className: "border-none", children: [
644
- /* @__PURE__ */ jsxs(Accordion.Trigger, { className: "flex items-center gap-2 cursor-pointer py-1.5 px-2 group focus:outline-none focus-visible:ring-2 focus-visible:ring-accent w-full text-left rounded-md hover:bg-surface-raised transition-colors duration-150", children: [
645
- /* @__PURE__ */ jsx(
646
- "svg",
647
- {
648
- viewBox: "0 0 24 24",
649
- fill: "none",
650
- stroke: "currentColor",
651
- strokeWidth: 2.5,
652
- className: "h-3.5 w-3.5 flex-shrink-0 text-foreground-muted transition-transform duration-200 group-data-[state=open]:rotate-0 group-data-[state=closed]:-rotate-90",
653
- children: /* @__PURE__ */ jsx(
654
- "path",
663
+ /* @__PURE__ */ jsxs(
664
+ Accordion.Trigger,
665
+ {
666
+ onClick: () => onNodeClick({
667
+ isParent: true,
668
+ key: item.key,
669
+ label: item.label,
670
+ data: item.nodeData,
671
+ parentLabel: item.parentLabel
672
+ }),
673
+ className: "flex items-center gap-2 cursor-pointer py-1.5 px-2 group focus:outline-none focus-visible:ring-2 focus-visible:ring-accent w-full text-left rounded-md hover:bg-surface-raised transition-colors duration-150",
674
+ children: [
675
+ /* @__PURE__ */ jsx(
676
+ "svg",
655
677
  {
656
- strokeLinecap: "round",
657
- strokeLinejoin: "round",
658
- d: "M19 9l-7 7-7-7"
678
+ viewBox: "0 0 24 24",
679
+ fill: "none",
680
+ stroke: "currentColor",
681
+ strokeWidth: 2.5,
682
+ className: "h-3.5 w-3.5 flex-shrink-0 text-foreground-muted transition-transform duration-200 group-data-[state=open]:rotate-0 group-data-[state=closed]:-rotate-90",
683
+ "aria-hidden": "true",
684
+ children: /* @__PURE__ */ jsx(
685
+ "path",
686
+ {
687
+ strokeLinecap: "round",
688
+ strokeLinejoin: "round",
689
+ d: "M19 9l-7 7-7-7"
690
+ }
691
+ )
659
692
  }
660
- )
661
- }
662
- ),
663
- /* @__PURE__ */ jsx(
664
- "span",
665
- {
666
- className: "text-sm font-semibold text-foreground select-none",
667
- onClick: () => onNodeClick({
668
- isParent: true,
669
- key: item.key,
670
- label: item.label,
671
- data: item.nodeData,
672
- parentLabel: item.parentLabel
673
- }),
674
- children: item.label
675
- }
676
- )
677
- ] }),
693
+ ),
694
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold text-foreground select-none", children: item.label })
695
+ ]
696
+ }
697
+ ),
678
698
  /* @__PURE__ */ jsx(Accordion.Content, { className: "overflow-hidden data-[state=open]:animate-accordion-down data-[state=closed]:animate-accordion-up", children: /* @__PURE__ */ jsx("div", { className: "ml-3.5 border-l border-border py-0.5", children: item.children.map((child) => /* @__PURE__ */ jsx(
679
699
  TreeNodeItem,
680
700
  {
@@ -920,39 +940,61 @@ function useNotification() {
920
940
  danger: (props) => open({ type: "danger", ...props })
921
941
  };
922
942
  }
923
- function LoadingSpinner({ prompt }) {
924
- const letterRefs = useMemo(() => [], []);
925
- const letters = prompt.split("");
926
- useEffect(() => {
927
- const timeouts = [];
928
- if (letterRefs.length === letters.length) {
929
- letterRefs.forEach((ref, index) => {
930
- const t = setTimeout(() => {
931
- ref?.classList.add("slowly-appear");
932
- }, index * 100);
933
- timeouts.push(t);
934
- });
943
+ var containerVariants = {
944
+ hidden: {},
945
+ visible: { transition: { staggerChildren: 0.06 } }
946
+ };
947
+ var letterVariants = {
948
+ hidden: { opacity: 0, y: 6 },
949
+ visible: { opacity: 1, y: 0, transition: { duration: 0.25, ease: "easeOut" } }
950
+ };
951
+ function LoadingSpinner({
952
+ prompt,
953
+ spinnerColor,
954
+ textColor,
955
+ backdropOpacity = 0.92
956
+ }) {
957
+ const reduced = useReducedMotion();
958
+ const letters = Array.from(prompt);
959
+ return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsxs(
960
+ "div",
961
+ {
962
+ role: "status",
963
+ "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",
966
+ 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
+ ]
935
996
  }
936
- return () => timeouts.forEach(clearTimeout);
937
- }, [letterRefs, letters.length]);
938
- return (
939
- // Portaled so the full-screen overlay always covers the real viewport,
940
- // not whatever container the consumer renders LoadingSpinner inside.
941
- /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsxs("div", { className: "fixed top-0 bottom-0 right-0 left-0 bg-oxford-blue-700-opaque z-[8000000] flex flex-col gap-5 items-center justify-start pt-80", children: [
942
- /* @__PURE__ */ jsx("div", { className: "border-r-prussian-blue border-l-prussian-blue border-t-white border-b-white border-[10px] w-[80px] h-[80px] rounded-xl shapeshift" }),
943
- /* @__PURE__ */ jsx("div", { className: "text-prussian-blue dark:text-white text-3xl font-bold", children: letters.map((letter, index) => /* @__PURE__ */ jsx(
944
- "span",
945
- {
946
- className: "select-none",
947
- ref: (ref) => {
948
- letterRefs[index] = ref;
949
- },
950
- children: letter
951
- },
952
- index
953
- )) })
954
- ] }) })
955
- );
997
+ ) });
956
998
  }
957
999
  function FadingBase({
958
1000
  className = "",
@@ -1214,7 +1256,12 @@ function MenuBarItem({ icon, isActive, title, onClick }) {
1214
1256
  className: `transition duration-300 hover:bg-prussian-blue ${isActive ? "bg-prussian-blue" : ""} rounded-lg p-2 cursor-pointer`,
1215
1257
  onClick,
1216
1258
  tabIndex: 0,
1217
- onKeyDown: (e) => e.key === "Enter" && onClick?.(),
1259
+ onKeyDown: (e) => {
1260
+ if (e.key === "Enter" || e.key === " ") {
1261
+ e.preventDefault();
1262
+ onClick?.();
1263
+ }
1264
+ },
1218
1265
  children: icon
1219
1266
  }
1220
1267
  ) });
@@ -1422,7 +1469,7 @@ function Wizard({ children, steps, storageKey = "po_wizard" }) {
1422
1469
  children
1423
1470
  ] });
1424
1471
  }
1425
- var SearchInput = React10.forwardRef(function SearchInput2({
1472
+ var SearchInput = React9.forwardRef(function SearchInput2({
1426
1473
  value,
1427
1474
  onChange,
1428
1475
  disabled,
@@ -1449,7 +1496,8 @@ var SearchInput = React10.forwardRef(function SearchInput2({
1449
1496
  disabled,
1450
1497
  value,
1451
1498
  onChange,
1452
- type: "text",
1499
+ type: "search",
1500
+ enterKeyHint: "search",
1453
1501
  name,
1454
1502
  id: htmlFor,
1455
1503
  className: "focus:outline-none pl-2 h-9 w-56 outline-offset-2 text-prussian-blue mt-1 rounded-lg disabled:bg-disabled disabled:cursor-not-allowed",
@@ -1686,7 +1734,7 @@ function TableBody({
1686
1734
  setVisibleRows(initial);
1687
1735
  }
1688
1736
  }, [rows]);
1689
- return /* @__PURE__ */ jsx("tbody", { className: "w-full", children: rows.map((row, i) => /* @__PURE__ */ jsxs(React10.Fragment, { children: [
1737
+ return /* @__PURE__ */ jsx("tbody", { className: "w-full", children: rows.map((row, i) => /* @__PURE__ */ jsxs(React9.Fragment, { children: [
1690
1738
  /* @__PURE__ */ jsxs(
1691
1739
  "tr",
1692
1740
  {
@@ -2267,7 +2315,7 @@ function ThemeProvider({
2267
2315
  className = "",
2268
2316
  style
2269
2317
  }) {
2270
- const id = React10.useId().replace(/:/g, "");
2318
+ const id = React9.useId().replace(/:/g, "");
2271
2319
  const scopeClass = `geo-th-${id}`;
2272
2320
  const divRef = useRef(null);
2273
2321
  useEffect(() => {
@@ -2420,6 +2468,9 @@ function TextInput({
2420
2468
  className: `flex ${layout === "vertical" ? "flex-col" : "flex-row items-center gap-2"}`,
2421
2469
  style: style ?? {},
2422
2470
  children: [
2471
+ label && // Render <label> only when a label is provided. An empty
2472
+ // <label htmlFor=…> announces as an unlabeled control in
2473
+ // some screen readers.
2423
2474
  /* @__PURE__ */ jsx(
2424
2475
  "label",
2425
2476
  {
@@ -2566,6 +2617,9 @@ function Password({
2566
2617
  const color = iconColor ?? colors_default.PALETTE["prussian-blue"];
2567
2618
  return /* @__PURE__ */ jsxs("div", { className: "relative flex flex-col items-center justify-center", style: style ?? {}, children: [
2568
2619
  /* @__PURE__ */ jsxs("div", { className: `flex ${layout === "vertical" ? "flex-col" : "flex-row items-center gap-2"}`, children: [
2620
+ label && // Render <label> only when a label is provided. An empty
2621
+ // <label htmlFor=…> announces as an unlabeled control in
2622
+ // some screen readers.
2569
2623
  /* @__PURE__ */ jsx(
2570
2624
  "label",
2571
2625
  {
@@ -2926,7 +2980,7 @@ function FileInput({
2926
2980
  const fileInput = useRef(null);
2927
2981
  const [files, setFiles] = useState([]);
2928
2982
  const openPicker = () => {
2929
- fileInput.current?.dispatchEvent(new MouseEvent("click", { bubbles: false }));
2983
+ fileInput.current?.click();
2930
2984
  };
2931
2985
  const handleFiles = (list) => {
2932
2986
  setFiles(list);
@@ -2958,56 +3012,70 @@ function FileInput({
2958
3012
  onChange?.({ target: { files: [], name, id: name, value: "" } });
2959
3013
  if (fileInput.current) fileInput.current.value = "";
2960
3014
  };
2961
- return /* @__PURE__ */ jsxs(
2962
- "div",
2963
- {
2964
- onClick: openPicker,
2965
- className: "border-2 hover:border-prussian-blue border-ice-dark w-full h-full rounded-md transition-all duration-300 border-dashed dark:border-independence hover:dark:border-ice-dark cursor-pointer",
2966
- onDragOver: (e) => e.preventDefault(),
2967
- onDrop,
2968
- children: [
2969
- /* @__PURE__ */ jsx(
2970
- "input",
2971
- {
2972
- id: name,
2973
- name,
2974
- onChange: localOnChange,
2975
- ref: fileInput,
2976
- hidden: true,
2977
- type: "file",
2978
- accept,
2979
- multiple: allowMultiple
3015
+ return (
3016
+ // Dropzone is keyboard-activatable: role="button", focusable via
3017
+ // tabIndex, and Space/Enter trigger the file picker. Without these
3018
+ // a keyboard-only user could not upload a file.
3019
+ /* @__PURE__ */ jsxs(
3020
+ "div",
3021
+ {
3022
+ role: "button",
3023
+ tabIndex: 0,
3024
+ "aria-label": "Upload file \u2014 click or drop",
3025
+ onClick: openPicker,
3026
+ onKeyDown: (e) => {
3027
+ if (e.key === "Enter" || e.key === " ") {
3028
+ e.preventDefault();
3029
+ openPicker();
2980
3030
  }
2981
- ),
2982
- files.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full items-center justify-center gap-2", children: [
2983
- /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: colors_default.PALETTE["prussian-blue"], className: "w-16 h-16 dark:fill-white", 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" }) }),
2984
- /* @__PURE__ */ jsx("div", { className: "text-prussian-blue dark:text-white text-sm", children: "Click or Drop a file" })
2985
- ] }) : /* @__PURE__ */ jsx("div", { className: "flex gap-3 items-center justify-center w-full h-full", children: files.map((file, id) => /* @__PURE__ */ jsxs(
2986
- "div",
2987
- {
2988
- className: "text-xs flex flex-col items-center w-20 h-24 text-center bg-ice-dark p-4 dark:bg-independence rounded-md relative",
2989
- children: [
2990
- /* @__PURE__ */ jsx(
2991
- "button",
2992
- {
2993
- type: "button",
2994
- onClick: removeFile,
2995
- className: "bg-error rounded-full w-4 h-4 absolute right-[-5px] top-[-5px] cursor-pointer flex items-center justify-center",
2996
- "aria-label": "Remove file",
2997
- 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" }) })
2998
- }
2999
- ),
3000
- /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: colors_default.PALETTE["prussian-blue"], className: "w-10 h-10 dark:fill-white", children: [
3001
- /* @__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" }),
3002
- /* @__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" })
3003
- ] }),
3004
- /* @__PURE__ */ jsx("span", { className: "text-ellipsis whitespace-nowrap overflow-hidden w-full text-prussian-blue dark:text-white", children: file.name })
3005
- ]
3006
- },
3007
- `${id}${file.name}`
3008
- )) })
3009
- ]
3010
- }
3031
+ },
3032
+ className: "border-2 hover:border-prussian-blue border-ice-dark w-full h-full rounded-md transition-all duration-300 border-dashed dark:border-independence hover:dark:border-ice-dark cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
3033
+ onDragOver: (e) => e.preventDefault(),
3034
+ onDrop,
3035
+ children: [
3036
+ /* @__PURE__ */ jsx(
3037
+ "input",
3038
+ {
3039
+ id: name,
3040
+ name,
3041
+ onChange: localOnChange,
3042
+ ref: fileInput,
3043
+ hidden: true,
3044
+ type: "file",
3045
+ accept,
3046
+ multiple: allowMultiple
3047
+ }
3048
+ ),
3049
+ files.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full items-center justify-center gap-2", children: [
3050
+ /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: colors_default.PALETTE["prussian-blue"], className: "w-16 h-16 dark:fill-white", 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" }) }),
3051
+ /* @__PURE__ */ jsx("div", { className: "text-prussian-blue dark:text-white text-sm", children: "Click or Drop a file" })
3052
+ ] }) : /* @__PURE__ */ jsx("div", { className: "flex gap-3 items-center justify-center w-full h-full", children: files.map((file, id) => /* @__PURE__ */ jsxs(
3053
+ "div",
3054
+ {
3055
+ className: "text-xs flex flex-col items-center w-20 h-24 text-center bg-ice-dark p-4 dark:bg-independence rounded-md relative",
3056
+ children: [
3057
+ /* @__PURE__ */ jsx(
3058
+ "button",
3059
+ {
3060
+ type: "button",
3061
+ onClick: removeFile,
3062
+ className: "bg-error rounded-full w-4 h-4 absolute right-[-5px] top-[-5px] cursor-pointer flex items-center justify-center",
3063
+ "aria-label": "Remove file",
3064
+ 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" }) })
3065
+ }
3066
+ ),
3067
+ /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: colors_default.PALETTE["prussian-blue"], className: "w-10 h-10 dark:fill-white", children: [
3068
+ /* @__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" }),
3069
+ /* @__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" })
3070
+ ] }),
3071
+ /* @__PURE__ */ jsx("span", { className: "text-ellipsis whitespace-nowrap overflow-hidden w-full text-prussian-blue dark:text-white", children: file.name })
3072
+ ]
3073
+ },
3074
+ `${id}${file.name}`
3075
+ )) })
3076
+ ]
3077
+ }
3078
+ )
3011
3079
  );
3012
3080
  }
3013
3081
  var MONTHS = {