@passui/react 0.1.38 → 0.1.39
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.
|
@@ -12,6 +12,7 @@ export interface TabBarLinkProps {
|
|
|
12
12
|
children: ReactNode;
|
|
13
13
|
}
|
|
14
14
|
export type TabBarMinimizeBehavior = "platform" | "scroll" | "never";
|
|
15
|
+
export type TabBarSize = "sm" | "md" | "lg";
|
|
15
16
|
export interface TabBarProps<Tab extends TabBarTab> {
|
|
16
17
|
/** `platform` follows the platform, `scroll` always minimizes, `never` stays expanded. @default "platform" */
|
|
17
18
|
minimizeBehavior?: TabBarMinimizeBehavior;
|
|
@@ -26,6 +27,8 @@ export interface TabBarProps<Tab extends TabBarTab> {
|
|
|
26
27
|
};
|
|
27
28
|
/** Accessible name for the navigation. */
|
|
28
29
|
label: string;
|
|
30
|
+
/** Tab height, label text, minimized width and search button diameter. @default "md" */
|
|
31
|
+
size?: TabBarSize;
|
|
29
32
|
className?: string;
|
|
30
33
|
}
|
|
31
34
|
/**
|
|
@@ -37,4 +40,4 @@ export interface TabBarProps<Tab extends TabBarTab> {
|
|
|
37
40
|
*
|
|
38
41
|
* Links stay the app's own (`renderLink`), so the bar works with any router.
|
|
39
42
|
*/
|
|
40
|
-
export declare function TabBar<Tab extends TabBarTab>({ tabs, active, renderLink, search, label, className, minimizeBehavior, }: TabBarProps<Tab>): import("react").JSX.Element;
|
|
43
|
+
export declare function TabBar<Tab extends TabBarTab>({ tabs, active, renderLink, search, label, className, size, minimizeBehavior, }: TabBarProps<Tab>): import("react").JSX.Element;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type * as React from "react";
|
|
2
|
-
|
|
2
|
+
export type TableSize = "sm" | "md" | "lg";
|
|
3
|
+
declare function Table({ className, size, ...props }: React.ComponentProps<"table"> & {
|
|
4
|
+
/** Row height, cell padding and text scale. @default "md" */ size?: TableSize;
|
|
5
|
+
}): React.JSX.Element;
|
|
3
6
|
declare function TableHeader({ className, ...props }: React.ComponentProps<"thead">): React.JSX.Element;
|
|
4
7
|
declare function TableBody({ className, ...props }: React.ComponentProps<"tbody">): React.JSX.Element;
|
|
5
8
|
declare function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">): React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@passui/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.39",
|
|
4
4
|
"description": "Passui: native React controls, design tokens, presentation and appearance.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -300,7 +300,7 @@
|
|
|
300
300
|
"clsx": "^2.1.1",
|
|
301
301
|
"tailwind-merge": "^3.7.0",
|
|
302
302
|
"tw-animate-css": "^1.4.0",
|
|
303
|
-
"@passui/tokens": "^0.1.
|
|
303
|
+
"@passui/tokens": "^0.1.3"
|
|
304
304
|
},
|
|
305
305
|
"types": "./dist/types/src/index.d.ts",
|
|
306
306
|
"sideEffects": [
|
|
@@ -20,6 +20,33 @@ export interface TabBarLinkProps {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export type TabBarMinimizeBehavior = "platform" | "scroll" | "never"
|
|
23
|
+
export type TabBarSize = "sm" | "md" | "lg"
|
|
24
|
+
|
|
25
|
+
const tabHeights: Record<TabBarSize, string> = {
|
|
26
|
+
sm: "h-9",
|
|
27
|
+
md: "h-11",
|
|
28
|
+
lg: "h-13",
|
|
29
|
+
}
|
|
30
|
+
const tabMinimizedWidths: Record<TabBarSize, string> = {
|
|
31
|
+
sm: "w-9",
|
|
32
|
+
md: "w-11",
|
|
33
|
+
lg: "w-13",
|
|
34
|
+
}
|
|
35
|
+
const tabText: Record<TabBarSize, string> = {
|
|
36
|
+
sm: "text-caption",
|
|
37
|
+
md: "text-caption2",
|
|
38
|
+
lg: "text-subheadline",
|
|
39
|
+
}
|
|
40
|
+
const searchButtonSizes: Record<TabBarSize, string> = {
|
|
41
|
+
sm: "size-10",
|
|
42
|
+
md: "size-12",
|
|
43
|
+
lg: "size-14",
|
|
44
|
+
}
|
|
45
|
+
const searchIconSizes: Record<TabBarSize, number> = {
|
|
46
|
+
sm: 17,
|
|
47
|
+
md: 19,
|
|
48
|
+
lg: 21,
|
|
49
|
+
}
|
|
23
50
|
|
|
24
51
|
export interface TabBarProps<Tab extends TabBarTab> {
|
|
25
52
|
/** `platform` follows the platform, `scroll` always minimizes, `never` stays expanded. @default "platform" */
|
|
@@ -32,6 +59,8 @@ export interface TabBarProps<Tab extends TabBarTab> {
|
|
|
32
59
|
search?: { label: string; onPress: () => void }
|
|
33
60
|
/** Accessible name for the navigation. */
|
|
34
61
|
label: string
|
|
62
|
+
/** Tab height, label text, minimized width and search button diameter. @default "md" */
|
|
63
|
+
size?: TabBarSize
|
|
35
64
|
className?: string
|
|
36
65
|
}
|
|
37
66
|
|
|
@@ -51,6 +80,7 @@ export function TabBar<Tab extends TabBarTab>({
|
|
|
51
80
|
search,
|
|
52
81
|
label,
|
|
53
82
|
className,
|
|
83
|
+
size = "md",
|
|
54
84
|
minimizeBehavior = "platform",
|
|
55
85
|
}: TabBarProps<Tab>) {
|
|
56
86
|
// Scopes the sliding selection to this bar, so two bars on one
|
|
@@ -97,8 +127,10 @@ export function TabBar<Tab extends TabBarTab>({
|
|
|
97
127
|
// Switching tabs is silent, as on Apple and Android: no haptic.
|
|
98
128
|
onClick: () => {},
|
|
99
129
|
className: cn(
|
|
100
|
-
"relative isolate flex
|
|
101
|
-
|
|
130
|
+
"relative isolate flex min-w-0 flex-col items-center justify-center gap-0.5 rounded-full font-semibold tracking-[0.01em] no-underline transition-[color,transform] duration-fast active:scale-[0.94]",
|
|
131
|
+
tabHeights[size],
|
|
132
|
+
tabText[size],
|
|
133
|
+
minimized ? tabMinimizedWidths[size] : "flex-1 px-1",
|
|
102
134
|
current ? "text-accent-text" : "text-label-secondary"
|
|
103
135
|
),
|
|
104
136
|
children: (
|
|
@@ -133,10 +165,11 @@ export function TabBar<Tab extends TabBarTab>({
|
|
|
133
165
|
aria-label={search.label}
|
|
134
166
|
onClick={search.onPress}
|
|
135
167
|
className={cn(
|
|
136
|
-
"glass ms-auto flex
|
|
168
|
+
"glass ms-auto flex shrink-0 items-center justify-center rounded-full text-label transition-transform duration-fast active:scale-[0.92]",
|
|
169
|
+
searchButtonSizes[size]
|
|
137
170
|
)}
|
|
138
171
|
>
|
|
139
|
-
<SearchIcon size={
|
|
172
|
+
<SearchIcon size={searchIconSizes[size]} strokeWidth={2} />
|
|
140
173
|
</button>
|
|
141
174
|
)}
|
|
142
175
|
</nav>
|
|
@@ -1,15 +1,46 @@
|
|
|
1
|
+
import { createContext, useContext } from "react"
|
|
1
2
|
import type * as React from "react"
|
|
2
3
|
|
|
3
4
|
import { cn } from "../../lib/class-names"
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
export type TableSize = "sm" | "md" | "lg"
|
|
7
|
+
|
|
8
|
+
const tableText: Record<TableSize, string> = {
|
|
9
|
+
sm: "text-footnote text-label",
|
|
10
|
+
md: "text-subheadline text-label",
|
|
11
|
+
lg: "text-body text-label",
|
|
12
|
+
}
|
|
13
|
+
const headCell: Record<TableSize, string> = {
|
|
14
|
+
sm: "h-8 px-2 text-start align-middle text-caption2 font-semibold whitespace-nowrap",
|
|
15
|
+
md: "h-10 px-3 text-start align-middle text-footnote font-semibold whitespace-nowrap",
|
|
16
|
+
lg: "h-12 px-4 text-start align-middle text-subheadline font-semibold whitespace-nowrap",
|
|
17
|
+
}
|
|
18
|
+
const bodyCell: Record<TableSize, string> = {
|
|
19
|
+
sm: "px-2 py-1.5 align-middle whitespace-nowrap",
|
|
20
|
+
md: "px-3 py-2.5 align-middle whitespace-nowrap",
|
|
21
|
+
lg: "px-4 py-3.5 align-middle whitespace-nowrap",
|
|
22
|
+
}
|
|
23
|
+
const captionText: Record<TableSize, string> = {
|
|
24
|
+
sm: "mt-3 text-caption2 text-label-secondary",
|
|
25
|
+
md: "mt-4 text-footnote text-label-secondary",
|
|
26
|
+
lg: "mt-5 text-subheadline text-label-secondary",
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const TableSizeContext = createContext<TableSize>("md")
|
|
30
|
+
const useTableSize = () => useContext(TableSizeContext)
|
|
31
|
+
|
|
32
|
+
function Table({
|
|
33
|
+
className,
|
|
34
|
+
size = "md",
|
|
35
|
+
...props
|
|
36
|
+
}: React.ComponentProps<"table"> & {
|
|
37
|
+
/** Row height, cell padding and text scale. @default "md" */ size?: TableSize
|
|
38
|
+
}) {
|
|
6
39
|
return (
|
|
7
40
|
<div data-slot="table-container" className="relative w-full overflow-x-auto">
|
|
8
|
-
<
|
|
9
|
-
data-slot="table"
|
|
10
|
-
|
|
11
|
-
{...props}
|
|
12
|
-
/>
|
|
41
|
+
<TableSizeContext value={size}>
|
|
42
|
+
<table data-slot="table" className={cn(tableText[size], className)} {...props} />
|
|
43
|
+
</TableSizeContext>
|
|
13
44
|
</div>
|
|
14
45
|
)
|
|
15
46
|
}
|
|
@@ -62,11 +93,12 @@ function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
|
|
|
62
93
|
}
|
|
63
94
|
|
|
64
95
|
function TableHead({ className, ...props }: React.ComponentProps<"th">) {
|
|
96
|
+
const size = useTableSize()
|
|
65
97
|
return (
|
|
66
98
|
<th
|
|
67
99
|
data-slot="table-head"
|
|
68
100
|
className={cn(
|
|
69
|
-
|
|
101
|
+
headCell[size],
|
|
70
102
|
"text-label-secondary has-[[role=checkbox]]:pe-0",
|
|
71
103
|
className
|
|
72
104
|
)}
|
|
@@ -76,23 +108,22 @@ function TableHead({ className, ...props }: React.ComponentProps<"th">) {
|
|
|
76
108
|
}
|
|
77
109
|
|
|
78
110
|
function TableCell({ className, ...props }: React.ComponentProps<"td">) {
|
|
111
|
+
const size = useTableSize()
|
|
79
112
|
return (
|
|
80
113
|
<td
|
|
81
114
|
data-slot="table-cell"
|
|
82
|
-
className={cn(
|
|
83
|
-
"px-3 py-2.5 align-middle whitespace-nowrap has-[[role=checkbox]]:pe-0",
|
|
84
|
-
className
|
|
85
|
-
)}
|
|
115
|
+
className={cn(bodyCell[size], "has-[[role=checkbox]]:pe-0", className)}
|
|
86
116
|
{...props}
|
|
87
117
|
/>
|
|
88
118
|
)
|
|
89
119
|
}
|
|
90
120
|
|
|
91
121
|
function TableCaption({ className, ...props }: React.ComponentProps<"caption">) {
|
|
122
|
+
const size = useTableSize()
|
|
92
123
|
return (
|
|
93
124
|
<caption
|
|
94
125
|
data-slot="table-caption"
|
|
95
|
-
className={cn(
|
|
126
|
+
className={cn(captionText[size], className)}
|
|
96
127
|
{...props}
|
|
97
128
|
/>
|
|
98
129
|
)
|