neba 1.10.0 → 1.11.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 +35 -5
- package/dist/components/accordion/Accordion.js +1 -1
- package/dist/components/alert/Alert.js +1 -1
- package/dist/components/anchor/Anchor.js +1 -1
- package/dist/components/animate-lighting/AnimateLighting.js +1 -1
- package/dist/components/app-logo/AppLogo.js +1 -1
- package/dist/components/aspect-ratio/AspectRatio.js +1 -1
- package/dist/components/avatar/Avatar.js +1 -1
- package/dist/components/avatar-group/AvatarGroup.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.js +1 -1
- package/dist/components/box/Box.js +1 -1
- package/dist/components/breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/button/Button.js +1 -1
- package/dist/components/button-group/ButtonGroup.js +1 -1
- package/dist/components/calendar/Calendar.d.ts +72 -0
- package/dist/components/calendar/Calendar.js +1 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.js +1 -0
- package/dist/components/card/Card.js +1 -1
- 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.js +1 -1
- package/dist/components/code-block/CodeBlock.js +1 -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 +14 -2
- package/dist/components/combobox/Combobox.js +1 -1
- package/dist/components/command-palette/CommandPalette.d.ts +1 -1
- package/dist/components/command-palette/CommandPalette.js +1 -1
- package/dist/components/confirm/Confirm.d.ts +83 -0
- package/dist/components/confirm/Confirm.js +1 -0
- package/dist/components/confirm/index.d.ts +2 -0
- package/dist/components/confirm/index.js +1 -0
- package/dist/components/container/Container.js +1 -1
- package/dist/components/data-list/DataList.js +1 -1
- package/dist/components/data-table/DataTable.d.ts +104 -1
- package/dist/components/data-table/DataTable.js +1 -1
- package/dist/components/date-picker/DatePicker.d.ts +40 -8
- 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 +1 -1
- package/dist/components/dialog/Dialog.js +1 -1
- package/dist/components/divider/Divider.js +1 -1
- package/dist/components/drawer/Drawer.d.ts +1 -1
- package/dist/components/drawer/Drawer.js +1 -1
- package/dist/components/empty/Empty.js +1 -1
- package/dist/components/file-picker/FilePicker.js +1 -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.js +1 -1
- package/dist/components/gauge-chart/GaugeChart.d.ts +1 -1
- package/dist/components/gauge-chart/GaugeChart.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.d.ts +1 -1
- package/dist/components/heatmap-chart/HeatmapChart.js +1 -1
- package/dist/components/highlight/Highlight.js +1 -1
- package/dist/components/hover-card/HoverCard.d.ts +1 -1
- package/dist/components/hover-card/HoverCard.js +1 -1
- package/dist/components/how-to-steps/HowToSteps.js +1 -1
- package/dist/components/image/Image.d.ts +70 -0
- package/dist/components/image/Image.js +1 -0
- package/dist/components/image/index.d.ts +2 -0
- package/dist/components/image/index.js +1 -0
- package/dist/components/list/List.js +1 -1
- package/dist/components/menubar/Menubar.js +1 -1
- package/dist/components/meter/Meter.js +1 -1
- package/dist/components/mockup/Mockup.js +1 -1
- package/dist/components/number-field/NumberField.d.ts +12 -2
- package/dist/components/number-field/NumberField.js +1 -1
- 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.js +1 -1
- package/dist/components/pagination/Pagination.js +1 -1
- package/dist/components/panes/Panes.js +1 -1
- package/dist/components/pie-chart/PieChart.d.ts +1 -1
- package/dist/components/pie-chart/PieChart.js +1 -1
- package/dist/components/pill/Pill.js +1 -1
- package/dist/components/popconfirm/Popconfirm.d.ts +71 -0
- package/dist/components/popconfirm/Popconfirm.js +1 -0
- package/dist/components/popconfirm/index.d.ts +2 -0
- package/dist/components/popconfirm/index.js +1 -0
- package/dist/components/popover/Popover.d.ts +1 -1
- package/dist/components/popover/Popover.js +1 -1
- package/dist/components/portal/Portal.d.ts +48 -0
- package/dist/components/portal/Portal.js +1 -0
- package/dist/components/portal/index.d.ts +2 -0
- package/dist/components/portal/index.js +1 -0
- 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/provider/NebaProvider.d.ts +99 -0
- package/dist/components/provider/NebaProvider.js +1 -0
- package/dist/components/provider/index.d.ts +3 -0
- package/dist/components/provider/index.js +1 -0
- package/dist/components/rating/Rating.js +1 -1
- package/dist/components/scatter-chart/ScatterChart.d.ts +1 -1
- package/dist/components/scatter-chart/ScatterChart.js +1 -1
- package/dist/components/scroll-area/ScrollArea.js +1 -1
- package/dist/components/scroll-zone/ScrollZone.js +1 -1
- package/dist/components/select/Select.js +1 -1
- package/dist/components/shortcut/Shortcut.d.ts +2 -1
- package/dist/components/shortcut/Shortcut.js +1 -1
- package/dist/components/sidebar/Sidebar.js +1 -1
- package/dist/components/sidebar/SidebarTrigger.js +1 -1
- package/dist/components/skeleton/Skeleton.js +1 -1
- package/dist/components/slider/Slider.js +1 -1
- package/dist/components/sparkline/Sparkline.js +1 -1
- package/dist/components/spoiler/Spoiler.js +1 -1
- package/dist/components/statistic/Statistic.js +1 -1
- package/dist/components/switch/Switch.js +1 -1
- package/dist/components/table/Table.d.ts +1 -1
- package/dist/components/table/Table.js +1 -1
- package/dist/components/text-field/TextField.d.ts +12 -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-chart/TimelineChart.d.ts +1 -1
- package/dist/components/timeline-chart/TimelineChart.js +1 -1
- package/dist/components/toast/Toast.d.ts +1 -1
- 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/toolbar/Toolbar.js +1 -1
- package/dist/components/tooltip/Tooltip.d.ts +1 -1
- package/dist/components/tooltip/Tooltip.js +1 -1
- package/dist/components/tour/Tour.d.ts +1 -1
- package/dist/components/tour/Tour.js +1 -1
- package/dist/components/transfer/Transfer.js +1 -1
- package/dist/components/tree-select/TreeSelect.d.ts +88 -0
- package/dist/components/tree-select/TreeSelect.js +1 -0
- package/dist/components/tree-select/index.d.ts +2 -0
- package/dist/components/tree-select/index.js +1 -0
- package/dist/components/tree-view/TreeView.js +1 -1
- package/dist/components/visually-hidden/VisuallyHidden.d.ts +37 -0
- package/dist/components/visually-hidden/VisuallyHidden.js +1 -0
- package/dist/components/visually-hidden/index.d.ts +2 -0
- package/dist/components/visually-hidden/index.js +1 -0
- package/dist/components/window-pane/WindowPane.js +1 -1
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useDisclosure.d.ts +21 -0
- package/dist/hooks/useDisclosure.js +1 -0
- package/dist/hooks/useElementSize.d.ts +23 -0
- package/dist/hooks/useElementSize.js +1 -0
- package/dist/hooks/useMediaQuery.d.ts +27 -0
- package/dist/hooks/useMediaQuery.js +1 -0
- package/dist/hooks/useOnScreen.d.ts +24 -0
- package/dist/hooks/useOnScreen.js +1 -0
- package/dist/hooks/useShortcut.d.ts +34 -0
- package/dist/hooks/useShortcut.js +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1 -1
- package/dist/internal/calendar.d.ts +31 -5
- package/dist/internal/calendar.js +1 -1
- package/dist/internal/csv.d.ts +40 -0
- package/dist/internal/csv.js +1 -0
- package/dist/internal/date.d.ts +39 -1
- package/dist/internal/date.js +1 -1
- package/dist/internal/defaults.d.ts +46 -0
- package/dist/internal/defaults.js +1 -0
- package/dist/internal/i18n.d.ts +23 -0
- package/dist/internal/i18n.js +1 -1
- package/dist/internal/keys.d.ts +92 -0
- package/dist/internal/keys.js +1 -0
- package/dist/internal/media.d.ts +27 -0
- package/dist/internal/media.js +1 -1
- package/dist/internal/page-layout.d.ts +7 -0
- package/dist/internal/page-layout.js +1 -1
- package/dist/internal/picker.d.ts +7 -1
- package/dist/internal/picker.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/types.d.ts +34 -0
- package/package.json +6 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type TreeViewValue } from '../tree-view/TreeView.js';
|
|
3
|
+
import { type PickerShellProps } from '../../internal/picker.js';
|
|
4
|
+
import type { NebaSlots } from '../../types.js';
|
|
5
|
+
/** One node of the tree the reader is choosing from. */
|
|
6
|
+
export interface TreeSelectItem {
|
|
7
|
+
/** What is stored when this node is chosen. Unique across the whole tree. */
|
|
8
|
+
value: TreeViewValue;
|
|
9
|
+
label: React.ReactNode;
|
|
10
|
+
/** What a search matches against. Falls back to `label` when it is a string. */
|
|
11
|
+
searchLabel?: string;
|
|
12
|
+
startIcon?: React.ReactNode;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether this node may itself be chosen.
|
|
16
|
+
*
|
|
17
|
+
* `false` makes it a heading with children under it — a "Europe" that groups
|
|
18
|
+
* countries without being one. Defaults to `true` for a leaf and follows
|
|
19
|
+
* `selectableBranches` for a node that has children.
|
|
20
|
+
*/
|
|
21
|
+
selectable?: boolean;
|
|
22
|
+
children?: TreeSelectItem[];
|
|
23
|
+
}
|
|
24
|
+
/** The parts a TreeSelect draws behind its root. */
|
|
25
|
+
export type TreeSelectSlot = 'popup' | 'tree' | 'item' | 'empty';
|
|
26
|
+
export interface TreeSelectProps extends PickerShellProps {
|
|
27
|
+
/** The tree, as nested items. */
|
|
28
|
+
items?: TreeSelectItem[];
|
|
29
|
+
/** The chosen value, or values when `multiple`. */
|
|
30
|
+
value?: TreeViewValue | TreeViewValue[] | null;
|
|
31
|
+
defaultValue?: TreeViewValue | TreeViewValue[] | null;
|
|
32
|
+
onValueChange?: (value: TreeViewValue[]) => void;
|
|
33
|
+
/** Whether more than one node may be held. @default false */
|
|
34
|
+
multiple?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Whether a node that has children may itself be chosen.
|
|
37
|
+
*
|
|
38
|
+
* Off by default, which is the shape most trees actually have: the branches
|
|
39
|
+
* are the taxonomy and the leaves are the answers. An item's own
|
|
40
|
+
* `selectable` overrides it either way.
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
selectableBranches?: boolean;
|
|
44
|
+
/** Which branches start open. */
|
|
45
|
+
defaultExpanded?: TreeViewValue[];
|
|
46
|
+
expanded?: TreeViewValue[];
|
|
47
|
+
onExpandedChange?: (expanded: TreeViewValue[]) => void;
|
|
48
|
+
/** Whether the popup is open. Use with `onOpenChange` to control it. */
|
|
49
|
+
open?: boolean;
|
|
50
|
+
defaultOpen?: boolean;
|
|
51
|
+
onOpenChange?: (open: boolean) => void;
|
|
52
|
+
/** Shown in the trigger while nothing is chosen. */
|
|
53
|
+
placeholder?: React.ReactNode;
|
|
54
|
+
/** Offers the × that empties the control. @default false */
|
|
55
|
+
clearable?: boolean;
|
|
56
|
+
/** Closes the popup as soon as a node is chosen. @default !multiple */
|
|
57
|
+
closeOnSelect?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Offers a field above the tree that filters it.
|
|
60
|
+
*
|
|
61
|
+
* A match keeps its ancestors, because a node with its parents cut away is a
|
|
62
|
+
* node the reader cannot place — "Seoul" under nothing at all.
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
searchable?: boolean;
|
|
66
|
+
searchPlaceholder?: string;
|
|
67
|
+
/** BCP 47 tag deciding the strings this draws on its own behalf. */
|
|
68
|
+
locale?: string;
|
|
69
|
+
/** How the trigger writes what is held. Defaults to the labels, comma-joined. */
|
|
70
|
+
format?: (chosen: TreeSelectItem[]) => React.ReactNode;
|
|
71
|
+
/** Identifies the field when a form is submitted. One input per value. */
|
|
72
|
+
name?: string;
|
|
73
|
+
classNames?: NebaSlots<TreeSelectSlot>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* A value chosen from a tree rather than from a list.
|
|
77
|
+
*
|
|
78
|
+
* The gap between [Select](./select) and [TreeView](../display/tree-view): the
|
|
79
|
+
* first is a flat list behind a field, the second is a hierarchy that shows
|
|
80
|
+
* what it holds but has no field. A category, a folder, an org chart node and a
|
|
81
|
+
* region are all chosen from a shape a flat list flattens away.
|
|
82
|
+
*
|
|
83
|
+
* `selectableBranches` is off by default because that is the shape most of
|
|
84
|
+
* these trees have — the branches are the taxonomy and the leaves are the
|
|
85
|
+
* answers, and a "Europe" that can be chosen alongside "France" is usually a
|
|
86
|
+
* data model nobody meant. An item's own `selectable` overrides it either way.
|
|
87
|
+
*/
|
|
88
|
+
export declare const TreeSelect: React.ForwardRefExoticComponent<TreeSelectProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +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{defaultPickerLabels as i}from"../../internal/calendar.js";import{searchHaystack as o,searchText as s}from"../../internal/search.js";import{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){return o([e.searchLabel??("string"==typeof e.label?e.label:String(e.value))])}function f(e,l){if(""===l)return e;const a=[];for(const n of e){const e=n.children?f(n.children,l):void 0,r=m(n).includes(l);(r||e&&e.length>0)&&a.push({...n,children:r?n.children:e})}return a}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(o,m){const{items:v=[],value:b,defaultValue:x,onValueChange:y,multiple:j=!1,selectableBranches:C=!1,defaultExpanded:S,expanded:w,onExpandedChange:N,open:O,defaultOpen:z,onOpenChange:M,placeholder:V,clearable:E=!1,closeOnSelect:T,searchable:k=!1,searchPlaceholder:A,locale:I,format:R,name:B,size:L="md",color:P="primary",readOnly:$=!1,disabled:q=!1,classNames:D,...F}=p(o,["size","locale"]),G=u(d,I),H=u(c,I),J=e=>null==e?[]:Array.isArray(e)?e:[e],[K,Q]=a.useState(()=>J(x)),U=void 0!==b?J(b):K,[W,X]=a.useState(z??!1),Y=O??W,[Z,_]=a.useState(""),ee=a.useMemo(()=>h(v),[v]),le=s(Z),ae=a.useMemo(()=>f(v,le),[v,le]),ne=a.useMemo(()=>""===le?void 0:g(ae),[le,ae]),[re,te]=a.useState(()=>S??[]),ie=ne??w??re,oe=e=>{e&&($||q)||(void 0===O&&X(e),e||_(""),M?.(e))},se=e=>{void 0===b&&Q(e),y?.(e)},ce=e=>e.selectable??(!(e.children&&e.children.length>0)||C),de=U.map(e=>ee.get(e)).filter(e=>void 0!==e),ue=0===de.length?V??"":R?R(de):de.map(e=>e.label).reduce((e,l,a)=>0===a?[l]:[...e,", ",l],[]),pe=l=>l.map(l=>e(n,{value:l.value,label:l.label,startIcon:l.startIcon,disabled:l.disabled||!ce(l),className:D?.item,children:l.children?pe(l.children):null},l.value));return e(t,{...F,size:L,color:P,readOnly:$,disabled:q,triggerRef:m,display:ue,empty:0===de.length,clearable:E,onClear:()=>se([]),open:Y,onOpenChange:oe,labels:i,popupClassName:D?.popup,hiddenValues:B?U.map(e=>({name:B,value:String(e)})):void 0,children:l("div",{className:"flex max-h-80 w-64 flex-col gap-2 overflow-hidden",children:[k?e("input",{type:"text",value:Z,placeholder:A??H.search,"aria-label":A??H.search,onChange:e=>_(e.currentTarget.value),className:"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===ae.length?e("p",{className:`px-1 py-2 text-(--neba-muted-fg) ${D?.empty??""}`,children:G.empty}):e(r,{size:L,color:P,multiple:j,selected:U,onSelectedChange:e=>{const l=e.filter(e=>{const l=ee.get(e);return void 0!==l&&ce(l)&&!l.disabled});se(j?l:l.slice(-1)),(T??!j)&&oe(!1)},expanded:ie,onExpandedChange:ne?()=>{}:e=>{void 0===w&&te(e),N?.(e)},className:D?.tree,children:pe(ae)})})]})})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{TreeSelect}from"./TreeSelect.js";
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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";import{useStyleDefaults as p}from"../../internal/defaults.js";const x=/*@__PURE__*/n.createContext({size:"md",density:"default",disabled:!1,expandedKeys:new Set,selectedKeys:new Set,activeKey:null,toggle:()=>{},select:()=>{},activate:()=>{},register:()=>()=>{}}),g={solid:[u,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[u,"border text-(--neba-fg) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--neba-fg) bg-transparent"},b={xs:"0.875rem",sm:"1rem",md:"1.25rem",lg:"1.5rem",xl:"1.75rem"},h={xs:"1.375rem",sm:"1.625rem",md:"2rem",lg:"2.5rem",xl:"3rem"},v={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"}},y={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 k(e){return Array.from(e.querySelectorAll('[role="treeitem"]'))}const C=e=>String(e);export const TreeView=/*@__PURE__*/n.forwardRef(function(t,r){const{variant:a="outline",size:l="md",color:o="primary",density:i="default",elevation:c=0,lines:u="simple",expanded:v,defaultExpanded:y,onExpandedChange:N,selected:S,defaultSelected:j,onSelectedChange:K,multiple:A=!1,disabled:D=!1,label:R,className:E,style:I,children:P,onKeyDown:z,...M}=p(t,["size","density","variant"]),[V,_]=n.useState(y??[]),[L,T]=n.useState(j??[]),[q,F]=n.useState(null),H=v??V,O=S??L,U=n.useRef(null),B=n.useCallback(e=>{U.current=e,"function"==typeof r?r(e):r&&(r.current=e)},[r]),G=n.useCallback(e=>{const t=C(e),r=v??V,n=r.some(e=>C(e)===t)?r.filter(e=>C(e)!==t):[...r,e];void 0===v&&_(n),N?.(n)},[v,V,N]),J=n.useCallback(e=>{const t=C(e),r=S??L,n=r.some(e=>C(e)===t),a=A?n?r.filter(e=>C(e)!==t):[...r,e]:[e];void 0===S&&T(a),K?.(a)},[A,S,L,K]),Q=n.useRef(new Map),W=n.useCallback((e,t)=>(Q.current.set(e,t),()=>{Q.current.delete(e)}),[]),X=n.useMemo(()=>H.map(C).join("\0"),[H]),Y=n.useMemo(()=>O.map(C).join("\0"),[O]),Z=n.useMemo(()=>({size:l,density:i,disabled:D,expandedKeys:new Set(H.map(C)),selectedKeys:new Set(O.map(C)),activeKey:q,toggle:G,select:J,activate:F,register:W}),[l,i,D,X,Y,q,G,J,W]);n.useEffect(()=>{if(null!==q&&Q.current.has(q))return;const e=U.current;if(!e)return;const t=k(e);0!==t.length&&F(t[0].dataset.nebaValue??null)});const $=s("flex list-none flex-col p-1",d[l],g[a],f,w[u],E);return e(x.Provider,{value:Z,children:e("ul",{ref:B,role:"tree","aria-label":R,"aria-multiselectable":A||void 0,className:$,style:{...m(o,c),"--n-tree-indent":b[l],"--n-tree-row":h[l],...I},onKeyDown:function(e){if(z?.(e),e.defaultPrevented)return;const t=U.current,r=e.target?.closest?.('[role="treeitem"]');if(!t||!r||!t.contains(r))return;const n=k(t),a=n.indexOf(r);if(-1===a)return;const l=t=>{t&&(e.preventDefault(),F(t.dataset.nebaValue??null),t.focus())},s=e=>{const t=e.dataset.nebaValue;t&&Q.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()}},...M,children:P})})});export const TreeItem=/*@__PURE__*/n.forwardRef(function({value:d,label:u,startIcon:m,endIcon:p,action:g,href:b,expandable:h,disabled:w=!1,className:k,children:N,onClick:S,...j},K){const{size:A,density:D,disabled:R,expandedKeys:E,selectedKeys:I,activeKey:P,toggle:z,select:M,activate:V,register:_}=n.useContext(x),L=n.useId(),T=d??L,q=C(T),F=n.useRef(null),H=n.useCallback(e=>{F.current=e,"function"==typeof K?K(e):K&&(K.current=e)},[K]),O=n.Children.toArray(N),U=h??O.length>0,B=U&&E.has(q),G=I.has(q),J=w||R,Q=n.useRef({toggle:()=>{}});Q.current.toggle=()=>{!J&&U&&z(T)},n.useEffect(()=>_(q,Q.current),[q,_]);const W=s("flex min-w-0 flex-1 cursor-pointer items-center text-start","h-(--n-tree-row)",v[D][A],y[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(),V(q),z(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(p)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:p}):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]",k),onClick:function(e){e.stopPropagation(),J?e.preventDefault():(F.current?.focus(),V(q),S?.(e),e.defaultPrevented||(U&&z(T),M(T)))},...j,children:[r("div",{className:"flex w-full items-center",children:[b&&!J?e("a",{href:b,tabIndex:-1,className:W,"aria-current":G?"page":void 0,children:X}):e("div",{className:W,children:X}),i(g)?e("span",{className:s("flex shrink-0 items-center",v[D][A]),onClick:e=>e.stopPropagation(),children:g}):null]}),U&&B&&O.length>0?e("ul",{role:"group",className:"list-none ps-(--n-tree-indent)",children:N}):null]})});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
export interface VisuallyHiddenProps extends React.ComponentPropsWithoutRef<'span'> {
|
|
4
|
+
/**
|
|
5
|
+
* Take the hiding off, so the content is drawn like anything else.
|
|
6
|
+
*
|
|
7
|
+
* This is what a skip link needs: hidden until it has the focus, and then a
|
|
8
|
+
* real control the reader can see themselves press. `focus-visible:` cannot
|
|
9
|
+
* express it, because the element has to *leave* the 1px box entirely.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
visible?: boolean;
|
|
13
|
+
/** Render as something else — a `<div>`, a `<label>`, an element of your own. */
|
|
14
|
+
render?: useRender.RenderProp;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Content that is in the accessibility tree and not on the screen.
|
|
18
|
+
*
|
|
19
|
+
* The library has needed this everywhere from the beginning and kept it to
|
|
20
|
+
* itself: the word "Remove" behind a Chip's ×, the count behind a Badge's dot,
|
|
21
|
+
* the page number under a Pagination chevron, the table a chart draws for a
|
|
22
|
+
* screen reader instead of a picture. This is the same 1px clipped box, offered
|
|
23
|
+
* so an application's own markup can say the same things.
|
|
24
|
+
*
|
|
25
|
+
* The form matters and there is only one that works. `hidden` and
|
|
26
|
+
* `display: none` take the text off the accessibility tree along with the
|
|
27
|
+
* screen, which is the opposite of the job. `opacity: 0` leaves a clickable
|
|
28
|
+
* ghost the size of the words, and a pointer finds it. `text-indent: -9999px`
|
|
29
|
+
* makes a box that wide and a horizontal scrollbar with it. A 1px box with its
|
|
30
|
+
* contents clipped is invisible to a sighted reader and present to every other
|
|
31
|
+
* kind, and it is what every serious implementation converged on.
|
|
32
|
+
*
|
|
33
|
+
* There is no `aria-hidden` here, deliberately: that is the *other* half of the
|
|
34
|
+
* pair — visible and not announced — and it is an attribute rather than a
|
|
35
|
+
* component because it belongs on the element that is already being drawn.
|
|
36
|
+
*/
|
|
37
|
+
export declare const VisuallyHidden: React.ForwardRefExoticComponent<VisuallyHiddenProps & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +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 t,srOnlyClasses as a}from"../../internal/styles.js";export const VisuallyHidden=/*@__PURE__*/e.forwardRef(function({visible:e=!1,render:i,className:o,...n},m){return s({render:i??r("span",{}),ref:m,props:{...n,className:t(e?void 0:a,o)}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{VisuallyHidden}from"./VisuallyHidden.js";
|
|
@@ -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 a,useMessages as s,windowMessages as l}from"../../internal/i18n.js";import{cx as d,hasContent as c,iconClasses as u,surfaceClasses as m}from"../../internal/styles.js";import{WindowControls as h,orderControls as f,windowChrome as w,windowMetrics as g,windowSlots as p}from"../../internal/window.js";function
|
|
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 a,useMessages as s,windowMessages as l}from"../../internal/i18n.js";import{cx as d,hasContent as c,iconClasses as u,surfaceClasses as m}from"../../internal/styles.js";import{WindowControls as h,orderControls as f,windowChrome as w,windowMetrics as g,windowSlots as p}from"../../internal/window.js";import{useStyleDefaults as b}from"../../internal/defaults.js";function v(e,t,n){const[o,r]=i.useState(t),a=void 0!==e;return[a?e:o,i.useCallback(e=>{a||r(e),n?.(e)},[a,n])]}const x=[{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(z,y){const{os:N="macos",title:M,icon:C,actions:E,controls:S=!0,size:k="md",color:L="primary",accent:j=!1,transparency:I=0,active:R,elevation:B=2,position:D="static",draggable:A=!1,resizable:T=!1,width:H,height:P,minWidth:W=180,minHeight:O,offset:X,defaultOffset:$,onOffsetChange:F,onResize:Y,open:_,defaultOpen:q=!0,onOpenChange:K,minimized:U,defaultMinimized:G=!1,onMinimizedChange:J,maximized:Q,defaultMaximized:V=!1,onMaximizedChange:Z,scroll:ee=!0,locale:te,minimizeLabel:ne,maximizeLabel:ie,restoreLabel:oe,closeLabel:re,resizeLabel:ae,render:se,className:le,style:de,children:ce,...ue}=b(z,["size","locale"]),me=s(l,te),he=s(a,te),fe=w(N),we=g(N,k),ge=i.useId(),[pe,be]=v(_,q,K),[ve,xe]=v(U,G,J),[ze,ye]=v(Q,V,Z),[Ne,Me]=v(X,$??{x:0,y:0},F),[Ce,Ee]=i.useState(null),[Se,ke]=i.useState(!0),Le=R??Se,[je,Ie]=i.useState(null),[Re,Be]=i.useState(null),[De,Ae]=i.useState(!1),[Te,He]=i.useState(!1),[Pe,We]=i.useState(pe);Pe!==pe&&(We(pe),He(!pe)),i.useEffect(()=>{if(!Te)return;const e=window.setTimeout(()=>He(!1),260);return()=>window.clearTimeout(e)},[Te]);const Oe=i.useRef(null),Xe=i.useCallback(e=>{Oe.current=e,"function"==typeof y?y(e):y&&(y.current=e)},[y]);i.useEffect(()=>{if(void 0!==R)return;const e=Oe.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)}},[R]);const $e=i.useRef(null);function Fe(e,t){if(0!==e.button)return;$e.current?.();const n=e.currentTarget,i=e.clientX,o=e.clientY;Ae(!0);const a=()=>{$e.current=null,Ae(!1)},s=r({target:n,pointerId:e.pointerId,onMove:e=>t(e.clientX-i,e.clientY-o),onEnd:a});$e.current=()=>{s(),a()}}i.useEffect(()=>()=>$e.current?.(),[]);const Ye={width:Math.max(0,W),height:Math.max(we.bar,O??we.bar)};function _e(e){Ee(e),Y?.(e)}const qe=f(N,!0===S?["minimize","maximize","close"]:!1===S?[]:S),Ke=qe.includes("maximize");i.useEffect(()=>{if(ve||null===Re)return;const e=window.setTimeout(()=>Be(null),400);return()=>window.clearTimeout(e)},[ve,Re]);const Ue={minimize:ne??me.minimize,maximize:ie??me.maximize,restore:oe??me.restore,close:re??he.close},Ge=e(h,{os:N,metrics:we,controls:qe,maximized:ze,active:Le,labels:Ue,onCommand:function(e){"close"===e?be(!1):"minimize"===e?function(e){const t=Oe.current,n=t?.firstElementChild;if(t&&n instanceof HTMLElement&&Ie(n.offsetHeight+(t.offsetHeight-t.clientHeight)),e&&void 0===(Ce?.height??P)&&t)return Be(t.getBoundingClientRect().height),void requestAnimationFrame(()=>xe(!0));xe(e)}(!ve):ye(!ze)}}),Je=c(M)?e("span",{id:ge,className:"min-w-0 truncate",children:M}):null,Qe=c(C)?e("span",{className:"flex shrink-0 items-center",children:C}):null,Ve=t("div",{className:d("relative flex shrink-0 items-center select-none",u,A&&!ze?"cursor-grab active:cursor-grabbing":""),style:{height:we.bar,textShadow:"var(--n-window-bar-shadow)",fontWeight:we.weight,paddingInlineStart:we.padX,paddingInlineEnd:we.padEnd,gap:Math.round(.7*we.title),fontSize:we.title,backgroundColor:"var(--n-window-bar)",backgroundImage:"var(--n-window-bar-image)",color:"var(--n-window-bar-fg)",borderBlockEnd:fe.rule?"1px solid var(--n-window-line)":void 0},onPointerDown:function(e){if(!A||ze)return;const t={...Ne};Fe(e,(e,n)=>Me({x:t.x+e,y:t.y+n}))},onDoubleClick:Ke?()=>ye(!ze):void 0,children:["start"===fe.controlsSide?Ge:null,"center"===fe.titleAlign?e("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 flex items-center justify-center",style:{paddingInline:we.controlsWidth(qe.length)+2*we.padX},children:t("span",{className:"flex min-w-0 items-center",style:{gap:Math.round(.5*we.title)},children:[Qe,Je]})}):t(n,{children:[Qe,Je]}),e("span",{className:"flex-1"}),c(E)?e("span",{className:"flex shrink-0 items-center",style:{gap:Math.round(.5*we.title)},onPointerDown:e=>e.stopPropagation(),children:E}):null,"end"===fe.controlsSide?Ge:null]}),Ze=ze?{left:0,top:0,width:"100%",height:"100%"}:{left:Ne.x,top:Ne.y,width:Ce?.width??H,height:ve?je??we.bar:Ce?.height??P??Re??void 0},et=o({render:se,ref:Xe,props:{role:"group","aria-labelledby":Je?ge:void 0,className:d("neba-window relative flex min-w-0 flex-col overflow-hidden",I>0?m:"",fe.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]",le),"data-gesture":De?"":void 0,inert:!pe||void 0,style:{opacity:pe?void 0:0,...p({os:N,color:L,accent:j,transparency:I,active:Le,elevation:B}),position:"static"===D?"relative":D,...Ze,borderRadius:ze?0:`${we.radius}px ${we.radius}px ${we.radiusBottom}px ${we.radiusBottom}px`,borderStyle:"solid",borderWidth:we.frame,borderColor:"var(--n-window-line)",backgroundColor:"var(--n-window-band)",boxShadow:"var(--n-window-shadow), var(--neba-plate-glass)",...de},children:t(n,{children:[Ve,e("div",{className:d("min-h-0 flex-1",ee?"overflow-auto":"overflow-hidden"),style:{backgroundColor:"var(--n-window-body)",marginInline:we.band.side,marginBottom:we.band.bottom,boxShadow:we.band.side>0?"inset 0 0 0 1px rgb(0 0 0 / 0.12)":void 0},inert:ve,children:ce}),!T||ze||ve?null:x.map(t=>{const n="se"===t.edge;return e("div",{role:n?"button":void 0,tabIndex:n?0:void 0,"aria-label":n?ae??me.resize:void 0,"aria-hidden":n?void 0:"true",className:d("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=Oe.current;if(!n||ze)return;const i=n.getBoundingClientRect(),o={width:i.width,height:i.height,x:Ne.x,y:Ne.y},r=e.includes("e"),a=e.includes("w"),s=e.includes("n"),l=e.includes("s");Fe(t,(e,t)=>{let{width:n,height:i}=o,{x:d,y:c}=o;r&&(n=Math.max(Ye.width,o.width+e)),l&&(i=Math.max(Ye.height,o.height+t)),a&&(n=Math.max(Ye.width,o.width-e),d=o.x+(o.width-n)),s&&(i=Math.max(Ye.height,o.height-t),c=o.y+(o.height-i)),_e({width:n,height:i}),(a||s)&&Me({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=Oe.current;if(!n)return;const i=n.getBoundingClientRect();_e({width:Math.max(Ye.width,i.width+e),height:Math.max(Ye.height,i.height+t)})}(t[0],t[1]))}:void 0},t.edge)})]}),...ue}});return pe||Te?et:null});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { useDisclosure } from './useDisclosure.js';
|
|
2
|
+
export type { Disclosure } from './useDisclosure.js';
|
|
3
|
+
export { useElementSize } from './useElementSize.js';
|
|
4
|
+
export type { ElementSize } from './useElementSize.js';
|
|
5
|
+
export { useBreakpoint, useMediaQuery } from './useMediaQuery.js';
|
|
6
|
+
export { useOnScreen } from './useOnScreen.js';
|
|
7
|
+
export type { OnScreenOptions } from './useOnScreen.js';
|
|
8
|
+
export { useShortcut } from './useShortcut.js';
|
|
9
|
+
export type { ShortcutOptions } from './useShortcut.js';
|
|
10
|
+
export { usePrefersReducedMotion } from '../internal/media.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{useDisclosure}from"./useDisclosure.js";export{useElementSize}from"./useElementSize.js";export{useBreakpoint,useMediaQuery}from"./useMediaQuery.js";export{useOnScreen}from"./useOnScreen.js";export{useShortcut}from"./useShortcut.js";export{usePrefersReducedMotion}from"../internal/media.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** What `useDisclosure` hands back: the state, and the three ways to change it. */
|
|
2
|
+
export interface Disclosure {
|
|
3
|
+
open: boolean;
|
|
4
|
+
setOpen: (open: boolean) => void;
|
|
5
|
+
onOpen: () => void;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
onToggle: () => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The caller's half of the `open` / `onOpenChange` pair every overlay in the
|
|
11
|
+
* library offers.
|
|
12
|
+
*
|
|
13
|
+
* A Dialog, a Drawer, a Popover, a Tour, a Menu, a CommandPalette and all four
|
|
14
|
+
* pickers take the same three props, so the state beside them is the same six
|
|
15
|
+
* lines every time — and the sixth is the one that gets written wrong: a
|
|
16
|
+
* `setOpen(!open)` closed over a stale render rather than an updater.
|
|
17
|
+
*
|
|
18
|
+
* Every function it returns is stable for the life of the component, so passing
|
|
19
|
+
* `onClose` straight to a memoised child does not re-render it on every open.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useDisclosure(defaultOpen?: boolean): Disclosure;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import*as e from"react";export function useDisclosure(o=!1){const[s,n]=e.useState(o),l=e.useCallback(()=>n(!0),[]),t=e.useCallback(()=>n(!1),[]),u=e.useCallback(()=>n(e=>!e),[]);return e.useMemo(()=>({open:s,setOpen:n,onOpen:l,onClose:t,onToggle:u}),[s,l,t,u])}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/** A box, in CSS pixels. `0` × `0` before the first measurement and on a server. */
|
|
3
|
+
export interface ElementSize {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* One element's size, kept up to date.
|
|
9
|
+
*
|
|
10
|
+
* The same shared `ResizeObserver` eleven components in the library measure
|
|
11
|
+
* themselves with — one observer for the whole page rather than one per
|
|
12
|
+
* subscriber, because a dashboard of eight charts inside a PageLayout with a
|
|
13
|
+
* Panes in it was a dozen registrations the browser walked on every layout.
|
|
14
|
+
*
|
|
15
|
+
* The ref goes on the element to watch. It measures once as soon as that
|
|
16
|
+
* element is there rather than waiting to be told, because a `ResizeObserver`
|
|
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.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useElementSize<E extends Element = HTMLElement>(): [
|
|
21
|
+
React.RefObject<E | null>,
|
|
22
|
+
ElementSize
|
|
23
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import*as t from"react";import{observeResize as e}from"../internal/observe.js";export function useElementSize(){const i=t.useRef(null),[n,r]=t.useState({width:0,height:0});return t.useLayoutEffect(()=>{const t=i.current;if(!t)return;const n=()=>{const e=t.getBoundingClientRect();r(t=>t.width===e.width&&t.height===e.height?t:{width:e.width,height:e.height})};return n(),e(t,n)},[]),[i,n]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { NebaBreakpoint } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* One media query, as a boolean this component re-renders on.
|
|
4
|
+
*
|
|
5
|
+
* The same store the library's own layout runs on, which is the reason it is
|
|
6
|
+
* offered rather than left to be written again: a `MediaQueryList` is live, so
|
|
7
|
+
* there is exactly one per query string for the whole page no matter how many
|
|
8
|
+
* components ask. Written the obvious way — `window.matchMedia` inside a
|
|
9
|
+
* `getSnapshot` — every subscriber builds a fresh one on every render *and*
|
|
10
|
+
* every commit, and a PageLayout with a Header, a Footer and two Sidebars in it
|
|
11
|
+
* asks the same question five times per render.
|
|
12
|
+
*
|
|
13
|
+
* It answers `false` on a server, where there is no window and no honest answer.
|
|
14
|
+
* A layout that must not flash is a layout stated in CSS; this is for the
|
|
15
|
+
* decisions CSS cannot make — which component to render at all.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useMediaQuery(query: string): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The same question in the units the rest of the library uses: is the window at
|
|
20
|
+
* least this wide?
|
|
21
|
+
*
|
|
22
|
+
* `useBreakpoint('md')` is `md:` in a class name, in JavaScript — the widths are
|
|
23
|
+
* one table, so a component that branches here and a utility that branches in
|
|
24
|
+
* CSS change at the same pixel. `xs` is `0rem` and therefore always true, which
|
|
25
|
+
* is the value with no media query around it.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useBreakpoint(breakpoint: NebaBreakpoint): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useMediaQuery as e,widthAtLeast as r}from"../internal/media.js";export function useMediaQuery(r){return e(r)}export function useBreakpoint(n){return e(r(n))}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface OnScreenOptions {
|
|
3
|
+
/** How much of the element has to be showing. @default 0 */
|
|
4
|
+
threshold?: number;
|
|
5
|
+
/**
|
|
6
|
+
* Stop watching once it has been seen. The right default for the thing this
|
|
7
|
+
* is usually for — mounting something, starting something, loading
|
|
8
|
+
* something — where the answer only has to arrive once.
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
|
+
once?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Whether an element is on screen.
|
|
15
|
+
*
|
|
16
|
+
* The same shared `IntersectionObserver` the eleven `Animate*` wrappers watch
|
|
17
|
+
* for their own element with — one per threshold for the whole page, because a
|
|
18
|
+
* page of them was one registration each.
|
|
19
|
+
*
|
|
20
|
+
* It answers `true` where there is no `IntersectionObserver` rather than
|
|
21
|
+
* `false`, and that is the load-bearing part: a caller cannot know without one,
|
|
22
|
+
* and the right fallback is to show the thing rather than to hide it forever.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useOnScreen<E extends Element = HTMLElement>(options?: OnScreenOptions): [React.RefObject<E | null>, boolean];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import*as e from"react";import{observeVisibility as r}from"../internal/observe.js";export function useOnScreen(t={}){const{threshold:n=0,once:o=!0}=t,s=e.useRef(null),[u,c]=e.useState(!1);return e.useEffect(()=>{const e=s.current;if(!e)return;const t=r(e,n,e=>{c(e),e&&o&&t?.()});if(t)return t;c(!0)},[n,o]),[s,u]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface ShortcutOptions {
|
|
2
|
+
/** Stop listening without unmounting — a modal is open, a field has focus. @default true */
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Ignore the key while the reader is typing into an input, a textarea or
|
|
6
|
+
* anything `contenteditable`.
|
|
7
|
+
*
|
|
8
|
+
* On by default, and it is the reason a bare `/` or `?` can be bound at all:
|
|
9
|
+
* a page-wide single-letter shortcut that fires inside a search box is a
|
|
10
|
+
* shortcut that eats what somebody was writing. A combination with a modifier
|
|
11
|
+
* is usually meant to work everywhere, so turn this off for those.
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
ignoreWhileTyping?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Call `preventDefault` when it matches — for a key the browser also has an
|
|
17
|
+
* opinion about, like `Mod+K` or `Mod+S`. @default true
|
|
18
|
+
*/
|
|
19
|
+
preventDefault?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A key combination bound on the window, spelled the way
|
|
23
|
+
* [Shortcut](../components/shortcut) draws it — `'Mod+K'`, `'Mod+Shift+P'`,
|
|
24
|
+
* `'?'`.
|
|
25
|
+
*
|
|
26
|
+
* This is what `CommandPalette` binds its own opener with, offered because an
|
|
27
|
+
* application has more shortcuts than the library does and every one of them
|
|
28
|
+
* should be spelled the way its key cap is. `Mod` is Command on a Mac and
|
|
29
|
+
* Control everywhere else; the modifiers are matched exactly.
|
|
30
|
+
*
|
|
31
|
+
* The handler is held in a ref, so a listener is bound once per combination
|
|
32
|
+
* rather than re-bound on every render that closes over new state.
|
|
33
|
+
*/
|
|
34
|
+
export declare function useShortcut(shortcut: string | false, handler: (event: KeyboardEvent) => void, options?: ShortcutOptions): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import*as e from"react";import{matchesShortcut as t}from"../internal/keys.js";export function useShortcut(n,r,a={}){const{enabled:o=!0,ignoreWhileTyping:i=!0,preventDefault:s=!0}=a,u=e.useRef(r);e.useEffect(()=>{u.current=r}),e.useEffect(()=>{if(!1===n||!o)return;const e=e=>{var r;i&&(r=e.target,r instanceof HTMLElement&&(r.isContentEditable||"INPUT"===r.tagName||"TEXTAREA"===r.tagName||"SELECT"===r.tagName))||t(e,n)&&(s&&e.preventDefault(),u.current(e))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n,o,i,s])}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
|
+
export * from './hooks/index.js';
|
|
2
3
|
export * from './components/accordion/index.js';
|
|
3
4
|
export * from './components/alert/index.js';
|
|
4
5
|
export * from './components/anchor/index.js';
|
|
@@ -26,6 +27,7 @@ export * from './components/box/index.js';
|
|
|
26
27
|
export * from './components/breadcrumb/index.js';
|
|
27
28
|
export * from './components/button/index.js';
|
|
28
29
|
export * from './components/button-group/index.js';
|
|
30
|
+
export * from './components/calendar/index.js';
|
|
29
31
|
export * from './components/card/index.js';
|
|
30
32
|
export * from './components/carousel/index.js';
|
|
31
33
|
export * from './components/chat-bubble/index.js';
|
|
@@ -36,6 +38,7 @@ export * from './components/collapsible/index.js';
|
|
|
36
38
|
export * from './components/color-picker/index.js';
|
|
37
39
|
export * from './components/combobox/index.js';
|
|
38
40
|
export * from './components/command-palette/index.js';
|
|
41
|
+
export * from './components/confirm/index.js';
|
|
39
42
|
export * from './components/container/index.js';
|
|
40
43
|
export * from './components/data-list/index.js';
|
|
41
44
|
export * from './components/data-table/index.js';
|
|
@@ -62,6 +65,7 @@ export * from './components/hover-card/index.js';
|
|
|
62
65
|
export * from './components/how-to-steps/index.js';
|
|
63
66
|
export * from './components/icon/index.js';
|
|
64
67
|
export * from './components/icon-button/index.js';
|
|
68
|
+
export * from './components/image/index.js';
|
|
65
69
|
export * from './components/line-chart/index.js';
|
|
66
70
|
export * from './components/list/index.js';
|
|
67
71
|
export * from './components/menu/index.js';
|
|
@@ -77,10 +81,13 @@ export * from './components/pagination/index.js';
|
|
|
77
81
|
export * from './components/panes/index.js';
|
|
78
82
|
export * from './components/pie-chart/index.js';
|
|
79
83
|
export * from './components/pill/index.js';
|
|
84
|
+
export * from './components/popconfirm/index.js';
|
|
80
85
|
export * from './components/popover/index.js';
|
|
86
|
+
export * from './components/portal/index.js';
|
|
81
87
|
export * from './components/progress-box/index.js';
|
|
82
88
|
export * from './components/progress-circular/index.js';
|
|
83
89
|
export * from './components/progress-linear/index.js';
|
|
90
|
+
export * from './components/provider/index.js';
|
|
84
91
|
export * from './components/radio-group/index.js';
|
|
85
92
|
export * from './components/rating/index.js';
|
|
86
93
|
export * from './components/scatter-chart/index.js';
|
|
@@ -110,6 +117,8 @@ export * from './components/toolbar/index.js';
|
|
|
110
117
|
export * from './components/tooltip/index.js';
|
|
111
118
|
export * from './components/tour/index.js';
|
|
112
119
|
export * from './components/transfer/index.js';
|
|
120
|
+
export * from './components/tree-select/index.js';
|
|
113
121
|
export * from './components/tree-view/index.js';
|
|
114
122
|
export * from './components/typography/index.js';
|
|
123
|
+
export * from './components/visually-hidden/index.js';
|
|
115
124
|
export * from './components/window-pane/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/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-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/avatar-group/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/command-palette/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/form/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/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/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-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/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/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-view/index.js";export*from"./components/typography/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/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-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/avatar-group/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/form/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/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/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,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type TimeUnit } from './date.js';
|
|
3
|
-
import type { NebaColor, NebaDensity, NebaSize, NebaWeekday } from '../types.js';
|
|
3
|
+
import type { NebaColor, NebaDateGranularity, NebaDensity, NebaSize, NebaWeekday } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* The calendar grid and the clock columns, written once for the four pickers.
|
|
6
6
|
*
|
|
@@ -20,9 +20,9 @@ import type { NebaColor, NebaDensity, NebaSize, NebaWeekday } from '../types.js'
|
|
|
20
20
|
/**
|
|
21
21
|
* Every string a picker says that is not a date.
|
|
22
22
|
*
|
|
23
|
-
* One object rather than
|
|
23
|
+
* One object rather than twenty props. These are a set: a caller who has to
|
|
24
24
|
* translate "Previous month" has to translate "Next month" in the same breath,
|
|
25
|
-
* and a component with
|
|
25
|
+
* and a component with twenty `*Label` props is a component whose signature is
|
|
26
26
|
* mostly apology. The dates themselves are never in here — those come from
|
|
27
27
|
* `Intl`, which already knows what July is called in more languages than this
|
|
28
28
|
* file ever will.
|
|
@@ -40,8 +40,14 @@ export interface PickerLabels {
|
|
|
40
40
|
/** The two header buttons that open the month grid and the year grid. */
|
|
41
41
|
chooseMonth: string;
|
|
42
42
|
chooseYear: string;
|
|
43
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* The footer's actions. Three shortcuts rather than one because the button
|
|
45
|
+
* jumps to the current *unit*, and a month picker whose footer says "Today"
|
|
46
|
+
* is offering a day it has no way to accept.
|
|
47
|
+
*/
|
|
44
48
|
today: string;
|
|
49
|
+
thisMonth: string;
|
|
50
|
+
thisYear: string;
|
|
45
51
|
now: string;
|
|
46
52
|
clear: string;
|
|
47
53
|
done: string;
|
|
@@ -71,6 +77,12 @@ export interface CalendarProps {
|
|
|
71
77
|
rangeStart?: Date | null;
|
|
72
78
|
rangeEnd?: Date | null;
|
|
73
79
|
onSelect: (date: Date) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Which grid the reader is allowed to stop on, and therefore what `onSelect`
|
|
82
|
+
* hands back: a day, the 1st of a month, or the 1st of January.
|
|
83
|
+
* @default 'day'
|
|
84
|
+
*/
|
|
85
|
+
granularity?: NebaDateGranularity;
|
|
74
86
|
/** The day under the pointer, for a range that is only half chosen. */
|
|
75
87
|
onPreviewChange?: (date: Date | null) => void;
|
|
76
88
|
minDate?: Date | null;
|
|
@@ -88,6 +100,14 @@ export interface CalendarProps {
|
|
|
88
100
|
* @default true
|
|
89
101
|
*/
|
|
90
102
|
showOutsideDays?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* What a day cell draws under its number — a dot, a count, a bar.
|
|
105
|
+
*
|
|
106
|
+
* A hook rather than a slot: the caller is the only one who knows what a day
|
|
107
|
+
* *has* on it, and the alternative is an `events` prop that would make this
|
|
108
|
+
* file responsible for a data shape it has no opinion about.
|
|
109
|
+
*/
|
|
110
|
+
renderDay?: (date: Date) => React.ReactNode;
|
|
91
111
|
/** Takes the focus on mount — the popup has just opened. */
|
|
92
112
|
autoFocus?: boolean;
|
|
93
113
|
showPreviousButton?: boolean;
|
|
@@ -104,13 +124,19 @@ export interface CalendarProps {
|
|
|
104
124
|
* two stretch four rows and three rows across that same height — so switching
|
|
105
125
|
* view never resizes the popup under the pointer that opened it.
|
|
106
126
|
*
|
|
127
|
+
* `granularity` says which of the three the reader may stop on. At `day` the
|
|
128
|
+
* other two are only a way of reaching it; at `month` or `year` the grid that
|
|
129
|
+
* names that unit is where the calendar opens and where a click becomes an
|
|
130
|
+
* answer. Climbing is unaffected — a month picker still reaches 2019 through
|
|
131
|
+
* the year grid — so the coarser settings take a view away and add none.
|
|
132
|
+
*
|
|
107
133
|
* Arrow keys move by one cell, `PageUp`/`PageDown` by a month (a year with
|
|
108
134
|
* Shift), `Home`/`End` to the ends of the week, and running off an edge steps
|
|
109
135
|
* the calendar rather than stopping. One roving tab stop, so `Tab` leaves the
|
|
110
136
|
* grid instead of walking forty-two cells — the pattern the ARIA date-picker
|
|
111
137
|
* practice describes, and the reason none of the cells is a `disabled` button.
|
|
112
138
|
*/
|
|
113
|
-
export declare function Calendar({ size, color, locale, weekStartsOn, month, onMonthChange, selected, rangeStart, rangeEnd, onSelect, onPreviewChange, minDate, maxDate, shouldDisableDate, showOutsideDays, autoFocus, showPreviousButton, showNextButton, labels, className }: CalendarProps): React.JSX.Element;
|
|
139
|
+
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;
|
|
114
140
|
export type { TimeUnit };
|
|
115
141
|
export interface TimeGridProps {
|
|
116
142
|
size: NebaSize;
|