neba 1.16.2 → 1.17.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/README.md +5 -5
- package/dist/a2ui/adapter-catalog.json +1 -0
- package/dist/a2ui/catalog.json +632 -145
- package/dist/a2ui/components.js +1 -1
- package/dist/a2ui/index.d.ts +22 -10
- package/dist/a2ui/index.js +1 -1
- package/dist/a2ui/schema.d.ts +8 -6
- package/dist/a2ui/schema.js +1 -1
- package/dist/components/accordion/Accordion.js +1 -1
- package/dist/components/agent-steps/AgentSteps.js +1 -1
- package/dist/components/alert/Alert.js +1 -1
- package/dist/components/anchor/Anchor.d.ts +3 -1
- package/dist/components/anchor/Anchor.js +1 -1
- package/dist/components/animate-counter/AnimateCounter.d.ts +11 -4
- package/dist/components/animate-counter/AnimateCounter.js +1 -1
- package/dist/components/animate-scramble/AnimateScramble.d.ts +6 -3
- package/dist/components/animate-scramble/AnimateScramble.js +1 -1
- package/dist/components/animate-split/AnimateSplit.d.ts +6 -3
- package/dist/components/animate-split/AnimateSplit.js +1 -1
- 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/avatar/Avatar.js +1 -1
- package/dist/components/bar-chart/BarChart.js +1 -1
- package/dist/components/bottom-navigation/BottomNavigation.js +1 -1
- package/dist/components/box/Box.js +1 -1
- package/dist/components/breadcrumb/Breadcrumb.d.ts +3 -3
- package/dist/components/breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/card/Card.js +1 -1
- package/dist/components/chat-bubble/ChatBubble.js +1 -1
- package/dist/components/chip/Chip.d.ts +4 -1
- package/dist/components/chip/Chip.js +1 -1
- package/dist/components/code-block/CodeBlock.js +1 -1
- package/dist/components/collapsible/Collapsible.js +1 -1
- package/dist/components/color-picker/ColorPicker.d.ts +3 -1
- package/dist/components/color-picker/ColorPicker.js +1 -1
- package/dist/components/combobox/Combobox.js +1 -1
- package/dist/components/command-palette/CommandPalette.js +1 -1
- package/dist/components/confirm/Confirm.js +1 -1
- package/dist/components/context-window/ContextWindow.d.ts +4 -1
- package/dist/components/context-window/ContextWindow.js +1 -1
- package/dist/components/data-list/DataList.d.ts +3 -2
- package/dist/components/data-list/DataList.js +1 -1
- package/dist/components/data-table/DataTable.d.ts +11 -5
- package/dist/components/data-table/DataTable.js +1 -1
- package/dist/components/date-range-picker/DateRangePicker.d.ts +3 -2
- package/dist/components/date-range-picker/DateRangePicker.js +1 -1
- package/dist/components/dialog/Dialog.js +1 -1
- package/dist/components/drawer/Drawer.js +1 -1
- package/dist/components/fieldset/Fieldset.js +1 -1
- package/dist/components/file-picker/FilePicker.d.ts +4 -0
- package/dist/components/file-picker/FilePicker.js +1 -1
- package/dist/components/footer/Footer.d.ts +4 -2
- package/dist/components/form/Form.d.ts +0 -14
- package/dist/components/form/Form.js +1 -1
- package/dist/components/gallery/Gallery.js +1 -1
- package/dist/components/gallery/GalleryViewer.js +1 -1
- package/dist/components/header/Header.d.ts +4 -3
- package/dist/components/heatmap-chart/HeatmapChart.js +1 -1
- package/dist/components/hover-card/HoverCard.d.ts +1 -1
- package/dist/components/how-to-steps/HowToSteps.d.ts +2 -1
- package/dist/components/how-to-steps/HowToSteps.js +1 -1
- package/dist/components/image/Image.d.ts +4 -1
- package/dist/components/image/Image.js +1 -1
- package/dist/components/inline-citation/InlineCitation.d.ts +4 -2
- package/dist/components/inline-citation/InlineCitation.js +1 -1
- package/dist/components/menu/Menu.d.ts +6 -2
- package/dist/components/menu/Menu.js +1 -1
- package/dist/components/mockup/Mockup.js +1 -1
- package/dist/components/navigation-menu/NavigationMenu.d.ts +1 -1
- package/dist/components/navigation-menu/NavigationMenu.js +1 -1
- package/dist/components/number-field/NumberField.js +1 -1
- package/dist/components/overlay/Overlay.d.ts +1 -1
- package/dist/components/page-layout/PageLayout.js +1 -1
- package/dist/components/pagination/Pagination.d.ts +3 -2
- 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/popover/Popover.js +1 -1
- package/dist/components/progress-box/ProgressBox.js +1 -1
- package/dist/components/prompt-input/PromptInput.d.ts +5 -3
- package/dist/components/prompt-input/PromptInput.js +1 -1
- package/dist/components/radio-group/RadioGroup.js +1 -1
- package/dist/components/rating/Rating.js +1 -1
- package/dist/components/reasoning/Reasoning.d.ts +7 -4
- package/dist/components/reasoning/Reasoning.js +1 -1
- package/dist/components/scatter-chart/ScatterChart.d.ts +7 -1
- package/dist/components/scatter-chart/ScatterChart.js +1 -1
- package/dist/components/scroll-area/ScrollArea.d.ts +12 -0
- package/dist/components/scroll-area/ScrollArea.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.d.ts +2 -1
- package/dist/components/select/Select.js +1 -1
- package/dist/components/sidebar/Sidebar.js +1 -1
- package/dist/components/sidebar/SidebarTrigger.js +1 -1
- package/dist/components/skeleton/Skeleton.js +1 -1
- package/dist/components/sources/Sources.d.ts +1 -1
- package/dist/components/sources/Sources.js +1 -1
- package/dist/components/stack/Stack.js +1 -1
- package/dist/components/streaming-text/StreamingText.js +1 -1
- package/dist/components/switch/Switch.d.ts +13 -2
- package/dist/components/switch/Switch.js +1 -1
- package/dist/components/switch/index.d.ts +1 -1
- package/dist/components/table/Table.d.ts +4 -2
- package/dist/components/tabs/Tabs.js +1 -1
- package/dist/components/text-field/TextField.js +1 -1
- package/dist/components/text-link/TextLink.js +1 -1
- package/dist/components/timeline-chart/TimelineChart.d.ts +6 -1
- package/dist/components/timeline-chart/TimelineChart.js +1 -1
- package/dist/components/toggle/Toggle.js +1 -1
- package/dist/components/tool-call/ToolCall.js +1 -1
- package/dist/components/tour/Tour.js +1 -1
- package/dist/components/transfer/Transfer.js +1 -1
- package/dist/components/tree-select/TreeSelect.js +1 -1
- package/dist/components/tree-view/TreeView.js +1 -1
- package/dist/components/typography/Typography.js +1 -1
- package/dist/components/visually-hidden/VisuallyHidden.d.ts +2 -2
- package/dist/components/window-pane/WindowPane.js +1 -1
- package/dist/hooks/useElementSize.d.ts +6 -2
- package/dist/hooks/useElementSize.js +1 -1
- package/dist/hooks/useMediaQuery.d.ts +3 -2
- package/dist/hooks/useOnScreen.d.ts +2 -2
- package/dist/hooks/useShortcut.d.ts +11 -3
- package/dist/hooks/useShortcut.js +1 -1
- package/dist/internal/animate.d.ts +8 -0
- package/dist/internal/animate.js +1 -1
- package/dist/internal/calendar.js +1 -1
- package/dist/internal/chart-brush.d.ts +3 -1
- package/dist/internal/chart-brush.js +1 -1
- package/dist/internal/chart-frame.d.ts +28 -2
- package/dist/internal/chart-frame.js +1 -1
- package/dist/internal/chart-line.js +1 -1
- package/dist/internal/chart.d.ts +21 -0
- package/dist/internal/chart.js +1 -1
- package/dist/internal/drag.d.ts +15 -0
- package/dist/internal/drag.js +1 -1
- package/dist/internal/drop.d.ts +12 -8
- package/dist/internal/drop.js +1 -1
- package/dist/internal/highlight.js +1 -1
- package/dist/internal/i18n.d.ts +40 -4
- package/dist/internal/i18n.js +1 -1
- package/dist/internal/icons.d.ts +3 -0
- package/dist/internal/icons.js +1 -1
- package/dist/internal/link.d.ts +27 -0
- package/dist/internal/link.js +1 -1
- package/dist/internal/new-tab.d.ts +21 -0
- package/dist/internal/new-tab.js +1 -0
- package/dist/internal/notch.d.ts +23 -1
- package/dist/internal/notch.js +1 -1
- package/dist/internal/observe.d.ts +3 -4
- package/dist/internal/picker.d.ts +21 -3
- package/dist/internal/picker.js +1 -1
- package/dist/internal/run.d.ts +7 -5
- package/dist/internal/run.js +1 -1
- package/dist/internal/search.d.ts +3 -3
- package/dist/internal/styles.d.ts +33 -1
- package/dist/internal/styles.js +1 -1
- package/dist/locales/ar.js +1 -1
- package/dist/locales/de.js +1 -1
- package/dist/locales/es.js +1 -1
- package/dist/locales/fr.js +1 -1
- package/dist/locales/hi.js +1 -1
- package/dist/locales/id.js +1 -1
- package/dist/locales/it.js +1 -1
- package/dist/locales/ja.js +1 -1
- package/dist/locales/ko.js +1 -1
- package/dist/locales/nl.js +1 -1
- package/dist/locales/pl.js +1 -1
- package/dist/locales/pt.js +1 -1
- package/dist/locales/ru.js +1 -1
- package/dist/locales/th.js +1 -1
- package/dist/locales/tr.js +1 -1
- package/dist/locales/vi.js +1 -1
- package/dist/locales/zh-hans.js +1 -1
- package/dist/locales/zh-hant.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +31 -4
- package/package.json +9 -3
|
@@ -54,9 +54,9 @@ export interface BreadcrumbProps extends Omit<React.ComponentPropsWithoutRef<'na
|
|
|
54
54
|
* Emits the trail a second time as a `BreadcrumbList`, in a
|
|
55
55
|
* `<script type="application/ld+json">` beside the markup.
|
|
56
56
|
*
|
|
57
|
-
* Off by default, because a
|
|
58
|
-
*
|
|
59
|
-
*
|
|
57
|
+
* Off by default, because a great many apps already emit theirs from an SEO
|
|
58
|
+
* layer of their own, and two lists of the same trail would be a page
|
|
59
|
+
* describing itself twice. Turn it on where this component *is* the
|
|
60
60
|
* trail: correct markup alone is not what puts a path under a search result,
|
|
61
61
|
* and the structured data is.
|
|
62
62
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import*as n from"react";import{useRender as a}from"@base-ui/react/use-render";import{safeHref as s,safeRel as l}from"../../internal/link.js";import{breadcrumbMessages as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import*as n from"react";import{useRender as a}from"@base-ui/react/use-render";import{safeHref as s,safeRel as l}from"../../internal/link.js";import{NewTabNote as i}from"../../internal/new-tab.js";import{breadcrumbMessages as o,useMessages as c}from"../../internal/i18n.js";import{ArrowRightIcon as m,ChevronIcon as u,EllipsisIcon as d}from"../../internal/icons.js";import{controlTextClasses as p,cx as f,gapClasses as h,hasContent as x,iconClasses as g,radiusClasses as b,transitionClasses as y}from"../../internal/styles.js";import{useStyleDefaults as v}from"../../internal/defaults.js";const N=/*@__PURE__*/n.createContext({size:"md",last:!1}),j={default:{xs:"gap-1",sm:"gap-1.5",md:"gap-2",lg:"gap-2.5",xl:"gap-3"},compact:{xs:"gap-0.5",sm:"gap-1",md:"gap-1",lg:"gap-1.5",xl:"gap-2"}},k={xs:b.xs,sm:b.xs,md:b.xs,lg:b.sm,xl:b.sm};const w=["chevron","arrow","slash","dot"];function C(e){return"string"==typeof e||"number"==typeof e?String(e):Array.isArray(e)?e.map(C).join(""):n.isValidElement(e)?C(e.props.children):""}function B(e,t){if(!t)return e;try{return new URL(e,t).href}catch{return e}}function I(e,t){const r=e.map((e,r)=>{const{children:n}=e.props,a=s(e.props.href);return{"@type":"ListItem",position:r+1,name:C(n),...a?{item:B(a,t)}:null}});return JSON.stringify({"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:r}).replace(/</g,"\\u003c")}export const Breadcrumb=/*@__PURE__*/n.forwardRef(function Breadcrumb(r,a){const{size:s="md",color:l="primary",density:i="default",separator:h="chevron",maxItems:x,itemsBeforeCollapse:b=1,itemsAfterCollapse:k=1,expandable:B=!0,locale:L,label:$,expandLabel:S,structuredData:_=!1,baseUrl:z,className:A,style:E,children:M,...R}=v(r,["size","density","locale"]),q=c(o,L),F=n.Children.toArray(M).filter(n.isValidElement),T=F.length,U=F.map(e=>`${e.key??""}\0${e.props.href??""}\0${C(e.props.children)}`).join(""),[V,D]=n.useState(null),H=V===U,J=n.useRef(null),O=n.useRef(!1);n.useLayoutEffect(()=>{if(!H||!O.current)return;O.current=!1;const e=J.current?.querySelectorAll(":scope > li:not([aria-hidden])")[Math.max(0,b)];e?.querySelector("a, button")?.focus()},[H,b]);const P=F.some(e=>!0===e.props.current),G=!H&&void 0!==x&&T>Math.max(x,1)&&T-b-k>1?[...F.slice(0,Math.max(0,b)),null,...F.slice(T-Math.max(0,k))]:F,K="string"==typeof(Q=h)&&w.includes(Q)?function(t){switch(t){case"chevron":return e("span",{className:"flex -rotate-90 items-center rtl:rotate-90",children:e(u,{})});case"arrow":return e("span",{className:"flex items-center rtl:rotate-180",children:e(m,{})});case"slash":return e("span",{className:"opacity-70",children:"/"});case"dot":return e("span",{className:"opacity-70",children:"·"});default:return null}}(h):h;var Q;const W=f("inline-flex items-center rounded-(--neba-radius-xs) px-0.5","text-(--neba-muted-fg)",y,g,B?f("cursor-pointer hover:bg-(--n-soft) hover:text-(--n-on-tint)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1"):"");return t("nav",{ref:a,"aria-label":$??q.label,className:f("flex",p[s],g,A),style:{"--n-accent":`var(--neba-${l}-accent)`,"--n-on-tint":`var(--neba-${l}-on-tint)`,"--n-soft":`var(--neba-${l}-soft)`,"--n-ring":`var(--neba-${l}-ring)`,...E},...R,children:[_&&T>0?e("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:I(F,z)}}):null,e("ol",{ref:J,role:"list",className:f("flex list-none flex-wrap items-center p-0",j[i][s]),children:G.map((r,a)=>t(n.Fragment,{children:[a>0?e("li",{"aria-hidden":"true",className:"flex shrink-0 items-center text-(--neba-muted-fg) select-none",children:K}):null,r?e(N.Provider,{value:{size:s,locale:L,last:!P&&a===G.length-1},children:r}):e("li",{className:"flex shrink-0 items-center",children:B?e("button",{type:"button",className:W,"aria-label":S??q.expand,onClick:e=>{O.current=e.currentTarget===document.activeElement,D(U)},children:e(d,{})}):e("span",{className:W,"aria-hidden":"true",children:e(d,{})})})]},r?r.key??a:"fold"))})]})});export const BreadcrumbItem=/*@__PURE__*/n.forwardRef(function BreadcrumbItem({href:o,onClick:c,render:m,target:u,startIcon:d,endIcon:p,current:g,disabled:b=!1,className:v,children:j,...w},C){const{size:B,locale:I,last:L}=n.useContext(N),$=s(o),S=g??L,_=Boolean($||c||m)&&!S&&!b,z=_&&Boolean($||m),A=f("inline-flex min-w-0 items-center px-1",h[B],k[B],y,b?"cursor-not-allowed text-(--neba-disabled-fg)":S?"font-medium text-(--neba-fg)":_?f("cursor-pointer text-(--neba-muted-fg)","hover:bg-(--n-soft) hover:text-(--n-on-tint)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1"):"text-(--neba-muted-fg)"),E=t(r,{children:[x(d)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:d}):null,e("span",{className:"truncate",children:j}),x(p)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:p}):null]}),M=a({render:m??e("a",{}),props:{href:$,target:u,rel:l(u,void 0),className:A,onClick:c,children:t(r,{children:[E,e(i,{target:u,locale:I})]})}});return e("li",{ref:C,className:f("flex min-w-0 items-center",v),...w,children:z?M:_?e("button",{type:"button",className:A,onClick:c,children:E}):e("span",{className:A,"aria-current":S?"page":void 0,"aria-disabled":b||void 0,children:E})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as l,Fragment as t}from"react/jsx-runtime";import*as s from"react";import{Box as n,boxPaddingXClasses as a,boxPaddingYClasses as r}from"../box/Box.js";import{cx as i,hasContent as o,metaTextClasses as c,sheetBodyClasses as d,sheetHeaderGapClasses as m,sheetSectionGapClasses as f,sheetTitleClasses as u}from"../../internal/styles.js";import{useStyleDefaults as x}from"../../internal/defaults.js";export const Card=/*@__PURE__*/s.forwardRef(function Card(s,h){const{size:p="md",density:N="default",title:y,subtitle:$,headerAction:b,footer:v,dividers:j=!1,className:k,children:g,...w}=x(s,["size","density"]),z=a[N][p],C=r[N][p],A=j?`${z} ${C}`:z,B=o(y)||o($)||o(b),F=l(t,{children:[o(y)||o($)?l("div",{className:`flex min-w-0 flex-1 flex-col ${m[p]}`,children:[o(y)?e("div",{className:`neba-title font-semibold ${u[p]}`,children:y}):null,o($)?e("div",{className:`text-(--neba-muted-fg) ${c[p]}`,children:$}):null]}):null,o(b)?e("div",{className:"
|
|
1
|
+
"use client";import{jsx as e,jsxs as l,Fragment as t}from"react/jsx-runtime";import*as s from"react";import{Box as n,boxPaddingXClasses as a,boxPaddingYClasses as r}from"../box/Box.js";import{cx as i,hasContent as o,metaTextClasses as c,sheetBodyClasses as d,sheetHeaderGapClasses as m,sheetSectionGapClasses as f,sheetTitleClasses as u}from"../../internal/styles.js";import{useStyleDefaults as x}from"../../internal/defaults.js";export const Card=/*@__PURE__*/s.forwardRef(function Card(s,h){const{size:p="md",density:N="default",title:y,subtitle:$,headerAction:b,footer:v,dividers:j=!1,className:k,children:g,...w}=x(s,["size","density"]),z=a[N][p],C=r[N][p],A=j?`${z} ${C}`:z,B=o(y)||o($)||o(b),F=l(t,{children:[o(y)||o($)?l("div",{className:`flex min-w-0 flex-1 flex-col ${m[p]}`,children:[o(y)?e("div",{className:`neba-title font-semibold ${u[p]}`,children:y}):null,o($)?e("div",{className:`text-(--neba-muted-fg) ${c[p]}`,children:$}):null]}):null,o(b)?e("div",{className:"ms-auto shrink-0",children:b}):null]}),R=[B?{key:"header",className:"flex items-start gap-3",content:F}:null,o(g)?{key:"content",className:d[p],content:g}:null,o(v)?{key:"footer",className:`flex flex-wrap items-center gap-2 ${d[p]}`,content:v}:null].filter(e=>null!==e);return e(n,{ref:h,size:p,density:N,padded:!1,className:i("flex flex-col",j?"":`${C} ${f[p]}`,k??""),...w,children:R.map((l,t)=>e("div",{className:i(A,l.className,j&&t>0?"border-t [border-color:var(--n-line)]":""),children:l.content},l.key))})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as r from"react";import{chatMessages as l,useMessages as
|
|
1
|
+
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as r from"react";import{chatMessages as l,useMessages as a}from"../../internal/i18n.js";import{CheckIcon as i,ClockIcon as t,DangerIcon as o,LinkIcon as s}from"../../internal/icons.js";import{safeHref as c,safeRel as d}from"../../internal/link.js";import{NewTabNote as m}from"../../internal/new-tab.js";import{controlSlots as p,cx as u,hasContent as f,metaTextClasses as b,radiusClasses as h,sheetBodyClasses as v,sheetHeaderGapClasses as x,srOnlyClasses as g,surfaceClasses as k,transitionClasses as y}from"../../internal/styles.js";import{useStyleDefaults as w}from"../../internal/defaults.js";const N={default:{xs:"px-2 py-1",sm:"px-2.5 py-1.5",md:"px-3 py-2",lg:"px-3.5 py-2.5",xl:"px-4 py-3"},compact:{xs:"px-1.5 py-0.5",sm:"px-2 py-1",md:"px-2.5 py-1.5",lg:"px-3 py-1.5",xl:"px-3.5 py-2"}},j={start:"[border-start-start-radius:0.25rem]",end:"[border-start-end-radius:0.25rem]"},_={solid:[k,"text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[k,"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-(--n-soft) [box-shadow:var(--n-elev)]"};const L={sending:e(t,{}),sent:e(i,{}),delivered:e(function DoubleCheckIcon(){return n("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e("path",{d:"m1.5 8.5 2.75 2.75L9.5 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M7 10.75 8.25 12l5.25-5.25",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})]})},{}),read:e(function ReadIcon(){const l=r.useId();return n("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[n("mask",{id:l,children:[e("rect",{width:"16",height:"16",fill:"white"}),n("g",{transform:"translate(2.375 1.25) scale(0.75)",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e("path",{d:"m1.5 8.5 2.75 2.75L9.5 6"}),e("path",{d:"M7 10.75 8.25 12l5.25-5.25"})]})]}),e("circle",{cx:"8",cy:"8",r:"7.25",fill:"currentColor",mask:`url(#${l})`})]})},{}),failed:e(o,{})},C={sending:"text-(--neba-muted-fg)",sent:"text-(--neba-muted-fg)",delivered:"text-(--neba-muted-fg)",read:"text-(--n-accent)",failed:"text-(--neba-danger-accent)"},z=["block overflow-hidden rounded-(--neba-radius-sm) border no-underline","[border-color:color-mix(in_oklab,currentColor_18%,transparent)]","[background-color:color-mix(in_oklab,currentColor_7%,transparent)]","hover:[background-color:color-mix(in_oklab,currentColor_12%,transparent)]","[transition-property:background-color] [transition-duration:var(--neba-duration)]","[transition-timing-function:var(--neba-ease)]","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"].join(" "),B=["shrink-0 opacity-0","[transition:opacity_var(--neba-duration)_var(--neba-ease)]","group-hover/bubble:opacity-100 group-focus-within/bubble:opacity-100","[@media(hover:none)]:opacity-100"].join(" ");export const ChatBubble=/*@__PURE__*/r.forwardRef(function ChatBubble(r,i){const{side:t="start",name:o,time:s,avatar:c,status:d,statusLabel:m,typing:k=!1,media:z,preview:D,actions:I,locale:T,variant:W="outline",size:M="md",color:P="primary",density:R="default",elevation:$=0,className:q,style:A,children:E,...F}=w(r,["size","density","variant","locale"]),G=a(l,T),H="end"===t,J=f(o)||f(s),K=k||f(E)||Boolean(D),O=["flex min-w-0 flex-col overflow-hidden",h[M],j[t],_[W],y].join(" "),Q=d?m??G[d]:"";return n("div",{ref:i,className:u("group/bubble flex w-full items-start gap-2",H?"flex-row-reverse":"",q??""),style:{...p(P,$,W),...A},...F,children:[f(c)?e("div",{className:"shrink-0",children:c}):null,n("div",{className:["flex min-w-0 max-w-[min(100%,32rem)] flex-col",x[M],H?"items-end":"items-start"].join(" "),children:[J?n("div",{className:`flex items-baseline gap-2 ${b[M]}`,children:[f(o)?e("span",{className:"font-semibold",children:o}):null,f(s)?e("span",{className:"text-(--neba-muted-fg)",children:s}):null]}):null,n("div",{className:"flex min-w-0 items-center gap-1 "+(H?"flex-row-reverse":""),children:[n("div",{className:O,children:[f(z)?e("div",{className:"[&_img]:block [&_img]:w-full [&_video]:block [&_video]:w-full",children:z}):null,K?n("div",{className:[N[R][M],"flex min-w-0 flex-col gap-2",v[M]].join(" "),children:[k?e(TypingDots,{label:G.typing}):f(E)?e("div",{className:"min-w-0 break-words whitespace-pre-line",children:E}):null,D?e(LinkPreview,{preview:D,locale:T}):null]}):null]}),f(I)?e("div",{className:B,children:I}):null]}),d?n("div",{className:["flex items-center gap-1",b[M],C[d],"[&_svg]:size-[1.15em] [&_svg]:shrink-0"].join(" "),children:[L[d],e("span",{className:g,children:Q})]}):null]})]})});function TypingDots({label:r}){return n("div",{className:"flex items-center gap-1 py-[0.35em]",role:"status",children:[[0,1,2].map(n=>e("span",{"aria-hidden":"true",className:"neba-typing-dot size-[0.45em] rounded-full",style:{"--n-i":n}},n)),e("span",{className:g,children:r})]})}function LinkPreview({preview:r,locale:l}){const{url:a,title:i,description:t,image:o,site:p,newTab:u=!1}=r,b=u?"_blank":void 0;return n("a",{href:c(a),target:b,rel:d(b,void 0),className:z,children:[o?e("img",{src:o,alt:"",loading:"lazy",decoding:"async",className:"block h-28 w-full object-cover"}):null,n("div",{className:"flex flex-col gap-0.5 p-2",children:[f(p)?n("span",{className:"flex items-center gap-1 text-[0.85em] opacity-70 [&_svg]:size-[1em] [&_svg]:shrink-0",children:[e(s,{}),e("span",{className:"truncate",children:p})]}):null,f(i)?e("span",{className:"font-semibold",children:i}):null,f(t)?e("span",{className:"line-clamp-2 text-[0.9em] opacity-80",children:t}):null,e(m,{target:b,locale:l})]})]})}
|
|
@@ -35,7 +35,10 @@ export interface ChipProps extends NebaStyleProps, Omit<React.ComponentPropsWith
|
|
|
35
35
|
* case where the page already knows its own language.
|
|
36
36
|
*/
|
|
37
37
|
locale?: string;
|
|
38
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* Accessible name of the delete button. Defaults to the `locale`'s "Remove
|
|
40
|
+
* {label}" when the chip's label is a string, and to its "Remove" otherwise.
|
|
41
|
+
*/
|
|
39
42
|
deleteLabel?: string;
|
|
40
43
|
/**
|
|
41
44
|
* Marks the chip as chosen — a filter that is on. `selected` deepens the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,Fragment as n,jsxs as l}from"react/jsx-runtime";import*as t from"react";import{actionMessages as i,useMessages as
|
|
1
|
+
"use client";import{jsx as e,Fragment as n,jsxs as l}from"react/jsx-runtime";import*as t from"react";import{actionMessages as i,fillMessage as o,useMessages as r}from"../../internal/i18n.js";import{CloseIcon as a}from"../../internal/icons.js";import{transitionProps as s}from"../../internal/animate.js";import{chipRemoveClasses as c,controlHeightClasses as d,controlSlots as m,controlTextClasses as p,disabledClasses as b,focusRingClasses as f,gapClasses as u,iconClasses as v,paddingXClasses as h,pressTransitionClasses as g,radiusClasses as x,surfaceClasses as j,transitionClasses as y}from"../../internal/styles.js";import{useStyleDefaults as w}from"../../internal/defaults.js";const N={xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"lg"},k={solid:[j,"text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[j,"border text-(--n-on-tint) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--n-on-tint) bg-(--n-soft)"},C={solid:"bg-(--n-fill-active)",outline:"bg-(--n-panel-press) [border-color:var(--n-line-hover)]",text:"bg-(--n-soft-press)"},$={solid:"hover:bg-(--n-fill-hover) active:bg-(--n-fill-active)",outline:"hover:bg-(--n-panel-hover) hover:[border-color:var(--n-line-hover)] active:bg-(--n-panel-press)",text:"hover:bg-(--n-soft-hover) active:bg-(--n-soft-press)"},z=["relative inline-flex max-w-full shrink-0 select-none items-center","align-middle font-medium leading-none whitespace-nowrap","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",y,g,v].join(" "),B=["flex min-w-0 flex-1 cursor-pointer items-center justify-center self-stretch rounded-[inherit]",f].join(" ");export const Chip=/*@__PURE__*/t.forwardRef(function Chip(t,f){const{variant:v="outline",size:g="md",color:j="primary",density:y="default",elevation:I=0,startIcon:L,endIcon:D,count:F,onDelete:R,locale:q,deleteLabel:A,transition:E,selected:G,disabled:H=!1,className:J,style:K,children:M,onClick:O,...P}=w(t,["size","density","variant","locale"]),Q=r(i,q),S=Boolean(O)&&!H,T=N[g],U=s(E),V=h[y][T],W=[z,d[T],p[T],u[T],x[T],H?b[v]:k[v],!H&&G?C[v]:"",S?$[v]:"",S?"ps-0":V,R?"pe-1":S?"pe-0":"",U.className,J??""].filter(Boolean).join(" "),X=l(n,{children:[L,null!=M&&!1!==M?e("span",{className:"min-w-0 truncate leading-[normal]",children:M}):null,D,null!=F&&!1!==F?e("span",{className:["ms-0.5 inline-flex shrink-0 items-center justify-center rounded-full px-1.5 py-px","text-[0.85em] leading-none font-semibold tabular-nums","solid"===v?"bg-(--neba-glow-on-fill) text-(--n-on-solid)":"bg-(--n-fill) text-(--n-on-solid)"].join(" "),children:F}):null]});return l("span",{ref:f,className:W,style:{...m(j,I,v),...U.style,...K},"aria-disabled":!(!H||S)||void 0,...P,children:[S?e("button",{type:"button","aria-pressed":G,className:`${B} ${u[T]} ${V}`,onClick:O,children:X}):X,R?e("button",{type:"button","aria-label":A??("string"==typeof M&&M.trim()?o(Q.removeLabel,{label:M.trim()}):Q.remove),disabled:H,className:c,onClick:R,children:e(a,{})}):null]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{CheckIcon as o,CodeIcon as l,CopyIcon as r}from"../../internal/icons.js";import{codeMessages as i,useMessages as a}from"../../internal/i18n.js";import{observeResize as s}from"../../internal/observe.js";import{canonicalLanguage as c,highlight as d,plainLines as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{CheckIcon as o,CodeIcon as l,CopyIcon as r}from"../../internal/icons.js";import{codeMessages as i,useMessages as a}from"../../internal/i18n.js";import{observeResize as s}from"../../internal/observe.js";import{canonicalLanguage as c,highlight as d,plainLines as u}from"../../internal/highlight.js";import{cx as m,hasContent as p,metaTextClasses as f,radiusClasses as x,srOnlyClasses as g,surfaceSlots as h,toLength as y,transitionClasses as v}from"../../internal/styles.js";import{useStyleDefaults as b}from"../../internal/defaults.js";export{registerLanguage}from"../../internal/highlight.js";const w={xs:"text-[0.6875rem]/[1.55]",sm:"text-[0.75rem]/[1.6]",md:"text-[0.8125rem]/[1.65]",lg:"text-[0.875rem]/[1.7]",xl:"text-[1rem]/[1.7]"},N={default:{xs:"py-2",sm:"py-3",md:"py-3.5",lg:"py-4",xl:"py-5"},compact:{xs:"py-1.5",sm:"py-2",md:"py-2.5",lg:"py-3",xl:"py-3.5"}},k={default:{xs:"px-2",sm:"px-3",md:"px-3.5",lg:"px-4",xl:"px-5"},compact:{xs:"px-1.5",sm:"px-2",md:"px-2.5",lg:"px-3",xl:"px-3.5"}},S={default:{xs:"px-2.5 py-1",sm:"px-3.5 py-1",md:"px-4 py-1.5",lg:"px-4.5 py-2",xl:"px-5.5 py-2"},compact:{xs:"px-2 py-0.5",sm:"px-2.5 py-0.5",md:"px-3 py-1",lg:"px-3.5 py-1",xl:"px-4 py-1.5"}};export const CodeBlock=/*@__PURE__*/n.forwardRef(function CodeBlock(M,T){const{code:j,language:C,theme:L="dark",size:R="md",color:A="primary",density:E="default",elevation:H=0,highlight:_=!0,toolbar:z=!0,title:F,showLanguage:K=!0,copyable:$=!0,rawToggle:B=!1,highlightLines:D,lineNumbers:I=!1,startLine:W=1,prompt:q,wrap:G=!1,maxHeight:J,fontFamily:O,fontSize:P,lineHeight:Q,letterSpacing:U,locale:V,copyLabel:X,copiedLabel:Y,rawLabel:Z,onCopy:ee,className:te,style:ne,...oe}=b(M,["size","density","locale"]),le=a(i,V),re=n.useMemo(()=>j.replace(/\r\n?/g,"\n").trimEnd(),[j]),ie=c(C),[ae,se]=n.useState(!1),[ce,de]=n.useState(null),[ue,me]=n.useState(null),pe=_&&!ae&&null!==ie;n.useEffect(()=>{if(!pe||!ie)return void me(null);let e=!1;return d(re,ie).then(t=>{e||me(t?{source:re,name:ie,lines:t}:null)},()=>{e||me(null)}),()=>{e=!0}},[re,ie,pe]);const fe=n.useMemo(()=>pe&&ue&&ue.source===re&&ue.name===ie?ue.lines:u(re),[pe,ue,re,ie]),xe=`${String(W+Math.max(fe.length-1,0)).length}ch`,ge=n.useRef(void 0),he=n.useRef(void 0),[ye,ve]=n.useState(null);n.useEffect(()=>()=>{clearTimeout(ge.current),clearTimeout(he.current)},[]);const be=W+Math.max(fe.length-1,0),we=n.useMemo(()=>function(e,t,n){const o=new Set;if(void 0===e)return o;for(const l of Array.isArray(e)?e:[e])if("number"!=typeof l)for(const e of l.split(",")){const l=/^\s*(\d+)\s*(?:-\s*(\d+)\s*)?$/.exec(e);if(!l)continue;const r=Number(l[1]),i=void 0===l[2]?r:Number(l[2]),a=Math.max(Math.min(r,i),t),s=Math.min(Math.max(r,i),n);for(let e=a;e<=s;e+=1)o.add(e)}else Number.isFinite(l)&&o.add(Math.trunc(l));return o}(D,W,be),[D,W,be]),Ne=n.useRef(null),ke=n.useRef(null),[Se,Me]=n.useState(!1);n.useEffect(()=>{const e=ke.current,t=Ne.current;if(!e||!t)return;const n=()=>Me(e.scrollWidth>e.clientWidth+1||e.scrollHeight>e.clientHeight+1);n();const o=s(e,n),l=s(t,n);return()=>{o(),l()}},[]);const Te=X??le.copy,je=Y??le.copied,Ce=Z??le.raw,Le=m("inline-flex shrink-0 cursor-pointer items-center gap-1 border-0 bg-transparent","px-1.5 py-1 text-(--n-code-dim) hover:text-(--n-code-fg) hover:bg-(--n-code-hover)",x.xs,f[R],"[&_svg]:pointer-events-none [&_svg]:size-[1.15em] [&_svg]:shrink-0",v,"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1"),Re=n.useId(),Ae=p(F)&&"string"!=typeof F&&z,Ee="string"==typeof F&&""!==F?F:ie??le.code,He=e("div",{ref:ke,role:Se?"region":void 0,"aria-label":Se&&!Ae?Ee:void 0,"aria-labelledby":Se&&Ae?Re:void 0,tabIndex:Se?0:void 0,onKeyDown:e=>{if(!("a"===e.key||"A"===e.key||!/^[a-z]$/i.test(e.key)&&"KeyA"===e.code))return;if(!e.metaKey&&!e.ctrlKey||e.altKey)return;const t=Ne.current,n="undefined"==typeof window?null:window.getSelection();if(!t||!n)return;e.preventDefault();const o=document.createRange();o.selectNodeContents(t),n.removeAllRanges(),n.addRange(o)},className:m("min-h-0 overflow-auto",N[E][R],"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:-outline-offset-2"),style:void 0===J?void 0:{maxHeight:y(J)},children:e("pre",{ref:Ne,className:m("m-0 bg-transparent p-0 font-mono",G?"w-full":"w-max min-w-full"),children:fe.map((t,o)=>{const l=W+o;return e("div",{className:m("neba-code-line",k[E][R]),"data-line":I?l:void 0,"data-mark":we.has(l)?"":void 0,"data-prompt":q&&t.length>0?q:void 0,children:e("code",{children:t.map((t,o)=>t.token?e("span",{className:t.token,children:t.text},o):e(n.Fragment,{children:t.text},o))})},o)})})});return t("div",{ref:T,className:m("neba-code flex min-w-0 flex-col overflow-hidden",x[R],"border bg-(--n-code-bg) text-(--n-code-fg) [border-color:var(--n-code-rule)]","[box-shadow:var(--n-elev)]",v,te),"data-code-theme":L,"data-code-wrap":G?"true":void 0,style:{...h(A,H),"--n-code-gutter":xe,...O?{fontFamily:O}:null,...void 0===P?null:{fontSize:y(P)},...void 0===Q?null:{lineHeight:Q},...void 0===U?null:{letterSpacing:y(U)},...ne},...oe,children:[z&&(K&&ie||$||B&&_||p(F))?t("div",{className:m("flex min-w-0 items-center gap-1 border-b [border-color:var(--n-code-rule)]",S[E][R]),children:[p(F)?e("span",{id:Re,className:m("min-w-0 truncate font-mono",f[R]),children:F}):null,K&&ie?e("span",{className:m("min-w-0 truncate font-mono tracking-wide text-(--n-code-dim) uppercase select-none",f[R]),children:ie}):null,e("span",{className:"flex-1"}),B&&_?e("button",{type:"button","aria-pressed":ae,"aria-label":Ce,title:Ce,onClick:()=>se(e=>!e),className:m(Le,ae?"text-(--n-code-fg) bg-(--n-code-hover)":""),children:e(l,{})}):null,$?t("button",{type:"button",onClick:async()=>{const e=await async function(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}const t=document.activeElement;try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.setAttribute("aria-hidden","true"),t.style.cssText="position:fixed;top:0;left:0;opacity:0;pointer-events:none",document.body.append(t),t.select();const n=document.execCommand("copy");return t.remove(),n}catch{return!1}finally{t instanceof HTMLElement&&t.isConnected&&t.focus()}}(re);clearTimeout(ge.current),clearTimeout(he.current),de(e),ve(null),he.current=setTimeout(()=>ve(e),100),ge.current=setTimeout(()=>{de(null),ve(null)},2e3),e&&ee?.(re)},className:Le,children:[e(ce?o:r,{}),e("span",{children:null===ce?Te:ce?je:le.copyFailed})]}):null]}):null,e("div",{className:m("flex min-h-0 flex-col",w[R]),children:He}),e("span",{"aria-live":"polite",className:g,children:null===ye?"":ye?je:le.copyFailed})]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as
|
|
1
|
+
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as l from"react";import{Collapsible as t}from"@base-ui/react/collapsible";import{boxPaddingXClasses as a,boxPaddingYClasses as s}from"../box/Box.js";import{ChevronIcon as i}from"../../internal/icons.js";import{collapsiblePanelClasses as o,gapClasses as r,hasContent as d,iconClasses as c,metaTextClasses as f,radiusClasses as m,sheetBodyClasses as p,sheetHeaderGapClasses as b,sheetTitleClasses as u,surfaceClasses as x,surfaceSlots as h,transitionClasses as g,clampClasses as v,clampSlot as j,disclosureChevronClasses as N,disclosureTriggerClasses as w}from"../../internal/styles.js";import{useStyleDefaults as y}from"../../internal/defaults.js";const $={solid:[x,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[x,"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"};export const Collapsible=/*@__PURE__*/l.forwardRef(function Collapsible(l,x){const{variant:C="outline",size:k="md",color:O="primary",density:B="default",elevation:z=0,open:F,defaultOpen:M=!1,onOpenChange:R,title:T,subtitle:U,lines:_,startIcon:I,action:P,trigger:q,indicator:A=!0,disabled:D=!1,padded:E=!0,hiddenUntilFound:G=!0,keepMounted:H=!1,className:J,style:K,children:L,...Q}=y(l,["size","density","variant"]),S=_?v(_):"",V=j(_),W=a[B][k],X=s[B][k];return n(t.Root,{ref:x,open:F,defaultOpen:M,onOpenChange:e=>R?.(e),disabled:D,className:["flex flex-col overflow-hidden",m[k],$[C],g,J??""].filter(Boolean).join(" "),style:{...h(O,z),...K},...Q,children:[q?e(t.Trigger,{render:q}):n("div",{className:"flex w-full items-center",children:[n(t.Trigger,{className:["flex min-w-0 flex-1 items-center text-start",w,W,X,r[k],g,c,"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]",D?"cursor-not-allowed bg-transparent text-(--neba-disabled-fg)":"cursor-pointer hover:bg-(--n-soft) data-[panel-open]:text-(--n-on-tint)"].join(" "),children:[d(I)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:I}):null,n("span",{className:`flex min-w-0 flex-1 flex-col ${b[k]}`,children:[d(T)?e("span",{className:`${S} font-semibold ${u[k]}`,style:V,children:T}):null,d(U)?e("span",{className:`${S} text-(--neba-muted-fg) ${f[k]}`,style:V,children:U}):null]}),A?e("span",{className:`${N} text-(--neba-muted-fg)`,children:e(i,{})}):null]}),d(P)?e("span",{className:`flex shrink-0 items-center ${W}`,children:P}):null]}),e(t.Panel,{hiddenUntilFound:G,keepMounted:H,className:o,children:e("div",{className:["min-w-0 text-(--neba-muted-fg)",p[k],E?W:"",E?q?X:"compact"===B?"pb-2":"pb-4":""].filter(Boolean).join(" "),children:L})})]})});
|
|
@@ -5,6 +5,8 @@ import type { NebaElevation, NebaLabelPlacement, NebaStyleProps } from '../../ty
|
|
|
5
5
|
export interface ColorPickerLabels {
|
|
6
6
|
/** The saturation/brightness square. */
|
|
7
7
|
area: string;
|
|
8
|
+
/** What its position is read as, with `{saturation}` and `{brightness}` in it. */
|
|
9
|
+
areaValue: string;
|
|
8
10
|
/** The hue rail beside it. */
|
|
9
11
|
hue: string;
|
|
10
12
|
/** The opacity rail, when `alpha` is on. */
|
|
@@ -104,7 +106,7 @@ export interface ColorPickerProps extends NebaStyleProps, Omit<React.ComponentPr
|
|
|
104
106
|
* every shade of black is the same colour and the rail would snap to red.
|
|
105
107
|
*
|
|
106
108
|
* There is no colour library under this. The conversions are in
|
|
107
|
-
* `internal/color.ts`, which is
|
|
109
|
+
* `internal/color.ts`, which is under four hundred lines of arithmetic — the whole
|
|
108
110
|
* reason no colour library comes with it.
|
|
109
111
|
*/
|
|
110
112
|
export declare const ColorPicker: React.ForwardRefExoticComponent<ColorPickerProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as r from"react";import{PickerShell as l}from"../../internal/picker.js";import{CheckIcon as n}from"../../internal/icons.js";import{colorMessages as t,useMessages as
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as r from"react";import{PickerShell as l}from"../../internal/picker.js";import{CheckIcon as n}from"../../internal/icons.js";import{colorMessages as t,fillMessage as o,useMessages as s}from"../../internal/i18n.js";import{numberFormatter as i}from"../../internal/format.js";import{checkerBackground as d,clamp as c,cssColor as u,defaultSwatches as h,formatColor as f,parseColor as p,readableInk as m}from"../../internal/color.js";import{controlTextClasses as b,cx as v,focusRingClasses as g,metaTextClasses as x,radiusClasses as w,stackGapClasses as y,surfaceSlots as k,transitionClasses as C}from"../../internal/styles.js";import{useStyleDefaults as N}from"../../internal/defaults.js";import{useFieldsetDisabled as _}from"../../internal/fieldset.js";const j={xs:"w-40",sm:"w-44",md:"w-52",lg:"w-60",xl:"w-72"},P={xs:"h-24",sm:"h-28",md:"h-32",lg:"h-40",xl:"h-48"},I={xs:"h-2.5",sm:"h-3",md:"h-3.5",lg:"h-4",xl:"h-5"},D={xs:"gap-1.5",sm:"gap-2",md:"gap-2.5",lg:"gap-3",xl:"gap-3.5"},z={xs:10,sm:12,md:14,lg:16,xl:18},A=["relative overflow-hidden border","[border-color:var(--neba-border)]","[box-shadow:var(--neba-plate-glass)]"].join(" "),T=["pointer-events-none absolute rounded-full border-2 border-white","[box-shadow:0_0_0_1px_rgba(0,0,0,0.35),0_1px_3px_rgba(0,0,0,0.4)]"].join(" ");function L(e){const a=e.currentTarget.getBoundingClientRect();return{x:0===a.width?0:c((e.clientX-a.left)/a.width,0,1),y:0===a.height?0:c((e.clientY-a.top)/a.height,0,1)}}function ColorPanel({hsv:r,alphaValue:l,onChange:t,text:s,onTextChange:h,withAlpha:b,swatches:y,editable:k,size:N,inert:_,disabled:O,labels:V,locale:q}){const S=z[N],B=i(q,{style:"percent",maximumFractionDigits:0}),E=i(q,{style:"unit",unit:"degree",unitDisplay:"long",maximumFractionDigits:0}),K=-S/2,M=u({h:r.h,s:100,v:100}),R=u(r),U=e=>({onPointerDown:a=>{_||(a.currentTarget.setPointerCapture(a.pointerId),e(a))},onPointerMove:a=>{!_&&a.currentTarget.hasPointerCapture(a.pointerId)&&e(a)}}),F=(e,a,r,l,n,t,o)=>({role:"slider",tabIndex:_?-1:0,"aria-label":e,"aria-valuemin":0,"aria-valuemax":l,"aria-valuenow":Math.round(r),"aria-valuetext":a,"aria-orientation":"horizontal","aria-disabled":_||void 0,onKeyDown:e=>{const a=function(e,a,r,l,n){const t=(e.shiftKey?10:1)*l;let o;switch(e.key){case"ArrowRight":case"ArrowUp":o=a+t;break;case"ArrowLeft":case"ArrowDown":o=a-t;break;case"PageUp":o=a+10*l;break;case"PageDown":o=a-10*l;break;case"Home":return 0;case"End":return r;default:return null}return n?(o%r+r)%r:c(o,0,r)}(e,r,l,n,t);_||null===a||(e.preventDefault(),o(a))}});return a("div",{className:v("flex flex-col",j[N],D[N]),children:[e("div",{...U(e=>{const{x:a,y:n}=L(e);t({hsv:{h:r.h,s:100*a,v:100*(1-n)},alpha:l})}),role:"slider",tabIndex:_?-1:0,"aria-label":V.area,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(r.s),"aria-valuetext":o(V.areaValue,{saturation:B.format(r.s/100),brightness:B.format(r.v/100)}),"aria-disabled":_||void 0,onKeyDown:e=>{const a=function(e,a,r){const l=e.shiftKey?10:1;switch(e.key){case"ArrowLeft":return{s:a-l,v:r};case"ArrowRight":return{s:a+l,v:r};case"ArrowUp":return{s:a,v:r+l};case"ArrowDown":return{s:a,v:r-l};case"PageUp":return{s:a,v:r+10};case"PageDown":return{s:a,v:r-10};case"Home":return{s:0,v:r};case"End":return{s:100,v:r};default:return null}}(e,r.s,r.v);!_&&a&&(e.preventDefault(),t({hsv:{h:r.h,s:c(a.s,0,100),v:c(a.v,0,100)},alpha:l}))},className:v(A,P[N],w[N],g,_?"cursor-default":"cursor-crosshair touch-none"),style:{backgroundColor:M,backgroundImage:"linear-gradient(to top, #000000, rgba(0, 0, 0, 0)), linear-gradient(to right, #ffffff, rgba(255, 255, 255, 0))"},children:e("span",{className:T,style:{width:S,height:S,left:`${r.s}%`,top:100-r.v+"%",marginLeft:K,marginTop:K,backgroundColor:R}})}),e("div",{...U(e=>t({hsv:{...r,h:360*L(e).x},alpha:l})),...F(V.hue,E.format(r.h),r.h,360,2,!0,e=>t({hsv:{...r,h:e},alpha:l})),className:v(A,I[N],"rounded-full",g,_?"cursor-default":"cursor-pointer touch-none"),style:{backgroundImage:"linear-gradient(to right, #ff0000 0%, #ffff00 16.66%, #00ff00 33.33%, #00ffff 50%, #0000ff 66.66%, #ff00ff 83.33%, #ff0000 100%)"},children:e("span",{className:T,style:{width:S,height:S,left:r.h/360*100+"%",top:"50%",marginLeft:K,marginTop:K,backgroundColor:M}})}),b?a("div",{...U(e=>t({hsv:r,alpha:L(e).x})),...F(V.alpha,B.format(l),100*l,100,1,!1,e=>t({hsv:r,alpha:e/100})),className:v(A,I[N],"rounded-full",g,_?"cursor-default":"cursor-pointer touch-none"),style:d,children:[e("span",{"aria-hidden":"true",className:"absolute inset-0",style:{backgroundImage:`linear-gradient(to right, ${u(r,0)}, ${R})`}}),e("span",{className:T,style:{width:S,height:S,left:100*l+"%",top:"50%",marginLeft:K,marginTop:K,backgroundColor:u(r,l)}})]}):null,k?a("div",{className:v("flex items-center",D[N]),children:[e("span",{"aria-hidden":"true",className:v("shrink-0 rounded-full border","[border-color:var(--neba-border)]"),style:{width:S+6,height:S+6,...d},children:e("span",{className:"block size-full rounded-full",style:{backgroundColor:u(r,l)}})}),e("input",{type:"text",value:s,readOnly:_,disabled:O,spellCheck:!1,autoComplete:"off","aria-label":V.value,onChange:e=>h(e.target.value),className:v("neba-input min-w-0 flex-1 border bg-transparent px-1.5 py-1 font-mono lowercase","[border-color:var(--neba-border)]",w.xs,x[N],"text-(--neba-fg)",C,"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1")})]}):null,y&&y.length>0?e("div",{role:"group","aria-label":V.swatches,className:"grid grid-cols-8 gap-1",children:y.map(a=>{const o=p(a),s=null!==o&&f(o.hsv,o.alpha,"hex")===f(r,l,"hex");return e("button",{type:"button",disabled:_,"aria-label":a,"aria-pressed":s,onClick:()=>{o&&t(o)},className:v("flex aspect-square items-center justify-center rounded-full border","[border-color:color-mix(in_oklab,var(--neba-fg)_18%,transparent)]","[transition:box-shadow_var(--neba-duration)_var(--neba-ease)]",g,_?"cursor-default":"cursor-pointer hover:[box-shadow:var(--neba-shadow-1)]","[&_svg]:size-3"),style:{backgroundColor:a},children:s&&o?e("span",{style:{color:m(o.hsv)},children:e(n,{})}):null},a)})}):null]})}function O(e,a){return"hex"===e?[a?"#ffffffff":"#ffffff"]:"rgb"===e?[a?"rgba(255, 255, 255, 0.55)":"rgb(255, 255, 255)"]:[a?"hsla(360, 100%, 100%, 0.55)":"hsl(360, 100%, 100%)"]}const V={h:217,s:87,v:82};export const ColorPicker=/*@__PURE__*/r.forwardRef(function ColorPicker(n,o){const{value:i,defaultValue:c="#1a58d1",onValueChange:m,format:g="hex",alpha:w=!1,swatches:C=h,inline:j=!1,editable:P=!0,label:I,labelPlacement:D,description:z,error:A,invalid:T,required:L=!1,disabled:q,readOnly:S=!1,fullWidth:B=!1,clearable:E=!1,name:K,open:M,defaultOpen:R=!1,onOpenChange:U,locale:F,labels:$,variant:H="outline",size:W="md",color:X="primary",density:Y="default",elevation:G=0,className:J,style:Q,...Z}=N(n,["size","density","variant","locale","labelPlacement"]),ee=_(q),ae=s(t,F),re=r.useMemo(()=>({...ae,...$}),[ae,$]),[le,ne]=r.useState(c),te=i??le,[oe,se]=r.useState(R),ie=M??oe,[de,ce]=r.useState(()=>p(te)??{hsv:V,alpha:1}),[ue,he]=r.useState(()=>te||""),fe=f(de.hsv,w?de.alpha:1,g),pe=""===te;r.useEffect(()=>{const e=p(te);e?f(e.hsv,w?e.alpha:1,g)!==fe&&(he(te),ce(e)):he(te)},[te,fe,w,g]);const me=(e,a)=>{ce(e);const r=f(e.hsv,w?e.alpha:1,g);he(a??r),void 0===i&&ne(r),m?.(r)},be=ee||S,ve=r.useId(),ge=r.useId(),xe=r.useId(),we=e(ColorPanel,{hsv:de.hsv,alphaValue:de.alpha,onChange:me,text:ue,onTextChange:e=>{he(e);const a=p(e);a&&me(a,e)},withAlpha:w,swatches:C,editable:P,size:W,inert:be,disabled:Boolean(ee),labels:re,locale:F}),ye=K?e("input",{type:"hidden",name:K,value:pe?"":fe,disabled:ee}):null,ke=L&&!be?e("input",{"aria-hidden":"true",tabIndex:-1,required:!0,value:pe?"":"chosen",onChange:()=>{},onInvalid:e=>e.currentTarget.parentElement?.querySelector('[role="slider"]')?.focus(),className:"pointer-events-none absolute start-0 bottom-0 size-px overflow-hidden opacity-0 [clip-path:inset(50%)]"}):null;if(j){const r=T??Boolean(A)?"danger":X,l=[z?ge:"",A?xe:""].filter(Boolean).join(" ");return a("div",{ref:o,role:"group","aria-labelledby":I?ve:void 0,"aria-describedby":l||void 0,className:v("relative flex flex-col",y[W],J),style:{...k(r,G),...Q},...Z,children:[I?e("span",{id:ve,className:v(x[W],"font-medium",ee?"text-(--neba-disabled-fg)":"text-(--neba-fg)"),children:I}):null,we,z?e("span",{id:ge,className:v(x[W],"text-(--neba-muted-fg)"),children:z}):null,A?e("span",{id:xe,className:v(x[W],"text-(--n-accent)"),children:A}):null,ye,ke]})}return e("div",{ref:o,className:B?"w-full":"inline-block",...Z,children:e(l,{variant:H,size:W,color:X,density:Y,elevation:G,style:Q,label:I,labelPlacement:D,description:z,error:A,invalid:T,required:L,disabled:ee,readOnly:S,fullWidth:B,className:J,startIcon:e("span",{"aria-hidden":"true",className:v("block size-[1.15em] shrink-0 rounded-full border","[border-color:color-mix(in_oklab,var(--neba-fg)_18%,transparent)]"),style:d,children:e("span",{className:"block size-full rounded-full",style:{backgroundColor:pe?"transparent":u(de.hsv,w?de.alpha:1)}})}),display:pe?re.empty:fe,samples:O(g,w),empty:pe,clearable:E,onClear:()=>{void 0===i&&ne(""),he(""),m?.("")},open:ie,onOpenChange:e=>{void 0===M&&se(e),U?.(e)},clearLabel:re.clear,initialFocus:!0,hiddenValues:K?[{name:K,value:pe?"":fe}]:void 0,children:e("div",{className:b[W],children:we})})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as a from"react";import{Combobox as t}from"@base-ui/react/combobox";import{Field as n}from"@base-ui/react/field";import{Chip as i}from"../chip/Chip.js";import{actionMessages as r,comboboxMessages as o,fillMessage as s,useMessages as c}from"../../internal/i18n.js";import{CheckIcon as d,ChevronIcon as m,CloseIcon as u,PlusIcon as p}from"../../internal/icons.js";import{keyHandler as b}from"../../internal/keys.js";import{FieldNotch as h,NotchFrame as f}from"../../internal/notch.js";import{chipRemoveClasses as
|
|
1
|
+
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as a from"react";import{Combobox as t}from"@base-ui/react/combobox";import{Field as n}from"@base-ui/react/field";import{Chip as i}from"../chip/Chip.js";import{actionMessages as r,comboboxMessages as o,fillMessage as s,useMessages as c}from"../../internal/i18n.js";import{CheckIcon as d,ChevronIcon as m,CloseIcon as u,PlusIcon as p}from"../../internal/icons.js";import{keyHandler as b}from"../../internal/keys.js";import{FieldNotch as h,NotchFrame as f,restEndOf as g}from"../../internal/notch.js";import{chipRemoveClasses as v,controlTextLeadingClasses as x,cx as y,disabledClasses as N,fieldFocusTransitionClasses as w,fieldHeightClasses as j,fieldReadOnlyClasses as C,fieldRestClasses as L,fieldRingClasses as I,fieldSheetClasses as S,fieldSheetDisabledClasses as z,fieldSheetReadOnlyClasses as $,gapClasses as O,hasContent as V,iconClasses as _,metaTextClasses as k,paddingXClasses as M,popupFadeClasses as P,radiusClasses as A,readOnlyFilterClasses as E,stackGapClasses as F,surfaceClasses as R,surfaceSlots as T,transitionClasses as q}from"../../internal/styles.js";import{useStyleDefaults as B}from"../../internal/defaults.js";import{fieldLight as D,fieldSpotlightSlot as G,glowClasses as H}from"../../internal/glow.js";import{useFieldsetDisabled as K}from"../../internal/fieldset.js";const W=["group relative flex w-full cursor-text items-center","[-webkit-tap-highlight-color:transparent]",q,w,_].join(" "),J={xs:"min-h-5.5 py-0",sm:"min-h-6.5 py-[2px]",md:"min-h-8 py-[3px]",lg:"min-h-10 py-[4px]",xl:"min-h-12 py-[4px]"},Q=[R,"max-h-[min(20rem,var(--available-height))] overflow-y-auto overscroll-contain","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]",P].join(" "),U=["relative flex cursor-pointer items-center gap-2 select-none","rounded-(--neba-radius-xs) py-1.5 pe-2 ps-7",q,"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(" "),X=["inline-flex h-[1lh] shrink-0 cursor-pointer items-center justify-center","rounded-(--neba-radius-xs) text-(--neba-muted-fg)","[transition:color_var(--neba-duration)_var(--neba-ease)]","hover:text-(--n-accent)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1","disabled:cursor-not-allowed disabled:text-(--neba-disabled-fg)"].join(" ");function Y(e){return null==e?[]:Array.isArray(e)?e.slice():[e]}export function Combobox(w){const{variant:_="outline",size:P="md",color:R="primary",density:q="default",elevation:Z=0,items:ee,multiple:le,value:ae,defaultValue:te,onValueChange:ne,filter:ie,onInputValueChange:re,allowCustom:oe=!0,customLabel:se,clearable:ce=!1,locale:de,emptyMessage:me,limit:ue,placeholder:pe,label:be,labelPlacement:he="top",description:fe,error:ge,invalid:ve,startIcon:xe,fullWidth:ye=!1,disabled:Ne,readOnly:we=!1,required:je=!1,name:Ce,open:Le,defaultOpen:Ie,onOpenChange:Se,clearLabel:ze,openLabel:$e,removeLabel:Oe,inputRef:Ve,shortcuts:_e,id:ke,className:Me,classNames:Pe,style:Ae,"aria-label":Ee,"aria-labelledby":Fe,...Re}=B(w,["size","density","variant","locale","labelPlacement"]),Te=K(Ne),qe=!Te&&!we,Be=c(o,de),De=c(r,de),Ge=Oe??(e=>s(Be.remove,{label:e})),He=V(ge),Ke=ve??He,We=Ke?"danger":R,Je=!0===le,Qe=a.useMemo(()=>ee.map(e=>({value:e.value,label:e.label??String(e.value),disabled:e.disabled})),[ee]),[Ue,Xe]=a.useState(()=>Y(te)),Ye=void 0===ae?Ue:Y(ae),[Ze,el]=a.useState(""),ll=a.useMemo(()=>new Map(Qe.map(e=>[e.value,e])),[Qe]),al=a.useCallback(e=>ll.get(e)??{value:e,label:String(e),custom:!0},[ll]),tl=Ze.trim(),nl=tl.toLocaleLowerCase(),il=""===tl||Qe.some(e=>e.label.toLocaleLowerCase()===nl||String(e.value).toLocaleLowerCase()===nl)||Ye.some(e=>String(e).toLocaleLowerCase()===nl),rl=!oe||we||Te||il?null:tl,ol=t.useFilter({locale:de}),sl=null!==rl&&void 0!==ue&&ue>-1,cl=a.useMemo(()=>{if(null===rl)return Qe;const e={value:rl,label:rl,custom:!0};if(!sl)return[...Qe,e];return[...(!1===ie?Qe:Qe.filter(e=>ie?ie(e,rl):ol.contains(e.label,rl))).slice(0,ue),e]},[Qe,rl,sl,ie,ol,ue]),dl=Je?Ye.map(al):Ye.length>0?al(Ye[0]):null;const ml=M[q][P],ul="top"!==he&&V(be),pl=ul&&"float"===he&&!V(xe),bl=[W,x[P],A[P],O[P],Je?J[P]:j[P],`${ml} pe-1.5`,ul?"":I,Te?(ul?z:N)[_]:we?ul?`${$[_]} ${E}`:C[_]:`${(ul?S:L)[_]} ${H}`,Pe?.shell].filter(Boolean).join(" "),hl=["neba-input min-w-0 flex-1 self-stretch bg-transparent [font:inherit] text-inherit","[outline:none]","placeholder:text-(--neba-muted-fg)","caret-(--n-accent) selection:bg-(--n-soft-press)","disabled:cursor-not-allowed",pl?"neba-float-control":"",Pe?.control].filter(Boolean).join(" "),fl=l=>e(t.Input,{ref:Ve,"aria-label":Ee,"aria-labelledby":Fe,onKeyDown:b(_e),placeholder:pl?pe||" ":pe,className:Je?`${hl} min-w-16 ${l?"ms-1.5":""}`:hl}),gl=l(t.InputGroup,{className:bl,...D(qe),children:[xe?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:xe}):null,Je?e(t.Chips,{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:e(t.Value,{children:n=>l(a.Fragment,{children:[n.map(l=>e(t.Chip,{render:e(i,{variant:"outline",size:P,color:We,density:"compact",disabled:Te,className:Pe?.chip,endIcon:we||Te?null:e(t.ChipRemove,{"aria-label":Ge(l.label),className:v,children:e(u,{})})}),children:l.label},String(l.value))),fl(n.length>0)]})})}):fl(!1),ce&&!we?e(t.Clear,{"aria-label":ze??De.clear,className:X,children:e(u,{})}):null,e(t.Trigger,{"aria-label":"string"==typeof be?void 0:$e??Be.open,className:X,children:e(t.Icon,{className:["flex items-center","[transition:rotate_var(--neba-duration)_var(--neba-ease)]","data-[popup-open]:rotate-180"].join(" "),children:e(m,{})})}),ul?e(h,{label:be,variant:_,disabled:Te,readOnly:we,rests:pl,empty:Je?0===Ye.length&&""===Ze:void 0,labelClassName:Pe?.label}):null]});return l(n.Root,{disabled:Te,invalid:Ke,className:y("flex-col align-top",F[P],ye?"flex w-full":"inline-flex",Me??""),style:{...T(We,Z),...qe?G:void 0,...Ae},...Re,children:[be&&!ul?e(n.Label,{className:y(k[P],"font-medium",Te?"text-(--neba-disabled-fg)":"text-(--neba-fg)",Pe?.label),children:be}):null,l(t.Root,{id:ke,name:Ce,items:cl,multiple:Je,value:dl,onValueChange:e=>{!function(e){void 0===ae&&Xe(e),ne?.(Je?e:e[0]??null)}((null===e?[]:Array.isArray(e)?e:[e]).map(e=>e.value))},onInputValueChange:e=>{el(e),re?.(e)},open:Le,defaultOpen:Ie,onOpenChange:e=>Se?.(e),autoHighlight:!0,itemToStringLabel:e=>e.label,itemToStringValue:e=>String(e.value),isItemEqualToValue:(e,l)=>e.value===l.value,limit:sl?-1:ue,filter:sl||!1===ie?null:ie?(e,l)=>!0===e.custom||ie(e,l):void 0,disabled:Te,readOnly:we,required:je,children:[ul?e(f,{label:be,size:P,density:q,variant:_,rests:pl,restEnd:g(P,ce&&!we?[1.2,1.2]:[1.2]),labelClassName:Pe?.label,children:gl}):gl,e(t.Portal,{children:e(t.Positioner,{className:"neba-portal z-(--neba-z-portal) [outline:none]",sideOffset:6,children:l(t.Popup,{className:y(Q,A[P],x[P],Pe?.popup),style:T(We,3),children:[e(t.Empty,{className:"px-2 py-1.5 text-(--neba-muted-fg) empty:hidden",children:me??Be.empty}),e(t.List,{children:n=>e(t.Item,{value:n,disabled:n.disabled,className:y(U,Pe?.item),children:n.custom?l(a.Fragment,{children:[e("span",{className:"absolute start-1.5 flex size-4 items-center justify-center text-(--n-accent) [&_svg]:size-4",children:e(p,{})}),e("span",{className:"truncate",children:se?se(n.label):s(Be.add,{label:n.label})})]}):l(a.Fragment,{children:[e(t.ItemIndicator,{className:"absolute start-1.5 flex size-4 items-center justify-center",children:e(d,{})}),e("span",{className:"truncate",children:n.label})]})},`${n.custom?"custom:":""}${String(n.value)}`)})]})})})]}),fe?e(n.Description,{className:y(k[P],"text-(--neba-muted-fg)",Pe?.description),children:fe}):null,e(n.Error,He?{match:!0,className:y(k[P],"text-(--n-accent)",Pe?.error),children:ge}:{className:y(k[P],"text-(--n-accent)",Pe?.error)})]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{Autocomplete as l}from"@base-ui/react/autocomplete";import{Dialog as n}from"@base-ui/react/dialog";import{Shortcut as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{Autocomplete as l}from"@base-ui/react/autocomplete";import{Dialog as n}from"@base-ui/react/dialog";import{Shortcut as s}from"../shortcut/Shortcut.js";import{useShortcut as o}from"../../hooks/useShortcut.js";import{commandMessages as r,useMessages as i}from"../../internal/i18n.js";import{searchHaystack as c,searchText as m}from"../../internal/search.js";import{controlTextLeadingClasses as d,cx as p,hasContent as u,metaTextClasses as h,popupFadeClasses as x,radiusClasses as b,surfaceClasses as f,surfaceSlots as g,toLength as v}from"../../internal/styles.js";import{useStyleDefaults as y}from"../../internal/defaults.js";const w=["fixed inset-0 z-(--neba-z-portal) bg-(--neba-scrim)","[backdrop-filter:blur(2px)]",x].join(" "),N=[f,"relative flex w-full flex-col overflow-hidden","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]",x].join(" "),k={xs:"max-w-sm",sm:"max-w-md",md:"max-w-xl",lg:"max-w-2xl",xl:"max-w-3xl"},j={xs:"h-9",sm:"h-10",md:"h-12",lg:"h-14",xl:"h-16"},z={xs:"py-1",sm:"py-1.5",md:"py-2",lg:"py-2.5",xl:"py-3"},C={xs:"px-2.5",sm:"px-3",md:"px-3.5",lg:"px-4",xl:"px-5"},S=["flex cursor-pointer items-center gap-3 select-none","[transition:background-color_var(--neba-duration)_var(--neba-ease)]","data-[highlighted]:bg-(--n-soft) data-[highlighted]:text-(--n-on-tint)","data-[disabled]:cursor-not-allowed data-[disabled]:text-(--neba-disabled-fg)"].join(" ");function M(e){return c([e.label,e.group,...e.keywords??[]])}export function CommandPalette(c){const{items:x,open:f,defaultOpen:O=!1,onOpenChange:$,onSelect:P,shortcut:V="Mod+K",width:_,maxHeight:E=320,locale:G,placeholder:H,emptyMessage:I,label:L,size:R="md",color:T="primary",density:W="default",className:B,classNames:D}=y(c,["size","density","locale"]),F=i(r,G),[K,q]=a.useState(O),[A,J]=a.useState(""),Q=f??K,[U,X]=a.useState(Q);Q!==U&&(X(Q),Q||J(""));const Y=a.useCallback(e=>{void 0===f&&q(e),$?.(e)},[f,$]);o(V,()=>{Q||Y(!0)},{ignoreWhileTyping:!1});const Z=a.useMemo(()=>x.map(M),[x]),ee=a.useMemo(()=>{const e=m(A);return""===e?x:x.filter((t,a)=>Z[a].includes(e))},[x,Z,A]),{groups:te,order:ae}=a.useMemo(()=>{const e=[],t=new Map;return ee.forEach((a,l)=>{t.set(a,l);const n=e[e.length-1];n&&n.value===a.group?n.items.push(a):e.push({key:`${e.length}:${a.group??""}`,value:a.group,items:[a]})}),{groups:e,order:t}},[ee]),le=v(_),ne=v(E);return e(n.Root,{open:Q,onOpenChange:Y,children:t(n.Portal,{children:[e(n.Backdrop,{className:p("neba-portal",w,D?.backdrop)}),e(n.Viewport,{className:p("neba-portal fixed inset-0 z-(--neba-z-portal) flex justify-center p-4 pt-[12vh]",D?.viewport),children:e(n.Popup,{"aria-label":L??F.label,className:p(N,b[R],d[R],void 0===le?k[R]:"","self-start",B),style:{...g(T,3),...void 0===le?null:{maxWidth:le}},children:t(l.Root,{open:!0,mode:"list",items:te,filter:null,value:A,onValueChange:e=>J(e),onOpenChange:(e,t)=>{e||"escape-key"!==t.reason||Y(!1)},itemToStringValue:e=>e.label,children:[e("div",{className:`flex shrink-0 items-center border-b [border-color:var(--n-line)] ${C[R]}`,children:e(l.Input,{autoFocus:!0,placeholder:H??F.search,className:p("neba-input min-w-0 flex-1 bg-transparent [font:inherit] text-inherit [outline:none]","placeholder:text-(--neba-muted-fg) caret-(--n-accent)",j[R],D?.input)})}),e(l.List,{className:p("min-h-0 flex-1 overflow-y-auto overscroll-contain p-1",D?.list),style:{maxHeight:ne},children:a=>t(l.Group,{items:a.items,children:[a.value?e(l.GroupLabel,{className:p(C[R],"pt-2 pb-1 font-medium text-(--neba-muted-fg)",h[R],D?.group),children:a.value}):null,e(l.Collection,{children:a=>t(l.Item,{index:ae.get(a),value:a,disabled:a.disabled,onClick:()=>(e=>{e.disabled||(e.onSelect?.(),P?.(e),Y(!1))})(a),className:p(S,b[R],C[R],z["compact"===W?"xs":R],D?.item),children:[u(a.icon)?e("span",{className:"flex h-[1lh] shrink-0 items-center [&_svg]:size-[1.15em]",children:a.icon}):null,t("span",{className:"flex min-w-0 flex-1 flex-col",children:[e("span",{className:"truncate",children:a.label}),u(a.description)?e("span",{className:`truncate text-(--neba-muted-fg) ${h[R]}`,children:a.description}):null]}),a.shortcut?e(s,{size:"xs",keys:a.shortcut,className:"shrink-0"}):null]},a.value)})]},a.key)}),e(l.Empty,{className:p(C[R],"py-6 text-center text-(--neba-muted-fg)",h[R],D?.empty),children:I??F.empty})]})})})]})})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,Fragment as t,jsxs as
|
|
1
|
+
"use client";import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import{DefaultsContext as r}from"../../internal/defaults.js";import*as o from"react";import{Button as i}from"../button/Button.js";import{Dialog as l}from"../dialog/Dialog.js";import{confirmMessages as s,useMessages as c}from"../../internal/i18n.js";const a=/*@__PURE__*/o.createContext(null);export function ConfirmProvider({children:u,defaults:m}){const[d,f]=o.useState([]),p=o.useRef(null),C=o.useRef(null),h=o.useRef(null),[v,x]=o.useState(void 0),[b,g]=o.useState(0),j=o.useRef(0),w=d[0];w&&w.options!==v&&(x(w.options),g(w.id));const y=o.useCallback(e=>new Promise(t=>{p.current||(p.current=document.activeElement instanceof HTMLElement?document.activeElement:null),j.current+=1;const n=j.current;f(r=>[...r,{id:n,options:"string"==typeof e?{title:e}:e,settle:t}])}),[]),E=e=>{w&&(w.settle(e),f(e=>e.slice(1)))},P={...m,...v},R=o.useContext(r),k=c(s,P.locale??R?.locale),F="danger"===P.color&&!P.alert;return n(a.Provider,{value:y,children:[u,e(l,{open:void 0!==w,onOpenChange:e=>{e||E(!0===P.alert)},size:P.size??"sm",color:P.color??"primary",width:P.width,title:P.title,description:P.description,dismissible:P.dismissible??!0,showClose:!1,role:"alertdialog",initialFocus:F?C:h,finalFocus:()=>{const e=p.current;return 0===d.length&&(p.current=null),!e?.isConnected||e},actions:n(t,{children:[P.alert?null:e(i,{ref:C,variant:"text",color:"secondary",onClick:()=>E(!1),children:P.cancelLabel??k.cancel}),e(i,{ref:h,variant:"solid",color:P.color??"primary",onClick:()=>E(!0),children:P.confirmLabel??k.confirm})]})},b)]})}export function useConfirm(){const e=o.useContext(a);if(!e)throw new Error("neba: useConfirm() needs a <ConfirmProvider> above it.");return e}
|
|
@@ -92,7 +92,10 @@ export interface ContextWindowProps extends Omit<React.ComponentPropsWithoutRef<
|
|
|
92
92
|
* other; and the money underneath is a third unit again.
|
|
93
93
|
*
|
|
94
94
|
* Base UI's Meter owns the semantics — `role="meter"`, the value and the range
|
|
95
|
-
* — so the reading is announced as a reading rather than as a picture.
|
|
95
|
+
* — so the reading is announced as a reading rather than as a picture. The
|
|
96
|
+
* meter is the ring, the label and the count and nothing else: a meter's
|
|
97
|
+
* children are presentational, so a split inside it stopped being a list, and a
|
|
98
|
+
* link a caller put under it stopped being a link.
|
|
96
99
|
*
|
|
97
100
|
* The four parts take the first four chart palette slots rather than four
|
|
98
101
|
* colour families, and that is deliberate: input and output are *entities*,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as s from"react";import{Meter as r}from"@base-ui/react/meter";import{contextMessages as t,fillMessage as l,useMessages as n}from"../../internal/i18n.js";import{numberFormatter as i}from"../../internal/format.js";import{progressFraction as o,progressSlots as c,thresholdColor as m}from"../../internal/progress.js";import{cx as d,gapClasses as f,hasContent as u,metaTextClasses as x,sheetTitleClasses as h,stackGapClasses as p}from"../../internal/styles.js";import{useStyleDefaults as b}from"../../internal/defaults.js";const k=[{key:"input",slot:1},{key:"output",slot:2},{key:"reasoning",slot:3},{key:"cached",slot:4}],g={xs:26,sm:30,md:36,lg:44,xl:54},y={xs:3,sm:3.5,md:4,lg:5,xl:6},N={xs:"size-1.5",sm:"size-2",md:"size-2",lg:"size-2.5",xl:"size-3"};export const ContextWindow=/*@__PURE__*/s.forwardRef(function ContextWindow(s,v){const{max:w,used:j,tokens:z,cost:$,currency:D="USD",thresholds:W,label:_,breakdown:C=!0,size:L="md",color:M="primary",locale:R,labels:V,classNames:A,className:B,style:F,children:I,...P}=b(s,["size","locale"]),S={...n(t,R),...V},T=k.filter(({key:e})=>"number"==typeof z?.[e]),U=j??T.reduce((e,{key:a})=>"cached"===a?e:e+(z?.[a]??0),0),q=o(U,0,w),E=m(U,M,W),G=i(R,{notation:"compact",maximumFractionDigits:1}),H=i(R,{style:"currency",currency:D}),J=l(S.usage,{used:G.format(U),max:G.format(w)}),K=g[L],O=K/2,Q=y[L],X=O-Q/2,Y=2*Math.PI*X;return a(
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as s from"react";import{Meter as r}from"@base-ui/react/meter";import{contextMessages as t,fillMessage as l,useMessages as n}from"../../internal/i18n.js";import{numberFormatter as i}from"../../internal/format.js";import{progressFraction as o,progressSlots as c,thresholdColor as m}from"../../internal/progress.js";import{cx as d,gapClasses as f,hasContent as u,metaTextClasses as x,sheetTitleClasses as h,stackGapClasses as p}from"../../internal/styles.js";import{useStyleDefaults as b}from"../../internal/defaults.js";const k=[{key:"input",slot:1},{key:"output",slot:2},{key:"reasoning",slot:3},{key:"cached",slot:4}],g={xs:26,sm:30,md:36,lg:44,xl:54},y={xs:3,sm:3.5,md:4,lg:5,xl:6},N={xs:"size-1.5",sm:"size-2",md:"size-2",lg:"size-2.5",xl:"size-3"};export const ContextWindow=/*@__PURE__*/s.forwardRef(function ContextWindow(s,v){const{max:w,used:j,tokens:z,cost:$,currency:D="USD",thresholds:W,label:_,breakdown:C=!0,size:L="md",color:M="primary",locale:R,labels:V,classNames:A,className:B,style:F,children:I,...P}=b(s,["size","locale"]),S={...n(t,R),...V},T=k.filter(({key:e})=>"number"==typeof z?.[e]),U=j??T.reduce((e,{key:a})=>"cached"===a?e:e+(z?.[a]??0),0),q=o(U,0,w),E=m(U,M,W),G=i(R,{notation:"compact",maximumFractionDigits:1}),H=i(R,{style:"currency",currency:D}),J=l(S.usage,{used:G.format(U),max:G.format(w)}),K=g[L],O=K/2,Q=y[L],X=O-Q/2,Y=2*Math.PI*X;return a("div",{ref:v,className:d("flex w-full flex-col",p[L],B??""),style:{...c(E),...F},...P,children:[a("div",{className:d("flex items-center",f[L]),children:[a(r.Root,{value:U,min:0,max:w,getAriaValueText:()=>J,className:d("flex min-w-0 flex-1 items-center",f[L]),children:[a("svg",{className:d("shrink-0",A?.ring??""),width:K,height:K,viewBox:`0 0 ${K} ${K}`,fill:"none","aria-hidden":"true",children:[e("circle",{cx:O,cy:O,r:X,stroke:"var(--n-soft)",strokeWidth:Q}),e("circle",{cx:O,cy:O,r:X,stroke:"var(--n-fill)",strokeWidth:Q,strokeLinecap:"round",strokeDasharray:Y,strokeDashoffset:Y*(1-(q??0)),transform:`rotate(-90 ${O} ${O})`,className:"[transition:stroke-dashoffset_var(--neba-duration-fill)_var(--neba-ease),stroke_var(--neba-duration)_var(--neba-ease)]"})]}),a("div",{className:d("flex min-w-0 flex-1 flex-col",A?.label??""),children:[e(r.Label,{className:d("min-w-0 truncate font-medium text-(--neba-fg)",x[L]),children:u(_)?_:S.label}),e(r.Value,{className:d("min-w-0 truncate tabular-nums text-(--neba-fg)",h[L]),children:()=>J})]})]}),"number"==typeof $?a("div",{className:"flex shrink-0 flex-col items-end",children:[e("span",{className:d("text-(--neba-muted-fg)",x[L]),children:S.cost}),e("span",{className:d("tabular-nums text-(--neba-fg)",h[L]),children:H.format($)})]}):null]}),C&&T.length>0?e("ul",{className:d("m-0 flex list-none flex-wrap gap-x-4 gap-y-1 p-0",x[L],A?.breakdown??""),children:T.map(({key:s,slot:r})=>a("li",{className:"flex items-center gap-1.5",children:[e("span",{"aria-hidden":"true",className:d("shrink-0 rounded-[2px]",N[L]),style:{background:`var(--neba-chart-${r})`}}),e("span",{className:"text-(--neba-muted-fg)",children:S[s]}),e("span",{className:"tabular-nums text-(--neba-fg)",children:G.format(z?.[s]??0)})]},s))}):null,I]})});
|
|
@@ -13,8 +13,9 @@ export interface DataListProps extends Omit<React.ComponentPropsWithoutRef<'dl'>
|
|
|
13
13
|
orientation?: NebaOrientation;
|
|
14
14
|
/**
|
|
15
15
|
* How wide the label column is when `horizontal`. A number of pixels or any
|
|
16
|
-
* CSS length. Left out, it is as wide as the widest label
|
|
17
|
-
* keeps every value in the list starting at the same place
|
|
16
|
+
* CSS length. Left out, it is as wide as the widest label, up to half the
|
|
17
|
+
* list — which keeps every value in the list starting at the same place, and
|
|
18
|
+
* wraps a long label rather than pushing the values off a narrow screen.
|
|
18
19
|
*/
|
|
19
20
|
labelWidth?: number | string;
|
|
20
21
|
/** Draws a hairline between the rows. @default false */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,Fragment as n,jsxs as e}from"react/jsx-runtime";import*as d from"react";import{controlTextLeadingClasses as p,hasContent as o,metaTextClasses as a,toLength as l}from"../../internal/styles.js";import{useStyleDefaults as r}from"../../internal/defaults.js";const f=/*@__PURE__*/d.createContext({size:"md",density:"default",orientation:"horizontal"}),
|
|
1
|
+
"use client";import{jsx as t,Fragment as n,jsxs as e}from"react/jsx-runtime";import*as d from"react";import{controlTextLeadingClasses as p,hasContent as o,metaTextClasses as a,toLength as l}from"../../internal/styles.js";import{useStyleDefaults as r}from"../../internal/defaults.js";const f=/*@__PURE__*/d.createContext({size:"md",density:"default",orientation:"horizontal"}),s={default:{xs:"gap-x-3",sm:"gap-x-4",md:"gap-x-5",lg:"gap-x-6",xl:"gap-x-8"},compact:{xs:"gap-x-2",sm:"gap-x-2.5",md:"gap-x-3",lg:"gap-x-4",xl:"gap-x-5"}},m={default:{xs:"gap-y-2",sm:"gap-y-2.5",md:"gap-y-3",lg:"gap-y-3.5",xl:"gap-y-4"},compact:{xs:"gap-y-1",sm:"gap-y-1.5",md:"gap-y-2",lg:"gap-y-2",xl:"gap-y-2.5"}},y=["[&>dt:nth-of-type(n+2)]:border-t [&>dd:nth-of-type(n+2)]:border-t","[&>dt]:[border-color:var(--neba-border)] [&>dd]:[border-color:var(--neba-border)]"].join(" "),i={default:{xs:"[&>dt:nth-of-type(n+2)]:pt-2 [&>dd:nth-of-type(n+2)]:pt-2",sm:"[&>dt:nth-of-type(n+2)]:pt-2.5 [&>dd:nth-of-type(n+2)]:pt-2.5",md:"[&>dt:nth-of-type(n+2)]:pt-3 [&>dd:nth-of-type(n+2)]:pt-3",lg:"[&>dt:nth-of-type(n+2)]:pt-3.5 [&>dd:nth-of-type(n+2)]:pt-3.5",xl:"[&>dt:nth-of-type(n+2)]:pt-4 [&>dd:nth-of-type(n+2)]:pt-4"},compact:{xs:"[&>dt:nth-of-type(n+2)]:pt-1 [&>dd:nth-of-type(n+2)]:pt-1",sm:"[&>dt:nth-of-type(n+2)]:pt-1.5 [&>dd:nth-of-type(n+2)]:pt-1.5",md:"[&>dt:nth-of-type(n+2)]:pt-2 [&>dd:nth-of-type(n+2)]:pt-2",lg:"[&>dt:nth-of-type(n+2)]:pt-2 [&>dd:nth-of-type(n+2)]:pt-2",xl:"[&>dt:nth-of-type(n+2)]:pt-2.5 [&>dd:nth-of-type(n+2)]:pt-2.5"}},h={default:{xs:"[&>dt:nth-of-type(n+2)]:mt-2",sm:"[&>dt:nth-of-type(n+2)]:mt-2.5",md:"[&>dt:nth-of-type(n+2)]:mt-3",lg:"[&>dt:nth-of-type(n+2)]:mt-3.5",xl:"[&>dt:nth-of-type(n+2)]:mt-4"},compact:{xs:"[&>dt:nth-of-type(n+2)]:mt-1",sm:"[&>dt:nth-of-type(n+2)]:mt-1.5",md:"[&>dt:nth-of-type(n+2)]:mt-2",lg:"[&>dt:nth-of-type(n+2)]:mt-2",xl:"[&>dt:nth-of-type(n+2)]:mt-2.5"}},x={default:{xs:"[&>dt:nth-of-type(n+2)]:pt-2",sm:"[&>dt:nth-of-type(n+2)]:pt-2.5",md:"[&>dt:nth-of-type(n+2)]:pt-3",lg:"[&>dt:nth-of-type(n+2)]:pt-3.5",xl:"[&>dt:nth-of-type(n+2)]:pt-4"},compact:{xs:"[&>dt:nth-of-type(n+2)]:pt-1",sm:"[&>dt:nth-of-type(n+2)]:pt-1.5",md:"[&>dt:nth-of-type(n+2)]:pt-2",lg:"[&>dt:nth-of-type(n+2)]:pt-2",xl:"[&>dt:nth-of-type(n+2)]:pt-2.5"}};export function DataListItem({label:l,children:r}){const{size:s,orientation:m}=d.useContext(f);return e(n,{children:[t("dt",{className:["min-w-0 text-(--neba-muted-fg)",a[s],"vertical"===m?"mb-0.5":"py-px"].join(" "),children:l}),t("dd",{className:`m-0 min-w-0 text-(--neba-fg) ${p[s]}`,children:o(r)?r:null})]})}export const DataList=/*@__PURE__*/d.forwardRef(function DataList(n,e){const{orientation:p="horizontal",labelWidth:o,dividers:a=!1,size:c="md",density:g="default",className:b,style:u,children:v,...j}=r(n,["size","density"]),z=d.useMemo(()=>({size:c,density:g,orientation:p}),[c,g,p]),$=l(o);return t(f.Provider,{value:z,children:t("dl",{ref:e,className:["m-0 min-w-0","vertical"===p?"flex flex-col":"grid [grid-template-columns:var(--n-label)_minmax(0,1fr)] items-baseline","vertical"===p?h[g][c]:`${s[g][c]} ${m[g][c]}`,a?"vertical"===p?`[&>dt:nth-of-type(n+2)]:border-t [&>dt]:[border-color:var(--neba-border)] ${x[g][c]}`:`${y} ${i[g][c]}`:"",b??""].filter(Boolean).join(" "),style:{"--n-label":$??"fit-content(50%)",...u},...j,children:v})})});
|
|
@@ -295,7 +295,11 @@ export interface DataTableProps<Row> extends NebaStyleProps, Omit<React.Componen
|
|
|
295
295
|
* @default false
|
|
296
296
|
*/
|
|
297
297
|
checkboxes?: boolean;
|
|
298
|
-
/**
|
|
298
|
+
/**
|
|
299
|
+
* Fires on every press of a row, after the press has changed the selection. A
|
|
300
|
+
* press on the row's own tick or inside an open cell editor is not a press on
|
|
301
|
+
* the row.
|
|
302
|
+
*/
|
|
299
303
|
onRowClick?: (row: Row, index: number, event: React.MouseEvent<HTMLTableRowElement>) => void;
|
|
300
304
|
/** Fires on a double-click, and on Enter. Opening the row is what this is. */
|
|
301
305
|
onRowActivate?: (row: Row, index: number) => void;
|
|
@@ -402,10 +406,12 @@ export interface DataTableProps<Row> extends NebaStyleProps, Omit<React.Componen
|
|
|
402
406
|
* The language the table's own words are in — the search field's placeholder,
|
|
403
407
|
* the ticks' labels, the footer's count.
|
|
404
408
|
*
|
|
405
|
-
* It is also what the default sort compares strings with
|
|
406
|
-
*
|
|
407
|
-
*
|
|
408
|
-
*
|
|
409
|
+
* It is also what the default sort compares strings with, what a date in a
|
|
410
|
+
* column without `render` is written in, and what the footer's counts are
|
|
411
|
+
* written in. Pass it whenever the markup is rendered on a server: without it
|
|
412
|
+
* all three follow the runtime's own locale, and a server that disagrees with
|
|
413
|
+
* the browser about that produces two different row orders for the same
|
|
414
|
+
* table.
|
|
409
415
|
*/
|
|
410
416
|
locale?: string;
|
|
411
417
|
}
|