@passui/react 0.1.45 → 0.1.46
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/README.md +57 -46
- package/dist/types/src/components/accordion/accordion.d.ts +1 -1
- package/dist/types/src/components/breadcrumb/breadcrumb.d.ts +1 -1
- package/dist/types/src/components/inline-disclosure/inline-disclosure.d.ts +1 -1
- package/dist/types/src/components/popover/anchored-surface.d.ts +5 -1
- package/dist/types/src/components/popover/index.d.ts +41 -0
- package/dist/types/src/components/popover/popover-content.d.ts +32 -0
- package/dist/types/src/components/popover/popover-root.d.ts +22 -0
- package/dist/types/src/components/popover/popover-trigger.d.ts +23 -0
- package/dist/types/src/components/stepper/rolling-digit.d.ts +1 -1
- package/dist/types/src/components/table/table.d.ts +1 -1
- package/dist/types/src/components/view-controller/view-controller.d.ts +2 -2
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/machines/popover.machine.d.ts +30 -0
- package/package.json +307 -307
- package/src/appearance/index.ts +2 -2
- package/src/appearance/platform.tsx +76 -60
- package/src/appearance/theme.tsx +409 -377
- package/src/components/accordion/accordion.tsx +58 -49
- package/src/components/ambient/ambient.tsx +25 -25
- package/src/components/ambient/index.ts +1 -1
- package/src/components/aspect-ratio/aspect-ratio.tsx +21 -16
- package/src/components/breadcrumb/breadcrumb.tsx +63 -57
- package/src/components/button/button-styles.ts +39 -32
- package/src/components/button/button.tsx +91 -84
- package/src/components/button/icon-button.tsx +27 -25
- package/src/components/button/pending-spinner.tsx +8 -8
- package/src/components/button/use-pending-indicator.ts +11 -11
- package/src/components/chip/chip.tsx +35 -30
- package/src/components/code-block/code-block.tsx +40 -39
- package/src/components/combo-box/combo-box.tsx +5 -5
- package/src/components/command/command.tsx +124 -94
- package/src/components/compact-date-picker/calendar-month.ts +75 -53
- package/src/components/compact-date-picker/compact-date-picker.tsx +308 -289
- package/src/components/compact-time-picker/compact-time-picker.tsx +288 -281
- package/src/components/compact-time-picker/time-value.ts +32 -29
- package/src/components/content-unavailable-view/content-unavailable-view.tsx +64 -48
- package/src/components/content-view/content-view.tsx +168 -159
- package/src/components/content-view/index.ts +1 -1
- package/src/components/context-menu/conceal-menu-source.ts +25 -25
- package/src/components/context-menu/context-menu-host.tsx +439 -402
- package/src/components/context-menu/context-menu-store.ts +125 -123
- package/src/components/context-menu/menu-navigation.ts +25 -18
- package/src/components/context-menu/menu-position.ts +33 -29
- package/src/components/context-menu/menu-reveal.ts +32 -32
- package/src/components/context-menu/use-context-menu.ts +63 -56
- package/src/components/conversation/conversation.tsx +265 -263
- package/src/components/conversation/index.ts +1 -1
- package/src/components/date-picker/date-picker.tsx +95 -94
- package/src/components/date-picker/date-value.ts +20 -10
- package/src/components/dialog/dialog-host.tsx +105 -103
- package/src/components/dialog/dialog-store.ts +37 -36
- package/src/components/dialog/dialog.tsx +192 -179
- package/src/components/dialog/index.ts +1 -1
- package/src/components/disclosure-group/disclosure-group.tsx +93 -86
- package/src/components/divider/divider.tsx +24 -22
- package/src/components/inline-disclosure/inline-disclosure.tsx +40 -36
- package/src/components/keyboard-shortcut/keyboard-shortcut.tsx +23 -19
- package/src/components/labeled-content/labeled-content.tsx +68 -68
- package/src/components/locale-switcher/index.ts +1 -1
- package/src/components/locale-switcher/locale-switcher.tsx +279 -251
- package/src/components/menu/menu.tsx +75 -58
- package/src/components/morph/index.ts +2 -2
- package/src/components/morph/morph.tsx +227 -201
- package/src/components/morph/use-morph-disclosure.ts +19 -19
- package/src/components/one-time-code/one-time-code.tsx +216 -200
- package/src/components/picker/picker-trigger.ts +16 -13
- package/src/components/picker/picker.tsx +371 -345
- package/src/components/popover/anchored-surface.tsx +253 -229
- package/src/components/popover/index.ts +50 -0
- package/src/components/popover/popover-content.tsx +334 -0
- package/src/components/popover/popover-fit.ts +58 -53
- package/src/components/popover/popover-root.tsx +97 -0
- package/src/components/popover/popover-trigger.tsx +71 -0
- package/src/components/profile-image/profile-image.tsx +80 -64
- package/src/components/progress-view/progress-view.tsx +61 -59
- package/src/components/progress-view/use-liquid-progress.ts +38 -38
- package/src/components/radio-group/radio-group.tsx +71 -68
- package/src/components/search-field/expanding-search-field.tsx +191 -177
- package/src/components/search-field/search-field.tsx +59 -50
- package/src/components/search-list/search-list.tsx +246 -236
- package/src/components/section/section.tsx +58 -58
- package/src/components/secure-field/secure-field.tsx +3 -3
- package/src/components/segmented-control/segmented-control.tsx +136 -136
- package/src/components/sheet/modal-environment.ts +71 -64
- package/src/components/sheet/sheet-portal.tsx +58 -53
- package/src/components/sheet/sheet.tsx +146 -141
- package/src/components/sheet/use-sheet-focus.ts +97 -82
- package/src/components/sidebar/sidebar.tsx +78 -78
- package/src/components/skeleton/skeleton.tsx +30 -21
- package/src/components/slider/slider.tsx +113 -104
- package/src/components/slosh-slider/liquid-step.ts +32 -31
- package/src/components/slosh-slider/slosh-slider.tsx +265 -228
- package/src/components/stat-tile/index.ts +1 -1
- package/src/components/stat-tile/stat-tile.tsx +79 -68
- package/src/components/status-indicator/status-indicator.tsx +40 -37
- package/src/components/stepper/rolling-digit.tsx +82 -68
- package/src/components/stepper/stepper.tsx +122 -113
- package/src/components/swatch-picker/swatch-picker.tsx +120 -120
- package/src/components/tab-bar/tab-bar.tsx +149 -148
- package/src/components/tab-view/tab-view.tsx +140 -137
- package/src/components/table/table.tsx +117 -98
- package/src/components/text-editor/text-editor.tsx +34 -29
- package/src/components/text-field/text-field.tsx +182 -180
- package/src/components/toast/toast-store.ts +127 -115
- package/src/components/toast/toaster.tsx +361 -347
- package/src/components/toggle/toggle.tsx +297 -282
- package/src/components/tooltip/tooltip-host.tsx +157 -150
- package/src/components/view-controller/index.ts +1 -1
- package/src/components/view-controller/view-controller.tsx +64 -53
- package/src/components/wake-slider/wake-slider.tsx +220 -205
- package/src/hooks/scroll/minimize-decision.ts +11 -7
- package/src/hooks/use-anchored-disclosure.ts +19 -19
- package/src/hooks/use-anchored-placement.ts +29 -25
- package/src/hooks/use-dismiss.ts +33 -29
- package/src/hooks/use-floating-dismiss.ts +24 -22
- package/src/hooks/use-media-query.ts +67 -60
- package/src/hooks/use-minimize-on-scroll.ts +69 -60
- package/src/hooks/use-visual-viewport.ts +63 -63
- package/src/hooks/viewport/types.ts +16 -16
- package/src/hooks/viewport/viewport-metrics.ts +16 -10
- package/src/icons/icons.tsx +440 -328
- package/src/index.ts +91 -91
- package/src/lib/anchored-placement.ts +70 -65
- package/src/lib/class-names.ts +14 -13
- package/src/lib/clipboard.ts +8 -7
- package/src/lib/date.ts +61 -60
- package/src/lib/floating-layers.ts +39 -24
- package/src/lib/haptics.ts +10 -10
- package/src/lib/language.ts +9 -9
- package/src/lib/range-value.ts +27 -21
- package/src/lib/screen-edges.ts +33 -30
- package/src/lib/shapes.ts +38 -34
- package/src/machines/popover.machine.ts +51 -0
- package/src/motion/transitions.ts +46 -43
- package/src/styles/code-block.css +69 -43
- package/src/styles/motion-controls.css +393 -191
- package/src/tokens.ts +1 -1
- package/dist/types/src/components/popover/popover.d.ts +0 -21
- package/src/components/popover/popover.tsx +0 -334
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { AnimatePresence, motion, useReducedMotion } from "motion/react"
|
|
2
|
-
import type { ReactNode } from "react"
|
|
3
|
-
import { cn } from "../../lib/class-names"
|
|
4
|
-
import { spring } from "../../motion/transitions"
|
|
1
|
+
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import { cn } from "../../lib/class-names";
|
|
4
|
+
import { spring } from "../../motion/transitions";
|
|
5
5
|
|
|
6
6
|
export interface InlineDisclosureProps {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
/** Whether the content is expanded. */
|
|
8
|
+
open: boolean;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
className?: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -17,33 +17,37 @@ export interface InlineDisclosureProps {
|
|
|
17
17
|
* instead of jumping. Motion is disabled when the user requests less motion.
|
|
18
18
|
* The content unmounts after its exit animation completes.
|
|
19
19
|
*/
|
|
20
|
-
export function InlineDisclosure({
|
|
21
|
-
|
|
20
|
+
export function InlineDisclosure({
|
|
21
|
+
open,
|
|
22
|
+
children,
|
|
23
|
+
className,
|
|
24
|
+
}: InlineDisclosureProps) {
|
|
25
|
+
const reduceMotion = useReducedMotion();
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
27
|
+
return (
|
|
28
|
+
<AnimatePresence initial={false}>
|
|
29
|
+
{open && (
|
|
30
|
+
<motion.div
|
|
31
|
+
key="inline-disclosure"
|
|
32
|
+
initial={reduceMotion ? false : { height: 0, opacity: 0 }}
|
|
33
|
+
animate={{ height: "auto", opacity: 1 }}
|
|
34
|
+
exit={reduceMotion ? { opacity: 0 } : { height: 0, opacity: 0 }}
|
|
35
|
+
transition={
|
|
36
|
+
reduceMotion
|
|
37
|
+
? { duration: 0 }
|
|
38
|
+
: {
|
|
39
|
+
height: spring.smooth,
|
|
40
|
+
opacity: {
|
|
41
|
+
duration: 0.18,
|
|
42
|
+
ease: "easeOut",
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
className={cn("overflow-hidden", className)}
|
|
47
|
+
>
|
|
48
|
+
{children}
|
|
49
|
+
</motion.div>
|
|
50
|
+
)}
|
|
51
|
+
</AnimatePresence>
|
|
52
|
+
);
|
|
49
53
|
}
|
|
@@ -1,28 +1,32 @@
|
|
|
1
|
-
import type { ComponentProps } from "react"
|
|
2
|
-
import { cn } from "../../lib/class-names"
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { cn } from "../../lib/class-names";
|
|
3
3
|
|
|
4
|
-
export type KeyboardShortcutSize = "sm" | "md"
|
|
4
|
+
export type KeyboardShortcutSize = "sm" | "md";
|
|
5
5
|
|
|
6
6
|
const sizes: Record<KeyboardShortcutSize, string> = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
7
|
+
sm: "px-1 py-0 text-caption2",
|
|
8
|
+
md: "px-1.5 py-0.5 text-caption2",
|
|
9
|
+
};
|
|
10
10
|
|
|
11
11
|
export interface KeyboardShortcutProps extends ComponentProps<"kbd"> {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
/** Keycap padding density. Text stays at caption2 in both sizes. @default "md" */
|
|
13
|
+
size?: KeyboardShortcutSize;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/** A quiet keycap for a shortcut supplied and localized by the application. */
|
|
17
|
-
export function KeyboardShortcut({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
export function KeyboardShortcut({
|
|
18
|
+
size = "md",
|
|
19
|
+
className,
|
|
20
|
+
...props
|
|
21
|
+
}: KeyboardShortcutProps) {
|
|
22
|
+
return (
|
|
23
|
+
<kbd
|
|
24
|
+
{...props}
|
|
25
|
+
className={cn(
|
|
26
|
+
"border-separator/70 bg-fill/50 text-label-secondary inline-flex shrink-0 items-center rounded-md border font-mono leading-none",
|
|
27
|
+
sizes[size],
|
|
28
|
+
className,
|
|
29
|
+
)}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
28
32
|
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import type { HTMLAttributes, ReactNode } from "react"
|
|
2
|
-
import { cn } from "../../lib/class-names"
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import { cn } from "../../lib/class-names";
|
|
3
3
|
|
|
4
|
-
export type LabeledContentSize = "sm" | "md" | "lg"
|
|
4
|
+
export type LabeledContentSize = "sm" | "md" | "lg";
|
|
5
5
|
|
|
6
6
|
const padding: Record<LabeledContentSize, string> = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
7
|
+
sm: "px-3 py-2",
|
|
8
|
+
md: "px-4 py-3",
|
|
9
|
+
lg: "px-5 py-4",
|
|
10
|
+
};
|
|
11
11
|
|
|
12
12
|
export interface LabeledContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
/** The visible name of the row. */
|
|
14
|
+
label: string;
|
|
15
|
+
/** Supporting text below the label. */
|
|
16
|
+
description?: string;
|
|
17
|
+
/** The row's control or value. */
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
/** Places the control below the label at every width. @default false */
|
|
20
|
+
stacked?: boolean;
|
|
21
|
+
/** Places a wide control below its label on phones. @default false */
|
|
22
|
+
wide?: boolean;
|
|
23
|
+
/** Row padding density. @default "md" */
|
|
24
|
+
size?: LabeledContentSize;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -30,55 +30,55 @@ export interface LabeledContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
30
30
|
* when there is no room beside it, rather than squeezing.
|
|
31
31
|
*/
|
|
32
32
|
export function LabeledContent({
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
label,
|
|
34
|
+
description,
|
|
35
|
+
children,
|
|
36
|
+
stacked,
|
|
37
|
+
wide,
|
|
38
|
+
size = "md",
|
|
39
|
+
className,
|
|
40
|
+
...props
|
|
41
41
|
}: LabeledContentProps) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
42
|
+
return (
|
|
43
|
+
<div
|
|
44
|
+
className={cn(
|
|
45
|
+
"flex flex-wrap gap-x-4 gap-y-2",
|
|
46
|
+
padding[size],
|
|
47
|
+
stacked
|
|
48
|
+
? "flex-col items-stretch"
|
|
49
|
+
: cn(
|
|
50
|
+
"items-center justify-between",
|
|
51
|
+
wide && "max-sm:flex-col max-sm:items-stretch max-sm:gap-2",
|
|
52
|
+
),
|
|
53
|
+
className,
|
|
54
|
+
)}
|
|
55
|
+
{...props}
|
|
56
|
+
>
|
|
57
|
+
<div
|
|
58
|
+
className={cn(
|
|
59
|
+
"flex min-w-0 flex-1 flex-col gap-2 break-normal",
|
|
60
|
+
!stacked && "basis-36",
|
|
61
|
+
wide && "max-sm:basis-auto",
|
|
62
|
+
)}
|
|
63
|
+
>
|
|
64
|
+
<span className="text-subheadline text-label">{label}</span>
|
|
65
|
+
{description && (
|
|
66
|
+
<span className="text-footnote text-label-secondary leading-snug">
|
|
67
|
+
{description}
|
|
68
|
+
</span>
|
|
69
|
+
)}
|
|
70
|
+
</div>
|
|
71
|
+
{/* Controls give way before the label does; a segmented control that
|
|
72
72
|
no longer fits turns into a pop-up button by itself. */}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
73
|
+
<div
|
|
74
|
+
className={cn(
|
|
75
|
+
"ms-auto flex max-w-full min-w-0 shrink-0 justify-end [&>*]:max-w-full",
|
|
76
|
+
stacked && "w-full",
|
|
77
|
+
wide && "max-sm:w-full",
|
|
78
|
+
)}
|
|
79
|
+
>
|
|
80
|
+
{children}
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./locale-switcher"
|
|
1
|
+
export * from "./locale-switcher";
|