@fea-ui/react 0.1.0-alpha.4 → 0.1.0-alpha.7

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/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { cn, cn as cn$1, tv } from "tailwind-variants";
2
- import { Accordion, AlertDialog, Avatar, Button, Checkbox, CheckboxGroup, Dialog, Field, Fieldset, Input, Menu, Meter, Progress, Separator, Slider, Switch, Tabs, Toggle } from "@base-ui/react";
2
+ import { Accordion, AlertDialog, Avatar, Button, Checkbox, CheckboxGroup, Dialog, Field, Fieldset, Input, Menu, Meter, Popover, Progress, Separator, Slider, Switch, Tabs, Toggle } from "@base-ui/react";
3
3
  import { LucideCheck, LucideChevronDown, LucideMenu, LucideX } from "lucide-react";
4
4
  import React, { createContext, useCallback, useContext, useMemo, useState } from "react";
5
- import { jsx } from "react/jsx-runtime";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
6
 
7
7
  //#region src/components/accordion/accordion.context.ts
8
8
  const AccordionContext = createContext(null);
@@ -605,6 +605,117 @@ Dialog$1.Trigger = DialogTrigger;
605
605
  Dialog$1.Viewport = DialogViewport;
606
606
  var dialog_default = Dialog$1;
607
607
 
608
+ //#endregion
609
+ //#region src/components/drawer/drawer.context.ts
610
+ const DrawerContext = createContext(null);
611
+
612
+ //#endregion
613
+ //#region src/components/drawer/drawer.variants.ts
614
+ const drawerVariants = tv({
615
+ defaultVariants: { position: "left" },
616
+ slots: {
617
+ backdrop: "drawer__backdrop",
618
+ close: "drawer__close",
619
+ description: "drawer__description",
620
+ popup: "drawer__popup",
621
+ portal: "drawer__portal",
622
+ root: "drawer",
623
+ title: "drawer__title",
624
+ trigger: "drawer__trigger",
625
+ viewport: "drawer__viewport"
626
+ },
627
+ variants: { position: {
628
+ bottom: { popup: "drawer--bottom" },
629
+ left: { popup: "drawer--left" },
630
+ right: { popup: "drawer--right" },
631
+ top: { popup: "drawer--top" }
632
+ } }
633
+ });
634
+
635
+ //#endregion
636
+ //#region src/components/drawer/use-drawer.ts
637
+ const useDrawer = () => {
638
+ const context = useContext(DrawerContext);
639
+ if (!context) throw new Error("useDrawer must be used within a DrawerProvider");
640
+ return context;
641
+ };
642
+
643
+ //#endregion
644
+ //#region src/components/drawer/drawer.tsx
645
+ const Drawer = ({ position, ...props }) => {
646
+ return /* @__PURE__ */ jsx(DrawerContext, {
647
+ value: { slots: useMemo(() => drawerVariants({ position }), [position]) },
648
+ children: /* @__PURE__ */ jsx(Dialog.Root, { ...props })
649
+ });
650
+ };
651
+ const DrawerTrigger = ({ className, ...props }) => {
652
+ const { slots } = useDrawer();
653
+ return /* @__PURE__ */ jsx(Dialog.Trigger, {
654
+ className: cn$1(slots.trigger(), className),
655
+ ...props
656
+ });
657
+ };
658
+ const DrawerPortal = ({ className, ...props }) => {
659
+ const { slots } = useDrawer();
660
+ return /* @__PURE__ */ jsx(Dialog.Portal, {
661
+ className: cn$1(slots.portal(), className),
662
+ ...props
663
+ });
664
+ };
665
+ const DrawerBackdrop = ({ className, ...props }) => {
666
+ const { slots } = useDrawer();
667
+ return /* @__PURE__ */ jsx(Dialog.Backdrop, {
668
+ className: cn$1(slots.backdrop(), className),
669
+ ...props
670
+ });
671
+ };
672
+ const DrawerViewport = ({ className, ...props }) => {
673
+ const { slots } = useDrawer();
674
+ return /* @__PURE__ */ jsx(Dialog.Viewport, {
675
+ className: cn$1(slots.viewport(), className),
676
+ ...props
677
+ });
678
+ };
679
+ const DrawerPopup = ({ className, ...props }) => {
680
+ const { slots } = useDrawer();
681
+ return /* @__PURE__ */ jsx(Dialog.Popup, {
682
+ className: cn$1(slots.popup(), className),
683
+ ...props
684
+ });
685
+ };
686
+ const DrawerTitle = ({ className, ...props }) => {
687
+ const { slots } = useDrawer();
688
+ return /* @__PURE__ */ jsx(Dialog.Title, {
689
+ className: cn$1(slots.title(), className),
690
+ ...props
691
+ });
692
+ };
693
+ const DrawerDescription = ({ className, ...props }) => {
694
+ const { slots } = useDrawer();
695
+ return /* @__PURE__ */ jsx(Dialog.Description, {
696
+ className: cn$1(slots.description(), className),
697
+ ...props
698
+ });
699
+ };
700
+ const DrawerClose = ({ className, children, ...props }) => {
701
+ const { slots } = useDrawer();
702
+ return /* @__PURE__ */ jsx(Dialog.Close, {
703
+ className: cn$1(slots.close(), className),
704
+ ...props,
705
+ children: children ?? /* @__PURE__ */ jsx(LucideX, {})
706
+ });
707
+ };
708
+ Drawer.Root = Drawer;
709
+ Drawer.Trigger = DrawerTrigger;
710
+ Drawer.Portal = DrawerPortal;
711
+ Drawer.Backdrop = DrawerBackdrop;
712
+ Drawer.Viewport = DrawerViewport;
713
+ Drawer.Popup = DrawerPopup;
714
+ Drawer.Title = DrawerTitle;
715
+ Drawer.Description = DrawerDescription;
716
+ Drawer.Close = DrawerClose;
717
+ var drawer_default = Drawer;
718
+
608
719
  //#endregion
