@synertech/ui 0.52.0 → 0.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/.claude/skills/use-synertech-ui/SKILL.md +121 -6
  2. package/dist/components/checkbox/Checkbox.cjs +1 -1
  3. package/dist/components/checkbox/Checkbox.js +1 -1
  4. package/dist/components/checkbox/CheckboxGroup.cjs +1 -1
  5. package/dist/components/checkbox/CheckboxGroup.js +1 -1
  6. package/dist/components/date-picker/DatePicker.cjs +1 -0
  7. package/dist/components/date-picker/DatePicker.js +1 -0
  8. package/dist/components/date-picker/DateRangePicker.cjs +1 -0
  9. package/dist/components/date-picker/DateRangePicker.js +1 -0
  10. package/dist/components/date-picker/date-field.cjs +1 -0
  11. package/dist/components/date-picker/date-field.js +1 -0
  12. package/dist/components/date-picker/date-input.cjs +1 -0
  13. package/dist/components/date-picker/date-input.js +1 -0
  14. package/dist/components/date-picker/index.cjs +1 -0
  15. package/dist/components/date-picker/index.js +1 -0
  16. package/dist/components/file-selector/FileSelector.cjs +1 -1
  17. package/dist/components/file-selector/FileSelector.js +1 -1
  18. package/dist/components/form/form-field/FormField.cjs +1 -0
  19. package/dist/components/form/form-field/FormField.js +1 -0
  20. package/dist/components/form/form-field/index.cjs +1 -0
  21. package/dist/components/form/form-field/index.js +1 -0
  22. package/dist/components/form/index.cjs +1 -1
  23. package/dist/components/form/index.js +1 -1
  24. package/dist/components/form/input/Input.cjs +1 -1
  25. package/dist/components/form/input/Input.js +1 -1
  26. package/dist/components/form/mention-input/MentionInput.cjs +5 -5
  27. package/dist/components/form/mention-input/MentionInput.js +5 -5
  28. package/dist/components/form/number-input/NumberInput.cjs +1 -1
  29. package/dist/components/form/number-input/NumberInput.js +1 -1
  30. package/dist/components/form/shared/InputWrapper.cjs +1 -1
  31. package/dist/components/form/shared/InputWrapper.js +1 -1
  32. package/dist/components/form/shared/field-error.cjs +1 -0
  33. package/dist/components/form/shared/field-error.js +1 -0
  34. package/dist/components/form/shared/inputStyles.cjs +1 -1
  35. package/dist/components/form/shared/inputStyles.js +1 -1
  36. package/dist/components/header/Header.cjs +1 -1
  37. package/dist/components/header/Header.js +1 -1
  38. package/dist/components/help-button/HelpButton.cjs +4 -12
  39. package/dist/components/help-button/HelpButton.js +4 -12
  40. package/dist/components/help-button/MarkdownEditor.cjs +1 -1
  41. package/dist/components/help-button/MarkdownEditor.js +1 -1
  42. package/dist/components/index.cjs +1 -1
  43. package/dist/components/index.js +1 -1
  44. package/dist/components/popover/Popover.cjs +1 -0
  45. package/dist/components/popover/Popover.js +1 -0
  46. package/dist/components/popover/PopoverClose.cjs +1 -0
  47. package/dist/components/popover/PopoverClose.js +1 -0
  48. package/dist/components/popover/PopoverContent.cjs +1 -0
  49. package/dist/components/popover/PopoverContent.js +1 -0
  50. package/dist/components/popover/PopoverTrigger.cjs +1 -0
  51. package/dist/components/popover/PopoverTrigger.js +1 -0
  52. package/dist/components/popover/index.cjs +1 -0
  53. package/dist/components/popover/index.js +1 -0
  54. package/dist/components/radio-button/RadioButton.cjs +1 -1
  55. package/dist/components/radio-button/RadioButton.js +1 -1
  56. package/dist/components/schema-editor/tables/SchemaTableRenderer.cjs +1 -1
  57. package/dist/components/schema-editor/tables/SchemaTableRenderer.js +1 -1
  58. package/dist/components/select/Select.cjs +1 -1
  59. package/dist/components/select/Select.js +1 -1
  60. package/dist/components/slider/Slider.cjs +1 -1
  61. package/dist/components/slider/Slider.js +1 -1
  62. package/dist/components/tooltip/Tooltip.cjs +1 -1
  63. package/dist/components/tooltip/Tooltip.js +1 -1
  64. package/dist/index.d.cts +2767 -2341
  65. package/dist/index.d.ts +2767 -2341
  66. package/dist/lib/ui-labels.cjs +1 -1
  67. package/dist/lib/ui-labels.js +1 -1
  68. package/dist/styles-no-preflight.css +162 -13
  69. package/dist/styles.css +162 -13
  70. package/package.json +1 -1
