@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.
Files changed (140) hide show
  1. package/README.md +57 -46
  2. package/dist/types/src/components/accordion/accordion.d.ts +1 -1
  3. package/dist/types/src/components/breadcrumb/breadcrumb.d.ts +1 -1
  4. package/dist/types/src/components/inline-disclosure/inline-disclosure.d.ts +1 -1
  5. package/dist/types/src/components/popover/anchored-surface.d.ts +5 -1
  6. package/dist/types/src/components/popover/index.d.ts +41 -0
  7. package/dist/types/src/components/popover/popover-content.d.ts +32 -0
  8. package/dist/types/src/components/popover/popover-root.d.ts +22 -0
  9. package/dist/types/src/components/popover/popover-trigger.d.ts +23 -0
  10. package/dist/types/src/components/stepper/rolling-digit.d.ts +1 -1
  11. package/dist/types/src/components/table/table.d.ts +1 -1
  12. package/dist/types/src/components/view-controller/view-controller.d.ts +2 -2
  13. package/dist/types/src/index.d.ts +1 -1
  14. package/dist/types/src/machines/popover.machine.d.ts +30 -0
  15. package/package.json +307 -307
  16. package/src/appearance/index.ts +2 -2
  17. package/src/appearance/platform.tsx +76 -60
  18. package/src/appearance/theme.tsx +409 -377
  19. package/src/components/accordion/accordion.tsx +58 -49
  20. package/src/components/ambient/ambient.tsx +25 -25
  21. package/src/components/ambient/index.ts +1 -1
  22. package/src/components/aspect-ratio/aspect-ratio.tsx +21 -16
  23. package/src/components/breadcrumb/breadcrumb.tsx +63 -57
  24. package/src/components/button/button-styles.ts +39 -32
  25. package/src/components/button/button.tsx +91 -84
  26. package/src/components/button/icon-button.tsx +27 -25
  27. package/src/components/button/pending-spinner.tsx +8 -8
  28. package/src/components/button/use-pending-indicator.ts +11 -11
  29. package/src/components/chip/chip.tsx +35 -30
  30. package/src/components/code-block/code-block.tsx +40 -39
  31. package/src/components/combo-box/combo-box.tsx +5 -5
  32. package/src/components/command/command.tsx +124 -94
  33. package/src/components/compact-date-picker/calendar-month.ts +75 -53
  34. package/src/components/compact-date-picker/compact-date-picker.tsx +308 -289
  35. package/src/components/compact-time-picker/compact-time-picker.tsx +288 -281
  36. package/src/components/compact-time-picker/time-value.ts +32 -29
  37. package/src/components/content-unavailable-view/content-unavailable-view.tsx +64 -48
  38. package/src/components/content-view/content-view.tsx +168 -159
  39. package/src/components/content-view/index.ts +1 -1
  40. package/src/components/context-menu/conceal-menu-source.ts +25 -25
  41. package/src/components/context-menu/context-menu-host.tsx +439 -402
  42. package/src/components/context-menu/context-menu-store.ts +125 -123
  43. package/src/components/context-menu/menu-navigation.ts +25 -18
  44. package/src/components/context-menu/menu-position.ts +33 -29
  45. package/src/components/context-menu/menu-reveal.ts +32 -32
  46. package/src/components/context-menu/use-context-menu.ts +63 -56
  47. package/src/components/conversation/conversation.tsx +265 -263
  48. package/src/components/conversation/index.ts +1 -1
  49. package/src/components/date-picker/date-picker.tsx +95 -94
  50. package/src/components/date-picker/date-value.ts +20 -10
  51. package/src/components/dialog/dialog-host.tsx +105 -103
  52. package/src/components/dialog/dialog-store.ts +37 -36
  53. package/src/components/dialog/dialog.tsx +192 -179
  54. package/src/components/dialog/index.ts +1 -1
  55. package/src/components/disclosure-group/disclosure-group.tsx +93 -86
  56. package/src/components/divider/divider.tsx +24 -22
  57. package/src/components/inline-disclosure/inline-disclosure.tsx +40 -36
  58. package/src/components/keyboard-shortcut/keyboard-shortcut.tsx +23 -19
  59. package/src/components/labeled-content/labeled-content.tsx +68 -68
  60. package/src/components/locale-switcher/index.ts +1 -1
  61. package/src/components/locale-switcher/locale-switcher.tsx +279 -251
  62. package/src/components/menu/menu.tsx +75 -58
  63. package/src/components/morph/index.ts +2 -2
  64. package/src/components/morph/morph.tsx +227 -201
  65. package/src/components/morph/use-morph-disclosure.ts +19 -19
  66. package/src/components/one-time-code/one-time-code.tsx +216 -200
  67. package/src/components/picker/picker-trigger.ts +16 -13
  68. package/src/components/picker/picker.tsx +371 -345
  69. package/src/components/popover/anchored-surface.tsx +253 -229
  70. package/src/components/popover/index.ts +50 -0
  71. package/src/components/popover/popover-content.tsx +334 -0
  72. package/src/components/popover/popover-fit.ts +58 -53
  73. package/src/components/popover/popover-root.tsx +97 -0
  74. package/src/components/popover/popover-trigger.tsx +71 -0
  75. package/src/components/profile-image/profile-image.tsx +80 -64
  76. package/src/components/progress-view/progress-view.tsx +61 -59
  77. package/src/components/progress-view/use-liquid-progress.ts +38 -38
  78. package/src/components/radio-group/radio-group.tsx +71 -68
  79. package/src/components/search-field/expanding-search-field.tsx +191 -177
  80. package/src/components/search-field/search-field.tsx +59 -50
  81. package/src/components/search-list/search-list.tsx +246 -236
  82. package/src/components/section/section.tsx +58 -58
  83. package/src/components/secure-field/secure-field.tsx +3 -3
  84. package/src/components/segmented-control/segmented-control.tsx +136 -136
  85. package/src/components/sheet/modal-environment.ts +71 -64
  86. package/src/components/sheet/sheet-portal.tsx +58 -53
  87. package/src/components/sheet/sheet.tsx +146 -141
  88. package/src/components/sheet/use-sheet-focus.ts +97 -82
  89. package/src/components/sidebar/sidebar.tsx +78 -78
  90. package/src/components/skeleton/skeleton.tsx +30 -21
  91. package/src/components/slider/slider.tsx +113 -104
  92. package/src/components/slosh-slider/liquid-step.ts +32 -31
  93. package/src/components/slosh-slider/slosh-slider.tsx +265 -228
  94. package/src/components/stat-tile/index.ts +1 -1
  95. package/src/components/stat-tile/stat-tile.tsx +79 -68
  96. package/src/components/status-indicator/status-indicator.tsx +40 -37
  97. package/src/components/stepper/rolling-digit.tsx +82 -68
  98. package/src/components/stepper/stepper.tsx +122 -113
  99. package/src/components/swatch-picker/swatch-picker.tsx +120 -120
  100. package/src/components/tab-bar/tab-bar.tsx +149 -148
  101. package/src/components/tab-view/tab-view.tsx +140 -137
  102. package/src/components/table/table.tsx +117 -98
  103. package/src/components/text-editor/text-editor.tsx +34 -29
  104. package/src/components/text-field/text-field.tsx +182 -180
  105. package/src/components/toast/toast-store.ts +127 -115
  106. package/src/components/toast/toaster.tsx +361 -347
  107. package/src/components/toggle/toggle.tsx +297 -282
  108. package/src/components/tooltip/tooltip-host.tsx +157 -150
  109. package/src/components/view-controller/index.ts +1 -1
  110. package/src/components/view-controller/view-controller.tsx +64 -53
  111. package/src/components/wake-slider/wake-slider.tsx +220 -205
  112. package/src/hooks/scroll/minimize-decision.ts +11 -7
  113. package/src/hooks/use-anchored-disclosure.ts +19 -19
  114. package/src/hooks/use-anchored-placement.ts +29 -25
  115. package/src/hooks/use-dismiss.ts +33 -29
  116. package/src/hooks/use-floating-dismiss.ts +24 -22
  117. package/src/hooks/use-media-query.ts +67 -60
  118. package/src/hooks/use-minimize-on-scroll.ts +69 -60
  119. package/src/hooks/use-visual-viewport.ts +63 -63
  120. package/src/hooks/viewport/types.ts +16 -16
  121. package/src/hooks/viewport/viewport-metrics.ts +16 -10
  122. package/src/icons/icons.tsx +440 -328
  123. package/src/index.ts +91 -91
  124. package/src/lib/anchored-placement.ts +70 -65
  125. package/src/lib/class-names.ts +14 -13
  126. package/src/lib/clipboard.ts +8 -7
  127. package/src/lib/date.ts +61 -60
  128. package/src/lib/floating-layers.ts +39 -24
  129. package/src/lib/haptics.ts +10 -10
  130. package/src/lib/language.ts +9 -9
  131. package/src/lib/range-value.ts +27 -21
  132. package/src/lib/screen-edges.ts +33 -30
  133. package/src/lib/shapes.ts +38 -34
  134. package/src/machines/popover.machine.ts +51 -0
  135. package/src/motion/transitions.ts +46 -43
  136. package/src/styles/code-block.css +69 -43
  137. package/src/styles/motion-controls.css +393 -191
  138. package/src/tokens.ts +1 -1
  139. package/dist/types/src/components/popover/popover.d.ts +0 -21
  140. package/src/components/popover/popover.tsx +0 -334
