@forthtilliath/react-native-kit 0.14.7 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -17
- package/dist/components/index.d.ts +4 -4
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -4
- package/dist/components/list/SwipeableRow.d.ts +14 -1
- package/dist/components/list/SwipeableRow.d.ts.map +1 -1
- package/dist/components/list/SwipeableRow.js +18 -16
- package/dist/components/list/Thumbnail.d.ts.map +1 -1
- package/dist/components/list/Thumbnail.js +2 -6
- package/dist/components/list/UndoToast.d.ts +10 -4
- package/dist/components/list/UndoToast.d.ts.map +1 -1
- package/dist/components/list/UndoToast.js +11 -8
- package/dist/components/list/index.d.ts +4 -4
- package/dist/components/list/index.d.ts.map +1 -1
- package/dist/components/list/index.js +4 -4
- package/dist/components/picker/PhotoPicker.d.ts +7 -1
- package/dist/components/picker/PhotoPicker.d.ts.map +1 -1
- package/dist/components/picker/PhotoPicker.js +33 -28
- package/dist/components/picker/PickerModal.d.ts +7 -1
- package/dist/components/picker/PickerModal.d.ts.map +1 -1
- package/dist/components/picker/PickerModal.js +8 -28
- package/dist/components/picker/PickerModal.styles.d.ts +18 -1
- package/dist/components/picker/PickerModal.styles.d.ts.map +1 -1
- package/dist/components/picker/PickerModal.styles.js +16 -6
- package/dist/components/picker/VoiceSearchButton.d.ts +13 -2
- package/dist/components/picker/VoiceSearchButton.d.ts.map +1 -1
- package/dist/components/picker/VoiceSearchButton.js +18 -1
- package/dist/components/picker/index.d.ts +3 -3
- package/dist/components/picker/index.d.ts.map +1 -1
- package/dist/components/picker/index.js +3 -3
- package/dist/components/settings/AboutSettingsScreen.d.ts +7 -1
- package/dist/components/settings/AboutSettingsScreen.d.ts.map +1 -1
- package/dist/components/settings/AboutSettingsScreen.js +13 -13
- package/dist/components/settings/BackupSettingsScreen.d.ts +9 -59
- package/dist/components/settings/BackupSettingsScreen.d.ts.map +1 -1
- package/dist/components/settings/BackupSettingsScreen.js +32 -141
- package/dist/components/settings/BackupSettingsScreen.styles.d.ts +173 -0
- package/dist/components/settings/BackupSettingsScreen.styles.d.ts.map +1 -0
- package/dist/components/settings/BackupSettingsScreen.styles.js +98 -0
- package/dist/components/settings/ContactSettingsScreen.d.ts +7 -1
- package/dist/components/settings/ContactSettingsScreen.d.ts.map +1 -1
- package/dist/components/settings/ContactSettingsScreen.js +15 -14
- package/dist/components/settings/PrivacySettingsScreen.d.ts +7 -1
- package/dist/components/settings/PrivacySettingsScreen.d.ts.map +1 -1
- package/dist/components/settings/PrivacySettingsScreen.js +50 -28
- package/dist/components/settings/SettingsMenu.d.ts.map +1 -1
- package/dist/components/settings/SettingsMenu.js +2 -9
- package/dist/components/settings/ThemeSettingsScreen.d.ts +7 -1
- package/dist/components/settings/ThemeSettingsScreen.d.ts.map +1 -1
- package/dist/components/settings/ThemeSettingsScreen.js +17 -19
- package/dist/components/settings/UpdateSettingsScreen.d.ts +11 -2
- package/dist/components/settings/UpdateSettingsScreen.d.ts.map +1 -1
- package/dist/components/settings/UpdateSettingsScreen.js +7 -31
- package/dist/components/settings/UpdateSettingsScreen.styles.d.ts +28 -1
- package/dist/components/settings/UpdateSettingsScreen.styles.d.ts.map +1 -1
- package/dist/components/settings/UpdateSettingsScreen.styles.js +26 -11
- package/dist/components/settings/index.d.ts +7 -7
- package/dist/components/settings/index.d.ts.map +1 -1
- package/dist/components/settings/index.js +7 -7
- package/dist/components/theme/ThemeOptionList.d.ts +7 -1
- package/dist/components/theme/ThemeOptionList.d.ts.map +1 -1
- package/dist/components/theme/ThemeOptionList.js +6 -17
- package/dist/components/theme/ThemeToggle.d.ts +7 -1
- package/dist/components/theme/ThemeToggle.d.ts.map +1 -1
- package/dist/components/theme/ThemeToggle.js +6 -20
- package/dist/components/theme/index.d.ts +2 -2
- package/dist/components/theme/index.d.ts.map +1 -1
- package/dist/components/theme/index.js +2 -2
- package/dist/components/theme/themeLabels.d.ts +14 -0
- package/dist/components/theme/themeLabels.d.ts.map +1 -0
- package/dist/components/theme/themeLabels.js +5 -0
- package/dist/hooks/index.d.ts +3 -3
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +3 -3
- package/dist/hooks/useDebouncedChange.d.ts.map +1 -1
- package/dist/hooks/useDebouncedChange.js +6 -7
- package/dist/hooks/useSubmitGuard.d.ts.map +1 -1
- package/dist/hooks/useSubmitGuard.js +9 -5
- package/dist/i18n/KitLocaleProvider.d.ts +19 -0
- package/dist/i18n/KitLocaleProvider.d.ts.map +1 -0
- package/dist/i18n/KitLocaleProvider.js +16 -0
- package/dist/i18n/index.d.ts +3 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +2 -0
- package/dist/i18n/locale.d.ts +14 -0
- package/dist/i18n/locale.d.ts.map +1 -0
- package/dist/i18n/locale.js +18 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/utils/helpers/confirmDestructive.d.ts +6 -0
- package/dist/utils/helpers/confirmDestructive.d.ts.map +1 -1
- package/dist/utils/helpers/confirmDestructive.js +20 -6
- package/dist/utils/helpers/index.d.ts +1 -0
- package/dist/utils/helpers/index.d.ts.map +1 -1
- package/dist/utils/helpers/index.js +1 -0
- package/dist/utils/helpers/mergeSlotStyles.d.ts +20 -0
- package/dist/utils/helpers/mergeSlotStyles.d.ts.map +1 -0
- package/dist/utils/helpers/mergeSlotStyles.js +26 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +14 -10
|
@@ -2,6 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
3
|
import { ActivityIndicator, Pressable, Text, View } from "react-native";
|
|
4
4
|
import { ChangelogNotes } from "@forthtilliath/expo-release-updates-ui";
|
|
5
|
+
import { KIT_LOCALE_TAGS, useKitLocale, } from "../../i18n/locale.js";
|
|
6
|
+
import { mergeSlotStyles } from "../../utils/helpers/mergeSlotStyles.js";
|
|
5
7
|
import { defaultLabels, defaultStyles } from "./UpdateSettingsScreen.styles.js";
|
|
6
8
|
import { UpdateSettingsScreenHistory } from "./UpdateSettingsScreenHistory.js";
|
|
7
9
|
// Full "check for update" screen: installed version, a manual check button,
|
|
@@ -10,41 +12,15 @@ import { UpdateSettingsScreenHistory } from "./UpdateSettingsScreenHistory.js";
|
|
|
10
12
|
// `fetchReleaseHistory` is passed — a list of past releases. Checks
|
|
11
13
|
// automatically once on mount (the caller decided to navigate here, no need
|
|
12
14
|
// to make them tap "check" again).
|
|
13
|
-
export function UpdateSettingsScreen({ currentVersion, checkForUpdate, compareVersions, downloadAndInstallApk, fetchReleaseHistory, dateLocale
|
|
15
|
+
export function UpdateSettingsScreen({ currentVersion, checkForUpdate, compareVersions, downloadAndInstallApk, fetchReleaseHistory, dateLocale: customDateLocale, labels, locale, styles, }) {
|
|
16
|
+
const resolvedLocale = useKitLocale(locale);
|
|
17
|
+
const dateLocale = customDateLocale ?? KIT_LOCALE_TAGS[resolvedLocale];
|
|
14
18
|
const merged = {
|
|
15
|
-
|
|
16
|
-
infoBox: [defaultStyles.infoBox, styles?.infoBox],
|
|
17
|
-
infoLabel: [defaultStyles.infoLabel, styles?.infoLabel],
|
|
18
|
-
infoValue: [defaultStyles.infoValue, styles?.infoValue],
|
|
19
|
-
helpText: [defaultStyles.helpText, styles?.helpText],
|
|
20
|
-
errorText: [defaultStyles.errorText, styles?.errorText],
|
|
21
|
-
button: [defaultStyles.button, styles?.button],
|
|
22
|
-
buttonDisabled: [defaultStyles.buttonDisabled, styles?.buttonDisabled],
|
|
23
|
-
buttonText: [defaultStyles.buttonText, styles?.buttonText],
|
|
24
|
-
updateAvailableBox: [
|
|
25
|
-
defaultStyles.updateAvailableBox,
|
|
26
|
-
styles?.updateAvailableBox,
|
|
27
|
-
],
|
|
28
|
-
updateAvailableTitle: [
|
|
29
|
-
defaultStyles.updateAvailableTitle,
|
|
30
|
-
styles?.updateAvailableTitle,
|
|
31
|
-
],
|
|
32
|
-
changelog: [defaultStyles.changelog, styles?.changelog],
|
|
33
|
-
changelogTitle: [defaultStyles.changelogTitle, styles?.changelogTitle],
|
|
34
|
-
changelogEntry: [defaultStyles.changelogEntry, styles?.changelogEntry],
|
|
35
|
-
changelogEntryHeader: [
|
|
36
|
-
defaultStyles.changelogEntryHeader,
|
|
37
|
-
styles?.changelogEntryHeader,
|
|
38
|
-
],
|
|
39
|
-
changelogVersion: [
|
|
40
|
-
defaultStyles.changelogVersion,
|
|
41
|
-
styles?.changelogVersion,
|
|
42
|
-
],
|
|
43
|
-
changelogDate: [defaultStyles.changelogDate, styles?.changelogDate],
|
|
19
|
+
...mergeSlotStyles(defaultStyles, styles),
|
|
44
20
|
notes: styles?.notes ?? defaultStyles.notes,
|
|
45
21
|
};
|
|
46
22
|
const activityIndicatorColor = styles?.activityIndicatorColor ?? defaultStyles.activityIndicatorColor;
|
|
47
|
-
const t = { ...defaultLabels, ...labels };
|
|
23
|
+
const t = { ...defaultLabels[resolvedLocale], ...labels };
|
|
48
24
|
const [updateState, setUpdateState] = useState({
|
|
49
25
|
status: "idle",
|
|
50
26
|
});
|
|
@@ -44,6 +44,33 @@ export interface UpdateSettingsScreenStyles {
|
|
|
44
44
|
changelogDate?: StyleProp<TextStyle>;
|
|
45
45
|
notes?: ChangelogNotesStyles;
|
|
46
46
|
}
|
|
47
|
-
export declare const defaultLabels:
|
|
47
|
+
export declare const defaultLabels: {
|
|
48
|
+
fr: {
|
|
49
|
+
installedVersionLabel: string;
|
|
50
|
+
checkButton: string;
|
|
51
|
+
upToDate: string;
|
|
52
|
+
checkError: string;
|
|
53
|
+
downloadError: string;
|
|
54
|
+
availableTitle: (version: string) => string;
|
|
55
|
+
installButton: () => string;
|
|
56
|
+
installButtonAccessibilityLabel: (version: string) => string;
|
|
57
|
+
downloadingLabel: (percent: number) => string;
|
|
58
|
+
downloadingHint: string;
|
|
59
|
+
historyTitle: string;
|
|
60
|
+
};
|
|
61
|
+
en: {
|
|
62
|
+
installedVersionLabel: string;
|
|
63
|
+
checkButton: string;
|
|
64
|
+
upToDate: string;
|
|
65
|
+
checkError: string;
|
|
66
|
+
downloadError: string;
|
|
67
|
+
availableTitle: (version: string) => string;
|
|
68
|
+
installButton: () => string;
|
|
69
|
+
installButtonAccessibilityLabel: (version: string) => string;
|
|
70
|
+
downloadingLabel: (percent: number) => string;
|
|
71
|
+
downloadingHint: string;
|
|
72
|
+
historyTitle: string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
48
75
|
export declare const defaultStyles: Required<Omit<UpdateSettingsScreenStyles, "activityIndicatorColor" | "notes">> & Pick<UpdateSettingsScreenStyles, "activityIndicatorColor" | "notes">;
|
|
49
76
|
//# sourceMappingURL=UpdateSettingsScreen.styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateSettingsScreen.styles.d.ts","sourceRoot":"","sources":["../../../src/components/settings/UpdateSettingsScreen.styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"UpdateSettingsScreen.styles.d.ts","sourceRoot":"","sources":["../../../src/components/settings/UpdateSettingsScreen.styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAInF,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,0BAA0B;IACzC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7C,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5C,+BAA+B,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9D,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,0BAA0B;IACzC,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC/B,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC9B,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,kBAAkB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC1C,oBAAoB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5C,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,oBAAoB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5C,gBAAgB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACxC,aAAa,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACrC,KAAK,CAAC,EAAE,oBAAoB,CAAC;CAC9B;AAED,eAAO,MAAM,aAAa;;;;;;;kCAOI,MAAM;;mDAEW,MAAM;oCAErB,MAAM;;;;;;;;;;kCAYR,MAAM;;mDAEW,MAAM;oCAErB,MAAM;;;;CAI6B,CAAC;AAEpE,eAAO,MAAM,aAAa,EAAE,QAAQ,CAClC,IAAI,CAAC,0BAA0B,EAAE,wBAAwB,GAAG,OAAO,CAAC,CACrE,GACC,IAAI,CAAC,0BAA0B,EAAE,wBAAwB,GAAG,OAAO,CA8DpE,CAAC"}
|
|
@@ -1,15 +1,30 @@
|
|
|
1
1
|
export const defaultLabels = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
fr: {
|
|
3
|
+
installedVersionLabel: "Version installée",
|
|
4
|
+
checkButton: "Rechercher une mise à jour",
|
|
5
|
+
upToDate: "Tu as déjà la dernière version.",
|
|
6
|
+
checkError: "Impossible de vérifier les mises à jour.",
|
|
7
|
+
downloadError: "Le téléchargement a échoué.",
|
|
8
|
+
availableTitle: (version) => `Version ${version} disponible`,
|
|
9
|
+
installButton: () => "Télécharger et installer",
|
|
10
|
+
installButtonAccessibilityLabel: (version) => `Télécharger et installer la version ${version}`,
|
|
11
|
+
downloadingLabel: (percent) => `Téléchargement… ${String(percent)}%`,
|
|
12
|
+
downloadingHint: "Ton téléphone va ensuite te demander confirmation pour installer la mise à jour.",
|
|
13
|
+
historyTitle: "Historique des versions",
|
|
14
|
+
},
|
|
15
|
+
en: {
|
|
16
|
+
installedVersionLabel: "Installed version",
|
|
17
|
+
checkButton: "Check for updates",
|
|
18
|
+
upToDate: "You already have the latest version.",
|
|
19
|
+
checkError: "Couldn't check for updates.",
|
|
20
|
+
downloadError: "The download failed.",
|
|
21
|
+
availableTitle: (version) => `Version ${version} available`,
|
|
22
|
+
installButton: () => "Download and install",
|
|
23
|
+
installButtonAccessibilityLabel: (version) => `Download and install version ${version}`,
|
|
24
|
+
downloadingLabel: (percent) => `Downloading… ${String(percent)}%`,
|
|
25
|
+
downloadingHint: "Your phone will then ask you to confirm the install.",
|
|
26
|
+
historyTitle: "Version history",
|
|
27
|
+
},
|
|
13
28
|
};
|
|
14
29
|
export const defaultStyles = {
|
|
15
30
|
container: { gap: 4 },
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from "./AboutSettingsScreen";
|
|
2
|
-
export * from "./BackupSettingsScreen";
|
|
3
|
-
export * from "./ContactSettingsScreen";
|
|
4
|
-
export * from "./PrivacySettingsScreen";
|
|
5
|
-
export * from "./SettingsMenu";
|
|
6
|
-
export * from "./ThemeSettingsScreen";
|
|
7
|
-
export * from "./UpdateSettingsScreen";
|
|
1
|
+
export * from "./AboutSettingsScreen.js";
|
|
2
|
+
export * from "./BackupSettingsScreen.js";
|
|
3
|
+
export * from "./ContactSettingsScreen.js";
|
|
4
|
+
export * from "./PrivacySettingsScreen.js";
|
|
5
|
+
export * from "./SettingsMenu.js";
|
|
6
|
+
export * from "./ThemeSettingsScreen.js";
|
|
7
|
+
export * from "./UpdateSettingsScreen.js";
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/settings/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/settings/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from "./AboutSettingsScreen";
|
|
2
|
-
export * from "./BackupSettingsScreen";
|
|
3
|
-
export * from "./ContactSettingsScreen";
|
|
4
|
-
export * from "./PrivacySettingsScreen";
|
|
5
|
-
export * from "./SettingsMenu";
|
|
6
|
-
export * from "./ThemeSettingsScreen";
|
|
7
|
-
export * from "./UpdateSettingsScreen";
|
|
1
|
+
export * from "./AboutSettingsScreen.js";
|
|
2
|
+
export * from "./BackupSettingsScreen.js";
|
|
3
|
+
export * from "./ContactSettingsScreen.js";
|
|
4
|
+
export * from "./PrivacySettingsScreen.js";
|
|
5
|
+
export * from "./SettingsMenu.js";
|
|
6
|
+
export * from "./ThemeSettingsScreen.js";
|
|
7
|
+
export * from "./UpdateSettingsScreen.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
2
2
|
import { Ionicons } from "@expo/vector-icons";
|
|
3
3
|
import type { ThemePreference } from "../../hooks/useEffectiveColorScheme.js";
|
|
4
|
+
import { type KitLocale } from "../../i18n/locale.js";
|
|
4
5
|
import type { ThemeToggleLabels } from "./ThemeToggle.js";
|
|
5
6
|
export interface ThemeOptionListIcons {
|
|
6
7
|
light?: keyof typeof Ionicons.glyphMap;
|
|
@@ -21,8 +22,13 @@ export interface ThemeOptionListProps {
|
|
|
21
22
|
value: ThemePreference;
|
|
22
23
|
onChange: (preference: ThemePreference) => void;
|
|
23
24
|
labels?: ThemeToggleLabels;
|
|
25
|
+
/**
|
|
26
|
+
* Language of the built-in labels — French by default, or the nearest
|
|
27
|
+
* `KitLocaleProvider`'s. `labels` still overrides individual strings.
|
|
28
|
+
*/
|
|
29
|
+
locale?: KitLocale;
|
|
24
30
|
icons?: ThemeOptionListIcons;
|
|
25
31
|
styles?: ThemeOptionListStyles;
|
|
26
32
|
}
|
|
27
|
-
export declare function ThemeOptionList({ value, onChange, labels, icons, styles, }: ThemeOptionListProps): import("react").JSX.Element;
|
|
33
|
+
export declare function ThemeOptionList({ value, onChange, labels, locale, icons, styles, }: ThemeOptionListProps): import("react").JSX.Element;
|
|
28
34
|
//# sourceMappingURL=ThemeOptionList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeOptionList.d.ts","sourceRoot":"","sources":["../../../src/components/theme/ThemeOptionList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"ThemeOptionList.d.ts","sourceRoot":"","sources":["../../../src/components/theme/ThemeOptionList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,KAAK,SAAS,EAAgB,MAAM,sBAAsB,CAAC;AAIpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAAM,OAAO,QAAQ,CAAC,QAAQ,CAAC;IACvC,IAAI,CAAC,EAAE,MAAM,OAAO,QAAQ,CAAC,QAAQ,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,OAAO,QAAQ,CAAC,QAAQ,CAAC;CACzC;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,GAAG,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,WAAW,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,CAAC,UAAU,EAAE,eAAe,KAAK,IAAI,CAAC;IAChD,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,MAAM,CAAC,EAAE,qBAAqB,CAAC;CAChC;AAyCD,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,MAAM,EACN,KAAK,EACL,MAAM,GACP,EAAE,oBAAoB,+BAwCtB"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Pressable, Text, View } from "react-native";
|
|
3
3
|
import { Ionicons } from "@expo/vector-icons";
|
|
4
|
+
import { useKitLocale } from "../../i18n/locale.js";
|
|
5
|
+
import { mergeSlotStyles } from "../../utils/helpers/mergeSlotStyles.js";
|
|
6
|
+
import { defaultThemeLabels } from "./themeLabels.js";
|
|
4
7
|
const OPTIONS = ["light", "dark", "system"];
|
|
5
|
-
const defaultLabels = {
|
|
6
|
-
light: "Clair",
|
|
7
|
-
dark: "Sombre",
|
|
8
|
-
system: "Système",
|
|
9
|
-
};
|
|
10
8
|
const defaultIcons = {
|
|
11
9
|
light: "sunny-outline",
|
|
12
10
|
dark: "moon-outline",
|
|
@@ -42,18 +40,9 @@ const defaultStyles = {
|
|
|
42
40
|
// Selectable list of rows (icon + label + checkmark) for a light/dark/system
|
|
43
41
|
// theme preference. Same data contract as ThemeToggle, but a taller row-based
|
|
44
42
|
// layout instead of a 3-way segmented control.
|
|
45
|
-
export function ThemeOptionList({ value, onChange, labels, icons, styles, }) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// the whole default style object.
|
|
49
|
-
const merged = {
|
|
50
|
-
container: [defaultStyles.container, styles?.container],
|
|
51
|
-
row: [defaultStyles.row, styles?.row],
|
|
52
|
-
rowActive: [defaultStyles.rowActive, styles?.rowActive],
|
|
53
|
-
label: [defaultStyles.label, styles?.label],
|
|
54
|
-
labelActive: [defaultStyles.labelActive, styles?.labelActive],
|
|
55
|
-
};
|
|
56
|
-
const t = { ...defaultLabels, ...labels };
|
|
43
|
+
export function ThemeOptionList({ value, onChange, labels, locale, icons, styles, }) {
|
|
44
|
+
const merged = mergeSlotStyles(defaultStyles, styles);
|
|
45
|
+
const t = { ...defaultThemeLabels[useKitLocale(locale)], ...labels };
|
|
57
46
|
const i = { ...defaultIcons, ...icons };
|
|
58
47
|
const iconColor = styles?.iconColor ?? defaultStyles.iconColor;
|
|
59
48
|
const iconColorActive = styles?.iconColorActive ?? defaultStyles.iconColorActive;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
2
2
|
import type { ThemePreference } from "../../hooks/useEffectiveColorScheme.js";
|
|
3
|
+
import { type KitLocale } from "../../i18n/locale.js";
|
|
3
4
|
export interface ThemeToggleStyles {
|
|
4
5
|
container?: StyleProp<ViewStyle>;
|
|
5
6
|
option?: StyleProp<ViewStyle>;
|
|
@@ -16,7 +17,12 @@ export interface ThemeToggleProps {
|
|
|
16
17
|
value: ThemePreference;
|
|
17
18
|
onChange: (preference: ThemePreference) => void;
|
|
18
19
|
labels?: ThemeToggleLabels;
|
|
20
|
+
/**
|
|
21
|
+
* Language of the built-in labels — French by default, or the nearest
|
|
22
|
+
* `KitLocaleProvider`'s. `labels` still overrides individual strings.
|
|
23
|
+
*/
|
|
24
|
+
locale?: KitLocale;
|
|
19
25
|
styles?: ThemeToggleStyles;
|
|
20
26
|
}
|
|
21
|
-
export declare function ThemeToggle({ value, onChange, labels, styles, }: ThemeToggleProps): import("react").JSX.Element;
|
|
27
|
+
export declare function ThemeToggle({ value, onChange, labels, locale, styles, }: ThemeToggleProps): import("react").JSX.Element;
|
|
22
28
|
//# sourceMappingURL=ThemeToggle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeToggle.d.ts","sourceRoot":"","sources":["../../../src/components/theme/ThemeToggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"ThemeToggle.d.ts","sourceRoot":"","sources":["../../../src/components/theme/ThemeToggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,KAAK,SAAS,EAAgB,MAAM,sBAAsB,CAAC;AAKpE,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC9B,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,gBAAgB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,CAAC,UAAU,EAAE,eAAe,KAAK,IAAI,CAAC;IAChD,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAqBD,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAM,GACP,EAAE,gBAAgB,+BA6BlB"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Pressable, Text, View } from "react-native";
|
|
3
|
+
import { useKitLocale } from "../../i18n/locale.js";
|
|
4
|
+
import { mergeSlotStyles } from "../../utils/helpers/mergeSlotStyles.js";
|
|
5
|
+
import { defaultThemeLabels } from "./themeLabels.js";
|
|
3
6
|
const OPTIONS = ["light", "dark", "system"];
|
|
4
7
|
const defaultStyles = {
|
|
5
8
|
container: { flexDirection: "row", gap: 8 },
|
|
@@ -16,27 +19,10 @@ const defaultStyles = {
|
|
|
16
19
|
optionText: { fontSize: 15, fontWeight: "600", color: "#111827" },
|
|
17
20
|
optionTextActive: { color: "#ffffff" },
|
|
18
21
|
};
|
|
19
|
-
const defaultLabels = {
|
|
20
|
-
light: "Clair",
|
|
21
|
-
dark: "Sombre",
|
|
22
|
-
system: "Système",
|
|
23
|
-
};
|
|
24
22
|
// 3-way segmented control for a light/dark/system theme preference.
|
|
25
|
-
export function ThemeToggle({ value, onChange, labels, styles, }) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// the whole default style object.
|
|
29
|
-
const merged = {
|
|
30
|
-
container: [defaultStyles.container, styles?.container],
|
|
31
|
-
option: [defaultStyles.option, styles?.option],
|
|
32
|
-
optionActive: [defaultStyles.optionActive, styles?.optionActive],
|
|
33
|
-
optionText: [defaultStyles.optionText, styles?.optionText],
|
|
34
|
-
optionTextActive: [
|
|
35
|
-
defaultStyles.optionTextActive,
|
|
36
|
-
styles?.optionTextActive,
|
|
37
|
-
],
|
|
38
|
-
};
|
|
39
|
-
const t = { ...defaultLabels, ...labels };
|
|
23
|
+
export function ThemeToggle({ value, onChange, labels, locale, styles, }) {
|
|
24
|
+
const merged = mergeSlotStyles(defaultStyles, styles);
|
|
25
|
+
const t = { ...defaultThemeLabels[useKitLocale(locale)], ...labels };
|
|
40
26
|
return (_jsx(View, { style: merged.container, children: OPTIONS.map((option) => {
|
|
41
27
|
const active = option === value;
|
|
42
28
|
return (_jsx(Pressable, { style: [merged.option, active && merged.optionActive], onPress: () => {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./ThemeOptionList";
|
|
2
|
-
export * from "./ThemeToggle";
|
|
1
|
+
export * from "./ThemeOptionList.js";
|
|
2
|
+
export * from "./ThemeToggle.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./ThemeOptionList";
|
|
2
|
-
export * from "./ThemeToggle";
|
|
1
|
+
export * from "./ThemeOptionList.js";
|
|
2
|
+
export * from "./ThemeToggle.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Default light/dark/system labels, shared by ThemeToggle and ThemeOptionList. */
|
|
2
|
+
export declare const defaultThemeLabels: {
|
|
3
|
+
fr: {
|
|
4
|
+
light: string;
|
|
5
|
+
dark: string;
|
|
6
|
+
system: string;
|
|
7
|
+
};
|
|
8
|
+
en: {
|
|
9
|
+
light: string;
|
|
10
|
+
dark: string;
|
|
11
|
+
system: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=themeLabels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeLabels.d.ts","sourceRoot":"","sources":["../../../src/components/theme/themeLabels.ts"],"names":[],"mappings":"AAIA,mFAAmF;AACnF,eAAO,MAAM,kBAAkB;;;;;;;;;;;CAG2B,CAAC"}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./useDebouncedChange";
|
|
2
|
-
export * from "./useEffectiveColorScheme";
|
|
3
|
-
export * from "./useSubmitGuard";
|
|
1
|
+
export * from "./useDebouncedChange.js";
|
|
2
|
+
export * from "./useEffectiveColorScheme.js";
|
|
3
|
+
export * from "./useSubmitGuard.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./useDebouncedChange";
|
|
2
|
-
export * from "./useEffectiveColorScheme";
|
|
3
|
-
export * from "./useSubmitGuard";
|
|
1
|
+
export * from "./useDebouncedChange.js";
|
|
2
|
+
export * from "./useEffectiveColorScheme.js";
|
|
3
|
+
export * from "./useSubmitGuard.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDebouncedChange.d.ts","sourceRoot":"","sources":["../../src/hooks/useDebouncedChange.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDebouncedChange.d.ts","sourceRoot":"","sources":["../../src/hooks/useDebouncedChange.ts"],"names":[],"mappings":"AAQA,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,OAAO,EAAE,EACjB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,IAAI,QAkBrB"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useEffect, useRef } from "react";
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// dépendances de useEffect classique.
|
|
2
|
+
// Fires `callback` `delayMs` after the last change among `values`, ignoring
|
|
3
|
+
// every render while at least one value is `undefined` (e.g. data not loaded
|
|
4
|
+
// yet) and the very first render where they're all defined (so it doesn't
|
|
5
|
+
// fire on mount). The delay restarts if a new value arrives before it
|
|
6
|
+
// expires (a true debounce). `values` must keep the same length across
|
|
7
|
+
// renders, like a regular useEffect dependency array.
|
|
9
8
|
export function useDebouncedChange(values, delayMs, callback) {
|
|
10
9
|
const hasInitializedRef = useRef(false);
|
|
11
10
|
useEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSubmitGuard.d.ts","sourceRoot":"","sources":["../../src/hooks/useSubmitGuard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSubmitGuard.d.ts","sourceRoot":"","sources":["../../src/hooks/useSubmitGuard.ts"],"names":[],"mappings":"AAMA,wBAAgB,cAAc;;oBAIC,MAAM,OAAO,CAAC,IAAI,CAAC;EAajD"}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
1
|
+
import { useRef, useState } from "react";
|
|
2
|
+
// Blocks a second call while a first one is still running (e.g. a double tap
|
|
3
|
+
// on a "Save" button before it had time to disable itself, which would create
|
|
4
|
+
// duplicate submissions). The lock is a ref, not the `isSaving` state: two
|
|
5
|
+
// taps handled before the re-render would both still read the stale `false`.
|
|
5
6
|
export function useSubmitGuard() {
|
|
6
7
|
const [isSaving, setIsSaving] = useState(false);
|
|
8
|
+
const inFlightRef = useRef(false);
|
|
7
9
|
async function guard(action) {
|
|
8
|
-
if (
|
|
10
|
+
if (inFlightRef.current)
|
|
9
11
|
return;
|
|
12
|
+
inFlightRef.current = true;
|
|
10
13
|
setIsSaving(true);
|
|
11
14
|
try {
|
|
12
15
|
await action();
|
|
13
16
|
}
|
|
14
17
|
finally {
|
|
18
|
+
inFlightRef.current = false;
|
|
15
19
|
setIsSaving(false);
|
|
16
20
|
}
|
|
17
21
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type KitLocale } from "./locale.js";
|
|
3
|
+
export interface KitLocaleProviderProps {
|
|
4
|
+
locale: KitLocale;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Sets the language of every kit component's built-in labels below it — for
|
|
9
|
+
* a bilingual app, switch it once here instead of passing `locale` to each
|
|
10
|
+
* component. A component's own `locale` prop still wins, and its `labels`
|
|
11
|
+
* prop still overrides individual strings.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <KitLocaleProvider locale={userLanguage}>
|
|
15
|
+
* <App />
|
|
16
|
+
* </KitLocaleProvider>
|
|
17
|
+
*/
|
|
18
|
+
export declare function KitLocaleProvider({ locale, children, }: KitLocaleProviderProps): import("react").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=KitLocaleProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KitLocaleProvider.d.ts","sourceRoot":"","sources":["../../src/i18n/KitLocaleProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,aAAa,CAAC;AAE/D,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,MAAM,EACN,QAAQ,GACT,EAAE,sBAAsB,+BAExB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { KitLocaleContext } from "./locale.js";
|
|
3
|
+
/**
|
|
4
|
+
* Sets the language of every kit component's built-in labels below it — for
|
|
5
|
+
* a bilingual app, switch it once here instead of passing `locale` to each
|
|
6
|
+
* component. A component's own `locale` prop still wins, and its `labels`
|
|
7
|
+
* prop still overrides individual strings.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <KitLocaleProvider locale={userLanguage}>
|
|
11
|
+
* <App />
|
|
12
|
+
* </KitLocaleProvider>
|
|
13
|
+
*/
|
|
14
|
+
export function KitLocaleProvider({ locale, children, }) {
|
|
15
|
+
return _jsx(KitLocaleContext, { value: locale, children: children });
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Languages the kit's built-in labels are available in. */
|
|
2
|
+
export type KitLocale = "fr" | "en";
|
|
3
|
+
/** Used when neither a `locale` prop nor a `KitLocaleProvider` sets one. */
|
|
4
|
+
export declare const DEFAULT_KIT_LOCALE: KitLocale;
|
|
5
|
+
/** BCP 47 tags matching each locale, for `Intl` dates and speech recognition. */
|
|
6
|
+
export declare const KIT_LOCALE_TAGS: Record<KitLocale, string>;
|
|
7
|
+
/** Provided by `KitLocaleProvider`, read by {@link useKitLocale}. */
|
|
8
|
+
export declare const KitLocaleContext: import("react").Context<KitLocale>;
|
|
9
|
+
/**
|
|
10
|
+
* Resolves the locale a component renders its built-in labels in: its own
|
|
11
|
+
* `locale` prop, else the nearest `KitLocaleProvider`, else French.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useKitLocale(locale?: KitLocale): KitLocale;
|
|
14
|
+
//# sourceMappingURL=locale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../../src/i18n/locale.ts"],"names":[],"mappings":"AAEA,4DAA4D;AAC5D,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;AAEpC,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,EAAE,SAAgB,CAAC;AAElD,iFAAiF;AACjF,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAGrD,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,oCAA+C,CAAC;AAE7E;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAG1D"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createContext, use } from "react";
|
|
2
|
+
/** Used when neither a `locale` prop nor a `KitLocaleProvider` sets one. */
|
|
3
|
+
export const DEFAULT_KIT_LOCALE = "fr";
|
|
4
|
+
/** BCP 47 tags matching each locale, for `Intl` dates and speech recognition. */
|
|
5
|
+
export const KIT_LOCALE_TAGS = {
|
|
6
|
+
fr: "fr-FR",
|
|
7
|
+
en: "en-US",
|
|
8
|
+
};
|
|
9
|
+
/** Provided by `KitLocaleProvider`, read by {@link useKitLocale}. */
|
|
10
|
+
export const KitLocaleContext = createContext(DEFAULT_KIT_LOCALE);
|
|
11
|
+
/**
|
|
12
|
+
* Resolves the locale a component renders its built-in labels in: its own
|
|
13
|
+
* `locale` prop, else the nearest `KitLocaleProvider`, else French.
|
|
14
|
+
*/
|
|
15
|
+
export function useKitLocale(locale) {
|
|
16
|
+
const contextLocale = use(KitLocaleContext);
|
|
17
|
+
return locale ?? contextLocale;
|
|
18
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -17,13 +17,16 @@ export * from "./components/theme/ThemeToggle.js";
|
|
|
17
17
|
export * from "./hooks/useDebouncedChange.js";
|
|
18
18
|
export * from "./hooks/useEffectiveColorScheme.js";
|
|
19
19
|
export * from "./hooks/useSubmitGuard.js";
|
|
20
|
+
export * from "./i18n/KitLocaleProvider.js";
|
|
21
|
+
export * from "./i18n/locale.js";
|
|
20
22
|
export * from "./utils/helpers/confirmDestructive.js";
|
|
23
|
+
export * from "./utils/helpers/mergeSlotStyles.js";
|
|
21
24
|
export { getMostRecentIds, type RecentIdRow, } from "@forthtilliath/ts-kit/array/getMostRecentIds";
|
|
22
25
|
export { nextInCycle } from "@forthtilliath/ts-kit/array/nextInCycle";
|
|
23
26
|
export { rankByNameMatch } from "@forthtilliath/ts-kit/array/rankByNameMatch";
|
|
27
|
+
export { escapeCsvField } from "@forthtilliath/ts-kit/csv/escapeCsvField";
|
|
28
|
+
export { formatCsvNumber } from "@forthtilliath/ts-kit/csv/formatCsvNumber";
|
|
24
29
|
export { getPeriodStartMs, type PeriodFilter, } from "@forthtilliath/ts-kit/date/getPeriodStartMs";
|
|
25
|
-
export { formatCsvNumber } from "@forthtilliath/ts-kit/number/formatCsvNumber";
|
|
26
|
-
export { escapeCsvField } from "@forthtilliath/ts-kit/string/escapeCsvField";
|
|
27
30
|
export { escapeHtml } from "@forthtilliath/ts-kit/string/escapeHtml";
|
|
28
31
|
export { normalizeForSearch } from "@forthtilliath/ts-kit/string/normalizeForSearch";
|
|
29
32
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,uCAAuC,CAAC;AACtD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,uCAAuC,CAAC;AACtD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oCAAoC,CAAC;AACnD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,uCAAuC,CAAC;AACtD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,uCAAuC,CAAC;AACtD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oCAAoC,CAAC;AACnD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,cAAc,uCAAuC,CAAC;AACtD,cAAc,oCAAoC,CAAC;AAGnD,OAAO,EACL,gBAAgB,EAChB,KAAK,WAAW,GACjB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EACL,gBAAgB,EAChB,KAAK,YAAY,GAClB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -22,14 +22,17 @@ export * from "./components/theme/ThemeToggle.js";
|
|
|
22
22
|
export * from "./hooks/useDebouncedChange.js";
|
|
23
23
|
export * from "./hooks/useEffectiveColorScheme.js";
|
|
24
24
|
export * from "./hooks/useSubmitGuard.js";
|
|
25
|
+
export * from "./i18n/KitLocaleProvider.js";
|
|
26
|
+
export * from "./i18n/locale.js";
|
|
25
27
|
export * from "./utils/helpers/confirmDestructive.js";
|
|
28
|
+
export * from "./utils/helpers/mergeSlotStyles.js";
|
|
26
29
|
// Framework-agnostic — actually implemented (and tested/documented) in
|
|
27
30
|
// ts-kit, re-exported here so existing imports of these names keep working.
|
|
28
31
|
export { getMostRecentIds, } from "@forthtilliath/ts-kit/array/getMostRecentIds";
|
|
29
32
|
export { nextInCycle } from "@forthtilliath/ts-kit/array/nextInCycle";
|
|
30
33
|
export { rankByNameMatch } from "@forthtilliath/ts-kit/array/rankByNameMatch";
|
|
34
|
+
export { escapeCsvField } from "@forthtilliath/ts-kit/csv/escapeCsvField";
|
|
35
|
+
export { formatCsvNumber } from "@forthtilliath/ts-kit/csv/formatCsvNumber";
|
|
31
36
|
export { getPeriodStartMs, } from "@forthtilliath/ts-kit/date/getPeriodStartMs";
|
|
32
|
-
export { formatCsvNumber } from "@forthtilliath/ts-kit/number/formatCsvNumber";
|
|
33
|
-
export { escapeCsvField } from "@forthtilliath/ts-kit/string/escapeCsvField";
|
|
34
37
|
export { escapeHtml } from "@forthtilliath/ts-kit/string/escapeHtml";
|
|
35
38
|
export { normalizeForSearch } from "@forthtilliath/ts-kit/string/normalizeForSearch";
|