@passui/react 0.1.32 → 0.1.34

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.
@@ -1,4 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
+ export type BreadcrumbSize = "sm" | "md";
2
3
  export interface BreadcrumbItem {
3
4
  label: string;
4
5
  href?: string;
@@ -11,6 +12,8 @@ export interface BreadcrumbProps {
11
12
  renderLink?: (item: BreadcrumbItem & {
12
13
  href: string;
13
14
  }) => ReactNode;
15
+ /** Text scale. @default "md" */
16
+ size?: BreadcrumbSize;
14
17
  }
15
18
  /** Ancestors stay links; the final item identifies the current page. */
16
- export declare function Breadcrumb({ label, items, className, renderLink }: BreadcrumbProps): import("react").JSX.Element;
19
+ export declare function Breadcrumb({ label, items, className, renderLink, size }: BreadcrumbProps): import("react").JSX.Element;
@@ -1,5 +1,8 @@
1
1
  import type { ComponentProps } from "react";
2
+ export type KeyboardShortcutSize = "sm" | "md";
2
3
  export interface KeyboardShortcutProps extends ComponentProps<"kbd"> {
4
+ /** Keycap padding density. Text stays at caption2 in both sizes. @default "md" */
5
+ size?: KeyboardShortcutSize;
3
6
  }
4
7
  /** A quiet keycap for a shortcut supplied and localized by the application. */
5
- export declare function KeyboardShortcut({ className, ...props }: KeyboardShortcutProps): import("react").JSX.Element;
8
+ export declare function KeyboardShortcut({ size, className, ...props }: KeyboardShortcutProps): import("react").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import { type HTMLAttributes, type ReactNode } from "react";
2
+ export type SectionSize = "sm" | "md" | "lg";
2
3
  export interface SectionProps extends HTMLAttributes<HTMLElement> {
3
4
  /** Optional group heading and accessible name. */
4
5
  title?: string;
@@ -6,10 +7,12 @@ export interface SectionProps extends HTMLAttributes<HTMLElement> {
6
7
  footer?: ReactNode;
7
8
  /** Rows, typically LabeledContent. */
8
9
  children?: ReactNode;
10
+ /** Title and footer text scale + padding. @default "md" */
11
+ size?: SectionSize;
9
12
  }
10
13
  /**
11
14
  * A titled, inset group of rows with an optional footer, as in iOS Settings
12
15
  * and SwiftUI's grouped `List` with `Section(header:footer:)`. Rows are
13
16
  * usually `LabeledContent`; dividers between them come for free.
14
17
  */
15
- export declare function Section({ title, footer, children, className, ...props }: SectionProps): import("react").JSX.Element;
18
+ export declare function Section({ title, footer, children, className, size, ...props }: SectionProps): import("react").JSX.Element;
@@ -5,10 +5,13 @@ declare const dots: {
5
5
  readonly offline: "bg-label-tertiary";
6
6
  };
7
7
  export type StatusIndicatorState = keyof typeof dots;
8
+ export type StatusIndicatorSize = "sm" | "md";
8
9
  export interface StatusIndicatorProps extends HTMLAttributes<HTMLSpanElement> {
9
10
  /** Visual treatment of the status dot. */
10
11
  state: StatusIndicatorState;
11
12
  children: ReactNode;
13
+ /** Dot diameter and text scale. @default "md" */
14
+ size?: StatusIndicatorSize;
12
15
  }
13
- export declare function StatusIndicator({ state, children, className, ...props }: StatusIndicatorProps): import("react").JSX.Element;
16
+ export declare function StatusIndicator({ state, children, size, className, ...props }: StatusIndicatorProps): import("react").JSX.Element;
14
17
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@passui/react",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "description": "Passui: native React controls, design tokens, presentation and appearance.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,6 +1,13 @@
1
1
  import type { ReactNode } from "react"
2
2
  import { cn } from "../../lib/class-names"
3
3
 
4
+ export type BreadcrumbSize = "sm" | "md"
5
+
6
+ const sizes: Record<BreadcrumbSize, string> = {
7
+ sm: "text-caption",
8
+ md: "text-footnote",
9
+ }
10
+
4
11
  export interface BreadcrumbItem {
5
12
  label: string
6
13
  href?: string
@@ -11,12 +18,19 @@ export interface BreadcrumbProps {
11
18
  className?: string
12
19
  /** Integrate a client router without nesting interactive elements. */
13
20
  renderLink?: (item: BreadcrumbItem & { href: string }) => ReactNode
21
+ /** Text scale. @default "md" */
22
+ size?: BreadcrumbSize
14
23
  }
15
24
  /** Ancestors stay links; the final item identifies the current page. */
16
- export function Breadcrumb({ label, items, className, renderLink }: BreadcrumbProps) {
25
+ export function Breadcrumb({ label, items, className, renderLink, size = "md" }: BreadcrumbProps) {
17
26
  return (
18
27
  <nav aria-label={label} className={cn("not-typeset", className)}>
19
- <ol className="m-0 flex list-none flex-wrap items-center gap-x-2 gap-y-1 p-0 text-footnote text-label-secondary">
28
+ <ol
29
+ className={cn(
30
+ "m-0 flex list-none flex-wrap items-center gap-x-2 gap-y-1 p-0 text-label-secondary",
31
+ sizes[size]
32
+ )}
33
+ >
20
34
  {items.map((item, index) => (
21
35
  <li
22
36
  key={`${index}-${item.label}`}
@@ -1,15 +1,26 @@
1
1
  import type { ComponentProps } from "react"
2
2
  import { cn } from "../../lib/class-names"
3
3
 
4
- export interface KeyboardShortcutProps extends ComponentProps<"kbd"> {}
4
+ export type KeyboardShortcutSize = "sm" | "md"
5
+
6
+ const sizes: Record<KeyboardShortcutSize, string> = {
7
+ sm: "px-1 py-0 text-caption2",
8
+ md: "px-1.5 py-0.5 text-caption2",
9
+ }
10
+
11
+ export interface KeyboardShortcutProps extends ComponentProps<"kbd"> {
12
+ /** Keycap padding density. Text stays at caption2 in both sizes. @default "md" */
13
+ size?: KeyboardShortcutSize
14
+ }
5
15
 
6
16
  /** A quiet keycap for a shortcut supplied and localized by the application. */
7
- export function KeyboardShortcut({ className, ...props }: KeyboardShortcutProps) {
17
+ export function KeyboardShortcut({ size = "md", className, ...props }: KeyboardShortcutProps) {
8
18
  return (
9
19
  <kbd
10
20
  {...props}
11
21
  className={cn(
12
- "inline-flex shrink-0 items-center rounded-md border border-separator/70 bg-fill/50 px-1.5 py-0.5 font-mono text-caption2 leading-none text-label-secondary",
22
+ "inline-flex shrink-0 items-center rounded-md border border-separator/70 bg-fill/50 font-mono leading-none text-label-secondary",
23
+ sizes[size],
13
24
  className
14
25
  )}
15
26
  />
@@ -1,6 +1,20 @@
1
1
  import { useId, type HTMLAttributes, type ReactNode } from "react"
2
2
  import { cn } from "../../lib/class-names"
3
3
 
4
+ export type SectionSize = "sm" | "md" | "lg"
5
+
6
+ const titleSizes: Record<SectionSize, string> = {
7
+ sm: "px-3 text-caption",
8
+ md: "px-4 text-footnote",
9
+ lg: "px-5 text-subheadline",
10
+ }
11
+
12
+ const footerSizes: Record<SectionSize, string> = {
13
+ sm: "px-3",
14
+ md: "px-4",
15
+ lg: "px-5",
16
+ }
17
+
4
18
  export interface SectionProps extends HTMLAttributes<HTMLElement> {
5
19
  /** Optional group heading and accessible name. */
6
20
  title?: string
@@ -8,6 +22,8 @@ export interface SectionProps extends HTMLAttributes<HTMLElement> {
8
22
  footer?: ReactNode
9
23
  /** Rows, typically LabeledContent. */
10
24
  children?: ReactNode
25
+ /** Title and footer text scale + padding. @default "md" */
26
+ size?: SectionSize
11
27
  }
12
28
 
13
29
  /**
@@ -15,7 +31,14 @@ export interface SectionProps extends HTMLAttributes<HTMLElement> {
15
31
  * and SwiftUI's grouped `List` with `Section(header:footer:)`. Rows are
16
32
  * usually `LabeledContent`; dividers between them come for free.
17
33
  */
18
- export function Section({ title, footer, children, className, ...props }: SectionProps) {
34
+ export function Section({
35
+ title,
36
+ footer,
37
+ children,
38
+ className,
39
+ size = "md",
40
+ ...props
41
+ }: SectionProps) {
19
42
  const headingId = useId()
20
43
  return (
21
44
  <section
@@ -24,7 +47,10 @@ export function Section({ title, footer, children, className, ...props }: Sectio
24
47
  {...props}
25
48
  >
26
49
  {title && (
27
- <h2 id={headingId} className="px-4 text-footnote font-medium text-label-tertiary">
50
+ <h2
51
+ id={headingId}
52
+ className={cn(titleSizes[size], "font-medium text-label-tertiary")}
53
+ >
28
54
  {title}
29
55
  </h2>
30
56
  )}
@@ -35,7 +61,14 @@ export function Section({ title, footer, children, className, ...props }: Sectio
35
61
  </div>
36
62
  ) : null}
37
63
  {footer && (
38
- <div className="px-4 text-caption leading-snug text-label-tertiary">{footer}</div>
64
+ <div
65
+ className={cn(
66
+ footerSizes[size],
67
+ "text-caption leading-snug text-label-tertiary"
68
+ )}
69
+ >
70
+ {footer}
71
+ </div>
39
72
  )}
40
73
  </section>
41
74
  )
@@ -8,20 +8,43 @@ const dots = {
8
8
  } as const
9
9
 
10
10
  export type StatusIndicatorState = keyof typeof dots
11
+ export type StatusIndicatorSize = "sm" | "md"
12
+
13
+ const dotSizes: Record<StatusIndicatorSize, string> = {
14
+ sm: "size-[6px]",
15
+ md: "size-[7px]",
16
+ }
17
+
18
+ const textSizes: Record<StatusIndicatorSize, string> = {
19
+ sm: "text-caption",
20
+ md: "text-footnote",
21
+ }
11
22
 
12
23
  export interface StatusIndicatorProps extends HTMLAttributes<HTMLSpanElement> {
13
24
  /** Visual treatment of the status dot. */
14
25
  state: StatusIndicatorState
15
26
  children: ReactNode
27
+ /** Dot diameter and text scale. @default "md" */
28
+ size?: StatusIndicatorSize
16
29
  }
17
30
 
18
- export function StatusIndicator({ state, children, className, ...props }: StatusIndicatorProps) {
31
+ export function StatusIndicator({
32
+ state,
33
+ children,
34
+ size = "md",
35
+ className,
36
+ ...props
37
+ }: StatusIndicatorProps) {
19
38
  return (
20
39
  <span
21
- className={cn("flex items-center gap-1.5 text-footnote text-label-tertiary", className)}
40
+ className={cn(
41
+ "flex items-center gap-1.5 text-label-tertiary",
42
+ textSizes[size],
43
+ className
44
+ )}
22
45
  {...props}
23
46
  >
24
- <span aria-hidden="true" className={cn("size-[7px] rounded-full", dots[state])} />
47
+ <span aria-hidden="true" className={cn(dotSizes[size], "rounded-full", dots[state])} />
25
48
  {children}
26
49
  </span>
27
50
  )