@@ -1,132 +1,151 @@
1
- import { createContext, useContext } from "react"
2
- import type * as React from "react"
1
+ import { createContext, useContext } from "react";
2
+ import type * as React from "react";
3
3
 
4
- import { cn } from "../../lib/class-names"
4
+ import { cn } from "../../lib/class-names";
5
5
 
6
- export type TableSize = "sm" | "md" | "lg"
6
+ export type TableSize = "sm" | "md" | "lg";
7
7
 
8
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
- }
9
+ sm: "text-footnote text-label",
10
+ md: "text-subheadline text-label",
11
+ lg: "text-body text-label",
12
+ };
13
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
- }
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
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
- }
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
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
- }
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
28
 
29
- const TableSizeContext = createContext<TableSize>("md")
30
- const useTableSize = () => useContext(TableSizeContext)
29
+ const TableSizeContext = createContext<TableSize>("md");
30
+ const useTableSize = () => useContext(TableSizeContext);
31
31
 
32
32
  function Table({
33
- className,
34
- size = "md",
35
- ...props
33
+ className,
34
+ size = "md",
35
+ ...props
36
36
  }: React.ComponentProps<"table"> & {
37
- /** Row height, cell padding and text scale. @default "md" */ size?: TableSize
37
+ /** Row height, cell padding and text scale. @default "md" */ size?: TableSize;
38
38
  }) {
39
- return (
40
- <div data-slot="table-container" className="relative w-full overflow-x-auto">
41
- <TableSizeContext value={size}>
42
- <table data-slot="table" className={cn(tableText[size], className)} {...props} />
43
- </TableSizeContext>
44
- </div>
45
- )
39
+ return (
40
+ <div
41
+ data-slot="table-container"
42
+ className="relative w-full overflow-x-auto"
43
+ >
44
+ <TableSizeContext value={size}>
45
+ <table
46
+ data-slot="table"
47
+ className={cn(tableText[size], className)}
48
+ {...props}
49
+ />
50
+ </TableSizeContext>
51
+ </div>
52
+ );
46
53
  }
