@radix-ui/react-separator 0.1.5-rc.2 → 0.1.5-rc.5

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.
@@ -1 +1 @@
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"}
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 * from './Separator';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
package/dist/index.js CHANGED
@@ -1,2 +1,86 @@
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;
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$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 $1d2e81bd6a105992$exports = {};
28
+
29
+ $parcel$export($1d2e81bd6a105992$exports, "Separator", () => $1d2e81bd6a105992$export$1ff3c3f08ae963c0);
30
+ $parcel$export($1d2e81bd6a105992$exports, "Root", () => $1d2e81bd6a105992$export$be92b6f5f03c0fe9);
31
+
32
+
33
+
34
+ /* -------------------------------------------------------------------------------------------------
35
+ * Separator
36
+ * -----------------------------------------------------------------------------------------------*/ const $1d2e81bd6a105992$var$NAME = 'Separator';
37
+ const $1d2e81bd6a105992$var$DEFAULT_ORIENTATION = 'horizontal';
38
+ const $1d2e81bd6a105992$var$ORIENTATIONS = [
39
+ 'horizontal',
40
+ 'vertical'
41
+ ];
42
+ const $1d2e81bd6a105992$export$1ff3c3f08ae963c0 = /*#__PURE__*/ $3sOcx$react.forwardRef((props, forwardedRef)=>{
43
+ const { decorative: decorative , orientation: orientationProp = $1d2e81bd6a105992$var$DEFAULT_ORIENTATION , ...domProps } = props;
44
+ 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
45
+ const ariaOrientation = orientation === 'vertical' ? orientation : undefined;
46
+ const semanticProps = decorative ? {
47
+ role: 'none'
48
+ } : {
49
+ 'aria-orientation': ariaOrientation,
50
+ role: 'separator'
51
+ };
52
+ return /*#__PURE__*/ $3sOcx$react.createElement($3sOcx$radixuireactprimitive.Primitive.div, ($parcel$interopDefault($3sOcx$babelruntimehelpersextends))({
53
+ "data-orientation": orientation
54
+ }, semanticProps, domProps, {
55
+ ref: forwardedRef
56
+ }));
57
+ });
58
+ /*#__PURE__*/ Object.assign($1d2e81bd6a105992$export$1ff3c3f08ae963c0, {
59
+ displayName: $1d2e81bd6a105992$var$NAME
60
+ });
61
+ $1d2e81bd6a105992$export$1ff3c3f08ae963c0.propTypes = {
62
+ orientation (props, propName, componentName) {
63
+ const propValue = props[propName];
64
+ const strVal = String(propValue);
65
+ if (propValue && !$1d2e81bd6a105992$var$isValidOrientation(propValue)) return new Error($1d2e81bd6a105992$var$getInvalidOrientationError(strVal, componentName));
66
+ return null;
67
+ }
68
+ };
69
+ /* -----------------------------------------------------------------------------------------------*/ // Split this out for clearer readability of the error message.
70
+ function $1d2e81bd6a105992$var$getInvalidOrientationError(value, componentName) {
71
+ return `Invalid prop \`orientation\` of value \`${value}\` supplied to \`${componentName}\`, expected one of:
72
+ - horizontal
73
+ - vertical
74
+
75
+ Defaulting to \`${$1d2e81bd6a105992$var$DEFAULT_ORIENTATION}\`.`;
76
+ }
77
+ function $1d2e81bd6a105992$var$isValidOrientation(orientation) {
78
+ return $1d2e81bd6a105992$var$ORIENTATIONS.includes(orientation);
79
+ }
80
+ const $1d2e81bd6a105992$export$be92b6f5f03c0fe9 = $1d2e81bd6a105992$export$1ff3c3f08ae963c0;
81
+
82
+
83
+ $parcel$exportWildcard(module.exports, $1d2e81bd6a105992$exports);
84
+
85
+
2
86
  //# 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,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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S,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,EAAkBjB,yCAAoB,CAAA,GAAA,CAJpC,CAIF;CACC;AAED,SAASU,wCAAT,CAA4BH,WAA5B,EAA0E;IACxE,OAAON,kCAAY,CAACuB,QAAb,CAAsBjB,WAAtB,CAAP,CAAA;CACD;AAED,MAAMkB,yCAAI,GAAGvB,yCAAb,AAAA;;AD3EA","sources":["packages/react/separator/src/index.ts","packages/react/separator/src/Separator.tsx"],"sourcesContent":["export * 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":["React","Primitive","NAME","DEFAULT_ORIENTATION","ORIENTATIONS","Separator","forwardRef","props","forwardedRef","decorative","orientation","orientationProp","domProps","isValidOrientation","ariaOrientation","undefined","semanticProps","role","propTypes","propName","componentName","propValue","strVal","String","Error","getInvalidOrientationError","value","includes","Root"],"version":3,"file":"index.js.map"}
