@a4ui/core 0.38.1 → 0.39.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.
Files changed (129) hide show
  1. package/README.md +66 -9
  2. package/dist/{Collapse-Cr5cDqAl.js → Collapse-CrKiFD8K.js} +173 -124
  3. package/dist/charts/Sparkline.d.ts +2 -0
  4. package/dist/charts.js +8 -5
  5. package/dist/commerce.js +59 -59
  6. package/dist/elements.css +248 -151
  7. package/dist/elements.iife.js +1 -1
  8. package/dist/elements.js +1025 -1015
  9. package/dist/full.css +248 -151
  10. package/dist/index.d.ts +2 -1
  11. package/dist/index.js +4723 -4656
  12. package/dist/lib/anchored.d.ts +7 -0
  13. package/dist/lib/direction.d.ts +18 -0
  14. package/dist/styles.css +27 -11
  15. package/dist/theme.css +1559 -0
  16. package/dist/ui/DirectionProvider.d.ts +47 -0
  17. package/dist/ui/Drawer.d.ts +6 -2
  18. package/dist/ui/Sidebar.d.ts +8 -2
  19. package/dist/ui/Toast.d.ts +5 -1
  20. package/package.json +5 -3
  21. package/preset.d.ts +2 -1
  22. package/preset.js +16 -5
  23. package/src/charts/BarList.tsx +1 -1
  24. package/src/charts/Sparkline.tsx +5 -1
  25. package/src/commerce/CartLine.tsx +1 -1
  26. package/src/commerce/FacetSidebar.tsx +1 -1
  27. package/src/commerce/ProductCard.tsx +1 -1
  28. package/src/index.ts +7 -1
  29. package/src/layout/NavGroup.tsx +2 -2
  30. package/src/lib/anchored.ts +13 -0
  31. package/src/lib/direction.ts +35 -0
  32. package/src/ui/Accordion.tsx +2 -2
  33. package/src/ui/ActivityFeed.tsx +2 -2
  34. package/src/ui/AlertDialog.tsx +2 -1
  35. package/src/ui/Anchor.tsx +1 -1
  36. package/src/ui/AnnouncementBar.tsx +3 -3
  37. package/src/ui/ArtifactPanel.tsx +1 -1
  38. package/src/ui/AvailabilityPicker.tsx +2 -2
  39. package/src/ui/AvatarGroup.tsx +2 -2
  40. package/src/ui/BackToTop.tsx +1 -1
  41. package/src/ui/Badge.tsx +1 -1
  42. package/src/ui/BlockEditor.tsx +1 -1
  43. package/src/ui/ButtonGroup.tsx +1 -1
  44. package/src/ui/Callout.tsx +1 -1
  45. package/src/ui/Carousel.tsx +17 -9
  46. package/src/ui/Cascader.tsx +2 -2
  47. package/src/ui/CategoryStrip.tsx +4 -1
  48. package/src/ui/CodeEditor.tsx +5 -5
  49. package/src/ui/CodeTabs.tsx +1 -1
  50. package/src/ui/Combobox.tsx +2 -1
  51. package/src/ui/Command.tsx +3 -2
  52. package/src/ui/Comment.tsx +1 -1
  53. package/src/ui/Configurator.tsx +2 -2
  54. package/src/ui/ContextMenu.tsx +2 -1
  55. package/src/ui/DateField.tsx +4 -4
  56. package/src/ui/DateRangePicker.tsx +4 -4
  57. package/src/ui/DiffViewer.tsx +4 -3
  58. package/src/ui/DirectionProvider.tsx +82 -0
  59. package/src/ui/Drawer.tsx +23 -5
  60. package/src/ui/Dropdown.tsx +2 -1
  61. package/src/ui/EmojiPicker.tsx +5 -2
  62. package/src/ui/Expandable.tsx +2 -2
  63. package/src/ui/Faq.tsx +1 -1
  64. package/src/ui/Field.tsx +1 -1
  65. package/src/ui/FloatingActionButton.tsx +2 -2
  66. package/src/ui/FollowingPointer.tsx +2 -2
  67. package/src/ui/Hero.tsx +2 -2
  68. package/src/ui/HoldToConfirm.tsx +2 -2
  69. package/src/ui/HoverCard.tsx +2 -1
  70. package/src/ui/Image.tsx +3 -2
  71. package/src/ui/InlineSelect.tsx +1 -1
  72. package/src/ui/InputGroup.tsx +2 -2
  73. package/src/ui/Item.tsx +1 -1
  74. package/src/ui/JsonViewer.tsx +2 -2
  75. package/src/ui/Kanban.tsx +1 -1
  76. package/src/ui/KpiBlock.tsx +1 -1
  77. package/src/ui/Lightbox.tsx +9 -6
  78. package/src/ui/MasterDetail.tsx +1 -1
  79. package/src/ui/Mentions.tsx +1 -1
  80. package/src/ui/Menubar.tsx +9 -8
  81. package/src/ui/Modal.tsx +3 -2
  82. package/src/ui/ModelPicker.tsx +2 -1
  83. package/src/ui/MultiSelect.tsx +5 -5
  84. package/src/ui/NativeSelect.tsx +2 -2
  85. package/src/ui/NavigationMenu.tsx +5 -4
  86. package/src/ui/NotificationCenter.tsx +1 -1
  87. package/src/ui/NotificationStack.tsx +1 -1
  88. package/src/ui/NumberInput.tsx +2 -2
  89. package/src/ui/OnboardingChecklist.tsx +2 -2
  90. package/src/ui/Pagination.tsx +2 -2
  91. package/src/ui/PillSearch.tsx +3 -3
  92. package/src/ui/PivotTable.tsx +0 -0
  93. package/src/ui/Popover.tsx +2 -1
  94. package/src/ui/Portal.tsx +3 -1
  95. package/src/ui/PresenceAvatars.tsx +4 -4
  96. package/src/ui/PricingTable.tsx +1 -1
  97. package/src/ui/Prose.tsx +3 -3
  98. package/src/ui/QueryBuilder.tsx +4 -4
  99. package/src/ui/Rating.tsx +6 -2
  100. package/src/ui/ReasoningTrace.tsx +1 -1
  101. package/src/ui/ScrollArea.tsx +1 -1
  102. package/src/ui/ScrollProgress.tsx +2 -2
  103. package/src/ui/SideRail.tsx +3 -3
  104. package/src/ui/Sidebar.tsx +43 -23
  105. package/src/ui/SlashMenu.tsx +1 -1
  106. package/src/ui/Snippet.tsx +6 -3
  107. package/src/ui/Sortable.tsx +1 -1
  108. package/src/ui/SpecSheet.tsx +1 -1
  109. package/src/ui/SpeedDial.tsx +1 -1
  110. package/src/ui/Splitter.tsx +8 -3
  111. package/src/ui/SpreadsheetGrid.tsx +4 -4
  112. package/src/ui/Stepper.tsx +1 -1
  113. package/src/ui/SuggestionChips.tsx +1 -1
  114. package/src/ui/Switch.tsx +1 -1
  115. package/src/ui/Table.tsx +5 -2
  116. package/src/ui/TimeField.tsx +8 -8
  117. package/src/ui/Timeline.tsx +2 -2
  118. package/src/ui/Toast.tsx +9 -3
  119. package/src/ui/ToolCallTimeline.tsx +2 -2
  120. package/src/ui/Tooltip.tsx +2 -1
  121. package/src/ui/Tour.tsx +1 -1
  122. package/src/ui/TransactionFeed.tsx +1 -1
  123. package/src/ui/Transfer.tsx +2 -2
  124. package/src/ui/Tree.tsx +2 -2
  125. package/src/ui/TreeSelect.tsx +2 -2
  126. package/src/ui/TreeTable.tsx +4 -4
  127. package/src/ui/UsageMeter.tsx +1 -1
  128. package/src/ui/VideoPlayerShell.tsx +2 -2
  129. package/src/ui/internal/CalendarCore.tsx +6 -6
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  [![npm downloads](https://img.shields.io/npm/dm/@a4ui/core.svg)](https://www.npmjs.com/package/@a4ui/core)
12
12
  [![minzipped size](https://img.shields.io/bundlephobia/minzip/@a4ui/core.svg)](https://bundlephobia.com/package/@a4ui/core)
13
13
 
14
- Accessible SolidJS **Spatial Glass** component library — 75+ components,
14
+ Accessible SolidJS **Spatial Glass** component library — 240+ components,
15
15
  layouts, runtime themes, a motion system, **1500+ icons** (lucide), and
16
16
  framework-agnostic Web Components. Named after the 4 people in the Rivera
17
17
  family. 🙂
@@ -35,7 +35,8 @@ Three layers, one identity:
35
35
  npm install @a4ui/core
36
36
  ```
37
37
 
38
- Peer dependency: `solid-js` (>= 1.9).
38
+ Peer dependencies: `solid-js` (>= 1.9) and, optionally, `tailwindcss` (`^3.4.0` or
39
+ `^4.0.0`; the setup differs, see below).
39
40
 
40
41
  **Starting fresh?** Scaffold a preconfigured Solid + Vite + A4ui app (with or
41
42
  without Tailwind):
@@ -47,7 +48,33 @@ npm create a4ui@latest my-app
47
48
 
48
49
  ## Use
49
50
 
50
- **With Tailwind** (recommended) — add the A4ui preset so the components'
51
+ **With Tailwind 4** — import `@a4ui/core/theme.css` after Tailwind in your CSS, and
52
+ nothing else. It carries the tokens, the glass classes, the `light:` variant and
53
+ the `@source` that scans the components:
54
+
55
+ ```css
56
+ /* src/index.css */
57
+ @import 'tailwindcss';
58
+ @import '@a4ui/core/theme.css';
59
+ ```
60
+
61
+ ```tsx
62
+ import './index.css'
63
+ import { Button } from '@a4ui/core'
64
+
65
+ export default () => <Button variant="primary">Save</Button>
66
+ ```
67
+
68
+ Tailwind 4 ignores `tailwind.config.js` and its `presets:` unless `@config` names
69
+ it, so the Tailwind 3 setup below builds without error on Tailwind 4 and produces
70
+ no A4ui styles. If you see unstyled components, check this first.
71
+
72
+ `theme.css` pins the scales the components were written for, so in your own code
73
+ `shadow-sm`, `rounded-sm`, `blur-sm`, `ring`, the default palette and the default
74
+ border color mean what they mean in Tailwind 3 (details in
75
+ [`INTEGRATIONS.md`](./INTEGRATIONS.md#tailwind-4)).
76
+
77
+ **With Tailwind 3** — add the A4ui preset so the components'
51
78
  utilities and glass classes (`bg-primary/90`, `.card`, `.glow-edge`) resolve
52
79
  against A4ui's tokens, and import the token stylesheet once:
53
80
 
@@ -78,7 +105,8 @@ import { Button } from '@a4ui/core'
78
105
  ```
79
106
 
80
107
  (`styles.css` ships only the CSS variables + motion keyframes — it needs the
81
- Tailwind preset to generate the component utilities; `full.css` is the
108
+ Tailwind 3 preset to generate the component utilities; `theme.css` already includes it;
109
+ `full.css` is the
82
110
  self-contained alternative. The framework-agnostic `elements` bundle ships its
83
111
  own precompiled CSS too.)
84
112
 
@@ -108,7 +136,7 @@ Browse the full set at [lucide.dev/icons](https://lucide.dev/icons).
108
136
 
109
137
  A4ui is **tree-shakeable** — `sideEffects` is `["**/*.css"]`, so the only thing
110
138
  that lands in your bundle is what you actually `import`. You never pay for the
111
- 75+ components you don't use, and adding components to the library **doesn't grow
139
+ 240+ components you don't use, and adding components to the library **doesn't grow
112
140
  your app**. Import à la carte:
113
141
 
114
142
  ```tsx
@@ -122,11 +150,12 @@ Approximate **gzipped** weights (measured on 0.13.0; JS excludes the `solid-js`,
122
150
  | ----------------------------------------------------- | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
123
151
  | **First component** (e.g. `Button` + the `cn` helper) | ~10–11 kB | One-time baseline (includes `tailwind-merge`). Shared by every component. |
124
152
  | **Typical extra primitive** | ~0.1–0.5 kB | `Button` alone 10.7 kB → `Button + Card + Badge + Input` 11.1 kB. Heavier ones (`DataGrid`, `Calendar`, `Combobox`, `Tour`) cost more via their Kobalte/behavior deps. |
125
- | **Whole barrel** (`@a4ui/core`, all 75+ used) | ~53.0 kB | Only if you literally import everything — the realistic ceiling. |
153
+ | **Whole barrel** (`@a4ui/core`, everything used) | ~53.0 kB | Only if you literally import everything — the realistic ceiling. |
126
154
  | `@a4ui/core/commerce` | ~3.0 kB | ProductCard, CartSummary, PriceTag… |
127
155
  | `@a4ui/core/charts` | ~2.5 kB | Sparkline, BarChart, DonutChart (native SVG). |
128
156
  | `@a4ui/core/styles.css` | ~5.3 kB | Tokens + motion keyframes (needs the Tailwind preset for utilities). |
129
157
  | `@a4ui/core/full.css` | ~14.1 kB | Every utility precompiled — for **no-Tailwind** apps. With Tailwind, your own purge ships far less. |
158
+ | `@a4ui/core/theme.css` | ~8 kB | Tailwind 4 entry: tokens, motion, starfield and glass rules, all emitted. Your Tailwind build adds the utilities. |
130
159
  | `@a4ui/core/elements` (Web Components) | ~63.9 kB JS + ~14 kB CSS | Self-contained (Solid + motion compiled in). For React/Vue/vanilla. |
131
160
  | `motion` (the animation engine) | ~45 kB | **External / opt-in** — pulled in **only** if you import an animated component (`Stat`, `HoldToConfirm`, `Curtain`, `Parallax`, `ScrambleText`, `FillText`, `TextReveal`, `NotificationStack`, `MultiStateBadge`, `Expandable`, `Magnetic`, `ScrollProgress`, `GradientText`, `SpeedDial`, or the `flyToCart`/`animate`/`createCountUp` helpers). Engine-free ones (`LoadingDots`, `NowPlaying`, `Typewriter`, `Spotlight`, `Ripple`, `TiltCard` — CSS/WAAPI) and static UIs never load it; that's also why `<Button ripple>` and `<Card tilt spotlight>` cost nothing. |
132
161
 
@@ -180,9 +209,36 @@ recolors live, then copy the exported CSS or JSON and apply it as a
180
209
  `ThemeDefinition`. This is separate from the light/dark `setTheme`/`toggleTheme`
181
210
  mode switch — a theme recolors underneath either mode.
182
211
 
212
+ ### Right-to-left
213
+
214
+ Wrap the app (or any subtree) in `DirectionProvider`. It sets `dir` on the DOM,
215
+ tells Kobalte which way arrow keys move (Tabs, Menubar, Slider, menus), and
216
+ copies the direction onto overlays that render in `<body>` (Modal, Drawer,
217
+ Popover, Dropdown, Tooltip, Command):
218
+
219
+ ```tsx
220
+ import { DirectionProvider, useDirection } from '@a4ui/core'
221
+
222
+ render(
223
+ () => (
224
+ <DirectionProvider dir="rtl" locale="ar">
225
+ <App />
226
+ </DirectionProvider>
227
+ ),
228
+ document.getElementById('root')!,
229
+ )
230
+ ```
231
+
232
+ Components use logical Tailwind utilities (`ms-*`, `start-*`, `text-start`), so
233
+ nothing else needs configuring. Mount `<Toaster />` inside the provider. `Drawer`
234
+ and `Sidebar` take `side="start" | "end"`, which follows the direction;
235
+ `Drawer`'s `"left" | "right"` stay physical. Charts, maps, code blocks and
236
+ other geometry-bound widgets keep their own left-to-right layout. The docs have
237
+ an RTL switch on every example.
238
+
183
239
  ## Components
184
240
 
185
- 75+ components across ten categories (this is a sample — see the
241
+ 240+ components across eleven categories (this is a sample — see the
186
242
  **[docs site](https://a4ui.pages.dev/)** or `src/index.ts` for the
187
243
  full list):
188
244
 
@@ -193,7 +249,7 @@ full list):
193
249
  | Data & display | `Table`, `DataGrid`, `Tree`, `Calendar`, `Timeline`, `Stat`, `Descriptions`, `SpecSheet`, `RatingsSummary`, `LogoWall`, `ChatThread`, `Message`, `Attachment`, `Citation`, `CodeTabs`, `DataView`, `BalanceCard`, `TransactionFeed`, `KpiBlock`, `BlockEditor`, `CalendarHeatmap` |
194
250
  | Navigation | `Tabs`, `Breadcrumb`, `Pagination`, `Command`, `Anchor`, `Stepper`, `BottomNavigation`, `CategoryStrip`, `Spaces`, `SideRail`, `Sidebar`, `NavigationMenu` |
195
251
  | Feedback | `Alert`, `AnnouncementBar`, `Toast`, `Progress`, `Skeleton`, `Empty`, `Result`, `NotificationCenter` |
196
- | Layout | `AppShell`, `SpaceBackground`, `ThemedScenery`, `Card`, `Splitter`, `Affix`, `NavGroup`, `FloatingToolbar`, `ArtifactPanel`, `MasterDetail`, `ScrollArea`, `Item`, `Prose` |
252
+ | Layout | `AppShell`, `SpaceBackground`, `ThemedScenery`, `DirectionProvider`, `Card`, `Splitter`, `Affix`, `NavGroup`, `FloatingToolbar`, `ArtifactPanel`, `MasterDetail`, `ScrollArea`, `Item`, `Prose` |
197
253
  | Commerce | `ProductCard`, `ProductGrid`, `PriceTag`, `PriceBlock`, `QuantityStepper`, `CartLine`, `CartSummary`, `FilterGroup`, `FacetSidebar`, `ConditionScale` |
198
254
  | Charts | `Sparkline`, `BarChart`, `AreaChart`, `PieChart`, `DonutChart`, `RadialBarChart` (native SVG, theme-tinted) |
199
255
  | Sections | `SiteNav`, `Hero`, `FeatureGrid`, `Testimonials`, `Faq`, `CtaBanner`, `ContactSection`, `SiteFooter`, `TeamGrid` (data-driven page blocks: plain props, no JSX required) |
@@ -275,7 +331,8 @@ Drop this into your project's `AGENTS.md` / `CLAUDE.md` to prime your agent:
275
331
 
276
332
  > This project uses **@a4ui/core** (SolidJS "Spatial Glass" design system). Import
277
333
  > components as named exports from `@a4ui/core`; import `@a4ui/core/styles.css`
278
- > once in the app entry; add `@a4ui/core/preset` to `tailwind.config` (optional).
334
+ > once in the app entry; add `@a4ui/core/preset` to `tailwind.config` (optional). On
335
+ > Tailwind 4, `@import '@a4ui/core/theme.css'` after Tailwind replaces both.
279
336
  > Props are typed with JSDoc/`@example` in the package's `.d.ts`.
280
337
  > **For the A4ui look, follow the Spatial Glass recipe** (in `llms.txt` and
281
338
  > https://a4ui.pages.dev/#/guide-spatial-glass): put an `<Aurora/>` backdrop