@geomak/ui 1.7.4 → 1.7.5
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 +123 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -24
- package/dist/index.d.ts +28 -24
- package/dist/index.js +123 -64
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1059,16 +1059,28 @@ function FadingBase({
|
|
|
1059
1059
|
);
|
|
1060
1060
|
}
|
|
1061
1061
|
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
|
-
|
|
1062
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { role: "listbox", children: items.map((item) => (
|
|
1063
|
+
// tabIndex + Enter/Space onKeyDown makes each option
|
|
1064
|
+
// keyboard-activatable. Previously the items were only mouse-
|
|
1065
|
+
// clickable — keyboard-only users couldn't select anything.
|
|
1066
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1067
|
+
"div",
|
|
1068
|
+
{
|
|
1069
|
+
role: "option",
|
|
1070
|
+
"aria-selected": activeKey === item.key,
|
|
1071
|
+
tabIndex: 0,
|
|
1072
|
+
className: `hover:bg-ice-dark dark:hover:bg-independence cursor-pointer p-3 border-b border-b-ice-dark dark:border-b-independence transition-all duration-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent ${activeKey === item.key ? "bg-ice-dark dark:bg-independence" : ""}`,
|
|
1073
|
+
onClick: () => onItemClick(item),
|
|
1074
|
+
onKeyDown: (e) => {
|
|
1075
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1076
|
+
e.preventDefault();
|
|
1077
|
+
onItemClick(item);
|
|
1078
|
+
}
|
|
1079
|
+
},
|
|
1080
|
+
children: item.label
|
|
1081
|
+
},
|
|
1082
|
+
item.key
|
|
1083
|
+
)
|
|
1072
1084
|
)) });
|
|
1073
1085
|
}
|
|
1074
1086
|
function ScalableContainer({
|
|
@@ -1574,6 +1586,8 @@ function Dropdown({
|
|
|
1574
1586
|
const [hoveredItem, setHoveredItem] = React9.useState(null);
|
|
1575
1587
|
const [searchTerm, setSearchTerm] = React9.useState("");
|
|
1576
1588
|
const [innerItems, setInnerItems] = React9.useState([]);
|
|
1589
|
+
const errorId = React9.useId();
|
|
1590
|
+
const hasError = errorMessage != null;
|
|
1577
1591
|
React9.useEffect(() => {
|
|
1578
1592
|
setInnerItems(items);
|
|
1579
1593
|
}, [items]);
|
|
@@ -1626,10 +1640,18 @@ function Dropdown({
|
|
|
1626
1640
|
role: "combobox",
|
|
1627
1641
|
"aria-expanded": open,
|
|
1628
1642
|
"aria-haspopup": "listbox",
|
|
1643
|
+
"aria-invalid": hasError || void 0,
|
|
1644
|
+
"aria-describedby": hasError ? errorId : void 0,
|
|
1629
1645
|
style,
|
|
1630
1646
|
className: `flex items-center justify-between relative h-9 rounded-lg cursor-pointer select-none ${disabled ? "cursor-not-allowed bg-disabled" : "bg-white"}`,
|
|
1631
1647
|
tabIndex: disabled ? -1 : 0,
|
|
1632
|
-
onKeyDown: (e) =>
|
|
1648
|
+
onKeyDown: (e) => {
|
|
1649
|
+
if (disabled) return;
|
|
1650
|
+
if (e.key === "Enter" || e.key === " " || e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
1651
|
+
e.preventDefault();
|
|
1652
|
+
setOpen(true);
|
|
1653
|
+
}
|
|
1654
|
+
},
|
|
1633
1655
|
children: [
|
|
1634
1656
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1635
1657
|
"div",
|
|
@@ -1671,34 +1693,49 @@ function Dropdown({
|
|
|
1671
1693
|
placeholder: "Search..."
|
|
1672
1694
|
}
|
|
1673
1695
|
) }),
|
|
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"
|
|
1696
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { role: "listbox", "aria-multiselectable": isMultiselect, className: "max-h-40 overflow-y-auto", children: innerItems.map((item) => (
|
|
1697
|
+
// aria-rowindex was previously set here but
|
|
1698
|
+
// it's invalid ARIA on role="option" (it
|
|
1699
|
+
// belongs on rows of a grid/treegrid). Dropped.
|
|
1700
|
+
// tabIndex={0} + Enter/Space handler makes the
|
|
1701
|
+
// option keyboard-activatable; the full
|
|
1702
|
+
// combobox roving-tabindex pattern is deferred
|
|
1703
|
+
// until the planned Phase-5 rewrite.
|
|
1704
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1705
|
+
"div",
|
|
1706
|
+
{
|
|
1707
|
+
role: "option",
|
|
1708
|
+
"aria-selected": isSelected(item.key),
|
|
1709
|
+
tabIndex: 0,
|
|
1710
|
+
className: `flex items-center justify-between p-2 hover:bg-prussian-blue hover:text-white transition-all duration-150 text-sm text-prussian-blue rounded-lg cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-accent ${selectedItems.includes(item.key) ? "bg-ice-dark" : ""}`,
|
|
1711
|
+
onClick: () => selectItem(item.key),
|
|
1712
|
+
onKeyDown: (e) => {
|
|
1713
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1714
|
+
e.preventDefault();
|
|
1715
|
+
selectItem(item.key);
|
|
1697
1716
|
}
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1717
|
+
},
|
|
1718
|
+
onMouseEnter: () => setHoveredItem(item.key),
|
|
1719
|
+
onMouseLeave: () => setHoveredItem(null),
|
|
1720
|
+
children: [
|
|
1721
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
1722
|
+
item.icon && /* @__PURE__ */ jsxRuntime.jsx("div", { children: item.icon }),
|
|
1723
|
+
item.label
|
|
1724
|
+
] }),
|
|
1725
|
+
isSelected(item.key) && /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1726
|
+
"path",
|
|
1727
|
+
{
|
|
1728
|
+
d: "M4 10l4.5 4.5L16 6",
|
|
1729
|
+
stroke: hoveredItem === item.key ? "#fff" : chunk255PCZIW_cjs.colors_default.PALETTE["prussian-blue"],
|
|
1730
|
+
strokeWidth: "2",
|
|
1731
|
+
strokeLinecap: "round",
|
|
1732
|
+
strokeLinejoin: "round"
|
|
1733
|
+
}
|
|
1734
|
+
) })
|
|
1735
|
+
]
|
|
1736
|
+
},
|
|
1737
|
+
item.key
|
|
1738
|
+
)
|
|
1702
1739
|
)) })
|
|
1703
1740
|
]
|
|
1704
1741
|
}
|
|
@@ -1707,7 +1744,7 @@ function Dropdown({
|
|
|
1707
1744
|
]
|
|
1708
1745
|
}
|
|
1709
1746
|
),
|
|
1710
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-error dark:text-prussian-blue min-h-0", children: errorMessage })
|
|
1747
|
+
hasError && /* @__PURE__ */ jsxRuntime.jsx("div", { id: errorId, className: "text-center text-error dark:text-prussian-blue min-h-0", children: errorMessage })
|
|
1711
1748
|
] });
|
|
1712
1749
|
}
|
|
1713
1750
|
var DEFAULT_PICKER = [
|
|
@@ -1877,10 +1914,11 @@ function Pagination({
|
|
|
1877
1914
|
isMultiselect: false,
|
|
1878
1915
|
value: displayPerPageKey,
|
|
1879
1916
|
onChange: ({ target: { value } }) => {
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1917
|
+
if (Array.isArray(value)) return;
|
|
1918
|
+
const numKey = typeof value === "number" ? value : Number(value);
|
|
1919
|
+
if (!serverSide) setPerPageKey(numKey);
|
|
1920
|
+
const opt = picker.find((o) => o.key === numKey);
|
|
1921
|
+
onPerPageChange(opt?.label ?? opt?.value ?? numKey);
|
|
1884
1922
|
}
|
|
1885
1923
|
}
|
|
1886
1924
|
)
|
|
@@ -2533,6 +2571,8 @@ function TextInput({
|
|
|
2533
2571
|
errorMessage,
|
|
2534
2572
|
labelColor
|
|
2535
2573
|
}) {
|
|
2574
|
+
const errorId = React9.useId();
|
|
2575
|
+
const hasError = errorMessage != null;
|
|
2536
2576
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col items-center justify-center", children: [
|
|
2537
2577
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2538
2578
|
"div",
|
|
@@ -2563,7 +2603,9 @@ function TextInput({
|
|
|
2563
2603
|
type: "text",
|
|
2564
2604
|
name,
|
|
2565
2605
|
id: htmlFor,
|
|
2566
|
-
|
|
2606
|
+
"aria-invalid": hasError || void 0,
|
|
2607
|
+
"aria-describedby": hasError ? errorId : void 0,
|
|
2608
|
+
className: `${hasError ? "border border-error" : ""} focus:outline-oxford-blue-700-opaque p-2 h-9 w-60 outline-offset-2 text-prussian-blue mt-1 rounded-lg disabled:bg-disabled disabled:cursor-not-allowed transition-all`,
|
|
2567
2609
|
style: inputStyle ?? {},
|
|
2568
2610
|
placeholder: placeholder ?? ""
|
|
2569
2611
|
}
|
|
@@ -2571,7 +2613,7 @@ function TextInput({
|
|
|
2571
2613
|
]
|
|
2572
2614
|
}
|
|
2573
2615
|
),
|
|
2574
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-error dark:text-prussian-blue min-h-0", children: errorMessage })
|
|
2616
|
+
hasError && /* @__PURE__ */ jsxRuntime.jsx("div", { id: errorId, className: "text-center text-error dark:text-prussian-blue min-h-0", children: errorMessage })
|
|
2575
2617
|
] });
|
|
2576
2618
|
}
|
|
2577
2619
|
function NumberInput({
|
|
@@ -2687,6 +2729,8 @@ function Password({
|
|
|
2687
2729
|
}) {
|
|
2688
2730
|
const [passwordVisible, setPasswordVisible] = React9.useState(false);
|
|
2689
2731
|
const color = iconColor ?? chunk255PCZIW_cjs.colors_default.PALETTE["prussian-blue"];
|
|
2732
|
+
const errorId = React9.useId();
|
|
2733
|
+
const hasError = errorMessage != null;
|
|
2690
2734
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col items-center justify-center", style: style ?? {}, children: [
|
|
2691
2735
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex ${layout === "vertical" ? "flex-col" : "flex-row items-center gap-2"}`, children: [
|
|
2692
2736
|
label && // Render <label> only when a label is provided. An empty
|
|
@@ -2713,7 +2757,9 @@ function Password({
|
|
|
2713
2757
|
type: passwordVisible ? "text" : "password",
|
|
2714
2758
|
name,
|
|
2715
2759
|
id: htmlFor,
|
|
2716
|
-
|
|
2760
|
+
"aria-invalid": hasError || void 0,
|
|
2761
|
+
"aria-describedby": hasError ? errorId : void 0,
|
|
2762
|
+
className: `${hasError ? "border border-error" : ""} focus:outline-oxford-blue-700-opaque p-2 h-9 w-52 outline-offset-2 text-prussian-blue mt-1 rounded-lg disabled:bg-disabled disabled:cursor-not-allowed transition-all`,
|
|
2717
2763
|
style: inputStyle ?? {},
|
|
2718
2764
|
placeholder: placeholder ?? ""
|
|
2719
2765
|
}
|
|
@@ -2743,7 +2789,7 @@ function Password({
|
|
|
2743
2789
|
)
|
|
2744
2790
|
] })
|
|
2745
2791
|
] }),
|
|
2746
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-error dark:text-prussian-blue min-h-0", children: errorMessage })
|
|
2792
|
+
hasError && /* @__PURE__ */ jsxRuntime.jsx("div", { id: errorId, className: "text-center text-error dark:text-prussian-blue min-h-0", children: errorMessage })
|
|
2747
2793
|
] });
|
|
2748
2794
|
}
|
|
2749
2795
|
function Checkbox({
|
|
@@ -2910,23 +2956,36 @@ function AutoComplete({
|
|
|
2910
2956
|
sideOffset: 4,
|
|
2911
2957
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
2912
2958
|
className: "w-64 bg-ice dark:bg-midnight-green-eagle-900 rounded-lg mt-1 shadow-md z-50 overflow-y-auto max-h-36 animate-in fade-in-0 zoom-in-95",
|
|
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-prussian-blue dark:text-white", children: emptyText }) : /* @__PURE__ */ jsxRuntime.jsx("div", { role: "listbox", children: foundItems.map((item) =>
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2959
|
+
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-prussian-blue dark:text-white", children: emptyText }) : /* @__PURE__ */ jsxRuntime.jsx("div", { role: "listbox", children: foundItems.map((item) => (
|
|
2960
|
+
// tabIndex + Enter/Space onKeyDown
|
|
2961
|
+
// makes each option keyboard-activatable.
|
|
2962
|
+
// Full roving-tabindex / arrow-key nav
|
|
2963
|
+
// is deferred to the Phase-5 rewrite.
|
|
2964
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2965
|
+
"div",
|
|
2966
|
+
{
|
|
2967
|
+
role: "option",
|
|
2968
|
+
tabIndex: 0,
|
|
2969
|
+
className: "text-sm flex items-center gap-2 p-2 transition-all duration-150 hover:bg-ice-dark dark:hover:bg-prussian-blue cursor-pointer text-prussian-blue dark:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
|
|
2970
|
+
onClick: () => handleSelect(item),
|
|
2971
|
+
onKeyDown: (e) => {
|
|
2972
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
2973
|
+
e.preventDefault();
|
|
2974
|
+
handleSelect(item);
|
|
2975
|
+
}
|
|
2976
|
+
},
|
|
2977
|
+
children: [
|
|
2978
|
+
item.icon,
|
|
2979
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
2980
|
+
item.label,
|
|
2981
|
+
" (",
|
|
2982
|
+
item.value,
|
|
2983
|
+
")"
|
|
2984
|
+
] })
|
|
2985
|
+
]
|
|
2986
|
+
},
|
|
2987
|
+
item.key
|
|
2988
|
+
)
|
|
2930
2989
|
)) })
|
|
2931
2990
|
}
|
|
2932
2991
|
) })
|