@zealicsolutions/web-ui 0.0.4 → 0.0.5

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 +1,8 @@
1
1
  export * from './atoms';
2
+ export * from './molecules';
3
+ export * from './organisms';
4
+ export * from './templates';
5
+ export * from './pages';
6
+ export * from './hooks';
7
+ export * from './theme';
8
+ export * from './fieldsConfiguration';
package/dist/index.d.ts CHANGED
@@ -1,14 +1,20 @@
1
1
  /// <reference types="react" />
2
2
  import { Callback, StylesType } from 'typescript';
3
3
  import * as react from 'react';
4
- import { PropsWithChildren, ReactNode } from 'react';
4
+ import { PropsWithChildren, ReactNode, Dispatch, SetStateAction } from 'react';
5
5
  import * as styled_components from 'styled-components';
6
- import { CSSProperties } from 'styled-components';
6
+ import { DefaultTheme, CSSProperties } from 'styled-components';
7
7
  import { IconNames as IconNames$1 } from 'atoms/Icon/Icon';
8
- import { InputFieldTypes } from 'fieldsConfiguration/types';
8
+ import { InputFieldTypes as InputFieldTypes$1, FieldTypes as FieldTypes$1, UIFields as UIFields$1 } from 'fieldsConfiguration/types';
9
9
  import { SizesTypes as SizesTypes$1, ThemeColors as ThemeColors$1 } from 'theme/types';
10
10
  import { SizesTypes as SizesTypes$2, ThemeColors as ThemeColors$2 } from 'theme';
11
11
  import { TooltipProps as TooltipProps$1 } from 'rc-tooltip/lib/Tooltip';
12
+ import { Control } from 'react-hook-form/dist/types';
13
+ import { SelectOption as SelectOption$1 } from 'atoms/Select/types';
14
+ import { DrawerProps as DrawerProps$1 } from '@mui/material';
15
+ import { SetPasswordFields, SetPasswordRuleValidation } from 'organisms/SetPasswordForm/types';
16
+ import { DeepPartial, FieldValues, FormState } from 'react-hook-form';
17
+ import { LoginFields as LoginFields$1 } from 'organisms/LoginForm/types';
12
18
 
