@radix-ui/react-separator 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 +7 -6
- 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 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as Radix from "@radix-ui/react-primitive";
|
|
1
3
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
2
|
-
import * as Polymorphic from "@radix-ui/react-polymorphic";
|
|
3
4
|
declare const ORIENTATIONS: readonly ["horizontal", "vertical"];
|
|
4
5
|
type Orientation = typeof ORIENTATIONS[number];
|
|
5
|
-
type
|
|
6
|
+
type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
7
|
+
export interface SeparatorProps extends PrimitiveDivProps {
|
|
6
8
|
/**
|
|
7
9
|
* Either `vertical` or `horizontal`. Defaults to `horizontal`.
|
|
8
10
|
*/
|
|
@@ -12,9 +14,8 @@ type SeparatorOwnProps = Polymorphic.Merge<Polymorphic.OwnProps<typeof Primitive
|
|
|
12
14
|
* are updated so that that the rendered element is removed from the accessibility tree.
|
|
13
15
|
*/
|
|
14
16
|
decorative?: boolean;
|
|
15
|
-
}
|
|
16
|
-
export
|
|
17
|
-
export const
|
|
18
|
-
export const Root: SeparatorPrimitive;
|
|
17
|
+
}
|
|
18
|
+
export const Separator: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
export const Root: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
19
20
|
|
|
20
21
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"A;A;
|
|
1
|
+
{"mappings":"A;A;A;AAWA,QAAA,MAAM,iDAAkD,CAAC;AAEzD,mBAAmB,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAE/C,yBAAyB,MAAM,wBAAwB,CAAC,OAAO,UAAU,GAAG,CAAC,CAAC;AAC9E,+BAAyB,SAAQ,iBAAiB;IAChD;A;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;A;A;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,OAAA,MAAM,gGAiBJ,CAAC;AA8BH,OAAA,MAAM,2FAAgB,CAAC","sources":["./packages/react/separator/src/packages/react/separator/src/Separator.tsx","./packages/react/separator/src/packages/react/separator/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,n=require("@radix-ui/react-primitive").Primitive,o=(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),i=(t=require("@babel/runtime/helpers/extends"))&&t.__esModule?t.default:t;const a="horizontal",u=["horizontal","vertical"],l=/*#__PURE__*/o.forwardRef(((e,r)=>{const{decorative:t,orientation:u=a,...l}=e,d=c(u)?u:a,p=t?{role:"none"}:{"aria-orientation":"vertical"===d?d:void 0,role:"separator"};/*#__PURE__*/return o.createElement(n,i({
|
|
1
|
+
var e,r,t,n=require("@radix-ui/react-primitive").Primitive,o=(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),i=(t=require("@babel/runtime/helpers/extends"))&&t.__esModule?t.default:t;const a="horizontal",u=["horizontal","vertical"],l=/*#__PURE__*/o.forwardRef(((e,r)=>{const{decorative:t,orientation:u=a,...l}=e,d=c(u)?u:a,p=t?{role:"none"}:{"aria-orientation":"vertical"===d?d:void 0,role:"separator"};/*#__PURE__*/return o.createElement(n.div,i({"data-orientation":d},p,l,{ref:r}))}));function c(e){return u.includes(e)}exports.Separator=l,l.propTypes={orientation(e,r,t){const n=e[r],o=String(n);return n&&!c(n)?new Error(function(e,r){return`Invalid prop \`orientation\` of value \`${e}\` supplied to \`${r}\`, expected one of:\n - horizontal\n - vertical\n\nDefaulting to \`${a}\`.`}(o,t)):null}};const d=l;exports.Root=d;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"IAYgCA,EAAMC,EAZNC,sDAYAF,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,
|
|
1
|
+
{"mappings":"IAYgCA,EAAMC,EAZNC,sDAYAF,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,ECQzC,MACMU,EAAsB,aACtBC,EAAe,CAAC,aAAc,YAiB9BC,eAAYC,EAAMC,YAA6C,CAACC,EAAOC,KAC3E,MAAMC,WAAEA,EAAYC,YAAaC,EAAkBT,KAAwBU,GAAaL,EAClFG,EAAcG,EAAmBF,GAAmBA,EAAkBT,EAGtEY,EAAgBL,EAClB,CAAEM,KAAM,QACR,CAAE,mBAHkC,aAAhBL,EAA6BA,OAAcM,EAGxBD,KAAM,0BAEjD,OACEE,EAAAC,cAACC,EAAUC,IAAXC,EAAA,CACE,mBAAkBX,GACdI,EACAF,EAHN,CAIEU,IAAKd,QA6BX,SAASK,EAAmBH,GAC1B,OAAOP,EAAaoB,SAASb,uBAvB/BN,EAAUoB,UAAY,CACpBd,YAAYH,EAAOkB,EAAUC,GAC3B,MAAMC,EAAYpB,EAAMkB,GAClBG,EAASC,OAAOF,GACtB,OAAIA,IAAcd,EAAmBc,GAC5B,IAAIG,MASjB,SAAoCC,EAAeL,GACjD,MAAQ,2CAA0CK,qBAAyBL,0EAI3DxB,OAdK8B,CAA2BJ,EAAQF,IAE/C,OAmBX,MAAMO,EAAO7B","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/react/separator/src/Separator.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 { Primitive } from '@radix-ui/react-primitive';\n\nimport type * as Radix from '@radix-ui/react-primitive';\n\n/* -------------------------------------------------------------------------------------------------\n * Separator\n * -----------------------------------------------------------------------------------------------*/\n\nconst NAME = 'Separator';\nconst DEFAULT_ORIENTATION = 'horizontal';\nconst ORIENTATIONS = ['horizontal', 'vertical'] as const;\n\ntype Orientation = typeof ORIENTATIONS[number];\ntype SeparatorElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface SeparatorProps extends PrimitiveDivProps {\n /**\n * Either `vertical` or `horizontal`. Defaults to `horizontal`.\n */\n orientation?: Orientation;\n /**\n * Whether or not the component is purely decorative. When true, accessibility-related attributes\n * are updated so that that the rendered element is removed from the accessibility tree.\n */\n decorative?: boolean;\n}\n\nconst Separator = React.forwardRef<SeparatorElement, SeparatorProps>((props, forwardedRef) => {\n const { decorative, orientation: orientationProp = DEFAULT_ORIENTATION, ...domProps } = props;\n const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;\n // `aria-orientation` defaults to `horizontal` so we only need it if `orientation` is vertical\n const ariaOrientation = orientation === 'vertical' ? orientation : undefined;\n const semanticProps = decorative\n ? { role: 'none' }\n : { 'aria-orientation': ariaOrientation, role: 'separator' };\n\n return (\n <Primitive.div\n data-orientation={orientation}\n {...semanticProps}\n {...domProps}\n ref={forwardedRef}\n />\n );\n});\n\nSeparator.displayName = NAME;\n\nSeparator.propTypes = {\n orientation(props, propName, componentName) {\n const propValue = props[propName];\n const strVal = String(propValue);\n if (propValue && !isValidOrientation(propValue)) {\n return new Error(getInvalidOrientationError(strVal, componentName));\n }\n return null;\n },\n};\n\n/* -----------------------------------------------------------------------------------------------*/\n\n// Split this out for clearer readability of the error message.\nfunction getInvalidOrientationError(value: string, componentName: string) {\n return `Invalid prop \\`orientation\\` of value \\`${value}\\` supplied to \\`${componentName}\\`, expected one of:\n - horizontal\n - vertical\n\nDefaulting to \\`${DEFAULT_ORIENTATION}\\`.`;\n}\n\nfunction isValidOrientation(orientation: any): orientation is Orientation {\n return ORIENTATIONS.includes(orientation);\n}\n\nconst Root = Separator;\n\nexport {\n Separator,\n //\n Root,\n};\nexport type { SeparatorProps };\n"],"names":["dest","source","a","Object","keys","forEach","key","defineProperty","enumerable","get","__esModule","default","DEFAULT_ORIENTATION","ORIENTATIONS","Separator","React","forwardRef","props","forwardedRef","decorative","orientation","orientationProp","domProps","isValidOrientation","semanticProps","role","undefined","_react","createElement","Primitive","div","_babelRuntimeHelpersExtends","ref","includes","propTypes","propName","componentName","propValue","strVal","String","Error","value","getInvalidOrientationError","Root"],"version":3,"file":"index.js.map"}
|
package/dist/index.module.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Primitive as r}from"@radix-ui/react-primitive";import*as o from"react";import t from"@babel/runtime/helpers/esm/extends";const e="horizontal",n=["horizontal","vertical"];export const Separator=/*#__PURE__*/o.forwardRef(((n,a)=>{const{decorative:p,orientation:l=e,...c}=n,s=i(l)?l:e,u=p?{role:"none"}:{"aria-orientation":"vertical"===s?s:void 0,role:"separator"};/*#__PURE__*/return o.createElement(r,t({
|
|
1
|
+
import{Primitive as r}from"@radix-ui/react-primitive";import*as o from"react";import t from"@babel/runtime/helpers/esm/extends";const e="horizontal",n=["horizontal","vertical"];export const Separator=/*#__PURE__*/o.forwardRef(((n,a)=>{const{decorative:p,orientation:l=e,...c}=n,s=i(l)?l:e,u=p?{role:"none"}:{"aria-orientation":"vertical"===s?s:void 0,role:"separator"};/*#__PURE__*/return o.createElement(r.div,t({"data-orientation":s},u,c,{ref:a}))}));/*#__PURE__*/function i(r){return n.includes(r)}Separator.propTypes={orientation(r,o,t){const n=r[o],a=String(n);return n&&!i(n)?new Error(function(r,o){return`Invalid prop \`orientation\` of value \`${r}\` supplied to \`${o}\`, expected one of:\n - horizontal\n - vertical\n\nDefaulting to \`${e}\`.`}(a,t)):null}};export const Root=Separator;
|
|
2
2
|
//# sourceMappingURL=index.module.js.map
|
package/dist/index.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":"gIASA,MACMA,EAAsB,aACtBC,EAAe,CAAC,aAAc,mBAiBpC,MAAMC,uBAAYC,EAAMC,YAA6C,CAACC,EAAOC,KAC3E,MAAMC,WAAEA,EAAYC,YAAaC,EAAkBT,KAAwBU,GAAaL,EAClFG,EAAcG,EAAmBF,GAAmBA,EAAkBT,EAGtEY,EAAgBL,EAClB,CAAEM,KAAM,QACR,CAAE,mBAHkC,aAAhBL,EAA6BA,OAAcM,EAGxBD,KAAM,0BAEjD,OACEE,EAAAC,cAACC,EAAUC,IAAXC,EAAA,CACE,mBAAkBX,GACdI,EACAF,EAHN,CAIEU,IAAKd,qBA6BX,SAASK,EAAmBH,GAC1B,OAAOP,EAAaoB,SAASb,GAvB/BN,UAAUoB,UAAY,CACpBd,YAAYH,EAAOkB,EAAUC,GAC3B,MAAMC,EAAYpB,EAAMkB,GAClBG,EAASC,OAAOF,GACtB,OAAIA,IAAcd,EAAmBc,GAC5B,IAAIG,MASjB,SAAoCC,EAAeL,GACjD,MAAQ,2CAA0CK,qBAAyBL,0EAI3DxB,OAdK8B,CAA2BJ,EAAQF,IAE/C,cAmBX,MAAMO,KAAO7B","sources":["./packages/react/separator/src/Separator.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Primitive } from '@radix-ui/react-primitive';\n\nimport type * as Radix from '@radix-ui/react-primitive';\n\n/* -------------------------------------------------------------------------------------------------\n * Separator\n * -----------------------------------------------------------------------------------------------*/\n\nconst NAME = 'Separator';\nconst DEFAULT_ORIENTATION = 'horizontal';\nconst ORIENTATIONS = ['horizontal', 'vertical'] as const;\n\ntype Orientation = typeof ORIENTATIONS[number];\ntype SeparatorElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface SeparatorProps extends PrimitiveDivProps {\n /**\n * Either `vertical` or `horizontal`. Defaults to `horizontal`.\n */\n orientation?: Orientation;\n /**\n * Whether or not the component is purely decorative. When true, accessibility-related attributes\n * are updated so that that the rendered element is removed from the accessibility tree.\n */\n decorative?: boolean;\n}\n\nconst Separator = React.forwardRef<SeparatorElement, SeparatorProps>((props, forwardedRef) => {\n const { decorative, orientation: orientationProp = DEFAULT_ORIENTATION, ...domProps } = props;\n const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;\n // `aria-orientation` defaults to `horizontal` so we only need it if `orientation` is vertical\n const ariaOrientation = orientation === 'vertical' ? orientation : undefined;\n const semanticProps = decorative\n ? { role: 'none' }\n : { 'aria-orientation': ariaOrientation, role: 'separator' };\n\n return (\n <Primitive.div\n data-orientation={orientation}\n {...semanticProps}\n {...domProps}\n ref={forwardedRef}\n />\n );\n});\n\nSeparator.displayName = NAME;\n\nSeparator.propTypes = {\n orientation(props, propName, componentName) {\n const propValue = props[propName];\n const strVal = String(propValue);\n if (propValue && !isValidOrientation(propValue)) {\n return new Error(getInvalidOrientationError(strVal, componentName));\n }\n return null;\n },\n};\n\n/* -----------------------------------------------------------------------------------------------*/\n\n// Split this out for clearer readability of the error message.\nfunction getInvalidOrientationError(value: string, componentName: string) {\n return `Invalid prop \\`orientation\\` of value \\`${value}\\` supplied to \\`${componentName}\\`, expected one of:\n - horizontal\n - vertical\n\nDefaulting to \\`${DEFAULT_ORIENTATION}\\`.`;\n}\n\nfunction isValidOrientation(orientation: any): orientation is Orientation {\n return ORIENTATIONS.includes(orientation);\n}\n\nconst Root = Separator;\n\nexport {\n Separator,\n //\n Root,\n};\nexport type { SeparatorProps };\n"],"names":["DEFAULT_ORIENTATION","ORIENTATIONS","Separator","React","forwardRef","props","forwardedRef","decorative","orientation","orientationProp","domProps","isValidOrientation","semanticProps","role","undefined","_react","createElement","Primitive","div","_babelRuntimeHelpersEsmExtends","ref","includes","propTypes","propName","componentName","propValue","strVal","String","Error","value","getInvalidOrientationError","Root"],"version":3,"file":"index.module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radix-ui/react-separator",
|
|
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,13 +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-
|
|
22
|
-
"@radix-ui/react-primitive": "0.0.14"
|
|
20
|
+
"@radix-ui/react-primitive": "0.1.0"
|
|
23
21
|
},
|
|
24
22
|
"peerDependencies": {
|
|
25
23
|
"react": "^16.8 || ^17.0"
|