@atelic-action/ui 7.1.0 → 8.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 (105) hide show
  1. package/README.md +313 -127
  2. package/package.json +14 -10
  3. package/src/app/ErrorFallback.tsx +6 -2
  4. package/src/app/context/AppContext.tsx +10 -1
  5. package/src/app/index.ts +0 -1
  6. package/src/app/layout/AppPage.tsx +36 -7
  7. package/src/app/layout/DesktopRail.tsx +9 -2
  8. package/src/app/layout/MobileMenu.tsx +5 -1
  9. package/src/app/layout/PageError.tsx +6 -3
  10. package/src/app/layout/PageSkeleton.tsx +33 -26
  11. package/src/app/layout/UserMenu.tsx +12 -6
  12. package/src/app/ui/alert.tsx +41 -11
  13. package/src/app/ui/badge.tsx +1 -1
  14. package/src/app/ui/button.tsx +2 -1
  15. package/src/app/ui/command.tsx +86 -21
  16. package/src/app/ui/country-dropdown.tsx +26 -47
  17. package/src/app/ui/form.tsx +46 -7
  18. package/src/app/ui/pagination.tsx +1 -1
  19. package/src/app/ui/progress.tsx +26 -12
  20. package/src/app/ui/search-input.tsx +16 -3
  21. package/src/app/ui/select.tsx +8 -3
  22. package/src/app/ui/slider.tsx +62 -15
  23. package/src/artifact/ArtifactShell.tsx +8 -3
  24. package/src/artifact/ErrorFallback.tsx +8 -1
  25. package/src/artifact/artifactConfig.ts +1 -1
  26. package/src/chrome/BrandLockup.tsx +71 -16
  27. package/src/chrome/ClosingBar.tsx +8 -5
  28. package/src/chrome/ContactDock.tsx +329 -0
  29. package/src/chrome/Footer.tsx +32 -9
  30. package/src/chrome/NavBadge.tsx +8 -0
  31. package/src/chrome/NavMegaPanel.tsx +388 -0
  32. package/src/chrome/SiteHeader.tsx +235 -18
  33. package/src/chrome/SiteMenu.tsx +197 -19
  34. package/src/chrome/SiteShell.tsx +130 -13
  35. package/src/chrome/StickyCTABar.tsx +56 -2
  36. package/src/chrome/brandMark.ts +56 -0
  37. package/src/chrome/icons.ts +58 -0
  38. package/src/chrome/index.ts +16 -0
  39. package/src/chrome/navSections.ts +55 -0
  40. package/src/components/ColumnChart.tsx +27 -2
  41. package/src/components/DataTable.tsx +104 -85
  42. package/src/components/Disclosure.tsx +3 -1
  43. package/src/components/Hint.tsx +3 -24
  44. package/src/components/NotFound.tsx +4 -1
  45. package/src/components/StarRating.tsx +45 -19
  46. package/src/components/ThresholdScale.tsx +36 -26
  47. package/src/email/atoms.tsx +13 -57
  48. package/src/email/frame.tsx +4 -6
  49. package/src/email/index.ts +4 -10
  50. package/src/email/scoreboard.tsx +107 -186
  51. package/src/email/text.ts +30 -0
  52. package/src/email/theme.tsx +76 -9
  53. package/src/hooks/useDismiss.ts +39 -0
  54. package/src/lib/useScrollsSideways.ts +26 -0
  55. package/src/primitives/Button.tsx +2 -0
  56. package/src/primitives/ProseBlocks.tsx +6 -1
  57. package/src/primitives/SectionHeading.tsx +3 -1
  58. package/src/primitives/StarRow.tsx +23 -8
  59. package/src/sections/BlogIndex.tsx +17 -3
  60. package/src/sections/BlogPost.tsx +10 -1
  61. package/src/sections/CTASection.tsx +2 -2
  62. package/src/sections/CalloutPanel.tsx +34 -0
  63. package/src/sections/ComparisonTable.tsx +23 -2
  64. package/src/sections/ContactForm.tsx +61 -17
  65. package/src/sections/FAQBrowser.tsx +11 -2
  66. package/src/sections/FeatureGrid.tsx +6 -2
  67. package/src/sections/FullBleedVideo.tsx +158 -0
  68. package/src/sections/Gallery.tsx +6 -4
  69. package/src/sections/Hero.tsx +63 -39
  70. package/src/sections/JumpRail.tsx +7 -0
  71. package/src/sections/LegalPage.tsx +10 -2
  72. package/src/sections/LinkColumns.tsx +64 -0
  73. package/src/sections/LocationSection.tsx +28 -5
  74. package/src/sections/Locations.tsx +17 -4
  75. package/src/sections/LogoMarquee.tsx +43 -11
  76. package/src/sections/MapEmbed.tsx +13 -9
  77. package/src/sections/PageHero.tsx +16 -2
  78. package/src/sections/ProcessSteps.tsx +27 -4
  79. package/src/sections/ProfileCards.tsx +12 -2
  80. package/src/sections/ProofStrip.tsx +44 -0
  81. package/src/sections/RevealSlider.tsx +28 -7
  82. package/src/sections/ReviewCarousel.tsx +17 -4
  83. package/src/sections/ReviewWall.tsx +2 -2
  84. package/src/sections/SplitSection.tsx +2 -1
  85. package/src/sections/index.ts +15 -6
  86. package/src/sections/siteConfig.ts +66 -3
  87. package/src/styles/app.css +24 -2
  88. package/src/styles/artifact.css +20 -8
  89. package/src/styles/base.css +42 -13
  90. package/src/styles/chrome.css +938 -48
  91. package/src/styles/components.css +104 -65
  92. package/src/styles/defaults.css +137 -0
  93. package/src/styles/gate.css +21 -10
  94. package/src/styles/primitives.css +97 -35
  95. package/src/styles/sections.css +477 -437
  96. package/src/styles/star-rating.css +1 -4
  97. package/src/tokens/palettes.ts +24 -4
  98. package/src/types.ts +212 -2
  99. package/src/app/CardErrorBoundary.tsx +0 -39
  100. package/src/sections/CTABanner.tsx +0 -93
  101. package/src/sections/DeviceShowcase.tsx +0 -39
  102. package/src/sections/MediaBand.tsx +0 -20
  103. package/src/sections/MenuList.tsx +0 -44
  104. package/src/sections/PressQuotes.tsx +0 -51
  105. 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
