@aortl/admin-react 0.1.0 → 0.3.0

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
@@ -11,6 +11,7 @@ let _base_ui_react_switch = require("@base-ui/react/switch");
11
11
  let _base_ui_react_select = require("@base-ui/react/select");
12
12
  let _base_ui_react_field = require("@base-ui/react/field");
13
13
  let _base_ui_react_tabs = require("@base-ui/react/tabs");
14
+ let _base_ui_react_tooltip = require("@base-ui/react/tooltip");
14
15
  let _base_ui_react_dialog = require("@base-ui/react/dialog");
15
16
  //#region src/Accordion.tsx
16
17
  function AccordionRoot({ className, ...rest }) {
@@ -712,6 +713,131 @@ var Card = Object.assign(CardRoot, {
712
713
  Actions: CardActions
713
714
  });
714
715
  //#endregion
716
+ //#region src/Dialog.tsx
717
+ var DialogContext = (0, react.createContext)(null);
718
+ function DefaultCloseIcon() {
719
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
720
+ width: "16",
721
+ height: "16",
722
+ viewBox: "0 0 24 24",
723
+ fill: "none",
724
+ stroke: "currentColor",
725
+ strokeWidth: "2",
726
+ strokeLinecap: "round",
727
+ strokeLinejoin: "round",
728
+ "aria-hidden": "true",
729
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M18 6 6 18" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m6 6 12 12" })]
730
+ });
731
+ }
732
+ /**
733
+ * The bare `<dialog>` primitive — no opinions about header, body, or footer.
734
+ * Use this when the default `<Dialog>` layout doesn't fit (custom header,
735
+ * media block, multi-step content).
736
+ */
737
+ function DialogContainer({ open, onOpenChange, size = "md", closedby = "any", className, children, ...rest }) {
738
+ const ref = (0, react.useRef)(null);
739
+ const onOpenChangeRef = (0, react.useRef)(onOpenChange);
740
+ onOpenChangeRef.current = onOpenChange;
741
+ (0, react.useEffect)(() => {
742
+ const el = ref.current;
743
+ if (!el || open === void 0) return;
744
+ if (open && !el.open) el.showModal();
745
+ else if (!open && el.open) el.close();
746
+ }, [open]);
747
+ (0, react.useEffect)(() => {
748
+ const el = ref.current;
749
+ if (!el) return;
750
+ const handleClose = () => onOpenChangeRef.current?.(false);
751
+ el.addEventListener("close", handleClose);
752
+ return () => el.removeEventListener("close", handleClose);
753
+ }, []);
754
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogContext.Provider, {
755
+ value: { close: () => ref.current?.close() },
756
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dialog", {
757
+ ref,
758
+ className: (0, clsx.clsx)("dialog", size !== "md" && `dialog-${size}`, className),
759
+ closedby,
760
+ ...rest,
761
+ children
762
+ })
763
+ });
764
+ }
765
+ function DialogHeader({ className, ...rest }) {
766
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
767
+ className: (0, clsx.clsx)("dialog-header", className),
768
+ ...rest
769
+ });
770
+ }
771
+ function DialogTitle({ icon, className, children, ...rest }) {
772
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h2", {
773
+ className: (0, clsx.clsx)("dialog-title", className),
774
+ ...rest,
775
+ children: [renderIcon(icon), children]
776
+ });
777
+ }
778
+ function DialogDescription({ className, ...rest }) {
779
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
780
+ className: (0, clsx.clsx)("dialog-description", className),
781
+ ...rest
782
+ });
783
+ }
784
+ function DialogBody({ className, ...rest }) {
785
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
786
+ className: (0, clsx.clsx)("dialog-body", className),
787
+ ...rest
788
+ });
789
+ }
790
+ function DialogFooter({ className, ...rest }) {
791
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
792
+ className: (0, clsx.clsx)("dialog-footer", className),
793
+ ...rest
794
+ });
795
+ }
796
+ function DialogCloseButton({ icon, className, children, onClick, type = "button", "aria-label": ariaLabel = "Close", ...rest }) {
797
+ const ctx = (0, react.useContext)(DialogContext);
798
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
799
+ type,
800
+ className: (0, clsx.clsx)("dialog-close", className),
801
+ "aria-label": ariaLabel,
802
+ onClick: (event) => {
803
+ onClick?.(event);
804
+ if (!event.defaultPrevented) ctx?.close();
805
+ },
806
+ ...rest,
807
+ children: children ?? (icon !== void 0 ? renderIcon(icon) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefaultCloseIcon, {}))
808
+ });
809
+ }
810
+ /**
811
+ * Standard modal: a `<dialog>` with an opinionated header / body / footer
812
+ * layout driven by shorthand props. For anything outside that shape, use
813
+ * `<Dialog.Container>` and compose by hand.
814
+ */
815
+ function DialogRoot({ icon, title, description, actions, dismissible = true, closeLabel = "Close", children, ...containerProps }) {
816
+ const hasTitle = title !== void 0 || icon !== void 0;
817
+ const showHeader = hasTitle || dismissible;
818
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DialogContainer, {
819
+ ...containerProps,
820
+ children: [
821
+ showHeader ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DialogHeader, { children: [hasTitle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogTitle, {
822
+ icon,
823
+ children: title
824
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "flex-1" }), dismissible ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogCloseButton, { "aria-label": closeLabel }) : null] }) : null,
825
+ description !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogDescription, { children: description }) : null,
826
+ children !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogBody, { children }) : null,
827
+ actions !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogFooter, { children: actions }) : null
828
+ ]
829
+ });
830
+ }
831
+ var Dialog = Object.assign(DialogRoot, {
832
+ Container: DialogContainer,
833
+ Header: DialogHeader,
834
+ Title: DialogTitle,
835
+ Description: DialogDescription,
836
+ Body: DialogBody,
837
+ Footer: DialogFooter,
838
+ CloseButton: DialogCloseButton
839
+ });
840
+ //#endregion
715
841
  //#region src/Field.tsx
