neba 0.0.1 → 1.0.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.
Files changed (141) hide show
  1. package/README.md +169 -2
  2. package/dist/components/accordion/Accordion.d.ts +97 -0
  3. package/dist/components/accordion/Accordion.js +1 -0
  4. package/dist/components/accordion/index.d.ts +2 -0
  5. package/dist/components/accordion/index.js +1 -0
  6. package/dist/components/alert/Alert.d.ts +47 -0
  7. package/dist/components/alert/Alert.js +1 -0
  8. package/dist/components/alert/index.d.ts +2 -0
  9. package/dist/components/alert/index.js +1 -0
  10. package/dist/components/badge/Badge.d.ts +80 -0
  11. package/dist/components/badge/Badge.js +1 -0
  12. package/dist/components/badge/index.d.ts +2 -0
  13. package/dist/components/badge/index.js +1 -0
  14. package/dist/components/box/Box.d.ts +50 -0
  15. package/dist/components/box/Box.js +1 -0
  16. package/dist/components/box/index.d.ts +2 -0
  17. package/dist/components/box/index.js +1 -0
  18. package/dist/components/button/Button.d.ts +25 -3
  19. package/dist/components/button/Button.js +1 -1
  20. package/dist/components/button/index.d.ts +1 -0
  21. package/dist/components/button-group/ButtonGroup.d.ts +31 -0
  22. package/dist/components/button-group/ButtonGroup.js +1 -0
  23. package/dist/components/button-group/index.d.ts +2 -0
  24. package/dist/components/button-group/index.js +1 -0
  25. package/dist/components/card/Card.d.ts +45 -0
  26. package/dist/components/card/Card.js +1 -0
  27. package/dist/components/card/index.d.ts +2 -0
  28. package/dist/components/card/index.js +1 -0
  29. package/dist/components/checkbox/Checkbox.d.ts +39 -0
  30. package/dist/components/checkbox/Checkbox.js +1 -0
  31. package/dist/components/checkbox/index.d.ts +2 -0
  32. package/dist/components/checkbox/index.js +1 -0
  33. package/dist/components/chip/Chip.d.ts +50 -0
  34. package/dist/components/chip/Chip.js +1 -0
  35. package/dist/components/chip/index.d.ts +2 -0
  36. package/dist/components/chip/index.js +1 -0
  37. package/dist/components/combobox/Combobox.d.ts +131 -0
  38. package/dist/components/combobox/Combobox.js +1 -0
  39. package/dist/components/combobox/index.d.ts +2 -0
  40. package/dist/components/combobox/index.js +1 -0
  41. package/dist/components/dialog/Dialog.d.ts +111 -0
  42. package/dist/components/dialog/Dialog.js +1 -0
  43. package/dist/components/dialog/index.d.ts +2 -0
  44. package/dist/components/dialog/index.js +1 -0
  45. package/dist/components/divider/Divider.d.ts +48 -0
  46. package/dist/components/divider/Divider.js +1 -0
  47. package/dist/components/divider/index.d.ts +2 -0
  48. package/dist/components/divider/index.js +1 -0
  49. package/dist/components/file-picker/FilePicker.d.ts +103 -0
  50. package/dist/components/file-picker/FilePicker.js +1 -0
  51. package/dist/components/file-picker/index.d.ts +2 -0
  52. package/dist/components/file-picker/index.js +1 -0
  53. package/dist/components/list/List.d.ts +81 -0
  54. package/dist/components/list/List.js +1 -0
  55. package/dist/components/list/index.d.ts +2 -0
  56. package/dist/components/list/index.js +1 -0
  57. package/dist/components/menu/Menu.d.ts +216 -0
  58. package/dist/components/menu/Menu.js +1 -0
  59. package/dist/components/menu/index.d.ts +2 -0
  60. package/dist/components/menu/index.js +1 -0
  61. package/dist/components/number-field/NumberField.d.ts +113 -0
  62. package/dist/components/number-field/NumberField.js +1 -0
  63. package/dist/components/number-field/index.d.ts +2 -0
  64. package/dist/components/number-field/index.js +1 -0
  65. package/dist/components/overlay/Overlay.d.ts +85 -0
  66. package/dist/components/overlay/Overlay.js +1 -0
  67. package/dist/components/overlay/index.d.ts +2 -0
  68. package/dist/components/overlay/index.js +1 -0
  69. package/dist/components/pagination/Pagination.d.ts +65 -0
  70. package/dist/components/pagination/Pagination.js +1 -0
  71. package/dist/components/pagination/index.d.ts +2 -0
  72. package/dist/components/pagination/index.js +1 -0
  73. package/dist/components/progress-box/ProgressBox.d.ts +33 -0
  74. package/dist/components/progress-box/ProgressBox.js +1 -0
  75. package/dist/components/progress-box/index.d.ts +2 -0
  76. package/dist/components/progress-box/index.js +1 -0
  77. package/dist/components/progress-circular/ProgressCircular.d.ts +19 -0
  78. package/dist/components/progress-circular/ProgressCircular.js +1 -0
  79. package/dist/components/progress-circular/index.d.ts +2 -0
  80. package/dist/components/progress-circular/index.js +1 -0
  81. package/dist/components/progress-linear/ProgressLinear.d.ts +20 -0
  82. package/dist/components/progress-linear/ProgressLinear.js +1 -0
  83. package/dist/components/progress-linear/index.d.ts +2 -0
  84. package/dist/components/progress-linear/index.js +1 -0
  85. package/dist/components/radio-group/RadioGroup.d.ts +51 -0
  86. package/dist/components/radio-group/RadioGroup.js +1 -0
  87. package/dist/components/radio-group/index.d.ts +2 -0
  88. package/dist/components/radio-group/index.js +1 -0
  89. package/dist/components/select/Select.d.ts +76 -0
  90. package/dist/components/select/Select.js +1 -0
  91. package/dist/components/select/index.d.ts +2 -0
  92. package/dist/components/select/index.js +1 -0
  93. package/dist/components/slider/Slider.d.ts +38 -0
  94. package/dist/components/slider/Slider.js +1 -0
  95. package/dist/components/slider/index.d.ts +2 -0
  96. package/dist/components/slider/index.js +1 -0
  97. package/dist/components/switch/Switch.d.ts +39 -0
  98. package/dist/components/switch/Switch.js +1 -0
  99. package/dist/components/switch/index.d.ts +2 -0
  100. package/dist/components/switch/index.js +1 -0
  101. package/dist/components/table/Table.d.ts +80 -0
  102. package/dist/components/table/Table.js +1 -0
  103. package/dist/components/table/index.d.ts +2 -0
  104. package/dist/components/table/index.js +1 -0
  105. package/dist/components/tabs/Tabs.d.ts +92 -0
  106. package/dist/components/tabs/Tabs.js +1 -0
  107. package/dist/components/tabs/index.d.ts +2 -0
  108. package/dist/components/tabs/index.js +1 -0
  109. package/dist/components/text-field/TextField.d.ts +63 -0
  110. package/dist/components/text-field/TextField.js +1 -0
  111. package/dist/components/text-field/index.d.ts +2 -0
  112. package/dist/components/text-field/index.js +1 -0
  113. package/dist/components/toast/Toast.d.ts +116 -0
  114. package/dist/components/toast/Toast.js +1 -0
  115. package/dist/components/toast/index.d.ts +2 -0
  116. package/dist/components/toast/index.js +1 -0
  117. package/dist/components/tooltip/Tooltip.d.ts +81 -0
  118. package/dist/components/tooltip/Tooltip.js +1 -0
  119. package/dist/components/tooltip/index.d.ts +2 -0
  120. package/dist/components/tooltip/index.js +1 -0
  121. package/dist/components/typography/Typography.d.ts +62 -0
  122. package/dist/components/typography/Typography.js +1 -0
  123. package/dist/components/typography/index.d.ts +2 -0
  124. package/dist/components/typography/index.js +1 -0
  125. package/dist/index.d.ts +32 -1
  126. package/dist/index.js +1 -1
  127. package/dist/internal/button-group.d.ts +25 -0
  128. package/dist/internal/button-group.js +1 -0
  129. package/dist/internal/icons.d.ts +48 -0
  130. package/dist/internal/icons.js +1 -0
  131. package/dist/internal/menu.d.ts +20 -0
  132. package/dist/internal/menu.js +1 -0
  133. package/dist/internal/progress.d.ts +122 -0
  134. package/dist/internal/progress.js +1 -0
  135. package/dist/internal/styles.d.ts +224 -0
  136. package/dist/internal/styles.js +1 -0
  137. package/dist/styles.css +758 -0
  138. package/dist/types.d.ts +77 -0
  139. package/dist/types.js +8 -0
  140. package/package.json +75 -19
  141. package/pnpm-workspace.yaml +0 -2