47
54
 
48
55
  function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
49
- return (
50
- <thead
51
- data-slot="table-header"
52
- className={cn("[&_tr]:border-separator [&_tr]:border-b", className)}
53
- {...props}
54
- />
55
- )
56
+ return (
57
+ <thead
58
+ data-slot="table-header"
59
+ className={cn("[&_tr]:border-separator [&_tr]:border-b", className)}
60
+ {...props}
61
+ />
62
+ );
56
63
  }
57
64
 
58
65
  function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
59
- return (
60
- <tbody
61
- data-slot="table-body"
62
- className={cn("[&_tr:last-child]:border-0", className)}
63
- {...props}
64
- />
65
- )
66
+ return (
67
+ <tbody
68
+ data-slot="table-body"
69
+ className={cn("[&_tr:last-child]:border-0", className)}
70
+ {...props}
71
+ />
72
+ );
66
73
  }
67
74
 
68
75
  function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
69
- return (
70
- <tfoot
71
- data-slot="table-footer"
72
- className={cn(
73
- "border-separator border-t bg-fill/50 font-semibold [&>tr]:last:border-b-0",
74
- className
75
- )}
76
- {...props}
77
- />
78
- )
76
+ return (
77
+ <tfoot
78
+ data-slot="table-footer"
79
+ className={cn(
80
+ "border-separator bg-fill/50 border-t font-semibold [&>tr]:last:border-b-0",
81
+ className,
82
+ )}
83
+ {...props}
84
+ />
85
+ );
79
86
  }
80
87
 
81
88
  function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
82
- return (
83
- <tr
84
- data-slot="table-row"
85
- className={cn(
86
- "border-separator border-b transition-colors duration-fast hover:bg-fill/50 has-aria-expanded:bg-fill/50",
87
- "data-[state=selected]:bg-accent-soft/60",
88
- className
89
- )}
90
- {...props}
91
- />
92
- )
89
+ return (
90
+ <tr
91
+ data-slot="table-row"
92
+ className={cn(
93
+ "border-separator duration-fast hover:bg-fill/50 has-aria-expanded:bg-fill/50 border-b transition-colors",
94
+ "data-[state=selected]:bg-accent-soft/60",
95
+ className,
96
+ )}
97
+ {...props}
98
+ />
99
+ );
93
100
  }
94
101
 
95
102
  function TableHead({ className, ...props }: React.ComponentProps<"th">) {
96
- const size = useTableSize()
97
- return (
98
- <th
99
- data-slot="table-head"
100
- className={cn(
101
- headCell[size],
102
- "text-label-secondary has-[[role=checkbox]]:pe-0",
103
- className
104
- )}
105
- {...props}
106
- />
107
- )
103
+ const size = useTableSize();
104
+ return (
105
+ <th
106
+ data-slot="table-head"
107
+ className={cn(
108
+ headCell[size],
109
+ "text-label-secondary has-[[role=checkbox]]:pe-0",
110
+ className,
111
+ )}
112
+ {...props}
113
+ />
114
+ );
108
115
  }
