@synertech/ui 0.46.1 → 0.46.2

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 (64) hide show
  1. package/dist/components/badge/Badge.cjs +1 -1
  2. package/dist/components/badge/Badge.js +1 -1
  3. package/dist/components/banner/Banner.cjs +1 -1
  4. package/dist/components/banner/Banner.js +1 -1
  5. package/dist/components/calendar/Calendar.cjs +1 -1
  6. package/dist/components/calendar/Calendar.js +1 -1
  7. package/dist/components/checkbox/Checkbox.cjs +1 -1
  8. package/dist/components/checkbox/Checkbox.js +1 -1
  9. package/dist/components/checkbox/CheckboxGroup.cjs +1 -1
  10. package/dist/components/checkbox/CheckboxGroup.js +1 -1
  11. package/dist/components/chip/Chip.cjs +1 -1
  12. package/dist/components/chip/Chip.js +1 -1
  13. package/dist/components/circular-progress/CircularProgress.cjs +1 -1
  14. package/dist/components/circular-progress/CircularProgress.js +1 -1
  15. package/dist/components/device-mockup/DeviceMockup.cjs +1 -1
  16. package/dist/components/device-mockup/DeviceMockup.js +1 -1
  17. package/dist/components/dropdown/DropdownItem.cjs +1 -1
  18. package/dist/components/dropdown/DropdownItem.js +1 -1
  19. package/dist/components/dropdown/DropdownRadio.cjs +1 -1
  20. package/dist/components/dropdown/DropdownRadio.js +1 -1
  21. package/dist/components/file-selector/FileSelector.cjs +1 -1
  22. package/dist/components/file-selector/FileSelector.js +1 -1
  23. package/dist/components/form/shared/inputStyles.cjs +1 -1
  24. package/dist/components/form/shared/inputStyles.js +1 -1
  25. package/dist/components/header/Header.cjs +1 -1
  26. package/dist/components/header/Header.js +1 -1
  27. package/dist/components/help-button/HelpButton.cjs +1 -1
  28. package/dist/components/help-button/HelpButton.js +1 -1
  29. package/dist/components/image-uploader/ImageUploader.cjs +1 -1
  30. package/dist/components/image-uploader/ImageUploader.js +1 -1
  31. package/dist/components/indicator/Indicator.cjs +1 -1
  32. package/dist/components/indicator/Indicator.js +1 -1
  33. package/dist/components/label/Label.cjs +1 -1
  34. package/dist/components/label/Label.js +1 -1
  35. package/dist/components/modal/Modal.cjs +1 -1
  36. package/dist/components/modal/Modal.js +1 -1
  37. package/dist/components/pagination/Pagination.cjs +1 -1
  38. package/dist/components/pagination/Pagination.js +1 -1
  39. package/dist/components/progress-bar/ProgressBar.cjs +1 -1
  40. package/dist/components/progress-bar/ProgressBar.js +1 -1
  41. package/dist/components/radio-button/RadioButton.cjs +1 -1
  42. package/dist/components/radio-button/RadioButton.js +1 -1
  43. package/dist/components/schema-editor/legend/SchemaLegend.cjs +1 -1
  44. package/dist/components/schema-editor/legend/SchemaLegend.js +1 -1
  45. package/dist/components/schema-editor/tables/SchemaTableRenderer.cjs +1 -1
  46. package/dist/components/schema-editor/tables/SchemaTableRenderer.js +1 -1
  47. package/dist/components/select/Select.cjs +1 -1
  48. package/dist/components/select/Select.js +1 -1
  49. package/dist/components/slider/Slider.cjs +1 -1
  50. package/dist/components/slider/Slider.js +1 -1
  51. package/dist/components/stat-card/StatCard.cjs +1 -1
  52. package/dist/components/stat-card/StatCard.js +1 -1
  53. package/dist/components/table/TableHeader.cjs +1 -1
  54. package/dist/components/table/TableHeader.js +1 -1
  55. package/dist/components/tabs/TabsTrigger.cjs +1 -1
  56. package/dist/components/tabs/TabsTrigger.js +1 -1
  57. package/dist/components/toast/Toast.cjs +1 -1
  58. package/dist/components/toast/Toast.js +1 -1
  59. package/dist/components/tooltip/Tooltip.cjs +1 -1
  60. package/dist/components/tooltip/Tooltip.js +1 -1
  61. package/dist/components/wizard/Wizard.cjs +1 -1
  62. package/dist/components/wizard/Wizard.js +1 -1
  63. package/dist/styles.css +56 -117
  64. package/package.json +2 -2
