@radix-ui/react-separator 1.0.3 → 1.1.0-rc.2

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.mts CHANGED
@@ -1,10 +1,11 @@
1
- import * as React from "react";
2
- import * as Radix from "@radix-ui/react-primitive";
3
- import { Primitive } from "@radix-ui/react-primitive";
1
+ import * as React from 'react';
2
+ import * as Radix from '@radix-ui/react-primitive';
3
+ import { Primitive } from '@radix-ui/react-primitive';
4
+
4
5
  declare const ORIENTATIONS: readonly ["horizontal", "vertical"];
5
- type Orientation = typeof ORIENTATIONS[number];
6
- type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
7
- export interface SeparatorProps extends PrimitiveDivProps {
6
+ declare type Orientation = typeof ORIENTATIONS[number];
7
+ declare type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
8
+ interface SeparatorProps extends PrimitiveDivProps {
8
9
  /**
9
10
  * Either `vertical` or `horizontal`. Defaults to `horizontal`.
10
11
  */
@@ -15,7 +16,7 @@ export interface SeparatorProps extends PrimitiveDivProps {
15
16
  */
16
17
  decorative?: boolean;
17
18
  }
18
- export const Separator: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLDivElement>>;
19
- export const Root: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLDivElement>>;
19
+ declare const Separator: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLDivElement>>;
20
+ declare const Root: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLDivElement>>;
20
21
 
21
- //# sourceMappingURL=index.d.ts.map
22
+ export { Root, Separator, type SeparatorProps };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- import * as React from "react";
2
- import * as Radix from "@radix-ui/react-primitive";
3
- import { Primitive } from "@radix-ui/react-primitive";
1
+ import * as React from 'react';
2
+ import * as Radix from '@radix-ui/react-primitive';
3
+ import { Primitive } from '@radix-ui/react-primitive';
4
+
4
5
  declare const ORIENTATIONS: readonly ["horizontal", "vertical"];
5
- type Orientation = typeof ORIENTATIONS[number];
6
- type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
7
- export interface SeparatorProps extends PrimitiveDivProps {
6
+ declare type Orientation = typeof ORIENTATIONS[number];
7
+ declare type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
8
+ interface SeparatorProps extends PrimitiveDivProps {
8
9
  /**
9
10
  * Either `vertical` or `horizontal`. Defaults to `horizontal`.
10
11
  */
@@ -15,7 +16,7 @@ export interface SeparatorProps extends PrimitiveDivProps {
15
16
  */
16
17
  decorative?: boolean;
17
18
  }
18
- export const Separator: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLDivElement>>;
19
- export const Root: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLDivElement>>;
19
+ declare const Separator: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLDivElement>>;
20
+ declare const Root: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLDivElement>>;
20
21
 
21
- //# sourceMappingURL=index.d.ts.map
22
+ export { Root, Separator, type SeparatorProps };
package/dist/index.js CHANGED
@@ -1,68 +1,77 @@
1
- var $3sOcx$babelruntimehelpersextends = require("@babel/runtime/helpers/extends");
2
- var $3sOcx$react = require("react");
3
- var $3sOcx$radixuireactprimitive = require("@radix-ui/react-primitive");
4
-
5
- function $parcel$export(e, n, v, s) {
6
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
- }
8
- function $parcel$interopDefault(a) {
9
- return a && a.__esModule ? a.default : a;
10
- }
11
-
12
- $parcel$export(module.exports, "Separator", () => $1d2e81bd6a105992$export$1ff3c3f08ae963c0);
13
- $parcel$export(module.exports, "Root", () => $1d2e81bd6a105992$export$be92b6f5f03c0fe9);
14
-
15
-
1
+ "use strict";
2
+ (() => {
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
10
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
11
+ }) : x)(function(x) {
12
+ if (typeof require !== "undefined") return require.apply(this, arguments);
13
+ throw Error('Dynamic require of "' + x + '" is not supported');
14
+ });
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
16
31
 
17
- /* -------------------------------------------------------------------------------------------------
18
- * Separator
19
- * -----------------------------------------------------------------------------------------------*/ const $1d2e81bd6a105992$var$NAME = 'Separator';
20
- const $1d2e81bd6a105992$var$DEFAULT_ORIENTATION = 'horizontal';
21
- const $1d2e81bd6a105992$var$ORIENTATIONS = [
22
- 'horizontal',
23
- 'vertical'
24
- ];
25
- const $1d2e81bd6a105992$export$1ff3c3f08ae963c0 = /*#__PURE__*/ $3sOcx$react.forwardRef((props, forwardedRef)=>{
26
- const { decorative: decorative , orientation: orientationProp = $1d2e81bd6a105992$var$DEFAULT_ORIENTATION , ...domProps } = props;
27
- 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
28
- const ariaOrientation = orientation === 'vertical' ? orientation : undefined;
29
- const semanticProps = decorative ? {
30
- role: 'none'
31
- } : {
32
- 'aria-orientation': ariaOrientation,
33
- role: 'separator'
34
- };
35
- return /*#__PURE__*/ $3sOcx$react.createElement($3sOcx$radixuireactprimitive.Primitive.div, ($parcel$interopDefault($3sOcx$babelruntimehelpersextends))({
36
- "data-orientation": orientation
37
- }, semanticProps, domProps, {
32
+ // packages/react/separator/src/Separator.tsx
33
+ var React = __toESM(__require("react"));
34
+ var import_react_primitive = __require("@radix-ui/react-primitive");
35
+ var import_jsx_runtime = __require("react/jsx-runtime");
36
+ var NAME = "Separator";
37
+ var DEFAULT_ORIENTATION = "horizontal";
38
+ var ORIENTATIONS = ["horizontal", "vertical"];
39
+ var Separator = React.forwardRef((props, forwardedRef) => {
40
+ const { decorative, orientation: orientationProp = DEFAULT_ORIENTATION, ...domProps } = props;
41
+ const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;
42
+ const ariaOrientation = orientation === "vertical" ? orientation : void 0;
43
+ const semanticProps = decorative ? { role: "none" } : { "aria-orientation": ariaOrientation, role: "separator" };
44
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
45
+ import_react_primitive.Primitive.div,
46
+ {
47
+ "data-orientation": orientation,
48
+ ...semanticProps,
49
+ ...domProps,
38
50
  ref: forwardedRef
39
- }));
40
- });
41
- /*#__PURE__*/ Object.assign($1d2e81bd6a105992$export$1ff3c3f08ae963c0, {
42
- displayName: $1d2e81bd6a105992$var$NAME
43
- });
44
- $1d2e81bd6a105992$export$1ff3c3f08ae963c0.propTypes = {
45
- orientation (props, propName, componentName) {
46
- const propValue = props[propName];
47
- const strVal = String(propValue);
48
- if (propValue && !$1d2e81bd6a105992$var$isValidOrientation(propValue)) return new Error($1d2e81bd6a105992$var$getInvalidOrientationError(strVal, componentName));
49
- return null;
51
+ }
52
+ );
53
+ });
54
+ Separator.displayName = NAME;
55
+ Separator.propTypes = {
56
+ orientation(props, propName, componentName) {
57
+ const propValue = props[propName];
58
+ const strVal = String(propValue);
59
+ if (propValue && !isValidOrientation(propValue)) {
60
+ return new Error(getInvalidOrientationError(strVal, componentName));
61
+ }
62
+ return null;
50
63
  }
51
- };
52
- /* -----------------------------------------------------------------------------------------------*/ // Split this out for clearer readability of the error message.
53
- function $1d2e81bd6a105992$var$getInvalidOrientationError(value, componentName) {
64
+ };
65
+ function getInvalidOrientationError(value, componentName) {
54
66
  return `Invalid prop \`orientation\` of value \`${value}\` supplied to \`${componentName}\`, expected one of:
55
67
  - horizontal
56
68
  - vertical
57
69
 
58
- Defaulting to \`${$1d2e81bd6a105992$var$DEFAULT_ORIENTATION}\`.`;
59
- }
60
- function $1d2e81bd6a105992$var$isValidOrientation(orientation) {
61
- return $1d2e81bd6a105992$var$ORIENTATIONS.includes(orientation);
62
- }
63
- const $1d2e81bd6a105992$export$be92b6f5f03c0fe9 = $1d2e81bd6a105992$export$1ff3c3f08ae963c0;
64
-
65
-
66
-
67
-
70
+ Defaulting to \`${DEFAULT_ORIENTATION}\`.`;
71
+ }
72
+ function isValidOrientation(orientation) {
73
+ return ORIENTATIONS.includes(orientation);
74
+ }
75
+ var Root = Separator;
76
+ })();
68
77
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1,7 @@
1
- {"mappings":";;;;;;;;;;;;;A;;;ACKA;;oGAEA,CAEA,MAAMI,0BAAI,GAAG,WAAb,AAAA;AACA,MAAMC,yCAAmB,GAAG,YAA5B,AAAA;AACA,MAAMC,kCAAY,GAAG;IAAC,YAAD;IAAe,UAAf;CAArB,AAAA;AAiBA,MAAMN,yCAAS,GAAA,aAAGE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B,oGAAA,CAEA,+DAAA;AACA,SAASK,gDAAT,CAAoCC,KAApC,EAAmDN,aAAnD,EAA0E;IACxE,OAAQ,CAAA,wCAAA,EAA0CM,KAAM,CAAA,iBAAA,EAAmBN,aAAc,CAAzF;;;;gBAIF,EAAkBhB,yCAAoB,CAAA,GAAA,CAJpC,CAIF;CACC;AAED,SAASS,wCAAT,CAA4BH,WAA5B,EAA0E;IACxE,OAAOL,kCAAY,CAACsB,QAAb,CAAsBjB,WAAtB,CAAP,CAAA;CACD;AAED,MAAMV,yCAAI,GAAGD,yCAAb,AAAA;;AD3EA","sources":["packages/react/separator/src/index.ts","packages/react/separator/src/Separator.tsx"],"sourcesContent":["export {\n Separator,\n //\n Root,\n} from './Separator';\nexport type { SeparatorProps } from './Separator';\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":["Separator","Root","React","Primitive","NAME","DEFAULT_ORIENTATION","ORIENTATIONS","forwardRef","props","forwardedRef","decorative","orientation","orientationProp","domProps","isValidOrientation","ariaOrientation","undefined","semanticProps","role","propTypes","propName","componentName","propValue","strVal","String","Error","getInvalidOrientationError","value","includes"],"version":3,"file":"index.js.map"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/Separator.tsx"],
4
+ "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"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAuB;AACvB,+BAA0B;AAqCtB;AA7BJ,MAAM,OAAO;AACb,MAAM,sBAAsB;AAC5B,MAAM,eAAe,CAAC,cAAc,UAAU;AAiB9C,MAAM,YAAkB,iBAA6C,CAAC,OAAO,iBAAiB;AAC5F,UAAM,EAAE,YAAY,aAAa,kBAAkB,qBAAqB,GAAG,SAAS,IAAI;AACxF,UAAM,cAAc,mBAAmB,eAAe,IAAI,kBAAkB;AAE5E,UAAM,kBAAkB,gBAAgB,aAAa,cAAc;AACnE,UAAM,gBAAgB,aAClB,EAAE,MAAM,OAAO,IACf,EAAE,oBAAoB,iBAAiB,MAAM,YAAY;AAE7D,WACE;AAAA,MAAC,iCAAU;AAAA,MAAV;AAAA,QACC,oBAAkB;AAAA,QACjB,GAAG;AAAA,QACH,GAAG;AAAA,QACJ,KAAK;AAAA;AAAA,IACP;AAAA,EAEJ,CAAC;AAED,YAAU,cAAc;AAExB,YAAU,YAAY;AAAA,IACpB,YAAY,OAAO,UAAU,eAAe;AAC1C,YAAM,YAAY,MAAM,QAAQ;AAChC,YAAM,SAAS,OAAO,SAAS;AAC/B,UAAI,aAAa,CAAC,mBAAmB,SAAS,GAAG;AAC/C,eAAO,IAAI,MAAM,2BAA2B,QAAQ,aAAa,CAAC;AAAA,MACpE;AACA,aAAO;AAAA,IACT;AAAA,EACF;AAKA,WAAS,2BAA2B,OAAe,eAAuB;AACxE,WAAO,2CAA2C,KAAK,oBAAoB,aAAa;AAAA;AAAA;AAAA;AAAA,kBAIxE,mBAAmB;AAAA,EACrC;AAEA,WAAS,mBAAmB,aAA8C;AACxE,WAAO,aAAa,SAAS,WAAW;AAAA,EAC1C;AAEA,MAAM,OAAO;",
6
+ "names": []
7
+ }
package/dist/index.mjs CHANGED
@@ -1,60 +1,49 @@
1
- import $5WXm8$babelruntimehelpersesmextends from "@babel/runtime/helpers/esm/extends";
2
- import {forwardRef as $5WXm8$forwardRef, createElement as $5WXm8$createElement} from "react";
3
- import {Primitive as $5WXm8$Primitive} from "@radix-ui/react-primitive";
4
-
5
-
6
-
7
-
8
- /* -------------------------------------------------------------------------------------------------
9
- * Separator
10
- * -----------------------------------------------------------------------------------------------*/ const $89eedd556c436f6a$var$NAME = 'Separator';
11
- const $89eedd556c436f6a$var$DEFAULT_ORIENTATION = 'horizontal';
12
- const $89eedd556c436f6a$var$ORIENTATIONS = [
13
- 'horizontal',
14
- 'vertical'
15
- ];
16
- const $89eedd556c436f6a$export$1ff3c3f08ae963c0 = /*#__PURE__*/ $5WXm8$forwardRef((props, forwardedRef)=>{
17
- const { decorative: decorative , orientation: orientationProp = $89eedd556c436f6a$var$DEFAULT_ORIENTATION , ...domProps } = props;
18
- const orientation = $89eedd556c436f6a$var$isValidOrientation(orientationProp) ? orientationProp : $89eedd556c436f6a$var$DEFAULT_ORIENTATION; // `aria-orientation` defaults to `horizontal` so we only need it if `orientation` is vertical
19
- const ariaOrientation = orientation === 'vertical' ? orientation : undefined;
20
- const semanticProps = decorative ? {
21
- role: 'none'
22
- } : {
23
- 'aria-orientation': ariaOrientation,
24
- role: 'separator'
25
- };
26
- return /*#__PURE__*/ $5WXm8$createElement($5WXm8$Primitive.div, $5WXm8$babelruntimehelpersesmextends({
27
- "data-orientation": orientation
28
- }, semanticProps, domProps, {
29
- ref: forwardedRef
30
- }));
31
- });
32
- /*#__PURE__*/ Object.assign($89eedd556c436f6a$export$1ff3c3f08ae963c0, {
33
- displayName: $89eedd556c436f6a$var$NAME
1
+ // packages/react/separator/src/Separator.tsx
2
+ import * as React from "react";
3
+ import { Primitive } from "@radix-ui/react-primitive";
4
+ import { jsx } from "react/jsx-runtime";
5
+ var NAME = "Separator";
6
+ var DEFAULT_ORIENTATION = "horizontal";
7
+ var ORIENTATIONS = ["horizontal", "vertical"];
8
+ var Separator = React.forwardRef((props, forwardedRef) => {
9
+ const { decorative, orientation: orientationProp = DEFAULT_ORIENTATION, ...domProps } = props;
10
+ const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;
11
+ const ariaOrientation = orientation === "vertical" ? orientation : void 0;
12
+ const semanticProps = decorative ? { role: "none" } : { "aria-orientation": ariaOrientation, role: "separator" };
13
+ return /* @__PURE__ */ jsx(
14
+ Primitive.div,
15
+ {
16
+ "data-orientation": orientation,
17
+ ...semanticProps,
18
+ ...domProps,
19
+ ref: forwardedRef
20
+ }
21
+ );
34
22
  });
35
- $89eedd556c436f6a$export$1ff3c3f08ae963c0.propTypes = {
36
- orientation (props, propName, componentName) {
37
- const propValue = props[propName];
38
- const strVal = String(propValue);
39
- if (propValue && !$89eedd556c436f6a$var$isValidOrientation(propValue)) return new Error($89eedd556c436f6a$var$getInvalidOrientationError(strVal, componentName));
40
- return null;
23
+ Separator.displayName = NAME;
24
+ Separator.propTypes = {
25
+ orientation(props, propName, componentName) {
26
+ const propValue = props[propName];
27
+ const strVal = String(propValue);
28
+ if (propValue && !isValidOrientation(propValue)) {
29
+ return new Error(getInvalidOrientationError(strVal, componentName));
41
30
  }
31
+ return null;
32
+ }
42
33
  };
43
- /* -----------------------------------------------------------------------------------------------*/ // Split this out for clearer readability of the error message.
44
- function $89eedd556c436f6a$var$getInvalidOrientationError(value, componentName) {
45
- return `Invalid prop \`orientation\` of value \`${value}\` supplied to \`${componentName}\`, expected one of:
34
+ function getInvalidOrientationError(value, componentName) {
35
+ return `Invalid prop \`orientation\` of value \`${value}\` supplied to \`${componentName}\`, expected one of:
46
36
  - horizontal
47
37
  - vertical
48
38
 
49
- Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
39
+ Defaulting to \`${DEFAULT_ORIENTATION}\`.`;
50
40
  }
51
- function $89eedd556c436f6a$var$isValidOrientation(orientation) {
52
- return $89eedd556c436f6a$var$ORIENTATIONS.includes(orientation);
41
+ function isValidOrientation(orientation) {
42
+ return ORIENTATIONS.includes(orientation);
53
43
  }
54
- const $89eedd556c436f6a$export$be92b6f5f03c0fe9 = $89eedd556c436f6a$export$1ff3c3f08ae963c0;
55
-
56
-
57
-
58
-
59
- export {$89eedd556c436f6a$export$1ff3c3f08ae963c0 as Separator, $89eedd556c436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AQY,QAAR,EAAkBC,aAAlB,EAAiC;QAC1C,MAAMC,SAAS,GAAGd,KAAK,CAACY,QAAD,CAAvB,AAAA;QACA,MAAMG,MAAM,GAAGC,MAAM,CAACF,SAAD,CAArB,AAAA;QACA,IAAIA,SAAS,IAAI,CAACR,wCAAkB,CAACQ,SAAD,CAApC,EACE,OAAO,IAAIG,KAAJ,CAAUC,gDAA0B,CAACH,MAAD,EAASF,aAAT,CAApC,CAAP,CAAA;QAEF,OAAO,IAAP,CAAA;KACD;CARH,CAAsB;AAWtB,oGAAA,CAEA,+DAAA;AACA,SAASK,gDAAT,CAAoCC,KAApC,EAAmDN,aAAnD,EAA0E;IACxE,OAAQ,CAAA,wCAAA,EAA0CM,KAAM,CAAA,iBAAA,EAAmBN,aAAc,CAAzF;;;;gBAIF,EAAkBhB,yCAAoB,CAAA,GAAA,CAJpC,CAIF;CACC;AAED,SAASS,wCAAT,CAA4BH,WAA5B,EAA0E;IACxE,OAAOL,kCAAY,CAACsB,QAAb,CAAsBjB,WAAtB,CAAP,CAAA;CACD;AAED,MAAMV,yCAAI,GAAGD,yCAAb,AAAA;;AD3EA","sources":["packages/react/separator/src/index.ts","packages/react/separator/src/Separator.tsx"],"sourcesContent":["export {\n Separator,\n //\n Root,\n} from './Separator';\nexport type { SeparatorProps } from './Separator';\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":["Separator","Root","React","Primitive","NAME","DEFAULT_ORIENTATION","ORIENTATIONS","forwardRef","props","forwardedRef","decorative","orientation","orientationProp","domProps","isValidOrientation","ariaOrientation","undefined","semanticProps","role","propTypes","propName","componentName","propValue","strVal","String","Error","getInvalidOrientationError","value","includes"],"version":3,"file":"index.mjs.map"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/Separator.tsx"],
4
+ "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"],
5
+ "mappings": ";AAAA,YAAY,WAAW;AACvB,SAAS,iBAAiB;AAqCtB;AA7BJ,IAAM,OAAO;AACb,IAAM,sBAAsB;AAC5B,IAAM,eAAe,CAAC,cAAc,UAAU;AAiB9C,IAAM,YAAkB,iBAA6C,CAAC,OAAO,iBAAiB;AAC5F,QAAM,EAAE,YAAY,aAAa,kBAAkB,qBAAqB,GAAG,SAAS,IAAI;AACxF,QAAM,cAAc,mBAAmB,eAAe,IAAI,kBAAkB;AAE5E,QAAM,kBAAkB,gBAAgB,aAAa,cAAc;AACnE,QAAM,gBAAgB,aAClB,EAAE,MAAM,OAAO,IACf,EAAE,oBAAoB,iBAAiB,MAAM,YAAY;AAE7D,SACE;AAAA,IAAC,UAAU;AAAA,IAAV;AAAA,MACC,oBAAkB;AAAA,MACjB,GAAG;AAAA,MACH,GAAG;AAAA,MACJ,KAAK;AAAA;AAAA,EACP;AAEJ,CAAC;AAED,UAAU,cAAc;AAExB,UAAU,YAAY;AAAA,EACpB,YAAY,OAAO,UAAU,eAAe;AAC1C,UAAM,YAAY,MAAM,QAAQ;AAChC,UAAM,SAAS,OAAO,SAAS;AAC/B,QAAI,aAAa,CAAC,mBAAmB,SAAS,GAAG;AAC/C,aAAO,IAAI,MAAM,2BAA2B,QAAQ,aAAa,CAAC;AAAA,IACpE;AACA,WAAO;AAAA,EACT;AACF;AAKA,SAAS,2BAA2B,OAAe,eAAuB;AACxE,SAAO,2CAA2C,KAAK,oBAAoB,aAAa;AAAA;AAAA;AAAA;AAAA,kBAIxE,mBAAmB;AACrC;AAEA,SAAS,mBAAmB,aAA8C;AACxE,SAAO,aAAa,SAAS,WAAW;AAC1C;AAEA,IAAM,OAAO;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radix-ui/react-separator",
3
- "version": "1.0.3",
3
+ "version": "1.1.0-rc.2",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": {
@@ -28,8 +28,7 @@
28
28
  "version": "yarn version"
29
29
  },
30
30
  "dependencies": {
31
- "@babel/runtime": "^7.13.10",
32
- "@radix-ui/react-primitive": "1.0.3"
31
+ "@radix-ui/react-primitive": "1.1.0-rc.2"
33
32
  },
34
33
  "peerDependencies": {
35
34
  "@types/react": "*",
@@ -52,5 +51,6 @@
52
51
  },
53
52
  "bugs": {
54
53
  "url": "https://github.com/radix-ui/primitives/issues"
55
- }
54
+ },
55
+ "stableVersion": "1.0.3"
56
56
  }
@@ -1 +0,0 @@
1
- {"mappings":";;;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;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;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","packages/react/separator/src/index.ts"],"sourcesContent":[null,null,"export {\n Separator,\n //\n Root,\n} from './Separator';\nexport type { SeparatorProps } from './Separator';\n"],"names":[],"version":3,"file":"index.d.ts.map"}