neba 1.10.0 → 1.12.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 +36 -6
- 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-appear/AnimateAppear.d.ts +2 -13
- package/dist/components/animate-appear/AnimateAppear.js +1 -1
- package/dist/components/animate-blink/AnimateBlink.d.ts +2 -2
- package/dist/components/animate-blink/AnimateBlink.js +1 -1
- package/dist/components/animate-counter/AnimateCounter.d.ts +45 -0
- package/dist/components/animate-counter/AnimateCounter.js +1 -0
- package/dist/components/animate-counter/index.d.ts +1 -0
- package/dist/components/animate-counter/index.js +1 -0
- package/dist/components/animate-fade/AnimateFade.d.ts +2 -2
- package/dist/components/animate-fade/AnimateFade.js +1 -1
- package/dist/components/animate-float/AnimateFloat.d.ts +35 -0
- package/dist/components/animate-float/AnimateFloat.js +1 -0
- package/dist/components/animate-float/index.d.ts +1 -0
- package/dist/components/animate-float/index.js +1 -0
- package/dist/components/animate-grow/AnimateGrow.d.ts +2 -2
- package/dist/components/animate-grow/AnimateGrow.js +1 -1
- package/dist/components/animate-lighting/AnimateLighting.js +1 -1
- package/dist/components/animate-reveal/AnimateReveal.d.ts +41 -0
- package/dist/components/animate-reveal/AnimateReveal.js +1 -0
- package/dist/components/animate-reveal/index.d.ts +1 -0
- package/dist/components/animate-reveal/index.js +1 -0
- package/dist/components/animate-rotate/AnimateRotate.d.ts +2 -2
- package/dist/components/animate-rotate/AnimateRotate.js +1 -1
- package/dist/components/animate-scramble/AnimateScramble.d.ts +48 -0
- package/dist/components/animate-scramble/AnimateScramble.js +1 -0
- package/dist/components/animate-scramble/index.d.ts +1 -0
- package/dist/components/animate-scramble/index.js +1 -0
- package/dist/components/animate-shake/AnimateShake.d.ts +39 -0
- package/dist/components/animate-shake/AnimateShake.js +1 -0
- package/dist/components/animate-shake/index.d.ts +1 -0
- package/dist/components/animate-shake/index.js +1 -0
- package/dist/components/animate-slide/AnimateSlide.d.ts +2 -2
- package/dist/components/animate-slide/AnimateSlide.js +1 -1
- package/dist/components/animate-split/AnimateSplit.d.ts +61 -0
- package/dist/components/animate-split/AnimateSplit.js +1 -0
- package/dist/components/animate-split/index.d.ts +1 -0
- package/dist/components/animate-split/index.js +1 -0
- package/dist/components/animate-typing/AnimateTyping.js +1 -1
- package/dist/components/animate-zoom/AnimateZoom.d.ts +2 -2
- package/dist/components/animate-zoom/AnimateZoom.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/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.d.ts +12 -4
- 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/flex/Flex.d.ts +93 -0
- package/dist/components/flex/Flex.js +1 -0
- package/dist/components/flex/index.d.ts +2 -0
- package/dist/components/flex/index.js +1 -0
- 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 +4 -3
- package/dist/components/footer/Footer.js +1 -1
- package/dist/components/gallery/Gallery.d.ts +150 -0
- package/dist/components/gallery/Gallery.js +1 -0
- package/dist/components/gallery/GalleryViewer.d.ts +30 -0
- package/dist/components/gallery/GalleryViewer.js +1 -0
- package/dist/components/gallery/index.d.ts +2 -0
- package/dist/components/gallery/index.js +1 -0
- package/dist/components/gauge-chart/GaugeChart.d.ts +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.d.ts +5 -4
- 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 +190 -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/menu/Menu.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/navigation-menu/NavigationMenu.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/radio-group/RadioGroup.js +1 -1
- 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.d.ts +9 -4
- 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/show/Show.d.ts +60 -0
- package/dist/components/show/Show.js +1 -0
- package/dist/components/show/index.d.ts +2 -0
- package/dist/components/show/index.js +1 -0
- 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/stack/Stack.d.ts +126 -0
- package/dist/components/stack/Stack.js +1 -0
- package/dist/components/stack/index.d.ts +1 -0
- package/dist/components/stack/index.js +1 -0
- package/dist/components/statistic/Statistic.d.ts +8 -3
- 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/tabs/Tabs.d.ts +28 -0
- package/dist/components/tabs/Tabs.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 +61 -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 +19 -1
- package/dist/index.js +1 -1
- package/dist/internal/animate.d.ts +65 -2
- package/dist/internal/animate.js +1 -1
- package/dist/internal/calendar.d.ts +31 -5
- package/dist/internal/calendar.js +1 -1
- package/dist/internal/chart-frame.d.ts +32 -0
- package/dist/internal/chart-frame.js +1 -1
- package/dist/internal/chart-line.js +1 -1
- package/dist/internal/chart.d.ts +16 -0
- package/dist/internal/chart.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/grid.d.ts +13 -27
- package/dist/internal/grid.js +1 -1
- package/dist/internal/i18n.d.ts +43 -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 +34 -0
- package/dist/internal/media.js +1 -1
- package/dist/internal/page-layout.d.ts +18 -9
- 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/internal/responsive.d.ts +97 -0
- package/dist/internal/responsive.js +1 -0
- package/dist/internal/styles.d.ts +68 -0
- package/dist/internal/styles.js +1 -1
- package/dist/internal/text.d.ts +42 -0
- package/dist/internal/text.js +1 -0
- 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 +280 -24
- package/dist/types.d.ts +153 -6
- package/package.json +23 -17
- package/dist/components/avatar-group/AvatarGroup.d.ts +0 -47
- package/dist/components/avatar-group/AvatarGroup.js +0 -1
- package/dist/components/avatar-group/index.d.ts +0 -2
- package/dist/components/avatar-group/index.js +0 -1
- package/dist/internal/avatar-group.d.ts +0 -22
- package/dist/internal/avatar-group.js +0 -1
package/dist/internal/i18n.d.ts
CHANGED
|
@@ -78,6 +78,25 @@ export interface ActionMessages {
|
|
|
78
78
|
}
|
|
79
79
|
/** The `action` namespace, as Alert, Chip, Combobox, Dialog, Drawer, Popover and Toast read it. */
|
|
80
80
|
export declare const actionMessages: MessageTable<ActionMessages>;
|
|
81
|
+
/** ConfirmProvider. */
|
|
82
|
+
export interface ConfirmMessages {
|
|
83
|
+
/** The button that answers yes. */
|
|
84
|
+
confirm: string;
|
|
85
|
+
/**
|
|
86
|
+
* And the one that answers no — which is also what Escape and a click on the
|
|
87
|
+
* backdrop mean, so it is the label on the way out rather than a third option.
|
|
88
|
+
*/
|
|
89
|
+
cancel: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The `confirm` namespace.
|
|
93
|
+
*
|
|
94
|
+
* Its own rather than two more keys on `action`, which holds the words on four
|
|
95
|
+
* different × buttons. A confirm's two buttons are a question being answered,
|
|
96
|
+
* not a thing being dismissed, and a namespace a Chip pulls in for the word
|
|
97
|
+
* "Remove" should not also carry them.
|
|
98
|
+
*/
|
|
99
|
+
export declare const confirmMessages: MessageTable<ConfirmMessages>;
|
|
81
100
|
/** TextLink. */
|
|
82
101
|
export interface LinkMessages {
|
|
83
102
|
/**
|
|
@@ -160,6 +179,8 @@ export interface TableMessages {
|
|
|
160
179
|
* same nothing to report and no chrome of its own to say it with.
|
|
161
180
|
*/
|
|
162
181
|
empty: string;
|
|
182
|
+
/** The button that writes what is on screen out as a file. */
|
|
183
|
+
exportCsv: string;
|
|
163
184
|
}
|
|
164
185
|
/** The `table` namespace, as Table and DataTable read it. */
|
|
165
186
|
export declare const tableMessages: MessageTable<TableMessages>;
|
|
@@ -267,6 +288,24 @@ export interface CarouselMessages {
|
|
|
267
288
|
}
|
|
268
289
|
/** The `carousel` namespace, as Carousel read it. */
|
|
269
290
|
export declare const carouselMessages: MessageTable<CarouselMessages>;
|
|
291
|
+
/**
|
|
292
|
+
* The gallery, and the viewer a tile opens into.
|
|
293
|
+
*
|
|
294
|
+
* A Carousel's words are next to these and are deliberately not reused: a
|
|
295
|
+
* carousel moves between *slides* and this moves between pictures, and a
|
|
296
|
+
* screen reader saying "next slide" over a wall of photographs is describing
|
|
297
|
+
* something the reader is not looking at.
|
|
298
|
+
*/
|
|
299
|
+
export interface GalleryMessages {
|
|
300
|
+
/** Names the list, when the caller did not. */
|
|
301
|
+
label: string;
|
|
302
|
+
/** One tile's position. `{index}` and `{total}` are replaced with the numbers. */
|
|
303
|
+
item: string;
|
|
304
|
+
previous: string;
|
|
305
|
+
next: string;
|
|
306
|
+
}
|
|
307
|
+
/** The `gallery` namespace, as Gallery and its viewer read it. */
|
|
308
|
+
export declare const galleryMessages: MessageTable<GalleryMessages>;
|
|
270
309
|
/**
|
|
271
310
|
* The charts.
|
|
272
311
|
*
|
|
@@ -522,6 +561,8 @@ export interface NebaLocale {
|
|
|
522
561
|
pagination?: Partial<PaginationMessages>;
|
|
523
562
|
/** Carousel. */
|
|
524
563
|
carousel?: Partial<CarouselMessages>;
|
|
564
|
+
/** Gallery. */
|
|
565
|
+
gallery?: Partial<GalleryMessages>;
|
|
525
566
|
/** Chart. */
|
|
526
567
|
chart?: Partial<ChartMessages>;
|
|
527
568
|
/** Scroll. */
|
|
@@ -546,6 +587,8 @@ export interface NebaLocale {
|
|
|
546
587
|
code?: Partial<CodeMessages>;
|
|
547
588
|
/** Steps. */
|
|
548
589
|
steps?: Partial<StepsMessages>;
|
|
590
|
+
/** Confirm. */
|
|
591
|
+
confirm?: Partial<ConfirmMessages>;
|
|
549
592
|
}
|
|
550
593
|
/**
|
|
551
594
|
* Teaches the library a language.
|
package/dist/internal/i18n.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";export function fill(e,s){return e.replace(/\{(\w+)\}/g,(e,
|
|
1
|
+
import*as e from"react";export function fill(e,s){return e.replace(/\{(\w+)\}/g,(e,o)=>s[o]??e)}export const actionMessages={"":{close:"Close",dismiss:"Dismiss",clear:"Clear",remove:"Remove"}};export const confirmMessages={"":{confirm:"Confirm",cancel:"Cancel"}};export const linkMessages={"":{newTab:"(opens in a new tab)"}};export const spoilerMessages={"":{reveal:"Reveal",hide:"Hide",notice:"This may contain spoilers"}};export const chatMessages={"":{sending:"Sending",sent:"Sent",delivered:"Delivered",read:"Read",failed:"Not sent",typing:"Typing…"}};export const emptyMessages={"":{title:"Nothing here"}};export const tableMessages={"":{search:"Search",selectAll:"Select all rows",selectRow:"Select row",rowsPerPage:"Rows per page",range:"{start}–{end} of {total}",selected:"{count} selected",empty:"No data",exportCsv:"Export CSV"}};export const colorMessages={"":{area:"Saturation and brightness",hue:"Hue",alpha:"Opacity",value:"Colour value",swatches:"Preset colours",clear:"Clear",empty:"Choose a colour"}};export const ratingMessages={"":{label:"Rating",value:"{value} out of {max}",empty:"No rating"}};export const numberMessages={"":{increase:"Increase",decrease:"Decrease"}};export const paginationMessages={"":{label:"Pagination",page:"Page {page}",status:"Page {page} of {total}",previous:"Previous page",next:"Next page",first:"First page",last:"Last page"}};export const carouselMessages={"":{label:"Carousel",slide:"Slide {index} of {total}",previous:"Previous slide",next:"Next slide"}};export const galleryMessages={"":{label:"Gallery",item:"Image {index} of {total}",previous:"Previous image",next:"Next image"}};export const chartMessages={"":{label:"Chart"}};export const scrollMessages={"":{label:"Scrollable content",previous:"Scroll back",next:"Scroll forward"}};export const breadcrumbMessages={"":{label:"Breadcrumb",expand:"Show hidden steps"}};export const commandMessages={"":{label:"Command palette",search:"Type a command or search…",empty:"No commands found"}};export const transferMessages={"":{source:"Available",target:"Selected",toTarget:"Move to selected",toSource:"Move to available",search:"Search",selectAll:"Select all",empty:"Nothing here"}};export const anchorMessages={"":{label:"On this page"}};export const comboboxMessages={"":{empty:"No matches",remove:"Remove {label}"}};export const overlayMessages={"":{label:"Overlay"}};export const windowMessages={"":{minimize:"Minimize",maximize:"Maximize",restore:"Restore",resize:"Resize window"}};export const layoutMessages={"":{skipToContent:"Skip to content",sidebar:"Sidebar",openSidebar:"Open sidebar",closeSidebar:"Close sidebar",resizeSidebar:"Resize sidebar"}};export const codeMessages={"":{code:"Code",copy:"Copy",copied:"Copied",copyFailed:"Could not copy",raw:"Raw",prompt:"Prompt"}};export const stepsMessages={"":{previous:"Previous",next:"Next",done:"Done",skip:"Skip",restart:"Start over",completed:"All steps complete",steps:"Steps",position:"{index} of {total}",step:"Step {index}: {title}"}};const s={zh:"zh-hans","zh-cn":"zh-hans","zh-my":"zh-hans","zh-sg":"zh-hans","zh-hk":"zh-hant","zh-mo":"zh-hant","zh-tw":"zh-hant"};const o=new WeakMap;export function resolveMessages(e,t){const a=e[""],r=t?.trim()??"";if(!r)return a;let n=o.get(e);n||(n=new Map,o.set(e,n));const l=n.get(r);if(l)return l;const c=function(e){const s=e.toLowerCase().split(/[-_]/).filter(Boolean),o=s[0];if(!o)return[];const t=s.slice(1),a=t.find(e=>/^[a-z]{4}$/.test(e)),r=t.find(e=>/^([a-z]{2}|\d{3})$/.test(e));return[a?`${o}-${a}`:"",r?`${o}-${r}`:"",o].filter(Boolean)}(r).map(o=>{const t=s[o];return e[o]??(t?e[t]:void 0)}).find(Boolean),i=c?{...a,...c}:a;return n.set(r,i),i}export function useMessages(s,o){return e.useMemo(()=>resolveMessages(s,o),[s,o])}export function fillMessage(e,s){return e.replace(/\{(\w+)\}/g,(e,o)=>s[o]??e)}const t={action:actionMessages,confirm:confirmMessages,link:linkMessages,spoiler:spoilerMessages,chat:chatMessages,empty:emptyMessages,table:tableMessages,color:colorMessages,rating:ratingMessages,number:numberMessages,pagination:paginationMessages,carousel:carouselMessages,gallery:galleryMessages,chart:chartMessages,scroll:scrollMessages,breadcrumb:breadcrumbMessages,anchor:anchorMessages,transfer:transferMessages,command:commandMessages,combobox:comboboxMessages,overlay:overlayMessages,window:windowMessages,layout:layoutMessages,code:codeMessages,steps:stepsMessages};export function registerMessages(e,s){const a=e.trim().toLowerCase();for(const[e,r]of Object.entries(s)){const s=t[e];s&&r&&(s[a]=r,o.delete(s))}}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A key combination, read rather than drawn.
|
|
3
|
+
*
|
|
4
|
+
* This is in `internal/` for `button-group.ts`'s reason with a sharper edge on
|
|
5
|
+
* it. `Shortcut` *draws* `Mod+K` and `CommandPalette` *binds* it, and the two
|
|
6
|
+
* were written separately — so the drawing side understood `Cmd`, `Command`,
|
|
7
|
+
* `Meta` and `Esc` and the binding side did not. `<Shortcut keys="Cmd+K" />`
|
|
8
|
+
* put a correct key cap on the screen over a shortcut that could never fire,
|
|
9
|
+
* which is the worst shape this bug can take: the label is the only evidence a
|
|
10
|
+
* reader has that the key exists at all.
|
|
11
|
+
*
|
|
12
|
+
* So the split is by job rather than by component. Everything that decides
|
|
13
|
+
* *which key a token means* is here and both sides read it. What a key *looks
|
|
14
|
+
* like* — `⌘`, `⇧`, the arrow glyphs — stays in `Shortcut`, because a TextField
|
|
15
|
+
* that binds `Mod+Enter` has no business carrying a table of Mac glyphs.
|
|
16
|
+
*
|
|
17
|
+
* Nothing here allocates at import time beyond two small object literals, and
|
|
18
|
+
* the platform is worked out once for the page.
|
|
19
|
+
*/
|
|
20
|
+
import type * as React from 'react';
|
|
21
|
+
import type { NebaShortcuts } from '../types.js';
|
|
22
|
+
/** The three platforms a combination can be named for, once `auto` is resolved. */
|
|
23
|
+
export type ResolvedOS = 'mac' | 'windows' | 'linux';
|
|
24
|
+
/**
|
|
25
|
+
* Splits the string form. Empty segments are what `'Ctrl++'` leaves behind, and
|
|
26
|
+
* dropping them is why the array form exists for that case.
|
|
27
|
+
*/
|
|
28
|
+
export declare function tokenize(keys: string | string[]): string[];
|
|
29
|
+
/**
|
|
30
|
+
* One token reduced to the name this file knows it by.
|
|
31
|
+
*
|
|
32
|
+
* It also folds a real `KeyboardEvent.key`, which is what lets the two sides of
|
|
33
|
+
* a comparison meet in the middle: a caller writes `Esc` and the browser
|
|
34
|
+
* reports `Escape`, and both arrive here as `escape`. The space bar is the one
|
|
35
|
+
* key whose `key` is punctuation, so it is named before the punctuation is
|
|
36
|
+
* stripped.
|
|
37
|
+
*/
|
|
38
|
+
export declare function canonicalKey(token: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* What the browser says it is running on.
|
|
41
|
+
*
|
|
42
|
+
* `userAgentData.platform` is the modern spelling and `navigator.platform` the
|
|
43
|
+
* deprecated one every browser still answers; the user agent string is the last
|
|
44
|
+
* resort, and *last resort* is the load-bearing word. The three are asked in
|
|
45
|
+
* order and the first that says anything at all is the answer — never all three
|
|
46
|
+
* matched at once, which is what this used to do.
|
|
47
|
+
*
|
|
48
|
+
* A union of the three can only ever be wrong in one direction: towards `mac`.
|
|
49
|
+
* A WebKit build on Linux or Windows reports its own platform and a *Safari on
|
|
50
|
+
* macOS* user agent string, so a haystack holding both reads as a Mac, and
|
|
51
|
+
* `Mod` then binds Command on a keyboard that has no Command key — with
|
|
52
|
+
* `Shortcut` drawing a ⌘ over it. That is this file's own opening paragraph
|
|
53
|
+
* happening again, one layer down.
|
|
54
|
+
*
|
|
55
|
+
* The rule is a pure function so it can be asserted on directly: the browser
|
|
56
|
+
* this suite runs in only ever reports one of these combinations, and the one
|
|
57
|
+
* that broke is not it.
|
|
58
|
+
*/
|
|
59
|
+
export declare function resolveOS(userAgentDataPlatform: string | undefined, platform: string | undefined, userAgent: string | undefined): ResolvedOS;
|
|
60
|
+
export declare function readOS(): ResolvedOS;
|
|
61
|
+
/**
|
|
62
|
+
* Enough of a keyboard event to decide a combination — so one function serves
|
|
63
|
+
* both a DOM `KeyboardEvent` and React's synthetic one.
|
|
64
|
+
*/
|
|
65
|
+
export interface KeyPress {
|
|
66
|
+
key: string;
|
|
67
|
+
code: string;
|
|
68
|
+
ctrlKey: boolean;
|
|
69
|
+
metaKey: boolean;
|
|
70
|
+
altKey: boolean;
|
|
71
|
+
shiftKey: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Does this keystroke satisfy `Mod+Shift+P`?
|
|
75
|
+
*
|
|
76
|
+
* The modifiers are matched **exactly**, not as a subset: a shortcut names the
|
|
77
|
+
* modifiers it wants, so `Enter` does not fire when `Mod+Enter` was pressed.
|
|
78
|
+
* That is what makes a `shortcuts` map unambiguous — at most one entry can
|
|
79
|
+
* match a keystroke, unless a caller spelled the same combination twice.
|
|
80
|
+
*/
|
|
81
|
+
export declare function matchesShortcut(event: KeyPress, shortcut: string): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* The `shortcuts` map and the caller's own `onKeyDown`, as the one handler a
|
|
84
|
+
* control can carry.
|
|
85
|
+
*
|
|
86
|
+
* The map is checked first and every matching entry runs, so a caller who
|
|
87
|
+
* spelled one combination two ways gets both rather than an arbitrary one; then
|
|
88
|
+
* `onKeyDown` runs, and can read `event.defaultPrevented` to see what the map
|
|
89
|
+
* decided. `undefined` when there is nothing to bind, so a field with neither
|
|
90
|
+
* prop attaches no listener at all.
|
|
91
|
+
*/
|
|
92
|
+
export declare function keyHandler<E extends Element>(shortcuts: NebaShortcuts<E> | undefined, onKeyDown?: React.KeyboardEventHandler<E>): React.KeyboardEventHandler<E> | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t={cmdorctrl:"mod",commandorcontrol:"mod",cmd:"meta",command:"meta",super:"meta",win:"meta",windows:"meta",control:"ctrl",option:"alt",opt:"alt",return:"enter",esc:"escape",del:"delete",caps:"capslock",spacebar:"space",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright"};export function tokenize(t){return Array.isArray(t)?t.map(t=>t.trim()).filter(Boolean):t.split("+").map(t=>t.trim()).filter(Boolean)}export function canonicalKey(e){if(" "===e)return"space";const r=e.toLowerCase().replace(/[\s_-]/g,"");return t[r]??r}export function resolveOS(t,e,r){const n=t||e||r||"";return/mac|iphone|ipad|ipod/i.test(n)?"mac":/win/i.test(n)?"windows":"linux"}let e=null;export function readOS(){return e??=function(){if("undefined"==typeof navigator)return"windows";const t=navigator.userAgentData;return resolveOS(t?.platform,navigator.platform,navigator.userAgent)}(),e}export function matchesShortcut(t,e){const r=tokenize(e).map(canonicalKey);if(0===r.length)return!1;const n={ctrl:!1,meta:!1,alt:!1,shift:!1},o="mac"===readOS();for(const t of r.slice(0,-1))if("mod"===t)n[o?"meta":"ctrl"]=!0;else{if("meta"!==t&&"ctrl"!==t&&"alt"!==t&&"shift"!==t)return!1;n[t]=!0}return t.ctrlKey===n.ctrl&&t.metaKey===n.meta&&t.altKey===n.alt&&t.shiftKey===n.shift&&function(t,e){if(canonicalKey(t.key)===e)return!0;if(1===e.length){if(e>="a"&&e<="z")return t.code===`Key${e.toUpperCase()}`;if(e>="0"&&e<="9")return t.code===`Digit${e}`}return!1}(t,r[r.length-1])}export function keyHandler(t,e){return t?r=>{for(const[e,n]of Object.entries(t))matchesShortcut(r,e)&&n(r);e?.(r)}:e}
|
package/dist/internal/media.d.ts
CHANGED
|
@@ -1,9 +1,43 @@
|
|
|
1
|
+
import type { NebaBreakpoint } from '../types.js';
|
|
1
2
|
/** Subscribes to one query. A no-op where there is no window to ask. */
|
|
2
3
|
export declare function subscribeToQuery(query: string, onChange: () => void): () => void;
|
|
3
4
|
/** The current answer. Reads a live object rather than building one. */
|
|
4
5
|
export declare function queryMatches(query: string): boolean;
|
|
5
6
|
/** A server has no window, so nothing matches. */
|
|
6
7
|
export declare function noMatchOnServer(): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* The five widths, written once and read in both directions.
|
|
10
|
+
*
|
|
11
|
+
* They are Tailwind's defaults, which is what makes a Neba layout and a `md:`
|
|
12
|
+
* utility change at the same moment — and they are here rather than in
|
|
13
|
+
* `page-layout.ts`, where they used to be, because a layout asks "is the window
|
|
14
|
+
* *narrower* than this" and a caller asks "is it *at least* this". Two
|
|
15
|
+
* questions, one table: a second copy would be a second chance for the two to
|
|
16
|
+
* disagree about what `md` is.
|
|
17
|
+
*
|
|
18
|
+
* This copy is the fallback rather than the source. `styles.css` publishes the
|
|
19
|
+
* same four widths as `--neba-breakpoint-*`, filled in from Tailwind's own
|
|
20
|
+
* theme at build time, and `readBreakpoints` below prefers those — so a
|
|
21
|
+
* consumer who moves `--breakpoint-md` moves the CSS and this together instead
|
|
22
|
+
* of leaving the two to disagree silently. What is written here is what a
|
|
23
|
+
* server, and a page whose stylesheet has not arrived, has to answer with.
|
|
24
|
+
*/
|
|
25
|
+
export declare const breakpointWidths: Record<NebaBreakpoint, string>;
|
|
26
|
+
/** Narrower than this breakpoint. `xs` has nothing below it, so it is `null`. */
|
|
27
|
+
export declare function widthBelow(breakpoint: NebaBreakpoint): string | null;
|
|
28
|
+
/** At this breakpoint or wider — the direction a Tailwind `md:` variant means. */
|
|
29
|
+
export declare function widthAtLeast(breakpoint: NebaBreakpoint): string;
|
|
30
|
+
/**
|
|
31
|
+
* One media query, as a boolean React can re-render on.
|
|
32
|
+
*
|
|
33
|
+
* `useSyncExternalStore` rather than state plus an effect, for the reason the
|
|
34
|
+
* whole module exists: a media query *is* an external store with a server
|
|
35
|
+
* answer, and reading it in an effect renders every subscriber once with the
|
|
36
|
+
* wrong answer and then again with the right one. `null` is a query that is
|
|
37
|
+
* always false and subscribes to nothing, which is what a breakpoint with
|
|
38
|
+
* nothing below it needs.
|
|
39
|
+
*/
|
|
40
|
+
export declare function useMediaQuery(query: string | null): boolean;
|
|
7
41
|
/** The query behind every "the reader asked for less motion" decision. */
|
|
8
42
|
export declare const reducedMotionQuery = "(prefers-reduced-motion: reduce)";
|
|
9
43
|
/**
|
package/dist/internal/media.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";const
|
|
1
|
+
"use client";import*as e from"react";const t=new Map;function n(e){if(t.has(e))return t.get(e)??null;const n="undefined"!=typeof window&&window.matchMedia?window.matchMedia(e):null;return t.set(e,n),n}export function subscribeToQuery(e,t){const r=n(e);return r?(r.addEventListener("change",t),()=>r.removeEventListener("change",t)):()=>{}}export function queryMatches(e){return n(e)?.matches??!1}export function noMatchOnServer(){return!1}export const breakpointWidths={xs:"0rem",sm:"40rem",md:"48rem",lg:"64rem",xl:"80rem"};let r=null;function o(){if(r)return r;if("undefined"==typeof window||!window.getComputedStyle)return breakpointWidths;const e=getComputedStyle(document.documentElement),t={...breakpointWidths};for(const n of["sm","md","lg","xl"]){const r=e.getPropertyValue(`--neba-breakpoint-${n}`).trim();r&&(t[n]=r)}return r=t,t}export function widthBelow(e){return"xs"===e?null:`(width < ${o()[e]})`}export function widthAtLeast(e){return`(width >= ${o()[e]})`}export function useMediaQuery(t){const n=e.useCallback(e=>t?subscribeToQuery(t,e):()=>{},[t]),r=e.useCallback(()=>!!t&&queryMatches(t),[t]);return e.useSyncExternalStore(n,r,noMatchOnServer)}export const reducedMotionQuery="(prefers-reduced-motion: reduce)";const u=e=>subscribeToQuery(reducedMotionQuery,e),c=()=>queryMatches(reducedMotionQuery);export function usePrefersReducedMotion(){return e.useSyncExternalStore(u,c,noMatchOnServer)}
|
|
@@ -96,20 +96,29 @@ export declare const PageLayoutContext: React.Context<PageLayoutContextValue>;
|
|
|
96
96
|
* "nobody said", which a standalone sidebar reads as `start`.
|
|
97
97
|
*/
|
|
98
98
|
export declare const SidebarSideContext: React.Context<SidebarSide | null>;
|
|
99
|
+
/**
|
|
100
|
+
* The media query each breakpoint's floor makes, written the way `styles.css`
|
|
101
|
+
* writes the grid's.
|
|
102
|
+
*
|
|
103
|
+
* `xs` has no query because its floor is zero: there is no width below it, so
|
|
104
|
+
* a sidebar that collapses there never collapses.
|
|
105
|
+
*/
|
|
99
106
|
/**
|
|
100
107
|
* The same five widths as Tailwind variants, for the parts of this that are
|
|
101
108
|
* decided in CSS rather than in JavaScript.
|
|
102
109
|
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
110
|
+
* The tables themselves are `internal/responsive.ts`', because `Show` asks the
|
|
111
|
+
* identical question and two spellings of "hidden below `md`" would be two
|
|
112
|
+
* chances to disagree. What is added here is only the sixth key: `none` is a
|
|
113
|
+
* layout that never collapses, which is not a breakpoint and has no place in a
|
|
114
|
+
* table the rest of the library reads.
|
|
106
115
|
*
|
|
107
|
-
* `
|
|
108
|
-
* sidebar's own trigger wants: the hamburger exists exactly while the
|
|
109
|
-
* does not. `
|
|
110
|
-
* wants for the one paint between the server's HTML arriving
|
|
111
|
-
* finding out how wide the window is — without it a phone draws
|
|
112
|
-
* full width and then throws it away.
|
|
116
|
+
* `collapsedOnlyClasses` hides something at and above the breakpoint, which is
|
|
117
|
+
* what a sidebar's own trigger wants: the hamburger exists exactly while the
|
|
118
|
+
* sidebar does not. `expandedOnlyClasses` hides it below, which is what the
|
|
119
|
+
* sidebar's column wants for the one paint between the server's HTML arriving
|
|
120
|
+
* and JavaScript finding out how wide the window is — without it a phone draws
|
|
121
|
+
* the sidebar full width and then throws it away.
|
|
113
122
|
*/
|
|
114
123
|
export declare const collapsedOnlyClasses: Record<PageLayoutCollapse, string>;
|
|
115
124
|
export declare const expandedOnlyClasses: Record<PageLayoutCollapse, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{
|
|
1
|
+
"use client";import*as e from"react";import{useMediaQuery as t,widthBelow as n}from"./media.js";import{hiddenBelowClasses as o,hiddenFromClasses as r}from"./responsive.js";export const PageLayoutContext=/*@__PURE__*/e.createContext({present:!1,register:()=>{},collapseBelow:"none",open:{start:!1,end:!1},setOpen:()=>{},scroll:"page"});export const SidebarSideContext=/*@__PURE__*/e.createContext(null);export const collapsedOnlyClasses={none:"hidden",...r};export const expandedOnlyClasses={none:"",...o};export function useCollapsed(e){return t("none"===e?null:n(e))}export function drawerSide(e){const t="undefined"!=typeof document&&"rtl"===getComputedStyle(document.documentElement).direction;return"start"===e?t?"right":"left":t?"left":"right"}
|
|
@@ -82,6 +82,12 @@ interface InternalShellProps extends PickerShellProps {
|
|
|
82
82
|
}>;
|
|
83
83
|
/** How far off the trigger the popup sits. */
|
|
84
84
|
sideOffset?: number;
|
|
85
|
+
/**
|
|
86
|
+
* A class name for the popup itself, which no `className` can reach: it is
|
|
87
|
+
* portalled to the end of `<body>`, outside the element the root class lands
|
|
88
|
+
* on. Only TreeSelect offers it to a caller so far.
|
|
89
|
+
*/
|
|
90
|
+
popupClassName?: string;
|
|
85
91
|
children: React.ReactNode;
|
|
86
92
|
triggerRef?: React.Ref<HTMLButtonElement>;
|
|
87
93
|
}
|
|
@@ -93,7 +99,7 @@ interface InternalShellProps extends PickerShellProps {
|
|
|
93
99
|
* and the way `invalid` re-points the whole colour family at `danger` so the
|
|
94
100
|
* edge, the ring and the message turn over together.
|
|
95
101
|
*/
|
|
96
|
-
export declare function PickerShell({ variant, size, color, density, elevation, label, description, error, invalid, startIcon, fullWidth, disabled, readOnly, required, id, className, style, display, samples, empty, clearable, onClear, open, onOpenChange, labels, hiddenValues, sideOffset, children, triggerRef, ...props }: InternalShellProps): React.JSX.Element;
|
|
102
|
+
export declare function PickerShell({ variant, size, color, density, elevation, label, description, error, invalid, startIcon, fullWidth, disabled, readOnly, required, id, className, style, display, samples, empty, clearable, onClear, open, onOpenChange, labels, hiddenValues, sideOffset, popupClassName, children, triggerRef, ...props }: InternalShellProps): React.JSX.Element;
|
|
97
103
|
/**
|
|
98
104
|
* The row of shortcuts under a picker's panel.
|
|
99
105
|
*
|
package/dist/internal/picker.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as
|
|
1
|
+
import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as l from"react";import{Field as i}from"@base-ui/react/field";import{Popover as a}from"@base-ui/react/popover";import{CloseIcon as r}from"./icons.js";import{WidthSizer as t}from"./sizer.js";import{chipRemoveClasses as s,controlHeightClasses as o,controlTextLeadingClasses as d,cx as c,disabledClasses as p,fieldReadOnlyClasses as u,fieldRestClasses as m,focusWithinRingClasses as f,gapClasses as b,iconClasses as h,metaTextClasses as x,paddingXClasses as g,popupFadeClasses as v,radiusClasses as N,stackGapClasses as y,surfaceClasses as w,surfaceSlots as P,transitionClasses as j}from"./styles.js";export function popupSlots(e,n){return{...P(e,n),"--n-fill":`var(--neba-${e}-fill)`,"--n-fill-hover":`var(--neba-${e}-fill-hover)`,"--n-fill-active":`var(--neba-${e}-fill-active)`,"--n-on-solid":`var(--neba-${e}-on-solid)`}}const C=["group relative flex w-full items-center select-none","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",j,"focus-within:[transition-duration:0ms]",f,h].join(" ");export const pickerPopupClasses=[w,"border bg-(--n-panel-press)","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]","[outline:none]",v].join(" ");export const popupPaddingClasses={xs:"p-1.5",sm:"p-2",md:"p-2.5",lg:"p-3",xl:"p-3.5"};export function PickerShell({variant:f="outline",size:h="md",color:v="primary",density:w="default",elevation:j=0,label:k,description:$,error:O,invalid:z,startIcon:F,fullWidth:R=!1,disabled:S=!1,readOnly:q=!1,required:D=!1,id:I,className:E,style:L,display:T,samples:V,empty:W,clearable:A=!1,onClear:B,open:G,onOpenChange:H,labels:J,hiddenValues:K,sideOffset:M=6,popupClassName:Q,children:U,triggerRef:X,...Y}){const Z=l.useId(),_=I??`${Z}-trigger`,ee=`${Z}-label`,ne=`${Z}-description`,le=`${Z}-error`,ie=null!=O&&!1!==O&&""!==O,ae=z??ie,re=ae?"danger":v,te=S||q,se=c($?ne:null,ie?le:null)||void 0;return n(i.Root,{disabled:S,invalid:ae,className:c("flex-col align-top",y[h],R?"flex w-full":"inline-flex",E),style:{...P(re,j),...L},...Y,children:[k?e(i.Label,{id:ee,htmlFor:_,className:c(x[h],"font-medium",S?"text-(--neba-disabled-fg)":"text-(--neba-fg)"),children:k}):null,n(a.Root,{open:G,onOpenChange:e=>H(e),children:[n("span",{className:c(C,o[h],d[h],N[h],b[h],g[w][h],S?p[f]:q?u[f]:m[f]),children:[n(a.Trigger,{id:_,ref:X,disabled:S,"aria-labelledby":k?ee:void 0,"aria-describedby":se,"aria-required":D||void 0,"aria-invalid":ae||void 0,className:c("flex min-w-0 flex-1 items-center bg-transparent text-start [font:inherit] text-inherit",b[h],"[outline:none]",te?"cursor-default":"cursor-pointer"),children:[F?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg) transition-[color] duration-(--neba-duration) group-focus-within:text-(--n-accent)",children:F}):null,n("span",{className:"flex min-w-0 flex-1 flex-col",children:[e("span",{className:c("w-full truncate",W?"text-(--neba-muted-fg)":"text-(--neba-fg)"),children:T}),e(t,{samples:V??[]})]})]}),!A||W||te?null:e("button",{type:"button","aria-label":J.clear,className:c(s,"text-(--neba-muted-fg)"),onClick:e=>{e.stopPropagation(),B()},children:e(r,{})})]}),e(a.Portal,{children:e(a.Positioner,{className:"neba-portal z-50 [outline:none]",sideOffset:M,align:"start",children:e(a.Popup,{initialFocus:!1,className:c(pickerPopupClasses,N[h],popupPaddingClasses[h],d[h],Q),style:popupSlots(re,3),children:U})})})]}),$?e(i.Description,{id:ne,className:c(x[h],"text-(--neba-muted-fg)"),children:$}):null,ie?e(i.Error,{id:le,match:!0,className:c(x[h],"text-(--n-accent)"),children:O}):null,K?.map((n,l)=>e("input",{type:"hidden",name:n.name,value:n.value},l))]})}export function PickerFooter({size:n,children:l}){return e("div",{className:c("flex items-center justify-end border-t pt-1.5","[border-color:var(--n-line)]",b[n]),children:l})}export function PickerDivider(){return e("div",{"aria-hidden":"true",className:"w-px self-stretch bg-(--n-line)"})}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A value that changes at a breakpoint, and the machinery every component that
|
|
3
|
+
* takes one shares.
|
|
4
|
+
*
|
|
5
|
+
* This was written inside `grid.ts`, for the grid, and it is here now for the
|
|
6
|
+
* reason `media.ts` exists one level down: it is not about grids at all. A
|
|
7
|
+
* span, a gutter, a content measure, a flex direction and whether an element is
|
|
8
|
+
* drawn are five different questions with one answer shape, and a second copy
|
|
9
|
+
* of `withBaseline` would be a second chance to disagree about what a partial
|
|
10
|
+
* map means.
|
|
11
|
+
*
|
|
12
|
+
* The split it makes is the load-bearing part. **What a responsive value cannot
|
|
13
|
+
* be is a class name.** Tailwind only ever sees class names written out
|
|
14
|
+
* literally, and a per-breakpoint class map would be five complete ladders in
|
|
15
|
+
* the bundle of every page that draws the component — so a prop is responsive
|
|
16
|
+
* exactly when its value fits in an inline `--n-*` slot, and props whose value
|
|
17
|
+
* *is* a class (`size`, `variant`, `color`, `elevation`) are deliberately not.
|
|
18
|
+
* That is the same line `styleSlots()` draws for colour, drawn again here.
|
|
19
|
+
*
|
|
20
|
+
* The CSS half lives in `styles.css`: one cascade per slot name, each
|
|
21
|
+
* breakpoint falling back through the ones below it. That is what lets a media
|
|
22
|
+
* query change a value without React hearing about it — the alternative is
|
|
23
|
+
* re-rendering the tree at every breakpoint to say the same thing — and it is
|
|
24
|
+
* also why the list of responsive axes is kept short. A cascade is four media
|
|
25
|
+
* blocks that cannot be generated, so each new one is a deliberate cost.
|
|
26
|
+
*/
|
|
27
|
+
import type * as React from 'react';
|
|
28
|
+
import type { NebaBreakpoint, NebaResponsive } from '../types.js';
|
|
29
|
+
/** Smallest first, which is also the order the media queries have to be in. */
|
|
30
|
+
export declare const breakpoints: readonly NebaBreakpoint[];
|
|
31
|
+
/** A bare value means "from `xs` up"; a map is already per-breakpoint. */
|
|
32
|
+
export declare function breakpointMap<T>(value: NebaResponsive<T> | undefined): Partial<Record<NebaBreakpoint, T>>;
|
|
33
|
+
/**
|
|
34
|
+
* Turns a responsive value into the `--n-{name}-{breakpoint}` slots the CSS
|
|
35
|
+
* reads, emitting only the breakpoints the caller actually named.
|
|
36
|
+
*
|
|
37
|
+
* The gaps are filled in by CSS rather than here: each breakpoint's rule falls
|
|
38
|
+
* back through the ones below it, so `{ md: 6 }` needs one slot and not five.
|
|
39
|
+
* That keeps the inline style on a grid item down to what was asked for.
|
|
40
|
+
*/
|
|
41
|
+
export declare function responsiveSlots<T>(name: string, value: NebaResponsive<T> | undefined, toCss: (value: T) => string): React.CSSProperties;
|
|
42
|
+
/**
|
|
43
|
+
* Fills in the `xs` entry of a partial map with the prop's own default.
|
|
44
|
+
*
|
|
45
|
+
* Without this, `spacing={{ md: 4 }}` would be a grid with no gutter at all
|
|
46
|
+
* below 48rem — the CSS fallback rather than the documented default of 2 — and
|
|
47
|
+
* a caller who narrowed one breakpoint would silently lose every other one. A
|
|
48
|
+
* map says "from here up, use this instead"; it does not say "and nothing
|
|
49
|
+
* below".
|
|
50
|
+
*/
|
|
51
|
+
export declare function withBaseline<T>(value: NebaResponsive<T> | undefined, baseline: T): NebaResponsive<T>;
|
|
52
|
+
/**
|
|
53
|
+
* The value in force at one breakpoint: the nearest entry at or below it.
|
|
54
|
+
*
|
|
55
|
+
* The JavaScript half of what the CSS cascade does, and written to give the
|
|
56
|
+
* same answer — every entry is a floor, so `{ xs: 12, md: 6 }` is `6` at `lg`
|
|
57
|
+
* because `md` is the last thing said before it. `undefined` is a map that has
|
|
58
|
+
* said nothing yet at this width, which is a real answer rather than a
|
|
59
|
+
* failure: `{ lg: 4 }` at `xs` is the caller declining to have an opinion, and
|
|
60
|
+
* the CSS form falls through to its own default there for the same reason.
|
|
61
|
+
*/
|
|
62
|
+
export declare function valueAt<T>(value: NebaResponsive<T> | undefined, breakpoint: NebaBreakpoint): T | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* One responsive value laid over another, the way a more specific CSS
|
|
65
|
+
* declaration is laid over a general one.
|
|
66
|
+
*
|
|
67
|
+
* This is what a pair like `spacing` and `columnSpacing` needs, and doing it
|
|
68
|
+
* with `columnSpacing ?? spacing` is wrong in a way that only shows up once
|
|
69
|
+
* either of them is a map: `spacing={2} columnSpacing={{ md: 6 }}` took the
|
|
70
|
+
* override whole and left the row with no column gutter at all below 48rem,
|
|
71
|
+
* because the map says nothing there and the baseline it fell back to was the
|
|
72
|
+
* prop's own default rather than the `spacing` beside it.
|
|
73
|
+
*
|
|
74
|
+
* So the two are walked together. At each breakpoint the override wins if it
|
|
75
|
+
* has said anything at or below there — and keeps winning above, because it is
|
|
76
|
+
* the more specific of the two — and the base fills in until then. Only the
|
|
77
|
+
* steps where the answer actually changes are emitted, so the result is still
|
|
78
|
+
* one or two slots rather than five.
|
|
79
|
+
*/
|
|
80
|
+
export declare function overlayResponsive<T>(base: NebaResponsive<T>, override: NebaResponsive<T> | undefined): NebaResponsive<T>;
|
|
81
|
+
/**
|
|
82
|
+
* A number is pixels; a string is already a CSS length.
|
|
83
|
+
*
|
|
84
|
+
* Every length a caller can hand this library goes through here — a Stack's
|
|
85
|
+
* overlap, a Container's measure — so that `640` and `'640px'` mean the same
|
|
86
|
+
* thing everywhere rather than in the components that happened to think of it.
|
|
87
|
+
*/
|
|
88
|
+
export declare function lengthOf(value: number | string): string;
|
|
89
|
+
/** Hidden below this breakpoint: the element exists from here up. */
|
|
90
|
+
export declare const hiddenBelowClasses: Record<NebaBreakpoint, string>;
|
|
91
|
+
/**
|
|
92
|
+
* Hidden at this breakpoint and above: the element exists only under it.
|
|
93
|
+
*
|
|
94
|
+
* `xs` is `hidden` outright rather than empty — nothing is below a floor of
|
|
95
|
+
* zero, so "only under `xs`" is nowhere at all.
|
|
96
|
+
*/
|
|
97
|
+
export declare const hiddenFromClasses: Record<NebaBreakpoint, string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const breakpoints=["xs","sm","md","lg","xl"];export function breakpointMap(n){return null==n?{}:"object"==typeof n?n:{xs:n}}export function responsiveSlots(n,e,o){const t=breakpointMap(e),r={};for(const e of breakpoints){const i=t[e];void 0!==i&&(r[`--n-${n}-${e}`]=o(i))}return r}export function withBaseline(n,e){return null==n?e:"object"==typeof n?{xs:e,...n}:n}export function valueAt(n,e){if(null==n)return;if("object"!=typeof n)return n;const o=n;for(let n=breakpoints.indexOf(e);n>=0;n-=1){const e=o[breakpoints[n]];if(void 0!==e)return e}}export function overlayResponsive(n,e){if(null==e)return n;const o=breakpointMap(n),t=breakpointMap(e),r={};let i,s,d;for(const n of breakpoints){void 0!==o[n]&&(i=o[n]),void 0!==t[n]&&(s=t[n]);const e=void 0!==s?s:i;void 0!==e&&e!==d&&(r[n]=e,d=e)}return r}export function lengthOf(n){return"number"==typeof n?`${n}px`:n}export const hiddenBelowClasses={xs:"",sm:"max-sm:hidden",md:"max-md:hidden",lg:"max-lg:hidden",xl:"max-xl:hidden"};export const hiddenFromClasses={xs:"hidden",sm:"sm:hidden",md:"md:hidden",lg:"lg:hidden",xl:"xl:hidden"};
|
|
@@ -34,6 +34,41 @@ export declare const radiusClasses: Record<NebaSize, string>;
|
|
|
34
34
|
* Density never touches these.
|
|
35
35
|
*/
|
|
36
36
|
export declare const controlHeightClasses: Record<NebaSize, string>;
|
|
37
|
+
/**
|
|
38
|
+
* The same ladder as raw lengths, for the arithmetic a class cannot do.
|
|
39
|
+
*
|
|
40
|
+
* `paddingXValues` is here for the same reason one level down: Tailwind only
|
|
41
|
+
* ever sees class names written out literally, so "three rows of tabs tall" is a
|
|
42
|
+
* number a component has to multiply. **Keep the two in step** — a height that
|
|
43
|
+
* disagrees with its class is a cap that lands half a row out.
|
|
44
|
+
*/
|
|
45
|
+
export declare const controlHeightValues: Record<NebaSize, string>;
|
|
46
|
+
/**
|
|
47
|
+
* How wide content is allowed to get — a Container's `maxWidth`, and the same
|
|
48
|
+
* prop on a Header and a Footer whose bar spans the window while what is on it
|
|
49
|
+
* lines up with the page.
|
|
50
|
+
*
|
|
51
|
+
* Written here once because the three had a copy each, and in `rem` rather than
|
|
52
|
+
* in Tailwind's named `max-w-*` steps so that a Container's `lg` and a `lg:`
|
|
53
|
+
* variant are the same 64rem. Tailwind's own container scale is a different set
|
|
54
|
+
* of numbers, and two ladders called `lg` on one page is how a layout drifts by
|
|
55
|
+
* a few pixels for no reason anybody can find later.
|
|
56
|
+
*
|
|
57
|
+
* Four of the five are exactly the breakpoint floors. `xs` is the one that is
|
|
58
|
+
* not — a measure of zero is not a thing — and that is the whole of the
|
|
59
|
+
* difference between this ladder and `NebaBreakpoint`.
|
|
60
|
+
*/
|
|
61
|
+
export declare const measureWidths: Record<NebaSize, string>;
|
|
62
|
+
/**
|
|
63
|
+
* One value of a `maxWidth`, as the length the `--n-max-w` slot takes.
|
|
64
|
+
*
|
|
65
|
+
* A step of the ladder resolves to its `rem`; anything else is a length the
|
|
66
|
+
* caller wrote and is passed through untouched, so `'48rem'`, `'60ch'`,
|
|
67
|
+
* `'min(90vw, 72rem)'` and `640` all reach `max-width` meaning what they say.
|
|
68
|
+
* `'none'` is not in the table and therefore falls through to the CSS keyword,
|
|
69
|
+
* which is what it already was.
|
|
70
|
+
*/
|
|
71
|
+
export declare function measureValue(value: NebaSize | 'none' | number | string): string;
|
|
37
72
|
/** The same numbers as a width, for a control with nothing to pad against. */
|
|
38
73
|
export declare const controlSquareClasses: Record<NebaSize, string>;
|
|
39
74
|
/** A control's label. One line, so the leading comes from `leading-none`. */
|
|
@@ -47,6 +82,12 @@ export declare const controlTextClasses: Record<NebaSize, string>;
|
|
|
47
82
|
export declare const controlTextLeadingClasses: Record<NebaSize, string>;
|
|
48
83
|
/** Labels, descriptions and error messages: one step below the control's text. */
|
|
49
84
|
export declare const metaTextClasses: Record<NebaSize, string>;
|
|
85
|
+
/**
|
|
86
|
+
* `metaTextClasses` as raw lengths, for text whose size has to travel in the
|
|
87
|
+
* same inline style object as the rest of what positions it — an Image's
|
|
88
|
+
* watermark, which is placed, tinted and turned inline. Keep the two in step.
|
|
89
|
+
*/
|
|
90
|
+
export declare const metaTextValues: Record<NebaSize, string>;
|
|
50
91
|
/**
|
|
51
92
|
* Horizontal padding, and the only thing `density` is allowed to touch. The two
|
|
52
93
|
* tracks are roughly 2:1 so the difference is legible at a glance rather than a
|
|
@@ -170,6 +211,33 @@ export declare const transitionClasses: string;
|
|
|
170
211
|
* and then decays.
|
|
171
212
|
*/
|
|
172
213
|
export declare const pressTransitionClasses = "active:[transition-duration:0ms]";
|
|
214
|
+
/**
|
|
215
|
+
* The two ends of a popup's fade: not there yet, and not there any more.
|
|
216
|
+
*
|
|
217
|
+
* Split out from `popupFadeClasses` below for exactly one caller —
|
|
218
|
+
* NavigationMenu's popup also travels in width and height as the reader moves
|
|
219
|
+
* between two menus, so its `transition` shorthand has to name three properties
|
|
220
|
+
* and a second shorthand beside it would win or lose by stylesheet order rather
|
|
221
|
+
* than by intent. Everything else wants the whole thing.
|
|
222
|
+
*/
|
|
223
|
+
export declare const popupFadeStateClasses = "data-[starting-style]:opacity-0 data-[ending-style]:opacity-0";
|
|
224
|
+
/**
|
|
225
|
+
* How every floating surface in the library arrives and leaves.
|
|
226
|
+
*
|
|
227
|
+
* Opacity, and nothing else. A popup that scales or slides has spent 160ms
|
|
228
|
+
* dragging its own text across the screen — and unlike a control, a popup is
|
|
229
|
+
* mostly text: a menu row the pointer was already reaching for, a dialog
|
|
230
|
+
* somebody has started reading, a calendar cell under a finger that is already
|
|
231
|
+
* moving. The house rule against transforming a control is the same rule, and
|
|
232
|
+
* this is where it lands for the things that float.
|
|
233
|
+
*
|
|
234
|
+
* It is written here rather than in each of them because there were fourteen
|
|
235
|
+
* copies of it and the fifteenth and sixteenth — Select's popup and Combobox's —
|
|
236
|
+
* were never written at all, which is the failure mode a shared table exists to
|
|
237
|
+
* prevent. Base UI supplies the `data-starting-style` / `data-ending-style` pair
|
|
238
|
+
* on every popup, backdrop and toast, so the same two lines fit all of them.
|
|
239
|
+
*/
|
|
240
|
+
export declare const popupFadeClasses: string;
|
|
173
241
|
/**
|
|
174
242
|
* The focus ring, written as the `outline` shorthand rather than Tailwind's
|
|
175
243
|
* `outline-2` + colour pair: the utilities route the style through
|
package/dist/internal/styles.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const radiusClasses={xs:"rounded-(--neba-radius-xs)",sm:"rounded-(--neba-radius-sm)",md:"rounded-(--neba-radius-md)",lg:"rounded-(--neba-radius-lg)",xl:"rounded-(--neba-radius-xl)"};export const controlHeightClasses={xs:"h-5.5",sm:"h-6.5",md:"h-8",lg:"h-10",xl:"h-12"};export const controlSquareClasses={xs:"w-5.5",sm:"w-6.5",md:"w-8",lg:"w-10",xl:"w-12"};export const controlTextClasses={xs:"text-[0.6875rem]",sm:"text-[0.75rem]",md:"text-[0.8125rem]",lg:"text-[0.9375rem]",xl:"text-[1.0625rem]"};export const controlTextLeadingClasses={xs:"text-[0.6875rem]/[0.875rem]",sm:"text-[0.75rem]/[1rem]",md:"text-[0.8125rem]/[1.25rem]",lg:"text-[0.9375rem]/[1.375rem]",xl:"text-[1.0625rem]/[1.625rem]"};export const metaTextClasses={xs:"text-[0.625rem]",sm:"text-[0.6875rem]",md:"text-[0.75rem]",lg:"text-[0.8125rem]",xl:"text-[0.875rem]"};export const paddingXClasses={default:{xs:"px-2.5",sm:"px-3",md:"px-4",lg:"px-5",xl:"px-6"},compact:{xs:"px-1.5",sm:"px-2",md:"px-2.5",lg:"px-3",xl:"px-4"}};export const iconSizeClasses={xs:"size-3.5",sm:"size-4",md:"size-5",lg:"size-6",xl:"size-7"};export const tickSizeClasses={xs:"size-3.5",sm:"size-4",md:"size-4.5",lg:"size-5",xl:"size-6"};export const tickRadiusClasses={xs:"rounded-[0.25rem]",sm:"rounded-[0.3125rem]",md:"rounded-[0.375rem]",lg:"rounded-[0.4375rem]",xl:"rounded-[0.5rem]"};export const tickDotClasses={xs:"size-[0.3125rem]",sm:"size-1.5",md:"size-[0.4375rem]",lg:"size-2",xl:"size-[0.5625rem]"};export const tickRowLeadingClasses="leading-[1.4]";export const hitAreaClasses="neba-hit";export const paddingXValues={default:{xs:"0.625rem",sm:"0.75rem",md:"1rem",lg:"1.25rem",xl:"1.5rem"},compact:{xs:"0.375rem",sm:"0.5rem",md:"0.625rem",lg:"0.75rem",xl:"1rem"}};export const gapClasses={xs:"gap-1",sm:"gap-1.5",md:"gap-1.5",lg:"gap-2",xl:"gap-2.5"};export const stackGapClasses={xs:"gap-1",sm:"gap-1",md:"gap-1.5",lg:"gap-1.5",xl:"gap-2"};export const sheetTitleClasses={xs:"text-[0.75rem]/[1rem]",sm:"text-[0.8125rem]/[1.125rem]",md:"text-[0.9375rem]/[1.25rem]",lg:"text-[1.0625rem]/[1.5rem]",xl:"text-[1.25rem]/[1.75rem]"};export const sheetBodyClasses={xs:"text-[0.6875rem]/[1rem]",sm:"text-[0.75rem]/[1.125rem]",md:"text-[0.8125rem]/[1.375rem]",lg:"text-[0.9375rem]/[1.5rem]",xl:"text-[1.0625rem]/[1.75rem]"};export const sheetHeaderGapClasses={xs:"gap-0.5",sm:"gap-0.5",md:"gap-1",lg:"gap-1",xl:"gap-1.5"};export const sheetSectionGapClasses={xs:"gap-1.5",sm:"gap-2",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const surfaceClasses="[background-image:var(--neba-grain),var(--neba-sheen)] [background-blend-mode:overlay,normal] [backdrop-filter:var(--neba-blur)]";export const transitionClasses=["[transition-property:background-color,border-color,box-shadow,color]","[transition-duration:var(--neba-duration-fill),var(--neba-duration),var(--neba-duration),var(--neba-duration)]","[transition-timing-function:var(--neba-ease)]"].join(" ");export const pressTransitionClasses="active:[transition-duration:0ms]";export const focusRingClasses="focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2";export const focusWithinRingClasses="has-[:focus-visible]:[outline:2px_solid_var(--n-ring)] has-[:focus-visible]:outline-offset-2";export const iconClasses="[&_svg]:pointer-events-none [&_svg]:size-[1.2em] [&_svg]:shrink-0";export const srOnlyClasses="absolute size-px overflow-hidden whitespace-nowrap [clip-path:inset(50%)]";export function controlSlots(e,s,
|
|
1
|
+
export const radiusClasses={xs:"rounded-(--neba-radius-xs)",sm:"rounded-(--neba-radius-sm)",md:"rounded-(--neba-radius-md)",lg:"rounded-(--neba-radius-lg)",xl:"rounded-(--neba-radius-xl)"};export const controlHeightClasses={xs:"h-5.5",sm:"h-6.5",md:"h-8",lg:"h-10",xl:"h-12"};export const controlHeightValues={xs:"1.375rem",sm:"1.625rem",md:"2rem",lg:"2.5rem",xl:"3rem"};export const measureWidths={xs:"30rem",sm:"40rem",md:"48rem",lg:"64rem",xl:"80rem"};export function measureValue(e){return"number"==typeof e?`${e}px`:measureWidths[e]??e}export const controlSquareClasses={xs:"w-5.5",sm:"w-6.5",md:"w-8",lg:"w-10",xl:"w-12"};export const controlTextClasses={xs:"text-[0.6875rem]",sm:"text-[0.75rem]",md:"text-[0.8125rem]",lg:"text-[0.9375rem]",xl:"text-[1.0625rem]"};export const controlTextLeadingClasses={xs:"text-[0.6875rem]/[0.875rem]",sm:"text-[0.75rem]/[1rem]",md:"text-[0.8125rem]/[1.25rem]",lg:"text-[0.9375rem]/[1.375rem]",xl:"text-[1.0625rem]/[1.625rem]"};export const metaTextClasses={xs:"text-[0.625rem]",sm:"text-[0.6875rem]",md:"text-[0.75rem]",lg:"text-[0.8125rem]",xl:"text-[0.875rem]"};export const metaTextValues={xs:"0.625rem",sm:"0.6875rem",md:"0.75rem",lg:"0.8125rem",xl:"0.875rem"};export const paddingXClasses={default:{xs:"px-2.5",sm:"px-3",md:"px-4",lg:"px-5",xl:"px-6"},compact:{xs:"px-1.5",sm:"px-2",md:"px-2.5",lg:"px-3",xl:"px-4"}};export const iconSizeClasses={xs:"size-3.5",sm:"size-4",md:"size-5",lg:"size-6",xl:"size-7"};export const tickSizeClasses={xs:"size-3.5",sm:"size-4",md:"size-4.5",lg:"size-5",xl:"size-6"};export const tickRadiusClasses={xs:"rounded-[0.25rem]",sm:"rounded-[0.3125rem]",md:"rounded-[0.375rem]",lg:"rounded-[0.4375rem]",xl:"rounded-[0.5rem]"};export const tickDotClasses={xs:"size-[0.3125rem]",sm:"size-1.5",md:"size-[0.4375rem]",lg:"size-2",xl:"size-[0.5625rem]"};export const tickRowLeadingClasses="leading-[1.4]";export const hitAreaClasses="neba-hit";export const paddingXValues={default:{xs:"0.625rem",sm:"0.75rem",md:"1rem",lg:"1.25rem",xl:"1.5rem"},compact:{xs:"0.375rem",sm:"0.5rem",md:"0.625rem",lg:"0.75rem",xl:"1rem"}};export const gapClasses={xs:"gap-1",sm:"gap-1.5",md:"gap-1.5",lg:"gap-2",xl:"gap-2.5"};export const stackGapClasses={xs:"gap-1",sm:"gap-1",md:"gap-1.5",lg:"gap-1.5",xl:"gap-2"};export const sheetTitleClasses={xs:"text-[0.75rem]/[1rem]",sm:"text-[0.8125rem]/[1.125rem]",md:"text-[0.9375rem]/[1.25rem]",lg:"text-[1.0625rem]/[1.5rem]",xl:"text-[1.25rem]/[1.75rem]"};export const sheetBodyClasses={xs:"text-[0.6875rem]/[1rem]",sm:"text-[0.75rem]/[1.125rem]",md:"text-[0.8125rem]/[1.375rem]",lg:"text-[0.9375rem]/[1.5rem]",xl:"text-[1.0625rem]/[1.75rem]"};export const sheetHeaderGapClasses={xs:"gap-0.5",sm:"gap-0.5",md:"gap-1",lg:"gap-1",xl:"gap-1.5"};export const sheetSectionGapClasses={xs:"gap-1.5",sm:"gap-2",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const surfaceClasses="[background-image:var(--neba-grain),var(--neba-sheen)] [background-blend-mode:overlay,normal] [backdrop-filter:var(--neba-blur)]";export const transitionClasses=["[transition-property:background-color,border-color,box-shadow,color]","[transition-duration:var(--neba-duration-fill),var(--neba-duration),var(--neba-duration),var(--neba-duration)]","[transition-timing-function:var(--neba-ease)]"].join(" ");export const pressTransitionClasses="active:[transition-duration:0ms]";export const popupFadeStateClasses="data-[starting-style]:opacity-0 data-[ending-style]:opacity-0";export const popupFadeClasses=["[transition:opacity_var(--neba-duration)_var(--neba-ease)]",popupFadeStateClasses].join(" ");export const focusRingClasses="focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2";export const focusWithinRingClasses="has-[:focus-visible]:[outline:2px_solid_var(--n-ring)] has-[:focus-visible]:outline-offset-2";export const iconClasses="[&_svg]:pointer-events-none [&_svg]:size-[1.2em] [&_svg]:shrink-0";export const srOnlyClasses="absolute size-px overflow-hidden whitespace-nowrap [clip-path:inset(50%)]";export function controlSlots(e,s,r){const n="solid"===r;return{"--n-fill":`var(--neba-${e}-fill)`,"--n-fill-hover":`var(--neba-${e}-fill-hover)`,"--n-fill-active":`var(--neba-${e}-fill-active)`,"--n-on-solid":`var(--neba-${e}-on-solid)`,"--n-accent":`var(--neba-${e}-accent)`,"--n-soft":`var(--neba-${e}-soft)`,"--n-soft-hover":`var(--neba-${e}-soft-hover)`,"--n-soft-press":`var(--neba-${e}-soft-press)`,"--n-panel":`var(--neba-${e}-panel)`,"--n-panel-hover":`var(--neba-${e}-panel-hover)`,"--n-panel-press":`var(--neba-${e}-panel-press)`,"--n-line":`var(--neba-${e}-line)`,"--n-line-hover":`var(--neba-${e}-line-hover)`,"--n-ring":`var(--neba-${e}-ring)`,"--n-glow":n?"var(--neba-glow-on-fill)":`var(--neba-${e}-soft)`,"--n-flash":n?"var(--neba-flash-on-fill)":`var(--neba-${e}-soft-press)`,"--n-elev":`var(--neba-shadow-${s})`,"--n-elev-hover":`var(--neba-shadow-${Math.min(s+1,4)})`,"--n-elev-press":`var(--neba-shadow-${Math.max(s-1,0)})`}}export function surfaceSlots(e,s){return{"--n-accent":`var(--neba-${e}-accent)`,"--n-soft":`var(--neba-${e}-soft)`,"--n-soft-hover":`var(--neba-${e}-soft-hover)`,"--n-soft-press":`var(--neba-${e}-soft-press)`,"--n-panel":"var(--neba-panel)","--n-panel-hover":"var(--neba-panel-hover)","--n-panel-press":"var(--neba-panel-press)","--n-line":`var(--neba-${e}-line)`,"--n-line-hover":`var(--neba-${e}-line-hover)`,"--n-ring":`var(--neba-${e}-ring)`,"--n-elev":`var(--neba-shadow-${s})`}}export const disabledClasses={solid:"cursor-not-allowed bg-(--neba-disabled-bg) text-(--neba-disabled-fg) shadow-none",outline:"cursor-not-allowed border bg-transparent text-(--neba-disabled-fg) [border-color:var(--neba-disabled-border)] shadow-none",text:"cursor-not-allowed bg-transparent text-(--neba-disabled-fg) shadow-none"};export const fieldRestClasses={solid:[surfaceClasses,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]","hover:bg-(--n-panel-press)","focus-within:bg-(--n-panel-press)"].join(" "),outline:[surfaceClasses,"border text-(--neba-fg) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]","hover:bg-(--n-panel-hover) hover:[border-color:var(--n-line-hover)]","focus-within:bg-(--n-panel-hover) focus-within:[border-color:var(--n-ring)]"].join(" "),text:["text-(--neba-fg) bg-transparent","hover:bg-(--n-soft)","focus-within:bg-(--n-soft-hover)"].join(" ")};export const fieldReadOnlyClasses={solid:[surfaceClasses,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--neba-plate-solid)] [filter:saturate(0.55)]"].join(" "),outline:[surfaceClasses,"border text-(--neba-fg) bg-(--n-panel)","[border-color:var(--n-line)] [box-shadow:var(--neba-plate-glass)] [filter:saturate(0.55)]"].join(" "),text:"text-(--neba-fg) bg-transparent [filter:saturate(0.55)]"};export const readOnlyFilterClasses="[filter:saturate(0.55)]";export const chipRemoveClasses=["relative ms-0.5 inline-flex shrink-0 items-center justify-center rounded-full","size-[1.15em] cursor-pointer opacity-70",hitAreaClasses,"[transition:opacity_var(--neba-duration)_var(--neba-ease)]","hover:opacity-100 focus-visible:opacity-100","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1","disabled:cursor-not-allowed"].join(" ");export function hasContent(e){return null!=e&&!1!==e&&""!==e}export function toLength(e){if(null!=e)return"number"==typeof e?`${e}px`:e}const e=/^\s*(-?[\d.]+)\s*(px|rem|em|%)\s*$/;export function toPixels(r,n){const t=e.exec(r);if(!t)return;const a=Number(t[1]);if(!Number.isNaN(a))switch(t[2]){case"px":return a;case"%":return n.percentOf*a/100;case"em":return a*s(n.relativeTo);default:return a*s("undefined"==typeof document?null:document.documentElement)}}function s(e){return e&&"undefined"!=typeof getComputedStyle&&parseFloat(getComputedStyle(e).fontSize)||16}export function cx(...e){return e.filter(Boolean).join(" ")}
|