@elliemae/ds-props-helpers 2.3.0-next.5 → 2.3.0-next.9

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.
@@ -9,7 +9,8 @@ require('core-js/modules/web.dom-collections.iterator.js');
9
9
  /* eslint-disable max-lines */
10
10
  const ariaAttributes = ['aria-activedescendant', 'aria-atomic', 'aria-autocomplete', 'aria-busy', 'aria-checked', 'aria-colcount', 'aria-colindex', 'aria-colspan', 'aria-controls', 'aria-current', 'aria-describedby', 'aria-details', 'aria-disabled', 'aria-dropeffect', 'aria-errormessage', 'aria-expanded', 'aria-flowto', 'aria-grabbed', 'aria-haspopup', 'aria-hidden', 'aria-invalid', 'aria-keyshortcuts', 'aria-label', 'aria-labelledby', 'aria-level', 'aria-live', 'aria-modal', 'aria-multiline', 'aria-multiselectable', 'aria-orientation', 'aria-owns', 'aria-placeholder', 'aria-posinset', 'aria-pressed', 'aria-readonly', 'aria-relevant', 'aria-required', 'aria-roledescription', 'aria-rowcount', 'aria-rowindex', 'aria-rowspan', 'aria-selected', 'aria-setsize', 'aria-sort', 'aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext'];
