@passui/react 0.1.31 → 0.1.33
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/dist/types/src/components/breadcrumb/breadcrumb.d.ts +4 -1
- package/dist/types/src/components/section/section.d.ts +4 -1
- package/dist/types/src/components/skeleton/skeleton.d.ts +4 -1
- package/dist/types/src/components/stat-tile/stat-tile.d.ts +4 -1
- package/package.json +1 -1
- package/src/components/breadcrumb/breadcrumb.tsx +16 -2
- package/src/components/section/section.tsx +36 -3
- package/src/components/skeleton/skeleton.tsx +12 -2
- package/src/components/stat-tile/stat-tile.tsx +24 -4
|
@@ -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,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;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { ComponentProps } from "react";
|
|
2
|
+
export type SkeletonSize = "sm" | "md" | "lg";
|
|
2
3
|
export interface SkeletonProps extends ComponentProps<"div"> {
|
|
3
4
|
label?: string;
|
|
5
|
+
/** Minimum height and rounding. @default "md" */
|
|
6
|
+
size?: SkeletonSize;
|
|
4
7
|
}
|
|
5
8
|
/** A loading placeholder that becomes still when Reduce Motion is enabled. */
|
|
6
|
-
export declare function Skeleton({ label, className, ...props }: SkeletonProps): import("react").JSX.Element;
|
|
9
|
+
export declare function Skeleton({ label, size, className, ...props }: SkeletonProps): import("react").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
export type StatTileTone = "critical";
|
|
3
|
+
export type StatTileSize = "sm" | "md" | "lg";
|
|
3
4
|
export interface StatTileProps {
|
|
4
5
|
label: string;
|
|
5
6
|
value: number;
|
|
@@ -12,6 +13,8 @@ export interface StatTileProps {
|
|
|
12
13
|
active?: boolean;
|
|
13
14
|
/** Custom classes for the tile container. */
|
|
14
15
|
className?: string;
|
|
16
|
+
/** Tile padding and number scale. @default "md" */
|
|
17
|
+
size?: StatTileSize;
|
|
15
18
|
}
|
|
16
19
|
/** One number with its label, optionally a toggle. */
|
|
17
|
-
export declare function StatTile({ label, value, caption, tone, onClick, active, className, }: StatTileProps): import("react").JSX.Element;
|
|
20
|
+
export declare function StatTile({ label, value, caption, tone, onClick, active, className, size, }: StatTileProps): import("react").JSX.Element;
|
package/package.json
CHANGED
|
@@ -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
|
|
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,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({
|
|
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
|
|
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
|
|
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
|
)
|
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
import type { ComponentProps } from "react"
|
|
2
2
|
import { cn } from "../../lib/class-names"
|
|
3
3
|
|
|
4
|
+
export type SkeletonSize = "sm" | "md" | "lg"
|
|
5
|
+
|
|
6
|
+
const minHeights: Record<SkeletonSize, string> = {
|
|
7
|
+
sm: "min-h-3 rounded-md",
|
|
8
|
+
md: "min-h-4 rounded-md",
|
|
9
|
+
lg: "min-h-6 rounded-lg",
|
|
10
|
+
}
|
|
11
|
+
|
|
4
12
|
export interface SkeletonProps extends ComponentProps<"div"> {
|
|
5
13
|
label?: string
|
|
14
|
+
/** Minimum height and rounding. @default "md" */
|
|
15
|
+
size?: SkeletonSize
|
|
6
16
|
}
|
|
7
17
|
/** A loading placeholder that becomes still when Reduce Motion is enabled. */
|
|
8
|
-
export function Skeleton({ label, className, ...props }: SkeletonProps) {
|
|
18
|
+
export function Skeleton({ label, size = "md", className, ...props }: SkeletonProps) {
|
|
9
19
|
return (
|
|
10
20
|
<div
|
|
11
21
|
{...props}
|
|
12
22
|
role={label ? "status" : undefined}
|
|
13
23
|
aria-hidden={label ? undefined : true}
|
|
14
|
-
className={cn("
|
|
24
|
+
className={cn("bg-fill motion-safe:animate-pulse", minHeights[size], className)}
|
|
15
25
|
>
|
|
16
26
|
{label && <span className="sr-only">{label}</span>}
|
|
17
27
|
</div>
|
|
@@ -2,6 +2,13 @@ import type { ReactNode } from "react"
|
|
|
2
2
|
import { cn } from "../../lib/class-names"
|
|
3
3
|
|
|
4
4
|
export type StatTileTone = "critical"
|
|
5
|
+
export type StatTileSize = "sm" | "md" | "lg"
|
|
6
|
+
|
|
7
|
+
const tileSizes: Record<StatTileSize, { padding: string; valueText: string; labelText: string }> = {
|
|
8
|
+
sm: { padding: "p-3", valueText: "text-title3", labelText: "text-caption" },
|
|
9
|
+
md: { padding: "p-4", valueText: "text-title1", labelText: "text-footnote" },
|
|
10
|
+
lg: { padding: "p-5", valueText: "text-title", labelText: "text-subheadline" },
|
|
11
|
+
}
|
|
5
12
|
|
|
6
13
|
export interface StatTileProps {
|
|
7
14
|
label: string
|
|
@@ -15,6 +22,8 @@ export interface StatTileProps {
|
|
|
15
22
|
active?: boolean
|
|
16
23
|
/** Custom classes for the tile container. */
|
|
17
24
|
className?: string
|
|
25
|
+
/** Tile padding and number scale. @default "md" */
|
|
26
|
+
size?: StatTileSize
|
|
18
27
|
}
|
|
19
28
|
|
|
20
29
|
/** One number with its label, optionally a toggle. */
|
|
@@ -26,18 +35,29 @@ export function StatTile({
|
|
|
26
35
|
onClick,
|
|
27
36
|
active = false,
|
|
28
37
|
className,
|
|
38
|
+
size = "md",
|
|
29
39
|
}: StatTileProps) {
|
|
40
|
+
const dims = tileSizes[size]
|
|
30
41
|
const body = (
|
|
31
42
|
<>
|
|
32
|
-
<span className="text-label-secondary">{label}</span>
|
|
33
|
-
<span
|
|
43
|
+
<span className={cn(dims.labelText, "text-label-secondary")}>{label}</span>
|
|
44
|
+
<span
|
|
45
|
+
className={cn(
|
|
46
|
+
"tabular-nums font-semibold",
|
|
47
|
+
dims.valueText,
|
|
48
|
+
tone === "critical" && value > 0 && "text-danger"
|
|
49
|
+
)}
|
|
50
|
+
>
|
|
34
51
|
{value.toLocaleString("en-US")}
|
|
35
52
|
</span>
|
|
36
|
-
{caption &&
|
|
53
|
+
{caption && (
|
|
54
|
+
<span className={cn(dims.labelText, "text-label-tertiary")}>{caption}</span>
|
|
55
|
+
)}
|
|
37
56
|
</>
|
|
38
57
|
)
|
|
39
58
|
const tileClass = cn(
|
|
40
|
-
"flex min-w-0 flex-col gap-2 rounded-2xl border border-separator/35 bg-elevated
|
|
59
|
+
"flex min-w-0 flex-col gap-2 rounded-2xl border border-separator/35 bg-elevated text-left shadow-xs",
|
|
60
|
+
dims.padding,
|
|
41
61
|
className
|
|
42
62
|
)
|
|
43
63
|
|