@zentauri-ui/zentauri-components 1.8.0 → 1.8.2
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/README.md +25 -10
- package/cli/registry.json +12 -0
- package/dist/charts/area.js +9 -10
- package/dist/charts/area.js.map +1 -1
- package/dist/charts/area.mjs +2 -3
- package/dist/charts/area.mjs.map +1 -1
- package/dist/charts/bar.js +10 -95
- package/dist/charts/bar.js.map +1 -1
- package/dist/charts/bar.mjs +2 -95
- package/dist/charts/bar.mjs.map +1 -1
- package/dist/charts/bubble.js +8 -9
- package/dist/charts/bubble.js.map +1 -1
- package/dist/charts/bubble.mjs +2 -3
- package/dist/charts/bubble.mjs.map +1 -1
- package/dist/charts/funnel/Funnel.d.ts +6 -0
- package/dist/charts/funnel/Funnel.d.ts.map +1 -0
- package/dist/charts/funnel/index.d.ts +4 -0
- package/dist/charts/funnel/index.d.ts.map +1 -0
- package/dist/charts/funnel.js +102 -0
- package/dist/charts/funnel.js.map +1 -0
- package/dist/charts/funnel.mjs +89 -0
- package/dist/charts/funnel.mjs.map +1 -0
- package/dist/charts/line.js +8 -9
- package/dist/charts/line.js.map +1 -1
- package/dist/charts/line.mjs +2 -3
- package/dist/charts/line.mjs.map +1 -1
- package/dist/charts/pie/Pie.d.ts +1 -1
- package/dist/charts/pie/Pie.d.ts.map +1 -1
- package/dist/charts/pie.js +19 -6
- package/dist/charts/pie.js.map +1 -1
- package/dist/charts/pie.mjs +17 -4
- package/dist/charts/pie.mjs.map +1 -1
- package/dist/charts/radar/Radar.d.ts +6 -0
- package/dist/charts/radar/Radar.d.ts.map +1 -0
- package/dist/charts/radar/index.d.ts +4 -0
- package/dist/charts/radar/index.d.ts.map +1 -0
- package/dist/charts/radar.js +94 -0
- package/dist/charts/radar.js.map +1 -0
- package/dist/charts/radar.mjs +81 -0
- package/dist/charts/radar.mjs.map +1 -0
- package/dist/charts/scatter/Scatter.d.ts +6 -0
- package/dist/charts/scatter/Scatter.d.ts.map +1 -0
- package/dist/charts/scatter/index.d.ts +4 -0
- package/dist/charts/scatter/index.d.ts.map +1 -0
- package/dist/charts/scatter.js +116 -0
- package/dist/charts/scatter.js.map +1 -0
- package/dist/charts/scatter.mjs +103 -0
- package/dist/charts/scatter.mjs.map +1 -0
- package/dist/charts/shared/chart-frame.d.ts +2 -1
- package/dist/charts/shared/chart-frame.d.ts.map +1 -1
- package/dist/charts/shared/types.d.ts +22 -2
- package/dist/charts/shared/types.d.ts.map +1 -1
- package/dist/charts/stacked-bar/StackedBar.d.ts +6 -0
- package/dist/charts/stacked-bar/StackedBar.d.ts.map +1 -0
- package/dist/charts/stacked-bar/index.d.ts +4 -0
- package/dist/charts/stacked-bar/index.d.ts.map +1 -0
- package/dist/charts/stacked-bar.js +29 -0
- package/dist/charts/stacked-bar.js.map +1 -0
- package/dist/charts/stacked-bar.mjs +15 -0
- package/dist/charts/stacked-bar.mjs.map +1 -0
- package/dist/chunk-7TGUGTTQ.mjs +147 -0
- package/dist/chunk-7TGUGTTQ.mjs.map +1 -0
- package/dist/chunk-CQMV7BB6.js +50 -0
- package/dist/chunk-CQMV7BB6.js.map +1 -0
- package/dist/chunk-DN7TYUJ6.js +119 -0
- package/dist/chunk-DN7TYUJ6.js.map +1 -0
- package/dist/chunk-F3V4POW3.mjs +8 -0
- package/dist/chunk-F3V4POW3.mjs.map +1 -0
- package/dist/{chunk-G2WARVAM.mjs → chunk-HZIRD3SR.mjs} +35 -15
- package/dist/chunk-HZIRD3SR.mjs.map +1 -0
- package/dist/{chunk-G66SXATZ.js → chunk-IL4LH2XX.js} +50 -4
- package/dist/chunk-IL4LH2XX.js.map +1 -0
- package/dist/chunk-LREMK2XR.js +97 -0
- package/dist/chunk-LREMK2XR.js.map +1 -0
- package/dist/chunk-O2KM3ETC.mjs +95 -0
- package/dist/chunk-O2KM3ETC.mjs.map +1 -0
- package/dist/chunk-ODBG4Y6R.mjs +48 -0
- package/dist/chunk-ODBG4Y6R.mjs.map +1 -0
- package/dist/{chunk-ZIFMIS7D.mjs → chunk-OL3BJSRC.mjs} +51 -5
- package/dist/chunk-OL3BJSRC.mjs.map +1 -0
- package/dist/{chunk-QNUDODDX.js → chunk-PWPMKXEG.js} +36 -14
- package/dist/chunk-PWPMKXEG.js.map +1 -0
- package/dist/chunk-RKX5MERK.js +150 -0
- package/dist/chunk-RKX5MERK.js.map +1 -0
- package/dist/chunk-VYI3GS2C.mjs +115 -0
- package/dist/chunk-VYI3GS2C.mjs.map +1 -0
- package/dist/chunk-XRM7GOIE.js +10 -0
- package/dist/chunk-XRM7GOIE.js.map +1 -0
- package/dist/design-system/copy-button.d.ts +43 -0
- package/dist/design-system/copy-button.d.ts.map +1 -0
- package/dist/design-system/index.d.ts +2 -0
- package/dist/design-system/index.d.ts.map +1 -1
- package/dist/design-system/kbd.d.ts +44 -0
- package/dist/design-system/kbd.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useClipboard.js +6 -44
- package/dist/hooks/useClipboard.js.map +1 -1
- package/dist/hooks/useClipboard.mjs +1 -46
- package/dist/hooks/useClipboard.mjs.map +1 -1
- package/dist/hooks/useIsomorphicLayoutEffect.js +6 -4
- package/dist/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/dist/hooks/useIsomorphicLayoutEffect.mjs +1 -6
- package/dist/hooks/useIsomorphicLayoutEffect.mjs.map +1 -1
- package/dist/hooks/useTableFilter/index.d.ts +3 -0
- package/dist/hooks/useTableFilter/index.d.ts.map +1 -0
- package/dist/hooks/useTableFilter/types.d.ts +20 -0
- package/dist/hooks/useTableFilter/types.d.ts.map +1 -0
- package/dist/hooks/useTableFilter/useTableFilter.d.ts +3 -0
- package/dist/hooks/useTableFilter/useTableFilter.d.ts.map +1 -0
- package/dist/hooks/useTableFilter.js +124 -0
- package/dist/hooks/useTableFilter.js.map +1 -0
- package/dist/hooks/useTableFilter.mjs +122 -0
- package/dist/hooks/useTableFilter.mjs.map +1 -0
- package/dist/hooks/useTableSort/index.d.ts +3 -0
- package/dist/hooks/useTableSort/index.d.ts.map +1 -0
- package/dist/hooks/useTableSort/types.d.ts +15 -0
- package/dist/hooks/useTableSort/types.d.ts.map +1 -0
- package/dist/hooks/useTableSort/useTableSort.d.ts +3 -0
- package/dist/hooks/useTableSort/useTableSort.d.ts.map +1 -0
- package/dist/hooks/useTableSort.js +99 -0
- package/dist/hooks/useTableSort.js.map +1 -0
- package/dist/hooks/useTableSort.mjs +97 -0
- package/dist/hooks/useTableSort.mjs.map +1 -0
- package/dist/ui/copy-button/animated/animations.d.ts +3 -0
- package/dist/ui/copy-button/animated/animations.d.ts.map +1 -0
- package/dist/ui/copy-button/animated/copy-button-animated.d.ts +6 -0
- package/dist/ui/copy-button/animated/copy-button-animated.d.ts.map +1 -0
- package/dist/ui/copy-button/animated/index.d.ts +4 -0
- package/dist/ui/copy-button/animated/index.d.ts.map +1 -0
- package/dist/ui/copy-button/animated/types.d.ts +26 -0
- package/dist/ui/copy-button/animated/types.d.ts.map +1 -0
- package/dist/ui/copy-button/animated.js +59 -0
- package/dist/ui/copy-button/animated.js.map +1 -0
- package/dist/ui/copy-button/animated.mjs +56 -0
- package/dist/ui/copy-button/animated.mjs.map +1 -0
- package/dist/ui/copy-button/copy-button-base.d.ts +6 -0
- package/dist/ui/copy-button/copy-button-base.d.ts.map +1 -0
- package/dist/ui/copy-button/copy-button.d.ts +6 -0
- package/dist/ui/copy-button/copy-button.d.ts.map +1 -0
- package/dist/ui/copy-button/index.d.ts +4 -0
- package/dist/ui/copy-button/index.d.ts.map +1 -0
- package/dist/ui/copy-button/types.d.ts +32 -0
- package/dist/ui/copy-button/types.d.ts.map +1 -0
- package/dist/ui/copy-button/variants.d.ts +6 -0
- package/dist/ui/copy-button/variants.d.ts.map +1 -0
- package/dist/ui/copy-button.js +20 -0
- package/dist/ui/copy-button.js.map +1 -0
- package/dist/ui/copy-button.mjs +15 -0
- package/dist/ui/copy-button.mjs.map +1 -0
- package/dist/ui/kbd/animated/animations.d.ts +3 -0
- package/dist/ui/kbd/animated/animations.d.ts.map +1 -0
- package/dist/ui/kbd/animated/index.d.ts +4 -0
- package/dist/ui/kbd/animated/index.d.ts.map +1 -0
- package/dist/ui/kbd/animated/kbd-animated.d.ts +6 -0
- package/dist/ui/kbd/animated/kbd-animated.d.ts.map +1 -0
- package/dist/ui/kbd/animated/types.d.ts +10 -0
- package/dist/ui/kbd/animated/types.d.ts.map +1 -0
- package/dist/ui/kbd/animated.js +42 -0
- package/dist/ui/kbd/animated.js.map +1 -0
- package/dist/ui/kbd/animated.mjs +39 -0
- package/dist/ui/kbd/animated.mjs.map +1 -0
- package/dist/ui/kbd/index.d.ts +4 -0
- package/dist/ui/kbd/index.d.ts.map +1 -0
- package/dist/ui/kbd/kbd-base.d.ts +6 -0
- package/dist/ui/kbd/kbd-base.d.ts.map +1 -0
- package/dist/ui/kbd/kbd.d.ts +6 -0
- package/dist/ui/kbd/kbd.d.ts.map +1 -0
- package/dist/ui/kbd/types.d.ts +17 -0
- package/dist/ui/kbd/types.d.ts.map +1 -0
- package/dist/ui/kbd/variants.d.ts +8 -0
- package/dist/ui/kbd/variants.d.ts.map +1 -0
- package/dist/ui/kbd.js +23 -0
- package/dist/ui/kbd.js.map +1 -0
- package/dist/ui/kbd.mjs +14 -0
- package/dist/ui/kbd.mjs.map +1 -0
- package/dist/ui/marquee/marquee.d.ts.map +1 -1
- package/dist/ui/marquee.js +82 -21
- package/dist/ui/marquee.js.map +1 -1
- package/dist/ui/marquee.mjs +83 -22
- package/dist/ui/marquee.mjs.map +1 -1
- package/dist/ui/table/animated.js +8 -8
- package/dist/ui/table/animated.mjs +2 -2
- package/dist/ui/table/index.d.ts +1 -1
- package/dist/ui/table/index.d.ts.map +1 -1
- package/dist/ui/table/table-base.d.ts +2 -2
- package/dist/ui/table/table-base.d.ts.map +1 -1
- package/dist/ui/table/types.d.ts +9 -1
- package/dist/ui/table/types.d.ts.map +1 -1
- package/dist/ui/table.js +14 -14
- package/dist/ui/table.mjs +1 -1
- package/package.json +1 -1
- package/src/charts/charts.test.tsx +80 -0
- package/src/charts/funnel/Funnel.tsx +105 -0
- package/src/charts/funnel/index.ts +14 -0
- package/src/charts/pie/Pie.tsx +28 -1
- package/src/charts/radar/Radar.tsx +84 -0
- package/src/charts/radar/index.ts +16 -0
- package/src/charts/scatter/Scatter.tsx +104 -0
- package/src/charts/scatter/index.ts +16 -0
- package/src/charts/shared/chart-frame.tsx +4 -2
- package/src/charts/shared/types.ts +42 -2
- package/src/charts/stacked-bar/StackedBar.tsx +12 -0
- package/src/charts/stacked-bar/index.ts +16 -0
- package/src/design-system/copy-button.ts +81 -0
- package/src/design-system/index.ts +2 -0
- package/src/design-system/kbd.ts +83 -0
- package/src/hooks/index.ts +12 -0
- package/src/hooks/useTableFilter/index.ts +7 -0
- package/src/hooks/useTableFilter/types.ts +28 -0
- package/src/hooks/useTableFilter/useTableFilter.test.ts +141 -0
- package/src/hooks/useTableFilter/useTableFilter.ts +153 -0
- package/src/hooks/useTableSort/index.ts +5 -0
- package/src/hooks/useTableSort/types.ts +23 -0
- package/src/hooks/useTableSort/useTableSort.test.ts +150 -0
- package/src/hooks/useTableSort/useTableSort.ts +121 -0
- package/src/ui/copy-button/animated/animations.ts +22 -0
- package/src/ui/copy-button/animated/copy-button-animated.tsx +39 -0
- package/src/ui/copy-button/animated/index.ts +10 -0
- package/src/ui/copy-button/animated/types.ts +21 -0
- package/src/ui/copy-button/copy-button-base.tsx +88 -0
- package/src/ui/copy-button/copy-button.test.tsx +82 -0
- package/src/ui/copy-button/copy-button.tsx +9 -0
- package/src/ui/copy-button/index.ts +10 -0
- package/src/ui/copy-button/types.ts +37 -0
- package/src/ui/copy-button/variants.ts +29 -0
- package/src/ui/divider/divider.test.tsx +55 -0
- package/src/ui/empty-state/empty-state.test.tsx +88 -0
- package/src/ui/kbd/animated/animations.ts +15 -0
- package/src/ui/kbd/animated/index.ts +9 -0
- package/src/ui/kbd/animated/kbd-animated.tsx +26 -0
- package/src/ui/kbd/animated/types.ts +16 -0
- package/src/ui/kbd/index.ts +5 -0
- package/src/ui/kbd/kbd-base.tsx +50 -0
- package/src/ui/kbd/kbd.test.tsx +48 -0
- package/src/ui/kbd/kbd.tsx +9 -0
- package/src/ui/kbd/types.ts +21 -0
- package/src/ui/kbd/variants.ts +31 -0
- package/src/ui/marquee/marquee.test.tsx +45 -4
- package/src/ui/marquee/marquee.tsx +100 -18
- package/src/ui/skeleton/skeleton.test.tsx +85 -0
- package/src/ui/table/index.ts +3 -0
- package/src/ui/table/table-base.tsx +69 -4
- package/src/ui/table/table.test.tsx +207 -0
- package/src/ui/table/types.ts +13 -1
- package/dist/chunk-G2WARVAM.mjs.map +0 -1
- package/dist/chunk-G66SXATZ.js.map +0 -1
- package/dist/chunk-OULU7OC4.mjs +0 -21
- package/dist/chunk-OULU7OC4.mjs.map +0 -1
- package/dist/chunk-QNUDODDX.js.map +0 -1
- package/dist/chunk-Z6S36PDD.js +0 -24
- package/dist/chunk-Z6S36PDD.js.map +0 -1
- package/dist/chunk-ZIFMIS7D.mjs.map +0 -1
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var react = require('react');
|
|
5
|
+
|
|
6
|
+
// src/hooks/useTableSort/useTableSort.ts
|
|
7
|
+
function nextSortDirection(currentDirection) {
|
|
8
|
+
if (currentDirection === "ascending") {
|
|
9
|
+
return "descending";
|
|
10
|
+
}
|
|
11
|
+
if (currentDirection === "descending") {
|
|
12
|
+
return "none";
|
|
13
|
+
}
|
|
14
|
+
return "ascending";
|
|
15
|
+
}
|
|
16
|
+
function normalizeSortState(nextSort) {
|
|
17
|
+
if (!nextSort.sortKey || nextSort.sortDirection === "none") {
|
|
18
|
+
return { sortKey: void 0, sortDirection: "none" };
|
|
19
|
+
}
|
|
20
|
+
return nextSort;
|
|
21
|
+
}
|
|
22
|
+
function useTableSort({
|
|
23
|
+
sortKey,
|
|
24
|
+
defaultSortKey,
|
|
25
|
+
sortDirection,
|
|
26
|
+
defaultSortDirection = "none",
|
|
27
|
+
onSortChange
|
|
28
|
+
} = {}) {
|
|
29
|
+
const [internalSort, setInternalSort] = react.useState(
|
|
30
|
+
() => normalizeSortState({
|
|
31
|
+
sortKey: defaultSortKey,
|
|
32
|
+
sortDirection: defaultSortDirection
|
|
33
|
+
})
|
|
34
|
+
);
|
|
35
|
+
const isSortKeyControlled = sortKey !== void 0;
|
|
36
|
+
const isSortDirectionControlled = sortDirection !== void 0;
|
|
37
|
+
const currentSort = normalizeSortState({
|
|
38
|
+
sortKey: isSortKeyControlled ? sortKey : internalSort.sortKey,
|
|
39
|
+
sortDirection: isSortDirectionControlled ? sortDirection : internalSort.sortDirection
|
|
40
|
+
});
|
|
41
|
+
const setSort = react.useCallback(
|
|
42
|
+
(nextSort) => {
|
|
43
|
+
const normalized = normalizeSortState(nextSort);
|
|
44
|
+
if (!isSortKeyControlled || !isSortDirectionControlled) {
|
|
45
|
+
setInternalSort((previousSort) => ({
|
|
46
|
+
sortKey: isSortKeyControlled ? previousSort.sortKey : normalized.sortKey,
|
|
47
|
+
sortDirection: isSortDirectionControlled ? previousSort.sortDirection : normalized.sortDirection
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
onSortChange?.(normalized);
|
|
51
|
+
},
|
|
52
|
+
[isSortDirectionControlled, isSortKeyControlled, onSortChange]
|
|
53
|
+
);
|
|
54
|
+
const clearSort = react.useCallback(() => {
|
|
55
|
+
setSort({ sortKey: void 0, sortDirection: "none" });
|
|
56
|
+
}, [setSort]);
|
|
57
|
+
const toggleSort = react.useCallback(
|
|
58
|
+
(nextSortKey) => {
|
|
59
|
+
const direction = currentSort.sortKey === nextSortKey ? nextSortDirection(currentSort.sortDirection) : "ascending";
|
|
60
|
+
setSort({
|
|
61
|
+
sortKey: nextSortKey,
|
|
62
|
+
sortDirection: direction
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
[currentSort.sortDirection, currentSort.sortKey, setSort]
|
|
66
|
+
);
|
|
67
|
+
const getSortProps = react.useCallback(
|
|
68
|
+
(nextSortKey) => ({
|
|
69
|
+
sortKey: nextSortKey,
|
|
70
|
+
sortDirection: currentSort.sortKey === nextSortKey ? currentSort.sortDirection : "none",
|
|
71
|
+
onSortChange: (nextSort) => {
|
|
72
|
+
setSort(nextSort);
|
|
73
|
+
}
|
|
74
|
+
}),
|
|
75
|
+
[currentSort.sortDirection, currentSort.sortKey, setSort]
|
|
76
|
+
);
|
|
77
|
+
return react.useMemo(
|
|
78
|
+
() => ({
|
|
79
|
+
sortKey: currentSort.sortKey,
|
|
80
|
+
sortDirection: currentSort.sortDirection,
|
|
81
|
+
setSort,
|
|
82
|
+
clearSort,
|
|
83
|
+
toggleSort,
|
|
84
|
+
getSortProps
|
|
85
|
+
}),
|
|
86
|
+
[
|
|
87
|
+
clearSort,
|
|
88
|
+
currentSort.sortDirection,
|
|
89
|
+
currentSort.sortKey,
|
|
90
|
+
getSortProps,
|
|
91
|
+
setSort,
|
|
92
|
+
toggleSort
|
|
93
|
+
]
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
exports.useTableSort = useTableSort;
|
|
98
|
+
//# sourceMappingURL=useTableSort.js.map
|
|
99
|
+
//# sourceMappingURL=useTableSort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useTableSort/useTableSort.ts"],"names":["useState","useCallback","useMemo"],"mappings":";;;;;AAOA,SAAS,kBACP,gBAAA,EACoB;AACpB,EAAA,IAAI,qBAAqB,WAAA,EAAa;AACpC,IAAA,OAAO,YAAA;AAAA,EACT;AACA,EAAA,IAAI,qBAAqB,YAAA,EAAc;AACrC,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,OAAO,WAAA;AACT;AAEA,SAAS,mBACP,QAAA,EACsB;AACtB,EAAA,IAAI,CAAC,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ACZ,WAAA,CAAY,OAAA;AAAA,MACZ,YAAA;AAAA,MACA,OAAA;AAAA,MACA;AAAA;AACF,GACF;AACF","file":"useTableSort.js","sourcesContent":["\"use client\";\n\nimport { useCallback, useMemo, useState } from \"react\";\n\nimport type { TableSortDirection, TableSortState } from \"../../ui/table/types\";\nimport type { UseTableSortParams, UseTableSortResult } from \"./types\";\n\nfunction nextSortDirection(\n currentDirection: TableSortDirection,\n): TableSortDirection {\n if (currentDirection === \"ascending\") {\n return \"descending\";\n }\n if (currentDirection === \"descending\") {\n return \"none\";\n }\n return \"ascending\";\n}\n\nfunction normalizeSortState<TKey extends string>(\n nextSort: TableSortState<TKey>,\n): TableSortState<TKey> {\n if (!nextSort.sortKey || nextSort.sortDirection === \"none\") {\n return { sortKey: undefined, sortDirection: \"none\" };\n }\n return nextSort;\n}\n\nexport function useTableSort<TKey extends string = string>({\n sortKey,\n defaultSortKey,\n sortDirection,\n defaultSortDirection = \"none\",\n onSortChange,\n}: UseTableSortParams<TKey> = {}): UseTableSortResult<TKey> {\n const [internalSort, setInternalSort] = useState<TableSortState<TKey>>(() =>\n normalizeSortState({\n sortKey: defaultSortKey,\n sortDirection: defaultSortDirection,\n }),\n );\n\n const isSortKeyControlled = sortKey !== undefined;\n const isSortDirectionControlled = sortDirection !== undefined;\n const currentSort = normalizeSortState({\n sortKey: isSortKeyControlled ? sortKey : internalSort.sortKey,\n sortDirection: isSortDirectionControlled\n ? sortDirection\n : internalSort.sortDirection,\n });\n\n const setSort = useCallback(\n (nextSort: TableSortState<TKey>) => {\n const normalized = normalizeSortState(nextSort);\n if (!isSortKeyControlled || !isSortDirectionControlled) {\n setInternalSort((previousSort) => ({\n sortKey: isSortKeyControlled\n ? previousSort.sortKey\n : normalized.sortKey,\n sortDirection: isSortDirectionControlled\n ? previousSort.sortDirection\n : normalized.sortDirection,\n }));\n }\n onSortChange?.(normalized);\n },\n [isSortDirectionControlled, isSortKeyControlled, onSortChange],\n );\n\n const clearSort = useCallback(() => {\n setSort({ sortKey: undefined, sortDirection: \"none\" });\n }, [setSort]);\n\n const toggleSort = useCallback(\n (nextSortKey: TKey) => {\n const direction =\n currentSort.sortKey === nextSortKey\n ? nextSortDirection(currentSort.sortDirection)\n : \"ascending\";\n\n setSort({\n sortKey: nextSortKey,\n sortDirection: direction,\n });\n },\n [currentSort.sortDirection, currentSort.sortKey, setSort],\n );\n\n const getSortProps = useCallback(\n (nextSortKey: TKey) => ({\n sortKey: nextSortKey,\n sortDirection:\n currentSort.sortKey === nextSortKey\n ? currentSort.sortDirection\n : \"none\",\n onSortChange: (nextSort: TableSortState) => {\n setSort(nextSort as TableSortState<TKey>);\n },\n }),\n [currentSort.sortDirection, currentSort.sortKey, setSort],\n );\n\n return useMemo(\n () => ({\n sortKey: currentSort.sortKey,\n sortDirection: currentSort.sortDirection,\n setSort,\n clearSort,\n toggleSort,\n getSortProps,\n }),\n [\n clearSort,\n currentSort.sortDirection,\n currentSort.sortKey,\n getSortProps,\n setSort,\n toggleSort,\n ],\n );\n}\n"]}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState, useCallback, useMemo } from 'react';
|
|
3
|
+
|
|
4
|
+
// src/hooks/useTableSort/useTableSort.ts
|
|
5
|
+
function nextSortDirection(currentDirection) {
|
|
6
|
+
if (currentDirection === "ascending") {
|
|
7
|
+
return "descending";
|
|
8
|
+
}
|
|
9
|
+
if (currentDirection === "descending") {
|
|
10
|
+
return "none";
|
|
11
|
+
}
|
|
12
|
+
return "ascending";
|
|
13
|
+
}
|
|
14
|
+
function normalizeSortState(nextSort) {
|
|
15
|
+
if (!nextSort.sortKey || nextSort.sortDirection === "none") {
|
|
16
|
+
return { sortKey: void 0, sortDirection: "none" };
|
|
17
|
+
}
|
|
18
|
+
return nextSort;
|
|
19
|
+
}
|
|
20
|
+
function useTableSort({
|
|
21
|
+
sortKey,
|
|
22
|
+
defaultSortKey,
|
|
23
|
+
sortDirection,
|
|
24
|
+
defaultSortDirection = "none",
|
|
25
|
+
onSortChange
|
|
26
|
+
} = {}) {
|
|
27
|
+
const [internalSort, setInternalSort] = useState(
|
|
28
|
+
() => normalizeSortState({
|
|
29
|
+
sortKey: defaultSortKey,
|
|
30
|
+
sortDirection: defaultSortDirection
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
const isSortKeyControlled = sortKey !== void 0;
|
|
34
|
+
const isSortDirectionControlled = sortDirection !== void 0;
|
|
35
|
+
const currentSort = normalizeSortState({
|
|
36
|
+
sortKey: isSortKeyControlled ? sortKey : internalSort.sortKey,
|
|
37
|
+
sortDirection: isSortDirectionControlled ? sortDirection : internalSort.sortDirection
|
|
38
|
+
});
|
|
39
|
+
const setSort = useCallback(
|
|
40
|
+
(nextSort) => {
|
|
41
|
+
const normalized = normalizeSortState(nextSort);
|
|
42
|
+
if (!isSortKeyControlled || !isSortDirectionControlled) {
|
|
43
|
+
setInternalSort((previousSort) => ({
|
|
44
|
+
sortKey: isSortKeyControlled ? previousSort.sortKey : normalized.sortKey,
|
|
45
|
+
sortDirection: isSortDirectionControlled ? previousSort.sortDirection : normalized.sortDirection
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
onSortChange?.(normalized);
|
|
49
|
+
},
|
|
50
|
+
[isSortDirectionControlled, isSortKeyControlled, onSortChange]
|
|
51
|
+
);
|
|
52
|
+
const clearSort = useCallback(() => {
|
|
53
|
+
setSort({ sortKey: void 0, sortDirection: "none" });
|
|
54
|
+
}, [setSort]);
|
|
55
|
+
const toggleSort = useCallback(
|
|
56
|
+
(nextSortKey) => {
|
|
57
|
+
const direction = currentSort.sortKey === nextSortKey ? nextSortDirection(currentSort.sortDirection) : "ascending";
|
|
58
|
+
setSort({
|
|
59
|
+
sortKey: nextSortKey,
|
|
60
|
+
sortDirection: direction
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
[currentSort.sortDirection, currentSort.sortKey, setSort]
|
|
64
|
+
);
|
|
65
|
+
const getSortProps = useCallback(
|
|
66
|
+
(nextSortKey) => ({
|
|
67
|
+
sortKey: nextSortKey,
|
|
68
|
+
sortDirection: currentSort.sortKey === nextSortKey ? currentSort.sortDirection : "none",
|
|
69
|
+
onSortChange: (nextSort) => {
|
|
70
|
+
setSort(nextSort);
|
|
71
|
+
}
|
|
72
|
+
}),
|
|
73
|
+
[currentSort.sortDirection, currentSort.sortKey, setSort]
|
|
74
|
+
);
|
|
75
|
+
return useMemo(
|
|
76
|
+
() => ({
|
|
77
|
+
sortKey: currentSort.sortKey,
|
|
78
|
+
sortDirection: currentSort.sortDirection,
|
|
79
|
+
setSort,
|
|
80
|
+
clearSort,
|
|
81
|
+
toggleSort,
|
|
82
|
+
getSortProps
|
|
83
|
+
}),
|
|
84
|
+
[
|
|
85
|
+
clearSort,
|
|
86
|
+
currentSort.sortDirection,
|
|
87
|
+
currentSort.sortKey,
|
|
88
|
+
getSortProps,
|
|
89
|
+
setSort,
|
|
90
|
+
toggleSort
|
|
91
|
+
]
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export { useTableSort };
|
|
96
|
+
//# sourceMappingURL=useTableSort.mjs.map
|
|
97
|
+
//# sourceMappingURL=useTableSort.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useTableSort/useTableSort.ts"],"names":[],"mappings":";;;AAOA,SAAS,kBACP,gBAAA,EACoB;AACpB,EAAA,IAAI,qBAAqB,WAAA,EAAa;AACpC,IAAA,OAAO,YAAA;AAAA,EACT;AACA,EAAA,IAAI,qBAAqB,YAAA,EAAc;AACrC,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,OAAO,WAAA;AACT;AAEA,SAAS,mBACP,QAAA,EACsB;AACtB,EAAA,IAAI,CAAC,QAAA,CAAS,OAAA,IAAW,QAAA,CAAS,kBAAkB,MAAA,EAAQ;AAC1D,IAAA,OAAO,EAAE,OAAA,EAAS,MAAA,EAAW,aAAA,EAAe,MA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back, useMemo, useState } from \"react\";\n\nimport type { TableSortDirection, TableSortState } from \"../../ui/table/types\";\nimport type { UseTableSortParams, UseTableSortResult } from \"./types\";\n\nfunction nextSortDirection(\n currentDirection: TableSortDirection,\n): TableSortDirection {\n if (currentDirection === \"ascending\") {\n return \"descending\";\n }\n if (currentDirection === \"descending\") {\n return \"none\";\n }\n return \"ascending\";\n}\n\nfunction normalizeSortState<TKey extends string>(\n nextSort: TableSortState<TKey>,\n): TableSortState<TKey> {\n if (!nextSort.sortKey || nextSort.sortDirection === \"none\") {\n return { sortKey: undefined, sortDirection: \"none\" };\n }\n return nextSort;\n}\n\nexport function useTableSort<TKey extends string = string>({\n sortKey,\n defaultSortKey,\n sortDirection,\n defaultSortDirection = \"none\",\n onSortChange,\n}: UseTableSortParams<TKey> = {}): UseTableSortResult<TKey> {\n const [internalSort, setInternalSort] = useState<TableSortState<TKey>>(() =>\n normalizeSortState({\n sortKey: defaultSortKey,\n sortDirection: defaultSortDirection,\n }),\n );\n\n const isSortKeyControlled = sortKey !== undefined;\n const isSortDirectionControlled = sortDirection !== undefined;\n const currentSort = normalizeSortState({\n sortKey: isSortKeyControlled ? sortKey : internalSort.sortKey,\n sortDirection: isSortDirectionControlled\n ? sortDirection\n : internalSort.sortDirection,\n });\n\n const setSort = useCallback(\n (nextSort: TableSortState<TKey>) => {\n const normalized = normalizeSortState(nextSort);\n if (!isSortKeyControlled || !isSortDirectionControlled) {\n setInternalSort((previousSort) => ({\n sortKey: isSortKeyControlled\n ? previousSort.sortKey\n : normalized.sortKey,\n sortDirection: isSortDirectionControlled\n ? previousSort.sortDirection\n : normalized.sortDirection,\n }));\n }\n onSortChange?.(normalized);\n },\n [isSortDirectionControlled, isSortKeyControlled, onSortChange],\n );\n\n const clearSort = useCallback(() => {\n setSort({ sortKey: undefined, sortDirection: \"none\" });\n }, [setSort]);\n\n const toggleSort = useCallback(\n (nextSortKey: TKey) => {\n const direction =\n currentSort.sortKey === nextSortKey\n ? nextSortDirection(currentSort.sortDirection)\n : \"ascending\";\n\n setSort({\n sortKey: nextSortKey,\n sortDirection: direction,\n });\n },\n [currentSort.sortDirection, currentSort.sortKey, setSort],\n );\n\n const getSortProps = useCallback(\n (nextSortKey: TKey) => ({\n sortKey: nextSortKey,\n sortDirection:\n currentSort.sortKey === nextSortKey\n ? currentSort.sortDirection\n : \"none\",\n onSortChange: (nextSort: TableSortState) => {\n setSort(nextSort as TableSortState<TKey>);\n },\n }),\n [currentSort.sortDirection, currentSort.sortKey, setSort],\n );\n\n return useMemo(\n () => ({\n sortKey: currentSort.sortKey,\n sortDirection: currentSort.sortDirection,\n setSort,\n clearSort,\n toggleSort,\n getSortProps,\n }),\n [\n clearSort,\n currentSort.sortDirection,\n currentSort.sortKey,\n getSortProps,\n setSort,\n toggleSort,\n ],\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animations.d.ts","sourceRoot":"","sources":["../../../../src/ui/copy-button/animated/animations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAE1D,eAAO,MAAM,0BAA0B,EAAE,0BAmBxC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CopyButtonAnimatedProps } from "./types";
|
|
2
|
+
export declare function CopyButtonAnimated({ animation, ...props }: CopyButtonAnimatedProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare namespace CopyButtonAnimated {
|
|
4
|
+
var displayName: string;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=copy-button-animated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-button-animated.d.ts","sourceRoot":"","sources":["../../../../src/ui/copy-button/animated/copy-button-animated.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvD,wBAAgB,kBAAkB,CAAC,EACjC,SAAkB,EAClB,GAAG,KAAK,EACT,EAAE,uBAAuB,2CAuBzB;yBA1Be,kBAAkB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { CopyButtonAnimated } from "./copy-button-animated";
|
|
2
|
+
export { copyButtonAnimationPresets } from "./animations";
|
|
3
|
+
export type { CopyButtonAnimatedProps, CopyButtonAnimation, CopyButtonAnimationPreset, CopyButtonAnimationPresets, } from "./types";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ui/copy-button/animated/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,YAAY,EACV,uBAAuB,EACvB,mBAAmB,EACnB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Transition } from "framer-motion";
|
|
2
|
+
import type { CopyButtonProps } from "../types";
|
|
3
|
+
export type CopyButtonAnimation = "swap" | "pop" | "fade";
|
|
4
|
+
export type CopyButtonAnimatedProps = CopyButtonProps & {
|
|
5
|
+
animation?: CopyButtonAnimation;
|
|
6
|
+
};
|
|
7
|
+
export type CopyButtonAnimationPreset = {
|
|
8
|
+
initial: {
|
|
9
|
+
opacity: number;
|
|
10
|
+
scale: number;
|
|
11
|
+
rotate: number;
|
|
12
|
+
};
|
|
13
|
+
animate: {
|
|
14
|
+
opacity: number;
|
|
15
|
+
scale: number;
|
|
16
|
+
rotate: number;
|
|
17
|
+
};
|
|
18
|
+
exit: {
|
|
19
|
+
opacity: number;
|
|
20
|
+
scale: number;
|
|
21
|
+
rotate: number;
|
|
22
|
+
};
|
|
23
|
+
transition: Transition;
|
|
24
|
+
};
|
|
25
|
+
export type CopyButtonAnimationPresets = Record<CopyButtonAnimation, CopyButtonAnimationPreset>;
|
|
26
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ui/copy-button/animated/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAE1D,MAAM,MAAM,uBAAuB,GAAG,eAAe,GAAG;IACtD,SAAS,CAAC,EAAE,mBAAmB,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5D,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5D,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACzD,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAC7C,mBAAmB,EACnB,yBAAyB,CAC1B,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var chunkRKX5MERK_js = require('../../chunk-RKX5MERK.js');
|
|
5
|
+
require('../../chunk-CQMV7BB6.js');
|
|
6
|
+
require('../../chunk-ZS5756ZC.js');
|
|
7
|
+
var framerMotion = require('framer-motion');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
|
|
10
|
+
// src/ui/copy-button/animated/animations.ts
|
|
11
|
+
var copyButtonAnimationPresets = {
|
|
12
|
+
swap: {
|
|
13
|
+
initial: { opacity: 0, scale: 0.6, rotate: -45 },
|
|
14
|
+
animate: { opacity: 1, scale: 1, rotate: 0 },
|
|
15
|
+
exit: { opacity: 0, scale: 0.6, rotate: 45 },
|
|
16
|
+
transition: { type: "spring", stiffness: 520, damping: 24 }
|
|
17
|
+
},
|
|
18
|
+
pop: {
|
|
19
|
+
initial: { opacity: 0, scale: 0.4, rotate: 0 },
|
|
20
|
+
animate: { opacity: 1, scale: 1, rotate: 0 },
|
|
21
|
+
exit: { opacity: 0, scale: 0.4, rotate: 0 },
|
|
22
|
+
transition: { type: "spring", stiffness: 600, damping: 20 }
|
|
23
|
+
},
|
|
24
|
+
fade: {
|
|
25
|
+
initial: { opacity: 0, scale: 1, rotate: 0 },
|
|
26
|
+
animate: { opacity: 1, scale: 1, rotate: 0 },
|
|
27
|
+
exit: { opacity: 0, scale: 1, rotate: 0 },
|
|
28
|
+
transition: { duration: 0.16 }
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
function CopyButtonAnimated({
|
|
32
|
+
animation = "swap",
|
|
33
|
+
...props
|
|
34
|
+
}) {
|
|
35
|
+
const preset = copyButtonAnimationPresets[animation];
|
|
36
|
+
const renderIcon = ({
|
|
37
|
+
copied,
|
|
38
|
+
copyIcon,
|
|
39
|
+
copiedIcon
|
|
40
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, mode: "wait", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
41
|
+
framerMotion.motion.span,
|
|
42
|
+
{
|
|
43
|
+
className: "inline-flex items-center justify-center",
|
|
44
|
+
initial: preset.initial,
|
|
45
|
+
animate: preset.animate,
|
|
46
|
+
exit: preset.exit,
|
|
47
|
+
transition: preset.transition,
|
|
48
|
+
children: copied ? copiedIcon : copyIcon
|
|
49
|
+
},
|
|
50
|
+
copied ? "copied" : "idle"
|
|
51
|
+
) });
|
|
52
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkRKX5MERK_js.CopyButtonBase, { ...props, renderIcon });
|
|
53
|
+
}
|
|
54
|
+
CopyButtonAnimated.displayName = "CopyButtonAnimated";
|
|
55
|
+
|
|
56
|
+
exports.CopyButtonAnimated = CopyButtonAnimated;
|
|
57
|
+
exports.copyButtonAnimationPresets = copyButtonAnimationPresets;
|
|
58
|
+
//# sourceMappingURL=animated.js.map
|
|
59
|
+
//# sourceMappingURL=animated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/ui/copy-button/animated/animations.ts","../../../src/ui/copy-button/animated/copy-button-animated.tsx"],"names":["jsx","AnimatePresence","motion","CopyButtonBase"],"mappings":";;;;;;;;;AAEO,IAAM,0BAAA,GAAyD;AAAA,EACpE,IAAA,EAAM;AAAA,IACJ,SAAS,EAAE,OAAA,EAAS,GAAG,KAAA,EAAO,GAAA,EAAK,QAAQ,GAAA,EAAI;AAAA,IAC/C,SAAS,EAAE,OAAA,EAAS,GAAG,KAAA,EAAO,CAAA,EAAG,QAAQ,CAAA,EAAE;AAAA,IAC3C,MAAM,EAAE,OAAA,EAAS,GAAG,KAAA,EAAO,GAAA,EAAK,QAAQ,EAAA,EAAG;AAAA,IAC3C,YAAY,EAAE,IAAA,EAAM,UAAU,SAAA,EAAW,GAAA,EAAK,SAAS,EAAA;AAAG,GAC5D;AAAA,EACA,GAAA,EAAK;AAAA,IACH,SAAS,EAAE,OAAA,EAAS,GAAG,KAAA,EAAO,GAAA,EAAK,QAAQ,CAAA,EAAE;AAAA,IAC7C,SAAS,EAAE,OAAA,EAAS,GAAG,KAAA,EAAO,CAAA,EAAG,QAAQ,CAAA,EAAE;AAAA,IAC3C,MAAM,EAAE,OAAA,EAAS,GAAG,KAAA,EAAO,GAAA,EAAK,QAAQ,CAAA,EAAE;AAAA,IAC1C,YAAY,EAAE,IAAA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from \"./types\";\n\nexport const copyButtonAnimationPresets: CopyButtonAnimationPresets = {\n swap: {\n initial: { opacity: 0, scale: 0.6, rotate: -45 },\n animate: { opacity: 1, scale: 1, rotate: 0 },\n exit: { opacity: 0, scale: 0.6, rotate: 45 },\n transition: { type: \"spring\", stiffness: 520, damping: 24 },\n },\n pop: {\n initial: { opacity: 0, scale: 0.4, rotate: 0 },\n animate: { opacity: 1, scale: 1, rotate: 0 },\n exit: { opacity: 0, scale: 0.4, rotate: 0 },\n transition: { type: \"spring\", stiffness: 600, damping: 20 },\n },\n fade: {\n initial: { opacity: 0, scale: 1, rotate: 0 },\n animate: { opacity: 1, scale: 1, rotate: 0 },\n exit: { opacity: 0, scale: 1, rotate: 0 },\n transition: { duration: 0.16 },\n },\n};\n","\"use client\";\n\nimport { AnimatePresence, motion } from \"framer-motion\";\n\nimport { CopyButtonBase } from \"../copy-button-base\";\nimport type { CopyButtonIconRenderer } from \"../types\";\n\nimport { copyButtonAnimationPresets } from \"./animations\";\nimport type { CopyButtonAnimatedProps } from \"./types\";\n\nexport function CopyButtonAnimated({\n animation = \"swap\",\n ...props\n}: CopyButtonAnimatedProps) {\n const preset = copyButtonAnimationPresets[animation];\n\n const renderIcon: CopyButtonIconRenderer = ({\n copied,\n copyIcon,\n copiedIcon,\n }) => (\n <AnimatePresence initial={false} mode=\"wait\">\n <motion.span\n key={copied ? \"copied\" : \"idle\"}\n className=\"inline-flex items-center justify-center\"\n initial={preset.initial}\n animate={preset.animate}\n exit={preset.exit}\n transition={preset.transition}\n >\n {copied ? copiedIcon : copyIcon}\n </motion.span>\n </AnimatePresence>\n );\n\n return <CopyButtonBase {...props} renderIcon={renderIcon} />;\n}\n\nCopyButtonAnimated.displayName = \"CopyButtonAnimated\";\n"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { CopyButtonBase } from '../../chunk-7TGUGTTQ.mjs';
|
|
3
|
+
import '../../chunk-ODBG4Y6R.mjs';
|
|
4
|
+
import '../../chunk-4D54YOL6.mjs';
|
|
5
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
// src/ui/copy-button/animated/animations.ts
|
|
9
|
+
var copyButtonAnimationPresets = {
|
|
10
|
+
swap: {
|
|
11
|
+
initial: { opacity: 0, scale: 0.6, rotate: -45 },
|
|
12
|
+
animate: { opacity: 1, scale: 1, rotate: 0 },
|
|
13
|
+
exit: { opacity: 0, scale: 0.6, rotate: 45 },
|
|
14
|
+
transition: { type: "spring", stiffness: 520, damping: 24 }
|
|
15
|
+
},
|
|
16
|
+
pop: {
|
|
17
|
+
initial: { opacity: 0, scale: 0.4, rotate: 0 },
|
|
18
|
+
animate: { opacity: 1, scale: 1, rotate: 0 },
|
|
19
|
+
exit: { opacity: 0, scale: 0.4, rotate: 0 },
|
|
20
|
+
transition: { type: "spring", stiffness: 600, damping: 20 }
|
|
21
|
+
},
|
|
22
|
+
fade: {
|
|
23
|
+
initial: { opacity: 0, scale: 1, rotate: 0 },
|
|
24
|
+
animate: { opacity: 1, scale: 1, rotate: 0 },
|
|
25
|
+
exit: { opacity: 0, scale: 1, rotate: 0 },
|
|
26
|
+
transition: { duration: 0.16 }
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
function CopyButtonAnimated({
|
|
30
|
+
animation = "swap",
|
|
31
|
+
...props
|
|
32
|
+
}) {
|
|
33
|
+
const preset = copyButtonAnimationPresets[animation];
|
|
34
|
+
const renderIcon = ({
|
|
35
|
+
copied,
|
|
36
|
+
copyIcon,
|
|
37
|
+
copiedIcon
|
|
38
|
+
}) => /* @__PURE__ */ jsx(AnimatePresence, { initial: false, mode: "wait", children: /* @__PURE__ */ jsx(
|
|
39
|
+
motion.span,
|
|
40
|
+
{
|
|
41
|
+
className: "inline-flex items-center justify-center",
|
|
42
|
+
initial: preset.initial,
|
|
43
|
+
animate: preset.animate,
|
|
44
|
+
exit: preset.exit,
|
|
45
|
+
transition: preset.transition,
|
|
46
|
+
children: copied ? copiedIcon : copyIcon
|
|
47
|
+
},
|
|
48
|
+
copied ? "copied" : "idle"
|
|
49
|
+
) });
|
|
50
|
+
return /* @__PURE__ */ jsx(CopyButtonBase, { ...props, renderIcon });
|
|
51
|
+
}
|
|
52
|
+
CopyButtonAnimated.displayName = "CopyButtonAnimated";
|
|
53
|
+
|
|
54
|
+
export { CopyButtonAnimated, copyButtonAnimationPresets };
|
|
55
|
+
//# sourceMappingURL=animated.mjs.map
|
|
56
|
+
//# sourceMappingURL=animated.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/ui/copy-button/animated/animations.ts","../../../src/ui/copy-button/animated/copy-button-animated.tsx"],"names":[],"mappings":";;;;;;;AAEO,IAAM,0BAAA,GAAyD;AAAA,EACpE,IAAA,EAAM;AAAA,IACJ,SAAS,EAAE,OAAA,EAAS,GAAG,KAAA,EAAO,GAAA,EAAK,QAAQ,GAAA,EAAI;AAAA,IAC/C,SAAS,EAAE,OAAA,EAAS,GAAG,KAAA,EAAO,CAAA,EAAG,QAAQ,CAAA,EAAE;AAAA,IAC3C,MAAM,EAAE,OAAA,EAAS,GAAG,KAAA,EAAO,GAAA,EAAK,QAAQ,EAAA,EAAG;AAAA,IAC3C,YAAY,EAAE,IAAA,EAAM,UAAU,SAAA,EAAW,GAAA,EAAK,SAAS,EAAA;AAAG,GAC5D;AAAA,EACA,GAAA,EAAK;AAAA,IACH,SAAS,EAAE,OAAA,EAAS,GAAG,KAAA,EAAO,GAAA,EAAK,QAAQ,CAAA,EAAE;AAAA,IAC7C,SAAS,EAAE,OAAA,EAAS,GAAG,KAAA,EAAO,CAAA,EAAG,QAAQ,CAAA,EAAE;AAAA,IAC3C,MAAM,EAAE,OAAA,EAAS,GAAG,KAAA,EAAO,GAAA,EAAK,QAAQ,CAAA,EAAE;AAAA,IAC1C,YAAY,EAAE,IAAA,EAAM,UAAU,SAAA,EA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ationPresets: CopyButtonAnimationPresets = {\n swap: {\n initial: { opacity: 0, scale: 0.6, rotate: -45 },\n animate: { opacity: 1, scale: 1, rotate: 0 },\n exit: { opacity: 0, scale: 0.6, rotate: 45 },\n transition: { type: \"spring\", stiffness: 520, damping: 24 },\n },\n pop: {\n initial: { opacity: 0, scale: 0.4, rotate: 0 },\n animate: { opacity: 1, scale: 1, rotate: 0 },\n exit: { opacity: 0, scale: 0.4, rotate: 0 },\n transition: { type: \"spring\", stiffness: 600, damping: 20 },\n },\n fade: {\n initial: { opacity: 0, scale: 1, rotate: 0 },\n animate: { opacity: 1, scale: 1, rotate: 0 },\n exit: { opacity: 0, scale: 1, rotate: 0 },\n transition: { duration: 0.16 },\n },\n};\n","\"use client\";\n\nimport { AnimatePresence, motion } from \"framer-motion\";\n\nimport { CopyButtonBase } from \"../copy-button-base\";\nimport type { CopyButtonIconRenderer } from \"../types\";\n\nimport { copyButtonAnimationPresets } from \"./animations\";\nimport type { CopyButtonAnimatedProps } from \"./types\";\n\nexport function CopyButtonAnimated({\n animation = \"swap\",\n ...props\n}: CopyButtonAnimatedProps) {\n const preset = copyButtonAnimationPresets[animation];\n\n const renderIcon: CopyButtonIconRenderer = ({\n copied,\n copyIcon,\n copiedIcon,\n }) => (\n <AnimatePresence initial={false} mode=\"wait\">\n <motion.span\n key={copied ? \"copied\" : \"idle\"}\n className=\"inline-flex items-center justify-center\"\n initial={preset.initial}\n animate={preset.animate}\n exit={preset.exit}\n transition={preset.transition}\n >\n {copied ? copiedIcon : copyIcon}\n </motion.span>\n </AnimatePresence>\n );\n\n return <CopyButtonBase {...props} renderIcon={renderIcon} />;\n}\n\nCopyButtonAnimated.displayName = \"CopyButtonAnimated\";\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CopyButtonBaseProps } from "./types";
|
|
2
|
+
export declare function CopyButtonBase({ value, timeout, appearance, size, iconOnly, label, copiedLabel, copyIcon, copiedIcon, onCopy, renderIcon, className, type, disabled, onClick, "aria-label": ariaLabel, ref, ...rest }: CopyButtonBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare namespace CopyButtonBase {
|
|
4
|
+
var displayName: string;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=copy-button-base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-button-base.d.ts","sourceRoot":"","sources":["../../../src/ui/copy-button/copy-button-base.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAA0B,MAAM,SAAS,CAAC;AAS3E,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,OAAc,EACd,UAAU,EACV,IAAI,EACJ,QAAe,EACf,KAAc,EACd,WAAsB,EACtB,QAAiC,EACjC,UAAoC,EACpC,MAAM,EACN,UAA8B,EAC9B,SAAS,EACT,IAAe,EACf,QAAQ,EACR,OAAO,EACP,YAAY,EAAE,SAAS,EACvB,GAAG,EACH,GAAG,IAAI,EACR,EAAE,mBAAmB,2CAkDrB;yBArEe,cAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-button.d.ts","sourceRoot":"","sources":["../../../src/ui/copy-button/copy-button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CAEhD;yBAFe,UAAU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/copy-button/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,sBAAsB,GACvB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { VariantProps } from "class-variance-authority";
|
|
2
|
+
import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
3
|
+
import type { copyButtonVariants } from "./variants";
|
|
4
|
+
export type CopyButtonVariantProps = VariantProps<typeof copyButtonVariants>;
|
|
5
|
+
/** Renders the icon region for a given copied state. Lets the animated entry swap the static icons for motion ones. */
|
|
6
|
+
export type CopyButtonIconRenderer = (state: {
|
|
7
|
+
copied: boolean;
|
|
8
|
+
copyIcon: ReactNode;
|
|
9
|
+
copiedIcon: ReactNode;
|
|
10
|
+
}) => ReactNode;
|
|
11
|
+
export interface CopyButtonBaseProps extends Omit<ComponentPropsWithRef<"button">, "value" | "onCopy"> {
|
|
12
|
+
/** Text written to the clipboard when the button is pressed. */
|
|
13
|
+
value: string;
|
|
14
|
+
/** Milliseconds the copied state stays active before resetting. `0` keeps it until re-copied. */
|
|
15
|
+
timeout?: number;
|
|
16
|
+
appearance?: CopyButtonVariantProps["appearance"];
|
|
17
|
+
size?: CopyButtonVariantProps["size"];
|
|
18
|
+
/** Render only the icon (default). Pass `false` to show the label text alongside the icon. */
|
|
19
|
+
iconOnly?: boolean;
|
|
20
|
+
/** Label shown (and used for `aria-label`) in the idle state. */
|
|
21
|
+
label?: string;
|
|
22
|
+
/** Label shown (and used for `aria-label`) after a successful copy. */
|
|
23
|
+
copiedLabel?: string;
|
|
24
|
+
copyIcon?: ReactNode;
|
|
25
|
+
copiedIcon?: ReactNode;
|
|
26
|
+
/** Called with `value` after the clipboard write succeeds. */
|
|
27
|
+
onCopy?: (value: string) => void;
|
|
28
|
+
/** Overrides how the icon region renders; the animated entry uses this for motion. */
|
|
29
|
+
renderIcon?: CopyButtonIconRenderer;
|
|
30
|
+
}
|
|
31
|
+
export type CopyButtonProps = Omit<CopyButtonBaseProps, "renderIcon">;
|
|
32
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/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,0 +1,6 @@
|
|
|
1
|
+
export declare const copyButtonVariants: (props?: ({
|
|
2
|
+
appearance?: "default" | "outline" | "glass" | "sky" | "emerald" | "violet" | "amber" | "rose" | "gray" | "indigo" | "orange" | "pink" | "purple" | "teal" | "yellow" | "gradient-blue" | "gradient-green" | "gradient-red" | "gradient-yellow" | "gradient-purple" | "gradient-teal" | "gradient-indigo" | "gradient-pink" | "gradient-orange" | "secondary" | "destructive" | "ghost" | null | undefined;
|
|
3
|
+
size?: "md" | "sm" | "lg" | null | undefined;
|
|
4
|
+
iconOnly?: boolean | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
//# sourceMappingURL=variants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../../src/ui/copy-button/variants.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,kBAAkB;;;;8EAmB7B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var chunkRKX5MERK_js = require('../chunk-RKX5MERK.js');
|
|
5
|
+
require('../chunk-CQMV7BB6.js');
|
|
6
|
+
require('../chunk-ZS5756ZC.js');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
|
|
9
|
+
function CopyButton(props) {
|
|
10
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkRKX5MERK_js.CopyButtonBase, { ...props });
|
|
11
|
+
}
|
|
12
|
+
CopyButton.displayName = "CopyButton";
|
|
13
|
+
|
|
14
|
+
Object.defineProperty(exports, "copyButtonVariants", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return chunkRKX5MERK_js.copyButtonVariants; }
|
|
17
|
+
});
|
|
18
|
+
exports.CopyButton = CopyButton;
|
|
19
|
+
//# sourceMappingURL=copy-button.js.map
|
|
20
|
+
//# sourceMappingURL=copy-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ui/copy-button/copy-button.tsx"],"names":["jsx","CopyButtonBase"],"mappings":";;;;;;;AAIO,SAAS,WAAW,KAAA,EAAwB;AACjD,EAAA,uBAAOA,cAAA,CAACC,+BAAA,EAAA,EAAgB,GAAG,KAAA,EAAO,CAAA;AACpC;AAEA,UAAA,CAAW,WAAA,GAAc,YAAA","file":"copy-button.js","sourcesContent":["// copy-button.tsx — default static entry (no framer-motion)\nimport { CopyButtonBase } from \"./copy-button-base\";\nimport type { CopyButtonProps } from \"./types\";\n\nexport function CopyButton(props: CopyButtonProps) {\n return <CopyButtonBase {...props} />;\n}\n\nCopyButton.displayName = \"CopyButton\";\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { CopyButtonBase } from '../chunk-7TGUGTTQ.mjs';
|
|
3
|
+
export { copyButtonVariants } from '../chunk-7TGUGTTQ.mjs';
|
|
4
|
+
import '../chunk-ODBG4Y6R.mjs';
|
|
5
|
+
import '../chunk-4D54YOL6.mjs';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
function CopyButton(props) {
|
|
9
|
+
return /* @__PURE__ */ jsx(CopyButtonBase, { ...props });
|
|
10
|
+
}
|
|
11
|
+
CopyButton.displayName = "CopyButton";
|
|
12
|
+
|
|
13
|
+
export { CopyButton };
|
|
14
|
+
//# sourceMappingURL=copy-button.mjs.map
|
|
15
|
+
//# sourceMappingURL=copy-button.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ui/copy-button/copy-button.tsx"],"names":[],"mappings":";;;;;;AAIO,SAAS,WAAW,KAAA,EAAwB;AACjD,EAAA,uBAAO,GAAA,CAAC,cAAA,EAAA,EAAgB,GAAG,KAAA,EAAO,CAAA;AACpC;AAEA,UAAA,CAAW,WAAA,GAAc,YAAA","file":"copy-button.mjs","sourcesContent":["// copy-button.tsx — default static entry (no framer-motion)\nimport { CopyButtonBase } from \"./copy-button-base\";\nimport type { CopyButtonProps } from \"./types\";\n\nexport function CopyButton(props: CopyButtonProps) {\n return <CopyButtonBase {...props} />;\n}\n\nCopyButton.displayName = \"CopyButton\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animations.d.ts","sourceRoot":"","sources":["../../../../src/ui/kbd/animated/animations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,eAAO,MAAM,mBAAmB,EAAE,mBAYjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ui/kbd/animated/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,GACpB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { KbdAnimatedProps } from "./types";
|
|
2
|
+
export declare function KbdAnimated({ animation, ...props }: KbdAnimatedProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare namespace KbdAnimated {
|
|
4
|
+
var displayName: string;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=kbd-animated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kbd-animated.d.ts","sourceRoot":"","sources":["../../../../src/ui/kbd/animated/kbd-animated.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,wBAAgB,WAAW,CAAC,EAAE,SAAkB,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAa7E;yBAbe,WAAW"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HTMLMotionProps } from "framer-motion";
|
|
2
|
+
import type { KbdBaseProps } from "../types";
|
|
3
|
+
export type KbdAnimation = "none" | "press" | "pop";
|
|
4
|
+
export type KbdAnimatedProps = Omit<KbdBaseProps, "as"> & {
|
|
5
|
+
animation?: KbdAnimation;
|
|
6
|
+
};
|
|
7
|
+
type KbdPresetMotionProps = Pick<HTMLMotionProps<"span">, "transition" | "whileHover" | "whileTap" | "animate" | "initial">;
|
|
8
|
+
export type KbdAnimationPresets = Record<KbdAnimation, KbdPresetMotionProps>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ui/kbd/animated/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAEpD,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,GAAG;IACxD,SAAS,CAAC,EAAE,YAAY,CAAC;CAC1B,CAAC;AAEF,KAAK,oBAAoB,GAAG,IAAI,CAC9B,eAAe,CAAC,MAAM,CAAC,EACvB,YAAY,GAAG,YAAY,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CACjE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC"}
|