neba 1.13.0 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -30
- package/dist/a2ui/catalog.json +1466 -0
- package/dist/a2ui/components.d.ts +21 -0
- package/dist/a2ui/components.js +1 -0
- package/dist/a2ui/index.d.ts +62 -0
- package/dist/a2ui/index.js +1 -0
- package/dist/a2ui/schema.d.ts +47 -0
- package/dist/a2ui/schema.js +1 -0
- package/dist/components/accordion/Accordion.d.ts +5 -1
- package/dist/components/accordion/Accordion.js +1 -1
- package/dist/components/agent-steps/AgentSteps.d.ts +80 -0
- package/dist/components/agent-steps/AgentSteps.js +1 -0
- package/dist/components/agent-steps/index.d.ts +2 -0
- package/dist/components/agent-steps/index.js +1 -0
- package/dist/components/alert/Alert.js +1 -1
- package/dist/components/anchor/Anchor.d.ts +3 -2
- package/dist/components/anchor/Anchor.js +1 -1
- package/dist/components/animate-appear/AnimateAppear.js +1 -1
- package/dist/components/animate-blink/AnimateBlink.d.ts +3 -0
- package/dist/components/animate-blink/AnimateBlink.js +1 -1
- package/dist/components/animate-counter/AnimateCounter.d.ts +3 -1
- package/dist/components/animate-counter/AnimateCounter.js +1 -1
- package/dist/components/animate-fade/AnimateFade.js +1 -1
- package/dist/components/animate-float/AnimateFloat.js +1 -1
- package/dist/components/animate-grow/AnimateGrow.js +1 -1
- package/dist/components/animate-headline/AnimateHeadline.d.ts +9 -2
- package/dist/components/animate-headline/AnimateHeadline.js +1 -1
- package/dist/components/animate-lighting/AnimateLighting.d.ts +1 -1
- package/dist/components/animate-lighting/AnimateLighting.js +1 -1
- package/dist/components/animate-marquee/AnimateMarquee.d.ts +15 -6
- package/dist/components/animate-marquee/AnimateMarquee.js +1 -1
- package/dist/components/animate-reveal/AnimateReveal.js +1 -1
- package/dist/components/animate-rotate/AnimateRotate.js +1 -1
- package/dist/components/animate-scramble/AnimateScramble.d.ts +5 -3
- package/dist/components/animate-scramble/AnimateScramble.js +1 -1
- package/dist/components/animate-shake/AnimateShake.js +1 -1
- package/dist/components/animate-slide/AnimateSlide.js +1 -1
- package/dist/components/animate-split/AnimateSplit.d.ts +3 -1
- package/dist/components/animate-split/AnimateSplit.js +1 -1
- package/dist/components/animate-typing/AnimateTyping.d.ts +12 -4
- package/dist/components/animate-typing/AnimateTyping.js +1 -1
- package/dist/components/animate-zoom/AnimateZoom.js +1 -1
- package/dist/components/app-logo/AppLogo.js +1 -1
- package/dist/components/approval/Approval.d.ts +115 -0
- package/dist/components/approval/Approval.js +1 -0
- package/dist/components/approval/index.d.ts +2 -0
- package/dist/components/approval/index.js +1 -0
- package/dist/components/area-chart/AreaChart.js +1 -1
- package/dist/components/aspect-ratio/AspectRatio.d.ts +6 -4
- package/dist/components/aspect-ratio/AspectRatio.js +1 -1
- package/dist/components/avatar/Avatar.js +1 -1
- package/dist/components/badge/Badge.js +1 -1
- package/dist/components/bar-chart/BarChart.d.ts +1 -1
- package/dist/components/bar-chart/BarChart.js +1 -1
- package/dist/components/blockquote/Blockquote.js +1 -1
- package/dist/components/bottom-navigation/BottomNavigation.d.ts +2 -1
- package/dist/components/bottom-navigation/BottomNavigation.js +1 -1
- package/dist/components/box/Box.d.ts +5 -0
- package/dist/components/box/Box.js +1 -1
- package/dist/components/breadcrumb/Breadcrumb.d.ts +10 -0
- package/dist/components/breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/button/Button.d.ts +11 -0
- package/dist/components/button/Button.js +1 -1
- package/dist/components/button-group/ButtonGroup.js +1 -1
- package/dist/components/calendar/Calendar.js +1 -1
- package/dist/components/card/Card.js +1 -1
- package/dist/components/carousel/Carousel.d.ts +4 -0
- package/dist/components/carousel/Carousel.js +1 -1
- package/dist/components/chat-bubble/ChatBubble.js +1 -1
- package/dist/components/checkbox/Checkbox.js +1 -1
- package/dist/components/chip/Chip.d.ts +3 -1
- package/dist/components/chip/Chip.js +1 -1
- package/dist/components/code-block/CodeBlock.d.ts +6 -3
- package/dist/components/code-block/CodeBlock.js +1 -1
- package/dist/components/collapsible/Collapsible.d.ts +11 -1
- package/dist/components/collapsible/Collapsible.js +1 -1
- package/dist/components/color-picker/ColorPicker.js +1 -1
- package/dist/components/combobox/Combobox.d.ts +11 -1
- package/dist/components/combobox/Combobox.js +1 -1
- package/dist/components/command-palette/CommandPalette.js +1 -1
- package/dist/components/confirm/Confirm.js +1 -1
- package/dist/components/container/Container.js +1 -1
- package/dist/components/context-window/ContextWindow.d.ts +103 -0
- package/dist/components/context-window/ContextWindow.js +1 -0
- package/dist/components/context-window/index.d.ts +2 -0
- package/dist/components/context-window/index.js +1 -0
- package/dist/components/data-list/DataList.js +1 -1
- package/dist/components/data-table/DataTable.d.ts +12 -1
- package/dist/components/data-table/DataTable.js +1 -1
- package/dist/components/date-picker/DatePicker.js +1 -1
- package/dist/components/date-range-picker/DateRangePicker.js +1 -1
- package/dist/components/date-time-picker/DateTimePicker.js +1 -1
- package/dist/components/dialog/Dialog.d.ts +12 -0
- package/dist/components/dialog/Dialog.js +1 -1
- package/dist/components/divider/Divider.js +1 -1
- package/dist/components/drawer/Drawer.d.ts +7 -0
- package/dist/components/drawer/Drawer.js +1 -1
- package/dist/components/empty/Empty.js +1 -1
- package/dist/components/fieldset/Fieldset.js +1 -1
- package/dist/components/file-picker/FilePicker.d.ts +12 -4
- package/dist/components/file-picker/FilePicker.js +1 -1
- package/dist/components/flex/Flex.d.ts +8 -2
- package/dist/components/flex/Flex.js +1 -1
- package/dist/components/floating-action-button/FloatingActionButton.d.ts +16 -1
- package/dist/components/floating-action-button/FloatingActionButton.js +1 -1
- package/dist/components/floating-bottom-navigation/FloatingBottomNavigation.js +1 -1
- package/dist/components/footer/Footer.d.ts +8 -0
- package/dist/components/footer/Footer.js +1 -1
- package/dist/components/form/Form.d.ts +4 -2
- package/dist/components/form/Form.js +1 -1
- package/dist/components/gallery/Gallery.d.ts +56 -3
- package/dist/components/gallery/Gallery.js +1 -1
- package/dist/components/gallery/GalleryViewer.js +1 -1
- package/dist/components/gauge-chart/GaugeChart.js +1 -1
- package/dist/components/grid/Grid.js +1 -1
- package/dist/components/grid-container/GridContainer.js +1 -1
- package/dist/components/header/Header.js +1 -1
- package/dist/components/heatmap-chart/HeatmapChart.js +1 -1
- package/dist/components/highlight/Highlight.js +1 -1
- package/dist/components/how-to-steps/HowToSteps.d.ts +26 -1
- package/dist/components/how-to-steps/HowToSteps.js +1 -1
- package/dist/components/icon/Icon.js +1 -1
- package/dist/components/icon-button/IconButton.d.ts +0 -20
- package/dist/components/icon-button/IconButton.js +1 -1
- package/dist/components/image/Image.d.ts +137 -11
- package/dist/components/image/Image.js +1 -1
- package/dist/components/image/index.d.ts +1 -1
- package/dist/components/inline-citation/InlineCitation.d.ts +53 -0
- package/dist/components/inline-citation/InlineCitation.js +1 -0
- package/dist/components/inline-citation/index.d.ts +2 -0
- package/dist/components/inline-citation/index.js +1 -0
- package/dist/components/list/List.js +1 -1
- package/dist/components/menu/Menu.d.ts +7 -4
- package/dist/components/menu/Menu.js +1 -1
- package/dist/components/menubar/Menubar.js +1 -1
- package/dist/components/meter/Meter.d.ts +6 -0
- package/dist/components/meter/Meter.js +1 -1
- package/dist/components/mockup/Mockup.js +1 -1
- package/dist/components/navigation-menu/NavigationMenu.d.ts +10 -1
- package/dist/components/navigation-menu/NavigationMenu.js +1 -1
- package/dist/components/number-field/NumberField.d.ts +20 -6
- package/dist/components/number-field/NumberField.js +1 -1
- package/dist/components/otp-field/OtpField.d.ts +7 -0
- package/dist/components/otp-field/OtpField.js +1 -1
- package/dist/components/overlay/Overlay.d.ts +1 -1
- package/dist/components/overlay/Overlay.js +1 -1
- package/dist/components/page-layout/PageLayout.d.ts +11 -0
- package/dist/components/page-layout/PageLayout.js +1 -1
- package/dist/components/pagination/Pagination.js +1 -1
- package/dist/components/panes/Panes.d.ts +11 -0
- package/dist/components/panes/Panes.js +1 -1
- package/dist/components/pie-chart/PieChart.d.ts +5 -3
- package/dist/components/pie-chart/PieChart.js +1 -1
- package/dist/components/pill/Pill.d.ts +8 -0
- package/dist/components/pill/Pill.js +1 -1
- package/dist/components/popconfirm/Popconfirm.d.ts +10 -3
- package/dist/components/popconfirm/Popconfirm.js +1 -1
- package/dist/components/popover/Popover.d.ts +8 -1
- package/dist/components/popover/Popover.js +1 -1
- package/dist/components/portal/Portal.js +1 -1
- package/dist/components/progress-box/ProgressBox.js +1 -1
- package/dist/components/progress-circular/ProgressCircular.js +1 -1
- package/dist/components/progress-linear/ProgressLinear.js +1 -1
- package/dist/components/prompt-input/PromptInput.d.ts +104 -0
- package/dist/components/prompt-input/PromptInput.js +1 -0
- package/dist/components/prompt-input/index.d.ts +2 -0
- package/dist/components/prompt-input/index.js +1 -0
- package/dist/components/provider/NebaProvider.d.ts +3 -3
- package/dist/components/provider/NebaProvider.js +1 -1
- package/dist/components/radio-group/RadioGroup.js +1 -1
- package/dist/components/rating/Rating.d.ts +4 -1
- package/dist/components/rating/Rating.js +1 -1
- package/dist/components/reasoning/Reasoning.d.ts +78 -0
- package/dist/components/reasoning/Reasoning.js +1 -0
- package/dist/components/reasoning/index.d.ts +2 -0
- package/dist/components/reasoning/index.js +1 -0
- package/dist/components/scatter-chart/ScatterChart.js +1 -1
- package/dist/components/scroll-area/ScrollArea.js +1 -1
- package/dist/components/scroll-zone/ScrollZone.d.ts +10 -0
- package/dist/components/scroll-zone/ScrollZone.js +1 -1
- package/dist/components/segmented-button/SegmentedButton.js +1 -1
- package/dist/components/select/Select.js +1 -1
- package/dist/components/shortcut/Shortcut.js +1 -1
- package/dist/components/show/Show.d.ts +6 -5
- package/dist/components/show/Show.js +1 -1
- package/dist/components/sidebar/Sidebar.d.ts +7 -5
- package/dist/components/sidebar/Sidebar.js +1 -1
- package/dist/components/sidebar/SidebarTrigger.js +1 -1
- package/dist/components/skeleton/Skeleton.d.ts +1 -1
- package/dist/components/skeleton/Skeleton.js +1 -1
- package/dist/components/slider/Slider.d.ts +13 -1
- package/dist/components/slider/Slider.js +1 -1
- package/dist/components/sources/Sources.d.ts +78 -0
- package/dist/components/sources/Sources.js +1 -0
- package/dist/components/sources/index.d.ts +2 -0
- package/dist/components/sources/index.js +1 -0
- package/dist/components/sparkline/Sparkline.js +1 -1
- package/dist/components/spoiler/Spoiler.js +1 -1
- package/dist/components/stack/Stack.d.ts +2 -2
- package/dist/components/stack/Stack.js +1 -1
- package/dist/components/statistic/Statistic.js +1 -1
- package/dist/components/streaming-text/StreamingText.d.ts +75 -0
- package/dist/components/streaming-text/StreamingText.js +1 -0
- package/dist/components/streaming-text/index.d.ts +2 -0
- package/dist/components/streaming-text/index.js +1 -0
- package/dist/components/switch/Switch.js +1 -1
- package/dist/components/table/Table.d.ts +8 -2
- package/dist/components/table/Table.js +1 -1
- package/dist/components/tabs/Tabs.js +1 -1
- package/dist/components/text-field/TextField.js +1 -1
- package/dist/components/text-link/TextLink.js +1 -1
- package/dist/components/time-picker/TimePicker.js +1 -1
- package/dist/components/timeline/Timeline.d.ts +8 -0
- package/dist/components/timeline/Timeline.js +1 -1
- package/dist/components/timeline-chart/TimelineChart.js +1 -1
- package/dist/components/toast/Toast.d.ts +9 -3
- package/dist/components/toast/Toast.js +1 -1
- package/dist/components/toggle/Toggle.js +1 -1
- package/dist/components/toggle-group/ToggleGroup.js +1 -1
- package/dist/components/tool-call/ToolCall.d.ts +104 -0
- package/dist/components/tool-call/ToolCall.js +1 -0
- package/dist/components/tool-call/index.d.ts +2 -0
- package/dist/components/tool-call/index.js +1 -0
- package/dist/components/toolbar/Toolbar.d.ts +8 -0
- package/dist/components/toolbar/Toolbar.js +1 -1
- package/dist/components/tooltip/Tooltip.js +1 -1
- package/dist/components/tour/Tour.d.ts +2 -0
- package/dist/components/tour/Tour.js +1 -1
- package/dist/components/transfer/Transfer.js +1 -1
- package/dist/components/tree-select/TreeSelect.js +1 -1
- package/dist/components/tree-view/TreeView.d.ts +6 -0
- package/dist/components/tree-view/TreeView.js +1 -1
- package/dist/components/typography/Typography.js +1 -1
- package/dist/components/visually-hidden/VisuallyHidden.d.ts +9 -7
- package/dist/components/visually-hidden/VisuallyHidden.js +1 -1
- package/dist/components/window-pane/WindowPane.d.ts +2 -2
- package/dist/components/window-pane/WindowPane.js +1 -1
- package/dist/hooks/useElementSize.d.ts +3 -1
- package/dist/hooks/useElementSize.js +1 -1
- package/dist/hooks/useOnScreen.d.ts +3 -0
- package/dist/hooks/useOnScreen.js +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1 -1
- package/dist/internal/animate.d.ts +63 -16
- package/dist/internal/animate.js +1 -1
- package/dist/internal/calendar.d.ts +6 -1
- package/dist/internal/calendar.js +1 -1
- package/dist/internal/chart-frame.d.ts +64 -22
- package/dist/internal/chart-frame.js +1 -1
- package/dist/internal/chart-line.js +1 -1
- package/dist/internal/chart.d.ts +55 -4
- package/dist/internal/chart.js +1 -1
- package/dist/internal/children.d.ts +15 -0
- package/dist/internal/children.js +1 -0
- package/dist/internal/color.d.ts +4 -0
- package/dist/internal/color.js +1 -1
- package/dist/internal/csv.d.ts +12 -1
- package/dist/internal/csv.js +1 -1
- package/dist/internal/data-table.d.ts +28 -10
- package/dist/internal/data-table.js +1 -1
- package/dist/internal/date.d.ts +12 -5
- package/dist/internal/date.js +1 -1
- package/dist/internal/defaults.d.ts +6 -1
- package/dist/internal/defaults.js +1 -1
- package/dist/internal/drag.d.ts +13 -1
- package/dist/internal/drag.js +1 -1
- package/dist/internal/drop.d.ts +61 -0
- package/dist/internal/drop.js +1 -0
- package/dist/internal/fieldset.d.ts +13 -0
- package/dist/internal/fieldset.js +1 -0
- package/dist/internal/glow.d.ts +58 -0
- package/dist/internal/glow.js +1 -0
- package/dist/internal/highlight.js +1 -1
- package/dist/internal/i18n.d.ts +230 -11
- package/dist/internal/i18n.js +1 -1
- package/dist/internal/icons.d.ts +13 -2
- package/dist/internal/icons.js +1 -1
- package/dist/internal/inert.d.ts +13 -0
- package/dist/internal/inert.js +1 -0
- package/dist/internal/initials.d.ts +8 -3
- package/dist/internal/initials.js +1 -1
- package/dist/internal/keys.d.ts +13 -0
- package/dist/internal/keys.js +1 -1
- package/dist/internal/link.d.ts +13 -15
- package/dist/internal/link.js +1 -1
- package/dist/internal/media.d.ts +9 -17
- package/dist/internal/media.js +1 -1
- package/dist/internal/menu.d.ts +6 -1
- package/dist/internal/mockup.d.ts +5 -4
- package/dist/internal/mockup.js +1 -1
- package/dist/internal/observe.d.ts +12 -0
- package/dist/internal/observe.js +1 -1
- package/dist/internal/page-layout.d.ts +10 -8
- package/dist/internal/page-layout.js +1 -1
- package/dist/internal/picker.d.ts +1 -1
- package/dist/internal/picker.js +1 -1
- package/dist/internal/progress.d.ts +11 -5
- package/dist/internal/progress.js +1 -1
- package/dist/internal/responsive.d.ts +0 -8
- package/dist/internal/responsive.js +1 -1
- package/dist/internal/run.d.ts +71 -0
- package/dist/internal/run.js +1 -0
- package/dist/internal/screen.d.ts +12 -0
- package/dist/internal/screen.js +1 -0
- package/dist/internal/styles.d.ts +185 -14
- package/dist/internal/styles.js +1 -1
- package/dist/internal/text.d.ts +3 -3
- package/dist/internal/text.js +1 -1
- package/dist/internal/window.js +1 -1
- package/dist/locales/ar.js +1 -1
- package/dist/locales/de.js +1 -1
- package/dist/locales/es.js +1 -1
- package/dist/locales/fr.js +1 -1
- package/dist/locales/hi.js +1 -1
- package/dist/locales/id.js +1 -1
- package/dist/locales/it.js +1 -1
- package/dist/locales/ja.js +1 -1
- package/dist/locales/ko.js +1 -1
- package/dist/locales/nl.js +1 -1
- package/dist/locales/pl.js +1 -1
- package/dist/locales/pt.js +1 -1
- package/dist/locales/ru.js +1 -1
- package/dist/locales/th.js +1 -1
- package/dist/locales/tr.js +1 -1
- package/dist/locales/vi.js +1 -1
- package/dist/locales/zh-hans.js +1 -1
- package/dist/locales/zh-hant.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +501 -53
- package/dist/types.d.ts +34 -7
- package/dist/types.js +0 -8
- package/package.json +43 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as a from"react";import{TreeItem as n,TreeView as r}from"../tree-view/TreeView.js";import{PickerShell as t}from"../../internal/picker.js";import{searchHaystack as o,searchText as i}from"../../internal/search.js";import{actionMessages as s,commandMessages as c,comboboxMessages as d,useMessages as u}from"../../internal/i18n.js";import{useStyleDefaults as
|
|
1
|
+
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as a from"react";import{TreeItem as n,TreeView as r}from"../tree-view/TreeView.js";import{PickerShell as t}from"../../internal/picker.js";import{searchHaystack as o,searchText as i}from"../../internal/search.js";import{actionMessages as s,commandMessages as c,comboboxMessages as d,useMessages as u}from"../../internal/i18n.js";import{useStyleDefaults as p}from"../../internal/defaults.js";function h(e,l=new Map){for(const a of e)l.set(a.value,a),a.children&&h(a.children,l);return l}function m(e,l=new Map){for(const a of e)l.set(a,o([a.searchLabel??("string"==typeof a.label?a.label:String(a.value))])),a.children&&m(a.children,l);return l}function f(e,l,a){if(""===l)return e;const n=[];for(const r of e){const e=r.children?f(r.children,l,a):void 0,t=(a.get(r)??"").includes(l);(t||e&&e.length>0)&&n.push({...r,children:t?r.children:e})}return n}function g(e,l=[]){for(const a of e)a.children&&a.children.length>0&&(l.push(a.value),g(a.children,l));return l}export const TreeSelect=/*@__PURE__*/a.forwardRef(function TreeSelect(o,b){const{items:v=[],value:x,defaultValue:y,onValueChange:S,multiple:w=!1,selectableBranches:C=!1,defaultExpanded:j,expanded:N,onExpandedChange:M,open:O,defaultOpen:z,onOpenChange:T,placeholder:V,clearable:E=!1,clearLabel:L,closeOnSelect:k,searchable:A=!1,searchPlaceholder:I,locale:R,format:B,name:P,size:$="md",color:q="primary",readOnly:D=!1,disabled:F=!1,classNames:G,...H}=p(o,["size","locale"]),J=u(d,R),K=u(c,R),Q=u(s,R),U=e=>null==e?[]:Array.isArray(e)?e:[e],[W,X]=a.useState(()=>U(y)),Y=void 0!==x?U(x):W,[Z,_]=a.useState(z??!1),ee=O??Z,[le,ae]=a.useState(""),ne=a.useMemo(()=>h(v),[v]),re=a.useMemo(()=>m(v),[v]),te=i(le),oe=a.useMemo(()=>f(v,te,re),[v,te,re]),ie=a.useMemo(()=>""===te?void 0:g(oe),[te,oe]),[se,ce]=a.useState(()=>j??[]),de=ie??N??se,ue=e=>{e&&(D||F)||(void 0===O&&_(e),e||ae(""),T?.(e))},pe=e=>{void 0===x&&X(e),S?.(e)},he=e=>e.selectable??(!(e.children&&e.children.length>0)||C),me=Y.map(e=>ne.get(e)).filter(e=>void 0!==e),fe=0===me.length?V??"":B?B(me):me.map(e=>e.label).reduce((e,l,a)=>0===a?[l]:[...e,", ",l],[]),ge=l=>l.map(l=>e(n,{value:l.value,label:l.label,startIcon:l.startIcon,disabled:l.disabled,selectable:he(l),className:G?.item,children:l.children?ge(l.children):null},l.value));return e(t,{...H,size:$,color:q,readOnly:D,disabled:F,triggerRef:b,display:fe,empty:0===me.length,clearable:E,onClear:()=>pe([]),open:ee,onOpenChange:ue,clearLabel:L??Q.clear,popupClassName:G?.popup,hiddenValues:P?Y.map(e=>({name:P,value:String(e)})):void 0,children:l("div",{className:"flex max-h-80 w-64 flex-col gap-2 overflow-hidden",children:[A?e("input",{type:"text",value:le,placeholder:I??K.search,"aria-label":I??K.search,onChange:e=>ae(e.currentTarget.value),className:"neba-input w-full shrink-0 bg-transparent px-1 py-1 [font:inherit] text-(--neba-fg) [outline:none] placeholder:text-(--neba-muted-fg)"}):null,e("div",{className:"min-h-0 flex-1 overflow-auto",children:0===oe.length?e("p",{className:`px-1 py-2 text-(--neba-muted-fg) ${G?.empty??""}`,children:J.empty}):e(r,{size:$,color:q,multiple:w,selected:Y,onSelectedChange:e=>{const l=e.filter(e=>{const l=ne.get(e);return void 0!==l&&he(l)&&!l.disabled});pe(w?l:l.slice(-1)),(k??!w)&&ue(!1)},expanded:de,onExpandedChange:ie?()=>{}:e=>{void 0===N&&ce(e),M?.(e)},className:G?.tree,children:ge(oe)})})]})})});
|
|
@@ -85,6 +85,12 @@ export interface TreeItemProps extends Omit<React.ComponentPropsWithoutRef<'li'>
|
|
|
85
85
|
expandable?: boolean;
|
|
86
86
|
/** Unavailable. Its branch, if it is open, keeps working. */
|
|
87
87
|
disabled?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Whether pressing the row chooses it. A row that cannot be chosen still
|
|
90
|
+
* opens and shuts — the folder in a tree whose answers are the files.
|
|
91
|
+
* @default true
|
|
92
|
+
*/
|
|
93
|
+
selectable?: boolean;
|
|
88
94
|
/** The rows underneath this one. */
|
|
89
95
|
children?: React.ReactNode;
|
|
90
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,Fragment as t,jsxs as
|
|
1
|
+
"use client";import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import*as r from"react";import{safeHref as a}from"../../internal/link.js";import{ChevronIcon as l}from"../../internal/icons.js";import{controlTextClasses as s,cx as o,gapClasses as i,hasContent as d,iconClasses as c,radiusClasses as u,surfaceClasses as m,surfaceSlots as f,transitionClasses as p}from"../../internal/styles.js";import{useStyleDefaults as g}from"../../internal/defaults.js";const x=/*@__PURE__*/r.createContext({size:"md",density:"default",disabled:!1,multiple:!1,expandedKeys:new Set,selectedKeys:new Set,activeKey:null,toggle:()=>{},select:()=>{},activate:()=>{},register:()=>()=>{}}),b=/*@__PURE__*/r.createContext(!1),v={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"},h={xs:"0.875rem",sm:"1rem",md:"1.25rem",lg:"1.5rem",xl:"1.75rem"},w={xs:"1.375rem",sm:"1.625rem",md:"2rem",lg:"2.5rem",xl:"3rem"},y={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"}},k={xs:"rounded-[0.3125rem]",sm:"rounded-[0.375rem]",md:"rounded-[0.5rem]",lg:"rounded-[0.625rem]",xl:"rounded-[0.75rem]"},C={none:"",simple:"neba-tree-simple",folder:"neba-tree-folder"};function S(e){return Array.from(e.querySelectorAll('[role="treeitem"]')).filter(e=>null===e.closest("[data-closing]"))}const E=e=>String(e);export const TreeView=/*@__PURE__*/r.forwardRef(function TreeView(t,n){const{variant:a="outline",size:l="md",color:s="primary",density:i="default",elevation:d=0,lines:c="simple",expanded:m,defaultExpanded:b,onExpandedChange:y,selected:k,defaultSelected:N,onSelectedChange:A,multiple:j=!1,disabled:K=!1,label:V,className:D,style:R,children:I,onKeyDown:P,...T}=g(t,["size","density","variant"]),[_,z]=r.useState(b??[]),[F,M]=r.useState(N??[]),[q,L]=r.useState(null),H=m??_,O=k??F,U=r.useRef(null),B=r.useCallback(e=>{U.current=e,"function"==typeof n?n(e):n&&(n.current=e)},[n]),G=r.useRef({expandedValues:H,selectedValues:O,controlledExpanded:void 0!==m,controlledSelected:void 0!==k,multiple:j,onExpandedChange:y,onSelectedChange:A});G.current={expandedValues:H,selectedValues:O,controlledExpanded:void 0!==m,controlledSelected:void 0!==k,multiple:j,onExpandedChange:y,onSelectedChange:A};const J=r.useCallback(e=>{const{expandedValues:t,controlledExpanded:n,onExpandedChange:r}=G.current,a=E(e),l=t.some(e=>E(e)===a)?t.filter(e=>E(e)!==a):[...t,e];n||z(l),r?.(l)},[]),Q=r.useCallback(e=>{const{selectedValues:t,controlledSelected:n,multiple:r,onSelectedChange:a}=G.current,l=E(e),s=t.some(e=>E(e)===l),o=r?s?t.filter(e=>E(e)!==l):[...t,e]:[e];n||M(o),a?.(o)},[]),W=r.useRef(new Map),X=r.useCallback((e,t)=>(W.current.set(e,t),()=>{W.current.delete(e)}),[]),Y=r.useMemo(()=>H.map(E).join("\0"),[H]),Z=r.useMemo(()=>O.map(E).join("\0"),[O]),$=r.useMemo(()=>({size:l,density:i,disabled:K,multiple:j,expandedKeys:new Set(H.map(E)),selectedKeys:new Set(O.map(E)),activeKey:q,toggle:J,select:Q,activate:L,register:X}),[l,i,K,j,Y,Z,q,J,Q,X]);r.useEffect(()=>{if(null!==q&&W.current.has(q))return;const e=U.current;if(!e)return;const t=S(e);if(0===t.length)return;const n=t.find(e=>"true"===e.getAttribute("aria-selected"))??t[0];L(n.dataset.nebaValue??null)});const ee=o("flex list-none flex-col p-1",u[l],v[a],p,C[c],D);return e(x.Provider,{value:$,children:e("ul",{ref:B,role:"tree","aria-label":V,"aria-multiselectable":j||void 0,className:ee,style:{...f(s,d),"--n-tree-indent":h[l],"--n-tree-row":w[l],...R},onKeyDown:function(e){if(P?.(e),e.defaultPrevented)return;const t=U.current,n=e.target?.closest?.('[role="treeitem"]');if(!t||!n||!t.contains(n))return;if(e.target!==n)return;const r=S(t),a=r.indexOf(n);if(-1===a)return;const l=t=>{t&&(e.preventDefault(),L(t.dataset.nebaValue??null),t.focus())},s=e=>{const t=e.dataset.nebaValue;t&&W.current.get(t)?.toggle()},o="rtl"===getComputedStyle(t).direction,i=o?"ArrowLeft":"ArrowRight",d=o?"ArrowRight":"ArrowLeft",c=n.getAttribute("aria-expanded");switch(e.key){case"ArrowDown":l(r[a+1]);break;case"ArrowUp":l(r[a-1]);break;case"Home":l(r[0]);break;case"End":l(r[r.length-1]);break;case i:"false"===c?(e.preventDefault(),s(n)):"true"===c&&l(r[a+1]);break;case d:"true"===c?(e.preventDefault(),s(n)):l(n.parentElement?.closest('[role="treeitem"]'));break;case"Enter":case" ":e.preventDefault();(("Enter"===e.key?n.querySelector(":scope > div > a[href]"):null)??n).click();break}},...T,children:I})})});export const TreeItem=/*@__PURE__*/r.forwardRef(function TreeItem({value:u,label:m,startIcon:f,endIcon:g,action:v,href:h,expandable:w,disabled:C=!1,selectable:S=!0,className:N,children:A,onClick:j,...K},V){const{size:D,density:R,disabled:I,expandedKeys:P,selectedKeys:T,activeKey:_,toggle:z,select:F,activate:M,register:q,multiple:L}=r.useContext(x),H=r.useId(),O=u??H,U=E(O),B=r.useRef(null),G=r.useCallback(e=>{B.current=e,"function"==typeof V?V(e):V&&(V.current=e)},[V]),J=r.Children.toArray(A),Q=w??J.length>0,W=Q&&P.has(U),X=T.has(U),Y=C||I,Z=r.useRef({toggle:()=>{}});Z.current.toggle=()=>{!Y&&Q&&z(O)};const $=r.useContext(b);r.useEffect(()=>$?void 0:q(U,Z.current),[$,U,q]);const[ee,te]=r.useState(W),[ne,re]=r.useState(W),ae=r.useRef(null);r.useEffect(()=>{if(W){te(!0);const e=requestAnimationFrame(()=>re(!0));return()=>cancelAnimationFrame(e)}re(!1);const e=ae.current;(null===e||getComputedStyle(e).transitionDuration.split(",").every(e=>0===parseFloat(e)))&&te(!1)},[W]);const le=o("flex min-w-0 flex-1 cursor-pointer items-center text-start","h-(--n-tree-row)",y[R][D],k[D],i[D],s[D],p,c,"group-focus-visible/tree-item:[outline:2px_solid_var(--n-ring)]","group-focus-visible/tree-item:outline-offset-[-2px]",Y?"cursor-not-allowed text-(--neba-disabled-fg)":X?"bg-(--n-soft-press) font-medium text-(--n-on-tint) hover:bg-(--n-soft-press)":"hover:bg-(--n-soft)"),se=n(t,{children:[e("span",{"aria-hidden":"true",onClick:e=>{!Y&&Q&&(e.stopPropagation(),e.preventDefault(),B.current?.focus(),M(U),z(O))},className:o("flex h-[1lh] w-[1.15em] shrink-0 items-center justify-center","[transition:rotate_var(--neba-duration)_var(--neba-ease)]",Q?"text-(--neba-muted-fg)":"",W?"rotate-0":"-rotate-90 rtl:rotate-90"),children:Q?e(l,{}):null}),d(f)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:f}):null,e("span",{className:"min-w-0 flex-1 truncate",children:m}),d(g)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:g}):null]});return n("li",{ref:G,role:"treeitem","aria-expanded":Q?W:void 0,"aria-selected":!!X||(!L||!S)&&void 0,"aria-disabled":Y||void 0,"data-neba-value":U,tabIndex:_===U?0:-1,className:o("group/tree-item relative block [outline:none]",N),onClick:function(e){e.stopPropagation(),Y?e.preventDefault():(B.current?.focus(),M(U),j?.(e),e.defaultPrevented||(Q&&z(O),S&&F(O)))},...K,children:[n("div",{className:"flex w-full items-center",children:[void 0===a(h)||Y?e("div",{className:le,children:se}):e("a",{href:a(h),tabIndex:-1,className:le,"aria-current":X?"page":void 0,children:se}),d(v)?e("span",{className:o("flex shrink-0 items-center",y[R][D]),onClick:e=>e.stopPropagation(),children:v}):null]}),Q&&ee&&J.length>0?e("div",{ref:ae,"data-closing":W?void 0:"",className:o("grid [transition:grid-template-rows_var(--neba-duration)_var(--neba-ease)]",ne?"[grid-template-rows:1fr]":"[grid-template-rows:0fr] pointer-events-none"),onTransitionEnd:e=>{e.target!==e.currentTarget||"grid-template-rows"!==e.propertyName||W||te(!1)},children:e("ul",{role:"group",className:"min-h-0 list-none overflow-hidden ps-(--n-tree-indent)",children:e(b.Provider,{value:$||!W,children:A})})}):null]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{useRender as
|
|
1
|
+
"use client";import*as e from"react";import{useRender as a}from"@base-ui/react/use-render";import{transitionProps as t}from"../../internal/animate.js";import{clampClasses as r,clampSlot as n,cx as p}from"../../internal/styles.js";const o={h1:"[&.neba-typography]:text-[1.875rem]/[1.2] [&.neba-typography]:tracking-[-0.02em]",h2:"[&.neba-typography]:text-[1.5rem]/[1.25] [&.neba-typography]:tracking-[-0.015em]",h3:"[&.neba-typography]:text-[1.25rem]/[1.3] [&.neba-typography]:tracking-[-0.01em]",h4:"[&.neba-typography]:text-[1.0625rem]/[1.41176] [&.neba-typography]:tracking-normal",h5:"[&.neba-typography]:text-[0.9375rem]/[1.46667] [&.neba-typography]:tracking-normal",h6:"[&.neba-typography]:text-[0.8125rem]/[1.53846] [&.neba-typography]:tracking-normal",lead:"[&.neba-typography]:text-[1.0625rem]/[1.64706] [&.neba-typography]:tracking-normal",body:"[&.neba-typography]:text-[0.8125rem]/[1.69231] [&.neba-typography]:tracking-normal",caption:"[&.neba-typography]:text-[0.75rem]/[1.5] [&.neba-typography]:tracking-normal",overline:"[&.neba-typography]:text-[0.6875rem]/[1.45455] [&.neba-typography]:tracking-[0.08em] uppercase"},y={h1:"semibold",h2:"semibold",h3:"semibold",h4:"semibold",h5:"semibold",h6:"semibold",lead:"regular",body:"regular",caption:"regular",overline:"medium"},h={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",lead:"p",body:"p",caption:"span",overline:"span"},b=new Set(["caption","overline"]),m={h1:"[&.neba-typography]:mb-4",h2:"[&.neba-typography]:mb-3.5",h3:"[&.neba-typography]:mb-3",h4:"[&.neba-typography]:mb-2.5",h5:"[&.neba-typography]:mb-2",h6:"[&.neba-typography]:mb-2",lead:"[&.neba-typography]:mb-4",body:"[&.neba-typography]:mb-3",caption:"[&.neba-typography]:mb-2",overline:"[&.neba-typography]:mb-2"},g={regular:"[&.neba-typography]:font-normal",medium:"[&.neba-typography]:font-medium",semibold:"[&.neba-typography]:font-semibold",bold:"[&.neba-typography]:font-bold"},i={start:"text-start",center:"text-center",end:"text-end",justify:"text-justify"};export const Typography=/*@__PURE__*/e.forwardRef(function Typography({level:l="body",color:s,weight:c,align:d,lines:u,gutter:x=!1,transition:f,render:k,className:v,style:j,children:w,...N},T){const E=t(f),R=p("neba-typography",o[l],g[c??y[l]],d?i[d]:"","span"===h[l]&&(d||x)?"block":"",u?r(u):"",x?m[l]:"[&.neba-typography]:my-0",s?"[&.neba-typography]:text-(--n-accent)":b.has(l)?"[&.neba-typography]:text-(--neba-muted-fg)":"",E.className,v??"");return a({render:k??e.createElement(h[l]),ref:T,props:{className:R,style:s?{"--n-accent":`var(--neba-${s}-accent)`,...n(u),...E.style,...j}:{...n(u),...E.style,...j},children:w,...N}})});
|
|
@@ -22,13 +22,15 @@ export interface VisuallyHiddenProps extends React.ComponentPropsWithoutRef<'spa
|
|
|
22
22
|
* screen reader instead of a picture. This is the same 1px clipped box, offered
|
|
23
23
|
* so an application's own markup can say the same things.
|
|
24
24
|
*
|
|
25
|
-
* The form matters and there is only one that works. `hidden
|
|
26
|
-
* `display: none` take the text off the accessibility
|
|
27
|
-
* screen, which is the opposite of the job. `opacity: 0`
|
|
28
|
-
* ghost the size of the words, and a pointer finds it.
|
|
29
|
-
* makes a box that wide and a horizontal scrollbar with
|
|
30
|
-
*
|
|
31
|
-
*
|
|
25
|
+
* The form matters and there is only one that works. `hidden`,
|
|
26
|
+
* `display: none` and `visibility: hidden` take the text off the accessibility
|
|
27
|
+
* tree along with the screen, which is the opposite of the job. `opacity: 0`
|
|
28
|
+
* leaves a clickable ghost the size of the words, and a pointer finds it.
|
|
29
|
+
* `text-indent: -9999px` makes a box that wide and a horizontal scrollbar with
|
|
30
|
+
* it, and `font-size: 0` is announced by some screen readers as nothing at all.
|
|
31
|
+
* A 1px box with its contents clipped is invisible to a sighted reader and
|
|
32
|
+
* present to every other kind, and it is what every serious implementation
|
|
33
|
+
* converged on.
|
|
32
34
|
*
|
|
33
35
|
* There is no `aria-hidden` here, deliberately: that is the *other* half of the
|
|
34
36
|
* pair — visible and not announced — and it is an attribute rather than a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r}from"react/jsx-runtime";import*as e from"react";import{useRender as s}from"@base-ui/react/use-render";import{cx as
|
|
1
|
+
"use client";import{jsx as r}from"react/jsx-runtime";import*as e from"react";import{useRender as s}from"@base-ui/react/use-render";import{cx as i,srOnlyClasses as a}from"../../internal/styles.js";export const VisuallyHidden=/*@__PURE__*/e.forwardRef(function VisuallyHidden({visible:e=!1,render:t,className:n,...o},m){return s({render:t??r("span",{}),ref:m,props:{...o,className:i(e?void 0:a,n)}})});
|
|
@@ -74,7 +74,7 @@ export interface WindowPaneProps extends Omit<React.ComponentPropsWithoutRef<'di
|
|
|
74
74
|
*
|
|
75
75
|
* What being in front looks like is the system's: coloured traffic lights on
|
|
76
76
|
* macOS against grey ones, an accent title bar and an accent border on
|
|
77
|
-
* Windows 10, a tinted header bar on GNOME — and, on
|
|
77
|
+
* Windows 10, a tinted header bar on GNOME — and, on every one of them, a window one
|
|
78
78
|
* step further off the page than the ones behind it.
|
|
79
79
|
*/
|
|
80
80
|
active?: boolean;
|
|
@@ -155,7 +155,7 @@ export interface WindowPaneProps extends Omit<React.ComponentPropsWithoutRef<'di
|
|
|
155
155
|
children?: React.ReactNode;
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
|
-
* A window, drawn the way one of
|
|
158
|
+
* A window, drawn the way one of eight systems draws it, with anything at all
|
|
159
159
|
* inside it.
|
|
160
160
|
*
|
|
161
161
|
* It is not a real window and does not pretend to be one: there is no desktop,
|
|
@@ -1 +1 @@
|
|
|
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 o}from"@base-ui/react/use-render";import{beginPointerDrag as r}from"../../internal/drag.js";import{actionMessages as
|
|
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 o}from"@base-ui/react/use-render";import{beginPointerDrag as r}from"../../internal/drag.js";import{actionMessages as s,useMessages as a,windowMessages as l}from"../../internal/i18n.js";import{cx as d,hasContent as c,iconClasses as u,surfaceClasses as h}from"../../internal/styles.js";import{WindowControls as m,orderControls as f,windowChrome as g,windowMetrics as w,windowSlots as p}from"../../internal/window.js";import{inertValue as b}from"../../internal/inert.js";import{useStyleDefaults as x}from"../../internal/defaults.js";function v(e,t,n){const[o,r]=i.useState(t),s=void 0!==e;return[s?e:o,i.useCallback(e=>{s||r(e),n?.(e)},[s,n])]}const z=[{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"}],y=[];export const WindowPane=/*@__PURE__*/i.forwardRef(function WindowPane(M,E){const{os:N="macos",title:H,icon:S,actions:C,controls:k=!0,size:L="md",color:W="primary",accent:j=!1,transparency:I=0,active:P,elevation:D=2,position:T="static",draggable:R=!1,resizable:A=!1,width:O,height:B,minWidth:X=180,minHeight:$,offset:F,defaultOffset:Y,onOffsetChange:_,onResize:q,open:K,defaultOpen:U=!0,onOpenChange:G,minimized:J,defaultMinimized:Q=!1,onMinimizedChange:V,maximized:Z,defaultMaximized:ee=!1,onMaximizedChange:te,scroll:ne=!0,locale:ie,minimizeLabel:oe,maximizeLabel:re,restoreLabel:se,closeLabel:ae,resizeLabel:le,render:de,className:ce,style:ue,children:he,...me}=x(M,["size","locale"]),fe=a(l,ie),ge=i.useId(),we=a(s,ie),pe=g(N),be=w(N,L),xe=i.useId(),[ve,ze]=v(K,U,G),[ye,Me]=v(J,Q,V),[Ee,Ne]=v(Z,ee,te),[He,Se]=v(F,Y??{x:0,y:0},_),[Ce,ke]=i.useState(null),[Le,We]=i.useState({width:O,height:B});Le.width===O&&Le.height===B||(We({width:O,height:B}),ke(null));const[je,Ie]=i.useState(!0),Pe=P??je,[De,Te]=i.useState(null),[Re,Ae]=i.useState(null),[Oe,Be]=i.useState(!1),[Xe,$e]=i.useState(!1),[Fe,Ye]=i.useState(ve);Fe!==ve&&(Ye(ve),$e(!ve)),i.useEffect(()=>{if(!Xe)return;const e=window.setTimeout(()=>$e(!1),260);return()=>window.clearTimeout(e)},[Xe]);const _e=i.useRef(null),qe=i.useCallback(e=>{_e.current=e,"function"==typeof E?E(e):E&&(E.current=e)},[E]);i.useEffect(()=>{if(void 0!==P||!ve)return;const e=_e.current;if(!e)return;const t=e=>Ie(e);y.push(t);const n=n=>{const i=n.target;if(!(i instanceof Node))return;if(e.contains(i))return y.splice(y.indexOf(t),1),y.push(t),void Ie(!0);const o=i instanceof Element?i:i.parentElement;o?.closest(".neba-window")&&Ie(!1)};return document.addEventListener("pointerdown",n,!0),document.addEventListener("focusin",n,!0),()=>{document.removeEventListener("pointerdown",n,!0),document.removeEventListener("focusin",n,!0);const e=y.indexOf(t),i=e===y.length-1;y.splice(e,1),i&&y[y.length-1]?.(!0)}},[P,ve]);const Ke=i.useRef(null);function Ue(e,t){if(0!==e.button)return;Ke.current?.();const n=e.currentTarget,i=e.clientX,o=e.clientY,s=_e.current,a=s?.getBoundingClientRect(),l=s&&a&&s.offsetWidth>0&&a.width/s.offsetWidth||1,d=s&&a&&s.offsetHeight>0&&a.height/s.offsetHeight||1;Be(!0);const c=()=>{Ke.current=null,Be(!1)},u=r({target:n,pointerId:e.pointerId,onMove:e=>t((e.clientX-i)/l,(e.clientY-o)/d),onEnd:c});Ke.current=()=>{u(),c()}}i.useEffect(()=>()=>Ke.current?.(),[]);const Ge={width:Math.max(0,X),height:Math.max(be.bar,$??be.bar)};function Je(e){ke(e),q?.(e)}const Qe=f(N,!0===k?["minimize","maximize","close"]:!1===k?[]:k),Ve=Qe.includes("maximize");i.useLayoutEffect(()=>{if(!ye||null!==De)return;const e=_e.current,t=e?.firstElementChild;e&&t instanceof HTMLElement&&Te(t.offsetHeight+(e.offsetHeight-e.clientHeight))},[ye,De]),i.useEffect(()=>{if(ye||null===Re)return;const e=window.setTimeout(()=>Ae(null),400);return()=>window.clearTimeout(e)},[ye,Re]);const Ze={minimize:oe??fe.minimize,maximize:re??fe.maximize,restore:se??fe.restore,close:ae??we.close},et=e(m,{os:N,metrics:be,controls:Qe,maximized:Ee,active:Pe,labels:Ze,onCommand:function(e){"close"===e?ze(!1):"minimize"===e?function(e){const t=_e.current,n=t?.firstElementChild;if(t&&n instanceof HTMLElement&&Te(n.offsetHeight+(t.offsetHeight-t.clientHeight)),e&&void 0===(Ce?.height??B)&&t)return Ae(t.offsetHeight),void requestAnimationFrame(()=>Me(!0));Me(e)}(!ye):Ne(!Ee)}}),tt=c(H)?e("span",{id:xe,className:"min-w-0 truncate",children:H}):null,nt=c(S)?e("span",{className:"flex shrink-0 items-center",children:S}):null,it=t("div",{className:d("relative flex shrink-0 items-center select-none",u,R&&!Ee?"cursor-grab touch-none active:cursor-grabbing":""),style:{height:be.bar,textShadow:"var(--n-window-bar-shadow)",fontWeight:be.weight,paddingInlineStart:be.padX,paddingInlineEnd:be.padEnd,gap:Math.round(.7*be.title),fontSize:be.title,backgroundColor:"var(--n-window-bar)",backgroundImage:"var(--n-window-bar-image)",color:"var(--n-window-bar-fg)",borderBlockEnd:pe.rule?"1px solid var(--n-window-line)":void 0},onPointerDown:function(e){if(!R||Ee)return;const t={...He},n=_e.current,i="fixed"===T?{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}:"absolute"===T&&n?.offsetParent instanceof HTMLElement?{width:n.offsetParent.clientWidth,height:n.offsetParent.clientHeight}:null,o=n?.offsetWidth??0,r=Math.min(o,48);Ue(e,(e,n)=>{const s=t.x+e,a=t.y+n;Se(i?{x:Math.min(Math.max(s,r-o),i.width-r),y:Math.min(Math.max(a,0),Math.max(0,i.height-be.bar))}:{x:s,y:a})})},onDoubleClick:Ve?()=>Ne(!Ee):void 0,children:["start"===pe.controlsSide?et:null,"center"===pe.titleAlign?e("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 flex items-center justify-center",style:{paddingInline:be.controlsWidth(Qe.length)+2*be.padX},children:t("span",{className:"flex min-w-0 items-center",style:{gap:Math.round(.5*be.title)},children:[nt,tt]})}):t(n,{children:[nt,tt]}),e("span",{className:"flex-1"}),c(C)?e("span",{className:"flex shrink-0 items-center",style:{gap:Math.round(.5*be.title)},onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:C}):null,"end"===pe.controlsSide?et:null]}),ot=Ee?{left:0,top:0,width:"100%",height:"100%"}:{left:He.x,top:He.y,width:Ce?.width??O,height:ye?De??be.bar:Ce?.height??B??Re??void 0},rt=o({render:de,ref:qe,props:{role:"group","aria-labelledby":tt?xe:void 0,className:d("neba-window relative flex min-w-0 flex-col overflow-hidden",I>0?h:"",pe.glass&&0===I?"[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]",ce),"data-gesture":Oe?"":void 0,inert:b(!ve),style:{opacity:ve?void 0:0,...p({os:N,color:W,accent:j,transparency:I,active:Pe,elevation:D}),position:"static"===T?"relative":T,...ot,borderRadius:Ee?0:`${be.radius}px ${be.radius}px ${be.radiusBottom}px ${be.radiusBottom}px`,borderStyle:"solid",borderWidth:be.frame,borderColor:"var(--n-window-line)",backgroundColor:"var(--n-window-band)",boxShadow:"var(--n-window-shadow), var(--neba-plate-glass)",...ue},children:t(n,{children:[it,e("div",{className:d("min-h-0 flex-1",ne?"overflow-auto":"overflow-hidden"),style:{backgroundColor:"var(--n-window-body)",marginInline:be.band.side,marginBottom:be.band.bottom,boxShadow:be.band.side>0?"inset 0 0 0 1px rgb(0 0 0 / 0.12)":void 0},inert:b(ye),children:he}),!A||Ee||ye?null:e("span",{id:ge,hidden:!0,children:fe.resizeHint}),!A||Ee||ye?null:z.map(t=>{const n="se"===t.edge;return e("div",{role:n?"button":void 0,tabIndex:n?0:void 0,"aria-label":n?le??fe.resize:void 0,"aria-describedby":n?ge:void 0,"aria-hidden":n?void 0:"true",className:d("absolute z-10 touch-none",t.className,n?"neba-hit":"",n?"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]":""),onPointerDown:e=>function(e,t){const n=_e.current;if(!n||Ee)return;const i={width:n.offsetWidth,height:n.offsetHeight,x:He.x,y:He.y},o=e.includes("e"),r=e.includes("w"),s=e.includes("n"),a=e.includes("s");Ue(t,(e,t)=>{let{width:n,height:l}=i,{x:d,y:c}=i;o&&(n=Math.max(Ge.width,i.width+e)),a&&(l=Math.max(Ge.height,i.height+t)),r&&(n=Math.max(Ge.width,i.width-e),d=i.x+(i.width-n)),s&&(l=Math.max(Ge.height,i.height-t),c=i.y+(i.height-l)),Je({width:n,height:l}),(r||s)&&Se({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=_e.current;n&&Je({width:Math.max(Ge.width,n.offsetWidth+e),height:Math.max(Ge.height,n.offsetHeight+t)})}(t[0],t[1]))}:void 0},t.edge)})]}),...me}});return ve||Xe?rt:null});
|
|
@@ -15,7 +15,9 @@ export interface ElementSize {
|
|
|
15
15
|
* The ref goes on the element to watch. It measures once as soon as that
|
|
16
16
|
* element is there rather than waiting to be told, because a `ResizeObserver`
|
|
17
17
|
* that is missing — an old browser, a server — never says anything at all, and
|
|
18
|
-
* a component sized `0 × 0` forever is worse than one measured once.
|
|
18
|
+
* a component sized `0 × 0` forever is worse than one measured once. An element
|
|
19
|
+
* put on the ref after the first render, behind a loading state for instance, is
|
|
20
|
+
* measured when it arrives.
|
|
19
21
|
*/
|
|
20
22
|
export declare function useElementSize<E extends Element = HTMLElement>(): [
|
|
21
23
|
React.RefObject<E | null>,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as t from"react";import{observeResize as
|
|
1
|
+
"use client";import*as t from"react";import{attachedRef as e,observeResize as i}from"../internal/observe.js";export function useElementSize(){const[n,h]=t.useState(null),[r]=t.useState(()=>e(h)),[u,o]=t.useState({width:0,height:0});return t.useLayoutEffect(()=>{if(!n)return;const t=()=>{const t=n.getBoundingClientRect();o(e=>e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})};return t(),i(n,t)},[n]),[r,u]}
|
|
@@ -20,5 +20,8 @@ export interface OnScreenOptions {
|
|
|
20
20
|
* It answers `true` where there is no `IntersectionObserver` rather than
|
|
21
21
|
* `false`, and that is the load-bearing part: a caller cannot know without one,
|
|
22
22
|
* and the right fallback is to show the thing rather than to hide it forever.
|
|
23
|
+
*
|
|
24
|
+
* An element put on the ref after the first render, behind a loading state for
|
|
25
|
+
* instance, is watched from when it arrives.
|
|
23
26
|
*/
|
|
24
27
|
export declare function useOnScreen<E extends Element = HTMLElement>(options?: OnScreenOptions): [React.RefObject<E | null>, boolean];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{observeVisibility as r}from"../internal/observe.js";export function useOnScreen(
|
|
1
|
+
"use client";import*as e from"react";import{attachedRef as t,observeVisibility as r}from"../internal/observe.js";export function useOnScreen(n={}){const{threshold:s=0,once:o=!0}=n,[u,c]=e.useState(null),[f]=e.useState(()=>t(c)),[i,a]=e.useState(!1);return e.useEffect(()=>{if(!u)return;const e=r(u,s,t=>{a(t),t&&o&&e?.()});if(e)return e;a(!0)},[u,s,o]),[f,i]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
2
|
export * from './hooks/index.js';
|
|
3
3
|
export * from './components/accordion/index.js';
|
|
4
|
+
export * from './components/agent-steps/index.js';
|
|
4
5
|
export * from './components/alert/index.js';
|
|
5
6
|
export * from './components/anchor/index.js';
|
|
6
7
|
export * from './components/animate-appear/index.js';
|
|
7
8
|
export * from './components/app-logo/index.js';
|
|
9
|
+
export * from './components/approval/index.js';
|
|
8
10
|
export * from './components/animate-blink/index.js';
|
|
9
11
|
export * from './components/animate-counter/index.js';
|
|
10
12
|
export * from './components/animate-fade/index.js';
|
|
@@ -45,6 +47,7 @@ export * from './components/combobox/index.js';
|
|
|
45
47
|
export * from './components/command-palette/index.js';
|
|
46
48
|
export * from './components/confirm/index.js';
|
|
47
49
|
export * from './components/container/index.js';
|
|
50
|
+
export * from './components/context-window/index.js';
|
|
48
51
|
export * from './components/data-list/index.js';
|
|
49
52
|
export * from './components/data-table/index.js';
|
|
50
53
|
export * from './components/date-picker/index.js';
|
|
@@ -73,6 +76,7 @@ export * from './components/how-to-steps/index.js';
|
|
|
73
76
|
export * from './components/icon/index.js';
|
|
74
77
|
export * from './components/icon-button/index.js';
|
|
75
78
|
export * from './components/image/index.js';
|
|
79
|
+
export * from './components/inline-citation/index.js';
|
|
76
80
|
export * from './components/line-chart/index.js';
|
|
77
81
|
export * from './components/list/index.js';
|
|
78
82
|
export * from './components/menu/index.js';
|
|
@@ -94,8 +98,10 @@ export * from './components/portal/index.js';
|
|
|
94
98
|
export * from './components/progress-box/index.js';
|
|
95
99
|
export * from './components/progress-circular/index.js';
|
|
96
100
|
export * from './components/progress-linear/index.js';
|
|
101
|
+
export * from './components/prompt-input/index.js';
|
|
97
102
|
export * from './components/provider/index.js';
|
|
98
103
|
export * from './components/radio-group/index.js';
|
|
104
|
+
export * from './components/reasoning/index.js';
|
|
99
105
|
export * from './components/rating/index.js';
|
|
100
106
|
export * from './components/scatter-chart/index.js';
|
|
101
107
|
export * from './components/scroll-area/index.js';
|
|
@@ -109,8 +115,10 @@ export * from './components/skeleton/index.js';
|
|
|
109
115
|
export * from './components/slider/index.js';
|
|
110
116
|
export * from './components/sparkline/index.js';
|
|
111
117
|
export * from './components/spoiler/index.js';
|
|
118
|
+
export * from './components/sources/index.js';
|
|
112
119
|
export * from './components/stack/index.js';
|
|
113
120
|
export * from './components/statistic/index.js';
|
|
121
|
+
export * from './components/streaming-text/index.js';
|
|
114
122
|
export * from './components/switch/index.js';
|
|
115
123
|
export * from './components/table/index.js';
|
|
116
124
|
export * from './components/tabs/index.js';
|
|
@@ -123,6 +131,7 @@ export * from './components/toast/index.js';
|
|
|
123
131
|
export * from './components/toggle/index.js';
|
|
124
132
|
export * from './components/toggle-group/index.js';
|
|
125
133
|
export * from './components/toolbar/index.js';
|
|
134
|
+
export * from './components/tool-call/index.js';
|
|
126
135
|
export * from './components/tooltip/index.js';
|
|
127
136
|
export * from './components/tour/index.js';
|
|
128
137
|
export * from './components/transfer/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./types.js";export*from"./hooks/index.js";export*from"./components/accordion/index.js";export*from"./components/alert/index.js";export*from"./components/anchor/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-counter/index.js";export*from"./components/animate-fade/index.js";export*from"./components/animate-float/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-reveal/index.js";export*from"./components/animate-rotate/index.js";export*from"./components/animate-scramble/index.js";export*from"./components/animate-shake/index.js";export*from"./components/animate-split/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/calendar/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/command-palette/index.js";export*from"./components/confirm/index.js";export*from"./components/container/index.js";export*from"./components/data-list/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/fieldset/index.js";export*from"./components/file-picker/index.js";export*from"./components/flex/index.js";export*from"./components/form/index.js";export*from"./components/gallery/index.js";export*from"./components/gauge-chart/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/hover-card/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/image/index.js";export*from"./components/line-chart/index.js";export*from"./components/list/index.js";export*from"./components/menu/index.js";export*from"./components/menubar/index.js";export*from"./components/meter/index.js";export*from"./components/mockup/index.js";export*from"./components/navigation-menu/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/popconfirm/index.js";export*from"./components/popover/index.js";export*from"./components/portal/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/provider/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-area/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/show/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/stack/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/toggle/index.js";export*from"./components/toggle-group/index.js";export*from"./components/toolbar/index.js";export*from"./components/tooltip/index.js";export*from"./components/tour/index.js";export*from"./components/transfer/index.js";export*from"./components/tree-select/index.js";export*from"./components/tree-view/index.js";export*from"./components/typography/index.js";export*from"./components/visually-hidden/index.js";export*from"./components/window-pane/index.js";
|
|
1
|
+
export*from"./types.js";export*from"./hooks/index.js";export*from"./components/accordion/index.js";export*from"./components/agent-steps/index.js";export*from"./components/alert/index.js";export*from"./components/anchor/index.js";export*from"./components/animate-appear/index.js";export*from"./components/app-logo/index.js";export*from"./components/approval/index.js";export*from"./components/animate-blink/index.js";export*from"./components/animate-counter/index.js";export*from"./components/animate-fade/index.js";export*from"./components/animate-float/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-reveal/index.js";export*from"./components/animate-rotate/index.js";export*from"./components/animate-scramble/index.js";export*from"./components/animate-shake/index.js";export*from"./components/animate-split/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/calendar/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/command-palette/index.js";export*from"./components/confirm/index.js";export*from"./components/container/index.js";export*from"./components/context-window/index.js";export*from"./components/data-list/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/fieldset/index.js";export*from"./components/file-picker/index.js";export*from"./components/flex/index.js";export*from"./components/form/index.js";export*from"./components/gallery/index.js";export*from"./components/gauge-chart/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/hover-card/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/image/index.js";export*from"./components/inline-citation/index.js";export*from"./components/line-chart/index.js";export*from"./components/list/index.js";export*from"./components/menu/index.js";export*from"./components/menubar/index.js";export*from"./components/meter/index.js";export*from"./components/mockup/index.js";export*from"./components/navigation-menu/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/popconfirm/index.js";export*from"./components/popover/index.js";export*from"./components/portal/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/prompt-input/index.js";export*from"./components/provider/index.js";export*from"./components/radio-group/index.js";export*from"./components/reasoning/index.js";export*from"./components/rating/index.js";export*from"./components/scatter-chart/index.js";export*from"./components/scroll-area/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/show/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/sources/index.js";export*from"./components/stack/index.js";export*from"./components/statistic/index.js";export*from"./components/streaming-text/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/toggle/index.js";export*from"./components/toggle-group/index.js";export*from"./components/toolbar/index.js";export*from"./components/tool-call/index.js";export*from"./components/tooltip/index.js";export*from"./components/tour/index.js";export*from"./components/transfer/index.js";export*from"./components/tree-select/index.js";export*from"./components/tree-view/index.js";export*from"./components/typography/index.js";export*from"./components/visually-hidden/index.js";export*from"./components/window-pane/index.js";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* with it.
|
|
4
4
|
*
|
|
5
5
|
* It lives in `internal/` for the reason `button-group.ts` and `menu.ts` do:
|
|
6
|
-
*
|
|
6
|
+
* seventeen components need it and none of them should have to import another. The
|
|
7
7
|
* `transition` prop needs the same table from the other side — a Card and an
|
|
8
8
|
* `AnimateFade` must produce the same fade, or the library has two fades.
|
|
9
9
|
*
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*
|
|
19
19
|
* Because the from-state is the *keyframe* rather than a second class, running
|
|
20
20
|
* an effect backwards is `animation-direction: reverse` and nothing else. That
|
|
21
|
-
* is what makes `mode="out"` free on
|
|
21
|
+
* is what makes `mode="out"` free on every one of them.
|
|
22
22
|
*
|
|
23
23
|
* ## What is deliberately not here
|
|
24
24
|
*
|
|
@@ -40,6 +40,11 @@ import type { NebaAnimateRepeat, NebaAnimateTimeline, NebaAnimateTrigger, NebaAn
|
|
|
40
40
|
export declare const animationClasses: Record<NebaAnimation, string>;
|
|
41
41
|
/** The class that reads the slots. Always paired with one of the above. */
|
|
42
42
|
export declare const animBaseClass = "neba-anim";
|
|
43
|
+
/**
|
|
44
|
+
* The parts a replay rewinds when the effect was handed to each child rather
|
|
45
|
+
* than run on the root, read from the root. See `AnimationRunOptions.parts`.
|
|
46
|
+
*/
|
|
47
|
+
export declare const childAnimations = ":scope > .neba-anim";
|
|
43
48
|
/**
|
|
44
49
|
* How long each effect takes when nobody said.
|
|
45
50
|
*
|
|
@@ -117,6 +122,15 @@ export declare function staggers({ stagger, durationStep }: StaggerOptions): boo
|
|
|
117
122
|
* how to opt part of a list out — group it.
|
|
118
123
|
*/
|
|
119
124
|
export declare function staggerChildren(children: React.ReactNode, effectClass: string, slots: AnimationSlotOptions, { stagger, durationStep, reverse }: StaggerOptions): React.ReactNode[];
|
|
125
|
+
/**
|
|
126
|
+
* The shortest a blink may run, in milliseconds.
|
|
127
|
+
*
|
|
128
|
+
* One blink is one flash, full to faint and back, and more than three flashes
|
|
129
|
+
* in a second is what WCAG 2.3.1 rules out, because that is the rate at which a
|
|
130
|
+
* flash can bring on a seizure. A shorter `duration` is raised to this rather
|
|
131
|
+
* than refused, wherever a blink is asked for.
|
|
132
|
+
*/
|
|
133
|
+
export declare const MIN_BLINK_DURATION = 334;
|
|
120
134
|
/**
|
|
121
135
|
* What a component's `transition` prop turns into: one class pair and a handful
|
|
122
136
|
* of custom properties, merged into whatever the component was already writing.
|
|
@@ -130,6 +144,11 @@ export declare function transitionProps(transition: NebaTransition | undefined):
|
|
|
130
144
|
className: string;
|
|
131
145
|
style: React.CSSProperties;
|
|
132
146
|
};
|
|
147
|
+
/** An effect, and the slots it reads. */
|
|
148
|
+
export interface TransitionParts {
|
|
149
|
+
effect: NebaAnimation;
|
|
150
|
+
slots: AnimationSlotOptions;
|
|
151
|
+
}
|
|
133
152
|
/**
|
|
134
153
|
* The same reading, one step before it becomes a class and a style object.
|
|
135
154
|
*
|
|
@@ -138,27 +157,44 @@ export declare function transitionProps(transition: NebaTransition | undefined):
|
|
|
138
157
|
* add to the delay before the slots are filled. Splitting it here is what keeps
|
|
139
158
|
* one table: `transition="fade"` on a Card and on a Stack item are the same
|
|
140
159
|
* fade, read by the same code.
|
|
160
|
+
*
|
|
161
|
+
* Given an effect it always has an answer, and the overload says so: AnimateSplit
|
|
162
|
+
* names one every time, and a `null` it could never receive was two branches of
|
|
163
|
+
* code that never ran.
|
|
141
164
|
*/
|
|
142
|
-
export declare function transitionParts(transition: NebaTransition
|
|
143
|
-
|
|
144
|
-
slots: AnimationSlotOptions;
|
|
145
|
-
} | null;
|
|
165
|
+
export declare function transitionParts(transition: NebaTransition): TransitionParts;
|
|
166
|
+
export declare function transitionParts(transition: NebaTransition | undefined): TransitionParts | null;
|
|
146
167
|
/**
|
|
147
|
-
* Whether the reader has asked for less motion — the hook the
|
|
168
|
+
* Whether the reader has asked for less motion — the hook the four effects
|
|
148
169
|
* with motion written in JavaScript read. It lives in `media.ts` beside the
|
|
149
170
|
* query it asks, so a Carousel and a ScrollZone can ask the same question
|
|
150
|
-
* without pulling the
|
|
171
|
+
* without pulling the table of effects below in with the answer.
|
|
151
172
|
*/
|
|
152
173
|
export { usePrefersReducedMotion } from './media.js';
|
|
153
174
|
export interface AnimationRunOptions {
|
|
154
175
|
trigger: NebaAnimateTrigger;
|
|
155
|
-
play?: boolean;
|
|
176
|
+
play?: boolean | number;
|
|
156
177
|
once: boolean;
|
|
157
178
|
threshold: number;
|
|
158
179
|
paused?: boolean;
|
|
159
180
|
/** An infinite effect stops when the pointer leaves; a finite one finishes. */
|
|
160
181
|
infinite: boolean;
|
|
182
|
+
/**
|
|
183
|
+
* The descendants a replay rewinds along with the root, as a selector read
|
|
184
|
+
* from it: `childAnimations` for an effect handed to each child. Only the
|
|
185
|
+
* component's own parts, so an animation of somebody else's inside it is
|
|
186
|
+
* left where it is.
|
|
187
|
+
*/
|
|
188
|
+
parts?: string;
|
|
189
|
+
/**
|
|
190
|
+
* The caller's own props, read for the four events a `hover` trigger listens
|
|
191
|
+
* to. Their handlers run beside the trigger's: spread in one order the
|
|
192
|
+
* trigger threw them away, and spread in the other they took the trigger off.
|
|
193
|
+
*/
|
|
194
|
+
caller?: TriggerHandlers;
|
|
161
195
|
}
|
|
196
|
+
/** The events a `hover` trigger listens to. */
|
|
197
|
+
type TriggerHandlers = Pick<React.HTMLAttributes<HTMLElement>, 'onPointerEnter' | 'onPointerLeave' | 'onFocus' | 'onBlur'>;
|
|
162
198
|
export interface AnimationRun {
|
|
163
199
|
/** Goes on the animated element. */
|
|
164
200
|
ref: React.RefCallback<HTMLElement>;
|
|
@@ -166,8 +202,17 @@ export interface AnimationRun {
|
|
|
166
202
|
state: 'running' | 'paused';
|
|
167
203
|
/** Whether the animation has been let go at all, for `data-state`. */
|
|
168
204
|
started: boolean;
|
|
169
|
-
/**
|
|
170
|
-
|
|
205
|
+
/**
|
|
206
|
+
* Spread onto the element after the caller's props when `trigger` is
|
|
207
|
+
* `hover`, with the caller's handlers already inside; empty otherwise.
|
|
208
|
+
*/
|
|
209
|
+
handlers: TriggerHandlers;
|
|
210
|
+
/**
|
|
211
|
+
* An endless effect that is off the screen, and held where it is until it
|
|
212
|
+
* comes back. Already folded into `state`; a loop written in JavaScript reads
|
|
213
|
+
* it beside `paused`.
|
|
214
|
+
*/
|
|
215
|
+
offscreen: boolean;
|
|
171
216
|
}
|
|
172
217
|
/**
|
|
173
218
|
* Starts, restarts and holds an animation.
|
|
@@ -188,7 +233,7 @@ export interface AnimationRun {
|
|
|
188
233
|
* style to settle, and putting it back is the one move that rewinds the element
|
|
189
234
|
* and leaves everything inside it alone.
|
|
190
235
|
*/
|
|
191
|
-
export declare function useAnimationRun({ trigger, play, once, threshold, paused, infinite }: AnimationRunOptions): AnimationRun;
|
|
236
|
+
export declare function useAnimationRun({ trigger, play, once, threshold, paused, infinite, caller, parts }: AnimationRunOptions): AnimationRun;
|
|
192
237
|
export interface AnimateElementParams extends AnimationSlotOptions, AnimationRunOptions {
|
|
193
238
|
/** Which keyframe, out of the shared table. `null` to bring your own. */
|
|
194
239
|
effect: NebaAnimation | null;
|
|
@@ -222,11 +267,13 @@ export interface AnimateElement {
|
|
|
222
267
|
/**
|
|
223
268
|
* Everything an `Animate*` root needs, in one call.
|
|
224
269
|
*
|
|
225
|
-
* The
|
|
270
|
+
* The ten effect components differ only in their defaults and in which slots
|
|
226
271
|
* they fill, so this is where the identical two-thirds of each of them lives.
|
|
227
|
-
* The
|
|
228
|
-
*
|
|
229
|
-
*
|
|
272
|
+
* The seven that have to understand their children or their text — Typing,
|
|
273
|
+
* Marquee, Headline, Appear, Split, Scramble and Counter — call
|
|
274
|
+
* `useAnimationRun` directly and put the classes where their own structure
|
|
275
|
+
* needs them. `effect` may be `null` for the one effect component, Lighting,
|
|
276
|
+
* whose keyframe runs on a pseudo-element rather than on its root.
|
|
230
277
|
*
|
|
231
278
|
* `data-neba-animation` and `data-state` are here rather than in each component
|
|
232
279
|
* because they are the same two facts every time, and because a test that has
|
package/dist/internal/animate.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e}from"react/jsx-runtime";import*as n from"react";import{observeVisibility as t}from"./observe.js";import{cx as a}from"./styles.js";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",reveal:"neba-anim-reveal"};export const animBaseClass="neba-anim";export const defaultDurations={fade:320,grow:340,slide:380,zoom:340,rotate:460,blink:900,reveal:620};export function revealClip(e){switch(e){case"top":return"inset(0 0 100% 0)";case"bottom":return"inset(100% 0 0 0)";case"right":return"inset(0 0 0 100%)";default:return"inset(0 100% 0 0)"}}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":(r=e.repeat,"infinite"===r?"infinite":String(r)),"--n-anim-direction":(t=e.mode??"in",a=e.alternate,"out"===t?a?"alternate-reverse":"reverse":a?"alternate":"normal")};var t,a,r;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),void 0!==e.clip&&(n["--n-anim-clip"]=e.clip),"view"===e.timeline&&(n["--n-anim-timeline"]="view()",n["--n-anim-range"]=e.range??"entry 0% cover 45%"),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 staggers({stagger:e,durationStep:n}){return 0!==e||0!==n}export function staggerChildren(t,r,i,{stagger:s,durationStep:o,reverse:l}){const
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import*as n from"react";import{observeVisibility as t}from"./observe.js";import{cx as a}from"./styles.js";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",reveal:"neba-anim-reveal"};export const animBaseClass="neba-anim";export const childAnimations=":scope > .neba-anim";export const defaultDurations={fade:320,grow:340,slide:380,zoom:340,rotate:460,blink:900,reveal:620};export function revealClip(e){switch(e){case"top":return"inset(0 0 100% 0)";case"bottom":return"inset(100% 0 0 0)";case"right":return"inset(0 0 0 100%)";default:return"inset(0 100% 0 0)"}}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":(r=e.repeat,"infinite"===r?"infinite":String(r)),"--n-anim-direction":(t=e.mode??"in",a=e.alternate,"out"===t?a?"alternate-reverse":"reverse":a?"alternate":"normal")};var t,a,r;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),void 0!==e.clip&&(n["--n-anim-clip"]=e.clip),"view"===e.timeline&&(n["--n-anim-timeline"]="view()",n["--n-anim-range"]=e.range??"entry 0% cover 45%"),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 staggers({stagger:e,durationStep:n}){return 0!==e||0!==n}export function staggerChildren(t,r,i,{stagger:s,durationStep:o,reverse:l}){const c=n.Children.toArray(t);return c.map((t,u)=>{const m=l?c.length-1-u:u,f=animationSlots({...i,delay:i.delay+m*s,duration:Math.max(0,i.duration+m*o)});if(!n.isValidElement(t))return e("span",{className:r,style:f,children:t},u);const d=t.props;return n.cloneElement(t,{className:a(r,d.className),style:{...f,...d.style}})})}export const MIN_BLINK_DURATION=334;export function transitionProps(e){const n=transitionParts(e);return n?{className:`neba-anim ${animationClasses[n.effect]}`,style:{...animationSlots(n.slots),"--n-anim-state":"running"}}:{className:"",style:{}}}export function transitionParts(e){if(!e)return null;const n="string"==typeof e?{type:e}:e,{type:t}=n,a=n.duration??defaultDurations[t],r={duration:"blink"===t?Math.max(a,334):a,delay:n.delay??0,easing:n.easing,repeat:n.repeat??("blink"===t?"infinite":1),alternate:n.alternate,timeline:n.timeline,range:n.range};if("grow"!==t&&"zoom"!==t||(r.scale=n.scale??("zoom"===t?.4:.8)),"slide"===t){const{x:e,y:t}=slideOffsets(n.from??"bottom",n.distance??"100%");r.x=e,r.y=t}return"rotate"===t&&(r.angle=`${n.angle??-180}deg`),"reveal"===t&&(r.clip=revealClip(n.side??"left")),{effect:t,slots:r}}export{usePrefersReducedMotion}from"./media.js";export function useAnimationRun({trigger:e,play:a,once:r,threshold:i,paused:s,infinite:o,caller:l,parts:c}){const u=n.useRef(null),[m,f]=n.useState("mount"===e),[d,p]=n.useState(0),[g,y]=n.useState(!1),x=n.useCallback(()=>{f(!0),p(e=>e+1)},[]);n.useLayoutEffect(()=>{const e=u.current;if(!e||0===d)return;const n=[e,...c?e.querySelectorAll(c):[]];for(const e of n)e.style.animationName="none";e.offsetWidth;for(const e of n)e.style.animationName=""},[d,c]),n.useEffect(()=>{if("visible"!==e)return;const n=u.current;if(!n)return;let a=null;if(a=t(n,i,e=>{e?(x(),r&&(a?.(),a=null)):r||f(!1)}),a)return()=>a?.();f(!0)},[e,r,i,x]),n.useEffect(()=>{const e=u.current;if(o&&e)return t(e,0,e=>y(!e))??void 0},[o]),n.useEffect(()=>{"manual"===e&&(a?x():f(!1))},[e,a,x]);const v=e=>e.relatedTarget instanceof Node&&e.currentTarget.contains(e.relatedTarget),b="hover"===e?{onPointerEnter:e=>{l?.onPointerEnter?.(e),x()},onFocus:e=>{l?.onFocus?.(e),v(e)||x()},onPointerLeave:e=>{l?.onPointerLeave?.(e),o&&f(!1)},onBlur:e=>{l?.onBlur?.(e),o&&!v(e)&&f(!1)}}:{};return{ref:n.useCallback(e=>{u.current=e},[]),state:!m||s||o&&g?"paused":"running",started:m,handlers:b,offscreen:o&&g}}export function useAnimateElement(e){const{effect:n,trigger:t,play:a,once:r,threshold:i,paused:s,infinite:o,caller:l,children:c,stagger:u=0,durationStep:m=0,reverse:f=!1,effectClass:d,name:p,...g}=e,y=n?animationClasses[n]:d,x=y?`neba-anim ${y}`:"",v=""!==x&&staggers({stagger:u,durationStep:m,reverse:f}),b=useAnimationRun({trigger:t,play:a,once:r,threshold:i,paused:s,infinite:o,caller:l,parts:v?childAnimations:void 0}),h="view"===g.timeline?"running":b.state;return{ref:b.ref,className:v?"":x,style:v?{"--n-anim-state":h}:{...animationSlots(g),"--n-anim-state":h},props:{...b.handlers,"data-neba-animation":p??n??void 0,"data-state":h},children:v?staggerChildren(c,x,g,{stagger:u,durationStep:m,reverse:f}):c}}
|
|
@@ -83,6 +83,11 @@ export interface CalendarProps {
|
|
|
83
83
|
renderDay?: (date: Date) => React.ReactNode;
|
|
84
84
|
/** Takes the focus on mount — the popup has just opened. */
|
|
85
85
|
autoFocus?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* More than one cell can be selected at once — a `multiple` calendar or a
|
|
88
|
+
* range — which a screen reader is told on the grid a pick is made in.
|
|
89
|
+
*/
|
|
90
|
+
multiselectable?: boolean;
|
|
86
91
|
showPreviousButton?: boolean;
|
|
87
92
|
showNextButton?: boolean;
|
|
88
93
|
labels: PickerLabels;
|
|
@@ -109,7 +114,7 @@ export interface CalendarProps {
|
|
|
109
114
|
* grid instead of walking forty-two cells — the pattern the ARIA date-picker
|
|
110
115
|
* practice describes, and the reason none of the cells is a `disabled` button.
|
|
111
116
|
*/
|
|
112
|
-
export declare function Calendar({ size, color, locale, weekStartsOn, month, onMonthChange, selected, rangeStart, rangeEnd, onSelect, granularity, renderDay, onPreviewChange, minDate, maxDate, shouldDisableDate, showOutsideDays, autoFocus, showPreviousButton, showNextButton, labels, className }: CalendarProps): React.JSX.Element;
|
|
117
|
+
export declare function Calendar({ size, color, locale, weekStartsOn, month, onMonthChange, selected, rangeStart, rangeEnd, onSelect, granularity, renderDay, onPreviewChange, minDate, maxDate, shouldDisableDate, showOutsideDays, autoFocus, multiselectable, showPreviousButton, showNextButton, labels, className }: CalendarProps): React.JSX.Element;
|
|
113
118
|
export type { TimeUnit };
|
|
114
119
|
export interface TimeGridProps {
|
|
115
120
|
size: NebaSize;
|