neba 1.8.1 → 1.10.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 (196) hide show
  1. package/README.md +7 -7
  2. package/dist/components/accordion/Accordion.js +1 -1
  3. package/dist/components/alert/Alert.js +1 -1
  4. package/dist/components/anchor/Anchor.d.ts +73 -0
  5. package/dist/components/anchor/Anchor.js +1 -0
  6. package/dist/components/anchor/index.d.ts +2 -0
  7. package/dist/components/anchor/index.js +1 -0
  8. package/dist/components/animate-marquee/AnimateMarquee.js +1 -1
  9. package/dist/components/app-logo/AppLogo.js +1 -1
  10. package/dist/components/aspect-ratio/AspectRatio.js +1 -1
  11. package/dist/components/avatar/Avatar.js +1 -1
  12. package/dist/components/avatar-group/AvatarGroup.d.ts +47 -0
  13. package/dist/components/avatar-group/AvatarGroup.js +1 -0
  14. package/dist/components/avatar-group/index.d.ts +2 -0
  15. package/dist/components/avatar-group/index.js +1 -0
  16. package/dist/components/badge/Badge.js +1 -1
  17. package/dist/components/blockquote/Blockquote.js +1 -1
  18. package/dist/components/box/Box.js +1 -1
  19. package/dist/components/button/Button.js +1 -1
  20. package/dist/components/button-group/ButtonGroup.js +1 -1
  21. package/dist/components/card/Card.js +1 -1
  22. package/dist/components/carousel/Carousel.js +1 -1
  23. package/dist/components/chat-bubble/ChatBubble.js +1 -1
  24. package/dist/components/checkbox/Checkbox.d.ts +13 -1
  25. package/dist/components/checkbox/Checkbox.js +1 -1
  26. package/dist/components/combobox/Combobox.d.ts +17 -2
  27. package/dist/components/combobox/Combobox.js +1 -1
  28. package/dist/components/command-palette/CommandPalette.d.ts +105 -0
  29. package/dist/components/command-palette/CommandPalette.js +1 -0
  30. package/dist/components/command-palette/index.d.ts +2 -0
  31. package/dist/components/command-palette/index.js +1 -0
  32. package/dist/components/container/Container.js +1 -1
  33. package/dist/components/data-list/DataList.d.ts +55 -0
  34. package/dist/components/data-list/DataList.js +1 -0
  35. package/dist/components/data-list/index.d.ts +2 -0
  36. package/dist/components/data-list/index.js +1 -0
  37. package/dist/components/data-table/DataTable.js +1 -1
  38. package/dist/components/dialog/Dialog.d.ts +19 -2
  39. package/dist/components/dialog/Dialog.js +1 -1
  40. package/dist/components/divider/Divider.js +1 -1
  41. package/dist/components/drawer/Drawer.js +1 -1
  42. package/dist/components/empty/Empty.js +1 -1
  43. package/dist/components/fieldset/Fieldset.d.ts +33 -0
  44. package/dist/components/fieldset/Fieldset.js +1 -0
  45. package/dist/components/fieldset/index.d.ts +2 -0
  46. package/dist/components/fieldset/index.js +1 -0
  47. package/dist/components/file-picker/FilePicker.js +1 -1
  48. package/dist/components/floating-bottom-navigation/FloatingBottomNavigation.js +1 -1
  49. package/dist/components/form/Form.d.ts +58 -0
  50. package/dist/components/form/Form.js +1 -0
  51. package/dist/components/form/index.d.ts +2 -0
  52. package/dist/components/form/index.js +1 -0
  53. package/dist/components/gauge-chart/GaugeChart.d.ts +62 -0
  54. package/dist/components/gauge-chart/GaugeChart.js +1 -0
  55. package/dist/components/gauge-chart/index.d.ts +2 -0
  56. package/dist/components/gauge-chart/index.js +1 -0
  57. package/dist/components/grid/Grid.js +1 -1
  58. package/dist/components/grid-container/GridContainer.js +1 -1
  59. package/dist/components/heatmap-chart/HeatmapChart.js +1 -1
  60. package/dist/components/highlight/Highlight.js +1 -1
  61. package/dist/components/hover-card/HoverCard.d.ts +78 -0
  62. package/dist/components/hover-card/HoverCard.js +1 -0
  63. package/dist/components/hover-card/index.d.ts +2 -0
  64. package/dist/components/hover-card/index.js +1 -0
  65. package/dist/components/how-to-steps/HowToSteps.d.ts +11 -25
  66. package/dist/components/how-to-steps/HowToSteps.js +1 -1
  67. package/dist/components/icon/Icon.js +1 -1
  68. package/dist/components/list/List.js +1 -1
  69. package/dist/components/menu/Menu.d.ts +16 -4
  70. package/dist/components/menu/Menu.js +1 -1
  71. package/dist/components/menubar/Menubar.d.ts +56 -0
  72. package/dist/components/menubar/Menubar.js +1 -0
  73. package/dist/components/menubar/index.d.ts +2 -0
  74. package/dist/components/menubar/index.js +1 -0
  75. package/dist/components/meter/Meter.d.ts +52 -0
  76. package/dist/components/meter/Meter.js +1 -0
  77. package/dist/components/meter/index.d.ts +2 -0
  78. package/dist/components/meter/index.js +1 -0
  79. package/dist/components/mockup/Mockup.js +1 -1
  80. package/dist/components/navigation-menu/NavigationMenu.d.ts +100 -0
  81. package/dist/components/navigation-menu/NavigationMenu.js +1 -0
  82. package/dist/components/navigation-menu/index.d.ts +2 -0
  83. package/dist/components/navigation-menu/index.js +1 -0
  84. package/dist/components/number-field/NumberField.d.ts +17 -2
  85. package/dist/components/number-field/NumberField.js +1 -1
  86. package/dist/components/otp-field/OtpField.js +1 -1
  87. package/dist/components/overlay/Overlay.js +1 -1
  88. package/dist/components/page-layout/PageLayout.js +1 -1
  89. package/dist/components/pagination/Pagination.js +1 -1
  90. package/dist/components/panes/Panes.js +1 -1
  91. package/dist/components/pie-chart/PieChart.js +1 -1
  92. package/dist/components/pill/Pill.js +1 -1
  93. package/dist/components/popover/Popover.js +1 -1
  94. package/dist/components/progress-box/ProgressBox.js +1 -1
  95. package/dist/components/progress-circular/ProgressCircular.js +1 -1
  96. package/dist/components/progress-linear/ProgressLinear.js +1 -1
  97. package/dist/components/radio-group/RadioGroup.d.ts +22 -1
  98. package/dist/components/radio-group/RadioGroup.js +1 -1
  99. package/dist/components/rating/Rating.js +1 -1
  100. package/dist/components/scroll-area/ScrollArea.d.ts +50 -0
  101. package/dist/components/scroll-area/ScrollArea.js +1 -0
  102. package/dist/components/scroll-area/index.d.ts +2 -0
  103. package/dist/components/scroll-area/index.js +1 -0
  104. package/dist/components/scroll-zone/ScrollZone.d.ts +35 -17
  105. package/dist/components/scroll-zone/ScrollZone.js +1 -1
  106. package/dist/components/segmented-button/SegmentedButton.js +1 -1
  107. package/dist/components/select/Select.d.ts +16 -1
  108. package/dist/components/select/Select.js +1 -1
  109. package/dist/components/shortcut/Shortcut.js +1 -1
  110. package/dist/components/sidebar/Sidebar.js +1 -1
  111. package/dist/components/skeleton/Skeleton.js +1 -1
  112. package/dist/components/slider/Slider.js +1 -1
  113. package/dist/components/spoiler/Spoiler.js +1 -1
  114. package/dist/components/statistic/Statistic.js +1 -1
  115. package/dist/components/switch/Switch.d.ts +13 -1
  116. package/dist/components/switch/Switch.js +1 -1
  117. package/dist/components/table/Table.d.ts +21 -2
  118. package/dist/components/table/Table.js +1 -1
  119. package/dist/components/tabs/Tabs.js +1 -1
  120. package/dist/components/text-field/TextField.d.ts +16 -1
  121. package/dist/components/text-field/TextField.js +1 -1
  122. package/dist/components/text-link/TextLink.js +1 -1
  123. package/dist/components/toast/Toast.d.ts +17 -2
  124. package/dist/components/toast/Toast.js +1 -1
  125. package/dist/components/toggle/Toggle.d.ts +53 -0
  126. package/dist/components/toggle/Toggle.js +1 -0
  127. package/dist/components/toggle/index.d.ts +2 -0
  128. package/dist/components/toggle/index.js +1 -0
  129. package/dist/components/toggle-group/ToggleGroup.d.ts +51 -0
  130. package/dist/components/toggle-group/ToggleGroup.js +1 -0
  131. package/dist/components/toggle-group/index.d.ts +2 -0
  132. package/dist/components/toggle-group/index.js +1 -0
  133. package/dist/components/toolbar/Toolbar.js +1 -1
  134. package/dist/components/tooltip/Tooltip.js +1 -1
  135. package/dist/components/tour/Tour.d.ts +97 -0
  136. package/dist/components/tour/Tour.js +1 -0
  137. package/dist/components/tour/index.d.ts +2 -0
  138. package/dist/components/tour/index.js +1 -0
  139. package/dist/components/transfer/Transfer.d.ts +52 -0
  140. package/dist/components/transfer/Transfer.js +1 -0
  141. package/dist/components/transfer/index.d.ts +2 -0
  142. package/dist/components/transfer/index.js +1 -0
  143. package/dist/components/tree-view/TreeView.js +1 -1
  144. package/dist/components/typography/Typography.js +1 -1
  145. package/dist/components/window-pane/WindowPane.js +1 -1
  146. package/dist/index.d.ts +16 -0
  147. package/dist/index.js +1 -1
  148. package/dist/internal/animate.d.ts +7 -1
  149. package/dist/internal/animate.js +1 -1
  150. package/dist/internal/avatar-group.d.ts +22 -0
  151. package/dist/internal/avatar-group.js +1 -0
  152. package/dist/internal/button-group.d.ts +6 -2
  153. package/dist/internal/chart-frame.d.ts +18 -1
  154. package/dist/internal/chart-frame.js +1 -1
  155. package/dist/internal/data-table.d.ts +0 -14
  156. package/dist/internal/data-table.js +1 -1
  157. package/dist/internal/drag.d.ts +62 -0
  158. package/dist/internal/drag.js +1 -0
  159. package/dist/internal/highlight.js +1 -1
  160. package/dist/internal/i18n.d.ts +82 -0
  161. package/dist/internal/i18n.js +1 -1
  162. package/dist/internal/link.d.ts +19 -0
  163. package/dist/internal/link.js +1 -0
  164. package/dist/internal/media.d.ts +29 -0
  165. package/dist/internal/media.js +1 -0
  166. package/dist/internal/observe.d.ts +42 -0
  167. package/dist/internal/observe.js +1 -0
  168. package/dist/internal/page-layout.js +1 -1
  169. package/dist/internal/picker.js +1 -1
  170. package/dist/internal/progress.d.ts +5 -0
  171. package/dist/internal/search.d.ts +33 -0
  172. package/dist/internal/search.js +1 -0
  173. package/dist/internal/styles.d.ts +39 -0
  174. package/dist/internal/styles.js +1 -1
  175. package/dist/locales/ar.js +1 -1
  176. package/dist/locales/de.js +1 -1
  177. package/dist/locales/es.js +1 -1
  178. package/dist/locales/fr.js +1 -1
  179. package/dist/locales/hi.js +1 -1
  180. package/dist/locales/id.js +1 -1
  181. package/dist/locales/it.js +1 -1
  182. package/dist/locales/ja.js +1 -1
  183. package/dist/locales/ko.js +1 -1
  184. package/dist/locales/nl.js +1 -1
  185. package/dist/locales/pl.js +1 -1
  186. package/dist/locales/pt.js +1 -1
  187. package/dist/locales/ru.js +1 -1
  188. package/dist/locales/th.js +1 -1
  189. package/dist/locales/tr.js +1 -1
  190. package/dist/locales/vi.js +1 -1
  191. package/dist/locales/zh-hans.js +1 -1
  192. package/dist/locales/zh-hant.js +1 -1
  193. package/dist/styles.css +1 -1
  194. package/dist/tailwind.css +104 -0
  195. package/dist/types.d.ts +55 -0
  196. package/package.json +2 -2
