neba 1.17.1 → 1.18.1

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 (156) hide show
  1. package/dist/a2ui/adapter-catalog.json +1 -1
  2. package/dist/a2ui/catalog.json +2 -2
  3. package/dist/a2ui/index.d.ts +2 -0
  4. package/dist/a2ui/schema.d.ts +11 -1
  5. package/dist/a2ui/schema.js +1 -1
  6. package/dist/components/alert/Alert.js +1 -1
  7. package/dist/components/animate-counter/AnimateCounter.d.ts +6 -0
  8. package/dist/components/animate-counter/AnimateCounter.js +1 -1
  9. package/dist/components/animate-headline/AnimateHeadline.js +1 -1
  10. package/dist/components/animate-scramble/AnimateScramble.d.ts +9 -3
  11. package/dist/components/animate-scramble/AnimateScramble.js +1 -1
  12. package/dist/components/animate-split/AnimateSplit.d.ts +7 -1
  13. package/dist/components/animate-split/AnimateSplit.js +1 -1
  14. package/dist/components/animate-typing/AnimateTyping.d.ts +6 -0
  15. package/dist/components/animate-typing/AnimateTyping.js +1 -1
  16. package/dist/components/app-logo/AppLogo.js +1 -1
  17. package/dist/components/approval/Approval.js +1 -1
  18. package/dist/components/breadcrumb/Breadcrumb.d.ts +16 -0
  19. package/dist/components/breadcrumb/Breadcrumb.js +1 -1
  20. package/dist/components/calendar/Calendar.js +1 -1
  21. package/dist/components/card/Card.js +1 -1
  22. package/dist/components/carousel/Carousel.d.ts +3 -2
  23. package/dist/components/carousel/Carousel.js +1 -1
  24. package/dist/components/chat-bubble/ChatBubble.d.ts +6 -0
  25. package/dist/components/chat-bubble/ChatBubble.js +1 -1
  26. package/dist/components/checkbox/Checkbox.js +1 -1
  27. package/dist/components/checkbox-group/CheckboxGroup.d.ts +84 -0
  28. package/dist/components/checkbox-group/CheckboxGroup.js +1 -0
  29. package/dist/components/checkbox-group/index.d.ts +2 -0
  30. package/dist/components/checkbox-group/index.js +1 -0
  31. package/dist/components/code-block/CodeBlock.d.ts +2 -2
  32. package/dist/components/code-block/CodeBlock.js +1 -1
  33. package/dist/components/code-block/index.d.ts +2 -1
  34. package/dist/components/code-block/index.js +1 -1
  35. package/dist/components/color-picker/ColorPicker.js +1 -1
  36. package/dist/components/combobox/Combobox.js +1 -1
  37. package/dist/components/context-window/ContextWindow.js +1 -1
  38. package/dist/components/data-table/DataTable.d.ts +13 -1
  39. package/dist/components/data-table/DataTable.js +1 -1
  40. package/dist/components/date-picker/DatePicker.js +1 -1
  41. package/dist/components/date-range-picker/DateRangePicker.js +1 -1
  42. package/dist/components/date-time-picker/DateTimePicker.js +1 -1
  43. package/dist/components/drawer/Drawer.d.ts +21 -0
  44. package/dist/components/drawer/Drawer.js +1 -1
  45. package/dist/components/empty/Empty.js +1 -1
  46. package/dist/components/fieldset/Fieldset.d.ts +12 -1
  47. package/dist/components/fieldset/Fieldset.js +1 -1
  48. package/dist/components/file-picker/FilePicker.d.ts +0 -8
  49. package/dist/components/file-picker/FilePicker.js +1 -1
  50. package/dist/components/file-picker/formatFileSize.d.ts +8 -0
  51. package/dist/components/file-picker/formatFileSize.js +1 -0
  52. package/dist/components/file-picker/index.d.ts +2 -1
  53. package/dist/components/file-picker/index.js +1 -1
  54. package/dist/components/floating-bottom-navigation/FloatingBottomNavigation.js +1 -1
  55. package/dist/components/form/Form.d.ts +8 -2
  56. package/dist/components/form/Form.js +1 -1
  57. package/dist/components/gallery/Gallery.d.ts +45 -3
  58. package/dist/components/gallery/Gallery.js +1 -1
  59. package/dist/components/gallery/GalleryViewer.js +1 -1
  60. package/dist/components/gauge-chart/GaugeChart.js +1 -1
  61. package/dist/components/heatmap-chart/HeatmapChart.js +1 -1
  62. package/dist/components/how-to-steps/HowToSteps.d.ts +14 -0
  63. package/dist/components/how-to-steps/HowToSteps.js +1 -1
  64. package/dist/components/image/Image.d.ts +31 -6
  65. package/dist/components/image/Image.js +1 -1
  66. package/dist/components/list/List.d.ts +9 -0
  67. package/dist/components/list/List.js +1 -1
  68. package/dist/components/menu/Menu.d.ts +17 -0
  69. package/dist/components/menu/Menu.js +1 -1
  70. package/dist/components/meter/Meter.js +1 -1
  71. package/dist/components/mockup/Mockup.js +1 -1
  72. package/dist/components/number-field/NumberField.js +1 -1
  73. package/dist/components/page-layout/PageLayout.js +1 -1
  74. package/dist/components/panes/Panes.js +1 -1
  75. package/dist/components/pie-chart/PieChart.js +1 -1
  76. package/dist/components/pill/Pill.js +1 -1
  77. package/dist/components/progress-box/ProgressBox.js +1 -1
  78. package/dist/components/progress-circular/ProgressCircular.js +1 -1
  79. package/dist/components/progress-linear/ProgressLinear.js +1 -1
  80. package/dist/components/prompt-input/PromptInput.js +1 -1
  81. package/dist/components/provider/NebaProvider.d.ts +3 -22
  82. package/dist/components/provider/NebaProvider.js +1 -1
  83. package/dist/components/provider/colorSchemeScript.d.ts +23 -0
  84. package/dist/components/provider/colorSchemeScript.js +1 -0
  85. package/dist/components/provider/index.d.ts +2 -1
  86. package/dist/components/provider/index.js +1 -1
  87. package/dist/components/radio-group/RadioGroup.d.ts +13 -0
  88. package/dist/components/radio-group/RadioGroup.js +1 -1
  89. package/dist/components/reasoning/Reasoning.d.ts +21 -0
  90. package/dist/components/reasoning/Reasoning.js +1 -1
  91. package/dist/components/scatter-chart/ScatterChart.js +1 -1
  92. package/dist/components/scroll-zone/ScrollZone.js +1 -1
  93. package/dist/components/segmented-button/SegmentedButton.js +1 -1
  94. package/dist/components/select/Select.js +1 -1
  95. package/dist/components/sidebar/Sidebar.d.ts +13 -0
  96. package/dist/components/sidebar/Sidebar.js +1 -1
  97. package/dist/components/slider/Slider.js +1 -1
  98. package/dist/components/sources/Sources.d.ts +11 -0
  99. package/dist/components/sources/Sources.js +1 -1
  100. package/dist/components/spoiler/Spoiler.js +1 -1
  101. package/dist/components/statistic/Statistic.js +1 -1
  102. package/dist/components/streaming-text/StreamingText.d.ts +22 -11
  103. package/dist/components/streaming-text/StreamingText.js +1 -1
  104. package/dist/components/tabs/Tabs.d.ts +12 -1
  105. package/dist/components/tabs/Tabs.js +1 -1
  106. package/dist/components/text-link/TextLink.d.ts +7 -0
  107. package/dist/components/text-link/TextLink.js +1 -1
  108. package/dist/components/time-picker/TimePicker.js +1 -1
  109. package/dist/components/timeline-chart/TimelineChart.js +1 -1
  110. package/dist/components/toast/Toast.js +1 -1
  111. package/dist/components/tool-call/ToolCall.d.ts +11 -0
  112. package/dist/components/tool-call/ToolCall.js +1 -1
  113. package/dist/components/tour/Tour.js +1 -1
  114. package/dist/components/tree-view/TreeView.d.ts +13 -1
  115. package/dist/components/tree-view/TreeView.js +1 -1
  116. package/dist/components/typography/Typography.d.ts +7 -0
  117. package/dist/components/typography/Typography.js +1 -1
  118. package/dist/components/window-pane/WindowPane.js +1 -1
  119. package/dist/hooks/useElementSize.js +1 -1
  120. package/dist/index.d.ts +1 -0
  121. package/dist/index.js +1 -1
  122. package/dist/internal/animate.js +1 -1
  123. package/dist/internal/calendar.d.ts +2 -2
  124. package/dist/internal/calendar.js +1 -1
  125. package/dist/internal/chart-frame.d.ts +59 -2
  126. package/dist/internal/chart-frame.js +1 -1
  127. package/dist/internal/chart-line.js +1 -1
  128. package/dist/internal/checkbox-group.d.ts +29 -0
  129. package/dist/internal/checkbox-group.js +1 -0
  130. package/dist/internal/defaults.d.ts +14 -2
  131. package/dist/internal/format.d.ts +7 -0
  132. package/dist/internal/format.js +1 -1
  133. package/dist/internal/highlight.d.ts +9 -0
  134. package/dist/internal/highlight.js +1 -1
  135. package/dist/internal/layout-effect.d.ts +17 -0
  136. package/dist/internal/layout-effect.js +1 -0
  137. package/dist/internal/media.d.ts +20 -0
  138. package/dist/internal/media.js +1 -1
  139. package/dist/internal/menu.d.ts +5 -0
  140. package/dist/internal/observe.d.ts +4 -1
  141. package/dist/internal/observe.js +1 -1
  142. package/dist/internal/overrides.d.ts +55 -0
  143. package/dist/internal/overrides.js +1 -0
  144. package/dist/internal/page-layout.d.ts +26 -1
  145. package/dist/internal/page-layout.js +1 -1
  146. package/dist/internal/run.d.ts +6 -1
  147. package/dist/internal/run.js +1 -1
  148. package/dist/internal/sizer.d.ts +10 -0
  149. package/dist/internal/sizer.js +1 -1
  150. package/dist/internal/styles.d.ts +41 -3
  151. package/dist/internal/styles.js +1 -1
  152. package/dist/internal/text.d.ts +25 -3
  153. package/dist/internal/text.js +1 -1
  154. package/dist/styles.css +1 -1
  155. package/dist/tailwind.css +94 -73
  156. package/package.json +3 -3
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as t from"react";import{CartesianChart as l,markTransitionClasses as a}from"../../internal/chart-frame.js";import{bubbleRadius as s,formatCategory as i,markerRadii as o,markGap as n,markPath as c,markShapes as u,plotHeights as d,pointX as m}from"../../internal/chart.js";import{numberFormatter as h}from"../../internal/format.js";import{chartMessages as f,useMessages as p}from"../../internal/i18n.js";import{cx as x,srOnlyClasses as b}from"../../internal/styles.js";import{useStyleDefaults as y}from"../../internal/defaults.js";export function ScatterChart(r){const{shape:a="auto",pointRadius:i,maxRadius:n,series:h,categories:x,size:b="md",xAxis:z,...g}=y(r,["size","locale"]),j=i??o[b],k=n??Math.max(j+2,("number"==typeof g.height?g.height:d[b])/12),M=h.reduce((e,r)=>r.color?e:e+1,0),$="auto"===a||"varied"===a?"circle":a,w="varied"===a||"auto"===a&&M>3,N=t.useCallback(e=>w?u[e%u.length]:$,[w,$]),S=t.useCallback(e=>{const r=[];let t=0;return e.values.forEach(e=>{e.forEach(e=>{null!==e.value&&void 0!==e.z&&Number.isFinite(e.z)&&(t=Math.max(t,e.z))})}),e.values.forEach((l,a)=>{e.visible[a]&&l.forEach((l,i)=>{if(null===l.value)return;const o=m(l,i,x);null!==o&&r.push({series:a,index:i,x:e.categoryValuePx(o),y:e.valuePx(l.value,a),r:void 0===l.z?j:s(l.z,t,k,2)})})}),r},[x,j,k]),A=p(f,g.locale);return e(l,{...g,series:h,categories:x,size:b,xScale:"value",xAxis:z,brush:void 0,secondaryAxis:void 0,marks:S,markInset:k,includeZero:!1,swatch:(r,t)=>e("svg",{viewBox:"0 0 10 10",className:"size-2.5 overflow-visible","aria-hidden":"true",children:e("path",{d:c(N(r),5,5,4),fill:t})}),exportRows:()=>function(e,r,t,l,a){const s=e.some(e=>e.data.some(e=>"object"==typeof e&&null!==e&&void 0!==e.z));return[["","string"==typeof t?t:"x","string"==typeof l?l:"y",...s?[a]:[]],...e.flatMap((e,t)=>e.data.map((l,a)=>{const i="object"==typeof l&&null!==l?l:null,o=i?i.y:"number"==typeof l?l:null,n=i?.x??r?.[a]??a;return[e.name??`${t+1}`,n,null!==o&&Number.isFinite(o)?o:null,...s?[i?.z??null]:[]]}))]}(h,x,z?.label,g.yAxis?.label,A.size),table:(r,t)=>e(v,{id:r,series:h,categories:x,label:g.label,xLabel:z?.label,yLabel:g.yAxis?.label,locale:g.locale,format:t}),children:r=>e(ScatterMarks,{context:r,shapeOf:N})})}function ScatterMarks({context:r,shapeOf:l}){const{marks:s,values:i,colors:o,hovered:u,activeMark:d}=r,m=t.useMemo(()=>[...s].sort((e,r)=>r.r-e.r),[s]);return e("g",{children:m.map(r=>{const t=i[r.series]?.[r.index],s=null!==u&&u!==r.series,m=d?.series===r.series&&d?.index===r.index;return e("path",{d:c(l(r.series),r.x,r.y,r.r),fill:t?.color??o[r.series],stroke:"var(--neba-chart-gap)",strokeWidth:n,opacity:s?.28:1,className:a,style:{transformBox:"view-box",transformOrigin:`${r.x}px ${r.y}px`,scale:String(m&&r.r>0?(r.r+1)/r.r:1)}},`${r.series}-${r.index}`)})})}const v=/*@__PURE__*/t.memo(function ScatterTable({id:t,series:l,categories:a,label:s,xLabel:o,yLabel:n,locale:c,format:u}){const d=p(f,c),m=l.some(e=>e.data.some(e=>"object"==typeof e&&null!==e&&void 0!==e.z));return r("table",{id:t,className:x(b),children:[s?e("caption",{children:s}):null,e("thead",{children:r("tr",{children:[e("th",{scope:"col"}),e("th",{scope:"col",children:o??"x"}),e("th",{scope:"col",children:n??"y"}),m?e("th",{scope:"col",children:d.size}):null]})}),e("tbody",{children:l.flatMap((t,l)=>t.data.map((s,o)=>{const n="object"==typeof s&&null!==s?s:null,d=n?n.y:"number"==typeof s?s:null,f=n?.x??a?.[o]??o;return r("tr",{children:[e("th",{scope:"row",children:t.name??l+1}),e("td",{children:"number"==typeof f?h(c,{}).format(f):i(f,c)}),e("td",{children:null!==d&&Number.isFinite(d)?u(d):""}),m?e("td",{children:void 0===n?.z?"":h(c,{}).format(n.z)}):null]},`${l}-${o}`)}))})]})});
1
+ "use client";import{jsx as e,Fragment as r,jsxs as s}from"react/jsx-runtime";import*as t from"react";import{CartesianChart as o,chartTableClasses as l,markTransitionClasses as a,useDeferredRows as i}from"../../internal/chart-frame.js";import{bubbleRadius as n,formatCategory as c,markerRadii as u,markGap as m,markPath as d,markShapes as h,plotHeights as f,pointX as p}from"../../internal/chart.js";import{numberFormatter as x}from"../../internal/format.js";import{chartMessages as b,useMessages as v}from"../../internal/i18n.js";import{useStyleDefaults as y}from"../../internal/defaults.js";import{useIntlLocale as g}from"../../internal/media.js";export function ScatterChart(r){const{shape:s="auto",pointRadius:l,maxRadius:a,series:i,categories:c,size:m="md",xAxis:x,...g}=y(r,["size","locale"]),k=l??u[m],z=a??Math.max(k+2,("number"==typeof g.height?g.height:f[m])/12),M=i.reduce((e,r)=>r.color?e:e+1,0),w="auto"===s||"varied"===s?"circle":s,N="varied"===s||"auto"===s&&M>3,$=t.useCallback(e=>N?h[e%h.length]:w,[N,w]),S=t.useCallback(e=>{const r=[];let s=0;return e.values.forEach(e=>{e.forEach(e=>{null!==e.value&&void 0!==e.z&&Number.isFinite(e.z)&&(s=Math.max(s,e.z))})}),e.values.forEach((t,o)=>{e.visible[o]&&t.forEach((t,l)=>{if(null===t.value)return;const a=p(t,l,c);null!==a&&r.push({series:o,index:l,x:e.categoryValuePx(a),y:e.valuePx(t.value,o),r:void 0===t.z?k:n(t.z,s,z,2)})})}),r},[c,k,z]),A=v(b,g.locale);return e(o,{...g,series:i,categories:c,size:m,xScale:"value",xAxis:x,brush:void 0,secondaryAxis:void 0,marks:S,markInset:z,includeZero:!1,swatch:(r,s)=>e("svg",{viewBox:"0 0 10 10",className:"size-2.5 overflow-visible","aria-hidden":"true",children:e("path",{d:d($(r),5,5,4),fill:s})}),exportRows:()=>function(e,r,s,t,o){const l=e.some(e=>e.data.some(e=>"object"==typeof e&&null!==e&&void 0!==e.z));return[["","string"==typeof s?s:"x","string"==typeof t?t:"y",...l?[o]:[]],...e.flatMap((e,s)=>e.data.map((t,o)=>{const a="object"==typeof t&&null!==t?t:null,i=a?a.y:"number"==typeof t?t:null,n=a?.x??r?.[o]??o;return[e.name??`${s+1}`,n,null!==i&&Number.isFinite(i)?i:null,...l?[a?.z??null]:[]]}))]}(i,c,x?.label,g.yAxis?.label,A.size),table:(r,s)=>e(j,{id:r,series:i,categories:c,label:g.label,xLabel:x?.label,yLabel:g.yAxis?.label,locale:g.locale,format:s}),children:r=>e(ScatterMarks,{context:r,shapeOf:$})})}const k=128;function z(e){const r=[];for(let s=0;s<e.length;s+=k)r.push(e.slice(s,s+k));return r}function ScatterMarks({context:r,shapeOf:s}){const{marks:o,values:l,colors:i,hovered:n,activeMark:c}=r,u=t.useMemo(()=>l.some(e=>e.some(e=>void 0!==e.z)),[l]),m=t.useMemo(()=>{const e=[...o].sort((e,r)=>r.r-e.r);if(u)return[{series:-1,blocks:z(e)}];const r=new Map;for(const s of e){const e=r.get(s.series);e?e.push(s):r.set(s.series,[s])}return[...r].map(([e,r])=>({series:e,blocks:z(r)}))},[o,u]),d=t.useMemo(()=>{const e=new Map;for(const r of m)for(const s of r.blocks)for(const r of s)e.set(r,s);return e},[m]),h=c?d.get(c):void 0,f=(r,t)=>r.map((r,o)=>e(M,{marks:r,values:l,colors:i,shapeOf:s,active:r===h?c:null,hovered:t?n:void 0},o));return e("g",{children:u?f(m[0]?.blocks??[],!0):m.map(r=>e("g",{opacity:null!==n&&n!==r.series?.28:1,className:a,children:f(r.blocks,!1)},r.series))})}const M=/*@__PURE__*/t.memo(function MarkBlock({marks:s,values:t,colors:o,shapeOf:l,active:i,hovered:n}){return e(r,{children:s.map(r=>{const s=t[r.series]?.[r.index],c=i?.series===r.series&&i?.index===r.index;return e("path",{d:d(l(r.series),r.x,r.y,r.r),fill:s?.color??o[r.series],stroke:"var(--neba-chart-gap)",strokeWidth:m,opacity:void 0===n?void 0:null!==n&&n!==r.series?.28:1,className:a,style:{transformBox:"view-box",transformOrigin:`${r.x}px ${r.y}px`,scale:String(c&&r.r>0?(r.r+1)/r.r:1)}},`${r.series}-${r.index}`)})})});const j=/*@__PURE__*/t.memo(function ScatterTable({id:r,series:t,categories:o,label:a,xLabel:n,yLabel:u,locale:m,format:d}){const h=v(b,m),f=g(m),p=t.some(e=>e.data.some(e=>"object"==typeof e&&null!==e&&void 0!==e.z)),y=[],k=t.reduce((e,r)=>(y.push(e),e+r.data.length),0),z=i({rows:k,points:k,columns:p?4:3});return s("table",{id:r,className:l,"aria-busy":z<k||void 0,children:[a?e("caption",{children:a}):null,e("thead",{children:s("tr",{children:[e("th",{scope:"col"}),e("th",{scope:"col",children:n??"x"}),e("th",{scope:"col",children:u??"y"}),p?e("th",{scope:"col",children:h.size}):null]})}),e("tbody",{children:t.flatMap((r,t)=>r.data.slice(0,Math.max(0,z-y[t])).map((l,a)=>{const i="object"==typeof l&&null!==l?l:null,n=i?i.y:"number"==typeof l?l:null,u=i?.x??o?.[a]??a;return s("tr",{children:[e("th",{scope:"row",children:r.name??t+1}),e("td",{children:"number"==typeof u?x(f,{}).format(u):c(u,f)}),e("td",{children:null!==n&&Number.isFinite(n)?d(n):""}),p?e("td",{children:void 0===i?.z?"":x(f,{}).format(i.z)}):null]},`${t}-${a}`)}))})]})});
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{IconButton as r}from"../icon-button/IconButton.js";import{drawnScale as o}from"../../internal/drag.js";import{spacingValue as l}from"../../internal/grid.js";import{scrollMessages as i,useMessages as s}from"../../internal/i18n.js";import{ChevronIcon as a}from"../../internal/icons.js";import{queryMatches as c,reducedMotionQuery as u}from"../../internal/media.js";import{observeResize as d}from"../../internal/observe.js";import{cx as f}from"../../internal/styles.js";import{bindAxisWheel as m}from"../../internal/wheel.js";import{useStyleDefaults as p}from"../../internal/defaults.js";const b={xs:"p-1",sm:"p-1.5",md:"p-2",lg:"p-3",xl:"p-4"},v={xs:"gap-1",sm:"gap-1.5",md:"gap-2",lg:"gap-3",xl:"gap-4"};export const ScrollZone=/*@__PURE__*/n.forwardRef(function ScrollZone(w,g){const{orientation:y="horizontal",lines:h=1,spacing:x=2,buttons:k="auto",buttonPlacement:E="inline",mode:L="item",step:j=1,speed:C=900,snap:P=!1,drag:R=!0,wheel:S=!1,scrollbar:T=!1,variant:N="solid",size:A="md",color:M="primary",density:D="default",locale:z,label:B,previousLabel:F,nextLabel:W,scrollerRef:H,onScroll:I,className:$,style:q,children:X,...Y}=p(w,["size","density","variant","locale"]),Z=s(i,z),_="horizontal"===y,K=Math.max(1,Math.round(h)),V=Math.max(1,Math.round(j)),G=n.useRef(null),J=n.useRef(null),O=n.useCallback(e=>{G.current=e,"function"==typeof H?H(e):H&&(H.current=e)},[H]),[Q,U]=n.useState({back:!1,forward:!1}),[ee,te]=n.useState(null),ne=n.useCallback(()=>{const e=G.current;if(!e)return;const t=_?e.clientWidth:e.clientHeight,n=_?e.scrollWidth:e.scrollHeight,r=Math.abs(_?e.scrollLeft:e.scrollTop);U(e=>{const o=r>1,l=n-t-r>1;return e.back===o&&e.forward===l?e:{back:o,forward:l}})},[_]);n.useEffect(()=>{const e=G.current,t=J.current;if(!e)return;ne();const n=[d(e,ne),t?d(t,ne):null];return()=>{for(const e of n)e?.()}},[ne]);const re=n.useCallback(()=>{const e=G.current;return e&&_&&"rtl"===getComputedStyle(e).direction?-1:1},[_]),oe=n.useCallback((e,t)=>{const n=G.current;if(!n)return;const r=t?c(u)?"auto":"smooth":"auto";n.scrollBy(_?{left:e,behavior:r}:{top:e,behavior:r})},[_]),le=n.useCallback(()=>{const e=G.current,t=J.current;if(!e||!t)return[];const n=_&&"rtl"===getComputedStyle(e).direction,r=_?n?"right":"left":"top",o=n?-1:1,l=e.getBoundingClientRect()[r],i=[];for(const e of Array.from(t.children)){const t=Math.round((e.getBoundingClientRect()[r]-l)*o);i.includes(t)||i.push(t)}return i.sort((e,t)=>e-t)},[_]),ie=n.useCallback((e,t=L)=>{const n=G.current;if(!n)return;const r=re(),o=_?n.clientWidth:n.clientHeight;if("page"===t)return void oe(o*(e?1:-1)*r,!0);const l=le(),i=l.filter(e=>e>1),s=l.filter(e=>e<-1),a=e?i[V-1]:s[s.length-V];oe(void 0!==a?a*r:o*(e?1:-1)*r,!0)},[re,_,le,V,L,oe]),se=n.useRef(null);n.useEffect(()=>()=>se.current?.(),[]);const ae=n.useCallback((e,t)=>{if(se.current)return;const n=re(),r=performance.now();let o=r,l=0;const i=t=>{const r=t-o;o=t,oe(C*r/1e3*(e?1:-1)*n,!1),l=requestAnimationFrame(i)};l=requestAnimationFrame(i);const s=()=>{cancelAnimationFrame(l),se.current=null,window.removeEventListener(t,s),window.removeEventListener("pointercancel",s),window.removeEventListener("blur",s),performance.now()-r<140&&ie(e,"item")};se.current=s,window.addEventListener(t,s),window.addEventListener("pointercancel",s),window.addEventListener("blur",s)},[ie,re,oe,C]),ce=n.useRef(null);function ue(e){return"hold"!==L?{onClick:()=>ie(e)}:{onPointerDown:t=>{0===t.button&&ae(e,"pointerup")},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),ae(e,"keyup"))}}}n.useEffect(()=>()=>ce.current?.(),[]),n.useEffect(()=>{const e=G.current;if(e&&S&&_)return m(e)},[_,S]);const de="none"!==k&&("always"===k||Q.back||Q.forward),fe="inline"===E;function me(t){const n=t?Q.forward:Q.back,o=t?"forward":"back";if("auto"===k&&!n&&!fe&&ee!==o)return e("span",{});const l=_?t?"-rotate-90 rtl:rotate-90":"rotate-90 rtl:-rotate-90":t?"":"rotate-180",i=e(r,{variant:N,size:A,color:M,density:D,elevation:1,label:t?W??Z.next:F??Z.previous,disabled:!n,focusableWhenDisabled:!0,onFocus:()=>te(o),onBlur:()=>te(e=>e===o?null:e),className:"pointer-events-auto",icon:e("span",{className:f("flex items-center",l),children:e(a,{})}),...ue(t)});return fe?e("span",{className:"flex shrink-0 items-center justify-center",children:i}):i}return t("div",{ref:g,className:f("relative flex min-w-0",fe&&_?"flex-row items-stretch":"flex-col",fe?v[A]:"",$),style:{"--n-ring":`var(--neba-${M}-ring)`,...q},...Y,children:[de&&fe?me(!1):null,e("div",{ref:O,tabIndex:Q.back||Q.forward?0:-1,role:"group","aria-label":B??Z.label,className:f("min-h-0 min-w-0 grow",_?"overflow-x-auto overflow-y-hidden":"overflow-y-auto overflow-x-hidden","overscroll-contain",P?_?"snap-x snap-mandatory":"snap-y snap-mandatory":"",T?"":"[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",R&&(Q.back||Q.forward)?"cursor-grab data-[dragging]:cursor-grabbing":"","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]"),onScroll:e=>{ne(),I?.(e)},onPointerDown:function(e){if(!R||"touch"===e.pointerType||0!==e.button)return;ce.current?.();const t=e.currentTarget,n=e.clientX,r=e.clientY,l=t.scrollLeft,i=t.scrollTop,s=o(t);let a=!1;const c=document.body.style.getPropertyValue("-webkit-user-select"),u=e=>{if(0===e.buttons)return void d();const o=e.clientX-n,c=e.clientY-r;if(!a){if(Math.abs(_?o:c)<4)return;a=!0,t.setPointerCapture(e.pointerId),t.dataset.dragging="true",document.body.style.setProperty("-webkit-user-select","none"),P&&(t.style.scrollSnapType="none")}_?t.scrollLeft=l-o/s.x:t.scrollTop=i-c/s.y},d=()=>{ce.current=null,t.removeEventListener("pointermove",u),t.removeEventListener("pointerup",f),t.removeEventListener("pointercancel",d),delete t.dataset.dragging,t.style.removeProperty("scroll-snap-type"),c?document.body.style.setProperty("-webkit-user-select",c):document.body.style.removeProperty("-webkit-user-select")},f=()=>{const e=a;if(d(),!e)return;const n=e=>{e.stopPropagation(),e.preventDefault()};t.addEventListener("click",n,{capture:!0,once:!0}),window.setTimeout(()=>t.removeEventListener("click",n,!0),0)};ce.current=d,t.addEventListener("pointermove",u),t.addEventListener("pointerup",f),t.addEventListener("pointercancel",d)},children:e("div",{ref:J,className:f(P?"[&>*]:snap-start":""),style:{display:"grid",gap:l(x),gridAutoFlow:_?"column":"row",..._?{width:"max-content",gridTemplateRows:`repeat(${K}, auto)`,gridAutoColumns:"max-content"}:{gridTemplateColumns:`repeat(${K}, minmax(0, 1fr))`,gridAutoRows:"max-content"}},children:X})}),de&&fe?me(!0):null,de&&!fe?t("div",{className:f("pointer-events-none absolute inset-0 flex justify-between",_?"items-center":"flex-col items-center",b[A]),children:[me(!1),me(!0)]}):null]})});
1
+ "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{IconButton as r}from"../icon-button/IconButton.js";import{drawnScale as o}from"../../internal/drag.js";import{spacingValue as l}from"../../internal/grid.js";import{scrollMessages as i,useMessages as s}from"../../internal/i18n.js";import{ChevronIcon as a}from"../../internal/icons.js";import{useLayoutEffectOnClient as c}from"../../internal/layout-effect.js";import{queryMatches as u,reducedMotionQuery as d}from"../../internal/media.js";import{observeResize as p}from"../../internal/observe.js";import{cx as m}from"../../internal/styles.js";import{bindAxisWheel as f}from"../../internal/wheel.js";import{useStyleDefaults as g}from"../../internal/defaults.js";const v={xs:"p-1",sm:"p-1.5",md:"p-2",lg:"p-3",xl:"p-4"},b={xs:"gap-1",sm:"gap-1.5",md:"gap-2",lg:"gap-3",xl:"gap-4"};export const ScrollZone=/*@__PURE__*/n.forwardRef(function ScrollZone(h,y){const{orientation:w="horizontal",lines:x=1,spacing:k=2,buttons:E="auto",buttonPlacement:L="inline",mode:j="item",step:C=1,speed:R=900,snap:S=!1,drag:P=!0,wheel:T=!1,scrollbar:F=!1,variant:A="solid",size:M="md",color:N="primary",density:B="default",locale:D,label:W,previousLabel:z,nextLabel:H,scrollerRef:I,onScroll:$,className:q,style:X,children:Y,...Z}=g(h,["size","density","variant","locale"]),_=s(i,D),K="horizontal"===w,V=Math.max(1,Math.round(x)),G=Math.max(1,Math.round(C)),J=n.useRef(null),O=n.useRef(null),Q=n.useCallback(e=>{J.current=e,"function"==typeof I?I(e):I&&(I.current=e)},[I]),[U,ee]=n.useState(null),[te,ne]=n.useState(null),re=n.useCallback(()=>{const e=J.current;if(!e)return;const t=K?e.clientWidth:e.clientHeight,n=K?e.scrollWidth:e.scrollHeight,r=Math.abs(K?e.scrollLeft:e.scrollTop),o=t+function(e,t){const n=e.parentElement;if(!n||!e.previousElementSibling?.hasAttribute("data-held"))return 0;const r=getComputedStyle(n),o=t?n.clientWidth-parseFloat(r.paddingLeft)-parseFloat(r.paddingRight):n.clientHeight-parseFloat(r.paddingTop)-parseFloat(r.paddingBottom);return Math.max(0,o-(t?e.offsetWidth:e.offsetHeight))}(e,K);ee(e=>{const t=r>1,l=n-o-r>1;return e?.back===t&&e.forward===l?e:{back:t,forward:l}})},[K]);c(()=>{const e=J.current,t=O.current;if(!e)return;re();const n=[p(e,re),t?p(t,re):null];return()=>{for(const e of n)e?.()}},[re]);const oe=n.useCallback(()=>{const e=J.current;return e&&K&&"rtl"===getComputedStyle(e).direction?-1:1},[K]),le=n.useCallback((e,t)=>{const n=J.current;if(!n)return;const r=t?u(d)?"auto":"smooth":"auto";n.scrollBy(K?{left:e,behavior:r}:{top:e,behavior:r})},[K]),ie=n.useCallback(()=>{const e=J.current,t=O.current;if(!e||!t)return[];const n=K&&"rtl"===getComputedStyle(e).direction,r=K?n?"right":"left":"top",o=n?-1:1,l=e.getBoundingClientRect()[r],i=[];for(const e of Array.from(t.children)){const t=Math.round((e.getBoundingClientRect()[r]-l)*o);i.includes(t)||i.push(t)}return i.sort((e,t)=>e-t)},[K]),se=n.useCallback((e,t=j)=>{const n=J.current;if(!n)return;const r=oe(),o=K?n.clientWidth:n.clientHeight;if("page"===t)return void le(o*(e?1:-1)*r,!0);const l=ie(),i=l.filter(e=>e>1),s=l.filter(e=>e<-1),a=e?i[G-1]:s[s.length-G];le(void 0!==a?a*r:o*(e?1:-1)*r,!0)},[oe,K,ie,G,j,le]),ae=n.useRef(null);n.useEffect(()=>()=>ae.current?.(),[]);const ce=n.useCallback((e,t)=>{if(ae.current)return;const n=oe(),r=performance.now();let o=r,l=0;const i=t=>{const r=t-o;o=t,le(R*r/1e3*(e?1:-1)*n,!1),l=requestAnimationFrame(i)};l=requestAnimationFrame(i);const s=()=>{cancelAnimationFrame(l),ae.current=null,window.removeEventListener(t,s),window.removeEventListener("pointercancel",s),window.removeEventListener("blur",s),performance.now()-r<140&&se(e,"item")};ae.current=s,window.addEventListener(t,s),window.addEventListener("pointercancel",s),window.addEventListener("blur",s)},[se,oe,le,R]),ue=n.useRef(null);function de(e){return"hold"!==j?{onClick:()=>se(e)}:{onPointerDown:t=>{0===t.button&&ce(e,"pointerup")},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),ce(e,"keyup"))}}}n.useEffect(()=>()=>ue.current?.(),[]),n.useEffect(()=>{const e=J.current;if(e&&T&&K)return f(e)},[K,T]);const pe="inline"===L,me=U?.back??!1,fe=U?.forward??!1,ge=null===U&&pe&&"auto"===E,ve="none"!==E&&("always"===E||ge||me||fe);function be(t){const n=t?fe:me,o=t?"forward":"back";if("auto"===E&&!n&&!pe&&te!==o)return e("span",{});const l=K?t?"-rotate-90 rtl:rotate-90":"rotate-90 rtl:-rotate-90":t?"":"rotate-180",i=e(r,{variant:A,size:M,color:N,density:B,elevation:1,label:t?H??_.next:z??_.previous,disabled:!n,focusableWhenDisabled:!0,onFocus:()=>ne(o),onBlur:()=>ne(e=>e===o?null:e),className:"pointer-events-auto",icon:e("span",{className:m("flex items-center",l),children:e(a,{})}),...de(t)});return pe?e("span",{"data-held":ge?"":void 0,className:"flex shrink-0 items-center justify-center",style:ge?{visibility:"hidden"}:void 0,children:i}):i}return t("div",{ref:y,className:m("relative flex min-w-0",pe&&K?"flex-row items-stretch":"flex-col",pe?b[M]:"",q),style:{"--n-ring":`var(--neba-${N}-ring)`,...X},...Z,children:[ve&&pe?be(!1):null,e("div",{ref:Q,tabIndex:me||fe?0:-1,role:"group","aria-label":W??_.label,className:m("min-h-0 min-w-0 grow",K?"overflow-x-auto overflow-y-hidden":"overflow-y-auto overflow-x-hidden","overscroll-contain",S?K?"snap-x snap-mandatory":"snap-y snap-mandatory":"",F?"":"[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",P&&(me||fe)?"cursor-grab data-[dragging]:cursor-grabbing":"","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]"),onScroll:e=>{re(),$?.(e)},onPointerDown:function(e){if(!P||"touch"===e.pointerType||0!==e.button)return;ue.current?.();const t=e.currentTarget,n=e.clientX,r=e.clientY,l=t.scrollLeft,i=t.scrollTop,s=o(t);let a=!1;const c=document.body.style.getPropertyValue("-webkit-user-select"),u=e=>{if(0===e.buttons)return void d();const o=e.clientX-n,c=e.clientY-r;if(!a){if(Math.abs(K?o:c)<4)return;a=!0,t.setPointerCapture(e.pointerId),t.dataset.dragging="true",document.body.style.setProperty("-webkit-user-select","none"),S&&(t.style.scrollSnapType="none")}K?t.scrollLeft=l-o/s.x:t.scrollTop=i-c/s.y},d=()=>{ue.current=null,t.removeEventListener("pointermove",u),t.removeEventListener("pointerup",p),t.removeEventListener("pointercancel",d),delete t.dataset.dragging,t.style.removeProperty("scroll-snap-type"),c?document.body.style.setProperty("-webkit-user-select",c):document.body.style.removeProperty("-webkit-user-select")},p=()=>{const e=a;if(d(),!e)return;const n=e=>{e.stopPropagation(),e.preventDefault()};t.addEventListener("click",n,{capture:!0,once:!0}),window.setTimeout(()=>t.removeEventListener("click",n,!0),0)};ue.current=d,t.addEventListener("pointermove",u),t.addEventListener("pointerup",p),t.addEventListener("pointercancel",d)},children:e("div",{ref:O,className:m(S?"[&>*]:snap-start":""),style:{display:"grid",gap:l(k),gridAutoFlow:K?"column":"row",...K?{width:"max-content",gridTemplateRows:`repeat(${V}, auto)`,gridAutoColumns:"max-content"}:{gridTemplateColumns:`repeat(${V}, minmax(0, 1fr))`,gridAutoRows:"max-content"}},children:Y})}),ve&&pe?be(!0):null,ve&&!pe?t("div",{className:m("pointer-events-none absolute inset-0 flex justify-between",K?"items-center":"flex-col items-center",v[M]),children:[be(!1),be(!0)]}):null]})});
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{glowClasses as n,trackPointer as r}from"../../internal/glow.js";import{Radio as o}from"@base-ui/react/radio";import{RadioGroup as s}from"@base-ui/react/radio-group";import{observeResize as l}from"../../internal/observe.js";import{controlHeightClasses as i,controlSlots as d,controlTextClasses as u,cx as f,gapClasses as c,hasContent as b,iconClasses as p,paddingXClasses as h,surfaceClasses as m,transitionClasses as g}from"../../internal/styles.js";import{useStyleDefaults as v}from"../../internal/defaults.js";const x=/*@__PURE__*/a.createContext({variant:"outline",size:"md",density:"default",fullWidth:!1,disabled:!1,readOnly:!1}),y={solid:`${m} bg-(--n-panel) p-1 [box-shadow:var(--n-elev),var(--neba-plate-glass)]`,outline:`${m} border bg-(--n-panel) p-1 [border-color:var(--n-line)] [box-shadow:var(--n-elev),var(--neba-plate-glass)]`,text:""},w={solid:"bg-transparent p-1",outline:"border bg-transparent p-1 [border-color:var(--neba-disabled-border)]",text:""},j={solid:`${m} bg-(--n-fill) [box-shadow:var(--neba-shadow-1),var(--neba-plate-solid)]`,outline:`${m} bg-(--n-panel-press) [box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]`,text:`${m} bg-(--n-panel-press) [box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]`},k="data-[off]:bg-(--neba-disabled-bg) data-[off]:[box-shadow:none]",$={solid:"data-[checked]:text-(--n-on-solid)",outline:"data-[checked]:text-(--n-on-tint)",text:"data-[checked]:text-(--n-on-tint)"};export const Segment=/*@__PURE__*/a.forwardRef(function Segment({value:s,startIcon:l,endIcon:d,disabled:m=!1,className:v,children:y,...w},j){const k=a.useContext(x),{variant:N,size:P,density:R,fullWidth:z}=k,A=m||k.disabled,S=k.readOnly&&!A;return t(o.Root,{ref:j,value:s,disabled:m,"data-segment":"",className:f("neba-segment relative z-10 inline-flex shrink-0 items-center justify-center select-none","whitespace-nowrap font-medium","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",i[P],u[P],c[P],h[R][P],"rounded-full",g,p,A?"cursor-not-allowed text-(--neba-disabled-fg)":S?f("cursor-default text-(--neba-muted-fg)",$[N]):f("cursor-pointer text-(--neba-muted-fg) hover:text-(--neba-fg)",$[N],n),"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]",z?"flex-1":"",v??""),...w,onPointerMove:r(w.onPointerMove,!A&&!S),children:[b(l)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:l}):null,y,b(d)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:d}):null]})});export const SegmentedButton=/*@__PURE__*/a.forwardRef(function SegmentedButton(n,r){const{variant:o="outline",size:i="md",color:u="primary",density:f="default",elevation:c=0,value:b,defaultValue:p=null,onValueChange:h,disabled:m=!1,readOnly:$=!1,name:N,fullWidth:P=!1,className:R,style:z,children:A,...S}=v(n,["size","density","variant"]),[W,C]=a.useState(p),O=void 0!==b,B=O?b:W,M=a.useRef(null),V=a.useRef(null),E=a.useCallback(e=>{const t=M.current,a=V.current;if(!t||!a)return;const n=t.querySelector("[data-segment][data-checked]");if(a.hidden=!n,!n)return void a.removeAttribute("data-ready");a.toggleAttribute("data-off",n.hasAttribute("data-disabled"));const r=!e||!a.hasAttribute("data-ready");r&&a.removeAttribute("data-ready"),a.style.setProperty("--n-seg-x",`${n.offsetLeft}px`),a.style.setProperty("--n-seg-y",`${n.offsetTop}px`),a.style.setProperty("--n-seg-w",`${n.offsetWidth}px`),a.style.setProperty("--n-seg-h",`${n.offsetHeight}px`),r&&a.offsetWidth,a.setAttribute("data-ready","")},[]);a.useLayoutEffect(()=>{E(!0)},[E,B,o,i,f,P,m,A]),a.useEffect(()=>{const e=M.current;if(e)return l(e,()=>E(!1))},[E]);const I=a.useMemo(()=>({variant:o,size:i,density:f,fullWidth:P,disabled:m,readOnly:$}),[o,i,f,P,m,$]);return e(x.Provider,{value:I,children:t(s,{ref:e=>{M.current=e,"function"==typeof r?r(e):r&&(r.current=e)},value:B,onValueChange:e=>{const t=e??null;O||C(t),h?.(t)},disabled:m,readOnly:$,name:N,className:["relative items-center rounded-full",m?w[o]:y[o],g,$?"[filter:saturate(0.55)]":"",P?"flex w-full":"inline-flex",R??""].filter(Boolean).join(" "),style:{...d(u,c,o),...z},...S,children:[null!=B?e("span",{ref:V,"aria-hidden":"true",className:["pointer-events-none absolute rounded-full","left-(--n-seg-x) top-(--n-seg-y) h-(--n-seg-h) w-(--n-seg-w)",j[o],k,"[transition-property:left,top,width,height]","[transition-timing-function:var(--neba-ease)]","[transition-duration:0ms] data-[ready]:[transition-duration:var(--neba-duration)]"].join(" ")}):null,A]})})});
1
+ "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{useLayoutEffectOnClient as n}from"../../internal/layout-effect.js";import{glowClasses as r,trackPointer as s}from"../../internal/glow.js";import{Radio as o}from"@base-ui/react/radio";import{RadioGroup as l}from"@base-ui/react/radio-group";import{observeResize as i}from"../../internal/observe.js";import{controlHeightClasses as d,controlSlots as u,controlTextClasses as f,cx as c,gapClasses as b,hasContent as p,iconClasses as m,paddingXClasses as h,surfaceClasses as g,transitionClasses as v}from"../../internal/styles.js";import{useStyleDefaults as x}from"../../internal/defaults.js";const y=/*@__PURE__*/a.createContext({variant:"outline",size:"md",density:"default",fullWidth:!1,disabled:!1,readOnly:!1}),w={solid:`${g} bg-(--n-panel) p-1 [box-shadow:var(--n-elev),var(--neba-plate-glass)]`,outline:`${g} border bg-(--n-panel) p-1 [border-color:var(--n-line)] [box-shadow:var(--n-elev),var(--neba-plate-glass)]`,text:""},j={solid:"bg-transparent p-1",outline:"border bg-transparent p-1 [border-color:var(--neba-disabled-border)]",text:""},k={solid:`${g} bg-(--n-fill) [box-shadow:var(--neba-shadow-1),var(--neba-plate-solid)]`,outline:`${g} bg-(--n-panel-press) [box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]`,text:`${g} bg-(--n-panel-press) [box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]`},$="data-[off]:bg-(--neba-disabled-bg) data-[off]:[box-shadow:none]",A={solid:"data-[checked]:text-(--n-on-solid)",outline:"data-[checked]:text-(--n-on-tint)",text:"data-[checked]:text-(--n-on-tint)"};export const Segment=/*@__PURE__*/a.forwardRef(function Segment({value:n,startIcon:l,endIcon:i,disabled:u=!1,className:g,children:x,...w},j){const k=a.useContext(y),{variant:$,size:N,density:P,fullWidth:R}=k,z=u||k.disabled,S=k.readOnly&&!z;return t(o.Root,{ref:j,value:n,disabled:u,"data-segment":"",className:c("neba-segment relative z-10 inline-flex shrink-0 items-center justify-center select-none","whitespace-nowrap font-medium","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",d[N],f[N],b[N],h[P][N],"rounded-full",v,m,z?"cursor-not-allowed text-(--neba-disabled-fg)":S?c("cursor-default text-(--neba-muted-fg)",A[$]):c("cursor-pointer text-(--neba-muted-fg) hover:text-(--neba-fg)",A[$],r),"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]",R?"flex-1":"",g??""),...w,onPointerMove:s(w.onPointerMove,!z&&!S),children:[p(l)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:l}):null,x,p(i)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:i}):null]})});export const SegmentedButton=/*@__PURE__*/a.forwardRef(function SegmentedButton(r,s){const{variant:o="outline",size:d="md",color:f="primary",density:c="default",elevation:b=0,value:p,defaultValue:m=null,onValueChange:h,disabled:g=!1,readOnly:A=!1,name:N,fullWidth:P=!1,className:R,style:z,children:S,...W}=x(r,["size","density","variant"]),[C,O]=a.useState(m),B=void 0!==p,M=B?p:C,V=a.useRef(null),I=a.useRef(null),_=a.useCallback(e=>{const t=V.current,a=I.current;if(!t||!a)return;const n=t.querySelector("[data-segment][data-checked]");if(a.hidden=!n,!n)return a.removeAttribute("data-ready"),void t.removeAttribute("data-placed");a.toggleAttribute("data-off",n.hasAttribute("data-disabled"));const r=!e||!a.hasAttribute("data-ready");r&&a.removeAttribute("data-ready"),a.style.setProperty("--n-seg-x",`${n.offsetLeft}px`),a.style.setProperty("--n-seg-y",`${n.offsetTop}px`),a.style.setProperty("--n-seg-w",`${n.offsetWidth}px`),a.style.setProperty("--n-seg-h",`${n.offsetHeight}px`),r&&a.offsetWidth,a.setAttribute("data-ready",""),t.setAttribute("data-placed","")},[]);n(()=>{_(!0)},[_,M,o,d,c,P,g,S]),a.useEffect(()=>{const e=V.current;if(e)return i(e,()=>_(!1))},[_]);const q=a.useMemo(()=>({variant:o,size:d,density:c,fullWidth:P,disabled:g,readOnly:A}),[o,d,c,P,g,A]);return e(y.Provider,{value:q,children:t(l,{ref:e=>{V.current=e,"function"==typeof s?s(e):s&&(s.current=e)},value:M,onValueChange:e=>{const t=e??null;B||O(t),h?.(t)},disabled:g,readOnly:A,name:N,className:["neba-segmented relative items-center rounded-full",g?j[o]:w[o],v,A?"[filter:saturate(0.55)]":"",P?"flex w-full":"inline-flex",R??""].filter(Boolean).join(" "),style:{...u(f,b,o),"--n-seg-bg":"solid"===o?"var(--n-fill)":"var(--n-panel-press)","--n-seg-plate":"solid"===o?"var(--neba-plate-solid)":"var(--neba-plate-glass)",...z},...W,children:[null!=M?e("span",{ref:I,"aria-hidden":"true",className:["pointer-events-none absolute rounded-full","left-(--n-seg-x) top-(--n-seg-y) h-(--n-seg-h) w-(--n-seg-w)",k[o],$,"[transition-property:left,top,width,height]","[transition-timing-function:var(--neba-ease)]","[transition-duration:0ms] data-[ready]:[transition-duration:var(--neba-duration)]","invisible data-[ready]:visible"].join(" ")}):null,S]})})});
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{Select as t}from"@base-ui/react/select";import{Field as r}from"@base-ui/react/field";import{CheckIcon as n,ChevronIcon as i}from"../../internal/icons.js";import{WidthSizer as s}from"../../internal/sizer.js";import{controlTextLeadingClasses as o,cx as d,disabledClasses as c,fieldFocusTransitionClasses as m,fieldHeightClasses as u,fieldReadOnlyClasses as p,fieldRestClasses as b,fieldRingClasses as f,fieldSheetClasses as h,fieldSheetDisabledClasses as g,fieldSheetReadOnlyClasses as v,gapClasses as x,hasContent as N,iconClasses as j,metaTextClasses as y,paddingXClasses as w,popupFadeClasses as $,radiusClasses as z,readOnlyFilterClasses as I,stackGapClasses as S,surfaceClasses as P,surfaceSlots as V,transitionClasses as k}from"../../internal/styles.js";import{useStyleDefaults as C}from"../../internal/defaults.js";import{FieldNotch as M,NotchFrame as O}from"../../internal/notch.js";import{fieldSpotlightSlot as R,glowClasses as T,trackPointer as q}from"../../internal/glow.js";import{useFieldsetDisabled as G}from"../../internal/fieldset.js";const L=["group relative flex w-full cursor-pointer items-center select-none","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",k,m,j].join(" "),W=[P,"max-h-[min(20rem,var(--available-height))] overflow-y-auto overscroll-contain","min-w-[var(--anchor-width)] border bg-(--n-panel-press) p-1","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]","[outline:none]",$].join(" "),_=["py-1.5 pe-2 ps-7 font-semibold tracking-wide text-(--neba-muted-fg) uppercase"].join(" "),D=["relative flex cursor-pointer items-center gap-2 select-none","rounded-(--neba-radius-xs) py-1.5 pe-2 ps-7",k,"data-[highlighted]:bg-(--n-soft-hover) data-[highlighted]:text-(--n-on-tint)","data-[selected]:text-(--n-on-tint) data-[selected]:font-medium","data-[disabled]:cursor-not-allowed data-[disabled]:text-(--neba-disabled-fg)","[outline:none]"].join(" ");export const Select=/*@__PURE__*/l.forwardRef(function Select(m,j){const{variant:$="outline",size:P="md",color:k="primary",density:E="default",elevation:A=0,items:B,value:F,defaultValue:H,onValueChange:J,placeholder:K,label:Q,labelPlacement:U="top",description:X,error:Y,invalid:Z,startIcon:ee,fullWidth:ae=!1,disabled:le,readOnly:te=!1,required:re=!1,name:ne,id:ie,className:se,classNames:oe,style:de,"aria-label":ce,"aria-labelledby":me,...ue}=C(m,["size","density","variant","labelPlacement"]),pe=G(le),be=!pe&&!te,fe=null!=Y&&!1!==Y&&""!==Y,he=Z??fe,ge=he?"danger":k,ve=l.useMemo(()=>B.map(e=>({label:e.label??String(e.value),value:e.value})),[B]),xe=l.useMemo(()=>function(e){const a=[];for(const l of e){const e=a.at(-1);e&&e.label===l.group?e.items.push(l):a.push({label:l.group,items:[l]})}return a}(B),[B]),Ne="top"!==U&&N(Q),je=Ne&&"float"===U&&!N(ee),ye=l.useMemo(()=>[...B.map(e=>e.label??String(e.value)),...N(K)?[K]:[],...je?[Q]:[]],[B,K,je,Q]),we=a(t.Trigger,{ref:j,onPointerMove:q(void 0,be),"aria-label":ce,"aria-labelledby":me,className:d(L,u[P],o[P],z[P],x[P],w[E][P],Ne?"":f,pe?(Ne?g:c)[$]:te?Ne?`${v[$]} ${I} cursor-default`:`${p[$]} cursor-default`:`${(Ne?h:b)[$]} ${T}`,je?"neba-float-control":"",oe?.control),children:[ee?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:ee}):null,a("span",{className:"flex min-w-0 flex-1 flex-col",children:[e(t.Value,{className:["w-full truncate text-start","data-[placeholder]:text-(--neba-muted-fg)"].join(" "),placeholder:K}),e(s,{samples:ye})]}),e(t.Icon,{className:["flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)","[transition:rotate_var(--neba-duration)_var(--neba-ease)]","data-[popup-open]:rotate-180"].join(" "),children:e(i,{})})]});return a(r.Root,{disabled:pe,invalid:he,className:d("flex-col align-top",S[P],ae?"flex w-full":"inline-flex",se??""),style:{...V(ge,A),...be?R:void 0,...de},...ue,children:[Q&&!Ne?e(r.Label,{className:d(y[P],"font-medium",pe?"text-(--neba-disabled-fg)":"text-(--neba-fg)",oe?.label),children:Q}):null,a(t.Root,{id:ie,name:ne,items:ve,value:F,defaultValue:H,onValueChange:e=>J?.(e),disabled:pe,readOnly:te,required:re,children:[Ne?a(O,{label:Q,size:P,density:E,variant:$,labelClassName:oe?.label,className:d(z[P],pe?"cursor-not-allowed":te?"cursor-default":"cursor-pointer"),children:[we,e(M,{label:Q,variant:$,disabled:pe,readOnly:te,rests:je,beside:!0,labelClassName:oe?.label})]}):we,e(t.Portal,{children:e(t.Positioner,{className:"neba-portal z-(--neba-z-portal) [outline:none]",sideOffset:6,alignItemWithTrigger:!1,children:e(t.Popup,{className:d(W,z[P],o[P],oe?.popup),style:V(ge,3),children:xe.map((l,r)=>{const i=l.items.map(l=>a(t.Item,{value:l.value,disabled:l.disabled,className:d(D,oe?.item),children:[e(t.ItemIndicator,{className:"absolute start-1.5 flex size-4 items-center justify-center",children:e(n,{})}),e(t.ItemText,{className:"truncate",children:l.label??String(l.value)})]},String(l.value)));return void 0===l.label?i:a(t.Group,{children:[e(t.GroupLabel,{className:`${_} ${y[P]}`,children:l.label}),i]},`${l.label}-${r}`)})})})})]}),X?e(r.Description,{className:d(y[P],"text-(--neba-muted-fg)",oe?.description),children:X}):null,e(r.Error,fe?{match:!0,className:d(y[P],"text-(--n-accent)",oe?.error),children:Y}:{className:d(y[P],"text-(--n-accent)",oe?.error)})]})});
1
+ "use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{Select as t}from"@base-ui/react/select";import{Field as r}from"@base-ui/react/field";import{CheckIcon as n,ChevronIcon as i}from"../../internal/icons.js";import{WidthSizer as s,widestSamples as o}from"../../internal/sizer.js";import{controlTextLeadingClasses as d,cx as c,disabledClasses as m,fieldFocusTransitionClasses as u,fieldHeightClasses as p,fieldReadOnlyClasses as b,fieldRestClasses as f,fieldRingClasses as h,fieldSheetClasses as g,fieldSheetDisabledClasses as v,fieldSheetReadOnlyClasses as x,gapClasses as N,hasContent as j,iconClasses as y,metaTextClasses as w,paddingXClasses as $,popupFadeClasses as z,radiusClasses as I,readOnlyFilterClasses as S,stackGapClasses as P,surfaceClasses as V,surfaceSlots as k,transitionClasses as C}from"../../internal/styles.js";import{useStyleDefaults as M}from"../../internal/defaults.js";import{FieldNotch as O,NotchFrame as R}from"../../internal/notch.js";import{fieldSpotlightSlot as T,glowClasses as q,trackPointer as G}from"../../internal/glow.js";import{useFieldsetDisabled as L}from"../../internal/fieldset.js";const W=["group relative flex w-full cursor-pointer items-center select-none","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",C,u,y].join(" "),_=[V,"max-h-[min(20rem,var(--available-height))] overflow-y-auto overscroll-contain","min-w-[var(--anchor-width)] border bg-(--n-panel-press) p-1","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]","[outline:none]",z].join(" "),D=["py-1.5 pe-2 ps-7 font-semibold tracking-wide text-(--neba-muted-fg) uppercase"].join(" "),E=["relative flex cursor-pointer items-center gap-2 select-none","rounded-(--neba-radius-xs) py-1.5 pe-2 ps-7",C,"data-[highlighted]:bg-(--n-soft-hover) data-[highlighted]:text-(--n-on-tint)","data-[selected]:text-(--n-on-tint) data-[selected]:font-medium","data-[disabled]:cursor-not-allowed data-[disabled]:text-(--neba-disabled-fg)","[outline:none]"].join(" ");export const Select=/*@__PURE__*/l.forwardRef(function Select(u,y){const{variant:z="outline",size:V="md",color:C="primary",density:A="default",elevation:B=0,items:F,value:H,defaultValue:J,onValueChange:K,placeholder:Q,label:U,labelPlacement:X="top",description:Y,error:Z,invalid:ee,startIcon:ae,fullWidth:le=!1,disabled:te,readOnly:re=!1,required:ne=!1,name:ie,id:se,className:oe,classNames:de,style:ce,"aria-label":me,"aria-labelledby":ue,...pe}=M(u,["size","density","variant","labelPlacement"]),be=L(te),fe=!be&&!re,he=null!=Z&&!1!==Z&&""!==Z,ge=ee??he,ve=ge?"danger":C,xe=l.useMemo(()=>F.map(e=>({label:e.label??String(e.value),value:e.value})),[F]),Ne=l.useMemo(()=>function(e){const a=[];for(const l of e){const e=a.at(-1);e&&e.label===l.group?e.items.push(l):a.push({label:l.group,items:[l]})}return a}(F),[F]),je="top"!==X&&j(U),ye=je&&"float"===X&&!j(ae),we=l.useMemo(()=>o([...F.map(e=>e.label??String(e.value)),...j(Q)?[Q]:[],...ye?[U]:[]]),[F,Q,ye,U]),$e=a(t.Trigger,{ref:y,onPointerMove:G(void 0,fe),"aria-label":me,"aria-labelledby":ue,className:c(W,p[V],d[V],I[V],N[V],$[A][V],je?"":h,be?(je?v:m)[z]:re?je?`${x[z]} ${S} cursor-default`:`${b[z]} cursor-default`:`${(je?g:f)[z]} ${q}`,ye?"neba-float-control":"",de?.control),children:[ae?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:ae}):null,a("span",{className:"flex min-w-0 flex-1 flex-col",children:[e(t.Value,{className:["w-full truncate text-start","data-[placeholder]:text-(--neba-muted-fg)"].join(" "),placeholder:Q}),e(s,{samples:we})]}),e(t.Icon,{className:["flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)","[transition:rotate_var(--neba-duration)_var(--neba-ease)]","data-[popup-open]:rotate-180"].join(" "),children:e(i,{})})]});return a(r.Root,{disabled:be,invalid:ge,className:c("flex-col align-top",P[V],le?"flex w-full":"inline-flex",oe??""),style:{...k(ve,B),...fe?T:void 0,...ce},...pe,children:[U&&!je?e(r.Label,{className:c(w[V],"font-medium",be?"text-(--neba-disabled-fg)":"text-(--neba-fg)",de?.label),children:U}):null,a(t.Root,{id:se,name:ie,items:xe,value:H,defaultValue:J,onValueChange:e=>K?.(e),disabled:be,readOnly:re,required:ne,children:[je?a(R,{label:U,size:V,density:A,variant:z,labelClassName:de?.label,className:c(I[V],be?"cursor-not-allowed":re?"cursor-default":"cursor-pointer"),children:[$e,e(O,{label:U,variant:z,disabled:be,readOnly:re,rests:ye,beside:!0,labelClassName:de?.label})]}):$e,e(t.Portal,{children:e(t.Positioner,{className:"neba-portal z-(--neba-z-portal) [outline:none]",sideOffset:6,alignItemWithTrigger:!1,children:e(t.Popup,{className:c(_,I[V],d[V],de?.popup),style:k(ve,3),children:Ne.map((l,r)=>{const i=l.items.map(l=>a(t.Item,{value:l.value,disabled:l.disabled,className:c(E,de?.item),children:[e(t.ItemIndicator,{className:"absolute start-1.5 flex size-4 items-center justify-center",children:e(n,{})}),e(t.ItemText,{className:"truncate",children:l.label??String(l.value)})]},String(l.value)));return void 0===l.label?i:a(t.Group,{children:[e(t.GroupLabel,{className:`${D} ${w[V]}`,children:l.label}),i]},`${l.label}-${r}`)})})})})]}),Y?e(r.Description,{className:c(w[V],"text-(--neba-muted-fg)",de?.description),children:Y}):null,e(r.Error,he?{match:!0,className:c(w[V],"text-(--n-accent)",de?.error),children:Z}:{className:c(w[V],"text-(--n-accent)",de?.error)})]})});
@@ -62,6 +62,19 @@ export interface SidebarProps extends Omit<React.ComponentPropsWithoutRef<'aside
62
62
  /** Which state it starts in, for an uncontrolled standalone sidebar. @default false */
