@usace/groundwork 1.0.2 → 1.0.4

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 (79) hide show
  1. package/dist/groundwork.es.js +5131 -0
  2. package/dist/groundwork.umd.js +30 -0
  3. package/dist/style.css +1 -0
  4. package/package.json +11 -3
  5. package/.eslintrc.cjs +0 -18
  6. package/.github/workflows/deploy-docs.yml +0 -59
  7. package/.github/workflows/publish.yml +0 -19
  8. package/index.html +0 -13
  9. package/lib/catalyst/alert.jsx +0 -110
  10. package/lib/catalyst/avatar.jsx +0 -64
  11. package/lib/catalyst/badge.jsx +0 -72
  12. package/lib/catalyst/checkbox.jsx +0 -160
  13. package/lib/catalyst/dialog.jsx +0 -101
  14. package/lib/catalyst/dropdown.jsx +0 -202
  15. package/lib/catalyst/fieldset.jsx +0 -87
  16. package/lib/catalyst/input.jsx +0 -78
  17. package/lib/catalyst/listbox.jsx +0 -195
  18. package/lib/catalyst/pagination.jsx +0 -75
  19. package/lib/catalyst/radio.jsx +0 -144
  20. package/lib/catalyst/select.jsx +0 -78
  21. package/lib/catalyst/switch.jsx +0 -203
  22. package/lib/catalyst/textarea.jsx +0 -59
  23. package/lib/components/breadcrumbs.jsx +0 -46
  24. package/lib/components/button.jsx +0 -219
  25. package/lib/components/display/headings.jsx +0 -39
  26. package/lib/components/display/text.jsx +0 -48
  27. package/lib/components/hero.jsx +0 -51
  28. package/lib/components/layout/container.jsx +0 -13
  29. package/lib/components/layout/usace-box.jsx +0 -26
  30. package/lib/components/link.jsx +0 -18
  31. package/lib/components/table.jsx +0 -146
  32. package/lib/composite/footer/essayons.jsx +0 -12
  33. package/lib/composite/footer/footer-links.jsx +0 -33
  34. package/lib/composite/footer/index.jsx +0 -148
  35. package/lib/composite/footer/logo-banner.jsx +0 -55
  36. package/lib/composite/footer/social-links.jsx +0 -60
  37. package/lib/composite/header/index.jsx +0 -83
  38. package/lib/composite/header/navbar-links.jsx +0 -113
  39. package/lib/composite/header/usa-banner/USABanner.jsx +0 -114
  40. package/lib/composite/header/usa-banner/usa-banner.css +0 -220
  41. package/lib/composite/site-wrapper/index.jsx +0 -52
  42. package/lib/index.jsx +0 -19
  43. package/postcss.config.js +0 -6
  44. package/public/Magnifying_glass_icon.svg +0 -5
  45. package/public/armystar-logo-rb.svg +0 -4
  46. package/public/cwbi-logo.png +0 -0
  47. package/public/essayonscrest.png +0 -0
  48. package/public/icon-dot-gov.svg +0 -1
  49. package/public/icon-https.svg +0 -1
  50. package/public/nww-lucky-peak-dam.jpg +0 -0
  51. package/public/rsgis-logo.png +0 -0
  52. package/public/us_flag_small.png +0 -0
  53. package/public/usace-logo-color.svg +0 -1
  54. package/src/App.jsx +0 -38
  55. package/src/app-bundles/index.js +0 -4
  56. package/src/app-bundles/route-bundle.js +0 -36
  57. package/src/app-components/code-example.jsx +0 -17
  58. package/src/app-components/copy-button.jsx +0 -32
  59. package/src/app-components/props-table.jsx +0 -43
  60. package/src/app-components/sub-site-banner.jsx +0 -15
  61. package/src/app-pages/documentation/_docs-page.jsx +0 -31
  62. package/src/app-pages/documentation/_docs-sidebar.jsx +0 -111
  63. package/src/app-pages/documentation/_template.jsx +0 -55
  64. package/src/app-pages/documentation/app-shell/index.jsx +0 -39
  65. package/src/app-pages/documentation/app-shell/site-wrapper.jsx +0 -190
  66. package/src/app-pages/documentation/buttons/index.jsx +0 -170
  67. package/src/app-pages/documentation/index.jsx +0 -57
  68. package/src/app-pages/documentation/layout/container.jsx +0 -68
  69. package/src/app-pages/documentation/layout/index.jsx +0 -52
  70. package/src/app-pages/documentation/layout/usace-box.jsx +0 -76
  71. package/src/app-pages/documentation/navigation/breadcrumbs.jsx +0 -119
  72. package/src/app-pages/documentation/navigation/index.jsx +0 -31
  73. package/src/app-pages/documentation/types/index.jsx +0 -31
  74. package/src/app-pages/documentation/types/link.jsx +0 -72
  75. package/src/app-pages/home.jsx +0 -71
  76. package/src/index.css +0 -3
  77. package/src/main.jsx +0 -18
  78. package/tailwind.config.js +0 -31
  79. package/vite.config.js +0 -46