- // Filter to countries with emoji support, excluding deleted entries.
39
- // North Korea (PRK) excluded due to international sanctions compliance.
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
- <div className="flex items-center flex-grow gap-2 overflow-hidden">
95
- <div className="inline-flex items-center justify-center w-5 h-5 shrink-0 overflow-hidden rounded-full">
96
- <CircleFlag countryCode={selectedCountry.alpha2.toLowerCase()} height={20} />
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
- <Command className="w-full max-h-[200px] sm:max-h-[270px]">
116
- <CommandList>
117
- <div className="sticky top-0 z-10 bg-popover">
118
- <CommandInput placeholder="Search country..." />
119
- </div>
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
- <div className="flex flex-grow space-x-2 overflow-hidden">
124
- <div className="inline-flex items-center justify-center w-5 h-5 shrink-0">
125
- <Globe size={16} className="text-muted-foreground" />
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
- <div className="flex flex-grow space-x-2 overflow-hidden">
147
- <div className="inline-flex items-center justify-center w-5 h-5 shrink-0 overflow-hidden rounded-full">
148
- <CircleFlag countryCode={option.alpha2.toLowerCase()} height={20} />
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
- }
@@ -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={{ id }}>
111
+ <FormItemContext.Provider value={value}>
80
112
  <div ref={ref} className={cn("space-y-2", className)} {...props} />
81
113
  </FormItemContext.Provider>
82
114
  );
