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 t}from"react/jsx-runtime";import*as o from"react";import{Toast as i}from"@base-ui/react/toast";import{boxPaddingClasses as n}from"../box/Box.js";import{actionMessages as s,useMessages as a}from"../../internal/i18n.js";import{CloseIcon as r,severityIcon as l}from"../../internal/icons.js";import{controlSlots as c,focusRingClasses as d,hasContent as m,iconClasses as p,metaTextClasses as u,radiusClasses as f,sheetBodyClasses as b,sheetHeaderGapClasses as x,sheetSectionGapClasses as v,sheetTitleClasses as h,surfaceClasses as y}from"../../internal/styles.js";const g={"top-start":"top-0 items-start","top-center":"top-0 items-center","top-end":"top-0 items-end","bottom-start":"bottom-0 items-start flex-col-reverse","bottom-center":"bottom-0 items-center flex-col-reverse","bottom-end":"bottom-0 items-end flex-col-reverse"},w={solid:[y,"text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--neba-shadow-3),var(--neba-plate-solid)]"].join(" "),outline:[y,"border text-(--neba-fg) bg-(--n-panel-press)","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]"].join(" "),text:[y,"text-(--neba-fg) bg-(--n-panel-press)","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]"].join(" ")},j={solid:"",outline:"text-(--n-accent)",text:"text-(--n-accent)"};function N(e){const{color:t,variant:o,icon:i,actionLabel:n,onAction:s,...a}=e;return{...a,data:{color:t,variant:o,icon:i},actionProps:void 0===n?void 0:{children:n,onClick:s}}}export function useToast(){const e=i.useToastManager();return o.useMemo(()=>({add:t=>e.add(N(t)),close:t=>e.close(t),update:(t,o)=>e.update(t,N(o)),promise:(t,o)=>e.promise(t,{loading:N(o.loading),success:e=>N("function"==typeof o.success?o.success(e):o.success),error:e=>N("function"==typeof o.error?o.error(e):o.error)}),toasts:e.toasts}),[e])}function _({toast:o,variant:s,color:a,size:y,density:g,closeLabel:N,swipeDirection:_}){const T=o.data?.variant??s??"outline",z=o.data?.color??a,$=void 0===o.data?.icon?l(z):o.data.icon,k=j[T],D=m(o.title);return t(i.Root,{toast:o,swipeDirection:_,className:["pointer-events-auto flex w-full items-start",n[g??"default"][y],f[y],v[y],b[y],w[T],p,"[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0","data-[limited]:hidden",d,"[outline:none]"].filter(Boolean).join(" "),style:c(z,3,T),children:[m($)?e("span",{className:`flex h-[1lh] shrink-0 items-center ${k}`,children:$}):null,t("div",{className:`flex min-w-0 flex-1 flex-col ${x[y]}`,children:[e(i.Title,{className:`neba-title font-semibold ${h[y]} ${k}`}),e(i.Description,{className:D?""+("solid"===T?"":"text-(--neba-muted-fg)"):""})]}),e(i.Action,{className:["flex h-[1lh] shrink-0 cursor-pointer items-center rounded-full px-2","font-medium underline-offset-2",k||"text-(--n-on-solid)","hover:underline","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2",u[y]].join(" ")}),e("span",{className:"flex h-[1lh] shrink-0 items-center",children:e(i.Close,{"aria-label":N,className:["inline-flex size-[1.15em] cursor-pointer items-center justify-center rounded-full","opacity-70 [transition:opacity_var(--neba-duration)_var(--neba-ease)]","hover:opacity-100 focus-visible:opacity-100","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"].join(" "),children:e(r,{})})})]})}function T(t){const{toasts:o}=i.useToastManager(),{position:n,width:s,...a}=t,r=[n.startsWith("top")?"up":"down","left","right"];return e(i.Portal,{children:e(i.Viewport,{className:["neba-portal pointer-events-none fixed inset-x-0 z-50 flex flex-col gap-2 p-4",g[n]].join(" "),children:o.map(t=>e("div",{className:"w-full",style:{maxWidth:"number"==typeof s?`${s}px`:s},children:e(_,{toast:t,swipeDirection:r,...a})},t.id))})})}export function ToastProvider({variant:o="outline",size:n="md",color:r="primary",density:l="default",position:c="bottom-end",timeout:d=5e3,limit:m=3,width:p=380,locale:u,closeLabel:f,children:b}){const x=a(s,u);return t(i.Provider,{timeout:d,limit:m,children:[b,e(T,{position:c,variant:o,size:n,color:r,density:l,width:p,closeLabel:f??x.close})]})}
1
+ "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{Toast as i}from"@base-ui/react/toast";import{boxPaddingClasses as n}from"../box/Box.js";import{actionMessages as s,useMessages as a}from"../../internal/i18n.js";import{CloseIcon as r,severityIcon as l}from"../../internal/icons.js";import{controlSlots as c,focusRingClasses as d,hasContent as m,iconClasses as p,metaTextClasses as u,radiusClasses as f,sheetBodyClasses as b,sheetHeaderGapClasses as x,sheetSectionGapClasses as v,sheetTitleClasses as h,surfaceClasses as y}from"../../internal/styles.js";const g={"top-start":"top-0 items-start","top-center":"top-0 items-center","top-end":"top-0 items-end","bottom-start":"bottom-0 items-start flex-col-reverse","bottom-center":"bottom-0 items-center flex-col-reverse","bottom-end":"bottom-0 items-end flex-col-reverse"},w={solid:[y,"text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--neba-shadow-3),var(--neba-plate-solid)]"].join(" "),outline:[y,"border text-(--neba-fg) bg-(--n-panel-press)","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]"].join(" "),text:[y,"text-(--neba-fg) bg-(--n-panel-press)","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]"].join(" ")},j={solid:"",outline:"text-(--n-accent)",text:"text-(--n-accent)"};function N(e){const{color:t,variant:o,icon:i,actionLabel:n,onAction:s,...a}=e;return{...a,data:{color:t,variant:o,icon:i},actionProps:void 0===n?void 0:{children:n,onClick:s}}}export function useToast(){const e=i.useToastManager();return o.useMemo(()=>({add:t=>e.add(N(t)),close:t=>e.close(t),update:(t,o)=>e.update(t,N(o)),promise:(t,o)=>e.promise(t,{loading:N(o.loading),success:e=>N("function"==typeof o.success?o.success(e):o.success),error:e=>N("function"==typeof o.error?o.error(e):o.error)}),toasts:e.toasts}),[e])}function _({toast:o,variant:s,color:a,size:y,density:g,closeLabel:N,swipeDirection:_}){const T=o.data?.variant??s??"outline",z=o.data?.color??a,$=void 0===o.data?.icon?l(z):o.data.icon,k=j[T],D=m(o.title);return t(i.Root,{toast:o,swipeDirection:_,className:["pointer-events-auto flex w-full items-start",n[g??"default"][y],f[y],v[y],b[y],w[T],p,"[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0","data-[limited]:hidden",d,"[outline:none]"].filter(Boolean).join(" "),style:c(z,3,T),children:[m($)?e("span",{className:`flex h-[1lh] shrink-0 items-center ${k}`,children:$}):null,t("div",{className:`flex min-w-0 flex-1 flex-col ${x[y]}`,children:[e(i.Title,{className:`neba-title font-semibold ${h[y]} ${k}`}),e(i.Description,{className:D?""+("solid"===T?"":"text-(--neba-muted-fg)"):""})]}),e(i.Action,{className:["flex h-[1lh] shrink-0 cursor-pointer items-center rounded-full px-2","font-medium underline-offset-2",k||"text-(--n-on-solid)","hover:underline","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2",u[y]].join(" ")}),e("span",{className:"flex h-[1lh] shrink-0 items-center",children:e(i.Close,{"aria-label":N,className:["inline-flex size-[1.15em] cursor-pointer items-center justify-center rounded-full","opacity-70 [transition:opacity_var(--neba-duration)_var(--neba-ease)]","hover:opacity-100 focus-visible:opacity-100","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"].join(" "),children:e(r,{})})})]})}function T(t){const{toasts:o}=i.useToastManager(),{position:n,width:s,...a}=t,r=[n.startsWith("top")?"up":"down","left","right"];return e(i.Portal,{children:e(i.Viewport,{className:["neba-portal pointer-events-none fixed inset-x-0 z-50 flex flex-col gap-2 p-4",g[n]].join(" "),children:o.map(t=>e("div",{className:"w-full",style:{maxWidth:"number"==typeof s?`${s}px`:s},children:e(_,{toast:t,swipeDirection:r,...a})},t.id))})})}export function ToastProvider({variant:o="outline",size:n="md",color:r="primary",density:l="default",position:c="bottom-end",timeout:d=5e3,limit:m=3,width:p=380,locale:u,closeLabel:f,children:b}){const x=a(s,u);return t(i.Provider,{timeout:d,limit:m,children:[b,e(T,{position:c,variant:o,size:n,color:r,density:l,width:p,closeLabel:f??x.close})]})}
@@ -1 +1 @@
1
- import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import*as o from"react";import{useRender as n}from"@base-ui/react/use-render";import{boxPaddingXClasses as i,boxPaddingYClasses as a}from"../box/Box.js";import{hasContent as s,radiusClasses as l,sheetSectionGapClasses as d,surfaceClasses as m,surfaceSlots as c,transitionClasses as b}from"../../internal/styles.js";const p={solid:[m,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[m,"border text-(--neba-fg) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--neba-fg) bg-transparent"},f={static:{top:"",bottom:""},sticky:{top:"sticky top-0 z-20",bottom:"sticky bottom-0 z-20"},fixed:{top:"fixed inset-x-0 top-0 z-30",bottom:"fixed inset-x-0 bottom-0 z-30"}},x={top:"border-b [border-color:var(--n-line)]",bottom:"border-t [border-color:var(--n-line)]"};export const Toolbar=/*@__PURE__*/o.forwardRef(function({variant:o="outline",size:m="md",color:v="primary",density:g="default",elevation:h=0,position:u="static",side:j="top",divider:w=!1,start:y,end:k,render:z,className:N,style:B,children:F,...R},T){const q=["flex w-full min-w-0 items-center",i[g][m],a[g][m],d[m],"static"===u?l[m]:"",p[o],w?x[j]:"",f[u][j],b,N??""].filter(Boolean).join(" ");return n({render:z,ref:T,props:{className:q,style:{...c(v,h),...B},children:r(t,{children:[s(y)?e("div",{className:"flex min-w-0 shrink-0 items-center gap-2",children:y}):null,e("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:F}),s(k)?e("div",{className:"flex min-w-0 shrink-0 items-center gap-2",children:k}):null]}),...R}})});
1
+ "use client";import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import*as o from"react";import{useRender as n}from"@base-ui/react/use-render";import{boxPaddingXClasses as i,boxPaddingYClasses as s}from"../box/Box.js";import{hasContent as a,radiusClasses as l,sheetSectionGapClasses as c,surfaceClasses as d,surfaceSlots as m,transitionClasses as b}from"../../internal/styles.js";const p={solid:[d,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[d,"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"},f={static:{top:"",bottom:""},sticky:{top:"sticky top-0 z-20",bottom:"sticky bottom-0 z-20"},fixed:{top:"fixed inset-x-0 top-0 z-30",bottom:"fixed inset-x-0 bottom-0 z-30"}},x={top:"border-b [border-color:var(--n-line)]",bottom:"border-t [border-color:var(--n-line)]"};export const Toolbar=/*@__PURE__*/o.forwardRef(function({variant:o="outline",size:d="md",color:v="primary",density:u="default",elevation:g=0,position:h="static",side:j="top",divider:w=!1,start:y,end:k,render:z,className:N,style:B,children:F,...R},T){const q=["flex w-full min-w-0 items-center",i[u][d],s[u][d],c[d],"static"===h?l[d]:"",p[o],w?x[j]:"",f[h][j],b,N??""].filter(Boolean).join(" ");return n({render:z,ref:T,props:{className:q,style:{...m(v,g),...B},children:r(t,{children:[a(y)?e("div",{className:"flex min-w-0 shrink-0 items-center gap-2",children:y}):null,e("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:F}),a(k)?e("div",{className:"flex min-w-0 shrink-0 items-center gap-2",children:k}):null]}),...R}})});
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{Tooltip as o}from"@base-ui/react/tooltip";import{controlSlots as i,metaTextClasses as s,paddingXClasses as n,radiusClasses as l,surfaceClasses as r}from"../../internal/styles.js";export const TooltipProvider=o.Provider;const d=[r,"max-w-64 text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--neba-shadow-3),var(--neba-plate-solid)]","[outline:none]","[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0","data-[instant]:[transition-duration:0ms]"].join(" "),p={xs:"py-0.5",sm:"py-0.5",md:"py-1",lg:"py-1.5",xl:"py-2"},c={xs:6,sm:7,md:8,lg:9,xl:10};export function Tooltip({content:r,children:m,size:h="sm",color:y="secondary",density:f="default",side:x="top",align:b="center",sideOffset:g=6,delay:u,closeDelay:v,arrow:j=!0,open:w,defaultOpen:O,onOpenChange:N,disabled:P=!1,className:T,style:z,...B}){const C=c[h],D=a.useId(),[_,k]=a.useState(O??!1),A=w??_;return t(o.Root,{open:w,defaultOpen:O,onOpenChange:e=>{k(e),N?.(e)},children:[e(o.Trigger,{render:m,delay:u,closeDelay:v,disabled:P,"aria-describedby":A?D:void 0}),e(o.Portal,{children:e(o.Positioner,{className:"neba-portal z-50 [outline:none]",side:x,align:b,sideOffset:g,children:t(o.Popup,{id:D,role:"tooltip",className:[d,l[h],n[f][h],p[h],s[h],T??""].filter(Boolean).join(" "),style:{...i(y,3,"solid"),...z},...B,children:[j?e(o.Arrow,{className:["data-[side=top]:bottom-[-1px]","data-[side=bottom]:top-[-1px] data-[side=bottom]:rotate-180","data-[side=left]:right-[-1px] data-[side=left]:-rotate-90","data-[side=right]:left-[-1px] data-[side=right]:rotate-90"].join(" "),children:e("svg",{width:C,height:C/2,viewBox:"0 0 10 5","aria-hidden":"true",className:"block",children:e("path",{d:"M0 0h10L5 5z",fill:"var(--n-fill)"})})}):null,r]})})})]})}
1
+ "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{Tooltip as o}from"@base-ui/react/tooltip";import{controlSlots as i,metaTextClasses as s,paddingXClasses as n,radiusClasses as l,surfaceClasses as r}from"../../internal/styles.js";export const TooltipProvider=o.Provider;const d=[r,"max-w-64 text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--neba-shadow-3),var(--neba-plate-solid)]","[outline:none]","[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0","data-[instant]:[transition-duration:0ms]"].join(" "),p={xs:"py-0.5",sm:"py-0.5",md:"py-1",lg:"py-1.5",xl:"py-2"},c={xs:6,sm:7,md:8,lg:9,xl:10};export function Tooltip({content:r,children:m,size:h="sm",color:y="secondary",density:f="default",side:u="top",align:x="center",sideOffset:b=6,delay:g,closeDelay:v,arrow:j=!0,open:w,defaultOpen:O,onOpenChange:N,disabled:P=!1,className:T,style:z,...B}){const C=c[h],D=a.useId(),[_,k]=a.useState(O??!1),A=w??_;return t(o.Root,{open:w,defaultOpen:O,onOpenChange:e=>{k(e),N?.(e)},children:[e(o.Trigger,{render:m,delay:g,closeDelay:v,disabled:P,"aria-describedby":A?D:void 0}),e(o.Portal,{children:e(o.Positioner,{className:"neba-portal z-50 [outline:none]",side:u,align:x,sideOffset:b,children:t(o.Popup,{id:D,role:"tooltip",className:[d,l[h],n[f][h],p[h],s[h],T??""].filter(Boolean).join(" "),style:{...i(y,3,"solid"),...z},...B,children:[j?e(o.Arrow,{className:["data-[side=top]:bottom-[-1px]","data-[side=bottom]:top-[-1px] data-[side=bottom]:rotate-180","data-[side=left]:right-[-1px] data-[side=left]:-rotate-90","data-[side=right]:left-[-1px] data-[side=right]:rotate-90"].join(" "),children:e("svg",{width:C,height:C/2,viewBox:"0 0 10 5","aria-hidden":"true",className:"block",children:e("path",{d:"M0 0h10L5 5z",fill:"var(--n-fill)"})})}):null,r]})})})]})}
@@ -1 +1 @@
1
- import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import*as n from"react";import{ChevronIcon as a}from"../../internal/icons.js";import{controlTextClasses as l,cx as s,gapClasses as o,hasContent as i,iconClasses as c,radiusClasses as d,surfaceClasses as u,surfaceSlots as m,transitionClasses as f}from"../../internal/styles.js";const p=/*@__PURE__*/n.createContext({size:"md",density:"default",disabled:!1,expandedKeys:new Set,selectedKeys:new Set,activeKey:null,toggle:()=>{},select:()=>{},activate:()=>{},register:()=>()=>{}}),x={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"},b={xs:"0.875rem",sm:"1rem",md:"1.25rem",lg:"1.5rem",xl:"1.75rem"},g={xs:"1.375rem",sm:"1.625rem",md:"2rem",lg:"2.5rem",xl:"3rem"},h={default:{xs:"px-1.5",sm:"px-2",md:"px-2.5",lg:"px-3",xl:"px-3.5"},compact:{xs:"px-1",sm:"px-1",md:"px-1.5",lg:"px-2",xl:"px-2.5"}},v={xs:"rounded-[0.3125rem]",sm:"rounded-[0.375rem]",md:"rounded-[0.5rem]",lg:"rounded-[0.625rem]",xl:"rounded-[0.75rem]"},w={none:"",simple:"neba-tree-simple",folder:"neba-tree-folder"};function y(e){return Array.from(e.querySelectorAll('[role="treeitem"]'))}const k=e=>String(e);export const TreeView=/*@__PURE__*/n.forwardRef(function({variant:t="outline",size:r="md",color:a="primary",density:l="default",elevation:o=0,lines:i="simple",expanded:c,defaultExpanded:u,onExpandedChange:h,selected:v,defaultSelected:C,onSelectedChange:N,multiple:S=!1,disabled:K=!1,label:j,className:A,style:D,children:R,onKeyDown:E,...I},P){const[V,z]=n.useState(u??[]),[_,L]=n.useState(C??[]),[M,T]=n.useState(null),q=c??V,F=v??_,H=n.useRef(null),O=n.useCallback(e=>{H.current=e,"function"==typeof P?P(e):P&&(P.current=e)},[P]),U=n.useCallback(e=>{const t=k(e),r=c??V,n=r.some(e=>k(e)===t)?r.filter(e=>k(e)!==t):[...r,e];void 0===c&&z(n),h?.(n)},[c,V,h]),B=n.useCallback(e=>{const t=k(e),r=v??_,n=r.some(e=>k(e)===t),a=S?n?r.filter(e=>k(e)!==t):[...r,e]:[e];void 0===v&&L(a),N?.(a)},[S,v,_,N]),G=n.useRef(new Map),J=n.useCallback((e,t)=>(G.current.set(e,t),()=>{G.current.delete(e)}),[]),Q=q.map(k).join("\0"),W=F.map(k).join("\0"),X=n.useMemo(()=>({size:r,density:l,disabled:K,expandedKeys:new Set(q.map(k)),selectedKeys:new Set(F.map(k)),activeKey:M,toggle:U,select:B,activate:T,register:J}),[r,l,K,Q,W,M,U,B,J]);n.useEffect(()=>{const e=H.current;if(!e)return;const t=y(e);0!==t.length&&(null!==M&&t.some(e=>e.dataset.nebaValue===M)||T(t[0].dataset.nebaValue??null))});const Y=s("flex list-none flex-col p-1",d[r],x[t],f,w[i],A);return e(p.Provider,{value:X,children:e("ul",{ref:O,role:"tree","aria-label":j,"aria-multiselectable":S||void 0,className:Y,style:{...m(a,o),"--n-tree-indent":b[r],"--n-tree-row":g[r],...D},onKeyDown:function(e){if(E?.(e),e.defaultPrevented)return;const t=H.current,r=e.target?.closest?.('[role="treeitem"]');if(!t||!r||!t.contains(r))return;const n=y(t),a=n.indexOf(r);if(-1===a)return;const l=t=>{t&&(e.preventDefault(),T(t.dataset.nebaValue??null),t.focus())},s=e=>{const t=e.dataset.nebaValue;t&&G.current.get(t)?.toggle()},o="rtl"===getComputedStyle(t).direction,i=o?"ArrowLeft":"ArrowRight",c=o?"ArrowRight":"ArrowLeft",d=r.getAttribute("aria-expanded");switch(e.key){case"ArrowDown":l(n[a+1]);break;case"ArrowUp":l(n[a-1]);break;case"Home":l(n[0]);break;case"End":l(n[n.length-1]);break;case i:"false"===d?(e.preventDefault(),s(r)):"true"===d&&l(n[a+1]);break;case c:"true"===d?(e.preventDefault(),s(r)):l(r.parentElement?.closest('[role="treeitem"]'));break;case"Enter":case" ":e.preventDefault(),r.click()}},...I,children:R})})});export const TreeItem=/*@__PURE__*/n.forwardRef(function({value:d,label:u,startIcon:m,endIcon:x,action:b,href:g,expandable:w,disabled:y=!1,className:C,children:N,onClick:S,...K},j){const{size:A,density:D,disabled:R,expandedKeys:E,selectedKeys:I,activeKey:P,toggle:V,select:z,activate:_,register:L}=n.useContext(p),M=n.useId(),T=d??M,q=k(T),F=n.useRef(null),H=n.useCallback(e=>{F.current=e,"function"==typeof j?j(e):j&&(j.current=e)},[j]),O=n.Children.toArray(N),U=w??O.length>0,B=U&&E.has(q),G=I.has(q),J=y||R,Q=n.useRef({toggle:()=>{}});Q.current.toggle=()=>{!J&&U&&V(T)},n.useEffect(()=>L(q,Q.current),[q,L]);const W=s("flex min-w-0 flex-1 cursor-pointer items-center text-start","h-(--n-tree-row)",h[D][A],v[A],o[A],l[A],f,c,"group-focus-visible/tree-item:[outline:2px_solid_var(--n-ring)]","group-focus-visible/tree-item:outline-offset-[-2px]",J?"cursor-not-allowed text-(--neba-disabled-fg)":G?"bg-(--n-soft-press) font-medium text-(--n-accent) hover:bg-(--n-soft-press)":"hover:bg-(--n-soft)"),X=r(t,{children:[e("span",{"aria-hidden":"true",onClick:e=>{!J&&U&&(e.stopPropagation(),e.preventDefault(),F.current?.focus(),_(q),V(T))},className:s("flex h-[1lh] w-[1.15em] shrink-0 items-center justify-center","[transition:rotate_var(--neba-duration)_var(--neba-ease)]",U?"text-(--neba-muted-fg)":"",B?"rotate-0":"-rotate-90 rtl:rotate-90"),children:U?e(a,{}):null}),i(m)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:m}):null,e("span",{className:"min-w-0 flex-1 truncate",children:u}),i(x)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:x}):null]});return r("li",{ref:H,role:"treeitem","aria-expanded":U?B:void 0,"aria-selected":!!G||void 0,"aria-disabled":J||void 0,"data-neba-value":q,tabIndex:P===q?0:-1,className:s("group/tree-item relative block [outline:none]",C),onClick:function(e){e.stopPropagation(),J?e.preventDefault():(F.current?.focus(),_(q),S?.(e),e.defaultPrevented||(U&&V(T),z(T)))},...K,children:[r("div",{className:"flex w-full items-center",children:[g&&!J?e("a",{href:g,tabIndex:-1,className:W,"aria-current":G?"page":void 0,children:X}):e("div",{className:W,children:X}),i(b)?e("span",{className:s("flex shrink-0 items-center",h[D][A]),onClick:e=>e.stopPropagation(),children:b}):null]}),U&&B&&O.length>0?e("ul",{role:"group",className:"list-none ps-(--n-tree-indent)",children:N}):null]})});
1
+ "use client";import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import*as n from"react";import{ChevronIcon as a}from"../../internal/icons.js";import{controlTextClasses as l,cx as s,gapClasses as o,hasContent as i,iconClasses as c,radiusClasses as d,surfaceClasses as u,surfaceSlots as m,transitionClasses as f}from"../../internal/styles.js";const p=/*@__PURE__*/n.createContext({size:"md",density:"default",disabled:!1,expandedKeys:new Set,selectedKeys:new Set,activeKey:null,toggle:()=>{},select:()=>{},activate:()=>{},register:()=>()=>{}}),x={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"},b={xs:"0.875rem",sm:"1rem",md:"1.25rem",lg:"1.5rem",xl:"1.75rem"},g={xs:"1.375rem",sm:"1.625rem",md:"2rem",lg:"2.5rem",xl:"3rem"},h={default:{xs:"px-1.5",sm:"px-2",md:"px-2.5",lg:"px-3",xl:"px-3.5"},compact:{xs:"px-1",sm:"px-1",md:"px-1.5",lg:"px-2",xl:"px-2.5"}},v={xs:"rounded-[0.3125rem]",sm:"rounded-[0.375rem]",md:"rounded-[0.5rem]",lg:"rounded-[0.625rem]",xl:"rounded-[0.75rem]"},w={none:"",simple:"neba-tree-simple",folder:"neba-tree-folder"};function y(e){return Array.from(e.querySelectorAll('[role="treeitem"]'))}const k=e=>String(e);export const TreeView=/*@__PURE__*/n.forwardRef(function({variant:t="outline",size:r="md",color:a="primary",density:l="default",elevation:o=0,lines:i="simple",expanded:c,defaultExpanded:u,onExpandedChange:h,selected:v,defaultSelected:C,onSelectedChange:N,multiple:S=!1,disabled:K=!1,label:j,className:A,style:D,children:R,onKeyDown:E,...I},P){const[V,z]=n.useState(u??[]),[_,L]=n.useState(C??[]),[M,T]=n.useState(null),q=c??V,F=v??_,H=n.useRef(null),O=n.useCallback(e=>{H.current=e,"function"==typeof P?P(e):P&&(P.current=e)},[P]),U=n.useCallback(e=>{const t=k(e),r=c??V,n=r.some(e=>k(e)===t)?r.filter(e=>k(e)!==t):[...r,e];void 0===c&&z(n),h?.(n)},[c,V,h]),B=n.useCallback(e=>{const t=k(e),r=v??_,n=r.some(e=>k(e)===t),a=S?n?r.filter(e=>k(e)!==t):[...r,e]:[e];void 0===v&&L(a),N?.(a)},[S,v,_,N]),G=n.useRef(new Map),J=n.useCallback((e,t)=>(G.current.set(e,t),()=>{G.current.delete(e)}),[]),Q=q.map(k).join("\0"),W=F.map(k).join("\0"),X=n.useMemo(()=>({size:r,density:l,disabled:K,expandedKeys:new Set(q.map(k)),selectedKeys:new Set(F.map(k)),activeKey:M,toggle:U,select:B,activate:T,register:J}),[r,l,K,Q,W,M,U,B,J]);n.useEffect(()=>{const e=H.current;if(!e)return;const t=y(e);0!==t.length&&(null!==M&&t.some(e=>e.dataset.nebaValue===M)||T(t[0].dataset.nebaValue??null))});const Y=s("flex list-none flex-col p-1",d[r],x[t],f,w[i],A);return e(p.Provider,{value:X,children:e("ul",{ref:O,role:"tree","aria-label":j,"aria-multiselectable":S||void 0,className:Y,style:{...m(a,o),"--n-tree-indent":b[r],"--n-tree-row":g[r],...D},onKeyDown:function(e){if(E?.(e),e.defaultPrevented)return;const t=H.current,r=e.target?.closest?.('[role="treeitem"]');if(!t||!r||!t.contains(r))return;const n=y(t),a=n.indexOf(r);if(-1===a)return;const l=t=>{t&&(e.preventDefault(),T(t.dataset.nebaValue??null),t.focus())},s=e=>{const t=e.dataset.nebaValue;t&&G.current.get(t)?.toggle()},o="rtl"===getComputedStyle(t).direction,i=o?"ArrowLeft":"ArrowRight",c=o?"ArrowRight":"ArrowLeft",d=r.getAttribute("aria-expanded");switch(e.key){case"ArrowDown":l(n[a+1]);break;case"ArrowUp":l(n[a-1]);break;case"Home":l(n[0]);break;case"End":l(n[n.length-1]);break;case i:"false"===d?(e.preventDefault(),s(r)):"true"===d&&l(n[a+1]);break;case c:"true"===d?(e.preventDefault(),s(r)):l(r.parentElement?.closest('[role="treeitem"]'));break;case"Enter":case" ":e.preventDefault(),r.click()}},...I,children:R})})});export const TreeItem=/*@__PURE__*/n.forwardRef(function({value:d,label:u,startIcon:m,endIcon:x,action:b,href:g,expandable:w,disabled:y=!1,className:C,children:N,onClick:S,...K},j){const{size:A,density:D,disabled:R,expandedKeys:E,selectedKeys:I,activeKey:P,toggle:V,select:z,activate:_,register:L}=n.useContext(p),M=n.useId(),T=d??M,q=k(T),F=n.useRef(null),H=n.useCallback(e=>{F.current=e,"function"==typeof j?j(e):j&&(j.current=e)},[j]),O=n.Children.toArray(N),U=w??O.length>0,B=U&&E.has(q),G=I.has(q),J=y||R,Q=n.useRef({toggle:()=>{}});Q.current.toggle=()=>{!J&&U&&V(T)},n.useEffect(()=>L(q,Q.current),[q,L]);const W=s("flex min-w-0 flex-1 cursor-pointer items-center text-start","h-(--n-tree-row)",h[D][A],v[A],o[A],l[A],f,c,"group-focus-visible/tree-item:[outline:2px_solid_var(--n-ring)]","group-focus-visible/tree-item:outline-offset-[-2px]",J?"cursor-not-allowed text-(--neba-disabled-fg)":G?"bg-(--n-soft-press) font-medium text-(--n-accent) hover:bg-(--n-soft-press)":"hover:bg-(--n-soft)"),X=r(t,{children:[e("span",{"aria-hidden":"true",onClick:e=>{!J&&U&&(e.stopPropagation(),e.preventDefault(),F.current?.focus(),_(q),V(T))},className:s("flex h-[1lh] w-[1.15em] shrink-0 items-center justify-center","[transition:rotate_var(--neba-duration)_var(--neba-ease)]",U?"text-(--neba-muted-fg)":"",B?"rotate-0":"-rotate-90 rtl:rotate-90"),children:U?e(a,{}):null}),i(m)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:m}):null,e("span",{className:"min-w-0 flex-1 truncate",children:u}),i(x)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:x}):null]});return r("li",{ref:H,role:"treeitem","aria-expanded":U?B:void 0,"aria-selected":!!G||void 0,"aria-disabled":J||void 0,"data-neba-value":q,tabIndex:P===q?0:-1,className:s("group/tree-item relative block [outline:none]",C),onClick:function(e){e.stopPropagation(),J?e.preventDefault():(F.current?.focus(),_(q),S?.(e),e.defaultPrevented||(U&&V(T),z(T)))},...K,children:[r("div",{className:"flex w-full items-center",children:[g&&!J?e("a",{href:g,tabIndex:-1,className:W,"aria-current":G?"page":void 0,children:X}):e("div",{className:W,children:X}),i(b)?e("span",{className:s("flex shrink-0 items-center",h[D][A]),onClick:e=>e.stopPropagation(),children:b}):null]}),U&&B&&O.length>0?e("ul",{role:"group",className:"list-none ps-(--n-tree-indent)",children:N}):null]})});
@@ -1 +1 @@
1
- import*as e from"react";import{useRender as t}from"@base-ui/react/use-render";import{transitionProps as r}from"../../internal/animate.js";const m={h1:"text-[1.875rem]/[2.25rem] tracking-[-0.02em]",h2:"text-[1.5rem]/[1.875rem] tracking-[-0.015em]",h3:"text-[1.25rem]/[1.625rem] tracking-[-0.01em]",h4:"text-[1.0625rem]/[1.5rem]",h5:"text-[0.9375rem]/[1.375rem]",h6:"text-[0.8125rem]/[1.25rem]",lead:"text-[1.0625rem]/[1.75rem]",body:"text-[0.8125rem]/[1.375rem]",caption:"text-[0.75rem]/[1.125rem]",overline:"text-[0.6875rem]/[1rem] tracking-[0.08em] uppercase"},n={h1:"semibold",h2:"semibold",h3:"semibold",h4:"semibold",h5:"semibold",h6:"semibold",lead:"regular",body:"regular",caption:"regular",overline:"medium"},a={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",lead:"p",body:"p",caption:"span",overline:"span"},l=new Set(["caption","overline"]),o={h1:"mb-4",h2:"mb-3.5",h3:"mb-3",h4:"mb-2.5",h5:"mb-2",h6:"mb-2",lead:"mb-4",body:"mb-3",caption:"mb-2",overline:"mb-2"},i={regular:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},c={start:"text-start",center:"text-center",end:"text-end",justify:"text-justify"},s={1:"truncate",2:"line-clamp-2",3:"line-clamp-3",4:"line-clamp-4",5:"line-clamp-5",6:"line-clamp-6"};export const Typography=/*@__PURE__*/e.forwardRef(function({level:h="body",color:d,weight:b,align:p,lines:x,gutter:u=!1,transition:f,render:g,className:y,style:v,children:j,...k},w){const N=r(f),B=[m[h],i[b??n[h]],p?c[p]:"",x?s[x]??"line-clamp-6":"",u?o[h]:"",d?"text-(--n-accent)":l.has(h)?"text-(--neba-muted-fg)":"text-(--neba-fg)",N.className,y??""].filter(Boolean).join(" ");return t({render:g??e.createElement(a[h]),ref:w,props:{className:B,style:d?{"--n-accent":`var(--neba-${d}-accent)`,...N.style,...v}:{...N.style,...v},children:j,...k}})});
1
+ "use client";import*as e from"react";import{useRender as t}from"@base-ui/react/use-render";import{transitionProps as r}from"../../internal/animate.js";const m={h1:"text-[1.875rem]/[2.25rem] tracking-[-0.02em]",h2:"text-[1.5rem]/[1.875rem] tracking-[-0.015em]",h3:"text-[1.25rem]/[1.625rem] tracking-[-0.01em]",h4:"text-[1.0625rem]/[1.5rem]",h5:"text-[0.9375rem]/[1.375rem]",h6:"text-[0.8125rem]/[1.25rem]",lead:"text-[1.0625rem]/[1.75rem]",body:"text-[0.8125rem]/[1.375rem]",caption:"text-[0.75rem]/[1.125rem]",overline:"text-[0.6875rem]/[1rem] tracking-[0.08em] uppercase"},n={h1:"semibold",h2:"semibold",h3:"semibold",h4:"semibold",h5:"semibold",h6:"semibold",lead:"regular",body:"regular",caption:"regular",overline:"medium"},a={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",lead:"p",body:"p",caption:"span",overline:"span"},l=new Set(["caption","overline"]),i={h1:"mb-4",h2:"mb-3.5",h3:"mb-3",h4:"mb-2.5",h5:"mb-2",h6:"mb-2",lead:"mb-4",body:"mb-3",caption:"mb-2",overline:"mb-2"},o={regular:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},c={start:"text-start",center:"text-center",end:"text-end",justify:"text-justify"},s={1:"truncate",2:"line-clamp-2",3:"line-clamp-3",4:"line-clamp-4",5:"line-clamp-5",6:"line-clamp-6"};export const Typography=/*@__PURE__*/e.forwardRef(function({level:h="body",color:d,weight:b,align:p,lines:u,gutter:x=!1,transition:f,render:g,className:y,style:v,children:j,...k},w){const N=r(f),B=[m[h],o[b??n[h]],p?c[p]:"",u?s[u]??"line-clamp-6":"",x?i[h]:"",d?"text-(--n-accent)":l.has(h)?"text-(--neba-muted-fg)":"text-(--neba-fg)",N.className,y??""].filter(Boolean).join(" ");return t({render:g??e.createElement(a[h]),ref:w,props:{className:B,style:d?{"--n-accent":`var(--neba-${d}-accent)`,...N.style,...v}:{...N.style,...v},children:j,...k}})});
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as i from"react";import{useRender as r}from"@base-ui/react/use-render";import{actionMessages as o,useMessages as s,windowMessages as a}from"../../internal/i18n.js";import{cx as l,hasContent as d,iconClasses as c,surfaceClasses as u}from"../../internal/styles.js";import{WindowControls as m,orderControls as h,windowChrome as g,windowMetrics as w,windowSlots as f}from"../../internal/window.js";function p(e,t,n){const[r,o]=i.useState(t),s=void 0!==e;return[s?e:r,i.useCallback(e=>{s||o(e),n?.(e)},[s,n])]}const b=[{edge:"n",className:"inset-x-3 top-0 h-1.5 cursor-ns-resize"},{edge:"s",className:"inset-x-3 bottom-0 h-1.5 cursor-ns-resize"},{edge:"w",className:"inset-y-3 left-0 w-1.5 cursor-ew-resize"},{edge:"e",className:"inset-y-3 right-0 w-1.5 cursor-ew-resize"},{edge:"nw",className:"top-0 left-0 size-3 cursor-nwse-resize"},{edge:"ne",className:"top-0 right-0 size-3 cursor-nesw-resize"},{edge:"sw",className:"bottom-0 left-0 size-3 cursor-nesw-resize"},{edge:"se",className:"right-0 bottom-0 size-3 cursor-nwse-resize"}];export const WindowPane=/*@__PURE__*/i.forwardRef(function({os:v="macos",title:x,icon:y,actions:z,controls:E=!0,size:N="md",color:k="primary",accent:C=!1,transparency:L=0,active:M,elevation:S=2,position:P="static",draggable:R=!1,resizable:I=!1,width:j,height:B,minWidth:D=180,minHeight:A,offset:T,defaultOffset:H,onOffsetChange:W,onResize:O,open:X,defaultOpen:$=!0,onOpenChange:F,minimized:Y,defaultMinimized:_=!1,onMinimizedChange:q,maximized:K,defaultMaximized:U=!1,onMaximizedChange:V,scroll:G=!0,locale:J,minimizeLabel:Q,maximizeLabel:Z,restoreLabel:ee,closeLabel:te,resizeLabel:ne,render:ie,className:re,style:oe,children:se,...ae},le){const de=s(a,J),ce=s(o,J),ue=g(v),me=w(v,N),he=i.useId(),[ge,we]=p(X,$,F),[fe,pe]=p(Y,_,q),[be,ve]=p(K,U,V),[xe,ye]=p(T,H??{x:0,y:0},W),[ze,Ee]=i.useState(null),[Ne,ke]=i.useState(!0),Ce=M??Ne,[Le,Me]=i.useState(null),[Se,Pe]=i.useState(null),[Re,Ie]=i.useState(!1),[je,Be]=i.useState(!1),[De,Ae]=i.useState(ge);De!==ge&&(Ae(ge),Be(!ge)),i.useEffect(()=>{if(!je)return;const e=window.setTimeout(()=>Be(!1),260);return()=>window.clearTimeout(e)},[je]);const Te=i.useRef(null),He=i.useCallback(e=>{Te.current=e,"function"==typeof le?le(e):le&&(le.current=e)},[le]);i.useEffect(()=>{if(void 0!==M)return;const e=Te.current;if(!e)return;const t=t=>{const n=t.target;if(!(n instanceof Node))return;if(e.contains(n))return void ke(!0);const i=n instanceof Element?n:n.parentElement;i?.closest(".neba-window")&&ke(!1)};return document.addEventListener("pointerdown",t,!0),document.addEventListener("focusin",t,!0),()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("focusin",t,!0)}},[M]);const We=i.useRef(null);function Oe(e,t){if(0!==e.button)return;We.current?.();const n=e.currentTarget;n.setPointerCapture(e.pointerId),n.dataset.dragging="true",Ie(!0);const i=e.clientX,r=e.clientY,o=document.body.style.getPropertyValue("-webkit-user-select");document.body.style.setProperty("-webkit-user-select","none");const s=e=>{t(e.clientX-i,e.clientY-r)},a=()=>{We.current=null,Ie(!1),n.removeEventListener("pointermove",s),n.removeEventListener("pointerup",a),n.removeEventListener("pointercancel",a),delete n.dataset.dragging,o?document.body.style.setProperty("-webkit-user-select",o):document.body.style.removeProperty("-webkit-user-select")};We.current=a,n.addEventListener("pointermove",s),n.addEventListener("pointerup",a),n.addEventListener("pointercancel",a)}i.useEffect(()=>()=>We.current?.(),[]);const Xe={width:Math.max(0,D),height:Math.max(me.bar,A??me.bar)};function $e(e){Ee(e),O?.(e)}const Fe=h(v,!0===E?["minimize","maximize","close"]:!1===E?[]:E),Ye=Fe.includes("maximize");i.useEffect(()=>{if(fe||null===Se)return;const e=window.setTimeout(()=>Pe(null),400);return()=>window.clearTimeout(e)},[fe,Se]);const _e={minimize:Q??de.minimize,maximize:Z??de.maximize,restore:ee??de.restore,close:te??ce.close},qe=e(m,{os:v,metrics:me,controls:Fe,maximized:be,active:Ce,labels:_e,onCommand:function(e){"close"===e?we(!1):"minimize"===e?function(e){const t=Te.current,n=t?.firstElementChild;if(t&&n instanceof HTMLElement&&Me(n.offsetHeight+(t.offsetHeight-t.clientHeight)),e&&void 0===(ze?.height??B)&&t)return Pe(t.getBoundingClientRect().height),void requestAnimationFrame(()=>pe(!0));pe(e)}(!fe):ve(!be)}}),Ke=d(x)?e("span",{id:he,className:"min-w-0 truncate",children:x}):null,Ue=d(y)?e("span",{className:"flex shrink-0 items-center",children:y}):null,Ve=t("div",{className:l("relative flex shrink-0 items-center select-none",c,R&&!be?"cursor-grab active:cursor-grabbing":""),style:{height:me.bar,textShadow:"var(--n-window-bar-shadow)",fontWeight:me.weight,paddingInlineStart:me.padX,paddingInlineEnd:me.padEnd,gap:Math.round(.7*me.title),fontSize:me.title,backgroundColor:"var(--n-window-bar)",backgroundImage:"var(--n-window-bar-image)",color:"var(--n-window-bar-fg)",borderBlockEnd:ue.rule?"1px solid var(--n-window-line)":void 0},onPointerDown:function(e){if(!R||be)return;const t={...xe};Oe(e,(e,n)=>ye({x:t.x+e,y:t.y+n}))},onDoubleClick:Ye?()=>ve(!be):void 0,children:["start"===ue.controlsSide?qe:null,"center"===ue.titleAlign?e("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 flex items-center justify-center",style:{paddingInline:me.controlsWidth(Fe.length)+2*me.padX},children:t("span",{className:"flex min-w-0 items-center",style:{gap:Math.round(.5*me.title)},children:[Ue,Ke]})}):t(n,{children:[Ue,Ke]}),e("span",{className:"flex-1"}),d(z)?e("span",{className:"flex shrink-0 items-center",style:{gap:Math.round(.5*me.title)},onPointerDown:e=>e.stopPropagation(),children:z}):null,"end"===ue.controlsSide?qe:null]}),Ge=be?{left:0,top:0,width:"100%",height:"100%"}:{left:xe.x,top:xe.y,width:ze?.width??j,height:fe?Le??me.bar:ze?.height??B??Se??void 0},Je=r({render:ie,ref:He,props:{role:"group","aria-labelledby":Ke?he:void 0,className:l("neba-window relative flex min-w-0 flex-col overflow-hidden",L>0?u:"",ue.glass&&0===L?"[backdrop-filter:var(--neba-blur)]":"","[transition-property:left,top,width,height,opacity,box-shadow,background-color,border-color,border-radius]","[transition-duration:var(--neba-duration-window)]","[transition-timing-function:var(--neba-ease)]","motion-reduce:[transition-duration:0ms]","data-[gesture]:[transition-property:none]",re),"data-gesture":Re?"":void 0,inert:!ge||void 0,style:{opacity:ge?void 0:0,...f({os:v,color:k,accent:C,transparency:L,active:Ce,elevation:S}),position:"static"===P?"relative":P,...Ge,borderRadius:be?0:`${me.radius}px ${me.radius}px ${me.radiusBottom}px ${me.radiusBottom}px`,borderStyle:"solid",borderWidth:me.frame,borderColor:"var(--n-window-line)",backgroundColor:"var(--n-window-band)",boxShadow:"var(--n-window-shadow), var(--neba-plate-glass)",...oe},children:t(n,{children:[Ve,e("div",{className:l("min-h-0 flex-1",G?"overflow-auto":"overflow-hidden"),style:{backgroundColor:"var(--n-window-body)",marginInline:me.band.side,marginBottom:me.band.bottom,boxShadow:me.band.side>0?"inset 0 0 0 1px rgb(0 0 0 / 0.12)":void 0},inert:fe,children:se}),!I||be||fe?null:b.map(t=>{const n="se"===t.edge;return e("div",{role:n?"button":void 0,tabIndex:n?0:void 0,"aria-label":n?ne??de.resize:void 0,"aria-hidden":n?void 0:"true",className:l("absolute z-10 touch-none",t.className,n?"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]":""),onPointerDown:e=>function(e,t){const n=Te.current;if(!n||be)return;const i=n.getBoundingClientRect(),r={width:i.width,height:i.height,x:xe.x,y:xe.y},o=e.includes("e"),s=e.includes("w"),a=e.includes("n"),l=e.includes("s");Oe(t,(e,t)=>{let{width:n,height:i}=r,{x:d,y:c}=r;o&&(n=Math.max(Xe.width,r.width+e)),l&&(i=Math.max(Xe.height,r.height+t)),s&&(n=Math.max(Xe.width,r.width-e),d=r.x+(r.width-n)),a&&(i=Math.max(Xe.height,r.height-t),c=r.y+(r.height-i)),$e({width:n,height:i}),(s||a)&&ye({x:d,y:c})})}(t.edge,e),onKeyDown:n?e=>{const t={ArrowRight:[16,0],ArrowLeft:[-16,0],ArrowDown:[0,16],ArrowUp:[0,-16]}[e.key];t&&(e.preventDefault(),function(e,t){const n=Te.current;if(!n)return;const i=n.getBoundingClientRect();$e({width:Math.max(Xe.width,i.width+e),height:Math.max(Xe.height,i.height+t)})}(t[0],t[1]))}:void 0},t.edge)})]}),...ae}});return ge||je?Je:null});
1
+ "use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as i from"react";import{useRender as r}from"@base-ui/react/use-render";import{actionMessages as o,useMessages as s,windowMessages as a}from"../../internal/i18n.js";import{cx as l,hasContent as d,iconClasses as c,surfaceClasses as u}from"../../internal/styles.js";import{WindowControls as m,orderControls as h,windowChrome as g,windowMetrics as w,windowSlots as f}from"../../internal/window.js";function p(e,t,n){const[r,o]=i.useState(t),s=void 0!==e;return[s?e:r,i.useCallback(e=>{s||o(e),n?.(e)},[s,n])]}const b=[{edge:"n",className:"inset-x-3 top-0 h-1.5 cursor-ns-resize"},{edge:"s",className:"inset-x-3 bottom-0 h-1.5 cursor-ns-resize"},{edge:"w",className:"inset-y-3 left-0 w-1.5 cursor-ew-resize"},{edge:"e",className:"inset-y-3 right-0 w-1.5 cursor-ew-resize"},{edge:"nw",className:"top-0 left-0 size-3 cursor-nwse-resize"},{edge:"ne",className:"top-0 right-0 size-3 cursor-nesw-resize"},{edge:"sw",className:"bottom-0 left-0 size-3 cursor-nesw-resize"},{edge:"se",className:"right-0 bottom-0 size-3 cursor-nwse-resize"}];export const WindowPane=/*@__PURE__*/i.forwardRef(function({os:v="macos",title:x,icon:y,actions:z,controls:E=!0,size:N="md",color:k="primary",accent:C=!1,transparency:L=0,active:M,elevation:S=2,position:P="static",draggable:R=!1,resizable:I=!1,width:j,height:B,minWidth:D=180,minHeight:A,offset:T,defaultOffset:H,onOffsetChange:W,onResize:O,open:X,defaultOpen:$=!0,onOpenChange:F,minimized:Y,defaultMinimized:_=!1,onMinimizedChange:q,maximized:K,defaultMaximized:U=!1,onMaximizedChange:V,scroll:G=!0,locale:J,minimizeLabel:Q,maximizeLabel:Z,restoreLabel:ee,closeLabel:te,resizeLabel:ne,render:ie,className:re,style:oe,children:se,...ae},le){const de=s(a,J),ce=s(o,J),ue=g(v),me=w(v,N),he=i.useId(),[ge,we]=p(X,$,F),[fe,pe]=p(Y,_,q),[be,ve]=p(K,U,V),[xe,ye]=p(T,H??{x:0,y:0},W),[ze,Ee]=i.useState(null),[Ne,ke]=i.useState(!0),Ce=M??Ne,[Le,Me]=i.useState(null),[Se,Pe]=i.useState(null),[Re,Ie]=i.useState(!1),[je,Be]=i.useState(!1),[De,Ae]=i.useState(ge);De!==ge&&(Ae(ge),Be(!ge)),i.useEffect(()=>{if(!je)return;const e=window.setTimeout(()=>Be(!1),260);return()=>window.clearTimeout(e)},[je]);const Te=i.useRef(null),He=i.useCallback(e=>{Te.current=e,"function"==typeof le?le(e):le&&(le.current=e)},[le]);i.useEffect(()=>{if(void 0!==M)return;const e=Te.current;if(!e)return;const t=t=>{const n=t.target;if(!(n instanceof Node))return;if(e.contains(n))return void ke(!0);const i=n instanceof Element?n:n.parentElement;i?.closest(".neba-window")&&ke(!1)};return document.addEventListener("pointerdown",t,!0),document.addEventListener("focusin",t,!0),()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("focusin",t,!0)}},[M]);const We=i.useRef(null);function Oe(e,t){if(0!==e.button)return;We.current?.();const n=e.currentTarget;n.setPointerCapture(e.pointerId),n.dataset.dragging="true",Ie(!0);const i=e.clientX,r=e.clientY,o=document.body.style.getPropertyValue("-webkit-user-select");document.body.style.setProperty("-webkit-user-select","none");const s=e=>{t(e.clientX-i,e.clientY-r)},a=()=>{We.current=null,Ie(!1),n.removeEventListener("pointermove",s),n.removeEventListener("pointerup",a),n.removeEventListener("pointercancel",a),delete n.dataset.dragging,o?document.body.style.setProperty("-webkit-user-select",o):document.body.style.removeProperty("-webkit-user-select")};We.current=a,n.addEventListener("pointermove",s),n.addEventListener("pointerup",a),n.addEventListener("pointercancel",a)}i.useEffect(()=>()=>We.current?.(),[]);const Xe={width:Math.max(0,D),height:Math.max(me.bar,A??me.bar)};function $e(e){Ee(e),O?.(e)}const Fe=h(v,!0===E?["minimize","maximize","close"]:!1===E?[]:E),Ye=Fe.includes("maximize");i.useEffect(()=>{if(fe||null===Se)return;const e=window.setTimeout(()=>Pe(null),400);return()=>window.clearTimeout(e)},[fe,Se]);const _e={minimize:Q??de.minimize,maximize:Z??de.maximize,restore:ee??de.restore,close:te??ce.close},qe=e(m,{os:v,metrics:me,controls:Fe,maximized:be,active:Ce,labels:_e,onCommand:function(e){"close"===e?we(!1):"minimize"===e?function(e){const t=Te.current,n=t?.firstElementChild;if(t&&n instanceof HTMLElement&&Me(n.offsetHeight+(t.offsetHeight-t.clientHeight)),e&&void 0===(ze?.height??B)&&t)return Pe(t.getBoundingClientRect().height),void requestAnimationFrame(()=>pe(!0));pe(e)}(!fe):ve(!be)}}),Ke=d(x)?e("span",{id:he,className:"min-w-0 truncate",children:x}):null,Ue=d(y)?e("span",{className:"flex shrink-0 items-center",children:y}):null,Ve=t("div",{className:l("relative flex shrink-0 items-center select-none",c,R&&!be?"cursor-grab active:cursor-grabbing":""),style:{height:me.bar,textShadow:"var(--n-window-bar-shadow)",fontWeight:me.weight,paddingInlineStart:me.padX,paddingInlineEnd:me.padEnd,gap:Math.round(.7*me.title),fontSize:me.title,backgroundColor:"var(--n-window-bar)",backgroundImage:"var(--n-window-bar-image)",color:"var(--n-window-bar-fg)",borderBlockEnd:ue.rule?"1px solid var(--n-window-line)":void 0},onPointerDown:function(e){if(!R||be)return;const t={...xe};Oe(e,(e,n)=>ye({x:t.x+e,y:t.y+n}))},onDoubleClick:Ye?()=>ve(!be):void 0,children:["start"===ue.controlsSide?qe:null,"center"===ue.titleAlign?e("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 flex items-center justify-center",style:{paddingInline:me.controlsWidth(Fe.length)+2*me.padX},children:t("span",{className:"flex min-w-0 items-center",style:{gap:Math.round(.5*me.title)},children:[Ue,Ke]})}):t(n,{children:[Ue,Ke]}),e("span",{className:"flex-1"}),d(z)?e("span",{className:"flex shrink-0 items-center",style:{gap:Math.round(.5*me.title)},onPointerDown:e=>e.stopPropagation(),children:z}):null,"end"===ue.controlsSide?qe:null]}),Ge=be?{left:0,top:0,width:"100%",height:"100%"}:{left:xe.x,top:xe.y,width:ze?.width??j,height:fe?Le??me.bar:ze?.height??B??Se??void 0},Je=r({render:ie,ref:He,props:{role:"group","aria-labelledby":Ke?he:void 0,className:l("neba-window relative flex min-w-0 flex-col overflow-hidden",L>0?u:"",ue.glass&&0===L?"[backdrop-filter:var(--neba-blur)]":"","[transition-property:left,top,width,height,opacity,box-shadow,background-color,border-color,border-radius]","[transition-duration:var(--neba-duration-window)]","[transition-timing-function:var(--neba-ease)]","motion-reduce:[transition-duration:0ms]","data-[gesture]:[transition-property:none]",re),"data-gesture":Re?"":void 0,inert:!ge||void 0,style:{opacity:ge?void 0:0,...f({os:v,color:k,accent:C,transparency:L,active:Ce,elevation:S}),position:"static"===P?"relative":P,...Ge,borderRadius:be?0:`${me.radius}px ${me.radius}px ${me.radiusBottom}px ${me.radiusBottom}px`,borderStyle:"solid",borderWidth:me.frame,borderColor:"var(--n-window-line)",backgroundColor:"var(--n-window-band)",boxShadow:"var(--n-window-shadow), var(--neba-plate-glass)",...oe},children:t(n,{children:[Ve,e("div",{className:l("min-h-0 flex-1",G?"overflow-auto":"overflow-hidden"),style:{backgroundColor:"var(--n-window-body)",marginInline:me.band.side,marginBottom:me.band.bottom,boxShadow:me.band.side>0?"inset 0 0 0 1px rgb(0 0 0 / 0.12)":void 0},inert:fe,children:se}),!I||be||fe?null:b.map(t=>{const n="se"===t.edge;return e("div",{role:n?"button":void 0,tabIndex:n?0:void 0,"aria-label":n?ne??de.resize:void 0,"aria-hidden":n?void 0:"true",className:l("absolute z-10 touch-none",t.className,n?"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]":""),onPointerDown:e=>function(e,t){const n=Te.current;if(!n||be)return;const i=n.getBoundingClientRect(),r={width:i.width,height:i.height,x:xe.x,y:xe.y},o=e.includes("e"),s=e.includes("w"),a=e.includes("n"),l=e.includes("s");Oe(t,(e,t)=>{let{width:n,height:i}=r,{x:d,y:c}=r;o&&(n=Math.max(Xe.width,r.width+e)),l&&(i=Math.max(Xe.height,r.height+t)),s&&(n=Math.max(Xe.width,r.width-e),d=r.x+(r.width-n)),a&&(i=Math.max(Xe.height,r.height-t),c=r.y+(r.height-i)),$e({width:n,height:i}),(s||a)&&ye({x:d,y:c})})}(t.edge,e),onKeyDown:n?e=>{const t={ArrowRight:[16,0],ArrowLeft:[-16,0],ArrowDown:[0,16],ArrowUp:[0,-16]}[e.key];t&&(e.preventDefault(),function(e,t){const n=Te.current;if(!n)return;const i=n.getBoundingClientRect();$e({width:Math.max(Xe.width,i.width+e),height:Math.max(Xe.height,i.height+t)})}(t[0],t[1]))}:void 0},t.edge)})]}),...ae}});return ge||je?Je:null});
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from './types.js';
2
2
  export * from './components/accordion/index.js';
3
3
  export * from './components/alert/index.js';
4
4
  export * from './components/animate-appear/index.js';
5
+ export * from './components/app-logo/index.js';
5
6
  export * from './components/animate-blink/index.js';
6
7
  export * from './components/animate-fade/index.js';
7
8
  export * from './components/animate-grow/index.js';
@@ -28,6 +29,7 @@ export * from './components/carousel/index.js';
28
29
  export * from './components/chat-bubble/index.js';
29
30
  export * from './components/checkbox/index.js';
30
31
  export * from './components/chip/index.js';
32
+ export * from './components/code-block/index.js';
31
33
  export * from './components/collapsible/index.js';
32
34
  export * from './components/color-picker/index.js';
33
35
  export * from './components/combobox/index.js';
@@ -44,9 +46,12 @@ export * from './components/file-picker/index.js';
44
46
  export * from './components/grid/index.js';
45
47
  export * from './components/floating-action-button/index.js';
46
48
  export * from './components/floating-bottom-navigation/index.js';
49
+ export * from './components/footer/index.js';
47
50
  export * from './components/grid-container/index.js';
51
+ export * from './components/header/index.js';
48
52
  export * from './components/heatmap-chart/index.js';
49
53
  export * from './components/highlight/index.js';
54
+ export * from './components/how-to-steps/index.js';
50
55
  export * from './components/icon/index.js';
51
56
  export * from './components/icon-button/index.js';
52
57
  export * from './components/line-chart/index.js';
@@ -56,6 +61,7 @@ export * from './components/mockup/index.js';
56
61
  export * from './components/number-field/index.js';
57
62
  export * from './components/otp-field/index.js';
58
63
  export * from './components/overlay/index.js';
64
+ export * from './components/page-layout/index.js';
59
65
  export * from './components/pagination/index.js';
60
66
  export * from './components/panes/index.js';
61
67
  export * from './components/pie-chart/index.js';
@@ -71,6 +77,7 @@ export * from './components/scroll-zone/index.js';
71
77
  export * from './components/segmented-button/index.js';
72
78
  export * from './components/select/index.js';
73
79
  export * from './components/shortcut/index.js';
80
+ export * from './components/sidebar/index.js';
74
81
  export * from './components/skeleton/index.js';
75
82
  export * from './components/slider/index.js';
76
83
  export * from './components/sparkline/index.js';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export*from"./types.js";export*from"./components/accordion/index.js";export*from"./components/alert/index.js";export*from"./components/animate-appear/index.js";export*from"./components/animate-blink/index.js";export*from"./components/animate-fade/index.js";export*from"./components/animate-grow/index.js";export*from"./components/animate-headline/index.js";export*from"./components/animate-lighting/index.js";export*from"./components/animate-marquee/index.js";export*from"./components/animate-rotate/index.js";export*from"./components/animate-slide/index.js";export*from"./components/animate-typing/index.js";export*from"./components/animate-zoom/index.js";export*from"./components/area-chart/index.js";export*from"./components/aspect-ratio/index.js";export*from"./components/avatar/index.js";export*from"./components/badge/index.js";export*from"./components/bar-chart/index.js";export*from"./components/blockquote/index.js";export*from"./components/bottom-navigation/index.js";export*from"./components/box/index.js";export*from"./components/breadcrumb/index.js";export*from"./components/button/index.js";export*from"./components/button-group/index.js";export*from"./components/card/index.js";export*from"./components/carousel/index.js";export*from"./components/chat-bubble/index.js";export*from"./components/checkbox/index.js";export*from"./components/chip/index.js";export*from"./components/collapsible/index.js";export*from"./components/color-picker/index.js";export*from"./components/combobox/index.js";export*from"./components/container/index.js";export*from"./components/data-table/index.js";export*from"./components/date-picker/index.js";export*from"./components/date-range-picker/index.js";export*from"./components/date-time-picker/index.js";export*from"./components/dialog/index.js";export*from"./components/divider/index.js";export*from"./components/drawer/index.js";export*from"./components/empty/index.js";export*from"./components/file-picker/index.js";export*from"./components/grid/index.js";export*from"./components/floating-action-button/index.js";export*from"./components/floating-bottom-navigation/index.js";export*from"./components/grid-container/index.js";export*from"./components/heatmap-chart/index.js";export*from"./components/highlight/index.js";export*from"./components/icon/index.js";export*from"./components/icon-button/index.js";export*from"./components/line-chart/index.js";export*from"./components/list/index.js";export*from"./components/menu/index.js";export*from"./components/mockup/index.js";export*from"./components/number-field/index.js";export*from"./components/otp-field/index.js";export*from"./components/overlay/index.js";export*from"./components/pagination/index.js";export*from"./components/panes/index.js";export*from"./components/pie-chart/index.js";export*from"./components/pill/index.js";export*from"./components/popover/index.js";export*from"./components/progress-box/index.js";export*from"./components/progress-circular/index.js";export*from"./components/progress-linear/index.js";export*from"./components/radio-group/index.js";export*from"./components/rating/index.js";export*from"./components/scatter-chart/index.js";export*from"./components/scroll-zone/index.js";export*from"./components/segmented-button/index.js";export*from"./components/select/index.js";export*from"./components/shortcut/index.js";export*from"./components/skeleton/index.js";export*from"./components/slider/index.js";export*from"./components/sparkline/index.js";export*from"./components/spoiler/index.js";export*from"./components/statistic/index.js";export*from"./components/switch/index.js";export*from"./components/table/index.js";export*from"./components/tabs/index.js";export*from"./components/text-field/index.js";export*from"./components/text-link/index.js";export*from"./components/time-picker/index.js";export*from"./components/timeline/index.js";export*from"./components/timeline-chart/index.js";export*from"./components/toast/index.js";export*from"./components/toolbar/index.js";export*from"./components/tooltip/index.js";export*from"./components/tree-view/index.js";export*from"./components/typography/index.js";export*from"./components/window-pane/index.js";
1
+ export*from"./types.js";export*from"./components/accordion/index.js";export*from"./components/alert/index.js";export*from"./components/animate-appear/index.js";export*from"./components/app-logo/index.js";export*from"./components/animate-blink/index.js";export*from"./components/animate-fade/index.js";export*from"./components/animate-grow/index.js";export*from"./components/animate-headline/index.js";export*from"./components/animate-lighting/index.js";export*from"./components/animate-marquee/index.js";export*from"./components/animate-rotate/index.js";export*from"./components/animate-slide/index.js";export*from"./components/animate-typing/index.js";export*from"./components/animate-zoom/index.js";export*from"./components/area-chart/index.js";export*from"./components/aspect-ratio/index.js";export*from"./components/avatar/index.js";export*from"./components/badge/index.js";export*from"./components/bar-chart/index.js";export*from"./components/blockquote/index.js";export*from"./components/bottom-navigation/index.js";export*from"./components/box/index.js";export*from"./components/breadcrumb/index.js";export*from"./components/button/index.js";export*from"./components/button-group/index.js";export*from"./components/card/index.js";export*from"./components/carousel/index.js";export*from"./components/chat-bubble/index.js";export*from"./components/checkbox/index.js";export*from"./components/chip/index.js";export*from"./components/code-block/index.js";export*from"./components/collapsible/index.js";export*from"./components/color-picker/index.js";export*from"./components/combobox/index.js";export*from"./components/container/index.js";export*from"./components/data-table/index.js";export*from"./components/date-picker/index.js";export*from"./components/date-range-picker/index.js";export*from"./components/date-time-picker/index.js";export*from"./components/dialog/index.js";export*from"./components/divider/index.js";export*from"./components/drawer/index.js";export*from"./components/empty/index.js";export*from"./components/file-picker/index.js";export*from"./components/grid/index.js";export*from"./components/floating-action-button/index.js";export*from"./components/floating-bottom-navigation/index.js";export*from"./components/footer/index.js";export*from"./components/grid-container/index.js";export*from"./components/header/index.js";export*from"./components/heatmap-chart/index.js";export*from"./components/highlight/index.js";export*from"./components/how-to-steps/index.js";export*from"./components/icon/index.js";export*from"./components/icon-button/index.js";export*from"./components/line-chart/index.js";export*from"./components/list/index.js";export*from"./components/menu/index.js";export*from"./components/mockup/index.js";export*from"./components/number-field/index.js";export*from"./components/otp-field/index.js";export*from"./components/overlay/index.js";export*from"./components/page-layout/index.js";export*from"./components/pagination/index.js";export*from"./components/panes/index.js";export*from"./components/pie-chart/index.js";export*from"./components/pill/index.js";export*from"./components/popover/index.js";export*from"./components/progress-box/index.js";export*from"./components/progress-circular/index.js";export*from"./components/progress-linear/index.js";export*from"./components/radio-group/index.js";export*from"./components/rating/index.js";export*from"./components/scatter-chart/index.js";export*from"./components/scroll-zone/index.js";export*from"./components/segmented-button/index.js";export*from"./components/select/index.js";export*from"./components/shortcut/index.js";export*from"./components/sidebar/index.js";export*from"./components/skeleton/index.js";export*from"./components/slider/index.js";export*from"./components/sparkline/index.js";export*from"./components/spoiler/index.js";export*from"./components/statistic/index.js";export*from"./components/switch/index.js";export*from"./components/table/index.js";export*from"./components/tabs/index.js";export*from"./components/text-field/index.js";export*from"./components/text-link/index.js";export*from"./components/time-picker/index.js";export*from"./components/timeline/index.js";export*from"./components/timeline-chart/index.js";export*from"./components/toast/index.js";export*from"./components/toolbar/index.js";export*from"./components/tooltip/index.js";export*from"./components/tree-view/index.js";export*from"./components/typography/index.js";export*from"./components/window-pane/index.js";
@@ -1 +1 @@
1
- import*as e from"react";export const animationClasses={fade:"neba-anim-fade",grow:"neba-anim-scale",slide:"neba-anim-slide",zoom:"neba-anim-scale",rotate:"neba-anim-rotate",blink:"neba-anim-blink"};export const animBaseClass="neba-anim";export const defaultDurations={fade:320,grow:340,slide:380,zoom:340,rotate:460,blink:900};export function lengthValue(e){return"number"==typeof e?`${e}px`:e}export function isInfinite(e){return"infinite"===e}export function animationSlots(e){const n={"--n-anim-duration":`${e.duration}ms`,"--n-anim-delay":`${e.delay}ms`,"--n-anim-repeat":(i=e.repeat,"infinite"===i?"infinite":String(i)),"--n-anim-direction":(t=e.mode??"in",a=e.alternate,"out"===t?a?"alternate-reverse":"reverse":a?"alternate":"normal")};var t,a,i;return e.easing&&(n["--n-anim-ease"]=e.easing),void 0!==e.opacity&&(n["--n-anim-opacity"]=String(e.opacity)),void 0!==e.scale&&(n["--n-anim-scale"]=String(e.scale)),void 0!==e.x&&(n["--n-anim-x"]=e.x),void 0!==e.y&&(n["--n-anim-y"]=e.y),void 0!==e.angle&&(n["--n-anim-angle"]=e.angle),void 0!==e.angleTo&&(n["--n-anim-angle-to"]=e.angleTo),n}export function slideOffsets(e,n){const t=lengthValue(n),a="number"==typeof n?-n+"px":`calc(-1 * ${t})`;switch(e){case"top":return{x:"0px",y:a};case"bottom":return{x:"0px",y:t};case"left":return{x:a,y:"0px"};default:return{x:t,y:"0px"}}}export function transitionProps(e){if(!e)return{className:"",style:{}};const n="string"==typeof e?{type:e}:e,{type:t}=n,a={duration:n.duration??defaultDurations[t],delay:n.delay??0,easing:n.easing,repeat:n.repeat??("blink"===t?"infinite":1),alternate:n.alternate};if("grow"!==t&&"zoom"!==t||(a.scale=n.scale??("zoom"===t?.4:.8)),"slide"===t){const{x:e,y:t}=slideOffsets(n.from??"bottom",n.distance??"100%");a.x=e,a.y=t}return"rotate"===t&&(a.angle=`${n.angle??-180}deg`),{className:`neba-anim ${animationClasses[t]}`,style:animationSlots(a)}}const n="(prefers-reduced-motion: reduce)";function t(e){if("undefined"==typeof window||!window.matchMedia)return()=>{};const t=window.matchMedia(n);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function a(){return!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia(n).matches}function i(){return!1}export function usePrefersReducedMotion(){return e.useSyncExternalStore(t,a,i)}export function useAnimationRun({trigger:n,play:t,once:a,threshold:i,paused:o,infinite:r}){const s=e.useRef(null),[c,l]=e.useState("mount"===n),[u,d]=e.useState(0),f=e.useCallback(()=>{l(!0),d(e=>e+1)},[]);e.useLayoutEffect(()=>{const e=s.current;if(!e||0===u)return;const n=[e,...e.querySelectorAll(".neba-anim, .neba-marquee-track")];for(const e of n)e.style.animationName="none";e.offsetWidth;for(const e of n)e.style.animationName=""},[u]),e.useEffect(()=>{if("visible"!==n)return;const e=s.current;if(!e||"undefined"==typeof IntersectionObserver)return void l(!0);const t=new IntersectionObserver(([e])=>{e.isIntersecting?(f(),a&&t.disconnect()):a||l(!1)},{threshold:i});return t.observe(e),()=>t.disconnect()},[n,a,i,f]),e.useEffect(()=>{"manual"===n&&(t?f():l(!1))},[n,t,f]);const m="hover"===n?{onPointerEnter:f,onFocus:f,onPointerLeave:()=>{r&&l(!1)},onBlur:()=>{r&&l(!1)}}:{};return{ref:e.useCallback(e=>{s.current=e},[]),state:c&&!o?"running":"paused",started:c,handlers:m}}export function useAnimateElement(e){const{effect:n,trigger:t,play:a,once:i,threshold:o,paused:r,infinite:s,...c}=e,l=useAnimationRun({trigger:t,play:a,once:i,threshold:o,paused:r,infinite:s});return{ref:l.ref,className:n?`neba-anim ${animationClasses[n]}`:"",style:{...animationSlots(c),"--n-anim-state":l.state},props:{...l.handlers,"data-neba-animation":n??void 0,"data-state":l.state}}}
1
+ "use client";import*as e from"react";export const animationClasses={fade:"neba-anim-fade",grow:"neba-anim-scale",slide:"neba-anim-slide",zoom:"neba-anim-scale",rotate:"neba-anim-rotate",blink:"neba-anim-blink"};export const animBaseClass="neba-anim";export const defaultDurations={fade:320,grow:340,slide:380,zoom:340,rotate:460,blink:900};export function lengthValue(e){return"number"==typeof e?`${e}px`:e}export function isInfinite(e){return"infinite"===e}export function animationSlots(e){const n={"--n-anim-duration":`${e.duration}ms`,"--n-anim-delay":`${e.delay}ms`,"--n-anim-repeat":(i=e.repeat,"infinite"===i?"infinite":String(i)),"--n-anim-direction":(t=e.mode??"in",a=e.alternate,"out"===t?a?"alternate-reverse":"reverse":a?"alternate":"normal")};var t,a,i;return e.easing&&(n["--n-anim-ease"]=e.easing),void 0!==e.opacity&&(n["--n-anim-opacity"]=String(e.opacity)),void 0!==e.scale&&(n["--n-anim-scale"]=String(e.scale)),void 0!==e.x&&(n["--n-anim-x"]=e.x),void 0!==e.y&&(n["--n-anim-y"]=e.y),void 0!==e.angle&&(n["--n-anim-angle"]=e.angle),void 0!==e.angleTo&&(n["--n-anim-angle-to"]=e.angleTo),n}export function slideOffsets(e,n){const t=lengthValue(n),a="number"==typeof n?-n+"px":`calc(-1 * ${t})`;switch(e){case"top":return{x:"0px",y:a};case"bottom":return{x:"0px",y:t};case"left":return{x:a,y:"0px"};default:return{x:t,y:"0px"}}}export function transitionProps(e){if(!e)return{className:"",style:{}};const n="string"==typeof e?{type:e}:e,{type:t}=n,a={duration:n.duration??defaultDurations[t],delay:n.delay??0,easing:n.easing,repeat:n.repeat??("blink"===t?"infinite":1),alternate:n.alternate};if("grow"!==t&&"zoom"!==t||(a.scale=n.scale??("zoom"===t?.4:.8)),"slide"===t){const{x:e,y:t}=slideOffsets(n.from??"bottom",n.distance??"100%");a.x=e,a.y=t}return"rotate"===t&&(a.angle=`${n.angle??-180}deg`),{className:`neba-anim ${animationClasses[t]}`,style:animationSlots(a)}}const n="(prefers-reduced-motion: reduce)";function t(e){if("undefined"==typeof window||!window.matchMedia)return()=>{};const t=window.matchMedia(n);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function a(){return!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia(n).matches}function i(){return!1}export function usePrefersReducedMotion(){return e.useSyncExternalStore(t,a,i)}export function useAnimationRun({trigger:n,play:t,once:a,threshold:i,paused:o,infinite:r}){const s=e.useRef(null),[c,l]=e.useState("mount"===n),[u,d]=e.useState(0),f=e.useCallback(()=>{l(!0),d(e=>e+1)},[]);e.useLayoutEffect(()=>{const e=s.current;if(!e||0===u)return;const n=[e,...e.querySelectorAll(".neba-anim, .neba-marquee-track")];for(const e of n)e.style.animationName="none";e.offsetWidth;for(const e of n)e.style.animationName=""},[u]),e.useEffect(()=>{if("visible"!==n)return;const e=s.current;if(!e||"undefined"==typeof IntersectionObserver)return void l(!0);const t=new IntersectionObserver(([e])=>{e.isIntersecting?(f(),a&&t.disconnect()):a||l(!1)},{threshold:i});return t.observe(e),()=>t.disconnect()},[n,a,i,f]),e.useEffect(()=>{"manual"===n&&(t?f():l(!1))},[n,t,f]);const m="hover"===n?{onPointerEnter:f,onFocus:f,onPointerLeave:()=>{r&&l(!1)},onBlur:()=>{r&&l(!1)}}:{};return{ref:e.useCallback(e=>{s.current=e},[]),state:c&&!o?"running":"paused",started:c,handlers:m}}export function useAnimateElement(e){const{effect:n,trigger:t,play:a,once:i,threshold:o,paused:r,infinite:s,...c}=e,l=useAnimationRun({trigger:t,play:a,once:i,threshold:o,paused:r,infinite:s});return{ref:l.ref,className:n?`neba-anim ${animationClasses[n]}`:"",style:{...animationSlots(c),"--n-anim-state":l.state},props:{...l.handlers,"data-neba-animation":n??void 0,"data-state":l.state}}}
@@ -9,9 +9,10 @@ export type BottomNavigationValue = string | number;
9
9
  * who has not used the app before, and the default on the bar that spans an
10
10
  * edge of the window.
11
11
  * - `selected` — only the destination that is current. The bar keeps its height
12
- * either way, because the named one is always the tallest; what changes is
13
- * how much of the row is words. The names the other items lose are still in
14
- * the document for a screen reader.
12
+ * either way: every item holds a line open for its name whether or not the
13
+ * name is drawn there, so what travels when the reader moves between two
14
+ * destinations is width and nothing else. The names the other items lose are
15
+ * still in the document for a screen reader.
15
16
  * - `none` — glyphs only, with every name read out but never drawn.
16
17
  */
17
18
  export type BottomNavigationLabels = 'all' | 'selected' | 'none';
@@ -1 +1 @@
1
- import*as t from"react";export const BottomNavigationContext=/*@__PURE__*/t.createContext({value:null,change:()=>{},size:"md",density:"default",labels:"all",disabled:!1,floating:!1});export const barMinHeightClasses={xs:"min-h-10",sm:"min-h-12",md:"min-h-14",lg:"min-h-16",xl:"min-h-18"};
1
+ "use client";import*as t from"react";export const BottomNavigationContext=/*@__PURE__*/t.createContext({value:null,change:()=>{},size:"md",density:"default",labels:"all",disabled:!1,floating:!1});export const barMinHeightClasses={xs:"min-h-10",sm:"min-h-12",md:"min-h-14",lg:"min-h-16",xl:"min-h-18"};
@@ -1 +1 @@
1
- import*as t from"react";export const ButtonGroupContext=/*@__PURE__*/t.createContext(null);
1
+ "use client";import*as t from"react";export const ButtonGroupContext=/*@__PURE__*/t.createContext(null);
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{Button as r}from"../components/button/Button.js";import{ChevronIcon as a}from"./icons.js";import{controlHeightClasses as l,controlTextClasses as s,cx as i,gapClasses as c,metaTextClasses as u,pressTransitionClasses as d,srOnlyClasses as m,transitionClasses as h}from"./styles.js";import{addDays as g,addMonths as f,addYears as b,calendarWeeks as p,compareDay as v,daysInMonth as x,isDayOutside as w,isMonthBeforeYear as y,isSameDay as D,isSameMonth as N,isValidDate as S,makeDate as M,meridiemLabels as P,monthLabels as C,startOfDay as k,startOfMonth as Y,today as z,weekdayLabels as A,withTime as F,YEAR_PAGE_SIZE as j,yearPageStart as E}from"./date.js";import{dateFormatter as T}from"./format.js";export const defaultPickerLabels={previousMonth:"Previous month",nextMonth:"Next month",previousYear:"Previous year",nextYear:"Next year",previousYears:"Previous years",nextYears:"Next years",chooseMonth:"Choose a month",chooseYear:"Choose a year",today:"Today",now:"Now",clear:"Clear",done:"Done",hour:"Hour",minute:"Minute",second:"Second",meridiem:"AM/PM",start:"Start",end:"End"};export function usePickerLabels(e){return o.useMemo(()=>e?{...defaultPickerLabels,...e}:defaultPickerLabels,[e])}const R={xs:"1.375rem",sm:"1.625rem",md:"2rem",lg:"2.5rem",xl:"3rem"},B={xs:"rounded-(--neba-radius-xs)",sm:"rounded-(--neba-radius-xs)",md:"rounded-(--neba-radius-sm)",lg:"rounded-(--neba-radius-md)",xl:"rounded-(--neba-radius-lg)"},H={xs:"rounded-s-(--neba-radius-xs)",sm:"rounded-s-(--neba-radius-xs)",md:"rounded-s-(--neba-radius-sm)",lg:"rounded-s-(--neba-radius-md)",xl:"rounded-s-(--neba-radius-lg)"},L={xs:"rounded-e-(--neba-radius-xs)",sm:"rounded-e-(--neba-radius-xs)",md:"rounded-e-(--neba-radius-sm)",lg:"rounded-e-(--neba-radius-md)",xl:"rounded-e-(--neba-radius-lg)"},K=["relative flex select-none items-center justify-center tabular-nums","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",h,d,"focus-visible:z-10 focus-visible:[outline:2px_solid_var(--n-ring)]","focus-visible:[outline-offset:-2px]"].join(" ");function O({children:n,label:o,selected:r,inRange:a=!1,rangeEdge:l=null,current:s=!1,muted:c=!1,disabled:u=!1,focused:d=!1,size:m,className:h,onClick:g,onPointerEnter:f,onKeyDown:b}){return t("button",{type:"button",role:"gridcell","aria-label":o,"aria-selected":r,"aria-current":s?"date":void 0,"aria-disabled":u||void 0,tabIndex:d?0:-1,"data-focus-target":d?"true":void 0,className:i(K,"start"===l?H[m]:"end"===l?L[m]:"middle"===l?"rounded-none":B[m],u?"cursor-not-allowed text-(--neba-disabled-fg)":r?"cursor-pointer bg-(--n-fill) font-semibold text-(--n-on-solid) hover:bg-(--n-fill-hover) active:bg-(--n-fill-active)":a?"cursor-pointer bg-(--n-soft) text-(--neba-fg) hover:bg-(--n-soft-hover) active:bg-(--n-soft-press)":s?"cursor-pointer font-semibold text-(--n-accent) hover:bg-(--n-soft) active:bg-(--n-soft-press)":c?"cursor-pointer text-(--neba-muted-fg) hover:bg-(--n-soft) active:bg-(--n-soft-press)":"cursor-pointer text-(--neba-fg) hover:bg-(--n-soft) active:bg-(--n-soft-press)",h),onClick:()=>{u||g()},onPointerEnter:f,onKeyDown:b,children:[n,s?e("span",{"aria-hidden":"true",className:"absolute bottom-[0.18em] size-[0.22em] rounded-full bg-current"}):null]})}function U({size:o,color:u,view:d,month:m,locale:h,labels:g,showPreviousButton:f,showNextButton:b,onStep:p,onViewChange:v}){const x=C(h,"long")[m.getMonth()],w=String(m.getFullYear()),D=y(h),N="day"===d?[g.previousMonth,g.nextMonth]:"month"===d?[g.previousYear,g.nextYear]:[g.previousYears,g.nextYears],S=(t,n)=>n?e(r,{variant:"text",size:o,color:u,density:"compact","aria-label":N[-1===t?0:1],onClick:()=>p(t),startIcon:e("span",{className:i("flex items-center",-1===t?"rotate-90 rtl:-rotate-90":"-rotate-90 rtl:rotate-90"),children:e(a,{})})}):e("span",{"aria-hidden":"true",className:i(l[o],"w-(--n-cell)")}),M=t=>e("span",{className:i("flex items-center text-(--neba-muted-fg)","[transition:rotate_var(--neba-duration)_var(--neba-ease)]",t&&"rotate-180"),children:e(a,{})}),P=e(r,{variant:"text",size:o,color:u,density:"compact","aria-label":g.chooseMonth,"aria-expanded":"month"===d,onClick:()=>v("month"===d?"day":"month"),endIcon:M("month"===d),children:x},"month"),k=e(r,{variant:"text",size:o,color:u,density:"compact",className:"tabular-nums","aria-label":g.chooseYear,"aria-expanded":"year"===d,onClick:()=>v("year"===d?"day":"year"),endIcon:M("year"===d),children:w},"year"),Y=E(m.getFullYear());return t("div",{className:"flex items-center justify-between gap-1",children:[S(-1,f),e("div",{className:i("flex min-w-0 flex-1 items-center justify-center",c[o]),children:"year"===d?e("span",{className:i("flex items-center font-medium tabular-nums text-(--neba-fg)",l[o],s[o]),children:`${Y}–${Y+j-1}`}):"month"===d?k:t(n,D?{children:[P,k]}:{children:[k,P]})}),S(1,b)]})}export function Calendar({size:n,color:r,locale:a,weekStartsOn:l,month:s,onMonthChange:u,selected:d,rangeStart:m=null,rangeEnd:h=null,onSelect:g,onPreviewChange:p,minDate:v,maxDate:x,shouldDisableDate:y,showOutsideDays:D=!0,autoFocus:P=!1,showPreviousButton:C=!0,showNextButton:A=!0,labels:F,className:E}){const[T,B]=o.useState("day"),H=o.useMemo(()=>d.filter(S),[d]),[L,K]=o.useState(()=>{const e=H.find(e=>N(e,s));return e?k(e):N(z(),s)?z():Y(s)}),O=o.useRef(P),_=o.useRef(null);o.useEffect(()=>{K(e=>N(e,s)?e:Y(s))},[s]),o.useLayoutEffect(()=>{O.current&&(O.current=!1,_.current?.querySelector('[data-focus-target="true"]')?.focus({preventScroll:!0}))});const V=o.useCallback(e=>w(e,v,x)||(y?.(e)??!1),[v,x,y]),G=e=>{O.current=!0,B(e)},J=e=>{O.current=!0,u(e)};return t("div",{ref:_,className:i("flex flex-col",c[n],E),style:{"--n-cell":R[n]},onPointerLeave:()=>p?.(null),children:[e(U,{size:n,color:r,view:T,month:s,locale:a,labels:F,showPreviousButton:C,showNextButton:A,onStep:e=>{u("day"===T?f(s,e):b(s,"month"===T?e:e*j))},onViewChange:G}),e("div",{className:"h-[calc(var(--n-cell)*7)] w-[calc(var(--n-cell)*7)]",children:"day"===T?e(q,{size:n,locale:a,weekStartsOn:l,month:s,chosen:H,rangeStart:m,rangeEnd:h,focusedDate:L,showOutsideDays:D,isDisabled:V,onSelect:e=>{K(e),g(e)},onPreviewChange:p,onMoveFocus:e=>{O.current=!0,K(e),N(e,s)||u(Y(e))}}):"month"===T?e(I,{size:n,locale:a,month:s,chosen:H,minDate:v,maxDate:x,onMoveCursor:J,onPick:e=>{u(M(s.getFullYear(),e,1)),G("day")}}):e($,{size:n,month:s,chosen:H,minDate:v,maxDate:x,onMoveCursor:J,onPick:e=>{u(M(e,s.getMonth(),1)),G("month")}})})]})}function q({size:n,locale:o,weekStartsOn:r,month:a,chosen:l,rangeStart:c,rangeEnd:d,focusedDate:m,showOutsideDays:h,isDisabled:b,onSelect:x,onPreviewChange:w,onMoveFocus:y}){const M=p(a,r),P=A(o,r,"short"),C=A(o,r,"long"),k=T(o,{dateStyle:"full"}),Y=(j=d,S(F=c)&&S(j)?v(F,j)<=0?[F,j]:[j,F]:null);var F,j;const E=z();return t("div",{role:"grid",className:"flex h-full flex-col",children:[e("div",{role:"row",className:"grid grid-cols-7",children:P.map((t,o)=>e("span",{role:"columnheader","aria-label":C[o],className:i("flex h-(--n-cell) items-center justify-center font-medium text-(--neba-muted-fg) select-none",u[n]),children:t},o))}),M.map((t,o)=>e("div",{role:"row",className:"grid grid-cols-7",children:t.map(t=>{const o=!N(t,a);if(o&&!h)return e("span",{role:"gridcell","aria-hidden":"true",className:"size-(--n-cell)"},t.getTime());const c=l.some(e=>D(e,t)),u=null!==Y&&v(t,Y[0])>=0&&v(t,Y[1])<=0,d=null!==Y&&u&&D(t,Y[0]),p=null!==Y&&u&&D(t,Y[1]);return e(O,{size:n,label:k.format(t),selected:c,inRange:u&&!c,rangeEdge:u?d&&p?"both":d?"start":p?"end":"middle":null,current:D(t,E)&&!c,muted:o,disabled:b(t),focused:D(t,m),className:i("size-(--n-cell)",s[n]),onClick:()=>x(t),onPointerEnter:()=>w?.(t),onKeyDown:e=>((e,t)=>{const n=(t.getDay()-r+7)%7,o={ArrowLeft:()=>g(t,-1),ArrowRight:()=>g(t,1),ArrowUp:()=>g(t,-7),ArrowDown:()=>g(t,7),Home:()=>g(t,-n),End:()=>g(t,6-n),PageUp:()=>f(t,e.shiftKey?-12:-1),PageDown:()=>f(t,e.shiftKey?12:1)}[e.key];o&&(e.preventDefault(),y(o()))})(e,t),children:t.getDate()},t.getTime())})},o))]})}function I({size:t,locale:n,month:o,chosen:r,minDate:a,maxDate:l,onMoveCursor:c,onPick:u}){const d=C(n,"short"),m=C(n,"long"),h=o.getFullYear(),g=new Date,b=e=>{const t={ArrowLeft:-1,ArrowRight:1,ArrowUp:-3,ArrowDown:3,PageUp:-12,PageDown:12}[e.key];void 0!==t&&(e.preventDefault(),c(f(Y(o),t)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2,3].map(n=>e("div",{role:"row",className:"grid grid-cols-3 gap-1",children:[0,1,2].map(c=>{const f=3*n+c,p=M(h,f,1),w=M(h,f,x(h,f));return e(O,{size:t,label:`${m[f]} ${h}`,selected:r.some(e=>e.getFullYear()===h&&e.getMonth()===f),current:g.getFullYear()===h&&g.getMonth()===f,disabled:S(a)&&v(w,a)<0||S(l)&&v(p,l)>0,focused:f===o.getMonth(),className:i("h-(--n-cell) w-full",s[t]),onClick:()=>u(f),onKeyDown:b,children:d[f]},f)})},n))})}function $({size:t,month:n,chosen:o,minDate:r,maxDate:a,onMoveCursor:l,onPick:c}){const u=E(n.getFullYear()),d=(new Date).getFullYear(),m=e=>{const t={ArrowLeft:-1,ArrowRight:1,ArrowUp:-4,ArrowDown:4,PageUp:-j,PageDown:j}[e.key];void 0!==t&&(e.preventDefault(),l(b(Y(n),t)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2].map(l=>e("div",{role:"row",className:"grid grid-cols-4 gap-1",children:[0,1,2,3].map(h=>{const g=u+4*l+h;return e(O,{size:t,label:String(g),selected:o.some(e=>e.getFullYear()===g),current:g===d,disabled:S(r)&&g<r.getFullYear()||S(a)&&g>a.getFullYear(),focused:g===n.getFullYear(),className:i("h-(--n-cell) w-full",s[t]),onClick:()=>c(g),onKeyDown:m,children:g},g)})},l))})}function _(e){const t=e.parentElement;if(!t)return;const n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=n.top-o.top-t.clientTop+t.scrollTop,a=r+n.height;r<t.scrollTop?t.scrollTop=r:a>t.scrollTop+t.clientHeight&&(t.scrollTop=a-t.clientHeight)}export function TimeGrid({size:n,density:r,locale:a,value:c,referenceDate:u,onChange:d,hour12:h,showSeconds:g,hourStep:f,minuteStep:b,secondStep:p,shouldDisableTime:v,autoFocus:x=!1,labels:w,className:y}){const D=c??u,N=o.useRef(null),[S,M]=o.useMemo(()=>P(a),[a]);o.useEffect(()=>{const e=N.current;if(e?.querySelectorAll('[data-chosen="true"]').forEach(_),x){const t=e?.querySelector('[role="listbox"]');(t?.querySelector('[data-chosen="true"]')??t?.querySelector('[role="option"]'))?.focus({preventScroll:!0})}},[x]);const C=o.useMemo(()=>{const e=Math.ceil((h?12:24)/f),t=Array.from({length:e},(e,t)=>t*f);return h?t.map(e=>0===e?12:e):t},[h,f]),k=o.useMemo(()=>Array.from({length:Math.ceil(60/b)},(e,t)=>t*b),[b]),Y=o.useMemo(()=>Array.from({length:Math.ceil(60/p)},(e,t)=>t*p),[p]),z=e=>String(e).padStart(2,"0"),A=h?D.getHours()%12||12:D.getHours(),j=(t,o,r,a,u)=>e("div",{role:"listbox","aria-label":o,className:i("flex flex-col gap-0.5 overflow-y-auto overscroll-contain","h-[calc(var(--n-cell)*7)] w-[calc(var(--n-cell)*2)]","scroll-py-0.5 [scrollbar-width:thin]"),children:r.map(o=>{const r=((e,t)=>F(D,"hour"===e?{hours:h?t%12+(D.getHours()>=12?12:0):t}:"minute"===e?{minutes:t}:"second"===e?{seconds:t}:{hours:D.getHours()%12+12*t}))(t,o),m=null!==c&&a(o),g=v?.(r,t)??!1;return e("button",{type:"button",role:"option","aria-selected":m,"aria-disabled":g||void 0,"data-chosen":m?"true":void 0,className:i(K,B[n],l[n],s[n],"w-full shrink-0",g?"cursor-not-allowed text-(--neba-disabled-fg)":m?"cursor-pointer bg-(--n-fill) font-semibold text-(--n-on-solid) hover:bg-(--n-fill-hover) active:bg-(--n-fill-active)":"cursor-pointer text-(--neba-fg) hover:bg-(--n-soft) active:bg-(--n-soft-press)"),onClick:()=>{g||d(r)},children:u(o)},o)})},t);return t("div",{ref:N,className:i("flex","compact"===r?"gap-0.5":"gap-1",y),style:{"--n-cell":R[n]},children:[j("hour",w.hour,C,e=>e===A,e=>h?String(e):z(e)),j("minute",w.minute,k,e=>e===D.getMinutes(),z),g?j("second",w.second,Y,e=>e===D.getSeconds(),z):null,h?j("meridiem",w.meridiem,[0,1],e=>(D.getHours()>=12?1:0)===e,e=>0===e?S:M):null,e("span",{className:m,"aria-live":"polite",children:null===c?"":T(a,{hour:"numeric",minute:"2-digit",...g?{second:"2-digit"}:{}}).format(c)})]})}
1
+ "use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{Button as r}from"../components/button/Button.js";import{ChevronIcon as a}from"./icons.js";import{controlHeightClasses as l,controlTextClasses as s,cx as i,gapClasses as c,metaTextClasses as u,pressTransitionClasses as d,srOnlyClasses as m,transitionClasses as h}from"./styles.js";import{addDays as g,addMonths as f,addYears as b,calendarWeeks as p,compareDay as v,daysInMonth as x,isDayOutside as w,isMonthBeforeYear as y,isSameDay as D,isSameMonth as N,isValidDate as S,makeDate as M,meridiemLabels as P,monthLabels as C,startOfDay as k,startOfMonth as Y,today as z,weekdayLabels as A,withTime as F,YEAR_PAGE_SIZE as j,yearPageStart as E}from"./date.js";import{dateFormatter as T}from"./format.js";export const defaultPickerLabels={previousMonth:"Previous month",nextMonth:"Next month",previousYear:"Previous year",nextYear:"Next year",previousYears:"Previous years",nextYears:"Next years",chooseMonth:"Choose a month",chooseYear:"Choose a year",today:"Today",now:"Now",clear:"Clear",done:"Done",hour:"Hour",minute:"Minute",second:"Second",meridiem:"AM/PM",start:"Start",end:"End"};export function usePickerLabels(e){return o.useMemo(()=>e?{...defaultPickerLabels,...e}:defaultPickerLabels,[e])}const R={xs:"1.375rem",sm:"1.625rem",md:"2rem",lg:"2.5rem",xl:"3rem"},B={xs:"rounded-(--neba-radius-xs)",sm:"rounded-(--neba-radius-xs)",md:"rounded-(--neba-radius-sm)",lg:"rounded-(--neba-radius-md)",xl:"rounded-(--neba-radius-lg)"},H={xs:"rounded-s-(--neba-radius-xs)",sm:"rounded-s-(--neba-radius-xs)",md:"rounded-s-(--neba-radius-sm)",lg:"rounded-s-(--neba-radius-md)",xl:"rounded-s-(--neba-radius-lg)"},L={xs:"rounded-e-(--neba-radius-xs)",sm:"rounded-e-(--neba-radius-xs)",md:"rounded-e-(--neba-radius-sm)",lg:"rounded-e-(--neba-radius-md)",xl:"rounded-e-(--neba-radius-lg)"},K=["relative flex select-none items-center justify-center tabular-nums","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",h,d,"focus-visible:z-10 focus-visible:[outline:2px_solid_var(--n-ring)]","focus-visible:[outline-offset:-2px]"].join(" ");function O({children:n,label:o,selected:r,inRange:a=!1,rangeEdge:l=null,current:s=!1,muted:c=!1,disabled:u=!1,focused:d=!1,size:m,className:h,onClick:g,onPointerEnter:f,onKeyDown:b}){return t("button",{type:"button",role:"gridcell","aria-label":o,"aria-selected":r,"aria-current":s?"date":void 0,"aria-disabled":u||void 0,tabIndex:d?0:-1,"data-focus-target":d?"true":void 0,className:i(K,"start"===l?H[m]:"end"===l?L[m]:"middle"===l?"rounded-none":B[m],u?"cursor-not-allowed text-(--neba-disabled-fg)":r?"cursor-pointer bg-(--n-fill) font-semibold text-(--n-on-solid) hover:bg-(--n-fill-hover) active:bg-(--n-fill-active)":a?"cursor-pointer bg-(--n-soft) text-(--neba-fg) hover:bg-(--n-soft-hover) active:bg-(--n-soft-press)":s?"cursor-pointer font-semibold text-(--n-accent) hover:bg-(--n-soft) active:bg-(--n-soft-press)":c?"cursor-pointer text-(--neba-muted-fg) hover:bg-(--n-soft) active:bg-(--n-soft-press)":"cursor-pointer text-(--neba-fg) hover:bg-(--n-soft) active:bg-(--n-soft-press)",h),onClick:()=>{u||g()},onPointerEnter:f,onKeyDown:b,children:[n,s?e("span",{"aria-hidden":"true",className:"absolute bottom-[0.18em] size-[0.22em] rounded-full bg-current"}):null]})}function U({size:o,color:u,view:d,month:m,locale:h,labels:g,showPreviousButton:f,showNextButton:b,onStep:p,onViewChange:v}){const x=C(h,"long")[m.getMonth()],w=String(m.getFullYear()),D=y(h),N="day"===d?[g.previousMonth,g.nextMonth]:"month"===d?[g.previousYear,g.nextYear]:[g.previousYears,g.nextYears],S=(t,n)=>n?e(r,{variant:"text",size:o,color:u,density:"compact","aria-label":N[-1===t?0:1],onClick:()=>p(t),startIcon:e("span",{className:i("flex items-center",-1===t?"rotate-90 rtl:-rotate-90":"-rotate-90 rtl:rotate-90"),children:e(a,{})})}):e("span",{"aria-hidden":"true",className:i(l[o],"w-(--n-cell)")}),M=t=>e("span",{className:i("flex items-center text-(--neba-muted-fg)","[transition:rotate_var(--neba-duration)_var(--neba-ease)]",t&&"rotate-180"),children:e(a,{})}),P=e(r,{variant:"text",size:o,color:u,density:"compact","aria-label":g.chooseMonth,"aria-expanded":"month"===d,onClick:()=>v("month"===d?"day":"month"),endIcon:M("month"===d),children:x},"month"),k=e(r,{variant:"text",size:o,color:u,density:"compact",className:"tabular-nums","aria-label":g.chooseYear,"aria-expanded":"year"===d,onClick:()=>v("year"===d?"day":"year"),endIcon:M("year"===d),children:w},"year"),Y=E(m.getFullYear());return t("div",{className:"flex items-center justify-between gap-1",children:[S(-1,f),e("div",{className:i("flex min-w-0 flex-1 items-center justify-center",c[o]),children:"year"===d?e("span",{className:i("flex items-center font-medium tabular-nums text-(--neba-fg)",l[o],s[o]),children:`${Y}–${Y+j-1}`}):"month"===d?k:t(n,D?{children:[P,k]}:{children:[k,P]})}),S(1,b)]})}export function Calendar({size:n,color:r,locale:a,weekStartsOn:l,month:s,onMonthChange:u,selected:d,rangeStart:m=null,rangeEnd:h=null,onSelect:g,onPreviewChange:p,minDate:v,maxDate:x,shouldDisableDate:y,showOutsideDays:D=!0,autoFocus:P=!1,showPreviousButton:C=!0,showNextButton:A=!0,labels:F,className:E}){const[T,B]=o.useState("day"),H=o.useMemo(()=>d.filter(S),[d]),[L,K]=o.useState(()=>{const e=H.find(e=>N(e,s));return e?k(e):N(z(),s)?z():Y(s)}),O=o.useRef(P),_=o.useRef(null);o.useEffect(()=>{K(e=>N(e,s)?e:Y(s))},[s]),o.useLayoutEffect(()=>{O.current&&(O.current=!1,_.current?.querySelector('[data-focus-target="true"]')?.focus({preventScroll:!0}))});const V=o.useCallback(e=>w(e,v,x)||(y?.(e)??!1),[v,x,y]),G=e=>{O.current=!0,B(e)},J=e=>{O.current=!0,u(e)};return t("div",{ref:_,className:i("flex flex-col",c[n],E),style:{"--n-cell":R[n]},onPointerLeave:()=>p?.(null),children:[e(U,{size:n,color:r,view:T,month:s,locale:a,labels:F,showPreviousButton:C,showNextButton:A,onStep:e=>{u("day"===T?f(s,e):b(s,"month"===T?e:e*j))},onViewChange:G}),e("div",{className:"h-[calc(var(--n-cell)*7)] w-[calc(var(--n-cell)*7)]",children:"day"===T?e(q,{size:n,locale:a,weekStartsOn:l,month:s,chosen:H,rangeStart:m,rangeEnd:h,focusedDate:L,showOutsideDays:D,isDisabled:V,onSelect:e=>{K(e),g(e)},onPreviewChange:p,onMoveFocus:e=>{O.current=!0,K(e),N(e,s)||u(Y(e))}}):"month"===T?e(I,{size:n,locale:a,month:s,chosen:H,minDate:v,maxDate:x,onMoveCursor:J,onPick:e=>{u(M(s.getFullYear(),e,1)),G("day")}}):e($,{size:n,month:s,chosen:H,minDate:v,maxDate:x,onMoveCursor:J,onPick:e=>{u(M(e,s.getMonth(),1)),G("month")}})})]})}function q({size:n,locale:o,weekStartsOn:r,month:a,chosen:l,rangeStart:c,rangeEnd:d,focusedDate:m,showOutsideDays:h,isDisabled:b,onSelect:x,onPreviewChange:w,onMoveFocus:y}){const M=p(a,r),P=A(o,r,"short"),C=A(o,r,"long"),k=T(o,{dateStyle:"full"}),Y=(j=d,S(F=c)&&S(j)?v(F,j)<=0?[F,j]:[j,F]:null);var F,j;const E=z();return t("div",{role:"grid",className:"flex h-full flex-col",children:[e("div",{role:"row",className:"grid grid-cols-7",children:P.map((t,o)=>e("span",{role:"columnheader","aria-label":C[o],className:i("flex h-(--n-cell) items-center justify-center font-medium text-(--neba-muted-fg) select-none",u[n]),children:t},o))}),M.map((t,o)=>e("div",{role:"row",className:"grid grid-cols-7",children:t.map(t=>{const o=!N(t,a);if(o&&!h)return e("span",{role:"gridcell","aria-hidden":"true",className:"size-(--n-cell)"},t.getTime());const c=l.some(e=>D(e,t)),u=null!==Y&&v(t,Y[0])>=0&&v(t,Y[1])<=0,d=null!==Y&&u&&D(t,Y[0]),p=null!==Y&&u&&D(t,Y[1]);return e(O,{size:n,label:k.format(t),selected:c,inRange:u&&!c,rangeEdge:u?d&&p?"both":d?"start":p?"end":"middle":null,current:D(t,E)&&!c,muted:o,disabled:b(t),focused:D(t,m),className:i("size-(--n-cell)",s[n]),onClick:()=>x(t),onPointerEnter:()=>w?.(t),onKeyDown:e=>((e,t)=>{const n=(t.getDay()-r+7)%7,o={ArrowLeft:()=>g(t,-1),ArrowRight:()=>g(t,1),ArrowUp:()=>g(t,-7),ArrowDown:()=>g(t,7),Home:()=>g(t,-n),End:()=>g(t,6-n),PageUp:()=>f(t,e.shiftKey?-12:-1),PageDown:()=>f(t,e.shiftKey?12:1)}[e.key];o&&(e.preventDefault(),y(o()))})(e,t),children:t.getDate()},t.getTime())})},o))]})}function I({size:t,locale:n,month:o,chosen:r,minDate:a,maxDate:l,onMoveCursor:c,onPick:u}){const d=C(n,"short"),m=C(n,"long"),h=o.getFullYear(),g=new Date,b=e=>{const t={ArrowLeft:-1,ArrowRight:1,ArrowUp:-3,ArrowDown:3,PageUp:-12,PageDown:12}[e.key];void 0!==t&&(e.preventDefault(),c(f(Y(o),t)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2,3].map(n=>e("div",{role:"row",className:"grid grid-cols-3 gap-1",children:[0,1,2].map(c=>{const f=3*n+c,p=M(h,f,1),w=M(h,f,x(h,f));return e(O,{size:t,label:`${m[f]} ${h}`,selected:r.some(e=>e.getFullYear()===h&&e.getMonth()===f),current:g.getFullYear()===h&&g.getMonth()===f,disabled:S(a)&&v(w,a)<0||S(l)&&v(p,l)>0,focused:f===o.getMonth(),className:i("h-(--n-cell) w-full",s[t]),onClick:()=>u(f),onKeyDown:b,children:d[f]},f)})},n))})}function $({size:t,month:n,chosen:o,minDate:r,maxDate:a,onMoveCursor:l,onPick:c}){const u=E(n.getFullYear()),d=(new Date).getFullYear(),m=e=>{const t={ArrowLeft:-1,ArrowRight:1,ArrowUp:-4,ArrowDown:4,PageUp:-j,PageDown:j}[e.key];void 0!==t&&(e.preventDefault(),l(b(Y(n),t)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2].map(l=>e("div",{role:"row",className:"grid grid-cols-4 gap-1",children:[0,1,2,3].map(h=>{const g=u+4*l+h;return e(O,{size:t,label:String(g),selected:o.some(e=>e.getFullYear()===g),current:g===d,disabled:S(r)&&g<r.getFullYear()||S(a)&&g>a.getFullYear(),focused:g===n.getFullYear(),className:i("h-(--n-cell) w-full",s[t]),onClick:()=>c(g),onKeyDown:m,children:g},g)})},l))})}function _(e){const t=e.parentElement;if(!t)return;const n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=n.top-o.top-t.clientTop+t.scrollTop,a=r+n.height;r<t.scrollTop?t.scrollTop=r:a>t.scrollTop+t.clientHeight&&(t.scrollTop=a-t.clientHeight)}export function TimeGrid({size:n,density:r,locale:a,value:c,referenceDate:u,onChange:d,hour12:h,showSeconds:g,hourStep:f,minuteStep:b,secondStep:p,shouldDisableTime:v,autoFocus:x=!1,labels:w,className:y}){const D=c??u,N=o.useRef(null),[S,M]=o.useMemo(()=>P(a),[a]);o.useEffect(()=>{const e=N.current;if(e?.querySelectorAll('[data-chosen="true"]').forEach(_),x){const t=e?.querySelector('[role="listbox"]');(t?.querySelector('[data-chosen="true"]')??t?.querySelector('[role="option"]'))?.focus({preventScroll:!0})}},[x]);const C=o.useMemo(()=>{const e=Math.ceil((h?12:24)/f),t=Array.from({length:e},(e,t)=>t*f);return h?t.map(e=>0===e?12:e):t},[h,f]),k=o.useMemo(()=>Array.from({length:Math.ceil(60/b)},(e,t)=>t*b),[b]),Y=o.useMemo(()=>Array.from({length:Math.ceil(60/p)},(e,t)=>t*p),[p]),z=e=>String(e).padStart(2,"0"),A=h?D.getHours()%12||12:D.getHours(),j=(t,o,r,a,u)=>e("div",{role:"listbox","aria-label":o,className:i("flex flex-col gap-0.5 overflow-y-auto overscroll-contain","h-[calc(var(--n-cell)*7)] w-[calc(var(--n-cell)*2)]","scroll-py-0.5 [scrollbar-width:thin]"),children:r.map(o=>{const r=((e,t)=>F(D,"hour"===e?{hours:h?t%12+(D.getHours()>=12?12:0):t}:"minute"===e?{minutes:t}:"second"===e?{seconds:t}:{hours:D.getHours()%12+12*t}))(t,o),m=null!==c&&a(o),g=v?.(r,t)??!1;return e("button",{type:"button",role:"option","aria-selected":m,"aria-disabled":g||void 0,"data-chosen":m?"true":void 0,className:i(K,B[n],l[n],s[n],"w-full shrink-0",g?"cursor-not-allowed text-(--neba-disabled-fg)":m?"cursor-pointer bg-(--n-fill) font-semibold text-(--n-on-solid) hover:bg-(--n-fill-hover) active:bg-(--n-fill-active)":"cursor-pointer text-(--neba-fg) hover:bg-(--n-soft) active:bg-(--n-soft-press)"),onClick:()=>{g||d(r)},children:u(o)},o)})},t);return t("div",{ref:N,className:i("flex","compact"===r?"gap-0.5":"gap-1",y),style:{"--n-cell":R[n]},children:[j("hour",w.hour,C,e=>e===A,e=>h?String(e):z(e)),j("minute",w.minute,k,e=>e===D.getMinutes(),z),g?j("second",w.second,Y,e=>e===D.getSeconds(),z):null,h?j("meridiem",w.meridiem,[0,1],e=>(D.getHours()>=12?1:0)===e,e=>0===e?S:M):null,e("span",{className:m,"aria-live":"polite",children:null===c?"":T(a,{hour:"numeric",minute:"2-digit",...g?{second:"2-digit"}:{}}).format(c)})]})}
@@ -1 +1 @@
1
- import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import*as a from"react";import{Box as l}from"../components/box/Box.js";import{bandScale as i,categoryAt as r,categoryCount as s,categoryExtent as o,chartFontSizes as c,compactNumber as d,extentOf as u,fitsLast as h,formatCategory as m,markerRadii as f,plotHeights as x,seriesColor as p,showsTick as g,textWidth as b,tickStride as v,toValues as y,truncate as k,valueScale as w}from"./chart.js";import{numberFormatter as M}from"./format.js";import{emptyMessages as N,useMessages as z}from"./i18n.js";import{cx as S,metaTextClasses as C,srOnlyClasses as A,transitionClasses as P}from"./styles.js";const j="undefined"==typeof document?a.useEffect:a.useLayoutEffect,W=[];function B(e){const[t,n]=a.useState(0);return j(()=>{const t=e.current;if(!t)return;const a=()=>n(t.clientWidth);if(a(),"undefined"==typeof ResizeObserver)return;const l=new ResizeObserver(a);return l.observe(t),()=>l.disconnect()},[e]),t}function R(e){const[t,n]=a.useState(()=>{const t=new Set;return e.forEach((e,n)=>{e.hidden&&t.add(n)}),t}),[l,i]=a.useState(null),r=a.useCallback(e=>{n(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);return{visible:e.map((e,n)=>!t.has(n)),hovered:l,toggle:r,setHovered:i}}const F={top:"flex-col-reverse",bottom:"flex-col",left:"flex-row-reverse",right:"flex-row"},E={start:"justify-start",center:"justify-center",end:"justify-end"};function H({series:a,colors:l,options:i,visibility:r,size:s,values:o,swatch:c}){const d=!1!==i.interactive,u="left"===i.side||"right"===i.side;return e("ul",{className:S("flex list-none flex-wrap items-center gap-x-3 gap-y-1 p-0",u?"min-w-0 flex-col items-start":"",E[i.align??"center"],C[s]),children:a.map((a,i)=>{const s=r.visible[i],u=null!==r.hovered&&r.hovered!==i,h=a.name??`${i+1}`,m=s?l[i]:"var(--neba-disabled-fg)",f=n(t,{children:[e("span",c?{"aria-hidden":"true",className:"flex size-2.5 shrink-0 items-center justify-center",children:c(i,m)}:{"aria-hidden":"true",className:"size-2.5 shrink-0 rounded-[0.1875rem]",style:{backgroundColor:m}}),e("span",{className:"min-w-0 truncate",children:h}),o?.[i]?e("span",{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:o[i]}):null]});return e("li",{className:"min-w-0",children:d?e("button",{type:"button","aria-pressed":s,onClick:()=>r.toggle(i),onPointerEnter:()=>r.setHovered(i),onPointerLeave:()=>r.setHovered(null),onFocus:()=>r.setHovered(i),onBlur:()=>r.setHovered(null),className:S("flex min-w-0 cursor-pointer items-center gap-1.5 rounded-(--neba-radius-xs)","px-1 py-0.5 text-(--neba-fg)",P,"hover:bg-(--n-soft)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1",s?"":"text-(--neba-disabled-fg)",u?"opacity-55":""),children:f}):e("span",{className:S("flex min-w-0 items-center gap-1.5 px-1 py-0.5 text-(--neba-fg)",s?"":"text-(--neba-disabled-fg)"),children:f})},a.name??i)})})}function I({steps:a,from:l,to:i,middle:r,align:s,vertical:o,size:c}){return e("div",{className:S("flex",o?"":E[s]),children:n("div",{className:S("grid grid-cols-[auto_auto_auto] items-center gap-x-2",C[c]),children:[e("span",{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:l}),e("span",{"aria-hidden":"true",className:S("flex h-2.5 overflow-hidden rounded-[0.1875rem]",o?"w-20":"w-24"),children:a.map(t=>e("span",{className:"h-full flex-1",style:{backgroundColor:t}},t))}),e("span",{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:i}),r?n(t,{children:[e("span",{}),e("span",{className:"text-center tabular-nums text-(--neba-muted-fg)",children:r}),e("span",{})]}):null]})})}function _({heading:t,items:a,x:l,y:i,flip:r,size:s}){return n("div",{role:"status","aria-live":"polite",className:S("pointer-events-none absolute z-10 max-w-56 min-w-24","rounded-(--neba-radius-sm) border p-2","[background-image:var(--neba-grain),var(--neba-sheen)]","[background-blend-mode:overlay,normal] [backdrop-filter:var(--neba-blur)]","bg-(--neba-panel-press) [border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-2),var(--neba-plate-glass)]",C[s]),style:r?{right:`calc(100% - ${l}px + 10px)`,top:i}:{left:l+10,top:i},children:[e("div",{className:"mb-1 font-medium text-(--neba-fg)",children:t}),e("ul",{className:"flex list-none flex-col gap-0.5 p-0",children:a.map(t=>n("li",{className:"flex items-center gap-1.5",children:[e("span",{"aria-hidden":"true",className:"size-2 shrink-0 rounded-[0.125rem]",style:{backgroundColor:t.color}}),t.name?e("span",{className:"min-w-0 flex-1 truncate text-(--neba-muted-fg)",children:t.name}):null,e("span",{className:"ms-auto shrink-0 font-medium tabular-nums text-(--neba-fg)",children:t.label??t.formatted})]},t.seriesIndex))})]})}function T({id:t,caption:a,corner:l,categories:i,series:r,values:s,format:o,locale:c}){return n("table",{id:t,className:A,children:[a?e("caption",{children:a}):null,e("thead",{children:n("tr",{children:[e("th",{scope:"col",children:l??""}),r.map((t,n)=>e("th",{scope:"col",children:t.name??n+1},t.name??n))]})}),e("tbody",{children:i.map((t,a)=>n("tr",{children:[e("th",{scope:"row",children:m(t,c)}),r.map((t,n)=>{const l=s[n]?.[a];return e("td",void 0!==l?.label?{children:l.label}:{children:null==l?.value?"":o(l.value)},t.name??n)})]},a))})]})}function $({legend:t,legendSide:a,children:i,table:r,className:s,...o}){return n(l,{...o,className:S("relative flex gap-3",F[a],s??void 0),children:[e("div",{className:"relative min-w-0 flex-1",children:i}),t,r]})}export function CartesianChart({series:t,categories:l,xAxis:h,yAxis:g,horizontal:v=!1,stacked:A=!1,includeZero:P=!0,bandRatio:j=1,inset:F=!1,headroom:E=0,markInset:I=0,xScale:V="band",marks:D,markRadius:X=24,table:Y,swatch:Z,scale:O,markTooltip:K,height:U,format:q,locale:G,label:J,legend:Q,tooltip:ee,empty:te,size:ne="md",variant:ae="text",padded:le=!1,className:ie,children:re,...se}){const oe=a.useRef(null),ce=B(oe),de=z(N,G),ue=a.useId(),he=R(t),[me,fe]=a.useState(null),[xe,pe]=a.useState(null),[ge,be]=a.useState(null),ve=a.useCallback(e=>q?M(G,q).format(e):d(e,G),[q,G]),ye=a.useMemo(()=>y(t),[t]),ke=a.useMemo(()=>t.map((e,t)=>p(e,t)),[t]),we=s(t),Me=a.useMemo(()=>Array.from({length:we},(e,t)=>r(t,l,ye)),[we,l,ye]),Ne=ye.filter((e,t)=>he.visible[t]),ze=u(Ne,A),Se="number"==typeof U?U:void 0===U?x[ne]:null,Ce=c[ne],Ae=g,Pe=h,je=O??w(ze,{min:Ae?.min,max:Ae?.max,tickCount:Ae?.tickCount,includeZero:P}),We="value"===V?o(Ne,l):null,Be="value"===V?w(We,{min:Pe?.min,max:Pe?.max,tickCount:Pe?.tickCount,includeZero:!1}):null,Re=je.ticks.map((e,t)=>Ae?.tickFormat?String(Ae.tickFormat(e,t)):ve(e)),Fe=Be?Be.ticks.map((e,t)=>Pe?.tickFormat?String(Pe.tickFormat(e,t)):d(e,G)):Me.map((e,t)=>Pe?.tickFormat?String(Pe.tickFormat(e,t)):m(e,G)),Ee=Re.reduce((e,t)=>Math.max(e,b(t,Ce)),0),He=Ce+6,Ie=Ae?.hidden?0:Ee+10+(Ae?.label?He:0),_e=(ce-(v?0:Ie)-16)/Math.max(1,we),Te=Be?Fe:v||_e-6>=2.4*Ce?Fe.map(e=>k(e,v?150:_e-6,Ce)):Fe,$e=Te.reduce((e,t)=>Math.max(e,b(t,Ce)),0),Le=v?Pe?.hidden?0:$e+10+(Pe?.label?He:0):Ie,Ve=v?Ae?.hidden?0:Ce+12+(Ae?.label?He:0):Pe?.hidden?0:Ce+12+(Pe?.label?He:0),De=(v?Pe:Ae)?.thickness??Le,Xe=(v?Ae:Pe)?.thickness??Ve,Ye=(v||Be?12:Math.max(8,Te.length?$e/2:8))+I,Ze=f[ne]+4+E+I,Oe=Se??0,Ke={left:De+I,top:Ze,width:Math.max(0,ce-De-I-Ye),height:Math.max(0,Oe-Ze-Xe-I)},Ue=v?Ke.height:Ke.width,qe=i(F?Math.max(1,we-1):we,Ue,j),Ge=a.useCallback(e=>F?we<=1?Ue/2:Ue*e/(we-1):qe.centre(e),[F,we,Ue,qe]),Je=a.useCallback(e=>v?Ke.left+je.fraction(e)*Ke.width:Ke.top+(1-je.fraction(e))*Ke.height,[v,Ke.left,Ke.top,Ke.width,Ke.height,je]),Qe=a.useCallback((e,t)=>v?{x:Je(t),y:Ke.top+Ge(e)}:{x:Ke.left+Ge(e),y:Je(t)},[v,Je,Ge,Ke.left,Ke.top]),et=a.useCallback(e=>v?Ke.top+(1-(Be?.fraction(e)??0))*Ke.height:Ke.left+(Be?.fraction(e)??0)*Ke.width,[v,Ke.left,Ke.top,Ke.width,Ke.height,Be]),tt=Je(Math.min(Math.max(0,je.min),je.max)),nt={plot:Ke,values:ye,visible:he.visible,colors:ke,scale:je,band:qe,horizontal:v,valuePx:Je,categoryPx:Ge,point:Qe,categoryScale:Be,categoryValuePx:et,zeroPx:tt,categories:Me,format:ve,size:ne},at=D?D(nt):W,lt=!1===ee?{mode:"none"}:!0===ee||void 0===ee?{}:ee,it=lt.mode??(D?"item":"index"),rt=null===xe?null:at[xe]??null,st=D?rt?rt.index:null:me,ot=D?at.length:we,ct=()=>{fe(null),pe(null),be(null)},dt=e=>{const t=null===e?null:Math.min(ot-1,Math.max(0,e));D?pe(t):fe(t)},ut=e=>{be(null);dt(((D?xe:me)??(e>0?-1:ot))+e)},ht=null===st?[]:t.flatMap((e,t)=>{if(!he.visible[t]||rt&&rt.series!==t)return[];const n=ye[t]?.[st];return n&&null!==n.value?[{seriesIndex:t,name:e.name,color:n.color??ke[t],value:n.value,formatted:ve(n.value),label:n.label}]:[]}),mt=rt&&K?K(rt):null,ft=mt?mt.items:"item"===it&&ht.length>1&&null!==ge?[ht.reduce((e,t)=>Math.abs(Je(t.value??0)-ge)<Math.abs(Je(e.value??0)-ge)?t:e)]:ht,xt=rt?ye[rt.series]?.[rt.index]?.x??l?.[rt.index]??rt.index:void 0,pt=rt?rt.x:v?Je(ft[0]?.value??0):Ke.left+Ge(st??0),gt=rt?rt.y:v?Ke.top+Ge(st??0):Ke.top,bt=rt?(rt.x-Ke.left)/Math.max(1,Ke.width)>.6:(v?je.fraction(ft[0]?.value??0):Ge(st??0)/Math.max(1,Ue))>.6,vt=!1===Q?{interactive:!1}:!0===Q||void 0===Q?{}:Q,yt=!0===Q||!1!==Q&&t.length>1,kt=vt.side??"bottom",wt={...nt,hovered:he.hovered,activeIndex:st,marks:at,activeMark:rt},Mt=0===we||null===ze||"value"===V&&null===We;return e($,{...se,size:ne,variant:ae,padded:le,className:ie,legendSide:kt,legend:yt?e(H,{series:t,colors:ke,options:vt,visibility:he,size:ne,swatch:Z,values:vt.showValue&&null!==st?t.map((e,t)=>{const n=ye[t]?.[st]?.value;return null==n?void 0:ve(n)}):void 0}):null,table:Mt?null:Y?.(ue)??e(T,{id:ue,caption:J,corner:Pe?.label,categories:Me,series:t,values:ye,format:ve,locale:G}),children:n("div",{ref:oe,role:"img",tabIndex:Mt?void 0:0,"aria-label":J,"aria-describedby":Mt?void 0:ue,onPointerMove:e=>{"none"!==it&&(D?pe(((e,t)=>{const n=oe.current;if(!n||0===at.length)return null;const a=n.getBoundingClientRect(),l=e-a.left,i=t-a.top;let r=null,s=1/0,o=1/0;return at.forEach((e,t)=>{const n=Math.hypot(e.x-l,e.y-i),a=void 0===e.rx?Math.max(0,n-e.r):Math.hypot(Math.max(0,Math.abs(e.x-l)-e.rx),Math.max(0,Math.abs(e.y-i)-(e.ry??e.rx)));a<=X&&(a<s||a===s&&n<o)&&(s=a,o=n,r=t)}),r})(e.clientX,e.clientY)):fe(((e,t)=>{const n=oe.current;if(!n||0===we)return null;const a=n.getBoundingClientRect(),l=v?t-a.top-Ke.top:e-a.left-Ke.left;if(l<-qe.step||l>Ue+qe.step)return null;const i=F?we<=1?0:Math.round(l/Ue*(we-1)):Math.floor(l/qe.step);return Math.min(we-1,Math.max(0,i))})(e.clientX,e.clientY)),"item"===it&&be(((e,t)=>{const n=oe.current;if(!n)return null;const a=n.getBoundingClientRect();return v?e-a.left:t-a.top})(e.clientX,e.clientY)))},onPointerLeave:ct,onKeyDown:"none"===it?void 0:e=>{const t=v?"ArrowDown":"ArrowRight",n=v?"ArrowUp":"ArrowLeft";if(e.key===t)ut(1);else if(e.key===n)ut(-1);else if("Home"===e.key)dt(0);else if("End"===e.key)dt(ot-1);else{if("Escape"!==e.key)return;ct()}e.preventDefault()},onBlur:ct,className:S("relative w-full","rounded-(--neba-radius-xs)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"),style:{height:Se??U},children:[Mt?e("div",{className:S("flex h-full items-center justify-center text-(--neba-muted-fg)",C[ne]),children:te??de.title}):ce>0?n("svg",{width:ce,height:Oe||"100%",viewBox:`0 0 ${ce} ${Oe}`,"aria-hidden":"true",className:"block overflow-visible",children:[e(L,{plot:Ke,scale:je,band:qe,horizontal:v,inset:F,categoryPx:Ge,valuePx:Je,tickTexts:Re,categoryTexts:Te,categoryScale:Be,categoryValuePx:et,valueAxis:Ae,categoryAxis:Pe,fontSize:Ce,zeroPx:tt}),null===st||D||"index"!==it||!1===lt.crosshair?null:(()=>{const t=Ge(st);return e("line",v?{x1:Ke.left,x2:Ke.left+Ke.width,y1:Ke.top+t,y2:Ke.top+t,stroke:"var(--neba-chart-baseline)",strokeWidth:1}:{x1:Ke.left+t,x2:Ke.left+t,y1:Ke.top,y2:Ke.top+Ke.height,stroke:"var(--neba-chart-baseline)",strokeWidth:1})})(),re(wt)]}):null,null!==st&&ft.length>0&&"none"!==it?lt.render?e("div",{className:"pointer-events-none absolute z-10",style:bt?{right:`calc(100% - ${pt}px + 10px)`,top:gt}:{left:pt+10,top:gt},children:lt.render({index:st,category:xt??Me[st],items:ft})}):e(_,{heading:mt?mt.heading:m(xt??Me[st],G),items:ft,x:pt,y:gt,flip:bt,size:ne}):null]})})}function L({plot:a,scale:l,horizontal:i,categoryPx:r,valuePx:s,tickTexts:o,categoryTexts:c,categoryScale:d,categoryValuePx:u,valueAxis:m,categoryAxis:f,fontSize:x,zeroPx:p}){const y=!1!==m?.grid&&!m?.hidden,k=!f?.hidden&&(f?.grid??null!==d),w=e=>d?u(d.ticks[e]):(i?a.top:a.left)+r(e),M=v(c.length,i?a.height:a.width,i?1.8*x:Math.max(...c.map(e=>b(e,x)),1)+12),N=v(l.ticks.length,i?a.width:a.height,i?Math.max(...o.map(e=>b(e,x)),1)+16:2*x),z=c.length>1?Math.abs(w(1)-w(0)):a.width,S=l.ticks.length>1?Math.abs(s(l.ticks[1])-s(l.ticks[0])):a.height,C=h(c.length,M,z,i?1.8*x:b(c[c.length-1]??"",x)),A=h(l.ticks.length,N,S,i?b(o[o.length-1]??"",x):1.6*x);return n("g",{children:[l.ticks.map((t,r)=>{const c=s(t),d=Math.abs(t)<1e-9;return n("g",{children:[y?e("line",i?{x1:c,x2:c,y1:a.top,y2:a.top+a.height,stroke:d?"var(--neba-chart-baseline)":"var(--neba-chart-grid)",strokeWidth:1}:{x1:a.left,x2:a.left+a.width,y1:c,y2:c,stroke:d?"var(--neba-chart-baseline)":"var(--neba-chart-grid)",strokeWidth:1}):null,m?.hidden||!g(r,l.ticks.length,N,A)?null:e("text",i?{x:c,y:a.top+a.height+x+6,textAnchor:0===r?"start":r===l.ticks.length-1?"end":"middle",fontSize:x,fill:"var(--neba-muted-fg)",className:"tabular-nums",children:o[r]}:{x:a.left-8,y:c,textAnchor:"end",dominantBaseline:"central",fontSize:x,fill:"var(--neba-muted-fg)",className:"tabular-nums",children:o[r]})]},t)}),f?.hidden?null:n(t,{children:[e("line",i?{x1:p,x2:p,y1:a.top,y2:a.top+a.height,stroke:"var(--neba-chart-axis)",strokeWidth:1}:{x1:a.left,x2:a.left+a.width,y1:p,y2:p,stroke:"var(--neba-chart-axis)",strokeWidth:1}),c.map((t,l)=>{const r=w(l),s=g(l,c.length,M,C);return i?s?e("text",{x:a.left-8,y:r,textAnchor:"end",dominantBaseline:"central",fontSize:x,fill:"var(--neba-muted-fg)",className:d?"tabular-nums":void 0,children:t},l):null:n("g",{children:[k?e("line",{x1:r,x2:r,y1:a.top,y2:a.top+a.height,stroke:"var(--neba-chart-grid)",strokeWidth:1}):null,s?e("text",{x:r,y:a.top+a.height+x+6,textAnchor:d?0===l?"start":l===c.length-1?"end":"middle":"middle",fontSize:x,fill:"var(--neba-muted-fg)",className:d?"tabular-nums":void 0,children:t}):null]},l)})]}),m?.label?e("text",{x:i?a.left+a.width:a.left,y:i?a.top+a.height+2*x+12:a.top-8,textAnchor:i?"end":"start",fontSize:x,fill:"var(--neba-muted-fg)",fontWeight:500,children:m.label}):null,f?.label&&!i?e("text",{x:a.left+a.width,y:a.top+a.height+2*x+12,textAnchor:"end",fontSize:x,fill:"var(--neba-muted-fg)",fontWeight:500,children:f.label}):null]})}export{T as ChartDataTable,H as ChartLegendBar,I as ChartScaleLegend,$ as ChartSurface,_ as ChartTooltipPanel,B as useMeasuredWidth,R as useVisibility};
1
+ "use client";import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import*as a from"react";import{Box as l}from"../components/box/Box.js";import{bandScale as i,categoryAt as r,categoryCount as s,categoryExtent as o,chartFontSizes as c,compactNumber as d,extentOf as u,fitsLast as h,formatCategory as m,markerRadii as f,plotHeights as x,seriesColor as p,showsTick as g,textWidth as b,tickStride as v,toValues as y,truncate as k,valueScale as w}from"./chart.js";import{numberFormatter as M}from"./format.js";import{emptyMessages as N,useMessages as z}from"./i18n.js";import{cx as S,metaTextClasses as C,srOnlyClasses as A,transitionClasses as P}from"./styles.js";const j="undefined"==typeof document?a.useEffect:a.useLayoutEffect,W=[];function B(e){const[t,n]=a.useState(0);return j(()=>{const t=e.current;if(!t)return;const a=()=>n(t.clientWidth);if(a(),"undefined"==typeof ResizeObserver)return;const l=new ResizeObserver(a);return l.observe(t),()=>l.disconnect()},[e]),t}function R(e){const[t,n]=a.useState(()=>{const t=new Set;return e.forEach((e,n)=>{e.hidden&&t.add(n)}),t}),[l,i]=a.useState(null),r=a.useCallback(e=>{n(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);return{visible:e.map((e,n)=>!t.has(n)),hovered:l,toggle:r,setHovered:i}}const F={top:"flex-col-reverse",bottom:"flex-col",left:"flex-row-reverse",right:"flex-row"},E={start:"justify-start",center:"justify-center",end:"justify-end"};function H({series:a,colors:l,options:i,visibility:r,size:s,values:o,swatch:c}){const d=!1!==i.interactive,u="left"===i.side||"right"===i.side;return e("ul",{className:S("flex list-none flex-wrap items-center gap-x-3 gap-y-1 p-0",u?"min-w-0 flex-col items-start":"",E[i.align??"center"],C[s]),children:a.map((a,i)=>{const s=r.visible[i],u=null!==r.hovered&&r.hovered!==i,h=a.name??`${i+1}`,m=s?l[i]:"var(--neba-disabled-fg)",f=n(t,{children:[e("span",c?{"aria-hidden":"true",className:"flex size-2.5 shrink-0 items-center justify-center",children:c(i,m)}:{"aria-hidden":"true",className:"size-2.5 shrink-0 rounded-[0.1875rem]",style:{backgroundColor:m}}),e("span",{className:"min-w-0 truncate",children:h}),o?.[i]?e("span",{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:o[i]}):null]});return e("li",{className:"min-w-0",children:d?e("button",{type:"button","aria-pressed":s,onClick:()=>r.toggle(i),onPointerEnter:()=>r.setHovered(i),onPointerLeave:()=>r.setHovered(null),onFocus:()=>r.setHovered(i),onBlur:()=>r.setHovered(null),className:S("flex min-w-0 cursor-pointer items-center gap-1.5 rounded-(--neba-radius-xs)","px-1 py-0.5 text-(--neba-fg)",P,"hover:bg-(--n-soft)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1",s?"":"text-(--neba-disabled-fg)",u?"opacity-55":""),children:f}):e("span",{className:S("flex min-w-0 items-center gap-1.5 px-1 py-0.5 text-(--neba-fg)",s?"":"text-(--neba-disabled-fg)"),children:f})},a.name??i)})})}function I({steps:a,from:l,to:i,middle:r,align:s,vertical:o,size:c}){return e("div",{className:S("flex",o?"":E[s]),children:n("div",{className:S("grid grid-cols-[auto_auto_auto] items-center gap-x-2",C[c]),children:[e("span",{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:l}),e("span",{"aria-hidden":"true",className:S("flex h-2.5 overflow-hidden rounded-[0.1875rem]",o?"w-20":"w-24"),children:a.map(t=>e("span",{className:"h-full flex-1",style:{backgroundColor:t}},t))}),e("span",{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:i}),r?n(t,{children:[e("span",{}),e("span",{className:"text-center tabular-nums text-(--neba-muted-fg)",children:r}),e("span",{})]}):null]})})}function _({heading:t,items:a,x:l,y:i,flip:r,size:s}){return n("div",{role:"status","aria-live":"polite",className:S("pointer-events-none absolute z-10 max-w-56 min-w-24","rounded-(--neba-radius-sm) border p-2","[background-image:var(--neba-grain),var(--neba-sheen)]","[background-blend-mode:overlay,normal] [backdrop-filter:var(--neba-blur)]","bg-(--neba-panel-press) [border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-2),var(--neba-plate-glass)]",C[s]),style:r?{right:`calc(100% - ${l}px + 10px)`,top:i}:{left:l+10,top:i},children:[e("div",{className:"mb-1 font-medium text-(--neba-fg)",children:t}),e("ul",{className:"flex list-none flex-col gap-0.5 p-0",children:a.map(t=>n("li",{className:"flex items-center gap-1.5",children:[e("span",{"aria-hidden":"true",className:"size-2 shrink-0 rounded-[0.125rem]",style:{backgroundColor:t.color}}),t.name?e("span",{className:"min-w-0 flex-1 truncate text-(--neba-muted-fg)",children:t.name}):null,e("span",{className:"ms-auto shrink-0 font-medium tabular-nums text-(--neba-fg)",children:t.label??t.formatted})]},t.seriesIndex))})]})}function T({id:t,caption:a,corner:l,categories:i,series:r,values:s,format:o,locale:c}){return n("table",{id:t,className:A,children:[a?e("caption",{children:a}):null,e("thead",{children:n("tr",{children:[e("th",{scope:"col",children:l??""}),r.map((t,n)=>e("th",{scope:"col",children:t.name??n+1},t.name??n))]})}),e("tbody",{children:i.map((t,a)=>n("tr",{children:[e("th",{scope:"row",children:m(t,c)}),r.map((t,n)=>{const l=s[n]?.[a];return e("td",void 0!==l?.label?{children:l.label}:{children:null==l?.value?"":o(l.value)},t.name??n)})]},a))})]})}function $({legend:t,legendSide:a,children:i,table:r,className:s,...o}){return n(l,{...o,className:S("relative flex gap-3",F[a],s??void 0),children:[e("div",{className:"relative min-w-0 flex-1",children:i}),t,r]})}export function CartesianChart({series:t,categories:l,xAxis:h,yAxis:g,horizontal:v=!1,stacked:A=!1,includeZero:P=!0,bandRatio:j=1,inset:F=!1,headroom:E=0,markInset:I=0,xScale:V="band",marks:D,markRadius:X=24,table:Y,swatch:Z,scale:O,markTooltip:K,height:U,format:q,locale:G,label:J,legend:Q,tooltip:ee,empty:te,size:ne="md",variant:ae="text",padded:le=!1,className:ie,children:re,...se}){const oe=a.useRef(null),ce=B(oe),de=z(N,G),ue=a.useId(),he=R(t),[me,fe]=a.useState(null),[xe,pe]=a.useState(null),[ge,be]=a.useState(null),ve=a.useCallback(e=>q?M(G,q).format(e):d(e,G),[q,G]),ye=a.useMemo(()=>y(t),[t]),ke=a.useMemo(()=>t.map((e,t)=>p(e,t)),[t]),we=s(t),Me=a.useMemo(()=>Array.from({length:we},(e,t)=>r(t,l,ye)),[we,l,ye]),Ne=ye.filter((e,t)=>he.visible[t]),ze=u(Ne,A),Se="number"==typeof U?U:void 0===U?x[ne]:null,Ce=c[ne],Ae=g,Pe=h,je=O??w(ze,{min:Ae?.min,max:Ae?.max,tickCount:Ae?.tickCount,includeZero:P}),We="value"===V?o(Ne,l):null,Be="value"===V?w(We,{min:Pe?.min,max:Pe?.max,tickCount:Pe?.tickCount,includeZero:!1}):null,Re=je.ticks.map((e,t)=>Ae?.tickFormat?String(Ae.tickFormat(e,t)):ve(e)),Fe=Be?Be.ticks.map((e,t)=>Pe?.tickFormat?String(Pe.tickFormat(e,t)):d(e,G)):Me.map((e,t)=>Pe?.tickFormat?String(Pe.tickFormat(e,t)):m(e,G)),Ee=Re.reduce((e,t)=>Math.max(e,b(t,Ce)),0),He=Ce+6,Ie=Ae?.hidden?0:Ee+10+(Ae?.label?He:0),_e=(ce-(v?0:Ie)-16)/Math.max(1,we),Te=Be?Fe:v||_e-6>=2.4*Ce?Fe.map(e=>k(e,v?150:_e-6,Ce)):Fe,$e=Te.reduce((e,t)=>Math.max(e,b(t,Ce)),0),Le=v?Pe?.hidden?0:$e+10+(Pe?.label?He:0):Ie,Ve=v?Ae?.hidden?0:Ce+12+(Ae?.label?He:0):Pe?.hidden?0:Ce+12+(Pe?.label?He:0),De=(v?Pe:Ae)?.thickness??Le,Xe=(v?Ae:Pe)?.thickness??Ve,Ye=(v||Be?12:Math.max(8,Te.length?$e/2:8))+I,Ze=f[ne]+4+E+I,Oe=Se??0,Ke={left:De+I,top:Ze,width:Math.max(0,ce-De-I-Ye),height:Math.max(0,Oe-Ze-Xe-I)},Ue=v?Ke.height:Ke.width,qe=i(F?Math.max(1,we-1):we,Ue,j),Ge=a.useCallback(e=>F?we<=1?Ue/2:Ue*e/(we-1):qe.centre(e),[F,we,Ue,qe]),Je=a.useCallback(e=>v?Ke.left+je.fraction(e)*Ke.width:Ke.top+(1-je.fraction(e))*Ke.height,[v,Ke.left,Ke.top,Ke.width,Ke.height,je]),Qe=a.useCallback((e,t)=>v?{x:Je(t),y:Ke.top+Ge(e)}:{x:Ke.left+Ge(e),y:Je(t)},[v,Je,Ge,Ke.left,Ke.top]),et=a.useCallback(e=>v?Ke.top+(1-(Be?.fraction(e)??0))*Ke.height:Ke.left+(Be?.fraction(e)??0)*Ke.width,[v,Ke.left,Ke.top,Ke.width,Ke.height,Be]),tt=Je(Math.min(Math.max(0,je.min),je.max)),nt={plot:Ke,values:ye,visible:he.visible,colors:ke,scale:je,band:qe,horizontal:v,valuePx:Je,categoryPx:Ge,point:Qe,categoryScale:Be,categoryValuePx:et,zeroPx:tt,categories:Me,format:ve,size:ne},at=D?D(nt):W,lt=!1===ee?{mode:"none"}:!0===ee||void 0===ee?{}:ee,it=lt.mode??(D?"item":"index"),rt=null===xe?null:at[xe]??null,st=D?rt?rt.index:null:me,ot=D?at.length:we,ct=()=>{fe(null),pe(null),be(null)},dt=e=>{const t=null===e?null:Math.min(ot-1,Math.max(0,e));D?pe(t):fe(t)},ut=e=>{be(null);dt(((D?xe:me)??(e>0?-1:ot))+e)},ht=null===st?[]:t.flatMap((e,t)=>{if(!he.visible[t]||rt&&rt.series!==t)return[];const n=ye[t]?.[st];return n&&null!==n.value?[{seriesIndex:t,name:e.name,color:n.color??ke[t],value:n.value,formatted:ve(n.value),label:n.label}]:[]}),mt=rt&&K?K(rt):null,ft=mt?mt.items:"item"===it&&ht.length>1&&null!==ge?[ht.reduce((e,t)=>Math.abs(Je(t.value??0)-ge)<Math.abs(Je(e.value??0)-ge)?t:e)]:ht,xt=rt?ye[rt.series]?.[rt.index]?.x??l?.[rt.index]??rt.index:void 0,pt=rt?rt.x:v?Je(ft[0]?.value??0):Ke.left+Ge(st??0),gt=rt?rt.y:v?Ke.top+Ge(st??0):Ke.top,bt=rt?(rt.x-Ke.left)/Math.max(1,Ke.width)>.6:(v?je.fraction(ft[0]?.value??0):Ge(st??0)/Math.max(1,Ue))>.6,vt=!1===Q?{interactive:!1}:!0===Q||void 0===Q?{}:Q,yt=!0===Q||!1!==Q&&t.length>1,kt=vt.side??"bottom",wt={...nt,hovered:he.hovered,activeIndex:st,marks:at,activeMark:rt},Mt=0===we||null===ze||"value"===V&&null===We;return e($,{...se,size:ne,variant:ae,padded:le,className:ie,legendSide:kt,legend:yt?e(H,{series:t,colors:ke,options:vt,visibility:he,size:ne,swatch:Z,values:vt.showValue&&null!==st?t.map((e,t)=>{const n=ye[t]?.[st]?.value;return null==n?void 0:ve(n)}):void 0}):null,table:Mt?null:Y?.(ue)??e(T,{id:ue,caption:J,corner:Pe?.label,categories:Me,series:t,values:ye,format:ve,locale:G}),children:n("div",{ref:oe,role:"img",tabIndex:Mt?void 0:0,"aria-label":J,"aria-describedby":Mt?void 0:ue,onPointerMove:e=>{"none"!==it&&(D?pe(((e,t)=>{const n=oe.current;if(!n||0===at.length)return null;const a=n.getBoundingClientRect(),l=e-a.left,i=t-a.top;let r=null,s=1/0,o=1/0;return at.forEach((e,t)=>{const n=Math.hypot(e.x-l,e.y-i),a=void 0===e.rx?Math.max(0,n-e.r):Math.hypot(Math.max(0,Math.abs(e.x-l)-e.rx),Math.max(0,Math.abs(e.y-i)-(e.ry??e.rx)));a<=X&&(a<s||a===s&&n<o)&&(s=a,o=n,r=t)}),r})(e.clientX,e.clientY)):fe(((e,t)=>{const n=oe.current;if(!n||0===we)return null;const a=n.getBoundingClientRect(),l=v?t-a.top-Ke.top:e-a.left-Ke.left;if(l<-qe.step||l>Ue+qe.step)return null;const i=F?we<=1?0:Math.round(l/Ue*(we-1)):Math.floor(l/qe.step);return Math.min(we-1,Math.max(0,i))})(e.clientX,e.clientY)),"item"===it&&be(((e,t)=>{const n=oe.current;if(!n)return null;const a=n.getBoundingClientRect();return v?e-a.left:t-a.top})(e.clientX,e.clientY)))},onPointerLeave:ct,onKeyDown:"none"===it?void 0:e=>{const t=v?"ArrowDown":"ArrowRight",n=v?"ArrowUp":"ArrowLeft";if(e.key===t)ut(1);else if(e.key===n)ut(-1);else if("Home"===e.key)dt(0);else if("End"===e.key)dt(ot-1);else{if("Escape"!==e.key)return;ct()}e.preventDefault()},onBlur:ct,className:S("relative w-full","rounded-(--neba-radius-xs)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"),style:{height:Se??U},children:[Mt?e("div",{className:S("flex h-full items-center justify-center text-(--neba-muted-fg)",C[ne]),children:te??de.title}):ce>0?n("svg",{width:ce,height:Oe||"100%",viewBox:`0 0 ${ce} ${Oe}`,"aria-hidden":"true",className:"block overflow-visible",children:[e(L,{plot:Ke,scale:je,band:qe,horizontal:v,inset:F,categoryPx:Ge,valuePx:Je,tickTexts:Re,categoryTexts:Te,categoryScale:Be,categoryValuePx:et,valueAxis:Ae,categoryAxis:Pe,fontSize:Ce,zeroPx:tt}),null===st||D||"index"!==it||!1===lt.crosshair?null:(()=>{const t=Ge(st);return e("line",v?{x1:Ke.left,x2:Ke.left+Ke.width,y1:Ke.top+t,y2:Ke.top+t,stroke:"var(--neba-chart-baseline)",strokeWidth:1}:{x1:Ke.left+t,x2:Ke.left+t,y1:Ke.top,y2:Ke.top+Ke.height,stroke:"var(--neba-chart-baseline)",strokeWidth:1})})(),re(wt)]}):null,null!==st&&ft.length>0&&"none"!==it?lt.render?e("div",{className:"pointer-events-none absolute z-10",style:bt?{right:`calc(100% - ${pt}px + 10px)`,top:gt}:{left:pt+10,top:gt},children:lt.render({index:st,category:xt??Me[st],items:ft})}):e(_,{heading:mt?mt.heading:m(xt??Me[st],G),items:ft,x:pt,y:gt,flip:bt,size:ne}):null]})})}function L({plot:a,scale:l,horizontal:i,categoryPx:r,valuePx:s,tickTexts:o,categoryTexts:c,categoryScale:d,categoryValuePx:u,valueAxis:m,categoryAxis:f,fontSize:x,zeroPx:p}){const y=!1!==m?.grid&&!m?.hidden,k=!f?.hidden&&(f?.grid??null!==d),w=e=>d?u(d.ticks[e]):(i?a.top:a.left)+r(e),M=v(c.length,i?a.height:a.width,i?1.8*x:Math.max(...c.map(e=>b(e,x)),1)+12),N=v(l.ticks.length,i?a.width:a.height,i?Math.max(...o.map(e=>b(e,x)),1)+16:2*x),z=c.length>1?Math.abs(w(1)-w(0)):a.width,S=l.ticks.length>1?Math.abs(s(l.ticks[1])-s(l.ticks[0])):a.height,C=h(c.length,M,z,i?1.8*x:b(c[c.length-1]??"",x)),A=h(l.ticks.length,N,S,i?b(o[o.length-1]??"",x):1.6*x);return n("g",{children:[l.ticks.map((t,r)=>{const c=s(t),d=Math.abs(t)<1e-9;return n("g",{children:[y?e("line",i?{x1:c,x2:c,y1:a.top,y2:a.top+a.height,stroke:d?"var(--neba-chart-baseline)":"var(--neba-chart-grid)",strokeWidth:1}:{x1:a.left,x2:a.left+a.width,y1:c,y2:c,stroke:d?"var(--neba-chart-baseline)":"var(--neba-chart-grid)",strokeWidth:1}):null,m?.hidden||!g(r,l.ticks.length,N,A)?null:e("text",i?{x:c,y:a.top+a.height+x+6,textAnchor:0===r?"start":r===l.ticks.length-1?"end":"middle",fontSize:x,fill:"var(--neba-muted-fg)",className:"tabular-nums",children:o[r]}:{x:a.left-8,y:c,textAnchor:"end",dominantBaseline:"central",fontSize:x,fill:"var(--neba-muted-fg)",className:"tabular-nums",children:o[r]})]},t)}),f?.hidden?null:n(t,{children:[e("line",i?{x1:p,x2:p,y1:a.top,y2:a.top+a.height,stroke:"var(--neba-chart-axis)",strokeWidth:1}:{x1:a.left,x2:a.left+a.width,y1:p,y2:p,stroke:"var(--neba-chart-axis)",strokeWidth:1}),c.map((t,l)=>{const r=w(l),s=g(l,c.length,M,C);return i?s?e("text",{x:a.left-8,y:r,textAnchor:"end",dominantBaseline:"central",fontSize:x,fill:"var(--neba-muted-fg)",className:d?"tabular-nums":void 0,children:t},l):null:n("g",{children:[k?e("line",{x1:r,x2:r,y1:a.top,y2:a.top+a.height,stroke:"var(--neba-chart-grid)",strokeWidth:1}):null,s?e("text",{x:r,y:a.top+a.height+x+6,textAnchor:d?0===l?"start":l===c.length-1?"end":"middle":"middle",fontSize:x,fill:"var(--neba-muted-fg)",className:d?"tabular-nums":void 0,children:t}):null]},l)})]}),m?.label?e("text",{x:i?a.left+a.width:a.left,y:i?a.top+a.height+2*x+12:a.top-8,textAnchor:i?"end":"start",fontSize:x,fill:"var(--neba-muted-fg)",fontWeight:500,children:m.label}):null,f?.label&&!i?e("text",{x:a.left+a.width,y:a.top+a.height+2*x+12,textAnchor:"end",fontSize:x,fill:"var(--neba-muted-fg)",fontWeight:500,children:f.label}):null]})}export{T as ChartDataTable,H as ChartLegendBar,I as ChartScaleLegend,$ as ChartSurface,_ as ChartTooltipPanel,B as useMeasuredWidth,R as useVisibility};
@@ -11,8 +11,9 @@
11
11
  * knows is data and pixels; `chart-frame.tsx` is where those become elements.
12
12
  *
13
13
  * The scales are deliberately not a `d3-scale`. A linear scale is six lines, a
14
- * band scale is four, and `nice numbers` is twelve — and the package still has
15
- * one runtime dependency, which is the same trade `color.ts` makes.
14
+ * band scale is four, and `nice numbers` is twelve — against a charting stack
15
+ * that would be the largest thing in the package. The same trade `color.ts`
16
+ * makes.
16
17
  */
17
18
  import type * as React from 'react';
18
19
  import type { NebaChartCategory, NebaChartDatum, NebaChartSeries, NebaDensity, NebaSize } from '../types.js';
@@ -4,8 +4,8 @@
4
4
  * ColorPicker is the only component that has to *compute* a colour rather than
5
5
  * name one, and the whole of what it needs is here: three representations, the
6
6
  * conversions between them, one parser and one formatter. It is a hundred lines
7
- * of trigonometry-free arithmetic, which is the entire reason the library still
8
- * has one runtime dependency.
7
+ * of trigonometry-free arithmetic, which is the entire reason a component that
8
+ * computes colours brings no colour library with it.
9
9
  *
10
10
  * Two decisions worth knowing before reading:
11
11
  *
@@ -1,10 +1,9 @@
1
1
  /**
2
2
  * The arithmetic and the naming the four pickers share.
3
3
  *
4
- * No date library under it, deliberately. Neba's one runtime dependency is Base
5
- * UI, and a component library that quietly adds `date-fns` — or worse, picks a
6
- * side in the dayjs/luxon/Temporal argument on its consumer's behalf — has made
7
- * a decision that was not its to make. Everything here is either `Date`
4
+ * No date library under it, deliberately. A component library that quietly adds
5
+ * `date-fns` — or worse, picks a side in the dayjs/luxon/Temporal argument on
6
+ * its consumer's behalf — has made a decision that was not its to make. Everything here is either `Date`
8
7
  * arithmetic, which is a dozen lines, or `Intl`, which the platform already
9
8
  * ships and which knows more about month names in more languages than any
10
9
  * bundled table ever will.
@@ -0,0 +1,97 @@
1
+ /**
2
+ * The grammar engine behind [CodeBlock], and the only thing in the library that
3
+ * is loaded rather than imported.
4
+ *
5
+ * highlight.js is the second runtime dependency Neba has, and it is here for a
6
+ * reason no amount of hand-written regex answers: colouring a language means
7
+ * knowing that language, and there are thirty-four of them. It is reached
8
+ * through `highlight.js/lib/core` plus one module per language — never through
9
+ * the package root, which is all hundred and ninety at once.
10
+ *
11
+ * **Every one of those specifiers is behind an `import()`, and that is the
12
+ * whole design.** A bundler resolves it at build time and emits it as its own
13
+ * chunk, so a page that imports CodeBlock and never highlights anything — a
14
+ * one-line `npm install` with `highlight={false}` — downloads none of it, and a
15
+ * page that highlights TypeScript downloads the core and TypeScript and not the
16
+ * other thirty-three. A component that does the same with a static import
17
+ * spends forty kilobytes before it has drawn a character.
18
+ *
19
+ * The dependency is a real `dependencies` entry rather than an optional peer
20
+ * because a specifier a bundler cannot resolve fails the *whole* build, not
21
+ * just the part that would have used it: Rollup walks and resolves `Code
22
+ * Block.js` while it is still deciding whether to keep it. An optional peer
23
+ * would mean `import { Button } from 'neba'` breaking for anyone who had not
24
+ * installed a syntax highlighter.
25
+ *
26
+ * What comes back out of here is not HTML. highlight.js emits a string of
27
+ * nested `<span>`s, and CodeBlock needs lines — a line is what carries a
28
+ * number, a prompt and a place in a scroll — so `tokenize` turns that string
29
+ * into runs of text with a class on them, split at every newline. That also
30
+ * means nothing in the library ever writes `dangerouslySetInnerHTML`.
31
+ */
32
+ /** One run of text with a single colour: the innermost span highlight.js drew. */
33
+ export interface CodeToken {
34
+ text: string;
35
+ /** The class highlight.js put on it — `hljs-keyword`, `hljs-title function_`. */
36
+ token?: string;
37
+ }
38
+ /** One line of code, as the runs it is made of. An empty array is a blank line. */
39
+ export type CodeLine = CodeToken[];
40
+ /** The core, and what it hands `registerLanguage`. Opaque here; only hljs reads them. */
41
+ type Hljs = typeof import('highlight.js/lib/core').default;
42
+ type LanguageDefinition = Parameters<Hljs['registerLanguage']>[1];
43
+ /**
44
+ * Teaches CodeBlock a language the built-in set does not have.
45
+ *
46
+ * The same arrangement `registerMessages` makes for the eighteen languages the
47
+ * library does not ship, and for the same reason: highlight.js knows a hundred
48
+ * and ninety grammars, a documentation site uses six, and the thirty-four here
49
+ * are a guess at which six. Registering is how a Nix flake or an Elixir project
50
+ * gets coloured without the other hundred and fifty being in anyone's build.
51
+ *
52
+ * ```ts
53
+ * import { registerLanguage } from 'neba';
54
+ * import elixir from 'highlight.js/lib/languages/elixir';
55
+ *
56
+ * registerLanguage('elixir', elixir);
57
+ * ```
58
+ *
59
+ * Call it at module scope. A language registered after a block has drawn does
60
+ * not repaint that block — nothing re-renders on its own — but every block
61
+ * mounted after it sees it.
62
+ *
63
+ * @param name What `language` will be written as. Registering a name the
64
+ * library already has replaces it.
65
+ * @param definition The default export of a `highlight.js/lib/languages/*`
66
+ * module.
67
+ */
68
+ export declare function registerLanguage(name: string, definition: LanguageDefinition): void;
69
+ /** The canonical name a caller's spelling means, whether or not it can be loaded. */
70
+ export declare function canonicalLanguage(language: string | undefined): string | null;
71
+ /**
72
+ * Colours `code`, or returns `null` when the language is unknown or the chunk
73
+ * has not arrived yet.
74
+ *
75
+ * Highlighting the block as a whole and splitting afterwards, never line by
76
+ * line: a block comment, a template literal and a heredoc all span lines, and a
77
+ * highlighter handed one line at a time sees the second line of a comment as
78
+ * code.
79
+ */
80
+ export declare function highlight(code: string, language: string): Promise<CodeLine[] | null>;
81
+ /**
82
+ * highlight.js's own markup, as lines of coloured runs.
83
+ *
84
+ * The output is a strictly nested tree of `<span class="…">` with escaped text
85
+ * between, and a span may cross a newline — which is exactly why this exists
86
+ * rather than a `split('\n')` over the string. Walking it keeps the open class
87
+ * across the break and reopens it on the next line.
88
+ *
89
+ * Only the innermost class survives a nesting. In the browser it is the one on
90
+ * the element the text actually sits in, so it is the one whose colour applies;
91
+ * keeping the ancestors would put two equally specific rules on one run and let
92
+ * stylesheet order decide the colour.
93
+ */
94
+ export declare function tokenize(html: string): CodeLine[];
95
+ /** The same shape with no colour in it: what a block draws before its chunk lands. */
96
+ export declare function plainLines(code: string): CodeLine[];
97
+ export {};
@@ -0,0 +1 @@
1
+ const i={bash:()=>import("highlight.js/lib/languages/bash"),c:()=>import("highlight.js/lib/languages/c"),cpp:()=>import("highlight.js/lib/languages/cpp"),csharp:()=>import("highlight.js/lib/languages/csharp"),css:()=>import("highlight.js/lib/languages/css"),diff:()=>import("highlight.js/lib/languages/diff"),dockerfile:()=>import("highlight.js/lib/languages/dockerfile"),go:()=>import("highlight.js/lib/languages/go"),graphql:()=>import("highlight.js/lib/languages/graphql"),ini:()=>import("highlight.js/lib/languages/ini"),java:()=>import("highlight.js/lib/languages/java"),javascript:()=>import("highlight.js/lib/languages/javascript"),json:()=>import("highlight.js/lib/languages/json"),kotlin:()=>import("highlight.js/lib/languages/kotlin"),less:()=>import("highlight.js/lib/languages/less"),lua:()=>import("highlight.js/lib/languages/lua"),makefile:()=>import("highlight.js/lib/languages/makefile"),markdown:()=>import("highlight.js/lib/languages/markdown"),objectivec:()=>import("highlight.js/lib/languages/objectivec"),perl:()=>import("highlight.js/lib/languages/perl"),php:()=>import("highlight.js/lib/languages/php"),plaintext:()=>import("highlight.js/lib/languages/plaintext"),powershell:()=>import("highlight.js/lib/languages/powershell"),python:()=>import("highlight.js/lib/languages/python"),r:()=>import("highlight.js/lib/languages/r"),ruby:()=>import("highlight.js/lib/languages/ruby"),rust:()=>import("highlight.js/lib/languages/rust"),scss:()=>import("highlight.js/lib/languages/scss"),shell:()=>import("highlight.js/lib/languages/shell"),sql:()=>import("highlight.js/lib/languages/sql"),swift:()=>import("highlight.js/lib/languages/swift"),typescript:()=>import("highlight.js/lib/languages/typescript"),xml:()=>import("highlight.js/lib/languages/xml"),yaml:()=>import("highlight.js/lib/languages/yaml")},t={"c++":"cpp",cc:"cpp",cjs:"javascript",console:"bash",cs:"csharp",cts:"typescript",docker:"dockerfile",gql:"graphql",golang:"go",h:"cpp",hpp:"cpp",htm:"xml",html:"xml",js:"javascript",jsx:"javascript",kt:"kotlin",kts:"kotlin",md:"markdown",mdx:"markdown",mjs:"javascript",mm:"objectivec",mts:"typescript",mysql:"sql",node:"javascript",none:"plaintext",objc:"objectivec",plain:"plaintext",posh:"powershell",ps1:"powershell",psql:"sql",py:"python",rb:"ruby",rs:"rust",sh:"bash",svelte:"xml",svg:"xml",text:"plaintext",toml:"ini",ts:"typescript",tsx:"typescript",txt:"plaintext",vue:"xml",yml:"yaml",zsh:"bash"},l=new Map;export function registerLanguage(i,t){const g=i.toLowerCase();l.set(g,t),s.delete(g)}let g=null;const s=new Map;export function canonicalLanguage(i){if(!i)return null;const l=i.trim().toLowerCase();return l?t[l]??l:null}export async function highlight(t,a){let e=s.get(a);e||(e=async function(t){const s=l.get(t),a=s?void 0:i[t];if(!s&&!a)return null;g??=import("highlight.js/lib/core").then(i=>i.default);const e=await g;return s?e.registerLanguage(t,s):e.getLanguage(t)||e.registerLanguage(t,(await a()).default),t}(a),s.set(a,e));const h=await e;if(!h||!g)return null;return tokenize((await g).highlight(t,{language:h,ignoreIllegals:!0}).value)}const a={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'"};export function tokenize(i){const t=[[]],l=[],g=/<span class="([^"]*)">|<\/span>/g;let s=0;const e=i=>{if(!i)return;const g=l[l.length-1];i.replace(/&(?:amp|lt|gt|quot|#x27);/g,i=>a[i]).split("\n").forEach((i,l)=>{l>0&&t.push([]),i&&t[t.length-1].push(g?{text:i,token:g}:{text:i})})};for(const t of i.matchAll(g))e(i.slice(s,t.index)),s=t.index+t[0].length,void 0===t[1]?l.pop():l.push(t[1]);return e(i.slice(s)),t}export function plainLines(i){return i.split("\n").map(i=>i?[{text:i}]:[])}