@synertech/ui 0.54.0 → 0.56.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 (90) hide show
  1. package/.claude/skills/use-synertech-ui/SKILL.md +320 -5
  2. package/README.md +1 -1
  3. package/dist/components/accordion/Accordion.cjs +1 -1
  4. package/dist/components/accordion/Accordion.js +1 -1
  5. package/dist/components/area-chart/AreaChart.cjs +1 -1
  6. package/dist/components/area-chart/AreaChart.js +1 -1
  7. package/dist/components/chart/ChartContainer.cjs +1 -1
  8. package/dist/components/chart/ChartContainer.js +1 -1
  9. package/dist/components/chart/ChartExportButton.cjs +1 -1
  10. package/dist/components/chart/ChartExportButton.js +1 -1
  11. package/dist/components/command-palette/CommandGroup.cjs +1 -0
  12. package/dist/components/command-palette/CommandGroup.js +1 -0
  13. package/dist/components/command-palette/CommandItem.cjs +1 -0
  14. package/dist/components/command-palette/CommandItem.js +1 -0
  15. package/dist/components/command-palette/CommandPalette.cjs +1 -0
  16. package/dist/components/command-palette/CommandPalette.js +1 -0
  17. package/dist/components/command-palette/context.cjs +1 -0
  18. package/dist/components/command-palette/context.js +1 -0
  19. package/dist/components/command-palette/index.cjs +1 -0
  20. package/dist/components/command-palette/index.js +1 -0
  21. package/dist/components/command-palette/kbd.cjs +1 -0
  22. package/dist/components/command-palette/kbd.js +1 -0
  23. package/dist/components/command-palette/match.cjs +1 -0
  24. package/dist/components/command-palette/match.js +1 -0
  25. package/dist/components/datagrid/ActiveFilters.cjs +1 -0
  26. package/dist/components/datagrid/ActiveFilters.js +1 -0
  27. package/dist/components/datagrid/BulkActionsBar.cjs +1 -0
  28. package/dist/components/datagrid/BulkActionsBar.js +1 -0
  29. package/dist/components/datagrid/ColumnToggle.cjs +1 -0
  30. package/dist/components/datagrid/ColumnToggle.js +1 -0
  31. package/dist/components/datagrid/DataGrid.cjs +1 -1
  32. package/dist/components/datagrid/DataGrid.js +1 -1
  33. package/dist/components/datagrid/DataGridPagination.cjs +1 -0
  34. package/dist/components/datagrid/DataGridPagination.js +1 -0
  35. package/dist/components/datagrid/EditableCell.cjs +1 -0
  36. package/dist/components/datagrid/EditableCell.js +1 -0
  37. package/dist/components/datagrid/FilterPopover.cjs +1 -0
  38. package/dist/components/datagrid/FilterPopover.js +1 -0
  39. package/dist/components/datagrid/export.cjs +1 -0
  40. package/dist/components/datagrid/export.js +1 -0
  41. package/dist/components/datagrid/icons.cjs +1 -0
  42. package/dist/components/datagrid/icons.js +1 -0
  43. package/dist/components/datagrid/index.cjs +1 -1
  44. package/dist/components/datagrid/types.cjs +1 -0
  45. package/dist/components/datagrid/types.js +0 -0
  46. package/dist/components/datagrid/utils.cjs +1 -0
  47. package/dist/components/datagrid/utils.js +1 -0
  48. package/dist/components/dropdown/DropdownContent.cjs +1 -1
  49. package/dist/components/dropdown/DropdownContent.js +1 -1
  50. package/dist/components/dropdown/DropdownSubMenu.cjs +1 -1
  51. package/dist/components/dropdown/DropdownSubMenu.js +1 -1
  52. package/dist/components/dropdown/hooks/usePositioning.cjs +1 -1
  53. package/dist/components/dropdown/hooks/usePositioning.js +1 -1
  54. package/dist/components/empty-state/EmptyState.cjs +1 -0
  55. package/dist/components/empty-state/EmptyState.js +1 -0
  56. package/dist/components/empty-state/index.cjs +1 -0
  57. package/dist/components/empty-state/index.js +1 -0
  58. package/dist/components/form/mention-input/MentionInput.cjs +5 -5
  59. package/dist/components/form/mention-input/MentionInput.js +5 -5
  60. package/dist/components/help-button/HelpButton.cjs +2 -2
  61. package/dist/components/help-button/HelpButton.js +2 -2
  62. package/dist/components/index.cjs +1 -1
  63. package/dist/components/index.js +1 -1
  64. package/dist/components/line-chart/LineChart.cjs +1 -1
  65. package/dist/components/line-chart/LineChart.js +1 -1
  66. package/dist/components/schema-editor/SchemaEditor.cjs +1 -1
  67. package/dist/components/schema-editor/SchemaEditor.js +1 -1
  68. package/dist/components/select/Select.cjs +1 -1
  69. package/dist/components/select/Select.js +1 -1
  70. package/dist/components/skeleton/Skeleton.cjs +1 -1
  71. package/dist/components/skeleton/Skeleton.js +1 -1
  72. package/dist/components/timeline/Timeline.cjs +1 -0
  73. package/dist/components/timeline/Timeline.js +1 -0
  74. package/dist/components/timeline/index.cjs +1 -0
  75. package/dist/components/timeline/index.js +1 -0
  76. package/dist/components/tree-view/TreeView.cjs +1 -0
  77. package/dist/components/tree-view/TreeView.js +1 -0
  78. package/dist/components/tree-view/index.cjs +1 -0
  79. package/dist/components/tree-view/index.js +1 -0
  80. package/dist/components/tree-view/tree-model.cjs +1 -0
  81. package/dist/components/tree-view/tree-model.js +1 -0
  82. package/dist/components/workflow-editor/WorkflowEditor.cjs +1 -1
  83. package/dist/components/workflow-editor/WorkflowEditor.js +1 -1
  84. package/dist/index.d.cts +601 -10
  85. package/dist/index.d.ts +601 -10
  86. package/dist/lib/ui-labels.cjs +1 -1
  87. package/dist/lib/ui-labels.js +1 -1
  88. package/dist/styles-no-preflight.css +1321 -843
  89. package/dist/styles.css +1319 -843
  90. package/package.json +10 -4
