@runlume/admin-ui 0.2.2 → 0.2.3

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.
Files changed (46) hide show
  1. package/README.en.md +40 -0
  2. package/README.md +34 -0
  3. package/dist-package/components/calendar.cjs +1 -1
  4. package/dist-package/components/calendar.d.ts.map +1 -1
  5. package/dist-package/components/calendar.js +1 -1
  6. package/dist-package/components/charts.cjs +1 -1
  7. package/dist-package/components/charts.d.ts.map +1 -1
  8. package/dist-package/components/charts.js +3 -2
  9. package/dist-package/components/rate.cjs +1 -1
  10. package/dist-package/components/rate.d.ts.map +1 -1
  11. package/dist-package/components/rate.js +13 -11
  12. package/dist-package/components/transfer.cjs +1 -1
  13. package/dist-package/components/transfer.d.ts.map +1 -1
  14. package/dist-package/components/transfer.js +2 -1
  15. package/dist-package/components/ui/alert-dialog.cjs +1 -1
  16. package/dist-package/components/ui/alert-dialog.d.ts +1 -1
  17. package/dist-package/components/ui/alert-dialog.d.ts.map +1 -1
  18. package/dist-package/components/ui/alert-dialog.js +42 -39
  19. package/dist-package/components/ui/context-menu.cjs +1 -1
  20. package/dist-package/components/ui/context-menu.d.ts +7 -6
  21. package/dist-package/components/ui/context-menu.d.ts.map +1 -1
  22. package/dist-package/components/ui/context-menu.js +28 -24
  23. package/dist-package/components/ui/dialog.cjs +1 -1
  24. package/dist-package/components/ui/dialog.d.ts +1 -1
  25. package/dist-package/components/ui/dialog.d.ts.map +1 -1
  26. package/dist-package/components/ui/dialog.js +85 -84
  27. package/dist-package/components/ui/dropdown-menu.cjs +1 -1
  28. package/dist-package/components/ui/dropdown-menu.d.ts +2 -2
  29. package/dist-package/components/ui/dropdown-menu.d.ts.map +1 -1
  30. package/dist-package/components/ui/dropdown-menu.js +74 -69
  31. package/dist-package/components/ui/native-select.cjs +1 -1
  32. package/dist-package/components/ui/native-select.d.ts.map +1 -1
  33. package/dist-package/components/ui/native-select.js +73 -70
  34. package/dist-package/components/ui/scroll-area.cjs +1 -1
  35. package/dist-package/components/ui/scroll-area.d.ts.map +1 -1
  36. package/dist-package/components/ui/scroll-area.js +1 -0
  37. package/dist-package/components/ui/sheet.cjs +1 -1
  38. package/dist-package/components/ui/sheet.d.ts +1 -1
  39. package/dist-package/components/ui/sheet.d.ts.map +1 -1
  40. package/dist-package/components/ui/sheet.js +45 -42
  41. package/dist-package/lib/overlay-suppression.cjs +1 -0
  42. package/dist-package/lib/overlay-suppression.d.ts +25 -0
  43. package/dist-package/lib/overlay-suppression.d.ts.map +1 -0
  44. package/dist-package/lib/overlay-suppression.js +36 -0
  45. package/dist-package/styles.css +1 -1
  46. package/package.json +5 -4
