neba 1.7.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -7
- package/dist/components/accordion/Accordion.js +1 -1
- package/dist/components/alert/Alert.js +1 -1
- package/dist/components/animate-appear/AnimateAppear.js +1 -1
- package/dist/components/animate-blink/AnimateBlink.js +1 -1
- package/dist/components/animate-fade/AnimateFade.js +1 -1
- package/dist/components/animate-grow/AnimateGrow.js +1 -1
- package/dist/components/animate-headline/AnimateHeadline.js +1 -1
- package/dist/components/animate-lighting/AnimateLighting.js +1 -1
- package/dist/components/animate-marquee/AnimateMarquee.js +1 -1
- package/dist/components/animate-rotate/AnimateRotate.js +1 -1
- package/dist/components/animate-slide/AnimateSlide.js +1 -1
- package/dist/components/animate-typing/AnimateTyping.js +1 -1
- package/dist/components/animate-zoom/AnimateZoom.js +1 -1
- package/dist/components/app-logo/AppLogo.d.ts +148 -0
- package/dist/components/app-logo/AppLogo.js +1 -0
- package/dist/components/app-logo/index.d.ts +2 -0
- package/dist/components/app-logo/index.js +1 -0
- package/dist/components/area-chart/AreaChart.js +1 -1
- package/dist/components/aspect-ratio/AspectRatio.js +1 -1
- package/dist/components/avatar/Avatar.js +1 -1
- package/dist/components/badge/Badge.js +1 -1
- package/dist/components/bar-chart/BarChart.js +1 -1
- package/dist/components/blockquote/Blockquote.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.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.js +1 -1
- package/dist/components/chip/Chip.js +1 -1
- package/dist/components/code-block/CodeBlock.d.ts +170 -0
- package/dist/components/code-block/CodeBlock.js +1 -0
- package/dist/components/code-block/index.d.ts +2 -0
- package/dist/components/code-block/index.js +1 -0
- package/dist/components/collapsible/Collapsible.js +1 -1
- package/dist/components/color-picker/ColorPicker.d.ts +1 -1
- package/dist/components/color-picker/ColorPicker.js +1 -1
- package/dist/components/combobox/Combobox.js +1 -1
- package/dist/components/container/Container.js +1 -1
- package/dist/components/data-table/DataTable.js +1 -1
- package/dist/components/date-picker/DatePicker.js +1 -1
- package/dist/components/date-range-picker/DateRangePicker.js +1 -1
- package/dist/components/date-time-picker/DateTimePicker.js +1 -1
- package/dist/components/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/file-picker/FilePicker.js +1 -1
- package/dist/components/floating-action-button/FloatingActionButton.js +1 -1
- package/dist/components/floating-bottom-navigation/FloatingBottomNavigation.js +1 -1
- package/dist/components/footer/Footer.d.ts +85 -0
- package/dist/components/footer/Footer.js +1 -0
- package/dist/components/footer/index.d.ts +2 -0
- package/dist/components/footer/index.js +1 -0
- package/dist/components/grid/Grid.js +1 -1
- package/dist/components/grid-container/GridContainer.js +1 -1
- package/dist/components/header/Header.d.ts +114 -0
- package/dist/components/header/Header.js +1 -0
- package/dist/components/header/index.d.ts +2 -0
- package/dist/components/header/index.js +1 -0
- package/dist/components/heatmap-chart/HeatmapChart.js +1 -1
- package/dist/components/highlight/Highlight.js +1 -1
- package/dist/components/how-to-steps/HowToSteps.d.ts +167 -0
- package/dist/components/how-to-steps/HowToSteps.js +1 -0
- package/dist/components/how-to-steps/index.d.ts +2 -0
- package/dist/components/how-to-steps/index.js +1 -0
- package/dist/components/icon/Icon.js +1 -1
- package/dist/components/icon-button/IconButton.js +1 -1
- package/dist/components/line-chart/LineChart.js +1 -1
- package/dist/components/list/List.js +1 -1
- package/dist/components/menu/Menu.js +1 -1
- package/dist/components/mockup/Mockup.js +1 -1
- 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.d.ts +144 -0
- package/dist/components/page-layout/PageLayout.js +1 -0
- package/dist/components/page-layout/index.d.ts +2 -0
- package/dist/components/page-layout/index.js +1 -0
- 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.js +1 -1
- package/dist/components/rating/Rating.js +1 -1
- package/dist/components/scatter-chart/ScatterChart.js +1 -1
- package/dist/components/scroll-zone/ScrollZone.js +1 -1
- package/dist/components/segmented-button/SegmentedButton.js +1 -1
- package/dist/components/select/Select.js +1 -1
- package/dist/components/shortcut/Shortcut.js +1 -1
- package/dist/components/sidebar/Sidebar.d.ts +144 -0
- package/dist/components/sidebar/Sidebar.js +1 -0
- package/dist/components/sidebar/SidebarTrigger.d.ts +36 -0
- package/dist/components/sidebar/SidebarTrigger.js +1 -0
- package/dist/components/sidebar/index.d.ts +4 -0
- package/dist/components/sidebar/index.js +1 -0
- package/dist/components/skeleton/Skeleton.js +1 -1
- package/dist/components/slider/Slider.js +1 -1
- package/dist/components/sparkline/Sparkline.js +1 -1
- package/dist/components/spoiler/Spoiler.js +1 -1
- package/dist/components/statistic/Statistic.js +1 -1
- package/dist/components/switch/Switch.js +1 -1
- package/dist/components/table/Table.js +1 -1
- package/dist/components/tabs/Tabs.js +1 -1
- package/dist/components/text-field/TextField.js +1 -1
- package/dist/components/text-link/TextLink.js +1 -1
- package/dist/components/time-picker/TimePicker.js +1 -1
- package/dist/components/timeline/Timeline.js +1 -1
- package/dist/components/timeline-chart/TimelineChart.js +1 -1
- package/dist/components/toast/Toast.js +1 -1
- package/dist/components/toolbar/Toolbar.js +1 -1
- package/dist/components/tooltip/Tooltip.js +1 -1
- 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 +7 -0
- package/dist/index.js +1 -1
- package/dist/internal/animate.js +1 -1
- package/dist/internal/bottom-navigation.d.ts +4 -3
- package/dist/internal/bottom-navigation.js +1 -1
- package/dist/internal/button-group.js +1 -1
- package/dist/internal/calendar.js +1 -1
- package/dist/internal/chart-frame.js +1 -1
- package/dist/internal/chart.d.ts +3 -2
- package/dist/internal/color.d.ts +2 -2
- package/dist/internal/date.d.ts +3 -4
- package/dist/internal/highlight.d.ts +97 -0
- package/dist/internal/highlight.js +1 -0
- package/dist/internal/i18n.d.ts +85 -0
- package/dist/internal/i18n.js +1 -1
- package/dist/internal/icons.d.ts +20 -0
- package/dist/internal/icons.js +1 -1
- package/dist/internal/initials.d.ts +24 -0
- package/dist/internal/initials.js +1 -0
- package/dist/internal/menu.js +1 -1
- package/dist/internal/page-layout.d.ts +143 -0
- package/dist/internal/page-layout.js +1 -0
- package/dist/internal/styles.d.ts +11 -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 +473 -0
- package/package.json +8 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as t from"react";import{Separator as n}from"@base-ui/react/separator";import{metaTextClasses as l}from"../../internal/styles.js";const i="[border-color:var(--n-line)]";function a(e){return"number"==typeof e?`${e}px`:e}const o={horizontal:{start:["w-4 shrink-0","flex-1"],center:["flex-1","flex-1"],end:["flex-1","w-4 shrink-0"]},vertical:{start:["h-4 shrink-0","flex-1"],center:["flex-1","flex-1"],end:["flex-1","h-4 shrink-0"]}},s={xs:"gap-1.5",sm:"gap-2",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const Divider=/*@__PURE__*/t.forwardRef(function({orientation:t="horizontal",color:c="primary",size:d="md",length:f,thickness:h,textAlign:m="center",className:p,style:u,children:x,...w},b){const v="vertical"===t,g=null!=x&&!1!==x&&""!==x,$={"--n-line":`var(--neba-${c}-line)`,"--n-rule":a(h)??"1px"},j=a(f),y={...$,...void 0===j?null:v?{height:j}:{width:j},...u};if(!g)return e(n,{ref:b,orientation:t,className:[v?"w-0 border-l [border-left-width:var(--n-rule)] "+(void 0===j?"self-stretch":""):"h-0 w-full border-t [border-top-width:var(--n-rule)]",i,p??""].filter(Boolean).join(" "),style:y,...w});const[k,N]=o[t][m],z=v?"w-0 border-l [border-left-width:var(--n-rule)]":"h-0 border-t [border-top-width:var(--n-rule)]";return r(n,{ref:b,orientation:t,"aria-label":"string"==typeof x?x:void 0,className:["flex items-center",v?"w-auto flex-col "+(void 0===j?"self-stretch":""):"w-full",s[d],p??""].filter(Boolean).join(" "),style:y,...w,children:[e("span",{"aria-hidden":"true",className:`${z} ${k} ${i}`}),e("span",{className:["shrink-0 whitespace-nowrap text-(--neba-muted-fg)",l[d],v?"[writing-mode:vertical-rl]":""].filter(Boolean).join(" "),children:x}),e("span",{"aria-hidden":"true",className:`${z} ${N} ${i}`})]})});
|
|
1
|
+
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as t from"react";import{Separator as n}from"@base-ui/react/separator";import{metaTextClasses as l}from"../../internal/styles.js";const i="[border-color:var(--n-line)]";function a(e){return"number"==typeof e?`${e}px`:e}const o={horizontal:{start:["w-4 shrink-0","flex-1"],center:["flex-1","flex-1"],end:["flex-1","w-4 shrink-0"]},vertical:{start:["h-4 shrink-0","flex-1"],center:["flex-1","flex-1"],end:["flex-1","h-4 shrink-0"]}},s={xs:"gap-1.5",sm:"gap-2",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const Divider=/*@__PURE__*/t.forwardRef(function({orientation:t="horizontal",color:c="primary",size:d="md",length:f,thickness:h,textAlign:m="center",className:p,style:u,children:x,...w},b){const v="vertical"===t,g=null!=x&&!1!==x&&""!==x,$={"--n-line":`var(--neba-${c}-line)`,"--n-rule":a(h)??"1px"},j=a(f),y={...$,...void 0===j?null:v?{height:j}:{width:j},...u};if(!g)return e(n,{ref:b,orientation:t,className:[v?"w-0 border-l [border-left-width:var(--n-rule)] "+(void 0===j?"self-stretch":""):"h-0 w-full border-t [border-top-width:var(--n-rule)]",i,p??""].filter(Boolean).join(" "),style:y,...w});const[k,N]=o[t][m],z=v?"w-0 border-l [border-left-width:var(--n-rule)]":"h-0 border-t [border-top-width:var(--n-rule)]";return r(n,{ref:b,orientation:t,"aria-label":"string"==typeof x?x:void 0,className:["flex items-center",v?"w-auto flex-col "+(void 0===j?"self-stretch":""):"w-full",s[d],p??""].filter(Boolean).join(" "),style:y,...w,children:[e("span",{"aria-hidden":"true",className:`${z} ${k} ${i}`}),e("span",{className:["shrink-0 whitespace-nowrap text-(--neba-muted-fg)",l[d],v?"[writing-mode:vertical-rl]":""].filter(Boolean).join(" "),children:x}),e("span",{"aria-hidden":"true",className:`${z} ${N} ${i}`})]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r,Fragment as a}from"react/jsx-runtime";import{Dialog as l}from"@base-ui/react/dialog";import{boxPaddingXClasses as n,boxPaddingYClasses as o}from"../box/Box.js";import{actionMessages as s,useMessages as i}from"../../internal/i18n.js";import{CloseIcon as d}from"../../internal/icons.js";import{hasContent as t,metaTextClasses as u,sheetBodyClasses as b,sheetHeaderGapClasses as m,sheetSectionGapClasses as c,sheetTitleClasses as f,surfaceClasses as x,surfaceSlots as p}from"../../internal/styles.js";const g={xs:"w-56",sm:"w-64",md:"w-80",lg:"w-96",xl:"w-[28rem]"},h={left:{xs:"rounded-r-(--neba-radius-xs)",sm:"rounded-r-(--neba-radius-sm)",md:"rounded-r-(--neba-radius-md)",lg:"rounded-r-(--neba-radius-lg)",xl:"rounded-r-(--neba-radius-xl)"},right:{xs:"rounded-l-(--neba-radius-xs)",sm:"rounded-l-(--neba-radius-sm)",md:"rounded-l-(--neba-radius-md)",lg:"rounded-l-(--neba-radius-lg)",xl:"rounded-l-(--neba-radius-xl)"},top:{xs:"rounded-b-(--neba-radius-xs)",sm:"rounded-b-(--neba-radius-sm)",md:"rounded-b-(--neba-radius-md)",lg:"rounded-b-(--neba-radius-lg)",xl:"rounded-b-(--neba-radius-xl)"},bottom:{xs:"rounded-t-(--neba-radius-xs)",sm:"rounded-t-(--neba-radius-sm)",md:"rounded-t-(--neba-radius-md)",lg:"rounded-t-(--neba-radius-lg)",xl:"rounded-t-(--neba-radius-xl)"}},v={left:"border-r",right:"border-l",top:"border-b",bottom:"border-t"},y={left:"flex-row justify-start",right:"flex-row justify-end",top:"flex-col justify-start",bottom:"flex-col justify-end"},w=[x,"relative flex flex-col overflow-hidden","text-(--neba-fg) bg-(--n-panel-press)","[border-color:var(--n-line)]","[outline:none]"].join(" "),j=["[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" "),N=["fixed inset-0 z-50 bg-(--neba-scrim)","[backdrop-filter:blur(2px)]",j].join(" "),$="border-t [border-color:var(--n-line)]",_=["flex size-[1.6em] shrink-0 cursor-pointer items-center justify-center","rounded-full text-(--neba-muted-fg)","[&_svg]:size-[1.1em] [&_svg]:shrink-0","[transition:background-color_var(--neba-duration)_var(--neba-ease),color_var(--neba-duration)_var(--neba-ease)]","hover:bg-(--n-soft) hover:text-(--neba-fg)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"].join(" ");export const DrawerClose=l.Close;export function Drawer({side:x="left",mode:k="overlay",size:C="md",color:z="primary",density:B="default",open:D,defaultOpen:O,onOpenChange:P,trigger:T,title:F,description:L,actions:R,dividers:V=!1,showClose:q,locale:A,closeLabel:E,extent:G,rounded:H=!0,modal:I=!0,dismissible:J=!0,className:K,style:M,children:Q,...S}){const U=i(s,A),W="overlay"===k,X="left"===x||"right"===x,Y=q??W,Z=n[B][C],ee=o[B][C],re=V?`${Z} ${ee}`:Z,ae=t(F)||t(L),le=t(R),ne=void 0===G?null:{[X?"width":"height"]:"number"==typeof G?`${G}px`:G},oe=[w,b[C],v[x],H?h[x][C]:"",W?"[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]":"[box-shadow:var(--neba-plate-glass)]",W?j:"",X?`h-full max-w-full ${void 0===G?g[C]:""}`:"w-full "+(void 0===G?"max-h-[85%]":""),V?"":`${ee} ${c[C]}`,K??""].filter(Boolean).join(" "),se=W?l.Title:"h2",ie=W?l.Description:"p",de=r(a,{children:[ae||Y?r("div",{className:`flex shrink-0 items-start gap-3 ${re}`,children:[r("div",{className:`flex min-w-0 flex-1 flex-col ${m[C]}`,children:[t(F)?e(se,{className:`m-0 font-semibold ${f[C]}`,children:F}):null,t(L)?e(ie,{className:`m-0 text-(--neba-muted-fg) ${u[C]}`,children:L}):null]}),Y?W?e(l.Close,{"aria-label":E??U.close,className:_,children:e(d,{})}):e("button",{type:"button","aria-label":E??U.close,className:_,onClick:()=>P?.(!1),children:e(d,{})}):null]}):null,t(Q)?e("div",{className:["min-h-0 flex-1 overflow-y-auto overscroll-contain",re,V&&(ae||Y)?$:"",V?"":"py-1 -my-1"].filter(Boolean).join(" "),children:Q}):null,le?e("div",{className:["flex shrink-0 flex-wrap items-center justify-end gap-2",re,V?$:""].filter(Boolean).join(" "),children:R}):null]});return W?r(l.Root,{open:D,defaultOpen:O,modal:I,disablePointerDismissal:!J,onOpenChange:(e,r)=>{J||e||"escape-key"!==r.reason?P?.(e):r.cancel()},children:[T?e(l.Trigger,{render:T}):null,r(l.Portal,{children:[e(l.Backdrop,{className:`neba-portal ${N}`}),e(l.Viewport,{className:`neba-portal fixed inset-0 z-50 flex ${y[x]}`,children:e(l.Popup,{className:oe,style:{...p(z,3),...ne,...M},...S,children:de})})]})]}):D??O
|
|
1
|
+
"use client";import{jsx as e,jsxs as r,Fragment as a}from"react/jsx-runtime";import{Dialog as l}from"@base-ui/react/dialog";import{boxPaddingXClasses as n,boxPaddingYClasses as o}from"../box/Box.js";import{actionMessages as s,useMessages as i}from"../../internal/i18n.js";import{CloseIcon as d}from"../../internal/icons.js";import{hasContent as t,metaTextClasses as u,sheetBodyClasses as b,sheetHeaderGapClasses as m,sheetSectionGapClasses as c,sheetTitleClasses as f,surfaceClasses as x,surfaceSlots as p}from"../../internal/styles.js";const g={xs:"w-56",sm:"w-64",md:"w-80",lg:"w-96",xl:"w-[28rem]"},h={left:{xs:"rounded-r-(--neba-radius-xs)",sm:"rounded-r-(--neba-radius-sm)",md:"rounded-r-(--neba-radius-md)",lg:"rounded-r-(--neba-radius-lg)",xl:"rounded-r-(--neba-radius-xl)"},right:{xs:"rounded-l-(--neba-radius-xs)",sm:"rounded-l-(--neba-radius-sm)",md:"rounded-l-(--neba-radius-md)",lg:"rounded-l-(--neba-radius-lg)",xl:"rounded-l-(--neba-radius-xl)"},top:{xs:"rounded-b-(--neba-radius-xs)",sm:"rounded-b-(--neba-radius-sm)",md:"rounded-b-(--neba-radius-md)",lg:"rounded-b-(--neba-radius-lg)",xl:"rounded-b-(--neba-radius-xl)"},bottom:{xs:"rounded-t-(--neba-radius-xs)",sm:"rounded-t-(--neba-radius-sm)",md:"rounded-t-(--neba-radius-md)",lg:"rounded-t-(--neba-radius-lg)",xl:"rounded-t-(--neba-radius-xl)"}},v={left:"border-r",right:"border-l",top:"border-b",bottom:"border-t"},y={left:"flex-row justify-start",right:"flex-row justify-end",top:"flex-col justify-start",bottom:"flex-col justify-end"},w=[x,"relative flex flex-col overflow-hidden","text-(--neba-fg) bg-(--n-panel-press)","[border-color:var(--n-line)]","[outline:none]"].join(" "),j=["[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" "),N=["fixed inset-0 z-50 bg-(--neba-scrim)","[backdrop-filter:blur(2px)]",j].join(" "),$="border-t [border-color:var(--n-line)]",_=["flex size-[1.6em] shrink-0 cursor-pointer items-center justify-center","rounded-full text-(--neba-muted-fg)","[&_svg]:size-[1.1em] [&_svg]:shrink-0","[transition:background-color_var(--neba-duration)_var(--neba-ease),color_var(--neba-duration)_var(--neba-ease)]","hover:bg-(--n-soft) hover:text-(--neba-fg)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"].join(" ");export const DrawerClose=l.Close;export function Drawer({side:x="left",mode:k="overlay",size:C="md",color:z="primary",density:B="default",open:D,defaultOpen:O,onOpenChange:P,trigger:T,title:F,description:L,actions:R,dividers:V=!1,showClose:q,locale:A,closeLabel:E,extent:G,rounded:H=!0,modal:I=!0,dismissible:J=!0,className:K,style:M,children:Q,...S}){const U=i(s,A),W="overlay"===k,X="left"===x||"right"===x,Y=q??W,Z=n[B][C],ee=o[B][C],re=V?`${Z} ${ee}`:Z,ae=t(F)||t(L),le=t(R),ne=void 0===G?null:{[X?"width":"height"]:"number"==typeof G?`${G}px`:G},oe=[w,b[C],v[x],H?h[x][C]:"",W?"[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]":"[box-shadow:var(--neba-plate-glass)]",W?j:"",X?`h-full max-w-full ${void 0===G?g[C]:""}`:"w-full "+(void 0===G?"max-h-[85%]":""),V?"":`${ee} ${c[C]}`,K??""].filter(Boolean).join(" "),se=W?l.Title:"h2",ie=W?l.Description:"p",de=r(a,{children:[ae||Y?r("div",{className:`flex shrink-0 items-start gap-3 ${re}`,children:[r("div",{className:`flex min-w-0 flex-1 flex-col ${m[C]}`,children:[t(F)?e(se,{className:`m-0 font-semibold ${f[C]}`,children:F}):null,t(L)?e(ie,{className:`m-0 text-(--neba-muted-fg) ${u[C]}`,children:L}):null]}),Y?W?e(l.Close,{"aria-label":E??U.close,className:_,children:e(d,{})}):e("button",{type:"button","aria-label":E??U.close,className:_,onClick:()=>P?.(!1),children:e(d,{})}):null]}):null,t(Q)?e("div",{className:["min-h-0 flex-1 overflow-y-auto overscroll-contain",re,V&&(ae||Y)?$:"",V?"":"py-1 -my-1"].filter(Boolean).join(" "),children:Q}):null,le?e("div",{className:["flex shrink-0 flex-wrap items-center justify-end gap-2",re,V?$:""].filter(Boolean).join(" "),children:R}):null]});return W?r(l.Root,{open:D,defaultOpen:O,modal:I,disablePointerDismissal:!J,onOpenChange:(e,r)=>{J||e||"escape-key"!==r.reason?P?.(e):r.cancel()},children:[T?e(l.Trigger,{render:T}):null,r(l.Portal,{children:[e(l.Backdrop,{className:`neba-portal ${N}`}),e(l.Viewport,{className:`neba-portal fixed inset-0 z-50 flex ${y[x]}`,children:e(l.Popup,{className:oe,style:{...p(z,3),...ne,...M},...S,children:de})})]})]}):D??O??!0?e("div",{className:oe,style:{...p(z,0),...ne,...M},children:de}):null}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import*as n from"react";import{useRender as l}from"@base-ui/react/use-render";import{boxPaddingXClasses as a}from"../box/Box.js";import{transitionProps as o}from"../../internal/animate.js";import{emptyMessages as s,useMessages as i}from"../../internal/i18n.js";import{hasContent as m,iconClasses as c,radiusClasses as d,sheetBodyClasses as x,sheetHeaderGapClasses as p,sheetSectionGapClasses as f,sheetTitleClasses as u,surfaceClasses as h,surfaceSlots as v,transitionClasses as y}from"../../internal/styles.js";const b={default:{xs:"py-5",sm:"py-6",md:"py-8",lg:"py-10",xl:"py-12"},compact:{xs:"py-3",sm:"py-3.5",md:"py-4",lg:"py-5",xl:"py-6"}},g={xs:"text-[1.25rem]",sm:"text-[1.5rem]",md:"text-[1.75rem]",lg:"text-[2.125rem]",xl:"text-[2.5rem]"},j={solid:[h,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[h,"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 N(){return t("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e("path",{d:"M1.75 9.75h3l.9 1.6h4.7l.9-1.6h3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"m1.75 9.75 2.1-6a1.5 1.5 0 0 1 1.42-1h5.46a1.5 1.5 0 0 1 1.42 1l2.1 6v2a1.5 1.5 0 0 1-1.5 1.5h-9.5a1.5 1.5 0 0 1-1.5-1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})]})}export const Empty=/*@__PURE__*/n.forwardRef(function({variant:n="text",size:h="md",color:k="secondary",density:w="default",elevation:$=0,title:B,icon:L,action:C,locale:W,transition:z,render:E,className:F,style:M,children:R,...Z},q){const A=i(s,W),D=void 0===B?A.title:B,G=void 0===L?e(N,{}):L,H=o(z),I=m(D),J=["flex w-full flex-col items-center justify-center text-center",a[w][h],b[w][h],d[h],f[h],y,j[n],H.className,F??""].filter(Boolean).join(" ");return l({render:E,ref:q,props:{role:"status",className:J,style:{...v(k,$),...H.style,...M},children:t(r,{children:[m(G)?e("span",{className:`flex items-center text-(--neba-muted-fg) ${g[h]} ${c}`,children:G}):null,I||m(R)?t("div",{className:`flex max-w-prose flex-col items-center ${p[h]}`,children:[I?e("div",{className:`neba-title font-semibold ${u[h]}`,children:D}):null,m(R)?e("div",{className:`${x[h]} ${I?"text-(--neba-muted-fg)":""}`,children:R}):null]}):null,m(C)?e("div",{className:"flex flex-wrap items-center justify-center gap-2",children:C}):null]}),...Z}})});
|
|
1
|
+
"use client";import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import*as n from"react";import{useRender as l}from"@base-ui/react/use-render";import{boxPaddingXClasses as a}from"../box/Box.js";import{transitionProps as o}from"../../internal/animate.js";import{emptyMessages as s,useMessages as i}from"../../internal/i18n.js";import{hasContent as m,iconClasses as c,radiusClasses as d,sheetBodyClasses as x,sheetHeaderGapClasses as p,sheetSectionGapClasses as f,sheetTitleClasses as u,surfaceClasses as h,surfaceSlots as v,transitionClasses as y}from"../../internal/styles.js";const b={default:{xs:"py-5",sm:"py-6",md:"py-8",lg:"py-10",xl:"py-12"},compact:{xs:"py-3",sm:"py-3.5",md:"py-4",lg:"py-5",xl:"py-6"}},g={xs:"text-[1.25rem]",sm:"text-[1.5rem]",md:"text-[1.75rem]",lg:"text-[2.125rem]",xl:"text-[2.5rem]"},j={solid:[h,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[h,"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 N(){return t("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e("path",{d:"M1.75 9.75h3l.9 1.6h4.7l.9-1.6h3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"m1.75 9.75 2.1-6a1.5 1.5 0 0 1 1.42-1h5.46a1.5 1.5 0 0 1 1.42 1l2.1 6v2a1.5 1.5 0 0 1-1.5 1.5h-9.5a1.5 1.5 0 0 1-1.5-1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})]})}export const Empty=/*@__PURE__*/n.forwardRef(function({variant:n="text",size:h="md",color:k="secondary",density:w="default",elevation:$=0,title:B,icon:L,action:C,locale:W,transition:z,render:E,className:F,style:M,children:R,...Z},q){const A=i(s,W),D=void 0===B?A.title:B,G=void 0===L?e(N,{}):L,H=o(z),I=m(D),J=["flex w-full flex-col items-center justify-center text-center",a[w][h],b[w][h],d[h],f[h],y,j[n],H.className,F??""].filter(Boolean).join(" ");return l({render:E,ref:q,props:{role:"status",className:J,style:{...v(k,$),...H.style,...M},children:t(r,{children:[m(G)?e("span",{className:`flex items-center text-(--neba-muted-fg) ${g[h]} ${c}`,children:G}):null,I||m(R)?t("div",{className:`flex max-w-prose flex-col items-center ${p[h]}`,children:[I?e("div",{className:`neba-title font-semibold ${u[h]}`,children:D}):null,m(R)?e("div",{className:`${x[h]} ${I?"text-(--neba-muted-fg)":""}`,children:R}):null]}):null,m(C)?e("div",{className:"flex flex-wrap items-center justify-center gap-2",children:C}):null]}),...Z}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as n from"react";import{CloseIcon as t}from"../../internal/icons.js";import{controlTextLeadingClasses as
|
|
1
|
+
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as n from"react";import{CloseIcon as t}from"../../internal/icons.js";import{controlTextLeadingClasses as l,disabledClasses as a,gapClasses as o,hasContent as i,iconClasses as s,metaTextClasses as c,radiusClasses as d,readOnlyFilterClasses as u,sheetTitleClasses as f,stackGapClasses as p,surfaceClasses as m,surfaceSlots as h,transitionClasses as b}from"../../internal/styles.js";const v={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"}},x={solid:[m,"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:[m,"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)]"},g={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 y(){return r("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 r=["kB","MB","GB","TB"];let n=e/1e3,t=0;for(;n>=1e3&&t<r.length-1;)n/=1e3,t+=1;return`${n<10?n.toFixed(1):Math.round(n)} ${r[t]}`}function k(e,r){const n=e.name.toLowerCase(),t=e.type.toLowerCase();return r.split(",").map(e=>e.trim().toLowerCase()).filter(Boolean).some(e=>e.startsWith(".")?n.endsWith(e):e.endsWith("/*")?t.startsWith(`${e.slice(0,-1)}`):t===e)}export const FilePicker=/*@__PURE__*/n.forwardRef(function({variant:m="outline",size:N="md",color:j="primary",density:$="default",elevation:w=0,accept:z,multiple:C=!1,maxSize:_,maxFiles:L,value:B,defaultValue:D,onFilesChange:I,onReject:M,label:F,description:W,error:S,invalid:R,title:T,hint:V,icon:E,showList:O=!0,removeLabel:q=e=>`Remove ${e}`,fullWidth:A=!0,disabled:P=!1,readOnly:G=!1,required:H=!1,name:Y,id:J,className:K,style:Q,...U},X){const Z=n.useRef(null);n.useImperativeHandle(X,()=>Z.current);const[ee,re]=n.useState(()=>[...D??[]]),ne=n.useMemo(()=>B?[...B]:ee,[B,ee]),te=n.useRef(0),[le,ae]=n.useState(!1),oe=i(S),ie=R??oe,se=ie?"danger":j,ce=P||G,de=n.useId(),ue=n.useCallback(e=>{B||re(e),I?.(e)},[I,B]),fe=n.useCallback(e=>{const r=[],n=[],t=C?L??Number.POSITIVE_INFINITY:1,l=C?ne.length:0;for(const a of e)z&&!k(a,z)?n.push({file:a,reason:"type"}):void 0!==_&&a.size>_?n.push({file:a,reason:"size"}):l+r.length>=t?n.push({file:a,reason:"count"}):r.push(a);return{kept:r,rejections:n}},[z,ne.length,L,_,C]),pe=n.useCallback(e=>{const{kept:r,rejections:n}=fe(e);n.length>0&&M?.(n),r.length>0&&ue(C?[...ne,...r]:r)},[fe,ue,ne,C,M]),me=["flex w-full flex-col items-center justify-center text-center","cursor-pointer select-none",v[$][N],d[N],o[N],b,s,"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2",P?`${a[m]} border-2 border-dashed`:G?`${x[m]} ${u} cursor-default`:x[m],ce?"":g[m],le&&!ce?"bg-(--n-soft-press) [border-color:var(--n-ring)]":""].filter(Boolean).join(" ");return r("div",{className:["flex-col align-top",p[N],A?"flex w-full":"inline-flex",K??""].filter(Boolean).join(" "),style:{...h(se,w),...Q},...U,children:[i(F)?e("span",{className:[c[N],"font-medium",P?"text-(--neba-disabled-fg)":"text-(--neba-fg)"].join(" "),children:F}):null,r("div",{className:"flex w-full flex-col",onDragEnter:e=>{ce||(e.preventDefault(),te.current+=1,ae(!0))},onDragOver:e=>{ce||(e.preventDefault(),e.dataTransfer.dropEffect="copy")},onDragLeave:()=>{ce||(te.current=Math.max(0,te.current-1),0===te.current&&ae(!1))},onDrop:e=>{ce||(e.preventDefault(),te.current=0,ae(!1),pe(Array.from(e.dataTransfer.files)))},children:[r("button",{type:"button",id:J,disabled:P,"aria-describedby":i(W)||oe?de:void 0,"aria-invalid":ie||void 0,className:me,onClick:()=>{ce||Z.current&&(Z.current.value="",Z.current.click())},children:[void 0===E?e("span",{className:"flex items-center text-(--n-accent) [&_svg]:size-[1.8em]",children:e(y,{})}):i(E)?e("span",{className:"flex items-center text-(--n-accent) [&_svg]:size-[1.8em]",children:E}):null,e("span",{className:`font-medium ${f[N]}`,children:T??"Drop files here, or click to browse"}),i(V)?e("span",{className:`text-(--neba-muted-fg) ${c[N]}`,children:V}):null]}),e("input",{ref:Z,type:"file",name:Y,accept:z,multiple:C,required:H&&0===ne.length,disabled:ce,tabIndex:-1,"aria-hidden":"true",className:"absolute size-px overflow-hidden opacity-0 [clip-path:inset(50%)]",onChange:e=>pe(Array.from(e.target.files??[]))})]}),O&&ne.length>0?e("ul",{role:"list",className:`flex w-full flex-col ${p[N]} m-0 list-none p-0`,children:ne.map((n,a)=>r("li",{className:["flex w-full items-center gap-2 px-2 py-1.5",d.xs,l[N],"bg-(--n-soft) text-(--neba-fg)"].join(" "),children:[e("span",{className:"min-w-0 flex-1 truncate",children:n.name}),e("span",{className:`shrink-0 text-(--neba-muted-fg) tabular-nums ${c[N]}`,children:formatFileSize(n.size)}),ce?null:e("button",{type:"button","aria-label":q(n.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:()=>ue(ne.filter((e,r)=>r!==a)),children:e(t,{})})]},`${n.name}-${n.size}-${n.lastModified}-${a}`))}):null,i(W)&&!oe?e("span",{id:de,className:`${c[N]} text-(--neba-muted-fg)`,children:W}):null,oe?e("span",{id:de,className:`${c[N]} text-(--n-accent)`,children:S}):null]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{Button as n}from"../button/Button.js";import{CloseIcon as s,PlusIcon as a}from"../../internal/icons.js";import{cx as r,hasContent as i,metaTextClasses as l,radiusClasses as c,surfaceClasses as d}from"../../internal/styles.js";const f=/*@__PURE__*/o.createContext({variant:"solid",size:"md",color:"primary",density:"default",elevation:1,showLabels:!0,reversed:!0,close:()=>{}}),p={xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"lg"},m={static:"",absolute:"absolute z-30",sticky:"sticky z-30",fixed:"fixed z-40"},u={"top-start":"top-(--n-fab-offset) start-(--n-fab-offset)","top-end":"top-(--n-fab-offset) end-(--n-fab-offset)","bottom-start":"bottom-(--n-fab-offset) start-(--n-fab-offset)","bottom-end":"bottom-(--n-fab-offset) end-(--n-fab-offset)"},b=r("pointer-events-none max-w-40 truncate select-none","px-2 py-0.5 text-(--neba-fg) bg-(--n-panel)",d,c.xs,"[box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]");export const FloatingActionButton=/*@__PURE__*/o.forwardRef(function({variant:i="solid",size:l="lg",color:c="primary",density:d="default",elevation:b=2,icon:v,label:x,extended:y=!1,openIcon:h,position:g="fixed",corner:w="bottom-end",offset:z=16,direction:C,open:k,defaultOpen:L=!1,onOpenChange:N,openOnHover:j=!0,closeOnAction:E=!0,showLabels:P=!0,disabled:R=!1,className:A,style:I,children:O,onClick:B,onKeyDown:D,onPointerEnter:F,onPointerLeave:K,...T},W){const H=o.useId(),M=o.useRef(null),S=o.useRef(null),[$,q]=o.useState(L),G=void 0!==k,J=o.Children.toArray(O).length>0,Q=(G?k:$)&&J&&!R,U=o.useCallback(e=>{G||q(e),N?.(e)},[G,N]),V=o.useCallback(()=>U(!1),[U]);o.useEffect(()=>{if(!Q)return;const e=e=>{const t=S.current;t&&e.target instanceof Node&&!t.contains(e.target)&&V()};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[Q,V]);const X=C??(w.startsWith("bottom")?"top":"bottom"),Y=w.endsWith("end"),Z=o.useMemo(()=>({variant:i,size:p[l],color:c,density:d,elevation:b,showLabels:P,reversed:Y,close:E?V:()=>{}}),[i,l,c,d,b,P,Y,E,V]),_=Q&&!1!==h?h??e(s,{}):v??e(a,{});return t("div",{ref:e=>{S.current=e,"function"==typeof W?W(e):W&&(W.current=e)},className:r("flex w-fit","top"===X?"flex-col-reverse":"flex-col",Y?"items-end":"items-start","xs"===l||"sm"===l?"gap-1.5":"gap-2",m[g],"static"===g?"":u[w],A),style:{"--n-fab-offset":"number"==typeof z?`${z}px`:z,...I},onKeyDown:e=>{"Escape"===e.key&&Q&&(e.stopPropagation(),V(),M.current?.focus()),D?.(e)},onPointerEnter:e=>{j&&J&&!R&&"mouse"===e.pointerType&&U(!0),F?.(e)},onPointerLeave:e=>{j&&"mouse"===e.pointerType&&V(),K?.(e)},...T,children:[e(n,{ref:M,variant:i,size:l,color:c,density:d,elevation:b,disabled:R,"aria-label":x,"aria-expanded":J?Q:void 0,"aria-controls":J&&Q?H:void 0,startIcon:_,style:{borderRadius:"9999px"},onClick:e=>{J&&U(!Q),B?.(e)},children:y?x:void 0}),Q?e("div",{id:H,className:r("flex","top"===X?"flex-col-reverse":"flex-col",Y?"items-end":"items-start","xs"===l||"sm"===l?"gap-1.5":"gap-2"),children:e(f.Provider,{value:Z,children:O})}):null]})});export const FloatingAction=/*@__PURE__*/o.forwardRef(function({icon:s,label:a,disabled:c=!1,className:d,onClick:p,...m},u){const v=o.useContext(f);return t("div",{className:r("flex items-center gap-2",v.reversed?"flex-row-reverse":"flex-row",d),children:[e(n,{ref:u,variant:v.variant,size:v.size,color:v.color,density:v.density,elevation:v.elevation,disabled:c,"aria-label":a,startIcon:s,style:{borderRadius:"9999px"},onClick:e=>{p?.(e),v.close()},...m}),v.showLabels&&i(a)?e("span",{"aria-hidden":"true",className:r(b,l[v.size]),children:a}):null]})});
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{Button as n}from"../button/Button.js";import{CloseIcon as s,PlusIcon as a}from"../../internal/icons.js";import{cx as r,hasContent as i,metaTextClasses as l,radiusClasses as c,surfaceClasses as d}from"../../internal/styles.js";const f=/*@__PURE__*/o.createContext({variant:"solid",size:"md",color:"primary",density:"default",elevation:1,showLabels:!0,reversed:!0,close:()=>{}}),p={xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"lg"},m={static:"",absolute:"absolute z-30",sticky:"sticky z-30",fixed:"fixed z-40"},u={"top-start":"top-(--n-fab-offset) start-(--n-fab-offset)","top-end":"top-(--n-fab-offset) end-(--n-fab-offset)","bottom-start":"bottom-(--n-fab-offset) start-(--n-fab-offset)","bottom-end":"bottom-(--n-fab-offset) end-(--n-fab-offset)"},b=r("pointer-events-none max-w-40 truncate select-none","px-2 py-0.5 text-(--neba-fg) bg-(--n-panel)",d,c.xs,"[box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]");export const FloatingActionButton=/*@__PURE__*/o.forwardRef(function({variant:i="solid",size:l="lg",color:c="primary",density:d="default",elevation:b=2,icon:v,label:x,extended:y=!1,openIcon:h,position:g="fixed",corner:w="bottom-end",offset:z=16,direction:C,open:k,defaultOpen:L=!1,onOpenChange:N,openOnHover:j=!0,closeOnAction:E=!0,showLabels:P=!0,disabled:R=!1,className:A,style:I,children:O,onClick:B,onKeyDown:D,onPointerEnter:F,onPointerLeave:K,...T},W){const H=o.useId(),M=o.useRef(null),S=o.useRef(null),[$,q]=o.useState(L),G=void 0!==k,J=o.Children.toArray(O).length>0,Q=(G?k:$)&&J&&!R,U=o.useCallback(e=>{G||q(e),N?.(e)},[G,N]),V=o.useCallback(()=>U(!1),[U]);o.useEffect(()=>{if(!Q)return;const e=e=>{const t=S.current;t&&e.target instanceof Node&&!t.contains(e.target)&&V()};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[Q,V]);const X=C??(w.startsWith("bottom")?"top":"bottom"),Y=w.endsWith("end"),Z=o.useMemo(()=>({variant:i,size:p[l],color:c,density:d,elevation:b,showLabels:P,reversed:Y,close:E?V:()=>{}}),[i,l,c,d,b,P,Y,E,V]),_=Q&&!1!==h?h??e(s,{}):v??e(a,{});return t("div",{ref:e=>{S.current=e,"function"==typeof W?W(e):W&&(W.current=e)},className:r("flex w-fit","top"===X?"flex-col-reverse":"flex-col",Y?"items-end":"items-start","xs"===l||"sm"===l?"gap-1.5":"gap-2",m[g],"static"===g?"":u[w],A),style:{"--n-fab-offset":"number"==typeof z?`${z}px`:z,...I},onKeyDown:e=>{"Escape"===e.key&&Q&&(e.stopPropagation(),V(),M.current?.focus()),D?.(e)},onPointerEnter:e=>{j&&J&&!R&&"mouse"===e.pointerType&&U(!0),F?.(e)},onPointerLeave:e=>{j&&"mouse"===e.pointerType&&V(),K?.(e)},...T,children:[e(n,{ref:M,variant:i,size:l,color:c,density:d,elevation:b,disabled:R,"aria-label":x,"aria-expanded":J?Q:void 0,"aria-controls":J&&Q?H:void 0,startIcon:_,style:{borderRadius:"9999px"},onClick:e=>{J&&U(!Q),B?.(e)},children:y?x:void 0}),Q?e("div",{id:H,className:r("flex","top"===X?"flex-col-reverse":"flex-col",Y?"items-end":"items-start","xs"===l||"sm"===l?"gap-1.5":"gap-2"),children:e(f.Provider,{value:Z,children:O})}):null]})});export const FloatingAction=/*@__PURE__*/o.forwardRef(function({icon:s,label:a,disabled:c=!1,className:d,onClick:p,...m},u){const v=o.useContext(f);return t("div",{className:r("flex items-center gap-2",v.reversed?"flex-row-reverse":"flex-row",d),children:[e(n,{ref:u,variant:v.variant,size:v.size,color:v.color,density:v.density,elevation:v.elevation,disabled:c,"aria-label":a,startIcon:s,style:{borderRadius:"9999px"},onClick:e=>{p?.(e),v.close()},...m}),v.showLabels&&i(a)?e("span",{"aria-hidden":"true",className:r(b,l[v.size]),children:a}):null]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
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 r,BottomNavigationContext as o}from"../../internal/bottom-navigation.js";import{cx as s,surfaceClasses as l,surfaceSlots as i,transitionClasses as f}from"../../internal/styles.js";const u={solid:[l,"text-(--neba-fg) bg-(--n-panel-press)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[l,"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"},d={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"},p={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:`${l} bg-(--n-panel-hover) [box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]`,outline:`${l} bg-(--n-soft-hover) [box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]`,text:"bg-(--n-soft-hover)"},b={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:l="outline",size:v="md",color:m="primary",density:x="default",elevation:g=2,value:y,defaultValue:h=null,onValueChange:w,position:$="fixed",offset:j=16,labels:z="selected",safeArea:k=!0,disabled:P=!1,label:A,render:C,className:N,style:R,children:E,...L},S){const[V,W]=a.useState(h),q=void 0!==y,B=q?y:V,F=a.useCallback(e=>{q||W(e),w?.(e)},[q,w]),H=a.useMemo(()=>({value:B??null,change:F,size:v,density:x,labels:z,disabled:P,floating:!0}),[B,F,v,x,z,P]),M=a.useRef(null),O=a.useRef(null),T=a.useCallback(e=>{M.current=e,"function"==typeof S?S(e):S&&(S.current=e)},[S]),D=a.useCallback(e=>{const t=M.current,a=O.current;if(!t||!a)return;const n=t.querySelector("[data-nav-item][aria-current]");if(!n)return;const r=!e||!a.hasAttribute("data-ready");r&&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`),r&&a.offsetWidth,a.setAttribute("data-ready","")},[]);a.useLayoutEffect(()=>{D(!0)},[D,B,l,v,x,z,E]),a.useEffect(()=>{const e=M.current;if(!e)return;const t=new ResizeObserver(()=>D(!1));return t.observe(e),()=>t.disconnect()},[D]);const G="number"==typeof j?`${j}px`:j,I=s("flex max-w-full min-w-0 items-center rounded-full",r[v],p[x][v],b[v],u[l],d[$],f,N);return n({render:C??e("nav",{}),ref:T,props:{"aria-label":A,className:I,style:{...i(m,g),"--n-nav-offset":k?`calc(${G} + env(safe-area-inset-bottom))`:G,...R},children:t(o.Provider,{value:H,children:[null!=B?e("span",{ref:O,"aria-hidden":"true",className:s("pointer-events-none absolute rounded-full","top-(--n-nav-y) left-(--n-nav-x) h-(--n-nav-h) w-(--n-nav-w)",c[l],"[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,E]}),...L}})});
|
|
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 r,BottomNavigationContext as o}from"../../internal/bottom-navigation.js";import{cx as s,surfaceClasses as l,surfaceSlots as i,transitionClasses as f}from"../../internal/styles.js";const u={solid:[l,"text-(--neba-fg) bg-(--n-panel-press)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[l,"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"},d={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"},p={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:`${l} bg-(--n-panel-hover) [box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]`,outline:`${l} bg-(--n-soft-hover) [box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]`,text:"bg-(--n-soft-hover)"},b={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:l="outline",size:v="md",color:m="primary",density:x="default",elevation:g=2,value:y,defaultValue:h=null,onValueChange:w,position:$="fixed",offset:j=16,labels:z="selected",safeArea:k=!0,disabled:P=!1,label:A,render:C,className:N,style:R,children:E,...L},S){const[V,W]=a.useState(h),q=void 0!==y,B=q?y:V,F=a.useCallback(e=>{q||W(e),w?.(e)},[q,w]),H=a.useMemo(()=>({value:B??null,change:F,size:v,density:x,labels:z,disabled:P,floating:!0}),[B,F,v,x,z,P]),M=a.useRef(null),O=a.useRef(null),T=a.useCallback(e=>{M.current=e,"function"==typeof S?S(e):S&&(S.current=e)},[S]),D=a.useCallback(e=>{const t=M.current,a=O.current;if(!t||!a)return;const n=t.querySelector("[data-nav-item][aria-current]");if(!n)return;const r=!e||!a.hasAttribute("data-ready");r&&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`),r&&a.offsetWidth,a.setAttribute("data-ready","")},[]);a.useLayoutEffect(()=>{D(!0)},[D,B,l,v,x,z,E]),a.useEffect(()=>{const e=M.current;if(!e)return;const t=new ResizeObserver(()=>D(!1));return t.observe(e),()=>t.disconnect()},[D]);const G="number"==typeof j?`${j}px`:j,I=s("flex max-w-full min-w-0 items-center rounded-full",r[v],p[x][v],b[v],u[l],d[$],f,N);return n({render:C??e("nav",{}),ref:T,props:{"aria-label":A,className:I,style:{...i(m,g),"--n-nav-offset":k?`calc(${G} + env(safe-area-inset-bottom))`:G,...R},children:t(o.Provider,{value:H,children:[null!=B?e("span",{ref:O,"aria-hidden":"true",className:s("pointer-events-none absolute rounded-full","top-(--n-nav-y) left-(--n-nav-x) h-(--n-nav-h) w-(--n-nav-w)",c[l],"[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,E]}),...L}})});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { NebaColor, NebaDensity, NebaElevation, NebaPosition, NebaSize, NebaVariant } from '../../types.js';
|
|
4
|
+
export interface FooterProps extends Omit<React.ComponentPropsWithoutRef<'footer'>, 'color' | 'title'> {
|
|
5
|
+
/**
|
|
6
|
+
* How the bar sits in the page's scroll. `static` — the default, and the
|
|
7
|
+
* opposite of [Header]'s — is what a footer is: the thing at the end of the
|
|
8
|
+
* document, reached by scrolling to it. `sticky` and `fixed` are for the bar
|
|
9
|
+
* that has to stay in reach — a form's save row, a cookie notice — and a
|
|
10
|
+
* [PageLayout] reserves the height a `fixed` one takes out of the flow.
|
|
11
|
+
* @default 'static'
|
|
12
|
+
*/
|
|
13
|
+
position?: NebaPosition;
|
|
14
|
+
/**
|
|
15
|
+
* Weight of the sheet, said the way a *container* says it: the bar is never
|
|
16
|
+
* dyed, because what is on it arrives with colours of its own.
|
|
17
|
+
* @default 'outline'
|
|
18
|
+
*/
|
|
19
|
+
variant?: NebaVariant;
|
|
20
|
+
/**
|
|
21
|
+
* The bar's scale — its gutter and the air above and below its content. As on
|
|
22
|
+
* Box, `size` here is the size of the *sheet*.
|
|
23
|
+
* @default 'md'
|
|
24
|
+
*/
|
|
25
|
+
size?: NebaSize;
|
|
26
|
+
/** @default 'primary' */
|
|
27
|
+
color?: NebaColor;
|
|
28
|
+
/** @default 'default' */
|
|
29
|
+
density?: NebaDensity;
|
|
30
|
+
/** Drop shadow depth. `0` (the default) is flat. @default 0 */
|
|
31
|
+
elevation?: NebaElevation;
|
|
32
|
+
/**
|
|
33
|
+
* Draws a hairline along the top edge. On by default: a footer is the one
|
|
34
|
+
* sheet on the page with content directly above it and nothing below, so the
|
|
35
|
+
* line is the whole of what says the document ended.
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
divider?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Holds the content to a measure and centres it, while the sheet itself still
|
|
41
|
+
* spans the window. On the same ladder Container's own `maxWidth` uses.
|
|
42
|
+
* @default 'none'
|
|
43
|
+
*/
|
|
44
|
+
maxWidth?: NebaSize | 'none';
|
|
45
|
+
/** The gutter and the air above and below. @default true */
|
|
46
|
+
padded?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* The name the bar is announced by. Worth writing when a page has more than
|
|
49
|
+
* one `<footer>` in it — an article's own and the site's.
|
|
50
|
+
*/
|
|
51
|
+
label?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Renders something other than a `<footer>`. Base UI's own escape hatch, and
|
|
54
|
+
* rarely what you want: at the top level of a document that tag is the
|
|
55
|
+
* `contentinfo` landmark, and it is what says "this is the site's own
|
|
56
|
+
* information" rather than "this is more of the article".
|
|
57
|
+
*/
|
|
58
|
+
render?: useRender.RenderProp;
|
|
59
|
+
/**
|
|
60
|
+
* Everything in it. A footer's content is columns of links, a copyright line,
|
|
61
|
+
* a logo — all of it the caller's, none of it something a component could
|
|
62
|
+
* guess at, which is why this one has slots for nothing and space for
|
|
63
|
+
* anything.
|
|
64
|
+
*/
|
|
65
|
+
children?: React.ReactNode;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The sheet at the end of a page.
|
|
69
|
+
*
|
|
70
|
+
* A real `<footer>`, which is the whole reason it is a component rather than a
|
|
71
|
+
* div: at the top level of a document that tag is the `contentinfo` landmark —
|
|
72
|
+
* the region a screen reader offers as "the site's own information" and a
|
|
73
|
+
* search engine reads the copyright, the address and the site map out of.
|
|
74
|
+
*
|
|
75
|
+
* It has no slots on purpose, which is the difference between it and [Header].
|
|
76
|
+
* A header's three regions are a fixed arrangement worth writing once; a
|
|
77
|
+
* footer's content is four columns on one site, one line on the next, and a
|
|
78
|
+
* component that guessed at the arrangement would be a component every second
|
|
79
|
+
* site fights. What it decides is the sheet: the surface, the gutter, the
|
|
80
|
+
* hairline that says the document ended, and whether it stays in reach.
|
|
81
|
+
*
|
|
82
|
+
* Inside a [PageLayout] it also registers itself, so a `fixed` footer's height
|
|
83
|
+
* is reserved rather than sitting on top of the last paragraph.
|
|
84
|
+
*/
|
|
85
|
+
export declare const Footer: React.ForwardRefExoticComponent<FooterProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import*as r from"react";import{useRender as t}from"@base-ui/react/use-render";import{boxPaddingXClasses as a,boxPaddingYClasses as o}from"../box/Box.js";import{PageLayoutContext as n}from"../../internal/page-layout.js";import{cx as s,surfaceClasses as i,surfaceSlots as l,transitionClasses as m}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,"text-(--neba-fg) bg-(--n-panel)","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--neba-fg) bg-transparent"},x={static:"",sticky:"sticky bottom-0 z-30",fixed:"fixed inset-x-0 bottom-0 z-40"},c={xs:"max-w-[30rem]",sm:"max-w-[40rem]",md:"max-w-[48rem]",lg:"max-w-[64rem]",xl:"max-w-[80rem]"};export const Footer=/*@__PURE__*/r.forwardRef(function({position:i="static",variant:f="outline",size:p="md",color:b="primary",density:u="default",elevation:v=0,divider:w=!0,maxWidth:g="none",padded:y=!0,label:j,render:h,className:k,style:z,children:N,...C},B){const F=r.useContext(n),{register:R}=F,W=r.useCallback(e=>{R("footer",e),"function"==typeof B?B(e):B&&(B.current=e)},[R,B]),q=s("w-full min-w-0",d[f],w?"border-t [border-color:var(--n-line)]":"",x[i],m,k);return t({render:h??e("footer",{}),ref:W,props:{"aria-label":j,className:q,style:{...l(b,v),...z},children:e("div",{className:s("w-full",y?s(a[u][p],o[u][p]):"","none"===g?"":s(c[g],"mx-auto")),children:N}),...C}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{Footer}from"./Footer.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{alignSelfClasses as n,offsetValue as
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{alignSelfClasses as n,offsetValue as s,responsiveSlots as t,spanValue as o}from"../../internal/grid.js";export const Grid=/*@__PURE__*/e.forwardRef(function({span:e,offset:i,alignSelf:a,render:f,className:l,style:c,children:d,...m},p){const u=["neba-grid-item",a?n[a]:"",l??""].filter(Boolean).join(" ");return r({render:f,ref:p,props:{className:u,style:{...t("span",e,o),...t("offset",i,s),...c},children:d,...m}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{alignContentClasses as n,alignItemsClasses as a,columnCount as o,justifyContentClasses as t,responsiveSlots as i,spacingValue as s,withBaseline as p}from"../../internal/grid.js";import{boxPaddingClasses as l}from"../box/Box.js";export const GridContainer=/*@__PURE__*/e.forwardRef(function({columns:e,spacing:c,rowSpacing:d,columnSpacing:f,justifyContent:m,alignItems:g,alignContent:
|
|
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 o,justifyContentClasses as t,responsiveSlots as i,spacingValue as s,withBaseline as p}from"../../internal/grid.js";import{boxPaddingClasses as l}from"../box/Box.js";export const GridContainer=/*@__PURE__*/e.forwardRef(function({columns:e,spacing:c,rowSpacing:d,columnSpacing:f,justifyContent:m,alignItems:g,alignContent:u,wrap:x=!0,padded:y=!0,size:w="md",density:j="default",render:b,className:C,style:h,children:B,...N},S){const z=["neba-grid flex",x?"flex-wrap":"flex-nowrap","gap-x-(--n-gap-x) gap-y-(--n-gap-y)",y?l[j][w]:"",m?t[m]:"",g?a[g]:"",u?n[u]:"",C??""].filter(Boolean).join(" ");return r({render:b,ref:S,props:{className:z,style:{...i("cols",p(e,12),o),...i("gap-x",p(f??c,2),s),...i("gap-y",p(d??c,2),s),...h},children:B,...N}})});
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { NebaAlign, NebaColor, NebaDensity, NebaElevation, NebaPosition, NebaSize, NebaVariant } from '../../types.js';
|
|
4
|
+
export interface HeaderProps extends Omit<React.ComponentPropsWithoutRef<'header'>, 'color' | 'title'> {
|
|
5
|
+
/**
|
|
6
|
+
* The leading slot: the logo, the product's name, the thing that is the same
|
|
7
|
+
* on every page. An [AppLogo] is what usually goes here.
|
|
8
|
+
*
|
|
9
|
+
* It is a slot rather than the first of `children` because the three regions
|
|
10
|
+
* of a bar are laid out against each other — the middle can only be centred
|
|
11
|
+
* in the bar if the two ends are measured — and a caller writing three
|
|
12
|
+
* wrappers by hand is a caller whose header drifts from the next one.
|
|
13
|
+
*/
|
|
14
|
+
brand?: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* The trailing slot: the account menu, the theme switch, the call to action.
|
|
17
|
+
* Laid out end-aligned, so a row of buttons needs no wrapper of its own.
|
|
18
|
+
*/
|
|
19
|
+
actions?: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Where the middle slot sits.
|
|
22
|
+
*
|
|
23
|
+
* - `start` — packed against the brand, taking whatever is left. The
|
|
24
|
+
* arrangement of an application's toolbar, and the default.
|
|
25
|
+
* - `center` — centred in the bar itself, not in the space left over. The two
|
|
26
|
+
* ends are given equal shares for this, so the middle stays on the bar's
|
|
27
|
+
* own midline however wide the brand is.
|
|
28
|
+
* - `end` — packed against the actions.
|
|
29
|
+
* @default 'start'
|
|
30
|
+
*/
|
|
31
|
+
align?: NebaAlign;
|
|
32
|
+
/**
|
|
33
|
+
* How the bar sits in the page's scroll, spelled the way CSS spells it.
|
|
34
|
+
* `sticky` — the default — holds it against the top of the window once the
|
|
35
|
+
* page has scrolled to it, while leaving it in the flow so nothing has to be
|
|
36
|
+
* padded out of its way. `fixed` takes it out of the flow entirely, which a
|
|
37
|
+
* [PageLayout] answers by reserving its height. `static` lets it scroll away.
|
|
38
|
+
* @default 'sticky'
|
|
39
|
+
*/
|
|
40
|
+
position?: NebaPosition;
|
|
41
|
+
/**
|
|
42
|
+
* Weight of the sheet, said the way a *container* says it: the bar is never
|
|
43
|
+
* dyed, because what is on it arrives with colours of its own.
|
|
44
|
+
* @default 'outline'
|
|
45
|
+
*/
|
|
46
|
+
variant?: NebaVariant;
|
|
47
|
+
/**
|
|
48
|
+
* The bar's scale — its height floor, its gutter and the air around its
|
|
49
|
+
* slots. As on Box, `size` here is the size of the *sheet*.
|
|
50
|
+
* @default 'md'
|
|
51
|
+
*/
|
|
52
|
+
size?: NebaSize;
|
|
53
|
+
/** @default 'primary' */
|
|
54
|
+
color?: NebaColor;
|
|
55
|
+
/** @default 'default' */
|
|
56
|
+
density?: NebaDensity;
|
|
57
|
+
/**
|
|
58
|
+
* Drop shadow depth. `0` (the default) is flat: a header is attached to the
|
|
59
|
+
* top of the window rather than floating over the middle of it, and `divider`
|
|
60
|
+
* is what separates it from the content.
|
|
61
|
+
* @default 0
|
|
62
|
+
*/
|
|
63
|
+
elevation?: NebaElevation;
|
|
64
|
+
/**
|
|
65
|
+
* Draws a hairline along the bottom edge, against the content the bar is
|
|
66
|
+
* over. On by default, for BottomNavigation's reason: a bar pinned over a
|
|
67
|
+
* scrolling page has content passing underneath it at every moment, and a
|
|
68
|
+
* translucent sheet with nothing marking its edge reads as part of that.
|
|
69
|
+
* @default true
|
|
70
|
+
*/
|
|
71
|
+
divider?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Holds the row of slots to a measure and centres it, while the sheet itself
|
|
74
|
+
* still spans the window. On the same ladder Container's own `maxWidth` uses,
|
|
75
|
+
* so a header and the [Container] under it line up on the same edge.
|
|
76
|
+
* @default 'none'
|
|
77
|
+
*/
|
|
78
|
+
maxWidth?: NebaSize | 'none';
|
|
79
|
+
/** The gutter down each side of the row. @default true */
|
|
80
|
+
padded?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* The name the bar is announced by. Worth writing when a page has more than
|
|
83
|
+
* one `<header>` in it — an article's own header and the site's — because
|
|
84
|
+
* "banner" twice tells a reader which is which not at all.
|
|
85
|
+
*/
|
|
86
|
+
label?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Renders something other than a `<header>`. Base UI's own escape hatch, and
|
|
89
|
+
* rarely what you want: the bar at the top of a page is a banner, and the tag
|
|
90
|
+
* is what says so to a search engine and to a screen reader's landmark list.
|
|
91
|
+
*/
|
|
92
|
+
render?: useRender.RenderProp;
|
|
93
|
+
/** The middle slot. */
|
|
94
|
+
children?: React.ReactNode;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The bar across the top of a page.
|
|
98
|
+
*
|
|
99
|
+
* A real `<header>`, which is the whole reason it is a component rather than a
|
|
100
|
+
* row of divs: at the top level of a document that tag is the `banner`
|
|
101
|
+
* landmark, and it is what a screen reader's landmark list, a reader mode and a
|
|
102
|
+
* search engine's understanding of the page are all built out of.
|
|
103
|
+
*
|
|
104
|
+
* Its three slots are props rather than compound sub-components, for Card's and
|
|
105
|
+
* Dialog's reason: the arrangement is fixed — brand, middle, actions — and what
|
|
106
|
+
* a caller wants to decide is what goes in each. That the middle can be centred
|
|
107
|
+
* on the bar's own midline is only possible because the ends are the
|
|
108
|
+
* component's to measure.
|
|
109
|
+
*
|
|
110
|
+
* Inside a [PageLayout] it also registers itself, so a sidebar that holds its
|
|
111
|
+
* place knows how far down the window to start. Outside one it is simply a bar,
|
|
112
|
+
* and everything above still works.
|
|
113
|
+
*/
|
|
114
|
+
export declare const Header: React.ForwardRefExoticComponent<HeaderProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as r from"react";import{useRender as n}from"@base-ui/react/use-render";import{boxPaddingXClasses as t}from"../box/Box.js";import{PageLayoutContext as s}from"../../internal/page-layout.js";import{cx as i,hasContent as l,surfaceClasses as m,surfaceSlots as o,transitionClasses as d}from"../../internal/styles.js";const c={xs:"min-h-10",sm:"min-h-12",md:"min-h-14",lg:"min-h-16",xl:"min-h-20"},x={xs:"gap-1.5",sm:"gap-2",md:"gap-3",lg:"gap-4",xl:"gap-5"},f={xs:"gap-3",sm:"gap-4",md:"gap-6",lg:"gap-8",xl:"gap-10"},p={xs:"max-w-[30rem]",sm:"max-w-[40rem]",md:"max-w-[48rem]",lg:"max-w-[64rem]",xl:"max-w-[80rem]"},u={solid:[m,"text-(--neba-fg) bg-(--n-panel-press)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[m,"text-(--neba-fg) bg-(--n-panel)","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--neba-fg) bg-transparent"},g={static:"",sticky:"sticky top-0 z-30",fixed:"fixed inset-x-0 top-0 z-40"},h={start:"shrink-0",center:"flex-1 basis-0",end:"shrink-0"},b={start:"flex min-w-0 flex-1 items-center justify-start",center:"flex min-w-0 shrink items-center justify-center",end:"flex min-w-0 flex-1 items-center justify-end"};export const Header=/*@__PURE__*/r.forwardRef(function({brand:m,actions:v,align:w="start",position:y="sticky",variant:j="outline",size:N="md",color:k="primary",density:z="default",elevation:C=0,divider:B=!0,maxWidth:H="none",padded:R=!0,label:W,render:q,className:A,style:D,children:E,...F},G){const I=r.useContext(s),{register:J}=I,K=r.useCallback(e=>{J("header",e),"function"==typeof G?G(e):G&&(G.current=e)},[J,G]),L=i("w-full min-w-0",u[j],B?"border-b [border-color:var(--n-line)]":"",g[y],d,A);return n({render:q??e("header",{}),ref:K,props:{"aria-label":W,className:L,style:{...o(k,C),...D},children:a("div",{className:i("flex w-full items-center",c[N],f[N],R?t[z][N]:"","none"===H?"":i(p[H],"mx-auto")),children:[l(m)?e("div",{className:i("flex min-w-0 items-center",h[w],x[N]),children:m}):"center"===w?e("div",{"aria-hidden":"true",className:h[w]}):null,l(E)?e("div",{className:i(b[w],x[N]),children:E}):null,l(v)?e("div",{className:i("flex min-w-0 items-center justify-end",h[w],x[N]),children:v}):"center"===w?e("div",{"aria-hidden":"true",className:h[w]}):null]}),...F}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{Header}from"./Header.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as l from"react";import{ChartScaleLegend as n,ChartSurface as i,ChartTooltipPanel as a,useMeasuredWidth as r}from"../../internal/chart-frame.js";import{categoryAt as o,chartFontSizes as d,compactNumber as h,formatCategory as s,markGap as c,plotHeights as m,rampFill as u,rampInk as x,rampStep as f,rampSteps as g,squarify as p,textWidth as v,toValues as w,truncate as b}from"../../internal/chart.js";import{numberFormatter as y}from"../../internal/format.js";import{cx as M,metaTextClasses as j,srOnlyClasses as k}from"../../internal/styles.js";import{emptyMessages as A,useMessages as N}from"../../internal/i18n.js";export function HeatmapChart({series:z,categories:E,shape:S="grid",scale:B="sequential",midpoint:C=0,min:I,max:_,valueLabels:D="none",height:L,format:P,locale:R,label:q,legend:H,tooltip:K,empty:U,size:W="md",variant:F="text",padded:G=!1,className:J,...O}){const Q=l.useRef(null),T=r(Q),V=N(A,R),X=l.useId(),[Y,Z]=l.useState(null),ee=l.useCallback(e=>P?y(R,P).format(e):h(e,R),[P,R]),te=l.useMemo(()=>w(z),[z]),le=te.reduce((e,t)=>Math.max(e,t.length),0),ne=l.useMemo(()=>Array.from({length:le},(e,t)=>o(t,E,te)),[le,E,te]),ie=l.useMemo(()=>z.map((e,t)=>e.name??`${t+1}`),[z]),ae=l.useMemo(()=>{let e=1/0,t=-1/0,l=!1;for(const n of te)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},[te]),re=I??ae?.min??0,oe=_??ae?.max??1,de=l.useCallback(e=>f(e,re,oe,B,C),[re,oe,B,C]),he="number"==typeof L?L:m[W]??220,se=d[W],ce=!0===H||void 0===H||!1===H?{}:H,me=!1!==H,ue=ce.side??"bottom",xe=!1===K?{mode:"none"}:!0===K||void 0===K?{}:K,fe="none"===xe.mode,ge=null===ae||0===le||0===z.length,pe=l.useMemo(()=>{if("treemap"===S||T<=0)return{texts:[],band:0};const e=Math.min(150,.25*T),t=ie.map(t=>b(t,e,se));return{texts:t,band:t.reduce((e,t)=>Math.max(e,v(t,se)),0)+10}},[S,ie,T,se]),ve="treemap"===S?0:se+8,we={left:pe.band,width:Math.max(0,T-pe.band),height:Math.max(0,he-ve)},be=l.useMemo(()=>{if(we.width<=0||we.height<=0)return[];if("treemap"===S){const e=[];return te.forEach((t,l)=>t.forEach((t,n)=>{null!==t.value&&e.push({row:l,index:n,cell:t})})),p(e.map(e=>Math.max(0,e.cell.value??0)),we.width,we.height).map(t=>({row:e[t.index].row,index:e[t.index].index,cell:e[t.index].cell,x:we.left+t.x,y:t.y,width:t.width,height:t.height}))}const e=we.height/Math.max(1,z.length),t=we.width/Math.max(1,le),l=[];return te.forEach((n,i)=>n.forEach((n,a)=>{null!==n.value&&l.push({row:i,index:a,cell:n,x:we.left+a*t,y:i*e,width:t,height:e})})),l},[S,te,z.length,le,we.left,we.width,we.height]),ye=l.useCallback(e=>s(e.cell.x??E?.[e.index]??ne[e.index]??e.index,R),[E,ne,R]),Me=null===Y?null:be.find(e=>e.row===Y.row&&e.index===Y.index)??null,je=null===Me?[]:[{seriesIndex:Me.row,color:Me.cell.color??u(de(Me.cell.value??0),B),value:Me.cell.value,formatted:ee(Me.cell.value??0),label:Me.cell.label}],ke=Array.from({length:g},(e,t)=>u(t,B));return e(i,{...O,size:W,variant:F,padded:G,className:J,legendSide:ue,legend:me&&!ge?e(n,{steps:ke,from:ee("diverging"===B?-$(re,oe,C)+C:re),to:ee("diverging"===B?$(re,oe,C)+C:oe),middle:"diverging"===B?ee(C):void 0,align:ce.align??"center",vertical:"left"===ue||"right"===ue,size:W}):null,table:ge?null:t("table",{id:X,className:k,children:[q?e("caption",{children:q}):null,e("thead",{children:t("tr",{children:[e("th",{scope:"col"}),ne.map((t,l)=>e("th",{scope:"col",children:s(t,R)},l))]})}),e("tbody",{children:te.map((l,n)=>t("tr",{children:[e("th",{scope:"row",children:ie[n]}),ne.map((t,n)=>{const i=l[n];return e("td",{children:void 0!==i?.label?i.label:null==i?.value?"":ee(i.value)},n)})]},n))})]}),children:t("div",{ref:Q,role:"img",tabIndex:ge?void 0:0,"aria-label":q,"aria-describedby":ge?void 0:X,onPointerLeave:()=>Z(null),onBlur:()=>Z(null),onKeyDown:e=>{if(fe||0===be.length)return;const t=null===Y?-1:be.findIndex(e=>e.row===Y.row&&e.index===Y.index);if("ArrowRight"===e.key||"ArrowDown"===e.key){const e=be[Math.min(be.length-1,t+1)];Z({row:e.row,index:e.index})}else if("ArrowLeft"===e.key||"ArrowUp"===e.key){const e=be[Math.max(0,(-1===t?be.length:t)-1)];Z({row:e.row,index:e.index})}else{if("Escape"!==e.key)return;Z(null)}e.preventDefault()},className:M("relative w-full rounded-(--neba-radius-xs)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"),style:{height:he},children:[ge?e("div",{className:M("flex h-full items-center justify-center text-(--neba-muted-fg)",j[W]),children:U??V.title}):T>0?t("svg",{width:T,height:he,viewBox:`0 0 ${T} ${he}`,"aria-hidden":"true",className:"block",children:[be.map(l=>{const n=de(l.cell.value??0),i=Y?.row===l.row&&Y?.index===l.index,a=Math.max(0,l.width-c),r=Math.max(0,l.height-c);if(a<=0||r<=0)return null;const o=ee(l.cell.value??0),d="treemap"===S?"all"===D?[ye(l),o]:[ye(l)]:"all"===D?[o]:[],h=d.filter(e=>function(e,t,l,n){return l>=1.8*n&&t>=Math.min(v(e,n),2.5*n)+8}(e,a,r/d.length,se)),s=l.cell.color?"var(--neba-surface)":x(n,B);return t("g",{children:[e("rect",{x:l.x+c/2,y:l.y+c/2,width:a,height:r,rx:Math.min(3,a/2,r/2),fill:l.cell.color??u(n,B),opacity:i?1:.94,onPointerEnter:fe?void 0:()=>Z({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)*(se+2),textAnchor:"middle",dominantBaseline:"central",fontSize:se,fontWeight:0===n?500:400,fill:s,opacity:0===n?1:.85,pointerEvents:"none",className:0===n&&"treemap"===S?void 0:"tabular-nums",children:b(t,l.width-8,se)},n))]},`${l.row}-${l.index}`)}),"grid"===S?pe.texts.map((t,l)=>e("text",{x:we.left-8,y:(l+.5)*we.height/Math.max(1,z.length),textAnchor:"end",dominantBaseline:"central",fontSize:se,fill:"var(--neba-muted-fg)",children:t},`row-${l}`)):null,"grid"===S?ne.map((t,l)=>{const n=we.width/Math.max(1,le),i=s(t,R);return l%Math.max(1,Math.ceil((v(i,se)+8)/Math.max(1,n)))!==0?null:e("text",{x:we.left+(l+.5)*n,y:we.height+se,textAnchor:"middle",fontSize:se,fill:"var(--neba-muted-fg)",children:i},`col-${l}`)}):null]}):null,Me&&!fe?xe.render?e("div",{className:"pointer-events-none absolute z-10",style:{left:Me.x+Me.width/2,top:Me.y},children:xe.render({index:Me.index,category:Me.cell.x??ne[Me.index]??Me.index,items:je})}):e(a,{heading:`${ie[Me.row]} · ${ye(Me)}`,items:je,x:Me.x+Me.width/2,y:Me.y,flip:Me.x+Me.width/2>.6*T,size:W}):null]})})}function $(e,t,l){return Math.max(Math.abs(t-l),Math.abs(l-e))}
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as l from"react";import{ChartScaleLegend as n,ChartSurface as i,ChartTooltipPanel as a,useMeasuredWidth as r}from"../../internal/chart-frame.js";import{categoryAt as o,chartFontSizes as d,compactNumber as h,formatCategory as s,markGap as c,plotHeights as m,rampFill as u,rampInk as x,rampStep as f,rampSteps as g,squarify as p,textWidth as v,toValues as w,truncate as b}from"../../internal/chart.js";import{numberFormatter as y}from"../../internal/format.js";import{cx as M,metaTextClasses as j,srOnlyClasses as k}from"../../internal/styles.js";import{emptyMessages as A,useMessages as N}from"../../internal/i18n.js";export function HeatmapChart({series:z,categories:E,shape:S="grid",scale:B="sequential",midpoint:C=0,min:I,max:_,valueLabels:D="none",height:L,format:P,locale:R,label:q,legend:H,tooltip:K,empty:U,size:W="md",variant:F="text",padded:G=!1,className:J,...O}){const Q=l.useRef(null),T=r(Q),V=N(A,R),X=l.useId(),[Y,Z]=l.useState(null),ee=l.useCallback(e=>P?y(R,P).format(e):h(e,R),[P,R]),te=l.useMemo(()=>w(z),[z]),le=te.reduce((e,t)=>Math.max(e,t.length),0),ne=l.useMemo(()=>Array.from({length:le},(e,t)=>o(t,E,te)),[le,E,te]),ie=l.useMemo(()=>z.map((e,t)=>e.name??`${t+1}`),[z]),ae=l.useMemo(()=>{let e=1/0,t=-1/0,l=!1;for(const n of te)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},[te]),re=I??ae?.min??0,oe=_??ae?.max??1,de=l.useCallback(e=>f(e,re,oe,B,C),[re,oe,B,C]),he="number"==typeof L?L:m[W]??220,se=d[W],ce=!0===H||void 0===H||!1===H?{}:H,me=!1!==H,ue=ce.side??"bottom",xe=!1===K?{mode:"none"}:!0===K||void 0===K?{}:K,fe="none"===xe.mode,ge=null===ae||0===le||0===z.length,pe=l.useMemo(()=>{if("treemap"===S||T<=0)return{texts:[],band:0};const e=Math.min(150,.25*T),t=ie.map(t=>b(t,e,se));return{texts:t,band:t.reduce((e,t)=>Math.max(e,v(t,se)),0)+10}},[S,ie,T,se]),ve="treemap"===S?0:se+8,we={left:pe.band,width:Math.max(0,T-pe.band),height:Math.max(0,he-ve)},be=l.useMemo(()=>{if(we.width<=0||we.height<=0)return[];if("treemap"===S){const e=[];return te.forEach((t,l)=>t.forEach((t,n)=>{null!==t.value&&e.push({row:l,index:n,cell:t})})),p(e.map(e=>Math.max(0,e.cell.value??0)),we.width,we.height).map(t=>({row:e[t.index].row,index:e[t.index].index,cell:e[t.index].cell,x:we.left+t.x,y:t.y,width:t.width,height:t.height}))}const e=we.height/Math.max(1,z.length),t=we.width/Math.max(1,le),l=[];return te.forEach((n,i)=>n.forEach((n,a)=>{null!==n.value&&l.push({row:i,index:a,cell:n,x:we.left+a*t,y:i*e,width:t,height:e})})),l},[S,te,z.length,le,we.left,we.width,we.height]),ye=l.useCallback(e=>s(e.cell.x??E?.[e.index]??ne[e.index]??e.index,R),[E,ne,R]),Me=null===Y?null:be.find(e=>e.row===Y.row&&e.index===Y.index)??null,je=null===Me?[]:[{seriesIndex:Me.row,color:Me.cell.color??u(de(Me.cell.value??0),B),value:Me.cell.value,formatted:ee(Me.cell.value??0),label:Me.cell.label}],ke=Array.from({length:g},(e,t)=>u(t,B));return e(i,{...O,size:W,variant:F,padded:G,className:J,legendSide:ue,legend:me&&!ge?e(n,{steps:ke,from:ee("diverging"===B?-$(re,oe,C)+C:re),to:ee("diverging"===B?$(re,oe,C)+C:oe),middle:"diverging"===B?ee(C):void 0,align:ce.align??"center",vertical:"left"===ue||"right"===ue,size:W}):null,table:ge?null:t("table",{id:X,className:k,children:[q?e("caption",{children:q}):null,e("thead",{children:t("tr",{children:[e("th",{scope:"col"}),ne.map((t,l)=>e("th",{scope:"col",children:s(t,R)},l))]})}),e("tbody",{children:te.map((l,n)=>t("tr",{children:[e("th",{scope:"row",children:ie[n]}),ne.map((t,n)=>{const i=l[n];return e("td",{children:void 0!==i?.label?i.label:null==i?.value?"":ee(i.value)},n)})]},n))})]}),children:t("div",{ref:Q,role:"img",tabIndex:ge?void 0:0,"aria-label":q,"aria-describedby":ge?void 0:X,onPointerLeave:()=>Z(null),onBlur:()=>Z(null),onKeyDown:e=>{if(fe||0===be.length)return;const t=null===Y?-1:be.findIndex(e=>e.row===Y.row&&e.index===Y.index);if("ArrowRight"===e.key||"ArrowDown"===e.key){const e=be[Math.min(be.length-1,t+1)];Z({row:e.row,index:e.index})}else if("ArrowLeft"===e.key||"ArrowUp"===e.key){const e=be[Math.max(0,(-1===t?be.length:t)-1)];Z({row:e.row,index:e.index})}else{if("Escape"!==e.key)return;Z(null)}e.preventDefault()},className:M("relative w-full rounded-(--neba-radius-xs)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"),style:{height:he},children:[ge?e("div",{className:M("flex h-full items-center justify-center text-(--neba-muted-fg)",j[W]),children:U??V.title}):T>0?t("svg",{width:T,height:he,viewBox:`0 0 ${T} ${he}`,"aria-hidden":"true",className:"block",children:[be.map(l=>{const n=de(l.cell.value??0),i=Y?.row===l.row&&Y?.index===l.index,a=Math.max(0,l.width-c),r=Math.max(0,l.height-c);if(a<=0||r<=0)return null;const o=ee(l.cell.value??0),d="treemap"===S?"all"===D?[ye(l),o]:[ye(l)]:"all"===D?[o]:[],h=d.filter(e=>function(e,t,l,n){return l>=1.8*n&&t>=Math.min(v(e,n),2.5*n)+8}(e,a,r/d.length,se)),s=l.cell.color?"var(--neba-surface)":x(n,B);return t("g",{children:[e("rect",{x:l.x+c/2,y:l.y+c/2,width:a,height:r,rx:Math.min(3,a/2,r/2),fill:l.cell.color??u(n,B),opacity:i?1:.94,onPointerEnter:fe?void 0:()=>Z({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)*(se+2),textAnchor:"middle",dominantBaseline:"central",fontSize:se,fontWeight:0===n?500:400,fill:s,opacity:0===n?1:.85,pointerEvents:"none",className:0===n&&"treemap"===S?void 0:"tabular-nums",children:b(t,l.width-8,se)},n))]},`${l.row}-${l.index}`)}),"grid"===S?pe.texts.map((t,l)=>e("text",{x:we.left-8,y:(l+.5)*we.height/Math.max(1,z.length),textAnchor:"end",dominantBaseline:"central",fontSize:se,fill:"var(--neba-muted-fg)",children:t},`row-${l}`)):null,"grid"===S?ne.map((t,l)=>{const n=we.width/Math.max(1,le),i=s(t,R);return l%Math.max(1,Math.ceil((v(i,se)+8)/Math.max(1,n)))!==0?null:e("text",{x:we.left+(l+.5)*n,y:we.height+se,textAnchor:"middle",fontSize:se,fill:"var(--neba-muted-fg)",children:i},`col-${l}`)}):null]}):null,Me&&!fe?xe.render?e("div",{className:"pointer-events-none absolute z-10",style:{left:Me.x+Me.width/2,top:Me.y},children:xe.render({index:Me.index,category:Me.cell.x??ne[Me.index]??Me.index,items:je})}):e(a,{heading:`${ie[Me.row]} · ${ye(Me)}`,items:je,x:Me.x+Me.width/2,y:Me.y,flip:Me.x+Me.width/2>.6*T,size:W}):null]})})}function $(e,t,l){return Math.max(Math.abs(t-l),Math.abs(l-e))}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as n}from"react/jsx-runtime";import*as e from"react";import{transitionClasses as t}from"../../internal/styles.js";const r={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)"},o={regular:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},l=/[\p{L}\p{N}_]/u;function i(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function a(n,e,t){const r=e>0?n[e-1]:"",o=t<n.length?n[t]:"";return!l.test(r)&&!l.test(o)}function s(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 s=l.index,c=s+l[0].length;t&&!a(n,s,c)||(s>i&&o.push(n.slice(i,s)),o.push(r(l[0],`${s}`)),i=c)}return 0===o.length?n:(i<n.length&&o.push(n.slice(i)),o)}function c(n,t,r,o){if("string"==typeof n)return s(n,t,r,o);if("number"==typeof n)return s(String(n),t,r,o);if(Array.isArray(n))return e.Children.map(n,n=>c(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,c(l,t,r,o))}return n}export const Highlight=/*@__PURE__*/e.forwardRef(function({query:l,variant:a="solid",color:s="warning",caseSensitive:u=!1,wholeWord:f=!1,underline:d=!1,weight:m,className:g,style:p,children:h,...b},x){const y=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(i).join("|"),e?"gu":"giu")}(l,u),[l,u]),v=["rounded-[0.25rem] px-0.5 -mx-0.5","box-decoration-clone",r[a],d?"underline decoration-2 underline-offset-2":"",m?o[m]:"",t].filter(Boolean).join(" "),$=y?c(h,y,f,(e,t)=>n("mark",{className:v,children:e},t)):h;return n("span",{ref:x,className:g,style:{"--n-fill":`var(--neba-${s}-fill)`,"--n-on-solid":`var(--neba-${s}-on-solid)`,"--n-accent":`var(--neba-${s}-accent)`,"--n-panel":`var(--neba-${s}-panel)`,"--n-line":`var(--neba-${s}-line)`,...p},...b,children:$})});
|
|
1
|
+
"use client";import{jsx as n}from"react/jsx-runtime";import*as e from"react";import{transitionClasses as t}from"../../internal/styles.js";const r={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)"},o={regular:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},l=/[\p{L}\p{N}_]/u;function i(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function a(n,e,t){const r=e>0?n[e-1]:"",o=t<n.length?n[t]:"";return!l.test(r)&&!l.test(o)}function s(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 s=l.index,c=s+l[0].length;t&&!a(n,s,c)||(s>i&&o.push(n.slice(i,s)),o.push(r(l[0],`${s}`)),i=c)}return 0===o.length?n:(i<n.length&&o.push(n.slice(i)),o)}function c(n,t,r,o){if("string"==typeof n)return s(n,t,r,o);if("number"==typeof n)return s(String(n),t,r,o);if(Array.isArray(n))return e.Children.map(n,n=>c(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,c(l,t,r,o))}return n}export const Highlight=/*@__PURE__*/e.forwardRef(function({query:l,variant:a="solid",color:s="warning",caseSensitive:u=!1,wholeWord:f=!1,underline:d=!1,weight:m,className:g,style:p,children:h,...b},x){const y=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(i).join("|"),e?"gu":"giu")}(l,u),[l,u]),v=["rounded-[0.25rem] px-0.5 -mx-0.5","box-decoration-clone",r[a],d?"underline decoration-2 underline-offset-2":"",m?o[m]:"",t].filter(Boolean).join(" "),$=y?c(h,y,f,(e,t)=>n("mark",{className:v,children:e},t)):h;return n("span",{ref:x,className:g,style:{"--n-fill":`var(--neba-${s}-fill)`,"--n-on-solid":`var(--neba-${s}-on-solid)`,"--n-accent":`var(--neba-${s}-accent)`,"--n-panel":`var(--neba-${s}-panel)`,"--n-line":`var(--neba-${s}-line)`,...p},...b,children:$})});
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { NebaColor, NebaDensity, NebaElevation, NebaOrientation, NebaSize, NebaTransition, NebaVariant } from '../../types.js';
|
|
3
|
+
/** One step of the guide. */
|
|
4
|
+
export interface HowToStep {
|
|
5
|
+
/** The heading, shown both in the list and over the step's own body. */
|
|
6
|
+
title: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* A glyph before the title, over the step's own body.
|
|
9
|
+
*
|
|
10
|
+
* Only there, and not in the list: a row there already carries a numbered
|
|
11
|
+
* disc, and a glyph beside it is a second mark making the same claim about
|
|
12
|
+
* the same row. What an icon is good for is telling a reader *what kind* of
|
|
13
|
+
* step this is — a terminal, a file, a warning — which is a thing to say
|
|
14
|
+
* once, where the step is stated at full size.
|
|
15
|
+
*/
|
|
16
|
+
icon?: React.ReactNode;
|
|
17
|
+
/** What the reader has to do. Anything — prose, a [CodeBlock], a screenshot. */
|
|
18
|
+
content?: React.ReactNode;
|
|
19
|
+
/** A picture above the content, for a step that is easier shown than said. */
|
|
20
|
+
image?: string;
|
|
21
|
+
/** What that picture says for a reader who cannot see it. Defaults to `title`. */
|
|
22
|
+
imageAlt?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface HowToStepsProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'title' | 'content'> {
|
|
25
|
+
/**
|
|
26
|
+
* The steps, in the order they are to be done.
|
|
27
|
+
*
|
|
28
|
+
* An array rather than children, and this is the one place the component
|
|
29
|
+
* genuinely could not be built the other way: the list beside the body and
|
|
30
|
+
* the body itself are two renderings of the same data, and the panel is sized
|
|
31
|
+
* against *every* step rather than the one showing. A component that had to
|
|
32
|
+
* find its steps among its children could do neither.
|
|
33
|
+
*/
|
|
34
|
+
steps: HowToStep[];
|
|
35
|
+
/** The guide's own heading, over both columns. */
|
|
36
|
+
title?: React.ReactNode;
|
|
37
|
+
/** Which step is showing. Pass it to drive the guide yourself. */
|
|
38
|
+
step?: number;
|
|
39
|
+
/** Where an uncontrolled guide starts. @default 0 */
|
|
40
|
+
defaultStep?: number;
|
|
41
|
+
/** Fires with the index whenever the step changes, however it changed. */
|
|
42
|
+
onStepChange?: (step: number) => void;
|
|
43
|
+
/** Whether the guide is finished. Pass it to drive that yourself too. */
|
|
44
|
+
completed?: boolean;
|
|
45
|
+
/** Whether an uncontrolled guide starts finished. @default false */
|
|
46
|
+
defaultCompleted?: boolean;
|
|
47
|
+
/** Fires when the guide is finished, and again when it is started over. */
|
|
48
|
+
onCompletedChange?: (completed: boolean) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Which way the list of steps runs.
|
|
51
|
+
*
|
|
52
|
+
* `vertical` is the default: the numbers run down one side with the body
|
|
53
|
+
* beside them, which takes any number of steps and any amount to say about
|
|
54
|
+
* each. Below `sm` it stacks, because a rail and a paragraph side by side on
|
|
55
|
+
* a phone is two columns too narrow for either. `horizontal` runs the numbers
|
|
56
|
+
* across the top, and is only honest while every title is short.
|
|
57
|
+
* @default 'vertical'
|
|
58
|
+
*/
|
|
59
|
+
orientation?: NebaOrientation;
|
|
60
|
+
/**
|
|
61
|
+
* How tall the guide may get before it scrolls. A number is pixels.
|
|
62
|
+
*
|
|
63
|
+
* Both the list and the body scroll inside it rather than the sheet growing.
|
|
64
|
+
* A guide with twenty steps is what this is for, and twenty rows that pushed
|
|
65
|
+
* the buttons off the bottom of the card would be a guide with no way
|
|
66
|
+
* forward.
|
|
67
|
+
*/
|
|
68
|
+
maxHeight?: number | string;
|
|
69
|
+
/**
|
|
70
|
+
* How wide the list is while it is a column. A number is pixels.
|
|
71
|
+
* @default '15rem'
|
|
72
|
+
*/
|
|
73
|
+
railWidth?: number | string;
|
|
74
|
+
/**
|
|
75
|
+
* The row of buttons under the body. Off, the list is the only way to move,
|
|
76
|
+
* which is what a guide inside a page that has navigation of its own wants.
|
|
77
|
+
* @default true
|
|
78
|
+
*/
|
|
79
|
+
navigation?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Draws a hairline between the list and the body — down the inner edge while
|
|
82
|
+
* they are two columns, along the bottom of the list once they have stacked.
|
|
83
|
+
*
|
|
84
|
+
* On by default. The two are different kinds of thing — one is a map, the
|
|
85
|
+
* other is the place the map points at — and space alone leaves that to be
|
|
86
|
+
* inferred from a gap that a narrow screen is about to take away.
|
|
87
|
+
* @default true
|
|
88
|
+
*/
|
|
89
|
+
divider?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* How a step arrives when the reader moves to it, from the same vocabulary
|
|
92
|
+
* `transition` uses everywhere: an effect name, or the object form for the
|
|
93
|
+
* duration, the easing and the rest. `'none'` turns it off.
|
|
94
|
+
*
|
|
95
|
+
* It runs on the panel rather than on anything that is pressed, which is what
|
|
96
|
+
* keeps it inside the library's rule against moving a control: the buttons
|
|
97
|
+
* and the list rows hold still, and what animates is the content they
|
|
98
|
+
* changed.
|
|
99
|
+
*
|
|
100
|
+
* A reduced-motion preference switches it off entirely, as it does every
|
|
101
|
+
* other effect in the library.
|
|
102
|
+
* @default 'fade'
|
|
103
|
+
*/
|
|
104
|
+
transition?: NebaTransition | 'none';
|
|
105
|
+
/**
|
|
106
|
+
* Whether there is a finished state at all.
|
|
107
|
+
*
|
|
108
|
+
* On, the last step's button says "Done" and pressing it replaces the body
|
|
109
|
+
* with a panel that says so and offers to start again. Off, the last step is
|
|
110
|
+
* simply the last step.
|
|
111
|
+
* @default true
|
|
112
|
+
*/
|
|
113
|
+
completion?: boolean;
|
|
114
|
+
/** What the finished panel says, in place of the `locale`'s own sentence. */
|
|
115
|
+
completedContent?: React.ReactNode;
|
|
116
|
+
/**
|
|
117
|
+
* Weight of the sheet, said the way a *container* says it: the guide is never
|
|
118
|
+
* dyed, because what is in it arrives with colours of its own.
|
|
119
|
+
* @default 'outline'
|
|
120
|
+
*/
|
|
121
|
+
variant?: NebaVariant;
|
|
122
|
+
/** @default 'md' */
|
|
123
|
+
size?: NebaSize;
|
|
124
|
+
/** The family the numbers, the connector and the buttons wear. @default 'primary' */
|
|
125
|
+
color?: NebaColor;
|
|
126
|
+
/** @default 'default' */
|
|
127
|
+
density?: NebaDensity;
|
|
128
|
+
/** Drop shadow depth. `0` (the default) is flat. @default 0 */
|
|
129
|
+
elevation?: NebaElevation;
|
|
130
|
+
/**
|
|
131
|
+
* Which language the guide's own words are in — the four buttons and the
|
|
132
|
+
* sentence at the end. A BCP 47 tag such as `ko`, `pt-BR` or `zh-Hant`;
|
|
133
|
+
* unsupported tags fall back to English.
|
|
134
|
+
*/
|
|
135
|
+
locale?: string;
|
|
136
|
+
/** The four button labels, written out over the `locale`. */
|
|
137
|
+
previousLabel?: string;
|
|
138
|
+
nextLabel?: string;
|
|
139
|
+
doneLabel?: string;
|
|
140
|
+
restartLabel?: string;
|
|
141
|
+
}
|
|
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
|
+
export declare const HowToSteps: React.ForwardRefExoticComponent<HowToStepsProps & React.RefAttributes<HTMLDivElement>>;
|