@usace/groundwork 4.3.2 → 5.0.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.
Files changed (67) hide show
  1. package/dist/es/components/button.js +125 -0
  2. package/dist/es/components/buttons/popover.js +51 -0
  3. package/dist/es/components/buttons/standard-buttons.js +54 -0
  4. package/dist/es/components/data-grid/data-grid-header.js +54 -0
  5. package/dist/es/components/data-grid/data-grid-row.js +44 -0
  6. package/dist/es/components/data-grid/data-grid-selector.js +65 -0
  7. package/dist/es/components/data-grid/data-grid.js +89 -0
  8. package/dist/es/components/display/accordion.js +24 -0
  9. package/dist/es/components/display/badge.js +56 -0
  10. package/dist/es/components/display/card.js +13 -0
  11. package/dist/es/components/display/divider.js +25 -0
  12. package/dist/es/components/display/headings.js +34 -0
  13. package/dist/es/components/display/loader.js +10 -0
  14. package/dist/es/components/display/modal.js +39 -0
  15. package/dist/es/components/display/progress-bar.js +20 -0
  16. package/dist/es/components/display/skeleton.js +9 -0
  17. package/dist/es/components/display/text.js +31 -0
  18. package/dist/es/components/form/checkboxes.js +72 -0
  19. package/dist/es/components/form/dropdown.js +20 -0
  20. package/dist/es/components/form/fieldset.js +60 -0
  21. package/dist/es/components/form/input.js +55 -0
  22. package/dist/es/components/form/radio-group.js +57 -0
  23. package/dist/es/components/form/textarea.js +34 -0
  24. package/dist/es/components/hero.js +67 -0
  25. package/dist/es/components/layout/container.js +12 -0
  26. package/dist/es/components/layout/usace-box.js +18 -0
  27. package/dist/es/components/navigation/breadcrumbs.js +39 -0
  28. package/dist/es/components/navigation/link-provider.js +15 -0
  29. package/dist/es/components/navigation/link.js +15 -0
  30. package/dist/es/components/navigation/tabs.js +35 -0
  31. package/dist/es/components/profile-dropdown.js +61 -0
  32. package/dist/es/components/search.js +37 -0
  33. package/dist/es/components/table.js +101 -0
  34. package/dist/es/composite/footer/essayons.js +22 -0
  35. package/dist/es/composite/footer/footer-links.js +28 -0
  36. package/dist/es/composite/footer/index.js +147 -0
  37. package/dist/es/composite/footer/logo-banner.js +100 -0
  38. package/dist/es/composite/footer/social-links.js +55 -0
  39. package/dist/es/composite/header/index.js +91 -0
  40. package/dist/es/composite/header/navbar-links.js +71 -0
  41. package/dist/es/composite/header/overlay-links.js +68 -0
  42. package/dist/es/composite/header/usa-banner/USABanner.js +130 -0
  43. package/dist/es/composite/sidebar/index.js +102 -0
  44. package/dist/es/composite/site-wrapper/dod-warning.js +46 -0
  45. package/dist/es/composite/site-wrapper/index.js +49 -0
  46. package/dist/es/gw-merge.js +11 -0
  47. package/dist/es/hooks/useIsMobile.js +32 -0
  48. package/dist/es/hooks/useScrollFade.js +19 -0
  49. package/dist/es/img/Army-250-year-logo.js +4 -0
  50. package/dist/es/img/Magnifying_glass_icon.js +4 -0
  51. package/dist/es/img/USACE-250-year-logo.js +4 -0
  52. package/dist/es/img/armystar-logo-rb.js +4 -0
  53. package/dist/es/img/cwbi-logo.js +4 -0
  54. package/dist/es/img/essayonscrest.js +4 -0
  55. package/dist/es/img/icon-dot-gov.js +4 -0
  56. package/dist/es/img/icon-https.js +4 -0
  57. package/dist/es/img/rsgis-logo.js +4 -0
  58. package/dist/es/img/us_flag_small.js +4 -0
  59. package/dist/es/img/usace-logo-color.js +4 -0
  60. package/dist/es/index.js +37 -0
  61. package/dist/es/utils/paths.js +19 -0
  62. package/dist/es/utils/sizes.js +14 -0
  63. package/dist/groundwork.css +2 -1
  64. package/dist/groundwork.umd.cjs +1 -0
  65. package/package.json +53 -9
  66. package/dist/groundwork.es.js +0 -9434
  67. package/dist/groundwork.umd.js +0 -5
