aa-geuthur-react 1.3.1 → 1.4.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 CHANGED
@@ -82,7 +82,7 @@ import "@/Styles/index.css";
82
82
 
83
83
  ### Translations<a name="translations"></a>
84
84
 
85
- Every text of the package lives in the i18next namespace `aa-geuthur-react` and is bundled into the package. `AaReactProvider` registers the translations with the i18next instance of the app when it mounts (`addResourceBundle`, texts the app already has for the namespace are kept), so the app lists only its own namespace and copies nothing. Untranslated texts are empty strings, so set `returnEmptyString: false` and i18next falls back to English:
85
+ Every text of the package lives in the i18next namespace `aa-geuthur-react` and is bundled into the package. `AaReactProvider` registers the translations with the i18next instance of the app when it mounts (`addResourceBundle`, texts the app already has for the namespace are kept), so the app lists only its own namespace and copies nothing. Untranslated texts are missing from the language files, so i18next falls back to English through `fallbackLng`:
86
86
 
87
87
  ```ts
88
88
  i18n.use(Backend).use(initReactI18next).init({
@@ -90,7 +90,6 @@ i18n.use(Backend).use(initReactI18next).init({
90
90
  fallbackLng: "en",
91
91
  ns: ["translation"],
92
92
  defaultNS: "translation",
93
- returnEmptyString: false,
94
93
  backend: {
95
94
  loadPath: `/static/${ProjectName}/i18n/{{lng}}/{{ns}}.json`,
96
95
  },
@@ -99,7 +98,7 @@ i18n.use(Backend).use(initReactI18next).init({
99
98
 
100
99
  The constants `I18N_NAMESPACE` (`aa-geuthur-react`) and `I18N_FALLBACK_NAMESPACE` (`translation`) are exported. Menu link names come from the app, so the menu tries the package namespace first and the namespace of the app second. `registerI18nResources(i18n)` adds the translations to an instance outside of the provider, e.g. in a test.
101
100
 
102
- The source files `i18n/<lng>/aa-geuthur-react.json` (12 languages: `en`, `de`, `es`, `fr-FR`, `it-IT`, `ja`, `ko-KR`, `nl-NL`, `pl-PL`, `ru`, `uk`, `zh-Hans`) are translated in [Weblate](https://weblate.geuthur.de/projects/allianceauth/aa-geuthur-react/); `en` is the template with key equal value, `make translations` adds new keys empty to every other language. They stay exported as `aa-geuthur-react/i18n/<lng>/aa-geuthur-react.json`.
101
+ The source files `i18n/<lng>/aa-geuthur-react.json` (12 languages: `en`, `de`, `es`, `fr-FR`, `it-IT`, `ja`, `ko-KR`, `nl-NL`, `pl-PL`, `ru`, `uk`, `zh-Hans`) are translated in [Weblate](https://weblate.geuthur.de/projects/allianceauth/aa-geuthur-react/); `en` is the template with key equal value and the only file `make translations` maintains. The other languages hold real translations only, Weblate leaves untranslated texts out. They stay exported as `aa-geuthur-react/i18n/<lng>/aa-geuthur-react.json`.
103
102
 
104
103
  ### API client<a name="api-client"></a>
105
104
 
@@ -0,0 +1,18 @@
1
+ import { default as React } from 'react';
2
+ export interface FilterOption<T extends string = string> {
3
+ value: T;
4
+ label: string;
5
+ /** Optional icon shown before the label. */
6
+ icon?: React.ReactNode;
7
+ /** Optional counter shown as a badge after the label. */
8
+ count?: number;
9
+ }
10
+ export interface FilterButtonGroupProps<T extends string = string> {
11
+ options: FilterOption<T>[];
12
+ value: T;
13
+ onChange: (value: T) => void;
14
+ ariaLabel: string;
15
+ }
16
+ /** Button group to pick one filter value, with optional icons and counters. */
17
+ export declare function FilterButtonGroup<T extends string = string>({ options, value, onChange, ariaLabel, }: FilterButtonGroupProps<T>): React.JSX.Element;
18
+ export default FilterButtonGroup;
@@ -0,0 +1 @@
1
+ export * from './FilterButtonGroup';
@@ -9,3 +9,4 @@ export * from './BaseModal/useModalState';
9
9
  export * from './Loader';
10
10
  export { default as BaseSectionHeader } from './BaseHeader';
11
11
  export type { BaseSectionHeaderProps } from './BaseHeader';
12
+ export * from './FilterButtonGroup';
package/dist/i18n.d.ts CHANGED
@@ -9,8 +9,8 @@ export declare const I18N_FALLBACK_NAMESPACE = "translation";
9
9
  /**
10
10
  * Adds the bundled translations of this package to an initialized i18next instance, once per instance.
11
11
  * `AaReactProvider` calls it on mount. Existing texts of the namespace are kept, so an app can
12
- * override single texts with its own resources. Untranslated texts are empty strings; the app sets
13
- * `returnEmptyString: false` so they fall back to `fallbackLng`. Does nothing without an
12
+ * override single texts with its own resources. Untranslated texts are missing from the language
13
+ * files, so i18next falls back to `fallbackLng` (`en`). Does nothing without an
14
14
  * initialized instance (e.g. when `react-i18next` is mocked in a test).
15
15
  */
16
16
  export declare function registerI18nResources(i18n: I18n | undefined): void;