@underpin/ui 2.0.0 → 2.2.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-more.js","names":[],"sources":["../../src/lib/load-more.ts"],"sourcesContent":["\"use client\"\n\nimport { useEffect } from \"react\"\n\nexport interface LoadMoreOptions {\n /** False while a page is in flight, when there is no next page, or after a failed page. */\n enabled: boolean\n onLoad: () => void\n /** How far below the viewport the sentinel starts loading, in pixels. */\n ahead?: number\n}\n\n/**\n * Loads the next page as `sentinel` scrolls into view. The observer is dropped while a page is\n * in flight and set up again after it lands: observing fires straight away for an element\n * already on screen, which is what walks a fast scroll on through page after page. Pass the\n * element through a state setter (`ref={setSentinel}`), so the hook sees it once it mounts.\n */\nexport function useLoadMore(sentinel: Element | null, { enabled, onLoad, ahead }: LoadMoreOptions) {\n useEffect(() => {\n if (!sentinel || !enabled) return\n const observer = new IntersectionObserver(\n entries => {\n if (entries.some(entry => entry.isIntersecting)) onLoad()\n },\n ahead === undefined ? undefined : { rootMargin: `0px 0px ${ahead}px 0px` },\n )\n observer.observe(sentinel)\n return () => observer.disconnect()\n }, [sentinel, enabled, onLoad, ahead])\n}\n"],"mappings":";;;;;;;;;AAkBA,SAAgB,YAAY,UAA0B,EAAE,SAAS,QAAQ,SAA0B;CACjG,gBAAgB;EACd,IAAI,CAAC,YAAY,CAAC,SAAS;EAC3B,MAAM,WAAW,IAAI,sBACnB,YAAW;GACT,IAAI,QAAQ,MAAK,UAAS,MAAM,cAAc,GAAG,OAAO;EAC1D,GACA,UAAU,KAAA,IAAY,KAAA,IAAY,EAAE,YAAY,WAAW,MAAM,QAAQ,CAC3E;EACA,SAAS,QAAQ,QAAQ;EACzB,aAAa,SAAS,WAAW;CACnC,GAAG;EAAC;EAAU;EAAS;EAAQ;CAAK,CAAC;AACvC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@underpin/ui",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "description": "React components on Base UI and Tailwind CSS v4: controls, overlays, forms, charts and the design tokens they share.",
5
5
  "keywords": [
6
6
  "base-ui",
@@ -69,6 +69,14 @@
69
69
  "types": "./lib/media.d.ts",
70
70
  "default": "./lib/media.js"
71
71
  },
72
+ "./load-more": {
73
+ "types": "./lib/load-more.d.ts",
74
+ "default": "./lib/load-more.js"
75
+ },
76
+ "./data-table-state": {
77
+ "types": "./lib/data-table-state.d.ts",
78
+ "default": "./lib/data-table-state.js"
79
+ },
72
80
  "./time-series": {
73
81
  "types": "./lib/time-series.d.ts",
74
82
  "default": "./lib/time-series.js"
@@ -104,6 +112,7 @@
104
112
  "peerDependencies": {
105
113
  "@base-ui/react": ">=1",
106
114
  "@tanstack/react-form": ">=1",
115
+ "@tanstack/react-table": ">=9",
107
116
  "react": ">=19",
108
117
  "react-dom": ">=19",
109
118
  "tailwindcss": ">=4",
@@ -112,6 +121,9 @@
112
121
  "peerDependenciesMeta": {
113
122
  "@tanstack/react-form": {
114
123
  "optional": true
124
+ },
125
+ "@tanstack/react-table": {
126
+ "optional": true
115
127
  }
116
128
  },
117
129
  "_sideEffects": "The stylesheet is a real side effect: `false` let a bundler tree-shake away a consumer's `import \"@underpin/ui/styles.css\"` and ship an unstyled app."
package/styles.css CHANGED
@@ -20,6 +20,17 @@
20
20
  */
21
21
  @source "./";
22
22
 
23
+ /*
24
+ * `ui-pressed`: held down by a pointer or the keyboard, on a control that can run. `ui-standalone`:
25
+ * not a member of a `ButtonGroup`, whose members share their edges and stay in line, so a darker
26
+ * edge or a 1px drop would break the group's outline. Both reach every consumer's Tailwind build
27
+ * through this stylesheet, so they carry the `ui-` prefix to stay clear of a product's own names.
28
+ * `ui-pressed` takes two `:not()`s, not one with a list, to match the specificity of a hover
29
+ * written `hover:not-disabled:not-aria-disabled:`; it comes later in the output, so it wins.
30
+ */
31
+ @custom-variant ui-pressed (&:active:not(:disabled):not([aria-disabled="true"]));
32
+ @custom-variant ui-standalone (&:not([data-slot="button-group"] > *));
33
+
23
34
  /*
24
35
  * Every colour is a `light-dark()` pair, resolved by the element's `color-scheme`: unset follows
25
36
  * the OS, `[data-theme="dark"|"light"]` forces one (see the base layer below). The set has seven