@@ -0,0 +1,125 @@
1
+ import e from "../gw-merge.js";
2
+ import t from "./navigation/link.js";
3
+ import n from "react";
4
+ import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
5
+ import { Button as o } from "@headlessui/react";
6
+ //#region lib/components/button.jsx
7
+ var s = ["gw:hover:cursor-pointer gw:relative gw:isolate gw:inline-flex gw:items-center gw:justify-center gw:gap-x-2 gw:font-semibold", "gw:data-disabled:cursor-not-allowed gw:data-disabled:opacity-50"], c = {
8
+ xs: "gw:px-2 gw:py-1 gw:text-xs",
9
+ sm: "gw:px-3 gw:py-1.5 gw:text-sm",
10
+ md: "gw:px-4 gw:py-2 gw:text-sm",
11
+ lg: "gw:px-5 gw:py-3 gw:text-base",
12
+ xl: "gw:px-6 gw:py-4 gw:text-lg"
13
+ }, l = {
14
+ none: "gw:rounded-none",
15
+ xs: "gw:rounded-xs",
16
+ sm: "gw:rounded-sm",
17
+ md: "gw:rounded-md",
18
+ lg: "gw:rounded-lg",
19
+ xl: "gw:rounded-xl"
20
+ }, u = {
21
+ light: "gw:bg-white gw:text-usace-black gw:border gw:border-gray-300/60 gw:hover:bg-gray-100/80 gw:active:bg-gray-200/70",
22
+ dark: "gw:bg-gray-900 gw:text-white gw:border gw:border-gray-900/90 gw:hover:bg-gray-900/90 gw:active:bg-gray-900/80",
23
+ primary: "gw:bg-blue-600 gw:text-white gw:border gw:border-blue-700/90 gw:hover:bg-blue-600/90 gw:active:bg-blue-600/80",
24
+ secondary: "gw:bg-gray-600 gw:text-white gw:border gw:border-gray-700/90 gw:hover:bg-gray-600/90 gw:active:bg-gray-600/80",
25
+ success: "gw:bg-green-600 gw:text-white gw:border gw:border-green-600/90 gw:hover:bg-green-600/90 gw:active:bg-green-600/80",
26
+ warning: "gw:bg-orange-600 gw:text-white gw:border gw:border-orange-700/90 gw:hover:bg-orange-600/90 gw:active:bg-orange-600/80",
27
+ danger: "gw:bg-red-600 gw:text-white gw:border gw:border-red-700/90 gw:hover:bg-red-600/90 gw:active:bg-red-600/80",
28
+ info: "gw:bg-cyan-400 gw:text-cyan-950 gw:border gw:border-cyan-500/90 gw:hover:bg-cyan-400/80 gw:active:bg-cyan-400/70",
29
+ white: "gw:bg-white gw:text-usace-black gw:border gw:border-usace-black/60 gw:hover:bg-gray-100/80 gw:active:bg-gray-200/70",
30
+ zinc: "gw:bg-zinc-800 gw:text-white gw:border gw:border-zinc-800/90 gw:hover:bg-zinc-800/90 gw:active:bg-zinc-800/80",
31
+ indigo: "gw:bg-indigo-600 gw:text-white gw:border gw:border-indigo-700/90 gw:hover:bg-indigo-600/90 gw:active:bg-indigo-600/80",
32
+ cyan: "gw:bg-cyan-400 gw:text-cyan-950 gw:border gw:border-cyan-500/90 gw:hover:bg-cyan-400/80 gw:active:bg-cyan-400/70",
33
+ red: "gw:bg-red-600 gw:text-white gw:border gw:border-red-700/90 gw:hover:bg-red-600/90 gw:active:bg-red-600/80",
34
+ orange: "gw:bg-orange-600 gw:text-white gw:border gw:border-orange-700/90 gw:hover:bg-orange-600/90 gw:active:bg-orange-600/80",
35
+ amber: "gw:bg-amber-600 gw:text-white gw:border gw:border-amber-700/90 gw:hover:bg-amber-600/90 gw:active:bg-amber-600/80",
36
+ yellow: "gw:bg-yellow-600 gw:text-white gw:border gw:border-yellow-700/90 gw:hover:bg-yellow-600/90 gw:active:bg-yellow-600/80",
37
+ lime: "gw:bg-lime-600 gw:text-white gw:border gw:border-lime-700/90 gw:hover:bg-lime-600/90 gw:active:bg-lime-600/80",
38
+ green: "gw:bg-green-600 gw:text-white gw:border gw:border-green-700/90 gw:hover:bg-green-600/90 gw:active:bg-green-600/80",
39
+ emerald: "gw:bg-emerald-600 gw:text-white gw:border gw:border-emerald-700/90 gw:hover:bg-emerald-600/90 gw:active:bg-emerald-600/80",
40
+ teal: "gw:bg-teal-600 gw:text-white gw:border gw:border-teal-700/90 gw:hover:bg-teal-600/90 gw:active:bg-teal-600/80",
41
+ sky: "gw:bg-sky-600 gw:text-white gw:border gw:border-sky-700/90 gw:hover:bg-sky-600/90 gw:active:bg-sky-600/80",
42
+ blue: "gw:bg-blue-600 gw:text-white gw:border gw:border-blue-700/90 gw:hover:bg-blue-600/90 gw:active:bg-blue-600/80",
43
+ violet: "gw:bg-violet-600 gw:text-white gw:border gw:border-violet-700/90 gw:hover:bg-violet-600/90 gw:active:bg-violet-600/80",
44
+ purple: "gw:bg-purple-600 gw:text-white gw:border gw:border-purple-700/90 gw:hover:bg-purple-600/90 gw:active:bg-purple-600/80",
45
+ fuchsia: "gw:bg-fuchsia-600 gw:text-white gw:border gw:border-fuchsia-700/90 gw:hover:bg-fuchsia-600/90 gw:active:bg-fuchsia-600/80",
46
+ pink: "gw:bg-pink-600 gw:text-white gw:border gw:border-pink-700/90 gw:hover:bg-pink-600/90 gw:active:bg-pink-600/80",
47
+ rose: "gw:bg-rose-600 gw:text-white gw:border gw:border-rose-700/90 gw:hover:bg-rose-600/90 gw:active:bg-rose-600/80"
48
+ }, d = {
49
+ light: "gw:bg-transparent gw:text-usace-black gw:border gw:border-gray-300/60 gw:hover:bg-gray-100/80 gw:active:bg-gray-200/70",
50
+ dark: "gw:bg-transparent gw:text-usace-black gw:border gw:border-gray-900/90 gw:hover:bg-gray-900 gw:hover:text-white gw:active:bg-gray-200/70",
51
+ primary: "gw:bg-transparent gw:text-blue-600 gw:border gw:border-blue-700/90 gw:border gw:border-blue-700/90 gw:hover:bg-blue-600/90 gw:hover:text-white gw:active:bg-blue-600/80",
52
+ secondary: "gw:bg-transparent gw:text-gray-700 gw:border gw:border-gray-700/90 gw:hover:bg-gray-600/90 gw:hover:text-white gw:active:bg-gray-600/80",
53
+ success: "gw:bg-transparent gw:text-green-600 gw:border gw:border-green-600/90 gw:hover:bg-green-600/90 gw:hover:text-white gw:active:bg-green-600/80",
54
+ warning: "gw:bg-transparent gw:text-orange-600 gw:border gw:border-orange-700/90 gw:hover:bg-orange-600/90 gw:hover:text-white gw:active:bg-orange-600/80",
55
+ danger: "gw:bg-transparent gw:text-red-600 gw:border gw:border-red-700/90 gw:hover:bg-red-600/90 gw:hover:text-white gw:active:bg-red-600/80",
56
+ info: "gw:bg-transparent gw:text-cyan-400 gw:text-cyan-950 gw:border gw:border-cyan-500/90 gw:hover:bg-cyan-400/80 gw:hover:text-white gw:active:bg-cyan-400/70",
57
+ white: "gw:bg-transparent gw:text-white gw:border gw:border-white gw:hover:bg-gray-100/80 gw:active:bg-gray-200/70",
58
+ zinc: "gw:bg-transparent gw:text-zinc-800 gw:border gw:border-zinc-800/90 gw:hover:bg-zinc-800/90 gw:hover:text-white gw:active:bg-zinc-800/80",
59
+ indigo: "gw:bg-transparent gw:text-indigo-600 gw:border gw:border-indigo-700/90 gw:hover:bg-indigo-600/90 gw:hover:text-white gw:active:bg-indigo-600/80",
60
+ cyan: "gw:bg-transparent gw:text-cyan-400 gw:text-cyan-950 gw:border gw:border-cyan-500/90 gw:hover:bg-cyan-400/80 gw:hover:text-white gw:active:bg-cyan-400/70",
61
+ red: "gw:bg-transparent gw:text-red-600 gw:border gw:border-red-700/90 gw:hover:bg-red-600/90 gw:hover:text-white gw:active:bg-red-600/80",
62
+ orange: "gw:bg-transparent gw:text-orange-600 gw:border gw:border-orange-700/90 gw:hover:bg-orange-600/90 gw:hover:text-white gw:active:bg-orange-600/80",
63
+ amber: "gw:bg-transparent gw:text-amber-600 gw:border gw:border-amber-700/90 gw:hover:bg-amber-600/90 gw:hover:text-white gw:active:bg-amber-600/80",
64
+ yellow: "gw:bg-transparent gw:text-yellow-600 gw:border gw:border-yellow-700/90 gw:hover:bg-yellow-600/90 gw:hover:text-white gw:active:bg-yellow-600/80",
65
+ lime: "gw:bg-transparent gw:text-lime-600 gw:border gw:border-lime-700/90 gw:hover:bg-lime-600/90 gw:hover:text-white gw:active:bg-lime-600/80",
66
+ green: "gw:bg-transparent gw:text-green-600 gw:border gw:border-green-700/90 gw:hover:bg-green-600/90 gw:hover:text-white gw:active:bg-green-600/80",
67
+ emerald: "gw:bg-transparent gw:text-emerald-600 gw:border gw:border-emerald-700/90 gw:hover:bg-emerald-600/90 gw:hover:text-white gw:active:bg-emerald-600/80",
68
+ teal: "gw:bg-transparent gw:text-teal-600 gw:border gw:border-teal-700/90 gw:hover:bg-teal-600/90 gw:hover:text-white gw:active:bg-teal-600/80",
69
+ sky: "gw:bg-transparent gw:text-sky-600 gw:border gw:border-sky-700/90 gw:hover:bg-sky-600/90 gw:hover:text-white gw:active:bg-sky-600/80",
70
+ blue: "gw:bg-transparent gw:text-blue-600 gw:border gw:border-blue-700/90 gw:hover:bg-blue-600/90 gw:hover:text-white gw:active:bg-blue-600/80",
71
+ violet: "gw:bg-transparent gw:text-violet-600 gw:border gw:border-violet-700/90 gw:hover:bg-violet-600/90 gw:hover:text-white gw:active:bg-violet-600/80",
72
+ purple: "gw:bg-transparent gw:text-purple-600 gw:border gw:border-purple-700/90 gw:hover:bg-purple-600/90 gw:hover:text-white gw:active:bg-purple-600/80",
73
+ fuchsia: "gw:bg-transparent gw:text-fuchsia-600 gw:border gw:border-fuchsia-700/90 gw:hover:bg-fuchsia-600/90 gw:hover:text-white gw:active:bg-fuchsia-600/80",
74
+ pink: "gw:bg-transparent gw:text-pink-600 gw:border gw:border-pink-700/90 gw:hover:bg-pink-600/90 gw:hover:text-white gw:active:bg-pink-600/80",
75
+ rose: "gw:bg-transparent gw:text-rose-600 gw:border gw:border-rose-700/90 gw:hover:bg-rose-600/90 gw:hover:text-white gw:active:bg-rose-600/80"
76
+ }, f = {
77
+ light: "gw:bg-transparent gw:text-gray-600",
78
+ dark: "gw:bg-transparent gw:text-usace-black",
79
+ primary: "gw:bg-transparent gw:text-blue-600",
80
+ secondary: "gw:bg-transparent gw:text-gray-700",
81
+ success: "gw:bg-transparent gw:text-green-600",
82
+ warning: "gw:bg-transparent gw:text-orange-600",
83
+ danger: "gw:bg-transparent gw:text-red-600",
84
+ info: "gw:bg-transparent gw:text-cyan-400",
85
+ white: "gw:bg-transparent gw:text-white",
86
+ zinc: "gw:bg-transparent gw:text-zinc-800",
87
+ indigo: "gw:bg-transparent gw:text-indigo-600",
88
+ cyan: "gw:bg-transparent gw:text-cyan-400",
89
+ red: "gw:bg-transparent gw:text-red-600",
90
+ orange: "gw:bg-transparent gw:text-orange-600",
91
+ amber: "gw:bg-transparent gw:text-amber-600",
92
+ yellow: "gw:bg-transparent gw:text-yellow-600",
93
+ lime: "gw:bg-transparent gw:text-lime-600",
94
+ green: "gw:bg-transparent gw:text-green-600",
95
+ emerald: "gw:bg-transparent gw:text-emerald-600",
96
+ teal: "gw:bg-transparent gw:text-teal-600",
97
+ sky: "gw:bg-transparent gw:text-sky-600",
98
+ blue: "gw:bg-transparent gw:text-blue-600",
99
+ violet: "gw:bg-transparent gw:text-violet-600",
100
+ purple: "gw:bg-transparent gw:text-purple-600",
101
+ fuchsia: "gw:bg-transparent gw:text-fuchsia-600",
102
+ pink: "gw:bg-transparent gw:text-pink-600",
103
+ rose: "gw:bg-transparent gw:text-rose-600"
104
+ }, p = n.forwardRef(function({ style: n = "filled", color: r = "primary", size: a = "md", radius: p = "xs", outline: h, plain: g, className: _, children: v, ...y }, b) {
105
+ let x = h ? "outline" : g ? "plain" : n, S = e(s, l[p], c[a], x === "filled" ? u[r] : "", x === "outline" ? d[r] : "", x === "plain" ? f[r] : "", _);
106
+ return "href" in y ? /* @__PURE__ */ i(t, {
107
+ ...y,
108
+ className: S,
109
+ ref: b,
110
+ children: /* @__PURE__ */ i(m, { children: v })
111
+ }) : /* @__PURE__ */ i(o, {
112
+ ...y,
113
+ className: e(S, "cursor-pointer"),
114
+ ref: b,
115
+ children: /* @__PURE__ */ i(m, { children: v })
116
+ });
117
+ });
118
+ function m({ children: e }) {
119
+ return /* @__PURE__ */ a(r, { children: [e, /* @__PURE__ */ i("span", {
120
+ className: "gw:absolute gw:left-1/2 gw:top-1/2 gw:size-[max(100%,2.75rem)] gw:-translate-x-1/2 gw:-translate-y-1/2 gw:pointer-fine:hidden",
121
+ "aria-hidden": "true"
122
+ })] });
123
+ }
124
+ //#endregion
125
+ export { p as Button, m as TouchTarget };
@@ -0,0 +1,51 @@
1
+ import e from "../../gw-merge.js";
2
+ import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
3
+ import { Popover as i, PopoverButton as a, PopoverPanel as o } from "@headlessui/react";
4
+ import { VscChevronDown as s, VscChevronLeft as c, VscChevronRight as l, VscChevronUp as u } from "react-icons/vsc";
5
+ //#region lib/components/buttons/popover.jsx
6
+ var d = [
7
+ "right",
8
+ "left",
9
+ "top",
10
+ "bottom"
11
+ ];
12
+ function f({ title: f, children: p, level: m = 0, className: h = "", direction: g = "right" }) {
13
+ if (g = g.toLowerCase(), !d.includes(g)) throw Error(`Invalid direction in component <Popover direction="${g}". Valid directions are: ${d.join(", ")}`);
14
+ let _ = {
15
+ right: "gw:left-full gw:transform gw:-translate-y-1/2 gw:translate-x-2",
16
+ left: "gw:right-full gw:transform gw:-translate-y-1/2 gw:-translate-x-2",
17
+ top: "gw:bottom-full gw:transform gw:-translate-x-1/2 gw:-translate-y-2",
18
+ bottom: "gw:top-full gw:transform gw:-translate-x-1/2 gw:translate-y-2"
19
+ }, v = {
20
+ right: l,
21
+ left: c,
22
+ top: u,
23
+ bottom: s
24
+ }[g];
25
+ return /* @__PURE__ */ n(i, {
26
+ name: "gw:popout-menu",
27
+ style: { zIndex: m * 10 + 100 },
28
+ className: e("gw:relative gw:cursor-not-allowed gw:select-none", h),
29
+ children: ({ open: e }) => /* @__PURE__ */ r(t, { children: [/* @__PURE__ */ r(a, {
30
+ style: { zIndex: m * 10 + 110 },
31
+ className: "gw:inline-flex gw:w-full gw:items-center gw:justify-between gw:leading-6 gw:ps-1 gw:focus:outline-hidden gw:hover:cursor-pointer",
32
+ children: [/* @__PURE__ */ n("span", { children: f }), /* @__PURE__ */ n(v, {
33
+ "aria-hidden": "true",
34
+ className: "gw:h-5 gw:w-5",
35
+ size: 12
36
+ })]
37
+ }), e && /* @__PURE__ */ n(o, {
38
+ transition: "true",
39
+ className: `${m ? "gw:fixed" : "gw:absolute"} gw:max-w-[50vw] gw:mt-2 gw:w-56 gw:shrink gw:rounded-xl gw:bg-white gw:text-sm gw:leading-6 gw:text-gray-900 gw:shadow-lg gw:ring-1 gw:ring-gray-900/5 ${_[g]}`,
40
+ style: { zIndex: m * 30 + 120 },
41
+ children: ({ close: e }) => /* @__PURE__ */ n("div", {
42
+ onClick: () => {
43
+ e();
44
+ },
45
+ children: p
46
+ })
47
+ })] })
48
+ });
49
+ }
50
+ //#endregion
51
+ export { f as PopoutMenu, f as default };
@@ -0,0 +1,54 @@
1
+ import { Button as e } from "../button.js";
2
+ import { useState as t } from "react";
3
+ import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
4
+ //#region lib/components/buttons/standard-buttons.jsx
5
+ function a({ onClick: t }) {
6
+ return /* @__PURE__ */ r(e, {
7
+ color: "white",
8
+ style: "plain",
9
+ className: "gw:font-normal",
10
+ onClick: t,
11
+ children: "Login"
12
+ });
13
+ }
14
+ function o({ onOk: t, onCancel: n }) {
15
+ return /* @__PURE__ */ i("div", {
16
+ className: "gw:flex gw:gap-2",
17
+ children: [/* @__PURE__ */ r(e, {
18
+ color: "emerald",
19
+ onClick: t,
20
+ children: "Ok"
21
+ }), /* @__PURE__ */ r(e, {
22
+ color: "white",
23
+ onClick: n,
24
+ children: "Cancel"
25
+ })]
26
+ });
27
+ }
28
+ function s({ onDelete: i, alignConfirm: a = "right" }) {
29
+ let [o, s] = t(!1), c = () => {
30
+ s(!0);
31
+ }, l = [/* @__PURE__ */ r(e, {
32
+ color: "white",
33
+ onClick: () => {
34
+ s(!1);
35
+ },
36
+ children: "Cancel"
37
+ }, "cancel"), /* @__PURE__ */ r(e, {
38
+ color: "red",
39
+ onClick: () => {
40
+ i && typeof i == "function" && i(), s(!1);
41
+ },
42
+ children: "Confirm"
43
+ }, "confirm")];
44
+ return /* @__PURE__ */ r("div", {
45
+ className: "gw:flex gw:gap-2",
46
+ children: o ? /* @__PURE__ */ r(n, { children: a === "right" ? l : l.reverse() }) : /* @__PURE__ */ r(e, {
47
+ color: "red",
48
+ onClick: c,
49
+ children: "Delete"
50
+ })
51
+ });
52
+ }
53
+ //#endregion
54
+ export { s as DeleteConfirm, a as LoginButton, o as OkCancel };
@@ -0,0 +1,54 @@
1
+ import e from "../../gw-merge.js";
2
+ import t from "./data-grid-selector.js";
3
+ import { memo as n } from "react";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ import { BsSortDown as a, BsSortDownAlt as o } from "react-icons/bs";
6
+ //#region lib/components/data-grid/data-grid-header.jsx
7
+ var s = n(function({ col: e, sortedBy: t, sortedDir: n, ...s }) {
8
+ return /* @__PURE__ */ i("div", {
9
+ "data-sorted-by": e.field === t,
10
+ className: "gw:pl-1 gw:pr-1 gw:flex gw:justify-between gw:items-center gw:data-[sorted-by=true]:font-bold gw:data-[sorted-by=true]:text-gray-800",
11
+ ...s,
12
+ children: [
13
+ e.header || "\xA0",
14
+ e.field === t && n === "asc" ? /* @__PURE__ */ r(o, {}) : null,
15
+ e.field === t && n === "desc" ? /* @__PURE__ */ r(a, {}) : null
16
+ ]
17
+ }, e.field);
18
+ });
19
+ function c({ sortedBy: a, sortedDir: o, columns: c, columnWidths: l, enableSelect: u, enableToggle: d, selected: f, onSelectAll: p, onSort: m }) {
20
+ return /* @__PURE__ */ i("div", {
21
+ className: "gw:sticky gw:top-0 gw:z-10 gw:flex gw:flex-row gw:items-center gw:text-sm gw:shadow-md",
22
+ children: [
23
+ u ? /* @__PURE__ */ r(t, {
24
+ selected: f,
25
+ onSelect: p
26
+ }) : null,
27
+ d ? /* @__PURE__ */ r(t, {
28
+ selected: f,
29
+ onSelect: p,
30
+ toggle: !0
31
+ }) : null,
32
+ c.map((t, i) => {
33
+ let c = typeof t.header == "function" ? n(t.header) : s, u = {
34
+ display: "flex",
35
+ width: l[i] - 1
36
+ };
37
+ return /* @__PURE__ */ r("div", {
38
+ className: e("gw:box-border gw:border-r gw:border-r-gray-300 gw:last:border-r-0", t?.sortable ? "gw:cursor-pointer" : ""),
39
+ children: /* @__PURE__ */ r(c, {
40
+ style: u,
41
+ col: t,
42
+ sortedBy: a,
43
+ sortedDir: o,
44
+ onClick: () => {
45
+ m && t?.field && t?.sortable && m(t.field);
46
+ }
47
+ })
48
+ }, `${t.field}-${i}`);
49
+ })
50
+ ]
51
+ });
52
+ }
53
+ //#endregion
54
+ export { c as default };
@@ -0,0 +1,44 @@
1
+ import e from "../../gw-merge.js";
2
+ import t from "./data-grid-selector.js";
3
+ import { memo as n } from "react";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ //#region lib/components/data-grid/data-grid-row.jsx
6
+ var a = n(function({ val: t, className: n, style: i = {} }) {
7
+ return /* @__PURE__ */ r("div", {
8
+ className: e("gw:truncate", n),
9
+ style: i,
10
+ children: t
11
+ });
12
+ }), o = n(function({ row: e, columns: o, columnWidths: s, enableSelect: c, enableToggle: l, selected: u, onSelect: d }) {
13
+ return /* @__PURE__ */ i("div", {
14
+ className: "gw:flex gw:flex-row gw:items-center gw:text-sm gw:even:bg-gray-50",
15
+ children: [
16
+ c ? /* @__PURE__ */ r(t, {
17
+ selected: u,
18
+ onSelect: d,
19
+ row: e
20
+ }) : null,
21
+ l ? /* @__PURE__ */ r(t, {
22
+ selected: u,
23
+ onSelect: d,
24
+ row: e,
25
+ toggle: !0
26
+ }) : null,
27
+ o.map((t, i) => {
28
+ let o = t?.component ? n(t.component) : a, c = {
29
+ display: "flex",
30
+ width: s[i]
31
+ };
32
+ return /* @__PURE__ */ r(o, {
33
+ row: e,
34
+ field: t.field,
35
+ val: e[t.field]?.toString() || "",
36
+ className: "gw:p-1 gw:truncate",
37
+ style: c
38
+ }, `${t.field}-${i}`);
39
+ })
40
+ ]
41
+ });
42
+ });
43
+ //#endregion
44
+ export { o as default };
@@ -0,0 +1,65 @@
1
+ import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
+ //#region lib/components/data-grid/data-grid-selector.jsx
3
+ function n({ checked: n = !1, onChange: r }) {
4
+ return /* @__PURE__ */ e("div", {
5
+ className: "gw:flex gw:h-6 gw:shrink-0 gw:items-center",
6
+ children: /* @__PURE__ */ t("div", {
7
+ className: "gw:group gw:grid gw:size-4 gw:grid-cols-1",
8
+ children: [/* @__PURE__ */ e("input", {
9
+ id: "rowselect",
10
+ name: "selected",
11
+ type: "checkbox",
12
+ checked: n,
13
+ onChange: r,
14
+ "aria-describedby": "select a row",
15
+ className: "gw:col-start-1 gw:row-start-1 gw:appearance-none gw:rounded-sm gw:border gw:border-gray-300 gw:bg-white gw:checked:border-indigo-600 gw:checked:bg-indigo-600 gw:indeterminate:border-indigo-600 gw:indeterminate:bg-indigo-600 gw:focus-visible:outline-2 gw:focus-visible:outline-offset-2 gw:focus-visible:outline-indigo-600 gw:disabled:border-gray-300 gw:disabled:bg-gray-100 gw:disabled:checked:bg-gray-100 gw:forced-colors:appearance-auto"
16
+ }), /* @__PURE__ */ t("svg", {
17
+ fill: "none",
18
+ viewBox: "0 0 14 14",
19
+ className: "gw:pointer-events-none gw:col-start-1 gw:row-start-1 gw:size-3.5 gw:self-center gw:justify-self-center gw:stroke-white gw:group-has-disabled:stroke-gray-950/25",
20
+ children: [/* @__PURE__ */ e("path", {
21
+ d: "M3 8L6 11L11 3.5",
22
+ strokeWidth: 2,
23
+ strokeLinecap: "round",
24
+ strokeLinejoin: "round",
25
+ className: "gw:opacity-0 gw:group-has-checked:opacity-100"
26
+ }), /* @__PURE__ */ e("path", {
27
+ d: "M3 7H11",
28
+ strokeWidth: 2,
29
+ strokeLinecap: "round",
30
+ strokeLinejoin: "round",
31
+ className: "gw:opacity-0 gw:group-has-indeterminate:opacity-100"
32
+ })]
33
+ })]
34
+ })
35
+ });
36
+ }
37
+ function r({ checked: n, onChange: r }) {
38
+ return /* @__PURE__ */ t("div", {
39
+ className: "gw:group gw:relative gw:inline-flex gw:h-5 gw:w-10 gw:shrink-0 gw:items-center gw:justify-center gw:rounded-full gw:outline-offset-2 gw:outline-indigo-600 gw:has-focus-visible:outline-2",
40
+ children: [
41
+ /* @__PURE__ */ e("span", { className: "gw:absolute gw:mx-auto gw:h-4 gw:w-9 gw:rounded-full gw:bg-gray-200 gw:inset-ring gw:inset-ring-gray-900/5 gw:transition-colors gw:duration-200 gw:ease-in-out gw:group-has-checked:bg-indigo-600" }),
42
+ /* @__PURE__ */ e("span", { className: "gw:absolute gw:left-0 gw:size-5 gw:rounded-full gw:border gw:border-gray-300 gw:bg-white gw:shadow-xs gw:transition-transform gw:duration-200 gw:ease-in-out gw:group-has-checked:translate-x-5" }),
43
+ /* @__PURE__ */ e("input", {
44
+ name: "toggle-select",
45
+ type: "checkbox",
46
+ "aria-label": "toggle selected",
47
+ checked: n,
48
+ onChange: r,
49
+ className: "gw:absolute gw:inset-0 gw:appearance-none gw:focus:outline-hidden"
50
+ })
51
+ ]
52
+ });
53
+ }
54
+ function i({ selected: t, onSelect: i, row: a, toggle: o = !1 }) {
55
+ return /* @__PURE__ */ e("div", {
56
+ className: "gw:p-1 gw:flex gw:items-center",
57
+ children: e(o ? r : n, {
58
+ checked: t,
59
+ onChange: i,
60
+ row: a
61
+ })
62
+ });
63
+ }
64
+ //#endregion
65
+ export { i as default };
@@ -0,0 +1,89 @@
1
+ import { Loader as e } from "../display/loader.js";
2
+ import t from "./data-grid-row.js";
3
+ import n from "./data-grid-header.js";
4
+ import { useEffect as r, useLayoutEffect as i, useRef as a, useState as o } from "react";
5
+ import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
6
+ //#region lib/components/data-grid/data-grid.jsx
7
+ function u(e, { box: t = "content-box" } = {}) {
8
+ let [n, i] = o({
9
+ width: 0,
10
+ height: 0
11
+ }), s = a(null);
12
+ return r(() => {
13
+ if (!e.current) return;
14
+ let n = new ResizeObserver(([n]) => {
15
+ let r = n.contentRect, a = n.borderBoxSize?.[0], o = n.contentBoxSize?.[0], c = t === "border-box" ? a?.inlineSize ?? e.current.offsetWidth : o?.inlineSize ?? r.width, l = t === "border-box" ? a?.blockSize ?? e.current.offsetHeight : o?.blockSize ?? r.height;
16
+ s.current && cancelAnimationFrame(s.current), s.current = requestAnimationFrame(() => i({
17
+ width: c,
18
+ height: l
19
+ }));
20
+ });
21
+ return n.observe(e.current, { box: t }), () => {
22
+ s.current && cancelAnimationFrame(s.current), n.disconnect();
23
+ };
24
+ }, [e, t]), n;
25
+ }
26
+ function d({ columns: e, parentWidth: t, enableSelect: n, enableToggle: r }) {
27
+ let i = 0, a = 0;
28
+ n && (a += 32), r && (a += 48), e.forEach((e) => {
29
+ if (e?.width && e?.flex) throw Error("A column cannot have both width and flex attributes");
30
+ a += e?.width || 0, i += e?.flex || 0;
31
+ });
32
+ let o = t - a, s = Math.floor(o / i), c = t - a - i * s, l = e.map((e) => e.width || e.flex * s);
33
+ return l[l.length - 1] = l[l.length - 1] + c, l;
34
+ }
35
+ function f({ data: r, columns: f, sortedBy: p = null, sortedDir: m = null, selectByField: h = "id", selectedIds: g = /* @__PURE__ */ new Set(), onSelect: _ = null, onSelectAll: v = null, onSort: y = null, showHeader: b = !0, enableSelect: x = !1, enableToggle: S = !1, isLoading: C = !1 }) {
36
+ let w = a(), { width: T } = u(w, { box: "border-box" }), [E, D] = o(null);
37
+ if (x && S) throw Error("Data-grid error: Cannot enable select and toggle at the same time.");
38
+ return i(() => {
39
+ T && D(d({
40
+ columns: f,
41
+ parentWidth: T,
42
+ enableSelect: x,
43
+ enableToggle: S
44
+ }));
45
+ }, [
46
+ T,
47
+ f,
48
+ x,
49
+ S
50
+ ]), /* @__PURE__ */ c("div", {
51
+ ref: w,
52
+ className: "gw:h-full gw:overflow-auto",
53
+ children: T && E ? /* @__PURE__ */ l(s, { children: [b ? /* @__PURE__ */ c(n, {
54
+ sortedBy: p,
55
+ sortedDir: m,
56
+ selected: r.length === g.size,
57
+ onSelectAll: v,
58
+ onSort: y,
59
+ columns: f,
60
+ columnWidths: E,
61
+ enableSelect: x,
62
+ enableToggle: S
63
+ }) : null, C ? /* @__PURE__ */ c(e, {}) : /* @__PURE__ */ c("div", {
64
+ className: "gw:h-full gw:flex gw:flex-col gw:overflow-y-scroll",
65
+ children: r.map((e, n) => {
66
+ let r = e?.id === void 0 ? n : e.id;
67
+ return /* @__PURE__ */ c(t, {
68
+ id: r,
69
+ selected: g.has(e[h]),
70
+ onSelect: (t) => {
71
+ _ && _({
72
+ id: e[h],
73
+ idx: n,
74
+ shiftKey: t.nativeEvent.shiftKey,
75
+ row: e
76
+ });
77
+ },
78
+ row: e,
79
+ columns: f,
80
+ columnWidths: E,
81
+ enableSelect: x,
82
+ enableToggle: S
83
+ }, r);
84
+ })
85
+ })] }) : null
86
+ });
87
+ }
88
+ //#endregion
89
+ export { f as DataGrid, f as default };
@@ -0,0 +1,24 @@
1
+ import e from "../../gw-merge.js";
2
+ import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
3
+ import { Disclosure as i, DisclosureButton as a, DisclosurePanel as o } from "@headlessui/react";
4
+ import { VscChevronDown as s, VscChevronRight as c } from "react-icons/vsc";
5
+ //#region lib/components/display/accordion.jsx
6
+ function l({ heading: l, defaultOpen: u = !1, unmountOnClose: d = !1, className: f, isOpen: p, onToggle: m, children: h, ...g }) {
7
+ return /* @__PURE__ */ n(i, {
8
+ defaultOpen: u,
9
+ children: ({ open: i }) => /* @__PURE__ */ r(t, { children: [/* @__PURE__ */ r(a, {
10
+ "aria-expanded": p ?? i,
11
+ "aria-controls": "accordion-panel",
12
+ onClick: m,
13
+ className: e("gw:flex gw:justify-between gw:items-center gw:w-full gw:shadow gw:px-3 gw:py-2 gw:text-sm gw:font-semibold gw:text-gray-500 gw:bg-gray-50 gw:hover:bg-gray-100", i ? "gw:rounded-t" : "gw:rounded", f),
14
+ ...g,
15
+ children: [l, n(i ? s : c, {})]
16
+ }), /* @__PURE__ */ n(o, {
17
+ className: "gw:shadow",
18
+ unmount: d,
19
+ children: h
20
+ })] })
21
+ });
22
+ }
23
+ //#endregion
24
+ export { l as Accordion, l as default };
@@ -0,0 +1,56 @@
1
+ import e from "../../gw-merge.js";
2
+ import t from "../navigation/link.js";
3
+ import { TouchTarget as n } from "../button.js";
4
+ import r, { useMemo as i } from "react";
5
+ import { jsx as a } from "react/jsx-runtime";
6
+ import { Button as o } from "@headlessui/react";
7
+ //#region lib/components/display/badge.jsx
8
+ var s = {
9
+ red: "gw:bg-red-500/15 gw:text-red-700 gw:group-data-hover:bg-red-500/25 gw:dark:bg-red-500/10 gw:dark:text-red-400 gw:dark:group-data-hover:bg-red-500/20",
10
+ orange: "gw:bg-orange-500/15 gw:text-orange-700 gw:group-data-hover:bg-orange-500/25 gw:dark:bg-orange-500/10 gw:dark:text-orange-400 gw:dark:group-data-hover:bg-orange-500/20",
11
+ amber: "gw:bg-amber-400/20 gw:text-amber-700 gw:group-data-hover:bg-amber-400/30 gw:dark:bg-amber-400/10 gw:dark:text-amber-400 gw:dark:group-data-hover:bg-amber-400/15",
12
+ yellow: "gw:bg-yellow-400/20 gw:text-yellow-700 gw:group-data-hover:bg-yellow-400/30 gw:dark:bg-yellow-400/10 gw:dark:text-yellow-300 gw:dark:group-data-hover:bg-yellow-400/15",
13
+ lime: "gw:bg-lime-400/20 gw:text-lime-700 gw:group-data-hover:bg-lime-400/30 gw:dark:bg-lime-400/10 gw:dark:text-lime-300 gw:dark:group-data-hover:bg-lime-400/15",
14
+ green: "gw:bg-green-500/15 gw:text-green-700 gw:group-data-hover:bg-green-500/25 gw:dark:bg-green-500/10 gw:dark:text-green-400 gw:dark:group-data-hover:bg-green-500/20",
15
+ emerald: "gw:bg-emerald-500/15 gw:text-emerald-700 gw:group-data-hover:bg-emerald-500/25 gw:dark:bg-emerald-500/10 gw:dark:text-emerald-400 gw:dark:group-data-hover:bg-emerald-500/20",
16
+ teal: "gw:bg-teal-500/15 gw:text-teal-700 gw:group-data-hover:bg-teal-500/25 gw:dark:bg-teal-500/10 gw:dark:text-teal-300 gw:dark:group-data-hover:bg-teal-500/20",
17
+ cyan: "gw:bg-cyan-400/20 gw:text-cyan-700 gw:group-data-hover:bg-cyan-400/30 gw:dark:bg-cyan-400/10 gw:dark:text-cyan-300 gw:dark:group-data-hover:bg-cyan-400/15",
18
+ sky: "gw:bg-sky-500/15 gw:text-sky-700 gw:group-data-hover:bg-sky-500/25 gw:dark:bg-sky-500/10 gw:dark:text-sky-300 gw:dark:group-data-hover:bg-sky-500/20",
19
+ blue: "gw:bg-blue-500/15 gw:text-blue-700 gw:group-data-hover:bg-blue-500/25 gw:dark:text-blue-400 gw:dark:group-data-hover:bg-blue-500/25",
20
+ indigo: "gw:bg-indigo-500/15 gw:text-indigo-700 gw:group-data-hover:bg-indigo-500/25 gw:dark:text-indigo-400 gw:dark:group-data-hover:bg-indigo-500/20",
21
+ violet: "gw:bg-violet-500/15 gw:text-violet-700 gw:group-data-hover:bg-violet-500/25 gw:dark:text-violet-400 gw:dark:group-data-hover:bg-violet-500/20",
22
+ purple: "gw:bg-purple-500/15 gw:text-purple-700 gw:group-data-hover:bg-purple-500/25 gw:dark:text-purple-400 gw:dark:group-data-hover:bg-purple-500/20",
23
+ fuchsia: "gw:bg-fuchsia-400/15 gw:text-fuchsia-700 gw:group-data-hover:bg-fuchsia-400/25 gw:dark:bg-fuchsia-400/10 gw:dark:text-fuchsia-400 gw:dark:group-data-hover:bg-fuchsia-400/20",
24
+ pink: "gw:bg-pink-400/15 gw:text-pink-700 gw:group-data-hover:bg-pink-400/25 gw:dark:bg-pink-400/10 gw:dark:text-pink-400 gw:dark:group-data-hover:bg-pink-400/20",
25
+ rose: "gw:bg-rose-400/15 gw:text-rose-700 gw:group-data-hover:bg-rose-400/25 gw:dark:bg-rose-400/10 gw:dark:text-rose-400 gw:dark:group-data-hover:bg-rose-400/20",
26
+ zinc: "gw:bg-zinc-600/10 gw:text-zinc-700 gw:group-data-hover:bg-zinc-600/20 gw:dark:bg-white/5 gw:dark:text-zinc-400 gw:dark:group-data-hover:bg-white/10"
27
+ };
28
+ function c({ color: t = "zinc", className: n, ...r }) {
29
+ let o = i(() => e("gw:inline-flex gw:items-center gw:gap-x-1.5 gw:rounded-md gw:px-1.5 gw:py-0.5 gw:text-sm/5 gw:font-medium gw:sm:text-xs/5 gw:forced-colors:outline", s[t], n), [n, t]);
30
+ return /* @__PURE__ */ a("span", {
31
+ ...r,
32
+ className: o
33
+ });
34
+ }
35
+ var l = r.forwardRef(function({ color: r = "zinc", className: s, children: l, ...u }, d) {
36
+ let f = i(() => e("gw:group gw:relative gw:inline-flex gw:rounded-md gw:focus:outline-hidden gw:data-focus:outline gw:data-focus:outline-2 gw:data-focus:outline-offset-2 gw:data-focus:outline-blue-500 gw:hover:cursor-pointer", s), [s]);
37
+ return "href" in u ? /* @__PURE__ */ a(t, {
38
+ ...u,
39
+ className: f,
40
+ ref: d,
41
+ children: /* @__PURE__ */ a(n, { children: /* @__PURE__ */ a(c, {
42
+ color: r,
43
+ children: l
44
+ }) })
45
+ }) : /* @__PURE__ */ a(o, {
46
+ ...u,
47
+ className: f,
48
+ ref: d,
49
+ children: /* @__PURE__ */ a(n, { children: /* @__PURE__ */ a(c, {
50
+ color: r,
51
+ children: l
52
+ }) })
53
+ });
54
+ });
55
+ //#endregion
56
+ export { c as Badge, l as BadgeButton };
@@ -0,0 +1,13 @@
1
+ import e from "../../gw-merge.js";
2
+ import { useMemo as t } from "react";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ //#region lib/components/display/card.jsx
5
+ function r({ className: r, children: i, stretch: a = !1, ...o }) {
6
+ return /* @__PURE__ */ n("div", {
7
+ className: t(() => e("gw:w-full gw:p-3 gw:shadow gw:bg-white gw:rounded-md gw:border gw:border-gray-200", a ? "gw:self-stretch" : "", r), [r, a]),
8
+ ...o,
9
+ children: i
10
+ });
11
+ }
12
+ //#endregion
13
+ export { r as Card, r as default };
@@ -0,0 +1,25 @@
1
+ import e from "../../gw-merge.js";
2
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ //#region lib/components/display/divider.jsx
4
+ function r({ text: r, className: i = null, ...a }) {
5
+ return /* @__PURE__ */ t("div", {
6
+ className: e("gw:py-3", i),
7
+ ...a,
8
+ children: /* @__PURE__ */ n("div", {
9
+ className: "gw:relative",
10
+ children: [/* @__PURE__ */ t("div", {
11
+ "aria-hidden": "true",
12
+ className: "gw:absolute gw:inset-0 gw:flex gw:items-center",
13
+ children: /* @__PURE__ */ t("div", { className: "gw:w-full gw:border-t gw:border-gray-300" })
14
+ }), /* @__PURE__ */ t("div", {
15
+ className: "gw:relative gw:flex gw:justify-center",
16
+ children: /* @__PURE__ */ t("span", {
17
+ className: "gw:bg-white gw:px-3 gw:text-base gw:font-semibold gw:leading-6 gw:text-gray-900",
18
+ children: r
19
+ })
20
+ })]
21
+ })
22
+ });
23
+ }
24
+ //#endregion
25
+ export { r as Divider, r as default };
@@ -0,0 +1,34 @@
1
+ import e from "../../gw-merge.js";
2
+ import { useMemo as t } from "react";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ //#region lib/components/display/headings.jsx
5
+ function r({ className: r, children: i, ...a }) {
6
+ return /* @__PURE__ */ n("h1", {
7
+ className: t(() => e("gw:text-3xl gw:font-bold", r), [r]),
8
+ ...a,
9
+ children: i
10
+ });
11
+ }
12
+ function i({ className: r, children: i, ...a }) {
13
+ return /* @__PURE__ */ n("h2", {
14
+ className: t(() => e("gw:text-2xl gw:font-bold", r), [r]),
15
+ ...a,
16
+ children: i
17
+ });
18
+ }
19
+ function a({ className: r, children: i, ...a }) {
20
+ return /* @__PURE__ */ n("h3", {
21
+ className: t(() => e("gw:text-xl gw:font-bold", r), [r]),
22
+ ...a,
23
+ children: i
24
+ });
25
+ }
26
+ function o({ className: r, children: i, ...a }) {
27
+ return /* @__PURE__ */ n("h4", {
28
+ className: t(() => e("gw:text-lg gw:font-bold", r), [r]),
29
+ ...a,
30
+ children: i
31
+ });
32
+ }
33
+ //#endregion
34
+ export { r as H1, i as H2, a as H3, o as H4 };