@blakesteve/roster 5.0.1 → 5.2.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/README.md +110 -9
- package/dist/components/atoms/Chip/Chip.cjs +1 -1
- package/dist/components/atoms/Chip/Chip.js +27 -27
- package/dist/components/atoms/Disclosure/Disclosure.cjs +1 -1
- package/dist/components/atoms/Disclosure/Disclosure.js +42 -44
- package/dist/components/atoms/Input/Input.cjs +1 -1
- package/dist/components/atoms/Input/Input.js +46 -41
- package/dist/components/atoms/Spinner/Spinner.cjs +1 -1
- package/dist/components/atoms/Spinner/Spinner.d.ts +6 -1
- package/dist/components/atoms/Spinner/Spinner.js +9 -8
- package/dist/components/atoms/Stat/Stat.cjs +1 -1
- package/dist/components/atoms/Stat/Stat.d.ts +27 -2
- package/dist/components/atoms/Stat/Stat.js +38 -13
- package/dist/components/atoms/Switch/Switch.cjs +1 -1
- package/dist/components/atoms/Switch/Switch.d.ts +11 -1
- package/dist/components/atoms/Switch/Switch.js +38 -36
- package/dist/components/atoms/Switch/switch-variants.cjs +1 -1
- package/dist/components/atoms/Switch/switch-variants.js +1 -1
- package/dist/components/molecules/Carousel/Carousel.cjs +1 -0
- package/dist/components/molecules/Carousel/Carousel.d.ts +146 -0
- package/dist/components/molecules/Carousel/Carousel.js +363 -0
- package/dist/components/molecules/Carousel/carousel-layout.cjs +1 -0
- package/dist/components/molecules/Carousel/carousel-layout.d.ts +23 -0
- package/dist/components/molecules/Carousel/carousel-layout.js +22 -0
- package/dist/components/molecules/Carousel/carousel-math.cjs +1 -0
- package/dist/components/molecules/Carousel/carousel-math.d.ts +60 -0
- package/dist/components/molecules/Carousel/carousel-math.js +58 -0
- package/dist/components/molecules/EmptyState/EmptyState.cjs +1 -1
- package/dist/components/molecules/EmptyState/EmptyState.d.ts +7 -1
- package/dist/components/molecules/EmptyState/EmptyState.js +18 -14
- package/dist/components/molecules/LiquidTabs/LiquidNav.cjs +1 -0
- package/dist/components/molecules/LiquidTabs/LiquidNav.d.ts +62 -0
- package/dist/components/molecules/LiquidTabs/LiquidNav.js +78 -0
- package/dist/components/molecules/LiquidTabs/LiquidTabs.cjs +1 -0
- package/dist/components/molecules/LiquidTabs/LiquidTabs.d.ts +69 -0
- package/dist/components/molecules/LiquidTabs/LiquidTabs.js +92 -0
- package/dist/components/molecules/LiquidTabs/liquid-pill.cjs +1 -0
- package/dist/components/molecules/LiquidTabs/liquid-pill.d.ts +56 -0
- package/dist/components/molecules/LiquidTabs/liquid-pill.js +129 -0
- package/dist/components/molecules/LiquidTabs/liquid-tab-id.cjs +1 -0
- package/dist/components/molecules/LiquidTabs/liquid-tab-id.d.ts +12 -0
- package/dist/components/molecules/LiquidTabs/liquid-tab-id.js +6 -0
- package/dist/components/molecules/Toast/Toaster.cjs +1 -1
- package/dist/components/molecules/Toast/Toaster.d.ts +7 -0
- package/dist/components/molecules/Toast/Toaster.js +67 -45
- package/dist/components/organisms/Dialog/Dialog.cjs +1 -1
- package/dist/components/organisms/Dialog/Dialog.js +102 -79
- package/dist/components/organisms/Navbar/Navbar.cjs +1 -1
- package/dist/components/organisms/Navbar/Navbar.js +157 -157
- package/dist/components/organisms/Sheet/Sheet.cjs +1 -0
- package/dist/components/organisms/Sheet/Sheet.d.ts +85 -0
- package/dist/components/organisms/Sheet/Sheet.js +304 -0
- package/dist/components/organisms/Sheet/sheet-drag.cjs +1 -0
- package/dist/components/organisms/Sheet/sheet-drag.d.ts +40 -0
- package/dist/components/organisms/Sheet/sheet-drag.js +22 -0
- package/dist/components/organisms/Sheet/sheet-title.cjs +1 -0
- package/dist/components/organisms/Sheet/sheet-title.d.ts +10 -0
- package/dist/components/organisms/Sheet/sheet-title.js +17 -0
- package/dist/index.d.ts +5 -1
- package/dist/internal/motion.cjs +1 -0
- package/dist/internal/motion.d.ts +12 -0
- package/dist/internal/motion.js +21 -0
- package/dist/internal/page-inert.cjs +1 -0
- package/dist/internal/page-inert.d.ts +51 -0
- package/dist/internal/page-inert.js +36 -0
- package/dist/meta.json +3 -3
- package/dist/roster.cjs +1 -1
- package/dist/roster.css +1 -1
- package/dist/roster.js +130 -122
- package/package.json +1 -1
- package/dist/components/atoms/LiquidTabs/LiquidTabs.cjs +0 -1
- package/dist/components/atoms/LiquidTabs/LiquidTabs.d.ts +0 -39
- package/dist/components/atoms/LiquidTabs/LiquidTabs.js +0 -120
package/dist/roster.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Avatar as e } from "./components/atoms/Avatar/Avatar.js";
|
|
3
3
|
import { avatarVariants as p } from "./components/atoms/Avatar/avatar-variants.js";
|
|
4
4
|
import { Badge as m } from "./components/atoms/Badge/Badge.js";
|
|
5
|
-
import { badgeVariants as
|
|
5
|
+
import { badgeVariants as f } from "./components/atoms/Badge/badge-variants.js";
|
|
6
6
|
import { Button as s } from "./components/atoms/Button/Button.js";
|
|
7
7
|
import { buttonVariants as V } from "./components/atoms/Button/button-variants.js";
|
|
8
8
|
import { Card as b } from "./components/atoms/Card/Card.js";
|
|
@@ -10,14 +10,14 @@ import { cardVariants as u } from "./components/atoms/Card/card-variants.js";
|
|
|
10
10
|
import { Checkbox as C } from "./components/atoms/Checkbox/Checkbox.js";
|
|
11
11
|
import { checkboxVariants as S } from "./components/atoms/Checkbox/checkbox-variants.js";
|
|
12
12
|
import { Disclosure as w } from "./components/atoms/Disclosure/Disclosure.js";
|
|
13
|
-
import { disclosureContentVariants as
|
|
14
|
-
import { Input as
|
|
15
|
-
import { iconVariants as
|
|
13
|
+
import { disclosureContentVariants as v, disclosureTriggerVariants as A } from "./components/atoms/Disclosure/disclosure-variants.js";
|
|
14
|
+
import { Input as D } from "./components/atoms/Input/Input.js";
|
|
15
|
+
import { iconVariants as q, inputVariants as y } from "./components/atoms/Input/input-variants.js";
|
|
16
16
|
import { Link as I } from "./components/atoms/Link/Link.js";
|
|
17
|
-
import { linkVariants as
|
|
17
|
+
import { linkVariants as G } from "./components/atoms/Link/link-variants.js";
|
|
18
18
|
import { PasswordInput as H } from "./components/atoms/PasswordInput/PasswordInput.js";
|
|
19
|
-
import { Combobox as
|
|
20
|
-
import { Chip as
|
|
19
|
+
import { Combobox as R } from "./components/atoms/Combobox/Combobox.js";
|
|
20
|
+
import { Chip as M } from "./components/atoms/Chip/Chip.js";
|
|
21
21
|
import { chipVariants as _ } from "./components/atoms/Chip/chip-variants.js";
|
|
22
22
|
import { Pill as X } from "./components/atoms/Pill/Pill.js";
|
|
23
23
|
import { pillDotVariants as z, pillVariants as J } from "./components/atoms/Pill/pill-variants.js";
|
|
@@ -28,157 +28,165 @@ import { inlineCodeVariants as tr } from "./components/atoms/InlineCode/inline-c
|
|
|
28
28
|
import { LabeledDivider as ar } from "./components/atoms/LabeledDivider/LabeledDivider.js";
|
|
29
29
|
import { Stat as ir } from "./components/atoms/Stat/Stat.js";
|
|
30
30
|
import { statValueVariants as xr } from "./components/atoms/Stat/stat-variants.js";
|
|
31
|
-
import { ThemeToggle as
|
|
31
|
+
import { ThemeToggle as nr } from "./components/atoms/ThemeToggle/ThemeToggle.js";
|
|
32
32
|
import { MultiSelect as lr } from "./components/atoms/MultiSelect/MultiSelect.js";
|
|
33
33
|
import { Select as cr } from "./components/atoms/Select/Select.js";
|
|
34
34
|
import { selectOptionVariants as dr, selectTriggerVariants as ur } from "./components/atoms/Select/select-variants.js";
|
|
35
35
|
import { Spinner as Cr } from "./components/atoms/Spinner/Spinner.js";
|
|
36
36
|
import { Switch as Sr } from "./components/atoms/Switch/Switch.js";
|
|
37
37
|
import { switchThumbVariants as wr, switchTrackVariants as kr } from "./components/atoms/Switch/switch-variants.js";
|
|
38
|
-
import { Textarea as
|
|
39
|
-
import { textareaVariants as
|
|
40
|
-
import { AvatarStrip as
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
import {
|
|
67
|
-
import {
|
|
68
|
-
import {
|
|
69
|
-
import {
|
|
70
|
-
import {
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
73
|
-
import {
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
76
|
-
import {
|
|
77
|
-
import {
|
|
78
|
-
import {
|
|
79
|
-
import {
|
|
80
|
-
import {
|
|
38
|
+
import { Textarea as Ar } from "./components/atoms/Textarea/Textarea.js";
|
|
39
|
+
import { textareaVariants as Dr } from "./components/atoms/Textarea/textarea-variants.js";
|
|
40
|
+
import { AvatarStrip as qr } from "./components/atoms/AvatarStrip/AvatarStrip.js";
|
|
41
|
+
import { Tooltip as Er } from "./components/atoms/Tooltip/Tooltip.js";
|
|
42
|
+
import { CollapsibleSection as Lr } from "./components/atoms/CollapsibleSection/CollapsibleSection.js";
|
|
43
|
+
import { SegmentBar as Pr } from "./components/atoms/SegmentBar/SegmentBar.js";
|
|
44
|
+
import { Toast as Nr } from "./components/molecules/Toast/Toast.js";
|
|
45
|
+
import { toastVariants as Fr } from "./components/molecules/Toast/toast-variants.js";
|
|
46
|
+
import { Toaster as Kr } from "./components/molecules/Toast/Toaster.js";
|
|
47
|
+
import { TONE_PREFIX as Wr, toast as Xr } from "./components/molecules/Toast/toast-api.js";
|
|
48
|
+
import { Alert as zr } from "./components/molecules/Alert/Alert.js";
|
|
49
|
+
import { alertVariants as Qr } from "./components/molecules/Alert/alert-variants.js";
|
|
50
|
+
import { Accordion as Yr } from "./components/molecules/Accordion/Accordion.js";
|
|
51
|
+
import { DescriptionList as $r } from "./components/molecules/DescriptionList/DescriptionList.js";
|
|
52
|
+
import { descriptionListVariants as oo } from "./components/molecules/DescriptionList/description-list-variants.js";
|
|
53
|
+
import { Pullquote as eo } from "./components/molecules/Pullquote/Pullquote.js";
|
|
54
|
+
import { pullquoteVariants as po } from "./components/molecules/Pullquote/pullquote-variants.js";
|
|
55
|
+
import { CheckboxGroup as mo } from "./components/molecules/CheckboxGroup/CheckboxGroup.js";
|
|
56
|
+
import { checkboxGroupOptionsVariants as fo, checkboxGroupPanelVariants as no } from "./components/molecules/CheckboxGroup/checkbox-group-variants.js";
|
|
57
|
+
import { RadioGroup as lo } from "./components/molecules/RadioGroup/RadioGroup.js";
|
|
58
|
+
import { radioDotVariants as co, radioGroupOptionsVariants as bo, radioOptionVariants as uo, radioVariants as To } from "./components/molecules/RadioGroup/radio-group-variants.js";
|
|
59
|
+
import { Breadcrumbs as ho } from "./components/molecules/Breadcrumbs/Breadcrumbs.js";
|
|
60
|
+
import { breadcrumbVariants as go } from "./components/molecules/Breadcrumbs/breadcrumb-variants.js";
|
|
61
|
+
import { LiquidTabs as ko } from "./components/molecules/LiquidTabs/LiquidTabs.js";
|
|
62
|
+
import { LiquidNav as Ao } from "./components/molecules/LiquidTabs/LiquidNav.js";
|
|
63
|
+
import { liquidTabId as Do } from "./components/molecules/LiquidTabs/liquid-tab-id.js";
|
|
64
|
+
import { Carousel as qo } from "./components/molecules/Carousel/Carousel.js";
|
|
65
|
+
import { CallToAction as Eo } from "./components/molecules/CallToAction/CallToAction.js";
|
|
66
|
+
import { ctaVariants as Lo } from "./components/molecules/CallToAction/call-to-action-variants.js";
|
|
67
|
+
import { EmptyState as Po } from "./components/molecules/EmptyState/EmptyState.js";
|
|
68
|
+
import { emptyStateVariants as No } from "./components/molecules/EmptyState/empty-state-variants.js";
|
|
69
|
+
import { ErrorState as Fo } from "./components/molecules/ErrorState/ErrorState.js";
|
|
70
|
+
import { errorStateVariants as Ko } from "./components/molecules/ErrorState/error-state-variants.js";
|
|
71
|
+
import { MatchupCard as Wo } from "./components/molecules/MatchupCard/MatchupCard.js";
|
|
72
|
+
import { ActionBar as jo } from "./components/organisms/ActionBar/ActionBar.js";
|
|
73
|
+
import { actionBarVariants as Jo } from "./components/organisms/ActionBar/action-bar-variants.js";
|
|
74
|
+
import { Countdown as Uo } from "./components/organisms/Countdown/Countdown.js";
|
|
75
|
+
import { Dialog as Zo } from "./components/organisms/Dialog/Dialog.js";
|
|
76
|
+
import { Footer as rt } from "./components/organisms/Footer/Footer.js";
|
|
77
|
+
import { Navbar as tt } from "./components/organisms/Navbar/Navbar.js";
|
|
78
|
+
import { navbarVariants as at } from "./components/organisms/Navbar/navbar-variants.js";
|
|
79
|
+
import { Sheet as it } from "./components/organisms/Sheet/Sheet.js";
|
|
80
|
+
import { Table as xt, TableBody as ft, TableCaption as nt, TableCell as st, TableFooter as lt, TableHead as Vt, TableHeader as ct, TableRow as bt } from "./components/organisms/Table/Table.js";
|
|
81
|
+
import { tableCellVariants as ut, tableHeadVariants as Tt, tableHeaderVariants as Ct, tableRowVariants as ht, tableVariants as St, tableWrapperVariants as gt } from "./components/organisms/Table/table-variants.js";
|
|
82
|
+
import { useCountdown as kt } from "./hooks/useCountdown.js";
|
|
83
|
+
import { KONAMI_CODE as At, useKeySequence as Bt } from "./hooks/useKeySequence.js";
|
|
84
|
+
import { cn as Ot } from "./lib/utils.js";
|
|
81
85
|
export {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
Yr as Accordion,
|
|
87
|
+
jo as ActionBar,
|
|
88
|
+
zr as Alert,
|
|
85
89
|
e as Avatar,
|
|
86
|
-
|
|
90
|
+
qr as AvatarStrip,
|
|
87
91
|
m as Badge,
|
|
88
|
-
|
|
92
|
+
ho as Breadcrumbs,
|
|
89
93
|
s as Button,
|
|
90
|
-
|
|
94
|
+
Eo as CallToAction,
|
|
91
95
|
b as Card,
|
|
96
|
+
qo as Carousel,
|
|
92
97
|
C as Checkbox,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
mo as CheckboxGroup,
|
|
99
|
+
M as Chip,
|
|
100
|
+
Lr as CollapsibleSection,
|
|
101
|
+
R as Combobox,
|
|
102
|
+
Uo as Countdown,
|
|
103
|
+
$r as DescriptionList,
|
|
104
|
+
Zo as Dialog,
|
|
100
105
|
w as Disclosure,
|
|
101
|
-
|
|
102
|
-
|
|
106
|
+
Po as EmptyState,
|
|
107
|
+
Fo as ErrorState,
|
|
103
108
|
U as Eyebrow,
|
|
104
|
-
|
|
109
|
+
rt as Footer,
|
|
105
110
|
rr as InlineCode,
|
|
106
|
-
|
|
107
|
-
|
|
111
|
+
D as Input,
|
|
112
|
+
At as KONAMI_CODE,
|
|
108
113
|
ar as LabeledDivider,
|
|
109
114
|
I as Link,
|
|
110
|
-
|
|
111
|
-
|
|
115
|
+
Ao as LiquidNav,
|
|
116
|
+
ko as LiquidTabs,
|
|
117
|
+
Wo as MatchupCard,
|
|
112
118
|
lr as MultiSelect,
|
|
113
|
-
|
|
119
|
+
tt as Navbar,
|
|
114
120
|
H as PasswordInput,
|
|
115
121
|
X as Pill,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
122
|
+
eo as Pullquote,
|
|
123
|
+
lo as RadioGroup,
|
|
124
|
+
Pr as SegmentBar,
|
|
119
125
|
cr as Select,
|
|
126
|
+
it as Sheet,
|
|
120
127
|
Cr as Spinner,
|
|
121
128
|
ir as Stat,
|
|
122
129
|
Sr as Switch,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
130
|
+
Wr as TONE_PREFIX,
|
|
131
|
+
xt as Table,
|
|
132
|
+
ft as TableBody,
|
|
133
|
+
nt as TableCaption,
|
|
134
|
+
st as TableCell,
|
|
135
|
+
lt as TableFooter,
|
|
136
|
+
Vt as TableHead,
|
|
137
|
+
ct as TableHeader,
|
|
138
|
+
bt as TableRow,
|
|
139
|
+
Ar as Textarea,
|
|
140
|
+
nr as ThemeToggle,
|
|
141
|
+
Nr as Toast,
|
|
142
|
+
Kr as Toaster,
|
|
143
|
+
Er as Tooltip,
|
|
144
|
+
Jo as actionBarVariants,
|
|
145
|
+
Qr as alertVariants,
|
|
139
146
|
p as avatarVariants,
|
|
140
|
-
|
|
141
|
-
|
|
147
|
+
f as badgeVariants,
|
|
148
|
+
go as breadcrumbVariants,
|
|
142
149
|
V as buttonVariants,
|
|
143
150
|
u as cardVariants,
|
|
144
|
-
|
|
145
|
-
|
|
151
|
+
fo as checkboxGroupOptionsVariants,
|
|
152
|
+
no as checkboxGroupPanelVariants,
|
|
146
153
|
S as checkboxVariants,
|
|
147
154
|
_ as chipVariants,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
+
Ot as cn,
|
|
156
|
+
Lo as ctaVariants,
|
|
157
|
+
oo as descriptionListVariants,
|
|
158
|
+
v as disclosureContentVariants,
|
|
159
|
+
A as disclosureTriggerVariants,
|
|
160
|
+
No as emptyStateVariants,
|
|
161
|
+
Ko as errorStateVariants,
|
|
155
162
|
Z as eyebrowVariants,
|
|
156
|
-
|
|
163
|
+
q as iconVariants,
|
|
157
164
|
tr as inlineCodeVariants,
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
165
|
+
y as inputVariants,
|
|
166
|
+
G as linkVariants,
|
|
167
|
+
Do as liquidTabId,
|
|
168
|
+
at as navbarVariants,
|
|
161
169
|
z as pillDotVariants,
|
|
162
170
|
J as pillVariants,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
171
|
+
po as pullquoteVariants,
|
|
172
|
+
co as radioDotVariants,
|
|
173
|
+
bo as radioGroupOptionsVariants,
|
|
174
|
+
uo as radioOptionVariants,
|
|
175
|
+
To as radioVariants,
|
|
168
176
|
dr as selectOptionVariants,
|
|
169
177
|
ur as selectTriggerVariants,
|
|
170
178
|
xr as statValueVariants,
|
|
171
179
|
wr as switchThumbVariants,
|
|
172
180
|
kr as switchTrackVariants,
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
ut as tableCellVariants,
|
|
182
|
+
Tt as tableHeadVariants,
|
|
183
|
+
Ct as tableHeaderVariants,
|
|
184
|
+
ht as tableRowVariants,
|
|
185
|
+
St as tableVariants,
|
|
186
|
+
gt as tableWrapperVariants,
|
|
187
|
+
Dr as textareaVariants,
|
|
188
|
+
Xr as toast,
|
|
189
|
+
Fr as toastVariants,
|
|
190
|
+
kt as useCountdown,
|
|
191
|
+
Bt as useKeySequence
|
|
184
192
|
};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),r=require("react"),c=require("../../../lib/utils.cjs");function C({tabs:g,activeTab:l,onChange:x,variant:R="pill",fullWidth:b=!1,className:v}){const w=r.useRef(null),a=r.useRef(null),f=r.useRef(null),o=r.useRef(null),m=r.useRef(!1),h=R==="filled",i=r.useCallback(t=>{const e=w.current;if(!e)return null;const s=e.querySelector(`[data-tab-id="${t}"]`);if(!s)return null;const n=e.getBoundingClientRect(),d=s.getBoundingClientRect();return{left:d.left-n.left,width:d.width}},[]),u=r.useCallback((t,e,s)=>{const n=a.current;n&&(n.style.transition=e,n.style.left=`${t.left}px`,n.style.width=`${t.width}px`,n.style.transform=`scaleY(${s})`)},[]);r.useEffect(()=>{const t=i(l);t&&(f.current=t,u(t,"none",1),a.current&&(a.current.style.opacity="1"),m.current=!0)},[]),r.useEffect(()=>{if(!m.current||o.current!==null)return;const t=i(l);t&&(f.current=t,u(t,"none",1))},[l,i,u]);const q=r.useCallback(t=>{if(t===l||(x(t),!m.current))return;o.current&&clearTimeout(o.current);const e=f.current??i(l),s=i(t);if(!e||!s)return;const n=Math.min(e.left,s.left),d=Math.max(e.left+e.width,s.left+s.width)-n;u({left:n,width:d},"left 130ms ease-out, width 130ms ease-out, transform 130ms ease-out",.55),o.current=setTimeout(()=>{const y=i(t)??s;f.current=y,u(y,"left 160ms ease-in, width 160ms ease-in, transform 160ms ease-in",1),o.current=null},130)},[l,i,x,u]);return r.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]),p.jsxs("div",{ref:w,role:"tablist","data-testid":"liquid-tabs",style:{background:"var(--roster-lt-bg)",borderColor:"var(--roster-lt-border)"},className:c.cn("rst:font-ui rst:relative rst:flex rst:border",h?"rst:w-full rst:overflow-hidden rst:rounded-lg":c.cn("rst:gap-1 rst:rounded-xl rst:p-1",b?"rst:w-full":"rst:w-fit"),v),children:[p.jsx("div",{ref:a,"aria-hidden":!0,"data-testid":"liquid-tabs-pill",className:c.cn("rst:absolute rst:rounded-lg",h?"rst:top-0 rst:bottom-0":"rst:top-1 rst:bottom-1"),style:{opacity:0,left:0,width:0,background:"var(--roster-lt-pill)"}}),g.map(t=>{const e=t.id===l;return p.jsx("button",{role:"tab","aria-selected":e,"data-tab-id":t.id,"data-testid":`liquid-tab-${t.id}`,onClick:()=>q(t.id),className:c.cn("rst:relative rst:z-10 rst:text-sm rst:font-medium rst:transition-colors rst:cursor-pointer",h?c.cn("rst:flex-1 rst:py-2",e?"rst:text-white":"rst:text-(--roster-lt-text-inactive) rst:hover:text-(--roster-lt-text-hover)"):c.cn("rst:rounded-lg rst:py-1.5",b?"rst:flex-1":"rst:px-4",e?"rst:text-white":"rst:text-(--roster-lt-text-inactive) rst:hover:text-(--roster-lt-text-hover)")),children:typeof t.label=="function"?t.label(e):t.label},t.id)})]})}exports.LiquidTabs=C;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
export interface TabItem {
|
|
3
|
-
id: string;
|
|
4
|
-
/** Static label, or a render function that receives whether this tab is active. */
|
|
5
|
-
label: ReactNode | ((isActive: boolean) => ReactNode);
|
|
6
|
-
}
|
|
7
|
-
export interface LiquidTabsProps {
|
|
8
|
-
tabs: TabItem[];
|
|
9
|
-
/** The `id` of the currently active tab. */
|
|
10
|
-
activeTab: string;
|
|
11
|
-
/** Called with the new tab `id` when the user selects a different tab. */
|
|
12
|
-
onChange: (id: string) => void;
|
|
13
|
-
/**
|
|
14
|
-
* `"pill"` (default) — floating pill inside a padded container.
|
|
15
|
-
* Width is `w-fit` by default; use `fullWidth` to stretch it.
|
|
16
|
-
* Liquid feel via scaleY squash during the stretch phase.
|
|
17
|
-
*
|
|
18
|
-
* `"filled"` — active tab fills its entire cell; container is always `w-full`.
|
|
19
|
-
* Liquid feel via border-radius morphing (oval during stretch) so the
|
|
20
|
-
* full-height pill never gaps at the container edges.
|
|
21
|
-
*/
|
|
22
|
-
variant?: "pill" | "filled";
|
|
23
|
-
/** Stretch the `pill` variant container to full width with `flex-1` buttons. */
|
|
24
|
-
fullWidth?: boolean;
|
|
25
|
-
/** Extra classes applied to the outer container. */
|
|
26
|
-
className?: string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Controlled tab strip with a liquid sliding indicator.
|
|
30
|
-
*
|
|
31
|
-
* The pill animation is driven by direct DOM ref manipulation (no setState)
|
|
32
|
-
* to avoid re-renders during the transition. Two-phase motion:
|
|
33
|
-
* 1. Stretch — pill expands to span the gap between old and new tab (130 ms ease-out).
|
|
34
|
-
* 2. Contract — pill snaps to the target tab (160 ms ease-in).
|
|
35
|
-
*
|
|
36
|
-
* `getBoundingClientRect` is used to measure tab positions, so the component
|
|
37
|
-
* must be rendered in a document with a real layout engine to animate.
|
|
38
|
-
*/
|
|
39
|
-
export declare function LiquidTabs({ tabs, activeTab, onChange, variant, fullWidth, className, }: LiquidTabsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs as k, jsx as v } from "react/jsx-runtime";
|
|
3
|
-
import { useRef as c, useCallback as h, useEffect as x } from "react";
|
|
4
|
-
import { cn as u } from "../../../lib/utils.js";
|
|
5
|
-
function B({
|
|
6
|
-
tabs: R,
|
|
7
|
-
activeTab: n,
|
|
8
|
-
onChange: w,
|
|
9
|
-
variant: q = "pill",
|
|
10
|
-
fullWidth: y = !1,
|
|
11
|
-
className: C
|
|
12
|
-
}) {
|
|
13
|
-
const g = c(null), d = c(null), a = c(null), l = c(null), m = c(!1), p = q === "filled", o = h((t) => {
|
|
14
|
-
const r = g.current;
|
|
15
|
-
if (!r) return null;
|
|
16
|
-
const e = r.querySelector(`[data-tab-id="${t}"]`);
|
|
17
|
-
if (!e) return null;
|
|
18
|
-
const s = r.getBoundingClientRect(), f = e.getBoundingClientRect();
|
|
19
|
-
return { left: f.left - s.left, width: f.width };
|
|
20
|
-
}, []), i = h((t, r, e) => {
|
|
21
|
-
const s = d.current;
|
|
22
|
-
s && (s.style.transition = r, s.style.left = `${t.left}px`, s.style.width = `${t.width}px`, s.style.transform = `scaleY(${e})`);
|
|
23
|
-
}, []);
|
|
24
|
-
x(() => {
|
|
25
|
-
const t = o(n);
|
|
26
|
-
t && (a.current = t, i(t, "none", 1), d.current && (d.current.style.opacity = "1"), m.current = !0);
|
|
27
|
-
}, []), x(() => {
|
|
28
|
-
if (!m.current || l.current !== null) return;
|
|
29
|
-
const t = o(n);
|
|
30
|
-
t && (a.current = t, i(t, "none", 1));
|
|
31
|
-
}, [n, o, i]);
|
|
32
|
-
const $ = h(
|
|
33
|
-
(t) => {
|
|
34
|
-
if (t === n || (w(t), !m.current)) return;
|
|
35
|
-
l.current && clearTimeout(l.current);
|
|
36
|
-
const r = a.current ?? o(n), e = o(t);
|
|
37
|
-
if (!r || !e) return;
|
|
38
|
-
const s = Math.min(r.left, e.left), f = Math.max(r.left + r.width, e.left + e.width) - s;
|
|
39
|
-
i(
|
|
40
|
-
{ left: s, width: f },
|
|
41
|
-
"left 130ms ease-out, width 130ms ease-out, transform 130ms ease-out",
|
|
42
|
-
0.55
|
|
43
|
-
), l.current = setTimeout(() => {
|
|
44
|
-
const b = o(t) ?? e;
|
|
45
|
-
a.current = b, i(
|
|
46
|
-
b,
|
|
47
|
-
"left 160ms ease-in, width 160ms ease-in, transform 160ms ease-in",
|
|
48
|
-
1
|
|
49
|
-
), l.current = null;
|
|
50
|
-
}, 130);
|
|
51
|
-
},
|
|
52
|
-
[n, o, w, i]
|
|
53
|
-
);
|
|
54
|
-
return x(
|
|
55
|
-
() => () => {
|
|
56
|
-
l.current && clearTimeout(l.current);
|
|
57
|
-
},
|
|
58
|
-
[]
|
|
59
|
-
), /* @__PURE__ */ k(
|
|
60
|
-
"div",
|
|
61
|
-
{
|
|
62
|
-
ref: g,
|
|
63
|
-
role: "tablist",
|
|
64
|
-
"data-testid": "liquid-tabs",
|
|
65
|
-
style: { background: "var(--roster-lt-bg)", borderColor: "var(--roster-lt-border)" },
|
|
66
|
-
className: u(
|
|
67
|
-
"rst:font-ui rst:relative rst:flex rst:border",
|
|
68
|
-
p ? "rst:w-full rst:overflow-hidden rst:rounded-lg" : u(
|
|
69
|
-
"rst:gap-1 rst:rounded-xl rst:p-1",
|
|
70
|
-
y ? "rst:w-full" : "rst:w-fit"
|
|
71
|
-
),
|
|
72
|
-
C
|
|
73
|
-
),
|
|
74
|
-
children: [
|
|
75
|
-
/* @__PURE__ */ v(
|
|
76
|
-
"div",
|
|
77
|
-
{
|
|
78
|
-
ref: d,
|
|
79
|
-
"aria-hidden": !0,
|
|
80
|
-
"data-testid": "liquid-tabs-pill",
|
|
81
|
-
className: u(
|
|
82
|
-
"rst:absolute rst:rounded-lg",
|
|
83
|
-
p ? "rst:top-0 rst:bottom-0" : "rst:top-1 rst:bottom-1"
|
|
84
|
-
),
|
|
85
|
-
style: { opacity: 0, left: 0, width: 0, background: "var(--roster-lt-pill)" }
|
|
86
|
-
}
|
|
87
|
-
),
|
|
88
|
-
R.map((t) => {
|
|
89
|
-
const r = t.id === n;
|
|
90
|
-
return /* @__PURE__ */ v(
|
|
91
|
-
"button",
|
|
92
|
-
{
|
|
93
|
-
role: "tab",
|
|
94
|
-
"aria-selected": r,
|
|
95
|
-
"data-tab-id": t.id,
|
|
96
|
-
"data-testid": `liquid-tab-${t.id}`,
|
|
97
|
-
onClick: () => $(t.id),
|
|
98
|
-
className: u(
|
|
99
|
-
"rst:relative rst:z-10 rst:text-sm rst:font-medium rst:transition-colors rst:cursor-pointer",
|
|
100
|
-
p ? u(
|
|
101
|
-
"rst:flex-1 rst:py-2",
|
|
102
|
-
r ? "rst:text-white" : "rst:text-(--roster-lt-text-inactive) rst:hover:text-(--roster-lt-text-hover)"
|
|
103
|
-
) : u(
|
|
104
|
-
"rst:rounded-lg rst:py-1.5",
|
|
105
|
-
y ? "rst:flex-1" : "rst:px-4",
|
|
106
|
-
r ? "rst:text-white" : "rst:text-(--roster-lt-text-inactive) rst:hover:text-(--roster-lt-text-hover)"
|
|
107
|
-
)
|
|
108
|
-
),
|
|
109
|
-
children: typeof t.label == "function" ? t.label(r) : t.label
|
|
110
|
-
},
|
|
111
|
-
t.id
|
|
112
|
-
);
|
|
113
|
-
})
|
|
114
|
-
]
|
|
115
|
-
}
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
export {
|
|
119
|
-
B as LiquidTabs
|
|
120
|
-
};
|