neba 1.7.0 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/README.md +13 -7
  2. package/dist/components/accordion/Accordion.js +1 -1
  3. package/dist/components/alert/Alert.js +1 -1
  4. package/dist/components/animate-appear/AnimateAppear.js +1 -1
  5. package/dist/components/animate-blink/AnimateBlink.js +1 -1
  6. package/dist/components/animate-fade/AnimateFade.js +1 -1
  7. package/dist/components/animate-grow/AnimateGrow.js +1 -1
  8. package/dist/components/animate-headline/AnimateHeadline.js +1 -1
  9. package/dist/components/animate-lighting/AnimateLighting.js +1 -1
  10. package/dist/components/animate-marquee/AnimateMarquee.js +1 -1
  11. package/dist/components/animate-rotate/AnimateRotate.js +1 -1
  12. package/dist/components/animate-slide/AnimateSlide.js +1 -1
  13. package/dist/components/animate-typing/AnimateTyping.js +1 -1
  14. package/dist/components/animate-zoom/AnimateZoom.js +1 -1
  15. package/dist/components/app-logo/AppLogo.d.ts +148 -0
  16. package/dist/components/app-logo/AppLogo.js +1 -0
  17. package/dist/components/app-logo/index.d.ts +2 -0
  18. package/dist/components/app-logo/index.js +1 -0
  19. package/dist/components/area-chart/AreaChart.js +1 -1
  20. package/dist/components/aspect-ratio/AspectRatio.js +1 -1
  21. package/dist/components/avatar/Avatar.js +1 -1
  22. package/dist/components/badge/Badge.js +1 -1
  23. package/dist/components/bar-chart/BarChart.js +1 -1
  24. package/dist/components/blockquote/Blockquote.js +1 -1
  25. package/dist/components/bottom-navigation/BottomNavigation.js +1 -1
  26. package/dist/components/box/Box.js +1 -1
  27. package/dist/components/breadcrumb/Breadcrumb.js +1 -1
  28. package/dist/components/button/Button.js +1 -1
  29. package/dist/components/button-group/ButtonGroup.js +1 -1
  30. package/dist/components/card/Card.js +1 -1
  31. package/dist/components/carousel/Carousel.js +1 -1
  32. package/dist/components/chat-bubble/ChatBubble.js +1 -1
  33. package/dist/components/checkbox/Checkbox.js +1 -1
  34. package/dist/components/chip/Chip.js +1 -1
  35. package/dist/components/code-block/CodeBlock.d.ts +170 -0
  36. package/dist/components/code-block/CodeBlock.js +1 -0
  37. package/dist/components/code-block/index.d.ts +2 -0
  38. package/dist/components/code-block/index.js +1 -0
  39. package/dist/components/collapsible/Collapsible.js +1 -1
  40. package/dist/components/color-picker/ColorPicker.d.ts +1 -1
  41. package/dist/components/color-picker/ColorPicker.js +1 -1
  42. package/dist/components/combobox/Combobox.js +1 -1
  43. package/dist/components/container/Container.js +1 -1
  44. package/dist/components/data-table/DataTable.js +1 -1
  45. package/dist/components/date-picker/DatePicker.js +1 -1
  46. package/dist/components/date-range-picker/DateRangePicker.js +1 -1
  47. package/dist/components/date-time-picker/DateTimePicker.js +1 -1
  48. package/dist/components/dialog/Dialog.js +1 -1
  49. package/dist/components/divider/Divider.js +1 -1
  50. package/dist/components/drawer/Drawer.js +1 -1
  51. package/dist/components/empty/Empty.js +1 -1
  52. package/dist/components/file-picker/FilePicker.js +1 -1
  53. package/dist/components/floating-action-button/FloatingActionButton.js +1 -1
  54. package/dist/components/floating-bottom-navigation/FloatingBottomNavigation.js +1 -1
  55. package/dist/components/footer/Footer.d.ts +85 -0
  56. package/dist/components/footer/Footer.js +1 -0
  57. package/dist/components/footer/index.d.ts +2 -0
  58. package/dist/components/footer/index.js +1 -0
  59. package/dist/components/grid/Grid.js +1 -1
  60. package/dist/components/grid-container/GridContainer.js +1 -1
  61. package/dist/components/header/Header.d.ts +114 -0
  62. package/dist/components/header/Header.js +1 -0
  63. package/dist/components/header/index.d.ts +2 -0
  64. package/dist/components/header/index.js +1 -0
  65. package/dist/components/heatmap-chart/HeatmapChart.js +1 -1
  66. package/dist/components/highlight/Highlight.js +1 -1
  67. package/dist/components/how-to-steps/HowToSteps.d.ts +167 -0
  68. package/dist/components/how-to-steps/HowToSteps.js +1 -0
  69. package/dist/components/how-to-steps/index.d.ts +2 -0
  70. package/dist/components/how-to-steps/index.js +1 -0
  71. package/dist/components/icon/Icon.js +1 -1
  72. package/dist/components/icon-button/IconButton.js +1 -1
  73. package/dist/components/line-chart/LineChart.js +1 -1
  74. package/dist/components/list/List.js +1 -1
  75. package/dist/components/menu/Menu.js +1 -1
  76. package/dist/components/mockup/Mockup.js +1 -1
  77. package/dist/components/number-field/NumberField.js +1 -1
  78. package/dist/components/otp-field/OtpField.js +1 -1
  79. package/dist/components/overlay/Overlay.js +1 -1
  80. package/dist/components/page-layout/PageLayout.d.ts +144 -0
  81. package/dist/components/page-layout/PageLayout.js +1 -0
  82. package/dist/components/page-layout/index.d.ts +2 -0
  83. package/dist/components/page-layout/index.js +1 -0
  84. package/dist/components/pagination/Pagination.js +1 -1
  85. package/dist/components/panes/Panes.js +1 -1
  86. package/dist/components/pie-chart/PieChart.js +1 -1
  87. package/dist/components/pill/Pill.js +1 -1
  88. package/dist/components/popover/Popover.js +1 -1
  89. package/dist/components/progress-box/ProgressBox.js +1 -1
  90. package/dist/components/progress-circular/ProgressCircular.js +1 -1
  91. package/dist/components/progress-linear/ProgressLinear.js +1 -1
  92. package/dist/components/radio-group/RadioGroup.js +1 -1
  93. package/dist/components/rating/Rating.js +1 -1
  94. package/dist/components/scatter-chart/ScatterChart.js +1 -1
  95. package/dist/components/scroll-zone/ScrollZone.js +1 -1
  96. package/dist/components/segmented-button/SegmentedButton.js +1 -1
  97. package/dist/components/select/Select.js +1 -1
  98. package/dist/components/shortcut/Shortcut.js +1 -1
  99. package/dist/components/sidebar/Sidebar.d.ts +144 -0
  100. package/dist/components/sidebar/Sidebar.js +1 -0
  101. package/dist/components/sidebar/SidebarTrigger.d.ts +36 -0
  102. package/dist/components/sidebar/SidebarTrigger.js +1 -0
  103. package/dist/components/sidebar/index.d.ts +4 -0
  104. package/dist/components/sidebar/index.js +1 -0
  105. package/dist/components/skeleton/Skeleton.js +1 -1
  106. package/dist/components/slider/Slider.js +1 -1
  107. package/dist/components/sparkline/Sparkline.js +1 -1
  108. package/dist/components/spoiler/Spoiler.js +1 -1
  109. package/dist/components/statistic/Statistic.js +1 -1
  110. package/dist/components/switch/Switch.js +1 -1
  111. package/dist/components/table/Table.js +1 -1
  112. package/dist/components/tabs/Tabs.js +1 -1
  113. package/dist/components/text-field/TextField.js +1 -1
  114. package/dist/components/text-link/TextLink.js +1 -1
  115. package/dist/components/time-picker/TimePicker.js +1 -1
  116. package/dist/components/timeline/Timeline.js +1 -1
  117. package/dist/components/timeline-chart/TimelineChart.js +1 -1
  118. package/dist/components/toast/Toast.js +1 -1
  119. package/dist/components/toolbar/Toolbar.js +1 -1
  120. package/dist/components/tooltip/Tooltip.js +1 -1
  121. package/dist/components/tree-view/TreeView.js +1 -1
  122. package/dist/components/typography/Typography.js +1 -1
  123. package/dist/components/window-pane/WindowPane.js +1 -1
  124. package/dist/index.d.ts +7 -0
  125. package/dist/index.js +1 -1
  126. package/dist/internal/animate.js +1 -1
  127. package/dist/internal/bottom-navigation.d.ts +4 -3
  128. package/dist/internal/bottom-navigation.js +1 -1
  129. package/dist/internal/button-group.js +1 -1
  130. package/dist/internal/calendar.js +1 -1
  131. package/dist/internal/chart-frame.js +1 -1
  132. package/dist/internal/chart.d.ts +3 -2
  133. package/dist/internal/color.d.ts +2 -2
  134. package/dist/internal/date.d.ts +3 -4
  135. package/dist/internal/highlight.d.ts +97 -0
  136. package/dist/internal/highlight.js +1 -0
  137. package/dist/internal/i18n.d.ts +85 -0
  138. package/dist/internal/i18n.js +1 -1
  139. package/dist/internal/icons.d.ts +20 -0
  140. package/dist/internal/icons.js +1 -1
  141. package/dist/internal/initials.d.ts +24 -0
  142. package/dist/internal/initials.js +1 -0
  143. package/dist/internal/menu.js +1 -1
  144. package/dist/internal/page-layout.d.ts +143 -0
  145. package/dist/internal/page-layout.js +1 -0
  146. package/dist/internal/styles.d.ts +11 -0
  147. package/dist/internal/styles.js +1 -1
  148. package/dist/locales/ar.js +1 -1
  149. package/dist/locales/de.js +1 -1
  150. package/dist/locales/es.js +1 -1
  151. package/dist/locales/fr.js +1 -1
  152. package/dist/locales/hi.js +1 -1
  153. package/dist/locales/id.js +1 -1
  154. package/dist/locales/it.js +1 -1
  155. package/dist/locales/ja.js +1 -1
  156. package/dist/locales/ko.js +1 -1
  157. package/dist/locales/nl.js +1 -1
  158. package/dist/locales/pl.js +1 -1
  159. package/dist/locales/pt.js +1 -1
  160. package/dist/locales/ru.js +1 -1
  161. package/dist/locales/th.js +1 -1
  162. package/dist/locales/tr.js +1 -1
  163. package/dist/locales/vi.js +1 -1
  164. package/dist/locales/zh-hans.js +1 -1
  165. package/dist/locales/zh-hant.js +1 -1
  166. package/dist/styles.css +1 -1
  167. package/dist/tailwind.css +473 -0
  168. package/package.json +8 -7