@@ -1,2 +1,67 @@
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;
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
+ function $parcel$export(e, n, v, s) {
6
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
+ }
8
+ var $89eedd556c436f6a$exports = {};
9
+
10
+ $parcel$export($89eedd556c436f6a$exports, "Separator", () => $89eedd556c436f6a$export$1ff3c3f08ae963c0);
11
+ $parcel$export($89eedd556c436f6a$exports, "Root", () => $89eedd556c436f6a$export$be92b6f5f03c0fe9);
12
+
13
+
14
+
15
+ /* -------------------------------------------------------------------------------------------------
16
+ * Separator
17
+ * -----------------------------------------------------------------------------------------------*/ const $89eedd556c436f6a$var$NAME = 'Separator';
18
+ const $89eedd556c436f6a$var$DEFAULT_ORIENTATION = 'horizontal';
19
+ const $89eedd556c436f6a$var$ORIENTATIONS = [
20
+ 'horizontal',
21
+ 'vertical'
22
+ ];
23
+ const $89eedd556c436f6a$export$1ff3c3f08ae963c0 = /*#__PURE__*/ $5WXm8$forwardRef((props, forwardedRef)=>{
24
+ const { decorative: decorative , orientation: orientationProp = $89eedd556c436f6a$var$DEFAULT_ORIENTATION , ...domProps } = props;
25
+ 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
26
+ const ariaOrientation = orientation === 'vertical' ? orientation : undefined;
27
+ const semanticProps = decorative ? {
28
+ role: 'none'
29
+ } : {
30
+ 'aria-orientation': ariaOrientation,
31
+ role: 'separator'
32
+ };
33
+ return /*#__PURE__*/ $5WXm8$createElement($5WXm8$Primitive.div, $5WXm8$babelruntimehelpersesmextends({
34
+ "data-orientation": orientation
35
+ }, semanticProps, domProps, {
36
+ ref: forwardedRef
37
+ }));
38
+ });
39
+ /*#__PURE__*/ Object.assign($89eedd556c436f6a$export$1ff3c3f08ae963c0, {
40
+ displayName: $89eedd556c436f6a$var$NAME
41
+ });
42
+ $89eedd556c436f6a$export$1ff3c3f08ae963c0.propTypes = {
43
+ orientation (props, propName, componentName) {
44
+ const propValue = props[propName];
45
+ const strVal = String(propValue);
46
+ if (propValue && !$89eedd556c436f6a$var$isValidOrientation(propValue)) return new Error($89eedd556c436f6a$var$getInvalidOrientationError(strVal, componentName));
47
+ return null;
48
+ }
49
+ };
50
+ /* -----------------------------------------------------------------------------------------------*/ // Split this out for clearer readability of the error message.
51
+ function $89eedd556c436f6a$var$getInvalidOrientationError(value, componentName) {
52
+ return `Invalid prop \`orientation\` of value \`${value}\` supplied to \`${componentName}\`, expected one of:
53
+ - horizontal
54
+ - vertical
55
+
56
+ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
57
+ }
58
+ function $89eedd556c436f6a$var$isValidOrientation(orientation) {
59
+ return $89eedd556c436f6a$var$ORIENTATIONS.includes(orientation);
60
+ }
61
+ const $89eedd556c436f6a$export$be92b6f5f03c0fe9 = $89eedd556c436f6a$export$1ff3c3f08ae963c0;
62
+
63
+
64
+
65
+
66
+ export {$89eedd556c436f6a$export$1ff3c3f08ae963c0 as Separator, $89eedd556c436f6a$export$be92b6f5f03c0fe9 as Root};
2
67
  //# sourceMappingURL=index.module.js.map
@@ -1 +1 @@
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"}
1
+ {"mappings":";;;;;;;;;;;A;;;ACKA;;oGAEA,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,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,EAAkBjB,yCAAoB,CAAA,GAAA,CAJpC,CAIF;CACC;AAED,SAASU,wCAAT,CAA4BH,WAA5B,EAA0E;IACxE,OAAON,kCAAY,CAACuB,QAAb,CAAsBjB,WAAtB,CAAP,CAAA;CACD;AAED,MAAMkB,yCAAI,GAAGvB,yCAAb,AAAA;;AD3EA","sources":["packages/react/separator/src/index.ts","packages/react/separator/src/Separator.tsx"],"sourcesContent":["export * 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":["React","Primitive","NAME","DEFAULT_ORIENTATION","ORIENTATIONS","Separator","forwardRef","props","forwardedRef","decorative","orientation","orientationProp","domProps","isValidOrientation","ariaOrientation","undefined","semanticProps","role","propTypes","propName","componentName","propValue","strVal","String","Error","getInvalidOrientationError","value","includes","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.1.5-rc.2",
3
+ "version": "0.1.5-rc.5",
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-primitive": "0.1.5-rc.2"
20
+ "@radix-ui/react-primitive": "0.1.5-rc.5"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "react": "^16.8 || ^17.0 || ^18.0"