@nxgt/material 3.35.0 → 3.36.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 (29) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/components/ui/actions/icon-button/icon-button.css +58 -0
  4. package/dist/{components-C9Zz2dir.js → components-C0WjV2oy.js} +16031 -16021
  5. package/dist/components.js +7 -7
  6. package/dist/{dialog-Cdv9IXVo.js → dialog-DR9rACzY.js} +1 -1
  7. package/dist/dnd.js +1 -1
  8. package/dist/editor.js +4 -4
  9. package/dist/{icon-badge-BFScQnp9.js → icon-badge-DXEBeS1y.js} +2 -2
  10. package/dist/{icon-button-ifTpXt0A.js → icon-button-CN9r5TNE.js} +51 -32
  11. package/dist/lib/components/ui/actions/icon-button/icon-button.d.ts +14 -0
  12. package/dist/lib/components/ui/collections/server-table/bulk-action-targets.d.ts +6 -5
  13. package/dist/lib/components/ui/collections/server-table/bulk-action.d.ts +6 -5
  14. package/dist/lib/components/ui/collections/server-table/partials/server-table-bulk-buttons.d.ts +6 -5
  15. package/dist/lib/components/ui/collections/server-table/selected-rows.d.ts +17 -0
  16. package/dist/lib/components/ui/collections/server-table/use-query-selection.d.ts +6 -1
  17. package/dist/lib/components/ui/collections/server-table/use-server-table-selection.d.ts +3 -1
  18. package/dist/lib/components/ui/collections/server-table/use-server-table.d.ts +1 -0
  19. package/dist/main.js +7 -7
  20. package/dist/map.js +3 -3
  21. package/dist/material.css +1 -1
  22. package/dist/pdf-reader.js +1 -1
  23. package/dist/{public-CYdnlHqA.js → public-f9CBkMZP.js} +2 -2
  24. package/dist/{sortable-provider-CY_YD3Ee.js → sortable-provider-BshacF8v.js} +1 -1
  25. package/dist/{use-chat-composer-CoyqPKbt.js → use-chat-composer-C5g_Va_g.js} +3 -3
  26. package/docs/components/buttons-and-actions.md +10 -0
  27. package/docs/components/data-table-filter-and-lists.md +10 -3
  28. package/lib/components/ui/actions/icon-button/icon-button.css +58 -0
  29. package/package.json +1 -1
@@ -1,3 +1,3 @@
1
- import { t as e } from "./public-CYdnlHqA.js";
1
+ import { t as e } from "./public-f9CBkMZP.js";
2
2
  import { configurePdfReader as t } from "@nxgt/material-core/pdf-reader";
3
3
  export { e as PdfReader, t as configurePdfReader };
@@ -6,12 +6,12 @@ import { c as i, i as a, l as o, n as s, o as c, s as l } from "./dist-lmHmz_bu.
6
6
  import { a as u, o as d } from "./tooltip-CkttDIab.js";
7
7
  import { i as f } from "./dist-C4wtXCjf.js";
8
8
  import { r as p, t as m } from "./in-dialog-Vwkyp-M5.js";
9
- import { C as h, D as g, E as _, O as v, S as y, T as b, _ as x, f as S, g as ee, k as te, r as ne, t as C, u as re, w } from "./dialog-Cdv9IXVo.js";
9
+ import { C as h, D as g, E as _, O as v, S as y, T as b, _ as x, f as S, g as ee, k as te, r as ne, t as C, u as re, w } from "./dialog-DR9rACzY.js";
10
10
  import { c as T, d as ie, f as E, i as ae, l as oe, n as se, o as D, t as ce, u as O } from "./dropdown-menu-CpSnRXd-.js";
11
11
  import { S as le, a as k, d as A, g as ue, h as de, i as fe, m as pe, n as j, r as me, t as M, u as he, w as ge } from "./toolbar-items-B1W-uVHS.js";
12
12
  import { t as N } from "./use-material-translation-BK2YYCY3.js";
13
13
  import { t as _e } from "./button-EMWOFSDB.js";
14
- import { n as ve, t as ye } from "./icon-button-ifTpXt0A.js";
14
+ import { n as ve, t as ye } from "./icon-button-CN9r5TNE.js";
15
15
  import { t as be } from "./useEvent-2fKq-6w8.js";
