@stll/ui 0.97.0 → 0.98.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.
@@ -148,15 +148,24 @@ export declare const TabsFace: ({ activeIndex, tabs }: {
148
148
  export type SplitButtonSize = "sm" | "md";
149
149
  /** The quiet chrome around both halves. */
150
150
  export declare const SPLIT_BUTTON_ROOT_CLASS = "group/split hover:border-border focus-within:border-border has-[[data-popup-open]]:border-border inline-flex shrink-0 items-center rounded-lg border border-transparent p-0.5";
151
- /** The primary half, over the `sm` ghost button it is built on. */
151
+ /**
152
+ * The primary half, over the `sm` ghost button it is built on. Grown to the
153
+ * 44px touch target on a coarse pointer, it keeps its content at the end, next
154
+ * to the chevron, so the two glyphs still read as one control.
155
+ */
152
156
  export declare const SPLIT_BUTTON_PRIMARY_CLASS: {
153
- readonly md: "active:bg-accent/80 rounded-md [&_svg]:mx-0 [&_svg]:size-3.5 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3.5 h-8 ps-2 pe-0.5 sm:h-8 pointer-coarse:min-h-11 pointer-coarse:min-w-11";
154
- readonly sm: "active:bg-accent/80 rounded-md [&_svg]:mx-0 [&_svg]:size-3.5 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3.5 h-7 ps-1.5 pe-0.5 sm:h-7 pointer-coarse:min-h-11 pointer-coarse:min-w-11";
157
+ readonly md: "active:bg-accent/80 rounded-md [&_svg]:mx-0 [&_svg]:size-3.5 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3.5 h-8 ps-2 pe-0.5 sm:h-8 pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:justify-end";
158
+ readonly sm: "active:bg-accent/80 rounded-md [&_svg]:mx-0 [&_svg]:size-3.5 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3.5 h-7 ps-1.5 pe-0.5 sm:h-7 pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:justify-end";
155
159
  };
156
- /** The chevron half, over the `sm` ghost button it is built on. */
160
+ /**
161
+ * The chevron half, over the `sm` ghost button it is built on. On a coarse
162
+ * pointer it takes the full touch height but stays a slim column: the primary
163
+ * half already holds the 44px target, and a second 44px column beside it
164
+ * crowds compact bars such as the chat composer on a phone.
165
+ */
157
166
  export declare const SPLIT_BUTTON_TRIGGER_CLASS: {
158
- readonly md: "group-hover/split:bg-muted group-focus-within/split:bg-muted hover:bg-accent active:bg-accent/80 data-popup-open:bg-accent rounded-md [&_svg]:mx-0 h-8 w-4 px-0 sm:h-8 pointer-coarse:min-h-11 pointer-coarse:min-w-11";
159
- readonly sm: "group-hover/split:bg-muted group-focus-within/split:bg-muted hover:bg-accent active:bg-accent/80 data-popup-open:bg-accent rounded-md [&_svg]:mx-0 h-7 w-3.5 px-0 sm:h-7 pointer-coarse:min-h-11 pointer-coarse:min-w-11";
167
+ readonly md: "group-hover/split:bg-muted group-focus-within/split:bg-muted hover:bg-accent active:bg-accent/80 data-popup-open:bg-accent rounded-md [&_svg]:mx-0 h-8 w-4 px-0 sm:h-8 pointer-coarse:min-h-11 pointer-coarse:w-6";
168
+ readonly sm: "group-hover/split:bg-muted group-focus-within/split:bg-muted hover:bg-accent active:bg-accent/80 data-popup-open:bg-accent rounded-md [&_svg]:mx-0 h-7 w-3.5 px-0 sm:h-7 pointer-coarse:min-h-11 pointer-coarse:w-6";
160
169
  };
161
170
  /** The chevron that opens the secondary surface. */
162
171
  export declare const SplitButtonChevron: () => import("react").JSX.Element;
@@ -168,15 +168,24 @@ const TabsFace = ({ activeIndex = 0, tabs }) => /* @__PURE__ */ jsx("span", {
168
168
  });
169
169
  /** The quiet chrome around both halves. */
170
170
  const SPLIT_BUTTON_ROOT_CLASS = "group/split hover:border-border focus-within:border-border has-[[data-popup-open]]:border-border inline-flex shrink-0 items-center rounded-lg border border-transparent p-0.5";
171
- /** The primary half, over the `sm` ghost button it is built on. */
171
+ /**
172
+ * The primary half, over the `sm` ghost button it is built on. Grown to the
173
+ * 44px touch target on a coarse pointer, it keeps its content at the end, next
174
+ * to the chevron, so the two glyphs still read as one control.
175
+ */
172
176
  const SPLIT_BUTTON_PRIMARY_CLASS = {
173
- md: "active:bg-accent/80 rounded-md [&_svg]:mx-0 [&_svg]:size-3.5 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3.5 h-8 ps-2 pe-0.5 sm:h-8 pointer-coarse:min-h-11 pointer-coarse:min-w-11",
174
- sm: "active:bg-accent/80 rounded-md [&_svg]:mx-0 [&_svg]:size-3.5 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3.5 h-7 ps-1.5 pe-0.5 sm:h-7 pointer-coarse:min-h-11 pointer-coarse:min-w-11"
177
+ md: "active:bg-accent/80 rounded-md [&_svg]:mx-0 [&_svg]:size-3.5 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3.5 h-8 ps-2 pe-0.5 sm:h-8 pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:justify-end",
178
+ sm: "active:bg-accent/80 rounded-md [&_svg]:mx-0 [&_svg]:size-3.5 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3.5 h-7 ps-1.5 pe-0.5 sm:h-7 pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:justify-end"
175
179
  };
176
- /** The chevron half, over the `sm` ghost button it is built on. */
180
+ /**
181
+ * The chevron half, over the `sm` ghost button it is built on. On a coarse
182
+ * pointer it takes the full touch height but stays a slim column: the primary
183
+ * half already holds the 44px target, and a second 44px column beside it
184
+ * crowds compact bars such as the chat composer on a phone.
185
+ */
177
186
  const SPLIT_BUTTON_TRIGGER_CLASS = {
178
- md: "group-hover/split:bg-muted group-focus-within/split:bg-muted hover:bg-accent active:bg-accent/80 data-popup-open:bg-accent rounded-md [&_svg]:mx-0 h-8 w-4 px-0 sm:h-8 pointer-coarse:min-h-11 pointer-coarse:min-w-11",
179
- sm: "group-hover/split:bg-muted group-focus-within/split:bg-muted hover:bg-accent active:bg-accent/80 data-popup-open:bg-accent rounded-md [&_svg]:mx-0 h-7 w-3.5 px-0 sm:h-7 pointer-coarse:min-h-11 pointer-coarse:min-w-11"
187
+ md: "group-hover/split:bg-muted group-focus-within/split:bg-muted hover:bg-accent active:bg-accent/80 data-popup-open:bg-accent rounded-md [&_svg]:mx-0 h-8 w-4 px-0 sm:h-8 pointer-coarse:min-h-11 pointer-coarse:w-6",
188
+ sm: "group-hover/split:bg-muted group-focus-within/split:bg-muted hover:bg-accent active:bg-accent/80 data-popup-open:bg-accent rounded-md [&_svg]:mx-0 h-7 w-3.5 px-0 sm:h-7 pointer-coarse:min-h-11 pointer-coarse:w-6"
180
189
  };
181
190
  /** The chevron that opens the secondary surface. */
182
191
  const SplitButtonChevron = () => /* @__PURE__ */ jsx(ChevronDownIcon, {
@@ -2,14 +2,18 @@
2
2
  * A text control is two boxes: the bordered wrapper a caller styles and the
3
3
  * element the text is typed into. The wrapper is what a height applies to and
4
4
  * what the search icon centres on, so the element never states a height of its
5
- * own — it fills whatever the wrapper turns out to be. A size only sets the
6
- * floor (`min-h-*`, always the element's own line box), which is what gives an
7
- * unsized control its height. Give the element a fixed height again and the
8
- * two boxes drift apart the moment a caller sizes the wrapper: the text sits
9
- * at the top of the control while the icon stays centred.
5
+ * own — it stretches across the wrapper's flex line, whatever the wrapper turns
6
+ * out to be. A size only sets the floor (`min-h-*`, always the element's own
7
+ * line box), which is what gives an unsized control its height. Give the
8
+ * element a height again (`h-full` counts: against a wrapper that only has a
9
+ * floor, such as the coarse-pointer `min-h-11`, a percentage resolves to
10
+ * nothing and blocks the stretch) and the two boxes drift apart: the text sits
11
+ * at the top of the control while the icon stays centred. So every wrapper is
12
+ * a flex line, the `unstyled` one too, and a wrapper sized by its caller is
13
+ * filled by the stretch rather than by a percentage.
10
14
  */
11
15
  export declare const INPUT_CONTROL_CLASS_NAME = "border-input bg-background text-foreground ring-ring/24 has-autofill:bg-foreground/4 has-focus-visible:border-ring has-aria-invalid:border-destructive/36 has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 dark:bg-input/32 dark:has-autofill:bg-foreground/8 dark:has-aria-invalid:ring-destructive/24 relative inline-flex w-full rounded-lg border text-base shadow-xs/5 not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] has-focus-visible:ring-[3px] has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none sm:text-sm dark:not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] pointer-coarse:min-h-11";
12
- export declare const INPUT_ELEMENT_CLASS_NAME = "placeholder:text-foreground-placeholder h-full min-h-8.5 w-full min-w-0 rounded-[inherit] px-[calc(--spacing(3)-1px)] leading-8.5 outline-none [transition:background-color_5000000s_ease-in-out_0s] sm:min-h-7.5 sm:leading-7.5";
16
+ export declare const INPUT_ELEMENT_CLASS_NAME = "placeholder:text-foreground-placeholder min-h-8.5 w-full min-w-0 self-stretch rounded-[inherit] px-[calc(--spacing(3)-1px)] leading-8.5 outline-none [transition:background-color_5000000s_ease-in-out_0s] sm:min-h-7.5 sm:leading-7.5";
13
17
  export declare const INPUT_SIZE_CLASS_NAMES: {
14
18
  readonly sm: "min-h-7.5 px-[calc(--spacing(2.5)-1px)] leading-7.5 sm:min-h-6.5 sm:leading-6.5";
15
19
  readonly default: undefined;
@@ -4,14 +4,18 @@ import { CONTROL_SIZE } from "../lib/control-size.js";
4
4
  * A text control is two boxes: the bordered wrapper a caller styles and the
5
5
  * element the text is typed into. The wrapper is what a height applies to and
6
6
  * what the search icon centres on, so the element never states a height of its
7
- * own — it fills whatever the wrapper turns out to be. A size only sets the
8
- * floor (`min-h-*`, always the element's own line box), which is what gives an
9
- * unsized control its height. Give the element a fixed height again and the
10
- * two boxes drift apart the moment a caller sizes the wrapper: the text sits
11
- * at the top of the control while the icon stays centred.
7
+ * own — it stretches across the wrapper's flex line, whatever the wrapper turns
8
+ * out to be. A size only sets the floor (`min-h-*`, always the element's own
9
+ * line box), which is what gives an unsized control its height. Give the
10
+ * element a height again (`h-full` counts: against a wrapper that only has a
11
+ * floor, such as the coarse-pointer `min-h-11`, a percentage resolves to
12
+ * nothing and blocks the stretch) and the two boxes drift apart: the text sits
13
+ * at the top of the control while the icon stays centred. So every wrapper is
14
+ * a flex line, the `unstyled` one too, and a wrapper sized by its caller is
15
+ * filled by the stretch rather than by a percentage.
12
16
  */
13
17
  const INPUT_CONTROL_CLASS_NAME = "border-input bg-background text-foreground ring-ring/24 has-autofill:bg-foreground/4 has-focus-visible:border-ring has-aria-invalid:border-destructive/36 has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 dark:bg-input/32 dark:has-autofill:bg-foreground/8 dark:has-aria-invalid:ring-destructive/24 relative inline-flex w-full rounded-lg border text-base shadow-xs/5 not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] has-focus-visible:ring-[3px] has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none sm:text-sm dark:not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] pointer-coarse:min-h-11";
14
- const INPUT_ELEMENT_CLASS_NAME = "placeholder:text-foreground-placeholder h-full min-h-8.5 w-full min-w-0 rounded-[inherit] px-[calc(--spacing(3)-1px)] leading-8.5 outline-none [transition:background-color_5000000s_ease-in-out_0s] sm:min-h-7.5 sm:leading-7.5";
18
+ const INPUT_ELEMENT_CLASS_NAME = "placeholder:text-foreground-placeholder min-h-8.5 w-full min-w-0 self-stretch rounded-[inherit] px-[calc(--spacing(3)-1px)] leading-8.5 outline-none [transition:background-color_5000000s_ease-in-out_0s] sm:min-h-7.5 sm:leading-7.5";
15
19
  const INPUT_SIZE_CLASS_NAMES = {
16
20
  [CONTROL_SIZE.sm]: "min-h-7.5 px-[calc(--spacing(2.5)-1px)] leading-7.5 sm:min-h-6.5 sm:leading-6.5",
17
21
  [CONTROL_SIZE.default]: void 0,
@@ -3,10 +3,20 @@ import { isStructuredInputType, useContentDir } from "../hooks/use-content-dir.j
3
3
  import { SearchIcon } from "../icons.js";
4
4
  import { CONTROL_SIZE } from "../lib/control-size.js";
5
5
  import { cn } from "../lib/utils.js";
6
- import { INLINE_FIELD_CLASS_NAME, INPUT_ELEMENT_CLASS_NAME, INPUT_SIZE_CLASS_NAMES } from "./input-control.js";
6
+ import { INLINE_FIELD_CLASS_NAME, INPUT_CONTROL_CLASS_NAME, INPUT_ELEMENT_CLASS_NAME, INPUT_SIZE_CLASS_NAMES } from "./input-control.js";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { Input as Input$1 } from "@base-ui/react/input";
9
9
  // src/components/input.tsx
10
+ /**
11
+ * The wrapper's own classes. An `unstyled` control draws no box but is still a
12
+ * flex line, as every control is: the text box stretches across whatever
13
+ * height a caller gives the wrapper (see `INPUT_CONTROL_CLASS_NAME`).
14
+ */
15
+ const controlClassName = ({ inline, unstyled }) => {
16
+ if (inline) return "relative inline-flex w-full";
17
+ if (unstyled) return "inline-flex";
18
+ return INPUT_CONTROL_CLASS_NAME;
19
+ };
10
20
  const Input = ({ className, size = CONTROL_SIZE.default, unstyled = false, inline = false, nativeInput = false, dir, onChange, ...props }) => {
11
21
  const controlSize = typeof size === "number" ? CONTROL_SIZE.default : size;
12
22
  const contentDir = useContentDir({
@@ -20,7 +30,10 @@ const Input = ({ className, size = CONTROL_SIZE.default, unstyled = false, inlin
20
30
  };
21
31
  const inputClassName = cn(inline ? INLINE_FIELD_CLASS_NAME : INPUT_ELEMENT_CLASS_NAME, !inline && INPUT_SIZE_CLASS_NAMES[controlSize], unstyled && !inline && "px-0", props.type === "search" && "ps-8 [&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none");
22
32
  return /* @__PURE__ */ jsxs("span", {
23
- className: cn(inline ? "relative inline-flex w-full" : !unstyled && "border-input bg-background text-foreground ring-ring/24 has-autofill:bg-foreground/4 has-focus-visible:border-ring has-aria-invalid:border-destructive/36 has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 dark:bg-input/32 dark:has-autofill:bg-foreground/8 dark:has-aria-invalid:ring-destructive/24 relative inline-flex w-full rounded-lg border text-base shadow-xs/5 not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] has-focus-visible:ring-[3px] has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none sm:text-sm dark:not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] pointer-coarse:min-h-11", className) || void 0,
33
+ className: cn(controlClassName({
34
+ inline,
35
+ unstyled
36
+ }), className),
24
37
  "data-size": size,
25
38
  "data-slot": "input-control",
26
39
  dir: contentDir.dir,
@@ -0,0 +1,16 @@
1
+ import { OrientationGateFit } from "./orientation-gate-frame.js";
2
+ import { ReactNode } from "react";
3
+ /**
4
+ * `OrientationGate` (./orientation-gate.tsx) for a loading view: the same
5
+ * prompt in the same box, its "show anyway" button a face nothing can press.
6
+ * A loading view cannot know the reader's choice, so its content stays behind
7
+ * the prompt until the loaded view, which does, replaces it.
8
+ */
9
+ export declare const OrientationGateFace: ({ title, description, revealLabel, fit, children }: {
10
+ title: ReactNode;
11
+ description: ReactNode;
12
+ revealLabel: ReactNode;
13
+ fit?: OrientationGateFit | undefined;
14
+ children: ReactNode;
15
+ }) => import("react").JSX.Element;
16
+ export type { OrientationGateFit };
@@ -0,0 +1,23 @@
1
+ import { ButtonFace } from "./control-face.js";
2
+ import { ORIENTATION_GATE_ACTION, OrientationGateFrame } from "./orientation-gate-frame.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ // src/components/orientation-gate-face.tsx
5
+ /**
6
+ * `OrientationGate` (./orientation-gate.tsx) for a loading view: the same
7
+ * prompt in the same box, its "show anyway" button a face nothing can press.
8
+ * A loading view cannot know the reader's choice, so its content stays behind
9
+ * the prompt until the loaded view, which does, replaces it.
10
+ */
11
+ const OrientationGateFace = ({ title, description, revealLabel, fit, children }) => /* @__PURE__ */ jsx(OrientationGateFrame, {
12
+ action: /* @__PURE__ */ jsx(ButtonFace, {
13
+ size: ORIENTATION_GATE_ACTION.size,
14
+ variant: ORIENTATION_GATE_ACTION.variant,
15
+ children: revealLabel
16
+ }),
17
+ description,
18
+ fit,
19
+ revealed: false,
20
+ title,
21
+ children
22
+ });
23
+ export { OrientationGateFace };
@@ -0,0 +1,30 @@
1
+ import { ReactNode } from "react";
2
+ /**
3
+ * The area the prompt fills and centres itself in. `free-space` takes a flex
4
+ * column's free space beside the content's siblings; `container` fills its
5
+ * parent's whole height, for a gate that is all a scroll area holds.
6
+ */
7
+ export type OrientationGateFit = "free-space" | "container";
8
+ /** The "show anyway" button's size and variant, and its face's. */
9
+ export declare const ORIENTATION_GATE_ACTION: {
10
+ readonly size: "sm";
11
+ readonly variant: "outline";
12
+ };
13
+ /**
14
+ * The prompt is for a phone, not for a narrow window: it needs the coarse
15
+ * pointer as well as the portrait viewport below `md`, so a desktop browser
16
+ * docked to the side of a screen keeps its content. Turning the phone hands
17
+ * over to the content with no script, so the prompt also draws in a
18
+ * server-rendered or loading view.
19
+ */
20
+ export declare const OrientationGateFrame: ({ title, description, action, revealed, contentStart, fit, children }: {
21
+ title: ReactNode;
22
+ description: ReactNode;
23
+ /** The "show anyway" button, or its face. */
24
+ action: ReactNode;
25
+ revealed: boolean;
26
+ /** Drawn first in the content once it is revealed (a focus target). */
27
+ contentStart?: ReactNode;
28
+ fit?: OrientationGateFit | undefined;
29
+ children: ReactNode;
30
+ }) => import("react").JSX.Element;
@@ -0,0 +1,63 @@
1
+ import { RotateCwIcon, SmartphoneIcon } from "../icons.js";
2
+ import { cn } from "../lib/utils.js";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ // src/components/orientation-gate-frame.tsx
5
+ const ORIENTATION_GATE_FIT_CLASS = {
6
+ "free-space": "min-h-64 flex-1",
7
+ container: "min-h-[max(--spacing(64),100%)]"
8
+ };
9
+ /** The "show anyway" button's size and variant, and its face's. */
10
+ const ORIENTATION_GATE_ACTION = {
11
+ size: "sm",
12
+ variant: "outline"
13
+ };
14
+ /**
15
+ * The prompt is for a phone, not for a narrow window: it needs the coarse
16
+ * pointer as well as the portrait viewport below `md`, so a desktop browser
17
+ * docked to the side of a screen keeps its content. Turning the phone hands
18
+ * over to the content with no script, so the prompt also draws in a
19
+ * server-rendered or loading view.
20
+ */
21
+ const OrientationGateFrame = ({ title, description, action, revealed, contentStart, fit = "free-space", children }) => /* @__PURE__ */ jsxs(Fragment, { children: [revealed ? null : /* @__PURE__ */ jsxs("div", {
22
+ className: cn("bg-background hidden flex-col items-center justify-center gap-4 px-6 py-8 text-center max-md:portrait:pointer-coarse:flex", ORIENTATION_GATE_FIT_CLASS[fit]),
23
+ "data-slot": "orientation-gate",
24
+ children: [
25
+ /* @__PURE__ */ jsx(RotateToLandscapeGlyph, {}),
26
+ /* @__PURE__ */ jsxs("div", {
27
+ className: "max-w-72 space-y-1",
28
+ children: [/* @__PURE__ */ jsx("h2", {
29
+ className: "text-sm font-medium text-balance",
30
+ children: title
31
+ }), /* @__PURE__ */ jsx("p", {
32
+ className: "text-muted-foreground text-sm text-pretty",
33
+ children: description
34
+ })]
35
+ }),
36
+ action
37
+ ]
38
+ }), /* @__PURE__ */ jsxs("div", {
39
+ className: cn("contents", revealed ? void 0 : "max-md:portrait:pointer-coarse:hidden"),
40
+ "data-slot": "orientation-gate-content",
41
+ children: [revealed ? contentStart : null, children]
42
+ })] });
43
+ /**
44
+ * A phone turning from portrait to landscape inside the arrow that says which
45
+ * way: the two turn a quarter together, rest, fade and start again. Transform
46
+ * and opacity only. Under reduced motion it is a still picture of the upright
47
+ * phone in its arrow, which says the same thing.
48
+ */
49
+ const RotateToLandscapeGlyph = () => /* @__PURE__ */ jsxs("span", {
50
+ "aria-hidden": "true",
51
+ className: "text-muted-foreground relative flex size-14 shrink-0 items-center justify-center",
52
+ "data-slot": "rotate-to-landscape-glyph",
53
+ children: [/* @__PURE__ */ jsx(RotateCwIcon, {
54
+ className: "animate-rotate-hint absolute inset-0 size-full motion-reduce:animate-none",
55
+ "data-slot": "rotate-to-landscape-arrow",
56
+ strokeWidth: 1.25
57
+ }), /* @__PURE__ */ jsx(SmartphoneIcon, {
58
+ className: "animate-rotate-hint size-6 motion-reduce:animate-none",
59
+ "data-slot": "rotate-to-landscape-device",
60
+ strokeWidth: 1.5
61
+ })]
62
+ });
63
+ export { ORIENTATION_GATE_ACTION, OrientationGateFrame };
@@ -0,0 +1,36 @@
1
+ import { OrientationGateFit } from "./orientation-gate-frame.js";
2
+ import { ReactNode } from "react";
3
+ export type OrientationGateProps = {
4
+ /** The gate's heading: what to do ("Rotate to landscape"). */
5
+ title: ReactNode;
6
+ /** One line on what the reader can do: turn the phone, or show it anyway. */
7
+ description: ReactNode;
8
+ /** The button that shows the content upright all the same. */
9
+ revealLabel: ReactNode;
10
+ /**
11
+ * The content's name ("Table"). Once the reader has asked to see it, their
12
+ * focus lands on it, at the start of the content, where the button they
13
+ * pressed was.
14
+ */
15
+ contentLabel: ReactNode;
16
+ /**
17
+ * Whether the reader chose to see the content upright. The gate then steps
18
+ * aside for good and the content renders at every orientation; the caller
19
+ * owns how long that choice lasts.
20
+ */
21
+ revealed: boolean;
22
+ /** Shows the content upright: the caller records the choice. */
23
+ onReveal: () => void;
24
+ /** The area the prompt fills and centres itself in; `free-space` by default. */
25
+ fit?: OrientationGateFit | undefined;
26
+ children: ReactNode;
27
+ };
28
+ /**
29
+ * Content too wide for a phone held upright (a table), behind a prompt to
30
+ * turn the phone sideways, and a button that shows it upright anyway. The
31
+ * prompt fills the area it is given (see `fit`) and centres itself in it, so
32
+ * it sits in the middle of whatever is left below the caller's toolbar. A
33
+ * loading view draws `OrientationGateFace` (@stll/ui/orientation-gate-face).
34
+ */
35
+ export declare const OrientationGate: ({ title, description, revealLabel, contentLabel, revealed, onReveal, fit, children }: OrientationGateProps) => import("react").JSX.Element;
36
+ export type { OrientationGateFit };
@@ -0,0 +1,45 @@
1
+ "use client";
2
+ import { Button } from "./button.js";
3
+ import { ORIENTATION_GATE_ACTION, OrientationGateFrame } from "./orientation-gate-frame.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { useRef } from "react";
6
+ // src/components/orientation-gate.tsx
7
+ /**
8
+ * Content too wide for a phone held upright (a table), behind a prompt to
9
+ * turn the phone sideways, and a button that shows it upright anyway. The
10
+ * prompt fills the area it is given (see `fit`) and centres itself in it, so
11
+ * it sits in the middle of whatever is left below the caller's toolbar. A
12
+ * loading view draws `OrientationGateFace` (@stll/ui/orientation-gate-face).
13
+ */
14
+ const OrientationGate = ({ title, description, revealLabel, contentLabel, revealed, onReveal, fit, children }) => {
15
+ const revealPressedRef = useRef(false);
16
+ return /* @__PURE__ */ jsx(OrientationGateFrame, {
17
+ action: /* @__PURE__ */ jsx(Button, {
18
+ onClick: () => {
19
+ revealPressedRef.current = true;
20
+ onReveal();
21
+ },
22
+ size: ORIENTATION_GATE_ACTION.size,
23
+ variant: ORIENTATION_GATE_ACTION.variant,
24
+ children: revealLabel
25
+ }),
26
+ contentStart: /* @__PURE__ */ jsx("span", {
27
+ className: "sr-only",
28
+ "data-slot": "orientation-gate-content-start",
29
+ ref: (node) => {
30
+ if (node !== null && revealPressedRef.current) {
31
+ revealPressedRef.current = false;
32
+ node.focus({ preventScroll: true });
33
+ }
34
+ },
35
+ tabIndex: -1,
36
+ children: contentLabel
37
+ }),
38
+ description,
39
+ fit,
40
+ revealed,
41
+ title,
42
+ children
43
+ });
44
+ };
45
+ export { OrientationGate };
@@ -9,6 +9,9 @@ import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
9
9
  * honest answer is to make it wrap. An element that genuinely needs the axis
10
10
  * (a wide table, a code block) carries its own `overflow-x-auto` and scrolls
11
11
  * locally, inside the column.
12
+ *
13
+ * The primitive sets `overflow: scroll` inline on the viewport, which a plain
14
+ * class cannot override, so the vertical axis lock is `!important`.
12
15
  */
13
16
  type ScrollAreaAxis = "both" | "vertical";
14
17
  declare const ScrollArea: ({ axis, className, children, scrollFade, scrollbarClassName, scrollbarGutter, viewportRef, ...props }: ScrollArea$1.Root.Props & {
@@ -5,7 +5,7 @@ import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
5
5
  // src/components/scroll-area.tsx
6
6
  const AXIS_VIEWPORT_CLASS = {
7
7
  both: "",
8
- vertical: "overflow-x-hidden"
8
+ vertical: "overflow-x-hidden!"
9
9
  };
10
10
  const ScrollArea = ({ axis = "both", className, children, scrollFade = false, scrollbarClassName, scrollbarGutter = false, viewportRef, ...props }) => /* @__PURE__ */ jsxs(ScrollArea$1.Root, {
11
11
  className: cn("flex size-full min-h-0 flex-col", className),
@@ -9,11 +9,5 @@ type SearchFieldProps = Omit<React.ComponentProps<typeof InputGroupInput>, "onCh
9
9
  /** Class for the outer group (width, margins). */
10
10
  groupClassName?: string;
11
11
  };
12
- /**
13
- * Filter-as-you-type search box: leading magnifier, clear button once there is
14
- * a query, and Escape clears before it blurs. The caller owns the query state
15
- * and the matching; keep matching local and instant for lists under a few
16
- * hundred rows.
17
- */
18
- declare const SearchField: ({ value, onValueChange, clearLabel, disabledReason, groupClassName, className, onKeyDown, ...props }: SearchFieldProps) => React.JSX.Element;
12
+ declare const SearchField: ({ value, onValueChange, clearLabel, disabledReason, groupClassName, className, onKeyDown, size, ...props }: SearchFieldProps) => React.JSX.Element;
19
13
  export { SearchField, type SearchFieldProps };
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { XIcon } from "../icons.js";
3
+ import { CONTROL_SIZE } from "../lib/control-size.js";
3
4
  import { cn } from "../lib/utils.js";
4
5
  import { Button } from "./button.js";
5
6
  import { InputGroup, InputGroupAddon, InputGroupInput } from "./input-group.js";
@@ -10,14 +11,30 @@ import { jsx, jsxs } from "react/jsx-runtime";
10
11
  * a query, and Escape clears before it blurs. The caller owns the query state
11
12
  * and the matching; keep matching local and instant for lists under a few
12
13
  * hundred rows.
14
+ *
15
+ * On a phone a field that stands on its own grows to a finger's 44px. A
16
+ * `size="sm"` field sits in a toolbar row beside `xs` buttons, so it keeps its
17
+ * compact height there: at 44px it would fill the row from border to border.
18
+ * Under a coarse pointer it reaches 44px all the same, through an invisible
19
+ * area above and below the drawn field (never to the sides, where the row's
20
+ * buttons sit) that focuses the input.
13
21
  */
14
- const SearchField = ({ value, onValueChange, clearLabel, disabledReason, groupClassName, className, onKeyDown, ...props }) => /* @__PURE__ */ jsxs(InputGroup, {
15
- className: cn("min-h-11 sm:min-h-0", groupClassName),
22
+ const COMPACT_TOUCH_TARGET_CLASS = "isolate pointer-coarse:after:absolute pointer-coarse:after:inset-x-0 pointer-coarse:after:top-1/2 pointer-coarse:after:-z-10 pointer-coarse:after:min-h-11 pointer-coarse:after:-translate-y-1/2";
23
+ /** A press on the group's own area, outside its input and buttons, types. */
24
+ const focusInputOnGroupPress = (event) => {
25
+ if (event.target !== event.currentTarget) return;
26
+ event.preventDefault();
27
+ event.currentTarget.querySelector("input")?.focus();
28
+ };
29
+ const SearchField = ({ value, onValueChange, clearLabel, disabledReason, groupClassName, className, onKeyDown, size = CONTROL_SIZE.default, ...props }) => /* @__PURE__ */ jsxs(InputGroup, {
30
+ className: cn(size === CONTROL_SIZE.sm ? COMPACT_TOUCH_TARGET_CLASS : "min-h-11 sm:min-h-0", groupClassName),
31
+ onMouseDown: focusInputOnGroupPress,
16
32
  children: [/* @__PURE__ */ jsx(InputGroupInput, {
17
33
  autoComplete: "off",
18
34
  spellCheck: false,
19
35
  ...props,
20
- className: cn("max-sm:h-11 max-sm:leading-11", className),
36
+ className: cn(size !== CONTROL_SIZE.sm && "max-sm:h-11 max-sm:leading-11", className),
37
+ size,
21
38
  onChange: (event) => {
22
39
  onValueChange(event.target.value);
23
40
  },
@@ -10,9 +10,10 @@ export declare const ViewChromeBar: ({ className, ...props }: ComponentProps<"di
10
10
  * one line and scroll horizontally once they outgrow half the row on a phone,
11
11
  * or two thirds of it from `md` up, so the tabs beside them always keep room
12
12
  * for a whole tab and scroll, and a control past the edge is scrolled to rather
13
- * than clipped.
13
+ * than clipped. The scrollbar stays hidden, so an edge with controls past it
14
+ * fades out rather than cutting a control off flush with the screen's edge.
14
15
  */
15
- export declare const ViewToolbarChrome: ({ className, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
16
+ export declare const ViewToolbarChrome: ({ className, ref, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
16
17
  /** The face of `ViewFilterButton` (./view-toolbar.tsx), for a loading view. */
17
18
  export declare const ViewFilterButtonFace: () => import("react").JSX.Element;
18
19
  /**
@@ -1,4 +1,7 @@
1
+ "use client";
2
+ import { useComposedRefs } from "../effects/refs.js";
1
3
  import { FilterIcon } from "../icons.js";
4
+ import { SCROLL_EDGE_FADE_CLASS, fadeScrollEdges } from "../lib/scroll-edge-fade.js";
2
5
  import { cn } from "../lib/utils.js";
3
6
  import { ButtonFace } from "./control-face.js";
4
7
  import { VIEW_FILTER_BUTTON, VIEW_FILTER_CHIP, VIEW_FILTER_ICON_CLASS_NAME } from "./view-toolbar-classes.js";
@@ -18,12 +21,17 @@ const ViewChromeBar = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
18
21
  * one line and scroll horizontally once they outgrow half the row on a phone,
19
22
  * or two thirds of it from `md` up, so the tabs beside them always keep room
20
23
  * for a whole tab and scroll, and a control past the edge is scrolled to rather
21
- * than clipped.
24
+ * than clipped. The scrollbar stays hidden, so an edge with controls past it
25
+ * fades out rather than cutting a control off flush with the screen's edge.
22
26
  */
23
- const ViewToolbarChrome = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
24
- className: cn("ms-auto flex max-w-1/2 min-w-0 shrink-0 [scrollbar-width:none] flex-nowrap items-center gap-1 overflow-x-auto px-2 py-1 [-ms-overflow-style:none] md:max-w-2/3 [&::-webkit-scrollbar]:hidden", className),
25
- ...props
26
- });
27
+ const ViewToolbarChrome = ({ className, ref, ...props }) => {
28
+ const stripRef = useComposedRefs(fadeScrollEdges, ref);
29
+ return /* @__PURE__ */ jsx("div", {
30
+ className: cn("ms-auto flex max-w-1/2 min-w-0 shrink-0 [scrollbar-width:none] flex-nowrap items-center gap-1 overflow-x-auto px-2 py-1 [-ms-overflow-style:none] md:max-w-2/3 [&::-webkit-scrollbar]:hidden", SCROLL_EDGE_FADE_CLASS, className),
31
+ ref: stripRef,
32
+ ...props
33
+ });
34
+ };
27
35
  /** The face of `ViewFilterButton` (./view-toolbar.tsx), for a loading view. */
28
36
  const ViewFilterButtonFace = () => /* @__PURE__ */ jsx(ButtonFace, {
29
37
  size: VIEW_FILTER_BUTTON.size,
@@ -186,6 +186,34 @@
186
186
  transform: scale(1);
187
187
  }
188
188
  }
189
+ /* RotateToLandscapeGlyph: the phone and its arrow turn a quarter, rest
190
+ on their side, fade, and come back upright. Transform and opacity only;
191
+ the component stills it under reduced motion. */
192
+ --animate-rotate-hint: rotate-hint 3.2s var(--ease-in-out) infinite;
193
+ @keyframes rotate-hint {
194
+ 0%,
195
+ 15% {
196
+ opacity: 1;
197
+ transform: rotate(0deg);
198
+ }
199
+ 45%,
200
+ 75% {
201
+ opacity: 1;
202
+ transform: rotate(90deg);
203
+ }
204
+ 88% {
205
+ opacity: 0;
206
+ transform: rotate(90deg);
207
+ }
208
+ 89% {
209
+ opacity: 0;
210
+ transform: rotate(0deg);
211
+ }
212
+ 100% {
213
+ opacity: 1;
214
+ transform: rotate(0deg);
215
+ }
216
+ }
189
217
  /* StatusMark: the running arc turns (paused, never reset, when it stops);
190
218
  under reduced motion a running ring breathes instead. Its state
191
219
  changes are transitions, owned by the component. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/ui",
3
- "version": "0.97.0",
3
+ "version": "0.98.0",
4
4
  "description": "Stella's design system: bidi-aware React primitives built on Base UI, the dockable inspector pane, and the Tailwind v4 theme they are styled with.",
5
5
  "keywords": [
6
6
  "base-ui",
@@ -546,6 +546,14 @@
546
546
  "types": "./dist/components/middle-truncate.d.ts",
547
547
  "import": "./dist/components/middle-truncate.js"
548
548
  },
549
+ "./orientation-gate": {
550
+ "types": "./dist/components/orientation-gate.d.ts",
551
+ "import": "./dist/components/orientation-gate.js"
552
+ },
553
+ "./orientation-gate-face": {
554
+ "types": "./dist/components/orientation-gate-face.d.ts",
555
+ "import": "./dist/components/orientation-gate-face.js"
556
+ },
549
557
  "./outcome-screen": {
550
558
  "types": "./dist/components/outcome-screen.d.ts",
551
559
  "import": "./dist/components/outcome-screen.js"