UNPKG

@zohodesk/components

Version:

Dot UI is a customizable React component library built to deliver a clean, accessible, and developer-friendly UI experience. It offers a growing set of reusable components designed to align with modern design systems and streamline application development

88 lines (87 loc) 4.17 kB
import PropTypes from 'prop-types'; // Define prop types once to avoid duplication const propTypeDefinitions = { shouldReset: PropTypes.bool, display: PropTypes.oneOf(['block', 'inlineBlock', 'inline', 'initial']), weight: PropTypes.oneOf(['regular', 'light', 'semibold', 'bold']), isDotted: PropTypes.bool, textAlign: PropTypes.oneOf(['left', 'right', 'center', 'justify']), transform: PropTypes.oneOf(['default', 'upper', 'lower', 'capital']), lineClamp: PropTypes.oneOf(['1', '2', '3', '4', '5']), typeFace: PropTypes.oneOf(['normal', 'italic']), decoration: PropTypes.oneOf(['default', 'underline', 'strike', 'overline']), size: PropTypes.oneOf(['7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '24', '25', '26', '28', '29', '30', '32', '34', '35', '36', '40', '50', 'inherit']), lineHeight: PropTypes.oneOf(['0', '0.1', '0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '1', '1.1', '1.2', '1.3', '1.4', '1.5', '1.6', '1.7', '1.8', '1.9', '2', 'normal', 'initial', 'inherit']), letterSpacing: PropTypes.oneOf(['0.1', '0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '1', '1.1', '1.2', '1.3', '1.4', '1.5', '1.6', '1.7', '1.8', '1.9', '2', 'inherit']), wordBreak: PropTypes.oneOf(['breakAll', 'keepAll', 'breakWord']), wordWrap: PropTypes.oneOf(['normal', 'break']), whiteSpace: PropTypes.oneOf(['normal', 'noWrap', 'pre', 'preLine', 'preWrap', 'breakSpaces']), customClass: PropTypes.string }; const typoStyleProps = { $flag_reset: propTypeDefinitions.shouldReset, shouldReset: propTypeDefinitions.shouldReset, $flag_dotted: propTypeDefinitions.isDotted, isDotted: propTypeDefinitions.isDotted, $ui_display: propTypeDefinitions.display, display: propTypeDefinitions.display, $ui_weight: propTypeDefinitions.weight, weight: propTypeDefinitions.weight, $ui_textAlign: propTypeDefinitions.textAlign, textAlign: propTypeDefinitions.textAlign, $ui_transform: propTypeDefinitions.transform, transform: propTypeDefinitions.transform, $ui_lineClamp: propTypeDefinitions.lineClamp, lineClamp: propTypeDefinitions.lineClamp, $ui_typeFace: propTypeDefinitions.typeFace, typeFace: propTypeDefinitions.typeFace, $ui_decoration: propTypeDefinitions.decoration, decoration: propTypeDefinitions.decoration, $ui_size: propTypeDefinitions.size, size: propTypeDefinitions.size, $ui_lineHeight: propTypeDefinitions.lineHeight, lineHeight: propTypeDefinitions.lineHeight, $ui_letterSpacing: propTypeDefinitions.letterSpacing, letterSpacing: propTypeDefinitions.letterSpacing, $ui_wordBreak: propTypeDefinitions.wordBreak, wordBreak: propTypeDefinitions.wordBreak, $ui_wordWrap: propTypeDefinitions.wordWrap, wordWrap: propTypeDefinitions.wordWrap, $ui_whiteSpace: propTypeDefinitions.whiteSpace, whiteSpace: propTypeDefinitions.whiteSpace, $ui_className: propTypeDefinitions.customClass, customClass: propTypeDefinitions.customClass }; const highlightProps = { customStyle: PropTypes.object, shouldExcludeIndices: PropTypes.bool, isCaseSensitive: PropTypes.bool, isWholeWord: PropTypes.bool, as: PropTypes.string, renderHighlight: PropTypes.oneOfType([PropTypes.func, PropTypes.node]), styleConfiguration: PropTypes.shape(typoStyleProps) }; const highlightDataItemShape = PropTypes.shape({ text: PropTypes.string, index: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number]), ...highlightProps }); const highlightConfigShape = PropTypes.shape({ data: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, highlightDataItemShape])), ...highlightProps }); export const propTypes = { ...typoStyleProps, children: PropTypes.node, $ui_tagName: PropTypes.string, as: PropTypes.string, $i18n_dataTitle: PropTypes.string, dataTitle: PropTypes.string, testId: PropTypes.string, customId: PropTypes.string, customStyle: PropTypes.object, $a11yAttributes_text: PropTypes.object, a11yAttributes: PropTypes.object, $tagAttributes_text: PropTypes.object, tagAttributes: PropTypes.object, $ui_highlightConfig: highlightConfigShape, highlightConfig: highlightConfigShape };