@radix-ui/react-primitive 0.0.14 → 0.1.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/dist/index.d.ts +13 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +1 -1
- package/dist/index.module.js.map +1 -1
- package/package.json +2 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import * as Polymorphic from "@radix-ui/react-polymorphic";
|
|
2
1
|
import * as React from "react";
|
|
3
|
-
declare const
|
|
4
|
-
type
|
|
5
|
-
export type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
declare const NODES: readonly ["a", "button", "div", "h2", "h3", "p", "img", "span", "svg"];
|
|
3
|
+
type PropsWithoutRef<P> = P extends any ? ('ref' extends keyof P ? Pick<P, Exclude<keyof P, 'ref'>> : P) : P;
|
|
4
|
+
export type ComponentPropsWithoutRef<T extends React.ElementType> = PropsWithoutRef<React.ComponentProps<T>>;
|
|
5
|
+
type Primitives = {
|
|
6
|
+
[E in typeof NODES[number]]: PrimitiveForwardRefComponent<E>;
|
|
7
|
+
};
|
|
8
|
+
export type PrimitivePropsWithRef<E extends React.ElementType> = React.ComponentPropsWithRef<E> & {
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
};
|
|
11
|
+
interface PrimitiveForwardRefComponent<E extends React.ElementType> extends React.ForwardRefExoticComponent<PrimitivePropsWithRef<E>> {
|
|
12
|
+
}
|
|
13
|
+
export const Primitive: Primitives;
|
|
14
|
+
export const Root: Primitives;
|
|
16
15
|
|
|
17
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"A;
|
|
1
|
+
{"mappings":"A;AAGA,QAAA,MAAM,6EAA8E,CAAC;AAKrF,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,qBAWL,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"],"sourcesContent":[null,null],"names":[],"version":3,"file":"index.d.ts.map"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e,r,t,
|
|
1
|
+
var e,r,t,o=require("@radix-ui/react-slot").Slot,i=(e={},r=require("react"),Object.keys(r).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})})),e),n=(t=require("@babel/runtime/helpers/extends"))&&t.__esModule?t.default:t;const s=["a","button","div","h2","h3","p","img","span","svg"].reduce(((e,r)=>({...e,[r]:/*#__PURE__*/i.forwardRef(((e,t)=>{const{asChild:s,...d}=e,u=s?o:r;return e.as&&console.error(a),/*#__PURE__*/i.createElement(u,n({},d,{ref:t}))}))})),{});exports.Primitive=s;const a="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",d=s;exports.Root=d;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"IAYgCA,EAAMC,EAZNC,
|
|
1
|
+
{"mappings":"IAYgCA,EAAMC,EAZNC,4CAYAF,KAAMC,mBACpCE,OAAOC,KAAKH,GAAQI,SAAQ,SAASC,GACvB,YAARA,GAA6B,eAARA,GAIzBH,OAAOI,eAAeP,EAAMM,EAAK,CAC/BE,YAAY,EACZC,IAAK,WACH,OAAOR,EAAOK,SAKbN,MA1BuBE,8CAClBA,EAAEQ,WAAaR,EAAES,QAAUT,ECEzC,MAsBMU,EAtBQ,CAAC,IAAK,SAAU,MAAO,KAAM,KAAM,IAAK,MAAO,OAAQ,OAsB7CC,QACtB,CAACC,EAAWC,KAAZ,IACKD,EACHC,CAACA,gBAAOC,EAAMC,YAAW,CAACC,EAA2CC,KACnE,MAAMC,QAAEA,KAAYC,GAAmBH,EACjCI,EAAYF,EAAUG,EAAOR,EAEnC,OADKG,EAAcM,IAAIC,QAAQC,MAAMC,gBAC9BC,EAAAC,cAACP,EAADQ,EAAA,GAAUT,EAAV,CAA0BU,IAAKZ,WAG1C,wBAKF,MAAMQ,EAAY,uKAEZK,EAAOpB","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/react/primitive/src/Primitive.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$reexport(e, n, v) {\n Object.defineProperty(e, n, {get: v, enumerable: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n","import * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\n\nconst NODES = ['a', 'button', 'div', 'h2', 'h3', 'p', 'img', 'span', 'svg'] 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 if ((props as any).as) console.error(AS_ERROR);\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":["dest","source","a","Object","keys","forEach","key","defineProperty","enumerable","get","__esModule","default","Primitive","reduce","primitive","node","React","forwardRef","props","forwardedRef","asChild","primitiveProps","Comp","Slot","as","console","error","AS_ERROR","_react","createElement","_babelRuntimeHelpersExtends","ref","Root"],"version":3,"file":"index.js.map"}
|
package/dist/index.module.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{Slot as e}from"@radix-ui/react-slot";import*as r from"react";import t from"@babel/runtime/helpers/esm/extends";export const Primitive=["a","button","div","h2","h3","p","img","span","svg"].reduce(((i,s)=>({...i,[s]:/*#__PURE__*/r.forwardRef(((i,n)=>{const{asChild:a,...m}=i,d=a?e:s;return i.as&&console.error(o),/*#__PURE__*/r.createElement(d,t({},m,{ref:n}))}))})),{});const o="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";export const Root=Primitive;
|
|
2
2
|
//# sourceMappingURL=index.module.js.map
|
package/dist/index.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":"6HAyBA,MAAMA,UAtBQ,CAAC,IAAK,SAAU,MAAO,KAAM,KAAM,IAAK,MAAO,OAAQ,OAsB7CC,QACtB,CAACC,EAAWC,KAAZ,IACKD,EACHC,CAACA,gBAAOC,EAAMC,YAAW,CAACC,EAA2CC,KACnE,MAAMC,QAAEA,KAAYC,GAAmBH,EACjCI,EAAYF,EAAUG,EAAOR,EAEnC,OADKG,EAAcM,IAAIC,QAAQC,MAAMC,gBAC9BC,EAAAC,cAACP,EAADQ,EAAA,GAAUT,EAAV,CAA0BU,IAAKZ,WAG1C,IAKF,MAAMQ,EAAY,8KAElB,MAAMK,KAAOpB","sources":["./packages/react/primitive/src/Primitive.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\n\nconst NODES = ['a', 'button', 'div', 'h2', 'h3', 'p', 'img', 'span', 'svg'] 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 if ((props as any).as) console.error(AS_ERROR);\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":["Primitive","reduce","primitive","node","React","forwardRef","props","forwardedRef","asChild","primitiveProps","Comp","Slot","as","console","error","AS_ERROR","_react","createElement","_babelRuntimeHelpersEsmExtends","ref","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.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,12 +13,11 @@
|
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"scripts": {
|
|
15
15
|
"clean": "rm -rf dist",
|
|
16
|
-
"prepublish": "yarn clean",
|
|
17
16
|
"version": "yarn version"
|
|
18
17
|
},
|
|
19
18
|
"dependencies": {
|
|
20
19
|
"@babel/runtime": "^7.13.10",
|
|
21
|
-
"@radix-ui/react-
|
|
20
|
+
"@radix-ui/react-slot": "0.1.0"
|
|
22
21
|
},
|
|
23
22
|
"devDependencies": {
|
|
24
23
|
"@testing-library/react": "^10.4.8"
|