@atelic-action/ui 7.2.0 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +439 -132
- package/bin/atelic-check-sentry.ts +5 -0
- package/dist/gate/middleware.js +15 -1
- package/dist/monitoring/server.d.ts +72 -0
- package/dist/monitoring/server.js +201 -0
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/dist/vite/marketing-config.d.ts +28 -1
- package/dist/vite/marketing-config.js +62 -0
- package/package.json +23 -11
- package/src/app/ErrorFallback.tsx +6 -2
- package/src/app/context/AppContext.tsx +10 -1
- package/src/app/index.ts +0 -1
- package/src/app/layout/AppPage.tsx +36 -7
- package/src/app/layout/DesktopRail.tsx +15 -6
- package/src/app/layout/MobileMenu.tsx +14 -5
- package/src/app/layout/MobileTabBar.tsx +3 -2
- package/src/app/layout/PageError.tsx +7 -4
- package/src/app/layout/PageSkeleton.tsx +33 -26
- package/src/app/layout/SectionCards.tsx +7 -2
- package/src/app/layout/UserMenu.tsx +13 -7
- package/src/app/ui/alert.tsx +42 -12
- package/src/app/ui/badge.tsx +1 -1
- package/src/app/ui/button.tsx +2 -1
- package/src/app/ui/command.tsx +86 -21
- package/src/app/ui/country-dropdown.tsx +26 -47
- package/src/app/ui/form.tsx +48 -9
- package/src/app/ui/pagination.tsx +1 -1
- package/src/app/ui/progress.tsx +26 -12
- package/src/app/ui/search-input.tsx +16 -3
- package/src/app/ui/select.tsx +8 -3
- package/src/app/ui/slider.tsx +62 -15
- package/src/artifact/AppErrorBoundary.tsx +12 -7
- package/src/artifact/ArtifactShell.tsx +5 -1
- package/src/artifact/ErrorFallback.tsx +8 -1
- package/src/artifact/artifactConfig.ts +1 -1
- package/src/chrome/BrandLockup.tsx +102 -17
- package/src/chrome/ClosingBar.tsx +5 -3
- package/src/chrome/ContactDock.tsx +361 -0
- package/src/chrome/Footer.tsx +126 -31
- package/src/chrome/NavBadge.tsx +8 -0
- package/src/chrome/NavMegaPanel.tsx +399 -0
- package/src/chrome/SiteHeader.tsx +268 -23
- package/src/chrome/SiteMenu.tsx +200 -19
- package/src/chrome/SiteShell.tsx +151 -14
- package/src/chrome/StickyCTABar.tsx +60 -2
- package/src/chrome/brandMark.ts +56 -0
- package/src/chrome/icons.ts +58 -0
- package/src/chrome/index.ts +16 -0
- package/src/chrome/navSections.ts +55 -0
- package/src/components/ColumnChart.tsx +27 -2
- package/src/components/DataTable.tsx +104 -85
- package/src/components/Disclosure.tsx +3 -1
- package/src/components/Hint.tsx +3 -24
- package/src/components/NotFound.tsx +7 -3
- package/src/components/StarRating.tsx +45 -19
- package/src/components/ThresholdScale.tsx +36 -26
- package/src/email/atoms.tsx +13 -57
- package/src/email/frame.tsx +4 -6
- package/src/email/index.ts +4 -10
- package/src/email/scoreboard.tsx +107 -186
- package/src/email/text.ts +30 -0
- package/src/email/theme.tsx +76 -9
- package/src/gate/middleware.ts +15 -1
- package/src/hooks/useDismiss.ts +39 -0
- package/src/lib/emailText.tsx +26 -0
- package/src/lib/phoneText.tsx +40 -0
- package/src/lib/useScrollsSideways.ts +26 -0
- package/src/monitoring/ErrorCatcherScript.tsx +15 -0
- package/src/monitoring/catcher.ts +118 -0
- package/src/monitoring/index.ts +25 -0
- package/src/monitoring/sdk.ts +112 -0
- package/src/monitoring/server.ts +244 -0
- package/src/monitoring/start.ts +118 -0
- package/src/primitives/Button.tsx +5 -1
- package/src/primitives/Eyebrow.tsx +6 -2
- package/src/primitives/ProseBlocks.tsx +6 -1
- package/src/primitives/SectionHeading.tsx +3 -1
- package/src/primitives/StarRow.tsx +23 -8
- package/src/routing/index.ts +1 -0
- package/src/routing/miss.ts +32 -0
- package/src/scripts/check-sentry.ts +77 -0
- package/src/sections/BlogIndex.tsx +17 -3
- package/src/sections/BlogPost.tsx +10 -1
- package/src/sections/CTASection.tsx +2 -2
- package/src/sections/CalloutPanel.tsx +34 -0
- package/src/sections/ComparisonTable.tsx +23 -2
- package/src/sections/ContactForm.tsx +61 -17
- package/src/sections/FAQBrowser.tsx +11 -2
- package/src/sections/FeatureGrid.tsx +6 -2
- package/src/sections/FullBleedVideo.tsx +167 -0
- package/src/sections/Gallery.tsx +6 -4
- package/src/sections/Hero.tsx +70 -39
- package/src/sections/JumpRail.tsx +7 -0
- package/src/sections/LegalPage.tsx +10 -2
- package/src/sections/LinkColumns.tsx +80 -0
- package/src/sections/LocationSection.tsx +28 -5
- package/src/sections/Locations.tsx +18 -5
- package/src/sections/LogoMarquee.tsx +43 -11
- package/src/sections/MapEmbed.tsx +13 -9
- package/src/sections/PageHero.tsx +16 -2
- package/src/sections/ProcessSteps.tsx +27 -4
- package/src/sections/ProfileCards.tsx +12 -2
- package/src/sections/ProofStrip.tsx +44 -0
- package/src/sections/RevealSlider.tsx +28 -7
- package/src/sections/ReviewCarousel.tsx +17 -4
- package/src/sections/ReviewWall.tsx +2 -2
- package/src/sections/SplitSection.tsx +2 -1
- package/src/sections/index.ts +15 -6
- package/src/sections/siteConfig.ts +101 -8
- package/src/styles/app.css +33 -2
- package/src/styles/artifact.css +20 -8
- package/src/styles/base.css +68 -13
- package/src/styles/chrome.css +1134 -56
- package/src/styles/components.css +104 -65
- package/src/styles/defaults.css +140 -0
- package/src/styles/gate.css +21 -10
- package/src/styles/primitives.css +108 -39
- package/src/styles/sections.css +500 -437
- package/src/styles/star-rating.css +1 -4
- package/src/tokens/palettes.ts +24 -4
- package/src/types.ts +220 -3
- package/src/vite/index.ts +4 -0
- package/src/vite/marketing-config.ts +81 -1
- package/src/app/CardErrorBoundary.tsx +0 -39
- package/src/sections/CTABanner.tsx +0 -93
- package/src/sections/DeviceShowcase.tsx +0 -39
- package/src/sections/MediaBand.tsx +0 -20
- package/src/sections/MenuList.tsx +0 -44
- package/src/sections/PressQuotes.tsx +0 -51
- package/src/sections/SocialStrip.tsx +0 -83
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { countries as countryList } from "country-data-list";
|
|
3
3
|
import { CheckIcon, ChevronDown, Globe } from "lucide-react";
|
|
4
4
|
import { forwardRef, useCallback, useEffect, useState } from "react";
|
|
5
|
-
import { CircleFlag } from "react-circle-flags";
|
|
6
5
|
import { cn } from "../lib/utils";
|
|
7
6
|
import {
|
|
8
7
|
Command,
|
|
@@ -33,10 +32,14 @@ interface CountryDropdownProps {
|
|
|
33
32
|
disabled?: boolean;
|
|
34
33
|
placeholder?: string;
|
|
35
34
|
className?: string;
|
|
35
|
+
/** The open list's accessible name, on the popover and its search. Defaults to "Countries". */
|
|
36
|
+
ariaLabel?: string;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
//
|
|
39
|
-
//
|
|
39
|
+
// The current, assigned countries (the data marks each with an emoji, which
|
|
40
|
+
// is only the filter here: a country is shown by its name and nothing else),
|
|
41
|
+
// excluding deleted entries. North Korea (PRK) is excluded for sanctions
|
|
42
|
+
// compliance.
|
|
40
43
|
const defaultOptions: Country[] = countryList.all.filter(
|
|
41
44
|
(country: Country) => country.emoji && country.status !== "deleted" && country.ioc !== "PRK",
|
|
42
45
|
);
|
|
@@ -49,6 +52,7 @@ const CountryDropdownComponent = (
|
|
|
49
52
|
disabled = false,
|
|
50
53
|
placeholder = "Select country",
|
|
51
54
|
className,
|
|
55
|
+
ariaLabel = "Countries",
|
|
52
56
|
}: CountryDropdownProps,
|
|
53
57
|
ref: React.ForwardedRef<HTMLButtonElement>,
|
|
54
58
|
) => {
|
|
@@ -91,44 +95,36 @@ const CountryDropdownComponent = (
|
|
|
91
95
|
disabled={disabled}
|
|
92
96
|
>
|
|
93
97
|
{selectedCountry ? (
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
</div>
|
|
98
|
-
<span className="overflow-hidden text-ellipsis whitespace-nowrap">
|
|
99
|
-
{selectedCountry.name}
|
|
100
|
-
</span>
|
|
101
|
-
</div>
|
|
98
|
+
<span className="flex-grow overflow-hidden text-ellipsis whitespace-nowrap text-left">
|
|
99
|
+
{selectedCountry.name}
|
|
100
|
+
</span>
|
|
102
101
|
) : (
|
|
103
102
|
<span className="flex items-center gap-2 text-muted-foreground">
|
|
104
|
-
<Globe size={16} />
|
|
103
|
+
<Globe size={16} aria-hidden="true" />
|
|
105
104
|
{placeholder}
|
|
106
105
|
</span>
|
|
107
106
|
)}
|
|
108
|
-
<ChevronDown size={16} className="shrink-0 text-muted-foreground" />
|
|
107
|
+
<ChevronDown size={16} className="shrink-0 text-muted-foreground" aria-hidden="true" />
|
|
109
108
|
</PopoverTrigger>
|
|
110
109
|
<PopoverContent
|
|
111
110
|
collisionPadding={10}
|
|
112
111
|
side="bottom"
|
|
112
|
+
aria-label={ariaLabel}
|
|
113
113
|
className="min-w-(--radix-popper-anchor-width) p-0"
|
|
114
114
|
>
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
{/* The search sits above the list, never inside it: the list is a
|
|
116
|
+
listbox, which may hold only its options. */}
|
|
117
|
+
<Command label={ariaLabel} className="w-full max-h-[200px] sm:max-h-[270px]">
|
|
118
|
+
<CommandInput placeholder="Search country..." />
|
|
119
|
+
<CommandList className="min-h-0 flex-1">
|
|
120
120
|
<CommandEmpty>No country found.</CommandEmpty>
|
|
121
121
|
<CommandGroup>
|
|
122
122
|
<CommandItem className="flex items-center w-full gap-2" onSelect={handleClear}>
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
</div>
|
|
127
|
-
<span className="overflow-hidden text-ellipsis whitespace-nowrap text-muted-foreground">
|
|
128
|
-
Not specified
|
|
129
|
-
</span>
|
|
130
|
-
</div>
|
|
123
|
+
<span className="flex-grow overflow-hidden text-ellipsis whitespace-nowrap text-muted-foreground">
|
|
124
|
+
Not specified
|
|
125
|
+
</span>
|
|
131
126
|
<CheckIcon
|
|
127
|
+
aria-hidden="true"
|
|
132
128
|
className={cn(
|
|
133
129
|
"ml-auto h-4 w-4 shrink-0",
|
|
134
130
|
!selectedCountry ? "opacity-100" : "opacity-0",
|
|
@@ -143,15 +139,11 @@ const CountryDropdownComponent = (
|
|
|
143
139
|
key={option.alpha3}
|
|
144
140
|
onSelect={() => handleSelect(option)}
|
|
145
141
|
>
|
|
146
|
-
<
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
</div>
|
|
150
|
-
<span className="overflow-hidden text-ellipsis whitespace-nowrap">
|
|
151
|
-
{option.name}
|
|
152
|
-
</span>
|
|
153
|
-
</div>
|
|
142
|
+
<span className="flex-grow overflow-hidden text-ellipsis whitespace-nowrap">
|
|
143
|
+
{option.name}
|
|
144
|
+
</span>
|
|
154
145
|
<CheckIcon
|
|
146
|
+
aria-hidden="true"
|
|
155
147
|
className={cn(
|
|
156
148
|
"ml-auto h-4 w-4 shrink-0",
|
|
157
149
|
selectedCountry?.alpha3 === option.alpha3 ? "opacity-100" : "opacity-0",
|
|
@@ -169,16 +161,3 @@ const CountryDropdownComponent = (
|
|
|
169
161
|
|
|
170
162
|
CountryDropdownComponent.displayName = "CountryDropdown";
|
|
171
163
|
export const CountryDropdown = forwardRef(CountryDropdownComponent);
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Get the flag component for a country name.
|
|
175
|
-
*/
|
|
176
|
-
export function getCountryFlag(countryName: string): React.ReactNode {
|
|
177
|
-
const country = defaultOptions.find((c) => c.name === countryName);
|
|
178
|
-
if (!country) return null;
|
|
179
|
-
return (
|
|
180
|
-
<span className="inline-flex items-center justify-center w-4 h-4 shrink-0 overflow-hidden rounded-full">
|
|
181
|
-
<CircleFlag countryCode={country.alpha2.toLowerCase()} height={16} />
|
|
182
|
-
</span>
|
|
183
|
-
);
|
|
184
|
-
}
|
package/src/app/ui/form.tsx
CHANGED
|
@@ -53,10 +53,11 @@ const useFormField = () => {
|
|
|
53
53
|
|
|
54
54
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
55
55
|
|
|
56
|
-
const { id } = itemContext;
|
|
56
|
+
const { id, parts } = itemContext;
|
|
57
57
|
|
|
58
58
|
return {
|
|
59
59
|
id,
|
|
60
|
+
parts,
|
|
60
61
|
name: fieldContext.name,
|
|
61
62
|
formItemId: `${id}-form-item`,
|
|
62
63
|
formDescriptionId: `${id}-form-item-description`,
|
|
@@ -65,18 +66,49 @@ const useFormField = () => {
|
|
|
65
66
|
};
|
|
66
67
|
};
|
|
67
68
|
|
|
69
|
+
/** Which of a field's describing parts are on the page right now. */
|
|
70
|
+
type FormItemParts = { description: boolean; message: boolean };
|
|
71
|
+
|
|
68
72
|
type FormItemContextValue = {
|
|
69
73
|
id: string;
|
|
74
|
+
parts: FormItemParts;
|
|
75
|
+
/** A describing part reports itself as it mounts and as it leaves. */
|
|
76
|
+
setPart: (part: keyof FormItemParts, present: boolean) => void;
|
|
70
77
|
};
|
|
71
78
|
|
|
72
79
|
const FormItemContext = React.createContext<FormItemContextValue | null>(null);
|
|
73
80
|
|
|
81
|
+
/** A layout effect in the browser, before the frame paints; a plain effect on the server, where none runs. */
|
|
82
|
+
const useBeforePaint = typeof window === "undefined" ? React.useEffect : React.useLayoutEffect;
|
|
83
|
+
|
|
84
|
+
/** A describing part of a field, which tells its item whether it is on the page. */
|
|
85
|
+
function useFormItemPart(part: keyof FormItemParts, present: boolean) {
|
|
86
|
+
const field = useFormField();
|
|
87
|
+
const setPart = React.useContext(FormItemContext)?.setPart;
|
|
88
|
+
useBeforePaint(() => {
|
|
89
|
+
if (!setPart) return;
|
|
90
|
+
setPart(part, present);
|
|
91
|
+
return () => setPart(part, false);
|
|
92
|
+
}, [setPart, part, present]);
|
|
93
|
+
return field;
|
|
94
|
+
}
|
|
95
|
+
|
|
74
96
|
const FormItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
75
97
|
({ className, ...props }, ref) => {
|
|
76
98
|
const id = React.useId();
|
|
99
|
+
const [parts, setParts] = React.useState<FormItemParts>({
|
|
100
|
+
description: false,
|
|
101
|
+
message: false,
|
|
102
|
+
});
|
|
103
|
+
const setPart = React.useCallback((part: keyof FormItemParts, present: boolean) => {
|
|
104
|
+
setParts((current) =>
|
|
105
|
+
current[part] === present ? current : { ...current, [part]: present },
|
|
106
|
+
);
|
|
107
|
+
}, []);
|
|
108
|
+
const value = React.useMemo(() => ({ id, parts, setPart }), [id, parts, setPart]);
|
|
77
109
|
|
|
78
110
|
return (
|
|
79
|
-
<FormItemContext.Provider value={
|
|
111
|
+
<FormItemContext.Provider value={value}>
|
|
80
112
|
<div ref={ref} className={cn("space-y-2", className)} {...props} />
|
|
81
113
|
</FormItemContext.Provider>
|
|
82
114
|
);
|
|
@@ -93,7 +125,7 @@ const FormLabel = React.forwardRef<
|
|
|
93
125
|
return (
|
|
94
126
|
<Label
|
|
95
127
|
ref={ref}
|
|
96
|
-
className={cn(error && "text-destructive", className)}
|
|
128
|
+
className={cn(error && "text-destructive-ink", className)}
|
|
97
129
|
htmlFor={formItemId}
|
|
98
130
|
{...props}
|
|
99
131
|
/>
|
|
@@ -105,13 +137,19 @@ const FormControl = React.forwardRef<
|
|
|
105
137
|
React.ElementRef<typeof Slot>,
|
|
106
138
|
React.ComponentPropsWithoutRef<typeof Slot>
|
|
107
139
|
>(({ ...props }, ref) => {
|
|
108
|
-
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
140
|
+
const { error, formItemId, formDescriptionId, formMessageId, parts } = useFormField();
|
|
141
|
+
// Only the parts on the page: a reference to a description or a message
|
|
142
|
+
// that never rendered points at nothing.
|
|
143
|
+
const describedBy =
|
|
144
|
+
[parts.description && formDescriptionId, parts.message && formMessageId]
|
|
145
|
+
.filter(Boolean)
|
|
146
|
+
.join(" ") || undefined;
|
|
109
147
|
|
|
110
148
|
return (
|
|
111
149
|
<Slot
|
|
112
150
|
ref={ref}
|
|
113
151
|
id={formItemId}
|
|
114
|
-
aria-describedby={
|
|
152
|
+
aria-describedby={describedBy}
|
|
115
153
|
aria-invalid={!!error}
|
|
116
154
|
{...props}
|
|
117
155
|
/>
|
|
@@ -123,7 +161,7 @@ const FormDescription = React.forwardRef<
|
|
|
123
161
|
HTMLParagraphElement,
|
|
124
162
|
React.HTMLAttributes<HTMLParagraphElement>
|
|
125
163
|
>(({ className, ...props }, ref) => {
|
|
126
|
-
const { formDescriptionId } =
|
|
164
|
+
const { formDescriptionId } = useFormItemPart("description", true);
|
|
127
165
|
|
|
128
166
|
return (
|
|
129
167
|
<p
|
|
@@ -140,8 +178,9 @@ const FormMessage = React.forwardRef<
|
|
|
140
178
|
HTMLParagraphElement,
|
|
141
179
|
React.HTMLAttributes<HTMLParagraphElement>
|
|
142
180
|
>(({ className, children, ...props }, ref) => {
|
|
143
|
-
const
|
|
144
|
-
const body = error ? String(error?.message ?? "") : children;
|
|
181
|
+
const field = useFormField();
|
|
182
|
+
const body = field.error ? String(field.error?.message ?? "") : children;
|
|
183
|
+
const { formMessageId } = useFormItemPart("message", Boolean(body));
|
|
145
184
|
|
|
146
185
|
if (!body) {
|
|
147
186
|
return null;
|
|
@@ -151,7 +190,7 @@ const FormMessage = React.forwardRef<
|
|
|
151
190
|
<p
|
|
152
191
|
ref={ref}
|
|
153
192
|
id={formMessageId}
|
|
154
|
-
className={cn("text-sm font-medium text-destructive", className)}
|
|
193
|
+
className={cn("text-sm font-medium text-destructive-ink", className)}
|
|
155
194
|
{...props}
|
|
156
195
|
>
|
|
157
196
|
{body}
|
package/src/app/ui/progress.tsx
CHANGED
|
@@ -3,23 +3,37 @@ import * as React from "react";
|
|
|
3
3
|
|
|
4
4
|
import { cn } from "../lib/utils";
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* A bar filled to `value` out of `max` (100 by default). The value reaches the
|
|
8
|
+
* Radix root, so the `progressbar` reports it (`aria-valuenow`); a bar with no
|
|
9
|
+
* value, or a null one, is indeterminate, reports none, and draws empty. A
|
|
10
|
+
* value past either end is held at that end (Radix reads one outside 0 to
|
|
11
|
+
* `max` as no value at all, so 120 of 100 would say indeterminate).
|
|
12
|
+
*/
|
|
6
13
|
const Progress = React.forwardRef<
|
|
7
14
|
React.ElementRef<typeof ProgressPrimitive.Root>,
|
|
8
15
|
React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root> & {
|
|
9
16
|
indicatorClassName?: string;
|
|
10
17
|
}
|
|
11
|
-
>(({ className, value, indicatorClassName, ...props }, ref) =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
>(({ className, value, max, indicatorClassName, ...props }, ref) => {
|
|
19
|
+
const ceiling = max ?? 100;
|
|
20
|
+
const held = value == null ? null : Math.min(Math.max(value, 0), Math.max(ceiling, 0));
|
|
21
|
+
const share = held == null || ceiling <= 0 ? 0 : (held / ceiling) * 100;
|
|
22
|
+
return (
|
|
23
|
+
<ProgressPrimitive.Root
|
|
24
|
+
ref={ref}
|
|
25
|
+
value={held}
|
|
26
|
+
max={max}
|
|
27
|
+
className={cn("relative h-4 w-full overflow-hidden rounded-full bg-secondary", className)}
|
|
28
|
+
{...props}
|
|
29
|
+
>
|
|
30
|
+
<ProgressPrimitive.Indicator
|
|
31
|
+
className={cn("h-full w-full flex-1 bg-primary transition-all", indicatorClassName)}
|
|
32
|
+
style={{ transform: `translateX(-${100 - share}%)` }}
|
|
33
|
+
/>
|
|
34
|
+
</ProgressPrimitive.Root>
|
|
35
|
+
);
|
|
36
|
+
});
|
|
23
37
|
Progress.displayName = ProgressPrimitive.Root.displayName;
|
|
24
38
|
|
|
25
39
|
export { Progress };
|
|
@@ -15,11 +15,21 @@ const SearchInput = React.forwardRef<HTMLInputElement, SearchInputProps>(
|
|
|
15
15
|
{ className, value, onValueChange, onClear, onKeyDown, placeholder = "Search...", ...props },
|
|
16
16
|
ref,
|
|
17
17
|
) => {
|
|
18
|
+
const inputRef = React.useRef<HTMLInputElement>(null);
|
|
19
|
+
React.useImperativeHandle(ref, () => inputRef.current as HTMLInputElement, []);
|
|
20
|
+
|
|
18
21
|
const handleClear = React.useCallback(() => {
|
|
19
22
|
onValueChange("");
|
|
20
23
|
onClear?.();
|
|
21
24
|
}, [onValueChange, onClear]);
|
|
22
25
|
|
|
26
|
+
// The clear button removes itself once the box is empty, so a press
|
|
27
|
+
// by keyboard would leave focus on nothing; it goes back to the box.
|
|
28
|
+
const handleClearClick = React.useCallback(() => {
|
|
29
|
+
handleClear();
|
|
30
|
+
inputRef.current?.focus();
|
|
31
|
+
}, [handleClear]);
|
|
32
|
+
|
|
23
33
|
const handleKeyDown = React.useCallback(
|
|
24
34
|
(e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
25
35
|
if (e.key === "Escape" && value) {
|
|
@@ -33,9 +43,12 @@ const SearchInput = React.forwardRef<HTMLInputElement, SearchInputProps>(
|
|
|
33
43
|
|
|
34
44
|
return (
|
|
35
45
|
<div className="relative w-full">
|
|
36
|
-
<Search
|
|
46
|
+
<Search
|
|
47
|
+
aria-hidden="true"
|
|
48
|
+
className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"
|
|
49
|
+
/>
|
|
37
50
|
<Input
|
|
38
|
-
ref={
|
|
51
|
+
ref={inputRef}
|
|
39
52
|
type="text"
|
|
40
53
|
value={value}
|
|
41
54
|
onChange={(e) => onValueChange(e.target.value)}
|
|
@@ -49,7 +62,7 @@ const SearchInput = React.forwardRef<HTMLInputElement, SearchInputProps>(
|
|
|
49
62
|
/>
|
|
50
63
|
{value && (
|
|
51
64
|
<ClearButton
|
|
52
|
-
onClick={
|
|
65
|
+
onClick={handleClearClick}
|
|
53
66
|
className="absolute right-3 top-1/2 -translate-y-1/2"
|
|
54
67
|
aria-label="Clear search"
|
|
55
68
|
/>
|
package/src/app/ui/select.tsx
CHANGED
|
@@ -67,8 +67,14 @@ const SelectContent = React.forwardRef<
|
|
|
67
67
|
ref={ref}
|
|
68
68
|
className={cn(
|
|
69
69
|
"relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-select-content-transform-origin)",
|
|
70
|
+
// The trigger's width is the list's floor on the content itself, so
|
|
71
|
+
// its border and the viewport's padding sit inside it rather than
|
|
72
|
+
// past the trigger's edge. The floor never exceeds the room the
|
|
73
|
+
// popper leaves inside its collision padding: a trigger as wide as
|
|
74
|
+
// a phone would otherwise hold the list past the screen's edge,
|
|
75
|
+
// since a min-width beats a max-width.
|
|
70
76
|
position === "popper" &&
|
|
71
|
-
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
77
|
+
"min-w-[min(max(8rem,var(--radix-select-trigger-width)),var(--radix-select-content-available-width))] max-w-(--radix-select-content-available-width) data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
72
78
|
className,
|
|
73
79
|
)}
|
|
74
80
|
position={position}
|
|
@@ -78,8 +84,7 @@ const SelectContent = React.forwardRef<
|
|
|
78
84
|
<SelectPrimitive.Viewport
|
|
79
85
|
className={cn(
|
|
80
86
|
"p-1",
|
|
81
|
-
position === "popper" &&
|
|
82
|
-
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]",
|
|
87
|
+
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full",
|
|
83
88
|
)}
|
|
84
89
|
>
|
|
85
90
|
{children}
|
package/src/app/ui/slider.tsx
CHANGED
|
@@ -3,21 +3,68 @@ import * as React from "react";
|
|
|
3
3
|
|
|
4
4
|
import { cn } from "../lib/utils";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
export interface SliderProps extends React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root> {
|
|
7
|
+
/**
|
|
8
|
+
* One accessible name per thumb, in value order, for a range slider whose
|
|
9
|
+
* thumbs mean different things ("Fewest", "Most"). A thumb with no entry
|
|
10
|
+
* takes the slider's own `aria-label` or `aria-labelledby`.
|
|
11
|
+
*/
|
|
12
|
+
thumbLabels?: string[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A slider with one thumb per value. The thumb is the `slider` a reader
|
|
17
|
+
* reaches, so the name given to `Slider` (`aria-label` or `aria-labelledby`)
|
|
18
|
+
* lands on each thumb rather than on the root, where nothing reads it.
|
|
19
|
+
*/
|
|
20
|
+
const Slider = React.forwardRef<React.ElementRef<typeof SliderPrimitive.Root>, SliderProps>(
|
|
21
|
+
(
|
|
22
|
+
{
|
|
23
|
+
className,
|
|
24
|
+
thumbLabels,
|
|
25
|
+
"aria-label": ariaLabel,
|
|
26
|
+
"aria-labelledby": ariaLabelledBy,
|
|
27
|
+
value,
|
|
28
|
+
defaultValue,
|
|
29
|
+
min = 0,
|
|
30
|
+
...props
|
|
31
|
+
},
|
|
32
|
+
ref,
|
|
33
|
+
) => {
|
|
34
|
+
const count = Math.max(1, (value ?? defaultValue ?? [min]).length);
|
|
35
|
+
return (
|
|
36
|
+
<SliderPrimitive.Root
|
|
37
|
+
ref={ref}
|
|
38
|
+
value={value}
|
|
39
|
+
defaultValue={defaultValue}
|
|
40
|
+
min={min}
|
|
41
|
+
className={cn("relative flex w-full touch-none select-none items-center", className)}
|
|
42
|
+
{...props}
|
|
43
|
+
>
|
|
44
|
+
<SliderPrimitive.Track className="relative h-2 w-full grow overflow-hidden rounded-full bg-secondary">
|
|
45
|
+
<SliderPrimitive.Range className="absolute h-full bg-primary" />
|
|
46
|
+
</SliderPrimitive.Track>
|
|
47
|
+
{Array.from({ length: count }, (_, index) => {
|
|
48
|
+
const own = thumbLabels?.[index];
|
|
49
|
+
return (
|
|
50
|
+
<SliderPrimitive.Thumb
|
|
51
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: a thumb's position is its identity
|
|
52
|
+
key={index}
|
|
53
|
+
// One thumb takes the slider's name; a range tells its thumbs
|
|
54
|
+
// apart, so a shared name never hides which end is which.
|
|
55
|
+
aria-label={
|
|
56
|
+
own ??
|
|
57
|
+
(ariaLabel && count > 1 ? `${ariaLabel} ${index + 1} of ${count}` : ariaLabel)
|
|
58
|
+
}
|
|
59
|
+
aria-labelledby={own || count > 1 ? undefined : ariaLabelledBy}
|
|
60
|
+
className="block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
})}
|
|
64
|
+
</SliderPrimitive.Root>
|
|
65
|
+
);
|
|
66
|
+
},
|
|
67
|
+
);
|
|
21
68
|
Slider.displayName = SliderPrimitive.Root.displayName;
|
|
22
69
|
|
|
23
70
|
export { Slider };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, type ReactNode } from "react";
|
|
2
|
-
|
|
2
|
+
import { reportError } from "../monitoring/catcher";
|
|
3
3
|
import { ErrorFallback } from "./ErrorFallback";
|
|
4
4
|
|
|
5
5
|
interface AppErrorBoundaryState {
|
|
@@ -8,12 +8,13 @@ interface AppErrorBoundaryState {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Plain React error boundary rendering the dependency
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
11
|
+
* Plain React error boundary rendering the dependency free ErrorFallback, so
|
|
12
|
+
* no Sentry code sits in the critical bundle. A render crash it catches
|
|
13
|
+
* never reaches the window's error handlers (React keeps it), so it hands
|
|
14
|
+
* the error to the package's error reporting itself (`reportError`): to the
|
|
15
|
+
* Sentry SDK once `startErrorReporting` has loaded it, and to the early
|
|
16
|
+
* catcher's buffer before that, which the SDK replays when it arrives. With
|
|
17
|
+
* no DSN configured the buffer simply holds it and nothing is sent.
|
|
17
18
|
*/
|
|
18
19
|
export class AppErrorBoundary extends Component<{ children: ReactNode }, AppErrorBoundaryState> {
|
|
19
20
|
state: AppErrorBoundaryState = { error: null, hasError: false };
|
|
@@ -22,6 +23,10 @@ export class AppErrorBoundary extends Component<{ children: ReactNode }, AppErro
|
|
|
22
23
|
return { error, hasError: true };
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
componentDidCatch(error: unknown) {
|
|
27
|
+
reportError(error, "boundary");
|
|
28
|
+
}
|
|
29
|
+
|
|
25
30
|
render() {
|
|
26
31
|
if (this.state.hasError) {
|
|
27
32
|
return (
|
|
@@ -34,8 +34,12 @@ export function ArtifactShell({ site, currentPath, stops, children }: ArtifactSh
|
|
|
34
34
|
// and run, then the recipient's mark after a times sign (ui 0.6.0).
|
|
35
35
|
const recipient = site.recipient.logo;
|
|
36
36
|
|
|
37
|
+
// Pinned to the roomier spacing every page had before 8.0.0, so a
|
|
38
|
+
// document's shell (its 404 included) reads as close as the one token allows to how it did when the
|
|
39
|
+
// marketing default tightened. `data-shell` scopes the document header's
|
|
40
|
+
// mark height (artifact.css).
|
|
37
41
|
return (
|
|
38
|
-
<div className="atelic-ui">
|
|
42
|
+
<div className="atelic-ui" data-density="comfortable" data-shell="artifact">
|
|
39
43
|
<SkipLink />
|
|
40
44
|
<SiteHeader
|
|
41
45
|
brand={{ name, href, logo, recipient }}
|
|
@@ -25,17 +25,24 @@ export function ErrorFallback({ error, resetError }: ErrorFallbackProps) {
|
|
|
25
25
|
textAlign: "center",
|
|
26
26
|
}}
|
|
27
27
|
>
|
|
28
|
-
|
|
28
|
+
{/* minWidth lets the card shrink to a phone whatever the message holds. */}
|
|
29
|
+
<div style={{ maxWidth: 420, minWidth: 0 }}>
|
|
29
30
|
<h1 style={{ fontSize: 24, fontWeight: 600, margin: 0 }}>Something went wrong</h1>
|
|
30
31
|
<p style={{ marginTop: 8, fontSize: 14, color: "#666" }}>
|
|
31
32
|
An unexpected error occurred. Please try again.
|
|
32
33
|
</p>
|
|
33
34
|
{import.meta.env.DEV && (
|
|
35
|
+
// The box scrolls when the message is long, so it takes focus and a
|
|
36
|
+
// keyboard can scroll it; the words wrap to its width.
|
|
34
37
|
<pre
|
|
38
|
+
// biome-ignore lint/a11y/noNoninteractiveTabindex: a scrolling region must be focusable to be scrolled by keyboard
|
|
39
|
+
tabIndex={0}
|
|
35
40
|
style={{
|
|
36
41
|
marginTop: 16,
|
|
37
42
|
maxHeight: 160,
|
|
38
43
|
overflow: "auto",
|
|
44
|
+
whiteSpace: "pre-wrap",
|
|
45
|
+
overflowWrap: "anywhere",
|
|
39
46
|
borderRadius: 8,
|
|
40
47
|
background: "#f4f4f4",
|
|
41
48
|
padding: 12,
|
|
@@ -72,7 +72,7 @@ export interface ArtifactRecipient {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
export interface ArtifactConfig {
|
|
75
|
-
/** Canonical origin of the hosted twin, no trailing slash, e.g. "https://
|
|
75
|
+
/** Canonical origin of the hosted twin, no trailing slash, e.g. "https://example.atelic.me". */
|
|
76
76
|
url: string;
|
|
77
77
|
/**
|
|
78
78
|
* Who may read it, which decides where it may be hosted (the practice's
|