@@ -1 +1 @@
1
- "use client";import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import*as a from"react";import{Box as l}from"../components/box/Box.js";import{bandScale as i,categoryAt as r,categoryCount as s,categoryExtent as o,chartFontSizes as c,compactNumber as d,extentOf as u,fitsLast as h,formatCategory as m,markerRadii as f,plotHeights as x,seriesColor as p,showsTick as g,textWidth as b,tickStride as v,toValues as y,truncate as k,valueScale as w}from"./chart.js";import{numberFormatter as M}from"./format.js";import{emptyMessages as N,useMessages as z}from"./i18n.js";import{cx as S,metaTextClasses as C,srOnlyClasses as A,transitionClasses as P}from"./styles.js";const j="undefined"==typeof document?a.useEffect:a.useLayoutEffect,W=[];function B(e){const[t,n]=a.useState(0);return j(()=>{const t=e.current;if(!t)return;const a=()=>n(t.clientWidth);if(a(),"undefined"==typeof ResizeObserver)return;const l=new ResizeObserver(a);return l.observe(t),()=>l.disconnect()},[e]),t}function R(e){const[t,n]=a.useState(()=>{const t=new Set;return e.forEach((e,n)=>{e.hidden&&t.add(n)}),t}),[l,i]=a.useState(null),r=a.useCallback(e=>{n(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);return{visible:e.map((e,n)=>!t.has(n)),hovered:l,toggle:r,setHovered:i}}const F={top:"flex-col-reverse",bottom:"flex-col",left:"flex-row-reverse",right:"flex-row"},E={start:"justify-start",center:"justify-center",end:"justify-end"};function H({series:a,colors:l,options:i,visibility:r,size:s,values:o,swatch:c}){const d=!1!==i.interactive,u="left"===i.side||"right"===i.side;return e("ul",{className:S("flex list-none flex-wrap items-center gap-x-3 gap-y-1 p-0",u?"min-w-0 flex-col items-start":"",E[i.align??"center"],C[s]),children:a.map((a,i)=>{const s=r.visible[i],u=null!==r.hovered&&r.hovered!==i,h=a.name??`${i+1}`,m=s?l[i]:"var(--neba-disabled-fg)",f=n(t,{children:[e("span",c?{"aria-hidden":"true",className:"flex size-2.5 shrink-0 items-center justify-center",children:c(i,m)}:{"aria-hidden":"true",className:"size-2.5 shrink-0 rounded-[0.1875rem]",style:{backgroundColor:m}}),e("span",{className:"min-w-0 truncate",children:h}),o?.[i]?e("span",{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:o[i]}):null]});return e("li",{className:"min-w-0",children:d?e("button",{type:"button","aria-pressed":s,onClick:()=>r.toggle(i),onPointerEnter:()=>r.setHovered(i),onPointerLeave:()=>r.setHovered(null),onFocus:()=>r.setHovered(i),onBlur:()=>r.setHovered(null),className:S("flex min-w-0 cursor-pointer items-center gap-1.5 rounded-(--neba-radius-xs)","px-1 py-0.5 text-(--neba-fg)",P,"hover:bg-(--n-soft)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1",s?"":"text-(--neba-disabled-fg)",u?"opacity-55":""),children:f}):e("span",{className:S("flex min-w-0 items-center gap-1.5 px-1 py-0.5 text-(--neba-fg)",s?"":"text-(--neba-disabled-fg)"),children:f})},a.name??i)})})}function I({steps:a,from:l,to:i,middle:r,align:s,vertical:o,size:c}){return e("div",{className:S("flex",o?"":E[s]),children:n("div",{className:S("grid grid-cols-[auto_auto_auto] items-center gap-x-2",C[c]),children:[e("span",{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:l}),e("span",{"aria-hidden":"true",className:S("flex h-2.5 overflow-hidden rounded-[0.1875rem]",o?"w-20":"w-24"),children:a.map(t=>e("span",{className:"h-full flex-1",style:{backgroundColor:t}},t))}),e("span",{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:i}),r?n(t,{children:[e("span",{}),e("span",{className:"text-center tabular-nums text-(--neba-muted-fg)",children:r}),e("span",{})]}):null]})})}function _({heading:t,items:a,x:l,y:i,flip:r,size:s}){return n("div",{role:"status","aria-live":"polite",className:S("pointer-events-none absolute z-10 max-w-56 min-w-24","rounded-(--neba-radius-sm) border p-2","[background-image:var(--neba-grain),var(--neba-sheen)]","[background-blend-mode:overlay,normal] [backdrop-filter:var(--neba-blur)]","bg-(--neba-panel-press) [border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-2),var(--neba-plate-glass)]",C[s]),style:r?{right:`calc(100% - ${l}px + 10px)`,top:i}:{left:l+10,top:i},children:[e("div",{className:"mb-1 font-medium text-(--neba-fg)",children:t}),e("ul",{className:"flex list-none flex-col gap-0.5 p-0",children:a.map(t=>n("li",{className:"flex items-center gap-1.5",children:[e("span",{"aria-hidden":"true",className:"size-2 shrink-0 rounded-[0.125rem]",style:{backgroundColor:t.color}}),t.name?e("span",{className:"min-w-0 flex-1 truncate text-(--neba-muted-fg)",children:t.name}):null,e("span",{className:"ms-auto shrink-0 font-medium tabular-nums text-(--neba-fg)",children:t.label??t.formatted})]},t.seriesIndex))})]})}function T({id:t,caption:a,corner:l,categories:i,series:r,values:s,format:o,locale:c}){return n("table",{id:t,className:A,children:[a?e("caption",{children:a}):null,e("thead",{children:n("tr",{children:[e("th",{scope:"col",children:l??""}),r.map((t,n)=>e("th",{scope:"col",children:t.name??n+1},t.name??n))]})}),e("tbody",{children:i.map((t,a)=>n("tr",{children:[e("th",{scope:"row",children:m(t,c)}),r.map((t,n)=>{const l=s[n]?.[a];return e("td",void 0!==l?.label?{children:l.label}:{children:null==l?.value?"":o(l.value)},t.name??n)})]},a))})]})}function $({legend:t,legendSide:a,children:i,table:r,className:s,...o}){return n(l,{...o,className:S("relative flex gap-3",F[a],s??void 0),children:[e("div",{className:"relative min-w-0 flex-1",children:i}),t,r]})}export function CartesianChart({series:t,categories:l,xAxis:h,yAxis:g,horizontal:v=!1,stacked:A=!1,includeZero:P=!0,bandRatio:j=1,inset:F=!1,headroom:E=0,markInset:I=0,xScale:V="band",marks:D,markRadius:X=24,table:Y,swatch:Z,scale:O,markTooltip:K,height:U,format:q,locale:G,label:J,legend:Q,tooltip:ee,empty:te,size:ne="md",variant:ae="text",padded:le=!1,className:ie,children:re,...se}){const oe=a.useRef(null),ce=B(oe),de=z(N,G),ue=a.useId(),he=R(t),[me,fe]=a.useState(null),[xe,pe]=a.useState(null),[ge,be]=a.useState(null),ve=a.useCallback(e=>q?M(G,q).format(e):d(e,G),[q,G]),ye=a.useMemo(()=>y(t),[t]),ke=a.useMemo(()=>t.map((e,t)=>p(e,t)),[t]),we=s(t),Me=a.useMemo(()=>Array.from({length:we},(e,t)=>r(t,l,ye)),[we,l,ye]),Ne=ye.filter((e,t)=>he.visible[t]),ze=u(Ne,A),Se="number"==typeof U?U:void 0===U?x[ne]:null,Ce=c[ne],Ae=g,Pe=h,je=O??w(ze,{min:Ae?.min,max:Ae?.max,tickCount:Ae?.tickCount,includeZero:P}),We="value"===V?o(Ne,l):null,Be="value"===V?w(We,{min:Pe?.min,max:Pe?.max,tickCount:Pe?.tickCount,includeZero:!1}):null,Re=je.ticks.map((e,t)=>Ae?.tickFormat?String(Ae.tickFormat(e,t)):ve(e)),Fe=Be?Be.ticks.map((e,t)=>Pe?.tickFormat?String(Pe.tickFormat(e,t)):d(e,G)):Me.map((e,t)=>Pe?.tickFormat?String(Pe.tickFormat(e,t)):m(e,G)),Ee=Re.reduce((e,t)=>Math.max(e,b(t,Ce)),0),He=Ce+6,Ie=Ae?.hidden?0:Ee+10+(Ae?.label?He:0),_e=(ce-(v?0:Ie)-16)/Math.max(1,we),Te=Be?Fe:v||_e-6>=2.4*Ce?Fe.map(e=>k(e,v?150:_e-6,Ce)):Fe,$e=Te.reduce((e,t)=>Math.max(e,b(t,Ce)),0),Le=v?Pe?.hidden?0:$e+10+(Pe?.label?He:0):Ie,Ve=v?Ae?.hidden?0:Ce+12+(Ae?.label?He:0):Pe?.hidden?0:Ce+12+(Pe?.label?He:0),De=(v?Pe:Ae)?.thickness??Le,Xe=(v?Ae:Pe)?.thickness??Ve,Ye=(v||Be?12:Math.max(8,Te.length?$e/2:8))+I,Ze=f[ne]+4+E+I,Oe=Se??0,Ke={left:De+I,top:Ze,width:Math.max(0,ce-De-I-Ye),height:Math.max(0,Oe-Ze-Xe-I)},Ue=v?Ke.height:Ke.width,qe=i(F?Math.max(1,we-1):we,Ue,j),Ge=a.useCallback(e=>F?we<=1?Ue/2:Ue*e/(we-1):qe.centre(e),[F,we,Ue,qe]),Je=a.useCallback(e=>v?Ke.left+je.fraction(e)*Ke.width:Ke.top+(1-je.fraction(e))*Ke.height,[v,Ke.left,Ke.top,Ke.width,Ke.height,je]),Qe=a.useCallback((e,t)=>v?{x:Je(t),y:Ke.top+Ge(e)}:{x:Ke.left+Ge(e),y:Je(t)},[v,Je,Ge,Ke.left,Ke.top]),et=a.useCallback(e=>v?Ke.top+(1-(Be?.fraction(e)??0))*Ke.height:Ke.left+(Be?.fraction(e)??0)*Ke.width,[v,Ke.left,Ke.top,Ke.width,Ke.height,Be]),tt=Je(Math.min(Math.max(0,je.min),je.max)),nt={plot:Ke,values:ye,visible:he.visible,colors:ke,scale:je,band:qe,horizontal:v,valuePx:Je,categoryPx:Ge,point:Qe,categoryScale:Be,categoryValuePx:et,zeroPx:tt,categories:Me,format:ve,size:ne},at=D?D(nt):W,lt=!1===ee?{mode:"none"}:!0===ee||void 0===ee?{}:ee,it=lt.mode??(D?"item":"index"),rt=null===xe?null:at[xe]??null,st=D?rt?rt.index:null:me,ot=D?at.length:we,ct=()=>{fe(null),pe(null),be(null)},dt=e=>{const t=null===e?null:Math.min(ot-1,Math.max(0,e));D?pe(t):fe(t)},ut=e=>{be(null);dt(((D?xe:me)??(e>0?-1:ot))+e)},ht=null===st?[]:t.flatMap((e,t)=>{if(!he.visible[t]||rt&&rt.series!==t)return[];const n=ye[t]?.[st];return n&&null!==n.value?[{seriesIndex:t,name:e.name,color:n.color??ke[t],value:n.value,formatted:ve(n.value),label:n.label}]:[]}),mt=rt&&K?K(rt):null,ft=mt?mt.items:"item"===it&&ht.length>1&&null!==ge?[ht.reduce((e,t)=>Math.abs(Je(t.value??0)-ge)<Math.abs(Je(e.value??0)-ge)?t:e)]:ht,xt=rt?ye[rt.series]?.[rt.index]?.x??l?.[rt.index]??rt.index:void 0,pt=rt?rt.x:v?Je(ft[0]?.value??0):Ke.left+Ge(st??0),gt=rt?rt.y:v?Ke.top+Ge(st??0):Ke.top,bt=rt?(rt.x-Ke.left)/Math.max(1,Ke.width)>.6:(v?je.fraction(ft[0]?.value??0):Ge(st??0)/Math.max(1,Ue))>.6,vt=!1===Q?{interactive:!1}:!0===Q||void 0===Q?{}:Q,yt=!0===Q||!1!==Q&&t.length>1,kt=vt.side??"bottom",wt={...nt,hovered:he.hovered,activeIndex:st,marks:at,activeMark:rt},Mt=0===we||null===ze||"value"===V&&null===We;return e($,{...se,size:ne,variant:ae,padded:le,className:ie,legendSide:kt,legend:yt?e(H,{series:t,colors:ke,options:vt,visibility:he,size:ne,swatch:Z,values:vt.showValue&&null!==st?t.map((e,t)=>{const n=ye[t]?.[st]?.value;return null==n?void 0:ve(n)}):void 0}):null,table:Mt?null:Y?.(ue)??e(T,{id:ue,caption:J,corner:Pe?.label,categories:Me,series:t,values:ye,format:ve,locale:G}),children:n("div",{ref:oe,role:"img",tabIndex:Mt?void 0:0,"aria-label":J,"aria-describedby":Mt?void 0:ue,onPointerMove:e=>{"none"!==it&&(D?pe(((e,t)=>{const n=oe.current;if(!n||0===at.length)return null;const a=n.getBoundingClientRect(),l=e-a.left,i=t-a.top;let r=null,s=1/0,o=1/0;return at.forEach((e,t)=>{const n=Math.hypot(e.x-l,e.y-i),a=void 0===e.rx?Math.max(0,n-e.r):Math.hypot(Math.max(0,Math.abs(e.x-l)-e.rx),Math.max(0,Math.abs(e.y-i)-(e.ry??e.rx)));a<=X&&(a<s||a===s&&n<o)&&(s=a,o=n,r=t)}),r})(e.clientX,e.clientY)):fe(((e,t)=>{const n=oe.current;if(!n||0===we)return null;const a=n.getBoundingClientRect(),l=v?t-a.top-Ke.top:e-a.left-Ke.left;if(l<-qe.step||l>Ue+qe.step)return null;const i=F?we<=1?0:Math.round(l/Ue*(we-1)):Math.floor(l/qe.step);return Math.min(we-1,Math.max(0,i))})(e.clientX,e.clientY)),"item"===it&&be(((e,t)=>{const n=oe.current;if(!n)return null;const a=n.getBoundingClientRect();return v?e-a.left:t-a.top})(e.clientX,e.clientY)))},onPointerLeave:ct,onKeyDown:"none"===it?void 0:e=>{const t=v?"ArrowDown":"ArrowRight",n=v?"ArrowUp":"ArrowLeft";if(e.key===t)ut(1);else if(e.key===n)ut(-1);else if("Home"===e.key)dt(0);else if("End"===e.key)dt(ot-1);else{if("Escape"!==e.key)return;ct()}e.preventDefault()},onBlur:ct,className:S("relative w-full","rounded-(--neba-radius-xs)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"),style:{height:Se??U},children:[Mt?e("div",{className:S("flex h-full items-center justify-center text-(--neba-muted-fg)",C[ne]),children:te??de.title}):ce>0?n("svg",{width:ce,height:Oe||"100%",viewBox:`0 0 ${ce} ${Oe}`,"aria-hidden":"true",className:"block overflow-visible",children:[e(L,{plot:Ke,scale:je,band:qe,horizontal:v,inset:F,categoryPx:Ge,valuePx:Je,tickTexts:Re,categoryTexts:Te,categoryScale:Be,categoryValuePx:et,valueAxis:Ae,categoryAxis:Pe,fontSize:Ce,zeroPx:tt}),null===st||D||"index"!==it||!1===lt.crosshair?null:(()=>{const t=Ge(st);return e("line",v?{x1:Ke.left,x2:Ke.left+Ke.width,y1:Ke.top+t,y2:Ke.top+t,stroke:"var(--neba-chart-baseline)",strokeWidth:1}:{x1:Ke.left+t,x2:Ke.left+t,y1:Ke.top,y2:Ke.top+Ke.height,stroke:"var(--neba-chart-baseline)",strokeWidth:1})})(),re(wt)]}):null,null!==st&&ft.length>0&&"none"!==it?lt.render?e("div",{className:"pointer-events-none absolute z-10",style:bt?{right:`calc(100% - ${pt}px + 10px)`,top:gt}:{left:pt+10,top:gt},children:lt.render({index:st,category:xt??Me[st],items:ft})}):e(_,{heading:mt?mt.heading:m(xt??Me[st],G),items:ft,x:pt,y:gt,flip:bt,size:ne}):null]})})}function L({plot:a,scale:l,horizontal:i,categoryPx:r,valuePx:s,tickTexts:o,categoryTexts:c,categoryScale:d,categoryValuePx:u,valueAxis:m,categoryAxis:f,fontSize:x,zeroPx:p}){const y=!1!==m?.grid&&!m?.hidden,k=!f?.hidden&&(f?.grid??null!==d),w=e=>d?u(d.ticks[e]):(i?a.top:a.left)+r(e),M=v(c.length,i?a.height:a.width,i?1.8*x:Math.max(...c.map(e=>b(e,x)),1)+12),N=v(l.ticks.length,i?a.width:a.height,i?Math.max(...o.map(e=>b(e,x)),1)+16:2*x),z=c.length>1?Math.abs(w(1)-w(0)):a.width,S=l.ticks.length>1?Math.abs(s(l.ticks[1])-s(l.ticks[0])):a.height,C=h(c.length,M,z,i?1.8*x:b(c[c.length-1]??"",x)),A=h(l.ticks.length,N,S,i?b(o[o.length-1]??"",x):1.6*x);return n("g",{children:[l.ticks.map((t,r)=>{const c=s(t),d=Math.abs(t)<1e-9;return n("g",{children:[y?e("line",i?{x1:c,x2:c,y1:a.top,y2:a.top+a.height,stroke:d?"var(--neba-chart-baseline)":"var(--neba-chart-grid)",strokeWidth:1}:{x1:a.left,x2:a.left+a.width,y1:c,y2:c,stroke:d?"var(--neba-chart-baseline)":"var(--neba-chart-grid)",strokeWidth:1}):null,m?.hidden||!g(r,l.ticks.length,N,A)?null:e("text",i?{x:c,y:a.top+a.height+x+6,textAnchor:0===r?"start":r===l.ticks.length-1?"end":"middle",fontSize:x,fill:"var(--neba-muted-fg)",className:"tabular-nums",children:o[r]}:{x:a.left-8,y:c,textAnchor:"end",dominantBaseline:"central",fontSize:x,fill:"var(--neba-muted-fg)",className:"tabular-nums",children:o[r]})]},t)}),f?.hidden?null:n(t,{children:[e("line",i?{x1:p,x2:p,y1:a.top,y2:a.top+a.height,stroke:"var(--neba-chart-axis)",strokeWidth:1}:{x1:a.left,x2:a.left+a.width,y1:p,y2:p,stroke:"var(--neba-chart-axis)",strokeWidth:1}),c.map((t,l)=>{const r=w(l),s=g(l,c.length,M,C);return i?s?e("text",{x:a.left-8,y:r,textAnchor:"end",dominantBaseline:"central",fontSize:x,fill:"var(--neba-muted-fg)",className:d?"tabular-nums":void 0,children:t},l):null:n("g",{children:[k?e("line",{x1:r,x2:r,y1:a.top,y2:a.top+a.height,stroke:"var(--neba-chart-grid)",strokeWidth:1}):null,s?e("text",{x:r,y:a.top+a.height+x+6,textAnchor:d?0===l?"start":l===c.length-1?"end":"middle":"middle",fontSize:x,fill:"var(--neba-muted-fg)",className:d?"tabular-nums":void 0,children:t}):null]},l)})]}),m?.label?e("text",{x:i?a.left+a.width:a.left,y:i?a.top+a.height+2*x+12:a.top-8,textAnchor:i?"end":"start",fontSize:x,fill:"var(--neba-muted-fg)",fontWeight:500,children:m.label}):null,f?.label&&!i?e("text",{x:a.left+a.width,y:a.top+a.height+2*x+12,textAnchor:"end",fontSize:x,fill:"var(--neba-muted-fg)",fontWeight:500,children:f.label}):null]})}export{T as ChartDataTable,H as ChartLegendBar,I as ChartScaleLegend,$ as ChartSurface,_ as ChartTooltipPanel,B as useMeasuredWidth,R as useVisibility};
1
+ "use client";import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import*as l from"react";import{Box as a}from"../components/box/Box.js";import{bandScale as i,categoryAt as r,categoryCount as s,categoryExtent as o,chartFontSizes as c,compactNumber as d,extentOf as u,fitsLast as h,formatCategory as m,markerRadii as f,plotHeights as x,seriesColor as g,showsTick as p,textWidth as b,tickStride as v,toValues as y,truncate as k,valueScale as w}from"./chart.js";import{numberFormatter as M}from"./format.js";import{observeResize as N}from"./observe.js";import{chartMessages as z,emptyMessages as S,useMessages as C}from"./i18n.js";import{cx as A,hasContent as P,metaTextClasses as j,srOnlyClasses as W,transitionClasses as B}from"./styles.js";const F="undefined"==typeof document?l.useEffect:l.useLayoutEffect,E=[];function I(e){const[t,n]=l.useState(0);return F(()=>{const t=e.current;if(!t)return;const l=()=>n(t.clientWidth);return l(),N(t,l)},[e]),t}function R(e){const[t,n]=l.useState(()=>{const t=new Set;return e.forEach((e,n)=>{e.hidden&&t.add(n)}),t}),[a,i]=l.useState(null),r=l.useCallback(e=>{n(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);return{visible:e.map((e,n)=>!t.has(n)),hovered:a,toggle:r,setHovered:i}}const H={top:"flex-col-reverse",bottom:"flex-col",left:"flex-row-reverse",right:"flex-row"},$={start:"justify-start",center:"justify-center",end:"justify-end"};function _({series:l,colors:a,options:i,visibility:r,size:s,values:o,swatch:c}){const d=!1!==i.interactive,u="left"===i.side||"right"===i.side;return e("ul",{className:A("flex list-none flex-wrap items-center gap-x-3 gap-y-1 p-0",u?"min-w-0 flex-col items-start":"",$[i.align??"center"],j[s]),children:l.map((l,i)=>{const s=r.visible[i],u=null!==r.hovered&&r.hovered!==i,h=l.name??`${i+1}`,m=s?a[i]:"var(--neba-disabled-fg)",f=n(t,{children:[e("span",c?{"aria-hidden":"true",className:"flex size-2.5 shrink-0 items-center justify-center",children:c(i,m)}:{"aria-hidden":"true",className:"size-2.5 shrink-0 rounded-[0.1875rem]",style:{backgroundColor:m}}),e("span",{className:"min-w-0 truncate",children:h}),o?.[i]?e("span",{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:o[i]}):null]});return e("li",{className:"min-w-0",children:d?e("button",{type:"button","aria-pressed":s,onClick:()=>r.toggle(i),onPointerEnter:()=>r.setHovered(i),onPointerLeave:()=>r.setHovered(null),onFocus:()=>r.setHovered(i),onBlur:()=>r.setHovered(null),className:A("flex min-w-0 cursor-pointer items-center gap-1.5 rounded-(--neba-radius-xs)","px-1 py-0.5 text-(--neba-fg)",B,"hover:bg-(--n-soft)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1",s?"":"text-(--neba-disabled-fg)",u?"opacity-55":""),children:f}):e("span",{className:A("flex min-w-0 items-center gap-1.5 px-1 py-0.5 text-(--neba-fg)",s?"":"text-(--neba-disabled-fg)"),children:f})},l.name??i)})})}function T({steps:l,from:a,to:i,middle:r,align:s,vertical:o,size:c}){return e("div",{className:A("flex",o?"":$[s]),children:n("div",{className:A("grid grid-cols-[auto_auto_auto] items-center gap-x-2",j[c]),children:[e("span",{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:a}),e("span",{"aria-hidden":"true",className:A("flex h-2.5 overflow-hidden rounded-[0.1875rem]",o?"w-20":"w-24"),children:l.map(t=>e("span",{className:"h-full flex-1",style:{backgroundColor:t}},t))}),e("span",{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:i}),r?n(t,{children:[e("span",{}),e("span",{className:"text-center tabular-nums text-(--neba-muted-fg)",children:r}),e("span",{})]}):null]})})}function L({heading:t,items:l,x:a,y:i,flip:r,size:s}){return n("div",{"data-neba-tooltip":"",className:A("pointer-events-none absolute z-10 max-w-56 min-w-24","rounded-(--neba-radius-sm) border p-2","[background-image:var(--neba-grain),var(--neba-sheen)]","[background-blend-mode:overlay,normal] [backdrop-filter:var(--neba-blur)]","bg-(--neba-panel-press) [border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-2),var(--neba-plate-glass)]",j[s]),style:r?{right:`calc(100% - ${a}px + 10px)`,top:i}:{left:a+10,top:i},children:[e("div",{className:"mb-1 font-medium text-(--neba-fg)",children:t}),e("ul",{className:"flex list-none flex-col gap-0.5 p-0",children:l.map(t=>n("li",{className:"flex items-center gap-1.5",children:[e("span",{"aria-hidden":"true",className:"size-2 shrink-0 rounded-[0.125rem]",style:{backgroundColor:t.color}}),t.name?e("span",{className:"min-w-0 flex-1 truncate text-(--neba-muted-fg)",children:t.name}):null,e("span",{className:"ms-auto shrink-0 font-medium tabular-nums text-(--neba-fg)",children:t.label??t.formatted})]},t.seriesIndex))})]})}function V({heading:a,items:i}){return e("span",{role:"status","aria-live":"polite",className:W,children:0===i.length?null:n(t,{children:[P(a)?n(t,{children:[a,", "]}):null,i.map((e,t)=>n(l.Fragment,{children:[t>0?", ":null,e.name?`${e.name}: `:null,e.label??e.formatted]},e.seriesIndex))]})})}function D({id:t,caption:l,corner:a,categories:i,series:r,values:s,format:o,locale:c}){return n("table",{id:t,className:W,children:[l?e("caption",{children:l}):null,e("thead",{children:n("tr",{children:[e("th",{scope:"col",children:a??""}),r.map((t,n)=>e("th",{scope:"col",children:t.name??n+1},t.name??n))]})}),e("tbody",{children:i.map((t,l)=>n("tr",{children:[e("th",{scope:"row",children:m(t,c)}),r.map((t,n)=>{const a=s[n]?.[l];return e("td",void 0!==a?.label?{children:a.label}:{children:null==a?.value?"":o(a.value)},t.name??n)})]},l))})]})}function X({legend:t,legendSide:l,children:i,table:r,className:s,...o}){return n(a,{...o,className:A("relative flex gap-3",H[l],s??void 0),children:[e("div",{className:"relative min-w-0 flex-1",children:i}),t,r]})}export function CartesianChart({series:t,categories:a,xAxis:h,yAxis:p,horizontal:v=!1,stacked:N=!1,includeZero:P=!0,bandRatio:W=1,inset:B=!1,headroom:F=0,markInset:H=0,xScale:$="band",marks:T,markRadius:Z=24,table:K,swatch:U,scale:q,markTooltip:G,height:J,format:O,locale:Q,label:ee,legend:te,tooltip:ne,empty:le,size:ae="md",variant:ie="text",padded:re=!1,className:se,children:oe,...ce}){const de=l.useRef(null),ue=I(de),he=C(S,Q),me=C(z,Q),fe=l.useId(),xe=R(t),[ge,pe]=l.useState(null),[be,ve]=l.useState(null),[ye,ke]=l.useState(null),we=l.useCallback(e=>O?M(Q,O).format(e):d(e,Q),[O,Q]),Me=l.useMemo(()=>y(t),[t]),Ne=l.useMemo(()=>t.map((e,t)=>g(e,t)),[t]),ze=s(t),Se=l.useMemo(()=>Array.from({length:ze},(e,t)=>r(t,a,Me)),[ze,a,Me]),Ce=Me.filter((e,t)=>xe.visible[t]),Ae=u(Ce,N),Pe="number"==typeof J?J:void 0===J?x[ae]:null,je=c[ae],We=p,Be=h,Fe=q??w(Ae,{min:We?.min,max:We?.max,tickCount:We?.tickCount,includeZero:P}),Ee="value"===$?o(Ce,a):null,Ie="value"===$?w(Ee,{min:Be?.min,max:Be?.max,tickCount:Be?.tickCount,includeZero:!1}):null,Re=Fe.ticks.map((e,t)=>We?.tickFormat?String(We.tickFormat(e,t)):we(e)),He=Ie?Ie.ticks.map((e,t)=>Be?.tickFormat?String(Be.tickFormat(e,t)):d(e,Q)):Se.map((e,t)=>Be?.tickFormat?String(Be.tickFormat(e,t)):m(e,Q)),$e=Re.reduce((e,t)=>Math.max(e,b(t,je)),0),_e=je+6,Te=We?.hidden?0:$e+10+(We?.label?_e:0),Le=(ue-(v?0:Te)-16)/Math.max(1,ze),Ve=Ie?He:v||Le-6>=2.4*je?He.map(e=>k(e,v?150:Le-6,je)):He,De=Ve.reduce((e,t)=>Math.max(e,b(t,je)),0),Xe=v?Be?.hidden?0:De+10+(Be?.label?_e:0):Te,Ye=v?We?.hidden?0:je+12+(We?.label?_e:0):Be?.hidden?0:je+12+(Be?.label?_e:0),Ze=(v?Be:We)?.thickness??Xe,Ke=(v?We:Be)?.thickness??Ye,Ue=(v||Ie?12:Math.max(8,Ve.length?De/2:8))+H,qe=f[ae]+4+F+H,Ge=Pe??0,Je={left:Ze+H,top:qe,width:Math.max(0,ue-Ze-H-Ue),height:Math.max(0,Ge-qe-Ke-H)},Oe=v?Je.height:Je.width,Qe=i(B?Math.max(1,ze-1):ze,Oe,W),et=l.useCallback(e=>B?ze<=1?Oe/2:Oe*e/(ze-1):Qe.centre(e),[B,ze,Oe,Qe]),tt=l.useCallback(e=>v?Je.left+Fe.fraction(e)*Je.width:Je.top+(1-Fe.fraction(e))*Je.height,[v,Je.left,Je.top,Je.width,Je.height,Fe]),nt=l.useCallback((e,t)=>v?{x:tt(t),y:Je.top+et(e)}:{x:Je.left+et(e),y:tt(t)},[v,tt,et,Je.left,Je.top]),lt=l.useCallback(e=>v?Je.top+(1-(Ie?.fraction(e)??0))*Je.height:Je.left+(Ie?.fraction(e)??0)*Je.width,[v,Je.left,Je.top,Je.width,Je.height,Ie]),at=tt(Math.min(Math.max(0,Fe.min),Fe.max)),it={plot:Je,values:Me,visible:xe.visible,colors:Ne,scale:Fe,band:Qe,horizontal:v,valuePx:tt,categoryPx:et,point:nt,categoryScale:Ie,categoryValuePx:lt,zeroPx:at,categories:Se,format:we,size:ae},rt=T?T(it):E,st=!1===ne?{mode:"none"}:!0===ne||void 0===ne?{}:ne,ot=st.mode??(T?"item":"index"),ct=null===be?null:rt[be]??null,dt=T?ct?ct.index:null:ge,ut=T?rt.length:ze,ht=()=>{pe(null),ve(null),ke(null)},mt=e=>{const t=null===e?null:Math.min(ut-1,Math.max(0,e));T?ve(t):pe(t)},ft=e=>{ke(null);mt(((T?be:ge)??(e>0?-1:ut))+e)},xt=null===dt?[]:t.flatMap((e,t)=>{if(!xe.visible[t]||ct&&ct.series!==t)return[];const n=Me[t]?.[dt];return n&&null!==n.value?[{seriesIndex:t,name:e.name,color:n.color??Ne[t],value:n.value,formatted:we(n.value),label:n.label}]:[]}),gt=ct&&G?G(ct):null,pt=gt?gt.items:"item"===ot&&xt.length>1&&null!==ye?[xt.reduce((e,t)=>Math.abs(tt(t.value??0)-ye)<Math.abs(tt(e.value??0)-ye)?t:e)]:xt,bt=ct?Me[ct.series]?.[ct.index]?.x??a?.[ct.index]??ct.index:void 0,vt=ct?ct.x:v?tt(pt[0]?.value??0):Je.left+et(dt??0),yt=ct?ct.y:v?Je.top+et(dt??0):Je.top,kt=ct?(ct.x-Je.left)/Math.max(1,Je.width)>.6:(v?Fe.fraction(pt[0]?.value??0):et(dt??0)/Math.max(1,Oe))>.6,wt=!1===te?{interactive:!1}:!0===te||void 0===te?{}:te,Mt=!0===te||!1!==te&&t.length>1,Nt=wt.side??"bottom",zt={...it,hovered:xe.hovered,activeIndex:dt,marks:rt,activeMark:ct},St=0===ze||null===Ae||"value"===$&&null===Ee;return n(X,{...ce,size:ae,variant:ie,padded:re,className:se,legendSide:Nt,legend:Mt?e(_,{series:t,colors:Ne,options:wt,visibility:xe,size:ae,swatch:U,values:wt.showValue&&null!==dt?t.map((e,t)=>{const n=Me[t]?.[dt]?.value;return null==n?void 0:we(n)}):void 0}):null,table:St?null:K?.(fe)??e(D,{id:fe,caption:ee,corner:Be?.label,categories:Se,series:t,values:Me,format:we,locale:Q}),children:[n("div",{ref:de,role:"img",tabIndex:St?void 0:0,"aria-label":ee??me.label,"aria-describedby":St?void 0:fe,onPointerMove:e=>{"none"!==ot&&(T?ve(((e,t)=>{const n=de.current;if(!n||0===rt.length)return null;const l=n.getBoundingClientRect(),a=e-l.left,i=t-l.top;let r=null,s=1/0,o=1/0;return rt.forEach((e,t)=>{const n=Math.hypot(e.x-a,e.y-i),l=void 0===e.rx?Math.max(0,n-e.r):Math.hypot(Math.max(0,Math.abs(e.x-a)-e.rx),Math.max(0,Math.abs(e.y-i)-(e.ry??e.rx)));l<=Z&&(l<s||l===s&&n<o)&&(s=l,o=n,r=t)}),r})(e.clientX,e.clientY)):pe(((e,t)=>{const n=de.current;if(!n||0===ze)return null;const l=n.getBoundingClientRect(),a=v?t-l.top-Je.top:e-l.left-Je.left;if(a<-Qe.step||a>Oe+Qe.step)return null;const i=B?ze<=1?0:Math.round(a/Oe*(ze-1)):Math.floor(a/Qe.step);return Math.min(ze-1,Math.max(0,i))})(e.clientX,e.clientY)),"item"===ot&&ke(((e,t)=>{const n=de.current;if(!n)return null;const l=n.getBoundingClientRect();return v?e-l.left:t-l.top})(e.clientX,e.clientY)))},onPointerLeave:ht,onKeyDown:"none"===ot?void 0:e=>{const t=v?"ArrowDown":"ArrowRight",n=v?"ArrowUp":"ArrowLeft";if(e.key===t)ft(1);else if(e.key===n)ft(-1);else if("Home"===e.key)mt(0);else if("End"===e.key)mt(ut-1);else{if("Escape"!==e.key)return;ht()}e.preventDefault()},onBlur:ht,className:A("relative w-full","rounded-(--neba-radius-xs)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"),style:{height:Pe??J},children:[St?e("div",{className:A("flex h-full items-center justify-center text-(--neba-muted-fg)",j[ae]),children:le??he.title}):ue>0?n("svg",{width:ue,height:Ge||"100%",viewBox:`0 0 ${ue} ${Ge}`,"aria-hidden":"true",className:"block overflow-visible",children:[e(Y,{plot:Je,scale:Fe,band:Qe,horizontal:v,inset:B,categoryPx:et,valuePx:tt,tickTexts:Re,categoryTexts:Ve,categoryScale:Ie,categoryValuePx:lt,valueAxis:We,categoryAxis:Be,fontSize:je,zeroPx:at}),null===dt||T||"index"!==ot||!1===st.crosshair?null:(()=>{const t=et(dt);return e("line",v?{x1:Je.left,x2:Je.left+Je.width,y1:Je.top+t,y2:Je.top+t,stroke:"var(--neba-chart-baseline)",strokeWidth:1}:{x1:Je.left+t,x2:Je.left+t,y1:Je.top,y2:Je.top+Je.height,stroke:"var(--neba-chart-baseline)",strokeWidth:1})})(),oe(zt)]}):null,null!==dt&&pt.length>0&&"none"!==ot?st.render?e("div",{className:"pointer-events-none absolute z-10",style:kt?{right:`calc(100% - ${vt}px + 10px)`,top:yt}:{left:vt+10,top:yt},children:st.render({index:dt,category:bt??Se[dt],items:pt})}):e(L,{heading:gt?gt.heading:m(bt??Se[dt],Q),items:pt,x:vt,y:yt,flip:kt,size:ae}):null]}),"none"===ot?null:e(V,{heading:null===dt?void 0:gt?.heading??m(bt??Se[dt],Q),items:pt})]})}function Y({plot:l,scale:a,horizontal:i,categoryPx:r,valuePx:s,tickTexts:o,categoryTexts:c,categoryScale:d,categoryValuePx:u,valueAxis:m,categoryAxis:f,fontSize:x,zeroPx:g}){const y=!1!==m?.grid&&!m?.hidden,k=!f?.hidden&&(f?.grid??null!==d),w=e=>d?u(d.ticks[e]):(i?l.top:l.left)+r(e),M=v(c.length,i?l.height:l.width,i?1.8*x:Math.max(...c.map(e=>b(e,x)),1)+12),N=v(a.ticks.length,i?l.width:l.height,i?Math.max(...o.map(e=>b(e,x)),1)+16:2*x),z=c.length>1?Math.abs(w(1)-w(0)):l.width,S=a.ticks.length>1?Math.abs(s(a.ticks[1])-s(a.ticks[0])):l.height,C=h(c.length,M,z,i?1.8*x:b(c[c.length-1]??"",x)),A=h(a.ticks.length,N,S,i?b(o[o.length-1]??"",x):1.6*x);return n("g",{children:[a.ticks.map((t,r)=>{const c=s(t),d=Math.abs(t)<1e-9;return n("g",{children:[y?e("line",i?{x1:c,x2:c,y1:l.top,y2:l.top+l.height,stroke:d?"var(--neba-chart-baseline)":"var(--neba-chart-grid)",strokeWidth:1}:{x1:l.left,x2:l.left+l.width,y1:c,y2:c,stroke:d?"var(--neba-chart-baseline)":"var(--neba-chart-grid)",strokeWidth:1}):null,m?.hidden||!p(r,a.ticks.length,N,A)?null:e("text",i?{x:c,y:l.top+l.height+x+6,textAnchor:0===r?"start":r===a.ticks.length-1?"end":"middle",fontSize:x,fill:"var(--neba-muted-fg)",className:"tabular-nums",children:o[r]}:{x:l.left-8,y:c,textAnchor:"end",dominantBaseline:"central",fontSize:x,fill:"var(--neba-muted-fg)",className:"tabular-nums",children:o[r]})]},t)}),f?.hidden?null:n(t,{children:[e("line",i?{x1:g,x2:g,y1:l.top,y2:l.top+l.height,stroke:"var(--neba-chart-axis)",strokeWidth:1}:{x1:l.left,x2:l.left+l.width,y1:g,y2:g,stroke:"var(--neba-chart-axis)",strokeWidth:1}),c.map((t,a)=>{const r=w(a),s=p(a,c.length,M,C);return i?s?e("text",{x:l.left-8,y:r,textAnchor:"end",dominantBaseline:"central",fontSize:x,fill:"var(--neba-muted-fg)",className:d?"tabular-nums":void 0,children:t},a):null:n("g",{children:[k?e("line",{x1:r,x2:r,y1:l.top,y2:l.top+l.height,stroke:"var(--neba-chart-grid)",strokeWidth:1}):null,s?e("text",{x:r,y:l.top+l.height+x+6,textAnchor:d?0===a?"start":a===c.length-1?"end":"middle":"middle",fontSize:x,fill:"var(--neba-muted-fg)",className:d?"tabular-nums":void 0,children:t}):null]},a)})]}),m?.label?e("text",{x:i?l.left+l.width:l.left,y:i?l.top+l.height+2*x+12:l.top-8,textAnchor:i?"end":"start",fontSize:x,fill:"var(--neba-muted-fg)",fontWeight:500,children:m.label}):null,f?.label&&!i?e("text",{x:l.left+l.width,y:l.top+l.height+2*x+12,textAnchor:"end",fontSize:x,fill:"var(--neba-muted-fg)",fontWeight:500,children:f.label}):null]})}export{D as ChartDataTable,_ as ChartLegendBar,T as ChartScaleLegend,V as ChartStatus,X as ChartSurface,L as ChartTooltipPanel,I as useMeasuredWidth,R as useVisibility};
@@ -94,20 +94,6 @@ export declare function sortRows<T>(rows: readonly T[], sort: readonly SortEntry
94
94
  * of a two-key sort does not silently make it the first.
95
95
  */
96
96
  export declare function nextSort(current: readonly SortEntry[], key: string, additive: boolean): SortEntry[];
97
- /**
98
- * A cell value as something a query can be matched against.
99
- *
100
- * Case-folded and stripped of combining marks, so `jose` finds `José` and
101
- * `SEOUL` finds `Seoul`. `NFD` splits an accented letter into the letter and
102
- * its accent and the range then deletes the accent; a search field is the one
103
- * place where losing that distinction is the point.
104
- *
105
- * A `Date` is deliberately *not* formatted here. What a reader sees in the cell
106
- * came out of the caller's `render`, and guessing a format the search would
107
- * agree with is how a table ends up not finding a date that is on the screen —
108
- * a column that wants its dates searchable gives them a `value`.
109
- */
110
- export declare function searchText(value: unknown): string;
111
97
  /** Where one page starts and stops, and how many there are. */
112
98
  export interface PageBounds {
113
99
  /** How many pages the rows come to. Never below `1`. */
@@ -1 +1 @@
1
- export const dataRowHeights={default:{xs:24,sm:28,md:32,lg:38,xl:44},compact:{xs:20,sm:24,md:28,lg:32,xl:38}};export const dataHeaderHeights={default:{xs:28,sm:32,md:36,lg:42,xl:48},compact:{xs:24,sm:28,md:32,lg:36,xl:42}};export const dataTickWidths={xs:30,sm:34,md:38,lg:42,xl:50};export const defaultColumnWidth=160;export const minColumnWidth=48;export function compareValues(t,e,n){const o=null==t||""===t,r=null==e||""===e;return o||r?o&&r?0:o?1:-1:"number"==typeof t&&"number"==typeof e?Number.isNaN(t)||Number.isNaN(e)?Number.isNaN(t)&&Number.isNaN(e)?0:Number.isNaN(t)?1:-1:t-e:"boolean"==typeof t&&"boolean"==typeof e?Number(t)-Number(e):t instanceof Date&&e instanceof Date?t.getTime()-e.getTime():n.compare(String(t),String(e))}export function sortRows(t,e,n){if(0===e.length)return t;const o=e.map(t=>{const e=n(t.key);return e?{compare:e,sign:"desc"===t.direction?-1:1}:null}).filter(t=>null!==t);return 0===o.length?t:[...t].sort((t,e)=>{for(const n of o){const o=n.compare(t,e);if(0!==o)return o*n.sign}return 0})}export function nextSort(t,e,n){const o=t.find(t=>t.key===e),r=void 0===o?"asc":"asc"===o.direction?"desc":null;return n?null===r?t.filter(t=>t.key!==e):void 0===o?[...t,{key:e,direction:r}]:t.map(t=>t.key===e?{key:e,direction:r}:t):null===r?[]:[{key:e,direction:r}]}export function searchText(t){return null==t||"object"==typeof t?"":String(t).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}export function pageBounds(t,e,n){const o=Math.max(1,Math.floor(n)),r=Math.max(1,Math.ceil(t/o)),a=Math.min(Math.max(Math.floor(e),1),r),i=(a-1)*o;return{pages:r,page:a,start:i,end:Math.min(i+o,t)}}export function virtualWindow(t,e,n,o,r){const a=e>0?Math.ceil(e/n):3*r,i=Math.max(0,Math.floor(t/n)-r),s=Math.min(o,i+a+2*r);return{start:i,end:s,before:i*n,after:Math.max(0,(o-s)*n)}}export function keysBetween(t,e,n){const o=t.indexOf(e),r=t.indexOf(n);return-1===o||-1===r?[]:t.slice(Math.min(o,r),Math.max(o,r)+1)}
1
+ export const dataRowHeights={default:{xs:24,sm:28,md:32,lg:38,xl:44},compact:{xs:20,sm:24,md:28,lg:32,xl:38}};export const dataHeaderHeights={default:{xs:28,sm:32,md:36,lg:42,xl:48},compact:{xs:24,sm:28,md:32,lg:36,xl:42}};export const dataTickWidths={xs:30,sm:34,md:38,lg:42,xl:50};export const defaultColumnWidth=160;export const minColumnWidth=48;export function compareValues(t,e,n){const o=null==t||""===t,r=null==e||""===e;return o||r?o&&r?0:o?1:-1:"number"==typeof t&&"number"==typeof e?Number.isNaN(t)||Number.isNaN(e)?Number.isNaN(t)&&Number.isNaN(e)?0:Number.isNaN(t)?1:-1:t-e:"boolean"==typeof t&&"boolean"==typeof e?Number(t)-Number(e):t instanceof Date&&e instanceof Date?t.getTime()-e.getTime():n.compare(String(t),String(e))}export function sortRows(t,e,n){if(0===e.length)return t;const o=e.map(t=>{const e=n(t.key);return e?{compare:e,sign:"desc"===t.direction?-1:1}:null}).filter(t=>null!==t);return 0===o.length?t:[...t].sort((t,e)=>{for(const n of o){const o=n.compare(t,e);if(0!==o)return o*n.sign}return 0})}export function nextSort(t,e,n){const o=t.find(t=>t.key===e),r=void 0===o?"asc":"asc"===o.direction?"desc":null;return n?null===r?t.filter(t=>t.key!==e):void 0===o?[...t,{key:e,direction:r}]:t.map(t=>t.key===e?{key:e,direction:r}:t):null===r?[]:[{key:e,direction:r}]}export function pageBounds(t,e,n){const o=Math.max(1,Math.floor(n)),r=Math.max(1,Math.ceil(t/o)),a=Math.min(Math.max(Math.floor(e),1),r),i=(a-1)*o;return{pages:r,page:a,start:i,end:Math.min(i+o,t)}}export function virtualWindow(t,e,n,o,r){const a=e>0?Math.ceil(e/n):3*r,i=Math.max(0,Math.floor(t/n)-r),s=Math.min(o,i+a+2*r);return{start:i,end:s,before:i*n,after:Math.max(0,(o-s)*n)}}export function keysBetween(t,e,n){const o=t.indexOf(e),r=t.indexOf(n);return-1===o||-1===r?[]:t.slice(Math.min(o,r),Math.max(o,r)+1)}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Everything a pointer drag takes from outside itself, and the one function
3
+ * that gives all of it back.
4
+ *
5
+ * Five components drag something: a Sidebar's edge, a Panes boundary, a
6
+ * WindowPane by its bar or its corner, a ScrollZone's strip, a DataTable's
7
+ * column rule. The arithmetic differs in every one of them and stays where it
8
+ * is. What was written five times and had already drifted is the scaffold
9
+ * around it — three listeners, a `dataset.dragging`, the document's text
10
+ * selection, and a teardown an unmount can call.
11
+ *
12
+ * The drift is the reason this exists rather than the repetition. A DataTable's
13
+ * column resize was the one copy with no selection suppression in it, so
14
+ * dragging a column boundary in Safari selected the text of every cell the
15
+ * pointer crossed; and it was the one with no unmount teardown, so a table that
16
+ * went away mid-drag left two listeners on a detached node.
17
+ *
18
+ * There is deliberately **no requestAnimationFrame in here.** A `pointermove`
19
+ * is already delivered once per frame in every browser the library supports —
20
+ * `pointerrawupdate` is the uncoalesced one — so coalescing again would buy
21
+ * nothing and cost a frame of latency on the one gesture where latency is the
22
+ * whole feel of it.
23
+ */
24
+ export interface PointerDragOptions {
25
+ /**
26
+ * The element the three listeners go on, and the one the pointer is captured
27
+ * to. Capture is what retargets every later event here, so a drag survives
28
+ * the pointer leaving the element it started on.
29
+ */
30
+ target: HTMLElement;
31
+ /** The pointer that started it. */
32
+ pointerId: number;
33
+ /** Every move until the gesture ends. */
34
+ onMove: (event: PointerEvent) => void;
35
+ /**
36
+ * The gesture ended the way it was meant to — the pointer was released.
37
+ *
38
+ * A `pointercancel` counts: the gesture is over and the caller wants to know
39
+ * where it settled. What does **not** count is the drag being torn down by an
40
+ * unmount — a component that disappeared did not finish resizing, and telling
41
+ * a caller it did would set state on the way out of the tree. That split is
42
+ * why `release` and `onEnd` are two things.
43
+ */
44
+ onEnd?: () => void;
45
+ /**
46
+ * Whether the document's text selection is taken for the length of it.
47
+ * @default true
48
+ */
49
+ selectable?: boolean;
50
+ /**
51
+ * Marks the target while it runs, for `data-[dragging]` to style against.
52
+ * @default true
53
+ */
54
+ mark?: boolean;
55
+ }
56
+ /**
57
+ * Starts a drag. Returns `release` — everything above, given back.
58
+ *
59
+ * Call `release` from an unmount effect. It is idempotent, so the pointer's own
60
+ * `pointerup` calling it first costs nothing.
61
+ */
62
+ export declare function beginPointerDrag({ target, pointerId, onMove, onEnd, selectable, mark }: PointerDragOptions): () => void;
@@ -0,0 +1 @@
1
+ export function beginPointerDrag({target:e,pointerId:t,onMove:r,onEnd:n,selectable:o=!0,mark:s=!0}){const i=o?function(){const e=document.body,t=e.style.getPropertyValue("-webkit-user-select");return e.style.setProperty("-webkit-user-select","none"),()=>{t?e.style.setProperty("-webkit-user-select",t):e.style.removeProperty("-webkit-user-select")}}():null;s&&(e.dataset.dragging="true"),e.setPointerCapture&&e.setPointerCapture(t);let a=!0;const l=()=>{a&&(a=!1,e.removeEventListener("pointermove",r),e.removeEventListener("pointerup",p),e.removeEventListener("pointercancel",p),s&&delete e.dataset.dragging,i?.())},p=()=>{l(),n?.()};return e.addEventListener("pointermove",r),e.addEventListener("pointerup",p),e.addEventListener("pointercancel",p),l}
@@ -1 +1 @@
1
- const i={bash:()=>import("highlight.js/lib/languages/bash"),c:()=>import("highlight.js/lib/languages/c"),cpp:()=>import("highlight.js/lib/languages/cpp"),csharp:()=>import("highlight.js/lib/languages/csharp"),css:()=>import("highlight.js/lib/languages/css"),diff:()=>import("highlight.js/lib/languages/diff"),dockerfile:()=>import("highlight.js/lib/languages/dockerfile"),go:()=>import("highlight.js/lib/languages/go"),graphql:()=>import("highlight.js/lib/languages/graphql"),ini:()=>import("highlight.js/lib/languages/ini"),java:()=>import("highlight.js/lib/languages/java"),javascript:()=>import("highlight.js/lib/languages/javascript"),json:()=>import("highlight.js/lib/languages/json"),kotlin:()=>import("highlight.js/lib/languages/kotlin"),less:()=>import("highlight.js/lib/languages/less"),lua:()=>import("highlight.js/lib/languages/lua"),makefile:()=>import("highlight.js/lib/languages/makefile"),markdown:()=>import("highlight.js/lib/languages/markdown"),objectivec:()=>import("highlight.js/lib/languages/objectivec"),perl:()=>import("highlight.js/lib/languages/perl"),php:()=>import("highlight.js/lib/languages/php"),plaintext:()=>import("highlight.js/lib/languages/plaintext"),powershell:()=>import("highlight.js/lib/languages/powershell"),python:()=>import("highlight.js/lib/languages/python"),r:()=>import("highlight.js/lib/languages/r"),ruby:()=>import("highlight.js/lib/languages/ruby"),rust:()=>import("highlight.js/lib/languages/rust"),scss:()=>import("highlight.js/lib/languages/scss"),shell:()=>import("highlight.js/lib/languages/shell"),sql:()=>import("highlight.js/lib/languages/sql"),swift:()=>import("highlight.js/lib/languages/swift"),typescript:()=>import("highlight.js/lib/languages/typescript"),xml:()=>import("highlight.js/lib/languages/xml"),yaml:()=>import("highlight.js/lib/languages/yaml")},t={"c++":"cpp",cc:"cpp",cjs:"javascript",console:"bash",cs:"csharp",cts:"typescript",docker:"dockerfile",gql:"graphql",golang:"go",h:"cpp",hpp:"cpp",htm:"xml",html:"xml",js:"javascript",jsx:"javascript",kt:"kotlin",kts:"kotlin",md:"markdown",mdx:"markdown",mjs:"javascript",mm:"objectivec",mts:"typescript",mysql:"sql",node:"javascript",none:"plaintext",objc:"objectivec",plain:"plaintext",posh:"powershell",ps1:"powershell",psql:"sql",py:"python",rb:"ruby",rs:"rust",sh:"bash",svelte:"xml",svg:"xml",text:"plaintext",toml:"ini",ts:"typescript",tsx:"typescript",txt:"plaintext",vue:"xml",yml:"yaml",zsh:"bash"},l=new Map;export function registerLanguage(i,t){const g=i.toLowerCase();l.set(g,t),s.delete(g)}let g=null;const s=new Map;export function canonicalLanguage(i){if(!i)return null;const l=i.trim().toLowerCase();return l?t[l]??l:null}export async function highlight(t,a){let e=s.get(a);e||(e=async function(t){const s=l.get(t),a=s?void 0:i[t];if(!s&&!a)return null;g??=import("highlight.js/lib/core").then(i=>i.default);const e=await g;return s?e.registerLanguage(t,s):e.getLanguage(t)||e.registerLanguage(t,(await a()).default),t}(a),s.set(a,e));const h=await e;if(!h||!g)return null;return tokenize((await g).highlight(t,{language:h,ignoreIllegals:!0}).value)}const a={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'"};export function tokenize(i){const t=[[]],l=[],g=/<span class="([^"]*)">|<\/span>/g;let s=0;const e=i=>{if(!i)return;const g=l[l.length-1];i.replace(/&(?:amp|lt|gt|quot|#x27);/g,i=>a[i]).split("\n").forEach((i,l)=>{l>0&&t.push([]),i&&t[t.length-1].push(g?{text:i,token:g}:{text:i})})};for(const t of i.matchAll(g))e(i.slice(s,t.index)),s=t.index+t[0].length,void 0===t[1]?l.pop():l.push(t[1]);return e(i.slice(s)),t}export function plainLines(i){return i.split("\n").map(i=>i?[{text:i}]:[])}
1
+ const i={bash:()=>import("highlight.js/lib/languages/bash"),c:()=>import("highlight.js/lib/languages/c"),cpp:()=>import("highlight.js/lib/languages/cpp"),csharp:()=>import("highlight.js/lib/languages/csharp"),css:()=>import("highlight.js/lib/languages/css"),diff:()=>import("highlight.js/lib/languages/diff"),dockerfile:()=>import("highlight.js/lib/languages/dockerfile"),go:()=>import("highlight.js/lib/languages/go"),graphql:()=>import("highlight.js/lib/languages/graphql"),ini:()=>import("highlight.js/lib/languages/ini"),java:()=>import("highlight.js/lib/languages/java"),javascript:()=>import("highlight.js/lib/languages/javascript"),json:()=>import("highlight.js/lib/languages/json"),kotlin:()=>import("highlight.js/lib/languages/kotlin"),less:()=>import("highlight.js/lib/languages/less"),lua:()=>import("highlight.js/lib/languages/lua"),makefile:()=>import("highlight.js/lib/languages/makefile"),markdown:()=>import("highlight.js/lib/languages/markdown"),objectivec:()=>import("highlight.js/lib/languages/objectivec"),perl:()=>import("highlight.js/lib/languages/perl"),php:()=>import("highlight.js/lib/languages/php"),plaintext:()=>import("highlight.js/lib/languages/plaintext"),powershell:()=>import("highlight.js/lib/languages/powershell"),python:()=>import("highlight.js/lib/languages/python"),r:()=>import("highlight.js/lib/languages/r"),ruby:()=>import("highlight.js/lib/languages/ruby"),rust:()=>import("highlight.js/lib/languages/rust"),scss:()=>import("highlight.js/lib/languages/scss"),shell:()=>import("highlight.js/lib/languages/shell"),sql:()=>import("highlight.js/lib/languages/sql"),swift:()=>import("highlight.js/lib/languages/swift"),typescript:()=>import("highlight.js/lib/languages/typescript"),xml:()=>import("highlight.js/lib/languages/xml"),yaml:()=>import("highlight.js/lib/languages/yaml")},t={"c++":"cpp",cc:"cpp",cjs:"javascript",console:"bash",cs:"csharp",cts:"typescript",docker:"dockerfile",gql:"graphql",golang:"go",h:"cpp",hpp:"cpp",htm:"xml",html:"xml",js:"javascript",jsx:"javascript",kt:"kotlin",kts:"kotlin",md:"markdown",mdx:"markdown",mjs:"javascript",mm:"objectivec",mts:"typescript",mysql:"sql",node:"javascript",none:"plaintext",objc:"objectivec",plain:"plaintext",posh:"powershell",ps1:"powershell",psql:"sql",py:"python",rb:"ruby",rs:"rust",sh:"bash",svelte:"xml",svg:"xml",text:"plaintext",toml:"ini",ts:"typescript",tsx:"typescript",txt:"plaintext",vue:"xml",yml:"yaml",zsh:"bash"},l=new Map;export function registerLanguage(i,t){const g=i.toLowerCase();l.set(g,t),s.delete(g)}let g=null;const s=new Map;export function canonicalLanguage(i){if(!i)return null;const l=i.trim().toLowerCase();return l?t[l]??l:null}export async function highlight(t,a){let e=s.get(a);e||(e=async function(t){const s=l.get(t),a=s?void 0:i[t];if(!s&&!a)return null;g??=import("highlight.js/lib/core").then(i=>i.default);const e=await g;return s?e.registerLanguage(t,s):e.getLanguage(t)||e.registerLanguage(t,(await a()).default),t}(a).catch(i=>{throw s.delete(a),i}),s.set(a,e));const h=await e;if(!h||!g)return null;return tokenize((await g).highlight(t,{language:h,ignoreIllegals:!0}).value)}const a={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'"};export function tokenize(i){const t=[[]],l=[],g=/<span class="([^"]*)">|<\/span>/g;let s=0;const e=i=>{if(!i)return;const g=l[l.length-1];i.replace(/&(?:amp|lt|gt|quot|#x27);/g,i=>a[i]).split("\n").forEach((i,l)=>{l>0&&t.push([]),i&&t[t.length-1].push(g?{text:i,token:g}:{text:i})})};for(const t of i.matchAll(g))e(i.slice(s,t.index)),s=t.index+t[0].length,void 0===t[1]?l.pop():l.push(t[1]);return e(i.slice(s)),t}export function plainLines(i){return i.split("\n").map(i=>i?[{text:i}]:[])}
@@ -33,6 +33,16 @@
33
33
  * string itself, so an unsupported language is never a dead end: `locale` gets
34
34
  * you a translation for free, and the prop gets you one for anything else.
35
35
  */
36
+ /**
37
+ * `{index}`, `{total}` and `{title}` filled into a message.
38
+ *
39
+ * It lives beside the tables rather than in whichever component needed it first
40
+ * because the placeholders are part of the message format: a language that
41
+ * orders "3 of 8" the other way round writes `{total}단계 중 {index}단계`, and a
42
+ * second copy of this function would eventually disagree about what a
43
+ * placeholder looks like.
44
+ */
45
+ export declare function fill(template: string, values: Record<string, string>): string;
36
46
  /**
37
47
  * One namespace's strings, in every language that has them.
38
48
  *
@@ -257,6 +267,21 @@ export interface CarouselMessages {
257
267
  }
258
268
  /** The `carousel` namespace, as Carousel read it. */
259
269
  export declare const carouselMessages: MessageTable<CarouselMessages>;
270
+ /**
271
+ * The charts.
272
+ *
273
+ * A chart is a `role="img"`, and an image without a name is a focus stop that
274
+ * announces nothing at all. Every chart takes a `label` saying what it is a
275
+ * chart *of*, and this is what stands in when it was not given one — the same
276
+ * bargain Empty makes, and for the same reason: there is nowhere else for the
277
+ * word to come from.
278
+ */
279
+ export interface ChartMessages {
280
+ /** Names the drawing when the caller did not. */
281
+ label: string;
282
+ }
283
+ /** The `chart` namespace, as every chart reads it. */
284
+ export declare const chartMessages: MessageTable<ChartMessages>;
260
285
  /**
261
286
  * ScrollZone.
262
287
  *
@@ -266,6 +291,16 @@ export declare const carouselMessages: MessageTable<CarouselMessages>;
266
291
  * right.
267
292
  */
268
293
  export interface ScrollMessages {
294
+ /**
295
+ * Names the strip itself.
296
+ *
297
+ * A scroll container is a tab stop — it has to be, or a reader with no
298
+ * pointer cannot move it — and a tab stop with no name announces nothing at
299
+ * all when the focus lands on it. `label` on the component says what the
300
+ * strip holds; this says what it *is*, for the far more common case where
301
+ * the surrounding page has already said the first part.
302
+ */
303
+ label: string;
269
304
  previous: string;
270
305
  next: string;
271
306
  }
@@ -280,6 +315,43 @@ export interface BreadcrumbMessages {
280
315
  }
281
316
  /** The `breadcrumb` namespace, as Breadcrumb read it. */
282
317
  export declare const breadcrumbMessages: MessageTable<BreadcrumbMessages>;
318
+ /** CommandPalette. */
319
+ export interface CommandMessages {
320
+ /** Names the dialog, which has no visible title of its own. */
321
+ label: string;
322
+ /** The placeholder in the field the reader types into. */
323
+ search: string;
324
+ /** The line where the rows would be, when nothing matched. */
325
+ empty: string;
326
+ }
327
+ /** The `command` namespace, as CommandPalette read it. */
328
+ export declare const commandMessages: MessageTable<CommandMessages>;
329
+ /** Transfer. */
330
+ export interface TransferMessages {
331
+ /** The heading over the list of everything not yet chosen. */
332
+ source: string;
333
+ /** And over the list of what has been. */
334
+ target: string;
335
+ /** The button that moves the ticked rows to the right-hand list. */
336
+ toTarget: string;
337
+ /** And the one that sends them back. */
338
+ toSource: string;
339
+ /** The placeholder in each list's filter. */
340
+ search: string;
341
+ /** The tick above a list that takes every row in it at once. */
342
+ selectAll: string;
343
+ /** The line where the rows would be, when a list has none. */
344
+ empty: string;
345
+ }
346
+ /** The `transfer` namespace, as Transfer read it. */
347
+ export declare const transferMessages: MessageTable<TransferMessages>;
348
+ /** Anchor. */
349
+ export interface AnchorMessages {
350
+ /** Names the `<nav>` landmark. */
351
+ label: string;
352
+ }
353
+ /** The `anchor` namespace, as Anchor read it. */
354
+ export declare const anchorMessages: MessageTable<AnchorMessages>;
283
355
  /** Combobox. */
284
356
  export interface ComboboxMessages {
285
357
  /** The line where the list would be, when nothing matched what was typed. */
@@ -380,6 +452,8 @@ export interface StepsMessages {
380
452
  next: string;
381
453
  /** And what it becomes on the last step. */
382
454
  done: string;
455
+ /** The way out of a guide that is running over the page, for a Tour. */
456
+ skip: string;
383
457
  /** The button under a finished guide. */
384
458
  restart: string;
385
459
  /** What a finished guide says. */
@@ -448,10 +522,18 @@ export interface NebaLocale {
448
522
  pagination?: Partial<PaginationMessages>;
449
523
  /** Carousel. */
450
524
  carousel?: Partial<CarouselMessages>;
525
+ /** Chart. */
526
+ chart?: Partial<ChartMessages>;
451
527
  /** Scroll. */
452
528
  scroll?: Partial<ScrollMessages>;
453
529
  /** Breadcrumb. */
454
530
  breadcrumb?: Partial<BreadcrumbMessages>;
531
+ /** Anchor. */
532
+ anchor?: Partial<AnchorMessages>;
533
+ /** Transfer. */
534
+ transfer?: Partial<TransferMessages>;
535
+ /** Command. */
536
+ command?: Partial<CommandMessages>;
455
537
  /** Combobox. */
456
538
  combobox?: Partial<ComboboxMessages>;
457
539
  /** Overlay. */
@@ -1 +1 @@
1
- import*as e from"react";export const actionMessages={"":{close:"Close",dismiss:"Dismiss",clear:"Clear",remove:"Remove"}};export const linkMessages={"":{newTab:"(opens in a new tab)"}};export const spoilerMessages={"":{reveal:"Reveal",hide:"Hide",notice:"This may contain spoilers"}};export const chatMessages={"":{sending:"Sending",sent:"Sent",delivered:"Delivered",read:"Read",failed:"Not sent",typing:"Typing…"}};export const emptyMessages={"":{title:"Nothing here"}};export const tableMessages={"":{search:"Search",selectAll:"Select all rows",selectRow:"Select row",rowsPerPage:"Rows per page",range:"{start}–{end} of {total}",selected:"{count} selected",empty:"No data"}};export const colorMessages={"":{area:"Saturation and brightness",hue:"Hue",alpha:"Opacity",value:"Colour value",swatches:"Preset colours",clear:"Clear",empty:"Choose a colour"}};export const ratingMessages={"":{label:"Rating",value:"{value} out of {max}",empty:"No rating"}};export const numberMessages={"":{increase:"Increase",decrease:"Decrease"}};export const paginationMessages={"":{label:"Pagination",page:"Page {page}",status:"Page {page} of {total}",previous:"Previous page",next:"Next page",first:"First page",last:"Last page"}};export const carouselMessages={"":{label:"Carousel",slide:"Slide {index} of {total}",previous:"Previous slide",next:"Next slide"}};export const scrollMessages={"":{previous:"Scroll back",next:"Scroll forward"}};export const breadcrumbMessages={"":{label:"Breadcrumb",expand:"Show hidden steps"}};export const comboboxMessages={"":{empty:"No matches",remove:"Remove {label}"}};export const overlayMessages={"":{label:"Overlay"}};export const windowMessages={"":{minimize:"Minimize",maximize:"Maximize",restore:"Restore",resize:"Resize window"}};export const layoutMessages={"":{skipToContent:"Skip to content",sidebar:"Sidebar",openSidebar:"Open sidebar",closeSidebar:"Close sidebar",resizeSidebar:"Resize sidebar"}};export const codeMessages={"":{code:"Code",copy:"Copy",copied:"Copied",copyFailed:"Could not copy",raw:"Raw",prompt:"Prompt"}};export const stepsMessages={"":{previous:"Previous",next:"Next",done:"Done",restart:"Start over",completed:"All steps complete",steps:"Steps",position:"{index} of {total}",step:"Step {index}: {title}"}};const s={zh:"zh-hans","zh-cn":"zh-hans","zh-my":"zh-hans","zh-sg":"zh-hans","zh-hk":"zh-hant","zh-mo":"zh-hant","zh-tw":"zh-hant"};const o=new WeakMap;export function resolveMessages(e,t){const a=e[""],r=t?.trim()??"";if(!r)return a;let n=o.get(e);n||(n=new Map,o.set(e,n));const i=n.get(r);if(i)return i;const l=function(e){const s=e.toLowerCase().split(/[-_]/).filter(Boolean),o=s[0];if(!o)return[];const t=s.slice(1),a=t.find(e=>/^[a-z]{4}$/.test(e)),r=t.find(e=>/^([a-z]{2}|\d{3})$/.test(e));return[a?`${o}-${a}`:"",r?`${o}-${r}`:"",o].filter(Boolean)}(r).map(o=>{const t=s[o];return e[o]??(t?e[t]:void 0)}).find(Boolean),c=l?{...a,...l}:a;return n.set(r,c),c}export function useMessages(s,o){return e.useMemo(()=>resolveMessages(s,o),[s,o])}export function fillMessage(e,s){return e.replace(/\{(\w+)\}/g,(e,o)=>s[o]??e)}const t={action:actionMessages,link:linkMessages,spoiler:spoilerMessages,chat:chatMessages,empty:emptyMessages,table:tableMessages,color:colorMessages,rating:ratingMessages,number:numberMessages,pagination:paginationMessages,carousel:carouselMessages,scroll:scrollMessages,breadcrumb:breadcrumbMessages,combobox:comboboxMessages,overlay:overlayMessages,window:windowMessages,layout:layoutMessages,code:codeMessages,steps:stepsMessages};export function registerMessages(e,s){const a=e.trim().toLowerCase();for(const[e,r]of Object.entries(s)){const s=t[e];s&&r&&(s[a]=r,o.delete(s))}}
1
+ import*as e from"react";export function fill(e,s){return e.replace(/\{(\w+)\}/g,(e,t)=>s[t]??e)}export const actionMessages={"":{close:"Close",dismiss:"Dismiss",clear:"Clear",remove:"Remove"}};export const linkMessages={"":{newTab:"(opens in a new tab)"}};export const spoilerMessages={"":{reveal:"Reveal",hide:"Hide",notice:"This may contain spoilers"}};export const chatMessages={"":{sending:"Sending",sent:"Sent",delivered:"Delivered",read:"Read",failed:"Not sent",typing:"Typing…"}};export const emptyMessages={"":{title:"Nothing here"}};export const tableMessages={"":{search:"Search",selectAll:"Select all rows",selectRow:"Select row",rowsPerPage:"Rows per page",range:"{start}–{end} of {total}",selected:"{count} selected",empty:"No data"}};export const colorMessages={"":{area:"Saturation and brightness",hue:"Hue",alpha:"Opacity",value:"Colour value",swatches:"Preset colours",clear:"Clear",empty:"Choose a colour"}};export const ratingMessages={"":{label:"Rating",value:"{value} out of {max}",empty:"No rating"}};export const numberMessages={"":{increase:"Increase",decrease:"Decrease"}};export const paginationMessages={"":{label:"Pagination",page:"Page {page}",status:"Page {page} of {total}",previous:"Previous page",next:"Next page",first:"First page",last:"Last page"}};export const carouselMessages={"":{label:"Carousel",slide:"Slide {index} of {total}",previous:"Previous slide",next:"Next slide"}};export const chartMessages={"":{label:"Chart"}};export const scrollMessages={"":{label:"Scrollable content",previous:"Scroll back",next:"Scroll forward"}};export const breadcrumbMessages={"":{label:"Breadcrumb",expand:"Show hidden steps"}};export const commandMessages={"":{label:"Command palette",search:"Type a command or search…",empty:"No commands found"}};export const transferMessages={"":{source:"Available",target:"Selected",toTarget:"Move to selected",toSource:"Move to available",search:"Search",selectAll:"Select all",empty:"Nothing here"}};export const anchorMessages={"":{label:"On this page"}};export const comboboxMessages={"":{empty:"No matches",remove:"Remove {label}"}};export const overlayMessages={"":{label:"Overlay"}};export const windowMessages={"":{minimize:"Minimize",maximize:"Maximize",restore:"Restore",resize:"Resize window"}};export const layoutMessages={"":{skipToContent:"Skip to content",sidebar:"Sidebar",openSidebar:"Open sidebar",closeSidebar:"Close sidebar",resizeSidebar:"Resize sidebar"}};export const codeMessages={"":{code:"Code",copy:"Copy",copied:"Copied",copyFailed:"Could not copy",raw:"Raw",prompt:"Prompt"}};export const stepsMessages={"":{previous:"Previous",next:"Next",done:"Done",skip:"Skip",restart:"Start over",completed:"All steps complete",steps:"Steps",position:"{index} of {total}",step:"Step {index}: {title}"}};const s={zh:"zh-hans","zh-cn":"zh-hans","zh-my":"zh-hans","zh-sg":"zh-hans","zh-hk":"zh-hant","zh-mo":"zh-hant","zh-tw":"zh-hant"};const t=new WeakMap;export function resolveMessages(e,o){const a=e[""],r=o?.trim()??"";if(!r)return a;let n=t.get(e);n||(n=new Map,t.set(e,n));const l=n.get(r);if(l)return l;const c=function(e){const s=e.toLowerCase().split(/[-_]/).filter(Boolean),t=s[0];if(!t)return[];const o=s.slice(1),a=o.find(e=>/^[a-z]{4}$/.test(e)),r=o.find(e=>/^([a-z]{2}|\d{3})$/.test(e));return[a?`${t}-${a}`:"",r?`${t}-${r}`:"",t].filter(Boolean)}(r).map(t=>{const o=s[t];return e[t]??(o?e[o]:void 0)}).find(Boolean),i=c?{...a,...c}:a;return n.set(r,i),i}export function useMessages(s,t){return e.useMemo(()=>resolveMessages(s,t),[s,t])}export function fillMessage(e,s){return e.replace(/\{(\w+)\}/g,(e,t)=>s[t]??e)}const o={action:actionMessages,link:linkMessages,spoiler:spoilerMessages,chat:chatMessages,empty:emptyMessages,table:tableMessages,color:colorMessages,rating:ratingMessages,number:numberMessages,pagination:paginationMessages,carousel:carouselMessages,chart:chartMessages,scroll:scrollMessages,breadcrumb:breadcrumbMessages,anchor:anchorMessages,transfer:transferMessages,command:commandMessages,combobox:comboboxMessages,overlay:overlayMessages,window:windowMessages,layout:layoutMessages,code:codeMessages,steps:stepsMessages};export function registerMessages(e,s){const a=e.trim().toLowerCase();for(const[e,r]of Object.entries(s)){const s=o[e];s&&r&&(s[a]=r,t.delete(s))}}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The one rule the library makes about a link it did not write.
3
+ *
4
+ * A `target` other than the current tab hands the new page a `window.opener`
5
+ * pointing back at this one, and a `Referer` header naming it. Modern browsers
6
+ * imply `noopener` for `target="_blank"`; none of them implies `noreferrer`,
7
+ * and neither is implied for a named target. So the two tokens are added
8
+ * wherever a component lets a caller choose where a link opens — TextLink,
9
+ * a Menu row, a NavigationMenu link — and they are added the same way in all
10
+ * three, because a library where only one of them is safe is a library whose
11
+ * users cannot tell which.
12
+ *
13
+ * It is a *merge* and not an override, and that is the whole reason this is a
14
+ * function rather than a string. The common reason to write a `rel` by hand is
15
+ * `nofollow` or `sponsored`, which is an SEO decision and has nothing to do
16
+ * with the two tokens above — spelled as a plain default it would silently take
17
+ * the protection off the link that still opens in a new tab.
18
+ */
19
+ export declare function safeRel(target: string | undefined, rel: string | undefined): string | undefined;
@@ -0,0 +1 @@
1
+ export function safeRel(e,n){return e&&"_self"!==e&&"_parent"!==e&&"_top"!==e?[...new Set([...(n??"").split(/\s+/).filter(Boolean),"noopener","noreferrer"])].join(" "):n}
@@ -0,0 +1,29 @@
1
+ /** Subscribes to one query. A no-op where there is no window to ask. */
2
+ export declare function subscribeToQuery(query: string, onChange: () => void): () => void;
3
+ /** The current answer. Reads a live object rather than building one. */
4
+ export declare function queryMatches(query: string): boolean;
5
+ /** A server has no window, so nothing matches. */
6
+ export declare function noMatchOnServer(): boolean;
7
+ /** The query behind every "the reader asked for less motion" decision. */
8
+ export declare const reducedMotionQuery = "(prefers-reduced-motion: reduce)";
9
+ /**
10
+ * Whether the reader has asked for less motion.
11
+ *
12
+ * The CSS side of this is handled in the stylesheet, where every keyframe is
13
+ * switched off at once. This is for the motion written in JavaScript — a
14
+ * typewriter, a headline reel, a measured marquee, a carousel that advances on
15
+ * a timer — where there is no rule to switch off and the component has to
16
+ * decide for itself what "still" means.
17
+ *
18
+ * `useSyncExternalStore` rather than state plus an effect, which is the same
19
+ * choice Shortcut makes for the same reason: a media query is an external
20
+ * store, and reading it in an effect means every animated element on the page
21
+ * renders once with the wrong answer and then again with the right one. Here
22
+ * that first render is the one that would start a typewriter a reader asked
23
+ * not to see.
24
+ *
25
+ * It lives beside the query rather than in `animate.ts` so that a Carousel and
26
+ * a ScrollZone can ask without pulling the eleven animation effects in with the
27
+ * answer.
28
+ */
29
+ export declare function usePrefersReducedMotion(): boolean;
@@ -0,0 +1 @@
1
+ "use client";import*as e from"react";const n=new Map;function r(e){if(n.has(e))return n.get(e)??null;const r="undefined"!=typeof window&&window.matchMedia?window.matchMedia(e):null;return n.set(e,r),r}export function subscribeToQuery(e,n){const t=r(e);return t?(t.addEventListener("change",n),()=>t.removeEventListener("change",n)):()=>{}}export function queryMatches(e){return r(e)?.matches??!1}export function noMatchOnServer(){return!1}export const reducedMotionQuery="(prefers-reduced-motion: reduce)";const t=e=>subscribeToQuery(reducedMotionQuery,e),o=()=>queryMatches(reducedMotionQuery);export function usePrefersReducedMotion(){return e.useSyncExternalStore(t,o,noMatchOnServer)}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The two browser observers the library uses, as one each rather than one per
3
+ * component.
4
+ *
5
+ * Eleven components measure themselves and every one of them was building a
6
+ * `ResizeObserver` of its own; eleven `Animate*` wrappers watch for their own
7
+ * element scrolling into view and every one was building an
8
+ * `IntersectionObserver`. Neither is free — each is a separate registration the
9
+ * browser has to walk on every layout, and each delivers its own callback task
10
+ * — and a dashboard of eight charts inside a PageLayout with a Panes and a
11
+ * ScrollZone in it is a page with a dozen of them for no reason at all.
12
+ *
13
+ * An observer takes any number of targets, so one is enough. What each of these
14
+ * adds is the routing: a target to the callbacks watching it, and an
15
+ * `unobserve` when the last of them goes away.
16
+ *
17
+ * There is no cross-component behaviour here. A shared observer batches the
18
+ * entries it delivers, which is if anything the better arrangement — two charts
19
+ * on one row resize in one callback rather than two.
20
+ */
21
+ /** What a watcher is told: the entry for its own element, and nothing else. */
22
+ type ResizeCallback = (entry: ResizeObserverEntry) => void;
23
+ /**
24
+ * Watches one element's size. Returns the function that stops watching.
25
+ *
26
+ * A no-op where there is no `ResizeObserver` — an old browser, or a server —
27
+ * which is why every caller measures once itself before calling this rather
28
+ * than waiting to be told.
29
+ */
30
+ export declare function observeResize(element: Element, onResize: ResizeCallback): () => void;
31
+ /** What a watcher is told: whether its own element is on screen. */
32
+ type VisibilityCallback = (visible: boolean) => void;
33
+ /**
34
+ * Watches whether one element is on screen. Returns the function that stops.
35
+ *
36
+ * `null` where there is no `IntersectionObserver`, rather than a no-op: a
37
+ * caller cannot know the answer without one, and the right fallback is to show
38
+ * the thing rather than to hide it forever — which is a decision only the
39
+ * caller can make.
40
+ */
41
+ export declare function observeVisibility(element: Element, threshold: number, onVisible: VisibilityCallback): (() => void) | null;
42
+ export {};
@@ -0,0 +1 @@
1
+ const e=new Map;let t=null;export function observeResize(r,n){const s="undefined"==typeof ResizeObserver?null:(t??=new ResizeObserver(t=>{for(const r of t){const t=e.get(r.target);if(t)for(const e of[...t])e(r)}}),t);if(!s)return()=>{};let o=e.get(r);return o||(o=new Set,e.set(r,o),s.observe(r)),o.add(n),()=>{const t=e.get(r);t&&(t.delete(n),0===t.size&&(e.delete(r),s.unobserve(r)))}}const r=new Map;export function observeVisibility(e,t,n){const s=function(e){if("undefined"==typeof IntersectionObserver)return null;let t=r.get(e);if(!t){const n=new Map;t={watchers:n,observer:new IntersectionObserver(e=>{for(const t of e){const e=n.get(t.target);if(e)for(const r of[...e])r(t.isIntersecting)}},{threshold:e})},r.set(e,t)}return t}(t);if(!s)return null;let o=s.watchers.get(e);return o||(o=new Set,s.watchers.set(e,o),s.observer.observe(e)),o.add(n),()=>{const t=s.watchers.get(e);t&&(t.delete(n),0===t.size&&(s.watchers.delete(e),s.observer.unobserve(e)))}}
@@ -1 +1 @@
1
- "use client";import*as e from"react";export const PageLayoutContext=/*@__PURE__*/e.createContext({present:!1,register:()=>{},collapseBelow:"none",open:{start:!1,end:!1},setOpen:()=>{},scroll:"page"});export const SidebarSideContext=/*@__PURE__*/e.createContext(null);const n={xs:null,sm:"(width < 40rem)",md:"(width < 48rem)",lg:"(width < 64rem)",xl:"(width < 80rem)"};export const collapsedOnlyClasses={none:"hidden",xs:"hidden",sm:"sm:hidden",md:"md:hidden",lg:"lg:hidden",xl:"xl:hidden"};export const expandedOnlyClasses={none:"",xs:"",sm:"max-sm:hidden",md:"max-md:hidden",lg:"max-lg:hidden",xl:"max-xl:hidden"};export function useCollapsed(t){const d="none"===t?null:n[t],o=e.useCallback(e=>{if(!d||"undefined"==typeof window||!window.matchMedia)return()=>{};const n=window.matchMedia(d);return n.addEventListener("change",e),()=>n.removeEventListener("change",e)},[d]),i=e.useCallback(()=>!(!d||"undefined"==typeof window||!window.matchMedia)&&window.matchMedia(d).matches,[d]);return e.useSyncExternalStore(o,i,()=>!1)}export function drawerSide(e){const n="undefined"!=typeof document&&"rtl"===getComputedStyle(document.documentElement).direction;return"start"===e?n?"right":"left":n?"left":"right"}
1
+ "use client";import*as e from"react";import{noMatchOnServer as t,queryMatches as n,subscribeToQuery as d}from"./media.js";export const PageLayoutContext=/*@__PURE__*/e.createContext({present:!1,register:()=>{},collapseBelow:"none",open:{start:!1,end:!1},setOpen:()=>{},scroll:"page"});export const SidebarSideContext=/*@__PURE__*/e.createContext(null);const o={xs:null,sm:"(width < 40rem)",md:"(width < 48rem)",lg:"(width < 64rem)",xl:"(width < 80rem)"};export const collapsedOnlyClasses={none:"hidden",xs:"hidden",sm:"sm:hidden",md:"md:hidden",lg:"lg:hidden",xl:"xl:hidden"};export const expandedOnlyClasses={none:"",xs:"",sm:"max-sm:hidden",md:"max-md:hidden",lg:"max-lg:hidden",xl:"max-xl:hidden"};export function useCollapsed(l){const s="none"===l?null:o[l],r=e.useCallback(e=>s?d(s,e):()=>{},[s]),i=e.useCallback(()=>!!s&&n(s),[s]);return e.useSyncExternalStore(r,i,t)}export function drawerSide(e){const t="undefined"!=typeof document&&"rtl"===getComputedStyle(document.documentElement).direction;return"start"===e?t?"right":"left":t?"left":"right"}
@@ -1 +1 @@
1
- import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as a from"react";import{Field as i}from"@base-ui/react/field";import{Popover as t}from"@base-ui/react/popover";import{CloseIcon as l}from"./icons.js";import{WidthSizer as r}from"./sizer.js";import{chipRemoveClasses as o,controlHeightClasses as s,controlTextLeadingClasses as d,cx as c,disabledClasses as p,fieldReadOnlyClasses as u,fieldRestClasses as m,focusWithinRingClasses as f,gapClasses as b,iconClasses as h,metaTextClasses as x,paddingXClasses as g,radiusClasses as v,stackGapClasses as y,surfaceClasses as N,surfaceSlots as w,transitionClasses as P}from"./styles.js";export function popupSlots(e,n){return{...w(e,n),"--n-fill":`var(--neba-${e}-fill)`,"--n-fill-hover":`var(--neba-${e}-fill-hover)`,"--n-fill-active":`var(--neba-${e}-fill-active)`,"--n-on-solid":`var(--neba-${e}-on-solid)`}}const j=["group relative flex w-full items-center select-none","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",P,"focus-within:[transition-duration:0ms]",f,h].join(" ");export const pickerPopupClasses=[N,"border bg-(--n-panel-press)","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]","[outline:none]","[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" ");export const popupPaddingClasses={xs:"p-1.5",sm:"p-2",md:"p-2.5",lg:"p-3",xl:"p-3.5"};export function PickerShell({variant:f="outline",size:h="md",color:N="primary",density:P="default",elevation:k=0,label:C,description:$,error:O,invalid:z,startIcon:F,fullWidth:R=!1,disabled:S=!1,readOnly:q=!1,required:D=!1,id:I,className:_,style:B,display:E,samples:L,empty:T,clearable:V=!1,onClear:W,open:A,onOpenChange:G,labels:H,hiddenValues:J,sideOffset:K=6,children:M,triggerRef:Q,...U}){const X=a.useId(),Y=I??`${X}-trigger`,Z=`${X}-label`,ee=`${X}-description`,ne=`${X}-error`,ae=null!=O&&!1!==O&&""!==O,ie=z??ae,te=ie?"danger":N,le=S||q,re=[$?ee:null,ae?ne:null].filter(Boolean).join(" ")||void 0;return n(i.Root,{disabled:S,invalid:ie,className:c("flex-col align-top",y[h],R?"flex w-full":"inline-flex",_),style:{...w(te,k),...B},...U,children:[C?e(i.Label,{id:Z,htmlFor:Y,className:c(x[h],"font-medium",S?"text-(--neba-disabled-fg)":"text-(--neba-fg)"),children:C}):null,n(t.Root,{open:A,onOpenChange:e=>G(e),children:[n("span",{className:c(j,s[h],d[h],v[h],b[h],g[P][h],S?p[f]:q?u[f]:m[f]),children:[n(t.Trigger,{id:Y,ref:Q,disabled:S,"aria-labelledby":C?Z:void 0,"aria-describedby":re,"aria-required":D||void 0,"aria-invalid":ie||void 0,className:c("flex min-w-0 flex-1 items-center bg-transparent text-start [font:inherit] text-inherit",b[h],"[outline:none]",le?"cursor-default":"cursor-pointer"),children:[F?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg) transition-[color] duration-(--neba-duration) group-focus-within:text-(--n-accent)",children:F}):null,n("span",{className:"flex min-w-0 flex-1 flex-col",children:[e("span",{className:c("w-full truncate",T?"text-(--neba-muted-fg)":"text-(--neba-fg)"),children:E}),e(r,{samples:L??[]})]})]}),!V||T||le?null:e("button",{type:"button","aria-label":H.clear,className:c(o,"text-(--neba-muted-fg)"),onClick:e=>{e.stopPropagation(),W()},children:e(l,{})})]}),e(t.Portal,{children:e(t.Positioner,{className:"neba-portal z-50 [outline:none]",sideOffset:K,align:"start",children:e(t.Popup,{initialFocus:!1,className:c(pickerPopupClasses,v[h],popupPaddingClasses[h],d[h]),style:popupSlots(te,3),children:M})})})]}),$?e(i.Description,{id:ee,className:c(x[h],"text-(--neba-muted-fg)"),children:$}):null,ae?e(i.Error,{id:ne,match:!0,className:c(x[h],"text-(--n-accent)"),children:O}):null,J?.map((n,a)=>e("input",{type:"hidden",name:n.name,value:n.value},a))]})}export function PickerFooter({size:n,children:a}){return e("div",{className:c("flex items-center justify-end border-t pt-1.5","[border-color:var(--n-line)]",b[n]),children:a})}export function PickerDivider(){return e("div",{"aria-hidden":"true",className:"w-px self-stretch bg-(--n-line)"})}
1
+ import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as a from"react";import{Field as i}from"@base-ui/react/field";import{Popover as t}from"@base-ui/react/popover";import{CloseIcon as l}from"./icons.js";import{WidthSizer as r}from"./sizer.js";import{chipRemoveClasses as o,controlHeightClasses as s,controlTextLeadingClasses as d,cx as c,disabledClasses as p,fieldReadOnlyClasses as u,fieldRestClasses as m,focusWithinRingClasses as f,gapClasses as b,iconClasses as h,metaTextClasses as x,paddingXClasses as g,radiusClasses as v,stackGapClasses as y,surfaceClasses as N,surfaceSlots as w,transitionClasses as P}from"./styles.js";export function popupSlots(e,n){return{...w(e,n),"--n-fill":`var(--neba-${e}-fill)`,"--n-fill-hover":`var(--neba-${e}-fill-hover)`,"--n-fill-active":`var(--neba-${e}-fill-active)`,"--n-on-solid":`var(--neba-${e}-on-solid)`}}const j=["group relative flex w-full items-center select-none","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",P,"focus-within:[transition-duration:0ms]",f,h].join(" ");export const pickerPopupClasses=[N,"border bg-(--n-panel-press)","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]","[outline:none]","[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" ");export const popupPaddingClasses={xs:"p-1.5",sm:"p-2",md:"p-2.5",lg:"p-3",xl:"p-3.5"};export function PickerShell({variant:f="outline",size:h="md",color:N="primary",density:P="default",elevation:k=0,label:C,description:$,error:O,invalid:z,startIcon:F,fullWidth:R=!1,disabled:S=!1,readOnly:q=!1,required:D=!1,id:I,className:_,style:E,display:L,samples:T,empty:V,clearable:W=!1,onClear:A,open:B,onOpenChange:G,labels:H,hiddenValues:J,sideOffset:K=6,children:M,triggerRef:Q,...U}){const X=a.useId(),Y=I??`${X}-trigger`,Z=`${X}-label`,ee=`${X}-description`,ne=`${X}-error`,ae=null!=O&&!1!==O&&""!==O,ie=z??ae,te=ie?"danger":N,le=S||q,re=c($?ee:null,ae?ne:null)||void 0;return n(i.Root,{disabled:S,invalid:ie,className:c("flex-col align-top",y[h],R?"flex w-full":"inline-flex",_),style:{...w(te,k),...E},...U,children:[C?e(i.Label,{id:Z,htmlFor:Y,className:c(x[h],"font-medium",S?"text-(--neba-disabled-fg)":"text-(--neba-fg)"),children:C}):null,n(t.Root,{open:B,onOpenChange:e=>G(e),children:[n("span",{className:c(j,s[h],d[h],v[h],b[h],g[P][h],S?p[f]:q?u[f]:m[f]),children:[n(t.Trigger,{id:Y,ref:Q,disabled:S,"aria-labelledby":C?Z:void 0,"aria-describedby":re,"aria-required":D||void 0,"aria-invalid":ie||void 0,className:c("flex min-w-0 flex-1 items-center bg-transparent text-start [font:inherit] text-inherit",b[h],"[outline:none]",le?"cursor-default":"cursor-pointer"),children:[F?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg) transition-[color] duration-(--neba-duration) group-focus-within:text-(--n-accent)",children:F}):null,n("span",{className:"flex min-w-0 flex-1 flex-col",children:[e("span",{className:c("w-full truncate",V?"text-(--neba-muted-fg)":"text-(--neba-fg)"),children:L}),e(r,{samples:T??[]})]})]}),!W||V||le?null:e("button",{type:"button","aria-label":H.clear,className:c(o,"text-(--neba-muted-fg)"),onClick:e=>{e.stopPropagation(),A()},children:e(l,{})})]}),e(t.Portal,{children:e(t.Positioner,{className:"neba-portal z-50 [outline:none]",sideOffset:K,align:"start",children:e(t.Popup,{initialFocus:!1,className:c(pickerPopupClasses,v[h],popupPaddingClasses[h],d[h]),style:popupSlots(te,3),children:M})})})]}),$?e(i.Description,{id:ee,className:c(x[h],"text-(--neba-muted-fg)"),children:$}):null,ae?e(i.Error,{id:ne,match:!0,className:c(x[h],"text-(--n-accent)"),children:O}):null,J?.map((n,a)=>e("input",{type:"hidden",name:n.name,value:n.value},a))]})}export function PickerFooter({size:n,children:a}){return e("div",{className:c("flex items-center justify-end border-t pt-1.5","[border-color:var(--n-line)]",b[n]),children:a})}export function PickerDivider(){return e("div",{"aria-hidden":"true",className:"w-px self-stretch bg-(--n-line)"})}
@@ -9,6 +9,11 @@
9
9
  *
