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

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.d.mts CHANGED
@@ -729,6 +729,136 @@ interface DialogTitleProps extends Dialog$1.Title.Props {}
729
729
  interface DialogDescriptionProps extends Dialog$1.Description.Props {}
730
730
  interface DialogCloseProps extends Dialog$1.Close.Props {}
731
731
  //#endregion
732
+ //#region src/components/drawer/drawer.variants.d.ts
733
+ declare const drawerVariants: tailwind_variants0.TVReturnType<{
734
+ position: {
735
+ bottom: {
736
+ popup: string;
737
+ };
738
+ left: {
739
+ popup: string;
740
+ };
741
+ right: {
742
+ popup: string;
743
+ };
744
+ top: {
745
+ popup: string;
746
+ };
747
+ };
748
+ }, {
749
+ backdrop: string;
750
+ close: string;
751
+ description: string;
752
+ popup: string;
753
+ portal: string;
754
+ root: string;
755
+ title: string;
756
+ trigger: string;
757
+ viewport: string;
758
+ }, undefined, {
759
+ position: {
760
+ bottom: {
761
+ popup: string;
762
+ };
763
+ left: {
764
+ popup: string;
765
+ };
766
+ right: {
767
+ popup: string;
768
+ };
769
+ top: {
770
+ popup: string;
771
+ };
772
+ };
773
+ }, {
774
+ backdrop: string;
775
+ close: string;
776
+ description: string;
777
+ popup: string;
778
+ portal: string;
779
+ root: string;
780
+ title: string;
781
+ trigger: string;
782
+ viewport: string;
783
+ }, tailwind_variants0.TVReturnType<{
784
+ position: {
785
+ bottom: {
786
+ popup: string;
787
+ };
788
+ left: {
789
+ popup: string;
790
+ };
791
+ right: {
792
+ popup: string;
793
+ };
794
+ top: {
795
+ popup: string;
796
+ };
797
+ };
798
+ }, {
799
+ backdrop: string;
800
+ close: string;
801
+ description: string;
802
+ popup: string;
803
+ portal: string;
804
+ root: string;
805
+ title: string;
806
+ trigger: string;
807
+ viewport: string;
808
+ }, undefined, unknown, unknown, undefined>>;
809
+ type DrawerVariants = VariantProps<typeof drawerVariants>;
810
+ //#endregion
811
+ //#region src/components/drawer/drawer.d.ts
812
+ interface DrawerProps extends DrawerVariants, Dialog$1.Root.Props {}
813
+ declare const Drawer: {
814
+ ({
815
+ position,
816
+ ...props
817
+ }: DrawerProps): react_jsx_runtime0.JSX.Element;
818
+ Root: /*elided*/any;
819
+ Trigger: ({
820
+ className,
821
+ ...props
822
+ }: DrawerTriggerProps) => react_jsx_runtime0.JSX.Element;
823
+ Portal: ({
824
+ className,
825
+ ...props
826
+ }: DrawerPortalProps) => react_jsx_runtime0.JSX.Element;
827
+ Backdrop: ({
828
+ className,
829
+ ...props
830
+ }: DrawerBackdropProps) => react_jsx_runtime0.JSX.Element;
831
+ Viewport: ({
832
+ className,
833
+ ...props
834
+ }: DrawerViewportProps) => react_jsx_runtime0.JSX.Element;
835
+ Popup: ({
836
+ className,
837
+ ...props
838
+ }: DrawerPopupProps) => react_jsx_runtime0.JSX.Element;
839
+ Title: ({
840
+ className,
841
+ ...props
842
+ }: DrawerTitleProps) => react_jsx_runtime0.JSX.Element;
843
+ Description: ({
844
+ className,
845
+ ...props
846
+ }: DrawerDescriptionProps) => react_jsx_runtime0.JSX.Element;
847
+ Close: ({
848
+ className,
849
+ children,
850
+ ...props
851
+ }: DrawerCloseProps) => react_jsx_runtime0.JSX.Element;
852
+ };
853
+ interface DrawerTriggerProps extends Dialog$1.Trigger.Props {}
854
+ interface DrawerPortalProps extends Dialog$1.Portal.Props {}
855
+ interface DrawerBackdropProps extends Dialog$1.Backdrop.Props {}
856
+ interface DrawerViewportProps extends Dialog$1.Viewport.Props {}
857
+ interface DrawerPopupProps extends Dialog$1.Popup.Props {}
858
+ interface DrawerTitleProps extends Dialog$1.Title.Props {}
859
+ interface DrawerDescriptionProps extends Dialog$1.Description.Props {}
860
+ interface DrawerCloseProps extends Dialog$1.Close.Props {}
861
+ //#endregion
732
862
  //#region src/components/field/field.variants.d.ts
