@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.cjs CHANGED
@@ -633,6 +633,117 @@ Dialog.Trigger = DialogTrigger;
633
633
  Dialog.Viewport = DialogViewport;
634
634
  var dialog_default = Dialog;
635
635
 
636
+ //#endregion
637
+ //#region src/components/drawer/drawer.context.ts
638
+ const DrawerContext = (0, react.createContext)(null);
639
+
640
+ //#endregion
641
+ //#region src/components/drawer/drawer.variants.ts
642
+ const drawerVariants = (0, tailwind_variants.tv)({
643
+ defaultVariants: { position: "left" },
644
+ slots: {
645
+ backdrop: "drawer__backdrop",
646
+ close: "drawer__close",
647
+ description: "drawer__description",
648
+ popup: "drawer__popup",
649
+ portal: "drawer__portal",
650
+ root: "drawer",
651
+ title: "drawer__title",
652
+ trigger: "drawer__trigger",
653
+ viewport: "drawer__viewport"
654
+ },
655
+ variants: { position: {
656
+ bottom: { popup: "drawer--bottom" },
657
+ left: { popup: "drawer--left" },
658
+ right: { popup: "drawer--right" },
659
+ top: { popup: "drawer--top" }
660
+ } }
661
+ });
662
+
663
+ //#endregion
664
+ //#region src/components/drawer/use-drawer.ts
665
+ const useDrawer = () => {
666
+ const context = (0, react.useContext)(DrawerContext);
667
+ if (!context) throw new Error("useDrawer must be used within a DrawerProvider");
668
+ return context;
669
+ };
670
+
671
+ //#endregion
672
+ //#region src/components/drawer/drawer.tsx
673
+ const Drawer = ({ position, ...props }) => {
674
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DrawerContext, {
675
+ value: { slots: (0, react.useMemo)(() => drawerVariants({ position }), [position]) },
676
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react.Dialog.Root, { ...props })
677
+ });
678
+ };
679
+ const DrawerTrigger = ({ className, ...props }) => {
680
+ const { slots } = useDrawer();
681
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react.Dialog.Trigger, {
682
+ className: (0, tailwind_variants.cn)(slots.trigger(), className),
683
+ ...props
684
+ });
685
+ };
686
+ const DrawerPortal = ({ className, ...props }) => {
687
+ const { slots } = useDrawer();
688
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react.Dialog.Portal, {
689
+ className: (0, tailwind_variants.cn)(slots.portal(), className),
690
+ ...props
691
+ });
692
+ };
693
+ const DrawerBackdrop = ({ className, ...props }) => {
694
+ const { slots } = useDrawer();
695
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react.Dialog.Backdrop, {
696
+ className: (0, tailwind_variants.cn)(slots.backdrop(), className),
697
+ ...props
698
+ });
699
+ };
700
+ const DrawerViewport = ({ className, ...props }) => {
701
+ const { slots } = useDrawer();
702
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react.Dialog.Viewport, {
703
+ className: (0, tailwind_variants.cn)(slots.viewport(), className),
704
+ ...props
705
+ });
706
+ };
707
+ const DrawerPopup = ({ className, ...props }) => {
708
+ const { slots } = useDrawer();
709
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react.Dialog.Popup, {
710
+ className: (0, tailwind_variants.cn)(slots.popup(), className),
711
+ ...props
712
+ });
713
+ };
714
+ const DrawerTitle = ({ className, ...props }) => {
715
+ const { slots } = useDrawer();
716
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react.Dialog.Title, {
717
+ className: (0, tailwind_variants.cn)(slots.title(), className),
718
+ ...props
719
+ });
720
+ };
721
+ const DrawerDescription = ({ className, ...props }) => {
722
+ const { slots } = useDrawer();
723
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react.Dialog.Description, {
724
+ className: (0, tailwind_variants.cn)(slots.description(), className),
725
+ ...props
726
+ });
727
+ };
728
+ const DrawerClose = ({ className, children, ...props }) => {
729
+ const { slots } = useDrawer();
730
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react.Dialog.Close, {
731
+ className: (0, tailwind_variants.cn)(slots.close(), className),
732
+ ...props,
733
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.LucideX, {})
734
+ });
735
+ };
736
+ Drawer.Root = Drawer;
737
+ Drawer.Trigger = DrawerTrigger;
738
+ Drawer.Portal = DrawerPortal;
739
+ Drawer.Backdrop = DrawerBackdrop;
740
+ Drawer.Viewport = DrawerViewport;
741
+ Drawer.Popup = DrawerPopup;
742
+ Drawer.Title = DrawerTitle;
743
+ Drawer.Description = DrawerDescription;
744
+ Drawer.Close = DrawerClose;
745
+ var drawer_default = Drawer;
746
+
636
747
  //#endregion