16
16
  import { n as xe, t as Se } from "./toggle-group-BMJNcFAC.js";
17
17
  import { o as Ce } from "./escape-owner-C4W_sOAU.js";
@@ -1,7 +1,7 @@
1
1
  import { t as e } from "./utils-BLfntITJ.js";
2
2
  import { t } from "./dist-DVRQkaTK.js";
3
3
  import { t as n } from "./use-material-translation-BK2YYCY3.js";
4
- import { t as r } from "./icon-button-ifTpXt0A.js";
4
+ import { t as r } from "./icon-button-CN9r5TNE.js";
5
5
  import { t as i } from "./compose-refs-DZ0iIVF-.js";
6
6
  import { GripVertical as a } from "lucide-react";
7
7
  import o, { cloneElement as s, createContext as c, forwardRef as l, memo as u, useCallback as d, useContext as f, useEffect as p, useLayoutEffect as m, useMemo as h, useReducer as g, useRef as _, useState as v } from "react";
@@ -7,7 +7,7 @@ import { a as o, c as s, i as c, l, n as u, o as d, r as f, s as p, t as m } fro
7
7
  import { _ as h, a as g, g as _, h as v, m as y, o as b, p as x, t as S, v as C, y as w } from "./tooltip-CkttDIab.js";
8
8
  import { a as T, i as E, n as D, r as O, t as k } from "./dist-C4wtXCjf.js";
9
9
  import { i as A, n as ee, t as j } from "./in-dialog-Vwkyp-M5.js";
10
- import { A as M, C as N, D as te, E as ne, O as P, S as re, T as ie, _ as F, b as ae, f as oe, g as se, k as I, l as ce, m as le, n as ue, o as de, r as fe, s as pe, t as me, u as he, v as ge, w as _e, x as ve, y as ye } from "./dialog-Cdv9IXVo.js";
10
+ import { A as M, C as N, D as te, E as ne, O as P, S as re, T as ie, _ as F, b as ae, f as oe, g as se, k as I, l as ce, m as le, n as ue, o as de, r as fe, s as pe, t as me, u as he, v as ge, w as _e, x as ve, y as ye } from "./dialog-DR9rACzY.js";
11
11
  import { A as be, C as xe, D as Se, E as Ce, O as we, S as Te, T as Ee, _ as De, a as Oe, b as ke, d as Ae, f as je, g as Me, h as Ne, i as Pe, k as Fe, l as Ie, m as Le, n as Re, o as ze, p as Be, r as Ve, s as He, t as Ue, u as We, v as Ge, w as Ke, x as qe, y as Je } from "./floating-ui.dom-KkZSW8_E.js";
12
12
  import { D as Ye, E as Xe, N as Ze, O as Qe, c as $e, d as et, f as tt, i as nt, k as rt, m as it, n as at, o as ot, p as st, t as ct, u as lt } from "./dropdown-menu-CpSnRXd-.js";
13
13
  import { a as ut, i as dt, n as ft } from "./field-blur-context-Cft9s7Hg.js";
@@ -22,7 +22,7 @@ import { t as L } from "./use-material-translation-BK2YYCY3.js";
22
22
  import { t as Mt } from "./spinner-CKlDba5I.js";
23
23
  import { a as Nt } from "./button-tones-BwuVvAmd.js";
24
24
  import { a as Pt, i as Ft, n as It, r as Lt, t as Rt } from "./button-EMWOFSDB.js";
25
- import { t as R } from "./icon-button-ifTpXt0A.js";
25
+ import { t as R } from "./icon-button-CN9r5TNE.js";
26
26
  import { a as zt, r as Bt } from "./icon-sprites-CaYXzOL4.js";
27
27
  import { t as Vt } from "./use-ssr-media-query-C6M5m8sf.js";
28
28
  import { n as Ht, t as Ut } from "./util-4heV2LPI.js";
@@ -36,7 +36,7 @@ import { n as an } from "./use-slice-reducer-BGkeGtML.js";
36
36
  import { t as on } from "./browser-only-DQ94lWF8.js";
