@fea-ui/react 0.1.0-alpha.4 → 1.0.0-alpha.5

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);
@@ -1660,6 +1771,7 @@ exports.CheckboxGroup = checkbox_group_default;
1660
1771
  exports.Chip = chip_default;
1661
1772
  exports.Container = container_default;
1662
1773
  exports.Dialog = dialog_default;
1774
+ exports.Drawer = drawer_default;
1663
1775
  exports.Field = field_default;
1664
1776
  exports.Fieldset = fieldset_default;
1665
1777
  exports.Form = form_default;
@@ -1696,6 +1808,7 @@ Object.defineProperty(exports, 'cn', {
1696
1808
  });
1697
1809
  exports.containerVariants = containerVariants;
1698
1810
  exports.dialogVariants = dialogVariants;
1811
+ exports.drawerVariants = drawerVariants;
1699
1812
  exports.fieldVariants = fieldVariants;
1700
1813
  exports.fieldsetVariants = fieldsetVariants;
1701
1814
  exports.formVariants = formVariants;