@wirecore/wirelayer-react 0.10.0 → 0.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/llms-full.txt CHANGED
@@ -82,6 +82,8 @@ Fixed in a corner of the window, e.g. a help or chat button
82
82
  | --- | --- | --- |
83
83
  | position? | `'bottom-end' \| 'bottom-start' \| 'top-end' \| 'top-start'` | Corner of the window (default bottom-end) |
84
84
  | offset? | `string` | Distance from the edges, e.g. "1rem" (default 1.5rem) |
85
+ | offsetX? | `string` | Distance from the side edge (start/end) only, e.g. "1rem" – instead of `offset` |
86
+ | offsetY? | `string` | Distance from the top or bottom edge only, e.g. "4rem" above a banner – instead of `offset` |
85
87
  | classes? | `RecipeClasses<typeof affixRecipe>` | Extra classes per part of the component, e.g. { base: "…" } (see the recipe) |
86
88
 
87
89
  ### AiLabel
@@ -1413,7 +1415,7 @@ Data table on TanStack Table: sorting (also by several columns), search, filter
1413
1415
  - Import: `import { DataTable } from '@wirecore/wirelayer-react/data-table'`
1414
1416
  - Category: Data
1415
1417
  - Example: https://wirecore.github.io/WireLayer/?path=/story/react_data-datatable--playground
1416
- - Also takes: Omit< ComponentProps<'div'>, 'children' | 'ref' | 'contextMenu' | 'onScrollEnd' | 'onRowClick' >
1418
+ - Also takes: Omit< ComponentProps<'div'>, 'children' | 'ref' | 'contextMenu' | 'onScroll' | 'onScrollEnd' | 'onRowClick' >
1417
1419
 
1418
1420
  | Prop | Type | Description |
1419
1421
  | --- | --- | --- |
@@ -1535,6 +1537,7 @@ Data table on TanStack Table: sorting (also by several columns), search, filter
1535
1537
  | rowHeight? | `number` | Estimated row height in px for `virtual` |
1536
1538
  | onLoadMore? | `() => void` | Scrolled near the end (`scrollHeight`) – load more rows (infinite scrolling) |
1537
1539
  | onScrollEnd? | `() => void` | |
1540
+ | onScroll? | `(event: UIEvent<HTMLDivElement>) => void` | The table's scroll area scrolled (down/up with `scrollHeight`, sideways when wider) – e.g. to close a popover anchored in a row that virtual scrolling removes |
1538
1541
  | stateKey? | `string` | Keeps sorting, filters, page, widths, order and the other settings in the browser under this key |
1539
1542
  | stateStorage? | `'local' \| 'session'` | |
1540
1543
  | stateExclude? | `readonly DataTableStateKey[]` | Parts of the state that `stateKey` does not keep – default: the selection (`[]` keeps it, too) |
@@ -3348,9 +3351,9 @@ Bell with the unread count (part of its name) that opens the notifications in a
3348
3351
  | now? | `Date \| string` | Reference time for "Today"/"Yesterday" (default: now) |
3349
3352
  | emptyText? | `string` | Text without notifications (default "No notifications") |
3350
3353
  | onMarkRead? | `(id: string) => void` | Mark one item as read |
3351
- | onMarkAllRead? | `() => void` | |
3354
+ | onMarkAllRead? | `(ids: string[]) => void` | "Mark all as read": the ids of the unread items shown – e.g. for one request to the server |
3352
3355
  | onLoadMore? | `() => void` | Load the next page (hasMore) |
3353
- | onSelect? | `(item: NotificationItem, event: MouseEvent<HTMLAnchorElement>) => void` | The title link of an item was clicked |
3356
+ | onSelect? | `(item: NotificationItem, event: MouseEvent<HTMLAnchorElement \| HTMLButtonElement>) => void` | The title of an item was clicked: its link, or its button (`clickable` without `href`) |
3354
3357
  | renderActions? | `(item: NotificationItem) => ReactNode` | Own buttons per item (before "mark as read") |