609
720
  //#region src/components/field/field.context.ts
610
721
  const FieldContext = createContext(null);
@@ -738,6 +849,28 @@ const Form = ({ className, ...props }) => {
738
849
  };
739
850
  var form_default = Form;
740
851
 
852
+ //#endregion
853
+ //#region src/components/icon-button/icon-button.variants.ts
854
+ const iconButtonVariants = tv({
855
+ base: "icon-button",
856
+ defaultVariants: { isIconOnly: true },
857
+ extend: buttonVariants
858
+ });
859
+
860
+ //#endregion
861
+ //#region src/components/icon-button/icon-button.tsx
862
+ const IconButton = ({ className, variant, size, isIconOnly, ...props }) => {
863
+ return /* @__PURE__ */ jsx(button_default, {
864
+ className: cn$1(className, iconButtonVariants({
865
+ isIconOnly,
866
+ size,
867
+ variant
868
+ })),
869
+ ...props
870
+ });
871
+ };
872
+ var icon_button_default = IconButton;
873
+
741
874
  //#endregion
742
875
  //#region src/components/input/input.variants.ts
743
876
  const inputVariants = tv({
@@ -1084,6 +1217,27 @@ Meter$1.Track = MeterTrack;
1084
1217
  Meter$1.Value = MeterValue;
1085
1218
  var meter_default = Meter$1;
1086
1219
 
1220
+ //#endregion
1221
+ //#region src/components/separator/separator.variants.ts
1222
+ const separatorVariants = tv({
1223
+ base: "separator",
1224
+ defaultVariants: { orientation: "horizontal" },
1225
+ variants: { orientation: {
1226
+ horizontal: "separator--horizontal",
1227
+ vertical: "separator--vertical"
1228
+ } }
1229
+ });
1230
+
1231
+ //#endregion
1232
+ //#region src/components/separator/separator.tsx
1233
+ const Separator$1 = ({ className, orientation, ...props }) => {
1234
+ return /* @__PURE__ */ jsx(Separator, {
1235
+ className: cn$1(className, separatorVariants({ orientation })),
1236
+ ...props
1237
+ });
1238
+ };
1239
+ var separator_default = Separator$1;
1240
+
1087
1241
  //#endregion
1088
1242
  //#region src/components/navbar/navbar.context.ts
1089
1243
  const NavbarContext = createContext(null);
@@ -1169,12 +1323,20 @@ const NavbarToggle = ({ className, ...props }) => {
1169
1323
  children: /* @__PURE__ */ jsx(Icon, { className: "size-5" })
1170
1324
  });
1171
1325
  };
