@tristan2828/ui-foundation 4.129.2 → 4.130.1
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/conventions/docs/add-an-entity.md +18 -12
- package/conventions/docs/cell-patterns.md +11 -6
- package/dist/components/app/editable-value.js +28 -2
- package/dist/components/app/milkdown-editor.js +3 -2
- package/dist/components/app/multi-choice.d.ts +15 -5
- package/dist/components/app/multi-choice.js +32 -4
- package/dist/components/app/rich-text-links.d.ts +2 -0
- package/dist/components/app/rich-text-links.js +14 -0
- package/dist/components/ui/combobox.d.ts +3 -1
- package/dist/components/ui/combobox.js +2 -2
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -15,19 +15,19 @@
|
|
|
15
15
|
- Step 8: Add Playwright specs for all three screens · lines 776–863
|
|
16
16
|
- Step 9: Register the nav entry and route names · lines 864–878
|
|
17
17
|
- Step 10: `npm run verify`. · lines 879–881
|
|
18
|
-
- [How a list opens a record](#how-a-list-opens-a-record) · lines 883–
|
|
18
|
+
- [How a list opens a record](#how-a-list-opens-a-record) · lines 883–1408
|
|
19
19
|
- [The record view](#the-record-view) · lines 1036–1217
|
|
20
|
-
- [Forms](#forms) · lines 1219–
|
|
21
|
-
- [Dialogs](#dialogs) · lines
|
|
22
|
-
- [Toasts and feedback](#toasts-and-feedback) · lines
|
|
23
|
-
- [What not to copy](#what-not-to-copy) · lines
|
|
24
|
-
- [After a commit, in the backend](#after-a-commit-in-the-backend) · lines
|
|
25
|
-
- [Saves that don't overwrite](#saves-that-dont-overwrite) · lines
|
|
26
|
-
- [Deleting](#deleting) · lines
|
|
27
|
-
- [Fields only a script writes](#fields-only-a-script-writes) · lines
|
|
28
|
-
- [Searching one part of the app](#searching-one-part-of-the-app) · lines
|
|
29
|
-
- [What a chat is told about an entity](#what-a-chat-is-told-about-an-entity) · lines
|
|
30
|
-
- [Behind a sign-in proxy](#behind-a-sign-in-proxy) · lines
|
|
20
|
+
- [Forms](#forms) · lines 1219–1307
|
|
21
|
+
- [Dialogs](#dialogs) · lines 1309–1342
|
|
22
|
+
- [Toasts and feedback](#toasts-and-feedback) · lines 1344–1408
|
|
23
|
+
- [What not to copy](#what-not-to-copy) · lines 1410–1445
|
|
24
|
+
- [After a commit, in the backend](#after-a-commit-in-the-backend) · lines 1447–1464
|
|
25
|
+
- [Saves that don't overwrite](#saves-that-dont-overwrite) · lines 1466–1531
|
|
26
|
+
- [Deleting](#deleting) · lines 1533–1564
|
|
27
|
+
- [Fields only a script writes](#fields-only-a-script-writes) · lines 1566–1587
|
|
28
|
+
- [Searching one part of the app](#searching-one-part-of-the-app) · lines 1589–1598
|
|
29
|
+
- [What a chat is told about an entity](#what-a-chat-is-told-about-an-entity) · lines 1601–1643
|
|
30
|
+
- [Behind a sign-in proxy](#behind-a-sign-in-proxy) · lines 1645–1681
|
|
31
31
|
|
|
32
32
|
<!-- /index -->
|
|
33
33
|
|
|
@@ -1275,6 +1275,12 @@ shape (4.85):
|
|
|
1275
1275
|
the trigger and on each item in its list (`inPlace.select` passes them
|
|
1276
1276
|
through). With `kind`, leave out a `render` that draws its own icon
|
|
1277
1277
|
(a `StatusMark`), or the option shows two.
|
|
1278
|
+
A status picked several at once (a multi-value status filter, a
|
|
1279
|
+
"statuses" field) is a `MultiChoice` given those same options (4.130):
|
|
1280
|
+
`options={STATUS_OPTIONS}` in place of bare values, so each option's
|
|
1281
|
+
kind icon (or `icon`) is drawn before its words in the list, on its
|
|
1282
|
+
chip, and on a filter's summary ("Status: ● Active +1"), and its
|
|
1283
|
+
`label` names it with no `getLabel`.
|
|
1278
1284
|
- **The controls** (4.88): a choice of two to four short options is
|
|
1279
1285
|
`ChoiceButtons` (`inPlace.choice` in place), five or more an
|
|
1280
1286
|
`OptionSelect`. A date is `DateField`, typed ("3/14", "Mar 14",
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
- [23. A Group menu, and a record read beside the list](#23-a-group-menu-and-a-record-read-beside-the-list) · lines 1935–2011
|
|
42
42
|
- [24. A stored colour beside its name](#24-a-stored-colour-beside-its-name) · lines 2013–2099
|
|
43
43
|
- [Picking one on a form: `ColorField`](#picking-one-on-a-form-colorfield) · lines 2038–2099
|
|
44
|
-
- [25. A list's tools: views, filters, columns, row actions, a phone's rows](#25-a-lists-tools-views-filters-columns-row-actions-a-phones-rows) · lines 2101–
|
|
45
|
-
- [The framed look, and sibling lists beside the title](#the-framed-look-and-sibling-lists-beside-the-title) · lines
|
|
46
|
-
- [26. A record's related list, capped](#26-a-records-related-list-capped) · lines
|
|
47
|
-
- [27. A repeat and its next time](#27-a-repeat-and-its-next-time) · lines
|
|
44
|
+
- [25. A list's tools: views, filters, columns, row actions, a phone's rows](#25-a-lists-tools-views-filters-columns-row-actions-a-phones-rows) · lines 2101–2347
|
|
45
|
+
- [The framed look, and sibling lists beside the title](#the-framed-look-and-sibling-lists-beside-the-title) · lines 2276–2347
|
|
46
|
+
- [26. A record's related list, capped](#26-a-records-related-list-capped) · lines 2349–2385
|
|
47
|
+
- [27. A repeat and its next time](#27-a-repeat-and-its-next-time) · lines 2387–2436
|
|
48
48
|
|
|
49
49
|
<!-- /index -->
|
|
50
50
|
|
|
@@ -2210,8 +2210,13 @@ const { filters, multiFilters, setFilter, setFilters, setMultiFilter, activeView
|
|
|
2210
2210
|
`search.onKeyDown` (4.123) gives the search box's keys to the app
|
|
2211
2211
|
first: Enter on "#12" opening record 12, `preventDefault()` keeping the
|
|
2212
2212
|
key from the box. `MultiChoice`'s `label` makes it "Rooms: Hall +1"
|
|
2213
|
-
instead of a chip per pick.
|
|
2214
|
-
|
|
2213
|
+
instead of a chip per pick. Given `OptionSelect`'s options
|
|
2214
|
+
(`{ value, label, kind?, icon? }`, 4.130) in place of bare values,
|
|
2215
|
+
`MultiChoice` draws each option's icon as OptionSelect does: in the
|
|
2216
|
+
list, on each chip, and before the summary's first pick ("Status: ●
|
|
2217
|
+
Active +1"), so a status filter that takes several keeps its icons.
|
|
2218
|
+
Below 48rem search and Filters share a line and every filter, primary
|
|
2219
|
+
ones too, is in Filters' bottom sheet, so pass
|
|
2215
2220
|
`primaryActive` (their chips) and an `onClearAll` that clears them all
|
|
2216
2221
|
in one `setFilters` call.
|
|
2217
2222
|
- **A date filter** (4.110) is `FilterDate`: "Any due date" while off,
|
|
@@ -91,16 +91,42 @@ function Control({ render, ...props }) {
|
|
|
91
91
|
// field's left edge, so it's never off screen (F5). Not CSS sticky: a
|
|
92
92
|
// section's card clips its content (`overflow-hidden`), which stops sticky
|
|
93
93
|
// at the card. Returns where to pin it, or null while it shows in place.
|
|
94
|
+
//
|
|
95
|
+
// Judged by where the field ends with its line in place, pinned or not.
|
|
96
|
+
// Pinning takes the line out of the field, so the field's own box is
|
|
97
|
+
// shorter by the line while it's pinned: judged by that box, a field whose
|
|
98
|
+
// end is within a line of the screen's bottom pinned, shrank, unpinned,
|
|
99
|
+
// grew and pinned again, every frame (a conflict's two buttons hopping
|
|
100
|
+
// 128px on a phone, never still enough to press).
|
|
94
101
|
function usePinnedStatus(field, enabled) {
|
|
95
102
|
const [pin, setPin] = useState(null);
|
|
96
103
|
useLayoutEffect(() => {
|
|
97
104
|
if (!enabled)
|
|
98
105
|
return;
|
|
99
106
|
let frame = 0;
|
|
107
|
+
// How far the line in place reaches below the rest of the field (the
|
|
108
|
+
// gap and the line), measured whenever it's in place.
|
|
109
|
+
let reserve = 0;
|
|
100
110
|
const measure = () => {
|
|
101
111
|
frame = 0;
|
|
102
|
-
const
|
|
103
|
-
const
|
|
112
|
+
const element = field.current;
|
|
113
|
+
const box = element?.getBoundingClientRect();
|
|
114
|
+
let bottom = box?.bottom;
|
|
115
|
+
const line = element?.querySelector(':scope > [data-slot="editable-value-status"]');
|
|
116
|
+
if (element && box && line) {
|
|
117
|
+
if (line.hasAttribute('data-pinned')) {
|
|
118
|
+
bottom = box.bottom + reserve;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
let rest = box.top;
|
|
122
|
+
for (const child of element.children) {
|
|
123
|
+
if (child !== line)
|
|
124
|
+
rest = Math.max(rest, child.getBoundingClientRect().bottom);
|
|
125
|
+
}
|
|
126
|
+
reserve = Math.max(0, box.bottom - rest);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const runsPast = box !== undefined && bottom !== undefined && box.top < window.innerHeight - 48 && bottom > window.innerHeight;
|
|
104
130
|
setPin((current) => {
|
|
105
131
|
if (!runsPast)
|
|
106
132
|
return null;
|
|
@@ -116,7 +116,7 @@ import { DEFAULT_HEADING_LEVEL } from './prose-look.js';
|
|
|
116
116
|
import { foldPlugin, setFolds } from './rich-text-fold.js';
|
|
117
117
|
import { headingView } from './rich-text-heading-view.js';
|
|
118
118
|
import { taskItemView, toggleTaskItem } from './rich-text-task-item-view.js';
|
|
119
|
-
import { applyLink, followLink, linkTarget } from './rich-text-links.js';
|
|
119
|
+
import { applyLink, followLink, linkTarget, notePress } from './rich-text-links.js';
|
|
120
120
|
import { anchorAt } from './rich-text-box-anchor.js';
|
|
121
121
|
import { LinkForm } from './rich-text-link-box.js';
|
|
122
122
|
import { PageForm } from './rich-text-page-box.js';
|
|
@@ -672,7 +672,8 @@ export default function MilkdownEditor({ id, defaultValue, onChange, onProblem,
|
|
|
672
672
|
}),
|
|
673
673
|
// The floating toolbar waits for the mouse to be up: a drag
|
|
674
674
|
// is still choosing the words.
|
|
675
|
-
mousedown: (
|
|
675
|
+
mousedown: (view, event) => {
|
|
676
|
+
notePress(view, event);
|
|
676
677
|
if (event.button !== 0)
|
|
677
678
|
return false;
|
|
678
679
|
setDismissed(null);
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import type { OptionSelectOption } from './option-select.js';
|
|
3
|
+
/** An option with its words and, optionally, its icon: OptionSelect's option, the same shape. */
|
|
4
|
+
export type MultiChoiceOption<T extends string> = OptionSelectOption<T>;
|
|
5
|
+
export type MultiChoiceProps<T extends string> = {
|
|
6
|
+
/**
|
|
7
|
+
* Every allowed option, in display order: bare values, or (4.130)
|
|
8
|
+
* OptionSelect's `{ value, label, kind?, icon? }`, whose `label` names it
|
|
9
|
+
* and whose `kind` or `icon` is drawn before the words, as OptionSelect
|
|
10
|
+
* draws it.
|
|
11
|
+
*/
|
|
12
|
+
options: readonly T[] | readonly MultiChoiceOption<T>[];
|
|
5
13
|
value: T[];
|
|
6
14
|
onValueChange: (value: T[]) => void;
|
|
7
15
|
/**
|
|
8
16
|
* The text shown for an option: on its chip, in the dropdown, and what
|
|
9
|
-
* typing matches against. Defaults to the value itself
|
|
17
|
+
* typing matches against. Defaults to the value itself, or to the
|
|
18
|
+
* option's `label` when options are objects.
|
|
10
19
|
*/
|
|
11
20
|
getLabel?: (value: T) => string;
|
|
12
21
|
/** Id for the text input, so a <FieldLabel htmlFor> labels it. */
|
|
@@ -24,4 +33,5 @@ export declare function MultiChoice<T extends string>({ options, value, onValueC
|
|
|
24
33
|
'aria-label'?: string;
|
|
25
34
|
'aria-invalid'?: boolean;
|
|
26
35
|
className?: string;
|
|
27
|
-
}
|
|
36
|
+
};
|
|
37
|
+
export declare function MultiChoice<T extends string>({ options, value, onValueChange, getLabel, id, placeholder, label, 'aria-label': ariaLabel, 'aria-invalid': ariaInvalid, className, }: MultiChoiceProps<T>): React.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// A multi-choice picker: selected options as removable chips, the rest in a
|
|
3
3
|
// filterable dropdown. The one control for every "multi choice" field
|
|
4
4
|
// (conventions/docs/entity-plan-template.md) — on a form (Widget Tags) and as a table
|
|
@@ -13,13 +13,41 @@ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
// A toolbar filter's summary ("Status: Active +1", `label`) keeps the
|
|
14
14
|
// control one line high however narrow it is (4.109): it truncates, and
|
|
15
15
|
// the text box beside it takes no room until it's focused.
|
|
16
|
+
//
|
|
17
|
+
// An option can carry a status kind or an icon (4.130), as OptionSelect's
|
|
18
|
+
// and ChoiceButtons' do, drawn by the same OptionIcon: pass the options as
|
|
19
|
+
// `{ value, label, kind?, icon? }` (OptionSelectOption) in place of bare
|
|
20
|
+
// values. The icon goes before the words on the option in the list, on its
|
|
21
|
+
// chip and on the summary's first pick. Decorative: the words say it.
|
|
16
22
|
import * as React from 'react';
|
|
17
23
|
import { cn } from 'cn';
|
|
18
24
|
import { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxContent, ComboboxEmpty, ComboboxItem, ComboboxList, ComboboxValue, useComboboxAnchor, } from '../ui/combobox.js';
|
|
19
|
-
|
|
25
|
+
import { OptionIcon } from './option-icon.js';
|
|
26
|
+
export function MultiChoice({ options, value, onValueChange, getLabel, id, placeholder, label, 'aria-label': ariaLabel, 'aria-invalid': ariaInvalid, className, }) {
|
|
20
27
|
const anchor = useComboboxAnchor();
|
|
28
|
+
// Bare values or option objects: the values are what the combobox holds,
|
|
29
|
+
// the objects (by value) give the words and the icon.
|
|
30
|
+
const { values, byValue } = React.useMemo(() => {
|
|
31
|
+
const byValue = new Map();
|
|
32
|
+
const values = options.map((option) => {
|
|
33
|
+
if (typeof option === 'string')
|
|
34
|
+
return option;
|
|
35
|
+
byValue.set(option.value, option);
|
|
36
|
+
return option.value;
|
|
37
|
+
});
|
|
38
|
+
return { values, byValue };
|
|
39
|
+
}, [options]);
|
|
40
|
+
const labelOf = (option) => (getLabel ? getLabel(option) : (byValue.get(option)?.label ?? String(option)));
|
|
41
|
+
const iconOf = (option, slot) => {
|
|
42
|
+
const found = byValue.get(option);
|
|
43
|
+
return found ? _jsx(OptionIcon, { kind: found.kind, icon: found.icon, slot: slot }) : null;
|
|
44
|
+
};
|
|
45
|
+
const hasIcon = (option) => {
|
|
46
|
+
const found = byValue.get(option);
|
|
47
|
+
return Boolean(found && (found.kind || found.icon));
|
|
48
|
+
};
|
|
21
49
|
const summarised = label !== undefined && value.length > 0;
|
|
22
|
-
return (_jsxs(Combobox, { multiple: true, autoHighlight: true, items:
|
|
50
|
+
return (_jsxs(Combobox, { multiple: true, autoHighlight: true, items: values, value: value, onValueChange: (next, details) => {
|
|
23
51
|
// Base UI empties the value on Escape while the list is closed, so
|
|
24
52
|
// a second Escape after a pick wiped every chip (issue #123). Escape
|
|
25
53
|
// never removes picks here: a chip's remove button, Backspace or
|
|
@@ -31,5 +59,5 @@ export function MultiChoice({ options, value, onValueChange, getLabel = String,
|
|
|
31
59
|
return;
|
|
32
60
|
}
|
|
33
61
|
onValueChange(next);
|
|
34
|
-
}, itemToStringLabel:
|
|
62
|
+
}, itemToStringLabel: labelOf, children: [_jsx(ComboboxChips, { ref: anchor, className: cn(summarised && 'flex-nowrap', className), children: _jsx(ComboboxValue, { children: (selected) => (_jsxs(React.Fragment, { children: [label !== undefined && selected.length > 0 ? (hasIcon(selected[0]) ? (_jsxs("span", { "data-slot": "multi-choice-summary", className: "flex min-w-0 items-center gap-1.5 pl-1 type-body text-foreground", children: [_jsxs("span", { className: "shrink-0", children: [label, ":"] }), iconOf(selected[0], 'multi-choice-icon'), _jsxs("span", { className: "min-w-0 truncate", children: [labelOf(selected[0]), selected.length > 1 && _jsxs("span", { className: "text-muted-foreground", children: [" +", selected.length - 1] })] })] })) : (_jsxs("span", { "data-slot": "multi-choice-summary", className: "min-w-0 truncate pl-1 type-body text-foreground", children: [label, ": ", labelOf(selected[0]), selected.length > 1 && _jsxs("span", { className: "text-muted-foreground", children: [" +", selected.length - 1] })] }))) : null, (label === undefined ? selected : []).map((option) => (_jsxs(ComboboxChip, { removeLabel: labelOf(option), children: [iconOf(option, 'multi-choice-icon'), labelOf(option)] }, option))), _jsx(ComboboxChipsInput, { id: id, "aria-label": ariaLabel, "aria-invalid": ariaInvalid, placeholder: selected.length === 0 ? placeholder : undefined, className: summarised ? 'min-w-0 focus:min-w-16' : undefined })] })) }) }), _jsxs(ComboboxContent, { anchor: anchor, children: [_jsx(ComboboxEmpty, { children: "No options found." }), _jsx(ComboboxList, { children: (option) => (_jsxs(ComboboxItem, { value: option, children: [iconOf(option, 'multi-choice-icon'), labelOf(option)] }, option)) })] })] }));
|
|
35
63
|
}
|
|
@@ -7,6 +7,8 @@ export type LinkTarget = {
|
|
|
7
7
|
href: string;
|
|
8
8
|
};
|
|
9
9
|
export declare function linkTarget(state: EditorState): LinkTarget;
|
|
10
|
+
/** Where the mouse went down in the editor: `followLink` doesn't follow a drag. */
|
|
11
|
+
export declare function notePress(view: EditorView, event: MouseEvent): void;
|
|
10
12
|
export declare function followLink(view: EditorView, event: MouseEvent, pages: {
|
|
11
13
|
resolve: PageLinkResolver | undefined;
|
|
12
14
|
open: (href: string) => void;
|
|
@@ -45,6 +45,17 @@ export function linkTarget(state) {
|
|
|
45
45
|
// A page link (`pageLink`) opens its page in this tab instead (`open`:
|
|
46
46
|
// the router's, when there is one), and a removed page's link opens
|
|
47
47
|
// nothing.
|
|
48
|
+
//
|
|
49
|
+
// A drag is told by the pointer moving between the press and the click,
|
|
50
|
+
// not only by the words it chose: whether a drag selects is the editor's
|
|
51
|
+
// and the browser's call (prosemirror-view 1.43, handling the mouse
|
|
52
|
+
// itself, leaves the caret where a drag with a mouse on a phone ended).
|
|
53
|
+
const presses = new WeakMap();
|
|
54
|
+
const DRAG_SLOP = 4;
|
|
55
|
+
/** Where the mouse went down in the editor: `followLink` doesn't follow a drag. */
|
|
56
|
+
export function notePress(view, event) {
|
|
57
|
+
presses.set(view, { x: event.clientX, y: event.clientY });
|
|
58
|
+
}
|
|
48
59
|
export function followLink(view, event, pages) {
|
|
49
60
|
if (event.button !== 0 || event.shiftKey || event.altKey)
|
|
50
61
|
return false;
|
|
@@ -53,6 +64,9 @@ export function followLink(view, event, pages) {
|
|
|
53
64
|
return false;
|
|
54
65
|
if (!view.state.selection.empty)
|
|
55
66
|
return false;
|
|
67
|
+
const press = presses.get(view);
|
|
68
|
+
if (press && Math.hypot(event.clientX - press.x, event.clientY - press.y) > DRAG_SLOP)
|
|
69
|
+
return false;
|
|
56
70
|
const written = anchor.getAttribute('href') ?? '';
|
|
57
71
|
const page = pageLinkInfo(pages.resolve, written);
|
|
58
72
|
if (page) {
|
|
@@ -16,8 +16,10 @@ declare function ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.P
|
|
|
16
16
|
declare function ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props): React.JSX.Element;
|
|
17
17
|
declare function ComboboxSeparator({ className, ...props }: ComboboxPrimitive.Separator.Props): React.JSX.Element;
|
|
18
18
|
declare function ComboboxChips({ className, ...props }: React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> & ComboboxPrimitive.Chips.Props): React.JSX.Element;
|
|
19
|
-
declare function ComboboxChip({ className, children, showRemove, ...props }: ComboboxPrimitive.Chip.Props & {
|
|
19
|
+
declare function ComboboxChip({ className, children, showRemove, removeLabel, ...props }: ComboboxPrimitive.Chip.Props & {
|
|
20
20
|
showRemove?: boolean;
|
|
21
|
+
/** The chip's words, naming its remove button ("Remove <words>") when its children aren't plain text (ui-foundation, 4.130). */
|
|
22
|
+
removeLabel?: string;
|
|
21
23
|
}): React.JSX.Element;
|
|
22
24
|
declare function ComboboxChipsInput({ className, ...props }: ComboboxPrimitive.Input.Props): React.JSX.Element;
|
|
23
25
|
declare function useComboboxAnchor(): React.RefObject<HTMLDivElement | null>;
|
|
@@ -46,12 +46,12 @@ function ComboboxSeparator({ className, ...props }) {
|
|
|
46
46
|
function ComboboxChips({ className, ...props }) {
|
|
47
47
|
return (_jsx(ComboboxPrimitive.Chips, { "data-slot": "combobox-chips", className: cn("flex min-h-[var(--control-height,--spacing(9))] flex-wrap items-center gap-1 rounded-md border border-input bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40", className), ...props }));
|
|
48
48
|
}
|
|
49
|
-
function ComboboxChip({ className, children, showRemove = true, ...props }) {
|
|
49
|
+
function ComboboxChip({ className, children, showRemove = true, removeLabel, ...props }) {
|
|
50
50
|
return (_jsxs(ComboboxPrimitive.Chip, { "data-slot": "combobox-chip", className: cn("flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0", className), ...props, children: [children, showRemove && (_jsx(ComboboxPrimitive.ChipRemove
|
|
51
51
|
// Patched (ui-foundation, Phase G): upstream's icon-only remove
|
|
52
52
|
// button has no accessible name — a critical axe violation. Name
|
|
53
53
|
// it after the chip ("Remove fragile") when the chip is plain text.
|
|
54
|
-
, { "aria-label": typeof children === "string" ? `Remove ${children}` : "Remove", render: _jsx(Button, { variant: "ghost", size: "icon-xs" }), className: "-ml-1 opacity-50 hover:opacity-100", "data-slot": "combobox-chip-remove", children: _jsx(XIcon, { className: "pointer-events-none" }) }))] }));
|
|
54
|
+
, { "aria-label": removeLabel !== undefined ? `Remove ${removeLabel}` : typeof children === "string" ? `Remove ${children}` : "Remove", render: _jsx(Button, { variant: "ghost", size: "icon-xs" }), className: "-ml-1 opacity-50 hover:opacity-100", "data-slot": "combobox-chip-remove", children: _jsx(XIcon, { className: "pointer-events-none" }) }))] }));
|
|
55
55
|
}
|
|
56
56
|
// Patched (ui-foundation, issue #94): upstream's input always keeps 4rem,
|
|
57
57
|
// so chips that fit on one line still pushed it onto an empty second one
|
package/dist/index.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ export { countTasks, toggleTaskAt, type TaskCount } from './lib/markdown-tasks.j
|
|
|
64
64
|
export { NotesOutline, type NotesOutlineProps } from './components/app/notes-outline.js';
|
|
65
65
|
export type { HeadingFrom, HeadingLevel, TableLook } from './components/app/prose-look.js';
|
|
66
66
|
export { MockModeBanner } from './components/app/mock-mode-banner.js';
|
|
67
|
-
export { MultiChoice } from './components/app/multi-choice.js';
|
|
67
|
+
export { MultiChoice, type MultiChoiceOption, type MultiChoiceProps } from './components/app/multi-choice.js';
|
|
68
68
|
export { MultiPick, type MultiPickOption, type MultiPickProps } from './components/app/multi-pick.js';
|
|
69
69
|
export { MultiReference } from './components/app/multi-reference.js';
|
|
70
70
|
export { ListEditor } from './components/app/list-editor.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tristan2828/ui-foundation",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.130.1",
|
|
4
4
|
"description": "Shared UI foundation for contract-first, database-backed React apps: shadcn primitives, DataTable/EntityForm composites, auth, the gateway error seam, design tokens, lint rules and the AI playbook.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|