@cryptofi/core-ui 0.20.0 → 0.22.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.
@@ -1,9 +1,10 @@
1
+ /// <reference types="react" />
1
2
  import * as _chakra_ui_system_dist_system_types from '@chakra-ui/system/dist/system.types';
2
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { SVGProps } from 'react';
4
+ import { SVGProps, Dispatch, SetStateAction } from 'react';
4
5
  import { CurveType } from 'recharts/types/shape/Curve';
5
- import { CardProps, CheckboxProps, InputProps, ChakraComponent, SelectProps, TagProps, UseToastOptions } from '@chakra-ui/react';
6
- import { UseFormRegister } from 'react-hook-form';
6
+ import { CardProps, CheckboxProps, InputProps, ChakraComponent, ModalProps, FlexProps, SelectProps, TagProps, UseToastOptions } from '@chakra-ui/react';
7
+ import { FieldValues, UseFormRegister } from 'react-hook-form';
7
8
 
8
9
  declare const SvgIconAlert: _chakra_ui_system_dist_system_types.ChakraComponent<(props: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element, {}>;
9
10
  //# sourceMappingURL=IconAlert.d.ts.map
@@ -158,6 +159,27 @@ declare const SvgIconUpload: _chakra_ui_system_dist_system_types.ChakraComponent
158
159
  declare const SvgIconUser: _chakra_ui_system_dist_system_types.ChakraComponent<(props: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element, {}>;
159
160
  //# sourceMappingURL=IconUser.d.ts.map
160
161
 
162
+ declare const SvgIconAvax: _chakra_ui_system_dist_system_types.ChakraComponent<(props: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element, {}>;
163
+ //# sourceMappingURL=IconAvax.d.ts.map
164
+
165
+ declare const SvgIconBch: _chakra_ui_system_dist_system_types.ChakraComponent<(props: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element, {}>;
166
+ //# sourceMappingURL=IconBch.d.ts.map
167
+
168
+ declare const SvgIconBtc: _chakra_ui_system_dist_system_types.ChakraComponent<(props: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element, {}>;
169
+ //# sourceMappingURL=IconBtc.d.ts.map
170
+
171
+ declare const SvgIconEth: _chakra_ui_system_dist_system_types.ChakraComponent<(props: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element, {}>;
172
+ //# sourceMappingURL=IconEth.d.ts.map
173
+
174
+ declare const SvgIconLink: _chakra_ui_system_dist_system_types.ChakraComponent<(props: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element, {}>;
175
+ //# sourceMappingURL=IconLink.d.ts.map
176
+
177
+ declare const SvgIconLtc: _chakra_ui_system_dist_system_types.ChakraComponent<(props: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element, {}>;
178
+ //# sourceMappingURL=IconLtc.d.ts.map
179
+
180
+ declare const SvgIconXlm: _chakra_ui_system_dist_system_types.ChakraComponent<(props: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element, {}>;
181
+ //# sourceMappingURL=IconXlm.d.ts.map
182
+
161
183
  /**
162
184
  * This is a partial Chakra theme and should be extended by the consuming application using
163
185
  * Chakra's extendTheme method.
@@ -172,36 +194,40 @@ declare const exportedTheme: {
172
194
  };
173
195
  //# sourceMappingURL=exportedTheme.d.ts.map
174
196
 
197
+ declare const aggregateAmounts: (amounts: number[]) => number;
198
+ //# sourceMappingURL=aggregateAmounts.d.ts.map
199
+
175
200
  declare const convertToUTCEpochTime: ({ timeString, toEndDate }: {
176
201
  timeString: string;
177
202
  toEndDate?: boolean | undefined;
178
203
  }) => string;
179
204
  //# sourceMappingURL=convertToUTCEpochTime.d.ts.map
180
205
 
181
- type SignDisplay$1 = 'auto' | 'always' | 'exceptZero' | 'never';
206
+ type SignDisplay = 'auto' | 'always' | 'exceptZero' | 'never';
182
207
  /**
183
208
  *
184
- * @param amount - A finite number
209
+ * @param amount - Number or string to format
185
210
  * @param signDisplay - Setting for minus / plus sign, defaults to exceptZero
186
211
  * @param isDecimal - Is the number a percentage in its decimal form? defaults to true
187
212
  */
188
213
  declare const formatPercentage: ({ number, signDisplay, isDecimal, }: {
189
- number: number;
190
- signDisplay?: SignDisplay$1 | undefined;
214
+ number: number | string;
215
+ signDisplay?: SignDisplay | undefined;
191
216
  isDecimal?: boolean | undefined;
192
- }) => string;
217
+ }) => string | number;
193
218
  //# sourceMappingURL=formatPercentage.d.ts.map
194
219
 
195
- type SignDisplay = 'auto' | 'always' | 'exceptZero' | 'never';
196
220
  /**
197
221
  *
198
- * @param amount - A finite number
199
- * @param signDisplay - Setting for minus / plus sign, defaults to auto
222
+ * @param amount - Number or string to format
223
+ * @param precision - The number of decimals to display
224
+ * @signDisplay - Whether to display a plus sign for positive amounts
200
225
  */
201
- declare const formatUSD: ({ amount, signDisplay }: {
202
- amount: number;
203
- signDisplay?: SignDisplay | undefined;
204
- }) => string;
226
+ declare const formatUSD: ({ amount, precision, signDisplay, }: {
227
+ amount: number | string;
228
+ precision?: number | undefined;
229
+ signDisplay?: boolean | undefined;
230
+ }) => string | number;
205
231
  //# sourceMappingURL=formatUSD.d.ts.map
206
232
 
207
233
  /**
@@ -214,20 +240,14 @@ declare const getDelta: ({ data, dataKey }: {
214
240
  data: any[] | undefined;
215
241
  dataKey: string;
216
242
  }) => {
217
- startingAmount: any;
218
- endingAmount: any;
243
+ startingAmount: number;
244
+ endingAmount: number;
219
245
  delta: number;
220
246
  percentChange: number;
221
247
  isNetGain: boolean;
222
248
  };
223
249
  //# sourceMappingURL=getDelta.d.ts.map
224
250
 
225
- declare const getFormDataQuery: (obj: unknown) => string | undefined;
226
- //# sourceMappingURL=getFormDataQuery.d.ts.map
227
-
228
- declare const isFormDataEmpty: (obj: unknown) => boolean;
229
- //# sourceMappingURL=isFormDataEmpty.d.ts.map
230
-
231
251
  declare const uiColors: {
232
252
  redRemains(alpha?: number): string;
233
253
  heroicRed(alpha?: number): string;
@@ -241,15 +261,21 @@ declare const uiColors: {
241
261
  };
242
262
  //# sourceMappingURL=uiColors.d.ts.map
243
263
 
244
- declare const CfAreaChart: ({ data, dataKey, width, height, areaType, }: {
264
+ declare const CfAreaChart: ({ data, dataKey, width, height, areaType, showTooltip, isAnimated, formatter, }: {
245
265
  data: any[] | undefined;
246
266
  dataKey: string;
247
267
  width?: string | undefined;
248
268
  height?: string | undefined;
249
269
  areaType?: CurveType | undefined;
270
+ showTooltip?: boolean | undefined;
271
+ isAnimated?: boolean | undefined;
272
+ formatter?: ((value: number) => string) | undefined;
250
273
  }) => react_jsx_runtime.JSX.Element;
251
274
  //# sourceMappingURL=AreaChart.d.ts.map
252
275
 
276
+ declare const CfBreakpointDebugger: () => react_jsx_runtime.JSX.Element;
277
+ //# sourceMappingURL=BreakpointDebugger.d.ts.map
278
+
253
279
  declare const CfCard: ({ children, ...rest }: CardProps) => react_jsx_runtime.JSX.Element;
254
280
  //# sourceMappingURL=Card.d.ts.map
255
281
 
@@ -259,40 +285,68 @@ interface CfCheckboxProps extends CheckboxProps {
259
285
  label?: string;
260
286
  labelPosition?: 'left' | 'right';
261
287
  spaceBetween?: boolean;
288
+ name: string;
262
289
  }
263
290
  declare const CfCheckbox: (props: CfCheckboxProps) => react_jsx_runtime.JSX.Element;
264
291
 
265
- interface CfInputProps extends InputProps {
292
+ interface CfInputProps<T extends FieldValues> extends InputProps {
293
+ register?: UseFormRegister<T>;
266
294
  errorMessage?: string;
267
295
  helperText?: string;
268
296
  label?: string;
269
- spellCheck?: boolean;
270
297
  IconLeft?: ChakraComponent<'svg', object>;
271
298
  IconRight?: ChakraComponent<'svg', object>;
272
299
  name: string;
273
- register: UseFormRegister<any>;
274
- rules?: object;
275
300
  }
276
- declare const CfInput: (props: CfInputProps) => react_jsx_runtime.JSX.Element;
301
+ declare const CfInput: <T extends FieldValues>(props: CfInputProps<T>) => react_jsx_runtime.JSX.Element;
277
302
 
278
- declare const CfLineChart: ({ data, dataKey, width, height, lineType, }: {
303
+ declare const CfLineChart: ({ data, dataKey, width, height, lineType, showTooltip, isAnimated, formatter, }: {
279
304
  data: any[] | undefined;
280
305
  dataKey: string;
281
306
  width?: string | undefined;
282
307
  height?: string | undefined;
283
308
  lineType?: CurveType | undefined;
309
+ showTooltip?: boolean | undefined;
310
+ isAnimated?: boolean | undefined;
311
+ formatter?: ((value: number) => string) | undefined;
284
312
  }) => react_jsx_runtime.JSX.Element;
285
313
  //# sourceMappingURL=LineChart.d.ts.map
286
314
 
287
- interface CfSelectProps extends SelectProps {
288
- register: UseFormRegister<any>;
289
- name: string;
290
- rules?: object;
315
+ interface Props extends ModalProps {
316
+ headerContent: React.ReactNode;
317
+ footerContent: React.ReactNode;
318
+ }
319
+ declare const CfModal: ({ isOpen, onClose, headerContent, footerContent, closeOnOverlayClick, children, ...rest }: Props) => react_jsx_runtime.JSX.Element;
320
+ //# sourceMappingURL=Modal.d.ts.map
321
+
322
+ interface LastEvaluatedKeyParams {
323
+ lastEvaluatedPKey?: string;
324
+ lastEvaluatedSKey?: string;
325
+ }
326
+ interface LastEvaluatedKey {
327
+ pKey: string;
328
+ sKey: string;
329
+ }
330
+ interface CfPaginationProps extends FlexProps {
331
+ setLastEvaluatedKeyParams: Dispatch<SetStateAction<LastEvaluatedKeyParams | undefined>>;
332
+ isLoading?: boolean;
333
+ hasMore?: boolean;
334
+ lastEvaluatedKey?: LastEvaluatedKey;
335
+ }
336
+ declare const CfPagination: ({ isLoading, hasMore, setLastEvaluatedKeyParams, lastEvaluatedKey, ...rest }: CfPaginationProps) => react_jsx_runtime.JSX.Element;
337
+
338
+ interface CfSelectProps<T extends FieldValues> extends SelectProps {
339
+ register?: UseFormRegister<T>;
291
340
  errorMessage?: string;
292
341
  helperText?: string;
293
342
  label?: string;
343
+ name: string;
344
+ }
345
+ interface CfSelectOption {
346
+ name: string;
347
+ value?: string;
294
348
  }
295
- declare const CfSelect: (props: CfSelectProps) => react_jsx_runtime.JSX.Element;
349
+ declare const CfSelect: <T extends FieldValues>(props: CfSelectProps<T>) => react_jsx_runtime.JSX.Element;
296
350
 
297
351
  interface CfTagProps extends TagProps {
298
352
  label: string;
@@ -307,4 +361,4 @@ interface CfToastProps extends UseToastOptions {
307
361
  }
308
362
  declare const CfToast: (props: CfToastProps) => react_jsx_runtime.JSX.Element;
309
363
 
310
- export { CfAreaChart, CfCard, CfCheckbox, type CfCheckboxProps, CfInput, type CfInputProps, CfLineChart, CfSelect, type CfSelectProps, CfTag, type CfTagProps, CfToast, SvgIconAlert as IconAlert, SvgIconArrowDown as IconArrowDown, SvgIconArrowUp as IconArrowUp, SvgIconBank as IconBank, SvgIconBarChart as IconBarChart, SvgIconCalendar as IconCalendar, SvgIconCaretDown as IconCaretDown, SvgIconCaretLeft as IconCaretLeft, SvgIconCaretRight as IconCaretRight, SvgIconCaretUp as IconCaretUp, SvgIconCent as IconCent, SvgIconCheck as IconCheck, SvgIconChecking as IconChecking, SvgIconClose as IconClose, SvgIconConnect as IconConnect, SvgIconCopy as IconCopy, SvgIconDollar as IconDollar, SvgIconDownload as IconDownload, SvgIconEdit as IconEdit, SvgIconEnter as IconEnter, SvgIconEnterInverted as IconEnterInverted, SvgIconExchange as IconExchange, SvgIconFilter as IconFilter, SvgIconHelp as IconHelp, SvgIconHistory as IconHistory, SvgIconHome as IconHome, SvgIconIndicatorDown as IconIndicatorDown, SvgIconIndicatorUp as IconIndicatorUp, SvgIconInfo as IconInfo, SvgIconMail as IconMail, SvgIconMenu as IconMenu, SvgIconMore as IconMore, SvgIconNotification as IconNotification, SvgIconOverview as IconOverview, SvgIconPercent as IconPercent, SvgIconPieChart as IconPieChart, SvgIconPlus as IconPlus, SvgIconReports as IconReports, SvgIconReservesSuccess as IconReservesSuccess, SvgIconReservesWarning as IconReservesWarning, SvgIconSearch as IconSearch, SvgIconSettings as IconSettings, SvgIconSettlement as IconSettlement, SvgIconSignIn as IconSignIn, SvgIconSignOut as IconSignOut, SvgIconSort as IconSort, SvgIconSpinner as IconSpinner, SvgIconSupport as IconSupport, SvgIconTrash as IconTrash, SvgIconUpload as IconUpload, SvgIconUser as IconUser, convertToUTCEpochTime, exportedTheme as coreTheme, formatPercentage, formatUSD, getDelta, getFormDataQuery, isFormDataEmpty, uiColors };
364
+ export { CfAreaChart, CfBreakpointDebugger, CfCard, CfCheckbox, type CfCheckboxProps, CfInput, type CfInputProps, CfLineChart, CfModal, CfPagination, CfSelect, type CfSelectOption, type CfSelectProps, CfTag, type CfTagProps, CfToast, SvgIconAlert as IconAlert, SvgIconArrowDown as IconArrowDown, SvgIconArrowUp as IconArrowUp, SvgIconAvax as IconAvax, SvgIconBank as IconBank, SvgIconBarChart as IconBarChart, SvgIconBch as IconBch, SvgIconBtc as IconBtc, SvgIconCalendar as IconCalendar, SvgIconCaretDown as IconCaretDown, SvgIconCaretLeft as IconCaretLeft, SvgIconCaretRight as IconCaretRight, SvgIconCaretUp as IconCaretUp, SvgIconCent as IconCent, SvgIconCheck as IconCheck, SvgIconChecking as IconChecking, SvgIconClose as IconClose, SvgIconConnect as IconConnect, SvgIconCopy as IconCopy, SvgIconDollar as IconDollar, SvgIconDownload as IconDownload, SvgIconEdit as IconEdit, SvgIconEnter as IconEnter, SvgIconEnterInverted as IconEnterInverted, SvgIconEth as IconEth, SvgIconExchange as IconExchange, SvgIconFilter as IconFilter, SvgIconHelp as IconHelp, SvgIconHistory as IconHistory, SvgIconHome as IconHome, SvgIconIndicatorDown as IconIndicatorDown, SvgIconIndicatorUp as IconIndicatorUp, SvgIconInfo as IconInfo, SvgIconLink as IconLink, SvgIconLtc as IconLtc, SvgIconMail as IconMail, SvgIconMenu as IconMenu, SvgIconMore as IconMore, SvgIconNotification as IconNotification, SvgIconOverview as IconOverview, SvgIconPercent as IconPercent, SvgIconPieChart as IconPieChart, SvgIconPlus as IconPlus, SvgIconReports as IconReports, SvgIconReservesSuccess as IconReservesSuccess, SvgIconReservesWarning as IconReservesWarning, SvgIconSearch as IconSearch, SvgIconSettings as IconSettings, SvgIconSettlement as IconSettlement, SvgIconSignIn as IconSignIn, SvgIconSignOut as IconSignOut, SvgIconSort as IconSort, SvgIconSpinner as IconSpinner, SvgIconSupport as IconSupport, SvgIconTrash as IconTrash, SvgIconUpload as IconUpload, SvgIconUser as IconUser, SvgIconXlm as IconXlm, aggregateAmounts, convertToUTCEpochTime, exportedTheme as coreTheme, formatPercentage, formatUSD, getDelta, uiColors };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cryptofi/core-ui",
3
- "version": "0.20.0",
3
+ "version": "0.22.0",
4
4
  "author": {
5
5
  "name": "CryptoFi"
6
6
  },
@@ -10,23 +10,25 @@
10
10
  "license": "MIT",
11
11
  "type": "module",
12
12
  "scripts": {
13
- "dev": "yarn storybook",
14
13
  "build": "rm -rf ./dist && rollup -c",
14
+ "build-storybook": "storybook build",
15
+ "chromatic": "dotenv cross-var npx chromatic --project-token=%CHROMATIC_PROJECT_TOKEN%",
16
+ "dev": "yarn storybook",
17
+ "format": "prettier --config ./.prettierrc -w '**/*.{tsx,ts,js,cjs,json,yml}' && git update-index --again",
18
+ "icons:gen": "yarn icons:clean && yarn icons:prefix && npx @svgr/cli --out-dir ./src/icons -- ./svg-icons",
19
+ "icons:clean": "npx rimraf '**/Icon*.tsx' ./src/icons/index.ts",
20
+ "icons:prefix": "node scripts/prefixIcons.cjs",
15
21
  "lint": "eslint src --ext .tsx --ext .ts",
16
22
  "lint:fix": "yarn lint --fix",
17
- "format": "prettier --config ./.prettierrc -w '**/*.{tsx,ts,js,cjs,json,yml}' && git update-index --again",
18
- "pretest": "yarn lint:fix",
19
- "test": "jest --colors --passWithNoTests",
20
23
  "posttest": "npx http-server coverage/lcov-report",
21
- "test:watch": "yarn test --collectCoverage=false --watch",
22
- "storybook": "storybook dev -p 6006",
23
- "build:storybook": "storybook build",
24
+ "pretest": "yarn lint:fix",
24
25
  "publish:local": "yarn build && npx yalc publish --push",
25
- "publish:npm": "npm publish --access public && yarn publish:notifier",
26
- "icons:gen": "yarn icons:clean && yarn icons:prefix && npx @svgr/cli --out-dir ./src/icons -- ./svg-icons",
27
- "icons:clean": "rm -rf src/icons",
28
- "icons:prefix": "node scripts/prefixIcons.cjs",
29
- "publish:notifier": "dotenv cross-var node scripts/npmPublishNotifier.cjs %SLACK_WEBHOOK_URL%"
26
+ "publish:notifier": "dotenv cross-var node scripts/npmPublishNotifier.cjs %SLACK_WEBHOOK_URL%",
27
+ "publish:npm": "yarn build && npm publish --access public && yarn publish:notifier && yarn publish:storybook",
28
+ "publish:storybook": "yarn chromatic",
29
+ "storybook": "storybook dev -p 6006",
30
+ "test": "jest --colors --passWithNoTests",
31
+ "test:watch": "yarn test --collectCoverage=false --watch"
30
32
  },
31
33
  "module": "dist/index.js",
32
34
  "types": "dist/types/index.d.ts",