@stamprally/admin-ui 0.8.0 → 0.10.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/dist/index.d.ts CHANGED
@@ -1,81 +1,39 @@
1
- import * as react from 'react';
2
- import { AdminRallyConfig, StampCondition, SupportedLocale, RallyConfig, LocaleDictionary, RewardItem, SpotItem, SheetTheme } from '@stamprally/core';
3
- export { LocaleDictionary } from '@stamprally/core';
1
+ import { SupportedLocale, AdminRallyConfig, LocaleDictionary, CheckInCondition, SpotItem } from '@stamprally/core';
2
+ import { ReactElement } from 'react';
4
3
 
5
- interface AdminRallyEditorProps<TLocale extends string = string, TMeta extends Record<string, unknown> = Record<string, unknown>> {
4
+ interface AdminRallyEditorProps<TLocale extends string = SupportedLocale, TMeta extends Record<string, unknown> = Record<string, unknown>> {
6
5
  readonly config: AdminRallyConfig<TLocale, TMeta>;
7
- readonly locale?: TLocale;
8
6
  readonly onChange: (config: AdminRallyConfig<TLocale, TMeta>) => void;
9
- }
10
- /** Universal-model GUI editor. JSON import/export remains available as a separate component. */
11
- declare function AdminRallyEditor<TLocale extends string = string, TMeta extends Record<string, unknown> = Record<string, unknown>>({ config, locale, onChange }: AdminRallyEditorProps<TLocale, TMeta>): react.JSX.Element;
12
- interface GeneralSettingsFormProps<TLocale extends string = SupportedLocale> {
13
- readonly config: RallyConfig<TLocale>;
14
- readonly locale?: TLocale;
15
- readonly dictionary?: LocaleDictionary<TLocale>;
16
- readonly onChange: (config: RallyConfig<TLocale>) => void;
17
- }
18
- declare function GeneralSettingsForm<TLocale extends string = SupportedLocale>({ config, locale, onChange, }: GeneralSettingsFormProps<TLocale>): react.JSX.Element;
19
- interface ConditionEditorProps {
20
- readonly condition: StampCondition;
21
- readonly onChange: (condition: StampCondition) => void;
22
- readonly locale?: SupportedLocale | (string & {});
23
- }
24
- declare function ConditionEditor({ condition, onChange }: ConditionEditorProps): react.JSX.Element;
25
- interface SpotItemFormProps<TLocale extends string = SupportedLocale> {
26
- readonly spot: SpotItem<TLocale>;
27
- readonly index?: number;
28
- readonly locale?: TLocale;
7
+ readonly locale?: string;
29
8
  readonly dictionary?: LocaleDictionary<TLocale>;
30
- readonly onChange: (spot: SpotItem<TLocale>) => void;
31
- readonly onDelete?: () => void;
32
9
  }
33
- declare function SpotItemForm<TLocale extends string = SupportedLocale>({ spot, index, locale, onChange, onDelete, }: SpotItemFormProps<TLocale>): react.JSX.Element;
34
- interface SpotListEditorProps<TLocale extends string = SupportedLocale> {
35
- readonly spots: ReadonlyArray<SpotItem<TLocale>>;
36
- readonly locale?: TLocale;
10
+ type DictionaryProps<TLocale extends string> = {
11
+ readonly locale?: NoInfer<TLocale>;
37
12
  readonly dictionary?: LocaleDictionary<TLocale>;
38
- readonly onChange: (spots: ReadonlyArray<SpotItem<TLocale>>) => void;
39
- }
40
- declare function SpotListEditor<TLocale extends string = SupportedLocale>({ spots, locale, onChange, }: SpotListEditorProps<TLocale>): react.JSX.Element;
41
- interface RewardListEditorProps<TLocale extends string = SupportedLocale> {
42
- readonly rewards: ReadonlyArray<RewardItem<TLocale>>;
43
- readonly locale?: TLocale;
44
- readonly dictionary?: LocaleDictionary<TLocale>;
45
- readonly onChange: (rewards: ReadonlyArray<RewardItem<TLocale>>) => void;
46
- }
47
- declare function RewardListEditor<TLocale extends string = SupportedLocale>({ rewards, locale, onChange, }: RewardListEditorProps<TLocale>): react.JSX.Element;
48
- interface ThemePresetSelectorProps {
49
- readonly value?: SheetTheme;
50
- readonly locale?: SupportedLocale | (string & {});
51
- readonly onChange: (theme: SheetTheme) => void;
52
- }
53
- declare function ThemePresetSelector({ value, locale, onChange }: ThemePresetSelectorProps): react.JSX.Element;
54
- interface ThemeEditorProps {
55
- readonly theme?: SheetTheme;
56
- readonly locale?: SupportedLocale | (string & {});
57
- readonly onChange: (theme: SheetTheme) => void;
58
- }
59
- declare function ThemeEditor({ theme, locale, onChange, }: ThemeEditorProps): react.JSX.Element;
60
- interface QrExportModalProps<TLocale extends string = SupportedLocale> {
61
- readonly open: boolean;
62
- readonly config: RallyConfig<TLocale>;
63
- readonly locale?: TLocale;
64
- readonly onClose: () => void;
65
- }
66
- declare function QrExportModal<TLocale extends string = SupportedLocale>({ open, config, locale, onClose, }: QrExportModalProps<TLocale>): react.JSX.Element | null;
67
- interface JsonConfigIOProps<TLocale extends string = SupportedLocale> {
68
- readonly config: RallyConfig<TLocale>;
69
- readonly onImport: (config: RallyConfig<TLocale>) => void;
70
- readonly locale?: TLocale;
13
+ };
14
+ interface ConditionEditorProps<TLocale extends string = SupportedLocale> extends DictionaryProps<TLocale> {
15
+ readonly condition: CheckInCondition;
16
+ readonly onChange: (condition: CheckInCondition) => void;
17
+ readonly onRemove?: () => void;
18
+ }
19
+ declare function ConditionEditor<TLocale extends string = SupportedLocale>({ condition, onChange, onRemove, locale, dictionary, }: ConditionEditorProps<TLocale>): ReactElement;
20
+ interface SpotItemFormProps<TLocale extends string = SupportedLocale, TMeta extends Record<string, unknown> = Record<string, unknown>> extends DictionaryProps<TLocale> {
21
+ readonly spot: SpotItem<TLocale, TMeta>;
22
+ readonly onChange: (spot: SpotItem<TLocale, TMeta>) => void;
23
+ readonly onRemove?: () => void;
24
+ }
25
+ declare function SpotItemForm<TLocale extends string = SupportedLocale, TMeta extends Record<string, unknown> = Record<string, unknown>>({ spot, onChange, onRemove, locale, dictionary, }: SpotItemFormProps<TLocale, TMeta>): ReactElement;
26
+ declare function AdminRallyEditor<TLocale extends string = SupportedLocale, TMeta extends Record<string, unknown> = Record<string, unknown>>({ config, onChange, locale, dictionary }: AdminRallyEditorProps<TLocale, TMeta>): ReactElement;
27
+ declare const RallyEditor: typeof AdminRallyEditor;
28
+ interface GeneralSettingsFormProps<TLocale extends string = SupportedLocale, TMeta extends Record<string, unknown> = Record<string, unknown>> extends DictionaryProps<TLocale> {
29
+ readonly config: AdminRallyConfig<TLocale, TMeta>;
30
+ readonly onChange: (config: AdminRallyConfig<TLocale, TMeta>) => void;
71
31
  }
72
- declare function JsonConfigIO<TLocale extends string = SupportedLocale>({ config, onImport, }: JsonConfigIOProps<TLocale>): react.JSX.Element;
73
- interface RallyEditorProps<TLocale extends string = SupportedLocale> {
74
- readonly config: RallyConfig<TLocale>;
75
- readonly locale?: TLocale;
76
- readonly dictionary?: LocaleDictionary<TLocale>;
77
- readonly onChange: (config: RallyConfig<TLocale>) => void;
32
+ declare function GeneralSettingsForm<TLocale extends string = SupportedLocale, TMeta extends Record<string, unknown> = Record<string, unknown>>({ config, onChange, locale, dictionary, }: GeneralSettingsFormProps<TLocale, TMeta>): ReactElement;
33
+ interface JsonConfigIOProps<TLocale extends string = SupportedLocale, TMeta extends Record<string, unknown> = Record<string, unknown>> extends DictionaryProps<TLocale> {
34
+ readonly config: AdminRallyConfig<TLocale, TMeta>;
35
+ readonly onImport: (config: AdminRallyConfig<TLocale, TMeta>) => void;
78
36
  }
79
- declare function RallyEditor<TLocale extends string = SupportedLocale>({ config, locale, onChange, }: RallyEditorProps<TLocale>): react.JSX.Element;
37
+ declare function JsonConfigIO<TLocale extends string = SupportedLocale, TMeta extends Record<string, unknown> = Record<string, unknown>>({ config, onImport, locale, dictionary }: JsonConfigIOProps<TLocale, TMeta>): ReactElement;
80
38
 
81
- export { AdminRallyEditor, type AdminRallyEditorProps, ConditionEditor, type ConditionEditorProps, GeneralSettingsForm, type GeneralSettingsFormProps, JsonConfigIO, type JsonConfigIOProps, QrExportModal, type QrExportModalProps, RallyEditor, type RallyEditorProps, RewardListEditor, type RewardListEditorProps, SpotItemForm, type SpotItemFormProps, SpotListEditor, type SpotListEditorProps, ThemeEditor, type ThemeEditorProps, ThemePresetSelector, type ThemePresetSelectorProps };
39
+ export { AdminRallyEditor, type AdminRallyEditorProps, ConditionEditor, type ConditionEditorProps, GeneralSettingsForm, type GeneralSettingsFormProps, JsonConfigIO, type JsonConfigIOProps, RallyEditor, SpotItemForm, type SpotItemFormProps };