10
10
  * The shapes themselves are all that is left in each component, which is the
11
11
  * point: they are the only thing that genuinely differs.
12
+ *
13
+ * `Meter` reads three of these too — the colour slots, the bar's thickness and
14
+ * the fraction — because it is the same groove with different semantics, and a
15
+ * meter whose `md` were a pixel off the progress bar's would be visible the
16
+ * first time a page carried both.
12
17
  */
13
18
  import type * as React from 'react';
14
19
  import type { NebaColor, NebaSize } from '../types.js';
@@ -0,0 +1,33 @@
1
+ /**
2
+ * What "this matches what I typed" means, once.
3
+ *
4
+ * Three components let a reader type at a list of their own — DataTable,
5
+ * CommandPalette and Transfer — and each had a `matches` of its own. They
6
+ * disagreed: a DataTable found `José` for `jose` and the other two did not,
7
+ * which is not a preference anybody chose. A reader who learns what the search
8
+ * box in one part of a product does has learned the wrong thing about the rest
9
+ * of it.
10
+ *
11
+ * It is also the fixed cost of typing. `String.prototype.normalize` is the
12
+ * expensive call in here by a wide margin, so the shape of the API is built
13
+ * around folding a haystack *once* and a needle *once* rather than folding both
14
+ * on every comparison — which is what a `matches(item, query)` signature
15
+ * quietly asks for, and what put a `normalize` on every cell of every row of a
16
+ * DataTable on every keystroke.
17
+ */
18
+ /**
19
+ * A value as something a query can be matched against.
20
+ *
21
+ * Case-folded and stripped of combining marks, so `jose` finds `José` and
22
+ * `SEOUL` finds `Seoul`. `NFD` splits an accented letter into the letter and
23
+ * its accent and the range then deletes the accent; a search field is the one
24
+ * place where losing that distinction is the point.
25
+ *
26
+ * A `Date` is deliberately *not* formatted here. What a reader sees in a cell
27
+ * came out of the caller's own rendering, and guessing a format the search
28
+ * would agree with is how a table ends up not finding a date that is on the
29
+ * screen — a column that wants its dates searchable gives them a `value`.
30
+ */
31
+ export declare function searchText(value: unknown): string;
32
+ /** Every string a row can be found by, folded once and joined into one haystack. */
33
+ export declare function searchHaystack(values: readonly unknown[]): string;
@@ -0,0 +1 @@
1
+ const e=/[\u0300-\u036f]/g;export function searchText(t){return null==t||"object"==typeof t?"":String(t).normalize("NFD").replace(e,"").toLowerCase()}export function searchHaystack(e){return e.map(searchText).join("\0")}
@@ -101,6 +101,22 @@ export declare const tickDotClasses: Record<NebaSize, string>;
101
101
  * the tick drifts a pixel or two off the text beside it.
