neba 1.16.1 → 1.17.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/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 +13 -3
- package/dist/components/color-picker/ColorPicker.js +1 -1
- package/dist/components/combobox/Combobox.d.ts +9 -2
- 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-picker/DatePicker.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/date-time-picker/DateTimePicker.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.d.ts +9 -4
- 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/provider/NebaProvider.d.ts +2 -2
- package/dist/components/provider/NebaProvider.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 +10 -2
- 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.d.ts +13 -5
- package/dist/components/text-field/TextField.js +1 -1
- package/dist/components/text-link/TextLink.js +1 -1
- package/dist/components/time-picker/TimePicker.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/defaults.d.ts +8 -4
- 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 +19 -0
- package/dist/internal/new-tab.js +1 -0
- package/dist/internal/notch.d.ts +102 -0
- package/dist/internal/notch.js +1 -0
- package/dist/internal/observe.d.ts +3 -4
- package/dist/internal/picker.d.ts +30 -4
- 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 +56 -0
- 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 +287 -3
- package/dist/types.d.ts +18 -0
- package/package.json +23 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as l from"react";import{Button as a}from"../button/Button.js";import{boxPaddingClasses as r}from"../box/Box.js";import{CheckIcon as i,ChevronIcon as o,RestartIcon as s,SuccessIcon as c}from"../../internal/icons.js";import{fillMessage as m,stepsMessages as d,useMessages as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as l from"react";import{Button as a}from"../button/Button.js";import{boxPaddingClasses as r}from"../box/Box.js";import{CheckIcon as i,ChevronIcon as o,RestartIcon as s,SuccessIcon as c}from"../../internal/icons.js";import{fillMessage as m,stepsMessages as d,useMessages as p}from"../../internal/i18n.js";import{transitionProps as f}from"../../internal/animate.js";import{cx as u,hasContent as x,headingTitleClasses as g,iconClasses as h,insetRingClasses as b,metaTextClasses as v,radiusClasses as N,sheetBodyClasses as w,sheetSectionGapClasses as y,sheetTitleClasses as j,srOnlyClasses as k,surfaceClasses as S,surfaceSlots as C,toLength as z,transitionClasses as R}from"../../internal/styles.js";import{inertValue as H}from"../../internal/inert.js";import{useStyleDefaults as L}from"../../internal/defaults.js";const I={xs:{box:"1.25rem",text:"text-[0.625rem]"},sm:{box:"1.5rem",text:"text-[0.6875rem]"},md:{box:"1.75rem",text:"text-[0.75rem]"},lg:{box:"2rem",text:"text-[0.8125rem]"},xl:{box:"2.25rem",text:"text-[0.875rem]"}},M={default:{xs:"gap-0.5",sm:"gap-1",md:"gap-1",lg:"gap-1.5",xl:"gap-2"},compact:{xs:"gap-0",sm:"gap-0",md:"gap-0.5",lg:"gap-0.5",xl:"gap-1"}},T={solid:[S,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[S,"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"};function B(e){return"string"==typeof e?e:""}function StepHeading({level:e,...t}){return l.createElement(`h${Math.min(6,Math.max(1,e))}`,t)}export const HowToSteps=/*@__PURE__*/l.forwardRef(function HowToSteps(S,E){const{steps:W,title:$,headingLevel:D=3,step:_,defaultStep:A=0,onStepChange:F,completed:q,defaultCompleted:G=!1,onCompletedChange:J,orientation:K="vertical",maxHeight:O,railWidth:P="15rem",navigation:Q=!0,divider:U=!0,transition:V="fade",completion:X=!0,completedContent:Y,variant:Z="outline",size:ee="md",color:te="primary",density:ne="default",elevation:le=0,locale:ae,previousLabel:re,nextLabel:ie,doneLabel:oe,restartLabel:se,className:ce,style:me,...de}=L(S,["size","density","variant","locale"]),pe=p(d,ae),fe=l.useId(),ue=x($),[xe,ge]=l.useState(A),[he,be]=l.useState(G),ve=void 0!==_,Ne=void 0!==q,we=W.length,ye=Math.min(Math.max(ve?_:xe,0),Math.max(we-1,0)),je=X&&(Ne?q:he),ke=void 0!==O,Se="vertical"===K,Ce=l.useRef(null),ze=l.useRef(null);l.useEffect(()=>{const e=Ce.current,t=ze.current;if(!e||!t)return;const n=e.getBoundingClientRect(),l=t.getBoundingClientRect();Se?l.top<n.top?e.scrollTop-=n.top-l.top:l.bottom>n.bottom&&(e.scrollTop+=l.bottom-n.bottom):l.left<n.left?e.scrollLeft-=n.left-l.left:l.right>n.right&&(e.scrollLeft+=l.right-n.right)},[ye,Se]);const Re=l.useRef(null),He=l.useRef(null),Le=l.useRef(null);if(l.useEffect(()=>{null!==Le.current&&Le.current===je&&(Le.current=null,(je?Re:He).current?.focus())},[je]),0===we)return null;const Ie=(e,t=!1)=>{Ne||be(t),je!==t&&J?.(t),t||(ve||ge(e),e!==ye&&F?.(e))},Me=0===ye,Te=ye===we-1,Be=(e,t)=>{Le.current=e.currentTarget===document.activeElement?t:null},Ee="none"===V?null:f(V),We=t=>{const n=je||t<ye,l=!je&&t===ye;return e("span",{"aria-hidden":"true",className:u("z-1 flex shrink-0 items-center justify-center rounded-full border font-medium","size-(--n-step-mark) [&_svg]:size-[1.15em]",I[ee].text,R,n?"bg-(--n-fill) text-(--n-on-solid) [border-color:transparent]":l?"bg-(--neba-surface) text-(--n-accent) [border-color:var(--n-accent)]":"bg-(--neba-surface) text-(--neba-muted-fg) [border-color:var(--n-line)]"),children:n?e(i,{}):t+1})},$e=e("ol",{ref:Ce,role:"list","aria-label":pe.steps,className:u("m-0 flex list-none p-0",Se?"flex-col":"flex-row",M[ne][ee],ke&&Se?"min-h-0 overflow-y-auto overscroll-contain":"",Se?"":"overflow-x-auto overscroll-contain"),children:W.map((n,l)=>{const a=je||l<ye,r=!je&&l===ye,i=B(n.title);return t("li",{ref:r?ze:void 0,className:u("relative",Se?"":"min-w-0 flex-1"),children:[l<we-1?e("span",{"aria-hidden":"true",className:u("absolute",R,a?"bg-(--n-fill)":"bg-(--n-line)",Se?["w-px","[inset-inline-start:calc(0.25rem+var(--n-step-mark)/2)]","[top:calc(0.25rem+var(--n-step-mark))]","[height:calc(100%-var(--n-step-mark))]"].join(" "):["h-px","[inset-inline-start:calc(50%+var(--n-step-mark)/2)]","[top:calc(0.25rem+var(--n-step-mark)/2)]","[width:calc(100%-var(--n-step-mark))]"].join(" "))}):null,t("button",{type:"button",onClick:()=>Ie(l),"aria-current":r?"step":void 0,"aria-label":i?m(pe.step,{index:String(l+1),title:i}):void 0,className:u("flex w-full cursor-pointer items-center p-1 text-start",Se?"gap-3":"flex-col gap-1.5 text-center",N.sm,"hover:bg-(--n-soft)",R,b),children:[We(l),e("span",{className:u("min-w-0",Se?"truncate":"",v[ee],r?"font-medium text-(--neba-fg)":"text-(--neba-muted-fg)"),children:n.title})]})]},l)})}),De=t("div",{className:u("grid flex-1 grid-cols-1",ke?"min-h-0":""),children:[W.map((n,l)=>{const a=je||l!==ye;return t("div",{"aria-hidden":a,inert:H(a),className:u("col-start-1 row-start-1 min-w-0",ke?"overflow-y-auto overscroll-contain":"",a?"invisible":Ee?.className??""),style:a?void 0:Ee?.style,children:[t("div",{className:"mb-3 flex items-baseline gap-3",children:[x(n.icon)?e("span",{"aria-hidden":"true",className:u("flex h-[1lh] shrink-0 items-center text-(--n-accent)",j[ee],h),children:n.icon}):null,e(StepHeading,{level:ue?D+1:D,className:u("neba-heading min-w-0 flex-1","[&.neba-heading]:m-0 [&.neba-heading]:font-medium [&.neba-heading]:text-inherit",g[ee]),children:n.title}),e("span",{className:u("shrink-0 text-(--neba-muted-fg) tabular-nums",v[ee]),children:m(pe.position,{index:String(l+1),total:String(we)})})]}),n.image?e("img",{src:n.image,alt:n.imageAlt??B(n.title),loading:"lazy",decoding:"async",className:u("mb-3 max-h-72 w-full object-contain",N[ee])}):null,x(n.content)?e("div",{className:u("min-w-0",w[ee]),children:n.content}):null]},l)}),X?t("div",{"aria-hidden":!je,inert:H(!je),className:u("col-start-1 row-start-1 flex min-w-0 flex-col items-center justify-center gap-2 py-4 text-center",je?Ee?.className??"":"invisible"),style:je?Ee?.style:void 0,children:[e("span",{"aria-hidden":"true",className:"text-(--n-accent) [&_svg]:size-9",children:e(c,{})}),e("p",{className:u("m-0 font-medium",w[ee]),children:Y??pe.completed})]}):null]});return t("div",{ref:E,role:ue?"group":void 0,"aria-labelledby":ue?fe:void 0,className:u("flex min-w-0 flex-col",N[ee],r[ne][ee],y[ee],T[Z],R,ce),style:{...C(te,le),"--n-fill":`var(--neba-${te}-fill)`,"--n-on-solid":`var(--neba-${te}-on-solid)`,"--n-step-mark":I[ee].box,"--n-step-rail":z(P),...ke?{maxHeight:z(O)}:null,...me},...de,children:[ue?e(StepHeading,{level:D,id:fe,className:u("neba-heading shrink-0","[&.neba-heading]:m-0 [&.neba-heading]:font-medium [&.neba-heading]:text-inherit",g[ee]),children:$}):null,e("span",{className:k,"aria-live":"polite",children:je?"":"string"==typeof W[ye]?.title?m(pe.step,{index:String(ye+1),title:W[ye].title}):m(pe.position,{index:String(ye+1),total:String(we)})}),t("div",{className:u("flex min-w-0 flex-1 flex-col",ke?"min-h-0":"",Se?"gap-4 sm:flex-row sm:gap-5":"gap-4"),children:[e("div",{className:u("flex min-w-0 flex-col",ke?"min-h-0":"",Se?"sm:w-(--n-step-rail) sm:shrink-0":"",U?Se?"border-b pb-4 sm:border-b-0 sm:border-e sm:pb-0 sm:pe-5":"border-b pb-4":"",U?"[border-color:var(--n-line)]":""),children:$e}),t("div",{className:u("flex min-w-0 flex-1 flex-col",ke?"min-h-0":"",y[ee]),children:[De,Q?e("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-2",children:je?e(a,{ref:Re,size:ee,variant:"outline",color:te,startIcon:e(s,{}),onClick:e=>{Be(e,!1),Ie(0)},children:se??pe.restart}):t(n,{children:[e(a,{size:ee,variant:"outline",color:te,disabled:Me,focusableWhenDisabled:!0,startIcon:e("span",{className:"rotate-90 rtl:-rotate-90",children:e(o,{})}),onClick:()=>Ie(ye-1),children:re??pe.previous}),e(a,Te&&X?{ref:He,size:ee,variant:"solid",color:te,startIcon:e(i,{}),onClick:e=>{Be(e,!0),Ie(ye,!0)},children:oe??pe.done}:{ref:He,size:ee,variant:"solid",color:te,disabled:Te,focusableWhenDisabled:!0,endIcon:e("span",{className:"-rotate-90 rtl:rotate-90",children:e(o,{})}),onClick:()=>Ie(ye+1),children:ie??pe.next})]})}):null]})]})]})});
|
|
@@ -166,7 +166,10 @@ export interface ImageProps extends Omit<React.ComponentPropsWithoutRef<'img'>,
|
|
|
166
166
|
* layout's: `ratio` says "hold this shape whatever arrives", these two say
|
|
167
167
|
* "this is what will arrive". Give both and an `'auto'` ratio becomes their
|
|
168
168
|
* proportion, so the box is reserved without anybody working out that 1200 by
|
|
169
|
-
* 800 is 3/2.
|
|
169
|
+
* 800 is 3/2. Together they are only that proportion, and not a size: the box
|
|
170
|
+
* spans the width its container gives it, as a responsive `<img>` does, and a
|
|
171
|
+
* picture meant to stay 320 pixels wide needs the width on the Image's own
|
|
172
|
+
* `className` or `style`.
|
|
170
173
|
*
|
|
171
174
|
* One on its own is not a proportion, so it is read as the length it looks
|
|
172
175
|
* like. `height={200}` is a box 200 pixels tall across whatever width it is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{AspectRatio as r}from"../aspect-ratio/AspectRatio.js";import{Skeleton as i}from"../skeleton/Skeleton.js";import{useStyleDefaults as a}from"../../internal/defaults.js";import{imageMessages as l,useMessages as s}from"../../internal/i18n.js";import{cx as c,metaTextValues as u,radiusClasses as d,toLength as f,transitionClasses as h}from"../../internal/styles.js";const p={cover:"object-cover",contain:"object-contain",fill:"object-fill",none:"object-none","scale-down":"object-scale-down"},b={none:"none",grayscale:"grayscale(1)",sepia:"sepia(0.72)",invert:"invert(1)",saturate:"saturate(1.5)",mute:"saturate(0.45)",contrast:"contrast(1.25)"},m={"top-start":"items-start justify-start","top-end":"items-start justify-end","bottom-start":"items-end justify-start","bottom-end":"items-end justify-end",center:"items-center justify-center"},g=Number.parseInt(o.version,10)>=19?"fetchPriority":"fetchpriority",v=o.lazy(()=>import("../dialog/Dialog.js").then(e=>({default:e.Dialog})));function y(e){const t="number"==typeof e?e:""===e.trim()?NaN:Number(e);return Number.isFinite(t)?`${t}px`:String(e)}const x=/^(-?\d*\.?\d+)%$/;function w(e,t,n){const o=function(e){let t=.5,n=.5;for(const[o,r]of e.trim().toLowerCase().split(/\s+/).entries()){const e=x.exec(r);if("left"===r||"right"===r)t="left"===r?0:1;else if("top"===r||"bottom"===r)n="top"===r?0:1;else if(null!==e)0===o?t=Number(e[1])/100:n=Number(e[1])/100;else if("center"!==r)return null}return[t,n]}(e);if(null===o)return e;let[r,i]=o;"horizontal"!==n&&"both"!==n||(r=1-r),"vertical"!==n&&"both"!==n||(i=1-i);for(let e=0;e<t;e+=1)[r,i]=[i,1-r];const a=e=>Math.round(1e4*e)/100+"%";return`${a(r)} ${a(i)}`}function $(e,t,n){const o=e=>0===n?e:`calc(${e} + ${2*n}px)`;return t?{...e,width:o("100cqh"),height:o("100cqw")}:{...e,position:"absolute",top:-n+"px",left:-n+"px",width:o("100%"),height:o("100%"),maxWidth:"none"}}function k(e,t){switch(e){case"rect":return{borderRadius:"0px"};case"circle":return{borderRadius:"50%"};case"arch":return{borderRadius:`50% 50% ${t} ${t} / 55% 55% ${t} ${t}`};case"cut":return{clipPath:`polygon(${t} 0, calc(100% - ${t}) 0, 100% ${t}, 100% calc(100% - ${t}), calc(100% - ${t}) 100%, ${t} 100%, 0 calc(100% - ${t}), 0 ${t})`};default:return{borderRadius:t}}}function N(e){const t=t=>`linear-gradient(to ${t}, transparent, #000 ${e}, #000 calc(100% - ${e}), transparent)`,n=`${t("right")}, ${t("bottom")}`;return{maskImage:n,maskComposite:"intersect",WebkitMaskImage:n,WebkitMaskComposite:"source-in"}}function TiledMark({text:n,color:r,opacity:i,rotate:a,fontSize:l,slot:s}){const u=`neba-mark-${o.useId().replace(/[^\w-]/g,"")}`,d=function(e){let t=0;for(const n of e)t+=/[ᄀ-ᇿ⺀-가-豈-︰-﹏]/.test(n)?1:.6;return{width:Math.max(16,Math.round(16*(t+2.4))),height:52}}(n);return t("svg",{"aria-hidden":"true",className:c("pointer-events-none absolute select-none",s),style:{top:"-40%",left:"-40%",width:"180%",height:"180%",opacity:i,fontSize:l,transform:`rotate(${a}deg)`},children:[e("defs",{children:e("pattern",{id:u,patternUnits:"userSpaceOnUse",width:d.width/16+"em",height:d.height/16+"em",children:e("text",{x:"0",y:"2em",style:{fill:r,fontFamily:"system-ui, sans-serif",stroke:"rgba(0, 0, 0, 0.28)",strokeWidth:"0.0375em",paintOrder:"stroke"},children:n})})}),e("rect",{width:"100%",height:"100%",fill:`url(#${u})`})]})}export const Image=/*@__PURE__*/o.forwardRef(function Image(x,S){const{alt:z,ratio:R="auto",width:C,height:M,fit:_="cover",position:W,letterbox:L="none",rounded:O=!1,placeholder:P,fallback:D,onLoadingStatusChange:T,preview:E=!1,priority:F=!1,filter:I="none",rotate:U=0,flip:q="none",frame:H,watermark:B,protect:A=!1,locale:V,unavailableLabel:G,className:J,classNames:K,style:Q,src:X,onLoad:Y,onError:Z,onContextMenu:ee,onDragStart:te,draggable:ne,...oe}=a(x,["locale"]),re=s(l,V),ie=!1!==P&&function(e){return"object"==typeof e&&null!==e&&!o.isValidElement(e)&&"src"in e}(P)?P:null,ae=function(e){const[t,n]=o.useState(null);return o.useEffect(()=>{if("undefined"==typeof Blob||!(e instanceof Blob))return;const t=URL.createObjectURL(e);return n({blob:e,url:t}),()=>URL.revokeObjectURL(t)},[e]),"string"==typeof e?e:null!==t&&t.blob===e?t.url:void 0}(ie?.src),[le,se]=o.useState("loading"),[ce,ue]=o.useState(!1),[de,fe]=o.useState(null),he=o.useRef(null),pe=o.useRef(T);o.useEffect(()=>{pe.current=T});const be=o.useCallback(e=>{he.current=e,"function"==typeof S?S(e):S&&(S.current=e)},[S]);o.useEffect(()=>{const e=he.current,t=X&&e?.complete?e.naturalWidth>0?"loaded":"failed":null;se(t??"loading"),fe("loaded"===t&&e?{width:e.naturalWidth,height:e.naturalHeight}:null),pe.current?.(t??"loading")},[X]);const me=(e,t)=>{se(e),"loaded"===e&&fe({width:t.naturalWidth,height:t.naturalHeight}),T?.(e)},ge=!1===O?"":d[!0===O?"md":O],ve=I in b?b[I]:I,ye=!0===A?{}:!1===A?null:A,xe=null!==ye&&!1!==ye.contextMenu,we=null!==ye&&!1!==ye.drag,$e=null!==ye&&!1!==ye.select,ke=e=>e.preventDefault(),Ne=function(e){return Number.isFinite(e)?(Math.round(e/90)%4+4)%4:0}(U),je=Ne%2==1,Se=function(e,t){const n=e%2==1,o="horizontal"===t||"both"===t,r="vertical"===t||"both"===t,i=n?r:o,a=n?o:r;return{scale:i||a?`${i?-1:1} ${a?-1:1}`:void 0,rotate:0===e?void 0:90*e+"deg",...n?{position:"absolute",top:"50%",left:"50%",width:"100cqh",height:"100cqw",maxWidth:"none",translate:"-50% -50%"}:null}}(Ne,q),ze=void 0===W?void 0:w(W,Ne,q),Re="blur"===L&&"cover"!==_&&"fill"!==_,Ce="none"!==L&&"blur"!==L?L:void 0,Me=ye?{onContextMenu:xe?ke:void 0,onDragStart:we?ke:void 0,draggable:!we&&void 0,className:$e?"select-none":"",style:$e?{WebkitTouchCallout:"none"}:void 0}:null,_e=e("img",{ref:be,src:X,alt:z,width:C,height:M,className:c("block size-full",p[_],ge,"[transition:opacity_var(--neba-duration-fill)_var(--neba-ease),filter_var(--neba-duration-fill)_var(--neba-ease),transform_var(--neba-duration-fill)_var(--neba-ease)]",F||"loaded"===le?"opacity-100":"opacity-0",Re||null!==ie?"relative":"",Me?.className,K?.image),style:{filter:"none"===ve?void 0:ve,objectPosition:ze,...Se,...Me?.style},onLoad:e=>{me("loaded",e.currentTarget),Y?.(e)},onError:e=>{me("failed",e.currentTarget),Z?.(e)},onContextMenu:e=>{xe&&ke(e),ee?.(e)},onDragStart:e=>{we&&ke(e),te?.(e)},draggable:!we&&ne,...F?{loading:"eager",[g]:"high"}:null,...oe}),We=Re?e("img",{src:X,srcSet:oe.srcSet,sizes:oe.sizes,loading:oe.loading,decoding:oe.decoding,crossOrigin:oe.crossOrigin,referrerPolicy:oe.referrerPolicy,alt:"","aria-hidden":"true",draggable:!1,className:c("pointer-events-none block object-cover select-none","[transition:opacity_var(--neba-duration-fill)_var(--neba-ease)]","loaded"===le?"opacity-100":"opacity-0"),style:{...$(Se,je,48),objectPosition:ze,filter:("none"===ve?"":`${ve} `)+"blur(24px)"}}):null,Le=null!==ie&&ie.blur?!0===ie.blur?20:ie.blur:0,Oe=null===ie||"failed"===le||void 0===ae?null:e("img",{src:ae,alt:"","aria-hidden":"true",draggable:!1,className:c("pointer-events-none block select-none",p[_],"loaded"===le?"opacity-0 [transition:opacity_0ms_linear_var(--neba-duration-fill)]":"opacity-100",K?.placeholder),style:{...$(Se,je,2*Le),objectPosition:ze,filter:0===Le?void 0:`blur(${Le}px)`}}),Pe="failed"===le?e("span",{className:c("absolute inset-0 flex items-center justify-center","bg-(--neba-disabled-bg) text-(--neba-muted-fg)",ge,K?.fallback),children:D??e("span",{className:"px-2 text-center text-sm","aria-hidden":!!z||void 0,children:z||G||re.unavailable})}):"loading"!==le||!1===P||null!==ie||F?null:e("span",{className:c("absolute inset-0",K?.placeholder),children:P??e(i,{render:e("span",{}),shape:"rect",className:c("block size-full",ge)})}),De=void 0===B?null:function(t,n){const o="string"==typeof t?{content:t}:t,{content:r,position:i="bottom-end",repeat:a=!1,opacity:l=.35,size:s="xs",color:d="#ffffff"}=o,h="string"==typeof s&&s in u?u[s]:f(s)??u.xs,p=o.rotate??(a&&"string"==typeof r?-24:0);if(a&&"string"==typeof r)return e(TiledMark,{text:r,color:d,opacity:l,rotate:p,fontSize:h,slot:n});return e("span",{"aria-hidden":"true",className:c("pointer-events-none absolute inset-0 flex select-none p-2",m[i],n),children:e("span",{style:{color:d,opacity:l,fontSize:h,lineHeight:1.2,textShadow:"0 1px 2px rgba(0, 0, 0, 0.45)",transform:p?`rotate(${p}deg)`:void 0},children:r})})}(B,K?.watermark),Te=t("span",{className:"relative block size-full",style:je||void 0!==Ce?{containerType:je?"size":void 0,background:Ce}:void 0,children:[We,Oe,_e,Pe,De]}),Ee=function(e,t){const n="number"==typeof e?e:Number(e),o="number"==typeof t?t:Number(t);return Number.isFinite(n)&&Number.isFinite(o)&&n>0&&o>0?{width:n,height:o}:null}(C,M),Fe="auto"===R&&null!==Ee?Ee.width/Ee.height:null,Ie=null===Fe?R:je?1/Fe:Fe,Ue=void 0===M&&void 0!==C?y(C):void 0,qe=void 0===C&&void 0!==M?y(M):void 0,He=void 0!==Ue?{width:Ue,maxWidth:"100%"}:void 0!==qe?{height:qe,..."auto"===Ie?null:{width:"auto",maxWidth:"100%"}}:null,Be=void 0!==Ue||void 0!==qe&&"auto"!==Ie,Ae="auto"===Ie&&je&&null!==de&&void 0===qe?de.height/de.width:null,Ve=void 0===H?null:function(e,t){const n=!0===t?"md":t;return{shape:"rounded",corner:!1===n?"md":n,..."string"==typeof e?{shape:e}:e}}(H,O),Ge=null===Ve?"0px":function(e){return"string"==typeof e&&e in d?`var(--neba-radius-${e})`:f(e)??"0px"}(Ve.corner??"md"),Je=null===Ve?void 0:f(Ve.mat),Ke=null===Ve?void 0:f(Ve.feather),Qe={...He,...null===Ve?null:k(Ve.shape,Ge),...void 0===Ke?null:N(Ke),...null!==Ve||E?null:Q},Xe="auto"===Ie?e("span",{className:c("relative block overflow-hidden",null===Ve?ge:"",null!==Ve||E?"":J),style:null===Ae?Qe:{aspectRatio:Ae,...Qe},children:Te}):e(r,{render:e("span",{}),ratio:Ie,className:c("block overflow-hidden",null===Ve?ge:"",null!==Ve||E?"":J),style:Qe,children:Te}),Ye=null===Ve?void 0:function(e){if(void 0===e.border||!1===e.border)return;const t=!0===e.border?"1px":f(e.border);return`inset 0 0 0 ${t} ${e.borderColor??"var(--neba-line)"}`}(Ve),Ze=void 0===Je?Ge:`calc(${Ge} + ${Je})`,et=null===Ve?Xe:t("span",{className:c("relative block",K?.frame,E?"":J),style:{...k(Ve.shape,Ze),padding:Je,background:Ve.background??(void 0===Je?void 0:"var(--neba-surface)"),boxShadow:Ve.elevation?`var(--neba-shadow-${Ve.elevation})`:void 0,width:Be?"fit-content":void 0,maxWidth:Be?"100%":void 0,...E?null:Q},children:[Xe,void 0===Ye?null:e("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0",style:{...k(Ve.shape,Ze),boxShadow:Ye}})]});return E?t(n,{children:[e("button",{type:"button","aria-label":z||re.preview,className:c("block cursor-zoom-in",h,Be?"[:where(&)]:w-fit [:where(&)]:max-w-full":"[:where(&)]:w-full","focus-visible:[outline:2px_solid_var(--n-ring,var(--neba-primary-ring))] focus-visible:[outline-offset:2px]",ge,J),style:Q,onClick:()=>ue(!0),children:et}),e(o.Suspense,{fallback:null,children:e(v,{open:ce,onOpenChange:ue,size:"xl",title:z||re.preview,children:t("span",{className:c("relative mx-auto block",je?"":"w-fit"),style:je?j(de??Ee):void 0,children:[e("img",{src:X,srcSet:oe.srcSet,crossOrigin:oe.crossOrigin,referrerPolicy:oe.referrerPolicy,alt:z,className:c(je?"block object-contain":"mx-auto block max-h-[70vh] w-auto max-w-full",Me?.className),style:{filter:"none"===ve?void 0:ve,...Se,...Me?.style},onContextMenu:Me?.onContextMenu,onDragStart:Me?.onDragStart,draggable:Me?.draggable}),De]})})})]}):et});function j(e){if(null===e)return{aspectRatio:"1",width:"min(100%, 70vh)",containerType:"size"};const t=e.height/e.width;return{aspectRatio:`${e.height} / ${e.width}`,width:`min(100%, ${e.height}px, calc(70vh * ${t}))`,containerType:"size"}}
|
|
1
|
+
"use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{AspectRatio as r}from"../aspect-ratio/AspectRatio.js";import{Skeleton as i}from"../skeleton/Skeleton.js";import{useStyleDefaults as a}from"../../internal/defaults.js";import{imageMessages as l,useMessages as s}from"../../internal/i18n.js";import{cx as c,metaTextValues as u,radiusClasses as d,toLength as f,transitionClasses as h}from"../../internal/styles.js";const p={cover:"object-cover",contain:"object-contain",fill:"object-fill",none:"object-none","scale-down":"object-scale-down"},b={none:"none",grayscale:"grayscale(1)",sepia:"sepia(0.72)",invert:"invert(1)",saturate:"saturate(1.5)",mute:"saturate(0.45)",contrast:"contrast(1.25)"},m={"top-start":"items-start justify-start","top-end":"items-start justify-end","bottom-start":"items-end justify-start","bottom-end":"items-end justify-end",center:"items-center justify-center"},g=Number.parseInt(o.version,10)>=19?"fetchPriority":"fetchpriority",v=o.lazy(()=>import("../dialog/Dialog.js").then(e=>({default:e.Dialog})));function y(e){const t="number"==typeof e?e:""===e.trim()?NaN:Number(e);return Number.isFinite(t)?`${t}px`:String(e)}const x=/^(-?\d*\.?\d+)%$/;function w(e,t,n){const o=function(e){let t=.5,n=.5;for(const[o,r]of e.trim().toLowerCase().split(/\s+/).entries()){const e=x.exec(r);if("left"===r||"right"===r)t="left"===r?0:1;else if("top"===r||"bottom"===r)n="top"===r?0:1;else if(null!==e)0===o?t=Number(e[1])/100:n=Number(e[1])/100;else if("center"!==r)return null}return[t,n]}(e);if(null===o)return e;let[r,i]=o;"horizontal"!==n&&"both"!==n||(r=1-r),"vertical"!==n&&"both"!==n||(i=1-i);for(let e=0;e<t;e+=1)[r,i]=[i,1-r];const a=e=>Math.round(1e4*e)/100+"%";return`${a(r)} ${a(i)}`}function $(e,t,n){const o=e=>0===n?e:`calc(${e} + ${2*n}px)`;return t?{...e,width:o("100cqh"),height:o("100cqw")}:{...e,position:"absolute",top:-n+"px",left:-n+"px",width:o("100%"),height:o("100%"),maxWidth:"none"}}function k(e,t){switch(e){case"rect":return{borderRadius:"0px"};case"circle":return{borderRadius:"50%"};case"arch":return{borderRadius:`50% 50% ${t} ${t} / 55% 55% ${t} ${t}`};case"cut":return{clipPath:`polygon(${t} 0, calc(100% - ${t}) 0, 100% ${t}, 100% calc(100% - ${t}), calc(100% - ${t}) 100%, ${t} 100%, 0 calc(100% - ${t}), 0 ${t})`};default:return{borderRadius:t}}}function N(e){const t=t=>`linear-gradient(to ${t}, transparent, #000 ${e}, #000 calc(100% - ${e}), transparent)`,n=`${t("right")}, ${t("bottom")}`;return{maskImage:n,maskComposite:"intersect",WebkitMaskImage:n,WebkitMaskComposite:"source-in"}}function TiledMark({text:n,color:r,opacity:i,rotate:a,fontSize:l,slot:s}){const u=`neba-mark-${o.useId().replace(/[^\w-]/g,"")}`,d=function(e){let t=0;for(const n of e)t+=/[ᄀ-ᇿ⺀-가-豈-︰-﹏]/.test(n)?1:.6;return{width:Math.max(16,Math.round(16*(t+2.4))),height:52}}(n);return t("svg",{"aria-hidden":"true",className:c("pointer-events-none absolute select-none",s),style:{top:"-40%",left:"-40%",width:"180%",height:"180%",opacity:i,fontSize:l,transform:`rotate(${a}deg)`},children:[e("defs",{children:e("pattern",{id:u,patternUnits:"userSpaceOnUse",width:d.width/16+"em",height:d.height/16+"em",children:e("text",{x:"0",y:"2em",style:{fill:r,fontFamily:"system-ui, sans-serif",stroke:"rgba(0, 0, 0, 0.28)",strokeWidth:"0.0375em",paintOrder:"stroke"},children:n})})}),e("rect",{width:"100%",height:"100%",fill:`url(#${u})`})]})}export const Image=/*@__PURE__*/o.forwardRef(function Image(x,S){const{alt:z,ratio:R="auto",width:C,height:M,fit:_="cover",position:W,letterbox:L="none",rounded:O=!1,placeholder:P,fallback:D,onLoadingStatusChange:T,preview:E=!1,priority:F=!1,filter:I="none",rotate:U=0,flip:q="none",frame:H,watermark:B,protect:A=!1,locale:V,unavailableLabel:G,className:J,classNames:K,style:Q,src:X,onLoad:Y,onError:Z,onContextMenu:ee,onDragStart:te,draggable:ne,...oe}=a(x,["locale"]),re=s(l,V),ie=!1!==P&&function(e){return"object"==typeof e&&null!==e&&!o.isValidElement(e)&&"src"in e}(P)?P:null,ae=function(e){const[t,n]=o.useState(null);return o.useEffect(()=>{if("undefined"==typeof Blob||!(e instanceof Blob))return;const t=URL.createObjectURL(e);return n({blob:e,url:t}),()=>URL.revokeObjectURL(t)},[e]),"string"==typeof e?e:null!==t&&t.blob===e?t.url:void 0}(ie?.src),[le,se]=o.useState("loading"),[ce,ue]=o.useState(!1),[de,fe]=o.useState(null),he=o.useRef(null),pe=o.useRef(T);o.useEffect(()=>{pe.current=T});const be=o.useCallback(e=>{he.current=e,"function"==typeof S?S(e):S&&(S.current=e)},[S]),me=oe.srcSet;o.useEffect(()=>{const e=he.current,t=(X||me)&&e?.complete?e.naturalWidth>0?"loaded":"failed":null;se(t??"loading"),fe("loaded"===t&&e?{width:e.naturalWidth,height:e.naturalHeight}:null),pe.current?.(t??"loading")},[X,me]);const ge=(e,t)=>{se(e),"loaded"===e&&fe({width:t.naturalWidth,height:t.naturalHeight}),T?.(e)},ve=!1===O?"":d[!0===O?"md":O],ye=I in b?b[I]:I,xe=!0===A?{}:!1===A?null:A,we=null!==xe&&!1!==xe.contextMenu,$e=null!==xe&&!1!==xe.drag,ke=null!==xe&&!1!==xe.select,Ne=e=>e.preventDefault(),je=function(e){return Number.isFinite(e)?(Math.round(e/90)%4+4)%4:0}(U),Se=je%2==1,ze=function(e,t){const n=e%2==1,o="horizontal"===t||"both"===t,r="vertical"===t||"both"===t,i=n?r:o,a=n?o:r;return{scale:i||a?`${i?-1:1} ${a?-1:1}`:void 0,rotate:0===e?void 0:90*e+"deg",...n?{position:"absolute",top:"50%",left:"50%",width:"100cqh",height:"100cqw",maxWidth:"none",translate:"-50% -50%"}:null}}(je,q),Re=void 0===W?void 0:w(W,je,q),Ce="blur"===L&&"cover"!==_&&"fill"!==_,Me="none"!==L&&"blur"!==L?L:void 0,_e=xe?{onContextMenu:we?Ne:void 0,onDragStart:$e?Ne:void 0,draggable:!$e&&void 0,className:ke?"select-none":"",style:ke?{WebkitTouchCallout:"none"}:void 0}:null,We=e("img",{ref:be,src:X,alt:z,width:C,height:M,className:c("block size-full",p[_],ve,"[transition:opacity_var(--neba-duration-fill)_var(--neba-ease),filter_var(--neba-duration-fill)_var(--neba-ease),transform_var(--neba-duration-fill)_var(--neba-ease)]",F||"loaded"===le?"opacity-100":"opacity-0",Ce||null!==ie?"relative":"",_e?.className,K?.image),style:{filter:"none"===ye?void 0:ye,objectPosition:Re,...ze,..._e?.style},onLoad:e=>{ge("loaded",e.currentTarget),Y?.(e)},onError:e=>{ge("failed",e.currentTarget),Z?.(e)},onContextMenu:e=>{we&&Ne(e),ee?.(e)},onDragStart:e=>{$e&&Ne(e),te?.(e)},draggable:!$e&&ne,...F?{loading:"eager",[g]:"high"}:null,...oe}),Le=Ce?e("img",{src:X,srcSet:oe.srcSet,sizes:oe.sizes,loading:oe.loading,decoding:oe.decoding,crossOrigin:oe.crossOrigin,referrerPolicy:oe.referrerPolicy,alt:"","aria-hidden":"true",draggable:!1,className:c("pointer-events-none block object-cover select-none","[transition:opacity_var(--neba-duration-fill)_var(--neba-ease)]","loaded"===le?"opacity-100":"opacity-0"),style:{...$(ze,Se,48),objectPosition:Re,filter:("none"===ye?"":`${ye} `)+"blur(24px)"}}):null,Oe=null!==ie&&ie.blur?!0===ie.blur?20:ie.blur:0,Pe=null===ie||"failed"===le||void 0===ae?null:e("img",{src:ae,alt:"","aria-hidden":"true",draggable:!1,className:c("pointer-events-none block select-none",p[_],"loaded"===le?"opacity-0 [transition:opacity_0ms_linear_var(--neba-duration-fill)]":"opacity-100",K?.placeholder),style:{...$(ze,Se,2*Oe),objectPosition:Re,filter:0===Oe?void 0:`blur(${Oe}px)`}}),De="failed"===le?e("span",{className:c("absolute inset-0 flex items-center justify-center","bg-(--neba-disabled-bg) text-(--neba-muted-fg)",ve,K?.fallback),children:D??e("span",{className:"px-2 text-center text-sm","aria-hidden":!!z||void 0,children:z||G||re.unavailable})}):"loading"!==le||!1===P||null!==ie||F?null:e("span",{className:c("absolute inset-0",K?.placeholder),children:P??e(i,{render:e("span",{}),shape:"rect",className:c("block size-full",ve)})}),Te=void 0===B?null:function(t,n){const o="string"==typeof t?{content:t}:t,{content:r,position:i="bottom-end",repeat:a=!1,opacity:l=.35,size:s="xs",color:d="#ffffff"}=o,h="string"==typeof s&&s in u?u[s]:f(s)??u.xs,p=o.rotate??(a&&"string"==typeof r?-24:0);if(a&&"string"==typeof r)return e(TiledMark,{text:r,color:d,opacity:l,rotate:p,fontSize:h,slot:n});return e("span",{"aria-hidden":"true",className:c("pointer-events-none absolute inset-0 flex select-none p-2",m[i],n),children:e("span",{style:{color:d,opacity:l,fontSize:h,lineHeight:1.2,textShadow:"0 1px 2px rgba(0, 0, 0, 0.45)",transform:p?`rotate(${p}deg)`:void 0},children:r})})}(B,K?.watermark),Ee=t("span",{className:"relative block size-full",style:Se||void 0!==Me?{containerType:Se?"size":void 0,background:Me}:void 0,children:[Le,Pe,We,De,Te]}),Fe=function(e,t){const n="number"==typeof e?e:Number(e),o="number"==typeof t?t:Number(t);return Number.isFinite(n)&&Number.isFinite(o)&&n>0&&o>0?{width:n,height:o}:null}(C,M),Ie="auto"===R&&null!==Fe?Fe.width/Fe.height:null,Ue=null===Ie?R:Se?1/Ie:Ie,qe=void 0===M&&void 0!==C?y(C):void 0,He=void 0===C&&void 0!==M?y(M):void 0,Be=void 0!==qe?{width:qe,maxWidth:"100%"}:void 0!==He?{height:He,..."auto"===Ue?null:{width:"auto",maxWidth:"100%"}}:null,Ae=void 0!==qe||void 0!==He&&"auto"!==Ue,Ve="auto"===Ue&&Se&&null!==de&&void 0===He?de.height/de.width:null,Ge=void 0===H?null:function(e,t){const n=!0===t?"md":t;return{shape:"rounded",corner:!1===n?"md":n,..."string"==typeof e?{shape:e}:e}}(H,O),Je=null===Ge?"0px":function(e){return"string"==typeof e&&e in d?`var(--neba-radius-${e})`:f(e)??"0px"}(Ge.corner??"md"),Ke=null===Ge?void 0:f(Ge.mat),Qe=null===Ge?void 0:f(Ge.feather),Xe={...Be,...null===Ge?null:k(Ge.shape,Je),...void 0===Qe?null:N(Qe),...null!==Ge||E?null:Q},Ye="auto"===Ue?e("span",{className:c("relative block overflow-hidden",null===Ge?ve:"",null!==Ge||E?"":J),style:null===Ve?Xe:{aspectRatio:Ve,...Xe},children:Ee}):e(r,{render:e("span",{}),ratio:Ue,className:c("block overflow-hidden",null===Ge?ve:"",null!==Ge||E?"":J),style:Xe,children:Ee}),Ze=null===Ge?void 0:function(e){if(void 0===e.border||!1===e.border)return;const t=!0===e.border?"1px":f(e.border);return`inset 0 0 0 ${t} ${e.borderColor??"var(--neba-line)"}`}(Ge),et=void 0===Ke?Je:`calc(${Je} + ${Ke})`,tt=null===Ge?Ye:t("span",{className:c("relative block",K?.frame,E?"":J),style:{...k(Ge.shape,et),padding:Ke,background:Ge.background??(void 0===Ke?void 0:"var(--neba-surface)"),boxShadow:Ge.elevation?`var(--neba-shadow-${Ge.elevation})`:void 0,width:Ae?"fit-content":void 0,maxWidth:Ae?"100%":void 0,...E?null:Q},children:[Ye,void 0===Ze?null:e("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0",style:{...k(Ge.shape,et),boxShadow:Ze}})]});return E?t(n,{children:[e("button",{type:"button","aria-label":z||re.preview,"aria-haspopup":"dialog",className:c("block cursor-zoom-in",h,Ae?"[:where(&)]:w-fit [:where(&)]:max-w-full":"[:where(&)]:w-full","focus-visible:[outline:2px_solid_var(--n-ring,var(--neba-primary-ring))] focus-visible:[outline-offset:2px]",ve,J),style:Q,onClick:()=>ue(!0),children:tt}),e(o.Suspense,{fallback:null,children:e(v,{open:ce,onOpenChange:ue,size:"xl",title:z||re.preview,children:t("span",{className:c("relative mx-auto block",Se?"":"w-fit"),style:Se?j(de??Fe):void 0,children:[e("img",{src:X,srcSet:oe.srcSet,crossOrigin:oe.crossOrigin,referrerPolicy:oe.referrerPolicy,alt:z,className:c(Se?"block object-contain":"mx-auto block max-h-[70vh] w-auto max-w-full",_e?.className),style:{filter:"none"===ye?void 0:ye,...ze,..._e?.style},onContextMenu:_e?.onContextMenu,onDragStart:_e?.onDragStart,draggable:_e?.draggable}),Te]})})})]}):tt});function j(e){if(null===e)return{aspectRatio:"1",width:"min(100%, 70vh)",containerType:"size"};const t=e.height/e.width;return{aspectRatio:`${e.height} / ${e.width}`,width:`min(100%, ${e.height}px, calc(70vh * ${t}))`,containerType:"size"}}
|
|
@@ -16,7 +16,9 @@ export interface InlineCitationProps extends Omit<React.ComponentPropsWithoutRef
|
|
|
16
16
|
site?: React.ReactNode;
|
|
17
17
|
/**
|
|
18
18
|
* Where the citation points. A scheme outside `http`, `https`, `mailto` and
|
|
19
|
-
* `tel` leaves the mark as plain text rather than writing the URL out.
|
|
19
|
+
* `tel` leaves the mark as plain text rather than writing the URL out. Without
|
|
20
|
+
* one the mark is a `<span>`, which takes the keyboard focus only when it has
|
|
21
|
+
* a preview to open.
|
|
20
22
|
*/
|
|
21
23
|
href?: string;
|
|
22
24
|
/** Where the link opens. `rel` gains `noopener noreferrer` whenever it leaves the tab. */
|
|
@@ -50,4 +52,4 @@ export interface InlineCitationProps extends Omit<React.ComponentPropsWithoutRef
|
|
|
50
52
|
* is no parent that could number it — and a component that numbered itself by
|
|
51
53
|
* render order would renumber the whole answer whenever a sentence moved.
|
|
52
54
|
*/
|
|
53
|
-
export declare const InlineCitation: React.ForwardRefExoticComponent<InlineCitationProps & React.RefAttributes<
|
|
55
|
+
export declare const InlineCitation: React.ForwardRefExoticComponent<InlineCitationProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e}from"react/jsx-runtime";import*as
|
|
1
|
+
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as n from"react";import{HoverCard as t}from"../hover-card/HoverCard.js";import{TextLink as i}from"../text-link/TextLink.js";import{fillMessage as a,linkMessages as o,sourcesMessages as l,useMessages as s}from"../../internal/i18n.js";import{opensElsewhere as c,safeHref as m,safeRel as d}from"../../internal/link.js";import{citationMarkClasses as f,cx as p,focusRingClasses as h,hasContent as u,metaTextClasses as v,srOnlyClasses as g,transitionClasses as b}from"../../internal/styles.js";import{useStyleDefaults as x}from"../../internal/defaults.js";export const InlineCitation=/*@__PURE__*/n.forwardRef(function InlineCitation(n,j){const{index:$,title:y,description:N,site:k,href:w,target:z,rel:C,preview:I=!0,size:T="md",color:H="primary",locale:L,labels:R,className:S,style:q,...A}=x(n,["size","locale"]),B=s(l,L),D=s(o,L),E={...B,...R},F=a(E.citation,{index:String($)}),G=m(w),J=I&&u(y),K={className:p(f,"align-[0.15em] no-underline",G?"cursor-pointer":"cursor-default","hover:bg-(--n-soft-hover)",h,b,S??""),style:{"--n-soft":`var(--neba-${H}-soft)`,"--n-soft-hover":`var(--neba-${H}-soft-hover)`,"--n-on-tint":`var(--neba-${H}-on-tint)`,"--n-ring":`var(--neba-${H}-ring)`,...q}},M=G?e("a",{ref:j,href:G,target:z,rel:d(z,C),"aria-label":c(z)?`${F} ${D.newTab}`:F,...K,...A,children:$}):r("span",{ref:j,tabIndex:J?0:void 0,...K,...A,children:[e("span",{className:g,children:F}),e("span",{"aria-hidden":"true",children:$})]});return J?e(t,{size:T,color:H,trigger:M,title:G?e(i,{href:G,underline:"hover",target:z,rel:d(z,C),locale:L,children:y}):y,description:k,children:u(N)?e("span",{className:p("text-(--neba-muted-fg)",v[T]),children:N}):null}):M});
|
|
@@ -88,7 +88,7 @@ export interface MenuItemProps {
|
|
|
88
88
|
* Where the link opens — `_blank` and the rest. Ignored without `href`.
|
|
89
89
|
*
|
|
90
90
|
* Anything other than this tab also gets `rel="noopener noreferrer"`, merged
|
|
91
|
-
* with whatever `rel` was asked for, exactly as on [TextLink].
|
|
91
|
+
* with whatever `rel` was asked for, exactly as on [TextLink](../display/text-link).
|
|
92
92
|
*/
|
|
93
93
|
target?: string;
|
|
94
94
|
/** The link's `rel`. The two tokens a new tab needs are added to it. */
|
|
@@ -242,6 +242,10 @@ export declare function Menu(rawProps: MenuProps): React.JSX.Element;
|
|
|
242
242
|
*
|
|
243
243
|
* Base UI positions the popup at the pointer rather than against an anchor, and
|
|
244
244
|
* the long press is what makes it reachable on a touch screen at all.
|
|
245
|
+
*
|
|
246
|
+
* The ref goes to the area, with everything else it is handed. A `forwardRef`
|
|
247
|
+
* and not a plain function for React 18's sake, which drops a ref given to a
|
|
248
|
+
* function component: a `Tooltip` around this one attaches its own, and lost it.
|
|
245
249
|
*/
|
|
246
|
-
export declare
|
|
250
|
+
export declare const ContextMenu: React.ForwardRefExoticComponent<ContextMenuProps & React.RefAttributes<HTMLDivElement>>;
|
|
247
251
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as n,Fragment as t}from"react/jsx-runtime";import*as l from"react";import{glowClasses as a,spotlightSlot as s,trackPointer as o}from"../../internal/glow.js";import{Menu as r}from"@base-ui/react/menu";import{useDirection as i}from"@base-ui/react/direction-provider";import{ContextMenu as c}from"@base-ui/react/context-menu";import{MenuContext as d}from"../../internal/menu.js";import{CheckIcon as u,ChevronIcon as m,DotIcon as p}from"../../internal/icons.js";import{safeHref as h,safeRel as f}from"../../internal/link.js";import{controlTextLeadingClasses as
|
|
1
|
+
"use client";import{jsx as e,jsxs as n,Fragment as t}from"react/jsx-runtime";import*as l from"react";import{glowClasses as a,spotlightSlot as s,trackPointer as o}from"../../internal/glow.js";import{Menu as r}from"@base-ui/react/menu";import{useDirection as i}from"@base-ui/react/direction-provider";import{ContextMenu as c}from"@base-ui/react/context-menu";import{MenuContext as d}from"../../internal/menu.js";import{CheckIcon as u,ChevronIcon as m,DotIcon as p}from"../../internal/icons.js";import{safeHref as h,safeRel as f}from"../../internal/link.js";import{NewTabNote as x}from"../../internal/new-tab.js";import{controlTextLeadingClasses as b,cx as g,gapClasses as y,hasContent as N,iconClasses as v,metaTextClasses as C,popupFadeClasses as k,radiusClasses as z,surfaceClasses as O,surfaceSlots as M,transitionClasses as w}from"../../internal/styles.js";import{useStyleDefaults as I}from"../../internal/defaults.js";const P=[O,"max-h-[min(24rem,var(--available-height))] min-w-40 overflow-y-auto overscroll-contain","border bg-(--n-panel-press) p-1","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]","[outline:none]",k].join(" "),j={default:{xs:"px-1.5 py-0.5",sm:"px-2 py-1",md:"px-2.5 py-1.5",lg:"px-3 py-2",xl:"px-3.5 py-2.5"},compact:{xs:"px-1 py-0.5",sm:"px-1.5 py-0.5",md:"px-2 py-1",lg:"px-2.5 py-1",xl:"px-3 py-1.5"}},R={xs:z.xs,sm:z.xs,md:z.sm,lg:z.sm,xl:z.md};function $(e,n,t,l,s){return g("relative flex w-full cursor-pointer items-center select-none",l?a:"",t?"text-(--n-on-tint)":"text-(--neba-fg)",j[n][e],R[e],y[e],b[e],w,v,"data-[highlighted]:bg-(--n-soft-hover)","data-[popup-open]:bg-(--n-soft)","data-[disabled]:cursor-not-allowed data-[disabled]:text-(--neba-disabled-fg)","[outline:none]",s??"")}const B="flex h-[1lh] w-[1.2em] shrink-0 items-center justify-center";function RowBody({children:t,description:l,size:a}){return N(l)?n("span",{className:"flex min-w-0 flex-1 flex-col text-start",children:[e("span",{className:"truncate",children:t}),e("span",{className:`truncate text-(--neba-muted-fg) ${C[a]}`,children:l})]}):e("span",{className:"min-w-0 flex-1 truncate text-start",children:t})}export function MenuItem({onClick:a,href:i,target:c,rel:u,startIcon:m,endIcon:p,shortcut:b,description:g,color:y,closeOnClick:v=!0,disabled:k=!1,label:z,children:O,className:w,style:I}){const P=l.useContext(d),{size:j,density:R}=P,F=n(t,{children:[N(m)?e("span",{className:`${B} text-(--neba-muted-fg)`,children:m}):null,e(RowBody,{description:g,size:j,children:O}),N(p)?e("span",{className:`${B} text-(--neba-muted-fg)`,children:p}):null,N(b)?e("span",{className:`ms-2 shrink-0 text-(--neba-muted-fg) tabular-nums ${C[j]}`,children:b}):null]}),G={...y?M(y,0):void 0,...s,...I},S=h(i);return void 0===S||k?e(r.Item,{disabled:k,label:z,closeOnClick:v,onClick:a,className:$(j,R,Boolean(y),!k,w),style:G,onPointerMove:o(void 0,!k),children:F}):n(r.LinkItem,{href:S,target:c,rel:f(c,u),label:z,closeOnClick:v,onClick:a,className:$(j,R,Boolean(y),!k,w),style:G,onPointerMove:o(void 0,!0),children:[F,e(x,{target:c})]})}export function MenuCheckboxItem({checked:t,defaultChecked:a,onCheckedChange:i,endIcon:c,shortcut:m,description:p,color:h,closeOnClick:f=!1,disabled:x=!1,label:b,children:g,className:y,style:v}){const{size:k,density:z}=l.useContext(d),O=h?M(h,0):void 0;return n(r.CheckboxItem,{checked:t,defaultChecked:a,onCheckedChange:e=>i?.(e),disabled:x,label:b,closeOnClick:f,className:$(k,z,Boolean(h),!x,y),style:{...O,...s,...v},onPointerMove:o(void 0,!x),children:[e("span",{className:`${B} text-(--n-accent)`,children:e(r.CheckboxItemIndicator,{className:"flex items-center justify-center",children:e(u,{})})}),e(RowBody,{description:p,size:k,children:g}),N(c)?e("span",{className:`${B} text-(--neba-muted-fg)`,children:c}):null,N(m)?e("span",{className:`ms-2 shrink-0 text-(--neba-muted-fg) tabular-nums ${C[k]}`,children:m}):null]})}export function MenuRadioGroup({value:n,defaultValue:t,onValueChange:l,disabled:a=!1,children:s,className:o}){return e(r.RadioGroup,{value:n,defaultValue:t,onValueChange:e=>l?.(e),disabled:a,className:o,children:s})}export function MenuRadioItem({value:t,endIcon:a,shortcut:i,description:c,color:u,closeOnClick:m=!1,disabled:h=!1,label:f,children:x,className:b,style:g}){const{size:y,density:v}=l.useContext(d),k=u?M(u,0):void 0;return n(r.RadioItem,{value:t,disabled:h,label:f,closeOnClick:m,className:$(y,v,Boolean(u),!h,b),style:{...k,...s,...g},onPointerMove:o(void 0,!h),children:[e("span",{className:`${B} text-(--n-accent)`,children:e(r.RadioItemIndicator,{className:"flex items-center justify-center",children:e(p,{})})}),e(RowBody,{description:c,size:y,children:x}),N(a)?e("span",{className:`${B} text-(--neba-muted-fg)`,children:a}):null,N(i)?e("span",{className:`ms-2 shrink-0 text-(--neba-muted-fg) tabular-nums ${C[y]}`,children:i}):null]})}export function MenuGroup({label:t,children:a,className:s}){const{size:o,density:i}=l.useContext(d);return n(r.Group,{className:s,children:[N(t)?e(r.GroupLabel,{className:[j[i][o],C[o],"font-semibold tracking-wide text-(--neba-muted-fg) uppercase"].join(" "),children:t}):null,a]})}export function MenuSeparator({className:n,...t}){return e(r.Separator,{className:g("-mx-1 my-1 h-px bg-(--n-line)",n??""),...t})}export function MenuSubmenu({label:t,startIcon:a,disabled:c=!1,side:u,sideOffset:p=4,children:h,className:f,style:x}){const y=l.useContext(d),{size:v,density:C,color:k}=y,O=i();return n(r.SubmenuRoot,{children:[n(r.SubmenuTrigger,{disabled:c,className:$(v,C,!1,!c),style:s,onPointerMove:o(void 0,!c),children:[N(a)?e("span",{className:`${B} text-(--neba-muted-fg)`,children:a}):null,e("span",{className:"min-w-0 flex-1 truncate text-start",children:t}),e("span",{className:`${B} text-(--neba-muted-fg) ${"rtl"===O?"rotate-90":"-rotate-90"}`,children:e(m,{})})]}),e(r.Portal,{children:e(r.Positioner,{className:"neba-portal z-(--neba-z-portal) [outline:none]",side:u??"inline-end",sideOffset:p,align:"start",children:e(r.Popup,{className:g(P,z[v],b[v],f??""),style:{...M(k,3),...x},children:h})})})]})}export function Menu(t){const{size:a="md",color:s="primary",density:o="default",trigger:i,open:c,defaultOpen:u,onOpenChange:m,side:p="bottom",align:h="start",sideOffset:f=6,modal:x,openOnHover:y=!1,loopFocus:N=!0,disabled:v=!1,className:C,style:k,children:O}=I(t,["size","density"]),w=l.useMemo(()=>({size:a,color:s,density:o}),[a,s,o]);return e(d.Provider,{value:w,children:n(r.Root,{open:c,defaultOpen:u,onOpenChange:e=>m?.(e),modal:x,loopFocus:N,disabled:v,children:[i?e(r.Trigger,{render:i,openOnHover:y,disabled:v}):null,e(r.Portal,{children:e(r.Positioner,{className:"neba-portal z-(--neba-z-portal) [outline:none]",side:p,align:h,sideOffset:f,children:e(r.Popup,{className:g(P,z[a],b[a],C??""),style:{...M(s,3),...k},children:O})})})]})})}export const ContextMenu=/*@__PURE__*/l.forwardRef(function ContextMenu(t,a){const{size:s="md",color:o="primary",density:r="default",content:i,children:u,open:m,defaultOpen:p,onOpenChange:h,loopFocus:f=!0,disabled:x=!1,className:y,style:N,...v}=I(t,["size","density"]),C=l.useMemo(()=>({size:s,color:o,density:r}),[s,o,r]);return e(d.Provider,{value:C,children:n(c.Root,{open:m,defaultOpen:p,onOpenChange:e=>h?.(e),loopFocus:f,disabled:x,children:[e(c.Trigger,{ref:a,render:u,...v}),e(c.Portal,{children:e(c.Positioner,{className:"neba-portal z-(--neba-z-portal) [outline:none]",children:e(c.Popup,{className:g(P,z[s],b[s],y??""),style:{...M(o,3),...N},children:i})})})]})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import*as r from"react";import{ScreenContext as n}from"../../internal/screen.js";import{useRender as a}from"@base-ui/react/use-render";import{transitionProps as o}from"../../internal/animate.js";import{MockupCutout as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import*as r from"react";import{ScreenContext as n}from"../../internal/screen.js";import{useRender as a}from"@base-ui/react/use-render";import{transitionProps as o}from"../../internal/animate.js";import{MockupCutout as s,defaultNotch as h,elevationFilters as d,finishSlots as l,mockupChrome as c,mockupMetrics as u,resolveOs as m,shellClasses as f}from"../../internal/mockup.js";import{observeResize as p}from"../../internal/observe.js";import{cx as g,surfaceSlots as b}from"../../internal/styles.js";import{useStyleDefaults as v}from"../../internal/defaults.js";const w="undefined"==typeof document?r.useEffect:r.useLayoutEffect;export const Mockup=/*@__PURE__*/r.forwardRef(function Mockup(y,x){const{device:k,os:N,hardware:M="monitor",size:R="md",resolution:$,orientation:j="portrait",bezel:z="standard",finish:W="graphite",notch:H,systemUi:P=!0,scroll:E=!1,wallpaper:L,time:S="9:41",width:B,height:C,color:F="primary",elevation:I=0,transition:T,render:U,className:q,style:A,children:D,...G}=v(y,["size"]),J=m(k,N),K=H??h(k,J),O="desktop"!==k&&"landscape"===j,Q=u({device:k,size:R,resolution:$,orientation:j,bezel:z,hardware:M}),{screen:V,frame:X,body:Y,stand:Z,base:_}=Q,ee=r.useRef(null),[te,ie]=r.useState(null),re="number"==typeof B?"number"==typeof C?Math.min(B/X.width,C/X.height):B/X.width:"number"==typeof C&&void 0===B?C/X.height:null,ne=te??re;w(()=>{const e=ee.current;if(!e)return;const t=()=>{const t=e.offsetWidth,i=e.offsetHeight;if(t<=0||i<=0)return;const r=Math.min(t/X.width,i/X.height);ie(e=>null!==e&&Math.abs(e-r)<1e-4?e:r)};return t(),p(e,t)},[X.width,X.height]);const ae=r.useCallback(e=>{ee.current=e,"function"==typeof x?x(e):x&&(x.current=e)},[x]),oe=P?c({os:J,notch:K,landscape:O,time:S}):{},se=o(T),he="none"===z,de=t("div",{className:"neba-mockup-screen relative flex flex-col overflow-hidden",style:{width:V.width,height:V.height,borderRadius:Q.screenRadius,background:L??"var(--neba-surface)",boxShadow:he?void 0:"inset 0 0 0 1px var(--n-shell-shade)"},children:[oe.top?.node,t("div",{className:"flex min-h-0 flex-1",children:[oe.start?.node,e("div",{className:"min-w-0 flex-1 "+(E?"overflow-auto":"overflow-hidden"),style:{containerType:"size",containerName:"neba-screen"},children:e(n.Provider,{value:!0,children:D})})]}),oe.bottom?.node,e(s,{notch:K,screen:V,landscape:O})]}),le=g("neba-mockup relative block overflow-hidden",se.className,q??"");return a({render:U,ref:ae,props:{className:le,style:{...b(F,I),...l[W],...se.style,width:B??(void 0===C?"100%":"auto"),height:C??"auto",aspectRatio:`${X.width} / ${X.height}`,filter:d[I],...A},children:t("div",{className:"absolute top-1/2 left-1/2 flex flex-col items-center",style:{width:X.width,height:X.height,transform:`translate(-50%, -50%) scale(${ne??1})`,visibility:null===ne?"hidden":void 0},children:[e("div",{className:he?"":f,style:{width:Y.width,height:Y.height,borderRadius:Q.frameRadius,paddingBlock:`${Q.bezel.top}px ${Q.bezel.bottom}px`,paddingInline:Q.bezel.x},children:de}),Z?t(i,{children:[e("div",{"aria-hidden":"true",style:{width:Z.neckWidth,height:Z.neckHeight,background:"var(--n-shell-shade)",clipPath:"polygon(16% 0, 84% 0, 100% 100%, 0 100%)"}}),e("div",{"aria-hidden":"true",className:f,style:{width:Z.footWidth,height:Z.footHeight,borderRadius:Z.footHeight/2}})]}):null,_?e("div",{"aria-hidden":"true",className:`relative ${f}`,style:{width:_.width,height:_.height,borderRadius:`0 0 ${Math.round(.55*_.height)}px ${Math.round(.55*_.height)}px`,clipPath:"polygon(0 0, 100% 0, 98.5% 100%, 1.5% 100%)"},children:e("div",{className:"absolute top-0 left-1/2",style:{width:_.lipWidth,height:Math.round(.34*_.height),marginLeft:-_.lipWidth/2,borderRadius:`0 0 ${Math.round(.2*_.height)}px ${Math.round(.2*_.height)}px`,background:"var(--n-shell-shade)"}})}):null]}),...G}})});
|
|
@@ -34,7 +34,7 @@ export interface NavigationMenuItemProps {
|
|
|
34
34
|
* Where the link opens. Ignored without `href`.
|
|
35
35
|
*
|
|
36
36
|
* Anything other than this tab also gets `rel="noopener noreferrer"`, merged
|
|
37
|
-
* with whatever `rel` was asked for, exactly as on [TextLink].
|
|
37
|
+
* with whatever `rel` was asked for, exactly as on [TextLink](../display/text-link).
|
|
38
38
|
*/
|
|
39
39
|
target?: string;
|
|
40
40
|
/** The link's `rel`. The two tokens a new tab needs are added to it. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as n,Fragment as a}from"react/jsx-runtime";import*as t from"react";import{NavigationMenu as i}from"@base-ui/react/navigation-menu";import{ChevronIcon as r}from"../../internal/icons.js";import{safeHref as
|
|
1
|
+
"use client";import{jsx as e,jsxs as n,Fragment as a}from"react/jsx-runtime";import*as t from"react";import{NavigationMenu as i}from"@base-ui/react/navigation-menu";import{ChevronIcon as r}from"../../internal/icons.js";import{safeHref as o,safeRel as s}from"../../internal/link.js";import{NewTabNote as l}from"../../internal/new-tab.js";import{controlHeightClasses as d,controlTextClasses as c,controlTextLeadingClasses as u,cx as p,gapClasses as m,hasContent as f,iconClasses as h,metaTextClasses as b,paddingXClasses as g,popupFadeStateClasses as v,radiusClasses as x,surfaceClasses as N,surfaceSlots as y,transitionClasses as w}from"../../internal/styles.js";import{useStyleDefaults as j}from"../../internal/defaults.js";const _=/*@__PURE__*/t.createContext({size:"md",density:"default"}),k=["inline-flex shrink-0 cursor-pointer select-none items-center justify-center","whitespace-nowrap font-medium leading-none no-underline","text-(--neba-fg) bg-transparent","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",w,h,"hover:bg-(--n-soft)","data-[popup-open]:bg-(--n-soft-hover) data-[popup-open]:text-(--n-on-tint)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2","data-[disabled]:cursor-not-allowed data-[disabled]:text-(--neba-disabled-fg)","data-[disabled]:hover:bg-transparent"].join(" "),z=[N,"relative 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] overflow-hidden","[transition:opacity_var(--neba-duration)_var(--neba-ease),width_var(--neba-duration)_var(--neba-ease),height_var(--neba-duration)_var(--neba-ease)]",v].join(" "),M=["flex min-w-0 cursor-pointer items-start no-underline","text-(--neba-fg) bg-transparent",w,h,"hover:bg-(--n-soft)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]"].join(" "),C={xs:"p-1",sm:"p-1.5",md:"p-2",lg:"p-2.5",xl:"p-3"};export const NavigationMenuLink=/*@__PURE__*/t.forwardRef(function NavigationMenuLink({href:a,title:r,description:d,startIcon:c,target:h,rel:v,className:N,children:y,...w},j){const{size:k,density:z}=t.useContext(_);return n(i.Link,{ref:j,href:o(a),target:h,rel:s(h,v),className:p(M,x[k],m[k],g[z??"default"][k],"py-2",N??""),...w,children:[f(c)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:c}):null,n("span",{className:"flex min-w-0 flex-col gap-0.5",children:[e("span",{className:`font-medium ${u[k]}`,children:r}),f(d)?e("span",{className:`text-(--neba-muted-fg) ${b[k]}`,children:d}):null,y,e(l,{target:h})]})]})});export function NavigationMenuItem({label:u,href:p,target:h,rel:b,startIcon:v,value:N,disabled:y=!1,columns:w=1,keepMounted:j=!0,children:z}){const{size:M,density:$}=t.useContext(_),I=o(p),L=void 0!==I&&!f(z),P=[k,d[M],c[M],m[M],g[$??"default"][M],x[M]].join(" ");return e(i.Item,{value:N,children:L&&y?n("span",{"aria-disabled":"true","data-disabled":"",className:P,children:[f(v)?v:null,u]}):L?n(i.Link,{href:I,target:h,rel:s(h,b),className:P,children:[f(v)?v:null,u,e(l,{target:h})]}):n(a,{children:[n(i.Trigger,{disabled:y,className:P,children:[f(v)?v:null,u,e(i.Icon,{className:"flex items-center [transition:rotate_var(--neba-duration)_var(--neba-ease)] data-[popup-open]:rotate-180",children:e(r,{})})]}),e(i.Content,{keepMounted:j,className:`grid gap-1 [&[hidden]]:hidden ${C[M]}`,style:w>1?{gridTemplateColumns:`repeat(${w}, minmax(0, 1fr))`}:void 0,children:z})]})})}export const NavigationMenu=/*@__PURE__*/t.forwardRef(function NavigationMenu(a,r){const{size:o="md",color:s="primary",density:l="default",orientation:d="horizontal",value:c,defaultValue:u,onValueChange:p,delay:f,closeDelay:h,sideOffset:b=8,className:g,style:v,children:N,...w}=j(a,["size","density"]),k=t.useMemo(()=>({size:o,density:l}),[o,l]),M=y(s,3);return e(_.Provider,{value:k,children:n(i.Root,{ref:r,orientation:d,value:c,defaultValue:u,onValueChange:e=>p?.(e),delay:f,closeDelay:h,className:g,style:{...M,...v},...w,children:[e(i.List,{className:["flex items-center","vertical"===d?"flex-col items-stretch":"flex-row",m[o]].join(" "),children:N}),e(i.Portal,{children:e(i.Positioner,{className:"neba-portal z-(--neba-z-portal) [outline:none]",side:"vertical"===d?"inline-end":"bottom",sideOffset:b,collisionPadding:12,children:e(i.Popup,{className:`${z} ${x[o]}`,style:M,children:e(i.Viewport,{})})})})]})})});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { NebaElevation, NebaFieldSlot, NebaShortcuts, NebaSlots, NebaStyleProps } from '../../types.js';
|
|
2
|
+
import type { NebaElevation, NebaFieldSlot, NebaLabelPlacement, NebaShortcuts, NebaSlots, NebaStyleProps } from '../../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Where the two steppers sit.
|
|
5
5
|
*
|
|
@@ -94,11 +94,16 @@ export interface NumberFieldProps extends NebaStyleProps, Omit<React.ComponentPr
|
|
|
94
94
|
incrementLabel?: string;
|
|
95
95
|
/** Accessible name of the decrement button. */
|
|
96
96
|
decrementLabel?: string;
|
|
97
|
+
/** The field's name, wired to the control by Base UI's Field. */
|
|
98
|
+
label?: React.ReactNode;
|
|
97
99
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
+
* Where the label is drawn: above the field, in a notch cut into its top
|
|
101
|
+
* edge, or inside it until the field is focused or filled. A `startIcon` or
|
|
102
|
+
* `split` steppers keep a `float` label in the notch, because they are where
|
|
103
|
+
* it would rest.
|
|
104
|
+
* @default 'top'
|
|
100
105
|
*/
|
|
101
|
-
|
|
106
|
+
labelPlacement?: NebaLabelPlacement;
|
|
102
107
|
/** Helper text below the control. */
|
|
103
108
|
description?: React.ReactNode;
|
|
104
109
|
/** Error message below the control. Its presence also turns the field invalid. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{NumberField as t}from"@base-ui/react/number-field";import{Field as n}from"@base-ui/react/field";import{numberMessages as r,useMessages as i}from"../../internal/i18n.js";import{MinusIcon as s,PlusIcon as o}from"../../internal/icons.js";import{keyHandler as c}from"../../internal/keys.js";import{FieldNotch as d,NotchFrame as m,restEndOf as u}from"../../internal/notch.js";import{controlTextLeadingClasses as p,cx as b,disabledClasses as f,fieldFocusTransitionClasses as h,fieldHeightClasses as g,fieldReadOnlyClasses as x,fieldRestClasses as v,fieldRingClasses as N,fieldSheetClasses as y,fieldSheetDisabledClasses as j,fieldSheetReadOnlyClasses as w,gapClasses as k,hasContent as _,iconClasses as S,metaTextClasses as C,paddingXClasses as V,radiusClasses as z,readOnlyFilterClasses as O,stackGapClasses as $,surfaceSlots as I,transitionClasses as D}from"../../internal/styles.js";import{useStyleDefaults as F}from"../../internal/defaults.js";import{fieldLight as L,fieldSpotlightSlot as R,glowClasses as q}from"../../internal/glow.js";import{useFieldsetDisabled as E}from"../../internal/fieldset.js";const P=["group relative flex w-full items-center","[-webkit-tap-highlight-color:transparent]",D,h,S].join(" "),W=["relative inline-flex size-[1.7em] shrink-0 cursor-pointer items-center justify-center","neba-hit-row","rounded-(--neba-radius-xs) text-(--neba-muted-fg) select-none","[&_svg]:size-[0.9em] [&_svg]:shrink-0","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]","[transition:background-color_var(--neba-duration)_var(--neba-ease),color_var(--neba-duration)_var(--neba-ease)]","active:[transition-duration:0ms]","hover:bg-(--n-soft) hover:text-(--n-on-tint)","active:bg-(--n-soft-press)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1","disabled:cursor-not-allowed disabled:bg-transparent disabled:text-(--neba-disabled-fg)"].join(" ");export const NumberField=/*@__PURE__*/l.forwardRef(function NumberField(l,h){const{variant:S="outline",size:D="md",color:B="primary",density:G="default",elevation:K=0,value:A,defaultValue:H,onValueChange:J,onValueCommitted:M,min:Q,max:T,step:U,largeStep:X,smallStep:Y,snapOnStep:Z,wheel:ee=!0,format:ae,locale:le,steppers:te="end",incrementLabel:ne,decrementLabel:re,label:ie,labelPlacement:se="top",description:oe,error:ce,invalid:de,startIcon:me,endIcon:ue,fullWidth:pe=!1,disabled:be,readOnly:fe=!1,required:he=!1,name:ge,placeholder:xe,id:ve,className:Ne,classNames:ye,shortcuts:je,style:we,"aria-label":ke,"aria-labelledby":_e,...Se}=F(l,["size","density","variant","locale","labelPlacement"]),Ce=E(be),Ve=!Ce&&!fe,ze=i(r,"string"==typeof le?le:void 0),Oe=_(ce),$e=de??Oe,Ie=$e?"danger":B,De=V[G][D],Fe={end:`${De} pe-1`,split:"px-1",none:De},Le=e(t.Decrement,{"aria-label":re??ze.decrease,className:b(W,ye?.stepper),children:e(s,{})}),Re=e(t.Increment,{"aria-label":ne??ze.increase,className:b(W,ye?.stepper),children:e(o,{})}),qe="none"!==te&&!fe,Ee="top"!==se&&_(ie),Pe=Ee&&"float"===se&&!_(me)&&!(qe&&"split"===te),We=a(t.Group,{...L(Ve),className:b(P,g[D],p[D],z[D],k[D],qe?Fe[te]:De,Ee?"":N,Ce?(Ee?j:f)[S]:fe?Ee?`${w[S]} ${O}`:x[S]:`${(Ee?y:v)[S]} ${q}`,Ce?"":"cursor-text",ye?.shell),children:[qe&&"split"===te?Le:null,me?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:me}):null,e(t.Input,{ref:h,"aria-label":ke,"aria-labelledby":_e,onKeyDown:c(je),placeholder:Pe?xe||" ":xe,className:["neba-input min-w-0 flex-1 self-stretch bg-transparent [font:inherit] text-inherit","[outline:none]","tabular-nums","split"===te&&qe?"text-center":"","placeholder:text-(--neba-muted-fg)","caret-(--n-accent) selection:bg-(--n-soft-press)","disabled:cursor-not-allowed",Pe?"neba-float-control":"",ye?.control].filter(Boolean).join(" ")}),ue?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:ue}):null,qe&&"end"===te?a("span",{className:"flex shrink-0 items-center gap-0.5",style:{"--n-hit-gap":"0.125rem"},children:[Le,Re]}):null,qe&&"split"===te?Re:null,Ee?e(d,{label:ie,variant:S,disabled:Ce,readOnly:fe,rests:Pe,labelClassName:ye?.label}):null]});return a(n.Root,{disabled:Ce,invalid:$e,className:b("flex-col align-top",$[D],pe?"flex w-full":"inline-flex",Ne??""),style:{...I(Ie,K),...Ve?R:void 0,...we},...Se,children:[ie&&!Ee?e(n.Label,{className:b(C[D],"font-medium",Ce?"text-(--neba-disabled-fg)":"text-(--neba-fg)",ye?.label),children:ie}):null,e(t.Root,{id:ve,name:ge,className:"contents",value:A,defaultValue:H,onValueChange:e=>J?.(e),onValueCommitted:e=>M?.(e),min:Q,max:T,step:U,largeStep:X,smallStep:Y,snapOnStep:Z,allowWheelScrub:ee,format:ae,locale:le,disabled:Ce,readOnly:fe,required:he,children:Ee?e(m,{label:ie,size:D,density:G,variant:S,rests:Pe,restEnd:u(D,[...ue?[1.2]:[],...qe&&"end"===te?[3.55]:[]]),labelClassName:ye?.label,children:We}):We}),oe?e(n.Description,{className:b(C[D],"text-(--neba-muted-fg)",ye?.description),children:oe}):null,e(n.Error,Oe?{match:!0,className:b(C[D],"text-(--n-accent)",ye?.error),children:ce}:{className:b(C[D],"text-(--n-accent)",ye?.error)})]})});
|
|
@@ -77,7 +77,7 @@ export interface OverlayProps extends Omit<React.ComponentPropsWithoutRef<'div'>
|
|
|
77
77
|
/**
|
|
78
78
|
* A sheet over the whole page that stops it being used.
|
|
79
79
|
*
|
|
80
|
-
* The difference from [Dialog](
|
|
80
|
+
* The difference from [Dialog](./dialog) is what is *not* here: no
|
|
81
81
|
* surface, no border, no title, no actions. An overlay is the scrim on its own,
|
|
82
82
|
* with whatever the caller puts on top of it — most often a spinner and a line
|
|
83
83
|
* saying what is being waited for.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as o}from"react/jsx-runtime";import*as l from"react";import{layoutMessages as n,useMessages as t}from"../../internal/i18n.js";import{PageLayoutContext as r,SidebarSideContext as a,PageLayoutSlotContext as s}from"../../internal/page-layout.js";import{observeResize as i}from"../../internal/observe.js";import{controlSlots as u,cx as c,hasContent as d,toLength as
|
|
1
|
+
"use client";import{jsx as e,jsxs as o}from"react/jsx-runtime";import*as l from"react";import{layoutMessages as n,useMessages as t}from"../../internal/i18n.js";import{PageLayoutContext as r,SidebarSideContext as a,PageLayoutSlotContext as s}from"../../internal/page-layout.js";import{observeResize as i}from"../../internal/observe.js";import{controlSlots as u,cx as c,hasContent as d,insetRingClasses as f,toLength as p}from"../../internal/styles.js";import{useStyleDefaults as m}from"../../internal/defaults.js";import{ScreenContext as h}from"../../internal/screen.js";const v=["header","footer"];export const PageLayout=/*@__PURE__*/l.forwardRef(function PageLayout(x,y){const{header:b,footer:w,sidebar:g,endSidebar:P,headerSpan:S="full",footerSpan:k="full",scroll:C="page",height:j="viewport",collapseBelow:N="md",sidebarOpen:O,defaultSidebarOpen:$=!1,onSidebarOpenChange:L,endSidebarOpen:R,defaultEndSidebarOpen:z=!1,onEndSidebarOpenChange:E,skipLink:B=!0,skipLabel:H,main:I,mainId:M="main",mainProps:_,locale:T,color:q="primary",className:A,style:D,children:F,...G}=m(x,["locale"]),J=t(n,T),K=l.useContext(h),Q=I??!K,[U,V]=l.useState($),[W,X]=l.useState(z),Y=l.useMemo(()=>({start:O??U,end:R??W}),[O,U,R,W]),Z=l.useCallback((e,o)=>{if("start"===e)return void 0===O&&V(o),void L?.(o);void 0===R&&X(o),E?.(o)},[O,R,L,E]),ee=l.useRef(null),oe=l.useCallback(e=>{ee.current=e,"function"==typeof y?y(e):y&&(y.current=e)},[y]),le=l.useRef({header:null,footer:null}),ne=l.useRef({header:null,footer:null}),te=l.useCallback(()=>{const e=ee.current;if(e)for(const o of v){const l=le.current[o],n="header"===o?S:k;if(!l){e.style.setProperty(`--n-layout-${o}`,"0px"),e.style.setProperty(`--n-layout-${o}-inset`,"0px");continue}const t=getComputedStyle(l).position,r=`${l.offsetHeight}px`,a="sticky"===t||"fixed"===t;e.style.setProperty(`--n-layout-${o}`,a&&"full"===n?r:"0px"),e.style.setProperty(`--n-layout-${o}-inset`,"fixed"===t?r:"0px")}},[S,k]),re=l.useCallback(()=>{for(const e of v){ne.current[e]?.();const o=le.current[e];ne.current[e]=o?i(o,()=>te()):null}te()},[te]);l.useEffect(()=>{const e=ne.current;return re(),()=>{for(const o of v)e[o]?.(),e[o]=null}},[re]);const ae=l.useCallback((e,o)=>{le.current[e]=o,re()},[re]),se=l.useMemo(()=>({present:!0,register:ae,collapseBelow:N,open:Y,setOpen:Z,scroll:C,locale:T}),[ae,N,Y,Z,C,T]),ie="content"===C,ue=p("viewport"===j||"auto"===j?void 0:j),ce=void 0!==ue?"":"auto"===j?ie?"h-full":"min-h-full":ie?"h-dvh":"min-h-dvh",de=d(b)?e(s.Provider,{value:"header",children:b}):null,fe=d(w)?e(s.Provider,{value:"footer",children:w}):null;return e(r.Provider,{value:se,children:o("div",{ref:oe,className:c("relative flex w-full flex-col",ie?"overflow-hidden":"",ce,"full"===S?"[padding-top:var(--n-layout-header-inset,0px)]":"","full"===k?"[padding-bottom:var(--n-layout-footer-inset,0px)]":"",A),style:void 0===ue?D:{...ie?{height:ue}:{minHeight:ue},...D},...G,children:[B&&Q?e("a",{href:`#${M}`,className:c("absolute start-3 top-3 z-50 size-px overflow-hidden whitespace-nowrap","[clip-path:inset(50%)] focus:size-auto focus:overflow-visible focus:[clip-path:none]","focus:rounded-(--neba-radius-md) focus:bg-(--n-fill) focus:px-4 focus:py-2","focus:font-medium focus:text-(--n-on-solid) focus:no-underline","focus:[box-shadow:var(--neba-shadow-2),var(--neba-plate-solid)]","focus:[outline:2px_solid_var(--n-ring)] focus:outline-offset-2"),style:u(q,2,"solid"),children:H??J.skipToContent}):null,"full"===S?de:null,o("div",{className:c("flex w-full flex-1",ie?"min-h-0":""),children:[d(g)?e(a.Provider,{value:"start",children:g}):null,o("div",{className:c("flex min-w-0 flex-1 flex-col",ie?"min-h-0":"","content"===S?"[padding-top:var(--n-layout-header-inset,0px)]":"","content"===k?"[padding-bottom:var(--n-layout-footer-inset,0px)]":""),children:["content"===S?de:null,Q?e("main",{tabIndex:-1,..._,id:M,className:c("min-w-0 flex-1",f,ie?"min-h-0 overflow-y-auto":"",_?.className),children:F}):e("div",{..._,className:c("min-w-0 flex-1",ie?"min-h-0 overflow-y-auto":"",_?.className),children:F}),"content"===k?fe:null]}),d(P)?e(a.Provider,{value:"end",children:P}):null]}),"full"===k?fe:null]})})});
|
|
@@ -43,8 +43,9 @@ export interface PaginationProps extends NebaStyleProps, Omit<React.ComponentPro
|
|
|
43
43
|
*
|
|
44
44
|
* `onPageChange` still fires and the press is still cancelled first, so a
|
|
45
45
|
* client-side router keeps the page it already has. A link with nowhere to go
|
|
46
|
-
* — the current page, a stepper at the end of the row —
|
|
47
|
-
*
|
|
46
|
+
* — the current page, a stepper at the end of the row — is an `<a>` with no
|
|
47
|
+
* `href` and `aria-disabled`, so a crawler never follows it and a press on it
|
|
48
|
+
* leaves the focus where it was.
|
|
48
49
|
*/
|
|
49
50
|
getPageHref?: (page: number) => string;
|
|
50
51
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as t from"react";import{beginPointerDrag as r}from"../../internal/drag.js";import{observeResize as
|
|
1
|
+
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as t from"react";import{beginPointerDrag as r,drawnScale as o}from"../../internal/drag.js";import{observeResize as a}from"../../internal/observe.js";import{cx as i,toPixels as l,transitionClasses as s}from"../../internal/styles.js";import{useStyleDefaults as c}from"../../internal/defaults.js";import{panesMessages as u,useMessages as f}from"../../internal/i18n.js";const m=/*@__PURE__*/t.createContext({basis:null}),d={xs:"basis-1",sm:"basis-1.5",md:"basis-2",lg:"basis-2.5",xl:"basis-3"},h={xs:4,sm:6,md:8,lg:10,xl:12};function p(e,n,t){if(null!=e)return"number"==typeof e?n*e/100:l(e,{percentOf:n,relativeTo:t})}export const Panes=/*@__PURE__*/t.forwardRef(function Panes(l,g){const{orientation:x="horizontal",resizable:b=!0,color:v="primary",size:z="md",onResize:w,onResizeEnd:y,handleLabel:S,locale:M,className:R,style:$,children:j,...A}=c(l,["size","locale"]),E=t.Children.toArray(j).filter(t.isValidElement),k=E.length,C=f(u,M),N=t.useId(),P=e=>E[e]?.props.id??`${N}-pane-${e}`,D=t.useRef(null),I=t.useCallback(e=>{D.current=e,"function"==typeof g?g(e):g&&(g.current=e)},[g]),L=t.useRef([]);L.current=E.map(e=>e.props);const[T,F]=t.useState(null),H=T&&T.length===k?T:null,W=t.useRef(null);t.useEffect(()=>{W.current=H});const X="horizontal"===x,Y=h[z]*Math.max(0,k-1);function _(e){const n=D.current,t=W.current;if(!b||!n||!t||void 0===t[e+1])return null;const r=(X?n.offsetWidth:n.offsetHeight)-Y;if(r<=0)return null;const o=L.current[e],a=L.current[e+1],i=t[e]*r,l=i+t[e+1]*r,s=Math.max(p(o?.minSize,r,n)??0,l-(p(a?.maxSize,r,n)??l)),c=Math.min(p(o?.maxSize,r,n)??l,l-(p(a?.minSize,r,n)??0));return c<s?null:{root:n,current:t,extent:r,start:i,pair:l,resize(n){const o=Math.min(c,Math.max(s,i+n)),a=[...t];return a[e]=o/r,a[e+1]=(l-o)/r,F(a),w?.(a.map(e=>100*e)),a}}}t.useEffect(()=>{const e=D.current;if(!e)return;const n=()=>{const n=(X?e.offsetWidth:e.offsetHeight)-Y;n<=0||F(t=>t&&t.length===k?t:function(e,n,t){const r=e.map(e=>p(e.defaultSize,n,t)),o=r.reduce((e,n)=>e+(n??0),0),a=r.filter(e=>void 0===e).length,i=a>0?Math.max(0,n-o)/a:0,l=r.map(e=>Math.max(0,e??i)),s=l.reduce((e,n)=>e+n,0);return s<=0?l.map(()=>1/Math.max(1,l.length)):l.map(e=>e/s)}(L.current,n,e))};return n(),a(e,n)},[k,X,Y]);const K=t.useRef(null);t.useEffect(()=>()=>K.current?.(),[]);const O=i("group/handle relative z-1 flex shrink-0 grow-0 items-center justify-center",d[z],s,"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-0",b?i(X?"cursor-col-resize":"cursor-row-resize","neba-hit","touch-none","hover:bg-(--n-soft) data-[dragging]:bg-(--n-soft)"):"");return e("div",{ref:I,className:i("flex h-full w-full",X?"flex-row":"flex-col","min-h-0 min-w-0",R),style:{"--n-accent":`var(--neba-${v}-accent)`,"--n-soft":`var(--neba-${v}-soft)`,"--n-ring":`var(--neba-${v}-ring)`,...$},...A,children:E.map((a,l)=>n(t.Fragment,{children:[l>0?e("div",{role:"separator","aria-label":"function"==typeof S?S(l-1):S??C.handle,"aria-controls":`${P(l-1)} ${P(l)}`,"aria-orientation":X?"vertical":"horizontal","aria-valuenow":H?Math.round(100*H[l-1]):void 0,"aria-valuemin":0,"aria-valuemax":100,"aria-disabled":!b||void 0,tabIndex:b?0:-1,className:O,onPointerDown:e=>{0===e.button&&function(e,n){const t=_(e);if(!t)return;const a=n.currentTarget,i=X?n.clientX:n.clientY,l=X&&"rtl"===getComputedStyle(t.root).direction?-1:1,s=o(t.root)[X?"x":"y"];let c=t.current;K.current=r({target:a,pointerId:n.pointerId,onMove:e=>{const n=X?e.clientX:e.clientY;c=t.resize((n-i)/s*l)},onEnd:()=>{K.current=null,y?.(c.map(e=>100*e))}})}(l-1,e)},onKeyDown:e=>{const n=X&&"rtl"===getComputedStyle(e.currentTarget).direction,t=X?n?"ArrowRight":"ArrowLeft":"ArrowUp",r=X?n?"ArrowLeft":"ArrowRight":"ArrowDown";e.key!==t&&e.key!==r||(e.preventDefault(),function(e,n){const t=_(e);if(!t)return;const r=t.resize(n);y?.(r.map(e=>100*e))}(l-1,e.key===r?16:-16))},children:e("span",{"aria-hidden":"true",className:i("pointer-events-none bg-(--neba-border)",s,X?"h-full w-px":"h-px w-full",b?"group-hover/handle:bg-(--n-accent) group-focus-visible/handle:bg-(--n-accent) group-data-[dragging]/handle:bg-(--n-accent)":"")})}):null,e(m.Provider,{value:{basis:H?`calc((100% - ${Y}px) * ${H[l].toFixed(6)})`:null},children:void 0===a.props.id?t.cloneElement(a,{id:P(l)}):a})]},a.key??l))})});export const Pane=/*@__PURE__*/t.forwardRef(function Pane({defaultSize:n,minSize:r,maxSize:o,className:a,style:l,children:s,...c},u){const{basis:f}=t.useContext(m);return e("div",{ref:u,className:i("relative min-h-0 min-w-0 overflow-auto",a),style:{flex:f?`0 0 ${f}`:"1 1 0%",...l},...c,children:s})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as t from"react";import{ChartDataTable as n,ChartExport as a,ChartLegendBar as i,ChartStatus as r,ChartSummary as o,ChartSurface as s,ChartTooltipPanel as u,markTransitionClasses as d,summarise as m,useMeasuredWidth as c,useReleaseOutside as h,useVisibility as f,chartHeight as v,useMeasuredHeight as p}from"../../internal/chart-frame.js";import{arcPath as x,categoryAt as g,chartFontSizes as b,compactNumber as y,formatCategory as M,inkOn as N,markGap as j,seriesColor as w,toValue as k,warnPaletteOverflow as E}from"../../internal/chart.js";import{numberFormatter as I}from"../../internal/format.js";import{cx as z,metaTextClasses as P}from"../../internal/styles.js";import{chartMessages as A,emptyMessages as $,useMessages as L}from"../../internal/i18n.js";import{useStyleDefaults as S}from"../../internal/defaults.js";const B={pie:0,donut:.62,semi:.62};export function PieChart(C){const{data:R,categories:D,shape:O="pie",startAngle:_=0,hole:F,gap:H=j,center:K,valueLabels:T="none",height:V,format:W,locale:q,label:G,legend:J,tooltip:Q,empty:U,exportable:X=!1,exportFileName:Y="chart.csv",onExport:Z,size:ee="md",variant:le="text",padded:te=!1,className:ne,...ae}=S(C,["size","variant","locale"]),ie=t.useRef(null),re=c(ie),oe=L($,q),se=L(A,q),ue=t.useId(),de=t.useCallback(e=>W?I(q,W).format(e):y(e,q),[W,q]),me=t.useMemo(()=>R.map(k),[R]),ce=t.useMemo(()=>me.map((e,l)=>({name:M(g(l,D,[me]),q),data:[R[l]],color:e.color})),[me,D,R,q]),he=f(ce);t.useEffect(()=>{E(ce.length)},[ce.length]);const[fe,ve]=t.useState(null);h(ie,null!==fe,()=>ve(null));const pe=t.useId(),xe=ce.map((e,l)=>w(e,l)),ge=me.reduce((e,l,t)=>he.visible[t]&&null!==l.value?e+Math.max(0,l.value):e,0),be="semi"===O,ye=p(ie,"string"==typeof V),Me=v(V,ee,ye),Ne=b[ee],je=!1===J?{interactive:!1}:!0===J||void 0===J?{}:J,we=!1!==J&&ce.length>1,ke=je.side??"bottom",Ee=!1===Q?{mode:"none"}:!0===Q||void 0===Q?{}:Q,Ie="none"===Ee.mode,ze=re/2,Pe=Math.max(0,Math.min(re/2,be?Me:Me/2)-2),Ae=be?Math.min(Me,Me/2+Pe/2):Me/2,$e=Pe*Math.min(.92,Math.max(0,F??B[O])),Le=ge<=0||Pe<=0,Se=Pe>0?Math.min(15,Math.max(0,H)/Pe*(180/Math.PI)):0,Be=be?180:360,Ce=[];let Re=be?-90:_;me.forEach((e,l)=>{if(!he.visible[l]||null===e.value||e.value<=0)return;const t=e.value/ge,n=t*Be;Ce.push({index:l,start:Re,end:Re+n,value:e.value,share:t}),Re+=n});const De=null===fe?[]:[{seriesIndex:fe,name:ce[fe]?.name,color:me[fe]?.color??xe[fe],value:me[fe]?.value??null,formatted:`${de(me[fe]?.value??0)} · ${Math.round(10*(Math.max(0,me[fe]?.value??0)/ge*100+Number.EPSILON))/10}%`,label:me[fe]?.label}];return l(s,{...ae,size:ee,variant:le,padded:te,className:ne,legendSide:ke,legend:we?e(i,{series:ce,colors:xe,options:je,visibility:he,size:ee,values:je.showValue?me.map(e=>null===e.value?void 0:de(e.value)):void 0}):null,table:Le?null:e(n,{id:ue,caption:G,categories:ce.map(e=>e.name??""),series:[{name:G,data:R}],values:[me],format:de,locale:q}),children:[X&&!Le?e(a,{rows:()=>[["",G??se.label],...ce.map((e,l)=>[e.name??"",me[l]?.value??null])],fileName:Y,onExport:Z,label:se.exportCsv}):null,l("div",{ref:ie,role:"img",tabIndex:Le?void 0:0,"aria-label":G??se.label,"aria-describedby":Le?void 0:pe,onPointerLeave:e=>{"touch"!==e.pointerType&&ve(null)},onBlur:()=>ve(null),onKeyDown:e=>{const l=Ce.map(e=>e.index);if("Escape"===e.key){if(null===fe)return;ve(null)}else{if(Ie||0===l.length)return;if("Home"===e.key)ve(l[0]);else if("End"===e.key)ve(l[l.length-1]);else{if("ArrowRight"!==e.key&&"ArrowLeft"!==e.key)return;{const t=null===fe?-1:l.indexOf(fe),n="ArrowRight"===e.key?t+1:t-1;ve(l[(n+l.length)%l.length])}}}e.preventDefault()},className:z("relative w-full rounded-(--neba-radius-xs)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"),style:{height:"string"==typeof V?V:Me},children:[Le?e("div",{className:z("flex h-full items-center justify-center text-(--neba-muted-fg)",P[ee]),children:U??oe.title}):re>0?l("svg",{width:re,height:Me,viewBox:`0 0 ${re} ${Me}`,"aria-hidden":"true",className:"block",children:[Ce.map(l=>{const t=null!==he.hovered&&he.hovered!==l.index||null!==fe&&fe!==l.index,n=l.end-l.start>2*Se?Se/2:0;return e("path",{d:x(ze,Ae,Pe,$e,l.start+n,l.end-n),fill:me[l.index].color??xe[l.index],opacity:t?.32:1,onPointerEnter:Ie?void 0:()=>ve(l.index),className:d},l.index)}),"all"===T?Ce.map(l=>{const t=((l.start+l.end)/2-90)*(Math.PI/180),n=$e>0?($e+Pe)/2:.68*Pe,a=`${Math.round(100*l.share)}%`;return(l.end-l.start)*(Math.PI/180)*n<2*Ne||Pe-$e<1.6*Ne?null:e("text",{x:ze+n*Math.cos(t),y:Ae+n*Math.sin(t),textAnchor:"middle",dominantBaseline:"central",fontSize:Ne,fontWeight:600,fill:N(me[l.index].color,l.index),className:"tabular-nums",children:a},l.index)}):null]}):null,K&&$e>0?e("div",{className:"pointer-events-none absolute flex flex-col items-center justify-center text-center",style:{left:ze-$e,top:Ae-$e,width:2*$e,height:be?$e:2*$e},children:K}):null,null===fe||Ie?null:Ee.render?e("div",{className:"pointer-events-none absolute top-0 left-1/2 z-10",children:Ee.render({index:fe,category:ce[fe]?.name??fe,items:De})}):e(u,{heading:ce[fe]?.name,items:De,x:ze,y:8,flip:!1,size:ee})]}),Le?null:e(o,{id:pe,template:se.summary,locale:q,...m(me.filter((e,l)=>he.visible[l]).map(e=>[e]),de)}),Ie?null:e(r,{heading:null===fe?void 0:ce[fe]?.name,items:De})]})}
|
|
1
|
+
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as t from"react";import{ChartDataTable as n,ChartExport as a,ChartLegendBar as i,ChartStatus as r,ChartSummary as o,ChartSurface as s,ChartTooltipPanel as u,markTransitionClasses as d,summarise as m,useMeasuredWidth as c,useReleaseOutside as h,useVisibility as f,chartHeight as v,useMeasuredHeight as p}from"../../internal/chart-frame.js";import{arcPath as x,categoryAt as g,chartFontSizes as b,compactNumber as y,formatCategory as M,inkOn as N,markGap as j,seriesColor as w,toValue as k,warnPaletteOverflow as E}from"../../internal/chart.js";import{numberFormatter as I}from"../../internal/format.js";import{cx as z,metaTextClasses as P}from"../../internal/styles.js";import{chartMessages as A,emptyMessages as $,useMessages as L}from"../../internal/i18n.js";import{useStyleDefaults as S}from"../../internal/defaults.js";const B={pie:0,donut:.62,semi:.62};export function PieChart(C){const{data:R,categories:D,shape:O="pie",startAngle:_=0,hole:F,gap:H=j,center:K,valueLabels:T="none",height:V,format:W,locale:q,label:G,legend:J,tooltip:Q,empty:U,exportable:X=!1,exportFileName:Y="chart.csv",onExport:Z,size:ee="md",variant:le="text",padded:te=!1,className:ne,...ae}=S(C,["size","variant","locale"]),ie=t.useRef(null),re=c(ie),oe=L($,q),se=L(A,q),ue=t.useId(),de=t.useCallback(e=>W?I(q,W).format(e):y(e,q),[W,q]),me=t.useMemo(()=>R.map(k),[R]),ce=t.useMemo(()=>me.map((e,l)=>({name:M(g(l,D,[me]),q),data:[R[l]],color:e.color})),[me,D,R,q]),he=f(ce);t.useEffect(()=>{E(ce.length)},[ce.length]);const[fe,ve]=t.useState(null);h(ie,null!==fe,()=>ve(null));const pe=t.useId(),xe=ce.map((e,l)=>w(e,l)),ge=me.reduce((e,l,t)=>he.visible[t]&&null!==l.value?e+Math.max(0,l.value):e,0),be="semi"===O,ye=p(ie,"string"==typeof V),Me=v(V,ee,ye),Ne=b[ee],je=!1===J?{interactive:!1}:!0===J||void 0===J?{}:J,we=!1!==J&&ce.length>1,ke=je.side??"bottom",Ee=!1===Q?{mode:"none"}:!0===Q||void 0===Q?{}:Q,Ie="none"===Ee.mode,ze=re/2,Pe=Math.max(0,Math.min(re/2,be?Me:Me/2)-2),Ae=be?Math.min(Me,Me/2+Pe/2):Me/2,$e=Pe*Math.min(.92,Math.max(0,F??B[O])),Le=ge<=0||Pe<=0,Se=Pe>0?Math.min(15,Math.max(0,H)/Pe*(180/Math.PI)):0,Be=be?180:360,Ce=[];let Re=be?-90:_;me.forEach((e,l)=>{if(!he.visible[l]||null===e.value||e.value<=0)return;const t=e.value/ge,n=t*Be;Ce.push({index:l,start:Re,end:Re+n,value:e.value,share:t}),Re+=n});const De=null===fe?[]:[{seriesIndex:fe,name:ce[fe]?.name,color:me[fe]?.color??xe[fe],value:me[fe]?.value??null,formatted:`${de(me[fe]?.value??0)} · ${Math.round(10*(Math.max(0,me[fe]?.value??0)/ge*100+Number.EPSILON))/10}%`,label:me[fe]?.label}];return l(s,{...ae,size:ee,variant:le,padded:te,className:ne,legendSide:ke,legend:we?e(i,{series:ce,colors:xe,options:je,visibility:he,size:ee,values:je.showValue?me.map(e=>null===e.value?void 0:de(e.value)):void 0}):null,table:Le?null:e(n,{id:ue,caption:G,categories:ce.map(e=>e.name??""),series:[{name:G,data:R}],values:[me],format:de,locale:q}),children:[X&&!Le?e(a,{rows:()=>[["",G??se.label],...ce.map((e,l)=>[e.name??"",me[l]?.value??null])],fileName:Y,onExport:Z,label:se.exportCsv}):null,l("div",{ref:ie,role:"img",tabIndex:Le?void 0:0,"aria-label":G??se.label,"aria-describedby":Le?void 0:pe,onPointerLeave:e=>{"touch"!==e.pointerType&&ve(null)},onBlur:()=>ve(null),onKeyDown:e=>{const l=Ce.map(e=>e.index);if("Escape"===e.key){if(null===fe)return;ve(null)}else{if(Ie||0===l.length)return;if("Home"===e.key)ve(l[0]);else if("End"===e.key)ve(l[l.length-1]);else{if("ArrowRight"!==e.key&&"ArrowLeft"!==e.key)return;{const t=null===fe?-1:l.indexOf(fe),n="ArrowRight"===e.key?t+1:t-1;ve(l[(n+l.length)%l.length])}}}e.preventDefault()},className:z("relative w-full rounded-(--neba-radius-xs)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"),style:{height:"string"==typeof V?V:Me},children:[Le?e("div",{className:z("flex h-full items-center justify-center text-(--neba-muted-fg)",P[ee]),children:U??oe.title}):re>0?l("svg",{width:re,height:Me,viewBox:`0 0 ${re} ${Me}`,"aria-hidden":"true",className:"block",children:[Ce.map(l=>{const t=null!==he.hovered&&he.hovered!==l.index||null!==fe&&fe!==l.index,n=Ce.length>1&&l.end-l.start>2*Se?Se/2:0;return e("path",{d:x(ze,Ae,Pe,$e,l.start+n,l.end-n),fill:me[l.index].color??xe[l.index],opacity:t?.32:1,onPointerEnter:Ie?void 0:()=>ve(l.index),className:d},l.index)}),"all"===T?Ce.map(l=>{const t=((l.start+l.end)/2-90)*(Math.PI/180),n=$e>0?($e+Pe)/2:.68*Pe,a=`${Math.round(100*l.share)}%`;return(l.end-l.start)*(Math.PI/180)*n<2*Ne||Pe-$e<1.6*Ne?null:e("text",{x:ze+n*Math.cos(t),y:Ae+n*Math.sin(t),textAnchor:"middle",dominantBaseline:"central",fontSize:Ne,fontWeight:600,fill:N(me[l.index].color,l.index),className:"tabular-nums",children:a},l.index)}):null]}):null,K&&$e>0?e("div",{className:"pointer-events-none absolute flex flex-col items-center justify-center text-center",style:{left:ze-$e,top:Ae-$e,width:2*$e,height:be?$e:2*$e},children:K}):null,null===fe||Ie?null:Ee.render?e("div",{className:"pointer-events-none absolute top-0 left-1/2 z-10",children:Ee.render({index:fe,category:ce[fe]?.name??fe,items:De})}):e(u,{heading:ce[fe]?.name,items:De,x:ze,y:8,flip:!1,size:ee})]}),Le?null:e(o,{id:pe,template:se.summary,locale:q,...m(me.filter((e,l)=>he.visible[l]).map(e=>[e]),de)}),Ie?null:e(r,{heading:null===fe?void 0:ce[fe]?.name,items:De})]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{trackPointer as i}from"../../internal/glow.js";import{observeResize as l}from"../../internal/observe.js";import{controlSlots as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{trackPointer as i}from"../../internal/glow.js";import{observeResize as l}from"../../internal/observe.js";import{controlSlots as s,controlTextClasses as r,cx as a,gapClasses as c,hasContent as m,iconClasses as d,iconSizeClasses as f,insetRingClasses as x,metaTextClasses as p,paddingXClasses as u,pressTransitionClasses as h,sheetBodyClasses as v,surfaceClasses as b,transitionClasses as g}from"../../internal/styles.js";import{inertValue as w}from"../../internal/inert.js";import{useStyleDefaults as y}from"../../internal/defaults.js";const j={solid:[b,"text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[b,"border text-(--n-on-tint) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:`${b} text-(--n-on-tint) bg-(--n-soft)`},_={solid:"hover:bg-(--n-fill-hover) active:bg-(--n-fill-active)",outline:"hover:bg-(--n-panel-hover) active:bg-(--n-panel-press)",text:"hover:bg-(--n-soft) active:bg-(--n-soft-hover)"},k={xs:"min-h-5.5",sm:"min-h-6.5",md:"min-h-8",lg:"min-h-10",xl:"min-h-12"},z={xs:"rounded-[0.6875rem]",sm:"rounded-[0.8125rem]",md:"rounded-[1rem]",lg:"rounded-[1.25rem]",xl:"rounded-[1.5rem]"},N={default:{xs:"px-3",sm:"px-4",md:"px-5",lg:"px-6",xl:"px-8"},compact:{xs:"px-1.5",sm:"px-2",md:"px-2.5",lg:"px-3",xl:"px-4"}},$={static:{top:"",bottom:""},sticky:{top:"sticky top-3 z-20",bottom:"sticky bottom-3 z-20"},fixed:{top:"fixed inset-x-0 top-3 z-30 mx-auto w-fit",bottom:"fixed inset-x-0 bottom-3 z-30 mx-auto w-fit"}},I={static:{top:"",bottom:""},sticky:{top:"sticky top-[calc(0.75rem_+_env(safe-area-inset-top))] z-20",bottom:"sticky bottom-[calc(0.75rem_+_env(safe-area-inset-bottom))] z-20"},fixed:{top:"fixed inset-x-0 top-[calc(0.75rem_+_env(safe-area-inset-top))] z-30 mx-auto w-fit",bottom:"fixed inset-x-0 bottom-[calc(0.75rem_+_env(safe-area-inset-bottom))] z-30 mx-auto w-fit"}};export const Pill=/*@__PURE__*/o.forwardRef(function Pill(b,P){const{variant:C="solid",size:H="md",color:R="secondary",density:A="default",elevation:B=2,startIcon:E,endIcon:F,title:L,description:M,details:S,expanded:q=!1,position:D="static",side:G="top",safeArea:J=!0,className:K,style:O,children:Q,onClick:T,...U}=y(b,["size","density","variant"]),V=o.useRef(null),W=o.useId(),[X,Y]=o.useState(null),Z=m(S);o.useLayoutEffect(()=>{const e=V.current;if(e)return Y(e.scrollHeight),l(e,()=>Y(e.scrollHeight))},[Z]);const ee=Boolean(T),te=u[A][H],ne=t(n,{children:[m(E)?e("span",{className:`flex shrink-0 items-center justify-center overflow-hidden rounded-full [&_img]:size-full [&_img]:object-cover ${f[H]}`,children:E}):null,m(L)||m(M)||m(Q)?t("span",{className:["flex min-w-0 flex-1 flex-col items-center justify-center text-center",N[A][H]].join(" "),children:[m(L)?e("span",{className:"max-w-full truncate",children:L}):null,m(M)?e("span",{className:`max-w-full truncate font-normal ${p[H]}`,children:M}):null,Q]}):null]});return t("div",{ref:P,className:a("inline-flex max-w-full flex-col overflow-hidden align-middle",z[H],"font-medium whitespace-nowrap select-none",r[H],j[C],g,h,d,(J?I:$)[D][G],K??""),style:{...s(R,B,C),...O},...U,children:[t("div",{className:["flex shrink-0 items-center py-1",k[H],c[H],ee?"ps-0":te,m(F)?"pe-1":ee?"pe-0":""].join(" "),children:[ee?e("button",{type:"button",className:["relative flex min-w-0 flex-1 cursor-pointer items-center justify-center self-stretch",z[H],c[H],te,x,"neba-glow",_[C],g,h].join(" "),onPointerMove:i(void 0,!0),"aria-expanded":Z?q:void 0,"aria-controls":Z?W:void 0,onClick:T,children:ne}):ne,m(F)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:F}):null]}),Z?e("div",{id:W,className:["overflow-hidden","[transition:height_var(--neba-duration)_var(--neba-ease)]","motion-reduce:[transition-duration:0ms]"].join(" "),style:{height:q?X??"auto":0},inert:w(!q),children:e("div",{ref:V,className:`whitespace-normal ${te} pb-2 ${v[H]}`,children:S})}):null]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import{Popover as s}from"@base-ui/react/popover";import{boxPaddingXClasses as o,boxPaddingYClasses as t}from"../box/Box.js";import{actionMessages as a,useMessages as i}from"../../internal/i18n.js";import{CloseIcon as n}from"../../internal/icons.js";import{cx as r,hasContent as d,metaTextClasses as c,popupFadeClasses as m,radiusClasses as p,sheetBodyClasses as f,sheetCloseClasses as u,sheetHeaderGapClasses as h,sheetSectionGapClasses as x,sheetTitleClasses as b,srOnlyClasses as g,surfaceClasses as v,surfaceSlots as w}from"../../internal/styles.js";import{useStyleDefaults as N}from"../../internal/defaults.js";const j={xs:"max-w-56",sm:"max-w-64",md:"max-w-80",lg:"max-w-96",xl:"max-w-lg"},y=[v,"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]",m].join(" "),O={xs:8,sm:9,md:10,lg:11,xl:12};export const PopoverClose=s.Close;export function Popover(m){const{size:v="md",color:k="primary",density:z="default",trigger:C,title:P,description:$,children:_,side:B="bottom",align:L="center",sideOffset:M=6,alignOffset:T=0,arrow:W=!1,open:A,defaultOpen:D,onOpenChange:E,modal:R=!1,dismissible:q=!0,showClose:F=!1,locale:G,closeLabel:H,width:I,className:J,style:K,...Q}=N(m,["size","density","locale"]),S=i(a,G),U=o[z][v],V=t[z][v],X=O[v],Y=d(P)||d($);return l(s.Root,{open:A,defaultOpen:D,modal:R,onOpenChange:(e,l)=>{q||e||"escape-key"!==l.reason&&"outside-press"!==l.reason&&"focus-out"!==l.reason?E?.(e):l.cancel()},children:[C?e(s.Trigger,{render:C}):null,e(s.Portal,{children:e(s.Positioner,{className:"neba-portal z-(--neba-z-portal) [outline:none]",side:B,align:L,sideOffset:M,alignOffset:T,children:l(s.Popup,{className:r(y,p[v],f[v],x[v],U,V,void 0===I?j[v]:"",J??""),style:{...w(k,3),...void 0===I?null:{maxWidth:"number"==typeof I?`${I}px`:I},...K},...Q,children:[W?e(s.Arrow,{className:["data-[side=top]:bottom-[-1px]","data-[side=bottom]:top-[-1px] data-[side=bottom]:rotate-180","data-[side=left]:right-[-1px] data-[side=left]:-rotate-90","data-[side=right]:left-[-1px] data-[side=right]:rotate-90"].join(" "),children:l("svg",{width:X,height:X/2,viewBox:"0 0 10 5","aria-hidden":"true",className:"block",children:[e("path",{d:"M0 0h10L5 5z",fill:"var(--n-panel-press)"}),e("path",{d:"M0 0 5 5 10 0",fill:"none",stroke:"var(--n-line)",strokeWidth:"1",vectorEffect:"non-scaling-stroke"})]})}):null,Y||F?l("div",{className:"flex shrink-0 items-start gap-3",children:[l("div",{className:`flex min-w-0 flex-1 flex-col ${h[v]}`,children:[d(P)?e(s.Title,{className:`m-0 font-semibold ${b[v]}`,children:P}):null,d($)?e(s.Description,{className:`m-0 text-(--neba-muted-fg) ${c[v]}`,children:$}):null]}),F?e(s.Close,{"aria-label":H??S.close,className:u,children:e(n,{})}):null]}):null,d(_)?e("div",{className:"min-w-0",children:_}):null,!1===R||F?null:e(s.Close,{"aria-label":H??S.close,className:r(g,"end-2 top-2 flex cursor-pointer items-center justify-center rounded-full","bg-(--n-panel-press) text-(--neba-muted-fg) [&_svg]:size-[1.1em] [&_svg]:shrink-0","focus-visible:size-[1.6em] focus-visible:[clip-path:none]","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"),children:e(n,{})})]})})})]})}
|