@app-studio/web 0.1.4 → 0.1.6
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/dist/components/Button/examples/index.d.ts +9 -9
- package/dist/components/Form/Checkbox/examples/index.d.ts +11 -11
- package/dist/components/Form/CountryPicker/examples/index.d.ts +12 -12
- package/dist/components/Form/DatePicker/examples/index.d.ts +11 -11
- package/dist/components/Form/Password/Password/Password.props.d.ts +1 -1
- package/dist/components/Form/TextArea/examples/index.d.ts +15 -15
- package/dist/components/Form/TextField/examples/index.d.ts +17 -17
- package/dist/components/Layout/Horizontal/examples/index.d.ts +4 -4
- package/dist/components/Layout/Input/FieldContainer/FieldContainer/FieldContainer.props.d.ts +1 -1
- package/dist/components/Layout/Input/FieldContent/FieldContent/FieldContent.props.d.ts +1 -1
- package/dist/components/Layout/Input/FieldLabel/FieldLabel/FieldLabel.props.d.ts +1 -1
- package/dist/components/Layout/Input/FieldLayout/FieldLayout/FieldLayout.props.d.ts +1 -1
- package/dist/components/Layout/Input/HelperText/HelperText.props.d.ts +1 -1
- package/dist/components/Layout/Input/index.d.ts +7 -7
- package/dist/components/Loader/examples/index.d.ts +7 -7
- package/dist/components/Modal/Examples/index.d.ts +9 -9
- package/dist/components/index.d.ts +18 -18
- package/package.json +6 -7
- package/src/components/Button/Button/Button.props.ts +0 -79
- package/src/components/Button/Button/Button.state.ts +0 -7
- package/src/components/Button/Button/Button.style.ts +0 -95
- package/src/components/Button/Button/Button.type.d.ts +0 -11
- package/src/components/Button/Button/Button.view.tsx +0 -113
- package/src/components/Button/Button.md +0 -165
- package/src/components/Button/Button.tsx +0 -24
- package/src/components/Button/examples/AutoFocusButton.tsx +0 -13
- package/src/components/Button/examples/BorderedButtons.tsx +0 -14
- package/src/components/Button/examples/ColoredButtons.tsx +0 -12
- package/src/components/Button/examples/DefaultButton.tsx +0 -4
- package/src/components/Button/examples/DisabledButton.tsx +0 -13
- package/src/components/Button/examples/IconButtons.tsx +0 -23
- package/src/components/Button/examples/LoadingButtons.tsx +0 -32
- package/src/components/Button/examples/ShadowButton.tsx +0 -6
- package/src/components/Button/examples/SizeButtons.tsx +0 -16
- package/src/components/Button/examples/VariantButtons.tsx +0 -20
- package/src/components/Button/examples/index.ts +0 -9
- package/src/components/Form/Checkbox/Checkbox/Checkbox.props.ts +0 -118
- package/src/components/Form/Checkbox/Checkbox/Checkbox.state.ts +0 -15
- package/src/components/Form/Checkbox/Checkbox/Checkbox.style.ts +0 -29
- package/src/components/Form/Checkbox/Checkbox/Checkbox.type.d.ts +0 -8
- package/src/components/Form/Checkbox/Checkbox/Checkbox.view.tsx +0 -98
- package/src/components/Form/Checkbox/Checkbox.md +0 -128
- package/src/components/Form/Checkbox/Checkbox.tsx +0 -15
- package/src/components/Form/Checkbox/examples/ColorScheme.tsx +0 -12
- package/src/components/Form/Checkbox/examples/Default.tsx +0 -5
- package/src/components/Form/Checkbox/examples/DisabledInput.tsx +0 -5
- package/src/components/Form/Checkbox/examples/ErrorCheckbox.tsx +0 -5
- package/src/components/Form/Checkbox/examples/FormCheckout.tsx +0 -46
- package/src/components/Form/Checkbox/examples/IconCheckbox.tsx +0 -8
- package/src/components/Form/Checkbox/examples/IndeterminateCheckbox.tsx +0 -5
- package/src/components/Form/Checkbox/examples/ReadOnlyInput.tsx +0 -5
- package/src/components/Form/Checkbox/examples/Shadow.tsx +0 -11
- package/src/components/Form/Checkbox/examples/SizeInput.tsx +0 -18
- package/src/components/Form/Checkbox/examples/StylesInput.tsx +0 -22
- package/src/components/Form/Checkbox/examples/index.ts +0 -11
- package/src/components/Form/CountryPicker/CountryPicker/CountryPicker.props.ts +0 -187
- package/src/components/Form/CountryPicker/CountryPicker/CountryPicker.state.ts +0 -28
- package/src/components/Form/CountryPicker/CountryPicker/CountryPicker.style.ts +0 -17
- package/src/components/Form/CountryPicker/CountryPicker/CountryPicker.type.d.ts +0 -22
- package/src/components/Form/CountryPicker/CountryPicker/CountryPicker.view.tsx +0 -234
- package/src/components/Form/CountryPicker/CountryPicker.md +0 -206
- package/src/components/Form/CountryPicker/CountryPicker.tsx +0 -16
- package/src/components/Form/CountryPicker/countries.json +0 -1453
- package/src/components/Form/CountryPicker/examples/Color.tsx +0 -12
- package/src/components/Form/CountryPicker/examples/Default.tsx +0 -4
- package/src/components/Form/CountryPicker/examples/Disabled.tsx +0 -5
- package/src/components/Form/CountryPicker/examples/Error.tsx +0 -4
- package/src/components/Form/CountryPicker/examples/Form.tsx +0 -23
- package/src/components/Form/CountryPicker/examples/Formik.tsx +0 -39
- package/src/components/Form/CountryPicker/examples/HelperText.tsx +0 -5
- package/src/components/Form/CountryPicker/examples/ReadOnlyInput.tsx +0 -5
- package/src/components/Form/CountryPicker/examples/Shadow.tsx +0 -4
- package/src/components/Form/CountryPicker/examples/Shape.tsx +0 -13
- package/src/components/Form/CountryPicker/examples/SizeInput.tsx +0 -16
- package/src/components/Form/CountryPicker/examples/StylesInput.tsx +0 -17
- package/src/components/Form/CountryPicker/examples/Variant.tsx +0 -13
- package/src/components/Form/CountryPicker/examples/index.ts +0 -12
- package/src/components/Form/CountryPicker/styles.css +0 -7
- package/src/components/Form/DatePicker/DatePicker/DatePicker.props.ts +0 -113
- package/src/components/Form/DatePicker/DatePicker/DatePicker.state.ts +0 -17
- package/src/components/Form/DatePicker/DatePicker/DatePicker.style.ts +0 -17
- package/src/components/Form/DatePicker/DatePicker/DatePicker.type.d.ts +0 -15
- package/src/components/Form/DatePicker/DatePicker/DatePicker.view.tsx +0 -118
- package/src/components/Form/DatePicker/DatePicker.md +0 -115
- package/src/components/Form/DatePicker/DatePicker.tsx +0 -15
- package/src/components/Form/DatePicker/examples/ColorScheme.tsx +0 -12
- package/src/components/Form/DatePicker/examples/Default.tsx +0 -4
- package/src/components/Form/DatePicker/examples/DisabledInput.tsx +0 -5
- package/src/components/Form/DatePicker/examples/ErrorCheckbox.tsx +0 -4
- package/src/components/Form/DatePicker/examples/FormCheckout.tsx +0 -23
- package/src/components/Form/DatePicker/examples/Formik.tsx +0 -35
- package/src/components/Form/DatePicker/examples/ReadOnlyInput.tsx +0 -5
- package/src/components/Form/DatePicker/examples/Shadow.tsx +0 -10
- package/src/components/Form/DatePicker/examples/SizeInput.tsx +0 -16
- package/src/components/Form/DatePicker/examples/StylesInput.tsx +0 -14
- package/src/components/Form/DatePicker/examples/helperTextDatePicker.tsx +0 -6
- package/src/components/Form/DatePicker/examples/index.ts +0 -11
- package/src/components/Form/Label/Label/Label.props.ts +0 -36
- package/src/components/Form/Label/Label/Label.style.ts +0 -34
- package/src/components/Form/Label/Label/Label.type.ts +0 -14
- package/src/components/Form/Label/Label/Label.view.tsx +0 -35
- package/src/components/Form/Label/Label.tsx +0 -8
- package/src/components/Form/Password/Password/Password.props.ts +0 -36
- package/src/components/Form/Password/Password/Password.state.ts +0 -6
- package/src/components/Form/Password/Password/Password.type.d.ts +0 -14
- package/src/components/Form/Password/Password/Password.view.tsx +0 -32
- package/src/components/Form/Password/Password.md +0 -108
- package/src/components/Form/Password/Password.tsx +0 -15
- package/src/components/Form/Password/example/Default.tsx +0 -9
- package/src/components/Form/Password/example/DisabledInput.tsx +0 -17
- package/src/components/Form/Password/example/ErrorInput.tsx +0 -66
- package/src/components/Form/Password/example/FormikErrorInput.tsx +0 -67
- package/src/components/Form/Password/example/FormikHelperText.tsx +0 -65
- package/src/components/Form/Password/example/HelperText.tsx +0 -65
- package/src/components/Form/Select/Select/Select.props.ts +0 -262
- package/src/components/Form/Select/Select/Select.state.ts +0 -19
- package/src/components/Form/Select/Select/Select.style.ts +0 -19
- package/src/components/Form/Select/Select/Select.type.d.ts +0 -15
- package/src/components/Form/Select/Select/Select.view.tsx +0 -337
- package/src/components/Form/Select/Select.md +0 -165
- package/src/components/Form/Select/Select.tsx +0 -16
- package/src/components/Form/Select/examples/Color.tsx +0 -12
- package/src/components/Form/Select/examples/Default.tsx +0 -4
- package/src/components/Form/Select/examples/Disabled.tsx +0 -5
- package/src/components/Form/Select/examples/Error.tsx +0 -4
- package/src/components/Form/Select/examples/Form.tsx +0 -23
- package/src/components/Form/Select/examples/Formik.tsx +0 -41
- package/src/components/Form/Select/examples/HelperText.tsx +0 -7
- package/src/components/Form/Select/examples/Multiple.tsx +0 -6
- package/src/components/Form/Select/examples/ReadOnlyInput.tsx +0 -5
- package/src/components/Form/Select/examples/Shadow.tsx +0 -11
- package/src/components/Form/Select/examples/SizeInput.tsx +0 -16
- package/src/components/Form/Select/examples/StylesInput.tsx +0 -15
- package/src/components/Form/Switch/Switch/Switch.props.ts +0 -91
- package/src/components/Form/Switch/Switch/Switch.state.ts +0 -11
- package/src/components/Form/Switch/Switch/Switch.style.ts +0 -72
- package/src/components/Form/Switch/Switch/Switch.type.d.ts +0 -6
- package/src/components/Form/Switch/Switch/Switch.view.tsx +0 -78
- package/src/components/Form/Switch/Switch.md +0 -148
- package/src/components/Form/Switch/Switch.tsx +0 -12
- package/src/components/Form/Switch/examples/ChildSwitch.tsx +0 -20
- package/src/components/Form/Switch/examples/ColorScheme.tsx +0 -5
- package/src/components/Form/Switch/examples/Default.tsx +0 -4
- package/src/components/Form/Switch/examples/DisabledInput.tsx +0 -7
- package/src/components/Form/Switch/examples/FormSwitch.tsx +0 -22
- package/src/components/Form/Switch/examples/Formik.tsx +0 -30
- package/src/components/Form/Switch/examples/ReadOnlyInput.tsx +0 -7
- package/src/components/Form/Switch/examples/Shadow.tsx +0 -11
- package/src/components/Form/Switch/examples/SizeInput.tsx +0 -21
- package/src/components/Form/Switch/examples/StylesInput.tsx +0 -32
- package/src/components/Form/TextArea/TextArea/TextArea.props.ts +0 -154
- package/src/components/Form/TextArea/TextArea/TextArea.state.ts +0 -21
- package/src/components/Form/TextArea/TextArea/TextArea.type.ts +0 -15
- package/src/components/Form/TextArea/TextArea/TextArea.view.tsx +0 -143
- package/src/components/Form/TextArea/TextArea.md +0 -169
- package/src/components/Form/TextArea/TextArea.tsx +0 -15
- package/src/components/Form/TextArea/examples/ColorScheme.tsx +0 -13
- package/src/components/Form/TextArea/examples/Default.tsx +0 -5
- package/src/components/Form/TextArea/examples/DisabledInput.tsx +0 -7
- package/src/components/Form/TextArea/examples/ErrorInput.tsx +0 -50
- package/src/components/Form/TextArea/examples/FormikErrorInput.tsx +0 -52
- package/src/components/Form/TextArea/examples/FormikHelperText.tsx +0 -51
- package/src/components/Form/TextArea/examples/HelperText.tsx +0 -49
- package/src/components/Form/TextArea/examples/LabelInput.tsx +0 -23
- package/src/components/Form/TextArea/examples/MaxRowCol.tsx +0 -7
- package/src/components/Form/TextArea/examples/Placeholder.tsx +0 -23
- package/src/components/Form/TextArea/examples/ReadOnlyInput.tsx +0 -7
- package/src/components/Form/TextArea/examples/ShadowArea.tsx +0 -28
- package/src/components/Form/TextArea/examples/ShapeInput.tsx +0 -15
- package/src/components/Form/TextArea/examples/SizeInput.tsx +0 -16
- package/src/components/Form/TextArea/examples/StylesInput.tsx +0 -32
- package/src/components/Form/TextArea/examples/VariantsInputs.tsx +0 -15
- package/src/components/Form/TextArea/examples/index.ts +0 -15
- package/src/components/Form/TextArea/styles.css +0 -7
- package/src/components/Form/TextField/TextField/TextField.props.ts +0 -134
- package/src/components/Form/TextField/TextField/TextField.state.ts +0 -21
- package/src/components/Form/TextField/TextField/TextField.type.d.ts +0 -15
- package/src/components/Form/TextField/TextField/TextField.view.tsx +0 -170
- package/src/components/Form/TextField/TextField.md +0 -193
- package/src/components/Form/TextField/TextField.tsx +0 -14
- package/src/components/Form/TextField/examples/ClearInput.tsx +0 -13
- package/src/components/Form/TextField/examples/ColorScheme.tsx +0 -13
- package/src/components/Form/TextField/examples/Default.tsx +0 -23
- package/src/components/Form/TextField/examples/DisabledInput.tsx +0 -7
- package/src/components/Form/TextField/examples/ErrorInput.tsx +0 -74
- package/src/components/Form/TextField/examples/FormikErrorInput.tsx +0 -76
- package/src/components/Form/TextField/examples/FormikHelperText.tsx +0 -62
- package/src/components/Form/TextField/examples/HelperText.tsx +0 -60
- package/src/components/Form/TextField/examples/LabelInput.tsx +0 -23
- package/src/components/Form/TextField/examples/LeftChild.tsx +0 -8
- package/src/components/Form/TextField/examples/Placeholder.tsx +0 -23
- package/src/components/Form/TextField/examples/ReadOnlyInput.tsx +0 -7
- package/src/components/Form/TextField/examples/RightChild.tsx +0 -8
- package/src/components/Form/TextField/examples/ShapeInput.tsx +0 -15
- package/src/components/Form/TextField/examples/SizeInput.tsx +0 -16
- package/src/components/Form/TextField/examples/StylesInput.tsx +0 -33
- package/src/components/Form/TextField/examples/VariantsInputs.tsx +0 -15
- package/src/components/Form/TextField/examples/index.ts +0 -17
- package/src/components/Form/TextField/styles.css +0 -7
- package/src/components/Layout/Center/Center/Center.props.ts +0 -18
- package/src/components/Layout/Center/Center/Center.view.tsx +0 -12
- package/src/components/Layout/Center/Center.md +0 -17
- package/src/components/Layout/Center/Center.tsx +0 -11
- package/src/components/Layout/Horizontal/Horizontal/Horizontal.props.ts +0 -26
- package/src/components/Layout/Horizontal/Horizontal/Horizontal.view.tsx +0 -24
- package/src/components/Layout/Horizontal/Horizontal.md +0 -107
- package/src/components/Layout/Horizontal/Horizontal.tsx +0 -11
- package/src/components/Layout/Horizontal/examples/Default.tsx +0 -11
- package/src/components/Layout/Horizontal/examples/Justify.tsx +0 -25
- package/src/components/Layout/Horizontal/examples/Reversed.tsx +0 -11
- package/src/components/Layout/Horizontal/examples/Wrap.tsx +0 -29
- package/src/components/Layout/Horizontal/examples/index.ts +0 -4
- package/src/components/Layout/Input/FieldContainer/FieldContainer/FieldContainer.props.ts +0 -25
- package/src/components/Layout/Input/FieldContainer/FieldContainer.tsx +0 -17
- package/src/components/Layout/Input/FieldContent/FieldContent/FieldContent.props.ts +0 -75
- package/src/components/Layout/Input/FieldContent/FieldContent.tsx +0 -55
- package/src/components/Layout/Input/FieldIcons/FieldIcons/FieldIcons.props.ts +0 -12
- package/src/components/Layout/Input/FieldIcons/FieldIcons.tsx +0 -19
- package/src/components/Layout/Input/FieldLabel/FieldLabel/FieldLabel.props.ts +0 -31
- package/src/components/Layout/Input/FieldLabel/FieldLabel.tsx +0 -30
- package/src/components/Layout/Input/FieldLayout/FieldLayout/FieldLayout.props.ts +0 -29
- package/src/components/Layout/Input/FieldLayout/FieldLayout.tsx +0 -33
- package/src/components/Layout/Input/FieldWrapper/FieldWrapper.props.ts +0 -12
- package/src/components/Layout/Input/FieldWrapper/FieldWrapper.tsx +0 -11
- package/src/components/Layout/Input/HelperText/HelperText.props.ts +0 -21
- package/src/components/Layout/Input/HelperText/HelperText.tsx +0 -22
- package/src/components/Layout/Input/index.ts +0 -7
- package/src/components/Layout/Vertical/Vertical/Vertical.props.ts +0 -26
- package/src/components/Layout/Vertical/Vertical/Vertical.type.ts +0 -3
- package/src/components/Layout/Vertical/Vertical/Vertical.view.tsx +0 -23
- package/src/components/Layout/Vertical/Vertical.md +0 -120
- package/src/components/Layout/Vertical/Vertical.tsx +0 -12
- package/src/components/Layout/Vertical/examples/Default.tsx +0 -11
- package/src/components/Layout/Vertical/examples/Justify.tsx +0 -26
- package/src/components/Layout/Vertical/examples/Reversed.tsx +0 -11
- package/src/components/Layout/Vertical/examples/Wrap.tsx +0 -30
- package/src/components/Layout/Vertical/examples/index.tsx +0 -5
- package/src/components/Layout/View/View.tsx +0 -2
- package/src/components/Layout/configs/Input.style.ts +0 -45
- package/src/components/Layout/configs/Input.type.ts +0 -18
- package/src/components/Link/Link/Link.props.ts +0 -50
- package/src/components/Link/Link/Link.state.ts +0 -6
- package/src/components/Link/Link/Link.style.ts +0 -14
- package/src/components/Link/Link/Link.type.d.ts +0 -8
- package/src/components/Link/Link/Link.view.tsx +0 -44
- package/src/components/Link/Link.md +0 -61
- package/src/components/Link/Link.tsx +0 -15
- package/src/components/Link/examples/Default.tsx +0 -5
- package/src/components/Link/examples/IsExternal.tsx +0 -10
- package/src/components/Link/examples/Underline.tsx +0 -23
- package/src/components/Loader/Loader/Loader.props.ts +0 -105
- package/src/components/Loader/Loader/Loader.style.ts +0 -25
- package/src/components/Loader/Loader/Loader.type.d.ts +0 -4
- package/src/components/Loader/Loader/Loader.view.tsx +0 -138
- package/src/components/Loader/Loader.md +0 -111
- package/src/components/Loader/Loader.tsx +0 -11
- package/src/components/Loader/examples/ColorLoader.tsx +0 -13
- package/src/components/Loader/examples/DefaultLoader.tsx +0 -4
- package/src/components/Loader/examples/PositionLoader.tsx +0 -19
- package/src/components/Loader/examples/SizeLoader.tsx +0 -12
- package/src/components/Loader/examples/SpeedLoader.tsx +0 -12
- package/src/components/Loader/examples/TextLoader.tsx +0 -8
- package/src/components/Loader/examples/VariantLoader.tsx +0 -12
- package/src/components/Loader/examples/index.ts +0 -7
- package/src/components/Modal/Examples/BlurModal.tsx +0 -38
- package/src/components/Modal/Examples/CloseButtonModal.tsx +0 -44
- package/src/components/Modal/Examples/DefaultModal.tsx +0 -38
- package/src/components/Modal/Examples/FullScreenModal.tsx +0 -28
- package/src/components/Modal/Examples/ModalPosition.tsx +0 -61
- package/src/components/Modal/Examples/PreventCloseModal.tsx +0 -27
- package/src/components/Modal/Examples/ScrollModal.tsx +0 -41
- package/src/components/Modal/Examples/ShadowModal.tsx +0 -29
- package/src/components/Modal/Examples/VariantModal.tsx +0 -48
- package/src/components/Modal/Examples/index.ts +0 -9
- package/src/components/Modal/Modal/Modal.props.ts +0 -202
- package/src/components/Modal/Modal/Modal.style.ts +0 -23
- package/src/components/Modal/Modal/Modal.type.d.ts +0 -7
- package/src/components/Modal/Modal/Modal.view.tsx +0 -169
- package/src/components/Modal/Modal.md +0 -509
- package/src/components/Modal/Modal.tsx +0 -18
- package/src/components/Svg/ArrowDown.tsx +0 -32
- package/src/components/Svg/ArrowUp.tsx +0 -32
- package/src/components/Svg/Check.tsx +0 -28
- package/src/components/Svg/Close.tsx +0 -31
- package/src/components/Svg/CloseEye.tsx +0 -26
- package/src/components/Svg/DustBin.tsx +0 -29
- package/src/components/Svg/Edit.tsx +0 -34
- package/src/components/Svg/ExternalLink.tsx +0 -31
- package/src/components/Svg/Indeterminate.tsx +0 -21
- package/src/components/Svg/OpenEye.tsx +0 -26
- package/src/components/Svg/Profile.tsx +0 -40
- package/src/components/Svg/RightArrow.tsx +0 -44
- package/src/components/Svg/index.tsx +0 -12
- package/src/components/Text/Text/Text.props.ts +0 -84
- package/src/components/Text/Text/Text.style.ts +0 -34
- package/src/components/Text/Text/Text.type.d.ts +0 -14
- package/src/components/Text/Text/Text.view.tsx +0 -96
- package/src/components/Text/Text.md +0 -163
- package/src/components/Text/Text.tsx +0 -13
- package/src/components/index.tsx +0 -18
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Typography } from 'app-studio';
|
|
3
|
-
import { Center } from 'src/components';
|
|
4
|
-
import { Label } from 'src/components/Form/Label/Label';
|
|
5
|
-
import { CheckSvg, IndeterminateSvg } from 'src/components/Svg';
|
|
6
|
-
|
|
7
|
-
import { CheckboxViewProps } from './Checkbox.props';
|
|
8
|
-
import { IconSizes, Sizes } from './Checkbox.style';
|
|
9
|
-
|
|
10
|
-
const CheckboxView: React.FC<CheckboxViewProps> = ({
|
|
11
|
-
id,
|
|
12
|
-
icon,
|
|
13
|
-
name,
|
|
14
|
-
label,
|
|
15
|
-
isChecked,
|
|
16
|
-
onChange,
|
|
17
|
-
onValueChange,
|
|
18
|
-
shadow = {},
|
|
19
|
-
size = 'md',
|
|
20
|
-
colorScheme = 'theme.primary',
|
|
21
|
-
error = false,
|
|
22
|
-
isSelected = false,
|
|
23
|
-
isHovered = false,
|
|
24
|
-
isDisabled = false,
|
|
25
|
-
isReadOnly = false,
|
|
26
|
-
isIndeterminate = false,
|
|
27
|
-
defaultIsSelected = false,
|
|
28
|
-
setIsSelected = () => {},
|
|
29
|
-
setIsHovered = () => {},
|
|
30
|
-
styles = { checkbox: {}, label: {} },
|
|
31
|
-
...props
|
|
32
|
-
}) => {
|
|
33
|
-
const handleHover = () => setIsHovered(!isHovered);
|
|
34
|
-
|
|
35
|
-
const handleChange = () => {
|
|
36
|
-
if (!isReadOnly && !isDisabled) {
|
|
37
|
-
if (isChecked === undefined) {
|
|
38
|
-
setIsSelected(!isSelected);
|
|
39
|
-
} else {
|
|
40
|
-
if (onChange) onChange(!isChecked);
|
|
41
|
-
if (onValueChange) onValueChange(!isChecked);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const checkboxStyle = {
|
|
47
|
-
container: {
|
|
48
|
-
gap: 10,
|
|
49
|
-
display: 'flex',
|
|
50
|
-
alignItems: 'center',
|
|
51
|
-
height: 'fit-content',
|
|
52
|
-
width: 'fit-content',
|
|
53
|
-
color: error ? 'theme.error' : isDisabled ? 'theme.disabled' : 'color.blueGray.700',
|
|
54
|
-
cursor: isDisabled ? 'not-allowed' : isReadOnly ? 'default' : 'pointer',
|
|
55
|
-
...styles['label'],
|
|
56
|
-
},
|
|
57
|
-
checkbox: {
|
|
58
|
-
...(isDisabled
|
|
59
|
-
? { backgroundColor: 'theme.disabled' }
|
|
60
|
-
: ((isChecked || isSelected) && !isIndeterminate) || isIndeterminate
|
|
61
|
-
? { backgroundColor: colorScheme }
|
|
62
|
-
: {
|
|
63
|
-
borderWidth: 2,
|
|
64
|
-
borderColor: error ? 'theme.error' : isHovered ? 'color.gray.500' : 'color.gray.300',
|
|
65
|
-
borderStyle: 'solid',
|
|
66
|
-
}),
|
|
67
|
-
borderRadius: 3,
|
|
68
|
-
filter: isHovered ? 'brightness(0.9)' : undefined,
|
|
69
|
-
...Sizes[size],
|
|
70
|
-
...shadow,
|
|
71
|
-
...styles['checkbox'],
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<Label
|
|
77
|
-
htmlFor={id}
|
|
78
|
-
as="div"
|
|
79
|
-
onClick={handleChange}
|
|
80
|
-
onMouseEnter={handleHover}
|
|
81
|
-
onMouseLeave={handleHover}
|
|
82
|
-
size={Typography.fontSizes[size]}
|
|
83
|
-
{...checkboxStyle.container}
|
|
84
|
-
{...props}
|
|
85
|
-
>
|
|
86
|
-
<Center {...checkboxStyle.checkbox}>
|
|
87
|
-
{isIndeterminate ? (
|
|
88
|
-
<IndeterminateSvg />
|
|
89
|
-
) : (
|
|
90
|
-
(isChecked || isSelected) && (icon ?? <CheckSvg size={IconSizes[size]} />)
|
|
91
|
-
)}
|
|
92
|
-
</Center>
|
|
93
|
-
{label}
|
|
94
|
-
</Label>
|
|
95
|
-
);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export default CheckboxView;
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
### **Import**
|
|
2
|
-
|
|
3
|
-
```tsx static
|
|
4
|
-
import { Checkbox } from "app-studio";
|
|
5
|
-
```
|
|
6
|
-
|
|
7
|
-
### **Default**
|
|
8
|
-
|
|
9
|
-
```tsx
|
|
10
|
-
<Checkbox>Agree to Terms and Conditions</Checkbox>
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
### **Disabled**
|
|
14
|
-
|
|
15
|
-
“isDisabled” makes the Checkbox unusable and un-clickable with a “disabled” look.
|
|
16
|
-
|
|
17
|
-
```tsx
|
|
18
|
-
<Checkbox isDisabled>Disable</Checkbox>
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
### **Read Only**
|
|
22
|
-
|
|
23
|
-
“isReadOnly” makes the field readable but not writable. Can only read the element.
|
|
24
|
-
|
|
25
|
-
```tsx
|
|
26
|
-
<Checkbox isReadOnly isChecked>
|
|
27
|
-
Read Only
|
|
28
|
-
</Checkbox>
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### **Indeterminate**
|
|
32
|
-
|
|
33
|
-
“isIndeterminant” indicates that the checkbox is never checked or unchecked.
|
|
34
|
-
|
|
35
|
-
```tsx
|
|
36
|
-
<Checkbox id="indeterminate" name="indeterminate" isIndeterminate>
|
|
37
|
-
Select All
|
|
38
|
-
</Checkbox>
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### **Size**
|
|
42
|
-
|
|
43
|
-
"size" property allows you to adjust the size of the checkbox. By default, it is set to "md" (medium) size.
|
|
44
|
-
|
|
45
|
-
```jsx
|
|
46
|
-
import { Vertical } from "../../Layout/Vertical/Vertical";
|
|
47
|
-
|
|
48
|
-
<Vertical gap={10}>
|
|
49
|
-
<Checkbox name="xs" size="xs" isChecked>
|
|
50
|
-
xs
|
|
51
|
-
</Checkbox>
|
|
52
|
-
<Checkbox name="sm" size="sm" isChecked>
|
|
53
|
-
sm
|
|
54
|
-
</Checkbox>
|
|
55
|
-
<Checkbox name="md" size="md" isChecked>
|
|
56
|
-
md
|
|
57
|
-
</Checkbox>
|
|
58
|
-
<Checkbox name="lg" size="lg" isChecked>
|
|
59
|
-
lg
|
|
60
|
-
</Checkbox>
|
|
61
|
-
<Checkbox name="xl" size="xl" isChecked>
|
|
62
|
-
xl
|
|
63
|
-
</Checkbox>
|
|
64
|
-
</Vertical>;
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### **ColorScheme**
|
|
68
|
-
|
|
69
|
-
“colorScheme” allows you to modify the background color of the Checkbox. It accepts a value from the "ColorThemes" type, with the default color set to "theme.primary".
|
|
70
|
-
|
|
71
|
-
```tsx
|
|
72
|
-
import { Horizontal } from "../../Layout/Horizontal/Horizontal";
|
|
73
|
-
|
|
74
|
-
<Horizontal justify="space-evenly" gap={10}>
|
|
75
|
-
{["theme.primary", "theme.secondary", "theme.error", "theme.success", "theme.warning"].map(
|
|
76
|
-
(color, index) => (
|
|
77
|
-
<Checkbox key={index} name="name" colorScheme={color} isChecked>
|
|
78
|
-
{color}
|
|
79
|
-
</Checkbox>
|
|
80
|
-
)
|
|
81
|
-
)}
|
|
82
|
-
</Horizontal>;
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### **Shadow**
|
|
86
|
-
|
|
87
|
-
"shadow" attribute applies a shadow effect to the Checkbox.
|
|
88
|
-
|
|
89
|
-
```tsx
|
|
90
|
-
<Checkbox shadow={{ boxShadow: "0 2px 4px rgba(0, 0, 0, 0.2)" }}>
|
|
91
|
-
Accept
|
|
92
|
-
</Checkbox>
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
### **Styles**
|
|
96
|
-
|
|
97
|
-
“styles” enables you to customize the styling of the input field.
|
|
98
|
-
|
|
99
|
-
```tsx
|
|
100
|
-
<Checkbox
|
|
101
|
-
styles={{
|
|
102
|
-
checkbox: { borderRadius: 10,
|
|
103
|
-
borderColor: 'theme.primary',
|
|
104
|
-
borderStyle: 'solid',
|
|
105
|
-
borderWidth: 1 },
|
|
106
|
-
label: { color: "teal" },
|
|
107
|
-
}}
|
|
108
|
-
>
|
|
109
|
-
Enable
|
|
110
|
-
</Checkbox>
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### Types
|
|
114
|
-
|
|
115
|
-
#### Sizes
|
|
116
|
-
|
|
117
|
-
```tsx static
|
|
118
|
-
type Size = "xs" | "sm" | "md" | "lg" | "xl";
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
#### Styles
|
|
122
|
-
|
|
123
|
-
```tsx static
|
|
124
|
-
type CheckboxStyles = {
|
|
125
|
-
checkbox?: CSSProperties;
|
|
126
|
-
label?: CSSProperties;
|
|
127
|
-
};
|
|
128
|
-
```
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { CheckboxProps } from './Checkbox/Checkbox.props';
|
|
4
|
-
import { useCheckboxState } from './Checkbox/Checkbox.state';
|
|
5
|
-
import CheckboxView from './Checkbox/Checkbox.view';
|
|
6
|
-
|
|
7
|
-
const CheckboxComponent: React.FC<CheckboxProps> = (props) => {
|
|
8
|
-
const checkboxStates = useCheckboxState(props);
|
|
9
|
-
return <CheckboxView {...checkboxStates} {...props} />;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Checkbox allows users to select one or more options from a list of choices.
|
|
14
|
-
*/
|
|
15
|
-
export const Checkbox = CheckboxComponent;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Vertical } from 'src/components/Layout/Vertical/examples';
|
|
3
|
-
|
|
4
|
-
import { Checkbox } from '../Checkbox';
|
|
5
|
-
|
|
6
|
-
export const ColorCheckbox = () => (
|
|
7
|
-
<Vertical gap={15}>
|
|
8
|
-
{['theme.primary', 'theme.secondary', 'theme.error', 'theme.success', 'theme.warning'].map((color) => (
|
|
9
|
-
<Checkbox key={color} name="name" colorScheme={color} label={color} defaultIsSelected />
|
|
10
|
-
))}
|
|
11
|
-
</Vertical>
|
|
12
|
-
);
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { Button } from 'src/components';
|
|
3
|
-
import { Vertical } from 'src/components/Layout/Vertical/examples';
|
|
4
|
-
import { View } from 'src/components/Layout/View/View';
|
|
5
|
-
|
|
6
|
-
import { Checkbox } from '../Checkbox';
|
|
7
|
-
|
|
8
|
-
export const FormCheckbox = () => {
|
|
9
|
-
const [isOnionChecked, setIsOnionChecked] = useState(false);
|
|
10
|
-
const [isCarrotChecked, setIsCarrotChecked] = useState(false);
|
|
11
|
-
|
|
12
|
-
const handleSubmit = (event: any) => {
|
|
13
|
-
event.preventDefault();
|
|
14
|
-
|
|
15
|
-
const selectedVegetables: Array<string> = [];
|
|
16
|
-
if (isOnionChecked) selectedVegetables.push('onion');
|
|
17
|
-
if (isCarrotChecked) selectedVegetables.push('carrot');
|
|
18
|
-
alert(`You selected: ${selectedVegetables.join(', ')}`);
|
|
19
|
-
};
|
|
20
|
-
return (
|
|
21
|
-
<form onSubmit={handleSubmit}>
|
|
22
|
-
<Vertical gap={10}>
|
|
23
|
-
<View>Choose your vegetables:</View>
|
|
24
|
-
<Checkbox
|
|
25
|
-
id="onion"
|
|
26
|
-
name="onion"
|
|
27
|
-
label="onion"
|
|
28
|
-
value="onion"
|
|
29
|
-
isChecked={isOnionChecked}
|
|
30
|
-
onChange={setIsOnionChecked}
|
|
31
|
-
/>
|
|
32
|
-
<Checkbox
|
|
33
|
-
id="carrot"
|
|
34
|
-
name="carrot"
|
|
35
|
-
label="carrot"
|
|
36
|
-
value="carrot"
|
|
37
|
-
isChecked={isCarrotChecked}
|
|
38
|
-
onChange={setIsCarrotChecked}
|
|
39
|
-
/>
|
|
40
|
-
<Button type="submit" onClick={handleSubmit}>
|
|
41
|
-
Submit
|
|
42
|
-
</Button>
|
|
43
|
-
</Vertical>
|
|
44
|
-
</form>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { EditSvg } from 'src/components/Svg';
|
|
3
|
-
|
|
4
|
-
import { Checkbox } from '../Checkbox';
|
|
5
|
-
|
|
6
|
-
export const IconCheckbox = () => (
|
|
7
|
-
<Checkbox id="child" name="child" colorScheme="theme.error" icon={<EditSvg size={14} />} label="Label" />
|
|
8
|
-
);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Checkbox } from 'src/components';
|
|
3
|
-
|
|
4
|
-
export const ShadowCheckbox = () => (
|
|
5
|
-
<Checkbox
|
|
6
|
-
id="shadowCheckbox"
|
|
7
|
-
name="shadowCheckbox"
|
|
8
|
-
shadow={{ boxShadow: 'rgb(249, 115, 22) 0px 4px 14px 0px' }}
|
|
9
|
-
defaultIsSelected
|
|
10
|
-
/>
|
|
11
|
-
);
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Vertical } from 'src/components/Layout/Vertical/examples';
|
|
3
|
-
|
|
4
|
-
import { Checkbox } from '../Checkbox';
|
|
5
|
-
|
|
6
|
-
export const SizeCheckbox = () => (
|
|
7
|
-
<Vertical gap={10}>
|
|
8
|
-
<Checkbox name="sm" size="sm" label="sm" defaultIsSelected />
|
|
9
|
-
<Checkbox name="md" size="md" label="md" defaultIsSelected />
|
|
10
|
-
<Checkbox name="lg" size="lg" label="lg" defaultIsSelected />
|
|
11
|
-
<Checkbox name="xl" size="xl" label="xl" defaultIsSelected />
|
|
12
|
-
<Checkbox name="2xl" size="2xl" label="2xl" defaultIsSelected />
|
|
13
|
-
<Checkbox name="3xl" size="3xl" label="3xl" defaultIsSelected />
|
|
14
|
-
<Checkbox name="4xl" size="4xl" label="4xl" defaultIsSelected />
|
|
15
|
-
<Checkbox name="5xl" size="5xl" label="5xl" defaultIsSelected />
|
|
16
|
-
<Checkbox name="6xl" size="6xl" label="6xl" defaultIsSelected />
|
|
17
|
-
</Vertical>
|
|
18
|
-
);
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { Checkbox } from '../Checkbox';
|
|
4
|
-
|
|
5
|
-
export const StyledCheckbox = () => (
|
|
6
|
-
<Checkbox
|
|
7
|
-
colorScheme="theme.primary"
|
|
8
|
-
label="Active"
|
|
9
|
-
styles={{
|
|
10
|
-
checkbox: {
|
|
11
|
-
borderRadius: '50%',
|
|
12
|
-
borderColor: 'theme.primary',
|
|
13
|
-
borderStyle: 'solid',
|
|
14
|
-
borderWidth: 1,
|
|
15
|
-
height: '16px',
|
|
16
|
-
width: '16px',
|
|
17
|
-
},
|
|
18
|
-
label: { color: 'theme.primary' },
|
|
19
|
-
}}
|
|
20
|
-
defaultIsSelected
|
|
21
|
-
/>
|
|
22
|
-
);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from 'src/components/Form/Checkbox/examples/ColorScheme';
|
|
2
|
-
export * from 'src/components/Form/Checkbox/examples/Default';
|
|
3
|
-
export * from 'src/components/Form/Checkbox/examples/DisabledInput';
|
|
4
|
-
export * from 'src/components/Form/Checkbox/examples/ErrorCheckbox';
|
|
5
|
-
export * from 'src/components/Form/Checkbox/examples/FormCheckout';
|
|
6
|
-
export * from 'src/components/Form/Checkbox/examples/IconCheckbox';
|
|
7
|
-
export * from 'src/components/Form/Checkbox/examples/IndeterminateCheckbox';
|
|
8
|
-
export * from 'src/components/Form/Checkbox/examples/ReadOnlyInput';
|
|
9
|
-
export * from 'src/components/Form/Checkbox/examples/Shadow';
|
|
10
|
-
export * from 'src/components/Form/Checkbox/examples/SizeInput';
|
|
11
|
-
export * from 'src/components/Form/Checkbox/examples/StylesInput';
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import { CSSProperties } from 'react';
|
|
2
|
-
import { Elevation } from 'src/utils/elevation';
|
|
3
|
-
import { Shadow } from 'app-studio';
|
|
4
|
-
|
|
5
|
-
import { Country, CountryPickerStyles, Shape, Size, Variant } from './CountryPicker.type';
|
|
6
|
-
|
|
7
|
-
export interface CountryPickerProps {
|
|
8
|
-
/**
|
|
9
|
-
* The identifier for the CountryPicker component.
|
|
10
|
-
*/
|
|
11
|
-
id?: string;
|
|
12
|
-
/**
|
|
13
|
-
* Indicates whether the field has an error.
|
|
14
|
-
*/
|
|
15
|
-
error?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* The name of the field.
|
|
18
|
-
*/
|
|
19
|
-
name?: string;
|
|
20
|
-
/**
|
|
21
|
-
* The label text for the field.
|
|
22
|
-
*/
|
|
23
|
-
label?: string;
|
|
24
|
-
/**
|
|
25
|
-
* The color scheme that changes the border color on hover of the field.
|
|
26
|
-
*/
|
|
27
|
-
colorScheme?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Additional helper text that provides information about the field.
|
|
30
|
-
*/
|
|
31
|
-
helperText?: string;
|
|
32
|
-
/**
|
|
33
|
-
* A brief text or hint that appears in the field before the user enters any value.
|
|
34
|
-
*/
|
|
35
|
-
placeholder?: string;
|
|
36
|
-
/**
|
|
37
|
-
* The shape that changes the outlines of the CountryPicker.
|
|
38
|
-
*/
|
|
39
|
-
shape?: Shape;
|
|
40
|
-
/**
|
|
41
|
-
* If true, the field will be automatically focused.
|
|
42
|
-
*/
|
|
43
|
-
isAutoFocus?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* If true, the CountryPicker cannot be edited.
|
|
46
|
-
*/
|
|
47
|
-
isReadOnly?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* If true, the field will be unusable.
|
|
50
|
-
*/
|
|
51
|
-
isDisabled?: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Callback function triggered when the CountryPicker loses focus.
|
|
54
|
-
*/
|
|
55
|
-
onBlur?: (value: any) => void;
|
|
56
|
-
/**
|
|
57
|
-
* Callback function triggered when the field value changes.
|
|
58
|
-
*/
|
|
59
|
-
onChange?: (value: any) => void;
|
|
60
|
-
/**
|
|
61
|
-
* CSS styles for the CountryPicker component.
|
|
62
|
-
*/
|
|
63
|
-
styles?: CountryPickerStyles;
|
|
64
|
-
/**
|
|
65
|
-
* The font size of the CountryPicker.
|
|
66
|
-
*/
|
|
67
|
-
size?: Size;
|
|
68
|
-
/**
|
|
69
|
-
* The default value of the input field.
|
|
70
|
-
*/
|
|
71
|
-
value?: string | number;
|
|
72
|
-
/**
|
|
73
|
-
* Changes the style of the input field.
|
|
74
|
-
*/
|
|
75
|
-
variant?: Variant;
|
|
76
|
-
/**
|
|
77
|
-
* Adds a shadow effect to the CountryPicker.
|
|
78
|
-
*/
|
|
79
|
-
shadow?: Shadow | Elevation | CSSProperties;
|
|
80
|
-
/**
|
|
81
|
-
* Other properties that can be passed to the component.
|
|
82
|
-
*/
|
|
83
|
-
[x: string]: any;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export interface CountryPickerViewProps extends CountryPickerProps {
|
|
87
|
-
/**
|
|
88
|
-
* Indicates whether the country picker is currently being hovered.
|
|
89
|
-
*/
|
|
90
|
-
isHovered?: boolean;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* A function to set the hovered state of the country picker.
|
|
94
|
-
* @param hovered - The hovered state to set.
|
|
95
|
-
*/
|
|
96
|
-
setIsHovered?: (hovered: boolean) => void;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Indicates whether the country picker is focused.
|
|
100
|
-
*/
|
|
101
|
-
isFocused?: boolean;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* A function to set the focus state of the country picker.
|
|
105
|
-
* @param focused - The focus state to set.
|
|
106
|
-
*/
|
|
107
|
-
setIsFocused?: (focused: boolean) => void;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Indicates the currently selected country.
|
|
111
|
-
*/
|
|
112
|
-
selected?: string;
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* A function to set the selected country.
|
|
116
|
-
* @param selected - The selected country to set.
|
|
117
|
-
*/
|
|
118
|
-
setSelected?: (selected: string) => void;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Indicates whether the country picker should be hidden.
|
|
122
|
-
*/
|
|
123
|
-
hide?: boolean;
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* A function to set the hide state of the country picker.
|
|
127
|
-
* @param hide - The hide state to set.
|
|
128
|
-
*/
|
|
129
|
-
setHide?: (hide: boolean) => void;
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Options for the country picker.
|
|
133
|
-
*/
|
|
134
|
-
newOptions?: Array<Country>;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* A function to set the new options for the country picker.
|
|
138
|
-
* @param newOptions - The new options to set.
|
|
139
|
-
*/
|
|
140
|
-
setNewOptions?: (newOptions: Array<Country>) => void;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export interface DropDownProps {
|
|
144
|
-
/**
|
|
145
|
-
* To set the height and width of the item list.
|
|
146
|
-
*/
|
|
147
|
-
size?: Size;
|
|
148
|
-
/**
|
|
149
|
-
* Function that will be called when the option is CountryPickered
|
|
150
|
-
*/
|
|
151
|
-
callback?: Function;
|
|
152
|
-
/**
|
|
153
|
-
* List of options
|
|
154
|
-
*/
|
|
155
|
-
options: Array<Country>;
|
|
156
|
-
/**
|
|
157
|
-
* Css styles for the CountryPicker container and label
|
|
158
|
-
*/
|
|
159
|
-
styles?: CountryPickerStyles;
|
|
160
|
-
/**
|
|
161
|
-
* other properties
|
|
162
|
-
*/
|
|
163
|
-
[x: string]: any;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export interface DropDownItemProps {
|
|
167
|
-
/**
|
|
168
|
-
* Function that will be called when the option is clicked
|
|
169
|
-
*/
|
|
170
|
-
callback?: Function;
|
|
171
|
-
/**
|
|
172
|
-
* Option to be displayed
|
|
173
|
-
*/
|
|
174
|
-
option: string;
|
|
175
|
-
/**
|
|
176
|
-
* To set the DropDownItem's fontSize
|
|
177
|
-
*/
|
|
178
|
-
size?: Size;
|
|
179
|
-
/**
|
|
180
|
-
* Css styles
|
|
181
|
-
*/
|
|
182
|
-
styles?: CountryPickerStyles;
|
|
183
|
-
/**
|
|
184
|
-
* other properties
|
|
185
|
-
*/
|
|
186
|
-
[x: string]: any;
|
|
187
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import countryList from '../countries.json';
|
|
4
|
-
|
|
5
|
-
import { CountryPickerProps } from './CountryPicker.props';
|
|
6
|
-
import { Country } from './CountryPicker.type';
|
|
7
|
-
|
|
8
|
-
export const useCountryPickerState = ({ placeholder }: CountryPickerProps) => {
|
|
9
|
-
const [newOptions, setNewOptions] = React.useState<Array<Country>>(countryList);
|
|
10
|
-
const [selected, setSelected] = React.useState<string>(placeholder ?? countryList[0].name);
|
|
11
|
-
|
|
12
|
-
const [hide, setHide] = React.useState(true);
|
|
13
|
-
const [isFocused, setIsFocused] = React.useState(false);
|
|
14
|
-
const [isHovered, setIsHovered] = React.useState(false);
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
hide,
|
|
18
|
-
setHide,
|
|
19
|
-
newOptions,
|
|
20
|
-
setNewOptions,
|
|
21
|
-
isHovered,
|
|
22
|
-
setIsHovered,
|
|
23
|
-
isFocused,
|
|
24
|
-
setIsFocused,
|
|
25
|
-
selected,
|
|
26
|
-
setSelected,
|
|
27
|
-
};
|
|
28
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Size } from './CountryPicker.type';
|
|
2
|
-
|
|
3
|
-
export const IconSizes: Record<Size, number> = {
|
|
4
|
-
xs: 8,
|
|
5
|
-
sm: 10,
|
|
6
|
-
md: 12,
|
|
7
|
-
lg: 14,
|
|
8
|
-
xl: 16,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const LabelSizes: Record<Size, number> = {
|
|
12
|
-
xs: 8,
|
|
13
|
-
sm: 10,
|
|
14
|
-
md: 12,
|
|
15
|
-
lg: 14,
|
|
16
|
-
xl: 16,
|
|
17
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export type CountryPickerStyles = {
|
|
2
|
-
text?: CSSProperties;
|
|
3
|
-
icon?: CSSProperties;
|
|
4
|
-
dropDown?: CSSProperties;
|
|
5
|
-
box?: CSSProperties;
|
|
6
|
-
label?: CSSProperties;
|
|
7
|
-
helperText?: CSSProperties;
|
|
8
|
-
field?: CSSProperties;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export type Country = {
|
|
12
|
-
name: string;
|
|
13
|
-
dial_code: string;
|
|
14
|
-
emoji: string;
|
|
15
|
-
code: string;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
19
|
-
|
|
20
|
-
export type Shape = 'default' | 'sharp' | 'rounded' | 'pillShaped';
|
|
21
|
-
|
|
22
|
-
export type Variant = 'default' | 'outline' | 'unStyled';
|