@imerss/inat-components 1.0.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 +0 -0
- package/declaration.d.ts +2 -0
- package/dist/index.d.ts +214 -0
- package/dist/index.js +876 -0
- package/package.json +53 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +20 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/rollup.config.js +36 -0
- package/src/__shared/api/common-taxa.ts +56 -0
- package/src/__shared/api/favourites.ts +61 -0
- package/src/__shared/api/index.ts +4 -0
- package/src/__shared/api/recent-observations.ts +43 -0
- package/src/__shared/api/summary.ts +84 -0
- package/src/__shared/constants.ts +4 -0
- package/src/__shared/index.ts +4 -0
- package/src/__shared/typings.ts +69 -0
- package/src/__shared/utils/configUtils.ts +21 -0
- package/src/__shared/utils/dateUtils.ts +14 -0
- package/src/__shared/utils/index.ts +3 -0
- package/src/__shared/utils/numberUtils.ts +1 -0
- package/src/components/common-taxa/__tests__/common-taxa.test.tsx +14 -0
- package/src/components/common-taxa/common-taxa.tsx +99 -0
- package/src/components/error/__tests__/error.test.tsx +9 -0
- package/src/components/error/error.module.scss +7 -0
- package/src/components/error/error.tsx +15 -0
- package/src/components/favourites/__tests__/favourites.test.tsx +13 -0
- package/src/components/favourites/favourites.tsx +98 -0
- package/src/components/hooks/hooks.tsx +24 -0
- package/src/components/loader/__tests__/loader.test.tsx +10 -0
- package/src/components/loader/loader.tsx +26 -0
- package/src/components/no-results/__tests__/no-results.test.tsx +9 -0
- package/src/components/no-results/no-results.tsx +9 -0
- package/src/components/observation/__tests__/observation.test.tsx +14 -0
- package/src/components/observation/observation.module.scss +20 -0
- package/src/components/observation/observation.tsx +29 -0
- package/src/components/recent-observations/__tests__/recent-observations.test.tsx +9 -0
- package/src/components/recent-observations/recent-observations.tsx +101 -0
- package/src/components/seasonality-graph/__tests__/seasonality-graph.test.tsx +9 -0
- package/src/components/seasonality-graph/seasonality-graph.module.scss +7 -0
- package/src/components/seasonality-graph/seasonality-graph.tsx +46 -0
- package/src/components/shared/css/general.module.scss +69 -0
- package/src/components/summary/ObserverList.tsx +18 -0
- package/src/components/summary/__tests__/summary.test.tsx +18 -0
- package/src/components/summary/summary.module.scss +88 -0
- package/src/components/summary/summary.tsx +83 -0
- package/src/components/tabs/__tests__/tabs.test.tsx +16 -0
- package/src/components/tabs/tabs.module.scss +28 -0
- package/src/components/tabs/tabs.tsx +44 -0
- package/src/components/taxon-panel/__tests__/taxon-panel.test.tsx +10 -0
- package/src/components/taxon-panel/taxon-panel.module.scss +7 -0
- package/src/components/taxon-panel/taxon-panel.tsx +104 -0
- package/src/components/year-dropdown/__tests__/year-dropdown.test.tsx +14 -0
- package/src/components/year-dropdown/year-dropdown.module.scss +3 -0
- package/src/components/year-dropdown/year-dropdown.tsx +33 -0
- package/src/index.ts +15 -0
- package/tsconfig.json +6 -0
package/README.md
ADDED
|
File without changes
|
package/declaration.d.ts
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
declare const TaxonPanel: ({ taxonId, placeId, dataSource, config, baseURL }: any) => JSX.Element;
|
|
2
|
+
|
|
3
|
+
declare type ObservationProps = {
|
|
4
|
+
imageUrl: string;
|
|
5
|
+
linkUrl: string;
|
|
6
|
+
children: any;
|
|
7
|
+
};
|
|
8
|
+
declare const Observation: ({ imageUrl, linkUrl, children }: ObservationProps) => JSX.Element;
|
|
9
|
+
|
|
10
|
+
declare type CommonTaxaCallProps = {
|
|
11
|
+
year: string | number;
|
|
12
|
+
taxonId: string | number;
|
|
13
|
+
placeId: string | number;
|
|
14
|
+
perPage: number;
|
|
15
|
+
};
|
|
16
|
+
declare type CommonTaxData = {
|
|
17
|
+
id: number;
|
|
18
|
+
imageUrl: string;
|
|
19
|
+
taxonName: string;
|
|
20
|
+
taxonCommonName: string;
|
|
21
|
+
obsCount: number;
|
|
22
|
+
};
|
|
23
|
+
declare type CommonTaxaRespData = {
|
|
24
|
+
totalResults: number;
|
|
25
|
+
results: [CommonTaxData];
|
|
26
|
+
};
|
|
27
|
+
declare const getCommonTaxa: ({ year, taxonId, placeId, perPage }: CommonTaxaCallProps) => Promise<CommonTaxaRespData>;
|
|
28
|
+
|
|
29
|
+
declare type FavouritesCallProps = {
|
|
30
|
+
year: string | number;
|
|
31
|
+
taxonId: string | number;
|
|
32
|
+
placeId: string | number;
|
|
33
|
+
perPage: number;
|
|
34
|
+
};
|
|
35
|
+
declare type FavouritesData = {
|
|
36
|
+
id: number;
|
|
37
|
+
imageUrl: string;
|
|
38
|
+
taxonName: string;
|
|
39
|
+
taxonCommonName: string;
|
|
40
|
+
obsDate: string;
|
|
41
|
+
obsCount: number;
|
|
42
|
+
observerUsername: string;
|
|
43
|
+
numFaves: number;
|
|
44
|
+
};
|
|
45
|
+
declare type FavouritesRespData = {
|
|
46
|
+
totalResults: number;
|
|
47
|
+
results: [FavouritesData];
|
|
48
|
+
};
|
|
49
|
+
declare const getFavourites: ({ year, taxonId, placeId, perPage }: FavouritesCallProps) => Promise<FavouritesRespData>;
|
|
50
|
+
|
|
51
|
+
declare type RecentObservationsCallProps = {
|
|
52
|
+
taxonId: string | number;
|
|
53
|
+
placeId: string | number;
|
|
54
|
+
perPage: number;
|
|
55
|
+
};
|
|
56
|
+
declare type RecentObservationData = {
|
|
57
|
+
id: number;
|
|
58
|
+
imageUrl: string;
|
|
59
|
+
obsUrl: string;
|
|
60
|
+
obsDate: string;
|
|
61
|
+
taxonName: string;
|
|
62
|
+
taxonCommonName: string;
|
|
63
|
+
observerUsername: string;
|
|
64
|
+
};
|
|
65
|
+
declare type RecentObservationsRespData = {
|
|
66
|
+
totalResults: number;
|
|
67
|
+
results: [RecentObservationData];
|
|
68
|
+
};
|
|
69
|
+
declare const getRecentObservations: ({ taxonId, placeId, perPage }: RecentObservationsCallProps) => Promise<RecentObservationsRespData>;
|
|
70
|
+
|
|
71
|
+
declare type SummaryApiProps = {
|
|
72
|
+
taxonId: number;
|
|
73
|
+
placeId: number;
|
|
74
|
+
year: string | number;
|
|
75
|
+
};
|
|
76
|
+
declare const getSummary: ({ taxonId, placeId, year }: SummaryApiProps) => Promise<any>;
|
|
77
|
+
declare type Observer = {
|
|
78
|
+
id: number;
|
|
79
|
+
userName: string;
|
|
80
|
+
numObservations: number;
|
|
81
|
+
iconUrl: string | null;
|
|
82
|
+
};
|
|
83
|
+
declare type SummaryData = {
|
|
84
|
+
totalCount: number;
|
|
85
|
+
top: [Observer];
|
|
86
|
+
};
|
|
87
|
+
declare const getObserverSummary: (taxonId: number, placeId: number, year: string | number) => Promise<SummaryData>;
|
|
88
|
+
declare const getObservationSummary: (taxonId: number, placeId: number, year: string | number) => Promise<{
|
|
89
|
+
totalCount: any;
|
|
90
|
+
}>;
|
|
91
|
+
declare type SeasonalityData = {
|
|
92
|
+
monthOfYear: {
|
|
93
|
+
[monthNum: string]: number;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
declare const getSeasonalityData: (taxonId: number, placeId: number, year: string | number) => Promise<SeasonalityData>;
|
|
97
|
+
|
|
98
|
+
declare type ConfigFile = {
|
|
99
|
+
taxa: TaxaConfig[];
|
|
100
|
+
places: PlaceConfig[];
|
|
101
|
+
features: {
|
|
102
|
+
[Feature.commonTaxa]?: {
|
|
103
|
+
numResults?: number;
|
|
104
|
+
};
|
|
105
|
+
[Feature.favourites]?: {
|
|
106
|
+
numResults?: number;
|
|
107
|
+
numYears?: number;
|
|
108
|
+
};
|
|
109
|
+
[Feature.recentObservations]?: {
|
|
110
|
+
numResults?: number;
|
|
111
|
+
numYears?: number;
|
|
112
|
+
};
|
|
113
|
+
[Feature.stats]?: {
|
|
114
|
+
numTopObservers?: number;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
declare enum DataSource {
|
|
119
|
+
autoLoad = "autoLoad",
|
|
120
|
+
dataProp = "dataProp",
|
|
121
|
+
url = "url"
|
|
122
|
+
}
|
|
123
|
+
declare enum Feature {
|
|
124
|
+
commonTaxa = "commonTaxa",
|
|
125
|
+
favourites = "favourites",
|
|
126
|
+
recentObservations = "recentObservations",
|
|
127
|
+
stats = "stats"
|
|
128
|
+
}
|
|
129
|
+
declare enum Tab {
|
|
130
|
+
recent = "recent",
|
|
131
|
+
commonTaxa = "commonTaxa",
|
|
132
|
+
favourites = "favourites",
|
|
133
|
+
stats = "stats"
|
|
134
|
+
}
|
|
135
|
+
declare type BaseComponentProps = {
|
|
136
|
+
taxonId?: number;
|
|
137
|
+
placeId?: number;
|
|
138
|
+
filename?: string;
|
|
139
|
+
perPage?: number;
|
|
140
|
+
source?: DataSource;
|
|
141
|
+
data?: any;
|
|
142
|
+
dataUrl?: string;
|
|
143
|
+
className?: string;
|
|
144
|
+
components?: {
|
|
145
|
+
label?: any;
|
|
146
|
+
error?: any;
|
|
147
|
+
loader?: any;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
declare type TaxaConfig = {
|
|
151
|
+
label: string;
|
|
152
|
+
short: string;
|
|
153
|
+
taxonId: number;
|
|
154
|
+
};
|
|
155
|
+
declare type PlaceConfig = {
|
|
156
|
+
label: string;
|
|
157
|
+
short: string;
|
|
158
|
+
placeId: number;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
declare const getSourceFile: (api: Feature, taxonInfo: TaxaConfig, placeInfo: PlaceConfig, year?: string | number) => string;
|
|
162
|
+
|
|
163
|
+
declare const getCurrentYear: () => number;
|
|
164
|
+
declare const formatDate: (date: string, dateFormat?: string) => any;
|
|
165
|
+
|
|
166
|
+
declare const numberWithCommas: (x: number) => string;
|
|
167
|
+
|
|
168
|
+
declare const BASE_API_URL = "https://api.inaturalist.org";
|
|
169
|
+
declare const PER_PAGE = 100;
|
|
170
|
+
declare const BASE_URL = "https://www.inaturalist.org";
|
|
171
|
+
declare const ERROR_LOG_FILENAME = "inat-components-error.log";
|
|
172
|
+
|
|
173
|
+
declare const constants_BASE_API_URL: typeof BASE_API_URL;
|
|
174
|
+
declare const constants_PER_PAGE: typeof PER_PAGE;
|
|
175
|
+
declare const constants_BASE_URL: typeof BASE_URL;
|
|
176
|
+
declare const constants_ERROR_LOG_FILENAME: typeof ERROR_LOG_FILENAME;
|
|
177
|
+
declare namespace constants {
|
|
178
|
+
export {
|
|
179
|
+
constants_BASE_API_URL as BASE_API_URL,
|
|
180
|
+
constants_PER_PAGE as PER_PAGE,
|
|
181
|
+
constants_BASE_URL as BASE_URL,
|
|
182
|
+
constants_ERROR_LOG_FILENAME as ERROR_LOG_FILENAME,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
declare type CommonTaxaProps = BaseComponentProps & {
|
|
187
|
+
year: string | number;
|
|
188
|
+
};
|
|
189
|
+
declare const CommonTaxaLabel: (data: CommonTaxData) => JSX.Element;
|
|
190
|
+
declare const CommonTaxa: ({ year, source, taxonId, placeId, perPage, data, dataUrl, components, className }: CommonTaxaProps) => JSX.Element;
|
|
191
|
+
|
|
192
|
+
declare type RecentObservationsProps = BaseComponentProps;
|
|
193
|
+
declare const RecentObservationLabel: (obs: RecentObservationData) => JSX.Element;
|
|
194
|
+
declare const RecentObservations: ({ taxonId, placeId, data, dataUrl, source, perPage, components, className }: RecentObservationsProps) => JSX.Element;
|
|
195
|
+
|
|
196
|
+
declare type FavouritesProps = BaseComponentProps & {
|
|
197
|
+
year: string | number;
|
|
198
|
+
};
|
|
199
|
+
declare const FavouritesLabel: (data: FavouritesData) => JSX.Element;
|
|
200
|
+
declare const Favourites: ({ year, source, taxonId, placeId, data, dataUrl, components, className, perPage }: FavouritesProps) => JSX.Element;
|
|
201
|
+
|
|
202
|
+
declare const SeasonalityGraph: ({ data }: any) => JSX.Element;
|
|
203
|
+
|
|
204
|
+
declare type SummaryProps = {
|
|
205
|
+
source: DataSource;
|
|
206
|
+
taxonId: number;
|
|
207
|
+
placeId: number;
|
|
208
|
+
year: string | number;
|
|
209
|
+
data?: FavouritesRespData;
|
|
210
|
+
dataUrl?: string;
|
|
211
|
+
};
|
|
212
|
+
declare const Summary: ({ source, data, dataUrl, taxonId, placeId, year }: SummaryProps) => JSX.Element;
|
|
213
|
+
|
|
214
|
+
export { BaseComponentProps, constants as C, CommonTaxData, CommonTaxa, CommonTaxaCallProps, CommonTaxaLabel, CommonTaxaProps, CommonTaxaRespData, ConfigFile, DataSource, Favourites, FavouritesCallProps, FavouritesData, FavouritesLabel, FavouritesProps, FavouritesRespData, Feature, Observation, ObservationProps, Observer, PlaceConfig, RecentObservationData, RecentObservationLabel, RecentObservations, RecentObservationsCallProps, RecentObservationsProps, RecentObservationsRespData, SeasonalityData, SeasonalityGraph, Summary, SummaryApiProps, SummaryData, SummaryProps, Tab, TaxaConfig, TaxonPanel as default, formatDate, getCommonTaxa, getCurrentYear, getFavourites, getObservationSummary, getObserverSummary, getRecentObservations, getSeasonalityData, getSourceFile, getSummary, numberWithCommas };
|