neba 1.11.0 → 1.13.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/LICENSE +1 -1
- package/README.md +43 -41
- package/dist/components/accordion/Accordion.d.ts +18 -0
- package/dist/components/accordion/Accordion.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-marquee/AnimateMarquee.d.ts +5 -3
- package/dist/components/animate-marquee/AnimateMarquee.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/avatar/Avatar.js +1 -1
- package/dist/components/bar-chart/BarChart.js +1 -1
- package/dist/components/bottom-navigation/BottomNavigation.d.ts +10 -0
- package/dist/components/bottom-navigation/BottomNavigation.js +1 -1
- package/dist/components/button/Button.js +1 -1
- package/dist/components/calendar/Calendar.js +1 -1
- package/dist/components/carousel/Carousel.d.ts +13 -0
- package/dist/components/carousel/Carousel.js +1 -1
- package/dist/components/checkbox/Checkbox.js +1 -1
- package/dist/components/code-block/CodeBlock.js +1 -1
- package/dist/components/color-picker/ColorPicker.js +1 -1
- package/dist/components/combobox/Combobox.d.ts +18 -0
- 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/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.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.d.ts +11 -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 +155 -7
- 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/meter/Meter.d.ts +7 -0
- package/dist/components/meter/Meter.js +1 -1
- package/dist/components/navigation-menu/NavigationMenu.js +1 -1
- package/dist/components/number-field/NumberField.js +1 -1
- package/dist/components/otp-field/OtpField.js +1 -1
- package/dist/components/overlay/Overlay.js +1 -1
- package/dist/components/panes/Panes.js +1 -1
- package/dist/components/pie-chart/PieChart.js +1 -1
- package/dist/components/popover/Popover.js +1 -1
- package/dist/components/progress-circular/ProgressCircular.d.ts +10 -1
- package/dist/components/progress-circular/ProgressCircular.js +1 -1
- package/dist/components/progress-linear/ProgressLinear.d.ts +7 -1
- package/dist/components/progress-linear/ProgressLinear.js +1 -1
- package/dist/components/provider/NebaProvider.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-area/ScrollArea.js +1 -1
- package/dist/components/scroll-zone/ScrollZone.d.ts +17 -11
- package/dist/components/scroll-zone/ScrollZone.js +1 -1
- package/dist/components/select/Select.d.ts +13 -0
- 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/slider/Slider.d.ts +37 -2
- package/dist/components/slider/Slider.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 +46 -0
- package/dist/components/tabs/Tabs.js +1 -1
- package/dist/components/text-field/TextField.js +1 -1
- package/dist/components/time-picker/TimePicker.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-select/TreeSelect.d.ts +2 -0
- package/dist/components/tree-select/TreeSelect.js +1 -1
- package/dist/components/tree-view/TreeView.js +1 -1
- package/dist/components/typography/Typography.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/cache.d.ts +24 -0
- package/dist/internal/cache.js +1 -0
- package/dist/internal/calendar.d.ts +15 -42
- package/dist/internal/calendar.js +1 -1
- package/dist/internal/chart-frame.d.ts +48 -3
- 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/date.js +1 -1
- package/dist/internal/drag.d.ts +8 -6
- package/dist/internal/drag.js +1 -1
- package/dist/internal/format.d.ts +21 -7
- package/dist/internal/format.js +1 -1
- package/dist/internal/grid.d.ts +29 -27
- package/dist/internal/grid.js +1 -1
- package/dist/internal/i18n.d.ts +92 -0
- package/dist/internal/i18n.js +1 -1
- package/dist/internal/icons.d.ts +25 -0
- package/dist/internal/icons.js +1 -1
- package/dist/internal/link.d.ts +5 -4
- package/dist/internal/media.d.ts +9 -2
- package/dist/internal/media.js +1 -1
- package/dist/internal/observe.js +1 -1
- package/dist/internal/page-layout.d.ts +11 -9
- package/dist/internal/page-layout.js +1 -1
- package/dist/internal/picker.d.ts +8 -3
- package/dist/internal/picker.js +1 -1
- package/dist/internal/progress.d.ts +24 -1
- package/dist/internal/progress.js +1 -1
- package/dist/internal/responsive.d.ts +97 -0
- package/dist/internal/responsive.js +1 -0
- package/dist/internal/styles.d.ts +140 -2
- package/dist/internal/styles.js +1 -1
- package/dist/internal/text.d.ts +32 -0
- package/dist/internal/text.js +1 -0
- package/dist/internal/wheel.d.ts +38 -0
- package/dist/internal/wheel.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 +411 -30
- package/dist/types.d.ts +119 -6
- package/package.json +19 -18
- 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/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025 CDGet
|
|
3
|
+
Copyright (c) 2025 CDGet (https://cdget.com).
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -12,27 +12,27 @@ Live previews and full props for every component. This README is just the quick
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
**Neba UI is a React component library for building application interfaces.**
|
|
15
|
+
**Neba UI is a React component library for building application interfaces.** About 130 components, from buttons and form fields through menus, dialogs, tables and charts. They are styled and accessible out of the box, and they agree with each other because they draw from one set of props.
|
|
16
16
|
|
|
17
17
|
You install one package, add one line to your CSS, and import components. There is nothing to configure, no theme object to assemble, and no per-component styling decisions to make before you can ship a screen.
|
|
18
18
|
|
|
19
|
-
- **A broad component set, still growing
|
|
20
|
-
- **One shared vocabulary
|
|
21
|
-
- **Accessible by construction
|
|
22
|
-
- **Dark mode with no work
|
|
23
|
-
- **A design language, not a theme file
|
|
24
|
-
- **ESM only**, TypeScript declarations included, and genuinely tree-shakeable
|
|
25
|
-
- **Two runtime dependencies
|
|
19
|
+
- **A broad component set, still growing**: enough to build a whole screen without reaching elsewhere.
|
|
20
|
+
- **One shared vocabulary**: `size`, `color`, `variant`, `density`, `elevation`. An `md` is the same height on every control; `primary` is the same colour everywhere.
|
|
21
|
+
- **Accessible by construction**: real roles, labels, focus management and keyboard support, not `div`s with click handlers.
|
|
22
|
+
- **Dark mode with no work**: follows the system, and can be forced either way per subtree.
|
|
23
|
+
- **A design language, not a theme file**: a translucent acrylic surface with a hairline edge, one deliberate motion signature, and shadows that are opt-in.
|
|
24
|
+
- **ESM only**, TypeScript declarations included, and genuinely tree-shakeable: every component compiles to its own module, and importing one costs about what one costs. A `Button` is ~5 kB gzipped including its Base UI parts, a `Chip` is ~3 kB, and a twelve-component app is ~70 kB; the whole library, all one hundred and seventy-five exports at once, is ~265 kB.
|
|
25
|
+
- **Two runtime dependencies**: Base UI, and `highlight.js`, which only [CodeBlock](https://neba.cdget.com/components/display/code-block) reaches and only through a dynamic import, so it never lands in a bundle that did not ask for it. React 18 or 19, Node.js 18 or later.
|
|
26
26
|
|
|
27
27
|
## Documentation
|
|
28
28
|
|
|
29
|
-
Everything is documented at **[neba.cdget.com](https://neba.cdget.com)**, where the previews are not screenshots
|
|
29
|
+
Everything is documented at **[neba.cdget.com](https://neba.cdget.com)**, where the previews are not screenshots. They are the components, running in the page.
|
|
30
30
|
|
|
31
31
|
| Page | What you will find |
|
|
32
32
|
| --- | --- |
|
|
33
33
|
| [**Getting started**](https://neba.cdget.com/guide/getting-started) | Install and setup, end to end. |
|
|
34
34
|
| [**All components**](https://neba.cdget.com/components/) | Every component, one page each: live previews and the full props table. |
|
|
35
|
-
| [**Examples**](https://neba.cdget.com/examples/overview) | A whole sample screen explained block by block, plus three concept screens
|
|
35
|
+
| [**Examples**](https://neba.cdget.com/examples/overview) | A whole sample screen explained block by block, plus three concept screens: a landing page, an admin dashboard and a sign-up flow. |
|
|
36
36
|
| [**Design language**](https://neba.cdget.com/design/design-language) | Why a Neba surface looks and behaves the way it does. |
|
|
37
37
|
| [**Prop conventions**](https://neba.cdget.com/design/prop-conventions) | The shared vocabulary every component draws from. |
|
|
38
38
|
| [**Color**](https://neba.cdget.com/design/color) | The token families, and how to theme them. |
|
|
@@ -48,7 +48,7 @@ npm install neba
|
|
|
48
48
|
pnpm add neba
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
`react` and `react-dom` are peer dependencies
|
|
51
|
+
`react` and `react-dom` are peer dependencies: React 18 or 19. Neba uses the copy your project already has, and npm 7 and later will install them alongside it if it has none.
|
|
52
52
|
|
|
53
53
|
### Setup
|
|
54
54
|
|
|
@@ -58,11 +58,11 @@ Add one line to your app's CSS entry point:
|
|
|
58
58
|
@import 'neba/styles.css';
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
`neba/styles.css` is finished CSS
|
|
61
|
+
`neba/styles.css` is finished CSS: the design tokens, the compiled rules for every utility class the components use, and a small reset whose every rule is specificity 0 so your own styles always win. [Tailwind CSS](https://tailwindcss.com) v4 builds this package; it does not have to be installed in yours.
|
|
62
62
|
|
|
63
63
|
That is the whole setup. No provider is required at the root, no theme object, no config file.
|
|
64
64
|
|
|
65
|
-
If your project already runs Tailwind v4, import `neba/tailwind.css` instead
|
|
65
|
+
If your project already runs Tailwind v4, import `neba/tailwind.css` instead: the token sheet, which registers the package as a style source so your own build generates the utilities in the same pass as your app's:
|
|
66
66
|
|
|
67
67
|
```css
|
|
68
68
|
@import 'tailwindcss';
|
|
@@ -88,11 +88,11 @@ export default function SignIn() {
|
|
|
88
88
|
|
|
89
89
|
### Next.js and React Server Components
|
|
90
90
|
|
|
91
|
-
Every component carries `'use client'`, so it can be imported straight into a Server Component
|
|
91
|
+
Every component carries `'use client'`, so it can be imported straight into a Server Component: no wrapper, no `transpilePackages` entry. The directive marks a boundary, not a page: the page stays a Server Component and only the components it renders reach the browser. The ordinary rule about that boundary still applies: an event handler defined in a Server Component cannot be passed across it.
|
|
92
92
|
|
|
93
93
|
The `neba` barrel and `neba/locales` are deliberately left unmarked, so a Server Component importing the barrel reaches the components behind it rather than a boundary of its own, and `registerMessages` stays a plain function. Bundlers that do not implement Server Components ignore the directive entirely.
|
|
94
94
|
|
|
95
|
-
A few components provide context and are mounted once, near the root, only if you use them
|
|
95
|
+
A few components provide context and are mounted once, near the root, only if you use them: `ToastProvider` (paired with the `useToast()` hook) and `TooltipProvider`.
|
|
96
96
|
|
|
97
97
|
Every component is also its own entry point, named after its folder:
|
|
98
98
|
|
|
@@ -101,11 +101,11 @@ import { Button } from 'neba/button';
|
|
|
101
101
|
import { TextField } from 'neba/text-field';
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
-
Both forms produce the same bundle. The root barrel is the one to reach for; the subpath is there for a build that would rather not parse
|
|
104
|
+
Both forms produce the same bundle. The root barrel is the one to reach for; the subpath is there for a build that would rather not parse three hundred modules to keep five, and as an escape hatch for a bundler that does not honour `sideEffects`.
|
|
105
105
|
|
|
106
106
|
### Languages
|
|
107
107
|
|
|
108
|
-
Neba writes very little text of its own
|
|
108
|
+
Neba writes very little text of its own (a Button says what you hand it) but a few components have to invent a string: the label on a Dialog's close button, the word under a chat message that says it was read, the sentence a screen reader hears after a link that opens a new tab.
|
|
109
109
|
|
|
110
110
|
Those ship in English. Eighteen other languages are included in the package and none of them is in your bundle until you say so:
|
|
111
111
|
|
|
@@ -121,9 +121,9 @@ Call it once, at module scope, before your first render. Then a `locale` prop tr
|
|
|
121
121
|
<Dialog locale="ko" title="설정" showClose />
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
-
A registered language costs about
|
|
124
|
+
A registered language costs about 2.8 kB gzipped and you pay only for the ones you name. Tags are matched by script, then by region, then by language: registering `ko` answers `ko-KR`, and `zhHans` registered as `zh-hans` answers `zh-CN` and a bare `zh`. Available: `ko`, `ja`, `zhHans`, `zhHant`, `es`, `pt`, `fr`, `de`, `it`, `nl`, `pl`, `ru`, `tr`, `ar`, `hi`, `id`, `vi`, `th`, each also its own entry point (`neba/locales/ko`).
|
|
125
125
|
|
|
126
|
-
Anything the platform already knows
|
|
126
|
+
Anything the platform already knows (month names, weekday names, AM/PM, number and date formats) comes from `Intl` and needs no registration. And every string a component invents also has a prop that overrides it, so a language Neba does not carry is never a dead end.
|
|
127
127
|
|
|
128
128
|
### One place for your defaults
|
|
129
129
|
|
|
@@ -138,7 +138,7 @@ import { NebaProvider } from 'neba';
|
|
|
138
138
|
</NebaProvider>;
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
Optional, and every component works without it. It fills in `size`, `density`, `variant` and `locale` where a call site left them out
|
|
141
|
+
Optional, and every component works without it. It fills in `size`, `density`, `variant` and `locale` where a call site left them out (the call site always wins) owns the colour scheme (`useColorScheme()`, plus a `colorSchemeScript()` for the first-paint flash), and sets the writing direction. `color` and `elevation` are deliberately not defaultable; [the guide](https://neba.cdget.com/guide/provider) says why.
|
|
142
142
|
|
|
143
143
|
### Hooks
|
|
144
144
|
|
|
@@ -153,7 +153,7 @@ const desktop = useBreakpoint('lg');
|
|
|
153
153
|
useShortcut('Mod+K', onOpen);
|
|
154
154
|
```
|
|
155
155
|
|
|
156
|
-
`useDisclosure`, `useMediaQuery`, `useBreakpoint`, `usePrefersReducedMotion`, `useElementSize`, `useOnScreen`, `useShortcut`. Everything here is machinery the library needed for itself
|
|
156
|
+
`useDisclosure`, `useMediaQuery`, `useBreakpoint`, `useCurrentBreakpoint`, `useBreakpointValue`, `usePrefersReducedMotion`, `useElementSize`, `useOnScreen`, `useShortcut`. Everything here is machinery the library needed for itself: there is no general-purpose hook collection, and there is not going to be one. Full notes in [the hooks guide](https://neba.cdget.com/guide/hooks).
|
|
157
157
|
|
|
158
158
|
### The shared prop vocabulary
|
|
159
159
|
|
|
@@ -164,10 +164,10 @@ The reason a Neba screen looks composed rather than assembled is that the props
|
|
|
164
164
|
| `size` | `xs` `sm` `md` `lg` `xl` | The control's scale. `md` is the desktop default. |
|
|
165
165
|
| `color` | `primary` `secondary` `success` `warning` `danger` `info` | The semantic colour family. |
|
|
166
166
|
| `variant` | `solid` `outline` `text` | How much visual weight the surface carries. |
|
|
167
|
-
| `density` | `default` `compact` | Padding only
|
|
167
|
+
| `density` | `default` `compact` | Padding only: never the height, never the type scale, so a compact control still lines up with a default one. |
|
|
168
168
|
| `elevation` | `0` `1` `2` `3` | How far a surface floats off the page. `0` is the default and means no shadow at all. |
|
|
169
169
|
|
|
170
|
-
Placement props are logical, not physical
|
|
170
|
+
Placement props are logical, not physical (`start`/`end` rather than `left`/`right`) so layouts flip correctly under RTL. The full rules are in [**Prop conventions**](https://neba.cdget.com/design/prop-conventions).
|
|
171
171
|
|
|
172
172
|
```tsx
|
|
173
173
|
<Button size="sm" color="danger" variant="outline">Delete</Button>
|
|
@@ -176,23 +176,23 @@ Placement props are logical, not physical — `start`/`end` rather than `left`/`
|
|
|
176
176
|
|
|
177
177
|
### Components
|
|
178
178
|
|
|
179
|
-
**Inputs
|
|
179
|
+
**Inputs**: Button, IconButton, ButtonGroup, SegmentedButton, Toggle, ToggleGroup, Form, Fieldset, FloatingActionButton (with FloatingAction), TextField, NumberField, OtpField, Select, Combobox, TreeSelect, Checkbox, RadioGroup, Switch, Slider, Rating, Menu (with submenus, checkbox and radio items), ContextMenu, Menubar, NavigationMenu, CommandPalette, FilePicker, Transfer, Pagination, BottomNavigation, FloatingBottomNavigation, ColorPicker, Calendar, DatePicker, TimePicker, DateTimePicker, DateRangePicker
|
|
180
180
|
|
|
181
|
-
**Surfaces
|
|
181
|
+
**Surfaces**: Box, Card, Accordion, Collapsible, Tabs, Carousel, Toolbar, Pill, Spoiler, HowToSteps, ChatBubble, Drawer, Popover, Mockup, WindowPane, HoverCard
|
|
182
182
|
|
|
183
|
-
**Display
|
|
183
|
+
**Display**: Typography, TextLink, Blockquote, Highlight, Divider, Chip, Badge, Avatar, AppLogo, Icon, Image, Gallery, Shortcut, List, DataList, Table, DataTable, CodeBlock, Timeline, Breadcrumb, Anchor, TreeView, VisuallyHidden
|
|
184
184
|
|
|
185
|
-
**Charts
|
|
185
|
+
**Charts**: Statistic, Sparkline, LineChart, AreaChart, BarChart, PieChart, ScatterChart, TimelineChart, HeatmapChart, GaugeChart
|
|
186
186
|
|
|
187
|
-
**Feedback
|
|
187
|
+
**Feedback**: Alert, Dialog, Confirm, Popconfirm, Toast, Tooltip, Overlay, Skeleton, Empty, ProgressLinear, ProgressCircular, ProgressBox, Meter, Tour
|
|
188
188
|
|
|
189
|
-
**Layout
|
|
189
|
+
**Layout**: PageLayout (with Header, Footer and Sidebar), Container, Grid (with GridContainer), Flex, Panes, Stack, Show, AspectRatio, Portal, ScrollZone, ScrollArea
|
|
190
190
|
|
|
191
|
-
**Transitions
|
|
191
|
+
**Transitions**: AnimateFade, AnimateGrow, AnimateZoom, AnimateSlide, AnimateRotate, AnimateBlink, AnimateReveal, AnimateFloat, AnimateShake, AnimateAppear, AnimateSplit, AnimateTyping, AnimateScramble, AnimateCounter, AnimateLighting, AnimateMarquee, AnimateHeadline
|
|
192
192
|
|
|
193
|
-
**
|
|
193
|
+
**Added in the last two releases**: Gallery, Flex, Show, Stack and the six new `Animate*` (Reveal, Float, Shake, Split, Counter, Scramble) in 1.12.0; Calendar, TreeSelect, Image, Confirm, Popconfirm and VisuallyHidden in 1.11.0. The [changelog](https://neba.cdget.com/changelog) has the rest.
|
|
194
194
|
|
|
195
|
-
Each one has its own page
|
|
195
|
+
Each one has its own page (live previews, every prop, and the variations worth seeing) under [**All components**](https://neba.cdget.com/components/).
|
|
196
196
|
|
|
197
197
|
### Theming and dark mode
|
|
198
198
|
|
|
@@ -204,7 +204,7 @@ Colours, radii, and surface strengths are CSS custom properties declared in the
|
|
|
204
204
|
}
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
-
Dark mode responds to `prefers-color-scheme` on its own. To force it, put `.dark` or `[data-theme='dark']` (or `'light'`) on any ancestor
|
|
207
|
+
Dark mode responds to `prefers-color-scheme` on its own. To force it, put `.dark` or `[data-theme='dark']` (or `'light'`) on any ancestor: it applies to that subtree, so a dark panel on a light page is one attribute.
|
|
208
208
|
|
|
209
209
|
Adding a whole new colour family is two edits: an entry in `NebaColor` and five tokens; everything else derives from them.
|
|
210
210
|
|
|
@@ -214,7 +214,7 @@ Clone the repository and install dependencies, then:
|
|
|
214
214
|
|
|
215
215
|
| Command | What it does |
|
|
216
216
|
| --- | --- |
|
|
217
|
-
| `npm run docs:dev` | Starts the documentation site (`docs/`) locally
|
|
217
|
+
| `npm run docs:dev` | Starts the documentation site (`docs/`) locally: every component, rendered live, with HMR. |
|
|
218
218
|
| `npm test` | Runs the test suite once. |
|
|
219
219
|
| `npm run test:watch` | Runs the test suite in watch mode. |
|
|
220
220
|
| `npm run typecheck` | Type-checks the library, the tests, and the docs. |
|
|
@@ -226,16 +226,16 @@ All commands are run from the repository root.
|
|
|
226
226
|
|
|
227
227
|
### Project structure
|
|
228
228
|
|
|
229
|
-
- `src
|
|
230
|
-
- `src/internal
|
|
231
|
-
- `test
|
|
232
|
-
- `docs
|
|
229
|
+
- `src/`: the library source. Each component lives in `src/components/{name}/` and is re-exported from `src/index.ts`.
|
|
230
|
+
- `src/internal/`: what the library shares with itself: the size and spacing tables, the surface and focus-ring generators, the icons more than one component draws. Shipped, but not part of the public API.
|
|
231
|
+
- `test/`: the test suite, mirroring the `src/` tree.
|
|
232
|
+
- `docs/`: the VitePress documentation site, in English and Korean. It renders the real components from `src/`, so it is also where components are developed and eyeballed.
|
|
233
233
|
|
|
234
234
|
There is no separate demo app: `npm run docs:dev` is the develop-and-eyeball loop.
|
|
235
235
|
|
|
236
236
|
### Tests
|
|
237
237
|
|
|
238
|
-
Tests run with [Vitest](https://vitest.dev) in browser mode, against a real headless browser driven by Playwright
|
|
238
|
+
Tests run with [Vitest](https://vitest.dev) in browser mode, against a real headless browser driven by Playwright. The components depend on browser APIs (`ResizeObserver`, the popover API, `dialog.showModal()`) that jsdom does not implement. Install the browser once before your first run:
|
|
239
239
|
|
|
240
240
|
```bash
|
|
241
241
|
npx playwright install chromium
|
|
@@ -249,11 +249,13 @@ VITEST_BROWSER=firefox npm test
|
|
|
249
249
|
|
|
250
250
|
CI runs the suite across Linux, Windows, and macOS in all three browser engines.
|
|
251
251
|
|
|
252
|
-
Tests ship with the component they cover, in the same commit. Add a test at the path mirroring its source
|
|
252
|
+
Tests ship with the component they cover, in the same commit. Add a test at the path mirroring its source: `src/components/button/Button.tsx` is covered by `test/components/button/Button.test.tsx`.
|
|
253
253
|
|
|
254
254
|
## Contributing
|
|
255
255
|
|
|
256
|
-
Anyone can contribute to the project by reporting new issues or submitting a pull request. For more information, please see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
256
|
+
Anyone can contribute to the project by reporting new issues or submitting a pull request. For more information, please see [CONTRIBUTING.md](CONTRIBUTING.md). Participation is subject to the [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
257
|
+
|
|
258
|
+
To report a security issue, please follow the process described in [SECURITY.md](SECURITY.md).
|
|
257
259
|
|
|
258
260
|
## License
|
|
259
261
|
|
|
@@ -31,6 +31,18 @@ export interface AccordionProps extends NebaStyleProps, Omit<React.ComponentProp
|
|
|
31
31
|
dividers?: boolean;
|
|
32
32
|
/** Unavailable. Every section stops answering. */
|
|
33
33
|
disabled?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Which heading every section's header is, in the page's own outline. An
|
|
36
|
+
* accordion under an `<h2>` wants `3`; one under an `<h3>` wants `4`.
|
|
37
|
+
*
|
|
38
|
+
* It belongs to the stack rather than to a fold in it — the sections are
|
|
39
|
+
* siblings, and a run of headings at different levels is an outline that
|
|
40
|
+
* lies. A `title` that is itself a styled heading nests one heading inside
|
|
41
|
+
* another, which this prop is the way out of: set the level here and pass
|
|
42
|
+
* plain text.
|
|
43
|
+
* @default 3
|
|
44
|
+
*/
|
|
45
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
34
46
|
/**
|
|
35
47
|
* Keeps closed panels in the DOM so the browser's own page search can find and
|
|
36
48
|
* open them. Overrides `keepMounted`.
|
|
@@ -65,6 +77,12 @@ export interface AccordionItemProps extends Omit<React.ComponentPropsWithoutRef<
|
|
|
65
77
|
* other. The same shape ListItem uses.
|
|
66
78
|
*/
|
|
67
79
|
action?: React.ReactNode;
|
|
80
|
+
/**
|
|
81
|
+
* Cuts the title and the subtitle off after this many lines, with an
|
|
82
|
+
* ellipsis. Unset, both wrap — an FAQ's title is a sentence rather than a
|
|
83
|
+
* label, and ending it in an ellipsis loses the question.
|
|
84
|
+
*/
|
|
85
|
+
lines?: number;
|
|
68
86
|
/** Unavailable. This section stops folding; the rest keep working. */
|
|
69
87
|
disabled?: boolean;
|
|
70
88
|
/** The body. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as a from"react";import{Accordion as t}from"@base-ui/react/accordion";import{boxPaddingXClasses as l,boxPaddingYClasses as
|
|
1
|
+
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as a from"react";import{Accordion as t}from"@base-ui/react/accordion";import{boxPaddingXClasses as l,boxPaddingYClasses as i}from"../box/Box.js";import{ChevronIcon as r}from"../../internal/icons.js";import{clampClasses as s,cx as d,focusRingClasses as o,gapClasses as c,hasContent as m,iconClasses as f,metaTextClasses as h,radiusClasses as u,sheetBodyClasses as b,sheetHeaderGapClasses as x,sheetTitleClasses as v,surfaceClasses as p,surfaceSlots as g,transitionClasses as N}from"../../internal/styles.js";import{useStyleDefaults as j}from"../../internal/defaults.js";const y=/*@__PURE__*/a.createContext({size:"md",density:"default",dividers:!0,headingLevel:3}),w={solid:[p,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[p,"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"},k={xs:u.xs,sm:u.xs,md:u.sm,lg:u.sm,xl:u.md};export const Accordion=/*@__PURE__*/a.forwardRef(function(n,l){const{variant:i="outline",size:r="md",color:s="primary",density:o="default",elevation:c=0,multiple:m=!1,value:f,defaultValue:h,onValueChange:b,dividers:x=!0,headingLevel:v=3,disabled:p=!1,hiddenUntilFound:k=!1,keepMounted:z=!1,className:C,style:L,children:V,..._}=j(n,["size","density","variant"]),A=a.useMemo(()=>({size:r,density:o,dividers:x,headingLevel:v}),[r,o,x,v]),I=d("flex flex-col",u[r],w[i],N,x?"overflow-hidden [&>div+div]:border-t [&>div+div]:[border-color:var(--n-line)]":"p-1",C??"");return e(y.Provider,{value:A,children:e(t.Root,{ref:l,multiple:m,value:f,defaultValue:h,onValueChange:e=>b?.(e),disabled:p,hiddenUntilFound:k,keepMounted:z,className:I,style:{...g(s,c),...L},..._,children:V})})});export const AccordionItem=/*@__PURE__*/a.forwardRef(function({value:u,title:p,subtitle:g,startIcon:j,action:w,lines:z,disabled:C=!1,className:L,children:V,..._},A){const{size:I,density:M,dividers:R,headingLevel:$}=a.useContext(y),F=z?s(z):"",P=l[M][I],U=i[M][I];return n(t.Item,{ref:A,value:u,disabled:C,className:d("flex flex-col",L??""),..._,children:[n(t.Header,{className:"m-0 flex w-full items-center [font:inherit]",render:a.createElement(`h${$}`),children:[n(t.Trigger,{className:d("flex min-w-0 flex-1 cursor-pointer items-center text-start",P,U,c[I],N,f,o,R?"":k[I],"hover:bg-(--n-soft)","data-[panel-open]:text-(--n-accent)","disabled:cursor-not-allowed disabled:bg-transparent disabled:text-(--neba-disabled-fg)"),children:[m(j)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:j}):null,n("span",{className:`flex min-w-0 flex-1 flex-col ${x[I]}`,children:[m(p)?e("span",{className:d("font-semibold",v[I],F),children:p}):null,m(g)?e("span",{className:d("text-(--neba-muted-fg)",h[I],F),children:g}):null]}),e("span",{className:["flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)","[transition:rotate_var(--neba-duration)_var(--neba-ease)]","data-[panel-open]:rotate-180"].join(" "),children:e(r,{})})]}),m(w)?e("span",{className:`flex shrink-0 items-center ${P}`,children:w}):null]}),e(t.Panel,{className:["h-(--accordion-panel-height) overflow-hidden","[transition:height_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:h-0 data-[ending-style]:h-0"].join(" "),children:e("div",{className:["text-(--neba-muted-fg)",b[I],P,"compact"===M?"pb-2":"pb-4"].join(" "),children:V})})]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e}from"react/jsx-runtime";import*as n from"react";import{anchorMessages as r,useMessages as t}from"../../internal/i18n.js";import{controlTextLeadingClasses as o,cx as a,focusRingClasses as l,transitionClasses as i}from"../../internal/styles.js";import{useStyleDefaults as c}from"../../internal/defaults.js";const s={default:{xs:"py-1",sm:"py-1",md:"py-1.5",lg:"py-1.5",xl:"py-2"},compact:{xs:"py-0.5",sm:"py-0.5",md:"py-1",lg:"py-1",xl:"py-1"}},
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import*as n from"react";import{anchorMessages as r,useMessages as t}from"../../internal/i18n.js";import{controlTextLeadingClasses as o,cx as a,focusRingClasses as l,transitionClasses as i}from"../../internal/styles.js";import{useStyleDefaults as c}from"../../internal/defaults.js";const s={default:{xs:"py-1",sm:"py-1",md:"py-1.5",lg:"py-1.5",xl:"py-2"},compact:{xs:"py-0.5",sm:"py-0.5",md:"py-1",lg:"py-1",xl:"py-1"}},d={xs:8,sm:10,md:12,lg:14,xl:16},m=["block min-w-0 truncate no-underline","text-(--neba-muted-fg)",i,l,"hover:text-(--neba-fg)","aria-[current=location]:font-medium aria-[current=location]:text-(--n-accent)"].join(" "),u=["border-s [border-color:transparent]","[transition:border-color_var(--neba-duration)_var(--neba-ease)]","aria-[current=location]:[border-color:var(--n-accent)]"].join(" ");function f(e,n){const r=n.get(e);if(r?.isConnected)return r;const t=document.getElementById(e.replace(/^#/,""));return t?n.set(e,t):n.delete(e),t}export const Anchor=/*@__PURE__*/n.forwardRef(function(l,i){const{items:p,activeHref:h,onActiveChange:g,offset:v=0,container:b,rail:y=!0,size:x="md",color:w="primary",density:j="default",locale:E,label:H,className:N,style:R,...z}=c(l,["size","density","locale"]),A=t(r,E),[C,L]=n.useState(null),B=void 0!==h,$=B?h:C,F=n.useRef(g),I=n.useRef(p);n.useEffect(()=>{F.current=g,I.current=p});const S=p.map(e=>e.href).join("\0");return n.useEffect(()=>{if(B)return;const e=b?.current??window,n=new Map;let r=0,t=null;const o=()=>{r=0;const e=function(e,n,r,t){const o=(r?r.getBoundingClientRect().top:0)+n+1;let a=null;for(const n of e){const e=f(n.href,t);e&&e.getBoundingClientRect().top<=o&&(a=n.href)}return(r?r.scrollTop+r.clientHeight>=r.scrollHeight-2:window.innerHeight+window.scrollY>=document.documentElement.scrollHeight-2)&&e.length>0?e[e.length-1].href:a}(I.current,v,b?.current??null,n);e!==t&&(t=e,L(e),F.current?.(e))},a=()=>{0===r&&(r=requestAnimationFrame(o))};return o(),e.addEventListener("scroll",a,{passive:!0}),window.addEventListener("resize",a,{passive:!0}),()=>{0!==r&&cancelAnimationFrame(r),e.removeEventListener("scroll",a),window.removeEventListener("resize",a)}},[S,v,b,B]),e("nav",{ref:i,"aria-label":H??A.label,className:a("min-w-0",N??""),style:{"--n-accent":`var(--neba-${w}-accent)`,"--n-ring":`var(--neba-${w}-ring)`,...R},...z,children:e("ul",{className:a("m-0 flex list-none flex-col p-0",y?"border-s [border-color:var(--neba-border)]":""),children:p.map(n=>e("li",{className:y?"[margin-inline-start:-1px]":"",children:e("a",{href:n.href,"aria-current":$===n.href?"location":void 0,className:a(m,o[x],s[j][x],y?`${u} ps-3`:""),style:{marginInlineStart:n.depth?n.depth*d[x]:void 0},children:n.label})},n.href))})})});
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
-
import type { NebaAnimateProps, NebaSide } from '../../types.js';
|
|
4
|
-
export interface AnimateAppearProps extends NebaAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
-
/**
|
|
6
|
-
* How long after one child the next one starts, in milliseconds. This is the
|
|
7
|
-
* whole effect — everything else is what a single child does.
|
|
8
|
-
* @default 80
|
|
9
|
-
*/
|
|
10
|
-
stagger?: number;
|
|
3
|
+
import type { NebaAnimateProps, NebaSide, NebaStaggerProps, NebaTimelineProps } from '../../types.js';
|
|
4
|
+
export interface AnimateAppearProps extends NebaAnimateProps, NebaStaggerProps, NebaTimelineProps, React.ComponentPropsWithoutRef<'div'> {
|
|
11
5
|
/**
|
|
12
6
|
* Which edge each child drifts in from.
|
|
13
7
|
* @default 'bottom'
|
|
@@ -25,11 +19,6 @@ export interface AnimateAppearProps extends NebaAnimateProps, React.ComponentPro
|
|
|
25
19
|
* @default true
|
|
26
20
|
*/
|
|
27
21
|
fade?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Runs the list from the last child to the first.
|
|
30
|
-
* @default false
|
|
31
|
-
*/
|
|
32
|
-
reverse?: boolean;
|
|
33
22
|
/** Renders something other than a `<div>`. Base UI's own escape hatch. */
|
|
34
23
|
render?: useRender.RenderProp;
|
|
35
24
|
/** The things that appear, one after another. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import
|
|
1
|
+
"use client";import*as e from"react";import{useRender as a}from"@base-ui/react/use-render";import{animBaseClass as t,animationClasses as r,isInfinite as n,slideOffsets as i,staggerChildren as s,useAnimationRun as o}from"../../internal/animate.js";export const AnimateAppear=/*@__PURE__*/e.forwardRef(function({duration:e=420,delay:d=0,easing:l,repeat:p=1,alternate:m,paused:c,trigger:g="mount",play:u,once:f=!0,threshold:y=.2,stagger:h=80,durationStep:b=0,reverse:x=!1,timeline:v,range:A,from:N="bottom",distance:S="0.75rem",fade:$=!0,render:j,className:w,style:R,children:k,...q},z){const B=o({trigger:g,play:u,once:f,threshold:y,paused:c,infinite:n(p)}),{x:C,y:D}=i(N,S),E=s(k,`${t} ${r.slide}`,{duration:e,delay:d,easing:l,repeat:p,alternate:m,x:C,y:D,opacity:$?0:1,timeline:v,range:A},{stagger:h,durationStep:b,reverse:x});return a({render:j,ref:[z,B.ref],props:{...q,className:w,style:{"--n-anim-state":B.state,...R},...B.handlers,"data-neba-animation":"appear","data-state":B.state,children:E}})});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
-
import type { NebaAnimateProps } from '../../types.js';
|
|
4
|
-
export interface AnimateBlinkProps extends NebaAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
import type { NebaAnimateProps, NebaStaggerProps, NebaTimelineProps } from '../../types.js';
|
|
4
|
+
export interface AnimateBlinkProps extends NebaAnimateProps, NebaStaggerProps, NebaTimelineProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
5
|
/**
|
|
6
6
|
* How faint it gets at the bottom of the cycle, between `0` and `1`. Raise it
|
|
7
7
|
* for something that has to stay readable while it pulses.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as n}from"../../internal/animate.js";import{cx as a}from"../../internal/styles.js";export const AnimateBlink=/*@__PURE__*/e.forwardRef(function({duration:e=900,delay:i=0,easing:s,repeat:l="infinite",alternate:o,paused:d,trigger:p="mount",play:c,once:m=!0,threshold:f=.2,stagger:g=0,durationStep:u=0,reverse:y=!1,timeline:h,range:N,min:b=0,render:j,className:k,style:v,children:S,...w},x){const A=n({effect:"blink",duration:e,delay:i,easing:s,repeat:l,alternate:o,opacity:b,trigger:p,play:c,once:m,threshold:f,paused:d,infinite:t(l),timeline:h,range:N,children:S,stagger:g,durationStep:u,reverse:y});return r({render:j,ref:[x,A.ref],props:{...w,className:a(A.className,k),style:{...A.style,...v},...A.props,children:A.children}})});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { NebaAnimateProps } from '../../types.js';
|
|
4
|
+
export interface AnimateCounterProps extends Omit<NebaAnimateProps, 'easing' | 'repeat' | 'alternate'>, Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
5
|
+
/** Where it lands. */
|
|
6
|
+
value: number;
|
|
7
|
+
/**
|
|
8
|
+
* Where it starts.
|
|
9
|
+
* @default 0
|
|
10
|
+
*/
|
|
11
|
+
from?: number;
|
|
12
|
+
/**
|
|
13
|
+
* How long the count takes, in milliseconds.
|
|
14
|
+
* @default 1200
|
|
15
|
+
*/
|
|
16
|
+
duration?: number;
|
|
17
|
+
/**
|
|
18
|
+
* How the number is written — `Intl.NumberFormat` options, so a currency, a
|
|
19
|
+
* percentage or a compact `1.2M` is a prop rather than a `format` callback.
|
|
20
|
+
*/
|
|
21
|
+
format?: Intl.NumberFormatOptions;
|
|
22
|
+
/** Which language it is written in. Defaults to the reader's own. */
|
|
23
|
+
locale?: string;
|
|
24
|
+
/** Renders something other than a `<div>`. Base UI's own escape hatch. */
|
|
25
|
+
render?: useRender.RenderProp;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A number counted up to its value.
|
|
29
|
+
*
|
|
30
|
+
* The one animation in the library whose subject is the content rather than the
|
|
31
|
+
* box around it, and the reason it is a component: a count is a value being
|
|
32
|
+
* interpolated and formatted on every frame, which is not something a
|
|
33
|
+
* `@keyframes` can do.
|
|
34
|
+
*
|
|
35
|
+
* It pairs with [Statistic](../charts/statistic) — a dashboard that draws its
|
|
36
|
+
* numbers instantly and animates everything around them has the emphasis
|
|
37
|
+
* exactly backwards.
|
|
38
|
+
*
|
|
39
|
+
* The finished number is in the document from the first frame, in a clipped box
|
|
40
|
+
* for a screen reader; what counts is a visible copy that is `aria-hidden`.
|
|
41
|
+
* A reader who cannot see the count is told the answer rather than a hundred
|
|
42
|
+
* intermediate ones, and a reader who has asked for less motion is shown the
|
|
43
|
+
* answer too.
|
|
44
|
+
*/
|
|
45
|
+
export declare const AnimateCounter: React.ForwardRefExoticComponent<AnimateCounterProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,Fragment as r,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{useRender as a}from"@base-ui/react/use-render";import{useAnimationRun as s,usePrefersReducedMotion as i}from"../../internal/animate.js";import{srOnlyClasses as o}from"../../internal/styles.js";export const AnimateCounter=/*@__PURE__*/n.forwardRef(function({value:m,from:l=0,duration:u=1200,delay:c=0,paused:d,trigger:f="mount",play:p,once:h=!0,threshold:y=.2,format:g,locale:F,render:j,className:v,style:A,...N},x){const b=s({trigger:f,play:p,once:h,threshold:y,paused:d,infinite:!1}),q=i(),[w,M]=n.useState(l),S=void 0===g?"":JSON.stringify(g),C=n.useMemo(()=>new Intl.NumberFormat(F,g),[F,S]);return n.useEffect(()=>{if(!b.started)return void M(l);if(q||u<=0)return void M(m);let e=0,r=null;const t=n=>{null===r&&(r=n);const a=n-r-c;if(a<0)return void(e=requestAnimationFrame(t));const s=Math.min(1,a/u);M(l+(m-l)*function(e){return 1-(1-e)**3}(s)),s<1&&(e=requestAnimationFrame(t))};return M(l),e=requestAnimationFrame(t),()=>cancelAnimationFrame(e)},[b.started,q,m,l,u,c]),a({render:j,ref:[x,b.ref],props:{...N,className:v,style:A,"data-neba-animation":"counter","data-state":b.state,...b.handlers,children:t(r,{children:[e("span",{className:o,children:C.format(m)}),e("span",{"aria-hidden":"true",children:C.format(w)})]})}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AnimateCounter.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./AnimateCounter.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
-
import type { NebaAnimateMode, NebaAnimateProps } from '../../types.js';
|
|
4
|
-
export interface AnimateFadeProps extends NebaAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
import type { NebaAnimateMode, NebaAnimateProps, NebaStaggerProps, NebaTimelineProps } from '../../types.js';
|
|
4
|
+
export interface AnimateFadeProps extends NebaAnimateProps, NebaStaggerProps, NebaTimelineProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
5
|
/**
|
|
6
6
|
* Whether the content arrives or leaves.
|
|
7
7
|
* @default 'in'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as a}from"../../internal/animate.js";import{cx as n}from"../../internal/styles.js";export const AnimateFade=/*@__PURE__*/e.forwardRef(function({duration:e=320,delay:
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as a}from"../../internal/animate.js";import{cx as n}from"../../internal/styles.js";export const AnimateFade=/*@__PURE__*/e.forwardRef(function({duration:e=320,delay:i=0,easing:s,repeat:o=1,alternate:l,paused:d,trigger:m="mount",play:p,once:c=!0,threshold:f=.2,stagger:g=0,durationStep:u=0,reverse:y=!1,timeline:h,range:N,mode:j="in",from:v=0,render:S,className:b,style:w,children:x,...A},F){const R=a({effect:"fade",duration:e,delay:i,easing:s,repeat:o,alternate:l,mode:j,opacity:v,trigger:m,play:p,once:c,threshold:f,paused:d,infinite:t(o),timeline:h,range:N,children:x,stagger:g,durationStep:u,reverse:y});return r({render:S,ref:[F,R.ref],props:{...A,className:n(R.className,b),style:{...R.style,...w},...R.props,children:R.children}})});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { NebaAnimateProps, NebaSide, NebaStaggerProps, NebaTimelineProps } from '../../types.js';
|
|
4
|
+
export interface AnimateFloatProps extends NebaAnimateProps, NebaStaggerProps, NebaTimelineProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* Which way it drifts.
|
|
7
|
+
* @default 'top'
|
|
8
|
+
*/
|
|
9
|
+
from?: NebaSide;
|
|
10
|
+
/**
|
|
11
|
+
* How far, at the top of the drift — a CSS length, or a number in pixels.
|
|
12
|
+
* Small on purpose: this is something resting rather than something moving,
|
|
13
|
+
* and past about a centimetre it stops reading as either.
|
|
14
|
+
* @default '0.5rem'
|
|
15
|
+
*/
|
|
16
|
+
distance?: number | string;
|
|
17
|
+
/** Renders something other than a `<div>`. Base UI's own escape hatch. */
|
|
18
|
+
render?: useRender.RenderProp;
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A slow drift with nowhere to get to.
|
|
23
|
+
*
|
|
24
|
+
* The only effect in the set that is neither an arrival nor a state: it says
|
|
25
|
+
* *this is not fixed to the page*, which is what an illustration, a floating
|
|
26
|
+
* card or a mark above a hero wants and what nothing else in the library says.
|
|
27
|
+
* It runs for as long as the page is open and turns round at both ends, so
|
|
28
|
+
* there is never a frame where it jumps back.
|
|
29
|
+
*
|
|
30
|
+
* It is `translate` rather than a `transform`, so it composes with anything the
|
|
31
|
+
* element is already scaled or rotated by — and it is deliberately not offered
|
|
32
|
+
* on a control: a button that is never quite where it was is a button that is
|
|
33
|
+
* harder to press.
|
|
34
|
+
*/
|
|
35
|
+
export declare const AnimateFloat: React.ForwardRefExoticComponent<AnimateFloatProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,slideOffsets as a,useAnimateElement as n}from"../../internal/animate.js";import{cx as i}from"../../internal/styles.js";export const AnimateFloat=/*@__PURE__*/e.forwardRef(function({duration:e=3200,delay:s=0,easing:l="ease-in-out",repeat:o="infinite",alternate:m=!0,paused:d,trigger:c="mount",play:f,once:p=!0,threshold:u=.2,stagger:g=0,durationStep:y=0,reverse:h=!1,timeline:x,range:N,from:b="top",distance:j="0.5rem",render:v,className:S,style:w,children:A,...C},F){const{x:R,y:k}=a(b,j),q=n({effect:null,effectClass:"neba-anim-float",name:"float",duration:e,delay:s,easing:l,repeat:o,alternate:m,x:R,y:k,trigger:c,play:f,once:p,threshold:u,paused:d,infinite:t(o),timeline:x,range:N,children:A,stagger:g,durationStep:y,reverse:h});return r({render:v,ref:[F,q.ref],props:{...C,className:i(q.className,S),style:{...q.style,...w},...q.props,children:q.children}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AnimateFloat.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./AnimateFloat.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
-
import type { NebaAnimateMode, NebaAnimateProps } from '../../types.js';
|
|
4
|
-
export interface AnimateGrowProps extends NebaAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
import type { NebaAnimateMode, NebaAnimateProps, NebaStaggerProps, NebaTimelineProps } from '../../types.js';
|
|
4
|
+
export interface AnimateGrowProps extends NebaAnimateProps, NebaStaggerProps, NebaTimelineProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
5
|
/**
|
|
6
6
|
* Whether the content unfolds or folds away.
|
|
7
7
|
* @default 'in'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as a}from"../../internal/animate.js";import{cx as n}from"../../internal/styles.js";export const AnimateGrow=/*@__PURE__*/e.forwardRef(function({duration:e=340,delay:
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as a}from"../../internal/animate.js";import{cx as n}from"../../internal/styles.js";export const AnimateGrow=/*@__PURE__*/e.forwardRef(function({duration:e=340,delay:i=0,easing:s,repeat:o=1,alternate:l,paused:d,trigger:m="mount",play:c,once:p=!0,threshold:f=.2,stagger:g=0,durationStep:u=0,reverse:y=!1,timeline:h,range:w,mode:N="in",from:j=.8,origin:v="center",fade:S=!0,render:b,className:x,style:A,children:G,...O},R){const k=a({effect:"grow",duration:e,delay:i,easing:s,repeat:o,alternate:l,mode:N,scale:j,opacity:S?0:1,trigger:m,play:c,once:p,threshold:f,paused:d,infinite:t(o),timeline:h,range:w,children:G,stagger:g,durationStep:u,reverse:y});return r({render:b,ref:[R,k.ref],props:{...O,className:n(k.className,x),style:{transformOrigin:v,...k.style,...A},...k.props,children:k.children}})});
|
|
@@ -32,8 +32,8 @@ export interface AnimateMarqueeProps extends NebaAnimateProps, React.ComponentPr
|
|
|
32
32
|
*/
|
|
33
33
|
copies?: number;
|
|
34
34
|
/**
|
|
35
|
-
* Stops while the pointer is on it,
|
|
36
|
-
* be read or
|
|
35
|
+
* Stops while the pointer is on it, or while the focus is inside it, so
|
|
36
|
+
* something scrolling past can actually be read, clicked or tabbed to.
|
|
37
37
|
* @default true
|
|
38
38
|
*/
|
|
39
39
|
pauseOnHover?: boolean;
|
|
@@ -56,7 +56,9 @@ export interface AnimateMarqueeProps extends NebaAnimateProps, React.ComponentPr
|
|
|
56
56
|
*
|
|
57
57
|
* `pauseOnHover` is on by default and is not decoration: content moving past a
|
|
58
58
|
* pointer cannot be clicked reliably, and a link inside a marquee that never
|
|
59
|
-
* stops is a link nobody can follow.
|
|
59
|
+
* stops is a link nobody can follow. It answers the focus as well as the
|
|
60
|
+
* pointer, or the same link would be unreachable to whoever tabs to it — the
|
|
61
|
+
* strip would be carrying it off the screen while it was being read.
|
|
60
62
|
*
|
|
61
63
|
* Only the first copy is read out. The rest carry `aria-hidden`, or a screen
|
|
62
64
|
* reader would announce everything on the strip as many times as it was laid
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e}from"react/jsx-runtime";import*as t from"react";import{isInfinite as a,lengthValue as r,useAnimationRun as n}from"../../internal/animate.js";import{observeResize as i}from"../../internal/observe.js";import{cx as s}from"../../internal/styles.js";export const AnimateMarquee=/*@__PURE__*/t.forwardRef(function({duration:o,delay:
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import*as t from"react";import{isInfinite as a,lengthValue as r,useAnimationRun as n}from"../../internal/animate.js";import{observeResize as i}from"../../internal/observe.js";import{cx as s}from"../../internal/styles.js";export const AnimateMarquee=/*@__PURE__*/t.forwardRef(function({duration:o,delay:l=0,repeat:m="infinite",alternate:u,paused:c,trigger:d="mount",play:f,once:p=!0,threshold:h=.2,easing:v,orientation:g="horizontal",reverse:y=!1,speed:b=60,gap:j="2rem",copies:q=2,pauseOnHover:x=!0,className:M,style:N,children:R,...S},k){const w=n({trigger:d,play:f,once:p,threshold:h,paused:c,infinite:a(m)}),A=t.useRef(null),C=t.useRef(null),[G,H]=t.useState(0),$="vertical"===g;t.useEffect(()=>{const e=A.current,t=C.current;if(!e||!t)return;const a=()=>{const a=getComputedStyle(e),r=parseFloat($?a.rowGap:a.columnGap)||0,n=$?t.offsetHeight:t.offsetWidth;H(n+r)};a();const r=i(t,a),n=i(e,a);return()=>{r(),n()}},[$,j]);const z=o??(G>0?G/b*1e3:12e3),E=w.ref,F=t.useCallback(e=>{A.current=e,E(e),"function"==typeof k?k(e):k&&(k.current=e)},[k,E]);return e("div",{ref:F,className:s("neba-marquee",$&&"neba-marquee-vertical",M),style:{"--n-anim-gap":r(j),...v?{"--n-anim-ease":v}:{},"--n-anim-duration":`${Math.round(z)}ms`,"--n-anim-delay":`${l}ms`,"--n-anim-repeat":"infinite"===m?"infinite":String(m),"--n-anim-direction":y?u?"alternate-reverse":"reverse":u?"alternate":"normal","--n-anim-state":w.state,...N},"data-neba-animation":"marquee","data-state":w.state,"data-pause-on-hover":x?"":void 0,...w.handlers,...S,children:Array.from({length:Math.max(1,q)},(t,a)=>(t=>e("div",{ref:0===t?C:void 0,className:"neba-marquee-track","aria-hidden":0===t?void 0:"true",children:R},t))(a))})});
|