637
748
  //#region src/components/field/field.context.ts
638
749
  const FieldContext = (0, react.createContext)(null);
@@ -1112,6 +1223,27 @@ Meter.Track = MeterTrack;
1112
1223
  Meter.Value = MeterValue;
1113
1224
  var meter_default = Meter;
1114
1225
 
1226
+ //#endregion
1227
+ //#region src/components/separator/separator.variants.ts
1228
+ const separatorVariants = (0, tailwind_variants.tv)({
1229
+ base: "separator",
1230
+ defaultVariants: { orientation: "horizontal" },
1231
+ variants: { orientation: {
1232
+ horizontal: "separator--horizontal",
1233
+ vertical: "separator--vertical"
1234
+ } }
1235
+ });
1236
+
1237
+ //#endregion
1238
+ //#region src/components/separator/separator.tsx
1239
+ const Separator = ({ className, orientation, ...props }) => {
1240
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react.Separator, {
1241
+ className: (0, tailwind_variants.cn)(className, separatorVariants({ orientation })),
1242
+ ...props
1243
+ });
1244
+ };
1245
+ var separator_default = Separator;
1246
+
1115
1247
  //#endregion
1116
1248
  //#region src/components/navbar/navbar.context.ts
1117
1249
  const NavbarContext = (0, react.createContext)(null);
@@ -1197,12 +1329,20 @@ const NavbarToggle = ({ className, ...props }) => {
1197
1329
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { className: "size-5" })
1198
1330
  });
1199
1331
  };
1200
- const NavbarMenu = ({ className, ...props }) => {
1201
- const { slots, isOpen } = useNavbar();
1202
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
1203
- className: (0, tailwind_variants.cn)(slots.menu(), className),
1204
- "data-expanded": isOpen ? "true" : "false",
1205
- ...props
1332
+ const NavbarMenu = ({ className, header, ...props }) => {
1333
+ const { slots, isOpen, onOpenChange } = useNavbar();
1334
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(drawer_default, {
1335
+ onOpenChange,
1336
+ open: isOpen,
1337
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(drawer_default.Portal, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(drawer_default.Backdrop, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(drawer_default.Viewport, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(drawer_default.Popup, { children: [
1338
+ header,
1339
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(drawer_default.Close, {}),
1340
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(separator_default, {}),
1341
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
1342
+ className: (0, tailwind_variants.cn)(slots.menu(), className),
1343
+ ...props
1344
+ })
1345
+ ] }) })] })
1206
1346
  });
1207
1347
  };
1208
1348
  const NavbarMenuItem = ({ className, ...props }) => {
@@ -1291,27 +1431,6 @@ Progress.Indicator = ProgressIndicator;
1291
1431
  Progress.Root = Progress;
1292
1432
  var progress_default = Progress;
1293
1433
 
1294
- //#endregion
1295
- //#region src/components/separator/separator.variants.ts
1296
- const separatorVariants = (0, tailwind_variants.tv)({
1297
- base: "separator",
1298
- defaultVariants: { orientation: "horizontal" },
1299
- variants: { orientation: {
1300
- horizontal: "separator--horizontal",
1301
- vertical: "separator--vertical"
1302
- } }
1303
- });
1304
-
1305
- //#endregion
1306
- //#region src/components/separator/separator.tsx
1307
- const Separator = ({ className, orientation, ...props }) => {
1308
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react.Separator, {
1309
- className: (0, tailwind_variants.cn)(className, separatorVariants({ orientation })),
1310
- ...props
1311
- });
1312
- };
1313
- var separator_default = Separator;
1314
-
1315
1434
  //#endregion
1316
1435
  //#region src/components/slider/slider.context.ts
1317
1436
  const SliderContext = (0, react.createContext)(null);
@@ -1660,6 +1779,7 @@ exports.CheckboxGroup = checkbox_group_default;
1660
1779
  exports.Chip = chip_default;
1661
1780
  exports.Container = container_default;
1662
1781
  exports.Dialog = dialog_default;
1782
+ exports.Drawer = drawer_default;
1663
1783
  exports.Field = field_default;
1664
1784
  exports.Fieldset = fieldset_default;
1665
1785
  exports.Form = form_default;
@@ -1696,6 +1816,7 @@ Object.defineProperty(exports, 'cn', {
1696
1816
  });
1697
1817
  exports.containerVariants = containerVariants;
1698
1818
  exports.dialogVariants = dialogVariants;
1819
+ exports.drawerVariants = drawerVariants;
1699
1820
  exports.fieldVariants = fieldVariants;
1700
1821
  exports.fieldsetVariants = fieldsetVariants;
1701
1822
  exports.formVariants = formVariants;