@tamagui/static 1.0.1-beta.67 → 1.0.1-beta.70

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.
Files changed (37) hide show
  1. package/dist/cjs/extractor/createEvaluator.js +1 -1
  2. package/dist/cjs/extractor/createEvaluator.js.map +2 -2
  3. package/dist/cjs/extractor/createExtractor.js +227 -115
  4. package/dist/cjs/extractor/createExtractor.js.map +2 -2
  5. package/dist/cjs/extractor/extractToClassNames.js +16 -20
  6. package/dist/cjs/extractor/extractToClassNames.js.map +2 -2
  7. package/dist/cjs/patchReactNativeWeb.js +29 -89
  8. package/dist/cjs/patchReactNativeWeb.js.map +2 -2
  9. package/dist/cjs/types.js.map +1 -1
  10. package/dist/esm/extractor/createEvaluator.js +1 -1
  11. package/dist/esm/extractor/createEvaluator.js.map +2 -2
  12. package/dist/esm/extractor/createExtractor.js +232 -119
  13. package/dist/esm/extractor/createExtractor.js.map +2 -2
  14. package/dist/esm/extractor/extractToClassNames.js +16 -20
  15. package/dist/esm/extractor/extractToClassNames.js.map +2 -2
  16. package/dist/esm/patchReactNativeWeb.js +29 -89
  17. package/dist/esm/patchReactNativeWeb.js.map +2 -2
  18. package/dist/jsx/extractor/createEvaluator.js +1 -1
  19. package/dist/jsx/extractor/createExtractor.js +232 -119
  20. package/dist/jsx/extractor/extractToClassNames.js +16 -20
  21. package/dist/jsx/patchReactNativeWeb.js +29 -89
  22. package/package.json +18 -12
  23. package/patches/18/createDOMProps.cjs.js +385 -0
  24. package/patches/18/createDOMProps.js +379 -0
  25. package/src/extractor/createEvaluator.ts +2 -1
  26. package/src/extractor/createExtractor.ts +356 -161
  27. package/src/extractor/extractToClassNames.ts +20 -31
  28. package/src/patchReactNativeWeb.ts +47 -96
  29. package/src/types.ts +6 -8
  30. package/types/extractor/createEvaluator.d.ts +1 -1
  31. package/types/extractor/createEvaluator.d.ts.map +1 -1
  32. package/types/extractor/createExtractor.d.ts +2 -1
  33. package/types/extractor/createExtractor.d.ts.map +1 -1
  34. package/types/extractor/extractToClassNames.d.ts.map +1 -1
  35. package/types/patchReactNativeWeb.d.ts.map +1 -1
  36. package/types/types.d.ts +4 -7
  37. package/types/types.d.ts.map +1 -1
@@ -2,80 +2,56 @@ var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
  import path from "path";
4
4
  import * as fs from "fs-extra";