13
19
  declare type BaseButtonProps = {
14
20
  onClick?: Callback;
@@ -70,7 +76,7 @@ declare type InputProps = {
70
76
  leftIcon?: InputIconProps;
71
77
  rightIcon?: InputIconProps;
72
78
  onBlur?: Callback;
73
- type?: InputFieldTypes;
79
+ type?: InputFieldTypes$1;
74
80
  placeholder?: string;
75
81
  disabled?: boolean;
76
82
  isEditMode?: boolean;
@@ -91,8 +97,21 @@ declare type TextWrapperProps = {
91
97
  };
92
98
  declare const TextWrapper: styled_components.StyledComponent<"div", styled_components.DefaultTheme, TextWrapperProps, never>;
93
99
 
100
+ declare const defaultTheme: DefaultTheme;
101
+
102
+ declare const ZealThemeProvider: (props: PropsWithChildren<{}>) => JSX.Element;
103
+
94
104
  declare type ThemeColors = 'primary' | 'secondary' | 'background' | 'gray1' | 'gray2' | 'gray3' | 'gray4' | 'gray5' | 'indigo' | 'blue' | 'white' | 'black' | 'indigoTint' | 'indigoTint2' | 'success' | 'error' | 'warning';
95
105
  declare type SizesTypes = '2XL' | 'XL' | 'L' | 'M' | 'S' | 'XS';
106
+ declare type ThemeColorsType = Record<ThemeColors, string>;
107
+ declare type ThemeTextType = Record<SizesTypes, {
108
+ 'font-weight': string;
109
+ 'font-size': number;
110
+ 'line-height': number;
111
+ }>;
112
+ declare type ThemeSizesType = Record<SizesTypes, number>;
113
+
114
+ declare const toastStyles: styled_components.FlattenSimpleInterpolation;
96
115
 
97
116
  declare type IconProps = {
98
117
  name: IconNames;
@@ -210,4 +229,285 @@ declare type DividerProps = {
210
229
  };
211
230
  declare const Divider: styled_components.StyledComponent<"div", styled_components.DefaultTheme, DividerProps, never>;
212
231
 
213
- export { Avatar, AvatarProps, BaseButtonProps, Button, ButtonProps, CheckBoxProps, Checkbox, Divider, DividerProps, HorizontalPadding, HorizontalPaddingProps, Icon, IconNames, IconProps, Image, ImageProps, Input, InputIconProps, InputProps, LinkButton, LinkButtonProps, Select, Spacer, SpacerProps, Spinner, StyleWrapper, TextTypes, TextWrapper, TextWrapperProps, Tooltip, TooltipProps, TouchableOpacity, TouchableOpacityProps, ValidationTag, ValidationTagProps, ValidationTagStatus, VerticalPadding, toast };
232
+ declare type FieldRuleLabelTypes = 'OPTIONAL' | 'REQUIRED';
233
+ declare type FieldLabelsProps = {
234
+ label: string;
235
+ tooltipText?: string;
236
+ isError?: boolean;
237
+ ruleLabel?: FieldRuleLabelTypes;
238
+ };
239
+ declare const FieldLabels: ({ label, isError, ruleLabel, tooltipText }: FieldLabelsProps) => JSX.Element;
240
+
241
+ declare type InputFieldProps = {
242
+ name: string;
243
+ control?: Control<any>;
244
+ required?: boolean;
245
+ optional?: boolean;
246
+ defaultValue?: string;
247
+ inputProps: InputProps;
248
+ styles?: CSSProperties;
249
+ labelsProps?: FieldLabelsProps;
250
+ };
251
+ declare const InputField: ({ control, name, inputProps, styles, labelsProps, defaultValue, optional, required, }: InputFieldProps) => JSX.Element;
252
+
253
+ declare const getFieldPlaceholder: (type: FieldTypes$1, title?: string) => string;
254
+
255
+ declare type InputFieldTypes = 'number' | 'text' | 'email' | 'password';
256
+ declare type FieldTypes = 'input' | 'select' | 'date-picker' | 'checkbox' | 'switch';
257
+ declare type UIField<T = string> = (UIInputField | UISelectField | UICheckboxField) & {
258
+ name: T;
259
+ value?: string;
260
+ label?: string;
261
+ placeholder?: string;
262
+ required?: boolean;
263
+ optional?: boolean;
264
+ tooltip?: string;
265
+ };
266
+ declare type UIInputField = {
267
+ type: 'input';
268
+ inputType?: InputFieldTypes;
269
+ maxLength?: number;
270
+ };
271
+ declare type UISelectField = {
272
+ type: 'select';
273
+ options: SelectOption$1[];
274
+ };
275
+ declare type UICheckboxField = {
276
+ type: 'checkbox';
277
+ checkboxLabel?: string;
278
+ };
279
+ declare type UIFields<T extends object> = UIField<keyof T>[];
280
+
281
+ declare const getInitialValuesFromFields: <T extends object>(fields: UIFields$1<T>) => DeepPartial<T>;
282
+ declare const isFormValid: <T extends FieldValues>(formState: FormState<T>) => boolean;
283
+
284
+ declare const acquisitionFormMockFields: UIFields$1<any>;
285
+ declare const setPasswordMockFields: UIFields$1<SetPasswordFields>;
286
+ declare const loginMockFields: UIFields$1<LoginFields$1>;
287
+
288
+ declare type FieldMapperProps<T extends object> = {
289
+ field: UIField<keyof T>;
290
+ control: Control<T>;
291
+ spacer?: number;
292
+ };
293
+ declare const FieldMapper: <T extends object>({ field, spacer, control, }: FieldMapperProps<T>) => JSX.Element;
294
+
295
+ declare type CheckboxFieldProps = {
296
+ name: string;
297
+ control: Control<any>;
298
+ defaultValue?: boolean;
299
+ checkboxProps: Omit<CheckBoxProps, 'error' | 'onClick' | 'value'>;
300
+ };
301
+ declare const CheckboxField: ({ control, name, checkboxProps, defaultValue, }: CheckboxFieldProps) => JSX.Element;
302
+
303
+ declare type SelectFieldProps = {
304
+ selectProps: SelectProps;
305
+ labelsProps?: FieldLabelsProps;
306
+ name: string;
307
+ control: Control<any>;
308
+ required?: boolean;
309
+ optional?: boolean;
310
+ defaultValue?: string;
311
+ styles?: CSSProperties;
312
+ };
313
+ declare const SelectField: ({ selectProps, name, defaultValue, optional, required, control, styles, labelsProps, }: SelectFieldProps) => JSX.Element;
314
+
315
+ declare type CustomValidationRule<T = string> = {
316
+ text: string;
317
+ validate: (value?: T) => boolean;
318
+ };
319
+ declare type CustomValidationProps<T = string> = {
320
+ label?: string;
321
+ value: T;
322
+ isSubmitted?: boolean;
323
+ rules: CustomValidationRule<T>[];
324
+ };
325
+ declare const CustomValidation: <T extends string = string>({ rules, value, isSubmitted, label, }: CustomValidationProps<T>) => JSX.Element;
326
+
327
+ declare type BaseSelectableProps<T> = {
328
+ iconName: IconNames;
329
+ infoText: string;
330
+ isActive?: boolean;
331
+ onClick?: (value: T) => void;
332
+ value: T;
333
+ };
334
+
335
+ declare type SelectableCardGroupProps<T> = {
336
+ cards: BaseSelectableProps<T>[];
337
+ handleChange?: (value: T | undefined) => void;
338
+ spacing?: SizesTypes;
339
+ initialValue?: T;
340
+ };
341
+ declare const SelectableCardGroup: <T extends string>({ cards, handleChange, spacing, initialValue, }: SelectableCardGroupProps<T>) => JSX.Element;
342
+
343
+ declare type BannerProps = {
344
+ backgroundImage: ImageProps;
345
+ title: string;
346
+ description?: string;
347
+ button?: ButtonProps;
348
+ };
349
+ declare const Banner: ({ backgroundImage, button, title, description }: BannerProps) => JSX.Element;
350
+
351
+ declare type Anchor = 'top' | 'left' | 'bottom' | 'right';
352
+ declare type DrawerProps = DrawerProps$1 & {
353
+ anchor: Anchor;
354
+ };
355
+
356
+ declare const Drawer: ({ children, ...props }: PropsWithChildren<DrawerProps>) => JSX.Element;
357
+
358
+ declare type InfoBoxProps = {
359
+ title: string;
360
+ description?: string;
361
+ linkButton?: LinkButtonProps;
362
+ icon?: IconNames;
363
+ };
364
+ declare const InfoBox: ({ title, icon, description, linkButton }: InfoBoxProps) => JSX.Element;
365
+
366
+ declare type MenuItem<T> = {
367
+ id: T;
368
+ title: string;
369
+ onClick?: (id: T) => void;
370
+ };
371
+ declare type MenuItemsProps<T> = {
372
+ title?: string;
373
+ onItemPress?: (id: T) => void;
374
+ options?: MenuItem<T>[];
375
+ };
376
+ declare const MenuItems: <T extends string | number>({ title, onItemPress, options, }: MenuItemsProps<T>) => JSX.Element;
377
+
378
+ declare type AvatarDropdownProps<T> = {
379
+ avatarProps: AvatarProps;
380
+ menuConfig: MenuItemsProps<T>;
381
+ };
382
+ declare const AvatarDropdown: <T extends string | number>({ avatarProps, menuConfig, }: AvatarDropdownProps<T>) => JSX.Element;
383
+
384
+ declare type TabProps<T = string, K = string> = {
385
+ tabKey: T;
386
+ text: string;
387
+ disabled?: boolean;
388
+ isActive?: boolean;
389
+ onClick?: (key: T) => void;
390
+ options?: MenuItem<K>[];
391
+ onOptionClick?: (optionKey: K) => void;
392
+ };
393
+
394
+ declare type TabGroupProps<T = string, K = string> = {
395
+ tabs: Pick<TabProps<T, K>, 'text' | 'tabKey' | 'disabled' | 'options'>[];
396
+ activeTabKey: T;
397
+ spacing?: SizesTypes$1;
398
+ onTabChange?: (tabKey: T) => void;
399
+ onOptionClick?: (optionKey: K) => void;
400
+ };
401
+ declare const TabGroup: <T extends string, K extends string>({ tabs, spacing, activeTabKey, onTabChange, }: TabGroupProps<T, K>) => JSX.Element;
402
+
403
+ declare type SetPasswordFormProps = {
404
+ fields: UIFields<SetPasswordFields>;
405
+ logoUrl: string;
406
+ isLoading?: boolean;
407
+ validations: SetPasswordRuleValidation[];
408
+ onSubmit: (values: SetPasswordFields) => void;
409
+ onBack: () => void;
410
+ };
411
+ declare const SetPasswordForm: ({ logoUrl, fields, validations, onBack, onSubmit, isLoading, }: SetPasswordFormProps) => JSX.Element;
412
+
413
+ declare type AcquisitionFormProps<T extends object> = {
414
+ fields: UIFields<T>;
415
+ logoUrl: string;
416
+ isLoading?: boolean;
417
+ onSubmit: (values: T) => void;
418
+ onLinkButtonClick?: Callback;
419
+ };
420
+ declare const AcquisitionForm: <T extends object>({ logoUrl, fields, onSubmit, onLinkButtonClick, isLoading, }: AcquisitionFormProps<T>) => JSX.Element;
421
+
422
+ declare type LoginFields = {
423
+ email: string;
424
+ password: string;
425
+ rememberMe: boolean;
426
+ };
427
+
428
+ declare type VerificationCodeForm = {
429
+ code: string;
430
+ };
431
+ declare type AuthMethod = 'email' | 'sms';
432
+ declare type TwoFactorAuthProps = {
433
+ logoUrl: string;
434
+ onNext?: (authMethod: AuthMethod) => Promise<void>;
435
+ onSubmit?: (values: VerificationCodeForm) => void;
436
+ onBack?: () => void;
437
+ };
438
+ declare const TwoFactorAuth: ({ logoUrl, onSubmit, onBack, onNext }: TwoFactorAuthProps) => JSX.Element;
439
+
440
+ declare type LoginFormProps = {
441
+ fields: UIFields<LoginFields>;
442
+ logoUrl: string;
443
+ isLoading?: boolean;
444
+ twoFactorAuthConfig?: {
445
+ twoFactorShow: boolean;
446
+ twoFactorAuthProps: TwoFactorAuthProps;
447
+ };
448
+ onSubmit: (values: LoginFields) => void;
449
+ onSignUpButtonClick?: Callback;
450
+ onForgotPasswordButtonClick?: Callback;
451
+ };
452
+ declare const LoginForm: ({ logoUrl, fields, onSubmit, onSignUpButtonClick, isLoading, twoFactorAuthConfig, onForgotPasswordButtonClick, }: LoginFormProps) => JSX.Element;
453
+
454
+ declare type ImportantLink = {
455
+ text: string;
456
+ href: string;
457
+ };
458
+ declare type HeaderProps = {
459
+ links?: ImportantLink[];
460
+ logoUrl: string;
461
+ tabs: TabGroupProps['tabs'];
462
+ withAvatar?: {
463
+ props: AvatarDropdownProps<string>;
464
+ };
465
+ onActionButtonClick?: Callback;
466
+ };
467
+ declare const Header: ({ logoUrl, links, onActionButtonClick, tabs, withAvatar }: HeaderProps) => JSX.Element;
468
+
469
+ declare type EmailAddressFields = {
470
+ email: string;
471
+ };
472
+ declare type ForgotPasswordFormProps = {
473
+ logoUrl: string;
474
+ isLoading?: boolean;
475
+ onSubmit?: (values: EmailAddressFields) => void;
476
+ onBack?: Callback;
477
+ };
478
+ declare const ForgotPasswordForm: ({ logoUrl, onBack, onSubmit, isLoading, }: ForgotPasswordFormProps) => JSX.Element;
479
+
480
+ declare type DefaultTemplateProps = {
481
+ header: HeaderProps;
482
+ banner?: BannerProps;
483
+ renderContent: () => JSX.Element;
484
+ };
485
+ declare const DefaultTemplate: ({ banner, header, renderContent }: DefaultTemplateProps) => JSX.Element;
486
+
487
+ declare type AuthDrawerContentType = 'sign-up' | 'sign-in' | 'set-password' | 'forgot-password';
488
+ declare type AuthDrawerContentProps = {
489
+ type: AuthDrawerContentType;
490
+ acquisitionFormConfig: AcquisitionFormProps<any>;
491
+ loginFormConfig: LoginFormProps;
492
+ forgotPasswordConfig: ForgotPasswordFormProps;
493
+ setPasswordConfig: SetPasswordFormProps;
494
+ };
495
+
496
+ declare type RegistrationPageProps = {
497
+ templateConfig: DefaultTemplateProps;
498
+ drawerConfig: Pick<DrawerProps, 'open' | 'onClose'>;
499
+ drawerContentConfig: AuthDrawerContentProps;
500
+ };
501
+ declare const AuthPage: ({ templateConfig, drawerContentConfig, drawerConfig, }: RegistrationPageProps) => JSX.Element;
502
+
503
+ interface Helpers {
504
+ goToNextStep: () => void;
505
+ goToPrevStep: () => void;
506
+ reset: () => void;
507
+ canGoToNextStep: boolean;
508
+ canGoToPrevStep: boolean;
509
+ setStep: Dispatch<SetStateAction<number>>;
510
+ }
511
+ declare const useStep: (maxStep: number) => [number, Helpers];
512
+
513
+ export { AcquisitionForm, AcquisitionFormProps, AuthMethod, AuthPage, Avatar, AvatarDropdown, AvatarDropdownProps, AvatarProps, Banner, BannerProps, BaseButtonProps, Button, ButtonProps, CheckBoxProps, Checkbox, CheckboxField, CheckboxFieldProps, CustomValidation, CustomValidationProps, CustomValidationRule, DefaultTemplate, DefaultTemplateProps, Divider, DividerProps, Drawer, FieldLabels, FieldLabelsProps, FieldMapper, FieldMapperProps, FieldRuleLabelTypes, FieldTypes, ForgotPasswordForm, ForgotPasswordFormProps, Header, HeaderProps, HorizontalPadding, HorizontalPaddingProps, Icon, IconNames, IconProps, Image, ImageProps, InfoBox, InfoBoxProps, Input, InputField, InputFieldProps, InputFieldTypes, InputIconProps, InputProps, LinkButton, LinkButtonProps, LoginForm, LoginFormProps, MenuItem, MenuItems, MenuItemsProps, RegistrationPageProps, Select, SelectField, SelectFieldProps, SelectableCardGroup, SelectableCardGroupProps, SetPasswordForm, SetPasswordFormProps, SizesTypes, Spacer, SpacerProps, Spinner, StyleWrapper, TabGroup, TabGroupProps, TextTypes, TextWrapper, TextWrapperProps, ThemeColors, ThemeColorsType, ThemeSizesType, ThemeTextType, Tooltip, TooltipProps, TouchableOpacity, TouchableOpacityProps, TwoFactorAuth, TwoFactorAuthProps, UICheckboxField, UIField, UIFields, UIInputField, UISelectField, ValidationTag, ValidationTagProps, ValidationTagStatus, VerticalPadding, ZealThemeProvider, acquisitionFormMockFields, defaultTheme, getFieldPlaceholder, getInitialValuesFromFields, isFormValid, loginMockFields, setPasswordMockFields, toast, toastStyles, useStep };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zealicsolutions/web-ui",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/Zealic_Solutions/zeal-ui-web.git"
@@ -16,15 +16,17 @@
16
16
  "dist"
17
17
  ],
18
18
  "types": "dist/index.d.ts",
19
- "exports": {
20
- ".": "./dist/index.d.ts",
21
- "./atoms": "./dist/atoms"
22
- },
23
19
  "typesVersions": {
24
20
  "*": {
25
- "atoms": ["dist/atoms"]
21
+ "atoms": ["dist/atoms"],
22
+ "molecules": ["dist/molecules"]
26
23
  }
27
24
  },
25
+ "exports": {
26
+ ".": "./dist/esm/index.js",
27
+ "./atoms": "./dist/esm/src/atoms",
28
+ "./molecules": "./dist/esm/src/molecules"
29
+ },
28
30
  "scripts": {
29
31
  "build": "npm run clean && rollup -c",
30
32
  "test": "jest",