@nimbus-ds/typings 1.1.0-rc.3 → 1.2.0-rc.1
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/CHANGELOG.md +1 -1
- package/dist/index.d.ts +49 -0
- package/dist/index.js +2 -0
- package/package.json +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,7 +6,7 @@ This package is intended for internal use in creating components with polymorphi
|
|
|
6
6
|
|
|
7
7
|
### 🎉 New features
|
|
8
8
|
|
|
9
|
-
- Added useRefObjectAsForwardedRef hook used to sync ref object with forwarded ref and allow local access to instance reference with `.current`. ([#
|
|
9
|
+
- Added useRefObjectAsForwardedRef hook used to sync ref object with forwarded ref and allow local access to instance reference with `.current`. ([#134](https://github.com/TiendaNube/nimbus-design-system/pull/134) by [@juniorconquista](https://github.com/juniorconquista))
|
|
10
10
|
|
|
11
11
|
## 2023-02-08 `1.0.0`
|
|
12
12
|
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v7.2.0
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { ForwardedRef, RefObject } from 'react';
|
|
5
|
+
|
|
6
|
+
export type Merge<P1 = {}, P2 = {}> = Omit<P1, keyof P2> & P2;
|
|
7
|
+
/**
|
|
8
|
+
* Infers the OwnProps if E is a ForwardRefExoticComponentWithAs
|
|
9
|
+
*/
|
|
10
|
+
export type OwnProps<E> = E extends PolymorphicForwardRefComponent<any, infer P> ? P : {};
|
|
11
|
+
/**
|
|
12
|
+
* Infers the JSX.IntrinsicElement if E is a ForwardRefExoticComponentWithAs
|
|
13
|
+
*/
|
|
14
|
+
export type IntrinsicElement<E> = E extends PolymorphicForwardRefComponent<infer I, any> ? I : never;
|
|
15
|
+
export type ForwardRefExoticComponent<E, OwnProps> = React.ForwardRefExoticComponent<Merge<E extends React.ElementType ? React.ComponentPropsWithRef<E> : never, OwnProps & {
|
|
16
|
+
as?: E;
|
|
17
|
+
}>>;
|
|
18
|
+
export interface PolymorphicForwardRefComponent<IntrinsicElementString, OwnProps = {}
|
|
19
|
+
/**
|
|
20
|
+
* Extends original type to ensure built in React types play nice
|
|
21
|
+
* with polymorphic components still e.g. `React.ElementRef` etc.
|
|
22
|
+
*/
|
|
23
|
+
> extends ForwardRefExoticComponent<IntrinsicElementString, OwnProps> {
|
|
24
|
+
/**
|
|
25
|
+
* When `as` prop is passed, use this overload.
|
|
26
|
+
* Merges original own props (without DOM props) and the inferred props
|
|
27
|
+
* from `as` element with the own props taking precendence.
|
|
28
|
+
*
|
|
29
|
+
* We explicitly avoid `React.ElementType` and manually narrow the prop types
|
|
30
|
+
* so that events are typed when using JSX.IntrinsicElements.
|
|
31
|
+
*/
|
|
32
|
+
<As = IntrinsicElementString>(props: As extends "" ? {
|
|
33
|
+
as: keyof JSX.IntrinsicElements;
|
|
34
|
+
} : As extends React.ComponentType<infer P> ? Merge<P, OwnProps & {
|
|
35
|
+
as: As;
|
|
36
|
+
}> : As extends keyof JSX.IntrinsicElements ? Merge<JSX.IntrinsicElements[As], OwnProps & {
|
|
37
|
+
as: As;
|
|
38
|
+
}> : never): React.ReactElement | null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Use a ref object as the imperative handle for a forwarded ref. This can be used to
|
|
42
|
+
* synchronize the ref object with the forwarded ref and allow local access the reference
|
|
43
|
+
* instance with `.current`.
|
|
44
|
+
*
|
|
45
|
+
* **NOTE**: The `refObject` should be passed to the underlying element, NOT the `forwardedRef`.
|
|
46
|
+
*/
|
|
47
|
+
export declare function useRefObjectAsForwardedRef<T>(forwardedRef: ForwardedRef<T>, refObject: RefObject<T>): void;
|
|
48
|
+
|
|
49
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("react")):"function"==typeof define&&define.amd?define(["react"],r):"object"==typeof exports?exports["@nimbus-ds/typings"]=r(require("react")):e["@nimbus-ds/typings"]=r(e.react)}(global,(e=>(()=>{"use strict";var r={155:r=>{r.exports=e}},t={};function o(e){var s=t[e];if(void 0!==s)return s.exports;var n=t[e]={exports:{}};return r[e](n,n.exports,o),n.exports}var s={};return(()=>{var e=s;Object.defineProperty(e,"__esModule",{value:!0}),e.useRefObjectAsForwardedRef=void 0;const r=o(155);e.useRefObjectAsForwardedRef=function(e,t){(0,r.useImperativeHandle)(e,(()=>t.current))}})(),s})()));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nimbus-ds/typings",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0-rc.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
"README.md"
|
|
9
9
|
],
|
|
10
10
|
"sideEffects": false,
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "yarn g:webpack",
|
|
13
|
+
"clean": "rm -rf dist",
|
|
14
|
+
"version": "yarn version"
|
|
15
|
+
},
|
|
11
16
|
"homepage": "https://nimbus.nuvemshop.com.br/documentation",
|
|
12
17
|
"repository": {
|
|
13
18
|
"type": "git",
|
|
@@ -16,5 +21,8 @@
|
|
|
16
21
|
"bugs": {
|
|
17
22
|
"url": "https://github.com/TiendaNube/nimbus-design-system/issues"
|
|
18
23
|
},
|
|
19
|
-
"
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@nimbus-ds/webpack": "^1.4.1-rc.1"
|
|
26
|
+
},
|
|
27
|
+
"stableVersion": "1.1.0"
|
|
20
28
|
}
|