@keepkit/ui 0.26.4 → 0.27.0
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 +4 -4
- package/dist/index.d.ts +36 -6
- package/dist/index.js +681 -357
- package/dist/index.js.map +1 -1
- package/dist/styles/base.css +35 -0
- package/dist/styles/collection.css +19 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -200,7 +200,10 @@ var DE_LABELS = {
|
|
|
200
200
|
toolbarStart: "Sammlungsaktionen",
|
|
201
201
|
toolbarQuery: "Suchen und sortieren",
|
|
202
202
|
toolbarFilters: "Filter",
|
|
203
|
-
toolbarEnd: "Zus\xE4tzliche Aktionen"
|
|
203
|
+
toolbarEnd: "Zus\xE4tzliche Aktionen",
|
|
204
|
+
createCollection: "Create collection",
|
|
205
|
+
createCollectionSubmit: "Create",
|
|
206
|
+
collectionName: "Collection name"
|
|
204
207
|
};
|
|
205
208
|
|
|
206
209
|
// src/locales/en.ts
|
|
@@ -308,7 +311,10 @@ var EN_LABELS = {
|
|
|
308
311
|
toolbarStart: "Collection actions",
|
|
309
312
|
toolbarQuery: "Search and sort",
|
|
310
313
|
toolbarFilters: "Filters",
|
|
311
|
-
toolbarEnd: "Additional actions"
|
|
314
|
+
toolbarEnd: "Additional actions",
|
|
315
|
+
createCollection: "Create collection",
|
|
316
|
+
createCollectionSubmit: "Create",
|
|
317
|
+
collectionName: "Collection name"
|
|
312
318
|
};
|
|
313
319
|
|
|
314
320
|
// src/locales/es.ts
|
|
@@ -416,7 +422,10 @@ var ES_LABELS = {
|
|
|
416
422
|
toolbarStart: "Acciones de la colecci\xF3n",
|
|
417
423
|
toolbarQuery: "Buscar y ordenar",
|
|
418
424
|
toolbarFilters: "Filtros",
|
|
419
|
-
toolbarEnd: "Acciones adicionales"
|
|
425
|
+
toolbarEnd: "Acciones adicionales",
|
|
426
|
+
createCollection: "Create collection",
|
|
427
|
+
createCollectionSubmit: "Create",
|
|
428
|
+
collectionName: "Collection name"
|
|
420
429
|
};
|
|
421
430
|
|
|
422
431
|
// src/locales/fil.ts
|
|
@@ -524,7 +533,10 @@ var FIL_LABELS = {
|
|
|
524
533
|
toolbarStart: "Mga aksyon ng koleksyon",
|
|
525
534
|
toolbarQuery: "Maghanap at mag-ayos",
|
|
526
535
|
toolbarFilters: "Mga filter",
|
|
527
|
-
toolbarEnd: "Mga karagdagang aksyon"
|
|
536
|
+
toolbarEnd: "Mga karagdagang aksyon",
|
|
537
|
+
createCollection: "Create collection",
|
|
538
|
+
createCollectionSubmit: "Create",
|
|
539
|
+
collectionName: "Collection name"
|
|
528
540
|
};
|
|
529
541
|
|
|
530
542
|
// src/locales/fr.ts
|
|
@@ -632,7 +644,10 @@ var FR_LABELS = {
|
|
|
632
644
|
toolbarStart: "Actions de la collection",
|
|
633
645
|
toolbarQuery: "Recherche et tri",
|
|
634
646
|
toolbarFilters: "Filtres",
|
|
635
|
-
toolbarEnd: "Actions suppl\xE9mentaires"
|
|
647
|
+
toolbarEnd: "Actions suppl\xE9mentaires",
|
|
648
|
+
createCollection: "Create collection",
|
|
649
|
+
createCollectionSubmit: "Create",
|
|
650
|
+
collectionName: "Collection name"
|
|
636
651
|
};
|
|
637
652
|
|
|
638
653
|
// src/locales/id.ts
|
|
@@ -740,7 +755,10 @@ var ID_LABELS = {
|
|
|
740
755
|
toolbarStart: "Tindakan koleksi",
|
|
741
756
|
toolbarQuery: "Cari dan urutkan",
|
|
742
757
|
toolbarFilters: "Filter",
|
|
743
|
-
toolbarEnd: "Tindakan tambahan"
|
|
758
|
+
toolbarEnd: "Tindakan tambahan",
|
|
759
|
+
createCollection: "Create collection",
|
|
760
|
+
createCollectionSubmit: "Create",
|
|
761
|
+
collectionName: "Collection name"
|
|
744
762
|
};
|
|
745
763
|
|
|
746
764
|
// src/locales/it.ts
|
|
@@ -848,7 +866,10 @@ var IT_LABELS = {
|
|
|
848
866
|
toolbarStart: "Azioni della raccolta",
|
|
849
867
|
toolbarQuery: "Cerca e ordina",
|
|
850
868
|
toolbarFilters: "Filtri",
|
|
851
|
-
toolbarEnd: "Azioni aggiuntive"
|
|
869
|
+
toolbarEnd: "Azioni aggiuntive",
|
|
870
|
+
createCollection: "Create collection",
|
|
871
|
+
createCollectionSubmit: "Create",
|
|
872
|
+
collectionName: "Collection name"
|
|
852
873
|
};
|
|
853
874
|
|
|
854
875
|
// src/locales/ja.ts
|
|
@@ -956,7 +977,10 @@ var JA_LABELS = {
|
|
|
956
977
|
toolbarStart: "\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u306E\u64CD\u4F5C",
|
|
957
978
|
toolbarQuery: "\u691C\u7D22\u3068\u4E26\u3073\u66FF\u3048",
|
|
958
979
|
toolbarFilters: "\u7D5E\u308A\u8FBC\u307F",
|
|
959
|
-
toolbarEnd: "\u8FFD\u52A0\u306E\u64CD\u4F5C"
|
|
980
|
+
toolbarEnd: "\u8FFD\u52A0\u306E\u64CD\u4F5C",
|
|
981
|
+
createCollection: "\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u4F5C\u6210",
|
|
982
|
+
createCollectionSubmit: "\u4F5C\u6210",
|
|
983
|
+
collectionName: "\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D"
|
|
960
984
|
};
|
|
961
985
|
|
|
962
986
|
// src/locales/ko.ts
|
|
@@ -1064,7 +1088,10 @@ var KO_LABELS = {
|
|
|
1064
1088
|
toolbarStart: "\uCEEC\uB809\uC158 \uC791\uC5C5",
|
|
1065
1089
|
toolbarQuery: "\uAC80\uC0C9 \uBC0F \uC815\uB82C",
|
|
1066
1090
|
toolbarFilters: "\uD544\uD130",
|
|
1067
|
-
toolbarEnd: "\uCD94\uAC00 \uC791\uC5C5"
|
|
1091
|
+
toolbarEnd: "\uCD94\uAC00 \uC791\uC5C5",
|
|
1092
|
+
createCollection: "Create collection",
|
|
1093
|
+
createCollectionSubmit: "Create",
|
|
1094
|
+
collectionName: "Collection name"
|
|
1068
1095
|
};
|
|
1069
1096
|
|
|
1070
1097
|
// src/locales/ms.ts
|
|
@@ -1172,7 +1199,10 @@ var MS_LABELS = {
|
|
|
1172
1199
|
toolbarStart: "Tindakan koleksi",
|
|
1173
1200
|
toolbarQuery: "Cari dan susun",
|
|
1174
1201
|
toolbarFilters: "Penapis",
|
|
1175
|
-
toolbarEnd: "Tindakan tambahan"
|
|
1202
|
+
toolbarEnd: "Tindakan tambahan",
|
|
1203
|
+
createCollection: "Create collection",
|
|
1204
|
+
createCollectionSubmit: "Create",
|
|
1205
|
+
collectionName: "Collection name"
|
|
1176
1206
|
};
|
|
1177
1207
|
|
|
1178
1208
|
// src/locales/pt-BR.ts
|
|
@@ -1280,7 +1310,10 @@ var PT_BR_LABELS = {
|
|
|
1280
1310
|
toolbarStart: "A\xE7\xF5es da cole\xE7\xE3o",
|
|
1281
1311
|
toolbarQuery: "Pesquisar e ordenar",
|
|
1282
1312
|
toolbarFilters: "Filtros",
|
|
1283
|
-
toolbarEnd: "A\xE7\xF5es adicionais"
|
|
1313
|
+
toolbarEnd: "A\xE7\xF5es adicionais",
|
|
1314
|
+
createCollection: "Create collection",
|
|
1315
|
+
createCollectionSubmit: "Create",
|
|
1316
|
+
collectionName: "Collection name"
|
|
1284
1317
|
};
|
|
1285
1318
|
|
|
1286
1319
|
// src/locales/ru.ts
|
|
@@ -1388,7 +1421,10 @@ var RU_LABELS = {
|
|
|
1388
1421
|
toolbarStart: "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044F \u043A\u043E\u043B\u043B\u0435\u043A\u0446\u0438\u0438",
|
|
1389
1422
|
toolbarQuery: "\u041F\u043E\u0438\u0441\u043A \u0438 \u0441\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0430",
|
|
1390
1423
|
toolbarFilters: "\u0424\u0438\u043B\u044C\u0442\u0440\u044B",
|
|
1391
|
-
toolbarEnd: "\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F"
|
|
1424
|
+
toolbarEnd: "\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F",
|
|
1425
|
+
createCollection: "Create collection",
|
|
1426
|
+
createCollectionSubmit: "Create",
|
|
1427
|
+
collectionName: "Collection name"
|
|
1392
1428
|
};
|
|
1393
1429
|
|
|
1394
1430
|
// src/locales/th.ts
|
|
@@ -1496,7 +1532,10 @@ var TH_LABELS = {
|
|
|
1496
1532
|
toolbarStart: "\u0E01\u0E32\u0E23\u0E14\u0E33\u0E40\u0E19\u0E34\u0E19\u0E01\u0E32\u0E23\u0E02\u0E2D\u0E07\u0E04\u0E2D\u0E25\u0E40\u0E25\u0E01\u0E0A\u0E31\u0E19",
|
|
1497
1533
|
toolbarQuery: "\u0E04\u0E49\u0E19\u0E2B\u0E32\u0E41\u0E25\u0E30\u0E08\u0E31\u0E14\u0E40\u0E23\u0E35\u0E22\u0E07",
|
|
1498
1534
|
toolbarFilters: "\u0E15\u0E31\u0E27\u0E01\u0E23\u0E2D\u0E07",
|
|
1499
|
-
toolbarEnd: "\u0E01\u0E32\u0E23\u0E14\u0E33\u0E40\u0E19\u0E34\u0E19\u0E01\u0E32\u0E23\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E40\u0E15\u0E34\u0E21"
|
|
1535
|
+
toolbarEnd: "\u0E01\u0E32\u0E23\u0E14\u0E33\u0E40\u0E19\u0E34\u0E19\u0E01\u0E32\u0E23\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E40\u0E15\u0E34\u0E21",
|
|
1536
|
+
createCollection: "Create collection",
|
|
1537
|
+
createCollectionSubmit: "Create",
|
|
1538
|
+
collectionName: "Collection name"
|
|
1500
1539
|
};
|
|
1501
1540
|
|
|
1502
1541
|
// src/locales/vi.ts
|
|
@@ -1604,7 +1643,10 @@ var VI_LABELS = {
|
|
|
1604
1643
|
toolbarStart: "Thao t\xE1c b\u1ED9 s\u01B0u t\u1EADp",
|
|
1605
1644
|
toolbarQuery: "T\xECm ki\u1EBFm v\xE0 s\u1EAFp x\u1EBFp",
|
|
1606
1645
|
toolbarFilters: "B\u1ED9 l\u1ECDc",
|
|
1607
|
-
toolbarEnd: "Thao t\xE1c b\u1ED5 sung"
|
|
1646
|
+
toolbarEnd: "Thao t\xE1c b\u1ED5 sung",
|
|
1647
|
+
createCollection: "Create collection",
|
|
1648
|
+
createCollectionSubmit: "Create",
|
|
1649
|
+
collectionName: "Collection name"
|
|
1608
1650
|
};
|
|
1609
1651
|
|
|
1610
1652
|
// src/locales/zh-Hans.ts
|
|
@@ -1712,7 +1754,10 @@ var ZH_HANS_LABELS = {
|
|
|
1712
1754
|
toolbarStart: "\u96C6\u5408\u64CD\u4F5C",
|
|
1713
1755
|
toolbarQuery: "\u641C\u7D22\u548C\u6392\u5E8F",
|
|
1714
1756
|
toolbarFilters: "\u7B5B\u9009",
|
|
1715
|
-
toolbarEnd: "\u5176\u4ED6\u64CD\u4F5C"
|
|
1757
|
+
toolbarEnd: "\u5176\u4ED6\u64CD\u4F5C",
|
|
1758
|
+
createCollection: "Create collection",
|
|
1759
|
+
createCollectionSubmit: "Create",
|
|
1760
|
+
collectionName: "Collection name"
|
|
1716
1761
|
};
|
|
1717
1762
|
|
|
1718
1763
|
// src/locales/zh-Hant.ts
|
|
@@ -1820,7 +1865,10 @@ var ZH_HANT_LABELS = {
|
|
|
1820
1865
|
toolbarStart: "\u96C6\u5408\u64CD\u4F5C",
|
|
1821
1866
|
toolbarQuery: "\u641C\u5C0B\u8207\u6392\u5E8F",
|
|
1822
1867
|
toolbarFilters: "\u7BE9\u9078",
|
|
1823
|
-
toolbarEnd: "\u5176\u4ED6\u64CD\u4F5C"
|
|
1868
|
+
toolbarEnd: "\u5176\u4ED6\u64CD\u4F5C",
|
|
1869
|
+
createCollection: "Create collection",
|
|
1870
|
+
createCollectionSubmit: "Create",
|
|
1871
|
+
collectionName: "Collection name"
|
|
1824
1872
|
};
|
|
1825
1873
|
|
|
1826
1874
|
// src/locales/index.ts
|
|
@@ -1887,10 +1935,12 @@ import { jsx } from "react/jsx-runtime";
|
|
|
1887
1935
|
var DEFAULT_LABELS = KEEP_LOCALE_LABELS.en;
|
|
1888
1936
|
var KeepUiLabelsContext = createContext({
|
|
1889
1937
|
labels: DEFAULT_LABELS,
|
|
1938
|
+
labelVisibility: {},
|
|
1890
1939
|
emitFeedback: () => void 0
|
|
1891
1940
|
});
|
|
1892
1941
|
function KeepUiProvider({
|
|
1893
1942
|
labels,
|
|
1943
|
+
labelOptions,
|
|
1894
1944
|
locale,
|
|
1895
1945
|
labelResolver,
|
|
1896
1946
|
onFeedback,
|
|
@@ -1905,9 +1955,24 @@ function KeepUiProvider({
|
|
|
1905
1955
|
const value = useMemo(() => {
|
|
1906
1956
|
const resolvedLocale = normalizeKeepLocale(locale);
|
|
1907
1957
|
const dictionary = getKeepLocaleLabels(resolvedLocale);
|
|
1908
|
-
const resolved = { ...DEFAULT_LABELS, ...dictionary
|
|
1909
|
-
|
|
1910
|
-
|
|
1958
|
+
const resolved = { ...DEFAULT_LABELS, ...dictionary };
|
|
1959
|
+
const labelVisibility = {};
|
|
1960
|
+
for (const key of Object.keys(resolved)) {
|
|
1961
|
+
const customLabel = labels?.[key];
|
|
1962
|
+
const text = labelOptions?.[key]?.text ?? customLabel;
|
|
1963
|
+
if (text !== void 0) resolved[key] = text;
|
|
1964
|
+
labelVisibility[key] = labelOptions?.[key]?.visible !== false;
|
|
1965
|
+
}
|
|
1966
|
+
return {
|
|
1967
|
+
locale: locale ?? resolvedLocale,
|
|
1968
|
+
labels: resolved,
|
|
1969
|
+
labelVisibility,
|
|
1970
|
+
customLabels: labels,
|
|
1971
|
+
labelOptions,
|
|
1972
|
+
labelResolver,
|
|
1973
|
+
emitFeedback
|
|
1974
|
+
};
|
|
1975
|
+
}, [emitFeedback, labelOptions, labelResolver, labels, locale]);
|
|
1911
1976
|
return /* @__PURE__ */ jsx(KeepUiLabelsContext.Provider, { value, children });
|
|
1912
1977
|
}
|
|
1913
1978
|
function useKeepUiLabels() {
|
|
@@ -1915,7 +1980,10 @@ function useKeepUiLabels() {
|
|
|
1915
1980
|
}
|
|
1916
1981
|
function useUiLabel(key, override) {
|
|
1917
1982
|
const context = useKeepUiLabels();
|
|
1918
|
-
return override ?? context.customLabels?.[key] ?? context.labelResolver?.(key, { locale: context.locale }) ?? context.labels[key];
|
|
1983
|
+
return override ?? context.labelOptions?.[key]?.text ?? context.customLabels?.[key] ?? context.labelResolver?.(key, { locale: context.locale }) ?? context.labels[key];
|
|
1984
|
+
}
|
|
1985
|
+
function useUiLabelVisibility(key) {
|
|
1986
|
+
return useKeepUiLabels().labelVisibility?.[key] ?? true;
|
|
1919
1987
|
}
|
|
1920
1988
|
function useKeepUiFeedback() {
|
|
1921
1989
|
const { emitFeedback } = useKeepUiLabels();
|
|
@@ -1937,6 +2005,9 @@ function KeepArchiveButton({
|
|
|
1937
2005
|
const archive = useUiLabel("archive");
|
|
1938
2006
|
const unarchive = useUiLabel("unarchive");
|
|
1939
2007
|
const archivedLabel = useUiLabel("archived");
|
|
2008
|
+
const showArchiveLabel = useUiLabelVisibility("archive");
|
|
2009
|
+
const showUnarchiveLabel = useUiLabelVisibility("unarchive");
|
|
2010
|
+
const showArchivedLabel = useUiLabelVisibility("archived");
|
|
1940
2011
|
const isArchived = state.item?.archived === true;
|
|
1941
2012
|
const isDisabled = disabled ?? state.isMutating;
|
|
1942
2013
|
return /* @__PURE__ */ jsxs(
|
|
@@ -1948,10 +2019,11 @@ function KeepArchiveButton({
|
|
|
1948
2019
|
"aria-pressed": isArchived,
|
|
1949
2020
|
"data-archived": isArchived ? "true" : "false",
|
|
1950
2021
|
"data-keep-action": "toggle-archive",
|
|
2022
|
+
"aria-label": props["aria-label"] ?? (children === void 0 ? isArchived ? showUnarchiveLabel ? void 0 : unarchive : showArchiveLabel ? void 0 : archive : void 0),
|
|
1951
2023
|
onClick: () => void state.toggleArchive().catch((error) => onToggleError?.(error)),
|
|
1952
2024
|
children: [
|
|
1953
|
-
typeof children === "function" ? children(state) : children ?? (isArchived ? unarchiveLabel ?? unarchive : archiveLabel ?? archive),
|
|
1954
|
-
isArchived && children === void 0 ? /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", children: [
|
|
2025
|
+
typeof children === "function" ? children(state) : children ?? (isArchived ? showUnarchiveLabel ? unarchiveLabel ?? unarchive : null : showArchiveLabel ? archiveLabel ?? archive : null),
|
|
2026
|
+
isArchived && children === void 0 && showArchivedLabel ? /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", children: [
|
|
1955
2027
|
" (",
|
|
1956
2028
|
archivedLabel,
|
|
1957
2029
|
")"
|
|
@@ -1973,6 +2045,9 @@ function KeepPinButton({
|
|
|
1973
2045
|
const pin = useUiLabel("pin");
|
|
1974
2046
|
const unpin = useUiLabel("unpin");
|
|
1975
2047
|
const pinnedLabel = useUiLabel("pinned");
|
|
2048
|
+
const showPinLabel = useUiLabelVisibility("pin");
|
|
2049
|
+
const showUnpinLabel = useUiLabelVisibility("unpin");
|
|
2050
|
+
const showPinnedLabel = useUiLabelVisibility("pinned");
|
|
1976
2051
|
const isPinned = state.item?.pinned === true;
|
|
1977
2052
|
const isDisabled = disabled ?? state.isMutating;
|
|
1978
2053
|
return /* @__PURE__ */ jsxs(
|
|
@@ -1984,10 +2059,11 @@ function KeepPinButton({
|
|
|
1984
2059
|
"aria-pressed": isPinned,
|
|
1985
2060
|
"data-pinned": isPinned ? "true" : "false",
|
|
1986
2061
|
"data-keep-action": "toggle-pin",
|
|
2062
|
+
"aria-label": props["aria-label"] ?? (children === void 0 ? isPinned ? showUnpinLabel ? void 0 : unpin : showPinLabel ? void 0 : pin : void 0),
|
|
1987
2063
|
onClick: () => void state.togglePin().catch((error) => onToggleError?.(error)),
|
|
1988
2064
|
children: [
|
|
1989
|
-
typeof children === "function" ? children(state) : children ?? (isPinned ? unpinLabel ?? unpin : pinLabel ?? pin),
|
|
1990
|
-
isPinned && children === void 0 ? /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", children: [
|
|
2065
|
+
typeof children === "function" ? children(state) : children ?? (isPinned ? showUnpinLabel ? unpinLabel ?? unpin : null : showPinLabel ? pinLabel ?? pin : null),
|
|
2066
|
+
isPinned && children === void 0 && showPinnedLabel ? /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", children: [
|
|
1991
2067
|
" (",
|
|
1992
2068
|
pinnedLabel,
|
|
1993
2069
|
")"
|
|
@@ -2068,6 +2144,9 @@ function KeepBackup({
|
|
|
2068
2144
|
...props
|
|
2069
2145
|
}) {
|
|
2070
2146
|
const view = useKeepBackup({ filename, onExport, onImported });
|
|
2147
|
+
const showExportLabel = useUiLabelVisibility("exportData");
|
|
2148
|
+
const showImportModeLabel = useUiLabelVisibility("importMode");
|
|
2149
|
+
const showImportLabel = useUiLabelVisibility("importData");
|
|
2071
2150
|
return /* @__PURE__ */ jsxs2(
|
|
2072
2151
|
"section",
|
|
2073
2152
|
{
|
|
@@ -2083,16 +2162,18 @@ function KeepBackup({
|
|
|
2083
2162
|
"data-keep-action": "export-backup",
|
|
2084
2163
|
onClick: () => void view.exportBackup(),
|
|
2085
2164
|
disabled: view.isMutating,
|
|
2086
|
-
|
|
2165
|
+
"aria-label": showExportLabel ? void 0 : view.labels.export,
|
|
2166
|
+
children: showExportLabel ? view.labels.export : null
|
|
2087
2167
|
}
|
|
2088
2168
|
),
|
|
2089
2169
|
/* @__PURE__ */ jsxs2("label", { children: [
|
|
2090
|
-
view.labels.importMode,
|
|
2170
|
+
showImportModeLabel ? view.labels.importMode : null,
|
|
2091
2171
|
/* @__PURE__ */ jsxs2(
|
|
2092
2172
|
"select",
|
|
2093
2173
|
{
|
|
2094
2174
|
"data-keep-action": "select-import-mode",
|
|
2095
2175
|
value: view.mode,
|
|
2176
|
+
"aria-label": showImportModeLabel ? void 0 : view.labels.importMode,
|
|
2096
2177
|
onChange: (event) => view.setMode(event.currentTarget.value),
|
|
2097
2178
|
children: [
|
|
2098
2179
|
/* @__PURE__ */ jsx2("option", { value: "merge", children: view.labels.merge }),
|
|
@@ -2101,7 +2182,17 @@ function KeepBackup({
|
|
|
2101
2182
|
}
|
|
2102
2183
|
)
|
|
2103
2184
|
] }),
|
|
2104
|
-
/* @__PURE__ */ jsx2(
|
|
2185
|
+
/* @__PURE__ */ jsx2(
|
|
2186
|
+
"button",
|
|
2187
|
+
{
|
|
2188
|
+
type: "button",
|
|
2189
|
+
"data-keep-action": "import-backup",
|
|
2190
|
+
onClick: view.openFilePicker,
|
|
2191
|
+
disabled: view.isMutating,
|
|
2192
|
+
"aria-label": showImportLabel ? void 0 : view.labels.import,
|
|
2193
|
+
children: showImportLabel ? view.labels.import : null
|
|
2194
|
+
}
|
|
2195
|
+
),
|
|
2105
2196
|
/* @__PURE__ */ jsx2(
|
|
2106
2197
|
"input",
|
|
2107
2198
|
{
|
|
@@ -2451,15 +2542,22 @@ function KeepBulkActions({
|
|
|
2451
2542
|
controlledScope,
|
|
2452
2543
|
onSelectionScopeChange
|
|
2453
2544
|
});
|
|
2545
|
+
const showSelectItemsLabel = useUiLabelVisibility("selectItems");
|
|
2546
|
+
const showSelectionScopeLabel = useUiLabelVisibility("selectionScope");
|
|
2547
|
+
const showSelectedCountLabel = useUiLabelVisibility("selectedCount");
|
|
2548
|
+
const showTagsLabel = useUiLabelVisibility("tagsToApply");
|
|
2549
|
+
const showDeleteLabel = useUiLabelVisibility("deleteSelected");
|
|
2550
|
+
const showApplyTagsLabel = useUiLabelVisibility("applyTags");
|
|
2454
2551
|
const body = render ? render(state) : typeof children === "function" ? children(state) : children ?? /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
2455
|
-
/* @__PURE__ */ jsxs3("fieldset", { children: [
|
|
2456
|
-
/* @__PURE__ */ jsx5("legend", { children: labels.selectItems }),
|
|
2552
|
+
/* @__PURE__ */ jsxs3("fieldset", { "aria-label": showSelectItemsLabel ? void 0 : labels.selectItems, children: [
|
|
2553
|
+
showSelectItemsLabel ? /* @__PURE__ */ jsx5("legend", { children: labels.selectItems }) : null,
|
|
2457
2554
|
/* @__PURE__ */ jsxs3("label", { children: [
|
|
2458
|
-
labels.selectionScope,
|
|
2555
|
+
showSelectionScopeLabel ? labels.selectionScope : null,
|
|
2459
2556
|
/* @__PURE__ */ jsxs3(
|
|
2460
2557
|
"select",
|
|
2461
2558
|
{
|
|
2462
2559
|
"data-keep-action": "select-scope",
|
|
2560
|
+
"aria-label": showSelectionScopeLabel ? void 0 : labels.selectionScope,
|
|
2463
2561
|
value: state.selectionScope,
|
|
2464
2562
|
onChange: (event) => state.setSelectionScope(event.currentTarget.value),
|
|
2465
2563
|
children: [
|
|
@@ -2483,7 +2581,7 @@ function KeepBulkActions({
|
|
|
2483
2581
|
),
|
|
2484
2582
|
state.selectedIds.length,
|
|
2485
2583
|
" ",
|
|
2486
|
-
labels.selectedCount
|
|
2584
|
+
showSelectedCountLabel ? labels.selectedCount : null
|
|
2487
2585
|
] }),
|
|
2488
2586
|
state.items.map((item) => /* @__PURE__ */ jsxs3("span", { children: [
|
|
2489
2587
|
/* @__PURE__ */ jsx5(
|
|
@@ -2502,17 +2600,19 @@ function KeepBulkActions({
|
|
|
2502
2600
|
{
|
|
2503
2601
|
type: "button",
|
|
2504
2602
|
"data-keep-action": "delete-selected",
|
|
2603
|
+
"aria-label": showDeleteLabel ? void 0 : labels.deleteSelected,
|
|
2505
2604
|
onClick: () => void state.remove(),
|
|
2506
2605
|
disabled: state.selectedIds.length === 0 || state.isMutating,
|
|
2507
|
-
children: labels.deleteSelected
|
|
2606
|
+
children: showDeleteLabel ? labels.deleteSelected : null
|
|
2508
2607
|
}
|
|
2509
2608
|
),
|
|
2510
2609
|
/* @__PURE__ */ jsxs3("label", { children: [
|
|
2511
|
-
labels.tags,
|
|
2610
|
+
showTagsLabel ? labels.tags : null,
|
|
2512
2611
|
/* @__PURE__ */ jsx5(
|
|
2513
2612
|
"input",
|
|
2514
2613
|
{
|
|
2515
2614
|
"data-keep-action": "edit-tags",
|
|
2615
|
+
"aria-label": showTagsLabel ? void 0 : labels.tags,
|
|
2516
2616
|
value: state.tagsInput,
|
|
2517
2617
|
onChange: (event) => state.setTagsInput(event.currentTarget.value)
|
|
2518
2618
|
}
|
|
@@ -2523,9 +2623,10 @@ function KeepBulkActions({
|
|
|
2523
2623
|
{
|
|
2524
2624
|
type: "button",
|
|
2525
2625
|
"data-keep-action": "apply-tags",
|
|
2626
|
+
"aria-label": showApplyTagsLabel ? void 0 : labels.applyTags,
|
|
2526
2627
|
onClick: () => void state.updateTags(),
|
|
2527
2628
|
disabled: state.selectedIds.length === 0 || state.isMutating,
|
|
2528
|
-
children: labels.applyTags
|
|
2629
|
+
children: showApplyTagsLabel ? labels.applyTags : null
|
|
2529
2630
|
}
|
|
2530
2631
|
)
|
|
2531
2632
|
] });
|
|
@@ -2581,6 +2682,11 @@ function KeepButton({
|
|
|
2581
2682
|
...props
|
|
2582
2683
|
}) {
|
|
2583
2684
|
const view = useKeepButton({ item: props.item, labels, icons, children: props.children });
|
|
2685
|
+
const removeLabel = useUiLabel("remove");
|
|
2686
|
+
const showSaveLabel = useUiLabelVisibility("save");
|
|
2687
|
+
const showSavedLabel = useUiLabelVisibility("saved");
|
|
2688
|
+
const showLoadingLabel = useUiLabelVisibility("loading");
|
|
2689
|
+
const showErrorLabel = useUiLabelVisibility("error");
|
|
2584
2690
|
const pendingToggle = useRef3(null);
|
|
2585
2691
|
useEffect2(() => {
|
|
2586
2692
|
const pending = pendingToggle.current;
|
|
@@ -2612,11 +2718,12 @@ function KeepButton({
|
|
|
2612
2718
|
if (typeof props.children === "function") return props.children(state);
|
|
2613
2719
|
if (props.children !== void 0) return props.children;
|
|
2614
2720
|
const label = state.error ? labels?.error ?? view.labels.error : state.isMutating ? labels?.loading ?? view.labels.loading : state.isSaved ? labels?.saved ?? view.labels.saved : labels?.unsaved ?? view.labels.save;
|
|
2615
|
-
|
|
2721
|
+
const showStateLabel = state.error ? showErrorLabel : state.isMutating ? showLoadingLabel : state.isSaved ? showSavedLabel : showSaveLabel;
|
|
2722
|
+
if (!icons) return showStateLabel ? label : null;
|
|
2616
2723
|
const icon = state.error ? icons.error : state.isMutating ? icons.loading : state.isSaved ? icons.remove ?? icons.saved : icons.save;
|
|
2617
2724
|
return /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
2618
2725
|
renderIcon(icon, iconClassName),
|
|
2619
|
-
showLabel && !iconOnly ? label : null
|
|
2726
|
+
showLabel && showStateLabel && !iconOnly ? label : null
|
|
2620
2727
|
] });
|
|
2621
2728
|
};
|
|
2622
2729
|
const sharedProps = {
|
|
@@ -2636,10 +2743,10 @@ function KeepButton({
|
|
|
2636
2743
|
"data-has-custom-icon": icons ? "true" : void 0,
|
|
2637
2744
|
"data-icon-only": iconOnly ? "true" : void 0,
|
|
2638
2745
|
"aria-busy": props["aria-busy"] ?? (view.buttonState.isLoading || view.buttonState.isMutating),
|
|
2639
|
-
savedLabel: labels?.saved ?? props.savedLabel ?? view.labels.saved,
|
|
2640
|
-
unsavedLabel: labels?.unsaved ?? props.unsavedLabel ?? view.labels.save,
|
|
2641
|
-
savedAriaLabel: labels?.savedAriaLabel ?? props.savedAriaLabel,
|
|
2642
|
-
unsavedAriaLabel: labels?.unsavedAriaLabel ?? props.unsavedAriaLabel
|
|
2746
|
+
savedLabel: showSavedLabel ? labels?.saved ?? props.savedLabel ?? view.labels.saved : null,
|
|
2747
|
+
unsavedLabel: showSaveLabel ? labels?.unsaved ?? props.unsavedLabel ?? view.labels.save : null,
|
|
2748
|
+
savedAriaLabel: labels?.savedAriaLabel ?? props.savedAriaLabel ?? (props.children === void 0 && !showSavedLabel ? removeLabel : void 0),
|
|
2749
|
+
unsavedAriaLabel: labels?.unsavedAriaLabel ?? props.unsavedAriaLabel ?? (props.children === void 0 && !showSaveLabel ? view.labels.save : void 0)
|
|
2643
2750
|
};
|
|
2644
2751
|
if (!view.customStateLabel) return /* @__PURE__ */ jsx6(CoreKeepButton, { ...sharedProps });
|
|
2645
2752
|
return /* @__PURE__ */ jsx6(CoreKeepButton, { ...sharedProps, children: (state) => /* @__PURE__ */ jsx6(Fragment4, { children: getStateContent(state) }) });
|
|
@@ -2801,11 +2908,16 @@ function KeepQuickEditorView({
|
|
|
2801
2908
|
const collections = useKeepCollections({ targetType: state.item.targetType, orderBy: "name" });
|
|
2802
2909
|
const rootRef = useRef4(null);
|
|
2803
2910
|
const noteLabel = useUiLabel("note");
|
|
2911
|
+
const showNoteLabel = useUiLabelVisibility("note");
|
|
2804
2912
|
const tagsLabel = useUiLabel("tags");
|
|
2913
|
+
const showTagsLabel = useUiLabelVisibility("tags");
|
|
2805
2914
|
const collectionLabel = useUiLabel("collection");
|
|
2915
|
+
const showCollectionLabel = useUiLabelVisibility("collection");
|
|
2806
2916
|
const uncategorizedLabel = useUiLabel("uncategorized");
|
|
2807
2917
|
const saveLabel = useUiLabel("saveWithNote");
|
|
2918
|
+
const showSaveLabel = useUiLabelVisibility("saveWithNote");
|
|
2808
2919
|
const closeLabel = useUiLabel("close");
|
|
2920
|
+
const showCloseLabel = useUiLabelVisibility("close");
|
|
2809
2921
|
const unsavedChangesLabel = useUiLabel("unsavedChanges");
|
|
2810
2922
|
const savingLabel = useUiLabel("saving");
|
|
2811
2923
|
const savedLabel = useUiLabel("saved");
|
|
@@ -2825,28 +2937,37 @@ function KeepQuickEditorView({
|
|
|
2825
2937
|
};
|
|
2826
2938
|
const statusMessage = state.saveStatus === "dirty" ? unsavedChangesLabel : state.saveStatus === "saving" ? savingLabel : state.saveStatus === "saved" ? savedLabel : state.saveStatus === "error" ? getErrorMessage2(state.error, errorLabel) : null;
|
|
2827
2939
|
const body = typeof children === "function" ? children(state) : children ?? /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
2828
|
-
/* @__PURE__ */ jsxs5("label", { children: [
|
|
2829
|
-
noteLabel,
|
|
2830
|
-
/* @__PURE__ */ jsx7(
|
|
2940
|
+
/* @__PURE__ */ jsxs5("label", { "data-keep-field": "note", children: [
|
|
2941
|
+
showNoteLabel ? /* @__PURE__ */ jsx7("span", { "data-keep-field-icon": true, children: noteLabel }) : null,
|
|
2942
|
+
/* @__PURE__ */ jsx7(
|
|
2943
|
+
"textarea",
|
|
2944
|
+
{
|
|
2945
|
+
value: state.note,
|
|
2946
|
+
"aria-label": showNoteLabel ? void 0 : noteLabel,
|
|
2947
|
+
onChange: (event) => state.setNote(event.currentTarget.value)
|
|
2948
|
+
}
|
|
2949
|
+
)
|
|
2831
2950
|
] }),
|
|
2832
|
-
/* @__PURE__ */ jsxs5("label", { children: [
|
|
2833
|
-
tagsLabel,
|
|
2951
|
+
/* @__PURE__ */ jsxs5("label", { "data-keep-field": "tags", children: [
|
|
2952
|
+
showTagsLabel ? /* @__PURE__ */ jsx7("span", { "data-keep-field-icon": true, children: tagsLabel }) : null,
|
|
2834
2953
|
/* @__PURE__ */ jsx7(
|
|
2835
2954
|
"input",
|
|
2836
2955
|
{
|
|
2837
2956
|
value: state.tags.join(", "),
|
|
2957
|
+
"aria-label": showTagsLabel ? void 0 : tagsLabel,
|
|
2838
2958
|
onChange: (event) => state.setTags(
|
|
2839
2959
|
event.currentTarget.value.split(",").map((tag) => tag.trim()).filter(Boolean)
|
|
2840
2960
|
)
|
|
2841
2961
|
}
|
|
2842
2962
|
)
|
|
2843
2963
|
] }),
|
|
2844
|
-
/* @__PURE__ */ jsxs5("label", { children: [
|
|
2845
|
-
collectionLabel,
|
|
2964
|
+
/* @__PURE__ */ jsxs5("label", { "data-keep-field": "collection", children: [
|
|
2965
|
+
showCollectionLabel ? /* @__PURE__ */ jsx7("span", { "data-keep-field-icon": true, children: collectionLabel }) : null,
|
|
2846
2966
|
/* @__PURE__ */ jsxs5(
|
|
2847
2967
|
"select",
|
|
2848
2968
|
{
|
|
2849
2969
|
value: state.collectionId ?? "",
|
|
2970
|
+
"aria-label": showCollectionLabel ? void 0 : collectionLabel,
|
|
2850
2971
|
onChange: (event) => state.setCollectionId(event.currentTarget.value || void 0),
|
|
2851
2972
|
children: [
|
|
2852
2973
|
/* @__PURE__ */ jsx7("option", { value: "", children: uncategorizedLabel }),
|
|
@@ -2866,7 +2987,16 @@ function KeepQuickEditorView({
|
|
|
2866
2987
|
children: statusMessage
|
|
2867
2988
|
}
|
|
2868
2989
|
) : null,
|
|
2869
|
-
showSaveButton ? /* @__PURE__ */ jsx7(
|
|
2990
|
+
showSaveButton ? /* @__PURE__ */ jsx7(
|
|
2991
|
+
"button",
|
|
2992
|
+
{
|
|
2993
|
+
type: "submit",
|
|
2994
|
+
disabled: state.isSaving,
|
|
2995
|
+
"data-keep-action": "save-quick-edit",
|
|
2996
|
+
"aria-label": showSaveLabel ? void 0 : saveLabel,
|
|
2997
|
+
children: showSaveLabel ? saveLabel : null
|
|
2998
|
+
}
|
|
2999
|
+
) : null,
|
|
2870
3000
|
onClose ? /* @__PURE__ */ jsx7(
|
|
2871
3001
|
"button",
|
|
2872
3002
|
{
|
|
@@ -2874,7 +3004,8 @@ function KeepQuickEditorView({
|
|
|
2874
3004
|
onClick: () => void state.flush().then(onClose).catch(() => void 0),
|
|
2875
3005
|
disabled: state.isSaving,
|
|
2876
3006
|
"data-keep-action": "close-quick-edit",
|
|
2877
|
-
|
|
3007
|
+
"aria-label": showCloseLabel ? void 0 : closeLabel,
|
|
3008
|
+
children: showCloseLabel ? closeLabel : null
|
|
2878
3009
|
}
|
|
2879
3010
|
) : null
|
|
2880
3011
|
] });
|
|
@@ -3112,6 +3243,7 @@ function useKeepUndo() {
|
|
|
3112
3243
|
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3113
3244
|
function KeepUndo({ children, label, ...props }) {
|
|
3114
3245
|
const view = useKeepUndo();
|
|
3246
|
+
const showLabel = useUiLabelVisibility("undo");
|
|
3115
3247
|
if (!view.canUndo) return null;
|
|
3116
3248
|
return /* @__PURE__ */ jsxs7("div", { ...props, role: "status", "aria-live": "polite", "data-keepkit": "undo", "data-state": "available", children: [
|
|
3117
3249
|
/* @__PURE__ */ jsx9("span", { "data-keepkit": "undo-message", children: children ?? view.message }),
|
|
@@ -3129,13 +3261,22 @@ function KeepUndo({ children, label, ...props }) {
|
|
|
3129
3261
|
"aria-valuetext": `${view.remainingSeconds}s`
|
|
3130
3262
|
}
|
|
3131
3263
|
),
|
|
3132
|
-
/* @__PURE__ */ jsx9(
|
|
3264
|
+
/* @__PURE__ */ jsx9(
|
|
3265
|
+
"button",
|
|
3266
|
+
{
|
|
3267
|
+
type: "button",
|
|
3268
|
+
"data-keep-action": "undo",
|
|
3269
|
+
"aria-label": showLabel ? void 0 : view.label,
|
|
3270
|
+
onClick: () => void view.undo(),
|
|
3271
|
+
children: showLabel ? label ?? view.label : null
|
|
3272
|
+
}
|
|
3273
|
+
)
|
|
3133
3274
|
] });
|
|
3134
3275
|
}
|
|
3135
3276
|
|
|
3136
3277
|
// src/features/collection/KeepCollection.tsx
|
|
3137
3278
|
import { KeepErrorBoundary as KeepErrorBoundary2 } from "@keepkit/core/react";
|
|
3138
|
-
import { useEffect as useEffect10, useId as
|
|
3279
|
+
import { useEffect as useEffect10, useId as useId4, useState as useState15 } from "react";
|
|
3139
3280
|
|
|
3140
3281
|
// src/features/query/KeepActiveFiltersSummary.tsx
|
|
3141
3282
|
import {
|
|
@@ -3159,6 +3300,7 @@ function KeepActiveFiltersSummary({
|
|
|
3159
3300
|
const tags = normalizeTags(providedTags ?? query?.tags ?? []);
|
|
3160
3301
|
const hasFilters = Boolean(search) || tags.length > 0;
|
|
3161
3302
|
const activeFiltersLabel = useUiLabel("activeFilters");
|
|
3303
|
+
const showActiveFiltersLabel = useUiLabelVisibility("activeFilters");
|
|
3162
3304
|
const clearAllLabel = useUiLabel("clearAllFilters");
|
|
3163
3305
|
const clearLabel = useUiLabel("clearFilters");
|
|
3164
3306
|
const removeLabel = useUiLabel("removeFilter");
|
|
@@ -3204,7 +3346,7 @@ function KeepActiveFiltersSummary({
|
|
|
3204
3346
|
};
|
|
3205
3347
|
const contentChildren = asChild && isElement(children) ? void 0 : children;
|
|
3206
3348
|
const body = typeof contentChildren === "function" ? contentChildren(state) : contentChildren ?? (hasFilters ? /* @__PURE__ */ jsxs8(Fragment6, { children: [
|
|
3207
|
-
/* @__PURE__ */ jsx10("span", { "data-active-filters-label": "true", children: activeFiltersLabel }),
|
|
3349
|
+
showActiveFiltersLabel ? /* @__PURE__ */ jsx10("span", { "data-active-filters-label": "true", children: activeFiltersLabel }) : null,
|
|
3208
3350
|
/* @__PURE__ */ jsxs8("ul", { "data-active-filters-list": "true", children: [
|
|
3209
3351
|
search ? /* @__PURE__ */ jsxs8("li", { "data-filter-kind": "search", children: [
|
|
3210
3352
|
/* @__PURE__ */ jsx10("span", { "data-filter-value": "true", children: search }),
|
|
@@ -3386,6 +3528,7 @@ function KeepCollectionFilter({
|
|
|
3386
3528
|
const collections = useKeepCollections2({ orderBy: "name" });
|
|
3387
3529
|
const options = useCollectionOptions(collectionLabels, collections);
|
|
3388
3530
|
const collectionLabel = useUiLabel("collection");
|
|
3531
|
+
const showCollectionLabel = useUiLabelVisibility("collection");
|
|
3389
3532
|
const defaultAllLabel = useUiLabel("allCollections");
|
|
3390
3533
|
const defaultUncategorizedLabel = useUiLabel("uncategorized");
|
|
3391
3534
|
const all = allLabel ?? defaultAllLabel;
|
|
@@ -3397,12 +3540,13 @@ function KeepCollectionFilter({
|
|
|
3397
3540
|
onChange?.(resolved);
|
|
3398
3541
|
};
|
|
3399
3542
|
return /* @__PURE__ */ jsxs10("label", { "data-keepkit": "collection-filter", children: [
|
|
3400
|
-
/* @__PURE__ */ jsx12("span", { children: collectionLabel }),
|
|
3543
|
+
showCollectionLabel ? /* @__PURE__ */ jsx12("span", { children: collectionLabel }) : null,
|
|
3401
3544
|
/* @__PURE__ */ jsxs10(
|
|
3402
3545
|
"select",
|
|
3403
3546
|
{
|
|
3404
3547
|
...props,
|
|
3405
3548
|
value: selected,
|
|
3549
|
+
"aria-label": props["aria-label"] ?? collectionLabel,
|
|
3406
3550
|
onChange: (event) => handleChange(event.currentTarget.value),
|
|
3407
3551
|
"data-keep-action": "filter-collection",
|
|
3408
3552
|
children: [
|
|
@@ -3466,17 +3610,20 @@ function KeepTagFilter({
|
|
|
3466
3610
|
...rootProps
|
|
3467
3611
|
}) {
|
|
3468
3612
|
const view = useKeepTagFilter({ query, controlledValue, defaultValue, onChange, onValueChange });
|
|
3613
|
+
const showFilterLabel = useUiLabelVisibility("filterTags");
|
|
3614
|
+
const showAllTagsLabel = useUiLabelVisibility("allTags");
|
|
3469
3615
|
const contentChildren = asChild && isValidElement3(children) ? void 0 : children;
|
|
3470
|
-
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */ jsxs11("fieldset", { children: [
|
|
3471
|
-
/* @__PURE__ */ jsx13("legend", { children: ariaLabel ?? view.labels.aria }),
|
|
3616
|
+
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */ jsxs11("fieldset", { "aria-label": showFilterLabel ? void 0 : ariaLabel ?? view.labels.aria, children: [
|
|
3617
|
+
showFilterLabel ? /* @__PURE__ */ jsx13("legend", { children: ariaLabel ?? view.labels.aria }) : null,
|
|
3472
3618
|
/* @__PURE__ */ jsx13(
|
|
3473
3619
|
"button",
|
|
3474
3620
|
{
|
|
3475
3621
|
type: "button",
|
|
3476
3622
|
"data-keep-action": "filter-all-tags",
|
|
3477
3623
|
"aria-pressed": view.state.value === void 0,
|
|
3624
|
+
"aria-label": showAllTagsLabel ? void 0 : view.labels.all,
|
|
3478
3625
|
onClick: () => view.state.select(),
|
|
3479
|
-
children: allLabel ?? view.labels.all
|
|
3626
|
+
children: showAllTagsLabel ? allLabel ?? view.labels.all : null
|
|
3480
3627
|
}
|
|
3481
3628
|
),
|
|
3482
3629
|
view.state.tags.map((tag) => /* @__PURE__ */ jsxs11(
|
|
@@ -3653,6 +3800,8 @@ function KeepPagination({
|
|
|
3653
3800
|
...props
|
|
3654
3801
|
}) {
|
|
3655
3802
|
const view = useKeepPagination({ totalCount, pageSize, page, maxPageButtons, onPageChange });
|
|
3803
|
+
const showPreviousLabel = useUiLabelVisibility("previousPage");
|
|
3804
|
+
const showNextLabel = useUiLabelVisibility("nextPage");
|
|
3656
3805
|
const navProps = {
|
|
3657
3806
|
...props,
|
|
3658
3807
|
"data-keepkit": "pagination",
|
|
@@ -3669,7 +3818,8 @@ function KeepPagination({
|
|
|
3669
3818
|
"data-keep-action": "previous-page",
|
|
3670
3819
|
onClick: () => view.goToPage(view.currentPage - 1),
|
|
3671
3820
|
disabled: view.currentPage <= 1,
|
|
3672
|
-
|
|
3821
|
+
"aria-label": showPreviousLabel ? void 0 : view.labels.previous,
|
|
3822
|
+
children: showPreviousLabel ? view.labels.previous : null
|
|
3673
3823
|
}
|
|
3674
3824
|
),
|
|
3675
3825
|
view.visiblePages.map((nextPage) => /* @__PURE__ */ jsx14(
|
|
@@ -3691,7 +3841,8 @@ function KeepPagination({
|
|
|
3691
3841
|
"data-keep-action": "next-page",
|
|
3692
3842
|
onClick: () => view.goToPage(view.currentPage + 1),
|
|
3693
3843
|
disabled: view.currentPage >= view.pageCount,
|
|
3694
|
-
|
|
3844
|
+
"aria-label": showNextLabel ? void 0 : view.labels.next,
|
|
3845
|
+
children: showNextLabel ? view.labels.next : null
|
|
3695
3846
|
}
|
|
3696
3847
|
)
|
|
3697
3848
|
] });
|
|
@@ -3718,6 +3869,7 @@ function useKeepCollection({
|
|
|
3718
3869
|
tags: true,
|
|
3719
3870
|
pin: false,
|
|
3720
3871
|
archive: false,
|
|
3872
|
+
note: false,
|
|
3721
3873
|
...features
|
|
3722
3874
|
};
|
|
3723
3875
|
const [searchValue, setSearchValue] = useState10(query.search?.query ?? "");
|
|
@@ -3823,6 +3975,102 @@ function scopeFromArchived(archived) {
|
|
|
3823
3975
|
return archived === true ? "archived" : "active";
|
|
3824
3976
|
}
|
|
3825
3977
|
|
|
3978
|
+
// src/features/collection/KeepCollectionCreate.tsx
|
|
3979
|
+
import { useKeepCollections as useKeepCollections3, useKeepContext as useKeepContext4 } from "@keepkit/core/react";
|
|
3980
|
+
import { useId as useId2, useState as useState11 } from "react";
|
|
3981
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3982
|
+
function KeepCollectionCreate({
|
|
3983
|
+
onCreated,
|
|
3984
|
+
onError,
|
|
3985
|
+
label,
|
|
3986
|
+
submitLabel,
|
|
3987
|
+
placeholder,
|
|
3988
|
+
id: externalId,
|
|
3989
|
+
...inputProps
|
|
3990
|
+
}) {
|
|
3991
|
+
const { createCollection } = useKeepContext4();
|
|
3992
|
+
const collections = useKeepCollections3();
|
|
3993
|
+
const [name, setName] = useState11("");
|
|
3994
|
+
const [error, setError] = useState11(null);
|
|
3995
|
+
const [isSubmitting, setIsSubmitting] = useState11(false);
|
|
3996
|
+
const autoId = useId2();
|
|
3997
|
+
const inputId = externalId ?? autoId;
|
|
3998
|
+
const resolvedLabel = useUiLabel("createCollection");
|
|
3999
|
+
const showLabel = useUiLabelVisibility("createCollection");
|
|
4000
|
+
const resolvedSubmitLabel = useUiLabel("createCollectionSubmit");
|
|
4001
|
+
const showSubmitLabel = useUiLabelVisibility("createCollectionSubmit");
|
|
4002
|
+
const placeholderText = useUiLabel("collectionName");
|
|
4003
|
+
const handleSubmit = async (event) => {
|
|
4004
|
+
event.preventDefault();
|
|
4005
|
+
const trimmed = name.trim();
|
|
4006
|
+
if (!trimmed) return;
|
|
4007
|
+
const normalizedId = trimmed.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
4008
|
+
if (!normalizedId) return;
|
|
4009
|
+
const exists = collections.some((c) => c.id === normalizedId || c.name.toLowerCase() === trimmed.toLowerCase());
|
|
4010
|
+
if (exists) {
|
|
4011
|
+
const message = `Collection "${trimmed}" already exists.`;
|
|
4012
|
+
setError(message);
|
|
4013
|
+
onError?.(new Error(message));
|
|
4014
|
+
return;
|
|
4015
|
+
}
|
|
4016
|
+
setError(null);
|
|
4017
|
+
setIsSubmitting(true);
|
|
4018
|
+
try {
|
|
4019
|
+
await createCollection(normalizedId, trimmed);
|
|
4020
|
+
setName("");
|
|
4021
|
+
onCreated?.(normalizedId);
|
|
4022
|
+
} catch (cause) {
|
|
4023
|
+
const message = cause instanceof Error ? cause.message : "Failed to create collection.";
|
|
4024
|
+
setError(message);
|
|
4025
|
+
onError?.(cause);
|
|
4026
|
+
} finally {
|
|
4027
|
+
setIsSubmitting(false);
|
|
4028
|
+
}
|
|
4029
|
+
};
|
|
4030
|
+
return /* @__PURE__ */ jsxs13(
|
|
4031
|
+
"form",
|
|
4032
|
+
{
|
|
4033
|
+
"data-keepkit": "collection-create",
|
|
4034
|
+
"data-state": error ? "error" : isSubmitting ? "submitting" : "idle",
|
|
4035
|
+
onSubmit: handleSubmit,
|
|
4036
|
+
children: [
|
|
4037
|
+
showLabel ? /* @__PURE__ */ jsx15("label", { htmlFor: inputId, children: label ?? resolvedLabel }) : null,
|
|
4038
|
+
/* @__PURE__ */ jsxs13("div", { "data-keepkit": "collection-create-row", children: [
|
|
4039
|
+
/* @__PURE__ */ jsx15(
|
|
4040
|
+
"input",
|
|
4041
|
+
{
|
|
4042
|
+
...inputProps,
|
|
4043
|
+
id: inputId,
|
|
4044
|
+
type: "text",
|
|
4045
|
+
value: name,
|
|
4046
|
+
onChange: (event) => {
|
|
4047
|
+
setName(event.currentTarget.value);
|
|
4048
|
+
if (error) setError(null);
|
|
4049
|
+
},
|
|
4050
|
+
placeholder: placeholder ?? placeholderText,
|
|
4051
|
+
disabled: isSubmitting,
|
|
4052
|
+
"aria-label": showLabel ? void 0 : resolvedLabel,
|
|
4053
|
+
"aria-invalid": error ? "true" : void 0,
|
|
4054
|
+
"data-keep-action": "collection-name-input"
|
|
4055
|
+
}
|
|
4056
|
+
),
|
|
4057
|
+
/* @__PURE__ */ jsx15(
|
|
4058
|
+
"button",
|
|
4059
|
+
{
|
|
4060
|
+
type: "submit",
|
|
4061
|
+
disabled: isSubmitting || !name.trim(),
|
|
4062
|
+
"aria-label": showSubmitLabel ? void 0 : resolvedSubmitLabel,
|
|
4063
|
+
"data-keep-action": "create-collection",
|
|
4064
|
+
children: showSubmitLabel ? submitLabel ?? resolvedSubmitLabel : null
|
|
4065
|
+
}
|
|
4066
|
+
)
|
|
4067
|
+
] }),
|
|
4068
|
+
error ? /* @__PURE__ */ jsx15("p", { role: "alert", children: error }) : null
|
|
4069
|
+
]
|
|
4070
|
+
}
|
|
4071
|
+
);
|
|
4072
|
+
}
|
|
4073
|
+
|
|
3826
4074
|
// src/features/collection/KeepList.tsx
|
|
3827
4075
|
import { KeepErrorBoundary } from "@keepkit/core/react";
|
|
3828
4076
|
import { isValidElement as isValidElement6 } from "react";
|
|
@@ -3834,9 +4082,9 @@ import {
|
|
|
3834
4082
|
isValidElement as isValidElement4,
|
|
3835
4083
|
useContext as useContext3,
|
|
3836
4084
|
useEffect as useEffect8,
|
|
3837
|
-
useId as
|
|
4085
|
+
useId as useId3,
|
|
3838
4086
|
useRef as useRef7,
|
|
3839
|
-
useState as
|
|
4087
|
+
useState as useState13
|
|
3840
4088
|
} from "react";
|
|
3841
4089
|
|
|
3842
4090
|
// src/features/item/hooks/useKeepItemStatusBadge.ts
|
|
@@ -3879,10 +4127,10 @@ function getDisplayStatus(status) {
|
|
|
3879
4127
|
}
|
|
3880
4128
|
|
|
3881
4129
|
// src/features/item/KeepItemStatusBadge.tsx
|
|
3882
|
-
import { Fragment as Fragment8, jsx as
|
|
4130
|
+
import { Fragment as Fragment8, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3883
4131
|
function KeepItemStatusBadge({ status = "available", label, className, ...props }) {
|
|
3884
4132
|
const view = useKeepItemStatusBadge(status);
|
|
3885
|
-
return /* @__PURE__ */
|
|
4133
|
+
return /* @__PURE__ */ jsxs14(
|
|
3886
4134
|
"span",
|
|
3887
4135
|
{
|
|
3888
4136
|
...props,
|
|
@@ -3893,14 +4141,14 @@ function KeepItemStatusBadge({ status = "available", label, className, ...props
|
|
|
3893
4141
|
"data-status": status,
|
|
3894
4142
|
"data-item-status": view.resolvedStatus,
|
|
3895
4143
|
children: [
|
|
3896
|
-
/* @__PURE__ */
|
|
3897
|
-
/* @__PURE__ */
|
|
4144
|
+
/* @__PURE__ */ jsx16(StatusIcon, { name: view.icon }),
|
|
4145
|
+
/* @__PURE__ */ jsx16("span", { "data-status-label": "true", children: label ?? view.statusLabel })
|
|
3898
4146
|
]
|
|
3899
4147
|
}
|
|
3900
4148
|
);
|
|
3901
4149
|
}
|
|
3902
4150
|
function StatusIcon({ name }) {
|
|
3903
|
-
return /* @__PURE__ */
|
|
4151
|
+
return /* @__PURE__ */ jsxs14(
|
|
3904
4152
|
"svg",
|
|
3905
4153
|
{
|
|
3906
4154
|
"data-status-icon": name,
|
|
@@ -3915,18 +4163,18 @@ function StatusIcon({ name }) {
|
|
|
3915
4163
|
"aria-hidden": "true",
|
|
3916
4164
|
focusable: "false",
|
|
3917
4165
|
children: [
|
|
3918
|
-
name === "check" ? /* @__PURE__ */
|
|
3919
|
-
name === "clock" ? /* @__PURE__ */
|
|
3920
|
-
/* @__PURE__ */
|
|
3921
|
-
/* @__PURE__ */
|
|
4166
|
+
name === "check" ? /* @__PURE__ */ jsx16("path", { d: "m5 12 4 4L19 6" }) : null,
|
|
4167
|
+
name === "clock" ? /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
4168
|
+
/* @__PURE__ */ jsx16("circle", { cx: "12", cy: "12", r: "8" }),
|
|
4169
|
+
/* @__PURE__ */ jsx16("path", { d: "M12 7v5l3 2" })
|
|
3922
4170
|
] }) : null,
|
|
3923
|
-
name === "ban" ? /* @__PURE__ */
|
|
3924
|
-
/* @__PURE__ */
|
|
3925
|
-
/* @__PURE__ */
|
|
4171
|
+
name === "ban" ? /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
4172
|
+
/* @__PURE__ */ jsx16("circle", { cx: "12", cy: "12", r: "8" }),
|
|
4173
|
+
/* @__PURE__ */ jsx16("path", { d: "m6.5 6.5 11 11" })
|
|
3926
4174
|
] }) : null,
|
|
3927
|
-
name === "lock" ? /* @__PURE__ */
|
|
3928
|
-
/* @__PURE__ */
|
|
3929
|
-
/* @__PURE__ */
|
|
4175
|
+
name === "lock" ? /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
4176
|
+
/* @__PURE__ */ jsx16("rect", { x: "5", y: "10", width: "14", height: "10", rx: "2" }),
|
|
4177
|
+
/* @__PURE__ */ jsx16("path", { d: "M8 10V7a4 4 0 0 1 8 0v3" })
|
|
3930
4178
|
] }) : null
|
|
3931
4179
|
]
|
|
3932
4180
|
}
|
|
@@ -3934,16 +4182,16 @@ function StatusIcon({ name }) {
|
|
|
3934
4182
|
}
|
|
3935
4183
|
|
|
3936
4184
|
// src/features/status/hooks/useKeepStaleNotice.ts
|
|
3937
|
-
import { useKeepContext as
|
|
3938
|
-
import { useState as
|
|
4185
|
+
import { useKeepContext as useKeepContext5 } from "@keepkit/core/react";
|
|
4186
|
+
import { useState as useState12 } from "react";
|
|
3939
4187
|
function useKeepStaleNotice({ item, onRetry, onRemoved }) {
|
|
3940
|
-
const context =
|
|
4188
|
+
const context = useKeepContext5();
|
|
3941
4189
|
const emitFeedback = useKeepUiFeedback();
|
|
3942
4190
|
const removedMessage = useUiLabel("removedMessage");
|
|
3943
4191
|
const restoredMessage = useUiLabel("restoredMessage");
|
|
3944
4192
|
const undoLabel = useUiLabel("undo");
|
|
3945
|
-
const [isRetrying, setIsRetrying] =
|
|
3946
|
-
const [error, setError] =
|
|
4193
|
+
const [isRetrying, setIsRetrying] = useState12(false);
|
|
4194
|
+
const [error, setError] = useState12(null);
|
|
3947
4195
|
async function retry() {
|
|
3948
4196
|
setError(null);
|
|
3949
4197
|
setIsRetrying(true);
|
|
@@ -3989,7 +4237,7 @@ function useKeepStaleNotice({ item, onRetry, onRemoved }) {
|
|
|
3989
4237
|
};
|
|
3990
4238
|
}
|
|
3991
4239
|
function useKeepPruneStale({ statuses, onPruned }) {
|
|
3992
|
-
const context =
|
|
4240
|
+
const context = useKeepContext5();
|
|
3993
4241
|
const emitFeedback = useKeepUiFeedback();
|
|
3994
4242
|
const staleItems = context.items.filter((item) => item.status && statuses.includes(item.status));
|
|
3995
4243
|
const staleIds = staleItems.map((item) => item.id);
|
|
@@ -4023,7 +4271,7 @@ function useKeepPruneStale({ statuses, onPruned }) {
|
|
|
4023
4271
|
}
|
|
4024
4272
|
|
|
4025
4273
|
// src/features/status/KeepStaleNotice.tsx
|
|
4026
|
-
import { jsx as
|
|
4274
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4027
4275
|
function KeepStaleNotice({
|
|
4028
4276
|
item,
|
|
4029
4277
|
onRetry,
|
|
@@ -4035,32 +4283,36 @@ function KeepStaleNotice({
|
|
|
4035
4283
|
...props
|
|
4036
4284
|
}) {
|
|
4037
4285
|
const view = useKeepStaleNotice({ item, onRetry, onRemoved });
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
/* @__PURE__ */
|
|
4042
|
-
|
|
4286
|
+
const showRetryLabel = useUiLabelVisibility("retry");
|
|
4287
|
+
const showRemoveLabel = useUiLabelVisibility("removeFromList");
|
|
4288
|
+
return /* @__PURE__ */ jsxs15("aside", { ...props, className, "data-keepkit": "stale-notice", "data-state": view.error ? "error" : "stale", children: [
|
|
4289
|
+
/* @__PURE__ */ jsx17(KeepItemStatusBadge, { status: view.status }),
|
|
4290
|
+
children ?? (item.statusReason ? /* @__PURE__ */ jsx17("p", { children: item.statusReason }) : null),
|
|
4291
|
+
/* @__PURE__ */ jsxs15("div", { children: [
|
|
4292
|
+
/* @__PURE__ */ jsx17(
|
|
4043
4293
|
"button",
|
|
4044
4294
|
{
|
|
4045
4295
|
type: "button",
|
|
4046
4296
|
"data-keep-action": "retry-item",
|
|
4047
4297
|
onClick: () => void view.retry(),
|
|
4048
4298
|
disabled: view.isRetrying || view.isMutating,
|
|
4049
|
-
|
|
4299
|
+
"aria-label": showRetryLabel ? void 0 : view.labels.retry,
|
|
4300
|
+
children: showRetryLabel ? retryLabel ?? view.labels.retry : null
|
|
4050
4301
|
}
|
|
4051
4302
|
),
|
|
4052
|
-
/* @__PURE__ */
|
|
4303
|
+
/* @__PURE__ */ jsx17(
|
|
4053
4304
|
"button",
|
|
4054
4305
|
{
|
|
4055
4306
|
type: "button",
|
|
4056
4307
|
"data-keep-action": "remove-item",
|
|
4057
4308
|
onClick: () => void view.remove(),
|
|
4058
4309
|
disabled: view.isMutating,
|
|
4059
|
-
|
|
4310
|
+
"aria-label": showRemoveLabel ? void 0 : view.labels.remove,
|
|
4311
|
+
children: showRemoveLabel ? removeLabel ?? view.labels.remove : null
|
|
4060
4312
|
}
|
|
4061
4313
|
)
|
|
4062
4314
|
] }),
|
|
4063
|
-
view.error ? /* @__PURE__ */
|
|
4315
|
+
view.error ? /* @__PURE__ */ jsx17("p", { role: "alert", children: view.error instanceof Error ? view.error.message : view.labels.error }) : null
|
|
4064
4316
|
] });
|
|
4065
4317
|
}
|
|
4066
4318
|
function KeepPruneStaleButton({
|
|
@@ -4072,7 +4324,8 @@ function KeepPruneStaleButton({
|
|
|
4072
4324
|
...props
|
|
4073
4325
|
}) {
|
|
4074
4326
|
const view = useKeepPruneStale({ statuses, onPruned });
|
|
4075
|
-
|
|
4327
|
+
const showLabel = useUiLabelVisibility("pruneStale");
|
|
4328
|
+
return /* @__PURE__ */ jsx17(
|
|
4076
4329
|
"button",
|
|
4077
4330
|
{
|
|
4078
4331
|
...props,
|
|
@@ -4082,8 +4335,9 @@ function KeepPruneStaleButton({
|
|
|
4082
4335
|
"data-keep-action": "prune-stale",
|
|
4083
4336
|
"data-state": view.staleIds.length > 0 ? "available" : "empty",
|
|
4084
4337
|
disabled: view.staleIds.length === 0 || view.isMutating || disabled,
|
|
4338
|
+
"aria-label": showLabel ? void 0 : view.label,
|
|
4085
4339
|
onClick: () => void view.prune(),
|
|
4086
|
-
children: children ?? label ?? `${view.label} (${view.staleIds.length})`
|
|
4340
|
+
children: showLabel ? children ?? label ?? `${view.label} (${view.staleIds.length})` : null
|
|
4087
4341
|
}
|
|
4088
4342
|
);
|
|
4089
4343
|
}
|
|
@@ -4185,7 +4439,7 @@ function getDisplayStatus2(status) {
|
|
|
4185
4439
|
}
|
|
4186
4440
|
|
|
4187
4441
|
// src/features/item/KeepItemCard.tsx
|
|
4188
|
-
import { Fragment as Fragment9, jsx as
|
|
4442
|
+
import { Fragment as Fragment9, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4189
4443
|
var KeepItemCardContext = createContext3(null);
|
|
4190
4444
|
function useKeepItemCardCompound(part) {
|
|
4191
4445
|
const context = useContext3(KeepItemCardContext);
|
|
@@ -4201,6 +4455,7 @@ function KeepItemCardRoot({
|
|
|
4201
4455
|
renderImage,
|
|
4202
4456
|
renderTags,
|
|
4203
4457
|
showTags = true,
|
|
4458
|
+
showNote = false,
|
|
4204
4459
|
showSavedAt = true,
|
|
4205
4460
|
collectionLabels,
|
|
4206
4461
|
imageAlt,
|
|
@@ -4243,10 +4498,12 @@ function KeepItemCardRoot({
|
|
|
4243
4498
|
const contextQuery = useKeepSearchQuery();
|
|
4244
4499
|
const searchQuery = highlightQuery ?? contextQuery;
|
|
4245
4500
|
const contentChildren = asChild && isValidElement4(children) ? void 0 : children;
|
|
4246
|
-
const [isEditOpen, setEditOpen] =
|
|
4501
|
+
const [isEditOpen, setEditOpen] = useState13(false);
|
|
4247
4502
|
const editTriggerRef = useRef7(null);
|
|
4248
|
-
const editPanelId =
|
|
4503
|
+
const editPanelId = useId3();
|
|
4249
4504
|
const editLabel = useUiLabel("editSavedItem");
|
|
4505
|
+
const showEditLabel = useUiLabelVisibility("editSavedItem");
|
|
4506
|
+
const showSavedAtLabel = useUiLabelVisibility("saved");
|
|
4250
4507
|
const closeEdit = () => setEditOpen(false);
|
|
4251
4508
|
useEffect8(() => {
|
|
4252
4509
|
if (!isEditOpen) editTriggerRef.current?.focus();
|
|
@@ -4260,16 +4517,16 @@ function KeepItemCardRoot({
|
|
|
4260
4517
|
onClick: (event) => onOpen?.(item, event),
|
|
4261
4518
|
children: content
|
|
4262
4519
|
};
|
|
4263
|
-
return LinkComponent ? /* @__PURE__ */
|
|
4520
|
+
return LinkComponent ? /* @__PURE__ */ jsx18(LinkComponent, { ...linkProps }) : /* @__PURE__ */ jsx18("a", { ...linkProps });
|
|
4264
4521
|
}
|
|
4265
4522
|
function renderTitle(content) {
|
|
4266
4523
|
if (linkTarget !== "title") return content;
|
|
4267
4524
|
if (view.isAvailable) return renderLink(content);
|
|
4268
|
-
return view.href ? /* @__PURE__ */
|
|
4525
|
+
return view.href ? /* @__PURE__ */ jsx18("span", { "aria-disabled": "true", "data-link-disabled": "true", children: content }) : content;
|
|
4269
4526
|
}
|
|
4270
4527
|
const resolvedImageProps = view.imageProps ? { ...view.imageProps, alt: imageAlt ?? view.imageProps.alt } : void 0;
|
|
4271
4528
|
const imageSource = resolvedImageProps?.src;
|
|
4272
|
-
const [imageStatus, setImageStatus] =
|
|
4529
|
+
const [imageStatus, setImageStatus] = useState13(imageSource ? "loading" : "error");
|
|
4273
4530
|
useEffect8(() => {
|
|
4274
4531
|
setImageStatus(imageSource ? "loading" : "error");
|
|
4275
4532
|
}, [imageSource]);
|
|
@@ -4288,44 +4545,47 @@ function KeepItemCardRoot({
|
|
|
4288
4545
|
setImageStatus("error");
|
|
4289
4546
|
}
|
|
4290
4547
|
};
|
|
4291
|
-
image = renderImage?.(imagePropsWithHandlers, item) ?? (ImageComponent ? /* @__PURE__ */
|
|
4548
|
+
image = renderImage?.(imagePropsWithHandlers, item) ?? (ImageComponent ? /* @__PURE__ */ jsx18(ImageComponent, { ...imagePropsWithHandlers }) : /* @__PURE__ */ jsx18("img", { ...imagePropsWithHandlers, alt: imagePropsWithHandlers.alt }));
|
|
4292
4549
|
}
|
|
4293
4550
|
const tags = showTags ? item.tags ?? [] : [];
|
|
4294
4551
|
const renderedTags = showTags && tags.length > 0 ? renderTags?.(tags, item) ?? null : null;
|
|
4295
|
-
const meta = showSavedAt ? /* @__PURE__ */
|
|
4296
|
-
/* @__PURE__ */
|
|
4552
|
+
const meta = showSavedAt ? /* @__PURE__ */ jsxs16("div", { "data-card-meta": true, children: [
|
|
4553
|
+
showSavedAtLabel ? /* @__PURE__ */ jsxs16("span", { children: [
|
|
4297
4554
|
view.labels.savedAt,
|
|
4298
4555
|
":"
|
|
4299
|
-
] }),
|
|
4300
|
-
" ",
|
|
4301
|
-
/* @__PURE__ */ jsx17("time", { dateTime: new Date(item.savedAt).toISOString(), children: formatSavedAt(item.savedAt) })
|
|
4302
|
-
] }) : null;
|
|
4303
|
-
const error = view.itemState.error ? /* @__PURE__ */ jsx17("p", { role: "alert", children: getErrorMessage3(view.itemState.error, view.labels.error) }) : null;
|
|
4304
|
-
const actions = view.statusLabel ? /* @__PURE__ */ jsx17(KeepStaleNotice, { item, onRetry, onRemoved }) : /* @__PURE__ */ jsxs15(Fragment9, { children: [
|
|
4305
|
-
showEditButton ? /* @__PURE__ */ jsxs15(Fragment9, { children: [
|
|
4306
|
-
/* @__PURE__ */ jsx17(
|
|
4307
|
-
"button",
|
|
4308
|
-
{
|
|
4309
|
-
ref: editTriggerRef,
|
|
4310
|
-
type: "button",
|
|
4311
|
-
"data-keep-action": "edit",
|
|
4312
|
-
"aria-label": editLabel,
|
|
4313
|
-
"aria-haspopup": "dialog",
|
|
4314
|
-
"aria-expanded": isEditOpen,
|
|
4315
|
-
"aria-controls": editPanelId,
|
|
4316
|
-
onClick: () => {
|
|
4317
|
-
onEdit?.(item);
|
|
4318
|
-
setEditOpen(true);
|
|
4319
|
-
},
|
|
4320
|
-
children: editLabel
|
|
4321
|
-
}
|
|
4322
|
-
),
|
|
4323
|
-
isEditOpen ? /* @__PURE__ */ jsx17("div", { id: editPanelId, role: "dialog", "aria-label": editLabel, "data-keepkit": "item-edit-dialog", children: editSlot ? editSlot(item, closeEdit) : /* @__PURE__ */ jsx17(KeepQuickEditor, { item: view.itemState.item ?? item, onClose: closeEdit }) }) : null
|
|
4324
4556
|
] }) : null,
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4557
|
+
showSavedAtLabel ? " " : null,
|
|
4558
|
+
/* @__PURE__ */ jsx18("time", { dateTime: new Date(item.savedAt).toISOString(), children: formatSavedAt(item.savedAt) })
|
|
4559
|
+
] }) : null;
|
|
4560
|
+
const error = view.itemState.error ? /* @__PURE__ */ jsx18("p", { role: "alert", children: getErrorMessage3(view.itemState.error, view.labels.error) }) : null;
|
|
4561
|
+
const actions = view.statusLabel ? /* @__PURE__ */ jsx18(KeepStaleNotice, { item, onRetry, onRemoved }) : /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
4562
|
+
showEditButton ? isEditOpen ? /* @__PURE__ */ jsx18("div", { id: editPanelId, role: "dialog", "aria-label": editLabel, "data-keepkit": "item-edit-dialog", children: editSlot ? editSlot(item, closeEdit) : /* @__PURE__ */ jsx18(KeepQuickEditor, { item: view.itemState.item ?? item, onClose: closeEdit }) }) : /* @__PURE__ */ jsx18(
|
|
4563
|
+
"button",
|
|
4564
|
+
{
|
|
4565
|
+
ref: editTriggerRef,
|
|
4566
|
+
type: "button",
|
|
4567
|
+
"data-keep-action": "edit",
|
|
4568
|
+
"aria-label": showEditLabel ? void 0 : editLabel,
|
|
4569
|
+
"aria-haspopup": "dialog",
|
|
4570
|
+
"aria-expanded": false,
|
|
4571
|
+
"aria-controls": editPanelId,
|
|
4572
|
+
onClick: () => {
|
|
4573
|
+
onEdit?.(item);
|
|
4574
|
+
setEditOpen(true);
|
|
4575
|
+
},
|
|
4576
|
+
children: showEditLabel ? editLabel : null
|
|
4577
|
+
}
|
|
4578
|
+
) : null,
|
|
4579
|
+
isEditOpen ? null : /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
4580
|
+
showSaveButton ? /* @__PURE__ */ jsx18(KeepItemCardSave, {}) : null,
|
|
4581
|
+
showPinButton ? /* @__PURE__ */ jsx18(KeepItemCardPin, {}) : null,
|
|
4582
|
+
showArchiveButton ? /* @__PURE__ */ jsx18(KeepItemCardArchive, {}) : null,
|
|
4583
|
+
/* @__PURE__ */ jsx18(KeepItemCardRemove, {})
|
|
4584
|
+
] }),
|
|
4585
|
+
isEditOpen && (showPinButton || showArchiveButton) ? /* @__PURE__ */ jsxs16("div", { "data-keep-card-part": "actions-secondary", children: [
|
|
4586
|
+
showPinButton ? /* @__PURE__ */ jsx18(KeepItemCardPin, {}) : null,
|
|
4587
|
+
showArchiveButton ? /* @__PURE__ */ jsx18(KeepItemCardArchive, {}) : null
|
|
4588
|
+
] }) : null
|
|
4329
4589
|
] });
|
|
4330
4590
|
const compoundValue = {
|
|
4331
4591
|
item,
|
|
@@ -4335,6 +4595,7 @@ function KeepItemCardRoot({
|
|
|
4335
4595
|
image: imageStatus === "error" ? null : image,
|
|
4336
4596
|
imageStatus,
|
|
4337
4597
|
fallbackLabel: String(view.resolvedTitle),
|
|
4598
|
+
note: showNote ? item.note : void 0,
|
|
4338
4599
|
tags,
|
|
4339
4600
|
tagsLabel: view.labels.tags,
|
|
4340
4601
|
renderedTags,
|
|
@@ -4346,12 +4607,12 @@ function KeepItemCardRoot({
|
|
|
4346
4607
|
remove: view.remove,
|
|
4347
4608
|
isMutating: view.itemState.isMutating,
|
|
4348
4609
|
saveAriaLabel: `${view.labels.remove} ${String(view.resolvedTitle)}`,
|
|
4349
|
-
renderText: (content) => /* @__PURE__ */
|
|
4610
|
+
renderText: (content) => /* @__PURE__ */ jsx18(KeepHighlight, { query: searchQuery, children: content })
|
|
4350
4611
|
};
|
|
4351
|
-
const defaultBody = /* @__PURE__ */
|
|
4352
|
-
/* @__PURE__ */
|
|
4353
|
-
/* @__PURE__ */
|
|
4354
|
-
/* @__PURE__ */
|
|
4612
|
+
const defaultBody = /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
4613
|
+
/* @__PURE__ */ jsx18(KeepItemCardMedia, {}),
|
|
4614
|
+
/* @__PURE__ */ jsx18(KeepItemCardContent, {}),
|
|
4615
|
+
/* @__PURE__ */ jsx18(KeepItemCardActions, {})
|
|
4355
4616
|
] });
|
|
4356
4617
|
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? defaultBody;
|
|
4357
4618
|
const linkedBody = linkTarget === "card" && view.isAvailable ? renderLink(body) : body;
|
|
@@ -4373,18 +4634,19 @@ function KeepItemCardRoot({
|
|
|
4373
4634
|
linkedBody,
|
|
4374
4635
|
"KeepItemCard"
|
|
4375
4636
|
);
|
|
4376
|
-
return /* @__PURE__ */
|
|
4637
|
+
return /* @__PURE__ */ jsx18(KeepItemCardContext.Provider, { value: compoundValue, children: root });
|
|
4377
4638
|
}
|
|
4378
4639
|
function KeepItemCardMedia({ children, fallback, ...props }) {
|
|
4379
4640
|
const context = useKeepItemCardCompound("Media");
|
|
4380
|
-
return /* @__PURE__ */
|
|
4641
|
+
return /* @__PURE__ */ jsx18("div", { ...props, "data-keep-card-part": "media", "data-media-status": context.imageStatus, "data-aspect-ratio": "1/1", children: children ?? context.image ?? /* @__PURE__ */ jsx18("span", { role: "img", "aria-label": context.fallbackLabel, "data-keep-card-fallback": "true", children: fallback ?? /* @__PURE__ */ jsx18(KeepMediaPlaceholderIcon, {}) }) });
|
|
4381
4642
|
}
|
|
4382
4643
|
function KeepItemCardContent({ children, ...props }) {
|
|
4383
4644
|
const context = useKeepItemCardCompound("Content");
|
|
4384
|
-
return /* @__PURE__ */
|
|
4385
|
-
/* @__PURE__ */
|
|
4645
|
+
return /* @__PURE__ */ jsx18("div", { ...props, "data-keep-card-part": "content", children: children === void 0 ? /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
4646
|
+
/* @__PURE__ */ jsx18(KeepItemCardTitle, {}),
|
|
4386
4647
|
context.meta,
|
|
4387
|
-
/* @__PURE__ */
|
|
4648
|
+
context.note ? /* @__PURE__ */ jsx18("p", { "data-keep-card-part": "memo-preview", "data-line-clamp": "2", children: context.note }) : null,
|
|
4649
|
+
/* @__PURE__ */ jsx18(KeepItemCardTags, {}),
|
|
4388
4650
|
context.error
|
|
4389
4651
|
] }) : context.renderText(children) });
|
|
4390
4652
|
}
|
|
@@ -4397,8 +4659,8 @@ function KeepItemCardTitle({ as = "h3", children, ...props }) {
|
|
|
4397
4659
|
);
|
|
4398
4660
|
}
|
|
4399
4661
|
function KeepMediaPlaceholderIcon() {
|
|
4400
|
-
return /* @__PURE__ */
|
|
4401
|
-
/* @__PURE__ */
|
|
4662
|
+
return /* @__PURE__ */ jsxs16("svg", { "data-media-fallback-icon": "true", viewBox: "0 0 24 24", "aria-hidden": "true", children: [
|
|
4663
|
+
/* @__PURE__ */ jsx18(
|
|
4402
4664
|
"path",
|
|
4403
4665
|
{
|
|
4404
4666
|
d: "M4 5.5A1.5 1.5 0 0 1 5.5 4h13A1.5 1.5 0 0 1 20 5.5v13a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 4 18.5v-13Z",
|
|
@@ -4406,23 +4668,23 @@ function KeepMediaPlaceholderIcon() {
|
|
|
4406
4668
|
stroke: "currentColor"
|
|
4407
4669
|
}
|
|
4408
4670
|
),
|
|
4409
|
-
/* @__PURE__ */
|
|
4410
|
-
/* @__PURE__ */
|
|
4671
|
+
/* @__PURE__ */ jsx18("circle", { cx: "9", cy: "9", r: "1.5", fill: "currentColor" }),
|
|
4672
|
+
/* @__PURE__ */ jsx18("path", { d: "m5.5 18 4.5-4.5 3 3 2-2L19 18", fill: "none", stroke: "currentColor" })
|
|
4411
4673
|
] });
|
|
4412
4674
|
}
|
|
4413
4675
|
function KeepItemCardTags({ children, ...props }) {
|
|
4414
4676
|
const context = useKeepItemCardCompound("Tags");
|
|
4415
4677
|
if (children === void 0 && context.renderedTags) return context.renderedTags;
|
|
4416
4678
|
if (children === void 0 && context.tags.length === 0) return null;
|
|
4417
|
-
return /* @__PURE__ */
|
|
4679
|
+
return /* @__PURE__ */ jsx18("ul", { ...props, "aria-label": props["aria-label"] ?? context.tagsLabel, "data-keep-card-part": "tags", children: children ?? context.tags.map((tag) => /* @__PURE__ */ jsx18("li", { children: tag }, tag)) });
|
|
4418
4680
|
}
|
|
4419
4681
|
function KeepItemCardActions({ children, ...props }) {
|
|
4420
4682
|
const context = useKeepItemCardCompound("Actions");
|
|
4421
|
-
return /* @__PURE__ */
|
|
4683
|
+
return /* @__PURE__ */ jsx18("div", { ...props, "data-keep-card-part": "actions", children: children ?? context.actions });
|
|
4422
4684
|
}
|
|
4423
4685
|
function KeepItemCardSave({ labels, getAriaLabel, ...props }) {
|
|
4424
4686
|
const context = useKeepItemCardCompound("Save");
|
|
4425
|
-
return /* @__PURE__ */
|
|
4687
|
+
return /* @__PURE__ */ jsx18(
|
|
4426
4688
|
KeepButton,
|
|
4427
4689
|
{
|
|
4428
4690
|
...props,
|
|
@@ -4435,7 +4697,7 @@ function KeepItemCardSave({ labels, getAriaLabel, ...props }) {
|
|
|
4435
4697
|
}
|
|
4436
4698
|
function KeepItemCardRemove({ children, disabled, onClick, ...props }) {
|
|
4437
4699
|
const context = useKeepItemCardCompound("Remove");
|
|
4438
|
-
return /* @__PURE__ */
|
|
4700
|
+
return /* @__PURE__ */ jsx18(
|
|
4439
4701
|
"button",
|
|
4440
4702
|
{
|
|
4441
4703
|
...props,
|
|
@@ -4452,19 +4714,19 @@ function KeepItemCardRemove({ children, disabled, onClick, ...props }) {
|
|
|
4452
4714
|
}
|
|
4453
4715
|
function KeepItemCardPin({ children, ...props }) {
|
|
4454
4716
|
const context = useKeepItemCardCompound("Pin");
|
|
4455
|
-
return /* @__PURE__ */
|
|
4717
|
+
return /* @__PURE__ */ jsx18(KeepPinButton, { ...props, item: context.item, children });
|
|
4456
4718
|
}
|
|
4457
4719
|
function KeepItemCardArchive({
|
|
4458
4720
|
children,
|
|
4459
4721
|
...props
|
|
4460
4722
|
}) {
|
|
4461
4723
|
const context = useKeepItemCardCompound("Archive");
|
|
4462
|
-
return /* @__PURE__ */
|
|
4724
|
+
return /* @__PURE__ */ jsx18(KeepArchiveButton, { ...props, item: context.item, children });
|
|
4463
4725
|
}
|
|
4464
4726
|
function KeepItemCardCollectionBadge({ children, ...props }) {
|
|
4465
4727
|
const context = useKeepItemCardCompound("CollectionBadge");
|
|
4466
4728
|
if (!context.item.collectionId) return null;
|
|
4467
|
-
return /* @__PURE__ */
|
|
4729
|
+
return /* @__PURE__ */ jsx18("span", { ...props, "data-keep-card-part": "collection-badge", children: children ?? context.collectionLabel });
|
|
4468
4730
|
}
|
|
4469
4731
|
var KeepItemCard = Object.assign(KeepItemCardRoot, {
|
|
4470
4732
|
Media: KeepItemCardMedia,
|
|
@@ -4479,12 +4741,12 @@ var KeepItemCard = Object.assign(KeepItemCardRoot, {
|
|
|
4479
4741
|
CollectionBadge: KeepItemCardCollectionBadge
|
|
4480
4742
|
});
|
|
4481
4743
|
function KeepItemCardSkeleton({ layout = "list", ...props }) {
|
|
4482
|
-
return /* @__PURE__ */
|
|
4483
|
-
/* @__PURE__ */
|
|
4484
|
-
/* @__PURE__ */
|
|
4485
|
-
/* @__PURE__ */
|
|
4486
|
-
/* @__PURE__ */
|
|
4487
|
-
/* @__PURE__ */
|
|
4744
|
+
return /* @__PURE__ */ jsxs16("article", { ...props, "aria-hidden": "true", "data-keepkit": "card-skeleton", "data-layout": layout, "data-state": "loading", children: [
|
|
4745
|
+
/* @__PURE__ */ jsx18("span", { "data-skeleton-part": "media" }),
|
|
4746
|
+
/* @__PURE__ */ jsx18("span", { "data-skeleton-part": "title" }),
|
|
4747
|
+
/* @__PURE__ */ jsx18("span", { "data-skeleton-part": "meta" }),
|
|
4748
|
+
/* @__PURE__ */ jsx18("span", { "data-skeleton-part": "tag" }),
|
|
4749
|
+
/* @__PURE__ */ jsx18("span", { "data-skeleton-part": "tag" })
|
|
4488
4750
|
] });
|
|
4489
4751
|
}
|
|
4490
4752
|
function formatSavedAt(timestamp) {
|
|
@@ -4496,7 +4758,7 @@ function getErrorMessage3(error, fallback) {
|
|
|
4496
4758
|
|
|
4497
4759
|
// src/features/status/KeepEmptyState.tsx
|
|
4498
4760
|
import { isValidElement as isValidElement5 } from "react";
|
|
4499
|
-
import { Fragment as Fragment10, jsx as
|
|
4761
|
+
import { Fragment as Fragment10, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4500
4762
|
function KeepEmptyState({
|
|
4501
4763
|
title,
|
|
4502
4764
|
description,
|
|
@@ -4515,10 +4777,10 @@ function KeepEmptyState({
|
|
|
4515
4777
|
);
|
|
4516
4778
|
const clearLabel = useUiLabel("clearFilters");
|
|
4517
4779
|
const contentChildren = asChild && isValidElement5(children) ? void 0 : children;
|
|
4518
|
-
const body = contentChildren ?? /* @__PURE__ */
|
|
4519
|
-
/* @__PURE__ */
|
|
4520
|
-
description ?? /* @__PURE__ */
|
|
4521
|
-
action ?? (resolvedVariant === "empty-filtered" && onClearFilters ? /* @__PURE__ */
|
|
4780
|
+
const body = contentChildren ?? /* @__PURE__ */ jsxs17(Fragment10, { children: [
|
|
4781
|
+
/* @__PURE__ */ jsx19("h2", { children: title ?? defaultTitle }),
|
|
4782
|
+
description ?? /* @__PURE__ */ jsx19("p", { children: defaultDescription }),
|
|
4783
|
+
action ?? (resolvedVariant === "empty-filtered" && onClearFilters ? /* @__PURE__ */ jsx19("button", { type: "button", "data-keep-action": "clear-filters", onClick: onClearFilters, children: clearLabel }) : null)
|
|
4522
4784
|
] });
|
|
4523
4785
|
return renderRoot(
|
|
4524
4786
|
asChild,
|
|
@@ -4609,8 +4871,8 @@ function useRovingTabIndex() {
|
|
|
4609
4871
|
}
|
|
4610
4872
|
|
|
4611
4873
|
// src/features/collection/KeepReorderableList.tsx
|
|
4612
|
-
import { useState as
|
|
4613
|
-
import { jsx as
|
|
4874
|
+
import { useState as useState14 } from "react";
|
|
4875
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
4614
4876
|
function KeepReorderableList({
|
|
4615
4877
|
items,
|
|
4616
4878
|
onReorder,
|
|
@@ -4618,8 +4880,8 @@ function KeepReorderableList({
|
|
|
4618
4880
|
itemLabel = (_item, index) => `Move item ${index + 1}`,
|
|
4619
4881
|
...props
|
|
4620
4882
|
}) {
|
|
4621
|
-
const [draggedId, setDraggedId] =
|
|
4622
|
-
const [dropTargetIndex, setDropTargetIndex] =
|
|
4883
|
+
const [draggedId, setDraggedId] = useState14(null);
|
|
4884
|
+
const [dropTargetIndex, setDropTargetIndex] = useState14(null);
|
|
4623
4885
|
const ids = items.map((item) => item.id);
|
|
4624
4886
|
function commit(nextIds) {
|
|
4625
4887
|
void onReorder(nextIds);
|
|
@@ -4644,7 +4906,7 @@ function KeepReorderableList({
|
|
|
4644
4906
|
if (next[index] === id) return;
|
|
4645
4907
|
commit(next);
|
|
4646
4908
|
}
|
|
4647
|
-
return /* @__PURE__ */
|
|
4909
|
+
return /* @__PURE__ */ jsx20("ul", { ...props, "data-keepkit": "reorderable-list", children: items.map((item, index) => {
|
|
4648
4910
|
const moveUp = () => move(index, index - 1);
|
|
4649
4911
|
const moveDown = () => move(index, index + 1);
|
|
4650
4912
|
const onHandleKeyDown = (event) => {
|
|
@@ -4688,7 +4950,7 @@ function KeepReorderableList({
|
|
|
4688
4950
|
onKeyDown: onHandleKeyDown
|
|
4689
4951
|
}
|
|
4690
4952
|
};
|
|
4691
|
-
return /* @__PURE__ */
|
|
4953
|
+
return /* @__PURE__ */ jsx20(
|
|
4692
4954
|
"li",
|
|
4693
4955
|
{
|
|
4694
4956
|
"data-reorder-index": index,
|
|
@@ -4720,12 +4982,12 @@ function KeepReorderableList({
|
|
|
4720
4982
|
}
|
|
4721
4983
|
|
|
4722
4984
|
// src/features/collection/KeepList.tsx
|
|
4723
|
-
import { Fragment as Fragment11, jsx as
|
|
4985
|
+
import { Fragment as Fragment11, jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4724
4986
|
function KeepList(props) {
|
|
4725
4987
|
const { fallback, onBoundaryError, boundaryResetKey, ...listProps } = props;
|
|
4726
|
-
const content = /* @__PURE__ */
|
|
4988
|
+
const content = /* @__PURE__ */ jsx21(KeepListContent, { ...listProps });
|
|
4727
4989
|
if (fallback === void 0 && onBoundaryError === void 0) return content;
|
|
4728
|
-
return /* @__PURE__ */
|
|
4990
|
+
return /* @__PURE__ */ jsx21(KeepErrorBoundary, { fallback, onError: onBoundaryError, resetKey: boundaryResetKey, children: content });
|
|
4729
4991
|
}
|
|
4730
4992
|
function KeepListContent({
|
|
4731
4993
|
query,
|
|
@@ -4790,7 +5052,7 @@ function KeepListContent({
|
|
|
4790
5052
|
if (!event.defaultPrevented) roving.onFocusCapture(event);
|
|
4791
5053
|
}
|
|
4792
5054
|
},
|
|
4793
|
-
/* @__PURE__ */
|
|
5055
|
+
/* @__PURE__ */ jsx21(KeepSearchQueryProvider, { query: query?.search?.query, children: body }),
|
|
4794
5056
|
"KeepList"
|
|
4795
5057
|
);
|
|
4796
5058
|
}
|
|
@@ -4805,17 +5067,17 @@ function getListBody(state, options) {
|
|
|
4805
5067
|
if (state.isLoading && !state.isHydrated) {
|
|
4806
5068
|
if (options.loading !== void 0) return resolveContent(options.loading, state);
|
|
4807
5069
|
const count = Number.isFinite(options.loadingCount) ? Math.max(0, Math.floor(options.loadingCount)) : 6;
|
|
4808
|
-
return /* @__PURE__ */
|
|
4809
|
-
/* @__PURE__ */
|
|
4810
|
-
/* @__PURE__ */
|
|
5070
|
+
return /* @__PURE__ */ jsxs18(Fragment11, { children: [
|
|
5071
|
+
/* @__PURE__ */ jsx21("span", { role: "status", "data-keepkit": "loading-label", children: options.loadingLabel }),
|
|
5072
|
+
/* @__PURE__ */ jsx21("ul", { "data-keepkit": "skeleton-list", "data-layout": options.layout, children: Array.from({ length: count }, (_, index) => (
|
|
4811
5073
|
// biome-ignore lint/suspicious/noArrayIndexKey: Static loading placeholders never reorder.
|
|
4812
|
-
/* @__PURE__ */
|
|
5074
|
+
/* @__PURE__ */ jsx21("li", { children: /* @__PURE__ */ jsx21(KeepItemCardSkeleton, { layout: options.layout }) }, index)
|
|
4813
5075
|
)) })
|
|
4814
5076
|
] });
|
|
4815
5077
|
}
|
|
4816
5078
|
if (state.isHydrated && state.items.length === 0) {
|
|
4817
5079
|
if (options.empty !== void 0) return resolveContent(options.empty, state);
|
|
4818
|
-
return /* @__PURE__ */
|
|
5080
|
+
return /* @__PURE__ */ jsx21(
|
|
4819
5081
|
KeepEmptyState,
|
|
4820
5082
|
{
|
|
4821
5083
|
variant: options.allItemCount > 0 && hasActiveQueryFilters(options.query) ? "empty-filtered" : "empty-storage",
|
|
@@ -4826,7 +5088,7 @@ function getListBody(state, options) {
|
|
|
4826
5088
|
if (typeof options.children === "function") return options.children(state);
|
|
4827
5089
|
if (options.children !== void 0 && !isValidElement6(options.children)) return options.children;
|
|
4828
5090
|
if (options.reorderable) {
|
|
4829
|
-
return /* @__PURE__ */
|
|
5091
|
+
return /* @__PURE__ */ jsx21(
|
|
4830
5092
|
KeepReorderableList,
|
|
4831
5093
|
{
|
|
4832
5094
|
items: state.items,
|
|
@@ -4834,16 +5096,16 @@ function getListBody(state, options) {
|
|
|
4834
5096
|
await options.reorder(orderedIds);
|
|
4835
5097
|
await options.onReorder?.(orderedIds);
|
|
4836
5098
|
},
|
|
4837
|
-
renderItem: (item, reorderState) => /* @__PURE__ */
|
|
4838
|
-
/* @__PURE__ */
|
|
4839
|
-
options.renderItem ? options.renderItem(item, state) : /* @__PURE__ */
|
|
5099
|
+
renderItem: (item, reorderState) => /* @__PURE__ */ jsxs18(Fragment11, { children: [
|
|
5100
|
+
/* @__PURE__ */ jsx21("button", { type: "button", ...reorderState.dragHandleProps, children: "\u2195" }),
|
|
5101
|
+
options.renderItem ? options.renderItem(item, state) : /* @__PURE__ */ jsx21(KeepItemCard, { item, ...options.itemCardProps })
|
|
4840
5102
|
] }),
|
|
4841
5103
|
"data-layout": options.layout
|
|
4842
5104
|
}
|
|
4843
5105
|
);
|
|
4844
5106
|
}
|
|
4845
|
-
return /* @__PURE__ */
|
|
4846
|
-
(item) => options.renderItem ? options.renderItem(item, state) : /* @__PURE__ */
|
|
5107
|
+
return /* @__PURE__ */ jsx21("ul", { "data-layout": options.layout, children: state.items.map(
|
|
5108
|
+
(item) => options.renderItem ? options.renderItem(item, state) : /* @__PURE__ */ jsx21("li", { children: /* @__PURE__ */ jsx21(KeepItemCard, { item, ...options.itemCardProps }) }, item.id)
|
|
4847
5109
|
) });
|
|
4848
5110
|
}
|
|
4849
5111
|
function hasActiveQueryFilters(query) {
|
|
@@ -4854,12 +5116,12 @@ function hasActiveQueryFilters(query) {
|
|
|
4854
5116
|
}
|
|
4855
5117
|
|
|
4856
5118
|
// src/features/collection/KeepCollection.tsx
|
|
4857
|
-
import { Fragment as Fragment12, jsx as
|
|
5119
|
+
import { Fragment as Fragment12, jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4858
5120
|
function KeepCollection(props) {
|
|
4859
5121
|
const { fallback, onBoundaryError, boundaryResetKey, ...collectionProps } = props;
|
|
4860
|
-
const content = /* @__PURE__ */
|
|
5122
|
+
const content = /* @__PURE__ */ jsx22(KeepCollectionContent, { ...collectionProps });
|
|
4861
5123
|
if (fallback === void 0 && onBoundaryError === void 0) return content;
|
|
4862
|
-
return /* @__PURE__ */
|
|
5124
|
+
return /* @__PURE__ */ jsx22(KeepErrorBoundary2, { fallback, onError: onBoundaryError, resetKey: boundaryResetKey, children: content });
|
|
4863
5125
|
}
|
|
4864
5126
|
function KeepCollectionContent({
|
|
4865
5127
|
query = {},
|
|
@@ -4876,6 +5138,7 @@ function KeepCollectionContent({
|
|
|
4876
5138
|
features,
|
|
4877
5139
|
slots,
|
|
4878
5140
|
collectionLabels,
|
|
5141
|
+
creatable = false,
|
|
4879
5142
|
renderItem,
|
|
4880
5143
|
itemCardProps,
|
|
4881
5144
|
loading,
|
|
@@ -4888,7 +5151,7 @@ function KeepCollectionContent({
|
|
|
4888
5151
|
...rootProps
|
|
4889
5152
|
}) {
|
|
4890
5153
|
const view = useKeepCollection({ query, pageSize, urlSync, urlAdapter, features, archiveScope });
|
|
4891
|
-
const [reorderUndoIds, setReorderUndoIds] =
|
|
5154
|
+
const [reorderUndoIds, setReorderUndoIds] = useState15(null);
|
|
4892
5155
|
const reorderUndoLabel = useUiLabel("undoReorder");
|
|
4893
5156
|
const handleReorder = async (orderedIds) => {
|
|
4894
5157
|
const previousIds = view.list.items.map((item) => item.id);
|
|
@@ -4916,19 +5179,21 @@ function KeepCollectionContent({
|
|
|
4916
5179
|
...itemCardProps,
|
|
4917
5180
|
showTags: itemCardProps?.showTags ?? view.enabled.tags,
|
|
4918
5181
|
showPinButton: itemCardProps?.showPinButton ?? view.enabled.pin,
|
|
4919
|
-
showArchiveButton: itemCardProps?.showArchiveButton ?? view.enabled.archive
|
|
5182
|
+
showArchiveButton: itemCardProps?.showArchiveButton ?? view.enabled.archive,
|
|
5183
|
+
showEditButton: itemCardProps?.showEditButton ?? view.enabled.note,
|
|
5184
|
+
showNote: itemCardProps?.showNote ?? view.enabled.note
|
|
4920
5185
|
};
|
|
4921
|
-
const toolbarId =
|
|
4922
|
-
const structuredToolbar = toolbarLayout === "grouped" || toolbarVariant === "panel" || slots?.toolbarStart !== void 0 || slots?.toolbarEnd !== void 0;
|
|
5186
|
+
const toolbarId = useId4();
|
|
5187
|
+
const structuredToolbar = toolbarLayout === "grouped" || toolbarVariant === "panel" || creatable || slots?.toolbarStart !== void 0 || slots?.toolbarEnd !== void 0;
|
|
4923
5188
|
const hasQueryControls = view.enabled.search || view.enabled.sort;
|
|
4924
5189
|
const hasFilterControls = view.enabled.tagFilter || view.enabled.collectionFilter || archiveScope !== void 0;
|
|
4925
|
-
const queryControls = hasQueryControls ? /* @__PURE__ */
|
|
4926
|
-
view.enabled.search ? /* @__PURE__ */
|
|
4927
|
-
view.enabled.sort ? /* @__PURE__ */
|
|
5190
|
+
const queryControls = hasQueryControls ? /* @__PURE__ */ jsxs19(Fragment12, { children: [
|
|
5191
|
+
view.enabled.search ? /* @__PURE__ */ jsx22(KeepSearchInput, { value: view.searchValue, onValueChange: view.setSearchValue }) : null,
|
|
5192
|
+
view.enabled.sort ? /* @__PURE__ */ jsx22(KeepSortSelect, { value: view.sortValue, onValueChange: view.setSortValue }) : null
|
|
4928
5193
|
] }) : null;
|
|
4929
|
-
const filterControls = hasFilterControls ? /* @__PURE__ */
|
|
4930
|
-
view.enabled.tagFilter ? /* @__PURE__ */
|
|
4931
|
-
view.enabled.collectionFilter ? /* @__PURE__ */
|
|
5194
|
+
const filterControls = hasFilterControls ? /* @__PURE__ */ jsxs19(Fragment12, { children: [
|
|
5195
|
+
view.enabled.tagFilter ? /* @__PURE__ */ jsx22(KeepTagFilter, { query, value: view.activeTags[0], onValueChange: view.setTag }) : null,
|
|
5196
|
+
view.enabled.collectionFilter ? /* @__PURE__ */ jsx22(
|
|
4932
5197
|
KeepCollectionFilter,
|
|
4933
5198
|
{
|
|
4934
5199
|
value: view.activeCollection,
|
|
@@ -4936,7 +5201,7 @@ function KeepCollectionContent({
|
|
|
4936
5201
|
collectionLabels
|
|
4937
5202
|
}
|
|
4938
5203
|
) : null,
|
|
4939
|
-
archiveScope !== void 0 ? /* @__PURE__ */
|
|
5204
|
+
archiveScope !== void 0 ? /* @__PURE__ */ jsx22(
|
|
4940
5205
|
KeepArchiveScopeSelect,
|
|
4941
5206
|
{
|
|
4942
5207
|
value: view.archiveScope,
|
|
@@ -4952,12 +5217,13 @@ function KeepCollectionContent({
|
|
|
4952
5217
|
const toolbarFiltersLabel = useUiLabel("toolbarFilters");
|
|
4953
5218
|
const toolbarEndLabel = useUiLabel("toolbarEnd");
|
|
4954
5219
|
const toolbarStartContent = slots?.toolbarStart === void 0 ? null : resolveContent(slots.toolbarStart, view.list);
|
|
4955
|
-
const
|
|
5220
|
+
const creatableContent = creatable ? /* @__PURE__ */ jsx22(KeepCollectionCreate, {}) : null;
|
|
5221
|
+
const toolbarEndContent = creatableContent ?? (slots?.toolbarEnd === void 0 ? null : resolveContent(slots.toolbarEnd, view.list));
|
|
4956
5222
|
const hasToolbarContent = hasQueryControls || hasFilterControls || hasRenderableContent(toolbarStartContent) || hasRenderableContent(toolbarEndContent);
|
|
4957
5223
|
const renderToolbarGroup = (group, content, label) => {
|
|
4958
5224
|
if (!hasRenderableContent(content)) return null;
|
|
4959
5225
|
const labelId = `${toolbarId}-${group}`;
|
|
4960
|
-
return /* @__PURE__ */
|
|
5226
|
+
return /* @__PURE__ */ jsxs19(
|
|
4961
5227
|
"fieldset",
|
|
4962
5228
|
{
|
|
4963
5229
|
"data-keepkit": "collection-toolbar-group",
|
|
@@ -4965,22 +5231,22 @@ function KeepCollectionContent({
|
|
|
4965
5231
|
role: "group",
|
|
4966
5232
|
"aria-labelledby": labelId,
|
|
4967
5233
|
children: [
|
|
4968
|
-
/* @__PURE__ */
|
|
4969
|
-
/* @__PURE__ */
|
|
5234
|
+
/* @__PURE__ */ jsx22("legend", { id: labelId, "data-keepkit": "collection-toolbar-label", children: label }),
|
|
5235
|
+
/* @__PURE__ */ jsx22("div", { "data-keepkit": "collection-toolbar-content", children: content })
|
|
4970
5236
|
]
|
|
4971
5237
|
}
|
|
4972
5238
|
);
|
|
4973
5239
|
};
|
|
4974
|
-
const toolbar = !structuredToolbar ? /* @__PURE__ */
|
|
5240
|
+
const toolbar = !structuredToolbar ? /* @__PURE__ */ jsxs19("div", { children: [
|
|
4975
5241
|
queryControls,
|
|
4976
5242
|
filterControls
|
|
4977
|
-
] }) : !hasToolbarContent ? null : /* @__PURE__ */
|
|
5243
|
+
] }) : !hasToolbarContent ? null : /* @__PURE__ */ jsxs19("div", { "data-keepkit": "collection-toolbar", "data-variant": toolbarVariant, "data-layout": toolbarLayout, children: [
|
|
4978
5244
|
renderToolbarGroup("toolbarStart", toolbarStartContent, toolbarStartLabel),
|
|
4979
5245
|
renderToolbarGroup("query", queryControls, toolbarQueryLabel),
|
|
4980
5246
|
renderToolbarGroup("filters", filterControls, toolbarFiltersLabel),
|
|
4981
5247
|
renderToolbarGroup("toolbarEnd", toolbarEndContent, toolbarEndLabel)
|
|
4982
5248
|
] });
|
|
4983
|
-
return /* @__PURE__ */
|
|
5249
|
+
return /* @__PURE__ */ jsxs19(
|
|
4984
5250
|
"section",
|
|
4985
5251
|
{
|
|
4986
5252
|
...rootProps,
|
|
@@ -4994,7 +5260,7 @@ function KeepCollectionContent({
|
|
|
4994
5260
|
"data-loading": view.list.isLoading || view.list.isMutating ? "true" : void 0,
|
|
4995
5261
|
children: [
|
|
4996
5262
|
toolbar,
|
|
4997
|
-
activeFilters === void 0 ? /* @__PURE__ */
|
|
5263
|
+
activeFilters === void 0 ? /* @__PURE__ */ jsx22(
|
|
4998
5264
|
KeepActiveFiltersSummary,
|
|
4999
5265
|
{
|
|
5000
5266
|
search: view.searchValue,
|
|
@@ -5004,7 +5270,7 @@ function KeepCollectionContent({
|
|
|
5004
5270
|
onClear: view.clearFilters
|
|
5005
5271
|
}
|
|
5006
5272
|
) : resolveContent(activeFilters, view.list),
|
|
5007
|
-
/* @__PURE__ */
|
|
5273
|
+
/* @__PURE__ */ jsx22(
|
|
5008
5274
|
KeepList,
|
|
5009
5275
|
{
|
|
5010
5276
|
query: view.resolvedQuery,
|
|
@@ -5021,7 +5287,7 @@ function KeepCollectionContent({
|
|
|
5021
5287
|
error
|
|
5022
5288
|
}
|
|
5023
5289
|
),
|
|
5024
|
-
view.enabled.pagination ? /* @__PURE__ */
|
|
5290
|
+
view.enabled.pagination ? /* @__PURE__ */ jsx22(
|
|
5025
5291
|
KeepPagination,
|
|
5026
5292
|
{
|
|
5027
5293
|
totalCount: view.list.totalCount,
|
|
@@ -5030,8 +5296,8 @@ function KeepCollectionContent({
|
|
|
5030
5296
|
onPageChange: view.setPage
|
|
5031
5297
|
}
|
|
5032
5298
|
) : null,
|
|
5033
|
-
view.enabled.bulkActions ? /* @__PURE__ */
|
|
5034
|
-
reorderable && reorderUndoIds ? /* @__PURE__ */
|
|
5299
|
+
view.enabled.bulkActions ? /* @__PURE__ */ jsx22(KeepBulkActions, { query: view.resolvedQuery }) : null,
|
|
5300
|
+
reorderable && reorderUndoIds ? /* @__PURE__ */ jsx22("div", { "data-keepkit": "reorder-feedback", role: "status", "aria-live": "polite", children: /* @__PURE__ */ jsx22("button", { type: "button", "data-keep-action": "undo-reorder", onClick: () => void undoReorder(), children: reorderUndoLabel }) }) : null
|
|
5035
5301
|
]
|
|
5036
5302
|
}
|
|
5037
5303
|
);
|
|
@@ -5044,12 +5310,12 @@ function getCollectionState(list) {
|
|
|
5044
5310
|
}
|
|
5045
5311
|
|
|
5046
5312
|
// src/features/collection/KeepLayout.tsx
|
|
5047
|
-
import { jsx as
|
|
5313
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
5048
5314
|
function KeepLayout({ layout = "list", children, onKeyDown, onFocusCapture, ...props }) {
|
|
5049
5315
|
const roving = useRovingTabIndex();
|
|
5050
5316
|
return (
|
|
5051
5317
|
// biome-ignore lint/a11y/noStaticElementInteractions: The group manages keyboard focus for descendant cards.
|
|
5052
|
-
/* @__PURE__ */
|
|
5318
|
+
/* @__PURE__ */ jsx23(
|
|
5053
5319
|
"div",
|
|
5054
5320
|
{
|
|
5055
5321
|
...props,
|
|
@@ -5076,7 +5342,7 @@ function KeepLayout({ layout = "list", children, onKeyDown, onFocusCapture, ...p
|
|
|
5076
5342
|
import { isValidElement as isValidElement7 } from "react";
|
|
5077
5343
|
|
|
5078
5344
|
// src/features/navigation/KeepShortcutHint.tsx
|
|
5079
|
-
import { jsx as
|
|
5345
|
+
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5080
5346
|
function KeepShortcutHint({ shortcut, separator = "+", ...props }) {
|
|
5081
5347
|
const keys = typeof shortcut === "string" ? shortcut.split("+") : [...shortcut];
|
|
5082
5348
|
const occurrences = /* @__PURE__ */ new Map();
|
|
@@ -5085,19 +5351,19 @@ function KeepShortcutHint({ shortcut, separator = "+", ...props }) {
|
|
|
5085
5351
|
occurrences.set(key, occurrence + 1);
|
|
5086
5352
|
return { id: `${key}-${occurrence}`, value: key };
|
|
5087
5353
|
});
|
|
5088
|
-
return /* @__PURE__ */
|
|
5089
|
-
index > 0 ? /* @__PURE__ */
|
|
5090
|
-
/* @__PURE__ */
|
|
5354
|
+
return /* @__PURE__ */ jsx24("span", { ...props, "data-keepkit": "shortcut-hint", "aria-hidden": props["aria-hidden"] ?? true, children: keyedKeys.map((key, index) => /* @__PURE__ */ jsxs20("span", { children: [
|
|
5355
|
+
index > 0 ? /* @__PURE__ */ jsx24("span", { "data-shortcut-separator": "true", children: separator }) : null,
|
|
5356
|
+
/* @__PURE__ */ jsx24("kbd", { children: key.value.trim() })
|
|
5091
5357
|
] }, key.id)) });
|
|
5092
5358
|
}
|
|
5093
5359
|
|
|
5094
5360
|
// src/features/editor/hooks/useKeepNoteEditor.ts
|
|
5095
5361
|
import { useKeepItem as useKeepItem6 } from "@keepkit/core/react";
|
|
5096
|
-
import { useCallback as useCallback6, useEffect as useEffect11, useRef as useRef9, useState as
|
|
5362
|
+
import { useCallback as useCallback6, useEffect as useEffect11, useRef as useRef9, useState as useState16 } from "react";
|
|
5097
5363
|
function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
5098
5364
|
const itemState = useKeepItem6(item);
|
|
5099
5365
|
const { error, isMutating, item: savedItem, updateNote } = itemState;
|
|
5100
|
-
const [note, setNote] =
|
|
5366
|
+
const [note, setNote] = useState16(item.note ?? "");
|
|
5101
5367
|
const baselineNote = savedItem?.note ?? item.note ?? "";
|
|
5102
5368
|
const isDirty = note !== baselineNote;
|
|
5103
5369
|
const lastSavedNoteRef = useRef9(void 0);
|
|
@@ -5148,7 +5414,7 @@ function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
|
5148
5414
|
}
|
|
5149
5415
|
|
|
5150
5416
|
// src/features/editor/KeepNoteEditor.tsx
|
|
5151
|
-
import { Fragment as Fragment13, jsx as
|
|
5417
|
+
import { Fragment as Fragment13, jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5152
5418
|
function KeepNoteEditor({
|
|
5153
5419
|
item,
|
|
5154
5420
|
label,
|
|
@@ -5165,15 +5431,20 @@ function KeepNoteEditor({
|
|
|
5165
5431
|
...formProps
|
|
5166
5432
|
}) {
|
|
5167
5433
|
const view = useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError });
|
|
5434
|
+
const showNoteLabel = useUiLabelVisibility("note");
|
|
5435
|
+
const noteAccessibleLabel = useUiLabel("note");
|
|
5436
|
+
const showSaveLabel = useUiLabelVisibility("saveNote");
|
|
5437
|
+
const saveAccessibleLabel = useUiLabel("saveNote");
|
|
5168
5438
|
const { error, isDirty, isSaving, note, setNote } = view.state;
|
|
5169
5439
|
const contentChildren = asChild && isValidElement7(children) ? void 0 : children;
|
|
5170
|
-
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */
|
|
5171
|
-
/* @__PURE__ */
|
|
5172
|
-
label ?? view.labels.note,
|
|
5173
|
-
/* @__PURE__ */
|
|
5440
|
+
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */ jsxs21(Fragment13, { children: [
|
|
5441
|
+
/* @__PURE__ */ jsxs21("label", { children: [
|
|
5442
|
+
showNoteLabel ? label ?? view.labels.note : null,
|
|
5443
|
+
/* @__PURE__ */ jsx25(
|
|
5174
5444
|
"textarea",
|
|
5175
5445
|
{
|
|
5176
5446
|
"data-keep-action": "edit-note",
|
|
5447
|
+
"aria-label": showNoteLabel ? void 0 : noteAccessibleLabel,
|
|
5177
5448
|
value: note,
|
|
5178
5449
|
onChange: (event) => setNote(event.currentTarget.value),
|
|
5179
5450
|
placeholder,
|
|
@@ -5182,13 +5453,23 @@ function KeepNoteEditor({
|
|
|
5182
5453
|
}
|
|
5183
5454
|
)
|
|
5184
5455
|
] }),
|
|
5185
|
-
/* @__PURE__ */
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5456
|
+
/* @__PURE__ */ jsxs21(
|
|
5457
|
+
"button",
|
|
5458
|
+
{
|
|
5459
|
+
type: "submit",
|
|
5460
|
+
"data-keep-action": "save-note",
|
|
5461
|
+
disabled: isSaving,
|
|
5462
|
+
"aria-busy": isSaving,
|
|
5463
|
+
"aria-label": showSaveLabel ? void 0 : saveAccessibleLabel,
|
|
5464
|
+
children: [
|
|
5465
|
+
showSaveLabel ? saveLabel ?? view.labels.save : null,
|
|
5466
|
+
showShortcutHint ? /* @__PURE__ */ jsx25(KeepShortcutHint, { shortcut: "Ctrl+Enter" }) : null
|
|
5467
|
+
]
|
|
5468
|
+
}
|
|
5469
|
+
)
|
|
5189
5470
|
] });
|
|
5190
5471
|
if (!asChild) {
|
|
5191
|
-
return /* @__PURE__ */
|
|
5472
|
+
return /* @__PURE__ */ jsxs21(
|
|
5192
5473
|
"form",
|
|
5193
5474
|
{
|
|
5194
5475
|
...formProps,
|
|
@@ -5201,7 +5482,7 @@ function KeepNoteEditor({
|
|
|
5201
5482
|
"data-disabled": isSaving ? "true" : void 0,
|
|
5202
5483
|
children: [
|
|
5203
5484
|
body,
|
|
5204
|
-
error ? /* @__PURE__ */
|
|
5485
|
+
error ? /* @__PURE__ */ jsx25("p", { role: "alert", children: getErrorMessage4(error, view.labels.error) }) : null
|
|
5205
5486
|
]
|
|
5206
5487
|
}
|
|
5207
5488
|
);
|
|
@@ -5229,11 +5510,11 @@ function getErrorMessage4(error, fallback) {
|
|
|
5229
5510
|
|
|
5230
5511
|
// src/features/editor/hooks/useKeepTagEditor.ts
|
|
5231
5512
|
import { useKeepItem as useKeepItem7 } from "@keepkit/core/react";
|
|
5232
|
-
import { useCallback as useCallback7, useEffect as useEffect12, useState as
|
|
5513
|
+
import { useCallback as useCallback7, useEffect as useEffect12, useState as useState17 } from "react";
|
|
5233
5514
|
function useKeepTagEditor({ item, onSaved, onSaveError }) {
|
|
5234
5515
|
const itemState = useKeepItem7(item);
|
|
5235
|
-
const [tags, setTags] =
|
|
5236
|
-
const [input, setInput] =
|
|
5516
|
+
const [tags, setTags] = useState17(item.tags ?? []);
|
|
5517
|
+
const [input, setInput] = useState17("");
|
|
5237
5518
|
useEffect12(() => setTags(itemState.item?.tags ?? item.tags ?? []), [item.tags, itemState.item?.tags]);
|
|
5238
5519
|
const save = useCallback7(async () => {
|
|
5239
5520
|
const nextTags = normalizeUiTags(tags);
|
|
@@ -5281,7 +5562,7 @@ function useKeepTagEditor({ item, onSaved, onSaveError }) {
|
|
|
5281
5562
|
}
|
|
5282
5563
|
|
|
5283
5564
|
// src/features/editor/KeepTagEditor.tsx
|
|
5284
|
-
import { Fragment as Fragment14, jsx as
|
|
5565
|
+
import { Fragment as Fragment14, jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5285
5566
|
function KeepTagEditor({
|
|
5286
5567
|
item,
|
|
5287
5568
|
availableTags = [],
|
|
@@ -5291,14 +5572,19 @@ function KeepTagEditor({
|
|
|
5291
5572
|
...props
|
|
5292
5573
|
}) {
|
|
5293
5574
|
const view = useKeepTagEditor({ item, onSaved, onSaveError });
|
|
5575
|
+
const showTagsLabel = useUiLabelVisibility("tags");
|
|
5576
|
+
const tagsAccessibleLabel = useUiLabel("tags");
|
|
5577
|
+
const showRemoveLabel = useUiLabelVisibility("remove");
|
|
5578
|
+
const showApplyLabel = useUiLabelVisibility("applyTags");
|
|
5294
5579
|
const { isSaving, tags } = view.state;
|
|
5295
|
-
const body = render ? render(view.state) : /* @__PURE__ */
|
|
5296
|
-
/* @__PURE__ */
|
|
5297
|
-
view.labels.tags,
|
|
5298
|
-
/* @__PURE__ */
|
|
5580
|
+
const body = render ? render(view.state) : /* @__PURE__ */ jsxs22(Fragment14, { children: [
|
|
5581
|
+
/* @__PURE__ */ jsxs22("label", { children: [
|
|
5582
|
+
showTagsLabel ? view.labels.tags : null,
|
|
5583
|
+
/* @__PURE__ */ jsx26(
|
|
5299
5584
|
"input",
|
|
5300
5585
|
{
|
|
5301
5586
|
"data-keep-action": "edit-tags",
|
|
5587
|
+
"aria-label": showTagsLabel ? void 0 : tagsAccessibleLabel,
|
|
5302
5588
|
value: view.input,
|
|
5303
5589
|
list: availableTags.length > 0 ? `keep-tags-${item.id}` : void 0,
|
|
5304
5590
|
onChange: (event) => view.setInput(event.currentTarget.value),
|
|
@@ -5306,14 +5592,33 @@ function KeepTagEditor({
|
|
|
5306
5592
|
}
|
|
5307
5593
|
)
|
|
5308
5594
|
] }),
|
|
5309
|
-
availableTags.length > 0 ? /* @__PURE__ */
|
|
5310
|
-
/* @__PURE__ */
|
|
5595
|
+
availableTags.length > 0 ? /* @__PURE__ */ jsx26("datalist", { id: `keep-tags-${item.id}`, children: availableTags.map((tag) => /* @__PURE__ */ jsx26("option", { value: tag }, tag)) }) : null,
|
|
5596
|
+
/* @__PURE__ */ jsx26("ul", { "aria-label": view.labels.tags, children: tags.map((tag) => /* @__PURE__ */ jsxs22("li", { children: [
|
|
5311
5597
|
tag,
|
|
5312
|
-
/* @__PURE__ */
|
|
5598
|
+
/* @__PURE__ */ jsx26(
|
|
5599
|
+
"button",
|
|
5600
|
+
{
|
|
5601
|
+
type: "button",
|
|
5602
|
+
"data-keep-action": "remove-tag",
|
|
5603
|
+
"aria-label": showRemoveLabel ? void 0 : view.labels.remove,
|
|
5604
|
+
onClick: () => view.removeTag(tag),
|
|
5605
|
+
children: showRemoveLabel ? view.labels.remove : null
|
|
5606
|
+
}
|
|
5607
|
+
)
|
|
5313
5608
|
] }, tag)) }),
|
|
5314
|
-
/* @__PURE__ */
|
|
5609
|
+
/* @__PURE__ */ jsx26(
|
|
5610
|
+
"button",
|
|
5611
|
+
{
|
|
5612
|
+
type: "submit",
|
|
5613
|
+
"data-keep-action": "apply-tags",
|
|
5614
|
+
disabled: isSaving,
|
|
5615
|
+
"aria-busy": isSaving,
|
|
5616
|
+
"aria-label": showApplyLabel ? void 0 : view.labels.apply,
|
|
5617
|
+
children: showApplyLabel ? view.labels.apply : null
|
|
5618
|
+
}
|
|
5619
|
+
)
|
|
5315
5620
|
] });
|
|
5316
|
-
return /* @__PURE__ */
|
|
5621
|
+
return /* @__PURE__ */ jsxs22(
|
|
5317
5622
|
"form",
|
|
5318
5623
|
{
|
|
5319
5624
|
...props,
|
|
@@ -5325,7 +5630,7 @@ function KeepTagEditor({
|
|
|
5325
5630
|
"data-disabled": isSaving ? "true" : void 0,
|
|
5326
5631
|
children: [
|
|
5327
5632
|
body,
|
|
5328
|
-
view.error ? /* @__PURE__ */
|
|
5633
|
+
view.error ? /* @__PURE__ */ jsx26("p", { role: "alert", children: getErrorMessage5(view.error, view.labels.error) }) : null
|
|
5329
5634
|
]
|
|
5330
5635
|
}
|
|
5331
5636
|
);
|
|
@@ -5356,7 +5661,7 @@ function useKeepToastFeedback(showToast) {
|
|
|
5356
5661
|
|
|
5357
5662
|
// src/features/navigation/KeepTourBar.tsx
|
|
5358
5663
|
import { useKeepNavigator } from "@keepkit/core/react";
|
|
5359
|
-
import { useId as
|
|
5664
|
+
import { useId as useId5 } from "react";
|
|
5360
5665
|
|
|
5361
5666
|
// src/features/navigation/hooks/useKeepTourShortcuts.ts
|
|
5362
5667
|
import { useEffect as useEffect13 } from "react";
|
|
@@ -5391,7 +5696,7 @@ function isEditableTarget(target) {
|
|
|
5391
5696
|
}
|
|
5392
5697
|
|
|
5393
5698
|
// src/features/navigation/KeepTourBar.tsx
|
|
5394
|
-
import { Fragment as Fragment15, jsx as
|
|
5699
|
+
import { Fragment as Fragment15, jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5395
5700
|
function KeepTourBar({
|
|
5396
5701
|
navigation: providedNavigation,
|
|
5397
5702
|
currentId,
|
|
@@ -5461,9 +5766,9 @@ function KeepTourBar({
|
|
|
5461
5766
|
return resolvedPrev();
|
|
5462
5767
|
}
|
|
5463
5768
|
});
|
|
5464
|
-
const body = /* @__PURE__ */
|
|
5465
|
-
showProgress ? /* @__PURE__ */
|
|
5466
|
-
/* @__PURE__ */
|
|
5769
|
+
const body = /* @__PURE__ */ jsxs23(Fragment15, { children: [
|
|
5770
|
+
showProgress ? /* @__PURE__ */ jsx27("span", { "data-keepkit": "tour-progress", "aria-live": "polite", children: progress ?? `${navigation.currentPosition ?? 0} / ${navigation.items.length}` }) : null,
|
|
5771
|
+
/* @__PURE__ */ jsx27(
|
|
5467
5772
|
TourAction,
|
|
5468
5773
|
{
|
|
5469
5774
|
href: resolvedPrevHref,
|
|
@@ -5471,7 +5776,7 @@ function KeepTourBar({
|
|
|
5471
5776
|
onClick: resolvedPrevHref ? notifyPrevNavigation : resolvedPrev,
|
|
5472
5777
|
"data-keep-action": "tour-prev",
|
|
5473
5778
|
shortcut: showShortcutHint ? shortcutOptions?.prevKeys?.[0] ?? "K" : void 0,
|
|
5474
|
-
preview: navigation.prevItem ? /* @__PURE__ */
|
|
5779
|
+
preview: navigation.prevItem ? /* @__PURE__ */ jsxs23(Fragment15, { children: [
|
|
5475
5780
|
previousLabel,
|
|
5476
5781
|
": ",
|
|
5477
5782
|
getItemTitle(navigation.prevItem)
|
|
@@ -5479,7 +5784,7 @@ function KeepTourBar({
|
|
|
5479
5784
|
children: previousLabel
|
|
5480
5785
|
}
|
|
5481
5786
|
),
|
|
5482
|
-
/* @__PURE__ */
|
|
5787
|
+
/* @__PURE__ */ jsx27(
|
|
5483
5788
|
TourAction,
|
|
5484
5789
|
{
|
|
5485
5790
|
href: resolvedNextHref,
|
|
@@ -5487,7 +5792,7 @@ function KeepTourBar({
|
|
|
5487
5792
|
onClick: resolvedNextHref ? notifyNextNavigation : resolvedNext,
|
|
5488
5793
|
"data-keep-action": "tour-next",
|
|
5489
5794
|
shortcut: showShortcutHint ? shortcutOptions?.nextKeys?.[0] ?? "J" : void 0,
|
|
5490
|
-
preview: navigation.nextItem ? /* @__PURE__ */
|
|
5795
|
+
preview: navigation.nextItem ? /* @__PURE__ */ jsxs23(Fragment15, { children: [
|
|
5491
5796
|
nextItemLabel,
|
|
5492
5797
|
": ",
|
|
5493
5798
|
getItemTitle(navigation.nextItem)
|
|
@@ -5495,7 +5800,7 @@ function KeepTourBar({
|
|
|
5495
5800
|
children: nextItemLabel
|
|
5496
5801
|
}
|
|
5497
5802
|
),
|
|
5498
|
-
resolvedBackHref || onBack ? /* @__PURE__ */
|
|
5803
|
+
resolvedBackHref || onBack ? /* @__PURE__ */ jsx27(TourAction, { href: resolvedBackHref, onClick: onBack, "data-keep-action": "tour-back", children: listLabel }) : null
|
|
5499
5804
|
] });
|
|
5500
5805
|
return renderRoot(
|
|
5501
5806
|
asChild,
|
|
@@ -5506,14 +5811,14 @@ function KeepTourBar({
|
|
|
5506
5811
|
);
|
|
5507
5812
|
}
|
|
5508
5813
|
function TourAction({ href, disabled = false, onClick, children, preview, shortcut, ...props }) {
|
|
5509
|
-
const previewId =
|
|
5510
|
-
const content = /* @__PURE__ */
|
|
5511
|
-
/* @__PURE__ */
|
|
5512
|
-
shortcut ? /* @__PURE__ */
|
|
5513
|
-
preview ? /* @__PURE__ */
|
|
5814
|
+
const previewId = useId5();
|
|
5815
|
+
const content = /* @__PURE__ */ jsxs23(Fragment15, { children: [
|
|
5816
|
+
/* @__PURE__ */ jsx27("span", { "data-tour-label": "true", children }),
|
|
5817
|
+
shortcut ? /* @__PURE__ */ jsx27(KeepShortcutHint, { shortcut }) : null,
|
|
5818
|
+
preview ? /* @__PURE__ */ jsx27("small", { id: previewId, "data-tour-preview": "true", children: preview }) : null
|
|
5514
5819
|
] });
|
|
5515
5820
|
if (href && !disabled) {
|
|
5516
|
-
return /* @__PURE__ */
|
|
5821
|
+
return /* @__PURE__ */ jsx27(
|
|
5517
5822
|
"a",
|
|
5518
5823
|
{
|
|
5519
5824
|
...props,
|
|
@@ -5525,7 +5830,7 @@ function TourAction({ href, disabled = false, onClick, children, preview, shortc
|
|
|
5525
5830
|
}
|
|
5526
5831
|
);
|
|
5527
5832
|
}
|
|
5528
|
-
return /* @__PURE__ */
|
|
5833
|
+
return /* @__PURE__ */ jsx27(
|
|
5529
5834
|
"button",
|
|
5530
5835
|
{
|
|
5531
5836
|
...props,
|
|
@@ -5548,10 +5853,10 @@ function navigateTo(item, href) {
|
|
|
5548
5853
|
import { isValidElement as isValidElement8 } from "react";
|
|
5549
5854
|
|
|
5550
5855
|
// src/features/status/hooks/useStatusViews.ts
|
|
5551
|
-
import { useKeepContext as
|
|
5552
|
-
import { useEffect as useEffect14, useRef as useRef10, useState as
|
|
5856
|
+
import { useKeepContext as useKeepContext6 } from "@keepkit/core/react";
|
|
5857
|
+
import { useEffect as useEffect14, useRef as useRef10, useState as useState18 } from "react";
|
|
5553
5858
|
function useKeepStatus(status) {
|
|
5554
|
-
const context =
|
|
5859
|
+
const context = useKeepContext6();
|
|
5555
5860
|
const resolvedStatus = status ?? getDerivedStatus(context);
|
|
5556
5861
|
const state = {
|
|
5557
5862
|
status: resolvedStatus,
|
|
@@ -5562,11 +5867,11 @@ function useKeepStatus(status) {
|
|
|
5562
5867
|
return { state, defaultLabel: useUiLabel(getStatusLabelKey3(resolvedStatus)) };
|
|
5563
5868
|
}
|
|
5564
5869
|
function useKeepAnnouncements(messages) {
|
|
5565
|
-
const context =
|
|
5870
|
+
const context = useKeepContext6();
|
|
5566
5871
|
const savedMessage = useUiLabel("savedMessage", messages?.save);
|
|
5567
5872
|
const removedMessage = useUiLabel("removedMessage", messages?.remove);
|
|
5568
5873
|
const noteSavedMessage = useUiLabel("noteSavedMessage", messages?.note);
|
|
5569
|
-
const [message, setMessage] =
|
|
5874
|
+
const [message, setMessage] = useState18("");
|
|
5570
5875
|
const lastChangeRef = useRef10(void 0);
|
|
5571
5876
|
useEffect14(() => {
|
|
5572
5877
|
const change = context.lastChange;
|
|
@@ -5596,7 +5901,7 @@ function getStatusLabelKey3(status) {
|
|
|
5596
5901
|
}
|
|
5597
5902
|
|
|
5598
5903
|
// src/features/status/status.tsx
|
|
5599
|
-
import { jsx as
|
|
5904
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
5600
5905
|
function KeepStatus({
|
|
5601
5906
|
status,
|
|
5602
5907
|
labels,
|
|
@@ -5628,7 +5933,7 @@ function KeepStatus({
|
|
|
5628
5933
|
}
|
|
5629
5934
|
function KeepAnnouncements({ messages, ...props }) {
|
|
5630
5935
|
const message = useKeepAnnouncements(messages);
|
|
5631
|
-
return /* @__PURE__ */
|
|
5936
|
+
return /* @__PURE__ */ jsx28(
|
|
5632
5937
|
"div",
|
|
5633
5938
|
{
|
|
5634
5939
|
...props,
|
|
@@ -5644,10 +5949,10 @@ function KeepAnnouncements({ messages, ...props }) {
|
|
|
5644
5949
|
var KeepAnnouncer = KeepAnnouncements;
|
|
5645
5950
|
|
|
5646
5951
|
// src/features/sync/hooks/useKeepSyncFeedback.ts
|
|
5647
|
-
import { useKeepContext as
|
|
5952
|
+
import { useKeepContext as useKeepContext7 } from "@keepkit/core/react";
|
|
5648
5953
|
import { useEffect as useEffect15, useRef as useRef11 } from "react";
|
|
5649
5954
|
function useKeepSyncFeedback() {
|
|
5650
|
-
const { syncState } =
|
|
5955
|
+
const { syncState } = useKeepContext7();
|
|
5651
5956
|
const emitFeedback = useKeepUiFeedback();
|
|
5652
5957
|
const completedMessage = useUiLabel("syncSynced");
|
|
5653
5958
|
const failedMessage = useUiLabel("syncFailedMessage");
|
|
@@ -5672,16 +5977,16 @@ function KeepSyncFeedbackObserver() {
|
|
|
5672
5977
|
}
|
|
5673
5978
|
|
|
5674
5979
|
// src/features/sync/hooks/useKeepSyncRecoveryDialog.ts
|
|
5675
|
-
import { useKeepContext as
|
|
5676
|
-
import { useEffect as useEffect16, useState as
|
|
5980
|
+
import { useKeepContext as useKeepContext8 } from "@keepkit/core/react";
|
|
5981
|
+
import { useEffect as useEffect16, useState as useState19 } from "react";
|
|
5677
5982
|
function useKeepSyncRecoveryDialog(options) {
|
|
5678
5983
|
const { open, onOpenChange, conflicts, onManualMerge } = options;
|
|
5679
|
-
const context =
|
|
5984
|
+
const context = useKeepContext8();
|
|
5680
5985
|
const conflictList = conflicts ?? context.syncState.conflicts ?? [];
|
|
5681
5986
|
const hasRecovery = conflictList.length > 0 || context.syncState.status === "error" || Boolean(context.error);
|
|
5682
|
-
const [dismissed, setDismissed] =
|
|
5683
|
-
const [busyId, setBusyId] =
|
|
5684
|
-
const [error, setError] =
|
|
5987
|
+
const [dismissed, setDismissed] = useState19(false);
|
|
5988
|
+
const [busyId, setBusyId] = useState19();
|
|
5989
|
+
const [error, setError] = useState19();
|
|
5685
5990
|
useEffect16(() => {
|
|
5686
5991
|
if (hasRecovery) setDismissed(false);
|
|
5687
5992
|
}, [hasRecovery]);
|
|
@@ -5727,7 +6032,7 @@ function useKeepSyncRecoveryDialog(options) {
|
|
|
5727
6032
|
}
|
|
5728
6033
|
|
|
5729
6034
|
// src/features/sync/KeepSyncRecoveryDialog.tsx
|
|
5730
|
-
import { jsx as
|
|
6035
|
+
import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5731
6036
|
function KeepSyncRecoveryDialog({
|
|
5732
6037
|
open,
|
|
5733
6038
|
onOpenChange,
|
|
@@ -5742,7 +6047,7 @@ function KeepSyncRecoveryDialog({
|
|
|
5742
6047
|
}) {
|
|
5743
6048
|
const view = useKeepSyncRecoveryDialog({ open, onOpenChange, conflicts, onManualMerge });
|
|
5744
6049
|
if (!view.isOpen) return null;
|
|
5745
|
-
return /* @__PURE__ */
|
|
6050
|
+
return /* @__PURE__ */ jsxs24(
|
|
5746
6051
|
"section",
|
|
5747
6052
|
{
|
|
5748
6053
|
...props,
|
|
@@ -5756,17 +6061,17 @@ function KeepSyncRecoveryDialog({
|
|
|
5756
6061
|
"data-state": view.conflictList.length > 0 ? "conflict" : "error",
|
|
5757
6062
|
"data-loading": view.busyId !== void 0 ? "true" : void 0,
|
|
5758
6063
|
children: [
|
|
5759
|
-
/* @__PURE__ */
|
|
5760
|
-
/* @__PURE__ */
|
|
5761
|
-
/* @__PURE__ */
|
|
6064
|
+
/* @__PURE__ */ jsxs24("header", { children: [
|
|
6065
|
+
/* @__PURE__ */ jsx29("h2", { id: "keepkit-sync-recovery-title", children: title ?? view.labels.title }),
|
|
6066
|
+
/* @__PURE__ */ jsx29("button", { type: "button", "data-keep-action": "close-dialog", onClick: view.close, "aria-label": view.labels.close, children: view.labels.close })
|
|
5762
6067
|
] }),
|
|
5763
6068
|
children,
|
|
5764
|
-
view.conflictList.length > 0 ? /* @__PURE__ */
|
|
5765
|
-
/* @__PURE__ */
|
|
5766
|
-
view.conflictList.map((conflict) => /* @__PURE__ */
|
|
5767
|
-
/* @__PURE__ */
|
|
5768
|
-
/* @__PURE__ */
|
|
5769
|
-
/* @__PURE__ */
|
|
6069
|
+
view.conflictList.length > 0 ? /* @__PURE__ */ jsxs24("div", { children: [
|
|
6070
|
+
/* @__PURE__ */ jsx29("p", { children: view.labels.conflict }),
|
|
6071
|
+
view.conflictList.map((conflict) => /* @__PURE__ */ jsxs24("article", { "data-conflict-id": conflict.id, children: [
|
|
6072
|
+
/* @__PURE__ */ jsx29("h3", { children: getMetaTitle(conflict.operation.item?.meta) ?? conflict.id }),
|
|
6073
|
+
/* @__PURE__ */ jsxs24("div", { "data-conflict-preview": true, children: [
|
|
6074
|
+
/* @__PURE__ */ jsx29(
|
|
5770
6075
|
ConflictPreview,
|
|
5771
6076
|
{
|
|
5772
6077
|
item: conflict.operation.item,
|
|
@@ -5776,7 +6081,7 @@ function KeepSyncRecoveryDialog({
|
|
|
5776
6081
|
side: "local"
|
|
5777
6082
|
}
|
|
5778
6083
|
),
|
|
5779
|
-
/* @__PURE__ */
|
|
6084
|
+
/* @__PURE__ */ jsx29(
|
|
5780
6085
|
ConflictPreview,
|
|
5781
6086
|
{
|
|
5782
6087
|
item: conflict.remote,
|
|
@@ -5787,8 +6092,8 @@ function KeepSyncRecoveryDialog({
|
|
|
5787
6092
|
}
|
|
5788
6093
|
)
|
|
5789
6094
|
] }),
|
|
5790
|
-
/* @__PURE__ */
|
|
5791
|
-
/* @__PURE__ */
|
|
6095
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
6096
|
+
/* @__PURE__ */ jsx29(
|
|
5792
6097
|
"button",
|
|
5793
6098
|
{
|
|
5794
6099
|
type: "button",
|
|
@@ -5798,7 +6103,7 @@ function KeepSyncRecoveryDialog({
|
|
|
5798
6103
|
children: view.labels.keepLocal
|
|
5799
6104
|
}
|
|
5800
6105
|
),
|
|
5801
|
-
/* @__PURE__ */
|
|
6106
|
+
/* @__PURE__ */ jsx29(
|
|
5802
6107
|
"button",
|
|
5803
6108
|
{
|
|
5804
6109
|
type: "button",
|
|
@@ -5808,7 +6113,7 @@ function KeepSyncRecoveryDialog({
|
|
|
5808
6113
|
children: view.labels.useServer
|
|
5809
6114
|
}
|
|
5810
6115
|
),
|
|
5811
|
-
/* @__PURE__ */
|
|
6116
|
+
/* @__PURE__ */ jsx29(
|
|
5812
6117
|
"button",
|
|
5813
6118
|
{
|
|
5814
6119
|
type: "button",
|
|
@@ -5821,12 +6126,12 @@ function KeepSyncRecoveryDialog({
|
|
|
5821
6126
|
] })
|
|
5822
6127
|
] }, conflict.id))
|
|
5823
6128
|
] }) : null,
|
|
5824
|
-
view.showBackupRecovery ? /* @__PURE__ */
|
|
5825
|
-
/* @__PURE__ */
|
|
5826
|
-
/* @__PURE__ */
|
|
5827
|
-
backup ?? (showBackupControls ? /* @__PURE__ */
|
|
6129
|
+
view.showBackupRecovery ? /* @__PURE__ */ jsxs24("section", { "data-recovery": "backup", children: [
|
|
6130
|
+
/* @__PURE__ */ jsx29("h3", { children: view.labels.backupRecovery }),
|
|
6131
|
+
/* @__PURE__ */ jsx29("p", { children: view.labels.backupRecoveryDescription }),
|
|
6132
|
+
backup ?? (showBackupControls ? /* @__PURE__ */ jsx29(KeepBackup, {}) : null)
|
|
5828
6133
|
] }) : null,
|
|
5829
|
-
view.error ? /* @__PURE__ */
|
|
6134
|
+
view.error ? /* @__PURE__ */ jsx29("p", { id: "keepkit-sync-recovery-error", role: "alert", "aria-live": "assertive", children: view.error instanceof Error ? view.error.message : view.labels.error }) : null
|
|
5830
6135
|
]
|
|
5831
6136
|
}
|
|
5832
6137
|
);
|
|
@@ -5838,16 +6143,16 @@ function ConflictPreview({
|
|
|
5838
6143
|
noteLabel,
|
|
5839
6144
|
side
|
|
5840
6145
|
}) {
|
|
5841
|
-
return /* @__PURE__ */
|
|
5842
|
-
/* @__PURE__ */
|
|
5843
|
-
/* @__PURE__ */
|
|
5844
|
-
/* @__PURE__ */
|
|
5845
|
-
/* @__PURE__ */
|
|
5846
|
-
/* @__PURE__ */
|
|
6146
|
+
return /* @__PURE__ */ jsxs24("article", { "data-conflict-version": side, "aria-label": heading, children: [
|
|
6147
|
+
/* @__PURE__ */ jsx29("h4", { children: heading }),
|
|
6148
|
+
/* @__PURE__ */ jsxs24("dl", { children: [
|
|
6149
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
6150
|
+
/* @__PURE__ */ jsx29("dt", { children: updatedAtLabel }),
|
|
6151
|
+
/* @__PURE__ */ jsx29("dd", { children: item ? /* @__PURE__ */ jsx29("time", { dateTime: new Date(item.updatedAt).toISOString(), children: formatConflictDate(item.updatedAt) }) : "\u2014" })
|
|
5847
6152
|
] }),
|
|
5848
|
-
/* @__PURE__ */
|
|
5849
|
-
/* @__PURE__ */
|
|
5850
|
-
/* @__PURE__ */
|
|
6153
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
6154
|
+
/* @__PURE__ */ jsx29("dt", { children: noteLabel }),
|
|
6155
|
+
/* @__PURE__ */ jsx29("dd", { children: item?.note || "\u2014" })
|
|
5851
6156
|
] })
|
|
5852
6157
|
] })
|
|
5853
6158
|
] });
|
|
@@ -5857,9 +6162,9 @@ function formatConflictDate(timestamp) {
|
|
|
5857
6162
|
}
|
|
5858
6163
|
|
|
5859
6164
|
// src/features/sync/hooks/useKeepSyncStatusBanner.ts
|
|
5860
|
-
import { useKeepContext as
|
|
6165
|
+
import { useKeepContext as useKeepContext9 } from "@keepkit/core/react";
|
|
5861
6166
|
function useKeepSyncStatusBanner({ onRetry, children }) {
|
|
5862
|
-
const context =
|
|
6167
|
+
const context = useKeepContext9();
|
|
5863
6168
|
const retryLabel = useUiLabel("retrySync");
|
|
5864
6169
|
const resolveLabel = useUiLabel("resolveSync");
|
|
5865
6170
|
const conflictLabel = useUiLabel("syncConflict");
|
|
@@ -5891,7 +6196,7 @@ function getErrorMessage6(error) {
|
|
|
5891
6196
|
}
|
|
5892
6197
|
|
|
5893
6198
|
// src/features/sync/KeepSyncStatusBanner.tsx
|
|
5894
|
-
import { jsx as
|
|
6199
|
+
import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5895
6200
|
function KeepSyncStatusBanner({
|
|
5896
6201
|
onRetry,
|
|
5897
6202
|
onResolveConflicts,
|
|
@@ -5900,8 +6205,10 @@ function KeepSyncStatusBanner({
|
|
|
5900
6205
|
...props
|
|
5901
6206
|
}) {
|
|
5902
6207
|
const view = useKeepSyncStatusBanner({ onRetry, children });
|
|
6208
|
+
const showRetryLabel = useUiLabelVisibility("retrySync");
|
|
6209
|
+
const showResolveLabel = useUiLabelVisibility("resolveSync");
|
|
5903
6210
|
if (view.status === "idle" && !view.hasConflicts) return null;
|
|
5904
|
-
return /* @__PURE__ */
|
|
6211
|
+
return /* @__PURE__ */ jsxs25(
|
|
5905
6212
|
"aside",
|
|
5906
6213
|
{
|
|
5907
6214
|
...props,
|
|
@@ -5911,25 +6218,27 @@ function KeepSyncStatusBanner({
|
|
|
5911
6218
|
"data-keepkit": "sync-status",
|
|
5912
6219
|
"data-state": view.status,
|
|
5913
6220
|
children: [
|
|
5914
|
-
/* @__PURE__ */
|
|
5915
|
-
view.showRetry ? /* @__PURE__ */
|
|
6221
|
+
/* @__PURE__ */ jsx30("p", { children: view.message }),
|
|
6222
|
+
view.showRetry ? /* @__PURE__ */ jsx30(
|
|
5916
6223
|
"button",
|
|
5917
6224
|
{
|
|
5918
6225
|
type: "button",
|
|
5919
6226
|
"data-keep-action": "retry-sync",
|
|
5920
6227
|
onClick: () => void view.retry(),
|
|
5921
6228
|
disabled: view.isMutating,
|
|
5922
|
-
|
|
6229
|
+
"aria-label": showRetryLabel ? void 0 : view.retryLabel,
|
|
6230
|
+
children: showRetryLabel ? view.retryLabel : null
|
|
5923
6231
|
}
|
|
5924
6232
|
) : null,
|
|
5925
|
-
view.hasConflicts ? /* @__PURE__ */
|
|
6233
|
+
view.hasConflicts ? /* @__PURE__ */ jsx30(
|
|
5926
6234
|
"button",
|
|
5927
6235
|
{
|
|
5928
6236
|
type: "button",
|
|
5929
6237
|
"data-keep-action": "resolve-conflicts",
|
|
5930
6238
|
onClick: onResolveConflicts,
|
|
5931
6239
|
disabled: !onResolveConflicts,
|
|
5932
|
-
|
|
6240
|
+
"aria-label": showResolveLabel ? void 0 : view.resolveLabel,
|
|
6241
|
+
children: showResolveLabel ? view.resolveLabel : null
|
|
5933
6242
|
}
|
|
5934
6243
|
) : null
|
|
5935
6244
|
]
|
|
@@ -5938,7 +6247,7 @@ function KeepSyncStatusBanner({
|
|
|
5938
6247
|
}
|
|
5939
6248
|
|
|
5940
6249
|
// src/features/workspace/hooks/useKeepWorkspace.ts
|
|
5941
|
-
import { useCallback as useCallback9, useState as
|
|
6250
|
+
import { useCallback as useCallback9, useState as useState20 } from "react";
|
|
5942
6251
|
var PRESET_MODULES = {
|
|
5943
6252
|
basic: { syncStatus: false, undo: false, recovery: false, backup: false, stalePrune: false },
|
|
5944
6253
|
standard: { syncStatus: false, undo: true, recovery: false, backup: false, stalePrune: false },
|
|
@@ -5958,7 +6267,7 @@ function useKeepWorkspace({
|
|
|
5958
6267
|
onRecoveryOpenChange,
|
|
5959
6268
|
onResolveConflicts
|
|
5960
6269
|
}) {
|
|
5961
|
-
const [internalRecoveryOpen, setInternalRecoveryOpen] =
|
|
6270
|
+
const [internalRecoveryOpen, setInternalRecoveryOpen] = useState20(false);
|
|
5962
6271
|
const resolvedModules = { ...PRESET_MODULES[preset], ...modules };
|
|
5963
6272
|
const setRecoveryOpen = useCallback9(
|
|
5964
6273
|
(open) => {
|
|
@@ -5982,7 +6291,7 @@ function useKeepWorkspace({
|
|
|
5982
6291
|
}
|
|
5983
6292
|
|
|
5984
6293
|
// src/features/workspace/KeepWorkspace.tsx
|
|
5985
|
-
import { jsx as
|
|
6294
|
+
import { jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5986
6295
|
function KeepWorkspace({
|
|
5987
6296
|
preset = "standard",
|
|
5988
6297
|
modules,
|
|
@@ -6021,27 +6330,27 @@ function KeepWorkspace({
|
|
|
6021
6330
|
if (!structuredRegions) return content;
|
|
6022
6331
|
if (!hasRenderableContent(content)) return null;
|
|
6023
6332
|
const resolvedSurface = typeof surface === "string" ? surface : surface[name] ?? "plain";
|
|
6024
|
-
return /* @__PURE__ */
|
|
6333
|
+
return /* @__PURE__ */ jsx31("div", { "data-keepkit": "workspace-region", "data-region": name, "data-surface": resolvedSurface, children: content });
|
|
6025
6334
|
};
|
|
6026
6335
|
const before = resolveOptionalSlot(slots?.before, state);
|
|
6027
6336
|
const syncStatus = view.modules.syncStatus ? resolveSlot(
|
|
6028
6337
|
slots?.syncStatus,
|
|
6029
|
-
/* @__PURE__ */
|
|
6338
|
+
/* @__PURE__ */ jsx31(KeepSyncStatusBanner, { ...syncStatusProps, onResolveConflicts: view.openRecovery }),
|
|
6030
6339
|
state
|
|
6031
6340
|
) : null;
|
|
6032
|
-
const collection = resolveSlot(slots?.collection, /* @__PURE__ */
|
|
6341
|
+
const collection = resolveSlot(slots?.collection, /* @__PURE__ */ jsx31(KeepCollection, { ...resolvedCollectionProps }), state);
|
|
6033
6342
|
const actions = view.modules.backup || view.modules.stalePrune ? resolveSlot(
|
|
6034
6343
|
slots?.actions,
|
|
6035
|
-
/* @__PURE__ */
|
|
6036
|
-
view.modules.stalePrune ? /* @__PURE__ */
|
|
6037
|
-
view.modules.backup ? /* @__PURE__ */
|
|
6344
|
+
/* @__PURE__ */ jsxs26("div", { "data-keepkit": "workspace-actions", children: [
|
|
6345
|
+
view.modules.stalePrune ? /* @__PURE__ */ jsx31(KeepPruneStaleButton, { ...stalePruneProps }) : null,
|
|
6346
|
+
view.modules.backup ? /* @__PURE__ */ jsx31(KeepBackup, { ...backupProps }) : null
|
|
6038
6347
|
] }),
|
|
6039
6348
|
state
|
|
6040
6349
|
) : null;
|
|
6041
|
-
const undo = view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */
|
|
6350
|
+
const undo = view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */ jsx31(KeepUndo, { ...undoProps }), state) : null;
|
|
6042
6351
|
const recovery = view.modules.recovery ? resolveSlot(
|
|
6043
6352
|
slots?.recovery,
|
|
6044
|
-
/* @__PURE__ */
|
|
6353
|
+
/* @__PURE__ */ jsx31(
|
|
6045
6354
|
KeepSyncRecoveryDialog,
|
|
6046
6355
|
{
|
|
6047
6356
|
...recoveryProps,
|
|
@@ -6053,7 +6362,7 @@ function KeepWorkspace({
|
|
|
6053
6362
|
) : null;
|
|
6054
6363
|
const additionalContent = resolveOptionalSlot(children, state);
|
|
6055
6364
|
const after = resolveOptionalSlot(slots?.after, state);
|
|
6056
|
-
return /* @__PURE__ */
|
|
6365
|
+
return /* @__PURE__ */ jsxs26(
|
|
6057
6366
|
"section",
|
|
6058
6367
|
{
|
|
6059
6368
|
...props,
|
|
@@ -6086,7 +6395,7 @@ function resolveOptionalSlot(slot, state) {
|
|
|
6086
6395
|
|
|
6087
6396
|
// src/foundation/theme.tsx
|
|
6088
6397
|
import { isValidElement as isValidElement9 } from "react";
|
|
6089
|
-
import { jsx as
|
|
6398
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
6090
6399
|
var keepThemeNames = [
|
|
6091
6400
|
"default",
|
|
6092
6401
|
"ocean",
|
|
@@ -6145,7 +6454,7 @@ function KeepThemeProvider({
|
|
|
6145
6454
|
throw new Error("KeepThemeProvider with asChild requires a single React element child.");
|
|
6146
6455
|
return createSlot(children, rootProps);
|
|
6147
6456
|
}
|
|
6148
|
-
return /* @__PURE__ */
|
|
6457
|
+
return /* @__PURE__ */ jsx32("div", { ...rootProps, children });
|
|
6149
6458
|
}
|
|
6150
6459
|
|
|
6151
6460
|
// src/index.tsx
|
|
@@ -6153,8 +6462,8 @@ import { createAuthenticatedSyncKit } from "@keepkit/core/core";
|
|
|
6153
6462
|
import {
|
|
6154
6463
|
KeepErrorBoundary as KeepErrorBoundary3,
|
|
6155
6464
|
KeepProvider,
|
|
6156
|
-
useKeepCollections as
|
|
6157
|
-
useKeepContext as
|
|
6465
|
+
useKeepCollections as useKeepCollections4,
|
|
6466
|
+
useKeepContext as useKeepContext10,
|
|
6158
6467
|
useKeepItem as useKeepItem8,
|
|
6159
6468
|
useKeepList as useKeepList5,
|
|
6160
6469
|
useKeepNavigator as useKeepNavigator2,
|
|
@@ -6170,9 +6479,10 @@ import {
|
|
|
6170
6479
|
LocalStorageSyncQueueAdapter,
|
|
6171
6480
|
SyncStorageAdapter
|
|
6172
6481
|
} from "@keepkit/core/storage";
|
|
6173
|
-
import { jsx as
|
|
6482
|
+
import { jsx as jsx33, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6174
6483
|
function KeepKitProvider({
|
|
6175
6484
|
labels,
|
|
6485
|
+
labelOptions,
|
|
6176
6486
|
locale,
|
|
6177
6487
|
labelResolver,
|
|
6178
6488
|
onFeedback,
|
|
@@ -6190,31 +6500,42 @@ function KeepKitProvider({
|
|
|
6190
6500
|
children,
|
|
6191
6501
|
...providerProps
|
|
6192
6502
|
}) {
|
|
6193
|
-
return /* @__PURE__ */
|
|
6194
|
-
|
|
6503
|
+
return /* @__PURE__ */ jsx33(
|
|
6504
|
+
KeepUiProvider,
|
|
6195
6505
|
{
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6506
|
+
labels,
|
|
6507
|
+
labelOptions,
|
|
6508
|
+
locale,
|
|
6509
|
+
labelResolver,
|
|
6510
|
+
onFeedback,
|
|
6511
|
+
children: /* @__PURE__ */ jsx33(
|
|
6512
|
+
KeepThemeProvider,
|
|
6513
|
+
{
|
|
6514
|
+
theme,
|
|
6515
|
+
mode,
|
|
6516
|
+
density,
|
|
6517
|
+
radius,
|
|
6518
|
+
accentColor,
|
|
6519
|
+
highContrast,
|
|
6520
|
+
reducedMotion,
|
|
6521
|
+
variables,
|
|
6522
|
+
className: themeClassName,
|
|
6523
|
+
style: themeStyle,
|
|
6524
|
+
asChild: themeAsChild,
|
|
6525
|
+
children: /* @__PURE__ */ jsxs27(CoreKeepProvider, { ...providerProps, children: [
|
|
6526
|
+
/* @__PURE__ */ jsx33(KeepSyncFeedbackObserver, {}),
|
|
6527
|
+
children,
|
|
6528
|
+
/* @__PURE__ */ jsx33(KeepAnnouncements, {})
|
|
6529
|
+
] })
|
|
6530
|
+
}
|
|
6531
|
+
)
|
|
6212
6532
|
}
|
|
6213
|
-
)
|
|
6533
|
+
);
|
|
6214
6534
|
}
|
|
6215
6535
|
function createKeepKit(options = {}) {
|
|
6216
6536
|
const {
|
|
6217
6537
|
labels,
|
|
6538
|
+
labelOptions,
|
|
6218
6539
|
locale,
|
|
6219
6540
|
labelResolver,
|
|
6220
6541
|
onFeedback,
|
|
@@ -6234,11 +6555,12 @@ function createKeepKit(options = {}) {
|
|
|
6234
6555
|
} = options;
|
|
6235
6556
|
const coreKit = createCoreKeepKit(coreOptions);
|
|
6236
6557
|
return {
|
|
6237
|
-
Provider: (props) => /* @__PURE__ */
|
|
6558
|
+
Provider: (props) => /* @__PURE__ */ jsx33(
|
|
6238
6559
|
KeepKitProvider,
|
|
6239
6560
|
{
|
|
6240
6561
|
...coreOptions,
|
|
6241
6562
|
labels,
|
|
6563
|
+
labelOptions,
|
|
6242
6564
|
locale,
|
|
6243
6565
|
labelResolver,
|
|
6244
6566
|
onFeedback,
|
|
@@ -6255,9 +6577,9 @@ function createKeepKit(options = {}) {
|
|
|
6255
6577
|
...props
|
|
6256
6578
|
}
|
|
6257
6579
|
),
|
|
6258
|
-
Button: (props) => /* @__PURE__ */
|
|
6259
|
-
Backup: (props) => /* @__PURE__ */
|
|
6260
|
-
Collection: (props) => /* @__PURE__ */
|
|
6580
|
+
Button: (props) => /* @__PURE__ */ jsx33(KeepButton, { ...props }),
|
|
6581
|
+
Backup: (props) => /* @__PURE__ */ jsx33(KeepBackup, { ...props }),
|
|
6582
|
+
Collection: (props) => /* @__PURE__ */ jsx33(
|
|
6261
6583
|
KeepCollection,
|
|
6262
6584
|
{
|
|
6263
6585
|
...props,
|
|
@@ -6268,7 +6590,7 @@ function createKeepKit(options = {}) {
|
|
|
6268
6590
|
}
|
|
6269
6591
|
}
|
|
6270
6592
|
),
|
|
6271
|
-
Workspace: (props) => /* @__PURE__ */
|
|
6593
|
+
Workspace: (props) => /* @__PURE__ */ jsx33(
|
|
6272
6594
|
KeepWorkspace,
|
|
6273
6595
|
{
|
|
6274
6596
|
...props,
|
|
@@ -6303,6 +6625,7 @@ export {
|
|
|
6303
6625
|
KeepBulkActions,
|
|
6304
6626
|
KeepButton,
|
|
6305
6627
|
KeepCollection,
|
|
6628
|
+
KeepCollectionCreate,
|
|
6306
6629
|
KeepCollectionFilter,
|
|
6307
6630
|
KeepCollectionSelect,
|
|
6308
6631
|
KeepEmptyState,
|
|
@@ -6355,8 +6678,8 @@ export {
|
|
|
6355
6678
|
keepThemeNames,
|
|
6356
6679
|
mergeProps,
|
|
6357
6680
|
toggleSelectAll,
|
|
6358
|
-
|
|
6359
|
-
|
|
6681
|
+
useKeepCollections4 as useKeepCollections,
|
|
6682
|
+
useKeepContext10 as useKeepContext,
|
|
6360
6683
|
useKeepItem8 as useKeepItem,
|
|
6361
6684
|
useKeepList5 as useKeepList,
|
|
6362
6685
|
useKeepNavigator2 as useKeepNavigator,
|
|
@@ -6365,6 +6688,7 @@ export {
|
|
|
6365
6688
|
useKeepToastFeedback,
|
|
6366
6689
|
useKeepTourShortcuts,
|
|
6367
6690
|
useKeepUiLabels,
|
|
6368
|
-
useKeepUrlSync
|
|
6691
|
+
useKeepUrlSync,
|
|
6692
|
+
useUiLabelVisibility
|
|
6369
6693
|
};
|
|
6370
6694
|
//# sourceMappingURL=index.js.map
|