@fea-ui/react 0.1.0-alpha.3 → 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);
@@ -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" });
@@ -1618,7 +1771,9 @@ exports.CheckboxGroup = checkbox_group_default;
1618
1771
  exports.Chip = chip_default;
1619
1772
  exports.Container = container_default;
1620
1773
  exports.Dialog = dialog_default;
1774
+ exports.Drawer = drawer_default;
1621
1775
  exports.Field = field_default;
1776
+ exports.Fieldset = fieldset_default;
1622
1777
  exports.Form = form_default;
1623
1778
  exports.Input = input_default;
1624
1779
  exports.Label = label_default;
@@ -1653,7 +1808,9 @@ Object.defineProperty(exports, 'cn', {
1653
1808
  });
1654
1809
  exports.containerVariants = containerVariants;
1655
1810
  exports.dialogVariants = dialogVariants;
1811
+ exports.drawerVariants = drawerVariants;
1656
1812
  exports.fieldVariants = fieldVariants;
1813
+ exports.fieldsetVariants = fieldsetVariants;
1657
1814
  exports.formVariants = formVariants;
1658
1815
  exports.inputVariants = inputVariants;
1659
1816
  exports.labelVariants = labelVariants;