@dashforge/tw 1.5.1 → 1.6.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/CHANGELOG.md CHANGED
@@ -12,6 +12,171 @@ This project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
12
12
  > duplicated intentionally — no shared "lowest common denominator" headless
13
13
  > layer.
14
14
 
15
+ ## [1.6.0] — 2026-09-15
16
+
17
+ Minor release: three bug fixes (BUG 6 Dialog `actions` slot,
18
+ BUG 9 tooltip DOM leak, BUG 13 pointer cursor across every
19
+ interactive `<button>`), one runtime-rete for the DashForm mode
20
+ misuse (BUG 2 wiring on Autocomplete / Select / RadioGroup /
21
+ DatePicker via the new `useWarnIfControlledInFormMode` hook from
22
+ `@dashforge/ui-core@1.1.0`), and one type-only refactor of
23
+ `AutocompleteProps` into a discriminated union so form-mode and
24
+ standalone-mode props stop compiling together.
25
+
26
+ Requires `@dashforge/ui-core@^1.1.0` at runtime for the new hook.
27
+
28
+ ### Fixed
29
+
30
+ - **Every interactive `<button>` in the package now shows the pointer
31
+ cursor on hover** (BUG 13). `buttonVariants.base` lacked
32
+ `cursor-pointer`, and the browser UA stylesheet leaves `<button>`
33
+ at `cursor: default` — so every `<Button>`, `<IconButton>`, and
34
+ `Button` in `variant="link"` mode read as "unclickable" to the
35
+ person hovering. Same shape found in the same-pass audit on
36
+ `tabs.variants.ts` (Radix.Tabs.Trigger),
37
+ `checkbox.variants.ts` (Radix.Checkbox.Root), and
38
+ `radioGroup.variants.ts` (Radix.RadioGroup.Item) — all four are
39
+ Radix primitives that surface as `<button>` under the hood. Fixed
40
+ by adding `cursor-pointer` on each interactive base/slot; the
41
+ existing `disabled:pointer-events-none` /
42
+ `data-[disabled]:cursor-not-allowed` state resets already handle
43
+ disabled instances, and `loading` on `<Button>` still overrides
44
+ to `cursor-wait` (tailwind-variants precedence). New test file
45
+ `_shared/cursorPointerAffordance.test.tsx` (7 assertions) pins
46
+ both the recipe-level class string and the rendered-DOM
47
+ `className` for `<Button>` and `<IconButton>`, so a future edit
48
+ that strips the class fails loudly. See `README-BUG.md § BUG 13`.
49
+
50
+ ### Added
51
+
52
+ - **`<Dialog>` gained an `actions` prop** (`ReactNode`) that renders
53
+ a right-aligned footer row below the body and above the close
54
+ button. The variant + `slotProps.actions` entry already existed
55
+ in the package but had never been rendered — declared API that
56
+ did nothing (README-BUG § BUG 6). The alignment (`flex justify-end
57
+ gap-2 pt-2`) is the design-system decision encoded in
58
+ `dialog.variants.ts:52` and had been surfaced consistently in
59
+ hand-rolled action rows across consumer forms; the prop lets
60
+ consumers drop that boilerplate. Additive — existing dialogs
61
+ without `actions` render identically to before.
62
+
63
+ - **Dev-mode warning when controlled / uncontrolled props are passed
64
+ to a bridge-integrated field inside a `<DashFormProvider>`** — the
65
+ runtime rete for README-BUG § BUG 2. Applied to `<Autocomplete>`,
66
+ `<Select>`, `<RadioGroup>` and `<DatePicker>` (the four
67
+ highest-usage field components; 10 more follow in a consistency
68
+ pass). Each component calls the new `useWarnIfControlledInFormMode`
69
+ hook from `@dashforge/ui-core` with its name and the destructured
70
+ controlled props; the hook warns once per
71
+ `(componentName, name, propKey)` triple with a message naming the
72
+ offending prop and the correct API (`<DashForm defaultValues={{
73
+ [name]: … }} />`). Zero cost in production — the effect body is
74
+ guarded by `process.env.NODE_ENV !== 'production'`.
75
+
76
+ Works alongside the existing type-surface split on `Autocomplete`
77
+ (which catches `rules + defaultValue` at compile time). The two
78
+ reties are complementary: types cover the `rules`-carrying case
79
+ before compile, the runtime warning covers the common case
80
+ (`rules`-less) on first render.
81
+
82
+ ### Changed
83
+
84
+ - **`<Autocomplete>` — `AutocompleteProps` split into a discriminated
85
+ union of two mode variants** (form / standalone) to close the
86
+ type-surface bug where controlled/uncontrolled value props
87
+ (`value`, `defaultValue`, `onValueChange`) were accepted alongside
88
+ `rules` and silently ignored at runtime in form mode. The runtime
89
+ behaviour is unchanged (form-mode initial values still come from
90
+ `<DashForm defaultValues={...}>` via the bridge); the fix is
91
+ purely at the TypeScript layer:
92
+
93
+ - `AutocompleteFormMixin` marks form mode via optional `rules`;
94
+ the controlled/uncontrolled props are typed `never`.
95
+ - `AutocompleteStandaloneMixin` marks standalone mode via optional
96
+ `value` / `defaultValue` / `onValueChange`; `rules` is typed
97
+ `never`.
98
+ - Consumer surface `AutocompleteProps<TOption>` still exports as a
99
+ single name — the discrimination is transparent at import sites.
100
+
101
+ Consumer misuse audit (dash, docs-lab, kits) surfaced zero existing
102
+ callers with the mixed-mode pattern, so no downstream code
103
+ changes are required. Type-regression pinned by
104
+ `autocomplete.props.type-test.ts` (compile-only, three
105
+ `@ts-expect-error` markers). See `libs/dashforge/README-BUG.md`
106
+ § BUG 2 for the full context.
107
+
108
+ ### Fixed
109
+
110
+ - **`<TextField>`, `<NumberField>` and `<Textarea>` no longer leak
111
+ the `tooltip` prop onto the rendered `<input>` / `<textarea>` as
112
+ an unknown HTML attribute.** These three components spread
113
+ `{...rest}` onto their DOM element after destructuring `merged`,
114
+ and `tooltip` was not in the destructured keys, so its value
115
+ landed on the DOM as `tooltip="…"` (the object form of the prop
116
+ stringified to `"[object Object]"`). React 19 forwards lowercase
117
+ unknown attrs silently, so nothing signalled it in dev — it took
118
+ a Playwright strict-mode failure to notice. Fix: three one-line
119
+ destructure edits consuming `tooltip` before the `...rest` catch.
120
+ Regression guard in
121
+ `libs/dashforge/tw/src/components/_shared/tooltipDomLeak.test.tsx`.
122
+ See README-BUG § BUG 9 — the report's original "all nine field
123
+ components" scope was corrected to these three after verification
124
+ (the other six do not spread `{...rest}` onto any DOM element and
125
+ therefore cannot leak structurally; Autocomplete was empirically
126
+ probed as an anchor).
127
+
128
+ - **`<Autocomplete multiple>` — the control no longer overflows its
129
+ own width by ~6px** (a regression introduced by the BUG 3 chevron
130
+ wrap fix earlier in this Unreleased block). The controls group
131
+ and the input inside it both went from `min-w-[6rem]` to
132
+ `min-w-0`, so the input can shrink under pressure and the
133
+ `shrink-0` clear + chevron buttons always fit inside the group.
134
+ The previous floor combined with the shrink-0 buttons produced an
135
+ intrinsic min-content-size of ~156px and pushed the chevron 6px
136
+ past the group's right edge when chips had consumed most of the
137
+ outer wrapper — which turned into a horizontal scrollbar inside
138
+ a `<Dialog>` (whose body is `overflow-y-auto` and so computes
139
+ `overflow-x: auto`). The BUG 3 invariant is preserved: the
140
+ chevron stays on the same row as the input, never orphaned.
141
+ Fixes README-BUG § BUG 5.
142
+
143
+ - **`<Autocomplete multiple>` — the chevron no longer wraps onto its
144
+ own line on narrow fields.** Multi mode's outer `flex-wrap`
145
+ context (needed so chip rows can grow vertically) used to let the
146
+ chevron drop onto an orphan row whenever the row width fell below
147
+ ~400px with two or more chips, producing a 90px-tall control with
148
+ an empty band. The fix keeps the `flex-wrap` on the outer wrapper
149
+ (so chips still wrap freely) but nests the input, clear `×` and
150
+ chevron in a `flex-nowrap` inner row of their own — that inner
151
+ row is structurally indivisible, so the chevron can never orphan.
152
+ Single-mode DOM is unchanged. See `libs/dashforge/README-BUG.md`
153
+ § BUG 3 for the full context and the DOM verification.
154
+ - **`<Autocomplete>` — the listbox is now portaled** to `document.body`
155
+ via `RadixPopover.Portal`, so ancestor `overflow: hidden` /
156
+ `overflow: auto` containers can no longer clip it. Fixes the
157
+ fault-line that made "multi-select in a modal form" unusable
158
+ (`<Dialog><DashForm><Autocomplete multiple/></DashForm></Dialog>`
159
+ clipped the dropdown at the dialog body's scroll boundary, and the
160
+ same happened inside any `overflow-hidden` card such as the
161
+ `inventory-kit` `SectionCard`). See `libs/dashforge/README-BUG.md`
162
+ § BUG 1 for the full context. Width is still tied to the anchor
163
+ (via Radix's `--radix-popover-trigger-width` CSS var), keyboard
164
+ model / `aria-controls` / `aria-activedescendant` / `preventBlur`
165
+ on options are unchanged, and Radix's focus management is
166
+ intentionally disabled so focus stays on the input as before.
167
+ Downstream `overflowVisible`-prop workarounds can be removed
168
+ when this ships.
169
+
170
+ ## [1.5.2] — 2026-08-30
171
+
172
+ ### Fixed
173
+
174
+ - **`<Select>` — the selected-option checkmark no longer stretches.** The
175
+ `listItemIndicator` slot set a width (`w-4`) but no height, so its inline
176
+ SVG (a `viewBox`-only `<svg>`) was stretched to the option row's height by
177
+ the flex layout — an oversized, distorted checkmark whenever the dropdown
178
+ was open. Added the missing `h-4`.
179
+
15
180
  ## [1.5.1] — 2026-08-15
16
181
 
17
182
  Patch: fixes the label ordering of the `tooltip` help icon relative to
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dashforge
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.