733
863
  declare const fieldVariants: tailwind_variants0.TVReturnType<{
734
864
  size: {
@@ -1433,6 +1563,7 @@ declare const Navbar: {
1433
1563
  }: NavbarToggleProps) => react_jsx_runtime0.JSX.Element;
1434
1564
  Menu: ({
1435
1565
  className,
1566
+ header,
1436
1567
  ...props
1437
1568
  }: NavbarMenuProps) => react_jsx_runtime0.JSX.Element;
1438
1569
  MenuItem: ({
@@ -1445,7 +1576,9 @@ interface NavbarContentProps extends React.ComponentProps<"div"> {}
1445
1576
  interface NavbarListProps extends React.ComponentProps<"ul"> {}
1446
1577
  interface NavbarListItemProps extends React.ComponentProps<"li"> {}
1447
1578
  interface NavbarToggleProps extends React.ComponentProps<"button"> {}
1448
- interface NavbarMenuProps extends React.ComponentProps<"ul"> {}
1579
+ interface NavbarMenuProps extends React.ComponentProps<"ul"> {
1580
+ header: React.ReactNode;
1581
+ }
1449
1582
  interface NavbarMenuItemProps extends React.ComponentProps<"li"> {}
1450
1583
  //#endregion
1451
1584
  //#region src/components/progress/progress.variants.d.ts
@@ -2060,5 +2193,5 @@ declare const ToggleButton: ({
2060
2193
  ...props
2061
2194
  }: ToggleButtonProps) => react_jsx_runtime0.JSX.Element;
2062
2195
  //#endregion
2063
- export { Accordion, AccordionVariants, AlertDialog, AlertDialogVariants, Avatar, AvatarVariants, Button, ButtonGroup, ButtonGroupVariants, ButtonVariants, Card, CardVariants, Checkbox, CheckboxGroup, CheckboxGroupVariants, CheckboxVariants, Chip, ChipVariants, Container, ContainerVariants, Dialog, DialogVariants, Field, FieldVariants, Fieldset, FieldsetVariants, Form, FormVariants, Input, InputVariants, Label, LabelVariants, Link, LinkVariants, List, ListVariants, Menu, MenuVariants, Meter, MeterVariants, Navbar, NavbarVariants, Progress, ProgressVariants, Separator, SeparatorVariants, Slider, SliderVariants, Switch, SwitchVariants, Table, TableVariants, Tabs, TabsVariants, Text, TextVariants, Textarea, TextareaVariants, ToggleButton, ToggleButtonVariants, 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 };
2196
+ export { Accordion, AccordionVariants, AlertDialog, AlertDialogVariants, Avatar, AvatarVariants, Button, ButtonGroup, ButtonGroupVariants, ButtonVariants, Card, CardVariants, Checkbox, CheckboxGroup, CheckboxGroupVariants, CheckboxVariants, Chip, ChipVariants, Container, ContainerVariants, Dialog, DialogVariants, Drawer, DrawerVariants, Field, FieldVariants, Fieldset, FieldsetVariants, Form, FormVariants, Input, InputVariants, Label, LabelVariants, Link, LinkVariants, List, ListVariants, Menu, MenuVariants, Meter, MeterVariants, Navbar, NavbarVariants, Progress, ProgressVariants, Separator, SeparatorVariants, Slider, SliderVariants, Switch, SwitchVariants, Table, TableVariants, Tabs, TabsVariants, Text, TextVariants, Textarea, TextareaVariants, ToggleButton, ToggleButtonVariants, accordionVariants, alertDialogVariants, avatarVariants, buttonGroupVariants, buttonVariants, cardVariants, checkboxGroupVariants, checkboxVariants, chipVariants, cn, containerVariants, dialogVariants, drawerVariants, fieldVariants, fieldsetVariants, formVariants, inputVariants, labelVariants, linkVariants, listVariants, menuVariants, meterVariants, navbarVariants, progressVariants, separatorVariants, sliderVariants, switchVariants, tableVariants, tabsVariants, textVariants, textareaVariants, toggleButtonVariants };
2064
2197
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import { cn, cn as cn$1, tv } from "tailwind-variants";
2
2
  import { Accordion, AlertDialog, Avatar, Button, Checkbox, CheckboxGroup, Dialog, Field, Fieldset, Input, Menu, Meter, 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);
@@ -1084,6 +1195,27 @@ Meter$1.Track = MeterTrack;
1084
1195
  Meter$1.Value = MeterValue;
1085
1196
  var meter_default = Meter$1;
1086
1197
 
1198
+ //#endregion
1199
+ //#region src/components/separator/separator.variants.ts
1200
+ const separatorVariants = tv({
1201
+ base: "separator",
1202
+ defaultVariants: { orientation: "horizontal" },
1203
+ variants: { orientation: {
1204
+ horizontal: "separator--horizontal",
1205
+ vertical: "separator--vertical"
1206
+ } }
1207
+ });
1208
+
1209
+ //#endregion
1210
+ //#region src/components/separator/separator.tsx
1211
+ const Separator$1 = ({ className, orientation, ...props }) => {
1212
+ return /* @__PURE__ */ jsx(Separator, {
1213
+ className: cn$1(className, separatorVariants({ orientation })),
1214
+ ...props
1215
+ });
1216
+ };
1217
+ var separator_default = Separator$1;
1218
+
1087
1219
  //#endregion
1088
1220
  //#region src/components/navbar/navbar.context.ts
1089
1221
  const NavbarContext = createContext(null);
@@ -1169,12 +1301,20 @@ const NavbarToggle = ({ className, ...props }) => {
1169
1301
  children: /* @__PURE__ */ jsx(Icon, { className: "size-5" })
1170
1302
  });
1171
1303
  };
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
1304
+ const NavbarMenu = ({ className, header, ...props }) => {
1305
+ const { slots, isOpen, onOpenChange } = useNavbar();
1306
+ return /* @__PURE__ */ jsx(drawer_default, {
1307
+ onOpenChange,
1308
+ open: isOpen,
1309
+ children: /* @__PURE__ */ jsxs(drawer_default.Portal, { children: [/* @__PURE__ */ jsx(drawer_default.Backdrop, {}), /* @__PURE__ */ jsx(drawer_default.Viewport, { children: /* @__PURE__ */ jsxs(drawer_default.Popup, { children: [
1310
+ header,
1311
+ /* @__PURE__ */ jsx(drawer_default.Close, {}),
1312
+ /* @__PURE__ */ jsx(separator_default, {}),
1313
+ /* @__PURE__ */ jsx("ul", {
1314
+ className: cn$1(slots.menu(), className),
1315
+ ...props
1316
+ })
1317
+ ] }) })] })
1178
1318
  });
1179
1319
  };
1180
1320
  const NavbarMenuItem = ({ className, ...props }) => {
@@ -1263,27 +1403,6 @@ Progress$1.Indicator = ProgressIndicator;
1263
1403
  Progress$1.Root = Progress$1;
1264
1404
  var progress_default = Progress$1;
1265
1405
 
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
1406
  //#endregion
1288
1407
  //#region src/components/slider/slider.context.ts
1289
1408
  const SliderContext = createContext(null);
@@ -1621,5 +1740,5 @@ const ToggleButton = ({ className, variant, size, ...props }) => {
1621
1740
  var toggle_button_default = ToggleButton;
1622
1741
 
1623
1742
  //#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 };
1743
+ 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, 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, drawerVariants, fieldVariants, fieldsetVariants, formVariants, inputVariants, labelVariants, linkVariants, listVariants, menuVariants, meterVariants, navbarVariants, progressVariants, separatorVariants, sliderVariants, switchVariants, tableVariants, tabsVariants, textVariants, textareaVariants, toggleButtonVariants };
1625
1744
  //# sourceMappingURL=index.mjs.map