5
+ const PATCH_PREFIX = "tamagui-patch-";
6
+ const PATCH_VERSION = `${PATCH_PREFIX}-v5`;
7
+ const PATCH_COMMENT = `// ${PATCH_VERSION}`;
8
+ const PATCH_END_COMMENT = `// tamagui-patch-end`;
5
9
  function patchReactNativeWeb(dir = require.resolve("react-native-web")) {
6
10
  const rootDir = dir.replace(/[\/\\]dist.*/, "");
11
+ const pkgJSON = fs.readJSONSync(path.join(rootDir, "package.json"));
12
+ if (pkgJSON.version.split(".")[1] !== "18") {
13
+ console.error(`\u26D4\uFE0F Error! Tamagui as of beta 69 only works with react-native-web version 0.18.x`, pkgJSON.version);
14
+ process.exit(1);
15
+ }
7
16
  const modulePath = path.join(rootDir, "dist", "tamagui-exports.js");
8
17
  const cjsPath = path.join(rootDir, "dist", "cjs", "tamagui-exports.js");
9
- const shouldPatchExports = fs.existsSync(modulePath) && fs.readFileSync(modulePath, "utf-8") === moduleExports && fs.existsSync(cjsPath) && fs.readFileSync(cjsPath, "utf-8") === cjsExports;
10
- if (!shouldPatchExports) {
18
+ const alreadyPatchedImports = fs.existsSync(modulePath) && fs.readFileSync(modulePath, "utf-8") === moduleExports && fs.existsSync(cjsPath) && fs.readFileSync(cjsPath, "utf-8") === cjsExports;
19
+ if (!alreadyPatchedImports) {
11
20
  console.log(" | patch " + path.relative(rootDir, modulePath));
12
- console.log(" | patch " + path.relative(rootDir, cjsPath));
13
21
  fs.writeFileSync(modulePath, moduleExports);
22
+ console.log(" | patch " + path.relative(rootDir, cjsPath));
14
23
  fs.writeFileSync(cjsPath, cjsExports);
15
24
  }
16
- const patches = [
17
- {
18
- id: "dom-props",
19
- filePath: ["modules", "createDOMProps", "index.js"],
20
- replacee: ` if (dataSet != null) {`,
21
- replacer: `
22
- if (props.dataSet && props.dataSet.className) {
23
- const { className, ...dataSetRest } = props.dataSet
24
- classList = className
25
- dataSet = dataSetRest
26
- }
27
- if (props.dataSet && props.dataSet.id) {
28
- domProps['id'] = props.dataSet.id
29
- }
30
- if (dataSet != null) {`
31
- },
32
- {
33
- id: "forward-props",
34
- filePath: ["modules", "forwardedProps", "index.js"],
35
- replacee: `dataSet: true,`,
36
- replacer: `id: true, dataSet: true,`
37
- }
38
- ];
39
- for (const { filePath, replacee, replacer } of patches) {
40
- const files = [
41
- path.join(rootDir, "dist", ...filePath),
42
- path.join(rootDir, "dist", "cjs", ...filePath)
43
- ];
44
- for (const file of files) {
45
- const contents = fs.readFileSync(file, "utf-8");
46
- if (contents.includes(replacer)) {
47
- continue;
48
- }
49
- if (!contents.includes(replacee)) {
50
- console.warn(`\u26A0\uFE0F Error: couldn't apply className patch! Maybe using incompatible react-native-web version.`, {
51
- replacee,
52
- contents
53
- });
54
- continue;
55
- }
56
- console.log(" | patch " + path.relative(rootDir, file));
57
- fs.writeFileSync(file, contents.replace(replacee, replacer));
58
- }
25
+ const dpFile = path.join(rootDir, "dist", "modules", "createDOMProps", "index.js");
26
+ const dpPatched = fs.readFileSync(path.join(__dirname, "..", "..", "patches", "18", "createDOMProps.js"), "utf-8");
27
+ const dpFileCJS = path.join(rootDir, "dist", "cjs", "modules", "createDOMProps", "index.js");
28
+ const dpCJSPatched = fs.readFileSync(path.join(__dirname, "..", "..", "patches", "18", "createDOMProps.cjs.js"), "utf-8");
29
+ const alreadyPatchedDOMProps = fs.readFileSync(dpFile, "utf-8") === dpPatched && fs.readFileSync(dpFileCJS, "utf-8") === dpCJSPatched;
30
+ if (!alreadyPatchedDOMProps) {
31
+ console.log(" | patch " + path.relative(rootDir, dpFile));
32
+ fs.writeFileSync(dpFile, dpPatched);
33
+ console.log(" | patch " + path.relative(rootDir, dpFileCJS));
34
+ fs.writeFileSync(dpFileCJS, dpCJSPatched);
59
35
  }
60
36
  const moduleEntry = path.join(rootDir, "dist", "index.js");
61
37
  const moduleEntrySrc = fs.readFileSync(moduleEntry, "utf-8");
62
- if (!moduleEntrySrc.includes("// tamagui-patch-v4")) {
38
+ if (!moduleEntrySrc.includes(PATCH_COMMENT)) {
63
39
  fs.writeFileSync(moduleEntry, `${removePatch(moduleEntrySrc)}
64
40
 
65
- // tamagui-patch-v4
41
+ ${PATCH_COMMENT}
66
42
  import * as TExports from './tamagui-exports'
67
43
  export const TamaguiExports = TExports
68
- // tamagui-patch-end
44
+ ${PATCH_END_COMMENT}
69
45
  `);
70
46
  }
71
47
  const cjsEntry = path.join(rootDir, "dist", "cjs", "index.js");
72
48
  const cjsEntrySrc = fs.readFileSync(cjsEntry, "utf-8");
73
- if (!cjsEntrySrc.includes("// tamagui-patch-v4")) {
49
+ if (!cjsEntrySrc.includes(PATCH_COMMENT)) {
74
50
  fs.writeFileSync(cjsEntry, `${removePatch(cjsEntrySrc)}
75
51
 
76
- // tamagui-patch-v4
77
- exports.TamaguiExports = _interopRequireDefault(require("./tamagui-exports"));
78
- // tamagui-patch-end
52
+ ${PATCH_COMMENT}
53
+ exports.TamaguiExports = require("./tamagui-exports");
54
+ ${PATCH_END_COMMENT}
79
55
  `);
80
56
  }
81
57
  }
@@ -84,57 +60,21 @@ function removePatch(source) {
84
60
  return source.replace(/\/\/ tamagui-patch([.\s\S]*)/g, "");
85
61
  }
86
62
  __name(removePatch, "removePatch");
87
- const forwardedPropsObj = `{
88
- ...fwdProps.defaultProps,
89
- ...fwdProps.accessibilityProps,
90
- ...fwdProps.clickProps,
91
- ...fwdProps.focusProps,
92
- ...fwdProps.keyboardProps,
93
- ...fwdProps.mouseProps,
94
- ...fwdProps.touchProps,
95
- ...fwdProps.styleProps,
96
- href: true,
97
- lang: true,
98
- onScroll: true,
99
- onWheel: true,
100
- pointerEvents: true
101
- }
102
- `;
103
63
  const moduleExports = `
104
- export { atomic } from './exports/StyleSheet/compile'
105
- export { default as createCompileableStyle } from './exports/StyleSheet/createCompileableStyle'
106
- export { default as createReactDOMStyle } from './exports/StyleSheet/createReactDOMStyle'
107
- export { default as i18Style } from './exports/StyleSheet/i18nStyle'
108
64
  export { default as createDOMProps } from './modules/createDOMProps'
109
- export { default as AccessibilityUtil } from './modules/AccessibilityUtil'
110
- export { default as createElement } from './exports/createElement'
111
- export { default as css } from './exports/StyleSheet/css'
112
65
  export { default as TextAncestorContext } from './exports/Text/TextAncestorContext'
113
- export { default as pick } from './modules/pick'
114
66
  export { default as useElementLayout } from './modules/useElementLayout'
115
67
  export { default as useMergeRefs } from './modules/useMergeRefs'
116
68
  export { default as usePlatformMethods } from './modules/usePlatformMethods'
117
69
  export { default as useResponderEvents } from './modules/useResponderEvents'
118
- import * as fwdProps from './modules/forwardedProps'
119
- export const forwardedProps = ${forwardedPropsObj}
120
70
  `;
121
71
  const cjsExports = `
122
- exports.atomic = require('./exports/StyleSheet/compile').atomic
123
- exports.createCompileableStyle = require('./exports/StyleSheet/createCompileableStyle')
124
- exports.createReactDOMStyle = require('./exports/StyleSheet/createReactDOMStyle')
125
- exports.i18Style = require('./exports/StyleSheet/i18nStyle')
126
72
  exports.createDOMProps = require('./modules/createDOMProps')
127
- exports.AccessibilityUtil = require('./modules/AccessibilityUtil')
128
- exports.createElement = require('./exports/createElement')
129
- exports.css = require('./exports/StyleSheet/css')
130
73
  exports.TextAncestorContext = require('./exports/Text/TextAncestorContext')
131
- exports.pick = require('./modules/pick')
132
74
  exports.useElementLayout = require('./modules/useElementLayout')
133
75
  exports.useMergeRefs = require('./modules/useMergeRefs')
134
76
  exports.usePlatformMethods = require('./modules/usePlatformMethods')
135
77
  exports.useResponderEvents = require('./modules/useResponderEvents')
136
- const fwdProps = require('./modules/forwardedProps')
137
- exports.forwardedProps = ${forwardedPropsObj}
138
78
  `;
139
79
  export {
140
80
  patchReactNativeWeb
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@tamagui/static",
3
- "version": "1.0.1-beta.67",
3
+ "version": "1.0.1-beta.70",
4
4
  "source": "src/index.ts",
5
5
  "types": "./types/index.d.ts",
6
6
  "main": "dist/cjs",
7
7
  "module": "dist/esm",
8
8
  "module:jsx": "dist/jsx",
9
9
  "files": [
10
+ "patches",
10
11
  "src",
11
12
  "types",
12
13
  "dist"
@@ -17,7 +18,8 @@
17
18
  "clean": "tamagui-build clean",
18
19
  "clean:build": "tamagui-build clean:build",
19
20
  "test": "NODE_ENV=test TAMAGUI_COMPILE_PROCESS=1 jest --forceExit",
20
- "test:babel": "yarn test tests/babel-test.tsx",
21
+ "test:output": "TAMAGUI_TARGET=web node -r esbuild-register test-output.tsx",
22
+ "test:babel": "DISABLE_PRE_TEST=true yarn test tests/babel-test.tsx",
21
23
  "test:debug": "NODE_ENV=test TAMAGUI_COMPILE_PROCESS=1 DEBUG_FILE=extract-specs.tsx DEBUG=1 yarn test",
22
24
  "test:watch": "NODE_ENV=test TAMAGUI_COMPILE_PROCESS=1 yarn test --watch",
23
25
  "test:update-snapshots": "NODE_ENV=test jest --updateSnapshot"
@@ -36,11 +38,11 @@
36
38
  "@babel/parser": "^7.15.7",
37
39
  "@babel/traverse": "^7.15.4",
38
40
  "@expo/match-media": "^0.3.0",
39
- "@tamagui/build": "^1.0.1-beta.67",
40
- "@tamagui/core-node": "^1.0.1-beta.67",
41
- "@tamagui/fake-react-native": "^1.0.1-beta.67",
42
- "@tamagui/helpers": "^1.0.1-beta.67",
43
- "@tamagui/proxy-worm": "^1.0.1-beta.67",
41
+ "@tamagui/build": "^1.0.1-beta.70",
42
+ "@tamagui/core-node": "^1.0.1-beta.70",
43
+ "@tamagui/fake-react-native": "^1.0.1-beta.70",
44
+ "@tamagui/helpers": "^1.0.1-beta.70",
45
+ "@tamagui/proxy-worm": "^1.0.1-beta.70",
44
46
  "babel-literal-to-ast": "^2.1.0",
45
47
  "esbuild": "^0.14.36",
46
48
  "esbuild-register": "^3.3.2",
@@ -48,13 +50,15 @@
48
50
  "fs-extra": "^9.1.0",
49
51
  "invariant": "^2.2.4",
50
52
  "lodash": "^4.17.21",
51
- "tamagui": "^1.0.1-beta.67"
53
+ "tamagui": "^1.0.1-beta.70"
52
54
  },
53
55
  "devDependencies": {
54
56
  "@babel/plugin-syntax-typescript": "^7.14.5",
55
57
  "@babel/types": "^7.15.6",
56
58
  "@dish/babel-preset": "^0.0.6",
57
- "@testing-library/react": "13.0.0-alpha.4",
59
+ "@tamagui/config-base": "^1.0.1-beta.70",
60
+ "@testing-library/jest-dom": "^5.16.4",
61
+ "@testing-library/react": "^13.3.0",
58
62
  "@types/jest": "*",
59
63
  "@types/node": "^16.11.9",
60
64
  "@types/react-native": "^0.67.3",
@@ -62,15 +66,17 @@
62
66
  "babel-loader": "^8.2.5",
63
67
  "css-loader": "^5.2.4",
64
68
  "esbuild-loader": "^2.18.0",
65
- "jest": "^27.3.1",
69
+ "jest": "^28.1.1",
70
+ "jest-dom": "^4.0.0",
71
+ "jest-environment-jsdom": "^28.1.1",
66
72
  "null-loader": "^4.0.1",
67
73
  "react": "*",
68
74
  "react-dom": "*",
69
75
  "react-native-web": "^0.17.5",
70
- "react-test-renderer": "^18.1.0",
76
+ "react-test-renderer": "^18.2.0",
71
77
  "style-loader": "^3.3.0",
72
78
  "typescript": "^4.7.2",
73
- "webpack": "^5.72.0"
79
+ "webpack": "^5.73.0"
74
80
  },
75
81
  "peerDependencies": {
76
82
  "react-native-web": "*"
@@ -0,0 +1,385 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+
6
+ var _AccessibilityUtil = _interopRequireDefault(require("../AccessibilityUtil"));
7
+
8
+ var _StyleSheet2 = _interopRequireDefault(require("../../exports/StyleSheet"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
13
+
14
+ var emptyObject = {};
15
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
16
+ var isArray = Array.isArray;
17
+ var uppercasePattern = /[A-Z]/g;
18
+
19
+ function toHyphenLower(match) {
20
+ return '-' + match.toLowerCase();
21
+ }
22
+
23
+ function hyphenateString(str) {
24
+ return str.replace(uppercasePattern, toHyphenLower);
25
+ }
26
+
27
+ function processIDRefList(idRefList) {
28
+ return isArray(idRefList) ? idRefList.join(' ') : idRefList;
29
+ }
30
+
31
+ var pointerEventsStyles = _StyleSheet2.default.create({
32
+ auto: {
33
+ pointerEvents: 'auto'
34
+ },
35
+ 'box-none': {
36
+ pointerEvents: 'box-none'
37
+ },
38
+ 'box-only': {
39
+ pointerEvents: 'box-only'
40
+ },
41
+ none: {
42
+ pointerEvents: 'none'
43
+ }
44
+ });
45
+
46
+ var createDOMProps = function createDOMProps(elementType, props, options) {
47
+ if (!props) {
48
+ props = emptyObject;
49
+ }
50
+
51
+ var _props = props,
52
+ accessibilityActiveDescendant = _props.accessibilityActiveDescendant,
53
+ accessibilityAtomic = _props.accessibilityAtomic,
54
+ accessibilityAutoComplete = _props.accessibilityAutoComplete,
55
+ accessibilityBusy = _props.accessibilityBusy,
56
+ accessibilityChecked = _props.accessibilityChecked,
57
+ accessibilityColumnCount = _props.accessibilityColumnCount,
58
+ accessibilityColumnIndex = _props.accessibilityColumnIndex,
59
+ accessibilityColumnSpan = _props.accessibilityColumnSpan,
60
+ accessibilityControls = _props.accessibilityControls,
61
+ accessibilityCurrent = _props.accessibilityCurrent,
62
+ accessibilityDescribedBy = _props.accessibilityDescribedBy,
63
+ accessibilityDetails = _props.accessibilityDetails,
64
+ accessibilityDisabled = _props.accessibilityDisabled,
65
+ accessibilityErrorMessage = _props.accessibilityErrorMessage,
66
+ accessibilityExpanded = _props.accessibilityExpanded,
67
+ accessibilityFlowTo = _props.accessibilityFlowTo,
68
+ accessibilityHasPopup = _props.accessibilityHasPopup,
69
+ accessibilityHidden = _props.accessibilityHidden,
70
+ accessibilityInvalid = _props.accessibilityInvalid,
71
+ accessibilityKeyShortcuts = _props.accessibilityKeyShortcuts,
72
+ accessibilityLabel = _props.accessibilityLabel,
73
+ accessibilityLabelledBy = _props.accessibilityLabelledBy,
74
+ accessibilityLevel = _props.accessibilityLevel,
75
+ accessibilityLiveRegion = _props.accessibilityLiveRegion,
76
+ accessibilityModal = _props.accessibilityModal,
77
+ accessibilityMultiline = _props.accessibilityMultiline,
78
+ accessibilityMultiSelectable = _props.accessibilityMultiSelectable,
79
+ accessibilityOrientation = _props.accessibilityOrientation,
80
+ accessibilityOwns = _props.accessibilityOwns,
81
+ accessibilityPlaceholder = _props.accessibilityPlaceholder,
82
+ accessibilityPosInSet = _props.accessibilityPosInSet,
83
+ accessibilityPressed = _props.accessibilityPressed,
84
+ accessibilityReadOnly = _props.accessibilityReadOnly,
85
+ accessibilityRequired = _props.accessibilityRequired,
86
+ accessibilityRole = _props.accessibilityRole,
87
+ accessibilityRoleDescription = _props.accessibilityRoleDescription,
88
+ accessibilityRowCount = _props.accessibilityRowCount,
89
+ accessibilityRowIndex = _props.accessibilityRowIndex,
90
+ accessibilityRowSpan = _props.accessibilityRowSpan,
91
+ accessibilitySelected = _props.accessibilitySelected,
92
+ accessibilitySetSize = _props.accessibilitySetSize,
93
+ accessibilitySort = _props.accessibilitySort,
94
+ accessibilityValueMax = _props.accessibilityValueMax,
95
+ accessibilityValueMin = _props.accessibilityValueMin,
96
+ accessibilityValueNow = _props.accessibilityValueNow,
97
+ accessibilityValueText = _props.accessibilityValueText,
98
+ dataSet = _props.dataSet,
99
+ focusable = _props.focusable,
100
+ nativeID = _props.nativeID,
101
+ pointerEvents = _props.pointerEvents,
102
+ style = _props.style,
103
+ testID = _props.testID,
104
+ domProps = _objectWithoutPropertiesLoose(_props, ["accessibilityActiveDescendant", "accessibilityAtomic", "accessibilityAutoComplete", "accessibilityBusy", "accessibilityChecked", "accessibilityColumnCount", "accessibilityColumnIndex", "accessibilityColumnSpan", "accessibilityControls", "accessibilityCurrent", "accessibilityDescribedBy", "accessibilityDetails", "accessibilityDisabled", "accessibilityErrorMessage", "accessibilityExpanded", "accessibilityFlowTo", "accessibilityHasPopup", "accessibilityHidden", "accessibilityInvalid", "accessibilityKeyShortcuts", "accessibilityLabel", "accessibilityLabelledBy", "accessibilityLevel", "accessibilityLiveRegion", "accessibilityModal", "accessibilityMultiline", "accessibilityMultiSelectable", "accessibilityOrientation", "accessibilityOwns", "accessibilityPlaceholder", "accessibilityPosInSet", "accessibilityPressed", "accessibilityReadOnly", "accessibilityRequired", "accessibilityRole", "accessibilityRoleDescription", "accessibilityRowCount", "accessibilityRowIndex", "accessibilityRowSpan", "accessibilitySelected", "accessibilitySetSize", "accessibilitySort", "accessibilityValueMax", "accessibilityValueMin", "accessibilityValueNow", "accessibilityValueText", "dataSet", "focusable", "nativeID", "pointerEvents", "style", "testID"]);
105
+
106
+ var disabled = accessibilityDisabled;
107
+
108
+ var role = _AccessibilityUtil.default.propsToAriaRole(props); // ACCESSIBILITY
109
+
110
+
111
+ if (accessibilityActiveDescendant != null) {
112
+ domProps['aria-activedescendant'] = accessibilityActiveDescendant;
113
+ }
114
+
115
+ if (accessibilityAtomic != null) {
116
+ domProps['aria-atomic'] = accessibilityAtomic;
117
+ }
118
+
119
+ if (accessibilityAutoComplete != null) {
120
+ domProps['aria-autocomplete'] = accessibilityAutoComplete;
121
+ }
122
+
123
+ if (accessibilityBusy != null) {
124
+ domProps['aria-busy'] = accessibilityBusy;
125
+ }
126
+
127
+ if (accessibilityChecked != null) {
128
+ domProps['aria-checked'] = accessibilityChecked;
129
+ }
130
+
131
+ if (accessibilityColumnCount != null) {
132
+ domProps['aria-colcount'] = accessibilityColumnCount;
133
+ }
134
+
135
+ if (accessibilityColumnIndex != null) {
136
+ domProps['aria-colindex'] = accessibilityColumnIndex;
137
+ }
138
+
139
+ if (accessibilityColumnSpan != null) {
140
+ domProps['aria-colspan'] = accessibilityColumnSpan;
141
+ }
142
+
143
+ if (accessibilityControls != null) {
144
+ domProps['aria-controls'] = processIDRefList(accessibilityControls);
145
+ }
146
+
147
+ if (accessibilityCurrent != null) {
148
+ domProps['aria-current'] = accessibilityCurrent;
149
+ }
150
+
151
+ if (accessibilityDescribedBy != null) {
152
+ domProps['aria-describedby'] = processIDRefList(accessibilityDescribedBy);
153
+ }
154
+
155
+ if (accessibilityDetails != null) {
156
+ domProps['aria-details'] = accessibilityDetails;
157
+ }
158
+
159
+ if (disabled === true) {
160
+ domProps['aria-disabled'] = true; // Enhance with native semantics
161
+
162
+ if (elementType === 'button' || elementType === 'form' || elementType === 'input' || elementType === 'select' || elementType === 'textarea') {
163
+ domProps.disabled = true;
164
+ }
165
+ }
166
+
167
+ if (accessibilityErrorMessage != null) {
168
+ domProps['aria-errormessage'] = accessibilityErrorMessage;
169
+ }
170
+
171
+ if (accessibilityExpanded != null) {
172
+ domProps['aria-expanded'] = accessibilityExpanded;
173
+ }
174
+
175
+ if (accessibilityFlowTo != null) {
176
+ domProps['aria-flowto'] = processIDRefList(accessibilityFlowTo);
177
+ }
178
+
179
+ if (accessibilityHasPopup != null) {
180
+ domProps['aria-haspopup'] = accessibilityHasPopup;
181
+ }
182
+
183
+ if (accessibilityHidden === true) {
184
+ domProps['aria-hidden'] = accessibilityHidden;
185
+ }
186
+
187
+ if (accessibilityInvalid != null) {
188
+ domProps['aria-invalid'] = accessibilityInvalid;
189
+ }
190
+
191
+ if (accessibilityKeyShortcuts != null && Array.isArray(accessibilityKeyShortcuts)) {
192
+ domProps['aria-keyshortcuts'] = accessibilityKeyShortcuts.join(' ');
193
+ }
194
+
195
+ if (accessibilityLabel != null) {
196
+ domProps['aria-label'] = accessibilityLabel;
197
+ }
198
+
199
+ if (accessibilityLabelledBy != null) {
200
+ domProps['aria-labelledby'] = processIDRefList(accessibilityLabelledBy);
201
+ }
202
+
203
+ if (accessibilityLevel != null) {
204
+ domProps['aria-level'] = accessibilityLevel;
205
+ }
206
+
207
+ if (accessibilityLiveRegion != null) {
208
+ domProps['aria-live'] = accessibilityLiveRegion === 'none' ? 'off' : accessibilityLiveRegion;
209
+ }
210
+
211
+ if (accessibilityModal != null) {
212
+ domProps['aria-modal'] = accessibilityModal;
213
+ }
214
+
215
+ if (accessibilityMultiline != null) {
216
+ domProps['aria-multiline'] = accessibilityMultiline;
217
+ }
218
+
219
+ if (accessibilityMultiSelectable != null) {
220
+ domProps['aria-multiselectable'] = accessibilityMultiSelectable;
221
+ }
222
+
223
+ if (accessibilityOrientation != null) {
224
+ domProps['aria-orientation'] = accessibilityOrientation;
225
+ }
226
+
227
+ if (accessibilityOwns != null) {
228
+ domProps['aria-owns'] = processIDRefList(accessibilityOwns);
229
+ }
230
+
231
+ if (accessibilityPlaceholder != null) {
232
+ domProps['aria-placeholder'] = accessibilityPlaceholder;
233
+ }
234
+
235
+ if (accessibilityPosInSet != null) {
236
+ domProps['aria-posinset'] = accessibilityPosInSet;
237
+ }
238
+
239
+ if (accessibilityPressed != null) {
240
+ domProps['aria-pressed'] = accessibilityPressed;
241
+ }
242
+
243
+ if (accessibilityReadOnly != null) {
244
+ domProps['aria-readonly'] = accessibilityReadOnly; // Enhance with native semantics
245
+
246
+ if (elementType === 'input' || elementType === 'select' || elementType === 'textarea') {
247
+ domProps.readOnly = true;
248
+ }
249
+ }
250
+
251
+ if (accessibilityRequired != null) {
252
+ domProps['aria-required'] = accessibilityRequired; // Enhance with native semantics
253
+
254
+ if (elementType === 'input' || elementType === 'select' || elementType === 'textarea') {
255
+ domProps.required = true;
256
+ }
257
+ }
258
+
259
+ if (role != null) {
260
+ // 'presentation' synonym has wider browser support
261
+ domProps['role'] = role === 'none' ? 'presentation' : role;
262
+ }
263
+
264
+ if (accessibilityRoleDescription != null) {
265
+ domProps['aria-roledescription'] = accessibilityRoleDescription;
266
+ }
267
+
268
+ if (accessibilityRowCount != null) {
269
+ domProps['aria-rowcount'] = accessibilityRowCount;
270
+ }
271
+
272
+ if (accessibilityRowIndex != null) {
273
+ domProps['aria-rowindex'] = accessibilityRowIndex;
274
+ }
275
+
276
+ if (accessibilityRowSpan != null) {
277
+ domProps['aria-rowspan'] = accessibilityRowSpan;
278
+ }
279
+
280
+ if (accessibilitySelected != null) {
281
+ domProps['aria-selected'] = accessibilitySelected;
282
+ }
283
+
284
+ if (accessibilitySetSize != null) {
285
+ domProps['aria-setsize'] = accessibilitySetSize;
286
+ }
287
+
288
+ if (accessibilitySort != null) {
289
+ domProps['aria-sort'] = accessibilitySort;
290
+ }
291
+
292
+ if (accessibilityValueMax != null) {
293
+ domProps['aria-valuemax'] = accessibilityValueMax;
294
+ }
295
+
296
+ if (accessibilityValueMin != null) {
297
+ domProps['aria-valuemin'] = accessibilityValueMin;
298
+ }
299
+
300
+ if (accessibilityValueNow != null) {
301
+ domProps['aria-valuenow'] = accessibilityValueNow;
302
+ }
303
+
304
+ if (accessibilityValueText != null) {
305
+ domProps['aria-valuetext'] = accessibilityValueText;
306
+ } // "dataSet" replaced with "data-*"
307
+
308
+
309
+ const tmgCN = dataSet ? dataSet.className : undefined
310
+ const tmgID = dataSet ? dataSet.id : undefined
311
+ if (dataSet != null) {
312
+ for (var dataProp in dataSet) {
313
+ if (dataProp === 'className' || dataProp === 'id') continue
314
+ if (hasOwnProperty.call(dataSet, dataProp)) {
315
+ var dataName = hyphenateString(dataProp);
316
+ var dataValue = dataSet[dataProp];
317
+
318
+ if (dataValue != null) {
319
+ domProps["data-" + dataName] = dataValue;
320
+ }
321
+ }
322
+ }
323
+ } // FOCUS
324
+ // "focusable" indicates that an element may be a keyboard tab-stop.
325
+
326
+
327
+ if (focusable === false) {
328
+ domProps.tabIndex = '-1';
329
+ }
330
+
331
+ if ( // These native elements are keyboard focusable by default
332
+ elementType === 'a' || elementType === 'button' || elementType === 'input' || elementType === 'select' || elementType === 'textarea') {
333
+ if (focusable === false || accessibilityDisabled === true) {
334
+ domProps.tabIndex = '-1';
335
+ }
336
+ } else if ( // These roles are made keyboard focusable by default
337
+ role === 'button' || role === 'checkbox' || role === 'link' || role === 'radio' || role === 'textbox' || role === 'switch') {
338
+ if (focusable !== false) {
339
+ domProps.tabIndex = '0';
340
+ }
341
+ } else {
342
+ // Everything else must explicitly set the prop
343
+ if (focusable === true) {
344
+ domProps.tabIndex = '0';
345
+ }
346
+ } // Resolve styles
347
+
348
+ var _StyleSheet = (0, _StyleSheet2.default)([style, pointerEvents && pointerEventsStyles[pointerEvents]], {
349
+ writingDirection: options ? options.writingDirection : 'ltr'
350
+ }),
351
+ className = _StyleSheet[0],
352
+ inlineStyle = _StyleSheet[1];
353
+
354
+ // elementType = null on setNativeProps and overrides our classname
355
+ if (elementType != null && className) {
356
+ domProps.className = className;
357
+ }
358
+
359
+ if (inlineStyle) {
360
+ domProps.style = inlineStyle;
361
+ }
362
+
363
+ if (tmgCN) {
364
+ domProps.className = tmgCN
365
+ }
366
+
367
+ // Native element ID
368
+
369
+ if (tmgID) {
370
+ domProps.id = tmgID
371
+ } else if (nativeID != null) {
372
+ domProps.id = nativeID;
373
+ } // Automated test IDs
374
+
375
+
376
+ if (testID != null) {
377
+ domProps['data-testid'] = testID;
378
+ }
379
+
380
+ return domProps;
381
+ };
382
+
383
+ var _default = createDOMProps;
384
+ exports.default = _default;
385
+ module.exports = exports.default;