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,191 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
--h: var(--gooee-control-h-md);
|
|
3
|
+
position: relative;
|
|
4
|
+
display: inline-grid;
|
|
5
|
+
/* Its own width in a column layout too; fullWidth (.full) still fills the row. */
|
|
6
|
+
width: fit-content;
|
|
7
|
+
grid-template-columns: minmax(0, auto);
|
|
8
|
+
place-items: center;
|
|
9
|
+
max-width: 100%;
|
|
10
|
+
min-height: var(--h);
|
|
11
|
+
padding: 0 var(--gooee-space-6);
|
|
12
|
+
--bg: transparent;
|
|
13
|
+
--line: transparent;
|
|
14
|
+
border: var(--gooee-line) solid var(--line);
|
|
15
|
+
border-radius: var(--gooee-radius-control);
|
|
16
|
+
background: var(--bg);
|
|
17
|
+
font-size: var(--gooee-text-md);
|
|
18
|
+
font-weight: var(--gooee-weight-medium);
|
|
19
|
+
line-height: 1;
|
|
20
|
+
text-decoration: none;
|
|
21
|
+
white-space: nowrap;
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
user-select: none;
|
|
24
|
+
-webkit-tap-highlight-color: transparent;
|
|
25
|
+
transition:
|
|
26
|
+
background-color var(--gooee-motion-fast) var(--gooee-ease-out),
|
|
27
|
+
border-color var(--gooee-motion-fast) var(--gooee-ease-out),
|
|
28
|
+
color var(--gooee-motion-fast) var(--gooee-ease-out),
|
|
29
|
+
box-shadow var(--gooee-motion-fast) var(--gooee-ease-out);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* The soft edge (internal/softPress.ts): while pressed, hovered by a mouse or letting go, an SVG draws
|
|
33
|
+
the button in its own colours (--bg, --line) and the button's own paint steps aside. At rest the SVG
|
|
34
|
+
is gone. */
|
|
35
|
+
.root[data-soft] {
|
|
36
|
+
background: transparent;
|
|
37
|
+
border-color: transparent;
|
|
38
|
+
box-shadow: none;
|
|
39
|
+
transition: color var(--gooee-motion-fast) var(--gooee-ease-out);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.root[data-soft]:focus-visible { box-shadow: var(--gooee-focus-ring); }
|
|
43
|
+
|
|
44
|
+
.soft {
|
|
45
|
+
position: absolute;
|
|
46
|
+
left: calc(var(--gooee-line) * -1);
|
|
47
|
+
top: calc(var(--gooee-line) * -1);
|
|
48
|
+
overflow: visible;
|
|
49
|
+
pointer-events: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.softFill {
|
|
53
|
+
fill: var(--bg);
|
|
54
|
+
transition: fill var(--gooee-motion-fast) var(--gooee-ease-out);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.softRing { fill: var(--line); }
|
|
58
|
+
|
|
59
|
+
.soft stop { stop-color: var(--gooee-press-wet-dark); }
|
|
60
|
+
.soft[data-wet="light"] stop { stop-color: var(--gooee-press-wet-light); }
|
|
61
|
+
|
|
62
|
+
/* Invisible hit area so small buttons still get a 44px target. */
|
|
63
|
+
.root::after {
|
|
64
|
+
content: "";
|
|
65
|
+
position: absolute;
|
|
66
|
+
inset-block: min(0px, calc((100% - var(--gooee-hit-min)) / 2));
|
|
67
|
+
inset-inline: 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@media (pointer: coarse) {
|
|
71
|
+
.sm::after { inset-inline: min(0px, calc((100% - var(--gooee-hit-min)) / 2)); }
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* Beside another button, the hit area sinks below every box in the row, so it only fills the empty gap. */
|
|
75
|
+
:has(> button + .root, > .root + button) { isolation: isolate; }
|
|
76
|
+
:has(> button + .root, > .root + button) > .root::after { z-index: -1; }
|
|
77
|
+
|
|
78
|
+
.root:focus-visible {
|
|
79
|
+
outline: none;
|
|
80
|
+
box-shadow: var(--gooee-focus-ring);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* aria-disabled looks the same as disabled but stays focusable, so focus is not lost and the reason it points to stays readable. */
|
|
84
|
+
.root:disabled,
|
|
85
|
+
.root[aria-disabled="true"]:not([data-loading]) {
|
|
86
|
+
cursor: not-allowed;
|
|
87
|
+
opacity: var(--gooee-disabled-opacity);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.root[data-loading] {
|
|
91
|
+
cursor: progress;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.sm { --h: var(--gooee-control-h-sm); padding: 0 var(--gooee-space-5); font-size: var(--gooee-text-sm); }
|
|
95
|
+
.lg { --h: var(--gooee-control-h-lg); padding: 0 var(--gooee-space-7); font-size: var(--gooee-text-lg); }
|
|
96
|
+
.full { display: grid; width: 100%; }
|
|
97
|
+
|
|
98
|
+
.primary {
|
|
99
|
+
--bg: var(--gooee-color-accent);
|
|
100
|
+
color: var(--gooee-color-accent-fg);
|
|
101
|
+
box-shadow: var(--gooee-shadow-1);
|
|
102
|
+
}
|
|
103
|
+
@media (hover: hover) {
|
|
104
|
+
.primary:hover:not([aria-disabled="true"]) { --bg: var(--gooee-color-accent-hover); }
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.secondary {
|
|
108
|
+
--bg: var(--gooee-color-surface);
|
|
109
|
+
--line: var(--gooee-color-border-strong);
|
|
110
|
+
color: var(--gooee-color-fg);
|
|
111
|
+
}
|
|
112
|
+
@media (hover: hover) {
|
|
113
|
+
.secondary:hover:not([aria-disabled="true"]) { --bg: var(--gooee-color-surface-hover); }
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.ghost {
|
|
117
|
+
color: var(--gooee-color-fg);
|
|
118
|
+
}
|
|
119
|
+
@media (hover: hover) {
|
|
120
|
+
.ghost:hover:not([aria-disabled="true"]) { --bg: var(--gooee-color-surface-hover); }
|
|
121
|
+
}
|
|
122
|
+
/* A ghost has no fill of its own, so a press shows one to dent. */
|
|
123
|
+
.ghost[data-held] { --bg: var(--gooee-color-surface-hover); }
|
|
124
|
+
|
|
125
|
+
.danger {
|
|
126
|
+
--bg: var(--gooee-color-danger-solid);
|
|
127
|
+
color: var(--gooee-color-on-danger);
|
|
128
|
+
font-weight: var(--gooee-weight-semibold);
|
|
129
|
+
box-shadow: var(--gooee-shadow-1);
|
|
130
|
+
}
|
|
131
|
+
@media (hover: hover) {
|
|
132
|
+
.danger:hover:not([aria-disabled="true"]) { --bg: var(--gooee-color-danger-solid-hover); }
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.primary .soft,
|
|
136
|
+
.danger .soft { filter: drop-shadow(var(--gooee-shadow-1)); }
|
|
137
|
+
|
|
138
|
+
.content,
|
|
139
|
+
.spinner {
|
|
140
|
+
position: relative;
|
|
141
|
+
grid-area: 1 / 1;
|
|
142
|
+
display: inline-flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
justify-content: center;
|
|
145
|
+
gap: var(--gooee-space-3);
|
|
146
|
+
transition:
|
|
147
|
+
opacity var(--gooee-motion-base) var(--gooee-ease-out),
|
|
148
|
+
transform var(--gooee-motion-slow) var(--gooee-ease-spring),
|
|
149
|
+
filter var(--gooee-motion-base) var(--gooee-ease-out);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.content { max-width: 100%; }
|
|
153
|
+
|
|
154
|
+
/* Clip only the x axis: line-height is 1, so hiding y would cut descenders. */
|
|
155
|
+
.label {
|
|
156
|
+
min-width: 0;
|
|
157
|
+
overflow-x: clip;
|
|
158
|
+
text-overflow: ellipsis;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.icon {
|
|
162
|
+
display: inline-flex;
|
|
163
|
+
flex: none;
|
|
164
|
+
font-size: var(--gooee-icon-md);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.srOnly {
|
|
168
|
+
position: absolute;
|
|
169
|
+
width: 1px;
|
|
170
|
+
height: 1px;
|
|
171
|
+
overflow: hidden;
|
|
172
|
+
clip-path: inset(50%);
|
|
173
|
+
white-space: nowrap;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/* The spinner shares the label's grid cell, so the width never changes. */
|
|
177
|
+
.spinner {
|
|
178
|
+
opacity: 0;
|
|
179
|
+
transform: translateY(var(--gooee-shift-md)) scale(0.6);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.root[data-loading] .content {
|
|
183
|
+
opacity: 0;
|
|
184
|
+
transform: translateY(calc(var(--gooee-shift-md) * -1)) scale(0.92);
|
|
185
|
+
filter: blur(2px);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.root[data-loading] .spinner {
|
|
189
|
+
opacity: 1;
|
|
190
|
+
transform: none;
|
|
191
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useId, type ComponentPropsWithRef, type FocusEvent, type KeyboardEvent, type MouseEvent, type PointerEvent, type ReactNode, type Ref } from 'react'
|
|
4
|
+
import { cx } from '../../internal/cx'
|
|
5
|
+
import { useSoftPress } from '../../internal/softPress'
|
|
6
|
+
import { Spinner } from '../Spinner'
|
|
7
|
+
import styles from './Button.module.css'
|
|
8
|
+
|
|
9
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger'
|
|
10
|
+
export type ButtonSize = 'sm' | 'md' | 'lg'
|
|
11
|
+
|
|
12
|
+
export type ButtonProps = ComponentPropsWithRef<'button'> & {
|
|
13
|
+
/** Visual weight. Use one primary per view and danger for destructive actions. */
|
|
14
|
+
variant?: ButtonVariant
|
|
15
|
+
/** Height and text size. */
|
|
16
|
+
size?: ButtonSize
|
|
17
|
+
/** Shows a spinner and ignores clicks, but keeps focus on the button. */
|
|
18
|
+
loading?: boolean
|
|
19
|
+
/** Spoken while loading, for example "Saving". */
|
|
20
|
+
loadingLabel?: string
|
|
21
|
+
/** Icon before the label. */
|
|
22
|
+
leadingIcon?: ReactNode
|
|
23
|
+
/** Icon after the label. */
|
|
24
|
+
trailingIcon?: ReactNode
|
|
25
|
+
/** Stretches the button to fill its container. */
|
|
26
|
+
fullWidth?: boolean
|
|
27
|
+
/** Why the button is disabled. Read by screen readers and shown as a tooltip while it is disabled. */
|
|
28
|
+
disabledReason?: string
|
|
29
|
+
/** Renders a link with the same look, for navigation. Button-only props such as type are then ignored. */
|
|
30
|
+
href?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function Button({
|
|
34
|
+
variant = 'primary',
|
|
35
|
+
size = 'md',
|
|
36
|
+
loading = false,
|
|
37
|
+
loadingLabel = 'Loading',
|
|
38
|
+
leadingIcon,
|
|
39
|
+
trailingIcon,
|
|
40
|
+
fullWidth,
|
|
41
|
+
href,
|
|
42
|
+
disabledReason,
|
|
43
|
+
className,
|
|
44
|
+
children,
|
|
45
|
+
type = 'button',
|
|
46
|
+
onClick,
|
|
47
|
+
onPointerDown,
|
|
48
|
+
onPointerMove,
|
|
49
|
+
onPointerLeave,
|
|
50
|
+
onKeyDown,
|
|
51
|
+
onKeyUp,
|
|
52
|
+
onBlur,
|
|
53
|
+
'aria-disabled': ariaDisabledProp,
|
|
54
|
+
ref,
|
|
55
|
+
...rest
|
|
56
|
+
}: ButtonProps) {
|
|
57
|
+
const reasonId = useId()
|
|
58
|
+
const inert = loading || Boolean(rest.disabled) || ariaDisabledProp === true || ariaDisabledProp === 'true'
|
|
59
|
+
// The edge is soft: it dents where pressed and springs back (internal/softPress.ts).
|
|
60
|
+
const soft = useSoftPress({ layer: styles.soft, fill: styles.softFill, ring: styles.softRing, wet: styles.wet }, inert, href === undefined ? [' ', 'Enter'] : ['Enter'])
|
|
61
|
+
const reason = (Boolean(rest.disabled) || ariaDisabledProp === true || ariaDisabledProp === 'true') ? disabledReason : undefined
|
|
62
|
+
const describedBy = [rest['aria-describedby'], reason ? reasonId : undefined].filter(Boolean).join(' ') || undefined
|
|
63
|
+
const shared = {
|
|
64
|
+
'aria-describedby': describedBy,
|
|
65
|
+
title: rest.title ?? reason,
|
|
66
|
+
className: cx(styles.root, styles[variant], styles[size], fullWidth && styles.full, className),
|
|
67
|
+
'data-loading': loading || undefined,
|
|
68
|
+
'aria-busy': loading || undefined,
|
|
69
|
+
'aria-disabled': inert || undefined,
|
|
70
|
+
onClick: (e: MouseEvent<HTMLButtonElement>) => {
|
|
71
|
+
// preventDefault also stops a submit button or a link while it is inert.
|
|
72
|
+
if (inert) {
|
|
73
|
+
e.preventDefault()
|
|
74
|
+
return
|
|
75
|
+
}
|
|
76
|
+
onClick?.(e)
|
|
77
|
+
},
|
|
78
|
+
onPointerDown: (e: PointerEvent<HTMLButtonElement>) => {
|
|
79
|
+
soft.onPointerDown(e)
|
|
80
|
+
onPointerDown?.(e)
|
|
81
|
+
},
|
|
82
|
+
onPointerMove: (e: PointerEvent<HTMLButtonElement>) => {
|
|
83
|
+
soft.onPointerMove(e)
|
|
84
|
+
onPointerMove?.(e)
|
|
85
|
+
},
|
|
86
|
+
onPointerLeave: (e: PointerEvent<HTMLButtonElement>) => {
|
|
87
|
+
soft.onPointerLeave()
|
|
88
|
+
onPointerLeave?.(e)
|
|
89
|
+
},
|
|
90
|
+
onKeyDown: (e: KeyboardEvent<HTMLButtonElement>) => {
|
|
91
|
+
soft.onKeyDown(e)
|
|
92
|
+
onKeyDown?.(e)
|
|
93
|
+
},
|
|
94
|
+
onKeyUp: (e: KeyboardEvent<HTMLButtonElement>) => {
|
|
95
|
+
soft.onKeyUp(e)
|
|
96
|
+
onKeyUp?.(e)
|
|
97
|
+
},
|
|
98
|
+
onBlur: (e: FocusEvent<HTMLButtonElement>) => {
|
|
99
|
+
soft.onBlur()
|
|
100
|
+
onBlur?.(e)
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
const inner = (
|
|
104
|
+
<>
|
|
105
|
+
<span className={styles.content}>
|
|
106
|
+
{leadingIcon && <span className={styles.icon}>{leadingIcon}</span>}
|
|
107
|
+
<span className={styles.label}>{children}</span>
|
|
108
|
+
{trailingIcon && <span className={styles.icon}>{trailingIcon}</span>}
|
|
109
|
+
</span>
|
|
110
|
+
<span className={styles.spinner} aria-hidden="true">
|
|
111
|
+
{loading && <Spinner size="sm" label={null} />}
|
|
112
|
+
</span>
|
|
113
|
+
{/* Stays mounted, because screen readers skip a live region that appears with its text. */}
|
|
114
|
+
<span className={styles.srOnly} role="status">
|
|
115
|
+
{loading ? loadingLabel : null}
|
|
116
|
+
</span>
|
|
117
|
+
{reason && (
|
|
118
|
+
// Hidden from the name, so it is read once, as the description.
|
|
119
|
+
<span id={reasonId} className={styles.srOnly} aria-hidden="true">
|
|
120
|
+
{reason}
|
|
121
|
+
</span>
|
|
122
|
+
)}
|
|
123
|
+
</>
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
if (href !== undefined) {
|
|
127
|
+
const { disabled, form, formAction, formEncType, formMethod, formNoValidate, formTarget, name, value, ...linkRest } = rest
|
|
128
|
+
return (
|
|
129
|
+
<a
|
|
130
|
+
{...(linkRest as ComponentPropsWithRef<'a'>)}
|
|
131
|
+
{...(shared as unknown as ComponentPropsWithRef<'a'>)}
|
|
132
|
+
ref={ref as Ref<HTMLAnchorElement>}
|
|
133
|
+
// A link has no disabled state; without href it leaves the tab order like a disabled button.
|
|
134
|
+
href={disabled ? undefined : href}
|
|
135
|
+
role={disabled ? 'link' : undefined}
|
|
136
|
+
>
|
|
137
|
+
{inner}
|
|
138
|
+
</a>
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return (
|
|
143
|
+
// With a reason the button is aria-disabled only: a natively disabled button cannot take focus, so its reason could not be reached.
|
|
144
|
+
<button {...rest} disabled={reason ? undefined : rest.disabled} {...shared} ref={ref} type={type}>
|
|
145
|
+
{inner}
|
|
146
|
+
</button>
|
|
147
|
+
)
|
|
148
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Button'
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
width: fit-content;
|
|
4
|
+
max-width: 100%;
|
|
5
|
+
isolation: isolate;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* With no room, the row wraps; each row keeps its joined look and its own round ends. */
|
|
9
|
+
.horizontal {
|
|
10
|
+
flex-wrap: wrap;
|
|
11
|
+
row-gap: var(--gooee-space-2);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.vertical {
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
align-items: stretch;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* Both classes, so these win over each button's own radius whatever order the styles load in. */
|
|
20
|
+
.root.root > * {
|
|
21
|
+
position: relative;
|
|
22
|
+
flex: none;
|
|
23
|
+
margin: 0;
|
|
24
|
+
border-radius: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Neighbours overlap by one line, so two borders read as one. */
|
|
28
|
+
.horizontal.horizontal > * + :not([data-row-start]) { margin-inline-start: calc(var(--gooee-line) * -1); }
|
|
29
|
+
.vertical.vertical > * + * { margin-block-start: calc(var(--gooee-line) * -1); }
|
|
30
|
+
/* min-width, not width: a button keeps its own size, and the narrower ones grow to the widest. */
|
|
31
|
+
.vertical.vertical > * { min-width: 100%; }
|
|
32
|
+
|
|
33
|
+
.horizontal.horizontal > :first-child,
|
|
34
|
+
.horizontal.horizontal > [data-row-start] {
|
|
35
|
+
border-start-start-radius: var(--gooee-radius-control);
|
|
36
|
+
border-end-start-radius: var(--gooee-radius-control);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.horizontal.horizontal > :last-child,
|
|
40
|
+
.horizontal.horizontal > [data-row-end] {
|
|
41
|
+
border-start-end-radius: var(--gooee-radius-control);
|
|
42
|
+
border-end-end-radius: var(--gooee-radius-control);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.vertical.vertical > :first-child {
|
|
46
|
+
border-start-start-radius: var(--gooee-radius-md);
|
|
47
|
+
border-start-end-radius: var(--gooee-radius-md);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.vertical.vertical > :last-child {
|
|
51
|
+
border-end-start-radius: var(--gooee-radius-md);
|
|
52
|
+
border-end-end-radius: var(--gooee-radius-md);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* The hovered and the focused button rise above their neighbours, so the full edge and focus ring show. */
|
|
56
|
+
@media (hover: hover) {
|
|
57
|
+
.root > :hover { z-index: 1; }
|
|
58
|
+
}
|
|
59
|
+
.root > :focus-visible { z-index: 2; }
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useLayoutEffect, useRef, type ComponentPropsWithRef, type ReactNode } from 'react'
|
|
2
|
+
import { cx } from '../../internal/cx'
|
|
3
|
+
import { mergeRefs } from '../../internal/mergeRefs'
|
|
4
|
+
import styles from './ButtonGroup.module.css'
|
|
5
|
+
|
|
6
|
+
export type ButtonGroupProps = Omit<ComponentPropsWithRef<'div'>, 'children'> & {
|
|
7
|
+
/** Accessible name for the group, such as "Text alignment". */
|
|
8
|
+
label: string
|
|
9
|
+
/** The Button, IconButton or Toggle elements to join. Secondary ones show the shared borders best. */
|
|
10
|
+
children: ReactNode
|
|
11
|
+
/** A row, or a column where each button takes the full width. */
|
|
12
|
+
orientation?: 'horizontal' | 'vertical'
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// A row with no room wraps onto more rows. Each row stays joined, with round ends of its own, so the
|
|
16
|
+
// buttons that start and end a row are marked as they fall.
|
|
17
|
+
export function ButtonGroup({ label, children, orientation = 'horizontal', className, ref, ...rest }: ButtonGroupProps) {
|
|
18
|
+
const own = useRef<HTMLDivElement>(null)
|
|
19
|
+
useLayoutEffect(() => {
|
|
20
|
+
const root = own.current
|
|
21
|
+
if (!root || orientation !== 'horizontal') return
|
|
22
|
+
const mark = () => {
|
|
23
|
+
const kids = [...root.children] as HTMLElement[]
|
|
24
|
+
kids.forEach((k, i) => {
|
|
25
|
+
const prev = kids[i - 1], next = kids[i + 1]
|
|
26
|
+
k.toggleAttribute('data-row-start', !prev || prev.offsetTop !== k.offsetTop)
|
|
27
|
+
k.toggleAttribute('data-row-end', !next || next.offsetTop !== k.offsetTop)
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
mark()
|
|
31
|
+
const ro = new ResizeObserver(mark)
|
|
32
|
+
ro.observe(root)
|
|
33
|
+
const mo = new MutationObserver(mark)
|
|
34
|
+
mo.observe(root, { childList: true })
|
|
35
|
+
return () => {
|
|
36
|
+
ro.disconnect()
|
|
37
|
+
mo.disconnect()
|
|
38
|
+
}
|
|
39
|
+
}, [orientation])
|
|
40
|
+
return (
|
|
41
|
+
<div {...rest} ref={mergeRefs(own, ref)} role="group" aria-label={label} className={cx(styles.root, styles[orientation], className)} data-orientation={orientation}>
|
|
42
|
+
{children}
|
|
43
|
+
</div>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ButtonGroup'
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
min-width: 0;
|
|
6
|
+
border: var(--gooee-line) solid var(--gooee-color-border);
|
|
7
|
+
border-radius: var(--gooee-radius-panel);
|
|
8
|
+
background: var(--gooee-color-surface);
|
|
9
|
+
box-shadow: var(--gooee-shadow-1);
|
|
10
|
+
transition:
|
|
11
|
+
transform var(--gooee-motion-slow) var(--gooee-ease-spring),
|
|
12
|
+
box-shadow var(--gooee-motion-slow) var(--gooee-ease-out),
|
|
13
|
+
border-color var(--gooee-motion-base) var(--gooee-ease-out);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@media (hover: hover) {
|
|
17
|
+
.interactive:hover {
|
|
18
|
+
transform: translateY(calc(var(--gooee-shift-sm) * -1));
|
|
19
|
+
box-shadow: var(--gooee-shadow-3);
|
|
20
|
+
border-color: var(--gooee-color-border-strong);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* The lift moves the card off a pointer on its lower edge, and it would drop back and lift again.
|
|
24
|
+
This fills the gap below while it is up: twice the lift, since the spring overshoots. The card
|
|
25
|
+
does not clip, so the strip can reach out. */
|
|
26
|
+
.interactive:hover::after { content: ""; position: absolute; inset: 100% 0 calc(var(--gooee-shift-sm) * -2); }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.interactive:active { transform: translateY(0) scale(0.995); transition-duration: var(--gooee-motion-fast); }
|
|
30
|
+
|
|
31
|
+
.interactive:focus-within:has(:focus-visible) {
|
|
32
|
+
box-shadow: var(--gooee-focus-ring);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.media {
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
border-bottom: var(--gooee-line) solid var(--gooee-color-border);
|
|
38
|
+
border-radius: calc(var(--gooee-radius-panel) - var(--gooee-line)) calc(var(--gooee-radius-panel) - var(--gooee-line)) 0 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.media > * { transition: transform var(--gooee-motion-slower) var(--gooee-ease-out); }
|
|
42
|
+
@media (hover: hover) {
|
|
43
|
+
.interactive:hover .media > * { transform: scale(1.03); }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.body {
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
gap: var(--gooee-space-3);
|
|
50
|
+
padding: var(--gooee-space-6);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.lg .body { padding: var(--gooee-space-8); }
|
|
54
|
+
|
|
55
|
+
@media (max-width: 520px) {
|
|
56
|
+
.lg .body { padding: var(--gooee-space-6); }
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.fill > .body { flex: 1; }
|
|
60
|
+
|
|
61
|
+
.title {
|
|
62
|
+
margin: 0;
|
|
63
|
+
font-size: var(--gooee-text-lg);
|
|
64
|
+
font-weight: var(--gooee-weight-semibold);
|
|
65
|
+
letter-spacing: var(--gooee-tracking-tight);
|
|
66
|
+
line-height: var(--gooee-leading-tight);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.description {
|
|
70
|
+
margin: 0;
|
|
71
|
+
color: var(--gooee-color-fg-muted);
|
|
72
|
+
font-size: var(--gooee-text-sm);
|
|
73
|
+
line-height: var(--gooee-leading-normal);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.footer {
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
gap: var(--gooee-space-3);
|
|
80
|
+
padding: var(--gooee-space-4) var(--gooee-space-6);
|
|
81
|
+
border-top: var(--gooee-line) solid var(--gooee-color-border);
|
|
82
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef, ReactNode } from 'react'
|
|
2
|
+
import { cx } from '../../internal/cx'
|
|
3
|
+
import styles from './Card.module.css'
|
|
4
|
+
|
|
5
|
+
export type CardProps = Omit<ComponentPropsWithRef<'div'>, 'title'> & {
|
|
6
|
+
/** Heading at the top of the body, rendered as an h3. Any content, not the native tooltip. */
|
|
7
|
+
title?: ReactNode
|
|
8
|
+
/** Muted text under the title. */
|
|
9
|
+
description?: ReactNode
|
|
10
|
+
/** Media or a header slot shown above the body, edge to edge. */
|
|
11
|
+
media?: ReactNode
|
|
12
|
+
/** Row under the body, set apart by a border, such as actions. */
|
|
13
|
+
footer?: ReactNode
|
|
14
|
+
/** Lifts on hover. Use when the card holds a link or button that covers it. */
|
|
15
|
+
interactive?: boolean
|
|
16
|
+
/** Space inside the card. */
|
|
17
|
+
padding?: 'md' | 'lg'
|
|
18
|
+
/** Lets the body grow when the card is stretched (a grid cell or flex row), so the footer or a last button sits at the bottom. */
|
|
19
|
+
fill?: boolean
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function Card({ title, description, media, footer, interactive, padding = 'md', fill, className, children, ...rest }: CardProps) {
|
|
23
|
+
return (
|
|
24
|
+
<div className={cx(styles.root, interactive && styles.interactive, styles[padding], fill && styles.fill, className)} {...rest}>
|
|
25
|
+
{media && <div className={styles.media}>{media}</div>}
|
|
26
|
+
<div className={styles.body}>
|
|
27
|
+
{title && <h3 className={styles.title}>{title}</h3>}
|
|
28
|
+
{description && <p className={styles.description}>{description}</p>}
|
|
29
|
+
{children}
|
|
30
|
+
</div>
|
|
31
|
+
{footer && <div className={styles.footer}>{footer}</div>}
|
|
32
|
+
</div>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Card'
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: var(--center-gap);
|
|
6
|
+
min-width: 0;
|
|
7
|
+
min-height: var(--center-min-h, auto);
|
|
8
|
+
margin: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.both { justify-content: center; }
|
|
12
|
+
.text { text-align: center; }
|
|
13
|
+
|
|
14
|
+
/* A child wider than the box wraps instead of spilling out on both sides. */
|
|
15
|
+
.root > * { max-width: 100%; }
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef, CSSProperties } from 'react'
|
|
2
|
+
import { cx } from '../../internal/cx'
|
|
3
|
+
import { space, type Space } from '../../internal/space'
|
|
4
|
+
import styles from './Center.module.css'
|
|
5
|
+
|
|
6
|
+
export type CenterProps = ComponentPropsWithRef<'div'> & {
|
|
7
|
+
/** "both" centres across and down; "inline" only across, and content starts at the top. */
|
|
8
|
+
axis?: 'both' | 'inline'
|
|
9
|
+
/** Least height of the box, from the --gooee-center-h-* tokens. "screen" fills the visible screen. Down centring needs a height to work in. */
|
|
10
|
+
minHeight?: 'sm' | 'md' | 'lg' | 'screen'
|
|
11
|
+
/** Centres each line of text too. Turn off for long text that reads better from the left. */
|
|
12
|
+
centerText?: boolean
|
|
13
|
+
/** Space between the items, as a step of the space scale. */
|
|
14
|
+
gap?: Space
|
|
15
|
+
/** Element to render, such as main for a full page error. */
|
|
16
|
+
as?: 'div' | 'section' | 'main' | 'article'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function Center({ axis = 'both', minHeight, centerText = true, gap = 4, as = 'div', className, style, ...rest }: CenterProps) {
|
|
20
|
+
// One cast keeps the ref and attribute types simple; every option is a block element.
|
|
21
|
+
const Tag = as as 'div'
|
|
22
|
+
const vars = {
|
|
23
|
+
'--center-gap': space(gap),
|
|
24
|
+
'--center-min-h': minHeight ? `var(--gooee-center-h-${minHeight})` : undefined,
|
|
25
|
+
...style,
|
|
26
|
+
} as CSSProperties
|
|
27
|
+
return <Tag className={cx(styles.root, axis === 'both' && styles.both, centerText && styles.text, className)} style={vars} {...rest} />
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Center'
|