@@ -1 +1 @@
1
- "use strict";"use client";var m=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var me=Object.prototype.hasOwnProperty;var ge=(r,t)=>{for(var l in t)m(r,l,{get:t[l],enumerable:!0})},be=(r,t,l,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ue(t))!me.call(r,a)&&a!==l&&m(r,a,{get:()=>t[a],enumerable:!(d=ce(t,a))||d.enumerable});return r};var ve=r=>be(m({},"__esModule",{value:!0}),r);var he={};ge(he,{Modal:()=>F});module.exports=ve(he);var s=require("react"),N=require("react-dom"),C=require("../../hooks/useDialogA11y.cjs"),o=require("../../lib/cn.cjs"),L=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime"),fe={sm:"max-w-sm",md:"max-w-2xl",lg:"max-w-4xl",xl:"max-w-6xl",full:"max-w-full"},F=(0,s.forwardRef)(({isOpen:r,onClose:t,title:l,children:d,buttonLabel:a,onButtonClick:S,className:M,allowFullScreen:D=!1,showSubmit:g=!0,submitLabel:j,onSubmitClick:I,showCancel:b=!1,cancelLabel:P,onCancelClick:v,buttonsPosition:f="right",showHeaderDivider:R=!0,showFooterDivider:B=!0,description:c,icon:h,size:H="md",reverseButtons:z=!1,headerClassName:E,contentClassName:T,footerClassName:W,titleClassName:$,descriptionClassName:A,submitClassName:O,cancelClassName:U,closeLabel:V,enterFullScreenLabel:q,exitFullScreenLabel:G,"aria-label":J,closeOnEscape:K=!0,trapFocus:Q=!0,initialFocus:X,returnFocus:Y,lockScroll:Z=!0},_)=>{let[i,ee]=(0,s.useState)(!1),n=(0,L.useUILabels)(),u=l??n.modalDefaultTitle,x=(0,s.useId)(),p=`${x}-title`,y=`${x}-description`,{dialogRef:te,dialogProps:re}=(0,C.useDialogA11y)({open:r,onClose:t,closeOnEscape:K,trapFocus:Q,initialFocus:X,returnFocus:Y,lockScroll:Z});if(!r)return null;let oe=a??j??n.confirm,ae=P??n.cancel,le=V??n.closeModal,ne=i?G??n.exitFullScreen:q??n.enterFullScreen,w=S??I,se=async()=>{w&&await w(),t()},ie=async()=>{v&&await v(),t()},k=(0,e.jsx)("div",{className:(0,o.cn)("overflow-y-auto overflow-x-hidden fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-sm",M),"aria-hidden":!r,children:(0,e.jsx)("div",{className:(0,o.cn)("relative p-4 w-full max-h-full transition-all duration-300",i?"max-w-full h-full p-0":fe[H]),ref:_,children:(0,e.jsxs)("div",{...re,ref:te,"aria-labelledby":u?p:void 0,"aria-label":u?void 0:J,"aria-describedby":c?y:void 0,className:(0,o.cn)("relative bg-white shadow dark:bg-gray-700 border-b-4 transition-all duration-300 focus:outline-none",i?"rounded-none h-full flex flex-col":"rounded-lg"),children:[(0,e.jsxs)("div",{className:(0,o.cn)("flex items-center justify-between p-4 md:p-5 rounded-t",R&&"border-b border-gray-200 dark:border-gray-600",E),children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[h&&(0,e.jsx)("div",{className:"shrink-0 text-gray-500 dark:text-gray-400",children:h}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{id:p,className:(0,o.cn)("text-xl font-semibold text-gray-900 dark:text-white",$),children:u}),c&&(0,e.jsx)("p",{id:y,className:(0,o.cn)("mt-1 text-sm text-gray-500 dark:text-gray-400",A),children:c})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 ms-auto",children:[D&&(0,e.jsx)("button",{type:"button",onClick:()=>ee(de=>!de),className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white","aria-label":ne,children:i?(0,e.jsx)("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M7 1H1v6m16 0V1h-6m0 16h6v-6M1 11v6h6"})}):(0,e.jsx)("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M11 1h6v6M1 11v6h6m0-12L1 1m16 16-6-6"})})}),(0,e.jsxs)("button",{type:"button",onClick:t,className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white",children:[(0,e.jsx)("svg",{className:"w-3 h-3","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"})}),(0,e.jsx)("span",{className:"sr-only",children:le})]})]})]}),(0,e.jsx)("div",{className:(0,o.cn)("p-4 md:p-5 space-y-4",i&&"flex-1 overflow-y-auto",T),children:d}),(g||b)&&(0,e.jsxs)("div",{className:(0,o.cn)("flex items-center gap-2 p-4 md:p-5 rounded-b",B&&"border-t border-gray-200 dark:border-gray-600",f==="right"?"justify-end":f==="center"?"justify-center":"justify-start",z&&"flex-row-reverse",W),children:[b&&(0,e.jsx)("button",{type:"button",onClick:ie,className:(0,o.cn)("text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 font-medium rounded-lg text-sm px-5 py-2.5 border border-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:bg-gray-600 dark:hover:text-white",U),children:ae}),g&&(0,e.jsx)("button",{type:"button",onClick:se,className:(0,o.cn)("text-white bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-500 dark:hover:bg-blue-600",O),children:oe})]})]})})});return typeof document<"u"?(0,N.createPortal)(k,document.body):k});F.displayName="Modal";0&&(module.exports={Modal});
1
+ "use strict";"use client";var m=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var me=Object.prototype.hasOwnProperty;var ge=(r,t)=>{for(var l in t)m(r,l,{get:t[l],enumerable:!0})},be=(r,t,l,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ue(t))!me.call(r,a)&&a!==l&&m(r,a,{get:()=>t[a],enumerable:!(d=ce(t,a))||d.enumerable});return r};var ve=r=>be(m({},"__esModule",{value:!0}),r);var xe={};ge(xe,{Modal:()=>F});module.exports=ve(xe);var s=require("react"),N=require("react-dom"),C=require("../../hooks/useDialogA11y.cjs"),o=require("../../lib/cn.cjs"),L=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime"),fe={sm:"max-w-sm",md:"max-w-2xl",lg:"max-w-4xl",xl:"max-w-6xl",full:"max-w-full"},F=(0,s.forwardRef)(({isOpen:r,onClose:t,title:l,children:d,buttonLabel:a,onButtonClick:S,className:M,allowFullScreen:D=!1,showSubmit:g=!0,submitLabel:j,onSubmitClick:I,showCancel:b=!1,cancelLabel:P,onCancelClick:v,buttonsPosition:f="right",showHeaderDivider:R=!0,showFooterDivider:B=!0,description:c,icon:x,size:H="md",reverseButtons:z=!1,headerClassName:E,contentClassName:T,footerClassName:W,titleClassName:$,descriptionClassName:A,submitClassName:O,cancelClassName:U,closeLabel:V,enterFullScreenLabel:q,exitFullScreenLabel:G,"aria-label":J,closeOnEscape:K=!0,trapFocus:Q=!0,initialFocus:X,returnFocus:Y,lockScroll:Z=!0},_)=>{let[i,ee]=(0,s.useState)(!1),n=(0,L.useUILabels)(),u=l??n.modalDefaultTitle,h=(0,s.useId)(),p=`${h}-title`,y=`${h}-description`,{dialogRef:te,dialogProps:re}=(0,C.useDialogA11y)({open:r,onClose:t,closeOnEscape:K,trapFocus:Q,initialFocus:X,returnFocus:Y,lockScroll:Z});if(!r)return null;let oe=a??j??n.confirm,ae=P??n.cancel,le=V??n.closeModal,ne=i?G??n.exitFullScreen:q??n.enterFullScreen,w=S??I,se=async()=>{w&&await w(),t()},ie=async()=>{v&&await v(),t()},k=(0,e.jsx)("div",{className:(0,o.cn)("overflow-y-auto overflow-x-hidden fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-sm",M),"aria-hidden":!r,children:(0,e.jsx)("div",{className:(0,o.cn)("relative p-4 w-full max-h-full transition-all duration-300",i?"max-w-full h-full p-0":fe[H]),ref:_,children:(0,e.jsxs)("div",{...re,ref:te,"aria-labelledby":u?p:void 0,"aria-label":u?void 0:J,"aria-describedby":c?y:void 0,className:(0,o.cn)("relative bg-white shadow dark:bg-gray-700 border-b-4 transition-all duration-300 focus:outline-none",i?"rounded-none h-full flex flex-col":"rounded-lg"),children:[(0,e.jsxs)("div",{className:(0,o.cn)("flex items-center justify-between p-4 md:p-5 rounded-t",R&&"border-b border-gray-200 dark:border-gray-600",E),children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[x&&(0,e.jsx)("div",{className:"shrink-0 text-gray-500 dark:text-gray-400",children:x}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{id:p,className:(0,o.cn)("text-xl font-semibold text-gray-900 dark:text-white",$),children:u}),c&&(0,e.jsx)("p",{id:y,className:(0,o.cn)("mt-1 text-sm text-gray-500 dark:text-gray-400",A),children:c})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 ms-auto",children:[D&&(0,e.jsx)("button",{type:"button",onClick:()=>ee(de=>!de),className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white","aria-label":ne,children:i?(0,e.jsx)("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M7 1H1v6m16 0V1h-6m0 16h6v-6M1 11v6h6"})}):(0,e.jsx)("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M11 1h6v6M1 11v6h6m0-12L1 1m16 16-6-6"})})}),(0,e.jsxs)("button",{type:"button",onClick:t,className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white",children:[(0,e.jsx)("svg",{className:"w-3 h-3","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"})}),(0,e.jsx)("span",{className:"sr-only",children:le})]})]})]}),(0,e.jsx)("div",{className:(0,o.cn)("p-4 md:p-5 space-y-4",i&&"flex-1 overflow-y-auto",T),children:d}),(g||b)&&(0,e.jsxs)("div",{className:(0,o.cn)("flex items-center gap-2 p-4 md:p-5 rounded-b",B&&"border-t border-gray-200 dark:border-gray-600",f==="right"?"justify-end":f==="center"?"justify-center":"justify-start",z&&"flex-row-reverse",W),children:[b&&(0,e.jsx)("button",{type:"button",onClick:ie,className:(0,o.cn)("text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 font-medium rounded-lg text-sm px-5 py-2.5 border border-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:bg-gray-600 dark:hover:text-white",U),children:ae}),g&&(0,e.jsx)("button",{type:"button",onClick:se,className:(0,o.cn)("text-white bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center",O),children:oe})]})]})})});return typeof document<"u"?(0,N.createPortal)(k,document.body):k});F.displayName="Modal";0&&(module.exports={Modal});
@@ -1 +1 @@
1
- "use client";import{forwardRef as le,useId as ne,useState as se}from"react";import{createPortal as ie}from"react-dom";import{useDialogA11y as de}from"../../hooks/useDialogA11y.js";import{cn as t}from"../../lib/cn.js";import{useUILabels as ce}from"../../lib/i18n.js";import{jsx as e,jsxs as r}from"react/jsx-runtime";var ue={sm:"max-w-sm",md:"max-w-2xl",lg:"max-w-4xl",xl:"max-w-6xl",full:"max-w-full"},me=le(({isOpen:n,onClose:l,title:p,children:y,buttonLabel:w,onButtonClick:k,className:N,allowFullScreen:C=!1,showSubmit:d=!0,submitLabel:L,onSubmitClick:F,showCancel:c=!1,cancelLabel:S,onCancelClick:u,buttonsPosition:m="right",showHeaderDivider:M=!0,showFooterDivider:D=!0,description:s,icon:g,size:j="md",reverseButtons:I=!1,headerClassName:P,contentClassName:R,footerClassName:B,titleClassName:H,descriptionClassName:z,submitClassName:E,cancelClassName:T,closeLabel:W,enterFullScreenLabel:$,exitFullScreenLabel:A,"aria-label":O,closeOnEscape:U=!0,trapFocus:V=!0,initialFocus:q,returnFocus:G,lockScroll:J=!0},K)=>{let[a,Q]=se(!1),o=ce(),i=p??o.modalDefaultTitle,b=ne(),v=`${b}-title`,f=`${b}-description`,{dialogRef:X,dialogProps:Y}=de({open:n,onClose:l,closeOnEscape:U,trapFocus:V,initialFocus:q,returnFocus:G,lockScroll:J});if(!n)return null;let Z=w??L??o.confirm,_=S??o.cancel,ee=W??o.closeModal,te=a?A??o.exitFullScreen:$??o.enterFullScreen,h=k??F,re=async()=>{h&&await h(),l()},oe=async()=>{u&&await u(),l()},x=e("div",{className:t("overflow-y-auto overflow-x-hidden fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-sm",N),"aria-hidden":!n,children:e("div",{className:t("relative p-4 w-full max-h-full transition-all duration-300",a?"max-w-full h-full p-0":ue[j]),ref:K,children:r("div",{...Y,ref:X,"aria-labelledby":i?v:void 0,"aria-label":i?void 0:O,"aria-describedby":s?f:void 0,className:t("relative bg-white shadow dark:bg-gray-700 border-b-4 transition-all duration-300 focus:outline-none",a?"rounded-none h-full flex flex-col":"rounded-lg"),children:[r("div",{className:t("flex items-center justify-between p-4 md:p-5 rounded-t",M&&"border-b border-gray-200 dark:border-gray-600",P),children:[r("div",{className:"flex items-center gap-3",children:[g&&e("div",{className:"shrink-0 text-gray-500 dark:text-gray-400",children:g}),r("div",{children:[e("h3",{id:v,className:t("text-xl font-semibold text-gray-900 dark:text-white",H),children:i}),s&&e("p",{id:f,className:t("mt-1 text-sm text-gray-500 dark:text-gray-400",z),children:s})]})]}),r("div",{className:"flex items-center gap-1 ms-auto",children:[C&&e("button",{type:"button",onClick:()=>Q(ae=>!ae),className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white","aria-label":te,children:a?e("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M7 1H1v6m16 0V1h-6m0 16h6v-6M1 11v6h6"})}):e("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M11 1h6v6M1 11v6h6m0-12L1 1m16 16-6-6"})})}),r("button",{type:"button",onClick:l,className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white",children:[e("svg",{className:"w-3 h-3","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"})}),e("span",{className:"sr-only",children:ee})]})]})]}),e("div",{className:t("p-4 md:p-5 space-y-4",a&&"flex-1 overflow-y-auto",R),children:y}),(d||c)&&r("div",{className:t("flex items-center gap-2 p-4 md:p-5 rounded-b",D&&"border-t border-gray-200 dark:border-gray-600",m==="right"?"justify-end":m==="center"?"justify-center":"justify-start",I&&"flex-row-reverse",B),children:[c&&e("button",{type:"button",onClick:oe,className:t("text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 font-medium rounded-lg text-sm px-5 py-2.5 border border-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:bg-gray-600 dark:hover:text-white",T),children:_}),d&&e("button",{type:"button",onClick:re,className:t("text-white bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-500 dark:hover:bg-blue-600",E),children:Z})]})]})})});return typeof document<"u"?ie(x,document.body):x});me.displayName="Modal";export{me as Modal};
1
+ "use client";import{forwardRef as le,useId as ne,useState as se}from"react";import{createPortal as ie}from"react-dom";import{useDialogA11y as de}from"../../hooks/useDialogA11y.js";import{cn as t}from"../../lib/cn.js";import{useUILabels as ce}from"../../lib/i18n.js";import{jsx as e,jsxs as r}from"react/jsx-runtime";var ue={sm:"max-w-sm",md:"max-w-2xl",lg:"max-w-4xl",xl:"max-w-6xl",full:"max-w-full"},me=le(({isOpen:n,onClose:l,title:p,children:y,buttonLabel:w,onButtonClick:k,className:N,allowFullScreen:C=!1,showSubmit:d=!0,submitLabel:L,onSubmitClick:F,showCancel:c=!1,cancelLabel:S,onCancelClick:u,buttonsPosition:m="right",showHeaderDivider:M=!0,showFooterDivider:D=!0,description:s,icon:g,size:j="md",reverseButtons:I=!1,headerClassName:P,contentClassName:R,footerClassName:B,titleClassName:H,descriptionClassName:z,submitClassName:E,cancelClassName:T,closeLabel:W,enterFullScreenLabel:$,exitFullScreenLabel:A,"aria-label":O,closeOnEscape:U=!0,trapFocus:V=!0,initialFocus:q,returnFocus:G,lockScroll:J=!0},K)=>{let[a,Q]=se(!1),o=ce(),i=p??o.modalDefaultTitle,b=ne(),v=`${b}-title`,f=`${b}-description`,{dialogRef:X,dialogProps:Y}=de({open:n,onClose:l,closeOnEscape:U,trapFocus:V,initialFocus:q,returnFocus:G,lockScroll:J});if(!n)return null;let Z=w??L??o.confirm,_=S??o.cancel,ee=W??o.closeModal,te=a?A??o.exitFullScreen:$??o.enterFullScreen,x=k??F,re=async()=>{x&&await x(),l()},oe=async()=>{u&&await u(),l()},h=e("div",{className:t("overflow-y-auto overflow-x-hidden fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-sm",N),"aria-hidden":!n,children:e("div",{className:t("relative p-4 w-full max-h-full transition-all duration-300",a?"max-w-full h-full p-0":ue[j]),ref:K,children:r("div",{...Y,ref:X,"aria-labelledby":i?v:void 0,"aria-label":i?void 0:O,"aria-describedby":s?f:void 0,className:t("relative bg-white shadow dark:bg-gray-700 border-b-4 transition-all duration-300 focus:outline-none",a?"rounded-none h-full flex flex-col":"rounded-lg"),children:[r("div",{className:t("flex items-center justify-between p-4 md:p-5 rounded-t",M&&"border-b border-gray-200 dark:border-gray-600",P),children:[r("div",{className:"flex items-center gap-3",children:[g&&e("div",{className:"shrink-0 text-gray-500 dark:text-gray-400",children:g}),r("div",{children:[e("h3",{id:v,className:t("text-xl font-semibold text-gray-900 dark:text-white",H),children:i}),s&&e("p",{id:f,className:t("mt-1 text-sm text-gray-500 dark:text-gray-400",z),children:s})]})]}),r("div",{className:"flex items-center gap-1 ms-auto",children:[C&&e("button",{type:"button",onClick:()=>Q(ae=>!ae),className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white","aria-label":te,children:a?e("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M7 1H1v6m16 0V1h-6m0 16h6v-6M1 11v6h6"})}):e("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M11 1h6v6M1 11v6h6m0-12L1 1m16 16-6-6"})})}),r("button",{type:"button",onClick:l,className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white",children:[e("svg",{className:"w-3 h-3","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"})}),e("span",{className:"sr-only",children:ee})]})]})]}),e("div",{className:t("p-4 md:p-5 space-y-4",a&&"flex-1 overflow-y-auto",R),children:y}),(d||c)&&r("div",{className:t("flex items-center gap-2 p-4 md:p-5 rounded-b",D&&"border-t border-gray-200 dark:border-gray-600",m==="right"?"justify-end":m==="center"?"justify-center":"justify-start",I&&"flex-row-reverse",B),children:[c&&e("button",{type:"button",onClick:oe,className:t("text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 font-medium rounded-lg text-sm px-5 py-2.5 border border-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:bg-gray-600 dark:hover:text-white",T),children:_}),d&&e("button",{type:"button",onClick:re,className:t("text-white bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center",E),children:Z})]})]})})});return typeof document<"u"?ie(h,document.body):h});me.displayName="Modal";export{me as Modal};
@@ -1 +1 @@
1
- "use strict";"use client";var L=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var z=(e,r)=>{for(var u in r)L(e,u,{get:r[u],enumerable:!0})},$=(e,r,u,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let c of _(r))!O.call(e,c)&&c!==u&&L(e,c,{get:()=>r[c],enumerable:!(i=F(r,c))||i.enumerable});return e};var q=e=>$(L({},"__esModule",{value:!0}),e);var X={};z(X,{Pagination:()=>V});module.exports=q(X);var C=require("react"),d=require("../../lib/cn.cjs"),y=require("../../lib/i18n.cjs"),n=require("react/jsx-runtime");function D(e,r,u,i){let c=u*2+1+i*2+2;if(r<=c)return Array.from({length:r},(t,g)=>g+1);let k=Array.from({length:i},(t,g)=>g+1).filter(t=>t<=r),N=Array.from({length:i},(t,g)=>r-i+1+g).filter(t=>t>=1),h=Math.max(e-u,i+1),s=Math.min(e+u,r-i),b=h>i+2,p=s<r-i-1,o=[];for(let t of k)o.push(t);if(b)o.push("ellipsis");else for(let t=i+1;t<h;t++)o.push(t);for(let t=h;t<=s;t++)o.push(t);if(p)o.push("ellipsis");else for(let t=s+1;t<=r-i;t++)o.push(t);for(let t of N)o.includes(t)||o.push(t);return o}function G({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function H({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}function J({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 19l-7-7 7-7M18 19l-7-7 7-7"})})}function K({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M6 5l7 7-7 7"})})}var Q={sm:{button:"h-7 min-w-7 px-1.5 text-xs",icon:"h-3 w-3",gap:"gap-0.5",text:"text-xs"},md:{button:"h-9 min-w-9 px-2.5 text-sm",icon:"h-4 w-4",gap:"gap-1",text:"text-sm"},lg:{button:"h-11 min-w-11 px-3.5 text-base",icon:"h-5 w-5",gap:"gap-1.5",text:"text-base"}},T={default:{base:"rounded-md font-medium transition-colors",idle:"text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700",active:"bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"},outlined:{base:"rounded-md border font-medium transition-colors",idle:"border-gray-300 text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800",active:"border-blue-600 bg-blue-50 text-blue-600 hover:bg-blue-100 dark:border-blue-400 dark:bg-blue-900/30 dark:text-blue-400 dark:hover:bg-blue-900/50",disabled:"border-gray-200 text-gray-300 cursor-not-allowed dark:border-gray-700 dark:text-gray-600"},minimal:{base:"rounded-md font-medium transition-colors",idle:"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200",active:"text-blue-600 font-semibold hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"}};function V({page:e,totalPages:r,onPageChange:u,size:i="md",variant:c="default",showFirstLast:k=!1,siblings:N=1,boundaries:h=1,disabled:s=!1,labels:b,totalItems:p,pageSize:o,pageSizeOptions:t,onPageSizeChange:g,className:I,...P}){let m=(0,y.useUILabels)(b),l=Q[i],f=T[c],W=(0,C.useMemo)(()=>D(e,r,N,h),[e,r,N,h]),x=(0,C.useCallback)(a=>{s||a<1||a>r||a===e||u(a)},[s,r,e,u]),R=e<=1,M=e>=r,B=(0,d.cn)("inline-flex items-center justify-center select-none",l.button,f.base),w=(a,v,U,A)=>(0,n.jsx)("button",{type:"button",onClick:a,disabled:s||v,"aria-label":U,"aria-disabled":s||v,className:(0,d.cn)(B,s||v?f.disabled:f.idle),children:A}),j=p!==void 0&&o?(e-1)*o+1:void 0,E=p!==void 0&&o?Math.min(e*o,p):void 0;return(0,n.jsxs)("nav",{"aria-label":m.paginationLabel,className:(0,d.cn)("flex items-center",l.gap,I),...P,children:[p!==void 0&&o&&(0,n.jsx)("span",{className:(0,d.cn)("mr-2 text-gray-600 dark:text-gray-400 whitespace-nowrap",l.text),children:(0,y.formatUILabel)(m.paginationRange,{start:j??0,end:E??0,total:p})}),t&&t.length>0&&g&&(0,n.jsxs)("div",{className:(0,d.cn)("mr-2 flex items-center whitespace-nowrap",l.gap,l.text),children:[(0,n.jsx)("label",{htmlFor:"pagination-page-size",className:"text-gray-600 dark:text-gray-400",children:m.paginationRowsPerPage}),(0,n.jsx)("select",{id:"pagination-page-size",value:o,onChange:a=>g(Number(a.target.value)),disabled:s,className:(0,d.cn)("rounded border border-gray-300 bg-white px-1.5 py-0.5 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200",l.text,s&&"cursor-not-allowed opacity-50"),children:t.map(a=>(0,n.jsx)("option",{value:a,children:a},a))})]}),(0,n.jsxs)("div",{className:(0,d.cn)("flex items-center",l.gap),children:[k&&w(()=>x(1),R,b?.first??m.paginationFirst,(0,n.jsx)(J,{className:l.icon})),w(()=>x(e-1),R,b?.previous??m.paginationPrevious,(0,n.jsx)(G,{className:l.icon})),W.map((a,v)=>a==="ellipsis"?(0,n.jsx)("span",{className:(0,d.cn)("inline-flex items-center justify-center select-none",l.button,"text-gray-400 dark:text-gray-500"),"aria-hidden":"true",children:"\u2026"},`ellipsis-${v}`):(0,n.jsx)("button",{type:"button",onClick:()=>x(a),disabled:s,"aria-current":a===e?"page":void 0,"aria-label":(0,y.formatUILabel)(m.paginationPage,{page:a}),className:(0,d.cn)(B,a===e?f.active:s?f.disabled:f.idle),children:a},a)),w(()=>x(e+1),M,b?.next??m.paginationNext,(0,n.jsx)(H,{className:l.icon})),k&&w(()=>x(r),M,b?.last??m.paginationLast,(0,n.jsx)(K,{className:l.icon}))]})]})}0&&(module.exports={Pagination});
1
+ "use strict";"use client";var L=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var z=(e,r)=>{for(var u in r)L(e,u,{get:r[u],enumerable:!0})},$=(e,r,u,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let c of _(r))!O.call(e,c)&&c!==u&&L(e,c,{get:()=>r[c],enumerable:!(i=F(r,c))||i.enumerable});return e};var q=e=>$(L({},"__esModule",{value:!0}),e);var X={};z(X,{Pagination:()=>V});module.exports=q(X);var C=require("react"),d=require("../../lib/cn.cjs"),y=require("../../lib/i18n.cjs"),n=require("react/jsx-runtime");function D(e,r,u,i){let c=u*2+1+i*2+2;if(r<=c)return Array.from({length:r},(t,g)=>g+1);let k=Array.from({length:i},(t,g)=>g+1).filter(t=>t<=r),N=Array.from({length:i},(t,g)=>r-i+1+g).filter(t=>t>=1),h=Math.max(e-u,i+1),s=Math.min(e+u,r-i),b=h>i+2,p=s<r-i-1,o=[];for(let t of k)o.push(t);if(b)o.push("ellipsis");else for(let t=i+1;t<h;t++)o.push(t);for(let t=h;t<=s;t++)o.push(t);if(p)o.push("ellipsis");else for(let t=s+1;t<=r-i;t++)o.push(t);for(let t of N)o.includes(t)||o.push(t);return o}function G({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function H({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}function J({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 19l-7-7 7-7M18 19l-7-7 7-7"})})}function K({className:e}){return(0,n.jsx)("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M6 5l7 7-7 7"})})}var Q={sm:{button:"h-7 min-w-7 px-1.5 text-xs",icon:"h-3 w-3",gap:"gap-0.5",text:"text-xs"},md:{button:"h-9 min-w-9 px-2.5 text-sm",icon:"h-4 w-4",gap:"gap-1",text:"text-sm"},lg:{button:"h-11 min-w-11 px-3.5 text-base",icon:"h-5 w-5",gap:"gap-1.5",text:"text-base"}},T={default:{base:"rounded-md font-medium transition-colors",idle:"text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700",active:"bg-blue-600 text-white hover:bg-blue-700",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"},outlined:{base:"rounded-md border font-medium transition-colors",idle:"border-gray-300 text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800",active:"border-blue-600 bg-blue-50 text-blue-600 hover:bg-blue-100 dark:border-blue-400 dark:bg-blue-900/30 dark:text-blue-400 dark:hover:bg-blue-900/50",disabled:"border-gray-200 text-gray-300 cursor-not-allowed dark:border-gray-700 dark:text-gray-600"},minimal:{base:"rounded-md font-medium transition-colors",idle:"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200",active:"text-blue-600 font-semibold hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"}};function V({page:e,totalPages:r,onPageChange:u,size:i="md",variant:c="default",showFirstLast:k=!1,siblings:N=1,boundaries:h=1,disabled:s=!1,labels:b,totalItems:p,pageSize:o,pageSizeOptions:t,onPageSizeChange:g,className:I,...P}){let m=(0,y.useUILabels)(b),l=Q[i],f=T[c],W=(0,C.useMemo)(()=>D(e,r,N,h),[e,r,N,h]),x=(0,C.useCallback)(a=>{s||a<1||a>r||a===e||u(a)},[s,r,e,u]),R=e<=1,M=e>=r,B=(0,d.cn)("inline-flex items-center justify-center select-none",l.button,f.base),w=(a,v,U,A)=>(0,n.jsx)("button",{type:"button",onClick:a,disabled:s||v,"aria-label":U,"aria-disabled":s||v,className:(0,d.cn)(B,s||v?f.disabled:f.idle),children:A}),j=p!==void 0&&o?(e-1)*o+1:void 0,E=p!==void 0&&o?Math.min(e*o,p):void 0;return(0,n.jsxs)("nav",{"aria-label":m.paginationLabel,className:(0,d.cn)("flex items-center",l.gap,I),...P,children:[p!==void 0&&o&&(0,n.jsx)("span",{className:(0,d.cn)("mr-2 text-gray-600 dark:text-gray-400 whitespace-nowrap",l.text),children:(0,y.formatUILabel)(m.paginationRange,{start:j??0,end:E??0,total:p})}),t&&t.length>0&&g&&(0,n.jsxs)("div",{className:(0,d.cn)("mr-2 flex items-center whitespace-nowrap",l.gap,l.text),children:[(0,n.jsx)("label",{htmlFor:"pagination-page-size",className:"text-gray-600 dark:text-gray-400",children:m.paginationRowsPerPage}),(0,n.jsx)("select",{id:"pagination-page-size",value:o,onChange:a=>g(Number(a.target.value)),disabled:s,className:(0,d.cn)("rounded border border-gray-300 bg-white px-1.5 py-0.5 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200",l.text,s&&"cursor-not-allowed opacity-50"),children:t.map(a=>(0,n.jsx)("option",{value:a,children:a},a))})]}),(0,n.jsxs)("div",{className:(0,d.cn)("flex items-center",l.gap),children:[k&&w(()=>x(1),R,b?.first??m.paginationFirst,(0,n.jsx)(J,{className:l.icon})),w(()=>x(e-1),R,b?.previous??m.paginationPrevious,(0,n.jsx)(G,{className:l.icon})),W.map((a,v)=>a==="ellipsis"?(0,n.jsx)("span",{className:(0,d.cn)("inline-flex items-center justify-center select-none",l.button,"text-gray-400 dark:text-gray-500"),"aria-hidden":"true",children:"\u2026"},`ellipsis-${v}`):(0,n.jsx)("button",{type:"button",onClick:()=>x(a),disabled:s,"aria-current":a===e?"page":void 0,"aria-label":(0,y.formatUILabel)(m.paginationPage,{page:a}),className:(0,d.cn)(B,a===e?f.active:s?f.disabled:f.idle),children:a},a)),w(()=>x(e+1),M,b?.next??m.paginationNext,(0,n.jsx)(H,{className:l.icon})),k&&w(()=>x(r),M,b?.last??m.paginationLast,(0,n.jsx)(K,{className:l.icon}))]})]})}0&&(module.exports={Pagination});
@@ -1 +1 @@
1
- "use client";import{useCallback as A,useMemo as F}from"react";import{cn as u}from"../../lib/cn.js";import{formatUILabel as M,useUILabels as _}from"../../lib/i18n.js";import{jsx as n,jsxs as w}from"react/jsx-runtime";function O(t,o,b,s){let N=b*2+1+s*2+2;if(o<=N)return Array.from({length:o},(e,d)=>d+1);let v=Array.from({length:s},(e,d)=>d+1).filter(e=>e<=o),y=Array.from({length:s},(e,d)=>o-s+1+d).filter(e=>e>=1),p=Math.max(t-b,s+1),i=Math.min(t+b,o-s),g=p>s+2,m=i<o-s-1,a=[];for(let e of v)a.push(e);if(g)a.push("ellipsis");else for(let e=s+1;e<p;e++)a.push(e);for(let e=p;e<=i;e++)a.push(e);if(m)a.push("ellipsis");else for(let e=i+1;e<=o-s;e++)a.push(e);for(let e of y)a.includes(e)||a.push(e);return a}function z({className:t}){return n("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function $({className:t}){return n("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}function q({className:t}){return n("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 19l-7-7 7-7M18 19l-7-7 7-7"})})}function D({className:t}){return n("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M6 5l7 7-7 7"})})}var G={sm:{button:"h-7 min-w-7 px-1.5 text-xs",icon:"h-3 w-3",gap:"gap-0.5",text:"text-xs"},md:{button:"h-9 min-w-9 px-2.5 text-sm",icon:"h-4 w-4",gap:"gap-1",text:"text-sm"},lg:{button:"h-11 min-w-11 px-3.5 text-base",icon:"h-5 w-5",gap:"gap-1.5",text:"text-base"}},H={default:{base:"rounded-md font-medium transition-colors",idle:"text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700",active:"bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"},outlined:{base:"rounded-md border font-medium transition-colors",idle:"border-gray-300 text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800",active:"border-blue-600 bg-blue-50 text-blue-600 hover:bg-blue-100 dark:border-blue-400 dark:bg-blue-900/30 dark:text-blue-400 dark:hover:bg-blue-900/50",disabled:"border-gray-200 text-gray-300 cursor-not-allowed dark:border-gray-700 dark:text-gray-600"},minimal:{base:"rounded-md font-medium transition-colors",idle:"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200",active:"text-blue-600 font-semibold hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"}};function T({page:t,totalPages:o,onPageChange:b,size:s="md",variant:N="default",showFirstLast:v=!1,siblings:y=1,boundaries:p=1,disabled:i=!1,labels:g,totalItems:m,pageSize:a,pageSizeOptions:e,onPageSizeChange:d,className:B,...I}){let c=_(g),l=G[s],h=H[N],P=F(()=>O(t,o,y,p),[t,o,y,p]),f=A(r=>{i||r<1||r>o||r===t||b(r)},[i,o,t,b]),C=t<=1,L=t>=o,R=u("inline-flex items-center justify-center select-none",l.button,h.base),k=(r,x,E,U)=>n("button",{type:"button",onClick:r,disabled:i||x,"aria-label":E,"aria-disabled":i||x,className:u(R,i||x?h.disabled:h.idle),children:U}),W=m!==void 0&&a?(t-1)*a+1:void 0,j=m!==void 0&&a?Math.min(t*a,m):void 0;return w("nav",{"aria-label":c.paginationLabel,className:u("flex items-center",l.gap,B),...I,children:[m!==void 0&&a&&n("span",{className:u("mr-2 text-gray-600 dark:text-gray-400 whitespace-nowrap",l.text),children:M(c.paginationRange,{start:W??0,end:j??0,total:m})}),e&&e.length>0&&d&&w("div",{className:u("mr-2 flex items-center whitespace-nowrap",l.gap,l.text),children:[n("label",{htmlFor:"pagination-page-size",className:"text-gray-600 dark:text-gray-400",children:c.paginationRowsPerPage}),n("select",{id:"pagination-page-size",value:a,onChange:r=>d(Number(r.target.value)),disabled:i,className:u("rounded border border-gray-300 bg-white px-1.5 py-0.5 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200",l.text,i&&"cursor-not-allowed opacity-50"),children:e.map(r=>n("option",{value:r,children:r},r))})]}),w("div",{className:u("flex items-center",l.gap),children:[v&&k(()=>f(1),C,g?.first??c.paginationFirst,n(q,{className:l.icon})),k(()=>f(t-1),C,g?.previous??c.paginationPrevious,n(z,{className:l.icon})),P.map((r,x)=>r==="ellipsis"?n("span",{className:u("inline-flex items-center justify-center select-none",l.button,"text-gray-400 dark:text-gray-500"),"aria-hidden":"true",children:"\u2026"},`ellipsis-${x}`):n("button",{type:"button",onClick:()=>f(r),disabled:i,"aria-current":r===t?"page":void 0,"aria-label":M(c.paginationPage,{page:r}),className:u(R,r===t?h.active:i?h.disabled:h.idle),children:r},r)),k(()=>f(t+1),L,g?.next??c.paginationNext,n($,{className:l.icon})),v&&k(()=>f(o),L,g?.last??c.paginationLast,n(D,{className:l.icon}))]})]})}export{T as Pagination};
1
+ "use client";import{useCallback as A,useMemo as F}from"react";import{cn as u}from"../../lib/cn.js";import{formatUILabel as M,useUILabels as _}from"../../lib/i18n.js";import{jsx as n,jsxs as w}from"react/jsx-runtime";function O(t,o,b,s){let N=b*2+1+s*2+2;if(o<=N)return Array.from({length:o},(e,d)=>d+1);let v=Array.from({length:s},(e,d)=>d+1).filter(e=>e<=o),y=Array.from({length:s},(e,d)=>o-s+1+d).filter(e=>e>=1),p=Math.max(t-b,s+1),i=Math.min(t+b,o-s),g=p>s+2,m=i<o-s-1,a=[];for(let e of v)a.push(e);if(g)a.push("ellipsis");else for(let e=s+1;e<p;e++)a.push(e);for(let e=p;e<=i;e++)a.push(e);if(m)a.push("ellipsis");else for(let e=i+1;e<=o-s;e++)a.push(e);for(let e of y)a.includes(e)||a.push(e);return a}function z({className:t}){return n("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function $({className:t}){return n("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}function q({className:t}){return n("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 19l-7-7 7-7M18 19l-7-7 7-7"})})}function D({className:t}){return n("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M6 5l7 7-7 7"})})}var G={sm:{button:"h-7 min-w-7 px-1.5 text-xs",icon:"h-3 w-3",gap:"gap-0.5",text:"text-xs"},md:{button:"h-9 min-w-9 px-2.5 text-sm",icon:"h-4 w-4",gap:"gap-1",text:"text-sm"},lg:{button:"h-11 min-w-11 px-3.5 text-base",icon:"h-5 w-5",gap:"gap-1.5",text:"text-base"}},H={default:{base:"rounded-md font-medium transition-colors",idle:"text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700",active:"bg-blue-600 text-white hover:bg-blue-700",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"},outlined:{base:"rounded-md border font-medium transition-colors",idle:"border-gray-300 text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800",active:"border-blue-600 bg-blue-50 text-blue-600 hover:bg-blue-100 dark:border-blue-400 dark:bg-blue-900/30 dark:text-blue-400 dark:hover:bg-blue-900/50",disabled:"border-gray-200 text-gray-300 cursor-not-allowed dark:border-gray-700 dark:text-gray-600"},minimal:{base:"rounded-md font-medium transition-colors",idle:"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200",active:"text-blue-600 font-semibold hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"}};function T({page:t,totalPages:o,onPageChange:b,size:s="md",variant:N="default",showFirstLast:v=!1,siblings:y=1,boundaries:p=1,disabled:i=!1,labels:g,totalItems:m,pageSize:a,pageSizeOptions:e,onPageSizeChange:d,className:B,...I}){let c=_(g),l=G[s],h=H[N],P=F(()=>O(t,o,y,p),[t,o,y,p]),f=A(r=>{i||r<1||r>o||r===t||b(r)},[i,o,t,b]),C=t<=1,L=t>=o,R=u("inline-flex items-center justify-center select-none",l.button,h.base),k=(r,x,E,U)=>n("button",{type:"button",onClick:r,disabled:i||x,"aria-label":E,"aria-disabled":i||x,className:u(R,i||x?h.disabled:h.idle),children:U}),W=m!==void 0&&a?(t-1)*a+1:void 0,j=m!==void 0&&a?Math.min(t*a,m):void 0;return w("nav",{"aria-label":c.paginationLabel,className:u("flex items-center",l.gap,B),...I,children:[m!==void 0&&a&&n("span",{className:u("mr-2 text-gray-600 dark:text-gray-400 whitespace-nowrap",l.text),children:M(c.paginationRange,{start:W??0,end:j??0,total:m})}),e&&e.length>0&&d&&w("div",{className:u("mr-2 flex items-center whitespace-nowrap",l.gap,l.text),children:[n("label",{htmlFor:"pagination-page-size",className:"text-gray-600 dark:text-gray-400",children:c.paginationRowsPerPage}),n("select",{id:"pagination-page-size",value:a,onChange:r=>d(Number(r.target.value)),disabled:i,className:u("rounded border border-gray-300 bg-white px-1.5 py-0.5 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200",l.text,i&&"cursor-not-allowed opacity-50"),children:e.map(r=>n("option",{value:r,children:r},r))})]}),w("div",{className:u("flex items-center",l.gap),children:[v&&k(()=>f(1),C,g?.first??c.paginationFirst,n(q,{className:l.icon})),k(()=>f(t-1),C,g?.previous??c.paginationPrevious,n(z,{className:l.icon})),P.map((r,x)=>r==="ellipsis"?n("span",{className:u("inline-flex items-center justify-center select-none",l.button,"text-gray-400 dark:text-gray-500"),"aria-hidden":"true",children:"\u2026"},`ellipsis-${x}`):n("button",{type:"button",onClick:()=>f(r),disabled:i,"aria-current":r===t?"page":void 0,"aria-label":M(c.paginationPage,{page:r}),className:u(R,r===t?h.active:i?h.disabled:h.idle),children:r},r)),k(()=>f(t+1),L,g?.next??c.paginationNext,n($,{className:l.icon})),v&&k(()=>f(o),L,g?.last??c.paginationLast,n(D,{className:l.icon}))]})]})}export{T as Pagination};
@@ -1 +1 @@
1
- "use strict";var d=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var v=(e,r)=>{for(var s in r)d(e,s,{get:r[s],enumerable:!0})},k=(e,r,s,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of P(r))!h.call(e,a)&&a!==s&&d(e,a,{get:()=>r[a],enumerable:!(o=w(r,a))||o.enumerable});return e};var B=e=>k(d({},"__esModule",{value:!0}),e);var _={};v(_,{ProgressBar:()=>p});module.exports=B(_);var n=require("../../lib/cn.cjs"),t=require("react/jsx-runtime"),C={xs:"h-1",sm:"h-1.5",md:"h-2.5",lg:"h-4",xl:"h-6"},N={default:"bg-gray-500 dark:bg-gray-400",primary:"bg-blue-600 dark:bg-blue-500",success:"bg-green-600 dark:bg-green-500",warning:"bg-yellow-500 dark:bg-yellow-400",error:"bg-red-600 dark:bg-red-500",info:"bg-cyan-600 dark:bg-cyan-500"},z={default:"text-gray-700 dark:text-gray-300",primary:"text-blue-600 dark:text-blue-400",success:"text-green-600 dark:text-green-400",warning:"text-yellow-600 dark:text-yellow-400",error:"text-red-600 dark:text-red-400",info:"text-cyan-600 dark:text-cyan-400"},f="bg-[repeating-linear-gradient(45deg,transparent,transparent_10px,rgba(255,255,255,0.2)_10px,rgba(255,255,255,0.2)_20px)]",R={default:"bg-gradient-to-r from-gray-400 to-gray-600",primary:"bg-gradient-to-r from-blue-400 to-blue-700",success:"bg-gradient-to-r from-green-400 to-green-700",warning:"bg-gradient-to-r from-yellow-300 to-yellow-600",error:"bg-gradient-to-r from-red-400 to-red-700",info:"bg-gradient-to-r from-cyan-400 to-cyan-700"};function p({value:e=0,indeterminate:r=!1,size:s="md",color:o="primary",variant:a="default",showValue:g=!1,valueFormat:m,label:i,animated:c=!0,className:b,...y}){let l=Math.min(100,Math.max(0,e)),u=a==="gradient"?R[o]:N[o],x=m?m(l):`${Math.round(l)}%`;return(0,t.jsxs)("div",{className:(0,n.cn)("w-full",b),...y,children:[(i||g)&&(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[i&&(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:i}),g&&!r&&(0,t.jsx)("span",{className:(0,n.cn)("text-sm font-semibold",z[o],!i&&"ml-auto"),children:x})]}),(0,t.jsx)("div",{role:"progressbar","aria-valuenow":r?void 0:l,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i,className:(0,n.cn)("relative w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700",C[s]),children:r?(0,t.jsx)("div",{className:(0,n.cn)("absolute h-full w-1/3 rounded-full",u,a==="striped"&&f,"animate-[progress-indeterminate_1.5s_ease-in-out_infinite]")}):(0,t.jsx)("div",{className:(0,n.cn)("h-full rounded-full",u,a==="striped"&&f,c&&"transition-[width] duration-300 ease-out"),style:{width:`${l}%`}})})]})}p.displayName="ProgressBar";0&&(module.exports={ProgressBar});
1
+ "use strict";var d=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var v=(e,r)=>{for(var s in r)d(e,s,{get:r[s],enumerable:!0})},k=(e,r,s,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of P(r))!h.call(e,a)&&a!==s&&d(e,a,{get:()=>r[a],enumerable:!(o=w(r,a))||o.enumerable});return e};var B=e=>k(d({},"__esModule",{value:!0}),e);var _={};v(_,{ProgressBar:()=>p});module.exports=B(_);var n=require("../../lib/cn.cjs"),t=require("react/jsx-runtime"),C={xs:"h-1",sm:"h-1.5",md:"h-2.5",lg:"h-4",xl:"h-6"},N={default:"bg-gray-500 dark:bg-gray-400",primary:"bg-blue-600 dark:bg-blue-500",success:"bg-green-600 dark:bg-green-500",warning:"bg-yellow-500 dark:bg-yellow-400",error:"bg-red-600 dark:bg-red-500",info:"bg-cyan-600 dark:bg-cyan-500"},z={default:"text-gray-700 dark:text-gray-300",primary:"text-blue-600 dark:text-blue-400",success:"text-green-700 dark:text-green-400",warning:"text-yellow-700 dark:text-yellow-400",error:"text-red-600 dark:text-red-400",info:"text-cyan-700 dark:text-cyan-400"},f="bg-[repeating-linear-gradient(45deg,transparent,transparent_10px,rgba(255,255,255,0.2)_10px,rgba(255,255,255,0.2)_20px)]",R={default:"bg-gradient-to-r from-gray-400 to-gray-600",primary:"bg-gradient-to-r from-blue-400 to-blue-700",success:"bg-gradient-to-r from-green-400 to-green-700",warning:"bg-gradient-to-r from-yellow-300 to-yellow-600",error:"bg-gradient-to-r from-red-400 to-red-700",info:"bg-gradient-to-r from-cyan-400 to-cyan-700"};function p({value:e=0,indeterminate:r=!1,size:s="md",color:o="primary",variant:a="default",showValue:g=!1,valueFormat:m,label:i,animated:c=!0,className:b,...y}){let l=Math.min(100,Math.max(0,e)),u=a==="gradient"?R[o]:N[o],x=m?m(l):`${Math.round(l)}%`;return(0,t.jsxs)("div",{className:(0,n.cn)("w-full",b),...y,children:[(i||g)&&(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[i&&(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:i}),g&&!r&&(0,t.jsx)("span",{className:(0,n.cn)("text-sm font-semibold",z[o],!i&&"ml-auto"),children:x})]}),(0,t.jsx)("div",{role:"progressbar","aria-valuenow":r?void 0:l,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i,className:(0,n.cn)("relative w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700",C[s]),children:r?(0,t.jsx)("div",{className:(0,n.cn)("absolute h-full w-1/3 rounded-full",u,a==="striped"&&f,"animate-[progress-indeterminate_1.5s_ease-in-out_infinite]")}):(0,t.jsx)("div",{className:(0,n.cn)("h-full rounded-full",u,a==="striped"&&f,c&&"transition-[width] duration-300 ease-out"),style:{width:`${l}%`}})})]})}p.displayName="ProgressBar";0&&(module.exports={ProgressBar});
@@ -1 +1 @@
1
- import{cn as e}from"../../lib/cn.js";import{jsx as a,jsxs as m}from"react/jsx-runtime";var x={xs:"h-1",sm:"h-1.5",md:"h-2.5",lg:"h-4",xl:"h-6"},w={default:"bg-gray-500 dark:bg-gray-400",primary:"bg-blue-600 dark:bg-blue-500",success:"bg-green-600 dark:bg-green-500",warning:"bg-yellow-500 dark:bg-yellow-400",error:"bg-red-600 dark:bg-red-500",info:"bg-cyan-600 dark:bg-cyan-500"},P={default:"text-gray-700 dark:text-gray-300",primary:"text-blue-600 dark:text-blue-400",success:"text-green-600 dark:text-green-400",warning:"text-yellow-600 dark:text-yellow-400",error:"text-red-600 dark:text-red-400",info:"text-cyan-600 dark:text-cyan-400"},g="bg-[repeating-linear-gradient(45deg,transparent,transparent_10px,rgba(255,255,255,0.2)_10px,rgba(255,255,255,0.2)_20px)]",h={default:"bg-gradient-to-r from-gray-400 to-gray-600",primary:"bg-gradient-to-r from-blue-400 to-blue-700",success:"bg-gradient-to-r from-green-400 to-green-700",warning:"bg-gradient-to-r from-yellow-300 to-yellow-600",error:"bg-gradient-to-r from-red-400 to-red-700",info:"bg-gradient-to-r from-cyan-400 to-cyan-700"};function v({value:u=0,indeterminate:s=!1,size:f="md",color:o="primary",variant:n="default",showValue:i=!1,valueFormat:l,label:r,animated:p=!0,className:c,...b}){let t=Math.min(100,Math.max(0,u)),d=n==="gradient"?h[o]:w[o],y=l?l(t):`${Math.round(t)}%`;return m("div",{className:e("w-full",c),...b,children:[(r||i)&&m("div",{className:"flex items-center justify-between mb-1",children:[r&&a("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:r}),i&&!s&&a("span",{className:e("text-sm font-semibold",P[o],!r&&"ml-auto"),children:y})]}),a("div",{role:"progressbar","aria-valuenow":s?void 0:t,"aria-valuemin":0,"aria-valuemax":100,"aria-label":r,className:e("relative w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700",x[f]),children:s?a("div",{className:e("absolute h-full w-1/3 rounded-full",d,n==="striped"&&g,"animate-[progress-indeterminate_1.5s_ease-in-out_infinite]")}):a("div",{className:e("h-full rounded-full",d,n==="striped"&&g,p&&"transition-[width] duration-300 ease-out"),style:{width:`${t}%`}})})]})}v.displayName="ProgressBar";export{v as ProgressBar};
1
+ import{cn as e}from"../../lib/cn.js";import{jsx as a,jsxs as m}from"react/jsx-runtime";var x={xs:"h-1",sm:"h-1.5",md:"h-2.5",lg:"h-4",xl:"h-6"},w={default:"bg-gray-500 dark:bg-gray-400",primary:"bg-blue-600 dark:bg-blue-500",success:"bg-green-600 dark:bg-green-500",warning:"bg-yellow-500 dark:bg-yellow-400",error:"bg-red-600 dark:bg-red-500",info:"bg-cyan-600 dark:bg-cyan-500"},P={default:"text-gray-700 dark:text-gray-300",primary:"text-blue-600 dark:text-blue-400",success:"text-green-700 dark:text-green-400",warning:"text-yellow-700 dark:text-yellow-400",error:"text-red-600 dark:text-red-400",info:"text-cyan-700 dark:text-cyan-400"},g="bg-[repeating-linear-gradient(45deg,transparent,transparent_10px,rgba(255,255,255,0.2)_10px,rgba(255,255,255,0.2)_20px)]",h={default:"bg-gradient-to-r from-gray-400 to-gray-600",primary:"bg-gradient-to-r from-blue-400 to-blue-700",success:"bg-gradient-to-r from-green-400 to-green-700",warning:"bg-gradient-to-r from-yellow-300 to-yellow-600",error:"bg-gradient-to-r from-red-400 to-red-700",info:"bg-gradient-to-r from-cyan-400 to-cyan-700"};function v({value:u=0,indeterminate:s=!1,size:f="md",color:o="primary",variant:n="default",showValue:i=!1,valueFormat:l,label:r,animated:p=!0,className:c,...b}){let t=Math.min(100,Math.max(0,u)),d=n==="gradient"?h[o]:w[o],y=l?l(t):`${Math.round(t)}%`;return m("div",{className:e("w-full",c),...b,children:[(r||i)&&m("div",{className:"flex items-center justify-between mb-1",children:[r&&a("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:r}),i&&!s&&a("span",{className:e("text-sm font-semibold",P[o],!r&&"ml-auto"),children:y})]}),a("div",{role:"progressbar","aria-valuenow":s?void 0:t,"aria-valuemin":0,"aria-valuemax":100,"aria-label":r,className:e("relative w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700",x[f]),children:s?a("div",{className:e("absolute h-full w-1/3 rounded-full",d,n==="striped"&&g,"animate-[progress-indeterminate_1.5s_ease-in-out_infinite]")}):a("div",{className:e("h-full rounded-full",d,n==="striped"&&g,p&&"transition-[width] duration-300 ease-out"),style:{width:`${t}%`}})})]})}v.displayName="ProgressBar";export{v as ProgressBar};
@@ -1 +1 @@
1
- "use strict";"use client";var N=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var j=(e,r)=>{for(var s in r)N(e,s,{get:r[s],enumerable:!0})},O=(e,r,s,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Z(r))!_.call(e,a)&&a!==s&&N(e,a,{get:()=>r[a],enumerable:!(i=Y(r,a))||i.enumerable});return e};var ee=e=>O(N({},"__esModule",{value:!0}),e);var ne={};j(ne,{RadioButton:()=>M});module.exports=ee(ne);var y=require("react"),t=require("../../lib/cn.cjs"),o=require("react/jsx-runtime"),re=e=>({sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"})[e],te=e=>({sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"})[e],oe=(e,r,s,i,a,v,c,d)=>{if(r)return(0,t.cn)("border-2",i?"":"border-red-500",s&&!a?"bg-red-500":"");switch(e){case"filled":return(0,t.cn)("border-2",d?"":"border-gray-300 dark:border-gray-600",s?v?"":"bg-blue-600 border-blue-600 dark:bg-blue-500 dark:border-blue-500":c?"":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700");case"outlined":return(0,t.cn)("border-[3px]",d?"":s?"border-blue-600 dark:border-blue-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800");default:return(0,t.cn)("border-2",d?"":s?"border-blue-600 dark:border-blue-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800")}},se={},M=(0,y.forwardRef)(({label:e,description:r,value:s,checked:i,defaultChecked:a=!1,onCheckedChange:v,size:c="md",variant:d="default",labelPosition:b="right",error:C=!1,disabled:u=!1,readOnly:l=!1,required:z=!1,checkedColor:f,uncheckedColor:k,borderColor:x,labelColor:w,errorColor:m,dotColor:p,hoverColor:P,focusRingColor:B,showFocusRing:E=!0,className:H,containerClassName:L,id:T,onClick:D,...F},W)=>{let $=i!==void 0,q=(0,y.useId)(),h=T||q,R=typeof C=="string"?C:void 0,S=!!C,V=n=>{u||l||v?.(n.target.checked)},A=n=>{D?.(n),l&&n.preventDefault()},G=w?"":"text-gray-700 dark:text-gray-200",J=m?"":"text-red-500",K=P?"":"hover:border-blue-500 dark:hover:border-blue-400",Q=B?"":"focus-visible:ring-blue-500",I=n=>{let g={};return f&&n&&(g.backgroundColor=f,g.borderColor=f),k&&!n&&(g.backgroundColor=k),x&&(g.borderColor=x),(0,o.jsx)("div",{className:(0,t.cn)("rounded-full transition-all duration-200",re(c),oe(d,S,n,m,p,f,k,x),!u&&!l&&K,!u&&!l&&E&&"peer-focus-visible:ring-2 ring-offset-2",!u&&!l&&E&&Q,H,n?"hidden peer-checked:block":"peer-checked:hidden"),style:g,children:n&&(0,o.jsx)("div",{className:(0,t.cn)("rounded-full absolute inset-0 m-auto transition-all duration-200",te(c),p?"":d==="outlined"||d==="default"?"bg-blue-600 dark:bg-blue-500":"bg-white"),style:p?{backgroundColor:p}:void 0})})},U=w?{color:w}:{},X=m?{color:m}:{};return(0,o.jsxs)("div",{className:(0,t.cn)("inline-flex flex-col",L),style:se,children:[(0,o.jsxs)("label",{className:(0,t.cn)("inline-flex items-center cursor-pointer",u&&"opacity-50 cursor-not-allowed",l&&"cursor-default",b==="left"&&"flex-row-reverse"),htmlFor:h,children:[(0,o.jsxs)("div",{className:"relative inline-flex items-center",children:[(0,o.jsx)("input",{ref:W,type:"radio",id:h,value:s,...$?{checked:i}:{defaultChecked:a},onChange:V,onClick:A,disabled:u,readOnly:l,required:z,"aria-invalid":S,"aria-describedby":R?`${h}-error`:void 0,className:"sr-only peer",tabIndex:l?-1:void 0,...F}),I(!1),I(!0)]}),e&&(0,o.jsxs)("span",{className:(0,t.cn)("select-none",b==="left"?"mr-2":"ml-2",G,u&&"opacity-50"),style:U,children:[e,z&&(0,o.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]})]}),r&&!S&&(0,o.jsx)("p",{className:(0,t.cn)("text-sm text-gray-500 dark:text-gray-400 mt-1",b==="left"?"text-right":"ml-7"),children:r}),R&&(0,o.jsx)("p",{id:`${h}-error`,className:(0,t.cn)("text-sm mt-1",b==="left"?"text-right":"ml-7",J),style:X,children:R})]})});M.displayName="RadioButton";0&&(module.exports={RadioButton});
1
+ "use strict";"use client";var N=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var j=(e,r)=>{for(var s in r)N(e,s,{get:r[s],enumerable:!0})},O=(e,r,s,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Z(r))!_.call(e,a)&&a!==s&&N(e,a,{get:()=>r[a],enumerable:!(i=Y(r,a))||i.enumerable});return e};var ee=e=>O(N({},"__esModule",{value:!0}),e);var ne={};j(ne,{RadioButton:()=>M});module.exports=ee(ne);var y=require("react"),t=require("../../lib/cn.cjs"),o=require("react/jsx-runtime"),re=e=>({sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"})[e],te=e=>({sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"})[e],oe=(e,r,s,i,a,k,c,d)=>{if(r)return(0,t.cn)("border-2",i?"":"border-red-500",s&&!a?"bg-red-500":"");switch(e){case"filled":return(0,t.cn)("border-2",d?"":"border-gray-300 dark:border-gray-600",s?k?"":"bg-blue-600 border-blue-600 dark:bg-blue-500 dark:border-blue-500":c?"":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700");case"outlined":return(0,t.cn)("border-[3px]",d?"":s?"border-blue-600 dark:border-blue-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800");default:return(0,t.cn)("border-2",d?"":s?"border-blue-600 dark:border-blue-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800")}},se={},M=(0,y.forwardRef)(({label:e,description:r,value:s,checked:i,defaultChecked:a=!1,onCheckedChange:k,size:c="md",variant:d="default",labelPosition:b="right",error:v=!1,disabled:u=!1,readOnly:l=!1,required:z=!1,checkedColor:f,uncheckedColor:x,borderColor:C,labelColor:w,errorColor:m,dotColor:p,hoverColor:P,focusRingColor:B,showFocusRing:E=!0,className:H,containerClassName:L,id:T,onClick:D,...F},W)=>{let $=i!==void 0,q=(0,y.useId)(),h=T||q,R=typeof v=="string"?v:void 0,S=!!v,V=n=>{u||l||k?.(n.target.checked)},A=n=>{D?.(n),l&&n.preventDefault()},G=w?"":"text-gray-700 dark:text-gray-200",J=m?"":"text-red-600 dark:text-red-400",K=P?"":"hover:border-blue-500 dark:hover:border-blue-400",Q=B?"":"focus-visible:ring-blue-500",I=n=>{let g={};return f&&n&&(g.backgroundColor=f,g.borderColor=f),x&&!n&&(g.backgroundColor=x),C&&(g.borderColor=C),(0,o.jsx)("div",{className:(0,t.cn)("rounded-full transition-all duration-200",re(c),oe(d,S,n,m,p,f,x,C),!u&&!l&&K,!u&&!l&&E&&"peer-focus-visible:ring-2 ring-offset-2",!u&&!l&&E&&Q,H,n?"hidden peer-checked:block":"peer-checked:hidden"),style:g,children:n&&(0,o.jsx)("div",{className:(0,t.cn)("rounded-full absolute inset-0 m-auto transition-all duration-200",te(c),p?"":d==="outlined"||d==="default"?"bg-blue-600 dark:bg-blue-500":"bg-white"),style:p?{backgroundColor:p}:void 0})})},U=w?{color:w}:{},X=m?{color:m}:{};return(0,o.jsxs)("div",{className:(0,t.cn)("inline-flex flex-col",L),style:se,children:[(0,o.jsxs)("label",{className:(0,t.cn)("inline-flex items-center cursor-pointer",u&&"opacity-50 cursor-not-allowed",l&&"cursor-default",b==="left"&&"flex-row-reverse"),htmlFor:h,children:[(0,o.jsxs)("div",{className:"relative inline-flex items-center",children:[(0,o.jsx)("input",{ref:W,type:"radio",id:h,value:s,...$?{checked:i}:{defaultChecked:a},onChange:V,onClick:A,disabled:u,readOnly:l,required:z,"aria-invalid":S,"aria-describedby":R?`${h}-error`:void 0,className:"sr-only peer",tabIndex:l?-1:void 0,...F}),I(!1),I(!0)]}),e&&(0,o.jsxs)("span",{className:(0,t.cn)("select-none",b==="left"?"mr-2":"ml-2",G,u&&"opacity-50"),style:U,children:[e,z&&(0,o.jsx)("span",{className:"text-red-600 dark:text-red-400 ml-1",children:"*"})]})]}),r&&!S&&(0,o.jsx)("p",{className:(0,t.cn)("text-sm text-gray-500 dark:text-gray-400 mt-1",b==="left"?"text-right":"ml-7"),children:r}),R&&(0,o.jsx)("p",{id:`${h}-error`,className:(0,t.cn)("text-sm mt-1",b==="left"?"text-right":"ml-7",J),style:X,children:R})]})});M.displayName="RadioButton";0&&(module.exports={RadioButton});
@@ -1 +1 @@
1
- "use client";import{useId as U,forwardRef as X}from"react";import{cn as e}from"../../lib/cn.js";import{jsx as i,jsxs as h}from"react/jsx-runtime";var Y=t=>({sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"})[t],Z=t=>({sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"})[t],_=(t,a,l,u,y,v,g,s)=>{if(a)return e("border-2",u?"":"border-red-500",l&&!y?"bg-red-500":"");switch(t){case"filled":return e("border-2",s?"":"border-gray-300 dark:border-gray-600",l?v?"":"bg-blue-600 border-blue-600 dark:bg-blue-500 dark:border-blue-500":g?"":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700");case"outlined":return e("border-[3px]",s?"":l?"border-blue-600 dark:border-blue-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800");default:return e("border-2",s?"":l?"border-blue-600 dark:border-blue-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800")}},j={},O=X(({label:t,description:a,value:l,checked:u,defaultChecked:y=!1,onCheckedChange:v,size:g="md",variant:s="default",labelPosition:c="right",error:C=!1,disabled:n=!1,readOnly:o=!1,required:N=!1,checkedColor:b,uncheckedColor:k,borderColor:x,labelColor:w,errorColor:f,dotColor:m,hoverColor:I,focusRingColor:M,showFocusRing:z=!0,className:P,containerClassName:B,id:H,onClick:L,...T},D)=>{let F=u!==void 0,W=U(),p=H||W,R=typeof C=="string"?C:void 0,S=!!C,$=r=>{n||o||v?.(r.target.checked)},q=r=>{L?.(r),o&&r.preventDefault()},V=w?"":"text-gray-700 dark:text-gray-200",A=f?"":"text-red-500",G=I?"":"hover:border-blue-500 dark:hover:border-blue-400",J=M?"":"focus-visible:ring-blue-500",E=r=>{let d={};return b&&r&&(d.backgroundColor=b,d.borderColor=b),k&&!r&&(d.backgroundColor=k),x&&(d.borderColor=x),i("div",{className:e("rounded-full transition-all duration-200",Y(g),_(s,S,r,f,m,b,k,x),!n&&!o&&G,!n&&!o&&z&&"peer-focus-visible:ring-2 ring-offset-2",!n&&!o&&z&&J,P,r?"hidden peer-checked:block":"peer-checked:hidden"),style:d,children:r&&i("div",{className:e("rounded-full absolute inset-0 m-auto transition-all duration-200",Z(g),m?"":s==="outlined"||s==="default"?"bg-blue-600 dark:bg-blue-500":"bg-white"),style:m?{backgroundColor:m}:void 0})})},K=w?{color:w}:{},Q=f?{color:f}:{};return h("div",{className:e("inline-flex flex-col",B),style:j,children:[h("label",{className:e("inline-flex items-center cursor-pointer",n&&"opacity-50 cursor-not-allowed",o&&"cursor-default",c==="left"&&"flex-row-reverse"),htmlFor:p,children:[h("div",{className:"relative inline-flex items-center",children:[i("input",{ref:D,type:"radio",id:p,value:l,...F?{checked:u}:{defaultChecked:y},onChange:$,onClick:q,disabled:n,readOnly:o,required:N,"aria-invalid":S,"aria-describedby":R?`${p}-error`:void 0,className:"sr-only peer",tabIndex:o?-1:void 0,...T}),E(!1),E(!0)]}),t&&h("span",{className:e("select-none",c==="left"?"mr-2":"ml-2",V,n&&"opacity-50"),style:K,children:[t,N&&i("span",{className:"text-red-500 ml-1",children:"*"})]})]}),a&&!S&&i("p",{className:e("text-sm text-gray-500 dark:text-gray-400 mt-1",c==="left"?"text-right":"ml-7"),children:a}),R&&i("p",{id:`${p}-error`,className:e("text-sm mt-1",c==="left"?"text-right":"ml-7",A),style:Q,children:R})]})});O.displayName="RadioButton";export{O as RadioButton};
1
+ "use client";import{useId as U,forwardRef as X}from"react";import{cn as e}from"../../lib/cn.js";import{jsx as i,jsxs as h}from"react/jsx-runtime";var Y=t=>({sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"})[t],Z=t=>({sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"})[t],_=(t,a,l,u,y,k,g,s)=>{if(a)return e("border-2",u?"":"border-red-500",l&&!y?"bg-red-500":"");switch(t){case"filled":return e("border-2",s?"":"border-gray-300 dark:border-gray-600",l?k?"":"bg-blue-600 border-blue-600 dark:bg-blue-500 dark:border-blue-500":g?"":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700");case"outlined":return e("border-[3px]",s?"":l?"border-blue-600 dark:border-blue-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800");default:return e("border-2",s?"":l?"border-blue-600 dark:border-blue-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800")}},j={},O=X(({label:t,description:a,value:l,checked:u,defaultChecked:y=!1,onCheckedChange:k,size:g="md",variant:s="default",labelPosition:c="right",error:v=!1,disabled:n=!1,readOnly:o=!1,required:N=!1,checkedColor:b,uncheckedColor:x,borderColor:C,labelColor:w,errorColor:f,dotColor:m,hoverColor:I,focusRingColor:M,showFocusRing:z=!0,className:P,containerClassName:B,id:H,onClick:L,...T},D)=>{let F=u!==void 0,W=U(),p=H||W,R=typeof v=="string"?v:void 0,S=!!v,$=r=>{n||o||k?.(r.target.checked)},q=r=>{L?.(r),o&&r.preventDefault()},V=w?"":"text-gray-700 dark:text-gray-200",A=f?"":"text-red-600 dark:text-red-400",G=I?"":"hover:border-blue-500 dark:hover:border-blue-400",J=M?"":"focus-visible:ring-blue-500",E=r=>{let d={};return b&&r&&(d.backgroundColor=b,d.borderColor=b),x&&!r&&(d.backgroundColor=x),C&&(d.borderColor=C),i("div",{className:e("rounded-full transition-all duration-200",Y(g),_(s,S,r,f,m,b,x,C),!n&&!o&&G,!n&&!o&&z&&"peer-focus-visible:ring-2 ring-offset-2",!n&&!o&&z&&J,P,r?"hidden peer-checked:block":"peer-checked:hidden"),style:d,children:r&&i("div",{className:e("rounded-full absolute inset-0 m-auto transition-all duration-200",Z(g),m?"":s==="outlined"||s==="default"?"bg-blue-600 dark:bg-blue-500":"bg-white"),style:m?{backgroundColor:m}:void 0})})},K=w?{color:w}:{},Q=f?{color:f}:{};return h("div",{className:e("inline-flex flex-col",B),style:j,children:[h("label",{className:e("inline-flex items-center cursor-pointer",n&&"opacity-50 cursor-not-allowed",o&&"cursor-default",c==="left"&&"flex-row-reverse"),htmlFor:p,children:[h("div",{className:"relative inline-flex items-center",children:[i("input",{ref:D,type:"radio",id:p,value:l,...F?{checked:u}:{defaultChecked:y},onChange:$,onClick:q,disabled:n,readOnly:o,required:N,"aria-invalid":S,"aria-describedby":R?`${p}-error`:void 0,className:"sr-only peer",tabIndex:o?-1:void 0,...T}),E(!1),E(!0)]}),t&&h("span",{className:e("select-none",c==="left"?"mr-2":"ml-2",V,n&&"opacity-50"),style:K,children:[t,N&&i("span",{className:"text-red-600 dark:text-red-400 ml-1",children:"*"})]})]}),a&&!S&&i("p",{className:e("text-sm text-gray-500 dark:text-gray-400 mt-1",c==="left"?"text-right":"ml-7"),children:a}),R&&i("p",{id:`${p}-error`,className:e("text-sm mt-1",c==="left"?"text-right":"ml-7",A),style:Q,children:R})]})});O.displayName="RadioButton";export{O as RadioButton};
@@ -1 +1 @@
1
- "use strict";var o=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var x=(s,t)=>{for(var a in t)o(s,a,{get:t[a],enumerable:!0})},g=(s,t,a,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of l(t))!m.call(s,r)&&r!==a&&o(s,r,{get:()=>t[r],enumerable:!(n=d(t,r))||n.enumerable});return s};var p=s=>g(o({},"__esModule",{value:!0}),s);var f={};x(f,{SchemaLegend:()=>N});module.exports=p(f);var i=require("react"),c=require("../../../lib/cn.cjs"),e=require("react/jsx-runtime"),h=()=>(0,e.jsxs)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("path",{d:"M10 1l2 2-5 5M8.5 4.5L11 7"}),(0,e.jsx)("circle",{cx:"4.5",cy:"11.5",r:"3"})]}),v=()=>(0,e.jsx)("span",{className:"text-xs font-bold text-gray-500 w-3.5 text-center",children:"?"}),y=()=>(0,e.jsxs)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:[(0,e.jsx)("circle",{cx:"8",cy:"8",r:"6",className:"fill-blue-500"}),(0,e.jsx)("path",{d:"M5 8h6M8 5l3 3-3 3",stroke:"white",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]}),k=()=>(0,e.jsx)("svg",{className:"w-3.5 h-3.5 text-amber-500",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("path",{d:"M3 2v12M7 4h6M7 8h4M7 12h5"})}),u=()=>(0,e.jsx)("svg",{className:"w-3.5 h-3.5 text-purple-500",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("path",{d:"M4 2v8a4 4 0 008 0V2"})}),N=(0,i.memo)(function({className:t,labels:a}){return(0,e.jsxs)("div",{className:(0,c.cn)("absolute top-3 right-3 z-20 flex items-center gap-4 bg-white dark:bg-gray-800 rounded-lg shadow-md border border-gray-200 dark:border-gray-600 px-3 py-2",t),"data-testid":"schema-legend",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(h,{}),(0,e.jsx)("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.schemaEditorPrimaryKey})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(v,{}),(0,e.jsx)("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.schemaEditorNullable})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(y,{}),(0,e.jsx)("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.schemaEditorForeignKey})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(k,{}),(0,e.jsx)("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.schemaEditorIndex})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(u,{}),(0,e.jsx)("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.schemaEditorUnique})]})]})});0&&(module.exports={SchemaLegend});
1
+ "use strict";var o=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var x=(r,t)=>{for(var a in t)o(r,a,{get:t[a],enumerable:!0})},p=(r,t,a,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of l(t))!m.call(r,s)&&s!==a&&o(r,s,{get:()=>t[s],enumerable:!(n=d(t,s))||n.enumerable});return r};var g=r=>p(o({},"__esModule",{value:!0}),r);var f={};x(f,{SchemaLegend:()=>N});module.exports=g(f);var i=require("react"),c=require("../../../lib/cn.cjs"),e=require("react/jsx-runtime"),h=()=>(0,e.jsxs)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("path",{d:"M10 1l2 2-5 5M8.5 4.5L11 7"}),(0,e.jsx)("circle",{cx:"4.5",cy:"11.5",r:"3"})]}),v=()=>(0,e.jsx)("span",{className:"text-xs font-bold text-gray-500 w-3.5 text-center",children:"?"}),k=()=>(0,e.jsxs)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:[(0,e.jsx)("circle",{cx:"8",cy:"8",r:"6",className:"fill-blue-500"}),(0,e.jsx)("path",{d:"M5 8h6M8 5l3 3-3 3",stroke:"white",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]}),y=()=>(0,e.jsx)("svg",{className:"w-3.5 h-3.5 text-amber-700 dark:text-amber-400",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("path",{d:"M3 2v12M7 4h6M7 8h4M7 12h5"})}),u=()=>(0,e.jsx)("svg",{className:"w-3.5 h-3.5 text-purple-600 dark:text-purple-400",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("path",{d:"M4 2v8a4 4 0 008 0V2"})}),N=(0,i.memo)(function({className:t,labels:a}){return(0,e.jsxs)("div",{className:(0,c.cn)("absolute top-3 right-3 z-20 flex items-center gap-4 bg-white dark:bg-gray-800 rounded-lg shadow-md border border-gray-200 dark:border-gray-600 px-3 py-2",t),"data-testid":"schema-legend",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(h,{}),(0,e.jsx)("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.schemaEditorPrimaryKey})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(v,{}),(0,e.jsx)("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.schemaEditorNullable})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(k,{}),(0,e.jsx)("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.schemaEditorForeignKey})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(y,{}),(0,e.jsx)("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.schemaEditorIndex})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(u,{}),(0,e.jsx)("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.schemaEditorUnique})]})]})});0&&(module.exports={SchemaLegend});
@@ -1 +1 @@
1
- import{memo as r}from"react";import{cn as o}from"../../../lib/cn.js";import{jsx as e,jsxs as t}from"react/jsx-runtime";var n=()=>t("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("path",{d:"M10 1l2 2-5 5M8.5 4.5L11 7"}),e("circle",{cx:"4.5",cy:"11.5",r:"3"})]}),i=()=>e("span",{className:"text-xs font-bold text-gray-500 w-3.5 text-center",children:"?"}),c=()=>t("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:[e("circle",{cx:"8",cy:"8",r:"6",className:"fill-blue-500"}),e("path",{d:"M5 8h6M8 5l3 3-3 3",stroke:"white",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]}),d=()=>e("svg",{className:"w-3.5 h-3.5 text-amber-500",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e("path",{d:"M3 2v12M7 4h6M7 8h4M7 12h5"})}),l=()=>e("svg",{className:"w-3.5 h-3.5 text-purple-500",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e("path",{d:"M4 2v8a4 4 0 008 0V2"})}),p=r(function({className:s,labels:a}){return t("div",{className:o("absolute top-3 right-3 z-20 flex items-center gap-4 bg-white dark:bg-gray-800 rounded-lg shadow-md border border-gray-200 dark:border-gray-600 px-3 py-2",s),"data-testid":"schema-legend",children:[t("div",{className:"flex items-center gap-1.5",children:[e(n,{}),e("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.schemaEditorPrimaryKey})]}),t("div",{className:"flex items-center gap-1.5",children:[e(i,{}),e("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.schemaEditorNullable})]}),t("div",{className:"flex items-center gap-1.5",children:[e(c,{}),e("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.schemaEditorForeignKey})]}),t("div",{className:"flex items-center gap-1.5",children:[e(d,{}),e("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.schemaEditorIndex})]}),t("div",{className:"flex items-center gap-1.5",children:[e(l,{}),e("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.schemaEditorUnique})]})]})});export{p as SchemaLegend};
1
+ import{memo as s}from"react";import{cn as o}from"../../../lib/cn.js";import{jsx as e,jsxs as t}from"react/jsx-runtime";var n=()=>t("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("path",{d:"M10 1l2 2-5 5M8.5 4.5L11 7"}),e("circle",{cx:"4.5",cy:"11.5",r:"3"})]}),i=()=>e("span",{className:"text-xs font-bold text-gray-500 w-3.5 text-center",children:"?"}),c=()=>t("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:[e("circle",{cx:"8",cy:"8",r:"6",className:"fill-blue-500"}),e("path",{d:"M5 8h6M8 5l3 3-3 3",stroke:"white",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]}),d=()=>e("svg",{className:"w-3.5 h-3.5 text-amber-700 dark:text-amber-400",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e("path",{d:"M3 2v12M7 4h6M7 8h4M7 12h5"})}),l=()=>e("svg",{className:"w-3.5 h-3.5 text-purple-600 dark:text-purple-400",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e("path",{d:"M4 2v8a4 4 0 008 0V2"})}),g=s(function({className:r,labels:a}){return t("div",{className:o("absolute top-3 right-3 z-20 flex items-center gap-4 bg-white dark:bg-gray-800 rounded-lg shadow-md border border-gray-200 dark:border-gray-600 px-3 py-2",r),"data-testid":"schema-legend",children:[t("div",{className:"flex items-center gap-1.5",children:[e(n,{}),e("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.schemaEditorPrimaryKey})]}),t("div",{className:"flex items-center gap-1.5",children:[e(i,{}),e("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.schemaEditorNullable})]}),t("div",{className:"flex items-center gap-1.5",children:[e(c,{}),e("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.schemaEditorForeignKey})]}),t("div",{className:"flex items-center gap-1.5",children:[e(d,{}),e("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.schemaEditorIndex})]}),t("div",{className:"flex items-center gap-1.5",children:[e(l,{}),e("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.schemaEditorUnique})]})]})});export{g as SchemaLegend};
@@ -1 +1 @@
1
- "use strict";var C=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var J=Object.prototype.hasOwnProperty;var Q=(h,o)=>{for(var m in o)C(h,m,{get:o[m],enumerable:!0})},Z=(h,o,m,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of X(o))!J.call(h,a)&&a!==m&&C(h,a,{get:()=>o[a],enumerable:!(s=Y(o,a))||s.enumerable});return h};var $=h=>Z(C({},"__esModule",{value:!0}),h);var ae={};Q(ae,{SchemaTableRenderer:()=>re});module.exports=$(ae);var l=require("react"),g=require("../../../lib/cn.cjs"),d=require("../utils/geometry.cjs"),_=require("../utils/schema-helpers.cjs"),M=require("../../../lib/ui-labels.cjs"),e=require("react/jsx-runtime"),P=()=>(0,e.jsxs)("svg",{className:"w-3.5 h-3.5 text-indigo-500 flex-shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("path",{d:"M10 1l2 2-5 5M8.5 4.5L11 7"}),(0,e.jsx)("circle",{cx:"4.5",cy:"11.5",r:"3"})]}),V=()=>(0,e.jsxs)("svg",{className:"w-3.5 h-3.5 flex-shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:[(0,e.jsx)("circle",{cx:"8",cy:"8",r:"6",className:"fill-blue-500"}),(0,e.jsx)("path",{d:"M5 8h6M8 5l3 3-3 3",stroke:"white",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]}),O=({collapsed:h})=>(0,e.jsx)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:h?(0,e.jsx)("path",{d:"M6 3l5 5-5 5V3z"}):(0,e.jsx)("path",{d:"M3 6l5 5 5-5H3z"})}),F=()=>(0,e.jsx)("svg",{className:"w-3.5 h-3.5 text-amber-500 flex-shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("path",{d:"M3 2v12M7 4h6M7 8h4M7 12h5"})}),H=()=>(0,e.jsx)("svg",{className:"w-3.5 h-3.5 text-purple-500 flex-shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("path",{d:"M4 2v8a4 4 0 008 0V2"})}),ee=()=>(0,e.jsx)("svg",{className:"w-3 h-3",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:(0,e.jsx)("path",{d:"M4 8h8"})}),te=()=>(0,e.jsxs)("svg",{className:"w-3 h-3 text-gray-300",viewBox:"0 0 16 16",fill:"currentColor",children:[(0,e.jsx)("circle",{cx:"5",cy:"4",r:"1.5"}),(0,e.jsx)("circle",{cx:"11",cy:"4",r:"1.5"}),(0,e.jsx)("circle",{cx:"5",cy:"8",r:"1.5"}),(0,e.jsx)("circle",{cx:"11",cy:"8",r:"1.5"}),(0,e.jsx)("circle",{cx:"5",cy:"12",r:"1.5"}),(0,e.jsx)("circle",{cx:"11",cy:"12",r:"1.5"})]}),oe=(0,l.memo)(function({field:o,tableId:m,editable:s,readOnly:a,disabled:c,onFieldChange:b,labels:x}){let[k,v]=(0,l.useState)(!1),[f,u]=(0,l.useState)(o.defaultValue??""),w=s&&!a&&!c,N=()=>{v(!1),b?.(m,o.id,{defaultValue:f||void 0})};return w?k?(0,e.jsx)("input",{className:"text-xs w-16 text-emerald-500 bg-transparent border-b border-emerald-300 outline-none focus:ring-0 p-0 flex-shrink-0","aria-label":(0,M.formatUILabel)(x.schemaEditorDefaultValueFor,{field:o.name}),value:f,onChange:p=>u(p.target.value),onBlur:N,onKeyDown:p=>{p.key==="Enter"&&N(),p.key==="Escape"&&v(!1)},onMouseDown:p=>p.stopPropagation(),autoFocus:!0}):o.defaultValue?(0,e.jsxs)("button",{type:"button",className:"text-xs text-emerald-500 flex-shrink-0 truncate max-w-16 cursor-pointer",onClick:p=>{p.stopPropagation(),u(o.defaultValue??""),v(!0)},onMouseDown:p=>p.stopPropagation(),title:(0,M.formatUILabel)(x.schemaEditorDefaultValue,{value:o.defaultValue}),children:["= ",o.defaultValue]}):(0,e.jsx)("button",{type:"button",className:"text-xs text-gray-300 flex-shrink-0 opacity-0 group-hover:opacity-30 hover:!opacity-100 cursor-pointer transition-opacity",onClick:p=>{p.stopPropagation(),u(""),v(!0)},onMouseDown:p=>p.stopPropagation(),title:x.schemaEditorSetDefaultValue,children:"= \u2205"}):o.defaultValue?(0,e.jsxs)("span",{className:"text-xs text-emerald-500 flex-shrink-0 truncate max-w-16",title:(0,M.formatUILabel)(x.schemaEditorDefaultValue,{value:o.defaultValue}),children:["= ",o.defaultValue]}):null}),re=(0,l.memo)(function({table:o,selected:m,disabled:s,readOnly:a,editable:c,dropTarget:b,fieldTypes:x,onTableNameChange:k,onTableNotesChange:v,onToggleCollapse:f,onFieldChange:u,onFieldAdd:w,onFieldRemove:N,onFieldReorder:p,onResizeStart:K,labels:i}){let L=o.width??d.DEFAULT_TABLE_WIDTH,D=o.collapsed??!1,S=x.length>0?x:_.DEFAULT_FIELD_TYPES,[B,T]=(0,l.useState)(null),[R,E]=(0,l.useState)(null),y=(0,l.useRef)(null),z=(0,l.useCallback)(t=>{k?.(o.id,t.target.value)},[o.id,k]),W=(0,l.useCallback)((t,n)=>{u?.(o.id,t,{name:n})},[o.id,u]),U=(0,l.useCallback)((t,n)=>{u?.(o.id,t,{type:n})},[o.id,u]),I=(0,l.useCallback)((t,n)=>{u?.(o.id,t,{primaryKey:!n})},[o.id,u]),A=(0,l.useCallback)((t,n)=>{u?.(o.id,t,{nullable:!n})},[o.id,u]),q=(0,l.useCallback)((t,n)=>{u?.(o.id,t,{indexed:!n})},[o.id,u]),j=(0,l.useCallback)((t,n)=>{u?.(o.id,t,{unique:!n})},[o.id,u]),G=(0,l.useCallback)(()=>{w?.(o.id)},[o.id,w]);return(0,e.jsxs)("div",{"data-table-id":o.id,className:(0,g.cn)("absolute bg-white dark:bg-gray-800 border-2 border-dashed rounded-lg shadow-sm cursor-grab active:cursor-grabbing",o.height?"flex flex-col":void 0,b?"border-green-400 shadow-green-100 dark:shadow-green-900/30 shadow-md":m?"border-blue-500 shadow-blue-100 dark:shadow-blue-900/30":"border-gray-300 dark:border-gray-600",s&&"opacity-60",o.locked&&"!cursor-default"),style:{left:o.x,top:o.y,width:L,height:o.height,userSelect:"none",overflow:o.height?"hidden":void 0},children:[(0,e.jsxs)("div",{className:(0,g.cn)("flex items-center justify-between px-3 gap-2","bg-gray-50 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600"),style:{height:d.HEADER_HEIGHT},children:[c&&!a&&!s?(0,e.jsx)("input",{className:"flex-1 min-w-0 text-sm font-semibold text-gray-800 dark:text-gray-100 bg-transparent border-none outline-none focus:ring-0 p-0 truncate cursor-text","aria-label":i.schemaEditorTableName,value:o.name,onChange:z,onMouseDown:t=>t.stopPropagation()}):(0,e.jsx)("span",{className:"flex-1 min-w-0 text-sm font-semibold text-gray-800 dark:text-gray-100 truncate",children:o.name}),(0,e.jsx)("button",{type:"button",className:"flex-shrink-0 p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-500 dark:text-gray-400",onClick:t=>{t.stopPropagation(),f?.(o.id)},onMouseDown:t=>t.stopPropagation(),"aria-label":D?i.schemaEditorExpandTable:i.schemaEditorCollapseTable,children:(0,e.jsx)(O,{collapsed:D})})]}),!D&&(c&&!a&&!s?(0,e.jsx)("div",{className:"px-3 border-b border-gray-100 dark:border-gray-700 flex items-center",style:{height:d.NOTES_ROW_HEIGHT},children:(0,e.jsx)("input",{className:"w-full text-xs italic text-gray-400 dark:text-gray-500 bg-transparent border-none outline-none focus:ring-0 p-0 placeholder-gray-400 dark:placeholder-gray-500","aria-label":i.schemaEditorTableNotes,placeholder:i.schemaEditorNotesPlaceholder,value:o.notes??"",onChange:t=>v?.(o.id,t.target.value),onMouseDown:t=>t.stopPropagation()})}):o.notes?(0,e.jsx)("div",{className:"px-3 border-b border-gray-100 dark:border-gray-700 flex items-center",style:{height:d.NOTES_ROW_HEIGHT},children:(0,e.jsx)("span",{className:"text-xs italic text-gray-400 dark:text-gray-500 truncate",children:o.notes})}):null),!D&&(0,e.jsxs)("div",{className:o.height?"overflow-y-auto flex-1 min-h-0":void 0,children:[o.fields.map((t,n)=>(0,e.jsxs)("div",{"data-field-id":t.id,"data-table-id":o.id,className:(0,g.cn)("flex items-center gap-1.5 pr-2 relative group",c&&!a&&!s?"pl-[18px]":"pl-2","border-b border-gray-100 dark:border-gray-700 last:border-b-0",b?"bg-blue-50/50 dark:bg-blue-900/10":"hover:bg-gray-50 dark:hover:bg-gray-700/50",B===n&&"opacity-40",R===n&&"!border-t-2 !border-t-blue-400"),style:{height:d.FIELD_ROW_HEIGHT},draggable:c&&!a&&!s,onDragStart:r=>{!c||a||s||(r.stopPropagation(),y.current=n,T(n),r.dataTransfer.effectAllowed="move",r.dataTransfer.setData("text/plain",String(n)))},onDragOver:r=>{y.current!==null&&(r.preventDefault(),r.stopPropagation(),E(n))},onDragLeave:()=>{R===n&&E(null)},onDrop:r=>{r.preventDefault(),r.stopPropagation(),y.current!==null&&y.current!==n&&p?.(o.id,y.current,n),y.current=null,T(null),E(null)},onDragEnd:()=>{y.current=null,T(null),E(null)},children:[(0,e.jsx)("div",{"data-connection-side":"left","data-field-id":t.id,"data-table-id":o.id,className:(0,g.cn)("absolute -left-[5px] w-2.5 h-2.5 rounded-full border-2 border-white dark:border-gray-800 cursor-crosshair z-10 transition-all",b?"opacity-100 bg-green-400 scale-150 shadow-[0_0_6px_rgba(74,222,128,0.6)]":"opacity-0 group-hover:opacity-100 bg-blue-400"),style:{top:d.FIELD_ROW_HEIGHT/2-5}}),c&&!a&&!s&&(0,e.jsx)("span",{className:"absolute left-[3px] cursor-grab active:cursor-grabbing opacity-0 group-hover:opacity-100 transition-opacity z-10",style:{top:d.FIELD_ROW_HEIGHT/2-6},children:(0,e.jsx)(te,{})}),c&&!a&&!s?(0,e.jsx)("button",{type:"button",className:(0,g.cn)("w-4 text-xs font-bold flex-shrink-0 text-center cursor-pointer",t.nullable?"text-gray-400":"text-transparent"),onClick:r=>{r.stopPropagation(),A(t.id,t.nullable??!1)},onMouseDown:r=>r.stopPropagation(),title:t.nullable?i.schemaEditorNullable:i.schemaEditorNotNullable,children:"?"}):(0,e.jsx)("span",{className:(0,g.cn)("w-4 text-xs font-bold flex-shrink-0 text-center",t.nullable?"text-gray-400":"text-transparent"),children:t.nullable?"?":""}),t.primaryKey&&t.foreignKey?(0,e.jsxs)("span",{className:"flex items-center gap-0.5 flex-shrink-0",children:[c&&!a&&!s?(0,e.jsx)("button",{type:"button",className:"flex-shrink-0 cursor-pointer",onClick:r=>{r.stopPropagation(),I(t.id,!0)},onMouseDown:r=>r.stopPropagation(),title:i.schemaEditorRemovePrimaryKey,children:(0,e.jsx)(P,{})}):(0,e.jsx)(P,{}),(0,e.jsx)(V,{})]}):t.primaryKey?c&&!a&&!s?(0,e.jsx)("button",{type:"button",className:"flex-shrink-0 cursor-pointer",onClick:r=>{r.stopPropagation(),I(t.id,!0)},onMouseDown:r=>r.stopPropagation(),title:i.schemaEditorRemovePrimaryKey,children:(0,e.jsx)(P,{})}):(0,e.jsx)(P,{}):t.foreignKey?(0,e.jsx)(V,{}):c&&!a&&!s?(0,e.jsx)("button",{type:"button",className:"w-3.5 h-3.5 flex-shrink-0 rounded text-gray-300 hover:text-indigo-400 transition-colors cursor-pointer",onClick:r=>{r.stopPropagation(),I(t.id,!1)},onMouseDown:r=>r.stopPropagation(),title:i.schemaEditorSetPrimaryKey,"aria-label":i.schemaEditorSetPrimaryKey,children:(0,e.jsxs)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",opacity:"0.3",children:[(0,e.jsx)("path",{d:"M10 1l2 2-5 5M8.5 4.5L11 7"}),(0,e.jsx)("circle",{cx:"4.5",cy:"11.5",r:"3"})]})}):(0,e.jsx)("span",{className:"w-3.5 flex-shrink-0"}),c&&!a&&!s?(0,e.jsx)("input",{className:(0,g.cn)("flex-1 min-w-0 text-xs bg-transparent border-none outline-none focus:ring-0 p-0 truncate cursor-text",t.primaryKey?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-300"),"aria-label":i.schemaEditorFieldName,value:t.name,onChange:r=>W(t.id,r.target.value),onMouseDown:r=>r.stopPropagation()}):(0,e.jsx)("span",{className:(0,g.cn)("flex-1 min-w-0 text-xs truncate",t.primaryKey?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-300"),children:t.name}),c&&!a&&!s?(0,e.jsxs)("select",{className:"text-xs text-gray-400 dark:text-gray-500 bg-transparent border-none outline-none focus:ring-0 p-0 cursor-pointer text-right",value:t.type,onChange:r=>U(t.id,r.target.value),onMouseDown:r=>r.stopPropagation(),children:[S.map(r=>(0,e.jsx)("option",{value:r,children:r},r)),!S.includes(t.type)&&(0,e.jsx)("option",{value:t.type,children:t.type})]}):(0,e.jsx)("span",{className:"text-xs text-gray-400 dark:text-gray-500 flex-shrink-0",children:t.type}),(0,e.jsx)(oe,{field:t,tableId:o.id,editable:c,readOnly:a,disabled:s,onFieldChange:u,labels:i}),t.indexed&&(0,e.jsx)(F,{}),t.unique&&(0,e.jsx)(H,{}),c&&!a&&!s&&(0,e.jsxs)("div",{className:"absolute right-1 top-0 bottom-0 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity bg-gradient-to-l from-white via-white to-transparent dark:from-gray-800 dark:via-gray-800 pl-4 pr-1 z-10",children:[(0,e.jsx)("button",{type:"button",className:(0,g.cn)("cursor-pointer transition-opacity",t.indexed?"opacity-100":"opacity-30 hover:opacity-100"),onClick:r=>{r.stopPropagation(),q(t.id,t.indexed??!1)},onMouseDown:r=>r.stopPropagation(),title:t.indexed?i.schemaEditorRemoveIndex:i.schemaEditorAddIndex,children:(0,e.jsx)(F,{})}),(0,e.jsx)("button",{type:"button",className:(0,g.cn)("cursor-pointer transition-opacity",t.unique?"opacity-100":"opacity-30 hover:opacity-100"),onClick:r=>{r.stopPropagation(),j(t.id,t.unique??!1)},onMouseDown:r=>r.stopPropagation(),title:t.unique?i.schemaEditorRemoveUnique:i.schemaEditorAddUnique,children:(0,e.jsx)(H,{})}),(0,e.jsx)("button",{type:"button",className:"p-0.5 rounded text-gray-300 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 cursor-pointer",onClick:r=>{r.stopPropagation(),N?.(o.id,t.id)},onMouseDown:r=>r.stopPropagation(),title:i.schemaEditorRemoveField,children:(0,e.jsx)(ee,{})})]}),(0,e.jsx)("div",{"data-connection-side":"right","data-field-id":t.id,"data-table-id":o.id,className:(0,g.cn)("absolute -right-[5px] w-2.5 h-2.5 rounded-full border-2 border-white dark:border-gray-800 cursor-crosshair z-10 transition-all",b?"opacity-100 bg-green-400 scale-150 shadow-[0_0_6px_rgba(74,222,128,0.6)]":"opacity-0 group-hover:opacity-100 bg-green-400"),style:{top:d.FIELD_ROW_HEIGHT/2-5}})]},t.id)),c&&!a&&!s&&(0,e.jsxs)("button",{type:"button",className:"flex items-center justify-center w-full gap-1 text-xs text-gray-400 hover:text-blue-500 hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors cursor-pointer",style:{height:d.ADD_BUTTON_HEIGHT},onClick:t=>{t.stopPropagation(),G()},onMouseDown:t=>t.stopPropagation(),children:[(0,e.jsx)("svg",{className:"w-3 h-3",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:(0,e.jsx)("path",{d:"M8 4v8M4 8h8"})}),i.schemaEditorAddField]})]}),!s&&!a&&(0,e.jsx)("div",{"data-resize-handle":"corner",className:"absolute -bottom-[5px] -right-[5px] w-[14px] h-[14px] cursor-nwse-resize z-20 group/resize",onMouseDown:t=>{t.stopPropagation(),t.preventDefault();let n=o.height??(0,d.getTableHeight)(o,c);K?.(o.id,t.clientX,t.clientY,L,n)},children:(0,e.jsxs)("svg",{className:"w-full h-full text-gray-300 group-hover/resize:text-blue-400 transition-colors",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:[(0,e.jsx)("path",{d:"M12 2v10H2",opacity:"0"}),(0,e.jsx)("path",{d:"M6 12L12 6"}),(0,e.jsx)("path",{d:"M10 12L12 10"})]})})]})});0&&(module.exports={SchemaTableRenderer});
1
+ "use strict";var C=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var J=Object.prototype.hasOwnProperty;var Q=(h,o)=>{for(var m in o)C(h,m,{get:o[m],enumerable:!0})},Z=(h,o,m,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of X(o))!J.call(h,a)&&a!==m&&C(h,a,{get:()=>o[a],enumerable:!(s=Y(o,a))||s.enumerable});return h};var $=h=>Z(C({},"__esModule",{value:!0}),h);var ae={};Q(ae,{SchemaTableRenderer:()=>re});module.exports=$(ae);var l=require("react"),g=require("../../../lib/cn.cjs"),p=require("../utils/geometry.cjs"),_=require("../utils/schema-helpers.cjs"),M=require("../../../lib/ui-labels.cjs"),e=require("react/jsx-runtime"),P=()=>(0,e.jsxs)("svg",{className:"w-3.5 h-3.5 text-indigo-500 dark:text-indigo-400 flex-shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("path",{d:"M10 1l2 2-5 5M8.5 4.5L11 7"}),(0,e.jsx)("circle",{cx:"4.5",cy:"11.5",r:"3"})]}),V=()=>(0,e.jsxs)("svg",{className:"w-3.5 h-3.5 flex-shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:[(0,e.jsx)("circle",{cx:"8",cy:"8",r:"6",className:"fill-blue-500"}),(0,e.jsx)("path",{d:"M5 8h6M8 5l3 3-3 3",stroke:"white",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]}),O=({collapsed:h})=>(0,e.jsx)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:h?(0,e.jsx)("path",{d:"M6 3l5 5-5 5V3z"}):(0,e.jsx)("path",{d:"M3 6l5 5 5-5H3z"})}),F=()=>(0,e.jsx)("svg",{className:"w-3.5 h-3.5 text-amber-700 dark:text-amber-400 flex-shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("path",{d:"M3 2v12M7 4h6M7 8h4M7 12h5"})}),H=()=>(0,e.jsx)("svg",{className:"w-3.5 h-3.5 text-purple-600 dark:text-purple-400 flex-shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("path",{d:"M4 2v8a4 4 0 008 0V2"})}),ee=()=>(0,e.jsx)("svg",{className:"w-3 h-3",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:(0,e.jsx)("path",{d:"M4 8h8"})}),te=()=>(0,e.jsxs)("svg",{className:"w-3 h-3 text-gray-300",viewBox:"0 0 16 16",fill:"currentColor",children:[(0,e.jsx)("circle",{cx:"5",cy:"4",r:"1.5"}),(0,e.jsx)("circle",{cx:"11",cy:"4",r:"1.5"}),(0,e.jsx)("circle",{cx:"5",cy:"8",r:"1.5"}),(0,e.jsx)("circle",{cx:"11",cy:"8",r:"1.5"}),(0,e.jsx)("circle",{cx:"5",cy:"12",r:"1.5"}),(0,e.jsx)("circle",{cx:"11",cy:"12",r:"1.5"})]}),oe=(0,l.memo)(function({field:o,tableId:m,editable:s,readOnly:a,disabled:c,onFieldChange:b,labels:x}){let[k,v]=(0,l.useState)(!1),[f,u]=(0,l.useState)(o.defaultValue??""),w=s&&!a&&!c,N=()=>{v(!1),b?.(m,o.id,{defaultValue:f||void 0})};return w?k?(0,e.jsx)("input",{className:"text-xs w-16 text-emerald-700 dark:text-emerald-400 bg-transparent border-b border-emerald-300 outline-none focus:ring-0 p-0 flex-shrink-0","aria-label":(0,M.formatUILabel)(x.schemaEditorDefaultValueFor,{field:o.name}),value:f,onChange:d=>u(d.target.value),onBlur:N,onKeyDown:d=>{d.key==="Enter"&&N(),d.key==="Escape"&&v(!1)},onMouseDown:d=>d.stopPropagation(),autoFocus:!0}):o.defaultValue?(0,e.jsxs)("button",{type:"button",className:"text-xs text-emerald-700 dark:text-emerald-400 flex-shrink-0 truncate max-w-16 cursor-pointer",onClick:d=>{d.stopPropagation(),u(o.defaultValue??""),v(!0)},onMouseDown:d=>d.stopPropagation(),title:(0,M.formatUILabel)(x.schemaEditorDefaultValue,{value:o.defaultValue}),children:["= ",o.defaultValue]}):(0,e.jsx)("button",{type:"button",className:"text-xs text-gray-300 flex-shrink-0 opacity-0 group-hover:opacity-30 hover:!opacity-100 cursor-pointer transition-opacity",onClick:d=>{d.stopPropagation(),u(""),v(!0)},onMouseDown:d=>d.stopPropagation(),title:x.schemaEditorSetDefaultValue,children:"= \u2205"}):o.defaultValue?(0,e.jsxs)("span",{className:"text-xs text-emerald-700 dark:text-emerald-400 flex-shrink-0 truncate max-w-16",title:(0,M.formatUILabel)(x.schemaEditorDefaultValue,{value:o.defaultValue}),children:["= ",o.defaultValue]}):null}),re=(0,l.memo)(function({table:o,selected:m,disabled:s,readOnly:a,editable:c,dropTarget:b,fieldTypes:x,onTableNameChange:k,onTableNotesChange:v,onToggleCollapse:f,onFieldChange:u,onFieldAdd:w,onFieldRemove:N,onFieldReorder:d,onResizeStart:K,labels:i}){let L=o.width??p.DEFAULT_TABLE_WIDTH,D=o.collapsed??!1,S=x.length>0?x:_.DEFAULT_FIELD_TYPES,[B,T]=(0,l.useState)(null),[R,E]=(0,l.useState)(null),y=(0,l.useRef)(null),z=(0,l.useCallback)(t=>{k?.(o.id,t.target.value)},[o.id,k]),W=(0,l.useCallback)((t,n)=>{u?.(o.id,t,{name:n})},[o.id,u]),U=(0,l.useCallback)((t,n)=>{u?.(o.id,t,{type:n})},[o.id,u]),I=(0,l.useCallback)((t,n)=>{u?.(o.id,t,{primaryKey:!n})},[o.id,u]),A=(0,l.useCallback)((t,n)=>{u?.(o.id,t,{nullable:!n})},[o.id,u]),q=(0,l.useCallback)((t,n)=>{u?.(o.id,t,{indexed:!n})},[o.id,u]),j=(0,l.useCallback)((t,n)=>{u?.(o.id,t,{unique:!n})},[o.id,u]),G=(0,l.useCallback)(()=>{w?.(o.id)},[o.id,w]);return(0,e.jsxs)("div",{"data-table-id":o.id,className:(0,g.cn)("absolute bg-white dark:bg-gray-800 border-2 border-dashed rounded-lg shadow-sm cursor-grab active:cursor-grabbing",o.height?"flex flex-col":void 0,b?"border-green-400 shadow-green-100 dark:shadow-green-900/30 shadow-md":m?"border-blue-500 shadow-blue-100 dark:shadow-blue-900/30":"border-gray-300 dark:border-gray-600",s&&"opacity-60",o.locked&&"!cursor-default"),style:{left:o.x,top:o.y,width:L,height:o.height,userSelect:"none",overflow:o.height?"hidden":void 0},children:[(0,e.jsxs)("div",{className:(0,g.cn)("flex items-center justify-between px-3 gap-2","bg-gray-50 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600"),style:{height:p.HEADER_HEIGHT},children:[c&&!a&&!s?(0,e.jsx)("input",{className:"flex-1 min-w-0 text-sm font-semibold text-gray-800 dark:text-gray-100 bg-transparent border-none outline-none focus:ring-0 p-0 truncate cursor-text","aria-label":i.schemaEditorTableName,value:o.name,onChange:z,onMouseDown:t=>t.stopPropagation()}):(0,e.jsx)("span",{className:"flex-1 min-w-0 text-sm font-semibold text-gray-800 dark:text-gray-100 truncate",children:o.name}),(0,e.jsx)("button",{type:"button",className:"flex-shrink-0 p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-500 dark:text-gray-400",onClick:t=>{t.stopPropagation(),f?.(o.id)},onMouseDown:t=>t.stopPropagation(),"aria-label":D?i.schemaEditorExpandTable:i.schemaEditorCollapseTable,children:(0,e.jsx)(O,{collapsed:D})})]}),!D&&(c&&!a&&!s?(0,e.jsx)("div",{className:"px-3 border-b border-gray-100 dark:border-gray-700 flex items-center",style:{height:p.NOTES_ROW_HEIGHT},children:(0,e.jsx)("input",{className:"w-full text-xs italic text-gray-400 dark:text-gray-500 bg-transparent border-none outline-none focus:ring-0 p-0 placeholder-gray-400 dark:placeholder-gray-500","aria-label":i.schemaEditorTableNotes,placeholder:i.schemaEditorNotesPlaceholder,value:o.notes??"",onChange:t=>v?.(o.id,t.target.value),onMouseDown:t=>t.stopPropagation()})}):o.notes?(0,e.jsx)("div",{className:"px-3 border-b border-gray-100 dark:border-gray-700 flex items-center",style:{height:p.NOTES_ROW_HEIGHT},children:(0,e.jsx)("span",{className:"text-xs italic text-gray-400 dark:text-gray-500 truncate",children:o.notes})}):null),!D&&(0,e.jsxs)("div",{className:o.height?"overflow-y-auto flex-1 min-h-0":void 0,children:[o.fields.map((t,n)=>(0,e.jsxs)("div",{"data-field-id":t.id,"data-table-id":o.id,className:(0,g.cn)("flex items-center gap-1.5 pr-2 relative group",c&&!a&&!s?"pl-[18px]":"pl-2","border-b border-gray-100 dark:border-gray-700 last:border-b-0",b?"bg-blue-50/50 dark:bg-blue-900/10":"hover:bg-gray-50 dark:hover:bg-gray-700/50",B===n&&"opacity-40",R===n&&"!border-t-2 !border-t-blue-400"),style:{height:p.FIELD_ROW_HEIGHT},draggable:c&&!a&&!s,onDragStart:r=>{!c||a||s||(r.stopPropagation(),y.current=n,T(n),r.dataTransfer.effectAllowed="move",r.dataTransfer.setData("text/plain",String(n)))},onDragOver:r=>{y.current!==null&&(r.preventDefault(),r.stopPropagation(),E(n))},onDragLeave:()=>{R===n&&E(null)},onDrop:r=>{r.preventDefault(),r.stopPropagation(),y.current!==null&&y.current!==n&&d?.(o.id,y.current,n),y.current=null,T(null),E(null)},onDragEnd:()=>{y.current=null,T(null),E(null)},children:[(0,e.jsx)("div",{"data-connection-side":"left","data-field-id":t.id,"data-table-id":o.id,className:(0,g.cn)("absolute -left-[5px] w-2.5 h-2.5 rounded-full border-2 border-white dark:border-gray-800 cursor-crosshair z-10 transition-all",b?"opacity-100 bg-green-400 scale-150 shadow-[0_0_6px_rgba(74,222,128,0.6)]":"opacity-0 group-hover:opacity-100 bg-blue-400"),style:{top:p.FIELD_ROW_HEIGHT/2-5}}),c&&!a&&!s&&(0,e.jsx)("span",{className:"absolute left-[3px] cursor-grab active:cursor-grabbing opacity-0 group-hover:opacity-100 transition-opacity z-10",style:{top:p.FIELD_ROW_HEIGHT/2-6},children:(0,e.jsx)(te,{})}),c&&!a&&!s?(0,e.jsx)("button",{type:"button",className:(0,g.cn)("w-4 text-xs font-bold flex-shrink-0 text-center cursor-pointer",t.nullable?"text-gray-400":"text-transparent"),onClick:r=>{r.stopPropagation(),A(t.id,t.nullable??!1)},onMouseDown:r=>r.stopPropagation(),title:t.nullable?i.schemaEditorNullable:i.schemaEditorNotNullable,children:"?"}):(0,e.jsx)("span",{className:(0,g.cn)("w-4 text-xs font-bold flex-shrink-0 text-center",t.nullable?"text-gray-400":"text-transparent"),children:t.nullable?"?":""}),t.primaryKey&&t.foreignKey?(0,e.jsxs)("span",{className:"flex items-center gap-0.5 flex-shrink-0",children:[c&&!a&&!s?(0,e.jsx)("button",{type:"button",className:"flex-shrink-0 cursor-pointer",onClick:r=>{r.stopPropagation(),I(t.id,!0)},onMouseDown:r=>r.stopPropagation(),title:i.schemaEditorRemovePrimaryKey,children:(0,e.jsx)(P,{})}):(0,e.jsx)(P,{}),(0,e.jsx)(V,{})]}):t.primaryKey?c&&!a&&!s?(0,e.jsx)("button",{type:"button",className:"flex-shrink-0 cursor-pointer",onClick:r=>{r.stopPropagation(),I(t.id,!0)},onMouseDown:r=>r.stopPropagation(),title:i.schemaEditorRemovePrimaryKey,children:(0,e.jsx)(P,{})}):(0,e.jsx)(P,{}):t.foreignKey?(0,e.jsx)(V,{}):c&&!a&&!s?(0,e.jsx)("button",{type:"button",className:"w-3.5 h-3.5 flex-shrink-0 rounded text-gray-300 hover:text-indigo-400 transition-colors cursor-pointer",onClick:r=>{r.stopPropagation(),I(t.id,!1)},onMouseDown:r=>r.stopPropagation(),title:i.schemaEditorSetPrimaryKey,"aria-label":i.schemaEditorSetPrimaryKey,children:(0,e.jsxs)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",opacity:"0.3",children:[(0,e.jsx)("path",{d:"M10 1l2 2-5 5M8.5 4.5L11 7"}),(0,e.jsx)("circle",{cx:"4.5",cy:"11.5",r:"3"})]})}):(0,e.jsx)("span",{className:"w-3.5 flex-shrink-0"}),c&&!a&&!s?(0,e.jsx)("input",{className:(0,g.cn)("flex-1 min-w-0 text-xs bg-transparent border-none outline-none focus:ring-0 p-0 truncate cursor-text",t.primaryKey?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-300"),"aria-label":i.schemaEditorFieldName,value:t.name,onChange:r=>W(t.id,r.target.value),onMouseDown:r=>r.stopPropagation()}):(0,e.jsx)("span",{className:(0,g.cn)("flex-1 min-w-0 text-xs truncate",t.primaryKey?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-300"),children:t.name}),c&&!a&&!s?(0,e.jsxs)("select",{className:"text-xs text-gray-400 dark:text-gray-500 bg-transparent border-none outline-none focus:ring-0 p-0 cursor-pointer text-right",value:t.type,onChange:r=>U(t.id,r.target.value),onMouseDown:r=>r.stopPropagation(),children:[S.map(r=>(0,e.jsx)("option",{value:r,children:r},r)),!S.includes(t.type)&&(0,e.jsx)("option",{value:t.type,children:t.type})]}):(0,e.jsx)("span",{className:"text-xs text-gray-400 dark:text-gray-500 flex-shrink-0",children:t.type}),(0,e.jsx)(oe,{field:t,tableId:o.id,editable:c,readOnly:a,disabled:s,onFieldChange:u,labels:i}),t.indexed&&(0,e.jsx)(F,{}),t.unique&&(0,e.jsx)(H,{}),c&&!a&&!s&&(0,e.jsxs)("div",{className:"absolute right-1 top-0 bottom-0 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity bg-gradient-to-l from-white via-white to-transparent dark:from-gray-800 dark:via-gray-800 pl-4 pr-1 z-10",children:[(0,e.jsx)("button",{type:"button",className:(0,g.cn)("cursor-pointer transition-opacity",t.indexed?"opacity-100":"opacity-30 hover:opacity-100"),onClick:r=>{r.stopPropagation(),q(t.id,t.indexed??!1)},onMouseDown:r=>r.stopPropagation(),title:t.indexed?i.schemaEditorRemoveIndex:i.schemaEditorAddIndex,children:(0,e.jsx)(F,{})}),(0,e.jsx)("button",{type:"button",className:(0,g.cn)("cursor-pointer transition-opacity",t.unique?"opacity-100":"opacity-30 hover:opacity-100"),onClick:r=>{r.stopPropagation(),j(t.id,t.unique??!1)},onMouseDown:r=>r.stopPropagation(),title:t.unique?i.schemaEditorRemoveUnique:i.schemaEditorAddUnique,children:(0,e.jsx)(H,{})}),(0,e.jsx)("button",{type:"button",className:"p-0.5 rounded text-gray-300 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 cursor-pointer",onClick:r=>{r.stopPropagation(),N?.(o.id,t.id)},onMouseDown:r=>r.stopPropagation(),title:i.schemaEditorRemoveField,children:(0,e.jsx)(ee,{})})]}),(0,e.jsx)("div",{"data-connection-side":"right","data-field-id":t.id,"data-table-id":o.id,className:(0,g.cn)("absolute -right-[5px] w-2.5 h-2.5 rounded-full border-2 border-white dark:border-gray-800 cursor-crosshair z-10 transition-all",b?"opacity-100 bg-green-400 scale-150 shadow-[0_0_6px_rgba(74,222,128,0.6)]":"opacity-0 group-hover:opacity-100 bg-green-400"),style:{top:p.FIELD_ROW_HEIGHT/2-5}})]},t.id)),c&&!a&&!s&&(0,e.jsxs)("button",{type:"button",className:"flex items-center justify-center w-full gap-1 text-xs text-gray-400 hover:text-blue-600 hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors cursor-pointer",style:{height:p.ADD_BUTTON_HEIGHT},onClick:t=>{t.stopPropagation(),G()},onMouseDown:t=>t.stopPropagation(),children:[(0,e.jsx)("svg",{className:"w-3 h-3",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:(0,e.jsx)("path",{d:"M8 4v8M4 8h8"})}),i.schemaEditorAddField]})]}),!s&&!a&&(0,e.jsx)("div",{"data-resize-handle":"corner",className:"absolute -bottom-[5px] -right-[5px] w-[14px] h-[14px] cursor-nwse-resize z-20 group/resize",onMouseDown:t=>{t.stopPropagation(),t.preventDefault();let n=o.height??(0,p.getTableHeight)(o,c);K?.(o.id,t.clientX,t.clientY,L,n)},children:(0,e.jsxs)("svg",{className:"w-full h-full text-gray-300 group-hover/resize:text-blue-400 transition-colors",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:[(0,e.jsx)("path",{d:"M12 2v10H2",opacity:"0"}),(0,e.jsx)("path",{d:"M6 12L12 6"}),(0,e.jsx)("path",{d:"M10 12L12 10"})]})})]})});0&&(module.exports={SchemaTableRenderer});
@@ -1 +1 @@
1
- import{memo as B,useCallback as g,useRef as J,useState as P}from"react";import{cn as d}from"../../../lib/cn.js";import{ADD_BUTTON_HEIGHT as Q,DEFAULT_TABLE_WIDTH as Z,FIELD_ROW_HEIGHT as D,getTableHeight as $,HEADER_HEIGHT as O,NOTES_ROW_HEIGHT as F}from"../utils/geometry.js";import{DEFAULT_FIELD_TYPES as ee}from"../utils/schema-helpers.js";import{formatUILabel as L}from"../../../lib/ui-labels.js";import{jsx as t,jsxs as p}from"react/jsx-runtime";var E=()=>p("svg",{className:"w-3.5 h-3.5 text-indigo-500 flex-shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[t("path",{d:"M10 1l2 2-5 5M8.5 4.5L11 7"}),t("circle",{cx:"4.5",cy:"11.5",r:"3"})]}),H=()=>p("svg",{className:"w-3.5 h-3.5 flex-shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:[t("circle",{cx:"8",cy:"8",r:"6",className:"fill-blue-500"}),t("path",{d:"M5 8h6M8 5l3 3-3 3",stroke:"white",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]}),te=({collapsed:M})=>t("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:M?t("path",{d:"M6 3l5 5-5 5V3z"}):t("path",{d:"M3 6l5 5 5-5H3z"})}),_=()=>t("svg",{className:"w-3.5 h-3.5 text-amber-500 flex-shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t("path",{d:"M3 2v12M7 4h6M7 8h4M7 12h5"})}),K=()=>t("svg",{className:"w-3.5 h-3.5 text-purple-500 flex-shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t("path",{d:"M4 2v8a4 4 0 008 0V2"})}),oe=()=>t("svg",{className:"w-3 h-3",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:t("path",{d:"M4 8h8"})}),re=()=>p("svg",{className:"w-3 h-3 text-gray-300",viewBox:"0 0 16 16",fill:"currentColor",children:[t("circle",{cx:"5",cy:"4",r:"1.5"}),t("circle",{cx:"11",cy:"4",r:"1.5"}),t("circle",{cx:"5",cy:"8",r:"1.5"}),t("circle",{cx:"11",cy:"8",r:"1.5"}),t("circle",{cx:"5",cy:"12",r:"1.5"}),t("circle",{cx:"11",cy:"12",r:"1.5"})]}),ae=B(function({field:o,tableId:T,editable:n,readOnly:i,disabled:l,onFieldChange:x,labels:h}){let[b,y]=P(!1),[v,c]=P(o.defaultValue??""),k=n&&!i&&!l,f=()=>{y(!1),x?.(T,o.id,{defaultValue:v||void 0})};return k?b?t("input",{className:"text-xs w-16 text-emerald-500 bg-transparent border-b border-emerald-300 outline-none focus:ring-0 p-0 flex-shrink-0","aria-label":L(h.schemaEditorDefaultValueFor,{field:o.name}),value:v,onChange:u=>c(u.target.value),onBlur:f,onKeyDown:u=>{u.key==="Enter"&&f(),u.key==="Escape"&&y(!1)},onMouseDown:u=>u.stopPropagation(),autoFocus:!0}):o.defaultValue?p("button",{type:"button",className:"text-xs text-emerald-500 flex-shrink-0 truncate max-w-16 cursor-pointer",onClick:u=>{u.stopPropagation(),c(o.defaultValue??""),y(!0)},onMouseDown:u=>u.stopPropagation(),title:L(h.schemaEditorDefaultValue,{value:o.defaultValue}),children:["= ",o.defaultValue]}):t("button",{type:"button",className:"text-xs text-gray-300 flex-shrink-0 opacity-0 group-hover:opacity-30 hover:!opacity-100 cursor-pointer transition-opacity",onClick:u=>{u.stopPropagation(),c(""),y(!0)},onMouseDown:u=>u.stopPropagation(),title:h.schemaEditorSetDefaultValue,children:"= \u2205"}):o.defaultValue?p("span",{className:"text-xs text-emerald-500 flex-shrink-0 truncate max-w-16",title:L(h.schemaEditorDefaultValue,{value:o.defaultValue}),children:["= ",o.defaultValue]}):null}),ue=B(function({table:o,selected:T,disabled:n,readOnly:i,editable:l,dropTarget:x,fieldTypes:h,onTableNameChange:b,onTableNotesChange:y,onToggleCollapse:v,onFieldChange:c,onFieldAdd:k,onFieldRemove:f,onFieldReorder:u,onResizeStart:z,labels:s}){let S=o.width??Z,w=o.collapsed??!1,R=h.length>0?h:ee,[W,I]=P(null),[V,N]=P(null),m=J(null),U=g(e=>{b?.(o.id,e.target.value)},[o.id,b]),A=g((e,a)=>{c?.(o.id,e,{name:a})},[o.id,c]),q=g((e,a)=>{c?.(o.id,e,{type:a})},[o.id,c]),C=g((e,a)=>{c?.(o.id,e,{primaryKey:!a})},[o.id,c]),j=g((e,a)=>{c?.(o.id,e,{nullable:!a})},[o.id,c]),G=g((e,a)=>{c?.(o.id,e,{indexed:!a})},[o.id,c]),Y=g((e,a)=>{c?.(o.id,e,{unique:!a})},[o.id,c]),X=g(()=>{k?.(o.id)},[o.id,k]);return p("div",{"data-table-id":o.id,className:d("absolute bg-white dark:bg-gray-800 border-2 border-dashed rounded-lg shadow-sm cursor-grab active:cursor-grabbing",o.height?"flex flex-col":void 0,x?"border-green-400 shadow-green-100 dark:shadow-green-900/30 shadow-md":T?"border-blue-500 shadow-blue-100 dark:shadow-blue-900/30":"border-gray-300 dark:border-gray-600",n&&"opacity-60",o.locked&&"!cursor-default"),style:{left:o.x,top:o.y,width:S,height:o.height,userSelect:"none",overflow:o.height?"hidden":void 0},children:[p("div",{className:d("flex items-center justify-between px-3 gap-2","bg-gray-50 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600"),style:{height:O},children:[l&&!i&&!n?t("input",{className:"flex-1 min-w-0 text-sm font-semibold text-gray-800 dark:text-gray-100 bg-transparent border-none outline-none focus:ring-0 p-0 truncate cursor-text","aria-label":s.schemaEditorTableName,value:o.name,onChange:U,onMouseDown:e=>e.stopPropagation()}):t("span",{className:"flex-1 min-w-0 text-sm font-semibold text-gray-800 dark:text-gray-100 truncate",children:o.name}),t("button",{type:"button",className:"flex-shrink-0 p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-500 dark:text-gray-400",onClick:e=>{e.stopPropagation(),v?.(o.id)},onMouseDown:e=>e.stopPropagation(),"aria-label":w?s.schemaEditorExpandTable:s.schemaEditorCollapseTable,children:t(te,{collapsed:w})})]}),!w&&(l&&!i&&!n?t("div",{className:"px-3 border-b border-gray-100 dark:border-gray-700 flex items-center",style:{height:F},children:t("input",{className:"w-full text-xs italic text-gray-400 dark:text-gray-500 bg-transparent border-none outline-none focus:ring-0 p-0 placeholder-gray-400 dark:placeholder-gray-500","aria-label":s.schemaEditorTableNotes,placeholder:s.schemaEditorNotesPlaceholder,value:o.notes??"",onChange:e=>y?.(o.id,e.target.value),onMouseDown:e=>e.stopPropagation()})}):o.notes?t("div",{className:"px-3 border-b border-gray-100 dark:border-gray-700 flex items-center",style:{height:F},children:t("span",{className:"text-xs italic text-gray-400 dark:text-gray-500 truncate",children:o.notes})}):null),!w&&p("div",{className:o.height?"overflow-y-auto flex-1 min-h-0":void 0,children:[o.fields.map((e,a)=>p("div",{"data-field-id":e.id,"data-table-id":o.id,className:d("flex items-center gap-1.5 pr-2 relative group",l&&!i&&!n?"pl-[18px]":"pl-2","border-b border-gray-100 dark:border-gray-700 last:border-b-0",x?"bg-blue-50/50 dark:bg-blue-900/10":"hover:bg-gray-50 dark:hover:bg-gray-700/50",W===a&&"opacity-40",V===a&&"!border-t-2 !border-t-blue-400"),style:{height:D},draggable:l&&!i&&!n,onDragStart:r=>{!l||i||n||(r.stopPropagation(),m.current=a,I(a),r.dataTransfer.effectAllowed="move",r.dataTransfer.setData("text/plain",String(a)))},onDragOver:r=>{m.current!==null&&(r.preventDefault(),r.stopPropagation(),N(a))},onDragLeave:()=>{V===a&&N(null)},onDrop:r=>{r.preventDefault(),r.stopPropagation(),m.current!==null&&m.current!==a&&u?.(o.id,m.current,a),m.current=null,I(null),N(null)},onDragEnd:()=>{m.current=null,I(null),N(null)},children:[t("div",{"data-connection-side":"left","data-field-id":e.id,"data-table-id":o.id,className:d("absolute -left-[5px] w-2.5 h-2.5 rounded-full border-2 border-white dark:border-gray-800 cursor-crosshair z-10 transition-all",x?"opacity-100 bg-green-400 scale-150 shadow-[0_0_6px_rgba(74,222,128,0.6)]":"opacity-0 group-hover:opacity-100 bg-blue-400"),style:{top:D/2-5}}),l&&!i&&!n&&t("span",{className:"absolute left-[3px] cursor-grab active:cursor-grabbing opacity-0 group-hover:opacity-100 transition-opacity z-10",style:{top:D/2-6},children:t(re,{})}),l&&!i&&!n?t("button",{type:"button",className:d("w-4 text-xs font-bold flex-shrink-0 text-center cursor-pointer",e.nullable?"text-gray-400":"text-transparent"),onClick:r=>{r.stopPropagation(),j(e.id,e.nullable??!1)},onMouseDown:r=>r.stopPropagation(),title:e.nullable?s.schemaEditorNullable:s.schemaEditorNotNullable,children:"?"}):t("span",{className:d("w-4 text-xs font-bold flex-shrink-0 text-center",e.nullable?"text-gray-400":"text-transparent"),children:e.nullable?"?":""}),e.primaryKey&&e.foreignKey?p("span",{className:"flex items-center gap-0.5 flex-shrink-0",children:[l&&!i&&!n?t("button",{type:"button",className:"flex-shrink-0 cursor-pointer",onClick:r=>{r.stopPropagation(),C(e.id,!0)},onMouseDown:r=>r.stopPropagation(),title:s.schemaEditorRemovePrimaryKey,children:t(E,{})}):t(E,{}),t(H,{})]}):e.primaryKey?l&&!i&&!n?t("button",{type:"button",className:"flex-shrink-0 cursor-pointer",onClick:r=>{r.stopPropagation(),C(e.id,!0)},onMouseDown:r=>r.stopPropagation(),title:s.schemaEditorRemovePrimaryKey,children:t(E,{})}):t(E,{}):e.foreignKey?t(H,{}):l&&!i&&!n?t("button",{type:"button",className:"w-3.5 h-3.5 flex-shrink-0 rounded text-gray-300 hover:text-indigo-400 transition-colors cursor-pointer",onClick:r=>{r.stopPropagation(),C(e.id,!1)},onMouseDown:r=>r.stopPropagation(),title:s.schemaEditorSetPrimaryKey,"aria-label":s.schemaEditorSetPrimaryKey,children:p("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",opacity:"0.3",children:[t("path",{d:"M10 1l2 2-5 5M8.5 4.5L11 7"}),t("circle",{cx:"4.5",cy:"11.5",r:"3"})]})}):t("span",{className:"w-3.5 flex-shrink-0"}),l&&!i&&!n?t("input",{className:d("flex-1 min-w-0 text-xs bg-transparent border-none outline-none focus:ring-0 p-0 truncate cursor-text",e.primaryKey?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-300"),"aria-label":s.schemaEditorFieldName,value:e.name,onChange:r=>A(e.id,r.target.value),onMouseDown:r=>r.stopPropagation()}):t("span",{className:d("flex-1 min-w-0 text-xs truncate",e.primaryKey?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-300"),children:e.name}),l&&!i&&!n?p("select",{className:"text-xs text-gray-400 dark:text-gray-500 bg-transparent border-none outline-none focus:ring-0 p-0 cursor-pointer text-right",value:e.type,onChange:r=>q(e.id,r.target.value),onMouseDown:r=>r.stopPropagation(),children:[R.map(r=>t("option",{value:r,children:r},r)),!R.includes(e.type)&&t("option",{value:e.type,children:e.type})]}):t("span",{className:"text-xs text-gray-400 dark:text-gray-500 flex-shrink-0",children:e.type}),t(ae,{field:e,tableId:o.id,editable:l,readOnly:i,disabled:n,onFieldChange:c,labels:s}),e.indexed&&t(_,{}),e.unique&&t(K,{}),l&&!i&&!n&&p("div",{className:"absolute right-1 top-0 bottom-0 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity bg-gradient-to-l from-white via-white to-transparent dark:from-gray-800 dark:via-gray-800 pl-4 pr-1 z-10",children:[t("button",{type:"button",className:d("cursor-pointer transition-opacity",e.indexed?"opacity-100":"opacity-30 hover:opacity-100"),onClick:r=>{r.stopPropagation(),G(e.id,e.indexed??!1)},onMouseDown:r=>r.stopPropagation(),title:e.indexed?s.schemaEditorRemoveIndex:s.schemaEditorAddIndex,children:t(_,{})}),t("button",{type:"button",className:d("cursor-pointer transition-opacity",e.unique?"opacity-100":"opacity-30 hover:opacity-100"),onClick:r=>{r.stopPropagation(),Y(e.id,e.unique??!1)},onMouseDown:r=>r.stopPropagation(),title:e.unique?s.schemaEditorRemoveUnique:s.schemaEditorAddUnique,children:t(K,{})}),t("button",{type:"button",className:"p-0.5 rounded text-gray-300 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 cursor-pointer",onClick:r=>{r.stopPropagation(),f?.(o.id,e.id)},onMouseDown:r=>r.stopPropagation(),title:s.schemaEditorRemoveField,children:t(oe,{})})]}),t("div",{"data-connection-side":"right","data-field-id":e.id,"data-table-id":o.id,className:d("absolute -right-[5px] w-2.5 h-2.5 rounded-full border-2 border-white dark:border-gray-800 cursor-crosshair z-10 transition-all",x?"opacity-100 bg-green-400 scale-150 shadow-[0_0_6px_rgba(74,222,128,0.6)]":"opacity-0 group-hover:opacity-100 bg-green-400"),style:{top:D/2-5}})]},e.id)),l&&!i&&!n&&p("button",{type:"button",className:"flex items-center justify-center w-full gap-1 text-xs text-gray-400 hover:text-blue-500 hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors cursor-pointer",style:{height:Q},onClick:e=>{e.stopPropagation(),X()},onMouseDown:e=>e.stopPropagation(),children:[t("svg",{className:"w-3 h-3",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:t("path",{d:"M8 4v8M4 8h8"})}),s.schemaEditorAddField]})]}),!n&&!i&&t("div",{"data-resize-handle":"corner",className:"absolute -bottom-[5px] -right-[5px] w-[14px] h-[14px] cursor-nwse-resize z-20 group/resize",onMouseDown:e=>{e.stopPropagation(),e.preventDefault();let a=o.height??$(o,l);z?.(o.id,e.clientX,e.clientY,S,a)},children:p("svg",{className:"w-full h-full text-gray-300 group-hover/resize:text-blue-400 transition-colors",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:[t("path",{d:"M12 2v10H2",opacity:"0"}),t("path",{d:"M6 12L12 6"}),t("path",{d:"M10 12L12 10"})]})})]})});export{ue as SchemaTableRenderer};
1
+ import{memo as B,useCallback as g,useRef as J,useState as P}from"react";import{cn as p}from"../../../lib/cn.js";import{ADD_BUTTON_HEIGHT as Q,DEFAULT_TABLE_WIDTH as Z,FIELD_ROW_HEIGHT as D,getTableHeight as $,HEADER_HEIGHT as O,NOTES_ROW_HEIGHT as F}from"../utils/geometry.js";import{DEFAULT_FIELD_TYPES as ee}from"../utils/schema-helpers.js";import{formatUILabel as L}from"../../../lib/ui-labels.js";import{jsx as t,jsxs as d}from"react/jsx-runtime";var E=()=>d("svg",{className:"w-3.5 h-3.5 text-indigo-500 dark:text-indigo-400 flex-shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[t("path",{d:"M10 1l2 2-5 5M8.5 4.5L11 7"}),t("circle",{cx:"4.5",cy:"11.5",r:"3"})]}),H=()=>d("svg",{className:"w-3.5 h-3.5 flex-shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:[t("circle",{cx:"8",cy:"8",r:"6",className:"fill-blue-500"}),t("path",{d:"M5 8h6M8 5l3 3-3 3",stroke:"white",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]}),te=({collapsed:M})=>t("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:M?t("path",{d:"M6 3l5 5-5 5V3z"}):t("path",{d:"M3 6l5 5 5-5H3z"})}),_=()=>t("svg",{className:"w-3.5 h-3.5 text-amber-700 dark:text-amber-400 flex-shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t("path",{d:"M3 2v12M7 4h6M7 8h4M7 12h5"})}),K=()=>t("svg",{className:"w-3.5 h-3.5 text-purple-600 dark:text-purple-400 flex-shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t("path",{d:"M4 2v8a4 4 0 008 0V2"})}),oe=()=>t("svg",{className:"w-3 h-3",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:t("path",{d:"M4 8h8"})}),re=()=>d("svg",{className:"w-3 h-3 text-gray-300",viewBox:"0 0 16 16",fill:"currentColor",children:[t("circle",{cx:"5",cy:"4",r:"1.5"}),t("circle",{cx:"11",cy:"4",r:"1.5"}),t("circle",{cx:"5",cy:"8",r:"1.5"}),t("circle",{cx:"11",cy:"8",r:"1.5"}),t("circle",{cx:"5",cy:"12",r:"1.5"}),t("circle",{cx:"11",cy:"12",r:"1.5"})]}),ae=B(function({field:o,tableId:T,editable:n,readOnly:i,disabled:l,onFieldChange:x,labels:h}){let[b,y]=P(!1),[v,c]=P(o.defaultValue??""),k=n&&!i&&!l,f=()=>{y(!1),x?.(T,o.id,{defaultValue:v||void 0})};return k?b?t("input",{className:"text-xs w-16 text-emerald-700 dark:text-emerald-400 bg-transparent border-b border-emerald-300 outline-none focus:ring-0 p-0 flex-shrink-0","aria-label":L(h.schemaEditorDefaultValueFor,{field:o.name}),value:v,onChange:u=>c(u.target.value),onBlur:f,onKeyDown:u=>{u.key==="Enter"&&f(),u.key==="Escape"&&y(!1)},onMouseDown:u=>u.stopPropagation(),autoFocus:!0}):o.defaultValue?d("button",{type:"button",className:"text-xs text-emerald-700 dark:text-emerald-400 flex-shrink-0 truncate max-w-16 cursor-pointer",onClick:u=>{u.stopPropagation(),c(o.defaultValue??""),y(!0)},onMouseDown:u=>u.stopPropagation(),title:L(h.schemaEditorDefaultValue,{value:o.defaultValue}),children:["= ",o.defaultValue]}):t("button",{type:"button",className:"text-xs text-gray-300 flex-shrink-0 opacity-0 group-hover:opacity-30 hover:!opacity-100 cursor-pointer transition-opacity",onClick:u=>{u.stopPropagation(),c(""),y(!0)},onMouseDown:u=>u.stopPropagation(),title:h.schemaEditorSetDefaultValue,children:"= \u2205"}):o.defaultValue?d("span",{className:"text-xs text-emerald-700 dark:text-emerald-400 flex-shrink-0 truncate max-w-16",title:L(h.schemaEditorDefaultValue,{value:o.defaultValue}),children:["= ",o.defaultValue]}):null}),ue=B(function({table:o,selected:T,disabled:n,readOnly:i,editable:l,dropTarget:x,fieldTypes:h,onTableNameChange:b,onTableNotesChange:y,onToggleCollapse:v,onFieldChange:c,onFieldAdd:k,onFieldRemove:f,onFieldReorder:u,onResizeStart:z,labels:s}){let S=o.width??Z,w=o.collapsed??!1,R=h.length>0?h:ee,[W,I]=P(null),[V,N]=P(null),m=J(null),U=g(e=>{b?.(o.id,e.target.value)},[o.id,b]),A=g((e,a)=>{c?.(o.id,e,{name:a})},[o.id,c]),q=g((e,a)=>{c?.(o.id,e,{type:a})},[o.id,c]),C=g((e,a)=>{c?.(o.id,e,{primaryKey:!a})},[o.id,c]),j=g((e,a)=>{c?.(o.id,e,{nullable:!a})},[o.id,c]),G=g((e,a)=>{c?.(o.id,e,{indexed:!a})},[o.id,c]),Y=g((e,a)=>{c?.(o.id,e,{unique:!a})},[o.id,c]),X=g(()=>{k?.(o.id)},[o.id,k]);return d("div",{"data-table-id":o.id,className:p("absolute bg-white dark:bg-gray-800 border-2 border-dashed rounded-lg shadow-sm cursor-grab active:cursor-grabbing",o.height?"flex flex-col":void 0,x?"border-green-400 shadow-green-100 dark:shadow-green-900/30 shadow-md":T?"border-blue-500 shadow-blue-100 dark:shadow-blue-900/30":"border-gray-300 dark:border-gray-600",n&&"opacity-60",o.locked&&"!cursor-default"),style:{left:o.x,top:o.y,width:S,height:o.height,userSelect:"none",overflow:o.height?"hidden":void 0},children:[d("div",{className:p("flex items-center justify-between px-3 gap-2","bg-gray-50 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600"),style:{height:O},children:[l&&!i&&!n?t("input",{className:"flex-1 min-w-0 text-sm font-semibold text-gray-800 dark:text-gray-100 bg-transparent border-none outline-none focus:ring-0 p-0 truncate cursor-text","aria-label":s.schemaEditorTableName,value:o.name,onChange:U,onMouseDown:e=>e.stopPropagation()}):t("span",{className:"flex-1 min-w-0 text-sm font-semibold text-gray-800 dark:text-gray-100 truncate",children:o.name}),t("button",{type:"button",className:"flex-shrink-0 p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-500 dark:text-gray-400",onClick:e=>{e.stopPropagation(),v?.(o.id)},onMouseDown:e=>e.stopPropagation(),"aria-label":w?s.schemaEditorExpandTable:s.schemaEditorCollapseTable,children:t(te,{collapsed:w})})]}),!w&&(l&&!i&&!n?t("div",{className:"px-3 border-b border-gray-100 dark:border-gray-700 flex items-center",style:{height:F},children:t("input",{className:"w-full text-xs italic text-gray-400 dark:text-gray-500 bg-transparent border-none outline-none focus:ring-0 p-0 placeholder-gray-400 dark:placeholder-gray-500","aria-label":s.schemaEditorTableNotes,placeholder:s.schemaEditorNotesPlaceholder,value:o.notes??"",onChange:e=>y?.(o.id,e.target.value),onMouseDown:e=>e.stopPropagation()})}):o.notes?t("div",{className:"px-3 border-b border-gray-100 dark:border-gray-700 flex items-center",style:{height:F},children:t("span",{className:"text-xs italic text-gray-400 dark:text-gray-500 truncate",children:o.notes})}):null),!w&&d("div",{className:o.height?"overflow-y-auto flex-1 min-h-0":void 0,children:[o.fields.map((e,a)=>d("div",{"data-field-id":e.id,"data-table-id":o.id,className:p("flex items-center gap-1.5 pr-2 relative group",l&&!i&&!n?"pl-[18px]":"pl-2","border-b border-gray-100 dark:border-gray-700 last:border-b-0",x?"bg-blue-50/50 dark:bg-blue-900/10":"hover:bg-gray-50 dark:hover:bg-gray-700/50",W===a&&"opacity-40",V===a&&"!border-t-2 !border-t-blue-400"),style:{height:D},draggable:l&&!i&&!n,onDragStart:r=>{!l||i||n||(r.stopPropagation(),m.current=a,I(a),r.dataTransfer.effectAllowed="move",r.dataTransfer.setData("text/plain",String(a)))},onDragOver:r=>{m.current!==null&&(r.preventDefault(),r.stopPropagation(),N(a))},onDragLeave:()=>{V===a&&N(null)},onDrop:r=>{r.preventDefault(),r.stopPropagation(),m.current!==null&&m.current!==a&&u?.(o.id,m.current,a),m.current=null,I(null),N(null)},onDragEnd:()=>{m.current=null,I(null),N(null)},children:[t("div",{"data-connection-side":"left","data-field-id":e.id,"data-table-id":o.id,className:p("absolute -left-[5px] w-2.5 h-2.5 rounded-full border-2 border-white dark:border-gray-800 cursor-crosshair z-10 transition-all",x?"opacity-100 bg-green-400 scale-150 shadow-[0_0_6px_rgba(74,222,128,0.6)]":"opacity-0 group-hover:opacity-100 bg-blue-400"),style:{top:D/2-5}}),l&&!i&&!n&&t("span",{className:"absolute left-[3px] cursor-grab active:cursor-grabbing opacity-0 group-hover:opacity-100 transition-opacity z-10",style:{top:D/2-6},children:t(re,{})}),l&&!i&&!n?t("button",{type:"button",className:p("w-4 text-xs font-bold flex-shrink-0 text-center cursor-pointer",e.nullable?"text-gray-400":"text-transparent"),onClick:r=>{r.stopPropagation(),j(e.id,e.nullable??!1)},onMouseDown:r=>r.stopPropagation(),title:e.nullable?s.schemaEditorNullable:s.schemaEditorNotNullable,children:"?"}):t("span",{className:p("w-4 text-xs font-bold flex-shrink-0 text-center",e.nullable?"text-gray-400":"text-transparent"),children:e.nullable?"?":""}),e.primaryKey&&e.foreignKey?d("span",{className:"flex items-center gap-0.5 flex-shrink-0",children:[l&&!i&&!n?t("button",{type:"button",className:"flex-shrink-0 cursor-pointer",onClick:r=>{r.stopPropagation(),C(e.id,!0)},onMouseDown:r=>r.stopPropagation(),title:s.schemaEditorRemovePrimaryKey,children:t(E,{})}):t(E,{}),t(H,{})]}):e.primaryKey?l&&!i&&!n?t("button",{type:"button",className:"flex-shrink-0 cursor-pointer",onClick:r=>{r.stopPropagation(),C(e.id,!0)},onMouseDown:r=>r.stopPropagation(),title:s.schemaEditorRemovePrimaryKey,children:t(E,{})}):t(E,{}):e.foreignKey?t(H,{}):l&&!i&&!n?t("button",{type:"button",className:"w-3.5 h-3.5 flex-shrink-0 rounded text-gray-300 hover:text-indigo-400 transition-colors cursor-pointer",onClick:r=>{r.stopPropagation(),C(e.id,!1)},onMouseDown:r=>r.stopPropagation(),title:s.schemaEditorSetPrimaryKey,"aria-label":s.schemaEditorSetPrimaryKey,children:d("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",opacity:"0.3",children:[t("path",{d:"M10 1l2 2-5 5M8.5 4.5L11 7"}),t("circle",{cx:"4.5",cy:"11.5",r:"3"})]})}):t("span",{className:"w-3.5 flex-shrink-0"}),l&&!i&&!n?t("input",{className:p("flex-1 min-w-0 text-xs bg-transparent border-none outline-none focus:ring-0 p-0 truncate cursor-text",e.primaryKey?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-300"),"aria-label":s.schemaEditorFieldName,value:e.name,onChange:r=>A(e.id,r.target.value),onMouseDown:r=>r.stopPropagation()}):t("span",{className:p("flex-1 min-w-0 text-xs truncate",e.primaryKey?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-300"),children:e.name}),l&&!i&&!n?d("select",{className:"text-xs text-gray-400 dark:text-gray-500 bg-transparent border-none outline-none focus:ring-0 p-0 cursor-pointer text-right",value:e.type,onChange:r=>q(e.id,r.target.value),onMouseDown:r=>r.stopPropagation(),children:[R.map(r=>t("option",{value:r,children:r},r)),!R.includes(e.type)&&t("option",{value:e.type,children:e.type})]}):t("span",{className:"text-xs text-gray-400 dark:text-gray-500 flex-shrink-0",children:e.type}),t(ae,{field:e,tableId:o.id,editable:l,readOnly:i,disabled:n,onFieldChange:c,labels:s}),e.indexed&&t(_,{}),e.unique&&t(K,{}),l&&!i&&!n&&d("div",{className:"absolute right-1 top-0 bottom-0 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity bg-gradient-to-l from-white via-white to-transparent dark:from-gray-800 dark:via-gray-800 pl-4 pr-1 z-10",children:[t("button",{type:"button",className:p("cursor-pointer transition-opacity",e.indexed?"opacity-100":"opacity-30 hover:opacity-100"),onClick:r=>{r.stopPropagation(),G(e.id,e.indexed??!1)},onMouseDown:r=>r.stopPropagation(),title:e.indexed?s.schemaEditorRemoveIndex:s.schemaEditorAddIndex,children:t(_,{})}),t("button",{type:"button",className:p("cursor-pointer transition-opacity",e.unique?"opacity-100":"opacity-30 hover:opacity-100"),onClick:r=>{r.stopPropagation(),Y(e.id,e.unique??!1)},onMouseDown:r=>r.stopPropagation(),title:e.unique?s.schemaEditorRemoveUnique:s.schemaEditorAddUnique,children:t(K,{})}),t("button",{type:"button",className:"p-0.5 rounded text-gray-300 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 cursor-pointer",onClick:r=>{r.stopPropagation(),f?.(o.id,e.id)},onMouseDown:r=>r.stopPropagation(),title:s.schemaEditorRemoveField,children:t(oe,{})})]}),t("div",{"data-connection-side":"right","data-field-id":e.id,"data-table-id":o.id,className:p("absolute -right-[5px] w-2.5 h-2.5 rounded-full border-2 border-white dark:border-gray-800 cursor-crosshair z-10 transition-all",x?"opacity-100 bg-green-400 scale-150 shadow-[0_0_6px_rgba(74,222,128,0.6)]":"opacity-0 group-hover:opacity-100 bg-green-400"),style:{top:D/2-5}})]},e.id)),l&&!i&&!n&&d("button",{type:"button",className:"flex items-center justify-center w-full gap-1 text-xs text-gray-400 hover:text-blue-600 hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors cursor-pointer",style:{height:Q},onClick:e=>{e.stopPropagation(),X()},onMouseDown:e=>e.stopPropagation(),children:[t("svg",{className:"w-3 h-3",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:t("path",{d:"M8 4v8M4 8h8"})}),s.schemaEditorAddField]})]}),!n&&!i&&t("div",{"data-resize-handle":"corner",className:"absolute -bottom-[5px] -right-[5px] w-[14px] h-[14px] cursor-nwse-resize z-20 group/resize",onMouseDown:e=>{e.stopPropagation(),e.preventDefault();let a=o.height??$(o,l);z?.(o.id,e.clientX,e.clientY,S,a)},children:d("svg",{className:"w-full h-full text-gray-300 group-hover/resize:text-blue-400 transition-colors",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:[t("path",{d:"M12 2v10H2",opacity:"0"}),t("path",{d:"M6 12L12 6"}),t("path",{d:"M10 12L12 10"})]})})]})});export{ue as SchemaTableRenderer};
@@ -1 +1 @@
1
- "use strict";"use client";var q=Object.defineProperty;var Me=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var Te=Object.prototype.hasOwnProperty;var Ae=(s,o)=>{for(var c in o)q(s,c,{get:o[c],enumerable:!0})},Pe=(s,o,c,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of Oe(o))!Te.call(s,i)&&i!==c&&q(s,i,{get:()=>o[i],enumerable:!(l=Me(o,i))||l.enumerable});return s};var Re=s=>Pe(q({},"__esModule",{value:!0}),s);var je={};Ae(je,{Select:()=>Ye});module.exports=Re(je);var r=require("react"),ue=require("react-dom"),de=require("../../lib/aria-hide.cjs"),pe=require("../../lib/i18n.cjs"),n=require("react/jsx-runtime"),F=()=>{},He=[],Ke=(0,n.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0",children:(0,n.jsx)("path",{d:"M4 6L8 10L12 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Ve=(0,n.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:"shrink-0",children:(0,n.jsx)("path",{d:"M10.5 3.5L3.5 10.5M3.5 3.5L10.5 10.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Be=(0,n.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0 animate-spin",children:[(0,n.jsx)("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"2",strokeOpacity:"0.25"}),(0,n.jsx)("path",{d:"M14 8a6 6 0 00-6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}),$e=(0,n.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:"shrink-0",children:(0,n.jsx)("path",{d:"M11.5 3.5L5.5 10.5L2.5 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),P={sm:{trigger:"h-8 px-2.5 text-xs gap-1.5",content:"text-xs",option:"px-2.5 py-1.5",searchInput:"px-2.5 py-1.5 text-xs"},md:{trigger:"h-10 px-3 text-sm gap-2",content:"text-sm",option:"px-3 py-2",searchInput:"px-3 py-2 text-sm"},lg:{trigger:"h-12 px-4 text-base gap-2.5",content:"text-base",option:"px-4 py-2.5",searchInput:"px-4 py-2.5 text-base"}},ce={default:{trigger:"border border-gray-300 bg-white dark:border-gray-600 dark:bg-gray-800",focus:"focus:ring-2 focus:ring-blue-500 focus:border-blue-500"},outlined:{trigger:"border-2 border-gray-300 bg-transparent dark:border-gray-600",focus:"focus:ring-2 focus:ring-blue-500 focus:border-blue-500"},filled:{trigger:"border border-transparent bg-gray-100 dark:bg-gray-700",focus:"focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}};function w(...s){let o="";for(let c=0;c<s.length;c++){let l=s[c];l&&(o&&(o+=" "),o+=l)}return o}function We(s,o){if(!o)return s;let c=o.toLowerCase();return s.filter(l=>{if(l.label.toLowerCase().includes(c)||l.value.toLowerCase().includes(c))return!0;if(l.keywords){for(let i of l.keywords)if(i.toLowerCase().includes(c))return!0}return!1})}var Ue=(0,r.memo)((0,r.forwardRef)(function({option:o,isSelected:c,isHighlighted:l,isDisabled:i,sizeKey:B,optionId:g,onClick:m,onMouseEnter:I,index:k},R){let $=()=>{i||m(o.value)},E=()=>{i||I(k)};return(0,n.jsxs)("div",{ref:R,id:g,role:"option","aria-selected":c,"aria-disabled":i||void 0,"data-highlighted":l||void 0,className:w(P[B].option,"flex items-center gap-2 cursor-pointer select-none transition-colors",l&&!i&&"bg-blue-50 dark:bg-blue-900/30",c&&!l&&"bg-gray-50 dark:bg-gray-700/50",i&&"opacity-50 cursor-not-allowed"),onClick:$,onMouseEnter:E,children:[o.icon?(0,n.jsx)("span",{className:"flex shrink-0 items-center",children:o.icon}):null,(0,n.jsxs)("span",{className:"flex flex-col min-w-0 flex-1",children:[(0,n.jsx)("span",{className:"truncate",children:o.label}),o.description?(0,n.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:o.description}):null]}),c?(0,n.jsx)("span",{className:"ml-auto text-blue-600 dark:text-blue-400",children:$e}):null]})}));function Ye({options:s=He,value:o,defaultValue:c,onValueChange:l,searchable:i=!1,clearable:B=!1,disabled:g=!1,readOnly:m=!1,loading:I=!1,size:k="md",variant:R="default",placeholder:$,label:E,description:Q,helperText:X,error:D,required:Z=!1,noOptionsText:fe,clearLabel:ge,searchLabel:be,searchPlaceholder:me,onSearchChange:G,name:J,className:he,triggerClassName:ve,contentClassName:xe,maxHeight:W=256}){let C=(0,pe.useUILabels)(),we=$??C.selectPlaceholder,ke=fe??C.selectNoOptions,S=(0,r.useId)(),U=`${S}-label`,ee=`${S}-trigger`,te=`${S}-listbox`,v=(0,r.useRef)(null),Y=(0,r.useRef)(null),ne=(0,r.useRef)(null),re=(0,r.useRef)([]),M=o!==void 0,[ye,oe]=(0,r.useState)(c??""),L=M?o:ye,[p,j]=(0,r.useState)(!1),[z,O]=(0,r.useState)(""),[a,f]=(0,r.useState)(-1),[T,se]=(0,r.useState)(null),d=(0,r.useMemo)(()=>i?We(s,z):s,[s,z,i]),H=(0,r.useMemo)(()=>s.find(e=>e.value===L)??null,[s,L]),x=(0,r.useMemo)(()=>{let e=new Set;for(let t of s)t.disabled&&e.add(t.value);return e},[s]),N=(0,r.useCallback)(e=>{M||oe(e),(l??F)(e),j(!1),O(""),f(-1),v.current?.focus()},[M,l]),Ee=(0,r.useCallback)(e=>{e.stopPropagation(),M||oe(""),(l??F)(""),O(""),v.current?.focus()},[M,l]),A=(0,r.useCallback)(()=>{g||m||(j(!0),O(""),f(-1))},[g,m]),b=(0,r.useCallback)(()=>{j(!1),O(""),f(-1),v.current?.focus()},[]),Le=(0,r.useCallback)(()=>{p?b():A()},[p,b,A]),h=(0,r.useCallback)((e,t)=>{let u=d.length;if(u===0)return-1;let y=e;for(let V=0;V<u;V++)if(y=((y+t)%u+u)%u,!x.has(d[y].value))return y;return-1},[d,x]),Ne=(0,r.useCallback)(e=>{if(!(g||m)){if(p){switch(e.key){case"ArrowDown":{e.preventDefault();let t=h(a,1);t!==-1&&f(t);break}case"ArrowUp":{e.preventDefault();let t=h(a,-1);t!==-1&&f(t);break}case"Home":{e.preventDefault();let t=h(-1,1);t!==-1&&f(t);break}case"End":{e.preventDefault();let t=h(d.length,-1);t!==-1&&f(t);break}case"Enter":{if(e.preventDefault(),a>=0&&a<d.length){let t=d[a];x.has(t.value)||N(t.value)}break}case" ":if(e.preventDefault(),a>=0&&a<d.length){let t=d[a];x.has(t.value)||N(t.value)}else b();break;case"Escape":e.preventDefault(),b();break;case"Tab":b();break}return}switch(e.key){case"ArrowDown":case"ArrowUp":e.preventDefault(),A();break;case"Enter":case" ":e.preventDefault(),A();break}}},[g,m,p,A,b,a,d,x,h,N]),Ie=(0,r.useCallback)(e=>{switch(e.key){case"ArrowDown":{e.preventDefault();let t=h(a,1);t!==-1&&f(t);break}case"ArrowUp":{e.preventDefault();let t=h(a,-1);t!==-1&&f(t);break}case"Home":{e.preventDefault();let t=h(-1,1);t!==-1&&f(t);break}case"End":{e.preventDefault();let t=h(d.length,-1);t!==-1&&f(t);break}case"Enter":{if(e.preventDefault(),a>=0&&a<d.length){let t=d[a];x.has(t.value)||N(t.value)}break}case"Escape":e.preventDefault(),b();break;case"Tab":b();break}},[a,d,x,h,N,b]),De=(0,r.useCallback)(e=>{let t=e.target.value;O(t),f(-1),(G??F)(t)},[G]);(0,r.useEffect)(()=>{if(!p)return;let e=t=>{let u=t.target;v.current?.contains(u)||Y.current?.contains(u)||b()};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e,{passive:!0}),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}},[p,b]),(0,r.useEffect)(()=>{if(!p||!v.current){se(null);return}let e=()=>{let t=v.current;if(!t)return;let u=t.getBoundingClientRect(),y=window.innerHeight-u.bottom,V=u.top,le=W+8,ie=y<le&&V>y?"top":"bottom";se({top:ie==="bottom"?u.bottom+window.scrollY+4:u.top+window.scrollY-le,left:u.left+window.scrollX,width:u.width,placement:ie})};return e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[p,W]);let K=p&&T!==null;(0,r.useEffect)(()=>{K&&i&&ne.current?.focus()},[K,i]),(0,r.useEffect)(()=>{let e=Y.current;if(!(!K||!e))return(0,de.registerFloatingLayer)(e,()=>v.current)},[K]),(0,r.useEffect)(()=>{if(a>=0){let e=re.current[a];e&&typeof e.scrollIntoView=="function"&&e.scrollIntoView({block:"nearest"})}},[a]);let _=L!==""&&L!==void 0,Ce=B&&_&&!g&&!m&&!I,ae=!g&&!m,Se=w("w-full flex items-center justify-between rounded-md transition-colors","text-gray-900 dark:text-gray-100",P[k].trigger,ce[R].trigger,!D&&ae&&ce[R].focus,D&&"border-red-500 dark:border-red-400 focus:ring-2 focus:ring-red-500 focus:border-red-500",g&&"opacity-50 cursor-not-allowed bg-gray-50 dark:bg-gray-900",m&&"cursor-default",!g&&!m&&"cursor-pointer",ve);return(0,n.jsxs)("div",{className:w("flex flex-col gap-1",he),children:[E?(0,n.jsxs)("label",{id:U,htmlFor:ee,className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:[E,Z?(0,n.jsx)("span",{className:"text-red-500 ml-0.5","aria-hidden":"true",children:"*"}):null]}):null,Q?(0,n.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:Q}):null,(0,n.jsxs)("button",{ref:v,id:ee,type:"button",role:"combobox","aria-expanded":p,"aria-haspopup":"listbox","aria-controls":p?te:void 0,"aria-labelledby":E?U:void 0,"aria-required":Z||void 0,"aria-invalid":D?!0:void 0,"aria-activedescendant":p&&a>=0?`${S}-option-${a}`:void 0,disabled:g,className:Se,onClick:ae?Le:void 0,onKeyDown:Ne,children:[(0,n.jsxs)("span",{className:w("flex items-center gap-2 min-w-0 flex-1 truncate",!_&&"text-gray-400 dark:text-gray-500"),children:[H?.icon?(0,n.jsx)("span",{className:"flex shrink-0 items-center",children:H.icon}):null,(0,n.jsx)("span",{className:"truncate",children:_&&H?H.label:we})]}),(0,n.jsxs)("span",{className:"flex items-center gap-1 shrink-0",children:[I?(0,n.jsx)("span",{className:"text-gray-400",children:Be}):null,Ce?(0,n.jsx)("span",{role:"button",tabIndex:-1,"aria-label":ge??C.selectClear,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 p-0.5 rounded transition-colors",onClick:Ee,onMouseDown:e=>e.preventDefault(),children:Ve}):null,(0,n.jsx)("span",{className:w("text-gray-400 transition-transform duration-200",p&&"rotate-180"),children:Ke})]})]}),D?(0,n.jsx)("p",{role:"alert",className:"text-xs text-red-500 dark:text-red-400",children:D}):X?(0,n.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:X}):null,J?(0,n.jsx)("input",{type:"hidden",name:J,value:L??""}):null,p&&T?(0,ue.createPortal)((0,n.jsxs)("div",{ref:Y,role:"listbox",id:te,"aria-labelledby":E?U:void 0,className:w("fixed z-50 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700","rounded-md shadow-lg overflow-hidden","animate-in fade-in-0 zoom-in-95",P[k].content,xe),style:{top:T.top,left:T.left,width:T.width,position:"absolute"},onKeyDown:Ie,children:[i?(0,n.jsx)("div",{className:"border-b border-gray-200 dark:border-gray-700",children:(0,n.jsx)("input",{ref:ne,type:"text",role:"searchbox","aria-label":be??C.selectSearch,className:w(P[k].searchInput,"w-full outline-none bg-transparent text-gray-900 dark:text-gray-100","placeholder:text-gray-400 dark:placeholder:text-gray-500"),placeholder:me??C.selectSearchPlaceholder,value:z,onChange:De})}):null,(0,n.jsx)("div",{className:"overflow-y-auto",style:{maxHeight:W},children:d.length===0?(0,n.jsx)("div",{className:w(P[k].option,"text-gray-500 dark:text-gray-400 text-center py-4"),children:ke}):d.map((e,t)=>(0,n.jsx)(Ue,{option:e,isSelected:e.value===L,isHighlighted:t===a,isDisabled:I||x.has(e.value),sizeKey:k,optionId:`${S}-option-${t}`,onClick:N,onMouseEnter:f,index:t,ref:u=>{re.current[t]=u}},e.value))})]}),document.body):null]})}0&&(module.exports={Select});
1
+ "use strict";"use client";var q=Object.defineProperty;var Me=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var Te=Object.prototype.hasOwnProperty;var Ae=(a,o)=>{for(var c in o)q(a,c,{get:o[c],enumerable:!0})},Pe=(a,o,c,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of Oe(o))!Te.call(a,i)&&i!==c&&q(a,i,{get:()=>o[i],enumerable:!(l=Me(o,i))||l.enumerable});return a};var Re=a=>Pe(q({},"__esModule",{value:!0}),a);var je={};Ae(je,{Select:()=>Ye});module.exports=Re(je);var r=require("react"),ue=require("react-dom"),de=require("../../lib/aria-hide.cjs"),pe=require("../../lib/i18n.cjs"),n=require("react/jsx-runtime"),F=()=>{},He=[],Ke=(0,n.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0",children:(0,n.jsx)("path",{d:"M4 6L8 10L12 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Ve=(0,n.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:"shrink-0",children:(0,n.jsx)("path",{d:"M10.5 3.5L3.5 10.5M3.5 3.5L10.5 10.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Be=(0,n.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0 animate-spin",children:[(0,n.jsx)("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"2",strokeOpacity:"0.25"}),(0,n.jsx)("path",{d:"M14 8a6 6 0 00-6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}),$e=(0,n.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:"shrink-0",children:(0,n.jsx)("path",{d:"M11.5 3.5L5.5 10.5L2.5 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),P={sm:{trigger:"h-8 px-2.5 text-xs gap-1.5",content:"text-xs",option:"px-2.5 py-1.5",searchInput:"px-2.5 py-1.5 text-xs"},md:{trigger:"h-10 px-3 text-sm gap-2",content:"text-sm",option:"px-3 py-2",searchInput:"px-3 py-2 text-sm"},lg:{trigger:"h-12 px-4 text-base gap-2.5",content:"text-base",option:"px-4 py-2.5",searchInput:"px-4 py-2.5 text-base"}},ce={default:{trigger:"border border-gray-300 bg-white dark:border-gray-600 dark:bg-gray-800",focus:"focus:ring-2 focus:ring-blue-500 focus:border-blue-500"},outlined:{trigger:"border-2 border-gray-300 bg-transparent dark:border-gray-600",focus:"focus:ring-2 focus:ring-blue-500 focus:border-blue-500"},filled:{trigger:"border border-transparent bg-gray-100 dark:bg-gray-700",focus:"focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}};function k(...a){let o="";for(let c=0;c<a.length;c++){let l=a[c];l&&(o&&(o+=" "),o+=l)}return o}function We(a,o){if(!o)return a;let c=o.toLowerCase();return a.filter(l=>{if(l.label.toLowerCase().includes(c)||l.value.toLowerCase().includes(c))return!0;if(l.keywords){for(let i of l.keywords)if(i.toLowerCase().includes(c))return!0}return!1})}var Ue=(0,r.memo)((0,r.forwardRef)(function({option:o,isSelected:c,isHighlighted:l,isDisabled:i,sizeKey:B,optionId:g,onClick:m,onMouseEnter:I,index:w},R){let $=()=>{i||m(o.value)},E=()=>{i||I(w)};return(0,n.jsxs)("div",{ref:R,id:g,role:"option","aria-selected":c,"aria-disabled":i||void 0,"data-highlighted":l||void 0,className:k(P[B].option,"flex items-center gap-2 cursor-pointer select-none transition-colors",l&&!i&&"bg-blue-50 dark:bg-blue-900/30",c&&!l&&"bg-gray-50 dark:bg-gray-700/50",i&&"opacity-50 cursor-not-allowed"),onClick:$,onMouseEnter:E,children:[o.icon?(0,n.jsx)("span",{className:"flex shrink-0 items-center",children:o.icon}):null,(0,n.jsxs)("span",{className:"flex flex-col min-w-0 flex-1",children:[(0,n.jsx)("span",{className:"truncate",children:o.label}),o.description?(0,n.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:o.description}):null]}),c?(0,n.jsx)("span",{className:"ml-auto text-blue-600 dark:text-blue-400",children:$e}):null]})}));function Ye({options:a=He,value:o,defaultValue:c,onValueChange:l,searchable:i=!1,clearable:B=!1,disabled:g=!1,readOnly:m=!1,loading:I=!1,size:w="md",variant:R="default",placeholder:$,label:E,description:Q,helperText:X,error:D,required:Z=!1,noOptionsText:fe,clearLabel:ge,searchLabel:be,searchPlaceholder:me,onSearchChange:G,name:J,className:he,triggerClassName:ve,contentClassName:xe,maxHeight:W=256}){let C=(0,pe.useUILabels)(),ke=$??C.selectPlaceholder,we=fe??C.selectNoOptions,S=(0,r.useId)(),U=`${S}-label`,ee=`${S}-trigger`,te=`${S}-listbox`,v=(0,r.useRef)(null),Y=(0,r.useRef)(null),ne=(0,r.useRef)(null),re=(0,r.useRef)([]),M=o!==void 0,[ye,oe]=(0,r.useState)(c??""),L=M?o:ye,[p,j]=(0,r.useState)(!1),[z,O]=(0,r.useState)(""),[s,f]=(0,r.useState)(-1),[T,ae]=(0,r.useState)(null),d=(0,r.useMemo)(()=>i?We(a,z):a,[a,z,i]),H=(0,r.useMemo)(()=>a.find(e=>e.value===L)??null,[a,L]),x=(0,r.useMemo)(()=>{let e=new Set;for(let t of a)t.disabled&&e.add(t.value);return e},[a]),N=(0,r.useCallback)(e=>{M||oe(e),(l??F)(e),j(!1),O(""),f(-1),v.current?.focus()},[M,l]),Ee=(0,r.useCallback)(e=>{e.stopPropagation(),M||oe(""),(l??F)(""),O(""),v.current?.focus()},[M,l]),A=(0,r.useCallback)(()=>{g||m||(j(!0),O(""),f(-1))},[g,m]),b=(0,r.useCallback)(()=>{j(!1),O(""),f(-1),v.current?.focus()},[]),Le=(0,r.useCallback)(()=>{p?b():A()},[p,b,A]),h=(0,r.useCallback)((e,t)=>{let u=d.length;if(u===0)return-1;let y=e;for(let V=0;V<u;V++)if(y=((y+t)%u+u)%u,!x.has(d[y].value))return y;return-1},[d,x]),Ne=(0,r.useCallback)(e=>{if(!(g||m)){if(p){switch(e.key){case"ArrowDown":{e.preventDefault();let t=h(s,1);t!==-1&&f(t);break}case"ArrowUp":{e.preventDefault();let t=h(s,-1);t!==-1&&f(t);break}case"Home":{e.preventDefault();let t=h(-1,1);t!==-1&&f(t);break}case"End":{e.preventDefault();let t=h(d.length,-1);t!==-1&&f(t);break}case"Enter":{if(e.preventDefault(),s>=0&&s<d.length){let t=d[s];x.has(t.value)||N(t.value)}break}case" ":if(e.preventDefault(),s>=0&&s<d.length){let t=d[s];x.has(t.value)||N(t.value)}else b();break;case"Escape":e.preventDefault(),b();break;case"Tab":b();break}return}switch(e.key){case"ArrowDown":case"ArrowUp":e.preventDefault(),A();break;case"Enter":case" ":e.preventDefault(),A();break}}},[g,m,p,A,b,s,d,x,h,N]),Ie=(0,r.useCallback)(e=>{switch(e.key){case"ArrowDown":{e.preventDefault();let t=h(s,1);t!==-1&&f(t);break}case"ArrowUp":{e.preventDefault();let t=h(s,-1);t!==-1&&f(t);break}case"Home":{e.preventDefault();let t=h(-1,1);t!==-1&&f(t);break}case"End":{e.preventDefault();let t=h(d.length,-1);t!==-1&&f(t);break}case"Enter":{if(e.preventDefault(),s>=0&&s<d.length){let t=d[s];x.has(t.value)||N(t.value)}break}case"Escape":e.preventDefault(),b();break;case"Tab":b();break}},[s,d,x,h,N,b]),De=(0,r.useCallback)(e=>{let t=e.target.value;O(t),f(-1),(G??F)(t)},[G]);(0,r.useEffect)(()=>{if(!p)return;let e=t=>{let u=t.target;v.current?.contains(u)||Y.current?.contains(u)||b()};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e,{passive:!0}),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}},[p,b]),(0,r.useEffect)(()=>{if(!p||!v.current){ae(null);return}let e=()=>{let t=v.current;if(!t)return;let u=t.getBoundingClientRect(),y=window.innerHeight-u.bottom,V=u.top,le=W+8,ie=y<le&&V>y?"top":"bottom";ae({top:ie==="bottom"?u.bottom+window.scrollY+4:u.top+window.scrollY-le,left:u.left+window.scrollX,width:u.width,placement:ie})};return e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[p,W]);let K=p&&T!==null;(0,r.useEffect)(()=>{K&&i&&ne.current?.focus()},[K,i]),(0,r.useEffect)(()=>{let e=Y.current;if(!(!K||!e))return(0,de.registerFloatingLayer)(e,()=>v.current)},[K]),(0,r.useEffect)(()=>{if(s>=0){let e=re.current[s];e&&typeof e.scrollIntoView=="function"&&e.scrollIntoView({block:"nearest"})}},[s]);let _=L!==""&&L!==void 0,Ce=B&&_&&!g&&!m&&!I,se=!g&&!m,Se=k("w-full flex items-center justify-between rounded-md transition-colors","text-gray-900 dark:text-gray-100",P[w].trigger,ce[R].trigger,!D&&se&&ce[R].focus,D&&"border-red-500 dark:border-red-400 focus:ring-2 focus:ring-red-500 focus:border-red-500",g&&"opacity-50 cursor-not-allowed bg-gray-50 dark:bg-gray-900",m&&"cursor-default",!g&&!m&&"cursor-pointer",ve);return(0,n.jsxs)("div",{className:k("flex flex-col gap-1",he),children:[E?(0,n.jsxs)("label",{id:U,htmlFor:ee,className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:[E,Z?(0,n.jsx)("span",{className:"text-red-600 dark:text-red-400 ml-0.5","aria-hidden":"true",children:"*"}):null]}):null,Q?(0,n.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:Q}):null,(0,n.jsxs)("button",{ref:v,id:ee,type:"button",role:"combobox","aria-expanded":p,"aria-haspopup":"listbox","aria-controls":p?te:void 0,"aria-labelledby":E?U:void 0,"aria-required":Z||void 0,"aria-invalid":D?!0:void 0,"aria-activedescendant":p&&s>=0?`${S}-option-${s}`:void 0,disabled:g,className:Se,onClick:se?Le:void 0,onKeyDown:Ne,children:[(0,n.jsxs)("span",{className:k("flex items-center gap-2 min-w-0 flex-1 truncate",!_&&"text-gray-400 dark:text-gray-500"),children:[H?.icon?(0,n.jsx)("span",{className:"flex shrink-0 items-center",children:H.icon}):null,(0,n.jsx)("span",{className:"truncate",children:_&&H?H.label:ke})]}),(0,n.jsxs)("span",{className:"flex items-center gap-1 shrink-0",children:[I?(0,n.jsx)("span",{className:"text-gray-400",children:Be}):null,Ce?(0,n.jsx)("span",{role:"button",tabIndex:-1,"aria-label":ge??C.selectClear,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 p-0.5 rounded transition-colors",onClick:Ee,onMouseDown:e=>e.preventDefault(),children:Ve}):null,(0,n.jsx)("span",{className:k("text-gray-400 transition-transform duration-200",p&&"rotate-180"),children:Ke})]})]}),D?(0,n.jsx)("p",{role:"alert",className:"text-xs text-red-600 dark:text-red-400",children:D}):X?(0,n.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:X}):null,J?(0,n.jsx)("input",{type:"hidden",name:J,value:L??""}):null,p&&T?(0,ue.createPortal)((0,n.jsxs)("div",{ref:Y,role:"listbox",id:te,"aria-labelledby":E?U:void 0,className:k("fixed z-50 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700","rounded-md shadow-lg overflow-hidden","animate-in fade-in-0 zoom-in-95",P[w].content,xe),style:{top:T.top,left:T.left,width:T.width,position:"absolute"},onKeyDown:Ie,children:[i?(0,n.jsx)("div",{className:"border-b border-gray-200 dark:border-gray-700",children:(0,n.jsx)("input",{ref:ne,type:"text",role:"searchbox","aria-label":be??C.selectSearch,className:k(P[w].searchInput,"w-full outline-none bg-transparent text-gray-900 dark:text-gray-100","placeholder:text-gray-400 dark:placeholder:text-gray-500"),placeholder:me??C.selectSearchPlaceholder,value:z,onChange:De})}):null,(0,n.jsx)("div",{className:"overflow-y-auto",style:{maxHeight:W},children:d.length===0?(0,n.jsx)("div",{className:k(P[w].option,"text-gray-500 dark:text-gray-400 text-center py-4"),children:we}):d.map((e,t)=>(0,n.jsx)(Ue,{option:e,isSelected:e.value===L,isHighlighted:t===s,isDisabled:I||x.has(e.value),sizeKey:w,optionId:`${S}-option-${t}`,onClick:N,onMouseEnter:f,index:t,ref:u=>{re.current[t]=u}},e.value))})]}),document.body):null]})}0&&(module.exports={Select});
@@ -1 +1 @@
1
- "use client";import{useState as R,useRef as U,useEffect as H,useCallback as h,useMemo as Z,useId as Oe,memo as Te,forwardRef as Ae}from"react";import{createPortal as Pe}from"react-dom";import{registerFloatingLayer as Re}from"../../lib/aria-hide.js";import{useUILabels as He}from"../../lib/i18n.js";import{jsx as n,jsxs as v}from"react/jsx-runtime";var G=()=>{},Ke=[],Ve=n("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0",children:n("path",{d:"M4 6L8 10L12 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Be=n("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:"shrink-0",children:n("path",{d:"M10.5 3.5L3.5 10.5M3.5 3.5L10.5 10.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),$e=v("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0 animate-spin",children:[n("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"2",strokeOpacity:"0.25"}),n("path",{d:"M14 8a6 6 0 00-6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}),We=n("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:"shrink-0",children:n("path",{d:"M11.5 3.5L5.5 10.5L2.5 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),K={sm:{trigger:"h-8 px-2.5 text-xs gap-1.5",content:"text-xs",option:"px-2.5 py-1.5",searchInput:"px-2.5 py-1.5 text-xs"},md:{trigger:"h-10 px-3 text-sm gap-2",content:"text-sm",option:"px-3 py-2",searchInput:"px-3 py-2 text-sm"},lg:{trigger:"h-12 px-4 text-base gap-2.5",content:"text-base",option:"px-4 py-2.5",searchInput:"px-4 py-2.5 text-base"}},fe={default:{trigger:"border border-gray-300 bg-white dark:border-gray-600 dark:bg-gray-800",focus:"focus:ring-2 focus:ring-blue-500 focus:border-blue-500"},outlined:{trigger:"border-2 border-gray-300 bg-transparent dark:border-gray-600",focus:"focus:ring-2 focus:ring-blue-500 focus:border-blue-500"},filled:{trigger:"border border-transparent bg-gray-100 dark:bg-gray-700",focus:"focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}};function k(...i){let o="";for(let u=0;u<i.length;u++){let a=i[u];a&&(o&&(o+=" "),o+=a)}return o}function Ue(i,o){if(!o)return i;let u=o.toLowerCase();return i.filter(a=>{if(a.label.toLowerCase().includes(u)||a.value.toLowerCase().includes(u))return!0;if(a.keywords){for(let d of a.keywords)if(d.toLowerCase().includes(u))return!0}return!1})}var Ye=Te(Ae(function({option:o,isSelected:u,isHighlighted:a,isDisabled:d,sizeKey:Y,optionId:f,onClick:b,onMouseEnter:D,index:y},V){let j=()=>{d||b(o.value)},L=()=>{d||D(y)};return v("div",{ref:V,id:f,role:"option","aria-selected":u,"aria-disabled":d||void 0,"data-highlighted":a||void 0,className:k(K[Y].option,"flex items-center gap-2 cursor-pointer select-none transition-colors",a&&!d&&"bg-blue-50 dark:bg-blue-900/30",u&&!a&&"bg-gray-50 dark:bg-gray-700/50",d&&"opacity-50 cursor-not-allowed"),onClick:j,onMouseEnter:L,children:[o.icon?n("span",{className:"flex shrink-0 items-center",children:o.icon}):null,v("span",{className:"flex flex-col min-w-0 flex-1",children:[n("span",{className:"truncate",children:o.label}),o.description?n("span",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:o.description}):null]}),u?n("span",{className:"ml-auto text-blue-600 dark:text-blue-400",children:We}):null]})}));function Fe({options:i=Ke,value:o,defaultValue:u,onValueChange:a,searchable:d=!1,clearable:Y=!1,disabled:f=!1,readOnly:b=!1,loading:D=!1,size:y="md",variant:V="default",placeholder:j,label:L,description:J,helperText:ee,error:C,required:te=!1,noOptionsText:ge,clearLabel:be,searchLabel:me,searchPlaceholder:he,onSearchChange:ne,name:re,className:ve,triggerClassName:xe,contentClassName:we,maxHeight:z=256}){let S=He(),ke=j??S.selectPlaceholder,ye=ge??S.selectNoOptions,M=Oe(),_=`${M}-label`,oe=`${M}-trigger`,se=`${M}-listbox`,x=U(null),q=U(null),ae=U(null),le=U([]),O=o!==void 0,[Ee,ie]=R(u??""),N=O?o:Ee,[c,F]=R(!1),[Q,T]=R(""),[r,p]=R(-1),[A,ce]=R(null),l=Z(()=>d?Ue(i,Q):i,[i,Q,d]),B=Z(()=>i.find(e=>e.value===N)??null,[i,N]),w=Z(()=>{let e=new Set;for(let t of i)t.disabled&&e.add(t.value);return e},[i]),I=h(e=>{O||ie(e),(a??G)(e),F(!1),T(""),p(-1),x.current?.focus()},[O,a]),Le=h(e=>{e.stopPropagation(),O||ie(""),(a??G)(""),T(""),x.current?.focus()},[O,a]),P=h(()=>{f||b||(F(!0),T(""),p(-1))},[f,b]),g=h(()=>{F(!1),T(""),p(-1),x.current?.focus()},[]),Ne=h(()=>{c?g():P()},[c,g,P]),m=h((e,t)=>{let s=l.length;if(s===0)return-1;let E=e;for(let W=0;W<s;W++)if(E=((E+t)%s+s)%s,!w.has(l[E].value))return E;return-1},[l,w]),Ie=h(e=>{if(!(f||b)){if(c){switch(e.key){case"ArrowDown":{e.preventDefault();let t=m(r,1);t!==-1&&p(t);break}case"ArrowUp":{e.preventDefault();let t=m(r,-1);t!==-1&&p(t);break}case"Home":{e.preventDefault();let t=m(-1,1);t!==-1&&p(t);break}case"End":{e.preventDefault();let t=m(l.length,-1);t!==-1&&p(t);break}case"Enter":{if(e.preventDefault(),r>=0&&r<l.length){let t=l[r];w.has(t.value)||I(t.value)}break}case" ":if(e.preventDefault(),r>=0&&r<l.length){let t=l[r];w.has(t.value)||I(t.value)}else g();break;case"Escape":e.preventDefault(),g();break;case"Tab":g();break}return}switch(e.key){case"ArrowDown":case"ArrowUp":e.preventDefault(),P();break;case"Enter":case" ":e.preventDefault(),P();break}}},[f,b,c,P,g,r,l,w,m,I]),De=h(e=>{switch(e.key){case"ArrowDown":{e.preventDefault();let t=m(r,1);t!==-1&&p(t);break}case"ArrowUp":{e.preventDefault();let t=m(r,-1);t!==-1&&p(t);break}case"Home":{e.preventDefault();let t=m(-1,1);t!==-1&&p(t);break}case"End":{e.preventDefault();let t=m(l.length,-1);t!==-1&&p(t);break}case"Enter":{if(e.preventDefault(),r>=0&&r<l.length){let t=l[r];w.has(t.value)||I(t.value)}break}case"Escape":e.preventDefault(),g();break;case"Tab":g();break}},[r,l,w,m,I,g]),Ce=h(e=>{let t=e.target.value;T(t),p(-1),(ne??G)(t)},[ne]);H(()=>{if(!c)return;let e=t=>{let s=t.target;x.current?.contains(s)||q.current?.contains(s)||g()};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e,{passive:!0}),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}},[c,g]),H(()=>{if(!c||!x.current){ce(null);return}let e=()=>{let t=x.current;if(!t)return;let s=t.getBoundingClientRect(),E=window.innerHeight-s.bottom,W=s.top,de=z+8,pe=E<de&&W>E?"top":"bottom";ce({top:pe==="bottom"?s.bottom+window.scrollY+4:s.top+window.scrollY-de,left:s.left+window.scrollX,width:s.width,placement:pe})};return e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[c,z]);let $=c&&A!==null;H(()=>{$&&d&&ae.current?.focus()},[$,d]),H(()=>{let e=q.current;if(!(!$||!e))return Re(e,()=>x.current)},[$]),H(()=>{if(r>=0){let e=le.current[r];e&&typeof e.scrollIntoView=="function"&&e.scrollIntoView({block:"nearest"})}},[r]);let X=N!==""&&N!==void 0,Se=Y&&X&&!f&&!b&&!D,ue=!f&&!b,Me=k("w-full flex items-center justify-between rounded-md transition-colors","text-gray-900 dark:text-gray-100",K[y].trigger,fe[V].trigger,!C&&ue&&fe[V].focus,C&&"border-red-500 dark:border-red-400 focus:ring-2 focus:ring-red-500 focus:border-red-500",f&&"opacity-50 cursor-not-allowed bg-gray-50 dark:bg-gray-900",b&&"cursor-default",!f&&!b&&"cursor-pointer",xe);return v("div",{className:k("flex flex-col gap-1",ve),children:[L?v("label",{id:_,htmlFor:oe,className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:[L,te?n("span",{className:"text-red-500 ml-0.5","aria-hidden":"true",children:"*"}):null]}):null,J?n("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:J}):null,v("button",{ref:x,id:oe,type:"button",role:"combobox","aria-expanded":c,"aria-haspopup":"listbox","aria-controls":c?se:void 0,"aria-labelledby":L?_:void 0,"aria-required":te||void 0,"aria-invalid":C?!0:void 0,"aria-activedescendant":c&&r>=0?`${M}-option-${r}`:void 0,disabled:f,className:Me,onClick:ue?Ne:void 0,onKeyDown:Ie,children:[v("span",{className:k("flex items-center gap-2 min-w-0 flex-1 truncate",!X&&"text-gray-400 dark:text-gray-500"),children:[B?.icon?n("span",{className:"flex shrink-0 items-center",children:B.icon}):null,n("span",{className:"truncate",children:X&&B?B.label:ke})]}),v("span",{className:"flex items-center gap-1 shrink-0",children:[D?n("span",{className:"text-gray-400",children:$e}):null,Se?n("span",{role:"button",tabIndex:-1,"aria-label":be??S.selectClear,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 p-0.5 rounded transition-colors",onClick:Le,onMouseDown:e=>e.preventDefault(),children:Be}):null,n("span",{className:k("text-gray-400 transition-transform duration-200",c&&"rotate-180"),children:Ve})]})]}),C?n("p",{role:"alert",className:"text-xs text-red-500 dark:text-red-400",children:C}):ee?n("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:ee}):null,re?n("input",{type:"hidden",name:re,value:N??""}):null,c&&A?Pe(v("div",{ref:q,role:"listbox",id:se,"aria-labelledby":L?_:void 0,className:k("fixed z-50 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700","rounded-md shadow-lg overflow-hidden","animate-in fade-in-0 zoom-in-95",K[y].content,we),style:{top:A.top,left:A.left,width:A.width,position:"absolute"},onKeyDown:De,children:[d?n("div",{className:"border-b border-gray-200 dark:border-gray-700",children:n("input",{ref:ae,type:"text",role:"searchbox","aria-label":me??S.selectSearch,className:k(K[y].searchInput,"w-full outline-none bg-transparent text-gray-900 dark:text-gray-100","placeholder:text-gray-400 dark:placeholder:text-gray-500"),placeholder:he??S.selectSearchPlaceholder,value:Q,onChange:Ce})}):null,n("div",{className:"overflow-y-auto",style:{maxHeight:z},children:l.length===0?n("div",{className:k(K[y].option,"text-gray-500 dark:text-gray-400 text-center py-4"),children:ye}):l.map((e,t)=>n(Ye,{option:e,isSelected:e.value===N,isHighlighted:t===r,isDisabled:D||w.has(e.value),sizeKey:y,optionId:`${M}-option-${t}`,onClick:I,onMouseEnter:p,index:t,ref:s=>{le.current[t]=s}},e.value))})]}),document.body):null]})}export{Fe as Select};
1
+ "use client";import{useState as R,useRef as U,useEffect as H,useCallback as h,useMemo as Z,useId as Oe,memo as Te,forwardRef as Ae}from"react";import{createPortal as Pe}from"react-dom";import{registerFloatingLayer as Re}from"../../lib/aria-hide.js";import{useUILabels as He}from"../../lib/i18n.js";import{jsx as n,jsxs as v}from"react/jsx-runtime";var G=()=>{},Ke=[],Ve=n("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0",children:n("path",{d:"M4 6L8 10L12 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Be=n("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:"shrink-0",children:n("path",{d:"M10.5 3.5L3.5 10.5M3.5 3.5L10.5 10.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),$e=v("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0 animate-spin",children:[n("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"2",strokeOpacity:"0.25"}),n("path",{d:"M14 8a6 6 0 00-6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}),We=n("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:"shrink-0",children:n("path",{d:"M11.5 3.5L5.5 10.5L2.5 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),K={sm:{trigger:"h-8 px-2.5 text-xs gap-1.5",content:"text-xs",option:"px-2.5 py-1.5",searchInput:"px-2.5 py-1.5 text-xs"},md:{trigger:"h-10 px-3 text-sm gap-2",content:"text-sm",option:"px-3 py-2",searchInput:"px-3 py-2 text-sm"},lg:{trigger:"h-12 px-4 text-base gap-2.5",content:"text-base",option:"px-4 py-2.5",searchInput:"px-4 py-2.5 text-base"}},fe={default:{trigger:"border border-gray-300 bg-white dark:border-gray-600 dark:bg-gray-800",focus:"focus:ring-2 focus:ring-blue-500 focus:border-blue-500"},outlined:{trigger:"border-2 border-gray-300 bg-transparent dark:border-gray-600",focus:"focus:ring-2 focus:ring-blue-500 focus:border-blue-500"},filled:{trigger:"border border-transparent bg-gray-100 dark:bg-gray-700",focus:"focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}};function w(...i){let o="";for(let u=0;u<i.length;u++){let s=i[u];s&&(o&&(o+=" "),o+=s)}return o}function Ue(i,o){if(!o)return i;let u=o.toLowerCase();return i.filter(s=>{if(s.label.toLowerCase().includes(u)||s.value.toLowerCase().includes(u))return!0;if(s.keywords){for(let d of s.keywords)if(d.toLowerCase().includes(u))return!0}return!1})}var Ye=Te(Ae(function({option:o,isSelected:u,isHighlighted:s,isDisabled:d,sizeKey:Y,optionId:f,onClick:b,onMouseEnter:D,index:y},V){let j=()=>{d||b(o.value)},L=()=>{d||D(y)};return v("div",{ref:V,id:f,role:"option","aria-selected":u,"aria-disabled":d||void 0,"data-highlighted":s||void 0,className:w(K[Y].option,"flex items-center gap-2 cursor-pointer select-none transition-colors",s&&!d&&"bg-blue-50 dark:bg-blue-900/30",u&&!s&&"bg-gray-50 dark:bg-gray-700/50",d&&"opacity-50 cursor-not-allowed"),onClick:j,onMouseEnter:L,children:[o.icon?n("span",{className:"flex shrink-0 items-center",children:o.icon}):null,v("span",{className:"flex flex-col min-w-0 flex-1",children:[n("span",{className:"truncate",children:o.label}),o.description?n("span",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:o.description}):null]}),u?n("span",{className:"ml-auto text-blue-600 dark:text-blue-400",children:We}):null]})}));function Fe({options:i=Ke,value:o,defaultValue:u,onValueChange:s,searchable:d=!1,clearable:Y=!1,disabled:f=!1,readOnly:b=!1,loading:D=!1,size:y="md",variant:V="default",placeholder:j,label:L,description:J,helperText:ee,error:C,required:te=!1,noOptionsText:ge,clearLabel:be,searchLabel:me,searchPlaceholder:he,onSearchChange:ne,name:re,className:ve,triggerClassName:xe,contentClassName:ke,maxHeight:z=256}){let S=He(),we=j??S.selectPlaceholder,ye=ge??S.selectNoOptions,M=Oe(),_=`${M}-label`,oe=`${M}-trigger`,ae=`${M}-listbox`,x=U(null),q=U(null),se=U(null),le=U([]),O=o!==void 0,[Ee,ie]=R(u??""),N=O?o:Ee,[c,F]=R(!1),[Q,T]=R(""),[r,p]=R(-1),[A,ce]=R(null),l=Z(()=>d?Ue(i,Q):i,[i,Q,d]),B=Z(()=>i.find(e=>e.value===N)??null,[i,N]),k=Z(()=>{let e=new Set;for(let t of i)t.disabled&&e.add(t.value);return e},[i]),I=h(e=>{O||ie(e),(s??G)(e),F(!1),T(""),p(-1),x.current?.focus()},[O,s]),Le=h(e=>{e.stopPropagation(),O||ie(""),(s??G)(""),T(""),x.current?.focus()},[O,s]),P=h(()=>{f||b||(F(!0),T(""),p(-1))},[f,b]),g=h(()=>{F(!1),T(""),p(-1),x.current?.focus()},[]),Ne=h(()=>{c?g():P()},[c,g,P]),m=h((e,t)=>{let a=l.length;if(a===0)return-1;let E=e;for(let W=0;W<a;W++)if(E=((E+t)%a+a)%a,!k.has(l[E].value))return E;return-1},[l,k]),Ie=h(e=>{if(!(f||b)){if(c){switch(e.key){case"ArrowDown":{e.preventDefault();let t=m(r,1);t!==-1&&p(t);break}case"ArrowUp":{e.preventDefault();let t=m(r,-1);t!==-1&&p(t);break}case"Home":{e.preventDefault();let t=m(-1,1);t!==-1&&p(t);break}case"End":{e.preventDefault();let t=m(l.length,-1);t!==-1&&p(t);break}case"Enter":{if(e.preventDefault(),r>=0&&r<l.length){let t=l[r];k.has(t.value)||I(t.value)}break}case" ":if(e.preventDefault(),r>=0&&r<l.length){let t=l[r];k.has(t.value)||I(t.value)}else g();break;case"Escape":e.preventDefault(),g();break;case"Tab":g();break}return}switch(e.key){case"ArrowDown":case"ArrowUp":e.preventDefault(),P();break;case"Enter":case" ":e.preventDefault(),P();break}}},[f,b,c,P,g,r,l,k,m,I]),De=h(e=>{switch(e.key){case"ArrowDown":{e.preventDefault();let t=m(r,1);t!==-1&&p(t);break}case"ArrowUp":{e.preventDefault();let t=m(r,-1);t!==-1&&p(t);break}case"Home":{e.preventDefault();let t=m(-1,1);t!==-1&&p(t);break}case"End":{e.preventDefault();let t=m(l.length,-1);t!==-1&&p(t);break}case"Enter":{if(e.preventDefault(),r>=0&&r<l.length){let t=l[r];k.has(t.value)||I(t.value)}break}case"Escape":e.preventDefault(),g();break;case"Tab":g();break}},[r,l,k,m,I,g]),Ce=h(e=>{let t=e.target.value;T(t),p(-1),(ne??G)(t)},[ne]);H(()=>{if(!c)return;let e=t=>{let a=t.target;x.current?.contains(a)||q.current?.contains(a)||g()};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e,{passive:!0}),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}},[c,g]),H(()=>{if(!c||!x.current){ce(null);return}let e=()=>{let t=x.current;if(!t)return;let a=t.getBoundingClientRect(),E=window.innerHeight-a.bottom,W=a.top,de=z+8,pe=E<de&&W>E?"top":"bottom";ce({top:pe==="bottom"?a.bottom+window.scrollY+4:a.top+window.scrollY-de,left:a.left+window.scrollX,width:a.width,placement:pe})};return e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[c,z]);let $=c&&A!==null;H(()=>{$&&d&&se.current?.focus()},[$,d]),H(()=>{let e=q.current;if(!(!$||!e))return Re(e,()=>x.current)},[$]),H(()=>{if(r>=0){let e=le.current[r];e&&typeof e.scrollIntoView=="function"&&e.scrollIntoView({block:"nearest"})}},[r]);let X=N!==""&&N!==void 0,Se=Y&&X&&!f&&!b&&!D,ue=!f&&!b,Me=w("w-full flex items-center justify-between rounded-md transition-colors","text-gray-900 dark:text-gray-100",K[y].trigger,fe[V].trigger,!C&&ue&&fe[V].focus,C&&"border-red-500 dark:border-red-400 focus:ring-2 focus:ring-red-500 focus:border-red-500",f&&"opacity-50 cursor-not-allowed bg-gray-50 dark:bg-gray-900",b&&"cursor-default",!f&&!b&&"cursor-pointer",xe);return v("div",{className:w("flex flex-col gap-1",ve),children:[L?v("label",{id:_,htmlFor:oe,className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:[L,te?n("span",{className:"text-red-600 dark:text-red-400 ml-0.5","aria-hidden":"true",children:"*"}):null]}):null,J?n("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:J}):null,v("button",{ref:x,id:oe,type:"button",role:"combobox","aria-expanded":c,"aria-haspopup":"listbox","aria-controls":c?ae:void 0,"aria-labelledby":L?_:void 0,"aria-required":te||void 0,"aria-invalid":C?!0:void 0,"aria-activedescendant":c&&r>=0?`${M}-option-${r}`:void 0,disabled:f,className:Me,onClick:ue?Ne:void 0,onKeyDown:Ie,children:[v("span",{className:w("flex items-center gap-2 min-w-0 flex-1 truncate",!X&&"text-gray-400 dark:text-gray-500"),children:[B?.icon?n("span",{className:"flex shrink-0 items-center",children:B.icon}):null,n("span",{className:"truncate",children:X&&B?B.label:we})]}),v("span",{className:"flex items-center gap-1 shrink-0",children:[D?n("span",{className:"text-gray-400",children:$e}):null,Se?n("span",{role:"button",tabIndex:-1,"aria-label":be??S.selectClear,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 p-0.5 rounded transition-colors",onClick:Le,onMouseDown:e=>e.preventDefault(),children:Be}):null,n("span",{className:w("text-gray-400 transition-transform duration-200",c&&"rotate-180"),children:Ve})]})]}),C?n("p",{role:"alert",className:"text-xs text-red-600 dark:text-red-400",children:C}):ee?n("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:ee}):null,re?n("input",{type:"hidden",name:re,value:N??""}):null,c&&A?Pe(v("div",{ref:q,role:"listbox",id:ae,"aria-labelledby":L?_:void 0,className:w("fixed z-50 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700","rounded-md shadow-lg overflow-hidden","animate-in fade-in-0 zoom-in-95",K[y].content,ke),style:{top:A.top,left:A.left,width:A.width,position:"absolute"},onKeyDown:De,children:[d?n("div",{className:"border-b border-gray-200 dark:border-gray-700",children:n("input",{ref:se,type:"text",role:"searchbox","aria-label":me??S.selectSearch,className:w(K[y].searchInput,"w-full outline-none bg-transparent text-gray-900 dark:text-gray-100","placeholder:text-gray-400 dark:placeholder:text-gray-500"),placeholder:he??S.selectSearchPlaceholder,value:Q,onChange:Ce})}):null,n("div",{className:"overflow-y-auto",style:{maxHeight:z},children:l.length===0?n("div",{className:w(K[y].option,"text-gray-500 dark:text-gray-400 text-center py-4"),children:ye}):l.map((e,t)=>n(Ye,{option:e,isSelected:e.value===N,isHighlighted:t===r,isDisabled:D||k.has(e.value),sizeKey:y,optionId:`${M}-option-${t}`,onClick:I,onMouseEnter:p,index:t,ref:a=>{le.current[t]=a}},e.value))})]}),document.body):null]})}export{Fe as Select};