neba 1.8.1 → 1.10.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 +7 -7
- package/dist/components/accordion/Accordion.js +1 -1
- package/dist/components/alert/Alert.js +1 -1
- package/dist/components/anchor/Anchor.d.ts +73 -0
- package/dist/components/anchor/Anchor.js +1 -0
- package/dist/components/anchor/index.d.ts +2 -0
- package/dist/components/anchor/index.js +1 -0
- package/dist/components/animate-marquee/AnimateMarquee.js +1 -1
- package/dist/components/app-logo/AppLogo.js +1 -1
- package/dist/components/aspect-ratio/AspectRatio.js +1 -1
- package/dist/components/avatar/Avatar.js +1 -1
- package/dist/components/avatar-group/AvatarGroup.d.ts +47 -0
- package/dist/components/avatar-group/AvatarGroup.js +1 -0
- package/dist/components/avatar-group/index.d.ts +2 -0
- package/dist/components/avatar-group/index.js +1 -0
- package/dist/components/badge/Badge.js +1 -1
- package/dist/components/blockquote/Blockquote.js +1 -1
- package/dist/components/box/Box.js +1 -1
- package/dist/components/button/Button.js +1 -1
- package/dist/components/button-group/ButtonGroup.js +1 -1
- package/dist/components/card/Card.js +1 -1
- package/dist/components/carousel/Carousel.js +1 -1
- package/dist/components/chat-bubble/ChatBubble.js +1 -1
- package/dist/components/checkbox/Checkbox.d.ts +13 -1
- package/dist/components/checkbox/Checkbox.js +1 -1
- package/dist/components/combobox/Combobox.d.ts +17 -2
- package/dist/components/combobox/Combobox.js +1 -1
- package/dist/components/command-palette/CommandPalette.d.ts +105 -0
- package/dist/components/command-palette/CommandPalette.js +1 -0
- package/dist/components/command-palette/index.d.ts +2 -0
- package/dist/components/command-palette/index.js +1 -0
- package/dist/components/container/Container.js +1 -1
- package/dist/components/data-list/DataList.d.ts +55 -0
- package/dist/components/data-list/DataList.js +1 -0
- package/dist/components/data-list/index.d.ts +2 -0
- package/dist/components/data-list/index.js +1 -0
- package/dist/components/data-table/DataTable.js +1 -1
- package/dist/components/dialog/Dialog.d.ts +19 -2
- package/dist/components/dialog/Dialog.js +1 -1
- package/dist/components/divider/Divider.js +1 -1
- package/dist/components/drawer/Drawer.js +1 -1
- package/dist/components/empty/Empty.js +1 -1
- package/dist/components/fieldset/Fieldset.d.ts +33 -0
- package/dist/components/fieldset/Fieldset.js +1 -0
- package/dist/components/fieldset/index.d.ts +2 -0
- package/dist/components/fieldset/index.js +1 -0
- package/dist/components/file-picker/FilePicker.js +1 -1
- package/dist/components/floating-bottom-navigation/FloatingBottomNavigation.js +1 -1
- package/dist/components/form/Form.d.ts +58 -0
- package/dist/components/form/Form.js +1 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +1 -0
- package/dist/components/gauge-chart/GaugeChart.d.ts +62 -0
- package/dist/components/gauge-chart/GaugeChart.js +1 -0
- package/dist/components/gauge-chart/index.d.ts +2 -0
- package/dist/components/gauge-chart/index.js +1 -0
- package/dist/components/grid/Grid.js +1 -1
- package/dist/components/grid-container/GridContainer.js +1 -1
- package/dist/components/heatmap-chart/HeatmapChart.js +1 -1
- package/dist/components/highlight/Highlight.js +1 -1
- package/dist/components/hover-card/HoverCard.d.ts +78 -0
- package/dist/components/hover-card/HoverCard.js +1 -0
- package/dist/components/hover-card/index.d.ts +2 -0
- package/dist/components/hover-card/index.js +1 -0
- package/dist/components/how-to-steps/HowToSteps.d.ts +11 -25
- package/dist/components/how-to-steps/HowToSteps.js +1 -1
- package/dist/components/icon/Icon.js +1 -1
- package/dist/components/list/List.js +1 -1
- package/dist/components/menu/Menu.d.ts +16 -4
- package/dist/components/menu/Menu.js +1 -1
- package/dist/components/menubar/Menubar.d.ts +56 -0
- package/dist/components/menubar/Menubar.js +1 -0
- package/dist/components/menubar/index.d.ts +2 -0
- package/dist/components/menubar/index.js +1 -0
- package/dist/components/meter/Meter.d.ts +52 -0
- package/dist/components/meter/Meter.js +1 -0
- package/dist/components/meter/index.d.ts +2 -0
- package/dist/components/meter/index.js +1 -0
- package/dist/components/mockup/Mockup.js +1 -1
- package/dist/components/navigation-menu/NavigationMenu.d.ts +100 -0
- package/dist/components/navigation-menu/NavigationMenu.js +1 -0
- package/dist/components/navigation-menu/index.d.ts +2 -0
- package/dist/components/navigation-menu/index.js +1 -0
- package/dist/components/number-field/NumberField.d.ts +17 -2
- package/dist/components/number-field/NumberField.js +1 -1
- package/dist/components/otp-field/OtpField.js +1 -1
- package/dist/components/overlay/Overlay.js +1 -1
- package/dist/components/page-layout/PageLayout.js +1 -1
- package/dist/components/pagination/Pagination.js +1 -1
- package/dist/components/panes/Panes.js +1 -1
- package/dist/components/pie-chart/PieChart.js +1 -1
- package/dist/components/pill/Pill.js +1 -1
- package/dist/components/popover/Popover.js +1 -1
- package/dist/components/progress-box/ProgressBox.js +1 -1
- package/dist/components/progress-circular/ProgressCircular.js +1 -1
- package/dist/components/progress-linear/ProgressLinear.js +1 -1
- package/dist/components/radio-group/RadioGroup.d.ts +22 -1
- package/dist/components/radio-group/RadioGroup.js +1 -1
- package/dist/components/rating/Rating.js +1 -1
- package/dist/components/scroll-area/ScrollArea.d.ts +50 -0
- package/dist/components/scroll-area/ScrollArea.js +1 -0
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.js +1 -0
- package/dist/components/scroll-zone/ScrollZone.d.ts +35 -17
- 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 +16 -1
- package/dist/components/select/Select.js +1 -1
- package/dist/components/shortcut/Shortcut.js +1 -1
- package/dist/components/sidebar/Sidebar.js +1 -1
- package/dist/components/skeleton/Skeleton.js +1 -1
- package/dist/components/slider/Slider.js +1 -1
- package/dist/components/spoiler/Spoiler.js +1 -1
- package/dist/components/statistic/Statistic.js +1 -1
- package/dist/components/switch/Switch.d.ts +13 -1
- package/dist/components/switch/Switch.js +1 -1
- package/dist/components/table/Table.d.ts +21 -2
- package/dist/components/table/Table.js +1 -1
- package/dist/components/tabs/Tabs.js +1 -1
- package/dist/components/text-field/TextField.d.ts +16 -1
- package/dist/components/text-field/TextField.js +1 -1
- package/dist/components/text-link/TextLink.js +1 -1
- package/dist/components/toast/Toast.d.ts +17 -2
- package/dist/components/toast/Toast.js +1 -1
- package/dist/components/toggle/Toggle.d.ts +53 -0
- package/dist/components/toggle/Toggle.js +1 -0
- package/dist/components/toggle/index.d.ts +2 -0
- package/dist/components/toggle/index.js +1 -0
- package/dist/components/toggle-group/ToggleGroup.d.ts +51 -0
- package/dist/components/toggle-group/ToggleGroup.js +1 -0
- package/dist/components/toggle-group/index.d.ts +2 -0
- package/dist/components/toggle-group/index.js +1 -0
- package/dist/components/toolbar/Toolbar.js +1 -1
- package/dist/components/tooltip/Tooltip.js +1 -1
- package/dist/components/tour/Tour.d.ts +97 -0
- package/dist/components/tour/Tour.js +1 -0
- package/dist/components/tour/index.d.ts +2 -0
- package/dist/components/tour/index.js +1 -0
- package/dist/components/transfer/Transfer.d.ts +52 -0
- package/dist/components/transfer/Transfer.js +1 -0
- package/dist/components/transfer/index.d.ts +2 -0
- package/dist/components/transfer/index.js +1 -0
- package/dist/components/tree-view/TreeView.js +1 -1
- package/dist/components/typography/Typography.js +1 -1
- package/dist/components/window-pane/WindowPane.js +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/index.js +1 -1
- package/dist/internal/animate.d.ts +7 -1
- package/dist/internal/animate.js +1 -1
- package/dist/internal/avatar-group.d.ts +22 -0
- package/dist/internal/avatar-group.js +1 -0
- package/dist/internal/button-group.d.ts +6 -2
- package/dist/internal/chart-frame.d.ts +18 -1
- package/dist/internal/chart-frame.js +1 -1
- package/dist/internal/data-table.d.ts +0 -14
- package/dist/internal/data-table.js +1 -1
- package/dist/internal/drag.d.ts +62 -0
- package/dist/internal/drag.js +1 -0
- package/dist/internal/highlight.js +1 -1
- package/dist/internal/i18n.d.ts +82 -0
- package/dist/internal/i18n.js +1 -1
- package/dist/internal/link.d.ts +19 -0
- package/dist/internal/link.js +1 -0
- package/dist/internal/media.d.ts +29 -0
- package/dist/internal/media.js +1 -0
- package/dist/internal/observe.d.ts +42 -0
- package/dist/internal/observe.js +1 -0
- package/dist/internal/page-layout.js +1 -1
- package/dist/internal/picker.js +1 -1
- package/dist/internal/progress.d.ts +5 -0
- package/dist/internal/search.d.ts +33 -0
- package/dist/internal/search.js +1 -0
- package/dist/internal/styles.d.ts +39 -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 +104 -0
- package/dist/types.d.ts +55 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as t from"react";import{CloseIcon as r}from"../../internal/icons.js";import{controlTextLeadingClasses as a,cx as l,disabledClasses as o,gapClasses as s,hasContent as i,iconClasses as c,metaTextClasses as d,radiusClasses as u,readOnlyFilterClasses as f,sheetTitleClasses as p,stackGapClasses as m,surfaceClasses as h,surfaceSlots as v,transitionClasses as b}from"../../internal/styles.js";const x={default:{xs:"p-4",sm:"p-5",md:"p-6",lg:"p-8",xl:"p-10"},compact:{xs:"p-2",sm:"p-3",md:"p-4",lg:"p-5",xl:"p-6"}},g={solid:[h,"border-2 border-dashed text-(--neba-fg) bg-(--n-panel-hover)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),outline:[h,"border-2 border-dashed text-(--neba-fg) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"border-2 border-dashed text-(--neba-fg) bg-transparent [border-color:var(--n-line)]"},y={solid:"hover:bg-(--n-panel-press) hover:[border-color:var(--n-line-hover)]",outline:"hover:bg-(--n-panel-hover) hover:[border-color:var(--n-line-hover)]",text:"hover:bg-(--n-soft) hover:[border-color:var(--n-line-hover)]"};function k(){return n("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e("path",{d:"M8 10.5V2.75m0 0L5.25 5.5M8 2.75 10.75 5.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M2.75 9.75v1.75a1.75 1.75 0 0 0 1.75 1.75h7a1.75 1.75 0 0 0 1.75-1.75V9.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}export function formatFileSize(e){if(e<1e3)return`${e} B`;const n=["kB","MB","GB","TB"];let t=e/1e3,r=0;for(;t>=1e3&&r<n.length-1;)t/=1e3,r+=1;return`${t<10?t.toFixed(1):Math.round(t)} ${n[r]}`}function N(e,n){const t=e.name.toLowerCase(),r=e.type.toLowerCase();return n.split(",").map(e=>e.trim().toLowerCase()).filter(Boolean).some(e=>e.startsWith(".")?t.endsWith(e):e.endsWith("/*")?r.startsWith(`${e.slice(0,-1)}`):r===e)}export const FilePicker=/*@__PURE__*/t.forwardRef(function({variant:h="outline",size:$="md",color:w="primary",density:j="default",elevation:L=0,accept:z,multiple:C=!1,maxSize:_,maxFiles:E,value:D,defaultValue:F,onFilesChange:I,onReject:M,label:B,description:W,error:S,invalid:R,title:T,hint:V,icon:O,showList:q=!0,removeLabel:A=e=>`Remove ${e}`,fullWidth:G=!0,disabled:P=!1,readOnly:H=!1,required:Y=!1,name:J,id:K,className:Q,style:U,...X},Z){const ee=t.useRef(null);t.useImperativeHandle(Z,()=>ee.current);const[ne,te]=t.useState(()=>[...F??[]]),re=t.useMemo(()=>D?[...D]:ne,[D,ne]),ae=t.useRef(0),[le,oe]=t.useState(!1);t.useEffect(()=>{const e=()=>{ae.current=0,oe(!1)};return document.addEventListener("dragend",e,!0),document.addEventListener("drop",e,!0),()=>{document.removeEventListener("dragend",e,!0),document.removeEventListener("drop",e,!0)}},[]);const se=i(S),ie=R??se,ce=ie?"danger":w,de=P||H,ue=t.useId(),fe=t.useCallback(e=>{D||te(e),I?.(e)},[I,D]),pe=t.useCallback(e=>{const n=[],t=[],r=C?E??Number.POSITIVE_INFINITY:1,a=C?re.length:0;for(const l of e)z&&!N(l,z)?t.push({file:l,reason:"type"}):void 0!==_&&l.size>_?t.push({file:l,reason:"size"}):a+n.length>=r?t.push({file:l,reason:"count"}):n.push(l);return{kept:n,rejections:t}},[z,re.length,E,_,C]),me=t.useCallback(e=>{const{kept:n,rejections:t}=pe(e);t.length>0&&M?.(t),n.length>0&&fe(C?[...re,...n]:n)},[pe,fe,re,C,M]),he=l("flex w-full flex-col items-center justify-center text-center","cursor-pointer select-none",x[j][$],u[$],s[$],b,c,"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2",P?`${o[h]} border-2 border-dashed`:H?`${g[h]} ${f} cursor-default`:g[h],de?"":y[h],le&&!de?"bg-(--n-soft-press) [border-color:var(--n-ring)]":"");return n("div",{className:l("flex-col align-top",m[$],G?"flex w-full":"inline-flex",Q??""),style:{...v(ce,L),...U},...X,children:[i(B)?e("span",{className:[d[$],"font-medium",P?"text-(--neba-disabled-fg)":"text-(--neba-fg)"].join(" "),children:B}):null,n("div",{className:"flex w-full flex-col",onDragEnter:e=>{de||(e.preventDefault(),ae.current+=1,oe(!0))},onDragOver:e=>{de||(e.preventDefault(),e.dataTransfer.dropEffect="copy")},onDragLeave:()=>{de||(ae.current=Math.max(0,ae.current-1),0===ae.current&&oe(!1))},onDrop:e=>{de||(e.preventDefault(),ae.current=0,oe(!1),me(function(e){const n=[...e.items],t=[...e.files];return n.length!==t.length?t:t.filter((e,t)=>{const r=n[t]?.webkitGetAsEntry?.();return!r||r.isFile})}(e.dataTransfer)))},children:[n("button",{type:"button",id:K,disabled:P,"aria-describedby":i(W)||se?ue:void 0,"aria-invalid":ie||void 0,className:he,onClick:()=>{de||ee.current&&(ee.current.value="",ee.current.click())},children:[void 0===O?e("span",{className:"flex items-center text-(--n-accent) [&_svg]:size-[1.8em]",children:e(k,{})}):i(O)?e("span",{className:"flex items-center text-(--n-accent) [&_svg]:size-[1.8em]",children:O}):null,e("span",{className:`font-medium ${p[$]}`,children:T??"Drop files here, or click to browse"}),i(V)?e("span",{className:`text-(--neba-muted-fg) ${d[$]}`,children:V}):null]}),e("input",{ref:ee,type:"file",name:J,accept:z,multiple:C,required:Y&&0===re.length,disabled:de,tabIndex:-1,"aria-hidden":"true",className:"absolute size-px overflow-hidden opacity-0 [clip-path:inset(50%)]",onChange:e=>me(Array.from(e.target.files??[]))})]}),q&&re.length>0?e("ul",{role:"list",className:`flex w-full flex-col ${m[$]} m-0 list-none p-0`,children:re.map((t,l)=>n("li",{className:["flex w-full items-center gap-2 px-2 py-1.5",u.xs,a[$],"bg-(--n-soft) text-(--neba-fg)"].join(" "),children:[e("span",{className:"min-w-0 flex-1 truncate",children:t.name}),e("span",{className:`shrink-0 text-(--neba-muted-fg) tabular-nums ${d[$]}`,children:formatFileSize(t.size)}),de?null:e("button",{type:"button","aria-label":A(t.name),className:["inline-flex shrink-0 cursor-pointer items-center justify-center rounded-full","size-[1.3em] text-(--neba-muted-fg) opacity-70","[transition:opacity_var(--neba-duration)_var(--neba-ease),color_var(--neba-duration)_var(--neba-ease)]","[&_svg]:size-[0.9em]","hover:text-(--neba-fg) hover:opacity-100 focus-visible:opacity-100","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1"].join(" "),onClick:()=>fe(re.filter((e,n)=>n!==l)),children:e(r,{})})]},`${t.name}-${t.size}-${t.lastModified}-${l}`))}):null,i(W)&&!se?e("span",{id:ue,className:`${d[$]} text-(--neba-muted-fg)`,children:W}):null,se?e("span",{id:ue,className:`${d[$]} text-(--n-accent)`,children:S}):null]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{useRender as n}from"@base-ui/react/use-render";import{barMinHeightClasses as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{useRender as n}from"@base-ui/react/use-render";import{barMinHeightClasses as o,BottomNavigationContext as r}from"../../internal/bottom-navigation.js";import{observeResize as s}from"../../internal/observe.js";import{cx as l,surfaceClasses as i,surfaceSlots as f,transitionClasses as u}from"../../internal/styles.js";const d={solid:[i,"text-(--neba-fg) bg-(--n-panel-press)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[i,"border text-(--neba-fg) bg-(--n-panel-hover)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--neba-fg) bg-transparent"},p={static:"relative mx-auto w-fit",absolute:"absolute inset-x-0 bottom-(--n-nav-offset) z-30 mx-auto w-fit",sticky:"sticky bottom-(--n-nav-offset) z-30 mx-auto w-fit",fixed:"fixed inset-x-0 bottom-(--n-nav-offset) z-40 mx-auto w-fit"},b={default:{xs:"p-1",sm:"p-1",md:"p-1.5",lg:"p-1.5",xl:"p-2"},compact:{xs:"p-0.5",sm:"p-0.5",md:"p-1",lg:"p-1",xl:"p-1"}},c={solid:`${i} bg-(--n-panel-hover) [box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]`,outline:`${i} bg-(--n-soft-hover) [box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]`,text:"bg-(--n-soft-hover)"},m={xs:"gap-0.5",sm:"gap-0.5",md:"gap-1",lg:"gap-1",xl:"gap-1.5"};export const FloatingBottomNavigation=/*@__PURE__*/a.forwardRef(function({variant:i="outline",size:v="md",color:x="primary",density:g="default",elevation:y=2,value:h,defaultValue:w=null,onValueChange:j,position:$="fixed",offset:k=16,labels:z="selected",safeArea:P=!0,disabled:A=!1,label:C,render:N,className:R,style:E,children:L,...S},V){const[W,q]=a.useState(w),B=void 0!==h,F=B?h:W,H=a.useCallback(e=>{B||q(e),j?.(e)},[B,j]),M=a.useMemo(()=>({value:F??null,change:H,size:v,density:g,labels:z,disabled:A,floating:!0}),[F,H,v,g,z,A]),T=a.useRef(null),D=a.useRef(null),G=a.useCallback(e=>{T.current=e,"function"==typeof V?V(e):V&&(V.current=e)},[V]),I=a.useCallback(e=>{const t=T.current,a=D.current;if(!t||!a)return;const n=t.querySelector("[data-nav-item][aria-current]");if(!n)return;const o=!e||!a.hasAttribute("data-ready");o&&a.removeAttribute("data-ready"),a.style.setProperty("--n-nav-x",`${n.offsetLeft}px`),a.style.setProperty("--n-nav-y",`${n.offsetTop}px`),a.style.setProperty("--n-nav-w",`${n.offsetWidth}px`),a.style.setProperty("--n-nav-h",`${n.offsetHeight}px`),o&&a.offsetWidth,a.setAttribute("data-ready","")},[]);a.useLayoutEffect(()=>{I(!0)},[I,F,i,v,g,z,L]),a.useEffect(()=>{const e=T.current;if(e)return s(e,()=>I(!1))},[I]);const J="number"==typeof k?`${k}px`:k,K=l("flex max-w-full min-w-0 items-center rounded-full",o[v],b[g][v],m[v],d[i],p[$],u,R);return n({render:N??e("nav",{}),ref:G,props:{"aria-label":C,className:K,style:{...f(x,y),"--n-nav-offset":P?`calc(${J} + env(safe-area-inset-bottom))`:J,...E},children:t(r.Provider,{value:M,children:[null!=F?e("span",{ref:D,"aria-hidden":"true",className:l("pointer-events-none absolute rounded-full","top-(--n-nav-y) left-(--n-nav-x) h-(--n-nav-h) w-(--n-nav-w)",c[i],"[transition-property:left,top,width,height]","[transition-timing-function:var(--neba-ease)]","[transition-duration:0ms] data-[ready]:[transition-duration:var(--neba-duration)]","motion-reduce:[transition-duration:0ms]")}):null,L]}),...S}})});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { NebaSize } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* When a field decides whether it is valid.
|
|
5
|
+
*
|
|
6
|
+
* Base UI's own three, kept under its own spelling because they are what a
|
|
7
|
+
* caller will read about everywhere else and a nicer synonym would only be a
|
|
8
|
+
* word to translate back.
|
|
9
|
+
*/
|
|
10
|
+
export type FormValidationMode = 'onSubmit' | 'onBlur' | 'onChange';
|
|
11
|
+
/** Errors that came from somewhere else, keyed by the field's `name`. */
|
|
12
|
+
export type FormErrors = Record<string, string | string[]>;
|
|
13
|
+
export interface FormProps extends Omit<React.ComponentPropsWithoutRef<'form'>, 'onSubmit'> {
|
|
14
|
+
/**
|
|
15
|
+
* When a field validates.
|
|
16
|
+
*
|
|
17
|
+
* - `onSubmit` — on submit, and on every change afterwards. The default, and
|
|
18
|
+
* the only one that does not tell somebody their email is wrong while they
|
|
19
|
+
* are still typing it.
|
|
20
|
+
* - `onBlur` — when a field loses focus.
|
|
21
|
+
* - `onChange` — on every keystroke.
|
|
22
|
+
* @default 'onSubmit'
|
|
23
|
+
*/
|
|
24
|
+
validationMode?: FormValidationMode;
|
|
25
|
+
/**
|
|
26
|
+
* Errors from outside the browser's own validation — a server, a form action,
|
|
27
|
+
* a schema — keyed by the `name` of the field each belongs to. They are shown
|
|
28
|
+
* on the field, and cleared as soon as that field changes.
|
|
29
|
+
*/
|
|
30
|
+
errors?: FormErrors;
|
|
31
|
+
/**
|
|
32
|
+
* Called on a valid submit, with the form's values. The native submit event is
|
|
33
|
+
* prevented, so nothing navigates.
|
|
34
|
+
*/
|
|
35
|
+
onSubmit?: (values: Record<string, unknown>) => void;
|
|
36
|
+
/**
|
|
37
|
+
* The gap between the form's children. A form is a stack, and this is which
|
|
38
|
+
* rung of the ladder it stacks on.
|
|
39
|
+
* @default 'md'
|
|
40
|
+
*/
|
|
41
|
+
size?: NebaSize;
|
|
42
|
+
children?: React.ReactNode;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A `<form>` that knows which of its fields is wrong.
|
|
46
|
+
*
|
|
47
|
+
* On its own, a page of [TextField](./text-field)s validates one field at a
|
|
48
|
+
* time and a failed submit leaves the reader to find the red one. What this
|
|
49
|
+
* adds is the part that has to be owned above the fields: a submit collects
|
|
50
|
+
* every field's validity at once, focuses the first one that failed, and
|
|
51
|
+
* `errors` puts a server's answer back on the field it belongs to rather than
|
|
52
|
+
* in a banner at the top.
|
|
53
|
+
*
|
|
54
|
+
* It is not a form *library*. There is no schema, no resolver and no field
|
|
55
|
+
* array here — a project that wants those keeps them and hands the result to
|
|
56
|
+
* `errors`, which is the seam this is built around.
|
|
57
|
+
*/
|
|
58
|
+
export declare const Form: React.ForwardRefExoticComponent<FormProps & React.RefAttributes<HTMLFormElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as r}from"react/jsx-runtime";import*as o from"react";import{Form as e}from"@base-ui/react/form";import{cx as t,sheetSectionGapClasses as i}from"../../internal/styles.js";export const Form=/*@__PURE__*/o.forwardRef(function({validationMode:o="onSubmit",errors:m,onSubmit:s,size:a="md",className:n,children:l,...c},f){return r(e,{ref:f,validationMode:o,errors:m,onFormSubmit:r=>s?.(r),className:t("flex flex-col",i[a],n??""),...c,children:l})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{Form}from"./Form.js";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ChartBaseProps } from '../../internal/chart-frame.js';
|
|
3
|
+
import type { NebaThreshold } from '../../types.js';
|
|
4
|
+
export interface GaugeChartProps extends Omit<ChartBaseProps, 'legend' | 'tooltip'> {
|
|
5
|
+
/**
|
|
6
|
+
* The reading. `null` draws the dial with nothing on it, which is the honest
|
|
7
|
+
* picture of an instrument that has not been told anything.
|
|
8
|
+
*/
|
|
9
|
+
value: number | null;
|
|
10
|
+
/** @default 0 */
|
|
11
|
+
min?: number;
|
|
12
|
+
/** @default 100 */
|
|
13
|
+
max?: number;
|
|
14
|
+
/**
|
|
15
|
+
* How far round the dial goes, in degrees, opened symmetrically about twelve
|
|
16
|
+
* o'clock. `180` is the half-dial a dashboard tile wants; `270` is the
|
|
17
|
+
* instrument shape; `360` is a ring.
|
|
18
|
+
* @default 180
|
|
19
|
+
*/
|
|
20
|
+
sweep?: number;
|
|
21
|
+
/** How thick the arc is, as a fraction of its radius. @default 0.22 */
|
|
22
|
+
thickness?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Where the arc changes colour — the same `{ from, color }` entries a
|
|
25
|
+
* [Meter](../feedback/meter) takes, and with the same rule: the last one the
|
|
26
|
+
* value has reached wins, and below all of them `color` stands.
|
|
27
|
+
*/
|
|
28
|
+
thresholds?: readonly NebaThreshold[];
|
|
29
|
+
/**
|
|
30
|
+
* How many marks are drawn around the dial, ends included. `false` — the
|
|
31
|
+
* default — draws none: a gauge on a dashboard is read as a proportion, and
|
|
32
|
+
* ticks are for an instrument somebody takes a *number* off.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
ticks?: number | false;
|
|
36
|
+
/** Writes `min` and `max` at the two ends of the arc. @default true */
|
|
37
|
+
showRange?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* What goes in the middle. Left out, it is the value written through `format`
|
|
40
|
+
* — which is what the dial is for, so replacing it is for adding to it rather
|
|
41
|
+
* than for taking it away.
|
|
42
|
+
*/
|
|
43
|
+
center?: React.ReactNode;
|
|
44
|
+
/** A line under the value: the unit, or what is being measured. */
|
|
45
|
+
caption?: React.ReactNode;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* One number on a scale that is known in advance, drawn as a dial.
|
|
49
|
+
*
|
|
50
|
+
* It is a [Meter](../feedback/meter) bent into an arc, and the two are
|
|
51
|
+
* deliberately the same component in two shapes: `value`, `min`, `max` and
|
|
52
|
+
* `thresholds` mean exactly what they mean there, so a page can move a reading
|
|
53
|
+
* from a bar to a dial without changing what it says. Reach for the bar in a
|
|
54
|
+
* row of fields and for this one in a tile of its own, where a dial reads at a
|
|
55
|
+
* glance from across a room and a four-pixel bar does not.
|
|
56
|
+
*
|
|
57
|
+
* It is not a [PieChart](./pie-chart) with `shape="semi"`. A pie is *parts of a
|
|
58
|
+
* whole* and every slice is a category; this is one value against a scale, and
|
|
59
|
+
* the unfilled part of the arc is not a second category — it is the rest of the
|
|
60
|
+
* dial.
|
|
61
|
+
*/
|
|
62
|
+
export declare function GaugeChart({ value, min, max, sweep, thickness, thresholds, ticks, showRange, center, caption, height, format, locale, label, empty, size, variant, color, padded, className, ...box }: GaugeChartProps): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as t,jsxs as e,Fragment as a}from"react/jsx-runtime";import*as n from"react";import{ChartSurface as l,useMeasuredWidth as r}from"../../internal/chart-frame.js";import{arcPath as i,chartFontSizes as s,compactNumber as o,plotHeights as m}from"../../internal/chart.js";import{numberFormatter as h}from"../../internal/format.js";import{emptyMessages as c,useMessages as d}from"../../internal/i18n.js";import{cx as u,metaTextClasses as f}from"../../internal/styles.js";function x(t,e,a,n){const l=(n-90)*Math.PI/180;return[t+a*Math.cos(l),e+a*Math.sin(l)]}export function GaugeChart({value:p,min:b=0,max:v=100,sweep:g=180,thickness:M=.22,thresholds:y,ticks:N=!1,showRange:j=!0,center:k,caption:$,height:w,format:z,locale:I,label:P,empty:S,size:A="md",variant:C="text",color:R="primary",padded:B=!1,className:F,...G}){const L=n.useRef(null),W=r(L),Y=d(c,I),q=n.useCallback(t=>z?h(I,z).format(t):o(t,I),[z,I]),D=Math.max(1,Math.min(360,g)),E=D/2,H=-E,J=E,K=v-b,O=null===p||Number.isNaN(p)||0===K?null:Math.min(1,Math.max(0,(p-b)/K)),Q=null===p?R:function(t,e,a){if(!a||0===a.length)return e;let n=e;for(const e of a)t>=e.from&&(n=e.color);return n}(p,R,y),T="number"==typeof w?w:m[A],U=s[A],V=D>=360?1:Math.max(0,-Math.cos(E*Math.PI/180)),X=D>=180?1:Math.sin(E*Math.PI/180),Z=U*(j?1.6:.6),_=Math.max(0,Math.min((W-2*Z)/(2*X),(T-Z*(V>0?2:1))/(1+V))),tt=_*(1-Math.min(.9,Math.max(.05,M))),et=W/2,at=Z+_,nt=_<=0||0===K,lt=null===O?H:H+D*O,rt=at-_+_*(1+V)/2,it=!1===N?0:Math.max(2,Math.floor(N));return t(l,{...G,variant:C,color:R,size:A,padded:B,legendSide:"bottom",className:F,legend:null,table:null,children:t("div",{ref:L,className:"relative w-full",style:{height:T},role:void 0===P?void 0:"img","aria-label":void 0===P?void 0:null===p?P:`${P}: ${q(p)} / ${q(v)}`,children:nt?t("div",{className:u("flex h-full items-center justify-center text-(--neba-muted-fg)",f[A]),children:S??Y.title}):W>0?e(a,{children:[e("svg",{width:W,height:T,viewBox:`0 0 ${W} ${T}`,"aria-hidden":"true",className:"block",children:[t("path",{d:i(et,at,_,tt,H,J),fill:`var(--neba-${R}-soft)`}),null!==O&&O>0?t("path",{d:i(et,at,_,tt,H,lt),fill:`var(--neba-${Q}-fill)`,style:{transition:"fill var(--neba-duration) var(--neba-ease)"}}):null,it>0?Array.from({length:it},(e,a)=>{const n=H+D*a/(it-1),[l,r]=x(et,at,_+.25*U,n),[i,s]=x(et,at,_+.6*U,n);return t("line",{x1:l,y1:r,x2:i,y2:s,stroke:"var(--neba-chart-grid)",strokeWidth:1,strokeLinecap:"round"},a)}):null,j?[[b,H,"start"],[v,J,"end"]].map(([e,a,n])=>{const[l,r]=x(et,at,(_+tt)/2,a);return t("text",{x:l+(D>=300?0:"start"===n?.6*-U:.6*U),y:r+U*(D>=300?1.4:.35),textAnchor:D>=300?"middle":"start"===n?"end":"start",fontSize:U,fill:"var(--neba-muted-fg)",children:q(e)},n)}):null]}),e("div",{className:"pointer-events-none absolute inset-x-0 flex flex-col items-center gap-0.5",style:{top:rt,transform:"translateY(-50%)"},children:[t("span",{className:"font-semibold tabular-nums text-(--neba-fg)",style:{fontSize:2*U},children:k??(null===p?"—":q(p))}),$?t("span",{className:u("text-(--neba-muted-fg)",f[A]),children:$}):null]})]}):null})})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{GaugeChart}from"./GaugeChart.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{alignSelfClasses as
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{alignSelfClasses as s,offsetValue as t,responsiveSlots as n,spanValue as i}from"../../internal/grid.js";import{cx as o}from"../../internal/styles.js";export const Grid=/*@__PURE__*/e.forwardRef(function({span:e,offset:a,alignSelf:f,render:l,className:m,style:c,children:d,...p},u){const g=o("neba-grid-item",f?s[f]:"",m??"");return r({render:l,ref:u,props:{className:g,style:{...n("span",e,i),...n("offset",a,t),...c},children:d,...p}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{alignContentClasses as n,alignItemsClasses as a,columnCount as
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{alignContentClasses as n,alignItemsClasses as a,columnCount as t,justifyContentClasses as o,responsiveSlots as s,spacingValue as i,withBaseline as p}from"../../internal/grid.js";import{boxPaddingClasses as l}from"../box/Box.js";import{cx as c}from"../../internal/styles.js";export const GridContainer=/*@__PURE__*/e.forwardRef(function({columns:e,spacing:m,rowSpacing:d,columnSpacing:f,justifyContent:g,alignItems:u,alignContent:x,wrap:y=!0,padded:w=!0,size:j="md",density:b="default",render:C,className:h,style:N,children:S,...z},B){const G=c("neba-grid flex",y?"flex-wrap":"flex-nowrap","gap-x-(--n-gap-x) gap-y-(--n-gap-y)",w?l[b][j]:"",g?o[g]:"",u?a[u]:"",x?n[x]:"",h??"");return r({render:C,ref:B,props:{className:G,style:{...s("cols",p(e,12),t),...s("gap-x",p(f??m,2),i),...s("gap-y",p(d??m,2),i),...N},children:S,...z}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as l from"react";import{ChartScaleLegend as n,
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as l from"react";import{ChartScaleLegend as n,ChartStatus as i,ChartSurface as a,ChartTooltipPanel as r,useMeasuredWidth as o}from"../../internal/chart-frame.js";import{categoryAt as d,chartFontSizes as h,compactNumber as s,formatCategory as c,markGap as m,plotHeights as u,rampFill as x,rampInk as f,rampStep as g,rampSteps as p,squarify as v,textWidth as w,toValues as b,truncate as y}from"../../internal/chart.js";import{numberFormatter as M}from"../../internal/format.js";import{cx as $,metaTextClasses as j,srOnlyClasses as k}from"../../internal/styles.js";import{chartMessages as A,emptyMessages as N,useMessages as z}from"../../internal/i18n.js";export function HeatmapChart({series:S,categories:B,shape:C="grid",scale:I="sequential",midpoint:_=0,min:D,max:L,valueLabels:P="none",height:R,format:q,locale:H,label:K,legend:U,tooltip:W,empty:F,size:G="md",variant:J="text",padded:O=!1,className:Q,...T}){const V=l.useRef(null),X=o(V),Y=z(N,H),Z=z(A,H),ee=l.useId(),[te,le]=l.useState(null),ne=l.useCallback(e=>q?M(H,q).format(e):s(e,H),[q,H]),ie=l.useMemo(()=>b(S),[S]),ae=ie.reduce((e,t)=>Math.max(e,t.length),0),re=l.useMemo(()=>Array.from({length:ae},(e,t)=>d(t,B,ie)),[ae,B,ie]),oe=l.useMemo(()=>S.map((e,t)=>e.name??`${t+1}`),[S]),de=l.useMemo(()=>{let e=1/0,t=-1/0,l=!1;for(const n of ie)for(const i of n)null!==i.value&&(l=!0,e=Math.min(e,i.value),t=Math.max(t,i.value));return l?{min:e,max:t}:null},[ie]),he=D??de?.min??0,se=L??de?.max??1,ce=l.useCallback(e=>g(e,he,se,I,_),[he,se,I,_]),me="number"==typeof R?R:u[G]??220,ue=h[G],xe=!0===U||void 0===U||!1===U?{}:U,fe=!1!==U,ge=xe.side??"bottom",pe=!1===W?{mode:"none"}:!0===W||void 0===W?{}:W,ve="none"===pe.mode,we=null===de||0===ae||0===S.length,be=l.useMemo(()=>{if("treemap"===C||X<=0)return{texts:[],band:0};const e=Math.min(150,.25*X),t=oe.map(t=>y(t,e,ue));return{texts:t,band:t.reduce((e,t)=>Math.max(e,w(t,ue)),0)+10}},[C,oe,X,ue]),ye="treemap"===C?0:ue+8,Me={left:be.band,width:Math.max(0,X-be.band),height:Math.max(0,me-ye)},$e=l.useMemo(()=>{if(Me.width<=0||Me.height<=0)return[];if("treemap"===C){const e=[];return ie.forEach((t,l)=>t.forEach((t,n)=>{null!==t.value&&e.push({row:l,index:n,cell:t})})),v(e.map(e=>Math.max(0,e.cell.value??0)),Me.width,Me.height).map(t=>({row:e[t.index].row,index:e[t.index].index,cell:e[t.index].cell,x:Me.left+t.x,y:t.y,width:t.width,height:t.height}))}const e=Me.height/Math.max(1,S.length),t=Me.width/Math.max(1,ae),l=[];return ie.forEach((n,i)=>n.forEach((n,a)=>{null!==n.value&&l.push({row:i,index:a,cell:n,x:Me.left+a*t,y:i*e,width:t,height:e})})),l},[C,ie,S.length,ae,Me.left,Me.width,Me.height]),je=l.useCallback(e=>c(e.cell.x??B?.[e.index]??re[e.index]??e.index,H),[B,re,H]),ke=null===te?null:$e.find(e=>e.row===te.row&&e.index===te.index)??null,Ae=null===ke?[]:[{seriesIndex:ke.row,color:ke.cell.color??x(ce(ke.cell.value??0),I),value:ke.cell.value,formatted:ne(ke.cell.value??0),label:ke.cell.label}],Ne=Array.from({length:p},(e,t)=>x(t,I));return t(a,{...T,size:G,variant:J,padded:O,className:Q,legendSide:ge,legend:fe&&!we?e(n,{steps:Ne,from:ne("diverging"===I?-E(he,se,_)+_:he),to:ne("diverging"===I?E(he,se,_)+_:se),middle:"diverging"===I?ne(_):void 0,align:xe.align??"center",vertical:"left"===ge||"right"===ge,size:G}):null,table:we?null:t("table",{id:ee,className:k,children:[K?e("caption",{children:K}):null,e("thead",{children:t("tr",{children:[e("th",{scope:"col"}),re.map((t,l)=>e("th",{scope:"col",children:c(t,H)},l))]})}),e("tbody",{children:ie.map((l,n)=>t("tr",{children:[e("th",{scope:"row",children:oe[n]}),re.map((t,n)=>{const i=l[n];return e("td",{children:void 0!==i?.label?i.label:null==i?.value?"":ne(i.value)},n)})]},n))})]}),children:[t("div",{ref:V,role:"img",tabIndex:we?void 0:0,"aria-label":K??Z.label,"aria-describedby":we?void 0:ee,onPointerLeave:()=>le(null),onBlur:()=>le(null),onKeyDown:e=>{if(ve||0===$e.length)return;const t=null===te?-1:$e.findIndex(e=>e.row===te.row&&e.index===te.index);if("ArrowRight"===e.key||"ArrowDown"===e.key){const e=$e[Math.min($e.length-1,t+1)];le({row:e.row,index:e.index})}else if("ArrowLeft"===e.key||"ArrowUp"===e.key){const e=$e[Math.max(0,(-1===t?$e.length:t)-1)];le({row:e.row,index:e.index})}else{if("Escape"!==e.key)return;le(null)}e.preventDefault()},className:$("relative w-full rounded-(--neba-radius-xs)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"),style:{height:me},children:[we?e("div",{className:$("flex h-full items-center justify-center text-(--neba-muted-fg)",j[G]),children:F??Y.title}):X>0?t("svg",{width:X,height:me,viewBox:`0 0 ${X} ${me}`,"aria-hidden":"true",className:"block",children:[$e.map(l=>{const n=ce(l.cell.value??0),i=te?.row===l.row&&te?.index===l.index,a=Math.max(0,l.width-m),r=Math.max(0,l.height-m);if(a<=0||r<=0)return null;const o=ne(l.cell.value??0),d="treemap"===C?"all"===P?[je(l),o]:[je(l)]:"all"===P?[o]:[],h=d.filter(e=>function(e,t,l,n){return l>=1.8*n&&t>=Math.min(w(e,n),2.5*n)+8}(e,a,r/d.length,ue)),s=l.cell.color?"var(--neba-surface)":f(n,I);return t("g",{children:[e("rect",{x:l.x+m/2,y:l.y+m/2,width:a,height:r,rx:Math.min(3,a/2,r/2),fill:l.cell.color??x(n,I),opacity:i?1:.94,onPointerEnter:ve?void 0:()=>le({row:l.row,index:l.index}),className:"[transition:opacity_var(--neba-duration)_var(--neba-ease)]"}),h.map((t,n)=>e("text",{x:l.x+l.width/2,y:l.y+l.height/2+(n-(h.length-1)/2)*(ue+2),textAnchor:"middle",dominantBaseline:"central",fontSize:ue,fontWeight:0===n?500:400,fill:s,opacity:0===n?1:.85,pointerEvents:"none",className:0===n&&"treemap"===C?void 0:"tabular-nums",children:y(t,l.width-8,ue)},n))]},`${l.row}-${l.index}`)}),"grid"===C?be.texts.map((t,l)=>e("text",{x:Me.left-8,y:(l+.5)*Me.height/Math.max(1,S.length),textAnchor:"end",dominantBaseline:"central",fontSize:ue,fill:"var(--neba-muted-fg)",children:t},`row-${l}`)):null,"grid"===C?re.map((t,l)=>{const n=Me.width/Math.max(1,ae),i=c(t,H);return l%Math.max(1,Math.ceil((w(i,ue)+8)/Math.max(1,n)))!==0?null:e("text",{x:Me.left+(l+.5)*n,y:Me.height+ue,textAnchor:"middle",fontSize:ue,fill:"var(--neba-muted-fg)",children:i},`col-${l}`)}):null]}):null,ke&&!ve?pe.render?e("div",{className:"pointer-events-none absolute z-10",style:{left:ke.x+ke.width/2,top:ke.y},children:pe.render({index:ke.index,category:ke.cell.x??re[ke.index]??ke.index,items:Ae})}):e(r,{heading:`${oe[ke.row]} · ${je(ke)}`,items:Ae,x:ke.x+ke.width/2,y:ke.y,flip:ke.x+ke.width/2>.6*X,size:G}):null]}),ve?null:e(i,{heading:ke?`${oe[ke.row]} · ${je(ke)}`:void 0,items:Ae})]})}function E(e,t,l){return Math.max(Math.abs(t-l),Math.abs(l-e))}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n}from"react/jsx-runtime";import*as e from"react";import{transitionClasses as
|
|
1
|
+
"use client";import{jsx as n}from"react/jsx-runtime";import*as e from"react";import{cx as t,transitionClasses as r}from"../../internal/styles.js";const o={solid:"bg-(--n-fill) text-(--n-on-solid)",outline:"border bg-(--n-panel) text-(--n-accent) [border-color:var(--n-line)]",text:"bg-transparent text-(--n-accent)"},l={regular:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},i=/[\p{L}\p{N}_]/u;function a(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function s(n,e,t){const r=e>0?n[e-1]:"",o=t<n.length?n[t]:"";return!i.test(r)&&!i.test(o)}function c(n,e,t,r){e.lastIndex=0;const o=[];let l,i=0;for(;null!==(l=e.exec(n));){if(""===l[0]){e.lastIndex+=1;continue}const a=l.index,c=a+l[0].length;!t||s(n,a,c)?(a>i&&o.push(n.slice(i,a)),o.push(r(l[0],`${a}`)),i=c):e.lastIndex=a+1}return 0===o.length?n:(i<n.length&&o.push(n.slice(i)),o)}function u(n,t,r,o){if("string"==typeof n)return c(n,t,r,o);if("number"==typeof n)return c(String(n),t,r,o);if(Array.isArray(n))return e.Children.map(n,n=>u(n,t,r,o));if(e.isValidElement(n)){const l=n.props.children;return void 0===l||"function"==typeof l?n:e.cloneElement(n,void 0,u(l,t,r,o))}return n}export const Highlight=/*@__PURE__*/e.forwardRef(function({query:i,variant:s="solid",color:c="warning",caseSensitive:f=!1,wholeWord:d=!1,underline:m=!1,weight:g,className:p,style:h,children:x,...b},y){const v=e.useMemo(()=>function(n,e){if(n instanceof RegExp)return new RegExp(n.source,n.global?n.flags:`${n.flags}g`);const t=(Array.isArray(n)?n:[n]).map(n=>n.trim()).filter(Boolean).sort((n,e)=>e.length-n.length);return 0===t.length?null:new RegExp(t.map(a).join("|"),e?"gu":"giu")}(i,f),[i,f]),$=t("rounded-[0.25rem] px-0.5 -mx-0.5","box-decoration-clone",o[s],m?"underline decoration-2 underline-offset-2":"",g?l[g]:"",r),w=v?u(x,v,d,(e,t)=>n("mark",{className:$,children:e},t)):x;return n("span",{ref:y,className:p,style:{"--n-fill":`var(--neba-${c}-fill)`,"--n-on-solid":`var(--neba-${c}-on-solid)`,"--n-accent":`var(--neba-${c}-accent)`,"--n-panel":`var(--neba-${c}-panel)`,"--n-line":`var(--neba-${c}-line)`,...h},...b,children:w})});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { NebaAlign, NebaSide, NebaStyleProps } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The same three axes a [Popover](./popover) takes, and for the same reasons:
|
|
5
|
+
* no `variant`, because a surface that had to be hovered has already asserted
|
|
6
|
+
* itself, and no `elevation`, because a card floating over the page is the
|
|
7
|
+
* whole idea and a prop that could sit it flat would undo it.
|
|
8
|
+
*/
|
|
9
|
+
export interface HoverCardProps extends Pick<NebaStyleProps, 'size' | 'color' | 'density'>, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'title' | 'children'> {
|
|
10
|
+
/**
|
|
11
|
+
* What the card hangs off. Exactly one element, which must accept a ref and
|
|
12
|
+
* spread props — every Neba component does.
|
|
13
|
+
*
|
|
14
|
+
* Usually a [TextLink](../display/text-link) or an
|
|
15
|
+
* [Avatar](../display/avatar): the two things a reader wants to know more
|
|
16
|
+
* about without leaving the sentence they are in.
|
|
17
|
+
*/
|
|
18
|
+
trigger: React.ReactElement;
|
|
19
|
+
/** The heading, rendered as the element that names the card. */
|
|
20
|
+
title?: React.ReactNode;
|
|
21
|
+
/** A line under the title. */
|
|
22
|
+
description?: React.ReactNode;
|
|
23
|
+
/** The body. */
|
|
24
|
+
children?: React.ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Which edge of the trigger it appears on. Flips when there is no room.
|
|
27
|
+
* @default 'bottom'
|
|
28
|
+
*/
|
|
29
|
+
side?: NebaSide;
|
|
30
|
+
/** Where it sits along that edge. @default 'center' */
|
|
31
|
+
align?: NebaAlign;
|
|
32
|
+
/** Distance from the trigger, in pixels. @default 6 */
|
|
33
|
+
sideOffset?: number;
|
|
34
|
+
/** Shift along that edge, in pixels. @default 0 */
|
|
35
|
+
alignOffset?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Draws the wedge pointing at the trigger. Off by default, exactly as on
|
|
38
|
+
* Popover: this surface is translucent over a blurred backdrop, and a wedge
|
|
39
|
+
* sticking out past the card's own box cannot carry that backdrop with it.
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
arrow?: boolean;
|
|
43
|
+
/** Whether the card is open. Use with `onOpenChange` for a controlled one. */
|
|
44
|
+
open?: boolean;
|
|
45
|
+
/** Whether it starts open, for an uncontrolled one. */
|
|
46
|
+
defaultOpen?: boolean;
|
|
47
|
+
onOpenChange?: (open: boolean) => void;
|
|
48
|
+
/**
|
|
49
|
+
* How long the pointer has to rest on the trigger before the card opens, in
|
|
50
|
+
* milliseconds. The default is long enough that crossing a paragraph of links
|
|
51
|
+
* does not open four of them.
|
|
52
|
+
*/
|
|
53
|
+
delay?: number;
|
|
54
|
+
/**
|
|
55
|
+
* How long the card stays after the pointer has left, in milliseconds. This
|
|
56
|
+
* is what makes the gap between the trigger and the card crossable.
|
|
57
|
+
*/
|
|
58
|
+
closeDelay?: number;
|
|
59
|
+
/** A hard cap on the card's width, overriding the one `size` implies. */
|
|
60
|
+
width?: number | string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A card that opens when the pointer rests on something, and holds a preview of
|
|
64
|
+
* what is on the other side of it.
|
|
65
|
+
*
|
|
66
|
+
* It sits between the library's other two popups, and the distance is short in
|
|
67
|
+
* both directions. A [Tooltip](../feedback/tooltip) is a label — one line, no
|
|
68
|
+
* interaction, and the pointer never reaches it. A [Popover](./popover) is a
|
|
69
|
+
* panel that was *asked for* by a press, so it can hold a form. This one is
|
|
70
|
+
* uninvited like a tooltip and reachable like a popover: the pointer can cross
|
|
71
|
+
* into it, and a link inside it can be followed.
|
|
72
|
+
*
|
|
73
|
+
* Because it is uninvited, it is never the only way to something. Whatever is in
|
|
74
|
+
* here has to exist on the page the trigger leads to as well — a keyboard
|
|
75
|
+
* without hover, a touchscreen with no pointer at all, and a screen reader all
|
|
76
|
+
* arrive by that route instead.
|
|
77
|
+
*/
|
|
78
|
+
export declare function HoverCard({ size, color, density, trigger, title, description, children, side, align, sideOffset, alignOffset, arrow, open, defaultOpen, onOpenChange, delay, closeDelay, width, className, style, ...props }: HoverCardProps): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import{PreviewCard as t}from"@base-ui/react/preview-card";import{boxPaddingXClasses as l,boxPaddingYClasses as i}from"../box/Box.js";import{cx as n,hasContent as o,metaTextClasses as r,radiusClasses as s,sheetBodyClasses as d,sheetHeaderGapClasses as c,sheetSectionGapClasses as m,sheetTitleClasses as p,surfaceClasses as f,surfaceSlots as x,toLength as h}from"../../internal/styles.js";const g={xs:"max-w-64",sm:"max-w-72",md:"max-w-84",lg:"max-w-md",xl:"max-w-xl"},u=[f,"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]","[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" "),b={xs:8,sm:9,md:10,lg:11,xl:12};export function HoverCard({size:f="md",color:v="primary",density:w="default",trigger:y,title:N,description:O,children:j,side:k="bottom",align:z="center",sideOffset:C=6,alignOffset:P=0,arrow:$=!1,open:B,defaultOpen:D,onOpenChange:M,delay:W,closeDelay:_,width:A,className:E,style:H,...L}){const R=l[w][f],T=i[w][f],q=b[f],F=o(N)||o(O),G=h(A);return a(t.Root,{open:B,defaultOpen:D,onOpenChange:e=>M?.(e),children:[e(t.Trigger,{render:y,delay:W,closeDelay:_}),e(t.Portal,{children:e(t.Positioner,{className:"neba-portal z-50 [outline:none]",side:k,align:z,sideOffset:C,alignOffset:P,children:a(t.Popup,{className:n(u,s[f],d[f],m[f],R,T,void 0===G?g[f]:"",E??""),style:{...x(v,3),...void 0===G?null:{maxWidth:G},...H},...L,children:[$?e(t.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:a("svg",{width:q,height:q/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,F?a("div",{className:`flex min-w-0 flex-col ${c[f]}`,children:[o(N)?e("div",{className:`m-0 font-semibold ${p[f]}`,children:N}):null,o(O)?e("div",{className:`m-0 text-(--neba-muted-fg) ${r[f]}`,children:O}):null]}):null,o(j)?e("div",{className:"min-w-0",children:j}):null]})})})]})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{HoverCard}from"./HoverCard.js";
|
|
@@ -34,6 +34,17 @@ export interface HowToStepsProps extends Omit<React.ComponentPropsWithoutRef<'di
|
|
|
34
34
|
steps: HowToStep[];
|
|
35
35
|
/** The guide's own heading, over both columns. */
|
|
36
36
|
title?: React.ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Which heading level `title` is written at, and the step's title one below
|
|
39
|
+
* it.
|
|
40
|
+
*
|
|
41
|
+
* A heading level is a claim about the *page*, not about the component: a
|
|
42
|
+
* guide under an `<h1>` is an `<h2>` and the same guide inside a section is an
|
|
43
|
+
* `<h4>`, and a component that decides for itself breaks the outline of every
|
|
44
|
+
* page it does not happen to suit.
|
|
45
|
+
* @default 3
|
|
46
|
+
*/
|
|
47
|
+
headingLevel?: 2 | 3 | 4 | 5;
|
|
37
48
|
/** Which step is showing. Pass it to drive the guide yourself. */
|
|
38
49
|
step?: number;
|
|
39
50
|
/** Where an uncontrolled guide starts. @default 0 */
|
|
@@ -139,29 +150,4 @@ export interface HowToStepsProps extends Omit<React.ComponentPropsWithoutRef<'di
|
|
|
139
150
|
doneLabel?: string;
|
|
140
151
|
restartLabel?: string;
|
|
141
152
|
}
|
|
142
|
-
/**
|
|
143
|
-
* A guide the reader walks through: numbered steps down one side, one step's
|
|
144
|
-
* instructions at a time beside them, and a way forward under those.
|
|
145
|
-
*
|
|
146
|
-
* It is [Timeline]'s interactive sibling, and the two are deliberately not one
|
|
147
|
-
* component. A Timeline *reports* — this happened, then this did, and here is
|
|
148
|
-
* where things have got to — and nothing in it is pressed. A HowToSteps *asks*:
|
|
149
|
-
* the reader is meant to do the thing on the screen and then say they have,
|
|
150
|
-
* which needs a current step, a way to change it, and an end.
|
|
151
|
-
*
|
|
152
|
-
* Two things about how it is built are load-bearing rather than incidental.
|
|
153
|
-
*
|
|
154
|
-
* **Every step's body is rendered into the same grid cell**, with the ones not
|
|
155
|
-
* showing left in the document, `invisible` and `inert`. The panel is therefore
|
|
156
|
-
* as tall as the tallest step at every moment, so moving between a one-line
|
|
157
|
-
* step and a five-line one does not resize the card the guide sits in — which,
|
|
158
|
-
* on a page the reader has already scrolled, moves everything under it. The
|
|
159
|
-
* finished panel is in that cell too, for the same reason.
|
|
160
|
-
*
|
|
161
|
-
* **The list is a list of buttons and not a tablist.** A stepper looks like
|
|
162
|
-
* tabs and is not one: the panels are ordered, the reader is expected to arrive
|
|
163
|
-
* at them in that order, and `aria-current="step"` is the attribute that says
|
|
164
|
-
* so. A tablist's roving focus would tell a screen reader that these are
|
|
165
|
-
* interchangeable views of one thing.
|
|
166
|
-
*/
|
|
167
153
|
export declare const HowToSteps: React.ForwardRefExoticComponent<HowToStepsProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -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
|
|
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{fill as m,stepsMessages as d,useMessages as p}from"../../internal/i18n.js";import{transitionProps as f}from"../../internal/animate.js";import{cx as x,hasContent as u,iconClasses as b,metaTextClasses as h,radiusClasses as g,sheetBodyClasses as v,sheetSectionGapClasses as N,sheetTitleClasses as w,srOnlyClasses as y,surfaceClasses as k,surfaceSlots as j,toLength as C,transitionClasses as z}from"../../internal/styles.js";const S={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]"}},L={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"}},I={solid:[k,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[k,"border text-(--neba-fg) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--neba-fg) bg-transparent"};function M(e){return"string"==typeof e?e:""}function R({level:e,...t}){return l.createElement(`h${Math.min(6,Math.max(1,e))}`,t)}export const HowToSteps=/*@__PURE__*/l.forwardRef(function({steps:k,title:B,headingLevel:_=3,step:H,defaultStep:T=0,onStepChange:$,completed:E,defaultCompleted:A=!1,onCompletedChange:F,orientation:W="vertical",maxHeight:q,railWidth:D="15rem",navigation:G=!0,divider:J=!0,transition:K="fade",completion:O=!0,completedContent:P,variant:Q="outline",size:U="md",color:V="primary",density:X="default",elevation:Y=0,locale:Z,previousLabel:ee,nextLabel:te,doneLabel:ne,restartLabel:le,className:ae,style:re,...ie},oe){const se=p(d,Z),ce=l.useId(),[me,de]=l.useState(T),[pe,fe]=l.useState(A),xe=void 0!==H,ue=void 0!==E,be=k.length,he=Math.min(Math.max(xe?H:me,0),Math.max(be-1,0)),ge=O&&(ue?E:pe),ve=void 0!==q,Ne="vertical"===W,we=l.useRef(null),ye=l.useRef(null);if(l.useEffect(()=>{const e=we.current,t=ye.current;if(!e||!t)return;const n=e.getBoundingClientRect(),l=t.getBoundingClientRect();Ne?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)},[he,Ne]),0===be)return null;const ke=(e,t=!1)=>{ue||fe(t),ge!==t&&F?.(t),t||(xe||de(e),e!==he&&$?.(e))},je=0===he,Ce=he===be-1,ze="none"===K?null:f(K),Se=t=>{const n=ge||t<he,l=!ge&&t===he;return e("span",{"aria-hidden":"true",className:x("z-1 flex shrink-0 items-center justify-center rounded-full border font-medium","size-(--n-step-mark) [&_svg]:size-[1.15em]",S[U].text,z,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})},Le=e("ol",{ref:we,"aria-label":se.steps,className:x("m-0 flex list-none p-0",Ne?"flex-col":"flex-row",L[X][U],ve&&Ne?"min-h-0 overflow-y-auto overscroll-contain":"",Ne?"":"overflow-x-auto overscroll-contain"),children:k.map((n,l)=>{const a=ge||l<he,r=!ge&&l===he;return t("li",{ref:r?ye:void 0,className:x("relative",Ne?"":"min-w-0 flex-1"),children:[l<be-1?e("span",{"aria-hidden":"true",className:x("absolute",z,a?"bg-(--n-fill)":"bg-(--n-line)",Ne?["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:()=>ke(l),"aria-current":r?"step":void 0,className:x("flex w-full cursor-pointer items-center p-1 text-start",Ne?"gap-3":"flex-col gap-1.5 text-center",g.sm,"hover:bg-(--n-soft)",z,"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1"),children:[Se(l),e("span",{className:x("min-w-0",Ne?"truncate":"",h[U],r?"font-medium text-(--neba-fg)":"text-(--neba-muted-fg)"),children:n.title}),e("span",{className:y,children:m(se.step,{index:String(l+1),title:M(n.title)})})]})]},l)})}),Ie=t("div",{className:x("grid flex-1 grid-cols-1",ve?"min-h-0":""),children:[k.map((n,l)=>{const a=ge||l!==he;return t("div",{"aria-hidden":a,inert:a||void 0,className:x("col-start-1 row-start-1 min-w-0",ve?"overflow-y-auto overscroll-contain":"",a?"invisible":ze?.className??""),style:a?void 0:ze?.style,children:[t("div",{className:"mb-3 flex items-baseline gap-3",children:[u(n.icon)?e("span",{"aria-hidden":"true",className:x("flex h-[1lh] shrink-0 items-center text-(--n-accent)",w[U],b),children:n.icon}):null,e(R,{level:_+1,className:x("m-0 min-w-0 flex-1 font-medium",w[U]),children:n.title}),e("span",{className:x("shrink-0 text-(--neba-muted-fg) tabular-nums",h[U]),children:m(se.position,{index:String(l+1),total:String(be)})})]}),n.image?e("img",{src:n.image,alt:n.imageAlt??M(n.title),loading:"lazy",decoding:"async",className:x("mb-3 max-h-72 w-full object-contain",g[U])}):null,u(n.content)?e("div",{className:x("min-w-0",v[U]),children:n.content}):null]},l)}),O?t("div",{"aria-hidden":!ge,inert:!ge||void 0,className:x("col-start-1 row-start-1 flex min-w-0 flex-col items-center justify-center gap-2 py-4 text-center",ge?ze?.className??"":"invisible"),style:ge?ze?.style:void 0,children:[e("span",{"aria-hidden":"true",className:"text-(--n-accent) [&_svg]:size-9",children:e(c,{})}),e("p",{className:x("m-0 font-medium",v[U]),children:P??se.completed})]}):null]});return t("div",{ref:oe,"aria-labelledby":u(B)?ce:void 0,className:x("flex min-w-0 flex-col",g[U],r[X][U],N[U],I[Q],z,ae),style:{...j(V,Y),"--n-fill":`var(--neba-${V}-fill)`,"--n-on-solid":`var(--neba-${V}-on-solid)`,"--n-step-mark":S[U].box,"--n-step-rail":C(D),...ve?{maxHeight:C(q)}:null,...re},...ie,children:[u(B)?e(R,{level:_,id:ce,className:x("m-0 shrink-0 font-medium",w[U]),children:B}):null,t("div",{className:x("flex min-w-0 flex-1 flex-col",ve?"min-h-0":"",Ne?"gap-4 sm:flex-row sm:gap-5":"gap-4"),children:[e("div",{className:x("flex min-w-0 flex-col",ve?"min-h-0":"",Ne?"sm:w-(--n-step-rail) sm:shrink-0":"",J?Ne?"border-b pb-4 sm:border-b-0 sm:border-e sm:pb-0 sm:pe-5":"border-b pb-4":"",J?"[border-color:var(--n-line)]":""),children:Le}),t("div",{className:x("flex min-w-0 flex-1 flex-col",ve?"min-h-0":"",N[U]),children:[Ie,G?e("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-2",children:ge?e(a,{size:U,variant:"outline",color:V,startIcon:e(s,{}),onClick:()=>ke(0),children:le??se.restart}):t(n,{children:[e(a,{size:U,variant:"outline",color:V,disabled:je,startIcon:e("span",{className:"rotate-90 rtl:-rotate-90",children:e(o,{})}),onClick:()=>ke(he-1),children:ee??se.previous}),e(a,Ce&&O?{size:U,variant:"solid",color:V,startIcon:e(i,{}),onClick:()=>ke(he,!0),children:ne??se.done}:{size:U,variant:"solid",color:V,disabled:Ce,endIcon:e("span",{className:"-rotate-90 rtl:rotate-90",children:e(o,{})}),onClick:()=>ke(he+1),children:te??se.next})]})}):null]})]})]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e}from"react/jsx-runtime";import*as t from"react";import{transitionProps as i}from"../../internal/animate.js";import{iconSizeClasses as
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import*as t from"react";import{transitionProps as i}from"../../internal/animate.js";import{cx as n,iconSizeClasses as r}from"../../internal/styles.js";const s={xs:"text-[0.875rem]",sm:"text-[1rem]",md:"text-[1.25rem]",lg:"text-[1.5rem]",xl:"text-[1.75rem]"};export const Icon=/*@__PURE__*/t.forwardRef(function({icon:t,size:l="md",color:a="inherit",label:m,transition:o,className:c,style:f,...x},d){const g=i(o),u=n("inline-flex shrink-0 items-center justify-center align-middle",r[l],"[&>svg]:block [&>svg]:size-full [&>img]:block [&>img]:size-full",`leading-none ${s[l]}`,"inherit"===a?"":"text-(--n-accent)",g.className,c??"");return e("span",{ref:d,className:u,style:"inherit"===a?{...g.style,...f}:{"--n-accent":`var(--neba-${a}-accent)`,...g.style,...f},role:m?"img":void 0,"aria-label":m,"aria-hidden":!m||void 0,...x,children:t})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as r,Fragment as s}from"react/jsx-runtime";import*as n from"react";import{useRender as t}from"@base-ui/react/use-render";import{boxPaddingXClasses as l}from"../box/Box.js";import{cx as a,focusRingClasses as i,gapClasses as o,hasContent as d,iconClasses as c,metaTextClasses as m,radiusClasses as f,sheetBodyClasses as x,surfaceClasses as p,surfaceSlots as u,transitionClasses as h}from"../../internal/styles.js";const b=/*@__PURE__*/n.createContext({size:"md",density:"default",dividers:!1}),v={solid:[p,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[p,"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"},g={default:{xs:"py-1",sm:"py-1.5",md:"py-2",lg:"py-2.5",xl:"py-3"},compact:{xs:"py-0.5",sm:"py-0.5",md:"py-1",lg:"py-1.5",xl:"py-2"}},y={xs:f.xs,sm:f.xs,md:f.sm,lg:f.sm,xl:f.md};export const List=/*@__PURE__*/n.forwardRef(function({variant:r="outline",size:s="md",color:l="primary",density:i="default",elevation:o=0,dividers:d=!1,render:c,className:m,style:x,children:p,...g},y){const N=n.useMemo(()=>({size:s,density:i,dividers:d}),[s,i,d]),w=a("flex flex-col",f[s],v[r],h,d?"overflow-hidden [&>li+li]:border-t [&>li+li]:[border-color:var(--n-line)]":"p-1",m??""),j=t({render:c,ref:y,props:{role:"list",className:w,style:{...u(l,o),...x},children:p,...g}});return e(b.Provider,{value:N,children:j})});export const ListItem=/*@__PURE__*/n.forwardRef(function({startIcon:t,endIcon:f,description:p,action:u,href:v,selected:N=!1,disabled:w=!1,className:j,children:k,onClick:C,...z},I){const{size:$,density:B,dividers:L}=n.useContext(b),R=Boolean(C||v)&&!w,F=l[B][$],M=g[B][$],P=a("flex min-w-0 flex-1 items-center text-start",F,M,o[$],x[$],h,c,L?"":y[$],w?"cursor-not-allowed text-(--neba-disabled-fg)":N?"bg-(--n-soft-press) font-medium text-(--n-accent)":"",R?`cursor-pointer ${i}`:"",R&&!N?"hover:bg-(--n-soft)":"",R&&N?"hover:bg-(--n-soft-press)":""),q=r(s,{children:[d(t)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:t}):null,r("span",{className:"flex min-w-0 flex-1 flex-col",children:[d(k)?e("span",{className:"truncate",children:k}):null,d(p)?e("span",{className:`truncate text-(--neba-muted-fg) ${m[$]}`,children:p}):null]}),d(f)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:f}):null]});return r("li",{ref:I,className:a("flex w-full items-center",j??""),...z,children:[R&&v?e("a",{href:v,className:P,"aria-current":N?"page":void 0,onClick:C,children:q}):R?e("button",{type:"button",className:P,"aria-current":!!N||void 0,onClick:C,children:q}):e("div",{className:P,"aria-disabled":w||void 0,children:q}),d(u)?e("div",{className:`flex shrink-0 items-center ${F}`,children:u}):null]})});
|