11
11
  const domAttributes = ['onCopy', 'onCopyCapture', 'onCut', 'onCutCapture', 'onPaste', 'onPasteCapture', 'onCompositionEnd', 'onCompositionEndCapture', 'onCompositionStart', 'onCompositionStartCapture', 'onCompositionUpdate', 'onCompositionUpdateCapture', 'onFocus', 'onFocusCapture', 'onBlur', 'onBlurCapture', 'onChange', 'onChangeCapture', 'onBeforeInput', 'onBeforeInputCapture', 'onInput', 'onInputCapture', 'onReset', 'onResetCapture', 'onSubmit', 'onSubmitCapture', 'onInvalid', 'onInvalidCapture', 'onLoad', 'onLoadCapture', 'onError', 'onErrorCapture', 'onKeyDown', 'onKeyDownCapture', 'onKeyPress', 'onKeyPressCapture', 'onKeyUp', 'onKeyUpCapture', 'onAbort', 'onAbortCapture', 'onCanPlay', 'onCanPlayCapture', 'onCanPlayThrough', 'onCanPlayThroughCapture', 'onDurationChange', 'onDurationChangeCapture', 'onEmptied', 'onEmptiedCapture', 'onEncrypted', 'onEncryptedCapture', 'onEnded', 'onEndedCapture', 'onLoadedData', 'onLoadedDataCapture', 'onLoadedMetadata', 'onLoadedMetadataCapture', 'onLoadStart', 'onLoadStartCapture', 'onPause', 'onPauseCapture', 'onPlay', 'onPlayCapture', 'onPlaying', 'onPlayingCapture', 'onProgress', 'onProgressCapture', 'onRateChange', 'onRateChangeCapture', 'onSeeked', 'onSeekedCapture', 'onSeeking', 'onSeekingCapture', 'onStalled', 'onStalledCapture', 'onSuspend', 'onSuspendCapture', 'onTimeUpdate', 'onTimeUpdateCapture', 'onVolumeChange', 'onVolumeChangeCapture', 'onWaiting', 'onWaitingCapture', 'onAuxClick', 'onAuxClickCapture', 'onClick', 'onClickCapture', 'onContextMenu', 'onContextMenuCapture', 'onDoubleClick', 'onDoubleClickCapture', 'onDrag', 'onDragCapture', 'onDragEnd', 'onDragEndCapture', 'onDragEnter', 'onDragEnterCapture', 'onDragExit', 'onDragExitCapture', 'onDragLeave', 'onDragLeaveCapture', 'onDragOver', 'onDragOverCapture', 'onDragStart', 'onDragStartCapture', 'onDrop', 'onDropCapture', 'onMouseDown', 'onMouseDownCapture', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseMoveCapture', 'onMouseOut', 'onMouseOutCapture', 'onMouseOver', 'onMouseOverCapture', 'onMouseUp', 'onMouseUpCapture', 'onSelect', 'onSelectCapture', 'onTouchCancel', 'onTouchCancelCapture', 'onTouchEnd', 'onTouchEndCapture', 'onTouchMove', 'onTouchMoveCapture', 'onTouchStart', 'onTouchStartCapture', 'onPointerDown', 'onPointerDownCapture', 'onPointerMove', 'onPointerMoveCapture', 'onPointerUp', 'onPointerUpCapture', 'onPointerCancel', 'onPointerCancelCapture', 'onPointerEnter', 'onPointerEnterCapture', 'onPointerLeave', 'onPointerLeaveCapture', 'onPointerOver', 'onPointerOverCapture', 'onPointerOut', 'onPointerOutCapture', 'onGotPointerCapture', 'onGotPointerCaptureCapture', 'onLostPointerCapture', 'onLostPointerCaptureCapture', 'onScroll', 'onScrollCapture', 'onWheel', 'onWheelCapture', 'onAnimationStart', 'onAnimationStartCapture', 'onAnimationEnd', 'onAnimationEndCapture', 'onAnimationIteration', 'onAnimationIterationCapture', 'onTransitionEnd', 'onTransitionEndCapture'];
12
- const htmlAttributes = ['about', 'accept', 'acceptCharset', 'accessKey', 'action', 'allowFullScreen', 'allowTransparency', 'alt', 'as', 'async', 'autoCapitalize', 'autoComplete', 'autoCorrect', 'autoFocus', 'autoPlay', 'autoSave', 'capture', 'cellPadding', 'cellSpacing', 'challenge', 'charSet', 'checked', 'cite', 'classID', 'className', 'color', 'cols', 'colSpan', 'content', 'contentEditable', 'contextMenu', 'controls', 'coords', 'crossOrigin', 'data', 'datatype', 'dateTime', 'default', 'defaultChecked', 'defaultValue', 'defer', 'dir', 'disabled', 'download', 'draggable', 'encType', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'frameBorder', 'headers', 'height', 'hidden', 'high', 'href', 'hrefLang', 'htmlFor', 'httpEquiv', 'id', 'inlist', 'inputMode', 'integrity', 'is', 'itemID', 'itemProp', 'itemRef', 'itemScope', 'itemType', 'keyParams', 'keyType', 'kind', 'label', 'lang', 'list', 'loop', 'low', 'manifest', 'marginHeight', 'marginWidth', 'max', 'maxLength', 'media', 'mediaGroup', 'method', 'min', 'minLength', 'multiple', 'muted', 'name', 'nonce', 'noValidate', 'open', 'optimum', 'pattern', 'placeholder', 'playsInline', 'poster', 'prefix', 'preload', 'property', 'radioGroup', 'readOnly', 'rel', 'required', 'resource', 'results', 'reversed', 'role', 'rows', 'rowSpan', 'sandbox', 'scope', 'scoped', 'scrolling', 'seamless', 'security', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'spellCheck', 'src', 'srcDoc', 'srcLang', 'srcSet', 'start', 'step', 'style', 'summary', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'tabIndex', 'target', 'title', 'translate', 'type', 'typeof', 'unselectable', 'useMap', 'value', 'vocab', 'width', 'wmode', 'wrap'];
12
+ const htmlAttributes = ['about', 'accept', 'acceptCharset', 'accessKey', 'action', 'allowFullScreen', 'allowTransparency', 'alt', // 'as', This property causes trouble in TS. This is actually not an HTML Attribute, leaving it here for the record
13
+ 'async', 'autoCapitalize', 'autoComplete', 'autoCorrect', 'autoFocus', 'autoPlay', 'autoSave', 'capture', 'cellPadding', 'cellSpacing', 'challenge', 'charSet', 'checked', 'cite', 'classID', 'className', 'color', 'cols', 'colSpan', 'content', 'contentEditable', 'contextMenu', 'controls', 'coords', 'crossOrigin', 'data', 'datatype', 'dateTime', 'default', 'defaultChecked', 'defaultValue', 'defer', 'dir', 'disabled', 'download', 'draggable', 'encType', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'frameBorder', 'headers', 'height', 'hidden', 'high', 'href', 'hrefLang', 'htmlFor', 'httpEquiv', 'id', 'inlist', 'inputMode', 'integrity', 'is', 'itemID', 'itemProp', 'itemRef', 'itemScope', 'itemType', 'keyParams', 'keyType', 'kind', 'label', 'lang', 'list', 'loop', 'low', 'manifest', 'marginHeight', 'marginWidth', 'max', 'maxLength', 'media', 'mediaGroup', 'method', 'min', 'minLength', 'multiple', 'muted', 'name', 'nonce', 'noValidate', 'open', 'optimum', 'pattern', 'placeholder', 'playsInline', 'poster', 'prefix', 'preload', 'property', 'radioGroup', 'readOnly', 'rel', 'required', 'resource', 'results', 'reversed', 'role', 'rows', 'rowSpan', 'sandbox', 'scope', 'scoped', 'scrolling', 'seamless', 'security', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'spellCheck', 'src', 'srcDoc', 'srcLang', 'srcSet', 'start', 'step', 'style', 'summary', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'tabIndex', 'target', 'title', 'translate', 'type', 'typeof', 'unselectable', 'useMap', 'value', 'vocab', 'width', 'wmode', 'wrap'];
13
14
  const globalAttributes = Object.fromEntries([...ariaAttributes, ...domAttributes, ...htmlAttributes].map(entry => [entry, true]));
14
15
 
15
16
  exports.globalAttributes = globalAttributes;
@@ -24,6 +24,7 @@ const useGetGlobalAttributes = (props, overrides) => {
24
24
 
25
25
  globalAttributesObject[key] = newFunc;
26
26
  } else {
27
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
27
28
  globalAttributesObject[key] = value;
28
29
  }
29
30
  }
