@octaviaflow/utilities-react 1.0.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.
- package/README.md +39 -0
- package/es/index.js +18 -0
- package/es/useNoInteractiveChildren/index.js +14 -0
- package/lib/index.js +18 -0
- package/lib/useNoInteractiveChildren/index.js +14 -0
- package/package.json +49 -0
- package/telemetry.yml +16 -0
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @octaviaflow/utilities-react
|
|
2
|
+
|
|
3
|
+
> Utilities and helpers to drive consistency across software products using the
|
|
4
|
+
> Carbon Design System with React
|
|
5
|
+
|
|
6
|
+
## Getting started
|
|
7
|
+
|
|
8
|
+
To install `@octaviaflow/utilities-react` in your project, you will need to run the
|
|
9
|
+
following command using [npm](https://www.npmjs.com/):
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @octaviaflow/utilities-react
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
If you prefer [Yarn](https://yarnpkg.com/en/), use the following command
|
|
16
|
+
instead:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
yarn add @octaviaflow/utilities-react
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 🙌 Contributing
|
|
23
|
+
|
|
24
|
+
We're always looking for contributors to help us fix bugs, build new features,
|
|
25
|
+
or help us improve the project documentation. If you're interested, definitely
|
|
26
|
+
check out our [Contributing Guide](/.github/CONTRIBUTING.md)! 👀
|
|
27
|
+
|
|
28
|
+
## 📝 License
|
|
29
|
+
|
|
30
|
+
Licensed under the [Apache 2.0 License](/LICENSE).
|
|
31
|
+
|
|
32
|
+
## <picture><source height="20" width="20" media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-dark.svg"><source height="20" width="20" media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-light.svg"><img height="20" width="20" alt="IBM Telemetry" src="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-light.svg"></picture> IBM Telemetry
|
|
33
|
+
|
|
34
|
+
This package uses IBM Telemetry to collect de-identified and anonymized metrics
|
|
35
|
+
data. By installing this package as a dependency you are agreeing to telemetry
|
|
36
|
+
collection. To opt out, see
|
|
37
|
+
[Opting out of IBM Telemetry data collection](https://github.com/ibm-telemetry/telemetry-js/tree/main#opting-out-of-ibm-telemetry-data-collection).
|
|
38
|
+
For more information on the data being collected, please see the
|
|
39
|
+
[IBM Telemetry documentation](https://github.com/ibm-telemetry/telemetry-js/tree/main#ibm-telemetry-collection-basics).
|
package/es/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var G=Object.create;var _=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty;var M=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),I=(t,e)=>{for(var r in e)_(t,r,{get:e[r],enumerable:!0})},Q=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of B(e))!W.call(t,u)&&u!==r&&_(t,u,{get:()=>e[u],enumerable:!(n=K(e,u))||n.enumerable});return t};var X=(t,e,r)=>(r=t!=null?G(F(t)):{},Q(e||!t||!t.__esModule?_(r,"default",{value:t,enumerable:!0}):r,t));var k=M(o=>{"use strict";var T=Symbol.for("react.transitional.element"),rt=Symbol.for("react.portal"),nt=Symbol.for("react.fragment"),ot=Symbol.for("react.strict_mode"),ut=Symbol.for("react.profiler"),st=Symbol.for("react.consumer"),it=Symbol.for("react.context"),ft=Symbol.for("react.forward_ref"),ct=Symbol.for("react.suspense"),at=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),lt=Symbol.for("react.activity"),b=Symbol.iterator;function pt(t){return t===null||typeof t!="object"?null:(t=b&&t[b]||t["@@iterator"],typeof t=="function"?t:null)}var $={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,D={};function p(t,e,r){this.props=t,this.context=e,this.refs=D,this.updater=r||$}p.prototype.isReactComponent={};p.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};p.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Y(){}Y.prototype=p.prototype;function R(t,e,r){this.props=t,this.context=e,this.refs=D,this.updater=r||$}var C=R.prototype=new Y;C.constructor=R;x(C,p.prototype);C.isPureReactComponent=!0;var H=Array.isArray;function h(){}var f={H:null,A:null,T:null,S:null},L=Object.prototype.hasOwnProperty;function S(t,e,r){var n=r.ref;return{$$typeof:T,type:t,key:e,ref:n!==void 0?n:null,props:r}}function yt(t,e){return S(t.type,e,t.props)}function w(t){return typeof t=="object"&&t!==null&&t.$$typeof===T}function mt(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var O=/\/+/g;function v(t,e){return typeof t=="object"&&t!==null&&t.key!=null?mt(""+t.key):e.toString(36)}function _t(t){switch(t.status){case"fulfilled":return t.value;case"rejected":throw t.reason;default:switch(typeof t.status=="string"?t.then(h,h):(t.status="pending",t.then(function(e){t.status==="pending"&&(t.status="fulfilled",t.value=e)},function(e){t.status==="pending"&&(t.status="rejected",t.reason=e)})),t.status){case"fulfilled":return t.value;case"rejected":throw t.reason}}throw t}function l(t,e,r,n,u){var s=typeof t;(s==="undefined"||s==="boolean")&&(t=null);var i=!1;if(t===null)i=!0;else switch(s){case"bigint":case"string":case"number":i=!0;break;case"object":switch(t.$$typeof){case T:case rt:i=!0;break;case j:return i=t._init,l(i(t._payload),e,r,n,u)}}if(i)return u=u(t),i=n===""?"."+v(t,0):n,H(u)?(r="",i!=null&&(r=i.replace(O,"$&/")+"/"),l(u,e,r,"",function(y){return y})):u!=null&&(w(u)&&(u=yt(u,r+(u.key==null||t&&t.key===u.key?"":(""+u.key).replace(O,"$&/")+"/")+i)),e.push(u)),1;i=0;var a=n===""?".":n+":";if(H(t))for(var c=0;c<t.length;c++)n=t[c],s=a+v(n,c),i+=l(n,e,r,s,u);else if(c=pt(t),typeof c=="function")for(t=c.call(t),c=0;!(n=t.next()).done;)n=n.value,s=a+v(n,c++),i+=l(n,e,r,s,u);else if(s==="object"){if(typeof t.then=="function")return l(_t(t),e,r,n,u);throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.")}return i}function m(t,e,r){if(t==null)return t;var n=[],u=0;return l(t,n,"","",function(s){return e.call(r,s,u++)}),n}function Et(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(r){(t._status===0||t._status===-1)&&(t._status=1,t._result=r)},function(r){(t._status===0||t._status===-1)&&(t._status=2,t._result=r)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var P=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},dt={map:m,forEach:function(t,e,r){m(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return m(t,function(){e++}),e},toArray:function(t){return m(t,function(e){return e})||[]},only:function(t){if(!w(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};o.Activity=lt;o.Children=dt;o.Component=p;o.Fragment=nt;o.Profiler=ut;o.PureComponent=R;o.StrictMode=ot;o.Suspense=ct;o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=f;o.__COMPILER_RUNTIME={__proto__:null,c:function(t){return f.H.useMemoCache(t)}};o.cache=function(t){return function(){return t.apply(null,arguments)}};o.cacheSignal=function(){return null};o.cloneElement=function(t,e,r){if(t==null)throw Error("The argument must be a React element, but you passed "+t+".");var n=x({},t.props),u=t.key;if(e!=null)for(s in e.key!==void 0&&(u=""+e.key),e)!L.call(e,s)||s==="key"||s==="__self"||s==="__source"||s==="ref"&&e.ref===void 0||(n[s]=e[s]);var s=arguments.length-2;if(s===1)n.children=r;else if(1<s){for(var i=Array(s),a=0;a<s;a++)i[a]=arguments[a+2];n.children=i}return S(t.type,u,n)};o.createContext=function(t){return t={$$typeof:it,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null},t.Provider=t,t.Consumer={$$typeof:st,_context:t},t};o.createElement=function(t,e,r){var n,u={},s=null;if(e!=null)for(n in e.key!==void 0&&(s=""+e.key),e)L.call(e,n)&&n!=="key"&&n!=="__self"&&n!=="__source"&&(u[n]=e[n]);var i=arguments.length-2;if(i===1)u.children=r;else if(1<i){for(var a=Array(i),c=0;c<i;c++)a[c]=arguments[c+2];u.children=a}if(t&&t.defaultProps)for(n in i=t.defaultProps,i)u[n]===void 0&&(u[n]=i[n]);return S(t,s,u)};o.createRef=function(){return{current:null}};o.forwardRef=function(t){return{$$typeof:ft,render:t}};o.isValidElement=w;o.lazy=function(t){return{$$typeof:j,_payload:{_status:-1,_result:t},_init:Et}};o.memo=function(t,e){return{$$typeof:at,type:t,compare:e===void 0?null:e}};o.startTransition=function(t){var e=f.T,r={};f.T=r;try{var n=t(),u=f.S;u!==null&&u(r,n),typeof n=="object"&&n!==null&&typeof n.then=="function"&&n.then(h,P)}catch(s){P(s)}finally{e!==null&&r.types!==null&&(e.types=r.types),f.T=e}};o.unstable_useCacheRefresh=function(){return f.H.useCacheRefresh()};o.use=function(t){return f.H.use(t)};o.useActionState=function(t,e,r){return f.H.useActionState(t,e,r)};o.useCallback=function(t,e){return f.H.useCallback(t,e)};o.useContext=function(t){return f.H.useContext(t)};o.useDebugValue=function(){};o.useDeferredValue=function(t,e){return f.H.useDeferredValue(t,e)};o.useEffect=function(t,e){return f.H.useEffect(t,e)};o.useEffectEvent=function(t){return f.H.useEffectEvent(t)};o.useId=function(){return f.H.useId()};o.useImperativeHandle=function(t,e,r){return f.H.useImperativeHandle(t,e,r)};o.useInsertionEffect=function(t,e){return f.H.useInsertionEffect(t,e)};o.useLayoutEffect=function(t,e){return f.H.useLayoutEffect(t,e)};o.useMemo=function(t,e){return f.H.useMemo(t,e)};o.useOptimistic=function(t,e){return f.H.useOptimistic(t,e)};o.useReducer=function(t,e,r){return f.H.useReducer(t,e,r)};o.useRef=function(t){return f.H.useRef(t)};o.useState=function(t){return f.H.useState(t)};o.useSyncExternalStore=function(t,e,r){return f.H.useSyncExternalStore(t,e,r)};o.useTransition=function(){return f.H.useTransition()};o.version="19.2.4"});var q=M((At,U)=>{"use strict";U.exports=k()});var E={};I(E,{format:()=>Z});function Z(t,e){let r=new Intl.RelativeTimeFormat(e?.locale,{style:e?.style??"long"}),n=typeof t=="number"?new Date(t):t,u=Date.now(),s=Math.floor((u-n.getTime())/1e3),i=Math.floor(s/60),a=Math.floor(i/60),c=Math.floor(a/24),y=Math.floor(c/7),N=Math.floor(y/4),z=Math.floor(c/365);return Math.abs(s)<60?new Intl.RelativeTimeFormat(e?.locale,{numeric:"auto",style:e?.style??"long"}).format(0,"seconds"):Math.abs(i)<60?r.format(i*-1,"minutes"):Math.abs(a)<24?r.format(a*-1,"hours"):Math.abs(c)<7?r.format(c*-1,"days"):Math.abs(y)<4?r.format(y*-1,"weeks"):Math.abs(N)<12?r.format(N*-1,"months"):r.format(z*-1,"years")}var d={};I(d,{format:()=>tt,formatDate:()=>V,formatRange:()=>et,formatTime:()=>J});function J(t,e){return new Intl.DateTimeFormat(e?.locale,{timeStyle:e?.style??"short"}).format(t)}function V(t,e){return new Intl.DateTimeFormat(e?.locale,{dateStyle:e?.style??"medium"}).format(t)}function tt(t,e){let r=e?.timeStyle??(e?.style==="tooltip"?"long":e?.style)??"short",n=e?.dateStyle??(e?.style==="tooltip"?"full":e?.style)??"medium";return new Intl.DateTimeFormat(e?.locale,{timeStyle:r,dateStyle:n}).format(t)}function et(t,e,r){let n=r?.timeStyle===null?void 0:r?.timeStyle??r?.style??"short",u=r?.dateStyle===null?void 0:r?.dateStyle??r?.style??"medium";return new Intl.DateTimeFormat(r?.locale,{timeStyle:n,dateStyle:u}).formatRange(t,e)}var Rt={relative:E,absolute:d};var g=X(q());function Nt(t,e="component should have no interactive child nodes"){__DEV__&&(0,g.useEffect)(()=>{let r=t.current?A(t.current):!1;if(r)throw new Error(`Error: ${e}.
|
|
2
|
+
|
|
3
|
+
Instead found: ${r.outerHTML}`)})}function Mt(t,e="interactive child node(s) should have an `aria-describedby` property"){__DEV__&&(0,g.useEffect)(()=>{let r=t.current?A(t.current):!1;if(r&&!r.hasAttribute("aria-describedby"))throw new Error(`Error: ${e}.
|
|
4
|
+
|
|
5
|
+
Instead found: ${r.outerHTML}`)})}function A(t){if(!t||!t.childNodes)return null;if(ht(t))return t;for(let e of t.childNodes){let r=A(e);if(r)return r}return null}function vt(t){if(!t||!t.childNodes)return null;if(t?.getAttribute?.("role")&&t.getAttribute("role")!=="")return t;for(let e of t.childNodes){let r=vt(e);if(r)return r}return null}function ht(t){if(t.tabIndex===void 0||t.tabIndex<0||t.disabled)return!1;switch(t.nodeName){case"A":return!!t.href&&t.rel!=="ignore";case"INPUT":return t.type!=="hidden";default:return!0}}export{Rt as dateTimeFormat,A as getInteractiveContent,vt as getRoleContent,Mt as useInteractiveChildrenNeedDescription,Nt as useNoInteractiveChildren};
|
|
6
|
+
/*! Bundled license information:
|
|
7
|
+
|
|
8
|
+
react/cjs/react.production.js:
|
|
9
|
+
(**
|
|
10
|
+
* @license React
|
|
11
|
+
* react.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*)
|
|
18
|
+
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright OctaviaFlow
|
|
3
|
+
* Author: Vishal Kumar
|
|
4
|
+
* Created: 11/November/2025
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import{useEffect as i}from"react";function d(r,t="component should have no interactive child nodes"){__DEV__&&i(()=>{const e=r.current?n(r.current):!1;if(e)throw new Error(`Error: ${t}.
|
|
11
|
+
|
|
12
|
+
Instead found: ${e.outerHTML}`)})}function s(r,t="interactive child node(s) should have an `aria-describedby` property"){__DEV__&&i(()=>{const e=r.current?n(r.current):!1;if(e&&!e.hasAttribute("aria-describedby"))throw new Error(`Error: ${t}.
|
|
13
|
+
|
|
14
|
+
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 o(r){if(!r||!r.childNodes)return null;if(r?.getAttribute?.("role")&&r.getAttribute("role")!=="")return r;for(const t of r.childNodes){const e=o(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,o as getRoleContent,s as useInteractiveChildrenNeedDescription,d as useNoInteractiveChildren};
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";var B=Object.create;var m=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty;var I=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),d=(t,e)=>{for(var r in e)m(t,r,{get:e[r],enumerable:!0})},b=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of W(e))!X.call(t,u)&&u!==r&&m(t,u,{get:()=>e[u],enumerable:!(n=F(e,u))||n.enumerable});return t};var Z=(t,e,r)=>(r=t!=null?B(Q(t)):{},b(e||!t||!t.__esModule?m(r,"default",{value:t,enumerable:!0}):r,t)),J=t=>b(m({},"__esModule",{value:!0}),t);var U=I(o=>{"use strict";var C=Symbol.for("react.transitional.element"),ut=Symbol.for("react.portal"),st=Symbol.for("react.fragment"),it=Symbol.for("react.strict_mode"),ft=Symbol.for("react.profiler"),ct=Symbol.for("react.consumer"),at=Symbol.for("react.context"),lt=Symbol.for("react.forward_ref"),pt=Symbol.for("react.suspense"),yt=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),mt=Symbol.for("react.activity"),H=Symbol.iterator;function _t(t){return t===null||typeof t!="object"?null:(t=H&&t[H]||t["@@iterator"],typeof t=="function"?t:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D=Object.assign,Y={};function p(t,e,r){this.props=t,this.context=e,this.refs=Y,this.updater=r||x}p.prototype.isReactComponent={};p.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};p.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function L(){}L.prototype=p.prototype;function S(t,e,r){this.props=t,this.context=e,this.refs=Y,this.updater=r||x}var w=S.prototype=new L;w.constructor=S;D(w,p.prototype);w.isPureReactComponent=!0;var O=Array.isArray;function R(){}var f={H:null,A:null,T:null,S:null},k=Object.prototype.hasOwnProperty;function g(t,e,r){var n=r.ref;return{$$typeof:C,type:t,key:e,ref:n!==void 0?n:null,props:r}}function Et(t,e){return g(t.type,e,t.props)}function A(t){return typeof t=="object"&&t!==null&&t.$$typeof===C}function dt(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var P=/\/+/g;function T(t,e){return typeof t=="object"&&t!==null&&t.key!=null?dt(""+t.key):e.toString(36)}function vt(t){switch(t.status){case"fulfilled":return t.value;case"rejected":throw t.reason;default:switch(typeof t.status=="string"?t.then(R,R):(t.status="pending",t.then(function(e){t.status==="pending"&&(t.status="fulfilled",t.value=e)},function(e){t.status==="pending"&&(t.status="rejected",t.reason=e)})),t.status){case"fulfilled":return t.value;case"rejected":throw t.reason}}throw t}function l(t,e,r,n,u){var s=typeof t;(s==="undefined"||s==="boolean")&&(t=null);var i=!1;if(t===null)i=!0;else switch(s){case"bigint":case"string":case"number":i=!0;break;case"object":switch(t.$$typeof){case C:case ut:i=!0;break;case $:return i=t._init,l(i(t._payload),e,r,n,u)}}if(i)return u=u(t),i=n===""?"."+T(t,0):n,O(u)?(r="",i!=null&&(r=i.replace(P,"$&/")+"/"),l(u,e,r,"",function(y){return y})):u!=null&&(A(u)&&(u=Et(u,r+(u.key==null||t&&t.key===u.key?"":(""+u.key).replace(P,"$&/")+"/")+i)),e.push(u)),1;i=0;var a=n===""?".":n+":";if(O(t))for(var c=0;c<t.length;c++)n=t[c],s=a+T(n,c),i+=l(n,e,r,s,u);else if(c=_t(t),typeof c=="function")for(t=c.call(t),c=0;!(n=t.next()).done;)n=n.value,s=a+T(n,c++),i+=l(n,e,r,s,u);else if(s==="object"){if(typeof t.then=="function")return l(vt(t),e,r,n,u);throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.")}return i}function _(t,e,r){if(t==null)return t;var n=[],u=0;return l(t,n,"","",function(s){return e.call(r,s,u++)}),n}function ht(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(r){(t._status===0||t._status===-1)&&(t._status=1,t._result=r)},function(r){(t._status===0||t._status===-1)&&(t._status=2,t._result=r)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var j=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Tt={map:_,forEach:function(t,e,r){_(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return _(t,function(){e++}),e},toArray:function(t){return _(t,function(e){return e})||[]},only:function(t){if(!A(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};o.Activity=mt;o.Children=Tt;o.Component=p;o.Fragment=st;o.Profiler=ft;o.PureComponent=S;o.StrictMode=it;o.Suspense=pt;o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=f;o.__COMPILER_RUNTIME={__proto__:null,c:function(t){return f.H.useMemoCache(t)}};o.cache=function(t){return function(){return t.apply(null,arguments)}};o.cacheSignal=function(){return null};o.cloneElement=function(t,e,r){if(t==null)throw Error("The argument must be a React element, but you passed "+t+".");var n=D({},t.props),u=t.key;if(e!=null)for(s in e.key!==void 0&&(u=""+e.key),e)!k.call(e,s)||s==="key"||s==="__self"||s==="__source"||s==="ref"&&e.ref===void 0||(n[s]=e[s]);var s=arguments.length-2;if(s===1)n.children=r;else if(1<s){for(var i=Array(s),a=0;a<s;a++)i[a]=arguments[a+2];n.children=i}return g(t.type,u,n)};o.createContext=function(t){return t={$$typeof:at,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null},t.Provider=t,t.Consumer={$$typeof:ct,_context:t},t};o.createElement=function(t,e,r){var n,u={},s=null;if(e!=null)for(n in e.key!==void 0&&(s=""+e.key),e)k.call(e,n)&&n!=="key"&&n!=="__self"&&n!=="__source"&&(u[n]=e[n]);var i=arguments.length-2;if(i===1)u.children=r;else if(1<i){for(var a=Array(i),c=0;c<i;c++)a[c]=arguments[c+2];u.children=a}if(t&&t.defaultProps)for(n in i=t.defaultProps,i)u[n]===void 0&&(u[n]=i[n]);return g(t,s,u)};o.createRef=function(){return{current:null}};o.forwardRef=function(t){return{$$typeof:lt,render:t}};o.isValidElement=A;o.lazy=function(t){return{$$typeof:$,_payload:{_status:-1,_result:t},_init:ht}};o.memo=function(t,e){return{$$typeof:yt,type:t,compare:e===void 0?null:e}};o.startTransition=function(t){var e=f.T,r={};f.T=r;try{var n=t(),u=f.S;u!==null&&u(r,n),typeof n=="object"&&n!==null&&typeof n.then=="function"&&n.then(R,j)}catch(s){j(s)}finally{e!==null&&r.types!==null&&(e.types=r.types),f.T=e}};o.unstable_useCacheRefresh=function(){return f.H.useCacheRefresh()};o.use=function(t){return f.H.use(t)};o.useActionState=function(t,e,r){return f.H.useActionState(t,e,r)};o.useCallback=function(t,e){return f.H.useCallback(t,e)};o.useContext=function(t){return f.H.useContext(t)};o.useDebugValue=function(){};o.useDeferredValue=function(t,e){return f.H.useDeferredValue(t,e)};o.useEffect=function(t,e){return f.H.useEffect(t,e)};o.useEffectEvent=function(t){return f.H.useEffectEvent(t)};o.useId=function(){return f.H.useId()};o.useImperativeHandle=function(t,e,r){return f.H.useImperativeHandle(t,e,r)};o.useInsertionEffect=function(t,e){return f.H.useInsertionEffect(t,e)};o.useLayoutEffect=function(t,e){return f.H.useLayoutEffect(t,e)};o.useMemo=function(t,e){return f.H.useMemo(t,e)};o.useOptimistic=function(t,e){return f.H.useOptimistic(t,e)};o.useReducer=function(t,e,r){return f.H.useReducer(t,e,r)};o.useRef=function(t){return f.H.useRef(t)};o.useState=function(t){return f.H.useState(t)};o.useSyncExternalStore=function(t,e,r){return f.H.useSyncExternalStore(t,e,r)};o.useTransition=function(){return f.H.useTransition()};o.version="19.2.4"});var z=I((bt,q)=>{"use strict";q.exports=U()});var wt={};d(wt,{dateTimeFormat:()=>ot,getInteractiveContent:()=>E,getRoleContent:()=>G,useInteractiveChildrenNeedDescription:()=>Ct,useNoInteractiveChildren:()=>Rt});module.exports=J(wt);var v={};d(v,{format:()=>V});function V(t,e){let r=new Intl.RelativeTimeFormat(e?.locale,{style:e?.style??"long"}),n=typeof t=="number"?new Date(t):t,u=Date.now(),s=Math.floor((u-n.getTime())/1e3),i=Math.floor(s/60),a=Math.floor(i/60),c=Math.floor(a/24),y=Math.floor(c/7),M=Math.floor(y/4),K=Math.floor(c/365);return Math.abs(s)<60?new Intl.RelativeTimeFormat(e?.locale,{numeric:"auto",style:e?.style??"long"}).format(0,"seconds"):Math.abs(i)<60?r.format(i*-1,"minutes"):Math.abs(a)<24?r.format(a*-1,"hours"):Math.abs(c)<7?r.format(c*-1,"days"):Math.abs(y)<4?r.format(y*-1,"weeks"):Math.abs(M)<12?r.format(M*-1,"months"):r.format(K*-1,"years")}var h={};d(h,{format:()=>rt,formatDate:()=>et,formatRange:()=>nt,formatTime:()=>tt});function tt(t,e){return new Intl.DateTimeFormat(e?.locale,{timeStyle:e?.style??"short"}).format(t)}function et(t,e){return new Intl.DateTimeFormat(e?.locale,{dateStyle:e?.style??"medium"}).format(t)}function rt(t,e){let r=e?.timeStyle??(e?.style==="tooltip"?"long":e?.style)??"short",n=e?.dateStyle??(e?.style==="tooltip"?"full":e?.style)??"medium";return new Intl.DateTimeFormat(e?.locale,{timeStyle:r,dateStyle:n}).format(t)}function nt(t,e,r){let n=r?.timeStyle===null?void 0:r?.timeStyle??r?.style??"short",u=r?.dateStyle===null?void 0:r?.dateStyle??r?.style??"medium";return new Intl.DateTimeFormat(r?.locale,{timeStyle:n,dateStyle:u}).formatRange(t,e)}var ot={relative:v,absolute:h};var N=Z(z());function Rt(t,e="component should have no interactive child nodes"){__DEV__&&(0,N.useEffect)(()=>{let r=t.current?E(t.current):!1;if(r)throw new Error(`Error: ${e}.
|
|
2
|
+
|
|
3
|
+
Instead found: ${r.outerHTML}`)})}function Ct(t,e="interactive child node(s) should have an `aria-describedby` property"){__DEV__&&(0,N.useEffect)(()=>{let r=t.current?E(t.current):!1;if(r&&!r.hasAttribute("aria-describedby"))throw new Error(`Error: ${e}.
|
|
4
|
+
|
|
5
|
+
Instead found: ${r.outerHTML}`)})}function E(t){if(!t||!t.childNodes)return null;if(St(t))return t;for(let e of t.childNodes){let r=E(e);if(r)return r}return null}function G(t){if(!t||!t.childNodes)return null;if(t?.getAttribute?.("role")&&t.getAttribute("role")!=="")return t;for(let e of t.childNodes){let r=G(e);if(r)return r}return null}function St(t){if(t.tabIndex===void 0||t.tabIndex<0||t.disabled)return!1;switch(t.nodeName){case"A":return!!t.href&&t.rel!=="ignore";case"INPUT":return t.type!=="hidden";default:return!0}}
|
|
6
|
+
/*! Bundled license information:
|
|
7
|
+
|
|
8
|
+
react/cjs/react.production.js:
|
|
9
|
+
(**
|
|
10
|
+
* @license React
|
|
11
|
+
* react.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*)
|
|
18
|
+
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright OctaviaFlow
|
|
3
|
+
* Author: Vishal Kumar
|
|
4
|
+
* Created: 11/November/2025
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";var o=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var l=(r,e)=>{for(var t in e)o(r,t,{get:e[t],enumerable:!0})},h=(r,e,t,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of f(e))!a.call(r,n)&&n!==t&&o(r,n,{get:()=>e[n],enumerable:!(c=s(e,n))||c.enumerable});return r};var N=r=>h(o({},"__esModule",{value:!0}),r);var I={};l(I,{getInteractiveContent:()=>i,getRoleContent:()=>d,useInteractiveChildrenNeedDescription:()=>p,useNoInteractiveChildren:()=>b});module.exports=N(I);var u=require("react");function b(r,e="component should have no interactive child nodes"){__DEV__&&(0,u.useEffect)(()=>{const t=r.current?i(r.current):!1;if(t)throw new Error(`Error: ${e}.
|
|
11
|
+
|
|
12
|
+
Instead found: ${t.outerHTML}`)})}function p(r,e="interactive child node(s) should have an `aria-describedby` property"){__DEV__&&(0,u.useEffect)(()=>{const t=r.current?i(r.current):!1;if(t&&!t.hasAttribute("aria-describedby"))throw new Error(`Error: ${e}.
|
|
13
|
+
|
|
14
|
+
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 d(r){if(!r||!r.childNodes)return null;if(r?.getAttribute?.("role")&&r.getAttribute("role")!=="")return r;for(const e of r.childNodes){const t=d(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
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@octaviaflow/utilities-react",
|
|
3
|
+
"description": "Utilities and helpers to drive consistency across software products using the OctaviaFlow Design System with React",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"module": "es/index.js",
|
|
8
|
+
"types": "types/index.d.ts",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/octaviaflow-design-system.git",
|
|
12
|
+
"directory": "packages/utilities-react"
|
|
13
|
+
},
|
|
14
|
+
"bugs": "https://github.com/octaviaflow-design-system/issues",
|
|
15
|
+
"files": [
|
|
16
|
+
"es",
|
|
17
|
+
"lib",
|
|
18
|
+
"telemetry.yml"
|
|
19
|
+
],
|
|
20
|
+
"keywords": [
|
|
21
|
+
"octaviaflow",
|
|
22
|
+
"octaviaflow-design-system",
|
|
23
|
+
"octaviaflow-utilities",
|
|
24
|
+
"octaviaflow-react"
|
|
25
|
+
],
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build:es": "esbuild src/index.ts --bundle --minify --outdir=es --target=es2020 --format=esm",
|
|
31
|
+
"build:cjs": "esbuild src/index.ts --bundle --minify --outdir=lib --target=es2020 --format=cjs",
|
|
32
|
+
"build:types": "tsc",
|
|
33
|
+
"build": "bun run build:es & bun run build:cjs & bun run build:types",
|
|
34
|
+
"watch": "bun run build:es --watch & bun run build:cjs --watch",
|
|
35
|
+
"clean": "rimraf es lib"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"react": "^19.2.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"esbuild": "^0.24.0",
|
|
42
|
+
"rimraf": "^6.0.0",
|
|
43
|
+
"typescript": "^4.8.4",
|
|
44
|
+
"typescript-config-octaviaflow": "^0.0.1"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@octaviaflow/utilities": "^1.0.0"
|
|
48
|
+
}
|
|
49
|
+
}
|
package/telemetry.yml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://unpkg.com/@octaviaflow/telemetry-config-schema@v1/dist/config.schema.json
|
|
2
|
+
version: 1
|
|
3
|
+
projectId: 'octaviaflow-utilities-react'
|
|
4
|
+
storage:
|
|
5
|
+
type: 'file'
|
|
6
|
+
file:
|
|
7
|
+
directory: '/Volumes/Main/Projects/OctaviaFlow-Design-System/telemetry-logs'
|
|
8
|
+
fileNamePattern: 'octaviaflow-utilities-react-{timestamp}.json'
|
|
9
|
+
maxFileSizeMB: 10
|
|
10
|
+
compress: false
|
|
11
|
+
collect:
|
|
12
|
+
npm:
|
|
13
|
+
dependencies: null
|
|
14
|
+
js:
|
|
15
|
+
functions: {}
|
|
16
|
+
tokens: null
|