@brightlocal/ui-components 2.12.0 → 2.13.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/component-meta.json +312 -16
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +203 -4
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +667 -393
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts +8 -0
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +227 -226
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +296 -288
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts +25 -4
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +71 -53
- package/dist/popover.cjs +1 -1
- package/dist/popover.js +7 -7
- package/dist/rating.cjs +1 -1
- package/dist/rating.js +13 -13
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts +10 -2
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +36 -30
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +14 -0
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +57 -39
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts +25 -9
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +128 -113
- package/package.json +1 -1
- package/src/blocks/sidebar.tsx +596 -9
- package/src/components/combobox.tsx +10 -0
- package/src/components/dropdown-menu.tsx +1 -1
- package/src/components/list.tsx +45 -2
- package/src/components/popover.tsx +1 -1
- package/src/components/rating.tsx +1 -1
- package/src/components/select.tsx +24 -2
- package/src/components/table.tsx +39 -2
- package/src/components/tabs.tsx +195 -146
package/component-meta.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightlocal/ui-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"description": "Machine-readable registry of all components in the BrightLocal Design System",
|
|
5
5
|
"components": [
|
|
6
6
|
{
|
|
@@ -108,10 +108,25 @@
|
|
|
108
108
|
"confirm modal",
|
|
109
109
|
"destructive action dialog"
|
|
110
110
|
],
|
|
111
|
+
"whenToUse": [
|
|
112
|
+
"User is about to perform an irreversible or destructive action (delete, discard, overwrite)",
|
|
113
|
+
"Action has significant consequences that require explicit confirmation",
|
|
114
|
+
"Two clear actions: confirm or cancel — no other options needed"
|
|
115
|
+
],
|
|
111
116
|
"doNotUseFor": [
|
|
112
117
|
"informational dialogs (use Dialog)",
|
|
113
118
|
"toast messages (use Sonner)"
|
|
114
119
|
],
|
|
120
|
+
"alternatives": [
|
|
121
|
+
{
|
|
122
|
+
"component": "Dialog",
|
|
123
|
+
"rule": "Use Dialog when content is informational or includes a form — not a simple confirm/cancel"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"component": "Sonner",
|
|
127
|
+
"rule": "Use Sonner for non-blocking success/error feedback after an action completes"
|
|
128
|
+
}
|
|
129
|
+
],
|
|
115
130
|
"replaces": [],
|
|
116
131
|
"states": [
|
|
117
132
|
"open",
|
|
@@ -187,10 +202,25 @@
|
|
|
187
202
|
"label",
|
|
188
203
|
"status indicator"
|
|
189
204
|
],
|
|
205
|
+
"whenToUse": [
|
|
206
|
+
"Displaying a status label (active/inactive, new, draft)",
|
|
207
|
+
"Showing a count or numeric indicator",
|
|
208
|
+
"Non-interactive categorical labels"
|
|
209
|
+
],
|
|
190
210
|
"doNotUseFor": [
|
|
191
211
|
"removable tags (use Chip)",
|
|
192
212
|
"interactive elements (use Button)"
|
|
193
213
|
],
|
|
214
|
+
"alternatives": [
|
|
215
|
+
{
|
|
216
|
+
"component": "Chip",
|
|
217
|
+
"rule": "Use Chip when the user can remove/dismiss the tag — Badge is non-interactive"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"component": "Button",
|
|
221
|
+
"rule": "Use Button for interactive status toggles"
|
|
222
|
+
}
|
|
223
|
+
],
|
|
194
224
|
"replaces": [],
|
|
195
225
|
"states": [
|
|
196
226
|
"default"
|
|
@@ -268,10 +298,36 @@
|
|
|
268
298
|
"submit button",
|
|
269
299
|
"confirm button"
|
|
270
300
|
],
|
|
301
|
+
"whenToUse": [
|
|
302
|
+
"Triggering an action (submit, save, delete, open)",
|
|
303
|
+
"Primary and secondary CTAs in forms, dialogs, and cards",
|
|
304
|
+
"Icon-only actions using the iconOnly prop"
|
|
305
|
+
],
|
|
271
306
|
"doNotUseFor": [
|
|
272
307
|
"navigation links (use Link)",
|
|
273
308
|
"toggle state (use Toggle or Switch)"
|
|
274
309
|
],
|
|
310
|
+
"alternatives": [
|
|
311
|
+
{
|
|
312
|
+
"component": "Link",
|
|
313
|
+
"rule": "Use Link for navigation to a URL — even if it looks like a button, use Button with asChild wrapping a router Link for button-styled navigation"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"component": "Toggle",
|
|
317
|
+
"rule": "Use Toggle for on/off state that persists (e.g., bold, italic)"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"component": "DropdownMenu",
|
|
321
|
+
"rule": "Use Button + DropdownMenu for a button with secondary actions (SplitButton recipe)"
|
|
322
|
+
}
|
|
323
|
+
],
|
|
324
|
+
"knownGaps": [
|
|
325
|
+
{
|
|
326
|
+
"description": "No ButtonLink variant for navigation-styled buttons",
|
|
327
|
+
"ticket": "DS-530",
|
|
328
|
+
"workaround": "Use Button with asChild wrapping a router Link component"
|
|
329
|
+
}
|
|
330
|
+
],
|
|
275
331
|
"replaces": [
|
|
276
332
|
"native <button>"
|
|
277
333
|
],
|
|
@@ -369,7 +425,7 @@
|
|
|
369
425
|
"props": [
|
|
370
426
|
"maxWidth"
|
|
371
427
|
],
|
|
372
|
-
"description": "Content container with consistent styling",
|
|
428
|
+
"description": "Content container with consistent styling. Supports a density prop: 'default' uses generous spacing (gap-8, py-section-md, px-section-md) for standalone cards; 'condensed' uses compact spacing (gap-3, py-3, px-3) for cards nested inside other cards as sub-sections, inline stat panels, or dense dashboard widgets.",
|
|
373
429
|
"aliases": [
|
|
374
430
|
"container",
|
|
375
431
|
"panel",
|
|
@@ -377,6 +433,18 @@
|
|
|
377
433
|
"wrapper",
|
|
378
434
|
"content card"
|
|
379
435
|
],
|
|
436
|
+
"whenToUse": [
|
|
437
|
+
"Grouping related content with a visual boundary (form sections, detail panels, stat cards)",
|
|
438
|
+
"Page-level content containers that need consistent padding and border styling",
|
|
439
|
+
"Nested sub-sections within a parent card — use density='condensed' for compact inline panels (e.g., stat summaries, ranking grids, metric tiles)"
|
|
440
|
+
],
|
|
441
|
+
"knownGaps": [
|
|
442
|
+
{
|
|
443
|
+
"description": "CardTitle text size too large for some contexts — smaller variant needed",
|
|
444
|
+
"ticket": "DS-535",
|
|
445
|
+
"workaround": "Override CardTitle with className='text-lg' or 'text-base' for smaller titles"
|
|
446
|
+
}
|
|
447
|
+
],
|
|
380
448
|
"doNotUseFor": [
|
|
381
449
|
"clickable list items (use List)",
|
|
382
450
|
"modal content (use Dialog)"
|
|
@@ -450,7 +518,25 @@
|
|
|
450
518
|
"dataHookRequired": true,
|
|
451
519
|
"variants": {},
|
|
452
520
|
"props": [],
|
|
453
|
-
"description": "Full-page centered content layout"
|
|
521
|
+
"description": "Full-page centered content layout",
|
|
522
|
+
"whenToUse": [
|
|
523
|
+
"Single-column centered pages (login, signup, password reset, onboarding)",
|
|
524
|
+
"Pages with a centered Card and branded header"
|
|
525
|
+
],
|
|
526
|
+
"doNotUseFor": [
|
|
527
|
+
"two-column layouts (use SplitLayout)",
|
|
528
|
+
"app shells with sidebar navigation (use GlobalLayout + Sidebar)"
|
|
529
|
+
],
|
|
530
|
+
"alternatives": [
|
|
531
|
+
{
|
|
532
|
+
"component": "SplitLayout",
|
|
533
|
+
"rule": "Use SplitLayout for two-column pages with marketing content on one side"
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
"component": "GlobalLayout",
|
|
537
|
+
"rule": "Use GlobalLayout for full app shells with sidebar navigation"
|
|
538
|
+
}
|
|
539
|
+
]
|
|
454
540
|
},
|
|
455
541
|
{
|
|
456
542
|
"name": "Chart",
|
|
@@ -543,7 +629,26 @@
|
|
|
543
629
|
"removeAriaLabel": "string — default: \"Remove {name}\""
|
|
544
630
|
}
|
|
545
631
|
},
|
|
546
|
-
"description": "Removable chip/tag element"
|
|
632
|
+
"description": "Removable chip/tag element",
|
|
633
|
+
"whenToUse": [
|
|
634
|
+
"Displaying user-created tags that can be removed",
|
|
635
|
+
"Selected filter values that can be dismissed",
|
|
636
|
+
"Multi-select token display with remove capability"
|
|
637
|
+
],
|
|
638
|
+
"doNotUseFor": [
|
|
639
|
+
"non-interactive status labels (use Badge)",
|
|
640
|
+
"category labels without remove action (use Badge)"
|
|
641
|
+
],
|
|
642
|
+
"alternatives": [
|
|
643
|
+
{
|
|
644
|
+
"component": "Badge",
|
|
645
|
+
"rule": "Use Badge for non-interactive status indicators or labels"
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
"component": "InputChip",
|
|
649
|
+
"rule": "Use InputChip when users need to both add and remove tags via an input field"
|
|
650
|
+
}
|
|
651
|
+
]
|
|
547
652
|
},
|
|
548
653
|
{
|
|
549
654
|
"name": "Collapsible",
|
|
@@ -611,10 +716,35 @@
|
|
|
611
716
|
"typeahead",
|
|
612
717
|
"filterable dropdown"
|
|
613
718
|
],
|
|
719
|
+
"whenToUse": [
|
|
720
|
+
"Dropdown with 10+ options where search/filtering improves UX",
|
|
721
|
+
"Autocomplete or typeahead for large lists (cities, categories, users)",
|
|
722
|
+
"Multi-select with search capability"
|
|
723
|
+
],
|
|
614
724
|
"doNotUseFor": [
|
|
615
725
|
"simple select without search (use Select)",
|
|
616
726
|
"command palette (use Command)"
|
|
617
727
|
],
|
|
728
|
+
"alternatives": [
|
|
729
|
+
{
|
|
730
|
+
"component": "Select",
|
|
731
|
+
"rule": "Use Select for short lists (under 10 options) where search is unnecessary"
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
"component": "Command",
|
|
735
|
+
"rule": "Use Command for keyboard-driven command palettes or action search"
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
"component": "DropdownMenu",
|
|
739
|
+
"rule": "Use DropdownMenu for action menus triggered by a button — not form selection"
|
|
740
|
+
}
|
|
741
|
+
],
|
|
742
|
+
"knownGaps": [
|
|
743
|
+
{
|
|
744
|
+
"description": "Missing onValueChange callback — consumers need @ts-expect-error workaround",
|
|
745
|
+
"workaround": "Use @ts-expect-error when passing onValueChange to Combobox until the API is updated"
|
|
746
|
+
}
|
|
747
|
+
],
|
|
618
748
|
"replaces": [],
|
|
619
749
|
"states": [
|
|
620
750
|
"open",
|
|
@@ -772,10 +902,29 @@
|
|
|
772
902
|
"popup",
|
|
773
903
|
"lightbox"
|
|
774
904
|
],
|
|
905
|
+
"whenToUse": [
|
|
906
|
+
"Presenting informational content or forms that require focused attention",
|
|
907
|
+
"Content that should block interaction with the page behind it",
|
|
908
|
+
"Multi-step flows or forms that don't fit inline"
|
|
909
|
+
],
|
|
775
910
|
"doNotUseFor": [
|
|
776
911
|
"confirmation actions (use AlertDialog)",
|
|
777
912
|
"side panels (use Sheet or Drawer)"
|
|
778
913
|
],
|
|
914
|
+
"alternatives": [
|
|
915
|
+
{
|
|
916
|
+
"component": "AlertDialog",
|
|
917
|
+
"rule": "Use AlertDialog when the user must confirm or cancel a destructive/irreversible action"
|
|
918
|
+
},
|
|
919
|
+
{
|
|
920
|
+
"component": "Sheet",
|
|
921
|
+
"rule": "Use Sheet for side panels with supplementary content or forms that don't need centered focus"
|
|
922
|
+
},
|
|
923
|
+
{
|
|
924
|
+
"component": "Drawer",
|
|
925
|
+
"rule": "Use Drawer for mobile-friendly bottom/side slide-out panels"
|
|
926
|
+
}
|
|
927
|
+
],
|
|
779
928
|
"replaces": [
|
|
780
929
|
"native <dialog>"
|
|
781
930
|
],
|
|
@@ -816,7 +965,26 @@
|
|
|
816
965
|
"onOpenChange",
|
|
817
966
|
"direction"
|
|
818
967
|
],
|
|
819
|
-
"description": "Slide-out drawer panel"
|
|
968
|
+
"description": "Slide-out drawer panel",
|
|
969
|
+
"whenToUse": [
|
|
970
|
+
"Mobile-friendly slide-out panel from any edge",
|
|
971
|
+
"Non-modal supplementary content on touch devices",
|
|
972
|
+
"Bottom sheet pattern on mobile viewports"
|
|
973
|
+
],
|
|
974
|
+
"doNotUseFor": [
|
|
975
|
+
"centered dialogs (use Dialog)",
|
|
976
|
+
"confirmation prompts (use AlertDialog)"
|
|
977
|
+
],
|
|
978
|
+
"alternatives": [
|
|
979
|
+
{
|
|
980
|
+
"component": "Sheet",
|
|
981
|
+
"rule": "Use Sheet for always-modal side panels with overlay — Sheet is modal-only, Drawer supports non-modal"
|
|
982
|
+
},
|
|
983
|
+
{
|
|
984
|
+
"component": "Dialog",
|
|
985
|
+
"rule": "Use Dialog when content should be centered and focused, not sliding from an edge"
|
|
986
|
+
}
|
|
987
|
+
]
|
|
820
988
|
},
|
|
821
989
|
{
|
|
822
990
|
"name": "DropdownMenu",
|
|
@@ -905,10 +1073,21 @@
|
|
|
905
1073
|
"input group",
|
|
906
1074
|
"field wrapper"
|
|
907
1075
|
],
|
|
1076
|
+
"whenToUse": [
|
|
1077
|
+
"Wrapping any form input with label, description, and error message",
|
|
1078
|
+
"Canonical pattern: Field > FieldLabel + Input/Select/Textarea + FieldDescription + FieldError",
|
|
1079
|
+
"When integrating with React Hook Form — use Field with Controller to wire up error state"
|
|
1080
|
+
],
|
|
908
1081
|
"doNotUseFor": [
|
|
909
1082
|
"standalone labels (use Label)",
|
|
910
1083
|
"inline text (use Typography)"
|
|
911
1084
|
],
|
|
1085
|
+
"alternatives": [
|
|
1086
|
+
{
|
|
1087
|
+
"component": "Label",
|
|
1088
|
+
"rule": "Use standalone Label only when building a custom field layout — Field includes FieldLabel with proper a11y wiring"
|
|
1089
|
+
}
|
|
1090
|
+
],
|
|
912
1091
|
"replaces": [],
|
|
913
1092
|
"states": [
|
|
914
1093
|
"default",
|
|
@@ -1177,7 +1356,22 @@
|
|
|
1177
1356
|
"showExternalIcon",
|
|
1178
1357
|
"asChild"
|
|
1179
1358
|
],
|
|
1180
|
-
"description": "Styled hyperlink with external link support"
|
|
1359
|
+
"description": "Styled hyperlink with external link support",
|
|
1360
|
+
"whenToUse": [
|
|
1361
|
+
"Inline text links within paragraphs or sentences",
|
|
1362
|
+
"Navigation to internal or external URLs",
|
|
1363
|
+
"Links inside i18n <Trans> blocks — use Link as a component in the components map"
|
|
1364
|
+
],
|
|
1365
|
+
"doNotUseFor": [
|
|
1366
|
+
"actions that don't navigate (use Button)",
|
|
1367
|
+
"button-styled navigation (use Button with asChild wrapping a router link)"
|
|
1368
|
+
],
|
|
1369
|
+
"alternatives": [
|
|
1370
|
+
{
|
|
1371
|
+
"component": "Button",
|
|
1372
|
+
"rule": "Use Button for actions (submit, delete, open). For button-styled navigation, use Button asChild wrapping your router's Link component"
|
|
1373
|
+
}
|
|
1374
|
+
]
|
|
1181
1375
|
},
|
|
1182
1376
|
{
|
|
1183
1377
|
"name": "List",
|
|
@@ -1186,20 +1380,25 @@
|
|
|
1186
1380
|
"exports": [
|
|
1187
1381
|
"List",
|
|
1188
1382
|
"Item",
|
|
1383
|
+
"ItemMedia",
|
|
1189
1384
|
"ItemContent",
|
|
1190
1385
|
"ItemTitle",
|
|
1191
|
-
"
|
|
1386
|
+
"ItemDescription",
|
|
1387
|
+
"ItemActions",
|
|
1388
|
+
"ItemSubheader"
|
|
1192
1389
|
],
|
|
1193
1390
|
"compound": true,
|
|
1194
1391
|
"dataHookRequired": true,
|
|
1195
1392
|
"variants": {
|
|
1196
1393
|
"variant": [
|
|
1197
1394
|
"default",
|
|
1198
|
-
"
|
|
1395
|
+
"filled",
|
|
1396
|
+
"outline",
|
|
1397
|
+
"loading"
|
|
1199
1398
|
]
|
|
1200
1399
|
},
|
|
1201
1400
|
"props": [],
|
|
1202
|
-
"description": "Vertical item list"
|
|
1401
|
+
"description": "Vertical item list with optional section headings"
|
|
1203
1402
|
},
|
|
1204
1403
|
{
|
|
1205
1404
|
"name": "Logo",
|
|
@@ -1612,10 +1811,29 @@
|
|
|
1612
1811
|
"tray",
|
|
1613
1812
|
"slide-out"
|
|
1614
1813
|
],
|
|
1814
|
+
"whenToUse": [
|
|
1815
|
+
"Side panel for editing details, settings, or supplementary info",
|
|
1816
|
+
"Right-side panel pattern (most common: filters, detail views, forms)",
|
|
1817
|
+
"Content that should slide in from an edge without navigating away"
|
|
1818
|
+
],
|
|
1615
1819
|
"doNotUseFor": [
|
|
1616
1820
|
"centered dialogs (use Dialog)",
|
|
1617
1821
|
"confirmations (use AlertDialog)"
|
|
1618
1822
|
],
|
|
1823
|
+
"alternatives": [
|
|
1824
|
+
{
|
|
1825
|
+
"component": "Dialog",
|
|
1826
|
+
"rule": "Use Dialog for centered content requiring focused attention"
|
|
1827
|
+
},
|
|
1828
|
+
{
|
|
1829
|
+
"component": "Drawer",
|
|
1830
|
+
"rule": "Use Drawer when you need non-modal behavior or mobile bottom-sheet pattern"
|
|
1831
|
+
},
|
|
1832
|
+
{
|
|
1833
|
+
"component": "Sidebar",
|
|
1834
|
+
"rule": "Use Sidebar for persistent collapsible navigation — Sheet is for temporary overlays"
|
|
1835
|
+
}
|
|
1836
|
+
],
|
|
1619
1837
|
"replaces": [],
|
|
1620
1838
|
"states": [
|
|
1621
1839
|
"open",
|
|
@@ -1727,7 +1945,27 @@
|
|
|
1727
1945
|
"left",
|
|
1728
1946
|
"right"
|
|
1729
1947
|
],
|
|
1730
|
-
"description": "Two-column responsive layout with composition pattern"
|
|
1948
|
+
"description": "Two-column responsive layout with composition pattern",
|
|
1949
|
+
"whenToUse": [
|
|
1950
|
+
"Two-column pages where one side is content and the other is decorative/marketing",
|
|
1951
|
+
"Auth pages with form on the left and branding on the right",
|
|
1952
|
+
"Any page where the right column should be hidden on mobile"
|
|
1953
|
+
],
|
|
1954
|
+
"doNotUseFor": [
|
|
1955
|
+
"centered single-column layouts (use CentredLayout)",
|
|
1956
|
+
"app shells with sidebar navigation (use GlobalLayout + Sidebar)",
|
|
1957
|
+
"equal-width columns that should both be visible on mobile (use CSS grid)"
|
|
1958
|
+
],
|
|
1959
|
+
"alternatives": [
|
|
1960
|
+
{
|
|
1961
|
+
"component": "CentredLayout",
|
|
1962
|
+
"rule": "Use CentredLayout for single-column centered content"
|
|
1963
|
+
},
|
|
1964
|
+
{
|
|
1965
|
+
"component": "GlobalLayout",
|
|
1966
|
+
"rule": "Use GlobalLayout for full app shells with persistent sidebar"
|
|
1967
|
+
}
|
|
1968
|
+
]
|
|
1731
1969
|
},
|
|
1732
1970
|
{
|
|
1733
1971
|
"name": "Switch",
|
|
@@ -1802,10 +2040,21 @@
|
|
|
1802
2040
|
"grid",
|
|
1803
2041
|
"list table"
|
|
1804
2042
|
],
|
|
2043
|
+
"whenToUse": [
|
|
2044
|
+
"Simple read-only data display with no sorting, filtering, or pagination",
|
|
2045
|
+
"Static tables like pricing tiers, feature comparisons, or settings summaries",
|
|
2046
|
+
"When you control the exact columns and rows — no dynamic column configuration needed"
|
|
2047
|
+
],
|
|
1805
2048
|
"doNotUseFor": [
|
|
1806
2049
|
"complex filtering and sorting (use DataTable block)",
|
|
1807
2050
|
"layout grids (use CSS grid)"
|
|
1808
2051
|
],
|
|
2052
|
+
"alternatives": [
|
|
2053
|
+
{
|
|
2054
|
+
"component": "DataTable",
|
|
2055
|
+
"rule": "Use DataTable for sortable, filterable, paginated tables with row selection — it wraps TanStack Table"
|
|
2056
|
+
}
|
|
2057
|
+
],
|
|
1809
2058
|
"replaces": [
|
|
1810
2059
|
"native <table>"
|
|
1811
2060
|
],
|
|
@@ -2029,7 +2278,22 @@
|
|
|
2029
2278
|
"props": [
|
|
2030
2279
|
"asChild"
|
|
2031
2280
|
],
|
|
2032
|
-
"description": "Semantic text components for headings, paragraphs, and inline styles"
|
|
2281
|
+
"description": "Semantic text components for headings, paragraphs, and inline styles",
|
|
2282
|
+
"whenToUse": [
|
|
2283
|
+
"Page and section headings (H1–H4) with consistent font and spacing",
|
|
2284
|
+
"Body text, lead text, muted captions, and inline code",
|
|
2285
|
+
"Any heading or paragraph that should follow the design system type scale"
|
|
2286
|
+
],
|
|
2287
|
+
"doNotUseFor": [
|
|
2288
|
+
"display-sized hero text larger than H1 — not yet covered, use custom Tailwind classes",
|
|
2289
|
+
"form labels (use Label or FieldLabel)"
|
|
2290
|
+
],
|
|
2291
|
+
"alternatives": [
|
|
2292
|
+
{
|
|
2293
|
+
"component": "Label",
|
|
2294
|
+
"rule": "Use Label for form input labels — Typography is for content headings and body text"
|
|
2295
|
+
}
|
|
2296
|
+
]
|
|
2033
2297
|
}
|
|
2034
2298
|
],
|
|
2035
2299
|
"blocks": [
|
|
@@ -2120,21 +2384,43 @@
|
|
|
2120
2384
|
"category": "block",
|
|
2121
2385
|
"exports": [
|
|
2122
2386
|
"Sidebar",
|
|
2387
|
+
"SidebarAccountDropdown",
|
|
2388
|
+
"SidebarCollapseIcon",
|
|
2123
2389
|
"SidebarContent",
|
|
2124
|
-
"SidebarHeader",
|
|
2125
2390
|
"SidebarFooter",
|
|
2391
|
+
"SidebarGroup",
|
|
2392
|
+
"SidebarGroupAction",
|
|
2393
|
+
"SidebarGroupContent",
|
|
2394
|
+
"SidebarGroupLabel",
|
|
2395
|
+
"SidebarHeader",
|
|
2396
|
+
"SidebarHeaderButton",
|
|
2397
|
+
"SidebarInboxItem",
|
|
2398
|
+
"SidebarInput",
|
|
2399
|
+
"SidebarInset",
|
|
2126
2400
|
"SidebarMenu",
|
|
2401
|
+
"SidebarMenuAction",
|
|
2402
|
+
"SidebarMenuBadge",
|
|
2127
2403
|
"SidebarMenuButton",
|
|
2404
|
+
"SidebarMenuCollapsible",
|
|
2405
|
+
"SidebarMenuCollapsibleContent",
|
|
2406
|
+
"SidebarMenuCollapsibleTrigger",
|
|
2128
2407
|
"SidebarMenuItem",
|
|
2408
|
+
"SidebarMenuSkeleton",
|
|
2129
2409
|
"SidebarMenuSub",
|
|
2130
|
-
"
|
|
2131
|
-
"
|
|
2410
|
+
"SidebarMenuSubButton",
|
|
2411
|
+
"SidebarMenuSubItem",
|
|
2412
|
+
"SidebarPopoverMenu",
|
|
2413
|
+
"SidebarPopoverMenuItem",
|
|
2414
|
+
"SidebarPopoverTrigger",
|
|
2415
|
+
"SidebarProvider",
|
|
2132
2416
|
"SidebarRail",
|
|
2417
|
+
"SidebarSeparator",
|
|
2418
|
+
"SidebarSwitcher",
|
|
2133
2419
|
"SidebarTrigger",
|
|
2134
|
-
"
|
|
2420
|
+
"useSidebar"
|
|
2135
2421
|
],
|
|
2136
2422
|
"compound": true,
|
|
2137
|
-
"dataHookRequired":
|
|
2423
|
+
"dataHookRequired": true,
|
|
2138
2424
|
"variants": {
|
|
2139
2425
|
"side": [
|
|
2140
2426
|
"left"
|
|
@@ -2162,6 +2448,16 @@
|
|
|
2162
2448
|
},
|
|
2163
2449
|
"SidebarRail": {
|
|
2164
2450
|
"toggleAriaLabel": "string — default: \"Toggle Sidebar\""
|
|
2451
|
+
},
|
|
2452
|
+
"SidebarPopoverTrigger": {
|
|
2453
|
+
"triggerAriaLabel": "string — default: \"Switch workspace\""
|
|
2454
|
+
},
|
|
2455
|
+
"SidebarPopoverMenu": {
|
|
2456
|
+
"groupTitle": "string — default: \"Teams\"",
|
|
2457
|
+
"addActionLabel": "string — default: \"Add team\""
|
|
2458
|
+
},
|
|
2459
|
+
"SidebarSwitcher": {
|
|
2460
|
+
"triggerAriaLabel": "string — default: \"Switch workspace\""
|
|
2165
2461
|
}
|
|
2166
2462
|
},
|
|
2167
2463
|
"description": "Complex sidebar navigation with collapsible support"
|
package/dist/blocks/sidebar.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),Se=require("react"),y=require("@radix-ui/react-slot"),D=require("class-variance-authority"),u=require("@brightlocal/icons"),d=require("@brightlocal/ui-components/lib/utils"),we=require("../button.cjs"),ke=require("../input.cjs"),ye=require("../separator.cjs"),M=require("../sheet.cjs"),I=require("../accordion.cjs"),Ne=require("@radix-ui/react-accordion"),je=require("../scroll-area.cjs"),L=require("../skeleton.cjs"),C=require("../tooltip.cjs"),Me=require("../hooks/use-breakpoint.cjs");function _(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const n=_(Se),Ce=_(Ne);var z=(e=>(e.LEFT="left",e))(z||{}),P=(e=>(e.SIDEBAR="sidebar",e))(P||{}),q=(e=>(e.OFFCANVAS="offcanvas",e.ICON="icon",e.NONE="none",e))(q||{}),G=(e=>(e.DEFAULT="default",e.SM="sm",e.XS="xs",e))(G||{}),H=(e=>(e.DEFAULT="default",e.COLLAPSIBLE="collapsible",e.ACTION="action",e))(H||{}),F=(e=>(e.SIMPLE="simple",e.COLLAPSIBLE="collapsible",e.DROPDOWN="dropdown",e.BADGE="badge",e.BIG_ICON="bigIcon",e.CHECKBOX="checkbox",e))(F||{}),K=(e=>(e.DEFAULT="default",e.SM="sm",e.LG="lg",e))(K||{}),U=(e=>(e.DEFAULT="default",e.BORDER="border",e.INDENT="indent",e))(U||{}),V=(e=>(e.SM="sm",e.MD="md",e))(V||{}),W=(e=>(e.CARET="caret",e.HORIZONTAL="horizontal",e.VERTICAL="vertical",e.UP_DOWN="upDown",e.PLUS_MINUS="plusMinus",e.DOTS="dots",e))(W||{});const Re="sidebar:state",Ie=3600*24*7,De="224px",Ae="336px",Oe="48px",Ee="b",X=n.createContext(null);function k(){const e=n.useContext(X);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const $=n.forwardRef(({dataHook:e,trackingEl:a,trackingLabel:t,defaultOpen:o=!0,open:s,onOpenChange:i,className:l,style:c,children:m,...g},x)=>{const b=Me.useIsBelowBreakpoint("lg"),[p,v]=n.useState(!1),[f,R]=n.useState(o),w=s??f,N=n.useCallback(h=>{const S=typeof h=="function"?h(w):h;i?i(S):R(S),document.cookie=`${Re}=${S}; path=/; max-age=${Ie}`},[i,w]),j=n.useCallback(()=>b?v(h=>!h):N(h=>!h),[b,N,v]);n.useEffect(()=>{const h=S=>{S.key===Ee&&(S.metaKey||S.ctrlKey)&&(S.preventDefault(),j())};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[j]);const B=w?"expanded":"collapsed",ve=n.useMemo(()=>({state:B,open:w,setOpen:N,isMobile:b,openMobile:p,setOpenMobile:v,toggleSidebar:j}),[B,w,N,b,p,v,j]);return r.jsx(X.Provider,{value:ve,children:r.jsx(C.TooltipProvider,{delayDuration:0,children:r.jsx("div",{ref:x,className:d.cn("group/sidebar-wrapper flex min-h-svh w-full",l),"data-hook":e,"data-slot":"sidebar-provider","data-tracking-el":a||"sidebar-provider","data-tracking-label":t,style:{"--sidebar-width":De,"--sidebar-width-icon":Oe,...c},...g,children:m})})})});$.displayName="SidebarProvider";const Y=n.forwardRef(({dataHook:e,trackingEl:a,trackingLabel:t,side:o="left",variant:s="sidebar",collapsible:i="offcanvas",embedded:l,mobileTitle:c,mobileDescription:m,className:g,children:x,...b},p)=>{const{isMobile:v,state:f,openMobile:R,setOpenMobile:w}=k();return i==="none"?r.jsx("div",{ref:p,className:d.cn("text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",g),"data-hook":e,"data-slot":"sidebar","data-tracking-el":a||"sidebar","data-tracking-label":t,...b,children:x}):v?r.jsx(M.Sheet,{open:R,onOpenChange:w,children:r.jsxs(M.SheetContent,{className:"bg-sidebar-background text-sidebar-foreground w-(--sidebar-width) p-6","data-hook":`${e}-mobile-content`,"data-mobile":"true","data-sidebar":"sidebar",side:"left",style:{"--sidebar-width":`min(${Ae}, calc(100vw - 40px))`},children:[r.jsx(M.SheetTitle,{className:"sr-only",children:c??"Navigation"}),r.jsx(M.SheetDescription,{className:"sr-only",children:m??"Main navigation menu"}),r.jsx("div",{className:"flex h-full w-full flex-col",children:x})]})}):r.jsx("div",{ref:p,className:d.cn("group text-sidebar-foreground flex h-full shrink-0 flex-col overflow-hidden transition-[width] duration-200 ease-linear",f==="expanded"&&"w-(--sidebar-width)",i==="icon"&&f==="collapsed"&&"w-(--sidebar-width-icon)",i==="offcanvas"&&f==="collapsed"&&"w-0",g),"data-collapsible":f==="collapsed"?i:"","data-hook":e,"data-side":o,"data-slot":"sidebar","data-state":f,"data-tracking-el":a||"sidebar","data-tracking-label":t,"data-variant":s,...b,children:x})});Y.displayName="Sidebar";const A=n.forwardRef(({className:e,onClick:a,dataHook:t="sidebar-trigger",toggleAriaLabel:o,children:s,...i},l)=>{const{toggleSidebar:c}=k(),m=o??"Toggle Sidebar";return r.jsxs(we.Button,{ref:l,iconOnly:!0,"aria-label":m,className:d.cn("h-7 w-7",e),"data-slot":"sidebar-trigger",dataHook:t,size:"sm",variant:"ghost",onClick:g=>{a?.(g),c()},...i,children:[s||r.jsx(u.PanelLeft,{}),r.jsx("span",{className:"sr-only",children:m})]})});A.displayName="SidebarTrigger";const Z=n.forwardRef(({className:e,toggleAriaLabel:a,...t},o)=>{const{toggleSidebar:s}=k(),i=a??"Toggle Sidebar";return r.jsx("button",{ref:o,"aria-label":i,className:d.cn("hover:after:bg-sidebar-border absolute inset-y-0 -right-4 z-20 hidden w-4 -translate-x-1/2 transition-transform ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-0.5 sm:flex","cursor-w-resize","in-data-[state=collapsed]:cursor-e-resize","group-data-[collapsible=offcanvas]:hover:bg-sidebar-background group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full","in-data-[collapsible=offcanvas]:-right-2",e),"data-slot":"sidebar-rail",tabIndex:-1,title:i,onClick:s,...t})});Z.displayName="SidebarRail";const J=n.forwardRef(({className:e,dataHook:a,trackingEl:t,trackingLabel:o,...s},i)=>r.jsx("main",{ref:i,className:d.cn("bg-background relative flex min-h-svh flex-1 flex-col",e),"data-hook":a,"data-slot":"sidebar-inset","data-tracking-el":t||"sidebar-inset","data-tracking-label":o,...s}));J.displayName="SidebarInset";const Q=n.forwardRef(({className:e,...a},t)=>r.jsx(ke.Input,{ref:t,className:d.cn("bg-background focus-visible:ring-sidebar-ring h-8 w-full shadow-none focus-visible:ring-2",e),"data-slot":"sidebar-input",dataHook:"sidebar-input",...a}));Q.displayName="SidebarInput";const ee=n.forwardRef(({className:e,dataHook:a,...t},o)=>r.jsx("header",{ref:o,className:d.cn("pr-section-xs flex flex-col gap-2 pt-2 pb-9 pl-8",e),"data-hook":a,"data-slot":"sidebar-header",...t}));ee.displayName="SidebarHeader";const ae=n.forwardRef(({className:e,dataHook:a,...t},o)=>r.jsx("footer",{ref:o,className:d.cn("flex flex-col gap-2 p-2",e),"data-hook":a,"data-slot":"sidebar-footer",...t}));ae.displayName="SidebarFooter";const te=n.forwardRef(({className:e,...a},t)=>r.jsx(ye.Separator,{ref:t,className:d.cn("bg-sidebar-border mx-2 my-5 w-auto group-data-[collapsible=icon]:mx-0",e),"data-slot":"sidebar-separator",...a}));te.displayName="SidebarSeparator";const re=n.forwardRef(({className:e,dataHook:a,ariaLabel:t="Sidebar",children:o,...s},i)=>{const{isMobile:l}=k();return r.jsx(je.ScrollArea,{ref:i,className:d.cn("min-h-0 flex-1 group-data-[collapsible=icon]:overflow-hidden *:data-[slot=scroll-area-viewport]:p-0 [&_[data-slot=scroll-area-viewport]>div]:block!",e),dataHook:a??"sidebar-content-scroll",scrollOrientation:l?"both":"vertical",...s,children:r.jsx("nav",{"aria-label":t,className:"flex flex-col gap-2","data-slot":"sidebar-content",children:o})})});re.displayName="SidebarContent";const oe=n.forwardRef(({className:e,dataHook:a,...t},o)=>r.jsx("div",{ref:o,className:d.cn("relative flex w-full min-w-0 flex-col p-2",e),"data-hook":a,"data-slot":"sidebar-group",...t}));oe.displayName="SidebarGroup";const Te=D.cva("flex h-8 shrink-0 items-center rounded-md px-2 font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:shrink-0 group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",{variants:{size:{default:"text-sm",sm:"text-sm",xs:"text-xs"},variant:{default:"",collapsible:"w-full justify-between cursor-pointer hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",action:"w-full justify-between cursor-pointer hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"}},defaultVariants:{size:"sm",variant:"default"}}),se=n.forwardRef(({className:e,dataHook:a,asChild:t=!1,size:o="sm",variant:s="default",isOpen:i=!1,onToggle:l,onAction:c,children:m,...g},x)=>{const b=t?y.Slot:"div",p=()=>{s==="collapsible"&&l?l():s==="action"&&c&&c()},v=f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),p())};return r.jsxs(b,{ref:x,className:d.cn(Te({size:o,variant:s}),e),"data-hook":a,"data-slot":"sidebar-group-label","data-variant":s,role:s!=="default"?"button":void 0,tabIndex:s!=="default"?0:void 0,onClick:s!=="default"?p:void 0,onKeyDown:s!=="default"?v:void 0,...g,children:[r.jsx("span",{children:m}),s==="collapsible"&&r.jsx(u.ChevronDown,{className:d.cn("shrink-0 transition-transform duration-200",i&&"rotate-180"),size:16}),s==="action"&&r.jsx(u.Plus,{className:"shrink-0",size:16})]})});se.displayName="SidebarGroupLabel";const ie=n.forwardRef(({className:e,asChild:a=!1,...t},o)=>{const s=a?y.Slot:"button";return r.jsx(s,{ref:o,className:d.cn("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform outline-none focus-visible:ring-2 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),"data-slot":"sidebar-group-action",...t})});ie.displayName="SidebarGroupAction";const ne=n.forwardRef(({className:e,dataHook:a,...t},o)=>r.jsx("div",{ref:o,className:d.cn("w-full text-sm",e),"data-hook":a,"data-slot":"sidebar-group-content",...t}));ne.displayName="SidebarGroupContent";const de=n.forwardRef(({className:e,dataHook:a,...t},o)=>r.jsx("ul",{ref:o,className:d.cn("flex w-full min-w-0 flex-col gap-1",e),"data-hook":a,"data-slot":"sidebar-menu",...t}));de.displayName="SidebarMenu";const O=n.forwardRef(({className:e,dataHook:a,...t},o)=>r.jsx("li",{ref:o,className:d.cn("group/menu-item relative",e),"data-hook":a,"data-slot":"sidebar-menu-item",...t}));O.displayName="SidebarMenuItem";const le=n.forwardRef(({type:e="caret",isActive:a=!1,className:t,...o},s)=>{const i={ref:s,className:d.cn("shrink-0 transition-transform",a&&e==="caret"&&"rotate-90",t),"data-slot":"sidebar-collapse-icon",...o};switch(e){case"horizontal":return r.jsx(u.ChevronRight,{...i});case"vertical":return r.jsx(u.ChevronDown,{...i});case"upDown":return r.jsx(u.ChevronsUpDown,{...i});case"plusMinus":return a?r.jsx(u.Minus,{...i}):r.jsx(u.Plus,{...i});case"dots":return r.jsx(u.Ellipsis,{...i});default:return r.jsx(u.ChevronRight,{...i})}});le.displayName="SidebarCollapseIcon";const Be=D.cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-full px-6 py-2 text-left text-sm font-medium outline-none ring-sidebar-ring transition-[color,background-color,border-color,box-shadow,opacity,width,height,padding] duration-150 ease-in-out hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-semibold data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:rounded-md [&>span:last-of-type]:truncate [&>svg]:shrink-0 [&>svg]:opacity-70 data-[active=true]:[&>svg]:opacity-100 group-data-[collapsible=icon]:[&>span]:hidden group-data-[collapsible=icon]:[&>div]:hidden",{variants:{variant:{simple:"",collapsible:"[&>[data-collapse-icon]]:ml-auto [&>[data-collapse-icon]]:transition-transform data-[state=open]:[&>[data-collapse-icon]]:rotate-90",dropdown:"group-has-[[data-sidebar=menu-action]]/menu-item:pr-8",badge:"group-has-[[data-sidebar=menu-badge]]/menu-item:pr-16",bigIcon:"h-auto flex-col items-start gap-1 rounded-lg p-3 [&>svg]:size-6 [&>svg]:rounded-md [&>svg]:bg-sidebar-foreground [&>svg]:p-1 [&>svg]:text-sidebar-background [&>svg]:opacity-100 hover:[&>svg]:bg-sidebar-foreground hover:[&>svg]:text-sidebar-background group-data-[collapsible=icon]:!size-10 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:items-center group-data-[collapsible=icon]:[&>svg]:size-6",checkbox:"px-3 [&>[data-checkbox]]:size-4 [&>[data-checkbox]]:shrink-0 [&>[data-checkbox]]:rounded [&>[data-checkbox]]:border [&>[data-checkbox]]:border-sidebar-foreground/30 data-[checked=true]:[&>[data-checkbox]]:bg-primary data-[checked=true]:[&>[data-checkbox]]:border-primary data-[checked=true]:[&>[data-checkbox]]:text-primary-foreground"},size:{default:"h-12 text-sm/4",sm:"h-7 text-xs/4",lg:"h-12 text-sm/4 group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"simple",size:"default"}}),E=n.forwardRef(({asChild:e=!1,isActive:a=!1,variant:t="simple",size:o="default",tooltip:s,className:i,dataHook:l,...c},m)=>{const g=e?y.Slot:"button",{isMobile:x,state:b}=k(),p=r.jsx(g,{ref:m,className:d.cn(Be({variant:t,size:o}),i),"data-active":a,"data-hook":l,"data-size":o,"data-slot":"sidebar-menu-button","data-variant":t,...c});return s?(typeof s=="string"&&(s={children:s,dataHook:"sidebar-menu-button-tooltip"}),r.jsxs(C.Tooltip,{children:[r.jsx(C.TooltipTrigger,{asChild:!0,children:p}),r.jsx(C.TooltipContent,{hideArrow:!0,...s,align:"center",className:d.cn("bg-foreground text-background border-none",s.className),hidden:b!=="collapsed"||x,side:"right",sideOffset:8})]})):p});E.displayName="SidebarMenuButton";const ce=n.forwardRef(({className:e,asChild:a=!1,showOnHover:t=!1,...o},s)=>{const i=a?y.Slot:"button";return r.jsx(i,{ref:s,className:d.cn("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform outline-none focus-visible:ring-2 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","peer-data-[size=bigIcon]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",t&&"peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",e),"data-slot":"sidebar-menu-action",...o})});ce.displayName="SidebarMenuAction";const ue=n.forwardRef(({className:e,...a},t)=>r.jsx("div",{ref:t,className:d.cn("text-sidebar-foreground pointer-events-none absolute inset-y-0 right-4 my-auto flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","group-data-[collapsible=icon]:hidden",e),"data-slot":"sidebar-menu-badge",...a}));ue.displayName="SidebarMenuBadge";const be=n.forwardRef(({className:e,showIcon:a=!1,...t},o)=>{const s=n.useId(),i=n.useMemo(()=>{let l=0;for(let c=0;c<s.length;c++)l=(l<<5)-l+s.charCodeAt(c),l|=0;return`${Math.abs(l)%40+50}%`},[s]);return r.jsxs("div",{ref:o,className:d.cn("flex h-8 items-center gap-2 rounded-md px-2",e),"data-slot":"sidebar-menu-skeleton",...t,children:[a&&r.jsx(L.Skeleton,{className:"size-4 rounded-md","data-slot":"sidebar-menu-skeleton-icon"}),r.jsx(L.Skeleton,{className:"h-4 max-w-[--skeleton-width] flex-1","data-slot":"sidebar-menu-skeleton-text",style:{"--skeleton-width":i}})]})});be.displayName="SidebarMenuSkeleton";const Le=D.cva("flex min-w-0 flex-col items-start gap-1 py-0.5 group-data-[collapsible=icon]:hidden",{variants:{variant:{default:"px-10",border:"border-l border-sidebar-border ml-10 pl-1 pr-10",indent:"px-10"}},defaultVariants:{variant:"border"}}),T=n.forwardRef(({className:e,variant:a="border",dataHook:t,...o},s)=>r.jsx("ul",{ref:s,className:d.cn(Le({variant:a}),e),"data-hook":t,"data-slot":"sidebar-menu-sub",...o}));T.displayName="SidebarMenuSub";const pe=n.forwardRef(({dataHook:e,...a},t)=>r.jsx("li",{ref:t,"data-hook":e,"data-slot":"sidebar-menu-sub-item",...a}));pe.displayName="SidebarMenuSubItem";const fe=n.forwardRef(({asChild:e=!1,size:a="md",isActive:t,className:o,dataHook:s,...i},l)=>{const c=e?y.Slot:"a";return r.jsx(c,{ref:l,className:d.cn("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-foreground flex h-7 min-w-0 items-center gap-2 overflow-hidden rounded-md px-2 transition-[color,background-color,box-shadow,opacity] duration-150 ease-in-out outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-of-type]:truncate [&>svg]:shrink-0","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",a==="sm"&&"text-xs",a==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",o),"data-active":t,"data-hook":s,"data-size":a,"data-slot":"sidebar-menu-sub-button",...i})});fe.displayName="SidebarMenuSubButton";function me({dataHook:e,className:a,children:t,defaultOpen:o,open:s,onOpenChange:i}){return r.jsx(O,{children:r.jsx(I.Accordion,{collapsible:!0,className:a,dataHook:e??"sidebar-menu-collapsible",defaultValue:o?"item":void 0,type:"single",value:s!==void 0?s?"item":"":void 0,onValueChange:i?l=>i(l==="item"):void 0,children:r.jsx(I.AccordionItem,{className:"group/collapsible border-none",value:"item",children:t})})})}me.displayName="SidebarMenuCollapsible";const ge=n.forwardRef(({children:e,className:a,...t},o)=>r.jsx(Ce.Trigger,{asChild:!0,children:r.jsxs(E,{ref:o,className:a,variant:"collapsible",...t,children:[e,r.jsx(u.ChevronRight,{"data-collapse-icon":!0,className:"opacity-100! transition-transform duration-200 ease-out group-data-[collapsible=icon]:hidden",size:12})]})}));ge.displayName="SidebarMenuCollapsibleTrigger";const he=n.forwardRef(({dataHook:e,children:a,...t},o)=>r.jsx(I.AccordionContent,{className:"p-0",children:r.jsx(T,{ref:o,dataHook:e,...t,children:a})}));he.displayName="SidebarMenuCollapsibleContent";const xe=n.forwardRef(({className:e,dataHook:a="sidebar-drawer",trackingEl:t,trackingLabel:o,children:s,...i},l)=>r.jsx("div",{ref:l,className:e,"data-hook":a,"data-slot":"sidebar-drawer","data-tracking-el":t,"data-tracking-label":o,...i,children:r.jsx(A,{dataHook:`${a}-trigger`,children:r.jsx(u.Menu,{size:24})})}));xe.displayName="SidebarDrawer";exports.Sidebar=Y;exports.SidebarCollapseIcon=le;exports.SidebarCollapseIconType=W;exports.SidebarCollapsible=q;exports.SidebarContent=re;exports.SidebarDrawer=xe;exports.SidebarFooter=ae;exports.SidebarGroup=oe;exports.SidebarGroupAction=ie;exports.SidebarGroupContent=ne;exports.SidebarGroupLabel=se;exports.SidebarGroupLabelSize=G;exports.SidebarGroupLabelVariant=H;exports.SidebarHeader=ee;exports.SidebarInput=Q;exports.SidebarInset=J;exports.SidebarMenu=de;exports.SidebarMenuAction=ce;exports.SidebarMenuBadge=ue;exports.SidebarMenuButton=E;exports.SidebarMenuButtonSize=K;exports.SidebarMenuButtonVariant=F;exports.SidebarMenuCollapsible=me;exports.SidebarMenuCollapsibleContent=he;exports.SidebarMenuCollapsibleTrigger=ge;exports.SidebarMenuItem=O;exports.SidebarMenuSkeleton=be;exports.SidebarMenuSub=T;exports.SidebarMenuSubButton=fe;exports.SidebarMenuSubButtonSize=V;exports.SidebarMenuSubItem=pe;exports.SidebarMenuSubVariant=U;exports.SidebarProvider=$;exports.SidebarRail=Z;exports.SidebarSeparator=te;exports.SidebarSide=z;exports.SidebarTrigger=A;exports.SidebarVariant=P;exports.useSidebar=k;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),Oe=require("react"),k=require("@radix-ui/react-slot"),T=require("class-variance-authority"),m=require("@brightlocal/icons"),l=require("@brightlocal/ui-components/lib/utils"),H=require("../button.cjs"),_e=require("../input.cjs"),F=require("../separator.cjs"),N=require("../dropdown-menu.cjs"),_=require("../popover.cjs"),R=require("../sheet.cjs"),E=require("../accordion.cjs"),Ee=require("@radix-ui/react-accordion"),Te=require("../scroll-area.cjs"),G=require("../skeleton.cjs"),I=require("../tooltip.cjs"),Pe=require("../hooks/use-breakpoint.cjs");function U(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const i=U(Oe),ze=U(Ee),v="focus-visible:[box-shadow:0_0_0_1px_color-mix(in_srgb,var(--color-sidebar-ring)_50%,transparent),0_0_0_3px_rgba(0,0,0,0.1)]";var K=(e=>(e.LEFT="left",e))(K||{}),V=(e=>(e.SIDEBAR="sidebar",e))(V||{}),$=(e=>(e.OFFCANVAS="offcanvas",e.ICON="icon",e.NONE="none",e))($||{}),W=(e=>(e.DEFAULT="default",e.SM="sm",e.XS="xs",e))(W||{}),X=(e=>(e.DEFAULT="default",e.COLLAPSIBLE="collapsible",e.ACTION="action",e))(X||{}),Y=(e=>(e.SIMPLE="simple",e.COLLAPSIBLE="collapsible",e.DROPDOWN="dropdown",e.BADGE="badge",e.BIG_ICON="bigIcon",e.CHECKBOX="checkbox",e))(Y||{}),Z=(e=>(e.DEFAULT="default",e.SM="sm",e.LG="lg",e))(Z||{}),J=(e=>(e.DEFAULT="default",e.BORDER="border",e.INDENT="indent",e))(J||{}),Q=(e=>(e.SM="sm",e.MD="md",e))(Q||{}),ee=(e=>(e.CARET="caret",e.HORIZONTAL="horizontal",e.VERTICAL="vertical",e.UP_DOWN="upDown",e.PLUS_MINUS="plusMinus",e.DOTS="dots",e))(ee||{});const Be="sidebar:state",Le=3600*24*7,qe="224px",Ge="336px",He="48px",Fe="b",ae=i.createContext(null);function y(){const e=i.useContext(ae);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const te=i.forwardRef(({dataHook:e,trackingEl:r,trackingLabel:t,defaultOpen:o=!0,open:s,onOpenChange:n,className:d,style:c,children:u,...b},f)=>{const p=Pe.useIsBelowBreakpoint("lg"),[x,S]=i.useState(!1),[g,O]=i.useState(o),j=s??g,M=i.useCallback(h=>{const w=typeof h=="function"?h(j):h;n?n(w):O(w),document.cookie=`${Be}=${w}; path=/; max-age=${Le}`},[n,j]),C=i.useCallback(()=>p?S(h=>!h):M(h=>!h),[p,M,S]);i.useEffect(()=>{const h=w=>{w.key===Fe&&(w.metaKey||w.ctrlKey)&&(w.preventDefault(),C())};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[C]);const q=j?"expanded":"collapsed",Ae=i.useMemo(()=>({state:q,open:j,setOpen:M,isMobile:p,openMobile:x,setOpenMobile:S,toggleSidebar:C}),[q,j,M,p,x,S,C]);return a.jsx(ae.Provider,{value:Ae,children:a.jsx(I.TooltipProvider,{delayDuration:0,children:a.jsx("div",{ref:f,className:l.cn("group/sidebar-wrapper flex min-h-svh w-full",d),"data-hook":e,"data-slot":"sidebar-provider","data-tracking-el":r||"sidebar-provider","data-tracking-label":t,style:{"--sidebar-width":qe,"--sidebar-width-icon":He,...c},...b,children:u})})})});te.displayName="SidebarProvider";const re=i.forwardRef(({dataHook:e,trackingEl:r,trackingLabel:t,side:o="left",variant:s="sidebar",collapsible:n="offcanvas",embedded:d,mobileTitle:c,mobileDescription:u,className:b,children:f,...p},x)=>{const{isMobile:S,state:g,openMobile:O,setOpenMobile:j}=y();return n==="none"?a.jsx("div",{ref:x,className:l.cn("text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",b),"data-hook":e,"data-slot":"sidebar","data-tracking-el":r||"sidebar","data-tracking-label":t,...p,children:f}):S?a.jsx(R.Sheet,{open:O,onOpenChange:j,children:a.jsxs(R.SheetContent,{className:"bg-sidebar-background text-sidebar-foreground w-(--sidebar-width) p-6","data-hook":`${e}-mobile-content`,"data-mobile":"true","data-sidebar":"sidebar",side:"left",style:{"--sidebar-width":`min(${Ge}, calc(100vw - 40px))`},children:[a.jsx(R.SheetTitle,{className:"sr-only",children:c??"Navigation"}),a.jsx(R.SheetDescription,{className:"sr-only",children:u??"Main navigation menu"}),a.jsx("div",{className:"flex h-full w-full flex-col",children:f})]})}):a.jsx("div",{ref:x,className:l.cn("group text-sidebar-foreground flex h-full shrink-0 flex-col overflow-hidden transition-[width] duration-200 ease-linear",g==="expanded"&&"w-(--sidebar-width)",n==="icon"&&g==="collapsed"&&"w-(--sidebar-width-icon)",n==="offcanvas"&&g==="collapsed"&&"w-0",b),"data-collapsible":g==="collapsed"?n:"","data-hook":e,"data-side":o,"data-slot":"sidebar","data-state":g,"data-tracking-el":r||"sidebar","data-tracking-label":t,"data-variant":s,...p,children:f})});re.displayName="Sidebar";const P=i.forwardRef(({className:e,onClick:r,dataHook:t="sidebar-trigger",toggleAriaLabel:o,children:s,...n},d)=>{const{toggleSidebar:c}=y(),u=o??"Toggle Sidebar";return a.jsxs(H.Button,{ref:d,iconOnly:!0,"aria-label":u,className:l.cn("h-7 w-7",e),"data-slot":"sidebar-trigger",dataHook:t,size:"sm",variant:"ghost",onClick:b=>{r?.(b),c()},...n,children:[s||a.jsx(m.PanelLeft,{}),a.jsx("span",{className:"sr-only",children:u})]})});P.displayName="SidebarTrigger";const oe=i.forwardRef(({className:e,toggleAriaLabel:r,...t},o)=>{const{toggleSidebar:s}=y(),n=r??"Toggle Sidebar";return a.jsx("button",{ref:o,"aria-label":n,className:l.cn("hover:after:bg-sidebar-border absolute inset-y-0 -right-4 z-20 hidden w-4 -translate-x-1/2 transition-transform ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-0.5 sm:flex","cursor-w-resize","in-data-[state=collapsed]:cursor-e-resize","group-data-[collapsible=offcanvas]:hover:bg-sidebar-background group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full","in-data-[collapsible=offcanvas]:-right-2",e),"data-slot":"sidebar-rail",tabIndex:-1,title:n,onClick:s,...t})});oe.displayName="SidebarRail";const se=i.forwardRef(({className:e,dataHook:r,trackingEl:t,trackingLabel:o,...s},n)=>a.jsx("main",{ref:n,className:l.cn("bg-background relative flex min-h-svh flex-1 flex-col",e),"data-hook":r,"data-slot":"sidebar-inset","data-tracking-el":t||"sidebar-inset","data-tracking-label":o,...s}));se.displayName="SidebarInset";const ne=i.forwardRef(({className:e,...r},t)=>a.jsx(_e.Input,{ref:t,className:l.cn("bg-background h-8 w-full shadow-none",v,e),"data-slot":"sidebar-input",dataHook:"sidebar-input",...r}));ne.displayName="SidebarInput";const ie=i.forwardRef(({className:e,dataHook:r,...t},o)=>a.jsx("header",{ref:o,className:l.cn("pr-section-xs flex flex-col gap-2 pt-2 pb-9 pl-8",e),"data-hook":r,"data-slot":"sidebar-header",...t}));ie.displayName="SidebarHeader";const de=i.forwardRef(({className:e,dataHook:r,...t},o)=>a.jsx("footer",{ref:o,className:l.cn("flex flex-col gap-2 p-2",e),"data-hook":r,"data-slot":"sidebar-footer",...t}));de.displayName="SidebarFooter";const le=i.forwardRef(({className:e,...r},t)=>a.jsx(F.Separator,{ref:t,className:l.cn("bg-sidebar-border mx-2 my-5 w-auto group-data-[collapsible=icon]:mx-0",e),"data-slot":"sidebar-separator",...r}));le.displayName="SidebarSeparator";const ce=i.forwardRef(({className:e,dataHook:r,ariaLabel:t="Sidebar",children:o,...s},n)=>{const{isMobile:d}=y(),c=i.useCallback(u=>{const b=u?.querySelector('[data-slot="scroll-area-viewport"]');b&&(b.tabIndex=-1),typeof n=="function"?n(u):n&&(n.current=u)},[n]);return a.jsx(Te.ScrollArea,{ref:c,className:l.cn("min-h-0 flex-1 group-data-[collapsible=icon]:overflow-hidden [&_[data-slot=scroll-area-viewport]>div]:block!",e),dataHook:r??"sidebar-content-scroll",scrollOrientation:d?"both":"vertical",...s,children:a.jsx("nav",{"aria-label":t,className:"flex flex-col gap-2","data-slot":"sidebar-content",children:o})})});ce.displayName="SidebarContent";const ue=i.forwardRef(({className:e,dataHook:r,...t},o)=>a.jsx("div",{ref:o,className:l.cn("relative flex w-full min-w-0 flex-col p-2",e),"data-hook":r,"data-slot":"sidebar-group",...t}));ue.displayName="SidebarGroup";const Ue=T.cva(["flex h-8 shrink-0 items-center rounded-md px-2 font-medium text-sidebar-foreground/70 outline-none transition-[margin,opacity] duration-200 ease-linear [&>svg]:shrink-0 group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",v],{variants:{size:{default:"text-sm",sm:"text-sm",xs:"text-xs"},variant:{default:"",collapsible:"w-full justify-between cursor-pointer hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",action:"w-full justify-between cursor-pointer hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"}},defaultVariants:{size:"sm",variant:"default"}}),be=i.forwardRef(({className:e,dataHook:r,asChild:t=!1,size:o="sm",variant:s="default",isOpen:n=!1,onToggle:d,onAction:c,children:u,...b},f)=>{const p=t?k.Slot:"div",x=()=>{s==="collapsible"&&d?d():s==="action"&&c&&c()},S=g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),x())};return a.jsxs(p,{ref:f,className:l.cn(Ue({size:o,variant:s}),e),"data-hook":r,"data-slot":"sidebar-group-label","data-variant":s,role:s!=="default"?"button":void 0,tabIndex:s!=="default"?0:void 0,onClick:s!=="default"?x:void 0,onKeyDown:s!=="default"?S:void 0,...b,children:[a.jsx("span",{children:u}),s==="collapsible"&&a.jsx(m.ChevronDown,{className:l.cn("shrink-0 transition-transform duration-200",n&&"rotate-180"),size:16}),s==="action"&&a.jsx(m.Plus,{className:"shrink-0",size:16})]})});be.displayName="SidebarGroupLabel";const pe=i.forwardRef(({className:e,asChild:r=!1,...t},o)=>{const s=r?k.Slot:"button";return a.jsx(s,{ref:o,className:l.cn("text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform outline-none [&>svg]:shrink-0",v,"after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),"data-slot":"sidebar-group-action",...t})});pe.displayName="SidebarGroupAction";const fe=i.forwardRef(({className:e,dataHook:r,...t},o)=>a.jsx("div",{ref:o,className:l.cn("w-full text-sm",e),"data-hook":r,"data-slot":"sidebar-group-content",...t}));fe.displayName="SidebarGroupContent";const me=i.forwardRef(({className:e,dataHook:r,...t},o)=>a.jsx("ul",{ref:o,className:l.cn("flex w-full min-w-0 flex-col gap-1",e),"data-hook":r,"data-slot":"sidebar-menu",...t}));me.displayName="SidebarMenu";const z=i.forwardRef(({className:e,dataHook:r,...t},o)=>a.jsx("li",{ref:o,className:l.cn("group/menu-item relative",e),"data-hook":r,"data-slot":"sidebar-menu-item",...t}));z.displayName="SidebarMenuItem";const xe=i.forwardRef(({type:e="caret",isActive:r=!1,className:t,...o},s)=>{const n={ref:s,className:l.cn("shrink-0 transition-transform",r&&e==="caret"&&"rotate-90",t),"data-slot":"sidebar-collapse-icon",...o};switch(e){case"horizontal":return a.jsx(m.ChevronRight,{...n});case"vertical":return a.jsx(m.ChevronDown,{...n});case"upDown":return a.jsx(m.ChevronsUpDown,{...n});case"plusMinus":return r?a.jsx(m.Minus,{...n}):a.jsx(m.Plus,{...n});case"dots":return a.jsx(m.Ellipsis,{...n});default:return a.jsx(m.ChevronRight,{...n})}});xe.displayName="SidebarCollapseIcon";const Ke=T.cva(["peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-full px-6 py-2 text-left text-sm font-medium outline-none transition-[color,background-color,border-color,box-shadow,opacity,width,height,padding] duration-150 ease-in-out hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-semibold data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:rounded-md [&>span:last-of-type]:truncate [&>svg]:shrink-0 [&>svg]:opacity-70 data-[active=true]:[&>svg]:opacity-100 group-data-[collapsible=icon]:[&>span]:hidden group-data-[collapsible=icon]:[&>div]:hidden",v],{variants:{variant:{simple:"",collapsible:"[&>[data-collapse-icon]]:ml-auto [&>[data-collapse-icon]]:transition-transform data-[state=open]:[&>[data-collapse-icon]]:rotate-90",dropdown:"group-has-[[data-sidebar=menu-action]]/menu-item:pr-8",badge:"group-has-[[data-sidebar=menu-badge]]/menu-item:pr-16",bigIcon:"h-auto flex-col items-start gap-1 rounded-lg p-3 [&>svg]:size-6 [&>svg]:rounded-md [&>svg]:bg-sidebar-foreground [&>svg]:p-1 [&>svg]:text-sidebar-background [&>svg]:opacity-100 hover:[&>svg]:bg-sidebar-foreground hover:[&>svg]:text-sidebar-background group-data-[collapsible=icon]:!size-10 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:items-center group-data-[collapsible=icon]:[&>svg]:size-6",checkbox:"px-3 [&>[data-checkbox]]:size-4 [&>[data-checkbox]]:shrink-0 [&>[data-checkbox]]:rounded [&>[data-checkbox]]:border [&>[data-checkbox]]:border-sidebar-foreground/30 data-[checked=true]:[&>[data-checkbox]]:bg-primary data-[checked=true]:[&>[data-checkbox]]:border-primary data-[checked=true]:[&>[data-checkbox]]:text-primary-foreground"},size:{default:"h-12 text-sm/4",sm:"h-7 text-xs/4",lg:"h-12 text-sm/4 group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"simple",size:"default"}}),A=i.forwardRef(({asChild:e=!1,isActive:r=!1,variant:t="simple",size:o="default",tooltip:s,className:n,dataHook:d,...c},u)=>{const b=e?k.Slot:"button",{isMobile:f,state:p}=y(),x=a.jsx(b,{ref:u,className:l.cn(Ke({variant:t,size:o}),n),"data-active":r,"data-hook":d,"data-size":o,"data-slot":"sidebar-menu-button","data-variant":t,...c});return s?(typeof s=="string"&&(s={children:s,dataHook:"sidebar-menu-button-tooltip"}),a.jsxs(I.Tooltip,{children:[a.jsx(I.TooltipTrigger,{asChild:!0,children:x}),a.jsx(I.TooltipContent,{hideArrow:!0,...s,align:"center",className:l.cn("bg-foreground text-background border-none",s.className),hidden:p!=="collapsed"||f,side:"right",sideOffset:8})]})):x});A.displayName="SidebarMenuButton";const ge=i.forwardRef(({className:e,asChild:r=!1,showOnHover:t=!1,...o},s)=>{const n=r?k.Slot:"button";return a.jsx(n,{ref:s,className:l.cn("text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform outline-none [&>svg]:shrink-0",v,"after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","peer-data-[size=bigIcon]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",t&&"peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",e),"data-slot":"sidebar-menu-action",...o})});ge.displayName="SidebarMenuAction";const he=i.forwardRef(({className:e,...r},t)=>a.jsx("div",{ref:t,className:l.cn("text-sidebar-foreground pointer-events-none absolute inset-y-0 right-4 my-auto flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","group-data-[collapsible=icon]:hidden",e),"data-slot":"sidebar-menu-badge",...r}));he.displayName="SidebarMenuBadge";const ve=i.forwardRef(({className:e,showIcon:r=!1,...t},o)=>{const s=i.useId(),n=i.useMemo(()=>{let d=0;for(let c=0;c<s.length;c++)d=(d<<5)-d+s.charCodeAt(c),d|=0;return`${Math.abs(d)%40+50}%`},[s]);return a.jsxs("div",{ref:o,className:l.cn("flex h-8 items-center gap-2 rounded-md px-2",e),"data-slot":"sidebar-menu-skeleton",...t,children:[r&&a.jsx(G.Skeleton,{className:"size-4 rounded-md","data-slot":"sidebar-menu-skeleton-icon"}),a.jsx(G.Skeleton,{className:"h-4 max-w-[--skeleton-width] flex-1","data-slot":"sidebar-menu-skeleton-text",style:{"--skeleton-width":n}})]})});ve.displayName="SidebarMenuSkeleton";const Ve=T.cva("flex min-w-0 flex-col items-start gap-1 py-1 group-data-[collapsible=icon]:hidden",{variants:{variant:{default:"px-10",border:"border-l border-sidebar-border ml-10 pl-1 pr-10",indent:"px-10"}},defaultVariants:{variant:"border"}}),B=i.forwardRef(({className:e,variant:r="border",dataHook:t,...o},s)=>a.jsx("ul",{ref:s,className:l.cn(Ve({variant:r}),e),"data-hook":t,"data-slot":"sidebar-menu-sub",...o}));B.displayName="SidebarMenuSub";const Se=i.forwardRef(({dataHook:e,...r},t)=>a.jsx("li",{ref:t,"data-hook":e,"data-slot":"sidebar-menu-sub-item",...r}));Se.displayName="SidebarMenuSubItem";const we=i.forwardRef(({asChild:e=!1,size:r="md",isActive:t,className:o,dataHook:s,...n},d)=>{const c=e?k.Slot:"a";return a.jsx(c,{ref:d,className:l.cn("text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-foreground flex h-7 min-w-0 items-center gap-2 overflow-hidden rounded-md px-2 transition-[color,background-color,box-shadow,opacity] duration-150 ease-in-out outline-none disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-of-type]:truncate [&>svg]:shrink-0",v,"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",r==="sm"&&"text-xs",r==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",o),"data-active":t,"data-hook":s,"data-size":r,"data-slot":"sidebar-menu-sub-button",...n})});we.displayName="SidebarMenuSubButton";function je({dataHook:e,className:r,children:t,defaultOpen:o,open:s,onOpenChange:n}){return a.jsx(z,{children:a.jsx(E.Accordion,{collapsible:!0,className:r,dataHook:e??"sidebar-menu-collapsible",defaultValue:o?"item":void 0,type:"single",value:s!==void 0?s?"item":"":void 0,onValueChange:n?d=>n(d==="item"):void 0,children:a.jsx(E.AccordionItem,{className:"group/collapsible border-none",value:"item",children:t})})})}je.displayName="SidebarMenuCollapsible";const Ne=i.forwardRef(({children:e,className:r,...t},o)=>a.jsx(ze.Trigger,{asChild:!0,children:a.jsxs(A,{ref:o,className:r,variant:"collapsible",...t,children:[e,a.jsx(m.ChevronRight,{"data-collapse-icon":!0,className:"opacity-100! transition-transform duration-200 ease-out group-data-[collapsible=icon]:hidden",size:12})]})}));Ne.displayName="SidebarMenuCollapsibleTrigger";const ye=i.forwardRef(({dataHook:e,children:r,...t},o)=>a.jsx(E.AccordionContent,{className:"p-0",children:a.jsx(B,{ref:o,dataHook:e,...t,children:r})}));ye.displayName="SidebarMenuCollapsibleContent";const ke=i.forwardRef(({className:e,dataHook:r="sidebar-drawer",trackingEl:t,trackingLabel:o,children:s,...n},d)=>a.jsx("div",{ref:d,className:e,"data-hook":r,"data-slot":"sidebar-drawer","data-tracking-el":t,"data-tracking-label":o,...n,children:a.jsx(P,{dataHook:`${r}-trigger`,children:a.jsx(m.Menu,{size:24})})}));ke.displayName="SidebarDrawer";const Me=i.forwardRef(({className:e,dataHook:r="sidebar-header-button",children:t,...o},s)=>a.jsx(H.Button,{ref:s,...o,iconOnly:!0,className:l.cn("hover:bg-sidebar-accent hover:text-sidebar-accent-foreground size-7 rounded-md shadow-none",v,e),"data-slot":"sidebar-header-button",dataHook:r,size:"sm",variant:"ghost",children:t}));Me.displayName="SidebarHeaderButton";const L=i.forwardRef(({className:e,dataHook:r="sidebar-popover-trigger",icon:t,triggerAriaLabel:o,children:s,...n},d)=>a.jsxs("button",{ref:d,"aria-label":o??"Switch workspace",className:l.cn("text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground flex items-center gap-2 rounded-md px-1.5 py-2 text-sm font-semibold transition-colors duration-200 ease-out outline-none",v,e),"data-hook":r,"data-slot":"sidebar-popover-trigger",type:"button",...n,children:[t&&a.jsx("span",{className:"bg-sidebar-primary text-sidebar-primary-foreground flex size-5 shrink-0 items-center justify-center rounded-md",children:t}),a.jsx("span",{className:"truncate",children:s}),a.jsx(m.ChevronDown,{className:"shrink-0 opacity-50",size:16})]}));L.displayName="SidebarPopoverTrigger";const D=i.forwardRef(({className:e,dataHook:r,icon:t,shortcut:o,children:s,...n},d)=>a.jsxs("button",{ref:d,className:l.cn("text-popover-foreground hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground flex h-10 w-full items-center gap-2 rounded-xs p-2 text-sm transition-colors duration-150 ease-in-out outline-none",v,e),"data-hook":r,"data-slot":"sidebar-popover-menu-item",type:"button",...n,children:[t&&a.jsx("span",{className:"border-border flex size-6 shrink-0 items-center justify-center rounded-xs border [&_svg]:size-4",children:t}),a.jsx("span",{className:"min-w-px flex-1 truncate text-left",children:s}),o&&a.jsx("span",{className:"text-popover-foreground/60 shrink-0 text-xs",children:o})]}));D.displayName="SidebarPopoverMenuItem";const Ce=i.forwardRef(({className:e,dataHook:r="sidebar-popover-menu",groupTitle:t="Teams",items:o,addActionLabel:s,addActionIcon:n,onAddAction:d,children:c,...u},b)=>a.jsx("div",{ref:b,className:l.cn("flex flex-col",e),"data-hook":r,"data-slot":"sidebar-popover-menu",...u,children:c||a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex flex-col items-start p-1",children:[t&&a.jsx("div",{className:"flex w-full items-center px-2 py-1.5",children:a.jsx("span",{className:"text-muted-foreground flex-1 text-xs font-medium",children:t})}),o?.map((f,p)=>a.jsx(D,{icon:f.icon,shortcut:f.shortcut,onClick:f.onClick,children:f.label},p))]}),d&&a.jsxs(a.Fragment,{children:[a.jsx(F.Separator,{}),a.jsx("div",{className:"flex flex-col items-start p-1",children:a.jsx(D,{icon:n||a.jsx(m.Plus,{size:16}),onClick:d,children:s??"Add team"})})]})]})}));Ce.displayName="SidebarPopoverMenu";function Re({dataHook:e="sidebar-switcher",icon:r,label:t,triggerAriaLabel:o,triggerClassName:s,children:n}){return a.jsxs(_.Popover,{children:[a.jsx(_.PopoverTrigger,{asChild:!0,children:a.jsx(L,{className:s,dataHook:`${e}-trigger`,icon:r,triggerAriaLabel:o,children:t})}),a.jsx(_.PopoverContent,{align:"start",className:"w-[316px] p-0",dataHook:`${e}-content`,side:"bottom",sideOffset:4,children:n})]})}Re.displayName="SidebarSwitcher";function Ie({dataHook:e="sidebar-account-dropdown",name:r,email:t,avatar:o,menuGroups:s,triggerAriaLabel:n,align:d="end",side:c="top",children:u}){return a.jsxs(N.DropdownMenu,{children:[a.jsx(N.DropdownMenuTrigger,{asChild:!0,children:a.jsxs(A,{"aria-label":n??"Account menu",className:"h-auto py-1.5",dataHook:`${e}-button`,size:"lg",children:[o,a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5 leading-none",children:[a.jsx("span",{className:"truncate text-sm font-semibold",children:r}),a.jsx("span",{className:"truncate text-xs font-normal",children:t})]})]})}),a.jsx(N.DropdownMenuContent,{align:d,className:"w-56",dataHook:`${e}-content`,side:c,sideOffset:4,children:u||a.jsxs(a.Fragment,{children:[a.jsxs(N.DropdownMenuLabel,{className:"flex items-center gap-2 px-1 py-1.5",children:[o,a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5 leading-none",children:[a.jsx("span",{className:"truncate text-sm font-semibold",children:r}),a.jsx("span",{className:"truncate text-xs font-normal",children:t})]})]}),s?.map((b,f)=>a.jsxs(i.Fragment,{children:[a.jsx(N.DropdownMenuSeparator,{}),b.map((p,x)=>a.jsxs(N.DropdownMenuItem,{onClick:p.onClick,children:[p.icon,p.label]},x))]},f))]})})]})}Ie.displayName="SidebarAccountDropdown";const De=i.forwardRef(({className:e,dataHook:r,senderName:t,title:o,description:s,timestamp:n,...d},c)=>a.jsxs("button",{ref:c,className:l.cn("border-sidebar-border text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent flex w-full flex-col gap-2 border-b p-4 text-left transition-colors duration-150 ease-in-out outline-none",v,e),"data-hook":r,"data-slot":"sidebar-inbox-item",type:"button",...d,children:[a.jsxs("div",{className:"flex w-full items-center justify-between text-sm",children:[a.jsx("span",{children:t}),n&&a.jsx("span",{children:n})]}),a.jsx("p",{className:"w-full text-sm font-medium",children:o}),s&&a.jsx("p",{className:"w-full truncate text-xs",children:s})]}));De.displayName="SidebarInboxItem";exports.Sidebar=re;exports.SidebarAccountDropdown=Ie;exports.SidebarCollapseIcon=xe;exports.SidebarCollapseIconType=ee;exports.SidebarCollapsible=$;exports.SidebarContent=ce;exports.SidebarDrawer=ke;exports.SidebarFooter=de;exports.SidebarGroup=ue;exports.SidebarGroupAction=pe;exports.SidebarGroupContent=fe;exports.SidebarGroupLabel=be;exports.SidebarGroupLabelSize=W;exports.SidebarGroupLabelVariant=X;exports.SidebarHeader=ie;exports.SidebarHeaderButton=Me;exports.SidebarInboxItem=De;exports.SidebarInput=ne;exports.SidebarInset=se;exports.SidebarMenu=me;exports.SidebarMenuAction=ge;exports.SidebarMenuBadge=he;exports.SidebarMenuButton=A;exports.SidebarMenuButtonSize=Z;exports.SidebarMenuButtonVariant=Y;exports.SidebarMenuCollapsible=je;exports.SidebarMenuCollapsibleContent=ye;exports.SidebarMenuCollapsibleTrigger=Ne;exports.SidebarMenuItem=z;exports.SidebarMenuSkeleton=ve;exports.SidebarMenuSub=B;exports.SidebarMenuSubButton=we;exports.SidebarMenuSubButtonSize=Q;exports.SidebarMenuSubItem=Se;exports.SidebarMenuSubVariant=J;exports.SidebarPopoverMenu=Ce;exports.SidebarPopoverMenuItem=D;exports.SidebarPopoverTrigger=L;exports.SidebarProvider=te;exports.SidebarRail=oe;exports.SidebarSeparator=le;exports.SidebarSide=K;exports.SidebarSwitcher=Re;exports.SidebarTrigger=P;exports.SidebarVariant=V;exports.useSidebar=y;
|