@motor-hero/ui-kit 0.26.0 → 0.27.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.
@@ -17,6 +17,13 @@ export interface BaseDialogProps {
17
17
  footer?: ReactNode;
18
18
  size?: BaseDialogSize;
19
19
  className?: string;
20
+ /**
21
+ * Radix `modal` for the underlying Dialog. Defaults to `!isDesktop`: on
22
+ * desktop the dialog is non-modal so a Combobox/Select popover (portaled
23
+ * outside the dialog) can receive focus and keystrokes; on mobile it stays
24
+ * modal so the bottom-sheet behaves. Pass explicitly to override.
25
+ */
26
+ modal?: boolean;
20
27
  /**
21
28
  * Advanced: wraps the dialog's inner content (header + body + footer) inside
22
29
  * Content. Used by FormDialog to inject a <form>. Defaults to identity.
@@ -33,6 +40,6 @@ export interface BaseDialogProps {
33
40
  * can persist after closing a dialog that contained a Select/Popover,
34
41
  * which would otherwise make the rest of the page unclickable.
35
42
  */
36
- export declare function BaseDialog({ open, onOpenChange, title, description, children, footer, size, className, contentWrapper, }: BaseDialogProps): React.JSX.Element;
43
+ export declare function BaseDialog({ open, onOpenChange, title, description, children, footer, size, className, modal, contentWrapper, }: BaseDialogProps): React.JSX.Element;
37
44
  export {};
38
45
  //# sourceMappingURL=base-dialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-dialog.d.ts","sourceRoot":"","sources":["../../src/components/base-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,QAAA,MAAM,WAAW;;;;;;CAMP,CAAA;AAEV,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,WAAW,CAAA;AAErD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,KAAK,EAAE,MAAM,CAAA;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AY,EACZ,KAAK,EACL,WAAW,EACX,QAAQ,EACR,MAAM,EACN,IAAW,EACX,SAAS,EACT,KAAK,EACL,cAAqC,GACtC,EAAE,eAAe,qBA+DjB"}
package/dist/index.cjs CHANGED
@@ -447,7 +447,24 @@ function FormField({ label, htmlFor, error, required, children, className }) {
447
447
  // src/components/base-dialog.tsx
448
448
  var Dialog = __toESM(require("@radix-ui/react-dialog"), 1);
449
449
  var import_lucide_react2 = require("lucide-react");
450
+ var React2 = __toESM(require("react"), 1);
451
+
452
+ // src/hooks/use-is-desktop.ts
450
453
  var React = __toESM(require("react"), 1);
454
+ var DESKTOP_QUERY = "(min-width: 640px)";
455
+ function useIsDesktop() {
456
+ const [isDesktop, setIsDesktop] = React.useState(
457
+ () => typeof window !== "undefined" ? window.matchMedia(DESKTOP_QUERY).matches : true
458
+ );
459
+ React.useEffect(() => {
460
+ const mql = window.matchMedia(DESKTOP_QUERY);
461
+ const onChange = () => setIsDesktop(mql.matches);
462
+ onChange();
463
+ mql.addEventListener("change", onChange);
464
+ return () => mql.removeEventListener("change", onChange);
465
+ }, []);
466
+ return isDesktop;
467
+ }
451
468
 
452
469
  // src/lib/utils.ts
453
470
  var import_clsx = require("clsx");
@@ -474,9 +491,11 @@ function BaseDialog({
474
491
  footer,
475
492
  size = "lg",
476
493
  className,
494
+ modal,
477
495
  contentWrapper = (content) => content
478
496
  }) {
479
- React.useEffect(() => {
497
+ const isDesktop = useIsDesktop();
498
+ React2.useEffect(() => {
480
499
  if (open) return;
481
500
  const id = window.setTimeout(() => {
482
501
  if (document.body.style.pointerEvents === "none") {
@@ -503,7 +522,7 @@ function BaseDialog({
503
522
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto px-6 py-4", children }),
504
523
  footer && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex shrink-0 flex-col-reverse gap-2 border-t px-6 py-3 sm:flex-row sm:justify-end", children: footer })
505
524
  ] });
506
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Dialog.Root, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Dialog.Portal, { children: [
525
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Dialog.Root, { open, onOpenChange, modal: modal ?? !isDesktop, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Dialog.Portal, { children: [
507
526
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Dialog.Overlay, { className: "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" }),
508
527
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
509
528
  Dialog.Content,
@@ -623,9 +642,9 @@ function TableSkeleton({ rows = 5, columns = 4 }) {
623
642
  }
624
643
 
625
644
  // src/components/search-input.tsx
626
- var React2 = __toESM(require("react"), 1);
645
+ var React3 = __toESM(require("react"), 1);
627
646
  var import_jsx_runtime15 = require("react/jsx-runtime");
628
- var SearchInput = React2.forwardRef(
647
+ var SearchInput = React3.forwardRef(
629
648
  ({ containerClassName, className, ...props }, ref) => {
630
649
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `relative flex-1 ${containerClassName ?? ""}`, children: [
631
650
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
@@ -663,10 +682,10 @@ SearchInput.displayName = "SearchInput";
663
682
 
664
683
  // src/components/password-input.tsx
665
684
  var import_lucide_react3 = require("lucide-react");
666
- var React3 = __toESM(require("react"), 1);
685
+ var React4 = __toESM(require("react"), 1);
667
686
  var import_jsx_runtime16 = require("react/jsx-runtime");
668
- var PasswordInput = React3.forwardRef(({ containerClassName, className, ...props }, ref) => {
669
- const [visible, setVisible] = React3.useState(false);
687
+ var PasswordInput = React4.forwardRef(({ containerClassName, className, ...props }, ref) => {
688
+ const [visible, setVisible] = React4.useState(false);
670
689
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `relative ${containerClassName ?? ""}`, children: [
671
690
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
672
691
  "input",
@@ -700,21 +719,21 @@ var React6 = __toESM(require("react"), 1);
700
719
  var import_vaul = require("vaul");
701
720
 
702
721
  // src/hooks/use-infinite-scroll-sentinel.ts
703
- var React4 = __toESM(require("react"), 1);
722
+ var React5 = __toESM(require("react"), 1);
704
723
  function useInfiniteScrollSentinel({
705
724
  enabled,
706
725
  loading,
707
726
  onLoadMore
708
727
  }) {
709
- const listRef = React4.useRef(null);
710
- const sentinelRef = React4.useRef(null);
711
- const loadingRef = React4.useRef(loading);
712
- const onLoadMoreRef = React4.useRef(onLoadMore);
713
- React4.useEffect(() => {
728
+ const listRef = React5.useRef(null);
729
+ const sentinelRef = React5.useRef(null);
730
+ const loadingRef = React5.useRef(loading);
731
+ const onLoadMoreRef = React5.useRef(onLoadMore);
732
+ React5.useEffect(() => {
714
733
  loadingRef.current = loading;
715
734
  onLoadMoreRef.current = onLoadMore;
716
735
  });
717
- React4.useEffect(() => {
736
+ React5.useEffect(() => {
718
737
  if (!enabled) return;
719
738
  const root = listRef.current;
720
739
  const sentinel = sentinelRef.current;
@@ -733,23 +752,6 @@ function useInfiniteScrollSentinel({
733
752
  return { listRef, sentinelRef };
734
753
  }
735
754
 
736
- // src/hooks/use-is-desktop.ts
737
- var React5 = __toESM(require("react"), 1);
738
- var DESKTOP_QUERY = "(min-width: 640px)";
739
- function useIsDesktop() {
740
- const [isDesktop, setIsDesktop] = React5.useState(
741
- () => typeof window !== "undefined" ? window.matchMedia(DESKTOP_QUERY).matches : true
742
- );
743
- React5.useEffect(() => {
744
- const mql = window.matchMedia(DESKTOP_QUERY);
745
- const onChange = () => setIsDesktop(mql.matches);
746
- onChange();
747
- mql.addEventListener("change", onChange);
748
- return () => mql.removeEventListener("change", onChange);
749
- }, []);
750
- return isDesktop;
751
- }
752
-
753
755
  // src/components/combobox.tsx
754
756
  var import_jsx_runtime17 = require("react/jsx-runtime");
755
757
  function Combobox({