@radix-ui/react-separator
Advanced tools
Comparing version 1.0.3 to 1.1.0-rc.1
@@ -1,8 +0,9 @@ | ||
import * as React from "react"; | ||
import * as Radix from "@radix-ui/react-primitive"; | ||
import { Primitive } from "@radix-ui/react-primitive"; | ||
import * as React from 'react'; | ||
import * as Radix from '@radix-ui/react-primitive'; | ||
import { Primitive } from '@radix-ui/react-primitive'; | ||
declare const ORIENTATIONS: readonly ["horizontal", "vertical"]; | ||
type Orientation = typeof ORIENTATIONS[number]; | ||
type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>; | ||
export interface SeparatorProps extends PrimitiveDivProps { | ||
declare type Orientation = typeof ORIENTATIONS[number]; | ||
declare type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>; | ||
interface SeparatorProps extends PrimitiveDivProps { | ||
/** | ||
@@ -18,5 +19,5 @@ * Either `vertical` or `horizontal`. Defaults to `horizontal`. | ||
} | ||
export const Separator: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLDivElement>>; | ||
export const Root: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLDivElement>>; | ||
declare const Separator: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLDivElement>>; | ||
declare const Root: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLDivElement>>; | ||
//# sourceMappingURL=index.d.ts.map | ||
export { Root, Separator, type SeparatorProps }; |
@@ -1,54 +0,66 @@ | ||
var $3sOcx$babelruntimehelpersextends = require("@babel/runtime/helpers/extends"); | ||
var $3sOcx$react = require("react"); | ||
var $3sOcx$radixuireactprimitive = require("@radix-ui/react-primitive"); | ||
"use strict"; | ||
(() => { | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { | ||
get: (a, b) => (typeof require !== "undefined" ? require : a)[b] | ||
}) : x)(function(x) { | ||
if (typeof require !== "undefined") return require.apply(this, arguments); | ||
throw Error('Dynamic require of "' + x + '" is not supported'); | ||
}); | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
mod | ||
)); | ||
function $parcel$export(e, n, v, s) { | ||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true}); | ||
} | ||
function $parcel$interopDefault(a) { | ||
return a && a.__esModule ? a.default : a; | ||
} | ||
$parcel$export(module.exports, "Separator", () => $1d2e81bd6a105992$export$1ff3c3f08ae963c0); | ||
$parcel$export(module.exports, "Root", () => $1d2e81bd6a105992$export$be92b6f5f03c0fe9); | ||
/* ------------------------------------------------------------------------------------------------- | ||
* Separator | ||
* -----------------------------------------------------------------------------------------------*/ const $1d2e81bd6a105992$var$NAME = 'Separator'; | ||
const $1d2e81bd6a105992$var$DEFAULT_ORIENTATION = 'horizontal'; | ||
const $1d2e81bd6a105992$var$ORIENTATIONS = [ | ||
'horizontal', | ||
'vertical' | ||
]; | ||
const $1d2e81bd6a105992$export$1ff3c3f08ae963c0 = /*#__PURE__*/ $3sOcx$react.forwardRef((props, forwardedRef)=>{ | ||
const { decorative: decorative , orientation: orientationProp = $1d2e81bd6a105992$var$DEFAULT_ORIENTATION , ...domProps } = props; | ||
const orientation = $1d2e81bd6a105992$var$isValidOrientation(orientationProp) ? orientationProp : $1d2e81bd6a105992$var$DEFAULT_ORIENTATION; // `aria-orientation` defaults to `horizontal` so we only need it if `orientation` is vertical | ||
const ariaOrientation = orientation === 'vertical' ? orientation : undefined; | ||
const semanticProps = decorative ? { | ||
role: 'none' | ||
} : { | ||
'aria-orientation': ariaOrientation, | ||
role: 'separator' | ||
}; | ||
return /*#__PURE__*/ $3sOcx$react.createElement($3sOcx$radixuireactprimitive.Primitive.div, ($parcel$interopDefault($3sOcx$babelruntimehelpersextends))({ | ||
"data-orientation": orientation | ||
}, semanticProps, domProps, { | ||
// packages/react/separator/src/Separator.tsx | ||
var React = __toESM(__require("react")); | ||
var import_react_primitive = __require("@radix-ui/react-primitive"); | ||
var import_jsx_runtime = __require("react/jsx-runtime"); | ||
var NAME = "Separator"; | ||
var DEFAULT_ORIENTATION = "horizontal"; | ||
var ORIENTATIONS = ["horizontal", "vertical"]; | ||
var Separator = React.forwardRef((props, forwardedRef) => { | ||
const { decorative, orientation: orientationProp = DEFAULT_ORIENTATION, ...domProps } = props; | ||
const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION; | ||
const ariaOrientation = orientation === "vertical" ? orientation : void 0; | ||
const semanticProps = decorative ? { role: "none" } : { "aria-orientation": ariaOrientation, role: "separator" }; | ||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( | ||
import_react_primitive.Primitive.div, | ||
{ | ||
"data-orientation": orientation, | ||
...semanticProps, | ||
...domProps, | ||
ref: forwardedRef | ||
})); | ||
}); | ||
/*#__PURE__*/ Object.assign($1d2e81bd6a105992$export$1ff3c3f08ae963c0, { | ||
displayName: $1d2e81bd6a105992$var$NAME | ||
}); | ||
$1d2e81bd6a105992$export$1ff3c3f08ae963c0.propTypes = { | ||
orientation (props, propName, componentName) { | ||
const propValue = props[propName]; | ||
const strVal = String(propValue); | ||
if (propValue && !$1d2e81bd6a105992$var$isValidOrientation(propValue)) return new Error($1d2e81bd6a105992$var$getInvalidOrientationError(strVal, componentName)); | ||
return null; | ||
} | ||
); | ||
}); | ||
Separator.displayName = NAME; | ||
Separator.propTypes = { | ||
orientation(props, propName, componentName) { | ||
const propValue = props[propName]; | ||
const strVal = String(propValue); | ||
if (propValue && !isValidOrientation(propValue)) { | ||
return new Error(getInvalidOrientationError(strVal, componentName)); | ||
} | ||
return null; | ||
} | ||
}; | ||
/* -----------------------------------------------------------------------------------------------*/ // Split this out for clearer readability of the error message. | ||
function $1d2e81bd6a105992$var$getInvalidOrientationError(value, componentName) { | ||
}; | ||
function getInvalidOrientationError(value, componentName) { | ||
return `Invalid prop \`orientation\` of value \`${value}\` supplied to \`${componentName}\`, expected one of: | ||
@@ -58,12 +70,9 @@ - horizontal | ||
Defaulting to \`${$1d2e81bd6a105992$var$DEFAULT_ORIENTATION}\`.`; | ||
} | ||
function $1d2e81bd6a105992$var$isValidOrientation(orientation) { | ||
return $1d2e81bd6a105992$var$ORIENTATIONS.includes(orientation); | ||
} | ||
const $1d2e81bd6a105992$export$be92b6f5f03c0fe9 = $1d2e81bd6a105992$export$1ff3c3f08ae963c0; | ||
Defaulting to \`${DEFAULT_ORIENTATION}\`.`; | ||
} | ||
function isValidOrientation(orientation) { | ||
return ORIENTATIONS.includes(orientation); | ||
} | ||
var Root = Separator; | ||
})(); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@radix-ui/react-separator", | ||
"version": "1.0.3", | ||
"version": "1.1.0-rc.1", | ||
"license": "MIT", | ||
@@ -31,4 +31,3 @@ "exports": { | ||
"dependencies": { | ||
"@babel/runtime": "^7.13.10", | ||
"@radix-ui/react-primitive": "1.0.3" | ||
"@radix-ui/react-primitive": "1.1.0-rc.1" | ||
}, | ||
@@ -56,3 +55,4 @@ "peerDependencies": { | ||
"url": "https://github.com/radix-ui/primitives/issues" | ||
} | ||
}, | ||
"stableVersion": "1.0.3" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
5
143
16431
8
1
3
+ Added@radix-ui/react-compose-refs@1.1.0-rc.1(transitive)
+ Added@radix-ui/react-primitive@1.1.0-rc.1(transitive)
+ Added@radix-ui/react-slot@1.1.0-rc.1(transitive)
- Removed@babel/runtime@^7.13.10
- Removed@babel/runtime@7.25.0(transitive)
- Removed@radix-ui/react-compose-refs@1.0.1(transitive)
- Removed@radix-ui/react-primitive@1.0.3(transitive)
- Removed@radix-ui/react-slot@1.0.2(transitive)
- Removedregenerator-runtime@0.14.1(transitive)