torch-glare 2.4.4 → 2.4.5
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/apps/lib/components/FormBuilder/fields/PhoneField.tsx +25 -0
- package/apps/lib/components/FormBuilder/fields/TableField.tsx +79 -51
- package/apps/lib/components/FormBuilder/form-builder.tsx +11 -3
- package/apps/lib/components/Input.tsx +3 -0
- package/apps/lib/components/SearchableTable.tsx +5 -4
- package/apps/lib/components/SectionBlock.tsx +58 -11
- package/apps/lib/components/Select.tsx +3 -1
- package/apps/lib/components/Table.tsx +265 -67
- package/apps/lib/registry.json +1 -1
- package/apps/lib/tsconfig.tsbuildinfo +1 -1
- package/docs/components/form-builder.md +16 -6
- package/docs/components/section-block.md +78 -2
- package/docs/components/table.md +44 -7
- package/docs/how-to/forms-with-form-builder.md +4 -2
- package/package.json +1 -1
|
@@ -32,7 +32,14 @@ const TableHeader = React.forwardRef<
|
|
|
32
32
|
>(({ className, ...props }, ref) => (
|
|
33
33
|
<thead
|
|
34
34
|
ref={ref}
|
|
35
|
-
|
|
35
|
+
// The header band is one continuous bar, not a per-cell background — a background on each
|
|
36
|
+
// `<th>` would paint over the half of the previous column's resize handle that overhangs
|
|
37
|
+
// the boundary.
|
|
38
|
+
className={cn(
|
|
39
|
+
"bg-background-presentation-form-header backdrop-blur-[8px]",
|
|
40
|
+
"shadow-[0px_4px_8px_0px_rgba(0,0,0,0.15)]",
|
|
41
|
+
className,
|
|
42
|
+
)}
|
|
36
43
|
{...props}
|
|
37
44
|
/>
|
|
38
45
|
));
|
|
@@ -95,6 +102,9 @@ const TableRow = React.forwardRef<
|
|
|
95
102
|
));
|
|
96
103
|
TableRow.displayName = "TableRow";
|
|
97
104
|
|
|
105
|
+
/** Floor for a drag-resized column, so dragging past the column's own left edge can't invert it. */
|
|
106
|
+
const MIN_COLUMN_WIDTH = 40;
|
|
107
|
+
|
|
98
108
|
const TableHead = React.forwardRef<
|
|
99
109
|
HTMLTableCellElement,
|
|
100
110
|
React.ThHTMLAttributes<HTMLTableCellElement> &
|
|
@@ -102,57 +112,133 @@ const TableHead = React.forwardRef<
|
|
|
102
112
|
React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
103
113
|
sortType?: "asc" | "desc" | undefined;
|
|
104
114
|
onSort?: () => void;
|
|
115
|
+
/** Column name for the sort button's accessible label. */
|
|
116
|
+
sortLabel?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Called with the new width (px) while the column is being drag-resized. Pass it to take
|
|
119
|
+
* **control** of the width — the header then renders `style.width` and expects you to
|
|
120
|
+
* feed the new value back. Required whenever the table needs a definite width
|
|
121
|
+
* (`table-layout: fixed`), because only the owner of every column width can total them.
|
|
122
|
+
* Omit for uncontrolled resizing, where the header keeps the width itself.
|
|
123
|
+
*/
|
|
124
|
+
onResize?: (width: number) => void;
|
|
125
|
+
/**
|
|
126
|
+
* Classes for the inner layout box (the flex row holding the label and sort toggle).
|
|
127
|
+
* `className` and every other prop go to the `<th>` — reach for this only when you need
|
|
128
|
+
* to restyle the content box itself, e.g. its typography or colour.
|
|
129
|
+
*/
|
|
130
|
+
contentClassName?: string;
|
|
105
131
|
isDummy?: boolean;
|
|
106
132
|
}
|
|
107
|
-
>(
|
|
108
|
-
|
|
109
|
-
|
|
133
|
+
>(
|
|
134
|
+
(
|
|
135
|
+
{
|
|
136
|
+
className,
|
|
137
|
+
contentClassName,
|
|
138
|
+
children,
|
|
139
|
+
style,
|
|
140
|
+
size = "M",
|
|
141
|
+
disabled,
|
|
142
|
+
sortType,
|
|
143
|
+
onSort,
|
|
144
|
+
sortLabel,
|
|
145
|
+
onResize,
|
|
146
|
+
isDummy,
|
|
147
|
+
...props
|
|
148
|
+
},
|
|
149
|
+
forwardedRef,
|
|
150
|
+
) => {
|
|
151
|
+
const headRef = useRef<HTMLTableCellElement>(null);
|
|
152
|
+
const { width, handleStartResize } = useResize(headRef as React.RefObject<HTMLElement>);
|
|
110
153
|
|
|
111
|
-
|
|
112
|
-
React.useEffect(() => {
|
|
113
|
-
if (!forwardedRef) return;
|
|
114
|
-
if (typeof forwardedRef === "function") forwardedRef(headRef.current);
|
|
115
|
-
else forwardedRef.current = headRef.current;
|
|
116
|
-
}, [forwardedRef]);
|
|
154
|
+
const clampedWidth = width === undefined ? undefined : Math.max(width, MIN_COLUMN_WIDTH);
|
|
117
155
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
156
|
+
React.useEffect(() => {
|
|
157
|
+
if (clampedWidth !== undefined) onResize?.(clampedWidth);
|
|
158
|
+
// `onResize` is intentionally not a dep — callers pass an inline closure, and re-firing
|
|
159
|
+
// on every render would loop.
|
|
160
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
161
|
+
}, [clampedWidth]);
|
|
162
|
+
|
|
163
|
+
// Combine refs using useEffect
|
|
164
|
+
React.useEffect(() => {
|
|
165
|
+
if (!forwardedRef) return;
|
|
166
|
+
if (typeof forwardedRef === "function") forwardedRef(headRef.current);
|
|
167
|
+
else forwardedRef.current = headRef.current;
|
|
168
|
+
}, [forwardedRef]);
|
|
169
|
+
|
|
170
|
+
// The width has to land on the `<th>` — that is the element the browser sizes the column
|
|
171
|
+
// from. Written to an inner div (as it once was) it did nothing at all. When `onResize` is
|
|
172
|
+
// given the caller owns the value and feeds it back via `style.width`; otherwise the drag
|
|
173
|
+
// result is applied here directly.
|
|
174
|
+
const resolvedWidth = onResize ? style?.width : (clampedWidth ?? style?.width);
|
|
175
|
+
|
|
176
|
+
return (
|
|
177
|
+
<th
|
|
178
|
+
ref={headRef}
|
|
179
|
+
// EVERY caller prop lands here: `className`, `style`, `aria-*` and event handlers
|
|
180
|
+
// alike. They have to share one element — dnd-kit's `useSortable` returns `attributes`
|
|
181
|
+
// (role/tabIndex/aria-*) and `listeners` (onKeyDown/onPointerDown) as a matched pair,
|
|
182
|
+
// and splitting them across the <th> and the inner div left the focusable node with no
|
|
183
|
+
// key handler. Use `contentClassName` to reach the inner box.
|
|
126
184
|
{...props}
|
|
185
|
+
style={{ ...style, width: resolvedWidth }}
|
|
127
186
|
className={cn(
|
|
128
|
-
|
|
129
|
-
{ "min-w-[100px]": !isDummy },
|
|
187
|
+
"relative h-[44px] py-[6px] px-[4px] border-b-[2px] border-border-presentation-table-header",
|
|
130
188
|
className,
|
|
131
189
|
)}
|
|
132
190
|
>
|
|
133
191
|
<div
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
192
|
+
className={cn(
|
|
193
|
+
tableHeadVariants({ size, disabled, isDummy }),
|
|
194
|
+
{
|
|
195
|
+
// Only when nothing has sized the column — otherwise this floor would overflow a
|
|
196
|
+
// column narrower than 100px.
|
|
197
|
+
"min-w-[100px]": !isDummy && resolvedWidth === undefined,
|
|
198
|
+
},
|
|
199
|
+
contentClassName,
|
|
200
|
+
)}
|
|
138
201
|
>
|
|
139
|
-
|
|
140
|
-
|
|
202
|
+
<div
|
|
203
|
+
className={cn("flex min-w-0 items-center justify-between flex-1", {
|
|
204
|
+
"justify-center": isDummy,
|
|
205
|
+
})}
|
|
206
|
+
>
|
|
207
|
+
{children}
|
|
208
|
+
{isDummy || !onSort ? null : (
|
|
209
|
+
<SortButton onSort={onSort} sortType={sortType} label={sortLabel} />
|
|
210
|
+
)}
|
|
211
|
+
</div>
|
|
141
212
|
</div>
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
213
|
+
{/* The grab target, straddling the column boundary. `z-10` keeps it above the next
|
|
214
|
+
column's content — it deliberately overhangs by half its width. The drag handlers
|
|
215
|
+
live here, not on the icon: the icon is `opacity-0` until hover, which made the
|
|
216
|
+
8px-wide SVG a near-impossible thing to grab. */}
|
|
217
|
+
<button
|
|
218
|
+
type="button"
|
|
219
|
+
disabled={isDummy}
|
|
220
|
+
aria-label="Resize column"
|
|
221
|
+
// Lets consumers exclude the grip from blanket `[&_button]` rules on a header row.
|
|
222
|
+
data-slot="resize-handle"
|
|
149
223
|
onMouseDown={handleStartResize}
|
|
150
224
|
onTouchStart={handleStartResize}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
225
|
+
className={cn(
|
|
226
|
+
"group/resize absolute top-[50%] translate-y-[-50%] z-10",
|
|
227
|
+
"right-[-4px] rtl:left-[-4px] rtl:right-[unset]",
|
|
228
|
+
// `absolute` already makes this the containing block for the grip icon.
|
|
229
|
+
"flex h-[24px] w-[8px] items-center justify-center cursor-col-resize",
|
|
230
|
+
"disabled:cursor-default",
|
|
231
|
+
)}
|
|
232
|
+
>
|
|
233
|
+
<span className="h-[20px] w-[2px] rounded-full bg-border-presentation-action-primary" />
|
|
234
|
+
<ResizeIcon
|
|
235
|
+
className={cn("group-hover/resize:opacity-100", { "!opacity-0": isDummy })}
|
|
236
|
+
/>
|
|
237
|
+
</button>
|
|
238
|
+
</th>
|
|
239
|
+
);
|
|
240
|
+
},
|
|
241
|
+
);
|
|
156
242
|
TableHead.displayName = "TableHead";
|
|
157
243
|
|
|
158
244
|
const TableCell = React.forwardRef<
|
|
@@ -161,15 +247,29 @@ const TableCell = React.forwardRef<
|
|
|
161
247
|
isDummy?: boolean;
|
|
162
248
|
childrenClassName?: string;
|
|
163
249
|
className?: string;
|
|
250
|
+
/**
|
|
251
|
+
* Minimum width of the cell's content box, in px. Defaults to 200 — pass `0` when the
|
|
252
|
+
* column width is driven by the caller (e.g. `FormBuilder.Table`'s `column.width`),
|
|
253
|
+
* otherwise this floor silently overrides any narrower column.
|
|
254
|
+
*/
|
|
255
|
+
minWidth?: number;
|
|
256
|
+
/**
|
|
257
|
+
* Fade the last 25% of the cell's content, to signal text clipped by the column width.
|
|
258
|
+
* Defaults to `true`. Set `false` for cells holding a **control** rather than text — the
|
|
259
|
+
* fade washes out whatever sits at the right edge (a Select's chevron, a date button).
|
|
260
|
+
* The built-in `:has(input)` escape hatch can't catch those, since a Radix trigger is a
|
|
261
|
+
* `<button>`, not an `<input>`.
|
|
262
|
+
*/
|
|
263
|
+
fade?: boolean;
|
|
164
264
|
}
|
|
165
|
-
>(({ className, childrenClassName, isDummy, ...props }, ref) => (
|
|
265
|
+
>(({ className, childrenClassName, isDummy, minWidth = 200, fade = true, ...props }, ref) => (
|
|
166
266
|
<td
|
|
167
267
|
ref={ref}
|
|
168
268
|
className={cn(
|
|
169
269
|
[
|
|
170
|
-
"h-[
|
|
270
|
+
"h-[50px] text-content-presentation-action-light-primary",
|
|
171
271
|
"typography-body-small-regular relative",
|
|
172
|
-
"border-r border-b border-border-presentation-table-header px-
|
|
272
|
+
"border-r border-b border-border-presentation-table-header px-[8px] rtl:border-l rtl:border-r-0",
|
|
173
273
|
"break-all",
|
|
174
274
|
],
|
|
175
275
|
className,
|
|
@@ -177,11 +277,21 @@ const TableCell = React.forwardRef<
|
|
|
177
277
|
{...props}
|
|
178
278
|
>
|
|
179
279
|
<div
|
|
280
|
+
style={isDummy ? undefined : { minWidth }}
|
|
180
281
|
className={cn(
|
|
181
|
-
"flex justify-start items-center gap-1
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
282
|
+
"flex justify-start items-center gap-1",
|
|
283
|
+
// This div hugs the control exactly — same height, and the control is `w-full` — so
|
|
284
|
+
// `overflow-hidden` clips every side of a drop shadow drawn on it. Text cells still
|
|
285
|
+
// need the crop to feed the fade gradient; control cells need the shadow to escape.
|
|
286
|
+
fade ? "overflow-hidden" : "overflow-visible",
|
|
287
|
+
// Never fade a dummy cell — its content is a centred checkbox or drag handle, not
|
|
288
|
+
// clippable text.
|
|
289
|
+
fade &&
|
|
290
|
+
!isDummy && [
|
|
291
|
+
"[mask-image:linear-gradient(to_right,black_0%,black_0%,black_75%,transparent_100%)]",
|
|
292
|
+
"rtl:[mask-image:linear-gradient(to_left,black_0%,black_0%,black_75%,transparent_100%)]",
|
|
293
|
+
"[&:has(input)]:[mask-image:none]",
|
|
294
|
+
],
|
|
185
295
|
{ "min-w-fit justify-center": isDummy },
|
|
186
296
|
childrenClassName,
|
|
187
297
|
)}
|
|
@@ -207,6 +317,75 @@ const TableCheckbox = React.forwardRef<
|
|
|
207
317
|
});
|
|
208
318
|
TableCheckbox.displayName = "TableCheckbox";
|
|
209
319
|
|
|
320
|
+
/**
|
|
321
|
+
* The full-width action bar that sits **below** a table — e.g. "+ Add New".
|
|
322
|
+
*
|
|
323
|
+
* Deliberately not a `<tr>`: it renders as a sibling of the table's horizontal scroll
|
|
324
|
+
* container, so it stays put while the columns scroll sideways under it. Use
|
|
325
|
+
* `TableFooterButton` instead when the action must scroll with the grid.
|
|
326
|
+
*/
|
|
327
|
+
const TableEndAction = React.forwardRef<
|
|
328
|
+
HTMLButtonElement,
|
|
329
|
+
React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
330
|
+
>(({ className, children, ...props }, ref) => (
|
|
331
|
+
<button
|
|
332
|
+
ref={ref}
|
|
333
|
+
type="button"
|
|
334
|
+
className={cn(
|
|
335
|
+
"flex h-[40px] w-full items-center justify-start gap-[8px] px-[8px]",
|
|
336
|
+
// No border. Figma's Table-End-Action-1.0 has none — it rounds its own bottom corners
|
|
337
|
+
// so it can sit flush on the card edge. A rule here is invisible against the card until
|
|
338
|
+
// the hover fill lands behind it, at which point it reads as a hard line cutting across
|
|
339
|
+
// the bar.
|
|
340
|
+
"rounded-bl-[16px] rounded-br-[16px]",
|
|
341
|
+
"typography-body-medium-semibold text-content-presentation-action-light-primary",
|
|
342
|
+
// NB: the "acton" spelling is the token that actually exists; the correctly-spelled
|
|
343
|
+
// `…table-action-hover` is defined nowhere and would be a dead class.
|
|
344
|
+
"transition-[background-color,box-shadow] hover:bg-background-presentation-table-acton-hover",
|
|
345
|
+
// Hover draws a ring rather than a border: it renders inset, so it costs no layout and
|
|
346
|
+
// can't push the bar's 40px box around the way a border would.
|
|
347
|
+
"hover:ring-2 hover:ring-inset hover:ring-border-presentation-table-action-hover",
|
|
348
|
+
"outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-border-presentation-state-focus",
|
|
349
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
350
|
+
"[&_i]:text-[20px]",
|
|
351
|
+
className,
|
|
352
|
+
)}
|
|
353
|
+
{...props}
|
|
354
|
+
>
|
|
355
|
+
{children}
|
|
356
|
+
</button>
|
|
357
|
+
));
|
|
358
|
+
TableEndAction.displayName = "TableEndAction";
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Horizontal scroll container for a table — the 14px scroller row from the design,
|
|
362
|
+
* with the thin track that thickens and turns blue on hover.
|
|
363
|
+
*/
|
|
364
|
+
const TableScroller = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
365
|
+
({ className, children, ...props }, ref) => (
|
|
366
|
+
<div
|
|
367
|
+
ref={ref}
|
|
368
|
+
className={cn(
|
|
369
|
+
"w-full overflow-x-auto overflow-y-hidden",
|
|
370
|
+
"[&::-webkit-scrollbar]:h-[14px]",
|
|
371
|
+
"[&::-webkit-scrollbar-track]:bg-transparent",
|
|
372
|
+
"[&::-webkit-scrollbar-thumb]:rounded-[7px]",
|
|
373
|
+
"[&::-webkit-scrollbar-thumb]:border-[5px] [&::-webkit-scrollbar-thumb]:border-solid",
|
|
374
|
+
"[&::-webkit-scrollbar-thumb]:border-transparent",
|
|
375
|
+
"[&::-webkit-scrollbar-thumb]:bg-clip-content",
|
|
376
|
+
"[&::-webkit-scrollbar-thumb]:bg-background-presentation-body-scroller-default",
|
|
377
|
+
"[&::-webkit-scrollbar-thumb:hover]:border-[3px]",
|
|
378
|
+
"[&::-webkit-scrollbar-thumb:hover]:bg-background-presentation-body-scroller-hover",
|
|
379
|
+
className,
|
|
380
|
+
)}
|
|
381
|
+
{...props}
|
|
382
|
+
>
|
|
383
|
+
{children}
|
|
384
|
+
</div>
|
|
385
|
+
),
|
|
386
|
+
);
|
|
387
|
+
TableScroller.displayName = "TableScroller";
|
|
388
|
+
|
|
210
389
|
const TableCaption = React.forwardRef<
|
|
211
390
|
HTMLTableCaptionElement,
|
|
212
391
|
React.HTMLAttributes<HTMLTableCaptionElement>
|
|
@@ -225,7 +404,9 @@ const TableFooterButton = React.forwardRef<
|
|
|
225
404
|
<TableRow className={cn("h-[40px] overflow-hidden", className)}>
|
|
226
405
|
<TableCell
|
|
227
406
|
className={
|
|
228
|
-
|
|
407
|
+
// `h-[40px]` because the row asks for 40 and body cells default to 50 — the two sit
|
|
408
|
+
// on different elements, so CSS would otherwise take the larger and grow the footer.
|
|
409
|
+
"h-[40px] border-t-2 border-b-2 border-transparent hover:border-border-presentation-table-action-hover hover:bg-background-presentation-table-acton-hover"
|
|
229
410
|
}
|
|
230
411
|
colSpan={100}
|
|
231
412
|
>
|
|
@@ -291,37 +472,41 @@ export {
|
|
|
291
472
|
TableCheckbox,
|
|
292
473
|
SubTableButton,
|
|
293
474
|
TableFooterButton,
|
|
475
|
+
TableEndAction,
|
|
476
|
+
TableScroller,
|
|
294
477
|
};
|
|
295
478
|
|
|
296
479
|
interface ResizeIconProps {
|
|
297
480
|
className?: string;
|
|
298
|
-
onMouseDown?: React.MouseEventHandler<SVGElement>;
|
|
299
|
-
onTouchStart?: React.TouchEventHandler<SVGElement>;
|
|
300
481
|
}
|
|
301
482
|
|
|
302
|
-
|
|
483
|
+
/**
|
|
484
|
+
* The grip that appears on hover. Sized to its parent button (8px wide), so it can't spill
|
|
485
|
+
* past the grab target; the button is what deliberately straddles the column boundary.
|
|
486
|
+
*/
|
|
487
|
+
const ResizeIcon = ({ className }: ResizeIconProps) => {
|
|
303
488
|
return (
|
|
304
489
|
<svg
|
|
305
|
-
{...props}
|
|
306
490
|
className={cn(
|
|
307
|
-
"
|
|
308
|
-
|
|
491
|
+
"pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
492
|
+
"opacity-0 transition-opacity duration-200",
|
|
493
|
+
className,
|
|
309
494
|
)}
|
|
310
495
|
width="8"
|
|
311
|
-
height="
|
|
312
|
-
viewBox="0
|
|
496
|
+
height="30"
|
|
497
|
+
viewBox="0 1 8 38"
|
|
313
498
|
fill="none"
|
|
314
499
|
xmlns="http://www.w3.org/2000/svg"
|
|
315
500
|
>
|
|
316
|
-
<rect
|
|
317
|
-
<circle
|
|
318
|
-
<circle
|
|
319
|
-
<circle
|
|
320
|
-
<circle
|
|
321
|
-
<circle
|
|
322
|
-
<circle
|
|
323
|
-
<circle
|
|
324
|
-
<circle
|
|
501
|
+
<rect y="5" width="8" height="30" rx="3" fill="#3391FF" />
|
|
502
|
+
<circle cx="2.75" cy="15.5" r="0.75" fill="#F9F9F9" />
|
|
503
|
+
<circle cx="5.25" cy="15.5" r="0.75" fill="#F9F9F9" />
|
|
504
|
+
<circle cx="2.75" cy="18.5" r="0.75" fill="#F9F9F9" />
|
|
505
|
+
<circle cx="5.25" cy="18.5" r="0.75" fill="#F9F9F9" />
|
|
506
|
+
<circle cx="2.75" cy="21.5" r="0.75" fill="#F9F9F9" />
|
|
507
|
+
<circle cx="5.25" cy="21.5" r="0.75" fill="#F9F9F9" />
|
|
508
|
+
<circle cx="2.75" cy="24.5" r="0.75" fill="#F9F9F9" />
|
|
509
|
+
<circle cx="5.25" cy="24.5" r="0.75" fill="#F9F9F9" />
|
|
325
510
|
</svg>
|
|
326
511
|
);
|
|
327
512
|
};
|
|
@@ -329,12 +514,25 @@ const ResizeIcon = (props: ResizeIconProps) => {
|
|
|
329
514
|
const SortButton = ({
|
|
330
515
|
onSort,
|
|
331
516
|
sortType,
|
|
517
|
+
label,
|
|
332
518
|
}: {
|
|
333
519
|
onSort?: () => void;
|
|
334
520
|
sortType?: "asc" | "desc" | undefined;
|
|
521
|
+
/** What this button sorts — without it the control is an unnamed icon. */
|
|
522
|
+
label?: string;
|
|
335
523
|
}) => {
|
|
524
|
+
const next = sortType === "asc" ? "descending" : "ascending";
|
|
336
525
|
return (
|
|
337
|
-
|
|
526
|
+
// `type="button"` matters: this table renders inside a <form> (FormBuilder.Table),
|
|
527
|
+
// where an untyped button defaults to submit.
|
|
528
|
+
<button
|
|
529
|
+
type="button"
|
|
530
|
+
// `onClick`, not `onPointerDown`: a button activated from the keyboard fires
|
|
531
|
+
// `click` only, so pointer-down made this mouse-only.
|
|
532
|
+
onClick={onSort}
|
|
533
|
+
aria-label={label ? `Sort by ${label} ${next}` : `Sort ${next}`}
|
|
534
|
+
className={cn("cursor-pointer text-[16px] z-10")}
|
|
535
|
+
>
|
|
338
536
|
{sortType === "asc" ? (
|
|
339
537
|
<i className="ri-arrow-up-line text-border-presentation-state-focus" />
|
|
340
538
|
) : sortType === "desc" ? (
|
|
@@ -379,9 +577,9 @@ const tableHeadVariants = cva(
|
|
|
379
577
|
isDummy: {
|
|
380
578
|
true: ["hover:bg-transparent", "hover:text-content-presentation-global-primary"],
|
|
381
579
|
},
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
580
|
+
},
|
|
581
|
+
defaultVariants: {
|
|
582
|
+
size: "M",
|
|
385
583
|
},
|
|
386
584
|
},
|
|
387
585
|
);
|
package/apps/lib/registry.json
CHANGED