37
37
  import { t as sn } from "./compose-refs-DZ0iIVF-.js";
38
38
  import { n as cn, r as ln, t as un } from "./chip-B6m3yagf.js";
39
- import { n as dn, t as fn } from "./icon-badge-BFScQnp9.js";
39
+ import { n as dn, t as fn } from "./icon-badge-DXEBeS1y.js";
40
40
  import { r as pn } from "./use-csp-nonce-ZKs9k-ov.js";
41
41
  import { t as mn } from "./empty-state-DMr94lsF.js";
42
42
  import { t as hn } from "./skeleton-DSdtr2qc.js";
@@ -159,6 +159,16 @@ import { Pencil, Trash2 } from 'lucide-react';
159
159
  | `aria-label` | `string` | the tooltip, if a string | give one when there is no string tooltip |
160
160
  | `shape` | `ShapeName` | — | draws the button as one of the expressive shapes (`cookie-9`, `sunny`, `squircle`…) instead of a circle; changing it morphs. Unset: the round button, unchanged |
161
161
  | `morph` | `'round' \| 'pill' \| 'none'` | `'pill'` | what a **toggle** (`aria-pressed` set) does when pressed: `pill` fills with its colour and widens by 14 px into a pill, `round` fills and stays a circle, `none` keeps the look your classes give it. Not set on a button without `aria-pressed`, one with a `shape`, or a Toolbar item (the Toolbar's own look) |
162
+ | `badge` | `number` | — | a count on the top end corner (top left in a right-to-left page): "99+" past 99, nothing at 0 or unset. It takes no room, so the box and the 44 px hit area are unchanged. It is **decorative** (`aria-hidden`): put the number in the accessible name yourself, e.g. `aria-label="Publish 2 items"` |
163
+ | `badgeTone` | `'primary' \| 'error' \| 'neutral'` | `'primary'` | the badge's colour: a count is not an alert, so `primary`; `error` for a notification; `neutral` is the page's text colour on its background |
164
+
165
+ **A count badge** (`badge`) is a primary pill (`badgeTone="error"` is the menu-item badge's red), ringed in the page background so it reads over any variant, and sits half outside the corner, over the neighbours' gap (leave 4 px; a `Toolbar` clips 4 px outside its items, so leave room there too). It does not dim when the button is disabled. It never names itself: `<IconButton badge={2} aria-label="Publish 2 items">`. `Button` has no `badge`: its label can be cut with an ellipsis and an `asChild` one clips, so compose a `CountBadge` around it.
166
+
167
+ ```tsx
168
+ <IconButton badge={count} aria-label={`Publish ${count} items`}>
169
+ <Send />
170
+ </IconButton>
171
+ ```
162
172
 
163
173
  **A toggle button** fills with the button's `color` (`primary` by default) through `data-selected` and the fill `Button` shares, and a pointer down squeezes the corners; `pill` widens the button itself by 14 px (its neighbours move by the 14 px), at any `size` (give the button a `size`, not a `size-*` class: the pressed width follows the `size`, see [troubleshooting](../troubleshooting.md#a-pill-iconbutton-toggle-is-the-wrong-width-with-a-size--class)). Below 600 px wide only the colour changes, so a phone row never reflows; `prefers-reduced-motion` keeps the colour change only; in forced colours the pressed fill is `SelectedItem`. The pressed fill and corners are the button's own (a `bg-*` or `rounded-*` class on a pressed toggle does not apply); a ghost toggle without a `color` is neutral when selected (a tint of the text colour), and primary only with a `color`. The focus is a 2 px outline 2 px off the button, a disabled button has a neutral 12 % fill (none on `ghost` and `link`), and on a coarse pointer every size has a 44 px hit area. The morph works with a `tooltip` too (the styles match `data-icon-button`, which the tooltip trigger does not replace). The date picker's input-mode switch uses `morph="round"`; `PasswordField`'s eye, which sits inside its field, and `RichChatComposer`'s format toggle, which draws its own pressed look, use `morph="none"`; the mini player's move button and the Gallery viewer's repeat are pills too, white with a black icon on their dark chrome. `CodeEditor`'s word-wrap pill takes the editor theme's tint.
164
174
 
@@ -868,9 +868,16 @@ export default function Students() {
868
868
  archived show no "Restore". `onClick(ids, selection, rows)` receives only
869
869
  those ids and rows. An action without `appliesTo` applies to the whole
870
870
  selection: it shows the selection's size and gets every id. **Across
871
- pages:** `appliesTo` sees the loaded page's rows only, so a row selected on
872
- another page is neither counted nor passed by an action that has one; an
873
- action without it still gets every selected id.
871
+ pages:** `ServerTable` keeps the row last seen for each selected id, taken
872
+ when the row was ticked and refreshed each time it is on screen again (so
873
+ after a mutation the bar sees its current state). `appliesTo`, the counts
874
+ and `onClick(ids, selection, rows)` use these rows for every selected id,
875
+ whatever page is shown: 3 archived rows ticked on page 1 and 2 live ones on
876
+ page 2 read "Restore (3)" and "Archive (2)" on either page. An id selected
877
+ with no row ever seen does not apply to an action that has `appliesTo`
878
+ (an action without it still gets every selected id). A row's snapshot is
879
+ dropped when it is deselected, when the selection is cleared and when the
880
+ query changes.
874
881
  ```tsx
875
882
  <ServerTable<Item>
876
883
  {...props}
@@ -113,3 +113,61 @@
113
113
  }
114
114
  }
115
115
  }
116
+
117
+ /* The `badge` count: on the top end corner (logical edges, so a right-to-left
118
+ * page mirrors it), outside the box so the button keeps its size, and
119
+ * `pointer-events: none` so the 44px hit area (button.css) stays the button's.
120
+ * Fill and text follow `badgeTone` (primary by default; error is the menu-item badge's `bg-error` under `text-error-foreground`);
121
+ * a ring in the page background detaches it from the fill of any variant. It
122
+ * does not follow the button's hover, focus, disabled or pressed look. */
123
+ @layer utilities {
124
+ .nxgt-icon-button-badge {
125
+ position: absolute;
126
+ inset-block-start: -0.25rem;
127
+ inset-inline-end: -0.25rem;
128
+ box-sizing: border-box;
129
+ display: inline-flex;
130
+ align-items: center;
131
+ justify-content: center;
132
+ block-size: 1rem;
133
+ min-inline-size: 1rem;
134
+ padding-inline: 0.25rem;
135
+ border-radius: 9999px;
136
+ /* The text-safe primary (AA on the page, light and dark) under the page
137
+ * colour: the plain fill is 2.7:1 against the dark page's ring. */
138
+ background: var(--color-primary-text);
139
+ color: var(--color-background);
140
+ box-shadow: 0 0 0 2px var(--color-background);
141
+ font-size: 10px;
142
+ font-weight: 500;
143
+ line-height: 1;
144
+ font-variant-numeric: tabular-nums;
145
+ white-space: nowrap;
146
+ pointer-events: none;
147
+ z-index: 1;
148
+ }
149
+ .nxgt-icon-button-badge[data-tone="error"] {
150
+ background: var(--color-error);
151
+ color: var(--color-error-foreground);
152
+ }
153
+ .nxgt-icon-button-badge[data-tone="neutral"] {
154
+ background: var(--color-foreground);
155
+ color: var(--color-background);
156
+ }
157
+ /* The 24px button: a smaller badge, further out, so it leaves the icon. */
158
+ [data-size="xs"] > .nxgt-icon-button-badge {
159
+ block-size: 0.875rem;
160
+ min-inline-size: 0.875rem;
161
+ padding-inline: 0.1875rem;
162
+ inset-block-start: -0.4375rem;
163
+ inset-inline-end: -0.4375rem;
164
+ }
165
+ @media (forced-colors: active) {
166
+ .nxgt-icon-button-badge {
167
+ border: 1px solid CanvasText;
168
+ background: Highlight;
169
+ color: HighlightText;
170
+ forced-color-adjust: none;
171
+ }
172
+ }
173
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxgt/material",
3
- "version": "3.35.0",
3
+ "version": "3.36.0",
4
4
  "license": "MIT",
5
5
  "bugs": {
6
6
  "email": "stevegires@gmail.com"