@@ -1 +1 @@
1
- "use client";import{useState as H,useRef as U,useEffect as K,useCallback as x,useMemo as Z,useId as Ae,memo as Pe,forwardRef as Re}from"react";import{createPortal as He}from"react-dom";import{registerFloatingLayer as Ke}from"../../lib/aria-hide.js";import{ownerDocumentOf as pe,ownerWindowOf as Ve}from"../../lib/owner-document.js";import{useUILabels as Be}from"../../lib/i18n.js";import{jsx as r,jsxs as v}from"react/jsx-runtime";var G=()=>{},$e=[],We=r("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0",children:r("path",{d:"M4 6L8 10L12 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Ue=r("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:"shrink-0",children:r("path",{d:"M10.5 3.5L3.5 10.5M3.5 3.5L10.5 10.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Ye=v("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0 animate-spin",children:[r("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"2",strokeOpacity:"0.25"}),r("path",{d:"M14 8a6 6 0 00-6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}),je=r("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:"shrink-0",children:r("path",{d:"M11.5 3.5L5.5 10.5L2.5 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),V={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-synertech-primary-500 focus:border-synertech-primary-500"},outlined:{trigger:"border-2 border-gray-300 bg-transparent dark:border-gray-600",focus:"focus:ring-2 focus:ring-synertech-primary-500 focus:border-synertech-primary-500"},filled:{trigger:"border border-transparent bg-gray-100 dark:bg-gray-700",focus:"focus:ring-2 focus:ring-synertech-primary-500 focus:border-synertech-primary-500"}};function w(...l){let o="";for(let u=0;u<l.length;u++){let a=l[u];a&&(o&&(o+=" "),o+=a)}return o}function ze(l,o){if(!o)return l;let u=o.toLowerCase();return l.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 _e=Pe(Re(function({option:o,isSelected:u,isHighlighted:a,isDisabled:d,sizeKey:Y,optionId:g,onClick:b,onMouseEnter:E,index:L},B){let j=()=>{d||b(o.value)},I=()=>{d||E(L)};return v("div",{ref:B,id:g,role:"option","aria-selected":u,"aria-disabled":d||void 0,"data-highlighted":a||void 0,className:w(V[Y].option,"flex items-center gap-2 cursor-pointer select-none transition-colors",a&&!d&&"bg-synertech-primary-50 dark:bg-synertech-primary-900/30",u&&!a&&"bg-gray-50 dark:bg-gray-700/50",d&&"opacity-50 cursor-not-allowed"),onClick:j,onMouseEnter:I,children:[o.icon?r("span",{className:"flex shrink-0 items-center",children:o.icon}):null,v("span",{className:"flex flex-col min-w-0 flex-1",children:[r("span",{className:"truncate",children:o.label}),o.description?r("span",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:o.description}):null]}),u?r("span",{className:"ml-auto text-synertech-primary-600 dark:text-synertech-primary-400",children:je}):null]})}));function Ge({options:l=$e,value:o,defaultValue:u,onValueChange:a,searchable:d=!1,clearable:Y=!1,disabled:g=!1,readOnly:b=!1,loading:E=!1,size:L="md",variant:B="default",placeholder:j,label:I,description:J,helperText:ee,error:S,required:te=!1,noOptionsText:ge,clearLabel:me,searchLabel:he,searchPlaceholder:be,onSearchChange:re,name:ne,className:ye,triggerClassName:xe,contentClassName:ve,maxHeight:z=256}){let M=Be(),ke=j??M.selectPlaceholder,we=ge??M.selectNoOptions,O=Ae(),_=`${O}-label`,oe=`${O}-trigger`,ae=`${O}-listbox`,m=U(null),q=U(null),se=U(null),le=U([]),T=o!==void 0,[Ee,ie]=H(u??""),D=T?o:Ee,[i,F]=H(!1),[Q,A]=H(""),[n,p]=H(-1),[N,ce]=H(null),s=Z(()=>d?ze(l,Q):l,[l,Q,d]),$=Z(()=>l.find(e=>e.value===D)??null,[l,D]),k=Z(()=>{let e=new Set;for(let t of l)t.disabled&&e.add(t.value);return e},[l]),C=x(e=>{E||(T||ie(e),(a??G)(e),F(!1),A(""),p(-1),m.current?.focus())},[T,a,E]),Le=x(e=>{e.stopPropagation(),T||ie(""),(a??G)(""),A(""),m.current?.focus()},[T,a]),P=x(()=>{g||b||(F(!0),A(""),p(-1))},[g,b]),h=x(()=>{F(!1),A(""),p(-1),m.current?.focus()},[]),Ne=x(()=>{i?h():P()},[i,h,P]),y=x((e,t)=>{let f=s.length;if(f===0)return-1;let c=e;for(let R=0;R<f;R++)if(c=((c+t)%f+f)%f,!k.has(s[c].value))return c;return-1},[s,k]),Ie=x(e=>{if(!(g||b)){if(i){switch(e.key){case"ArrowDown":{e.preventDefault();let t=y(n,1);t!==-1&&p(t);break}case"ArrowUp":{e.preventDefault();let t=y(n,-1);t!==-1&&p(t);break}case"Home":{e.preventDefault();let t=y(-1,1);t!==-1&&p(t);break}case"End":{e.preventDefault();let t=y(s.length,-1);t!==-1&&p(t);break}case"Enter":{if(e.preventDefault(),n>=0&&n<s.length){let t=s[n];k.has(t.value)||C(t.value)}break}case" ":if(e.preventDefault(),n>=0&&n<s.length){let t=s[n];k.has(t.value)||C(t.value)}else h();break;case"Escape":e.preventDefault(),h();break;case"Tab":h();break}return}switch(e.key){case"ArrowDown":case"ArrowUp":e.preventDefault(),P();break;case"Enter":case" ":e.preventDefault(),P();break}}},[g,b,i,P,h,n,s,k,y,C]),De=x(e=>{switch(e.key){case"ArrowDown":{e.preventDefault();let t=y(n,1);t!==-1&&p(t);break}case"ArrowUp":{e.preventDefault();let t=y(n,-1);t!==-1&&p(t);break}case"Home":{e.preventDefault();let t=y(-1,1);t!==-1&&p(t);break}case"End":{e.preventDefault();let t=y(s.length,-1);t!==-1&&p(t);break}case"Enter":{if(e.preventDefault(),n>=0&&n<s.length){let t=s[n];k.has(t.value)||C(t.value)}break}case"Escape":e.preventDefault(),h();break;case"Tab":h();break}},[n,s,k,y,C,h]),Ce=x(e=>{let t=e.target.value;A(t),p(-1),(re??G)(t)},[re]);K(()=>{if(!i)return;let e=f=>{let c=f.target;m.current?.contains(c)||q.current?.contains(c)||h()},t=pe(m.current);return t.addEventListener("mousedown",e),t.addEventListener("touchstart",e,{passive:!0}),()=>{t.removeEventListener("mousedown",e),t.removeEventListener("touchstart",e)}},[i,h]),K(()=>{if(!i||!m.current){ce(null);return}let e=Ve(m.current),t=()=>{let f=m.current;if(!f)return;let c=f.getBoundingClientRect(),R=e.innerHeight-c.bottom,Oe=c.top,Te=z+8,de=R<Te&&Oe>R?"top":"bottom";ce({top:de==="bottom"?c.bottom+e.scrollY+4:c.top+e.scrollY-4,left:c.left+e.scrollX,width:c.width,placement:de})};return t(),e.addEventListener("scroll",t,!0),e.addEventListener("resize",t),()=>{e.removeEventListener("scroll",t,!0),e.removeEventListener("resize",t)}},[i,z]);let W=i&&N!==null;K(()=>{W&&d&&se.current?.focus()},[W,d]),K(()=>{let e=q.current;if(!(!W||!e))return Ke(e,()=>m.current)},[W]),K(()=>{if(n>=0){let e=le.current[n];e&&typeof e.scrollIntoView=="function"&&e.scrollIntoView({block:"nearest"})}},[n]);let X=D!==""&&D!==void 0,Se=Y&&X&&!g&&!b&&!E,ue=!g&&!b,Me=w("w-full flex items-center justify-between rounded-md transition-colors","text-gray-900 dark:text-gray-100",V[L].trigger,fe[B].trigger,!S&&ue&&fe[B].focus,S&&"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",b&&"cursor-default",!g&&!b&&"cursor-pointer",xe);return v("div",{className:w("flex flex-col gap-1",ye),children:[I?v("label",{id:_,htmlFor:oe,className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:[I,te?r("span",{className:"text-red-600 dark:text-red-400 ml-0.5","aria-hidden":"true",children:"*"}):null]}):null,J?r("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:J}):null,v("button",{ref:m,id:oe,type:"button",role:"combobox","aria-expanded":i,"aria-haspopup":"listbox","aria-controls":i?ae:void 0,"aria-labelledby":I?_:void 0,"aria-required":te||void 0,"aria-invalid":S?!0:void 0,"aria-activedescendant":i&&n>=0?`${O}-option-${n}`:void 0,disabled:g,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-600 dark:text-gray-300"),children:[$?.icon?r("span",{className:"flex shrink-0 items-center",children:$.icon}):null,r("span",{className:"truncate",children:X&&$?$.label:ke})]}),v("span",{className:"flex items-center gap-1 shrink-0",children:[E?r("span",{className:"text-gray-500 dark:text-gray-400",children:Ye}):null,Se?r("span",{role:"button",tabIndex:-1,"aria-label":me??M.selectClear,className:"text-gray-500 dark: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:Ue}):null,r("span",{className:w("text-gray-500 dark:text-gray-400 transition-transform duration-200",i&&"rotate-180"),children:We})]})]}),S?r("p",{role:"alert",className:"text-xs text-red-600 dark:text-red-400",children:S}):ee?r("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:ee}):null,ne?r("input",{type:"hidden",name:ne,value:D??""}):null,i&&N?He(v("div",{ref:q,role:"listbox",id:ae,"aria-labelledby":I?_: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",V[L].content,ve),"data-placement":N.placement,style:{top:N.top,left:N.left,width:N.width,position:"absolute",translate:N.placement==="top"?"0 -100%":void 0},onKeyDown:De,children:[d?r("div",{className:"border-b border-gray-200 dark:border-gray-700",children:r("input",{ref:se,type:"text",role:"searchbox","aria-label":he??M.selectSearch,className:w(V[L].searchInput,"w-full outline-none bg-transparent text-gray-900 dark:text-gray-100","placeholder:text-gray-500 dark:placeholder:text-gray-400"),placeholder:be??M.selectSearchPlaceholder,value:Q,onChange:Ce})}):null,r("div",{className:"overflow-y-auto",style:{maxHeight:z},children:s.length===0?r("div",{className:w(V[L].option,"text-gray-500 dark:text-gray-400 text-center py-4"),children:we}):s.map((e,t)=>r(_e,{option:e,isSelected:e.value===D,isHighlighted:t===n,isDisabled:E||k.has(e.value),sizeKey:L,optionId:`${O}-option-${t}`,onClick:C,onMouseEnter:p,index:t,ref:f=>{le.current[t]=f}},e.value))})]}),pe(m.current).body):null]})}export{Ge as Select};
1
+ "use client";import{useState as H,useRef as U,useEffect as K,useCallback as x,useMemo as G,useId as Pe,memo as Re,forwardRef as He}from"react";import{createPortal as Ke}from"react-dom";import{registerFloatingLayer as Be}from"../../lib/aria-hide.js";import{ownerDocumentOf as pe,ownerWindowOf as Ve}from"../../lib/owner-document.js";import{useUILabels as $e}from"../../lib/i18n.js";import{describeField as We}from"../form/shared/field-error.js";import{jsx as r,jsxs as w}from"react/jsx-runtime";var J=()=>{},Ue=[],Ye=r("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0",children:r("path",{d:"M4 6L8 10L12 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),je=r("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:"shrink-0",children:r("path",{d:"M10.5 3.5L3.5 10.5M3.5 3.5L10.5 10.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),ze=w("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0 animate-spin",children:[r("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"2",strokeOpacity:"0.25"}),r("path",{d:"M14 8a6 6 0 00-6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}),Fe=r("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:"shrink-0",children:r("path",{d:"M11.5 3.5L5.5 10.5L2.5 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),B={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-synertech-primary-500 focus:border-synertech-primary-500"},outlined:{trigger:"border-2 border-gray-300 bg-transparent dark:border-gray-600",focus:"focus:ring-2 focus:ring-synertech-primary-500 focus:border-synertech-primary-500"},filled:{trigger:"border border-transparent bg-gray-100 dark:bg-gray-700",focus:"focus:ring-2 focus:ring-synertech-primary-500 focus:border-synertech-primary-500"}};function k(...i){let o="";for(let d=0;d<i.length;d++){let a=i[d];a&&(o&&(o+=" "),o+=a)}return o}function _e(i,o){if(!o)return i;let d=o.toLowerCase();return i.filter(a=>{if(a.label.toLowerCase().includes(d)||a.value.toLowerCase().includes(d))return!0;if(a.keywords){for(let u of a.keywords)if(u.toLowerCase().includes(d))return!0}return!1})}var qe=Re(He(function({option:o,isSelected:d,isHighlighted:a,isDisabled:u,sizeKey:Y,optionId:m,onClick:y,onMouseEnter:L,index:N},V){let j=()=>{u||y(o.value)},I=()=>{u||L(N)};return w("div",{ref:V,id:m,role:"option","aria-selected":d,"aria-disabled":u||void 0,"data-highlighted":a||void 0,className:k(B[Y].option,"flex items-center gap-2 cursor-pointer select-none transition-colors",a&&!u&&"bg-synertech-primary-50 dark:bg-synertech-primary-900/30",d&&!a&&"bg-gray-50 dark:bg-gray-700/50",u&&"opacity-50 cursor-not-allowed"),onClick:j,onMouseEnter:I,children:[o.icon?r("span",{className:"flex shrink-0 items-center",children:o.icon}):null,w("span",{className:"flex flex-col min-w-0 flex-1",children:[r("span",{className:"truncate",children:o.label}),o.description?r("span",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:o.description}):null]}),d?r("span",{className:"ml-auto text-synertech-primary-600 dark:text-synertech-primary-400",children:Fe}):null]})}));function tt({options:i=Ue,value:o,defaultValue:d,onValueChange:a,searchable:u=!1,clearable:Y=!1,disabled:m=!1,readOnly:y=!1,loading:L=!1,size:N="md",variant:V="default",placeholder:j,label:I,description:ee,helperText:te,error:ge,required:re=!1,noOptionsText:me,clearLabel:he,searchLabel:be,searchPlaceholder:ye,onSearchChange:ne,name:oe,className:ve,triggerClassName:xe,contentClassName:ke,maxHeight:z=256}){let M=$e(),we=j??M.selectPlaceholder,Ee=me??M.selectNoOptions,O=Pe(),F=`${O}-label`,_=`${O}-trigger`,ae=`${O}-listbox`,f=We(_,{description:ee,helperText:te,error:ge}),h=U(null),q=U(null),se=U(null),ie=U([]),T=o!==void 0,[Le,le]=H(d??""),C=T?o:Le,[l,Q]=H(!1),[X,A]=H(""),[n,p]=H(-1),[D,ce]=H(null),s=G(()=>u?_e(i,X):i,[i,X,u]),$=G(()=>i.find(e=>e.value===C)??null,[i,C]),E=G(()=>{let e=new Set;for(let t of i)t.disabled&&e.add(t.value);return e},[i]),S=x(e=>{L||(T||le(e),(a??J)(e),Q(!1),A(""),p(-1),h.current?.focus())},[T,a,L]),Ne=x(e=>{e.stopPropagation(),T||le(""),(a??J)(""),A(""),h.current?.focus()},[T,a]),P=x(()=>{m||y||(Q(!0),A(""),p(-1))},[m,y]),b=x(()=>{Q(!1),A(""),p(-1),h.current?.focus()},[]),De=x(()=>{l?b():P()},[l,b,P]),v=x((e,t)=>{let g=s.length;if(g===0)return-1;let c=e;for(let R=0;R<g;R++)if(c=((c+t)%g+g)%g,!E.has(s[c].value))return c;return-1},[s,E]),Ie=x(e=>{if(!(m||y)){if(l){switch(e.key){case"ArrowDown":{e.preventDefault();let t=v(n,1);t!==-1&&p(t);break}case"ArrowUp":{e.preventDefault();let t=v(n,-1);t!==-1&&p(t);break}case"Home":{e.preventDefault();let t=v(-1,1);t!==-1&&p(t);break}case"End":{e.preventDefault();let t=v(s.length,-1);t!==-1&&p(t);break}case"Enter":{if(e.preventDefault(),n>=0&&n<s.length){let t=s[n];E.has(t.value)||S(t.value)}break}case" ":if(e.preventDefault(),n>=0&&n<s.length){let t=s[n];E.has(t.value)||S(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(),P();break;case"Enter":case" ":e.preventDefault(),P();break}}},[m,y,l,P,b,n,s,E,v,S]),Ce=x(e=>{switch(e.key){case"ArrowDown":{e.preventDefault();let t=v(n,1);t!==-1&&p(t);break}case"ArrowUp":{e.preventDefault();let t=v(n,-1);t!==-1&&p(t);break}case"Home":{e.preventDefault();let t=v(-1,1);t!==-1&&p(t);break}case"End":{e.preventDefault();let t=v(s.length,-1);t!==-1&&p(t);break}case"Enter":{if(e.preventDefault(),n>=0&&n<s.length){let t=s[n];E.has(t.value)||S(t.value)}break}case"Escape":e.preventDefault(),b();break;case"Tab":b();break}},[n,s,E,v,S,b]),Se=x(e=>{let t=e.target.value;A(t),p(-1),(ne??J)(t)},[ne]);K(()=>{if(!l)return;let e=g=>{let c=g.target;h.current?.contains(c)||q.current?.contains(c)||b()},t=pe(h.current);return t.addEventListener("mousedown",e),t.addEventListener("touchstart",e,{passive:!0}),()=>{t.removeEventListener("mousedown",e),t.removeEventListener("touchstart",e)}},[l,b]),K(()=>{if(!l||!h.current){ce(null);return}let e=Ve(h.current),t=()=>{let g=h.current;if(!g)return;let c=g.getBoundingClientRect(),R=e.innerHeight-c.bottom,Te=c.top,Ae=z+8,ue=R<Ae&&Te>R?"top":"bottom";ce({top:ue==="bottom"?c.bottom+e.scrollY+4:c.top+e.scrollY-4,left:c.left+e.scrollX,width:c.width,placement:ue})};return t(),e.addEventListener("scroll",t,!0),e.addEventListener("resize",t),()=>{e.removeEventListener("scroll",t,!0),e.removeEventListener("resize",t)}},[l,z]);let W=l&&D!==null;K(()=>{W&&u&&se.current?.focus()},[W,u]),K(()=>{let e=q.current;if(!(!W||!e))return Be(e,()=>h.current)},[W]),K(()=>{if(n>=0){let e=ie.current[n];e&&typeof e.scrollIntoView=="function"&&e.scrollIntoView({block:"nearest"})}},[n]);let Z=C!==""&&C!==void 0,Me=Y&&Z&&!m&&!y&&!L,de=!m&&!y,Oe=k("w-full flex items-center justify-between rounded-md transition-colors","text-gray-900 dark:text-gray-100",B[N].trigger,fe[V].trigger,!f.invalid&&de&&fe[V].focus,f.invalid&&"border-red-500 dark:border-red-400 focus:ring-2 focus:ring-red-500 focus:border-red-500",m&&"opacity-50 cursor-not-allowed bg-gray-50 dark:bg-gray-900",y&&"cursor-default",!m&&!y&&"cursor-pointer",xe);return w("div",{className:k("flex flex-col gap-1",ve),children:[I?w("label",{id:F,htmlFor:_,className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:[I,re?r("span",{className:"text-red-600 dark:text-red-400 ml-0.5","aria-hidden":"true",children:"*"}):null]}):null,f.hasDescription?r("p",{id:f.ids.description,className:"text-xs text-gray-500 dark:text-gray-400",children:ee}):null,w("button",{ref:h,id:_,type:"button",role:"combobox","aria-expanded":l,"aria-haspopup":"listbox","aria-controls":l?ae:void 0,"aria-labelledby":I?F:void 0,"aria-required":re||void 0,"aria-invalid":f.invalid||void 0,"aria-describedby":f.describedBy,"aria-activedescendant":l&&n>=0?`${O}-option-${n}`:void 0,disabled:m,className:Oe,onClick:de?De:void 0,onKeyDown:Ie,children:[w("span",{className:k("flex items-center gap-2 min-w-0 flex-1 truncate",!Z&&"text-gray-600 dark:text-gray-300"),children:[$?.icon?r("span",{className:"flex shrink-0 items-center",children:$.icon}):null,r("span",{className:"truncate",children:Z&&$?$.label:we})]}),w("span",{className:"flex items-center gap-1 shrink-0",children:[L?r("span",{className:"text-gray-500 dark:text-gray-400",children:ze}):null,Me?r("span",{role:"button",tabIndex:-1,"aria-label":he??M.selectClear,className:"text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 p-0.5 rounded transition-colors",onClick:Ne,onMouseDown:e=>e.preventDefault(),children:je}):null,r("span",{className:k("text-gray-500 dark:text-gray-400 transition-transform duration-200",l&&"rotate-180"),children:Ye})]})]}),f.message!==void 0?r("p",{id:f.ids.error,className:"text-xs text-red-600 dark:text-red-400",children:f.message}):f.showHelper?r("p",{id:f.ids.helper,className:k("text-xs",f.invalid?"text-red-600 dark:text-red-400":"text-gray-500 dark:text-gray-400"),children:te}):null,oe?r("input",{type:"hidden",name:oe,value:C??""}):null,l&&D?Ke(w("div",{ref:q,role:"listbox",id:ae,"aria-labelledby":I?F: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",B[N].content,ke),"data-placement":D.placement,style:{top:D.top,left:D.left,width:D.width,position:"absolute",translate:D.placement==="top"?"0 -100%":void 0},onKeyDown:Ce,children:[u?r("div",{className:"border-b-2 border-gray-200 focus-within:border-synertech-primary-500 dark:border-gray-700 dark:focus-within:border-synertech-primary-400",children:r("input",{ref:se,type:"text",role:"searchbox","aria-label":be??M.selectSearch,className:k(B[N].searchInput,"w-full outline-hidden bg-transparent text-gray-900 dark:text-gray-100","placeholder:text-gray-500 dark:placeholder:text-gray-400"),placeholder:ye??M.selectSearchPlaceholder,value:X,onChange:Se})}):null,r("div",{className:"overflow-y-auto",style:{maxHeight:z},children:s.length===0?r("div",{className:k(B[N].option,"text-gray-500 dark:text-gray-400 text-center py-4"),children:Ee}):s.map((e,t)=>r(qe,{option:e,isSelected:e.value===C,isHighlighted:t===n,isDisabled:L||E.has(e.value),sizeKey:N,optionId:`${O}-option-${t}`,onClick:S,onMouseEnter:p,index:t,ref:g=>{ie.current[t]=g}},e.value))})]}),pe(h.current).body):null]})}export{tt as Select};
@@ -1 +1 @@
1
- "use strict";"use client";var P=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var ie=Object.prototype.hasOwnProperty;var de=(r,e)=>{for(var t in e)P(r,t,{get:e[t],enumerable:!0})},ue=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of le(e))!ie.call(r,n)&&n!==t&&P(r,n,{get:()=>e[n],enumerable:!(o=se(e,n))||o.enumerable});return r};var ce=r=>ue(P({},"__esModule",{value:!0}),r);var Se={};de(Se,{Slider:()=>j});module.exports=ce(Se);var i=require("react"),l=require("../../lib/cn.cjs"),w=require("../../lib/css-value.cjs"),a=require("react/jsx-runtime"),be={sm:"h-1",md:"h-1.5",lg:"h-2"},me={sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5"},ge={sm:14,md:16,lg:20},pe="[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-moz-range-thumb]:appearance-none [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-0",ye={sm:"[&::-webkit-slider-thumb]:h-3.5 [&::-webkit-slider-thumb]:w-3.5 [&::-moz-range-thumb]:h-3.5 [&::-moz-range-thumb]:w-3.5",md:"[&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:w-4 [&::-moz-range-thumb]:h-4 [&::-moz-range-thumb]:w-4",lg:"[&::-webkit-slider-thumb]:h-5 [&::-webkit-slider-thumb]:w-5 [&::-moz-range-thumb]:h-5 [&::-moz-range-thumb]:w-5"},fe={sm:"h-4",md:"h-5",lg:"h-6"},he={primary:"bg-synertech-primary-600 dark:bg-synertech-primary-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",neutral:"bg-gray-600 dark:bg-gray-400"},ve={primary:"border-synertech-primary-600 dark:border-synertech-primary-500",success:"border-green-600 dark:border-green-500",warning:"border-yellow-500 dark:border-yellow-400",error:"border-red-600 dark:border-red-500",info:"border-cyan-600 dark:border-cyan-500",neutral:"border-gray-600 dark:border-gray-400"},ke={primary:"peer-focus-visible:ring-synertech-primary-500",success:"peer-focus-visible:ring-green-500",warning:"peer-focus-visible:ring-yellow-500",error:"peer-focus-visible:ring-red-500",info:"peer-focus-visible:ring-cyan-500",neutral:"peer-focus-visible:ring-gray-500"},we={primary:"text-synertech-primary-600 dark:text-synertech-primary-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",neutral:"text-gray-700 dark:text-gray-300"},_=(r,e,t)=>Math.min(t,Math.max(e,r)),$=(r,e,t)=>t>e?(_(r,e,t)-e)/(t-e)*100:0,k=(r,e)=>{let t=(.5-r/100)*e,o=Math.round(Math.abs(t)*1e3)/1e3;return`calc(${r}% ${t<0?"-":"+"} ${o}px)`},Ce=(r,e,t,o)=>{if(!r)return[];if(Array.isArray(r))return r;let n=o>0?o:1,d=Math.floor((t-e)/n);return d<=0||d>20?[{value:e},{value:t}]:Array.from({length:d+1},(u,C)=>({value:e+C*n}))},j=(0,i.forwardRef)(({value:r,defaultValue:e,onValueChange:t,min:o=0,max:n=100,step:d=1,size:u="md",color:C="primary",disabled:m=!1,readOnly:S=!1,label:x,description:V,error:N=!1,showValue:I=!1,showTooltip:T=!1,valueFormat:E,marks:A,trackColor:q,fillColor:D,thumbColor:G,className:J,containerClassName:K,id:Q,...U},X)=>{let H=(0,w.safeCssColor)(q),z=(0,w.safeCssColor)(D),g=(0,w.safeCssColor)(G),[Y,Z]=(0,i.useState)(e??o),L=r!==void 0,b=_(L?r:Y,o,n),ee=(0,i.useId)(),p=Q??ee,y=typeof N=="string"?N:void 0,W=!!N,f=!m&&!S,h=W?"error":C,F=$(b,o,n),v=ge[u],re=s=>{if(!f)return;let c=Number(s.target.value);L||Z(c),t?.(c)},M=(0,i.useMemo)(()=>Ce(A,o,n,d),[A,o,n,d]),te=M.some(s=>s.label!=null),B=E?E(b):`${b}`,O={width:k(F,v)};z&&(O.backgroundColor=z);let R={left:k(F,v)};g&&(R.backgroundColor=g,R.borderColor=g);let ae=H?{backgroundColor:H}:{};return(0,a.jsxs)("div",{className:(0,l.cn)("w-full",K),children:[(x||I)&&(0,a.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[x?(0,a.jsx)("label",{htmlFor:p,className:(0,l.cn)("text-sm font-medium text-gray-700 dark:text-gray-200",m&&"opacity-50"),children:x}):(0,a.jsx)("span",{}),I&&(0,a.jsx)("span",{className:(0,l.cn)("text-sm font-semibold tabular-nums",we[h]),children:B})]}),(0,a.jsxs)("div",{className:(0,l.cn)("relative flex items-center",fe[u],m&&"opacity-50"),children:[(0,a.jsx)("input",{ref:X,type:"range",id:p,min:o,max:n,step:d,value:b,onChange:re,disabled:m,readOnly:S,"aria-invalid":W,"aria-readonly":S||void 0,"aria-describedby":y?`${p}-error`:void 0,tabIndex:f?void 0:-1,className:(0,l.cn)("peer absolute inset-0 z-10 m-0 h-full w-full cursor-pointer appearance-none bg-transparent opacity-0",pe,ye[u],!f&&"pointer-events-none cursor-default",J),...U}),(0,a.jsxs)("div",{className:(0,l.cn)("pointer-events-none relative w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700",be[u]),style:ae,children:[(0,a.jsx)("div",{className:(0,l.cn)("absolute inset-y-0 left-0 rounded-full transition-[width] duration-150 ease-out",z?"":he[h]),style:O}),M.map((s,c)=>{let oe=$(s.value,o,n),ne=s.value<=b;return(0,a.jsx)("span",{"data-slider-mark":"",className:(0,l.cn)("absolute top-1/2 h-1 w-1 -translate-x-1/2 -translate-y-1/2 rounded-full",ne?"bg-white/80":"bg-gray-400 dark:bg-gray-500"),style:{left:k(oe,v)}},`mark-${s.value}-${c}`)})]}),(0,a.jsx)("div",{"data-slider-thumb":"",className:(0,l.cn)("pointer-events-none absolute top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 bg-white shadow transition-transform dark:bg-gray-100",me[u],g?"":ve[h],f&&"peer-hover:scale-110 peer-active:scale-110","peer-focus-visible:scale-110 peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2",ke[h],T&&"peer-hover:*:opacity-100 peer-focus-visible:*:opacity-100 peer-active:*:opacity-100"),style:R,children:T&&(0,a.jsx)("span",{"data-slider-tooltip":"",className:"pointer-events-none absolute bottom-full left-1/2 mb-2 -translate-x-1/2 rounded bg-gray-900 px-1.5 py-0.5 text-xs font-medium text-white opacity-0 transition-opacity dark:bg-gray-700",children:B})})]}),te&&(0,a.jsx)("div",{className:"relative mt-1.5 h-4",children:M.map((s,c)=>s.label!=null?(0,a.jsx)("span",{className:"absolute -translate-x-1/2 whitespace-nowrap text-xs text-gray-500 dark:text-gray-400",style:{left:k($(s.value,o,n),v)},children:s.label},`mark-label-${s.value}-${c}`):null)}),V&&!y&&(0,a.jsx)("p",{className:"mt-1.5 text-sm text-gray-500 dark:text-gray-400",children:V}),y&&(0,a.jsx)("p",{id:`${p}-error`,className:"mt-1.5 text-sm text-red-600 dark:text-red-400",children:y})]})});j.displayName="Slider";0&&(module.exports={Slider});
1
+ "use strict";"use client";var P=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var ue=Object.prototype.hasOwnProperty;var ce=(r,e)=>{for(var t in e)P(r,t,{get:e[t],enumerable:!0})},be=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of de(e))!ue.call(r,n)&&n!==t&&P(r,n,{get:()=>e[n],enumerable:!(o=ie(e,n))||o.enumerable});return r};var me=r=>be(P({},"__esModule",{value:!0}),r);var Ne={};ce(Ne,{Slider:()=>j});module.exports=me(Ne);var i=require("react"),l=require("../../lib/cn.cjs"),O=require("../form/shared/field-error.cjs"),k=require("../../lib/css-value.cjs"),a=require("react/jsx-runtime"),ge={sm:"h-1",md:"h-1.5",lg:"h-2"},pe={sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5"},ye={sm:14,md:16,lg:20},fe="[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-moz-range-thumb]:appearance-none [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-0",he={sm:"[&::-webkit-slider-thumb]:h-3.5 [&::-webkit-slider-thumb]:w-3.5 [&::-moz-range-thumb]:h-3.5 [&::-moz-range-thumb]:w-3.5",md:"[&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:w-4 [&::-moz-range-thumb]:h-4 [&::-moz-range-thumb]:w-4",lg:"[&::-webkit-slider-thumb]:h-5 [&::-webkit-slider-thumb]:w-5 [&::-moz-range-thumb]:h-5 [&::-moz-range-thumb]:w-5"},ve={sm:"h-4",md:"h-5",lg:"h-6"},ke={primary:"bg-synertech-primary-600 dark:bg-synertech-primary-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",neutral:"bg-gray-600 dark:bg-gray-400"},we={primary:"border-synertech-primary-600 dark:border-synertech-primary-500",success:"border-green-600 dark:border-green-500",warning:"border-yellow-500 dark:border-yellow-400",error:"border-red-600 dark:border-red-500",info:"border-cyan-600 dark:border-cyan-500",neutral:"border-gray-600 dark:border-gray-400"},Ce={primary:"peer-focus-visible:ring-synertech-primary-500",success:"peer-focus-visible:ring-green-500",warning:"peer-focus-visible:ring-yellow-500",error:"peer-focus-visible:ring-red-500",info:"peer-focus-visible:ring-cyan-500",neutral:"peer-focus-visible:ring-gray-500"},Se={primary:"text-synertech-primary-600 dark:text-synertech-primary-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",neutral:"text-gray-700 dark:text-gray-300"},_=(r,e,t)=>Math.min(t,Math.max(e,r)),V=(r,e,t)=>t>e?(_(r,e,t)-e)/(t-e)*100:0,v=(r,e)=>{let t=(.5-r/100)*e,o=Math.round(Math.abs(t)*1e3)/1e3;return`calc(${r}% ${t<0?"-":"+"} ${o}px)`},xe=(r,e,t,o)=>{if(!r)return[];if(Array.isArray(r))return r;let n=o>0?o:1,d=Math.floor((t-e)/n);return d<=0||d>20?[{value:e},{value:t}]:Array.from({length:d+1},(c,w)=>({value:e+w*n}))},j=(0,i.forwardRef)(({value:r,defaultValue:e,onValueChange:t,min:o=0,max:n=100,step:d=1,size:c="md",color:w="primary",disabled:g=!1,readOnly:C=!1,label:S,description:$,error:q,showValue:I=!1,showTooltip:T=!1,valueFormat:E,marks:H,trackColor:D,fillColor:G,thumbColor:J,className:K,containerClassName:Q,id:U,"aria-describedby":X,...Y},Z)=>{let A=(0,k.safeCssColor)(D),x=(0,k.safeCssColor)(G),p=(0,k.safeCssColor)(J),[ee,re]=(0,i.useState)(e??o),F=r!==void 0,m=_(F?r:ee,o,n),te=(0,i.useId)(),N=U??te,u=(0,O.describeField)(N,{helperText:$,error:q,own:X}),z=u.invalid,y=!g&&!C,f=z?"error":w,L=V(m,o,n),h=ye[c],ae=s=>{if(!y)return;let b=Number(s.target.value);F||re(b),t?.(b)},R=(0,i.useMemo)(()=>xe(H,o,n,d),[H,o,n,d]),oe=R.some(s=>s.label!=null),W=E?E(m):`${m}`,B={width:v(L,h)};x&&(B.backgroundColor=x);let M={left:v(L,h)};p&&(M.backgroundColor=p,M.borderColor=p);let ne=A?{backgroundColor:A}:{};return(0,a.jsxs)("div",{className:(0,l.cn)("w-full",Q),children:[(S||I)&&(0,a.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[S?(0,a.jsx)("label",{htmlFor:N,className:(0,l.cn)("text-sm font-medium text-gray-700 dark:text-gray-200",g&&"opacity-50"),children:S}):(0,a.jsx)("span",{}),I&&(0,a.jsx)("span",{className:(0,l.cn)("text-sm font-semibold tabular-nums",Se[f]),children:W})]}),(0,a.jsxs)("div",{className:(0,l.cn)("relative flex items-center",ve[c],g&&"opacity-50"),children:[(0,a.jsx)("input",{ref:Z,type:"range",id:N,min:o,max:n,step:d,value:m,onChange:ae,disabled:g,readOnly:C,"aria-invalid":z||void 0,"aria-readonly":C||void 0,"aria-describedby":u.describedBy,tabIndex:y?void 0:-1,className:(0,l.cn)("peer absolute inset-0 z-10 m-0 h-full w-full cursor-pointer appearance-none bg-transparent opacity-0",fe,he[c],!y&&"pointer-events-none cursor-default",K),...Y}),(0,a.jsxs)("div",{className:(0,l.cn)("pointer-events-none relative w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700",ge[c]),style:ne,children:[(0,a.jsx)("div",{className:(0,l.cn)("absolute inset-y-0 left-0 rounded-full transition-[width] duration-150 ease-out",x?"":ke[f]),style:B}),R.map((s,b)=>{let se=V(s.value,o,n),le=s.value<=m;return(0,a.jsx)("span",{"data-slider-mark":"",className:(0,l.cn)("absolute top-1/2 h-1 w-1 -translate-x-1/2 -translate-y-1/2 rounded-full",le?"bg-white/80":"bg-gray-400 dark:bg-gray-500"),style:{left:v(se,h)}},`mark-${s.value}-${b}`)})]}),(0,a.jsx)("div",{"data-slider-thumb":"",className:(0,l.cn)("pointer-events-none absolute top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 bg-white shadow transition-transform dark:bg-gray-100",pe[c],p?"":we[f],y&&"peer-hover:scale-110 peer-active:scale-110","peer-focus-visible:scale-110 peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2",Ce[f],T&&"peer-hover:*:opacity-100 peer-focus-visible:*:opacity-100 peer-active:*:opacity-100"),style:M,children:T&&(0,a.jsx)("span",{"data-slider-tooltip":"",className:"pointer-events-none absolute bottom-full left-1/2 mb-2 -translate-x-1/2 rounded bg-gray-900 px-1.5 py-0.5 text-xs font-medium text-white opacity-0 transition-opacity dark:bg-gray-700",children:W})})]}),oe&&(0,a.jsx)("div",{className:"relative mt-1.5 h-4",children:R.map((s,b)=>s.label!=null?(0,a.jsx)("span",{className:"absolute -translate-x-1/2 whitespace-nowrap text-xs text-gray-500 dark:text-gray-400",style:{left:v(V(s.value,o,n),h)},children:s.label},`mark-label-${s.value}-${b}`):null)}),u.showHelper&&(0,a.jsx)("p",{id:u.ids.helper,className:(0,l.cn)("mt-1.5 text-sm",z?"text-red-600 dark:text-red-400":"text-gray-500 dark:text-gray-400"),children:$}),u.message!==void 0&&(0,a.jsx)("p",{id:u.ids.error,className:"mt-1.5 text-sm text-red-600 dark:text-red-400",children:u.message})]})});j.displayName="Slider";0&&(module.exports={Slider});
@@ -1 +1 @@
1
- "use client";import{useState as oe,useId as ne,useMemo as se,forwardRef as le}from"react";import{cn as l}from"../../lib/cn.js";import{safeCssColor as R}from"../../lib/css-value.js";import{jsx as n,jsxs as k}from"react/jsx-runtime";var ie={sm:"h-1",md:"h-1.5",lg:"h-2"},de={sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5"},ue={sm:14,md:16,lg:20},ce="[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-moz-range-thumb]:appearance-none [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-0",be={sm:"[&::-webkit-slider-thumb]:h-3.5 [&::-webkit-slider-thumb]:w-3.5 [&::-moz-range-thumb]:h-3.5 [&::-moz-range-thumb]:w-3.5",md:"[&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:w-4 [&::-moz-range-thumb]:h-4 [&::-moz-range-thumb]:w-4",lg:"[&::-webkit-slider-thumb]:h-5 [&::-webkit-slider-thumb]:w-5 [&::-moz-range-thumb]:h-5 [&::-moz-range-thumb]:w-5"},me={sm:"h-4",md:"h-5",lg:"h-6"},ge={primary:"bg-synertech-primary-600 dark:bg-synertech-primary-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",neutral:"bg-gray-600 dark:bg-gray-400"},pe={primary:"border-synertech-primary-600 dark:border-synertech-primary-500",success:"border-green-600 dark:border-green-500",warning:"border-yellow-500 dark:border-yellow-400",error:"border-red-600 dark:border-red-500",info:"border-cyan-600 dark:border-cyan-500",neutral:"border-gray-600 dark:border-gray-400"},ye={primary:"peer-focus-visible:ring-synertech-primary-500",success:"peer-focus-visible:ring-green-500",warning:"peer-focus-visible:ring-yellow-500",error:"peer-focus-visible:ring-red-500",info:"peer-focus-visible:ring-cyan-500",neutral:"peer-focus-visible:ring-gray-500"},fe={primary:"text-synertech-primary-600 dark:text-synertech-primary-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",neutral:"text-gray-700 dark:text-gray-300"},O=(r,e,t)=>Math.min(t,Math.max(e,r)),P=(r,e,t)=>t>e?(O(r,e,t)-e)/(t-e)*100:0,v=(r,e)=>{let t=(.5-r/100)*e,a=Math.round(Math.abs(t)*1e3)/1e3;return`calc(${r}% ${t<0?"-":"+"} ${a}px)`},he=(r,e,t,a)=>{if(!r)return[];if(Array.isArray(r))return r;let s=a>0?a:1,i=Math.floor((t-e)/s);return i<=0||i>20?[{value:e},{value:t}]:Array.from({length:i+1},(d,w)=>({value:e+w*s}))},ve=le(({value:r,defaultValue:e,onValueChange:t,min:a=0,max:s=100,step:i=1,size:d="md",color:w="primary",disabled:b=!1,readOnly:C=!1,label:S,description:$,error:x=!1,showValue:V=!1,showTooltip:I=!1,valueFormat:T,marks:E,trackColor:_,fillColor:j,thumbColor:q,className:D,containerClassName:G,id:J,...K},Q)=>{let A=R(_),N=R(j),m=R(q),[U,X]=oe(e??a),H=r!==void 0,c=O(H?r:U,a,s),Y=ne(),g=J??Y,p=typeof x=="string"?x:void 0,L=!!x,y=!b&&!C,f=L?"error":w,W=P(c,a,s),h=ue[d],Z=o=>{if(!y)return;let u=Number(o.target.value);H||X(u),t?.(u)},z=se(()=>he(E,a,s,i),[E,a,s,i]),ee=z.some(o=>o.label!=null),F=T?T(c):`${c}`,B={width:v(W,h)};N&&(B.backgroundColor=N);let M={left:v(W,h)};m&&(M.backgroundColor=m,M.borderColor=m);let re=A?{backgroundColor:A}:{};return k("div",{className:l("w-full",G),children:[(S||V)&&k("div",{className:"flex items-center justify-between mb-1.5",children:[S?n("label",{htmlFor:g,className:l("text-sm font-medium text-gray-700 dark:text-gray-200",b&&"opacity-50"),children:S}):n("span",{}),V&&n("span",{className:l("text-sm font-semibold tabular-nums",fe[f]),children:F})]}),k("div",{className:l("relative flex items-center",me[d],b&&"opacity-50"),children:[n("input",{ref:Q,type:"range",id:g,min:a,max:s,step:i,value:c,onChange:Z,disabled:b,readOnly:C,"aria-invalid":L,"aria-readonly":C||void 0,"aria-describedby":p?`${g}-error`:void 0,tabIndex:y?void 0:-1,className:l("peer absolute inset-0 z-10 m-0 h-full w-full cursor-pointer appearance-none bg-transparent opacity-0",ce,be[d],!y&&"pointer-events-none cursor-default",D),...K}),k("div",{className:l("pointer-events-none relative w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700",ie[d]),style:re,children:[n("div",{className:l("absolute inset-y-0 left-0 rounded-full transition-[width] duration-150 ease-out",N?"":ge[f]),style:B}),z.map((o,u)=>{let te=P(o.value,a,s),ae=o.value<=c;return n("span",{"data-slider-mark":"",className:l("absolute top-1/2 h-1 w-1 -translate-x-1/2 -translate-y-1/2 rounded-full",ae?"bg-white/80":"bg-gray-400 dark:bg-gray-500"),style:{left:v(te,h)}},`mark-${o.value}-${u}`)})]}),n("div",{"data-slider-thumb":"",className:l("pointer-events-none absolute top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 bg-white shadow transition-transform dark:bg-gray-100",de[d],m?"":pe[f],y&&"peer-hover:scale-110 peer-active:scale-110","peer-focus-visible:scale-110 peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2",ye[f],I&&"peer-hover:*:opacity-100 peer-focus-visible:*:opacity-100 peer-active:*:opacity-100"),style:M,children:I&&n("span",{"data-slider-tooltip":"",className:"pointer-events-none absolute bottom-full left-1/2 mb-2 -translate-x-1/2 rounded bg-gray-900 px-1.5 py-0.5 text-xs font-medium text-white opacity-0 transition-opacity dark:bg-gray-700",children:F})})]}),ee&&n("div",{className:"relative mt-1.5 h-4",children:z.map((o,u)=>o.label!=null?n("span",{className:"absolute -translate-x-1/2 whitespace-nowrap text-xs text-gray-500 dark:text-gray-400",style:{left:v(P(o.value,a,s),h)},children:o.label},`mark-label-${o.value}-${u}`):null)}),$&&!p&&n("p",{className:"mt-1.5 text-sm text-gray-500 dark:text-gray-400",children:$}),p&&n("p",{id:`${g}-error`,className:"mt-1.5 text-sm text-red-600 dark:text-red-400",children:p})]})});ve.displayName="Slider";export{ve as Slider};
1
+ "use client";import{useState as ne,useId as se,useMemo as le,forwardRef as ie}from"react";import{cn as l}from"../../lib/cn.js";import{describeField as de}from"../form/shared/field-error.js";import{safeCssColor as M}from"../../lib/css-value.js";import{jsx as n,jsxs as v}from"react/jsx-runtime";var ue={sm:"h-1",md:"h-1.5",lg:"h-2"},ce={sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5"},be={sm:14,md:16,lg:20},me="[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-moz-range-thumb]:appearance-none [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-0",ge={sm:"[&::-webkit-slider-thumb]:h-3.5 [&::-webkit-slider-thumb]:w-3.5 [&::-moz-range-thumb]:h-3.5 [&::-moz-range-thumb]:w-3.5",md:"[&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:w-4 [&::-moz-range-thumb]:h-4 [&::-moz-range-thumb]:w-4",lg:"[&::-webkit-slider-thumb]:h-5 [&::-webkit-slider-thumb]:w-5 [&::-moz-range-thumb]:h-5 [&::-moz-range-thumb]:w-5"},pe={sm:"h-4",md:"h-5",lg:"h-6"},ye={primary:"bg-synertech-primary-600 dark:bg-synertech-primary-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",neutral:"bg-gray-600 dark:bg-gray-400"},fe={primary:"border-synertech-primary-600 dark:border-synertech-primary-500",success:"border-green-600 dark:border-green-500",warning:"border-yellow-500 dark:border-yellow-400",error:"border-red-600 dark:border-red-500",info:"border-cyan-600 dark:border-cyan-500",neutral:"border-gray-600 dark:border-gray-400"},he={primary:"peer-focus-visible:ring-synertech-primary-500",success:"peer-focus-visible:ring-green-500",warning:"peer-focus-visible:ring-yellow-500",error:"peer-focus-visible:ring-red-500",info:"peer-focus-visible:ring-cyan-500",neutral:"peer-focus-visible:ring-gray-500"},ve={primary:"text-synertech-primary-600 dark:text-synertech-primary-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",neutral:"text-gray-700 dark:text-gray-300"},B=(r,e,t)=>Math.min(t,Math.max(e,r)),P=(r,e,t)=>t>e?(B(r,e,t)-e)/(t-e)*100:0,h=(r,e)=>{let t=(.5-r/100)*e,a=Math.round(Math.abs(t)*1e3)/1e3;return`calc(${r}% ${t<0?"-":"+"} ${a}px)`},ke=(r,e,t,a)=>{if(!r)return[];if(Array.isArray(r))return r;let s=a>0?a:1,i=Math.floor((t-e)/s);return i<=0||i>20?[{value:e},{value:t}]:Array.from({length:i+1},(u,k)=>({value:e+k*s}))},we=ie(({value:r,defaultValue:e,onValueChange:t,min:a=0,max:s=100,step:i=1,size:u="md",color:k="primary",disabled:m=!1,readOnly:w=!1,label:C,description:V,error:O,showValue:$=!1,showTooltip:I=!1,valueFormat:T,marks:E,trackColor:_,fillColor:j,thumbColor:q,className:D,containerClassName:G,id:J,"aria-describedby":K,...Q},U)=>{let H=M(_),S=M(j),g=M(q),[X,Y]=ne(e??a),A=r!==void 0,b=B(A?r:X,a,s),Z=se(),x=J??Z,d=de(x,{helperText:V,error:O,own:K}),N=d.invalid,p=!m&&!w,y=N?"error":k,F=P(b,a,s),f=be[u],ee=o=>{if(!p)return;let c=Number(o.target.value);A||Y(c),t?.(c)},z=le(()=>ke(E,a,s,i),[E,a,s,i]),re=z.some(o=>o.label!=null),L=T?T(b):`${b}`,W={width:h(F,f)};S&&(W.backgroundColor=S);let R={left:h(F,f)};g&&(R.backgroundColor=g,R.borderColor=g);let te=H?{backgroundColor:H}:{};return v("div",{className:l("w-full",G),children:[(C||$)&&v("div",{className:"flex items-center justify-between mb-1.5",children:[C?n("label",{htmlFor:x,className:l("text-sm font-medium text-gray-700 dark:text-gray-200",m&&"opacity-50"),children:C}):n("span",{}),$&&n("span",{className:l("text-sm font-semibold tabular-nums",ve[y]),children:L})]}),v("div",{className:l("relative flex items-center",pe[u],m&&"opacity-50"),children:[n("input",{ref:U,type:"range",id:x,min:a,max:s,step:i,value:b,onChange:ee,disabled:m,readOnly:w,"aria-invalid":N||void 0,"aria-readonly":w||void 0,"aria-describedby":d.describedBy,tabIndex:p?void 0:-1,className:l("peer absolute inset-0 z-10 m-0 h-full w-full cursor-pointer appearance-none bg-transparent opacity-0",me,ge[u],!p&&"pointer-events-none cursor-default",D),...Q}),v("div",{className:l("pointer-events-none relative w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700",ue[u]),style:te,children:[n("div",{className:l("absolute inset-y-0 left-0 rounded-full transition-[width] duration-150 ease-out",S?"":ye[y]),style:W}),z.map((o,c)=>{let ae=P(o.value,a,s),oe=o.value<=b;return n("span",{"data-slider-mark":"",className:l("absolute top-1/2 h-1 w-1 -translate-x-1/2 -translate-y-1/2 rounded-full",oe?"bg-white/80":"bg-gray-400 dark:bg-gray-500"),style:{left:h(ae,f)}},`mark-${o.value}-${c}`)})]}),n("div",{"data-slider-thumb":"",className:l("pointer-events-none absolute top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 bg-white shadow transition-transform dark:bg-gray-100",ce[u],g?"":fe[y],p&&"peer-hover:scale-110 peer-active:scale-110","peer-focus-visible:scale-110 peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2",he[y],I&&"peer-hover:*:opacity-100 peer-focus-visible:*:opacity-100 peer-active:*:opacity-100"),style:R,children:I&&n("span",{"data-slider-tooltip":"",className:"pointer-events-none absolute bottom-full left-1/2 mb-2 -translate-x-1/2 rounded bg-gray-900 px-1.5 py-0.5 text-xs font-medium text-white opacity-0 transition-opacity dark:bg-gray-700",children:L})})]}),re&&n("div",{className:"relative mt-1.5 h-4",children:z.map((o,c)=>o.label!=null?n("span",{className:"absolute -translate-x-1/2 whitespace-nowrap text-xs text-gray-500 dark:text-gray-400",style:{left:h(P(o.value,a,s),f)},children:o.label},`mark-label-${o.value}-${c}`):null)}),d.showHelper&&n("p",{id:d.ids.helper,className:l("mt-1.5 text-sm",N?"text-red-600 dark:text-red-400":"text-gray-500 dark:text-gray-400"),children:V}),d.message!==void 0&&n("p",{id:d.ids.error,className:"mt-1.5 text-sm text-red-600 dark:text-red-400",children:d.message})]})});we.displayName="Slider";export{we as Slider};
@@ -1 +1 @@
1
- "use strict";"use client";var m=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var I=(o,r)=>{for(var l in r)m(o,l,{get:r[l],enumerable:!0})},O=(o,r,l,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of D(r))!F.call(o,i)&&i!==l&&m(o,i,{get:()=>r[i],enumerable:!(n=B(r,i))||n.enumerable});return o};var W=o=>O(m({},"__esModule",{value:!0}),o);var Y={};I(Y,{Tooltip:()=>w});module.exports=W(Y);var e=require("react"),c=require("../../lib/cn.cjs"),b=require("react/jsx-runtime"),q={top:"marginBottom",bottom:"marginTop",left:"marginRight",right:"marginLeft"},G={default:"bg-gray-900 text-white dark:bg-gray-700",light:"bg-white text-gray-900 border border-gray-200 shadow-lg dark:bg-gray-800 dark:text-white dark:border-gray-600",error:"bg-red-600 text-white",success:"bg-green-700 text-white",warning:"bg-yellow-500 text-gray-900",info:"bg-blue-600 text-white"},J={default:{top:"border-t-gray-900 dark:border-t-gray-700",bottom:"border-b-gray-900 dark:border-b-gray-700",left:"border-l-gray-900 dark:border-l-gray-700",right:"border-r-gray-900 dark:border-r-gray-700"},light:{top:"border-t-white dark:border-t-gray-800",bottom:"border-b-white dark:border-b-gray-800",left:"border-l-white dark:border-l-gray-800",right:"border-r-white dark:border-r-gray-800"},error:{top:"border-t-red-600",bottom:"border-b-red-600",left:"border-l-red-600",right:"border-r-red-600"},success:{top:"border-t-green-700",bottom:"border-b-green-700",left:"border-l-green-700",right:"border-r-green-700"},warning:{top:"border-t-yellow-500",bottom:"border-b-yellow-500",left:"border-l-yellow-500",right:"border-r-yellow-500"},info:{top:"border-t-blue-600",bottom:"border-b-blue-600",left:"border-l-blue-600",right:"border-r-blue-600"}},K={sm:"px-2 py-1 text-xs",md:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-base"},Q={sm:"border-4",md:"border-[5px]",lg:"border-[6px]"},U={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},X={top:"top-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-b-transparent",bottom:"bottom-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-t-transparent",left:"left-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-r-transparent",right:"right-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-l-transparent"};function w({children:o,content:r,position:l="top",variant:n="default",size:i="md",trigger:u="hover",open:x,delay:f=0,showArrow:k=!0,maxWidth:R="max-w-xs",className:v,contentClassName:P,disabled:s=!1,offset:y,onMouseEnter:C,onMouseLeave:S,onFocus:N,onBlur:z,onClick:V,...L}){let[M,p]=(0,e.useState)(!1),d=(0,e.useRef)(null),a=(0,e.useCallback)(()=>{d.current&&(clearTimeout(d.current),d.current=null)},[]);(0,e.useEffect)(()=>a,[a]);let h=(0,e.useCallback)(()=>{s||(a(),f>0?d.current=setTimeout(()=>{d.current=null,p(!0)},f):p(!0))},[f,s,a]),T=(0,e.useCallback)(()=>{a(),p(!1)},[a]),A=(0,e.useCallback)(()=>{s||p(t=>!t)},[s]),E=u==="manual"?x:M,g=u==="hover",H=u==="click";return(0,b.jsxs)("div",{className:(0,c.cn)("relative inline-flex",v),...L,onMouseEnter:t=>{C?.(t),g&&h()},onMouseLeave:t=>{S?.(t),g&&T()},onFocus:t=>{N?.(t),g&&h()},onBlur:t=>{z?.(t),g&&T()},onClick:t=>{V?.(t),H&&A()},children:[o,E&&!s&&(0,b.jsxs)("div",{role:"tooltip",style:y===void 0?void 0:{[q[l]]:y},className:(0,c.cn)("absolute z-50 whitespace-normal wrap-break-word rounded-md","transition-opacity duration-150",U[l],G[n],K[i],R,P),children:[r,k&&(0,b.jsx)("span",{className:(0,c.cn)("absolute w-0 h-0 border-solid",Q[i],X[l],J[n][l]),"aria-hidden":"true"})]})]})}w.displayName="Tooltip";0&&(module.exports={Tooltip});
1
+ "use strict";"use client";var N=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var J=Object.prototype.hasOwnProperty;var K=(e,r)=>{for(var s in r)N(e,s,{get:r[s],enumerable:!0})},Q=(e,r,s,b)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of G(r))!J.call(e,i)&&i!==s&&N(e,i,{get:()=>r[i],enumerable:!(b=q(r,i))||b.enumerable});return e};var U=e=>Q(N({},"__esModule",{value:!0}),e);var et={};K(et,{Tooltip:()=>B});module.exports=U(et);var t=require("react"),A=require("react-dom"),S=require("../dropdown/hooks/usePositioning.cjs"),V=require("../../lib/aria-hide.cjs"),E=require("../../lib/owner-document.cjs"),R=require("../../lib/cn.cjs"),f=require("react/jsx-runtime"),X={default:"bg-gray-900 text-white dark:bg-gray-700",light:"bg-white text-gray-900 border border-gray-200 shadow-lg dark:bg-gray-800 dark:text-white dark:border-gray-600",error:"bg-red-600 text-white",success:"bg-green-700 text-white",warning:"bg-yellow-500 text-gray-900",info:"bg-blue-600 text-white"},Y={default:{top:"border-t-gray-900 dark:border-t-gray-700",bottom:"border-b-gray-900 dark:border-b-gray-700",left:"border-l-gray-900 dark:border-l-gray-700",right:"border-r-gray-900 dark:border-r-gray-700"},light:{top:"border-t-white dark:border-t-gray-800",bottom:"border-b-white dark:border-b-gray-800",left:"border-l-white dark:border-l-gray-800",right:"border-r-white dark:border-r-gray-800"},error:{top:"border-t-red-600",bottom:"border-b-red-600",left:"border-l-red-600",right:"border-r-red-600"},success:{top:"border-t-green-700",bottom:"border-b-green-700",left:"border-l-green-700",right:"border-r-green-700"},warning:{top:"border-t-yellow-500",bottom:"border-b-yellow-500",left:"border-l-yellow-500",right:"border-r-yellow-500"},info:{top:"border-t-blue-600",bottom:"border-b-blue-600",left:"border-l-blue-600",right:"border-r-blue-600"}},Z={sm:"px-2 py-1 text-xs",md:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-base"},_={sm:"border-4",md:"border-[5px]",lg:"border-[6px]"},$={top:"top-full -translate-x-1/2 border-l-transparent border-r-transparent border-b-transparent",bottom:"bottom-full -translate-x-1/2 border-l-transparent border-r-transparent border-t-transparent",left:"left-full -translate-y-1/2 border-t-transparent border-b-transparent border-r-transparent",right:"right-full -translate-y-1/2 border-t-transparent border-b-transparent border-l-transparent"};function tt({anchorRef:e,content:r,position:s,offset:b,variant:i,size:p,showArrow:v,maxWidth:g,contentClassName:k}){let c=(0,t.useRef)(null),o=(0,S.usePositioning)({triggerRef:e,contentRef:c,isOpen:!0,side:s,align:"center",sideOffset:b}),d=o.actualSide,l=d==="top"||d==="bottom",[y,C]=(0,t.useState)(null);return(0,t.useLayoutEffect)(()=>{if(!o.isReady)return;let a=e.current?.getBoundingClientRect(),m=c.current?.getBoundingClientRect();if(!a||!m)return;let M=l?a.left+a.width/2-o.left:a.top+a.height/2-o.top,P=l?m.width:m.height;C(Math.min(Math.max(M,10),Math.max(10,P-10)))},[e,o.isReady,o.top,o.left,l]),(0,t.useEffect)(()=>{let a=c.current;if(a)return(0,V.registerFloatingLayer)(a,()=>e.current)},[e]),(0,f.jsxs)("div",{ref:c,role:"tooltip","data-side":d,style:{position:"fixed",top:o.top,left:o.left,opacity:o.isReady?1:0},className:(0,R.cn)("z-[70] whitespace-normal wrap-break-word rounded-md","transition-opacity duration-150",X[i],Z[p],g,k),children:[r,v&&(0,f.jsx)("span",{className:(0,R.cn)("absolute w-0 h-0 border-solid",_[p],$[d],Y[i][d]),style:l?{left:y??"50%"}:{top:y??"50%"},"aria-hidden":"true"})]})}function B({children:e,content:r,position:s="top",variant:b="default",size:i="md",trigger:p="hover",open:v,delay:g=0,showArrow:k=!0,maxWidth:c="max-w-xs",className:o,contentClassName:d,disabled:l=!1,offset:y,onMouseEnter:C,onMouseLeave:a,onFocus:m,onBlur:M,onClick:P,...H}){let[O,T]=(0,t.useState)(!1),h=(0,t.useRef)(null),w=(0,t.useRef)(null),[D,W]=(0,t.useState)(!1);(0,t.useEffect)(()=>W(!0),[]);let u=(0,t.useCallback)(()=>{h.current&&(clearTimeout(h.current),h.current=null)},[]);(0,t.useEffect)(()=>u,[u]);let z=(0,t.useCallback)(()=>{l||(u(),g>0?h.current=setTimeout(()=>{h.current=null,T(!0)},g):T(!0))},[g,l,u]),L=(0,t.useCallback)(()=>{u(),T(!1)},[u]),F=(0,t.useCallback)(()=>{l||T(n=>!n)},[l]),j=p==="manual"?v:O,x=p==="hover",I=p==="click";return(0,f.jsxs)("div",{ref:w,className:(0,R.cn)("relative inline-flex",o),...H,onMouseEnter:n=>{C?.(n),x&&z()},onMouseLeave:n=>{a?.(n),x&&L()},onFocus:n=>{m?.(n),x&&z()},onBlur:n=>{M?.(n),x&&L()},onClick:n=>{P?.(n),I&&F()},children:[e,j&&!l&&D&&w.current?(0,A.createPortal)((0,f.jsx)(tt,{anchorRef:w,content:r,position:s,offset:y??8,variant:b,size:i,showArrow:k,maxWidth:c,contentClassName:d}),(0,E.ownerDocumentOf)(w.current).body):null]})}B.displayName="Tooltip";0&&(module.exports={Tooltip});
@@ -1 +1 @@
1
- "use client";import{useState as E,useRef as H,useCallback as n,useEffect as B}from"react";import{cn as b}from"../../lib/cn.js";import{jsx as K,jsxs as m}from"react/jsx-runtime";var D={top:"marginBottom",bottom:"marginTop",left:"marginRight",right:"marginLeft"},F={default:"bg-gray-900 text-white dark:bg-gray-700",light:"bg-white text-gray-900 border border-gray-200 shadow-lg dark:bg-gray-800 dark:text-white dark:border-gray-600",error:"bg-red-600 text-white",success:"bg-green-700 text-white",warning:"bg-yellow-500 text-gray-900",info:"bg-blue-600 text-white"},I={default:{top:"border-t-gray-900 dark:border-t-gray-700",bottom:"border-b-gray-900 dark:border-b-gray-700",left:"border-l-gray-900 dark:border-l-gray-700",right:"border-r-gray-900 dark:border-r-gray-700"},light:{top:"border-t-white dark:border-t-gray-800",bottom:"border-b-white dark:border-b-gray-800",left:"border-l-white dark:border-l-gray-800",right:"border-r-white dark:border-r-gray-800"},error:{top:"border-t-red-600",bottom:"border-b-red-600",left:"border-l-red-600",right:"border-r-red-600"},success:{top:"border-t-green-700",bottom:"border-b-green-700",left:"border-l-green-700",right:"border-r-green-700"},warning:{top:"border-t-yellow-500",bottom:"border-b-yellow-500",left:"border-l-yellow-500",right:"border-r-yellow-500"},info:{top:"border-t-blue-600",bottom:"border-b-blue-600",left:"border-l-blue-600",right:"border-r-blue-600"}},O={sm:"px-2 py-1 text-xs",md:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-base"},W={sm:"border-4",md:"border-[5px]",lg:"border-[6px]"},q={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},G={top:"top-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-b-transparent",bottom:"bottom-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-t-transparent",left:"left-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-r-transparent",right:"right-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-l-transparent"};function J({children:y,content:h,position:l="top",variant:p="default",size:g="md",trigger:s="hover",open:T,delay:d=0,showArrow:w=!0,maxWidth:x="max-w-xs",className:k,contentClassName:R,disabled:e=!1,offset:c,onMouseEnter:v,onMouseLeave:P,onFocus:C,onBlur:S,onClick:N,...z}){let[V,i]=E(!1),o=H(null),t=n(()=>{o.current&&(clearTimeout(o.current),o.current=null)},[]);B(()=>t,[t]);let u=n(()=>{e||(t(),d>0?o.current=setTimeout(()=>{o.current=null,i(!0)},d):i(!0))},[d,e,t]),f=n(()=>{t(),i(!1)},[t]),L=n(()=>{e||i(r=>!r)},[e]),M=s==="manual"?T:V,a=s==="hover",A=s==="click";return m("div",{className:b("relative inline-flex",k),...z,onMouseEnter:r=>{v?.(r),a&&u()},onMouseLeave:r=>{P?.(r),a&&f()},onFocus:r=>{C?.(r),a&&u()},onBlur:r=>{S?.(r),a&&f()},onClick:r=>{N?.(r),A&&L()},children:[y,M&&!e&&m("div",{role:"tooltip",style:c===void 0?void 0:{[D[l]]:c},className:b("absolute z-50 whitespace-normal wrap-break-word rounded-md","transition-opacity duration-150",q[l],F[p],O[g],x,R),children:[h,w&&K("span",{className:b("absolute w-0 h-0 border-solid",W[g],G[l],I[p][l]),"aria-hidden":"true"})]})]})}J.displayName="Tooltip";export{J as Tooltip};
1
+ "use client";import{useState as M,useRef as P,useCallback as h,useEffect as N,useLayoutEffect as j}from"react";import{createPortal as I}from"react-dom";import{usePositioning as q}from"../dropdown/hooks/usePositioning.js";import{registerFloatingLayer as G}from"../../lib/aria-hide.js";import{ownerDocumentOf as J}from"../../lib/owner-document.js";import{cn as z}from"../../lib/cn.js";import{jsx as S,jsxs as V}from"react/jsx-runtime";var K={default:"bg-gray-900 text-white dark:bg-gray-700",light:"bg-white text-gray-900 border border-gray-200 shadow-lg dark:bg-gray-800 dark:text-white dark:border-gray-600",error:"bg-red-600 text-white",success:"bg-green-700 text-white",warning:"bg-yellow-500 text-gray-900",info:"bg-blue-600 text-white"},Q={default:{top:"border-t-gray-900 dark:border-t-gray-700",bottom:"border-b-gray-900 dark:border-b-gray-700",left:"border-l-gray-900 dark:border-l-gray-700",right:"border-r-gray-900 dark:border-r-gray-700"},light:{top:"border-t-white dark:border-t-gray-800",bottom:"border-b-white dark:border-b-gray-800",left:"border-l-white dark:border-l-gray-800",right:"border-r-white dark:border-r-gray-800"},error:{top:"border-t-red-600",bottom:"border-b-red-600",left:"border-l-red-600",right:"border-r-red-600"},success:{top:"border-t-green-700",bottom:"border-b-green-700",left:"border-l-green-700",right:"border-r-green-700"},warning:{top:"border-t-yellow-500",bottom:"border-b-yellow-500",left:"border-l-yellow-500",right:"border-r-yellow-500"},info:{top:"border-t-blue-600",bottom:"border-b-blue-600",left:"border-l-blue-600",right:"border-r-blue-600"}},U={sm:"px-2 py-1 text-xs",md:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-base"},X={sm:"border-4",md:"border-[5px]",lg:"border-[6px]"},Y={top:"top-full -translate-x-1/2 border-l-transparent border-r-transparent border-b-transparent",bottom:"bottom-full -translate-x-1/2 border-l-transparent border-r-transparent border-t-transparent",left:"left-full -translate-y-1/2 border-t-transparent border-b-transparent border-r-transparent",right:"right-full -translate-y-1/2 border-t-transparent border-b-transparent border-l-transparent"};function Z({anchorRef:n,content:y,position:T,offset:w,variant:c,size:l,showArrow:x,maxWidth:d,contentClassName:R}){let a=P(null),t=q({triggerRef:n,contentRef:a,isOpen:!0,side:T,align:"center",sideOffset:w}),i=t.actualSide,r=i==="top"||i==="bottom",[u,v]=M(null);return j(()=>{if(!t.isReady)return;let o=n.current?.getBoundingClientRect(),b=a.current?.getBoundingClientRect();if(!o||!b)return;let k=r?o.left+o.width/2-t.left:o.top+o.height/2-t.top,C=r?b.width:b.height;v(Math.min(Math.max(k,10),Math.max(10,C-10)))},[n,t.isReady,t.top,t.left,r]),N(()=>{let o=a.current;if(o)return G(o,()=>n.current)},[n]),V("div",{ref:a,role:"tooltip","data-side":i,style:{position:"fixed",top:t.top,left:t.left,opacity:t.isReady?1:0},className:z("z-[70] whitespace-normal wrap-break-word rounded-md","transition-opacity duration-150",K[c],U[l],d,R),children:[y,x&&S("span",{className:z("absolute w-0 h-0 border-solid",X[l],Y[i],Q[c][i]),style:r?{left:u??"50%"}:{top:u??"50%"},"aria-hidden":"true"})]})}function _({children:n,content:y,position:T="top",variant:w="default",size:c="md",trigger:l="hover",open:x,delay:d=0,showArrow:R=!0,maxWidth:a="max-w-xs",className:t,contentClassName:i,disabled:r=!1,offset:u,onMouseEnter:v,onMouseLeave:o,onFocus:b,onBlur:k,onClick:C,...E}){let[B,f]=M(!1),p=P(null),g=P(null),[H,O]=M(!1);N(()=>O(!0),[]);let s=h(()=>{p.current&&(clearTimeout(p.current),p.current=null)},[]);N(()=>s,[s]);let L=h(()=>{r||(s(),d>0?p.current=setTimeout(()=>{p.current=null,f(!0)},d):f(!0))},[d,r,s]),A=h(()=>{s(),f(!1)},[s]),D=h(()=>{r||f(e=>!e)},[r]),W=l==="manual"?x:B,m=l==="hover",F=l==="click";return V("div",{ref:g,className:z("relative inline-flex",t),...E,onMouseEnter:e=>{v?.(e),m&&L()},onMouseLeave:e=>{o?.(e),m&&A()},onFocus:e=>{b?.(e),m&&L()},onBlur:e=>{k?.(e),m&&A()},onClick:e=>{C?.(e),F&&D()},children:[n,W&&!r&&H&&g.current?I(S(Z,{anchorRef:g,content:y,position:T,offset:u??8,variant:w,size:c,showArrow:R,maxWidth:a,contentClassName:i}),J(g.current).body):null]})}_.displayName="Tooltip";export{_ as Tooltip};