Skip to content

Commit

Permalink
fix(FJS-NOINDEX): utils update
Browse files Browse the repository at this point in the history
  • Loading branch information
LordWerter committed Aug 18, 2021
1 parent 440f22a commit 6ce7556
Show file tree
Hide file tree
Showing 22 changed files with 109 additions and 243 deletions.
2 changes: 1 addition & 1 deletion packages/react-uikit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fast-js/react-uikit",
"version": "0.1.11",
"version": "0.2.0",
"author": "Aleksander Rudenko<learnitnow@yandex.ru>",
"license": "MIT",
"repository": "https://github.com/LordWerter/fast-js/tree/main/packages/react-uikit",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-uikit/src/components/Button/BasicButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { TSize } from '../../definitions/IPropTypes';
* @returns {JSX.Element}
*/
export const BasicButton: React.FC<IProps> = (props): JSX.Element => {
const { text, onClick, sizeId = 'xl', customize = {}, iconId = null } = props;
const { text, onClick, sizeId = 'mobile', customize = {}, iconId = null } = props;

// @ts-ignore
const initTheme = { ...useTheme().components.Button };
Expand Down
36 changes: 12 additions & 24 deletions packages/react-uikit/src/components/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable react/jsx-no-bind */
/* eslint-disable no-undef */
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable no-unused-expressions */
/* eslint-disable react/jsx-no-bind */
/* eslint-disable guard-for-in */
/* eslint-disable @typescript-eslint/no-unused-expressions */
/* eslint-disable react/prop-types */
Expand All @@ -20,35 +21,22 @@ export interface IProps {
onChange?: EventHandler;
customize?: any;
}
/**
* imports of packages
*/

import React, { useState } from 'react';
import { useTheme } from '@emotion/react';
/**
* imports of components
*/
/**
* imports of styles
*/
import { CWrap, IconBox, Input, Label } from './Checkbox.styles';
/**
* imports of constants
*/
/**
* imports of utils
*/
import { mergeThemeObjects } from '../../utils';
import { TSize } from '../../definitions/IPropTypes';

/**
* Checkbox Component
* @param {Object} props implements IProps
* @type {Function}
* @returns {JSX.Element}
*/
export const Checkbox: React.FC<IProps> = (props): JSX.Element => {
const { name = `checkbox_${props.hash}`, label, sizeId = 'xl', disabled = false, callback, customize = {} } = props;
const {
name = `checkbox_${props.hash}`,
label,
sizeId = 'mobile',
disabled = false,
callback,
customize = {},
} = props;

// const [active, setActive] = useState(false);
const [isChecked, setIsChecked] = useState(false);
Expand Down
23 changes: 3 additions & 20 deletions packages/react-uikit/src/components/Counter/Counter.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/* eslint-disable no-unused-vars */
/* eslint-disable guard-for-in */
/* eslint-disable react/jsx-no-bind */
/* eslint-disable react/forbid-component-props */
/* eslint-disable react/prop-types */
/* eslint-disable @typescript-eslint/ban-ts-comment */
/**
* imports & exports of namespaces, interfaces & types
*/
import { TSize } from '../../definitions/IPropTypes';

export interface IProps {
Expand All @@ -17,28 +15,13 @@ export interface IProps {
handlePlusCount: (productCode: string) => any;
}

/**
* imports of packages
*/
import React from 'react';
import { useTheme } from '@emotion/react';
/**
* imports of components
*/
/**
* imports of styles
*/
import { CWrap, Value, Btn } from './Counter.styles';
/**
* imports of constants
*/
/**
* imports of utils
*/
import { mergeThemeObjects } from '../../utils';
import { CWrap, Value, Btn } from './Counter.styles';

export const Counter: React.FC<IProps> = (props): JSX.Element => {
const { sizeId = 'xl', customize = {}, count, productCode, handleMinusCount, handlePlusCount } = props;
const { sizeId = 'mobile', customize = {}, count, productCode, handleMinusCount, handlePlusCount } = props;
// @ts-ignore
const theme = { ...useTheme().components.Counter };
const requiredThemeKeys = ['container', 'button', 'value', 'images'];
Expand Down
10 changes: 3 additions & 7 deletions packages/react-uikit/src/components/Dropbox/Dropbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import React, { useState } from 'react';
import { useTheme } from '@emotion/react';
import { TSize } from '../../definitions/IPropTypes';
import { mergeThemeObjects } from '../../utils';
import { CWrap, SelectedItem, Item } from './Dropbox.styles';

export interface IProps {
defaultItem: any;
Expand All @@ -15,14 +17,8 @@ export interface IProps {
data?: any;
}

import { CWrap, SelectedItem, Item } from './Dropbox.styles';
/**
* imports of utils
*/
import { mergeThemeObjects } from '../../utils';

export const Dropbox: React.FC<IProps> = (props): JSX.Element => {
const { defaultItem, data, sizeId = 'xl', customize = {}, children } = props;
const { defaultItem, data, sizeId = 'mobile', customize = {}, children } = props;

const [selectedItem, setSelectedItem] = useState(defaultItem);

Expand Down
5 changes: 1 addition & 4 deletions packages/react-uikit/src/components/Image/BgImage.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/* eslint-disable react/forbid-component-props */
/* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable react/prop-types */
/**
* imports & exports of namespaces, interfaces & types
*/
import { TSize } from '../../definitions/IPropTypes';
import React from 'react';
import { useTheme } from '@emotion/react';
Expand All @@ -21,7 +18,7 @@ import { CWrap } from './BgImage.styles';
import { mergeThemeObjects } from '../../utils';

const BgImage: React.FC<IProps> = (props): JSX.Element => {
const { bgImage, sizeId = 'xl', customize = {} } = props;
const { bgImage, sizeId = 'mobile', customize = {} } = props;

// @ts-ignore
const theme = { ...useTheme().components.Image };
Expand Down
37 changes: 7 additions & 30 deletions packages/react-uikit/src/components/Inputbox/Input/Input.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
/* eslint-disable no-unused-vars */
/* eslint-disable no-undef */
/* eslint-disable guard-for-in */
/* eslint-disable react/jsx-no-bind */
/* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable react/prop-types */
/**
* imports & exports of namespaces, interfaces & types
*/
import React, { useState, ChangeEvent } from 'react';
import { useTheme } from '@emotion/react';
import { mergeThemeObjects } from '../../../utils';
import { CWrap, InputWrap, Label, InputBox, Placeholder, Notice } from './Input.styles';
import { TSize } from '../../../definitions/IPropTypes';

export type TLabel = {
Expand All @@ -29,35 +32,10 @@ export interface IProps {
handleReset2EmptyValueBtn?: () => any;
onChange?: (event: ChangeEvent<HTMLInputElement>) => any | null;
}
/**
* imports of packages
*/
import React, { useState, ChangeEvent } from 'react';
import { useTheme } from '@emotion/react';
/**
* imports of components
*/
/**
* imports of styles
*/
import { CWrap, InputWrap, Label, InputBox, Placeholder, Notice } from './Input.styles';
/**
* imports of constants
*/
/**
* imports of utils
*/
import { mergeThemeObjects } from '../../../utils';

/**
* Input Component
* @param {Object} props implements IProps
* @type {Function}
* @returns {JSX.Element}
*/
export const Input: React.FC<IProps> = (props): JSX.Element => {
const {
sizeId = 'xl',
sizeId = 'mobile',
value = '',
label = null,
placeholder = null,
Expand All @@ -76,7 +54,6 @@ export const Input: React.FC<IProps> = (props): JSX.Element => {
theme[curKey] = mergeThemeObjects(theme[curKey], customize[curKey]);
});


return (
<CWrap sizeId={sizeId} theme={theme.container}>
{label ? (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
/* eslint-disable no-unused-vars */
/* eslint-disable react/jsx-no-bind */
/* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable react/prop-types */
/**
* imports & exports of namespaces, interfaces & types
*/
import React from 'react';
import { useTheme } from '@emotion/react';
import Input from '../Input';
import { mergeThemeObjects } from '../../../utils';
import { CWrap, SearchBtn } from './Input4Search.styles';
import { TSize } from '../../../definitions/IPropTypes';

export interface IProps {
Expand All @@ -13,35 +16,9 @@ export interface IProps {
onClick?: (event: any) => any;
customize?: any;
}
/**
* imports of packages
*/
import React from 'react';
import { useTheme } from '@emotion/react';
/**
* imports of components
*/
import Input from '../Input';
/**
* imports of styles
*/
import { CWrap, SearchBtn } from './Input4Search.styles';
/**
* imports of constants
*/
/**
* imports of utils
*/
import { mergeThemeObjects } from '../../../utils';

/**
* Input4Search Component
* @param {Object} props implements IProps
* @type {Function}
* @returns {JSX.Element}
*/
export const Input4Search: React.FC<IProps> = (props): JSX.Element => {
const { sizeId = 'xl', value = '', params, onClick, customize = {} } = props;
const { sizeId = 'mobile', value = '', params, onClick, customize = {} } = props;

// @ts-ignore
const theme = { ...useTheme().components.Input4Search };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable react/prop-types */
/* eslint-disable @typescript-eslint/ban-ts-comment */
/**
* imports & exports of namespaces, interfaces & types
*/
import React from 'react';
import IMask from 'imask';
import { useTheme } from '@emotion/react';
import Input from '../Input';
import { TSize } from '../../../definitions/IPropTypes';

export interface IProps {
Expand All @@ -13,19 +14,9 @@ export interface IProps {
maskOptions?: any;
customize?: any;
}
/**
* imports of packages
*/
import React from 'react';
import IMask from 'imask';
import { useTheme } from '@emotion/react';
/**
* imports of components
*/
import Input from '../Input';

export const InputWithMask: React.FC<IProps> = (props): JSX.Element => {
const { sizeId = 'xl', value = '', maskTpl, customize = {} } = props;
const { sizeId = 'mobile', value = '', maskTpl } = props;
const masked = IMask.createMask({
mask: maskTpl,
});
Expand All @@ -36,7 +27,7 @@ export const InputWithMask: React.FC<IProps> = (props): JSX.Element => {

return (
<>
<Input customize={customize} sizeId={sizeId} value={maskedValue} />
<Input customize={theme} sizeId={sizeId} value={maskedValue} />
</>
);
};
Expand Down
35 changes: 7 additions & 28 deletions packages/react-uikit/src/components/Keyboard/KeyBtn.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
/* eslint-disable no-unused-vars */
/* eslint-disable react/jsx-no-bind */
/* eslint-disable no-unused-expressions */
/* eslint-disable @typescript-eslint/no-unused-expressions */
/* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable react/prop-types */
/**
* imports & exports of namespaces, interfaces & types
*/
import React from 'react';
import { useTheme } from '@emotion/react';
import Image from '../Image';
import { mergeThemeObjects } from '../../utils';
import { CWrap } from './KeyBtn.styles';
import { TSize } from '../../definitions/IPropTypes';

export interface IProps {
Expand All @@ -18,32 +21,8 @@ export interface IProps {
customize?: any;
}

/**
* imports of packages
*/
import React from 'react';
import { useTheme } from '@emotion/react';
/**
* imports of components
*/
import Image from '../Image';
/**
* imports of styles
*/
import { CWrap } from './KeyBtn.styles';
/**
* imports of utils
*/
import { mergeThemeObjects } from '../../utils';

/**
* KeyBtn Component
* @param {Object} props implements IProps
* @type {Function}
* @returns {JSX.Element}
*/
export const KeyBtn: React.FC<IProps> = (props): JSX.Element => {
const { sizeId = 'xl', customize = {}, boardId, keyCode, keyValue, capslock, callback } = props;
const { sizeId = 'mobile', customize = {}, boardId, keyCode, keyValue, capslock, callback } = props;

// @ts-ignore
const theme = { ...useTheme().components.KeyBtn };
Expand Down
Loading

0 comments on commit 6ce7556

Please sign in to comment.