63
63
  defaultOpen?: boolean;
64
64
  onOpenChange?: (open: boolean) => void;
65
+ /**
66
+ * Keeps the drawer's contents in the DOM while it is closed, once the sidebar
67
+ * has collapsed into one. A column is always there and this changes nothing
68
+ * about it.
69
+ *
70
+ * The server sends the column, so a crawler that does not run scripts reads
71
+ * the links either way. One that does run them, at a phone's width, sees the
72
+ * sidebar become a closed drawer — and a closed drawer that is not in the DOM
73
+ * takes every link in the navigation with it. Turn this on where those links
74
+ * are how the site is found.
75
+ * @default false
76
+ */
77
+ keepMounted?: boolean;
65
78
  /**
66
79
  * Whether the column holds its place while the page scrolls past it.
67
80
  *
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{boxPaddingXClasses as n,boxPaddingYClasses as o}from"../box/Box.js";import{Drawer as a}from"../drawer/Drawer.js";import{beginPointerDrag as s,drawnScale as l}from"../../internal/drag.js";import{layoutMessages as i,useMessages as c}from"../../internal/i18n.js";import{drawerSide as u,expandedOnlyClasses as d,PageLayoutContext as f,SidebarSideContext as p,useCollapsed as b}from"../../internal/page-layout.js";import{cx as m,surfaceClasses as h,surfaceSlots as v,toLength as w,toPixels as g,transitionClasses as y}from"../../internal/styles.js";import{useStyleDefaults as x}from"../../internal/defaults.js";const S={xs:"11rem",sm:"13rem",md:"16rem",lg:"18rem",xl:"21rem"},j={solid:[h,"text-(--neba-fg) bg-(--n-panel-press)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[h,"text-(--neba-fg) bg-(--n-panel)","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--neba-fg) bg-transparent"};export const Sidebar=/*@__PURE__*/r.forwardRef(function Sidebar(h,R){const z=r.useContext(f),{side:E,width:N,minWidth:k=160,maxWidth:A=480,resizable:B=!1,onResize:C,onResizeEnd:M,collapseBelow:O,open:W,defaultOpen:D=!1,onOpenChange:L,sticky:P,title:T,variant:I="outline",size:$="md",color:_="primary",density:X="default",elevation:K=0,divider:V=!0,padded:q=!0,label:F,locale:G,className:H,style:J,children:Q,...U}=x(h,["size","density","variant","locale"],{locale:z.locale}),Y=r.useContext(p),Z=E??Y??"start",ee=G??z.locale,te=c(i,ee),re=O??(z.present?z.collapseBelow:"none"),ne=b(re),oe=P??z.present;r.useEffect(()=>{"production"!==process.env.NODE_ENV&&z.present&&void 0!==O&&O!==z.collapseBelow&&console.warn(`Neba: a Sidebar collapses below "${O}" and its PageLayout below "${z.collapseBelow}". A SidebarTrigger follows the layout, so between the two widths the drawer has nothing to open it. Set collapseBelow on the PageLayout instead.`)},[z.present,z.collapseBelow,O]);const[ae,se]=r.useState(D),le=void 0!==W,ie=le?W:z.present?z.open[Z]:ae,ce=e=>{le||(z.present?z.setOpen(Z,e):se(e)),L?.(e)},ue=r.useRef(ie),de=r.useRef(ce),fe=r.useRef(ne);r.useEffect(()=>{ue.current=ie,de.current=ce}),r.useEffect(()=>{fe.current&&!ne&&ue.current&&de.current(!1),fe.current=ne},[ne]);const pe=w(N)??S[$],be=r.useRef(null),me=r.useCallback(e=>{be.current=e,"function"==typeof R?R(e):R&&(R.current=e)},[R]),he=r.useRef(null);r.useEffect(()=>()=>he.current?.(),[]);const ve=r.useRef(null),we=(e,t,r)=>null==t?r:"number"==typeof t?t:g(t,{percentOf:"undefined"==typeof window?0:window.innerWidth,relativeTo:e})??r,ge=(e,t)=>{const r=ve.current;r&&(r.setAttribute("aria-valuenow",String(Math.round(t))),r.setAttribute("aria-valuemin",String(Math.round(we(e,k,160)))),r.setAttribute("aria-valuemax",String(Math.round(we(e,A,480)))))};r.useEffect(()=>{const e=be.current;B&&e&&ge(e,e.offsetWidth)},[B,k,A,pe,ne]);const ye=e=>{const t=be.current;if(!t)return e;const r=Math.min(we(t,A,480),Math.max(we(t,k,160),Math.round(e)));return t.style.setProperty("--n-sidebar-w",`${r}px`),ge(t,r),r},xe=e("div",{className:m("min-h-0 flex-1 overflow-y-auto overscroll-contain",q?m(n[X][$],o[X][$]):""),children:Q});return ne?e(a,{side:u(Z),mode:"overlay",open:ie,onOpenChange:ce,title:T,size:$,color:_,density:X,locale:ee,closeLabel:te.closeSidebar,extent:void 0===N?void 0:pe,"aria-label":T?void 0:F??te.sidebar,className:H,style:J,...U,children:Q}):t("aside",{ref:me,"aria-label":F??te.sidebar,className:m("relative flex min-w-0 shrink-0 flex-col","w-(--n-sidebar-w)",j[I],V?m("start"===Z?"border-e":"border-s","[border-color:var(--n-line)]"):"","content"===z.scroll?"h-full":oe?m("self-start","sticky [top:var(--n-layout-header,0px)]","[height:calc(100dvh-var(--n-layout-header,0px)-var(--n-layout-footer,0px))]"):"",d[re],y,H),style:{...v(_,K),"--n-sidebar-w":pe,...J},...U,children:[xe,B?e("div",{ref:ve,role:"separator","aria-orientation":"vertical","aria-label":te.resizeSidebar,tabIndex:0,className:m("neba-hit absolute inset-y-0 z-1 w-2 cursor-col-resize touch-none","start"===Z?"end-0 -me-1":"start-0 -ms-1","bg-transparent hover:bg-(--n-soft) data-[dragging]:bg-(--n-soft)",y,"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-0"),onPointerDown:e=>{const t=be.current;if(!t||0!==e.button)return;const r=e.currentTarget,n=e.clientX,o=t.offsetWidth,a=l(t).x,i="rtl"===getComputedStyle(t).direction,c="start"===Z===i?-1:1;let u=o;he.current=s({target:r,pointerId:e.pointerId,onMove:e=>{u=ye(o+(e.clientX-n)/a*c),C?.(u)},onEnd:()=>{he.current=null,M?.(u)}})},onKeyDown:e=>{if("ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.preventDefault();const t="rtl"===getComputedStyle(e.currentTarget).direction,r="start"===Z===t?-1:1;(e=>{const t=be.current;if(!t)return;const r=ye(t.offsetWidth+e);C?.(r),M?.(r)})(("ArrowRight"===e.key?16:-16)*r)}}):null]})});
1
+ "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{boxPaddingXClasses as n,boxPaddingYClasses as o}from"../box/Box.js";import{Drawer as a}from"../drawer/Drawer.js";import{beginPointerDrag as s,drawnScale as l}from"../../internal/drag.js";import{layoutMessages as i,useMessages as c}from"../../internal/i18n.js";import{drawerSide as u,expandedOnlyClasses as d,PageLayoutContext as f,SidebarSideContext as p,useCollapsed as b}from"../../internal/page-layout.js";import{cx as m,surfaceClasses as h,surfaceSlots as v,toLength as w,toPixels as g,transitionClasses as y}from"../../internal/styles.js";import{useStyleDefaults as x}from"../../internal/defaults.js";const S={xs:"11rem",sm:"13rem",md:"16rem",lg:"18rem",xl:"21rem"},j={solid:[h,"text-(--neba-fg) bg-(--n-panel-press)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[h,"text-(--neba-fg) bg-(--n-panel)","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--neba-fg) bg-transparent"};export const Sidebar=/*@__PURE__*/r.forwardRef(function Sidebar(h,R){const k=r.useContext(f),{side:z,width:E,minWidth:M=160,maxWidth:N=480,resizable:A=!1,onResize:B,onResizeEnd:C,collapseBelow:O,open:W,defaultOpen:D=!1,onOpenChange:L,keepMounted:P=!1,sticky:T,title:I,variant:$="outline",size:_="md",color:X="primary",density:K="default",elevation:V=0,divider:q=!0,padded:F=!0,label:G,locale:H,className:J,style:Q,children:U,...Y}=x(h,["size","density","variant","locale"],{locale:k.locale}),Z=r.useContext(p),ee=z??Z??"start",te=H??k.locale,re=c(i,te),ne=O??(k.present?k.collapseBelow:"none"),oe=b(ne),ae=T??k.present;r.useEffect(()=>{"production"!==process.env.NODE_ENV&&k.present&&void 0!==O&&O!==k.collapseBelow&&console.warn(`Neba: a Sidebar collapses below "${O}" and its PageLayout below "${k.collapseBelow}". A SidebarTrigger follows the layout, so between the two widths the drawer has nothing to open it. Set collapseBelow on the PageLayout instead.`)},[k.present,k.collapseBelow,O]);const[se,le]=r.useState(D),ie=void 0!==W,ce=ie?W:k.present?k.open[ee]:se,ue=e=>{ie||(k.present?k.setOpen(ee,e):le(e)),L?.(e)},de=r.useRef(ce),fe=r.useRef(ue),pe=r.useRef(oe);r.useEffect(()=>{de.current=ce,fe.current=ue}),r.useEffect(()=>{pe.current&&!oe&&de.current&&fe.current(!1),pe.current=oe},[oe]);const be=w(E)??S[_],me=r.useRef(null),he=r.useCallback(e=>{me.current=e,"function"==typeof R?R(e):R&&(R.current=e)},[R]),ve=r.useRef(null);r.useEffect(()=>()=>ve.current?.(),[]);const we=r.useRef(null),ge=(e,t,r)=>null==t?r:"number"==typeof t?t:g(t,{percentOf:"undefined"==typeof window?0:window.innerWidth,relativeTo:e})??r,ye=(e,t)=>{const r=we.current;r&&(r.setAttribute("aria-valuenow",String(Math.round(t))),r.setAttribute("aria-valuemin",String(Math.round(ge(e,M,160)))),r.setAttribute("aria-valuemax",String(Math.round(ge(e,N,480)))))};r.useEffect(()=>{const e=me.current;A&&e&&ye(e,e.offsetWidth)},[A,M,N,be,oe]);const xe=e=>{const t=me.current;if(!t)return e;const r=Math.min(ge(t,N,480),Math.max(ge(t,M,160),Math.round(e)));return t.style.setProperty("--n-sidebar-w",`${r}px`),ye(t,r),r},Se=e("div",{className:m("min-h-0 flex-1 overflow-y-auto overscroll-contain",F?m(n[K][_],o[K][_]):""),children:U});return oe?e(a,{side:u(ee),mode:"overlay",open:ce,onOpenChange:ue,keepMounted:P,title:I,size:_,color:X,density:K,locale:te,closeLabel:re.closeSidebar,extent:void 0===E?void 0:be,"aria-label":I?void 0:G??re.sidebar,className:J,style:Q,...Y,children:U}):t("aside",{ref:he,"aria-label":G??re.sidebar,className:m("relative flex min-w-0 shrink-0 flex-col","w-(--n-sidebar-w)",j[$],q?m("start"===ee?"border-e":"border-s","[border-color:var(--n-line)]"):"","content"===k.scroll?"h-full":ae?m("self-start","sticky [top:var(--n-layout-header,0px)]","[height:calc(100dvh-var(--n-layout-header,0px)-var(--n-layout-footer,0px))]"):"",d[ne],y,J),style:{...v(X,V),"--n-sidebar-w":be,...Q},...Y,children:[Se,A?e("div",{ref:we,role:"separator","aria-orientation":"vertical","aria-label":re.resizeSidebar,tabIndex:0,className:m("neba-hit absolute inset-y-0 z-1 w-2 cursor-col-resize touch-none","start"===ee?"end-0 -me-1":"start-0 -ms-1","bg-transparent hover:bg-(--n-soft) data-[dragging]:bg-(--n-soft)",y,"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-0"),onPointerDown:e=>{const t=me.current;if(!t||0!==e.button)return;const r=e.currentTarget,n=e.clientX,o=t.offsetWidth,a=l(t).x,i="rtl"===getComputedStyle(t).direction,c="start"===ee===i?-1:1;let u=o;ve.current=s({target:r,pointerId:e.pointerId,onMove:e=>{u=xe(o+(e.clientX-n)/a*c),B?.(u)},onEnd:()=>{ve.current=null,C?.(u)}})},onKeyDown:e=>{if("ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.preventDefault();const t="rtl"===getComputedStyle(e.currentTarget).direction,r="start"===ee===t?-1:1;(e=>{const t=me.current;if(!t)return;const r=xe(t.offsetWidth+e);B?.(r),C?.(r)})(("ArrowRight"===e.key?16:-16)*r)}}):null]})});
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as a from"react";import{Slider as r}from"@base-ui/react/slider";import{cx as n,hasContent as s,metaTextClasses as i,surfaceClasses as t,transitionClasses as o}from"../../internal/styles.js";import{WidthSizer as d}from"../../internal/sizer.js";import{useStyleDefaults as c}from"../../internal/defaults.js";const b={xs:"h-1",sm:"h-1.5",md:"h-1.5",lg:"h-2",xl:"h-2.5"},u={xs:"w-1",sm:"w-1.5",md:"w-1.5",lg:"w-2",xl:"w-2.5"},f={xs:"size-3",sm:"size-3.5",md:"size-4",lg:"size-5",xl:"size-6"},m={xs:"h-4",sm:"h-4.5",md:"h-5",lg:"h-6",xl:"h-7"},h={xs:"w-4",sm:"w-4.5",md:"w-5",lg:"w-6",xl:"w-7"},g=`neba-slider-indicator rounded-full bg-(--n-fill) ${o}`,x=["neba-slider-thumb rounded-full border bg-(--neba-surface)",t,"[border-color:var(--n-line-hover)]","[box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]","cursor-grab select-none active:cursor-grabbing",o,"hover:[box-shadow:var(--neba-shadow-2),0_0_0_4px_var(--n-soft)]","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2","data-[dragging]:[box-shadow:var(--neba-shadow-1),0_0_0_6px_var(--n-soft-hover)]"].join(" "),v=["neba-slider-thumb rounded-full border bg-(--neba-surface)",t,"[border-color:var(--neba-disabled-border)] shadow-none"].join(" ");function p(e,l,a,r){const n=(e.value-l)/(a-l)*100;return r?{insetBlockEnd:`${n}%`}:{insetInlineStart:`${n}%`}}export const Slider=/*@__PURE__*/a.forwardRef(function Slider(t,o){const{size:w="md",color:N="primary",orientation:$="horizontal",label:y,description:_,showValue:j=!1,marks:z=!1,disabled:A=!1,classNames:k,min:V=0,max:S=100,step:T=1,getAriaLabel:I,getAriaValueText:L,className:B,style:M,"aria-label":R,"aria-labelledby":C,"aria-describedby":E,...q}=c(t,["size"]),D="vertical"===$,F=a.useId(),G=[E,s(_)?F:void 0].filter(Boolean).join(" ")||void 0,H=a.useMemo(()=>!0===z?function(e,l,a){const r=l-e;if(!(a>0)||!(r>0)||r/a>100)return[];const n=Math.floor(r/a+1e-9);return Array.from({length:n+1},(l,r)=>({value:e+r*a}))}(V,S,T):!1===z?[]:[...z],[z,V,S,T]),J={"--n-fill":`var(--neba-${N}-fill)`,"--n-accent":`var(--neba-${N}-accent)`,"--n-soft":`var(--neba-${N}-soft)`,"--n-soft-hover":`var(--neba-${N}-soft-hover)`,"--n-line-hover":`var(--neba-${N}-line-hover)`,"--n-ring":`var(--neba-${N}-ring)`},K=q.value??q.defaultValue,O=Array.isArray(K)?K.length:1,P=e(r.Control,{className:n("flex touch-none select-none items-center justify-center",D?`${h[w]} h-full flex-col`:`w-full ${m[w]}`,k?.control),children:l(r.Track,{className:n(A?"neba-slider-rail rounded-full bg-(--neba-disabled-bg)":"neba-slider-rail rounded-full bg-(--n-soft)",D?`${u[w]} h-full`:`${b[w]} w-full`,k?.track),children:[e(r.Indicator,{className:n(A?"neba-slider-indicator rounded-full bg-(--neba-disabled-fg)":g,k?.indicator)}),Array.from({length:O},(l,a)=>e(r.Thumb,{index:a,"aria-label":R,"aria-labelledby":C,"aria-describedby":G,getAriaLabel:I,getAriaValueText:L,className:n(A?v:x,f[w],k?.thumb)},a))]})}),Q=H.some(e=>s(e.label)),U=H.length>0?l("div",{"aria-hidden":"true",className:n("relative",i[w],D?"h-full ps-3":Q?"h-[calc(1lh+0.375rem)] w-full":"h-1.5 w-full"),children:[H.map((a,r)=>l("span",{className:n("absolute flex text-(--neba-muted-fg)",D?"start-0 h-0 items-center gap-1.5":"top-0 w-0 flex-col items-center",k?.mark),style:p(a,V,S,D),children:[e("span",{className:n("shrink-0 rounded-full bg-(--neba-border)",D?"h-px w-1.5":"h-1.5 w-px")}),s(a.label)?e("span",{className:"whitespace-nowrap",children:a.label}):null]},`${a.value}:${r}`)),D?e(d,{samples:H.filter(e=>s(e.label)).map(e=>e.label)}):null]}):null;return l(r.Root,{ref:o,orientation:$,disabled:A,className:n("flex",D?"w-fit flex-col items-center gap-2":"w-full flex-col gap-1.5",A?"[&_*]:cursor-not-allowed":"",B??""),style:{...J,...M},min:V,max:S,step:T,...q,children:[y||j?l("div",{className:`flex w-full items-baseline gap-2 ${i[w]}`,children:[y?e(r.Label,{className:n("font-medium",A?"text-(--neba-disabled-fg)":"text-(--neba-fg)",k?.label),children:y}):null,j?e(r.Value,{className:"ms-auto tabular-nums text-(--neba-muted-fg)",children:"function"==typeof j?j:null}):null]}):null,D?l("div",{className:"flex h-40 items-stretch",children:[P,U]}):P,D?null:U,_?e("div",{id:F,className:n(i[w],"text-(--neba-muted-fg)",k?.description),children:_}):null]})});
1
+ "use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as a from"react";import{Slider as r}from"@base-ui/react/slider";import{cx as n,hasContent as s,metaTextClasses as i,surfaceClasses as t,transitionClasses as o}from"../../internal/styles.js";import{WidthSizer as d}from"../../internal/sizer.js";import{useStyleDefaults as c}from"../../internal/defaults.js";import{useIntlLocale as b}from"../../internal/media.js";const u={xs:"h-1",sm:"h-1.5",md:"h-1.5",lg:"h-2",xl:"h-2.5"},m={xs:"w-1",sm:"w-1.5",md:"w-1.5",lg:"w-2",xl:"w-2.5"},f={xs:"size-3",sm:"size-3.5",md:"size-4",lg:"size-5",xl:"size-6"},h={xs:"h-4",sm:"h-4.5",md:"h-5",lg:"h-6",xl:"h-7"},x={xs:"w-4",sm:"w-4.5",md:"w-5",lg:"w-6",xl:"w-7"},g=`neba-slider-indicator rounded-full bg-(--n-fill) ${o}`,v=["neba-slider-thumb rounded-full border bg-(--neba-surface)",t,"[border-color:var(--n-line-hover)]","[box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]","cursor-grab select-none active:cursor-grabbing",o,"hover:[box-shadow:var(--neba-shadow-2),0_0_0_4px_var(--n-soft)]","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2","data-[dragging]:[box-shadow:var(--neba-shadow-1),0_0_0_6px_var(--n-soft-hover)]"].join(" "),p=["neba-slider-thumb rounded-full border bg-(--neba-surface)",t,"[border-color:var(--neba-disabled-border)] shadow-none"].join(" ");function w(e,l,a,r){const n=(e.value-l)/(a-l)*100;return r?{insetBlockEnd:`${n}%`}:{insetInlineStart:`${n}%`}}function N(e,l,a){return e.value<=l?"min":e.value>=a?"max":"between"}const $={min:["items-start","items-end"],max:["items-end","items-start"],between:["items-center","items-center"]};export const Slider=/*@__PURE__*/a.forwardRef(function Slider(t,o){const{size:y="md",color:j="primary",orientation:_="horizontal",label:z,description:A,showValue:k=!1,marks:V=!1,disabled:S=!1,classNames:T,min:I=0,max:L=100,step:B=1,getAriaLabel:M,getAriaValueText:R,className:C,style:E,"aria-label":q,"aria-labelledby":D,"aria-describedby":F,locale:G,...H}=c(t,["size","locale"]),J=b(void 0),K="vertical"===_,O=a.useId(),P=[F,s(A)?O:void 0].filter(Boolean).join(" ")||void 0,Q=a.useMemo(()=>!0===V?function(e,l,a){const r=l-e;if(!(a>0)||!(r>0)||r/a>100)return[];const n=Math.floor(r/a+1e-9);return Array.from({length:n+1},(l,r)=>({value:e+r*a}))}(I,L,B):!1===V?[]:[...V],[V,I,L,B]),U={"--n-fill":`var(--neba-${j}-fill)`,"--n-accent":`var(--neba-${j}-accent)`,"--n-soft":`var(--neba-${j}-soft)`,"--n-soft-hover":`var(--neba-${j}-soft-hover)`,"--n-line-hover":`var(--neba-${j}-line-hover)`,"--n-ring":`var(--neba-${j}-ring)`},W=H.value??H.defaultValue,X=Array.isArray(W)?W.length:1,Y=e(r.Control,{className:n("flex touch-none select-none items-center justify-center",K?`${x[y]} h-full flex-col`:`w-full ${h[y]}`,T?.control),children:l(r.Track,{className:n(S?"neba-slider-rail rounded-full bg-(--neba-disabled-bg)":"neba-slider-rail rounded-full bg-(--n-soft)",K?`${m[y]} h-full`:`${u[y]} w-full`,T?.track),children:[e(r.Indicator,{className:n(S?"neba-slider-indicator rounded-full bg-(--neba-disabled-fg)":g,T?.indicator)}),Array.from({length:X},(l,a)=>e(r.Thumb,{index:a,"aria-label":q,"aria-labelledby":D,"aria-describedby":P,getAriaLabel:M,getAriaValueText:R,className:n(S?p:v,f[y],T?.thumb)},a))]})}),Z=Q.some(e=>s(e.label)),ee=Q.length>0?l("div",{"aria-hidden":"true",className:n("relative",i[y],K?"h-full ps-3":Z?"h-[calc(1lh+0.375rem)] w-full":"h-1.5 w-full"),children:[Q.map((a,r)=>l("span",{className:n("absolute flex text-(--neba-muted-fg)",K?"start-0 h-0 gap-1.5":"top-0 w-0 flex-col",$[N(a,I,L)][K?1:0],T?.mark),style:w(a,I,L,K),children:[e("span",{className:n("shrink-0 rounded-full bg-(--neba-border)",K?"h-px w-1.5":"h-1.5 w-px")}),s(a.label)?e("span",{className:"whitespace-nowrap",children:a.label}):null]},`${a.value}:${r}`)),K?e(d,{samples:Q.filter(e=>s(e.label)).map(e=>e.label)}):null]}):null;return l(r.Root,{ref:o,locale:G??J,orientation:_,disabled:S,className:n("flex",K?"w-fit flex-col items-center gap-2":"w-full flex-col gap-1.5",S?"[&_*]:cursor-not-allowed":"",C??""),style:{...U,...E},min:I,max:L,step:B,...H,children:[z||k?l("div",{className:`flex w-full items-baseline gap-2 ${i[y]}`,children:[z?e(r.Label,{className:n("font-medium",S?"text-(--neba-disabled-fg)":"text-(--neba-fg)",T?.label),children:z}):null,k?e(r.Value,{className:"ms-auto tabular-nums text-(--neba-muted-fg)",children:"function"==typeof k?k:null}):null]}):null,K?l("div",{className:"flex h-40 items-stretch",children:[Y,ee]}):Y,K?null:ee,A?e("div",{id:O,className:n(i[y],"text-(--neba-muted-fg)",T?.description),children:A}):null]})});
@@ -48,6 +48,17 @@ export interface SourcesProps extends Pick<NebaStyleProps, 'size' | 'variant' |
48
48
  defaultOpen?: boolean;
49
49
  /** Called when the heading opens or closes the list. */
50
50
  onOpenChange?: (open: boolean) => void;
51
+ /**
52
+ * Keeps a folded list in the DOM, hidden until the browser's own page search
53
+ * finds something in it and opens it.
54
+ *
55
+ * On by default, as on a [Collapsible](../surfaces/collapsible): a list that
56
+ * is not in the markup is not in a server render either, and a crawler reads
57
+ * the server render without opening anything. Turn it off to leave a folded
58
+ * list out of the DOM.
59
+ * @default true
60
+ */
61
+ hiddenUntilFound?: boolean;
51
62
  /**
52
63
  * Numbers the rows, so a citation in the body has something to point at.
53
64
  * @default true
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as l from"react";import{Collapsible as s}from"@base-ui/react/collapsible";import{boxPaddingXClasses as t,boxPaddingYClasses as a}from"../box/Box.js";import{ChevronIcon as i}from"../../internal/icons.js";import{TextLink as r}from"../text-link/TextLink.js";import{safeHref as o,safeRel as m}from"../../internal/link.js";import{sourcesMessages as c,useMessages as d}from"../../internal/i18n.js";import{citationMarkClasses as f,collapsiblePanelClasses as p,cx as u,gapClasses as x,hasContent as b,iconClasses as h,metaTextClasses as g,radiusClasses as v,sheetBodyClasses as N,sheetTitleClasses as j,surfaceClasses as w,surfaceSlots as y,transitionClasses as z,disclosureChevronClasses as k,disclosureTriggerClasses as _}from"../../internal/styles.js";import{useStyleDefaults as C}from"../../internal/defaults.js";const O={solid:[w,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[w,"border text-(--neba-fg) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--neba-fg) bg-transparent"},S={xs:"size-3.5",sm:"size-4",md:"size-4.5",lg:"size-5",xl:"size-6"};export const Sources=/*@__PURE__*/l.forwardRef(function Sources(w,$){const{variant:R="text",size:T="md",color:B="primary",density:L="default",elevation:P=0,items:q,title:A,collapsible:D=!0,open:E,defaultOpen:F=!1,onOpenChange:G,numbered:H=!0,locale:I,labels:J,classNames:K,className:M,style:Q,...U}=C(w,["size","density","variant","locale"]),V={...d(c,I),...J},[W,X]=l.useState(F),Y=void 0!==E,Z=Y?E:W,ee=t[L][T],ne=a[L][T],le=b(A)?A:V.title,se=e("ol",{role:"list",className:u("m-0 flex list-none flex-col gap-2 p-0",ee,"compact"===L?"pb-2":"pb-4",N[T],K?.list??""),children:q.map((l,s)=>{const t=l.index??s+1,a=o(l.href),i=n("span",{className:"min-w-0 font-medium",children:[l.title,b(l.site)?e("span",{className:u("ms-2 font-normal text-(--neba-muted-fg)",g[T]),children:l.site}):null]});return n("li",{className:u("flex min-w-0 items-baseline gap-2",K?.item??""),children:[H?e("span",{"aria-hidden":"true",className:f,children:t}):null,b(l.icon)?e("span",{className:u("inline-flex shrink-0 items-center justify-center self-center overflow-hidden","rounded-[0.25rem] [&_img]:size-full [&_img]:object-cover",S[T]),children:l.icon}):null,n("span",{className:"flex min-w-0 flex-col gap-0.5",children:[a?e(r,{href:a,underline:"hover",target:l.target,rel:m(l.target,l.rel),locale:I,className:"min-w-0",children:i}):i,b(l.description)?e("span",{className:u("min-w-0 text-(--neba-muted-fg)",g[T]),children:l.description}):null]})]},`${t}-${a??s}`)})}),te=u("flex flex-col overflow-hidden",v[T],O[R],z,h,M??""),ae={...y(B,P),...Q};return D?n(s.Root,{ref:$,open:Z,onOpenChange:e=>{Y||X(e),G?.(e)},className:te,style:ae,...U,children:[n(s.Trigger,{className:u("flex w-full cursor-pointer items-center text-start font-semibold text-(--neba-fg)",_,ee,ne,x[T],j[T],z,"hover:bg-(--n-soft)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]",K?.header??""),children:[e("span",{className:"min-w-0 truncate",children:le}),e("span",{className:"shrink-0 font-normal text-(--neba-muted-fg) tabular-nums",children:q.length}),e("span",{className:`${k} ms-auto text-(--neba-muted-fg)`,children:e(i,{})})]}),e(s.Panel,{className:p,children:se})]}):n("div",{ref:$,className:te,style:ae,...U,children:[n("div",{className:u("flex items-center font-semibold text-(--neba-fg)",ee,ne,x[T],j[T],K?.header??""),children:[le,e("span",{className:"text-(--neba-muted-fg) tabular-nums",children:q.length})]}),se]})});
1
+ "use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as l from"react";import{Collapsible as s}from"@base-ui/react/collapsible";import{boxPaddingXClasses as t,boxPaddingYClasses as a}from"../box/Box.js";import{ChevronIcon as i}from"../../internal/icons.js";import{TextLink as r}from"../text-link/TextLink.js";import{safeHref as o,safeRel as m}from"../../internal/link.js";import{sourcesMessages as c,useMessages as d}from"../../internal/i18n.js";import{citationMarkClasses as f,collapsiblePanelClasses as p,cx as u,gapClasses as h,hasContent as x,iconClasses as b,metaTextClasses as g,radiusClasses as v,sheetBodyClasses as N,sheetTitleClasses as j,surfaceClasses as w,surfaceSlots as y,transitionClasses as z,disclosureChevronClasses as k,disclosureTriggerClasses as _}from"../../internal/styles.js";import{useStyleDefaults as C}from"../../internal/defaults.js";const O={solid:[w,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[w,"border text-(--neba-fg) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--neba-fg) bg-transparent"},S={xs:"size-3.5",sm:"size-4",md:"size-4.5",lg:"size-5",xl:"size-6"};export const Sources=/*@__PURE__*/l.forwardRef(function Sources(w,$){const{variant:F="text",size:R="md",color:T="primary",density:U="default",elevation:B=0,items:L,title:P,collapsible:q=!0,open:A,defaultOpen:D=!1,onOpenChange:E,hiddenUntilFound:G=!0,numbered:H=!0,locale:I,labels:J,classNames:K,className:M,style:Q,...V}=C(w,["size","density","variant","locale"]),W={...d(c,I),...J},[X,Y]=l.useState(D),Z=void 0!==A,ee=Z?A:X,ne=t[U][R],le=a[U][R],se=x(P)?P:W.title,te=e("ol",{role:"list",className:u("m-0 flex list-none flex-col gap-2 p-0",ne,"compact"===U?"pb-2":"pb-4",N[R],K?.list??""),children:L.map((l,s)=>{const t=l.index??s+1,a=o(l.href),i=n("span",{className:"min-w-0 font-medium",children:[l.title,x(l.site)?e("span",{className:u("ms-2 font-normal text-(--neba-muted-fg)",g[R]),children:l.site}):null]});return n("li",{className:u("flex min-w-0 items-baseline gap-2",K?.item??""),children:[H?e("span",{"aria-hidden":"true",className:f,children:t}):null,x(l.icon)?e("span",{className:u("inline-flex shrink-0 items-center justify-center self-center overflow-hidden","rounded-[0.25rem] [&_img]:size-full [&_img]:object-cover",S[R]),children:l.icon}):null,n("span",{className:"flex min-w-0 flex-col gap-0.5",children:[a?e(r,{href:a,underline:"hover",target:l.target,rel:m(l.target,l.rel),locale:I,className:"min-w-0",children:i}):i,x(l.description)?e("span",{className:u("min-w-0 text-(--neba-muted-fg)",g[R]),children:l.description}):null]})]},`${t}-${a??s}`)})}),ae=u("flex flex-col overflow-hidden",v[R],O[F],z,b,M??""),ie={...y(T,B),...Q};return q?n(s.Root,{ref:$,open:ee,onOpenChange:e=>{Z||Y(e),E?.(e)},className:ae,style:ie,...V,children:[n(s.Trigger,{className:u("flex w-full cursor-pointer items-center text-start font-semibold text-(--neba-fg)",_,ne,le,h[R],j[R],z,"hover:bg-(--n-soft)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]",K?.header??""),children:[e("span",{className:"min-w-0 truncate",children:se}),e("span",{className:"shrink-0 font-normal text-(--neba-muted-fg) tabular-nums",children:L.length}),e("span",{className:`${k} ms-auto text-(--neba-muted-fg)`,children:e(i,{})})]}),e(s.Panel,{hiddenUntilFound:G,className:p,children:te})]}):n("div",{ref:$,className:ae,style:ie,...V,children:[n("div",{className:u("flex items-center font-semibold text-(--neba-fg)",ne,le,h[R],j[R],K?.header??""),children:[se,e("span",{className:"text-(--neba-muted-fg) tabular-nums",children:L.length})]}),te]})});
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as r from"react";import{Button as t}from"../button/Button.js";import{spoilerMessages as i,useMessages as a}from"../../internal/i18n.js";import{boxPaddingClasses as o,boxPaddingXClasses as l,boxPaddingYClasses as s}from"../box/Box.js";import{cx as d,hasContent as c,metaTextClasses as u,radiusClasses as m,surfaceClasses as f,surfaceSlots as v,transitionClasses as p}from"../../internal/styles.js";import{inertValue as b}from"../../internal/inert.js";import{useStyleDefaults as x}from"../../internal/defaults.js";const h={solid:[f,"bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[f,"border bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"bg-transparent"};export const Spoiler=/*@__PURE__*/r.forwardRef(function Spoiler(f,g){const{revealed:y,defaultRevealed:j=!1,onRevealedChange:w,locale:R,label:N,hideLabel:z,description:C,action:S,reversible:k=!1,maxHeight:E,blur:_=10,padded:H=!0,variant:L="outline",size:T="md",color:A="primary",density:B="default",elevation:I=0,className:$,style:q,children:M,...D}=x(f,["size","density","variant","locale"]),F=a(i,R),G=r.useId(),[J,K]=r.useState(j),O=y??J,P=e=>{void 0===y&&K(e),w?.(e)},Q=!1===C?null:C??F.notice,U=r.useRef(null),V=r.useRef(null);return r.useLayoutEffect(()=>{const e=U.current?.parentElement,n=document.activeElement;if(!(e&&n instanceof HTMLElement&&e.contains(n)))return;if(!n.closest("[inert]"))return;const r=O?U.current:V.current?.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');r?.focus({preventScroll:!0})},[O]),n("div",{ref:g,className:d("isolate grid overflow-hidden",m[T],h[L],p,$??""),style:{gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:k?"auto auto":"auto",...v(A,I),...q},...D,children:[e("div",{ref:U,id:G,tabIndex:-1,className:d("min-w-0 [outline:none]",H?o[B][T]:"","[transition:filter_var(--neba-duration-fill)_var(--neba-ease)]","motion-reduce:[transition-duration:0ms]",O?"":"select-none"),style:{gridArea:"1 / 1",filter:O?void 0:`blur(${_}px)`,maxHeight:O?void 0:E,overflow:O?void 0:"hidden"},inert:b(!O),children:M}),k?e("div",{className:[O?"":"invisible","flex justify-end",l[B][T],s[B][T],"pt-0"].join(" "),style:{gridArea:"2 / 1"},inert:b(!O),children:e(t,{variant:"text",size:T,color:A,density:B,onClick:()=>P(!1),"aria-expanded":!0,"aria-controls":G,children:z??F.hide})}):null,n("div",{ref:V,className:d("z-10 flex flex-col items-center justify-center gap-2 text-center",o[B][T],O?"invisible":"[background-color:color-mix(in_oklab,var(--neba-surface)_55%,transparent)]"),style:{gridRow:"1 / -1",gridColumn:"1"},inert:b(O),children:[c(Q)?e("p",{className:`m-0 text-(--neba-muted-fg) ${u[T]}`,children:Q}):null,S??e(t,{size:T,color:A,density:B,onClick:()=>P(!0),"aria-expanded":!1,"aria-controls":G,children:N??F.reveal})]})]})});
1
+ "use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as n from"react";import{useLayoutEffectOnClient as t}from"../../internal/layout-effect.js";import{Button as i}from"../button/Button.js";import{spoilerMessages as a,useMessages as o}from"../../internal/i18n.js";import{boxPaddingClasses as l,boxPaddingXClasses as s,boxPaddingYClasses as d}from"../box/Box.js";import{cx as c,hasContent as u,metaTextClasses as m,radiusClasses as f,surfaceClasses as v,surfaceSlots as p,transitionClasses as b}from"../../internal/styles.js";import{inertValue as x}from"../../internal/inert.js";import{useStyleDefaults as h}from"../../internal/defaults.js";const g={solid:[v,"bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[v,"border bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"bg-transparent"};export const Spoiler=/*@__PURE__*/n.forwardRef(function Spoiler(v,j){const{revealed:y,defaultRevealed:w=!1,onRevealedChange:R,locale:N,label:z,hideLabel:C,description:S,action:k,reversible:_=!1,maxHeight:E,blur:H=10,padded:T=!0,variant:A="outline",size:B="md",color:I="primary",density:L="default",elevation:$=0,className:q,style:M,children:D,...F}=h(v,["size","density","variant","locale"]),G=o(a,N),J=n.useId(),[K,O]=n.useState(w),P=y??K,Q=e=>{void 0===y&&O(e),R?.(e)},U=!1===S?null:S??G.notice,V=n.useRef(null),W=n.useRef(null);return t(()=>{const e=V.current?.parentElement,r=document.activeElement;if(!(e&&r instanceof HTMLElement&&e.contains(r)))return;if(!r.closest("[inert]"))return;const n=P?V.current:W.current?.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');n?.focus({preventScroll:!0})},[P]),r("div",{ref:j,className:c("isolate grid overflow-hidden",f[B],g[A],b,q??""),style:{gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:_?"auto auto":"auto",...p(I,$),...M},...F,children:[e("div",{ref:V,id:J,tabIndex:-1,className:c("min-w-0 [outline:none]",T?l[L][B]:"","[transition:filter_var(--neba-duration-fill)_var(--neba-ease)]","motion-reduce:[transition-duration:0ms]",P?"":"select-none"),style:{gridArea:"1 / 1",filter:P?void 0:`blur(${H}px)`,maxHeight:P?void 0:E,overflow:P?void 0:"hidden"},inert:x(!P),children:D}),_?e("div",{className:[P?"":"invisible","flex justify-end",s[L][B],d[L][B],"pt-0"].join(" "),style:{gridArea:"2 / 1"},inert:x(!P),children:e(i,{variant:"text",size:B,color:I,density:L,onClick:()=>Q(!1),"aria-expanded":!0,"aria-controls":J,children:C??G.hide})}):null,r("div",{ref:W,className:c("z-10 flex flex-col items-center justify-center gap-2 text-center",l[L][B],P?"invisible":"[background-color:color-mix(in_oklab,var(--neba-surface)_55%,transparent)]"),style:{gridRow:"1 / -1",gridColumn:"1"},inert:x(P),children:[u(U)?e("p",{className:`m-0 text-(--neba-muted-fg) ${m[B]}`,children:U}):null,k??e(i,{size:B,color:I,density:L,onClick:()=>Q(!0),"aria-expanded":!1,"aria-controls":J,children:z??G.reveal})]})]})});
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as l from"react";import{Box as n}from"../box/Box.js";import{Chip as a}from"../chip/Chip.js";import{MinusIcon as s,TrendDownIcon as r,TrendUpIcon as i}from"../../internal/icons.js";import{numberFormatter as m}from"../../internal/format.js";import{cx as o,hasContent as u,metaTextClasses as c,sheetSectionGapClasses as d}from"../../internal/styles.js";import{useStyleDefaults as f}from"../../internal/defaults.js";const x={xs:"text-[1.125rem]/[1.375rem]",sm:"text-[1.375rem]/[1.625rem]",md:"text-[1.75rem]/[2rem]",lg:"text-[2.25rem]/[2.5rem]",xl:"text-[2.875rem]/[3.25rem]"},p={xs:"text-[0.75rem]",sm:"text-[0.875rem]",md:"text-[1rem]",lg:"text-[1.25rem]",xl:"text-[1.5rem]"},b={xs:"gap-y-0.5",sm:"gap-y-0.5",md:"gap-y-1",lg:"gap-y-1",xl:"gap-y-1.5"},h={start:"items-start text-start",center:"items-center text-center",end:"items-end text-end"},g={up:e(i,{}),down:e(r,{}),flat:e(s,{})};export const Statistic=/*@__PURE__*/l.forwardRef(function Statistic(l,s){const{size:r="md",color:i="primary",density:N="default",label:w,value:y,format:j,locale:v,prefix:$,unit:M,icon:z,previousValue:F,delta:k="percent",betterWhen:B="up",caption:D,align:S="start",className:C,children:I,...O}=f(l,["size","density","locale"]),R="number"==typeof y?y:null,V=null===R?y:m(v,j).format(R),W=null!==R&&Number.isFinite(R)&&void 0!==F&&Number.isFinite(F)?R-F:null,q=null!==W&&0!==F&&void 0!==F?W/Math.abs(F):null,A=m(v,j),E="absolute"!==k&&null!==q,G=E?3:A.resolvedOptions().maximumFractionDigits??0,H=E?q:W,J=null===H||0===Math.round(Math.abs(H)*10**G)?0:Math.sign(H),K=null===W?null:J>0?"up":J<0?"down":"flat";let L=null;if(null!==W&&null!==K&&"none"!==k){const e="up"===K?"+":"down"===K?"-":"",t=`${e}${A.format(Math.abs(W))}`,l=null===q?null:`${e}${m(v,{style:"percent",maximumFractionDigits:1}).format(Math.abs(q))}`;L="absolute"===k?t:"both"===k?[l,t].filter(Boolean).join(" · "):l??t}const P=null===K||"flat"===K?"secondary":K===B?"success":"danger",Q=null!==L||u(D);return t(n,{ref:s,size:r,color:i,density:N,className:o("flex flex-col",d[r],h[S],C??""),...O,children:[u(w)||u(z)?t("div",{className:["flex min-w-0 items-center gap-1.5 font-medium text-(--neba-muted-fg)",c[r]].join(" "),children:[u(z)?e("span",{className:"flex shrink-0 items-center",children:z}):null,u(w)?e("span",{className:"min-w-0 truncate",children:w}):null]}):null,t("div",{className:["flex min-w-0 flex-wrap items-baseline gap-1 font-semibold text-(--neba-fg) tabular-nums",x[r]].join(" "),children:[u($)?e("span",{className:`font-medium text-(--neba-muted-fg) ${p[r]}`,children:$}):null,e("span",{className:"min-w-0 break-words",children:V}),u(M)?e("span",{className:`font-medium text-(--neba-muted-fg) ${p[r]}`,children:M}):null]}),Q?t("div",{className:`flex min-w-0 flex-wrap items-center gap-x-2 ${b[r]}`,children:[null!==L&&null!==K?e(a,{size:r,variant:"text",color:P,startIcon:g[K],className:"tabular-nums",children:L}):null,u(D)?e("span",{className:`min-w-0 text-(--neba-muted-fg) ${c[r]}`,children:D}):null]}):null,I]})});
1
+ "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as l from"react";import{Box as n}from"../box/Box.js";import{Chip as a}from"../chip/Chip.js";import{MinusIcon as s,TrendDownIcon as r,TrendUpIcon as i}from"../../internal/icons.js";import{numberFormatter as m}from"../../internal/format.js";import{cx as o,hasContent as u,metaTextClasses as c,sheetSectionGapClasses as d}from"../../internal/styles.js";import{useStyleDefaults as f}from"../../internal/defaults.js";import{useIntlLocale as x}from"../../internal/media.js";const p={xs:"text-[1.125rem]/[1.375rem]",sm:"text-[1.375rem]/[1.625rem]",md:"text-[1.75rem]/[2rem]",lg:"text-[2.25rem]/[2.5rem]",xl:"text-[2.875rem]/[3.25rem]"},b={xs:"text-[0.75rem]",sm:"text-[0.875rem]",md:"text-[1rem]",lg:"text-[1.25rem]",xl:"text-[1.5rem]"},h={xs:"gap-y-0.5",sm:"gap-y-0.5",md:"gap-y-1",lg:"gap-y-1",xl:"gap-y-1.5"},g={start:"items-start text-start",center:"items-center text-center",end:"items-end text-end"},N={up:e(i,{}),down:e(r,{}),flat:e(s,{})};export const Statistic=/*@__PURE__*/l.forwardRef(function Statistic(l,s){const{size:r="md",color:i="primary",density:j="default",label:w,value:y,format:v,locale:$,prefix:M,unit:z,icon:F,previousValue:k,delta:B="percent",betterWhen:D="up",caption:S,align:C="start",className:I,children:O,...R}=f(l,["size","density","locale"]),V=x($),W="number"==typeof y?y:null,q=null===W?y:m(V,v).format(W),A=null!==W&&Number.isFinite(W)&&void 0!==k&&Number.isFinite(k)?W-k:null,E=null!==A&&0!==k&&void 0!==k?A/Math.abs(k):null,G=m(V,v),H="absolute"!==B&&null!==E,J=H?3:G.resolvedOptions().maximumFractionDigits??0,K=H?E:A,L=null===K||0===Math.round(Math.abs(K)*10**J)?0:Math.sign(K),P=null===A?null:L>0?"up":L<0?"down":"flat";let Q=null;if(null!==A&&null!==P&&"none"!==B){const e="up"===P?"+":"down"===P?"-":"",t=`${e}${G.format(Math.abs(A))}`,l=null===E?null:`${e}${m(V,{style:"percent",maximumFractionDigits:1}).format(Math.abs(E))}`;Q="absolute"===B?t:"both"===B?[l,t].filter(Boolean).join(" · "):l??t}const T=null===P||"flat"===P?"secondary":P===D?"success":"danger",U=null!==Q||u(S);return t(n,{ref:s,size:r,color:i,density:j,className:o("flex flex-col",d[r],g[C],I??""),...R,children:[u(w)||u(F)?t("div",{className:["flex min-w-0 items-center gap-1.5 font-medium text-(--neba-muted-fg)",c[r]].join(" "),children:[u(F)?e("span",{className:"flex shrink-0 items-center",children:F}):null,u(w)?e("span",{className:"min-w-0 truncate",children:w}):null]}):null,t("div",{className:["flex min-w-0 flex-wrap items-baseline gap-1 font-semibold text-(--neba-fg) tabular-nums",p[r]].join(" "),children:[u(M)?e("span",{className:`font-medium text-(--neba-muted-fg) ${b[r]}`,children:M}):null,e("span",{className:"min-w-0 break-words",children:q}),u(z)?e("span",{className:`font-medium text-(--neba-muted-fg) ${b[r]}`,children:z}):null]}),U?t("div",{className:`flex min-w-0 flex-wrap items-center gap-x-2 ${h[r]}`,children:[null!==Q&&null!==P?e(a,{size:r,variant:"text",color:T,startIcon:N[P],className:"tabular-nums",children:Q}):null,u(S)?e("span",{className:`min-w-0 text-(--neba-muted-fg) ${c[r]}`,children:S}):null]}):null,O]})});
@@ -3,9 +3,10 @@ import { useRender } from '@base-ui/react/use-render';
3
3
  import type { NebaColor } from '../../types.js';
4
4
  export interface StreamingTextProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color'> {
5
5
  /**
6
- * The text so far. A **string** is what this is for: it is cut into words,
7
- * and each one fades in as it lands. Anything else is rendered untouched,
8
- * with the caret and the reserved height still around it.
6
+ * The text so far. A **string** is what this is for: what arrives while it
7
+ * streams is cut into words, and each one fades in as it lands. Anything else
8
+ * is rendered untouched, with the caret and the reserved height still around
9
+ * it.
9
10
  */
10
11
  children?: React.ReactNode;
11
12
  /**
@@ -23,10 +24,13 @@ export interface StreamingTextProps extends Omit<React.ComponentPropsWithoutRef<
23
24
  /**
24
25
  * Fades each word in as it arrives.
25
26
  *
26
- * On. It costs one element per word, which is the price of the effect: a
27
- * transition on the block as a whole would fade the *whole answer* every time
28
- * a token landed. Turn it off for a very long answer, or where the text is
29
- * being re-rendered from something other than a stream.
27
+ * On. A word that arrives during a stream costs one element, which is the
28
+ * price of the effect: a transition on the block as a whole would fade the
29
+ * *whole answer* every time a token landed. Text that did not arrive that
30
+ * way costs nothing — what the block was first drawn with while not
31
+ * streaming, what the server rendered, what was already there when a stream
32
+ * started, and what replaces it while nothing streams are drawn as plain
33
+ * text. Turn it off for a very long answer.
30
34
  * @default true
31
35
  */
32
36
  fade?: boolean;
@@ -61,10 +65,17 @@ export interface StreamingTextProps extends Omit<React.ComponentPropsWithoutRef<
61
65
  * is not a flourish: a transition on the block would replay the *entire* answer
62
66
  * every time a token landed.
63
67
  *
64
- * The fade needs no bookkeeping at all. Words are keyed by position, so a word
65
- * already on screen keeps its element and never animates again; only a new one
66
- * is a new element, and the last word grows a character at a time inside the
67
- * element it already has.
68
+ * Words are keyed by position, so a word already on screen keeps its element
69
+ * and never animates again; only a new one is a new element, and the last word
70
+ * grows a character at a time inside the element it already has. They are held
71
+ * in blocks of sixty-four, and a full block is never drawn again, so a token
72
+ * landing costs the last block rather than the whole answer.
73
+ *
74
+ * Only a stream is cut into words. Text the block is drawn with while nothing
75
+ * streams — a message loaded from history, a page rendered on the server — is
76
+ * one run of plain text, because none of it is arriving: fifty such messages
77
+ * drawn a word to an element were fifteen thousand elements, each with an
78
+ * animation to start.
68
79
  *
69
80
  * It is deliberately **not** a live region. An answer that announced itself
70
81
  * token by token would be unusable, and one that announced itself whole on
@@ -1 +1 @@
1
- "use client";import{jsx as r,Fragment as e,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{useRender as n}from"@base-ui/react/use-render";import{segmenter as s}from"../../internal/format.js";import{cx as i,hasContent as c}from"../../internal/styles.js";const l=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Thai}\p{Script=Lao}\p{Script=Khmer}\p{Script=Myanmar}]/u;export const StreamingText=/*@__PURE__*/t.forwardRef(function StreamingText({children:m,streaming:p=!1,cursor:o=!0,fade:d=!0,lines:u=1,color:f="primary",render:h,className:g,style:S,...v},x){const y="string"==typeof m?m:null,b=t.useMemo(()=>null!==y&&d?function(r){const e=r.split(/(\s+)/).filter(r=>""!==r),a=l.test(r)?s(void 0,"word"):null;return a?e.flatMap(r=>l.test(r)?[...a.segment(r)].map(r=>r.segment):[r]):e}(y):null,[y,d]),j=p&&!1!==o?!0===o?r("span",{"aria-hidden":"true",className:"neba-stream-caret"}):o:null;return n({render:h??r("div",{}),ref:x,props:{"aria-busy":p||void 0,"data-streaming":p||void 0,className:i("min-h-(--n-reserve) whitespace-pre-wrap",g),style:{"--n-reserve":`calc(${Math.max(u,0)} * 1lh)`,"--n-accent":`var(--neba-${f}-accent)`,...S},children:a(e,{children:[b?b.map((e,a)=>/\s/.test(e)?r(t.Fragment,{children:e},a):r("span",{className:"neba-stream-word",children:e},a)):m,c(j)?j:null]}),...v}})});
1
+ "use client";import{jsx as t,Fragment as e,jsxs as r}from"react/jsx-runtime";import*as n from"react";import{useRender as s}from"@base-ui/react/use-render";import{segmenter as a}from"../../internal/format.js";import{useLayoutEffectOnClient as i}from"../../internal/layout-effect.js";import{useHydrated as l}from"../../internal/media.js";import{cx as c,hasContent as o}from"../../internal/styles.js";const m=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Thai}\p{Script=Lao}\p{Script=Khmer}\p{Script=Myanmar}]/u;function u(t){const e=t.split(/(\s+)/).filter(t=>""!==t),r=m.test(t)?a(void 0,"word"):null;return r?e.flatMap(t=>m.test(t)?[...r.segment(t)].map(t=>t.segment):[t]):e}const p=/\s/;const f=/*@__PURE__*/n.memo(function StreamBlock({text:r,joined:s}){return t(e,{children:u(r).map((e,r)=>p.test(e)||s&&0===r?t(n.Fragment,{children:e},r):t("span",{className:"neba-stream-word",children:e},r))})});function d(t,e){if(e.startsWith(t))return t;let r=0;for(;r<t.length&&t[r]===e[r];)r+=1;for(;r>0&&!p.test(e[r-1]);)r-=1;return e.slice(0,r)}export const StreamingText=/*@__PURE__*/n.forwardRef(function StreamingText({children:a,streaming:h=!1,cursor:g=!0,fade:x=!0,lines:S=1,color:j="primary",render:v,className:y,style:b,...w},N){const M="string"==typeof a?a:null,R=M??"",T=l(),[W,k]=n.useState(()=>h?T?"":R:null),F=n.useRef(R),H=n.useRef({closed:"",texts:[]}),K=x?function(t,e,r,n){return null===t?r?d(n,e):null:e.startsWith(n)?t:r?d(t,e):null}(W,R,h,F.current):W;K!==W&&k(K),i(()=>{F.current=R});let $=a;if(null!==M&&x&&null!==K){const e=M.slice(K.length),r=function(t,e){let{closed:r,texts:n}=e.startsWith(t.closed)?t:{closed:"",texts:[]};const s=e.slice(r.length);let a=0,i=0,l=0;for(const t of u(s)){if(!p.test(t)){if(64===a){const t=s.slice(i,l);n=[...n,t],r+=t,i=l,a=0}a+=1}l+=t.length}return{closed:r,texts:n,tail:s.slice(i)}}(H.current,e),n=K.at(-1),s=e.at(0),a=void 0!==n&&void 0!==s&&!p.test(n)&&!p.test(s)&&!m.test(n+s);H.current=r,$=[K,...[...r.texts,r.tail].map((e,r)=>""===e?null:t(f,{text:e,joined:a&&0===r},r))]}const B=h&&!1!==g?!0===g?t("span",{"aria-hidden":"true",className:"neba-stream-caret"}):g:null;return s({render:v??t("div",{}),ref:N,props:{"aria-busy":h||void 0,"data-streaming":h||void 0,className:c("min-h-(--n-reserve) whitespace-pre-wrap",y),style:{"--n-reserve":`calc(${Math.max(S,0)} * 1lh)`,"--n-accent":`var(--neba-${j}-accent)`,...b},children:r(e,{children:[$,o(B)?B:null]}),...w}})});
@@ -105,6 +105,17 @@ export interface TabsProps extends Omit<NebaStyleProps, 'variant'>, Omit<React.C
105
105
  * @default 'center'
106
106
  */
107
107
  align?: NebaAlign;
108
+ /**
109
+ * Keeps every panel in the DOM while it is hidden, rather than only the one
110
+ * whose tab is chosen.
111
+ *
112
+ * A hidden panel that is not in the markup is not in a server render either,
113
+ * and a crawler reads the server render without pressing a single tab. Turn
114
+ * this on where what is behind the other tabs is content the page should be
115
+ * found by. A panel's own `keepMounted` still wins over it.
116
+ * @default false
117
+ */
118
+ keepMounted?: boolean;
108
119
  children?: React.ReactNode;
109
120
  }
110
121
  export interface TabProps extends Omit<React.ComponentPropsWithoutRef<'button'>, 'value' | 'color'> {
@@ -124,7 +135,7 @@ export interface TabPanelProps extends React.ComponentPropsWithoutRef<'div'> {
124
135
  /**
125
136
  * Keeps the panel in the DOM while it is hidden. For a panel that is expensive
126
137
  * to build, or that holds form state which should survive being switched away
127
- * from.
138
+ * from. Left out, it is whatever the Tabs around it says.
128
139
  * @default false
129
140
  */
130
141
  keepMounted?: boolean;
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{glowClasses as o,spotlightSlot as n,trackPointer as l}from"../../internal/glow.js";import{Tabs as i}from"@base-ui/react/tabs";import{controlHeightClasses as r,controlHeightValues as s,controlTextClasses as c,cx as d,gapClasses as f,hasContent as u,iconClasses as b,paddingXClasses as v,radiusClasses as h,surfaceClasses as p,surfaceSlots as m,transitionClasses as x}from"../../internal/styles.js";import{observeResize as g}from"../../internal/observe.js";import{bindAxisWheel as w}from"../../internal/wheel.js";import{useStyleDefaults as y}from"../../internal/defaults.js";const z=/*@__PURE__*/a.createContext({variant:"outline",size:"md",density:"default",orientation:"horizontal",fullWidth:!1,align:"center"}),j={solid:{horizontal:`${p} inline-flex bg-(--n-panel) p-1 [box-shadow:var(--neba-plate-glass)]`,vertical:`${p} inline-flex flex-col bg-(--n-panel) p-1 [box-shadow:var(--neba-plate-glass)]`},outline:{horizontal:"flex border-b [border-color:var(--n-line)]",vertical:"flex flex-col border-e [border-color:var(--n-line)]"},text:{horizontal:"flex",vertical:"flex flex-col"}},N={solid:{horizontal:"absolute left-(--active-tab-left) top-(--active-tab-top) h-(--active-tab-height) w-(--active-tab-width)",vertical:"absolute left-(--active-tab-left) top-(--active-tab-top) h-(--active-tab-height) w-(--active-tab-width)"},outline:{horizontal:"absolute bottom-0 left-(--active-tab-left) h-0.5 w-(--active-tab-width)",vertical:"absolute end-0 top-(--active-tab-top) h-(--active-tab-height) w-0.5"},text:{horizontal:"absolute bottom-0 left-(--active-tab-left) h-0.5 w-(--active-tab-width)",vertical:"absolute end-0 top-(--active-tab-top) h-(--active-tab-height) w-0.5"}},T={horizontal:"absolute left-(--active-tab-left) top-(--active-tab-top) h-(--active-tab-height) w-(--active-tab-width) border-b-2 [border-color:var(--n-accent)] !bg-transparent",vertical:"absolute left-(--active-tab-left) top-(--active-tab-top) h-(--active-tab-height) w-(--active-tab-width) border-e-2 [border-color:var(--n-accent)] !bg-transparent"},$={solid:`${p} bg-(--n-panel-press) [box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]`,outline:"bg-(--n-accent)",text:"bg-(--n-accent)"},k={start:"justify-start",center:"justify-center",end:"justify-end"},M={solid:"text-(--neba-muted-fg) hover:text-(--neba-fg) data-[active]:text-(--n-accent)",outline:"text-(--neba-muted-fg) hover:text-(--neba-fg) data-[active]:text-(--n-accent)",text:"text-(--neba-muted-fg) hover:text-(--neba-fg) data-[active]:text-(--n-accent)"};export const Tab=/*@__PURE__*/a.forwardRef(function Tab({value:s,startIcon:p,endIcon:m,disabled:g=!1,className:w,style:y,children:j,...N},T){const{variant:$,size:E,density:P,fullWidth:C,align:R}=a.useContext(z);return t(i.Tab,{ref:T,value:s,disabled:g,style:{...g?void 0:n,...y},className:d("relative z-10 inline-flex shrink-0 cursor-pointer items-center select-none","whitespace-nowrap font-medium",k[R],"[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",r[E],c[E],f[E],v[P][E],"solid"===$?h[E]:"",x,b,M[$],"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]","data-[disabled]:cursor-not-allowed data-[disabled]:text-(--neba-disabled-fg)",g?"":o,C?"flex-1":"",w??""),...N,onPointerMove:l(N.onPointerMove,!g),children:[u(p)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:p}):null,j,u(m)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:m}):null]})});export const TabPanel=/*@__PURE__*/a.forwardRef(function TabPanel({value:t,keepMounted:o=!1,className:n,children:l,...r},s){const{size:c}=a.useContext(z);return e(i.Panel,{ref:s,value:t,keepMounted:o,className:["min-w-0 flex-1 text-(--neba-fg)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2","data-[starting-style]:opacity-0","[transition:opacity_var(--neba-duration)_var(--neba-ease)]",h[c],n??""].filter(Boolean).join(" "),...r,children:l})});export const Tabs=/*@__PURE__*/a.forwardRef(function Tabs(o,n){const{variant:l="outline",size:r="md",color:c="primary",density:f="default",value:u,defaultValue:b,onValueChange:v,orientation:p="horizontal",activateOnFocus:x=!1,loopFocus:k=!0,overflow:M="scroll",lines:E,wheel:P=!0,fullWidth:C=!1,align:R="center",className:V,style:W,children:_,...F}=y(o,["size","density","variant"]),A="horizontal"===p,L="wrap"===M,H=a.useRef(null),I=a.useRef(null),O=a.useMemo(()=>({variant:l,size:r,density:f,orientation:p,fullWidth:C,align:R}),[l,r,f,p,C,R]),B=[],q=[],D=e=>a.Children.forEach(e,e=>{a.isValidElement(e)&&e.type===a.Fragment?D(e.props.children):a.isValidElement(e)&&e.type===TabPanel?q.push(e):null!=e&&!1!==e&&B.push(e)});D(_);const G=B.length;return a.useEffect(()=>{const e=I.current,t=H.current;if(!e||!t)return;const a=()=>{const a=Math.abs(A?e.scrollLeft:e.scrollTop),o=A?e.clientWidth:e.clientHeight,n=A?e.scrollWidth:e.scrollHeight,l=A?"x":"y",i=A?"y":"x";t.toggleAttribute(`data-overflow-${l}-start`,a>1),t.toggleAttribute(`data-overflow-${l}-end`,n-o-a>1),t.removeAttribute(`data-overflow-${i}-start`),t.removeAttribute(`data-overflow-${i}-end`)};a(),e.addEventListener("scroll",a,{passive:!0});const o=g(e,a);return()=>{e.removeEventListener("scroll",a),o()}},[A,G]),a.useEffect(()=>{const e=I.current;if(e&&P)return w(e)},[P]),e(z.Provider,{value:O,children:t(i.Root,{ref:e=>{H.current=e,"function"==typeof n?n(e):n&&(n.current=e)},value:u,defaultValue:b,onValueChange:e=>v?.(e),orientation:p,className:d("flex min-w-0","vertical"===p?"flex-row gap-4":"flex-col gap-4",V??""),style:{...m(c,0),...W},...F,children:[t(i.List,{ref:I,activateOnFocus:x,loopFocus:k,className:d("relative shrink-0",j[l][p],"solid"===l?h[r]:"",C&&"horizontal"===p?"w-full":"",L?"flex-wrap":A?"overflow-x-auto":"overflow-y-auto",L&&void 0!==E?A?"overflow-y-auto":"overflow-x-auto":"",!L&&A?"overflow-y-hidden":"","overscroll-contain","[scrollbar-width:none] [&::-webkit-scrollbar]:hidden","neba-scroll-fade"),style:{"--n-fade":"2rem",maxHeight:L&&void 0!==E?`calc(${s[r]} * ${Math.max(1,Math.round(E))}${"solid"===l?" + 0.5rem":"outline"===l&&A?" + 1px":""})`:void 0},children:[B,e(i.Indicator,{className:["pointer-events-none",L&&"solid"!==l?T[p]:N[l][p],$[l],"solid"===l?h[r]:"rounded-full","[transition-property:left,top,width,height]","[transition-duration:var(--neba-duration)]","[transition-timing-function:var(--neba-ease)]"].join(" ")})]}),q]})})});
1
+ "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{glowClasses as o,spotlightSlot as n,trackPointer as i}from"../../internal/glow.js";import{Tabs as l}from"@base-ui/react/tabs";import{controlHeightClasses as r,controlHeightValues as s,controlTextClasses as c,cx as d,gapClasses as u,hasContent as f,iconClasses as b,paddingXClasses as v,radiusClasses as h,surfaceClasses as p,surfaceSlots as m,transitionClasses as x}from"../../internal/styles.js";import{observeResize as g}from"../../internal/observe.js";import{bindAxisWheel as w}from"../../internal/wheel.js";import{useStyleDefaults as y}from"../../internal/defaults.js";const z=/*@__PURE__*/a.createContext({variant:"outline",size:"md",density:"default",orientation:"horizontal",fullWidth:!1,align:"center",keepMounted:!1}),j={solid:{horizontal:`${p} inline-flex bg-(--n-panel) p-1 [box-shadow:var(--neba-plate-glass)]`,vertical:`${p} inline-flex flex-col bg-(--n-panel) p-1 [box-shadow:var(--neba-plate-glass)]`},outline:{horizontal:"flex border-b [border-color:var(--n-line)]",vertical:"flex flex-col border-e [border-color:var(--n-line)]"},text:{horizontal:"flex",vertical:"flex flex-col"}},k={solid:{horizontal:"absolute left-(--active-tab-left) top-(--active-tab-top) h-(--active-tab-height) w-(--active-tab-width)",vertical:"absolute left-(--active-tab-left) top-(--active-tab-top) h-(--active-tab-height) w-(--active-tab-width)"},outline:{horizontal:"absolute bottom-0 left-(--active-tab-left) h-0.5 w-(--active-tab-width)",vertical:"absolute end-0 top-(--active-tab-top) h-(--active-tab-height) w-0.5"},text:{horizontal:"absolute bottom-0 left-(--active-tab-left) h-0.5 w-(--active-tab-width)",vertical:"absolute end-0 top-(--active-tab-top) h-(--active-tab-height) w-0.5"}},M={horizontal:"absolute left-(--active-tab-left) top-(--active-tab-top) h-(--active-tab-height) w-(--active-tab-width) border-b-2 [border-color:var(--n-accent)] !bg-transparent",vertical:"absolute left-(--active-tab-left) top-(--active-tab-top) h-(--active-tab-height) w-(--active-tab-width) border-e-2 [border-color:var(--n-accent)] !bg-transparent"},N={solid:`${p} bg-(--n-panel-press) [box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]`,outline:"bg-(--n-accent)",text:"bg-(--n-accent)"},T={start:"justify-start",center:"justify-center",end:"justify-end"},$={solid:"text-(--neba-muted-fg) hover:text-(--neba-fg) data-[active]:text-(--n-accent)",outline:"text-(--neba-muted-fg) hover:text-(--neba-fg) data-[active]:text-(--n-accent)",text:"text-(--neba-muted-fg) hover:text-(--neba-fg) data-[active]:text-(--n-accent)"};export const Tab=/*@__PURE__*/a.forwardRef(function Tab({value:s,startIcon:p,endIcon:m,disabled:g=!1,className:w,style:y,children:j,...k},M){const{variant:N,size:E,density:P,fullWidth:C,align:R}=a.useContext(z);return t(l.Tab,{ref:M,value:s,disabled:g,style:{...g?void 0:n,...y},className:d("relative z-10 inline-flex shrink-0 cursor-pointer items-center select-none","whitespace-nowrap font-medium",T[R],"[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",r[E],c[E],u[E],v[P][E],"solid"===N?h[E]:"",x,b,$[N],"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]","data-[disabled]:cursor-not-allowed data-[disabled]:text-(--neba-disabled-fg)",g?"":o,C?"flex-1":"",w??""),...k,onPointerMove:i(k.onPointerMove,!g),children:[f(p)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:p}):null,j,f(m)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:m}):null]})});export const TabPanel=/*@__PURE__*/a.forwardRef(function TabPanel({value:t,keepMounted:o,className:n,children:i,...r},s){const{size:c,keepMounted:d}=a.useContext(z);return e(l.Panel,{ref:s,value:t,keepMounted:o??d,className:["min-w-0 flex-1 text-(--neba-fg)","[&[hidden]]:hidden","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2","data-[starting-style]:opacity-0","[transition:opacity_var(--neba-duration)_var(--neba-ease)]",h[c],n??""].filter(Boolean).join(" "),...r,children:i})});export const Tabs=/*@__PURE__*/a.forwardRef(function Tabs(o,n){const{variant:i="outline",size:r="md",color:c="primary",density:u="default",value:f,defaultValue:b,onValueChange:v,orientation:p="horizontal",activateOnFocus:x=!1,loopFocus:T=!0,overflow:$="scroll",lines:E,wheel:P=!0,fullWidth:C=!1,align:R="center",keepMounted:V=!1,className:W,style:_,children:F,...A}=y(o,["size","density","variant"]),L="horizontal"===p,H="wrap"===$,I=a.useRef(null),O=a.useRef(null),B=a.useMemo(()=>({variant:i,size:r,density:u,orientation:p,fullWidth:C,align:R,keepMounted:V}),[i,r,u,p,C,R,V]),q=[],D=[],G=e=>a.Children.forEach(e,e=>{a.isValidElement(e)&&e.type===a.Fragment?G(e.props.children):a.isValidElement(e)&&e.type===TabPanel?D.push(e):null!=e&&!1!==e&&q.push(e)});G(F);const J=q.length;return a.useEffect(()=>{const e=O.current,t=I.current;if(!e||!t)return;const a=()=>{const a=Math.abs(L?e.scrollLeft:e.scrollTop),o=L?e.clientWidth:e.clientHeight,n=L?e.scrollWidth:e.scrollHeight,i=L?"x":"y",l=L?"y":"x";t.toggleAttribute(`data-overflow-${i}-start`,a>1),t.toggleAttribute(`data-overflow-${i}-end`,n-o-a>1),t.removeAttribute(`data-overflow-${l}-start`),t.removeAttribute(`data-overflow-${l}-end`)};a(),e.addEventListener("scroll",a,{passive:!0});const o=g(e,a);return()=>{e.removeEventListener("scroll",a),o()}},[L,J]),a.useEffect(()=>{const e=O.current;if(e&&P)return w(e)},[P]),e(z.Provider,{value:B,children:t(l.Root,{ref:e=>{I.current=e,"function"==typeof n?n(e):n&&(n.current=e)},value:f,defaultValue:b,onValueChange:e=>v?.(e),orientation:p,className:d("flex min-w-0","vertical"===p?"flex-row gap-4":"flex-col gap-4",W??""),style:{...m(c,0),..._},...A,children:[t(l.List,{ref:O,activateOnFocus:x,loopFocus:T,className:d("relative shrink-0",j[i][p],"solid"===i?h[r]:"",C&&"horizontal"===p?"w-full":"",H?"flex-wrap":L?"overflow-x-auto":"overflow-y-auto",H&&void 0!==E?L?"overflow-y-auto":"overflow-x-auto":"",!H&&L?"overflow-y-hidden":"","overscroll-contain","[scrollbar-width:none] [&::-webkit-scrollbar]:hidden","neba-scroll-fade"),style:{"--n-fade":"2rem",maxHeight:H&&void 0!==E?`calc(${s[r]} * ${Math.max(1,Math.round(E))}${"solid"===i?" + 0.5rem":"outline"===i&&L?" + 1px":""})`:void 0},children:[q,e(l.Indicator,{className:["pointer-events-none",H&&"solid"!==i?M[p]:k[i][p],N[i],"solid"===i?h[r]:"rounded-full","[transition-property:left,top,width,height]","[transition-duration:var(--neba-duration)]","[transition-timing-function:var(--neba-ease)]"].join(" ")})]}),D]})})});
@@ -64,6 +64,13 @@ export interface TextLinkProps extends Omit<React.ComponentPropsWithoutRef<'a'>,
64
64
  * needs it written once, on the TextLink.
65
65
  */
66
66
  render?: useRender.RenderProp;
67
+ /**
68
+ * A Tailwind utility here wins over the link's own colour, weight and line —
69
+ * whether it is drawn, its thickness, its offset and its colour — with or
70
+ * without a variant. Only Tailwind's names are read: a class from your own
71
+ * stylesheet needs two classes or `!important`.
72
+ */
73
+ className?: string;
67
74
  /** The label. */
68
75
  children?: React.ReactNode;
69
76
  }
@@ -1 +1 @@
1
- "use client";import{jsx as n,jsxs as e,Fragment as r}from"react/jsx-runtime";import*as i from"react";import{useRender as a}from"@base-ui/react/use-render";import{linkMessages as t,useMessages as o}from"../../internal/i18n.js";import{ExternalLinkIcon as l,LinkIcon as s}from"../../internal/icons.js";import{opensElsewhere as c,safeHref as m,safeRel as u}from"../../internal/link.js";import{controlTextLeadingClasses as d,cx as p,focusRingClasses as b,srOnlyClasses as f}from"../../internal/styles.js";import{useStyleDefaults as k}from"../../internal/defaults.js";const v={always:"[&.neba-link]:underline",hover:"[&.neba-link]:no-underline [&.neba-link]:hover:underline",none:"[&.neba-link]:no-underline"},h=["neba-link","cursor-pointer","[&_svg]:pointer-events-none [&_svg]:inline [&_svg]:size-[0.95em] [&_svg]:shrink-0",["[transition-property:color,text-decoration-color]","[transition-duration:var(--neba-duration)]","[transition-timing-function:var(--neba-ease)]"].join(" "),b,"focus-visible:rounded-[0.25rem]"].join(" ");export const TextLink=/*@__PURE__*/i.forwardRef(function TextLink(i,b){const{href:g,underline:j="always",color:x,size:y,newTab:w=!1,icon:_,locale:N,render:T,className:z,style:C,children:L,...$}=k(i,["locale"]),F=o(t,N),R=_??w,q=!0===R?n(w?l:s,{}):R,A=p(h,y?d[y]:"",v[j],x?"[&.neba-link]:text-(--n-accent)":"[&.neba-link]:text-inherit",z??""),B={"--n-underline":"color-mix(in oklab, currentColor 45%, transparent)","--n-underline-hover":"currentColor","--n-ring":`var(--neba-${x??"primary"}-ring)`,...x?{"--n-accent":`var(--neba-${x}-accent)`}:null},{rel:D,target:E,...G}=$,H=w?"_blank":E,I=u(H,D),J=c(H);return a({render:T??n("a",{}),ref:b,props:{href:m(g),target:H,className:A,style:{...B,...C},children:e(r,{children:[L,q?n("span",{className:"ms-[0.25em]",children:q}):null,J?e("span",{className:f,children:[" ",F.newTab]}):null]}),...G,rel:I}})});
1
+ "use client";import{jsx as e,jsxs as n,Fragment as r}from"react/jsx-runtime";import*as i from"react";import{useRender as t}from"@base-ui/react/use-render";import{linkMessages as o,useMessages as a}from"../../internal/i18n.js";import{ExternalLinkIcon as l,LinkIcon as s}from"../../internal/icons.js";import{opensElsewhere as c,safeHref as d,safeRel as m}from"../../internal/link.js";import{COLOR as u,FONT_WEIGHT as h,overriddenBy as f,TEXT_DECORATION_COLOR as p,TEXT_DECORATION_LINE as b,TEXT_DECORATION_THICKNESS as k,TEXT_UNDERLINE_OFFSET as x,TEXT_UNDERLINE_POSITION as v}from"../../internal/overrides.js";import{controlTextLeadingClasses as w,cx as g,focusRingClasses as j,srOnlyClasses as y}from"../../internal/styles.js";import{useStyleDefaults as _}from"../../internal/defaults.js";const N={always:["[&.neba-link]:underline","[:where(&)]:underline"],hover:["[&.neba-link]:no-underline [&.neba-link]:hover:underline","[:where(&)]:no-underline hover:[:where(&)]:underline"],none:["[&.neba-link]:no-underline","[:where(&)]:no-underline"]},T=[[h,"[&.neba-link]:[font-weight:inherit]","[:where(&)]:[font-weight:inherit]"],[k,"[&.neba-link]:[text-decoration-thickness:max(1px,0.055em)]","[:where(&)]:[text-decoration-thickness:max(1px,0.055em)]"],[x,"[&.neba-link]:underline-offset-[0.2em]","[:where(&)]:underline-offset-[0.2em]"],[v,"[&.neba-link]:[text-underline-position:from-font]","[:where(&)]:[text-underline-position:from-font]"],[p,"[&.neba-link]:decoration-(--n-underline) [&.neba-link:hover]:decoration-(--n-underline-hover)","[:where(&)]:decoration-(--n-underline) [:where(&:hover)]:decoration-(--n-underline-hover)"]],z=["neba-link","cursor-pointer","[&_svg]:pointer-events-none [&_svg]:inline [&_svg]:size-[0.95em] [&_svg]:shrink-0",["[transition-property:color,text-decoration-color]","[transition-duration:var(--neba-duration)]","[transition-timing-function:var(--neba-ease)]"].join(" "),j,"focus-visible:rounded-[0.25rem]"].join(" ");export const TextLink=/*@__PURE__*/i.forwardRef(function TextLink(h,p){const{href:k,underline:x="always",color:v,size:j,newTab:C=!1,icon:L,locale:$,render:F,className:M,style:R,children:q,...A}=_(h,["locale"]),B=a(o,$),D=L??C,E=!0===D?e(C?l:s,{}):D,G=i.useMemo(()=>f(M),[M]),H=g(z,j?w[j]:"",N[x][G&b?1:0],...T.map(([e,n,r])=>G&e?r:n),v?G&u?"[:where(&)]:text-(--n-accent)":"[&.neba-link]:text-(--n-accent)":G&u?"[:where(&)]:text-inherit":"[&.neba-link]:text-inherit",M??""),I={"--n-underline":"color-mix(in oklab, currentColor 45%, transparent)","--n-underline-hover":"currentColor","--n-ring":`var(--neba-${v??"primary"}-ring)`,...v?{"--n-accent":`var(--neba-${v}-accent)`}:null},{rel:J,target:K,...O}=A,P=C?"_blank":K,Q=m(P,J),S=c(P);return t({render:F??e("a",{}),ref:p,props:{href:d(k),target:P,className:H,style:{...I,...R},children:n(r,{children:[q,E?e("span",{className:"ms-[0.25em]",children:E}):null,S?n("span",{className:y,children:[" ",B.newTab]}):null]}),...O,rel:Q}})});
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as l from"react";import{Button as t}from"../button/Button.js";import{TimeGrid as o,usePickerLabels as s}from"../../internal/calendar.js";import{ClockIcon as a}from"../../internal/icons.js";import{PickerFooter as i,PickerShell as r}from"../../internal/picker.js";import{displaySamples as c,formatDate as u,clampDate as d,isHour12 as m,isValidDate as p,secondsOfDay as h,startOfDay as f,timeUnitSpan as g,toISOTime as S,withPlaceholder as b,withTime as y}from"../../internal/date.js";import{cx as v}from"../../internal/styles.js";import{useStyleDefaults as j}from"../../internal/defaults.js";export const TimePicker=/*@__PURE__*/l.forwardRef(function TimePicker(x,C){const{value:w,defaultValue:z,onValueChange:k,open:D,defaultOpen:O,onOpenChange:T,referenceDate:M,minTime:P,maxTime:V,shouldDisableTime:B,hour12:H,showSeconds:I=!1,hourStep:N=1,minuteStep:R=1,secondStep:F=1,locale:L,format:q,placeholder:A,clearable:E=!1,showNowButton:G=!0,closeOnSelect:J=!1,labels:K,name:Q,size:U="md",color:W="primary",density:X="default",readOnly:Y=!1,disabled:Z=!1,startIcon:$,..._}=j(x,["size","density","variant","locale","labelPlacement"]),ee=s(K,L),ne=H??m(L),[le,te]=l.useState(z??null),oe=void 0!==w?w:le,[se,ae]=l.useState(O??!1),ie=D??se,[re]=l.useState(()=>M??f(new Date)),ce=e=>{e&&(Y||Z)||(void 0===D&&ae(e),T?.(e))},ue=(e,n)=>p(n)?y(e,{hours:n.getHours(),minutes:n.getMinutes(),seconds:n.getSeconds()}):null,de=e=>{const n=null===e?null:d(e,ue(e,P),ue(e,V));void 0===w&&te(n),k?.(n)},me=l.useCallback((e,n)=>{const[l,t]=g(n,e);return!!(p(P)&&t<h(P))||(!!(p(V)&&l>h(V))||(B?.(e,n)??!1))},[P,V,B]),pe=l.useMemo(()=>q??{hour:"numeric",minute:"2-digit",...I?{second:"2-digit"}:{}},[q,I]),he=new Date,fe=y(M??re,{hours:he.getHours(),minutes:he.getMinutes(),seconds:I?he.getSeconds():0}),ge=G||E||!J,Se=l.useMemo(()=>b(c(L,pe),A),[L,pe,A]);return e(r,{..._,size:U,color:W,density:X,readOnly:Y,disabled:Z,triggerRef:C,startIcon:$??e(a,{}),display:p(oe)?u(oe,L,pe):A??"",samples:Se,empty:!p(oe),clearable:E,onClear:()=>de(null),open:ie,onOpenChange:ce,clearLabel:ee.clear,hiddenValues:Q?[{name:Q,value:p(oe)?S(oe,I):""}]:void 0,children:n("div",{className:v("flex flex-col",ge&&"gap-1.5"),children:[e(o,{size:U,density:X,locale:L,value:p(oe)?oe:null,referenceDate:M??re,onChange:e=>{de(e),J&&ce(!1)},hour12:ne,showSeconds:I,hourStep:N,minuteStep:R,secondStep:F,shouldDisableTime:me,labels:ee,autoFocus:!0}),ge?n(i,{size:U,children:[E?e(t,{variant:"text",size:U,color:W,density:"compact",onClick:()=>{de(null),ce(!1)},children:ee.clear}):null,G?e(t,{variant:"text",size:U,color:W,density:"compact",disabled:me(fe,"second"),onClick:()=>{de(fe),ce(!1)},children:ee.now}):null,J?null:e(t,{variant:"solid",size:U,color:W,density:"compact",onClick:()=>ce(!1),children:ee.done})]}):null]})})});
1
+ "use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as l from"react";import{Button as t}from"../button/Button.js";import{TimeGrid as o,usePickerLabels as a}from"../../internal/calendar.js";import{ClockIcon as s}from"../../internal/icons.js";import{PickerFooter as i,PickerShell as r}from"../../internal/picker.js";import{displaySamples as c,formatDate as u,clampDate as d,isHour12 as m,isValidDate as p,secondsOfDay as h,startOfDay as f,timeUnitSpan as g,toISOTime as S,withPlaceholder as b,withTime as y}from"../../internal/date.js";import{cx as v}from"../../internal/styles.js";import{useStyleDefaults as j}from"../../internal/defaults.js";import{useIntlLocale as x}from"../../internal/media.js";export const TimePicker=/*@__PURE__*/l.forwardRef(function TimePicker(C,w){const{value:z,defaultValue:k,onValueChange:D,open:O,defaultOpen:T,onOpenChange:M,referenceDate:P,minTime:V,maxTime:B,shouldDisableTime:H,hour12:I,showSeconds:N=!1,hourStep:R=1,minuteStep:F=1,secondStep:L=1,locale:q,format:A,placeholder:E,clearable:G=!1,showNowButton:J=!0,closeOnSelect:K=!1,labels:Q,name:U,size:W="md",color:X="primary",density:Y="default",readOnly:Z=!1,disabled:$=!1,startIcon:_,...ee}=j(C,["size","density","variant","locale","labelPlacement"]),ne=a(Q,q),le=x(q),te=I??m(le),[oe,ae]=l.useState(k??null),se=void 0!==z?z:oe,[ie,re]=l.useState(T??!1),ce=O??ie,[ue]=l.useState(()=>P??f(new Date)),de=e=>{e&&(Z||$)||(void 0===O&&re(e),M?.(e))},me=(e,n)=>p(n)?y(e,{hours:n.getHours(),minutes:n.getMinutes(),seconds:n.getSeconds()}):null,pe=e=>{const n=null===e?null:d(e,me(e,V),me(e,B));void 0===z&&ae(n),D?.(n)},he=l.useCallback((e,n)=>{const[l,t]=g(n,e);return!!(p(V)&&t<h(V))||(!!(p(B)&&l>h(B))||(H?.(e,n)??!1))},[V,B,H]),fe=l.useMemo(()=>A??{hour:"numeric",minute:"2-digit",...N?{second:"2-digit"}:{}},[A,N]),ge=new Date,Se=y(P??ue,{hours:ge.getHours(),minutes:ge.getMinutes(),seconds:N?ge.getSeconds():0}),be=J||G||!K,ye=l.useMemo(()=>b(c(le,fe),E),[le,fe,E]);return e(r,{...ee,size:W,color:X,density:Y,readOnly:Z,disabled:$,triggerRef:w,startIcon:_??e(s,{}),display:p(se)?u(se,le,fe):E??"",samples:ye,empty:!p(se),clearable:G,onClear:()=>pe(null),open:ce,onOpenChange:de,clearLabel:ne.clear,hiddenValues:U?[{name:U,value:p(se)?S(se,N):""}]:void 0,children:n("div",{className:v("flex flex-col",be&&"gap-1.5"),children:[e(o,{size:W,density:Y,locale:q,value:p(se)?se:null,referenceDate:P??ue,onChange:e=>{pe(e),K&&de(!1)},hour12:te,showSeconds:N,hourStep:R,minuteStep:F,secondStep:L,shouldDisableTime:he,labels:ne,autoFocus:!0}),be?n(i,{size:W,children:[G?e(t,{variant:"text",size:W,color:X,density:"compact",onClick:()=>{pe(null),de(!1)},children:ne.clear}):null,J?e(t,{variant:"text",size:W,color:X,density:"compact",disabled:he(Se,"second"),onClick:()=>{pe(Se),de(!1)},children:ne.now}):null,K?null:e(t,{variant:"solid",size:W,color:X,density:"compact",onClick:()=>de(!1),children:ne.done})]}):null]})})});