@@ -0,0 +1 @@
1
+ import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as n from"react";import{CloseIcon as t}from"../../internal/icons";import{controlTextLeadingClasses as a,disabledClasses as l,gapClasses as o,hasContent as i,iconClasses as s,metaTextClasses as c,radiusClasses as d,readOnlyFilterClasses as u,sheetTitleClasses as f,stackGapClasses as p,surfaceClasses as m,surfaceSlots as h,transitionClasses as b}from"../../internal/styles";const v={default:{xs:"p-4",sm:"p-5",md:"p-6",lg:"p-8",xl:"p-10"},compact:{xs:"p-2",sm:"p-3",md:"p-4",lg:"p-5",xl:"p-6"}},x={solid:[m,"border-2 border-dashed text-(--neba-fg) bg-(--n-panel-hover)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),outline:[m,"border-2 border-dashed text-(--neba-fg) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"border-2 border-dashed text-(--neba-fg) bg-transparent [border-color:var(--n-line)]"},g={solid:"hover:bg-(--n-panel-press) hover:[border-color:var(--n-line-hover)]",outline:"hover:bg-(--n-panel-hover) hover:[border-color:var(--n-line-hover)]",text:"hover:bg-(--n-soft) hover:[border-color:var(--n-line-hover)]"};function y(){return r("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e("path",{d:"M8 10.5V2.75m0 0L5.25 5.5M8 2.75 10.75 5.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M2.75 9.75v1.75a1.75 1.75 0 0 0 1.75 1.75h7a1.75 1.75 0 0 0 1.75-1.75V9.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}export function formatFileSize(e){if(e<1e3)return`${e} B`;const r=["kB","MB","GB","TB"];let n=e/1e3,t=0;for(;n>=1e3&&t<r.length-1;)n/=1e3,t+=1;return`${n<10?n.toFixed(1):Math.round(n)} ${r[t]}`}function k(e,r){const n=e.name.toLowerCase(),t=e.type.toLowerCase();return r.split(",").map(e=>e.trim().toLowerCase()).filter(Boolean).some(e=>e.startsWith(".")?n.endsWith(e):e.endsWith("/*")?t.startsWith(`${e.slice(0,-1)}`):t===e)}export const FilePicker=n.forwardRef(function({variant:m="outline",size:N="md",color:$="primary",density:j="default",elevation:w=0,accept:z,multiple:C=!1,maxSize:_,maxFiles:L,value:B,defaultValue:D,onFilesChange:I,onReject:F,label:M,description:W,error:S,invalid:R,title:T,hint:V,icon:E,showList:O=!0,removeLabel:q=e=>`Remove ${e}`,fullWidth:A=!0,disabled:P=!1,readOnly:G=!1,required:H=!1,name:Y,id:J,className:K,style:Q},U){const X=n.useRef(null);n.useImperativeHandle(U,()=>X.current);const[Z,ee]=n.useState(()=>[...D??[]]),re=B?[...B]:Z,ne=n.useRef(0),[te,ae]=n.useState(!1),le=i(S),oe=R??le,ie=oe?"danger":$,se=P||G,ce=n.useId(),de=n.useCallback(e=>{B||ee(e),I?.(e)},[I,B]),ue=n.useCallback(e=>{const r=[],n=[],t=C?L??Number.POSITIVE_INFINITY:1,a=C?re.length:0;for(const l of e)z&&!k(l,z)?n.push({file:l,reason:"type"}):void 0!==_&&l.size>_?n.push({file:l,reason:"size"}):a+r.length>=t?n.push({file:l,reason:"count"}):r.push(l);return{kept:r,rejections:n}},[z,re.length,L,_,C]),fe=n.useCallback(e=>{const{kept:r,rejections:n}=ue(e);n.length>0&&F?.(n),r.length>0&&de(C?[...re,...r]:r)},[ue,de,re,C,F]),pe=["flex w-full flex-col items-center justify-center text-center","cursor-pointer select-none",v[j][N],d[N],o[N],b,s,"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2",P?`${l[m]} border-2 border-dashed`:G?`${x[m]} ${u} cursor-default`:x[m],se?"":g[m],te&&!se?"bg-(--n-soft-press) [border-color:var(--n-ring)]":""].filter(Boolean).join(" ");return r("div",{className:["flex-col align-top",p[N],A?"flex w-full":"inline-flex",K??""].filter(Boolean).join(" "),style:{...h(ie,w),...Q},children:[i(M)?e("span",{className:[c[N],"font-medium",P?"text-(--neba-disabled-fg)":"text-(--neba-fg)"].join(" "),children:M}):null,r("div",{className:"flex w-full flex-col",onDragEnter:e=>{se||(e.preventDefault(),ne.current+=1,ae(!0))},onDragOver:e=>{se||(e.preventDefault(),e.dataTransfer.dropEffect="copy")},onDragLeave:()=>{se||(ne.current=Math.max(0,ne.current-1),0===ne.current&&ae(!1))},onDrop:e=>{se||(e.preventDefault(),ne.current=0,ae(!1),fe(Array.from(e.dataTransfer.files)))},children:[r("button",{type:"button",id:J,disabled:P,"aria-describedby":i(W)||le?ce:void 0,"aria-invalid":oe||void 0,className:pe,onClick:()=>{se||X.current&&(X.current.value="",X.current.click())},children:[void 0===E?e("span",{className:"flex items-center text-(--n-accent) [&_svg]:size-[1.8em]",children:e(y,{})}):i(E)?e("span",{className:"flex items-center text-(--n-accent) [&_svg]:size-[1.8em]",children:E}):null,e("span",{className:`font-medium ${f[N]}`,children:T??"Drop files here, or click to browse"}),i(V)?e("span",{className:`text-(--neba-muted-fg) ${c[N]}`,children:V}):null]}),e("input",{ref:X,type:"file",name:Y,accept:z,multiple:C,required:H&&0===re.length,disabled:se,tabIndex:-1,"aria-hidden":"true",className:"absolute size-px overflow-hidden opacity-0 [clip-path:inset(50%)]",onChange:e=>fe(Array.from(e.target.files??[]))})]}),O&&re.length>0?e("ul",{role:"list",className:`flex w-full flex-col ${p[N]} m-0 list-none p-0`,children:re.map((n,l)=>r("li",{className:["flex w-full items-center gap-2 px-2 py-1.5",d.xs,a[N],"bg-(--n-soft) text-(--neba-fg)"].join(" "),children:[e("span",{className:"min-w-0 flex-1 truncate",children:n.name}),e("span",{className:`shrink-0 text-(--neba-muted-fg) tabular-nums ${c[N]}`,children:formatFileSize(n.size)}),se?null:e("button",{type:"button","aria-label":q(n.name),className:["inline-flex shrink-0 cursor-pointer items-center justify-center rounded-full","size-[1.3em] text-(--neba-muted-fg) opacity-70","[transition:opacity_var(--neba-duration)_var(--neba-ease),color_var(--neba-duration)_var(--neba-ease)]","[&_svg]:size-[0.9em]","hover:text-(--neba-fg) hover:opacity-100 focus-visible:opacity-100","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1"].join(" "),onClick:()=>de(re.filter((e,r)=>r!==l)),children:e(t,{})})]},`${n.name}-${n.size}-${n.lastModified}-${l}`))}):null,i(W)&&!le?e("span",{id:ce,className:`${c[N]} text-(--neba-muted-fg)`,children:W}):null,le?e("span",{id:ce,className:`${c[N]} text-(--n-accent)`,children:S}):null]})});
@@ -0,0 +1,2 @@
1
+ export { FilePicker, formatFileSize } from './FilePicker';
2
+ export type { FilePickerProps, FileRejection, FileRejectionReason } from './FilePicker';
@@ -0,0 +1 @@
1
+ export{FilePicker,formatFileSize}from"./FilePicker";
@@ -0,0 +1,81 @@
1
+ import * as React from 'react';
2
+ import { useRender } from '@base-ui/react/use-render';
3
+ import type { NebaElevation, NebaStyleProps } from '../../types';
4
+ export interface ListProps extends NebaStyleProps, Omit<React.ComponentPropsWithoutRef<'ul'>, 'color'> {
5
+ /**
6
+ * Drop shadow depth. `0` (the default) is flat.
7
+ * @default 0
8
+ */
9
+ elevation?: NebaElevation;
10
+ /**
11
+ * Separates the rows with a hairline instead of with space.
12
+ *
13
+ * It changes more than it sounds like: with dividers the rules have to reach
14
+ * both edges of the sheet, so the list gives up its inner padding and the rows
15
+ * give up their rounded corners. A row cannot be a floating tile and a ruled
16
+ * line at the same time.
17
+ * @default false
18
+ */
19
+ dividers?: boolean;
20
+ /**
21
+ * Renders something other than a `<ul>` — `render={<ol />}` for a list where
22
+ * the order is the point. Base UI's own escape hatch.
23
+ */
24
+ render?: useRender.RenderProp;
25
+ children?: React.ReactNode;
26
+ }
27
+ export interface ListItemProps extends Omit<React.ComponentPropsWithoutRef<'li'>, 'color' | 'onClick'> {
28
+ /**
29
+ * Passing it is what turns the row into a real `<button>`. It lands on that
30
+ * button rather than on the `<li>`, which is why the type is loosened from
31
+ * the list item the shell actually is.
32
+ */
33
+ onClick?: React.MouseEventHandler<HTMLElement>;
34
+ /** Content before the label — an icon, an avatar, a status dot. */
35
+ startIcon?: React.ReactNode;
36
+ /** Content after the label, inside the pressable area. */
37
+ endIcon?: React.ReactNode;
38
+ /** A second line under the label, one step down the type scale and muted. */
39
+ description?: React.ReactNode;
40
+ /**
41
+ * A control pinned to the end of the row — a switch, a menu button.
42
+ *
43
+ * Deliberately outside the pressable area: a row that both navigates and
44
+ * holds a toggle has two things to press, and nesting one button inside
45
+ * another is markup the browser rewrites on parse.
46
+ */
47
+ action?: React.ReactNode;
48
+ /** Renders the row as a link. Mutually exclusive with `onClick` in practice. */
49
+ href?: string;
50
+ /** Marks the row as the chosen one — the open page, the current filter. */
51
+ selected?: boolean;
52
+ /** Unavailable. Drops the colour family for neutral grey, as everywhere else. */
53
+ disabled?: boolean;
54
+ /** The label. */
55
+ children?: React.ReactNode;
56
+ }
57
+ /**
58
+ * A stack of rows.
59
+ *
60
+ * The list is a sheet and the rows are what is on it, which is the whole reason
61
+ * the two are separate components: `size` and `density` are properties of the
62
+ * stack, not of any one line in it, and a context is what carries them down.
63
+ *
64
+ * There is no Base UI primitive under this on purpose. A list is not a
65
+ * composite widget — it has no roving focus, no selection model, no keyboard
66
+ * contract of its own. Reaching for a menu or a listbox primitive to get one
67
+ * would hand every consumer's plain list of links the semantics of a menu,
68
+ * which is the most common way a component library breaks a screen reader.
69
+ */
70
+ export declare const List: React.ForwardRefExoticComponent<ListProps & React.RefAttributes<HTMLUListElement>>;
71
+ /**
72
+ * One row.
73
+ *
74
+ * The shell is always an `<li>`. What changes is what is inside it: a plain run
75
+ * of content, or — when `onClick` or `href` is given — a real `<button>` or
76
+ * `<a>` wrapping that content, with `action` sitting outside it as a separate
77
+ * control. This is the same shape Chip uses, for the same two reasons: a
78
+ * `<span>` carrying a click handler is invisible to a keyboard, and a
79
+ * `<button>` inside a `<button>` is markup Chrome silently un-nests.
80
+ */
81
+ export declare const ListItem: React.ForwardRefExoticComponent<ListItemProps & React.RefAttributes<HTMLLIElement>>;
@@ -0,0 +1 @@
1
+ import{jsx as e,jsxs as n,Fragment as r}from"react/jsx-runtime";import*as t from"react";import{useRender as l}from"@base-ui/react/use-render";import{boxPaddingXClasses as s}from"../box/Box";import{focusRingClasses as a,gapClasses as i,hasContent as o,iconClasses as d,metaTextClasses as c,radiusClasses as m,sheetBodyClasses as f,surfaceClasses as x,surfaceSlots as p,transitionClasses as u}from"../../internal/styles";const h=t.createContext({size:"md",density:"default",dividers:!1}),b={solid:[x,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[x,"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"},v={default:{xs:"py-1",sm:"py-1.5",md:"py-2",lg:"py-2.5",xl:"py-3"},compact:{xs:"py-0.5",sm:"py-0.5",md:"py-1",lg:"py-1.5",xl:"py-2"}},g={xs:m.xs,sm:m.xs,md:m.sm,lg:m.sm,xl:m.md};export const List=t.forwardRef(function({variant:n="outline",size:r="md",color:s="primary",density:a="default",elevation:i=0,dividers:o=!1,render:d,className:c,style:f,children:x,...v},g){const y=t.useMemo(()=>({size:r,density:a,dividers:o}),[r,a,o]),N=["flex flex-col",m[r],b[n],u,o?"overflow-hidden [&>li+li]:border-t [&>li+li]:[border-color:var(--n-line)]":"p-1",c??""].filter(Boolean).join(" "),w=l({render:d,ref:g,props:{role:"list",className:N,style:{...p(s,i),...f},children:x,...v}});return e(h.Provider,{value:y,children:w})});export const ListItem=t.forwardRef(function({startIcon:l,endIcon:m,description:x,action:p,href:b,selected:y=!1,disabled:N=!1,className:w,children:j,onClick:k,...B},C){const{size:z,density:I,dividers:$}=t.useContext(h),L=Boolean(k||b)&&!N,R=s[I][z],F=["flex min-w-0 flex-1 items-center text-start",R,v[I][z],i[z],f[z],u,d,$?"":g[z],N?"cursor-not-allowed text-(--neba-disabled-fg)":y?"bg-(--n-soft-press) font-medium text-(--n-accent)":"",L?`cursor-pointer ${a}`:"",L&&!y?"hover:bg-(--n-soft)":"",L&&y?"hover:bg-(--n-soft-press)":""].filter(Boolean).join(" "),M=n(r,{children:[o(l)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:l}):null,n("span",{className:"flex min-w-0 flex-1 flex-col",children:[o(j)?e("span",{className:"truncate",children:j}):null,o(x)?e("span",{className:`truncate text-(--neba-muted-fg) ${c[z]}`,children:x}):null]}),o(m)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:m}):null]});return n("li",{ref:C,className:["flex w-full items-center",w??""].filter(Boolean).join(" "),...B,children:[L&&b?e("a",{href:b,className:F,"aria-current":y?"page":void 0,onClick:k,children:M}):L?e("button",{type:"button",className:F,"aria-current":!!y||void 0,onClick:k,children:M}):e("div",{className:F,"aria-disabled":N||void 0,children:M}),o(p)?e("div",{className:`flex shrink-0 items-center ${R}`,children:p}):null]})});
@@ -0,0 +1,2 @@
1
+ export { List, ListItem } from './List';
2
+ export type { ListItemProps, ListProps } from './List';
@@ -0,0 +1 @@
1
+ export{List,ListItem}from"./List";
@@ -0,0 +1,216 @@
1
+ import * as React from 'react';
2
+ import type { NebaAlign, NebaColor, NebaSide, NebaStyleProps } from '../../types';
3
+ /**
4
+ * A menu takes `size`, `color` and `density` and stops there.
5
+ *
6
+ * There is no `variant`, for the reason Dialog has none: the three weights
7
+ * answer "how much does this surface assert itself against the page", and a
8
+ * popup that has taken the pointer has already answered it. There is no
9
+ * `elevation` either — a menu genuinely floats, which is the one case elevation
10
+ * exists for, so it is fixed at 3.
11
+ */
12
+ interface MenuSurfaceProps extends Pick<NebaStyleProps, 'size' | 'color' | 'density'> {
13
+ className?: string;
14
+ style?: React.CSSProperties;
15
+ }
16
+ export interface MenuProps extends MenuSurfaceProps {
17
+ /**
18
+ * The element that opens the menu, wired up by Base UI. Optional — a
19
+ * controlled menu opened from elsewhere needs no trigger of its own.
20
+ */
21
+ trigger?: React.ReactElement;
22
+ /** Whether the menu is open. Use with `onOpenChange` for a controlled menu. */
23
+ open?: boolean;
24
+ /** Whether it starts open, for an uncontrolled one. */
25
+ defaultOpen?: boolean;
26
+ onOpenChange?: (open: boolean) => void;
27
+ /** Which edge of the trigger it hangs off. @default 'bottom' */
28
+ side?: NebaSide;
29
+ /** Where it sits along that edge. @default 'start' */
30
+ align?: NebaAlign;
31
+ /** Distance from the trigger, in pixels. @default 6 */
32
+ sideOffset?: number;
33
+ /**
34
+ * Whether the page behind is taken away while the menu is open.
35
+ * @default true
36
+ */
37
+ modal?: boolean;
38
+ /**
39
+ * Opens on hover as well as on click. For a menu bar, where crossing the row
40
+ * with an open menu should walk through the others rather than close them.
41
+ * @default false
42
+ */
43
+ openOnHover?: boolean;
44
+ /**
45
+ * Whether the arrow keys wrap from the last item back to the first.
46
+ * @default true
47
+ */
48
+ loopFocus?: boolean;
49
+ /** Unavailable. The trigger stops opening anything. */
50
+ disabled?: boolean;
51
+ /** The rows. */
52
+ children?: React.ReactNode;
53
+ }
54
+ export interface ContextMenuProps extends MenuSurfaceProps {
55
+ /** The rows, exactly as they are written inside a `Menu`. */
56
+ content: React.ReactNode;
57
+ /**
58
+ * The area that answers a right-click or a long press. Rendered inside a
59
+ * `<div>` of Base UI's, which is what listens for the gesture.
60
+ */
61
+ children: React.ReactNode;
62
+ open?: boolean;
63
+ defaultOpen?: boolean;
64
+ onOpenChange?: (open: boolean) => void;
65
+ /** @default true */
66
+ loopFocus?: boolean;
67
+ disabled?: boolean;
68
+ }
69
+ export interface MenuItemProps {
70
+ /** What the row does. Not given, and not a link, the row is a label. */
71
+ onClick?: (event: React.MouseEvent<HTMLElement>) => void;
72
+ /** Renders the row as a real `<a>`. A menu of links has to be links. */
73
+ href?: string;
74
+ /** Where the link opens — `_blank` and the rest. Ignored without `href`. */
75
+ target?: string;
76
+ /** Content before the label — an icon, a swatch, a check. */
77
+ startIcon?: React.ReactNode;
78
+ /** Content after the label, before any `shortcut`. */
79
+ endIcon?: React.ReactNode;
80
+ /**
81
+ * The keystroke that does the same thing, set at the end of the row and
82
+ * muted. Text only — the row does not bind it, the application does.
83
+ */
84
+ shortcut?: React.ReactNode;
85
+ /** A second line under the label, one step down the type scale and muted. */
86
+ description?: React.ReactNode;
87
+ /**
88
+ * Re-points the row's colour family — `danger` for the one that deletes.
89
+ * Defaults to the menu's own.
90
+ */
91
+ color?: NebaColor;
92
+ /**
93
+ * Whether picking the row closes the menu.
94
+ * @default true
95
+ */
96
+ closeOnClick?: boolean;
97
+ /** Unavailable. Still listed, and still found by typeahead. */
98
+ disabled?: boolean;
99
+ /** What typeahead matches against, when the label is not a plain string. */
100
+ label?: string;
101
+ /** The label. */
102
+ children?: React.ReactNode;
103
+ className?: string;
104
+ style?: React.CSSProperties;
105
+ }
106
+ export interface MenuSubmenuProps {
107
+ /** The label on the row that opens it. */
108
+ label?: React.ReactNode;
109
+ startIcon?: React.ReactNode;
110
+ disabled?: boolean;
111
+ /** Which edge of the parent row it opens against. @default 'right' */
112
+ side?: NebaSide;
113
+ /** Distance from the parent menu, in pixels. @default 4 */
114
+ sideOffset?: number;
115
+ /** The nested rows. */
116
+ children?: React.ReactNode;
117
+ className?: string;
118
+ style?: React.CSSProperties;
119
+ }
120
+ export interface MenuGroupProps {
121
+ /** The heading over the group. Wired to it by Base UI. */
122
+ label?: React.ReactNode;
123
+ children?: React.ReactNode;
124
+ className?: string;
125
+ }
126
+ export interface MenuCheckboxItemProps extends Omit<MenuItemProps, 'href' | 'target' | 'startIcon' | 'onClick'> {
127
+ checked?: boolean;
128
+ defaultChecked?: boolean;
129
+ onCheckedChange?: (checked: boolean) => void;
130
+ /**
131
+ * Whether ticking the row closes the menu. `false` here rather than the `true`
132
+ * a plain item takes: a list of things to tick is a list you tick more than
133
+ * one of.
134
+ * @default false
135
+ */
136
+ closeOnClick?: boolean;
137
+ }
138
+ export interface MenuRadioGroupProps {
139
+ value?: string | number;
140
+ defaultValue?: string | number;
141
+ onValueChange?: (value: string | number) => void;
142
+ disabled?: boolean;
143
+ children?: React.ReactNode;
144
+ className?: string;
145
+ }
146
+ export interface MenuRadioItemProps extends Omit<MenuItemProps, 'href' | 'target' | 'startIcon' | 'onClick'> {
147
+ /** What this row sets the group to. */
148
+ value: string | number;
149
+ /** @default false */
150
+ closeOnClick?: boolean;
151
+ }
152
+ export type MenuSeparatorProps = React.ComponentPropsWithoutRef<'div'>;
153
+ /**
154
+ * One row of a menu.
155
+ *
156
+ * Renders a real `<a>` when it is given an `href` and Base UI's own item
157
+ * otherwise — the same split ListItem makes, for the same reason. A menu of
158
+ * links that are not links cannot be opened in a new tab, cannot be copied, and
159
+ * tells a screen reader the wrong thing about every one of them.
160
+ */
161
+ export declare function MenuItem({ onClick, href, target, startIcon, endIcon, shortcut, description, color, closeOnClick, disabled, label, children, className, style }: MenuItemProps): React.JSX.Element;
162
+ /** A row that ticks. The tick lands in the same slot a `startIcon` would. */
163
+ export declare function MenuCheckboxItem({ checked, defaultChecked, onCheckedChange, endIcon, shortcut, description, color, closeOnClick, disabled, label, children, className, style }: MenuCheckboxItemProps): React.JSX.Element;
164
+ /** One choice out of a set. Wraps the rows that make up the set. */
165
+ export declare function MenuRadioGroup({ value, defaultValue, onValueChange, disabled, children, className }: MenuRadioGroupProps): React.JSX.Element;
166
+ /**
167
+ * A row inside a `MenuRadioGroup`.
168
+ *
169
+ * Marked with a dot rather than a tick, which is the same distinction Checkbox
170
+ * and Radio make everywhere else: a tick says "and", a dot says "instead of".
171
+ */
172
+ export declare function MenuRadioItem({ value, endIcon, shortcut, description, color, closeOnClick, disabled, label, children, className, style }: MenuRadioItemProps): React.JSX.Element;
173
+ /** A named run of rows. The label is a heading, not a row — it cannot be picked. */
174
+ export declare function MenuGroup({ label, children, className }: MenuGroupProps): React.JSX.Element;
175
+ /** The hairline between two runs of rows. */
176
+ export declare function MenuSeparator({ className, ...props }: MenuSeparatorProps): React.JSX.Element;
177
+ /**
178
+ * A menu inside a menu.
179
+ *
180
+ * The row that opens it is the same row every other item is, wearing a chevron
181
+ * — and it opens on hover, on Enter and on the arrow key that points at it,
182
+ * all of which is Base UI's. What is here is the surface and the glyph.
183
+ *
184
+ * Nesting is unlimited: a `MenuSubmenu` renders its children inside a popup
185
+ * that is itself a menu, so a submenu of a submenu needs no different component.
186
+ */
187
+ export declare function MenuSubmenu({ label, startIcon, disabled, side, sideOffset, children, className, style }: MenuSubmenuProps): React.JSX.Element;
188
+ /**
189
+ * A list of actions that appears when something is pressed.
190
+ *
191
+ * Everything that makes a menu a menu rather than a floating list of divs is
192
+ * Base UI's: roving focus with the arrow keys, Home and End, typeahead, Escape,
193
+ * closing on an outside click, restoring focus to the trigger, submenus opening
194
+ * on hover with the safe-triangle so a diagonal reach does not close them, and
195
+ * the `menu` / `menuitem` roles that make any of it mean something to a screen
196
+ * reader. What is here is the surface, the ladders and the row layout.
197
+ *
198
+ * The rows are composed rather than passed as data — the opposite of Select,
199
+ * and deliberately. A select's options are values from a list a caller already
200
+ * has; a menu's rows are *code*, each one a different handler, a different icon,
201
+ * sometimes a submenu. Data would mean an `items` type with a variant for every
202
+ * shape a row can take, which is a component tree spelled as a discriminated
203
+ * union.
204
+ */
205
+ export declare function Menu({ size, color, density, trigger, open, defaultOpen, onOpenChange, side, align, sideOffset, modal, openOnHover, loopFocus, disabled, className, style, children }: MenuProps): React.JSX.Element;
206
+ /**
207
+ * The same menu, opened by a right-click or a long press instead of by a button.
208
+ *
209
+ * It takes the rows as `content` and the area as `children`, which is Tooltip's
210
+ * shape rather than Menu's — because here the trigger is not one element you
211
+ * hand over, it is a region of the page, and the region is the thing being
212
+ * wrapped. Base UI positions the popup at the pointer rather than against an
213
+ * anchor, and the long press is what makes it reachable on a touch screen at all.
214
+ */
215
+ export declare function ContextMenu({ size, color, density, content, children, open, defaultOpen, onOpenChange, loopFocus, disabled, className, style }: ContextMenuProps): React.JSX.Element;
216
+ export {};
@@ -0,0 +1 @@
1
+ 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";import{CheckIcon as i,ChevronIcon as r,DotIcon as c}from"../../internal/icons";import{controlTextLeadingClasses as d,gapClasses as u,hasContent as m,iconClasses as p,metaTextClasses as h,radiusClasses as f,surfaceClasses as x,surfaceSlots as b,transitionClasses as g}from"../../internal/styles";const y=[x,"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]","[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" "),N={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"}},C={xs:f.xs,sm:f.xs,md:f.sm,lg:f.sm,xl:f.md};function v(e,n,l,t){return["relative flex w-full cursor-pointer items-center select-none",l?"text-(--n-accent)":"text-(--neba-fg)",N[n][e],C[e],u[e],d[e],g,p,"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??""].filter(Boolean).join(" ")}const k="flex h-[1lh] w-[1.2em] shrink-0 items-center justify-center";function O({children:l,description:t,size:a}){return m(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) ${h[a]}`,children:t})]}):e("span",{className:"min-w-0 flex-1 truncate text-start",children:l})}export function MenuItem({onClick:s,href:i,target:r,startIcon:c,endIcon:d,shortcut:u,description:p,color:f,closeOnClick:x=!0,disabled:g=!1,label:y,children:N,className:C,style:z}){const I=t.useContext(o),{size:j,density:M}=I,$=n(l,{children:[m(c)?e("span",{className:`${k} text-(--neba-muted-fg)`,children:c}):null,e(O,{description:p,size:j,children:N}),m(d)?e("span",{className:`${k} text-(--neba-muted-fg)`,children:d}):null,m(u)?e("span",{className:`ms-2 shrink-0 text-(--neba-muted-fg) tabular-nums ${h[j]}`,children:u}):null]}),w=f?b(f,0):void 0,P=w||z?{...w,...z}:void 0;return void 0!==i?e(a.LinkItem,{href:i,target:r,label:y,closeOnClick:x,onClick:s,className:v(j,M,Boolean(f),C),style:P,children:$}):e(a.Item,{disabled:g,label:y,closeOnClick:x,onClick:s,className:v(j,M,Boolean(f),C),style:P,children:$})}export function MenuCheckboxItem({checked:l,defaultChecked:s,onCheckedChange:r,endIcon:c,shortcut:d,description:u,color:p,closeOnClick:f=!1,disabled:x=!1,label:g,children:y,className:N,style:C}){const{size:z,density:I}=t.useContext(o),j=p?b(p,0):void 0;return n(a.CheckboxItem,{checked:l,defaultChecked:s,onCheckedChange:e=>r?.(e),disabled:x,label:g,closeOnClick:f,className:v(z,I,Boolean(p),N),style:j||C?{...j,...C}:void 0,children:[e("span",{className:`${k} text-(--n-accent)`,children:e(a.CheckboxItemIndicator,{className:"flex items-center justify-center",children:e(i,{})})}),e(O,{description:u,size:z,children:y}),m(c)?e("span",{className:`${k} text-(--neba-muted-fg)`,children:c}):null,m(d)?e("span",{className:`ms-2 shrink-0 text-(--neba-muted-fg) tabular-nums ${h[z]}`,children:d}):null]})}export function MenuRadioGroup({value:n,defaultValue:l,onValueChange:t,disabled:s=!1,children:o,className:i}){return e(a.RadioGroup,{value:n,defaultValue:l,onValueChange:e=>t?.(e),disabled:s,className:i,children:o})}export function MenuRadioItem({value:l,endIcon:s,shortcut:i,description:r,color:d,closeOnClick:u=!1,disabled:p=!1,label:f,children:x,className:g,style:y}){const{size:N,density:C}=t.useContext(o),z=d?b(d,0):void 0;return n(a.RadioItem,{value:l,disabled:p,label:f,closeOnClick:u,className:v(N,C,Boolean(d),g),style:z||y?{...z,...y}:void 0,children:[e("span",{className:`${k} text-(--n-accent)`,children:e(a.RadioItemIndicator,{className:"flex items-center justify-center",children:e(c,{})})}),e(O,{description:r,size:N,children:x}),m(s)?e("span",{className:`${k} text-(--neba-muted-fg)`,children:s}):null,m(i)?e("span",{className:`ms-2 shrink-0 text-(--neba-muted-fg) tabular-nums ${h[N]}`,children:i}):null]})}export function MenuGroup({label:l,children:s,className:i}){const{size:r,density:c}=t.useContext(o);return n(a.Group,{className:i,children:[m(l)?e(a.GroupLabel,{className:[N[c][r],h[r],"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:["-mx-1 my-1 h-px bg-(--n-line)",n??""].filter(Boolean).join(" "),...l})}export function MenuSubmenu({label:l,startIcon:s,disabled:i=!1,side:c="right",sideOffset:u=4,children:p,className:h,style:x}){const g=t.useContext(o),{size:N,density:C,color:O}=g;return n(a.SubmenuRoot,{children:[n(a.SubmenuTrigger,{disabled:i,className:v(N,C,!1),children:[m(s)?e("span",{className:`${k} text-(--neba-muted-fg)`,children:s}):null,e("span",{className:"min-w-0 flex-1 truncate text-start",children:l}),e("span",{className:`${k} text-(--neba-muted-fg) -rotate-90`,children:e(r,{})})]}),e(a.Portal,{children:e(a.Positioner,{className:"neba-portal z-50 [outline:none]",side:c,sideOffset:u,align:"start",children:e(a.Popup,{className:[y,f[N],d[N],h??""].filter(Boolean).join(" "),style:{...b(O,3),...x},children:p})})})]})}export function Menu({size:l="md",color:s="primary",density:i="default",trigger:r,open:c,defaultOpen:u,onOpenChange:m,side:p="bottom",align:h="start",sideOffset:x=6,modal:g=!0,openOnHover:N=!1,loopFocus:C=!0,disabled:v=!1,className:k,style:O,children:z}){const I=t.useMemo(()=>({size:l,color:s,density:i}),[l,s,i]);return e(o.Provider,{value:I,children:n(a.Root,{open:c,defaultOpen:u,onOpenChange:e=>m?.(e),modal:g,loopFocus:C,disabled:v,children:[r?e(a.Trigger,{render:r,openOnHover:N,disabled:v}):null,e(a.Portal,{children:e(a.Positioner,{className:"neba-portal z-50 [outline:none]",side:p,align:h,sideOffset:x,children:e(a.Popup,{className:[y,f[l],d[l],k??""].filter(Boolean).join(" "),style:{...b(s,3),...O},children:z})})})]})})}export function ContextMenu({size:l="md",color:a="primary",density:i="default",content:r,children:c,open:u,defaultOpen:m,onOpenChange:p,loopFocus:h=!0,disabled:x=!1,className:g,style:N}){const C=t.useMemo(()=>({size:l,color:a,density:i}),[l,a,i]);return e(o.Provider,{value:C,children:n(s.Root,{open:u,defaultOpen:m,onOpenChange:e=>p?.(e),loopFocus:h,disabled:x,children:[e(s.Trigger,{children:c}),e(s.Portal,{children:e(s.Positioner,{className:"neba-portal z-50 [outline:none]",children:e(s.Popup,{className:[y,f[l],d[l],g??""].filter(Boolean).join(" "),style:{...b(a,3),...N},children:r})})})]})})}
@@ -0,0 +1,2 @@
1
+ export { ContextMenu, Menu, MenuCheckboxItem, MenuGroup, MenuItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSubmenu } from './Menu';
2
+ export type { ContextMenuProps, MenuCheckboxItemProps, MenuGroupProps, MenuItemProps, MenuProps, MenuRadioGroupProps, MenuRadioItemProps, MenuSeparatorProps, MenuSubmenuProps } from './Menu';
@@ -0,0 +1 @@
1
+ export{ContextMenu,Menu,MenuCheckboxItem,MenuGroup,MenuItem,MenuRadioGroup,MenuRadioItem,MenuSeparator,MenuSubmenu}from"./Menu";
@@ -0,0 +1,113 @@
1
+ import * as React from 'react';
2
+ import type { NebaElevation, NebaStyleProps } from '../../types';
3
+ /**
4
+ * Where the two steppers sit.
5
+ *
6
+ * - `end` — both at the trailing edge, the way a spinner has always looked.
7
+ * - `split` — minus at the start, plus at the end, with the number between
8
+ * them. For a quantity that is nudged rather than typed.
9
+ * - `none` — no buttons. The field is still a number field: the arrow keys,
10
+ * the clamping and the formatting all stay.
11
+ *
12
+ * There is deliberately no stacked pair of half-height chevrons. At `xs` each
13
+ * arrow would be under three pixels tall, and a target that small is a target
14
+ * nobody hits.
15
+ */
16
+ export type NumberFieldSteppers = 'end' | 'split' | 'none';
17
+ export interface NumberFieldProps extends NebaStyleProps {
18
+ /**
19
+ * Drop shadow depth. `0` (the default) is flat — a field is a well, not a
20
+ * surface that floats.
21
+ * @default 0
22
+ */
23
+ elevation?: NebaElevation;
24
+ /** The number. Use with `onValueChange` for a controlled field. */
25
+ value?: number | null;
26
+ /** The initial number, for an uncontrolled field. */
27
+ defaultValue?: number;
28
+ /** Called on every change — typing, stepping, the wheel. */
29
+ onValueChange?: (value: number | null) => void;
30
+ /**
31
+ * Called when the value settles: on blur after typing, on pointer release
32
+ * after a press, and together with `onValueChange` for the keyboard.
33
+ */
34
+ onValueCommitted?: (value: number | null) => void;
35
+ /** The bottom of the range. Stepping stops here. */
36
+ min?: number;
37
+ /** The top of the range. */
38
+ max?: number;
39
+ /** How far one step goes. `'any'` turns step validation off. @default 1 */
40
+ step?: number | 'any';
41
+ /** The step taken while Shift is held. @default 10 */
42
+ largeStep?: number;
43
+ /** The step taken while Alt is held. @default 0.1 */
44
+ smallStep?: number;
45
+ /** Whether stepping snaps to multiples of the step. @default false */
46
+ snapOnStep?: boolean;
47
+ /**
48
+ * Whether the wheel changes the value while the field is focused and hovered.
49
+ * Off by default: a page that scrolls under the pointer and a field that
50
+ * changes under it are the same gesture, and only one of them was meant.
51
+ * @default false
52
+ */
53
+ allowWheelScrub?: boolean;
54
+ /**
55
+ * How the number is written — currency, percent, decimal places. Passed
56
+ * straight to `Intl.NumberFormat`, so the field shows `$1,240.00` and still
57
+ * reports `1240`.
58
+ */
59
+ format?: Intl.NumberFormatOptions;
60
+ /** Which locale the number is written and parsed in. Defaults to the runtime's. */
61
+ locale?: Intl.LocalesArgument;
62
+ /** Where the steppers sit, or `none` for a field without them. @default 'end' */
63
+ steppers?: NumberFieldSteppers;
64
+ /** Accessible name of the increment button. */
65
+ incrementLabel?: string;
66
+ /** Accessible name of the decrement button. */
67
+ decrementLabel?: string;
68
+ /**
69
+ * Label above the control, wired to it by Base UI's Field. There is no
70
+ * floating variant on purpose: floating labels need a `transform`.
71
+ */
72
+ label?: React.ReactNode;
73
+ /** Helper text below the control. */
74
+ description?: React.ReactNode;
75
+ /** Error message below the control. Its presence also turns the field invalid. */
76
+ error?: React.ReactNode;
77
+ /** Forces the invalid state without a message. Defaults to `!!error`. */
78
+ invalid?: boolean;
79
+ /** Content placed before the number — a currency mark, a unit, an icon. */
80
+ startIcon?: React.ReactNode;
81
+ /** Content placed after the number, before the steppers. */
82
+ endIcon?: React.ReactNode;
83
+ /** Stretches to the width of the container. */
84
+ fullWidth?: boolean;
85
+ /** Unavailable. */
86
+ disabled?: boolean;
87
+ /** The number is shown but cannot be changed. */
88
+ readOnly?: boolean;
89
+ /** Whether a value must be entered before the form is submitted. */
90
+ required?: boolean;
91
+ /** Identifies the field when a form is submitted. */
92
+ name?: string;
93
+ /** Placeholder shown while the field is empty. */
94
+ placeholder?: string;
95
+ id?: string;
96
+ className?: string;
97
+ style?: React.CSSProperties;
98
+ }
99
+ /**
100
+ * A field that only holds a number.
101
+ *
102
+ * The shell is a TextField's, to the pixel, because a form where the quantity
103
+ * box is a different height or radius from the boxes around it is a form that
104
+ * looks assembled rather than designed. What is added on top is a real numeric
105
+ * control: arrow keys and the steppers move by `step` (Shift for `largeStep`,
106
+ * Alt for `smallStep`), the value clamps to `min`/`max`, and `format` writes it
107
+ * as currency or a percentage while `value` stays a plain number.
108
+ *
109
+ * Base UI owns the hard parts — parsing what was typed against the locale,
110
+ * clamping, the press-and-hold repeat on the steppers, and the hidden input
111
+ * that submits with a form.
112
+ */
113
+ export declare function NumberField({ variant, size, color, density, elevation, value, defaultValue, onValueChange, onValueCommitted, min, max, step, largeStep, smallStep, snapOnStep, allowWheelScrub, format, locale, steppers, incrementLabel, decrementLabel, label, description, error, invalid, startIcon, endIcon, fullWidth, disabled, readOnly, required, name, placeholder, id, className, style }: NumberFieldProps): React.JSX.Element;
@@ -0,0 +1 @@
1
+ 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{MinusIcon as l,PlusIcon as i}from"../../internal/icons";import{controlHeightClasses as r,controlTextLeadingClasses as s,disabledClasses as o,fieldReadOnlyClasses as c,fieldRestClasses as d,focusWithinRingClasses as m,gapClasses as u,hasContent as p,iconClasses as f,metaTextClasses as b,paddingXClasses as h,radiusClasses as x,stackGapClasses as g,surfaceSlots as v,transitionClasses as N}from"../../internal/styles";const j=["group relative flex w-full cursor-text items-center","[-webkit-tap-highlight-color:transparent]",N,"focus-within:[transition-duration:0ms]",m,f].join(" "),w=["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({variant:m="outline",size:f="md",color:N="primary",density:k="default",elevation:y=0,value:S,defaultValue:_,onValueChange:V,onValueCommitted:I,min:C,max:O,step:z,largeStep:D,smallStep:L,snapOnStep:W,allowWheelScrub:$=!1,format:q,locale:B,steppers:F="end",incrementLabel:R="Increase",decrementLabel:E="Decrease",label:G,description:A,error:H,invalid:J,startIcon:K,endIcon:M,fullWidth:P=!1,disabled:Q=!1,readOnly:T=!1,required:U=!1,name:X,placeholder:Y,id:Z,className:ee,style:ne}){const te=p(H),ae=J??te,le=ae?"danger":N,ie=h[k][f],re={end:`${ie} pe-1`,split:"px-1",none:ie},se=e(t.Decrement,{"aria-label":E,className:w,children:e(l,{})}),oe=e(t.Increment,{"aria-label":R,className:w,children:e(i,{})}),ce="none"!==F&&!T;return n(a.Root,{disabled:Q,invalid:ae,className:["flex-col align-top",g[f],P?"flex w-full":"inline-flex",ee??""].filter(Boolean).join(" "),style:{...v(le,y),...ne},children:[G?e(a.Label,{className:[b[f],"font-medium",Q?"text-(--neba-disabled-fg)":"text-(--neba-fg)"].join(" "),children:G}):null,e(t.Root,{id:Z,name:X,className:"contents",value:S,defaultValue:_,onValueChange:e=>V?.(e),onValueCommitted:e=>I?.(e),min:C,max:O,step:z,largeStep:D,smallStep:L,snapOnStep:W,allowWheelScrub:$,format:q,locale:B,disabled:Q,readOnly:T,required:U,children:n(t.Group,{className:[j,r[f],s[f],x[f],u[f],ce?re[F]:ie,Q?o[m]:T?c[m]:d[m]].join(" "),children:[ce&&"split"===F?se:null,K?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:K}):null,e(t.Input,{placeholder:Y,className:["min-w-0 flex-1 self-stretch bg-transparent [font:inherit] text-inherit","[outline:none]","tabular-nums","split"===F&&ce?"text-center":"","placeholder:text-(--neba-muted-fg)","caret-(--n-accent) selection:bg-(--n-soft-press)","disabled:cursor-not-allowed"].filter(Boolean).join(" ")}),M?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:M}):null,ce&&"end"===F?n("span",{className:"flex shrink-0 items-center gap-0.5",children:[se,oe]}):null,ce&&"split"===F?oe:null]})}),A?e(a.Description,{className:`${b[f]} text-(--neba-muted-fg)`,children:A}):null,te?e(a.Error,{match:!0,className:`${b[f]} text-(--n-accent)`,children:H}):null]})}
@@ -0,0 +1,2 @@
1
+ export { NumberField } from './NumberField';
2
+ export type { NumberFieldProps, NumberFieldSteppers } from './NumberField';
@@ -0,0 +1 @@
1
+ export{NumberField}from"./NumberField";
@@ -0,0 +1,85 @@
1
+ import * as React from 'react';
2
+ import type { NebaAlign, NebaColor, NebaSize } from '../../types';
3
+ /**
4
+ * How much of the page the overlay takes away.
5
+ *
6
+ * The four steps are one axis — how legible is what is behind — and they are
7
+ * tuned with the blur radius as much as with the alpha, because past about
8
+ * 16px a backdrop smears into flat colour and the scrim reads opaque no matter
9
+ * how low its alpha goes.
10
+ *
11
+ * - `scrim` — the neutral dim a Dialog puts behind itself. The page is still
12
+ * there and still readable; it has only stopped being reachable.
13
+ * - `blur` — frosted. A lighter dim over a real blur, so the page is present as
14
+ * shape and colour but not as words. For "this is being replaced".
15
+ * - `solid` — the page surface, opaque. For a screen that is genuinely gone.
16
+ * - `clear` — nothing drawn at all. Still blocks the pointer, which is the
17
+ * whole reason to reach for it: an invisible sheet that catches a click.
18
+ */
19
+ export type OverlayTone = 'scrim' | 'blur' | 'solid' | 'clear';
20
+ /**
21
+ * An overlay takes `size`, `color` and `align` and stops there.
22
+ *
23
+ * There is no `variant` — the three weights answer "how much does this surface
24
+ * assert itself against the page", and an overlay has taken the page. There is
25
+ * no `elevation` either: the overlay *is* the plane everything else floats
26
+ * above, and a scrim with a drop shadow is a scrim with an edge.
27
+ */
28
+ export interface OverlayProps {
29
+ /** The overlay is shown. Use with `onOpenChange` for a controlled overlay. */
30
+ open?: boolean;
31
+ /** Whether the overlay starts shown, for an uncontrolled one. */
32
+ defaultOpen?: boolean;
33
+ onOpenChange?: (open: boolean) => void;
34
+ /** How much of the page is taken away. @default 'scrim' */
35
+ tone?: OverlayTone;
36
+ /**
37
+ * Whether clicking the overlay or pressing Escape closes it.
38
+ *
39
+ * Off by default, which is the other way round from [Dialog](./dialog). A
40
+ * dialog asks a question and Escape is the universal "no"; an overlay is not
41
+ * asking anything — it is saying *wait* — and a save that can be dismissed
42
+ * by a stray click is a save the user will think finished. Turn it on for the
43
+ * overlay whose job is to catch a click outside something.
44
+ * @default false
45
+ */
46
+ dismissible?: boolean;
47
+ /**
48
+ * Whether the page behind is taken away for the keyboard too. `'trap-focus'`
49
+ * leaves the page scrollable and clickable while still holding focus inside,
50
+ * which is what a `clear` overlay usually wants.
51
+ * @default true
52
+ */
53
+ modal?: boolean | 'trap-focus';
54
+ /** Where the content sits down the viewport. @default 'center' */
55
+ align?: NebaAlign;
56
+ /** Scale of the padding around the content. @default 'md' */
57
+ size?: NebaSize;
58
+ /** Semantic colour role. Reaches the focus ring and whatever the content reads. */
59
+ color?: NebaColor;
60
+ /**
61
+ * The accessible name of the overlay. An overlay that holds nothing readable
62
+ * — a bare spinner, a `clear` sheet — still has to say what it is, so this
63
+ * has a default rather than being optional.
64
+ * @default 'Overlay'
65
+ */
66
+ label?: string;
67
+ /** What sits on top of the scrim — a spinner, a line of text, a small card. */
68
+ children?: React.ReactNode;
69
+ className?: string;
70
+ style?: React.CSSProperties;
71
+ }
72
+ /**
73
+ * A sheet over the whole page that stops it being used.
74
+ *
75
+ * The difference from [Dialog](../surfaces/dialog) is what is *not* here: no
76
+ * surface, no border, no title, no actions. An overlay is the scrim on its own,
77
+ * with whatever the caller puts on top of it — most often a spinner and a line
78
+ * saying what is being waited for.
79
+ *
80
+ * It is not dismissible by default, and that is the one prop worth reading
81
+ * twice. Everything else Base UI owns: the portal, the scroll lock, the focus
82
+ * held inside, the page behind going inert, and focus returning to wherever it
83
+ * came from when the overlay closes.
84
+ */
85
+ export declare function Overlay({ open, defaultOpen, onOpenChange, tone, dismissible, modal, align, size, color, label, className, style, children }: OverlayProps): React.JSX.Element;
@@ -0,0 +1 @@
1
+ import{jsx as e,jsxs as a}from"react/jsx-runtime";import{Dialog as r}from"@base-ui/react/dialog";import{surfaceSlots as n}from"../../internal/styles";const t={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:""},l={start:"items-start",center:"items-center",end:"items-end"},i={xs:"p-3",sm:"p-4",md:"p-6",lg:"p-8",xl:"p-10"},s=["[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" ");export function Overlay({open:o,defaultOpen:c,onOpenChange:p,tone:m="scrim",dismissible:d=!1,modal:b=!0,align:f="center",size:u="md",color:x="primary",label:y="Overlay",className:g,style:h,children:j}){return e(r.Root,{open:o,defaultOpen:c,modal:b,disablePointerDismissal:!d,onOpenChange:(e,a)=>{d||e||"escape-key"!==a.reason?p?.(e):a.cancel()},children:a(r.Portal,{children:[e(r.Backdrop,{className:`neba-portal fixed inset-0 z-50 ${s} ${t[m]}`}),e(r.Viewport,{className:["neba-portal fixed inset-0 z-50 flex justify-center",l[f],i[u]].join(" "),children:e(r.Popup,{"aria-label":y,className:["flex max-h-full max-w-full flex-col items-center justify-center","[outline:none]",s,g??""].filter(Boolean).join(" "),style:{...n(x,0),...h},children:j})})]})})}
@@ -0,0 +1,2 @@
1
+ export { Overlay } from './Overlay';
2
+ export type { OverlayProps, OverlayTone } from './Overlay';
@@ -0,0 +1 @@
1
+ export{Overlay}from"./Overlay";