@radix-ui/react-separator 1.0.3-rc.5 → 1.0.3-rc.7
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
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as Radix from "@radix-ui/react-primitive";
|
|
3
|
+
import { Primitive } from "@radix-ui/react-primitive";
|
|
4
|
+
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 {
|
|
8
|
+
/**
|
|
9
|
+
* Either `vertical` or `horizontal`. Defaults to `horizontal`.
|
|
10
|
+
*/
|
|
11
|
+
orientation?: Orientation;
|
|
12
|
+
/**
|
|
13
|
+
* Whether or not the component is purely decorative. When true, accessibility-related attributes
|
|
14
|
+
* are updated so that that the rendered element is removed from the accessibility tree.
|
|
15
|
+
*/
|
|
16
|
+
decorative?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export const Separator: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
export const Root: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -57,4 +57,4 @@ const $89eedd556c436f6a$export$be92b6f5f03c0fe9 = $89eedd556c436f6a$export$1ff3c
|
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
export {$89eedd556c436f6a$export$1ff3c3f08ae963c0 as Separator, $89eedd556c436f6a$export$be92b6f5f03c0fe9 as Root};
|
|
60
|
-
//# sourceMappingURL=index.
|
|
60
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;A;;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A;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.
|
|
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;AAi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P,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"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radix-ui/react-separator",
|
|
3
|
-
"version": "1.0.3-rc.
|
|
3
|
+
"version": "1.0.3-rc.7",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"import": {
|
|
8
|
+
"types": "./dist/index.d.mts",
|
|
9
|
+
"default": "./dist/index.mjs"
|
|
10
|
+
},
|
|
11
|
+
"require": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"source": "./src/index.ts",
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"module": "./dist/index.mjs",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
9
21
|
"files": [
|
|
10
22
|
"dist",
|
|
11
23
|
"README.md"
|
|
@@ -17,7 +29,7 @@
|
|
|
17
29
|
},
|
|
18
30
|
"dependencies": {
|
|
19
31
|
"@babel/runtime": "^7.13.10",
|
|
20
|
-
"@radix-ui/react-primitive": "1.0.3-rc.
|
|
32
|
+
"@radix-ui/react-primitive": "1.0.3-rc.7"
|
|
21
33
|
},
|
|
22
34
|
"peerDependencies": {
|
|
23
35
|
"react": "^16.8 || ^17.0 || ^18.0",
|