neba 1.12.0 → 1.13.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/LICENSE +1 -1
- package/README.md +43 -41
- package/dist/components/accordion/Accordion.d.ts +18 -0
- package/dist/components/accordion/Accordion.js +1 -1
- package/dist/components/anchor/Anchor.js +1 -1
- package/dist/components/animate-marquee/AnimateMarquee.d.ts +5 -3
- package/dist/components/animate-marquee/AnimateMarquee.js +1 -1
- package/dist/components/animate-scramble/AnimateScramble.js +1 -1
- package/dist/components/app-logo/AppLogo.js +1 -1
- package/dist/components/bottom-navigation/BottomNavigation.d.ts +10 -0
- package/dist/components/bottom-navigation/BottomNavigation.js +1 -1
- package/dist/components/button/Button.js +1 -1
- package/dist/components/calendar/Calendar.js +1 -1
- package/dist/components/carousel/Carousel.d.ts +13 -0
- package/dist/components/carousel/Carousel.js +1 -1
- package/dist/components/code-block/CodeBlock.js +1 -1
- package/dist/components/color-picker/ColorPicker.js +1 -1
- package/dist/components/combobox/Combobox.d.ts +18 -0
- package/dist/components/combobox/Combobox.js +1 -1
- package/dist/components/command-palette/CommandPalette.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/drawer/Drawer.js +1 -1
- package/dist/components/gauge-chart/GaugeChart.js +1 -1
- package/dist/components/grid/Grid.d.ts +11 -1
- package/dist/components/grid/Grid.js +1 -1
- package/dist/components/hover-card/HoverCard.js +1 -1
- package/dist/components/image/Image.d.ts +32 -4
- package/dist/components/image/Image.js +1 -1
- package/dist/components/menu/Menu.js +1 -1
- package/dist/components/meter/Meter.d.ts +7 -0
- package/dist/components/meter/Meter.js +1 -1
- package/dist/components/navigation-menu/NavigationMenu.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/panes/Panes.js +1 -1
- package/dist/components/popover/Popover.js +1 -1
- package/dist/components/progress-circular/ProgressCircular.d.ts +10 -1
- package/dist/components/progress-circular/ProgressCircular.js +1 -1
- package/dist/components/progress-linear/ProgressLinear.d.ts +7 -1
- package/dist/components/progress-linear/ProgressLinear.js +1 -1
- package/dist/components/provider/NebaProvider.js +1 -1
- package/dist/components/scatter-chart/ScatterChart.js +1 -1
- package/dist/components/scroll-area/ScrollArea.js +1 -1
- package/dist/components/scroll-zone/ScrollZone.d.ts +8 -7
- package/dist/components/scroll-zone/ScrollZone.js +1 -1
- package/dist/components/select/Select.d.ts +13 -0
- package/dist/components/select/Select.js +1 -1
- package/dist/components/slider/Slider.d.ts +37 -2
- package/dist/components/slider/Slider.js +1 -1
- package/dist/components/tabs/Tabs.d.ts +18 -0
- package/dist/components/tabs/Tabs.js +1 -1
- package/dist/components/text-field/TextField.js +1 -1
- package/dist/components/time-picker/TimePicker.js +1 -1
- package/dist/components/timeline-chart/TimelineChart.js +1 -1
- package/dist/components/toast/Toast.js +1 -1
- package/dist/components/tooltip/Tooltip.js +1 -1
- package/dist/components/tour/Tour.js +1 -1
- package/dist/components/transfer/Transfer.js +1 -1
- package/dist/components/tree-select/TreeSelect.d.ts +2 -0
- package/dist/components/tree-select/TreeSelect.js +1 -1
- package/dist/components/typography/Typography.js +1 -1
- package/dist/internal/cache.d.ts +24 -0
- package/dist/internal/cache.js +1 -0
- package/dist/internal/calendar.d.ts +15 -42
- package/dist/internal/calendar.js +1 -1
- package/dist/internal/chart-frame.d.ts +16 -3
- package/dist/internal/chart-frame.js +1 -1
- package/dist/internal/date.js +1 -1
- package/dist/internal/drag.d.ts +8 -6
- package/dist/internal/drag.js +1 -1
- package/dist/internal/format.d.ts +21 -7
- package/dist/internal/format.js +1 -1
- package/dist/internal/grid.d.ts +16 -0
- package/dist/internal/grid.js +1 -1
- package/dist/internal/i18n.d.ts +72 -0
- package/dist/internal/i18n.js +1 -1
- package/dist/internal/icons.d.ts +25 -0
- package/dist/internal/icons.js +1 -1
- package/dist/internal/link.d.ts +5 -4
- package/dist/internal/media.js +1 -1
- package/dist/internal/observe.js +1 -1
- package/dist/internal/picker.d.ts +8 -3
- package/dist/internal/picker.js +1 -1
- package/dist/internal/progress.d.ts +24 -1
- package/dist/internal/progress.js +1 -1
- package/dist/internal/styles.d.ts +73 -3
- package/dist/internal/styles.js +1 -1
- package/dist/internal/text.d.ts +0 -10
- package/dist/internal/text.js +1 -1
- package/dist/internal/wheel.d.ts +38 -0
- package/dist/internal/wheel.js +1 -0
- 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 +131 -6
- package/package.json +2 -2
|
@@ -90,7 +90,7 @@ export interface NebaImageProtection {
|
|
|
90
90
|
}
|
|
91
91
|
/** Where a picture is in its own life. */
|
|
92
92
|
type Phase = 'loading' | 'loaded' | 'failed';
|
|
93
|
-
export interface ImageProps extends Omit<React.ComponentPropsWithoutRef<'img'>, '
|
|
93
|
+
export interface ImageProps extends Omit<React.ComponentPropsWithoutRef<'img'>, 'children'> {
|
|
94
94
|
/** Required, and required to be right. See the note on the component. */
|
|
95
95
|
alt: string;
|
|
96
96
|
/**
|
|
@@ -98,12 +98,27 @@ export interface ImageProps extends Omit<React.ComponentPropsWithoutRef<'img'>,
|
|
|
98
98
|
*
|
|
99
99
|
* This is the whole reason to use this over an `<img>`: a picture with no
|
|
100
100
|
* reserved box is a picture that pushes the page down when it lands, which is
|
|
101
|
-
* the single largest source of layout shift on most sites. `'auto'`
|
|
102
|
-
*
|
|
103
|
-
*
|
|
101
|
+
* the single largest source of layout shift on most sites. `'auto'` lets the
|
|
102
|
+
* file decide — and `width` and `height` are how you tell it what the file
|
|
103
|
+
* will say, so the box is right before anything has arrived.
|
|
104
104
|
* @default 'auto'
|
|
105
105
|
*/
|
|
106
106
|
ratio?: number | string | 'auto';
|
|
107
|
+
/**
|
|
108
|
+
* The file's own pixel dimensions, as an `<img>` takes them.
|
|
109
|
+
*
|
|
110
|
+
* They are the platform's own answer to layout shift, and they are what to
|
|
111
|
+
* reach for when the proportion is the picture's rather than the layout's:
|
|
112
|
+
* `ratio` says "hold this shape whatever arrives", these two say "this is
|
|
113
|
+
* what will arrive". Give both and an `'auto'` ratio becomes their
|
|
114
|
+
* proportion, so the box is reserved without anybody working out that 1200 by
|
|
115
|
+
* 800 is 3/2.
|
|
116
|
+
*
|
|
117
|
+
* They reach the `<img>` either way. One on its own reserves nothing, since
|
|
118
|
+
* a proportion needs two numbers.
|
|
119
|
+
*/
|
|
120
|
+
width?: number | string;
|
|
121
|
+
height?: number | string;
|
|
107
122
|
/** How the picture fills that box. @default 'cover' */
|
|
108
123
|
fit?: NebaAspectFit;
|
|
109
124
|
/** Rounds the corners at this step of the radius ladder. `false` for square. */
|
|
@@ -163,6 +178,19 @@ export interface ImageProps extends Omit<React.ComponentPropsWithoutRef<'img'>,
|
|
|
163
178
|
* @default false
|
|
164
179
|
*/
|
|
165
180
|
protect?: boolean | NebaImageProtection;
|
|
181
|
+
/**
|
|
182
|
+
* Which language the picture names its own absence in — a BCP 47 tag such as
|
|
183
|
+
* `ko`, `pt-BR` or `zh-Hant`. Unsupported tags fall back to English.
|
|
184
|
+
*
|
|
185
|
+
* It is read for one string, and only when a file fails and there is no `alt`
|
|
186
|
+
* to put in its place. `unavailableLabel` writes the words out instead.
|
|
187
|
+
*/
|
|
188
|
+
locale?: string;
|
|
189
|
+
/**
|
|
190
|
+
* What the box says when the file does not arrive and `alt` is empty.
|
|
191
|
+
* Defaults to the `locale`'s wording.
|
|
192
|
+
*/
|
|
193
|
+
unavailableLabel?: string;
|
|
166
194
|
/** Class names for the parts behind the root. */
|
|
167
195
|
classNames?: NebaSlots<ImageSlot>;
|
|
168
196
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t,Fragment as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as a from"react";import{AspectRatio as o}from"../aspect-ratio/AspectRatio.js";import{Skeleton as r}from"../skeleton/Skeleton.js";import{useStyleDefaults as l}from"../../internal/defaults.js";import{imageMessages as s,useMessages as i}from"../../internal/i18n.js";import{cx as c,metaTextValues as u,radiusClasses as d,toLength as f}from"../../internal/styles.js";const m={cover:"object-cover",contain:"object-contain",fill:"object-fill",none:"object-none"},p={none:"none",grayscale:"grayscale(1)",sepia:"sepia(0.72)",invert:"invert(1)",saturate:"saturate(1.5)",mute:"saturate(0.45)",contrast:"contrast(1.25)"},b={"top-start":"items-start justify-start","top-end":"items-start justify-end","bottom-start":"items-end justify-start","bottom-end":"items-end justify-end",center:"items-center justify-center"},g=a.lazy(()=>import("../dialog/Dialog.js").then(e=>({default:e.Dialog})));function h(e,t){switch(e){case"rect":return{borderRadius:"0px"};case"circle":return{borderRadius:"50%"};case"arch":return{borderRadius:`50% 50% ${t} ${t} / 55% 55% ${t} ${t}`};case"cut":return{clipPath:`polygon(${t} 0, calc(100% - ${t}) 0, 100% ${t}, 100% calc(100% - ${t}), calc(100% - ${t}) 100%, ${t} 100%, 0 calc(100% - ${t}), 0 ${t})`};default:return{borderRadius:t}}}function v(e){const t=t=>`linear-gradient(to ${t}, transparent, #000 ${e}, #000 calc(100% - ${e}), transparent)`,n=`${t("right")}, ${t("bottom")}`;return{maskImage:n,maskComposite:"intersect",WebkitMaskImage:n,WebkitMaskComposite:"source-in"}}export const Image=/*@__PURE__*/a.forwardRef(function(y,x){const{alt:$,ratio:k="auto",width:w,height:N,fit:j="cover",rounded:S=!1,placeholder:C,fallback:z,onLoadingStatusChange:M,preview:R=!1,filter:D="none",frame:_,watermark:I,protect:W=!1,locale:E,unavailableLabel:F,className:L,classNames:A,style:H,src:O,...P}=l(y,["locale"]),T=i(s,E),[U,q]=a.useState("loading"),[B,G]=a.useState(!1),J=a.useRef(null),K=a.useRef(M);a.useEffect(()=>{K.current=M});const Q=a.useCallback(e=>{J.current=e,"function"==typeof x?x(e):x&&(x.current=e)},[x]);a.useEffect(()=>{const e=J.current,t=O&&e?.complete?e.naturalWidth>0?"loaded":"failed":null;q(t??"loading"),t&&K.current?.(t)},[O]);const V=e=>{q(e),M?.(e)},X=!1===S?"":d[!0===S?"md":S],Y=D in p?p[D]:D,Z=!0===W?{}:!1===W?null:W,ee=null!==Z&&!1!==Z.contextMenu,te=null!==Z&&!1!==Z.drag,ne=null!==Z&&!1!==Z.select,ae=e=>e.preventDefault(),oe=Z?{onContextMenu:ee?ae:void 0,onDragStart:te?ae:void 0,draggable:!te&&void 0,className:ne?"select-none":"",style:ne?{WebkitTouchCallout:"none"}:void 0}:null,re=e("img",{ref:Q,src:O,alt:$,width:w,height:N,className:c("block size-full",m[j],X,"[transition:opacity_var(--neba-duration-fill)_var(--neba-ease),filter_var(--neba-duration-fill)_var(--neba-ease)]","loaded"===U?"opacity-100":"opacity-0",oe?.className,A?.image),style:{filter:"none"===Y?void 0:Y,...oe?.style},onLoad:()=>V("loaded"),onError:()=>V("failed"),onContextMenu:oe?.onContextMenu,onDragStart:oe?.onDragStart,draggable:oe?.draggable,...P}),le="failed"===U?e("span",{className:c("absolute inset-0 flex items-center justify-center","bg-(--neba-disabled-bg) text-(--neba-muted-fg)",X,A?.fallback),children:z??e("span",{className:"px-2 text-center text-sm",children:$||F||T.unavailable})}):"loading"===U&&!1!==C?e("span",{className:c("absolute inset-0",A?.placeholder),children:C??e(r,{shape:"rect",className:c("size-full",X)})}):null,se=void 0===I?null:function(t,n){const a="string"==typeof t?{content:t}:t,{content:o,position:r="bottom-end",repeat:l=!1,opacity:s=.35,size:i="xs",color:d="#ffffff"}=a,m="string"==typeof i&&i in u?u[i]:f(i)??u.xs,p=a.rotate??(l&&"string"==typeof o?-24:0);if(l&&"string"==typeof o){const t=function(e,t){let n=0;for(const t of e)n+=/[ᄀ-ᇿ⺀-가-豈-︰-﹏]/.test(t)?1:.6;const a=Math.max(16,Math.round(16*(n+2.4))),o=e.replace(/[&<>]/g,e=>"&"===e?"&":"<"===e?"<":">");return{uri:`data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="${a}" height="52"><text x="0" y="32" font-family="system-ui, sans-serif" font-size="16" fill="${t}" stroke="rgba(0,0,0,0.28)" stroke-width="0.6" paint-order="stroke">${o}</text></svg>`)}`,width:a,height:52}}(o,d);return e("span",{"aria-hidden":"true",className:c("pointer-events-none absolute select-none",n),style:{inset:"-40%",opacity:s,transform:`rotate(${p}deg)`,backgroundImage:`url("${t.uri}")`,backgroundSize:`calc(${m} * ${t.width/16}) calc(${m} * ${t.height/16})`}})}return e("span",{"aria-hidden":"true",className:c("pointer-events-none absolute inset-0 flex select-none p-2",b[r],n),children:e("span",{style:{color:d,opacity:s,fontSize:m,lineHeight:1.2,textShadow:"0 1px 2px rgba(0, 0, 0, 0.45)",transform:p?`rotate(${p}deg)`:void 0},children:o})})}(I,A?.watermark),ie=t("span",{className:"relative block size-full",children:[re,le,se]}),ce="auto"===k?function(e,t){const n="number"==typeof e?e:Number(e),a="number"==typeof t?t:Number(t);return Number.isFinite(n)&&Number.isFinite(a)&&n>0&&a>0?n/a:null}(w,N):null,ue=ce??k,de=void 0===_?null:function(e,t){const n=!0===t?"md":t;return{shape:"rounded",corner:!1===n?"md":n,..."string"==typeof e?{shape:e}:e}}(_,S),fe=null===de?"0px":function(e){return"string"==typeof e&&e in d?`var(--neba-radius-${e})`:f(e)??"0px"}(de.corner??"md"),me=null===de?void 0:f(de.mat),pe=null===de?void 0:f(de.feather),be={...null===de?null:h(de.shape,fe),...void 0===pe?null:v(pe),...null===de?H:null},ge="auto"===ue?e("span",{className:c("relative block overflow-hidden",null===de?X:"",null===de?L:""),style:be,children:ie}):e(o,{ratio:ue,className:c("overflow-hidden",null===de?X:"",null===de?L:""),style:be,children:ie}),he=null===de?void 0:function(e){if(void 0===e.border||!1===e.border)return;const t=!0===e.border?"1px":f(e.border);return`inset 0 0 0 ${t} ${e.borderColor??"var(--neba-line)"}`}(de),ve=void 0===me?fe:`calc(${fe} + ${me})`,ye=null===de?ge:t("span",{className:c("relative block",A?.frame,L),style:{...h(de.shape,ve),padding:me,background:de.background??(void 0===me?void 0:"var(--neba-surface)"),boxShadow:de.elevation?`var(--neba-shadow-${de.elevation})`:void 0,...H},children:[ge,void 0===he?null:e("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0",style:{...h(de.shape,ve),boxShadow:he}})]});return R?t(n,{children:[e("button",{type:"button","aria-label":$,className:c("block w-full cursor-zoom-in [outline:none]","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:2px]",X),onClick:()=>G(!0),children:ye}),e(a.Suspense,{fallback:null,children:e(g,{open:B,onOpenChange:G,size:"xl",title:$,children:t("span",{className:"relative mx-auto block w-fit",children:[e("img",{src:O,alt:$,className:c("mx-auto block max-h-[70vh] w-auto max-w-full",oe?.className),style:{filter:"none"===Y?void 0:Y,...oe?.style},onContextMenu:oe?.onContextMenu,onDragStart:oe?.onDragStart,draggable:oe?.draggable}),se]})})})]}):ye});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as n,Fragment as l}from"react/jsx-runtime";import*as t from"react";import{Menu as
|
|
1
|
+
"use client";import{jsx as e,jsxs as n,Fragment as l}from"react/jsx-runtime";import*as t from"react";import{Menu as a}from"@base-ui/react/menu";import{ContextMenu as s}from"@base-ui/react/context-menu";import{MenuContext as o}from"../../internal/menu.js";import{CheckIcon as r,ChevronIcon as i,DotIcon as c}from"../../internal/icons.js";import{safeRel as d}from"../../internal/link.js";import{controlTextLeadingClasses as u,cx as m,gapClasses as p,hasContent as h,iconClasses as x,metaTextClasses as b,popupFadeClasses as f,radiusClasses as g,surfaceClasses as N,surfaceSlots as y,transitionClasses as C}from"../../internal/styles.js";const k=[N,"max-h-[min(24rem,var(--available-height))] min-w-40 overflow-y-auto overscroll-contain","border bg-(--n-panel-press) p-1","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]","[outline:none]",f].join(" "),v={default:{xs:"px-1.5 py-0.5",sm:"px-2 py-1",md:"px-2.5 py-1.5",lg:"px-3 py-2",xl:"px-3.5 py-2.5"},compact:{xs:"px-1 py-0.5",sm:"px-1.5 py-0.5",md:"px-2 py-1",lg:"px-2.5 py-1",xl:"px-3 py-1.5"}},O={xs:g.xs,sm:g.xs,md:g.sm,lg:g.sm,xl:g.md};function z(e,n,l,t){return m("relative flex w-full cursor-pointer items-center select-none",l?"text-(--n-accent)":"text-(--neba-fg)",v[n][e],O[e],p[e],u[e],C,x,"data-[highlighted]:bg-(--n-soft-hover)","data-[popup-open]:bg-(--n-soft)","data-[disabled]:cursor-not-allowed data-[disabled]:text-(--neba-disabled-fg)","[outline:none]",t??"")}const I="flex h-[1lh] w-[1.2em] shrink-0 items-center justify-center";function M({children:l,description:t,size:a}){return h(t)?n("span",{className:"flex min-w-0 flex-1 flex-col text-start",children:[e("span",{className:"truncate",children:l}),e("span",{className:`truncate text-(--neba-muted-fg) ${b[a]}`,children:t})]}):e("span",{className:"min-w-0 flex-1 truncate text-start",children:l})}export function MenuItem({onClick:s,href:r,target:i,rel:c,startIcon:u,endIcon:m,shortcut:p,description:x,color:f,closeOnClick:g=!0,disabled:N=!1,label:C,children:k,className:v,style:O}){const j=t.useContext(o),{size:$,density:w}=j,P=n(l,{children:[h(u)?e("span",{className:`${I} text-(--neba-muted-fg)`,children:u}):null,e(M,{description:x,size:$,children:k}),h(m)?e("span",{className:`${I} text-(--neba-muted-fg)`,children:m}):null,h(p)?e("span",{className:`ms-2 shrink-0 text-(--neba-muted-fg) tabular-nums ${b[$]}`,children:p}):null]}),R=f?y(f,0):void 0,F=R||O?{...R,...O}:void 0;return void 0!==r?e(a.LinkItem,{href:r,target:i,rel:d(i,c),label:C,closeOnClick:g,onClick:s,className:z($,w,Boolean(f),v),style:F,children:P}):e(a.Item,{disabled:N,label:C,closeOnClick:g,onClick:s,className:z($,w,Boolean(f),v),style:F,children:P})}export function MenuCheckboxItem({checked:l,defaultChecked:s,onCheckedChange:i,endIcon:c,shortcut:d,description:u,color:m,closeOnClick:p=!1,disabled:x=!1,label:f,children:g,className:N,style:C}){const{size:k,density:v}=t.useContext(o),O=m?y(m,0):void 0;return n(a.CheckboxItem,{checked:l,defaultChecked:s,onCheckedChange:e=>i?.(e),disabled:x,label:f,closeOnClick:p,className:z(k,v,Boolean(m),N),style:O||C?{...O,...C}:void 0,children:[e("span",{className:`${I} text-(--n-accent)`,children:e(a.CheckboxItemIndicator,{className:"flex items-center justify-center",children:e(r,{})})}),e(M,{description:u,size:k,children:g}),h(c)?e("span",{className:`${I} text-(--neba-muted-fg)`,children:c}):null,h(d)?e("span",{className:`ms-2 shrink-0 text-(--neba-muted-fg) tabular-nums ${b[k]}`,children:d}):null]})}export function MenuRadioGroup({value:n,defaultValue:l,onValueChange:t,disabled:s=!1,children:o,className:r}){return e(a.RadioGroup,{value:n,defaultValue:l,onValueChange:e=>t?.(e),disabled:s,className:r,children:o})}export function MenuRadioItem({value:l,endIcon:s,shortcut:r,description:i,color:d,closeOnClick:u=!1,disabled:m=!1,label:p,children:x,className:f,style:g}){const{size:N,density:C}=t.useContext(o),k=d?y(d,0):void 0;return n(a.RadioItem,{value:l,disabled:m,label:p,closeOnClick:u,className:z(N,C,Boolean(d),f),style:k||g?{...k,...g}:void 0,children:[e("span",{className:`${I} text-(--n-accent)`,children:e(a.RadioItemIndicator,{className:"flex items-center justify-center",children:e(c,{})})}),e(M,{description:i,size:N,children:x}),h(s)?e("span",{className:`${I} text-(--neba-muted-fg)`,children:s}):null,h(r)?e("span",{className:`ms-2 shrink-0 text-(--neba-muted-fg) tabular-nums ${b[N]}`,children:r}):null]})}export function MenuGroup({label:l,children:s,className:r}){const{size:i,density:c}=t.useContext(o);return n(a.Group,{className:r,children:[h(l)?e(a.GroupLabel,{className:[v[c][i],b[i],"font-semibold tracking-wide text-(--neba-muted-fg) uppercase"].join(" "),children:l}):null,s]})}export function MenuSeparator({className:n,...l}){return e(a.Separator,{className:m("-mx-1 my-1 h-px bg-(--n-line)",n??""),...l})}export function MenuSubmenu({label:l,startIcon:s,disabled:r=!1,side:c="right",sideOffset:d=4,children:p,className:x,style:b}){const f=t.useContext(o),{size:N,density:C,color:v}=f;return n(a.SubmenuRoot,{children:[n(a.SubmenuTrigger,{disabled:r,className:z(N,C,!1),children:[h(s)?e("span",{className:`${I} text-(--neba-muted-fg)`,children:s}):null,e("span",{className:"min-w-0 flex-1 truncate text-start",children:l}),e("span",{className:`${I} text-(--neba-muted-fg) -rotate-90`,children:e(i,{})})]}),e(a.Portal,{children:e(a.Positioner,{className:"neba-portal z-(--neba-z-portal) [outline:none]",side:c,sideOffset:d,align:"start",children:e(a.Popup,{className:m(k,g[N],u[N],x??""),style:{...y(v,3),...b},children:p})})})]})}export function Menu({size:l="md",color:s="primary",density:r="default",trigger:i,open:c,defaultOpen:d,onOpenChange:p,side:h="bottom",align:x="start",sideOffset:b=6,modal:f,openOnHover:N=!1,loopFocus:C=!0,disabled:v=!1,className:O,style:z,children:I}){const M=t.useMemo(()=>({size:l,color:s,density:r}),[l,s,r]);return e(o.Provider,{value:M,children:n(a.Root,{open:c,defaultOpen:d,onOpenChange:e=>p?.(e),modal:f,loopFocus:C,disabled:v,children:[i?e(a.Trigger,{render:i,openOnHover:N,disabled:v}):null,e(a.Portal,{children:e(a.Positioner,{className:"neba-portal z-(--neba-z-portal) [outline:none]",side:h,align:x,sideOffset:b,children:e(a.Popup,{className:m(k,g[l],u[l],O??""),style:{...y(s,3),...z},children:I})})})]})})}export function ContextMenu({size:l="md",color:a="primary",density:r="default",content:i,children:c,open:d,defaultOpen:p,onOpenChange:h,loopFocus:x=!0,disabled:b=!1,className:f,style:N}){const C=t.useMemo(()=>({size:l,color:a,density:r}),[l,a,r]);return e(o.Provider,{value:C,children:n(s.Root,{open:d,defaultOpen:p,onOpenChange:e=>h?.(e),loopFocus:x,disabled:b,children:[e(s.Trigger,{children:c}),e(s.Portal,{children:e(s.Positioner,{className:"neba-portal z-(--neba-z-portal) [outline:none]",children:e(s.Popup,{className:m(k,g[l],u[l],f??""),style:{...y(a,3),...N},children:i})})})]})})}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { type ProgressThickness } from '../../internal/progress.js';
|
|
2
3
|
import type { NebaColor, NebaSize, NebaThreshold } from '../../types.js';
|
|
3
4
|
export interface MeterProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'children'> {
|
|
4
5
|
/**
|
|
@@ -32,6 +33,12 @@ export interface MeterProps extends Omit<React.ComponentPropsWithoutRef<'div'>,
|
|
|
32
33
|
thresholds?: readonly NebaThreshold[];
|
|
33
34
|
/** Thickness of the groove. Nothing else on a bar has a size. @default 'md' */
|
|
34
35
|
size?: NebaSize;
|
|
36
|
+
/**
|
|
37
|
+
* The groove's thickness in pixels, when the step's own is not the one you
|
|
38
|
+
* want. The same prop a [ProgressLinear](./progress-linear) takes, because
|
|
39
|
+
* the two draw the same groove.
|
|
40
|
+
*/
|
|
41
|
+
thickness?: ProgressThickness;
|
|
35
42
|
/** The family the bar carries before any threshold is reached. @default 'primary' */
|
|
36
43
|
color?: NebaColor;
|
|
37
44
|
}
|
|
@@ -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 r from"react";import{Meter as l}from"@base-ui/react/meter";import{barThicknessClasses as t,progressFraction as s,progressSlots as n,thresholdColor as i}from"../../internal/progress.js";import{cx as o,metaTextClasses as m,stackGapClasses as u}from"../../internal/styles.js";import{useStyleDefaults as f}from"../../internal/defaults.js";export const Meter=/*@__PURE__*/r.forwardRef(function(r,c){const{value:d,min:b=0,max:h=100,label:p,showValue:v=!1,format:x,thresholds:j,thickness:g,size:w="md",color:y="primary",className:N,style:k,..._}=f(r,["size"]),M=s(d,b,h),$=i(d,y,j),z=void 0!==x;return a(l.Root,{ref:c,value:d,min:b,max:h,format:x,className:o("flex w-full flex-col",u[w],N??""),style:{...n($),...k},..._,children:[p||v?a("div",{className:["flex items-baseline gap-2",p?"justify-between":"justify-end",m[w]].join(" "),children:[p?e(l.Label,{className:"min-w-0 truncate text-(--neba-fg)",children:p}):null,v?e(l.Value,{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:e=>z?e:`${Math.round(100*(M??0))}%`}):null]}):null,e(l.Track,{className:`relative w-full overflow-hidden rounded-full bg-(--n-soft) ${t[w]}`,style:void 0===g?void 0:{height:`${g}px`},children:e(l.Indicator,{className:"absolute top-0 rounded-full bg-(--n-fill) [transition:width_var(--neba-duration-fill)_var(--neba-ease),background-color_var(--neba-duration)_var(--neba-ease)]"})})]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as n,Fragment as a}from"react/jsx-runtime";import*as t from"react";import{NavigationMenu as i}from"@base-ui/react/navigation-menu";import{ChevronIcon as r}from"../../internal/icons.js";import{safeRel as o}from"../../internal/link.js";import{controlHeightClasses as s,controlTextClasses as l,controlTextLeadingClasses as d,cx as c,gapClasses as u,hasContent as f,iconClasses as p,metaTextClasses as m,paddingXClasses as h,popupFadeStateClasses as b,radiusClasses as
|
|
1
|
+
"use client";import{jsx as e,jsxs as n,Fragment as a}from"react/jsx-runtime";import*as t from"react";import{NavigationMenu as i}from"@base-ui/react/navigation-menu";import{ChevronIcon as r}from"../../internal/icons.js";import{safeRel as o}from"../../internal/link.js";import{controlHeightClasses as s,controlTextClasses as l,controlTextLeadingClasses as d,cx as c,gapClasses as u,hasContent as f,iconClasses as p,metaTextClasses as m,paddingXClasses as h,popupFadeStateClasses as b,radiusClasses as g,surfaceClasses as v,surfaceSlots as x,transitionClasses as N}from"../../internal/styles.js";const y=/*@__PURE__*/t.createContext({size:"md",density:"default"}),w=["inline-flex shrink-0 cursor-pointer select-none items-center justify-center","whitespace-nowrap font-medium leading-none no-underline","text-(--neba-fg) bg-transparent","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",N,p,"hover:bg-(--n-soft)","data-[popup-open]:bg-(--n-soft-hover) data-[popup-open]:text-(--n-accent)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2","data-[disabled]:cursor-not-allowed data-[disabled]:text-(--neba-disabled-fg)","data-[disabled]:hover:bg-transparent"].join(" "),j=[v,"relative border text-(--neba-fg) bg-(--n-panel-press)","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]","[outline:none] overflow-hidden","[transition:opacity_var(--neba-duration)_var(--neba-ease),width_var(--neba-duration)_var(--neba-ease),height_var(--neba-duration)_var(--neba-ease)]",b].join(" "),_=["flex min-w-0 cursor-pointer items-start no-underline","text-(--neba-fg) bg-transparent",N,p,"hover:bg-(--n-soft)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]"].join(" "),z={xs:"p-1",sm:"p-1.5",md:"p-2",lg:"p-2.5",xl:"p-3"};export const NavigationMenuLink=/*@__PURE__*/t.forwardRef(function({href:a,title:r,description:o,startIcon:s,className:l,children:p,...b},v){const{size:x,density:N}=t.useContext(y);return n(i.Link,{ref:v,href:a,className:c(_,g[x],u[x],h[N??"default"][x],"py-2",l??""),...b,children:[f(s)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:s}):null,n("span",{className:"flex min-w-0 flex-col gap-0.5",children:[e("span",{className:`font-medium ${d[x]}`,children:r}),f(o)?e("span",{className:`text-(--neba-muted-fg) ${m[x]}`,children:o}):null,p]})]})});export function NavigationMenuItem({label:d,href:c,target:p,rel:m,startIcon:b,value:v,disabled:x=!1,columns:N=1,children:j}){const{size:_,density:k}=t.useContext(y),C=void 0!==c&&!f(j),$=[w,s[_],l[_],u[_],h[k??"default"][_],g[_]].join(" ");return e(i.Item,{value:v,children:C?n(i.Link,{href:c,target:p,rel:o(p,m),className:$,children:[f(b)?b:null,d]}):n(a,{children:[n(i.Trigger,{disabled:x,className:$,children:[f(b)?b:null,d,e(i.Icon,{className:"flex items-center [transition:rotate_var(--neba-duration)_var(--neba-ease)] data-[popup-open]:rotate-180",children:e(r,{})})]}),e(i.Content,{className:`grid gap-1 ${z[_]}`,style:N>1?{gridTemplateColumns:`repeat(${N}, minmax(0, 1fr))`}:void 0,children:j})]})})}export const NavigationMenu=/*@__PURE__*/t.forwardRef(function({size:a="md",color:r="primary",density:o="default",orientation:s="horizontal",value:l,defaultValue:d,onValueChange:c,delay:f,closeDelay:p,sideOffset:m=8,className:h,style:b,children:v,...N},w){const _=t.useMemo(()=>({size:a,density:o}),[a,o]),z=x(r,3);return e(y.Provider,{value:_,children:n(i.Root,{ref:w,orientation:s,value:l,defaultValue:d,onValueChange:e=>c?.(e),delay:f,closeDelay:p,className:h,style:{...z,...b},...N,children:[e(i.List,{className:["flex items-center","vertical"===s?"flex-col items-stretch":"flex-row",u[a]].join(" "),children:v}),e(i.Portal,{children:e(i.Positioner,{className:"neba-portal z-(--neba-z-portal) [outline:none]",sideOffset:m,collisionPadding:12,children:e(i.Popup,{className:`${j} ${g[a]}`,style:z,children:e(i.Viewport,{})})})})]})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import{NumberField as t}from"@base-ui/react/number-field";import{Field as a}from"@base-ui/react/field";import{numberMessages as l,useMessages as r}from"../../internal/i18n.js";import{MinusIcon as s,PlusIcon as i}from"../../internal/icons.js";import{keyHandler as o}from"../../internal/keys.js";import{
|
|
1
|
+
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import{NumberField as t}from"@base-ui/react/number-field";import{Field as a}from"@base-ui/react/field";import{numberMessages as l,useMessages as r}from"../../internal/i18n.js";import{MinusIcon as s,PlusIcon as i}from"../../internal/icons.js";import{keyHandler as o}from"../../internal/keys.js";import{controlTextLeadingClasses as c,cx as d,disabledClasses as m,fieldFocusTransitionClasses as u,fieldHeightClasses as p,fieldReadOnlyClasses as f,fieldRestClasses as b,fieldRingClasses as h,gapClasses as x,hasContent as g,iconClasses as v,metaTextClasses as N,paddingXClasses as j,radiusClasses as y,stackGapClasses as w,surfaceSlots as k,transitionClasses as S}from"../../internal/styles.js";import{useStyleDefaults as _}from"../../internal/defaults.js";const V=["group relative flex w-full cursor-text items-center","[-webkit-tap-highlight-color:transparent]",S,u,h,v].join(" "),z=["inline-flex size-[1.7em] shrink-0 cursor-pointer items-center justify-center","rounded-(--neba-radius-xs) text-(--neba-muted-fg) select-none","[&_svg]:size-[0.9em] [&_svg]:shrink-0","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]","[transition:background-color_var(--neba-duration)_var(--neba-ease),color_var(--neba-duration)_var(--neba-ease)]","active:[transition-duration:0ms]","hover:bg-(--n-soft) hover:text-(--n-accent)","active:bg-(--n-soft-press)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1","disabled:cursor-not-allowed disabled:bg-transparent disabled:text-(--neba-disabled-fg)"].join(" ");export function NumberField(u){const{variant:h="outline",size:v="md",color:S="primary",density:C="default",elevation:I=0,value:O,defaultValue:D,onValueChange:L,onValueCommitted:W,min:q,max:F,step:R,largeStep:B,smallStep:E,snapOnStep:G,allowWheelScrub:K=!1,format:$,locale:A,steppers:H="end",incrementLabel:J,decrementLabel:M,label:P,description:Q,error:T,invalid:U,startIcon:X,endIcon:Y,fullWidth:Z=!1,disabled:ee=!1,readOnly:ne=!1,required:te=!1,name:ae,placeholder:le,id:re,className:se,classNames:ie,shortcuts:oe,style:ce,...de}=_(u,["size","density","variant","locale"]),me=r(l,"string"==typeof A?A:void 0),ue=g(T),pe=U??ue,fe=pe?"danger":S,be=j[C][v],he={end:`${be} pe-1`,split:"px-1",none:be},xe=e(t.Decrement,{"aria-label":M??me.decrease,className:d(z,ie?.stepper),children:e(s,{})}),ge=e(t.Increment,{"aria-label":J??me.increase,className:d(z,ie?.stepper),children:e(i,{})}),ve="none"!==H&&!ne;return n(a.Root,{disabled:ee,invalid:pe,className:d("flex-col align-top",w[v],Z?"flex w-full":"inline-flex",se??""),style:{...k(fe,I),...ce},...de,children:[P?e(a.Label,{className:d(N[v],"font-medium",ee?"text-(--neba-disabled-fg)":"text-(--neba-fg)",ie?.label),children:P}):null,e(t.Root,{id:re,name:ae,className:"contents",value:O,defaultValue:D,onValueChange:e=>L?.(e),onValueCommitted:e=>W?.(e),min:q,max:F,step:R,largeStep:B,smallStep:E,snapOnStep:G,allowWheelScrub:K,format:$,locale:A,disabled:ee,readOnly:ne,required:te,children:n(t.Group,{className:d(V,p[v],c[v],y[v],x[v],ve?he[H]:be,ee?m[h]:ne?f[h]:b[h],ie?.shell),children:[ve&&"split"===H?xe:null,X?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:X}):null,e(t.Input,{onKeyDown:o(oe),placeholder:le,className:["min-w-0 flex-1 self-stretch bg-transparent [font:inherit] text-inherit","[outline:none]","tabular-nums","split"===H&&ve?"text-center":"","placeholder:text-(--neba-muted-fg)","caret-(--n-accent) selection:bg-(--n-soft-press)","disabled:cursor-not-allowed",ie?.control].filter(Boolean).join(" ")}),Y?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:Y}):null,ve&&"end"===H?n("span",{className:"flex shrink-0 items-center gap-0.5",children:[xe,ge]}):null,ve&&"split"===H?ge:null]})}),Q?e(a.Description,{className:d(N[v],"text-(--neba-muted-fg)",ie?.description),children:Q}):null,e(a.Error,ue?{match:!0,className:d(N[v],"text-(--n-accent)",ie?.error),children:T}:{className:d(N[v],"text-(--n-accent)",ie?.error)})]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{Field as n}from"@base-ui/react/field";import{OTPField as l}from"@base-ui/react/otp-field";import{cx as r,disabledClasses as i,fieldReadOnlyClasses as
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{Field as n}from"@base-ui/react/field";import{OTPField as l}from"@base-ui/react/otp-field";import{cx as r,disabledClasses as i,fieldReadOnlyClasses as o,fieldRestClasses as s,metaTextClasses as m,stackGapClasses as d,surfaceSlots as u,transitionClasses as c}from"../../internal/styles.js";import{useStyleDefaults as p}from"../../internal/defaults.js";const f={xs:"h-7 w-6",sm:"h-8 w-7",md:"h-10 w-8",lg:"h-12 w-10",xl:"h-14 w-12"},x={xs:"rounded-[0.3125rem]",sm:"rounded-[0.375rem]",md:"rounded-[0.4375rem]",lg:"rounded-[0.5625rem]",xl:"rounded-[0.6875rem]"},g={xs:"text-[0.8125rem]",sm:"text-[0.9375rem]",md:"text-[1.0625rem]",lg:"text-[1.25rem]",xl:"text-[1.5rem]"},h={default:{xs:"gap-1",sm:"gap-1",md:"gap-1.5",lg:"gap-2",xl:"gap-2.5"},compact:{xs:"gap-0.5",sm:"gap-0.5",md:"gap-1",lg:"gap-1",xl:"gap-1.5"}},b={numeric:"numeric",alpha:"alpha",alphanumeric:"alphanumeric",any:"none"};export const OtpField=/*@__PURE__*/t.forwardRef(function(v,y){const{variant:N="outline",size:V="md",color:w="primary",density:j="default",elevation:C=0,length:F=6,charset:M="numeric",mask:_=!1,groupSize:z,separator:I="–",value:O,defaultValue:R,onValueChange:S,onComplete:k,onValueInvalid:q,autoSubmit:A=!1,label:D,description:E,error:L,invalid:T,name:B,required:G=!1,disabled:H=!1,readOnly:J=!1,autoFocus:K=!1,className:P,style:Q,...U}=p(v,["size","density","variant"]),W=Math.min(12,Math.max(2,Math.round(F))),X=null!=L&&!1!==L&&""!==L,Y=T??X,Z=Y?"danger":w,$=r("text-center font-medium [font-family:inherit]",f[V],g[V],x[V],c,"caret-(--n-accent) selection:bg-(--n-soft-press)","[outline:0_solid_var(--n-ring)] outline-offset-0 focus:[outline:2px_solid_var(--n-ring)]","focus:[transition-duration:var(--neba-duration)]",H?i[N]:J?o[N]:s[N]),ee=z&&z>0?Math.round(z):0;return a(n.Root,{disabled:H,invalid:Y,className:r("inline-flex flex-col align-top",d[V],P),style:{...u(Z,C),...Q},children:[D?e(n.Label,{className:r(m[V],"font-medium",H?"text-(--neba-disabled-fg)":"text-(--neba-fg)"),children:D}):null,e(l.Root,{ref:y,length:W,validationType:b[M],mask:_,name:B,required:G,disabled:H,readOnly:J,autoSubmit:A,value:O,defaultValue:R,onValueChange:e=>S?.(e),onValueComplete:e=>k?.(e),onValueInvalid:e=>q?.(e),className:r("flex items-center",h[j][V]),...U,children:Array.from({length:W},(n,i)=>a(t.Fragment,{children:[ee>0&&i>0&&i%ee===0?e("span",{"aria-hidden":"true",className:r("select-none px-0.5 text-(--neba-muted-fg)",g[V]),children:I}):null,e(l.Input,{className:$,autoFocus:K&&0===i})]},i))}),E?e(n.Description,{className:r(m[V],"text-(--neba-muted-fg)"),children:E}):null,e(n.Error,X?{match:!0,className:r(m[V],"text-(--n-accent)"),children:L}:{className:r(m[V],"text-(--n-accent)")})]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import{Dialog as l}from"@base-ui/react/dialog";import{overlayMessages as r,useMessages as
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import{Dialog as l}from"@base-ui/react/dialog";import{overlayMessages as r,useMessages as n}from"../../internal/i18n.js";import{cx as s,popupFadeClasses as t,surfaceSlots as i}from"../../internal/styles.js";import{useStyleDefaults as o}from"../../internal/defaults.js";const c={scrim:"bg-(--neba-scrim) [backdrop-filter:blur(2px)]",blur:"[background-color:color-mix(in_oklab,var(--neba-scrim)_55%,transparent)] [backdrop-filter:blur(14px)_saturate(1.4)]",solid:"bg-(--neba-surface)",clear:""},m={start:"items-start",center:"items-center",end:"items-end"},p={xs:"p-3",sm:"p-4",md:"p-6",lg:"p-8",xl:"p-10"};export function Overlay(d){const{open:b,defaultOpen:f,onOpenChange:u,tone:x="scrim",dismissible:g=!1,modal:j=!0,align:h="center",size:y="md",color:k="primary",locale:z,label:O,className:N,style:P,children:_,...v}=o(d,["size","locale"]),w=n(r,z);return e(l.Root,{open:b,defaultOpen:f,modal:j,disablePointerDismissal:!g,onOpenChange:(e,a)=>{g||e||"escape-key"!==a.reason?u?.(e):a.cancel()},children:a(l.Portal,{children:[e(l.Backdrop,{className:`neba-portal fixed inset-0 z-(--neba-z-portal) ${t} ${c[x]}`}),e(l.Viewport,{className:["neba-portal fixed inset-0 z-(--neba-z-portal) flex justify-center",m[h],p[y]].join(" "),children:e(l.Popup,{"aria-label":O??w.label,className:s("flex max-h-full max-w-full flex-col items-center justify-center","[outline:none]",t,N??""),style:{...i(k,0),...P},...v,children:_})})]})})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as t from"react";import{beginPointerDrag as r}from"../../internal/drag.js";import{observeResize as i}from"../../internal/observe.js";import{cx as o,toPixels as a,transitionClasses as l}from"../../internal/styles.js";import{useStyleDefaults as s}from"../../internal/defaults.js";const c=/*@__PURE__*/t.createContext({basis:null}),u={xs:"basis-1",sm:"basis-1.5",md:"basis-2",lg:"basis-2.5",xl:"basis-3"},f={xs:4,sm:6,md:8,lg:10,xl:12};function m(e,n,t){if(null!=e)return"number"==typeof e?n*e/100:a(e,{percentOf:n,relativeTo:t})}export const Panes=/*@__PURE__*/t.forwardRef(function(a,d){const{orientation:h="horizontal",resizable:p=!0,color:g="primary",size:x="md",onResize:v,onResizeEnd:b,className:z,style:w,children:y,...R}=s(a,["size"]),M=t.Children.toArray(y).filter(t.isValidElement),S=M.length,j=t.useRef(null),C=t.useCallback(e=>{j.current=e,"function"==typeof d?d(e):d&&(d.current=e)},[d]),k=t.useRef([]);k.current=M.map(e=>e.props);const[N
|
|
1
|
+
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as t from"react";import{beginPointerDrag as r}from"../../internal/drag.js";import{observeResize as i}from"../../internal/observe.js";import{cx as o,toPixels as a,transitionClasses as l}from"../../internal/styles.js";import{useStyleDefaults as s}from"../../internal/defaults.js";const c=/*@__PURE__*/t.createContext({basis:null}),u={xs:"basis-1",sm:"basis-1.5",md:"basis-2",lg:"basis-2.5",xl:"basis-3"},f={xs:4,sm:6,md:8,lg:10,xl:12};function m(e,n,t){if(null!=e)return"number"==typeof e?n*e/100:a(e,{percentOf:n,relativeTo:t})}export const Panes=/*@__PURE__*/t.forwardRef(function(a,d){const{orientation:h="horizontal",resizable:p=!0,color:g="primary",size:x="md",onResize:v,onResizeEnd:b,className:z,style:w,children:y,...R}=s(a,["size"]),M=t.Children.toArray(y).filter(t.isValidElement),S=M.length,j=t.useRef(null),C=t.useCallback(e=>{j.current=e,"function"==typeof d?d(e):d&&(d.current=e)},[d]),k=t.useRef([]);k.current=M.map(e=>e.props);const[E,N]=t.useState(null),$=E&&E.length===S?E:null,A=t.useRef(null);t.useEffect(()=>{A.current=$});const D="horizontal"===h,P=f[x]*Math.max(0,S-1);function I(e){const n=j.current,t=A.current;if(!p||!n||!t||void 0===t[e+1])return null;const r=n.getBoundingClientRect(),i=(D?r.width:r.height)-P;if(i<=0)return null;const o=k.current[e],a=k.current[e+1],l=t[e]*i,s=l+t[e+1]*i,c=Math.max(m(o?.minSize,i,n)??0,s-(m(a?.maxSize,i,n)??s)),u=Math.min(m(o?.maxSize,i,n)??s,s-(m(a?.minSize,i,n)??0));return u<c?null:{root:n,current:t,extent:i,start:l,pair:s,resize(n){const r=Math.min(u,Math.max(c,l+n)),o=[...t];return o[e]=r/i,o[e+1]=(s-r)/i,N(o),v?.(o.map(e=>100*e)),o}}}t.useEffect(()=>{const e=j.current;if(!e)return;const n=()=>{const n=e.getBoundingClientRect(),t=(D?n.width:n.height)-P;t<=0||N(n=>n&&n.length===S?n:function(e,n,t){const r=e.map(e=>m(e.defaultSize,n,t)),i=r.reduce((e,n)=>e+(n??0),0),o=r.filter(e=>void 0===e).length,a=o>0?Math.max(0,n-i)/o:0,l=r.map(e=>Math.max(0,e??a)),s=l.reduce((e,n)=>e+n,0);return s<=0?l.map(()=>1/Math.max(1,l.length)):l.map(e=>e/s)}(k.current,t,e))};return n(),i(e,n)},[S,D,P]);const B=t.useRef(null);t.useEffect(()=>()=>B.current?.(),[]);const F=o("group/handle relative z-1 flex shrink-0 grow-0 items-center justify-center",u[x],l,"[outline:none] focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-0",p?o(D?"cursor-col-resize":"cursor-row-resize","hover:bg-(--n-soft) data-[dragging]:bg-(--n-soft)"):"");return e("div",{ref:C,className:o("flex h-full w-full",D?"flex-row":"flex-col","min-h-0 min-w-0",z),style:{"--n-accent":`var(--neba-${g}-accent)`,"--n-soft":`var(--neba-${g}-soft)`,"--n-ring":`var(--neba-${g}-ring)`,...w},...R,children:M.map((i,a)=>n(t.Fragment,{children:[a>0?e("div",{role:"separator","aria-orientation":D?"vertical":"horizontal","aria-valuenow":$?Math.round(100*$[a-1]):void 0,"aria-valuemin":0,"aria-valuemax":100,"aria-disabled":!p||void 0,tabIndex:p?0:-1,className:F,onPointerDown:e=>{0===e.button&&function(e,n){const t=I(e);if(!t)return;const i=n.currentTarget,o=D?n.clientX:n.clientY,a=D&&"rtl"===getComputedStyle(t.root).direction?-1:1;let l=t.current;B.current=r({target:i,pointerId:n.pointerId,onMove:e=>{const n=D?e.clientX:e.clientY;l=t.resize((n-o)*a)},onEnd:()=>{B.current=null,b?.(l.map(e=>100*e))}})}(a-1,e)},onKeyDown:e=>{const n=D?"ArrowLeft":"ArrowUp",t=D?"ArrowRight":"ArrowDown";e.key!==n&&e.key!==t||(e.preventDefault(),function(e,n){const t=I(e);if(!t)return;const r=t.resize(n);b?.(r.map(e=>100*e))}(a-1,e.key===t?16:-16))},children:e("span",{"aria-hidden":"true",className:o("pointer-events-none bg-(--neba-border)",l,D?"h-full w-px":"h-px w-full",p?"group-hover/handle:bg-(--n-accent) group-focus-visible/handle:bg-(--n-accent) group-data-[dragging]/handle:bg-(--n-accent)":"")})}):null,e(c.Provider,{value:{basis:$?`calc((100% - ${P}px) * ${$[a].toFixed(6)})`:null},children:i})]},i.key??a))})});export const Pane=/*@__PURE__*/t.forwardRef(function({defaultSize:n,minSize:r,maxSize:i,className:a,style:l,children:s,...u},f){const{basis:m}=t.useContext(c);return e("div",{ref:f,className:o("relative min-h-0 min-w-0 overflow-auto",a),style:{flex:m?`0 0 ${m}`:"1 1 0%",...l},...u,children:s})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Popover as
|
|
1
|
+
"use client";import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Popover as a}from"@base-ui/react/popover";import{boxPaddingXClasses as s,boxPaddingYClasses as t}from"../box/Box.js";import{actionMessages as l,useMessages as n}from"../../internal/i18n.js";import{CloseIcon as r}from"../../internal/icons.js";import{cx as i,hasContent as d,metaTextClasses as c,popupFadeClasses as m,radiusClasses as f,sheetBodyClasses as p,sheetHeaderGapClasses as u,sheetSectionGapClasses as h,sheetTitleClasses as x,surfaceClasses as b,surfaceSlots as g}from"../../internal/styles.js";import{useStyleDefaults as v}from"../../internal/defaults.js";const w={xs:"max-w-56",sm:"max-w-64",md:"max-w-80",lg:"max-w-96",xl:"max-w-lg"},j=[b,"relative flex flex-col","border text-(--neba-fg) bg-(--n-panel-press)","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]","[outline:none]",m].join(" "),N={xs:8,sm:9,md:10,lg:11,xl:12};export const PopoverClose=a.Close;export function Popover(m){const{size:b="md",color:k="primary",density:y="default",trigger:O,title:_,description:z,children:C,side:P="bottom",align:$="center",sideOffset:B=6,alignOffset:L=0,arrow:M=!1,open:T,defaultOpen:W,onOpenChange:A,modal:D=!1,dismissible:E=!0,showClose:R=!1,locale:q,closeLabel:F,width:G,className:H,style:I,...J}=v(m,["size","density","locale"]),K=n(l,q),Q=s[y][b],S=t[y][b],U=N[b],V=d(_)||d(z);return o(a.Root,{open:T,defaultOpen:W,modal:D,onOpenChange:(e,o)=>{E||e||"escape-key"!==o.reason&&"outside-press"!==o.reason&&"focus-out"!==o.reason?A?.(e):o.cancel()},children:[O?e(a.Trigger,{render:O}):null,e(a.Portal,{children:e(a.Positioner,{className:"neba-portal z-(--neba-z-portal) [outline:none]",side:P,align:$,sideOffset:B,alignOffset:L,children:o(a.Popup,{className:i(j,f[b],p[b],h[b],Q,S,void 0===G?w[b]:"",H??""),style:{...g(k,3),...void 0===G?null:{maxWidth:"number"==typeof G?`${G}px`:G},...I},...J,children:[M?e(a.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:o("svg",{width:U,height:U/2,viewBox:"0 0 10 5","aria-hidden":"true",className:"block",children:[e("path",{d:"M0 0h10L5 5z",fill:"var(--n-panel-press)"}),e("path",{d:"M0 0 5 5 10 0",fill:"none",stroke:"var(--n-line)",strokeWidth:"1",vectorEffect:"non-scaling-stroke"})]})}):null,V||R?o("div",{className:"flex shrink-0 items-start gap-3",children:[o("div",{className:`flex min-w-0 flex-1 flex-col ${u[b]}`,children:[d(_)?e(a.Title,{className:`m-0 font-semibold ${x[b]}`,children:_}):null,d(z)?e(a.Description,{className:`m-0 text-(--neba-muted-fg) ${c[b]}`,children:z}):null]}),R?e(a.Close,{"aria-label":F??K.close,className:["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(" "),children:e(r,{})}):null]}):null,d(C)?e("div",{className:"min-w-0",children:C}):null]})})})]})}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { type ProgressSharedProps } from '../../internal/progress.js';
|
|
2
|
+
import { type ProgressSharedProps, type ProgressThickness } from '../../internal/progress.js';
|
|
3
3
|
import type { NebaColor, NebaSize } from '../../types.js';
|
|
4
4
|
export interface ProgressCircularProps extends ProgressSharedProps {
|
|
5
5
|
/** Diameter of the ring. Sits just under the control ladder at every step. */
|
|
6
6
|
size?: NebaSize;
|
|
7
7
|
/** @default 'primary' */
|
|
8
8
|
color?: NebaColor;
|
|
9
|
+
/**
|
|
10
|
+
* The ring's stroke in pixels, when the step's own is not the one you want —
|
|
11
|
+
* a heavier dial for a reading a screen is actually about. `size` still sets
|
|
12
|
+
* the diameter, so this is how thick the ring is and not how big.
|
|
13
|
+
*
|
|
14
|
+
* Held to less than half the radius: a stroke past that closes the hole and
|
|
15
|
+
* the ring stops being one.
|
|
16
|
+
*/
|
|
17
|
+
thickness?: ProgressThickness;
|
|
9
18
|
}
|
|
10
19
|
/**
|
|
11
20
|
* A ring that fills, and the one to reach for when there is no room for a bar —
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as a from"react";import{Progress as s}from"@base-ui/react/progress";import{progressAriaText as t,progressFraction as n,progressSlots as i,progressText as l,ringDiameters as o,ringStrokes as
|
|
1
|
+
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as a from"react";import{Progress as s}from"@base-ui/react/progress";import{progressAriaText as t,progressFraction as n,progressSlots as i,progressText as l,ringDiameters as o,ringStrokes as m}from"../../internal/progress.js";import{cx as c,gapClasses as f,metaTextClasses as u}from"../../internal/styles.js";import{useStyleDefaults as h}from"../../internal/defaults.js";export const ProgressCircular=/*@__PURE__*/a.forwardRef(function(a,d){const{size:x="md",color:k="primary",value:p=null,min:b=0,max:g=100,label:v,showValue:y=!1,format:$,thickness:j,className:N,style:w,...M}=h(a,["size"]),V=n(p,b,g),z=null===V,D=void 0!==$,L=o[x],P=L/2,R=Math.min(Math.max(j??m[x],.5),P),W=P-R/2,_=2*Math.PI*W,A=z?`${.28*_} ${_}`:`${_}`,B=z?0:_*(1-V);return r(s.Root,{ref:d,value:p??null,min:b,max:g,format:$,getAriaValueText:t(V,D),className:c("inline-flex items-center",f[x],u[x],N??""),style:{...i(k),...w},...M,children:[r("svg",{className:z?"neba-ring-spin shrink-0":"shrink-0",width:L,height:L,viewBox:`0 0 ${L} ${L}`,fill:"none","aria-hidden":"true",children:[e("circle",{cx:P,cy:P,r:W,stroke:"var(--n-soft)",strokeWidth:R}),e("circle",{cx:P,cy:P,r:W,stroke:"var(--n-accent)",strokeWidth:R,strokeLinecap:"round",strokeDasharray:A,strokeDashoffset:B,transform:`rotate(-90 ${P} ${P})`,className:"[transition:stroke-dashoffset_var(--neba-duration-fill)_var(--neba-ease)]"})]}),v?e(s.Label,{className:"min-w-0 truncate text-(--neba-fg)",children:v}):null,y?e(s.Value,{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:e=>l(V,e,D)}):null]})});
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { type ProgressSharedProps } from '../../internal/progress.js';
|
|
2
|
+
import { type ProgressSharedProps, type ProgressThickness } from '../../internal/progress.js';
|
|
3
3
|
import type { NebaColor, NebaSize } from '../../types.js';
|
|
4
4
|
export interface ProgressLinearProps extends ProgressSharedProps {
|
|
5
5
|
/** Thickness of the groove. Nothing else on a bar has a size. */
|
|
6
6
|
size?: NebaSize;
|
|
7
7
|
/** @default 'primary' */
|
|
8
8
|
color?: NebaColor;
|
|
9
|
+
/**
|
|
10
|
+
* The groove's thickness in pixels, when the step's own is not the one you
|
|
11
|
+
* want — a heavier bar for a page that is about the one number. `size` still
|
|
12
|
+
* sets the type scale beside it.
|
|
13
|
+
*/
|
|
14
|
+
thickness?: ProgressThickness;
|
|
9
15
|
}
|
|
10
16
|
/**
|
|
11
17
|
* A bar that fills. The workhorse: it is the only one of the three that can
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as a from"react";import{Progress as r}from"@base-ui/react/progress";import{barThicknessClasses as s,progressAriaText as
|
|
1
|
+
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as a from"react";import{Progress as r}from"@base-ui/react/progress";import{barThicknessClasses as s,progressAriaText as t,progressFraction as n,progressSlots as i,progressText as o}from"../../internal/progress.js";import{cx as m,metaTextClasses as u,stackGapClasses as f}from"../../internal/styles.js";import{useStyleDefaults as c}from"../../internal/defaults.js";export const ProgressLinear=/*@__PURE__*/a.forwardRef(function(a,d){const{size:b="md",color:p="primary",value:x=null,min:h=0,max:g=100,label:j,showValue:v=!1,format:w,thickness:y,className:N,style:k,...V}=c(a,["size"]),z=n(x,h,g),L=null===z,R=void 0!==w;return l(r.Root,{ref:d,value:x??null,min:h,max:g,format:w,getAriaValueText:t(z,R),className:m("flex w-full flex-col",f[b],N??""),style:{...i(p),...k},...V,children:[j||v?l("div",{className:["flex items-baseline gap-2",j?"justify-between":"justify-end",u[b]].join(" "),children:[j?e(r.Label,{className:"min-w-0 truncate text-(--neba-fg)",children:j}):null,v?e(r.Value,{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:e=>o(z,e,R)}):null]}):null,e(r.Track,{className:`relative w-full overflow-hidden rounded-full bg-(--n-soft) ${s[b]}`,style:void 0===y?void 0:{height:`${y}px`},children:e(r.Indicator,{className:["absolute rounded-full bg-(--n-fill)",L?"neba-sweep":"top-0 [transition:width_var(--neba-duration-fill)_var(--neba-ease)]"].join(" ")})})]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e}from"react/jsx-runtime";import*as t from"react";import{DirectionProvider as r}from"@base-ui/react/direction-provider";import{DefaultsContext as o}from"../../internal/defaults.js";import{useMediaQuery as c}from"../../internal/media.js";const n=/*@__PURE__*/t.createContext(null);export function colorSchemeScript(e={}){const t=e.storageKey??"neba-color-scheme",r=e.defaultColorScheme??"system";return`(function(){try{var s=localStorage.getItem(${
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import*as t from"react";import{DirectionProvider as r}from"@base-ui/react/direction-provider";import{DefaultsContext as o}from"../../internal/defaults.js";import{useMediaQuery as c}from"../../internal/media.js";const n=/*@__PURE__*/t.createContext(null);export function colorSchemeScript(e={}){const t=e.storageKey??"neba-color-scheme",r=e.defaultColorScheme??"system";return`(function(){try{var s=localStorage.getItem(${l(t)})||${l(r)};if(s==='system'){s=matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light'}document.documentElement.setAttribute('data-theme',s)}catch(e){}})()`}function l(e){return JSON.stringify(e).replace(/</g,"\\u003c")}export function NebaProvider({children:l,defaults:s,colorScheme:a,defaultColorScheme:m="system",onColorSchemeChange:i,storageKey:u="neba-color-scheme",colorSchemeElement:d,direction:h}){const[f,S]=t.useState(()=>function(e){if(!1===e||"undefined"==typeof localStorage)return null;try{const t=localStorage.getItem(e);return"light"===t||"dark"===t||"system"===t?t:null}catch{return null}}(u)??m),g=a??f,p=c("(prefers-color-scheme: dark)"),y="system"===g?p?"dark":"light":g,C=t.useCallback(e=>{if(void 0===a&&S(e),!1!==u)try{localStorage.setItem(u,e)}catch{}i?.(e)},[a,u,i]);t.useEffect(()=>{const e=d?d():document.documentElement;e&&(e.setAttribute("data-theme",y),e.style.colorScheme=y)},[y,d]),t.useEffect(()=>{h&&document.documentElement.setAttribute("dir",h)},[h]);const b=t.useMemo(()=>({colorScheme:g,resolvedColorScheme:y,setColorScheme:C,toggleColorScheme:()=>C("dark"===y?"light":"dark")}),[g,y,C]);return e(o.Provider,{value:s??null,children:e(n.Provider,{value:b,children:e(r,{direction:h??"ltr",children:l})})})}export function useColorScheme(){const e=t.useContext(n);if(!e)throw new Error("neba: useColorScheme() needs a <NebaProvider> above it.");return e}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as
|
|
1
|
+
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as l from"react";import{CartesianChart as a,markTransitionClasses as t}from"../../internal/chart-frame.js";import{bubbleRadius as s,formatCategory as i,markerRadii as o,markGap as n,markPath as c,markShapes as u,plotHeights as d,pointX as h}from"../../internal/chart.js";import{cx as m,srOnlyClasses as x}from"../../internal/styles.js";import{useStyleDefaults as p}from"../../internal/defaults.js";export function ScatterChart(r){const{shape:t="auto",pointRadius:i,maxRadius:n,series:m,categories:x,size:v="md",xAxis:y,...z}=p(r,["size"]),g=i??o[v],j=n??Math.max(g+2,("number"==typeof z.height?z.height:d[v])/12),k=m.reduce((e,r)=>r.color?e:e+1,0),$="auto"===t||"varied"===t?"circle":t,w="varied"===t||"auto"===t&&k>3,M=l.useCallback(e=>w?u[e%u.length]:$,[w,$]),N=l.useCallback(e=>{const r=[];let l=0;return e.values.forEach(e=>{e.forEach(e=>{null!==e.value&&void 0!==e.z&&Number.isFinite(e.z)&&(l=Math.max(l,e.z))})}),e.values.forEach((a,t)=>{e.visible[t]&&a.forEach((a,i)=>{if(null===a.value)return;const o=h(a,i,x);null!==o&&r.push({series:t,index:i,x:e.categoryValuePx(o),y:e.valuePx(a.value),r:void 0===a.z?g:s(a.z,l,j,2)})})}),r},[x,g,j]);return e(a,{...z,series:m,categories:x,size:v,xScale:"value",xAxis:y,marks:N,markInset:j,includeZero:!1,swatch:(r,l)=>e("svg",{viewBox:"0 0 10 10",className:"size-2.5 overflow-visible","aria-hidden":"true",children:e("path",{d:c(M(r),5,5,4),fill:l})}),table:(r,l)=>e(b,{id:r,series:m,categories:x,label:z.label,xLabel:y?.label,yLabel:z.yAxis?.label,locale:z.locale,format:l}),children:r=>e(f,{context:r,shapeOf:M})})}function f({context:r,shapeOf:a}){const{marks:s,values:i,colors:o,hovered:u,activeMark:d}=r,h=l.useMemo(()=>[...s].sort((e,r)=>r.r-e.r),[s]);return e("g",{children:h.map(r=>{const l=i[r.series]?.[r.index],s=null!==u&&u!==r.series,h=d?.series===r.series&&d?.index===r.index;return e("path",{d:c(a(r.series),r.x,r.y,r.r),fill:l?.color??o[r.series],stroke:"var(--neba-chart-gap)",strokeWidth:n,opacity:s?.28:1,className:t,style:{transformBox:"view-box",transformOrigin:`${r.x}px ${r.y}px`,scale:h&&r.r>0?(r.r+1)/r.r:1}},`${r.series}-${r.index}`)})})}const b=/*@__PURE__*/l.memo(function({id:l,series:a,categories:t,label:s,xLabel:o,yLabel:n,locale:c,format:u}){const d=a.some(e=>e.data.some(e=>"object"==typeof e&&null!==e&&void 0!==e.z));return r("table",{id:l,className:m(x),children:[s?e("caption",{children:s}):null,e("thead",{children:r("tr",{children:[e("th",{scope:"col"}),e("th",{scope:"col",children:o??"x"}),e("th",{scope:"col",children:n??"y"}),d?e("th",{scope:"col",children:"z"}):null]})}),e("tbody",{children:a.flatMap((l,a)=>l.data.map((s,o)=>{const n="object"==typeof s&&null!==s?s:null,h=n?n.y:"number"==typeof s?s:null,m=n?.x??t?.[o]??o;return r("tr",{children:[e("th",{scope:"row",children:l.name??a+1}),e("td",{children:i(m,c)}),e("td",{children:null!==h&&Number.isFinite(h)?u(h):""}),d?e("td",{children:void 0===n?.z?"":u(n.z)}):null]},`${a}-${o}`)}))})]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as r,jsxs as e}from"react/jsx-runtime";import*as a from"react";import{ScrollArea as n}from"@base-ui/react/scroll-area";import{cx as o,focusRingClasses as l,toLength as t}from"../../internal/styles.js";import{useStyleDefaults as i}from"../../internal/defaults.js";const s={xs:"0.25rem",sm:"0.3125rem",md:"0.375rem",lg:"0.5rem",xl:"0.625rem"},c={xs:"1rem",sm:"1.25rem",md:"1.5rem",lg:"2rem",xl:"2.5rem"},m=["flex touch-none select-none rounded-full p-px","bg-transparent hover:bg-(--n-soft)","opacity-0 transition-[opacity,background-color] duration-(--neba-duration) ease-(--neba-ease)","data-[hovering]:opacity-100 data-[scrolling]:opacity-100 data-[scrolling]:duration-0"].join(" "),h="flex-1 rounded-full bg-(--n-thumb) hover:bg-(--n-thumb-hover)";export const ScrollArea=/*@__PURE__*/a.forwardRef(function(a,d){const{orientation:b="vertical",height:u,maxHeight:f,size:g="md",color:p="primary",fade:x=!1,className:v,style:y,children:N,...j}=i(a,["size"]),w="vertical"===b||"both"===b,$="horizontal"===b||"both"===b;return e(n.Root,{ref:d,className:o("relative overflow-hidden",v??""),style:{"--n-soft":`var(--neba-${p}-soft)`,"--n-ring":`var(--neba-${p}-ring)`,"--n-thumb":`color-mix(in oklab, var(--neba-${p}-accent) 35%, transparent)`,"--n-thumb-hover":`color-mix(in oklab, var(--neba-${p}-accent) 55%, transparent)`,"--n-rail":s[g],"--n-fade":c[g],height:t(u),maxHeight:t(f),...y},...j,children:[r(n.Viewport,{style:{height:"100%",width:"100%"},className:o("overscroll-contain",l,x?"neba-scroll-fade":""),children:r(n.Content,{className:"min-w-full",children:N})}),w?r(n.Scrollbar,{orientation:"vertical",className:`${m} w-(--n-rail) [margin-block:2px]`,children:r(n.Thumb,{className:h})}):null,$?r(n.Scrollbar,{orientation:"horizontal",className:`${m} h-(--n-rail) [margin-inline:2px]`,children:r(n.Thumb,{className:h})}):null,w&&$?r(n.Corner,{}):null]})});
|
|
@@ -100,14 +100,15 @@ export interface ScrollZoneProps extends NebaStyleProps, Omit<React.ComponentPro
|
|
|
100
100
|
* Turns a wheel rolled over the strip into travel along it — the one axis a
|
|
101
101
|
* mouse has, on a strip that does not run along it. Off by default, because a
|
|
102
102
|
* wheel taken from the page is the page's: a reader who meant to scroll past
|
|
103
|
-
* the shelf is held by it instead
|
|
103
|
+
* the shelf is held by it instead, and this strip has buttons for the pointer
|
|
104
|
+
* that has no other way along.
|
|
104
105
|
*
|
|
105
|
-
* What it
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* and a vertical zone ignores the prop,
|
|
110
|
-
* runs.
|
|
106
|
+
* What it takes it keeps, at the ends as well, so a flick that runs out of
|
|
107
|
+
* strip does not become a jump down the article. The pointer leaving the
|
|
108
|
+
* strip is what gives the page its wheel back. A trackpad swiping sideways is
|
|
109
|
+
* left alone — that already scrolls the strip, and answering it here would
|
|
110
|
+
* move twice as far as it was asked to — and a vertical zone ignores the prop,
|
|
111
|
+
* the wheel already pointing the way it runs.
|
|
111
112
|
* @default false
|
|
112
113
|
*/
|
|
113
114
|
wheel?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{IconButton as r}from"../icon-button/IconButton.js";import{spacingValue as o}from"../../internal/grid.js";import{scrollMessages as i,useMessages as l}from"../../internal/i18n.js";import{ChevronIcon as s}from"../../internal/icons.js";import{queryMatches as a,reducedMotionQuery as c}from"../../internal/media.js";import{observeResize as u}from"../../internal/observe.js";import{cx as d}from"../../internal/styles.js";import{useStyleDefaults as f}from"../../internal/defaults.js";const
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{IconButton as r}from"../icon-button/IconButton.js";import{spacingValue as o}from"../../internal/grid.js";import{scrollMessages as i,useMessages as l}from"../../internal/i18n.js";import{ChevronIcon as s}from"../../internal/icons.js";import{queryMatches as a,reducedMotionQuery as c}from"../../internal/media.js";import{observeResize as u}from"../../internal/observe.js";import{cx as d}from"../../internal/styles.js";import{bindAxisWheel as m}from"../../internal/wheel.js";import{useStyleDefaults as f}from"../../internal/defaults.js";const p={xs:"p-1",sm:"p-1.5",md:"p-2",lg:"p-3",xl:"p-4"},v={xs:"gap-1",sm:"gap-1.5",md:"gap-2",lg:"gap-3",xl:"gap-4"};export const ScrollZone=/*@__PURE__*/n.forwardRef(function(b,g){const{orientation:w="horizontal",lines:h=1,spacing:y=2,buttons:x="auto",buttonPlacement:k="inline",mode:E="item",step:L=1,speed:j=900,snap:C=!1,drag:P=!0,wheel:R=!1,scrollbar:N=!1,variant:T="solid",size:A="md",color:M="primary",density:z="default",locale:D,label:S,previousLabel:B,nextLabel:F,className:H,style:I,children:W,...$}=f(b,["size","density","variant","locale"]),q=l(i,D),X="horizontal"===w,Y=Math.max(1,Math.round(h)),_=Math.max(1,Math.round(L)),K=n.useRef(null),V=n.useRef(null),[Z,G]=n.useState({back:!1,forward:!1}),J=n.useCallback(()=>{const e=K.current;if(!e)return;const t=X?e.clientWidth:e.clientHeight,n=X?e.scrollWidth:e.scrollHeight,r=Math.abs(X?e.scrollLeft:e.scrollTop);G(e=>{const o=r>1,i=n-t-r>1;return e.back===o&&e.forward===i?e:{back:o,forward:i}})},[X]);n.useEffect(()=>{const e=K.current,t=V.current;if(!e)return;J();const n=[u(e,J),t?u(t,J):null];return()=>{for(const e of n)e?.()}},[J]);const O=n.useCallback(()=>{const e=K.current;return e&&X&&"rtl"===getComputedStyle(e).direction?-1:1},[X]),Q=n.useCallback((e,t)=>{const n=K.current;if(!n)return;const r=t?a(c)?"auto":"smooth":"auto";n.scrollBy(X?{left:e,behavior:r}:{top:e,behavior:r})},[X]),U=n.useCallback(()=>{const e=K.current,t=V.current;if(!e||!t)return[];const n=X&&"rtl"===getComputedStyle(e).direction,r=X?n?"right":"left":"top",o=n?-1:1,i=e.getBoundingClientRect()[r],l=[];for(const e of Array.from(t.children)){const t=Math.round((e.getBoundingClientRect()[r]-i)*o);l.includes(t)||l.push(t)}return l.sort((e,t)=>e-t)},[X]),ee=n.useCallback((e,t=E)=>{const n=K.current;if(!n)return;const r=O(),o=X?n.clientWidth:n.clientHeight;if("page"===t)return void Q(o*(e?1:-1)*r,!0);const i=U(),l=i.filter(e=>e>1),s=i.filter(e=>e<-1),a=e?l[_-1]:s[s.length-_];Q(void 0!==a?a*r:o*(e?1:-1)*r,!0)},[O,X,U,_,E,Q]),te=n.useRef(null);n.useEffect(()=>()=>te.current?.(),[]);const ne=n.useCallback((e,t)=>{if(te.current)return;const n=O(),r=performance.now();let o=r,i=0;const l=t=>{const r=t-o;o=t,Q(j*r/1e3*(e?1:-1)*n,!1),i=requestAnimationFrame(l)};i=requestAnimationFrame(l);const s=()=>{cancelAnimationFrame(i),te.current=null,window.removeEventListener(t,s),window.removeEventListener("pointercancel",s),window.removeEventListener("blur",s),performance.now()-r<140&&ee(e,"item")};te.current=s,window.addEventListener(t,s),window.addEventListener("pointercancel",s),window.addEventListener("blur",s)},[ee,O,Q,j]),re=n.useRef(null);function oe(e){return"hold"!==E?{onClick:()=>ee(e)}:{onPointerDown:t=>{0===t.button&&ne(e,"pointerup")},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),ne(e,"keyup"))}}}n.useEffect(()=>()=>re.current?.(),[]),n.useEffect(()=>{const e=K.current;if(e&&R&&X)return m(e)},[X,R]);const ie="none"!==x&&("always"===x||Z.back||Z.forward),le="inline"===k;function se(t){const n=t?Z.forward:Z.back;if("auto"===x&&!n&&!le)return e("span",{});const o=X?t?"-rotate-90 rtl:rotate-90":"rotate-90 rtl:-rotate-90":t?"":"rotate-180",i=e(r,{variant:T,size:A,color:M,density:z,elevation:1,label:t?F??q.next:B??q.previous,disabled:!n,className:"pointer-events-auto",icon:e("span",{className:d("flex items-center",o),children:e(s,{})}),...oe(t)});return le?e("span",{className:"flex shrink-0 items-center justify-center",children:i}):i}return t("div",{ref:g,className:d("relative flex min-w-0",le&&X?"flex-row items-stretch":"flex-col",le?v[A]:"",H),style:{"--n-ring":`var(--neba-${M}-ring)`,...I},...$,children:[ie&&le?se(!1):null,e("div",{ref:K,tabIndex:0,role:"group","aria-label":S??q.label,className:d("min-h-0 min-w-0 grow",X?"overflow-x-auto overflow-y-hidden":"overflow-y-auto overflow-x-hidden","overscroll-contain",C?X?"snap-x snap-mandatory":"snap-y snap-mandatory":"",N?"":"[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",P&&(Z.back||Z.forward)?"cursor-grab data-[dragging]:cursor-grabbing":"","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]"),onScroll:J,onPointerDown:function(e){if(!P||"touch"===e.pointerType||0!==e.button)return;re.current?.();const t=e.currentTarget,n=e.clientX,r=e.clientY,o=t.scrollLeft,i=t.scrollTop;let l=!1;const s=document.body.style.getPropertyValue("-webkit-user-select"),a=e=>{const s=e.clientX-n,a=e.clientY-r;if(!l){if(Math.abs(X?s:a)<4)return;l=!0,t.setPointerCapture(e.pointerId),t.dataset.dragging="true",document.body.style.setProperty("-webkit-user-select","none")}X?t.scrollLeft=o-s:t.scrollTop=i-a},c=()=>{re.current=null,t.removeEventListener("pointermove",a),t.removeEventListener("pointerup",u),t.removeEventListener("pointercancel",c),delete t.dataset.dragging,s?document.body.style.setProperty("-webkit-user-select",s):document.body.style.removeProperty("-webkit-user-select")},u=()=>{const e=l;if(c(),!e)return;const n=e=>{e.stopPropagation(),e.preventDefault()};t.addEventListener("click",n,{capture:!0,once:!0}),window.setTimeout(()=>t.removeEventListener("click",n,!0),0)};re.current=c,t.addEventListener("pointermove",a),t.addEventListener("pointerup",u),t.addEventListener("pointercancel",c)},children:e("div",{ref:V,className:d(C?"[&>*]:snap-start":""),style:{display:"grid",gap:o(y),gridAutoFlow:X?"column":"row",...X?{width:"max-content",gridTemplateRows:`repeat(${Y}, auto)`,gridAutoColumns:"max-content"}:{gridTemplateColumns:`repeat(${Y}, minmax(0, 1fr))`,gridAutoRows:"max-content"}},children:W})}),ie&&le?se(!0):null,ie&&!le?t("div",{className:d("pointer-events-none absolute inset-0 flex justify-between",X?"items-center":"flex-col items-center",p[A]),children:[se(!1),se(!0)]}):null]})});
|
|
@@ -17,6 +17,19 @@ export interface SelectOption {
|
|
|
17
17
|
label?: React.ReactNode;
|
|
18
18
|
/** Unavailable, but still listed — the option exists, it just cannot be picked. */
|
|
19
19
|
disabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* A heading over this option and the ones next to it that name the same
|
|
22
|
+
* group: time zones under their region, fonts under their family.
|
|
23
|
+
*
|
|
24
|
+
* A group is a **run of adjacent options**, so the array's order is the
|
|
25
|
+
* list's order and nothing is ever moved out from under a caller. Two runs
|
|
26
|
+
* naming the same group draw two headings, which is the array saying the
|
|
27
|
+
* options are not together.
|
|
28
|
+
*
|
|
29
|
+
* The heading is a heading and not a row: it cannot be highlighted, chosen
|
|
30
|
+
* or reached by typeahead.
|
|
31
|
+
*/
|
|
32
|
+
group?: string;
|
|
20
33
|
}
|
|
21
34
|
/**
|
|
22
35
|
* The parts a Select draws behind its root.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{Select as l}from"@base-ui/react/select";import{Field as n}from"@base-ui/react/field";import{CheckIcon as r,ChevronIcon as i}from"../../internal/icons.js";import{WidthSizer as s}from"../../internal/sizer.js";import{
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{Select as l}from"@base-ui/react/select";import{Field as n}from"@base-ui/react/field";import{CheckIcon as r,ChevronIcon as i}from"../../internal/icons.js";import{WidthSizer as s}from"../../internal/sizer.js";import{controlTextLeadingClasses as o,cx as c,disabledClasses as d,fieldFocusTransitionClasses as m,fieldHeightClasses as u,fieldReadOnlyClasses as p,fieldRestClasses as f,fieldRingClasses as h,gapClasses as b,hasContent as g,iconClasses as x,metaTextClasses as v,paddingXClasses as N,popupFadeClasses as j,radiusClasses as w,stackGapClasses as y,surfaceClasses as I,surfaceSlots as z,transitionClasses as S}from"../../internal/styles.js";import{useStyleDefaults as V}from"../../internal/defaults.js";const $=["group relative flex w-full cursor-pointer items-center select-none","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",S,m,h,x].join(" "),k=[I,"max-h-[min(20rem,var(--available-height))] overflow-y-auto overscroll-contain","min-w-[var(--anchor-width)] border bg-(--n-panel-press) p-1","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]","[outline:none]",j].join(" "),M=["py-1.5 pe-2 ps-7 font-semibold tracking-wide text-(--neba-muted-fg) uppercase"].join(" "),O=["relative flex cursor-pointer items-center gap-2 select-none","rounded-(--neba-radius-xs) py-1.5 pe-2 ps-7",S,"data-[highlighted]:bg-(--n-soft-hover) data-[highlighted]:text-(--n-accent)","data-[selected]:text-(--n-accent) data-[selected]:font-medium","data-[disabled]:cursor-not-allowed data-[disabled]:text-(--neba-disabled-fg)","[outline:none]"].join(" ");export const Select=/*@__PURE__*/t.forwardRef(function(m,h){const{variant:x="outline",size:j="md",color:I="primary",density:S="default",elevation:P=0,items:R,value:T,defaultValue:q,onValueChange:C,placeholder:G,label:L,description:W,error:_,invalid:D,startIcon:E,fullWidth:A=!1,disabled:B=!1,readOnly:F=!1,required:H=!1,name:J,id:K,className:Q,classNames:U,style:X,...Y}=V(m,["size","density","variant"]),Z=null!=_&&!1!==_&&""!==_,ee=D??Z,ae=ee?"danger":I,te=t.useMemo(()=>R.map(e=>({label:e.label??String(e.value),value:e.value})),[R]),le=t.useMemo(()=>function(e){const a=[];for(const t of e){const e=a.at(-1);e&&e.label===t.group?e.items.push(t):a.push({label:t.group,items:[t]})}return a}(R),[R]),ne=t.useMemo(()=>[...R.map(e=>e.label??String(e.value)),...g(G)?[G]:[]],[R,G]);return a(n.Root,{disabled:B,invalid:ee,className:c("flex-col align-top",y[j],A?"flex w-full":"inline-flex",Q??""),style:{...z(ae,P),...X},...Y,children:[L?e(n.Label,{className:c(v[j],"font-medium",B?"text-(--neba-disabled-fg)":"text-(--neba-fg)",U?.label),children:L}):null,a(l.Root,{id:K,name:J,items:te,value:T,defaultValue:q,onValueChange:e=>C?.(e),disabled:B,readOnly:F,required:H,children:[a(l.Trigger,{ref:h,className:c($,u[j],o[j],w[j],b[j],N[S][j],B?d[x]:F?`${p[x]} cursor-default`:f[x],U?.control),children:[E?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:E}):null,a("span",{className:"flex min-w-0 flex-1 flex-col",children:[e(l.Value,{className:["w-full truncate text-start","data-[placeholder]:text-(--neba-muted-fg)"].join(" "),placeholder:G}),e(s,{samples:ne})]}),e(l.Icon,{className:["flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)","[transition:rotate_var(--neba-duration)_var(--neba-ease)]","data-[popup-open]:rotate-180"].join(" "),children:e(i,{})})]}),e(l.Portal,{children:e(l.Positioner,{className:"neba-portal z-(--neba-z-portal) [outline:none]",sideOffset:6,alignItemWithTrigger:!1,children:e(l.Popup,{className:c(k,w[j],o[j],U?.popup),style:z(ae,3),children:le.map((t,n)=>{const i=t.items.map(t=>a(l.Item,{value:t.value,disabled:t.disabled,className:c(O,U?.item),children:[e(l.ItemIndicator,{className:"absolute start-1.5 flex size-4 items-center justify-center",children:e(r,{})}),e(l.ItemText,{className:"truncate",children:t.label??String(t.value)})]},String(t.value)));return void 0===t.label?i:a(l.Group,{children:[e(l.GroupLabel,{className:`${M} ${v[j]}`,children:t.label}),i]},`${t.label}-${n}`)})})})})]}),W?e(n.Description,{className:c(v[j],"text-(--neba-muted-fg)",U?.description),children:W}):null,e(n.Error,Z?{match:!0,className:c(v[j],"text-(--n-accent)",U?.error),children:_}:{className:c(v[j],"text-(--n-accent)",U?.error)})]})});
|