neba 1.17.1 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/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/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/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/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 +0 -20
- 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/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/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/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 +28 -2
- 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 +91 -72
- package/package.json +2 -2
|
@@ -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]})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{CartesianChart as o,markTransitionClasses as r}from"../../internal/chart-frame.js";import{barBandRatio as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{CartesianChart as o,chartTableClasses as a,markTransitionClasses as r,useDeferredRows as s}from"../../internal/chart-frame.js";import{barBandRatio as l,barMaxThickness as i,barRadius as c,formatTimeTicks as m,formatTimeValue as u,markGap as d,resolveColor as f,seriesColor as h,timeScale as x,toNumber as p}from"../../internal/chart.js";import{chartMessages as M,useMessages as b}from"../../internal/i18n.js";import{useStyleDefaults as y}from"../../internal/defaults.js";import{useIntlLocale as v}from"../../internal/media.js";export function TimelineChart(t){const{series:a,min:r,max:s,barSize:c,rounded:f=!0,size:C="md",density:T="default",xAxis:z,yAxis:A,locale:D,references:E,...P}=y(t,["size","density","locale"]),S=v(D),B=n.useMemo(()=>a.map(g),[a]),F=n.useMemo(()=>B.map(e=>e.spans),[B]),I=n.useMemo(()=>{let e=1/0,t=-1/0,n=!1;for(const o of F)for(const a of o)a&&(n=!0,e=Math.min(e,a.from),t=Math.max(t,a.to));for(const o of E??[])if("value"===(o.axis??"value"))for(const a of void 0===o.to?[o.value]:[o.value,o.to])n=!0,e=Math.min(e,a),t=Math.max(t,a);return n?{min:e,max:t}:null},[F,E]),N=n.useMemo(()=>x(I,{min:p(r)??void 0,max:p(s)??void 0,tickCount:A?.tickCount}),[I,r,s,A?.tickCount]),R=n.useMemo(()=>m(N.ticks,N.unit,S),[N,S]),q=n.useMemo(()=>a.map((e,t)=>h(e,t)),[a]),Y=n.useMemo(()=>[{data:F.map(e=>e.some(Boolean)?1:null)}],[F]),G=n.useMemo(()=>{const e=w(N.unit);return("day"===e||"week"===e)&&F.some(e=>e.some(e=>null!==e&&(k(e.from)||k(e.to))))},[F,N.unit]),H=n.useMemo(()=>{let e=0,t=1/0,n=-1/0;for(const o of F)for(const a of o)a&&(e+=1,t=Math.min(t,a.from),n=Math.max(n,a.to));return 0===e?{count:e,min:"",max:""}:{count:e,min:u(t,w(N.unit),S,G),max:u(n,w(N.unit),S,G)}},[F,N.unit,S,G]),J=n.useMemo(()=>a.map((e,t)=>e.name??`${t+1}`),[a]),K=c??i[C],L=b(M,D),O=n.useCallback(e=>{const t=[];return B.forEach((n,o)=>{const a=Math.min(K,Math.max(1,(e.band.band-d*(n.lanes-1))/n.lanes)),r=a*n.lanes+d*(n.lanes-1),s=e.plot.top+e.categoryPx(o)-r/2+a/2;n.spans.forEach((n,r)=>{if(!n||n.to<e.scale.min||n.from>e.scale.max)return;const l=e.valuePx(n.from),i=e.valuePx(n.to);t.push({series:o,index:r,x:(l+i)/2,y:s+n.lane*(a+d),r:a/2,rx:Math.max(0,(i-l)/2),ry:a/2})})}),t},[B,K]),Q=n.useCallback(e=>{const t=F[e.series]?.[e.index];if(!t)return null;const n=[{seriesIndex:e.series,name:J[e.series],color:t.color??q[e.series],value:t.to-t.from,formatted:`${u(t.from,w(N.unit),S,G)} – ${u(t.to,w(N.unit),S,G)}`}];return{heading:t.span.label??J[e.series],items:n}},[F,J,q,N.unit,S,G]);return e(o,{...P,series:Y,categories:J,size:C,density:T,locale:D,horizontal:!0,scale:N,references:E,brush:void 0,secondaryAxis:void 0,xAxis:z,yAxis:{tickFormat:(e,t)=>R[t]??"",...A},legend:!1,bandRatio:l[T],marks:O,markTooltip:Q,summary:H,exportRows:()=>function(e,t,n,o,a){const r=t.some(e=>e.data.some(e=>void 0!==e.label));return[["string"==typeof o?o:"",...r?[a.title]:[],a.start,a.end],...n.flatMap((n,o)=>n.map((n,a)=>[e[o],...r?[j(t[o].data[a]?.label)]:[],n?new Date(n.from):null,n?new Date(n.to):null]))]}(J,a,F,z?.label,L),table:t=>e($,{id:t,names:J,series:a,spans:F,unit:w(N.unit),clock:G,label:P.label,corner:z?.label,locale:D}),children:t=>e(Spans,{context:t,spans:F,colors:q,rounded:f})})}function g(e){const t=e.data.map(e=>{const t=p(e.start),n=p(e.end);return null===t||null===n?null:{from:Math.min(t,n),to:Math.max(t,n),lane:0,color:e.color?f(e.color):void 0,span:e}}),n=[];return t.map((e,t)=>({one:e,index:t})).filter(e=>Boolean(e.one)).sort((e,t)=>e.one.from-t.one.from).forEach(({one:e})=>{const t=n.findIndex(t=>t<=e.from),o=-1===t?n.length:t;n[o]=e.to,e.lane=o}),{spans:t,lanes:Math.max(1,n.length)}}function Spans({context:t,spans:n,colors:o,rounded:a}){const{marks:s,activeMark:l,plot:i}=t,m=a?c:0;return e("g",{children:s.map(t=>{const a=n[t.series]?.[t.index];if(!a)return null;const s=l?.series===t.series&&l?.index===t.index,c=t.rx??t.r,u=2*(t.ry??t.r),d=Math.max(i.left,t.x-c),f=Math.min(i.left+i.width,t.x+c);if(f<i.left||d>i.left+i.width)return null;const h=Math.max(1,f-d);return e("rect",{x:d,y:t.y-u/2,width:h,height:u,rx:Math.min(m,h/2,u/2),fill:a.color??o[t.series],opacity:s?1:.92,className:r},`${t.series}-${t.index}`)})})}function k(e){const t=new Date(e);return t.getTime()!==new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()}function w(e){return"month"===e||"quarter"===e||"year"===e?"day":e}const j=e=>"string"==typeof e||"number"==typeof e?e:null;const $=/*@__PURE__*/n.memo(function TimelineTable({id:n,names:o,series:r,spans:l,unit:i,clock:c,label:m,corner:d,locale:f}){const h=b(M,f),x=v(f),p=r.some(e=>e.data.some(e=>void 0!==e.label)),y=[],g=l.reduce((e,t)=>(y.push(e),e+t.length),0),k=s({rows:g,points:g,columns:p?4:3});return t("table",{id:n,className:a,"aria-busy":k<g||void 0,children:[m?e("caption",{children:m}):null,e("thead",{children:t("tr",{children:[e("th",{scope:"col",children:d??""}),p?e("th",{scope:"col",children:h.title}):null,e("th",{scope:"col",children:h.start}),e("th",{scope:"col",children:h.end})]})}),e("tbody",{children:l.flatMap((n,a)=>n.slice(0,Math.max(0,k-y[a])).map((n,s)=>t("tr",{children:[e("th",{scope:"row",children:o[a]}),p?e("td",{children:r[a].data[s]?.label??""}):null,e("td",{children:n?u(n.from,i,x,c):""}),e("td",{children:n?u(n.to,i,x,c):""})]},`${a}-${s}`)))})]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{useLayoutEffectOnClient as i}from"../../internal/layout-effect.js";import{Toast as s}from"@base-ui/react/toast";import{boxPaddingClasses as n}from"../box/Box.js";import{actionMessages as a,toastMessages as r,useMessages as l}from"../../internal/i18n.js";import{CloseIcon as c,severityIcon as d}from"../../internal/icons.js";import{controlSlots as m,cx as u,focusRingClasses as f,hasContent as p,hitAreaClasses as b,iconClasses as v,metaTextClasses as x,popupFadeClasses as h,radiusClasses as w,sheetBodyClasses as g,sheetHeaderGapClasses as j,sheetSectionGapClasses as y,sheetTitleClasses as N,sheetTitleHeadingClasses as T,surfaceClasses as z}from"../../internal/styles.js";import{useStyleDefaults as L}from"../../internal/defaults.js";const k={"top-start":"top-0 items-start","top-center":"top-0 items-center","top-end":"top-0 items-end","bottom-start":"bottom-0 items-start flex-col-reverse","bottom-center":"bottom-0 items-center flex-col-reverse","bottom-end":"bottom-0 items-end flex-col-reverse"},_={solid:[z,"text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--neba-shadow-3),var(--neba-plate-solid)]"].join(" "),outline:[z,"border text-(--neba-fg) bg-(--n-panel-press)","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]"].join(" "),text:[z,"text-(--neba-fg) bg-(--n-panel-press)","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]"].join(" ")},M={solid:"",outline:"text-(--n-on-tint)",text:"text-(--n-on-tint)"};function O(e){const{color:t,variant:o,icon:i,actionLabel:s,onAction:n,...a}=e;return{...a,data:{color:t,variant:o,icon:i},actionProps:void 0===s?void 0:{children:s,onClick:n}}}export function useToast(){const e=s.useToastManager(),t=o.useRef(e);i(()=>{t.current=e});const n=o.useMemo(()=>({add:e=>t.current.add(O(e)),close:e=>t.current.close(e),update:(e,o)=>t.current.update(e,e=>function(e,t){const{color:o,variant:i,icon:s,actionLabel:n,onAction:a,...r}=e,l=Object.fromEntries(Object.entries(r).filter(([,e])=>void 0!==e)),c=Object.fromEntries(Object.entries({color:o,variant:i,icon:s}).filter(([,e])=>void 0!==e));return{...l,...0===Object.keys(c).length?null:{data:{...t.data,...c}},...void 0===n?null:{actionProps:{children:n,onClick:a}}}}(o,e)),promise:(e,o)=>t.current.promise(e,{loading:O(o.loading),success:e=>O("function"==typeof o.success?o.success(e):o.success),error:e=>O("function"==typeof o.error?o.error(e):o.error)})}),[]);return o.useMemo(()=>({...n,toasts:e.toasts}),[n,e.toasts])}function ToastItem({toast:o,variant:i,color:a,size:r,density:l,closeLabel:z,swipeDirection:L,classNames:k}){const O=o.data?.variant??i??"outline",P=o.data?.color??a,D=void 0===o.data?.icon?d(P):o.data.icon,A=M[O],C=p(o.title);return t(s.Root,{toast:o,swipeDirection:L,className:u("pointer-events-auto flex w-full items-start",n[l??"default"][r],w[r],y[r],g[r],_[O],v,h,"data-[limited]:hidden",f,k?.toast),style:m(P,3,O),children:[p(D)?e("span",{className:`flex h-[1lh] shrink-0 items-center ${A}`,children:D}):null,t("div",{className:`flex min-w-0 flex-1 flex-col ${j[r]}`,children:[e(s.Title,{className:u(T,"font-semibold",N[r],A,k?.title)}),e(s.Description,{className:u(C&&"solid"!==O?"text-(--neba-muted-fg)":"",k?.description)})]}),e(s.Action,{className:u("flex h-[1lh] shrink-0 cursor-pointer items-center rounded-full px-2","font-medium underline-offset-2",A||"text-(--n-on-solid)","hover:underline","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2",x[r],k?.action)}),e("span",{className:"flex h-[1lh] shrink-0 items-center",children:e(s.Close,{"aria-label":z,className:u("relative inline-flex size-[1.15em] cursor-pointer items-center justify-center rounded-full",b,"opacity-70 [transition:opacity_var(--neba-duration)_var(--neba-ease)]","hover:opacity-100 focus-visible:opacity-100","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2",k?.close),children:e(c,{})})})]})}function ToastViewport(t){const{toasts:i}=s.useToastManager(),{position:n,width:a,classNames:r,regionLabel:l,...c}=t,d=o.useMemo(()=>[n.startsWith("top")?"up":"down","left","right"],[n]);return e(s.Portal,{children:e(s.Viewport,{"aria-label":l,className:u("neba-portal pointer-events-none fixed inset-x-0 z-(--neba-z-portal) flex flex-col gap-2 p-4",k[n],r?.viewport),children:i.map(t=>e("div",{className:"w-full",style:{maxWidth:"number"==typeof a?`${a}px`:a},children:e(ToastItem,{toast:t,swipeDirection:d,classNames:r,...c})},t.id))})})}export function ToastProvider(o){const{variant:i="outline",size:n="md",color:c="primary",density:d="default",position:m="bottom-end",timeout:u=5e3,limit:f=3,width:p=380,locale:b,closeLabel:v,label:x,classNames:h,children:w}=L(o,["size","density","variant","locale"]),g=l(a,b),j=l(r,b);return t(s.Provider,{timeout:u,limit:f,children:[w,e(ToastViewport,{position:m,variant:i,size:n,color:c,density:d,width:p,closeLabel:v??g.close,regionLabel:x??j.label,classNames:h})]})}
|
|
@@ -69,6 +69,17 @@ export interface ToolCallProps extends Pick<NebaStyleProps, 'size' | 'variant' |
|
|
|
69
69
|
defaultOpen?: boolean;
|
|
70
70
|
/** Called when the header opens or closes the panel. */
|
|
71
71
|
onOpenChange?: (open: boolean) => void;
|
|
72
|
+
/**
|
|
73
|
+
* Keeps a closed panel in the DOM, hidden until the browser's own page search
|
|
74
|
+
* finds something in it and opens it.
|
|
75
|
+
*
|
|
76
|
+
* On by default, as on a [Collapsible](../surfaces/collapsible): a panel that
|
|
77
|
+
* is not in the markup is not in a server render either. Turn it off for a
|
|
78
|
+
* transcript of many calls with long results, where the closed panels are
|
|
79
|
+
* only worth building once they are opened.
|
|
80
|
+
* @default true
|
|
81
|
+
*/
|
|
82
|
+
hiddenUntilFound?: boolean;
|
|
72
83
|
/**
|
|
73
84
|
* Drop shadow depth. `0` (the default) is flat — a tool call belongs to the
|
|
74
85
|
* transcript it sits in rather than floating over it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,Fragment as a,jsxs as n}from"react/jsx-runtime";import*as l from"react";import{Collapsible as s}from"@base-ui/react/collapsible";import{boxPaddingXClasses as r,boxPaddingYClasses as t}from"../box/Box.js";import{ChevronIcon as o}from"../../internal/icons.js";import{formatDuration as i,runColor as c,runIcon as m,useElapsed as d}from"../../internal/run.js";import{runMessages as u,toolMessages as f,useMessages as p}from"../../internal/i18n.js";import{collapsiblePanelClasses as
|
|
1
|
+
"use client";import{jsx as e,Fragment as a,jsxs as n}from"react/jsx-runtime";import*as l from"react";import{Collapsible as s}from"@base-ui/react/collapsible";import{boxPaddingXClasses as r,boxPaddingYClasses as t}from"../box/Box.js";import{ChevronIcon as o}from"../../internal/icons.js";import{formatDuration as i,runColor as c,runIcon as m,useElapsed as d}from"../../internal/run.js";import{runMessages as u,toolMessages as f,useMessages as p}from"../../internal/i18n.js";import{collapsiblePanelClasses as h,cx as x,gapClasses as b,hasContent as g,iconClasses as v,metaTextClasses as N,preformattedClasses as j,radiusClasses as w,sheetBodyClasses as y,sheetTitleClasses as k,srOnlyClasses as z,surfaceClasses as C,surfaceSlots as B,transitionClasses as F,disclosureChevronClasses as O,disclosureTriggerClasses as R}from"../../internal/styles.js";import{useStyleDefaults as T}from"../../internal/defaults.js";const U={solid:[C,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[C,"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"},_=k;export const ToolCall=/*@__PURE__*/l.forwardRef(function ToolCall(j,k){const{variant:C="outline",size:E="md",color:P="primary",density:S="default",elevation:$=0,name:q,status:A="pending",args:D,result:G,error:H,duration:I,meta:J,icon:K,open:L,defaultOpen:M=!1,onOpenChange:Q,hiddenUntilFound:V=!0,locale:W,labels:X,classNames:Y,className:Z,style:ee,children:ae,...ne}=T(j,["size","density","variant","locale"]),le=p(u,W),se=p(f,W),re={...le,...se,...X},[te,oe]=l.useState(M),ie=void 0!==L,ce=ie?L:te,me=l.useRef(A);l.useEffect(()=>{me.current===A||"error"!==A||ie||oe(!0),me.current=A},[A,ie]);const de=d("running"===A,I),ue=c(A,P),fe=void 0===K?m(A):K,pe=function(e,a,n){return"error"===e&&g(n)?n:a}(A,G,H),he=g(D)||g(pe)||g(ae),xe=r[S][E],be=t[S][E],ge=n(a,{children:[g(fe)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--n-accent)",children:fe}):null,e("span",{className:x("min-w-0 truncate font-mono font-semibold",_[E]),children:q}),e("span",{className:z,children:re[A]}),g(J)?e("span",{className:x("min-w-0 truncate text-(--neba-muted-fg)",N[E]),children:J}):null,e("span",{className:"flex-1"}),null===de?null:e("span",{className:x("shrink-0 tabular-nums text-(--neba-muted-fg)",N[E]),children:i(de,W)})]}),ve=x("flex flex-col overflow-hidden",w[E],U[C],F,v,Z??""),Ne={...B(ue,$),...ee};return he?n(s.Root,{ref:k,open:ce,onOpenChange:e=>{ie||oe(e),Q?.(e)},"data-status":A,className:ve,style:Ne,...ne,children:[n(s.Trigger,{className:x("flex w-full cursor-pointer items-center text-start",R,xe,be,b[E],F,"hover:bg-(--n-soft)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]",Y?.header??""),children:[ge,e("span",{className:`${O} text-(--neba-muted-fg)`,children:e(o,{})})]}),e(s.Panel,{hiddenUntilFound:V,className:h,children:n("div",{className:x("flex min-w-0 flex-col gap-2 pb-4",xe,y[E],"compact"===S?"pb-2":"",Y?.body??""),children:[g(D)?e(Block,{size:E,label:re.arguments,className:Y?.args,value:D}):null,g(pe)?e(Block,{size:E,label:"error"===A&&g(H)?le.error:re.result,className:Y?.result,value:pe,accent:"error"===A}):null,ae]})})]}):e("div",{ref:k,"data-status":A,className:ve,style:Ne,...ne,children:e("div",{className:x("flex items-center",xe,be,b[E],Y?.header??""),children:ge})})});function Block({size:a,label:l,value:s,className:r,accent:t=!1}){return n("div",{className:x("flex min-w-0 flex-col gap-1",r??""),children:[e("span",{className:x("font-medium tracking-wide text-(--neba-muted-fg) uppercase",N[a]),children:l}),"string"==typeof s?e("pre",{className:x(j,"max-h-64",t?"text-(--n-accent)":""),children:s}):e("div",{className:t?"text-(--n-accent)":void 0,children:s})]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{Popover as s}from"@base-ui/react/popover";import{Button as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{useLayoutEffectOnClient as i}from"../../internal/layout-effect.js";import{Popover as s}from"@base-ui/react/popover";import{Button as o}from"../button/Button.js";import{boxPaddingXClasses as l,boxPaddingYClasses as a}from"../box/Box.js";import{actionMessages as r,fillMessage as c,stepsMessages as d,useMessages as m}from"../../internal/i18n.js";import{CloseIcon as p}from"../../internal/icons.js";import{queryMatches as u,reducedMotionQuery as h}from"../../internal/media.js";import{observeResize as f}from"../../internal/observe.js";import{cx as g,hasContent as x,metaTextClasses as b,popupFadeClasses as v,radiusClasses as w,sheetBodyClasses as N,sheetCloseClasses as k,sheetHeaderGapClasses as j,sheetSectionGapClasses as y,sheetTitleClasses as S,srOnlyClasses as z,surfaceClasses as L,surfaceSlots as C}from"../../internal/styles.js";import{useStyleDefaults as E}from"../../internal/defaults.js";const M=[L,"relative flex flex-col","border text-(--neba-fg) bg-(--n-panel-press)","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]","[outline:none]",v].join(" "),P={xs:"max-w-56",sm:"max-w-64",md:"max-w-80",lg:"max-w-96",xl:"max-w-lg"},O={xs:"xs",sm:"xs",md:"sm",lg:"sm",xl:"md"};function _(e){try{return document.querySelector(e)}catch{return null}}function Mask({spot:t,radius:n,className:i}){return e("div",null===t?{"aria-hidden":"true",className:g("pointer-events-none fixed inset-0 z-40 bg-(--neba-scrim)",i)}:{"aria-hidden":"true",className:g("pointer-events-none fixed z-40 [box-shadow:0_0_0_9999px_var(--neba-scrim)]",i),style:{top:t.top,left:t.left,width:t.width,height:t.height,borderRadius:n}})}export function Tour(v){const{steps:L,open:B,defaultOpen:F=!1,onOpenChange:R,step:T,defaultStep:q=0,onStepChange:A,onFinish:I,mask:V=!0,skippable:$=!0,dismissible:D=!0,scrollIntoView:H=!0,locale:G,previousLabel:J,nextLabel:K,doneLabel:Q,skipLabel:U,closeLabel:W,size:X="md",color:Y="primary",density:Z="default",className:ee,classNames:te}=E(v,["size","density","locale"]),ne=m(d,G),ie=m(r,G),[se,oe]=n.useState(F),[le,ae]=n.useState(q),re=B??se,ce=Math.min(T??le,Math.max(0,L.length-1)),de=L[ce],[me,pe]=n.useState(null),ue=e=>{void 0===B&&oe(e),R?.(e)},he=e=>{void 0===T&&ae(e),A?.(e)},[fe,ge]=n.useState(null);if(i(()=>{const e=de?.target;ge(re&&e?_(e):null)},[re,de?.target]),n.useEffect(()=>{const e=de?.target;if(!re||!e)return;const t=_(e);if(!(t instanceof HTMLElement))return;H&&t.scrollIntoView({block:"center",inline:"nearest",behavior:u(h)?"auto":"smooth"});const n=de?.padding??6;let i=0;const s=()=>{i=0;const s=t.getBoundingClientRect(),o={top:s.top-n,left:s.left-n,width:s.width+2*n,height:s.height+2*n};pe(t=>t?.selector===e&&t.spot.top===o.top&&t.spot.left===o.left&&t.spot.width===o.width&&t.spot.height===o.height?t:{selector:e,spot:o})},o=()=>{0===i&&(i=requestAnimationFrame(s))};s();const l=f(t,o);return window.addEventListener("scroll",o,{passive:!0,capture:!0}),window.addEventListener("resize",o,{passive:!0}),()=>{0!==i&&cancelAnimationFrame(i),l(),window.removeEventListener("scroll",o,!0),window.removeEventListener("resize",o)}},[re,de?.target,de?.padding,H]),0===L.length)return null;const xe=re&&de?.target&&me?.selector===de.target?me.spot:null,be=0===ce,ve=ce===L.length-1,we=l[Z][X],Ne=a[Z][X],ke=O[X],je=x(de?.title)||x(de?.content);return e(s.Root,{open:re,onOpenChange:(e,t)=>{(e||D||"escape-key"!==t.reason)&&(e||"outside-press"!==t.reason&&"focus-out"!==t.reason)?ue(e):t.cancel()},children:t(s.Portal,{children:[re&&V?e(Mask,{spot:xe,radius:xe?8:0,className:te?.mask}):null,e(s.Positioner,{className:"neba-portal z-(--neba-z-portal) [outline:none]",side:de?.side??"bottom",align:de?.align??"center",sideOffset:10,collisionPadding:12,anchor:fe,children:t(s.Popup,{className:g(M,w[X],N[X],y[X],P[X],we,Ne,ee),style:C(Y,3),children:[e("span",{className:z,"aria-live":"polite",children:"string"==typeof de?.title?c(ne.step,{index:String(ce+1),title:de.title}):c(ne.position,{index:String(ce+1),total:String(L.length)})}),je?t("div",{className:"flex items-start gap-3",children:[t("div",{className:`flex min-w-0 flex-1 flex-col ${j[X]}`,children:[x(de?.title)?e(s.Title,{className:g("m-0 font-semibold",S[X],te?.title),children:de?.title}):null,x(de?.content)?e(s.Description,{className:g("m-0 min-w-0",te?.description),children:de?.content}):null]}),D?e("button",{type:"button","aria-label":W??ie.close,onClick:()=>ue(!1),className:g(k,te?.close),children:e(p,{})}):null]}):null,t("div",{className:g("flex items-center gap-2",te?.footer),children:[e("span",{className:`shrink-0 tabular-nums text-(--neba-muted-fg) ${b[X]}`,children:c(ne.position,{index:String(ce+1),total:String(L.length)})}),t("div",{className:"ms-auto flex items-center gap-2",children:[$&&!ve?e(o,{size:ke,variant:"text",color:"secondary",onClick:()=>ue(!1),children:U??ne.skip}):null,be?null:e(o,{size:ke,variant:"outline",color:Y,onClick:()=>he(ce-1),children:J??ne.previous}),e(o,{size:ke,color:Y,onClick:()=>ve?(I?.(),void ue(!1)):he(ce+1),children:ve?Q??ne.done:K??ne.next})]})]})]})})]})})}
|
|
@@ -49,6 +49,17 @@ export interface TreeViewProps extends NebaStyleProps, Omit<React.ComponentProps
|
|
|
49
49
|
disabled?: boolean;
|
|
50
50
|
/** The name the tree is announced by. */
|
|
51
51
|
label?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Keeps the rows of a shut branch in the DOM — collapsed, inert and out of
|
|
54
|
+
* the order the arrow keys walk — instead of taking them out of it.
|
|
55
|
+
*
|
|
56
|
+
* A row that is not in the markup is not in a server render either, and a
|
|
57
|
+
* crawler reads the server render without opening a single branch. Turn this
|
|
58
|
+
* on for a tree that is navigation, so every `href` in it can be followed. A
|
|
59
|
+
* tree of thousands of rows pays for every one of them on the first render.
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
keepMounted?: boolean;
|
|
52
63
|
/** The top-level TreeItems. */
|
|
53
64
|
children?: React.ReactNode;
|
|
54
65
|
}
|
|
@@ -106,7 +117,8 @@ export interface TreeItemProps extends Omit<React.ComponentPropsWithoutRef<'li'>
|
|
|
106
117
|
* keys are questions about the *tree* ("what is the next visible row", "where is
|
|
107
118
|
* my parent"), and the only element that can answer them is the one holding all
|
|
108
119
|
* of them. The rows the query returns are in document order, which is reading
|
|
109
|
-
* order, because a shut branch is unmounted
|
|
120
|
+
* order, because a shut branch is either unmounted or — under `keepMounted` —
|
|
121
|
+
* marked, and `treeRows` leaves a marked one out.
|
|
110
122
|
*/
|
|
111
123
|
export declare const TreeView: React.ForwardRefExoticComponent<TreeViewProps & React.RefAttributes<HTMLUListElement>>;
|
|
112
124
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import*as r from"react";import{inertValue as a}from"../../internal/inert.js";import{safeHref as l}from"../../internal/link.js";import{searchText as s}from"../../internal/search.js";import{ChevronIcon as o}from"../../internal/icons.js";import{controlTextClasses as i,cx as d,gapClasses as c,hasContent as u,iconClasses as m,radiusClasses as
|
|
1
|
+
"use client";import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import*as r from"react";import{inertValue as a}from"../../internal/inert.js";import{safeHref as l}from"../../internal/link.js";import{searchText as s}from"../../internal/search.js";import{ChevronIcon as o}from"../../internal/icons.js";import{controlTextClasses as i,cx as d,gapClasses as c,hasContent as u,iconClasses as m,radiusClasses as p,surfaceClasses as f,surfaceSlots as g,transitionClasses as x}from"../../internal/styles.js";import{useStyleDefaults as b}from"../../internal/defaults.js";const h=/*@__PURE__*/r.createContext({size:"md",density:"default",disabled:!1,multiple:!1,keepMounted:!1,expandedKeys:new Set,selectedKeys:new Set,activeKey:null,toggle:()=>{},select:()=>{},activate:()=>{},register:()=>()=>{}}),v=/*@__PURE__*/r.createContext(!1),y={solid:[f,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[f,"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"},w={xs:"0.875rem",sm:"1rem",md:"1.25rem",lg:"1.5rem",xl:"1.75rem"},k={xs:"1.375rem",sm:"1.625rem",md:"2rem",lg:"2.5rem",xl:"3rem"},C={default:{xs:"px-1.5",sm:"px-2",md:"px-2.5",lg:"px-3",xl:"px-3.5"},compact:{xs:"px-1",sm:"px-1",md:"px-1.5",lg:"px-2",xl:"px-2.5"}},S={xs:"rounded-[0.3125rem]",sm:"rounded-[0.375rem]",md:"rounded-[0.5rem]",lg:"rounded-[0.625rem]",xl:"rounded-[0.75rem]"},E={none:"",simple:"neba-tree-simple",folder:"neba-tree-folder"};function N(e){return Array.from(e.querySelectorAll('[role="treeitem"]')).filter(e=>null===e.closest("[data-closing]"))}const j=e=>String(e);export const TreeView=/*@__PURE__*/r.forwardRef(function TreeView(t,n){const{variant:a="outline",size:l="md",color:o="primary",density:i="default",elevation:c=0,lines:u="simple",expanded:m,defaultExpanded:f,onExpandedChange:v,selected:C,defaultSelected:S,onSelectedChange:K,multiple:A=!1,disabled:V=!1,label:D,keepMounted:R=!1,className:M,style:I,children:P,onKeyDown:T,..._}=b(t,["size","density","variant"]),[z,q]=r.useState(f??[]),[F,L]=r.useState(S??[]),[H,O]=r.useState(null),U=m??z,W=C??F,B=r.useRef(null),G=r.useCallback(e=>{B.current=e,"function"==typeof n?n(e):n&&(n.current=e)},[n]),J=r.useRef({expandedValues:U,selectedValues:W,controlledExpanded:void 0!==m,controlledSelected:void 0!==C,multiple:A,onExpandedChange:v,onSelectedChange:K});J.current={expandedValues:U,selectedValues:W,controlledExpanded:void 0!==m,controlledSelected:void 0!==C,multiple:A,onExpandedChange:v,onSelectedChange:K};const Q=r.useCallback(e=>{const{expandedValues:t,controlledExpanded:n,onExpandedChange:r}=J.current,a=j(e),l=t.some(e=>j(e)===a)?t.filter(e=>j(e)!==a):[...t,e];n||q(l),r?.(l)},[]),X=r.useCallback(e=>{const{selectedValues:t,controlledSelected:n,multiple:r,onSelectedChange:a}=J.current,l=j(e),s=t.some(e=>j(e)===l),o=r?s?t.filter(e=>j(e)!==l):[...t,e]:[e];n||L(o),a?.(o)},[]),Y=r.useRef(new Map),Z=r.useCallback((e,t)=>(Y.current.set(e,t),()=>{Y.current.delete(e)}),[]),$=r.useMemo(()=>U.map(j).join("\0"),[U]),ee=r.useMemo(()=>W.map(j).join("\0"),[W]),te=r.useMemo(()=>({size:l,density:i,disabled:V,multiple:A,keepMounted:R,expandedKeys:new Set(U.map(j)),selectedKeys:new Set(W.map(j)),activeKey:H,toggle:Q,select:X,activate:O,register:Z}),[l,i,V,A,R,$,ee,H,Q,X,Z]);r.useEffect(()=>{if(null!==H&&Y.current.has(H))return;const e=B.current;if(!e)return;const t=N(e);if(0===t.length)return;const n=t.find(e=>"true"===e.getAttribute("aria-selected"))??t[0];O(n.dataset.nebaValue??null)});const ne=d("flex list-none flex-col p-1",p[l],y[a],x,E[u],M);return e(h.Provider,{value:te,children:e("ul",{ref:G,role:"tree","aria-label":D,"aria-multiselectable":A||void 0,className:ne,style:{...g(o,c),"--n-tree-indent":w[l],"--n-tree-row":k[l],...I},onKeyDown:function(e){if(T?.(e),e.defaultPrevented)return;const t=B.current,n=e.target?.closest?.('[role="treeitem"]');if(!t||!n||!t.contains(n))return;if(e.target!==n)return;const r=N(t),a=r.indexOf(n);if(-1===a)return;const l=t=>{t&&(e.preventDefault(),O(t.dataset.nebaValue??null),t.focus())},o=e=>{const t=e.dataset.nebaValue;t&&Y.current.get(t)?.toggle()},i="rtl"===getComputedStyle(t).direction,d=i?"ArrowLeft":"ArrowRight",c=i?"ArrowRight":"ArrowLeft",u=n.getAttribute("aria-expanded");switch(e.key){case"ArrowDown":l(r[a+1]);break;case"ArrowUp":l(r[a-1]);break;case"Home":l(r[0]);break;case"End":l(r[r.length-1]);break;case d:"false"===u?(e.preventDefault(),o(n)):"true"===u&&l(r[a+1]);break;case c:"true"===u?(e.preventDefault(),o(n)):l(n.parentElement?.closest('[role="treeitem"]'));break;case"Enter":case" ":e.preventDefault();(("Enter"===e.key?n.querySelector(":scope > div > a[href]"):null)??n).click();break;default:if(1===[...e.key].length&&" "!==e.key&&!e.ctrlKey&&!e.metaKey&&!e.altKey){const t=s(e.key);l([...r.slice(a+1),...r.slice(0,a)].find(e=>s(e.querySelector("[data-neba-label]")?.textContent??"").startsWith(t)))}}},..._,children:P})})});export const TreeItem=/*@__PURE__*/r.forwardRef(function TreeItem({value:s,label:p,startIcon:f,endIcon:g,action:b,href:y,expandable:w,disabled:k=!1,selectable:E=!0,className:N,children:K,onClick:A,...V},D){const{size:R,density:M,disabled:I,expandedKeys:P,selectedKeys:T,activeKey:_,toggle:z,select:q,activate:F,register:L,multiple:H,keepMounted:O}=r.useContext(h),U=r.useId(),W=s??U,B=j(W),G=r.useRef(null),J=r.useCallback(e=>{G.current=e,"function"==typeof D?D(e):D&&(D.current=e)},[D]),Q=r.Children.toArray(K),X=w??Q.length>0,Y=X&&P.has(B),Z=T.has(B),$=k||I,ee=r.useRef({toggle:()=>{}});ee.current.toggle=()=>{!$&&X&&z(W)};const te=r.useContext(v);r.useEffect(()=>te?void 0:L(B,ee.current),[te,B,L]);const[ne,re]=r.useState(Y),[ae,le]=r.useState(Y),se=r.useRef(null);r.useEffect(()=>{if(Y){re(!0);const e=requestAnimationFrame(()=>le(!0));return()=>cancelAnimationFrame(e)}le(!1);const e=se.current;(null===e||getComputedStyle(e).transitionDuration.split(",").every(e=>0===parseFloat(e)))&&re(!1)},[Y]);const oe=d("flex min-w-0 flex-1 cursor-pointer items-center text-start","h-(--n-tree-row)",C[M][R],S[R],c[R],i[R],x,m,"group-focus-visible/tree-item:[outline:2px_solid_var(--n-ring)]","group-focus-visible/tree-item:outline-offset-[-2px]",$?"cursor-not-allowed text-(--neba-disabled-fg)":Z?"bg-(--n-soft-press) font-medium text-(--n-on-tint) hover:bg-(--n-soft-press)":"hover:bg-(--n-soft)"),ie=n(t,{children:[e("span",{"aria-hidden":"true",onClick:e=>{!$&&X&&(e.stopPropagation(),e.preventDefault(),G.current?.focus(),F(B),z(W))},className:d("flex h-[1lh] w-[1.15em] shrink-0 items-center justify-center","[transition:rotate_var(--neba-duration)_var(--neba-ease)]",X?"text-(--neba-muted-fg)":"",Y?"rotate-0":"-rotate-90 rtl:rotate-90"),children:X?e(o,{}):null}),u(f)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:f}):null,e("span",{"data-neba-label":"",className:"min-w-0 flex-1 truncate",children:p}),u(g)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:g}):null]});return n("li",{ref:J,role:"treeitem","aria-expanded":X?Y:void 0,"aria-selected":!!Z||(!H||!E)&&void 0,"aria-disabled":$||void 0,"data-neba-value":B,tabIndex:_===B?0:-1,className:d("group/tree-item relative block [outline:none]",N),onClick:function(e){e.stopPropagation(),$?e.preventDefault():(G.current?.focus(),F(B),A?.(e),e.defaultPrevented||(X&&z(W),E&&q(W)))},...V,children:[n("div",{className:"flex w-full items-center",children:[void 0===l(y)||$?e("div",{className:oe,children:ie}):e("a",{href:l(y),tabIndex:-1,className:oe,"aria-current":Z?"page":void 0,children:ie}),u(b)?e("span",{className:d("flex shrink-0 items-center",C[M][R]),onClick:e=>e.stopPropagation(),children:b}):null]}),X&&(ne||O)&&Q.length>0?e("div",{ref:se,"data-closing":Y?void 0:"",inert:a(!Y),className:d("grid [transition:grid-template-rows_var(--neba-duration)_var(--neba-ease)]",ae?"[grid-template-rows:1fr]":"[grid-template-rows:0fr] pointer-events-none"),onTransitionEnd:e=>{e.target!==e.currentTarget||"grid-template-rows"!==e.propertyName||Y||re(!1)},children:e("ul",{role:"group",className:"min-h-0 list-none overflow-hidden ps-(--n-tree-indent)",children:e(v.Provider,{value:te||!Y,children:K})})}):null]})});
|
|
@@ -51,6 +51,13 @@ export interface TypographyProps extends Omit<React.ComponentPropsWithoutRef<'p'
|
|
|
51
51
|
* escape hatch, so it behaves the same here as on Box.
|
|
52
52
|
*/
|
|
53
53
|
render?: useRender.RenderProp;
|
|
54
|
+
/**
|
|
55
|
+
* A Tailwind utility here wins over the level's own size, leading, tracking,
|
|
56
|
+
* weight, margins and colour, with or without a variant. Only Tailwind's
|
|
57
|
+
* names are read: a class from your own stylesheet needs two classes or
|
|
58
|
+
* `!important` to beat the level.
|
|
59
|
+
*/
|
|
60
|
+
className?: string;
|
|
54
61
|
children?: React.ReactNode;
|
|
55
62
|
}
|
|
56
63
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{useRender as
|
|
1
|
+
"use client";import*as e from"react";import{useRender as t}from"@base-ui/react/use-render";import{transitionProps as n}from"../../internal/animate.js";import{COLOR as r,FONT_SIZE as a,FONT_WEIGHT as i,LETTER_SPACING as o,LINE_HEIGHT as l,MARGIN_BOTTOM as g,MARGIN_TOP as h,overriddenBy as m}from"../../internal/overrides.js";import{clampClasses as p,clampSlot as s,cx as c}from"../../internal/styles.js";const d={h1:{size:"1.875rem",leading:"1.2",tracking:"-0.02em"},h2:{size:"1.5rem",leading:"1.25",tracking:"-0.015em"},h3:{size:"1.25rem",leading:"1.3",tracking:"-0.01em"},h4:{size:"1.0625rem",leading:"1.41176",tracking:"normal"},h5:{size:"0.9375rem",leading:"1.46667",tracking:"normal"},h6:{size:"0.8125rem",leading:"1.53846",tracking:"normal"},lead:{size:"1.0625rem",leading:"1.64706",tracking:"normal"},body:{size:"0.8125rem",leading:"1.69231",tracking:"normal"},caption:{size:"0.75rem",leading:"1.5",tracking:"normal"},overline:{size:"0.6875rem",leading:"1.45455",tracking:"0.08em"}},y={h1:"semibold",h2:"semibold",h3:"semibold",h4:"semibold",h5:"semibold",h6:"semibold",lead:"regular",body:"regular",caption:"regular",overline:"medium"},b={regular:"var(--font-weight-normal, 400)",medium:"var(--font-weight-medium, 500)",semibold:"var(--font-weight-semibold, 600)",bold:"var(--font-weight-bold, 700)"},u={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",lead:"p",body:"p",caption:"span",overline:"span"},w=new Set(["caption","overline"]),f={h1:4,h2:3.5,h3:3,h4:2.5,h5:2,h6:2,lead:4,body:3,caption:2,overline:2},k=[[a,"[&.neba-typography]:text-(length:--n-type-size)","[:where(&)]:text-(length:--n-type-size)"],[l,"[&.neba-typography]:leading-(--n-type-leading)","[:where(&)]:leading-(--n-type-leading)"],[o,"[&.neba-typography]:tracking-(--n-type-tracking)","[:where(&)]:tracking-(--n-type-tracking)"],[i,"[&.neba-typography]:font-(weight:--n-type-weight)","[:where(&)]:font-(weight:--n-type-weight)"],[g,"[&.neba-typography]:mb-(--n-type-gutter)","[:where(&)]:mb-(--n-type-gutter)"]],v={start:"text-start",center:"text-center",end:"text-end",justify:"text-justify"};export const Typography=/*@__PURE__*/e.forwardRef(function Typography({level:a="body",color:i,weight:o,align:l,lines:g,gutter:z=!1,transition:x,render:j,className:N,style:T,children:$,...E},M){const R=n(x),S=e.useMemo(()=>m(N),[N]),q=d[a],A=w.has(a),B=c("neba-typography",...k.map(([e,t,n])=>S&e?n:t),z?"":S&h?"[:where(&)]:mt-0":"[&.neba-typography]:mt-0","overline"===a?"uppercase":"",l?v[l]:"","span"!==u[a]||!l&&!z||void 0!==g&&g>1?"":"block",g?p(g):"",i?S&r?"[:where(&)]:text-(--n-accent)":"[&.neba-typography]:text-(--n-accent)":A?S&r?"[:where(&)]:text-(--neba-muted-fg)":"[&.neba-typography]:text-(--neba-muted-fg)":"",R.className,N??"");return t({render:j??e.createElement(u[a]),ref:M,props:{className:B,style:{"--n-type-size":q.size,"--n-type-leading":q.leading,"--n-type-tracking":q.tracking,"--n-type-weight":b[o??y[a]],"--n-type-gutter":z?`calc(var(--spacing, 0.25rem) * ${f[a]})`:"0",...i?{"--n-accent":`var(--neba-${i}-accent)`}:null,...s(g),...R.style,...T},children:$,...E}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as i from"react";import{
|
|
1
|
+
"use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as i from"react";import{useLayoutEffectOnClient as o}from"../../internal/layout-effect.js";import{useRender as r}from"@base-ui/react/use-render";import{beginPointerDrag as s,drawnScale as a}from"../../internal/drag.js";import{actionMessages as l,useMessages as d,windowMessages as c}from"../../internal/i18n.js";import{cx as u,hasContent as h,iconClasses as m,surfaceClasses as f}from"../../internal/styles.js";import{WindowControls as g,orderControls as w,windowChrome as p,windowMetrics as b,windowSlots as x}from"../../internal/window.js";import{inertValue as v}from"../../internal/inert.js";import{useStyleDefaults as y}from"../../internal/defaults.js";function z(e,t,n){const[o,r]=i.useState(t),s=void 0!==e;return[s?e:o,i.useCallback(e=>{s||r(e),n?.(e)},[s,n])]}const M=[{edge:"n",className:"inset-x-3 top-0 h-1.5 cursor-ns-resize"},{edge:"s",className:"inset-x-3 bottom-0 h-1.5 cursor-ns-resize"},{edge:"w",className:"inset-y-3 left-0 w-1.5 cursor-ew-resize"},{edge:"e",className:"inset-y-3 right-0 w-1.5 cursor-ew-resize"},{edge:"nw",className:"top-0 left-0 size-3 cursor-nwse-resize"},{edge:"ne",className:"top-0 right-0 size-3 cursor-nesw-resize"},{edge:"sw",className:"bottom-0 left-0 size-3 cursor-nesw-resize"},{edge:"se",className:"right-0 bottom-0 size-3 cursor-nwse-resize"}],E=[];export const WindowPane=/*@__PURE__*/i.forwardRef(function WindowPane(N,S){const{os:H="macos",title:k,icon:C,actions:L,controls:j=!0,size:W="md",color:I="primary",accent:P=!1,transparency:D=0,active:T,elevation:A=2,position:O="static",draggable:R=!1,resizable:B=!1,width:X,height:$,minWidth:F=180,minHeight:Y,offset:_,defaultOffset:q,onOffsetChange:K,onResize:U,open:G,defaultOpen:J=!0,onOpenChange:Q,minimized:V,defaultMinimized:Z=!1,onMinimizedChange:ee,maximized:te,defaultMaximized:ne=!1,onMaximizedChange:ie,scroll:oe=!0,locale:re,minimizeLabel:se,maximizeLabel:ae,restoreLabel:le,closeLabel:de,resizeLabel:ce,render:ue,className:he,style:me,children:fe,...ge}=y(N,["size","locale"]),we=d(c,re),pe=i.useId(),be=d(l,re),xe=p(H),ve=b(H,W),ye=i.useId(),[ze,Me]=z(G,J,Q),[Ee,Ne]=z(V,Z,ee),[Se,He]=z(te,ne,ie),[ke,Ce]=z(_,q??{x:0,y:0},K),[Le,je]=i.useState(null),[We,Ie]=i.useState({width:X,height:$});We.width===X&&We.height===$||(Ie({width:X,height:$}),je(null));const[Pe,De]=i.useState(!0),Te=T??Pe,[Ae,Oe]=i.useState(null),[Re,Be]=i.useState(null),[Xe,$e]=i.useState(!1),[Fe,Ye]=i.useState(!1),[_e,qe]=i.useState(ze);_e!==ze&&(qe(ze),Ye(!ze)),i.useEffect(()=>{if(!Fe)return;const e=window.setTimeout(()=>Ye(!1),260);return()=>window.clearTimeout(e)},[Fe]);const Ke=i.useRef(null),Ue=i.useCallback(e=>{Ke.current=e,"function"==typeof S?S(e):S&&(S.current=e)},[S]);i.useEffect(()=>{if(void 0!==T||!ze)return;const e=Ke.current;if(!e)return;const t=e=>De(e);E.push(t);const n=n=>{const i=n.target;if(!(i instanceof Node))return;if(e.contains(i))return E.splice(E.indexOf(t),1),E.push(t),void De(!0);const o=i instanceof Element?i:i.parentElement;o?.closest(".neba-window")&&De(!1)};return document.addEventListener("pointerdown",n,!0),document.addEventListener("focusin",n,!0),()=>{document.removeEventListener("pointerdown",n,!0),document.removeEventListener("focusin",n,!0);const e=E.indexOf(t),i=e===E.length-1;E.splice(e,1),i&&E[E.length-1]?.(!0)}},[T,ze]);const Ge=i.useRef(null);function Je(e,t){if(0!==e.button)return;Ge.current?.();const n=e.currentTarget,i=e.clientX,o=e.clientY,r=Ke.current,l=r?a(r):{x:1,y:1};$e(!0);const d=()=>{Ge.current=null,$e(!1)},c=s({target:n,pointerId:e.pointerId,onMove:e=>t((e.clientX-i)/l.x,(e.clientY-o)/l.y),onEnd:d});Ge.current=()=>{c(),d()}}i.useEffect(()=>()=>Ge.current?.(),[]);const Qe={width:Math.max(0,F),height:Math.max(ve.bar,Y??ve.bar)};function Ve(e){je(e),U?.(e)}const Ze=w(H,!0===j?["minimize","maximize","close"]:!1===j?[]:j),et=Ze.includes("maximize");o(()=>{if(!Ee||null!==Ae)return;const e=Ke.current,t=e?.firstElementChild;e&&t instanceof HTMLElement&&Oe(t.offsetHeight+(e.offsetHeight-e.clientHeight))},[Ee,Ae]),i.useEffect(()=>{if(Ee||null===Re)return;const e=window.setTimeout(()=>Be(null),400);return()=>window.clearTimeout(e)},[Ee,Re]);const tt={minimize:se??we.minimize,maximize:ae??we.maximize,restore:le??we.restore,close:de??be.close},nt=e(g,{os:H,metrics:ve,controls:Ze,maximized:Se,active:Te,labels:tt,onCommand:function(e){"close"===e?Me(!1):"minimize"===e?function(e){const t=Ke.current,n=t?.firstElementChild;if(t&&n instanceof HTMLElement&&Oe(n.offsetHeight+(t.offsetHeight-t.clientHeight)),e&&void 0===(Le?.height??$)&&t)return Be(t.offsetHeight),void requestAnimationFrame(()=>Ne(!0));Ne(e)}(!Ee):He(!Se)}}),it=h(k)?e("span",{id:ye,className:"min-w-0 truncate",children:k}):null,ot=h(C)?e("span",{className:"flex shrink-0 items-center",children:C}):null,rt=t("div",{className:u("relative flex shrink-0 items-center select-none",m,R&&!Se?"cursor-grab touch-none active:cursor-grabbing":""),style:{height:ve.bar,textShadow:"var(--n-window-bar-shadow)",fontWeight:ve.weight,paddingInlineStart:ve.padX,paddingInlineEnd:ve.padEnd,gap:Math.round(.7*ve.title),fontSize:ve.title,backgroundColor:"var(--n-window-bar)",backgroundImage:"var(--n-window-bar-image)",color:"var(--n-window-bar-fg)",borderBlockEnd:xe.rule?"1px solid var(--n-window-line)":void 0},onPointerDown:function(e){if(!R||Se)return;const t={...ke},n=Ke.current,i="fixed"===O?{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}:"absolute"===O&&n?.offsetParent instanceof HTMLElement?{width:n.offsetParent.clientWidth,height:n.offsetParent.clientHeight}:null,o=n?.offsetWidth??0,r=Math.min(o,48);Je(e,(e,n)=>{const s=t.x+e,a=t.y+n;Ce(i?{x:Math.min(Math.max(s,r-o),i.width-r),y:Math.min(Math.max(a,0),Math.max(0,i.height-ve.bar))}:{x:s,y:a})})},onDoubleClick:et?()=>He(!Se):void 0,children:["start"===xe.controlsSide?nt:null,"center"===xe.titleAlign?e("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 flex items-center justify-center",style:{paddingInline:ve.controlsWidth(Ze.length)+2*ve.padX},children:t("span",{className:"flex min-w-0 items-center",style:{gap:Math.round(.5*ve.title)},children:[ot,it]})}):t(n,{children:[ot,it]}),e("span",{className:"flex-1"}),h(L)?e("span",{className:"flex shrink-0 items-center",style:{gap:Math.round(.5*ve.title)},onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:L}):null,"end"===xe.controlsSide?nt:null]}),st=Se?{left:0,top:0,width:"100%",height:"100%"}:{left:ke.x,top:ke.y,width:Le?.width??X,height:Ee?Ae??ve.bar:Le?.height??$??Re??void 0},at=r({render:ue,ref:Ue,props:{role:"group","aria-labelledby":it?ye:void 0,className:u("neba-window relative flex min-w-0 flex-col overflow-hidden",D>0?f:"",xe.glass&&0===D?"[backdrop-filter:var(--neba-blur)]":"","[transition-property:left,top,width,height,opacity,box-shadow,background-color,border-color,border-radius]","[transition-duration:var(--neba-duration-window)]","[transition-timing-function:var(--neba-ease)]","motion-reduce:[transition-duration:0ms]","data-[gesture]:[transition-property:none]",he),"data-gesture":Xe?"":void 0,inert:v(!ze),style:{opacity:ze?void 0:0,...x({os:H,color:I,accent:P,transparency:D,active:Te,elevation:A}),position:"static"===O?"relative":O,...st,borderRadius:Se?0:`${ve.radius}px ${ve.radius}px ${ve.radiusBottom}px ${ve.radiusBottom}px`,borderStyle:"solid",borderWidth:ve.frame,borderColor:"var(--n-window-line)",backgroundColor:"var(--n-window-band)",boxShadow:"var(--n-window-shadow), var(--neba-plate-glass)",...me},children:t(n,{children:[rt,e("div",{className:u("min-h-0 flex-1",oe?"overflow-auto":"overflow-hidden"),style:{backgroundColor:"var(--n-window-body)",marginInline:ve.band.side,marginBottom:ve.band.bottom,boxShadow:ve.band.side>0?"inset 0 0 0 1px rgb(0 0 0 / 0.12)":void 0},inert:v(Ee),children:fe}),!B||Se||Ee?null:e("span",{id:pe,hidden:!0,children:we.resizeHint}),!B||Se||Ee?null:M.map(t=>{const n="se"===t.edge;return e("div",{role:n?"button":void 0,tabIndex:n?0:void 0,"aria-label":n?ce??we.resize:void 0,"aria-describedby":n?pe:void 0,"aria-hidden":n?void 0:"true",className:u("absolute z-10 touch-none",t.className,n?"neba-hit":"",n?"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]":""),onPointerDown:e=>function(e,t){const n=Ke.current;if(!n||Se)return;const i={width:n.offsetWidth,height:n.offsetHeight,x:ke.x,y:ke.y},o=e.includes("e"),r=e.includes("w"),s=e.includes("n"),a=e.includes("s");Je(t,(e,t)=>{let{width:n,height:l}=i,{x:d,y:c}=i;o&&(n=Math.max(Qe.width,i.width+e)),a&&(l=Math.max(Qe.height,i.height+t)),r&&(n=Math.max(Qe.width,i.width-e),d=i.x+(i.width-n)),s&&(l=Math.max(Qe.height,i.height-t),c=i.y+(i.height-l)),Ve({width:n,height:l}),(r||s)&&Ce({x:d,y:c})})}(t.edge,e),onKeyDown:n?e=>{const t={ArrowRight:[16,0],ArrowLeft:[-16,0],ArrowDown:[0,16],ArrowUp:[0,-16]}[e.key];t&&(e.preventDefault(),function(e,t){const n=Ke.current;n&&Ve({width:Math.max(Qe.width,n.offsetWidth+e),height:Math.max(Qe.height,n.offsetHeight+t)})}(t[0],t[1]))}:void 0},t.edge)})]}),...ge}});return ze||Fe?at:null});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as t from"react";import{attachedRef as
|
|
1
|
+
"use client";import*as t from"react";import{useLayoutEffectOnClient as e}from"../internal/layout-effect.js";import{attachedRef as i,observeResize as n}from"../internal/observe.js";export function useElementSize(){const[h,r]=t.useState(null),[o]=t.useState(()=>i(r)),[s,u]=t.useState({width:0,height:0});return e(()=>{if(!h)return;const t=()=>{const t=function(t){return t instanceof HTMLElement?{width:t.offsetWidth,height:t.offsetHeight}:t.getBoundingClientRect()}(h);u(e=>e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})};return t(),n(h,t)},[h]),[o,s]}
|