109
116
 
110
117
  function TableCell({ className, ...props }: React.ComponentProps<"td">) {
111
- const size = useTableSize()
112
- return (
113
- <td
114
- data-slot="table-cell"
115
- className={cn(bodyCell[size], "has-[[role=checkbox]]:pe-0", className)}
116
- {...props}
117
- />
118
- )
118
+ const size = useTableSize();
119
+ return (
120
+ <td
121
+ data-slot="table-cell"
122
+ className={cn(bodyCell[size], "has-[[role=checkbox]]:pe-0", className)}
123
+ {...props}
124
+ />
125
+ );
119
126
  }
120
127
 
121
- function TableCaption({ className, ...props }: React.ComponentProps<"caption">) {
122
- const size = useTableSize()
123
- return (
124
- <caption
125
- data-slot="table-caption"
126
- className={cn(captionText[size], className)}
127
- {...props}
128
- />
129
- )
128
+ function TableCaption({
129
+ className,
130
+ ...props
131
+ }: React.ComponentProps<"caption">) {
132
+ const size = useTableSize();
133
+ return (
134
+ <caption
135
+ data-slot="table-caption"
136
+ className={cn(captionText[size], className)}
137
+ {...props}
138
+ />
139
+ );
130
140
  }
131
141
 
132
- export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow }
142
+ export {
143
+ Table,
144
+ TableBody,
145
+ TableCaption,
146
+ TableCell,
147
+ TableFooter,
148
+ TableHead,
149
+ TableHeader,
150
+ TableRow,
151
+ };
@@ -1,37 +1,42 @@
1
- import type { ComponentProps } from "react"
2
- import { cn } from "../../lib/class-names"
3
- import { fieldSize, type TextFieldSize } from "../text-field/text-field"
1
+ import type { ComponentProps } from "react";
2
+ import { cn } from "../../lib/class-names";
3
+ import { fieldSize, type TextFieldSize } from "../text-field/text-field";
4
4
 
5
5
  const minHeights: Record<TextFieldSize, string> = {
6
- xs: "min-h-24",
7
- sm: "min-h-24",
8
- md: "min-h-28",
9
- lg: "min-h-32",
10
- }
6
+ xs: "min-h-24",
7
+ sm: "min-h-24",
8
+ md: "min-h-28",
9
+ lg: "min-h-32",
10
+ };
11
11
 
12
- export type TextEditorSize = TextFieldSize
12
+ export type TextEditorSize = TextFieldSize;
13
13
 
14
- export interface TextEditorProps extends Omit<ComponentProps<"textarea">, "size"> {
15
- /** Field surface scale; matches TextField's xs | sm | md | lg. @default "md" */
16
- size?: TextEditorSize
14
+ export interface TextEditorProps
15
+ extends Omit<ComponentProps<"textarea">, "size"> {
16
+ /** Field surface scale; matches TextField's xs | sm | md | lg. @default "md" */
17
+ size?: TextEditorSize;
17
18
  }
18
19
 
19
20
  /** A multi-line text field that reuses TextField's shared surface treatment. */
20
- export function TextEditor({ className, size = "md", ...props }: TextEditorProps) {
21
- const surface = fieldSize(size)
22
- return (
23
- <textarea
24
- {...props}
25
- className={cn(
26
- "w-full min-w-0 resize-y border border-separator bg-elevated text-label placeholder:text-label-tertiary",
27
- "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent-text",
28
- "disabled:cursor-not-allowed disabled:opacity-40 aria-invalid:border-danger",
29
- surface.radius,
30
- surface.padding,
31
- surface.text,
32
- minHeights[size],
33
- className
34
- )}
35
- />
36
- )
21
+ export function TextEditor({
22
+ className,
23
+ size = "md",
24
+ ...props
25
+ }: TextEditorProps) {
26
+ const surface = fieldSize(size);
27
+ return (
28
+ <textarea
29
+ {...props}
30
+ className={cn(
31
+ "border-separator bg-elevated text-label placeholder:text-label-tertiary w-full min-w-0 resize-y border",
32
+ "focus-visible:outline-accent-text focus-visible:outline-2 focus-visible:outline-offset-2",
33
+ "aria-invalid:border-danger disabled:cursor-not-allowed disabled:opacity-40",
34
+ surface.radius,
35
+ surface.padding,
36
+ surface.text,
37
+ minHeights[size],
38
+ className,
39
+ )}
40
+ />
41
+ );
37
42
  }