@pathscale/ui 2.11.6 → 2.11.8

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,44 @@
1
+ /*
2
+ * The containing block every component that owns a non-portaled overlay needs.
3
+ *
4
+ * One definition rather than one per component, for the same reason
5
+ * `material.css` exists: Dropdown, Select, Popover, Tooltip, Dialog, Drawer and
6
+ * anything else that opens a floating layer all need exactly this, and copying
7
+ * a one-line rule into seven files is seven places to be wrong in.
8
+ *
9
+ * ## What it is for
10
+ *
11
+ * These overlays are `position: fixed` and live inside their owning component's
12
+ * subtree rather than in a portal. (Portals are what we moved *away* from: under
13
+ * Blitz a portal makes a transient semantic subtree, so an option can paint for
14
+ * one frame and vanish before the next sibling opens.) A fixed child positioned
15
+ * in viewport coordinates routinely lands far outside its parent's box: a
16
+ * 220x239 dropdown menu under a 72x28 pill trigger overhangs by ~267px.
17
+ *
18
+ * A renderer resolves a pointer by descending the box tree, and it descends into
19
+ * a child that escaped its parent's bounds only when the parent carries the
20
+ * hoisted-content area that a *stacking context* provides. `position: relative`
21
+ * alone does not create one unless it also carries a `z-index`. Without a
22
+ * stacking context the overlay paints, reports itself visible to the semantic
23
+ * tree, and silently takes no clicks: hit-testing rejects the descent before it
24
+ * ever reaches the item.
25
+ *
26
+ * That failure is invisible to any check that activates a node semantically
27
+ * rather than by pointer, which is how it shipped: the menu was addressable and
28
+ * the value changed, so the check passed while a real mouse could not click it.
29
+ *
30
+ * `isolation: isolate` exists precisely to create a stacking context with no
31
+ * other visual effect, which is why it is the property used here rather than a
32
+ * `z-index` that would also reorder painting.
33
+ *
34
+ * ## How to use it
35
+ *
36
+ * Import this file and put `ui-overlay-host` on the component's root, alongside
37
+ * whatever positioning that root already sets.
38
+ */
39
+ @layer components {
40
+ .ui-overlay-host {
41
+ position: relative;
42
+ isolation: isolate;
43
+ }
44
+ }
@@ -5,7 +5,7 @@ import { For, Show, createSignal, omit, onCleanup, onSettled } from "solid-js";
5
5
  import { twMerge } from "../../lib/twMerge.js";
6
6
  import { CLASSES, componentRecipe } from "./Dock.recipe.js";
7
7
  var _tmpl$ = /*#__PURE__*/ template("<div>"), _tmpl$2 = /*#__PURE__*/ template("<div><div>"), _tmpl$3 = /*#__PURE__*/ template("<button>"), _tmpl$4 = /*#__PURE__*/ template("<a>"), _tmpl$5 = /*#__PURE__*/ template("<div><!><!>"), _tmpl$6 = /*#__PURE__*/ template("<div><button>"), _tmpl$7 = /*#__PURE__*/ template('<svg><path d="M4 6h16"></path><path d="M4 12h16"></path><path d="M4 18h16">');
