@atelic-action/ui 3.12.1 → 3.13.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 CHANGED
@@ -14,7 +14,7 @@ Every export, grouped by the entry it is imported from. The gallery column links
14
14
  | `SiteMenu` | `@atelic-action/ui/chrome` | The phone's full screen menu, on a native modal dialog | [#site-menu](https://ui.atelic.me/#site-menu) |
15
15
  | `Footer` | `@atelic-action/ui/chrome` | The site's foot: brand column, nav, address, hours, copyright, credit band | [#footer](https://ui.atelic.me/#footer) |
16
16
  | `CreditBar` | `@atelic-action/ui/chrome` | The developer credit band | [#credit-bar](https://ui.atelic.me/#credit-bar) |
17
- | `StickyCTABar` | `@atelic-action/ui/chrome` | The phone's bottom bar: the call to action and a call shortcut | [#sticky-cta-bar](https://ui.atelic.me/#sticky-cta-bar) |
17
+ | `StickyCTABar` | `@atelic-action/ui/chrome` | The phone's bottom bar: the call to action and a call shortcut, there from the top on an interior page (`fromTop`) and sliding in after a scroll on a hero page | [#sticky-cta-bar](https://ui.atelic.me/#sticky-cta-bar) |
18
18
  | `BrandLockup` | `@atelic-action/ui/chrome` | The header's identity as one link, with the recipient's mark on a sent document | [#brand-lockup](https://ui.atelic.me/#brand-lockup) |
19
19
  | `SkipLink` | `@atelic-action/ui/chrome` | The keyboard user's jump past the chrome | [#skip-link](https://ui.atelic.me/#skip-link) |
20
20
  | `Brand`, `BrandLogo`, `CallToAction`, `HoursRow`, `MenuContact`, `NavLink`, `Phone`, `PostalAddress`, `SiteLink`, `SocialLink`, `PageStop` | `@atelic-action/ui/chrome` | The shapes the chrome renders from (types) | none |
@@ -37,7 +37,7 @@ Every export, grouped by the entry it is imported from. The gallery column links
37
37
  | `GateLogin` | `@atelic-action/ui/components` | The access gate's sign in screen | [#gate-login](https://ui.atelic.me/#gate-login) |
38
38
  | `Watermark` | `@atelic-action/ui/components` | The signed in reader's confidential stamp, pill or tiled | [#watermark](https://ui.atelic.me/#watermark) |
39
39
  | `readCookie`, `Tone` | `@atelic-action/ui/components` | The cookie reader the watermark uses, and the tone type | none |
40
- | `Button`, `Chip`, `Eyebrow`, `Lead`, `SectionHeading` | `@atelic-action/ui/primitives` | The small pieces a page is set in | [#primitives](https://ui.atelic.me/#primitives) |
40
+ | `Button`, `PrimaryButton`, `SecondaryButton`, `Chip`, `Eyebrow`, `Lead`, `SectionHeading` | `@atelic-action/ui/primitives` | The small pieces a page is set in; the two named buttons are the only call to action shapes a page uses | [#primitives](https://ui.atelic.me/#primitives) |
41
41
  | `GradeChip`, `gradeLabel`, `WriteupGrade` | `@atelic-action/ui/artifact` | A section's grade, A to D, as a chip in its color, the letter alone, and the grade type | [#grade-chip](https://ui.atelic.me/#grade-chip) |
42
42
  | `SignOff`, `WriteupPerson` | `@atelic-action/ui/artifact` | The close a document ends on, and the person it names | [#sign-off](https://ui.atelic.me/#sign-off) |
43
43
  | `Shot`, `WriteupShot` | `@atelic-action/ui/artifact` | The owner's own screen, opening the full picture, over its caption; a portrait crop is marked `data-portrait` and held to 200px (1.8in in print) | [#shot](https://ui.atelic.me/#shot) |
@@ -234,6 +234,8 @@ import { Button, SectionHeading } from "@atelic-action/ui/primitives";
234
234
  </Button>;
235
235
  ```
236
236
 
237
+ `PrimaryButton` and `SecondaryButton` (3.13.0) are the two buttons a marketing page uses, by name: the primary is the large primary button with the arrow, the shape `CTASection` closes every page with, and the secondary is the large ghost beside it, always second. A page reaches for those and never picks a variant and a size by hand, so no two pages drift; the header's compact button is the header's own. `Button` stays underneath for the few other shapes (a form's submit, a dark surface).
238
+
237
239
  `Button` is an anchor when it has an `href` and a real button otherwise. It puts the base path from `BasePathProvider` on a root path `href` (0.19.0), so a site served under a prefix needs no wrapper; with no provider above it the `href` renders as given. Its arrow is hidden from the name a screen reader hears.
238
240
 
239
241
  `Bubble` (3.11.0) is the round tile set beside a heading or a numbered step, holding either a lucide icon the caller sizes (`icon`) or a short mono index (`num`, such as "01"); given both, the icon sits inside and the number rides a small badge on the lower right rim, the way an unread count sits on an app icon. It comes in three sizes (`sm`, `md`, `lg`: 36, 48, and 60 pixels across, `md` by default) and lifts its fill for a dark band with `onDark`, the way `Chip` does. It is decoration and wears `aria-hidden`, so the heading beside it carries the meaning, the step's number included.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atelic-action/ui",
3
- "version": "3.12.1",
3
+ "version": "3.13.0",
4
4
  "description": "Shared UI for the Atelic templates: site chrome, base styles, the component library, the access gate, and the app shell they install",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -116,7 +116,9 @@ export function SiteShell({
116
116
  <main id="main" className={heroNav ? undefined : "clears-nav"}>
117
117
  {children}
118
118
  </main>
119
- {stickyCTA && <StickyCTABar primaryCTA={cta} phone={site.phone} />}
119
+ {/* An interior page's first screen has no booking button of its own, so
120
+ the bar is there from the top; the hero home page keeps the slide in. */}
121
+ {stickyCTA && <StickyCTABar primaryCTA={cta} phone={site.phone} fromTop={!heroNav} />}
120
122
  {footer ? (
121
123
  <Footer
122
124
  brand={brand}
@@ -10,25 +10,38 @@ export interface StickyCTABarProps {
10
10
  phone?: Phone;
11
11
  /** Scroll depth in pixels before the bar slides in. Defaults to 520. */
12
12
  threshold?: number;
13
+ /**
14
+ * Show the bar from the first paint, with no scroll. For a page whose
15
+ * first screen carries no booking button of its own (every page but the
16
+ * hero home page), so a lead action is one tap away before anyone scrolls.
17
+ * The home page keeps the slide in, since its hero already holds the button
18
+ * and a bar from the top would put two of them on one screen.
19
+ */
20
+ fromTop?: boolean;
13
21
  /** The call shortcut's accessible name. Defaults to "Call us". */
14
22
  callLabel?: string;
15
23
  }
16
24
 
17
- /** The phone only bottom bar: the primary CTA and a call shortcut, sliding in once scrolled. */
25
+ /** The phone only bottom bar: the primary CTA and a call shortcut, sliding in once scrolled, or there from the top. */
18
26
  export function StickyCTABar({
19
27
  primaryCTA,
20
28
  phone,
21
29
  threshold = 520,
30
+ fromTop = false,
22
31
  callLabel = "Call us",
23
32
  }: StickyCTABarProps) {
24
- const [show, setShow] = useState(false);
33
+ const [show, setShow] = useState(fromTop);
25
34
 
26
35
  useEffect(() => {
36
+ if (fromTop) {
37
+ setShow(true);
38
+ return;
39
+ }
27
40
  const onScroll = () => setShow(window.scrollY > threshold);
28
41
  window.addEventListener("scroll", onScroll, { passive: true });
29
42
  onScroll();
30
43
  return () => window.removeEventListener("scroll", onScroll);
31
- }, [threshold]);
44
+ }, [threshold, fromTop]);
32
45
 
33
46
  return (
34
47
  // Inert while offscreen, so its links take no keyboard focus before it slides in.
@@ -0,0 +1,21 @@
1
+ import type { ButtonProps } from "./Button";
2
+ import { Button } from "./Button";
3
+
4
+ /**
5
+ * The two buttons a marketing page uses, by name, so no page picks a variant
6
+ * and a size by hand and no two pages drift. A page's call to action is the
7
+ * PrimaryButton: the hero's, the one under the case studies, the closing
8
+ * section's, every one the same large primary shape with the arrow. A
9
+ * SecondaryButton is the ghost beside it at the same size, always second.
10
+ * The header's own compact button stays the header's. `Button` remains for
11
+ * the few places that need another shape (a form's submit, a dark surface).
12
+ */
13
+ export type CallToActionProps = Omit<ButtonProps, "variant" | "size" | "arrow">;
14
+
15
+ export function PrimaryButton(props: CallToActionProps) {
16
+ return <Button {...props} variant="primary" size="lg" arrow />;
17
+ }
18
+
19
+ export function SecondaryButton(props: CallToActionProps) {
20
+ return <Button {...props} variant="ghost" size="lg" />;
21
+ }
@@ -1,5 +1,6 @@
1
1
  export { Bubble, type BubbleProps } from "./Bubble";
2
2
  export { Button, type ButtonProps } from "./Button";
3
+ export { type CallToActionProps, PrimaryButton, SecondaryButton } from "./CallToAction";
3
4
  export { Chip, type ChipProps } from "./Chip";
4
5
  export { Eyebrow, type EyebrowProps } from "./Eyebrow";
5
6
  export { ImageFrame, type ImageFrameProps } from "./ImageFrame";
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode } from "react";
2
2
  import { Eyebrow, Lead } from "../primitives";
3
- import { Button } from "../primitives/Button";
3
+ import { PrimaryButton, SecondaryButton } from "../primitives/CallToAction";
4
4
  import type { SiteConfig } from "./siteConfig";
5
5
 
6
6
  export interface CTASectionProps {
@@ -45,13 +45,13 @@ export function CTASection({
45
45
  <h2>{title}</h2>
46
46
  {lead && <Lead className="cta-lead">{lead}</Lead>}
47
47
  <div className="cta-row center">
48
- <Button href={primaryAction.href} newTab={primaryAction.newTab} size="lg" arrow>
48
+ <PrimaryButton href={primaryAction.href} newTab={primaryAction.newTab}>
49
49
  {primaryAction.label}
50
- </Button>
50
+ </PrimaryButton>
51
51
  {secondary && (
52
- <Button href={secondary.href} newTab={secondary.newTab} variant="ghost" size="lg">
52
+ <SecondaryButton href={secondary.href} newTab={secondary.newTab}>
53
53
  {secondary.label}
54
- </Button>
54
+ </SecondaryButton>
55
55
  )}
56
56
  </div>
57
57
  </div>