@blocklet/labels 1.4.12 → 1.4.14

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.
@@ -1,11 +1,12 @@
1
1
  /// <reference types="react" />
2
- import { Label } from './types';
2
+ import { Label, LabelDto } from './types';
3
3
  interface LabelsProviderProps {
4
- fetchLabels: () => Promise<Label[]>;
4
+ fetchLabels: () => Promise<LabelDto[]>;
5
5
  children: React.ReactNode;
6
6
  }
7
7
  interface LabelsContextValue {
8
8
  labels: Label[];
9
+ localizedLabels: Label[];
9
10
  loading: boolean;
10
11
  updateLabels: () => void;
11
12
  getLabelsById: (ids: string[]) => Label[];
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { Label } from './types';
2
+ import type { Label } from './types';
3
3
  interface LabelFormDialogProps {
4
4
  open: boolean;
5
5
  onClose: () => void;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import type { TextFieldProps } from '@mui/material';
3
+ import type { Translation } from './types';
4
+ interface Props {
5
+ I18NProps: {
6
+ translation: Translation;
7
+ onChange: (translation: Translation) => void;
8
+ };
9
+ }
10
+ export default function TranslationInput({ I18NProps, ...rest }: TextFieldProps & Props): JSX.Element;
11
+ export {};
@@ -1,15 +1,20 @@
1
+ export declare type Translation = {
2
+ [locale: string]: string;
3
+ };
1
4
  export interface Label {
2
5
  id: string;
3
6
  name: string;
4
7
  icon?: string;
5
8
  color: string;
6
- type?: 'system' | 'user-defined';
9
+ translation?: Translation;
7
10
  parent?: Label;
8
11
  children?: Label[];
9
12
  }
10
13
  export interface LabelDto {
11
14
  id: string;
12
15
  name: string;
16
+ icon?: string;
13
17
  color: string;
18
+ translation?: string;
14
19
  parentId?: string;
15
20
  }
@@ -5,4 +5,5 @@ export declare const flatten: <T extends {
5
5
  export declare const copyTree: <T extends {
6
6
  children?: T[] | undefined;
7
7
  }>(data: T[]) => T[];
8
+ export declare const safeParseJSON: (json: string | undefined, defaultValue?: any) => any;
8
9
  export declare const transformLabels: (labelDtos: LabelDto[]) => Label[];