gooee 0.0.0-stage → 0.41.0
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/LICENSE +21 -0
- package/README.md +99 -2
- package/package.json +36 -4
- package/scripts/add.js +533 -0
- package/scripts/pro-components.json +82 -0
- package/src/base.css +39 -0
- package/src/components/Accordion/Accordion.module.css +90 -0
- package/src/components/Accordion/Accordion.tsx +125 -0
- package/src/components/Accordion/index.ts +1 -0
- package/src/components/Alert/Alert.module.css +121 -0
- package/src/components/Alert/Alert.tsx +90 -0
- package/src/components/Alert/index.ts +1 -0
- package/src/components/AlertDialog/AlertDialog.module.css +2 -0
- package/src/components/AlertDialog/AlertDialog.tsx +108 -0
- package/src/components/AlertDialog/index.ts +1 -0
- package/src/components/AnimatedNumber/AnimatedNumber.module.css +48 -0
- package/src/components/AnimatedNumber/AnimatedNumber.tsx +52 -0
- package/src/components/AnimatedNumber/index.ts +1 -0
- package/src/components/AspectRatio/AspectRatio.module.css +15 -0
- package/src/components/AspectRatio/AspectRatio.tsx +12 -0
- package/src/components/AspectRatio/index.ts +1 -0
- package/src/components/Avatar/Avatar.module.css +62 -0
- package/src/components/Avatar/Avatar.tsx +55 -0
- package/src/components/Avatar/index.ts +3 -0
- package/src/components/AvatarGroup/AvatarGroup.module.css +53 -0
- package/src/components/AvatarGroup/AvatarGroup.tsx +43 -0
- package/src/components/AvatarGroup/index.ts +1 -0
- package/src/components/Badge/Badge.module.css +69 -0
- package/src/components/Badge/Badge.tsx +25 -0
- package/src/components/Badge/index.ts +1 -0
- package/src/components/Breadcrumb/Breadcrumb.module.css +104 -0
- package/src/components/Breadcrumb/Breadcrumb.tsx +76 -0
- package/src/components/Breadcrumb/index.ts +1 -0
- package/src/components/Button/Button.module.css +191 -0
- package/src/components/Button/Button.tsx +148 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/ButtonGroup/ButtonGroup.module.css +59 -0
- package/src/components/ButtonGroup/ButtonGroup.tsx +45 -0
- package/src/components/ButtonGroup/index.ts +1 -0
- package/src/components/Card/Card.module.css +82 -0
- package/src/components/Card/Card.tsx +34 -0
- package/src/components/Card/index.ts +1 -0
- package/src/components/Center/Center.module.css +15 -0
- package/src/components/Center/Center.tsx +28 -0
- package/src/components/Center/index.ts +1 -0
- package/src/components/Checkbox/Checkbox.module.css +120 -0
- package/src/components/Checkbox/Checkbox.tsx +133 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/CheckboxGroup/CheckboxGroup.module.css +30 -0
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +88 -0
- package/src/components/CheckboxGroup/index.ts +1 -0
- package/src/components/Cluster/Cluster.module.css +25 -0
- package/src/components/Cluster/Cluster.tsx +26 -0
- package/src/components/Cluster/index.ts +1 -0
- package/src/components/CodeBlock/CodeBlock.module.css +74 -0
- package/src/components/CodeBlock/CodeBlock.tsx +53 -0
- package/src/components/CodeBlock/highlight.ts +73 -0
- package/src/components/CodeBlock/index.ts +1 -0
- package/src/components/Collapsible/Collapsible.module.css +75 -0
- package/src/components/Collapsible/Collapsible.tsx +71 -0
- package/src/components/Collapsible/index.ts +1 -0
- package/src/components/Container/Container.module.css +14 -0
- package/src/components/Container/Container.tsx +19 -0
- package/src/components/Container/index.ts +1 -0
- package/src/components/CopyButton/CopyButton.module.css +125 -0
- package/src/components/CopyButton/CopyButton.tsx +160 -0
- package/src/components/CopyButton/index.ts +1 -0
- package/src/components/Dial/Dial.module.css +344 -0
- package/src/components/Dial/Dial.tsx +332 -0
- package/src/components/Dial/index.ts +1 -0
- package/src/components/Dialog/Dialog.module.css +190 -0
- package/src/components/Dialog/Dialog.tsx +100 -0
- package/src/components/Dialog/index.ts +1 -0
- package/src/components/Divider/Divider.module.css +39 -0
- package/src/components/Divider/Divider.tsx +34 -0
- package/src/components/Divider/index.ts +1 -0
- package/src/components/DropdownMenu/DropdownMenu.module.css +134 -0
- package/src/components/DropdownMenu/DropdownMenu.tsx +215 -0
- package/src/components/DropdownMenu/index.ts +1 -0
- package/src/components/EmptyState/EmptyState.module.css +66 -0
- package/src/components/EmptyState/EmptyState.tsx +38 -0
- package/src/components/EmptyState/index.ts +1 -0
- package/src/components/Fab/Fab.module.css +176 -0
- package/src/components/Fab/Fab.tsx +117 -0
- package/src/components/Fab/index.ts +1 -0
- package/src/components/Fieldset/Fieldset.module.css +34 -0
- package/src/components/Fieldset/Fieldset.tsx +41 -0
- package/src/components/Fieldset/index.ts +1 -0
- package/src/components/FormField/FormField.module.css +62 -0
- package/src/components/FormField/FormField.tsx +91 -0
- package/src/components/FormField/index.ts +2 -0
- package/src/components/Grid/Grid.module.css +39 -0
- package/src/components/Grid/Grid.tsx +35 -0
- package/src/components/Grid/index.ts +1 -0
- package/src/components/HoldToConfirm/HoldToConfirm.module.css +175 -0
- package/src/components/HoldToConfirm/HoldToConfirm.tsx +334 -0
- package/src/components/HoldToConfirm/index.ts +1 -0
- package/src/components/IconButton/IconButton.module.css +78 -0
- package/src/components/IconButton/IconButton.tsx +35 -0
- package/src/components/IconButton/index.ts +1 -0
- package/src/components/Input/Input.module.css +157 -0
- package/src/components/Input/Input.tsx +133 -0
- package/src/components/Input/index.ts +1 -0
- package/src/components/InputGroup/InputGroup.module.css +146 -0
- package/src/components/InputGroup/InputGroup.tsx +90 -0
- package/src/components/InputGroup/index.ts +1 -0
- package/src/components/Kbd/Kbd.module.css +28 -0
- package/src/components/Kbd/Kbd.tsx +38 -0
- package/src/components/Kbd/index.ts +1 -0
- package/src/components/Link/Link.module.css +65 -0
- package/src/components/Link/Link.tsx +41 -0
- package/src/components/Link/index.ts +1 -0
- package/src/components/LivePill/LivePill.module.css +207 -0
- package/src/components/LivePill/LivePill.tsx +182 -0
- package/src/components/LivePill/index.ts +1 -0
- package/src/components/Meter/Meter.module.css +91 -0
- package/src/components/Meter/Meter.tsx +109 -0
- package/src/components/Meter/index.ts +1 -0
- package/src/components/MorphButton/MorphButton.module.css +152 -0
- package/src/components/MorphButton/MorphButton.tsx +203 -0
- package/src/components/MorphButton/index.ts +1 -0
- package/src/components/NumberInput/NumberInput.module.css +104 -0
- package/src/components/NumberInput/NumberInput.tsx +252 -0
- package/src/components/NumberInput/index.ts +2 -0
- package/src/components/Pagination/Pagination.module.css +88 -0
- package/src/components/Pagination/Pagination.tsx +126 -0
- package/src/components/Pagination/index.ts +1 -0
- package/src/components/PasswordInput/PasswordInput.module.css +64 -0
- package/src/components/PasswordInput/PasswordInput.tsx +63 -0
- package/src/components/PasswordInput/index.ts +2 -0
- package/src/components/PickerWheel/PickerWheel.module.css +123 -0
- package/src/components/PickerWheel/PickerWheel.tsx +326 -0
- package/src/components/PickerWheel/index.ts +1 -0
- package/src/components/Popover/Popover.module.css +78 -0
- package/src/components/Popover/Popover.tsx +117 -0
- package/src/components/Popover/index.ts +1 -0
- package/src/components/ProgressBar/ProgressBar.module.css +61 -0
- package/src/components/ProgressBar/ProgressBar.tsx +48 -0
- package/src/components/ProgressBar/index.ts +1 -0
- package/src/components/Prose/Prose.module.css +115 -0
- package/src/components/Prose/Prose.tsx +14 -0
- package/src/components/Prose/index.ts +1 -0
- package/src/components/Radio/Radio.module.css +106 -0
- package/src/components/Radio/Radio.tsx +115 -0
- package/src/components/Radio/index.ts +1 -0
- package/src/components/Retime/Retime.tsx +116 -0
- package/src/components/Retime/index.ts +1 -0
- package/src/components/RulerScrubber/RulerScrubber.module.css +146 -0
- package/src/components/RulerScrubber/RulerScrubber.tsx +209 -0
- package/src/components/RulerScrubber/index.ts +1 -0
- package/src/components/ScrollArea/ScrollArea.module.css +72 -0
- package/src/components/ScrollArea/ScrollArea.tsx +172 -0
- package/src/components/ScrollArea/index.ts +1 -0
- package/src/components/SearchInput/SearchInput.module.css +53 -0
- package/src/components/SearchInput/SearchInput.tsx +104 -0
- package/src/components/SearchInput/index.ts +2 -0
- package/src/components/SegmentedControl/SegmentedControl.module.css +150 -0
- package/src/components/SegmentedControl/SegmentedControl.tsx +169 -0
- package/src/components/SegmentedControl/index.ts +1 -0
- package/src/components/Select/Select.module.css +204 -0
- package/src/components/Select/Select.tsx +254 -0
- package/src/components/Select/index.ts +1 -0
- package/src/components/Sheet/Sheet.module.css +228 -0
- package/src/components/Sheet/Sheet.tsx +449 -0
- package/src/components/Sheet/index.ts +1 -0
- package/src/components/Skeleton/Skeleton.module.css +56 -0
- package/src/components/Skeleton/Skeleton.tsx +37 -0
- package/src/components/Skeleton/index.ts +1 -0
- package/src/components/Slider/Slider.module.css +155 -0
- package/src/components/Slider/Slider.tsx +200 -0
- package/src/components/Slider/index.ts +1 -0
- package/src/components/Spinner/Spinner.module.css +50 -0
- package/src/components/Spinner/Spinner.tsx +29 -0
- package/src/components/Spinner/index.ts +1 -0
- package/src/components/Split/Split.module.css +29 -0
- package/src/components/Split/Split.tsx +33 -0
- package/src/components/Split/index.ts +1 -0
- package/src/components/SplitFlap/SplitFlap.module.css +107 -0
- package/src/components/SplitFlap/SplitFlap.tsx +225 -0
- package/src/components/SplitFlap/index.ts +1 -0
- package/src/components/Stack/Stack.module.css +17 -0
- package/src/components/Stack/Stack.tsx +19 -0
- package/src/components/Stack/index.ts +1 -0
- package/src/components/SwipeDeck/SwipeDeck.module.css +250 -0
- package/src/components/SwipeDeck/SwipeDeck.tsx +350 -0
- package/src/components/SwipeDeck/index.ts +1 -0
- package/src/components/Switch/Switch.module.css +97 -0
- package/src/components/Switch/Switch.tsx +147 -0
- package/src/components/Switch/index.ts +1 -0
- package/src/components/Table/Table.module.css +369 -0
- package/src/components/Table/Table.tsx +368 -0
- package/src/components/Table/index.ts +1 -0
- package/src/components/TableOfContents/TableOfContents.module.css +107 -0
- package/src/components/TableOfContents/TableOfContents.tsx +93 -0
- package/src/components/TableOfContents/index.ts +1 -0
- package/src/components/Tabs/Tabs.module.css +101 -0
- package/src/components/Tabs/Tabs.tsx +190 -0
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/Tag/Tag.module.css +120 -0
- package/src/components/Tag/Tag.tsx +109 -0
- package/src/components/Tag/index.ts +1 -0
- package/src/components/Textarea/Textarea.module.css +79 -0
- package/src/components/Textarea/Textarea.tsx +130 -0
- package/src/components/Textarea/index.ts +1 -0
- package/src/components/ThemeToggle/ThemeToggle.module.css +21 -0
- package/src/components/ThemeToggle/ThemeToggle.tsx +69 -0
- package/src/components/ThemeToggle/index.ts +1 -0
- package/src/components/Toast/Toast.module.css +202 -0
- package/src/components/Toast/Toast.tsx +473 -0
- package/src/components/Toast/index.ts +1 -0
- package/src/components/Toggle/Toggle.module.css +94 -0
- package/src/components/Toggle/Toggle.tsx +50 -0
- package/src/components/Toggle/index.ts +1 -0
- package/src/components/Tooltip/Tooltip.module.css +34 -0
- package/src/components/Tooltip/Tooltip.tsx +154 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/VisuallyHidden/VisuallyHidden.module.css +13 -0
- package/src/components/VisuallyHidden/VisuallyHidden.tsx +12 -0
- package/src/components/VisuallyHidden/index.ts +1 -0
- package/src/internal/FieldMessage.module.css +49 -0
- package/src/internal/FieldMessage.tsx +44 -0
- package/src/internal/Portal.tsx +7 -0
- package/src/internal/Roll.module.css +31 -0
- package/src/internal/Roll.tsx +20 -0
- package/src/internal/cx.ts +3 -0
- package/src/internal/feel.ts +355 -0
- package/src/internal/fling.ts +118 -0
- package/src/internal/focus.ts +94 -0
- package/src/internal/icons.module.css +62 -0
- package/src/internal/icons.tsx +511 -0
- package/src/internal/keyboard.ts +62 -0
- package/src/internal/layers.ts +85 -0
- package/src/internal/liquid.ts +248 -0
- package/src/internal/liquidMatter.ts +168 -0
- package/src/internal/liquidMore.ts +686 -0
- package/src/internal/liquidPath.ts +519 -0
- package/src/internal/mergeRefs.ts +10 -0
- package/src/internal/motion.ts +37 -0
- package/src/internal/relativeTime.ts +26 -0
- package/src/internal/scrollFrame.ts +157 -0
- package/src/internal/softPress.ts +299 -0
- package/src/internal/space.ts +6 -0
- package/src/internal/useControllable.ts +21 -0
- package/src/internal/useFloating.ts +85 -0
- package/src/internal/usePresence.ts +15 -0
- package/src/internal/useScrub.ts +160 -0
- package/src/tokens.css +727 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
.overlay {
|
|
2
|
+
position: fixed;
|
|
3
|
+
inset: 0;
|
|
4
|
+
z-index: var(--gooee-z-dialog);
|
|
5
|
+
background: var(--gooee-color-overlay);
|
|
6
|
+
backdrop-filter: blur(2px);
|
|
7
|
+
animation: fadeIn var(--gooee-motion-morph) var(--gooee-ease-morph);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.overlay[data-state="closed"] { animation: fadeOut var(--gooee-motion-morph-out) var(--gooee-ease-morph) forwards; }
|
|
11
|
+
|
|
12
|
+
.positioner {
|
|
13
|
+
position: fixed;
|
|
14
|
+
inset: 0;
|
|
15
|
+
z-index: var(--gooee-z-dialog);
|
|
16
|
+
display: grid;
|
|
17
|
+
place-items: center;
|
|
18
|
+
padding: var(--gooee-space-5);
|
|
19
|
+
overflow-y: auto;
|
|
20
|
+
pointer-events: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.panel {
|
|
24
|
+
position: relative;
|
|
25
|
+
width: 100%;
|
|
26
|
+
max-width: var(--gooee-panel-w-md);
|
|
27
|
+
max-height: calc(100dvh - var(--gooee-space-5) * 2);
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
border: var(--gooee-line) solid var(--gooee-glass-edge, var(--gooee-color-border));
|
|
31
|
+
border-radius: var(--gooee-radius-panel);
|
|
32
|
+
background: var(--gooee-glass-bg, var(--gooee-color-surface));
|
|
33
|
+
-webkit-backdrop-filter: var(--gooee-glass-filter, none);
|
|
34
|
+
backdrop-filter: var(--gooee-glass-filter, none);
|
|
35
|
+
box-shadow: var(--gooee-shadow-4);
|
|
36
|
+
outline: none;
|
|
37
|
+
pointer-events: auto;
|
|
38
|
+
animation: panelIn var(--gooee-motion-morph) var(--gooee-ease-morph);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* A closing panel takes no clicks, so a double click cannot run a footer action twice.
|
|
42
|
+
The overlay still catches them, so they never reach the page behind. */
|
|
43
|
+
.panel[data-state="closed"] { animation: panelOut var(--gooee-motion-morph-out) var(--gooee-ease-morph) forwards; pointer-events: none; }
|
|
44
|
+
|
|
45
|
+
/* The morph (internal/liquid.ts) grows the panel out of its opener instead, and a drag carries a
|
|
46
|
+
sheet the hand lets go of; the CSS motion stands down. */
|
|
47
|
+
.panel[data-liquid],
|
|
48
|
+
.panel[data-liquid][data-state="closed"],
|
|
49
|
+
.panel[data-fluid][data-state="closed"] { animation: none; }
|
|
50
|
+
|
|
51
|
+
/* The sheet's grabber, shown on phones only */
|
|
52
|
+
.handle { display: none; }
|
|
53
|
+
|
|
54
|
+
.sm { max-width: var(--gooee-panel-w-sm); }
|
|
55
|
+
.lg { max-width: var(--gooee-panel-w-lg); }
|
|
56
|
+
|
|
57
|
+
.header {
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: flex-start;
|
|
60
|
+
justify-content: space-between;
|
|
61
|
+
gap: var(--gooee-space-4);
|
|
62
|
+
padding: var(--gooee-space-7) var(--gooee-space-4) 0 var(--gooee-space-7);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.titles {
|
|
66
|
+
display: flex;
|
|
67
|
+
flex-direction: column;
|
|
68
|
+
gap: var(--gooee-space-2);
|
|
69
|
+
padding-top: var(--gooee-space-2);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.title {
|
|
73
|
+
margin: 0;
|
|
74
|
+
font-size: var(--gooee-text-xl);
|
|
75
|
+
font-weight: var(--gooee-weight-semibold);
|
|
76
|
+
letter-spacing: var(--gooee-tracking-tight);
|
|
77
|
+
line-height: var(--gooee-leading-tight);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.description {
|
|
81
|
+
margin: 0;
|
|
82
|
+
color: var(--gooee-color-fg-muted);
|
|
83
|
+
font-size: var(--gooee-text-md);
|
|
84
|
+
line-height: var(--gooee-leading-snug);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.close {
|
|
88
|
+
display: grid;
|
|
89
|
+
place-items: center;
|
|
90
|
+
flex: none;
|
|
91
|
+
width: var(--gooee-hit-min);
|
|
92
|
+
height: var(--gooee-hit-min);
|
|
93
|
+
margin-top: calc(var(--gooee-space-3) * -1);
|
|
94
|
+
padding: 0;
|
|
95
|
+
border: 0;
|
|
96
|
+
border-radius: var(--gooee-radius-full);
|
|
97
|
+
background: transparent;
|
|
98
|
+
color: var(--gooee-color-fg-muted);
|
|
99
|
+
font-size: var(--gooee-icon-lg);
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
transition: background-color var(--gooee-motion-fast) var(--gooee-ease-out);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Only the icon turns and presses. The button is square to the pointer even though it looks round,
|
|
105
|
+
so turning it would move its corners out from under the pointer and make it flicker. */
|
|
106
|
+
.close svg { transition: transform var(--gooee-motion-slow) var(--gooee-ease-spring); }
|
|
107
|
+
|
|
108
|
+
@media (hover: hover) {
|
|
109
|
+
.close:hover { background: var(--gooee-color-surface-hover); color: var(--gooee-color-fg); }
|
|
110
|
+
.close:hover svg { transform: rotate(90deg); }
|
|
111
|
+
}
|
|
112
|
+
.close:active svg { transform: rotate(90deg) scale(var(--gooee-press-scale)); }
|
|
113
|
+
.close:focus-visible { outline: none; box-shadow: var(--gooee-focus-ring); }
|
|
114
|
+
|
|
115
|
+
.body {
|
|
116
|
+
padding: var(--gooee-space-5) var(--gooee-space-7) 0;
|
|
117
|
+
overflow-y: auto;
|
|
118
|
+
color: var(--gooee-color-fg-muted);
|
|
119
|
+
line-height: var(--gooee-leading-normal);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.footer {
|
|
123
|
+
display: flex;
|
|
124
|
+
justify-content: flex-end;
|
|
125
|
+
flex-wrap: wrap;
|
|
126
|
+
gap: var(--gooee-space-3);
|
|
127
|
+
padding: var(--gooee-space-7);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.header:last-child { padding-bottom: var(--gooee-space-7); }
|
|
131
|
+
.body:last-child { padding-bottom: var(--gooee-space-7); }
|
|
132
|
+
|
|
133
|
+
/* Phones: dock to the bottom, inside thumb reach. */
|
|
134
|
+
@media (max-width: 520px) {
|
|
135
|
+
.positioner {
|
|
136
|
+
place-items: end stretch;
|
|
137
|
+
padding: 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.panel {
|
|
141
|
+
max-width: none;
|
|
142
|
+
max-height: 92dvh;
|
|
143
|
+
border-radius: var(--gooee-radius-sheet) var(--gooee-radius-sheet) 0 0;
|
|
144
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
145
|
+
animation-name: slideUp;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.panel[data-state="closed"] { animation-name: slideDown; }
|
|
149
|
+
|
|
150
|
+
.handle {
|
|
151
|
+
display: block;
|
|
152
|
+
flex: none;
|
|
153
|
+
width: var(--gooee-handle-w);
|
|
154
|
+
height: var(--gooee-handle-h);
|
|
155
|
+
margin: var(--gooee-space-3) auto 0;
|
|
156
|
+
border-radius: var(--gooee-radius-full);
|
|
157
|
+
background: var(--gooee-color-border-strong);
|
|
158
|
+
transition: width var(--gooee-motion-base) var(--gooee-ease-morph);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.panel[data-dragging] .handle { width: var(--gooee-handle-w-active); }
|
|
162
|
+
|
|
163
|
+
/* The handle and the header are where the hand takes hold, as on a Sheet. */
|
|
164
|
+
.handle,
|
|
165
|
+
.handle + .header { touch-action: none; cursor: grab; }
|
|
166
|
+
.panel[data-dragging] .handle,
|
|
167
|
+
.panel[data-dragging] .handle + .header { cursor: grabbing; }
|
|
168
|
+
|
|
169
|
+
.handle + .header { padding-top: var(--gooee-space-4); }
|
|
170
|
+
|
|
171
|
+
.footer {
|
|
172
|
+
flex-direction: column-reverse;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.footer > * { width: 100%; }
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
@keyframes fadeIn { from { opacity: 0; } }
|
|
179
|
+
@keyframes fadeOut { to { opacity: 0; } }
|
|
180
|
+
|
|
181
|
+
@keyframes panelIn {
|
|
182
|
+
from { opacity: 0; transform: translateY(var(--gooee-shift-md)) scale(var(--gooee-pop-scale)); }
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
@keyframes panelOut {
|
|
186
|
+
to { opacity: 0; transform: scale(var(--gooee-pop-scale)); }
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@keyframes slideUp { from { transform: translateY(100%); } }
|
|
190
|
+
@keyframes slideDown { to { transform: translateY(100%); } }
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useId, useRef, type ReactNode, type RefObject } from 'react'
|
|
4
|
+
import { cx } from '../../internal/cx'
|
|
5
|
+
import { useDragClose } from '../../internal/fling'
|
|
6
|
+
import { useFocusTrap } from '../../internal/focus'
|
|
7
|
+
import { XIcon } from '../../internal/icons'
|
|
8
|
+
import { useDismiss, useScrollLock } from '../../internal/layers'
|
|
9
|
+
import { useDialogMorph } from '../../internal/liquid'
|
|
10
|
+
import { Portal } from '../../internal/Portal'
|
|
11
|
+
import { usePresence } from '../../internal/usePresence'
|
|
12
|
+
import styles from './Dialog.module.css'
|
|
13
|
+
|
|
14
|
+
export type DialogProps = {
|
|
15
|
+
/** Shows the dialog. You always control it. */
|
|
16
|
+
open: boolean
|
|
17
|
+
/** Called with false when the close button, Esc or an outside tap asks to close. */
|
|
18
|
+
onOpenChange: (open: boolean) => void
|
|
19
|
+
/** Heading of the dialog. Also its accessible name. */
|
|
20
|
+
title: ReactNode
|
|
21
|
+
/** Short text under the title, read out when the dialog opens. */
|
|
22
|
+
description?: ReactNode
|
|
23
|
+
/** Main content of the dialog. */
|
|
24
|
+
children?: ReactNode
|
|
25
|
+
/** Actions row. Put the primary action last, so it sits under the thumb on phones. */
|
|
26
|
+
footer?: ReactNode
|
|
27
|
+
/** Maximum width of the panel. */
|
|
28
|
+
size?: 'sm' | 'md' | 'lg'
|
|
29
|
+
/** Set false for dialogs that must not close by a stray tap, like unsaved work. */
|
|
30
|
+
dismissOnOverlay?: boolean
|
|
31
|
+
/** Screen reader name for the close button. */
|
|
32
|
+
closeLabel?: string
|
|
33
|
+
/** Element to focus first. Defaults to the first focusable element. */
|
|
34
|
+
initialFocus?: RefObject<HTMLElement | null>
|
|
35
|
+
/** Extra class for the dialog panel. */
|
|
36
|
+
className?: string
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function Dialog({
|
|
40
|
+
open,
|
|
41
|
+
onOpenChange,
|
|
42
|
+
title,
|
|
43
|
+
description,
|
|
44
|
+
children,
|
|
45
|
+
footer,
|
|
46
|
+
size = 'md',
|
|
47
|
+
dismissOnOverlay = true,
|
|
48
|
+
closeLabel = 'Close',
|
|
49
|
+
initialFocus,
|
|
50
|
+
className,
|
|
51
|
+
}: DialogProps) {
|
|
52
|
+
const id = useId()
|
|
53
|
+
const panelRef = useRef<HTMLDivElement>(null)
|
|
54
|
+
const { mounted, state } = usePresence(open, 'morph-out')
|
|
55
|
+
useDialogMorph(panelRef, open, mounted, state)
|
|
56
|
+
// On a phone the dialog is a bottom sheet, and the hand can pull it down to close, as it can a Sheet.
|
|
57
|
+
const grab = useDragClose(
|
|
58
|
+
panelRef,
|
|
59
|
+
open,
|
|
60
|
+
() => onOpenChange(false),
|
|
61
|
+
(e) => window.matchMedia('(max-width: 520px)').matches && !!(e.target as HTMLElement).closest(`.${styles.handle}, .${styles.header}`),
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
useScrollLock(open)
|
|
65
|
+
useDismiss(open, [panelRef], () => onOpenChange(false), { outside: dismissOnOverlay })
|
|
66
|
+
useFocusTrap(panelRef, open && mounted, { initialFocus })
|
|
67
|
+
|
|
68
|
+
if (!mounted) return null
|
|
69
|
+
return (
|
|
70
|
+
<Portal>
|
|
71
|
+
<div className={styles.overlay} data-state={state} aria-hidden="true" />
|
|
72
|
+
<div className={styles.positioner}>
|
|
73
|
+
<div
|
|
74
|
+
ref={panelRef}
|
|
75
|
+
role="dialog"
|
|
76
|
+
aria-modal="true"
|
|
77
|
+
aria-labelledby={`${id}-title`}
|
|
78
|
+
aria-describedby={description ? `${id}-desc` : undefined}
|
|
79
|
+
tabIndex={-1}
|
|
80
|
+
className={cx(styles.panel, styles[size], className)}
|
|
81
|
+
data-state={state}
|
|
82
|
+
{...(dismissOnOverlay ? grab : {})}
|
|
83
|
+
>
|
|
84
|
+
{dismissOnOverlay && <span className={styles.handle} aria-hidden="true" />}
|
|
85
|
+
<header className={styles.header}>
|
|
86
|
+
<div className={styles.titles}>
|
|
87
|
+
<h2 id={`${id}-title`} className={styles.title}>{title}</h2>
|
|
88
|
+
{description && <p id={`${id}-desc`} className={styles.description}>{description}</p>}
|
|
89
|
+
</div>
|
|
90
|
+
<button type="button" className={styles.close} aria-label={closeLabel} data-skip-initial-focus onClick={() => onOpenChange(false)}>
|
|
91
|
+
<XIcon />
|
|
92
|
+
</button>
|
|
93
|
+
</header>
|
|
94
|
+
{children && <div className={styles.body}>{children}</div>}
|
|
95
|
+
{footer && <footer className={styles.footer}>{footer}</footer>}
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
</Portal>
|
|
99
|
+
)
|
|
100
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Dialog'
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
flex: none;
|
|
3
|
+
background: var(--gooee-color-border);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.horizontal { width: 100%; height: var(--gooee-line); }
|
|
7
|
+
.vertical { align-self: stretch; width: var(--gooee-line); min-height: 1em; }
|
|
8
|
+
|
|
9
|
+
.animated.horizontal,
|
|
10
|
+
.animated .line { animation: drawX var(--gooee-motion-slower) var(--gooee-ease-out); }
|
|
11
|
+
.animated.vertical { animation: drawY var(--gooee-motion-slower) var(--gooee-ease-out); }
|
|
12
|
+
|
|
13
|
+
.labelled {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: var(--gooee-space-4);
|
|
17
|
+
width: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.line {
|
|
21
|
+
flex: 1;
|
|
22
|
+
height: var(--gooee-line);
|
|
23
|
+
background: var(--gooee-color-border);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.line:first-child { transform-origin: right; }
|
|
27
|
+
.line:last-child { transform-origin: left; }
|
|
28
|
+
|
|
29
|
+
.text {
|
|
30
|
+
font-size: var(--gooee-text-xs);
|
|
31
|
+
font-weight: var(--gooee-weight-medium);
|
|
32
|
+
color: var(--gooee-color-fg-muted);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.animated .text { animation: fade var(--gooee-motion-slower) var(--gooee-ease-out); }
|
|
36
|
+
|
|
37
|
+
@keyframes drawX { from { transform: scaleX(0); } }
|
|
38
|
+
@keyframes drawY { from { transform: scaleY(0); } }
|
|
39
|
+
@keyframes fade { from { opacity: 0; } }
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
import { cx } from '../../internal/cx'
|
|
3
|
+
import styles from './Divider.module.css'
|
|
4
|
+
|
|
5
|
+
export type DividerProps = {
|
|
6
|
+
/** Direction of the line. A vertical line stretches to the height of its flex row. */
|
|
7
|
+
orientation?: 'horizontal' | 'vertical'
|
|
8
|
+
/** Text in the middle of a horizontal line, such as "or". */
|
|
9
|
+
label?: ReactNode
|
|
10
|
+
/** Draws the line in from the centre when it mounts. */
|
|
11
|
+
animated?: boolean
|
|
12
|
+
/** Extra class for the root element. */
|
|
13
|
+
className?: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function Divider({ orientation = 'horizontal', label, animated = true, className }: DividerProps) {
|
|
17
|
+
if (label && orientation === 'horizontal') {
|
|
18
|
+
// A separator hides its children, so the role sits on the lines and the label is still read.
|
|
19
|
+
return (
|
|
20
|
+
<div className={cx(styles.labelled, animated && styles.animated, className)}>
|
|
21
|
+
<span className={styles.line} role="separator" aria-orientation="horizontal" />
|
|
22
|
+
<span className={styles.text}>{label}</span>
|
|
23
|
+
<span className={styles.line} role="separator" aria-orientation="horizontal" />
|
|
24
|
+
</div>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
return (
|
|
28
|
+
<div
|
|
29
|
+
role="separator"
|
|
30
|
+
aria-orientation={orientation}
|
|
31
|
+
className={cx(styles.root, styles[orientation], animated && styles.animated, className)}
|
|
32
|
+
/>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Divider'
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
.menu {
|
|
2
|
+
--oy: calc(var(--gooee-shift-sm) * -1);
|
|
3
|
+
z-index: var(--gooee-z-popover);
|
|
4
|
+
min-width: var(--gooee-menu-w);
|
|
5
|
+
max-width: calc(100vw - var(--gooee-space-5) * 2);
|
|
6
|
+
max-height: calc(100dvh - 2 * var(--gooee-space-5));
|
|
7
|
+
overflow-y: auto;
|
|
8
|
+
padding: var(--gooee-space-2);
|
|
9
|
+
border: var(--gooee-line) solid var(--gooee-glass-edge, var(--gooee-color-border));
|
|
10
|
+
border-radius: var(--gooee-radius-md);
|
|
11
|
+
background: var(--gooee-glass-bg, var(--gooee-color-surface));
|
|
12
|
+
-webkit-backdrop-filter: var(--gooee-glass-filter, none);
|
|
13
|
+
backdrop-filter: var(--gooee-glass-filter, none);
|
|
14
|
+
box-shadow: var(--gooee-shadow-3);
|
|
15
|
+
outline: none;
|
|
16
|
+
isolation: isolate;
|
|
17
|
+
transform-origin: top left;
|
|
18
|
+
animation: menuIn var(--gooee-motion-base) var(--gooee-ease-out);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.menu[data-side="top"] { --oy: var(--gooee-shift-sm); transform-origin: bottom left; }
|
|
22
|
+
|
|
23
|
+
.menu[data-state="closed"] {
|
|
24
|
+
animation: menuOut var(--gooee-motion-fast) var(--gooee-ease-in) forwards;
|
|
25
|
+
pointer-events: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Liquid (internal/liquid.ts) grows the menu out of its button instead; the fade stands down. */
|
|
29
|
+
.menu[data-liquid],
|
|
30
|
+
.menu[data-liquid][data-state="closed"] {
|
|
31
|
+
animation: none;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.item {
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
gap: var(--gooee-space-4);
|
|
38
|
+
min-height: var(--gooee-hit-min);
|
|
39
|
+
padding: 0 var(--gooee-space-4);
|
|
40
|
+
border-radius: max(0px, calc(var(--gooee-radius-md) - var(--gooee-space-2)));
|
|
41
|
+
font-size: var(--gooee-text-md);
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
outline: none;
|
|
44
|
+
user-select: none;
|
|
45
|
+
animation: itemIn var(--gooee-motion-slow) var(--gooee-ease-out) backwards;
|
|
46
|
+
animation-delay: calc(var(--i) * var(--gooee-motion-stagger));
|
|
47
|
+
transition: background-color var(--gooee-motion-fast) var(--gooee-ease-out);
|
|
48
|
+
--gooee-bead: var(--gooee-color-surface-hover);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.item[data-destructive]:not([aria-disabled]) { --gooee-bead: var(--gooee-color-danger-soft); }
|
|
52
|
+
|
|
53
|
+
/* The bead (internal/liquidMore.ts): while the highlight moves between items, the panel carries
|
|
54
|
+
data-bead and an SVG draws it under the items; at rest the focused item's own fill is back. */
|
|
55
|
+
.bead {
|
|
56
|
+
position: absolute;
|
|
57
|
+
left: 0;
|
|
58
|
+
top: 0;
|
|
59
|
+
z-index: -1;
|
|
60
|
+
overflow: visible;
|
|
61
|
+
pointer-events: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.menu[data-bead] .item { transition: none; }
|
|
65
|
+
.menu[data-bead] .item:focus,
|
|
66
|
+
.menu[data-bead] .item[data-destructive]:not([aria-disabled]):is(:focus, :active) { background: transparent; }
|
|
67
|
+
|
|
68
|
+
.item:focus { background: var(--gooee-color-surface-hover); }
|
|
69
|
+
.item:focus-visible { box-shadow: inset 0 0 0 var(--gooee-line-focus) var(--gooee-color-fg); }
|
|
70
|
+
|
|
71
|
+
.item:active:not([aria-disabled]) {
|
|
72
|
+
background: var(--gooee-color-surface-active);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.item[aria-disabled] {
|
|
76
|
+
color: var(--gooee-color-fg-disabled);
|
|
77
|
+
cursor: not-allowed;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.item[data-destructive] { font-weight: var(--gooee-weight-semibold); }
|
|
81
|
+
|
|
82
|
+
.item[data-destructive]:not([aria-disabled]),
|
|
83
|
+
.item[data-destructive]:not([aria-disabled]) .icon { color: var(--gooee-color-danger); }
|
|
84
|
+
|
|
85
|
+
.item[data-destructive]:not([aria-disabled]):is(:focus, :active) { background: var(--gooee-color-danger-soft); }
|
|
86
|
+
|
|
87
|
+
.icon {
|
|
88
|
+
display: inline-flex;
|
|
89
|
+
font-size: var(--gooee-icon-md);
|
|
90
|
+
color: var(--gooee-color-fg-muted);
|
|
91
|
+
transition: transform var(--gooee-motion-base) var(--gooee-ease-spring);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.item:focus .icon { transform: translateX(var(--gooee-space-1)); color: var(--gooee-color-fg); }
|
|
95
|
+
|
|
96
|
+
.label { flex: 1; }
|
|
97
|
+
|
|
98
|
+
.reason {
|
|
99
|
+
display: block;
|
|
100
|
+
font-size: var(--gooee-text-xs);
|
|
101
|
+
font-weight: var(--gooee-weight-regular);
|
|
102
|
+
color: var(--gooee-color-fg-muted);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.shortcut {
|
|
106
|
+
font-family: var(--gooee-font-mono);
|
|
107
|
+
font-size: var(--gooee-text-xs);
|
|
108
|
+
color: var(--gooee-color-fg-muted);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.separator {
|
|
112
|
+
height: var(--gooee-line);
|
|
113
|
+
margin: var(--gooee-space-2) var(--gooee-space-3);
|
|
114
|
+
background: var(--gooee-color-border);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.groupLabel {
|
|
118
|
+
padding: var(--gooee-space-3) var(--gooee-space-4) var(--gooee-space-2);
|
|
119
|
+
font-size: var(--gooee-text-xs);
|
|
120
|
+
font-weight: var(--gooee-weight-medium);
|
|
121
|
+
color: var(--gooee-color-fg-muted);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@keyframes menuIn {
|
|
125
|
+
from { opacity: 0; transform: translateY(var(--oy)) scale(var(--gooee-pop-scale)); }
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@keyframes menuOut {
|
|
129
|
+
to { opacity: 0; transform: scale(var(--gooee-pop-scale)); }
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
@keyframes itemIn {
|
|
133
|
+
from { opacity: 0; transform: translateX(calc(var(--gooee-shift-sm) * -1)); }
|
|
134
|
+
}
|