@carbon/utilities-react 0.6.0 → 0.7.0-rc.0

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.
@@ -1 +1,5 @@
1
- import"react";function u(e,t="component should have no interactive child nodes"){}function f(e,t="interactive child node(s) should have an `aria-describedby` property"){}function n(e){if(!e||!e.childNodes)return null;if(i(e))return e;for(const t of e.childNodes){const r=n(t);if(r)return r}return null}function o(e){if(!e||!e.childNodes)return null;if(e?.getAttribute?.("role")&&e.getAttribute("role")!=="")return e;for(const t of e.childNodes){const r=o(t);if(r)return r}return null}function i(e){if(e.tabIndex===void 0||e.tabIndex<0||e.disabled)return!1;switch(e.nodeName){case"A":return!!e.href&&e.rel!=="ignore";case"INPUT":return e.type!=="hidden";default:return!0}}export{n as getInteractiveContent,o as getRoleContent,f as useInteractiveChildrenNeedDescription,u as useNoInteractiveChildren};
1
+ import{useEffect as i}from"react";function d(r,t="component should have no interactive child nodes"){process.env.NODE_ENV!=="production"&&i(()=>{const e=r.current?n(r.current):!1;if(e){const o=`Error: ${t}.
2
+
3
+ Instead found: ${e.outerHTML}`;throw console.error(o),new Error(o)}})}function f(r,t="interactive child node(s) should have an `aria-describedby` property"){process.env.NODE_ENV!=="production"&&i(()=>{const e=r.current?n(r.current):!1;if(e&&!e.hasAttribute("aria-describedby"))throw new Error(`Error: ${t}.
4
+
5
+ Instead found: ${e.outerHTML}`)})}function n(r){if(!r||!r.childNodes)return null;if(u(r))return r;for(const t of r.childNodes){const e=n(t);if(e)return e}return null}function c(r){if(!r||!r.childNodes)return null;if(r?.getAttribute?.("role")&&r.getAttribute("role")!=="")return r;for(const t of r.childNodes){const e=c(t);if(e)return e}return null}function u(r){if(r.tabIndex===void 0||r.tabIndex<0||r.disabled)return!1;switch(r.nodeName){case"A":return!!r.href&&r.rel!=="ignore";case"INPUT":return r.type!=="hidden";default:return!0}}export{n as getInteractiveContent,c as getRoleContent,f as useInteractiveChildrenNeedDescription,d as useNoInteractiveChildren};
@@ -1 +1,5 @@
1
- "use strict";var o=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var a=(e,r)=>{for(var t in r)o(e,t,{get:r[t],enumerable:!0})},l=(e,r,t,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of f(r))!d.call(e,n)&&n!==t&&o(e,n,{get:()=>r[n],enumerable:!(i=u(r,n))||i.enumerable});return e};var h=e=>l(o({},"__esModule",{value:!0}),e);var b={};a(b,{getInteractiveContent:()=>s,getRoleContent:()=>c,useInteractiveChildrenNeedDescription:()=>p,useNoInteractiveChildren:()=>N});module.exports=h(b);var E=require("react");function N(e,r="component should have no interactive child nodes"){}function p(e,r="interactive child node(s) should have an `aria-describedby` property"){}function s(e){if(!e||!e.childNodes)return null;if(v(e))return e;for(const r of e.childNodes){const t=s(r);if(t)return t}return null}function c(e){if(!e||!e.childNodes)return null;if(e?.getAttribute?.("role")&&e.getAttribute("role")!=="")return e;for(const r of e.childNodes){const t=c(r);if(t)return t}return null}function v(e){if(e.tabIndex===void 0||e.tabIndex<0||e.disabled)return!1;switch(e.nodeName){case"A":return!!e.href&&e.rel!=="ignore";case"INPUT":return e.type!=="hidden";default:return!0}}
1
+ "use strict";var c=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var l=(r,e)=>{for(var t in e)c(r,t,{get:e[t],enumerable:!0})},h=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of f(e))!a.call(r,o)&&o!==t&&c(r,o,{get:()=>e[o],enumerable:!(n=d(e,o))||n.enumerable});return r};var N=r=>h(c({},"__esModule",{value:!0}),r);var E={};l(E,{getInteractiveContent:()=>i,getRoleContent:()=>s,useInteractiveChildrenNeedDescription:()=>b,useNoInteractiveChildren:()=>p});module.exports=N(E);var u=require("react");function p(r,e="component should have no interactive child nodes"){process.env.NODE_ENV!=="production"&&(0,u.useEffect)(()=>{const t=r.current?i(r.current):!1;if(t){const n=`Error: ${e}.
2
+
3
+ Instead found: ${t.outerHTML}`;throw console.error(n),new Error(n)}})}function b(r,e="interactive child node(s) should have an `aria-describedby` property"){process.env.NODE_ENV!=="production"&&(0,u.useEffect)(()=>{const t=r.current?i(r.current):!1;if(t&&!t.hasAttribute("aria-describedby"))throw new Error(`Error: ${e}.
4
+
5
+ Instead found: ${t.outerHTML}`)})}function i(r){if(!r||!r.childNodes)return null;if(v(r))return r;for(const e of r.childNodes){const t=i(e);if(t)return t}return null}function s(r){if(!r||!r.childNodes)return null;if(r?.getAttribute?.("role")&&r.getAttribute("role")!=="")return r;for(const e of r.childNodes){const t=s(e);if(t)return t}return null}function v(r){if(r.tabIndex===void 0||r.tabIndex<0||r.disabled)return!1;switch(r.nodeName){case"A":return!!r.href&&r.rel!=="ignore";case"INPUT":return r.type!=="hidden";default:return!0}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/utilities-react",
3
3
  "description": "Utilities and helpers to drive consistency across software products using the Carbon Design System with React",
4
- "version": "0.6.0",
4
+ "version": "0.7.0-rc.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -30,8 +30,8 @@
30
30
  "provenance": true
31
31
  },
32
32
  "scripts": {
33
- "build:es": "esbuild ./src/**/!(*-test).{js,ts,jsx,tsx} --minify --outdir=es --target=es2020 --format=esm",
34
- "build:cjs": "esbuild ./src/**/!(*-test).{js,ts,jsx,tsx} --minify --outdir=lib --target=es2020 --format=cjs",
33
+ "build:es": "esbuild ./src/**/!(*-test).{js,ts,jsx,tsx} --minify --outdir=es --target=es2020 --format=esm --define:process=process",
34
+ "build:cjs": "esbuild ./src/**/!(*-test).{js,ts,jsx,tsx} --minify --outdir=lib --target=es2020 --format=cjs --define:process=process",
35
35
  "build:types": "tsc",
36
36
  "build": "yarn build:es & yarn build:cjs & yarn build:types",
37
37
  "watch": "yarn build:es --watch & yarn build:cjs --watch",
@@ -51,5 +51,5 @@
51
51
  "@carbon/utilities": "^0.5.0",
52
52
  "@ibm/telemetry-js": "^1.6.1"
53
53
  },
54
- "gitHead": "7c4674649e1a5bd1367d99797df86cdc338eff6e"
54
+ "gitHead": "679420306589ea6cb50db59d208c7039020ebb4f"
55
55
  }