@modul/mbui 0.0.1-beta-pv-50519-0061ac62 → 0.0.1-beta-pv-50520-797e2860
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/package.json
CHANGED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React, { FC, InputHTMLAttributes, ReactNode } from 'react'
|
|
2
|
+
import classnames from 'classnames'
|
|
3
|
+
interface ICheckbox extends InputHTMLAttributes<HTMLInputElement> {
|
|
4
|
+
switcher?: boolean
|
|
5
|
+
children?: ReactNode
|
|
6
|
+
childrenWrapperClassName?: string
|
|
7
|
+
labelClassName?: string
|
|
8
|
+
iconId?: string
|
|
9
|
+
onClick?: () => void
|
|
10
|
+
disabled?: boolean
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const Checkbox: FC<ICheckbox> = ({
|
|
14
|
+
id,
|
|
15
|
+
name,
|
|
16
|
+
checked,
|
|
17
|
+
onChange,
|
|
18
|
+
onClick,
|
|
19
|
+
value = 'on',
|
|
20
|
+
switcher,
|
|
21
|
+
onBlur,
|
|
22
|
+
onFocus,
|
|
23
|
+
iconId,
|
|
24
|
+
children,
|
|
25
|
+
childrenWrapperClassName,
|
|
26
|
+
labelClassName,
|
|
27
|
+
disabled,
|
|
28
|
+
}) => {
|
|
29
|
+
const labelClasses = classnames('label-check', labelClassName, { _switcher: switcher })
|
|
30
|
+
|
|
31
|
+
const renderIcon = (
|
|
32
|
+
<i
|
|
33
|
+
className="icon"
|
|
34
|
+
id={iconId}
|
|
35
|
+
/>
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
const renderChildren = children && <span className={childrenWrapperClassName}>{children}</span>
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<span onClick={onClick}>
|
|
42
|
+
<input
|
|
43
|
+
type="checkbox"
|
|
44
|
+
checked={checked}
|
|
45
|
+
name={name}
|
|
46
|
+
id={id}
|
|
47
|
+
onChange={onChange}
|
|
48
|
+
value={value}
|
|
49
|
+
onBlur={onBlur}
|
|
50
|
+
onFocus={onFocus}
|
|
51
|
+
disabled={disabled}
|
|
52
|
+
/>
|
|
53
|
+
|
|
54
|
+
<label
|
|
55
|
+
htmlFor={id}
|
|
56
|
+
className={labelClasses}
|
|
57
|
+
data-checked={checked}
|
|
58
|
+
>
|
|
59
|
+
{renderIcon}
|
|
60
|
+
{renderChildren}
|
|
61
|
+
</label>
|
|
62
|
+
</span>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default Checkbox
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,6 @@ import { Button } from './Base/Buttons'
|
|
|
2
2
|
import { TextLink } from './Base/Links'
|
|
3
3
|
import { DatePicker } from './DatePicker'
|
|
4
4
|
import { Input } from './Base/Input'
|
|
5
|
-
import {
|
|
5
|
+
import { Checkbox } from './Base/Checkbox'
|
|
6
6
|
|
|
7
|
-
export { Button, TextLink, DatePicker, Input,
|
|
7
|
+
export { Button, TextLink, DatePicker, Input, Checkbox }
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
export interface ILoader {
|
|
3
|
-
children?: React.ReactNode
|
|
4
|
-
loading?: boolean
|
|
5
|
-
className?: string
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const Loader: React.FC<ILoader> = ({ children, loading, className = '' }) => {
|
|
9
|
-
const combinedClassName = `${className} ${loading ? 'loading_block' : ''}`
|
|
10
|
-
|
|
11
|
-
if (children) {
|
|
12
|
-
return <div className={combinedClassName}>{children}</div>
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
//FIXME: { height: '100%' } указать с помощью класса
|
|
16
|
-
if (loading) {
|
|
17
|
-
return <div className="loading_block" />
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return null
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default Loader
|
package/src/Base/Loader/index.ts
DELETED