neba 1.11.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 +4 -4
- 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-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/avatar/Avatar.js +1 -1
- package/dist/components/bar-chart/BarChart.js +1 -1
- package/dist/components/checkbox/Checkbox.js +1 -1
- package/dist/components/combobox/Combobox.js +1 -1
- package/dist/components/command-palette/CommandPalette.js +1 -1
- package/dist/components/container/Container.d.ts +12 -4
- package/dist/components/container/Container.js +1 -1
- package/dist/components/data-table/DataTable.js +1 -1
- package/dist/components/dialog/Dialog.js +1 -1
- package/dist/components/drawer/Drawer.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/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.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.js +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 +123 -3
- package/dist/components/image/Image.js +1 -1
- package/dist/components/image/index.d.ts +1 -1
- package/dist/components/menu/Menu.js +1 -1
- package/dist/components/navigation-menu/NavigationMenu.js +1 -1
- package/dist/components/overlay/Overlay.js +1 -1
- package/dist/components/pie-chart/PieChart.js +1 -1
- package/dist/components/popover/Popover.js +1 -1
- package/dist/components/radio-group/RadioGroup.js +1 -1
- package/dist/components/rating/Rating.js +1 -1
- package/dist/components/scatter-chart/ScatterChart.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/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/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/tabs/Tabs.d.ts +28 -0
- package/dist/components/tabs/Tabs.js +1 -1
- package/dist/components/timeline-chart/TimelineChart.js +1 -1
- package/dist/components/toast/Toast.js +1 -1
- package/dist/components/toggle/Toggle.js +1 -1
- package/dist/components/tooltip/Tooltip.js +1 -1
- package/dist/components/tour/Tour.js +1 -1
- package/dist/components/transfer/Transfer.js +1 -1
- package/dist/components/tree-view/TreeView.js +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useMediaQuery.d.ts +35 -1
- package/dist/hooks/useMediaQuery.js +1 -1
- package/dist/index.d.ts +10 -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/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/grid.d.ts +13 -27
- package/dist/internal/grid.js +1 -1
- package/dist/internal/i18n.d.ts +20 -0
- package/dist/internal/i18n.js +1 -1
- package/dist/internal/media.d.ts +9 -2
- package/dist/internal/media.js +1 -1
- package/dist/internal/page-layout.d.ts +11 -9
- package/dist/internal/page-layout.js +1 -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 +119 -6
- package/package.json +18 -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
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { NebaSize, NebaStaggerProps, NebaTransition } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Which way the pile grows.
|
|
5
|
+
*
|
|
6
|
+
* - `horizontal` — each item sits under the one before it along the inline
|
|
7
|
+
* axis. A row of faces, a row of coins.
|
|
8
|
+
* - `vertical` — the same down the block axis. A pile seen from the front.
|
|
9
|
+
* - `diagonal` — flows along the inline axis like `horizontal` and drops each
|
|
10
|
+
* item as it goes, which is a fanned deck: the item behind shows its corner
|
|
11
|
+
* rather than its edge. How far it drops is `drop`.
|
|
12
|
+
*/
|
|
13
|
+
export type StackDirection = 'horizontal' | 'vertical' | 'diagonal';
|
|
14
|
+
export interface StackProps extends NebaStaggerProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color'> {
|
|
15
|
+
/** Which way the pile grows. @default 'horizontal' */
|
|
16
|
+
direction?: StackDirection;
|
|
17
|
+
/**
|
|
18
|
+
* How far each item sits **under** the one before it — a CSS length, or a
|
|
19
|
+
* number of pixels — along the axis the stack flows on.
|
|
20
|
+
*
|
|
21
|
+
* Left out it is a fraction of `size`, roughly a third of a control at every
|
|
22
|
+
* step: enough that the pile reads as a pile, and not so much that the item
|
|
23
|
+
* behind is gone.
|
|
24
|
+
*/
|
|
25
|
+
overlap?: number | string;
|
|
26
|
+
/**
|
|
27
|
+
* How far each item falls on the axis the stack does **not** flow along.
|
|
28
|
+
* Only `diagonal` moves on two axes, so only `diagonal` reads it.
|
|
29
|
+
*
|
|
30
|
+
* Defaults to `overlap`, which is a shallow fan. A true forty-five degrees
|
|
31
|
+
* would be the item's own width, which is the one number a stack cannot know
|
|
32
|
+
* without measuring what it was handed.
|
|
33
|
+
*/
|
|
34
|
+
drop?: number | string;
|
|
35
|
+
/**
|
|
36
|
+
* The size of the things being stacked, which is only ever read to work out
|
|
37
|
+
* the default `overlap`. Set `overlap` and this does nothing.
|
|
38
|
+
* @default 'md'
|
|
39
|
+
*/
|
|
40
|
+
size?: NebaSize;
|
|
41
|
+
/**
|
|
42
|
+
* How many items are drawn before the rest become an overflow marker. Left
|
|
43
|
+
* out, every one of them is drawn.
|
|
44
|
+
*/
|
|
45
|
+
max?: number;
|
|
46
|
+
/**
|
|
47
|
+
* How many there are altogether, when the stack was handed only the first
|
|
48
|
+
* few. Without it the count is worked out from the children, which is right
|
|
49
|
+
* only when all of them were passed.
|
|
50
|
+
*/
|
|
51
|
+
total?: number;
|
|
52
|
+
/**
|
|
53
|
+
* What stands in for the ones that did not fit, given how many those are.
|
|
54
|
+
* Drawn as one more item at the back of the pile.
|
|
55
|
+
*
|
|
56
|
+
* A function rather than a node, because the number is the whole point of it:
|
|
57
|
+
* `(hidden) => <Avatar initials={`+${hidden}`} />`.
|
|
58
|
+
*/
|
|
59
|
+
overflow?: (hidden: number) => React.ReactNode;
|
|
60
|
+
/**
|
|
61
|
+
* Which end of the list is at the front of the pile.
|
|
62
|
+
*
|
|
63
|
+
* `first` — the default — puts the first child on top, so a stack read from
|
|
64
|
+
* its leading edge is read front to back and the item the pile is *about*
|
|
65
|
+
* comes first rather than last.
|
|
66
|
+
* @default 'first'
|
|
67
|
+
*/
|
|
68
|
+
front?: 'first' | 'last';
|
|
69
|
+
/**
|
|
70
|
+
* What each item is multiplied by against the one in front of it — `0.94`
|
|
71
|
+
* takes six per cent off at every step, so the pile recedes.
|
|
72
|
+
*
|
|
73
|
+
* It is the `scale` property rather than a `transform`, which is what lets it
|
|
74
|
+
* sit on the same element as an entrance without the two fighting: the
|
|
75
|
+
* individual transform properties are applied before the shorthand.
|
|
76
|
+
* @default 1
|
|
77
|
+
*/
|
|
78
|
+
scaleStep?: number;
|
|
79
|
+
/**
|
|
80
|
+
* The same for opacity: `0.8` leaves each item four fifths as solid as the
|
|
81
|
+
* one in front. It multiplies with an entrance's own fade rather than
|
|
82
|
+
* replacing it.
|
|
83
|
+
* @default 1
|
|
84
|
+
*/
|
|
85
|
+
opacityStep?: number;
|
|
86
|
+
/**
|
|
87
|
+
* Draws a hairline in the page's own surface colour around each item.
|
|
88
|
+
*
|
|
89
|
+
* The one place the library draws a hard outline rather than an acrylic edge,
|
|
90
|
+
* and it is not decoration: two shapes of similar tone laid over each other
|
|
91
|
+
* have no edge between them at all and the pile reads as one smeared shape.
|
|
92
|
+
* Written onto the items themselves, so it follows a circle round.
|
|
93
|
+
* @default false
|
|
94
|
+
*/
|
|
95
|
+
ring?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* How each item arrives — the library's own `transition` vocabulary, so a
|
|
98
|
+
* Stack's fade and an `AnimateFade` are the same fade.
|
|
99
|
+
*
|
|
100
|
+
* `stagger` is what turns it into a pile being dealt rather than a pile
|
|
101
|
+
* appearing: it is added to each item's delay in turn.
|
|
102
|
+
*/
|
|
103
|
+
transition?: NebaTransition;
|
|
104
|
+
/** The things being stacked. Every top-level child is one item. */
|
|
105
|
+
children?: React.ReactNode;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Things laid over each other, so the set reads as a pile rather than a row.
|
|
109
|
+
*
|
|
110
|
+
* The overlap is a **margin** rather than a `translate`, which is the whole
|
|
111
|
+
* reason a Stack can sit in a paragraph: a translated pile draws outside a box
|
|
112
|
+
* that is still the size of one item, so everything after it is laid out
|
|
113
|
+
* against the wrong width. Margins make the box exactly as big as what is in
|
|
114
|
+
* it, at every direction and every overlap.
|
|
115
|
+
*
|
|
116
|
+
* Each item is drawn into a wrapper of its own rather than cloned onto. Cloning
|
|
117
|
+
* would need every child to accept a `className` and a `style` — which a
|
|
118
|
+
* Tooltip around an avatar, or anything produced by a `.map()` through somebody
|
|
119
|
+
* else's component, is not obliged to do. The wrapper carries the offset, the
|
|
120
|
+
* depth and the entrance; the child is left exactly as it was passed.
|
|
121
|
+
*
|
|
122
|
+
* The one thing written onto the children is `ring`, and only because a ring
|
|
123
|
+
* has to follow the shape it is around: a hairline on the wrapper of a circular
|
|
124
|
+
* avatar is a square.
|
|
125
|
+
*/
|
|
126
|
+
export declare const Stack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import*as e from"react";import{animBaseClass as r,animationClasses as a,animationSlots as l,transitionParts as i}from"../../internal/animate.js";import{lengthOf as n}from"../../internal/responsive.js";import{cx as s}from"../../internal/styles.js";import{useStyleDefaults as o}from"../../internal/defaults.js";const m={xs:"0.375rem",sm:"0.5rem",md:"0.625rem",lg:"0.75rem",xl:"0.875rem"};export const Stack=/*@__PURE__*/e.forwardRef(function(c,d){const{direction:f="horizontal",overlap:p,drop:g,size:u="md",max:h,total:x,overflow:v,front:y="first",scaleStep:S=1,opacityStep:j=1,ring:$=!1,transition:k,stagger:z=0,durationStep:M=0,reverse:N=!1,className:b,style:w,children:B,...I}=o(c,["size"]),A=e.Children.toArray(B),C=void 0===h?A:A.slice(0,Math.max(0,h)),R=Math.max(0,(x??A.length)-C.length),q=R>0?v?.(R):null,D=null==q?C:[...C,q],E=n(p??m[u]),F=n(g??p??m[u]),G="vertical"===f,H="diagonal"===f,J=i(k),K=J?`${r} ${a[J.effect]}`:"";return t("div",{ref:d,className:s("isolate inline-flex",G?"flex-col items-start":"items-start",$?"[&>*>*>*]:ring-2 [&>*>*>*]:ring-(--neba-surface)":"",b??""),style:w,...I,children:D.map((e,r)=>{const a=N?D.length-1-r:r,i=J?l({...J.slots,delay:J.slots.delay+a*z,duration:Math.max(0,J.slots.duration+a*M)}):void 0;return t("span",{"data-neba-stack-item":"",className:K||void 0,style:{...i,...0===r?null:G?{marginBlockStart:`calc(${E} * -1)`}:{marginInlineStart:`calc(${E} * -1)`},...H?{marginBlockStart:`calc(${F} * ${r})`}:null,zIndex:"first"===y?D.length-r:r+1},children:t("span",{style:{display:"inline-flex",scale:1===S?void 0:String(S**r),opacity:1===j?void 0:j**r},children:e})},r)})})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Stack.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./Stack.js";
|
|
@@ -12,10 +12,15 @@ export interface StatisticProps extends Omit<BoxProps, 'title' | 'prefix'> {
|
|
|
12
12
|
*/
|
|
13
13
|
label?: React.ReactNode;
|
|
14
14
|
/**
|
|
15
|
-
* The figure. A number is formatted;
|
|
16
|
-
* the values that are not numbers at all
|
|
15
|
+
* The figure. A number is formatted; anything else is rendered exactly as
|
|
16
|
+
* given — a string, for the values that are not numbers at all ("3h 42m",
|
|
17
|
+
* "A+", "—"), or a node for the ones that have to do something on the way in,
|
|
18
|
+
* which is what an [AnimateCounter](../transitions/animate-counter) is.
|
|
19
|
+
*
|
|
20
|
+
* `delta` and `previous` are arithmetic and so only mean anything against a
|
|
21
|
+
* number; with anything else there is nothing to compare.
|
|
17
22
|
*/
|
|
18
|
-
value:
|
|
23
|
+
value: React.ReactNode;
|
|
19
24
|
/**
|
|
20
25
|
* How to write a numeric `value` — `Intl.NumberFormat` options, the same prop
|
|
21
26
|
* the progress indicators take. Without it a number is grouped by the reader's
|
|
@@ -2,6 +2,17 @@ import * as React from 'react';
|
|
|
2
2
|
import type { NebaOrientation, NebaStyleProps, NebaVariant } from '../../types.js';
|
|
3
3
|
/** A tab's value. The same restraint Select puts on its own — an identifier. */
|
|
4
4
|
export type TabValue = string | number;
|
|
5
|
+
/**
|
|
6
|
+
* What a bar with more tabs than room does about it.
|
|
7
|
+
*
|
|
8
|
+
* - `scroll` — stays one line and scrolls along it. The default: a tab bar is a
|
|
9
|
+
* row, and the indicator has one place to be. The ends fade while there is
|
|
10
|
+
* more bar in that direction, which is the only cue there is — the scrollbar
|
|
11
|
+
* is hidden, and on macOS it would have been invisible anyway.
|
|
12
|
+
* - `wrap` — takes as many lines as it needs, and the indicator rides the line
|
|
13
|
+
* its tab is on. For a bar whose tabs all have to be visible at once.
|
|
14
|
+
*/
|
|
15
|
+
export type TabsOverflow = 'scroll' | 'wrap';
|
|
5
16
|
export interface TabsProps extends Omit<NebaStyleProps, 'variant'>, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'defaultValue' | 'onChange'> {
|
|
6
17
|
/**
|
|
7
18
|
* Weight of the tab *bar*, not of the panels under it.
|
|
@@ -41,6 +52,23 @@ export interface TabsProps extends Omit<NebaStyleProps, 'variant'>, Omit<React.C
|
|
|
41
52
|
* @default true
|
|
42
53
|
*/
|
|
43
54
|
loopFocus?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* What the bar does when there are more tabs than there is room for.
|
|
57
|
+
* @default 'scroll'
|
|
58
|
+
*/
|
|
59
|
+
overflow?: TabsOverflow;
|
|
60
|
+
/**
|
|
61
|
+
* The most tab-rows tall the bar may be, which is a cap and not a target — a
|
|
62
|
+
* bar that fits on one line stays on one line.
|
|
63
|
+
*
|
|
64
|
+
* On a horizontal bar those rows are the lines it wraps onto; on a vertical
|
|
65
|
+
* one they are the tabs in a column before it starts another. Past the cap the
|
|
66
|
+
* bar scrolls in the direction it ran out of room in.
|
|
67
|
+
*
|
|
68
|
+
* Only read when `overflow` is `wrap`, since a `scroll` bar is one row by
|
|
69
|
+
* definition. Left out, a wrapping bar takes every line it needs.
|
|
70
|
+
*/
|
|
71
|
+
lines?: number;
|
|
44
72
|
/** The tabs share the bar's full width, each taking an equal share of it. */
|
|
45
73
|
fullWidth?: boolean;
|
|
46
74
|
children?: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{Tabs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{Tabs as o}from"@base-ui/react/tabs";import{controlHeightClasses as l,controlHeightValues as i,controlTextClasses as n,cx as r,gapClasses as s,hasContent as c,iconClasses as d,paddingXClasses as u,radiusClasses as f,surfaceClasses as b,surfaceSlots as h,transitionClasses as v}from"../../internal/styles.js";import{observeResize as p}from"../../internal/observe.js";const x=/*@__PURE__*/a.createContext({variant:"outline",size:"md",density:"default",orientation:"horizontal",fullWidth:!1}),m={solid:{horizontal:`${b} inline-flex bg-(--n-panel) p-1 [box-shadow:var(--neba-plate-glass)]`,vertical:`${b} inline-flex flex-col bg-(--n-panel) p-1 [box-shadow:var(--neba-plate-glass)]`},outline:{horizontal:"flex border-b [border-color:var(--n-line)]",vertical:"flex flex-col border-e [border-color:var(--n-line)]"},text:{horizontal:"flex",vertical:"flex flex-col"}},g={solid:{horizontal:"absolute left-(--active-tab-left) top-(--active-tab-top) h-(--active-tab-height) w-(--active-tab-width)",vertical:"absolute left-(--active-tab-left) top-(--active-tab-top) h-(--active-tab-height) w-(--active-tab-width)"},outline:{horizontal:"absolute bottom-0 left-(--active-tab-left) h-0.5 w-(--active-tab-width)",vertical:"absolute end-0 top-(--active-tab-top) h-(--active-tab-height) w-0.5"},text:{horizontal:"absolute bottom-0 left-(--active-tab-left) h-0.5 w-(--active-tab-width)",vertical:"absolute end-0 top-(--active-tab-top) h-(--active-tab-height) w-0.5"}},w={horizontal:"absolute left-(--active-tab-left) top-(--active-tab-top) h-(--active-tab-height) w-(--active-tab-width) border-b-2 [border-color:var(--n-accent)] !bg-transparent",vertical:"absolute left-(--active-tab-left) top-(--active-tab-top) h-(--active-tab-height) w-(--active-tab-width) border-e-2 [border-color:var(--n-accent)] !bg-transparent"},y={solid:`${b} bg-(--n-panel-press) [box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]`,outline:"bg-(--n-accent)",text:"bg-(--n-accent)"},z={solid:"text-(--neba-muted-fg) hover:text-(--neba-fg) data-[active]:text-(--n-accent)",outline:"text-(--neba-muted-fg) hover:text-(--neba-fg) data-[active]:text-(--n-accent)",text:"text-(--neba-muted-fg) hover:text-(--neba-fg) data-[active]:text-(--n-accent)"};export const Tab=/*@__PURE__*/a.forwardRef(function({value:i,startIcon:b,endIcon:h,disabled:p=!1,className:m,children:g,...w},y){const{variant:N,size:$,density:j,fullWidth:k}=a.useContext(x);return t(o.Tab,{ref:y,value:i,disabled:p,className:r("relative z-10 inline-flex shrink-0 cursor-pointer items-center justify-center select-none","whitespace-nowrap font-medium","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",l[$],n[$],s[$],u[j][$],"solid"===N?f[$]:"",v,d,z[N],"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]","data-[disabled]:cursor-not-allowed data-[disabled]:text-(--neba-disabled-fg)",k?"flex-1":"",m??""),...w,children:[c(b)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:b}):null,g,c(h)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:h}):null]})});export const TabPanel=/*@__PURE__*/a.forwardRef(function({value:t,keepMounted:l=!1,className:i,children:n,...r},s){const{size:c}=a.useContext(x);return e(o.Panel,{ref:s,value:t,keepMounted:l,className:["min-w-0 flex-1 text-(--neba-fg)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2","data-[starting-style]:opacity-0","[transition:opacity_var(--neba-duration)_var(--neba-ease)]",f[c],i??""].filter(Boolean).join(" "),...r,children:n})});export const Tabs=/*@__PURE__*/a.forwardRef(function({variant:l="outline",size:n="md",color:s="primary",density:c="default",value:d,defaultValue:u,onValueChange:b,orientation:v="horizontal",activateOnFocus:z=!1,loopFocus:N=!0,overflow:$="scroll",lines:j,fullWidth:k=!1,className:T,style:C,children:M,...R},W){const _="horizontal"===v,E="wrap"===$,V=a.useRef(null),A=a.useRef(null),F=a.useMemo(()=>({variant:l,size:n,density:c,orientation:v,fullWidth:k}),[l,n,c,v,k]),L=[],P=[];a.Children.forEach(M,e=>{a.isValidElement(e)&&e.type===TabPanel?P.push(e):null!=e&&!1!==e&&L.push(e)});const H=L.length;return a.useEffect(()=>{const e=A.current,t=V.current;if(!e||!t)return;const a=()=>{const a=Math.abs(_?e.scrollLeft:e.scrollTop),o=_?e.clientWidth:e.clientHeight,l=_?e.scrollWidth:e.scrollHeight,i=_?"x":"y",n=_?"y":"x";t.toggleAttribute(`data-overflow-${i}-start`,a>1),t.toggleAttribute(`data-overflow-${i}-end`,l-o-a>1),t.removeAttribute(`data-overflow-${n}-start`),t.removeAttribute(`data-overflow-${n}-end`)};a(),e.addEventListener("scroll",a,{passive:!0});const o=p(e,a);return()=>{e.removeEventListener("scroll",a),o()}},[_,H]),e(x.Provider,{value:F,children:t(o.Root,{ref:e=>{V.current=e,"function"==typeof W?W(e):W&&(W.current=e)},value:d,defaultValue:u,onValueChange:e=>b?.(e),orientation:v,className:r("flex min-w-0","vertical"===v?"flex-row gap-4":"flex-col gap-4",T??""),style:{...h(s,0),...C},...R,children:[t(o.List,{ref:A,activateOnFocus:z,loopFocus:N,className:r("relative shrink-0",m[l][v],"solid"===l?f[n]:"",k&&"horizontal"===v?"w-full":"",E?"flex-wrap":_?"overflow-x-auto":"",E&&void 0!==j?_?"overflow-y-auto":"overflow-x-auto":"",!E&&_?"overflow-y-hidden":"","[scrollbar-width:none] [&::-webkit-scrollbar]:hidden","neba-scroll-fade"),style:{"--n-fade":"2rem",maxHeight:E&&void 0!==j?`calc(${i[n]} * ${Math.max(1,Math.round(j))}${"solid"===l?" + 0.5rem":""})`:void 0},children:[L,e(o.Indicator,{className:["pointer-events-none",E&&"solid"!==l?w[v]:g[l][v],y[l],"solid"===l?f[n]:"rounded-full","[transition-property:left,top,width,height]","[transition-duration:var(--neba-duration)]","[transition-timing-function:var(--neba-ease)]"].join(" ")})]}),P]})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as t from"react";import{CartesianChart as o}from"../../internal/chart-frame.js";import{barBandRatio as
|
|
1
|
+
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as t from"react";import{CartesianChart as o,markTransitionClasses as r}from"../../internal/chart-frame.js";import{barBandRatio as a,barMaxThickness as s,barRadius as l,formatTimeTicks as i,formatTimeValue as c,markGap as m,resolveColor as d,seriesColor as u,timeScale as h,toNumber as f}from"../../internal/chart.js";import{srOnlyClasses as x}from"../../internal/styles.js";import{useStyleDefaults as p}from"../../internal/defaults.js";export function TimelineChart(n){const{series:r,min:l,max:d,barSize:x,rounded:k=!0,size:g="md",density:v="default",xAxis:j,yAxis:$,locale:C,...z}=p(n,["size","density","locale"]),w=t.useMemo(()=>r.map(M),[r]),A=t.useMemo(()=>w.map(e=>e.spans),[w]),E=t.useMemo(()=>{let e=1/0,n=-1/0,t=!1;for(const o of A)for(const r of o)r&&(t=!0,e=Math.min(e,r.from),n=Math.max(n,r.to));return t?{min:e,max:n}:null},[A]),P=t.useMemo(()=>h(E,{min:f(l)??void 0,max:f(d)??void 0,tickCount:$?.tickCount}),[E,l,d,$?.tickCount]),B=t.useMemo(()=>i(P.ticks,P.unit,C),[P,C]),I=t.useMemo(()=>r.map((e,n)=>u(e,n)),[r]),N=t.useMemo(()=>[{data:A.map(e=>e.some(Boolean)?1:null)}],[A]),T=t.useMemo(()=>r.map((e,n)=>e.name??`${n+1}`),[r]),F=x??s[g],R=t.useCallback(e=>{const n=[];return w.forEach((t,o)=>{const r=Math.min(F,Math.max(1,(e.band.band-m*(t.lanes-1))/t.lanes)),a=r*t.lanes+m*(t.lanes-1),s=e.plot.top+e.categoryPx(o)-a/2+r/2;t.spans.forEach((t,a)=>{if(!t)return;const l=e.valuePx(t.from),i=e.valuePx(t.to);n.push({series:o,index:a,x:(l+i)/2,y:s+t.lane*(r+m),r:r/2,rx:Math.max(0,(i-l)/2),ry:r/2})})}),n},[w,F]),S=t.useCallback(e=>{const n=A[e.series]?.[e.index];if(!n)return null;const t=[{seriesIndex:e.series,name:T[e.series],color:n.color??I[e.series],value:n.to-n.from,formatted:`${c(n.from,P.unit,C)} – ${c(n.to,P.unit,C)}`}];return{heading:n.span.label??T[e.series],items:t}},[A,T,I,P.unit,C]);return e(o,{...z,series:N,categories:T,size:g,density:v,locale:C,horizontal:!0,scale:P,xAxis:j,yAxis:{tickFormat:(e,n)=>B[n]??"",...$},legend:!1,bandRatio:a[v],marks:R,markTooltip:S,table:n=>e(y,{id:n,names:T,series:r,spans:A,unit:P.unit,label:z.label,corner:j?.label,locale:C}),children:n=>e(b,{context:n,spans:A,colors:I,rounded:k})})}function M(e){const n=e.data.map(e=>{const n=f(e.start),t=f(e.end);return null===n||null===t?null:{from:Math.min(n,t),to:Math.max(n,t),lane:0,color:e.color?d(e.color):void 0,span:e}}),t=[];return n.map((e,n)=>({one:e,index:n})).filter(e=>Boolean(e.one)).sort((e,n)=>e.one.from-n.one.from).forEach(({one:e})=>{const n=t.findIndex(n=>n<=e.from),o=-1===n?t.length:n;t[o]=e.to,e.lane=o}),{spans:n,lanes:Math.max(1,t.length)}}function b({context:n,spans:t,colors:o,rounded:a}){const{marks:s,activeMark:i,plot:c}=n,m=a?l:0;return e("g",{children:s.map(n=>{const a=t[n.series]?.[n.index];if(!a)return null;const s=i?.series===n.series&&i?.index===n.index,l=n.rx??n.r,d=2*(n.ry??n.r),u=Math.max(c.left,n.x-l),h=Math.min(c.left+c.width,n.x+l);if(h<c.left||u>c.left+c.width)return null;const f=Math.max(1,h-u);return e("rect",{x:u,y:n.y-d/2,width:f,height:d,rx:Math.min(m,f/2,d/2),fill:a.color??o[n.series],opacity:s?1:.92,className:r},`${n.series}-${n.index}`)})})}function y({id:t,names:o,series:r,spans:a,unit:s,label:l,corner:i,locale:m}){const d=r.some(e=>e.data.some(e=>void 0!==e.label));return n("table",{id:t,className:x,children:[l?e("caption",{children:l}):null,e("thead",{children:n("tr",{children:[e("th",{scope:"col",children:i??""}),d?e("th",{scope:"col",children:"label"}):null,e("th",{scope:"col",children:"start"}),e("th",{scope:"col",children:"end"})]})}),e("tbody",{children:a.flatMap((t,a)=>t.map((t,l)=>n("tr",{children:[e("th",{scope:"row",children:o[a]}),d?e("td",{children:r[a].data[l]?.label??""}):null,e("td",{children:t?c(t.from,s,m):""}),e("td",{children:t?c(t.to,s,m):""})]},`${a}-${l}`)))})]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{Toast as s}from"@base-ui/react/toast";import{boxPaddingClasses as i}from"../box/Box.js";import{actionMessages as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{Toast as s}from"@base-ui/react/toast";import{boxPaddingClasses as i}from"../box/Box.js";import{actionMessages as n,useMessages as a}from"../../internal/i18n.js";import{CloseIcon as r,severityIcon as l}from"../../internal/icons.js";import{controlSlots as c,cx as d,focusRingClasses as m,hasContent as u,iconClasses as p,metaTextClasses as f,popupFadeClasses as b,radiusClasses as x,sheetBodyClasses as v,sheetHeaderGapClasses as h,sheetSectionGapClasses as w,sheetTitleClasses as g,surfaceClasses as y}from"../../internal/styles.js";import{useStyleDefaults as N}from"../../internal/defaults.js";const j={"top-start":"top-0 items-start","top-center":"top-0 items-center","top-end":"top-0 items-end","bottom-start":"bottom-0 items-start flex-col-reverse","bottom-center":"bottom-0 items-center flex-col-reverse","bottom-end":"bottom-0 items-end flex-col-reverse"},z={solid:[y,"text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--neba-shadow-3),var(--neba-plate-solid)]"].join(" "),outline:[y,"border text-(--neba-fg) bg-(--n-panel-press)","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]"].join(" "),text:[y,"text-(--neba-fg) bg-(--n-panel-press)","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]"].join(" ")},T={solid:"",outline:"text-(--n-accent)",text:"text-(--n-accent)"};function _(e){const{color:t,variant:o,icon:s,actionLabel:i,onAction:n,...a}=e;return{...a,data:{color:t,variant:o,icon:s},actionProps:void 0===i?void 0:{children:i,onClick:n}}}export function useToast(){const e=s.useToastManager();return o.useMemo(()=>({add:t=>e.add(_(t)),close:t=>e.close(t),update:(t,o)=>e.update(t,_(o)),promise:(t,o)=>e.promise(t,{loading:_(o.loading),success:e=>_("function"==typeof o.success?o.success(e):o.success),error:e=>_("function"==typeof o.error?o.error(e):o.error)}),toasts:e.toasts}),[e])}function k({toast:o,variant:n,color:a,size:y,density:N,closeLabel:j,swipeDirection:_,classNames:k}){const D=o.data?.variant??n??"outline",L=o.data?.color??a,M=void 0===o.data?.icon?l(L):o.data.icon,P=T[D],$=u(o.title);return t(s.Root,{toast:o,swipeDirection:_,className:d("pointer-events-auto flex w-full items-start",i[N??"default"][y],x[y],w[y],v[y],z[D],p,b,"data-[limited]:hidden",m,"[outline:none]",k?.toast),style:c(L,3,D),children:[u(M)?e("span",{className:`flex h-[1lh] shrink-0 items-center ${P}`,children:M}):null,t("div",{className:`flex min-w-0 flex-1 flex-col ${h[y]}`,children:[e(s.Title,{className:d("neba-title font-semibold",g[y],P,k?.title)}),e(s.Description,{className:d($&&"solid"!==D?"text-(--neba-muted-fg)":"",k?.description)})]}),e(s.Action,{className:d("flex h-[1lh] shrink-0 cursor-pointer items-center rounded-full px-2","font-medium underline-offset-2",P||"text-(--n-on-solid)","hover:underline","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2",f[y],k?.action)}),e("span",{className:"flex h-[1lh] shrink-0 items-center",children:e(s.Close,{"aria-label":j,className:d("inline-flex size-[1.15em] cursor-pointer items-center justify-center rounded-full","opacity-70 [transition:opacity_var(--neba-duration)_var(--neba-ease)]","hover:opacity-100 focus-visible:opacity-100","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2",k?.close),children:e(r,{})})})]})}function D(t){const{toasts:i}=s.useToastManager(),{position:n,width:a,classNames:r,...l}=t,c=o.useMemo(()=>[n.startsWith("top")?"up":"down","left","right"],[n]);return e(s.Portal,{children:e(s.Viewport,{className:d("neba-portal pointer-events-none fixed inset-x-0 z-50 flex flex-col gap-2 p-4",j[n],r?.viewport),children:i.map(t=>e("div",{className:"w-full",style:{maxWidth:"number"==typeof a?`${a}px`:a},children:e(k,{toast:t,swipeDirection:c,classNames:r,...l})},t.id))})})}export function ToastProvider(o){const{variant:i="outline",size:r="md",color:l="primary",density:c="default",position:d="bottom-end",timeout:m=5e3,limit:u=3,width:p=380,locale:f,closeLabel:b,classNames:x,children:v}=N(o,["size","density","variant","locale"]),h=a(n,f);return t(s.Provider,{timeout:m,limit:u,children:[v,e(D,{position:d,variant:i,size:r,color:l,density:c,width:p,closeLabel:b??h.close,classNames:x})]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsxs as e}from"react/jsx-runtime";import*as t from"react";import{Toggle as n}from"@base-ui/react/toggle";import{ButtonGroupContext as o}from"../../internal/button-group.js";import{controlHeightClasses as
|
|
1
|
+
"use client";import{jsxs as e}from"react/jsx-runtime";import*as t from"react";import{Toggle as n}from"@base-ui/react/toggle";import{ButtonGroupContext as o}from"../../internal/button-group.js";import{controlHeightClasses as s,controlSlots as r,controlSquareClasses as a,controlTextClasses as l,cx as i,disabledClasses as d,focusRingClasses as b,gapClasses as v,iconClasses as g,paddingXClasses as p,pressTransitionClasses as x,radiusClasses as m,surfaceClasses as f,transitionClasses as c}from"../../internal/styles.js";import{useStyleDefaults as h}from"../../internal/defaults.js";const u={xs:`${s.xs} ${v.xs} ${m.xs} ${l.xs}`,sm:`${s.sm} ${v.sm} ${m.sm} ${l.sm}`,md:`${s.md} ${v.md} ${m.md} ${l.md}`,lg:`${s.lg} ${v.lg} ${m.lg} ${l.lg}`,xl:`${s.xl} ${v.xl} ${m.xl} ${l.xl}`},$={xs:`${a.xs} px-0`,sm:`${a.sm} px-0`,md:`${a.md} px-0`,lg:`${a.lg} px-0`,xl:`${a.xl} px-0`},j=["relative inline-flex shrink-0 cursor-pointer select-none items-center justify-center","whitespace-nowrap align-middle font-medium leading-none","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",c,x,b,g].join(" "),y={solid:[f,"text-(--neba-muted-fg) bg-(--neba-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]","hover:bg-(--neba-panel-press) hover:text-(--neba-fg)","active:bg-(--neba-panel-press)"].join(" "),outline:[f,"border text-(--neba-muted-fg) bg-(--neba-panel)","[border-color:var(--neba-border)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]","hover:bg-(--neba-panel-hover) hover:text-(--neba-fg)","active:bg-(--neba-panel-press)"].join(" "),text:["text-(--neba-muted-fg) bg-transparent","hover:bg-(--n-soft) hover:text-(--neba-fg)","active:bg-(--n-soft-hover)"].join(" ")},w={solid:[f,"text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]","hover:bg-(--n-fill-hover)","active:bg-(--n-fill-active)"].join(" "),outline:[f,"border text-(--n-accent) bg-(--n-panel-press)","[border-color:var(--n-line-hover)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]","hover:bg-(--n-soft-hover)","active:bg-(--n-soft-press)"].join(" "),text:["text-(--n-accent) bg-(--n-soft-hover)","hover:bg-(--n-soft-press)","active:bg-(--n-soft-press)"].join(" ")};export const Toggle=/*@__PURE__*/t.forwardRef(function(s,a){const{variant:l,size:b,color:v,density:g,elevation:x,pressed:m,defaultPressed:f,onPressedChange:c,value:P,startIcon:z,endIcon:C,fullWidth:T=!1,disabled:k,className:E,style:I,children:M,onPointerMove:N,...R}=h(s,["size","density","variant"]),W=t.useContext(o),X=l??W?.variant??"outline",Y=b??W?.size??"md",q=v??W?.color??"primary",A=g??W?.density??"default",B=x??W?.elevation??0,D=k??W?.disabled??!1,F=null==M||!1===M;return e(n,{ref:a,value:P,pressed:m,defaultPressed:f,onPressedChange:e=>c?.(e),disabled:D,className:e=>i(j,u[Y],F?$[Y]:p[A][Y],D?d[X]:e.pressed?w[X]:y[X],D?"":"neba-glow",T?"w-full":"",E??""),style:{...r(q,B,X),...I},onPointerMove:e=>{if(!D){const t=e.currentTarget;t.style.setProperty("--n-mx",`${e.nativeEvent.offsetX}px`),t.style.setProperty("--n-my",`${e.nativeEvent.offsetY}px`)}N?.(e)},...R,children:[z,M,C]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{Tooltip as a}from"@base-ui/react/tooltip";import{controlSlots as i,cx as s,metaTextClasses as l,paddingXClasses as n,popupFadeClasses as r,radiusClasses as d,surfaceClasses as p}from"../../internal/styles.js";import{useStyleDefaults as c}from"../../internal/defaults.js";export const TooltipProvider=a.Provider;const m=[p,"max-w-64 text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--neba-shadow-3),var(--neba-plate-solid)]","[outline:none]",r,"data-[instant]:[transition-duration:0ms]"].join(" "),f={xs:"py-0.5",sm:"py-0.5",md:"py-1",lg:"py-1.5",xl:"py-2"},h={xs:6,sm:7,md:8,lg:9,xl:10};export function Tooltip(r){const{content:p,children:u,size:x="sm",color:y="secondary",density:b="default",side:g="top",align:v="center",sideOffset:j=6,delay:w,closeDelay:O,arrow:N=!0,open:P,defaultOpen:z,onOpenChange:T,disabled:C=!1,className:D,style:k,...A}=c(r,["size","density"]),B=h[x],I=o.useId(),[L,M]=o.useState(z??!1),R=P??L;return t(a.Root,{open:P,defaultOpen:z,onOpenChange:e=>{void 0===P&&M(e),T?.(e)},children:[e(a.Trigger,{render:u,delay:w,closeDelay:O,disabled:C,"aria-describedby":R?I:void 0}),e(a.Portal,{children:e(a.Positioner,{className:"neba-portal z-50 [outline:none]",side:g,align:v,sideOffset:j,children:t(a.Popup,{id:I,role:"tooltip",className:s(m,d[x],n[b][x],f[x],l[x],D??""),style:{...i(y,3,"solid"),...k},...A,children:[N?e(a.Arrow,{className:["data-[side=top]:bottom-[-1px]","data-[side=bottom]:top-[-1px] data-[side=bottom]:rotate-180","data-[side=left]:right-[-1px] data-[side=left]:-rotate-90","data-[side=right]:left-[-1px] data-[side=right]:rotate-90"].join(" "),children:e("svg",{width:B,height:B/2,viewBox:"0 0 10 5","aria-hidden":"true",className:"block",children:e("path",{d:"M0 0h10L5 5z",fill:"var(--n-fill)"})})}):null,p]})})})]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{Popover as s}from"@base-ui/react/popover";import{Button as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{Popover as s}from"@base-ui/react/popover";import{Button as o}from"../button/Button.js";import{boxPaddingXClasses as i,boxPaddingYClasses as r}from"../box/Box.js";import{actionMessages as l,fill as a,stepsMessages as c,useMessages as d}from"../../internal/i18n.js";import{CloseIcon as m}from"../../internal/icons.js";import{observeResize as u}from"../../internal/observe.js";import{cx as p,hasContent as f,metaTextClasses as h,popupFadeClasses as g,radiusClasses as b,sheetBodyClasses as v,sheetHeaderGapClasses as x,sheetSectionGapClasses as w,sheetTitleClasses as N,surfaceClasses as k,surfaceSlots as j}from"../../internal/styles.js";import{useStyleDefaults as y}from"../../internal/defaults.js";const z=[k,"relative flex flex-col","border text-(--neba-fg) bg-(--n-panel-press)","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]","[outline:none]",g].join(" "),_={xs:"max-w-56",sm:"max-w-64",md:"max-w-80",lg:"max-w-96",xl:"max-w-lg"},L={xs:"xs",sm:"xs",md:"sm",lg:"sm",xl:"md"};function S({spot:t,radius:n,className:s}){return e("div",null===t?{"aria-hidden":"true",className:p("pointer-events-none fixed inset-0 z-40 bg-(--neba-scrim)",s)}:{"aria-hidden":"true",className:p("pointer-events-none fixed z-40 [box-shadow:0_0_0_9999px_var(--neba-scrim)]",s),style:{top:t.top,left:t.left,width:t.width,height:t.height,borderRadius:n}})}export function Tour(g){const{steps:k,open:C,defaultOpen:E=!1,onOpenChange:P,step:O,defaultStep:q=0,onStepChange:B,onFinish:F,mask:M=!0,skippable:R=!0,dismissible:T=!0,scrollIntoView:A=!0,locale:I,previousLabel:V,nextLabel:$,doneLabel:D,skipLabel:H,size:G="md",color:J="primary",density:K="default",className:Q,classNames:U}=y(g,["size","density","locale"]),W=d(c,I),X=d(l,I),[Y,Z]=n.useState(E),[ee,te]=n.useState(q),ne=C??Y,se=Math.min(O??ee,Math.max(0,k.length-1)),oe=k[se],[ie,re]=n.useState(null),le=e=>{void 0===C&&Z(e),P?.(e)},ae=e=>{void 0===O&&te(e),B?.(e)};if(n.useEffect(()=>{const e=oe?.target;if(!ne||!e)return;const t=document.querySelector(e);if(!(t instanceof HTMLElement))return;A&&t.scrollIntoView({block:"center",inline:"nearest",behavior:"smooth"});const n=oe?.padding??6;let s=0;const o=()=>{s=0;const o=t.getBoundingClientRect();re({selector:e,spot:{top:o.top-n,left:o.left-n,width:o.width+2*n,height:o.height+2*n}})},i=()=>{0===s&&(s=requestAnimationFrame(o))};o();const r=u(t,i);return window.addEventListener("scroll",i,{passive:!0,capture:!0}),window.addEventListener("resize",i,{passive:!0}),()=>{0!==s&&cancelAnimationFrame(s),r(),window.removeEventListener("scroll",i,!0),window.removeEventListener("resize",i)}},[ne,oe?.target,oe?.padding,A]),0===k.length)return null;const ce=ne&&oe?.target&&ie?.selector===oe.target?ie.spot:null,de=0===se,me=se===k.length-1,ue=i[K][G],pe=r[K][G],fe=L[G],he=f(oe?.title)||f(oe?.content);return t(s.Root,{open:ne,onOpenChange:(e,t)=>{(e||T||"escape-key"!==t.reason)&&(e||"outside-press"!==t.reason&&"focus-out"!==t.reason)?le(e):t.cancel()},children:[ne&&M?e(S,{spot:ce,radius:ce?8:0,className:U?.mask}):null,e(s.Portal,{children:e(s.Positioner,{className:"neba-portal z-50 [outline:none]",side:oe?.side??"bottom",align:oe?.align??"center",sideOffset:10,collisionPadding:12,anchor:()=>{if(!oe?.target)return null;const e=document.querySelector(oe.target);return e instanceof Element?e:null},children:t(s.Popup,{className:p(z,b[G],v[G],w[G],_[G],ue,pe,Q),style:j(J,3),children:[he?t("div",{className:"flex items-start gap-3",children:[t("div",{className:`flex min-w-0 flex-1 flex-col ${x[G]}`,children:[f(oe?.title)?e(s.Title,{className:p("m-0 font-semibold",N[G],U?.title),children:oe?.title}):null,f(oe?.content)?e(s.Description,{className:p("m-0 min-w-0",U?.description),children:oe?.content}):null]}),T?e("button",{type:"button","aria-label":X.close,onClick:()=>le(!1),className:p("flex size-[1.6em] shrink-0 cursor-pointer items-center justify-center","rounded-full text-(--neba-muted-fg)","[&_svg]:size-[1.1em] [&_svg]:shrink-0","[transition:background-color_var(--neba-duration)_var(--neba-ease),color_var(--neba-duration)_var(--neba-ease)]","hover:bg-(--n-soft) hover:text-(--neba-fg)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2",U?.close),children:e(m,{})}):null]}):null,t("div",{className:p("flex items-center gap-2",U?.footer),children:[e("span",{className:`shrink-0 tabular-nums text-(--neba-muted-fg) ${h[G]}`,children:a(W.position,{index:String(se+1),total:String(k.length)})}),t("div",{className:"ms-auto flex items-center gap-2",children:[R&&!me?e(o,{size:fe,variant:"text",color:"secondary",onClick:()=>le(!1),children:H??W.skip}):null,de?null:e(o,{size:fe,variant:"outline",color:J,onClick:()=>ae(se-1),children:V??W.previous}),e(o,{size:fe,color:J,onClick:()=>me?(F?.(),void le(!1)):ae(se+1),children:me?D??W.done:$??W.next})]})]})]})})})]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{Checkbox as t}from"../checkbox/Checkbox.js";import{IconButton as s}from"../icon-button/IconButton.js";import{ScrollArea as r}from"../scroll-area/ScrollArea.js";import{TextField as i}from"../text-field/TextField.js";import{transferMessages as n,useMessages as o}from"../../internal/i18n.js";import{ArrowRightIcon as c}from"../../internal/icons.js";import{searchText as d}from"../../internal/search.js";import{cx as m,fieldRestClasses as h,hasContent as u,metaTextClasses as f,paddingXClasses as b,radiusClasses as p,surfaceSlots as v,toLength as g}from"../../internal/styles.js";import{useStyleDefaults as x}from"../../internal/defaults.js";const y={xs:"py-1",sm:"py-1.5",md:"py-2",lg:"py-2.5",xl:"py-3"},k={xs:"py-0.5",sm:"py-1",md:"py-1",lg:"py-1.5",xl:"py-2"};function S({title:l,rows:s,arrived:n,ticked:o,onTick:c,onTickAll:d,search:u,onSearch:g,searchable:x,disabled:S,height:w,emptyMessage:j,searchLabel:N,selectAllLabel:z,style:$}){const{size:A,variant:C="outline",color:T="primary",density:L="default"}=$,M=s.filter(e=>!e.disabled),_=M.filter(e=>o.has(e.value)),V=M.length>0&&_.length===M.length,B=_.length>0&&!V,F=b[L][A];return a("div",{className:["flex min-w-0 flex-col overflow-hidden",h[C],p[A]].join(" "),style:v(T,0),children:[a("div",{className:`flex items-center gap-2 border-b [border-color:var(--neba-border)] ${F} ${y[A]}`,children:[e(t,{size:A,color:T,checked:V,indeterminate:B,disabled:S||0===M.length,"aria-label":z,onCheckedChange:e=>d(!0===e)}),e("span",{className:`min-w-0 flex-1 truncate font-medium ${f[A]}`,children:l}),a("span",{className:`shrink-0 tabular-nums text-(--neba-muted-fg) ${f[A]}`,children:[_.length,"/",s.length]})]}),x?e("div",{className:`${F} ${y[A]}`,children:e(i,{size:A,color:T,density:L,fullWidth:!0,variant:"text",disabled:S,placeholder:N,"aria-label":N,value:u,onChange:e=>g(e.target.value)})}):null,e(r,{size:A,color:T,height:w,fade:!0,children:e("div",{className:`flex flex-col ${F} ${y[A]}`,children:0===s.length?e("span",{className:`text-(--neba-muted-fg) ${f[A]} ${k[A]}`,children:j}):s.map(a=>e(t,{size:A,color:T,className:m(k[A],n.has(a.value)?"[animation:neba-anim-fade_var(--neba-duration-fill)_var(--neba-ease)_both]":""),label:a.label,checked:o.has(a.value),disabled:S||a.disabled,onCheckedChange:e=>c(a.value,!0===e)},a.value))})})]})}function w(e,a){const l=d(a);return""===l?e:e.filter(e=>"string"!=typeof e.label||d(e.label).includes(l))}export const Transfer=/*@__PURE__*/l.forwardRef(function(t,r){const{items:i,value:d,defaultValue:h,onValueChange:f,sourceLabel:b,targetLabel:p,searchable:v=!1,height:y=220,disabled:k=!1,locale:j,variant:N="outline",size:z="md",color:$="primary",density:A="default",className:C,...T}=x(t,["size","density","variant","locale"]),L=o(n,j),[M,_]=l.useState(h??[]),V=d??M,[B,F]=l.useState(()=>new Set),[I,R]=l.useState(()=>new Set),[W,q]=l.useState(""),[D,E]=l.useState(""),G=l.useMemo(()=>new Set(V),[V]),H=l.useMemo(()=>i.filter(e=>!G.has(e.value)),[i,G]),J=l.useMemo(()=>i.filter(e=>G.has(e.value)),[i,G]),K=(e,a)=>{F(l=>{const t=new Set(l);return a?t.add(e):t.delete(e),t})},O=(e,a)=>{F(l=>{const t=new Set(l);for(const l of e)l.disabled||(a?t.add(l.value):t.delete(l.value));return t})},P=(e,a)=>{const l=e.filter(e=>!e.disabled&&B.has(e.value));if(0===l.length)return;const t=new Set(l.map(e=>e.value)),s=a?i.filter(e=>G.has(e.value)||t.has(e.value)).map(e=>e.value):V.filter(e=>!t.has(e));F(e=>new Set([...e].filter(e=>!t.has(e)))),R(t),(e=>{void 0===d&&_(e),f?.(e)})(s)},Q=w(H,W),U=w(J,D),X=Q.some(e=>!e.disabled&&B.has(e.value)),Y=U.some(e=>!e.disabled&&B.has(e.value)),Z=g(y),ee={variant:N,size:z,color:$,density:A};return a("div",{ref:r,className:m("grid w-full items-center gap-3","[grid-template-columns:minmax(0,1fr)_auto_minmax(0,1fr)]",C??""),...T,children:[e(S,{title:u(b)?b:L.source,rows:Q,arrived:I,ticked:B,onTick:K,onTickAll:e=>O(Q,e),search:W,onSearch:q,searchable:v,disabled:k,height:Z,emptyMessage:L.empty,searchLabel:L.search,selectAllLabel:L.selectAll,style:ee}),a("div",{className:"flex flex-col gap-2",children:[e(s,{size:z,color:$,variant:"text"===N?"text":"outline",label:L.toTarget,disabled:k||!X,onClick:()=>P(Q,!0),icon:e(c,{})}),e(s,{size:z,color:$,variant:"text"===N?"text":"outline",label:L.toSource,disabled:k||!Y,onClick:()=>P(U,!1),icon:e("span",{className:"flex rotate-180",children:e(c,{})})})]}),e(S,{title:u(p)?p:L.target,rows:U,arrived:I,ticked:B,onTick:K,onTickAll:e=>O(U,e),search:D,onSearch:E,searchable:v,disabled:k,height:Z,emptyMessage:L.empty,searchLabel:L.search,selectAllLabel:L.selectAll,style:ee})]})});
|
|
@@ -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";import{useStyleDefaults as p}from"../../internal/defaults.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 g=/*@__PURE__*/n.createContext({size:"md",density:"default",disabled:!1,expandedKeys:new Set,selectedKeys:new Set,activeKey:null,toggle:()=>{},select:()=>{},activate:()=>{},register:()=>()=>{}}),x=/*@__PURE__*/n.createContext(!1),b={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"},v={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"},w={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]"},k={none:"",simple:"neba-tree-simple",folder:"neba-tree-folder"};function C(e){return Array.from(e.querySelectorAll('[role="treeitem"]')).filter(e=>null===e.closest("[data-closing]"))}const N=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:x,defaultExpanded:w,onExpandedChange:y,selected:S,defaultSelected:A,onSelectedChange:j,multiple:K=!1,disabled:D=!1,label:E,className:R,style:P,children:I,onKeyDown:_,...z}=p(t,["size","density","variant"]),[F,M]=n.useState(w??[]),[T,V]=n.useState(A??[]),[q,L]=n.useState(null),H=x??F,O=S??T,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=N(e),r=x??F,n=r.some(e=>N(e)===t)?r.filter(e=>N(e)!==t):[...r,e];void 0===x&&M(n),y?.(n)},[x,F,y]),J=n.useCallback(e=>{const t=N(e),r=S??T,n=r.some(e=>N(e)===t),a=K?n?r.filter(e=>N(e)!==t):[...r,e]:[e];void 0===S&&V(a),j?.(a)},[K,S,T,j]),Q=n.useRef(new Map),W=n.useCallback((e,t)=>(Q.current.set(e,t),()=>{Q.current.delete(e)}),[]),X=n.useMemo(()=>H.map(N).join("\0"),[H]),Y=n.useMemo(()=>O.map(N).join("\0"),[O]),Z=n.useMemo(()=>({size:l,density:i,disabled:D,expandedKeys:new Set(H.map(N)),selectedKeys:new Set(O.map(N)),activeKey:q,toggle:G,select:J,activate:L,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=C(e);0!==t.length&&L(t[0].dataset.nebaValue??null)});const $=s("flex list-none flex-col p-1",d[l],b[a],f,k[u],R);return e(g.Provider,{value:Z,children:e("ul",{ref:B,role:"tree","aria-label":E,"aria-multiselectable":K||void 0,className:$,style:{...m(o,c),"--n-tree-indent":v[l],"--n-tree-row":h[l],...P},onKeyDown:function(e){if(_?.(e),e.defaultPrevented)return;const t=U.current,r=e.target?.closest?.('[role="treeitem"]');if(!t||!r||!t.contains(r))return;const n=C(t),a=n.indexOf(r);if(-1===a)return;const l=t=>{t&&(e.preventDefault(),L(t.dataset.nebaValue??null),t.focus())},s=e=>{const t=e.dataset.nebaValue;t&&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()}},...z,children:I})})});export const TreeItem=/*@__PURE__*/n.forwardRef(function({value:d,label:u,startIcon:m,endIcon:p,action:b,href:v,expandable:h,disabled:k=!1,className:C,children:S,onClick:A,...j},K){const{size:D,density:E,disabled:R,expandedKeys:P,selectedKeys:I,activeKey:_,toggle:z,select:F,activate:M,register:T}=n.useContext(g),V=n.useId(),q=d??V,L=N(q),H=n.useRef(null),O=n.useCallback(e=>{H.current=e,"function"==typeof K?K(e):K&&(K.current=e)},[K]),U=n.Children.toArray(S),B=h??U.length>0,G=B&&P.has(L),J=I.has(L),Q=k||R,W=n.useRef({toggle:()=>{}});W.current.toggle=()=>{!Q&&B&&z(q)};const X=n.useContext(x);n.useEffect(()=>X?void 0:T(L,W.current),[X,L,T]);const[Y,Z]=n.useState(G),[$,ee]=n.useState(G),te=n.useRef(null);n.useEffect(()=>{if(G){Z(!0);const e=requestAnimationFrame(()=>ee(!0));return()=>cancelAnimationFrame(e)}ee(!1);const e=te.current;(null===e||getComputedStyle(e).transitionDuration.split(",").every(e=>0===parseFloat(e)))&&Z(!1)},[G]);const re=s("flex min-w-0 flex-1 cursor-pointer items-center text-start","h-(--n-tree-row)",w[E][D],y[D],o[D],l[D],f,c,"group-focus-visible/tree-item:[outline:2px_solid_var(--n-ring)]","group-focus-visible/tree-item:outline-offset-[-2px]",Q?"cursor-not-allowed text-(--neba-disabled-fg)":J?"bg-(--n-soft-press) font-medium text-(--n-accent) hover:bg-(--n-soft-press)":"hover:bg-(--n-soft)"),ne=r(t,{children:[e("span",{"aria-hidden":"true",onClick:e=>{!Q&&B&&(e.stopPropagation(),e.preventDefault(),H.current?.focus(),M(L),z(q))},className:s("flex h-[1lh] w-[1.15em] shrink-0 items-center justify-center","[transition:rotate_var(--neba-duration)_var(--neba-ease)]",B?"text-(--neba-muted-fg)":"",G?"rotate-0":"-rotate-90 rtl:rotate-90"),children:B?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:O,role:"treeitem","aria-expanded":B?G:void 0,"aria-selected":!!J||void 0,"aria-disabled":Q||void 0,"data-neba-value":L,tabIndex:_===L?0:-1,className:s("group/tree-item relative block [outline:none]",C),onClick:function(e){e.stopPropagation(),Q?e.preventDefault():(H.current?.focus(),M(L),A?.(e),e.defaultPrevented||(B&&z(q),F(q)))},...j,children:[r("div",{className:"flex w-full items-center",children:[v&&!Q?e("a",{href:v,tabIndex:-1,className:re,"aria-current":J?"page":void 0,children:ne}):e("div",{className:re,children:ne}),i(b)?e("span",{className:s("flex shrink-0 items-center",w[E][D]),onClick:e=>e.stopPropagation(),children:b}):null]}),B&&Y&&U.length>0?e("div",{ref:te,"data-closing":G?void 0:"",className:s("grid [transition:grid-template-rows_var(--neba-duration)_var(--neba-ease)]",$?"[grid-template-rows:1fr]":"[grid-template-rows:0fr] pointer-events-none"),onTransitionEnd:e=>{e.target!==e.currentTarget||"grid-template-rows"!==e.propertyName||G||Z(!1)},children:e("ul",{role:"group",className:"min-h-0 list-none overflow-hidden ps-(--n-tree-indent)",children:e(x.Provider,{value:X||!G,children:S})})}):null]})});
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { useDisclosure } from './useDisclosure.js';
|
|
|
2
2
|
export type { Disclosure } from './useDisclosure.js';
|
|
3
3
|
export { useElementSize } from './useElementSize.js';
|
|
4
4
|
export type { ElementSize } from './useElementSize.js';
|
|
5
|
-
export { useBreakpoint, useMediaQuery } from './useMediaQuery.js';
|
|
5
|
+
export { useBreakpoint, useBreakpointValue, useCurrentBreakpoint, useMediaQuery } from './useMediaQuery.js';
|
|
6
6
|
export { useOnScreen } from './useOnScreen.js';
|
|
7
7
|
export type { OnScreenOptions } from './useOnScreen.js';
|
|
8
8
|
export { useShortcut } from './useShortcut.js';
|
package/dist/hooks/index.js
CHANGED
|
@@ -1 +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";
|
|
1
|
+
export{useDisclosure}from"./useDisclosure.js";export{useElementSize}from"./useElementSize.js";export{useBreakpoint,useBreakpointValue,useCurrentBreakpoint,useMediaQuery}from"./useMediaQuery.js";export{useOnScreen}from"./useOnScreen.js";export{useShortcut}from"./useShortcut.js";export{usePrefersReducedMotion}from"../internal/media.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NebaBreakpoint } from '../types.js';
|
|
1
|
+
import type { NebaBreakpoint, NebaResponsive } from '../types.js';
|
|
2
2
|
/**
|
|
3
3
|
* One media query, as a boolean this component re-renders on.
|
|
4
4
|
*
|
|
@@ -25,3 +25,37 @@ export declare function useMediaQuery(query: string): boolean;
|
|
|
25
25
|
* is the value with no media query around it.
|
|
26
26
|
*/
|
|
27
27
|
export declare function useBreakpoint(breakpoint: NebaBreakpoint): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Which breakpoint the window is currently in — the widest whose floor it has
|
|
30
|
+
* reached.
|
|
31
|
+
*
|
|
32
|
+
* Four subscriptions and not five: `xs` is a floor of zero, so it is where the
|
|
33
|
+
* window is when none of the others match, and there is no query to ask. They
|
|
34
|
+
* are four separate calls rather than a loop because they are hooks; the count
|
|
35
|
+
* is fixed, which is what makes that legal, and each one costs nothing extra —
|
|
36
|
+
* a `MediaQueryList` is shared per query string for the whole page.
|
|
37
|
+
*
|
|
38
|
+
* `xs` on a server, which is the same answer the stylesheet gives before any
|
|
39
|
+
* media query has had a chance to apply.
|
|
40
|
+
*/
|
|
41
|
+
export declare function useCurrentBreakpoint(): NebaBreakpoint;
|
|
42
|
+
/**
|
|
43
|
+
* A responsive prop's own shape, resolved in JavaScript.
|
|
44
|
+
*
|
|
45
|
+
* `useBreakpointValue({ xs: 1, md: 3 })` is `1` under 48rem and `3` from there
|
|
46
|
+
* up, reading the map exactly as the CSS cascade behind `span` and `spacing`
|
|
47
|
+
* reads it: every entry is a floor, so the nearest one at or below the current
|
|
48
|
+
* width wins. That sameness is the point — a component's responsive props and
|
|
49
|
+
* the numbers a caller works out for themselves should not need two mental
|
|
50
|
+
* models, or two ideas of what `{ md: 6 }` says about a phone.
|
|
51
|
+
*
|
|
52
|
+
* A bare value is returned unchanged, and `undefined` means the map has not
|
|
53
|
+
* said anything yet at this width: `{ lg: 4 }` on a phone is the caller
|
|
54
|
+
* declining to have an opinion there, not a failure. Pair it with `??` for a
|
|
55
|
+
* default.
|
|
56
|
+
*
|
|
57
|
+
* It re-renders on a resize, which the CSS form does not — so reach for it when
|
|
58
|
+
* the value is one JavaScript has to see (how many items to fetch, what to pass
|
|
59
|
+
* a chart), and leave layout to the props that resolve in the stylesheet.
|
|
60
|
+
*/
|
|
61
|
+
export declare function useBreakpointValue<T>(value: NebaResponsive<T> | undefined): T | undefined;
|
|
@@ -1 +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))}
|
|
1
|
+
"use client";import{useMediaQuery as e,widthAtLeast as r}from"../internal/media.js";import{valueAt as n}from"../internal/responsive.js";export function useMediaQuery(r){return e(r)}export function useBreakpoint(n){return e(r(n))}export function useCurrentBreakpoint(){const n=e(r("sm")),t=e(r("md")),u=e(r("lg"));return e(r("xl"))?"xl":u?"lg":t?"md":n?"sm":"xs"}export function useBreakpointValue(e){return n(e,useCurrentBreakpoint())}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,19 +6,24 @@ export * from './components/anchor/index.js';
|
|
|
6
6
|
export * from './components/animate-appear/index.js';
|
|
7
7
|
export * from './components/app-logo/index.js';
|
|
8
8
|
export * from './components/animate-blink/index.js';
|
|
9
|
+
export * from './components/animate-counter/index.js';
|
|
9
10
|
export * from './components/animate-fade/index.js';
|
|
11
|
+
export * from './components/animate-float/index.js';
|
|
10
12
|
export * from './components/animate-grow/index.js';
|
|
11
13
|
export * from './components/animate-headline/index.js';
|
|
12
14
|
export * from './components/animate-lighting/index.js';
|
|
13
15
|
export * from './components/animate-marquee/index.js';
|
|
16
|
+
export * from './components/animate-reveal/index.js';
|
|
14
17
|
export * from './components/animate-rotate/index.js';
|
|
18
|
+
export * from './components/animate-scramble/index.js';
|
|
19
|
+
export * from './components/animate-shake/index.js';
|
|
20
|
+
export * from './components/animate-split/index.js';
|
|
15
21
|
export * from './components/animate-slide/index.js';
|
|
16
22
|
export * from './components/animate-typing/index.js';
|
|
17
23
|
export * from './components/animate-zoom/index.js';
|
|
18
24
|
export * from './components/area-chart/index.js';
|
|
19
25
|
export * from './components/aspect-ratio/index.js';
|
|
20
26
|
export * from './components/avatar/index.js';
|
|
21
|
-
export * from './components/avatar-group/index.js';
|
|
22
27
|
export * from './components/badge/index.js';
|
|
23
28
|
export * from './components/bar-chart/index.js';
|
|
24
29
|
export * from './components/blockquote/index.js';
|
|
@@ -51,7 +56,9 @@ export * from './components/drawer/index.js';
|
|
|
51
56
|
export * from './components/empty/index.js';
|
|
52
57
|
export * from './components/fieldset/index.js';
|
|
53
58
|
export * from './components/file-picker/index.js';
|
|
59
|
+
export * from './components/flex/index.js';
|
|
54
60
|
export * from './components/form/index.js';
|
|
61
|
+
export * from './components/gallery/index.js';
|
|
55
62
|
export * from './components/gauge-chart/index.js';
|
|
56
63
|
export * from './components/grid/index.js';
|
|
57
64
|
export * from './components/floating-action-button/index.js';
|
|
@@ -96,11 +103,13 @@ export * from './components/scroll-zone/index.js';
|
|
|
96
103
|
export * from './components/segmented-button/index.js';
|
|
97
104
|
export * from './components/select/index.js';
|
|
98
105
|
export * from './components/shortcut/index.js';
|
|
106
|
+
export * from './components/show/index.js';
|
|
99
107
|
export * from './components/sidebar/index.js';
|
|
100
108
|
export * from './components/skeleton/index.js';
|
|
101
109
|
export * from './components/slider/index.js';
|
|
102
110
|
export * from './components/sparkline/index.js';
|
|
103
111
|
export * from './components/spoiler/index.js';
|
|
112
|
+
export * from './components/stack/index.js';
|
|
104
113
|
export * from './components/statistic/index.js';
|
|
105
114
|
export * from './components/switch/index.js';
|
|
106
115
|
export * from './components/table/index.js';
|