@passui/react 0.1.28 → 0.1.29
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,7 +1,10 @@
|
|
|
1
1
|
import type { HTMLAttributes } from "react";
|
|
2
2
|
export type ChipTone = "neutral" | "accent" | "public" | "family" | "friends";
|
|
3
|
+
export type ChipSize = "xs" | "sm" | "md";
|
|
3
4
|
export interface ChipProps extends HTMLAttributes<HTMLSpanElement> {
|
|
4
5
|
/** `neutral`, `accent`, `public`, `family`, or `friends`. @default "neutral" */
|
|
5
6
|
tone?: ChipTone;
|
|
7
|
+
/** `xs`, `sm`, or `md`. @default "sm" */
|
|
8
|
+
size?: ChipSize;
|
|
6
9
|
}
|
|
7
|
-
export declare function Chip({ tone, className, ...props }: ChipProps): import("react").JSX.Element;
|
|
10
|
+
export declare function Chip({ tone, size, className, ...props }: ChipProps): import("react").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export type LabeledContentSize = "sm" | "md" | "lg";
|
|
2
3
|
export interface LabeledContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
4
|
/** The visible name of the row. */
|
|
4
5
|
label: string;
|
|
@@ -10,10 +11,12 @@ export interface LabeledContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
10
11
|
stacked?: boolean;
|
|
11
12
|
/** Places a wide control below its label on phones. @default false */
|
|
12
13
|
wide?: boolean;
|
|
14
|
+
/** Row padding density. @default "md" */
|
|
15
|
+
size?: LabeledContentSize;
|
|
13
16
|
}
|
|
14
17
|
/**
|
|
15
18
|
* A row: a label, an optional description, and its control at the trailing
|
|
16
19
|
* end, as SwiftUI's `LabeledContent`. Wide controls move under the label
|
|
17
20
|
* when there is no room beside it, rather than squeezing.
|
|
18
21
|
*/
|
|
19
|
-
export declare function LabeledContent({ label, description, children, stacked, wide, className, ...props }: LabeledContentProps): import("react").JSX.Element;
|
|
22
|
+
export declare function LabeledContent({ label, description, children, stacked, wide, size, className, ...props }: LabeledContentProps): import("react").JSX.Element;
|
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@ import type { HTMLAttributes } from "react"
|
|
|
2
2
|
import { cn } from "../../lib/class-names"
|
|
3
3
|
|
|
4
4
|
export type ChipTone = "neutral" | "accent" | "public" | "family" | "friends"
|
|
5
|
+
export type ChipSize = "xs" | "sm" | "md"
|
|
5
6
|
|
|
6
7
|
const tones: Record<ChipTone, string> = {
|
|
7
8
|
neutral: "bg-fill text-label-secondary",
|
|
@@ -11,17 +12,26 @@ const tones: Record<ChipTone, string> = {
|
|
|
11
12
|
friends: "bg-[#ede8ff] text-[#5a3fc0] dark:bg-[#26203f] dark:text-[#c3b5ff]",
|
|
12
13
|
}
|
|
13
14
|
|
|
15
|
+
const sizes: Record<ChipSize, string> = {
|
|
16
|
+
xs: "px-1 py-0 text-caption2",
|
|
17
|
+
sm: "px-1.5 py-0.5 text-caption2",
|
|
18
|
+
md: "px-2 py-0.5 text-caption",
|
|
19
|
+
}
|
|
20
|
+
|
|
14
21
|
export interface ChipProps extends HTMLAttributes<HTMLSpanElement> {
|
|
15
22
|
/** `neutral`, `accent`, `public`, `family`, or `friends`. @default "neutral" */
|
|
16
23
|
tone?: ChipTone
|
|
24
|
+
/** `xs`, `sm`, or `md`. @default "sm" */
|
|
25
|
+
size?: ChipSize
|
|
17
26
|
}
|
|
18
27
|
|
|
19
|
-
export function Chip({ tone = "neutral", className, ...props }: ChipProps) {
|
|
28
|
+
export function Chip({ tone = "neutral", size = "sm", className, ...props }: ChipProps) {
|
|
20
29
|
return (
|
|
21
30
|
<span
|
|
22
31
|
className={cn(
|
|
23
|
-
"inline-flex items-center gap-1 rounded-full
|
|
32
|
+
"inline-flex items-center gap-1 rounded-full font-semibold",
|
|
24
33
|
tones[tone],
|
|
34
|
+
sizes[size],
|
|
25
35
|
className
|
|
26
36
|
)}
|
|
27
37
|
{...props}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { HTMLAttributes, ReactNode } from "react"
|
|
2
2
|
import { cn } from "../../lib/class-names"
|
|
3
3
|
|
|
4
|
+
export type LabeledContentSize = "sm" | "md" | "lg"
|
|
5
|
+
|
|
6
|
+
const padding: Record<LabeledContentSize, string> = {
|
|
7
|
+
sm: "px-3 py-2",
|
|
8
|
+
md: "px-4 py-3",
|
|
9
|
+
lg: "px-5 py-4",
|
|
10
|
+
}
|
|
11
|
+
|
|
4
12
|
export interface LabeledContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
13
|
/** The visible name of the row. */
|
|
6
14
|
label: string
|
|
@@ -12,6 +20,8 @@ export interface LabeledContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
12
20
|
stacked?: boolean
|
|
13
21
|
/** Places a wide control below its label on phones. @default false */
|
|
14
22
|
wide?: boolean
|
|
23
|
+
/** Row padding density. @default "md" */
|
|
24
|
+
size?: LabeledContentSize
|
|
15
25
|
}
|
|
16
26
|
|
|
17
27
|
/**
|
|
@@ -25,13 +35,15 @@ export function LabeledContent({
|
|
|
25
35
|
children,
|
|
26
36
|
stacked,
|
|
27
37
|
wide,
|
|
38
|
+
size = "md",
|
|
28
39
|
className,
|
|
29
40
|
...props
|
|
30
41
|
}: LabeledContentProps) {
|
|
31
42
|
return (
|
|
32
43
|
<div
|
|
33
44
|
className={cn(
|
|
34
|
-
"flex flex-wrap gap-x-4 gap-y-2
|
|
45
|
+
"flex flex-wrap gap-x-4 gap-y-2",
|
|
46
|
+
padding[size],
|
|
35
47
|
stacked
|
|
36
48
|
? "flex-col items-stretch"
|
|
37
49
|
: cn(
|