@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,234 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { Element, Input, Typography, useTheme } from 'app-studio';
|
|
3
|
-
import { FieldContainer, FieldContent, FieldIcons, FieldLabel, FieldWrapper } from 'src/components/Layout/Input';
|
|
4
|
-
import { ArrowDownSvg } from 'src/components/Svg/ArrowDown';
|
|
5
|
-
import { ArrowUpSvg } from 'src/components/Svg/ArrowUp';
|
|
6
|
-
|
|
7
|
-
import countryList from '../countries.json';
|
|
8
|
-
|
|
9
|
-
import { CountryPickerViewProps, DropDownItemProps, DropDownProps } from './CountryPicker.props';
|
|
10
|
-
import { IconSizes } from './CountryPicker.style';
|
|
11
|
-
import { Country } from './CountryPicker.type';
|
|
12
|
-
|
|
13
|
-
const CountryList: React.FC<DropDownProps> = (props) => <Element as="ul" {...props} />;
|
|
14
|
-
|
|
15
|
-
const CountrySelector: React.FC<any> = (props) => <Input type="country" {...props} />;
|
|
16
|
-
|
|
17
|
-
const CountryItem: React.FC<DropDownItemProps> = (props) => <Element as="li" {...props} />;
|
|
18
|
-
|
|
19
|
-
export const DropDownItem: React.FC<DropDownItemProps> = ({
|
|
20
|
-
option,
|
|
21
|
-
size = 'md',
|
|
22
|
-
callback = () => {},
|
|
23
|
-
styles = { text: {} },
|
|
24
|
-
}) => {
|
|
25
|
-
const [isHovered, setIsHovered] = useState(false);
|
|
26
|
-
|
|
27
|
-
const handleOptionClick = (event: any) => {
|
|
28
|
-
event.stopPropagation();
|
|
29
|
-
callback(option);
|
|
30
|
-
};
|
|
31
|
-
const handleHover = () => setIsHovered(!isHovered);
|
|
32
|
-
return (
|
|
33
|
-
<CountryItem
|
|
34
|
-
margin={0}
|
|
35
|
-
role="DropDownItem"
|
|
36
|
-
listStyleType="none"
|
|
37
|
-
paddingVertical={6}
|
|
38
|
-
paddingHorizontal={12}
|
|
39
|
-
onMouseEnter={handleHover}
|
|
40
|
-
onMouseLeave={handleHover}
|
|
41
|
-
onClick={handleOptionClick}
|
|
42
|
-
fontSize={Typography.fontSizes[size]}
|
|
43
|
-
backgroundColor={isHovered ? 'trueGray.100' : 'transparent'}
|
|
44
|
-
{...styles['text']}
|
|
45
|
-
>
|
|
46
|
-
{option}
|
|
47
|
-
</CountryItem>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const DropDown: React.FC<DropDownProps> = ({
|
|
52
|
-
size,
|
|
53
|
-
styles = { dropDown: {} },
|
|
54
|
-
options,
|
|
55
|
-
callback = () => {},
|
|
56
|
-
}) => {
|
|
57
|
-
const handleCallback = (option: string) => callback(option);
|
|
58
|
-
return (
|
|
59
|
-
<CountryList
|
|
60
|
-
role="dropDown"
|
|
61
|
-
margin={0}
|
|
62
|
-
padding={0}
|
|
63
|
-
top="100%"
|
|
64
|
-
width="100%"
|
|
65
|
-
display="flex"
|
|
66
|
-
zIndex={1000}
|
|
67
|
-
overflow="auto"
|
|
68
|
-
maxHeight="300px"
|
|
69
|
-
borderRadius={4}
|
|
70
|
-
position="absolute"
|
|
71
|
-
flexDirection="column"
|
|
72
|
-
backgroundColor="white"
|
|
73
|
-
boxShadow="rgba(0, 0, 0, 0.07) 0px 1px 1px, rgba(0, 0, 0, 0.07) 0px 2px 2px, rgba(0, 0, 0, 0.07) 0px 4px 4px, rgba(0, 0, 0, 0.07) 0px 8px 8px, rgba(0, 0, 0, 0.07) 0px 16px 16px"
|
|
74
|
-
{...styles['dropDown']}
|
|
75
|
-
>
|
|
76
|
-
{options.map((option: Country) => (
|
|
77
|
-
<DropDownItem
|
|
78
|
-
key={option.code}
|
|
79
|
-
size={size}
|
|
80
|
-
option={option.name}
|
|
81
|
-
callback={handleCallback}
|
|
82
|
-
{...styles['text']}
|
|
83
|
-
/>
|
|
84
|
-
))}
|
|
85
|
-
</CountryList>
|
|
86
|
-
);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const CountryPickerView: React.FC<CountryPickerViewProps> = ({
|
|
90
|
-
id,
|
|
91
|
-
name,
|
|
92
|
-
label,
|
|
93
|
-
selected,
|
|
94
|
-
placeholder,
|
|
95
|
-
helperText,
|
|
96
|
-
hide = false,
|
|
97
|
-
error = false,
|
|
98
|
-
isHovered = false,
|
|
99
|
-
isFocused = false,
|
|
100
|
-
isAutoFocus = false,
|
|
101
|
-
isDisabled = false,
|
|
102
|
-
isReadOnly = false,
|
|
103
|
-
shadow = {},
|
|
104
|
-
newOptions = [],
|
|
105
|
-
size = 'md',
|
|
106
|
-
variant = 'default',
|
|
107
|
-
shape = 'default',
|
|
108
|
-
colorScheme = 'theme.primary',
|
|
109
|
-
onChange,
|
|
110
|
-
onBlur = () => {},
|
|
111
|
-
setHide = () => {},
|
|
112
|
-
setNewOptions = () => {},
|
|
113
|
-
setIsHovered = () => {},
|
|
114
|
-
setIsFocused = () => {},
|
|
115
|
-
setSelected = () => {},
|
|
116
|
-
styles = {
|
|
117
|
-
text: {},
|
|
118
|
-
icon: {},
|
|
119
|
-
label: {},
|
|
120
|
-
dropDown: {},
|
|
121
|
-
helperText: {},
|
|
122
|
-
box: {},
|
|
123
|
-
},
|
|
124
|
-
...props
|
|
125
|
-
}) => {
|
|
126
|
-
const { getColor } = useTheme();
|
|
127
|
-
const IconColor = getColor('color.blueGray.700');
|
|
128
|
-
|
|
129
|
-
const handleHover = () => setIsHovered(!isHovered);
|
|
130
|
-
const handleFocus = () => setIsFocused(true);
|
|
131
|
-
|
|
132
|
-
const handleCallback = (option: string) => {
|
|
133
|
-
setHide(!hide);
|
|
134
|
-
setSelected(option);
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
const handleClick = () => {
|
|
138
|
-
if (!isDisabled && !isReadOnly) {
|
|
139
|
-
setHide(!hide);
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
143
|
-
const selectedCountry = event.target.value;
|
|
144
|
-
const filteredCountries = countryList.filter((country) =>
|
|
145
|
-
country.name.toLowerCase().startsWith(selectedCountry.toLowerCase())
|
|
146
|
-
);
|
|
147
|
-
if (hide) setHide(false);
|
|
148
|
-
setSelected(event.target.value);
|
|
149
|
-
setNewOptions(filteredCountries);
|
|
150
|
-
if (onChange) onChange(event);
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
const handleBlur = (event: any) => {
|
|
154
|
-
onBlur(event);
|
|
155
|
-
setIsFocused(false);
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
useEffect(() => {
|
|
159
|
-
if (onChange) onChange(selected); // Call onChange when selectedCountry changes
|
|
160
|
-
}, [onChange, selected]);
|
|
161
|
-
|
|
162
|
-
const isWithLabel = !!(isFocused && label);
|
|
163
|
-
|
|
164
|
-
const fieldStyles = {
|
|
165
|
-
margin: 0,
|
|
166
|
-
paddingVerical: 8,
|
|
167
|
-
paddingHorizonatl: 0,
|
|
168
|
-
width: '100%',
|
|
169
|
-
heigth: '100%',
|
|
170
|
-
border: 'none',
|
|
171
|
-
on: { focus: { outline: 'none' } },
|
|
172
|
-
fontSize: Typography.fontSizes[size],
|
|
173
|
-
backgroundColor: 'transparent',
|
|
174
|
-
color: isDisabled ? 'color.trueGray.600' : 'color.blueGray.700',
|
|
175
|
-
cursor: isDisabled ? 'not-allowed' : 'auto',
|
|
176
|
-
...styles['field'],
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
return (
|
|
180
|
-
<FieldContainer helperText={helperText} error={error} styles={styles} onClick={handleClick}>
|
|
181
|
-
<FieldContent
|
|
182
|
-
label={label}
|
|
183
|
-
size={size}
|
|
184
|
-
error={error}
|
|
185
|
-
shape={shape}
|
|
186
|
-
styles={styles}
|
|
187
|
-
shadow={shadow}
|
|
188
|
-
variant={variant}
|
|
189
|
-
value={selected}
|
|
190
|
-
color={colorScheme}
|
|
191
|
-
isHovered={isHovered}
|
|
192
|
-
isDisabled={isDisabled}
|
|
193
|
-
isReadOnly={isReadOnly}
|
|
194
|
-
isFocused={isFocused}
|
|
195
|
-
isWithLabel={isWithLabel}
|
|
196
|
-
colorScheme={colorScheme}
|
|
197
|
-
onMouseEnter={handleHover}
|
|
198
|
-
onMouseLeave={handleHover}
|
|
199
|
-
>
|
|
200
|
-
<FieldWrapper>
|
|
201
|
-
{isWithLabel && (
|
|
202
|
-
<FieldLabel htmlFor={id} color={colorScheme} error={error} {...styles}>
|
|
203
|
-
{label}
|
|
204
|
-
</FieldLabel>
|
|
205
|
-
)}
|
|
206
|
-
<CountrySelector
|
|
207
|
-
id={id}
|
|
208
|
-
name={name}
|
|
209
|
-
placeholder={placeholder}
|
|
210
|
-
readOnly={isReadOnly}
|
|
211
|
-
disabled={isDisabled}
|
|
212
|
-
autoFocus={isAutoFocus}
|
|
213
|
-
onBlur={handleBlur}
|
|
214
|
-
onFocus={handleFocus}
|
|
215
|
-
{...fieldStyles}
|
|
216
|
-
{...props}
|
|
217
|
-
value={selected}
|
|
218
|
-
onChange={handleChange}
|
|
219
|
-
/>
|
|
220
|
-
</FieldWrapper>
|
|
221
|
-
<FieldIcons>
|
|
222
|
-
{hide ? (
|
|
223
|
-
<ArrowDownSvg size={IconSizes[size]} color={IconColor} style={styles['icon']} />
|
|
224
|
-
) : (
|
|
225
|
-
<ArrowUpSvg size={IconSizes[size]} color={IconColor} style={styles['icon']} />
|
|
226
|
-
)}
|
|
227
|
-
</FieldIcons>
|
|
228
|
-
</FieldContent>
|
|
229
|
-
{!hide && <DropDown size={size} styles={styles} options={newOptions} callback={handleCallback} />}
|
|
230
|
-
</FieldContainer>
|
|
231
|
-
);
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
export default CountryPickerView;
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
### **Import**
|
|
2
|
-
|
|
3
|
-
```jsx static
|
|
4
|
-
import { CountryPicker } from "app-studio";
|
|
5
|
-
```
|
|
6
|
-
|
|
7
|
-
### **Default**
|
|
8
|
-
|
|
9
|
-
```jsx
|
|
10
|
-
<CountryPicker label="Country" placeholder="Select a country..." />
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
### **Disabled**
|
|
14
|
-
|
|
15
|
-
“**_isDisabled_**” makes the field unusable.
|
|
16
|
-
|
|
17
|
-
```tsx
|
|
18
|
-
<CountryPicker isDisabled />
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
### **Read Only**
|
|
22
|
-
|
|
23
|
-
“**_isReadOnly_**” makes the field readable but not writable. Can only read the element.
|
|
24
|
-
|
|
25
|
-
```tsx
|
|
26
|
-
<CountryPicker isReadOnly />
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### **Size**
|
|
30
|
-
|
|
31
|
-
“**_size_**” changes the text and icon size . It has a default value of “md”.
|
|
32
|
-
|
|
33
|
-
```tsx
|
|
34
|
-
import { Vertical } from "../../Layout/Vertical/Vertical";
|
|
35
|
-
|
|
36
|
-
<Vertical gap={10}>
|
|
37
|
-
<CountryPicker name="xs" size="xs" label="xs" />
|
|
38
|
-
<CountryPicker name="sm" size="sm" label="sm" />
|
|
39
|
-
<CountryPicker name="md" size="md" label="md" />
|
|
40
|
-
<CountryPicker name="lg" size="lg" label="lg" />
|
|
41
|
-
<CountryPicker name="xl" size="xl" label="xl" />
|
|
42
|
-
</Vertical>;
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### **Shape**
|
|
46
|
-
|
|
47
|
-
“**_shape_**” changes the appearance of the borders.
|
|
48
|
-
|
|
49
|
-
```tsx
|
|
50
|
-
import { Vertical } from "../../Layout/Vertical/Vertical";
|
|
51
|
-
|
|
52
|
-
<Vertical gap={10}>
|
|
53
|
-
{["default", "sharp", "rounded", "pillShaped"].map((shape) => (
|
|
54
|
-
<CountryPicker
|
|
55
|
-
key={shape}
|
|
56
|
-
shape={shape}
|
|
57
|
-
placeholder="Select a country..."
|
|
58
|
-
/>
|
|
59
|
-
))}
|
|
60
|
-
</Vertical>;
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### **Variant**
|
|
64
|
-
|
|
65
|
-
“**_variant_**” modifies the layout or design of the component.
|
|
66
|
-
|
|
67
|
-
```tsx
|
|
68
|
-
import { Vertical } from "../../Layout/Vertical/Vertical";
|
|
69
|
-
|
|
70
|
-
<Vertical gap={10}>
|
|
71
|
-
{["outline", "default", "unStyled"].map((variant) => (
|
|
72
|
-
<CountryPicker
|
|
73
|
-
key={variant}
|
|
74
|
-
variant={variant}
|
|
75
|
-
label={variant}
|
|
76
|
-
placeholder="Select a country..."
|
|
77
|
-
/>
|
|
78
|
-
))}
|
|
79
|
-
</Vertical>;
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### **ColorScheme**
|
|
83
|
-
|
|
84
|
-
“**_colorScheme_**” modifies the label and border color of the field.
|
|
85
|
-
|
|
86
|
-
```jsx
|
|
87
|
-
import { Vertical } from "../../Layout/Vertical/Vertical";
|
|
88
|
-
|
|
89
|
-
<Vertical gap={15}>
|
|
90
|
-
{["theme.primary", "theme.secondary", "theme.error", "theme.success", "theme.warning"].map((color) => (
|
|
91
|
-
<CountryPicker key={color} label={color} colorScheme={color} />
|
|
92
|
-
))}
|
|
93
|
-
</Vertical>;
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### **Shadow**
|
|
97
|
-
|
|
98
|
-
“**_shadow_**” adds a shadow effect to the field.
|
|
99
|
-
|
|
100
|
-
```tsx
|
|
101
|
-
<CountryPicker shadow={{ boxShadow: "rgba(0, 0, 0, 0.20) 0px 3px 8px" }} />
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### **HelperText**
|
|
105
|
-
|
|
106
|
-
“**_helperText_**” provides additional information about the field.
|
|
107
|
-
|
|
108
|
-
```tsx
|
|
109
|
-
<CountryPicker helperText="CountryPicker one item!" error />
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### **Styles**
|
|
113
|
-
|
|
114
|
-
“**_styles_**” changes the style of the field.
|
|
115
|
-
|
|
116
|
-
```jsx
|
|
117
|
-
<CountryPicker
|
|
118
|
-
styles={{
|
|
119
|
-
box: {
|
|
120
|
-
borderRadius: 10,
|
|
121
|
-
borderColor: 'theme.primary',
|
|
122
|
-
borderStyle: 'solid',
|
|
123
|
-
borderWidth: 1
|
|
124
|
-
},
|
|
125
|
-
text: { color: "theme.primary" },
|
|
126
|
-
label: { fontWeight: "bold", color: "theme.primary" },
|
|
127
|
-
dropDown: { color: "theme.primary" },
|
|
128
|
-
}}
|
|
129
|
-
error
|
|
130
|
-
/>
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
```jsx static
|
|
134
|
-
const Shapes: Record<Shape, number | string> = {
|
|
135
|
-
default: "6px 6px 0 0",
|
|
136
|
-
sharp: 0,
|
|
137
|
-
rounded: 4,
|
|
138
|
-
pillShaped: 24,
|
|
139
|
-
};
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
## Types
|
|
143
|
-
|
|
144
|
-
```tsx static
|
|
145
|
-
type Size = "xs" | "sm" | "md" | "lg" | "xl";
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
```jsx static
|
|
149
|
-
type CountryPickerStyles = {
|
|
150
|
-
text?: CSSProperties,
|
|
151
|
-
icon?: CSSProperties,
|
|
152
|
-
dropDown?: CSSProperties,
|
|
153
|
-
box?: CSSProperties,
|
|
154
|
-
label?: CSSProperties,
|
|
155
|
-
helperText?: CSSProperties,
|
|
156
|
-
};
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
```jsx static
|
|
160
|
-
type Shape = "default" | "sharp" | "rounded" | "pillShaped";
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
```jsx static
|
|
164
|
-
type Country = {
|
|
165
|
-
name: string,
|
|
166
|
-
dial_code: string,
|
|
167
|
-
emoji: string,
|
|
168
|
-
code: string,
|
|
169
|
-
};
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
```js static
|
|
173
|
-
type Variant = "default" | "outline" | "unStyled";
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
```jsx static
|
|
177
|
-
type Styles = {
|
|
178
|
-
box?: CSSProperties,
|
|
179
|
-
text?: CSSProperties,
|
|
180
|
-
label?: CSSProperties,
|
|
181
|
-
helperText?: CSSProperties,
|
|
182
|
-
field?: CSSProperties,ssss
|
|
183
|
-
};
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
## Default Values
|
|
187
|
-
|
|
188
|
-
```jsx static
|
|
189
|
-
const LabelSizes: Record<Size, number> = {
|
|
190
|
-
xs: 8,
|
|
191
|
-
sm: 10,
|
|
192
|
-
md: 12,
|
|
193
|
-
lg: 14,
|
|
194
|
-
xl: 16,
|
|
195
|
-
};
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
```jsx static
|
|
199
|
-
const IconSizes: Record<Size, string> = {
|
|
200
|
-
xs: "8px",
|
|
201
|
-
sm: "10px",
|
|
202
|
-
md: "12px",
|
|
203
|
-
lg: "14px",
|
|
204
|
-
xl: "16px",
|
|
205
|
-
};
|
|
206
|
-
```
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { CountryPickerProps } from './CountryPicker/CountryPicker.props';
|
|
4
|
-
import { useCountryPickerState } from './CountryPicker/CountryPicker.state';
|
|
5
|
-
import CountryPickerView from './CountryPicker/CountryPicker.view';
|
|
6
|
-
|
|
7
|
-
const CountryPickerComponent: React.FC<CountryPickerProps> = (props) => {
|
|
8
|
-
const countryPickerStates = useCountryPickerState(props);
|
|
9
|
-
|
|
10
|
-
return <CountryPickerView {...countryPickerStates} {...props} />;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Country picker allows users to select a country from a dropdown list or search field.
|
|
15
|
-
*/
|
|
16
|
-
export const CountryPicker = CountryPickerComponent;
|