716
842
  function FieldRoot({ className, ...rest }) {
717
843
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_field.Field.Root, {
@@ -950,6 +1076,48 @@ var Tabs = Object.assign(TabsRoot, {
950
1076
  Indicator: TabsIndicator
951
1077
  });
952
1078
  //#endregion
1079
+ //#region src/Tooltip.tsx
1080
+ function TooltipProvider(props) {
1081
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_tooltip.Tooltip.Provider, { ...props });
1082
+ }
1083
+ function TooltipRoot(props) {
1084
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_tooltip.Tooltip.Root, { ...props });
1085
+ }
1086
+ function TooltipTrigger(props) {
1087
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_tooltip.Tooltip.Trigger, { ...props });
1088
+ }
1089
+ function TooltipPopup({ size = "md", side = "top", align = "center", sideOffset = 6, role = "tooltip", className, children, ...rest }) {
1090
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_tooltip.Tooltip.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_tooltip.Tooltip.Positioner, {
1091
+ sideOffset,
1092
+ side,
1093
+ align,
1094
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_tooltip.Tooltip.Popup, {
1095
+ role,
1096
+ className: cn(["tooltip", size !== "md" && `tooltip-${size}`], className),
1097
+ ...rest,
1098
+ children
1099
+ })
1100
+ }) });
1101
+ }
1102
+ function TooltipShorthand({ content, side, align, sideOffset, size, children, ...rootProps }) {
1103
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(TooltipRoot, {
1104
+ ...rootProps,
1105
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_tooltip.Tooltip.Trigger, { render: children }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipPopup, {
1106
+ side,
1107
+ align,
1108
+ sideOffset,
1109
+ size,
1110
+ children: content
1111
+ })]
1112
+ });
1113
+ }
1114
+ var Tooltip = Object.assign(TooltipShorthand, {
1115
+ Provider: TooltipProvider,
1116
+ Root: TooltipRoot,
1117
+ Trigger: TooltipTrigger,
1118
+ Popup: TooltipPopup
1119
+ });
1120
+ //#endregion
953
1121
  //#region src/Table.tsx
954
1122
  function TableRoot({ striped, bordered, relaxed, sticky, className, ...rest }) {
955
1123
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("table", {
@@ -1180,6 +1348,7 @@ exports.Button = Button;
1180
1348
  exports.ButtonGroup = ButtonGroup;
1181
1349
  exports.Card = Card;
1182
1350
  exports.Checkbox = Checkbox;
1351
+ exports.Dialog = Dialog;
1183
1352
  exports.Field = Field;
1184
1353
  exports.FileInput = FileInput;
1185
1354
  exports.Footer = Footer;
@@ -1198,6 +1367,7 @@ exports.Switch = Switch;
1198
1367
  exports.Table = Table;
1199
1368
  exports.Tabs = Tabs;
1200
1369
  exports.Textarea = Textarea;
1370
+ exports.Tooltip = Tooltip;
1201
1371
  exports.getPaginationItems = getPaginationItems;
1202
1372
  exports.useAppShell = useAppShell;
1203
1373