@@ -0,0 +1 @@
1
+ "use strict";"use client";var l=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var v=(e,t)=>{for(var d in t)l(e,d,{get:t[d],enumerable:!0})},f=(e,t,d,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of y(t))!c.call(e,i)&&i!==d&&l(e,i,{get:()=>t[i],enumerable:!(r=g(t,i))||r.enumerable});return e};var x=e=>f(l({},"__esModule",{value:!0}),e);var k={};v(k,{DataGridPagination:()=>N});module.exports=x(k);var p=require("../../lib/ui-labels.cjs"),m=require("./utils.cjs"),a=require("react/jsx-runtime"),b="px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer";function N({config:e,totalItems:t,pageSize:d,currentPage:r,totalPages:i,onPageChange:n,onPageSizeChange:u,labels:o}){return(0,a.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3 text-sm text-gray-600 dark:text-gray-400",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[e.showTotalItems!==!1&&(0,a.jsx)("span",{children:(0,p.formatUILabel)(t===1?o.dataGridItemCount:o.dataGridItemsCount,{count:t})}),e.showPageSizeSelector!==!1&&e.pageSizeOptions&&(0,a.jsxs)("label",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{children:o.dataGridRowsPerPage}),(0,a.jsx)("select",{value:d,onChange:s=>u(Number(s.target.value)),className:"border border-gray-300 dark:border-gray-600 rounded px-1.5 py-0.5 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 text-sm",children:(0,m.pageSizeChoices)(e.pageSizeOptions,d).map(s=>(0,a.jsx)("option",{value:s,children:s},s))})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"mr-2",children:(0,p.formatUILabel)(o.dataGridPageOf,{page:r,total:i})}),(0,a.jsx)("button",{type:"button",onClick:()=>n(1),disabled:r<=1,className:b,"aria-label":o.dataGridFirstPage,children:"\xAB\xAB"}),(0,a.jsx)("button",{type:"button",onClick:()=>n(r-1),disabled:r<=1,className:b,"aria-label":o.dataGridPreviousPage,children:"\xAB"}),(0,a.jsx)("button",{type:"button",onClick:()=>n(r+1),disabled:r>=i,className:b,"aria-label":o.dataGridNextPage,children:"\xBB"}),(0,a.jsx)("button",{type:"button",onClick:()=>n(i),disabled:r>=i,className:b,"aria-label":o.dataGridLastPage,children:"\xBB\xBB"})]})]})}0&&(module.exports={DataGridPagination});
@@ -0,0 +1 @@
1
+ "use client";import{formatUILabel as p}from"../../lib/ui-labels.js";import{pageSizeChoices as u}from"./utils.js";import{jsx as a,jsxs as n}from"react/jsx-runtime";var s="px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer";function c({config:i,totalItems:b,pageSize:l,currentPage:t,totalPages:o,onPageChange:d,onPageSizeChange:m,labels:e}){return n("div",{className:"flex items-center justify-between flex-wrap gap-3 text-sm text-gray-600 dark:text-gray-400",children:[n("div",{className:"flex items-center gap-3",children:[i.showTotalItems!==!1&&a("span",{children:p(b===1?e.dataGridItemCount:e.dataGridItemsCount,{count:b})}),i.showPageSizeSelector!==!1&&i.pageSizeOptions&&n("label",{className:"flex items-center gap-1.5",children:[a("span",{children:e.dataGridRowsPerPage}),a("select",{value:l,onChange:r=>m(Number(r.target.value)),className:"border border-gray-300 dark:border-gray-600 rounded px-1.5 py-0.5 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 text-sm",children:u(i.pageSizeOptions,l).map(r=>a("option",{value:r,children:r},r))})]})]}),n("div",{className:"flex items-center gap-1",children:[a("span",{className:"mr-2",children:p(e.dataGridPageOf,{page:t,total:o})}),a("button",{type:"button",onClick:()=>d(1),disabled:t<=1,className:s,"aria-label":e.dataGridFirstPage,children:"\xAB\xAB"}),a("button",{type:"button",onClick:()=>d(t-1),disabled:t<=1,className:s,"aria-label":e.dataGridPreviousPage,children:"\xAB"}),a("button",{type:"button",onClick:()=>d(t+1),disabled:t>=o,className:s,"aria-label":e.dataGridNextPage,children:"\xBB"}),a("button",{type:"button",onClick:()=>d(o),disabled:t>=o,className:s,"aria-label":e.dataGridLastPage,children:"\xBB\xBB"})]})]})}export{c as DataGridPagination};
@@ -0,0 +1 @@
1
+ "use strict";"use client";var d=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var x=(e,t)=>{for(var r in t)d(e,r,{get:t[r],enumerable:!0})},v=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of k(t))!N.call(e,n)&&n!==r&&d(e,n,{get:()=>t[n],enumerable:!(o=E(t,n))||o.enumerable});return e};var w=e=>v(d({},"__esModule",{value:!0}),e);var h={};x(h,{EditableCell:()=>D});module.exports=w(h);var i=require("react"),b=require("../../lib/cn.cjs"),g=require("./utils.cjs"),c=require("react/jsx-runtime");function D({value:e,display:t,onSave:r,density:o,labels:n}){let m=typeof e=="number",[s,f]=(0,i.useState)(!1),[l,p]=(0,i.useState)(String(e??"")),a=(0,i.useRef)(null);if((0,i.useEffect)(()=>{s&&a.current&&(a.current.focus(),a.current.select())},[s]),!s)return(0,c.jsx)("div",{onDoubleClick:()=>{p(String(e??"")),f(!0)},className:"cursor-text min-h-[1.5em]",title:n.dataGridEditHint,children:t});let y=()=>{if(f(!1),l!==String(e??"")){if(!m){r(l);return}l.trim()===""?r(null):Number.isFinite(Number(l))&&r(Number(l))}};return(0,c.jsx)("input",{ref:a,type:m?"number":"text",value:l,onChange:u=>p(u.target.value),onBlur:y,"aria-label":n.dataGridEditCell,onKeyDown:u=>{u.key==="Enter"&&y(),u.key==="Escape"&&(u.preventDefault(),f(!1))},className:(0,b.cn)("w-full border border-synertech-primary-500 rounded px-1 py-0.5 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 outline-none",g.densityText[o])})}0&&(module.exports={EditableCell});
@@ -0,0 +1 @@
1
+ "use client";import{useEffect as y,useRef as b,useState as d}from"react";import{cn as g}from"../../lib/cn.js";import{densityText as E}from"./utils.js";import{jsx as c}from"react/jsx-runtime";function v({value:r,display:m,onSave:i,density:p,labels:o}){let a=typeof r=="number",[l,u]=d(!1),[e,s]=d(String(r??"")),n=b(null);if(y(()=>{l&&n.current&&(n.current.focus(),n.current.select())},[l]),!l)return c("div",{onDoubleClick:()=>{s(String(r??"")),u(!0)},className:"cursor-text min-h-[1.5em]",title:o.dataGridEditHint,children:m});let f=()=>{if(u(!1),e!==String(r??"")){if(!a){i(e);return}e.trim()===""?i(null):Number.isFinite(Number(e))&&i(Number(e))}};return c("input",{ref:n,type:a?"number":"text",value:e,onChange:t=>s(t.target.value),onBlur:f,"aria-label":o.dataGridEditCell,onKeyDown:t=>{t.key==="Enter"&&f(),t.key==="Escape"&&(t.preventDefault(),u(!1))},className:g("w-full border border-synertech-primary-500 rounded px-1 py-0.5 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 outline-none",E[p])})}export{v as EditableCell};
@@ -0,0 +1 @@
1
+ "use strict";"use client";var f=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var I=(o,a)=>{for(var i in a)f(o,i,{get:a[i],enumerable:!0})},L=(o,a,i,p)=>{if(a&&typeof a=="object"||typeof a=="function")for(let e of T(a))!V.call(o,e)&&e!==i&&f(o,e,{get:()=>a[e],enumerable:!(p=w(a,e))||p.enumerable});return o};var q=o=>L(f({},"__esModule",{value:!0}),o);var A={};I(A,{FilterPopover:()=>W});module.exports=q(A);var l=require("react"),N=require("../../lib/cn.cjs"),m=require("../../lib/ui-labels.cjs"),F=require("./icons.cjs"),E=require("./utils.cjs"),r=require("react/jsx-runtime");function W({column:o,value:a,onApply:i,onClear:p,labels:e}){let d=o.filterType??"text",g=(0,E.columnLabel)(o),v=d==="number"?[{value:"equals",label:e.dataGridOperatorEquals},{value:"gt",label:e.dataGridOperatorGreaterThan},{value:"gte",label:e.dataGridOperatorGreaterOrEqual},{value:"lt",label:e.dataGridOperatorLessThan},{value:"lte",label:e.dataGridOperatorLessOrEqual},{value:"between",label:e.dataGridOperatorBetween}]:d==="date"?[{value:"equals",label:e.dataGridOperatorOn},{value:"lt",label:e.dataGridOperatorBefore},{value:"gt",label:e.dataGridOperatorAfter},{value:"between",label:e.dataGridOperatorBetween},{value:"isEmpty",label:e.dataGridOperatorIsEmpty},{value:"isNotEmpty",label:e.dataGridOperatorIsNotEmpty}]:[{value:"contains",label:e.dataGridOperatorContains},{value:"equals",label:e.dataGridOperatorEquals},{value:"startsWith",label:e.dataGridOperatorStartsWith},{value:"endsWith",label:e.dataGridOperatorEndsWith},{value:"isEmpty",label:e.dataGridOperatorIsEmpty},{value:"isNotEmpty",label:e.dataGridOperatorIsNotEmpty}],h=t=>t&&v.some(x=>x.value===t.operator)?t.operator:v[0].value,[u,n]=(0,l.useState)(!1),[s,k]=(0,l.useState)(()=>h(a)),[c,y]=(0,l.useState)(a?.value??""),[O,G]=(0,l.useState)(a?.valueTo??""),b=(0,l.useRef)(null),C=()=>{u||(k(h(a)),y(a?.value??""),G(a?.valueTo??"")),n(!u)};return(0,l.useEffect)(()=>{let t=x=>{b.current&&!b.current.contains(x.target)&&n(!1)};return u&&document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[u]),(0,r.jsxs)("div",{className:"relative inline-block",ref:b,children:[(0,r.jsx)("button",{type:"button",onClick:C,className:(0,N.cn)("p-0.5 rounded hover:bg-gray-200 dark:hover:bg-gray-600 cursor-pointer",a&&"text-synertech-primary-600 dark:text-synertech-primary-400"),"aria-label":(0,m.formatUILabel)(e.dataGridFilterColumn,{column:g}),"data-grid-filter":o.key,children:(0,r.jsx)(F.FilterIcon,{})}),u&&(0,r.jsx)("div",{className:"absolute z-50 top-full left-0 mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg p-3 min-w-[220px]",children:d==="select"&&o.filterOptions?(0,r.jsxs)("div",{className:"flex flex-col gap-1.5",children:[o.filterOptions.map(t=>(0,r.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[(0,r.jsx)("input",{type:"radio",name:`filter-${o.key}`,value:t,checked:c===t,onChange:()=>y(t),className:"cursor-pointer"}),(0,r.jsx)("span",{className:"text-gray-700 dark:text-gray-300",children:t})]},t)),(0,r.jsxs)("div",{className:"flex gap-2 mt-2",children:[(0,r.jsx)("button",{type:"button",onClick:()=>{i({column:o.key,operator:"equals",value:c}),n(!1)},className:"px-2 py-1 text-xs bg-synertech-primary-600 text-synertech-on-primary rounded hover:bg-synertech-primary-700 cursor-pointer",children:e.dataGridFilterApply}),(0,r.jsx)("button",{type:"button",onClick:()=>{y(""),p(),n(!1)},className:"px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 cursor-pointer",children:e.dataGridFilterClear})]})]}):(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsx)("select",{value:s,onChange:t=>k(t.target.value),className:"text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200",children:v.map(t=>(0,r.jsx)("option",{value:t.value,children:t.label},t.value))}),s!=="isEmpty"&&s!=="isNotEmpty"&&(0,r.jsx)("input",{type:d==="number"?"number":d==="date"?"date":"text",value:c,onChange:t=>y(t.target.value),placeholder:e.dataGridFilterValuePlaceholder,className:"text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200",autoFocus:!0,"aria-label":(0,m.formatUILabel)(e.dataGridFilterValue,{column:g})}),s==="between"&&(0,r.jsx)("input",{type:d==="date"?"date":"number",value:O,onChange:t=>G(t.target.value),placeholder:e.dataGridFilterValuePlaceholder,className:"text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200","aria-label":(0,m.formatUILabel)(e.dataGridFilterValueTo,{column:g})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{type:"button",onClick:()=>{i({column:o.key,operator:s,value:c,...s==="between"?{valueTo:O}:{}}),n(!1)},className:"px-2 py-1 text-xs bg-synertech-primary-600 text-synertech-on-primary rounded hover:bg-synertech-primary-700 cursor-pointer",children:e.dataGridFilterApply}),(0,r.jsx)("button",{type:"button",onClick:()=>{y(""),p(),n(!1)},className:"px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 cursor-pointer",children:e.dataGridFilterClear})]})]})})]})}0&&(module.exports={FilterPopover});
@@ -0,0 +1 @@
1
+ "use client";import{useEffect as F,useRef as E,useState as y}from"react";import{cn as C}from"../../lib/cn.js";import{formatUILabel as b}from"../../lib/ui-labels.js";import{FilterIcon as w}from"./icons.js";import{columnLabel as T}from"./utils.js";import{jsx as r,jsxs as n}from"react/jsx-runtime";function A({column:a,value:o,onApply:x,onClear:f,labels:e}){let l=a.filterType??"text",c=T(a),m=l==="number"?[{value:"equals",label:e.dataGridOperatorEquals},{value:"gt",label:e.dataGridOperatorGreaterThan},{value:"gte",label:e.dataGridOperatorGreaterOrEqual},{value:"lt",label:e.dataGridOperatorLessThan},{value:"lte",label:e.dataGridOperatorLessOrEqual},{value:"between",label:e.dataGridOperatorBetween}]:l==="date"?[{value:"equals",label:e.dataGridOperatorOn},{value:"lt",label:e.dataGridOperatorBefore},{value:"gt",label:e.dataGridOperatorAfter},{value:"between",label:e.dataGridOperatorBetween},{value:"isEmpty",label:e.dataGridOperatorIsEmpty},{value:"isNotEmpty",label:e.dataGridOperatorIsNotEmpty}]:[{value:"contains",label:e.dataGridOperatorContains},{value:"equals",label:e.dataGridOperatorEquals},{value:"startsWith",label:e.dataGridOperatorStartsWith},{value:"endsWith",label:e.dataGridOperatorEndsWith},{value:"isEmpty",label:e.dataGridOperatorIsEmpty},{value:"isNotEmpty",label:e.dataGridOperatorIsNotEmpty}],h=t=>t&&m.some(v=>v.value===t.operator)?t.operator:m[0].value,[s,i]=y(!1),[d,k]=y(()=>h(o)),[u,p]=y(o?.value??""),[O,G]=y(o?.valueTo??""),g=E(null),N=()=>{s||(k(h(o)),p(o?.value??""),G(o?.valueTo??"")),i(!s)};return F(()=>{let t=v=>{g.current&&!g.current.contains(v.target)&&i(!1)};return s&&document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[s]),n("div",{className:"relative inline-block",ref:g,children:[r("button",{type:"button",onClick:N,className:C("p-0.5 rounded hover:bg-gray-200 dark:hover:bg-gray-600 cursor-pointer",o&&"text-synertech-primary-600 dark:text-synertech-primary-400"),"aria-label":b(e.dataGridFilterColumn,{column:c}),"data-grid-filter":a.key,children:r(w,{})}),s&&r("div",{className:"absolute z-50 top-full left-0 mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg p-3 min-w-[220px]",children:l==="select"&&a.filterOptions?n("div",{className:"flex flex-col gap-1.5",children:[a.filterOptions.map(t=>n("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[r("input",{type:"radio",name:`filter-${a.key}`,value:t,checked:u===t,onChange:()=>p(t),className:"cursor-pointer"}),r("span",{className:"text-gray-700 dark:text-gray-300",children:t})]},t)),n("div",{className:"flex gap-2 mt-2",children:[r("button",{type:"button",onClick:()=>{x({column:a.key,operator:"equals",value:u}),i(!1)},className:"px-2 py-1 text-xs bg-synertech-primary-600 text-synertech-on-primary rounded hover:bg-synertech-primary-700 cursor-pointer",children:e.dataGridFilterApply}),r("button",{type:"button",onClick:()=>{p(""),f(),i(!1)},className:"px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 cursor-pointer",children:e.dataGridFilterClear})]})]}):n("div",{className:"flex flex-col gap-2",children:[r("select",{value:d,onChange:t=>k(t.target.value),className:"text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200",children:m.map(t=>r("option",{value:t.value,children:t.label},t.value))}),d!=="isEmpty"&&d!=="isNotEmpty"&&r("input",{type:l==="number"?"number":l==="date"?"date":"text",value:u,onChange:t=>p(t.target.value),placeholder:e.dataGridFilterValuePlaceholder,className:"text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200",autoFocus:!0,"aria-label":b(e.dataGridFilterValue,{column:c})}),d==="between"&&r("input",{type:l==="date"?"date":"number",value:O,onChange:t=>G(t.target.value),placeholder:e.dataGridFilterValuePlaceholder,className:"text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200","aria-label":b(e.dataGridFilterValueTo,{column:c})}),n("div",{className:"flex gap-2",children:[r("button",{type:"button",onClick:()=>{x({column:a.key,operator:d,value:u,...d==="between"?{valueTo:O}:{}}),i(!1)},className:"px-2 py-1 text-xs bg-synertech-primary-600 text-synertech-on-primary rounded hover:bg-synertech-primary-700 cursor-pointer",children:e.dataGridFilterApply}),r("button",{type:"button",onClick:()=>{p(""),f(),i(!1)},className:"px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 cursor-pointer",children:e.dataGridFilterClear})]})]})})]})}export{A as FilterPopover};
@@ -0,0 +1 @@
1
+ "use strict";var m=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var d=(t,e)=>{for(var r in e)m(t,r,{get:e[r],enumerable:!0})},f=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of x(e))!y.call(t,n)&&n!==r&&m(t,n,{get:()=>e[n],enumerable:!(i=u(e,n))||i.enumerable});return t};var b=t=>f(m({},"__esModule",{value:!0}),t);var j={};d(j,{buildGridExport:()=>g,downloadGridExport:()=>v});module.exports=b(j);var l=require("../../lib/csv.cjs"),p=require("./utils.cjs");function g(t,e,r,i){let n=t.filter(o=>o.type!=="actions"&&o.type!=="selection"&&o.type!=="expand");if(r==="csv")return{content:(0,l.csvDocument)([n.map(o=>(0,p.columnLabel)(o)),...e.map(o=>n.map(s=>{let c=(0,p.getCellValue)(o,s.key);return typeof c=="number"?c:String(c??"")}))],{neutralizeFormulas:i}),mimeType:"text/csv",extension:"csv"};let a=e.map(o=>{let s={};for(let c of n)s[c.key]=(0,p.getCellValue)(o,c.key);return s});return{content:JSON.stringify(a,null,2),mimeType:"application/json",extension:"json"}}function v(t,e){let r=new Blob([t.content],{type:t.mimeType}),i=URL.createObjectURL(r),n=document.createElement("a");n.href=i,n.download=`${e}.${t.extension}`,n.click(),URL.revokeObjectURL(i)}0&&(module.exports={buildGridExport,downloadGridExport});
@@ -0,0 +1 @@
1
+ import{csvDocument as l}from"../../lib/csv.js";import{columnLabel as a,getCellValue as s}from"./utils.js";function y(o,r,p,i){let t=o.filter(e=>e.type!=="actions"&&e.type!=="selection"&&e.type!=="expand");if(p==="csv")return{content:l([t.map(e=>a(e)),...r.map(e=>t.map(c=>{let n=s(e,c.key);return typeof n=="number"?n:String(n??"")}))],{neutralizeFormulas:i}),mimeType:"text/csv",extension:"csv"};let m=r.map(e=>{let c={};for(let n of t)c[n.key]=s(e,n.key);return c});return{content:JSON.stringify(m,null,2),mimeType:"application/json",extension:"json"}}function d(o,r){let p=new Blob([o.content],{type:o.mimeType}),i=URL.createObjectURL(p),t=document.createElement("a");t.href=i,t.download=`${r}.${o.extension}`,t.click(),URL.revokeObjectURL(i)}export{y as buildGridExport,d as downloadGridExport};
@@ -0,0 +1 @@
1
+ "use strict";var t=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var h=(l,e)=>{for(var r in e)t(l,r,{get:e[r],enumerable:!0})},d=(l,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of n(e))!i.call(l,a)&&a!==r&&t(l,a,{get:()=>e[a],enumerable:!(s=c(e,a))||s.enumerable});return l};var p=l=>d(t({},"__esModule",{value:!0}),l);var B={};h(B,{ChevronDownIcon:()=>w,ColumnsIcon:()=>C,EmptyTrayIcon:()=>N,ExportIcon:()=>f,FilterIcon:()=>M,GripIcon:()=>m,SearchIcon:()=>z,SortAscIcon:()=>g,SortDescIcon:()=>x,SortNeutralIcon:()=>u});module.exports=p(B);var v=require("../../lib/cn.cjs"),o=require("react/jsx-runtime"),g=()=>(0,o.jsx)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:(0,o.jsx)("path",{d:"M8 3l4 5H4l4-5z"})}),x=()=>(0,o.jsx)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:(0,o.jsx)("path",{d:"M8 13l4-5H4l4 5z"})}),u=()=>(0,o.jsx)("svg",{className:"w-3.5 h-3.5 opacity-30",viewBox:"0 0 16 16",fill:"currentColor",children:(0,o.jsx)("path",{d:"M8 3l3 4H5l3-4zM8 13l3-4H5l3 4z"})}),w=({className:l})=>(0,o.jsx)("svg",{className:(0,v.cn)("w-4 h-4",l),viewBox:"0 0 20 20",fill:"currentColor",children:(0,o.jsx)("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})}),z=()=>(0,o.jsx)("svg",{className:"w-4 h-4 text-gray-500 dark:text-gray-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,o.jsx)("path",{fillRule:"evenodd",d:"M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z",clipRule:"evenodd"})}),m=()=>(0,o.jsx)("svg",{className:"w-4 h-4 text-gray-500 dark:text-gray-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,o.jsx)("path",{d:"M7 4a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3zM7 10.5a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3zM7 17a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3z"})}),M=()=>(0,o.jsx)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,o.jsx)("path",{fillRule:"evenodd",d:"M2.628 1.601C5.028 1.206 7.49 1 10 1s4.973.206 7.372.601a.75.75 0 01.628.74v2.288a2.25 2.25 0 01-.659 1.59l-4.682 4.683a2.25 2.25 0 00-.659 1.59v3.037c0 .684-.31 1.33-.844 1.757l-1.937 1.55A.75.75 0 018 18.25v-5.757a2.25 2.25 0 00-.659-1.591L2.659 6.22A2.25 2.25 0 012 4.629V2.34a.75.75 0 01.628-.74z",clipRule:"evenodd"})}),f=()=>(0,o.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:[(0,o.jsx)("path",{d:"M10.75 2.75a.75.75 0 00-1.5 0v8.614L6.295 8.235a.75.75 0 10-1.09 1.03l4.25 4.5a.75.75 0 001.09 0l4.25-4.5a.75.75 0 00-1.09-1.03l-2.955 3.129V2.75z"}),(0,o.jsx)("path",{d:"M3.5 12.75a.75.75 0 00-1.5 0v2.5A2.75 2.75 0 004.75 18h10.5A2.75 2.75 0 0018 15.25v-2.5a.75.75 0 00-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5z"})]}),C=()=>(0,o.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,o.jsx)("path",{fillRule:"evenodd",d:"M2.5 3A1.5 1.5 0 001 4.5v11A1.5 1.5 0 002.5 17h15a1.5 1.5 0 001.5-1.5v-11A1.5 1.5 0 0017.5 3h-15zM2.5 4.5h6v11h-6v-11zm7.5 0h7.5v11H10v-11z",clipRule:"evenodd"})}),N=(0,o.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[(0,o.jsx)("path",{strokeLinejoin:"round",d:"M2.5 11.5 4.5 4h11l2 7.5V16h-15z"}),(0,o.jsx)("path",{strokeLinejoin:"round",d:"M2.5 11.5h4l1.25 2h4.5l1.25-2h4"})]});0&&(module.exports={ChevronDownIcon,ColumnsIcon,EmptyTrayIcon,ExportIcon,FilterIcon,GripIcon,SearchIcon,SortAscIcon,SortDescIcon,SortNeutralIcon});
@@ -0,0 +1 @@
1
+ import{cn as a}from"../../lib/cn.js";import{jsx as o,jsxs as l}from"react/jsx-runtime";var t=()=>o("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:o("path",{d:"M8 3l4 5H4l4-5z"})}),s=()=>o("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:o("path",{d:"M8 13l4-5H4l4 5z"})}),v=()=>o("svg",{className:"w-3.5 h-3.5 opacity-30",viewBox:"0 0 16 16",fill:"currentColor",children:o("path",{d:"M8 3l3 4H5l3-4zM8 13l3-4H5l3 4z"})}),c=({className:e})=>o("svg",{className:a("w-4 h-4",e),viewBox:"0 0 20 20",fill:"currentColor",children:o("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})}),n=()=>o("svg",{className:"w-4 h-4 text-gray-500 dark:text-gray-400",viewBox:"0 0 20 20",fill:"currentColor",children:o("path",{fillRule:"evenodd",d:"M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z",clipRule:"evenodd"})}),i=()=>o("svg",{className:"w-4 h-4 text-gray-500 dark:text-gray-400",viewBox:"0 0 20 20",fill:"currentColor",children:o("path",{d:"M7 4a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3zM7 10.5a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3zM7 17a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3z"})}),h=()=>o("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 20 20",fill:"currentColor",children:o("path",{fillRule:"evenodd",d:"M2.628 1.601C5.028 1.206 7.49 1 10 1s4.973.206 7.372.601a.75.75 0 01.628.74v2.288a2.25 2.25 0 01-.659 1.59l-4.682 4.683a2.25 2.25 0 00-.659 1.59v3.037c0 .684-.31 1.33-.844 1.757l-1.937 1.55A.75.75 0 018 18.25v-5.757a2.25 2.25 0 00-.659-1.591L2.659 6.22A2.25 2.25 0 012 4.629V2.34a.75.75 0 01.628-.74z",clipRule:"evenodd"})}),d=()=>l("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:[o("path",{d:"M10.75 2.75a.75.75 0 00-1.5 0v8.614L6.295 8.235a.75.75 0 10-1.09 1.03l4.25 4.5a.75.75 0 001.09 0l4.25-4.5a.75.75 0 00-1.09-1.03l-2.955 3.129V2.75z"}),o("path",{d:"M3.5 12.75a.75.75 0 00-1.5 0v2.5A2.75 2.75 0 004.75 18h10.5A2.75 2.75 0 0018 15.25v-2.5a.75.75 0 00-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5z"})]}),p=()=>o("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:o("path",{fillRule:"evenodd",d:"M2.5 3A1.5 1.5 0 001 4.5v11A1.5 1.5 0 002.5 17h15a1.5 1.5 0 001.5-1.5v-11A1.5 1.5 0 0017.5 3h-15zM2.5 4.5h6v11h-6v-11zm7.5 0h7.5v11H10v-11z",clipRule:"evenodd"})}),g=l("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[o("path",{strokeLinejoin:"round",d:"M2.5 11.5 4.5 4h11l2 7.5V16h-15z"}),o("path",{strokeLinejoin:"round",d:"M2.5 11.5h4l1.25 2h4.5l1.25-2h4"})]});export{c as ChevronDownIcon,p as ColumnsIcon,g as EmptyTrayIcon,d as ExportIcon,h as FilterIcon,i as GripIcon,n as SearchIcon,t as SortAscIcon,s as SortDescIcon,v as SortNeutralIcon};
@@ -1 +1 @@
1
- "use strict";var i=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var p=(e,t)=>{for(var a in t)i(e,a,{get:t[a],enumerable:!0})},f=(e,t,a,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of d(t))!l.call(e,r)&&r!==a&&i(e,r,{get:()=>t[r],enumerable:!(o=D(t,r))||o.enumerable});return e};var g=e=>f(i({},"__esModule",{value:!0}),e);var G={};p(G,{DataGrid:()=>n.DataGrid});module.exports=g(G);var n=require("./DataGrid.cjs");0&&(module.exports={DataGrid});
1
+ "use strict";var a=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var p=(e,t)=>{for(var i in t)a(e,i,{get:t[i],enumerable:!0})},G=(e,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of d(t))!l.call(e,r)&&r!==i&&a(e,r,{get:()=>t[r],enumerable:!(o=D(t,r))||o.enumerable});return e};var f=e=>G(a({},"__esModule",{value:!0}),e);var g={};p(g,{DataGrid:()=>n.DataGrid});module.exports=f(g);var n=require("./DataGrid.cjs");0&&(module.exports={DataGrid});
@@ -0,0 +1 @@
1
+ "use strict";var n=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var d=(o,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of l(e))!s.call(o,t)&&t!==i&&n(o,t,{get:()=>e[t],enumerable:!(r=a(e,t))||r.enumerable});return o};var g=o=>d(n({},"__esModule",{value:!0}),o);var u={};module.exports=g(u);
File without changes
@@ -0,0 +1 @@
1
+ "use strict";var g=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var D=(t,e)=>{for(var n in e)g(t,n,{get:e[n],enumerable:!0})},I=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of F(e))!N.call(t,o)&&o!==n&&g(t,o,{get:()=>e[o],enumerable:!(a=E(e,o))||a.enumerable});return t};var R=t=>I(g({},"__esModule",{value:!0}),t);var z={};D(z,{columnLabel:()=>C,computeAggregate:()=>B,dayOf:()=>x,defaultComparator:()=>M,densityPadding:()=>S,densityText:()=>W,describeFilter:()=>U,filterConstrains:()=>P,formatAggregate:()=>j,getCellValue:()=>w,getRowKey:()=>v,groupKeyOf:()=>q,isEmptyCell:()=>l,matchesFilter:()=>K,numberOf:()=>h,pageSizeChoices:()=>_,resetRowKeyWarning:()=>L,sanitizePageSize:()=>Y,virtualPadding:()=>A,warnMissingRowKey:()=>O,warnStickyWidth:()=>V});module.exports=R(z);var T=require("../chart/utils/timestamp.cjs"),s=require("../../lib/ui-labels.cjs"),S={compact:"px-3 py-1.5",default:"px-4 py-3",comfortable:"px-6 py-4"},A={compact:"px-3 py-0",default:"px-4 py-0",comfortable:"px-6 py-0"},W={compact:"text-xs",default:"text-sm",comfortable:"text-base"};function v(t,e,n){return typeof n=="function"?n(t,e):String(typeof n=="string"?t[n]:e)}var y=!1;function L(){y=!1}function O(){y||(y=!0,console.warn("[@synertech/ui] DataGrid has no `rowKey`: each row is known by its position in `data`. Selection, expansion and edits follow that position when `data` is refetched or reordered, and from one page to the next in server mode. Pass `rowKey` to tie them to the row."))}var k=!1;function V(){k||(k=!0,console.warn("[@synertech/ui] DataGrid has a sticky column after another one with no `width` on the same side: it cannot know where the first one ends, and the two overlap. Give every sticky column but the last a `width`."))}function w(t,e){return t[e]}function q(t,e){return e.map(n=>String(w(t,n)??"")).join(" / ")}function C(t){let{header:e}=t;return typeof e=="string"||typeof e=="number"?String(e):t.key}function l(t){return t==null||typeof t=="string"&&t.trim()===""||typeof t=="number"&&Number.isNaN(t)||t instanceof Date&&Number.isNaN(t.getTime())}function M(t,e,n){let a=l(t),o=l(e);return a||o?a===o?0:a?-1:1:t instanceof Date&&e instanceof Date?t.getTime()-e.getTime():typeof t=="number"&&typeof e=="number"?t-e:n.compare(String(t),String(e))}function x(t){let e=(0,T.toTimestamp)(t);if(e===null)return null;let n=new Date(e);return new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime()}function h(t){if(l(t))return null;let e=typeof t=="number"?t:Number(t);return Number.isFinite(e)?e:null}var G=new Set(["gt","gte","lt","lte","between"]);function K(t,e,n="text"){if(e.operator==="isEmpty")return l(t);if(e.operator==="isNotEmpty")return!l(t);let a=G.has(e.operator);if(n==="number"||n==="date"||a){let d=n==="date"?x:h,r=d(t),u=e.value.trim()===""?null:d(e.value),m=e.valueTo===void 0||e.valueTo.trim()===""?null:d(e.valueTo);if(r===null)return!1;switch(e.operator){case"equals":return u===null||r===u;case"gt":return u===null||r>u;case"gte":return u===null||r>=u;case"lt":return u===null||r<u;case"lte":return u===null||r<=u;case"between":return(u===null||r>=u)&&(m===null||r<=m);default:return!0}}let o=String(t??"").toLowerCase(),c=e.value.toLowerCase();switch(e.operator){case"contains":return o.includes(c);case"equals":return o===c;case"startsWith":return o.startsWith(c);case"endsWith":return o.endsWith(c);default:return!0}}function P(t){return t.operator==="isEmpty"||t.operator==="isNotEmpty"||t.value.trim()!==""?!0:t.operator==="between"&&(t.valueTo??"").trim()!==""}function U(t,e,n,a){let o=e?.filterType??"text",c=o==="number"||o!=="date"&&G.has(t.operator),d=b=>{let p=(b??"").trim();if(p==="")return"";if(o==="date"){let f=x(p);return f===null?p:a.date.format(f)}if(c){let f=h(p);return f===null?p:a.number.format(f)}return b??""},r=d(t.value),u=d(t.valueTo),m=o==="date",i;switch(t.operator){case"isEmpty":i=n.dataGridConditionIsEmpty;break;case"isNotEmpty":i=n.dataGridConditionIsNotEmpty;break;case"contains":i=(0,s.formatUILabel)(n.dataGridConditionContains,{value:r});break;case"startsWith":i=(0,s.formatUILabel)(n.dataGridConditionStartsWith,{value:r});break;case"endsWith":i=(0,s.formatUILabel)(n.dataGridConditionEndsWith,{value:r});break;case"gt":i=(0,s.formatUILabel)(m?n.dataGridConditionAfter:n.dataGridConditionGreaterThan,{value:r});break;case"gte":i=(0,s.formatUILabel)(n.dataGridConditionGreaterOrEqual,{value:r});break;case"lt":i=(0,s.formatUILabel)(m?n.dataGridConditionBefore:n.dataGridConditionLessThan,{value:r});break;case"lte":i=(0,s.formatUILabel)(n.dataGridConditionLessOrEqual,{value:r});break;case"between":i=r&&u?(0,s.formatUILabel)(n.dataGridConditionBetween,{from:r,to:u}):r?(0,s.formatUILabel)(n.dataGridConditionGreaterOrEqual,{value:r}):(0,s.formatUILabel)(n.dataGridConditionLessOrEqual,{value:u});break;default:i=r}return(0,s.formatUILabel)(n.dataGridActiveFilter,{column:e?C(e):t.column,condition:i})}function B(t,e,n){let a=0,o=0,c=0,d=1/0,r=-1/0;for(let u of t){let m=w(u,e);if(l(m))continue;a++;let i=Number(m);Number.isNaN(i)||(o++,c+=i,i<d&&(d=i),i>r&&(r=i))}switch(n){case"count":return a;case"sum":return c;case"avg":return o===0?null:c/o;case"min":return o===0?null:d;case"max":return o===0?null:r}}function j(t,e,n){if(t==="count")return e;let a=t==="avg"?n.dataGridAggregateAvg:t==="sum"?n.dataGridAggregateSum:t==="min"?n.dataGridAggregateMin:n.dataGridAggregateMax;return(0,s.formatUILabel)(a,{value:e})}function Y(t,e){return t!==void 0&&Number.isFinite(t)&&t>=1?Math.floor(t):e}function _(t,e){return t.includes(e)?t:[...t,e].sort((n,a)=>n-a)}0&&(module.exports={columnLabel,computeAggregate,dayOf,defaultComparator,densityPadding,densityText,describeFilter,filterConstrains,formatAggregate,getCellValue,getRowKey,groupKeyOf,isEmptyCell,matchesFilter,numberOf,pageSizeChoices,resetRowKeyWarning,sanitizePageSize,virtualPadding,warnMissingRowKey,warnStickyWidth});
@@ -0,0 +1 @@
1
+ import{toTimestamp as T}from"../chart/utils/timestamp.js";import{formatUILabel as s}from"../../lib/ui-labels.js";var F={compact:"px-3 py-1.5",default:"px-4 py-3",comfortable:"px-6 py-4"},N={compact:"px-3 py-0",default:"px-4 py-0",comfortable:"px-6 py-0"},D={compact:"text-xs",default:"text-sm",comfortable:"text-base"};function I(t,e,n){return typeof n=="function"?n(t,e):String(typeof n=="string"?t[n]:e)}var g=!1;function R(){g=!1}function S(){g||(g=!0,console.warn("[@synertech/ui] DataGrid has no `rowKey`: each row is known by its position in `data`. Selection, expansion and edits follow that position when `data` is refetched or reordered, and from one page to the next in server mode. Pass `rowKey` to tie them to the row."))}var w=!1;function A(){w||(w=!0,console.warn("[@synertech/ui] DataGrid has a sticky column after another one with no `width` on the same side: it cannot know where the first one ends, and the two overlap. Give every sticky column but the last a `width`."))}function x(t,e){return t[e]}function W(t,e){return e.map(n=>String(x(t,n)??"")).join(" / ")}function C(t){let{header:e}=t;return typeof e=="string"||typeof e=="number"?String(e):t.key}function l(t){return t==null||typeof t=="string"&&t.trim()===""||typeof t=="number"&&Number.isNaN(t)||t instanceof Date&&Number.isNaN(t.getTime())}function v(t,e,n){let u=l(t),i=l(e);return u||i?u===i?0:u?-1:1:t instanceof Date&&e instanceof Date?t.getTime()-e.getTime():typeof t=="number"&&typeof e=="number"?t-e:n.compare(String(t),String(e))}function h(t){let e=T(t);if(e===null)return null;let n=new Date(e);return new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime()}function b(t){if(l(t))return null;let e=typeof t=="number"?t:Number(t);return Number.isFinite(e)?e:null}var k=new Set(["gt","gte","lt","lte","between"]);function L(t,e,n="text"){if(e.operator==="isEmpty")return l(t);if(e.operator==="isNotEmpty")return!l(t);let u=k.has(e.operator);if(n==="number"||n==="date"||u){let d=n==="date"?h:b,r=d(t),a=e.value.trim()===""?null:d(e.value),m=e.valueTo===void 0||e.valueTo.trim()===""?null:d(e.valueTo);if(r===null)return!1;switch(e.operator){case"equals":return a===null||r===a;case"gt":return a===null||r>a;case"gte":return a===null||r>=a;case"lt":return a===null||r<a;case"lte":return a===null||r<=a;case"between":return(a===null||r>=a)&&(m===null||r<=m);default:return!0}}let i=String(t??"").toLowerCase(),c=e.value.toLowerCase();switch(e.operator){case"contains":return i.includes(c);case"equals":return i===c;case"startsWith":return i.startsWith(c);case"endsWith":return i.endsWith(c);default:return!0}}function O(t){return t.operator==="isEmpty"||t.operator==="isNotEmpty"||t.value.trim()!==""?!0:t.operator==="between"&&(t.valueTo??"").trim()!==""}function V(t,e,n,u){let i=e?.filterType??"text",c=i==="number"||i!=="date"&&k.has(t.operator),d=y=>{let p=(y??"").trim();if(p==="")return"";if(i==="date"){let f=h(p);return f===null?p:u.date.format(f)}if(c){let f=b(p);return f===null?p:u.number.format(f)}return y??""},r=d(t.value),a=d(t.valueTo),m=i==="date",o;switch(t.operator){case"isEmpty":o=n.dataGridConditionIsEmpty;break;case"isNotEmpty":o=n.dataGridConditionIsNotEmpty;break;case"contains":o=s(n.dataGridConditionContains,{value:r});break;case"startsWith":o=s(n.dataGridConditionStartsWith,{value:r});break;case"endsWith":o=s(n.dataGridConditionEndsWith,{value:r});break;case"gt":o=s(m?n.dataGridConditionAfter:n.dataGridConditionGreaterThan,{value:r});break;case"gte":o=s(n.dataGridConditionGreaterOrEqual,{value:r});break;case"lt":o=s(m?n.dataGridConditionBefore:n.dataGridConditionLessThan,{value:r});break;case"lte":o=s(n.dataGridConditionLessOrEqual,{value:r});break;case"between":o=r&&a?s(n.dataGridConditionBetween,{from:r,to:a}):r?s(n.dataGridConditionGreaterOrEqual,{value:r}):s(n.dataGridConditionLessOrEqual,{value:a});break;default:o=r}return s(n.dataGridActiveFilter,{column:e?C(e):t.column,condition:o})}function q(t,e,n){let u=0,i=0,c=0,d=1/0,r=-1/0;for(let a of t){let m=x(a,e);if(l(m))continue;u++;let o=Number(m);Number.isNaN(o)||(i++,c+=o,o<d&&(d=o),o>r&&(r=o))}switch(n){case"count":return u;case"sum":return c;case"avg":return i===0?null:c/i;case"min":return i===0?null:d;case"max":return i===0?null:r}}function M(t,e,n){if(t==="count")return e;let u=t==="avg"?n.dataGridAggregateAvg:t==="sum"?n.dataGridAggregateSum:t==="min"?n.dataGridAggregateMin:n.dataGridAggregateMax;return s(u,{value:e})}function K(t,e){return t!==void 0&&Number.isFinite(t)&&t>=1?Math.floor(t):e}function P(t,e){return t.includes(e)?t:[...t,e].sort((n,u)=>n-u)}export{C as columnLabel,q as computeAggregate,h as dayOf,v as defaultComparator,F as densityPadding,D as densityText,V as describeFilter,O as filterConstrains,M as formatAggregate,x as getCellValue,I as getRowKey,W as groupKeyOf,l as isEmptyCell,L as matchesFilter,b as numberOf,P as pageSizeChoices,R as resetRowKeyWarning,K as sanitizePageSize,N as virtualPadding,S as warnMissingRowKey,A as warnStickyWidth};
@@ -1 +1 @@
1
- "use strict";"use client";var D=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var ee=(u,s)=>{for(var p in s)D(u,p,{get:s[p],enumerable:!0})},ne=(u,s,p,h)=>{if(s&&typeof s=="object"||typeof s=="function")for(let f of Z(s))!j.call(u,f)&&f!==p&&D(u,f,{get:()=>s[f],enumerable:!(h=Y(s,f))||h.enumerable});return u};var te=u=>ne(D({},"__esModule",{value:!0}),u);var oe={};ee(oe,{DropdownContent:()=>z});module.exports=te(oe);var a=require("react"),S=require("react-dom"),T=require("./Dropdown.cjs"),W=require("./hooks/useClickOutside.cjs"),O=require("./hooks/useLatest.cjs"),M=require("./hooks/usePositioning.cjs"),t=require("./menu-navigation.cjs"),B=require("../../lib/aria-hide.cjs"),I=require("../../lib/owner-document.cjs"),H=require("../../lib/cn.cjs"),d=require("react/jsx-runtime"),re={fade:"animate-in fade-in-0 duration-200",scale:"animate-in fade-in-0 zoom-in-95 duration-200",slide:"animate-in fade-in-0 slide-in-from-top-2 duration-200",none:""};function z({side:u="bottom",align:s="start",sideOffset:p=4,alignOffset:h=0,avoidCollisions:f=!0,collisionPadding:q=8,minWidth:K,maxWidth:U,maxHeight:w=300,animation:_="scale",portal:$=!0,children:G,className:J}){let{isOpen:n,setIsOpen:E,triggerRef:o,contentRef:i,closeOnClickOutside:Q,closeOnEscape:V,modal:X,contentId:c}=(0,T.useDropdownContext)(),[y,R]=(0,a.useState)(!1),l=(0,M.usePositioning)({triggerRef:o,contentRef:i,isOpen:n,side:u,align:s,sideOffset:p,alignOffset:h,avoidCollisions:f,collisionPadding:q});(0,W.useClickOutside)(i,()=>{Q&&E(!1)},n,{isInside:e=>!!o.current?.contains(e)||e instanceof Element&&e.closest((0,t.ownedBy)(c))!==null});let v=(0,O.useLatest)(E),N=(0,O.useLatest)(V);(0,a.useEffect)(()=>{if(!n)return;let e=r=>{if(r.defaultPrevented)return;let m=i.current;if(!m)return;let b=m.ownerDocument,k=b.activeElement,x=(0,t.hasFocusWithin)(c,b)||!!o.current?.contains(k);if(r.key==="Escape"){if(!N.current)return;r.preventDefault(),v.current(!1),o.current?.focus();return}if(r.key==="Tab"){v.current(!1),x&&o.current?.focus();return}if(!x&&k!==null&&k!==b.body)return;let L=(0,t.getActiveMenu)(c,b)??m,P=(0,t.isTyping)(r.target);if(!((r.key==="Home"||r.key==="End")&&P)){if((0,t.moveFocus)(L,r.key)){r.preventDefault();return}if(r.key==="Enter"||r.key===" "){if(P)return;let C=k;if(!C||!(0,t.getMenuItems)(L).includes(C))return;r.preventDefault(),C.click()}}},g=(0,I.ownerDocumentOf)(o.current);return g.addEventListener("keydown",e),()=>g.removeEventListener("keydown",e)},[n,c,i,o,v,N]),(0,a.useEffect)(()=>{let e=i.current;if(e)return(0,B.registerFloatingLayer)(e,()=>o.current)},[i,o]),(0,a.useEffect)(()=>{if(!n||!y)return;let e=i.current;if(e)return(0,t.focusFirstItem)(e,()=>!(0,t.hasFocusWithin)(c,e.ownerDocument))},[n,y,c,i]);let A=(0,a.useRef)(n);(0,a.useLayoutEffect)(()=>{if(A.current&&!n){let e=i.current?.ownerDocument;e&&(0,t.hasFocusWithin)(c,e)&&o.current?.focus({preventScroll:!0})}A.current=n},[n,c,i,o]),(0,a.useLayoutEffect)(()=>{let e=0;if(!n){R(!1);return}let g=()=>{let r=o.current?.getBoundingClientRect(),m=i.current?.getBoundingClientRect();if(l.isReady&&!!r&&!!m&&r.width>0&&r.height>0&&m.width>0&&m.height>0){R(!0);return}e=requestAnimationFrame(g)};return R(!1),e=requestAnimationFrame(g),()=>{e&&cancelAnimationFrame(e)}},[n,l.isReady,o,i]);let F=(0,d.jsxs)(d.Fragment,{children:[X&&n&&(0,d.jsx)("div",{className:"fixed inset-0 z-[59] bg-black/20",onClick:()=>E(!1)}),(0,d.jsx)("div",{ref:i,id:c,role:"menu","aria-orientation":"vertical","aria-hidden":!n,tabIndex:-1,[t.MENU_OWNER_ATTRIBUTE]:c,style:{position:"fixed",top:l.top,left:l.left,minWidth:K??o.current?.offsetWidth,maxWidth:U,maxHeight:l.availableHeight===void 0?w:typeof w=="number"?Math.min(w,l.availableHeight):`min(${w}, ${l.availableHeight}px)`,visibility:n&&y?"visible":"hidden",opacity:n&&y?1:0,pointerEvents:n&&y?"auto":"none"},className:(0,H.cn)("z-[60] overflow-auto rounded-lg outline-none","border border-gray-200 bg-white shadow-lg","dark:border-gray-700 dark:bg-gray-800",n&&y&&re[_],J),children:(0,d.jsx)("div",{className:"py-1",children:G})})]});return $&&typeof document<"u"?(0,S.createPortal)(F,(0,I.ownerDocumentOf)(o.current).body):F}z.displayName="DropdownContent";0&&(module.exports={DropdownContent});
1
+ "use strict";"use client";var D=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var ee=(u,s)=>{for(var p in s)D(u,p,{get:s[p],enumerable:!0})},ne=(u,s,p,h)=>{if(s&&typeof s=="object"||typeof s=="function")for(let d of Z(s))!j.call(u,d)&&d!==p&&D(u,d,{get:()=>s[d],enumerable:!(h=Y(s,d))||h.enumerable});return u};var te=u=>ne(D({},"__esModule",{value:!0}),u);var oe={};ee(oe,{DropdownContent:()=>z});module.exports=te(oe);var a=require("react"),S=require("react-dom"),T=require("./Dropdown.cjs"),W=require("./hooks/useClickOutside.cjs"),O=require("./hooks/useLatest.cjs"),M=require("./hooks/usePositioning.cjs"),t=require("./menu-navigation.cjs"),B=require("../../lib/aria-hide.cjs"),I=require("../../lib/owner-document.cjs"),H=require("../../lib/cn.cjs"),f=require("react/jsx-runtime"),re={fade:"animate-in fade-in-0",scale:"animate-in fade-in-0 zoom-in-95",slide:"animate-in fade-in-0 slide-in-from-top-2",none:""};function z({side:u="bottom",align:s="start",sideOffset:p=4,alignOffset:h=0,avoidCollisions:d=!0,collisionPadding:q=8,minWidth:K,maxWidth:U,maxHeight:w=300,animation:_="scale",portal:$=!0,children:G,className:J}){let{isOpen:n,setIsOpen:E,triggerRef:o,contentRef:i,closeOnClickOutside:Q,closeOnEscape:V,modal:X,contentId:c}=(0,T.useDropdownContext)(),[y,R]=(0,a.useState)(!1),l=(0,M.usePositioning)({triggerRef:o,contentRef:i,isOpen:n,side:u,align:s,sideOffset:p,alignOffset:h,avoidCollisions:d,collisionPadding:q});(0,W.useClickOutside)(i,()=>{Q&&E(!1)},n,{isInside:e=>!!o.current?.contains(e)||e instanceof Element&&e.closest((0,t.ownedBy)(c))!==null});let v=(0,O.useLatest)(E),N=(0,O.useLatest)(V);(0,a.useEffect)(()=>{if(!n)return;let e=r=>{if(r.defaultPrevented)return;let m=i.current;if(!m)return;let b=m.ownerDocument,k=b.activeElement,x=(0,t.hasFocusWithin)(c,b)||!!o.current?.contains(k);if(r.key==="Escape"){if(!N.current)return;r.preventDefault(),v.current(!1),o.current?.focus();return}if(r.key==="Tab"){v.current(!1),x&&o.current?.focus();return}if(!x&&k!==null&&k!==b.body)return;let L=(0,t.getActiveMenu)(c,b)??m,P=(0,t.isTyping)(r.target);if(!((r.key==="Home"||r.key==="End")&&P)){if((0,t.moveFocus)(L,r.key)){r.preventDefault();return}if(r.key==="Enter"||r.key===" "){if(P)return;let C=k;if(!C||!(0,t.getMenuItems)(L).includes(C))return;r.preventDefault(),C.click()}}},g=(0,I.ownerDocumentOf)(o.current);return g.addEventListener("keydown",e),()=>g.removeEventListener("keydown",e)},[n,c,i,o,v,N]),(0,a.useEffect)(()=>{let e=i.current;if(e)return(0,B.registerFloatingLayer)(e,()=>o.current)},[i,o]),(0,a.useEffect)(()=>{if(!n||!y)return;let e=i.current;if(e)return(0,t.focusFirstItem)(e,()=>!(0,t.hasFocusWithin)(c,e.ownerDocument))},[n,y,c,i]);let A=(0,a.useRef)(n);(0,a.useLayoutEffect)(()=>{if(A.current&&!n){let e=i.current?.ownerDocument;e&&(0,t.hasFocusWithin)(c,e)&&o.current?.focus({preventScroll:!0})}A.current=n},[n,c,i,o]),(0,a.useLayoutEffect)(()=>{let e=0;if(!n){R(!1);return}let g=()=>{let r=o.current?.getBoundingClientRect(),m=i.current?.getBoundingClientRect();if(l.isReady&&!!r&&!!m&&r.width>0&&r.height>0&&m.width>0&&m.height>0){R(!0);return}e=requestAnimationFrame(g)};return R(!1),e=requestAnimationFrame(g),()=>{e&&cancelAnimationFrame(e)}},[n,l.isReady,o,i]);let F=(0,f.jsxs)(f.Fragment,{children:[X&&n&&(0,f.jsx)("div",{className:"fixed inset-0 z-[59] bg-black/20",onClick:()=>E(!1)}),(0,f.jsx)("div",{ref:i,id:c,role:"menu","aria-orientation":"vertical","aria-hidden":!n,tabIndex:-1,[t.MENU_OWNER_ATTRIBUTE]:c,style:{position:"fixed",top:l.top,left:l.left,minWidth:K??o.current?.offsetWidth,maxWidth:U,maxHeight:l.availableHeight===void 0?w:typeof w=="number"?Math.min(w,l.availableHeight):`min(${w}, ${l.availableHeight}px)`,visibility:n&&y?"visible":"hidden",opacity:n&&y?1:0,pointerEvents:n&&y?"auto":"none"},className:(0,H.cn)("z-[60] overflow-auto rounded-lg outline-none","border border-gray-200 bg-white shadow-lg","dark:border-gray-700 dark:bg-gray-800",n&&y&&re[_],J),children:(0,f.jsx)("div",{className:"py-1",children:G})})]});return $&&typeof document<"u"?(0,S.createPortal)(F,(0,I.ownerDocumentOf)(o.current).body):F}z.displayName="DropdownContent";0&&(module.exports={DropdownContent});
@@ -1 +1 @@
1
- "use client";import{useEffect as b,useLayoutEffect as O,useRef as _,useState as $}from"react";import{createPortal as G}from"react-dom";import{useDropdownContext as J}from"./Dropdown.js";import{useClickOutside as Q}from"./hooks/useClickOutside.js";import{useLatest as I}from"./hooks/useLatest.js";import{usePositioning as V}from"./hooks/usePositioning.js";import{MENU_OWNER_ATTRIBUTE as X,focusFirstItem as Y,getActiveMenu as Z,getMenuItems as j,hasFocusWithin as h,isTyping as ee,moveFocus as ne,ownedBy as te}from"./menu-navigation.js";import{registerFloatingLayer as re}from"../../lib/aria-hide.js";import{ownerDocumentOf as N}from"../../lib/owner-document.js";import{cn as oe}from"../../lib/cn.js";import{Fragment as ae,jsx as w,jsxs as ce}from"react/jsx-runtime";var ie={fade:"animate-in fade-in-0 duration-200",scale:"animate-in fade-in-0 zoom-in-95 duration-200",slide:"animate-in fade-in-0 slide-in-from-top-2 duration-200",none:""};function se({side:A="bottom",align:F="start",sideOffset:x=4,alignOffset:L=0,avoidCollisions:P=!0,collisionPadding:S=8,minWidth:T,maxWidth:W,maxHeight:f=300,animation:M="scale",portal:B=!0,children:H,className:z}){let{isOpen:n,setIsOpen:m,triggerRef:r,contentRef:o,closeOnClickOutside:q,closeOnEscape:K,modal:U,contentId:i}=J(),[c,p]=$(!1),s=V({triggerRef:r,contentRef:o,isOpen:n,side:A,align:F,sideOffset:x,alignOffset:L,avoidCollisions:P,collisionPadding:S});Q(o,()=>{q&&m(!1)},n,{isInside:e=>!!r.current?.contains(e)||e instanceof Element&&e.closest(te(i))!==null});let y=I(m),k=I(K);b(()=>{if(!n)return;let e=t=>{if(t.defaultPrevented)return;let a=o.current;if(!a)return;let d=a.ownerDocument,l=d.activeElement,v=h(i,d)||!!r.current?.contains(l);if(t.key==="Escape"){if(!k.current)return;t.preventDefault(),y.current(!1),r.current?.focus();return}if(t.key==="Tab"){y.current(!1),v&&r.current?.focus();return}if(!v&&l!==null&&l!==d.body)return;let C=Z(i,d)??a,D=ee(t.target);if(!((t.key==="Home"||t.key==="End")&&D)){if(ne(C,t.key)){t.preventDefault();return}if(t.key==="Enter"||t.key===" "){if(D)return;let g=l;if(!g||!j(C).includes(g))return;t.preventDefault(),g.click()}}},u=N(r.current);return u.addEventListener("keydown",e),()=>u.removeEventListener("keydown",e)},[n,i,o,r,y,k]),b(()=>{let e=o.current;if(e)return re(e,()=>r.current)},[o,r]),b(()=>{if(!n||!c)return;let e=o.current;if(e)return Y(e,()=>!h(i,e.ownerDocument))},[n,c,i,o]);let E=_(n);O(()=>{if(E.current&&!n){let e=o.current?.ownerDocument;e&&h(i,e)&&r.current?.focus({preventScroll:!0})}E.current=n},[n,i,o,r]),O(()=>{let e=0;if(!n){p(!1);return}let u=()=>{let t=r.current?.getBoundingClientRect(),a=o.current?.getBoundingClientRect();if(s.isReady&&!!t&&!!a&&t.width>0&&t.height>0&&a.width>0&&a.height>0){p(!0);return}e=requestAnimationFrame(u)};return p(!1),e=requestAnimationFrame(u),()=>{e&&cancelAnimationFrame(e)}},[n,s.isReady,r,o]);let R=ce(ae,{children:[U&&n&&w("div",{className:"fixed inset-0 z-[59] bg-black/20",onClick:()=>m(!1)}),w("div",{ref:o,id:i,role:"menu","aria-orientation":"vertical","aria-hidden":!n,tabIndex:-1,[X]:i,style:{position:"fixed",top:s.top,left:s.left,minWidth:T??r.current?.offsetWidth,maxWidth:W,maxHeight:s.availableHeight===void 0?f:typeof f=="number"?Math.min(f,s.availableHeight):`min(${f}, ${s.availableHeight}px)`,visibility:n&&c?"visible":"hidden",opacity:n&&c?1:0,pointerEvents:n&&c?"auto":"none"},className:oe("z-[60] overflow-auto rounded-lg outline-none","border border-gray-200 bg-white shadow-lg","dark:border-gray-700 dark:bg-gray-800",n&&c&&ie[M],z),children:w("div",{className:"py-1",children:H})})]});return B&&typeof document<"u"?G(R,N(r.current).body):R}se.displayName="DropdownContent";export{se as DropdownContent};
1
+ "use client";import{useEffect as b,useLayoutEffect as O,useRef as _,useState as $}from"react";import{createPortal as G}from"react-dom";import{useDropdownContext as J}from"./Dropdown.js";import{useClickOutside as Q}from"./hooks/useClickOutside.js";import{useLatest as I}from"./hooks/useLatest.js";import{usePositioning as V}from"./hooks/usePositioning.js";import{MENU_OWNER_ATTRIBUTE as X,focusFirstItem as Y,getActiveMenu as Z,getMenuItems as j,hasFocusWithin as h,isTyping as ee,moveFocus as ne,ownedBy as te}from"./menu-navigation.js";import{registerFloatingLayer as re}from"../../lib/aria-hide.js";import{ownerDocumentOf as N}from"../../lib/owner-document.js";import{cn as oe}from"../../lib/cn.js";import{Fragment as ae,jsx as w,jsxs as ce}from"react/jsx-runtime";var ie={fade:"animate-in fade-in-0",scale:"animate-in fade-in-0 zoom-in-95",slide:"animate-in fade-in-0 slide-in-from-top-2",none:""};function se({side:A="bottom",align:F="start",sideOffset:x=4,alignOffset:L=0,avoidCollisions:P=!0,collisionPadding:S=8,minWidth:T,maxWidth:W,maxHeight:d=300,animation:M="scale",portal:B=!0,children:H,className:z}){let{isOpen:n,setIsOpen:m,triggerRef:r,contentRef:o,closeOnClickOutside:q,closeOnEscape:K,modal:U,contentId:i}=J(),[c,p]=$(!1),s=V({triggerRef:r,contentRef:o,isOpen:n,side:A,align:F,sideOffset:x,alignOffset:L,avoidCollisions:P,collisionPadding:S});Q(o,()=>{q&&m(!1)},n,{isInside:e=>!!r.current?.contains(e)||e instanceof Element&&e.closest(te(i))!==null});let y=I(m),k=I(K);b(()=>{if(!n)return;let e=t=>{if(t.defaultPrevented)return;let a=o.current;if(!a)return;let f=a.ownerDocument,l=f.activeElement,v=h(i,f)||!!r.current?.contains(l);if(t.key==="Escape"){if(!k.current)return;t.preventDefault(),y.current(!1),r.current?.focus();return}if(t.key==="Tab"){y.current(!1),v&&r.current?.focus();return}if(!v&&l!==null&&l!==f.body)return;let C=Z(i,f)??a,D=ee(t.target);if(!((t.key==="Home"||t.key==="End")&&D)){if(ne(C,t.key)){t.preventDefault();return}if(t.key==="Enter"||t.key===" "){if(D)return;let g=l;if(!g||!j(C).includes(g))return;t.preventDefault(),g.click()}}},u=N(r.current);return u.addEventListener("keydown",e),()=>u.removeEventListener("keydown",e)},[n,i,o,r,y,k]),b(()=>{let e=o.current;if(e)return re(e,()=>r.current)},[o,r]),b(()=>{if(!n||!c)return;let e=o.current;if(e)return Y(e,()=>!h(i,e.ownerDocument))},[n,c,i,o]);let E=_(n);O(()=>{if(E.current&&!n){let e=o.current?.ownerDocument;e&&h(i,e)&&r.current?.focus({preventScroll:!0})}E.current=n},[n,i,o,r]),O(()=>{let e=0;if(!n){p(!1);return}let u=()=>{let t=r.current?.getBoundingClientRect(),a=o.current?.getBoundingClientRect();if(s.isReady&&!!t&&!!a&&t.width>0&&t.height>0&&a.width>0&&a.height>0){p(!0);return}e=requestAnimationFrame(u)};return p(!1),e=requestAnimationFrame(u),()=>{e&&cancelAnimationFrame(e)}},[n,s.isReady,r,o]);let R=ce(ae,{children:[U&&n&&w("div",{className:"fixed inset-0 z-[59] bg-black/20",onClick:()=>m(!1)}),w("div",{ref:o,id:i,role:"menu","aria-orientation":"vertical","aria-hidden":!n,tabIndex:-1,[X]:i,style:{position:"fixed",top:s.top,left:s.left,minWidth:T??r.current?.offsetWidth,maxWidth:W,maxHeight:s.availableHeight===void 0?d:typeof d=="number"?Math.min(d,s.availableHeight):`min(${d}, ${s.availableHeight}px)`,visibility:n&&c?"visible":"hidden",opacity:n&&c?1:0,pointerEvents:n&&c?"auto":"none"},className:oe("z-[60] overflow-auto rounded-lg outline-none","border border-gray-200 bg-white shadow-lg","dark:border-gray-700 dark:bg-gray-800",n&&c&&ie[M],z),children:w("div",{className:"py-1",children:H})})]});return B&&typeof document<"u"?G(R,N(r.current).body):R}se.displayName="DropdownContent";export{se as DropdownContent};
@@ -1 +1 @@
1
- "use strict";"use client";var M=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var K=(r,n)=>{for(var i in n)M(r,i,{get:n[i],enumerable:!0})},W=(r,n,i,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of B(n))!H.call(r,t)&&t!==i&&M(r,t,{get:()=>n[t],enumerable:!(l=q(n,t))||l.enumerable});return r};var j=r=>W(M({},"__esModule",{value:!0}),r);var _={};K(_,{DropdownSubMenu:()=>F,DropdownSubMenuContent:()=>P,DropdownSubMenuTrigger:()=>I});module.exports=j(_);var e=require("react"),S=require("react-dom"),R=require("./Dropdown.cjs"),k=require("./hooks/useClickOutside.cjs"),E=require("./hooks/usePositioning.cjs"),h=require("./menu-navigation.cjs"),N=require("../../lib/aria-hide.cjs"),O=require("../../lib/owner-document.cjs"),x=require("../../lib/cn.cjs"),d=require("react/jsx-runtime"),V=100,T=(0,e.createContext)(null);function L(){let r=(0,e.useContext)(T);if(!r)throw new Error("DropdownSubMenu components must be used within a DropdownSubMenu");return r}function F({children:r}){let{isOpen:n}=(0,R.useDropdownContext)(),[i,l]=(0,e.useState)(!1),t=(0,e.useRef)(null),p=(0,e.useRef)(null),u=(0,e.useRef)(null),s=(0,e.useRef)(!1),g=n&&i,o=(0,e.useCallback)(()=>{u.current!==null&&(clearTimeout(u.current),u.current=null)},[]),b=(0,e.useCallback)(()=>{o(),u.current=setTimeout(()=>{u.current=null,l(!1)},V)},[o]),f=(0,e.useCallback)(()=>{o(),s.current=!0,l(!0)},[o]),c=(0,e.useCallback)(()=>{let y=s.current;return s.current=!1,y},[]);(0,e.useEffect)(()=>{n||(o(),s.current=!1,l(!1))},[n,o]),(0,e.useEffect)(()=>o,[o]);let m=(0,e.useMemo)(()=>({isOpen:g,setIsOpen:l,triggerRef:t,contentRef:p,scheduleClose:b,cancelClose:o,openWithFocus:f,takeFocusRequest:c}),[g,b,o,f,c]);return(0,d.jsx)(T.Provider,{value:m,children:(0,d.jsx)("div",{className:"relative",children:r})})}F.displayName="DropdownSubMenu";function I({children:r,icon:n,disabled:i=!1,className:l}){let{isOpen:t,setIsOpen:p,triggerRef:u,scheduleClose:s,cancelClose:g,openWithFocus:o}=L();return(0,d.jsxs)("button",{ref:u,role:"menuitem",type:"button",tabIndex:-1,"aria-haspopup":"menu","aria-expanded":t,disabled:i,"data-disabled":i||void 0,onMouseEnter:c=>{i||(g(),c.currentTarget.focus({preventScroll:!0}),p(!0))},onMouseLeave:s,onClick:i?void 0:o,onKeyDown:c=>{i||(c.key==="ArrowRight"||c.key==="Enter"||c.key===" ")&&(c.preventDefault(),o())},className:(0,x.cn)("relative flex w-full items-center px-3 py-2 text-left text-sm","outline-none transition-colors","text-gray-700 dark:text-gray-200","hover:bg-gray-100 dark:hover:bg-gray-700","focus:bg-gray-100 dark:focus:bg-gray-700",i&&"opacity-50 cursor-not-allowed hover:bg-transparent",t&&"bg-gray-100 dark:bg-gray-700",l),children:[n&&(0,d.jsx)("span",{className:"mr-2 shrink-0 w-5 h-5",children:n}),(0,d.jsx)("span",{className:"flex-1",children:r}),(0,d.jsx)("svg",{className:"ml-auto w-4 h-4 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})}I.displayName="DropdownSubMenuTrigger";function P({children:r,sideOffset:n=0,className:i}){let{contentId:l}=(0,R.useDropdownContext)(),{isOpen:t,setIsOpen:p,triggerRef:u,contentRef:s,scheduleClose:g,cancelClose:o,takeFocusRequest:b}=L(),[f,c]=(0,e.useState)(!1),m=(0,E.usePositioning)({triggerRef:u,contentRef:s,isOpen:t,side:"right",align:"start",sideOffset:n,avoidCollisions:!0});(0,k.useClickOutside)(s,()=>p(!1),t,{isInside:a=>!!u.current?.contains(a)}),(0,e.useEffect)(()=>{let a=s.current;if(a)return(0,N.registerFloatingLayer)(a,()=>u.current)},[s,u]);let y=(0,e.useCallback)(()=>{o(),p(!0)},[o,p]),A=a=>{(a.key==="ArrowLeft"||a.key==="Escape")&&(a.preventDefault(),o(),p(!1),u.current?.focus())};(0,e.useEffect)(()=>{if(!t||!f||!b())return;let a=s.current;if(a)return(0,h.focusFirstItem)(a)},[t,f,s,b]),(0,e.useLayoutEffect)(()=>{let a=0;if(!t){c(!1);return}let D=()=>{let w=u.current?.getBoundingClientRect(),v=s.current?.getBoundingClientRect();if(m.isReady&&!!w&&!!v&&w.width>0&&w.height>0&&v.width>0&&v.height>0){c(!0);return}a=requestAnimationFrame(D)};return c(!1),a=requestAnimationFrame(D),()=>{a&&cancelAnimationFrame(a)}},[t,m.isReady,u,s]);let C=(0,d.jsx)("div",{ref:s,role:"menu","aria-orientation":"vertical","aria-hidden":!t,tabIndex:-1,[h.MENU_OWNER_ATTRIBUTE]:l,onMouseEnter:y,onMouseLeave:g,onKeyDown:A,style:{position:"fixed",top:m.top,left:m.left,maxHeight:m.availableHeight,visibility:t&&f?"visible":"hidden",opacity:t&&f?1:0,pointerEvents:t&&f?"auto":"none"},className:(0,x.cn)("z-[61] min-w-40 overflow-x-hidden overflow-y-auto rounded-lg outline-none","border border-gray-200 bg-white shadow-lg","dark:border-gray-700 dark:bg-gray-800",t&&f&&"animate-in fade-in-0 zoom-in-95 duration-150",i),children:(0,d.jsx)("div",{className:"py-1",children:r})});return typeof document<"u"?(0,S.createPortal)(C,(0,O.ownerDocumentOf)(u.current).body):C}P.displayName="DropdownSubMenuContent";0&&(module.exports={DropdownSubMenu,DropdownSubMenuContent,DropdownSubMenuTrigger});
1
+ "use strict";"use client";var M=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var K=(r,n)=>{for(var i in n)M(r,i,{get:n[i],enumerable:!0})},W=(r,n,i,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of B(n))!H.call(r,t)&&t!==i&&M(r,t,{get:()=>n[t],enumerable:!(l=q(n,t))||l.enumerable});return r};var j=r=>W(M({},"__esModule",{value:!0}),r);var _={};K(_,{DropdownSubMenu:()=>F,DropdownSubMenuContent:()=>P,DropdownSubMenuTrigger:()=>I});module.exports=j(_);var e=require("react"),S=require("react-dom"),R=require("./Dropdown.cjs"),k=require("./hooks/useClickOutside.cjs"),E=require("./hooks/usePositioning.cjs"),h=require("./menu-navigation.cjs"),N=require("../../lib/aria-hide.cjs"),O=require("../../lib/owner-document.cjs"),x=require("../../lib/cn.cjs"),d=require("react/jsx-runtime"),V=100,T=(0,e.createContext)(null);function L(){let r=(0,e.useContext)(T);if(!r)throw new Error("DropdownSubMenu components must be used within a DropdownSubMenu");return r}function F({children:r}){let{isOpen:n}=(0,R.useDropdownContext)(),[i,l]=(0,e.useState)(!1),t=(0,e.useRef)(null),p=(0,e.useRef)(null),u=(0,e.useRef)(null),s=(0,e.useRef)(!1),g=n&&i,o=(0,e.useCallback)(()=>{u.current!==null&&(clearTimeout(u.current),u.current=null)},[]),b=(0,e.useCallback)(()=>{o(),u.current=setTimeout(()=>{u.current=null,l(!1)},V)},[o]),f=(0,e.useCallback)(()=>{o(),s.current=!0,l(!0)},[o]),c=(0,e.useCallback)(()=>{let y=s.current;return s.current=!1,y},[]);(0,e.useEffect)(()=>{n||(o(),s.current=!1,l(!1))},[n,o]),(0,e.useEffect)(()=>o,[o]);let m=(0,e.useMemo)(()=>({isOpen:g,setIsOpen:l,triggerRef:t,contentRef:p,scheduleClose:b,cancelClose:o,openWithFocus:f,takeFocusRequest:c}),[g,b,o,f,c]);return(0,d.jsx)(T.Provider,{value:m,children:(0,d.jsx)("div",{className:"relative",children:r})})}F.displayName="DropdownSubMenu";function I({children:r,icon:n,disabled:i=!1,className:l}){let{isOpen:t,setIsOpen:p,triggerRef:u,scheduleClose:s,cancelClose:g,openWithFocus:o}=L();return(0,d.jsxs)("button",{ref:u,role:"menuitem",type:"button",tabIndex:-1,"aria-haspopup":"menu","aria-expanded":t,disabled:i,"data-disabled":i||void 0,onMouseEnter:c=>{i||(g(),c.currentTarget.focus({preventScroll:!0}),p(!0))},onMouseLeave:s,onClick:i?void 0:o,onKeyDown:c=>{i||(c.key==="ArrowRight"||c.key==="Enter"||c.key===" ")&&(c.preventDefault(),o())},className:(0,x.cn)("relative flex w-full items-center px-3 py-2 text-left text-sm","outline-none transition-colors","text-gray-700 dark:text-gray-200","hover:bg-gray-100 dark:hover:bg-gray-700","focus:bg-gray-100 dark:focus:bg-gray-700",i&&"opacity-50 cursor-not-allowed hover:bg-transparent",t&&"bg-gray-100 dark:bg-gray-700",l),children:[n&&(0,d.jsx)("span",{className:"mr-2 shrink-0 w-5 h-5",children:n}),(0,d.jsx)("span",{className:"flex-1",children:r}),(0,d.jsx)("svg",{className:"ml-auto w-4 h-4 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})}I.displayName="DropdownSubMenuTrigger";function P({children:r,sideOffset:n=0,className:i}){let{contentId:l}=(0,R.useDropdownContext)(),{isOpen:t,setIsOpen:p,triggerRef:u,contentRef:s,scheduleClose:g,cancelClose:o,takeFocusRequest:b}=L(),[f,c]=(0,e.useState)(!1),m=(0,E.usePositioning)({triggerRef:u,contentRef:s,isOpen:t,side:"right",align:"start",sideOffset:n,avoidCollisions:!0});(0,k.useClickOutside)(s,()=>p(!1),t,{isInside:a=>!!u.current?.contains(a)}),(0,e.useEffect)(()=>{let a=s.current;if(a)return(0,N.registerFloatingLayer)(a,()=>u.current)},[s,u]);let y=(0,e.useCallback)(()=>{o(),p(!0)},[o,p]),A=a=>{(a.key==="ArrowLeft"||a.key==="Escape")&&(a.preventDefault(),o(),p(!1),u.current?.focus())};(0,e.useEffect)(()=>{if(!t||!f||!b())return;let a=s.current;if(a)return(0,h.focusFirstItem)(a)},[t,f,s,b]),(0,e.useLayoutEffect)(()=>{let a=0;if(!t){c(!1);return}let D=()=>{let w=u.current?.getBoundingClientRect(),v=s.current?.getBoundingClientRect();if(m.isReady&&!!w&&!!v&&w.width>0&&w.height>0&&v.width>0&&v.height>0){c(!0);return}a=requestAnimationFrame(D)};return c(!1),a=requestAnimationFrame(D),()=>{a&&cancelAnimationFrame(a)}},[t,m.isReady,u,s]);let C=(0,d.jsx)("div",{ref:s,role:"menu","aria-orientation":"vertical","aria-hidden":!t,tabIndex:-1,[h.MENU_OWNER_ATTRIBUTE]:l,onMouseEnter:y,onMouseLeave:g,onKeyDown:A,style:{position:"fixed",top:m.top,left:m.left,maxHeight:m.availableHeight,visibility:t&&f?"visible":"hidden",opacity:t&&f?1:0,pointerEvents:t&&f?"auto":"none"},className:(0,x.cn)("z-[61] min-w-40 overflow-x-hidden overflow-y-auto rounded-lg outline-none","border border-gray-200 bg-white shadow-lg","dark:border-gray-700 dark:bg-gray-800",t&&f&&"animate-in fade-in-0 zoom-in-95",i),children:(0,d.jsx)("div",{className:"py-1",children:r})});return typeof document<"u"?(0,S.createPortal)(C,(0,O.ownerDocumentOf)(u.current).body):C}P.displayName="DropdownSubMenuContent";0&&(module.exports={DropdownSubMenu,DropdownSubMenuContent,DropdownSubMenuTrigger});
@@ -1 +1 @@
1
- "use client";import{createContext as O,useContext as T,useState as C,useRef as h,useEffect as y,useLayoutEffect as L,useCallback as b,useMemo as F}from"react";import{createPortal as I}from"react-dom";import{useDropdownContext as D}from"./Dropdown.js";import{useClickOutside as P}from"./hooks/useClickOutside.js";import{usePositioning as A}from"./hooks/usePositioning.js";import{MENU_OWNER_ATTRIBUTE as q,focusFirstItem as B}from"./menu-navigation.js";import{registerFloatingLayer as H}from"../../lib/aria-hide.js";import{ownerDocumentOf as K}from"../../lib/owner-document.js";import{cn as S}from"../../lib/cn.js";import{jsx as f,jsxs as z}from"react/jsx-runtime";var W=100,k=O(null);function E(){let i=T(k);if(!i)throw new Error("DropdownSubMenu components must be used within a DropdownSubMenu");return i}function j({children:i}){let{isOpen:c}=D(),[s,l]=C(!1),t=h(null),d=h(null),n=h(null),o=h(!1),m=c&&s,e=b(()=>{n.current!==null&&(clearTimeout(n.current),n.current=null)},[]),g=b(()=>{e(),n.current=setTimeout(()=>{n.current=null,l(!1)},W)},[e]),a=b(()=>{e(),o.current=!0,l(!0)},[e]),u=b(()=>{let w=o.current;return o.current=!1,w},[]);y(()=>{c||(e(),o.current=!1,l(!1))},[c,e]),y(()=>e,[e]);let p=F(()=>({isOpen:m,setIsOpen:l,triggerRef:t,contentRef:d,scheduleClose:g,cancelClose:e,openWithFocus:a,takeFocusRequest:u}),[m,g,e,a,u]);return f(k.Provider,{value:p,children:f("div",{className:"relative",children:i})})}j.displayName="DropdownSubMenu";function V({children:i,icon:c,disabled:s=!1,className:l}){let{isOpen:t,setIsOpen:d,triggerRef:n,scheduleClose:o,cancelClose:m,openWithFocus:e}=E();return z("button",{ref:n,role:"menuitem",type:"button",tabIndex:-1,"aria-haspopup":"menu","aria-expanded":t,disabled:s,"data-disabled":s||void 0,onMouseEnter:u=>{s||(m(),u.currentTarget.focus({preventScroll:!0}),d(!0))},onMouseLeave:o,onClick:s?void 0:e,onKeyDown:u=>{s||(u.key==="ArrowRight"||u.key==="Enter"||u.key===" ")&&(u.preventDefault(),e())},className:S("relative flex w-full items-center px-3 py-2 text-left text-sm","outline-none transition-colors","text-gray-700 dark:text-gray-200","hover:bg-gray-100 dark:hover:bg-gray-700","focus:bg-gray-100 dark:focus:bg-gray-700",s&&"opacity-50 cursor-not-allowed hover:bg-transparent",t&&"bg-gray-100 dark:bg-gray-700",l),children:[c&&f("span",{className:"mr-2 shrink-0 w-5 h-5",children:c}),f("span",{className:"flex-1",children:i}),f("svg",{className:"ml-auto w-4 h-4 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:f("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})}V.displayName="DropdownSubMenuTrigger";function _({children:i,sideOffset:c=0,className:s}){let{contentId:l}=D(),{isOpen:t,setIsOpen:d,triggerRef:n,contentRef:o,scheduleClose:m,cancelClose:e,takeFocusRequest:g}=E(),[a,u]=C(!1),p=A({triggerRef:n,contentRef:o,isOpen:t,side:"right",align:"start",sideOffset:c,avoidCollisions:!0});P(o,()=>d(!1),t,{isInside:r=>!!n.current?.contains(r)}),y(()=>{let r=o.current;if(r)return H(r,()=>n.current)},[o,n]);let w=b(()=>{e(),d(!0)},[e,d]),N=r=>{(r.key==="ArrowLeft"||r.key==="Escape")&&(r.preventDefault(),e(),d(!1),n.current?.focus())};y(()=>{if(!t||!a||!g())return;let r=o.current;if(r)return B(r)},[t,a,o,g]),L(()=>{let r=0;if(!t){u(!1);return}let x=()=>{let v=n.current?.getBoundingClientRect(),M=o.current?.getBoundingClientRect();if(p.isReady&&!!v&&!!M&&v.width>0&&v.height>0&&M.width>0&&M.height>0){u(!0);return}r=requestAnimationFrame(x)};return u(!1),r=requestAnimationFrame(x),()=>{r&&cancelAnimationFrame(r)}},[t,p.isReady,n,o]);let R=f("div",{ref:o,role:"menu","aria-orientation":"vertical","aria-hidden":!t,tabIndex:-1,[q]:l,onMouseEnter:w,onMouseLeave:m,onKeyDown:N,style:{position:"fixed",top:p.top,left:p.left,maxHeight:p.availableHeight,visibility:t&&a?"visible":"hidden",opacity:t&&a?1:0,pointerEvents:t&&a?"auto":"none"},className:S("z-[61] min-w-40 overflow-x-hidden overflow-y-auto rounded-lg outline-none","border border-gray-200 bg-white shadow-lg","dark:border-gray-700 dark:bg-gray-800",t&&a&&"animate-in fade-in-0 zoom-in-95 duration-150",s),children:f("div",{className:"py-1",children:i})});return typeof document<"u"?I(R,K(n.current).body):R}_.displayName="DropdownSubMenuContent";export{j as DropdownSubMenu,_ as DropdownSubMenuContent,V as DropdownSubMenuTrigger};
1
+ "use client";import{createContext as O,useContext as T,useState as C,useRef as h,useEffect as y,useLayoutEffect as L,useCallback as b,useMemo as F}from"react";import{createPortal as I}from"react-dom";import{useDropdownContext as D}from"./Dropdown.js";import{useClickOutside as P}from"./hooks/useClickOutside.js";import{usePositioning as A}from"./hooks/usePositioning.js";import{MENU_OWNER_ATTRIBUTE as q,focusFirstItem as B}from"./menu-navigation.js";import{registerFloatingLayer as H}from"../../lib/aria-hide.js";import{ownerDocumentOf as K}from"../../lib/owner-document.js";import{cn as S}from"../../lib/cn.js";import{jsx as f,jsxs as z}from"react/jsx-runtime";var W=100,k=O(null);function E(){let i=T(k);if(!i)throw new Error("DropdownSubMenu components must be used within a DropdownSubMenu");return i}function j({children:i}){let{isOpen:c}=D(),[s,l]=C(!1),t=h(null),d=h(null),n=h(null),o=h(!1),m=c&&s,e=b(()=>{n.current!==null&&(clearTimeout(n.current),n.current=null)},[]),g=b(()=>{e(),n.current=setTimeout(()=>{n.current=null,l(!1)},W)},[e]),a=b(()=>{e(),o.current=!0,l(!0)},[e]),u=b(()=>{let w=o.current;return o.current=!1,w},[]);y(()=>{c||(e(),o.current=!1,l(!1))},[c,e]),y(()=>e,[e]);let p=F(()=>({isOpen:m,setIsOpen:l,triggerRef:t,contentRef:d,scheduleClose:g,cancelClose:e,openWithFocus:a,takeFocusRequest:u}),[m,g,e,a,u]);return f(k.Provider,{value:p,children:f("div",{className:"relative",children:i})})}j.displayName="DropdownSubMenu";function V({children:i,icon:c,disabled:s=!1,className:l}){let{isOpen:t,setIsOpen:d,triggerRef:n,scheduleClose:o,cancelClose:m,openWithFocus:e}=E();return z("button",{ref:n,role:"menuitem",type:"button",tabIndex:-1,"aria-haspopup":"menu","aria-expanded":t,disabled:s,"data-disabled":s||void 0,onMouseEnter:u=>{s||(m(),u.currentTarget.focus({preventScroll:!0}),d(!0))},onMouseLeave:o,onClick:s?void 0:e,onKeyDown:u=>{s||(u.key==="ArrowRight"||u.key==="Enter"||u.key===" ")&&(u.preventDefault(),e())},className:S("relative flex w-full items-center px-3 py-2 text-left text-sm","outline-none transition-colors","text-gray-700 dark:text-gray-200","hover:bg-gray-100 dark:hover:bg-gray-700","focus:bg-gray-100 dark:focus:bg-gray-700",s&&"opacity-50 cursor-not-allowed hover:bg-transparent",t&&"bg-gray-100 dark:bg-gray-700",l),children:[c&&f("span",{className:"mr-2 shrink-0 w-5 h-5",children:c}),f("span",{className:"flex-1",children:i}),f("svg",{className:"ml-auto w-4 h-4 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:f("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})}V.displayName="DropdownSubMenuTrigger";function _({children:i,sideOffset:c=0,className:s}){let{contentId:l}=D(),{isOpen:t,setIsOpen:d,triggerRef:n,contentRef:o,scheduleClose:m,cancelClose:e,takeFocusRequest:g}=E(),[a,u]=C(!1),p=A({triggerRef:n,contentRef:o,isOpen:t,side:"right",align:"start",sideOffset:c,avoidCollisions:!0});P(o,()=>d(!1),t,{isInside:r=>!!n.current?.contains(r)}),y(()=>{let r=o.current;if(r)return H(r,()=>n.current)},[o,n]);let w=b(()=>{e(),d(!0)},[e,d]),N=r=>{(r.key==="ArrowLeft"||r.key==="Escape")&&(r.preventDefault(),e(),d(!1),n.current?.focus())};y(()=>{if(!t||!a||!g())return;let r=o.current;if(r)return B(r)},[t,a,o,g]),L(()=>{let r=0;if(!t){u(!1);return}let x=()=>{let v=n.current?.getBoundingClientRect(),M=o.current?.getBoundingClientRect();if(p.isReady&&!!v&&!!M&&v.width>0&&v.height>0&&M.width>0&&M.height>0){u(!0);return}r=requestAnimationFrame(x)};return u(!1),r=requestAnimationFrame(x),()=>{r&&cancelAnimationFrame(r)}},[t,p.isReady,n,o]);let R=f("div",{ref:o,role:"menu","aria-orientation":"vertical","aria-hidden":!t,tabIndex:-1,[q]:l,onMouseEnter:w,onMouseLeave:m,onKeyDown:N,style:{position:"fixed",top:p.top,left:p.left,maxHeight:p.availableHeight,visibility:t&&a?"visible":"hidden",opacity:t&&a?1:0,pointerEvents:t&&a?"auto":"none"},className:S("z-[61] min-w-40 overflow-x-hidden overflow-y-auto rounded-lg outline-none","border border-gray-200 bg-white shadow-lg","dark:border-gray-700 dark:bg-gray-800",t&&a&&"animate-in fade-in-0 zoom-in-95",s),children:f("div",{className:"py-1",children:i})});return typeof document<"u"?I(R,K(n.current).body):R}_.displayName="DropdownSubMenuContent";export{j as DropdownSubMenu,_ as DropdownSubMenuContent,V as DropdownSubMenuTrigger};
@@ -1 +1 @@
1
- "use strict";"use client";var x=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var z=(o,n)=>{for(var f in n)x(o,f,{get:n[f],enumerable:!0})},I=(o,n,f,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of k(n))!q.call(o,a)&&a!==f&&x(o,a,{get:()=>n[a],enumerable:!(c=M(n,a))||c.enumerable});return o};var U=o=>I(x({},"__esModule",{value:!0}),o);var P={};z(P,{usePositioning:()=>W});module.exports=U(P);var m=require("react"),E=require("../../../lib/owner-document.cjs"),V={top:"bottom",bottom:"top",left:"right",right:"left"};function W({triggerRef:o,contentRef:n,isOpen:f,side:c="bottom",align:a="start",sideOffset:u=4,alignOffset:b=0,avoidCollisions:L=!0,collisionPadding:i=8}){let[F,H]=(0,m.useState)({top:0,left:0,actualSide:c,actualAlign:a,isReady:!1}),R=(0,m.useRef)(!1),v=(0,m.useCallback)(()=>{if(!o.current||!n.current)return;let t=o.current.getBoundingClientRect(),e=n.current.getBoundingClientRect();if(!(t.width>0&&t.height>0&&e.width>0&&e.height>0)){R.current=!1;return}let w=(0,E.ownerWindowOf)(o.current),l={width:w.innerWidth,height:w.innerHeight},s=c,d=a,T=p=>{switch(p){case"bottom":return{top:t.bottom+u,left:t.left};case"top":return{top:t.top-e.height-u,left:t.left};case"right":return{top:t.top,left:t.right+u};case"left":return{top:t.top,left:t.left-e.width-u}}},j=(p,S,h)=>{if(p==="top"||p==="bottom")switch(S){case"start":return{...h,left:t.left+b};case"center":return{...h,left:t.left+t.width/2-e.width/2+b};case"end":return{...h,left:t.right-e.width+b}}else switch(S){case"start":return{...h,top:t.top+b};case"center":return{...h,top:t.top+t.height/2-e.height/2+b};case"end":return{...h,top:t.bottom-e.height+b}}},r=T(s);r=j(s,d,r);let B;if(L){let p={top:t.top-u-i,bottom:l.height-t.bottom-u-i,left:t.left-u-i,right:l.width-t.right-u-i},S=c==="top"||c==="bottom"?e.height:e.width,h=V[c];S>p[c]&&p[h]>p[c]&&(s=h,r=T(s),r=j(s,d,r));let A=l.width-e.width-i,C=l.height-e.height-i,y=s==="top"||s==="bottom";r.left>A&&(r.left=A,y&&(d="end")),r.left<i&&(r.left=i,y&&(d="start")),r.top>C&&(r.top=C,y||(d="end")),r.top<i&&(r.top=i,y||(d="start")),B=Math.max(0,l.height-2*i)}R.current=!0,H({top:r.top,left:r.left,actualSide:s,actualAlign:d,isReady:!0,availableHeight:B})},[o,n,c,a,u,b,L,i]);return(0,m.useLayoutEffect)(()=>{if(!f)return;let t=0;R.current=!1,H(l=>l.isReady?{...l,isReady:!1}:l);let e=()=>{v(),R.current||(t=requestAnimationFrame(e))};t=requestAnimationFrame(e);let g=()=>v(),w=(0,E.ownerWindowOf)(o.current);return w.addEventListener("resize",g),w.addEventListener("scroll",g,{passive:!0,capture:!0}),()=>{t&&cancelAnimationFrame(t),w.removeEventListener("resize",g),w.removeEventListener("scroll",g,{capture:!0})}},[v,f]),F}0&&(module.exports={usePositioning});
1
+ "use strict";"use client";var L=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var z=(e,r)=>{for(var b in r)L(e,b,{get:r[b],enumerable:!0})},I=(e,r,b,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let l of k(r))!q.call(e,l)&&l!==b&&L(e,l,{get:()=>r[l],enumerable:!(u=F(r,l))||u.enumerable});return e};var N=e=>I(L({},"__esModule",{value:!0}),e);var D={};z(D,{usePositioning:()=>W});module.exports=N(D);var m=require("react"),H=require("../../../lib/owner-document.cjs"),x="synertech-layer-moved",U={top:"bottom",bottom:"top",left:"right",right:"left"};function W({triggerRef:e,contentRef:r,isOpen:b,side:u="bottom",align:l="start",sideOffset:s=4,alignOffset:d=0,avoidCollisions:M=!0,collisionPadding:c=8}){let[v,T]=(0,m.useState)({top:0,left:0,actualSide:u,actualAlign:l,isReady:!1}),E=(0,m.useRef)(!1),g=(0,m.useCallback)(()=>{if(!e.current||!r.current)return;let t=e.current.getBoundingClientRect(),n=r.current.getBoundingClientRect();if(!(t.width>0&&t.height>0&&n.width>0&&n.height>0)){E.current=!1;return}let y=(0,H.ownerWindowOf)(e.current),a={width:y.innerWidth,height:y.innerHeight},i=u,h=l,V=f=>{switch(f){case"bottom":return{top:t.bottom+s,left:t.left};case"top":return{top:t.top-n.height-s,left:t.left};case"right":return{top:t.top,left:t.right+s};case"left":return{top:t.top,left:t.left-n.width-s}}},j=(f,S,p)=>{if(f==="top"||f==="bottom")switch(S){case"start":return{...p,left:t.left+d};case"center":return{...p,left:t.left+t.width/2-n.width/2+d};case"end":return{...p,left:t.right-n.width+d}}else switch(S){case"start":return{...p,top:t.top+d};case"center":return{...p,top:t.top+t.height/2-n.height/2+d};case"end":return{...p,top:t.bottom-n.height+d}}},o=V(i);o=j(i,h,o);let B;if(M){let f={top:t.top-s-c,bottom:a.height-t.bottom-s-c,left:t.left-s-c,right:a.width-t.right-s-c},S=u==="top"||u==="bottom"?n.height:n.width,p=U[u];S>f[u]&&f[p]>f[u]&&(i=p,o=V(i),o=j(i,h,o));let R=a.width-n.width-c,C=a.height-n.height-c,A=i==="top"||i==="bottom";o.left>R&&(o.left=R,A&&(h="end")),o.left<c&&(o.left=c,A&&(h="start")),o.top>C&&(o.top=C,A||(h="end")),o.top<c&&(o.top=c,A||(h="start")),B=Math.max(0,a.height-2*c)}E.current=!0,T({top:o.top,left:o.left,actualSide:i,actualAlign:h,isReady:!0,availableHeight:B})},[e,r,u,l,s,d,M,c]);return(0,m.useLayoutEffect)(()=>{if(!b)return;let t=0;E.current=!1,T(i=>i.isReady?{...i,isReady:!1}:i);let n=()=>{g(),E.current||(t=requestAnimationFrame(n))};t=requestAnimationFrame(n);let w=()=>g(),y=i=>{let h=i.target;e.current&&h?.contains(e.current)&&g()},a=(0,H.ownerWindowOf)(e.current);return a.addEventListener("resize",w),a.addEventListener("scroll",w,{passive:!0,capture:!0}),a.addEventListener(x,y,{capture:!0}),()=>{t&&cancelAnimationFrame(t),a.removeEventListener("resize",w),a.removeEventListener("scroll",w,{capture:!0}),a.removeEventListener(x,y,{capture:!0})}},[g,b,e]),(0,m.useLayoutEffect)(()=>{v.isReady&&r.current?.dispatchEvent(new Event(x))},[r,v.isReady,v.top,v.left]),v}0&&(module.exports={usePositioning});
@@ -1 +1 @@
1
- "use client";import{useState as C,useLayoutEffect as F,useCallback as M,useRef as k}from"react";import{ownerWindowOf as j}from"../../../lib/owner-document.js";var q={top:"bottom",bottom:"top",left:"right",right:"left"};function U({triggerRef:m,contentRef:g,isOpen:v,side:a="bottom",align:R="start",sideOffset:n=4,alignOffset:h=0,avoidCollisions:A=!0,collisionPadding:o=8}){let[B,x]=C({top:0,left:0,actualSide:a,actualAlign:R,isReady:!1}),b=k(!1),S=M(()=>{if(!m.current||!g.current)return;let t=m.current.getBoundingClientRect(),e=g.current.getBoundingClientRect();if(!(t.width>0&&t.height>0&&e.width>0&&e.height>0)){b.current=!1;return}let s=j(m.current),i={width:s.innerWidth,height:s.innerHeight},u=a,p=R,E=l=>{switch(l){case"bottom":return{top:t.bottom+n,left:t.left};case"top":return{top:t.top-e.height-n,left:t.left};case"right":return{top:t.top,left:t.right+n};case"left":return{top:t.top,left:t.left-e.width-n}}},L=(l,w,c)=>{if(l==="top"||l==="bottom")switch(w){case"start":return{...c,left:t.left+h};case"center":return{...c,left:t.left+t.width/2-e.width/2+h};case"end":return{...c,left:t.right-e.width+h}}else switch(w){case"start":return{...c,top:t.top+h};case"center":return{...c,top:t.top+t.height/2-e.height/2+h};case"end":return{...c,top:t.bottom-e.height+h}}},r=E(u);r=L(u,p,r);let H;if(A){let l={top:t.top-n-o,bottom:i.height-t.bottom-n-o,left:t.left-n-o,right:i.width-t.right-n-o},w=a==="top"||a==="bottom"?e.height:e.width,c=q[a];w>l[a]&&l[c]>l[a]&&(u=c,r=E(u),r=L(u,p,r));let y=i.width-e.width-o,T=i.height-e.height-o,d=u==="top"||u==="bottom";r.left>y&&(r.left=y,d&&(p="end")),r.left<o&&(r.left=o,d&&(p="start")),r.top>T&&(r.top=T,d||(p="end")),r.top<o&&(r.top=o,d||(p="start")),H=Math.max(0,i.height-2*o)}b.current=!0,x({top:r.top,left:r.left,actualSide:u,actualAlign:p,isReady:!0,availableHeight:H})},[m,g,a,R,n,h,A,o]);return F(()=>{if(!v)return;let t=0;b.current=!1,x(i=>i.isReady?{...i,isReady:!1}:i);let e=()=>{S(),b.current||(t=requestAnimationFrame(e))};t=requestAnimationFrame(e);let f=()=>S(),s=j(m.current);return s.addEventListener("resize",f),s.addEventListener("scroll",f,{passive:!0,capture:!0}),()=>{t&&cancelAnimationFrame(t),s.removeEventListener("resize",f),s.removeEventListener("scroll",f,{capture:!0})}},[S,v]),B}export{U as usePositioning};
1
+ "use client";import{useState as C,useLayoutEffect as j,useCallback as F,useRef as k}from"react";import{ownerWindowOf as B}from"../../../lib/owner-document.js";var A="synertech-layer-moved",q={top:"bottom",bottom:"top",left:"right",right:"left"};function N({triggerRef:l,contentRef:m,isOpen:R,side:s="bottom",align:g="start",sideOffset:c=4,alignOffset:p=0,avoidCollisions:L=!0,collisionPadding:o=8}){let[f,x]=C({top:0,left:0,actualSide:s,actualAlign:g,isReady:!1}),v=k(!1),w=F(()=>{if(!l.current||!m.current)return;let t=l.current.getBoundingClientRect(),e=m.current.getBoundingClientRect();if(!(t.width>0&&t.height>0&&e.width>0&&e.height>0)){v.current=!1;return}let d=B(l.current),i={width:d.innerWidth,height:d.innerHeight},n=s,a=g,H=h=>{switch(h){case"bottom":return{top:t.bottom+c,left:t.left};case"top":return{top:t.top-e.height-c,left:t.left};case"right":return{top:t.top,left:t.right+c};case"left":return{top:t.top,left:t.left-e.width-c}}},M=(h,y,u)=>{if(h==="top"||h==="bottom")switch(y){case"start":return{...u,left:t.left+p};case"center":return{...u,left:t.left+t.width/2-e.width/2+p};case"end":return{...u,left:t.right-e.width+p}}else switch(y){case"start":return{...u,top:t.top+p};case"center":return{...u,top:t.top+t.height/2-e.height/2+p};case"end":return{...u,top:t.bottom-e.height+p}}},r=H(n);r=M(n,a,r);let T;if(L){let h={top:t.top-c-o,bottom:i.height-t.bottom-c-o,left:t.left-c-o,right:i.width-t.right-c-o},y=s==="top"||s==="bottom"?e.height:e.width,u=q[s];y>h[s]&&h[u]>h[s]&&(n=u,r=H(n),r=M(n,a,r));let S=i.width-e.width-o,V=i.height-e.height-o,E=n==="top"||n==="bottom";r.left>S&&(r.left=S,E&&(a="end")),r.left<o&&(r.left=o,E&&(a="start")),r.top>V&&(r.top=V,E||(a="end")),r.top<o&&(r.top=o,E||(a="start")),T=Math.max(0,i.height-2*o)}v.current=!0,x({top:r.top,left:r.left,actualSide:n,actualAlign:a,isReady:!0,availableHeight:T})},[l,m,s,g,c,p,L,o]);return j(()=>{if(!R)return;let t=0;v.current=!1,x(n=>n.isReady?{...n,isReady:!1}:n);let e=()=>{w(),v.current||(t=requestAnimationFrame(e))};t=requestAnimationFrame(e);let b=()=>w(),d=n=>{let a=n.target;l.current&&a?.contains(l.current)&&w()},i=B(l.current);return i.addEventListener("resize",b),i.addEventListener("scroll",b,{passive:!0,capture:!0}),i.addEventListener(A,d,{capture:!0}),()=>{t&&cancelAnimationFrame(t),i.removeEventListener("resize",b),i.removeEventListener("scroll",b,{capture:!0}),i.removeEventListener(A,d,{capture:!0})}},[w,R,l]),j(()=>{f.isReady&&m.current?.dispatchEvent(new Event(A))},[m,f.isReady,f.top,f.left]),f}export{N as usePositioning};
@@ -0,0 +1 @@
1
+ "use strict";var m=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var u=(e,t)=>{for(var i in t)m(e,i,{get:t[i],enumerable:!0})},v=(e,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of N(t))!S.call(e,s)&&s!==i&&m(e,s,{get:()=>t[s],enumerable:!(o=z(t,s))||o.enumerable});return e};var R=e=>v(m({},"__esModule",{value:!0}),e);var E={};u(E,{EmptyState:()=>d});module.exports=R(E);var r=require("../../lib/cn.cjs"),a=require("react/jsx-runtime"),p={sm:{root:"gap-1 px-3 py-3",disc:"mb-1 size-9 [&>svg]:size-5",title:"text-sm",description:"max-w-xs text-xs",actions:"mt-2 gap-2"},md:{root:"gap-1.5 px-6 py-10",disc:"mb-2 size-12 [&>svg]:size-6",title:"text-base",description:"max-w-sm text-sm",actions:"mt-4 gap-3"},lg:{root:"gap-2 px-8 py-16",disc:"mb-3 size-16 [&>svg]:size-8",title:"text-xl",description:"max-w-md text-base",actions:"mt-6 gap-3"}};function d({icon:e,title:t,description:i,action:o,secondaryAction:s,headingLevel:c,size:l="md",children:x,className:g,...y}){let n=p[l]??p.md,f=c?`h${c}`:"p";return(0,a.jsxs)("div",{className:(0,r.cn)("flex flex-col items-center text-center",n.root,g),...y,children:[e?(0,a.jsx)("span",{"aria-hidden":"true",className:(0,r.cn)("flex shrink-0 items-center justify-center rounded-full bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-300",n.disc),children:e}):null,(0,a.jsx)(f,{className:(0,r.cn)("m-0 font-semibold text-gray-900 dark:text-gray-100",n.title),children:t}),i?(0,a.jsx)("div",{className:(0,r.cn)("text-gray-500 dark:text-gray-400",n.description),children:i}):null,x,o||s?(0,a.jsxs)("div",{className:(0,r.cn)("flex flex-wrap items-center justify-center",n.actions),children:[o,s]}):null]})}d.displayName="EmptyState";0&&(module.exports={EmptyState});
@@ -0,0 +1 @@
1
+ import{cn as e}from"../../lib/cn.js";import{jsx as s,jsxs as c}from"react/jsx-runtime";var m={sm:{root:"gap-1 px-3 py-3",disc:"mb-1 size-9 [&>svg]:size-5",title:"text-sm",description:"max-w-xs text-xs",actions:"mt-2 gap-2"},md:{root:"gap-1.5 px-6 py-10",disc:"mb-2 size-12 [&>svg]:size-6",title:"text-base",description:"max-w-sm text-sm",actions:"mt-4 gap-3"},lg:{root:"gap-2 px-8 py-16",disc:"mb-3 size-16 [&>svg]:size-8",title:"text-xl",description:"max-w-md text-base",actions:"mt-6 gap-3"}};function f({icon:i,title:p,description:a,action:r,secondaryAction:o,headingLevel:n,size:d="md",children:l,className:x,...g}){let t=m[d]??m.md,y=n?`h${n}`:"p";return c("div",{className:e("flex flex-col items-center text-center",t.root,x),...g,children:[i?s("span",{"aria-hidden":"true",className:e("flex shrink-0 items-center justify-center rounded-full bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-300",t.disc),children:i}):null,s(y,{className:e("m-0 font-semibold text-gray-900 dark:text-gray-100",t.title),children:p}),a?s("div",{className:e("text-gray-500 dark:text-gray-400",t.description),children:a}):null,l,r||o?c("div",{className:e("flex flex-wrap items-center justify-center",t.actions),children:[r,o]}):null]})}f.displayName="EmptyState";export{f as EmptyState};
@@ -0,0 +1 @@
1
+ "use strict";var o=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var f=(e,t)=>{for(var m in t)o(e,m,{get:t[m],enumerable:!0})},x=(e,t,m,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of a(t))!E.call(e,p)&&p!==m&&o(e,p,{get:()=>t[p],enumerable:!(r=S(t,p))||r.enumerable});return e};var i=e=>x(o({},"__esModule",{value:!0}),e);var s={};f(s,{EmptyState:()=>y.EmptyState});module.exports=i(s);var y=require("./EmptyState.cjs");0&&(module.exports={EmptyState});
@@ -0,0 +1 @@
1
+ import{EmptyState as p}from"./EmptyState.js";export{p as EmptyState};
@@ -1,5 +1,5 @@
1
- "use strict";"use client";var J=Object.defineProperty;var Le=Object.getOwnPropertyDescriptor;var ke=Object.getOwnPropertyNames;var Ae=Object.prototype.hasOwnProperty;var He=(t,n)=>{for(var l in n)J(t,l,{get:n[l],enumerable:!0})},Pe=(t,n,l,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let c of ke(n))!Ae.call(t,c)&&c!==l&&J(t,c,{get:()=>n[c],enumerable:!(o=Le(n,c))||o.enumerable});return t};var Be=t=>Pe(J({},"__esModule",{value:!0}),t);var qe={};He(qe,{MentionInput:()=>he});module.exports=Be(qe);var i=require("react"),ce=require("react-dom"),V=require("../../../lib/cn.cjs"),Z=require("../../../lib/css-value.cjs"),ue=require("../../../lib/i18n.cjs"),$=require("../shared/inputStyles.cjs"),de=require("../shared/field-error.cjs"),fe=require("../shared/InputWrapper.cjs"),pe=require("../../chip/Chip.cjs"),g=require("react/jsx-runtime"),ge=0,Ve=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),me=t=>{let n=document.createElement("span");return n.contentEditable="false",n.setAttribute("data-mention-id",t.id),n.setAttribute("data-mention-label",t.label),t.avatar&&n.setAttribute("data-mention-avatar",t.avatar),n.className="inline-block align-middle mx-0.5",n.style.userSelect="none",n},$e=(t,n)=>{if(typeof document.execCommand=="function")try{if(document.execCommand("insertText",!1,n))return!1}catch{}let l=t.ownerDocument.getSelection();if(!l||l.rangeCount===0)return!1;let o=l.getRangeAt(0);if(!t.contains(o.commonAncestorContainer))return!1;o.deleteContents();let c=t.ownerDocument.createDocumentFragment();n.split(`
2
- `).forEach((a,u)=>{u>0&&c.appendChild(t.ownerDocument.createElement("br")),a&&c.appendChild(t.ownerDocument.createTextNode(a))});let x=c.lastChild;return o.insertNode(c),x&&(o.setStartAfter(x),o.collapse(!0),l.removeAllRanges(),l.addRange(o)),!0},_e=t=>t.tagName==="DIV"||t.tagName==="P",ze=(t,n,l)=>{let o="",c=[],x=!1,a=h=>{x&&o&&(o+=`
3
- `),x=!1,o+=h},u=h=>{if(h.nodeType===Node.TEXT_NODE){h.textContent&&a(h.textContent);return}if(h.nodeType!==Node.ELEMENT_NODE)return;let M=h,T=l.get(M);if(T){let D=`@${T.label}`;a(""),c.push({trigger:n,suggestion:T,startIndex:o.length,endIndex:o.length+D.length}),o+=D;return}if(M.tagName==="BR"){a(M.nextSibling?`
4
- `:"");return}let S=_e(M);S&&o&&(x=!0),M.childNodes.forEach(u),S&&o&&(x=!0)};return t.childNodes.forEach(u),{text:o,mentions:c}},Fe=(t,n)=>{t.replaceChildren();let l=[],o=a=>{a.split(`
5
- `).forEach((u,h)=>{h>0&&t.appendChild(document.createElement("br")),u&&t.appendChild(document.createTextNode(u))})},c=0,x=[...n.mentions].sort((a,u)=>a.startIndex-u.startIndex);for(let a of x){if(a.startIndex<c||a.endIndex>n.text.length||a.endIndex<a.startIndex)continue;o(n.text.slice(c,a.startIndex));let u=me(a.suggestion);t.appendChild(u),l.push({key:`mention-${++ge}`,element:u,suggestion:a.suggestion}),c=a.endIndex}return o(n.text.slice(c)),t.lastChild?.nodeName==="BR"&&t.appendChild(document.createElement("br")),l},Xe=(t,n)=>t.text===n.text&&t.mentions.length===n.mentions.length&&t.mentions.every((l,o)=>l.suggestion.id===n.mentions[o].suggestion.id&&l.startIndex===n.mentions[o].startIndex&&l.endIndex===n.mentions[o].endIndex),Ke=t=>(0,g.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",children:[t.avatar&&(0,g.jsx)("img",{src:t.avatar,alt:t.label,className:"w-6 h-6 rounded-full"}),(0,g.jsx)("span",{className:"text-sm text-gray-900 dark:text-white",children:t.label})]}),he=(0,i.forwardRef)(({label:t,inline:n=!1,size:l="md",labelColor:o,borderColor:c,textColor:x,disabled:a=!1,readOnly:u=!1,error:h,helperText:M,hideLabel:T=!1,icon:S,iconPosition:D="left",mentionTrigger:w="@",suggestions:L=[],onMentionSearch:ee,onMentionSelect:te,onMentionRemove:k,renderSuggestion:ne,value:R,onChange:N,placeholder:_,loading:xe=!1,loadingLabel:Ce,maxSuggestions:z=10,chipVariant:be="soft",chipColor:Me="primary",chipSize:ve="sm"},A)=>{let F=(0,Z.safeCssColor)(c),X=(0,Z.safeCssColor)(x),K=(0,i.useId)(),Ee=(0,ue.useUILabels)(),q=(0,de.describeField)(K,{helperText:M,error:h}),p=(0,i.useRef)(null),[re,ye]=(0,i.useState)([]),C=(0,i.useRef)(re),v=(0,i.useCallback)(e=>{e!==C.current&&(C.current=e,ye(e))},[]),[O,H]=(0,i.useState)(!1),[P,W]=(0,i.useState)(0),[Oe,Q]=(0,i.useState)(""),Ie=(0,V.cn)((0,$.getBaseInputClasses)({size:l,error:q.invalid,disabled:a,readOnly:u,icon:S,iconPosition:D}),"min-h-[42px]","whitespace-pre-wrap","break-words"),Se={...F&&{borderColor:F},...X&&{color:X}},we=F||X?Se:void 0,E=(0,i.useCallback)(()=>{let e=p.current;if(!e)return{text:"",mentions:[]};let s=new Map(C.current.map(r=>[r.element,r.suggestion]));return ze(e,w,s)},[w]),U=(0,i.useCallback)(e=>{let s=p.current;if(!s||!s.contains(e))return;let r=C.current.find(d=>d.element===e);r&&(e.remove(),v(C.current.filter(d=>d!==r)),N?.(E()),k?.(r.suggestion))},[E,N,k,v]),Y=(0,i.useCallback)(()=>{if(!p.current)return;let e=window.getSelection();if(!e||e.rangeCount===0)return;let s=e.getRangeAt(0),r="";s.startContainer.nodeType===Node.TEXT_NODE&&(r=s.startContainer.textContent?.substring(0,s.startOffset)||"");let d=r.match(new RegExp(`${Ve(w)}([\\p{L}\\p{M}\\p{N}_]*)$`,"u"));if(d){let b=d[1];Q(b),H(!0),W(0),ee?.(b)}else H(!1),Q("");let f=p.current,m=C.current.filter(b=>!f.contains(b.element));m.length>0&&v(C.current.filter(b=>!m.includes(b)));let y=E();N?.(y),m.forEach(b=>k?.(b.suggestion))},[w,ee,N,k,E,v]),oe=(0,i.useCallback)(e=>{let s=p.current;if(!s)return!1;let r=window.getSelection();if(!r||r.rangeCount===0)return!1;let d=r.getRangeAt(0);if(d.startContainer.nodeType!==Node.TEXT_NODE||!s.contains(d.startContainer))return!1;let f=d.startContainer,m=f.textContent||"",y=d.startOffset,ae=m.substring(0,y).lastIndexOf(w);if(ae===-1)return!1;let se=m.substring(0,ae),ie=m.substring(y),I=me(e);if(v([...C.current,{key:`mention-${++ge}`,element:I,suggestion:e}]),se?(f.textContent=se,f.parentNode?.insertBefore(I,f.nextSibling)):(f.parentNode?.insertBefore(I,f),f.remove()),ie){let Re=document.createTextNode(ie);I.parentNode?.insertBefore(Re,I.nextSibling)}let le=document.createTextNode(" ");I.parentNode?.insertBefore(le,I.nextSibling);let G=document.createRange();return G.setStartAfter(le),G.collapse(!0),r.removeAllRanges(),r.addRange(G),!0},[w,v]),j=(0,i.useCallback)(e=>{let s=oe(e);if(H(!1),Q(""),!s)return;let r=E();N?.(r),te?.(e),p.current?.focus()},[oe,E,N,te]),B=(0,i.useCallback)(e=>{let s=p.current;!s||a||u||$e(s,e)&&Y()},[a,u,Y]),Ne=(0,i.useCallback)(e=>{e.preventDefault(),B(e.clipboardData.getData("text/plain"))},[B]),Te=(0,i.useCallback)(e=>{e.preventDefault();let s=e.dataTransfer.getData("text/plain");if(!s)return;let r=e.currentTarget.ownerDocument,d=r.caretRangeFromPoint?.(e.clientX,e.clientY)??(()=>{let m=r.caretPositionFromPoint?.(e.clientX,e.clientY);if(!m)return null;let y=r.createRange();return y.setStart(m.offsetNode,m.offset),y})(),f=r.getSelection();d&&f&&e.currentTarget.contains(d.startContainer)&&(f.removeAllRanges(),f.addRange(d)),B(s)},[B]),De=(0,i.useCallback)(e=>{let s=L.slice(0,z);if(O&&s.length>0)switch(e.key){case"ArrowDown":e.preventDefault(),W(r=>r<s.length-1?r+1:0);return;case"ArrowUp":e.preventDefault(),W(r=>r>0?r-1:s.length-1);return;case"Enter":case"Tab":e.preventDefault(),s[P]&&j(s[P]);return;case"Escape":e.preventDefault(),H(!1);return}if(e.key==="Backspace"){let r=window.getSelection();if(!r||r.rangeCount===0)return;let d=r.getRangeAt(0);if(!d.collapsed||d.startOffset!==0)return;let f=d.startContainer.previousSibling;f&&C.current.some(m=>m.element===f)&&(e.preventDefault(),U(f))}},[O,L,P,z,j,U]);return(0,i.useLayoutEffect)(()=>{let e=p.current;!e||R===void 0||Xe(R,E())||v(Fe(e,R))},[R,E,v]),(0,i.useEffect)(()=>{p.current&&(!(p.current.textContent||p.current.querySelector("[data-mention-id]"))&&_?p.current.setAttribute("data-placeholder",_):p.current.removeAttribute("data-placeholder"))},[_,R]),(0,g.jsx)(fe.InputWrapper,{label:t,hideLabel:T,labelColor:o,error:h,helperText:M,inline:n,htmlFor:K,children:(0,g.jsxs)("div",{className:"relative w-full",children:[S&&(0,g.jsx)("span",{className:(0,$.getIconClasses)(D),children:S}),(0,g.jsx)("div",{ref:e=>{typeof A=="function"?A(e):A&&(A.current=e),p.current=e},id:K,contentEditable:!a&&!u,suppressContentEditableWarning:!0,onInput:Y,onKeyDown:De,onPaste:Ne,onDrop:Te,className:(0,V.cn)(Ie,"empty:before:content-[attr(data-placeholder)] empty:before:text-gray-500 empty:before:dark:text-gray-400"),style:we,role:"textbox","aria-label":t,"aria-multiline":"true","aria-invalid":q.invalid||void 0,"aria-describedby":q.describedBy,tabIndex:u||a?-1:0}),O&&L.length>0&&(0,g.jsx)("div",{onMouseDown:e=>e.preventDefault(),className:"absolute z-10 mt-1 w-full max-h-60 overflow-auto rounded-lg border border-gray-300 bg-white dark:bg-gray-700 dark:border-gray-600 shadow-lg",children:xe?(0,g.jsx)("div",{className:"px-3 py-2 text-sm text-gray-500 dark:text-gray-400",children:Ce??Ee.mentionInputLoading}):L.slice(0,z).map((e,s)=>(0,g.jsx)("div",{onClick:()=>j(e),className:(0,V.cn)(s===P&&"bg-gray-100 dark:bg-gray-600"),children:ne?ne(e):Ke(e)},e.id))}),re.map(e=>(0,ce.createPortal)((0,g.jsx)(pe.Chip,{label:e.suggestion.label,variant:be,color:Me,size:ve,closable:!a&&!u,onClose:()=>U(e.element),disabled:a,avatar:e.suggestion.avatar?(0,g.jsx)("img",{src:e.suggestion.avatar,alt:e.suggestion.label,className:"w-full h-full object-cover"}):void 0}),e.element,e.key))]})})});he.displayName="MentionInput";0&&(module.exports={MentionInput});
1
+ "use strict";"use client";var J=Object.defineProperty;var He=Object.getOwnPropertyDescriptor;var Be=Object.getOwnPropertyNames;var Pe=Object.prototype.hasOwnProperty;var Ve=(t,n)=>{for(var l in n)J(t,l,{get:n[l],enumerable:!0})},$e=(t,n,l,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let c of Be(n))!Pe.call(t,c)&&c!==l&&J(t,c,{get:()=>n[c],enumerable:!(a=He(n,c))||a.enumerable});return t};var _e=t=>$e(J({},"__esModule",{value:!0}),t);var Qe={};Ve(Qe,{MentionInput:()=>ve});module.exports=_e(Qe);var i=require("react"),ge=require("react-dom"),_=require("../../../lib/cn.cjs"),Z=require("../../../lib/css-value.cjs"),me=require("../../../lib/i18n.cjs"),z=require("../shared/inputStyles.cjs"),he=require("../shared/field-error.cjs"),xe=require("../shared/InputWrapper.cjs"),Ce=require("../../chip/Chip.cjs"),p=require("react/jsx-runtime"),be=0,ze=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Me=t=>{let n=document.createElement("span");return n.contentEditable="false",n.setAttribute("data-mention-id",t.id),n.setAttribute("data-mention-label",t.label),t.avatar&&n.setAttribute("data-mention-avatar",t.avatar),n.className="inline-block align-middle mx-0.5",n.style.userSelect="none",n},Fe=(t,n)=>{if(typeof document.execCommand=="function")try{if(document.execCommand("insertText",!1,n))return!1}catch{}let l=t.ownerDocument.getSelection();if(!l||l.rangeCount===0)return!1;let a=l.getRangeAt(0);if(!t.contains(a.commonAncestorContainer))return!1;a.deleteContents();let c=t.ownerDocument.createDocumentFragment();n.split(`
2
+ `).forEach((s,u)=>{u>0&&c.appendChild(t.ownerDocument.createElement("br")),s&&c.appendChild(t.ownerDocument.createTextNode(s))});let x=c.lastChild;return a.insertNode(c),x&&(a.setStartAfter(x),a.collapse(!0),l.removeAllRanges(),l.addRange(a)),!0},Xe=t=>t.tagName==="DIV"||t.tagName==="P",Ke=(t,n,l)=>{let a="",c=[],x=!1,s=h=>{x&&a&&(a+=`
3
+ `),x=!1,a+=h},u=h=>{if(h.nodeType===Node.TEXT_NODE){h.textContent&&s(h.textContent);return}if(h.nodeType!==Node.ELEMENT_NODE)return;let M=h,D=l.get(M);if(D){let R=`@${D.label}`;s(""),c.push({trigger:n,suggestion:D,startIndex:a.length,endIndex:a.length+R.length}),a+=R;return}if(M.tagName==="BR"){s(M.nextSibling?`
4
+ `:"");return}let S=Xe(M);S&&a&&(x=!0),M.childNodes.forEach(u),S&&a&&(x=!0)};return t.childNodes.forEach(u),{text:a,mentions:c}},Oe=(t,n)=>{t.replaceChildren();let l=[],a=s=>{s.split(`
5
+ `).forEach((u,h)=>{h>0&&t.appendChild(document.createElement("br")),u&&t.appendChild(document.createTextNode(u))})},c=0,x=[...n.mentions].sort((s,u)=>s.startIndex-u.startIndex);for(let s of x){if(s.startIndex<c||s.endIndex>n.text.length||s.endIndex<s.startIndex)continue;a(n.text.slice(c,s.startIndex));let u=Me(s.suggestion);t.appendChild(u),l.push({key:`mention-${++be}`,element:u,suggestion:s.suggestion}),c=s.endIndex}return a(n.text.slice(c)),t.lastChild?.nodeName==="BR"&&t.appendChild(document.createElement("br")),l},qe=(t,n)=>t.text===n.text&&t.mentions.length===n.mentions.length&&t.mentions.every((l,a)=>l.suggestion.id===n.mentions[a].suggestion.id&&l.startIndex===n.mentions[a].startIndex&&l.endIndex===n.mentions[a].endIndex),We=t=>(0,p.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",children:[t.avatar&&(0,p.jsx)("img",{src:t.avatar,alt:"",className:"w-6 h-6 rounded-full"}),(0,p.jsx)("span",{className:"text-sm text-gray-900 dark:text-white",children:t.label})]}),ve=(0,i.forwardRef)(({label:t,inline:n=!1,size:l="md",labelColor:a,borderColor:c,textColor:x,disabled:s=!1,readOnly:u=!1,error:h,helperText:M,hideLabel:D=!1,icon:S,iconPosition:R="left",mentionTrigger:N="@",suggestions:L=[],onMentionSearch:ee,onMentionSelect:te,onMentionRemove:H,renderSuggestion:ne,value:k,onChange:w,placeholder:F,loading:re=!1,loadingLabel:ye,maxSuggestions:X=10,chipVariant:Ee="soft",chipColor:Ie="primary",chipSize:Se="sm"},B)=>{let K=(0,Z.safeCssColor)(c),O=(0,Z.safeCssColor)(x),A=(0,i.useId)(),oe=(0,me.useUILabels)(),ae=`${A}-suggestions`,se=e=>`${A}-suggestion-${e}`,q=(0,he.describeField)(A,{helperText:M,error:h}),g=(0,i.useRef)(null),[ie,Ne]=(0,i.useState)([]),C=(0,i.useRef)(ie),v=(0,i.useCallback)(e=>{e!==C.current&&(C.current=e,Ne(e))},[]),[P,V]=(0,i.useState)(!1),[T,W]=(0,i.useState)(0),[Ue,Q]=(0,i.useState)(""),we=(0,_.cn)((0,z.getBaseInputClasses)({size:l,error:q.invalid,disabled:s,readOnly:u,icon:S,iconPosition:R}),"min-h-[42px]","whitespace-pre-wrap","break-words"),Te={...K&&{borderColor:K},...O&&{color:O}},De=K||O?Te:void 0,y=(0,i.useCallback)(()=>{let e=g.current;if(!e)return{text:"",mentions:[]};let o=new Map(C.current.map(r=>[r.element,r.suggestion]));return Ke(e,N,o)},[N]),U=(0,i.useCallback)(e=>{let o=g.current;if(!o||!o.contains(e))return;let r=C.current.find(d=>d.element===e);r&&(e.remove(),v(C.current.filter(d=>d!==r)),w?.(y()),H?.(r.suggestion))},[y,w,H,v]),Y=(0,i.useCallback)(()=>{if(!g.current)return;let e=window.getSelection();if(!e||e.rangeCount===0)return;let o=e.getRangeAt(0),r="";o.startContainer.nodeType===Node.TEXT_NODE&&(r=o.startContainer.textContent?.substring(0,o.startOffset)||"");let d=r.match(new RegExp(`${ze(N)}([\\p{L}\\p{M}\\p{N}_]*)$`,"u"));if(d){let b=d[1];Q(b),V(!0),W(0),ee?.(b)}else V(!1),Q("");let f=g.current,m=C.current.filter(b=>!f.contains(b.element));m.length>0&&v(C.current.filter(b=>!m.includes(b)));let E=y();w?.(E),m.forEach(b=>H?.(b.suggestion))},[N,ee,w,H,y,v]),le=(0,i.useCallback)(e=>{let o=g.current;if(!o)return!1;let r=window.getSelection();if(!r||r.rangeCount===0)return!1;let d=r.getRangeAt(0);if(d.startContainer.nodeType!==Node.TEXT_NODE||!o.contains(d.startContainer))return!1;let f=d.startContainer,m=f.textContent||"",E=d.startOffset,ue=m.substring(0,E).lastIndexOf(N);if(ue===-1)return!1;let de=m.substring(0,ue),fe=m.substring(E),I=Me(e);if(v([...C.current,{key:`mention-${++be}`,element:I,suggestion:e}]),de?(f.textContent=de,f.parentNode?.insertBefore(I,f.nextSibling)):(f.parentNode?.insertBefore(I,f),f.remove()),fe){let Ae=document.createTextNode(fe);I.parentNode?.insertBefore(Ae,I.nextSibling)}let pe=document.createTextNode(" ");I.parentNode?.insertBefore(pe,I.nextSibling);let G=document.createRange();return G.setStartAfter(pe),G.collapse(!0),r.removeAllRanges(),r.addRange(G),!0},[N,v]),j=(0,i.useCallback)(e=>{let o=le(e);if(V(!1),Q(""),!o)return;let r=y();w?.(r),te?.(e),g.current?.focus()},[le,y,w,te]),$=(0,i.useCallback)(e=>{let o=g.current;!o||s||u||Fe(o,e)&&Y()},[s,u,Y]),Re=(0,i.useCallback)(e=>{e.preventDefault(),$(e.clipboardData.getData("text/plain"))},[$]),Le=(0,i.useCallback)(e=>{e.preventDefault();let o=e.dataTransfer.getData("text/plain");if(!o)return;let r=e.currentTarget.ownerDocument,d=r.caretRangeFromPoint?.(e.clientX,e.clientY)??(()=>{let m=r.caretPositionFromPoint?.(e.clientX,e.clientY);if(!m)return null;let E=r.createRange();return E.setStart(m.offsetNode,m.offset),E})(),f=r.getSelection();d&&f&&e.currentTarget.contains(d.startContainer)&&(f.removeAllRanges(),f.addRange(d)),$(o)},[$]),ke=(0,i.useCallback)(e=>{let o=L.slice(0,X);if(P&&o.length>0)switch(e.key){case"ArrowDown":e.preventDefault(),W(r=>r<o.length-1?r+1:0);return;case"ArrowUp":e.preventDefault(),W(r=>r>0?r-1:o.length-1);return;case"Enter":case"Tab":e.preventDefault(),o[T]&&j(o[T]);return;case"Escape":e.preventDefault(),V(!1);return}if(e.key==="Backspace"){let r=window.getSelection();if(!r||r.rangeCount===0)return;let d=r.getRangeAt(0);if(!d.collapsed||d.startOffset!==0)return;let f=d.startContainer.previousSibling;f&&C.current.some(m=>m.element===f)&&(e.preventDefault(),U(f))}},[P,L,T,X,j,U]);(0,i.useLayoutEffect)(()=>{let e=g.current;!e||k===void 0||qe(k,y())||v(Oe(e,k))},[k,y,v]),(0,i.useEffect)(()=>{g.current&&(!(g.current.textContent||g.current.querySelector("[data-mention-id]"))&&F?g.current.setAttribute("data-placeholder",F):g.current.removeAttribute("data-placeholder"))},[F,k]);let ce=P&&L.length>0&&!re;return(0,p.jsx)(xe.InputWrapper,{label:t,hideLabel:D,labelColor:a,error:h,helperText:M,inline:n,htmlFor:A,children:(0,p.jsxs)("div",{className:"relative w-full",children:[S&&(0,p.jsx)("span",{className:(0,z.getIconClasses)(R),children:S}),(0,p.jsx)("div",{ref:e=>{typeof B=="function"?B(e):B&&(B.current=e),g.current=e},id:A,contentEditable:!s&&!u,suppressContentEditableWarning:!0,onInput:Y,onKeyDown:ke,onPaste:Re,onDrop:Le,className:(0,_.cn)(we,"empty:before:content-[attr(data-placeholder)] empty:before:text-gray-500 empty:before:dark:text-gray-400"),style:De,role:"textbox","aria-label":t,"aria-multiline":"true","aria-controls":ce?ae:void 0,"aria-activedescendant":ce?se(T):void 0,"aria-invalid":q.invalid||void 0,"aria-describedby":q.describedBy,tabIndex:u||s?-1:0}),P&&L.length>0&&(0,p.jsx)("div",{onMouseDown:e=>e.preventDefault(),className:"absolute z-10 mt-1 w-full max-h-60 overflow-auto rounded-lg border border-gray-300 bg-white dark:bg-gray-700 dark:border-gray-600 shadow-lg",children:re?(0,p.jsx)("div",{role:"status",className:"px-3 py-2 text-sm text-gray-500 dark:text-gray-400",children:ye??oe.mentionInputLoading}):(0,p.jsx)("div",{role:"listbox",id:ae,"aria-label":oe.mentionInputSuggestions,children:L.slice(0,X).map((e,o)=>(0,p.jsx)("div",{id:se(o),role:"option","aria-selected":o===T,onClick:()=>j(e),className:(0,_.cn)(o===T&&"bg-gray-100 dark:bg-gray-600"),children:ne?ne(e):We(e)},e.id))})}),ie.map(e=>(0,ge.createPortal)((0,p.jsx)(Ce.Chip,{label:e.suggestion.label,variant:Ee,color:Ie,size:Se,closable:!s&&!u,onClose:()=>U(e.element),disabled:s,avatar:e.suggestion.avatar?(0,p.jsx)("img",{src:e.suggestion.avatar,alt:e.suggestion.label,className:"w-full h-full object-cover"}):void 0}),e.element,e.key))]})})});ve.displayName="MentionInput";0&&(module.exports={MentionInput});
@@ -1,5 +1,5 @@
1
- "use client";import{forwardRef as we,useCallback as h,useEffect as Ne,useId as Te,useLayoutEffect as De,useRef as ie,useState as V}from"react";import{createPortal as Re}from"react-dom";import{cn as G}from"../../../lib/cn.js";import{safeCssColor as le}from"../../../lib/css-value.js";import{useUILabels as Le}from"../../../lib/i18n.js";import{getBaseInputClasses as ke,getIconClasses as Ae}from"../shared/inputStyles.js";import{describeField as He}from"../shared/field-error.js";import{InputWrapper as Pe}from"../shared/InputWrapper.js";import{Chip as Be}from"../../chip/Chip.js";import{jsx as x,jsxs as de}from"react/jsx-runtime";var ce=0,Ve=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),ue=t=>{let a=document.createElement("span");return a.contentEditable="false",a.setAttribute("data-mention-id",t.id),a.setAttribute("data-mention-label",t.label),t.avatar&&a.setAttribute("data-mention-avatar",t.avatar),a.className="inline-block align-middle mx-0.5",a.style.userSelect="none",a},$e=(t,a)=>{if(typeof document.execCommand=="function")try{if(document.execCommand("insertText",!1,a))return!1}catch{}let u=t.ownerDocument.getSelection();if(!u||u.rangeCount===0)return!1;let s=u.getRangeAt(0);if(!t.contains(s.commonAncestorContainer))return!1;s.deleteContents();let d=t.ownerDocument.createDocumentFragment();a.split(`
2
- `).forEach((r,i)=>{i>0&&d.appendChild(t.ownerDocument.createElement("br")),r&&d.appendChild(t.ownerDocument.createTextNode(r))});let m=d.lastChild;return s.insertNode(d),m&&(s.setStartAfter(m),s.collapse(!0),u.removeAllRanges(),u.addRange(s)),!0},_e=t=>t.tagName==="DIV"||t.tagName==="P",ze=(t,a,u)=>{let s="",d=[],m=!1,r=g=>{m&&s&&(s+=`
3
- `),m=!1,s+=g},i=g=>{if(g.nodeType===Node.TEXT_NODE){g.textContent&&r(g.textContent);return}if(g.nodeType!==Node.ELEMENT_NODE)return;let M=g,T=u.get(M);if(T){let D=`@${T.label}`;r(""),d.push({trigger:a,suggestion:T,startIndex:s.length,endIndex:s.length+D.length}),s+=D;return}if(M.tagName==="BR"){r(M.nextSibling?`
4
- `:"");return}let S=_e(M);S&&s&&(m=!0),M.childNodes.forEach(i),S&&s&&(m=!0)};return t.childNodes.forEach(i),{text:s,mentions:d}},Fe=(t,a)=>{t.replaceChildren();let u=[],s=r=>{r.split(`
5
- `).forEach((i,g)=>{g>0&&t.appendChild(document.createElement("br")),i&&t.appendChild(document.createTextNode(i))})},d=0,m=[...a.mentions].sort((r,i)=>r.startIndex-i.startIndex);for(let r of m){if(r.startIndex<d||r.endIndex>a.text.length||r.endIndex<r.startIndex)continue;s(a.text.slice(d,r.startIndex));let i=ue(r.suggestion);t.appendChild(i),u.push({key:`mention-${++ce}`,element:i,suggestion:r.suggestion}),d=r.endIndex}return s(a.text.slice(d)),t.lastChild?.nodeName==="BR"&&t.appendChild(document.createElement("br")),u},Xe=(t,a)=>t.text===a.text&&t.mentions.length===a.mentions.length&&t.mentions.every((u,s)=>u.suggestion.id===a.mentions[s].suggestion.id&&u.startIndex===a.mentions[s].startIndex&&u.endIndex===a.mentions[s].endIndex),Ke=t=>de("div",{className:"flex items-center gap-2 px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",children:[t.avatar&&x("img",{src:t.avatar,alt:t.label,className:"w-6 h-6 rounded-full"}),x("span",{className:"text-sm text-gray-900 dark:text-white",children:t.label})]}),qe=we(({label:t,inline:a=!1,size:u="md",labelColor:s,borderColor:d,textColor:m,disabled:r=!1,readOnly:i=!1,error:g,helperText:M,hideLabel:T=!1,icon:S,iconPosition:D="left",mentionTrigger:w="@",suggestions:L=[],onMentionSearch:J,onMentionSelect:Z,onMentionRemove:k,renderSuggestion:ee,value:R,onChange:N,placeholder:$,loading:fe=!1,loadingLabel:pe,maxSuggestions:_=10,chipVariant:ge="soft",chipColor:me="primary",chipSize:he="sm"},A)=>{let z=le(d),F=le(m),X=Te(),xe=Le(),K=He(X,{helperText:M,error:g}),f=ie(null),[te,Ce]=V([]),C=ie(te),v=h(e=>{e!==C.current&&(C.current=e,Ce(e))},[]),[q,H]=V(!1),[P,O]=V(0),[Oe,W]=V(""),be=G(ke({size:u,error:K.invalid,disabled:r,readOnly:i,icon:S,iconPosition:D}),"min-h-[42px]","whitespace-pre-wrap","break-words"),Me={...z&&{borderColor:z},...F&&{color:F}},ve=z||F?Me:void 0,E=h(()=>{let e=f.current;if(!e)return{text:"",mentions:[]};let o=new Map(C.current.map(n=>[n.element,n.suggestion]));return ze(e,w,o)},[w]),Q=h(e=>{let o=f.current;if(!o||!o.contains(e))return;let n=C.current.find(l=>l.element===e);n&&(e.remove(),v(C.current.filter(l=>l!==n)),N?.(E()),k?.(n.suggestion))},[E,N,k,v]),U=h(()=>{if(!f.current)return;let e=window.getSelection();if(!e||e.rangeCount===0)return;let o=e.getRangeAt(0),n="";o.startContainer.nodeType===Node.TEXT_NODE&&(n=o.startContainer.textContent?.substring(0,o.startOffset)||"");let l=n.match(new RegExp(`${Ve(w)}([\\p{L}\\p{M}\\p{N}_]*)$`,"u"));if(l){let b=l[1];W(b),H(!0),O(0),J?.(b)}else H(!1),W("");let c=f.current,p=C.current.filter(b=>!c.contains(b.element));p.length>0&&v(C.current.filter(b=>!p.includes(b)));let y=E();N?.(y),p.forEach(b=>k?.(b.suggestion))},[w,J,N,k,E,v]),ne=h(e=>{let o=f.current;if(!o)return!1;let n=window.getSelection();if(!n||n.rangeCount===0)return!1;let l=n.getRangeAt(0);if(l.startContainer.nodeType!==Node.TEXT_NODE||!o.contains(l.startContainer))return!1;let c=l.startContainer,p=c.textContent||"",y=l.startOffset,re=p.substring(0,y).lastIndexOf(w);if(re===-1)return!1;let oe=p.substring(0,re),ae=p.substring(y),I=ue(e);if(v([...C.current,{key:`mention-${++ce}`,element:I,suggestion:e}]),oe?(c.textContent=oe,c.parentNode?.insertBefore(I,c.nextSibling)):(c.parentNode?.insertBefore(I,c),c.remove()),ae){let Se=document.createTextNode(ae);I.parentNode?.insertBefore(Se,I.nextSibling)}let se=document.createTextNode(" ");I.parentNode?.insertBefore(se,I.nextSibling);let j=document.createRange();return j.setStartAfter(se),j.collapse(!0),n.removeAllRanges(),n.addRange(j),!0},[w,v]),Y=h(e=>{let o=ne(e);if(H(!1),W(""),!o)return;let n=E();N?.(n),Z?.(e),f.current?.focus()},[ne,E,N,Z]),B=h(e=>{let o=f.current;!o||r||i||$e(o,e)&&U()},[r,i,U]),Ee=h(e=>{e.preventDefault(),B(e.clipboardData.getData("text/plain"))},[B]),ye=h(e=>{e.preventDefault();let o=e.dataTransfer.getData("text/plain");if(!o)return;let n=e.currentTarget.ownerDocument,l=n.caretRangeFromPoint?.(e.clientX,e.clientY)??(()=>{let p=n.caretPositionFromPoint?.(e.clientX,e.clientY);if(!p)return null;let y=n.createRange();return y.setStart(p.offsetNode,p.offset),y})(),c=n.getSelection();l&&c&&e.currentTarget.contains(l.startContainer)&&(c.removeAllRanges(),c.addRange(l)),B(o)},[B]),Ie=h(e=>{let o=L.slice(0,_);if(q&&o.length>0)switch(e.key){case"ArrowDown":e.preventDefault(),O(n=>n<o.length-1?n+1:0);return;case"ArrowUp":e.preventDefault(),O(n=>n>0?n-1:o.length-1);return;case"Enter":case"Tab":e.preventDefault(),o[P]&&Y(o[P]);return;case"Escape":e.preventDefault(),H(!1);return}if(e.key==="Backspace"){let n=window.getSelection();if(!n||n.rangeCount===0)return;let l=n.getRangeAt(0);if(!l.collapsed||l.startOffset!==0)return;let c=l.startContainer.previousSibling;c&&C.current.some(p=>p.element===c)&&(e.preventDefault(),Q(c))}},[q,L,P,_,Y,Q]);return De(()=>{let e=f.current;!e||R===void 0||Xe(R,E())||v(Fe(e,R))},[R,E,v]),Ne(()=>{f.current&&(!(f.current.textContent||f.current.querySelector("[data-mention-id]"))&&$?f.current.setAttribute("data-placeholder",$):f.current.removeAttribute("data-placeholder"))},[$,R]),x(Pe,{label:t,hideLabel:T,labelColor:s,error:g,helperText:M,inline:a,htmlFor:X,children:de("div",{className:"relative w-full",children:[S&&x("span",{className:Ae(D),children:S}),x("div",{ref:e=>{typeof A=="function"?A(e):A&&(A.current=e),f.current=e},id:X,contentEditable:!r&&!i,suppressContentEditableWarning:!0,onInput:U,onKeyDown:Ie,onPaste:Ee,onDrop:ye,className:G(be,"empty:before:content-[attr(data-placeholder)] empty:before:text-gray-500 empty:before:dark:text-gray-400"),style:ve,role:"textbox","aria-label":t,"aria-multiline":"true","aria-invalid":K.invalid||void 0,"aria-describedby":K.describedBy,tabIndex:i||r?-1:0}),q&&L.length>0&&x("div",{onMouseDown:e=>e.preventDefault(),className:"absolute z-10 mt-1 w-full max-h-60 overflow-auto rounded-lg border border-gray-300 bg-white dark:bg-gray-700 dark:border-gray-600 shadow-lg",children:fe?x("div",{className:"px-3 py-2 text-sm text-gray-500 dark:text-gray-400",children:pe??xe.mentionInputLoading}):L.slice(0,_).map((e,o)=>x("div",{onClick:()=>Y(e),className:G(o===P&&"bg-gray-100 dark:bg-gray-600"),children:ee?ee(e):Ke(e)},e.id))}),te.map(e=>Re(x(Be,{label:e.suggestion.label,variant:ge,color:me,size:he,closable:!r&&!i,onClose:()=>Q(e.element),disabled:r,avatar:e.suggestion.avatar?x("img",{src:e.suggestion.avatar,alt:e.suggestion.label,className:"w-full h-full object-cover"}):void 0}),e.element,e.key))]})})});qe.displayName="MentionInput";export{qe as MentionInput};
1
+ "use client";import{forwardRef as De,useCallback as x,useEffect as Re,useId as Le,useLayoutEffect as ke,useRef as fe,useState as _}from"react";import{createPortal as Ae}from"react-dom";import{cn as G}from"../../../lib/cn.js";import{safeCssColor as pe}from"../../../lib/css-value.js";import{useUILabels as He}from"../../../lib/i18n.js";import{getBaseInputClasses as Be,getIconClasses as Pe}from"../shared/inputStyles.js";import{describeField as Ve}from"../shared/field-error.js";import{InputWrapper as $e}from"../shared/InputWrapper.js";import{Chip as _e}from"../../chip/Chip.js";import{jsx as h,jsxs as he}from"react/jsx-runtime";var ge=0,ze=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),me=t=>{let a=document.createElement("span");return a.contentEditable="false",a.setAttribute("data-mention-id",t.id),a.setAttribute("data-mention-label",t.label),t.avatar&&a.setAttribute("data-mention-avatar",t.avatar),a.className="inline-block align-middle mx-0.5",a.style.userSelect="none",a},Fe=(t,a)=>{if(typeof document.execCommand=="function")try{if(document.execCommand("insertText",!1,a))return!1}catch{}let u=t.ownerDocument.getSelection();if(!u||u.rangeCount===0)return!1;let s=u.getRangeAt(0);if(!t.contains(s.commonAncestorContainer))return!1;s.deleteContents();let d=t.ownerDocument.createDocumentFragment();a.split(`
2
+ `).forEach((o,i)=>{i>0&&d.appendChild(t.ownerDocument.createElement("br")),o&&d.appendChild(t.ownerDocument.createTextNode(o))});let m=d.lastChild;return s.insertNode(d),m&&(s.setStartAfter(m),s.collapse(!0),u.removeAllRanges(),u.addRange(s)),!0},Xe=t=>t.tagName==="DIV"||t.tagName==="P",Ke=(t,a,u)=>{let s="",d=[],m=!1,o=g=>{m&&s&&(s+=`
3
+ `),m=!1,s+=g},i=g=>{if(g.nodeType===Node.TEXT_NODE){g.textContent&&o(g.textContent);return}if(g.nodeType!==Node.ELEMENT_NODE)return;let M=g,D=u.get(M);if(D){let R=`@${D.label}`;o(""),d.push({trigger:a,suggestion:D,startIndex:s.length,endIndex:s.length+R.length}),s+=R;return}if(M.tagName==="BR"){o(M.nextSibling?`
4
+ `:"");return}let S=Xe(M);S&&s&&(m=!0),M.childNodes.forEach(i),S&&s&&(m=!0)};return t.childNodes.forEach(i),{text:s,mentions:d}},Oe=(t,a)=>{t.replaceChildren();let u=[],s=o=>{o.split(`
5
+ `).forEach((i,g)=>{g>0&&t.appendChild(document.createElement("br")),i&&t.appendChild(document.createTextNode(i))})},d=0,m=[...a.mentions].sort((o,i)=>o.startIndex-i.startIndex);for(let o of m){if(o.startIndex<d||o.endIndex>a.text.length||o.endIndex<o.startIndex)continue;s(a.text.slice(d,o.startIndex));let i=me(o.suggestion);t.appendChild(i),u.push({key:`mention-${++ge}`,element:i,suggestion:o.suggestion}),d=o.endIndex}return s(a.text.slice(d)),t.lastChild?.nodeName==="BR"&&t.appendChild(document.createElement("br")),u},qe=(t,a)=>t.text===a.text&&t.mentions.length===a.mentions.length&&t.mentions.every((u,s)=>u.suggestion.id===a.mentions[s].suggestion.id&&u.startIndex===a.mentions[s].startIndex&&u.endIndex===a.mentions[s].endIndex),We=t=>he("div",{className:"flex items-center gap-2 px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",children:[t.avatar&&h("img",{src:t.avatar,alt:"",className:"w-6 h-6 rounded-full"}),h("span",{className:"text-sm text-gray-900 dark:text-white",children:t.label})]}),Qe=De(({label:t,inline:a=!1,size:u="md",labelColor:s,borderColor:d,textColor:m,disabled:o=!1,readOnly:i=!1,error:g,helperText:M,hideLabel:D=!1,icon:S,iconPosition:R="left",mentionTrigger:N="@",suggestions:L=[],onMentionSearch:J,onMentionSelect:Z,onMentionRemove:H,renderSuggestion:ee,value:k,onChange:w,placeholder:z,loading:te=!1,loadingLabel:xe,maxSuggestions:F=10,chipVariant:Ce="soft",chipColor:be="primary",chipSize:Me="sm"},B)=>{let X=pe(d),K=pe(m),A=Le(),ne=He(),re=`${A}-suggestions`,oe=e=>`${A}-suggestion-${e}`,O=Ve(A,{helperText:M,error:g}),f=fe(null),[ae,ve]=_([]),C=fe(ae),v=x(e=>{e!==C.current&&(C.current=e,ve(e))},[]),[P,V]=_(!1),[T,q]=_(0),[Ue,W]=_(""),ye=G(Be({size:u,error:O.invalid,disabled:o,readOnly:i,icon:S,iconPosition:R}),"min-h-[42px]","whitespace-pre-wrap","break-words"),Ee={...X&&{borderColor:X},...K&&{color:K}},Ie=X||K?Ee:void 0,y=x(()=>{let e=f.current;if(!e)return{text:"",mentions:[]};let r=new Map(C.current.map(n=>[n.element,n.suggestion]));return Ke(e,N,r)},[N]),Q=x(e=>{let r=f.current;if(!r||!r.contains(e))return;let n=C.current.find(l=>l.element===e);n&&(e.remove(),v(C.current.filter(l=>l!==n)),w?.(y()),H?.(n.suggestion))},[y,w,H,v]),U=x(()=>{if(!f.current)return;let e=window.getSelection();if(!e||e.rangeCount===0)return;let r=e.getRangeAt(0),n="";r.startContainer.nodeType===Node.TEXT_NODE&&(n=r.startContainer.textContent?.substring(0,r.startOffset)||"");let l=n.match(new RegExp(`${ze(N)}([\\p{L}\\p{M}\\p{N}_]*)$`,"u"));if(l){let b=l[1];W(b),V(!0),q(0),J?.(b)}else V(!1),W("");let c=f.current,p=C.current.filter(b=>!c.contains(b.element));p.length>0&&v(C.current.filter(b=>!p.includes(b)));let E=y();w?.(E),p.forEach(b=>H?.(b.suggestion))},[N,J,w,H,y,v]),se=x(e=>{let r=f.current;if(!r)return!1;let n=window.getSelection();if(!n||n.rangeCount===0)return!1;let l=n.getRangeAt(0);if(l.startContainer.nodeType!==Node.TEXT_NODE||!r.contains(l.startContainer))return!1;let c=l.startContainer,p=c.textContent||"",E=l.startOffset,le=p.substring(0,E).lastIndexOf(N);if(le===-1)return!1;let ce=p.substring(0,le),ue=p.substring(E),I=me(e);if(v([...C.current,{key:`mention-${++ge}`,element:I,suggestion:e}]),ce?(c.textContent=ce,c.parentNode?.insertBefore(I,c.nextSibling)):(c.parentNode?.insertBefore(I,c),c.remove()),ue){let Te=document.createTextNode(ue);I.parentNode?.insertBefore(Te,I.nextSibling)}let de=document.createTextNode(" ");I.parentNode?.insertBefore(de,I.nextSibling);let j=document.createRange();return j.setStartAfter(de),j.collapse(!0),n.removeAllRanges(),n.addRange(j),!0},[N,v]),Y=x(e=>{let r=se(e);if(V(!1),W(""),!r)return;let n=y();w?.(n),Z?.(e),f.current?.focus()},[se,y,w,Z]),$=x(e=>{let r=f.current;!r||o||i||Fe(r,e)&&U()},[o,i,U]),Se=x(e=>{e.preventDefault(),$(e.clipboardData.getData("text/plain"))},[$]),Ne=x(e=>{e.preventDefault();let r=e.dataTransfer.getData("text/plain");if(!r)return;let n=e.currentTarget.ownerDocument,l=n.caretRangeFromPoint?.(e.clientX,e.clientY)??(()=>{let p=n.caretPositionFromPoint?.(e.clientX,e.clientY);if(!p)return null;let E=n.createRange();return E.setStart(p.offsetNode,p.offset),E})(),c=n.getSelection();l&&c&&e.currentTarget.contains(l.startContainer)&&(c.removeAllRanges(),c.addRange(l)),$(r)},[$]),we=x(e=>{let r=L.slice(0,F);if(P&&r.length>0)switch(e.key){case"ArrowDown":e.preventDefault(),q(n=>n<r.length-1?n+1:0);return;case"ArrowUp":e.preventDefault(),q(n=>n>0?n-1:r.length-1);return;case"Enter":case"Tab":e.preventDefault(),r[T]&&Y(r[T]);return;case"Escape":e.preventDefault(),V(!1);return}if(e.key==="Backspace"){let n=window.getSelection();if(!n||n.rangeCount===0)return;let l=n.getRangeAt(0);if(!l.collapsed||l.startOffset!==0)return;let c=l.startContainer.previousSibling;c&&C.current.some(p=>p.element===c)&&(e.preventDefault(),Q(c))}},[P,L,T,F,Y,Q]);ke(()=>{let e=f.current;!e||k===void 0||qe(k,y())||v(Oe(e,k))},[k,y,v]),Re(()=>{f.current&&(!(f.current.textContent||f.current.querySelector("[data-mention-id]"))&&z?f.current.setAttribute("data-placeholder",z):f.current.removeAttribute("data-placeholder"))},[z,k]);let ie=P&&L.length>0&&!te;return h($e,{label:t,hideLabel:D,labelColor:s,error:g,helperText:M,inline:a,htmlFor:A,children:he("div",{className:"relative w-full",children:[S&&h("span",{className:Pe(R),children:S}),h("div",{ref:e=>{typeof B=="function"?B(e):B&&(B.current=e),f.current=e},id:A,contentEditable:!o&&!i,suppressContentEditableWarning:!0,onInput:U,onKeyDown:we,onPaste:Se,onDrop:Ne,className:G(ye,"empty:before:content-[attr(data-placeholder)] empty:before:text-gray-500 empty:before:dark:text-gray-400"),style:Ie,role:"textbox","aria-label":t,"aria-multiline":"true","aria-controls":ie?re:void 0,"aria-activedescendant":ie?oe(T):void 0,"aria-invalid":O.invalid||void 0,"aria-describedby":O.describedBy,tabIndex:i||o?-1:0}),P&&L.length>0&&h("div",{onMouseDown:e=>e.preventDefault(),className:"absolute z-10 mt-1 w-full max-h-60 overflow-auto rounded-lg border border-gray-300 bg-white dark:bg-gray-700 dark:border-gray-600 shadow-lg",children:te?h("div",{role:"status",className:"px-3 py-2 text-sm text-gray-500 dark:text-gray-400",children:xe??ne.mentionInputLoading}):h("div",{role:"listbox",id:re,"aria-label":ne.mentionInputSuggestions,children:L.slice(0,F).map((e,r)=>h("div",{id:oe(r),role:"option","aria-selected":r===T,onClick:()=>Y(e),className:G(r===T&&"bg-gray-100 dark:bg-gray-600"),children:ee?ee(e):We(e)},e.id))})}),ae.map(e=>Ae(h(_e,{label:e.suggestion.label,variant:Ce,color:be,size:Me,closable:!o&&!i,onClose:()=>Q(e.element),disabled:o,avatar:e.suggestion.avatar?h("img",{src:e.suggestion.avatar,alt:e.suggestion.label,className:"w-full h-full object-cover"}):void 0}),e.element,e.key))]})})});Qe.displayName="MentionInput";export{Qe as MentionInput};
@@ -1,4 +1,4 @@
1
- "use strict";"use client";var Z=Object.create;var R=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var re=Object.getPrototypeOf,oe=Object.prototype.hasOwnProperty;var ae=(r,t)=>{for(var n in t)R(r,n,{get:t[n],enumerable:!0})},z=(r,t,n,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of te(t))!oe.call(r,s)&&s!==n&&R(r,s,{get:()=>t[s],enumerable:!(l=ee(t,s))||l.enumerable});return r};var A=(r,t,n)=>(n=r!=null?Z(re(r)):{},z(t||!r||!r.__esModule?R(n,"default",{value:r,enumerable:!0}):n,r)),ne=r=>z(R({},"__esModule",{value:!0}),r);var xe={};ae(xe,{HelpButton:()=>F,WithHelpButton:()=>be});module.exports=ne(xe);var a=require("react"),U=require("react-dom"),j=A(require("react-markdown"),1),K=A(require("remark-gfm"),1),$=require("../../lib/i18n.cjs"),G=require("./sanitize-html.cjs"),q=require("../dropdown/hooks/usePositioning.cjs"),V=require("../../lib/aria-hide.cjs"),I=require("../../lib/owner-document.cjs"),D=require("../../lib/cn.cjs"),e=require("react/jsx-runtime"),se=(0,e.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,e.jsx)("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),(0,e.jsx)("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),le=(0,e.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,e.jsx)("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),(0,e.jsx)("polyline",{points:"17 21 17 13 7 13 7 21"}),(0,e.jsx)("polyline",{points:"7 3 7 8 15 8"})]}),ie=(0,e.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,e.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,e.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),de=(0,e.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,e.jsx)("polyline",{points:"1 4 1 10 7 10"}),(0,e.jsx)("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]}),ce=(0,e.jsxs)("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,e.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10"}),(0,e.jsx)("path",{className:"opacity-75",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z",fill:"currentColor"})]}),ue={xs:"w-4 h-4 text-[10px]",sm:"w-5 h-5 text-xs",md:"w-6 h-6 text-sm",lg:"w-7 h-7 text-base"},me={sm:"w-56",md:"w-72",lg:"w-96",xl:"w-[32rem]"},ge=[K.default],pe=["img"],ye={h1:({node:r,...t})=>(0,e.jsx)("h1",{className:"text-xl font-bold mb-2 text-gray-900 dark:text-gray-100",...t}),h2:({node:r,...t})=>(0,e.jsx)("h2",{className:"text-lg font-semibold mt-4 mb-2 text-gray-900 dark:text-gray-100",...t}),h3:({node:r,...t})=>(0,e.jsx)("h3",{className:"text-base font-semibold mt-3 mb-1 text-gray-900 dark:text-gray-100",...t}),p:({node:r,...t})=>(0,e.jsx)("p",{className:"my-1 text-gray-700 dark:text-gray-300",...t}),ul:({node:r,...t})=>(0,e.jsx)("ul",{className:"list-disc list-inside space-y-1 my-2 text-gray-700 dark:text-gray-300",...t}),ol:({node:r,...t})=>(0,e.jsx)("ol",{className:"list-decimal list-inside space-y-1 my-2 text-gray-700 dark:text-gray-300",...t}),code:({node:r,className:t,children:n,...l})=>!t?.includes("language-")?(0,e.jsx)("code",{className:"bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded text-sm font-mono text-gray-900 dark:text-gray-100",...l,children:n}):(0,e.jsx)("code",{className:"block bg-gray-100 dark:bg-gray-800 rounded-lg p-3 my-2 overflow-x-auto text-sm font-mono text-gray-900 dark:text-gray-100",...l,children:n}),pre:({node:r,...t})=>(0,e.jsx)("pre",{className:"my-2",...t}),a:({node:r,...t})=>(0,e.jsx)("a",{className:"text-synertech-primary-600 dark:text-synertech-primary-400 hover:underline",...t}),strong:({node:r,...t})=>(0,e.jsx)("strong",{className:"font-semibold text-gray-900 dark:text-gray-100",...t}),em:({node:r,...t})=>(0,e.jsx)("em",{className:"italic",...t}),blockquote:({node:r,...t})=>(0,e.jsx)("blockquote",{className:"border-l-4 border-gray-300 dark:border-gray-600 pl-4 my-2 italic text-gray-600 dark:text-gray-400",...t})};function F({content:r,markdown:t=!1,position:n="bottom",size:l="sm",className:s="",visible:i=!0,editable:u=!1,onSave:b,onReset:g,width:H="md",title:x,markdownEditor:N,markdownEditorUnavailableLabel:L,labels:M}){let o=(0,$.useUILabels)(M),[h,_]=(0,a.useState)(!1),[m,v]=(0,a.useState)(!1),[w,k]=(0,a.useState)(""),[O,E]=(0,a.useState)(!1),[S,d]=(0,a.useState)(null),p=(0,a.useRef)(null),P=(0,a.useRef)(null),T=(0,a.useRef)(null),c=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(!h)return;let y=f=>{p.current&&!p.current.contains(f.target)&&P.current&&!P.current.contains(f.target)&&(m||_(!1))},W=f=>{if(f.key==="Escape"){if(f.defaultPrevented)return;f.preventDefault(),m?(v(!1),k("")):_(!1)}},B=(0,I.ownerDocumentOf)(p.current);return B.addEventListener("mousedown",y),B.addEventListener("keydown",W),()=>{B.removeEventListener("mousedown",y),B.removeEventListener("keydown",W)}},[h,m]),(0,a.useEffect)(()=>{m&&T.current&&T.current.focus()},[m]),(0,a.useEffect)(()=>()=>{c.current&&clearTimeout(c.current)},[]);let J=(0,a.useCallback)(()=>{k(typeof r=="string"?r:""),v(!0),d(null)},[r]),Q=(0,a.useCallback)(()=>{v(!1),k(""),d(null)},[]),X=(0,a.useCallback)(async()=>{if(!b){d({type:"error",text:o.helpButtonNoSave});return}E(!0);try{await b(w)?(d({type:"success",text:o.helpButtonSaved}),v(!1),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>d(null),2e3)):d({type:"error",text:o.helpButtonSaveError})}catch{d({type:"error",text:o.helpButtonSaveError})}finally{E(!1)}},[w,b,o]),Y=(0,a.useCallback)(async()=>{if(g&&confirm(o.helpButtonResetConfirm)){E(!0);try{await g()?(d({type:"success",text:o.helpButtonResetDone}),v(!1),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>d(null),2e3)):d({type:"error",text:o.helpButtonResetError})}catch{d({type:"error",text:o.helpButtonResetError})}finally{E(!1)}}},[g,o]),C=r;return i?(0,e.jsxs)("div",{className:"relative inline-flex items-center",children:[(0,e.jsx)("button",{type:"button",ref:p,onClick:()=>_(!h),className:`
1
+ "use strict";"use client";var Z=Object.create;var R=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var re=Object.getPrototypeOf,oe=Object.prototype.hasOwnProperty;var ae=(r,t)=>{for(var o in t)R(r,o,{get:t[o],enumerable:!0})},z=(r,t,o,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of te(t))!oe.call(r,s)&&s!==o&&R(r,s,{get:()=>t[s],enumerable:!(l=ee(t,s))||l.enumerable});return r};var A=(r,t,o)=>(o=r!=null?Z(re(r)):{},z(t||!r||!r.__esModule?R(o,"default",{value:r,enumerable:!0}):o,r)),ne=r=>z(R({},"__esModule",{value:!0}),r);var xe={};ae(xe,{HelpButton:()=>F,WithHelpButton:()=>be});module.exports=ne(xe);var n=require("react"),U=require("react-dom"),j=A(require("react-markdown"),1),K=A(require("remark-gfm"),1),$=require("../../lib/i18n.cjs"),G=require("./sanitize-html.cjs"),q=require("../dropdown/hooks/usePositioning.cjs"),V=require("../../lib/aria-hide.cjs"),I=require("../../lib/owner-document.cjs"),D=require("../../lib/cn.cjs"),e=require("react/jsx-runtime"),se=(0,e.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,e.jsx)("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),(0,e.jsx)("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),le=(0,e.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,e.jsx)("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),(0,e.jsx)("polyline",{points:"17 21 17 13 7 13 7 21"}),(0,e.jsx)("polyline",{points:"7 3 7 8 15 8"})]}),ie=(0,e.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,e.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,e.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),de=(0,e.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,e.jsx)("polyline",{points:"1 4 1 10 7 10"}),(0,e.jsx)("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]}),ce=(0,e.jsxs)("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,e.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10"}),(0,e.jsx)("path",{className:"opacity-75",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z",fill:"currentColor"})]}),ue={xs:"w-4 h-4 text-[10px]",sm:"w-5 h-5 text-xs",md:"w-6 h-6 text-sm",lg:"w-7 h-7 text-base"},me={sm:"w-56",md:"w-72",lg:"w-96",xl:"w-[32rem]"},ge=[K.default],pe=["img"],ye={h1:({node:r,children:t,...o})=>(0,e.jsx)("h1",{className:"text-xl font-bold mb-2 text-gray-900 dark:text-gray-100",...o,children:t}),h2:({node:r,children:t,...o})=>(0,e.jsx)("h2",{className:"text-lg font-semibold mt-4 mb-2 text-gray-900 dark:text-gray-100",...o,children:t}),h3:({node:r,children:t,...o})=>(0,e.jsx)("h3",{className:"text-base font-semibold mt-3 mb-1 text-gray-900 dark:text-gray-100",...o,children:t}),p:({node:r,...t})=>(0,e.jsx)("p",{className:"my-1 text-gray-700 dark:text-gray-300",...t}),ul:({node:r,...t})=>(0,e.jsx)("ul",{className:"list-disc list-inside space-y-1 my-2 text-gray-700 dark:text-gray-300",...t}),ol:({node:r,...t})=>(0,e.jsx)("ol",{className:"list-decimal list-inside space-y-1 my-2 text-gray-700 dark:text-gray-300",...t}),code:({node:r,className:t,children:o,...l})=>!t?.includes("language-")?(0,e.jsx)("code",{className:"bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded text-sm font-mono text-gray-900 dark:text-gray-100",...l,children:o}):(0,e.jsx)("code",{className:"block bg-gray-100 dark:bg-gray-800 rounded-lg p-3 my-2 overflow-x-auto text-sm font-mono text-gray-900 dark:text-gray-100",...l,children:o}),pre:({node:r,...t})=>(0,e.jsx)("pre",{className:"my-2",...t}),a:({node:r,children:t,...o})=>(0,e.jsx)("a",{className:"text-synertech-primary-600 dark:text-synertech-primary-400 hover:underline",...o,children:t}),strong:({node:r,...t})=>(0,e.jsx)("strong",{className:"font-semibold text-gray-900 dark:text-gray-100",...t}),em:({node:r,...t})=>(0,e.jsx)("em",{className:"italic",...t}),blockquote:({node:r,...t})=>(0,e.jsx)("blockquote",{className:"border-l-4 border-gray-300 dark:border-gray-600 pl-4 my-2 italic text-gray-600 dark:text-gray-400",...t})};function F({content:r,markdown:t=!1,position:o="bottom",size:l="sm",className:s="",visible:i=!0,editable:u=!1,onSave:b,onReset:g,width:H="md",title:x,markdownEditor:N,markdownEditorUnavailableLabel:L,labels:M}){let a=(0,$.useUILabels)(M),[h,_]=(0,n.useState)(!1),[m,v]=(0,n.useState)(!1),[w,k]=(0,n.useState)(""),[O,E]=(0,n.useState)(!1),[S,d]=(0,n.useState)(null),p=(0,n.useRef)(null),P=(0,n.useRef)(null),T=(0,n.useRef)(null),c=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!h)return;let y=f=>{p.current&&!p.current.contains(f.target)&&P.current&&!P.current.contains(f.target)&&(m||_(!1))},W=f=>{if(f.key==="Escape"){if(f.defaultPrevented)return;f.preventDefault(),m?(v(!1),k("")):_(!1)}},B=(0,I.ownerDocumentOf)(p.current);return B.addEventListener("mousedown",y),B.addEventListener("keydown",W),()=>{B.removeEventListener("mousedown",y),B.removeEventListener("keydown",W)}},[h,m]),(0,n.useEffect)(()=>{m&&T.current&&T.current.focus()},[m]),(0,n.useEffect)(()=>()=>{c.current&&clearTimeout(c.current)},[]);let J=(0,n.useCallback)(()=>{k(typeof r=="string"?r:""),v(!0),d(null)},[r]),Q=(0,n.useCallback)(()=>{v(!1),k(""),d(null)},[]),X=(0,n.useCallback)(async()=>{if(!b){d({type:"error",text:a.helpButtonNoSave});return}E(!0);try{await b(w)?(d({type:"success",text:a.helpButtonSaved}),v(!1),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>d(null),2e3)):d({type:"error",text:a.helpButtonSaveError})}catch{d({type:"error",text:a.helpButtonSaveError})}finally{E(!1)}},[w,b,a]),Y=(0,n.useCallback)(async()=>{if(g&&confirm(a.helpButtonResetConfirm)){E(!0);try{await g()?(d({type:"success",text:a.helpButtonResetDone}),v(!1),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>d(null),2e3)):d({type:"error",text:a.helpButtonResetError})}catch{d({type:"error",text:a.helpButtonResetError})}finally{E(!1)}}},[g,a]),C=r;return i?(0,e.jsxs)("div",{className:"relative inline-flex items-center",children:[(0,e.jsx)("button",{type:"button",ref:p,onClick:()=>_(!h),className:`
2
2
  ${ue[l]}
3
3
  inline-flex items-center justify-center
4
4
  rounded-full border border-gray-300 dark:border-gray-600
@@ -11,4 +11,4 @@
11
11
  transition-all duration-150
12
12
  focus:outline-none focus:ring-2 focus:ring-synertech-primary-500/50
13
13
  ${s}
14
- `,"aria-label":o.helpButtonShow,"aria-expanded":h,children:(0,e.jsx)("span",{className:"font-medium",children:"?"})}),h&&p.current&&(0,e.jsxs)(fe,{anchorRef:p,bubbleRef:P,position:n,className:(0,D.cn)(me[H],"max-w-[calc(100vw-1rem)] max-h-[80vh] overflow-hidden flex flex-col","bg-white dark:bg-gray-900","border border-gray-200 dark:border-gray-700","rounded-xl shadow-xl","text-sm text-gray-700 dark:text-gray-300"),children:[(x||u)&&(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:[(0,e.jsx)("div",{className:"flex items-center gap-2",children:x&&(0,e.jsx)("h3",{className:"text-sm font-semibold",children:x})}),u&&(0,e.jsx)("div",{className:"flex items-center gap-1",children:m?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",onClick:X,disabled:O,className:"p-1.5 rounded-md hover:bg-green-100 dark:hover:bg-green-900/30 text-green-700 dark:text-green-400 transition-colors disabled:opacity-50 cursor-pointer",title:o.helpButtonSave,children:O?ce:le}),(0,e.jsx)("button",{type:"button",onClick:Q,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:o.helpButtonCancel,children:ie}),g&&(0,e.jsx)("button",{type:"button",onClick:Y,disabled:O,className:"p-1.5 rounded-md hover:bg-orange-100 dark:hover:bg-orange-900/30 text-orange-700 dark:text-orange-400 transition-colors disabled:opacity-50 cursor-pointer",title:o.helpButtonReset,children:de})]}):(0,e.jsx)("button",{type:"button",onClick:J,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:o.helpButtonEdit,children:se})})]}),S&&(0,e.jsx)("div",{className:`px-4 py-2 text-xs ${S.type==="success"?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400"}`,children:S.text}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:m?t?N?(0,e.jsx)(N,{value:w,onChange:k,placeholder:o.markdownEditorPlaceholder}):(0,e.jsx)("p",{role:"alert",className:"p-3 text-sm text-gray-500 dark:text-gray-400",children:L??o.markdownEditorUnavailable}):(0,e.jsx)("div",{className:"space-y-2",children:(0,e.jsx)("textarea",{ref:T,"aria-label":o.helpButtonContent,value:w,onChange:y=>k(y.target.value),className:"w-full h-64 p-3 text-sm bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg resize-none focus:outline-none focus:ring-2 focus:ring-synertech-primary-500/50 text-gray-700 dark:text-gray-300 font-mono",placeholder:o.helpButtonContentPlaceholder})}):typeof C=="string"?(0,e.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:t?(0,e.jsx)(j.default,{remarkPlugins:ge,components:ye,disallowedElements:pe,children:C}):(0,e.jsx)("div",{dangerouslySetInnerHTML:{__html:(0,G.sanitizeHelpHtml)(C)}})}):C})]})]}):null}function fe({anchorRef:r,bubbleRef:t,position:n,className:l,children:s}){let i=(0,q.usePositioning)({triggerRef:r,contentRef:t,isOpen:!0,side:n,align:"center",sideOffset:8});return(0,a.useEffect)(()=>{let u=t.current;if(u)return(0,V.registerFloatingLayer)(u,()=>r.current)},[r,t]),(0,U.createPortal)((0,e.jsx)("div",{ref:t,role:"tooltip","data-side":i.actualSide,style:{position:"fixed",top:i.top,left:i.left,maxHeight:i.availableHeight===void 0?void 0:`min(80vh, ${i.availableHeight}px)`,opacity:i.isReady?1:0},className:(0,D.cn)("z-50",l,i.isReady&&"animate-in fade-in-0 zoom-in-95 duration-150"),children:s}),(0,I.ownerDocumentOf)(r.current).body)}function be({children:r,content:t,markdown:n=!1,position:l="bottom",size:s="sm",visible:i=!0,editable:u=!1,onSave:b,onReset:g,width:H="md",title:x,className:N,markdownEditor:L,markdownEditorUnavailableLabel:M,labels:o}){return(0,e.jsxs)("div",{className:"inline-flex items-center gap-2.5",children:[r,(0,e.jsx)(F,{content:t,markdown:n,position:l,size:s,visible:i,editable:u,onSave:b,onReset:g,width:H,title:x,className:N,markdownEditor:L,markdownEditorUnavailableLabel:M,labels:o})]})}0&&(module.exports={HelpButton,WithHelpButton});
14
+ `,"aria-label":a.helpButtonShow,"aria-expanded":h,children:(0,e.jsx)("span",{className:"font-medium",children:"?"})}),h&&p.current&&(0,e.jsxs)(fe,{anchorRef:p,bubbleRef:P,position:o,className:(0,D.cn)(me[H],"max-w-[calc(100vw-1rem)] max-h-[80vh] overflow-hidden flex flex-col","bg-white dark:bg-gray-900","border border-gray-200 dark:border-gray-700","rounded-xl shadow-xl","text-sm text-gray-700 dark:text-gray-300"),children:[(x||u)&&(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:[(0,e.jsx)("div",{className:"flex items-center gap-2",children:x&&(0,e.jsx)("h3",{className:"text-sm font-semibold",children:x})}),u&&(0,e.jsx)("div",{className:"flex items-center gap-1",children:m?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",onClick:X,disabled:O,className:"p-1.5 rounded-md hover:bg-green-100 dark:hover:bg-green-900/30 text-green-700 dark:text-green-400 transition-colors disabled:opacity-50 cursor-pointer",title:a.helpButtonSave,children:O?ce:le}),(0,e.jsx)("button",{type:"button",onClick:Q,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:a.helpButtonCancel,children:ie}),g&&(0,e.jsx)("button",{type:"button",onClick:Y,disabled:O,className:"p-1.5 rounded-md hover:bg-orange-100 dark:hover:bg-orange-900/30 text-orange-700 dark:text-orange-400 transition-colors disabled:opacity-50 cursor-pointer",title:a.helpButtonReset,children:de})]}):(0,e.jsx)("button",{type:"button",onClick:J,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:a.helpButtonEdit,children:se})})]}),S&&(0,e.jsx)("div",{className:`px-4 py-2 text-xs ${S.type==="success"?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400"}`,children:S.text}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:m?t?N?(0,e.jsx)(N,{value:w,onChange:k,placeholder:a.markdownEditorPlaceholder}):(0,e.jsx)("p",{role:"alert",className:"p-3 text-sm text-gray-500 dark:text-gray-400",children:L??a.markdownEditorUnavailable}):(0,e.jsx)("div",{className:"space-y-2",children:(0,e.jsx)("textarea",{ref:T,"aria-label":a.helpButtonContent,value:w,onChange:y=>k(y.target.value),className:"w-full h-64 p-3 text-sm bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg resize-none focus:outline-none focus:ring-2 focus:ring-synertech-primary-500/50 text-gray-700 dark:text-gray-300 font-mono",placeholder:a.helpButtonContentPlaceholder})}):typeof C=="string"?(0,e.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:t?(0,e.jsx)(j.default,{remarkPlugins:ge,components:ye,disallowedElements:pe,children:C}):(0,e.jsx)("div",{dangerouslySetInnerHTML:{__html:(0,G.sanitizeHelpHtml)(C)}})}):C})]})]}):null}function fe({anchorRef:r,bubbleRef:t,position:o,className:l,children:s}){let i=(0,q.usePositioning)({triggerRef:r,contentRef:t,isOpen:!0,side:o,align:"center",sideOffset:8});return(0,n.useEffect)(()=>{let u=t.current;if(u)return(0,V.registerFloatingLayer)(u,()=>r.current)},[r,t]),(0,U.createPortal)((0,e.jsx)("div",{ref:t,role:"tooltip","data-side":i.actualSide,style:{position:"fixed",top:i.top,left:i.left,maxHeight:i.availableHeight===void 0?void 0:`min(80vh, ${i.availableHeight}px)`,opacity:i.isReady?1:0},className:(0,D.cn)("z-50",l,i.isReady&&"animate-in fade-in-0 zoom-in-95"),children:s}),(0,I.ownerDocumentOf)(r.current).body)}function be({children:r,content:t,markdown:o=!1,position:l="bottom",size:s="sm",visible:i=!0,editable:u=!1,onSave:b,onReset:g,width:H="md",title:x,className:N,markdownEditor:L,markdownEditorUnavailableLabel:M,labels:a}){return(0,e.jsxs)("div",{className:"inline-flex items-center gap-2.5",children:[r,(0,e.jsx)(F,{content:t,markdown:o,position:l,size:s,visible:i,editable:u,onSave:b,onReset:g,width:H,title:x,className:N,markdownEditor:L,markdownEditorUnavailableLabel:M,labels:a})]})}0&&(module.exports={HelpButton,WithHelpButton});