@keepkit/ui 0.26.4 → 0.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/index.d.ts +42 -7
- package/dist/index.js +694 -361
- 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) }) });
|
|
@@ -2783,29 +2890,42 @@ function KeepQuickEditor({
|
|
|
2783
2890
|
debounceMs = 300,
|
|
2784
2891
|
onSaved,
|
|
2785
2892
|
onSaveError,
|
|
2893
|
+
features,
|
|
2786
2894
|
...props
|
|
2787
2895
|
}) {
|
|
2788
2896
|
const view = useKeepQuickEditor(item, { debounceMs, onSaved, onSaveError });
|
|
2789
|
-
return /* @__PURE__ */ jsx7(KeepQuickEditorView, { ...props, state: view.state });
|
|
2897
|
+
return /* @__PURE__ */ jsx7(KeepQuickEditorView, { ...props, features, state: view.state });
|
|
2790
2898
|
}
|
|
2899
|
+
var DEFAULT_FEATURES = {
|
|
2900
|
+
note: true,
|
|
2901
|
+
tags: true,
|
|
2902
|
+
collection: true
|
|
2903
|
+
};
|
|
2791
2904
|
function KeepQuickEditorView({
|
|
2792
2905
|
state,
|
|
2793
2906
|
collectionIds,
|
|
2794
2907
|
collectionLabels,
|
|
2795
2908
|
showSaveButton = true,
|
|
2909
|
+
features,
|
|
2796
2910
|
children,
|
|
2797
2911
|
onClose,
|
|
2798
2912
|
focusScopeRef,
|
|
2799
2913
|
...props
|
|
2800
2914
|
}) {
|
|
2915
|
+
const enabled = { ...DEFAULT_FEATURES, ...features };
|
|
2801
2916
|
const collections = useKeepCollections({ targetType: state.item.targetType, orderBy: "name" });
|
|
2802
2917
|
const rootRef = useRef4(null);
|
|
2803
2918
|
const noteLabel = useUiLabel("note");
|
|
2919
|
+
const showNoteLabel = useUiLabelVisibility("note");
|
|
2804
2920
|
const tagsLabel = useUiLabel("tags");
|
|
2921
|
+
const showTagsLabel = useUiLabelVisibility("tags");
|
|
2805
2922
|
const collectionLabel = useUiLabel("collection");
|
|
2923
|
+
const showCollectionLabel = useUiLabelVisibility("collection");
|
|
2806
2924
|
const uncategorizedLabel = useUiLabel("uncategorized");
|
|
2807
2925
|
const saveLabel = useUiLabel("saveWithNote");
|
|
2926
|
+
const showSaveLabel = useUiLabelVisibility("saveWithNote");
|
|
2808
2927
|
const closeLabel = useUiLabel("close");
|
|
2928
|
+
const showCloseLabel = useUiLabelVisibility("close");
|
|
2809
2929
|
const unsavedChangesLabel = useUiLabel("unsavedChanges");
|
|
2810
2930
|
const savingLabel = useUiLabel("saving");
|
|
2811
2931
|
const savedLabel = useUiLabel("saved");
|
|
@@ -2825,28 +2945,37 @@ function KeepQuickEditorView({
|
|
|
2825
2945
|
};
|
|
2826
2946
|
const statusMessage = state.saveStatus === "dirty" ? unsavedChangesLabel : state.saveStatus === "saving" ? savingLabel : state.saveStatus === "saved" ? savedLabel : state.saveStatus === "error" ? getErrorMessage2(state.error, errorLabel) : null;
|
|
2827
2947
|
const body = typeof children === "function" ? children(state) : children ?? /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
2828
|
-
/* @__PURE__ */ jsxs5("label", { children: [
|
|
2829
|
-
noteLabel,
|
|
2830
|
-
/* @__PURE__ */ jsx7(
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2948
|
+
enabled.note ? /* @__PURE__ */ jsxs5("label", { "data-keep-field": "note", children: [
|
|
2949
|
+
showNoteLabel ? /* @__PURE__ */ jsx7("span", { "data-keep-field-icon": true, children: noteLabel }) : null,
|
|
2950
|
+
/* @__PURE__ */ jsx7(
|
|
2951
|
+
"textarea",
|
|
2952
|
+
{
|
|
2953
|
+
value: state.note,
|
|
2954
|
+
"aria-label": showNoteLabel ? void 0 : noteLabel,
|
|
2955
|
+
onChange: (event) => state.setNote(event.currentTarget.value)
|
|
2956
|
+
}
|
|
2957
|
+
)
|
|
2958
|
+
] }) : null,
|
|
2959
|
+
enabled.tags ? /* @__PURE__ */ jsxs5("label", { "data-keep-field": "tags", children: [
|
|
2960
|
+
showTagsLabel ? /* @__PURE__ */ jsx7("span", { "data-keep-field-icon": true, children: tagsLabel }) : null,
|
|
2834
2961
|
/* @__PURE__ */ jsx7(
|
|
2835
2962
|
"input",
|
|
2836
2963
|
{
|
|
2837
2964
|
value: state.tags.join(", "),
|
|
2965
|
+
"aria-label": showTagsLabel ? void 0 : tagsLabel,
|
|
2838
2966
|
onChange: (event) => state.setTags(
|
|
2839
2967
|
event.currentTarget.value.split(",").map((tag) => tag.trim()).filter(Boolean)
|
|
2840
2968
|
)
|
|
2841
2969
|
}
|
|
2842
2970
|
)
|
|
2843
|
-
] }),
|
|
2844
|
-
/* @__PURE__ */ jsxs5("label", { children: [
|
|
2845
|
-
collectionLabel,
|
|
2971
|
+
] }) : null,
|
|
2972
|
+
enabled.collection ? /* @__PURE__ */ jsxs5("label", { "data-keep-field": "collection", children: [
|
|
2973
|
+
showCollectionLabel ? /* @__PURE__ */ jsx7("span", { "data-keep-field-icon": true, children: collectionLabel }) : null,
|
|
2846
2974
|
/* @__PURE__ */ jsxs5(
|
|
2847
2975
|
"select",
|
|
2848
2976
|
{
|
|
2849
2977
|
value: state.collectionId ?? "",
|
|
2978
|
+
"aria-label": showCollectionLabel ? void 0 : collectionLabel,
|
|
2850
2979
|
onChange: (event) => state.setCollectionId(event.currentTarget.value || void 0),
|
|
2851
2980
|
children: [
|
|
2852
2981
|
/* @__PURE__ */ jsx7("option", { value: "", children: uncategorizedLabel }),
|
|
@@ -2854,7 +2983,7 @@ function KeepQuickEditorView({
|
|
|
2854
2983
|
]
|
|
2855
2984
|
}
|
|
2856
2985
|
)
|
|
2857
|
-
] }),
|
|
2986
|
+
] }) : null,
|
|
2858
2987
|
statusMessage ? /* @__PURE__ */ jsx7(
|
|
2859
2988
|
"p",
|
|
2860
2989
|
{
|
|
@@ -2866,7 +2995,16 @@ function KeepQuickEditorView({
|
|
|
2866
2995
|
children: statusMessage
|
|
2867
2996
|
}
|
|
2868
2997
|
) : null,
|
|
2869
|
-
showSaveButton ? /* @__PURE__ */ jsx7(
|
|
2998
|
+
showSaveButton ? /* @__PURE__ */ jsx7(
|
|
2999
|
+
"button",
|
|
3000
|
+
{
|
|
3001
|
+
type: "submit",
|
|
3002
|
+
disabled: state.isSaving,
|
|
3003
|
+
"data-keep-action": "save-quick-edit",
|
|
3004
|
+
"aria-label": showSaveLabel ? void 0 : saveLabel,
|
|
3005
|
+
children: showSaveLabel ? saveLabel : null
|
|
3006
|
+
}
|
|
3007
|
+
) : null,
|
|
2870
3008
|
onClose ? /* @__PURE__ */ jsx7(
|
|
2871
3009
|
"button",
|
|
2872
3010
|
{
|
|
@@ -2874,7 +3012,8 @@ function KeepQuickEditorView({
|
|
|
2874
3012
|
onClick: () => void state.flush().then(onClose).catch(() => void 0),
|
|
2875
3013
|
disabled: state.isSaving,
|
|
2876
3014
|
"data-keep-action": "close-quick-edit",
|
|
2877
|
-
|
|
3015
|
+
"aria-label": showCloseLabel ? void 0 : closeLabel,
|
|
3016
|
+
children: showCloseLabel ? closeLabel : null
|
|
2878
3017
|
}
|
|
2879
3018
|
) : null
|
|
2880
3019
|
] });
|
|
@@ -3112,6 +3251,7 @@ function useKeepUndo() {
|
|
|
3112
3251
|
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3113
3252
|
function KeepUndo({ children, label, ...props }) {
|
|
3114
3253
|
const view = useKeepUndo();
|
|
3254
|
+
const showLabel = useUiLabelVisibility("undo");
|
|
3115
3255
|
if (!view.canUndo) return null;
|
|
3116
3256
|
return /* @__PURE__ */ jsxs7("div", { ...props, role: "status", "aria-live": "polite", "data-keepkit": "undo", "data-state": "available", children: [
|
|
3117
3257
|
/* @__PURE__ */ jsx9("span", { "data-keepkit": "undo-message", children: children ?? view.message }),
|
|
@@ -3129,13 +3269,22 @@ function KeepUndo({ children, label, ...props }) {
|
|
|
3129
3269
|
"aria-valuetext": `${view.remainingSeconds}s`
|
|
3130
3270
|
}
|
|
3131
3271
|
),
|
|
3132
|
-
/* @__PURE__ */ jsx9(
|
|
3272
|
+
/* @__PURE__ */ jsx9(
|
|
3273
|
+
"button",
|
|
3274
|
+
{
|
|
3275
|
+
type: "button",
|
|
3276
|
+
"data-keep-action": "undo",
|
|
3277
|
+
"aria-label": showLabel ? void 0 : view.label,
|
|
3278
|
+
onClick: () => void view.undo(),
|
|
3279
|
+
children: showLabel ? label ?? view.label : null
|
|
3280
|
+
}
|
|
3281
|
+
)
|
|
3133
3282
|
] });
|
|
3134
3283
|
}
|
|
3135
3284
|
|
|
3136
3285
|
// src/features/collection/KeepCollection.tsx
|
|
3137
3286
|
import { KeepErrorBoundary as KeepErrorBoundary2 } from "@keepkit/core/react";
|
|
3138
|
-
import { useEffect as useEffect10, useId as
|
|
3287
|
+
import { useEffect as useEffect10, useId as useId4, useState as useState15 } from "react";
|
|
3139
3288
|
|
|
3140
3289
|
// src/features/query/KeepActiveFiltersSummary.tsx
|
|
3141
3290
|
import {
|
|
@@ -3159,6 +3308,7 @@ function KeepActiveFiltersSummary({
|
|
|
3159
3308
|
const tags = normalizeTags(providedTags ?? query?.tags ?? []);
|
|
3160
3309
|
const hasFilters = Boolean(search) || tags.length > 0;
|
|
3161
3310
|
const activeFiltersLabel = useUiLabel("activeFilters");
|
|
3311
|
+
const showActiveFiltersLabel = useUiLabelVisibility("activeFilters");
|
|
3162
3312
|
const clearAllLabel = useUiLabel("clearAllFilters");
|
|
3163
3313
|
const clearLabel = useUiLabel("clearFilters");
|
|
3164
3314
|
const removeLabel = useUiLabel("removeFilter");
|
|
@@ -3204,7 +3354,7 @@ function KeepActiveFiltersSummary({
|
|
|
3204
3354
|
};
|
|
3205
3355
|
const contentChildren = asChild && isElement(children) ? void 0 : children;
|
|
3206
3356
|
const body = typeof contentChildren === "function" ? contentChildren(state) : contentChildren ?? (hasFilters ? /* @__PURE__ */ jsxs8(Fragment6, { children: [
|
|
3207
|
-
/* @__PURE__ */ jsx10("span", { "data-active-filters-label": "true", children: activeFiltersLabel }),
|
|
3357
|
+
showActiveFiltersLabel ? /* @__PURE__ */ jsx10("span", { "data-active-filters-label": "true", children: activeFiltersLabel }) : null,
|
|
3208
3358
|
/* @__PURE__ */ jsxs8("ul", { "data-active-filters-list": "true", children: [
|
|
3209
3359
|
search ? /* @__PURE__ */ jsxs8("li", { "data-filter-kind": "search", children: [
|
|
3210
3360
|
/* @__PURE__ */ jsx10("span", { "data-filter-value": "true", children: search }),
|
|
@@ -3386,6 +3536,7 @@ function KeepCollectionFilter({
|
|
|
3386
3536
|
const collections = useKeepCollections2({ orderBy: "name" });
|
|
3387
3537
|
const options = useCollectionOptions(collectionLabels, collections);
|
|
3388
3538
|
const collectionLabel = useUiLabel("collection");
|
|
3539
|
+
const showCollectionLabel = useUiLabelVisibility("collection");
|
|
3389
3540
|
const defaultAllLabel = useUiLabel("allCollections");
|
|
3390
3541
|
const defaultUncategorizedLabel = useUiLabel("uncategorized");
|
|
3391
3542
|
const all = allLabel ?? defaultAllLabel;
|
|
@@ -3397,12 +3548,13 @@ function KeepCollectionFilter({
|
|
|
3397
3548
|
onChange?.(resolved);
|
|
3398
3549
|
};
|
|
3399
3550
|
return /* @__PURE__ */ jsxs10("label", { "data-keepkit": "collection-filter", children: [
|
|
3400
|
-
/* @__PURE__ */ jsx12("span", { children: collectionLabel }),
|
|
3551
|
+
showCollectionLabel ? /* @__PURE__ */ jsx12("span", { children: collectionLabel }) : null,
|
|
3401
3552
|
/* @__PURE__ */ jsxs10(
|
|
3402
3553
|
"select",
|
|
3403
3554
|
{
|
|
3404
3555
|
...props,
|
|
3405
3556
|
value: selected,
|
|
3557
|
+
"aria-label": props["aria-label"] ?? collectionLabel,
|
|
3406
3558
|
onChange: (event) => handleChange(event.currentTarget.value),
|
|
3407
3559
|
"data-keep-action": "filter-collection",
|
|
3408
3560
|
children: [
|
|
@@ -3466,17 +3618,20 @@ function KeepTagFilter({
|
|
|
3466
3618
|
...rootProps
|
|
3467
3619
|
}) {
|
|
3468
3620
|
const view = useKeepTagFilter({ query, controlledValue, defaultValue, onChange, onValueChange });
|
|
3621
|
+
const showFilterLabel = useUiLabelVisibility("filterTags");
|
|
3622
|
+
const showAllTagsLabel = useUiLabelVisibility("allTags");
|
|
3469
3623
|
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 }),
|
|
3624
|
+
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: [
|
|
3625
|
+
showFilterLabel ? /* @__PURE__ */ jsx13("legend", { children: ariaLabel ?? view.labels.aria }) : null,
|
|
3472
3626
|
/* @__PURE__ */ jsx13(
|
|
3473
3627
|
"button",
|
|
3474
3628
|
{
|
|
3475
3629
|
type: "button",
|
|
3476
3630
|
"data-keep-action": "filter-all-tags",
|
|
3477
3631
|
"aria-pressed": view.state.value === void 0,
|
|
3632
|
+
"aria-label": showAllTagsLabel ? void 0 : view.labels.all,
|
|
3478
3633
|
onClick: () => view.state.select(),
|
|
3479
|
-
children: allLabel ?? view.labels.all
|
|
3634
|
+
children: showAllTagsLabel ? allLabel ?? view.labels.all : null
|
|
3480
3635
|
}
|
|
3481
3636
|
),
|
|
3482
3637
|
view.state.tags.map((tag) => /* @__PURE__ */ jsxs11(
|
|
@@ -3653,6 +3808,8 @@ function KeepPagination({
|
|
|
3653
3808
|
...props
|
|
3654
3809
|
}) {
|
|
3655
3810
|
const view = useKeepPagination({ totalCount, pageSize, page, maxPageButtons, onPageChange });
|
|
3811
|
+
const showPreviousLabel = useUiLabelVisibility("previousPage");
|
|
3812
|
+
const showNextLabel = useUiLabelVisibility("nextPage");
|
|
3656
3813
|
const navProps = {
|
|
3657
3814
|
...props,
|
|
3658
3815
|
"data-keepkit": "pagination",
|
|
@@ -3669,7 +3826,8 @@ function KeepPagination({
|
|
|
3669
3826
|
"data-keep-action": "previous-page",
|
|
3670
3827
|
onClick: () => view.goToPage(view.currentPage - 1),
|
|
3671
3828
|
disabled: view.currentPage <= 1,
|
|
3672
|
-
|
|
3829
|
+
"aria-label": showPreviousLabel ? void 0 : view.labels.previous,
|
|
3830
|
+
children: showPreviousLabel ? view.labels.previous : null
|
|
3673
3831
|
}
|
|
3674
3832
|
),
|
|
3675
3833
|
view.visiblePages.map((nextPage) => /* @__PURE__ */ jsx14(
|
|
@@ -3691,7 +3849,8 @@ function KeepPagination({
|
|
|
3691
3849
|
"data-keep-action": "next-page",
|
|
3692
3850
|
onClick: () => view.goToPage(view.currentPage + 1),
|
|
3693
3851
|
disabled: view.currentPage >= view.pageCount,
|
|
3694
|
-
|
|
3852
|
+
"aria-label": showNextLabel ? void 0 : view.labels.next,
|
|
3853
|
+
children: showNextLabel ? view.labels.next : null
|
|
3695
3854
|
}
|
|
3696
3855
|
)
|
|
3697
3856
|
] });
|
|
@@ -3718,6 +3877,7 @@ function useKeepCollection({
|
|
|
3718
3877
|
tags: true,
|
|
3719
3878
|
pin: false,
|
|
3720
3879
|
archive: false,
|
|
3880
|
+
note: false,
|
|
3721
3881
|
...features
|
|
3722
3882
|
};
|
|
3723
3883
|
const [searchValue, setSearchValue] = useState10(query.search?.query ?? "");
|
|
@@ -3823,6 +3983,102 @@ function scopeFromArchived(archived) {
|
|
|
3823
3983
|
return archived === true ? "archived" : "active";
|
|
3824
3984
|
}
|
|
3825
3985
|
|
|
3986
|
+
// src/features/collection/KeepCollectionCreate.tsx
|
|
3987
|
+
import { useKeepCollections as useKeepCollections3, useKeepContext as useKeepContext4 } from "@keepkit/core/react";
|
|
3988
|
+
import { useId as useId2, useState as useState11 } from "react";
|
|
3989
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3990
|
+
function KeepCollectionCreate({
|
|
3991
|
+
onCreated,
|
|
3992
|
+
onError,
|
|
3993
|
+
label,
|
|
3994
|
+
submitLabel,
|
|
3995
|
+
placeholder,
|
|
3996
|
+
id: externalId,
|
|
3997
|
+
...inputProps
|
|
3998
|
+
}) {
|
|
3999
|
+
const { createCollection } = useKeepContext4();
|
|
4000
|
+
const collections = useKeepCollections3();
|
|
4001
|
+
const [name, setName] = useState11("");
|
|
4002
|
+
const [error, setError] = useState11(null);
|
|
4003
|
+
const [isSubmitting, setIsSubmitting] = useState11(false);
|
|
4004
|
+
const autoId = useId2();
|
|
4005
|
+
const inputId = externalId ?? autoId;
|
|
4006
|
+
const resolvedLabel = useUiLabel("createCollection");
|
|
4007
|
+
const showLabel = useUiLabelVisibility("createCollection");
|
|
4008
|
+
const resolvedSubmitLabel = useUiLabel("createCollectionSubmit");
|
|
4009
|
+
const showSubmitLabel = useUiLabelVisibility("createCollectionSubmit");
|
|
4010
|
+
const placeholderText = useUiLabel("collectionName");
|
|
4011
|
+
const handleSubmit = async (event) => {
|
|
4012
|
+
event.preventDefault();
|
|
4013
|
+
const trimmed = name.trim();
|
|
4014
|
+
if (!trimmed) return;
|
|
4015
|
+
const normalizedId = trimmed.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
4016
|
+
if (!normalizedId) return;
|
|
4017
|
+
const exists = collections.some((c) => c.id === normalizedId || c.name.toLowerCase() === trimmed.toLowerCase());
|
|
4018
|
+
if (exists) {
|
|
4019
|
+
const message = `Collection "${trimmed}" already exists.`;
|
|
4020
|
+
setError(message);
|
|
4021
|
+
onError?.(new Error(message));
|
|
4022
|
+
return;
|
|
4023
|
+
}
|
|
4024
|
+
setError(null);
|
|
4025
|
+
setIsSubmitting(true);
|
|
4026
|
+
try {
|
|
4027
|
+
await createCollection(normalizedId, trimmed);
|
|
4028
|
+
setName("");
|
|
4029
|
+
onCreated?.(normalizedId);
|
|
4030
|
+
} catch (cause) {
|
|
4031
|
+
const message = cause instanceof Error ? cause.message : "Failed to create collection.";
|
|
4032
|
+
setError(message);
|
|
4033
|
+
onError?.(cause);
|
|
4034
|
+
} finally {
|
|
4035
|
+
setIsSubmitting(false);
|
|
4036
|
+
}
|
|
4037
|
+
};
|
|
4038
|
+
return /* @__PURE__ */ jsxs13(
|
|
4039
|
+
"form",
|
|
4040
|
+
{
|
|
4041
|
+
"data-keepkit": "collection-create",
|
|
4042
|
+
"data-state": error ? "error" : isSubmitting ? "submitting" : "idle",
|
|
4043
|
+
onSubmit: handleSubmit,
|
|
4044
|
+
children: [
|
|
4045
|
+
showLabel ? /* @__PURE__ */ jsx15("label", { htmlFor: inputId, children: label ?? resolvedLabel }) : null,
|
|
4046
|
+
/* @__PURE__ */ jsxs13("div", { "data-keepkit": "collection-create-row", children: [
|
|
4047
|
+
/* @__PURE__ */ jsx15(
|
|
4048
|
+
"input",
|
|
4049
|
+
{
|
|
4050
|
+
...inputProps,
|
|
4051
|
+
id: inputId,
|
|
4052
|
+
type: "text",
|
|
4053
|
+
value: name,
|
|
4054
|
+
onChange: (event) => {
|
|
4055
|
+
setName(event.currentTarget.value);
|
|
4056
|
+
if (error) setError(null);
|
|
4057
|
+
},
|
|
4058
|
+
placeholder: placeholder ?? placeholderText,
|
|
4059
|
+
disabled: isSubmitting,
|
|
4060
|
+
"aria-label": showLabel ? void 0 : resolvedLabel,
|
|
4061
|
+
"aria-invalid": error ? "true" : void 0,
|
|
4062
|
+
"data-keep-action": "collection-name-input"
|
|
4063
|
+
}
|
|
4064
|
+
),
|
|
4065
|
+
/* @__PURE__ */ jsx15(
|
|
4066
|
+
"button",
|
|
4067
|
+
{
|
|
4068
|
+
type: "submit",
|
|
4069
|
+
disabled: isSubmitting || !name.trim(),
|
|
4070
|
+
"aria-label": showSubmitLabel ? void 0 : resolvedSubmitLabel,
|
|
4071
|
+
"data-keep-action": "create-collection",
|
|
4072
|
+
children: showSubmitLabel ? submitLabel ?? resolvedSubmitLabel : null
|
|
4073
|
+
}
|
|
4074
|
+
)
|
|
4075
|
+
] }),
|
|
4076
|
+
error ? /* @__PURE__ */ jsx15("p", { role: "alert", children: error }) : null
|
|
4077
|
+
]
|
|
4078
|
+
}
|
|
4079
|
+
);
|
|
4080
|
+
}
|
|
4081
|
+
|
|
3826
4082
|
// src/features/collection/KeepList.tsx
|
|
3827
4083
|
import { KeepErrorBoundary } from "@keepkit/core/react";
|
|
3828
4084
|
import { isValidElement as isValidElement6 } from "react";
|
|
@@ -3834,9 +4090,9 @@ import {
|
|
|
3834
4090
|
isValidElement as isValidElement4,
|
|
3835
4091
|
useContext as useContext3,
|
|
3836
4092
|
useEffect as useEffect8,
|
|
3837
|
-
useId as
|
|
4093
|
+
useId as useId3,
|
|
3838
4094
|
useRef as useRef7,
|
|
3839
|
-
useState as
|
|
4095
|
+
useState as useState13
|
|
3840
4096
|
} from "react";
|
|
3841
4097
|
|
|
3842
4098
|
// src/features/item/hooks/useKeepItemStatusBadge.ts
|
|
@@ -3879,10 +4135,10 @@ function getDisplayStatus(status) {
|
|
|
3879
4135
|
}
|
|
3880
4136
|
|
|
3881
4137
|
// src/features/item/KeepItemStatusBadge.tsx
|
|
3882
|
-
import { Fragment as Fragment8, jsx as
|
|
4138
|
+
import { Fragment as Fragment8, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3883
4139
|
function KeepItemStatusBadge({ status = "available", label, className, ...props }) {
|
|
3884
4140
|
const view = useKeepItemStatusBadge(status);
|
|
3885
|
-
return /* @__PURE__ */
|
|
4141
|
+
return /* @__PURE__ */ jsxs14(
|
|
3886
4142
|
"span",
|
|
3887
4143
|
{
|
|
3888
4144
|
...props,
|
|
@@ -3893,14 +4149,14 @@ function KeepItemStatusBadge({ status = "available", label, className, ...props
|
|
|
3893
4149
|
"data-status": status,
|
|
3894
4150
|
"data-item-status": view.resolvedStatus,
|
|
3895
4151
|
children: [
|
|
3896
|
-
/* @__PURE__ */
|
|
3897
|
-
/* @__PURE__ */
|
|
4152
|
+
/* @__PURE__ */ jsx16(StatusIcon, { name: view.icon }),
|
|
4153
|
+
/* @__PURE__ */ jsx16("span", { "data-status-label": "true", children: label ?? view.statusLabel })
|
|
3898
4154
|
]
|
|
3899
4155
|
}
|
|
3900
4156
|
);
|
|
3901
4157
|
}
|
|
3902
4158
|
function StatusIcon({ name }) {
|
|
3903
|
-
return /* @__PURE__ */
|
|
4159
|
+
return /* @__PURE__ */ jsxs14(
|
|
3904
4160
|
"svg",
|
|
3905
4161
|
{
|
|
3906
4162
|
"data-status-icon": name,
|
|
@@ -3915,18 +4171,18 @@ function StatusIcon({ name }) {
|
|
|
3915
4171
|
"aria-hidden": "true",
|
|
3916
4172
|
focusable: "false",
|
|
3917
4173
|
children: [
|
|
3918
|
-
name === "check" ? /* @__PURE__ */
|
|
3919
|
-
name === "clock" ? /* @__PURE__ */
|
|
3920
|
-
/* @__PURE__ */
|
|
3921
|
-
/* @__PURE__ */
|
|
4174
|
+
name === "check" ? /* @__PURE__ */ jsx16("path", { d: "m5 12 4 4L19 6" }) : null,
|
|
4175
|
+
name === "clock" ? /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
4176
|
+
/* @__PURE__ */ jsx16("circle", { cx: "12", cy: "12", r: "8" }),
|
|
4177
|
+
/* @__PURE__ */ jsx16("path", { d: "M12 7v5l3 2" })
|
|
3922
4178
|
] }) : null,
|
|
3923
|
-
name === "ban" ? /* @__PURE__ */
|
|
3924
|
-
/* @__PURE__ */
|
|
3925
|
-
/* @__PURE__ */
|
|
4179
|
+
name === "ban" ? /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
4180
|
+
/* @__PURE__ */ jsx16("circle", { cx: "12", cy: "12", r: "8" }),
|
|
4181
|
+
/* @__PURE__ */ jsx16("path", { d: "m6.5 6.5 11 11" })
|
|
3926
4182
|
] }) : null,
|
|
3927
|
-
name === "lock" ? /* @__PURE__ */
|
|
3928
|
-
/* @__PURE__ */
|
|
3929
|
-
/* @__PURE__ */
|
|
4183
|
+
name === "lock" ? /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
4184
|
+
/* @__PURE__ */ jsx16("rect", { x: "5", y: "10", width: "14", height: "10", rx: "2" }),
|
|
4185
|
+
/* @__PURE__ */ jsx16("path", { d: "M8 10V7a4 4 0 0 1 8 0v3" })
|
|
3930
4186
|
] }) : null
|
|
3931
4187
|
]
|
|
3932
4188
|
}
|
|
@@ -3934,16 +4190,16 @@ function StatusIcon({ name }) {
|
|
|
3934
4190
|
}
|
|
3935
4191
|
|
|
3936
4192
|
// src/features/status/hooks/useKeepStaleNotice.ts
|
|
3937
|
-
import { useKeepContext as
|
|
3938
|
-
import { useState as
|
|
4193
|
+
import { useKeepContext as useKeepContext5 } from "@keepkit/core/react";
|
|
4194
|
+
import { useState as useState12 } from "react";
|
|
3939
4195
|
function useKeepStaleNotice({ item, onRetry, onRemoved }) {
|
|
3940
|
-
const context =
|
|
4196
|
+
const context = useKeepContext5();
|
|
3941
4197
|
const emitFeedback = useKeepUiFeedback();
|
|
3942
4198
|
const removedMessage = useUiLabel("removedMessage");
|
|
3943
4199
|
const restoredMessage = useUiLabel("restoredMessage");
|
|
3944
4200
|
const undoLabel = useUiLabel("undo");
|
|
3945
|
-
const [isRetrying, setIsRetrying] =
|
|
3946
|
-
const [error, setError] =
|
|
4201
|
+
const [isRetrying, setIsRetrying] = useState12(false);
|
|
4202
|
+
const [error, setError] = useState12(null);
|
|
3947
4203
|
async function retry() {
|
|
3948
4204
|
setError(null);
|
|
3949
4205
|
setIsRetrying(true);
|
|
@@ -3989,7 +4245,7 @@ function useKeepStaleNotice({ item, onRetry, onRemoved }) {
|
|
|
3989
4245
|
};
|
|
3990
4246
|
}
|
|
3991
4247
|
function useKeepPruneStale({ statuses, onPruned }) {
|
|
3992
|
-
const context =
|
|
4248
|
+
const context = useKeepContext5();
|
|
3993
4249
|
const emitFeedback = useKeepUiFeedback();
|
|
3994
4250
|
const staleItems = context.items.filter((item) => item.status && statuses.includes(item.status));
|
|
3995
4251
|
const staleIds = staleItems.map((item) => item.id);
|
|
@@ -4023,7 +4279,7 @@ function useKeepPruneStale({ statuses, onPruned }) {
|
|
|
4023
4279
|
}
|
|
4024
4280
|
|
|
4025
4281
|
// src/features/status/KeepStaleNotice.tsx
|
|
4026
|
-
import { jsx as
|
|
4282
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4027
4283
|
function KeepStaleNotice({
|
|
4028
4284
|
item,
|
|
4029
4285
|
onRetry,
|
|
@@ -4035,32 +4291,36 @@ function KeepStaleNotice({
|
|
|
4035
4291
|
...props
|
|
4036
4292
|
}) {
|
|
4037
4293
|
const view = useKeepStaleNotice({ item, onRetry, onRemoved });
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
/* @__PURE__ */
|
|
4042
|
-
|
|
4294
|
+
const showRetryLabel = useUiLabelVisibility("retry");
|
|
4295
|
+
const showRemoveLabel = useUiLabelVisibility("removeFromList");
|
|
4296
|
+
return /* @__PURE__ */ jsxs15("aside", { ...props, className, "data-keepkit": "stale-notice", "data-state": view.error ? "error" : "stale", children: [
|
|
4297
|
+
/* @__PURE__ */ jsx17(KeepItemStatusBadge, { status: view.status }),
|
|
4298
|
+
children ?? (item.statusReason ? /* @__PURE__ */ jsx17("p", { children: item.statusReason }) : null),
|
|
4299
|
+
/* @__PURE__ */ jsxs15("div", { children: [
|
|
4300
|
+
/* @__PURE__ */ jsx17(
|
|
4043
4301
|
"button",
|
|
4044
4302
|
{
|
|
4045
4303
|
type: "button",
|
|
4046
4304
|
"data-keep-action": "retry-item",
|
|
4047
4305
|
onClick: () => void view.retry(),
|
|
4048
4306
|
disabled: view.isRetrying || view.isMutating,
|
|
4049
|
-
|
|
4307
|
+
"aria-label": showRetryLabel ? void 0 : view.labels.retry,
|
|
4308
|
+
children: showRetryLabel ? retryLabel ?? view.labels.retry : null
|
|
4050
4309
|
}
|
|
4051
4310
|
),
|
|
4052
|
-
/* @__PURE__ */
|
|
4311
|
+
/* @__PURE__ */ jsx17(
|
|
4053
4312
|
"button",
|
|
4054
4313
|
{
|
|
4055
4314
|
type: "button",
|
|
4056
4315
|
"data-keep-action": "remove-item",
|
|
4057
4316
|
onClick: () => void view.remove(),
|
|
4058
4317
|
disabled: view.isMutating,
|
|
4059
|
-
|
|
4318
|
+
"aria-label": showRemoveLabel ? void 0 : view.labels.remove,
|
|
4319
|
+
children: showRemoveLabel ? removeLabel ?? view.labels.remove : null
|
|
4060
4320
|
}
|
|
4061
4321
|
)
|
|
4062
4322
|
] }),
|
|
4063
|
-
view.error ? /* @__PURE__ */
|
|
4323
|
+
view.error ? /* @__PURE__ */ jsx17("p", { role: "alert", children: view.error instanceof Error ? view.error.message : view.labels.error }) : null
|
|
4064
4324
|
] });
|
|
4065
4325
|
}
|
|
4066
4326
|
function KeepPruneStaleButton({
|
|
@@ -4072,7 +4332,8 @@ function KeepPruneStaleButton({
|
|
|
4072
4332
|
...props
|
|
4073
4333
|
}) {
|
|
4074
4334
|
const view = useKeepPruneStale({ statuses, onPruned });
|
|
4075
|
-
|
|
4335
|
+
const showLabel = useUiLabelVisibility("pruneStale");
|
|
4336
|
+
return /* @__PURE__ */ jsx17(
|
|
4076
4337
|
"button",
|
|
4077
4338
|
{
|
|
4078
4339
|
...props,
|
|
@@ -4082,8 +4343,9 @@ function KeepPruneStaleButton({
|
|
|
4082
4343
|
"data-keep-action": "prune-stale",
|
|
4083
4344
|
"data-state": view.staleIds.length > 0 ? "available" : "empty",
|
|
4084
4345
|
disabled: view.staleIds.length === 0 || view.isMutating || disabled,
|
|
4346
|
+
"aria-label": showLabel ? void 0 : view.label,
|
|
4085
4347
|
onClick: () => void view.prune(),
|
|
4086
|
-
children: children ?? label ?? `${view.label} (${view.staleIds.length})`
|
|
4348
|
+
children: showLabel ? children ?? label ?? `${view.label} (${view.staleIds.length})` : null
|
|
4087
4349
|
}
|
|
4088
4350
|
);
|
|
4089
4351
|
}
|
|
@@ -4185,7 +4447,7 @@ function getDisplayStatus2(status) {
|
|
|
4185
4447
|
}
|
|
4186
4448
|
|
|
4187
4449
|
// src/features/item/KeepItemCard.tsx
|
|
4188
|
-
import { Fragment as Fragment9, jsx as
|
|
4450
|
+
import { Fragment as Fragment9, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4189
4451
|
var KeepItemCardContext = createContext3(null);
|
|
4190
4452
|
function useKeepItemCardCompound(part) {
|
|
4191
4453
|
const context = useContext3(KeepItemCardContext);
|
|
@@ -4201,6 +4463,7 @@ function KeepItemCardRoot({
|
|
|
4201
4463
|
renderImage,
|
|
4202
4464
|
renderTags,
|
|
4203
4465
|
showTags = true,
|
|
4466
|
+
showNote = false,
|
|
4204
4467
|
showSavedAt = true,
|
|
4205
4468
|
collectionLabels,
|
|
4206
4469
|
imageAlt,
|
|
@@ -4216,6 +4479,7 @@ function KeepItemCardRoot({
|
|
|
4216
4479
|
showEditButton = false,
|
|
4217
4480
|
onEdit,
|
|
4218
4481
|
editSlot,
|
|
4482
|
+
editFeatures,
|
|
4219
4483
|
saveButtonLabels,
|
|
4220
4484
|
asChild = false,
|
|
4221
4485
|
href: hrefOption,
|
|
@@ -4243,10 +4507,12 @@ function KeepItemCardRoot({
|
|
|
4243
4507
|
const contextQuery = useKeepSearchQuery();
|
|
4244
4508
|
const searchQuery = highlightQuery ?? contextQuery;
|
|
4245
4509
|
const contentChildren = asChild && isValidElement4(children) ? void 0 : children;
|
|
4246
|
-
const [isEditOpen, setEditOpen] =
|
|
4510
|
+
const [isEditOpen, setEditOpen] = useState13(false);
|
|
4247
4511
|
const editTriggerRef = useRef7(null);
|
|
4248
|
-
const editPanelId =
|
|
4512
|
+
const editPanelId = useId3();
|
|
4249
4513
|
const editLabel = useUiLabel("editSavedItem");
|
|
4514
|
+
const showEditLabel = useUiLabelVisibility("editSavedItem");
|
|
4515
|
+
const showSavedAtLabel = useUiLabelVisibility("saved");
|
|
4250
4516
|
const closeEdit = () => setEditOpen(false);
|
|
4251
4517
|
useEffect8(() => {
|
|
4252
4518
|
if (!isEditOpen) editTriggerRef.current?.focus();
|
|
@@ -4260,16 +4526,16 @@ function KeepItemCardRoot({
|
|
|
4260
4526
|
onClick: (event) => onOpen?.(item, event),
|
|
4261
4527
|
children: content
|
|
4262
4528
|
};
|
|
4263
|
-
return LinkComponent ? /* @__PURE__ */
|
|
4529
|
+
return LinkComponent ? /* @__PURE__ */ jsx18(LinkComponent, { ...linkProps }) : /* @__PURE__ */ jsx18("a", { ...linkProps });
|
|
4264
4530
|
}
|
|
4265
4531
|
function renderTitle(content) {
|
|
4266
4532
|
if (linkTarget !== "title") return content;
|
|
4267
4533
|
if (view.isAvailable) return renderLink(content);
|
|
4268
|
-
return view.href ? /* @__PURE__ */
|
|
4534
|
+
return view.href ? /* @__PURE__ */ jsx18("span", { "aria-disabled": "true", "data-link-disabled": "true", children: content }) : content;
|
|
4269
4535
|
}
|
|
4270
4536
|
const resolvedImageProps = view.imageProps ? { ...view.imageProps, alt: imageAlt ?? view.imageProps.alt } : void 0;
|
|
4271
4537
|
const imageSource = resolvedImageProps?.src;
|
|
4272
|
-
const [imageStatus, setImageStatus] =
|
|
4538
|
+
const [imageStatus, setImageStatus] = useState13(imageSource ? "loading" : "error");
|
|
4273
4539
|
useEffect8(() => {
|
|
4274
4540
|
setImageStatus(imageSource ? "loading" : "error");
|
|
4275
4541
|
}, [imageSource]);
|
|
@@ -4288,44 +4554,47 @@ function KeepItemCardRoot({
|
|
|
4288
4554
|
setImageStatus("error");
|
|
4289
4555
|
}
|
|
4290
4556
|
};
|
|
4291
|
-
image = renderImage?.(imagePropsWithHandlers, item) ?? (ImageComponent ? /* @__PURE__ */
|
|
4557
|
+
image = renderImage?.(imagePropsWithHandlers, item) ?? (ImageComponent ? /* @__PURE__ */ jsx18(ImageComponent, { ...imagePropsWithHandlers }) : /* @__PURE__ */ jsx18("img", { ...imagePropsWithHandlers, alt: imagePropsWithHandlers.alt }));
|
|
4292
4558
|
}
|
|
4293
4559
|
const tags = showTags ? item.tags ?? [] : [];
|
|
4294
4560
|
const renderedTags = showTags && tags.length > 0 ? renderTags?.(tags, item) ?? null : null;
|
|
4295
|
-
const meta = showSavedAt ? /* @__PURE__ */
|
|
4296
|
-
/* @__PURE__ */
|
|
4561
|
+
const meta = showSavedAt ? /* @__PURE__ */ jsxs16("div", { "data-card-meta": true, children: [
|
|
4562
|
+
showSavedAtLabel ? /* @__PURE__ */ jsxs16("span", { children: [
|
|
4297
4563
|
view.labels.savedAt,
|
|
4298
4564
|
":"
|
|
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
4565
|
] }) : null,
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4566
|
+
showSavedAtLabel ? " " : null,
|
|
4567
|
+
/* @__PURE__ */ jsx18("time", { dateTime: new Date(item.savedAt).toISOString(), children: formatSavedAt(item.savedAt) })
|
|
4568
|
+
] }) : null;
|
|
4569
|
+
const error = view.itemState.error ? /* @__PURE__ */ jsx18("p", { role: "alert", children: getErrorMessage3(view.itemState.error, view.labels.error) }) : null;
|
|
4570
|
+
const actions = view.statusLabel ? /* @__PURE__ */ jsx18(KeepStaleNotice, { item, onRetry, onRemoved }) : /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
4571
|
+
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, features: editFeatures }) }) : /* @__PURE__ */ jsx18(
|
|
4572
|
+
"button",
|
|
4573
|
+
{
|
|
4574
|
+
ref: editTriggerRef,
|
|
4575
|
+
type: "button",
|
|
4576
|
+
"data-keep-action": "edit",
|
|
4577
|
+
"aria-label": showEditLabel ? void 0 : editLabel,
|
|
4578
|
+
"aria-haspopup": "dialog",
|
|
4579
|
+
"aria-expanded": false,
|
|
4580
|
+
"aria-controls": editPanelId,
|
|
4581
|
+
onClick: () => {
|
|
4582
|
+
onEdit?.(item);
|
|
4583
|
+
setEditOpen(true);
|
|
4584
|
+
},
|
|
4585
|
+
children: showEditLabel ? editLabel : null
|
|
4586
|
+
}
|
|
4587
|
+
) : null,
|
|
4588
|
+
isEditOpen ? null : /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
4589
|
+
showSaveButton ? /* @__PURE__ */ jsx18(KeepItemCardSave, {}) : null,
|
|
4590
|
+
showPinButton ? /* @__PURE__ */ jsx18(KeepItemCardPin, {}) : null,
|
|
4591
|
+
showArchiveButton ? /* @__PURE__ */ jsx18(KeepItemCardArchive, {}) : null,
|
|
4592
|
+
/* @__PURE__ */ jsx18(KeepItemCardRemove, {})
|
|
4593
|
+
] }),
|
|
4594
|
+
isEditOpen && (showPinButton || showArchiveButton) ? /* @__PURE__ */ jsxs16("div", { "data-keep-card-part": "actions-secondary", children: [
|
|
4595
|
+
showPinButton ? /* @__PURE__ */ jsx18(KeepItemCardPin, {}) : null,
|
|
4596
|
+
showArchiveButton ? /* @__PURE__ */ jsx18(KeepItemCardArchive, {}) : null
|
|
4597
|
+
] }) : null
|
|
4329
4598
|
] });
|
|
4330
4599
|
const compoundValue = {
|
|
4331
4600
|
item,
|
|
@@ -4335,6 +4604,7 @@ function KeepItemCardRoot({
|
|
|
4335
4604
|
image: imageStatus === "error" ? null : image,
|
|
4336
4605
|
imageStatus,
|
|
4337
4606
|
fallbackLabel: String(view.resolvedTitle),
|
|
4607
|
+
note: showNote ? item.note : void 0,
|
|
4338
4608
|
tags,
|
|
4339
4609
|
tagsLabel: view.labels.tags,
|
|
4340
4610
|
renderedTags,
|
|
@@ -4346,12 +4616,12 @@ function KeepItemCardRoot({
|
|
|
4346
4616
|
remove: view.remove,
|
|
4347
4617
|
isMutating: view.itemState.isMutating,
|
|
4348
4618
|
saveAriaLabel: `${view.labels.remove} ${String(view.resolvedTitle)}`,
|
|
4349
|
-
renderText: (content) => /* @__PURE__ */
|
|
4619
|
+
renderText: (content) => /* @__PURE__ */ jsx18(KeepHighlight, { query: searchQuery, children: content })
|
|
4350
4620
|
};
|
|
4351
|
-
const defaultBody = /* @__PURE__ */
|
|
4352
|
-
/* @__PURE__ */
|
|
4353
|
-
/* @__PURE__ */
|
|
4354
|
-
/* @__PURE__ */
|
|
4621
|
+
const defaultBody = /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
4622
|
+
/* @__PURE__ */ jsx18(KeepItemCardMedia, {}),
|
|
4623
|
+
/* @__PURE__ */ jsx18(KeepItemCardContent, {}),
|
|
4624
|
+
/* @__PURE__ */ jsx18(KeepItemCardActions, {})
|
|
4355
4625
|
] });
|
|
4356
4626
|
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? defaultBody;
|
|
4357
4627
|
const linkedBody = linkTarget === "card" && view.isAvailable ? renderLink(body) : body;
|
|
@@ -4373,18 +4643,19 @@ function KeepItemCardRoot({
|
|
|
4373
4643
|
linkedBody,
|
|
4374
4644
|
"KeepItemCard"
|
|
4375
4645
|
);
|
|
4376
|
-
return /* @__PURE__ */
|
|
4646
|
+
return /* @__PURE__ */ jsx18(KeepItemCardContext.Provider, { value: compoundValue, children: root });
|
|
4377
4647
|
}
|
|
4378
4648
|
function KeepItemCardMedia({ children, fallback, ...props }) {
|
|
4379
4649
|
const context = useKeepItemCardCompound("Media");
|
|
4380
|
-
return /* @__PURE__ */
|
|
4650
|
+
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
4651
|
}
|
|
4382
4652
|
function KeepItemCardContent({ children, ...props }) {
|
|
4383
4653
|
const context = useKeepItemCardCompound("Content");
|
|
4384
|
-
return /* @__PURE__ */
|
|
4385
|
-
/* @__PURE__ */
|
|
4654
|
+
return /* @__PURE__ */ jsx18("div", { ...props, "data-keep-card-part": "content", children: children === void 0 ? /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
4655
|
+
/* @__PURE__ */ jsx18(KeepItemCardTitle, {}),
|
|
4386
4656
|
context.meta,
|
|
4387
|
-
/* @__PURE__ */
|
|
4657
|
+
context.note ? /* @__PURE__ */ jsx18("p", { "data-keep-card-part": "memo-preview", "data-line-clamp": "2", children: context.note }) : null,
|
|
4658
|
+
/* @__PURE__ */ jsx18(KeepItemCardTags, {}),
|
|
4388
4659
|
context.error
|
|
4389
4660
|
] }) : context.renderText(children) });
|
|
4390
4661
|
}
|
|
@@ -4397,8 +4668,8 @@ function KeepItemCardTitle({ as = "h3", children, ...props }) {
|
|
|
4397
4668
|
);
|
|
4398
4669
|
}
|
|
4399
4670
|
function KeepMediaPlaceholderIcon() {
|
|
4400
|
-
return /* @__PURE__ */
|
|
4401
|
-
/* @__PURE__ */
|
|
4671
|
+
return /* @__PURE__ */ jsxs16("svg", { "data-media-fallback-icon": "true", viewBox: "0 0 24 24", "aria-hidden": "true", children: [
|
|
4672
|
+
/* @__PURE__ */ jsx18(
|
|
4402
4673
|
"path",
|
|
4403
4674
|
{
|
|
4404
4675
|
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 +4677,23 @@ function KeepMediaPlaceholderIcon() {
|
|
|
4406
4677
|
stroke: "currentColor"
|
|
4407
4678
|
}
|
|
4408
4679
|
),
|
|
4409
|
-
/* @__PURE__ */
|
|
4410
|
-
/* @__PURE__ */
|
|
4680
|
+
/* @__PURE__ */ jsx18("circle", { cx: "9", cy: "9", r: "1.5", fill: "currentColor" }),
|
|
4681
|
+
/* @__PURE__ */ jsx18("path", { d: "m5.5 18 4.5-4.5 3 3 2-2L19 18", fill: "none", stroke: "currentColor" })
|
|
4411
4682
|
] });
|
|
4412
4683
|
}
|
|
4413
4684
|
function KeepItemCardTags({ children, ...props }) {
|
|
4414
4685
|
const context = useKeepItemCardCompound("Tags");
|
|
4415
4686
|
if (children === void 0 && context.renderedTags) return context.renderedTags;
|
|
4416
4687
|
if (children === void 0 && context.tags.length === 0) return null;
|
|
4417
|
-
return /* @__PURE__ */
|
|
4688
|
+
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
4689
|
}
|
|
4419
4690
|
function KeepItemCardActions({ children, ...props }) {
|
|
4420
4691
|
const context = useKeepItemCardCompound("Actions");
|
|
4421
|
-
return /* @__PURE__ */
|
|
4692
|
+
return /* @__PURE__ */ jsx18("div", { ...props, "data-keep-card-part": "actions", children: children ?? context.actions });
|
|
4422
4693
|
}
|
|
4423
4694
|
function KeepItemCardSave({ labels, getAriaLabel, ...props }) {
|
|
4424
4695
|
const context = useKeepItemCardCompound("Save");
|
|
4425
|
-
return /* @__PURE__ */
|
|
4696
|
+
return /* @__PURE__ */ jsx18(
|
|
4426
4697
|
KeepButton,
|
|
4427
4698
|
{
|
|
4428
4699
|
...props,
|
|
@@ -4435,7 +4706,7 @@ function KeepItemCardSave({ labels, getAriaLabel, ...props }) {
|
|
|
4435
4706
|
}
|
|
4436
4707
|
function KeepItemCardRemove({ children, disabled, onClick, ...props }) {
|
|
4437
4708
|
const context = useKeepItemCardCompound("Remove");
|
|
4438
|
-
return /* @__PURE__ */
|
|
4709
|
+
return /* @__PURE__ */ jsx18(
|
|
4439
4710
|
"button",
|
|
4440
4711
|
{
|
|
4441
4712
|
...props,
|
|
@@ -4452,19 +4723,19 @@ function KeepItemCardRemove({ children, disabled, onClick, ...props }) {
|
|
|
4452
4723
|
}
|
|
4453
4724
|
function KeepItemCardPin({ children, ...props }) {
|
|
4454
4725
|
const context = useKeepItemCardCompound("Pin");
|
|
4455
|
-
return /* @__PURE__ */
|
|
4726
|
+
return /* @__PURE__ */ jsx18(KeepPinButton, { ...props, item: context.item, children });
|
|
4456
4727
|
}
|
|
4457
4728
|
function KeepItemCardArchive({
|
|
4458
4729
|
children,
|
|
4459
4730
|
...props
|
|
4460
4731
|
}) {
|
|
4461
4732
|
const context = useKeepItemCardCompound("Archive");
|
|
4462
|
-
return /* @__PURE__ */
|
|
4733
|
+
return /* @__PURE__ */ jsx18(KeepArchiveButton, { ...props, item: context.item, children });
|
|
4463
4734
|
}
|
|
4464
4735
|
function KeepItemCardCollectionBadge({ children, ...props }) {
|
|
4465
4736
|
const context = useKeepItemCardCompound("CollectionBadge");
|
|
4466
4737
|
if (!context.item.collectionId) return null;
|
|
4467
|
-
return /* @__PURE__ */
|
|
4738
|
+
return /* @__PURE__ */ jsx18("span", { ...props, "data-keep-card-part": "collection-badge", children: children ?? context.collectionLabel });
|
|
4468
4739
|
}
|
|
4469
4740
|
var KeepItemCard = Object.assign(KeepItemCardRoot, {
|
|
4470
4741
|
Media: KeepItemCardMedia,
|
|
@@ -4479,12 +4750,12 @@ var KeepItemCard = Object.assign(KeepItemCardRoot, {
|
|
|
4479
4750
|
CollectionBadge: KeepItemCardCollectionBadge
|
|
4480
4751
|
});
|
|
4481
4752
|
function KeepItemCardSkeleton({ layout = "list", ...props }) {
|
|
4482
|
-
return /* @__PURE__ */
|
|
4483
|
-
/* @__PURE__ */
|
|
4484
|
-
/* @__PURE__ */
|
|
4485
|
-
/* @__PURE__ */
|
|
4486
|
-
/* @__PURE__ */
|
|
4487
|
-
/* @__PURE__ */
|
|
4753
|
+
return /* @__PURE__ */ jsxs16("article", { ...props, "aria-hidden": "true", "data-keepkit": "card-skeleton", "data-layout": layout, "data-state": "loading", children: [
|
|
4754
|
+
/* @__PURE__ */ jsx18("span", { "data-skeleton-part": "media" }),
|
|
4755
|
+
/* @__PURE__ */ jsx18("span", { "data-skeleton-part": "title" }),
|
|
4756
|
+
/* @__PURE__ */ jsx18("span", { "data-skeleton-part": "meta" }),
|
|
4757
|
+
/* @__PURE__ */ jsx18("span", { "data-skeleton-part": "tag" }),
|
|
4758
|
+
/* @__PURE__ */ jsx18("span", { "data-skeleton-part": "tag" })
|
|
4488
4759
|
] });
|
|
4489
4760
|
}
|
|
4490
4761
|
function formatSavedAt(timestamp) {
|
|
@@ -4496,7 +4767,7 @@ function getErrorMessage3(error, fallback) {
|
|
|
4496
4767
|
|
|
4497
4768
|
// src/features/status/KeepEmptyState.tsx
|
|
4498
4769
|
import { isValidElement as isValidElement5 } from "react";
|
|
4499
|
-
import { Fragment as Fragment10, jsx as
|
|
4770
|
+
import { Fragment as Fragment10, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4500
4771
|
function KeepEmptyState({
|
|
4501
4772
|
title,
|
|
4502
4773
|
description,
|
|
@@ -4515,10 +4786,10 @@ function KeepEmptyState({
|
|
|
4515
4786
|
);
|
|
4516
4787
|
const clearLabel = useUiLabel("clearFilters");
|
|
4517
4788
|
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__ */
|
|
4789
|
+
const body = contentChildren ?? /* @__PURE__ */ jsxs17(Fragment10, { children: [
|
|
4790
|
+
/* @__PURE__ */ jsx19("h2", { children: title ?? defaultTitle }),
|
|
4791
|
+
description ?? /* @__PURE__ */ jsx19("p", { children: defaultDescription }),
|
|
4792
|
+
action ?? (resolvedVariant === "empty-filtered" && onClearFilters ? /* @__PURE__ */ jsx19("button", { type: "button", "data-keep-action": "clear-filters", onClick: onClearFilters, children: clearLabel }) : null)
|
|
4522
4793
|
] });
|
|
4523
4794
|
return renderRoot(
|
|
4524
4795
|
asChild,
|
|
@@ -4609,8 +4880,8 @@ function useRovingTabIndex() {
|
|
|
4609
4880
|
}
|
|
4610
4881
|
|
|
4611
4882
|
// src/features/collection/KeepReorderableList.tsx
|
|
4612
|
-
import { useState as
|
|
4613
|
-
import { jsx as
|
|
4883
|
+
import { useState as useState14 } from "react";
|
|
4884
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
4614
4885
|
function KeepReorderableList({
|
|
4615
4886
|
items,
|
|
4616
4887
|
onReorder,
|
|
@@ -4618,8 +4889,8 @@ function KeepReorderableList({
|
|
|
4618
4889
|
itemLabel = (_item, index) => `Move item ${index + 1}`,
|
|
4619
4890
|
...props
|
|
4620
4891
|
}) {
|
|
4621
|
-
const [draggedId, setDraggedId] =
|
|
4622
|
-
const [dropTargetIndex, setDropTargetIndex] =
|
|
4892
|
+
const [draggedId, setDraggedId] = useState14(null);
|
|
4893
|
+
const [dropTargetIndex, setDropTargetIndex] = useState14(null);
|
|
4623
4894
|
const ids = items.map((item) => item.id);
|
|
4624
4895
|
function commit(nextIds) {
|
|
4625
4896
|
void onReorder(nextIds);
|
|
@@ -4644,7 +4915,7 @@ function KeepReorderableList({
|
|
|
4644
4915
|
if (next[index] === id) return;
|
|
4645
4916
|
commit(next);
|
|
4646
4917
|
}
|
|
4647
|
-
return /* @__PURE__ */
|
|
4918
|
+
return /* @__PURE__ */ jsx20("ul", { ...props, "data-keepkit": "reorderable-list", children: items.map((item, index) => {
|
|
4648
4919
|
const moveUp = () => move(index, index - 1);
|
|
4649
4920
|
const moveDown = () => move(index, index + 1);
|
|
4650
4921
|
const onHandleKeyDown = (event) => {
|
|
@@ -4688,7 +4959,7 @@ function KeepReorderableList({
|
|
|
4688
4959
|
onKeyDown: onHandleKeyDown
|
|
4689
4960
|
}
|
|
4690
4961
|
};
|
|
4691
|
-
return /* @__PURE__ */
|
|
4962
|
+
return /* @__PURE__ */ jsx20(
|
|
4692
4963
|
"li",
|
|
4693
4964
|
{
|
|
4694
4965
|
"data-reorder-index": index,
|
|
@@ -4720,12 +4991,12 @@ function KeepReorderableList({
|
|
|
4720
4991
|
}
|
|
4721
4992
|
|
|
4722
4993
|
// src/features/collection/KeepList.tsx
|
|
4723
|
-
import { Fragment as Fragment11, jsx as
|
|
4994
|
+
import { Fragment as Fragment11, jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4724
4995
|
function KeepList(props) {
|
|
4725
4996
|
const { fallback, onBoundaryError, boundaryResetKey, ...listProps } = props;
|
|
4726
|
-
const content = /* @__PURE__ */
|
|
4997
|
+
const content = /* @__PURE__ */ jsx21(KeepListContent, { ...listProps });
|
|
4727
4998
|
if (fallback === void 0 && onBoundaryError === void 0) return content;
|
|
4728
|
-
return /* @__PURE__ */
|
|
4999
|
+
return /* @__PURE__ */ jsx21(KeepErrorBoundary, { fallback, onError: onBoundaryError, resetKey: boundaryResetKey, children: content });
|
|
4729
5000
|
}
|
|
4730
5001
|
function KeepListContent({
|
|
4731
5002
|
query,
|
|
@@ -4790,7 +5061,7 @@ function KeepListContent({
|
|
|
4790
5061
|
if (!event.defaultPrevented) roving.onFocusCapture(event);
|
|
4791
5062
|
}
|
|
4792
5063
|
},
|
|
4793
|
-
/* @__PURE__ */
|
|
5064
|
+
/* @__PURE__ */ jsx21(KeepSearchQueryProvider, { query: query?.search?.query, children: body }),
|
|
4794
5065
|
"KeepList"
|
|
4795
5066
|
);
|
|
4796
5067
|
}
|
|
@@ -4805,17 +5076,17 @@ function getListBody(state, options) {
|
|
|
4805
5076
|
if (state.isLoading && !state.isHydrated) {
|
|
4806
5077
|
if (options.loading !== void 0) return resolveContent(options.loading, state);
|
|
4807
5078
|
const count = Number.isFinite(options.loadingCount) ? Math.max(0, Math.floor(options.loadingCount)) : 6;
|
|
4808
|
-
return /* @__PURE__ */
|
|
4809
|
-
/* @__PURE__ */
|
|
4810
|
-
/* @__PURE__ */
|
|
5079
|
+
return /* @__PURE__ */ jsxs18(Fragment11, { children: [
|
|
5080
|
+
/* @__PURE__ */ jsx21("span", { role: "status", "data-keepkit": "loading-label", children: options.loadingLabel }),
|
|
5081
|
+
/* @__PURE__ */ jsx21("ul", { "data-keepkit": "skeleton-list", "data-layout": options.layout, children: Array.from({ length: count }, (_, index) => (
|
|
4811
5082
|
// biome-ignore lint/suspicious/noArrayIndexKey: Static loading placeholders never reorder.
|
|
4812
|
-
/* @__PURE__ */
|
|
5083
|
+
/* @__PURE__ */ jsx21("li", { children: /* @__PURE__ */ jsx21(KeepItemCardSkeleton, { layout: options.layout }) }, index)
|
|
4813
5084
|
)) })
|
|
4814
5085
|
] });
|
|
4815
5086
|
}
|
|
4816
5087
|
if (state.isHydrated && state.items.length === 0) {
|
|
4817
5088
|
if (options.empty !== void 0) return resolveContent(options.empty, state);
|
|
4818
|
-
return /* @__PURE__ */
|
|
5089
|
+
return /* @__PURE__ */ jsx21(
|
|
4819
5090
|
KeepEmptyState,
|
|
4820
5091
|
{
|
|
4821
5092
|
variant: options.allItemCount > 0 && hasActiveQueryFilters(options.query) ? "empty-filtered" : "empty-storage",
|
|
@@ -4826,7 +5097,7 @@ function getListBody(state, options) {
|
|
|
4826
5097
|
if (typeof options.children === "function") return options.children(state);
|
|
4827
5098
|
if (options.children !== void 0 && !isValidElement6(options.children)) return options.children;
|
|
4828
5099
|
if (options.reorderable) {
|
|
4829
|
-
return /* @__PURE__ */
|
|
5100
|
+
return /* @__PURE__ */ jsx21(
|
|
4830
5101
|
KeepReorderableList,
|
|
4831
5102
|
{
|
|
4832
5103
|
items: state.items,
|
|
@@ -4834,16 +5105,16 @@ function getListBody(state, options) {
|
|
|
4834
5105
|
await options.reorder(orderedIds);
|
|
4835
5106
|
await options.onReorder?.(orderedIds);
|
|
4836
5107
|
},
|
|
4837
|
-
renderItem: (item, reorderState) => /* @__PURE__ */
|
|
4838
|
-
/* @__PURE__ */
|
|
4839
|
-
options.renderItem ? options.renderItem(item, state) : /* @__PURE__ */
|
|
5108
|
+
renderItem: (item, reorderState) => /* @__PURE__ */ jsxs18(Fragment11, { children: [
|
|
5109
|
+
/* @__PURE__ */ jsx21("button", { type: "button", ...reorderState.dragHandleProps, children: "\u2195" }),
|
|
5110
|
+
options.renderItem ? options.renderItem(item, state) : /* @__PURE__ */ jsx21(KeepItemCard, { item, ...options.itemCardProps })
|
|
4840
5111
|
] }),
|
|
4841
5112
|
"data-layout": options.layout
|
|
4842
5113
|
}
|
|
4843
5114
|
);
|
|
4844
5115
|
}
|
|
4845
|
-
return /* @__PURE__ */
|
|
4846
|
-
(item) => options.renderItem ? options.renderItem(item, state) : /* @__PURE__ */
|
|
5116
|
+
return /* @__PURE__ */ jsx21("ul", { "data-layout": options.layout, children: state.items.map(
|
|
5117
|
+
(item) => options.renderItem ? options.renderItem(item, state) : /* @__PURE__ */ jsx21("li", { children: /* @__PURE__ */ jsx21(KeepItemCard, { item, ...options.itemCardProps }) }, item.id)
|
|
4847
5118
|
) });
|
|
4848
5119
|
}
|
|
4849
5120
|
function hasActiveQueryFilters(query) {
|
|
@@ -4854,12 +5125,12 @@ function hasActiveQueryFilters(query) {
|
|
|
4854
5125
|
}
|
|
4855
5126
|
|
|
4856
5127
|
// src/features/collection/KeepCollection.tsx
|
|
4857
|
-
import { Fragment as Fragment12, jsx as
|
|
5128
|
+
import { Fragment as Fragment12, jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4858
5129
|
function KeepCollection(props) {
|
|
4859
5130
|
const { fallback, onBoundaryError, boundaryResetKey, ...collectionProps } = props;
|
|
4860
|
-
const content = /* @__PURE__ */
|
|
5131
|
+
const content = /* @__PURE__ */ jsx22(KeepCollectionContent, { ...collectionProps });
|
|
4861
5132
|
if (fallback === void 0 && onBoundaryError === void 0) return content;
|
|
4862
|
-
return /* @__PURE__ */
|
|
5133
|
+
return /* @__PURE__ */ jsx22(KeepErrorBoundary2, { fallback, onError: onBoundaryError, resetKey: boundaryResetKey, children: content });
|
|
4863
5134
|
}
|
|
4864
5135
|
function KeepCollectionContent({
|
|
4865
5136
|
query = {},
|
|
@@ -4876,6 +5147,7 @@ function KeepCollectionContent({
|
|
|
4876
5147
|
features,
|
|
4877
5148
|
slots,
|
|
4878
5149
|
collectionLabels,
|
|
5150
|
+
creatable = false,
|
|
4879
5151
|
renderItem,
|
|
4880
5152
|
itemCardProps,
|
|
4881
5153
|
loading,
|
|
@@ -4888,7 +5160,7 @@ function KeepCollectionContent({
|
|
|
4888
5160
|
...rootProps
|
|
4889
5161
|
}) {
|
|
4890
5162
|
const view = useKeepCollection({ query, pageSize, urlSync, urlAdapter, features, archiveScope });
|
|
4891
|
-
const [reorderUndoIds, setReorderUndoIds] =
|
|
5163
|
+
const [reorderUndoIds, setReorderUndoIds] = useState15(null);
|
|
4892
5164
|
const reorderUndoLabel = useUiLabel("undoReorder");
|
|
4893
5165
|
const handleReorder = async (orderedIds) => {
|
|
4894
5166
|
const previousIds = view.list.items.map((item) => item.id);
|
|
@@ -4916,19 +5188,21 @@ function KeepCollectionContent({
|
|
|
4916
5188
|
...itemCardProps,
|
|
4917
5189
|
showTags: itemCardProps?.showTags ?? view.enabled.tags,
|
|
4918
5190
|
showPinButton: itemCardProps?.showPinButton ?? view.enabled.pin,
|
|
4919
|
-
showArchiveButton: itemCardProps?.showArchiveButton ?? view.enabled.archive
|
|
5191
|
+
showArchiveButton: itemCardProps?.showArchiveButton ?? view.enabled.archive,
|
|
5192
|
+
showEditButton: itemCardProps?.showEditButton ?? view.enabled.note,
|
|
5193
|
+
showNote: itemCardProps?.showNote ?? view.enabled.note
|
|
4920
5194
|
};
|
|
4921
|
-
const toolbarId =
|
|
4922
|
-
const structuredToolbar = toolbarLayout === "grouped" || toolbarVariant === "panel" || slots?.toolbarStart !== void 0 || slots?.toolbarEnd !== void 0;
|
|
5195
|
+
const toolbarId = useId4();
|
|
5196
|
+
const structuredToolbar = toolbarLayout === "grouped" || toolbarVariant === "panel" || creatable || slots?.toolbarStart !== void 0 || slots?.toolbarEnd !== void 0;
|
|
4923
5197
|
const hasQueryControls = view.enabled.search || view.enabled.sort;
|
|
4924
5198
|
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__ */
|
|
5199
|
+
const queryControls = hasQueryControls ? /* @__PURE__ */ jsxs19(Fragment12, { children: [
|
|
5200
|
+
view.enabled.search ? /* @__PURE__ */ jsx22(KeepSearchInput, { value: view.searchValue, onValueChange: view.setSearchValue }) : null,
|
|
5201
|
+
view.enabled.sort ? /* @__PURE__ */ jsx22(KeepSortSelect, { value: view.sortValue, onValueChange: view.setSortValue }) : null
|
|
4928
5202
|
] }) : null;
|
|
4929
|
-
const filterControls = hasFilterControls ? /* @__PURE__ */
|
|
4930
|
-
view.enabled.tagFilter ? /* @__PURE__ */
|
|
4931
|
-
view.enabled.collectionFilter ? /* @__PURE__ */
|
|
5203
|
+
const filterControls = hasFilterControls ? /* @__PURE__ */ jsxs19(Fragment12, { children: [
|
|
5204
|
+
view.enabled.tagFilter ? /* @__PURE__ */ jsx22(KeepTagFilter, { query, value: view.activeTags[0], onValueChange: view.setTag }) : null,
|
|
5205
|
+
view.enabled.collectionFilter ? /* @__PURE__ */ jsx22(
|
|
4932
5206
|
KeepCollectionFilter,
|
|
4933
5207
|
{
|
|
4934
5208
|
value: view.activeCollection,
|
|
@@ -4936,7 +5210,7 @@ function KeepCollectionContent({
|
|
|
4936
5210
|
collectionLabels
|
|
4937
5211
|
}
|
|
4938
5212
|
) : null,
|
|
4939
|
-
archiveScope !== void 0 ? /* @__PURE__ */
|
|
5213
|
+
archiveScope !== void 0 ? /* @__PURE__ */ jsx22(
|
|
4940
5214
|
KeepArchiveScopeSelect,
|
|
4941
5215
|
{
|
|
4942
5216
|
value: view.archiveScope,
|
|
@@ -4952,12 +5226,13 @@ function KeepCollectionContent({
|
|
|
4952
5226
|
const toolbarFiltersLabel = useUiLabel("toolbarFilters");
|
|
4953
5227
|
const toolbarEndLabel = useUiLabel("toolbarEnd");
|
|
4954
5228
|
const toolbarStartContent = slots?.toolbarStart === void 0 ? null : resolveContent(slots.toolbarStart, view.list);
|
|
4955
|
-
const
|
|
5229
|
+
const creatableContent = creatable ? /* @__PURE__ */ jsx22(KeepCollectionCreate, {}) : null;
|
|
5230
|
+
const toolbarEndContent = creatableContent ?? (slots?.toolbarEnd === void 0 ? null : resolveContent(slots.toolbarEnd, view.list));
|
|
4956
5231
|
const hasToolbarContent = hasQueryControls || hasFilterControls || hasRenderableContent(toolbarStartContent) || hasRenderableContent(toolbarEndContent);
|
|
4957
5232
|
const renderToolbarGroup = (group, content, label) => {
|
|
4958
5233
|
if (!hasRenderableContent(content)) return null;
|
|
4959
5234
|
const labelId = `${toolbarId}-${group}`;
|
|
4960
|
-
return /* @__PURE__ */
|
|
5235
|
+
return /* @__PURE__ */ jsxs19(
|
|
4961
5236
|
"fieldset",
|
|
4962
5237
|
{
|
|
4963
5238
|
"data-keepkit": "collection-toolbar-group",
|
|
@@ -4965,22 +5240,22 @@ function KeepCollectionContent({
|
|
|
4965
5240
|
role: "group",
|
|
4966
5241
|
"aria-labelledby": labelId,
|
|
4967
5242
|
children: [
|
|
4968
|
-
/* @__PURE__ */
|
|
4969
|
-
/* @__PURE__ */
|
|
5243
|
+
/* @__PURE__ */ jsx22("legend", { id: labelId, "data-keepkit": "collection-toolbar-label", children: label }),
|
|
5244
|
+
/* @__PURE__ */ jsx22("div", { "data-keepkit": "collection-toolbar-content", children: content })
|
|
4970
5245
|
]
|
|
4971
5246
|
}
|
|
4972
5247
|
);
|
|
4973
5248
|
};
|
|
4974
|
-
const toolbar = !structuredToolbar ? /* @__PURE__ */
|
|
5249
|
+
const toolbar = !structuredToolbar ? /* @__PURE__ */ jsxs19("div", { children: [
|
|
4975
5250
|
queryControls,
|
|
4976
5251
|
filterControls
|
|
4977
|
-
] }) : !hasToolbarContent ? null : /* @__PURE__ */
|
|
5252
|
+
] }) : !hasToolbarContent ? null : /* @__PURE__ */ jsxs19("div", { "data-keepkit": "collection-toolbar", "data-variant": toolbarVariant, "data-layout": toolbarLayout, children: [
|
|
4978
5253
|
renderToolbarGroup("toolbarStart", toolbarStartContent, toolbarStartLabel),
|
|
4979
5254
|
renderToolbarGroup("query", queryControls, toolbarQueryLabel),
|
|
4980
5255
|
renderToolbarGroup("filters", filterControls, toolbarFiltersLabel),
|
|
4981
5256
|
renderToolbarGroup("toolbarEnd", toolbarEndContent, toolbarEndLabel)
|
|
4982
5257
|
] });
|
|
4983
|
-
return /* @__PURE__ */
|
|
5258
|
+
return /* @__PURE__ */ jsxs19(
|
|
4984
5259
|
"section",
|
|
4985
5260
|
{
|
|
4986
5261
|
...rootProps,
|
|
@@ -4994,7 +5269,7 @@ function KeepCollectionContent({
|
|
|
4994
5269
|
"data-loading": view.list.isLoading || view.list.isMutating ? "true" : void 0,
|
|
4995
5270
|
children: [
|
|
4996
5271
|
toolbar,
|
|
4997
|
-
activeFilters === void 0 ? /* @__PURE__ */
|
|
5272
|
+
activeFilters === void 0 ? /* @__PURE__ */ jsx22(
|
|
4998
5273
|
KeepActiveFiltersSummary,
|
|
4999
5274
|
{
|
|
5000
5275
|
search: view.searchValue,
|
|
@@ -5004,7 +5279,7 @@ function KeepCollectionContent({
|
|
|
5004
5279
|
onClear: view.clearFilters
|
|
5005
5280
|
}
|
|
5006
5281
|
) : resolveContent(activeFilters, view.list),
|
|
5007
|
-
/* @__PURE__ */
|
|
5282
|
+
/* @__PURE__ */ jsx22(
|
|
5008
5283
|
KeepList,
|
|
5009
5284
|
{
|
|
5010
5285
|
query: view.resolvedQuery,
|
|
@@ -5021,7 +5296,7 @@ function KeepCollectionContent({
|
|
|
5021
5296
|
error
|
|
5022
5297
|
}
|
|
5023
5298
|
),
|
|
5024
|
-
view.enabled.pagination ? /* @__PURE__ */
|
|
5299
|
+
view.enabled.pagination ? /* @__PURE__ */ jsx22(
|
|
5025
5300
|
KeepPagination,
|
|
5026
5301
|
{
|
|
5027
5302
|
totalCount: view.list.totalCount,
|
|
@@ -5030,8 +5305,8 @@ function KeepCollectionContent({
|
|
|
5030
5305
|
onPageChange: view.setPage
|
|
5031
5306
|
}
|
|
5032
5307
|
) : null,
|
|
5033
|
-
view.enabled.bulkActions ? /* @__PURE__ */
|
|
5034
|
-
reorderable && reorderUndoIds ? /* @__PURE__ */
|
|
5308
|
+
view.enabled.bulkActions ? /* @__PURE__ */ jsx22(KeepBulkActions, { query: view.resolvedQuery }) : null,
|
|
5309
|
+
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
5310
|
]
|
|
5036
5311
|
}
|
|
5037
5312
|
);
|
|
@@ -5044,12 +5319,12 @@ function getCollectionState(list) {
|
|
|
5044
5319
|
}
|
|
5045
5320
|
|
|
5046
5321
|
// src/features/collection/KeepLayout.tsx
|
|
5047
|
-
import { jsx as
|
|
5322
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
5048
5323
|
function KeepLayout({ layout = "list", children, onKeyDown, onFocusCapture, ...props }) {
|
|
5049
5324
|
const roving = useRovingTabIndex();
|
|
5050
5325
|
return (
|
|
5051
5326
|
// biome-ignore lint/a11y/noStaticElementInteractions: The group manages keyboard focus for descendant cards.
|
|
5052
|
-
/* @__PURE__ */
|
|
5327
|
+
/* @__PURE__ */ jsx23(
|
|
5053
5328
|
"div",
|
|
5054
5329
|
{
|
|
5055
5330
|
...props,
|
|
@@ -5076,7 +5351,7 @@ function KeepLayout({ layout = "list", children, onKeyDown, onFocusCapture, ...p
|
|
|
5076
5351
|
import { isValidElement as isValidElement7 } from "react";
|
|
5077
5352
|
|
|
5078
5353
|
// src/features/navigation/KeepShortcutHint.tsx
|
|
5079
|
-
import { jsx as
|
|
5354
|
+
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5080
5355
|
function KeepShortcutHint({ shortcut, separator = "+", ...props }) {
|
|
5081
5356
|
const keys = typeof shortcut === "string" ? shortcut.split("+") : [...shortcut];
|
|
5082
5357
|
const occurrences = /* @__PURE__ */ new Map();
|
|
@@ -5085,19 +5360,19 @@ function KeepShortcutHint({ shortcut, separator = "+", ...props }) {
|
|
|
5085
5360
|
occurrences.set(key, occurrence + 1);
|
|
5086
5361
|
return { id: `${key}-${occurrence}`, value: key };
|
|
5087
5362
|
});
|
|
5088
|
-
return /* @__PURE__ */
|
|
5089
|
-
index > 0 ? /* @__PURE__ */
|
|
5090
|
-
/* @__PURE__ */
|
|
5363
|
+
return /* @__PURE__ */ jsx24("span", { ...props, "data-keepkit": "shortcut-hint", "aria-hidden": props["aria-hidden"] ?? true, children: keyedKeys.map((key, index) => /* @__PURE__ */ jsxs20("span", { children: [
|
|
5364
|
+
index > 0 ? /* @__PURE__ */ jsx24("span", { "data-shortcut-separator": "true", children: separator }) : null,
|
|
5365
|
+
/* @__PURE__ */ jsx24("kbd", { children: key.value.trim() })
|
|
5091
5366
|
] }, key.id)) });
|
|
5092
5367
|
}
|
|
5093
5368
|
|
|
5094
5369
|
// src/features/editor/hooks/useKeepNoteEditor.ts
|
|
5095
5370
|
import { useKeepItem as useKeepItem6 } from "@keepkit/core/react";
|
|
5096
|
-
import { useCallback as useCallback6, useEffect as useEffect11, useRef as useRef9, useState as
|
|
5371
|
+
import { useCallback as useCallback6, useEffect as useEffect11, useRef as useRef9, useState as useState16 } from "react";
|
|
5097
5372
|
function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
5098
5373
|
const itemState = useKeepItem6(item);
|
|
5099
5374
|
const { error, isMutating, item: savedItem, updateNote } = itemState;
|
|
5100
|
-
const [note, setNote] =
|
|
5375
|
+
const [note, setNote] = useState16(item.note ?? "");
|
|
5101
5376
|
const baselineNote = savedItem?.note ?? item.note ?? "";
|
|
5102
5377
|
const isDirty = note !== baselineNote;
|
|
5103
5378
|
const lastSavedNoteRef = useRef9(void 0);
|
|
@@ -5148,7 +5423,7 @@ function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
|
5148
5423
|
}
|
|
5149
5424
|
|
|
5150
5425
|
// src/features/editor/KeepNoteEditor.tsx
|
|
5151
|
-
import { Fragment as Fragment13, jsx as
|
|
5426
|
+
import { Fragment as Fragment13, jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5152
5427
|
function KeepNoteEditor({
|
|
5153
5428
|
item,
|
|
5154
5429
|
label,
|
|
@@ -5165,15 +5440,20 @@ function KeepNoteEditor({
|
|
|
5165
5440
|
...formProps
|
|
5166
5441
|
}) {
|
|
5167
5442
|
const view = useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError });
|
|
5443
|
+
const showNoteLabel = useUiLabelVisibility("note");
|
|
5444
|
+
const noteAccessibleLabel = useUiLabel("note");
|
|
5445
|
+
const showSaveLabel = useUiLabelVisibility("saveNote");
|
|
5446
|
+
const saveAccessibleLabel = useUiLabel("saveNote");
|
|
5168
5447
|
const { error, isDirty, isSaving, note, setNote } = view.state;
|
|
5169
5448
|
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__ */
|
|
5449
|
+
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */ jsxs21(Fragment13, { children: [
|
|
5450
|
+
/* @__PURE__ */ jsxs21("label", { children: [
|
|
5451
|
+
showNoteLabel ? label ?? view.labels.note : null,
|
|
5452
|
+
/* @__PURE__ */ jsx25(
|
|
5174
5453
|
"textarea",
|
|
5175
5454
|
{
|
|
5176
5455
|
"data-keep-action": "edit-note",
|
|
5456
|
+
"aria-label": showNoteLabel ? void 0 : noteAccessibleLabel,
|
|
5177
5457
|
value: note,
|
|
5178
5458
|
onChange: (event) => setNote(event.currentTarget.value),
|
|
5179
5459
|
placeholder,
|
|
@@ -5182,13 +5462,23 @@ function KeepNoteEditor({
|
|
|
5182
5462
|
}
|
|
5183
5463
|
)
|
|
5184
5464
|
] }),
|
|
5185
|
-
/* @__PURE__ */
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5465
|
+
/* @__PURE__ */ jsxs21(
|
|
5466
|
+
"button",
|
|
5467
|
+
{
|
|
5468
|
+
type: "submit",
|
|
5469
|
+
"data-keep-action": "save-note",
|
|
5470
|
+
disabled: isSaving,
|
|
5471
|
+
"aria-busy": isSaving,
|
|
5472
|
+
"aria-label": showSaveLabel ? void 0 : saveAccessibleLabel,
|
|
5473
|
+
children: [
|
|
5474
|
+
showSaveLabel ? saveLabel ?? view.labels.save : null,
|
|
5475
|
+
showShortcutHint ? /* @__PURE__ */ jsx25(KeepShortcutHint, { shortcut: "Ctrl+Enter" }) : null
|
|
5476
|
+
]
|
|
5477
|
+
}
|
|
5478
|
+
)
|
|
5189
5479
|
] });
|
|
5190
5480
|
if (!asChild) {
|
|
5191
|
-
return /* @__PURE__ */
|
|
5481
|
+
return /* @__PURE__ */ jsxs21(
|
|
5192
5482
|
"form",
|
|
5193
5483
|
{
|
|
5194
5484
|
...formProps,
|
|
@@ -5201,7 +5491,7 @@ function KeepNoteEditor({
|
|
|
5201
5491
|
"data-disabled": isSaving ? "true" : void 0,
|
|
5202
5492
|
children: [
|
|
5203
5493
|
body,
|
|
5204
|
-
error ? /* @__PURE__ */
|
|
5494
|
+
error ? /* @__PURE__ */ jsx25("p", { role: "alert", children: getErrorMessage4(error, view.labels.error) }) : null
|
|
5205
5495
|
]
|
|
5206
5496
|
}
|
|
5207
5497
|
);
|
|
@@ -5229,11 +5519,11 @@ function getErrorMessage4(error, fallback) {
|
|
|
5229
5519
|
|
|
5230
5520
|
// src/features/editor/hooks/useKeepTagEditor.ts
|
|
5231
5521
|
import { useKeepItem as useKeepItem7 } from "@keepkit/core/react";
|
|
5232
|
-
import { useCallback as useCallback7, useEffect as useEffect12, useState as
|
|
5522
|
+
import { useCallback as useCallback7, useEffect as useEffect12, useState as useState17 } from "react";
|
|
5233
5523
|
function useKeepTagEditor({ item, onSaved, onSaveError }) {
|
|
5234
5524
|
const itemState = useKeepItem7(item);
|
|
5235
|
-
const [tags, setTags] =
|
|
5236
|
-
const [input, setInput] =
|
|
5525
|
+
const [tags, setTags] = useState17(item.tags ?? []);
|
|
5526
|
+
const [input, setInput] = useState17("");
|
|
5237
5527
|
useEffect12(() => setTags(itemState.item?.tags ?? item.tags ?? []), [item.tags, itemState.item?.tags]);
|
|
5238
5528
|
const save = useCallback7(async () => {
|
|
5239
5529
|
const nextTags = normalizeUiTags(tags);
|
|
@@ -5281,7 +5571,7 @@ function useKeepTagEditor({ item, onSaved, onSaveError }) {
|
|
|
5281
5571
|
}
|
|
5282
5572
|
|
|
5283
5573
|
// src/features/editor/KeepTagEditor.tsx
|
|
5284
|
-
import { Fragment as Fragment14, jsx as
|
|
5574
|
+
import { Fragment as Fragment14, jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5285
5575
|
function KeepTagEditor({
|
|
5286
5576
|
item,
|
|
5287
5577
|
availableTags = [],
|
|
@@ -5291,14 +5581,19 @@ function KeepTagEditor({
|
|
|
5291
5581
|
...props
|
|
5292
5582
|
}) {
|
|
5293
5583
|
const view = useKeepTagEditor({ item, onSaved, onSaveError });
|
|
5584
|
+
const showTagsLabel = useUiLabelVisibility("tags");
|
|
5585
|
+
const tagsAccessibleLabel = useUiLabel("tags");
|
|
5586
|
+
const showRemoveLabel = useUiLabelVisibility("remove");
|
|
5587
|
+
const showApplyLabel = useUiLabelVisibility("applyTags");
|
|
5294
5588
|
const { isSaving, tags } = view.state;
|
|
5295
|
-
const body = render ? render(view.state) : /* @__PURE__ */
|
|
5296
|
-
/* @__PURE__ */
|
|
5297
|
-
view.labels.tags,
|
|
5298
|
-
/* @__PURE__ */
|
|
5589
|
+
const body = render ? render(view.state) : /* @__PURE__ */ jsxs22(Fragment14, { children: [
|
|
5590
|
+
/* @__PURE__ */ jsxs22("label", { children: [
|
|
5591
|
+
showTagsLabel ? view.labels.tags : null,
|
|
5592
|
+
/* @__PURE__ */ jsx26(
|
|
5299
5593
|
"input",
|
|
5300
5594
|
{
|
|
5301
5595
|
"data-keep-action": "edit-tags",
|
|
5596
|
+
"aria-label": showTagsLabel ? void 0 : tagsAccessibleLabel,
|
|
5302
5597
|
value: view.input,
|
|
5303
5598
|
list: availableTags.length > 0 ? `keep-tags-${item.id}` : void 0,
|
|
5304
5599
|
onChange: (event) => view.setInput(event.currentTarget.value),
|
|
@@ -5306,14 +5601,33 @@ function KeepTagEditor({
|
|
|
5306
5601
|
}
|
|
5307
5602
|
)
|
|
5308
5603
|
] }),
|
|
5309
|
-
availableTags.length > 0 ? /* @__PURE__ */
|
|
5310
|
-
/* @__PURE__ */
|
|
5604
|
+
availableTags.length > 0 ? /* @__PURE__ */ jsx26("datalist", { id: `keep-tags-${item.id}`, children: availableTags.map((tag) => /* @__PURE__ */ jsx26("option", { value: tag }, tag)) }) : null,
|
|
5605
|
+
/* @__PURE__ */ jsx26("ul", { "aria-label": view.labels.tags, children: tags.map((tag) => /* @__PURE__ */ jsxs22("li", { children: [
|
|
5311
5606
|
tag,
|
|
5312
|
-
/* @__PURE__ */
|
|
5607
|
+
/* @__PURE__ */ jsx26(
|
|
5608
|
+
"button",
|
|
5609
|
+
{
|
|
5610
|
+
type: "button",
|
|
5611
|
+
"data-keep-action": "remove-tag",
|
|
5612
|
+
"aria-label": showRemoveLabel ? void 0 : view.labels.remove,
|
|
5613
|
+
onClick: () => view.removeTag(tag),
|
|
5614
|
+
children: showRemoveLabel ? view.labels.remove : null
|
|
5615
|
+
}
|
|
5616
|
+
)
|
|
5313
5617
|
] }, tag)) }),
|
|
5314
|
-
/* @__PURE__ */
|
|
5618
|
+
/* @__PURE__ */ jsx26(
|
|
5619
|
+
"button",
|
|
5620
|
+
{
|
|
5621
|
+
type: "submit",
|
|
5622
|
+
"data-keep-action": "apply-tags",
|
|
5623
|
+
disabled: isSaving,
|
|
5624
|
+
"aria-busy": isSaving,
|
|
5625
|
+
"aria-label": showApplyLabel ? void 0 : view.labels.apply,
|
|
5626
|
+
children: showApplyLabel ? view.labels.apply : null
|
|
5627
|
+
}
|
|
5628
|
+
)
|
|
5315
5629
|
] });
|
|
5316
|
-
return /* @__PURE__ */
|
|
5630
|
+
return /* @__PURE__ */ jsxs22(
|
|
5317
5631
|
"form",
|
|
5318
5632
|
{
|
|
5319
5633
|
...props,
|
|
@@ -5325,7 +5639,7 @@ function KeepTagEditor({
|
|
|
5325
5639
|
"data-disabled": isSaving ? "true" : void 0,
|
|
5326
5640
|
children: [
|
|
5327
5641
|
body,
|
|
5328
|
-
view.error ? /* @__PURE__ */
|
|
5642
|
+
view.error ? /* @__PURE__ */ jsx26("p", { role: "alert", children: getErrorMessage5(view.error, view.labels.error) }) : null
|
|
5329
5643
|
]
|
|
5330
5644
|
}
|
|
5331
5645
|
);
|
|
@@ -5356,7 +5670,7 @@ function useKeepToastFeedback(showToast) {
|
|
|
5356
5670
|
|
|
5357
5671
|
// src/features/navigation/KeepTourBar.tsx
|
|
5358
5672
|
import { useKeepNavigator } from "@keepkit/core/react";
|
|
5359
|
-
import { useId as
|
|
5673
|
+
import { useId as useId5 } from "react";
|
|
5360
5674
|
|
|
5361
5675
|
// src/features/navigation/hooks/useKeepTourShortcuts.ts
|
|
5362
5676
|
import { useEffect as useEffect13 } from "react";
|
|
@@ -5391,7 +5705,7 @@ function isEditableTarget(target) {
|
|
|
5391
5705
|
}
|
|
5392
5706
|
|
|
5393
5707
|
// src/features/navigation/KeepTourBar.tsx
|
|
5394
|
-
import { Fragment as Fragment15, jsx as
|
|
5708
|
+
import { Fragment as Fragment15, jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5395
5709
|
function KeepTourBar({
|
|
5396
5710
|
navigation: providedNavigation,
|
|
5397
5711
|
currentId,
|
|
@@ -5461,9 +5775,9 @@ function KeepTourBar({
|
|
|
5461
5775
|
return resolvedPrev();
|
|
5462
5776
|
}
|
|
5463
5777
|
});
|
|
5464
|
-
const body = /* @__PURE__ */
|
|
5465
|
-
showProgress ? /* @__PURE__ */
|
|
5466
|
-
/* @__PURE__ */
|
|
5778
|
+
const body = /* @__PURE__ */ jsxs23(Fragment15, { children: [
|
|
5779
|
+
showProgress ? /* @__PURE__ */ jsx27("span", { "data-keepkit": "tour-progress", "aria-live": "polite", children: progress ?? `${navigation.currentPosition ?? 0} / ${navigation.items.length}` }) : null,
|
|
5780
|
+
/* @__PURE__ */ jsx27(
|
|
5467
5781
|
TourAction,
|
|
5468
5782
|
{
|
|
5469
5783
|
href: resolvedPrevHref,
|
|
@@ -5471,7 +5785,7 @@ function KeepTourBar({
|
|
|
5471
5785
|
onClick: resolvedPrevHref ? notifyPrevNavigation : resolvedPrev,
|
|
5472
5786
|
"data-keep-action": "tour-prev",
|
|
5473
5787
|
shortcut: showShortcutHint ? shortcutOptions?.prevKeys?.[0] ?? "K" : void 0,
|
|
5474
|
-
preview: navigation.prevItem ? /* @__PURE__ */
|
|
5788
|
+
preview: navigation.prevItem ? /* @__PURE__ */ jsxs23(Fragment15, { children: [
|
|
5475
5789
|
previousLabel,
|
|
5476
5790
|
": ",
|
|
5477
5791
|
getItemTitle(navigation.prevItem)
|
|
@@ -5479,7 +5793,7 @@ function KeepTourBar({
|
|
|
5479
5793
|
children: previousLabel
|
|
5480
5794
|
}
|
|
5481
5795
|
),
|
|
5482
|
-
/* @__PURE__ */
|
|
5796
|
+
/* @__PURE__ */ jsx27(
|
|
5483
5797
|
TourAction,
|
|
5484
5798
|
{
|
|
5485
5799
|
href: resolvedNextHref,
|
|
@@ -5487,7 +5801,7 @@ function KeepTourBar({
|
|
|
5487
5801
|
onClick: resolvedNextHref ? notifyNextNavigation : resolvedNext,
|
|
5488
5802
|
"data-keep-action": "tour-next",
|
|
5489
5803
|
shortcut: showShortcutHint ? shortcutOptions?.nextKeys?.[0] ?? "J" : void 0,
|
|
5490
|
-
preview: navigation.nextItem ? /* @__PURE__ */
|
|
5804
|
+
preview: navigation.nextItem ? /* @__PURE__ */ jsxs23(Fragment15, { children: [
|
|
5491
5805
|
nextItemLabel,
|
|
5492
5806
|
": ",
|
|
5493
5807
|
getItemTitle(navigation.nextItem)
|
|
@@ -5495,7 +5809,7 @@ function KeepTourBar({
|
|
|
5495
5809
|
children: nextItemLabel
|
|
5496
5810
|
}
|
|
5497
5811
|
),
|
|
5498
|
-
resolvedBackHref || onBack ? /* @__PURE__ */
|
|
5812
|
+
resolvedBackHref || onBack ? /* @__PURE__ */ jsx27(TourAction, { href: resolvedBackHref, onClick: onBack, "data-keep-action": "tour-back", children: listLabel }) : null
|
|
5499
5813
|
] });
|
|
5500
5814
|
return renderRoot(
|
|
5501
5815
|
asChild,
|
|
@@ -5506,14 +5820,14 @@ function KeepTourBar({
|
|
|
5506
5820
|
);
|
|
5507
5821
|
}
|
|
5508
5822
|
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__ */
|
|
5823
|
+
const previewId = useId5();
|
|
5824
|
+
const content = /* @__PURE__ */ jsxs23(Fragment15, { children: [
|
|
5825
|
+
/* @__PURE__ */ jsx27("span", { "data-tour-label": "true", children }),
|
|
5826
|
+
shortcut ? /* @__PURE__ */ jsx27(KeepShortcutHint, { shortcut }) : null,
|
|
5827
|
+
preview ? /* @__PURE__ */ jsx27("small", { id: previewId, "data-tour-preview": "true", children: preview }) : null
|
|
5514
5828
|
] });
|
|
5515
5829
|
if (href && !disabled) {
|
|
5516
|
-
return /* @__PURE__ */
|
|
5830
|
+
return /* @__PURE__ */ jsx27(
|
|
5517
5831
|
"a",
|
|
5518
5832
|
{
|
|
5519
5833
|
...props,
|
|
@@ -5525,7 +5839,7 @@ function TourAction({ href, disabled = false, onClick, children, preview, shortc
|
|
|
5525
5839
|
}
|
|
5526
5840
|
);
|
|
5527
5841
|
}
|
|
5528
|
-
return /* @__PURE__ */
|
|
5842
|
+
return /* @__PURE__ */ jsx27(
|
|
5529
5843
|
"button",
|
|
5530
5844
|
{
|
|
5531
5845
|
...props,
|
|
@@ -5548,10 +5862,10 @@ function navigateTo(item, href) {
|
|
|
5548
5862
|
import { isValidElement as isValidElement8 } from "react";
|
|
5549
5863
|
|
|
5550
5864
|
// src/features/status/hooks/useStatusViews.ts
|
|
5551
|
-
import { useKeepContext as
|
|
5552
|
-
import { useEffect as useEffect14, useRef as useRef10, useState as
|
|
5865
|
+
import { useKeepContext as useKeepContext6 } from "@keepkit/core/react";
|
|
5866
|
+
import { useEffect as useEffect14, useRef as useRef10, useState as useState18 } from "react";
|
|
5553
5867
|
function useKeepStatus(status) {
|
|
5554
|
-
const context =
|
|
5868
|
+
const context = useKeepContext6();
|
|
5555
5869
|
const resolvedStatus = status ?? getDerivedStatus(context);
|
|
5556
5870
|
const state = {
|
|
5557
5871
|
status: resolvedStatus,
|
|
@@ -5562,11 +5876,11 @@ function useKeepStatus(status) {
|
|
|
5562
5876
|
return { state, defaultLabel: useUiLabel(getStatusLabelKey3(resolvedStatus)) };
|
|
5563
5877
|
}
|
|
5564
5878
|
function useKeepAnnouncements(messages) {
|
|
5565
|
-
const context =
|
|
5879
|
+
const context = useKeepContext6();
|
|
5566
5880
|
const savedMessage = useUiLabel("savedMessage", messages?.save);
|
|
5567
5881
|
const removedMessage = useUiLabel("removedMessage", messages?.remove);
|
|
5568
5882
|
const noteSavedMessage = useUiLabel("noteSavedMessage", messages?.note);
|
|
5569
|
-
const [message, setMessage] =
|
|
5883
|
+
const [message, setMessage] = useState18("");
|
|
5570
5884
|
const lastChangeRef = useRef10(void 0);
|
|
5571
5885
|
useEffect14(() => {
|
|
5572
5886
|
const change = context.lastChange;
|
|
@@ -5596,7 +5910,7 @@ function getStatusLabelKey3(status) {
|
|
|
5596
5910
|
}
|
|
5597
5911
|
|
|
5598
5912
|
// src/features/status/status.tsx
|
|
5599
|
-
import { jsx as
|
|
5913
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
5600
5914
|
function KeepStatus({
|
|
5601
5915
|
status,
|
|
5602
5916
|
labels,
|
|
@@ -5628,7 +5942,7 @@ function KeepStatus({
|
|
|
5628
5942
|
}
|
|
5629
5943
|
function KeepAnnouncements({ messages, ...props }) {
|
|
5630
5944
|
const message = useKeepAnnouncements(messages);
|
|
5631
|
-
return /* @__PURE__ */
|
|
5945
|
+
return /* @__PURE__ */ jsx28(
|
|
5632
5946
|
"div",
|
|
5633
5947
|
{
|
|
5634
5948
|
...props,
|
|
@@ -5644,10 +5958,10 @@ function KeepAnnouncements({ messages, ...props }) {
|
|
|
5644
5958
|
var KeepAnnouncer = KeepAnnouncements;
|
|
5645
5959
|
|
|
5646
5960
|
// src/features/sync/hooks/useKeepSyncFeedback.ts
|
|
5647
|
-
import { useKeepContext as
|
|
5961
|
+
import { useKeepContext as useKeepContext7 } from "@keepkit/core/react";
|
|
5648
5962
|
import { useEffect as useEffect15, useRef as useRef11 } from "react";
|
|
5649
5963
|
function useKeepSyncFeedback() {
|
|
5650
|
-
const { syncState } =
|
|
5964
|
+
const { syncState } = useKeepContext7();
|
|
5651
5965
|
const emitFeedback = useKeepUiFeedback();
|
|
5652
5966
|
const completedMessage = useUiLabel("syncSynced");
|
|
5653
5967
|
const failedMessage = useUiLabel("syncFailedMessage");
|
|
@@ -5672,16 +5986,16 @@ function KeepSyncFeedbackObserver() {
|
|
|
5672
5986
|
}
|
|
5673
5987
|
|
|
5674
5988
|
// src/features/sync/hooks/useKeepSyncRecoveryDialog.ts
|
|
5675
|
-
import { useKeepContext as
|
|
5676
|
-
import { useEffect as useEffect16, useState as
|
|
5989
|
+
import { useKeepContext as useKeepContext8 } from "@keepkit/core/react";
|
|
5990
|
+
import { useEffect as useEffect16, useState as useState19 } from "react";
|
|
5677
5991
|
function useKeepSyncRecoveryDialog(options) {
|
|
5678
5992
|
const { open, onOpenChange, conflicts, onManualMerge } = options;
|
|
5679
|
-
const context =
|
|
5993
|
+
const context = useKeepContext8();
|
|
5680
5994
|
const conflictList = conflicts ?? context.syncState.conflicts ?? [];
|
|
5681
5995
|
const hasRecovery = conflictList.length > 0 || context.syncState.status === "error" || Boolean(context.error);
|
|
5682
|
-
const [dismissed, setDismissed] =
|
|
5683
|
-
const [busyId, setBusyId] =
|
|
5684
|
-
const [error, setError] =
|
|
5996
|
+
const [dismissed, setDismissed] = useState19(false);
|
|
5997
|
+
const [busyId, setBusyId] = useState19();
|
|
5998
|
+
const [error, setError] = useState19();
|
|
5685
5999
|
useEffect16(() => {
|
|
5686
6000
|
if (hasRecovery) setDismissed(false);
|
|
5687
6001
|
}, [hasRecovery]);
|
|
@@ -5727,7 +6041,7 @@ function useKeepSyncRecoveryDialog(options) {
|
|
|
5727
6041
|
}
|
|
5728
6042
|
|
|
5729
6043
|
// src/features/sync/KeepSyncRecoveryDialog.tsx
|
|
5730
|
-
import { jsx as
|
|
6044
|
+
import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5731
6045
|
function KeepSyncRecoveryDialog({
|
|
5732
6046
|
open,
|
|
5733
6047
|
onOpenChange,
|
|
@@ -5742,7 +6056,7 @@ function KeepSyncRecoveryDialog({
|
|
|
5742
6056
|
}) {
|
|
5743
6057
|
const view = useKeepSyncRecoveryDialog({ open, onOpenChange, conflicts, onManualMerge });
|
|
5744
6058
|
if (!view.isOpen) return null;
|
|
5745
|
-
return /* @__PURE__ */
|
|
6059
|
+
return /* @__PURE__ */ jsxs24(
|
|
5746
6060
|
"section",
|
|
5747
6061
|
{
|
|
5748
6062
|
...props,
|
|
@@ -5756,17 +6070,17 @@ function KeepSyncRecoveryDialog({
|
|
|
5756
6070
|
"data-state": view.conflictList.length > 0 ? "conflict" : "error",
|
|
5757
6071
|
"data-loading": view.busyId !== void 0 ? "true" : void 0,
|
|
5758
6072
|
children: [
|
|
5759
|
-
/* @__PURE__ */
|
|
5760
|
-
/* @__PURE__ */
|
|
5761
|
-
/* @__PURE__ */
|
|
6073
|
+
/* @__PURE__ */ jsxs24("header", { children: [
|
|
6074
|
+
/* @__PURE__ */ jsx29("h2", { id: "keepkit-sync-recovery-title", children: title ?? view.labels.title }),
|
|
6075
|
+
/* @__PURE__ */ jsx29("button", { type: "button", "data-keep-action": "close-dialog", onClick: view.close, "aria-label": view.labels.close, children: view.labels.close })
|
|
5762
6076
|
] }),
|
|
5763
6077
|
children,
|
|
5764
|
-
view.conflictList.length > 0 ? /* @__PURE__ */
|
|
5765
|
-
/* @__PURE__ */
|
|
5766
|
-
view.conflictList.map((conflict) => /* @__PURE__ */
|
|
5767
|
-
/* @__PURE__ */
|
|
5768
|
-
/* @__PURE__ */
|
|
5769
|
-
/* @__PURE__ */
|
|
6078
|
+
view.conflictList.length > 0 ? /* @__PURE__ */ jsxs24("div", { children: [
|
|
6079
|
+
/* @__PURE__ */ jsx29("p", { children: view.labels.conflict }),
|
|
6080
|
+
view.conflictList.map((conflict) => /* @__PURE__ */ jsxs24("article", { "data-conflict-id": conflict.id, children: [
|
|
6081
|
+
/* @__PURE__ */ jsx29("h3", { children: getMetaTitle(conflict.operation.item?.meta) ?? conflict.id }),
|
|
6082
|
+
/* @__PURE__ */ jsxs24("div", { "data-conflict-preview": true, children: [
|
|
6083
|
+
/* @__PURE__ */ jsx29(
|
|
5770
6084
|
ConflictPreview,
|
|
5771
6085
|
{
|
|
5772
6086
|
item: conflict.operation.item,
|
|
@@ -5776,7 +6090,7 @@ function KeepSyncRecoveryDialog({
|
|
|
5776
6090
|
side: "local"
|
|
5777
6091
|
}
|
|
5778
6092
|
),
|
|
5779
|
-
/* @__PURE__ */
|
|
6093
|
+
/* @__PURE__ */ jsx29(
|
|
5780
6094
|
ConflictPreview,
|
|
5781
6095
|
{
|
|
5782
6096
|
item: conflict.remote,
|
|
@@ -5787,8 +6101,8 @@ function KeepSyncRecoveryDialog({
|
|
|
5787
6101
|
}
|
|
5788
6102
|
)
|
|
5789
6103
|
] }),
|
|
5790
|
-
/* @__PURE__ */
|
|
5791
|
-
/* @__PURE__ */
|
|
6104
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
6105
|
+
/* @__PURE__ */ jsx29(
|
|
5792
6106
|
"button",
|
|
5793
6107
|
{
|
|
5794
6108
|
type: "button",
|
|
@@ -5798,7 +6112,7 @@ function KeepSyncRecoveryDialog({
|
|
|
5798
6112
|
children: view.labels.keepLocal
|
|
5799
6113
|
}
|
|
5800
6114
|
),
|
|
5801
|
-
/* @__PURE__ */
|
|
6115
|
+
/* @__PURE__ */ jsx29(
|
|
5802
6116
|
"button",
|
|
5803
6117
|
{
|
|
5804
6118
|
type: "button",
|
|
@@ -5808,7 +6122,7 @@ function KeepSyncRecoveryDialog({
|
|
|
5808
6122
|
children: view.labels.useServer
|
|
5809
6123
|
}
|
|
5810
6124
|
),
|
|
5811
|
-
/* @__PURE__ */
|
|
6125
|
+
/* @__PURE__ */ jsx29(
|
|
5812
6126
|
"button",
|
|
5813
6127
|
{
|
|
5814
6128
|
type: "button",
|
|
@@ -5821,12 +6135,12 @@ function KeepSyncRecoveryDialog({
|
|
|
5821
6135
|
] })
|
|
5822
6136
|
] }, conflict.id))
|
|
5823
6137
|
] }) : null,
|
|
5824
|
-
view.showBackupRecovery ? /* @__PURE__ */
|
|
5825
|
-
/* @__PURE__ */
|
|
5826
|
-
/* @__PURE__ */
|
|
5827
|
-
backup ?? (showBackupControls ? /* @__PURE__ */
|
|
6138
|
+
view.showBackupRecovery ? /* @__PURE__ */ jsxs24("section", { "data-recovery": "backup", children: [
|
|
6139
|
+
/* @__PURE__ */ jsx29("h3", { children: view.labels.backupRecovery }),
|
|
6140
|
+
/* @__PURE__ */ jsx29("p", { children: view.labels.backupRecoveryDescription }),
|
|
6141
|
+
backup ?? (showBackupControls ? /* @__PURE__ */ jsx29(KeepBackup, {}) : null)
|
|
5828
6142
|
] }) : null,
|
|
5829
|
-
view.error ? /* @__PURE__ */
|
|
6143
|
+
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
6144
|
]
|
|
5831
6145
|
}
|
|
5832
6146
|
);
|
|
@@ -5838,16 +6152,16 @@ function ConflictPreview({
|
|
|
5838
6152
|
noteLabel,
|
|
5839
6153
|
side
|
|
5840
6154
|
}) {
|
|
5841
|
-
return /* @__PURE__ */
|
|
5842
|
-
/* @__PURE__ */
|
|
5843
|
-
/* @__PURE__ */
|
|
5844
|
-
/* @__PURE__ */
|
|
5845
|
-
/* @__PURE__ */
|
|
5846
|
-
/* @__PURE__ */
|
|
6155
|
+
return /* @__PURE__ */ jsxs24("article", { "data-conflict-version": side, "aria-label": heading, children: [
|
|
6156
|
+
/* @__PURE__ */ jsx29("h4", { children: heading }),
|
|
6157
|
+
/* @__PURE__ */ jsxs24("dl", { children: [
|
|
6158
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
6159
|
+
/* @__PURE__ */ jsx29("dt", { children: updatedAtLabel }),
|
|
6160
|
+
/* @__PURE__ */ jsx29("dd", { children: item ? /* @__PURE__ */ jsx29("time", { dateTime: new Date(item.updatedAt).toISOString(), children: formatConflictDate(item.updatedAt) }) : "\u2014" })
|
|
5847
6161
|
] }),
|
|
5848
|
-
/* @__PURE__ */
|
|
5849
|
-
/* @__PURE__ */
|
|
5850
|
-
/* @__PURE__ */
|
|
6162
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
6163
|
+
/* @__PURE__ */ jsx29("dt", { children: noteLabel }),
|
|
6164
|
+
/* @__PURE__ */ jsx29("dd", { children: item?.note || "\u2014" })
|
|
5851
6165
|
] })
|
|
5852
6166
|
] })
|
|
5853
6167
|
] });
|
|
@@ -5857,9 +6171,9 @@ function formatConflictDate(timestamp) {
|
|
|
5857
6171
|
}
|
|
5858
6172
|
|
|
5859
6173
|
// src/features/sync/hooks/useKeepSyncStatusBanner.ts
|
|
5860
|
-
import { useKeepContext as
|
|
6174
|
+
import { useKeepContext as useKeepContext9 } from "@keepkit/core/react";
|
|
5861
6175
|
function useKeepSyncStatusBanner({ onRetry, children }) {
|
|
5862
|
-
const context =
|
|
6176
|
+
const context = useKeepContext9();
|
|
5863
6177
|
const retryLabel = useUiLabel("retrySync");
|
|
5864
6178
|
const resolveLabel = useUiLabel("resolveSync");
|
|
5865
6179
|
const conflictLabel = useUiLabel("syncConflict");
|
|
@@ -5891,7 +6205,7 @@ function getErrorMessage6(error) {
|
|
|
5891
6205
|
}
|
|
5892
6206
|
|
|
5893
6207
|
// src/features/sync/KeepSyncStatusBanner.tsx
|
|
5894
|
-
import { jsx as
|
|
6208
|
+
import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5895
6209
|
function KeepSyncStatusBanner({
|
|
5896
6210
|
onRetry,
|
|
5897
6211
|
onResolveConflicts,
|
|
@@ -5900,8 +6214,10 @@ function KeepSyncStatusBanner({
|
|
|
5900
6214
|
...props
|
|
5901
6215
|
}) {
|
|
5902
6216
|
const view = useKeepSyncStatusBanner({ onRetry, children });
|
|
6217
|
+
const showRetryLabel = useUiLabelVisibility("retrySync");
|
|
6218
|
+
const showResolveLabel = useUiLabelVisibility("resolveSync");
|
|
5903
6219
|
if (view.status === "idle" && !view.hasConflicts) return null;
|
|
5904
|
-
return /* @__PURE__ */
|
|
6220
|
+
return /* @__PURE__ */ jsxs25(
|
|
5905
6221
|
"aside",
|
|
5906
6222
|
{
|
|
5907
6223
|
...props,
|
|
@@ -5911,25 +6227,27 @@ function KeepSyncStatusBanner({
|
|
|
5911
6227
|
"data-keepkit": "sync-status",
|
|
5912
6228
|
"data-state": view.status,
|
|
5913
6229
|
children: [
|
|
5914
|
-
/* @__PURE__ */
|
|
5915
|
-
view.showRetry ? /* @__PURE__ */
|
|
6230
|
+
/* @__PURE__ */ jsx30("p", { children: view.message }),
|
|
6231
|
+
view.showRetry ? /* @__PURE__ */ jsx30(
|
|
5916
6232
|
"button",
|
|
5917
6233
|
{
|
|
5918
6234
|
type: "button",
|
|
5919
6235
|
"data-keep-action": "retry-sync",
|
|
5920
6236
|
onClick: () => void view.retry(),
|
|
5921
6237
|
disabled: view.isMutating,
|
|
5922
|
-
|
|
6238
|
+
"aria-label": showRetryLabel ? void 0 : view.retryLabel,
|
|
6239
|
+
children: showRetryLabel ? view.retryLabel : null
|
|
5923
6240
|
}
|
|
5924
6241
|
) : null,
|
|
5925
|
-
view.hasConflicts ? /* @__PURE__ */
|
|
6242
|
+
view.hasConflicts ? /* @__PURE__ */ jsx30(
|
|
5926
6243
|
"button",
|
|
5927
6244
|
{
|
|
5928
6245
|
type: "button",
|
|
5929
6246
|
"data-keep-action": "resolve-conflicts",
|
|
5930
6247
|
onClick: onResolveConflicts,
|
|
5931
6248
|
disabled: !onResolveConflicts,
|
|
5932
|
-
|
|
6249
|
+
"aria-label": showResolveLabel ? void 0 : view.resolveLabel,
|
|
6250
|
+
children: showResolveLabel ? view.resolveLabel : null
|
|
5933
6251
|
}
|
|
5934
6252
|
) : null
|
|
5935
6253
|
]
|
|
@@ -5938,7 +6256,7 @@ function KeepSyncStatusBanner({
|
|
|
5938
6256
|
}
|
|
5939
6257
|
|
|
5940
6258
|
// src/features/workspace/hooks/useKeepWorkspace.ts
|
|
5941
|
-
import { useCallback as useCallback9, useState as
|
|
6259
|
+
import { useCallback as useCallback9, useState as useState20 } from "react";
|
|
5942
6260
|
var PRESET_MODULES = {
|
|
5943
6261
|
basic: { syncStatus: false, undo: false, recovery: false, backup: false, stalePrune: false },
|
|
5944
6262
|
standard: { syncStatus: false, undo: true, recovery: false, backup: false, stalePrune: false },
|
|
@@ -5958,7 +6276,7 @@ function useKeepWorkspace({
|
|
|
5958
6276
|
onRecoveryOpenChange,
|
|
5959
6277
|
onResolveConflicts
|
|
5960
6278
|
}) {
|
|
5961
|
-
const [internalRecoveryOpen, setInternalRecoveryOpen] =
|
|
6279
|
+
const [internalRecoveryOpen, setInternalRecoveryOpen] = useState20(false);
|
|
5962
6280
|
const resolvedModules = { ...PRESET_MODULES[preset], ...modules };
|
|
5963
6281
|
const setRecoveryOpen = useCallback9(
|
|
5964
6282
|
(open) => {
|
|
@@ -5982,7 +6300,7 @@ function useKeepWorkspace({
|
|
|
5982
6300
|
}
|
|
5983
6301
|
|
|
5984
6302
|
// src/features/workspace/KeepWorkspace.tsx
|
|
5985
|
-
import { jsx as
|
|
6303
|
+
import { jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5986
6304
|
function KeepWorkspace({
|
|
5987
6305
|
preset = "standard",
|
|
5988
6306
|
modules,
|
|
@@ -6021,27 +6339,27 @@ function KeepWorkspace({
|
|
|
6021
6339
|
if (!structuredRegions) return content;
|
|
6022
6340
|
if (!hasRenderableContent(content)) return null;
|
|
6023
6341
|
const resolvedSurface = typeof surface === "string" ? surface : surface[name] ?? "plain";
|
|
6024
|
-
return /* @__PURE__ */
|
|
6342
|
+
return /* @__PURE__ */ jsx31("div", { "data-keepkit": "workspace-region", "data-region": name, "data-surface": resolvedSurface, children: content });
|
|
6025
6343
|
};
|
|
6026
6344
|
const before = resolveOptionalSlot(slots?.before, state);
|
|
6027
6345
|
const syncStatus = view.modules.syncStatus ? resolveSlot(
|
|
6028
6346
|
slots?.syncStatus,
|
|
6029
|
-
/* @__PURE__ */
|
|
6347
|
+
/* @__PURE__ */ jsx31(KeepSyncStatusBanner, { ...syncStatusProps, onResolveConflicts: view.openRecovery }),
|
|
6030
6348
|
state
|
|
6031
6349
|
) : null;
|
|
6032
|
-
const collection = resolveSlot(slots?.collection, /* @__PURE__ */
|
|
6350
|
+
const collection = resolveSlot(slots?.collection, /* @__PURE__ */ jsx31(KeepCollection, { ...resolvedCollectionProps }), state);
|
|
6033
6351
|
const actions = view.modules.backup || view.modules.stalePrune ? resolveSlot(
|
|
6034
6352
|
slots?.actions,
|
|
6035
|
-
/* @__PURE__ */
|
|
6036
|
-
view.modules.stalePrune ? /* @__PURE__ */
|
|
6037
|
-
view.modules.backup ? /* @__PURE__ */
|
|
6353
|
+
/* @__PURE__ */ jsxs26("div", { "data-keepkit": "workspace-actions", children: [
|
|
6354
|
+
view.modules.stalePrune ? /* @__PURE__ */ jsx31(KeepPruneStaleButton, { ...stalePruneProps }) : null,
|
|
6355
|
+
view.modules.backup ? /* @__PURE__ */ jsx31(KeepBackup, { ...backupProps }) : null
|
|
6038
6356
|
] }),
|
|
6039
6357
|
state
|
|
6040
6358
|
) : null;
|
|
6041
|
-
const undo = view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */
|
|
6359
|
+
const undo = view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */ jsx31(KeepUndo, { ...undoProps }), state) : null;
|
|
6042
6360
|
const recovery = view.modules.recovery ? resolveSlot(
|
|
6043
6361
|
slots?.recovery,
|
|
6044
|
-
/* @__PURE__ */
|
|
6362
|
+
/* @__PURE__ */ jsx31(
|
|
6045
6363
|
KeepSyncRecoveryDialog,
|
|
6046
6364
|
{
|
|
6047
6365
|
...recoveryProps,
|
|
@@ -6053,7 +6371,7 @@ function KeepWorkspace({
|
|
|
6053
6371
|
) : null;
|
|
6054
6372
|
const additionalContent = resolveOptionalSlot(children, state);
|
|
6055
6373
|
const after = resolveOptionalSlot(slots?.after, state);
|
|
6056
|
-
return /* @__PURE__ */
|
|
6374
|
+
return /* @__PURE__ */ jsxs26(
|
|
6057
6375
|
"section",
|
|
6058
6376
|
{
|
|
6059
6377
|
...props,
|
|
@@ -6086,7 +6404,7 @@ function resolveOptionalSlot(slot, state) {
|
|
|
6086
6404
|
|
|
6087
6405
|
// src/foundation/theme.tsx
|
|
6088
6406
|
import { isValidElement as isValidElement9 } from "react";
|
|
6089
|
-
import { jsx as
|
|
6407
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
6090
6408
|
var keepThemeNames = [
|
|
6091
6409
|
"default",
|
|
6092
6410
|
"ocean",
|
|
@@ -6145,7 +6463,7 @@ function KeepThemeProvider({
|
|
|
6145
6463
|
throw new Error("KeepThemeProvider with asChild requires a single React element child.");
|
|
6146
6464
|
return createSlot(children, rootProps);
|
|
6147
6465
|
}
|
|
6148
|
-
return /* @__PURE__ */
|
|
6466
|
+
return /* @__PURE__ */ jsx32("div", { ...rootProps, children });
|
|
6149
6467
|
}
|
|
6150
6468
|
|
|
6151
6469
|
// src/index.tsx
|
|
@@ -6153,8 +6471,8 @@ import { createAuthenticatedSyncKit } from "@keepkit/core/core";
|
|
|
6153
6471
|
import {
|
|
6154
6472
|
KeepErrorBoundary as KeepErrorBoundary3,
|
|
6155
6473
|
KeepProvider,
|
|
6156
|
-
useKeepCollections as
|
|
6157
|
-
useKeepContext as
|
|
6474
|
+
useKeepCollections as useKeepCollections4,
|
|
6475
|
+
useKeepContext as useKeepContext10,
|
|
6158
6476
|
useKeepItem as useKeepItem8,
|
|
6159
6477
|
useKeepList as useKeepList5,
|
|
6160
6478
|
useKeepNavigator as useKeepNavigator2,
|
|
@@ -6170,9 +6488,10 @@ import {
|
|
|
6170
6488
|
LocalStorageSyncQueueAdapter,
|
|
6171
6489
|
SyncStorageAdapter
|
|
6172
6490
|
} from "@keepkit/core/storage";
|
|
6173
|
-
import { jsx as
|
|
6491
|
+
import { jsx as jsx33, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6174
6492
|
function KeepKitProvider({
|
|
6175
6493
|
labels,
|
|
6494
|
+
labelOptions,
|
|
6176
6495
|
locale,
|
|
6177
6496
|
labelResolver,
|
|
6178
6497
|
onFeedback,
|
|
@@ -6190,31 +6509,42 @@ function KeepKitProvider({
|
|
|
6190
6509
|
children,
|
|
6191
6510
|
...providerProps
|
|
6192
6511
|
}) {
|
|
6193
|
-
return /* @__PURE__ */
|
|
6194
|
-
|
|
6512
|
+
return /* @__PURE__ */ jsx33(
|
|
6513
|
+
KeepUiProvider,
|
|
6195
6514
|
{
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6515
|
+
labels,
|
|
6516
|
+
labelOptions,
|
|
6517
|
+
locale,
|
|
6518
|
+
labelResolver,
|
|
6519
|
+
onFeedback,
|
|
6520
|
+
children: /* @__PURE__ */ jsx33(
|
|
6521
|
+
KeepThemeProvider,
|
|
6522
|
+
{
|
|
6523
|
+
theme,
|
|
6524
|
+
mode,
|
|
6525
|
+
density,
|
|
6526
|
+
radius,
|
|
6527
|
+
accentColor,
|
|
6528
|
+
highContrast,
|
|
6529
|
+
reducedMotion,
|
|
6530
|
+
variables,
|
|
6531
|
+
className: themeClassName,
|
|
6532
|
+
style: themeStyle,
|
|
6533
|
+
asChild: themeAsChild,
|
|
6534
|
+
children: /* @__PURE__ */ jsxs27(CoreKeepProvider, { ...providerProps, children: [
|
|
6535
|
+
/* @__PURE__ */ jsx33(KeepSyncFeedbackObserver, {}),
|
|
6536
|
+
children,
|
|
6537
|
+
/* @__PURE__ */ jsx33(KeepAnnouncements, {})
|
|
6538
|
+
] })
|
|
6539
|
+
}
|
|
6540
|
+
)
|
|
6212
6541
|
}
|
|
6213
|
-
)
|
|
6542
|
+
);
|
|
6214
6543
|
}
|
|
6215
6544
|
function createKeepKit(options = {}) {
|
|
6216
6545
|
const {
|
|
6217
6546
|
labels,
|
|
6547
|
+
labelOptions,
|
|
6218
6548
|
locale,
|
|
6219
6549
|
labelResolver,
|
|
6220
6550
|
onFeedback,
|
|
@@ -6234,11 +6564,12 @@ function createKeepKit(options = {}) {
|
|
|
6234
6564
|
} = options;
|
|
6235
6565
|
const coreKit = createCoreKeepKit(coreOptions);
|
|
6236
6566
|
return {
|
|
6237
|
-
Provider: (props) => /* @__PURE__ */
|
|
6567
|
+
Provider: (props) => /* @__PURE__ */ jsx33(
|
|
6238
6568
|
KeepKitProvider,
|
|
6239
6569
|
{
|
|
6240
6570
|
...coreOptions,
|
|
6241
6571
|
labels,
|
|
6572
|
+
labelOptions,
|
|
6242
6573
|
locale,
|
|
6243
6574
|
labelResolver,
|
|
6244
6575
|
onFeedback,
|
|
@@ -6255,9 +6586,9 @@ function createKeepKit(options = {}) {
|
|
|
6255
6586
|
...props
|
|
6256
6587
|
}
|
|
6257
6588
|
),
|
|
6258
|
-
Button: (props) => /* @__PURE__ */
|
|
6259
|
-
Backup: (props) => /* @__PURE__ */
|
|
6260
|
-
Collection: (props) => /* @__PURE__ */
|
|
6589
|
+
Button: (props) => /* @__PURE__ */ jsx33(KeepButton, { ...props }),
|
|
6590
|
+
Backup: (props) => /* @__PURE__ */ jsx33(KeepBackup, { ...props }),
|
|
6591
|
+
Collection: (props) => /* @__PURE__ */ jsx33(
|
|
6261
6592
|
KeepCollection,
|
|
6262
6593
|
{
|
|
6263
6594
|
...props,
|
|
@@ -6268,7 +6599,7 @@ function createKeepKit(options = {}) {
|
|
|
6268
6599
|
}
|
|
6269
6600
|
}
|
|
6270
6601
|
),
|
|
6271
|
-
Workspace: (props) => /* @__PURE__ */
|
|
6602
|
+
Workspace: (props) => /* @__PURE__ */ jsx33(
|
|
6272
6603
|
KeepWorkspace,
|
|
6273
6604
|
{
|
|
6274
6605
|
...props,
|
|
@@ -6303,6 +6634,7 @@ export {
|
|
|
6303
6634
|
KeepBulkActions,
|
|
6304
6635
|
KeepButton,
|
|
6305
6636
|
KeepCollection,
|
|
6637
|
+
KeepCollectionCreate,
|
|
6306
6638
|
KeepCollectionFilter,
|
|
6307
6639
|
KeepCollectionSelect,
|
|
6308
6640
|
KeepEmptyState,
|
|
@@ -6355,8 +6687,8 @@ export {
|
|
|
6355
6687
|
keepThemeNames,
|
|
6356
6688
|
mergeProps,
|
|
6357
6689
|
toggleSelectAll,
|
|
6358
|
-
|
|
6359
|
-
|
|
6690
|
+
useKeepCollections4 as useKeepCollections,
|
|
6691
|
+
useKeepContext10 as useKeepContext,
|
|
6360
6692
|
useKeepItem8 as useKeepItem,
|
|
6361
6693
|
useKeepList5 as useKeepList,
|
|
6362
6694
|
useKeepNavigator2 as useKeepNavigator,
|
|
@@ -6365,6 +6697,7 @@ export {
|
|
|
6365
6697
|
useKeepToastFeedback,
|
|
6366
6698
|
useKeepTourShortcuts,
|
|
6367
6699
|
useKeepUiLabels,
|
|
6368
|
-
useKeepUrlSync
|
|
6700
|
+
useKeepUrlSync,
|
|
6701
|
+
useUiLabelVisibility
|
|
6369
6702
|
};
|
|
6370
6703
|
//# sourceMappingURL=index.js.map
|