package/cjs/index.js CHANGED
@@ -3,26 +3,30 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var useMemoMergePropsWithDefault = require('./defaultProps/useMemoMergePropsWithDefault.js');
6
- var validator = require('./validation/validator.js');
7
- var errorTemplates = require('./validation/errorTemplates.js');
8
- var typescriptValidator = require('./validation/typescriptValidator.js');
9
6
  var index = require('./getProps/index.js');
10
7
  var useGetGlobalAttributes = require('./globalProps/useGetGlobalAttributes.js');
11
8
  var globalAttributesPropTypes = require('./globalProps/globalAttributesPropTypes.js');
12
9
  var PropTypes = require('./propTypes/PropTypes.js');
13
10
  var describe = require('./propTypes/describe.js');
11
+ var validator = require('./validation/validator.js');
12
+ var errorTemplates = require('./validation/errorTemplates.js');
13
+ var typescriptValidator = require('./validation/typescriptValidator.js');
14
+ var useGetXstyledProps = require('./xstyledProps/useGetXstyledProps.js');
15
+ var xstyledPropTypes = require('./xstyledProps/xstyledPropTypes.js');
14
16
 
15
17
 
16
18
 
17
19
  exports.useMemoMergePropsWithDefault = useMemoMergePropsWithDefault.useMemoMergePropsWithDefault;
18
- exports.useValidatePropTypes = validator.useValidatePropTypes;
19
- exports.throwRequiredError = errorTemplates.throwRequiredError;
20
- exports.throwTypeError = errorTemplates.throwTypeError;
21
- exports.useValidateTypescriptPropTypes = typescriptValidator.useValidateTypescriptPropTypes;
22
- exports.validateTypescriptPropTypesImplementation = typescriptValidator.validateTypescriptPropTypesImplementation;
23
20
  exports.getAriaProps = index.getAriaProps;
24
21
  exports.getDataProps = index.getDataProps;
25
22
  exports.useGetGlobalAttributes = useGetGlobalAttributes.useGetGlobalAttributes;
26
23
  exports.globalAttributesPropTypes = globalAttributesPropTypes.globalAttributesPropTypes;
27
24
  exports.PropTypes = PropTypes;
28
25
  exports.describe = describe;
26
+ exports.useValidatePropTypes = validator.useValidatePropTypes;
27
+ exports.throwRequiredError = errorTemplates.throwRequiredError;
28
+ exports.throwTypeError = errorTemplates.throwTypeError;
29
+ exports.useValidateTypescriptPropTypes = typescriptValidator.useValidateTypescriptPropTypes;
30
+ exports.validateTypescriptPropTypesImplementation = typescriptValidator.validateTypescriptPropTypesImplementation;
31
+ exports.useGetXstyledProps = useGetXstyledProps.useGetXstyledProps;
32
+ exports.xstyledPropTypes = xstyledPropTypes.xstyledPropTypes;
@@ -21,7 +21,7 @@ const addPropTypeDocumentationField = fieldName => function addFieldToReactDesc(
21
21
  }
22
22
 
23
23
  let realValue = value;
24
- if (fieldName === 'global' || fieldName === 'hidden') realValue = true;
24
+ if (fieldName === 'global' || fieldName === 'hidden' || fieldName === 'xstyled') realValue = true;
25
25
  this.reactDesc[fieldName] = realValue;
26
26
  return this;
27
27
  };
@@ -32,7 +32,8 @@ const documentedPropType = {
32
32
  deprecated: addPropTypeDocumentationField('deprecated'),
33
33
  format: addPropTypeDocumentationField('format'),
34
34
  global: addPropTypeDocumentationField('global'),
35
- hidden: addPropTypeDocumentationField('hidden')
35
+ hidden: addPropTypeDocumentationField('hidden'),
36
+ xstyled: addPropTypeDocumentationField('hidden')
36
37
  };
37
38
 