@@ -1 +1 @@
1
- const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("radix-ui"),i=require("lucide-react"),a=require("react/jsx-runtime");function o(e,t,r=!1){return n.Children.toArray(e).flatMap(e=>n.isValidElement(e)?e.type===n.Fragment?o(e.props.children,t,r):e.type===`optgroup`||e.type===l?o(e.props.children,e.props.label,e.props.disabled):[{value:String(e.props.value??e.props.children??``),label:e.props.children,disabled:r||e.props.disabled,group:t}]:[])}function s({className:e,size:s=`default`,children:c,value:l,defaultValue:u,onChange:d,ref:f,id:p,name:m,disabled:h,required:g,onInvalid:_,...v}){let y=o(c),b=String(u??y.find(e=>!e.disabled)?.value??``),[x,S]=n.useState(b),C=l===void 0?x:String(l),w=y.findIndex(e=>e.value===C),T=w>=0?w:y.findIndex(e=>!e.disabled),E=y[T]?.value??``,D=n.useRef(l===void 0?b:E);n.useLayoutEffect(()=>{D.current=l===void 0?b:E},[l,b,E]);let O=n.useRef(!1),k=n.useRef(null),A=n.useRef(null);n.useImperativeHandle(f,()=>k.current),n.useEffect(()=>{let e=k.current;e.focus=e=>A.current?.focus(e);let t=t=>{O.current=!0,queueMicrotask(()=>{t.defaultPrevented||(S(b),e.value=D.current),O.current=!1})},n=e.form;return n?.addEventListener(`reset`,t,!0),()=>n?.removeEventListener(`reset`,t,!0)},[b]);function j(e){if(O.current||e===``||y[Number(e)]?.value===E)return;let t=k.current,n=y[Number(e)]?.value;n!==void 0&&(Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,`value`).set.call(t,n),t.dispatchEvent(new Event(`change`,{bubbles:!0})))}return(0,a.jsxs)(`div`,{"data-slot":`native-select-wrapper`,className:`relative w-full min-w-0`,children:[(0,a.jsxs)(r.Select.Root,{value:T<0?``:String(T),onValueChange:j,disabled:h,children:[(0,a.jsxs)(r.Select.Trigger,{value:E,ref:A,id:p,onBlur:()=>k.current?.dispatchEvent(new FocusEvent(`focusout`,{bubbles:!0})),"aria-label":v[`aria-label`],"aria-labelledby":v[`aria-labelledby`],"aria-describedby":v[`aria-describedby`],"aria-invalid":v[`aria-invalid`],"aria-required":g,"data-slot":`select-trigger`,"data-size":s,className:t.cn(`flex h-10 w-full min-w-0 items-center justify-between gap-2 rounded-lg border border-input bg-card px-3.5 text-sm font-normal shadow-none outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/20 disabled:cursor-not-allowed disabled:opacity-50 data-[size=sm]:h-8 aria-invalid:border-destructive [&>span:first-child]:truncate`,e),children:[(0,a.jsx)(`span`,{children:y[T]?.label}),(0,a.jsx)(r.Select.Icon,{children:(0,a.jsx)(i.ChevronDown,{"data-slot":`native-select-icon`,className:`size-4 shrink-0 text-muted-foreground`})})]}),(0,a.jsx)(r.Select.Portal,{children:(0,a.jsxs)(r.Select.Content,{position:`popper`,sideOffset:4,"data-slot":`select-content`,className:`z-50 max-h-[min(20rem,var(--radix-select-content-available-height))] min-w-[var(--radix-select-trigger-width)] max-w-[calc(100vw-2rem)] overflow-hidden rounded-lg border bg-popover text-popover-foreground shadow-md`,children:[(0,a.jsx)(r.Select.ScrollUpButton,{className:`flex justify-center py-1`,children:(0,a.jsx)(i.ChevronUp,{className:`size-4`})}),(0,a.jsx)(r.Select.Viewport,{className:`p-1`,children:y.map((e,t)=>(0,a.jsxs)(n.Fragment,{children:[e.group&&y[t-1]?.group!==e.group&&(0,a.jsx)(`div`,{className:`px-3 py-2 text-xs font-medium text-muted-foreground`,children:e.group}),(0,a.jsxs)(r.Select.Item,{value:String(t),"data-value":e.value,disabled:e.disabled,className:`relative flex min-h-9 cursor-default items-center rounded-md py-2 pl-8 pr-3 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[state=checked]:text-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,children:[(0,a.jsx)(r.Select.ItemIndicator,{className:`absolute left-2`,children:(0,a.jsx)(i.Check,{className:`size-4`})}),(0,a.jsx)(r.Select.ItemText,{children:e.label})]})]},e.value))}),(0,a.jsx)(r.Select.ScrollDownButton,{className:`flex justify-center py-1`,children:(0,a.jsx)(i.ChevronDown,{className:`size-4`})})]})})]}),(0,a.jsx)(`select`,{...v,ref:k,name:m,disabled:h,required:g,value:E,tabIndex:-1,"aria-label":void 0,"aria-labelledby":void 0,"aria-hidden":`true`,className:`sr-only pointer-events-none`,onInvalid:e=>{e.preventDefault(),A.current?.focus(),_?.(e)},onChange:e=>{S(e.target.value),d?.(e)},children:c})]})}function c(e){return(0,a.jsx)(`option`,{...e})}function l(e){return(0,a.jsx)(`optgroup`,{...e})}exports.NativeSelect=s,exports.NativeSelectOptGroup=l,exports.NativeSelectOption=c;
1
+ const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/overlay-suppression.cjs"),n=require("../../lib/utils.cjs");let r=require("react");r=e.__toESM(r,1);let i=require("radix-ui"),a=require("lucide-react"),o=require("react/jsx-runtime");function s(e,t,n=!1){return r.Children.toArray(e).flatMap(e=>r.isValidElement(e)?e.type===r.Fragment?s(e.props.children,t,n):e.type===`optgroup`||e.type===u?s(e.props.children,e.props.label,e.props.disabled):[{value:String(e.props.value??e.props.children??``),label:e.props.children,disabled:n||e.props.disabled,group:t}]:[])}function c({className:e,size:c=`default`,children:l,value:u,defaultValue:d,onChange:f,ref:p,id:m,name:h,disabled:g,required:_,onInvalid:v,...y}){let b=s(l),x=String(d??b.find(e=>!e.disabled)?.value??``),[S,C]=r.useState(x),w=u===void 0?S:String(u),T=b.findIndex(e=>e.value===w),E=T>=0?T:b.findIndex(e=>!e.disabled),D=b[E]?.value??``,O=r.useRef(u===void 0?x:D);r.useLayoutEffect(()=>{O.current=u===void 0?x:D},[u,x,D]);let k=r.useRef(!1),A=r.useRef(null),j=r.useRef(null),[M,N]=r.useState(!1),P=t.useOverlayBackgroundSuppression(M);r.useImperativeHandle(p,()=>A.current),r.useEffect(()=>{let e=A.current;e.focus=e=>j.current?.focus(e);let t=t=>{k.current=!0,queueMicrotask(()=>{t.defaultPrevented||(C(x),e.value=O.current),k.current=!1})},n=e.form;return n?.addEventListener(`reset`,t,!0),()=>n?.removeEventListener(`reset`,t,!0)},[x]);function F(e){if(k.current||e===``||b[Number(e)]?.value===D)return;let t=A.current,n=b[Number(e)]?.value;n!==void 0&&(Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,`value`).set.call(t,n),t.dispatchEvent(new Event(`change`,{bubbles:!0})))}return(0,o.jsxs)(`div`,{"data-slot":`native-select-wrapper`,className:`relative w-full min-w-0`,children:[(0,o.jsxs)(i.Select.Root,{value:E<0?``:String(E),onValueChange:F,onOpenChange:N,disabled:g,children:[(0,o.jsxs)(i.Select.Trigger,{value:D,ref:j,id:m,onBlur:()=>A.current?.dispatchEvent(new FocusEvent(`focusout`,{bubbles:!0})),"aria-label":y[`aria-label`],"aria-labelledby":y[`aria-labelledby`],"aria-describedby":y[`aria-describedby`],"aria-invalid":y[`aria-invalid`],"aria-required":_,"data-slot":`select-trigger`,"data-size":c,className:n.cn(`flex h-10 w-full min-w-0 items-center justify-between gap-2 rounded-lg border border-input bg-card px-3.5 text-sm font-normal shadow-none outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/20 disabled:cursor-not-allowed disabled:opacity-50 data-[size=sm]:h-8 aria-invalid:border-destructive [&>span:first-child]:truncate`,e),children:[(0,o.jsx)(`span`,{children:b[E]?.label}),(0,o.jsx)(i.Select.Icon,{children:(0,o.jsx)(a.ChevronDown,{"data-slot":`native-select-icon`,className:`size-4 shrink-0 text-muted-foreground`})})]}),(0,o.jsx)(i.Select.Portal,{children:(0,o.jsxs)(i.Select.Content,{position:`popper`,sideOffset:4,ref:P,"data-slot":`select-content`,className:`z-50 max-h-[min(20rem,var(--radix-select-content-available-height))] min-w-[var(--radix-select-trigger-width)] max-w-[calc(100vw-2rem)] overflow-hidden rounded-lg border bg-popover text-popover-foreground shadow-md`,children:[(0,o.jsx)(i.Select.ScrollUpButton,{className:`flex justify-center py-1`,children:(0,o.jsx)(a.ChevronUp,{className:`size-4`})}),(0,o.jsx)(i.Select.Viewport,{className:`p-1`,children:b.map((e,t)=>(0,o.jsxs)(r.Fragment,{children:[e.group&&b[t-1]?.group!==e.group&&(0,o.jsx)(`div`,{className:`px-3 py-2 text-xs font-medium text-muted-foreground`,children:e.group}),(0,o.jsxs)(i.Select.Item,{value:String(t),"data-value":e.value,disabled:e.disabled,className:`relative flex min-h-9 cursor-default items-center rounded-md py-2 pl-8 pr-3 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[state=checked]:text-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,children:[(0,o.jsx)(i.Select.ItemIndicator,{className:`absolute left-2`,children:(0,o.jsx)(a.Check,{className:`size-4`})}),(0,o.jsx)(i.Select.ItemText,{children:e.label})]})]},e.value))}),(0,o.jsx)(i.Select.ScrollDownButton,{className:`flex justify-center py-1`,children:(0,o.jsx)(a.ChevronDown,{className:`size-4`})})]})})]}),(0,o.jsx)(`select`,{...y,ref:A,name:h,disabled:g,required:_,value:D,tabIndex:-1,"aria-label":void 0,"aria-labelledby":void 0,"aria-hidden":`true`,className:`sr-only pointer-events-none`,onInvalid:e=>{e.preventDefault(),j.current?.focus(),v?.(e)},onChange:e=>{C(e.target.value),f?.(e)},children:l})]})}function l(e){return(0,o.jsx)(`option`,{...e})}function u(e){return(0,o.jsx)(`optgroup`,{...e})}exports.NativeSelect=c,exports.NativeSelectOptGroup=u,exports.NativeSelectOption=l;
@@ -1 +1 @@
1
- {"version":3,"file":"native-select.d.ts","sourceRoot":"","sources":["../../../src/components/ui/native-select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,KAAK,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,CAAA;CAAE,CAAA;AA2BpG,qGAAqG;AACrG,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,IAAgB,EAChB,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,GAAG,EACH,EAAE,EACF,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,qBA2IP;AACD,iBAAS,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,qBAEhE;AACD,iBAAS,oBAAoB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,qBAEpE;AACD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,CAAA"}
1
+ {"version":3,"file":"native-select.d.ts","sourceRoot":"","sources":["../../../src/components/ui/native-select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,KAAK,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,CAAA;CAAE,CAAA;AA2BpG,qGAAqG;AACrG,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,IAAgB,EAChB,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,GAAG,EACH,EAAE,EACF,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,qBAiJP;AACD,iBAAS,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,qBAEhE;AACD,iBAAS,oBAAoB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,qBAEpE;AACD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,CAAA"}
@@ -1,125 +1,128 @@
1
- import { cn as e } from "../../lib/utils.js";
2
- import * as t from "react";
3
- import { Select as n } from "radix-ui";
4
- import { Check as r, ChevronDown as i, ChevronUp as a } from "lucide-react";
5
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
1
+ import { useOverlayBackgroundSuppression as e } from "../../lib/overlay-suppression.js";
2
+ import { cn as t } from "../../lib/utils.js";
3
+ import * as n from "react";
4
+ import { Select as r } from "radix-ui";
5
+ import { Check as i, ChevronDown as a, ChevronUp as o } from "lucide-react";
6
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
6
7
  //#region src/components/ui/native-select.tsx
7
- function c(e, n, r = !1) {
8
- return t.Children.toArray(e).flatMap((e) => t.isValidElement(e) ? e.type === t.Fragment ? c(e.props.children, n, r) : e.type === "optgroup" || e.type === d ? c(e.props.children, e.props.label, e.props.disabled) : [{
8
+ function l(e, t, r = !1) {
9
+ return n.Children.toArray(e).flatMap((e) => n.isValidElement(e) ? e.type === n.Fragment ? l(e.props.children, t, r) : e.type === "optgroup" || e.type === f ? l(e.props.children, e.props.label, e.props.disabled) : [{
9
10
  value: String(e.props.value ?? e.props.children ?? ""),
10
11
  label: e.props.children,
11
12
  disabled: r || e.props.disabled,
12
- group: n
13
+ group: t
13
14
  }] : []);
14
15
  }
15
- function l({ className: l, size: u = "default", children: d, value: f, defaultValue: p, onChange: m, ref: h, id: g, name: _, disabled: v, required: y, onInvalid: b, ...x }) {
16
- let S = c(d), C = String(p ?? S.find((e) => !e.disabled)?.value ?? ""), [w, T] = t.useState(C), E = f === void 0 ? w : String(f), D = S.findIndex((e) => e.value === E), O = D >= 0 ? D : S.findIndex((e) => !e.disabled), k = S[O]?.value ?? "", A = t.useRef(f === void 0 ? C : k);
17
- t.useLayoutEffect(() => {
18
- A.current = f === void 0 ? C : k;
16
+ function u({ className: u, size: d = "default", children: f, value: p, defaultValue: m, onChange: h, ref: g, id: _, name: v, disabled: y, required: b, onInvalid: x, ...S }) {
17
+ let C = l(f), w = String(m ?? C.find((e) => !e.disabled)?.value ?? ""), [T, E] = n.useState(w), D = p === void 0 ? T : String(p), O = C.findIndex((e) => e.value === D), k = O >= 0 ? O : C.findIndex((e) => !e.disabled), A = C[k]?.value ?? "", j = n.useRef(p === void 0 ? w : A);
18
+ n.useLayoutEffect(() => {
19
+ j.current = p === void 0 ? w : A;
19
20
  }, [
20
- f,
21
- C,
22
- k
21
+ p,
22
+ w,
23
+ A
23
24
  ]);
24
- let j = t.useRef(!1), M = t.useRef(null), N = t.useRef(null);
25
- t.useImperativeHandle(h, () => M.current), t.useEffect(() => {
26
- let e = M.current;
27
- e.focus = (e) => N.current?.focus(e);
25
+ let M = n.useRef(!1), N = n.useRef(null), P = n.useRef(null), [F, I] = n.useState(!1), L = e(F);
26
+ n.useImperativeHandle(g, () => N.current), n.useEffect(() => {
27
+ let e = N.current;
28
+ e.focus = (e) => P.current?.focus(e);
28
29
  let t = (t) => {
29
- j.current = !0, queueMicrotask(() => {
30
- t.defaultPrevented || (T(C), e.value = A.current), j.current = !1;
30
+ M.current = !0, queueMicrotask(() => {
31
+ t.defaultPrevented || (E(w), e.value = j.current), M.current = !1;
31
32
  });
32
33
  }, n = e.form;
33
34
  return n?.addEventListener("reset", t, !0), () => n?.removeEventListener("reset", t, !0);
34
- }, [C]);
35
- function P(e) {
36
- if (j.current || e === "" || S[Number(e)]?.value === k) return;
37
- let t = M.current, n = S[Number(e)]?.value;
35
+ }, [w]);
36
+ function R(e) {
37
+ if (M.current || e === "" || C[Number(e)]?.value === A) return;
38
+ let t = N.current, n = C[Number(e)]?.value;
38
39
  n !== void 0 && (Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, "value").set.call(t, n), t.dispatchEvent(new Event("change", { bubbles: !0 })));
39
40
  }
40
- return /* @__PURE__ */ s("div", {
41
+ return /* @__PURE__ */ c("div", {
41
42
  "data-slot": "native-select-wrapper",
42
43
  className: "relative w-full min-w-0",
43
- children: [/* @__PURE__ */ s(n.Root, {
44
- value: O < 0 ? "" : String(O),
45
- onValueChange: P,
46
- disabled: v,
47
- children: [/* @__PURE__ */ s(n.Trigger, {
48
- value: k,
49
- ref: N,
50
- id: g,
51
- onBlur: () => M.current?.dispatchEvent(new FocusEvent("focusout", { bubbles: !0 })),
52
- "aria-label": x["aria-label"],
53
- "aria-labelledby": x["aria-labelledby"],
54
- "aria-describedby": x["aria-describedby"],
55
- "aria-invalid": x["aria-invalid"],
56
- "aria-required": y,
44
+ children: [/* @__PURE__ */ c(r.Root, {
45
+ value: k < 0 ? "" : String(k),
46
+ onValueChange: R,
47
+ onOpenChange: I,
48
+ disabled: y,
49
+ children: [/* @__PURE__ */ c(r.Trigger, {
50
+ value: A,
51
+ ref: P,
52
+ id: _,
53
+ onBlur: () => N.current?.dispatchEvent(new FocusEvent("focusout", { bubbles: !0 })),
54
+ "aria-label": S["aria-label"],
55
+ "aria-labelledby": S["aria-labelledby"],
56
+ "aria-describedby": S["aria-describedby"],
57
+ "aria-invalid": S["aria-invalid"],
58
+ "aria-required": b,
57
59
  "data-slot": "select-trigger",
58
- "data-size": u,
59
- className: e("flex h-10 w-full min-w-0 items-center justify-between gap-2 rounded-lg border border-input bg-card px-3.5 text-sm font-normal shadow-none outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/20 disabled:cursor-not-allowed disabled:opacity-50 data-[size=sm]:h-8 aria-invalid:border-destructive [&>span:first-child]:truncate", l),
60
- children: [/* @__PURE__ */ o("span", { children: S[O]?.label }), /* @__PURE__ */ o(n.Icon, { children: /* @__PURE__ */ o(i, {
60
+ "data-size": d,
61
+ className: t("flex h-10 w-full min-w-0 items-center justify-between gap-2 rounded-lg border border-input bg-card px-3.5 text-sm font-normal shadow-none outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/20 disabled:cursor-not-allowed disabled:opacity-50 data-[size=sm]:h-8 aria-invalid:border-destructive [&>span:first-child]:truncate", u),
62
+ children: [/* @__PURE__ */ s("span", { children: C[k]?.label }), /* @__PURE__ */ s(r.Icon, { children: /* @__PURE__ */ s(a, {
61
63
  "data-slot": "native-select-icon",
62
64
  className: "size-4 shrink-0 text-muted-foreground"
63
65
  }) })]
64
- }), /* @__PURE__ */ o(n.Portal, { children: /* @__PURE__ */ s(n.Content, {
66
+ }), /* @__PURE__ */ s(r.Portal, { children: /* @__PURE__ */ c(r.Content, {
65
67
  position: "popper",
66
68
  sideOffset: 4,
69
+ ref: L,
67
70
  "data-slot": "select-content",
68
71
  className: "z-50 max-h-[min(20rem,var(--radix-select-content-available-height))] min-w-[var(--radix-select-trigger-width)] max-w-[calc(100vw-2rem)] overflow-hidden rounded-lg border bg-popover text-popover-foreground shadow-md",
69
72
  children: [
70
- /* @__PURE__ */ o(n.ScrollUpButton, {
73
+ /* @__PURE__ */ s(r.ScrollUpButton, {
71
74
  className: "flex justify-center py-1",
72
- children: /* @__PURE__ */ o(a, { className: "size-4" })
75
+ children: /* @__PURE__ */ s(o, { className: "size-4" })
73
76
  }),
74
- /* @__PURE__ */ o(n.Viewport, {
77
+ /* @__PURE__ */ s(r.Viewport, {
75
78
  className: "p-1",
76
- children: S.map((e, i) => /* @__PURE__ */ s(t.Fragment, { children: [e.group && S[i - 1]?.group !== e.group && /* @__PURE__ */ o("div", {
79
+ children: C.map((e, t) => /* @__PURE__ */ c(n.Fragment, { children: [e.group && C[t - 1]?.group !== e.group && /* @__PURE__ */ s("div", {
77
80
  className: "px-3 py-2 text-xs font-medium text-muted-foreground",
78
81
  children: e.group
79
- }), /* @__PURE__ */ s(n.Item, {
80
- value: String(i),
82
+ }), /* @__PURE__ */ c(r.Item, {
83
+ value: String(t),
81
84
  "data-value": e.value,
82
85
  disabled: e.disabled,
83
86
  className: "relative flex min-h-9 cursor-default items-center rounded-md py-2 pl-8 pr-3 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[state=checked]:text-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
84
- children: [/* @__PURE__ */ o(n.ItemIndicator, {
87
+ children: [/* @__PURE__ */ s(r.ItemIndicator, {
85
88
  className: "absolute left-2",
86
- children: /* @__PURE__ */ o(r, { className: "size-4" })
87
- }), /* @__PURE__ */ o(n.ItemText, { children: e.label })]
89
+ children: /* @__PURE__ */ s(i, { className: "size-4" })
90
+ }), /* @__PURE__ */ s(r.ItemText, { children: e.label })]
88
91
  })] }, e.value))
89
92
  }),
90
- /* @__PURE__ */ o(n.ScrollDownButton, {
93
+ /* @__PURE__ */ s(r.ScrollDownButton, {
91
94
  className: "flex justify-center py-1",
92
- children: /* @__PURE__ */ o(i, { className: "size-4" })
95
+ children: /* @__PURE__ */ s(a, { className: "size-4" })
93
96
  })
94
97
  ]
95
98
  }) })]
96
- }), /* @__PURE__ */ o("select", {
97
- ...x,
98
- ref: M,
99
- name: _,
100
- disabled: v,
101
- required: y,
102
- value: k,
99
+ }), /* @__PURE__ */ s("select", {
100
+ ...S,
101
+ ref: N,
102
+ name: v,
103
+ disabled: y,
104
+ required: b,
105
+ value: A,
103
106
  tabIndex: -1,
104
107
  "aria-label": void 0,
105
108
  "aria-labelledby": void 0,
106
109
  "aria-hidden": "true",
107
110
  className: "sr-only pointer-events-none",
108
111
  onInvalid: (e) => {
109
- e.preventDefault(), N.current?.focus(), b?.(e);
112
+ e.preventDefault(), P.current?.focus(), x?.(e);
110
113
  },
111
114
  onChange: (e) => {
112
- T(e.target.value), m?.(e);
115
+ E(e.target.value), h?.(e);
113
116
  },
114
- children: d
117
+ children: f
115
118
  })]
116
119
  });
117
120
  }
118
- function u(e) {
119
- return /* @__PURE__ */ o("option", { ...e });
120
- }
121
121
  function d(e) {
122
- return /* @__PURE__ */ o("optgroup", { ...e });
122
+ return /* @__PURE__ */ s("option", { ...e });
123
+ }
124
+ function f(e) {
125
+ return /* @__PURE__ */ s("optgroup", { ...e });
123
126
  }
124
127
  //#endregion
125
- export { l as NativeSelect, d as NativeSelectOptGroup, u as NativeSelectOption };
128
+ export { u as NativeSelect, f as NativeSelectOptGroup, d as NativeSelectOption };
@@ -1 +1 @@
1
- const e=require("../../lib/utils.cjs");let t=require("radix-ui"),n=require("react/jsx-runtime");function r({className:r,children:i,...a}){return(0,n.jsxs)(t.ScrollArea.Root,{"data-slot":`scroll-area`,className:e.cn(`relative overflow-hidden`,r),...a,children:[(0,n.jsx)(t.ScrollArea.Viewport,{className:`size-full rounded-[inherit]`,children:i}),(0,n.jsx)(t.ScrollArea.Scrollbar,{orientation:`vertical`,className:`flex w-2 touch-none select-none p-0.5 transition-colors`,children:(0,n.jsx)(t.ScrollArea.Thumb,{className:`relative flex-1 rounded-full bg-border`})}),(0,n.jsx)(t.ScrollArea.Corner,{})]})}exports.ScrollArea=r;
1
+ const e=require("../../lib/utils.cjs");let t=require("radix-ui"),n=require("react/jsx-runtime");function r({className:r,children:i,...a}){return(0,n.jsxs)(t.ScrollArea.Root,{"data-slot":`scroll-area`,className:e.cn(`relative overflow-hidden`,r),...a,children:[(0,n.jsx)(t.ScrollArea.Viewport,{className:`size-full rounded-[inherit]`,tabIndex:0,children:i}),(0,n.jsx)(t.ScrollArea.Scrollbar,{orientation:`vertical`,className:`flex w-2 touch-none select-none p-0.5 transition-colors`,children:(0,n.jsx)(t.ScrollArea.Thumb,{className:`relative flex-1 rounded-full bg-border`})}),(0,n.jsx)(t.ScrollArea.Corner,{})]})}exports.ScrollArea=r;
@@ -1 +1 @@
1
- {"version":3,"file":"scroll-area.d.ts","sourceRoot":"","sources":["../../../src/components/ui/scroll-area.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAG5D,6BAA6B;AAC7B,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,IAAI,CAAC,+BAmBvD;AAED,OAAO,EAAE,UAAU,EAAE,CAAA"}
1
+ {"version":3,"file":"scroll-area.d.ts","sourceRoot":"","sources":["../../../src/components/ui/scroll-area.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAG5D,6BAA6B;AAC7B,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,IAAI,CAAC,+BAoBvD;AAED,OAAO,EAAE,UAAU,EAAE,CAAA"}
@@ -10,6 +10,7 @@ function i({ className: i, children: a, ...o }) {
10
10
  children: [
11
11
  /* @__PURE__ */ n(t.Viewport, {
12
12
  className: "size-full rounded-[inherit]",
13
+ tabIndex: 0,
13
14
  children: a
14
15
  }),
15
16
  /* @__PURE__ */ n(t.Scrollbar, {
@@ -1 +1 @@
1
- const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs"),n=require("../../lib/dialog-focus.cjs");let r=require("react");r=e.__toESM(r,1);let i=require("radix-ui"),a=require("lucide-react"),o=require("react/jsx-runtime");function s({...e}){return(0,o.jsx)(i.Dialog.Root,{"data-slot":`sheet`,...e})}function c({...e}){return(0,o.jsx)(i.Dialog.Trigger,{"data-slot":`sheet-trigger`,...e})}function l({...e}){return(0,o.jsx)(i.Dialog.Close,{"data-slot":`sheet-close`,...e})}function u({...e}){return(0,o.jsx)(i.Dialog.Portal,{"data-slot":`sheet-portal`,...e})}function d({className:e,...n}){return(0,o.jsx)(i.Dialog.Overlay,{"data-slot":`sheet-overlay`,className:t.cn(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...n})}function f({className:e,children:r,side:s=`right`,showCloseButton:c=!0,onOpenAutoFocus:l,...f}){return(0,o.jsxs)(u,{children:[(0,o.jsx)(d,{}),(0,o.jsxs)(i.Dialog.Content,{"data-slot":`sheet-content`,className:t.cn(`fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500`,s===`right`&&`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`,s===`left`&&`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,s===`top`&&`inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,s===`bottom`&&`inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,e),...f,onOpenAutoFocus:e=>{l?.(e),e.defaultPrevented||n.avoidInitialCloseFocus(e)},children:[r,c&&(0,o.jsxs)(i.Dialog.Close,{"data-slot":`sheet-close`,className:`absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,o.jsx)(a.XIcon,{className:`size-4`}),(0,o.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function p({className:e,...n}){return(0,o.jsx)(`div`,{"data-slot":`sheet-header`,className:t.cn(`flex flex-col gap-1.5 p-4`,e),...n})}function m({className:e,...n}){return(0,o.jsx)(`div`,{"data-slot":`sheet-footer`,className:t.cn(`mt-auto flex flex-col gap-2 p-4`,e),...n})}function h({className:e,...n}){return(0,o.jsx)(i.Dialog.Title,{"data-slot":`sheet-title`,className:t.cn(`font-semibold text-foreground`,e),...n})}function g({className:e,...n}){return(0,o.jsx)(i.Dialog.Description,{"data-slot":`sheet-description`,className:t.cn(`text-sm text-muted-foreground`,e),...n})}exports.Sheet=s,exports.SheetClose=l,exports.SheetContent=f,exports.SheetDescription=g,exports.SheetFooter=m,exports.SheetHeader=p,exports.SheetTitle=h,exports.SheetTrigger=c;
1
+ const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/overlay-suppression.cjs"),n=require("../../lib/utils.cjs"),r=require("../../lib/dialog-focus.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("radix-ui"),o=require("lucide-react"),s=require("react/jsx-runtime");function c({...e}){return(0,s.jsx)(a.Dialog.Root,{"data-slot":`sheet`,...e})}function l({...e}){return(0,s.jsx)(a.Dialog.Trigger,{"data-slot":`sheet-trigger`,...e})}function u({...e}){return(0,s.jsx)(a.Dialog.Close,{"data-slot":`sheet-close`,...e})}function d({...e}){return(0,s.jsx)(a.Dialog.Portal,{"data-slot":`sheet-portal`,...e})}function f({className:e,...t}){return(0,s.jsx)(a.Dialog.Overlay,{"data-slot":`sheet-overlay`,className:n.cn(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function p({className:e,children:c,side:l=`right`,showCloseButton:u=!0,onOpenAutoFocus:p,ref:m,...h}){let g=i.useRef(null),_=t.useOverlayBackgroundSuppression(),v=i.useMemo(()=>t.composeRefs(g,_,m),[_,m]);return(0,s.jsxs)(d,{children:[(0,s.jsx)(f,{}),(0,s.jsxs)(a.Dialog.Content,{"data-slot":`sheet-content`,ref:v,className:n.cn(`fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500`,l===`right`&&`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`,l===`left`&&`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,l===`top`&&`inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,l===`bottom`&&`inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,e),...h,onOpenAutoFocus:e=>{p?.(e),e.defaultPrevented||r.avoidInitialCloseFocus(e)},children:[c,u&&(0,s.jsxs)(a.Dialog.Close,{"data-slot":`sheet-close`,className:`absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,s.jsx)(o.XIcon,{className:`size-4`}),(0,s.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function m({className:e,...t}){return(0,s.jsx)(`div`,{"data-slot":`sheet-header`,className:n.cn(`flex flex-col gap-1.5 p-4`,e),...t})}function h({className:e,...t}){return(0,s.jsx)(`div`,{"data-slot":`sheet-footer`,className:n.cn(`mt-auto flex flex-col gap-2 p-4`,e),...t})}function g({className:e,...t}){return(0,s.jsx)(a.Dialog.Title,{"data-slot":`sheet-title`,className:n.cn(`font-semibold text-foreground`,e),...t})}function _({className:e,...t}){return(0,s.jsx)(a.Dialog.Description,{"data-slot":`sheet-description`,className:n.cn(`text-sm text-muted-foreground`,e),...t})}exports.Sheet=c,exports.SheetClose=u,exports.SheetContent=p,exports.SheetDescription=_,exports.SheetFooter=h,exports.SheetHeader=m,exports.SheetTitle=g,exports.SheetTrigger=l;
@@ -3,7 +3,7 @@ import { Dialog as SheetPrimitive } from 'radix-ui';
3
3
  declare function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>): React.JSX.Element;
4
4
  declare function SheetTrigger({ ...props }: React.ComponentProps<typeof SheetPrimitive.Trigger>): React.JSX.Element;
5
5
  declare function SheetClose({ ...props }: React.ComponentProps<typeof SheetPrimitive.Close>): React.JSX.Element;
6
- declare function SheetContent({ className, children, side, showCloseButton, onOpenAutoFocus, ...props }: React.ComponentProps<typeof SheetPrimitive.Content> & {
6
+ declare function SheetContent({ className, children, side, showCloseButton, onOpenAutoFocus, ref, ...props }: React.ComponentProps<typeof SheetPrimitive.Content> & {
7
7
  side?: 'top' | 'right' | 'bottom' | 'left';
8
8
  showCloseButton?: boolean;
9
9
  }): React.JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"sheet.d.ts","sourceRoot":"","sources":["../../../src/components/ui/sheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,UAAU,CAAA;AAEnD,iBAAS,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,qBAE5E;AAED,iBAAS,YAAY,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,qBAEtF;AAED,iBAAS,UAAU,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,qBAElF;AAsBD,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,QAAQ,EACR,IAAc,EACd,eAAsB,EACtB,eAAe,EACf,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,GAAG;IACvD,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;IAC1C,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,qBAqCA;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAQxE;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAQxE;AAED,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,qBAQ7F;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,WAAW,CAAC,qBAQzD;AAED,OAAO,EACL,KAAK,EACL,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,GACjB,CAAA"}
1
+ {"version":3,"file":"sheet.d.ts","sourceRoot":"","sources":["../../../src/components/ui/sheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,UAAU,CAAA;AAEnD,iBAAS,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,qBAE5E;AAED,iBAAS,YAAY,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,qBAEtF;AAED,iBAAS,UAAU,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,qBAElF;AAsBD,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,QAAQ,EACR,IAAc,EACd,eAAsB,EACtB,eAAe,EACf,GAAG,EACH,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,GAAG;IACvD,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;IAC1C,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,qBAyCA;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAQxE;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAQxE;AAED,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,qBAQ7F;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,WAAW,CAAC,qBAQzD;AAED,OAAO,EACL,KAAK,EACL,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,GACjB,CAAA"}
@@ -1,86 +1,89 @@
1
- import { cn as e } from "../../lib/utils.js";
2
- import { avoidInitialCloseFocus as t } from "../../lib/dialog-focus.js";
3
- import "react";
4
- import { Dialog as n } from "radix-ui";
5
- import { XIcon as r } from "lucide-react";
6
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
1
+ import { composeRefs as e, useOverlayBackgroundSuppression as t } from "../../lib/overlay-suppression.js";
2
+ import { cn as n } from "../../lib/utils.js";
3
+ import { avoidInitialCloseFocus as r } from "../../lib/dialog-focus.js";
4
+ import * as i from "react";
5
+ import { Dialog as a } from "radix-ui";
6
+ import { XIcon as o } from "lucide-react";
7
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
8
  //#region src/components/ui/sheet.tsx
8
- function o({ ...e }) {
9
- return /* @__PURE__ */ i(n.Root, {
9
+ function l({ ...e }) {
10
+ return /* @__PURE__ */ s(a.Root, {
10
11
  "data-slot": "sheet",
11
12
  ...e
12
13
  });
13
14
  }
14
- function s({ ...e }) {
15
- return /* @__PURE__ */ i(n.Trigger, {
15
+ function u({ ...e }) {
16
+ return /* @__PURE__ */ s(a.Trigger, {
16
17
  "data-slot": "sheet-trigger",
17
18
  ...e
18
19
  });
19
20
  }
20
- function c({ ...e }) {
21
- return /* @__PURE__ */ i(n.Close, {
21
+ function d({ ...e }) {
22
+ return /* @__PURE__ */ s(a.Close, {
22
23
  "data-slot": "sheet-close",
23
24
  ...e
24
25
  });
25
26
  }
26
- function l({ ...e }) {
27
- return /* @__PURE__ */ i(n.Portal, {
27
+ function f({ ...e }) {
28
+ return /* @__PURE__ */ s(a.Portal, {
28
29
  "data-slot": "sheet-portal",
29
30
  ...e
30
31
  });
31
32
  }
32
- function u({ className: t, ...r }) {
33
- return /* @__PURE__ */ i(n.Overlay, {
33
+ function p({ className: e, ...t }) {
34
+ return /* @__PURE__ */ s(a.Overlay, {
34
35
  "data-slot": "sheet-overlay",
35
- className: e("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0", t),
36
- ...r
36
+ className: n("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0", e),
37
+ ...t
37
38
  });
38
39
  }
39
- function d({ className: o, children: s, side: c = "right", showCloseButton: d = !0, onOpenAutoFocus: f, ...p }) {
40
- return /* @__PURE__ */ a(l, { children: [/* @__PURE__ */ i(u, {}), /* @__PURE__ */ a(n.Content, {
40
+ function m({ className: l, children: u, side: d = "right", showCloseButton: m = !0, onOpenAutoFocus: h, ref: g, ..._ }) {
41
+ let v = i.useRef(null), y = t(), b = i.useMemo(() => e(v, y, g), [y, g]);
42
+ return /* @__PURE__ */ c(f, { children: [/* @__PURE__ */ s(p, {}), /* @__PURE__ */ c(a.Content, {
41
43
  "data-slot": "sheet-content",
42
- className: e("fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500", c === "right" && "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm", c === "left" && "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm", c === "top" && "inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top", c === "bottom" && "inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom", o),
43
- ...p,
44
+ ref: b,
45
+ className: n("fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500", d === "right" && "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm", d === "left" && "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm", d === "top" && "inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top", d === "bottom" && "inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom", l),
46
+ ..._,
44
47
  onOpenAutoFocus: (e) => {
45
- f?.(e), e.defaultPrevented || t(e);
48
+ h?.(e), e.defaultPrevented || r(e);
46
49
  },
47
- children: [s, d && /* @__PURE__ */ a(n.Close, {
50
+ children: [u, m && /* @__PURE__ */ c(a.Close, {
48
51
  "data-slot": "sheet-close",
49
52
  className: "absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary",
50
- children: [/* @__PURE__ */ i(r, { className: "size-4" }), /* @__PURE__ */ i("span", {
53
+ children: [/* @__PURE__ */ s(o, { className: "size-4" }), /* @__PURE__ */ s("span", {
51
54
  className: "sr-only",
52
55
  children: "Close"
53
56
  })]
54
57
  })]
55
58
  })] });
56
59
  }
57
- function f({ className: t, ...n }) {
58
- return /* @__PURE__ */ i("div", {
60
+ function h({ className: e, ...t }) {
61
+ return /* @__PURE__ */ s("div", {
59
62
  "data-slot": "sheet-header",
60
- className: e("flex flex-col gap-1.5 p-4", t),
61
- ...n
63
+ className: n("flex flex-col gap-1.5 p-4", e),
64
+ ...t
62
65
  });
63
66
  }
64
- function p({ className: t, ...n }) {
65
- return /* @__PURE__ */ i("div", {
67
+ function g({ className: e, ...t }) {
68
+ return /* @__PURE__ */ s("div", {
66
69
  "data-slot": "sheet-footer",
67
- className: e("mt-auto flex flex-col gap-2 p-4", t),
68
- ...n
70
+ className: n("mt-auto flex flex-col gap-2 p-4", e),
71
+ ...t
69
72
  });
70
73
  }
71
- function m({ className: t, ...r }) {
72
- return /* @__PURE__ */ i(n.Title, {
74
+ function _({ className: e, ...t }) {
75
+ return /* @__PURE__ */ s(a.Title, {
73
76
  "data-slot": "sheet-title",
74
- className: e("font-semibold text-foreground", t),
75
- ...r
77
+ className: n("font-semibold text-foreground", e),
78
+ ...t
76
79
  });
77
80
  }
78
- function h({ className: t, ...r }) {
79
- return /* @__PURE__ */ i(n.Description, {
81
+ function v({ className: e, ...t }) {
82
+ return /* @__PURE__ */ s(a.Description, {
80
83
  "data-slot": "sheet-description",
81
- className: e("text-sm text-muted-foreground", t),
82
- ...r
84
+ className: n("text-sm text-muted-foreground", e),
85
+ ...t
83
86
  });
84
87
  }
85
88
  //#endregion
86
- export { o as Sheet, c as SheetClose, d as SheetContent, h as SheetDescription, p as SheetFooter, f as SheetHeader, m as SheetTitle, s as SheetTrigger };
89
+ export { l as Sheet, d as SheetClose, m as SheetContent, v as SheetDescription, g as SheetFooter, h as SheetHeader, _ as SheetTitle, u as SheetTrigger };
@@ -0,0 +1 @@
1
+ const e=require("../_virtual/_rolldown/runtime.cjs");let t=require("react");t=e.__toESM(t,1);function n(...e){return t=>{for(let n of e)typeof n==`function`?n(t):n&&(n.current=t)}}var r=new WeakMap;function i(e){let t=new Set;for(let n=e;n;n=n.parentElement)t.add(n);let n=[],i=e=>{let t=r.get(e)??{count:0,added:!1};t.count===0&&!e.hasAttribute(`inert`)&&(e.setAttribute(`inert`,``),t.added=!0),t.count+=1,r.set(e,t),n.push(e)},a=n=>{if(n!==e)for(let e of Array.from(n.children))t.has(e)?a(e):i(e)};return a(e.ownerDocument.body),console.debug(`[suppress] start`,e.getAttribute(`data-slot`),n.length),()=>{console.debug(`[suppress] undo`,e.getAttribute(`data-slot`),n.length);for(let e of n){let t=r.get(e);t&&(--t.count,t.count<=0&&(t.added&&e.removeAttribute(`inert`),r.delete(e)))}}}function a(e=!0){let[n,r]=t.useState(null);return t.useEffect(()=>{if(n&&e)return i(n)},[n,e]),t.useCallback(e=>r(e),[])}exports.composeRefs=n,exports.useOverlayBackgroundSuppression=a;
@@ -0,0 +1,25 @@
1
+ import * as React from 'react';
2
+ type AnyRef<T> = React.Ref<T> | undefined;
3
+ export declare function composeRefs<T>(...refs: AnyRef<T>[]): (node: T | null) => void;
4
+ /**
5
+ * 模态浮层打开时让背景真正不可交互。
6
+ *
7
+ * Radix 只用 `aria-hidden` 把背景移出无障碍树,背景里的输入框、链接、按钮仍然留在
8
+ * Tab 顺序里:屏幕阅读器看不到、键盘却能走过去,axe 的 `aria-hidden-focus` 也会报错。
9
+ * 原生 `<dialog>.showModal()` 的做法是把背景设为 `inert`,这里补齐同一语义。
10
+ *
11
+ * 只补 `inert`,不改动 Radix 自己写入的 `aria-hidden`;两者范围一致,叠加后背景
12
+ * 既不在无障碍树里、也不在 Tab 顺序里,浮层卸载时按引用计数撤销自己的 `inert`。
13
+ * 仅用于模态浮层;非模态浮层(如 Popover 默认行为)不应使用。
14
+ *
15
+ * 返回的是回调 ref:我们的封装外面还套着 Radix 的 `Presence`,组件挂载时浮层内容
16
+ * 往往还没渲染,必须等内容节点真正出现(以及卸载时置空)才能施加与撤销。
17
+ * 调用方应把它与其它 ref 用 `useMemo` 组合,避免每次渲染重建导致反复摘挂。
18
+ *
19
+ * @param active 浮层是否处于打开态,默认按内容节点挂载/卸载判断。Radix Select 关闭时
20
+ * 只把内容节点移出文档、并不卸载 React 组件(拿不到 ref 置空),必须显式传入打开态,
21
+ * 否则背景会一直停在 `inert` 上,页面再也点不动。
22
+ */
23
+ export declare function useOverlayBackgroundSuppression<T extends HTMLElement>(active?: boolean): (next: T | null) => void;
24
+ export {};
25
+ //# sourceMappingURL=overlay-suppression.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay-suppression.d.ts","sourceRoot":"","sources":["../../src/lib/overlay-suppression.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,KAAK,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;AAEzC,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,IACzC,MAAM,CAAC,GAAG,IAAI,UAMvB;AA0DD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,+BAA+B,CAAC,CAAC,SAAS,WAAW,EAAE,MAAM,UAAO,UAMlD,CAAC,GAAG,IAAI,UACzC"}
@@ -0,0 +1,36 @@
1
+ import * as e from "react";
2
+ //#region src/lib/overlay-suppression.ts
3
+ function t(...e) {
4
+ return (t) => {
5
+ for (let n of e) typeof n == "function" ? n(t) : n && (n.current = t);
6
+ };
7
+ }
8
+ var n = /* @__PURE__ */ new WeakMap();
9
+ function r(e) {
10
+ let t = /* @__PURE__ */ new Set();
11
+ for (let n = e; n; n = n.parentElement) t.add(n);
12
+ let r = [], i = (e) => {
13
+ let t = n.get(e) ?? {
14
+ count: 0,
15
+ added: !1
16
+ };
17
+ t.count === 0 && !e.hasAttribute("inert") && (e.setAttribute("inert", ""), t.added = !0), t.count += 1, n.set(e, t), r.push(e);
18
+ }, a = (n) => {
19
+ if (n !== e) for (let e of Array.from(n.children)) t.has(e) ? a(e) : i(e);
20
+ };
21
+ return a(e.ownerDocument.body), console.debug("[suppress] start", e.getAttribute("data-slot"), r.length), () => {
22
+ console.debug("[suppress] undo", e.getAttribute("data-slot"), r.length);
23
+ for (let e of r) {
24
+ let t = n.get(e);
25
+ t && (--t.count, t.count <= 0 && (t.added && e.removeAttribute("inert"), n.delete(e)));
26
+ }
27
+ };
28
+ }
29
+ function i(t = !0) {
30
+ let [n, i] = e.useState(null);
31
+ return e.useEffect(() => {
32
+ if (n && t) return r(n);
33
+ }, [n, t]), e.useCallback((e) => i(e), []);
34
+ }
35
+ //#endregion
36
+ export { t as composeRefs, i as useOverlayBackgroundSuppression };