@radix-ui/react-primitive 0.1.5-rc.2 → 0.1.5-rc.3
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/dist/index.d.ts.map +1 -1
- package/dist/index.js +73 -1
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +54 -1
- package/dist/index.module.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";AAGA,QAAA,MAAM,sGAcI,CAAC;AAKX,qBAAqB,CAAC,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,KAAK,SAAS,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;AAC7G,qCAA8B,CAAC,SAAS,MAAM,WAAW,IAAI,gBAC3D,MAAM,cAAc,CAAC,CAAC,CAAC,CACxB,CAAC;AAEF,kBAAkB;KAAG,CAAC,IAAI,YAAY,CAAC,MAAM,CAAC,GAAG,6BAA6B,CAAC,CAAC;CAAE,CAAC;AACnF,kCAA2B,CAAC,SAAS,MAAM,WAAW,IAAI,MAAM,qBAAqB,CAAC,CAAC,CAAC,GAAG;IACzF,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,uCAAuC,CAAC,SAAS,MAAM,WAAW,CAChE,SAAQ,KAAK,CAAC,yBAAyB,CAAC,sBAAsB,CAAC,CAAC,CAAC;CAAG;AAMtE,OAAA,MAAM,qBAoBL,CAAC;AAMF,OAAA,MAAM,gBAAgB,CAAC","sources":["packages/react/primitive/src/packages/react/primitive/src/Primitive.tsx","packages/react/primitive/src/packages/react/primitive/src/index.ts","packages/react/primitive/src/index.ts"],"sourcesContent":[null,null,"export * from './Primitive';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,74 @@
|
|
|
1
|
-
var
|
|
1
|
+
var $iMixA$babelruntimehelpersextends = require("@babel/runtime/helpers/extends");
|
|
2
|
+
var $iMixA$react = require("react");
|
|
3
|
+
var $iMixA$radixuireactslot = require("@radix-ui/react-slot");
|
|
4
|
+
|
|
5
|
+
function $parcel$exportWildcard(dest, source) {
|
|
6
|
+
Object.keys(source).forEach(function(key) {
|
|
7
|
+
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
Object.defineProperty(dest, key, {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function get() {
|
|
14
|
+
return source[key];
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
return dest;
|
|
20
|
+
}
|
|
21
|
+
function $parcel$interopDefault(a) {
|
|
22
|
+
return a && a.__esModule ? a.default : a;
|
|
23
|
+
}
|
|
24
|
+
function $parcel$export(e, n, v, s) {
|
|
25
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
26
|
+
}
|
|
27
|
+
var $c3def6332c2749a6$exports = {};
|
|
28
|
+
|
|
29
|
+
$parcel$export($c3def6332c2749a6$exports, "Primitive", () => $c3def6332c2749a6$export$250ffa63cdc0d034);
|
|
30
|
+
$parcel$export($c3def6332c2749a6$exports, "Root", () => $c3def6332c2749a6$export$be92b6f5f03c0fe9);
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
const $c3def6332c2749a6$var$NODES = [
|
|
35
|
+
'a',
|
|
36
|
+
'button',
|
|
37
|
+
'div',
|
|
38
|
+
'h2',
|
|
39
|
+
'h3',
|
|
40
|
+
'img',
|
|
41
|
+
'li',
|
|
42
|
+
'nav',
|
|
43
|
+
'ol',
|
|
44
|
+
'p',
|
|
45
|
+
'span',
|
|
46
|
+
'svg',
|
|
47
|
+
'ul'
|
|
48
|
+
]; // Temporary while we await merge of this fix:
|
|
49
|
+
// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396
|
|
50
|
+
// prettier-ignore
|
|
51
|
+
/* -------------------------------------------------------------------------------------------------
|
|
52
|
+
* Primitive
|
|
53
|
+
* -----------------------------------------------------------------------------------------------*/ const $c3def6332c2749a6$export$250ffa63cdc0d034 = $c3def6332c2749a6$var$NODES.reduce((primitive, node)=>({
|
|
54
|
+
...primitive,
|
|
55
|
+
[node]: /*#__PURE__*/ $iMixA$react.forwardRef((props, forwardedRef)=>{
|
|
56
|
+
const { asChild: asChild , ...primitiveProps } = props;
|
|
57
|
+
const Comp = asChild ? $iMixA$radixuireactslot.Slot : node;
|
|
58
|
+
$iMixA$react.useEffect(()=>{
|
|
59
|
+
window[Symbol.for('radix-ui')] = true;
|
|
60
|
+
}, []); // DEPRECATED
|
|
61
|
+
return /*#__PURE__*/ $iMixA$react.createElement(Comp, ($parcel$interopDefault($iMixA$babelruntimehelpersextends))({}, primitiveProps, {
|
|
62
|
+
ref: forwardedRef
|
|
63
|
+
}));
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
, {});
|
|
67
|
+
/* -----------------------------------------------------------------------------------------------*/ const $c3def6332c2749a6$var$AS_ERROR = `Warning: The \`as\` prop has been removed in favour of \`asChild\`. For details, see https://radix-ui.com/docs/primitives/overview/styling#changing-the-rendered-element`;
|
|
68
|
+
const $c3def6332c2749a6$export$be92b6f5f03c0fe9 = $c3def6332c2749a6$export$250ffa63cdc0d034;
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
$parcel$exportWildcard(module.exports, $c3def6332c2749a6$exports);
|
|
72
|
+
|
|
73
|
+
|
|
2
74
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A;;;ACGA,MAAME,2BAAK,GAAG;IACZ,GADY;IAEZ,QAFY;IAGZ,KAHY;IAIZ,IAJY;IAKZ,IALY;IAMZ,KANY;IAOZ,IAPY;IAQZ,KARY;IASZ,IATY;IAUZ,GAVY;IAWZ,MAXY;IAYZ,KAZY;IAaZ,IAbY;CAAd,A,EAgBA,8CAhBA;AAiBA,gEAAA;AACA,kBAAA;AAcA;;oGAEA,CAEA,MAAMC,yCAAS,GAAGD,2BAAK,CAACE,MAAN,CAChB,CAACC,SAAD,EAAYC,IAAZ,GAAsB,CAAA;QACpB,GAAGD,SADiB;QAEpB,CAACC,IAAD,CAAA,EAAA,aAAQN,CAAAA,uBAAA,CAAiB,CAACQ,KAAD,EAA4CC,YAA5C,GAAkE;YACzF,MAAM,E,SAAEC,OAAF,CAAA,EAAW,GAAGC,cAAH,EAAX,GAAiCH,KAAvC,AAAM;YACN,MAAMI,IAAS,GAAGF,OAAO,GAAGT,4BAAH,GAAUK,IAAnC,AAAA;YAEAN,sBAAA,CAAgB,IAAM;gBACnBc,MAAD,CAAgBC,MAAM,CAACC,GAAP,CAAW,UAAX,CAAhB,CAAA,GAA0C,IAA1C,CAACF;aADH,EAEG,EAFH,CAAA,CAJyF,CAQzF,aAFC;YAOD,OAAA,aAAO,CAAA,0BAAA,CAAC,IAAD,EAAA,2DAAA,CAAA,EAAA,EAAUH,cAAV,EAAP;gBAAiC,GAAG,EAAEF,YAAL;aAA1B,CAAA,CAAP,CAAO;SAbD,CAcP;KAhBH,CAAA;AADgB,EAmBhB,EAnBgB,CAAlB,AACwB;AAqBxB,oGAAA,CAEA,MAAMc,8BAAQ,GAAI,CAAA,wKAAA,CAAlB,AAAA;AAEA,MAAMC,yCAAI,GAAGrB,yCAAb,AAAA;;ADjEA","sources":["packages/react/primitive/src/index.ts","packages/react/primitive/src/Primitive.tsx"],"sourcesContent":["export * from './Primitive';\n","import * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\n\nconst NODES = [\n 'a',\n 'button',\n 'div',\n 'h2',\n 'h3',\n 'img',\n 'li',\n 'nav',\n 'ol',\n 'p',\n 'span',\n 'svg',\n 'ul',\n] as const;\n\n// Temporary while we await merge of this fix:\n// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396\n// prettier-ignore\ntype PropsWithoutRef<P> = P extends any ? ('ref' extends keyof P ? Pick<P, Exclude<keyof P, 'ref'>> : P) : P;\ntype ComponentPropsWithoutRef<T extends React.ElementType> = PropsWithoutRef<\n React.ComponentProps<T>\n>;\n\ntype Primitives = { [E in typeof NODES[number]]: PrimitiveForwardRefComponent<E> };\ntype PrimitivePropsWithRef<E extends React.ElementType> = React.ComponentPropsWithRef<E> & {\n asChild?: boolean;\n};\n\ninterface PrimitiveForwardRefComponent<E extends React.ElementType>\n extends React.ForwardRefExoticComponent<PrimitivePropsWithRef<E>> {}\n\n/* -------------------------------------------------------------------------------------------------\n * Primitive\n * -----------------------------------------------------------------------------------------------*/\n\nconst Primitive = NODES.reduce(\n (primitive, node) => ({\n ...primitive,\n [node]: React.forwardRef((props: PrimitivePropsWithRef<typeof node>, forwardedRef: any) => {\n const { asChild, ...primitiveProps } = props;\n const Comp: any = asChild ? Slot : node;\n\n React.useEffect(() => {\n (window as any)[Symbol.for('radix-ui')] = true;\n }, []);\n\n // DEPRECATED\n if (process.env.NODE_ENV === 'development' && (props as any).as) {\n console.warn(AS_ERROR);\n }\n\n return <Comp {...primitiveProps} ref={forwardedRef} />;\n }),\n }),\n {} as Primitives\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst AS_ERROR = `Warning: The \\`as\\` prop has been removed in favour of \\`asChild\\`. For details, see https://radix-ui.com/docs/primitives/overview/styling#changing-the-rendered-element`;\n\nconst Root = Primitive;\n\nexport {\n Primitive,\n //\n Root,\n};\nexport type { ComponentPropsWithoutRef, PrimitivePropsWithRef };\n"],"names":["React","Slot","NODES","Primitive","reduce","primitive","node","forwardRef","props","forwardedRef","asChild","primitiveProps","Comp","useEffect","window","Symbol","for","process","env","NODE_ENV","as","console","warn","AS_ERROR","Root"],"version":3,"file":"index.js.map"}
|
package/dist/index.module.js
CHANGED
|
@@ -1,2 +1,55 @@
|
|
|
1
|
-
import
|
|
1
|
+
import $4q5Fq$babelruntimehelpersesmextends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import {forwardRef as $4q5Fq$forwardRef, useEffect as $4q5Fq$useEffect, createElement as $4q5Fq$createElement} from "react";
|
|
3
|
+
import {Slot as $4q5Fq$Slot} from "@radix-ui/react-slot";
|
|
4
|
+
|
|
5
|
+
function $parcel$export(e, n, v, s) {
|
|
6
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
7
|
+
}
|
|
8
|
+
var $8927f6f2acc4f386$exports = {};
|
|
9
|
+
|
|
10
|
+
$parcel$export($8927f6f2acc4f386$exports, "Primitive", () => $8927f6f2acc4f386$export$250ffa63cdc0d034);
|
|
11
|
+
$parcel$export($8927f6f2acc4f386$exports, "Root", () => $8927f6f2acc4f386$export$be92b6f5f03c0fe9);
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const $8927f6f2acc4f386$var$NODES = [
|
|
16
|
+
'a',
|
|
17
|
+
'button',
|
|
18
|
+
'div',
|
|
19
|
+
'h2',
|
|
20
|
+
'h3',
|
|
21
|
+
'img',
|
|
22
|
+
'li',
|
|
23
|
+
'nav',
|
|
24
|
+
'ol',
|
|
25
|
+
'p',
|
|
26
|
+
'span',
|
|
27
|
+
'svg',
|
|
28
|
+
'ul'
|
|
29
|
+
]; // Temporary while we await merge of this fix:
|
|
30
|
+
// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396
|
|
31
|
+
// prettier-ignore
|
|
32
|
+
/* -------------------------------------------------------------------------------------------------
|
|
33
|
+
* Primitive
|
|
34
|
+
* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node)=>({
|
|
35
|
+
...primitive,
|
|
36
|
+
[node]: /*#__PURE__*/ $4q5Fq$forwardRef((props, forwardedRef)=>{
|
|
37
|
+
const { asChild: asChild , ...primitiveProps } = props;
|
|
38
|
+
const Comp = asChild ? $4q5Fq$Slot : node;
|
|
39
|
+
$4q5Fq$useEffect(()=>{
|
|
40
|
+
window[Symbol.for('radix-ui')] = true;
|
|
41
|
+
}, []); // DEPRECATED
|
|
42
|
+
return /*#__PURE__*/ $4q5Fq$createElement(Comp, $4q5Fq$babelruntimehelpersesmextends({}, primitiveProps, {
|
|
43
|
+
ref: forwardedRef
|
|
44
|
+
}));
|
|
45
|
+
})
|
|
46
|
+
})
|
|
47
|
+
, {});
|
|
48
|
+
/* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$var$AS_ERROR = `Warning: The \`as\` prop has been removed in favour of \`asChild\`. For details, see https://radix-ui.com/docs/primitives/overview/styling#changing-the-rendered-element`;
|
|
49
|
+
const $8927f6f2acc4f386$export$be92b6f5f03c0fe9 = $8927f6f2acc4f386$export$250ffa63cdc0d034;
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
export {$8927f6f2acc4f386$export$250ffa63cdc0d034 as Primitive, $8927f6f2acc4f386$export$be92b6f5f03c0fe9 as Root};
|
|
2
55
|
//# sourceMappingURL=index.module.js.map
|
package/dist/index.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;A;;;ACGA,MAAME,2BAAK,GAAG;IACZ,GADY;IAEZ,QAFY;IAGZ,KAHY;IAIZ,IAJY;IAKZ,IALY;IAMZ,KANY;IAOZ,IAPY;IAQZ,KARY;IASZ,IATY;IAUZ,GAVY;IAWZ,MAXY;IAYZ,KAZY;IAaZ,IAbY;CAAd,A,EAgBA,8CAhBA;AAiBA,gEAAA;AACA,kBAAA;AAcA;;oGAEA,CAEA,MAAMC,yCAAS,GAAGD,2BAAK,CAACE,MAAN,CAChB,CAACC,SAAD,EAAYC,IAAZ,GAAsB,CAAA;QACpB,GAAGD,SADiB;QAEpB,CAACC,IAAD,CAAA,EAAA,aAAQN,CAAAA,iBAAA,CAAiB,CAACQ,KAAD,EAA4CC,YAA5C,GAAkE;YACzF,MAAM,E,SAAEC,OAAF,CAAA,EAAW,GAAGC,cAAH,EAAX,GAAiCH,KAAvC,AAAM;YACN,MAAMI,IAAS,GAAGF,OAAO,GAAGT,WAAH,GAAUK,IAAnC,AAAA;YAEAN,gBAAA,CAAgB,IAAM;gBACnBc,MAAD,CAAgBC,MAAM,CAACC,GAAP,CAAW,UAAX,CAAhB,CAAA,GAA0C,IAA1C,CAACF;aADH,EAEG,EAFH,CAAA,CAJyF,CAQzF,aAFC;YAOD,OAAA,aAAO,CAAA,oBAAA,CAAC,IAAD,EAAA,oCAAA,CAAA,EAAA,EAAUH,cAAV,EAAP;gBAAiC,GAAG,EAAEF,YAAL;aAA1B,CAAA,CAAP,CAAO;SAbD,CAcP;KAhBH,CAAA;AADgB,EAmBhB,EAnBgB,CAAlB,AACwB;AAqBxB,oGAAA,CAEA,MAAMc,8BAAQ,GAAI,CAAA,wKAAA,CAAlB,AAAA;AAEA,MAAMC,yCAAI,GAAGrB,yCAAb,AAAA;;ADjEA","sources":["packages/react/primitive/src/index.ts","packages/react/primitive/src/Primitive.tsx"],"sourcesContent":["export * from './Primitive';\n","import * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\n\nconst NODES = [\n 'a',\n 'button',\n 'div',\n 'h2',\n 'h3',\n 'img',\n 'li',\n 'nav',\n 'ol',\n 'p',\n 'span',\n 'svg',\n 'ul',\n] as const;\n\n// Temporary while we await merge of this fix:\n// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396\n// prettier-ignore\ntype PropsWithoutRef<P> = P extends any ? ('ref' extends keyof P ? Pick<P, Exclude<keyof P, 'ref'>> : P) : P;\ntype ComponentPropsWithoutRef<T extends React.ElementType> = PropsWithoutRef<\n React.ComponentProps<T>\n>;\n\ntype Primitives = { [E in typeof NODES[number]]: PrimitiveForwardRefComponent<E> };\ntype PrimitivePropsWithRef<E extends React.ElementType> = React.ComponentPropsWithRef<E> & {\n asChild?: boolean;\n};\n\ninterface PrimitiveForwardRefComponent<E extends React.ElementType>\n extends React.ForwardRefExoticComponent<PrimitivePropsWithRef<E>> {}\n\n/* -------------------------------------------------------------------------------------------------\n * Primitive\n * -----------------------------------------------------------------------------------------------*/\n\nconst Primitive = NODES.reduce(\n (primitive, node) => ({\n ...primitive,\n [node]: React.forwardRef((props: PrimitivePropsWithRef<typeof node>, forwardedRef: any) => {\n const { asChild, ...primitiveProps } = props;\n const Comp: any = asChild ? Slot : node;\n\n React.useEffect(() => {\n (window as any)[Symbol.for('radix-ui')] = true;\n }, []);\n\n // DEPRECATED\n if (process.env.NODE_ENV === 'development' && (props as any).as) {\n console.warn(AS_ERROR);\n }\n\n return <Comp {...primitiveProps} ref={forwardedRef} />;\n }),\n }),\n {} as Primitives\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst AS_ERROR = `Warning: The \\`as\\` prop has been removed in favour of \\`asChild\\`. For details, see https://radix-ui.com/docs/primitives/overview/styling#changing-the-rendered-element`;\n\nconst Root = Primitive;\n\nexport {\n Primitive,\n //\n Root,\n};\nexport type { ComponentPropsWithoutRef, PrimitivePropsWithRef };\n"],"names":["React","Slot","NODES","Primitive","reduce","primitive","node","forwardRef","props","forwardedRef","asChild","primitiveProps","Comp","useEffect","window","Symbol","for","process","env","NODE_ENV","as","console","warn","AS_ERROR","Root"],"version":3,"file":"index.module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radix-ui/react-primitive",
|
|
3
|
-
"version": "0.1.5-rc.
|
|
3
|
+
"version": "0.1.5-rc.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/runtime": "^7.13.10",
|
|
20
|
-
"@radix-ui/react-slot": "0.1.3-rc.
|
|
20
|
+
"@radix-ui/react-slot": "0.1.3-rc.3"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@testing-library/react": "^10.4.8"
|