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.
- package/dist/a2ui/adapter-catalog.json +1 -1
- package/dist/a2ui/catalog.json +2 -2
- package/dist/a2ui/index.d.ts +2 -0
- package/dist/a2ui/schema.d.ts +11 -1
- package/dist/a2ui/schema.js +1 -1
- package/dist/components/alert/Alert.js +1 -1
- package/dist/components/animate-counter/AnimateCounter.d.ts +6 -0
- package/dist/components/animate-counter/AnimateCounter.js +1 -1
- package/dist/components/animate-headline/AnimateHeadline.js +1 -1
- package/dist/components/animate-scramble/AnimateScramble.d.ts +9 -3
- package/dist/components/animate-scramble/AnimateScramble.js +1 -1
- package/dist/components/animate-split/AnimateSplit.d.ts +7 -1
- package/dist/components/animate-split/AnimateSplit.js +1 -1
- package/dist/components/animate-typing/AnimateTyping.d.ts +6 -0
- package/dist/components/animate-typing/AnimateTyping.js +1 -1
- package/dist/components/app-logo/AppLogo.js +1 -1
- package/dist/components/approval/Approval.js +1 -1
- package/dist/components/breadcrumb/Breadcrumb.d.ts +16 -0
- package/dist/components/breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/calendar/Calendar.js +1 -1
- package/dist/components/card/Card.js +1 -1
- package/dist/components/carousel/Carousel.d.ts +3 -2
- package/dist/components/carousel/Carousel.js +1 -1
- package/dist/components/chat-bubble/ChatBubble.d.ts +6 -0
- package/dist/components/chat-bubble/ChatBubble.js +1 -1
- package/dist/components/checkbox/Checkbox.js +1 -1
- package/dist/components/checkbox-group/CheckboxGroup.d.ts +84 -0
- package/dist/components/checkbox-group/CheckboxGroup.js +1 -0
- package/dist/components/checkbox-group/index.d.ts +2 -0
- package/dist/components/checkbox-group/index.js +1 -0
- package/dist/components/code-block/CodeBlock.d.ts +2 -2
- package/dist/components/code-block/CodeBlock.js +1 -1
- package/dist/components/code-block/index.d.ts +2 -1
- package/dist/components/code-block/index.js +1 -1
- package/dist/components/color-picker/ColorPicker.js +1 -1
- package/dist/components/combobox/Combobox.js +1 -1
- package/dist/components/context-window/ContextWindow.js +1 -1
- package/dist/components/data-table/DataTable.d.ts +13 -1
- package/dist/components/data-table/DataTable.js +1 -1
- package/dist/components/date-picker/DatePicker.js +1 -1
- package/dist/components/date-range-picker/DateRangePicker.js +1 -1
- package/dist/components/date-time-picker/DateTimePicker.js +1 -1
- package/dist/components/drawer/Drawer.d.ts +21 -0
- package/dist/components/drawer/Drawer.js +1 -1
- package/dist/components/empty/Empty.js +1 -1
- package/dist/components/fieldset/Fieldset.d.ts +12 -1
- package/dist/components/fieldset/Fieldset.js +1 -1
- package/dist/components/file-picker/FilePicker.d.ts +0 -8
- package/dist/components/file-picker/FilePicker.js +1 -1
- package/dist/components/file-picker/formatFileSize.d.ts +8 -0
- package/dist/components/file-picker/formatFileSize.js +1 -0
- package/dist/components/file-picker/index.d.ts +2 -1
- package/dist/components/file-picker/index.js +1 -1
- package/dist/components/floating-bottom-navigation/FloatingBottomNavigation.js +1 -1
- package/dist/components/form/Form.d.ts +8 -2
- package/dist/components/form/Form.js +1 -1
- package/dist/components/gallery/Gallery.d.ts +45 -3
- package/dist/components/gallery/Gallery.js +1 -1
- package/dist/components/gallery/GalleryViewer.js +1 -1
- package/dist/components/gauge-chart/GaugeChart.js +1 -1
- package/dist/components/heatmap-chart/HeatmapChart.js +1 -1
- package/dist/components/how-to-steps/HowToSteps.d.ts +14 -0
- package/dist/components/how-to-steps/HowToSteps.js +1 -1
- package/dist/components/image/Image.d.ts +31 -6
- package/dist/components/image/Image.js +1 -1
- package/dist/components/list/List.d.ts +9 -0
- package/dist/components/list/List.js +1 -1
- package/dist/components/menu/Menu.d.ts +17 -0
- package/dist/components/menu/Menu.js +1 -1
- package/dist/components/meter/Meter.js +1 -1
- package/dist/components/mockup/Mockup.js +1 -1
- package/dist/components/number-field/NumberField.js +1 -1
- package/dist/components/page-layout/PageLayout.js +1 -1
- package/dist/components/panes/Panes.js +1 -1
- package/dist/components/pie-chart/PieChart.js +1 -1
- package/dist/components/pill/Pill.js +1 -1
- package/dist/components/progress-box/ProgressBox.js +1 -1
- package/dist/components/progress-circular/ProgressCircular.js +1 -1
- package/dist/components/progress-linear/ProgressLinear.js +1 -1
- package/dist/components/prompt-input/PromptInput.js +1 -1
- package/dist/components/provider/NebaProvider.d.ts +3 -22
- package/dist/components/provider/NebaProvider.js +1 -1
- package/dist/components/provider/colorSchemeScript.d.ts +23 -0
- package/dist/components/provider/colorSchemeScript.js +1 -0
- package/dist/components/provider/index.d.ts +2 -1
- package/dist/components/provider/index.js +1 -1
- package/dist/components/radio-group/RadioGroup.d.ts +13 -0
- package/dist/components/radio-group/RadioGroup.js +1 -1
- package/dist/components/reasoning/Reasoning.d.ts +21 -0
- package/dist/components/reasoning/Reasoning.js +1 -1
- package/dist/components/scatter-chart/ScatterChart.js +1 -1
- package/dist/components/scroll-zone/ScrollZone.js +1 -1
- package/dist/components/segmented-button/SegmentedButton.js +1 -1
- package/dist/components/select/Select.js +1 -1
- package/dist/components/sidebar/Sidebar.d.ts +13 -0
- package/dist/components/sidebar/Sidebar.js +1 -1
- package/dist/components/slider/Slider.js +1 -1
- package/dist/components/sources/Sources.d.ts +11 -0
- package/dist/components/sources/Sources.js +1 -1
- package/dist/components/spoiler/Spoiler.js +1 -1
- package/dist/components/statistic/Statistic.js +1 -1
- package/dist/components/streaming-text/StreamingText.d.ts +22 -11
- package/dist/components/streaming-text/StreamingText.js +1 -1
- package/dist/components/tabs/Tabs.d.ts +12 -1
- package/dist/components/tabs/Tabs.js +1 -1
- package/dist/components/text-link/TextLink.d.ts +7 -0
- package/dist/components/text-link/TextLink.js +1 -1
- package/dist/components/time-picker/TimePicker.js +1 -1
- package/dist/components/timeline-chart/TimelineChart.js +1 -1
- package/dist/components/toast/Toast.js +1 -1
- package/dist/components/tool-call/ToolCall.d.ts +11 -0
- package/dist/components/tool-call/ToolCall.js +1 -1
- package/dist/components/tour/Tour.js +1 -1
- package/dist/components/tree-view/TreeView.d.ts +13 -1
- package/dist/components/tree-view/TreeView.js +1 -1
- package/dist/components/typography/Typography.d.ts +7 -0
- package/dist/components/typography/Typography.js +1 -1
- package/dist/components/window-pane/WindowPane.js +1 -1
- package/dist/hooks/useElementSize.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/internal/animate.js +1 -1
- package/dist/internal/calendar.d.ts +2 -2
- package/dist/internal/calendar.js +1 -1
- package/dist/internal/chart-frame.d.ts +59 -2
- package/dist/internal/chart-frame.js +1 -1
- package/dist/internal/chart-line.js +1 -1
- package/dist/internal/checkbox-group.d.ts +29 -0
- package/dist/internal/checkbox-group.js +1 -0
- package/dist/internal/defaults.d.ts +14 -2
- package/dist/internal/format.d.ts +7 -0
- package/dist/internal/format.js +1 -1
- package/dist/internal/highlight.d.ts +9 -0
- package/dist/internal/highlight.js +1 -1
- package/dist/internal/layout-effect.d.ts +17 -0
- package/dist/internal/layout-effect.js +1 -0
- package/dist/internal/media.d.ts +20 -0
- package/dist/internal/media.js +1 -1
- package/dist/internal/menu.d.ts +5 -0
- package/dist/internal/observe.d.ts +4 -1
- package/dist/internal/observe.js +1 -1
- package/dist/internal/overrides.d.ts +55 -0
- package/dist/internal/overrides.js +1 -0
- package/dist/internal/page-layout.d.ts +26 -1
- package/dist/internal/page-layout.js +1 -1
- package/dist/internal/run.d.ts +6 -1
- package/dist/internal/run.js +1 -1
- package/dist/internal/sizer.d.ts +10 -0
- package/dist/internal/sizer.js +1 -1
- package/dist/internal/styles.d.ts +41 -3
- package/dist/internal/styles.js +1 -1
- package/dist/internal/text.d.ts +25 -3
- package/dist/internal/text.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +94 -73
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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:
|
|
7
|
-
* and each one fades in as it lands. Anything else
|
|
8
|
-
* with the caret and the reserved height still around
|
|
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.
|
|
27
|
-
* transition on the block as a whole would fade the
|
|
28
|
-
*
|
|
29
|
-
*
|
|
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
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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]})})});
|