3355
3358
  | classes? | `RecipeClasses<typeof notificationCenterRecipe>` | Extra classes per part of the component, e.g. { base: "…" } (see the recipe) |
3356
3359
 
@@ -4383,7 +4386,10 @@ Navigation landmark with links and expandable groups (buttons with aria-expanded
4383
4386
  | --- | --- | --- |
4384
4387
  | items | `readonly SidebarNavItem[]` | |
4385
4388
  | label | `string` | Name of the navigation landmark, e.g. "Main navigation" |
4386
- | onNavigate? | `(item: SidebarNavItem, event: MouseEvent<HTMLAnchorElement>) => void` | A link was clicked – call event.preventDefault() and route yourself in a single-page app |
4389
+ | onNavigate? | `(item: SidebarNavItem, event: MouseEvent<HTMLAnchorElement>) => void` | A link was clicked – call event.preventDefault() and route yourself in a single-page app (or use `linkAs`) |
4390
+ | linkAs? | `ElementType` | Component for the links, e.g. Link of React Router or Next.js (gets `to` for items with `to`, else `href`); default <a> |
4391
+ | currentHref? | `string` | Path of the current page – the item with exactly this href gets aria-current="page" (its groups start open) |
4392
+ | isCurrent? | `(item: SidebarNavItem) => boolean` | Own check for the current page, e.g. with the router |
4387
4393
  | rail? | `boolean` | Icons only, the labels as tooltips (and for screen readers). Default: the collapsed state of a surrounding AppShell (navbarCollapsed) |
4388
4394
  | expandOnHover? | `boolean` | With `rail`: hovering or focusing the rail shows the labels (no tooltips) – default from the AppShell |
4389
4395
  | header? | `ReactNode` | Above the links, e.g. a logo or a switcher |
@@ -4544,6 +4550,7 @@ Sortable list: every item has a handle – drag it, or press Space/Enter, move w
4544
4550
  | orientation? | `SortableOrientation` | vertical (default), horizontal or grid (with `columns`) |
4545
4551
  | columns? | `number` | Columns of the grid |
4546
4552
  | accepts? | `(item: T, from: string) => boolean` | Whether an item from another list of the group may come in |
4553
+ | clone? | `(item: T) => unknown` | Makes the list a source (e.g. a palette): dragging an item out copies it – this function makes the copy, e.g. with a new id. The list keeps its items, takes none in and is not sorted. |
4547
4554
  | animate? | `boolean` | Items glide to their new place when they move (default: yes; not with reduced motion) |
4548
4555
  | disabled? | `boolean` | |
4549
4556
  | emptyText? | `string` | Text of an empty list (it stays a drop target) |
@@ -5264,6 +5271,9 @@ Step-by-step introduction: each step is a dialog next to its element (focus move
5264
5271
  | steps | `readonly TourStep[]` | |
5265
5272
  | open? | `boolean` | Running – starting it sets it, the tour ends itself |
5266
5273
  | onOpenChange? | `(open: boolean) => void` | |
5274
+ | step? | `string \| null` | Id of the step shown, null while the tour does not run; setting it moves there |
5275
+ | onStepChange? | `(step: string \| null) => void` | |
5276
+ | missingTarget? | `'skip' \| 'dialog'` | A step whose target is not there (after `waitFor`): skip it (default) or show it as a centred dialog |
5267
5277
  | onComplete? | `() => void` | |
5268
5278
  | classes? | `RecipeClasses<typeof tourRecipe>` | Extra classes per part of the component, e.g. { base: "…" } (see the recipe) |
5269
5279
 
@@ -6466,6 +6476,59 @@ suggestThemeFixes(brand);
6466
6476
  // on: { token: 'on-primary', value: '#050505', ratio: 8.1 } }, …]
6467
6477
  ```
6468
6478
 
6479
+ ### Second brand color and hover color
6480
+
6481
+ Three more tokens are optional – a theme sets them only when it needs them. Without them they follow another token, so
6482
+ a theme without them looks as before:
6483
+
6484
+ | Token | Without it | Used by |
6485
+ | --------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- |
6486
+ | `accent` | `primary` | A second brand color for your own markup: `bg-accent`, `text-accent`, `border-accent` (no component uses it) |
6487
+ | `on-accent` | `on-primary` | Text on the accent: `text-on-accent` |
6488
+ | `primary-hover` | see right | Hover of the primary color: the fill of solid primary buttons (else the fill fades to 85 %) and the text of tinted ones (else it stays `primary`) |
6489
+
6490
+ `primary-hover` is the answer to a strong brand color: a fill that fades on hover, or a tint behind the text, can drop
6491
+ it below 4.5:1 although the color itself passes. Tinted means `soft`, `outline` and `text` buttons in the primary color
6492
+ and avatar buttons with `color="primary"`.
6493
+
6494
+ ```ts
6495
+ export const brand = defineTheme({
6496
+ name: 'brand',
6497
+ label: 'Brand',
6498
+ colors: {
6499
+ light: {
6500
+ primary: '#a33d00',
6501
+ 'on-primary': '#FFFFFF',
6502
+ 'primary-hover': '#8a3300',
6503
+ accent: '#00696d',
6504
+ 'on-accent': '#FFFFFF',
6505
+ },
6506
+ dark: {
6507
+ primary: '#e95a00',
6508
+ 'on-primary': '#050505',
6509
+ 'primary-hover': '#f5772a',
6510
+ accent: '#2aa0a5',
6511
+ 'on-accent': '#050505',
6512
+ },
6513
+ },
6514
+ });
6515
+ ```
6516
+
6517
+ `checkTheme` checks the accent (text on it, and as text on `bg`, `bg-2` and `card`) once a theme sets `accent` or
6518
+ `on-accent` in a mode. The hover pairs of the primary color use `primary-hover` when it is set, and `suggestThemeFixes`
6519
+ suggests one `primary-hover` that meets all of them, before it would change `primary` itself.
6520
+
6521
+ **Changed with `@wirecore/wirelayer-tokens` 0.6 and `@wirecore/wirelayer-recipes` 0.9:**
6522
+
6523
+ - Solid primary buttons without `primary-hover` fade only their fill on hover (`color-mix`, 85 %); before, the whole
6524
+ button faded with `opacity`, the text included. In the bundled themes this looks the same – the text has the color
6525
+ of the page – and the contrast is never lower. Solid success, danger, info, warn and contrast buttons still fade with
6526
+ `opacity`.
6527
+ - `checkTheme` checks tinted primary text at rest as well: `soft primary: text-primary on bg-primary/10` (on `bg`,
6528
+ `bg-2`, `card`) and `avatar primary: text-primary on primary/14 (card)`. Before, the stricter hover pairs covered
6529
+ them; with `primary-hover` the hover has a text color of its own. A theme that missed a tinted hover may therefore be
6530
+ reported for these pairs as well.
6531
+
6469
6532
  ### Component sizes and shapes
6470
6533
 
6471
6534
  Besides the colors, a few measures that a brand usually changes are CSS variables. Without them every component looks as
package/llms.txt CHANGED
@@ -313,4 +313,5 @@ Full API (props, events, slots, examples) in llms-full.txt next to this file. MC
313
313
  - Pitfalls
314
314
  - Desktop apps (dense UI, many dialogs)
315
315
  - Custom theme
316
+ - Second brand color and hover color
316
317
  - Component sizes and shapes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirecore/wirelayer-react",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "description": "WireLayer components for React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -166,8 +166,8 @@
166
166
  "dependencies": {
167
167
  "@ark-ui/react": "^5.39.3",
168
168
  "@internationalized/date": "^3.12.4",
169
- "@wirecore/wirelayer-recipes": "^0.8.1",
170
- "@wirecore/wirelayer-tokens": "^0.5.1",
169
+ "@wirecore/wirelayer-recipes": "^0.10.0",
170
+ "@wirecore/wirelayer-tokens": "^0.6.0",
171
171
  "lucide-react": "^1.59.0"
172
172
  },
173
173
  "devDependencies": {