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 t}from"react/jsx-runtime";import*as r from"react";import{boxPaddingXClasses as n,boxPaddingYClasses as o}from"../box/Box.js";import{Drawer as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{boxPaddingXClasses as n,boxPaddingYClasses as o}from"../box/Box.js";import{Drawer as a}from"../drawer/Drawer.js";import{beginPointerDrag as i}from"../../internal/drag.js";import{layoutMessages as l,useMessages as s}from"../../internal/i18n.js";import{drawerSide as d,expandedOnlyClasses as c,PageLayoutContext as u,SidebarSideContext as p,useCollapsed as f}from"../../internal/page-layout.js";import{cx as m,surfaceClasses as b,surfaceSlots as v,toLength as g,toPixels as h,transitionClasses as x}from"../../internal/styles.js";const y={xs:"11rem",sm:"13rem",md:"16rem",lg:"18rem",xl:"21rem"},w={solid:[b,"text-(--neba-fg) bg-(--n-panel-press)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[b,"text-(--neba-fg) bg-(--n-panel)","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--neba-fg) bg-transparent"};export const Sidebar=/*@__PURE__*/r.forwardRef(function({side:b,width:j,minWidth:C=160,maxWidth:R=480,resizable:z=!1,onResize:k,onResizeEnd:S,collapseBelow:B,open:N,defaultOpen:O=!1,onOpenChange:D,sticky:M=!0,title:A,variant:E="outline",size:I="md",color:T="primary",density:W="default",elevation:L=0,divider:P=!0,padded:X=!0,label:_,locale:K,className:$,style:q,children:F,...G},H){const J=r.useContext(u),Q=r.useContext(p),U=b??Q??"start",V=K??J.locale,Y=s(l,V),Z=B??(J.present?J.collapseBelow:"none"),ee=f(Z),[te,re]=r.useState(O),ne=void 0!==N,oe=ne?N:J.present?J.open[U]:te,ae=e=>{ne||(J.present?J.setOpen(U,e):re(e)),D?.(e)},ie=g(j)??y[I],le=r.useRef(null),se=r.useCallback(e=>{le.current=e,"function"==typeof H?H(e):H&&(H.current=e)},[H]),de=r.useRef(null);r.useEffect(()=>()=>de.current?.(),[]);const ce=e=>{const t=le.current;if(!t)return e;const r=(e,r)=>null==e?r:"number"==typeof e?e:h(e,{percentOf:"undefined"==typeof window?0:window.innerWidth,relativeTo:t})??r,n=Math.min(r(R,480),Math.max(r(C,160),Math.round(e)));return t.style.setProperty("--n-sidebar-w",`${n}px`),n},ue=e("div",{className:m("min-h-0 flex-1 overflow-y-auto overscroll-contain",X?m(n[W][I],o[W][I]):""),children:F});return ee?e(a,{side:d(U),mode:"overlay",open:oe,onOpenChange:ae,title:A,size:I,color:T,density:W,locale:V,closeLabel:Y.closeSidebar,extent:void 0===j?void 0:ie,"aria-label":A?void 0:_??Y.sidebar,className:$,style:q,children:F}):t("aside",{ref:se,"aria-label":_??Y.sidebar,className:m("relative flex min-w-0 shrink-0 flex-col","w-(--n-sidebar-w)",w[E],P?m("start"===U?"border-e":"border-s","[border-color:var(--n-line)]"):"","content"===J.scroll?"h-full":M?m("self-start","sticky [top:var(--n-layout-header,0px)]","[height:calc(100dvh-var(--n-layout-header,0px)-var(--n-layout-footer,0px))]"):"",c[Z],x,$),style:{...v(T,L),"--n-sidebar-w":ie,...q},...G,children:[ue,z?e("div",{role:"separator","aria-orientation":"vertical","aria-label":Y.resizeSidebar,tabIndex:0,className:m("absolute inset-y-0 z-1 w-2 cursor-col-resize","start"===U?"end-0 -me-1":"start-0 -ms-1","bg-transparent hover:bg-(--n-soft) data-[dragging]:bg-(--n-soft)",x,"[outline:none] focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-0"),onPointerDown:e=>{const t=le.current;if(!t||0!==e.button)return;const r=e.currentTarget,n=e.clientX,o=t.getBoundingClientRect().width,a="rtl"===getComputedStyle(t).direction,l="start"===U===a?-1:1;let s=o;de.current=i({target:r,pointerId:e.pointerId,onMove:e=>{s=ce(o+(e.clientX-n)*l),k?.(s)},onEnd:()=>{de.current=null,S?.(s)}})},onKeyDown:e=>{if("ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.preventDefault();const t="rtl"===getComputedStyle(e.currentTarget).direction,r="start"===U===t?-1:1;(e=>{const t=le.current;if(!t)return;const r=ce(t.getBoundingClientRect().width+e);k?.(r),S?.(r)})(("ArrowRight"===e.key?16:-16)*r)}}):null]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e}from"react/jsx-runtime";import*as r from"react";import{useRender as l}from"@base-ui/react/use-render";import{controlHeightClasses as
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import*as r from"react";import{useRender as l}from"@base-ui/react/use-render";import{controlHeightClasses as d,controlSquareClasses as n,cx as s,surfaceSlots as a}from"../../internal/styles.js";const o={xs:"h-[0.6875rem]",sm:"h-[0.75rem]",md:"h-[0.8125rem]",lg:"h-[0.9375rem]",xl:"h-[1.0625rem]"},m={xs:"gap-[0.3125rem]",sm:"gap-[0.375rem]",md:"gap-[0.5625rem]",lg:"gap-[0.5625rem]",xl:"gap-[0.6875rem]"},i={xs:"rounded-[0.3125rem]",sm:"rounded-[0.3125rem]",md:"rounded-[0.375rem]",lg:"rounded-[0.4375rem]",xl:"rounded-[0.5rem]"},t={xs:"h-12",sm:"h-16",md:"h-20",lg:"h-28",xl:"h-36"},u={xs:"rounded-(--neba-radius-xs)",sm:"rounded-(--neba-radius-sm)",md:"rounded-(--neba-radius-md)",lg:"rounded-(--neba-radius-lg)",xl:"rounded-(--neba-radius-xl)"},h="relative overflow-hidden bg-(--n-soft-hover)";function f(e){if(void 0!==e)return"number"==typeof e?`${e}px`:e}export const Skeleton=/*@__PURE__*/r.forwardRef(function({shape:r="line",lines:c=1,size:x="md",color:g="secondary",width:p,height:b,animated:w=!0,label:y,render:$,className:v,style:j,...k},N){const z=w?"neba-skeleton":"",A="circle"===r?`rounded-full ${d[x]} ${n[x]} shrink-0`:"rect"===r?`w-full ${u[x]} ${void 0===b?t[x]:""}`:`w-full ${i[x]} ${o[x]}`,B=y?{role:"status","aria-busy":!0,"aria-label":y}:{"aria-hidden":!0},R="line"===r&&c>1;return l({render:$,ref:N,props:{className:(R?["flex w-full flex-col",m[x],v??""]:[h,z,A,v??""]).filter(Boolean).join(" "),style:{...a(g,0),width:f(p),height:f(b),...j},...B,...R?{children:Array.from({length:c},(r,l)=>e("div",{className:s(h,z,i[x],o[x],l===c-1?"w-3/5":"w-full")},l))}:null,...k}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as a from"react";import{Slider as
|
|
1
|
+
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as a from"react";import{Slider as s}from"@base-ui/react/slider";import{cx as r,metaTextClasses as n,surfaceClasses as o,transitionClasses as t}from"../../internal/styles.js";const i={xs:"h-1",sm:"h-1.5",md:"h-1.5",lg:"h-2",xl:"h-2.5"},c={xs:"w-1",sm:"w-1.5",md:"w-1.5",lg:"w-2",xl:"w-2.5"},d={xs:"size-3",sm:"size-3.5",md:"size-4",lg:"size-5",xl:"size-6"},f={xs:"h-4",sm:"h-4.5",md:"h-5",lg:"h-6",xl:"h-7"},u={xs:"w-4",sm:"w-4.5",md:"w-5",lg:"w-6",xl:"w-7"},m="rounded-full bg-(--n-soft)",h=`rounded-full bg-(--n-fill) ${t}`,b=["rounded-full border bg-(--neba-surface)",o,"[border-color:var(--n-line-hover)]","[box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]","cursor-grab select-none active:cursor-grabbing",t,"hover:[box-shadow:var(--neba-shadow-2),0_0_0_4px_var(--n-soft)]","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2","data-[dragging]:[box-shadow:var(--neba-shadow-1),0_0_0_6px_var(--n-soft-hover)]"].join(" ");export const Slider=/*@__PURE__*/a.forwardRef(function({size:a="md",color:o="primary",orientation:t="horizontal",label:x,description:v,showValue:g=!1,disabled:w=!1,className:p,style:$,..._},y){const N="vertical"===t,j={"--n-fill":`var(--neba-${o}-fill)`,"--n-accent":`var(--neba-${o}-accent)`,"--n-soft":`var(--neba-${o}-soft)`,"--n-soft-hover":`var(--neba-${o}-soft-hover)`,"--n-line-hover":`var(--neba-${o}-line-hover)`,"--n-ring":`var(--neba-${o}-ring)`},z=_.value??_.defaultValue,A=Array.isArray(z)?z.length:1;return l(s.Root,{ref:y,orientation:t,disabled:w,className:r("flex",N?"w-fit flex-col items-center gap-2":"w-full flex-col gap-1.5",w?"[filter:saturate(0.25)] opacity-70 [&_*]:cursor-not-allowed":"",p??""),style:{...j,...$},..._,children:[x||g?l("div",{className:`flex w-full items-baseline gap-2 ${n[a]}`,children:[x?e(s.Label,{className:w?"font-medium text-(--neba-disabled-fg)":"font-medium text-(--neba-fg)",children:x}):null,g?e(s.Value,{className:"ms-auto tabular-nums text-(--neba-muted-fg)",children:"function"==typeof g?g:null}):null]}):null,e(s.Control,{className:["flex touch-none select-none items-center justify-center",N?`${u[a]} h-40 flex-col`:`w-full ${f[a]}`].join(" "),children:l(s.Track,{className:[m,N?`${c[a]} h-full`:`${i[a]} w-full`].join(" "),children:[e(s.Indicator,{className:h}),Array.from({length:A},(l,r)=>e(s.Thumb,{index:r,className:`${b} ${d[a]}`},r))]})}),v?e("div",{className:`${n[a]} text-(--neba-muted-fg)`,children:v}):null]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as n from"react";import{Button as r}from"../button/Button.js";import{spoilerMessages as i,useMessages as l}from"../../internal/i18n.js";import{boxPaddingClasses as o,boxPaddingXClasses as t,boxPaddingYClasses as s}from"../box/Box.js";import{cx as d,hasContent as c,metaTextClasses as m,radiusClasses as v,surfaceClasses as u,surfaceSlots as f,transitionClasses as b}from"../../internal/styles.js";const p={solid:[u,"bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[u,"border bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"bg-transparent"},x="[background-color:color-mix(in_oklab,var(--neba-surface)_55%,transparent)]";export const Spoiler=/*@__PURE__*/n.forwardRef(function({revealed:u,defaultRevealed:h=!1,onRevealedChange:j,locale:g,label:y,hideLabel:w,description:N,action:k,reversible:z=!1,maxHeight:_,blur:C=10,padded:R=!0,variant:B="outline",size:H="md",color:S="primary",density:$="default",elevation:I=0,className:L,style:q,children:A,...D},E){const F=l(i,g),G=n.useId(),[J,K]=n.useState(h),M=u??J,O=e=>{void 0===u&&K(e),j?.(e)},P=!1===N?null:N??F.notice;return a("div",{ref:E,className:d("relative isolate overflow-hidden",v[H],p[B],b,L??""),style:{...f(S,I),...q},...D,children:[e("div",{id:G,className:d("min-w-0",R?o[$][H]:"","[transition:filter_var(--neba-duration-fill)_var(--neba-ease)]","motion-reduce:[transition-duration:0ms]",M?"":"select-none"),style:{filter:M?void 0:`blur(${C}px)`,maxHeight:M?void 0:_,overflow:M?void 0:"hidden"},inert:!M,children:A}),M?null:a("div",{className:["absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 text-center",o[$][H],x].join(" "),children:[c(P)?e("p",{className:`m-0 text-(--neba-muted-fg) ${m[H]}`,children:P}):null,k??e(r,{size:H,color:S,density:$,onClick:()=>O(!0),"aria-expanded":!1,"aria-controls":G,children:y??F.reveal})]}),M&&z?e("div",{className:["flex justify-end",t[$][H],s[$][H],"pt-0"].join(" "),children:e(r,{variant:"text",size:H,color:S,density:$,onClick:()=>O(!1),"aria-expanded":!0,"aria-controls":G,children:w??F.hide})}):null]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as l from"react";import{Box as n}from"../box/Box.js";import{Chip as a}from"../chip/Chip.js";import{MinusIcon as r,TrendDownIcon as s,TrendUpIcon as m}from"../../internal/icons.js";import{numberFormatter as i}from"../../internal/format.js";import{
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as l from"react";import{Box as n}from"../box/Box.js";import{Chip as a}from"../chip/Chip.js";import{MinusIcon as r,TrendDownIcon as s,TrendUpIcon as m}from"../../internal/icons.js";import{numberFormatter as i}from"../../internal/format.js";import{cx as o,hasContent as c,metaTextClasses as u,sheetSectionGapClasses as d}from"../../internal/styles.js";const x={xs:"text-[1.125rem]/[1.375rem]",sm:"text-[1.375rem]/[1.625rem]",md:"text-[1.75rem]/[2rem]",lg:"text-[2.25rem]/[2.5rem]",xl:"text-[2.875rem]/[3.25rem]"},f={xs:"text-[0.75rem]",sm:"text-[0.875rem]",md:"text-[1rem]",lg:"text-[1.25rem]",xl:"text-[1.5rem]"},p={xs:"gap-y-0.5",sm:"gap-y-0.5",md:"gap-y-1",lg:"gap-y-1",xl:"gap-y-1.5"},h={start:"items-start text-start",center:"items-center text-center",end:"items-end text-end"},b={up:e(m,{}),down:e(s,{}),flat:e(r,{})};export const Statistic=/*@__PURE__*/l.forwardRef(function({size:l="md",color:r="primary",density:s="default",label:m,value:g,format:w,locale:N,prefix:j,unit:y,icon:$,previousValue:v,delta:z="percent",betterWhen:M="up",caption:k,align:B="start",className:C,children:F,...I},R){const S="number"==typeof g?g:null,V=null===S?g:i(N,w).format(S),W=null!==S&&void 0!==v?S-v:null,q=null!==W&&0!==v&&void 0!==v?W/Math.abs(v):null,A=null===W?null:W>0?"up":W<0?"down":"flat";let D=null;if(null!==W&&null!==A&&"none"!==z){const e=W>0?"+":W<0?"-":"",t=`${e}${i(N,w).format(Math.abs(W))}`,l=null===q?null:`${e}${(100*Math.abs(q)).toFixed(1).replace(/\.0$/,"")}%`;D="absolute"===z?t:"both"===z?[l,t].filter(Boolean).join(" · "):l??t}const E=null===A||"flat"===A?"secondary":A===M?"success":"danger",G=null!==D||c(k);return t(n,{ref:R,size:l,color:r,density:s,className:o("flex flex-col",d[l],h[B],C??""),...I,children:[c(m)||c($)?t("div",{className:["flex min-w-0 items-center gap-1.5 font-medium text-(--neba-muted-fg)",u[l]].join(" "),children:[c($)?e("span",{className:"flex shrink-0 items-center",children:$}):null,c(m)?e("span",{className:"min-w-0 truncate",children:m}):null]}):null,t("div",{className:["flex min-w-0 flex-wrap items-baseline gap-1 font-semibold text-(--neba-fg) tabular-nums",x[l]].join(" "),children:[c(j)?e("span",{className:`font-medium text-(--neba-muted-fg) ${f[l]}`,children:j}):null,e("span",{className:"min-w-0 break-words",children:V}),c(y)?e("span",{className:`font-medium text-(--neba-muted-fg) ${f[l]}`,children:y}):null]}),G?t("div",{className:`flex min-w-0 flex-wrap items-center gap-x-2 ${p[l]}`,children:[null!==D&&null!==A?e(a,{size:l,variant:"text",color:E,startIcon:b[A],className:"tabular-nums",children:D}):null,c(k)?e("span",{className:`min-w-0 text-(--neba-muted-fg) ${u[l]}`,children:k}):null]}):null,F]})});
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Switch as BaseUISwitch } from '@base-ui/react/switch';
|
|
3
|
-
import type { NebaColor, NebaSize } from '../../types.js';
|
|
3
|
+
import type { NebaColor, NebaFieldSlot, NebaSize, NebaSlots } from '../../types.js';
|
|
4
4
|
/** Which side of the track the label sits on. */
|
|
5
5
|
export type SwitchLabelPlacement = 'start' | 'end';
|
|
6
6
|
type BaseSwitchProps = Omit<React.ComponentPropsWithoutRef<typeof BaseUISwitch.Root>, 'className' | 'style' | 'render' | 'children'>;
|
|
7
|
+
/**
|
|
8
|
+
* The parts a Switch draws behind its root.
|
|
9
|
+
*
|
|
10
|
+
* `control` is the track — the pill that fills when the switch is on — and
|
|
11
|
+
* `thumb` is the disc that travels across it.
|
|
12
|
+
*/
|
|
13
|
+
export type SwitchSlot = NebaFieldSlot | 'thumb';
|
|
7
14
|
export interface SwitchProps extends BaseSwitchProps {
|
|
8
15
|
/** @default 'md' */
|
|
9
16
|
size?: NebaSize;
|
|
@@ -26,6 +33,11 @@ export interface SwitchProps extends BaseSwitchProps {
|
|
|
26
33
|
labelPlacement?: SwitchLabelPlacement;
|
|
27
34
|
/** Class names for the field wrapper, not for the track. */
|
|
28
35
|
className?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Class names for the parts behind that wrapper — the track is
|
|
38
|
+
* `classNames.control`.
|
|
39
|
+
*/
|
|
40
|
+
classNames?: NebaSlots<SwitchSlot>;
|
|
29
41
|
style?: React.CSSProperties;
|
|
30
42
|
}
|
|
31
43
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as a,Fragment as r}from"react/jsx-runtime";import*as n from"react";import{Switch as l}from"@base-ui/react/switch";import{Field as
|
|
1
|
+
"use client";import{jsx as e,jsxs as a,Fragment as r}from"react/jsx-runtime";import*as n from"react";import{Switch as l}from"@base-ui/react/switch";import{Field as t}from"@base-ui/react/field";import{controlTextClasses as o,cx as i,hitAreaClasses as c,metaTextClasses as s,surfaceClasses as d,tickRowLeadingClasses as b}from"../../internal/styles.js";const h={xs:"h-3.5 w-6",sm:"h-4 w-7",md:"h-5 w-9",lg:"h-6 w-11",xl:"h-7 w-13"},f={xs:"data-[checked]:left-[calc(100%-0.75rem)]",sm:"data-[checked]:left-[calc(100%-0.875rem)]",md:"data-[checked]:left-[calc(100%-1.125rem)]",lg:"data-[checked]:left-[calc(100%-1.375rem)]",xl:"data-[checked]:left-[calc(100%-1.625rem)]"},m=["relative inline-flex shrink-0 border",c,"[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]","rounded-full","[transition-property:background-color,border-color,box-shadow]","[transition-duration:var(--neba-duration-fill),var(--neba-duration),var(--neba-duration)]","[transition-timing-function:var(--neba-ease)]","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"].join(" "),u=[d,"cursor-pointer bg-(--n-panel) [border-color:var(--n-line)]","hover:bg-(--n-panel-hover) hover:[border-color:var(--n-line-hover)]","data-[checked]:bg-(--n-fill) data-[checked]:[border-color:transparent]","data-[checked]:hover:bg-(--n-fill-hover)"].join(" "),v=[d,"cursor-default bg-(--n-panel) [border-color:var(--n-line)]","[filter:saturate(0.55)]","data-[checked]:bg-(--n-fill) data-[checked]:[border-color:transparent]"].join(" "),p=["cursor-not-allowed bg-transparent [border-color:var(--neba-disabled-border)] shadow-none","data-[checked]:bg-(--neba-disabled-bg)"].join(" "),g=["absolute inset-y-0.5 left-0.5 aspect-square rounded-full bg-(--neba-surface)","[box-shadow:var(--neba-shadow-1)]","[transition:left_var(--neba-duration)_var(--neba-ease)]"].join(" ");export const Switch=/*@__PURE__*/n.forwardRef(function({size:n="md",color:c="primary",label:d,description:x,error:w,invalid:k,labelPlacement:N="end",disabled:j=!1,readOnly:y=!1,className:$,classNames:_,style:R,...O},S){const q=null!=w&&!1!==w&&""!==w,z=k??q,D=z?"danger":c,E={"--n-fill":`var(--neba-${D}-fill)`,"--n-fill-hover":`var(--neba-${D}-fill-hover)`,"--n-accent":`var(--neba-${D}-accent)`,"--n-panel":"var(--neba-panel)","--n-panel-hover":"var(--neba-panel-hover)","--n-line":`var(--neba-${D}-line)`,"--n-line-hover":`var(--neba-${D}-line-hover)`,"--n-ring":`var(--neba-${D}-ring)`},F=e("span",{className:"flex h-[1lh] shrink-0 items-center",children:e(l.Root,{ref:S,className:i(m,h[n],j?p:y?v:u,_?.control),disabled:j,readOnly:y,...O,children:e(l.Thumb,{className:i(g,f[n],_?.thumb)})})}),L=d||x?a("span",{className:i("flex min-w-0 flex-col gap-0.5","start"===N?"flex-1":""),children:[d?e(t.Label,{className:i("leading-[1.4]",j?"text-(--neba-disabled-fg)":"cursor-pointer text-(--neba-fg)",_?.label),children:d}):null,x?e(t.Description,{className:i(s[n],"text-(--neba-muted-fg)",_?.description),children:x}):null]}):null;return a(t.Root,{disabled:j,invalid:z,className:i("inline-flex flex-col gap-1 align-top",$??""),style:{...E,...R},children:[e("div",{className:`flex items-start gap-2.5 ${o[n]} ${b}`,children:a(r,"start"===N?{children:[L,F]}:{children:[F,L]})}),e(t.Error,q?{match:!0,className:i(s[n],"text-(--n-accent)",_?.error),children:w}:{className:i(s[n],"text-(--n-accent)",_?.error)})]})});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type BoxProps } from '../box/Box.js';
|
|
3
|
-
import type { NebaAlign } from '../../types.js';
|
|
3
|
+
import type { NebaAlign, NebaSlots } from '../../types.js';
|
|
4
4
|
/** Which edge the text in a column lines up against. */
|
|
5
5
|
export type TableAlign = NebaAlign;
|
|
6
6
|
/**
|
|
@@ -38,6 +38,20 @@ export interface TableColumn<Row> {
|
|
|
38
38
|
*/
|
|
39
39
|
render?: (row: Row, index: number) => React.ReactNode;
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* The parts a Table draws behind its root.
|
|
43
|
+
*
|
|
44
|
+
* `className` is the sheet — the Box that scrolls horizontally — and everything
|
|
45
|
+
* tabular is behind it, starting with the `<table>` itself.
|
|
46
|
+
*
|
|
47
|
+
* One caveat, and it is the whole reason the note above `cellStyle` exists: a
|
|
48
|
+
* cell's padding, alignment and background are written as **inline styles**,
|
|
49
|
+
* because `.vp-doc td` and `.prose td` outrank any one-class utility. A class
|
|
50
|
+
* handed to `headCell`, `cell` or `empty` can add anything the component does
|
|
51
|
+
* not already set inline — a colour, a font, a border — but to change one of
|
|
52
|
+
* those three it has to be an important one (`p-4!`).
|
|
53
|
+
*/
|
|
54
|
+
export type TableSlot = 'table' | 'caption' | 'head' | 'headCell' | 'body' | 'row' | 'cell' | 'empty';
|
|
41
55
|
export interface TableProps<Row> extends Omit<BoxProps, 'padded' | 'children' | 'render' | 'title'> {
|
|
42
56
|
/** The columns, in the order they appear. */
|
|
43
57
|
headers: readonly TableColumn<Row>[];
|
|
@@ -79,6 +93,11 @@ export interface TableProps<Row> extends Omit<BoxProps, 'padded' | 'children' |
|
|
|
79
93
|
stickyHeader?: boolean;
|
|
80
94
|
/** Makes rows activatable. Also turns on the hover treatment. */
|
|
81
95
|
onRowClick?: (row: Row, index: number) => void;
|
|
96
|
+
/**
|
|
97
|
+
* Class names for the parts behind the root. `className` is the sheet the
|
|
98
|
+
* table scrolls inside; the `<table>` itself is `classNames.table`.
|
|
99
|
+
*/
|
|
100
|
+
classNames?: NebaSlots<TableSlot>;
|
|
82
101
|
}
|
|
83
102
|
/**
|
|
84
103
|
* A grid of data.
|
|
@@ -88,4 +107,4 @@ export interface TableProps<Row> extends Omit<BoxProps, 'padded' | 'children' |
|
|
|
88
107
|
* might sit next to. What Table adds is the part that is genuinely tabular: the
|
|
89
108
|
* columns, the rows, and the fact that the two cannot drift apart.
|
|
90
109
|
*/
|
|
91
|
-
export declare function Table<Row>({ headers, items, getRowKey, caption, locale, empty, striped, hoverable, stickyHeader, onRowClick, size, density, className, ...boxProps }: TableProps<Row>): React.JSX.Element;
|
|
110
|
+
export declare function Table<Row>({ headers, items, getRowKey, caption, locale, empty, striped, hoverable, stickyHeader, onRowClick, size, density, className, classNames, ...boxProps }: TableProps<Row>): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Box as r}from"../box/Box.js";import{tableMessages as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Box as r}from"../box/Box.js";import{tableMessages as a,useMessages as l}from"../../internal/i18n.js";import{controlTextLeadingClasses as n,cx as o,metaTextClasses as s,paddingXValues as i}from"../../internal/styles.js";const d={default:{xs:"0.25rem",sm:"0.375rem",md:"0.625rem",lg:"0.75rem",xl:"0.875rem"},compact:{xs:"0.125rem",sm:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.625rem"}},c=["[--n-row:transparent]","[transition:background-color_var(--neba-duration)_var(--neba-ease)]"].join(" "),m=["cursor-pointer [outline:none]","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]"].join(" "),p={borderTop:"1px solid var(--n-line)",backgroundColor:"var(--n-row)"};export function Table({headers:h,items:y,getRowKey:b,caption:u,locale:x,empty:g,striped:f=!1,hoverable:v=!1,stickyHeader:w=!1,onRowClick:k,size:N="md",density:j="default",className:C,classNames:A,...$}){const _=l(a,x),z=i[j][N],T=d[j][N],B=Boolean(k),D=v||B,K={padding:`${T} ${z}`},R={...K,backgroundColor:"var(--n-panel-press)"};return e(r,{size:N,density:j,padded:!1,className:o("overflow-x-auto",C??""),...$,children:t("table",{className:o("w-full text-start",n[N],"text-(--neba-fg)",A?.table),style:{borderCollapse:"collapse"},children:[u?e("caption",{className:o(s[N],"text-(--neba-muted-fg)",A?.caption),style:{...K,textAlign:"start"},children:u}):null,e("colgroup",{children:h.map(t=>e("col",{style:void 0===t.width?void 0:{width:"number"==typeof t.width?`${t.width}px`:t.width}},t.key))}),e("thead",{className:A?.head,children:e("tr",{children:h.map(t=>e("th",{scope:"col",className:o("font-semibold whitespace-nowrap text-(--neba-muted-fg)",w?"sticky top-0 z-10 [backdrop-filter:var(--neba-blur)]":"",A?.headCell),style:{...R,textAlign:t.align??"start"},children:t.label??t.key},t.key))})}),e("tbody",{className:A?.body,children:0===y.length?e("tr",{className:o(c,A?.row),style:p,children:e("td",{colSpan:h.length,className:o("text-(--neba-muted-fg)",A?.empty),style:{padding:`2rem ${z}`,textAlign:"center"},children:g??_.empty})}):y.map((t,r)=>e("tr",{className:o(c,f&&r%2==1?"[--n-row:var(--n-panel-hover)]":"",D?"hover:[--n-row:var(--n-soft)]":"",B?m:"",A?.row),style:p,tabIndex:B?0:void 0,onClick:k?()=>k(t,r):void 0,onKeyDown:k?e=>{e.target===e.currentTarget&&("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),k(t,r)))}:void 0,children:h.map(a=>e("td",{className:A?.cell,style:{...K,textAlign:a.align??"start"},children:a.render?a.render(t,r):t[a.key]},a.key))},b?b(t,r):r))})]})})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{Tabs as i}from"@base-ui/react/tabs";import{controlHeightClasses as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{Tabs as i}from"@base-ui/react/tabs";import{controlHeightClasses as l,controlTextClasses as n,cx as o,gapClasses as r,hasContent as s,iconClasses as c,paddingXClasses as d,radiusClasses as u,surfaceClasses as f,surfaceSlots as h,transitionClasses as b}from"../../internal/styles.js";const v=/*@__PURE__*/a.createContext({variant:"outline",size:"md",density:"default",orientation:"horizontal",fullWidth:!1}),p={solid:{horizontal:`${f} inline-flex bg-(--n-panel) p-1 [box-shadow:var(--neba-plate-glass)]`,vertical:`${f} inline-flex flex-col bg-(--n-panel) p-1 [box-shadow:var(--neba-plate-glass)]`},outline:{horizontal:"flex border-b [border-color:var(--n-line)]",vertical:"flex flex-col border-e [border-color:var(--n-line)]"},text:{horizontal:"flex",vertical:"flex flex-col"}},x={solid:{horizontal:"absolute left-(--active-tab-left) top-(--active-tab-top) h-(--active-tab-height) w-(--active-tab-width)",vertical:"absolute left-(--active-tab-left) top-(--active-tab-top) h-(--active-tab-height) w-(--active-tab-width)"},outline:{horizontal:"absolute bottom-0 left-(--active-tab-left) h-0.5 w-(--active-tab-width)",vertical:"absolute end-0 top-(--active-tab-top) h-(--active-tab-height) w-0.5"},text:{horizontal:"absolute bottom-0 left-(--active-tab-left) h-0.5 w-(--active-tab-width)",vertical:"absolute end-0 top-(--active-tab-top) h-(--active-tab-height) w-0.5"}},m={solid:`${f} bg-(--n-panel-press) [box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]`,outline:"bg-(--n-accent)",text:"bg-(--n-accent)"},g={solid:"text-(--neba-muted-fg) hover:text-(--neba-fg) data-[active]:text-(--n-accent)",outline:"text-(--neba-muted-fg) hover:text-(--neba-fg) data-[active]:text-(--n-accent)",text:"text-(--neba-muted-fg) hover:text-(--neba-fg) data-[active]:text-(--n-accent)"};export const Tab=/*@__PURE__*/a.forwardRef(function({value:f,startIcon:h,endIcon:p,disabled:x=!1,className:m,children:w,...z},y){const{variant:N,size:j,density:k,fullWidth:C}=a.useContext(v);return t(i.Tab,{ref:y,value:f,disabled:x,className:o("relative z-10 inline-flex shrink-0 cursor-pointer items-center justify-center select-none","whitespace-nowrap font-medium","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",l[j],n[j],r[j],d[k][j],"solid"===N?u[j]:"",b,c,g[N],"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]","data-[disabled]:cursor-not-allowed data-[disabled]:text-(--neba-disabled-fg)",C?"flex-1":"",m??""),...z,children:[s(h)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:h}):null,w,s(p)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:p}):null]})});export const TabPanel=/*@__PURE__*/a.forwardRef(function({value:t,keepMounted:l=!1,className:n,children:o,...r},s){const{size:c}=a.useContext(v);return e(i.Panel,{ref:s,value:t,keepMounted:l,className:["min-w-0 flex-1 text-(--neba-fg)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2",u[c],n??""].filter(Boolean).join(" "),...r,children:o})});export const Tabs=/*@__PURE__*/a.forwardRef(function({variant:l="outline",size:n="md",color:r="primary",density:s="default",value:c,defaultValue:d,onValueChange:f,orientation:b="horizontal",activateOnFocus:g=!1,loopFocus:w=!0,fullWidth:z=!1,className:y,style:N,children:j,...k},C){const T=a.useMemo(()=>({variant:l,size:n,density:s,orientation:b,fullWidth:z}),[l,n,s,b,z]),V=[],F=[];return a.Children.forEach(j,e=>{a.isValidElement(e)&&e.type===TabPanel?F.push(e):null!=e&&!1!==e&&V.push(e)}),e(v.Provider,{value:T,children:t(i.Root,{ref:C,value:c,defaultValue:d,onValueChange:e=>f?.(e),orientation:b,className:o("flex min-w-0","vertical"===b?"flex-row gap-4":"flex-col gap-4",y??""),style:{...h(r,0),...N},...k,children:[t(i.List,{activateOnFocus:g,loopFocus:w,className:o("relative shrink-0",p[l][b],"solid"===l?u[n]:"",z&&"horizontal"===b?"w-full":"","horizontal"===b?"overflow-x-auto overflow-y-hidden":""),children:[V,e(i.Indicator,{className:["pointer-events-none",x[l][b],m[l],"solid"===l?u[n]:"rounded-full","[transition-property:left,top,width,height]","[transition-duration:var(--neba-duration)]","[transition-timing-function:var(--neba-ease)]"].join(" ")})]}),F]})})});
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { NebaElevation, NebaStyleProps } from '../../types.js';
|
|
2
|
+
import type { NebaElevation, NebaFieldSlot, NebaSlots, NebaStyleProps } from '../../types.js';
|
|
3
3
|
/** How the multiline control may be resized by the user. Ignored when single line. */
|
|
4
4
|
export type TextFieldResize = 'none' | 'vertical' | 'horizontal' | 'both';
|
|
5
|
+
/**
|
|
6
|
+
* The parts a TextField draws behind its root.
|
|
7
|
+
*
|
|
8
|
+
* `shell` is the framed box the control sits in — the thing wearing the border,
|
|
9
|
+
* the fill and the focus ring. It is a part rather than an implementation
|
|
10
|
+
* detail because it, and not the `<input>`, is what a caller means by "the
|
|
11
|
+
* field" when they want to change its shape.
|
|
12
|
+
*/
|
|
13
|
+
export type TextFieldSlot = NebaFieldSlot | 'shell';
|
|
5
14
|
/**
|
|
6
15
|
* Native `<input>` attributes, minus the three that collide with the shared
|
|
7
16
|
* vocabulary: `color` and `size` are Neba props here, and `onChange` is widened
|
|
@@ -57,6 +66,12 @@ export interface TextFieldProps extends NebaStyleProps, NativeControlProps {
|
|
|
57
66
|
loading?: boolean;
|
|
58
67
|
/** Stretches to the width of the container. */
|
|
59
68
|
fullWidth?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Class names for the parts behind the root. `className` is the root — the
|
|
71
|
+
* column that holds the label, the shell and the two lines under it — so the
|
|
72
|
+
* control itself is reached through `classNames.control`.
|
|
73
|
+
*/
|
|
74
|
+
classNames?: NebaSlots<TextFieldSlot>;
|
|
60
75
|
onChange?: React.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
61
76
|
}
|
|
62
77
|
export declare const TextField: React.ForwardRefExoticComponent<TextFieldProps & React.RefAttributes<HTMLInputElement | HTMLTextAreaElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{Field as r}from"@base-ui/react/field";import{Input as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{Field as r}from"@base-ui/react/field";import{Input as l}from"@base-ui/react/input";import{controlHeightClasses as i,controlTextLeadingClasses as a,cx as s,disabledClasses as o,fieldReadOnlyClasses as c,fieldRestClasses as d,focusWithinRingClasses as m,gapClasses as u,iconClasses as p,metaTextClasses as x,paddingXClasses as f,radiusClasses as h,stackGapClasses as b,surfaceSlots as g,transitionClasses as y}from"../../internal/styles.js";const $={xs:`${u.xs} ${h.xs} ${a.xs}`,sm:`${u.sm} ${h.sm} ${a.sm}`,md:`${u.md} ${h.md} ${a.md}`,lg:`${u.lg} ${h.lg} ${a.lg}`,xl:`${u.xl} ${h.xl} ${a.xl}`},N={xs:"min-h-5.5 py-[3px]",sm:"min-h-6.5 py-[4px]",md:"min-h-8 py-[5px]",lg:"min-h-10 py-[8px]",xl:"min-h-12 py-[10px]"},v={none:"resize-none",vertical:"resize-y",horizontal:"resize-x",both:"resize"},w=["group relative flex w-full cursor-text","[-webkit-tap-highlight-color:transparent]",y,"focus-within:[transition-duration:0ms]",m,p].join(" "),k=d,z=c;function j(){return t("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"animate-spin",children:[e("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"2"}),e("path",{d:"M14.5 8A6.5 6.5 0 0 0 8 1.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}export const TextField=/*@__PURE__*/n.forwardRef(function({variant:a="outline",size:c="md",color:d="primary",density:m="default",elevation:u=0,multiline:p=!1,rows:h=3,resize:y="vertical",label:C,description:D,error:O,invalid:R,startIcon:W,endIcon:I,loading:L=!1,fullWidth:T=!1,classNames:A,readOnly:B=!1,disabled:E=!1,type:F="text",className:M,style:P,...q},G){const H=null!=O&&!1!==O&&""!==O,J=R??H,K=J?"danger":d,Q=n.useRef(null),S=n.useCallback(e=>{Q.current=e,"function"==typeof G?G(e):G&&(G.current=e)},[G]),U=s(w,$[c],p?`${N[c]} items-start`:`${i[c]} items-center`,f[m][c],E?o[a]:B?z[a]:k[a],A?.shell),V=s("min-w-0 flex-1 bg-transparent [font:inherit] text-inherit","[outline:none]","placeholder:text-(--neba-muted-fg)","caret-(--n-accent) selection:bg-(--n-soft-press)","disabled:cursor-not-allowed",p?`block ${v[y]}`:"self-stretch",A?.control),X="inline-flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg) transition-[color] duration-(--neba-duration) group-focus-within:text-(--n-accent)";return t(r.Root,{disabled:E,invalid:J,className:s("flex-col align-top",b[c],T?"flex w-full":"inline-flex",M??""),style:{...g(K,u),...P},children:[C?e(r.Label,{className:s(x[c],"font-medium",E?"text-(--neba-disabled-fg)":"text-(--neba-fg)",A?.label),children:C}):null,t("span",{className:U,onPointerDown:e=>{e.target!==e.currentTarget||E||(e.preventDefault(),Q.current?.focus())},children:[W?e("span",{className:X,children:W}):null,e(l,{ref:S,className:V,disabled:E,readOnly:B,"aria-busy":L||void 0,"data-loading":L||void 0,...p?{render:e("textarea",{rows:h})}:{type:F},...q}),L?e("span",{className:X,children:e(j,{})}):I?e("span",{className:X,children:I}):null]}),D?e(r.Description,{className:s(x[c],"text-(--neba-muted-fg)",A?.description),children:D}):null,e(r.Error,H?{match:!0,className:s(x[c],"text-(--n-accent)",A?.error),children:O}:{className:s(x[c],"text-(--n-accent)",A?.error)})]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n,Fragment as e,jsxs as r}from"react/jsx-runtime";import*as i from"react";import{useRender as
|
|
1
|
+
"use client";import{jsx as n,Fragment as e,jsxs as r}from"react/jsx-runtime";import*as i from"react";import{useRender as a}from"@base-ui/react/use-render";import{linkMessages as o,useMessages as t}from"../../internal/i18n.js";import{ExternalLinkIcon as l,LinkIcon as s}from"../../internal/icons.js";import{safeRel as c}from"../../internal/link.js";import{controlTextLeadingClasses as m,cx as u,focusRingClasses as d,srOnlyClasses as p}from"../../internal/styles.js";const b={always:"[&.neba-link]:underline",hover:"[&.neba-link]:no-underline [&.neba-link]:hover:underline",none:"[&.neba-link]:no-underline"},f=["neba-link","cursor-pointer","[&_svg]:pointer-events-none [&_svg]:inline [&_svg]:size-[0.95em] [&_svg]:shrink-0",["[transition-property:color,text-decoration-color]","[transition-duration:var(--neba-duration)]","[transition-timing-function:var(--neba-ease)]"].join(" "),d,"focus-visible:rounded-[0.25rem]"].join(" ");export const TextLink=/*@__PURE__*/i.forwardRef(function({href:i,underline:d="always",color:v,size:h,newTab:k=!1,icon:g,locale:j,render:x,className:y,style:w,children:_,...N},T){const z=t(o,j),C=g??k,$=!0===C?n(k?l:s,{}):C,F=u(f,h?m[h]:"",b[d],v?"[&.neba-link]:text-(--n-accent)":"[&.neba-link]:text-inherit",y??""),L={"--n-underline":"color-mix(in oklab, currentColor 45%, transparent)","--n-underline-hover":"currentColor","--n-ring":`var(--neba-${v??"primary"}-ring)`,...v?{"--n-accent":`var(--neba-${v}-accent)`}:null},R=k?"_blank":void 0,{rel:q,...A}=N,B=c(R,q);return a({render:x??n("a",{}),ref:T,props:{href:i,target:R,className:F,style:{...L,...w},children:r(e,{children:[_,$?n("span",{className:"ms-[0.25em]",children:$}):null,k?r(e,{children:[" ",n("span",{className:p,children:z.newTab})]}):null]}),...A,rel:B}})});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { NebaAlign, NebaColor, NebaStyleProps, NebaVariant } from '../../types.js';
|
|
2
|
+
import type { NebaAlign, NebaColor, NebaSlots, NebaStyleProps, NebaVariant } from '../../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Where the stack sits.
|
|
5
5
|
*
|
|
@@ -50,6 +50,16 @@ export interface ToastOptions extends ToastData {
|
|
|
50
50
|
/** Called once it has finished animating out and left the DOM. */
|
|
51
51
|
onRemove?: () => void;
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* The parts the toast stack draws.
|
|
55
|
+
*
|
|
56
|
+
* There is no `className` on the provider and there is deliberately no `root`
|
|
57
|
+
* slot: a ToastProvider renders no element of its own — it wraps the app and
|
|
58
|
+
* puts a portalled stack on the page — so there is nothing for a root class
|
|
59
|
+
* name to land on. `viewport` is the strip the toasts are stacked in and
|
|
60
|
+
* `toast` is one of them.
|
|
61
|
+
*/
|
|
62
|
+
export type ToastSlot = 'viewport' | 'toast' | 'title' | 'description' | 'action' | 'close';
|
|
53
63
|
export interface ToastProviderProps extends Pick<NebaStyleProps, 'variant' | 'size' | 'density'> {
|
|
54
64
|
/** The default colour family. A single toast overrides it in `add`. */
|
|
55
65
|
color?: NebaColor;
|
|
@@ -79,6 +89,11 @@ export interface ToastProviderProps extends Pick<NebaStyleProps, 'variant' | 'si
|
|
|
79
89
|
locale?: string;
|
|
80
90
|
/** Accessible name of every toast's × button. Defaults to the `locale`'s word. */
|
|
81
91
|
closeLabel?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Class names for the parts of the stack. There is no `className` here — a
|
|
94
|
+
* provider renders no element of its own to put one on.
|
|
95
|
+
*/
|
|
96
|
+
classNames?: NebaSlots<ToastSlot>;
|
|
82
97
|
children?: React.ReactNode;
|
|
83
98
|
}
|
|
84
99
|
/**
|
|
@@ -121,4 +136,4 @@ export declare function useToast(): {
|
|
|
121
136
|
* limit, the swipe, the F6 focus hotkey, and the live region that makes a
|
|
122
137
|
* message that appeared out of nowhere reach a screen reader at all.
|
|
123
138
|
*/
|
|
124
|
-
export declare function ToastProvider({ variant, size, color, density, position, timeout, limit, width, locale, closeLabel, children }: ToastProviderProps): React.JSX.Element;
|
|
139
|
+
export declare function ToastProvider({ variant, size, color, density, position, timeout, limit, width, locale, closeLabel, classNames, children }: ToastProviderProps): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{Toast as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{Toast as s}from"@base-ui/react/toast";import{boxPaddingClasses as i}from"../box/Box.js";import{actionMessages as n,useMessages as a}from"../../internal/i18n.js";import{CloseIcon as r,severityIcon as l}from"../../internal/icons.js";import{controlSlots as c,cx as d,focusRingClasses as m,hasContent as p,iconClasses as u,metaTextClasses as f,radiusClasses as b,sheetBodyClasses as v,sheetHeaderGapClasses as x,sheetSectionGapClasses as h,sheetTitleClasses as y,surfaceClasses as g}from"../../internal/styles.js";const w={"top-start":"top-0 items-start","top-center":"top-0 items-center","top-end":"top-0 items-end","bottom-start":"bottom-0 items-start flex-col-reverse","bottom-center":"bottom-0 items-center flex-col-reverse","bottom-end":"bottom-0 items-end flex-col-reverse"},N={solid:[g,"text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--neba-shadow-3),var(--neba-plate-solid)]"].join(" "),outline:[g,"border text-(--neba-fg) bg-(--n-panel-press)","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]"].join(" "),text:[g,"text-(--neba-fg) bg-(--n-panel-press)","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]"].join(" ")},j={solid:"",outline:"text-(--n-accent)",text:"text-(--n-accent)"};function _(e){const{color:t,variant:o,icon:s,actionLabel:i,onAction:n,...a}=e;return{...a,data:{color:t,variant:o,icon:s},actionProps:void 0===i?void 0:{children:i,onClick:n}}}export function useToast(){const e=s.useToastManager();return o.useMemo(()=>({add:t=>e.add(_(t)),close:t=>e.close(t),update:(t,o)=>e.update(t,_(o)),promise:(t,o)=>e.promise(t,{loading:_(o.loading),success:e=>_("function"==typeof o.success?o.success(e):o.success),error:e=>_("function"==typeof o.error?o.error(e):o.error)}),toasts:e.toasts}),[e])}function T({toast:o,variant:n,color:a,size:g,density:w,closeLabel:_,swipeDirection:T,classNames:z}){const k=o.data?.variant??n??"outline",D=o.data?.color??a,L=void 0===o.data?.icon?l(D):o.data.icon,M=j[k],P=p(o.title);return t(s.Root,{toast:o,swipeDirection:T,className:d("pointer-events-auto flex w-full items-start",i[w??"default"][g],b[g],h[g],v[g],N[k],u,"[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0","data-[limited]:hidden",m,"[outline:none]",z?.toast),style:c(D,3,k),children:[p(L)?e("span",{className:`flex h-[1lh] shrink-0 items-center ${M}`,children:L}):null,t("div",{className:`flex min-w-0 flex-1 flex-col ${x[g]}`,children:[e(s.Title,{className:d("neba-title font-semibold",y[g],M,z?.title)}),e(s.Description,{className:d(P&&"solid"!==k?"text-(--neba-muted-fg)":"",z?.description)})]}),e(s.Action,{className:d("flex h-[1lh] shrink-0 cursor-pointer items-center rounded-full px-2","font-medium underline-offset-2",M||"text-(--n-on-solid)","hover:underline","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2",f[g],z?.action)}),e("span",{className:"flex h-[1lh] shrink-0 items-center",children:e(s.Close,{"aria-label":_,className:d("inline-flex size-[1.15em] cursor-pointer items-center justify-center rounded-full","opacity-70 [transition:opacity_var(--neba-duration)_var(--neba-ease)]","hover:opacity-100 focus-visible:opacity-100","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2",z?.close),children:e(r,{})})})]})}function z(t){const{toasts:i}=s.useToastManager(),{position:n,width:a,classNames:r,...l}=t,c=o.useMemo(()=>[n.startsWith("top")?"up":"down","left","right"],[n]);return e(s.Portal,{children:e(s.Viewport,{className:d("neba-portal pointer-events-none fixed inset-x-0 z-50 flex flex-col gap-2 p-4",w[n],r?.viewport),children:i.map(t=>e("div",{className:"w-full",style:{maxWidth:"number"==typeof a?`${a}px`:a},children:e(T,{toast:t,swipeDirection:c,classNames:r,...l})},t.id))})})}export function ToastProvider({variant:o="outline",size:i="md",color:r="primary",density:l="default",position:c="bottom-end",timeout:d=5e3,limit:m=3,width:p=380,locale:u,closeLabel:f,classNames:b,children:v}){const x=a(n,u);return t(s.Provider,{timeout:d,limit:m,children:[v,e(z,{position:c,variant:o,size:i,color:r,density:l,width:p,closeLabel:f??x.close,classNames:b})]})}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { NebaElevation, NebaStyleProps, NebaVariant } from '../../types.js';
|
|
3
|
+
export interface ToggleProps extends NebaStyleProps, Omit<React.ComponentPropsWithoutRef<'button'>, 'color' | 'value'> {
|
|
4
|
+
/**
|
|
5
|
+
* How the toggle looks while it is **off**. On is always the colour family
|
|
6
|
+
* asserting itself, whichever weight was asked for.
|
|
7
|
+
*
|
|
8
|
+
* - `solid` — a filled neutral plate that fills with the accent when it goes
|
|
9
|
+
* on. The loudest, for a toggle a screen is steered by.
|
|
10
|
+
* - `outline` — a hairline panel. The default.
|
|
11
|
+
* - `text` — nothing at all until it is hovered or on. What a toolbar wants.
|
|
12
|
+
* @default 'outline'
|
|
13
|
+
*/
|
|
14
|
+
variant?: NebaVariant;
|
|
15
|
+
/** Whether it is on. Use with `onPressedChange` for a controlled toggle. */
|
|
16
|
+
pressed?: boolean;
|
|
17
|
+
/** Whether it starts on, for an uncontrolled one. @default false */
|
|
18
|
+
defaultPressed?: boolean;
|
|
19
|
+
onPressedChange?: (pressed: boolean) => void;
|
|
20
|
+
/** Identifies the toggle inside a [ToggleGroup](./toggle-group). */
|
|
21
|
+
value?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Drop shadow depth. `0` (the default) is flat — the acrylic edge is what
|
|
24
|
+
* separates the toggle from the page.
|
|
25
|
+
* @default 0
|
|
26
|
+
*/
|
|
27
|
+
elevation?: NebaElevation;
|
|
28
|
+
/** Content placed before the label. Sized in `em`, so it tracks the label. */
|
|
29
|
+
startIcon?: React.ReactNode;
|
|
30
|
+
/** Content placed after the label. */
|
|
31
|
+
endIcon?: React.ReactNode;
|
|
32
|
+
/** Stretches to the width of the container. */
|
|
33
|
+
fullWidth?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The label. Left out, the toggle goes square around whatever icon it was
|
|
36
|
+
* given — which is what a toolbar toggle is. An icon-only toggle still needs
|
|
37
|
+
* an `aria-label`.
|
|
38
|
+
*/
|
|
39
|
+
children?: React.ReactNode;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A button that stays down.
|
|
43
|
+
*
|
|
44
|
+
* The difference from a [Switch](./switch) is what the press *is*: a switch
|
|
45
|
+
* changes a setting and the change is the point, a toggle changes the state of
|
|
46
|
+
* the thing beside it — bold on the selected words, the grid on the canvas, the
|
|
47
|
+
* filter on the list. The difference from a [Checkbox](./checkbox) is that this
|
|
48
|
+
* one is a control rather than an answer, so it never goes in a form.
|
|
49
|
+
*
|
|
50
|
+
* Base UI's Toggle owns `aria-pressed` and the controlled/uncontrolled pair.
|
|
51
|
+
* What is left here is the surface, and the rule that off is neutral.
|
|
52
|
+
*/
|
|
53
|
+
export declare const Toggle: React.ForwardRefExoticComponent<ToggleProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsxs as e}from"react/jsx-runtime";import*as n from"react";import{Toggle as t}from"@base-ui/react/toggle";import{ButtonGroupContext as o}from"../../internal/button-group.js";import{controlHeightClasses as r,controlSlots as s,controlSquareClasses as a,controlTextClasses as l,cx as i,disabledClasses as v,focusRingClasses as d,gapClasses as g,iconClasses as b,paddingXClasses as p,pressTransitionClasses as x,radiusClasses as c,surfaceClasses as f,transitionClasses as m}from"../../internal/styles.js";const h={xs:`${r.xs} ${g.xs} ${c.xs} ${l.xs}`,sm:`${r.sm} ${g.sm} ${c.sm} ${l.sm}`,md:`${r.md} ${g.md} ${c.md} ${l.md}`,lg:`${r.lg} ${g.lg} ${c.lg} ${l.lg}`,xl:`${r.xl} ${g.xl} ${c.xl} ${l.xl}`},u={xs:`${a.xs} px-0`,sm:`${a.sm} px-0`,md:`${a.md} px-0`,lg:`${a.lg} px-0`,xl:`${a.xl} px-0`},$=["relative inline-flex shrink-0 cursor-pointer select-none items-center justify-center","whitespace-nowrap align-middle font-medium leading-none","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",m,x,d,b].join(" "),j={solid:[f,"text-(--neba-muted-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]","hover:bg-(--n-panel-press) hover:text-(--neba-fg)","active:bg-(--n-panel-press)"].join(" "),outline:[f,"border text-(--neba-muted-fg) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]","hover:bg-(--n-panel-hover) hover:text-(--neba-fg) hover:[border-color:var(--n-line-hover)]","active:bg-(--n-panel-press)"].join(" "),text:["text-(--neba-muted-fg) bg-transparent","hover:bg-(--n-soft) hover:text-(--neba-fg)","active:bg-(--n-soft-hover)"].join(" ")},y={solid:[f,"text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]","hover:bg-(--n-fill-hover)","active:bg-(--n-fill-active)"].join(" "),outline:[f,"border text-(--n-accent) bg-(--n-soft)","[border-color:var(--n-line-hover)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]","hover:bg-(--n-soft-hover)","active:bg-(--n-soft-press)"].join(" "),text:["text-(--n-accent) bg-(--n-soft)","hover:bg-(--n-soft-hover)","active:bg-(--n-soft-press)"].join(" ")};export const Toggle=/*@__PURE__*/n.forwardRef(function({variant:r,size:a,color:l,density:d,elevation:g,pressed:b,defaultPressed:x,onPressedChange:c,value:f,startIcon:m,endIcon:w,fullWidth:P=!1,disabled:C,className:T,style:k,children:z,onPointerMove:E,...I},M){const N=n.useContext(o),R=r??N?.variant??"outline",W=a??N?.size??"md",X=l??N?.color??"primary",Y=d??N?.density??"default",q=g??N?.elevation??0,A=C??N?.disabled??!1,B=null==z||!1===z;return e(t,{ref:M,value:f,pressed:b,defaultPressed:x,onPressedChange:e=>c?.(e),disabled:A,className:e=>i($,h[W],B?u[W]:p[Y][W],A?v[R]:e.pressed?y[R]:j[R],A?"":"neba-glow",P?"w-full":"",T??""),style:{...s(X,q,R),...k},onPointerMove:e=>{if(!A){const n=e.currentTarget;n.style.setProperty("--n-mx",`${e.nativeEvent.offsetX}px`),n.style.setProperty("--n-my",`${e.nativeEvent.offsetY}px`)}E?.(e)},...I,children:[m,z,w]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{Toggle}from"./Toggle.js";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { NebaElevation, NebaOrientation, NebaStyleProps, NebaVariant } from '../../types.js';
|
|
3
|
+
export interface ToggleGroupProps extends NebaStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'defaultValue' | 'onChange'> {
|
|
4
|
+
/** Passed to every toggle in the set. @default 'outline' */
|
|
5
|
+
variant?: NebaVariant;
|
|
6
|
+
/**
|
|
7
|
+
* Which toggles are on, by their `value`. An array in both the single and the
|
|
8
|
+
* multiple case — Base UI's own shape, and the one that does not change type
|
|
9
|
+
* when `multiple` is turned on.
|
|
10
|
+
*/
|
|
11
|
+
value?: readonly string[];
|
|
12
|
+
/** Which start on, for an uncontrolled set. */
|
|
13
|
+
defaultValue?: readonly string[];
|
|
14
|
+
onValueChange?: (value: string[]) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Whether more than one can be on at a time. Off, turning one on turns the
|
|
17
|
+
* last one off — which is a one-of-a-set, and worth a second thought: if the
|
|
18
|
+
* choice is a *value* rather than a state, that is a
|
|
19
|
+
* [SegmentedButton](./segmented-button) or a [RadioGroup](./radio-group).
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
multiple?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Which way the toggles run.
|
|
25
|
+
* @default 'horizontal'
|
|
26
|
+
*/
|
|
27
|
+
orientation?: NebaOrientation;
|
|
28
|
+
/** Drop shadow depth, passed to every toggle in the set. @default 0 */
|
|
29
|
+
elevation?: NebaElevation;
|
|
30
|
+
/** Disables every toggle in the set at once. */
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/** Whether the arrow keys wrap around at the ends. @default true */
|
|
33
|
+
loopFocus?: boolean;
|
|
34
|
+
/** Stretches to the container and divides the width evenly between toggles. */
|
|
35
|
+
fullWidth?: boolean;
|
|
36
|
+
children?: React.ReactNode;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A set of toggles that share one state.
|
|
40
|
+
*
|
|
41
|
+
* Two things are happening, and only one of them is visual. The corners facing a
|
|
42
|
+
* neighbour are squared off — that is the look. The other half is that the set
|
|
43
|
+
* owns the value: the toggles report into one array, `multiple` decides whether
|
|
44
|
+
* more than one of them can be on, and `variant`, `size`, `color`, `density`,
|
|
45
|
+
* `elevation` and `disabled` are set once here rather than on every toggle.
|
|
46
|
+
*
|
|
47
|
+
* Base UI owns the roving tab index — one tab stop for the whole set, arrow keys
|
|
48
|
+
* between the members — which is what makes a toolbar of eight toggles two key
|
|
49
|
+
* presses deep instead of eight.
|
|
50
|
+
*/
|
|
51
|
+
export declare const ToggleGroup: React.ForwardRefExoticComponent<ToggleGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import*as o from"react";import{ToggleGroup as l}from"@base-ui/react/toggle-group";import{ButtonGroupContext as i}from"../../internal/button-group.js";import{cx as t}from"../../internal/styles.js";const n={horizontal:"[&>*:not(:first-child)]:rounded-s-none [&>*:not(:last-child)]:rounded-e-none",vertical:"[&>*:not(:first-child)]:rounded-t-none [&>*:not(:last-child)]:rounded-b-none"},r={horizontal:"[&>*:not(:first-child)]:-ms-px",vertical:"[&>*:not(:first-child)]:-mt-px"},a=["inline-flex align-middle","[&>*]:relative [&>*:hover]:z-10 [&>*:focus-visible]:z-10","[&>*]:shrink-0"].join(" ");export const ToggleGroup=/*@__PURE__*/o.forwardRef(function({variant:s,size:u,color:d,density:c,elevation:f,value:m,defaultValue:h,onValueChange:p,multiple:v=!1,orientation:g="horizontal",disabled:x,loopFocus:b=!0,fullWidth:z=!1,className:j,children:V,...w},y){const C=o.useMemo(()=>({variant:s,size:u,color:d,density:c,elevation:f,disabled:x}),[s,u,d,c,f,x]);return e(i.Provider,{value:C,children:e(l,{ref:y,value:m,defaultValue:h,onValueChange:e=>p?.(e),multiple:v,orientation:g,disabled:x,loopFocus:b,className:t(a,"vertical"===g?"flex-col":"flex-row",n[g],"outline"===(s??"outline")?r[g]:"",z?"flex w-full [&>*]:flex-1":"",j??""),...w,children:V})})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{ToggleGroup}from"./ToggleGroup.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import*as o from"react";import{useRender as n}from"@base-ui/react/use-render";import{boxPaddingXClasses as i,boxPaddingYClasses as s}from"../box/Box.js";import{
|
|
1
|
+
"use client";import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import*as o from"react";import{useRender as n}from"@base-ui/react/use-render";import{boxPaddingXClasses as i,boxPaddingYClasses as s}from"../box/Box.js";import{cx as a,hasContent as l,radiusClasses as c,sheetSectionGapClasses as d,surfaceClasses as m,surfaceSlots as b,transitionClasses as p}from"../../internal/styles.js";const f={solid:[m,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[m,"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"},x={static:{top:"",bottom:""},sticky:{top:"sticky top-0 z-20",bottom:"sticky bottom-0 z-20"},fixed:{top:"fixed inset-x-0 top-0 z-30",bottom:"fixed inset-x-0 bottom-0 z-30"}},v={top:"border-b [border-color:var(--n-line)]",bottom:"border-t [border-color:var(--n-line)]"};export const Toolbar=/*@__PURE__*/o.forwardRef(function({variant:o="outline",size:m="md",color:u="primary",density:g="default",elevation:h=0,position:w="static",side:y="top",divider:j=!1,start:k,end:z,render:N,className:B,style:F,children:R,...T},q){const A=a("flex w-full min-w-0 items-center",i[g][m],s[g][m],d[m],"static"===w?c[m]:"",f[o],j?v[y]:"",x[w][y],p,B??"");return n({render:N,ref:q,props:{className:A,style:{...b(u,h),...F},children:r(t,{children:[l(k)?e("div",{className:"flex min-w-0 shrink-0 items-center gap-2",children:k}):null,e("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:R}),l(z)?e("div",{className:"flex min-w-0 shrink-0 items-center gap-2",children:z}):null]}),...T}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{Tooltip as o}from"@base-ui/react/tooltip";import{controlSlots as i,
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{Tooltip as o}from"@base-ui/react/tooltip";import{controlSlots as i,cx as s,metaTextClasses as n,paddingXClasses as l,radiusClasses as r,surfaceClasses as d}from"../../internal/styles.js";export const TooltipProvider=o.Provider;const p=[d,"max-w-64 text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--neba-shadow-3),var(--neba-plate-solid)]","[outline:none]","[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0","data-[instant]:[transition-duration:0ms]"].join(" "),c={xs:"py-0.5",sm:"py-0.5",md:"py-1",lg:"py-1.5",xl:"py-2"},m={xs:6,sm:7,md:8,lg:9,xl:10};export function Tooltip({content:d,children:h,size:y="sm",color:f="secondary",density:u="default",side:x="top",align:b="center",sideOffset:g=6,delay:v,closeDelay:w,arrow:j=!0,open:O,defaultOpen:N,onOpenChange:P,disabled:T=!1,className:z,style:C,...D}){const _=m[y],k=a.useId(),[A,B]=a.useState(N??!1),I=O??A;return t(o.Root,{open:O,defaultOpen:N,onOpenChange:e=>{void 0===O&&B(e),P?.(e)},children:[e(o.Trigger,{render:h,delay:v,closeDelay:w,disabled:T,"aria-describedby":I?k:void 0}),e(o.Portal,{children:e(o.Positioner,{className:"neba-portal z-50 [outline:none]",side:x,align:b,sideOffset:g,children:t(o.Popup,{id:k,role:"tooltip",className:s(p,r[y],l[u][y],c[y],n[y],z??""),style:{...i(f,3,"solid"),...C},...D,children:[j?e(o.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:e("svg",{width:_,height:_/2,viewBox:"0 0 10 5","aria-hidden":"true",className:"block",children:e("path",{d:"M0 0h10L5 5z",fill:"var(--n-fill)"})})}):null,d]})})})]})}
|