1172
- const NavbarMenu = ({ className, ...props }) => {
1173
- const { slots, isOpen } = useNavbar();
1174
- return /* @__PURE__ */ jsx("ul", {
1175
- className: cn$1(slots.menu(), className),
1176
- "data-expanded": isOpen ? "true" : "false",
1177
- ...props
1326
+ const NavbarMenu = ({ className, header, ...props }) => {
1327
+ const { slots, isOpen, onOpenChange } = useNavbar();
1328
+ return /* @__PURE__ */ jsx(drawer_default, {
1329
+ onOpenChange,
1330
+ open: isOpen,
1331
+ children: /* @__PURE__ */ jsxs(drawer_default.Portal, { children: [/* @__PURE__ */ jsx(drawer_default.Backdrop, {}), /* @__PURE__ */ jsx(drawer_default.Viewport, { children: /* @__PURE__ */ jsxs(drawer_default.Popup, { children: [
1332
+ header,
1333
+ /* @__PURE__ */ jsx(drawer_default.Close, {}),
1334
+ /* @__PURE__ */ jsx(separator_default, {}),
1335
+ /* @__PURE__ */ jsx("ul", {
1336
+ className: cn$1(slots.menu(), className),
1337
+ ...props
1338
+ })
1339
+ ] }) })] })
1178
1340
  });
1179
1341
  };
1180
1342
  const NavbarMenuItem = ({ className, ...props }) => {
@@ -1194,6 +1356,125 @@ Navbar.Menu = NavbarMenu;
1194
1356
  Navbar.MenuItem = NavbarMenuItem;
1195
1357
  var navbar_default = Navbar;
1196
1358
 
1359
+ //#endregion
1360
+ //#region src/components/popover/popover.context.ts
1361
+ const PopoverContext = createContext(null);
1362
+
1363
+ //#endregion
1364
+ //#region src/components/popover/popover.variants.ts
1365
+ const popoverVariants = tv({ slots: {
1366
+ arrow: "popover__arrow",
1367
+ backdrop: "popover__backdrop",
1368
+ close: "popover__close",
1369
+ description: "popover__description",
1370
+ popup: "popover__popup",
1371
+ portal: "popover__portal",
1372
+ positioner: "popover__positioner",
1373
+ root: "popover",
1374
+ title: "popover__title",
1375
+ trigger: "popover__trigger",
1376
+ viewport: "popover__viewport"
1377
+ } });
1378
+
1379
+ //#endregion
1380
+ //#region src/components/popover/use-popover.ts
1381
+ const usePopover = () => {
1382
+ const context = useContext(PopoverContext);
1383
+ if (!context) throw new Error("usePopover must be used within a PopoverProvider");
1384
+ return context;
1385
+ };
1386
+
1387
+ //#endregion
1388
+ //#region src/components/popover/popover.tsx
1389
+ const Popover$1 = ({ ...props }) => {
1390
+ return /* @__PURE__ */ jsx(PopoverContext, {
1391
+ value: { slots: useMemo(() => popoverVariants(), []) },
1392
+ children: /* @__PURE__ */ jsx(Popover.Root, { ...props })
1393
+ });
1394
+ };
1395
+ const PopoverTrigger = ({ className, ...props }) => {
1396
+ const { slots } = usePopover();
1397
+ return /* @__PURE__ */ jsx(Popover.Trigger, {
1398
+ className: cn$1(slots.trigger(), className),
1399
+ ...props
1400
+ });
1401
+ };
1402
+ const PopoverPortal = ({ className, ...props }) => {
1403
+ const { slots } = usePopover();
1404
+ return /* @__PURE__ */ jsx(Popover.Portal, {
1405
+ className: cn$1(slots.portal(), className),
1406
+ ...props
1407
+ });
1408
+ };
1409
+ const PopoverBackdrop = ({ className, ...props }) => {
1410
+ const { slots } = usePopover();
1411
+ return /* @__PURE__ */ jsx(Popover.Backdrop, {
1412
+ className: cn$1(slots.backdrop(), className),
1413
+ ...props
1414
+ });
1415
+ };
1416
+ const PopoverPositioner = ({ className, ...props }) => {
1417
+ const { slots } = usePopover();
1418
+ return /* @__PURE__ */ jsx(Popover.Positioner, {
1419
+ className: cn$1(slots.positioner(), className),
1420
+ ...props
1421
+ });
1422
+ };
1423
+ const PopoverPopup = ({ className, ...props }) => {
1424
+ const { slots } = usePopover();
1425
+ return /* @__PURE__ */ jsx(Popover.Popup, {
1426
+ className: cn$1(slots.popup(), className),
1427
+ ...props
1428
+ });
1429
+ };
1430
+ const PopoverArrow = ({ className, ...props }) => {
1431
+ const { slots } = usePopover();
1432
+ return /* @__PURE__ */ jsx(Popover.Arrow, {
1433
+ className: cn$1(slots.arrow(), className),
1434
+ ...props
1435
+ });
1436
+ };
1437
+ const PopoverViewport = ({ className, ...props }) => {
1438
+ const { slots } = usePopover();
1439
+ return /* @__PURE__ */ jsx(Popover.Viewport, {
1440
+ className: cn$1(slots.viewport(), className),
1441
+ ...props
1442
+ });
1443
+ };
1444
+ const PopoverTitle = ({ className, ...props }) => {
1445
+ const { slots } = usePopover();
1446
+ return /* @__PURE__ */ jsx(Popover.Title, {
1447
+ className: cn$1(slots.title(), className),
1448
+ ...props
1449
+ });
1450
+ };
1451
+ const PopoverDescription = ({ className, ...props }) => {
1452
+ const { slots } = usePopover();
1453
+ return /* @__PURE__ */ jsx(Popover.Description, {
1454
+ className: cn$1(slots.description(), className),
1455
+ ...props
1456
+ });
1457
+ };
1458
+ const PopoverClose = ({ className, ...props }) => {
1459
+ const { slots } = usePopover();
1460
+ return /* @__PURE__ */ jsx(Popover.Close, {
1461
+ className: cn$1(slots.close(), className),
1462
+ ...props
1463
+ });
1464
+ };
1465
+ Popover$1.Root = Popover$1;
1466
+ Popover$1.Trigger = PopoverTrigger;
1467
+ Popover$1.Portal = PopoverPortal;
1468
+ Popover$1.Backdrop = PopoverBackdrop;
1469
+ Popover$1.Positioner = PopoverPositioner;
1470
+ Popover$1.Popup = PopoverPopup;
1471
+ Popover$1.Arrow = PopoverArrow;
1472
+ Popover$1.Viewport = PopoverViewport;
1473
+ Popover$1.Title = PopoverTitle;
1474
+ Popover$1.Description = PopoverDescription;
1475
+ Popover$1.Close = PopoverClose;
1476
+ var popover_default = Popover$1;
1477
+
1197
1478
  //#endregion
1198
1479
  //#region src/components/progress/progress.context.ts
1199
1480
  const ProgressContext = createContext(null);
@@ -1263,27 +1544,6 @@ Progress$1.Indicator = ProgressIndicator;
1263
1544
  Progress$1.Root = Progress$1;
1264
1545
  var progress_default = Progress$1;
1265
1546
 
1266
- //#endregion
1267
- //#region src/components/separator/separator.variants.ts
1268
- const separatorVariants = tv({
1269
- base: "separator",
1270
- defaultVariants: { orientation: "horizontal" },
1271
- variants: { orientation: {
1272
- horizontal: "separator--horizontal",
1273
- vertical: "separator--vertical"
1274
- } }
1275
- });
1276
-
1277
- //#endregion
1278
- //#region src/components/separator/separator.tsx
1279
- const Separator$1 = ({ className, orientation, ...props }) => {
1280
- return /* @__PURE__ */ jsx(Separator, {
1281
- className: cn$1(className, separatorVariants({ orientation })),
1282
- ...props
1283
- });
1284
- };
1285
- var separator_default = Separator$1;
1286
-
1287
1547
  //#endregion
1288
1548
  //#region src/components/slider/slider.context.ts
1289
1549
  const SliderContext = createContext(null);
@@ -1621,5 +1881,5 @@ const ToggleButton = ({ className, variant, size, ...props }) => {
1621
1881
  var toggle_button_default = ToggleButton;
1622
1882
 
1623
1883
  //#endregion
1624
- export { accordion_default as Accordion, alert_dialog_default as AlertDialog, avatar_default as Avatar, button_default as Button, button_group_default as ButtonGroup, card_default as Card, checkbox_default as Checkbox, checkbox_group_default as CheckboxGroup, chip_default as Chip, container_default as Container, dialog_default as Dialog, field_default as Field, fieldset_default as Fieldset, form_default as Form, input_default as Input, label_default as Label, link_default as Link, list_default as List, menu_default as Menu, meter_default as Meter, navbar_default as Navbar, progress_default as Progress, separator_default as Separator, slider_default as Slider, switch_default as Switch, table_default as Table, tabs_default as Tabs, text_default as Text, textarea_default as Textarea, toggle_button_default as ToggleButton, accordionVariants, alertDialogVariants, avatarVariants, buttonGroupVariants, buttonVariants, cardVariants, checkboxGroupVariants, checkboxVariants, chipVariants, cn, containerVariants, dialogVariants, fieldVariants, fieldsetVariants, formVariants, inputVariants, labelVariants, linkVariants, listVariants, menuVariants, meterVariants, navbarVariants, progressVariants, separatorVariants, sliderVariants, switchVariants, tableVariants, tabsVariants, textVariants, textareaVariants, toggleButtonVariants };
1884
+ export { accordion_default as Accordion, alert_dialog_default as AlertDialog, avatar_default as Avatar, button_default as Button, button_group_default as ButtonGroup, card_default as Card, checkbox_default as Checkbox, checkbox_group_default as CheckboxGroup, chip_default as Chip, container_default as Container, dialog_default as Dialog, drawer_default as Drawer, field_default as Field, fieldset_default as Fieldset, form_default as Form, icon_button_default as IconButton, input_default as Input, label_default as Label, link_default as Link, list_default as List, menu_default as Menu, meter_default as Meter, navbar_default as Navbar, popover_default as Popover, progress_default as Progress, separator_default as Separator, slider_default as Slider, switch_default as Switch, table_default as Table, tabs_default as Tabs, text_default as Text, textarea_default as Textarea, toggle_button_default as ToggleButton, accordionVariants, alertDialogVariants, avatarVariants, buttonGroupVariants, buttonVariants, cardVariants, checkboxGroupVariants, checkboxVariants, chipVariants, cn, containerVariants, dialogVariants, drawerVariants, fieldVariants, fieldsetVariants, formVariants, iconButtonVariants, inputVariants, labelVariants, linkVariants, listVariants, menuVariants, meterVariants, navbarVariants, popoverVariants, progressVariants, separatorVariants, sliderVariants, switchVariants, tableVariants, tabsVariants, textVariants, textareaVariants, toggleButtonVariants };
1625
1885
  //# sourceMappingURL=index.mjs.map