38
39
  const createPropType = type => {
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('core-js/modules/web.dom-collections.iterator.js');
6
+ require('core-js/modules/esnext.async-iterator.map.js');
7
+ require('core-js/modules/esnext.iterator.map.js');
8
+
9
+ const marginKeys = ['margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'm', 'mt', 'mr', 'mb', 'ml', 'mx', 'my'];
10
+ const paddingKeys = ['padding', 'p', 'paddingTop', 'pt', 'paddingRight', 'pr', 'paddingBottom', 'pb', 'paddingLeft', 'pl', 'px', 'py'];
11
+ const spaceKeys = ['spaceY', 'spaceX', 'spaceXReverse', 'spaceYReverse'];
12
+ const widthKeys = ['w', 'maxWidth', 'maxW', 'minWidth', 'minW'];
13
+ const heightKeys = ['h', 'maxHeight', 'maxH', 'minHeight', 'minH'];
14
+ const maskSizeKeys = ['maskSize'];
15
+ const spacingKeys = [...marginKeys, ...paddingKeys, ...spaceKeys];
16
+ const sizingKeys = [...widthKeys, ...heightKeys, ...maskSizeKeys];
17
+ const layoutKeys = ['display', 'float', 'boxSizing', 'container', 'overflow', 'overflowX', 'overflowY', 'zIndex', 'position', 'top', 'right', 'bottom', 'left', 'visibility', 'overscrollBehavior', 'objectFit'];
18
+ const xstyledKeys = Object.fromEntries([...spacingKeys, ...sizingKeys, ...layoutKeys].map(item => [item, true]));
19
+
20
+ exports.layoutKeys = layoutKeys;
21
+ exports.xstyledKeys = xstyledKeys;
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var useGetXstyledProps = require('./useGetXstyledProps.js');
6
+ var xstyledPropTypes = require('./xstyledPropTypes.js');
7
+
8
+
9
+
10
+ exports.useGetXstyledProps = useGetXstyledProps.useGetXstyledProps;
11
+ exports.xstyledPropTypes = xstyledPropTypes.xstyledPropTypes;
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('core-js/modules/esnext.async-iterator.for-each.js');
6
+ require('core-js/modules/esnext.iterator.constructor.js');
7
+ require('core-js/modules/esnext.iterator.for-each.js');
8
+ require('core-js/modules/web.dom-collections.iterator.js');
9
+ var react = require('react');
10
+ var constants = require('./constants.js');
11
+
12
+ const useGetXstyledProps = props => {
13
+ const componentXstyledProps = react.useMemo(() => {
14
+ const xstyledPropsObject = {};
15
+ Object.entries(props).forEach(_ref => {
16
+ let [key, value] = _ref;
17
+
18
+ if (key in constants.xstyledKeys) {
19
+ xstyledPropsObject[key] = value;
20
+ }
21
+ });
22
+ return xstyledPropsObject;
23
+ }, [props]);
24
+ return componentXstyledProps;
25
+ };
26
+
27
+ exports.useGetXstyledProps = useGetXstyledProps;
@@ -0,0 +1,75 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var PropTypes = require('../propTypes/PropTypes.js');
6
+ require('core-js/modules/esnext.async-iterator.for-each.js');
7
+ require('core-js/modules/esnext.iterator.constructor.js');
8
+ require('core-js/modules/esnext.iterator.for-each.js');
9
+ require('core-js/modules/web.dom-collections.iterator.js');
10
+ require('core-js/modules/esnext.async-iterator.map.js');
11
+ require('core-js/modules/esnext.iterator.map.js');
12
+ require('prop-types');
13
+ require('@babel/runtime/helpers/defineProperty');
14
+ require('core-js/modules/esnext.async-iterator.filter.js');
15
+ require('core-js/modules/esnext.iterator.filter.js');
16
+
17
+ const xstyledPropTypes = {
18
+ margin: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
19
+ m: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
20
+ marginTop: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
21
+ mt: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
22
+ marginRight: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
23
+ mr: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
24
+ marginBottom: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
25
+ mb: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
26
+ marginLeft: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
27
+ ml: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
28
+ mx: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
29
+ my: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
30
+ padding: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
31
+ p: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
32
+ paddingTop: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
33
+ pt: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
34
+ paddingRight: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
35
+ pr: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
36
+ paddingBottom: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
37
+ pb: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
38
+ paddingLeft: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
39
+ pl: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
40
+ px: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
41
+ py: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
42
+ spaceY: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
43
+ spaceX: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
44
+ spaceXReverse: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
45
+ spaceYReverse: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
46
+ w: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
47
+ maxWidth: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
48
+ maxW: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
49
+ minWidth: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
50
+ minW: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
51
+ h: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
52
+ maxHeight: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
53
+ maxH: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
54
+ minHeight: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
55
+ minH: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
56
+ maskSize: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
57
+ display: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
58
+ float: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
59
+ boxSizing: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
60
+ container: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
61
+ overflow: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
62
+ overflowX: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
63
+ overflowY: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
64
+ zIndex: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
65
+ position: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
66
+ top: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
67
+ right: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
68
+ bottom: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
69
+ left: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
70
+ visibility: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
71
+ overscrollBehavior: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
72
+ objectFit: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled()
73
+ };
74
+
75
+ exports.xstyledPropTypes = xstyledPropTypes;
@@ -5,7 +5,8 @@ import 'core-js/modules/web.dom-collections.iterator.js';
5
5
  /* eslint-disable max-lines */
6
6
  const ariaAttributes = ['aria-activedescendant', 'aria-atomic', 'aria-autocomplete', 'aria-busy', 'aria-checked', 'aria-colcount', 'aria-colindex', 'aria-colspan', 'aria-controls', 'aria-current', 'aria-describedby', 'aria-details', 'aria-disabled', 'aria-dropeffect', 'aria-errormessage', 'aria-expanded', 'aria-flowto', 'aria-grabbed', 'aria-haspopup', 'aria-hidden', 'aria-invalid', 'aria-keyshortcuts', 'aria-label', 'aria-labelledby', 'aria-level', 'aria-live', 'aria-modal', 'aria-multiline', 'aria-multiselectable', 'aria-orientation', 'aria-owns', 'aria-placeholder', 'aria-posinset', 'aria-pressed', 'aria-readonly', 'aria-relevant', 'aria-required', 'aria-roledescription', 'aria-rowcount', 'aria-rowindex', 'aria-rowspan', 'aria-selected', 'aria-setsize', 'aria-sort', 'aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext'];
7
7
  const domAttributes = ['onCopy', 'onCopyCapture', 'onCut', 'onCutCapture', 'onPaste', 'onPasteCapture', 'onCompositionEnd', 'onCompositionEndCapture', 'onCompositionStart', 'onCompositionStartCapture', 'onCompositionUpdate', 'onCompositionUpdateCapture', 'onFocus', 'onFocusCapture', 'onBlur', 'onBlurCapture', 'onChange', 'onChangeCapture', 'onBeforeInput', 'onBeforeInputCapture', 'onInput', 'onInputCapture', 'onReset', 'onResetCapture', 'onSubmit', 'onSubmitCapture', 'onInvalid', 'onInvalidCapture', 'onLoad', 'onLoadCapture', 'onError', 'onErrorCapture', 'onKeyDown', 'onKeyDownCapture', 'onKeyPress', 'onKeyPressCapture', 'onKeyUp', 'onKeyUpCapture', 'onAbort', 'onAbortCapture', 'onCanPlay', 'onCanPlayCapture', 'onCanPlayThrough', 'onCanPlayThroughCapture', 'onDurationChange', 'onDurationChangeCapture', 'onEmptied', 'onEmptiedCapture', 'onEncrypted', 'onEncryptedCapture', 'onEnded', 'onEndedCapture', 'onLoadedData', 'onLoadedDataCapture', 'onLoadedMetadata', 'onLoadedMetadataCapture', 'onLoadStart', 'onLoadStartCapture', 'onPause', 'onPauseCapture', 'onPlay', 'onPlayCapture', 'onPlaying', 'onPlayingCapture', 'onProgress', 'onProgressCapture', 'onRateChange', 'onRateChangeCapture', 'onSeeked', 'onSeekedCapture', 'onSeeking', 'onSeekingCapture', 'onStalled', 'onStalledCapture', 'onSuspend', 'onSuspendCapture', 'onTimeUpdate', 'onTimeUpdateCapture', 'onVolumeChange', 'onVolumeChangeCapture', 'onWaiting', 'onWaitingCapture', 'onAuxClick', 'onAuxClickCapture', 'onClick', 'onClickCapture', 'onContextMenu', 'onContextMenuCapture', 'onDoubleClick', 'onDoubleClickCapture', 'onDrag', 'onDragCapture', 'onDragEnd', 'onDragEndCapture', 'onDragEnter', 'onDragEnterCapture', 'onDragExit', 'onDragExitCapture', 'onDragLeave', 'onDragLeaveCapture', 'onDragOver', 'onDragOverCapture', 'onDragStart', 'onDragStartCapture', 'onDrop', 'onDropCapture', 'onMouseDown', 'onMouseDownCapture', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseMoveCapture', 'onMouseOut', 'onMouseOutCapture', 'onMouseOver', 'onMouseOverCapture', 'onMouseUp', 'onMouseUpCapture', 'onSelect', 'onSelectCapture', 'onTouchCancel', 'onTouchCancelCapture', 'onTouchEnd', 'onTouchEndCapture', 'onTouchMove', 'onTouchMoveCapture', 'onTouchStart', 'onTouchStartCapture', 'onPointerDown', 'onPointerDownCapture', 'onPointerMove', 'onPointerMoveCapture', 'onPointerUp', 'onPointerUpCapture', 'onPointerCancel', 'onPointerCancelCapture', 'onPointerEnter', 'onPointerEnterCapture', 'onPointerLeave', 'onPointerLeaveCapture', 'onPointerOver', 'onPointerOverCapture', 'onPointerOut', 'onPointerOutCapture', 'onGotPointerCapture', 'onGotPointerCaptureCapture', 'onLostPointerCapture', 'onLostPointerCaptureCapture', 'onScroll', 'onScrollCapture', 'onWheel', 'onWheelCapture', 'onAnimationStart', 'onAnimationStartCapture', 'onAnimationEnd', 'onAnimationEndCapture', 'onAnimationIteration', 'onAnimationIterationCapture', 'onTransitionEnd', 'onTransitionEndCapture'];
8
- const htmlAttributes = ['about', 'accept', 'acceptCharset', 'accessKey', 'action', 'allowFullScreen', 'allowTransparency', 'alt', 'as', 'async', 'autoCapitalize', 'autoComplete', 'autoCorrect', 'autoFocus', 'autoPlay', 'autoSave', 'capture', 'cellPadding', 'cellSpacing', 'challenge', 'charSet', 'checked', 'cite', 'classID', 'className', 'color', 'cols', 'colSpan', 'content', 'contentEditable', 'contextMenu', 'controls', 'coords', 'crossOrigin', 'data', 'datatype', 'dateTime', 'default', 'defaultChecked', 'defaultValue', 'defer', 'dir', 'disabled', 'download', 'draggable', 'encType', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'frameBorder', 'headers', 'height', 'hidden', 'high', 'href', 'hrefLang', 'htmlFor', 'httpEquiv', 'id', 'inlist', 'inputMode', 'integrity', 'is', 'itemID', 'itemProp', 'itemRef', 'itemScope', 'itemType', 'keyParams', 'keyType', 'kind', 'label', 'lang', 'list', 'loop', 'low', 'manifest', 'marginHeight', 'marginWidth', 'max', 'maxLength', 'media', 'mediaGroup', 'method', 'min', 'minLength', 'multiple', 'muted', 'name', 'nonce', 'noValidate', 'open', 'optimum', 'pattern', 'placeholder', 'playsInline', 'poster', 'prefix', 'preload', 'property', 'radioGroup', 'readOnly', 'rel', 'required', 'resource', 'results', 'reversed', 'role', 'rows', 'rowSpan', 'sandbox', 'scope', 'scoped', 'scrolling', 'seamless', 'security', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'spellCheck', 'src', 'srcDoc', 'srcLang', 'srcSet', 'start', 'step', 'style', 'summary', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'tabIndex', 'target', 'title', 'translate', 'type', 'typeof', 'unselectable', 'useMap', 'value', 'vocab', 'width', 'wmode', 'wrap'];
8
+ const htmlAttributes = ['about', 'accept', 'acceptCharset', 'accessKey', 'action', 'allowFullScreen', 'allowTransparency', 'alt', // 'as', This property causes trouble in TS. This is actually not an HTML Attribute, leaving it here for the record
9
+ 'async', 'autoCapitalize', 'autoComplete', 'autoCorrect', 'autoFocus', 'autoPlay', 'autoSave', 'capture', 'cellPadding', 'cellSpacing', 'challenge', 'charSet', 'checked', 'cite', 'classID', 'className', 'color', 'cols', 'colSpan', 'content', 'contentEditable', 'contextMenu', 'controls', 'coords', 'crossOrigin', 'data', 'datatype', 'dateTime', 'default', 'defaultChecked', 'defaultValue', 'defer', 'dir', 'disabled', 'download', 'draggable', 'encType', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'frameBorder', 'headers', 'height', 'hidden', 'high', 'href', 'hrefLang', 'htmlFor', 'httpEquiv', 'id', 'inlist', 'inputMode', 'integrity', 'is', 'itemID', 'itemProp', 'itemRef', 'itemScope', 'itemType', 'keyParams', 'keyType', 'kind', 'label', 'lang', 'list', 'loop', 'low', 'manifest', 'marginHeight', 'marginWidth', 'max', 'maxLength', 'media', 'mediaGroup', 'method', 'min', 'minLength', 'multiple', 'muted', 'name', 'nonce', 'noValidate', 'open', 'optimum', 'pattern', 'placeholder', 'playsInline', 'poster', 'prefix', 'preload', 'property', 'radioGroup', 'readOnly', 'rel', 'required', 'resource', 'results', 'reversed', 'role', 'rows', 'rowSpan', 'sandbox', 'scope', 'scoped', 'scrolling', 'seamless', 'security', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'spellCheck', 'src', 'srcDoc', 'srcLang', 'srcSet', 'start', 'step', 'style', 'summary', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'tabIndex', 'target', 'title', 'translate', 'type', 'typeof', 'unselectable', 'useMap', 'value', 'vocab', 'width', 'wmode', 'wrap'];
9
10
  const globalAttributes = Object.fromEntries([...ariaAttributes, ...domAttributes, ...htmlAttributes].map(entry => [entry, true]));
10
11
 
11
12
  export { globalAttributes };
@@ -20,6 +20,7 @@ const useGetGlobalAttributes = (props, overrides) => {
20
20
 
21
21
  globalAttributesObject[key] = newFunc;
22
22
  } else {
23
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
23
24
  globalAttributesObject[key] = value;
24
25
  }
25
26
  }
package/esm/index.js CHANGED
@@ -1,9 +1,11 @@
1
1
  export { useMemoMergePropsWithDefault } from './defaultProps/useMemoMergePropsWithDefault.js';
2
- export { useValidatePropTypes } from './validation/validator.js';
3
- export { throwRequiredError, throwTypeError } from './validation/errorTemplates.js';
4
- export { useValidateTypescriptPropTypes, validateTypescriptPropTypesImplementation } from './validation/typescriptValidator.js';
5
2
  export { getAriaProps, getDataProps } from './getProps/index.js';
6
3
  export { useGetGlobalAttributes } from './globalProps/useGetGlobalAttributes.js';
7
4
  export { globalAttributesPropTypes } from './globalProps/globalAttributesPropTypes.js';
8
5
  export { default as PropTypes } from './propTypes/PropTypes.js';
9
6
  export { default as describe } from './propTypes/describe.js';
7
+ export { useValidatePropTypes } from './validation/validator.js';
8
+ export { throwRequiredError, throwTypeError } from './validation/errorTemplates.js';
9
+ export { useValidateTypescriptPropTypes, validateTypescriptPropTypesImplementation } from './validation/typescriptValidator.js';
10
+ export { useGetXstyledProps } from './xstyledProps/useGetXstyledProps.js';
11
+ export { xstyledPropTypes } from './xstyledProps/xstyledPropTypes.js';
@@ -15,7 +15,7 @@ const addPropTypeDocumentationField = fieldName => function addFieldToReactDesc(
15
15
  }
16
16
 
17
17
  let realValue = value;
18
- if (fieldName === 'global' || fieldName === 'hidden') realValue = true;
18
+ if (fieldName === 'global' || fieldName === 'hidden' || fieldName === 'xstyled') realValue = true;
19
19
  this.reactDesc[fieldName] = realValue;
20
20
  return this;
21
21
  };
@@ -26,7 +26,8 @@ const documentedPropType = {
26
26
  deprecated: addPropTypeDocumentationField('deprecated'),
27
27
  format: addPropTypeDocumentationField('format'),
28
28
  global: addPropTypeDocumentationField('global'),
29
- hidden: addPropTypeDocumentationField('hidden')
29
+ hidden: addPropTypeDocumentationField('hidden'),
30
+ xstyled: addPropTypeDocumentationField('hidden')
30
31
  };
31
32
 
32
33
  const createPropType = type => {
@@ -0,0 +1,16 @@
1
+ import 'core-js/modules/web.dom-collections.iterator.js';
2
+ import 'core-js/modules/esnext.async-iterator.map.js';
3
+ import 'core-js/modules/esnext.iterator.map.js';
4
+
5
+ const marginKeys = ['margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'm', 'mt', 'mr', 'mb', 'ml', 'mx', 'my'];
6
+ const paddingKeys = ['padding', 'p', 'paddingTop', 'pt', 'paddingRight', 'pr', 'paddingBottom', 'pb', 'paddingLeft', 'pl', 'px', 'py'];
7
+ const spaceKeys = ['spaceY', 'spaceX', 'spaceXReverse', 'spaceYReverse'];
8
+ const widthKeys = ['w', 'maxWidth', 'maxW', 'minWidth', 'minW'];
9
+ const heightKeys = ['h', 'maxHeight', 'maxH', 'minHeight', 'minH'];
10
+ const maskSizeKeys = ['maskSize'];
11
+ const spacingKeys = [...marginKeys, ...paddingKeys, ...spaceKeys];
12
+ const sizingKeys = [...widthKeys, ...heightKeys, ...maskSizeKeys];
13
+ const layoutKeys = ['display', 'float', 'boxSizing', 'container', 'overflow', 'overflowX', 'overflowY', 'zIndex', 'position', 'top', 'right', 'bottom', 'left', 'visibility', 'overscrollBehavior', 'objectFit'];
14
+ const xstyledKeys = Object.fromEntries([...spacingKeys, ...sizingKeys, ...layoutKeys].map(item => [item, true]));
15
+
16
+ export { layoutKeys, xstyledKeys };
@@ -0,0 +1,2 @@
1
+ export { useGetXstyledProps } from './useGetXstyledProps.js';
2
+ export { xstyledPropTypes } from './xstyledPropTypes.js';
@@ -0,0 +1,23 @@
1
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
2
+ import 'core-js/modules/esnext.iterator.constructor.js';
3
+ import 'core-js/modules/esnext.iterator.for-each.js';
4
+ import 'core-js/modules/web.dom-collections.iterator.js';
5
+ import { useMemo } from 'react';
6
+ import { xstyledKeys } from './constants.js';
7
+
8
+ const useGetXstyledProps = props => {
9
+ const componentXstyledProps = useMemo(() => {
10
+ const xstyledPropsObject = {};
11
+ Object.entries(props).forEach(_ref => {
12
+ let [key, value] = _ref;
13
+
14
+ if (key in xstyledKeys) {
15
+ xstyledPropsObject[key] = value;
16
+ }
17
+ });
18
+ return xstyledPropsObject;
19
+ }, [props]);
20
+ return componentXstyledProps;
21
+ };
22
+
23
+ export { useGetXstyledProps };
@@ -0,0 +1,71 @@
1
+ import PropTypes from '../propTypes/PropTypes.js';
2
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
3
+ import 'core-js/modules/esnext.iterator.constructor.js';
4
+ import 'core-js/modules/esnext.iterator.for-each.js';
5
+ import 'core-js/modules/web.dom-collections.iterator.js';
6
+ import 'core-js/modules/esnext.async-iterator.map.js';
7
+ import 'core-js/modules/esnext.iterator.map.js';
8
+ import 'prop-types';
9
+ import 'core-js/modules/esnext.async-iterator.filter.js';
10
+ import 'core-js/modules/esnext.iterator.filter.js';
11
+ import '@babel/runtime/helpers/esm/defineProperty';
12
+
13
+ const xstyledPropTypes = {
14
+ margin: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
15
+ m: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
16
+ marginTop: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
17
+ mt: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
18
+ marginRight: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
19
+ mr: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
20
+ marginBottom: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
21
+ mb: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
22
+ marginLeft: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
23
+ ml: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
24
+ mx: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
25
+ my: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
26
+ padding: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
27
+ p: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
28
+ paddingTop: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
29
+ pt: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
30
+ paddingRight: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
31
+ pr: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
32
+ paddingBottom: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
33
+ pb: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
34
+ paddingLeft: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
35
+ pl: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
36
+ px: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
37
+ py: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
38
+ spaceY: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
39
+ spaceX: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
40
+ spaceXReverse: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
41
+ spaceYReverse: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
42
+ w: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
43
+ maxWidth: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
44
+ maxW: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
45
+ minWidth: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
46
+ minW: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
47
+ h: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
48
+ maxHeight: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
49
+ maxH: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
50
+ minHeight: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
51
+ minH: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
52
+ maskSize: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
53
+ display: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
54
+ float: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
55
+ boxSizing: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
56
+ container: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
57
+ overflow: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
58
+ overflowX: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
59
+ overflowY: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
60
+ zIndex: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
61
+ position: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
62
+ top: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
63
+ right: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
64
+ bottom: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
65
+ left: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
66
+ visibility: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
67
+ overscrollBehavior: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled(),
68
+ objectFit: PropTypes.any.description('Applies to the root container. For more info read xstyled docs').xstyled()
69
+ };
70
+
71
+ export { xstyledPropTypes };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-props-helpers",
3
- "version": "2.3.0-next.5",
3
+ "version": "2.3.0-next.9",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Props Helpers",
6
6
  "module": "./esm/index.js",
@@ -11,6 +11,22 @@
11
11
  "import": "./esm/index.js",
12
12
  "require": "./cjs/index.js"
13
13
  },
14
+ "./xstyledProps/xstyledPropTypes": {
15
+ "import": "./esm/xstyledProps/xstyledPropTypes.js",
16
+ "require": "./cjs/xstyledProps/xstyledPropTypes.js"
17
+ },
18
+ "./xstyledProps/useGetXstyledProps": {
19
+ "import": "./esm/xstyledProps/useGetXstyledProps.js",
20
+ "require": "./cjs/xstyledProps/useGetXstyledProps.js"
21
+ },
22
+ "./xstyledProps": {
23
+ "import": "./esm/xstyledProps/index.js",
24
+ "require": "./cjs/xstyledProps/index.js"
25
+ },
26
+ "./xstyledProps/constants": {
27
+ "import": "./esm/xstyledProps/constants.js",
28
+ "require": "./cjs/xstyledProps/constants.js"
29
+ },
14
30
  "./validation/validator": {
15
31
  "import": "./esm/validation/validator.js",
16
32
  "require": "./cjs/validation/validator.js"
@@ -127,7 +143,8 @@
127
143
  "react-desc": "^4.1.3"
128
144
  },
129
145
  "devDependencies": {
130
- "@testing-library/jest-dom": "~5.15.0"
146
+ "@testing-library/jest-dom": "~5.15.0",
147
+ "@xstyled/styled-components": "~3.5.1"
131
148
  },
132
149
  "peerDependencies": {
133
150
  "react": "~17.0.2",