@astryxdesign/core 0.2.0-canary.77b3b61 → 0.2.0-canary.79cf94a
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/dist/Lightbox/Lightbox.d.ts +5 -3
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +101 -23
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +14 -15
- package/dist/Table/TableCell.js +3 -1
- package/dist/Table/TableHeaderCell.js +3 -1
- package/dist/astryx.umd.js +34 -34
- package/dist/astryx.umd.js.map +3 -3
- package/dist/i18n/InternationalizationProvider.d.ts +6 -0
- package/dist/i18n/InternationalizationProvider.d.ts.map +1 -1
- package/dist/i18n/useDirection.d.ts.map +1 -1
- package/dist/i18n/useDirection.js +6 -3
- package/locales/en.json +12 -0
- package/locales/pseudo.json +9 -0
- package/package.json +2 -2
- package/src/Lightbox/Lightbox.doc.mjs +2 -2
- package/src/Lightbox/Lightbox.test.tsx +178 -0
- package/src/Lightbox/Lightbox.tsx +93 -18
- package/src/Pagination/Pagination.tsx +12 -10
- package/src/Table/Table.doc.mjs +2 -2
- package/src/Table/Table.test.tsx +27 -0
- package/src/Table/TableCell.tsx +1 -1
- package/src/Table/TableHeaderCell.tsx +1 -1
- package/src/i18n/InternationalizationProvider.doc.mjs +12 -0
- package/src/i18n/InternationalizationProvider.tsx +6 -0
- package/src/i18n/useDirection.ts +6 -3
|
@@ -65,8 +65,8 @@ export interface LightboxProps extends BaseProps<HTMLDialogElement> {
|
|
|
65
65
|
*/
|
|
66
66
|
onIndexChange?: (index: number) => void;
|
|
67
67
|
/**
|
|
68
|
-
* Enable zoom on double-click
|
|
69
|
-
* When zoomed, drag to pan.
|
|
68
|
+
* Enable zoom on double-click, or Enter/Space/`+`/`-` via keyboard
|
|
69
|
+
* (images only). When zoomed, drag or use arrow keys to pan.
|
|
70
70
|
* @default false
|
|
71
71
|
*/
|
|
72
72
|
hasZoom?: boolean;
|
|
@@ -81,7 +81,9 @@ export interface LightboxProps extends BaseProps<HTMLDialogElement> {
|
|
|
81
81
|
*
|
|
82
82
|
* Supports single image and gallery modes. In gallery mode, provides
|
|
83
83
|
* prev/next navigation via buttons and arrow keys. Optionally supports
|
|
84
|
-
* zoom (double-click
|
|
84
|
+
* zoom (double-click, Enter/Space on the image, or `+`/`-` to toggle 2x)
|
|
85
|
+
* and pan (drag or arrow keys when zoomed; arrows navigate the gallery
|
|
86
|
+
* when not zoomed).
|
|
85
87
|
*
|
|
86
88
|
* Uses the native `<dialog>` element with `showModal()` for focus
|
|
87
89
|
* trapping and top-layer placement. Dismiss via Escape, close button,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lightbox.d.ts","sourceRoot":"","sources":["../../src/Lightbox/Lightbox.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AASf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAI5C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,OAAO,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,uBAAuB;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,gEAAgE;IAChE,GAAG,EAAE,MAAM,CAAC;IACZ,iDAAiD;IACjD,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,iBAAiB,CAAC;CAC1B;AAED,MAAM,WAAW,aAAc,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IACjE,+CAA+C;IAC/C,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAA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AE,MAAM,CAAC;IACf;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AA6JD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,QAAQ,CAAC,EACvB,MAAM,EACN,YAAY,EACZ,KAAK,EACL,KAAK,EAAE,eAAe,EACtB,YAAgB,EAChB,aAAa,EACb,OAAe,EACf,WAAmB,EACnB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,aAAa,EACxB,GAAG,KAAK,EACT,EAAE,aAAa,sCAyYf;yBAzZe,QAAQ"}
|
|
@@ -85,12 +85,28 @@ const dynamicStyles = {
|
|
|
85
85
|
}]
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
+
/**
|
|
89
|
+
* Pan distance (px) per arrow-key press while zoomed. Offsets move the
|
|
90
|
+
* viewport in the arrow's direction — pressing ArrowRight reveals content to
|
|
91
|
+
* the right, so the image itself shifts left (negative x), matching how
|
|
92
|
+
* scrolling and pointer-drag panning feel.
|
|
93
|
+
*/
|
|
94
|
+
const KEYBOARD_PAN_STEP = 50;
|
|
95
|
+
const KEYBOARD_PAN_OFFSETS = {
|
|
96
|
+
ArrowLeft: [KEYBOARD_PAN_STEP, 0],
|
|
97
|
+
ArrowRight: [-KEYBOARD_PAN_STEP, 0],
|
|
98
|
+
ArrowUp: [0, KEYBOARD_PAN_STEP],
|
|
99
|
+
ArrowDown: [0, -KEYBOARD_PAN_STEP]
|
|
100
|
+
};
|
|
101
|
+
|
|
88
102
|
/**
|
|
89
103
|
* A fullscreen overlay for viewing images at full resolution.
|
|
90
104
|
*
|
|
91
105
|
* Supports single image and gallery modes. In gallery mode, provides
|
|
92
106
|
* prev/next navigation via buttons and arrow keys. Optionally supports
|
|
93
|
-
* zoom (double-click
|
|
107
|
+
* zoom (double-click, Enter/Space on the image, or `+`/`-` to toggle 2x)
|
|
108
|
+
* and pan (drag or arrow keys when zoomed; arrows navigate the gallery
|
|
109
|
+
* when not zoomed).
|
|
94
110
|
*
|
|
95
111
|
* Uses the native `<dialog>` element with `showModal()` for focus
|
|
96
112
|
* trapping and top-layer placement. Dismiss via Escape, close button,
|
|
@@ -266,8 +282,49 @@ export function Lightbox({
|
|
|
266
282
|
}
|
|
267
283
|
}, [canNext, index, setIndex]);
|
|
268
284
|
|
|
269
|
-
//
|
|
285
|
+
// Zoom: double-click, Enter/Space on the image, or +/- keys toggle 1x ↔ 2x.
|
|
286
|
+
// Zoom changes are silent to assistive tech (only the transform changes), so
|
|
287
|
+
// mirror them in the polite live region, including a hint that arrow keys
|
|
288
|
+
// pan while zoomed.
|
|
289
|
+
const applyZoom = useCallback(next => {
|
|
290
|
+
if (!hasZoom || isVideo || next === zoom) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
setZoom(next);
|
|
294
|
+
setPan({
|
|
295
|
+
x: 0,
|
|
296
|
+
y: 0
|
|
297
|
+
});
|
|
298
|
+
announce(next > 1 ? t('@astryx.lightbox.zoomedIn') : t('@astryx.lightbox.zoomedOut'));
|
|
299
|
+
}, [hasZoom, isVideo, zoom, announce, t]);
|
|
300
|
+
const handleDoubleClick = useCallback(() => {
|
|
301
|
+
applyZoom(zoom === 1 ? 2 : 1);
|
|
302
|
+
}, [applyZoom, zoom]);
|
|
303
|
+
|
|
304
|
+
// Keyboard navigation. While zoomed, arrows pan the image (matching common
|
|
305
|
+
// lightbox conventions); when not zoomed they navigate the gallery.
|
|
270
306
|
const handleKeyDown = useCallback(e => {
|
|
307
|
+
if (hasZoom && !isVideo) {
|
|
308
|
+
if (e.key === '+' || e.key === '=') {
|
|
309
|
+
e.preventDefault();
|
|
310
|
+
applyZoom(2);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
if (e.key === '-') {
|
|
314
|
+
e.preventDefault();
|
|
315
|
+
applyZoom(1);
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
if (zoom > 1 && KEYBOARD_PAN_OFFSETS[e.key] !== undefined) {
|
|
319
|
+
e.preventDefault();
|
|
320
|
+
const [dx, dy] = KEYBOARD_PAN_OFFSETS[e.key];
|
|
321
|
+
setPan(prev => ({
|
|
322
|
+
x: prev.x + dx,
|
|
323
|
+
y: prev.y + dy
|
|
324
|
+
}));
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
271
328
|
if (e.key === 'ArrowLeft') {
|
|
272
329
|
e.preventDefault();
|
|
273
330
|
goToPrev();
|
|
@@ -275,27 +332,15 @@ export function Lightbox({
|
|
|
275
332
|
e.preventDefault();
|
|
276
333
|
goToNext();
|
|
277
334
|
}
|
|
278
|
-
}, [goToPrev, goToNext]);
|
|
335
|
+
}, [hasZoom, isVideo, zoom, applyZoom, goToPrev, goToNext]);
|
|
279
336
|
|
|
280
|
-
//
|
|
281
|
-
const
|
|
282
|
-
if (
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
if (zoom === 1) {
|
|
286
|
-
setZoom(2);
|
|
287
|
-
setPan({
|
|
288
|
-
x: 0,
|
|
289
|
-
y: 0
|
|
290
|
-
});
|
|
291
|
-
} else {
|
|
292
|
-
setZoom(1);
|
|
293
|
-
setPan({
|
|
294
|
-
x: 0,
|
|
295
|
-
y: 0
|
|
296
|
-
});
|
|
337
|
+
// Enter/Space on the focused image wrapper (role="button") toggles zoom.
|
|
338
|
+
const handleImageKeyDown = useCallback(e => {
|
|
339
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
340
|
+
e.preventDefault();
|
|
341
|
+
handleDoubleClick();
|
|
297
342
|
}
|
|
298
|
-
}, [
|
|
343
|
+
}, [handleDoubleClick]);
|
|
299
344
|
|
|
300
345
|
// Pan: mouse drag when zoomed
|
|
301
346
|
const handlePointerDown = useCallback(e => {
|
|
@@ -335,6 +380,7 @@ export function Lightbox({
|
|
|
335
380
|
};
|
|
336
381
|
}, [isDragging]);
|
|
337
382
|
const isZoomed = zoom > 1;
|
|
383
|
+
const isZoomTarget = hasZoom && !isVideo;
|
|
338
384
|
const imageTransform = zoom === 1 ? null : `scale(${zoom}) translate(${pan.x / zoom}px, ${pan.y / zoom}px)`;
|
|
339
385
|
if (!currentItem) {
|
|
340
386
|
return null;
|
|
@@ -397,34 +443,66 @@ export function Lightbox({
|
|
|
397
443
|
className: "x78zum5 xdt5ytf x6s0dn4 x193iq5w xmz0i5r xb3r6kr"
|
|
398
444
|
},
|
|
399
445
|
children: [/*#__PURE__*/_jsx("div", {
|
|
400
|
-
ref: imageWrapperRef
|
|
446
|
+
ref: imageWrapperRef
|
|
447
|
+
// The wrapper is a keyboard-operable zoom toggle when zoom is
|
|
448
|
+
// enabled: Enter/Space toggles, aria-pressed reflects state.
|
|
449
|
+
,
|
|
450
|
+
role: isZoomTarget ? 'button' : undefined,
|
|
451
|
+
tabIndex: isZoomTarget ? 0 : undefined,
|
|
452
|
+
"aria-pressed": isZoomTarget ? isZoomed : undefined,
|
|
453
|
+
"aria-label": isZoomTarget ? t('@astryx.lightbox.zoom') : undefined,
|
|
401
454
|
...{
|
|
402
455
|
0: {
|
|
403
456
|
className: "x78zum5 x6s0dn4 xl56j7k xb3r6kr xt0e3qv x87ps6o x2lwn1j"
|
|
404
457
|
},
|
|
458
|
+
8: {
|
|
459
|
+
className: "x78zum5 x6s0dn4 xl56j7k xb3r6kr xt0e3qv x87ps6o x2lwn1j x1a2a7pz x17nn4n9 x1wfwxd8 x7s97pk"
|
|
460
|
+
},
|
|
405
461
|
4: {
|
|
406
462
|
className: "x78zum5 x6s0dn4 xl56j7k xb3r6kr x87ps6o x2lwn1j x1huxd7x x2dt3px"
|
|
407
463
|
},
|
|
464
|
+
12: {
|
|
465
|
+
className: "x78zum5 x6s0dn4 xl56j7k xb3r6kr x87ps6o x2lwn1j x1a2a7pz x17nn4n9 x1wfwxd8 x7s97pk x1huxd7x x2dt3px"
|
|
466
|
+
},
|
|
408
467
|
2: {
|
|
409
468
|
className: "x78zum5 x6s0dn4 xl56j7k xb3r6kr x87ps6o x2lwn1j x1jm3nie"
|
|
410
469
|
},
|
|
470
|
+
10: {
|
|
471
|
+
className: "x78zum5 x6s0dn4 xl56j7k xb3r6kr x87ps6o x2lwn1j x1a2a7pz x17nn4n9 x1wfwxd8 x7s97pk x1jm3nie"
|
|
472
|
+
},
|
|
411
473
|
6: {
|
|
412
474
|
className: "x78zum5 x6s0dn4 xl56j7k xb3r6kr x87ps6o x2lwn1j x1jm3nie"
|
|
413
475
|
},
|
|
476
|
+
14: {
|
|
477
|
+
className: "x78zum5 x6s0dn4 xl56j7k xb3r6kr x87ps6o x2lwn1j x1a2a7pz x17nn4n9 x1wfwxd8 x7s97pk x1jm3nie"
|
|
478
|
+
},
|
|
414
479
|
1: {
|
|
415
480
|
className: "x78zum5 x6s0dn4 xl56j7k xb3r6kr x87ps6o x2lwn1j xi9pz9s"
|
|
416
481
|
},
|
|
482
|
+
9: {
|
|
483
|
+
className: "x78zum5 x6s0dn4 xl56j7k xb3r6kr x87ps6o x2lwn1j x1a2a7pz x17nn4n9 x1wfwxd8 x7s97pk xi9pz9s"
|
|
484
|
+
},
|
|
417
485
|
5: {
|
|
418
486
|
className: "x78zum5 x6s0dn4 xl56j7k xb3r6kr x87ps6o x2lwn1j xi9pz9s"
|
|
419
487
|
},
|
|
488
|
+
13: {
|
|
489
|
+
className: "x78zum5 x6s0dn4 xl56j7k xb3r6kr x87ps6o x2lwn1j x1a2a7pz x17nn4n9 x1wfwxd8 x7s97pk xi9pz9s"
|
|
490
|
+
},
|
|
420
491
|
3: {
|
|
421
492
|
className: "x78zum5 x6s0dn4 xl56j7k xb3r6kr x87ps6o x2lwn1j xi9pz9s"
|
|
422
493
|
},
|
|
494
|
+
11: {
|
|
495
|
+
className: "x78zum5 x6s0dn4 xl56j7k xb3r6kr x87ps6o x2lwn1j x1a2a7pz x17nn4n9 x1wfwxd8 x7s97pk xi9pz9s"
|
|
496
|
+
},
|
|
423
497
|
7: {
|
|
424
498
|
className: "x78zum5 x6s0dn4 xl56j7k xb3r6kr x87ps6o x2lwn1j xi9pz9s"
|
|
499
|
+
},
|
|
500
|
+
15: {
|
|
501
|
+
className: "x78zum5 x6s0dn4 xl56j7k xb3r6kr x87ps6o x2lwn1j x1a2a7pz x17nn4n9 x1wfwxd8 x7s97pk xi9pz9s"
|
|
425
502
|
}
|
|
426
|
-
}[!!(!isVideo && hasZoom && !isZoomed) << 2 | !!(!isVideo && isZoomed) << 1 | !!(!isVideo && isDragging) << 0],
|
|
503
|
+
}[!!isZoomTarget << 3 | !!(!isVideo && hasZoom && !isZoomed) << 2 | !!(!isVideo && isZoomed) << 1 | !!(!isVideo && isDragging) << 0],
|
|
427
504
|
onDoubleClick: isVideo ? undefined : handleDoubleClick,
|
|
505
|
+
onKeyDown: isZoomTarget ? handleImageKeyDown : undefined,
|
|
428
506
|
onPointerDown: isVideo ? undefined : handlePointerDown,
|
|
429
507
|
children: isVideo ? /*#__PURE__*/_jsx("video", {
|
|
430
508
|
src: currentItem.src,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../src/Pagination/Pagination.tsx"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../src/Pagination/Pagination.tsx"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,SAAS,CAAC;AAMlD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,oBAAoB,CAAC;AAE3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,EAAE,MAAM,GACnB,CAAC,MAAM,GAAG,KAAK,CAAC,EAAE,CA6CpB;AAMD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,UAAU,EAAE,cAAc,EAC1B,OAAO,EACP,QAAQ,EAAE,YAAiB,EAC3B,eAAe,EACf,gBAAgB,EAChB,OAAiB,EACjB,YAAgB,EAChB,IAAW,EACX,UAAkB,EAClB,KAAK,EAAE,cAAc,EACrB,aAAa,EAAE,MAAM,EACrB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,eAAe,sCAoVjB;yBAzWe,UAAU"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @file Pagination.tsx
|
|
7
7
|
* @input Uses React, StyleX, Button, Icon, Selector, Text; page number buttons delegate to Button.
|
|
8
|
-
*
|
|
8
|
+
* Prev/next chevrons mirror under RTL via the shared rtlStyles.mirror (CSS scaleX), not a JS direction read.
|
|
9
9
|
* @output Exports Pagination component, PaginationProps, PaginationVariant, PaginationSize types
|
|
10
10
|
* @position Core implementation; consumed by index.ts, tested by Pagination.test.tsx
|
|
11
11
|
*
|
|
@@ -29,10 +29,9 @@ import { Selector } from "../Selector/index.js";
|
|
|
29
29
|
import { Text } from "../Text/index.js";
|
|
30
30
|
import { useAnnounce } from "../hooks/useAnnounce.js";
|
|
31
31
|
import { useListFocus } from "../hooks/useListFocus.js";
|
|
32
|
-
import { mergeProps } from "../utils/index.js";
|
|
32
|
+
import { mergeProps, rtlStyles } from "../utils/index.js";
|
|
33
33
|
import { themeProps } from "../utils/themeProps.js";
|
|
34
34
|
import { useTranslator } from "../i18n/useTranslator.js";
|
|
35
|
-
import { useDirection } from "../i18n/useDirection.js";
|
|
36
35
|
|
|
37
36
|
// =============================================================================
|
|
38
37
|
// Types
|
|
@@ -172,12 +171,6 @@ export function Pagination({
|
|
|
172
171
|
const label = labelFromProps ?? t('@astryx.pagination.label');
|
|
173
172
|
const previousLabel = t('@astryx.pagination.previous');
|
|
174
173
|
const nextLabel = t('@astryx.pagination.next');
|
|
175
|
-
|
|
176
|
-
// Directional icons: under RTL, the "previous" control points right and the
|
|
177
|
-
// "next" control points left. aria-labels stay semantic (unchanged).
|
|
178
|
-
const direction = useDirection();
|
|
179
|
-
const previousIcon = direction === 'rtl' ? 'chevronRight' : 'chevronLeft';
|
|
180
|
-
const nextIcon = direction === 'rtl' ? 'chevronLeft' : 'chevronRight';
|
|
181
174
|
const pageIndicatorsLabel = t('@astryx.pagination.pageIndicators');
|
|
182
175
|
const itemsPerPageLabel = t('@astryx.pagination.itemsPerPage');
|
|
183
176
|
|
|
@@ -482,9 +475,12 @@ export function Pagination({
|
|
|
482
475
|
label: previousLabel,
|
|
483
476
|
variant: "ghost",
|
|
484
477
|
size: buttonSize,
|
|
485
|
-
icon: /*#__PURE__*/_jsx(
|
|
486
|
-
|
|
487
|
-
|
|
478
|
+
icon: /*#__PURE__*/_jsx("span", {
|
|
479
|
+
...stylex.props(rtlStyles.mirror),
|
|
480
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
481
|
+
icon: "chevronLeft",
|
|
482
|
+
size: isSm ? 'sm' : 'md'
|
|
483
|
+
})
|
|
488
484
|
}),
|
|
489
485
|
onClick: handlePrevious,
|
|
490
486
|
isDisabled: isDisabled || !hasPrevious,
|
|
@@ -493,9 +489,12 @@ export function Pagination({
|
|
|
493
489
|
label: nextLabel,
|
|
494
490
|
variant: "ghost",
|
|
495
491
|
size: buttonSize,
|
|
496
|
-
icon: /*#__PURE__*/_jsx(
|
|
497
|
-
|
|
498
|
-
|
|
492
|
+
icon: /*#__PURE__*/_jsx("span", {
|
|
493
|
+
...stylex.props(rtlStyles.mirror),
|
|
494
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
495
|
+
icon: "chevronRight",
|
|
496
|
+
size: isSm ? 'sm' : 'md'
|
|
497
|
+
})
|
|
499
498
|
}),
|
|
500
499
|
onClick: handleNext,
|
|
501
500
|
isDisabled: isDisabled || !hasNext,
|
package/dist/Table/TableCell.js
CHANGED
|
@@ -182,7 +182,9 @@ export function TableCell({
|
|
|
182
182
|
return /*#__PURE__*/_jsx("td", {
|
|
183
183
|
ref: ref,
|
|
184
184
|
...props,
|
|
185
|
-
...mergeProps(themeProps('table-cell'
|
|
185
|
+
...mergeProps(themeProps('table-cell', {
|
|
186
|
+
density: ctx?.density
|
|
187
|
+
}), stylex.props(...mergeXStyle(cellStyles, xstyle)), incomingClassName, incomingStyle),
|
|
186
188
|
children: content
|
|
187
189
|
});
|
|
188
190
|
}
|
|
@@ -120,7 +120,9 @@ export function TableHeaderCell({
|
|
|
120
120
|
return /*#__PURE__*/_jsx("th", {
|
|
121
121
|
ref: ref,
|
|
122
122
|
...props,
|
|
123
|
-
...mergeProps(themeProps('table-header-cell'
|
|
123
|
+
...mergeProps(themeProps('table-header-cell', {
|
|
124
|
+
density: ctx?.density
|
|
125
|
+
}), stylex.props(...mergeXStyle(cellStyles, xstyle)), incomingClassName, incomingStyle),
|
|
124
126
|
children: content
|
|
125
127
|
});
|
|
126
128
|
}
|