102
102
  */
103
103
  export declare const tickRowLeadingClasses = "leading-[1.4]";
104
+ /**
105
+ * What a finger gets, on a control drawn smaller than one.
106
+ *
107
+ * A tick, a switch and the × on a Chip are all sized against the text beside
108
+ * them, and text is smaller than 24px — which is what WCAG 2.5.8 asks a target
109
+ * to be in both directions. The class grows the pressable box and draws
110
+ * nothing; `styles.css` says how, and why it is CSS rather than an arbitrary
111
+ * variant. It needs `relative` on the element, which every control that uses it
112
+ * already has.
113
+ *
114
+ * Not applied to the controls on the height ladder. A Button at `xs` is 22px
115
+ * tall and equally short of the minimum, but a Button sits in a row of other
116
+ * Buttons and its label is the target — growing it two pixels past its own edge
117
+ * would take the press off whatever it was next to.
118
+ */
119
+ export declare const hitAreaClasses = "neba-hit";
104
120
  /**
105
121
  * The same two tracks again, as raw lengths.
106
122
  *
@@ -264,5 +280,28 @@ export declare function hasContent(node: React.ReactNode): boolean;
264
280
  * length.
265
281
  */
266
282
  export declare function toLength(value: number | string | undefined): string | undefined;
283
+ /**
284
+ * The other direction: a CSS length a caller wrote, as the number a drag can do
285
+ * arithmetic on.
286
+ *
287
+ * `toLength` is what a component hands the browser; this is what it needs back
288
+ * the moment a gesture has to clamp against the value — a Sidebar's `minWidth`,
289
+ * a Panes' `maxSize`. Both wrote their own, and the copies disagreed: one of
290
+ * them resolved `em` against the document root, which is what `rem` means, so a
291
+ * `minWidth="2em"` on a sidebar with type of its own came out wrong.
292
+ *
293
+ * `percentOf` is what a percentage is a percentage *of*, because that differs:
294
+ * a Sidebar is bounded against the window and a pane against the split it sits
295
+ * in. `relativeTo` is the element `em` is measured against — its own font size,
296
+ * which is the whole difference between the two units.
297
+ *
298
+ * A bare number is deliberately **not** handled. It means pixels on one of them
299
+ * and a percentage on the other, and that is a question about the prop rather
300
+ * than about the length.
301
+ */
302
+ export declare function toPixels(value: string, options: {
303
+ percentOf: number;
304
+ relativeTo?: Element | null;
305
+ }): number | undefined;
267
306
  /** Joins class name fragments, dropping the empty ones. */
268
307
  export declare function cx(...parts: Array<string | false | null | undefined>): string;