@blakesteve/roster 5.8.0 → 5.10.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 +126 -23
- package/dist/components/atoms/Button/button-variants.js +1 -1
- package/dist/components/atoms/Eyebrow/eyebrow-variants.d.ts +2 -2
- package/dist/components/atoms/Input/input-variants.js +1 -1
- package/dist/components/atoms/Skeleton/Skeleton.cjs +1 -1
- package/dist/components/atoms/Skeleton/Skeleton.d.ts +19 -3
- package/dist/components/atoms/Skeleton/Skeleton.js +38 -33
- package/dist/components/atoms/ThemeToggle/ThemeToggle.d.ts +1 -1
- package/dist/components/molecules/CheckboxGroup/CheckboxGroup.d.ts +1 -1
- package/dist/components/molecules/CheckboxGroup/checkbox-group-variants.d.ts +1 -1
- package/dist/components/molecules/Menu/Menu.cjs +1 -0
- package/dist/components/molecules/Menu/Menu.d.ts +169 -0
- package/dist/components/molecules/Menu/Menu.js +577 -0
- package/dist/components/molecules/Menu/menu-typeahead.cjs +1 -0
- package/dist/components/molecules/Menu/menu-typeahead.d.ts +7 -0
- package/dist/components/molecules/Menu/menu-typeahead.js +13 -0
- package/dist/components/molecules/SkeletonPresets/SkeletonPresets.cjs +1 -1
- package/dist/components/molecules/SkeletonPresets/SkeletonPresets.d.ts +13 -4
- package/dist/components/molecules/SkeletonPresets/SkeletonPresets.js +35 -35
- package/dist/components/molecules/Toast/Toaster.d.ts +1 -1
- package/dist/components/organisms/Navbar/Navbar.cjs +1 -1
- package/dist/components/organisms/Navbar/Navbar.d.ts +1 -1
- package/dist/components/organisms/Navbar/Navbar.js +275 -302
- package/dist/index.d.ts +1 -0
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.js +4 -1
- package/dist/meta.json +3 -3
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +7 -7
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +2 -2
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +5 -5
- package/dist/node_modules/@headlessui/react/dist/components/portal/portal.js +6 -6
- package/dist/node_modules/@headlessui/react/dist/utils/focus-management.cjs +1 -1
- package/dist/node_modules/@headlessui/react/dist/utils/focus-management.js +52 -61
- package/dist/node_modules/@radix-ui/react-popper/dist/index.js +6 -6
- package/dist/roster.cjs +1 -1
- package/dist/roster.css +1 -1
- package/dist/roster.js +127 -116
- package/package.json +2 -1
- package/dist/node_modules/@headlessui/react/dist/components/menu/menu-machine-glue.cjs +0 -1
- package/dist/node_modules/@headlessui/react/dist/components/menu/menu-machine-glue.js +0 -21
- package/dist/node_modules/@headlessui/react/dist/components/menu/menu-machine.cjs +0 -1
- package/dist/node_modules/@headlessui/react/dist/components/menu/menu-machine.js +0 -120
- package/dist/node_modules/@headlessui/react/dist/components/menu/menu.cjs +0 -1
- package/dist/node_modules/@headlessui/react/dist/components/menu/menu.js +0 -197
package/dist/roster.js
CHANGED
|
@@ -2,21 +2,21 @@
|
|
|
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 n } from "./components/atoms/Badge/badge-variants.js";
|
|
6
6
|
import { Button as s } from "./components/atoms/Button/Button.js";
|
|
7
|
-
import { buttonVariants as
|
|
8
|
-
import { Card as
|
|
7
|
+
import { buttonVariants as u } from "./components/atoms/Button/button-variants.js";
|
|
8
|
+
import { Card as d } from "./components/atoms/Card/Card.js";
|
|
9
9
|
import { cardVariants as b } from "./components/atoms/Card/card-variants.js";
|
|
10
10
|
import { Checkbox as T } from "./components/atoms/Checkbox/Checkbox.js";
|
|
11
11
|
import { checkboxVariants as g } from "./components/atoms/Checkbox/checkbox-variants.js";
|
|
12
12
|
import { Disclosure as k } from "./components/atoms/Disclosure/Disclosure.js";
|
|
13
|
-
import { disclosureContentVariants as
|
|
14
|
-
import { Input as
|
|
15
|
-
import { iconVariants as
|
|
16
|
-
import { Link as
|
|
17
|
-
import { linkVariants as
|
|
18
|
-
import { PasswordInput as
|
|
19
|
-
import { Combobox as
|
|
13
|
+
import { disclosureContentVariants as w, disclosureTriggerVariants as I } from "./components/atoms/Disclosure/disclosure-variants.js";
|
|
14
|
+
import { Input as v } from "./components/atoms/Input/Input.js";
|
|
15
|
+
import { iconVariants as D, inputVariants as B } from "./components/atoms/Input/input-variants.js";
|
|
16
|
+
import { Link as R } from "./components/atoms/Link/Link.js";
|
|
17
|
+
import { linkVariants as L } from "./components/atoms/Link/link-variants.js";
|
|
18
|
+
import { PasswordInput as q } from "./components/atoms/PasswordInput/PasswordInput.js";
|
|
19
|
+
import { Combobox as F } from "./components/atoms/Combobox/Combobox.js";
|
|
20
20
|
import { Chip as N } from "./components/atoms/Chip/Chip.js";
|
|
21
21
|
import { chipVariants as K } from "./components/atoms/Chip/chip-variants.js";
|
|
22
22
|
import { Pill as U } from "./components/atoms/Pill/Pill.js";
|
|
@@ -27,21 +27,21 @@ import { InlineCode as rr } from "./components/atoms/InlineCode/InlineCode.js";
|
|
|
27
27
|
import { inlineCodeVariants as tr } from "./components/atoms/InlineCode/inline-code-variants.js";
|
|
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
|
-
import { statSourceClass as xr, statValueVariants as
|
|
30
|
+
import { statSourceClass as xr, statValueVariants as nr } from "./components/atoms/Stat/stat-variants.js";
|
|
31
31
|
import { ThemeToggle as sr } from "./components/atoms/ThemeToggle/ThemeToggle.js";
|
|
32
|
-
import { MultiSelect as
|
|
33
|
-
import { Select as
|
|
32
|
+
import { MultiSelect as ur } from "./components/atoms/MultiSelect/MultiSelect.js";
|
|
33
|
+
import { Select as dr } from "./components/atoms/Select/Select.js";
|
|
34
34
|
import { selectOptionVariants as br, selectTriggerVariants as Sr } from "./components/atoms/Select/select-variants.js";
|
|
35
35
|
import { Spinner as Cr } from "./components/atoms/Spinner/Spinner.js";
|
|
36
36
|
import { Switch as hr } from "./components/atoms/Switch/Switch.js";
|
|
37
|
-
import { switchThumbVariants as
|
|
38
|
-
import { Textarea as
|
|
39
|
-
import { textareaVariants as
|
|
40
|
-
import { AvatarStrip as
|
|
41
|
-
import { Tooltip as
|
|
42
|
-
import { CollapsibleSection as
|
|
43
|
-
import { SegmentBar as
|
|
44
|
-
import { Skeleton as
|
|
37
|
+
import { switchThumbVariants as Mr, switchTrackVariants as wr } from "./components/atoms/Switch/switch-variants.js";
|
|
38
|
+
import { Textarea as Pr } from "./components/atoms/Textarea/Textarea.js";
|
|
39
|
+
import { textareaVariants as Ar } from "./components/atoms/Textarea/textarea-variants.js";
|
|
40
|
+
import { AvatarStrip as Br } from "./components/atoms/AvatarStrip/AvatarStrip.js";
|
|
41
|
+
import { Tooltip as Rr } from "./components/atoms/Tooltip/Tooltip.js";
|
|
42
|
+
import { CollapsibleSection as Lr } from "./components/atoms/CollapsibleSection/CollapsibleSection.js";
|
|
43
|
+
import { SegmentBar as qr } from "./components/atoms/SegmentBar/SegmentBar.js";
|
|
44
|
+
import { Skeleton as Fr, SkeletonRegion as Hr } from "./components/atoms/Skeleton/Skeleton.js";
|
|
45
45
|
import { Progress as Qr } from "./components/atoms/Progress/Progress.js";
|
|
46
46
|
import { LoadingDots as _r } from "./components/atoms/LoadingDots/LoadingDots.js";
|
|
47
47
|
import { Toast as Wr } from "./components/molecules/Toast/Toast.js";
|
|
@@ -52,19 +52,19 @@ import { Alert as oo } from "./components/molecules/Alert/Alert.js";
|
|
|
52
52
|
import { alertVariants as eo } from "./components/molecules/Alert/alert-variants.js";
|
|
53
53
|
import { Accordion as po } from "./components/molecules/Accordion/Accordion.js";
|
|
54
54
|
import { DescriptionList as mo } from "./components/molecules/DescriptionList/DescriptionList.js";
|
|
55
|
-
import { descriptionListVariants as
|
|
55
|
+
import { descriptionListVariants as no } from "./components/molecules/DescriptionList/description-list-variants.js";
|
|
56
56
|
import { Pullquote as so } from "./components/molecules/Pullquote/Pullquote.js";
|
|
57
|
-
import { pullquoteVariants as
|
|
57
|
+
import { pullquoteVariants as uo } from "./components/molecules/Pullquote/pullquote-variants.js";
|
|
58
58
|
import { CheckboxGroup as co } from "./components/molecules/CheckboxGroup/CheckboxGroup.js";
|
|
59
59
|
import { checkboxGroupOptionsVariants as So, checkboxGroupPanelVariants as To } from "./components/molecules/CheckboxGroup/checkbox-group-variants.js";
|
|
60
60
|
import { RadioGroup as go } from "./components/molecules/RadioGroup/RadioGroup.js";
|
|
61
|
-
import { radioDotVariants as ko, radioGroupOptionsVariants as
|
|
62
|
-
import { Breadcrumbs as
|
|
63
|
-
import { breadcrumbVariants as
|
|
64
|
-
import { LiquidTabs as
|
|
65
|
-
import { LiquidNav as
|
|
66
|
-
import { liquidTabId as
|
|
67
|
-
import { Carousel as
|
|
61
|
+
import { radioDotVariants as ko, radioGroupOptionsVariants as Mo, radioOptionVariants as wo, radioVariants as Io } from "./components/molecules/RadioGroup/radio-group-variants.js";
|
|
62
|
+
import { Breadcrumbs as vo } from "./components/molecules/Breadcrumbs/Breadcrumbs.js";
|
|
63
|
+
import { breadcrumbVariants as Do } from "./components/molecules/Breadcrumbs/breadcrumb-variants.js";
|
|
64
|
+
import { LiquidTabs as Eo } from "./components/molecules/LiquidTabs/LiquidTabs.js";
|
|
65
|
+
import { LiquidNav as Go } from "./components/molecules/LiquidTabs/LiquidNav.js";
|
|
66
|
+
import { liquidTabId as Oo } from "./components/molecules/LiquidTabs/liquid-tab-id.js";
|
|
67
|
+
import { Carousel as yo } from "./components/molecules/Carousel/Carousel.js";
|
|
68
68
|
import { CallToAction as Ho } from "./components/molecules/CallToAction/CallToAction.js";
|
|
69
69
|
import { ctaVariants as Qo } from "./components/molecules/CallToAction/call-to-action-variants.js";
|
|
70
70
|
import { EmptyState as _o } from "./components/molecules/EmptyState/EmptyState.js";
|
|
@@ -75,78 +75,89 @@ import { Pagination as Zo } from "./components/molecules/Pagination/Pagination.j
|
|
|
75
75
|
import { SkeletonAvatar as rt, SkeletonCard as ot, SkeletonStat as tt, SkeletonTableRow as et } from "./components/molecules/SkeletonPresets/SkeletonPresets.js";
|
|
76
76
|
import { ProgressField as pt } from "./components/molecules/ProgressField/ProgressField.js";
|
|
77
77
|
import { StepProgress as mt } from "./components/molecules/StepProgress/StepProgress.js";
|
|
78
|
-
import { ErrorState as
|
|
78
|
+
import { ErrorState as nt } from "./components/molecules/ErrorState/ErrorState.js";
|
|
79
79
|
import { errorStateVariants as st } from "./components/molecules/ErrorState/error-state-variants.js";
|
|
80
|
-
import { MatchupCard as
|
|
81
|
-
import {
|
|
82
|
-
import {
|
|
83
|
-
import {
|
|
84
|
-
import {
|
|
85
|
-
import {
|
|
86
|
-
import {
|
|
87
|
-
import {
|
|
88
|
-
import {
|
|
89
|
-
import {
|
|
90
|
-
import {
|
|
91
|
-
import {
|
|
92
|
-
import {
|
|
93
|
-
import {
|
|
94
|
-
import {
|
|
95
|
-
import {
|
|
96
|
-
import {
|
|
97
|
-
import {
|
|
80
|
+
import { MatchupCard as ut } from "./components/molecules/MatchupCard/MatchupCard.js";
|
|
81
|
+
import { Menu as dt, MenuButton as ct, MenuCheckboxItem as bt, MenuGroup as St, MenuItem as Tt, MenuItems as Ct, MenuRadioGroup as gt, MenuRadioItem as ht, MenuSeparator as kt, MenuSubmenu as Mt } from "./components/molecules/Menu/Menu.js";
|
|
82
|
+
import { ActionBar as It } from "./components/organisms/ActionBar/ActionBar.js";
|
|
83
|
+
import { actionBarVariants as vt } from "./components/organisms/ActionBar/action-bar-variants.js";
|
|
84
|
+
import { Countdown as Dt } from "./components/organisms/Countdown/Countdown.js";
|
|
85
|
+
import { Dialog as Et } from "./components/organisms/Dialog/Dialog.js";
|
|
86
|
+
import { Footer as Gt } from "./components/organisms/Footer/Footer.js";
|
|
87
|
+
import { Navbar as Ot } from "./components/organisms/Navbar/Navbar.js";
|
|
88
|
+
import { navbarVariants as yt } from "./components/organisms/Navbar/navbar-variants.js";
|
|
89
|
+
import { Sheet as Ht } from "./components/organisms/Sheet/Sheet.js";
|
|
90
|
+
import { ModerationQueue as Qt } from "./components/organisms/ModerationQueue/ModerationQueue.js";
|
|
91
|
+
import { editAction as _t } from "./components/organisms/ModerationQueue/queue-actions.js";
|
|
92
|
+
import { QueueEditDialog as Wt } from "./components/organisms/ModerationQueue/QueueEditDialog.js";
|
|
93
|
+
import { QueueEditSheet as jt } from "./components/organisms/ModerationQueue/QueueEditSheet.js";
|
|
94
|
+
import { Table as Jt, TableBody as Yt, TableCaption as Zt, TableCell as $t, TableFooter as re, TableHead as oe, TableHeader as te, TableRow as ee } from "./components/organisms/Table/Table.js";
|
|
95
|
+
import { tableCellVariants as pe, tableHeadVariants as ie, tableHeaderVariants as me, tableRowVariants as xe, tableVariants as ne, tableWrapperVariants as fe } from "./components/organisms/Table/table-variants.js";
|
|
96
|
+
import { useCountdown as le } from "./hooks/useCountdown.js";
|
|
97
|
+
import { KONAMI_CODE as Ve, useKeySequence as de } from "./hooks/useKeySequence.js";
|
|
98
|
+
import { cn as be } from "./lib/utils.js";
|
|
98
99
|
export {
|
|
99
100
|
po as Accordion,
|
|
100
|
-
|
|
101
|
+
It as ActionBar,
|
|
101
102
|
oo as Alert,
|
|
102
103
|
e as Avatar,
|
|
103
|
-
|
|
104
|
+
Br as AvatarStrip,
|
|
104
105
|
m as Badge,
|
|
105
|
-
|
|
106
|
+
vo as Breadcrumbs,
|
|
106
107
|
s as Button,
|
|
107
108
|
Ho as CallToAction,
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
d as Card,
|
|
110
|
+
yo as Carousel,
|
|
110
111
|
T as Checkbox,
|
|
111
112
|
co as CheckboxGroup,
|
|
112
113
|
N as Chip,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
Lr as CollapsibleSection,
|
|
115
|
+
F as Combobox,
|
|
116
|
+
Dt as Countdown,
|
|
116
117
|
mo as DescriptionList,
|
|
117
|
-
|
|
118
|
+
Et as Dialog,
|
|
118
119
|
k as Disclosure,
|
|
119
120
|
_o as EmptyState,
|
|
120
|
-
|
|
121
|
+
nt as ErrorState,
|
|
121
122
|
J as Eyebrow,
|
|
122
123
|
Jo as FileUpload,
|
|
123
|
-
|
|
124
|
+
Gt as Footer,
|
|
124
125
|
rr as InlineCode,
|
|
125
|
-
|
|
126
|
-
|
|
126
|
+
v as Input,
|
|
127
|
+
Ve as KONAMI_CODE,
|
|
127
128
|
ar as LabeledDivider,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
R as Link,
|
|
130
|
+
Go as LiquidNav,
|
|
131
|
+
Eo as LiquidTabs,
|
|
131
132
|
_r as LoadingDots,
|
|
132
|
-
|
|
133
|
+
ut as MatchupCard,
|
|
133
134
|
jo as MediaPreview,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
dt as Menu,
|
|
136
|
+
ct as MenuButton,
|
|
137
|
+
bt as MenuCheckboxItem,
|
|
138
|
+
St as MenuGroup,
|
|
139
|
+
Tt as MenuItem,
|
|
140
|
+
Ct as MenuItems,
|
|
141
|
+
gt as MenuRadioGroup,
|
|
142
|
+
ht as MenuRadioItem,
|
|
143
|
+
kt as MenuSeparator,
|
|
144
|
+
Mt as MenuSubmenu,
|
|
145
|
+
Qt as ModerationQueue,
|
|
146
|
+
ur as MultiSelect,
|
|
147
|
+
Ot as Navbar,
|
|
137
148
|
Zo as Pagination,
|
|
138
|
-
|
|
149
|
+
q as PasswordInput,
|
|
139
150
|
U as Pill,
|
|
140
151
|
Qr as Progress,
|
|
141
152
|
pt as ProgressField,
|
|
142
153
|
so as Pullquote,
|
|
143
|
-
|
|
144
|
-
|
|
154
|
+
Wt as QueueEditDialog,
|
|
155
|
+
jt as QueueEditSheet,
|
|
145
156
|
go as RadioGroup,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
157
|
+
qr as SegmentBar,
|
|
158
|
+
dr as Select,
|
|
159
|
+
Ht as Sheet,
|
|
160
|
+
Fr as Skeleton,
|
|
150
161
|
rt as SkeletonAvatar,
|
|
151
162
|
ot as SkeletonCard,
|
|
152
163
|
Hr as SkeletonRegion,
|
|
@@ -157,67 +168,67 @@ export {
|
|
|
157
168
|
mt as StepProgress,
|
|
158
169
|
hr as Switch,
|
|
159
170
|
Zr as TONE_PREFIX,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
171
|
+
Jt as Table,
|
|
172
|
+
Yt as TableBody,
|
|
173
|
+
Zt as TableCaption,
|
|
174
|
+
$t as TableCell,
|
|
175
|
+
re as TableFooter,
|
|
176
|
+
oe as TableHead,
|
|
177
|
+
te as TableHeader,
|
|
178
|
+
ee as TableRow,
|
|
179
|
+
Pr as Textarea,
|
|
169
180
|
sr as ThemeToggle,
|
|
170
181
|
Wr as Toast,
|
|
171
182
|
Jr as Toaster,
|
|
172
|
-
|
|
173
|
-
|
|
183
|
+
Rr as Tooltip,
|
|
184
|
+
vt as actionBarVariants,
|
|
174
185
|
eo as alertVariants,
|
|
175
186
|
p as avatarVariants,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
187
|
+
n as badgeVariants,
|
|
188
|
+
Do as breadcrumbVariants,
|
|
189
|
+
u as buttonVariants,
|
|
179
190
|
b as cardVariants,
|
|
180
191
|
So as checkboxGroupOptionsVariants,
|
|
181
192
|
To as checkboxGroupPanelVariants,
|
|
182
193
|
g as checkboxVariants,
|
|
183
194
|
K as chipVariants,
|
|
184
|
-
|
|
195
|
+
be as cn,
|
|
185
196
|
Qo as ctaVariants,
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
197
|
+
no as descriptionListVariants,
|
|
198
|
+
w as disclosureContentVariants,
|
|
199
|
+
I as disclosureTriggerVariants,
|
|
200
|
+
_t as editAction,
|
|
190
201
|
Wo as emptyStateVariants,
|
|
191
202
|
st as errorStateVariants,
|
|
192
203
|
Z as eyebrowVariants,
|
|
193
|
-
|
|
204
|
+
D as iconVariants,
|
|
194
205
|
tr as inlineCodeVariants,
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
206
|
+
B as inputVariants,
|
|
207
|
+
L as linkVariants,
|
|
208
|
+
Oo as liquidTabId,
|
|
209
|
+
yt as navbarVariants,
|
|
199
210
|
X as pillDotVariants,
|
|
200
211
|
j as pillVariants,
|
|
201
|
-
|
|
212
|
+
uo as pullquoteVariants,
|
|
202
213
|
ko as radioDotVariants,
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
214
|
+
Mo as radioGroupOptionsVariants,
|
|
215
|
+
wo as radioOptionVariants,
|
|
216
|
+
Io as radioVariants,
|
|
206
217
|
br as selectOptionVariants,
|
|
207
218
|
Sr as selectTriggerVariants,
|
|
208
219
|
xr as statSourceClass,
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
220
|
+
nr as statValueVariants,
|
|
221
|
+
Mr as switchThumbVariants,
|
|
222
|
+
wr as switchTrackVariants,
|
|
223
|
+
pe as tableCellVariants,
|
|
224
|
+
ie as tableHeadVariants,
|
|
225
|
+
me as tableHeaderVariants,
|
|
226
|
+
xe as tableRowVariants,
|
|
227
|
+
ne as tableVariants,
|
|
228
|
+
fe as tableWrapperVariants,
|
|
229
|
+
Ar as textareaVariants,
|
|
219
230
|
$r as toast,
|
|
220
231
|
jr as toastVariants,
|
|
221
|
-
|
|
222
|
-
|
|
232
|
+
le as useCountdown,
|
|
233
|
+
de as useKeySequence
|
|
223
234
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blakesteve/roster",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.10.0",
|
|
4
4
|
"description": "A production-grade atomic component library: accessible, theme-aware, and documented in Storybook. React 19, TypeScript, Tailwind CSS v4.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -127,6 +127,7 @@
|
|
|
127
127
|
"vitest": "^4.0.18"
|
|
128
128
|
},
|
|
129
129
|
"dependencies": {
|
|
130
|
+
"@floating-ui/react-dom": "^2.1.7",
|
|
130
131
|
"@fortawesome/fontawesome-svg-core": "^7.2.0",
|
|
131
132
|
"@fortawesome/free-solid-svg-icons": "^7.2.0",
|
|
132
133
|
"@fortawesome/react-fontawesome": "^3.2.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),c=require("../../hooks/use-on-unmount.cjs"),i=require("./menu-machine.cjs"),o=r.createContext(null);function s(t){let n=r.useContext(o);if(n===null){let e=new Error(`<${t} /> is missing a parent <Menu /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(e,u),e}return n}function u({id:t,__demoMode:n=!1}){let e=r.useMemo(()=>i.MenuMachine.new({id:t,__demoMode:n}),[]);return c.useOnUnmount(()=>e.dispose()),e}exports.MenuContext=o;exports.useMenuMachine=u;exports.useMenuMachineContext=s;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useMemo as o, createContext as r, useContext as a } from "react";
|
|
2
|
-
import { useOnUnmount as u } from "../../hooks/use-on-unmount.js";
|
|
3
|
-
import { MenuMachine as s } from "./menu-machine.js";
|
|
4
|
-
const c = r(null);
|
|
5
|
-
function l(t) {
|
|
6
|
-
let n = a(c);
|
|
7
|
-
if (n === null) {
|
|
8
|
-
let e = new Error(`<${t} /> is missing a parent <Menu /> component.`);
|
|
9
|
-
throw Error.captureStackTrace && Error.captureStackTrace(e, i), e;
|
|
10
|
-
}
|
|
11
|
-
return n;
|
|
12
|
-
}
|
|
13
|
-
function i({ id: t, __demoMode: n = !1 }) {
|
|
14
|
-
let e = o(() => s.new({ id: t, __demoMode: n }), []);
|
|
15
|
-
return u(() => e.dispose()), e;
|
|
16
|
-
}
|
|
17
|
-
export {
|
|
18
|
-
c as MenuContext,
|
|
19
|
-
i as useMenuMachine,
|
|
20
|
-
l as useMenuMachineContext
|
|
21
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../machine.cjs"),S=require("../../machines/stack-machine.cjs"),a=require("../../utils/calculate-active-index.cjs"),m=require("../../utils/element-movement.cjs"),E=require("../../utils/focus-management.cjs"),P=require("../../utils/match.cjs");var R=Object.defineProperty,A=(e,n,t)=>n in e?R(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,g=(e,n,t)=>(A(e,typeof n!="symbol"?n+"":n,t),t),x=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(x||{}),b=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(b||{}),M=(e=>(e[e.OpenMenu=0]="OpenMenu",e[e.CloseMenu=1]="CloseMenu",e[e.GoToItem=2]="GoToItem",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterItems=5]="RegisterItems",e[e.UnregisterItems=6]="UnregisterItems",e[e.SetButtonElement=7]="SetButtonElement",e[e.SetItemsElement=8]="SetItemsElement",e[e.SortItems=9]="SortItems",e[e.MarkButtonAsMoved=10]="MarkButtonAsMoved",e))(M||{});function p(e,n=t=>t){let t=e.activeItemIndex!==null?e.items[e.activeItemIndex]:null,i=E.sortByDomNode(n(e.items.slice()),r=>r.dataRef.current.domRef.current),s=t?i.indexOf(t):null;return s===-1&&(s=null),{items:i,activeItemIndex:s}}let F={1(e){if(e.menuState===1)return e;let n=e.buttonElement?m.ElementPositionState.Tracked(m.computeVisualPosition(e.buttonElement)):e.buttonPositionState;return{...e,activeItemIndex:null,pendingFocus:{focus:a.Focus.Nothing},menuState:1,buttonPositionState:n}},0(e,n){return e.menuState===0?e:{...e,__demoMode:!1,pendingFocus:n.focus,menuState:0,buttonPositionState:m.ElementPositionState.Idle}},2:(e,n)=>{var t,i,s,r,o;if(e.menuState===1)return e;let c={...e,searchQuery:"",activationTrigger:(t=n.trigger)!=null?t:1,__demoMode:!1};if(n.focus===a.Focus.Nothing)return{...c,activeItemIndex:null};if(n.focus===a.Focus.Specific)return{...c,activeItemIndex:e.items.findIndex(u=>u.id===n.id)};if(n.focus===a.Focus.Previous){let u=e.activeItemIndex;if(u!==null){let I=e.items[u].dataRef.current.domRef,d=a.calculateActiveIndex(n,{resolveItems:()=>e.items,resolveActiveIndex:()=>e.activeItemIndex,resolveId:l=>l.id,resolveDisabled:l=>l.dataRef.current.disabled});if(d!==null){let l=e.items[d].dataRef.current.domRef;if(((i=I.current)==null?void 0:i.previousElementSibling)===l.current||((s=l.current)==null?void 0:s.previousElementSibling)===null)return{...c,activeItemIndex:d}}}}else if(n.focus===a.Focus.Next){let u=e.activeItemIndex;if(u!==null){let I=e.items[u].dataRef.current.domRef,d=a.calculateActiveIndex(n,{resolveItems:()=>e.items,resolveActiveIndex:()=>e.activeItemIndex,resolveId:l=>l.id,resolveDisabled:l=>l.dataRef.current.disabled});if(d!==null){let l=e.items[d].dataRef.current.domRef;if(((r=I.current)==null?void 0:r.nextElementSibling)===l.current||((o=l.current)==null?void 0:o.nextElementSibling)===null)return{...c,activeItemIndex:d}}}}let v=p(e),y=a.calculateActiveIndex(n,{resolveItems:()=>v.items,resolveActiveIndex:()=>v.activeItemIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled});return{...c,...v,activeItemIndex:y}},3:(e,n)=>{let t=e.searchQuery!==""?0:1,i=e.searchQuery+n.value.toLowerCase(),s=(e.activeItemIndex!==null?e.items.slice(e.activeItemIndex+t).concat(e.items.slice(0,e.activeItemIndex+t)):e.items).find(o=>{var c;return((c=o.dataRef.current.textValue)==null?void 0:c.startsWith(i))&&!o.dataRef.current.disabled}),r=s?e.items.indexOf(s):-1;return r===-1||r===e.activeItemIndex?{...e,searchQuery:i}:{...e,searchQuery:i,activeItemIndex:r,activationTrigger:1}},4(e){return e.searchQuery===""?e:{...e,searchQuery:"",searchActiveItemIndex:null}},5:(e,n)=>{let t=e.items.concat(n.items.map(s=>s)),i=e.activeItemIndex;return e.pendingFocus.focus!==a.Focus.Nothing&&(i=a.calculateActiveIndex(e.pendingFocus,{resolveItems:()=>t,resolveActiveIndex:()=>e.activeItemIndex,resolveId:s=>s.id,resolveDisabled:s=>s.dataRef.current.disabled})),{...e,items:t,activeItemIndex:i,pendingFocus:{focus:a.Focus.Nothing},pendingShouldSort:!0}},6:(e,n)=>{let t=e.items,i=[],s=new Set(n.items);for(let[r,o]of t.entries())if(s.has(o.id)&&(i.push(r),s.delete(o.id),s.size===0))break;if(i.length>0){t=t.slice();for(let r of i.reverse())t.splice(r,1)}return{...e,items:t,activationTrigger:1}},7:(e,n)=>e.buttonElement===n.element?e:{...e,buttonElement:n.element},8:(e,n)=>e.itemsElement===n.element?e:{...e,itemsElement:n.element},9:e=>e.pendingShouldSort?{...e,...p(e),pendingShouldSort:!1}:e,10(e){return e.buttonPositionState.kind!=="Tracked"?e:{...e,buttonPositionState:m.ElementPositionState.Moved}}};class h extends f.Machine{constructor(n){super(n),g(this,"actions",{registerItem:f.batch(()=>{let t=[],i=new Set;return[(s,r)=>{i.has(r)||(i.add(r),t.push({id:s,dataRef:r}))},()=>(i.clear(),this.send({type:5,items:t.splice(0)}))]}),unregisterItem:f.batch(()=>{let t=[];return[i=>t.push(i),()=>this.send({type:6,items:t.splice(0)})]})}),g(this,"selectors",{activeDescendantId(t){var i;let s=t.activeItemIndex,r=t.items;return s===null||(i=r[s])==null?void 0:i.id},isActive(t,i){var s;let r=t.activeItemIndex,o=t.items;return r!==null?((s=o[r])==null?void 0:s.id)===i:!1},shouldScrollIntoView(t,i){return t.__demoMode||t.menuState!==0||t.activationTrigger===0?!1:this.isActive(t,i)},didButtonMove(t){return t.buttonPositionState.kind==="Moved"}}),this.on(5,()=>{this.disposables.requestAnimationFrame(()=>{this.send({type:9})})});{let t=this.state.id,i=S.stackMachines.get(null);this.disposables.add(i.on(S.ActionTypes.Push,s=>{!i.selectors.isTop(s,t)&&this.state.menuState===0&&this.send({type:1})})),this.on(0,()=>i.actions.push(t)),this.on(1,()=>i.actions.pop(t))}this.disposables.group(t=>{this.on(1,i=>{i.buttonElement&&(t.dispose(),t.add(m.detectMovement(i.buttonElement,i.buttonPositionState,()=>{this.send({type:10})})))})})}static new({id:n,__demoMode:t=!1}){return new h({id:n,__demoMode:t,menuState:t?0:1,buttonElement:null,itemsElement:null,items:[],searchQuery:"",activeItemIndex:null,activationTrigger:1,pendingShouldSort:!1,pendingFocus:{focus:a.Focus.Nothing},buttonPositionState:m.ElementPositionState.Idle})}reduce(n,t){return P.match(t.type,F,n,t)}}exports.ActionTypes=M;exports.ActivationTrigger=b;exports.MenuMachine=h;exports.MenuState=x;
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { Machine as b, batch as h } from "../../machine.js";
|
|
2
|
-
import { stackMachines as M, ActionTypes as y } from "../../machines/stack-machine.js";
|
|
3
|
-
import { Focus as d, calculateActiveIndex as m } from "../../utils/calculate-active-index.js";
|
|
4
|
-
import { detectMovement as E, ElementPositionState as v, computeVisualPosition as R } from "../../utils/element-movement.js";
|
|
5
|
-
import { sortByDomNode as P } from "../../utils/focus-management.js";
|
|
6
|
-
import { match as A } from "../../utils/match.js";
|
|
7
|
-
var T = Object.defineProperty, k = (e, n, t) => n in e ? T(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t, p = (e, n, t) => (k(e, typeof n != "symbol" ? n + "" : n, t), t), O = ((e) => (e[e.Open = 0] = "Open", e[e.Closed = 1] = "Closed", e))(O || {}), _ = ((e) => (e[e.Pointer = 0] = "Pointer", e[e.Other = 1] = "Other", e))(_ || {}), C = ((e) => (e[e.OpenMenu = 0] = "OpenMenu", e[e.CloseMenu = 1] = "CloseMenu", e[e.GoToItem = 2] = "GoToItem", e[e.Search = 3] = "Search", e[e.ClearSearch = 4] = "ClearSearch", e[e.RegisterItems = 5] = "RegisterItems", e[e.UnregisterItems = 6] = "UnregisterItems", e[e.SetButtonElement = 7] = "SetButtonElement", e[e.SetItemsElement = 8] = "SetItemsElement", e[e.SortItems = 9] = "SortItems", e[e.MarkButtonAsMoved = 10] = "MarkButtonAsMoved", e))(C || {});
|
|
8
|
-
function S(e, n = (t) => t) {
|
|
9
|
-
let t = e.activeItemIndex !== null ? e.items[e.activeItemIndex] : null, i = P(n(e.items.slice()), (r) => r.dataRef.current.domRef.current), s = t ? i.indexOf(t) : null;
|
|
10
|
-
return s === -1 && (s = null), { items: i, activeItemIndex: s };
|
|
11
|
-
}
|
|
12
|
-
let F = { 1(e) {
|
|
13
|
-
if (e.menuState === 1) return e;
|
|
14
|
-
let n = e.buttonElement ? v.Tracked(R(e.buttonElement)) : e.buttonPositionState;
|
|
15
|
-
return { ...e, activeItemIndex: null, pendingFocus: { focus: d.Nothing }, menuState: 1, buttonPositionState: n };
|
|
16
|
-
}, 0(e, n) {
|
|
17
|
-
return e.menuState === 0 ? e : { ...e, __demoMode: !1, pendingFocus: n.focus, menuState: 0, buttonPositionState: v.Idle };
|
|
18
|
-
}, 2: (e, n) => {
|
|
19
|
-
var t, i, s, r, o;
|
|
20
|
-
if (e.menuState === 1) return e;
|
|
21
|
-
let u = { ...e, searchQuery: "", activationTrigger: (t = n.trigger) != null ? t : 1, __demoMode: !1 };
|
|
22
|
-
if (n.focus === d.Nothing) return { ...u, activeItemIndex: null };
|
|
23
|
-
if (n.focus === d.Specific) return { ...u, activeItemIndex: e.items.findIndex((a) => a.id === n.id) };
|
|
24
|
-
if (n.focus === d.Previous) {
|
|
25
|
-
let a = e.activeItemIndex;
|
|
26
|
-
if (a !== null) {
|
|
27
|
-
let f = e.items[a].dataRef.current.domRef, c = m(n, { resolveItems: () => e.items, resolveActiveIndex: () => e.activeItemIndex, resolveId: (l) => l.id, resolveDisabled: (l) => l.dataRef.current.disabled });
|
|
28
|
-
if (c !== null) {
|
|
29
|
-
let l = e.items[c].dataRef.current.domRef;
|
|
30
|
-
if (((i = f.current) == null ? void 0 : i.previousElementSibling) === l.current || ((s = l.current) == null ? void 0 : s.previousElementSibling) === null) return { ...u, activeItemIndex: c };
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
} else if (n.focus === d.Next) {
|
|
34
|
-
let a = e.activeItemIndex;
|
|
35
|
-
if (a !== null) {
|
|
36
|
-
let f = e.items[a].dataRef.current.domRef, c = m(n, { resolveItems: () => e.items, resolveActiveIndex: () => e.activeItemIndex, resolveId: (l) => l.id, resolveDisabled: (l) => l.dataRef.current.disabled });
|
|
37
|
-
if (c !== null) {
|
|
38
|
-
let l = e.items[c].dataRef.current.domRef;
|
|
39
|
-
if (((r = f.current) == null ? void 0 : r.nextElementSibling) === l.current || ((o = l.current) == null ? void 0 : o.nextElementSibling) === null) return { ...u, activeItemIndex: c };
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
let I = S(e), x = m(n, { resolveItems: () => I.items, resolveActiveIndex: () => I.activeItemIndex, resolveId: (a) => a.id, resolveDisabled: (a) => a.dataRef.current.disabled });
|
|
44
|
-
return { ...u, ...I, activeItemIndex: x };
|
|
45
|
-
}, 3: (e, n) => {
|
|
46
|
-
let t = e.searchQuery !== "" ? 0 : 1, i = e.searchQuery + n.value.toLowerCase(), s = (e.activeItemIndex !== null ? e.items.slice(e.activeItemIndex + t).concat(e.items.slice(0, e.activeItemIndex + t)) : e.items).find((o) => {
|
|
47
|
-
var u;
|
|
48
|
-
return ((u = o.dataRef.current.textValue) == null ? void 0 : u.startsWith(i)) && !o.dataRef.current.disabled;
|
|
49
|
-
}), r = s ? e.items.indexOf(s) : -1;
|
|
50
|
-
return r === -1 || r === e.activeItemIndex ? { ...e, searchQuery: i } : { ...e, searchQuery: i, activeItemIndex: r, activationTrigger: 1 };
|
|
51
|
-
}, 4(e) {
|
|
52
|
-
return e.searchQuery === "" ? e : { ...e, searchQuery: "", searchActiveItemIndex: null };
|
|
53
|
-
}, 5: (e, n) => {
|
|
54
|
-
let t = e.items.concat(n.items.map((s) => s)), i = e.activeItemIndex;
|
|
55
|
-
return e.pendingFocus.focus !== d.Nothing && (i = m(e.pendingFocus, { resolveItems: () => t, resolveActiveIndex: () => e.activeItemIndex, resolveId: (s) => s.id, resolveDisabled: (s) => s.dataRef.current.disabled })), { ...e, items: t, activeItemIndex: i, pendingFocus: { focus: d.Nothing }, pendingShouldSort: !0 };
|
|
56
|
-
}, 6: (e, n) => {
|
|
57
|
-
let t = e.items, i = [], s = new Set(n.items);
|
|
58
|
-
for (let [r, o] of t.entries()) if (s.has(o.id) && (i.push(r), s.delete(o.id), s.size === 0)) break;
|
|
59
|
-
if (i.length > 0) {
|
|
60
|
-
t = t.slice();
|
|
61
|
-
for (let r of i.reverse()) t.splice(r, 1);
|
|
62
|
-
}
|
|
63
|
-
return { ...e, items: t, activationTrigger: 1 };
|
|
64
|
-
}, 7: (e, n) => e.buttonElement === n.element ? e : { ...e, buttonElement: n.element }, 8: (e, n) => e.itemsElement === n.element ? e : { ...e, itemsElement: n.element }, 9: (e) => e.pendingShouldSort ? { ...e, ...S(e), pendingShouldSort: !1 } : e, 10(e) {
|
|
65
|
-
return e.buttonPositionState.kind !== "Tracked" ? e : { ...e, buttonPositionState: v.Moved };
|
|
66
|
-
} };
|
|
67
|
-
class g extends b {
|
|
68
|
-
constructor(n) {
|
|
69
|
-
super(n), p(this, "actions", { registerItem: h(() => {
|
|
70
|
-
let t = [], i = /* @__PURE__ */ new Set();
|
|
71
|
-
return [(s, r) => {
|
|
72
|
-
i.has(r) || (i.add(r), t.push({ id: s, dataRef: r }));
|
|
73
|
-
}, () => (i.clear(), this.send({ type: 5, items: t.splice(0) }))];
|
|
74
|
-
}), unregisterItem: h(() => {
|
|
75
|
-
let t = [];
|
|
76
|
-
return [(i) => t.push(i), () => this.send({ type: 6, items: t.splice(0) })];
|
|
77
|
-
}) }), p(this, "selectors", { activeDescendantId(t) {
|
|
78
|
-
var i;
|
|
79
|
-
let s = t.activeItemIndex, r = t.items;
|
|
80
|
-
return s === null || (i = r[s]) == null ? void 0 : i.id;
|
|
81
|
-
}, isActive(t, i) {
|
|
82
|
-
var s;
|
|
83
|
-
let r = t.activeItemIndex, o = t.items;
|
|
84
|
-
return r !== null ? ((s = o[r]) == null ? void 0 : s.id) === i : !1;
|
|
85
|
-
}, shouldScrollIntoView(t, i) {
|
|
86
|
-
return t.__demoMode || t.menuState !== 0 || t.activationTrigger === 0 ? !1 : this.isActive(t, i);
|
|
87
|
-
}, didButtonMove(t) {
|
|
88
|
-
return t.buttonPositionState.kind === "Moved";
|
|
89
|
-
} }), this.on(5, () => {
|
|
90
|
-
this.disposables.requestAnimationFrame(() => {
|
|
91
|
-
this.send({ type: 9 });
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
{
|
|
95
|
-
let t = this.state.id, i = M.get(null);
|
|
96
|
-
this.disposables.add(i.on(y.Push, (s) => {
|
|
97
|
-
!i.selectors.isTop(s, t) && this.state.menuState === 0 && this.send({ type: 1 });
|
|
98
|
-
})), this.on(0, () => i.actions.push(t)), this.on(1, () => i.actions.pop(t));
|
|
99
|
-
}
|
|
100
|
-
this.disposables.group((t) => {
|
|
101
|
-
this.on(1, (i) => {
|
|
102
|
-
i.buttonElement && (t.dispose(), t.add(E(i.buttonElement, i.buttonPositionState, () => {
|
|
103
|
-
this.send({ type: 10 });
|
|
104
|
-
})));
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
static new({ id: n, __demoMode: t = !1 }) {
|
|
109
|
-
return new g({ id: n, __demoMode: t, menuState: t ? 0 : 1, buttonElement: null, itemsElement: null, items: [], searchQuery: "", activeItemIndex: null, activationTrigger: 1, pendingShouldSort: !1, pendingFocus: { focus: d.Nothing }, buttonPositionState: v.Idle });
|
|
110
|
-
}
|
|
111
|
-
reduce(n, t) {
|
|
112
|
-
return A(t.type, F, n, t);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
export {
|
|
116
|
-
C as ActionTypes,
|
|
117
|
-
_ as ActivationTrigger,
|
|
118
|
-
g as MenuMachine,
|
|
119
|
-
O as MenuState
|
|
120
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ce=require("../../../../../@react-aria/focus/dist/useFocusRing.cjs"),pe=require("../../../../../@react-aria/interactions/dist/useHover.cjs"),r=require("react"),$=require("react-dom"),de=require("../../hooks/use-active-press.cjs"),fe=require("../../hooks/use-disposables.cjs"),ye=require("../../hooks/use-element-size.cjs"),b=require("../../hooks/use-event.cjs"),me=require("../../hooks/use-handle-toggle.cjs"),ve=require("../../hooks/use-inert-others.cjs"),B=require("../../hooks/use-iso-morphic-effect.cjs"),Me=require("../../hooks/use-on-disappear.cjs"),Se=require("../../hooks/use-outside-click.cjs"),Z=require("../../hooks/use-owner.cjs"),N=require("../../hooks/use-quick-release.cjs"),ge=require("../../hooks/use-resolve-button-type.cjs"),be=require("../../hooks/use-scroll-lock.cjs"),U=require("../../hooks/use-slot.cjs"),V=require("../../hooks/use-sync-refs.cjs"),Te=require("../../hooks/use-text-value.cjs"),he=require("../../hooks/use-tracked-pointer.cjs"),J=require("../../hooks/use-transition.cjs"),Pe=require("../../hooks/use-tree-walker.cjs"),C=require("../../internal/floating.cjs"),K=require("../../internal/open-closed.cjs"),Ee=require("../../machines/stack-machine.cjs"),F=require("../../react-glue.cjs"),P=require("../../utils/calculate-active-index.cjs"),Ae=require("../../utils/disposables.cjs"),Ie=require("../../utils/dom.cjs"),k=require("../../utils/focus-management.cjs"),Fe=require("../../utils/match.cjs"),Re=require("../../utils/owner.cjs"),p=require("../../utils/render.cjs"),qe=require("../description/description.cjs"),f=require("../keyboard.cjs"),z=require("../label/label.cjs"),ke=require("../portal/portal.cjs"),e=require("./menu-machine.cjs"),W=require("./menu-machine-glue.cjs");let Oe=r.Fragment;function we(y,S){let l=r.useId(),{__demoMode:a=!1,...c}=y,i=W.useMenuMachine({id:l,__demoMode:a}),[n,E,M]=F.useSlice(i,m=>[m.menuState,m.itemsElement,m.buttonElement]),A=V.useSyncRefs(S),s=Ee.stackMachines.get(null),q=F.useSlice(s,r.useCallback(m=>s.selectors.isTop(m,l),[s,l]));Se.useOutsideClick(q,[M,E],(m,v)=>{var g;i.send({type:e.ActionTypes.CloseMenu}),k.isFocusableElement(v,k.FocusableMode.Loose)||(m.preventDefault(),(g=i.state.buttonElement)==null||g.focus())});let I=b.useEvent(()=>{i.send({type:e.ActionTypes.CloseMenu})}),T=U.useSlot({open:n===e.MenuState.Open,close:I}),d={ref:A},h=p.useRender();return r.createElement(C.FloatingProvider,null,r.createElement(W.MenuContext.Provider,{value:i},r.createElement(K.OpenClosedProvider,{value:Fe.match(n,{[e.MenuState.Open]:K.State.Open,[e.MenuState.Closed]:K.State.Closed})},h({ourProps:d,theirProps:c,slot:T,defaultTag:Oe,name:"Menu"}))))}let De="button";function Ce(y,S){let l=W.useMenuMachineContext("Menu.Button"),a=r.useId(),{id:c=`headlessui-menu-button-${a}`,disabled:i=!1,autoFocus:n=!1,...E}=y,M=r.useRef(null),A=C.useFloatingReferenceProps(),s=V.useSyncRefs(S,M,C.useFloatingReference(),b.useEvent(o=>l.send({type:e.ActionTypes.SetButtonElement,element:o}))),q=b.useEvent(o=>{switch(o.key){case f.Keys.Space:case f.Keys.Enter:case f.Keys.ArrowDown:o.preventDefault(),o.stopPropagation(),l.send({type:e.ActionTypes.OpenMenu,focus:{focus:P.Focus.First}});break;case f.Keys.ArrowUp:o.preventDefault(),o.stopPropagation(),l.send({type:e.ActionTypes.OpenMenu,focus:{focus:P.Focus.Last}});break}}),I=b.useEvent(o=>{o.key===f.Keys.Space&&o.preventDefault()}),[T,d,h]=F.useSlice(l,o=>[o.menuState,o.buttonElement,o.itemsElement]),m=T===e.MenuState.Open;N.useQuickRelease(m,{trigger:d,action:r.useCallback(o=>{if(d!=null&&d.contains(o.target))return N.Action.Ignore;let u=o.target.closest('[role="menuitem"]:not([data-disabled])');return Ie.isHTMLElement(u)?N.Action.Select(u):h!=null&&h.contains(o.target)?N.Action.Ignore:N.Action.Close},[d,h]),close:r.useCallback(()=>l.send({type:e.ActionTypes.CloseMenu}),[]),select:r.useCallback(o=>o.click(),[])});let v=me.useHandleToggle(o=>{var u;i||(T===e.MenuState.Open?($.flushSync(()=>l.send({type:e.ActionTypes.CloseMenu})),(u=M.current)==null||u.focus({preventScroll:!0})):(o.preventDefault(),l.send({type:e.ActionTypes.OpenMenu,focus:{focus:P.Focus.Nothing},trigger:e.ActivationTrigger.Pointer})))}),{isFocusVisible:g,focusProps:O}=ce.useFocusRing({autoFocus:n}),{isHovered:L,hoverProps:w}=pe.useHover({isDisabled:i}),{pressed:R,pressProps:x}=de.useActivePress({disabled:i}),D=U.useSlot({open:T===e.MenuState.Open,active:R||T===e.MenuState.Open,disabled:i,hover:L,focus:g,autofocus:n}),G=p.mergeProps(A(),{ref:s,id:c,type:ge.useResolveButtonType(y,M.current),"aria-haspopup":"menu","aria-controls":h?.id,"aria-expanded":T===e.MenuState.Open,disabled:i||void 0,autoFocus:n,onKeyDown:q,onKeyUp:I},v,O,w,x);return p.useRender()({ourProps:G,theirProps:E,slot:D,defaultTag:De,name:"Menu.Button"})}let Ke="div",Le=p.RenderFeatures.RenderStrategy|p.RenderFeatures.Static;function xe(y,S){let l=r.useId(),{id:a=`headlessui-menu-items-${l}`,anchor:c,portal:i=!1,modal:n=!0,transition:E=!1,...M}=y,A=C.useResolvedAnchor(c),s=W.useMenuMachineContext("Menu.Items"),[q,I]=C.useFloatingPanel(A),T=C.useFloatingPanelProps(),[d,h]=r.useState(null),m=V.useSyncRefs(S,A?q:null,b.useEvent(t=>s.send({type:e.ActionTypes.SetItemsElement,element:t})),h),[v,g]=F.useSlice(s,t=>[t.menuState,t.buttonElement]),O=Z.useOwnerDocument(g),L=Z.useOwnerDocument(d);A&&(i=!0);let w=K.useOpenClosed(),[R,x]=J.useTransition(E,d,w!==null?(w&K.State.Open)===K.State.Open:v===e.MenuState.Open);Me.useOnDisappear(R,g,()=>{s.send({type:e.ActionTypes.CloseMenu})});let D=F.useSlice(s,t=>t.__demoMode),G=D?!1:n&&v===e.MenuState.Open;be.useScrollLock(G,L);let o=D?!1:n&&v===e.MenuState.Open;ve.useInertOthers(o,{allowed:r.useCallback(()=>[g,d],[g,d])});let u=F.useSlice(s,s.selectors.didButtonMove)?!1:R;r.useEffect(()=>{let t=d;t&&v===e.MenuState.Open&&(Re.isActiveElement(t)||t.focus({preventScroll:!0}))},[v,d]),Pe.useTreeWalker(v===e.MenuState.Open,{container:d,accept(t){return t.getAttribute("role")==="menuitem"?NodeFilter.FILTER_REJECT:t.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(t){t.setAttribute("role","none")}});let H=fe.useDisposables(),oe=b.useEvent(t=>{var _,Q,j;switch(H.dispose(),t.key){case f.Keys.Space:if(s.state.searchQuery!=="")return t.preventDefault(),t.stopPropagation(),s.send({type:e.ActionTypes.Search,value:t.key});case f.Keys.Enter:if(t.preventDefault(),t.stopPropagation(),s.state.activeItemIndex!==null){let{dataRef:le}=s.state.items[s.state.activeItemIndex];(Q=(_=le.current)==null?void 0:_.domRef.current)==null||Q.click()}s.send({type:e.ActionTypes.CloseMenu}),k.restoreFocusIfNecessary(s.state.buttonElement);break;case f.Keys.ArrowDown:return t.preventDefault(),t.stopPropagation(),s.send({type:e.ActionTypes.GoToItem,focus:P.Focus.Next});case f.Keys.ArrowUp:return t.preventDefault(),t.stopPropagation(),s.send({type:e.ActionTypes.GoToItem,focus:P.Focus.Previous});case f.Keys.Home:case f.Keys.PageUp:return t.preventDefault(),t.stopPropagation(),s.send({type:e.ActionTypes.GoToItem,focus:P.Focus.First});case f.Keys.End:case f.Keys.PageDown:return t.preventDefault(),t.stopPropagation(),s.send({type:e.ActionTypes.GoToItem,focus:P.Focus.Last});case f.Keys.Escape:t.preventDefault(),t.stopPropagation(),$.flushSync(()=>s.send({type:e.ActionTypes.CloseMenu})),(j=s.state.buttonElement)==null||j.focus({preventScroll:!0});break;case f.Keys.Tab:t.preventDefault(),t.stopPropagation(),$.flushSync(()=>s.send({type:e.ActionTypes.CloseMenu})),k.focusFrom(s.state.buttonElement,t.shiftKey?k.Focus.Previous:k.Focus.Next);break;default:t.key.length===1&&(s.send({type:e.ActionTypes.Search,value:t.key}),H.setTimeout(()=>s.send({type:e.ActionTypes.ClearSearch}),350));break}}),re=b.useEvent(t=>{t.key===f.Keys.Space&&t.preventDefault()}),ue=U.useSlot({open:v===e.MenuState.Open}),ae=p.mergeProps(A?T():{},{"aria-activedescendant":F.useSlice(s,s.selectors.activeDescendantId),"aria-labelledby":F.useSlice(s,t=>{var _;return(_=t.buttonElement)==null?void 0:_.id}),id:a,onKeyDown:oe,onKeyUp:re,role:"menu",tabIndex:v===e.MenuState.Open?0:void 0,ref:m,style:{...M.style,...I,"--button-width":ye.useElementSize(R,g,!0).width},...J.transitionDataAttributes(x)}),ie=p.useRender();return r.createElement(ke.Portal,{enabled:i?y.static||R:!1,ownerDocument:O},ie({ourProps:ae,theirProps:M,slot:ue,defaultTag:Ke,features:Le,visible:u,name:"Menu.Items"}))}let Ge=r.Fragment;function He(y,S){let l=r.useId(),{id:a=`headlessui-menu-item-${l}`,disabled:c=!1,...i}=y,n=W.useMenuMachineContext("Menu.Item"),E=F.useSlice(n,u=>n.selectors.isActive(u,a)),M=r.useRef(null),A=V.useSyncRefs(S,M),s=F.useSlice(n,u=>n.selectors.shouldScrollIntoView(u,a));B.useIsoMorphicEffect(()=>{if(s)return Ae.disposables().requestAnimationFrame(()=>{var u,H;(H=(u=M.current)==null?void 0:u.scrollIntoView)==null||H.call(u,{block:"nearest"})})},[s,M]);let q=Te.useTextValue(M),I=r.useRef({disabled:c,domRef:M,get textValue(){return q()}});B.useIsoMorphicEffect(()=>{I.current.disabled=c},[I,c]),B.useIsoMorphicEffect(()=>(n.actions.registerItem(a,I),()=>n.actions.unregisterItem(a)),[I,a]);let T=b.useEvent(()=>{n.send({type:e.ActionTypes.CloseMenu})}),d=b.useEvent(u=>{if(c)return u.preventDefault();n.send({type:e.ActionTypes.CloseMenu}),k.restoreFocusIfNecessary(n.state.buttonElement)}),h=b.useEvent(()=>{if(c)return n.send({type:e.ActionTypes.GoToItem,focus:P.Focus.Nothing});n.send({type:e.ActionTypes.GoToItem,focus:P.Focus.Specific,id:a})}),m=he.useTrackedPointer(),v=b.useEvent(u=>m.update(u)),g=b.useEvent(u=>{m.wasMoved(u)&&(c||E||n.send({type:e.ActionTypes.GoToItem,focus:P.Focus.Specific,id:a,trigger:e.ActivationTrigger.Pointer}))}),O=b.useEvent(u=>{m.wasMoved(u)&&(c||E&&n.state.activationTrigger===e.ActivationTrigger.Pointer&&n.send({type:e.ActionTypes.GoToItem,focus:P.Focus.Nothing}))}),[L,w]=z.useLabels(),[R,x]=qe.useDescriptions(),D=U.useSlot({active:E,focus:E,disabled:c,close:T}),G={id:a,ref:A,role:"menuitem",tabIndex:c===!0?void 0:-1,"aria-disabled":c===!0?!0:void 0,"aria-labelledby":L,"aria-describedby":R,disabled:void 0,onClick:d,onFocus:h,onPointerEnter:v,onMouseEnter:v,onPointerMove:g,onMouseMove:g,onPointerLeave:O,onMouseLeave:O},o=p.useRender();return r.createElement(w,null,r.createElement(x,null,o({ourProps:G,theirProps:i,slot:D,defaultTag:Ge,name:"Menu.Item"})))}let _e="div";function Ne(y,S){let[l,a]=z.useLabels(),c=y,i={ref:S,"aria-labelledby":l,role:"group"},n=p.useRender();return r.createElement(a,null,n({ourProps:i,theirProps:c,slot:{},defaultTag:_e,name:"Menu.Section"}))}let We="header";function Be(y,S){let l=r.useId(),{id:a=`headlessui-menu-heading-${l}`,...c}=y,i=z.useLabelContext();B.useIsoMorphicEffect(()=>i.register(a),[a,i.register]);let n={id:a,ref:S,role:"presentation",...i.props};return p.useRender()({ourProps:n,theirProps:c,slot:{},defaultTag:We,name:"Menu.Heading"})}let Ue="div";function Ve(y,S){let l=y,a={ref:S,role:"separator"};return p.useRender()({ourProps:a,theirProps:l,slot:{},defaultTag:Ue,name:"Menu.Separator"})}let $e=p.forwardRefWithAs(we),Y=p.forwardRefWithAs(Ce),X=p.forwardRefWithAs(xe),ee=p.forwardRefWithAs(He),te=p.forwardRefWithAs(Ne),se=p.forwardRefWithAs(Be),ne=p.forwardRefWithAs(Ve),ze=Object.assign($e,{Button:Y,Items:X,Item:ee,Section:te,Heading:se,Separator:ne});exports.Menu=ze;exports.MenuButton=Y;exports.MenuHeading=se;exports.MenuItem=ee;exports.MenuItems=X;exports.MenuSection=te;exports.MenuSeparator=ne;
|