@@ -1 +1 @@
1
- import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as t from"react";import{IconButton as n}from"../icon-button/IconButton.js";import{carouselMessages as a,fillMessage as o,useMessages as i}from"../../internal/i18n.js";import{ChevronIcon as l}from"../../internal/icons.js";import{radiusClasses as s,srOnlyClasses as c,surfaceClasses as u,surfaceSlots as d,transitionClasses as f}from"../../internal/styles.js";const m={solid:[u,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[u,"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"},p={xs:"start-1 end-1",sm:"start-1.5 end-1.5",md:"start-2 end-2",lg:"start-3 end-3",xl:"start-4 end-4"},b={xs:{rest:"h-1 w-1",current:"h-1 w-3",gap:"gap-1"},sm:{rest:"h-1 w-1",current:"h-1 w-3.5",gap:"gap-1"},md:{rest:"h-1.5 w-1.5",current:"h-1.5 w-4",gap:"gap-1.5"},lg:{rest:"h-1.5 w-1.5",current:"h-1.5 w-5",gap:"gap-2"},xl:{rest:"h-2 w-2",current:"h-2 w-6",gap:"gap-2"}};export const Carousel=/*@__PURE__*/t.forwardRef(function({variant:u="outline",size:v="md",color:h="primary",density:g="default",elevation:w=0,value:x,defaultValue:j=0,onValueChange:y,loop:N=!0,autoPlay:k=!1,interval:M=5e3,arrows:C=!0,indicators:R=!0,locale:I,label:L,previousLabel:S,nextLabel:$,slideLabel:_,className:z,style:B,children:E,...P},V){const T=i(a,I),W=_??((e,r)=>o(T.slide,{index:String(e),total:String(r)})),A=t.Children.toArray(E),F=A.length,[q,D]=t.useState(j),G=Math.min(Math.max(x??q,0),Math.max(F-1,0)),H=t.useRef(null),J=t.useRef([]),K=t.useRef(!1),O=t.useRef(!1),Q=t.useRef(!1),[U,X]=t.useState(!1),Y=t.useCallback((e,r=!1)=>{if(0===F)return;const t=N?(e%F+F)%F:Math.min(Math.max(e,0),F-1);K.current=r,void 0===x&&D(t),t!==G&&y?.(t)},[F,N,x,G,y]);t.useEffect(()=>{if(K.current)return void(K.current=!1);if(!O.current)return void(O.current=!0);J.current[G]?.scrollIntoView({block:"nearest",inline:"start"}),Q.current=!0;const e=window.setTimeout(()=>{Q.current=!1},700);return()=>window.clearTimeout(e)},[G]);t.useEffect(()=>{if(!k||U||F<2)return;if(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;const e=window.setInterval(()=>{document.hidden||Y(G+1)},M);return()=>window.clearInterval(e)},[k,U,F,M,G,Y]);const Z=G<=0,ee=G>=F-1;return r("div",{ref:V,role:"region","aria-roledescription":"carousel","aria-label":L??T.label,className:["flex flex-col",z??""].filter(Boolean).join(" "),style:{...d(h,w),...B},onPointerEnter:()=>X(!0),onPointerLeave:()=>X(!1),onFocus:()=>X(!0),onBlur:()=>X(!1),...P,children:[r("div",{className:["relative min-w-0 overflow-hidden",s[v],m[u],f].join(" "),children:[e("div",{ref:H,tabIndex:0,role:"group","aria-label":L??T.label,className:["flex min-w-0 snap-x snap-mandatory overflow-x-auto scroll-smooth","motion-reduce:scroll-auto","[scrollbar-width:none] [&::-webkit-scrollbar]:hidden","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]"].join(" "),onScroll:()=>{const e=H.current;if(Q.current||!e||0===e.clientWidth)return;const r=Math.round(Math.abs(e.scrollLeft)/e.clientWidth);r!==G&&r>=0&&r<F&&Y(r,!0)},children:A.map((r,t)=>e("div",{ref:e=>{J.current[t]=e},role:"group","aria-roledescription":"slide","aria-label":W(t+1,F),className:"w-full shrink-0 grow-0 basis-full snap-start",children:r},t))}),C&&F>1?r("div",{className:`pointer-events-none absolute inset-y-0 flex items-center ${p[v]}`,children:[e(n,{variant:"solid",size:v,color:h,density:g,elevation:1,label:S??T.previous,disabled:!N&&Z,className:"pointer-events-auto",icon:e("span",{className:"flex items-center rotate-90 rtl:-rotate-90",children:e(l,{})}),onClick:()=>Y(G-1)}),e("span",{className:"flex-1"}),e(n,{variant:"solid",size:v,color:h,density:g,elevation:1,label:$??T.next,disabled:!N&&ee,className:"pointer-events-auto",icon:e("span",{className:"flex items-center -rotate-90 rtl:rotate-90",children:e(l,{})}),onClick:()=>Y(G+1)})]}):null]}),R&&F>1?e("div",{className:`flex shrink-0 items-center justify-center pt-2 ${b[v].gap}`,children:A.map((r,t)=>e("button",{type:"button","aria-label":W(t+1,F),"aria-current":t===G?"true":void 0,className:["cursor-pointer rounded-full","[transition-property:width,background-color]","[transition-duration:var(--neba-duration)]","[transition-timing-function:var(--neba-ease)]","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2",t===G?`${b[v].current} bg-(--n-accent)`:`${b[v].rest} bg-(--n-line-hover) hover:bg-(--n-accent)`].join(" "),onClick:()=>Y(t)},t))}):null,e("span",{className:c,"aria-live":k?"off":"polite",children:F>0?W(G+1,F):""})]})});
1
+ "use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as t from"react";import{IconButton as n}from"../icon-button/IconButton.js";import{carouselMessages as a,fillMessage as o,useMessages as i}from"../../internal/i18n.js";import{ChevronIcon as l}from"../../internal/icons.js";import{radiusClasses as s,srOnlyClasses as c,surfaceClasses as u,surfaceSlots as d,transitionClasses as f}from"../../internal/styles.js";const m={solid:[u,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[u,"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"},p={xs:"start-1 end-1",sm:"start-1.5 end-1.5",md:"start-2 end-2",lg:"start-3 end-3",xl:"start-4 end-4"},b={xs:{rest:"h-1 w-1",current:"h-1 w-3",gap:"gap-1"},sm:{rest:"h-1 w-1",current:"h-1 w-3.5",gap:"gap-1"},md:{rest:"h-1.5 w-1.5",current:"h-1.5 w-4",gap:"gap-1.5"},lg:{rest:"h-1.5 w-1.5",current:"h-1.5 w-5",gap:"gap-2"},xl:{rest:"h-2 w-2",current:"h-2 w-6",gap:"gap-2"}};export const Carousel=/*@__PURE__*/t.forwardRef(function({variant:u="outline",size:v="md",color:h="primary",density:g="default",elevation:w=0,value:x,defaultValue:j=0,onValueChange:y,loop:N=!0,autoPlay:k=!1,interval:M=5e3,arrows:C=!0,indicators:R=!0,locale:I,label:L,previousLabel:S,nextLabel:$,slideLabel:_,className:z,style:B,children:E,...P},V){const T=i(a,I),W=_??((e,r)=>o(T.slide,{index:String(e),total:String(r)})),A=t.Children.toArray(E),F=A.length,[q,D]=t.useState(j),G=Math.min(Math.max(x??q,0),Math.max(F-1,0)),H=t.useRef(null),J=t.useRef([]),K=t.useRef(!1),O=t.useRef(!1),Q=t.useRef(!1),[U,X]=t.useState(!1),Y=t.useCallback((e,r=!1)=>{if(0===F)return;const t=N?(e%F+F)%F:Math.min(Math.max(e,0),F-1);K.current=r,void 0===x&&D(t),t!==G&&y?.(t)},[F,N,x,G,y]);t.useEffect(()=>{if(K.current)return void(K.current=!1);if(!O.current)return void(O.current=!0);J.current[G]?.scrollIntoView({block:"nearest",inline:"start"}),Q.current=!0;const e=window.setTimeout(()=>{Q.current=!1},700);return()=>window.clearTimeout(e)},[G]);t.useEffect(()=>{if(!k||U||F<2)return;if(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;const e=window.setInterval(()=>{document.hidden||Y(G+1)},M);return()=>window.clearInterval(e)},[k,U,F,M,G,Y]);const Z=G<=0,ee=G>=F-1;return r("div",{ref:V,role:"region","aria-roledescription":"carousel","aria-label":L??T.label,className:["flex flex-col",z??""].filter(Boolean).join(" "),style:{...d(h,w),...B},onPointerEnter:()=>X(!0),onPointerLeave:()=>X(!1),onFocus:()=>X(!0),onBlur:()=>X(!1),...P,children:[r("div",{className:["relative min-w-0 overflow-hidden",s[v],m[u],f].join(" "),children:[e("div",{ref:H,tabIndex:0,role:"group","aria-label":L??T.label,className:["flex min-w-0 snap-x snap-mandatory overflow-x-auto scroll-smooth","motion-reduce:scroll-auto","[scrollbar-width:none] [&::-webkit-scrollbar]:hidden","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]"].join(" "),onScroll:()=>{const e=H.current;if(Q.current||!e||0===e.clientWidth)return;const r=Math.round(Math.abs(e.scrollLeft)/e.clientWidth);r!==G&&r>=0&&r<F&&Y(r,!0)},children:A.map((r,t)=>e("div",{ref:e=>{J.current[t]=e},role:"group","aria-roledescription":"slide","aria-label":W(t+1,F),className:"w-full shrink-0 grow-0 basis-full snap-start",children:r},t))}),C&&F>1?r("div",{className:`pointer-events-none absolute inset-y-0 flex items-center ${p[v]}`,children:[e(n,{variant:"solid",size:v,color:h,density:g,elevation:1,label:S??T.previous,disabled:!N&&Z,className:"pointer-events-auto",icon:e("span",{className:"flex items-center rotate-90 rtl:-rotate-90",children:e(l,{})}),onClick:()=>Y(G-1)}),e("span",{className:"flex-1"}),e(n,{variant:"solid",size:v,color:h,density:g,elevation:1,label:$??T.next,disabled:!N&&ee,className:"pointer-events-auto",icon:e("span",{className:"flex items-center -rotate-90 rtl:rotate-90",children:e(l,{})}),onClick:()=>Y(G+1)})]}):null]}),R&&F>1?e("div",{className:`flex shrink-0 items-center justify-center pt-2 ${b[v].gap}`,children:A.map((r,t)=>e("button",{type:"button","aria-label":W(t+1,F),"aria-current":t===G?"true":void 0,className:["cursor-pointer rounded-full","[transition-property:width,background-color]","[transition-duration:var(--neba-duration)]","[transition-timing-function:var(--neba-ease)]","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2",t===G?`${b[v].current} bg-(--n-accent)`:`${b[v].rest} bg-(--n-line-hover) hover:bg-(--n-accent)`].join(" "),onClick:()=>Y(t)},t))}):null,e("span",{className:c,"aria-live":k?"off":"polite",children:F>0?W(G+1,F):""})]})});
@@ -1 +1 @@
1
- import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as r from"react";import{chatMessages as a,useMessages as l}from"../../internal/i18n.js";import{CheckIcon as i,ClockIcon as t,DangerIcon as o,LinkIcon as s}from"../../internal/icons.js";import{controlSlots as c,hasContent as d,metaTextClasses as m,radiusClasses as p,sheetBodyClasses as u,sheetHeaderGapClasses as b,srOnlyClasses as f,surfaceClasses as v,transitionClasses as x}from"../../internal/styles.js";const h={default:{xs:"px-2 py-1",sm:"px-2.5 py-1.5",md:"px-3 py-2",lg:"px-3.5 py-2.5",xl:"px-4 py-3"},compact:{xs:"px-1.5 py-0.5",sm:"px-2 py-1",md:"px-2.5 py-1.5",lg:"px-3 py-1.5",xl:"px-3.5 py-2"}},g={start:"[border-start-start-radius:0.25rem]",end:"[border-start-end-radius:0.25rem]"},y={solid:[v,"text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[v,"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-(--n-soft) [box-shadow:var(--n-elev)]"};function w(){return n("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e("path",{d:"m1.5 8.5 2.75 2.75L9.5 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M7 10.75 8.25 12l5.25-5.25",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})]})}const N={sending:e(t,{}),sent:e(i,{}),delivered:e(w,{}),read:e(w,{}),failed:e(o,{})},k={sending:"text-(--neba-muted-fg)",sent:"text-(--neba-muted-fg)",delivered:"text-(--neba-muted-fg)",read:"text-(--n-accent)",failed:"text-(--neba-danger-accent)"},_=["block overflow-hidden rounded-(--neba-radius-sm) border no-underline","[border-color:color-mix(in_oklab,currentColor_18%,transparent)]","[background-color:color-mix(in_oklab,currentColor_7%,transparent)]","hover:[background-color:color-mix(in_oklab,currentColor_12%,transparent)]","[transition-property:background-color] [transition-duration:var(--neba-duration)]","[transition-timing-function:var(--neba-ease)]","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"].join(" "),j=["shrink-0 opacity-0","[transition:opacity_var(--neba-duration)_var(--neba-ease)]","group-hover/bubble:opacity-100 group-focus-within/bubble:opacity-100","[@media(hover:none)]:opacity-100"].join(" ");export const ChatBubble=/*@__PURE__*/r.forwardRef(function({side:r="start",name:i,time:t,avatar:o,status:s,statusLabel:v,typing:w=!1,media:_,preview:z,actions:B,locale:W,variant:M="outline",size:R="md",color:T="primary",density:$="default",elevation:q=0,className:A,style:D,children:E,...F},G){const H=l(a,W),I="end"===r,J=d(i)||d(t),K=w||d(E)||Boolean(z),O=["flex min-w-0 flex-col overflow-hidden",p[R],g[r],y[M],x].join(" "),P=s?v??H[s]:"";return n("div",{ref:G,className:["group/bubble flex w-full items-start gap-2",I?"flex-row-reverse":"",A??""].filter(Boolean).join(" "),style:{...c(T,q,M),...D},...F,children:[d(o)?e("div",{className:"shrink-0",children:o}):null,n("div",{className:["flex min-w-0 max-w-[min(100%,32rem)] flex-col",b[R],I?"items-end":"items-start"].join(" "),children:[J?n("div",{className:`flex items-baseline gap-2 ${m[R]}`,children:[d(i)?e("span",{className:"font-semibold",children:i}):null,d(t)?e("span",{className:"text-(--neba-muted-fg)",children:t}):null]}):null,n("div",{className:"flex min-w-0 items-center gap-1 "+(I?"flex-row-reverse":""),children:[n("div",{className:O,children:[d(_)?e("div",{className:"[&_img]:block [&_img]:w-full [&_video]:block [&_video]:w-full",children:_}):null,K?n("div",{className:[h[$][R],"flex min-w-0 flex-col gap-2",u[R]].join(" "),children:[w?e(C,{label:H.typing}):d(E)?e("div",{className:"min-w-0 break-words whitespace-pre-line",children:E}):null,z?e(L,{preview:z}):null]}):null]}),d(B)?e("div",{className:j,children:B}):null]}),s?n("div",{className:["flex items-center gap-1",m[R],k[s],"[&_svg]:size-[1.15em] [&_svg]:shrink-0"].join(" "),children:[N[s],e("span",{className:f,children:P})]}):null]})]})});function C({label:r}){return n("div",{className:"flex items-center gap-1 py-[0.35em]",role:"status",children:[[0,1,2].map(n=>e("span",{"aria-hidden":"true",className:"neba-typing-dot size-[0.45em] rounded-full",style:{"--n-i":n}},n)),e("span",{className:f,children:r})]})}function L({preview:r}){const{url:a,title:l,description:i,image:t,site:o,newTab:c=!1}=r;return n("a",{href:a,target:c?"_blank":void 0,rel:c?"noopener noreferrer":void 0,className:_,children:[t?e("img",{src:t,alt:"",className:"block h-28 w-full object-cover"}):null,n("div",{className:"flex flex-col gap-0.5 p-2",children:[d(o)?n("span",{className:"flex items-center gap-1 text-[0.85em] opacity-70 [&_svg]:size-[1em] [&_svg]:shrink-0",children:[e(s,{}),e("span",{className:"truncate",children:o})]}):null,d(l)?e("span",{className:"font-semibold",children:l}):null,d(i)?e("span",{className:"line-clamp-2 text-[0.9em] opacity-80",children:i}):null]})]})}
1
+ "use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as r from"react";import{chatMessages as a,useMessages as l}from"../../internal/i18n.js";import{CheckIcon as i,ClockIcon as t,DangerIcon as s,LinkIcon as o}from"../../internal/icons.js";import{controlSlots as c,hasContent as d,metaTextClasses as m,radiusClasses as p,sheetBodyClasses as u,sheetHeaderGapClasses as b,srOnlyClasses as f,surfaceClasses as v,transitionClasses as x}from"../../internal/styles.js";const h={default:{xs:"px-2 py-1",sm:"px-2.5 py-1.5",md:"px-3 py-2",lg:"px-3.5 py-2.5",xl:"px-4 py-3"},compact:{xs:"px-1.5 py-0.5",sm:"px-2 py-1",md:"px-2.5 py-1.5",lg:"px-3 py-1.5",xl:"px-3.5 py-2"}},g={start:"[border-start-start-radius:0.25rem]",end:"[border-start-end-radius:0.25rem]"},y={solid:[v,"text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[v,"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-(--n-soft) [box-shadow:var(--n-elev)]"};function w(){return n("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e("path",{d:"m1.5 8.5 2.75 2.75L9.5 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M7 10.75 8.25 12l5.25-5.25",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})]})}const N={sending:e(t,{}),sent:e(i,{}),delivered:e(w,{}),read:e(w,{}),failed:e(s,{})},k={sending:"text-(--neba-muted-fg)",sent:"text-(--neba-muted-fg)",delivered:"text-(--neba-muted-fg)",read:"text-(--n-accent)",failed:"text-(--neba-danger-accent)"},_=["block overflow-hidden rounded-(--neba-radius-sm) border no-underline","[border-color:color-mix(in_oklab,currentColor_18%,transparent)]","[background-color:color-mix(in_oklab,currentColor_7%,transparent)]","hover:[background-color:color-mix(in_oklab,currentColor_12%,transparent)]","[transition-property:background-color] [transition-duration:var(--neba-duration)]","[transition-timing-function:var(--neba-ease)]","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"].join(" "),j=["shrink-0 opacity-0","[transition:opacity_var(--neba-duration)_var(--neba-ease)]","group-hover/bubble:opacity-100 group-focus-within/bubble:opacity-100","[@media(hover:none)]:opacity-100"].join(" ");export const ChatBubble=/*@__PURE__*/r.forwardRef(function({side:r="start",name:i,time:t,avatar:s,status:o,statusLabel:v,typing:w=!1,media:_,preview:z,actions:B,locale:W,variant:M="outline",size:R="md",color:T="primary",density:$="default",elevation:q=0,className:A,style:D,children:E,...F},G){const H=l(a,W),I="end"===r,J=d(i)||d(t),K=w||d(E)||Boolean(z),O=["flex min-w-0 flex-col overflow-hidden",p[R],g[r],y[M],x].join(" "),P=o?v??H[o]:"";return n("div",{ref:G,className:["group/bubble flex w-full items-start gap-2",I?"flex-row-reverse":"",A??""].filter(Boolean).join(" "),style:{...c(T,q,M),...D},...F,children:[d(s)?e("div",{className:"shrink-0",children:s}):null,n("div",{className:["flex min-w-0 max-w-[min(100%,32rem)] flex-col",b[R],I?"items-end":"items-start"].join(" "),children:[J?n("div",{className:`flex items-baseline gap-2 ${m[R]}`,children:[d(i)?e("span",{className:"font-semibold",children:i}):null,d(t)?e("span",{className:"text-(--neba-muted-fg)",children:t}):null]}):null,n("div",{className:"flex min-w-0 items-center gap-1 "+(I?"flex-row-reverse":""),children:[n("div",{className:O,children:[d(_)?e("div",{className:"[&_img]:block [&_img]:w-full [&_video]:block [&_video]:w-full",children:_}):null,K?n("div",{className:[h[$][R],"flex min-w-0 flex-col gap-2",u[R]].join(" "),children:[w?e(C,{label:H.typing}):d(E)?e("div",{className:"min-w-0 break-words whitespace-pre-line",children:E}):null,z?e(L,{preview:z}):null]}):null]}),d(B)?e("div",{className:j,children:B}):null]}),o?n("div",{className:["flex items-center gap-1",m[R],k[o],"[&_svg]:size-[1.15em] [&_svg]:shrink-0"].join(" "),children:[N[o],e("span",{className:f,children:P})]}):null]})]})});function C({label:r}){return n("div",{className:"flex items-center gap-1 py-[0.35em]",role:"status",children:[[0,1,2].map(n=>e("span",{"aria-hidden":"true",className:"neba-typing-dot size-[0.45em] rounded-full",style:{"--n-i":n}},n)),e("span",{className:f,children:r})]})}function L({preview:r}){const{url:a,title:l,description:i,image:t,site:s,newTab:c=!1}=r;return n("a",{href:a,target:c?"_blank":void 0,rel:c?"noopener noreferrer":void 0,className:_,children:[t?e("img",{src:t,alt:"",className:"block h-28 w-full object-cover"}):null,n("div",{className:"flex flex-col gap-0.5 p-2",children:[d(s)?n("span",{className:"flex items-center gap-1 text-[0.85em] opacity-70 [&_svg]:size-[1em] [&_svg]:shrink-0",children:[e(o,{}),e("span",{className:"truncate",children:s})]}):null,d(l)?e("span",{className:"font-semibold",children:l}):null,d(i)?e("span",{className:"line-clamp-2 text-[0.9em] opacity-80",children:i}):null]})]})}
@@ -1 +1 @@
1
- import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as r from"react";import{Checkbox as a}from"@base-ui/react/checkbox";import{Field as i}from"@base-ui/react/field";import{controlTextClasses as l,metaTextClasses as t,surfaceClasses as o,tickRadiusClasses as s,tickRowLeadingClasses as d,tickSizeClasses as c,transitionClasses as b}from"../../internal/styles.js";const h=["relative inline-flex shrink-0 items-center justify-center border","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",b,"active:[transition-duration:0ms]","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"].join(" "),f=[o,"cursor-pointer bg-(--n-panel) [border-color:var(--n-line)]","hover:bg-(--n-panel-hover) hover:[border-color:var(--n-line-hover)]","data-[checked]:bg-(--n-fill) data-[checked]:text-(--n-on-solid)","data-[checked]:[border-color:transparent]","data-[checked]:hover:bg-(--n-fill-hover)","data-[indeterminate]:bg-(--n-fill) data-[indeterminate]:text-(--n-on-solid)","data-[indeterminate]:[border-color:transparent]"].join(" "),m=[o,"cursor-default bg-(--n-panel) [border-color:var(--n-line)]","[filter:saturate(0.55)]","data-[checked]:bg-(--n-fill) data-[checked]:text-(--n-on-solid)","data-[checked]:[border-color:transparent]"].join(" "),u=["cursor-not-allowed bg-transparent [border-color:var(--neba-disabled-border)]","text-(--neba-disabled-fg) shadow-none","data-[checked]:bg-(--neba-disabled-bg)","data-[indeterminate]:bg-(--neba-disabled-bg)"].join(" ");function v(){return e("svg",{viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",className:"size-full",children:e("path",{d:"M2 6.2 4.6 8.8 10 3.4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function p(){return e("svg",{viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",className:"size-full",children:e("path",{d:"M2.5 6h7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}export const Checkbox=/*@__PURE__*/r.forwardRef(function({size:r="md",color:o="primary",label:b,description:g,error:x,invalid:k,disabled:j=!1,readOnly:N=!1,className:$,style:y,...w},z){const C=null!=x&&!1!==x&&""!==x,L=k??C,B=L?"danger":o,R={"--n-fill":`var(--neba-${B}-fill)`,"--n-fill-hover":`var(--neba-${B}-fill-hover)`,"--n-on-solid":`var(--neba-${B}-on-solid)`,"--n-accent":`var(--neba-${B}-accent)`,"--n-panel":"var(--neba-panel)","--n-panel-hover":"var(--neba-panel-hover)","--n-line":`var(--neba-${B}-line)`,"--n-line-hover":`var(--neba-${B}-line-hover)`,"--n-ring":`var(--neba-${B}-ring)`},M=[h,c[r],s[r],j?u:N?m:f].join(" ");return n(i.Root,{disabled:j,invalid:L,className:["inline-flex flex-col gap-1 align-top",$??""].filter(Boolean).join(" "),style:{...R,...y},children:[n("div",{className:`flex items-start gap-2 ${l[r]} ${d}`,children:[e("span",{className:"flex h-[1lh] shrink-0 items-center",children:e(a.Root,{ref:z,className:M,disabled:j,readOnly:N,...w,children:e(a.Indicator,{className:"flex size-[70%] items-center justify-center",children:w.indeterminate?e(p,{}):e(v,{})})})}),b||g?n("span",{className:"flex min-w-0 flex-col gap-0.5",children:[b?e(i.Label,{className:["leading-[1.4]",j?"text-(--neba-disabled-fg)":"cursor-pointer text-(--neba-fg)"].join(" "),children:b}):null,g?e(i.Description,{className:`${t[r]} text-(--neba-muted-fg)`,children:g}):null]}):null]}),C?e(i.Error,{match:!0,className:`${t[r]} text-(--n-accent)`,children:x}):null]})});
1
+ "use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as r from"react";import{Checkbox as a}from"@base-ui/react/checkbox";import{Field as i}from"@base-ui/react/field";import{controlTextClasses as l,metaTextClasses as t,surfaceClasses as o,tickRadiusClasses as s,tickRowLeadingClasses as d,tickSizeClasses as c,transitionClasses as b}from"../../internal/styles.js";const h=["relative inline-flex shrink-0 items-center justify-center border","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",b,"active:[transition-duration:0ms]","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"].join(" "),f=[o,"cursor-pointer bg-(--n-panel) [border-color:var(--n-line)]","hover:bg-(--n-panel-hover) hover:[border-color:var(--n-line-hover)]","data-[checked]:bg-(--n-fill) data-[checked]:text-(--n-on-solid)","data-[checked]:[border-color:transparent]","data-[checked]:hover:bg-(--n-fill-hover)","data-[indeterminate]:bg-(--n-fill) data-[indeterminate]:text-(--n-on-solid)","data-[indeterminate]:[border-color:transparent]"].join(" "),u=[o,"cursor-default bg-(--n-panel) [border-color:var(--n-line)]","[filter:saturate(0.55)]","data-[checked]:bg-(--n-fill) data-[checked]:text-(--n-on-solid)","data-[checked]:[border-color:transparent]"].join(" "),m=["cursor-not-allowed bg-transparent [border-color:var(--neba-disabled-border)]","text-(--neba-disabled-fg) shadow-none","data-[checked]:bg-(--neba-disabled-bg)","data-[indeterminate]:bg-(--neba-disabled-bg)"].join(" ");function v(){return e("svg",{viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",className:"size-full",children:e("path",{d:"M2 6.2 4.6 8.8 10 3.4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function p(){return e("svg",{viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",className:"size-full",children:e("path",{d:"M2.5 6h7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}export const Checkbox=/*@__PURE__*/r.forwardRef(function({size:r="md",color:o="primary",label:b,description:g,error:x,invalid:k,disabled:j=!1,readOnly:N=!1,className:$,style:y,...w},z){const C=null!=x&&!1!==x&&""!==x,L=k??C,B=L?"danger":o,R={"--n-fill":`var(--neba-${B}-fill)`,"--n-fill-hover":`var(--neba-${B}-fill-hover)`,"--n-on-solid":`var(--neba-${B}-on-solid)`,"--n-accent":`var(--neba-${B}-accent)`,"--n-panel":"var(--neba-panel)","--n-panel-hover":"var(--neba-panel-hover)","--n-line":`var(--neba-${B}-line)`,"--n-line-hover":`var(--neba-${B}-line-hover)`,"--n-ring":`var(--neba-${B}-ring)`},M=[h,c[r],s[r],j?m:N?u:f].join(" ");return n(i.Root,{disabled:j,invalid:L,className:["inline-flex flex-col gap-1 align-top",$??""].filter(Boolean).join(" "),style:{...R,...y},children:[n("div",{className:`flex items-start gap-2 ${l[r]} ${d}`,children:[e("span",{className:"flex h-[1lh] shrink-0 items-center",children:e(a.Root,{ref:z,className:M,disabled:j,readOnly:N,...w,children:e(a.Indicator,{className:"flex size-[70%] items-center justify-center",children:w.indeterminate?e(p,{}):e(v,{})})})}),b||g?n("span",{className:"flex min-w-0 flex-col gap-0.5",children:[b?e(i.Label,{className:["leading-[1.4]",j?"text-(--neba-disabled-fg)":"cursor-pointer text-(--neba-fg)"].join(" "),children:b}):null,g?e(i.Description,{className:`${t[r]} text-(--neba-muted-fg)`,children:g}):null]}):null]}),C?e(i.Error,{match:!0,className:`${t[r]} text-(--n-accent)`,children:x}):null]})});
@@ -1 +1 @@
1
- import{jsx as e,Fragment as n,jsxs as t}from"react/jsx-runtime";import*as l from"react";import{actionMessages as o,useMessages as i}from"../../internal/i18n.js";import{CloseIcon as r}from"../../internal/icons.js";import{transitionProps as s}from"../../internal/animate.js";import{chipRemoveClasses as a,controlHeightClasses as c,controlSlots as d,controlTextClasses as m,disabledClasses as p,focusRingClasses as b,gapClasses as f,iconClasses as u,paddingXClasses as h,pressTransitionClasses as v,radiusClasses as x,surfaceClasses as g,transitionClasses as j}from"../../internal/styles.js";const y={xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"lg"},w={solid:[g,"text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[g,"border text-(--n-accent) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--n-accent) bg-(--n-soft)"},N={solid:"bg-(--n-fill-active)",outline:"bg-(--n-panel-press) [border-color:var(--n-line-hover)]",text:"bg-(--n-soft-press)"},k={solid:"hover:bg-(--n-fill-hover) active:bg-(--n-fill-active)",outline:"hover:bg-(--n-panel-hover) hover:[border-color:var(--n-line-hover)] active:bg-(--n-panel-press)",text:"hover:bg-(--n-soft-hover) active:bg-(--n-soft-press)"},C=["relative inline-flex max-w-full shrink-0 select-none items-center","align-middle font-medium leading-none whitespace-nowrap","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",j,v,u].join(" "),$=["flex min-w-0 flex-1 cursor-pointer items-center justify-center self-stretch rounded-[inherit]",b].join(" ");export const Chip=/*@__PURE__*/l.forwardRef(function({variant:l="outline",size:b="md",color:u="primary",density:v="default",elevation:g=0,startIcon:j,endIcon:B,count:I,onDelete:z,locale:D,deleteLabel:F,transition:L,selected:R=!1,disabled:q=!1,className:A,style:E,children:G,onClick:H,...J},K){const M=i(o,D),O=Boolean(H)&&!q,P=y[b],Q=s(L),S=h[v][P],T=[C,c[P],m[P],f[P],x[P],q?p[l]:w[l],!q&&R?N[l]:"",O?k[l]:"",O?"ps-0":S,z?"pe-1":O?"pe-0":"",Q.className,A??""].filter(Boolean).join(" "),U=t(n,{children:[j,null!=G&&!1!==G?e("span",{className:"min-w-0 truncate",children:G}):null,B,null!=I&&!1!==I?e("span",{className:["ms-0.5 inline-flex shrink-0 items-center justify-center rounded-full px-1.5 py-px","text-[0.85em] leading-none font-semibold tabular-nums","solid"===l?"bg-(--neba-glow-on-fill) text-(--n-on-solid)":"bg-(--n-soft-press) text-(--n-accent)"].join(" "),children:I}):null]});return t("span",{ref:K,className:T,style:{...d(u,g,l),...Q.style,...E},"aria-disabled":!(!q||O)||void 0,...J,children:[O?e("button",{type:"button","aria-pressed":R,className:`${$} ${f[P]} ${S}`,onClick:H,children:U}):U,z?e("button",{type:"button","aria-label":F??M.remove,disabled:q,className:a,onClick:z,children:e(r,{})}):null]})});
1
+ "use client";import{jsx as e,Fragment as n,jsxs as t}from"react/jsx-runtime";import*as l from"react";import{actionMessages as o,useMessages as i}from"../../internal/i18n.js";import{CloseIcon as r}from"../../internal/icons.js";import{transitionProps as s}from"../../internal/animate.js";import{chipRemoveClasses as a,controlHeightClasses as c,controlSlots as d,controlTextClasses as m,disabledClasses as p,focusRingClasses as b,gapClasses as f,iconClasses as u,paddingXClasses as h,pressTransitionClasses as v,radiusClasses as x,surfaceClasses as g,transitionClasses as j}from"../../internal/styles.js";const y={xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"lg"},w={solid:[g,"text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[g,"border text-(--n-accent) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--n-accent) bg-(--n-soft)"},N={solid:"bg-(--n-fill-active)",outline:"bg-(--n-panel-press) [border-color:var(--n-line-hover)]",text:"bg-(--n-soft-press)"},k={solid:"hover:bg-(--n-fill-hover) active:bg-(--n-fill-active)",outline:"hover:bg-(--n-panel-hover) hover:[border-color:var(--n-line-hover)] active:bg-(--n-panel-press)",text:"hover:bg-(--n-soft-hover) active:bg-(--n-soft-press)"},C=["relative inline-flex max-w-full shrink-0 select-none items-center","align-middle font-medium leading-none whitespace-nowrap","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",j,v,u].join(" "),$=["flex min-w-0 flex-1 cursor-pointer items-center justify-center self-stretch rounded-[inherit]",b].join(" ");export const Chip=/*@__PURE__*/l.forwardRef(function({variant:l="outline",size:b="md",color:u="primary",density:v="default",elevation:g=0,startIcon:j,endIcon:B,count:I,onDelete:z,locale:D,deleteLabel:F,transition:L,selected:R=!1,disabled:q=!1,className:A,style:E,children:G,onClick:H,...J},K){const M=i(o,D),O=Boolean(H)&&!q,P=y[b],Q=s(L),S=h[v][P],T=[C,c[P],m[P],f[P],x[P],q?p[l]:w[l],!q&&R?N[l]:"",O?k[l]:"",O?"ps-0":S,z?"pe-1":O?"pe-0":"",Q.className,A??""].filter(Boolean).join(" "),U=t(n,{children:[j,null!=G&&!1!==G?e("span",{className:"min-w-0 truncate",children:G}):null,B,null!=I&&!1!==I?e("span",{className:["ms-0.5 inline-flex shrink-0 items-center justify-center rounded-full px-1.5 py-px","text-[0.85em] leading-none font-semibold tabular-nums","solid"===l?"bg-(--neba-glow-on-fill) text-(--n-on-solid)":"bg-(--n-soft-press) text-(--n-accent)"].join(" "),children:I}):null]});return t("span",{ref:K,className:T,style:{...d(u,g,l),...Q.style,...E},"aria-disabled":!(!q||O)||void 0,...J,children:[O?e("button",{type:"button","aria-pressed":R,className:`${$} ${f[P]} ${S}`,onClick:H,children:U}):U,z?e("button",{type:"button","aria-label":F??M.remove,disabled:q,className:a,onClick:z,children:e(r,{})}):null]})});
@@ -0,0 +1,170 @@
1
+ import * as React from 'react';
2
+ import type { NebaColor, NebaDensity, NebaElevation, NebaSize } from '../../types.js';
3
+ export { registerLanguage } from '../../internal/highlight.js';
4
+ /**
5
+ * Which palette the block wears.
6
+ *
7
+ * The four house themes come first. `dark` is the default and is the only one
8
+ * that is not a preference: code has been read on a dark ground since
9
+ * terminals, and a block that matched the page would be the one element on it
10
+ * whose colours were chosen by something other than the code. `auto` is the
11
+ * opt-out, and `mono` has no hue in it at all.
12
+ *
13
+ * The eight after them are ports, kept at their published values. They exist
14
+ * because a code block is the one component whose colours a reader already has
15
+ * an opinion about: someone who writes in One Dark all day reads a Dracula
16
+ * block as a different product's documentation.
17
+ *
18
+ * The type is open on purpose. A theme is a set of `--n-code-*` custom
19
+ * properties under a `[data-code-theme]` selector and nothing else, so a
20
+ * consumer who writes one in their own stylesheet has a theme — with nothing to
21
+ * register, nothing to import, and no cost to anybody who did not.
22
+ */
23
+ export type CodeBlockTheme = 'dark' | 'light' | 'auto' | 'mono' | 'one-dark' | 'dracula' | 'monokai' | 'nord' | 'night-owl' | 'gruvbox' | 'github' | 'solarized-light';
24
+ export interface CodeBlockProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'title' | 'prefix' | 'children' | 'onCopy'> {
25
+ /**
26
+ * The code. Trailing whitespace is trimmed off the end of the block — a
27
+ * template literal is almost always written with a newline before its closing
28
+ * backtick, and that newline is a blank line at the bottom of every block.
29
+ */
30
+ code: string;
31
+ /**
32
+ * What it is written in — `ts`, `bash`, `yml`, `dockerfile`. The common
33
+ * spellings and file extensions are understood, so a value copied off a
34
+ * fenced code block works as-is.
35
+ *
36
+ * A language nothing here knows is drawn plain rather than refused; teach it
37
+ * one with `registerLanguage`.
38
+ */
39
+ language?: string;
40
+ /**
41
+ * The palette. Independent of the page's light and dark, except on `auto`.
42
+ *
43
+ * Any other string works too, and is how a project brings its own: write
44
+ * `[data-code-theme='ours'] { --n-code-bg: …; --n-code-keyword: … }` in your
45
+ * own CSS and pass the name. Sixteen slots, five of which are derived from
46
+ * the other two and need no declaration.
47
+ * @default 'dark'
48
+ */
49
+ theme?: CodeBlockTheme | (string & {});
50
+ /** The type scale and the air around the code. @default 'md' */
51
+ size?: NebaSize;
52
+ /** @default 'primary' */
53
+ color?: NebaColor;
54
+ /** @default 'default' */
55
+ density?: NebaDensity;
56
+ /** Drop shadow depth. `0` (the default) is flat. @default 0 */
57
+ elevation?: NebaElevation;
58
+ /**
59
+ * Colours the code.
60
+ *
61
+ * Off, nothing is fetched at all: the grammar engine is behind a dynamic
62
+ * import, so a block that does not highlight costs no more than the text in
63
+ * it. On, the block draws plain on the first frame and colours itself when
64
+ * the grammar lands — a few milliseconds, and never a blank space where the
65
+ * code should be.
66
+ * @default true
67
+ */
68
+ highlight?: boolean;
69
+ /**
70
+ * The bar over the code, and the master switch for it: with it off there is
71
+ * no bar and none of `showLanguage`, `copyable` or `rawToggle` draws
72
+ * anything, whatever they say.
73
+ * @default true
74
+ */
75
+ toolbar?: boolean;
76
+ /**
77
+ * A name at the start of the bar — a file path, usually. Takes the place the
78
+ * language would otherwise have; both can be shown at once.
79
+ */
80
+ title?: React.ReactNode;
81
+ /** Names the language at the start of the bar. @default true */
82
+ showLanguage?: boolean;
83
+ /** The button that puts the code on the clipboard. @default true */
84
+ copyable?: boolean;
85
+ /**
86
+ * The toggle that drops the colouring and shows the characters as they are.
87
+ * Off by default: it is a second control on a bar that usually wants one, and
88
+ * it means nothing at all when `highlight` is off.
89
+ * @default false
90
+ */
91
+ rawToggle?: boolean;
92
+ /**
93
+ * Lines to mark: a tinted row with a rule down its leading edge.
94
+ *
95
+ * A number is one line, a string is a list of lines and ranges —
96
+ * `'4'`, `'4-9'`, `'1,4-9,12'` — and an array is any mix of the two. They
97
+ * are counted the way the gutter counts, so `startLine={286}` means
98
+ * `highlightLines={288}` marks the line the gutter calls 288.
99
+ *
100
+ * The tint is mixed from the theme's own ink rather than from the page's
101
+ * colour family, so it is legible on all twelve palettes and never the one
102
+ * colour on a Dracula block that nobody chose.
103
+ */
104
+ highlightLines?: number | string | Array<number | string>;
105
+ /** Numbers down the side. @default false */
106
+ lineNumbers?: boolean;
107
+ /** What the first line is numbered. @default 1 */
108
+ startLine?: number;
109
+ /**
110
+ * A shell prompt in front of every line that has something on it — `$`, `#`,
111
+ * `C:\>`, `>>>`.
112
+ *
113
+ * It is drawn but never *present*: the symbol is generated content, so it
114
+ * cannot be selected, cannot be found by find-in-page and is not what `copy`
115
+ * puts on the clipboard. A transcript stays a transcript and still pastes
116
+ * into a shell.
117
+ */
118
+ prompt?: string;
119
+ /** Wraps long lines instead of scrolling them sideways. @default false */
120
+ wrap?: boolean;
121
+ /**
122
+ * How tall the block may get before the code scrolls inside it. A number is
123
+ * pixels; any CSS length works. Left out, the block is as tall as the code.
124
+ */
125
+ maxHeight?: number | string;
126
+ /** The typeface. Defaults to the page's own monospace stack. */
127
+ fontFamily?: string;
128
+ /** Overrides the size the `size` ladder chose. A number is pixels. */
129
+ fontSize?: number | string;
130
+ /** Overrides the leading. A bare number is a ratio, as in CSS. */
131
+ lineHeight?: number | string;
132
+ /** Tracking. A number is pixels; `-0.01em` and the like work too. */
133
+ letterSpacing?: number | string;
134
+ /**
135
+ * Which language the block's own words are in — the copy button, the raw
136
+ * toggle, the name of the region. A BCP 47 tag such as `ko`, `pt-BR` or
137
+ * `zh-Hant`; unsupported tags fall back to English.
138
+ */
139
+ locale?: string;
140
+ /** The copy button's label. Defaults to the `locale`'s word for it. */
141
+ copyLabel?: string;
142
+ /** And what it says once the code is on the clipboard. */
143
+ copiedLabel?: string;
144
+ /** The raw toggle's label. */
145
+ rawLabel?: string;
146
+ /** Fires with the copied text once the clipboard has taken it. */
147
+ onCopy?: (code: string) => void;
148
+ }
149
+ /**
150
+ * A viewer for one line of code or a thousand.
151
+ *
152
+ * Everything it draws above the code is optional and off one prop each, because
153
+ * the same component has to be a snippet inside a sentence — no bar, no
154
+ * numbers, no chrome — and the full transcript at the top of a README, and
155
+ * those are the same block with different things turned on rather than two
156
+ * components.
157
+ *
158
+ * The colouring is highlight.js, and it is the one thing in the library reached
159
+ * through a dynamic import: the grammars are forty kilobytes and there are
160
+ * thirty-four of them, so they arrive as their own chunk, one language at a
161
+ * time, and only for a block that asked to be coloured. See
162
+ * `internal/highlight.ts` for why that is a `dependencies` entry rather than an
163
+ * optional peer.
164
+ *
165
+ * The block is rendered as lines rather than as one run of text — even with no
166
+ * numbers and no prompt — because a line is what carries a number, a prompt and
167
+ * a place in the scroll, and a component that switched between two renderings
168
+ * would have two sets of wrapping behaviour to keep in step.
169
+ */
170
+ export declare const CodeBlock: React.ForwardRefExoticComponent<CodeBlockProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1 @@
1
+ "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{CheckIcon as o,CodeIcon as l,CopyIcon as r}from"../../internal/icons.js";import{codeMessages as a,useMessages as i}from"../../internal/i18n.js";import{canonicalLanguage as s,highlight as c,plainLines as d}from"../../internal/highlight.js";import{cx as p,hasContent as m,metaTextClasses as u,radiusClasses as x,srOnlyClasses as f,surfaceSlots as g,toLength as h,transitionClasses as y}from"../../internal/styles.js";export{registerLanguage}from"../../internal/highlight.js";const v={xs:"text-[0.6875rem]/[1.55]",sm:"text-[0.75rem]/[1.6]",md:"text-[0.8125rem]/[1.65]",lg:"text-[0.875rem]/[1.7]",xl:"text-[1rem]/[1.7]"},b={default:{xs:"py-2",sm:"py-3",md:"py-3.5",lg:"py-4",xl:"py-5"},compact:{xs:"py-1.5",sm:"py-2",md:"py-2.5",lg:"py-3",xl:"py-3.5"}},w={default:{xs:"px-2",sm:"px-3",md:"px-3.5",lg:"px-4",xl:"px-5"},compact:{xs:"px-1.5",sm:"px-2",md:"px-2.5",lg:"px-3",xl:"px-3.5"}},N={default:{xs:"px-2.5 py-1",sm:"px-3.5 py-1",md:"px-4 py-1.5",lg:"px-4.5 py-2",xl:"px-5.5 py-2"},compact:{xs:"px-2 py-0.5",sm:"px-2.5 py-0.5",md:"px-3 py-1",lg:"px-3.5 py-1",xl:"px-4 py-1.5"}};export const CodeBlock=/*@__PURE__*/n.forwardRef(function({code:k,language:S,theme:j="dark",size:L="md",color:M="primary",density:T="default",elevation:_=0,highlight:C=!0,toolbar:F=!0,title:R,showLanguage:A=!0,copyable:z=!0,rawToggle:H=!1,highlightLines:K,lineNumbers:E=!1,startLine:$=1,prompt:D,wrap:B=!1,maxHeight:I,fontFamily:q,fontSize:G,lineHeight:J,letterSpacing:O,locale:P,copyLabel:Q,copiedLabel:U,rawLabel:V,onCopy:W,className:X,style:Y,...Z},ee){const te=i(a,P),ne=n.useMemo(()=>k.replace(/\r\n?/g,"\n").replace(/\s+$/,""),[k]),oe=s(S),[le,re]=n.useState(!1),[ae,ie]=n.useState(null),[se,ce]=n.useState(null),de=C&&!le&&null!==oe;n.useEffect(()=>{if(!de||!oe)return void ce(null);let e=!1;return c(ne,oe).then(t=>{e||ce(t)},()=>{e||ce(null)}),()=>{e=!0}},[ne,oe,de]);const pe=n.useMemo(()=>de&&se?se:d(ne),[de,se,ne]),me=`${String($+Math.max(pe.length-1,0)).length}ch`,ue=n.useRef(void 0);n.useEffect(()=>()=>clearTimeout(ue.current),[]);const xe=n.useMemo(()=>function(e){const t=new Set;if(void 0===e)return t;for(const n of Array.isArray(e)?e:[e])if("number"!=typeof n)for(const e of n.split(",")){const n=/^\s*(\d+)\s*(?:-\s*(\d+)\s*)?$/.exec(e);if(!n)continue;const o=Number(n[1]),l=void 0===n[2]?o:Number(n[2]);for(let e=Math.min(o,l);e<=Math.max(o,l);e+=1)t.add(e)}else Number.isFinite(n)&&t.add(Math.trunc(n));return t}(K),[K]),fe=n.useRef(null),ge=Q??te.copy,he=U??te.copied,ye=V??te.raw,ve=p("inline-flex shrink-0 cursor-pointer items-center gap-1 border-0 bg-transparent","px-1.5 py-1 text-(--n-code-dim) hover:text-(--n-code-fg) hover:bg-(--n-code-hover)",x.xs,u[L],"[&_svg]:pointer-events-none [&_svg]:size-[1.15em] [&_svg]:shrink-0",y,"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1"),be=m(R)?void 0:oe??te.code,we=e("div",{role:"region","aria-label":"string"==typeof R?R:be,tabIndex:0,onKeyDown:e=>{if("a"!==e.key&&"A"!==e.key)return;if(!e.metaKey&&!e.ctrlKey||e.altKey)return;const t=fe.current,n="undefined"==typeof window?null:window.getSelection();if(!t||!n)return;e.preventDefault();const o=document.createRange();o.selectNodeContents(t),n.removeAllRanges(),n.addRange(o)},className:p("min-h-0 overflow-auto",b[T][L],"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:-outline-offset-2"),style:void 0===I?void 0:{maxHeight:h(I)},children:e("pre",{ref:fe,className:p("m-0 bg-transparent p-0 font-mono",B?"w-full":"w-max min-w-full"),children:pe.map((t,o)=>{const l=$+o;return e("div",{className:p("neba-code-line",w[T][L]),"data-line":E?l:void 0,"data-mark":xe.has(l)?"":void 0,"data-prompt":D&&t.length>0?D:void 0,children:e("code",{children:t.map((t,o)=>t.token?e("span",{className:t.token,children:t.text},o):e(n.Fragment,{children:t.text},o))})},o)})})});return t("div",{ref:ee,className:p("neba-code flex min-w-0 flex-col overflow-hidden",x[L],"border bg-(--n-code-bg) text-(--n-code-fg) [border-color:var(--n-code-rule)]","[box-shadow:var(--n-elev)]",y,X),"data-code-theme":j,"data-code-wrap":B?"true":void 0,style:{...g(M,_),"--n-code-gutter":me,...q?{fontFamily:q}:null,...void 0===G?null:{fontSize:h(G)},...void 0===J?null:{lineHeight:J},...void 0===O?null:{letterSpacing:h(O)},...Y},...Z,children:[F&&(A||z||H||m(R))?t("div",{className:p("flex min-w-0 items-center gap-1 border-b [border-color:var(--n-code-rule)]",N[T][L]),children:[m(R)?e("span",{className:p("min-w-0 truncate font-mono",u[L]),children:R}):null,A&&oe?e("span",{className:p("min-w-0 truncate font-mono tracking-wide text-(--n-code-dim) uppercase select-none",u[L]),children:oe}):null,e("span",{className:"flex-1"}),H&&C?e("button",{type:"button","aria-pressed":le,"aria-label":ye,title:ye,onClick:()=>re(e=>!e),className:p(ve,le?"text-(--n-code-fg) bg-(--n-code-hover)":""),children:e(l,{})}):null,z?t("button",{type:"button",onClick:async()=>{const e=await async function(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.cssText="position:fixed;top:0;left:0;opacity:0;pointer-events:none",document.body.append(t),t.select();const n=document.execCommand("copy");return t.remove(),n}catch{return!1}}(ne);clearTimeout(ue.current),ie(e),ue.current=setTimeout(()=>ie(null),2e3),e&&W?.(ne)},className:ve,children:[e(ae?o:r,{}),e("span",{children:null===ae?ge:ae?he:te.copyFailed})]}):null]}):null,e("div",{className:p("flex min-h-0 flex-col",v[L]),children:we}),e("span",{"aria-live":"polite",className:f,children:null===ae?"":ae?he:te.copyFailed})]})});
@@ -0,0 +1,2 @@
1
+ export { CodeBlock, registerLanguage } from './CodeBlock.js';
2
+ export type { CodeBlockProps, CodeBlockTheme } from './CodeBlock.js';
@@ -0,0 +1 @@
1
+ export{CodeBlock,registerLanguage}from"./CodeBlock.js";
@@ -1 +1 @@
1
- import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as a from"react";import{Collapsible as t}from"@base-ui/react/collapsible";import{boxPaddingXClasses as l,boxPaddingYClasses as i}from"../box/Box.js";import{ChevronIcon as r}from"../../internal/icons.js";import{gapClasses as s,hasContent as o,iconClasses as d,metaTextClasses as c,radiusClasses as p,sheetBodyClasses as f,sheetHeaderGapClasses as m,sheetTitleClasses as b,surfaceClasses as h,surfaceSlots as u,transitionClasses as x}from"../../internal/styles.js";const g={solid:[h,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[h,"border text-(--neba-fg) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--neba-fg) bg-transparent"};export const Collapsible=/*@__PURE__*/a.forwardRef(function({variant:a="outline",size:h="md",color:v="primary",density:j="default",elevation:N=0,open:w,defaultOpen:y=!1,onOpenChange:_,title:k,subtitle:C,startIcon:O,action:$,trigger:B,indicator:F=!0,disabled:M=!1,padded:R=!0,hiddenUntilFound:T=!1,keepMounted:U=!1,className:z,style:I,children:P,...q},A){const D=l[j][h],E=i[j][h];return n(t.Root,{ref:A,open:w,defaultOpen:y,onOpenChange:e=>_?.(e),disabled:M,className:["flex flex-col overflow-hidden",p[h],g[a],x,z??""].filter(Boolean).join(" "),style:{...u(v,N),...I},...q,children:[B?e(t.Trigger,{render:B}):n("div",{className:"flex w-full items-center",children:[n(t.Trigger,{className:["flex min-w-0 flex-1 cursor-pointer items-center text-start",D,E,s[h],x,d,"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]","hover:bg-(--n-soft)","data-[panel-open]:text-(--n-accent)","disabled:cursor-not-allowed disabled:bg-transparent disabled:text-(--neba-disabled-fg)"].join(" "),children:[o(O)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:O}):null,n("span",{className:`flex min-w-0 flex-1 flex-col ${m[h]}`,children:[o(k)?e("span",{className:`truncate font-semibold ${b[h]}`,children:k}):null,o(C)?e("span",{className:`truncate text-(--neba-muted-fg) ${c[h]}`,children:C}):null]}),F?e("span",{className:["flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)","[transition:rotate_var(--neba-duration)_var(--neba-ease)]","data-[panel-open]:rotate-180"].join(" "),children:e(r,{})}):null]}),o($)?e("span",{className:`flex shrink-0 items-center ${D}`,children:$}):null]}),e(t.Panel,{hiddenUntilFound:T,keepMounted:U,className:["h-(--collapsible-panel-height) overflow-hidden","[transition:height_var(--neba-duration)_var(--neba-ease)]","motion-reduce:[transition-duration:0ms]","data-[starting-style]:h-0 data-[ending-style]:h-0"].join(" "),children:e("div",{className:["min-w-0 text-(--neba-muted-fg)",f[h],R?D:"",R?B?E:"compact"===j?"pb-2":"pb-4":""].filter(Boolean).join(" "),children:P})})]})});
1
+ "use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as a from"react";import{Collapsible as t}from"@base-ui/react/collapsible";import{boxPaddingXClasses as l,boxPaddingYClasses as i}from"../box/Box.js";import{ChevronIcon as r}from"../../internal/icons.js";import{gapClasses as s,hasContent as o,iconClasses as d,metaTextClasses as c,radiusClasses as p,sheetBodyClasses as f,sheetHeaderGapClasses as m,sheetTitleClasses as b,surfaceClasses as u,surfaceSlots as h,transitionClasses as x}from"../../internal/styles.js";const g={solid:[u,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[u,"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"};export const Collapsible=/*@__PURE__*/a.forwardRef(function({variant:a="outline",size:u="md",color:v="primary",density:j="default",elevation:N=0,open:w,defaultOpen:y=!1,onOpenChange:_,title:k,subtitle:C,startIcon:O,action:$,trigger:B,indicator:F=!0,disabled:M=!1,padded:R=!0,hiddenUntilFound:T=!1,keepMounted:U=!1,className:z,style:I,children:P,...q},A){const D=l[j][u],E=i[j][u];return n(t.Root,{ref:A,open:w,defaultOpen:y,onOpenChange:e=>_?.(e),disabled:M,className:["flex flex-col overflow-hidden",p[u],g[a],x,z??""].filter(Boolean).join(" "),style:{...h(v,N),...I},...q,children:[B?e(t.Trigger,{render:B}):n("div",{className:"flex w-full items-center",children:[n(t.Trigger,{className:["flex min-w-0 flex-1 cursor-pointer items-center text-start",D,E,s[u],x,d,"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]","hover:bg-(--n-soft)","data-[panel-open]:text-(--n-accent)","disabled:cursor-not-allowed disabled:bg-transparent disabled:text-(--neba-disabled-fg)"].join(" "),children:[o(O)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:O}):null,n("span",{className:`flex min-w-0 flex-1 flex-col ${m[u]}`,children:[o(k)?e("span",{className:`truncate font-semibold ${b[u]}`,children:k}):null,o(C)?e("span",{className:`truncate text-(--neba-muted-fg) ${c[u]}`,children:C}):null]}),F?e("span",{className:["flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)","[transition:rotate_var(--neba-duration)_var(--neba-ease)]","data-[panel-open]:rotate-180"].join(" "),children:e(r,{})}):null]}),o($)?e("span",{className:`flex shrink-0 items-center ${D}`,children:$}):null]}),e(t.Panel,{hiddenUntilFound:T,keepMounted:U,className:["h-(--collapsible-panel-height) overflow-hidden","[transition:height_var(--neba-duration)_var(--neba-ease)]","motion-reduce:[transition-duration:0ms]","data-[starting-style]:h-0 data-[ending-style]:h-0"].join(" "),children:e("div",{className:["min-w-0 text-(--neba-muted-fg)",f[u],R?D:"",R?B?E:"compact"===j?"pb-2":"pb-4":""].filter(Boolean).join(" "),children:P})})]})});
@@ -97,6 +97,6 @@ export interface ColorPickerProps extends NebaStyleProps, Omit<React.ComponentPr
97
97
  *
98
98
  * There is no colour library under this. The conversions are in
99
99
  * `internal/color.ts`, which is a hundred lines of arithmetic — the whole
100
- * reason the package still has one runtime dependency.
100
+ * reason no colour library comes with it.
101
101
  */
102
102
  export declare const ColorPicker: React.ForwardRefExoticComponent<ColorPickerProps & React.RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as r from"react";import{defaultPickerLabels as l}from"../../internal/calendar.js";import{PickerShell as n}from"../../internal/picker.js";import{CheckIcon as t}from"../../internal/icons.js";import{colorMessages as o,useMessages as s}from"../../internal/i18n.js";import{checkerBackground as i,clamp as d,cssColor as h,defaultSwatches as c,formatColor as u,parseColor as f,readableInk as p}from"../../internal/color.js";import{controlTextClasses as b,cx as m,focusRingClasses as g,metaTextClasses as v,radiusClasses as x,stackGapClasses as y,surfaceSlots as w}from"../../internal/styles.js";const N={xs:"w-40",sm:"w-44",md:"w-52",lg:"w-60",xl:"w-72"},k={xs:"h-24",sm:"h-28",md:"h-32",lg:"h-40",xl:"h-48"},C={xs:"h-2.5",sm:"h-3",md:"h-3.5",lg:"h-4",xl:"h-5"},_={xs:"gap-1.5",sm:"gap-2",md:"gap-2.5",lg:"gap-3",xl:"gap-3.5"},j={xs:10,sm:12,md:14,lg:16,xl:18},z=["relative overflow-hidden border","[border-color:var(--neba-border)]","[box-shadow:var(--neba-plate-glass)]"].join(" "),I=["pointer-events-none absolute rounded-full border-2 border-white","[box-shadow:0_0_0_1px_rgba(0,0,0,0.35),0_1px_3px_rgba(0,0,0,0.4)]"].join(" ");function T(e){const a=e.currentTarget.getBoundingClientRect();return{x:0===a.width?0:d((e.clientX-a.left)/a.width,0,1),y:0===a.height?0:d((e.clientY-a.top)/a.height,0,1)}}function A(e){const a=e.shiftKey?10:1;switch(e.key){case"ArrowLeft":return{x:-a,y:0};case"ArrowRight":return{x:a,y:0};case"ArrowUp":return{x:0,y:a};case"ArrowDown":return{x:0,y:-a};default:return null}}function D({hsv:r,alphaValue:l,onChange:n,text:o,onTextChange:s,withAlpha:c,swatches:b,editable:y,size:w,inert:D,labels:M}){const O=j[w],P=-O/2,V=h({h:r.h,s:100,v:100}),$=h(r),L=e=>({onPointerDown:a=>{D||(a.currentTarget.setPointerCapture(a.pointerId),e(a))},onPointerMove:a=>{!D&&a.currentTarget.hasPointerCapture(a.pointerId)&&e(a)}}),S=(e,a,r,l)=>({role:"slider",tabIndex:D?-1:0,"aria-label":e,"aria-valuemin":0,"aria-valuemax":r,"aria-valuenow":Math.round(a),"aria-orientation":"horizontal","aria-disabled":D||void 0,onKeyDown:e=>{const a=A(e);!D&&a&&0!==a.x&&(e.preventDefault(),l(a.x))}});return a("div",{className:m("flex flex-col",N[w],_[w]),children:[e("div",{...L(e=>{const{x:a,y:t}=T(e);n({hsv:{h:r.h,s:100*a,v:100*(1-t)},alpha:l})}),role:"slider",tabIndex:D?-1:0,"aria-label":M.area,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(r.s),"aria-valuetext":`${Math.round(r.s)}%, ${Math.round(r.v)}%`,"aria-disabled":D||void 0,onKeyDown:e=>{const a=A(e);!D&&a&&(e.preventDefault(),n({hsv:{h:r.h,s:d(r.s+a.x,0,100),v:d(r.v+a.y,0,100)},alpha:l}))},className:m(z,k[w],x[w],g,D?"cursor-default":"cursor-crosshair touch-none"),style:{backgroundColor:V,backgroundImage:"linear-gradient(to top, #000000, rgba(0, 0, 0, 0)), linear-gradient(to right, #ffffff, rgba(255, 255, 255, 0))"},children:e("span",{className:I,style:{width:O,height:O,left:`${r.s}%`,top:100-r.v+"%",marginLeft:P,marginTop:P,backgroundColor:$}})}),e("div",{...L(e=>n({hsv:{...r,h:360*T(e).x},alpha:l})),...S(M.hue,r.h,360,e=>n({hsv:{...r,h:(r.h+2*e+360)%360},alpha:l})),className:m(z,C[w],"rounded-full",g,D?"cursor-default":"cursor-pointer touch-none"),style:{backgroundImage:"linear-gradient(to right, #ff0000 0%, #ffff00 16.66%, #00ff00 33.33%, #00ffff 50%, #0000ff 66.66%, #ff00ff 83.33%, #ff0000 100%)"},children:e("span",{className:I,style:{width:O,height:O,left:r.h/360*100+"%",top:"50%",marginLeft:P,marginTop:P,backgroundColor:V}})}),c?a("div",{...L(e=>n({hsv:r,alpha:T(e).x})),...S(M.alpha,100*l,100,e=>n({hsv:r,alpha:d(l+e/100,0,1)})),className:m(z,C[w],"rounded-full",g,D?"cursor-default":"cursor-pointer touch-none"),style:i,children:[e("span",{"aria-hidden":"true",className:"absolute inset-0",style:{backgroundImage:`linear-gradient(to right, ${h(r,0)}, ${$})`}}),e("span",{className:I,style:{width:O,height:O,left:100*l+"%",top:"50%",marginLeft:P,marginTop:P,backgroundColor:h(r,l)}})]}):null,y?a("div",{className:m("flex items-center",_[w]),children:[e("span",{"aria-hidden":"true",className:m("shrink-0 rounded-full border","[border-color:var(--neba-border)]"),style:{width:O+6,height:O+6,...i},children:e("span",{className:"block size-full rounded-full",style:{backgroundColor:h(r,l)}})}),e("input",{type:"text",value:o,readOnly:D,spellCheck:!1,autoComplete:"off","aria-label":M.value,onChange:e=>s(e.target.value),className:m("min-w-0 flex-1 border bg-transparent px-1.5 py-1 font-mono lowercase","[border-color:var(--neba-border)]",x.xs,v[w],"text-(--neba-fg)","[outline:none] focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1")})]}):null,b&&b.length>0?e("div",{role:"group","aria-label":M.swatches,className:"grid grid-cols-8 gap-1",children:b.map(a=>{const o=f(a),s=null!==o&&u(o.hsv,o.alpha,"hex")===u(r,l,"hex");return e("button",{type:"button",disabled:D,"aria-label":a,"aria-pressed":s,onClick:()=>{o&&n(o)},className:m("flex aspect-square items-center justify-center rounded-full border","[border-color:color-mix(in_oklab,var(--neba-fg)_18%,transparent)]","[transition:box-shadow_var(--neba-duration)_var(--neba-ease)]",g,"[outline:none]",D?"cursor-default":"cursor-pointer hover:[box-shadow:var(--neba-shadow-1)]","[&_svg]:size-3"),style:{backgroundColor:a},children:s&&o?e("span",{style:{color:p(o.hsv)},children:e(t,{})}):null},a)})}):null]})}function M(e,a){return"hex"===e?[a?"#ffffffff":"#ffffff"]:"rgb"===e?[a?"rgba(255, 255, 255, 0.55)":"rgb(255, 255, 255)"]:[a?"hsla(360, 100%, 100%, 0.55)":"hsl(360, 100%, 100%)"]}const O={h:217,s:87,v:82};export const ColorPicker=/*@__PURE__*/r.forwardRef(function({value:t,defaultValue:d="#1a58d1",onValueChange:p,format:g="hex",alpha:x=!1,swatches:N=c,inline:k=!1,editable:C=!0,label:_,description:j,error:z,invalid:I,required:T=!1,disabled:A=!1,readOnly:P=!1,fullWidth:V=!1,clearable:$=!1,name:L,open:S,defaultOpen:q=!1,onOpenChange:K,locale:R,labels:B,variant:W="outline",size:E="md",color:U="primary",density:X="default",elevation:Y=0,className:F,style:G,...H},J){const Q=s(o,R),Z=r.useMemo(()=>({...Q,...B}),[Q,B]),[ee,ae]=r.useState(d),re=t??ee,[le,ne]=r.useState(q),te=S??le,[oe,se]=r.useState(()=>f(re)??{hsv:O,alpha:1}),[ie,de]=r.useState(()=>re||""),he=u(oe.hsv,x?oe.alpha:1,g),ce=""===re;r.useEffect(()=>{const e=f(re);e?u(e.hsv,x?e.alpha:1,g)!==he&&(de(re),se(e)):de(re)},[re,he,x,g]);const ue=(e,a)=>{se(e);const r=u(e.hsv,x?e.alpha:1,g);de(a??r),void 0===t&&ae(r),p?.(r)},fe=A||P,pe=e(D,{hsv:oe.hsv,alphaValue:oe.alpha,onChange:ue,text:ie,onTextChange:e=>{de(e);const a=f(e);a&&ue(a,e)},withAlpha:x,swatches:N,editable:C,size:E,inert:fe,labels:Z}),be=L?e("input",{type:"hidden",name:L,value:ce?"":he}):null;if(k){const r=I??Boolean(z)?"danger":U;return a("div",{ref:J,className:m("flex flex-col",y[E],F),style:{...w(r,Y),...G},...H,children:[_?e("span",{className:m(v[E],"font-medium",A?"text-(--neba-disabled-fg)":"text-(--neba-fg)"),children:_}):null,pe,j?e("span",{className:m(v[E],"text-(--neba-muted-fg)"),children:j}):null,z?e("span",{className:m(v[E],"text-(--n-accent)"),children:z}):null,be]})}return e("div",{ref:J,className:V?"w-full":"inline-block",...H,children:e(n,{variant:W,size:E,color:U,density:X,elevation:Y,style:G,label:_,description:j,error:z,invalid:I,required:T,disabled:A,readOnly:P,fullWidth:V,className:F,startIcon:e("span",{"aria-hidden":"true",className:m("block size-[1.15em] shrink-0 rounded-full border","[border-color:color-mix(in_oklab,var(--neba-fg)_18%,transparent)]"),style:i,children:e("span",{className:"block size-full rounded-full",style:{backgroundColor:ce?"transparent":h(oe.hsv,x?oe.alpha:1)}})}),display:ce?Z.empty:he,samples:M(g,x),empty:ce,clearable:$,onClear:()=>{void 0===t&&ae(""),de(""),p?.("")},open:te,onOpenChange:e=>{void 0===S&&ne(e),K?.(e)},labels:{...l,clear:Z.clear},hiddenValues:L?[{name:L,value:ce?"":he}]:void 0,children:e("div",{className:b[E],children:pe})})})});
1
+ "use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as r from"react";import{defaultPickerLabels as l}from"../../internal/calendar.js";import{PickerShell as n}from"../../internal/picker.js";import{CheckIcon as t}from"../../internal/icons.js";import{colorMessages as o,useMessages as s}from"../../internal/i18n.js";import{checkerBackground as i,clamp as d,cssColor as h,defaultSwatches as c,formatColor as u,parseColor as f,readableInk as p}from"../../internal/color.js";import{controlTextClasses as b,cx as m,focusRingClasses as g,metaTextClasses as v,radiusClasses as x,stackGapClasses as y,surfaceSlots as w}from"../../internal/styles.js";const N={xs:"w-40",sm:"w-44",md:"w-52",lg:"w-60",xl:"w-72"},k={xs:"h-24",sm:"h-28",md:"h-32",lg:"h-40",xl:"h-48"},C={xs:"h-2.5",sm:"h-3",md:"h-3.5",lg:"h-4",xl:"h-5"},_={xs:"gap-1.5",sm:"gap-2",md:"gap-2.5",lg:"gap-3",xl:"gap-3.5"},j={xs:10,sm:12,md:14,lg:16,xl:18},z=["relative overflow-hidden border","[border-color:var(--neba-border)]","[box-shadow:var(--neba-plate-glass)]"].join(" "),I=["pointer-events-none absolute rounded-full border-2 border-white","[box-shadow:0_0_0_1px_rgba(0,0,0,0.35),0_1px_3px_rgba(0,0,0,0.4)]"].join(" ");function T(e){const a=e.currentTarget.getBoundingClientRect();return{x:0===a.width?0:d((e.clientX-a.left)/a.width,0,1),y:0===a.height?0:d((e.clientY-a.top)/a.height,0,1)}}function A(e){const a=e.shiftKey?10:1;switch(e.key){case"ArrowLeft":return{x:-a,y:0};case"ArrowRight":return{x:a,y:0};case"ArrowUp":return{x:0,y:a};case"ArrowDown":return{x:0,y:-a};default:return null}}function D({hsv:r,alphaValue:l,onChange:n,text:o,onTextChange:s,withAlpha:c,swatches:b,editable:y,size:w,inert:D,labels:M}){const O=j[w],P=-O/2,V=h({h:r.h,s:100,v:100}),$=h(r),L=e=>({onPointerDown:a=>{D||(a.currentTarget.setPointerCapture(a.pointerId),e(a))},onPointerMove:a=>{!D&&a.currentTarget.hasPointerCapture(a.pointerId)&&e(a)}}),S=(e,a,r,l)=>({role:"slider",tabIndex:D?-1:0,"aria-label":e,"aria-valuemin":0,"aria-valuemax":r,"aria-valuenow":Math.round(a),"aria-orientation":"horizontal","aria-disabled":D||void 0,onKeyDown:e=>{const a=A(e);!D&&a&&0!==a.x&&(e.preventDefault(),l(a.x))}});return a("div",{className:m("flex flex-col",N[w],_[w]),children:[e("div",{...L(e=>{const{x:a,y:t}=T(e);n({hsv:{h:r.h,s:100*a,v:100*(1-t)},alpha:l})}),role:"slider",tabIndex:D?-1:0,"aria-label":M.area,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(r.s),"aria-valuetext":`${Math.round(r.s)}%, ${Math.round(r.v)}%`,"aria-disabled":D||void 0,onKeyDown:e=>{const a=A(e);!D&&a&&(e.preventDefault(),n({hsv:{h:r.h,s:d(r.s+a.x,0,100),v:d(r.v+a.y,0,100)},alpha:l}))},className:m(z,k[w],x[w],g,D?"cursor-default":"cursor-crosshair touch-none"),style:{backgroundColor:V,backgroundImage:"linear-gradient(to top, #000000, rgba(0, 0, 0, 0)), linear-gradient(to right, #ffffff, rgba(255, 255, 255, 0))"},children:e("span",{className:I,style:{width:O,height:O,left:`${r.s}%`,top:100-r.v+"%",marginLeft:P,marginTop:P,backgroundColor:$}})}),e("div",{...L(e=>n({hsv:{...r,h:360*T(e).x},alpha:l})),...S(M.hue,r.h,360,e=>n({hsv:{...r,h:(r.h+2*e+360)%360},alpha:l})),className:m(z,C[w],"rounded-full",g,D?"cursor-default":"cursor-pointer touch-none"),style:{backgroundImage:"linear-gradient(to right, #ff0000 0%, #ffff00 16.66%, #00ff00 33.33%, #00ffff 50%, #0000ff 66.66%, #ff00ff 83.33%, #ff0000 100%)"},children:e("span",{className:I,style:{width:O,height:O,left:r.h/360*100+"%",top:"50%",marginLeft:P,marginTop:P,backgroundColor:V}})}),c?a("div",{...L(e=>n({hsv:r,alpha:T(e).x})),...S(M.alpha,100*l,100,e=>n({hsv:r,alpha:d(l+e/100,0,1)})),className:m(z,C[w],"rounded-full",g,D?"cursor-default":"cursor-pointer touch-none"),style:i,children:[e("span",{"aria-hidden":"true",className:"absolute inset-0",style:{backgroundImage:`linear-gradient(to right, ${h(r,0)}, ${$})`}}),e("span",{className:I,style:{width:O,height:O,left:100*l+"%",top:"50%",marginLeft:P,marginTop:P,backgroundColor:h(r,l)}})]}):null,y?a("div",{className:m("flex items-center",_[w]),children:[e("span",{"aria-hidden":"true",className:m("shrink-0 rounded-full border","[border-color:var(--neba-border)]"),style:{width:O+6,height:O+6,...i},children:e("span",{className:"block size-full rounded-full",style:{backgroundColor:h(r,l)}})}),e("input",{type:"text",value:o,readOnly:D,spellCheck:!1,autoComplete:"off","aria-label":M.value,onChange:e=>s(e.target.value),className:m("min-w-0 flex-1 border bg-transparent px-1.5 py-1 font-mono lowercase","[border-color:var(--neba-border)]",x.xs,v[w],"text-(--neba-fg)","[outline:none] focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1")})]}):null,b&&b.length>0?e("div",{role:"group","aria-label":M.swatches,className:"grid grid-cols-8 gap-1",children:b.map(a=>{const o=f(a),s=null!==o&&u(o.hsv,o.alpha,"hex")===u(r,l,"hex");return e("button",{type:"button",disabled:D,"aria-label":a,"aria-pressed":s,onClick:()=>{o&&n(o)},className:m("flex aspect-square items-center justify-center rounded-full border","[border-color:color-mix(in_oklab,var(--neba-fg)_18%,transparent)]","[transition:box-shadow_var(--neba-duration)_var(--neba-ease)]",g,"[outline:none]",D?"cursor-default":"cursor-pointer hover:[box-shadow:var(--neba-shadow-1)]","[&_svg]:size-3"),style:{backgroundColor:a},children:s&&o?e("span",{style:{color:p(o.hsv)},children:e(t,{})}):null},a)})}):null]})}function M(e,a){return"hex"===e?[a?"#ffffffff":"#ffffff"]:"rgb"===e?[a?"rgba(255, 255, 255, 0.55)":"rgb(255, 255, 255)"]:[a?"hsla(360, 100%, 100%, 0.55)":"hsl(360, 100%, 100%)"]}const O={h:217,s:87,v:82};export const ColorPicker=/*@__PURE__*/r.forwardRef(function({value:t,defaultValue:d="#1a58d1",onValueChange:p,format:g="hex",alpha:x=!1,swatches:N=c,inline:k=!1,editable:C=!0,label:_,description:j,error:z,invalid:I,required:T=!1,disabled:A=!1,readOnly:P=!1,fullWidth:V=!1,clearable:$=!1,name:L,open:S,defaultOpen:q=!1,onOpenChange:K,locale:R,labels:B,variant:W="outline",size:E="md",color:U="primary",density:X="default",elevation:Y=0,className:F,style:G,...H},J){const Q=s(o,R),Z=r.useMemo(()=>({...Q,...B}),[Q,B]),[ee,ae]=r.useState(d),re=t??ee,[le,ne]=r.useState(q),te=S??le,[oe,se]=r.useState(()=>f(re)??{hsv:O,alpha:1}),[ie,de]=r.useState(()=>re||""),he=u(oe.hsv,x?oe.alpha:1,g),ce=""===re;r.useEffect(()=>{const e=f(re);e?u(e.hsv,x?e.alpha:1,g)!==he&&(de(re),se(e)):de(re)},[re,he,x,g]);const ue=(e,a)=>{se(e);const r=u(e.hsv,x?e.alpha:1,g);de(a??r),void 0===t&&ae(r),p?.(r)},fe=A||P,pe=e(D,{hsv:oe.hsv,alphaValue:oe.alpha,onChange:ue,text:ie,onTextChange:e=>{de(e);const a=f(e);a&&ue(a,e)},withAlpha:x,swatches:N,editable:C,size:E,inert:fe,labels:Z}),be=L?e("input",{type:"hidden",name:L,value:ce?"":he}):null;if(k){const r=I??Boolean(z)?"danger":U;return a("div",{ref:J,className:m("flex flex-col",y[E],F),style:{...w(r,Y),...G},...H,children:[_?e("span",{className:m(v[E],"font-medium",A?"text-(--neba-disabled-fg)":"text-(--neba-fg)"),children:_}):null,pe,j?e("span",{className:m(v[E],"text-(--neba-muted-fg)"),children:j}):null,z?e("span",{className:m(v[E],"text-(--n-accent)"),children:z}):null,be]})}return e("div",{ref:J,className:V?"w-full":"inline-block",...H,children:e(n,{variant:W,size:E,color:U,density:X,elevation:Y,style:G,label:_,description:j,error:z,invalid:I,required:T,disabled:A,readOnly:P,fullWidth:V,className:F,startIcon:e("span",{"aria-hidden":"true",className:m("block size-[1.15em] shrink-0 rounded-full border","[border-color:color-mix(in_oklab,var(--neba-fg)_18%,transparent)]"),style:i,children:e("span",{className:"block size-full rounded-full",style:{backgroundColor:ce?"transparent":h(oe.hsv,x?oe.alpha:1)}})}),display:ce?Z.empty:he,samples:M(g,x),empty:ce,clearable:$,onClear:()=>{void 0===t&&ae(""),de(""),p?.("")},open:te,onOpenChange:e=>{void 0===S&&ne(e),K?.(e)},labels:{...l,clear:Z.clear},hiddenValues:L?[{name:L,value:ce?"":he}]:void 0,children:e("div",{className:b[E],children:pe})})})});
@@ -1 +1 @@
1
- import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{Combobox as n}from"@base-ui/react/combobox";import{Field as t}from"@base-ui/react/field";import{Chip as i}from"../chip/Chip.js";import{actionMessages as r,comboboxMessages as s,fillMessage as o,useMessages as c}from"../../internal/i18n.js";import{CheckIcon as d,ChevronIcon as m,CloseIcon as u,PlusIcon as p}from"../../internal/icons.js";import{chipRemoveClasses as h,controlHeightClasses as b,controlTextLeadingClasses as f,disabledClasses as g,fieldReadOnlyClasses as x,fieldRestClasses as v,focusWithinRingClasses as y,gapClasses as w,hasContent as N,iconClasses as j,metaTextClasses as C,paddingXClasses as L,radiusClasses as I,stackGapClasses as S,surfaceClasses as $,surfaceSlots as O,transitionClasses as V}from"../../internal/styles.js";const _=["group relative flex w-full cursor-text items-center","[-webkit-tap-highlight-color:transparent]",V,"focus-within:[transition-duration:0ms]",y,j].join(" "),z={xs:"min-h-5.5 py-0",sm:"min-h-6.5 py-[2px]",md:"min-h-8 py-[3px]",lg:"min-h-10 py-[4px]",xl:"min-h-12 py-[4px]"},A=[$,"max-h-[min(20rem,var(--available-height))] overflow-y-auto overscroll-contain","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]"].join(" "),M=["relative flex cursor-pointer items-center gap-2 select-none","rounded-(--neba-radius-xs) py-1.5 pe-2 ps-7",V,"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(" "),k=["inline-flex h-[1lh] shrink-0 cursor-pointer items-center justify-center","rounded-(--neba-radius-xs) text-(--neba-muted-fg)","[transition:color_var(--neba-duration)_var(--neba-ease)]","hover:text-(--n-accent)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1","disabled:cursor-not-allowed disabled:text-(--neba-disabled-fg)"].join(" ");function R(e){return null==e?[]:Array.isArray(e)?e.slice():[e]}export function Combobox({variant:y="outline",size:j="md",color:$="primary",density:V="default",elevation:T=0,items:q,multiple:E,value:F,defaultValue:P,onValueChange:B,onInputValueChange:D,allowCustom:G=!0,customLabel:H,clearable:W=!1,locale:J,emptyMessage:K,limit:Q,placeholder:U,label:X,description:Y,error:Z,invalid:ee,startIcon:ae,fullWidth:le=!1,disabled:ne=!1,readOnly:te=!1,required:ie=!1,name:re,open:se,defaultOpen:oe,onOpenChange:ce,clearLabel:de,removeLabel:me,inputRef:ue,id:pe,className:he,style:be,...fe}){const ge=c(s,J),xe=c(r,J),ve=me??(e=>o(ge.remove,{label:e})),ye=N(Z),we=ee??ye,Ne=we?"danger":$,je=!0===E,Ce=l.useMemo(()=>q.map(e=>({value:e.value,label:e.label??String(e.value),disabled:e.disabled})),[q]),[Le,Ie]=l.useState(()=>R(P)),Se=void 0===F?Le:R(F),[$e,Oe]=l.useState(""),Ve=l.useMemo(()=>new Map(Ce.map(e=>[e.value,e])),[Ce]),_e=l.useCallback(e=>Ve.get(e)??{value:e,label:String(e),custom:!0},[Ve]),ze=$e.trim(),Ae=ze.toLocaleLowerCase(),Me=""===ze||Ce.some(e=>e.label.toLocaleLowerCase()===Ae||String(e.value).toLocaleLowerCase()===Ae)||Se.some(e=>String(e).toLocaleLowerCase()===Ae),ke=!G||te||ne||Me?null:ze,Re=l.useMemo(()=>null===ke?Ce:[...Ce,{value:ke,label:ke,custom:!0}],[Ce,ke]),Te=je?Se.map(_e):Se.length>0?_e(Se[0]):null;const qe=L[V][j],Ee=[_,f[j],I[j],w[j],je?z[j]:b[j],`${qe} pe-1.5`,ne?g[y]:te?x[y]:v[y]].join(" "),Fe=["min-w-0 flex-1 self-stretch bg-transparent [font:inherit] text-inherit","[outline:none]","placeholder:text-(--neba-muted-fg)","caret-(--n-accent) selection:bg-(--n-soft-press)","disabled:cursor-not-allowed"].join(" "),Pe=a=>e(n.Input,{ref:ue,placeholder:U,className:je?`${Fe} min-w-16 ${a?"ms-1.5":""}`:Fe});return a(t.Root,{disabled:ne,invalid:we,className:["flex-col align-top",S[j],le?"flex w-full":"inline-flex",he??""].filter(Boolean).join(" "),style:{...O(Ne,T),...be},...fe,children:[X?e(t.Label,{className:[C[j],"font-medium",ne?"text-(--neba-disabled-fg)":"text-(--neba-fg)"].join(" "),children:X}):null,a(n.Root,{id:pe,name:re,items:Re,multiple:je,value:Te,onValueChange:e=>{!function(e){void 0===F&&Ie(e),B?.(je?e:e[0]??null)}((null===e?[]:Array.isArray(e)?e:[e]).map(e=>e.value))},onInputValueChange:e=>{Oe(e),D?.(e)},open:se,defaultOpen:oe,onOpenChange:e=>ce?.(e),autoHighlight:!0,itemToStringLabel:e=>e.label,itemToStringValue:e=>String(e.value),isItemEqualToValue:(e,a)=>e.value===a.value,limit:Q,disabled:ne,readOnly:te,required:ie,children:[a(n.InputGroup,{className:Ee,children:[ae?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:ae}):null,je?e(n.Chips,{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:e(n.Value,{children:t=>a(l.Fragment,{children:[t.map(a=>e(n.Chip,{render:e(i,{variant:"outline",size:j,color:Ne,density:"compact",disabled:ne,endIcon:te||ne?null:e(n.ChipRemove,{"aria-label":ve(a.label),className:h,children:e(u,{})})}),children:a.label},String(a.value))),Pe(t.length>0)]})})}):Pe(!1),W&&!te?e(n.Clear,{"aria-label":de??xe.clear,className:k,children:e(u,{})}):null,e(n.Trigger,{"aria-label":"string"==typeof X?void 0:"Open",className:k,children:e(n.Icon,{className:["flex items-center","[transition:rotate_var(--neba-duration)_var(--neba-ease)]","data-[popup-open]:rotate-180"].join(" "),children:e(m,{})})})]}),e(n.Portal,{children:e(n.Positioner,{className:"neba-portal z-50 [outline:none]",sideOffset:6,children:a(n.Popup,{className:`${A} ${I[j]} ${f[j]}`,style:O(Ne,3),children:[e(n.Empty,{className:"px-2 py-1.5 text-(--neba-muted-fg) empty:hidden",children:K??ge.empty}),e(n.List,{children:t=>e(n.Item,{value:t,disabled:t.disabled,className:M,children:t.custom?a(l.Fragment,{children:[e("span",{className:"absolute start-1.5 flex size-4 items-center justify-center text-(--n-accent) [&_svg]:size-4",children:e(p,{})}),e("span",{className:"truncate",children:H?H(t.label):`Add “${t.label}”`})]}):a(l.Fragment,{children:[e(n.ItemIndicator,{className:"absolute start-1.5 flex size-4 items-center justify-center",children:e(d,{})}),e("span",{className:"truncate",children:t.label})]})},`${t.custom?"custom:":""}${String(t.value)}`)})]})})})]}),Y?e(t.Description,{className:`${C[j]} text-(--neba-muted-fg)`,children:Y}):null,ye?e(t.Error,{match:!0,className:`${C[j]} text-(--n-accent)`,children:Z}):null]})}
1
+ "use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{Combobox as n}from"@base-ui/react/combobox";import{Field as t}from"@base-ui/react/field";import{Chip as i}from"../chip/Chip.js";import{actionMessages as r,comboboxMessages as s,fillMessage as o,useMessages as c}from"../../internal/i18n.js";import{CheckIcon as d,ChevronIcon as u,CloseIcon as m,PlusIcon as p}from"../../internal/icons.js";import{chipRemoveClasses as h,controlHeightClasses as b,controlTextLeadingClasses as f,disabledClasses as g,fieldReadOnlyClasses as x,fieldRestClasses as v,focusWithinRingClasses as y,gapClasses as w,hasContent as N,iconClasses as j,metaTextClasses as C,paddingXClasses as L,radiusClasses as I,stackGapClasses as S,surfaceClasses as $,surfaceSlots as O,transitionClasses as V}from"../../internal/styles.js";const _=["group relative flex w-full cursor-text items-center","[-webkit-tap-highlight-color:transparent]",V,"focus-within:[transition-duration:0ms]",y,j].join(" "),z={xs:"min-h-5.5 py-0",sm:"min-h-6.5 py-[2px]",md:"min-h-8 py-[3px]",lg:"min-h-10 py-[4px]",xl:"min-h-12 py-[4px]"},A=[$,"max-h-[min(20rem,var(--available-height))] overflow-y-auto overscroll-contain","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]"].join(" "),M=["relative flex cursor-pointer items-center gap-2 select-none","rounded-(--neba-radius-xs) py-1.5 pe-2 ps-7",V,"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(" "),k=["inline-flex h-[1lh] shrink-0 cursor-pointer items-center justify-center","rounded-(--neba-radius-xs) text-(--neba-muted-fg)","[transition:color_var(--neba-duration)_var(--neba-ease)]","hover:text-(--n-accent)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1","disabled:cursor-not-allowed disabled:text-(--neba-disabled-fg)"].join(" ");function R(e){return null==e?[]:Array.isArray(e)?e.slice():[e]}export function Combobox({variant:y="outline",size:j="md",color:$="primary",density:V="default",elevation:T=0,items:q,multiple:E,value:F,defaultValue:P,onValueChange:B,onInputValueChange:D,allowCustom:G=!0,customLabel:H,clearable:W=!1,locale:J,emptyMessage:K,limit:Q,placeholder:U,label:X,description:Y,error:Z,invalid:ee,startIcon:ae,fullWidth:le=!1,disabled:ne=!1,readOnly:te=!1,required:ie=!1,name:re,open:se,defaultOpen:oe,onOpenChange:ce,clearLabel:de,removeLabel:ue,inputRef:me,id:pe,className:he,style:be,...fe}){const ge=c(s,J),xe=c(r,J),ve=ue??(e=>o(ge.remove,{label:e})),ye=N(Z),we=ee??ye,Ne=we?"danger":$,je=!0===E,Ce=l.useMemo(()=>q.map(e=>({value:e.value,label:e.label??String(e.value),disabled:e.disabled})),[q]),[Le,Ie]=l.useState(()=>R(P)),Se=void 0===F?Le:R(F),[$e,Oe]=l.useState(""),Ve=l.useMemo(()=>new Map(Ce.map(e=>[e.value,e])),[Ce]),_e=l.useCallback(e=>Ve.get(e)??{value:e,label:String(e),custom:!0},[Ve]),ze=$e.trim(),Ae=ze.toLocaleLowerCase(),Me=""===ze||Ce.some(e=>e.label.toLocaleLowerCase()===Ae||String(e.value).toLocaleLowerCase()===Ae)||Se.some(e=>String(e).toLocaleLowerCase()===Ae),ke=!G||te||ne||Me?null:ze,Re=l.useMemo(()=>null===ke?Ce:[...Ce,{value:ke,label:ke,custom:!0}],[Ce,ke]),Te=je?Se.map(_e):Se.length>0?_e(Se[0]):null;const qe=L[V][j],Ee=[_,f[j],I[j],w[j],je?z[j]:b[j],`${qe} pe-1.5`,ne?g[y]:te?x[y]:v[y]].join(" "),Fe=["min-w-0 flex-1 self-stretch bg-transparent [font:inherit] text-inherit","[outline:none]","placeholder:text-(--neba-muted-fg)","caret-(--n-accent) selection:bg-(--n-soft-press)","disabled:cursor-not-allowed"].join(" "),Pe=a=>e(n.Input,{ref:me,placeholder:U,className:je?`${Fe} min-w-16 ${a?"ms-1.5":""}`:Fe});return a(t.Root,{disabled:ne,invalid:we,className:["flex-col align-top",S[j],le?"flex w-full":"inline-flex",he??""].filter(Boolean).join(" "),style:{...O(Ne,T),...be},...fe,children:[X?e(t.Label,{className:[C[j],"font-medium",ne?"text-(--neba-disabled-fg)":"text-(--neba-fg)"].join(" "),children:X}):null,a(n.Root,{id:pe,name:re,items:Re,multiple:je,value:Te,onValueChange:e=>{!function(e){void 0===F&&Ie(e),B?.(je?e:e[0]??null)}((null===e?[]:Array.isArray(e)?e:[e]).map(e=>e.value))},onInputValueChange:e=>{Oe(e),D?.(e)},open:se,defaultOpen:oe,onOpenChange:e=>ce?.(e),autoHighlight:!0,itemToStringLabel:e=>e.label,itemToStringValue:e=>String(e.value),isItemEqualToValue:(e,a)=>e.value===a.value,limit:Q,disabled:ne,readOnly:te,required:ie,children:[a(n.InputGroup,{className:Ee,children:[ae?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:ae}):null,je?e(n.Chips,{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:e(n.Value,{children:t=>a(l.Fragment,{children:[t.map(a=>e(n.Chip,{render:e(i,{variant:"outline",size:j,color:Ne,density:"compact",disabled:ne,endIcon:te||ne?null:e(n.ChipRemove,{"aria-label":ve(a.label),className:h,children:e(m,{})})}),children:a.label},String(a.value))),Pe(t.length>0)]})})}):Pe(!1),W&&!te?e(n.Clear,{"aria-label":de??xe.clear,className:k,children:e(m,{})}):null,e(n.Trigger,{"aria-label":"string"==typeof X?void 0:"Open",className:k,children:e(n.Icon,{className:["flex items-center","[transition:rotate_var(--neba-duration)_var(--neba-ease)]","data-[popup-open]:rotate-180"].join(" "),children:e(u,{})})})]}),e(n.Portal,{children:e(n.Positioner,{className:"neba-portal z-50 [outline:none]",sideOffset:6,children:a(n.Popup,{className:`${A} ${I[j]} ${f[j]}`,style:O(Ne,3),children:[e(n.Empty,{className:"px-2 py-1.5 text-(--neba-muted-fg) empty:hidden",children:K??ge.empty}),e(n.List,{children:t=>e(n.Item,{value:t,disabled:t.disabled,className:M,children:t.custom?a(l.Fragment,{children:[e("span",{className:"absolute start-1.5 flex size-4 items-center justify-center text-(--n-accent) [&_svg]:size-4",children:e(p,{})}),e("span",{className:"truncate",children:H?H(t.label):`Add “${t.label}”`})]}):a(l.Fragment,{children:[e(n.ItemIndicator,{className:"absolute start-1.5 flex size-4 items-center justify-center",children:e(d,{})}),e("span",{className:"truncate",children:t.label})]})},`${t.custom?"custom:":""}${String(t.value)}`)})]})})})]}),Y?e(t.Description,{className:`${C[j]} text-(--neba-muted-fg)`,children:Y}):null,ye?e(t.Error,{match:!0,className:`${C[j]} text-(--n-accent)`,children:Z}):null]})}
@@ -1 +1 @@
1
- import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{boxPaddingXClasses as m}from"../box/Box.js";const o={xs:"max-w-[30rem]",sm:"max-w-[40rem]",md:"max-w-[48rem]",lg:"max-w-[64rem]",xl:"max-w-[80rem]"};export const Container=/*@__PURE__*/e.forwardRef(function({maxWidth:e="none",padded:n=!0,size:a="md",density:t="default",centered:s=!0,render:d,className:i,children:c,...l},x){const f=["block w-full","none"===e?"":o[e],s?"mx-auto":"",n?m[t][a]:"",i??""].filter(Boolean).join(" ");return r({render:d,ref:x,props:{className:f,children:c,...l}})});
1
+ "use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{boxPaddingXClasses as m}from"../box/Box.js";const o={xs:"max-w-[30rem]",sm:"max-w-[40rem]",md:"max-w-[48rem]",lg:"max-w-[64rem]",xl:"max-w-[80rem]"};export const Container=/*@__PURE__*/e.forwardRef(function({maxWidth:e="none",padded:n=!0,size:a="md",density:t="default",centered:s=!0,render:d,className:i,children:c,...l},x){const f=["block w-full","none"===e?"":o[e],s?"mx-auto":"",n?m[t][a]:"",i??""].filter(Boolean).join(" ");return r({render:d,ref:x,props:{className:f,children:c,...l}})});
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as r from"react";import{Box as a}from"../box/Box.js";import{Checkbox as o}from"../checkbox/Checkbox.js";import{Pagination as l}from"../pagination/Pagination.js";import{Select as s}from"../select/Select.js";import{TextField as i}from"../text-field/TextField.js";import{compareValues as c,dataHeaderHeights as u,dataRowHeights as d,dataTickWidths as p,defaultColumnWidth as m,keysBetween as h,minColumnWidth as f,nextSort as g,pageBounds as v,searchText as y,sortRows as b,virtualWindow as k}from"../../internal/data-table.js";import{emptyMessages as w,fillMessage as x,tableMessages as C,useMessages as S}from"../../internal/i18n.js";import{ChevronIcon as M}from"../../internal/icons.js";import{controlTextLeadingClasses as N,cx as K,hasContent as z,metaTextClasses as $,paddingXValues as j,srOnlyClasses as E}from"../../internal/styles.js";const _=["[--n-row:transparent]","[transition:background-color_var(--neba-duration)_var(--neba-ease)]"].join(" "),R={"--n-stripe":"color-mix(in oklab, var(--neba-fg) 4%, transparent)"},D=["group/sort flex w-full min-w-0 cursor-pointer items-center gap-1","text-inherit [outline:none]","[transition:color_var(--neba-duration)_var(--neba-ease)]","hover:text-(--n-accent)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1","[&_svg]:pointer-events-none [&_svg]:size-[1.15em] [&_svg]:shrink-0"].join(" "),L=["absolute inset-y-0 z-10 w-2 cursor-col-resize select-none","end-0 translate-x-1/2 rtl:-translate-x-1/2","after:absolute after:inset-y-1 after:start-1/2 after:w-px","after:[background:transparent]","after:[transition:background_var(--neba-duration)_var(--neba-ease)]","hover:after:[background:var(--n-accent)]"].join(" ");function P(){return t("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e("circle",{cx:"7.25",cy:"7.25",r:"4.75",stroke:"currentColor",strokeWidth:"1.5"}),e("path",{d:"m10.75 10.75 2.75 2.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function A(e){return"number"==typeof e?`${e}px`:e}export function DataTable({headers:T,items:H,getRowKey:B,variant:I="outline",size:W="sm",color:F="primary",density:O="compact",elevation:q=0,height:U,maxHeight:X,rowHeight:Y,striped:V=!1,hoverable:G=!0,stickyHeader:J=!0,caption:Q,label:Z,empty:ee,virtual:te=!0,overscan:ne=8,sortable:re=!1,sortMode:ae="single",sort:oe,defaultSort:le,onSortChange:se,resizable:ie=!1,columnWidths:ce,defaultColumnWidths:ue,onColumnWidthsChange:de,selectionMode:pe="none",selected:me,defaultSelected:he,onSelectedChange:fe,checkboxes:ge=!1,onRowClick:ve,onRowActivate:ye,paging:be="scroll",page:ke,defaultPage:we=1,onPageChange:xe,pageSize:Ce,defaultPageSize:Se=25,onPageSizeChange:Me,pageSizeOptions:Ne=[10,25,50,100],footer:Ke,search:ze,defaultSearch:$e,onSearchChange:je,searchable:Ee=!1,searchPlaceholder:_e,filter:Re,toolbar:De,manual:Le=!1,rowCount:Pe,locale:Ae,className:Te,style:He,...Be}){const Ie=S(C,Ae),We=S(w,Ae),Fe=r.useId(),Oe=Y??d[O][W],qe=u[O][W],Ue=j[O][W],Xe=r.useMemo(()=>new Set(!0===Le?["sort","filter","pages"]:Le||[]),[Le]),Ye=r.useMemo(()=>T.filter(e=>!e.hidden),[T]),Ve=Ye.some(e=>void 0!==e.group),Ge="none"!==pe,Je="multiple"===pe,Qe=Ge&&ge,Ze=r.useMemo(()=>H.map((e,t)=>{const n=B?B(e,t):t;return{row:e,identity:n,key:String(n),origin:t}}),[H,B]),[et,tt]=r.useState($e??""),nt=(ze??et).trim(),rt=r.useMemo(()=>{if(Xe.has("filter"))return Ze;const e=y(nt),t=Ye.filter(e=>!1!==e.searchable);let n=Ze;return""!==e&&t.length>0&&(n=n.filter(n=>t.some(t=>{const r=t.value?t.value(n.row):n.row[t.key];return y(r).includes(e)}))),Re?n.filter(e=>Re(e.row,e.origin)):n},[Ze,Ye,nt,Re,Xe]),at=r.useMemo(()=>new Intl.Collator(Ae,{numeric:!0,sensitivity:"base"}),[Ae]),[ot,lt]=r.useState(le??[]),st=oe??ot,it=r.useMemo(()=>Xe.has("sort")?rt:b(rt,st,e=>{const t=Ye.find(t=>t.key===e);if(!t)return null;if(t.compare)return(e,n)=>t.compare(e.row,n.row);const n=t.value?t.value:e=>e[t.key];return(e,t)=>c(n(e.row),n(t.row),at)}),[rt,st,Ye,at,Xe]),[ct,ut]=r.useState(we),[dt,pt]=r.useState(Se),mt=Ce??dt,ht=Xe.has("pages")?Pe??it.length:it.length,ft=v(ht,ke??ct,mt),gt=r.useMemo(()=>"pages"!==be||Xe.has("pages")?it:it.slice(ft.start,ft.end),[it,be,Xe,ft.start,ft.end]),vt="pages"===be?ft.start:0,yt=r.useMemo(()=>gt.map(e=>e.key),[gt]),bt=r.useMemo(()=>new Map(Ze.map(e=>[e.key,e])),[Ze]),[kt,wt]=r.useState(he??[]),xt=me??kt,Ct=r.useMemo(()=>new Set(xt.map(String)),[xt]),[St,Mt]=r.useState(null),Nt=r.useRef(null),Kt=r.useRef({paged:gt,pagedKeys:yt,byKey:bt,selectedKeys:Ct,multiple:Je});Kt.current={paged:gt,pagedKeys:yt,byKey:bt,selectedKeys:Ct,multiple:Je};const zt=r.useCallback(e=>{const t=[],n=[];for(const r of e){const e=Kt.current.byKey.get(r);e&&(t.push(e.identity),n.push(e.row))}void 0===me&&wt(t),fe?.(t,n)},[me,fe]),$t=r.useCallback(e=>{Nt.current=e,zt([e])},[zt]),jt=r.useCallback(e=>{const t=Kt.current.selectedKeys,n=new Set(t);n.has(e)?n.delete(e):n.add(e),Nt.current=e,zt([...n])},[zt]),Et=r.useCallback((e,t)=>{const n=Kt.current.pagedKeys,r=Nt.current??n[0];if(void 0===r)return;const a=h(n,r,e);0!==a.length&&zt(t?[...new Set([...Kt.current.selectedKeys,...a])]:a)},[zt]),_t=r.useRef(null),Rt=r.useRef(null),Dt=r.useRef(null),[Lt,Pt]=r.useState(0),[At,Tt]=r.useState(0),Ht=void 0!==U||void 0!==X,Bt=te&&Ht&&gt.length>0;r.useLayoutEffect(()=>{const e=_t.current;if(!e||!Bt)return;const t=new ResizeObserver(([e])=>{Pt(e.contentRect.height)});return t.observe(e),Pt(e.clientHeight),()=>t.disconnect()},[Bt]);const It=r.useCallback(e=>{if(!Bt)return;const t=Math.floor(e.currentTarget.scrollTop/Oe)*Oe;Tt(e=>e===t?e:t)},[Bt,Oe]),Wt=Bt?k(At,Lt,Oe,gt.length,ne):{start:0,end:gt.length,before:0,after:0},Ft=gt.slice(Wt.start,Wt.end),Ot=Ge&&null!==St&&Ft.some(e=>e.key===St),[qt,Ut]=r.useState(ue??{}),Xt=ce??qt,Yt=r.useCallback(e=>{void 0===ce&&Ut(e),de?.(e)},[ce,de]),Vt=r.useRef(new Map),Gt=r.useCallback(e=>{const t=_t.current;if(!t||!Ht)return;const n=J?qe*(Ve?2:1):0,r=e*Oe;r<t.scrollTop+n?t.scrollTop=Math.max(0,r-n):r+Oe>t.scrollTop+t.clientHeight&&(t.scrollTop=r+Oe-t.clientHeight)},[Ht,J,qe,Ve,Oe]),Jt=(e,t)=>{const n=Kt.current.paged,r=Math.min(Math.max(e,0),n.length-1),a=n[r];a&&(t.preventDefault(),Mt(a.key),Gt(r),t.shiftKey&&Kt.current.multiple?Et(a.key,!1):t.ctrlKey||t.metaKey||$t(a.key))};const Qt=r.useCallback(e=>{const t=Rt.current,n=Kt.current.paged;if(!t||0===n.length)return null;const r=t.getBoundingClientRect().top,a=Math.floor((e-r)/Oe);return Math.min(Math.max(a,0),n.length-1)},[Oe]),Zt=r.useRef(null),en=r.useCallback(e=>{const t=Qt(e),n=null===t?void 0:Kt.current.paged[t];n&&(Mt(n.key),Et(n.key,!1))},[Qt,Et]),tn=r.useRef(en);tn.current=en;function nn(e,t){if(Ge&&!t.target.closest('button, a, input, select, textarea, [role="button"]'))if(Dt.current?.focus({preventScroll:!0}),Mt(e.key),2!==t.button){if(0===t.button)return t.shiftKey&&Je?(t.preventDefault(),void Et(e.key,t.ctrlKey||t.metaKey)):void((t.ctrlKey||t.metaKey)&&Je?jt(e.key):($t(e.key),Je&&(e=>{if(Zt.current)return;const t=e=>{const t=Zt.current,r=_t.current;if(!t)return;if(t.y=e.clientY,tn.current(t.y),!r||!Ht)return;const a=r.getBoundingClientRect(),o=a.top+Oe-t.y,l=t.y-(a.bottom-Oe);t.speed=o>0?-Math.min(o,40):l>0?Math.min(l,40):0,0!==t.speed&&null===t.frame&&(t.frame=requestAnimationFrame(n))},n=()=>{const e=Zt.current,t=_t.current;e&&t&&0!==e.speed?(t.scrollTop+=e.speed,tn.current(e.y),e.frame=requestAnimationFrame(n)):e&&(e.frame=null)},r=()=>{const e=Zt.current;null!=e?.frame&&cancelAnimationFrame(e.frame),Zt.current=null,window.removeEventListener("pointermove",t),window.removeEventListener("pointerup",r),window.removeEventListener("pointercancel",r)};Zt.current={y:e,speed:0,frame:null,stop:r},window.addEventListener("pointermove",t),window.addEventListener("pointerup",r),window.addEventListener("pointercancel",r)})(t.clientY)))}else Kt.current.selectedKeys.has(e.key)||$t(e.key)}r.useEffect(()=>()=>Zt.current?.stop(),[]);const rn=r.useMemo(()=>yt.reduce((e,t)=>Ct.has(t)?e+1:e,0),[yt,Ct]),an=yt.length>0&&rn===yt.length,on=p[W],ln=e=>Xt[e.key]??e.width,sn=(Qe?on:0)+Ye.reduce((e,t)=>e+(ln(t)??f),0),cn=Ye.length>0&&Ye.every(e=>void 0!==ln(e)),un=Ye.length+(Qe?1:0)+(cn?1:0),dn=r.useMemo(()=>{const e=[];return Ye.forEach((t,n)=>{const r=e[e.length-1];r&&void 0!==r.label&&r.label===t.group?r.span+=1:e.push({label:t.group,span:1,from:n})}),e},[Ye]),pn={padding:`0 ${Ue}`,borderBottom:"1px solid var(--n-line)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},mn={...pn,height:`${qe}px`,backgroundColor:"var(--n-panel-press)"},hn="odd"===V?0:1,fn=r.useMemo(()=>new Intl.NumberFormat(Ae),[Ae]),gn=Ke??"pages"===be,vn=x(Ie.range,{start:fn.format(0===ht?0:("pages"===be?ft.start:0)+1),end:fn.format("pages"===be?ft.end:ht),total:fn.format(ht)}),yn=e=>{void 0===ke&&ut(e),xe?.(e)},bn=(n,r,a)=>{const o=n.sortable??re,l=n.resizable??ie,s=(i=n.key,st.find(e=>e.key===i));var i;const c=s?st.findIndex(e=>e.key===n.key)+1:0,u=n.headerAlign??n.align??"start";return t("th",{ref:e=>{e?Vt.current.set(n.key,e):Vt.current.delete(n.key)},scope:"col",rowSpan:a,"aria-sort":s?"asc"===s.direction?"ascending":"descending":void 0,className:K("relative font-semibold select-none",s?"text-(--n-accent)":"text-(--neba-muted-fg)",J?"sticky z-20 [backdrop-filter:var(--neba-blur)]":""),style:{...mn,top:J?2!==a&&Ve?qe:0:void 0,textAlign:u},children:[o?t("button",{type:"button",className:K(D,"end"===u?"justify-end":"center"===u?"justify-center":"justify-start"),onClick:e=>((e,t)=>{const n=g(st,e,t&&"multiple"===ae);void 0===oe&&lt(n),se?.(n)})(n.key,e.shiftKey),children:[e("span",{className:"min-w-0 truncate",children:n.label??n.key}),e("span",{"aria-hidden":"true",className:K("flex items-center","desc"===s?.direction?"rotate-0":"rotate-180",s?"":"text-transparent group-hover/sort:text-inherit group-focus-visible/sort:text-inherit"),children:e(M,{})}),c>1?e("span",{"aria-hidden":"true",className:"text-[0.85em] tabular-nums",children:c}):null]}):e("span",{className:"block truncate",children:n.label??n.key}),l&&r<Ye.length-1?e("span",{"aria-hidden":"true",className:L,onPointerDown:e=>((e,t)=>{t.preventDefault(),t.stopPropagation();const n=t.currentTarget,r={...Xt};for(const e of Ye){const t=Vt.current.get(e.key);t&&void 0===r[e.key]&&(r[e.key]=Math.round(t.getBoundingClientRect().width))}const a="rtl"===getComputedStyle(n).direction,o=t.clientX,l=r[e]??m,s=Ye.find(t=>t.key===e)?.minWidth??f;n.setPointerCapture(t.pointerId);const i=t=>{const n=(t.clientX-o)*(a?-1:1);Yt({...r,[e]:Math.max(s,Math.round(l+n))})},c=()=>{n.removeEventListener("pointermove",i),n.removeEventListener("pointerup",c),n.removeEventListener("pointercancel",c)};n.addEventListener("pointermove",i),n.addEventListener("pointerup",c),n.addEventListener("pointercancel",c)})(n.key,e),onDoubleClick:()=>(e=>{const t={...Xt};delete t[e],Yt(t)})(n.key)}):null]},n.key)},kn=t=>e("span",{className:"flex items-center justify-center",children:t}),wn=t=>e("td",{role:Ge?"gridcell":void 0,style:{...pn,padding:0,overflow:"visible"},children:kn(e(o,{size:W,color:F,checked:Ct.has(t.key),"aria-label":Ie.selectRow,onCheckedChange:()=>{Je?jt(t.key):$t(t.key)}}))}),xn=Je?kn(e(o,{size:W,color:F,checked:an,indeterminate:rn>0&&!an,"aria-label":Ie.selectAll,onCheckedChange:()=>{if(an){const e=new Set(yt);zt([...Ct].filter(t=>!e.has(t)))}else zt([...new Set([...Ct,...yt])])}})):null,Cn=cn?e("th",{"aria-hidden":"true",className:K(J?"sticky top-0 z-20 [backdrop-filter:var(--neba-blur)]":""),style:{...mn,padding:0}}):null,Sn=(t,n)=>n>0?e("tr",{"aria-hidden":"true",style:{height:`${n}px`},children:e("td",{colSpan:un,style:{padding:0,border:0}})},t):null;return t(a,{variant:I,size:W,color:F,density:O,elevation:q,padded:!1,className:K("flex flex-col overflow-hidden",Ge?"has-[:focus-visible]:[outline:2px_solid_var(--n-ring)] has-[:focus-visible]:outline-offset-2":"",Te),style:{...R,...He},...Be,children:[Ee||z(De)?t("div",{className:"flex items-center gap-2",style:{padding:`${Ue} ${Ue}`,borderBottom:"1px solid var(--n-line)"},children:[Ee?e(i,{size:W,color:F,density:O,variant:"outline",type:"search",className:"w-full max-w-64",startIcon:e(P,{}),placeholder:_e??Ie.search,"aria-label":_e??Ie.search,value:ze??et,onChange:e=>{const t=e.target.value;void 0===ze&&tt(t),yn(1),je?.(t)}}):null,z(De)?e("div",{className:"ms-auto flex items-center gap-2",children:De}):null]}):null,e("div",{ref:_t,className:"min-h-0 flex-auto overflow-auto overscroll-contain",style:{height:A(U),maxHeight:A(X)},onScroll:It,children:t("table",{ref:Dt,role:Ge?"grid":void 0,"aria-label":Z,"aria-multiselectable":Je||void 0,"aria-rowcount":Bt?gt.length+1:void 0,"aria-activedescendant":Ot?`${Fe}-${St}`:void 0,tabIndex:Ge?0:void 0,className:K("w-full text-start [outline:none]",N[W],"text-(--neba-fg)",Ge?"select-none":""),style:{tableLayout:"fixed",borderCollapse:"separate",borderSpacing:0,minWidth:`${sn}px`},onKeyDown:function(e){if(!Ge||e.target!==e.currentTarget)return;const t=Kt.current.paged;if(0===t.length)return;const n=null===St?-1:Kt.current.pagedKeys.indexOf(St),r=Math.max(1,Math.floor((Lt||10*Oe)/Oe)-1);switch(e.key){case"ArrowDown":Jt(n+1,e);break;case"ArrowUp":Jt(-1===n?0:n-1,e);break;case"Home":Jt(0,e);break;case"End":Jt(t.length-1,e);break;case"PageDown":Jt(-1===n?0:n+r,e);break;case"PageUp":Jt(-1===n?0:n-r,e);break;case" ":-1!==n&&(e.preventDefault(),(e.ctrlKey||e.metaKey)&&Je?jt(t[n].key):$t(t[n].key));break;case"a":case"A":(e.ctrlKey||e.metaKey)&&Je&&(e.preventDefault(),zt(Kt.current.pagedKeys));break;case"Escape":e.preventDefault(),zt([]);break;case"Enter":-1!==n&&ye&&(e.preventDefault(),ye(t[n].row,vt+n))}},children:[Q?e("caption",{className:K($[W],"text-(--neba-muted-fg)"),style:{padding:`0.5rem ${Ue}`,textAlign:"start"},children:Q}):null,t("colgroup",{children:[Qe?e("col",{style:{width:`${on}px`}}):null,Ye.map(t=>{const n=ln(t);return e("col",{style:void 0===n?void 0:{width:`${n}px`}},t.key)}),cn?e("col",{}):null]}),t("thead",{children:[Ve?t("tr",{style:{height:`${qe}px`},children:[Qe?e("th",{scope:"col",rowSpan:2,className:K(J?"sticky top-0 z-20 [backdrop-filter:var(--neba-blur)]":""),style:{...mn,padding:0,overflow:"visible"},children:xn}):null,dn.map(t=>void 0===t.label?bn(Ye[t.from],t.from,2):e("th",{scope:"colgroup",colSpan:t.span,className:K("font-semibold text-(--neba-muted-fg) select-none",J?"sticky top-0 z-20 [backdrop-filter:var(--neba-blur)]":""),style:{...mn,textAlign:"center"},children:t.label},`group-${t.from}`)),cn?r.cloneElement(Cn,{rowSpan:2}):null]}):null,t("tr",{style:{height:`${qe}px`},children:[Qe&&!Ve?e("th",{scope:"col",className:K(J?"sticky top-0 z-20 [backdrop-filter:var(--neba-blur)]":""),style:{...mn,padding:0,overflow:"visible"},children:xn}):null,Ye.map((e,t)=>Ve&&void 0===e.group?null:bn(e,t)),cn&&!Ve?Cn:null]})]}),e("tbody",{ref:Rt,children:0===gt.length?e("tr",{children:e("td",{colSpan:un,className:"text-(--neba-muted-fg)",style:{padding:`2rem ${Ue}`,textAlign:"center"},children:ee??We.title})}):t(n,{children:[Sn("before",Wt.before),Ft.map((n,r)=>{const a=Wt.start+r,o=Ct.has(n.key),l=St===n.key;return t("tr",{id:`${Fe}-${n.key}`,"aria-selected":Ge?o:void 0,"aria-rowindex":Bt?a+2:void 0,"data-neba-row":n.key,className:K(_,o?"[--n-row:var(--n-soft-press)]":!1!==V&&a%2===hn?"[--n-row:var(--n-stripe)]":"",!o&&G?"hover:[--n-row:var(--n-soft)]":"",l&&Ge?"[box-shadow:inset_0_0_0_1px_var(--n-ring)]":"",Ge||ve?"cursor-default":""),style:{height:`${Oe}px`,backgroundColor:"var(--n-row)"},onPointerDown:e=>nn(n,e),onClick:e=>ve?.(n.row,vt+a,e),onDoubleClick:()=>ye?.(n.row,vt+a),children:[Qe?wn(n):null,Ye.map(t=>e("td",{role:Ge?"gridcell":void 0,style:{...pn,textAlign:t.align??"start"},children:t.render?t.render(n.row,vt+a):n.row[t.key]},t.key)),cn?e("td",{"aria-hidden":"true",style:{...pn,padding:0}}):null]},n.key)}),Sn("after",Wt.after)]})})]})}),gn?t("div",{className:K("flex flex-wrap items-center gap-3",$[W]),style:{padding:`0.375rem ${Ue}`,borderTop:"1px solid var(--n-line)"},children:[e("span",{className:"text-(--neba-muted-fg) tabular-nums",children:vn}),Ge&&Ct.size>0?e("span",{className:"text-(--n-accent) tabular-nums",children:x(Ie.selected,{count:fn.format(Ct.size)})}):null,t("div",{className:"ms-auto flex items-center gap-2",children:["pages"===be&&Ne.length>0?e(n,{children:e(s,{size:W,color:F,density:O,variant:"outline",label:Ie.rowsPerPage,items:Ne.map(e=>({value:e})),value:mt,onValueChange:e=>{const t=Number(e);void 0===Ce&&pt(t),yn(Math.floor(ft.start/t)+1),Me?.(t)}})}):null,"pages"===be?e(l,{size:W,color:F,count:ft.pages,page:ft.page,siblingCount:0,onPageChange:yn}):null]})]}):null,!gn&&Bt?e("span",{className:E,"aria-live":"polite",children:vn}):null]})}
1
+ "use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as r from"react";import{Box as a}from"../box/Box.js";import{Checkbox as o}from"../checkbox/Checkbox.js";import{Pagination as l}from"../pagination/Pagination.js";import{Select as s}from"../select/Select.js";import{TextField as i}from"../text-field/TextField.js";import{compareValues as c,dataHeaderHeights as u,dataRowHeights as d,dataTickWidths as p,defaultColumnWidth as m,keysBetween as h,minColumnWidth as f,nextSort as g,pageBounds as v,searchText as y,sortRows as b,virtualWindow as k}from"../../internal/data-table.js";import{emptyMessages as w,fillMessage as x,tableMessages as C,useMessages as S}from"../../internal/i18n.js";import{ChevronIcon as M}from"../../internal/icons.js";import{controlTextLeadingClasses as N,cx as K,hasContent as z,metaTextClasses as $,paddingXValues as j,srOnlyClasses as E}from"../../internal/styles.js";const _=["[--n-row:transparent]","[transition:background-color_var(--neba-duration)_var(--neba-ease)]"].join(" "),R={"--n-stripe":"color-mix(in oklab, var(--neba-fg) 4%, transparent)"},D=["group/sort flex w-full min-w-0 cursor-pointer items-center gap-1","text-inherit [outline:none]","[transition:color_var(--neba-duration)_var(--neba-ease)]","hover:text-(--n-accent)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1","[&_svg]:pointer-events-none [&_svg]:size-[1.15em] [&_svg]:shrink-0"].join(" "),L=["absolute inset-y-0 z-10 w-2 cursor-col-resize select-none","end-0 translate-x-1/2 rtl:-translate-x-1/2","after:absolute after:inset-y-1 after:start-1/2 after:w-px","after:[background:transparent]","after:[transition:background_var(--neba-duration)_var(--neba-ease)]","hover:after:[background:var(--n-accent)]"].join(" ");function P(){return t("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e("circle",{cx:"7.25",cy:"7.25",r:"4.75",stroke:"currentColor",strokeWidth:"1.5"}),e("path",{d:"m10.75 10.75 2.75 2.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function A(e){return"number"==typeof e?`${e}px`:e}export function DataTable({headers:T,items:H,getRowKey:B,variant:I="outline",size:W="sm",color:F="primary",density:O="compact",elevation:q=0,height:U,maxHeight:X,rowHeight:Y,striped:V=!1,hoverable:G=!0,stickyHeader:J=!0,caption:Q,label:Z,empty:ee,virtual:te=!0,overscan:ne=8,sortable:re=!1,sortMode:ae="single",sort:oe,defaultSort:le,onSortChange:se,resizable:ie=!1,columnWidths:ce,defaultColumnWidths:ue,onColumnWidthsChange:de,selectionMode:pe="none",selected:me,defaultSelected:he,onSelectedChange:fe,checkboxes:ge=!1,onRowClick:ve,onRowActivate:ye,paging:be="scroll",page:ke,defaultPage:we=1,onPageChange:xe,pageSize:Ce,defaultPageSize:Se=25,onPageSizeChange:Me,pageSizeOptions:Ne=[10,25,50,100],footer:Ke,search:ze,defaultSearch:$e,onSearchChange:je,searchable:Ee=!1,searchPlaceholder:_e,filter:Re,toolbar:De,manual:Le=!1,rowCount:Pe,locale:Ae,className:Te,style:He,...Be}){const Ie=S(C,Ae),We=S(w,Ae),Fe=r.useId(),Oe=Y??d[O][W],qe=u[O][W],Ue=j[O][W],Xe=r.useMemo(()=>new Set(!0===Le?["sort","filter","pages"]:Le||[]),[Le]),Ye=r.useMemo(()=>T.filter(e=>!e.hidden),[T]),Ve=Ye.some(e=>void 0!==e.group),Ge="none"!==pe,Je="multiple"===pe,Qe=Ge&&ge,Ze=r.useMemo(()=>H.map((e,t)=>{const n=B?B(e,t):t;return{row:e,identity:n,key:String(n),origin:t}}),[H,B]),[et,tt]=r.useState($e??""),nt=(ze??et).trim(),rt=r.useMemo(()=>{if(Xe.has("filter"))return Ze;const e=y(nt),t=Ye.filter(e=>!1!==e.searchable);let n=Ze;return""!==e&&t.length>0&&(n=n.filter(n=>t.some(t=>{const r=t.value?t.value(n.row):n.row[t.key];return y(r).includes(e)}))),Re?n.filter(e=>Re(e.row,e.origin)):n},[Ze,Ye,nt,Re,Xe]),at=r.useMemo(()=>new Intl.Collator(Ae,{numeric:!0,sensitivity:"base"}),[Ae]),[ot,lt]=r.useState(le??[]),st=oe??ot,it=r.useMemo(()=>Xe.has("sort")?rt:b(rt,st,e=>{const t=Ye.find(t=>t.key===e);if(!t)return null;if(t.compare)return(e,n)=>t.compare(e.row,n.row);const n=t.value?t.value:e=>e[t.key];return(e,t)=>c(n(e.row),n(t.row),at)}),[rt,st,Ye,at,Xe]),[ct,ut]=r.useState(we),[dt,pt]=r.useState(Se),mt=Ce??dt,ht=Xe.has("pages")?Pe??it.length:it.length,ft=v(ht,ke??ct,mt),gt=r.useMemo(()=>"pages"!==be||Xe.has("pages")?it:it.slice(ft.start,ft.end),[it,be,Xe,ft.start,ft.end]),vt="pages"===be?ft.start:0,yt=r.useMemo(()=>gt.map(e=>e.key),[gt]),bt=r.useMemo(()=>new Map(Ze.map(e=>[e.key,e])),[Ze]),[kt,wt]=r.useState(he??[]),xt=me??kt,Ct=r.useMemo(()=>new Set(xt.map(String)),[xt]),[St,Mt]=r.useState(null),Nt=r.useRef(null),Kt=r.useRef({paged:gt,pagedKeys:yt,byKey:bt,selectedKeys:Ct,multiple:Je});Kt.current={paged:gt,pagedKeys:yt,byKey:bt,selectedKeys:Ct,multiple:Je};const zt=r.useCallback(e=>{const t=[],n=[];for(const r of e){const e=Kt.current.byKey.get(r);e&&(t.push(e.identity),n.push(e.row))}void 0===me&&wt(t),fe?.(t,n)},[me,fe]),$t=r.useCallback(e=>{Nt.current=e,zt([e])},[zt]),jt=r.useCallback(e=>{const t=Kt.current.selectedKeys,n=new Set(t);n.has(e)?n.delete(e):n.add(e),Nt.current=e,zt([...n])},[zt]),Et=r.useCallback((e,t)=>{const n=Kt.current.pagedKeys,r=Nt.current??n[0];if(void 0===r)return;const a=h(n,r,e);0!==a.length&&zt(t?[...new Set([...Kt.current.selectedKeys,...a])]:a)},[zt]),_t=r.useRef(null),Rt=r.useRef(null),Dt=r.useRef(null),[Lt,Pt]=r.useState(0),[At,Tt]=r.useState(0),Ht=void 0!==U||void 0!==X,Bt=te&&Ht&&gt.length>0;r.useLayoutEffect(()=>{const e=_t.current;if(!e||!Bt)return;const t=new ResizeObserver(([e])=>{Pt(e.contentRect.height)});return t.observe(e),Pt(e.clientHeight),()=>t.disconnect()},[Bt]);const It=r.useCallback(e=>{if(!Bt)return;const t=Math.floor(e.currentTarget.scrollTop/Oe)*Oe;Tt(e=>e===t?e:t)},[Bt,Oe]),Wt=Bt?k(At,Lt,Oe,gt.length,ne):{start:0,end:gt.length,before:0,after:0},Ft=gt.slice(Wt.start,Wt.end),Ot=Ge&&null!==St&&Ft.some(e=>e.key===St),[qt,Ut]=r.useState(ue??{}),Xt=ce??qt,Yt=r.useCallback(e=>{void 0===ce&&Ut(e),de?.(e)},[ce,de]),Vt=r.useRef(new Map),Gt=r.useCallback(e=>{const t=_t.current;if(!t||!Ht)return;const n=J?qe*(Ve?2:1):0,r=e*Oe;r<t.scrollTop+n?t.scrollTop=Math.max(0,r-n):r+Oe>t.scrollTop+t.clientHeight&&(t.scrollTop=r+Oe-t.clientHeight)},[Ht,J,qe,Ve,Oe]),Jt=(e,t)=>{const n=Kt.current.paged,r=Math.min(Math.max(e,0),n.length-1),a=n[r];a&&(t.preventDefault(),Mt(a.key),Gt(r),t.shiftKey&&Kt.current.multiple?Et(a.key,!1):t.ctrlKey||t.metaKey||$t(a.key))};const Qt=r.useCallback(e=>{const t=Rt.current,n=Kt.current.paged;if(!t||0===n.length)return null;const r=t.getBoundingClientRect().top,a=Math.floor((e-r)/Oe);return Math.min(Math.max(a,0),n.length-1)},[Oe]),Zt=r.useRef(null),en=r.useCallback(e=>{const t=Qt(e),n=null===t?void 0:Kt.current.paged[t];n&&(Mt(n.key),Et(n.key,!1))},[Qt,Et]),tn=r.useRef(en);tn.current=en;function nn(e,t){if(Ge&&!t.target.closest('button, a, input, select, textarea, [role="button"]'))if(Dt.current?.focus({preventScroll:!0}),Mt(e.key),2!==t.button){if(0===t.button)return t.shiftKey&&Je?(t.preventDefault(),void Et(e.key,t.ctrlKey||t.metaKey)):void((t.ctrlKey||t.metaKey)&&Je?jt(e.key):($t(e.key),Je&&(e=>{if(Zt.current)return;const t=e=>{const t=Zt.current,r=_t.current;if(!t)return;if(t.y=e.clientY,tn.current(t.y),!r||!Ht)return;const a=r.getBoundingClientRect(),o=a.top+Oe-t.y,l=t.y-(a.bottom-Oe);t.speed=o>0?-Math.min(o,40):l>0?Math.min(l,40):0,0!==t.speed&&null===t.frame&&(t.frame=requestAnimationFrame(n))},n=()=>{const e=Zt.current,t=_t.current;e&&t&&0!==e.speed?(t.scrollTop+=e.speed,tn.current(e.y),e.frame=requestAnimationFrame(n)):e&&(e.frame=null)},r=()=>{const e=Zt.current;null!=e?.frame&&cancelAnimationFrame(e.frame),Zt.current=null,window.removeEventListener("pointermove",t),window.removeEventListener("pointerup",r),window.removeEventListener("pointercancel",r)};Zt.current={y:e,speed:0,frame:null,stop:r},window.addEventListener("pointermove",t),window.addEventListener("pointerup",r),window.addEventListener("pointercancel",r)})(t.clientY)))}else Kt.current.selectedKeys.has(e.key)||$t(e.key)}r.useEffect(()=>()=>Zt.current?.stop(),[]);const rn=r.useMemo(()=>yt.reduce((e,t)=>Ct.has(t)?e+1:e,0),[yt,Ct]),an=yt.length>0&&rn===yt.length,on=p[W],ln=e=>Xt[e.key]??e.width,sn=(Qe?on:0)+Ye.reduce((e,t)=>e+(ln(t)??f),0),cn=Ye.length>0&&Ye.every(e=>void 0!==ln(e)),un=Ye.length+(Qe?1:0)+(cn?1:0),dn=r.useMemo(()=>{const e=[];return Ye.forEach((t,n)=>{const r=e[e.length-1];r&&void 0!==r.label&&r.label===t.group?r.span+=1:e.push({label:t.group,span:1,from:n})}),e},[Ye]),pn={padding:`0 ${Ue}`,borderBottom:"1px solid var(--n-line)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},mn={...pn,height:`${qe}px`,backgroundColor:"var(--n-panel-press)"},hn="odd"===V?0:1,fn=r.useMemo(()=>new Intl.NumberFormat(Ae),[Ae]),gn=Ke??"pages"===be,vn=x(Ie.range,{start:fn.format(0===ht?0:("pages"===be?ft.start:0)+1),end:fn.format("pages"===be?ft.end:ht),total:fn.format(ht)}),yn=e=>{void 0===ke&&ut(e),xe?.(e)},bn=(n,r,a)=>{const o=n.sortable??re,l=n.resizable??ie,s=(i=n.key,st.find(e=>e.key===i));var i;const c=s?st.findIndex(e=>e.key===n.key)+1:0,u=n.headerAlign??n.align??"start";return t("th",{ref:e=>{e?Vt.current.set(n.key,e):Vt.current.delete(n.key)},scope:"col",rowSpan:a,"aria-sort":s?"asc"===s.direction?"ascending":"descending":void 0,className:K("relative font-semibold select-none",s?"text-(--n-accent)":"text-(--neba-muted-fg)",J?"sticky z-20 [backdrop-filter:var(--neba-blur)]":""),style:{...mn,top:J?2!==a&&Ve?qe:0:void 0,textAlign:u},children:[o?t("button",{type:"button",className:K(D,"end"===u?"justify-end":"center"===u?"justify-center":"justify-start"),onClick:e=>((e,t)=>{const n=g(st,e,t&&"multiple"===ae);void 0===oe&&lt(n),se?.(n)})(n.key,e.shiftKey),children:[e("span",{className:"min-w-0 truncate",children:n.label??n.key}),e("span",{"aria-hidden":"true",className:K("flex items-center","desc"===s?.direction?"rotate-0":"rotate-180",s?"":"text-transparent group-hover/sort:text-inherit group-focus-visible/sort:text-inherit"),children:e(M,{})}),c>1?e("span",{"aria-hidden":"true",className:"text-[0.85em] tabular-nums",children:c}):null]}):e("span",{className:"block truncate",children:n.label??n.key}),l&&r<Ye.length-1?e("span",{"aria-hidden":"true",className:L,onPointerDown:e=>((e,t)=>{t.preventDefault(),t.stopPropagation();const n=t.currentTarget,r={...Xt};for(const e of Ye){const t=Vt.current.get(e.key);t&&void 0===r[e.key]&&(r[e.key]=Math.round(t.getBoundingClientRect().width))}const a="rtl"===getComputedStyle(n).direction,o=t.clientX,l=r[e]??m,s=Ye.find(t=>t.key===e)?.minWidth??f;n.setPointerCapture(t.pointerId);const i=t=>{const n=(t.clientX-o)*(a?-1:1);Yt({...r,[e]:Math.max(s,Math.round(l+n))})},c=()=>{n.removeEventListener("pointermove",i),n.removeEventListener("pointerup",c),n.removeEventListener("pointercancel",c)};n.addEventListener("pointermove",i),n.addEventListener("pointerup",c),n.addEventListener("pointercancel",c)})(n.key,e),onDoubleClick:()=>(e=>{const t={...Xt};delete t[e],Yt(t)})(n.key)}):null]},n.key)},kn=t=>e("span",{className:"flex items-center justify-center",children:t}),wn=t=>e("td",{role:Ge?"gridcell":void 0,style:{...pn,padding:0,overflow:"visible"},children:kn(e(o,{size:W,color:F,checked:Ct.has(t.key),"aria-label":Ie.selectRow,onCheckedChange:()=>{Je?jt(t.key):$t(t.key)}}))}),xn=Je?kn(e(o,{size:W,color:F,checked:an,indeterminate:rn>0&&!an,"aria-label":Ie.selectAll,onCheckedChange:()=>{if(an){const e=new Set(yt);zt([...Ct].filter(t=>!e.has(t)))}else zt([...new Set([...Ct,...yt])])}})):null,Cn=cn?e("th",{"aria-hidden":"true",className:K(J?"sticky top-0 z-20 [backdrop-filter:var(--neba-blur)]":""),style:{...mn,padding:0}}):null,Sn=(t,n)=>n>0?e("tr",{"aria-hidden":"true",style:{height:`${n}px`},children:e("td",{colSpan:un,style:{padding:0,border:0}})},t):null;return t(a,{variant:I,size:W,color:F,density:O,elevation:q,padded:!1,className:K("flex flex-col overflow-hidden",Ge?"has-[:focus-visible]:[outline:2px_solid_var(--n-ring)] has-[:focus-visible]:outline-offset-2":"",Te),style:{...R,...He},...Be,children:[Ee||z(De)?t("div",{className:"flex items-center gap-2",style:{padding:`${Ue} ${Ue}`,borderBottom:"1px solid var(--n-line)"},children:[Ee?e(i,{size:W,color:F,density:O,variant:"outline",type:"search",className:"w-full max-w-64",startIcon:e(P,{}),placeholder:_e??Ie.search,"aria-label":_e??Ie.search,value:ze??et,onChange:e=>{const t=e.target.value;void 0===ze&&tt(t),yn(1),je?.(t)}}):null,z(De)?e("div",{className:"ms-auto flex items-center gap-2",children:De}):null]}):null,e("div",{ref:_t,className:"min-h-0 flex-auto overflow-auto overscroll-contain",style:{height:A(U),maxHeight:A(X)},onScroll:It,children:t("table",{ref:Dt,role:Ge?"grid":void 0,"aria-label":Z,"aria-multiselectable":Je||void 0,"aria-rowcount":Bt?gt.length+1:void 0,"aria-activedescendant":Ot?`${Fe}-${St}`:void 0,tabIndex:Ge?0:void 0,className:K("w-full text-start [outline:none]",N[W],"text-(--neba-fg)",Ge?"select-none":""),style:{tableLayout:"fixed",borderCollapse:"separate",borderSpacing:0,minWidth:`${sn}px`},onKeyDown:function(e){if(!Ge||e.target!==e.currentTarget)return;const t=Kt.current.paged;if(0===t.length)return;const n=null===St?-1:Kt.current.pagedKeys.indexOf(St),r=Math.max(1,Math.floor((Lt||10*Oe)/Oe)-1);switch(e.key){case"ArrowDown":Jt(n+1,e);break;case"ArrowUp":Jt(-1===n?0:n-1,e);break;case"Home":Jt(0,e);break;case"End":Jt(t.length-1,e);break;case"PageDown":Jt(-1===n?0:n+r,e);break;case"PageUp":Jt(-1===n?0:n-r,e);break;case" ":-1!==n&&(e.preventDefault(),(e.ctrlKey||e.metaKey)&&Je?jt(t[n].key):$t(t[n].key));break;case"a":case"A":(e.ctrlKey||e.metaKey)&&Je&&(e.preventDefault(),zt(Kt.current.pagedKeys));break;case"Escape":e.preventDefault(),zt([]);break;case"Enter":-1!==n&&ye&&(e.preventDefault(),ye(t[n].row,vt+n))}},children:[Q?e("caption",{className:K($[W],"text-(--neba-muted-fg)"),style:{padding:`0.5rem ${Ue}`,textAlign:"start"},children:Q}):null,t("colgroup",{children:[Qe?e("col",{style:{width:`${on}px`}}):null,Ye.map(t=>{const n=ln(t);return e("col",{style:void 0===n?void 0:{width:`${n}px`}},t.key)}),cn?e("col",{}):null]}),t("thead",{children:[Ve?t("tr",{style:{height:`${qe}px`},children:[Qe?e("th",{scope:"col",rowSpan:2,className:K(J?"sticky top-0 z-20 [backdrop-filter:var(--neba-blur)]":""),style:{...mn,padding:0,overflow:"visible"},children:xn}):null,dn.map(t=>void 0===t.label?bn(Ye[t.from],t.from,2):e("th",{scope:"colgroup",colSpan:t.span,className:K("font-semibold text-(--neba-muted-fg) select-none",J?"sticky top-0 z-20 [backdrop-filter:var(--neba-blur)]":""),style:{...mn,textAlign:"center"},children:t.label},`group-${t.from}`)),cn?r.cloneElement(Cn,{rowSpan:2}):null]}):null,t("tr",{style:{height:`${qe}px`},children:[Qe&&!Ve?e("th",{scope:"col",className:K(J?"sticky top-0 z-20 [backdrop-filter:var(--neba-blur)]":""),style:{...mn,padding:0,overflow:"visible"},children:xn}):null,Ye.map((e,t)=>Ve&&void 0===e.group?null:bn(e,t)),cn&&!Ve?Cn:null]})]}),e("tbody",{ref:Rt,children:0===gt.length?e("tr",{children:e("td",{colSpan:un,className:"text-(--neba-muted-fg)",style:{padding:`2rem ${Ue}`,textAlign:"center"},children:ee??We.title})}):t(n,{children:[Sn("before",Wt.before),Ft.map((n,r)=>{const a=Wt.start+r,o=Ct.has(n.key),l=St===n.key;return t("tr",{id:`${Fe}-${n.key}`,"aria-selected":Ge?o:void 0,"aria-rowindex":Bt?a+2:void 0,"data-neba-row":n.key,className:K(_,o?"[--n-row:var(--n-soft-press)]":!1!==V&&a%2===hn?"[--n-row:var(--n-stripe)]":"",!o&&G?"hover:[--n-row:var(--n-soft)]":"",l&&Ge?"[box-shadow:inset_0_0_0_1px_var(--n-ring)]":"",Ge||ve?"cursor-default":""),style:{height:`${Oe}px`,backgroundColor:"var(--n-row)"},onPointerDown:e=>nn(n,e),onClick:e=>ve?.(n.row,vt+a,e),onDoubleClick:()=>ye?.(n.row,vt+a),children:[Qe?wn(n):null,Ye.map(t=>e("td",{role:Ge?"gridcell":void 0,style:{...pn,textAlign:t.align??"start"},children:t.render?t.render(n.row,vt+a):n.row[t.key]},t.key)),cn?e("td",{"aria-hidden":"true",style:{...pn,padding:0}}):null]},n.key)}),Sn("after",Wt.after)]})})]})}),gn?t("div",{className:K("flex flex-wrap items-center gap-3",$[W]),style:{padding:`0.375rem ${Ue}`,borderTop:"1px solid var(--n-line)"},children:[e("span",{className:"text-(--neba-muted-fg) tabular-nums",children:vn}),Ge&&Ct.size>0?e("span",{className:"text-(--n-accent) tabular-nums",children:x(Ie.selected,{count:fn.format(Ct.size)})}):null,t("div",{className:"ms-auto flex items-center gap-2",children:["pages"===be&&Ne.length>0?e(n,{children:e(s,{size:W,color:F,density:O,variant:"outline",label:Ie.rowsPerPage,items:Ne.map(e=>({value:e})),value:mt,onValueChange:e=>{const t=Number(e);void 0===Ce&&pt(t),yn(Math.floor(ft.start/t)+1),Me?.(t)}})}):null,"pages"===be?e(l,{size:W,color:F,count:ft.pages,page:ft.page,siblingCount:0,onPageChange:yn}):null]})]}):null,!gn&&Bt?e("span",{className:E,"aria-live":"polite",children:vn}):null]})}
@@ -1 +1 @@
1
- import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{Button as l}from"../button/Button.js";import{Calendar as o,usePickerLabels as n}from"../../internal/calendar.js";import{CalendarIcon as r}from"../../internal/icons.js";import{PickerFooter as s,PickerShell as i}from"../../internal/picker.js";import{displaySamples as c,formatDate as d,isDayOutside as m,isValidDate as u,localeWeekStart as p,mergeDateAndTime as f,startOfDay as h,startOfMonth as b,toISODate as y,today as x,withPlaceholder as j}from"../../internal/date.js";import{cx as v}from"../../internal/styles.js";export const DatePicker=/*@__PURE__*/t.forwardRef(function({value:D,defaultValue:O,onValueChange:S,open:g,defaultOpen:C,onOpenChange:k,defaultMonth:z,minDate:w,maxDate:M,shouldDisableDate:V,locale:B,weekStartsOn:I,format:R={dateStyle:"medium"},placeholder:E,clearable:F=!1,showTodayButton:N=!0,closeOnSelect:P=!0,labels:T,name:q,size:A="md",color:G="primary",readOnly:H=!1,disabled:J=!1,startIcon:K,...L},Q){const U=n(T),W=I??p(B),[X,Y]=t.useState(O??null),Z=void 0!==D?D:X,[$,_]=t.useState(C??!1),ee=g??$,[ae,te]=t.useState(()=>b(u(Z)?Z:z??x()));t.useEffect(()=>{ee&&te(b(u(Z)?Z:z??x()))},[ee]);const le=e=>{e&&(H||J)||(void 0===g&&_(e),k?.(e))},oe=e=>{void 0===D&&Y(e),S?.(e)},ne=e=>{const a=u(Z)?f(e,Z):h(e);oe(a),te(b(a)),P&&le(!1)},re=x(),se=m(re,w,M)||(V?.(re)??!1),ie=N||F,ce=t.useMemo(()=>j(c(B,R),E),[B,R,E]);return e(i,{...L,size:A,color:G,readOnly:H,disabled:J,triggerRef:Q,startIcon:K??e(r,{}),display:u(Z)?d(Z,B,R):E??"",samples:ce,empty:!u(Z),clearable:F,onClear:()=>oe(null),open:ee,onOpenChange:le,labels:U,hiddenValues:q?[{name:q,value:u(Z)?y(Z):""}]:void 0,children:a("div",{className:v("flex flex-col",ie&&"gap-1.5"),children:[e(o,{size:A,color:G,locale:B,weekStartsOn:W,month:ae,onMonthChange:te,selected:[Z],onSelect:ne,minDate:w,maxDate:M,shouldDisableDate:V,labels:U,autoFocus:!0}),ie?a(s,{size:A,children:[F?e(l,{variant:"text",size:A,color:G,density:"compact",onClick:()=>{oe(null),le(!1)},children:U.clear}):null,N?e(l,{variant:"text",size:A,color:G,density:"compact",disabled:se,onClick:()=>ne(re),children:U.today}):null]}):null]})})});
1
+ "use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{Button as l}from"../button/Button.js";import{Calendar as o,usePickerLabels as n}from"../../internal/calendar.js";import{CalendarIcon as r}from"../../internal/icons.js";import{PickerFooter as s,PickerShell as i}from"../../internal/picker.js";import{displaySamples as c,formatDate as d,isDayOutside as m,isValidDate as u,localeWeekStart as p,mergeDateAndTime as f,startOfDay as h,startOfMonth as b,toISODate as y,today as x,withPlaceholder as j}from"../../internal/date.js";import{cx as v}from"../../internal/styles.js";export const DatePicker=/*@__PURE__*/t.forwardRef(function({value:D,defaultValue:O,onValueChange:S,open:g,defaultOpen:C,onOpenChange:k,defaultMonth:z,minDate:w,maxDate:M,shouldDisableDate:V,locale:B,weekStartsOn:I,format:R={dateStyle:"medium"},placeholder:E,clearable:F=!1,showTodayButton:N=!0,closeOnSelect:P=!0,labels:T,name:q,size:A="md",color:G="primary",readOnly:H=!1,disabled:J=!1,startIcon:K,...L},Q){const U=n(T),W=I??p(B),[X,Y]=t.useState(O??null),Z=void 0!==D?D:X,[$,_]=t.useState(C??!1),ee=g??$,[ae,te]=t.useState(()=>b(u(Z)?Z:z??x()));t.useEffect(()=>{ee&&te(b(u(Z)?Z:z??x()))},[ee]);const le=e=>{e&&(H||J)||(void 0===g&&_(e),k?.(e))},oe=e=>{void 0===D&&Y(e),S?.(e)},ne=e=>{const a=u(Z)?f(e,Z):h(e);oe(a),te(b(a)),P&&le(!1)},re=x(),se=m(re,w,M)||(V?.(re)??!1),ie=N||F,ce=t.useMemo(()=>j(c(B,R),E),[B,R,E]);return e(i,{...L,size:A,color:G,readOnly:H,disabled:J,triggerRef:Q,startIcon:K??e(r,{}),display:u(Z)?d(Z,B,R):E??"",samples:ce,empty:!u(Z),clearable:F,onClear:()=>oe(null),open:ee,onOpenChange:le,labels:U,hiddenValues:q?[{name:q,value:u(Z)?y(Z):""}]:void 0,children:a("div",{className:v("flex flex-col",ie&&"gap-1.5"),children:[e(o,{size:A,color:G,locale:B,weekStartsOn:W,month:ae,onMonthChange:te,selected:[Z],onSelect:ne,minDate:w,maxDate:M,shouldDisableDate:V,labels:U,autoFocus:!0}),ie?a(s,{size:A,children:[F?e(l,{variant:"text",size:A,color:G,density:"compact",onClick:()=>{oe(null),le(!1)},children:U.clear}):null,N?e(l,{variant:"text",size:A,color:G,density:"compact",disabled:se,onClick:()=>ne(re),children:U.today}):null]}):null]})})});
@@ -1 +1 @@
1
- import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as n from"react";import{Button as a}from"../button/Button.js";import{Calendar as t,usePickerLabels as s}from"../../internal/calendar.js";import{ArrowRightIcon as r,CalendarIcon as o}from"../../internal/icons.js";import{PickerFooter as i,PickerShell as c}from"../../internal/picker.js";import{WidthSizer as u}from"../../internal/sizer.js";import{addMonths as d,compareDay as m,displaySamples as h,formatDate as p,isValidDate as f,localeWeekStart as x,startOfDay as v,startOfMonth as g,toISODate as b,today as w,withPlaceholder as y}from"../../internal/date.js";import{cx as N,gapClasses as j,metaTextClasses as S}from"../../internal/styles.js";const C={start:null,end:null};export const DateRangePicker=/*@__PURE__*/n.forwardRef(function({value:D,defaultValue:O,onValueChange:k,open:z,defaultOpen:P,onOpenChange:B,defaultMonth:M,minDate:R,maxDate:V,shouldDisableDate:E,locale:I,weekStartsOn:F,format:q={dateStyle:"medium"},monthCount:A=2,startPlaceholder:G,endPlaceholder:H,presets:J,clearable:K=!1,closeOnSelect:L=!0,labels:Q,name:T,size:U="md",color:W="primary",readOnly:X=!1,disabled:Y=!1,startIcon:Z,...$},_){const ee=s(Q),le=F??x(I),[ne,ae]=n.useState(O??C),te=void 0!==D?D??C:ne,se=f(te.start)?te.start:null,re=f(te.end)?te.end:null,[oe,ie]=n.useState(P??!1),ce=z??oe,[ue,de]=n.useState(null),[me,he]=n.useState(null),[pe,fe]=n.useState(()=>g(se??M??w()));n.useEffect(()=>{ce?fe(g(se??M??w())):(de(null),he(null))},[ce]);const xe=e=>{e&&(X||Y)||(void 0===z&&ie(e),B?.(e))},ve=e=>{void 0===D&&ae(e),k?.(e)},ge=ue??se,be=null!==ue?me:re,we=(l,n)=>f(l)?p(l,I,q):e("span",{className:"text-(--neba-muted-fg)",children:n??""}),ye=d(pe,1),Ne=2===A,je=h(I,q),Se=null!==ue?ee.end:null===se?ee.start:null,Ce={size:U,color:W,locale:I,weekStartsOn:le,selected:[se,re,ue],rangeStart:ge,rangeEnd:be,onSelect:e=>{const l=v(e);if(null===ue)return de(l),he(l),void ve({start:l,end:null});const[n,a]=m(l,ue)<0?[l,ue]:[ue,l];de(null),he(null),ve({start:n,end:a}),L&&xe(!1)},onPreviewChange:e=>{null!==ue&&he(e??ue)},minDate:R,maxDate:V,shouldDisableDate:E,showOutsideDays:!1,labels:ee};return e(c,{...$,size:U,color:W,readOnly:X,disabled:Y,triggerRef:_,startIcon:Z??e(o,{}),display:l("span",{className:"flex min-w-0 items-center gap-1.5",children:[l("span",{className:"flex min-w-0 flex-col",children:[e("span",{className:"truncate",children:we(se,G)}),e(u,{samples:y(je,G)})]}),e("span",{"aria-hidden":"true",className:"flex shrink-0 items-center text-(--neba-muted-fg) rtl:rotate-180",children:e(r,{})}),l("span",{className:"flex min-w-0 flex-col",children:[e("span",{className:"truncate",children:we(re,H)}),e(u,{samples:y(je,H)})]})]}),empty:null===se&&null===re,clearable:K,onClear:()=>ve(C),open:ce,onOpenChange:xe,labels:ee,hiddenValues:T?[{name:T,value:se?b(se):""},{name:T,value:re?b(re):""}]:void 0,children:l("div",{className:"flex flex-col gap-1.5",children:[l("div",{className:N("flex items-stretch",j[U]),children:[J&&J.length>0?e("div",{className:N("flex max-h-[calc(var(--n-cell,2rem)*8)] flex-col overflow-y-auto border-e pe-1.5","[border-color:var(--n-line)]"),children:J.map((l,n)=>e(a,{variant:"text",size:U,color:W,density:"compact",className:"justify-start whitespace-nowrap",onClick:()=>(e=>{const l="function"==typeof e.value?e.value():e.value;de(null),he(null),ve(l),f(l.start)&&fe(g(l.start)),L&&xe(!1)})(l),children:l.label},n))}):null,e(t,{...Ce,month:pe,onMonthChange:fe,showNextButton:!Ne,autoFocus:!0}),Ne?e(t,{...Ce,month:ye,onMonthChange:e=>fe(d(e,-1)),showPreviousButton:!1}):null]}),K||null!==Se?l(i,{size:U,children:[null!==Se?e("span",{className:N("me-auto text-(--neba-muted-fg)",S[U]),children:Se}):null,K?e(a,{variant:"text",size:U,color:W,density:"compact",onClick:()=>{de(null),he(null),ve(C),xe(!1)},children:ee.clear}):null]}):null]})})});
1
+ "use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as n from"react";import{Button as a}from"../button/Button.js";import{Calendar as t,usePickerLabels as s}from"../../internal/calendar.js";import{ArrowRightIcon as r,CalendarIcon as o}from"../../internal/icons.js";import{PickerFooter as i,PickerShell as c}from"../../internal/picker.js";import{WidthSizer as u}from"../../internal/sizer.js";import{addMonths as d,compareDay as m,displaySamples as h,formatDate as p,isValidDate as f,localeWeekStart as x,startOfDay as v,startOfMonth as g,toISODate as b,today as w,withPlaceholder as y}from"../../internal/date.js";import{cx as N,gapClasses as j,metaTextClasses as S}from"../../internal/styles.js";const C={start:null,end:null};export const DateRangePicker=/*@__PURE__*/n.forwardRef(function({value:D,defaultValue:O,onValueChange:k,open:z,defaultOpen:P,onOpenChange:B,defaultMonth:M,minDate:R,maxDate:V,shouldDisableDate:E,locale:I,weekStartsOn:F,format:q={dateStyle:"medium"},monthCount:A=2,startPlaceholder:G,endPlaceholder:H,presets:J,clearable:K=!1,closeOnSelect:L=!0,labels:Q,name:T,size:U="md",color:W="primary",readOnly:X=!1,disabled:Y=!1,startIcon:Z,...$},_){const ee=s(Q),le=F??x(I),[ne,ae]=n.useState(O??C),te=void 0!==D?D??C:ne,se=f(te.start)?te.start:null,re=f(te.end)?te.end:null,[oe,ie]=n.useState(P??!1),ce=z??oe,[ue,de]=n.useState(null),[me,he]=n.useState(null),[pe,fe]=n.useState(()=>g(se??M??w()));n.useEffect(()=>{ce?fe(g(se??M??w())):(de(null),he(null))},[ce]);const xe=e=>{e&&(X||Y)||(void 0===z&&ie(e),B?.(e))},ve=e=>{void 0===D&&ae(e),k?.(e)},ge=ue??se,be=null!==ue?me:re,we=(l,n)=>f(l)?p(l,I,q):e("span",{className:"text-(--neba-muted-fg)",children:n??""}),ye=d(pe,1),Ne=2===A,je=h(I,q),Se=null!==ue?ee.end:null===se?ee.start:null,Ce={size:U,color:W,locale:I,weekStartsOn:le,selected:[se,re,ue],rangeStart:ge,rangeEnd:be,onSelect:e=>{const l=v(e);if(null===ue)return de(l),he(l),void ve({start:l,end:null});const[n,a]=m(l,ue)<0?[l,ue]:[ue,l];de(null),he(null),ve({start:n,end:a}),L&&xe(!1)},onPreviewChange:e=>{null!==ue&&he(e??ue)},minDate:R,maxDate:V,shouldDisableDate:E,showOutsideDays:!1,labels:ee};return e(c,{...$,size:U,color:W,readOnly:X,disabled:Y,triggerRef:_,startIcon:Z??e(o,{}),display:l("span",{className:"flex min-w-0 items-center gap-1.5",children:[l("span",{className:"flex min-w-0 flex-col",children:[e("span",{className:"truncate",children:we(se,G)}),e(u,{samples:y(je,G)})]}),e("span",{"aria-hidden":"true",className:"flex shrink-0 items-center text-(--neba-muted-fg) rtl:rotate-180",children:e(r,{})}),l("span",{className:"flex min-w-0 flex-col",children:[e("span",{className:"truncate",children:we(re,H)}),e(u,{samples:y(je,H)})]})]}),empty:null===se&&null===re,clearable:K,onClear:()=>ve(C),open:ce,onOpenChange:xe,labels:ee,hiddenValues:T?[{name:T,value:se?b(se):""},{name:T,value:re?b(re):""}]:void 0,children:l("div",{className:"flex flex-col gap-1.5",children:[l("div",{className:N("flex items-stretch",j[U]),children:[J&&J.length>0?e("div",{className:N("flex max-h-[calc(var(--n-cell,2rem)*8)] flex-col overflow-y-auto border-e pe-1.5","[border-color:var(--n-line)]"),children:J.map((l,n)=>e(a,{variant:"text",size:U,color:W,density:"compact",className:"justify-start whitespace-nowrap",onClick:()=>(e=>{const l="function"==typeof e.value?e.value():e.value;de(null),he(null),ve(l),f(l.start)&&fe(g(l.start)),L&&xe(!1)})(l),children:l.label},n))}):null,e(t,{...Ce,month:pe,onMonthChange:fe,showNextButton:!Ne,autoFocus:!0}),Ne?e(t,{...Ce,month:ye,onMonthChange:e=>fe(d(e,-1)),showPreviousButton:!1}):null]}),K||null!==Se?l(i,{size:U,children:[null!==Se?e("span",{className:N("me-auto text-(--neba-muted-fg)",S[U]),children:Se}):null,K?e(a,{variant:"text",size:U,color:W,density:"compact",onClick:()=>{de(null),he(null),ve(C),xe(!1)},children:ee.clear}):null]}):null]})})});
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as l from"react";import{Button as o}from"../button/Button.js";import{Calendar as n,TimeGrid as a,usePickerLabels as s}from"../../internal/calendar.js";import{CalendarIcon as i}from"../../internal/icons.js";import{PickerDivider as r,PickerFooter as c,PickerShell as d}from"../../internal/picker.js";import{displaySamples as m,formatDate as u,isDayOutside as h,isHour12 as p,isValidDate as f,localeWeekStart as S,mergeDateAndTime as b,startOfDay as y,startOfMonth as D,timeUnitSpan as g,toISODateTime as v,today as x,withPlaceholder as C,withTime as j}from"../../internal/date.js";import{cx as w,gapClasses as k}from"../../internal/styles.js";export const DateTimePicker=/*@__PURE__*/l.forwardRef(function({value:z,defaultValue:O,onValueChange:T,open:N,defaultOpen:V,onOpenChange:B,defaultMonth:I,minDate:M,maxDate:R,shouldDisableDate:E,shouldDisableTime:F,locale:P,weekStartsOn:q,format:A={dateStyle:"medium",timeStyle:"short"},hour12:G,showSeconds:H=!1,hourStep:J=1,minuteStep:K=1,secondStep:L=1,placeholder:Q,clearable:U=!1,showNowButton:W=!0,closeOnSelect:X=!1,labels:Y,name:Z,size:$="md",color:_="primary",density:ee="default",readOnly:te=!1,disabled:le=!1,startIcon:oe,...ne},ae){const se=s(Y),ie=q??S(P),re=G??p(P),[ce,de]=l.useState(O??null),me=void 0!==z?z:ce,[ue,he]=l.useState(V??!1),pe=N??ue,[fe,Se]=l.useState(()=>D(f(me)?me:I??x()));l.useEffect(()=>{pe&&Se(D(f(me)?me:I??x()))},[pe]);const be=e=>{e&&(te||le)||(void 0===N&&he(e),B?.(e))},ye=e=>{void 0===z&&de(e),T?.(e)},De=l.useCallback((e,t)=>{const[l,o]=g(t,e),n=y(e).getTime();return!!(f(M)&&n+1e3*o<M.getTime())||(!!(f(R)&&n+1e3*l>R.getTime())||(F?.(e,t)??!1))},[M,R,F]),ge=new Date,ve=j(ge,{seconds:H?ge.getSeconds():0}),xe=h(ve,M,R)||(E?.(ve)??!1)||De(ve,"second"),Ce=C(m(P,A),Q);return e(d,{...ne,size:$,color:_,density:ee,readOnly:te,disabled:le,triggerRef:ae,startIcon:oe??e(i,{}),display:f(me)?u(me,P,A):Q??"",samples:Ce,empty:!f(me),clearable:U,onClear:()=>ye(null),open:pe,onOpenChange:be,labels:se,hiddenValues:Z?[{name:Z,value:f(me)?v(me,H):""}]:void 0,children:t("div",{className:"flex flex-col gap-1.5",children:[t("div",{className:w("flex items-stretch",k[$]),children:[e(n,{size:$,color:_,locale:P,weekStartsOn:ie,month:fe,onMonthChange:Se,selected:[me],onSelect:e=>{const t=f(me)?b(e,me):y(e);ye(t),Se(D(t)),X&&be(!1)},minDate:M,maxDate:R,shouldDisableDate:E,labels:se,autoFocus:!0}),e(r,{}),e(a,{size:$,density:ee,locale:P,value:f(me)?me:null,referenceDate:f(me)?me:x(),onChange:ye,hour12:re,showSeconds:H,hourStep:J,minuteStep:K,secondStep:L,shouldDisableTime:De,labels:se})]}),t(c,{size:$,children:[U?e(o,{variant:"text",size:$,color:_,density:"compact",onClick:()=>{ye(null),be(!1)},children:se.clear}):null,W?e(o,{variant:"text",size:$,color:_,density:"compact",disabled:xe,onClick:()=>{ye(ve),Se(D(ve))},children:se.now}):null,e(o,{variant:"solid",size:$,color:_,density:"compact",onClick:()=>be(!1),children:se.done})]})]})})});
1
+ "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as l from"react";import{Button as n}from"../button/Button.js";import{Calendar as o,TimeGrid as a,usePickerLabels as s}from"../../internal/calendar.js";import{CalendarIcon as i}from"../../internal/icons.js";import{PickerDivider as r,PickerFooter as c,PickerShell as d}from"../../internal/picker.js";import{displaySamples as m,formatDate as u,isDayOutside as h,isHour12 as p,isValidDate as f,localeWeekStart as S,mergeDateAndTime as b,startOfDay as y,startOfMonth as D,timeUnitSpan as g,toISODateTime as v,today as x,withPlaceholder as C,withTime as j}from"../../internal/date.js";import{cx as w,gapClasses as k}from"../../internal/styles.js";export const DateTimePicker=/*@__PURE__*/l.forwardRef(function({value:z,defaultValue:O,onValueChange:T,open:N,defaultOpen:V,onOpenChange:B,defaultMonth:I,minDate:M,maxDate:R,shouldDisableDate:E,shouldDisableTime:F,locale:P,weekStartsOn:q,format:A={dateStyle:"medium",timeStyle:"short"},hour12:G,showSeconds:H=!1,hourStep:J=1,minuteStep:K=1,secondStep:L=1,placeholder:Q,clearable:U=!1,showNowButton:W=!0,closeOnSelect:X=!1,labels:Y,name:Z,size:$="md",color:_="primary",density:ee="default",readOnly:te=!1,disabled:le=!1,startIcon:ne,...oe},ae){const se=s(Y),ie=q??S(P),re=G??p(P),[ce,de]=l.useState(O??null),me=void 0!==z?z:ce,[ue,he]=l.useState(V??!1),pe=N??ue,[fe,Se]=l.useState(()=>D(f(me)?me:I??x()));l.useEffect(()=>{pe&&Se(D(f(me)?me:I??x()))},[pe]);const be=e=>{e&&(te||le)||(void 0===N&&he(e),B?.(e))},ye=e=>{void 0===z&&de(e),T?.(e)},De=l.useCallback((e,t)=>{const[l,n]=g(t,e),o=y(e).getTime();return!!(f(M)&&o+1e3*n<M.getTime())||(!!(f(R)&&o+1e3*l>R.getTime())||(F?.(e,t)??!1))},[M,R,F]),ge=new Date,ve=j(ge,{seconds:H?ge.getSeconds():0}),xe=h(ve,M,R)||(E?.(ve)??!1)||De(ve,"second"),Ce=C(m(P,A),Q);return e(d,{...oe,size:$,color:_,density:ee,readOnly:te,disabled:le,triggerRef:ae,startIcon:ne??e(i,{}),display:f(me)?u(me,P,A):Q??"",samples:Ce,empty:!f(me),clearable:U,onClear:()=>ye(null),open:pe,onOpenChange:be,labels:se,hiddenValues:Z?[{name:Z,value:f(me)?v(me,H):""}]:void 0,children:t("div",{className:"flex flex-col gap-1.5",children:[t("div",{className:w("flex items-stretch",k[$]),children:[e(o,{size:$,color:_,locale:P,weekStartsOn:ie,month:fe,onMonthChange:Se,selected:[me],onSelect:e=>{const t=f(me)?b(e,me):y(e);ye(t),Se(D(t)),X&&be(!1)},minDate:M,maxDate:R,shouldDisableDate:E,labels:se,autoFocus:!0}),e(r,{}),e(a,{size:$,density:ee,locale:P,value:f(me)?me:null,referenceDate:f(me)?me:x(),onChange:ye,hour12:re,showSeconds:H,hourStep:J,minuteStep:K,secondStep:L,shouldDisableTime:De,labels:se})]}),t(c,{size:$,children:[U?e(n,{variant:"text",size:$,color:_,density:"compact",onClick:()=>{ye(null),be(!1)},children:se.clear}):null,W?e(n,{variant:"text",size:$,color:_,density:"compact",disabled:xe,onClick:()=>{ye(ve),Se(D(ve))},children:se.now}):null,e(n,{variant:"solid",size:$,color:_,density:"compact",onClick:()=>be(!1),children:se.done})]})]})})});
@@ -1 +1 @@
1
- import{jsx as e,jsxs as a}from"react/jsx-runtime";import{Dialog as l}from"@base-ui/react/dialog";import{boxPaddingXClasses as n,boxPaddingYClasses as i}from"../box/Box.js";import{actionMessages as o,useMessages as r}from"../../internal/i18n.js";import{CloseIcon as t}from"../../internal/icons.js";import{hasContent as s,metaTextClasses as c,radiusClasses as d,sheetBodyClasses as m,sheetHeaderGapClasses as f,sheetSectionGapClasses as p,sheetTitleClasses as u,surfaceClasses as x,surfaceSlots as b}from"../../internal/styles.js";const h={xs:"max-w-80",sm:"max-w-96",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl"},g=[x,"relative flex w-full flex-col overflow-hidden","border text-(--neba-fg) bg-(--n-panel-press)","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]","[outline:none]","[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" "),v=["fixed inset-0 z-50 bg-(--neba-scrim)","[backdrop-filter:blur(2px)]","[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" "),y="border-t [border-color:var(--n-line)]";export const DialogClose=l.Close;export function Dialog({size:x="md",color:j="primary",density:w="default",open:$,defaultOpen:_,onOpenChange:N,trigger:k,title:C,description:z,actions:B,dividers:D=!1,showClose:O=!0,locale:P,closeLabel:T,width:W,fullWidth:L=!0,fullScreen:R=!1,modal:S=!0,dismissible:V=!0,className:q,style:A,children:E,...F}){const G=r(o,P),H=n[w][x],I=i[w][x],J=D?`${H} ${I}`:H,K=s(C)||s(z),M=s(B);return a(l.Root,{open:$,defaultOpen:_,modal:S,disablePointerDismissal:!V,onOpenChange:(e,a)=>{V||e||"escape-key"!==a.reason?N?.(e):a.cancel()},children:[k?e(l.Trigger,{render:k}):null,a(l.Portal,{children:[e(l.Backdrop,{className:`neba-portal ${v}`}),e(l.Viewport,{className:["neba-portal fixed inset-0 z-50 flex justify-center",R?"items-stretch":"items-center p-4"].join(" "),children:a(l.Popup,{className:[g,m[x],R?"h-full max-w-none rounded-none":`max-h-full ${d[x]} ${void 0===W?h[x]:""}`,R||L?"":"w-auto",D?"":`${I} ${p[x]}`,q??""].filter(Boolean).join(" "),style:{...b(j,3),...void 0===W?null:{maxWidth:"number"==typeof W?`${W}px`:W},...A},...F,children:[K||O?a("div",{className:`flex shrink-0 items-start gap-3 ${J}`,children:[a("div",{className:`flex min-w-0 flex-1 flex-col ${f[x]}`,children:[s(C)?e(l.Title,{className:`font-semibold ${u[x]} m-0`,children:C}):null,s(z)?e(l.Description,{className:`m-0 text-(--neba-muted-fg) ${c[x]}`,children:z}):null]}),O?e(l.Close,{"aria-label":T??G.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(t,{})}):null]}):null,s(E)?e("div",{className:["min-h-0 flex-1 overflow-y-auto overscroll-contain",J,D&&(K||O)?y:"",D?"":"py-1 -my-1"].filter(Boolean).join(" "),children:E}):null,M?e("div",{className:["flex shrink-0 flex-wrap items-center justify-end gap-2",J,D?y:""].filter(Boolean).join(" "),children:B}):null]})})]})]})}
1
+ "use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import{Dialog as l}from"@base-ui/react/dialog";import{boxPaddingXClasses as n,boxPaddingYClasses as i}from"../box/Box.js";import{actionMessages as o,useMessages as r}from"../../internal/i18n.js";import{CloseIcon as t}from"../../internal/icons.js";import{hasContent as s,metaTextClasses as c,radiusClasses as d,sheetBodyClasses as m,sheetHeaderGapClasses as f,sheetSectionGapClasses as u,sheetTitleClasses as p,surfaceClasses as x,surfaceSlots as b}from"../../internal/styles.js";const h={xs:"max-w-80",sm:"max-w-96",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl"},g=[x,"relative flex w-full flex-col overflow-hidden","border text-(--neba-fg) bg-(--n-panel-press)","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]","[outline:none]","[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" "),v=["fixed inset-0 z-50 bg-(--neba-scrim)","[backdrop-filter:blur(2px)]","[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" "),y="border-t [border-color:var(--n-line)]";export const DialogClose=l.Close;export function Dialog({size:x="md",color:j="primary",density:w="default",open:$,defaultOpen:_,onOpenChange:N,trigger:k,title:C,description:z,actions:B,dividers:D=!1,showClose:O=!0,locale:P,closeLabel:T,width:W,fullWidth:L=!0,fullScreen:R=!1,modal:S=!0,dismissible:V=!0,className:q,style:A,children:E,...F}){const G=r(o,P),H=n[w][x],I=i[w][x],J=D?`${H} ${I}`:H,K=s(C)||s(z),M=s(B);return a(l.Root,{open:$,defaultOpen:_,modal:S,disablePointerDismissal:!V,onOpenChange:(e,a)=>{V||e||"escape-key"!==a.reason?N?.(e):a.cancel()},children:[k?e(l.Trigger,{render:k}):null,a(l.Portal,{children:[e(l.Backdrop,{className:`neba-portal ${v}`}),e(l.Viewport,{className:["neba-portal fixed inset-0 z-50 flex justify-center",R?"items-stretch":"items-center p-4"].join(" "),children:a(l.Popup,{className:[g,m[x],R?"h-full max-w-none rounded-none":`max-h-full ${d[x]} ${void 0===W?h[x]:""}`,R||L?"":"w-auto",D?"":`${I} ${u[x]}`,q??""].filter(Boolean).join(" "),style:{...b(j,3),...void 0===W?null:{maxWidth:"number"==typeof W?`${W}px`:W},...A},...F,children:[K||O?a("div",{className:`flex shrink-0 items-start gap-3 ${J}`,children:[a("div",{className:`flex min-w-0 flex-1 flex-col ${f[x]}`,children:[s(C)?e(l.Title,{className:`font-semibold ${p[x]} m-0`,children:C}):null,s(z)?e(l.Description,{className:`m-0 text-(--neba-muted-fg) ${c[x]}`,children:z}):null]}),O?e(l.Close,{"aria-label":T??G.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(t,{})}):null]}):null,s(E)?e("div",{className:["min-h-0 flex-1 overflow-y-auto overscroll-contain",J,D&&(K||O)?y:"",D?"":"py-1 -my-1"].filter(Boolean).join(" "),children:E}):null,M?e("div",{className:["flex shrink-0 flex-wrap items-center justify-end gap-2",J,D?y:""].filter(Boolean).join(" "),children:B}):null]})})]})]})}