@@ -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={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}
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 } = useFormField();
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 { error, formMessageId } = useFormField();
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;
@@ -54,7 +54,7 @@ export function Pagination({ page, totalPages, onPageChange, className }: Pagina
54
54
  disabled={page <= 1}
55
55
  aria-label="Previous page"
56
56
  >
57
- Prev
57
+ Previous
58
58
  </Button>
59
59
 
60
60
  {pageWindow(page, totalPages).map((item) =>
@@ -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
- <ProgressPrimitive.Root
13
- ref={ref}
14
- className={cn("relative h-4 w-full overflow-hidden rounded-full bg-secondary", className)}
15
- {...props}
16
- >
17
- <ProgressPrimitive.Indicator
18
- className={cn("h-full w-full flex-1 bg-primary transition-all", indicatorClassName)}
19
- style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
20
- />
21
- </ProgressPrimitive.Root>
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 className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
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={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={handleClear}
65
+ onClick={handleClearClick}
53
66
  className="absolute right-3 top-1/2 -translate-y-1/2"
54
67
  aria-label="Clear search"
55
68
  />
@@ -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}
@@ -3,21 +3,68 @@ import * as React from "react";
3
3
 
4
4
  import { cn } from "../lib/utils";
5
5
 
6
- const Slider = React.forwardRef<
7
- React.ElementRef<typeof SliderPrimitive.Root>,
8
- React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>
9
- >(({ className, ...props }, ref) => (
10
- <SliderPrimitive.Root
11
- ref={ref}
12
- className={cn("relative flex w-full touch-none select-none items-center", className)}
13
- {...props}
14
- >
15
- <SliderPrimitive.Track className="relative h-2 w-full grow overflow-hidden rounded-full bg-secondary">
16
- <SliderPrimitive.Range className="absolute h-full bg-primary" />
17
- </SliderPrimitive.Track>
18
- <SliderPrimitive.Thumb 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" />
19
- </SliderPrimitive.Root>
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 };
@@ -25,7 +25,8 @@ export interface ArtifactShellProps {
25
25
  * variant with the sender's lockup and never a site nav or a CTA, because the
26
26
  * document's own close is the ask. There is no footer and no sticky bar by
27
27
  * design: a document ends on its own sign off, and the closing bar is the
28
- * one line allowed after it.
28
+ * one line allowed after it, closing the way a site does, with the copyright
29
+ * in the sender's name on the left and the practice's credit on the right.
29
30
  */
30
31
  export function ArtifactShell({ site, currentPath, stops, children }: ArtifactShellProps) {
31
32
  const { name, href, logo } = site.sender;
@@ -33,8 +34,12 @@ export function ArtifactShell({ site, currentPath, stops, children }: ArtifactSh
33
34
  // and run, then the recipient's mark after a times sign (ui 0.6.0).
34
35
  const recipient = site.recipient.logo;
35
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).
36
41
  return (
37
- <div className="atelic-ui">
42
+ <div className="atelic-ui" data-density="comfortable" data-shell="artifact">
38
43
  <SkipLink />
39
44
  <SiteHeader
40
45
  brand={{ name, href, logo, recipient }}
@@ -43,7 +48,7 @@ export function ArtifactShell({ site, currentPath, stops, children }: ArtifactSh
43
48
  stops={stops}
44
49
  />
45
50
  <main id="main">{children}</main>
46
- <ClosingBar />
51
+ <ClosingBar name={name} />
47
52
  <Watermark />
48
53
  </div>
49
54
  );
@@ -25,17 +25,24 @@ export function ErrorFallback({ error, resetError }: ErrorFallbackProps) {
25
25
  textAlign: "center",
26
26
  }}
27
27
  >
28
- <div style={{ maxWidth: 420 }}>
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://og.atelic.me". */
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
@@ -1,33 +1,88 @@
1
- import type { Brand } from "../types";
1
+ import type { Brand, BrandLogo } from "../types";
2
+ import { hasMark, type ResolvedMark, resolveMark, tintClass } from "./brandMark";
2
3
 
3
4
  export interface BrandLockupProps {
4
5
  brand: Brand;
5
- /** The link's accessible name. Defaults to "<name> home". */
6
+ /**
7
+ * The link's accessible name. Defaults to the words the lockup shows (the
8
+ * brand's name when they are its name in another case), then "home".
9
+ */
6
10
  ariaLabel?: string;
7
11
  }
8
12
 
13
+ /**
14
+ * The glyph tile mark (`logo.tile`): the favicon's design, its letter drawn
15
+ * by the stylesheet from `data-glyph` so it is never text in the link. Were
16
+ * it text, a link reading "K" then "Kestrel Hollow" would show words its
17
+ * name does not hold. Decorative, and hidden from assistive technology.
18
+ */
19
+ export function LogoTile({ glyph }: { glyph: string }) {
20
+ return <span className="logo-tile" data-glyph={glyph} aria-hidden="true" />;
21
+ }
22
+
23
+ function MarkImage({ mark, surface }: { mark: ResolvedMark; surface?: "light" | "dark" }) {
24
+ const className = ["mark", surface && `is-on-${surface}`, tintClass(mark)]
25
+ .filter(Boolean)
26
+ .join(" ");
27
+ return <img className={className} src={mark.src} alt="" />;
28
+ }
29
+
30
+ /**
31
+ * The header's mark: a glyph tile, or the image each surface resolves to
32
+ * (`resolveMark`), one per surface, each shown on its own bar by chrome.css.
33
+ * When both surfaces draw the same image the same way, it is drawn once.
34
+ */
35
+ function Mark({ logo }: { logo?: BrandLogo }) {
36
+ if (logo?.tile) return <LogoTile glyph={logo.tile} />;
37
+ const light = resolveMark(logo, "light");
38
+ const dark = resolveMark(logo, "dark");
39
+ if (!light || !dark) return null;
40
+ if (light.src === dark.src && light.tint === dark.tint) return <MarkImage mark={light} />;
41
+ return (
42
+ <>
43
+ <MarkImage mark={light} surface="light" />
44
+ <MarkImage mark={dark} surface="dark" />
45
+ </>
46
+ );
47
+ }
48
+
49
+ /**
50
+ * The live words beside the mark: the wordmark the logo names, else the
51
+ * brand's name. `wordmark: false` drops them beside artwork that spells the
52
+ * name, and only there: with no mark to stand in, the name stays, so the
53
+ * home link is never empty.
54
+ */
55
+ export function lockupWords(name: string, logo: BrandLogo | undefined): string | null {
56
+ if (logo?.wordmark === false) return hasMark(logo) ? null : name;
57
+ return logo?.wordmark ?? name;
58
+ }
59
+
9
60
  /**
10
61
  * The header's identity as one link: the mark (a glyph tile or an image),
11
62
  * the wordmark, and the trailing run. The image carries empty alt text
12
- * because the link's own label already names it. On a sent artifact the
13
- * recipient's mark follows, after a times sign: "atelic × Wynkoop Athletics",
14
- * the sender's identity and the business the document is for in one lockup.
15
- * The anchor's aria-label folds in the recipient's alt too, since it
16
- * overrides accessible-name computation for every child, image alt included.
63
+ * because the link's own label already names it. A mark is as tall as
64
+ * `--brand-mark-height` and as wide as its own ratio; a site whose artwork is
65
+ * cut per surface passes `onLight` and `onDark`, and a cut is never
66
+ * recolored on its own surface (see `resolveMark` for a surface with none).
67
+ * On a sent artifact the recipient's mark follows, after a times sign:
68
+ * "atelic × Wynkoop Athletics", the sender's identity and the business the
69
+ * document is for in one lockup. The anchor's aria-label folds in the
70
+ * recipient's alt too, since it overrides accessible-name computation for
71
+ * every child, image alt included, and it always holds the words the link
72
+ * shows, so what a reader sees is what a voice user can say.
17
73
  */
18
74
  export function BrandLockup({ brand, ariaLabel }: BrandLockupProps) {
19
75
  const { name, href = "/", logo, recipient } = brand;
20
- const label = ariaLabel ?? (recipient ? `${name} × ${recipient.alt} home` : `${name} home`);
76
+ const wordmark = lockupWords(name, logo);
77
+ // The visible words lead the name. A wordmark that is the name in another
78
+ // case (or a part of it) keeps the name's own spelling.
79
+ const words =
80
+ wordmark === null || name.toLowerCase().includes(wordmark.toLowerCase()) ? name : wordmark;
81
+ const label = ariaLabel ?? (recipient ? `${words} × ${recipient.alt} home` : `${words} home`);
21
82
  return (
22
83
  <a className="nav-logo" href={href} aria-label={label}>
23
- {logo?.tile ? (
24
- <span className="logo-tile" aria-hidden="true">
25
- {logo.tile}
26
- </span>
27
- ) : (
28
- logo?.src && <img className="mark" src={logo.src} alt="" />
29
- )}
30
- <span className="wordmark">{logo?.wordmark ?? name}</span>
84
+ <Mark logo={logo} />
85
+ {wordmark !== null && <span className="wordmark">{wordmark}</span>}
31
86
  {logo?.run && <span className="wordmark-run" aria-hidden="true" />}
32
87
  {recipient && (
33
88
  <>