@fea-ui/react 0.1.0-alpha.3 → 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);
@@ -710,6 +821,48 @@ Field.Label = FieldLabel;
710
821
  Field.Root = Field;
711
822
  var field_default = Field;
712
823
 
824
+ //#endregion
825
+ //#region src/components/fieldset/fieldset.context.ts
826
+ const FieldsetContext = (0, react.createContext)(null);
827
+
828
+ //#endregion
829
+ //#region src/components/fieldset/fieldset.variants.ts
830
+ const fieldsetVariants = (0, tailwind_variants.tv)({ slots: {
831
+ legend: "fieldset__legend",
832
+ root: "fieldset"
833
+ } });
834
+
835
+ //#endregion
836
+ //#region src/components/fieldset/use-fieldset.ts
837
+ const useFieldset = () => {
838
+ const context = (0, react.useContext)(FieldsetContext);
839
+ if (!context) throw new Error("useFieldset must be used within a FieldsetProvider");
840
+ return context;
841
+ };
842
+
843
+ //#endregion
844
+ //#region src/components/fieldset/fieldset.tsx
845
+ const Fieldset = ({ className, ...props }) => {
846
+ const slots = (0, react.useMemo)(() => fieldsetVariants(), []);
847
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldsetContext, {
848
+ value: { slots },
849
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react.Fieldset.Root, {
850
+ className: (0, tailwind_variants.cn)(className, slots.root()),
851
+ ...props
852
+ })
853
+ });
854
+ };
855
+ const FieldsetLegend = ({ className, ...props }) => {
856
+ const { slots } = useFieldset();
857
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react.Fieldset.Legend, {
858
+ className: (0, tailwind_variants.cn)(slots.legend(), className),
859
+ ...props
860
+ });
861
+ };
862
+ Fieldset.Root = Fieldset;
863
+ Fieldset.Legend = FieldsetLegend;
864
+ var fieldset_default = Fieldset;
865
+
713
866
  //#endregion
714
867
  //#region src/components/form/form.variants.ts
715
868
  const formVariants = (0, tailwind_variants.tv)({ base: "form" });
@@ -1070,6 +1223,27 @@ Meter.Track = MeterTrack;
1070
1223
  Meter.Value = MeterValue;
1071
1224
  var meter_default = Meter;
1072
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
+
1073
1247
  //#endregion
1074
1248
  //#region src/components/navbar/navbar.context.ts
1075
1249
  const NavbarContext = (0, react.createContext)(null);
@@ -1155,12 +1329,20 @@ const NavbarToggle = ({ className, ...props }) => {
1155
1329
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { className: "size-5" })
1156
1330
  });
1157
1331
  };
1158
- const NavbarMenu = ({ className, ...props }) => {
1159
- const { slots, isOpen } = useNavbar();
1160
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
1161
- className: (0, tailwind_variants.cn)(slots.menu(), className),
1162
- "data-expanded": isOpen ? "true" : "false",
1163
- ...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
+ ] }) })] })
1164
1346
  });
1165
1347
  };
1166
1348
  const NavbarMenuItem = ({ className, ...props }) => {
@@ -1249,27 +1431,6 @@ Progress.Indicator = ProgressIndicator;
1249
1431
  Progress.Root = Progress;
1250
1432
  var progress_default = Progress;
1251
1433
 
1252
- //#endregion
1253
- //#region src/components/separator/separator.variants.ts
1254
- const separatorVariants = (0, tailwind_variants.tv)({
1255
- base: "separator",
1256
- defaultVariants: { orientation: "horizontal" },
1257
- variants: { orientation: {
1258
- horizontal: "separator--horizontal",
1259
- vertical: "separator--vertical"
1260
- } }
1261
- });
1262
-
1263
- //#endregion
1264
- //#region src/components/separator/separator.tsx
1265
- const Separator = ({ className, orientation, ...props }) => {
1266
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react.Separator, {
1267
- className: (0, tailwind_variants.cn)(className, separatorVariants({ orientation })),
1268
- ...props
1269
- });
1270
- };
1271
- var separator_default = Separator;
1272
-
1273
1434
  //#endregion
1274
1435
  //#region src/components/slider/slider.context.ts
1275
1436
  const SliderContext = (0, react.createContext)(null);
@@ -1618,7 +1779,9 @@ exports.CheckboxGroup = checkbox_group_default;
1618
1779
  exports.Chip = chip_default;
1619
1780
  exports.Container = container_default;
1620
1781
  exports.Dialog = dialog_default;
1782
+ exports.Drawer = drawer_default;
1621
1783
  exports.Field = field_default;
1784
+ exports.Fieldset = fieldset_default;
1622
1785
  exports.Form = form_default;
1623
1786
  exports.Input = input_default;
1624
1787
  exports.Label = label_default;
@@ -1653,7 +1816,9 @@ Object.defineProperty(exports, 'cn', {
1653
1816
  });
1654
1817
  exports.containerVariants = containerVariants;
1655
1818
  exports.dialogVariants = dialogVariants;
1819
+ exports.drawerVariants = drawerVariants;
1656
1820
  exports.fieldVariants = fieldVariants;
1821
+ exports.fieldsetVariants = fieldsetVariants;
1657
1822
  exports.formVariants = formVariants;
1658
1823
  exports.inputVariants = inputVariants;
1659
1824
  exports.labelVariants = labelVariants;