@flipdish/ui-library 0.45.3 → 0.46.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/dist/components/molecules/Pagination/components/PaginationBase.cjs +20 -6
- package/dist/components/molecules/Pagination/components/PaginationBase.cjs.map +1 -1
- package/dist/components/molecules/Pagination/components/PaginationBase.d.ts +7 -2
- package/dist/components/molecules/Pagination/components/PaginationBase.d.ts.map +1 -1
- package/dist/components/molecules/Pagination/components/PaginationBase.js +19 -6
- package/dist/components/molecules/Pagination/components/PaginationBase.js.map +1 -1
- package/dist/components/molecules/Pagination/components/PaginationDot.cjs +2 -2
- package/dist/components/molecules/Pagination/components/PaginationDot.cjs.map +1 -1
- package/dist/components/molecules/Pagination/components/PaginationDot.js +3 -3
- package/dist/components/molecules/Pagination/components/PaginationDot.js.map +1 -1
- package/dist/components/molecules/Pagination/components/PaginationLine.cjs +2 -2
- package/dist/components/molecules/Pagination/components/PaginationLine.cjs.map +1 -1
- package/dist/components/molecules/Pagination/components/PaginationLine.js +3 -3
- package/dist/components/molecules/Pagination/components/PaginationLine.js.map +1 -1
- package/dist/components/molecules/Pagination/index.cjs +48 -64
- package/dist/components/molecules/Pagination/index.cjs.map +1 -1
- package/dist/components/molecules/Pagination/index.d.ts +24 -71
- package/dist/components/molecules/Pagination/index.d.ts.map +1 -1
- package/dist/components/molecules/Pagination/index.js +52 -63
- package/dist/components/molecules/Pagination/index.js.map +1 -1
- package/dist/components/organisms/Table/index.cjs +5 -2
- package/dist/components/organisms/Table/index.cjs.map +1 -1
- package/dist/components/organisms/Table/index.d.ts +5 -1
- package/dist/components/organisms/Table/index.d.ts.map +1 -1
- package/dist/components/organisms/Table/index.js +5 -2
- package/dist/components/organisms/Table/index.js.map +1 -1
- package/dist/components/organisms/VideoPlayer/hooks/useVideoPlayback.cjs +11 -20
- package/dist/components/organisms/VideoPlayer/hooks/useVideoPlayback.cjs.map +1 -1
- package/dist/components/organisms/VideoPlayer/hooks/useVideoPlayback.d.ts.map +1 -1
- package/dist/components/organisms/VideoPlayer/hooks/useVideoPlayback.js +9 -18
- package/dist/components/organisms/VideoPlayer/hooks/useVideoPlayback.js.map +1 -1
- package/dist/components/organisms/VideoPlayer/hooks/useVideoVolume.cjs +3 -2
- package/dist/components/organisms/VideoPlayer/hooks/useVideoVolume.cjs.map +1 -1
- package/dist/components/organisms/VideoPlayer/hooks/useVideoVolume.d.ts.map +1 -1
- package/dist/components/organisms/VideoPlayer/hooks/useVideoVolume.js +3 -2
- package/dist/components/organisms/VideoPlayer/hooks/useVideoVolume.js.map +1 -1
- package/dist/components/organisms/VideoPlayer/index.cjs +8 -10
- package/dist/components/organisms/VideoPlayer/index.cjs.map +1 -1
- package/dist/components/organisms/VideoPlayer/index.d.ts.map +1 -1
- package/dist/components/organisms/VideoPlayer/index.js +8 -10
- package/dist/components/organisms/VideoPlayer/index.js.map +1 -1
- package/dist/components/organisms/VideoPlayer/videoPlayer.utils.cjs +92 -0
- package/dist/components/organisms/VideoPlayer/videoPlayer.utils.cjs.map +1 -0
- package/dist/components/organisms/VideoPlayer/videoPlayer.utils.d.ts +84 -0
- package/dist/components/organisms/VideoPlayer/videoPlayer.utils.d.ts.map +1 -0
- package/dist/components/organisms/VideoPlayer/videoPlayer.utils.js +83 -0
- package/dist/components/organisms/VideoPlayer/videoPlayer.utils.js.map +1 -0
- package/package.json +2 -2
- package/dist/components/molecules/Pagination/components/PaginationPages.cjs +0 -27
- package/dist/components/molecules/Pagination/components/PaginationPages.cjs.map +0 -1
- package/dist/components/molecules/Pagination/components/PaginationPages.d.ts +0 -18
- package/dist/components/molecules/Pagination/components/PaginationPages.d.ts.map +0 -1
- package/dist/components/molecules/Pagination/components/PaginationPages.js +0 -25
- package/dist/components/molecules/Pagination/components/PaginationPages.js.map +0 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/** Speeds the large player's rate button cycles through, in order. */
|
|
2
|
+
const PLAYBACK_SPEEDS = [1, 1.25, 1.5, 1.75, 2];
|
|
3
|
+
/**
|
|
4
|
+
* Formats a playback position as `m:ss`, flooring partial seconds and clamping negatives to zero.
|
|
5
|
+
*
|
|
6
|
+
* @param time Position in seconds. Hours are not split out, so `125` is `2:05`.
|
|
7
|
+
* @returns A clock label such as `0:00` or `1:05`.
|
|
8
|
+
*/
|
|
9
|
+
const formatTime = (time) => {
|
|
10
|
+
const minutes = Math.max(Math.floor(time / 60), 0);
|
|
11
|
+
const seconds = Math.max(Math.floor(time % 60), 0);
|
|
12
|
+
return `${minutes}:${seconds.toString().padStart(2, '0')}`;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Steps to the next playback speed, wrapping from the last speed back to the first.
|
|
16
|
+
*
|
|
17
|
+
* @param current The speed currently shown. A value outside {@link PLAYBACK_SPEEDS} starts the cycle at the first speed.
|
|
18
|
+
* @returns The next speed in the cycle.
|
|
19
|
+
*/
|
|
20
|
+
const nextPlaybackRate = (current) => {
|
|
21
|
+
const currentIndex = PLAYBACK_SPEEDS.indexOf(current);
|
|
22
|
+
const nextIndex = (currentIndex + 1) % PLAYBACK_SPEEDS.length;
|
|
23
|
+
return PLAYBACK_SPEEDS[nextIndex];
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Turns buffered media ranges into bar positions.
|
|
27
|
+
*
|
|
28
|
+
* @param buffered Ranges reported by the video element, or `null` before the first progress event.
|
|
29
|
+
* @param duration Length of the video in seconds. `0` produces non-finite percentages, matching the render-time division.
|
|
30
|
+
* @returns One segment per range, in order. No ranges yields an empty list, which renders nothing.
|
|
31
|
+
*/
|
|
32
|
+
const bufferedSegments = (buffered, duration) => {
|
|
33
|
+
if (!buffered)
|
|
34
|
+
return [];
|
|
35
|
+
const segments = [];
|
|
36
|
+
for (let i = 0; i < buffered.length; i++) {
|
|
37
|
+
const start = (buffered.start(i) / duration) * 100;
|
|
38
|
+
const end = (buffered.end(i) / duration) * 100;
|
|
39
|
+
segments.push({ startPercent: start, widthPercent: end - start });
|
|
40
|
+
}
|
|
41
|
+
return segments;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Maps a pointer's client x to a position on the scrubber.
|
|
45
|
+
*
|
|
46
|
+
* @param clientX The pointer's viewport x, from the mouse event.
|
|
47
|
+
* @param rect The scrubber's box. Only `left` and `width` are read.
|
|
48
|
+
* @param duration Length of the video in seconds. The time is this length times the unclamped ratio.
|
|
49
|
+
* @returns The ratio, the time it selects, and the pixel offset from the bar's left edge.
|
|
50
|
+
*/
|
|
51
|
+
const progressAtPointer = (clientX, rect, duration) => {
|
|
52
|
+
const offset = clientX - rect.left;
|
|
53
|
+
const ratio = offset / rect.width;
|
|
54
|
+
return { ratio, time: ratio * duration, offset };
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Moves backward by `seconds`, never before the start.
|
|
58
|
+
*
|
|
59
|
+
* @param currentTime Position in seconds before the seek.
|
|
60
|
+
* @param seconds How far back to move. Defaults to the keyboard step of 10.
|
|
61
|
+
* @returns The next position, floored at 0.
|
|
62
|
+
*/
|
|
63
|
+
const seekBackward = (currentTime, seconds = 10) => Math.max(currentTime - seconds, 0);
|
|
64
|
+
/**
|
|
65
|
+
* Moves forward by `seconds`, never past `duration`.
|
|
66
|
+
*
|
|
67
|
+
* @param currentTime Position in seconds before the seek.
|
|
68
|
+
* @param duration Length of the video in seconds. A non-finite duration makes the result non-finite, the same as seeking before metadata loads.
|
|
69
|
+
* @param seconds How far forward to move. Defaults to the keyboard step of 10.
|
|
70
|
+
* @returns The next position, capped at `duration`.
|
|
71
|
+
*/
|
|
72
|
+
const seekForward = (currentTime, duration, seconds = 10) => Math.min(currentTime + seconds, duration);
|
|
73
|
+
/**
|
|
74
|
+
* Steps volume by `delta`, staying inside 0–1. A positive delta only clamps the top; a negative delta only clamps the bottom.
|
|
75
|
+
*
|
|
76
|
+
* @param volume Current level from 0 to 1.
|
|
77
|
+
* @param delta Change to apply. Arrow keys use `0.1` and `-0.1`.
|
|
78
|
+
* @returns The next level.
|
|
79
|
+
*/
|
|
80
|
+
const adjustVolume = (volume, delta) => (delta >= 0 ? Math.min(volume + delta, 1) : Math.max(volume + delta, 0));
|
|
81
|
+
|
|
82
|
+
export { PLAYBACK_SPEEDS, adjustVolume, bufferedSegments, formatTime, nextPlaybackRate, progressAtPointer, seekBackward, seekForward };
|
|
83
|
+
//# sourceMappingURL=videoPlayer.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"videoPlayer.utils.js","sources":["../../../../src/components/organisms/VideoPlayer/videoPlayer.utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACO,MAAM,eAAe,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AA2BrD;;;;;AAKG;AACI,MAAM,UAAU,GAAG,CAAC,IAAY,KAAY;AACjD,IAAA,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;AAClD,IAAA,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;AAClD,IAAA,OAAO,CAAA,EAAG,OAAO,CAAA,CAAA,EAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;AAC5D;AAEA;;;;;AAKG;AACI,MAAM,gBAAgB,GAAG,CAAC,OAAe,KAAY;IAC1D,MAAM,YAAY,GAAG,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC;IACrD,MAAM,SAAS,GAAG,CAAC,YAAY,GAAG,CAAC,IAAI,eAAe,CAAC,MAAM;AAC7D,IAAA,OAAO,eAAe,CAAC,SAAS,CAAC;AACnC;AAEA;;;;;;AAMG;MACU,gBAAgB,GAAG,CAAC,QAA8B,EAAE,QAAgB,KA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,GAAG,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC,CAAC;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flipdish/ui-library",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.1",
|
|
4
4
|
"description": "Flipdish Design System — atomic-design component library (Tailwind v4 + UntitledUI + React Aria).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"imports": {
|
|
@@ -230,7 +230,7 @@
|
|
|
230
230
|
"@storybook/addon-a11y": "^10.5.8",
|
|
231
231
|
"@storybook/addon-docs": "^10.5.8",
|
|
232
232
|
"@storybook/addon-mcp": "^0.7.0",
|
|
233
|
-
"@storybook/addon-vitest": "10.6.
|
|
233
|
+
"@storybook/addon-vitest": "10.6.5",
|
|
234
234
|
"@storybook/react-vite": "^10.5.8",
|
|
235
235
|
"@tailwindcss/vite": "^4.3.1",
|
|
236
236
|
"@tanstack/react-query": "^5.104.3",
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
5
|
-
var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
|
|
6
|
-
var PaginationBase = require('./PaginationBase.cjs');
|
|
7
|
-
|
|
8
|
-
const PaginationItem = ({ value, rounded, isCurrent }) => {
|
|
9
|
-
return (jsxRuntime.jsx(PaginationBase.Pagination.Item, { value: value, isCurrent: isCurrent, className: ({ isSelected }) => cx.cx('flex size-9 cursor-pointer items-center justify-center p-3 text-sm font-medium text-quaternary outline-focus-ring transition duration-100 ease-linear hover:bg-primary_hover hover:text-secondary focus-visible:z-10 focus-visible:bg-primary_hover focus-visible:outline-2 focus-visible:outline-offset-2', rounded ? 'rounded-full' : 'rounded-lg', isSelected && 'bg-primary_hover text-secondary'), children: value }));
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Shared `Pagination.Context` body used by the numbered-page pagination variants:
|
|
13
|
-
* the desktop row of page buttons/ellipses, plus the mobile "Page X of Y" line.
|
|
14
|
-
*/
|
|
15
|
-
const PaginationPages = ({ rounded, wideMobileLine, 'data-testid': dataTestId }) => {
|
|
16
|
-
return (jsxRuntime.jsx(PaginationBase.Pagination.Context, { children: ({ pages, currentPage, total, testIdPrefix }) => {
|
|
17
|
-
const prefix = dataTestId ?? testIdPrefix;
|
|
18
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "hidden justify-center gap-0.5 md:flex", "data-testid": prefix ? testIdUtils.joinTestId(prefix, 'pages') : undefined, children: pages.map((page, index) => page.type === 'page' ? (
|
|
19
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: This is a custom component and we need to use the index as the key
|
|
20
|
-
jsxRuntime.jsx(PaginationItem, { rounded: rounded, ...page }, index)) : (
|
|
21
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: This is a custom component and we need to use the index as the key
|
|
22
|
-
jsxRuntime.jsx(PaginationBase.Pagination.Ellipsis, { className: "flex size-9 shrink-0 items-center justify-center text-tertiary", children: "\u2026" }, index))) }), jsxRuntime.jsxs("div", { className: cx.cx('flex', wideMobileLine && 'flex-1', 'justify-center text-sm whitespace-pre text-fg-secondary md:hidden'), "data-testid": prefix ? testIdUtils.joinTestId(prefix, 'mobile-status') : undefined, children: ["Page ", jsxRuntime.jsx("span", { className: "font-medium", children: currentPage }), " of ", jsxRuntime.jsx("span", { className: "font-medium", children: total })] })] }));
|
|
23
|
-
} }));
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
exports.PaginationPages = PaginationPages;
|
|
27
|
-
//# sourceMappingURL=PaginationPages.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationPages.cjs","sources":["../../../../../src/components/molecules/Pagination/components/PaginationPages.tsx"],"sourcesContent":[null],"names":["_jsx","Pagination","cx","_jsxs","_Fragment","joinTestId"],"mappings":";;;;;;;AAMA,MAAM,cAAc,GAAG,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAA4D,KAAI;IACjH,QACEA,eAACC,yBAAU,CAAC,IAAI,EAAA,EACd,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,KACxBC,KAAE,CACA,4SAA4S,EAC5S,OAAO,GAAG,cAAc,GAAG,YAAY,EACvC,UAAU,IAAI,iCAAiC,CAChD,EAAA,QAAA,EAGF,KAAK,EAAA,CACU;AAEtB,CAAC;AAcD;;;AAGG;AACI,MAAM,eAAe,GAAG,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAwB,KAAI;AAC9G,IAAA,QACEF,cAAA,CAACC,yBAAU,CAAC,OAAO,cAChB,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,KAAI;AAC/C,YAAA,MAAM,MAAM,GAAG,UAAU,IAAI,YAAY;AACzC,YAAA,QACEE,eAAA,CAAAC,mBAAA,EAAA,EAAA,QAAA,EAAA,CACEJ,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,uCAAuC,iBAAc,MAAM,GAAGK,sBAAU,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAAA,QAAA,EACjH,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,KACrB,IAAI,CAAC,IAAI,KAAK,MAAM;;AAElB,wBAAAL,cAAA,CAAC,cAAc,EAAA,EAAa,OAAO,EAAE,OAAO,EAAA,GAAM,IAAI,EAAA,EAAjC,KAAK,CAAgC;;AAG1D,wBAAAA,cAAA,CAACC,yBAAU,CAAC,QAAQ,EAAA,EAAa,SAAS,EAAC,gEAAgE,EAAA,QAAA,EAAA,QAAA,EAAA,EAAjF,KAAK,CAET,CACvB,CACF,EAAA,CACG,EAENE,eAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAED,KAAE,CAAC,MAAM,EAAE,cAAc,IAAI,QAAQ,EAAE,mEAAmE,CAAC,EAAA,aAAA,EACzG,MAAM,GAAGG,sBAAU,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,SAAS,EAAA,QAAA,EAAA,CAAA,OAAA,EAEhEL,cAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,aAAa,EAAA,QAAA,EAAE,WAAW,EAAA,CAAQ,EAAA,MAAA,EAAIA,cAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,aAAa,EAAA,QAAA,EAAE,KAAK,EAAA,CAAQ,CAAA,EAAA,CACnG,CAAA,EAAA,CACL;QAEP,CAAC,EAAA,CACkB;AAEzB;;"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
interface PaginationPagesProps {
|
|
2
|
-
/** Whether the pagination buttons are rounded. */
|
|
3
|
-
rounded?: boolean;
|
|
4
|
-
/** Whether the mobile "Page X of Y" line grows to fill the available space (`flex-1`). */
|
|
5
|
-
wideMobileLine?: boolean;
|
|
6
|
-
/**
|
|
7
|
-
* Overrides the derived `data-testid` prefix (defaults to the root's testid).
|
|
8
|
-
* The desktop pages row renders `<prefix>--pages`, the mobile status line `<prefix>--mobile-status`.
|
|
9
|
-
*/
|
|
10
|
-
'data-testid'?: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Shared `Pagination.Context` body used by the numbered-page pagination variants:
|
|
14
|
-
* the desktop row of page buttons/ellipses, plus the mobile "Page X of Y" line.
|
|
15
|
-
*/
|
|
16
|
-
export declare const PaginationPages: ({ rounded, wideMobileLine, "data-testid": dataTestId }: PaginationPagesProps) => import("react").JSX.Element;
|
|
17
|
-
export {};
|
|
18
|
-
//# sourceMappingURL=PaginationPages.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationPages.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Pagination/components/PaginationPages.tsx"],"names":[],"mappings":"AAwBA,UAAU,oBAAoB;IAC5B,kDAAkD;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0FAA0F;IAC1F,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,wDAAwD,oBAAoB,gCAgC3G,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
3
|
-
import { joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
4
|
-
import { Pagination } from './PaginationBase.js';
|
|
5
|
-
|
|
6
|
-
const PaginationItem = ({ value, rounded, isCurrent }) => {
|
|
7
|
-
return (jsx(Pagination.Item, { value: value, isCurrent: isCurrent, className: ({ isSelected }) => cx('flex size-9 cursor-pointer items-center justify-center p-3 text-sm font-medium text-quaternary outline-focus-ring transition duration-100 ease-linear hover:bg-primary_hover hover:text-secondary focus-visible:z-10 focus-visible:bg-primary_hover focus-visible:outline-2 focus-visible:outline-offset-2', rounded ? 'rounded-full' : 'rounded-lg', isSelected && 'bg-primary_hover text-secondary'), children: value }));
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Shared `Pagination.Context` body used by the numbered-page pagination variants:
|
|
11
|
-
* the desktop row of page buttons/ellipses, plus the mobile "Page X of Y" line.
|
|
12
|
-
*/
|
|
13
|
-
const PaginationPages = ({ rounded, wideMobileLine, 'data-testid': dataTestId }) => {
|
|
14
|
-
return (jsx(Pagination.Context, { children: ({ pages, currentPage, total, testIdPrefix }) => {
|
|
15
|
-
const prefix = dataTestId ?? testIdPrefix;
|
|
16
|
-
return (jsxs(Fragment, { children: [jsx("div", { className: "hidden justify-center gap-0.5 md:flex", "data-testid": prefix ? joinTestId(prefix, 'pages') : undefined, children: pages.map((page, index) => page.type === 'page' ? (
|
|
17
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: This is a custom component and we need to use the index as the key
|
|
18
|
-
jsx(PaginationItem, { rounded: rounded, ...page }, index)) : (
|
|
19
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: This is a custom component and we need to use the index as the key
|
|
20
|
-
jsx(Pagination.Ellipsis, { className: "flex size-9 shrink-0 items-center justify-center text-tertiary", children: "\u2026" }, index))) }), jsxs("div", { className: cx('flex', wideMobileLine && 'flex-1', 'justify-center text-sm whitespace-pre text-fg-secondary md:hidden'), "data-testid": prefix ? joinTestId(prefix, 'mobile-status') : undefined, children: ["Page ", jsx("span", { className: "font-medium", children: currentPage }), " of ", jsx("span", { className: "font-medium", children: total })] })] }));
|
|
21
|
-
} }));
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export { PaginationPages };
|
|
25
|
-
//# sourceMappingURL=PaginationPages.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationPages.js","sources":["../../../../../src/components/molecules/Pagination/components/PaginationPages.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;AAMA,MAAM,cAAc,GAAG,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAA4D,KAAI;IACjH,QACEA,IAAC,UAAU,CAAC,IAAI,EAAA,EACd,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,KACxB,EAAE,CACA,4SAA4S,EAC5S,OAAO,GAAG,cAAc,GAAG,YAAY,EACvC,UAAU,IAAI,iCAAiC,CAChD,EAAA,QAAA,EAGF,KAAK,EAAA,CACU;AAEtB,CAAC;AAcD;;;AAGG;AACI,MAAM,eAAe,GAAG,CAAC,EAAE,OAAO,EA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