@12-apps/ui 1.20.0 → 1.21.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/package.json
CHANGED
|
@@ -60,6 +60,20 @@ function clickKeys(onClick: () => void) {
|
|
|
60
60
|
* 1.4 all four rows keep identical rail edges, because subgrid tracks and the
|
|
61
61
|
* zoom that reads them are the same for every row.
|
|
62
62
|
*/
|
|
63
|
+
/**
|
|
64
|
+
* DIVIDER COMPOSES WITH THE VARIANT — it changes the row's SHAPE, not its
|
|
65
|
+
* surface.
|
|
66
|
+
*
|
|
67
|
+
* It used to set `border: 0` and hard-code its own rule colour, which discarded
|
|
68
|
+
* whatever the variant had drawn: `outline`, `text` and `ghost` all collapsed
|
|
69
|
+
* to one identical flush row, and the variant control silently stopped meaning
|
|
70
|
+
* anything the moment `divider` was on.
|
|
71
|
+
*
|
|
72
|
+
* Now only the GEOMETRY changes here — the box's sides go, one edge stays — and
|
|
73
|
+
* no `borderColor` is written, so the colour set by `cardSurfaceStyles` survives.
|
|
74
|
+
* A variant that draws no border of its own gets the neutral rule from
|
|
75
|
+
* {@link rowStyles}.
|
|
76
|
+
*/
|
|
63
77
|
export function rowSx(opts: {
|
|
64
78
|
inGroup: boolean;
|
|
65
79
|
railCount: number;
|
|
@@ -134,7 +148,7 @@ export function rowSx(opts: {
|
|
|
134
148
|
'& > [data-slot="value"]': { gridArea: "2 / 4", textAlign: "right" },
|
|
135
149
|
},
|
|
136
150
|
...(divider
|
|
137
|
-
? {
|
|
151
|
+
? { borderRadius: 0, borderWidth: 0, borderBottomWidth: 1, borderStyle: "solid" }
|
|
138
152
|
: {}),
|
|
139
153
|
};
|
|
140
154
|
}
|
|
@@ -217,22 +231,36 @@ export function actionProps(onClick: (() => void) | undefined) {
|
|
|
217
231
|
}
|
|
218
232
|
|
|
219
233
|
/** The surface and the geometry, merged — the row's whole `sx` in one place. */
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* The row's painted surface, plus the divider's colour fallback.
|
|
237
|
+
*
|
|
238
|
+
* A variant with no border of its own (`text`, `ghost`) would draw its rule in
|
|
239
|
+
* the inherited colour — the TEXT colour, i.e. a black bar across the row. The
|
|
240
|
+
* neutral divider token is supplied only in that case; a variant that has a
|
|
241
|
+
* border keeps it, which is the whole point of composing the two.
|
|
242
|
+
*/
|
|
243
|
+
function rowSurface(
|
|
244
|
+
props: BaseListCardProps,
|
|
245
|
+
shell: ReturnType<typeof useRowShell>,
|
|
246
|
+
): Record<string, unknown> {
|
|
247
|
+
const { theme, selectable, drag } = shell;
|
|
248
|
+
const surface = cardSurfaceStyles(
|
|
249
|
+
{ ...props, selectable, shape: "row", state: drag.dragging ? "disabled" : props.state },
|
|
250
|
+
theme,
|
|
251
|
+
);
|
|
252
|
+
if (props.divider !== true || surface.borderColor != null) return surface;
|
|
253
|
+
return { ...surface, borderBottomColor: theme.palette.divider };
|
|
254
|
+
}
|
|
255
|
+
|
|
220
256
|
export function rowStyles(
|
|
221
257
|
props: BaseListCardProps,
|
|
222
258
|
shell: ReturnType<typeof useRowShell>,
|
|
223
259
|
cellTemplate: string | null,
|
|
224
260
|
): Record<string, unknown> {
|
|
225
|
-
const { group,
|
|
261
|
+
const { group, selectable, drag, reserve, pad, padY, scale, acts } = shell;
|
|
226
262
|
return {
|
|
227
|
-
...
|
|
228
|
-
{
|
|
229
|
-
...props,
|
|
230
|
-
selectable,
|
|
231
|
-
shape: "row",
|
|
232
|
-
state: drag.dragging ? "disabled" : props.state,
|
|
233
|
-
},
|
|
234
|
-
theme,
|
|
235
|
-
),
|
|
263
|
+
...rowSurface(props, shell),
|
|
236
264
|
...rowSx({
|
|
237
265
|
inGroup: group !== null,
|
|
238
266
|
railCount: group?.railCount ?? RAIL_COUNT,
|
|
@@ -7,6 +7,24 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { BaseCard } from "./base-card";
|
|
9
9
|
export { BaseListCard, type BaseListCardProps } from "./base-list-card";
|
|
10
|
+
// THE LIST'S HALF OF THE CARD API. `BaseListCard` alone is not usable as
|
|
11
|
+
// designed: its cells are declared by the GROUP and typed by
|
|
12
|
+
// `ListCardCellConfig`, and without these a consumer can only fall back to the
|
|
13
|
+
// named slots and standalone rails — which is the layout the cell config
|
|
14
|
+
// replaced, and gives up the alignment that was the point.
|
|
15
|
+
export {
|
|
16
|
+
ListCardGroup,
|
|
17
|
+
DEFAULT_RAILS,
|
|
18
|
+
RAIL_COUNT,
|
|
19
|
+
type ListRails,
|
|
20
|
+
} from "./list-card-rails";
|
|
21
|
+
export {
|
|
22
|
+
type ListCardCellConfig,
|
|
23
|
+
DEFAULT_CELL_WIDTH,
|
|
24
|
+
} from "./list-card-cells";
|
|
25
|
+
// Published by a drag container so a row can draw the marker; a consumer wiring
|
|
26
|
+
// its own DnD needs the type to build the value.
|
|
27
|
+
export { DropIndicator } from "./data-views-drag";
|
|
10
28
|
export {
|
|
11
29
|
DragContainerProvider,
|
|
12
30
|
useDragItem,
|
|
@@ -190,6 +190,7 @@ export const Select = React.forwardRef<HTMLDivElement, SelectProps>(
|
|
|
190
190
|
pulse,
|
|
191
191
|
'data-testid': dataTestId,
|
|
192
192
|
value,
|
|
193
|
+
'aria-label': ariaLabel,
|
|
193
194
|
...props
|
|
194
195
|
},
|
|
195
196
|
ref,
|
|
@@ -223,6 +224,24 @@ export const Select = React.forwardRef<HTMLDivElement, SelectProps>(
|
|
|
223
224
|
data-testid={dataTestId ? `${dataTestId}-select` : 'select'}
|
|
224
225
|
value={value ?? ''}
|
|
225
226
|
{...props}
|
|
227
|
+
/*
|
|
228
|
+
* `role="combobox"` sits on MUI's display DIV, not on the hidden
|
|
229
|
+
* native input that `{...props}` reaches — so an `aria-label` passed
|
|
230
|
+
* to this component never landed on the element carrying the role,
|
|
231
|
+
* and MUI's `aria-labelledby` then fell back to that div's OWN id.
|
|
232
|
+
* The control announced as its current value: a filter's field
|
|
233
|
+
* select read "Status" instead of "Filtro 1 — campo".
|
|
234
|
+
*
|
|
235
|
+
* Forwarding it here names the right element. The explicit
|
|
236
|
+
* `undefined` clears that self-referential `aria-labelledby`, which
|
|
237
|
+
* would otherwise win — a labelledby always beats a label in the
|
|
238
|
+
* accessible-name computation.
|
|
239
|
+
*/
|
|
240
|
+
SelectDisplayProps={
|
|
241
|
+
ariaLabel === undefined
|
|
242
|
+
? undefined
|
|
243
|
+
: { 'aria-label': ariaLabel, 'aria-labelledby': undefined }
|
|
244
|
+
}
|
|
226
245
|
>
|
|
227
246
|
{renderMenuItems(options, placeholder, dataTestId)}
|
|
228
247
|
</MuiSelect>
|