@passui/react 0.1.28 → 0.1.30
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/chip/chip.d.ts +4 -1
- package/dist/types/src/components/labeled-content/labeled-content.d.ts +4 -1
- package/package.json +1 -1
- package/src/components/chip/chip.tsx +12 -2
- package/src/components/context-menu/context-menu-host.tsx +9 -4
- package/src/components/labeled-content/labeled-content.tsx +13 -1
|
@@ -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}
|
|
@@ -5,7 +5,7 @@ import { CheckIcon } from "../../icons/icons"
|
|
|
5
5
|
import { cn } from "../../lib/class-names"
|
|
6
6
|
import { belongsToFloatingSurface, registerFloatingLayer } from "../../lib/floating-layers"
|
|
7
7
|
import { screenEdges } from "../../lib/screen-edges"
|
|
8
|
-
import { spring } from "../../motion/transitions"
|
|
8
|
+
import { spring, fluidOvershoot } from "../../motion/transitions"
|
|
9
9
|
import { concealMenuSource } from "./conceal-menu-source"
|
|
10
10
|
import { findMenuTypeaheadIndex, isMenuNavigationKey, nextMenuIndex } from "./menu-navigation"
|
|
11
11
|
import { menuPosition } from "./menu-position"
|
|
@@ -288,7 +288,7 @@ function Menu({ menu }: { menu: OpenMenu }) {
|
|
|
288
288
|
transition={
|
|
289
289
|
reducedMotion
|
|
290
290
|
? { duration: 0 }
|
|
291
|
-
: { ...
|
|
291
|
+
: { ...fluidOvershoot, opacity: { duration: 0.16 } }
|
|
292
292
|
}
|
|
293
293
|
/>
|
|
294
294
|
)}
|
|
@@ -305,18 +305,23 @@ function Menu({ menu }: { menu: OpenMenu }) {
|
|
|
305
305
|
? false
|
|
306
306
|
: {
|
|
307
307
|
opacity: 0,
|
|
308
|
+
scale: 0.96,
|
|
308
309
|
y: menu.source && menu.source.top > position.top ? 4 : -4,
|
|
309
310
|
}
|
|
310
311
|
}
|
|
311
|
-
animate={{ opacity: 1, y: 0 }}
|
|
312
|
+
animate={{ opacity: 1, scale: 1, y: 0 }}
|
|
312
313
|
exit={{
|
|
313
314
|
opacity: 0,
|
|
315
|
+
scale: 0.98,
|
|
314
316
|
transition: {
|
|
315
317
|
duration: reducedMotion ? 0 : 0.06,
|
|
316
318
|
},
|
|
317
319
|
}}
|
|
318
320
|
transition={{
|
|
319
|
-
duration: reducedMotion ? 0 : 0.
|
|
321
|
+
duration: reducedMotion ? 0 : 0.2,
|
|
322
|
+
ease: reducedMotion
|
|
323
|
+
? undefined
|
|
324
|
+
: ([0.4, 0, 0.2, 1] as [number, number, number, number]),
|
|
320
325
|
delay: reducedMotion || !menu.source ? 0 : 0.06,
|
|
321
326
|
}}
|
|
322
327
|
>
|
|
@@ -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(
|