8
- const prefersReducedMotion = "u" > typeof window && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
8
+ const prefersReducedMotion = "u" > typeof window && "function" == typeof window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
9
9
  function createSpring(initial, opts = {}) {
10
10
  const mass = opts.mass ?? 1;
11
11
  const stiffness = opts.stiffness ?? 150;
@@ -1,3 +1,5 @@
1
+ @import "../_shared/overlayHost.css";
2
+
1
3
  @layer components {
2
4
  .dropdown {
3
5
  position: relative;
@@ -10,6 +12,20 @@
10
12
  position: relative;
11
13
  isolation: isolate;
12
14
  display: inline-flex;
15
+ /*
16
+ * The border is inside the height a consumer asks for.
17
+ *
18
+ * There is no global `box-sizing` reset in this library, so this element
19
+ * was `content-box`: `height: 24px` set the *content* box and the 1px
20
+ * border on each side was added on top. AgencyZero's composer pill asks
21
+ * for `h-[24px]` and rendered at 28, measured on a running app, which is
22
+ * the sort of few-pixel drift that reads as a component quietly breaking
23
+ * its own contract.
24
+ *
25
+ * `border-box` makes an explicit height mean the height that lands on
26
+ * screen, which is what every caller already assumed.
27
+ */
28
+ box-sizing: border-box;
13
29
  min-height: 2.25rem;
14
30
  width: fit-content;
15
31
  align-items: center;
@@ -34,9 +50,26 @@
34
50
  background-color: var(--dropdown-trigger-bg);
35
51
  color: var(--dropdown-trigger-fg);
36
52
  border-color: var(--dropdown-trigger-border);
37
- box-shadow:
53
+ /*
54
+ * The drop shadow is a variable so a caller can turn it off.
55
+ *
56
+ * `0 1px 2px` paints about 3px below the border box, and a shadow is not
57
+ * part of the box: an element declared `24px` occupies 24px of layout and
58
+ * reports bounds of 27.8. That is correct CSS and still wrong for a pill
59
+ * sized to sit inside a fixed-height composer row, where the visual result
60
+ * reads as the control quietly ignoring its own height. Measured on the
61
+ * running application: border-box 24.1, outer bounds 27.8, with border
62
+ * 0.9 and zero vertical padding - the whole 3.7px difference is this
63
+ * shadow.
64
+ *
65
+ * A variable rather than removal, because a dropdown on an ordinary
66
+ * surface wants the elevation. Set `--dropdown-trigger-shadow: none` on
67
+ * the trigger to opt out.
68
+ */
69
+ --dropdown-trigger-shadow:
38
70
  0 1px 2px rgb(var(--shadow-color, 0 0 0) / 6%),
39
71
  0 1px 0 oklch(100% 0 0 / 0.03) inset;
72
+ box-shadow: var(--dropdown-trigger-shadow);
40
73
  transition:
41
74
  transform 250ms cubic-bezier(0.22, 1, 0.36, 1),
42
75
  background-color 150ms ease,
@@ -1,6 +1,6 @@
1
1
  import type { Component as __LayoutComponent } from "solid-js";
2
2
  import "./Dropdown.css";
3
- import type { JSX } from "@solidjs/web";
3
+ import { type JSX } from "@solidjs/web";
4
4
  import { type OverlayPlacement } from "../_shared/overlayPosition";
5
5
  type DropdownAlign = "start" | "end";
6
6
  type DropdownPlacement = OverlayPlacement;
@@ -1,7 +1,7 @@
1
- import { createComponent, insert, mergeProps, ref, spread, template } from "@solidjs/web";
1
+ import { Portal, createComponent, insert, mergeProps, ref, spread, template } from "@solidjs/web";
2
2
  import { defineComponent } from "solid-layouts/solid-2/application-boundary";
3
3
  import "./Dropdown.css";
4
- import { Show, createContext, createSignal, createTrackedEffect, createUniqueId, omit, onCleanup, onSettled, useContext } from "solid-js";
4
+ import { Show, createContext, createSignal, createTrackedEffect, createUniqueId, flush, omit, onCleanup, onSettled, useContext } from "solid-js";
5
5
  import { twMerge } from "../../lib/twMerge.js";
6
6
  import { createOverlayPosition } from "../_shared/overlayPosition.js";
7
7
  import { CLASSES, componentRecipe } from "./Dropdown.recipe.js";
@@ -117,6 +117,7 @@ const __solidLayoutDropdownRoot = (_stable, p)=>{
117
117
  if (menuRef()?.contains(target)) return;
118
118
  if (triggerRef()?.contains(target)) return;
119
119
  setOpen(false);
120
+ flush();
120
121
  };
121
122
  document.addEventListener("pointerdown", handlePointerDown);
122
123
  return ()=>{
@@ -337,44 +338,48 @@ const __solidLayoutDropdownMenu = (_stable, p)=>{
337
338
  return ctx.open();
338
339
  },
339
340
  get children () {
340
- var _el$6 = _tmpl$3(), _el$7 = _el$6.firstChild;
341
- var _ref$ = ctx.setMenuRef;
342
- "function" == typeof _ref$ || Array.isArray(_ref$) ? ref(()=>_ref$, _el$6) : ctx.setMenuRef = _el$6;
343
- spread(_el$6, mergeProps(others, {
344
- get id () {
345
- return ctx.menuId;
341
+ return createComponent(Portal, {
342
+ get children () {
343
+ var _el$6 = _tmpl$3(), _el$7 = _el$6.firstChild;
344
+ var _ref$ = ctx.setMenuRef;
345
+ "function" == typeof _ref$ || Array.isArray(_ref$) ? ref(()=>_ref$, _el$6) : ctx.setMenuRef = _el$6;
346
+ spread(_el$6, mergeProps(others, {
347
+ get id () {
348
+ return ctx.menuId;
349
+ }
350
+ }, ()=>({
351
+ class: twMerge(CLASSES.slot.popover, p.class)
352
+ }), {
353
+ get role () {
354
+ return p.role ?? "menu";
355
+ },
356
+ "data-slot": "dropdown-popover",
357
+ get ["data-open"] () {
358
+ return ctx.open() ? "true" : "false";
359
+ },
360
+ get ["data-align"] () {
361
+ return p.align ?? "start";
362
+ },
363
+ get ["data-placement"] () {
364
+ return overlayPosition.placement();
365
+ },
366
+ get ["aria-hidden"] () {
367
+ return ctx.open() ? "false" : "true";
368
+ },
369
+ get style () {
370
+ return menuStyle();
371
+ },
372
+ onKeyDown: handleKeyDown
373
+ }), true);
374
+ spread(_el$7, mergeProps(()=>({
375
+ class: CLASSES.slot.menu
376
+ }), {
377
+ "data-slot": "dropdown-menu"
378
+ }), true);
379
+ insert(_el$7, ()=>p.children);
380
+ return _el$6;
346
381
  }
347
- }, ()=>({
348
- class: twMerge(CLASSES.slot.popover, p.class)
349
- }), {
350
- get role () {
351
- return p.role ?? "menu";
352
- },
353
- "data-slot": "dropdown-popover",
354
- get ["data-open"] () {
355
- return ctx.open() ? "true" : "false";
356
- },
357
- get ["data-align"] () {
358
- return p.align ?? "start";
359
- },
360
- get ["data-placement"] () {
361
- return overlayPosition.placement();
362
- },
363
- get ["aria-hidden"] () {
364
- return ctx.open() ? "false" : "true";
365
- },
366
- get style () {
367
- return menuStyle();
368
- },
369
- onKeyDown: handleKeyDown
370
- }), true);
371
- spread(_el$7, mergeProps(()=>({
372
- class: CLASSES.slot.menu
373
- }), {
374
- "data-slot": "dropdown-menu"
375
- }), true);
376
- insert(_el$7, ()=>p.children);
377
- return _el$6;
382
+ });
378
383
  }
379
384
  });
380
385
  };
@@ -1,5 +1,5 @@
1
1
  export declare const CLASSES: {
2
- readonly base: "dropdown";
2
+ readonly base: "dropdown ui-overlay-host";
3
3
  readonly slot: {
4
4
  readonly trigger: "dropdown__trigger";
5
5
  readonly popover: "dropdown__popover";
@@ -1,6 +1,6 @@
1
1
  import { recipe } from "../../lib/layouts/index.js";
2
2
  const CLASSES = {
3
- base: "dropdown",
3
+ base: "dropdown ui-overlay-host",
4
4
  slot: {
5
5
  trigger: "dropdown__trigger",
6
6
  popover: "dropdown__popover",
@@ -1,3 +1,5 @@
1
+ @import "../_shared/overlayHost.css";
2
+
1
3
  @layer components {
2
4
  .ui-select {
3
5
  position: relative;
@@ -162,8 +164,7 @@
162
164
  pointer-events: none;
163
165
  transition:
164
166
  opacity 150ms cubic-bezier(0.22, 1, 0.36, 1),
165
- transform 150ms cubic-bezier(0.22, 1, 0.36, 1),
166
- visibility 150ms ease;
167
+ transform 150ms cubic-bezier(0.22, 1, 0.36, 1);
167
168
  }
168
169
 
169
170
  .ui-select__popover[data-open="true"] {
@@ -1,6 +1,6 @@
1
1
  import "./Select.css";
2
2
  import { type Component } from "solid-js";
3
- import { type JSX } from "@solidjs/web";
3
+ import type { JSX } from "@solidjs/web";
4
4
  import { type OverlayPlacement } from "../_shared/overlayPosition";
5
5
  import type { UIBaseProps, State } from "../vocabulary";
6
6
  type SelectKey = string | number;
@@ -1,4 +1,4 @@
1
- import { Portal, createComponent, insert, memo, mergeProps, ref, spread, template } from "@solidjs/web";
1
+ import { createComponent, insert, memo, mergeProps, ref, spread, template } from "@solidjs/web";
2
2
  import { defineComponent } from "solid-layouts/solid-2/application-boundary";
3
3
  import "./Select.css";
4
4
  import { createContext, createMemo, createSignal, createTrackedEffect, createUniqueId, omit, onCleanup, onSettled, useContext } from "solid-js";
@@ -502,36 +502,32 @@ const __solidLayoutSelectPopover = (_stable, p)=>{
502
502
  ...overlayStyle
503
503
  };
504
504
  };
505
- return createComponent(Portal, {
506
- get children () {
507
- var _el$19 = _tmpl$();
508
- var _ref$ = ctx?.setPopoverRef;
509
- ("function" == typeof _ref$ || Array.isArray(_ref$)) && ref(()=>_ref$, _el$19);
510
- spread(_el$19, mergeProps(others, ()=>({
511
- class: twMerge(CLASSES.slot.popover, p.class)
512
- }), {
513
- get ["data-theme"] () {
514
- return p.dataTheme;
515
- },
516
- "data-slot": "ui-select-popover",
517
- get ["data-open"] () {
518
- return ctx?.open() ? "true" : "false";
519
- },
520
- get ["data-placement"] () {
521
- return overlayPosition.placement();
522
- },
523
- get style () {
524
- return popoverStyle();
525
- },
526
- onPointerDown: (event)=>{
527
- invokeEventHandler(p.onPointerDown, event);
528
- if (!event.defaultPrevented) event.stopPropagation();
529
- }
530
- }), true);
531
- insert(_el$19, ()=>p.children);
532
- return _el$19;
505
+ var _el$19 = _tmpl$();
506
+ var _ref$ = ctx?.setPopoverRef;
507
+ ("function" == typeof _ref$ || Array.isArray(_ref$)) && ref(()=>_ref$, _el$19);
508
+ spread(_el$19, mergeProps(others, ()=>({
509
+ class: twMerge(CLASSES.slot.popover, p.class)
510
+ }), {
511
+ get ["data-theme"] () {
512
+ return p.dataTheme;
513
+ },
514
+ "data-slot": "ui-select-popover",
515
+ get ["data-open"] () {
516
+ return ctx?.open() ? "true" : "false";
517
+ },
518
+ get ["data-placement"] () {
519
+ return overlayPosition.placement();
520
+ },
521
+ get style () {
522
+ return popoverStyle();
523
+ },
524
+ onPointerDown: (event)=>{
525
+ invokeEventHandler(p.onPointerDown, event);
526
+ if (!event.defaultPrevented) event.stopPropagation();
533
527
  }
534
- });
528
+ }), true);
529
+ insert(_el$19, ()=>p.children);
530
+ return _el$19;
535
531
  };
536
532
  const SelectPopover = defineComponent({
537
533
  recipe: componentRecipe,
@@ -1,5 +1,5 @@
1
1
  export declare const CLASSES: {
2
- readonly base: "ui-select";
2
+ readonly base: "ui-select ui-overlay-host";
3
3
  readonly flag: {
4
4
  readonly fullWidth: "ui-select--full-width";
5
5
  };
@@ -1,6 +1,6 @@
1
1
  import { recipe } from "../../lib/layouts/index.js";
2
2
  const CLASSES = {
3
- base: "ui-select",
3
+ base: "ui-select ui-overlay-host",
4
4
  flag: {
5
5
  fullWidth: "ui-select--full-width"
6
6
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "format": "solid-layouts-library-v2",
3
3
  "package": "@pathscale/ui",
4
- "version": "2.11.6",
4
+ "version": "2.11.8",
5
5
  "components": {
6
6
  "Accordion": {
7
7
  "kind": "embedded"
@@ -11255,7 +11255,8 @@
11255
11255
  "component": "Select",
11256
11256
  "classes": {
11257
11257
  "always": [
11258
- "ui-select"
11258
+ "ui-select",
11259
+ "ui-overlay-host"
11259
11260
  ],
11260
11261
  "byProp": {
11261
11262
  "fullWidth": [
@@ -15150,7 +15151,8 @@
15150
15151
  "component": "Dropdown",
15151
15152
  "classes": {
15152
15153
  "always": [
15153
- "dropdown"
15154
+ "dropdown",
15155
+ "ui-overlay-host"
15154
15156
  ],
15155
15157
  "byProp": {
15156
15158
  "slot": {
@@ -15224,7 +15226,8 @@
15224
15226
  "--dropdown-trigger-bg-hover",
15225
15227
  "--dropdown-trigger-bg-pressed",
15226
15228
  "--dropdown-trigger-border",
15227
- "--dropdown-trigger-fg"
15229
+ "--dropdown-trigger-fg",
15230
+ "--dropdown-trigger-shadow"
15228
15231
  ],
15229
15232
  "referenced": [
15230
15233
  "--border",
@@ -15237,6 +15240,7 @@
15237
15240
  "--dropdown-trigger-bg-pressed",
15238
15241
  "--dropdown-trigger-border",
15239
15242
  "--dropdown-trigger-fg",
15243
+ "--dropdown-trigger-shadow",
15240
15244
  "--focus-ring-offset",
15241
15245
  "--focus-ring-width",
15242
15246
  "--radius-pill",
@@ -34638,6 +34642,14 @@
34638
34642
  "Dropdown"
34639
34643
  ]
34640
34644
  },
34645
+ "--dropdown-trigger-shadow": {
34646
+ "declaredBy": [
34647
+ "Dropdown"
34648
+ ],
34649
+ "referencedBy": [
34650
+ "Dropdown"
34651
+ ]
34652
+ },
34641
34653
  "--color-swatch-current": {
34642
34654
  "declaredBy": [],
34643
34655
  "referencedBy": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pathscale/ui",
3
- "version": "2.11.6",
3
+ "version": "2.11.8",
4
4
  "author": "pathscale",
5
5
  "repository": {
6
6
  "type": "git",
@@ -60,6 +60,7 @@
60
60
  "types": "./dist/motion/index.d.ts",
61
61
  "import": "./dist/motion/index.js"
62
62
  },
63
+ "./package.json": "./package.json",
63
64
  "./styles/*": "./dist/styles/*",
64
65
  "./dist/styles/*": "./dist/styles/*",
65
66
  "./index.css": "./dist/index.css"
@@ -73,27 +74,30 @@
73
74
  "@rsbuild/core": "^2.0.9",
74
75
  "@rsbuild/plugin-solid": "^1.2.1",
75
76
  "@rslib/core": "^0.22.0",
76
- "@solidjs/h": "2.0.0-rc.0",
77
+ "@solidjs/h": "^2.0.0-rc.0",
77
78
  "@standard-schema/spec": "^1.1.0",
79
+ "@tailwindcss/postcss": "^4.3.3",
78
80
  "@types/bun": "^1.3.14",
79
- "babel-preset-solid": "2.0.0-rc.0",
81
+ "babel-preset-solid": "^2.0.0-rc.0",
80
82
  "cally": "^0.8.0",
81
83
  "cssnano": "^7.1.9",
84
+ "popmotion": "^11.0.5",
82
85
  "postcss": "^8.5.15",
83
86
  "postcss-cli": "^11.0.1",
84
87
  "postcss-selector-parser": "^7.1.1",
85
- "rsbuild-plugin-solid-layouts": "0.2.1",
86
- "solid-js": "2.0.0-rc.0",
87
- "solid-layouts": "0.2.0",
88
- "solid-layouts-oxc": "0.2.1",
88
+ "rsbuild-plugin-solid-layouts": "^0.2.1",
89
+ "solid-js": "^2.0.0-rc.0",
90
+ "solid-layouts": "^0.2.1",
91
+ "solid-layouts-oxc": "^0.2.1",
89
92
  "svgo": "^3.3.3",
93
+ "tailwindcss": "^4.3.3",
90
94
  "typescript": "^6.0.3"
91
95
  },
92
96
  "overrides": {
93
- "babel-preset-solid": "2.0.0-rc.0"
97
+ "babel-preset-solid": "^2.0.0-rc.0"
94
98
  },
95
99
  "dependencies": {
96
- "@solidjs/web": "2.0.0-rc.0",
100
+ "@solidjs/web": "^2.0.0-rc.0",
97
101
  "clsx": "^2.1.1",
98
102
  "tailwind-merge": "^3.6.0"
99
103
  },
@@ -121,14 +125,19 @@
121
125
  "clean": "rm -rf dist node_modules",
122
126
  "format": "bun biome format --write",
123
127
  "lint": "bun run lint:code && bun run lint:layouts",
124
- "lint:code": "bun biome lint --write",
128
+ "lint:code": "bun biome lint --write src qa",
125
129
  "lint:layouts": "solid-layouts-lint",
126
130
  "check": "bun run layouts:generate && bun run scripts/check-contracts.ts",
127
131
  "check:package": "bun run scripts/check-package.ts",
128
132
  "next-version": "bun run scripts/next-version.ts",
129
133
  "smoke": "bun run scripts/smoke-consumer.ts",
134
+ "qa:checks": "bun run tests/qa-harness/generate-checks.ts",
135
+ "qa:entries": "bun run tests/qa-harness/generate-entries.ts",
136
+ "qa:dev": "rsbuild dev --config tests/qa-harness/rsbuild.config.ts",
137
+ "qa:build": "bun run qa:entries && rsbuild build --config tests/qa-harness/rsbuild.config.ts",
130
138
  "test": "bun test --conditions=browser",
131
- "check:api": "bun run scripts/check-api-contract.ts"
139
+ "check:api": "bun run scripts/check-api-contract.ts",
140
+ "qa:lint": "bun biome lint tests/qa-harness"
132
141
  },
133
142
  "sideEffects": [
134
143
  "**/*.css"