You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					61 lines
				
				1.7 KiB
			
		
		
			
		
	
	
					61 lines
				
				1.7 KiB
			| 
								 
											3 years ago
										 
									 | 
							
								"use strict";
							 | 
						||
| 
								 | 
							
								var __importDefault = (this && this.__importDefault) || function (mod) {
							 | 
						||
| 
								 | 
							
								    return (mod && mod.__esModule) ? mod : { "default": mod };
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								Object.defineProperty(exports, "__esModule", { value: true });
							 | 
						||
| 
								 | 
							
								exports.PhoneInput = void 0;
							 | 
						||
| 
								 | 
							
								const react_phone_input_2_1 = __importDefault(require("react-phone-input-2"));
							 | 
						||
| 
								 | 
							
								const styled_components_1 = __importDefault(require("styled-components"));
							 | 
						||
| 
								 | 
							
								const styled_system_1 = require("styled-system");
							 | 
						||
| 
								 | 
							
								const input_1 = require("../input");
							 | 
						||
| 
								 | 
							
								const phone_input_styles_1 = __importDefault(require("../../utils/phone-input.styles"));
							 | 
						||
| 
								 | 
							
								const css_class_1 = require("../../utils/css-class");
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @classdesc
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * Wrapped `phoneinput` html element.
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * ### Usage
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * ```ts
							 | 
						||
| 
								 | 
							
								 * import { PhoneInput, PhoneInputProps } from '@adminjs/design-system'
							 | 
						||
| 
								 | 
							
								 * ```
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * @component
							 | 
						||
| 
								 | 
							
								 * @subcategory Atoms
							 | 
						||
| 
								 | 
							
								 * @see {@link https://storybook.adminjs.co/?path=/story/designsystem-atoms-phoneinput--default Storybook}
							 | 
						||
| 
								 | 
							
								 * @see PhoneInputProps
							 | 
						||
| 
								 | 
							
								 * @hideconstructor
							 | 
						||
| 
								 | 
							
								 * @example
							 | 
						||
| 
								 | 
							
								 * return (
							 | 
						||
| 
								 | 
							
								 *   <Box p="xl">
							 | 
						||
| 
								 | 
							
								 *      <Label htmlFor="phoneinput1">Some example label</Label>
							 | 
						||
| 
								 | 
							
								 *      <PhoneInput id="phoneinput1" onChange={...} />;
							 | 
						||
| 
								 | 
							
								 *   </Box>
							 | 
						||
| 
								 | 
							
								 * )
							 | 
						||
| 
								 | 
							
								 * @section design-system
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								const PhoneInput = styled_components_1.default(react_phone_input_2_1.default) `
							 | 
						||
| 
								 | 
							
								  ${phone_input_styles_1.default}
							 | 
						||
| 
								 | 
							
								  width: 100%;
							 | 
						||
| 
								 | 
							
								  position: relative;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  & > input {
							 | 
						||
| 
								 | 
							
								    ${input_1.InputCSS}
							 | 
						||
| 
								 | 
							
								    ${styled_system_1.space}
							 | 
						||
| 
								 | 
							
								    ${styled_system_1.typography}
							 | 
						||
| 
								 | 
							
								    ${styled_system_1.layout}
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  .form-control, .flag-dropdown {
							 | 
						||
| 
								 | 
							
								    border-radius: 0;
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								`;
							 | 
						||
| 
								 | 
							
								exports.PhoneInput = PhoneInput;
							 | 
						||
| 
								 | 
							
								PhoneInput.defaultProps = {
							 | 
						||
| 
								 | 
							
								    px: 'default',
							 | 
						||
| 
								 | 
							
								    py: 'sm',
							 | 
						||
| 
								 | 
							
								    className: css_class_1.cssClass('PhoneInput'),
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								exports.default = PhoneInput;
							 |