@@ -1,203 +0,0 @@
1
- import { Field as HeadlessField, Switch as HeadlessSwitch } from '@headlessui/react'
2
- import { clsx } from 'clsx'
3
-
4
- export function SwitchGroup({ className, ...props }) {
5
- return (
6
- <div
7
- data-slot="control"
8
- {...props}
9
- className={clsx(
10
- className,
11
-
12
- // Basic groups
13
- 'space-y-3 [&_[data-slot=label]]:font-normal',
14
-
15
- // With descriptions
16
- 'has-[[data-slot=description]]:space-y-6 [&_[data-slot=label]]:has-[[data-slot=description]]:font-medium'
17
- )}
18
- />
19
- )
20
- }
21
-
22
- export function SwitchField({ className, ...props }) {
23
- return (
24
- <HeadlessField
25
- data-slot="field"
26
- {...props}
27
- className={clsx(
28
- className,
29
-
30
- // Base layout
31
- 'grid grid-cols-[1fr_auto] items-center gap-x-8 gap-y-1 sm:grid-cols-[1fr_auto]',
32
-
33
- // Control layout
34
- '[&>[data-slot=control]]:col-start-2 [&>[data-slot=control]]:self-center',
35
-
36
- // Label layout
37
- '[&>[data-slot=label]]:col-start-1 [&>[data-slot=label]]:row-start-1 [&>[data-slot=label]]:justify-self-start',
38
-
39
- // Description layout
40
- '[&>[data-slot=description]]:col-start-1 [&>[data-slot=description]]:row-start-2',
41
-
42
- // With description
43
- '[&_[data-slot=label]]:has-[[data-slot=description]]:font-medium'
44
- )}
45
- />
46
- )
47
- }
48
-
49
- const colors = {
50
- 'dark/zinc': [
51
- '[--switch-bg-ring:theme(colors.zinc.950/90%)] [--switch-bg:theme(colors.zinc.900)] dark:[--switch-bg-ring:transparent] dark:[--switch-bg:theme(colors.white/25%)]',
52
- '[--switch-ring:theme(colors.zinc.950/90%)] [--switch-shadow:theme(colors.black/10%)] [--switch:white] dark:[--switch-ring:theme(colors.zinc.700/90%)]',
53
- ],
54
- 'dark/white': [
55
- '[--switch-bg-ring:theme(colors.zinc.950/90%)] [--switch-bg:theme(colors.zinc.900)] dark:[--switch-bg-ring:transparent] dark:[--switch-bg:theme(colors.white)]',
56
- '[--switch-ring:theme(colors.zinc.950/90%)] [--switch-shadow:theme(colors.black/10%)] [--switch:white] dark:[--switch-ring:transparent] dark:[--switch:theme(colors.zinc.900)]',
57
- ],
58
- dark: [
59
- '[--switch-bg-ring:theme(colors.zinc.950/90%)] [--switch-bg:theme(colors.zinc.900)] dark:[--switch-bg-ring:theme(colors.white/15%)]',
60
- '[--switch-ring:theme(colors.zinc.950/90%)] [--switch-shadow:theme(colors.black/10%)] [--switch:white]',
61
- ],
62
- zinc: [
63
- '[--switch-bg-ring:theme(colors.zinc.700/90%)] [--switch-bg:theme(colors.zinc.600)] dark:[--switch-bg-ring:transparent]',
64
- '[--switch-shadow:theme(colors.black/10%)] [--switch:white] [--switch-ring:theme(colors.zinc.700/90%)]',
65
- ],
66
- white: [
67
- '[--switch-bg-ring:theme(colors.black/15%)] [--switch-bg:white] dark:[--switch-bg-ring:transparent]',
68
- '[--switch-shadow:theme(colors.black/10%)] [--switch-ring:transparent] [--switch:theme(colors.zinc.950)]',
69
- ],
70
- red: [
71
- '[--switch-bg-ring:theme(colors.red.700/90%)] [--switch-bg:theme(colors.red.600)] dark:[--switch-bg-ring:transparent]',
72
- '[--switch:white] [--switch-ring:theme(colors.red.700/90%)] [--switch-shadow:theme(colors.red.900/20%)]',
73
- ],
74
- orange: [
75
- '[--switch-bg-ring:theme(colors.orange.600/90%)] [--switch-bg:theme(colors.orange.500)] dark:[--switch-bg-ring:transparent]',
76
- '[--switch:white] [--switch-ring:theme(colors.orange.600/90%)] [--switch-shadow:theme(colors.orange.900/20%)]',
77
- ],
78
- amber: [
79
- '[--switch-bg-ring:theme(colors.amber.500/80%)] [--switch-bg:theme(colors.amber.400)] dark:[--switch-bg-ring:transparent]',
80
- '[--switch-ring:transparent] [--switch-shadow:transparent] [--switch:theme(colors.amber.950)]',
81
- ],
82
- yellow: [
83
- '[--switch-bg-ring:theme(colors.yellow.400/80%)] [--switch-bg:theme(colors.yellow.300)] dark:[--switch-bg-ring:transparent]',
84
- '[--switch-ring:transparent] [--switch-shadow:transparent] [--switch:theme(colors.yellow.950)]',
85
- ],
86
- lime: [
87
- '[--switch-bg-ring:theme(colors.lime.400/80%)] [--switch-bg:theme(colors.lime.300)] dark:[--switch-bg-ring:transparent]',
88
- '[--switch-ring:transparent] [--switch-shadow:transparent] [--switch:theme(colors.lime.950)]',
89
- ],
90
- green: [
91
- '[--switch-bg-ring:theme(colors.green.700/90%)] [--switch-bg:theme(colors.green.600)] dark:[--switch-bg-ring:transparent]',
92
- '[--switch:white] [--switch-ring:theme(colors.green.700/90%)] [--switch-shadow:theme(colors.green.900/20%)]',
93
- ],
94
- emerald: [
95
- '[--switch-bg-ring:theme(colors.emerald.600/90%)] [--switch-bg:theme(colors.emerald.500)] dark:[--switch-bg-ring:transparent]',
96
- '[--switch:white] [--switch-ring:theme(colors.emerald.600/90%)] [--switch-shadow:theme(colors.emerald.900/20%)]',
97
- ],
98
- teal: [
99
- '[--switch-bg-ring:theme(colors.teal.700/90%)] [--switch-bg:theme(colors.teal.600)] dark:[--switch-bg-ring:transparent]',
100
- '[--switch:white] [--switch-ring:theme(colors.teal.700/90%)] [--switch-shadow:theme(colors.teal.900/20%)]',
101
- ],
102
- cyan: [
103
- '[--switch-bg-ring:theme(colors.cyan.400/80%)] [--switch-bg:theme(colors.cyan.300)] dark:[--switch-bg-ring:transparent]',
104
- '[--switch-ring:transparent] [--switch-shadow:transparent] [--switch:theme(colors.cyan.950)]',
105
- ],
106
- sky: [
107
- '[--switch-bg-ring:theme(colors.sky.600/80%)] [--switch-bg:theme(colors.sky.500)] dark:[--switch-bg-ring:transparent]',
108
- '[--switch:white] [--switch-ring:theme(colors.sky.600/80%)] [--switch-shadow:theme(colors.sky.900/20%)]',
109
- ],
110
- blue: [
111
- '[--switch-bg-ring:theme(colors.blue.700/90%)] [--switch-bg:theme(colors.blue.600)] dark:[--switch-bg-ring:transparent]',
112
- '[--switch:white] [--switch-ring:theme(colors.blue.700/90%)] [--switch-shadow:theme(colors.blue.900/20%)]',
113
- ],
114
- indigo: [
115
- '[--switch-bg-ring:theme(colors.indigo.600/90%)] [--switch-bg:theme(colors.indigo.500)] dark:[--switch-bg-ring:transparent]',
116
- '[--switch:white] [--switch-ring:theme(colors.indigo.600/90%)] [--switch-shadow:theme(colors.indigo.900/20%)]',
117
- ],
118
- violet: [
119
- '[--switch-bg-ring:theme(colors.violet.600/90%)] [--switch-bg:theme(colors.violet.500)] dark:[--switch-bg-ring:transparent]',
120
- '[--switch:white] [--switch-ring:theme(colors.violet.600/90%)] [--switch-shadow:theme(colors.violet.900/20%)]',
121
- ],
122
- purple: [
123
- '[--switch-bg-ring:theme(colors.purple.600/90%)] [--switch-bg:theme(colors.purple.500)] dark:[--switch-bg-ring:transparent]',
124
- '[--switch:white] [--switch-ring:theme(colors.purple.600/90%)] [--switch-shadow:theme(colors.purple.900/20%)]',
125
- ],
126
- fuchsia: [
127
- '[--switch-bg-ring:theme(colors.fuchsia.600/90%)] [--switch-bg:theme(colors.fuchsia.500)] dark:[--switch-bg-ring:transparent]',
128
- '[--switch:white] [--switch-ring:theme(colors.fuchsia.600/90%)] [--switch-shadow:theme(colors.fuchsia.900/20%)]',
129
- ],
130
- pink: [
131
- '[--switch-bg-ring:theme(colors.pink.600/90%)] [--switch-bg:theme(colors.pink.500)] dark:[--switch-bg-ring:transparent]',
132
- '[--switch:white] [--switch-ring:theme(colors.pink.600/90%)] [--switch-shadow:theme(colors.pink.900/20%)]',
133
- ],
134
- rose: [
135
- '[--switch-bg-ring:theme(colors.rose.600/90%)] [--switch-bg:theme(colors.rose.500)] dark:[--switch-bg-ring:transparent]',
136
- '[--switch:white] [--switch-ring:theme(colors.rose.600/90%)] [--switch-shadow:theme(colors.rose.900/20%)]',
137
- ],
138
- }
139
-
140
- export function Switch({ color = 'dark/zinc', className, children, ...props }) {
141
- return (
142
- <HeadlessSwitch
143
- data-slot="control"
144
- className={clsx(
145
- className,
146
-
147
- // Base styles
148
- 'group relative isolate inline-flex h-6 w-10 cursor-default rounded-full p-[3px] sm:h-5 sm:w-8',
149
-
150
- // Transitions
151
- 'transition duration-0 ease-in-out data-[changing]:duration-200',
152
-
153
- // Outline and background color in forced-colors mode so switch is still visible
154
- 'forced-colors:outline forced-colors:[--switch-bg:Highlight] dark:forced-colors:[--switch-bg:Highlight]',
155
-
156
- // Unchecked
157
- 'bg-zinc-200 ring-1 ring-inset ring-black/5 dark:bg-white/5 dark:ring-white/15',
158
-
159
- // Checked
160
- 'data-[checked]:bg-[--switch-bg] data-[checked]:ring-[--switch-bg-ring] dark:data-[checked]:bg-[--switch-bg] dark:data-[checked]:ring-[--switch-bg-ring]',
161
-
162
- // Focus
163
- 'focus:outline-none data-[focus]:outline data-[focus]:outline-2 data-[focus]:outline-offset-2 data-[focus]:outline-blue-500',
164
-
165
- // Hover
166
- 'data-[hover]:data-[checked]:ring-[--switch-bg-ring] data-[hover]:ring-black/15',
167
- 'dark:data-[hover]:data-[checked]:ring-[--switch-bg-ring] dark:data-[hover]:ring-white/25',
168
-
169
- // Disabled
170
- 'data-[disabled]:bg-zinc-200 data-[disabled]:data-[checked]:bg-zinc-200 data-[disabled]:opacity-50 data-[disabled]:data-[checked]:ring-black/5',
171
- 'dark:data-[disabled]:bg-white/15 dark:data-[disabled]:data-[checked]:bg-white/15 dark:data-[disabled]:data-[checked]:ring-white/15',
172
-
173
- // Color specific styles
174
- colors[color]
175
- )}
176
- {...props}
177
- >
178
- <span
179
- aria-hidden="true"
180
- className={clsx(
181
- // Basic layout
182
- 'pointer-events-none relative inline-block size-[1.125rem] rounded-full sm:size-3.5',
183
-
184
- // Transition
185
- 'translate-x-0 transition duration-200 ease-in-out',
186
-
187
- // Invisible border so the switch is still visible in forced-colors mode
188
- 'border border-transparent',
189
-
190
- // Unchecked
191
- 'bg-white shadow ring-1 ring-black/5',
192
-
193
- // Checked
194
- 'group-data-[checked]:bg-[--switch] group-data-[checked]:shadow-[--switch-shadow] group-data-[checked]:ring-[--switch-ring]',
195
- 'group-data-[checked]:translate-x-4 sm:group-data-[checked]:translate-x-3',
196
-
197
- // Disabled
198
- 'group-data-[disabled]:group-data-[checked]:bg-white group-data-[disabled]:group-data-[checked]:shadow group-data-[disabled]:group-data-[checked]:ring-black/5'
199
- )}
200
- />
201
- </HeadlessSwitch>
202
- )
203
- }
@@ -1,59 +0,0 @@
1
- import { Textarea as HeadlessTextarea } from '@headlessui/react'
2
- import { clsx } from 'clsx'
3
- import { forwardRef } from 'react'
4
-
5
- export const Textarea = forwardRef(function Textarea({ className, resizable = true, ...props }, ref) {
6
- return (
7
- <span
8
- data-slot="control"
9
- className={clsx([
10
- className,
11
-
12
- // Basic layout
13
- 'relative block w-full',
14
-
15
- // Background color + shadow applied to inset pseudo element, so shadow blends with border in light mode
16
- 'before:absolute before:inset-px before:rounded-[calc(theme(borderRadius.lg)-1px)] before:bg-white before:shadow',
17
-
18
- // Background color is moved to control and shadow is removed in dark mode so hide `before` pseudo
19
- 'dark:before:hidden',
20
-
21
- // Focus ring
22
- 'after:pointer-events-none after:absolute after:inset-0 after:rounded-lg after:ring-inset after:ring-transparent sm:after:focus-within:ring-2 sm:after:focus-within:ring-blue-500',
23
-
24
- // Disabled state
25
- 'has-[[data-disabled]]:opacity-50 before:has-[[data-disabled]]:bg-zinc-950/5 before:has-[[data-disabled]]:shadow-none',
26
- ])}
27
- >
28
- <HeadlessTextarea
29
- ref={ref}
30
- className={clsx([
31
- // Basic layout
32
- 'relative block h-full w-full appearance-none rounded-lg px-[calc(theme(spacing[3.5])-1px)] py-[calc(theme(spacing[2.5])-1px)] sm:px-[calc(theme(spacing.3)-1px)] sm:py-[calc(theme(spacing[1.5])-1px)]',
33
-
34
- // Typography
35
- 'text-base/6 text-zinc-950 placeholder:text-zinc-500 sm:text-sm/6 dark:text-white',
36
-
37
- // Border
38
- 'border border-zinc-950/10 data-[hover]:border-zinc-950/20 dark:border-white/10 dark:data-[hover]:border-white/20',
39
-
40
- // Background color
41
- 'bg-transparent dark:bg-white/5',
42
-
43
- // Hide default focus styles
44
- 'focus:outline-none',
45
-
46
- // Invalid state
47
- 'data-[invalid]:border-red-500 data-[invalid]:data-[hover]:border-red-500 data-[invalid]:dark:border-red-600 data-[invalid]:data-[hover]:dark:border-red-600',
48
-
49
- // Disabled state
50
- 'disabled:border-zinc-950/20 disabled:dark:border-white/15 disabled:dark:bg-white/[2.5%] dark:data-[hover]:disabled:border-white/15',
51
-
52
- // Resizable
53
- resizable ? 'resize-y' : 'resize-none',
54
- ])}
55
- {...props}
56
- />
57
- </span>
58
- )
59
- })
@@ -1,46 +0,0 @@
1
- import clsx from "clsx";
2
- import { MdHome } from "react-icons/md";
3
- import { VscChevronRight } from "react-icons/vsc";
4
-
5
- function BreadcrumbItem({ className, href, text }) {
6
- const cls = clsx(
7
- "text-gray-300 hover:text-gray-500 last:text-gray-900",
8
- className
9
- );
10
- return (
11
- <li className={cls}>
12
- <div className="flex items-center">
13
- <VscChevronRight
14
- size={18}
15
- aria-hidden="true"
16
- color="rgb(156 163 175)"
17
- />
18
- <a href={href} className="ml-2 hover:underline">
19
- {text}
20
- </a>
21
- </div>
22
- </li>
23
- );
24
- }
25
-
26
- function Breadcrumbs({ className, children }) {
27
- const cls = clsx("flex items-center justify-between py-4", className);
28
- return (
29
- <nav className={cls}>
30
- <ol className="flex items-center space-x-2">
31
- <li>
32
- <div>
33
- <a href="/" className="text-gray-300 hover:text-gray-500">
34
- <MdHome size={22} />
35
- <span className="sr-only">Home</span>
36
- </a>
37
- </div>
38
- </li>
39
- {children}
40
- </ol>
41
- </nav>
42
- );
43
- }
44
-
45
- export default Breadcrumbs;
46
- export { Breadcrumbs, BreadcrumbItem };
@@ -1,219 +0,0 @@
1
- import { Button as HeadlessButton } from "@headlessui/react";
2
- import { clsx } from "clsx";
3
- import React from "react";
4
- import { Link } from "./link";
5
-
6
- const styles = {
7
- base: [
8
- // Base
9
- "relative isolate inline-flex items-center justify-center gap-x-2 rounded-lg border text-base/6 font-semibold",
10
-
11
- // Sizing
12
- "px-[calc(theme(spacing[3.5])-1px)] py-[calc(theme(spacing[2.5])-1px)] sm:px-[calc(theme(spacing.3)-1px)] sm:py-[calc(theme(spacing[1.5])-1px)] sm:text-sm/6",
13
-
14
- // Focus
15
- "focus:outline-none data-[focus]:outline data-[focus]:outline-2 data-[focus]:outline-offset-2 data-[focus]:outline-blue-500",
16
-
17
- // Disabled
18
- "data-[disabled]:opacity-50",
19
-
20
- // Icon
21
- "[&>[data-slot=icon]]:-mx-0.5 [&>[data-slot=icon]]:my-0.5 [&>[data-slot=icon]]:size-5 [&>[data-slot=icon]]:shrink-0 [&>[data-slot=icon]]:text-[--btn-icon] [&>[data-slot=icon]]:sm:my-1 [&>[data-slot=icon]]:sm:size-4 forced-colors:[--btn-icon:ButtonText] forced-colors:data-[hover]:[--btn-icon:ButtonText]",
22
- ],
23
- solid: [
24
- // Optical border, implemented as the button background to avoid corner artifacts
25
- "border-transparent bg-[--btn-border]",
26
-
27
- // Dark mode: border is rendered on `after` so background is set to button background
28
- "dark:bg-[--btn-bg]",
29
-
30
- // Button background, implemented as foreground layer to stack on top of pseudo-border layer
31
- "before:absolute before:inset-0 before:-z-10 before:rounded-[calc(theme(borderRadius.lg)-1px)] before:bg-[--btn-bg]",
32
-
33
- // Drop shadow, applied to the inset `before` layer so it blends with the border
34
- "before:shadow",
35
-
36
- // Background color is moved to control and shadow is removed in dark mode so hide `before` pseudo
37
- "dark:before:hidden",
38
-
39
- // Dark mode: Subtle white outline is applied using a border
40
- "dark:border-white/5",
41
-
42
- // Shim/overlay, inset to match button foreground and used for hover state + highlight shadow
43
- "after:absolute after:inset-0 after:-z-10 after:rounded-[calc(theme(borderRadius.lg)-1px)]",
44
-
45
- // Inner highlight shadow
46
- "after:shadow-[shadow:inset_0_1px_theme(colors.white/15%)]",
47
-
48
- // White overlay on hover
49
- "after:data-[active]:bg-[--btn-hover-overlay] after:data-[hover]:bg-[--btn-hover-overlay]",
50
-
51
- // Dark mode: `after` layer expands to cover entire button
52
- "dark:after:-inset-px dark:after:rounded-lg",
53
-
54
- // Disabled
55
- "before:data-[disabled]:shadow-none after:data-[disabled]:shadow-none",
56
- ],
57
- outline: [
58
- // Base
59
- "border-zinc-950/10 text-zinc-950 data-[active]:bg-zinc-950/[2.5%] data-[hover]:bg-zinc-950/[2.5%]",
60
-
61
- // Dark mode
62
- "dark:border-white/15 dark:text-white dark:[--btn-bg:transparent] dark:data-[active]:bg-white/5 dark:data-[hover]:bg-white/5",
63
-
64
- // Icon
65
- "[--btn-icon:theme(colors.zinc.500)] data-[active]:[--btn-icon:theme(colors.zinc.700)] data-[hover]:[--btn-icon:theme(colors.zinc.700)] dark:data-[active]:[--btn-icon:theme(colors.zinc.400)] dark:data-[hover]:[--btn-icon:theme(colors.zinc.400)]",
66
- ],
67
- plain: [
68
- // Base
69
- "border-transparent text-zinc-950 data-[active]:bg-zinc-950/5 data-[hover]:bg-zinc-950/5",
70
-
71
- // Dark mode
72
- "dark:text-white dark:data-[active]:bg-white/10 dark:data-[hover]:bg-white/10",
73
-
74
- // Icon
75
- "[--btn-icon:theme(colors.zinc.500)] data-[active]:[--btn-icon:theme(colors.zinc.700)] data-[hover]:[--btn-icon:theme(colors.zinc.700)] dark:[--btn-icon:theme(colors.zinc.500)] dark:data-[active]:[--btn-icon:theme(colors.zinc.400)] dark:data-[hover]:[--btn-icon:theme(colors.zinc.400)]",
76
- ],
77
- colors: {
78
- "dark/zinc": [
79
- "text-white [--btn-bg:theme(colors.zinc.900)] [--btn-border:theme(colors.zinc.950/90%)] [--btn-hover-overlay:theme(colors.white/10%)]",
80
- "dark:text-white dark:[--btn-bg:theme(colors.zinc.600)] dark:[--btn-hover-overlay:theme(colors.white/5%)]",
81
- "[--btn-icon:theme(colors.zinc.400)] data-[active]:[--btn-icon:theme(colors.zinc.300)] data-[hover]:[--btn-icon:theme(colors.zinc.300)]",
82
- ],
83
- light: [
84
- "text-zinc-950 [--btn-bg:white] [--btn-border:theme(colors.zinc.950/10%)] [--btn-hover-overlay:theme(colors.zinc.950/2.5%)] data-[active]:[--btn-border:theme(colors.zinc.950/15%)] data-[hover]:[--btn-border:theme(colors.zinc.950/15%)]",
85
- "dark:text-white dark:[--btn-hover-overlay:theme(colors.white/5%)] dark:[--btn-bg:theme(colors.zinc.800)]",
86
- "[--btn-icon:theme(colors.zinc.500)] data-[active]:[--btn-icon:theme(colors.zinc.700)] data-[hover]:[--btn-icon:theme(colors.zinc.700)] dark:[--btn-icon:theme(colors.zinc.500)] dark:data-[active]:[--btn-icon:theme(colors.zinc.400)] dark:data-[hover]:[--btn-icon:theme(colors.zinc.400)]",
87
- ],
88
- "dark/white": [
89
- "text-white [--btn-bg:theme(colors.zinc.900)] [--btn-border:theme(colors.zinc.950/90%)] [--btn-hover-overlay:theme(colors.white/10%)]",
90
- "dark:text-zinc-950 dark:[--btn-bg:white] dark:[--btn-hover-overlay:theme(colors.zinc.950/5%)]",
91
- "[--btn-icon:theme(colors.zinc.400)] data-[active]:[--btn-icon:theme(colors.zinc.300)] data-[hover]:[--btn-icon:theme(colors.zinc.300)] dark:[--btn-icon:theme(colors.zinc.500)] dark:data-[active]:[--btn-icon:theme(colors.zinc.400)] dark:data-[hover]:[--btn-icon:theme(colors.zinc.400)]",
92
- ],
93
- dark: [
94
- "text-white [--btn-bg:theme(colors.zinc.900)] [--btn-border:theme(colors.zinc.950/90%)] [--btn-hover-overlay:theme(colors.white/10%)]",
95
- "dark:[--btn-hover-overlay:theme(colors.white/5%)] dark:[--btn-bg:theme(colors.zinc.800)]",
96
- "[--btn-icon:theme(colors.zinc.400)] data-[active]:[--btn-icon:theme(colors.zinc.300)] data-[hover]:[--btn-icon:theme(colors.zinc.300)]",
97
- ],
98
- white: [
99
- "text-zinc-950 [--btn-bg:white] [--btn-border:theme(colors.zinc.950/10%)] [--btn-hover-overlay:theme(colors.zinc.950/2.5%)] data-[active]:[--btn-border:theme(colors.zinc.950/15%)] data-[hover]:[--btn-border:theme(colors.zinc.950/15%)]",
100
- "dark:[--btn-hover-overlay:theme(colors.zinc.950/5%)]",
101
- "[--btn-icon:theme(colors.zinc.400)] data-[active]:[--btn-icon:theme(colors.zinc.500)] data-[hover]:[--btn-icon:theme(colors.zinc.500)]",
102
- ],
103
- zinc: [
104
- "text-white [--btn-hover-overlay:theme(colors.white/10%)] [--btn-bg:theme(colors.zinc.600)] [--btn-border:theme(colors.zinc.700/90%)]",
105
- "dark:[--btn-hover-overlay:theme(colors.white/5%)]",
106
- "[--btn-icon:theme(colors.zinc.400)] data-[active]:[--btn-icon:theme(colors.zinc.300)] data-[hover]:[--btn-icon:theme(colors.zinc.300)]",
107
- ],
108
- indigo: [
109
- "text-white [--btn-hover-overlay:theme(colors.white/10%)] [--btn-bg:theme(colors.indigo.500)] [--btn-border:theme(colors.indigo.600/90%)]",
110
- "[--btn-icon:theme(colors.indigo.300)] data-[active]:[--btn-icon:theme(colors.indigo.200)] data-[hover]:[--btn-icon:theme(colors.indigo.200)]",
111
- ],
112
- cyan: [
113
- "text-cyan-950 [--btn-bg:theme(colors.cyan.300)] [--btn-border:theme(colors.cyan.400/80%)] [--btn-hover-overlay:theme(colors.white/25%)]",
114
- "[--btn-icon:theme(colors.cyan.500)]",
115
- ],
116
- red: [
117
- "text-white [--btn-hover-overlay:theme(colors.white/10%)] [--btn-bg:theme(colors.red.600)] [--btn-border:theme(colors.red.700/90%)]",
118
- "[--btn-icon:theme(colors.red.300)] data-[active]:[--btn-icon:theme(colors.red.200)] data-[hover]:[--btn-icon:theme(colors.red.200)]",
119
- ],
120
- orange: [
121
- "text-white [--btn-hover-overlay:theme(colors.white/10%)] [--btn-bg:theme(colors.orange.500)] [--btn-border:theme(colors.orange.600/90%)]",
122
- "[--btn-icon:theme(colors.orange.300)] data-[active]:[--btn-icon:theme(colors.orange.200)] data-[hover]:[--btn-icon:theme(colors.orange.200)]",
123
- ],
124
- amber: [
125
- "text-amber-950 [--btn-hover-overlay:theme(colors.white/25%)] [--btn-bg:theme(colors.amber.400)] [--btn-border:theme(colors.amber.500/80%)]",
126
- "[--btn-icon:theme(colors.amber.600)]",
127
- ],
128
- yellow: [
129
- "text-yellow-950 [--btn-hover-overlay:theme(colors.white/25%)] [--btn-bg:theme(colors.yellow.300)] [--btn-border:theme(colors.yellow.400/80%)]",
130
- "[--btn-icon:theme(colors.yellow.600)] data-[active]:[--btn-icon:theme(colors.yellow.700)] data-[hover]:[--btn-icon:theme(colors.yellow.700)]",
131
- ],
132
- lime: [
133
- "text-lime-950 [--btn-hover-overlay:theme(colors.white/25%)] [--btn-bg:theme(colors.lime.300)] [--btn-border:theme(colors.lime.400/80%)]",
134
- "[--btn-icon:theme(colors.lime.600)] data-[active]:[--btn-icon:theme(colors.lime.700)] data-[hover]:[--btn-icon:theme(colors.lime.700)]",
135
- ],
136
- green: [
137
- "text-white [--btn-hover-overlay:theme(colors.white/10%)] [--btn-bg:theme(colors.green.600)] [--btn-border:theme(colors.green.700/90%)]",
138
- "[--btn-icon:theme(colors.white/60%)] data-[active]:[--btn-icon:theme(colors.white/80%)] data-[hover]:[--btn-icon:theme(colors.white/80%)]",
139
- ],
140
- emerald: [
141
- "text-white [--btn-hover-overlay:theme(colors.white/10%)] [--btn-bg:theme(colors.emerald.600)] [--btn-border:theme(colors.emerald.700/90%)]",
142
- "[--btn-icon:theme(colors.white/60%)] data-[active]:[--btn-icon:theme(colors.white/80%)] data-[hover]:[--btn-icon:theme(colors.white/80%)]",
143
- ],
144
- teal: [
145
- "text-white [--btn-hover-overlay:theme(colors.white/10%)] [--btn-bg:theme(colors.teal.600)] [--btn-border:theme(colors.teal.700/90%)]",
146
- "[--btn-icon:theme(colors.white/60%)] data-[active]:[--btn-icon:theme(colors.white/80%)] data-[hover]:[--btn-icon:theme(colors.white/80%)]",
147
- ],
148
- sky: [
149
- "text-white [--btn-hover-overlay:theme(colors.white/10%)] [--btn-bg:theme(colors.sky.500)] [--btn-border:theme(colors.sky.600/80%)]",
150
- "[--btn-icon:theme(colors.white/60%)] data-[active]:[--btn-icon:theme(colors.white/80%)] data-[hover]:[--btn-icon:theme(colors.white/80%)]",
151
- ],
152
- blue: [
153
- "text-white [--btn-hover-overlay:theme(colors.white/10%)] [--btn-bg:theme(colors.blue.600)] [--btn-border:theme(colors.blue.700/90%)]",
154
- "[--btn-icon:theme(colors.blue.400)] data-[active]:[--btn-icon:theme(colors.blue.300)] data-[hover]:[--btn-icon:theme(colors.blue.300)]",
155
- ],
156
- violet: [
157
- "text-white [--btn-hover-overlay:theme(colors.white/10%)] [--btn-bg:theme(colors.violet.500)] [--btn-border:theme(colors.violet.600/90%)]",
158
- "[--btn-icon:theme(colors.violet.300)] data-[active]:[--btn-icon:theme(colors.violet.200)] data-[hover]:[--btn-icon:theme(colors.violet.200)]",
159
- ],
160
- purple: [
161
- "text-white [--btn-hover-overlay:theme(colors.white/10%)] [--btn-bg:theme(colors.purple.500)] [--btn-border:theme(colors.purple.600/90%)]",
162
- "[--btn-icon:theme(colors.purple.300)] data-[active]:[--btn-icon:theme(colors.purple.200)] data-[hover]:[--btn-icon:theme(colors.purple.200)]",
163
- ],
164
- fuchsia: [
165
- "text-white [--btn-hover-overlay:theme(colors.white/10%)] [--btn-bg:theme(colors.fuchsia.500)] [--btn-border:theme(colors.fuchsia.600/90%)]",
166
- "[--btn-icon:theme(colors.fuchsia.300)] data-[active]:[--btn-icon:theme(colors.fuchsia.200)] data-[hover]:[--btn-icon:theme(colors.fuchsia.200)]",
167
- ],
168
- pink: [
169
- "text-white [--btn-hover-overlay:theme(colors.white/10%)] [--btn-bg:theme(colors.pink.500)] [--btn-border:theme(colors.pink.600/90%)]",
170
- "[--btn-icon:theme(colors.pink.300)] data-[active]:[--btn-icon:theme(colors.pink.200)] data-[hover]:[--btn-icon:theme(colors.pink.200)]",
171
- ],
172
- rose: [
173
- "text-white [--btn-hover-overlay:theme(colors.white/10%)] [--btn-bg:theme(colors.rose.500)] [--btn-border:theme(colors.rose.600/90%)]",
174
- "[--btn-icon:theme(colors.rose.300)] data-[active]:[--btn-icon:theme(colors.rose.200)] data-[hover]:[--btn-icon:theme(colors.rose.200)]",
175
- ],
176
- },
177
- };
178
-
179
- export const Button = React.forwardRef(function Button(
180
- { color, outline, plain, className, children, ...props },
181
- ref
182
- ) {
183
- let classes = clsx(
184
- styles.base,
185
- outline
186
- ? styles.outline
187
- : plain
188
- ? styles.plain
189
- : clsx(styles.solid, styles.colors[color ?? "dark/zinc"]),
190
- className
191
- );
192
-
193
- return "href" in props ? (
194
- <Link {...props} className={classes} ref={ref}>
195
- <TouchTarget>{children}</TouchTarget>
196
- </Link>
197
- ) : (
198
- <HeadlessButton
199
- {...props}
200
- className={clsx(classes, "cursor-default")}
201
- ref={ref}
202
- >
203
- <TouchTarget>{children}</TouchTarget>
204
- </HeadlessButton>
205
- );
206
- });
207
-
208
- /* Expand the hit area to at least 44×44px on touch devices */
209
- export function TouchTarget({ children }) {
210
- return (
211
- <>
212
- {children}
213
- <span
214
- className="absolute left-1/2 top-1/2 size-[max(100%,2.75rem)] -translate-x-1/2 -translate-y-1/2 [@media(pointer:fine)]:hidden"
215
- aria-hidden="true"
216
- />
217
- </>
218
- );
219
- }
@@ -1,39 +0,0 @@
1
- import clsx from "clsx";
2
-
3
- function H1({ className, children, ...props }) {
4
- const cls = clsx("text-3xl font-bold", className);
5
- return (
6
- <h1 className={cls} {...props}>
7
- {children}
8
- </h1>
9
- );
10
- }
11
-
12
- function H2({ className, children, ...props }) {
13
- const cls = clsx("text-2xl font-bold", className);
14
- return (
15
- <h2 className={cls} {...props}>
16
- {children}
17
- </h2>
18
- );
19
- }
20
-
21
- function H3({ className, children, ...props }) {
22
- const cls = clsx("text-xl font-bold", className);
23
- return (
24
- <h3 className={cls} {...props}>
25
- {children}
26
- </h3>
27
- );
28
- }
29
-
30
- function H4({ className, children, ...props }) {
31
- const cls = clsx("text-lg font-bold", className);
32
- return (
33
- <h4 className={cls} {...props}>
34
- {children}
35
- </h4>
36
- );
37
- }
38
-
39
- export { H1, H2, H3, H4 };
@@ -1,48 +0,0 @@
1
- import { clsx } from "clsx";
2
- import { Link } from "../link";
3
-
4
- export function Text({ className, ...props }) {
5
- return (
6
- <p
7
- {...props}
8
- data-slot="text"
9
- className={clsx(
10
- className,
11
- "text-base/6 text-zinc-500 sm:text-sm/6 dark:text-zinc-400"
12
- )}
13
- />
14
- );
15
- }
16
-
17
- export function TextLink({ className, ...props }) {
18
- return (
19
- <Link
20
- {...props}
21
- className={clsx(
22
- className,
23
- "text-zinc-950 underline decoration-zinc-950/50 data-[hover]:decoration-zinc-950 dark:text-white dark:decoration-white/50 dark:data-[hover]:decoration-white"
24
- )}
25
- />
26
- );
27
- }
28
-
29
- export function Strong({ className, ...props }) {
30
- return (
31
- <strong
32
- {...props}
33
- className={clsx(className, "font-medium text-zinc-950 dark:text-white")}
34
- />
35
- );
36
- }
37
-
38
- export function Code({ className, ...props }) {
39
- return (
40
- <code
41
- {...props}
42
- className={clsx(
43
- className,
44
- "rounded border border-zinc-950/10 bg-zinc-950/[2.5%] px-0.5 text-sm font-medium text-zinc-950 sm:text-[0.8125rem] dark:border-white/20 dark:bg-white/5 dark:text-white"
45
- )}
46
- />
47
- );
48
- }
@@ -1,51 +0,0 @@
1
- import { Container } from "./layout/container";
2
- /**
3
- * @name Hero
4
- * @description A full width, full height hero component with a title, subtitle, and optional image.
5
- * @param {string} title - The title of the hero.
6
- * @param {string} subtitle - The subtitle of the hero.
7
- * @param {string} image - The image to display in the hero.
8
- * @param {string} alt - The alt text for the image.
9
- * @param {ReactNode} children - Custom children to display in the hero.
10
- * @example
11
- * <Hero
12
- * title="Groundwork"
13
- * subtitle="React Component Library"
14
- * image="/nww-lucky-peak-dam.jpg"
15
- * alt="Lucky Peak Dam"
16
- * >
17
- */
18
- function Hero({ title, subtitle, image, alt, children }) {
19
- return (
20
- <div className="relative">
21
- <div className="h-56 w-full overflow-clip bg-zinc-950 md:h-1/5 md:max-h-[500px]">
22
- <img
23
- src={image}
24
- alt={alt}
25
- className="object-cover object-center w-full h-full"
26
- />
27
- </div>
28
- <div className="absolute inset-0 bg-zinc-950/50" />
29
- {children && (
30
- <div className="absolute inset-0 flex items-center justify-center">
31
- {children}
32
- </div>
33
- )}
34
- {title && (
35
- <Container className="relative">
36
- <div className="absolute bottom-0 left-0 max-w-7xl mx-auto px-4">
37
- <div className="pb-8">
38
- <h1 className="text-4xl font-extrabold tracking-tight text-white sm:text-5xl lg:text-6xl">
39
- {title}
40
- </h1>
41
- <p className="mt-1 text-xl text-zinc-200">{subtitle}</p>
42
- </div>
43
- </div>
44
- </Container>
45
- )}
46
- </div>
47
- );
48
- }
49
-
50
- export default Hero;
51
- export { Hero };