node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

13
server/node_modules/@radix-ui/number/README.md generated vendored Normal file
View File

@@ -0,0 +1,13 @@
# `number`
## Installation
```sh
$ yarn add @radix-ui/number
# or
$ npm install @radix-ui/number
```
## Usage
This is an internal utility, not intended for public usage.

View File

@@ -0,0 +1,3 @@
export function clamp(value: number, [min, max]: [number, number]): number;
//# sourceMappingURL=index.d.ts.map

3
server/node_modules/@radix-ui/number/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export function clamp(value: number, [min, max]: [number, number]): number;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"mappings":"AAAA,sBAAe,KAAK,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAElE","sources":["packages/core/number/src/packages/core/number/src/number.ts","packages/core/number/src/packages/core/number/src/index.ts","packages/core/number/src/index.ts"],"sourcesContent":[null,null,"export { clamp } from './number';\n"],"names":[],"version":3,"file":"index.d.ts.map"}

13
server/node_modules/@radix-ui/number/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "clamp", () => $8e747672ba00eedb$export$7d15b64cf5a3a4c4);
function $8e747672ba00eedb$export$7d15b64cf5a3a4c4(value, [min, max]) {
return Math.min(max, Math.max(min, value));
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"mappings":";;;;;ACAA,SAASA,yCAAT,CAAeC,KAAf,EAA8B,CAACC,GAAD,EAAMC,GAAN,CAA9B,EAAoE;IAClE,OAAOC,IAAI,CAACF,GAAL,CAASC,GAAT,EAAcC,IAAI,CAACD,GAAL,CAASD,GAAT,EAAcD,KAAd,CAAd,CAAP,CAAA;CACD;;ADFD","sources":["packages/core/number/src/index.ts","packages/core/number/src/number.ts"],"sourcesContent":["export { clamp } from './number';\n","function clamp(value: number, [min, max]: [number, number]): number {\n return Math.min(max, Math.max(min, value));\n}\n\nexport { clamp };\n"],"names":["clamp","value","min","max","Math"],"version":3,"file":"index.js.map"}

9
server/node_modules/@radix-ui/number/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,9 @@
function $ae6933e535247d3d$export$7d15b64cf5a3a4c4(value, [min, max]) {
return Math.min(max, Math.max(min, value));
}
export {$ae6933e535247d3d$export$7d15b64cf5a3a4c4 as clamp};
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"mappings":"ACAA,SAASA,yCAAT,CAAeC,KAAf,EAA8B,CAACC,GAAD,EAAMC,GAAN,CAA9B,EAAoE;IAClE,OAAOC,IAAI,CAACF,GAAL,CAASC,GAAT,EAAcC,IAAI,CAACD,GAAL,CAASD,GAAT,EAAcD,KAAd,CAAd,CAAP,CAAA;CACD;;ADFD","sources":["packages/core/number/src/index.ts","packages/core/number/src/number.ts"],"sourcesContent":["export { clamp } from './number';\n","function clamp(value: number, [min, max]: [number, number]): number {\n return Math.min(max, Math.max(min, value));\n}\n\nexport { clamp };\n"],"names":["clamp","value","min","max","Math"],"version":3,"file":"index.mjs.map"}

41
server/node_modules/@radix-ui/number/package.json generated vendored Normal file
View File

@@ -0,0 +1,41 @@
{
"name": "@radix-ui/number",
"version": "1.0.1",
"license": "MIT",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"source": "./src/index.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"README.md"
],
"sideEffects": false,
"scripts": {
"clean": "rm -rf dist",
"version": "yarn version"
},
"homepage": "https://radix-ui.com/primitives",
"repository": {
"type": "git",
"url": "git+https://github.com/radix-ui/primitives.git"
},
"bugs": {
"url": "https://github.com/radix-ui/primitives/issues"
},
"dependencies": {
"@babel/runtime": "^7.13.10"
}
}

13
server/node_modules/@radix-ui/primitive/README.md generated vendored Normal file
View File

@@ -0,0 +1,13 @@
# `primitive`
## Installation
```sh
$ yarn add @radix-ui/primitive
# or
$ npm install @radix-ui/primitive
```
## Usage
This is an internal utility, not intended for public usage.

View File

@@ -0,0 +1,5 @@
export function composeEventHandlers<E>(originalEventHandler?: (event: E) => void, ourEventHandler?: (event: E) => void, { checkForDefaultPrevented }?: {
checkForDefaultPrevented?: boolean | undefined;
}): (event: E) => void;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,5 @@
export function composeEventHandlers<E>(originalEventHandler?: (event: E) => void, ourEventHandler?: (event: E) => void, { checkForDefaultPrevented }?: {
checkForDefaultPrevented?: boolean | undefined;
}): (event: E) => void;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"mappings":"AAAA,qCAA8B,CAAC,EAC7B,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,EACzC,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,EACpC,EAAE,wBAA+B,EAAE;;CAAK,WAEL,CAAC,UAOrC","sources":["packages/core/primitive/src/packages/core/primitive/src/primitive.tsx","packages/core/primitive/src/packages/core/primitive/src/index.ts","packages/core/primitive/src/index.ts"],"sourcesContent":[null,null,"export { composeEventHandlers } from './primitive';\n"],"names":[],"version":3,"file":"index.d.ts.map"}

16
server/node_modules/@radix-ui/primitive/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "composeEventHandlers", () => $1a6a90a521dcd173$export$b9ecd428b558ff10);
function $1a6a90a521dcd173$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented: checkForDefaultPrevented = true } = {}) {
return function handleEvent(event) {
originalEventHandler === null || originalEventHandler === void 0 || originalEventHandler(event);
if (checkForDefaultPrevented === false || !event.defaultPrevented) return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);
};
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"mappings":";;;;;ACAA,SAASA,yCAAT,CACEC,oBADF,EAEEC,eAFF,EAGE,4BAAEC,wBAAwB,GAAG,IAA3BA,GAAF,GAAsC,EAHxC,EAIE;IACA,OAAO,SAASC,WAAT,CAAqBC,KAArB,EAA+B;QACpCJ,oBAAoB,KAAA,IAApB,IAAAA,oBAAoB,KAAA,KAAA,CAApB,IAAAA,oBAAoB,CAAGI,KAAH,CAApB,CAAAJ;QAEA,IAAIE,wBAAwB,KAAK,KAA7B,IAAsC,CAAGE,KAAF,CAA8BC,gBAAzE,EACE,OAAOJ,eAAP,KAAA,IAAA,IAAOA,eAAP,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAOA,eAAe,CAAGG,KAAH,CAAtB,CAAA;KAJJ,CAMC;CACF;;ADZD","sources":["packages/core/primitive/src/index.ts","packages/core/primitive/src/primitive.tsx"],"sourcesContent":["export { composeEventHandlers } from './primitive';\n","function composeEventHandlers<E>(\n originalEventHandler?: (event: E) => void,\n ourEventHandler?: (event: E) => void,\n { checkForDefaultPrevented = true } = {}\n) {\n return function handleEvent(event: E) {\n originalEventHandler?.(event);\n\n if (checkForDefaultPrevented === false || !((event as unknown) as Event).defaultPrevented) {\n return ourEventHandler?.(event);\n }\n };\n}\n\nexport { composeEventHandlers };\n"],"names":["composeEventHandlers","originalEventHandler","ourEventHandler","checkForDefaultPrevented","handleEvent","event","defaultPrevented"],"version":3,"file":"index.js.map"}

12
server/node_modules/@radix-ui/primitive/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,12 @@
function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented: checkForDefaultPrevented = true } = {}) {
return function handleEvent(event) {
originalEventHandler === null || originalEventHandler === void 0 || originalEventHandler(event);
if (checkForDefaultPrevented === false || !event.defaultPrevented) return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);
};
}
export {$e42e1063c40fb3ef$export$b9ecd428b558ff10 as composeEventHandlers};
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"mappings":"ACAA,SAASA,yCAAT,CACEC,oBADF,EAEEC,eAFF,EAGE,4BAAEC,wBAAwB,GAAG,IAA3BA,GAAF,GAAsC,EAHxC,EAIE;IACA,OAAO,SAASC,WAAT,CAAqBC,KAArB,EAA+B;QACpCJ,oBAAoB,KAAA,IAApB,IAAAA,oBAAoB,KAAA,KAAA,CAApB,IAAAA,oBAAoB,CAAGI,KAAH,CAApB,CAAAJ;QAEA,IAAIE,wBAAwB,KAAK,KAA7B,IAAsC,CAAGE,KAAF,CAA8BC,gBAAzE,EACE,OAAOJ,eAAP,KAAA,IAAA,IAAOA,eAAP,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAOA,eAAe,CAAGG,KAAH,CAAtB,CAAA;KAJJ,CAMC;CACF;;ADZD","sources":["packages/core/primitive/src/index.ts","packages/core/primitive/src/primitive.tsx"],"sourcesContent":["export { composeEventHandlers } from './primitive';\n","function composeEventHandlers<E>(\n originalEventHandler?: (event: E) => void,\n ourEventHandler?: (event: E) => void,\n { checkForDefaultPrevented = true } = {}\n) {\n return function handleEvent(event: E) {\n originalEventHandler?.(event);\n\n if (checkForDefaultPrevented === false || !((event as unknown) as Event).defaultPrevented) {\n return ourEventHandler?.(event);\n }\n };\n}\n\nexport { composeEventHandlers };\n"],"names":["composeEventHandlers","originalEventHandler","ourEventHandler","checkForDefaultPrevented","handleEvent","event","defaultPrevented"],"version":3,"file":"index.mjs.map"}

41
server/node_modules/@radix-ui/primitive/package.json generated vendored Normal file
View File

@@ -0,0 +1,41 @@
{
"name": "@radix-ui/primitive",
"version": "1.0.1",
"license": "MIT",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"source": "./src/index.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"README.md"
],
"sideEffects": false,
"scripts": {
"clean": "rm -rf dist",
"version": "yarn version"
},
"homepage": "https://radix-ui.com/primitives",
"repository": {
"type": "git",
"url": "git+https://github.com/radix-ui/primitives.git"
},
"bugs": {
"url": "https://github.com/radix-ui/primitives/issues"
},
"dependencies": {
"@babel/runtime": "^7.13.10"
}
}

View File

@@ -0,0 +1,13 @@
# `react-accordion`
## Installation
```sh
$ yarn add @radix-ui/react-accordion
# or
$ npm install @radix-ui/react-accordion
```
## Usage
View docs [here](https://radix-ui.com/primitives/docs/components/accordion).

View File

@@ -0,0 +1,113 @@
import React from "react";
import * as Radix from "@radix-ui/react-primitive";
import { Primitive } from "@radix-ui/react-primitive";
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
type Direction = 'ltr' | 'rtl';
export const createAccordionScope: import("@radix-ui/react-context").CreateScope;
export interface AccordionSingleProps extends AccordionImplSingleProps {
type: 'single';
}
export interface AccordionMultipleProps extends AccordionImplMultipleProps {
type: 'multiple';
}
export const Accordion: React.ForwardRefExoticComponent<(AccordionSingleProps | AccordionMultipleProps) & React.RefAttributes<HTMLDivElement>>;
interface AccordionImplSingleProps extends AccordionImplProps {
/**
* The controlled stateful value of the accordion item whose content is expanded.
*/
value?: string;
/**
* The value of the item whose content is expanded when the accordion is initially rendered. Use
* `defaultValue` if you do not need to control the state of an accordion.
*/
defaultValue?: string;
/**
* The callback that fires when the state of the accordion changes.
*/
onValueChange?(value: string): void;
/**
* Whether an accordion item can be collapsed after it has been opened.
* @default false
*/
collapsible?: boolean;
}
interface AccordionImplMultipleProps extends AccordionImplProps {
/**
* The controlled stateful value of the accordion items whose contents are expanded.
*/
value?: string[];
/**
* The value of the items whose contents are expanded when the accordion is initially rendered. Use
* `defaultValue` if you do not need to control the state of an accordion.
*/
defaultValue?: string[];
/**
* The callback that fires when the state of the accordion changes.
*/
onValueChange?(value: string[]): void;
}
type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
interface AccordionImplProps extends PrimitiveDivProps {
/**
* Whether or not an accordion is disabled from user interaction.
*
* @defaultValue false
*/
disabled?: boolean;
/**
* The layout in which the Accordion operates.
* @default vertical
*/
orientation?: React.AriaAttributes['aria-orientation'];
/**
* The language read direction.
*/
dir?: Direction;
}
type CollapsibleProps = Radix.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Root>;
export interface AccordionItemProps extends Omit<CollapsibleProps, 'open' | 'defaultOpen' | 'onOpenChange'> {
/**
* Whether or not an accordion item is disabled from user interaction.
*
* @defaultValue false
*/
disabled?: boolean;
/**
* A string value for the accordion item. All items within an accordion should use a unique value.
*/
value: string;
}
/**
* `AccordionItem` contains all of the parts of a collapsible section inside of an `Accordion`.
*/
export const AccordionItem: React.ForwardRefExoticComponent<AccordionItemProps & React.RefAttributes<HTMLDivElement>>;
type PrimitiveHeading3Props = Radix.ComponentPropsWithoutRef<typeof Primitive.h3>;
export interface AccordionHeaderProps extends PrimitiveHeading3Props {
}
/**
* `AccordionHeader` contains the content for the parts of an `AccordionItem` that will be visible
* whether or not its content is collapsed.
*/
export const AccordionHeader: React.ForwardRefExoticComponent<AccordionHeaderProps & React.RefAttributes<HTMLHeadingElement>>;
type CollapsibleTriggerProps = Radix.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Trigger>;
export interface AccordionTriggerProps extends CollapsibleTriggerProps {
}
/**
* `AccordionTrigger` is the trigger that toggles the collapsed state of an `AccordionItem`. It
* should always be nested inside of an `AccordionHeader`.
*/
export const AccordionTrigger: React.ForwardRefExoticComponent<AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>>;
type CollapsibleContentProps = Radix.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Content>;
export interface AccordionContentProps extends CollapsibleContentProps {
}
/**
* `AccordionContent` contains the collapsible content for an `AccordionItem`.
*/
export const AccordionContent: React.ForwardRefExoticComponent<AccordionContentProps & React.RefAttributes<HTMLDivElement>>;
export const Root: React.ForwardRefExoticComponent<(AccordionSingleProps | AccordionMultipleProps) & React.RefAttributes<HTMLDivElement>>;
export const Item: React.ForwardRefExoticComponent<AccordionItemProps & React.RefAttributes<HTMLDivElement>>;
export const Header: React.ForwardRefExoticComponent<AccordionHeaderProps & React.RefAttributes<HTMLHeadingElement>>;
export const Trigger: React.ForwardRefExoticComponent<AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>>;
export const Content: React.ForwardRefExoticComponent<AccordionContentProps & React.RefAttributes<HTMLDivElement>>;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,113 @@
import React from "react";
import * as Radix from "@radix-ui/react-primitive";
import { Primitive } from "@radix-ui/react-primitive";
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
type Direction = 'ltr' | 'rtl';
export const createAccordionScope: import("@radix-ui/react-context").CreateScope;
export interface AccordionSingleProps extends AccordionImplSingleProps {
type: 'single';
}
export interface AccordionMultipleProps extends AccordionImplMultipleProps {
type: 'multiple';
}
export const Accordion: React.ForwardRefExoticComponent<(AccordionSingleProps | AccordionMultipleProps) & React.RefAttributes<HTMLDivElement>>;
interface AccordionImplSingleProps extends AccordionImplProps {
/**
* The controlled stateful value of the accordion item whose content is expanded.
*/
value?: string;
/**
* The value of the item whose content is expanded when the accordion is initially rendered. Use
* `defaultValue` if you do not need to control the state of an accordion.
*/
defaultValue?: string;
/**
* The callback that fires when the state of the accordion changes.
*/
onValueChange?(value: string): void;
/**
* Whether an accordion item can be collapsed after it has been opened.
* @default false
*/
collapsible?: boolean;
}
interface AccordionImplMultipleProps extends AccordionImplProps {
/**
* The controlled stateful value of the accordion items whose contents are expanded.
*/
value?: string[];
/**
* The value of the items whose contents are expanded when the accordion is initially rendered. Use
* `defaultValue` if you do not need to control the state of an accordion.
*/
defaultValue?: string[];
/**
* The callback that fires when the state of the accordion changes.
*/
onValueChange?(value: string[]): void;
}
type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
interface AccordionImplProps extends PrimitiveDivProps {
/**
* Whether or not an accordion is disabled from user interaction.
*
* @defaultValue false
*/
disabled?: boolean;
/**
* The layout in which the Accordion operates.
* @default vertical
*/
orientation?: React.AriaAttributes['aria-orientation'];
/**
* The language read direction.
*/
dir?: Direction;
}
type CollapsibleProps = Radix.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Root>;
export interface AccordionItemProps extends Omit<CollapsibleProps, 'open' | 'defaultOpen' | 'onOpenChange'> {
/**
* Whether or not an accordion item is disabled from user interaction.
*
* @defaultValue false
*/
disabled?: boolean;
/**
* A string value for the accordion item. All items within an accordion should use a unique value.
*/
value: string;
}
/**
* `AccordionItem` contains all of the parts of a collapsible section inside of an `Accordion`.
*/
export const AccordionItem: React.ForwardRefExoticComponent<AccordionItemProps & React.RefAttributes<HTMLDivElement>>;
type PrimitiveHeading3Props = Radix.ComponentPropsWithoutRef<typeof Primitive.h3>;
export interface AccordionHeaderProps extends PrimitiveHeading3Props {
}
/**
* `AccordionHeader` contains the content for the parts of an `AccordionItem` that will be visible
* whether or not its content is collapsed.
*/
export const AccordionHeader: React.ForwardRefExoticComponent<AccordionHeaderProps & React.RefAttributes<HTMLHeadingElement>>;
type CollapsibleTriggerProps = Radix.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Trigger>;
export interface AccordionTriggerProps extends CollapsibleTriggerProps {
}
/**
* `AccordionTrigger` is the trigger that toggles the collapsed state of an `AccordionItem`. It
* should always be nested inside of an `AccordionHeader`.
*/
export const AccordionTrigger: React.ForwardRefExoticComponent<AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>>;
type CollapsibleContentProps = Radix.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Content>;
export interface AccordionContentProps extends CollapsibleContentProps {
}
/**
* `AccordionContent` contains the collapsible content for an `AccordionItem`.
*/
export const AccordionContent: React.ForwardRefExoticComponent<AccordionContentProps & React.RefAttributes<HTMLDivElement>>;
export const Root: React.ForwardRefExoticComponent<(AccordionSingleProps | AccordionMultipleProps) & React.RefAttributes<HTMLDivElement>>;
export const Item: React.ForwardRefExoticComponent<AccordionItemProps & React.RefAttributes<HTMLDivElement>>;
export const Header: React.ForwardRefExoticComponent<AccordionHeaderProps & React.RefAttributes<HTMLHeadingElement>>;
export const Trigger: React.ForwardRefExoticComponent<AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>>;
export const Content: React.ForwardRefExoticComponent<AccordionContentProps & React.RefAttributes<HTMLDivElement>>;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"mappings":";;;;AAeA,iBAAiB,KAAK,GAAG,KAAK,CAAC;AAa/B,OAAA,2FAGE,CAAC;AAIH,qCAA+B,SAAQ,wBAAwB;IAC7D,IAAI,EAAE,QAAQ,CAAC;CAChB;AACD,uCAAiC,SAAQ,0BAA0B;IACjE,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,OAAA,MAAM,iIAeL,CAAC;AA2CF,kCAAmC,SAAQ,kBAAkB;IAC3D;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAoCD,oCAAqC,SAAQ,kBAAkB;IAC7D;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB;;OAEG;IACH,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CACvC;AAwDD,yBAAyB,MAAM,wBAAwB,CAAC,OAAO,UAAU,GAAG,CAAC,CAAC;AAC9E,4BAA6B,SAAQ,iBAAiB;IACpD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,cAAc,CAAC,kBAAkB,CAAC,CAAC;IACvD;;OAEG;IACH,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB;AAiHD,wBAAwB,MAAM,wBAAwB,CAAC,OAAO,qBAAqB,IAAI,CAAC,CAAC;AACzF,mCACE,SAAQ,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,aAAa,GAAG,cAAc,CAAC;IACvE;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,OAAA,MAAM,wGAoCL,CAAC;AAWF,8BAA8B,MAAM,wBAAwB,CAAC,OAAO,UAAU,EAAE,CAAC,CAAC;AAClF,qCAA+B,SAAQ,sBAAsB;CAAG;AAEhE;;;GAGG;AACH,OAAA,MAAM,gHAeL,CAAC;AAWF,+BAA+B,MAAM,wBAAwB,CAAC,OAAO,qBAAqB,OAAO,CAAC,CAAC;AACnG,sCAAgC,SAAQ,uBAAuB;CAAG;AAElE;;;GAGG;AACH,OAAA,MAAM,iHAoBL,CAAC;AAWF,+BAA+B,MAAM,wBAAwB,CAAC,OAAO,qBAAqB,OAAO,CAAC,CAAC;AACnG,sCAAgC,SAAQ,uBAAuB;CAAG;AAElE;;GAEG;AACH,OAAA,MAAM,8GAsBL,CAAC;AAUF,OAAA,MAAM,4HAAgB,CAAC;AACvB,OAAA,MAAM,+FAAoB,CAAC;AAC3B,OAAA,MAAM,uGAAwB,CAAC;AAC/B,OAAA,MAAM,wGAA0B,CAAC;AACjC,OAAA,MAAM,qGAA0B,CAAC","sources":["packages/react/accordion/src/packages/react/accordion/src/Accordion.tsx","packages/react/accordion/src/packages/react/accordion/src/index.ts","packages/react/accordion/src/index.ts"],"sourcesContent":[null,null,"export {\n createAccordionScope,\n //\n Accordion,\n AccordionItem,\n AccordionHeader,\n AccordionTrigger,\n AccordionContent,\n //\n Root,\n Item,\n Header,\n Trigger,\n Content,\n} from './Accordion';\nexport type {\n AccordionSingleProps,\n AccordionMultipleProps,\n AccordionItemProps,\n AccordionHeaderProps,\n AccordionTriggerProps,\n AccordionContentProps,\n} from './Accordion';\n"],"names":[],"version":3,"file":"index.d.ts.map"}

View File

@@ -0,0 +1,342 @@
var $47SRi$babelruntimehelpersextends = require("@babel/runtime/helpers/extends");
var $47SRi$react = require("react");
var $47SRi$radixuireactcontext = require("@radix-ui/react-context");
var $47SRi$radixuireactcollection = require("@radix-ui/react-collection");
var $47SRi$radixuireactcomposerefs = require("@radix-ui/react-compose-refs");
var $47SRi$radixuiprimitive = require("@radix-ui/primitive");
var $47SRi$radixuireactusecontrollablestate = require("@radix-ui/react-use-controllable-state");
var $47SRi$radixuireactprimitive = require("@radix-ui/react-primitive");
var $47SRi$radixuireactcollapsible = require("@radix-ui/react-collapsible");
var $47SRi$radixuireactid = require("@radix-ui/react-id");
var $47SRi$radixuireactdirection = require("@radix-ui/react-direction");
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, "createAccordionScope", () => $0f4a20de0660bfd8$export$9748edc328a73be1);
$parcel$export(module.exports, "Accordion", () => $0f4a20de0660bfd8$export$a766cd26d0d69044);
$parcel$export(module.exports, "AccordionItem", () => $0f4a20de0660bfd8$export$d99097c13d4dac9f);
$parcel$export(module.exports, "AccordionHeader", () => $0f4a20de0660bfd8$export$5e3e5deaaf81ee41);
$parcel$export(module.exports, "AccordionTrigger", () => $0f4a20de0660bfd8$export$94e939b1f85bdd73);
$parcel$export(module.exports, "AccordionContent", () => $0f4a20de0660bfd8$export$985b9a77379b54a0);
$parcel$export(module.exports, "Root", () => $0f4a20de0660bfd8$export$be92b6f5f03c0fe9);
$parcel$export(module.exports, "Item", () => $0f4a20de0660bfd8$export$6d08773d2e66f8f2);
$parcel$export(module.exports, "Header", () => $0f4a20de0660bfd8$export$8b251419efc915eb);
$parcel$export(module.exports, "Trigger", () => $0f4a20de0660bfd8$export$41fb9f06171c75f4);
$parcel$export(module.exports, "Content", () => $0f4a20de0660bfd8$export$7c6e2c02157bb7d2);
/* -------------------------------------------------------------------------------------------------
* Accordion
* -----------------------------------------------------------------------------------------------*/ const $0f4a20de0660bfd8$var$ACCORDION_NAME = 'Accordion';
const $0f4a20de0660bfd8$var$ACCORDION_KEYS = [
'Home',
'End',
'ArrowDown',
'ArrowUp',
'ArrowLeft',
'ArrowRight'
];
const [$0f4a20de0660bfd8$var$Collection, $0f4a20de0660bfd8$var$useCollection, $0f4a20de0660bfd8$var$createCollectionScope] = $47SRi$radixuireactcollection.createCollection($0f4a20de0660bfd8$var$ACCORDION_NAME);
const [$0f4a20de0660bfd8$var$createAccordionContext, $0f4a20de0660bfd8$export$9748edc328a73be1] = $47SRi$radixuireactcontext.createContextScope($0f4a20de0660bfd8$var$ACCORDION_NAME, [
$0f4a20de0660bfd8$var$createCollectionScope,
$47SRi$radixuireactcollapsible.createCollapsibleScope
]);
const $0f4a20de0660bfd8$var$useCollapsibleScope = $47SRi$radixuireactcollapsible.createCollapsibleScope();
const $0f4a20de0660bfd8$export$a766cd26d0d69044 = /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).forwardRef((props, forwardedRef)=>{
const { type: type , ...accordionProps } = props;
const singleProps = accordionProps;
const multipleProps = accordionProps;
return /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).createElement($0f4a20de0660bfd8$var$Collection.Provider, {
scope: props.__scopeAccordion
}, type === 'multiple' ? /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).createElement($0f4a20de0660bfd8$var$AccordionImplMultiple, ($parcel$interopDefault($47SRi$babelruntimehelpersextends))({}, multipleProps, {
ref: forwardedRef
})) : /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).createElement($0f4a20de0660bfd8$var$AccordionImplSingle, ($parcel$interopDefault($47SRi$babelruntimehelpersextends))({}, singleProps, {
ref: forwardedRef
})));
});
/*#__PURE__*/ Object.assign($0f4a20de0660bfd8$export$a766cd26d0d69044, {
displayName: $0f4a20de0660bfd8$var$ACCORDION_NAME
});
$0f4a20de0660bfd8$export$a766cd26d0d69044.propTypes = {
type (props) {
const value = props.value || props.defaultValue;
if (props.type && ![
'single',
'multiple'
].includes(props.type)) return new Error('Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`.');
if (props.type === 'multiple' && typeof value === 'string') return new Error('Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`.');
if (props.type === 'single' && Array.isArray(value)) return new Error('Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`.');
return null;
}
};
/* -----------------------------------------------------------------------------------------------*/ const [$0f4a20de0660bfd8$var$AccordionValueProvider, $0f4a20de0660bfd8$var$useAccordionValueContext] = $0f4a20de0660bfd8$var$createAccordionContext($0f4a20de0660bfd8$var$ACCORDION_NAME);
const [$0f4a20de0660bfd8$var$AccordionCollapsibleProvider, $0f4a20de0660bfd8$var$useAccordionCollapsibleContext] = $0f4a20de0660bfd8$var$createAccordionContext($0f4a20de0660bfd8$var$ACCORDION_NAME, {
collapsible: false
});
const $0f4a20de0660bfd8$var$AccordionImplSingle = /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).forwardRef((props, forwardedRef)=>{
const { value: valueProp , defaultValue: defaultValue , onValueChange: onValueChange = ()=>{} , collapsible: collapsible = false , ...accordionSingleProps } = props;
const [value, setValue] = $47SRi$radixuireactusecontrollablestate.useControllableState({
prop: valueProp,
defaultProp: defaultValue,
onChange: onValueChange
});
return /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).createElement($0f4a20de0660bfd8$var$AccordionValueProvider, {
scope: props.__scopeAccordion,
value: value ? [
value
] : [],
onItemOpen: setValue,
onItemClose: ($parcel$interopDefault($47SRi$react)).useCallback(()=>collapsible && setValue('')
, [
collapsible,
setValue
])
}, /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).createElement($0f4a20de0660bfd8$var$AccordionCollapsibleProvider, {
scope: props.__scopeAccordion,
collapsible: collapsible
}, /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).createElement($0f4a20de0660bfd8$var$AccordionImpl, ($parcel$interopDefault($47SRi$babelruntimehelpersextends))({}, accordionSingleProps, {
ref: forwardedRef
}))));
});
/* -----------------------------------------------------------------------------------------------*/ const $0f4a20de0660bfd8$var$AccordionImplMultiple = /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).forwardRef((props, forwardedRef)=>{
const { value: valueProp , defaultValue: defaultValue , onValueChange: onValueChange = ()=>{} , ...accordionMultipleProps } = props;
const [value1 = [], setValue] = $47SRi$radixuireactusecontrollablestate.useControllableState({
prop: valueProp,
defaultProp: defaultValue,
onChange: onValueChange
});
const handleItemOpen = ($parcel$interopDefault($47SRi$react)).useCallback((itemValue)=>setValue((prevValue = [])=>[
...prevValue,
itemValue
]
)
, [
setValue
]);
const handleItemClose = ($parcel$interopDefault($47SRi$react)).useCallback((itemValue)=>setValue((prevValue = [])=>prevValue.filter((value)=>value !== itemValue
)
)
, [
setValue
]);
return /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).createElement($0f4a20de0660bfd8$var$AccordionValueProvider, {
scope: props.__scopeAccordion,
value: value1,
onItemOpen: handleItemOpen,
onItemClose: handleItemClose
}, /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).createElement($0f4a20de0660bfd8$var$AccordionCollapsibleProvider, {
scope: props.__scopeAccordion,
collapsible: true
}, /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).createElement($0f4a20de0660bfd8$var$AccordionImpl, ($parcel$interopDefault($47SRi$babelruntimehelpersextends))({}, accordionMultipleProps, {
ref: forwardedRef
}))));
});
/* -----------------------------------------------------------------------------------------------*/ const [$0f4a20de0660bfd8$var$AccordionImplProvider, $0f4a20de0660bfd8$var$useAccordionContext] = $0f4a20de0660bfd8$var$createAccordionContext($0f4a20de0660bfd8$var$ACCORDION_NAME);
const $0f4a20de0660bfd8$var$AccordionImpl = /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).forwardRef((props, forwardedRef)=>{
const { __scopeAccordion: __scopeAccordion , disabled: disabled , dir: dir , orientation: orientation = 'vertical' , ...accordionProps } = props;
const accordionRef = ($parcel$interopDefault($47SRi$react)).useRef(null);
const composedRefs = $47SRi$radixuireactcomposerefs.useComposedRefs(accordionRef, forwardedRef);
const getItems = $0f4a20de0660bfd8$var$useCollection(__scopeAccordion);
const direction = $47SRi$radixuireactdirection.useDirection(dir);
const isDirectionLTR = direction === 'ltr';
const handleKeyDown = $47SRi$radixuiprimitive.composeEventHandlers(props.onKeyDown, (event)=>{
var _triggerCollection$cl;
if (!$0f4a20de0660bfd8$var$ACCORDION_KEYS.includes(event.key)) return;
const target = event.target;
const triggerCollection = getItems().filter((item)=>{
var _item$ref$current;
return !((_item$ref$current = item.ref.current) !== null && _item$ref$current !== void 0 && _item$ref$current.disabled);
});
const triggerIndex = triggerCollection.findIndex((item)=>item.ref.current === target
);
const triggerCount = triggerCollection.length;
if (triggerIndex === -1) return; // Prevents page scroll while user is navigating
event.preventDefault();
let nextIndex = triggerIndex;
const homeIndex = 0;
const endIndex = triggerCount - 1;
const moveNext = ()=>{
nextIndex = triggerIndex + 1;
if (nextIndex > endIndex) nextIndex = homeIndex;
};
const movePrev = ()=>{
nextIndex = triggerIndex - 1;
if (nextIndex < homeIndex) nextIndex = endIndex;
};
switch(event.key){
case 'Home':
nextIndex = homeIndex;
break;
case 'End':
nextIndex = endIndex;
break;
case 'ArrowRight':
if (orientation === 'horizontal') {
if (isDirectionLTR) moveNext();
else movePrev();
}
break;
case 'ArrowDown':
if (orientation === 'vertical') moveNext();
break;
case 'ArrowLeft':
if (orientation === 'horizontal') {
if (isDirectionLTR) movePrev();
else moveNext();
}
break;
case 'ArrowUp':
if (orientation === 'vertical') movePrev();
break;
}
const clampedIndex = nextIndex % triggerCount;
(_triggerCollection$cl = triggerCollection[clampedIndex].ref.current) === null || _triggerCollection$cl === void 0 || _triggerCollection$cl.focus();
});
return /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).createElement($0f4a20de0660bfd8$var$AccordionImplProvider, {
scope: __scopeAccordion,
disabled: disabled,
direction: dir,
orientation: orientation
}, /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).createElement($0f4a20de0660bfd8$var$Collection.Slot, {
scope: __scopeAccordion
}, /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).createElement($47SRi$radixuireactprimitive.Primitive.div, ($parcel$interopDefault($47SRi$babelruntimehelpersextends))({}, accordionProps, {
"data-orientation": orientation,
ref: composedRefs,
onKeyDown: disabled ? undefined : handleKeyDown
}))));
});
/* -------------------------------------------------------------------------------------------------
* AccordionItem
* -----------------------------------------------------------------------------------------------*/ const $0f4a20de0660bfd8$var$ITEM_NAME = 'AccordionItem';
const [$0f4a20de0660bfd8$var$AccordionItemProvider, $0f4a20de0660bfd8$var$useAccordionItemContext] = $0f4a20de0660bfd8$var$createAccordionContext($0f4a20de0660bfd8$var$ITEM_NAME);
/**
* `AccordionItem` contains all of the parts of a collapsible section inside of an `Accordion`.
*/ const $0f4a20de0660bfd8$export$d99097c13d4dac9f = /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).forwardRef((props, forwardedRef)=>{
const { __scopeAccordion: __scopeAccordion , value: value , ...accordionItemProps } = props;
const accordionContext = $0f4a20de0660bfd8$var$useAccordionContext($0f4a20de0660bfd8$var$ITEM_NAME, __scopeAccordion);
const valueContext = $0f4a20de0660bfd8$var$useAccordionValueContext($0f4a20de0660bfd8$var$ITEM_NAME, __scopeAccordion);
const collapsibleScope = $0f4a20de0660bfd8$var$useCollapsibleScope(__scopeAccordion);
const triggerId = $47SRi$radixuireactid.useId();
const open1 = value && valueContext.value.includes(value) || false;
const disabled = accordionContext.disabled || props.disabled;
return /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).createElement($0f4a20de0660bfd8$var$AccordionItemProvider, {
scope: __scopeAccordion,
open: open1,
disabled: disabled,
triggerId: triggerId
}, /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).createElement($47SRi$radixuireactcollapsible.Root, ($parcel$interopDefault($47SRi$babelruntimehelpersextends))({
"data-orientation": accordionContext.orientation,
"data-state": $0f4a20de0660bfd8$var$getState(open1)
}, collapsibleScope, accordionItemProps, {
ref: forwardedRef,
disabled: disabled,
open: open1,
onOpenChange: (open)=>{
if (open) valueContext.onItemOpen(value);
else valueContext.onItemClose(value);
}
})));
});
/*#__PURE__*/ Object.assign($0f4a20de0660bfd8$export$d99097c13d4dac9f, {
displayName: $0f4a20de0660bfd8$var$ITEM_NAME
});
/* -------------------------------------------------------------------------------------------------
* AccordionHeader
* -----------------------------------------------------------------------------------------------*/ const $0f4a20de0660bfd8$var$HEADER_NAME = 'AccordionHeader';
/**
* `AccordionHeader` contains the content for the parts of an `AccordionItem` that will be visible
* whether or not its content is collapsed.
*/ const $0f4a20de0660bfd8$export$5e3e5deaaf81ee41 = /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).forwardRef((props, forwardedRef)=>{
const { __scopeAccordion: __scopeAccordion , ...headerProps } = props;
const accordionContext = $0f4a20de0660bfd8$var$useAccordionContext($0f4a20de0660bfd8$var$ACCORDION_NAME, __scopeAccordion);
const itemContext = $0f4a20de0660bfd8$var$useAccordionItemContext($0f4a20de0660bfd8$var$HEADER_NAME, __scopeAccordion);
return /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).createElement($47SRi$radixuireactprimitive.Primitive.h3, ($parcel$interopDefault($47SRi$babelruntimehelpersextends))({
"data-orientation": accordionContext.orientation,
"data-state": $0f4a20de0660bfd8$var$getState(itemContext.open),
"data-disabled": itemContext.disabled ? '' : undefined
}, headerProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/ Object.assign($0f4a20de0660bfd8$export$5e3e5deaaf81ee41, {
displayName: $0f4a20de0660bfd8$var$HEADER_NAME
});
/* -------------------------------------------------------------------------------------------------
* AccordionTrigger
* -----------------------------------------------------------------------------------------------*/ const $0f4a20de0660bfd8$var$TRIGGER_NAME = 'AccordionTrigger';
/**
* `AccordionTrigger` is the trigger that toggles the collapsed state of an `AccordionItem`. It
* should always be nested inside of an `AccordionHeader`.
*/ const $0f4a20de0660bfd8$export$94e939b1f85bdd73 = /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).forwardRef((props, forwardedRef)=>{
const { __scopeAccordion: __scopeAccordion , ...triggerProps } = props;
const accordionContext = $0f4a20de0660bfd8$var$useAccordionContext($0f4a20de0660bfd8$var$ACCORDION_NAME, __scopeAccordion);
const itemContext = $0f4a20de0660bfd8$var$useAccordionItemContext($0f4a20de0660bfd8$var$TRIGGER_NAME, __scopeAccordion);
const collapsibleContext = $0f4a20de0660bfd8$var$useAccordionCollapsibleContext($0f4a20de0660bfd8$var$TRIGGER_NAME, __scopeAccordion);
const collapsibleScope = $0f4a20de0660bfd8$var$useCollapsibleScope(__scopeAccordion);
return /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).createElement($0f4a20de0660bfd8$var$Collection.ItemSlot, {
scope: __scopeAccordion
}, /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).createElement($47SRi$radixuireactcollapsible.Trigger, ($parcel$interopDefault($47SRi$babelruntimehelpersextends))({
"aria-disabled": itemContext.open && !collapsibleContext.collapsible || undefined,
"data-orientation": accordionContext.orientation,
id: itemContext.triggerId
}, collapsibleScope, triggerProps, {
ref: forwardedRef
})));
});
/*#__PURE__*/ Object.assign($0f4a20de0660bfd8$export$94e939b1f85bdd73, {
displayName: $0f4a20de0660bfd8$var$TRIGGER_NAME
});
/* -------------------------------------------------------------------------------------------------
* AccordionContent
* -----------------------------------------------------------------------------------------------*/ const $0f4a20de0660bfd8$var$CONTENT_NAME = 'AccordionContent';
/**
* `AccordionContent` contains the collapsible content for an `AccordionItem`.
*/ const $0f4a20de0660bfd8$export$985b9a77379b54a0 = /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).forwardRef((props, forwardedRef)=>{
const { __scopeAccordion: __scopeAccordion , ...contentProps } = props;
const accordionContext = $0f4a20de0660bfd8$var$useAccordionContext($0f4a20de0660bfd8$var$ACCORDION_NAME, __scopeAccordion);
const itemContext = $0f4a20de0660bfd8$var$useAccordionItemContext($0f4a20de0660bfd8$var$CONTENT_NAME, __scopeAccordion);
const collapsibleScope = $0f4a20de0660bfd8$var$useCollapsibleScope(__scopeAccordion);
return /*#__PURE__*/ ($parcel$interopDefault($47SRi$react)).createElement($47SRi$radixuireactcollapsible.Content, ($parcel$interopDefault($47SRi$babelruntimehelpersextends))({
role: "region",
"aria-labelledby": itemContext.triggerId,
"data-orientation": accordionContext.orientation
}, collapsibleScope, contentProps, {
ref: forwardedRef,
style: {
['--radix-accordion-content-height']: 'var(--radix-collapsible-content-height)',
['--radix-accordion-content-width']: 'var(--radix-collapsible-content-width)',
...props.style
}
}));
});
/*#__PURE__*/ Object.assign($0f4a20de0660bfd8$export$985b9a77379b54a0, {
displayName: $0f4a20de0660bfd8$var$CONTENT_NAME
});
/* -----------------------------------------------------------------------------------------------*/ function $0f4a20de0660bfd8$var$getState(open) {
return open ? 'open' : 'closed';
}
const $0f4a20de0660bfd8$export$be92b6f5f03c0fe9 = $0f4a20de0660bfd8$export$a766cd26d0d69044;
const $0f4a20de0660bfd8$export$6d08773d2e66f8f2 = $0f4a20de0660bfd8$export$d99097c13d4dac9f;
const $0f4a20de0660bfd8$export$8b251419efc915eb = $0f4a20de0660bfd8$export$5e3e5deaaf81ee41;
const $0f4a20de0660bfd8$export$41fb9f06171c75f4 = $0f4a20de0660bfd8$export$94e939b1f85bdd73;
const $0f4a20de0660bfd8$export$7c6e2c02157bb7d2 = $0f4a20de0660bfd8$export$985b9a77379b54a0;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,325 @@
import $3DjNB$babelruntimehelpersesmextends from "@babel/runtime/helpers/esm/extends";
import $3DjNB$react from "react";
import {createContextScope as $3DjNB$createContextScope} from "@radix-ui/react-context";
import {createCollection as $3DjNB$createCollection} from "@radix-ui/react-collection";
import {useComposedRefs as $3DjNB$useComposedRefs} from "@radix-ui/react-compose-refs";
import {composeEventHandlers as $3DjNB$composeEventHandlers} from "@radix-ui/primitive";
import {useControllableState as $3DjNB$useControllableState} from "@radix-ui/react-use-controllable-state";
import {Primitive as $3DjNB$Primitive} from "@radix-ui/react-primitive";
import {createCollapsibleScope as $3DjNB$createCollapsibleScope, Root as $3DjNB$Root, Trigger as $3DjNB$Trigger, Content as $3DjNB$Content} from "@radix-ui/react-collapsible";
import {useId as $3DjNB$useId} from "@radix-ui/react-id";
import {useDirection as $3DjNB$useDirection} from "@radix-ui/react-direction";
/* -------------------------------------------------------------------------------------------------
* Accordion
* -----------------------------------------------------------------------------------------------*/ const $1bf158f521e1b1b4$var$ACCORDION_NAME = 'Accordion';
const $1bf158f521e1b1b4$var$ACCORDION_KEYS = [
'Home',
'End',
'ArrowDown',
'ArrowUp',
'ArrowLeft',
'ArrowRight'
];
const [$1bf158f521e1b1b4$var$Collection, $1bf158f521e1b1b4$var$useCollection, $1bf158f521e1b1b4$var$createCollectionScope] = $3DjNB$createCollection($1bf158f521e1b1b4$var$ACCORDION_NAME);
const [$1bf158f521e1b1b4$var$createAccordionContext, $1bf158f521e1b1b4$export$9748edc328a73be1] = $3DjNB$createContextScope($1bf158f521e1b1b4$var$ACCORDION_NAME, [
$1bf158f521e1b1b4$var$createCollectionScope,
$3DjNB$createCollapsibleScope
]);
const $1bf158f521e1b1b4$var$useCollapsibleScope = $3DjNB$createCollapsibleScope();
const $1bf158f521e1b1b4$export$a766cd26d0d69044 = /*#__PURE__*/ $3DjNB$react.forwardRef((props, forwardedRef)=>{
const { type: type , ...accordionProps } = props;
const singleProps = accordionProps;
const multipleProps = accordionProps;
return /*#__PURE__*/ $3DjNB$react.createElement($1bf158f521e1b1b4$var$Collection.Provider, {
scope: props.__scopeAccordion
}, type === 'multiple' ? /*#__PURE__*/ $3DjNB$react.createElement($1bf158f521e1b1b4$var$AccordionImplMultiple, $3DjNB$babelruntimehelpersesmextends({}, multipleProps, {
ref: forwardedRef
})) : /*#__PURE__*/ $3DjNB$react.createElement($1bf158f521e1b1b4$var$AccordionImplSingle, $3DjNB$babelruntimehelpersesmextends({}, singleProps, {
ref: forwardedRef
})));
});
/*#__PURE__*/ Object.assign($1bf158f521e1b1b4$export$a766cd26d0d69044, {
displayName: $1bf158f521e1b1b4$var$ACCORDION_NAME
});
$1bf158f521e1b1b4$export$a766cd26d0d69044.propTypes = {
type (props) {
const value = props.value || props.defaultValue;
if (props.type && ![
'single',
'multiple'
].includes(props.type)) return new Error('Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`.');
if (props.type === 'multiple' && typeof value === 'string') return new Error('Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`.');
if (props.type === 'single' && Array.isArray(value)) return new Error('Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`.');
return null;
}
};
/* -----------------------------------------------------------------------------------------------*/ const [$1bf158f521e1b1b4$var$AccordionValueProvider, $1bf158f521e1b1b4$var$useAccordionValueContext] = $1bf158f521e1b1b4$var$createAccordionContext($1bf158f521e1b1b4$var$ACCORDION_NAME);
const [$1bf158f521e1b1b4$var$AccordionCollapsibleProvider, $1bf158f521e1b1b4$var$useAccordionCollapsibleContext] = $1bf158f521e1b1b4$var$createAccordionContext($1bf158f521e1b1b4$var$ACCORDION_NAME, {
collapsible: false
});
const $1bf158f521e1b1b4$var$AccordionImplSingle = /*#__PURE__*/ $3DjNB$react.forwardRef((props, forwardedRef)=>{
const { value: valueProp , defaultValue: defaultValue , onValueChange: onValueChange = ()=>{} , collapsible: collapsible = false , ...accordionSingleProps } = props;
const [value, setValue] = $3DjNB$useControllableState({
prop: valueProp,
defaultProp: defaultValue,
onChange: onValueChange
});
return /*#__PURE__*/ $3DjNB$react.createElement($1bf158f521e1b1b4$var$AccordionValueProvider, {
scope: props.__scopeAccordion,
value: value ? [
value
] : [],
onItemOpen: setValue,
onItemClose: $3DjNB$react.useCallback(()=>collapsible && setValue('')
, [
collapsible,
setValue
])
}, /*#__PURE__*/ $3DjNB$react.createElement($1bf158f521e1b1b4$var$AccordionCollapsibleProvider, {
scope: props.__scopeAccordion,
collapsible: collapsible
}, /*#__PURE__*/ $3DjNB$react.createElement($1bf158f521e1b1b4$var$AccordionImpl, $3DjNB$babelruntimehelpersesmextends({}, accordionSingleProps, {
ref: forwardedRef
}))));
});
/* -----------------------------------------------------------------------------------------------*/ const $1bf158f521e1b1b4$var$AccordionImplMultiple = /*#__PURE__*/ $3DjNB$react.forwardRef((props, forwardedRef)=>{
const { value: valueProp , defaultValue: defaultValue , onValueChange: onValueChange = ()=>{} , ...accordionMultipleProps } = props;
const [value1 = [], setValue] = $3DjNB$useControllableState({
prop: valueProp,
defaultProp: defaultValue,
onChange: onValueChange
});
const handleItemOpen = $3DjNB$react.useCallback((itemValue)=>setValue((prevValue = [])=>[
...prevValue,
itemValue
]
)
, [
setValue
]);
const handleItemClose = $3DjNB$react.useCallback((itemValue)=>setValue((prevValue = [])=>prevValue.filter((value)=>value !== itemValue
)
)
, [
setValue
]);
return /*#__PURE__*/ $3DjNB$react.createElement($1bf158f521e1b1b4$var$AccordionValueProvider, {
scope: props.__scopeAccordion,
value: value1,
onItemOpen: handleItemOpen,
onItemClose: handleItemClose
}, /*#__PURE__*/ $3DjNB$react.createElement($1bf158f521e1b1b4$var$AccordionCollapsibleProvider, {
scope: props.__scopeAccordion,
collapsible: true
}, /*#__PURE__*/ $3DjNB$react.createElement($1bf158f521e1b1b4$var$AccordionImpl, $3DjNB$babelruntimehelpersesmextends({}, accordionMultipleProps, {
ref: forwardedRef
}))));
});
/* -----------------------------------------------------------------------------------------------*/ const [$1bf158f521e1b1b4$var$AccordionImplProvider, $1bf158f521e1b1b4$var$useAccordionContext] = $1bf158f521e1b1b4$var$createAccordionContext($1bf158f521e1b1b4$var$ACCORDION_NAME);
const $1bf158f521e1b1b4$var$AccordionImpl = /*#__PURE__*/ $3DjNB$react.forwardRef((props, forwardedRef)=>{
const { __scopeAccordion: __scopeAccordion , disabled: disabled , dir: dir , orientation: orientation = 'vertical' , ...accordionProps } = props;
const accordionRef = $3DjNB$react.useRef(null);
const composedRefs = $3DjNB$useComposedRefs(accordionRef, forwardedRef);
const getItems = $1bf158f521e1b1b4$var$useCollection(__scopeAccordion);
const direction = $3DjNB$useDirection(dir);
const isDirectionLTR = direction === 'ltr';
const handleKeyDown = $3DjNB$composeEventHandlers(props.onKeyDown, (event)=>{
var _triggerCollection$cl;
if (!$1bf158f521e1b1b4$var$ACCORDION_KEYS.includes(event.key)) return;
const target = event.target;
const triggerCollection = getItems().filter((item)=>{
var _item$ref$current;
return !((_item$ref$current = item.ref.current) !== null && _item$ref$current !== void 0 && _item$ref$current.disabled);
});
const triggerIndex = triggerCollection.findIndex((item)=>item.ref.current === target
);
const triggerCount = triggerCollection.length;
if (triggerIndex === -1) return; // Prevents page scroll while user is navigating
event.preventDefault();
let nextIndex = triggerIndex;
const homeIndex = 0;
const endIndex = triggerCount - 1;
const moveNext = ()=>{
nextIndex = triggerIndex + 1;
if (nextIndex > endIndex) nextIndex = homeIndex;
};
const movePrev = ()=>{
nextIndex = triggerIndex - 1;
if (nextIndex < homeIndex) nextIndex = endIndex;
};
switch(event.key){
case 'Home':
nextIndex = homeIndex;
break;
case 'End':
nextIndex = endIndex;
break;
case 'ArrowRight':
if (orientation === 'horizontal') {
if (isDirectionLTR) moveNext();
else movePrev();
}
break;
case 'ArrowDown':
if (orientation === 'vertical') moveNext();
break;
case 'ArrowLeft':
if (orientation === 'horizontal') {
if (isDirectionLTR) movePrev();
else moveNext();
}
break;
case 'ArrowUp':
if (orientation === 'vertical') movePrev();
break;
}
const clampedIndex = nextIndex % triggerCount;
(_triggerCollection$cl = triggerCollection[clampedIndex].ref.current) === null || _triggerCollection$cl === void 0 || _triggerCollection$cl.focus();
});
return /*#__PURE__*/ $3DjNB$react.createElement($1bf158f521e1b1b4$var$AccordionImplProvider, {
scope: __scopeAccordion,
disabled: disabled,
direction: dir,
orientation: orientation
}, /*#__PURE__*/ $3DjNB$react.createElement($1bf158f521e1b1b4$var$Collection.Slot, {
scope: __scopeAccordion
}, /*#__PURE__*/ $3DjNB$react.createElement($3DjNB$Primitive.div, $3DjNB$babelruntimehelpersesmextends({}, accordionProps, {
"data-orientation": orientation,
ref: composedRefs,
onKeyDown: disabled ? undefined : handleKeyDown
}))));
});
/* -------------------------------------------------------------------------------------------------
* AccordionItem
* -----------------------------------------------------------------------------------------------*/ const $1bf158f521e1b1b4$var$ITEM_NAME = 'AccordionItem';
const [$1bf158f521e1b1b4$var$AccordionItemProvider, $1bf158f521e1b1b4$var$useAccordionItemContext] = $1bf158f521e1b1b4$var$createAccordionContext($1bf158f521e1b1b4$var$ITEM_NAME);
/**
* `AccordionItem` contains all of the parts of a collapsible section inside of an `Accordion`.
*/ const $1bf158f521e1b1b4$export$d99097c13d4dac9f = /*#__PURE__*/ $3DjNB$react.forwardRef((props, forwardedRef)=>{
const { __scopeAccordion: __scopeAccordion , value: value , ...accordionItemProps } = props;
const accordionContext = $1bf158f521e1b1b4$var$useAccordionContext($1bf158f521e1b1b4$var$ITEM_NAME, __scopeAccordion);
const valueContext = $1bf158f521e1b1b4$var$useAccordionValueContext($1bf158f521e1b1b4$var$ITEM_NAME, __scopeAccordion);
const collapsibleScope = $1bf158f521e1b1b4$var$useCollapsibleScope(__scopeAccordion);
const triggerId = $3DjNB$useId();
const open1 = value && valueContext.value.includes(value) || false;
const disabled = accordionContext.disabled || props.disabled;
return /*#__PURE__*/ $3DjNB$react.createElement($1bf158f521e1b1b4$var$AccordionItemProvider, {
scope: __scopeAccordion,
open: open1,
disabled: disabled,
triggerId: triggerId
}, /*#__PURE__*/ $3DjNB$react.createElement($3DjNB$Root, $3DjNB$babelruntimehelpersesmextends({
"data-orientation": accordionContext.orientation,
"data-state": $1bf158f521e1b1b4$var$getState(open1)
}, collapsibleScope, accordionItemProps, {
ref: forwardedRef,
disabled: disabled,
open: open1,
onOpenChange: (open)=>{
if (open) valueContext.onItemOpen(value);
else valueContext.onItemClose(value);
}
})));
});
/*#__PURE__*/ Object.assign($1bf158f521e1b1b4$export$d99097c13d4dac9f, {
displayName: $1bf158f521e1b1b4$var$ITEM_NAME
});
/* -------------------------------------------------------------------------------------------------
* AccordionHeader
* -----------------------------------------------------------------------------------------------*/ const $1bf158f521e1b1b4$var$HEADER_NAME = 'AccordionHeader';
/**
* `AccordionHeader` contains the content for the parts of an `AccordionItem` that will be visible
* whether or not its content is collapsed.
*/ const $1bf158f521e1b1b4$export$5e3e5deaaf81ee41 = /*#__PURE__*/ $3DjNB$react.forwardRef((props, forwardedRef)=>{
const { __scopeAccordion: __scopeAccordion , ...headerProps } = props;
const accordionContext = $1bf158f521e1b1b4$var$useAccordionContext($1bf158f521e1b1b4$var$ACCORDION_NAME, __scopeAccordion);
const itemContext = $1bf158f521e1b1b4$var$useAccordionItemContext($1bf158f521e1b1b4$var$HEADER_NAME, __scopeAccordion);
return /*#__PURE__*/ $3DjNB$react.createElement($3DjNB$Primitive.h3, $3DjNB$babelruntimehelpersesmextends({
"data-orientation": accordionContext.orientation,
"data-state": $1bf158f521e1b1b4$var$getState(itemContext.open),
"data-disabled": itemContext.disabled ? '' : undefined
}, headerProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/ Object.assign($1bf158f521e1b1b4$export$5e3e5deaaf81ee41, {
displayName: $1bf158f521e1b1b4$var$HEADER_NAME
});
/* -------------------------------------------------------------------------------------------------
* AccordionTrigger
* -----------------------------------------------------------------------------------------------*/ const $1bf158f521e1b1b4$var$TRIGGER_NAME = 'AccordionTrigger';
/**
* `AccordionTrigger` is the trigger that toggles the collapsed state of an `AccordionItem`. It
* should always be nested inside of an `AccordionHeader`.
*/ const $1bf158f521e1b1b4$export$94e939b1f85bdd73 = /*#__PURE__*/ $3DjNB$react.forwardRef((props, forwardedRef)=>{
const { __scopeAccordion: __scopeAccordion , ...triggerProps } = props;
const accordionContext = $1bf158f521e1b1b4$var$useAccordionContext($1bf158f521e1b1b4$var$ACCORDION_NAME, __scopeAccordion);
const itemContext = $1bf158f521e1b1b4$var$useAccordionItemContext($1bf158f521e1b1b4$var$TRIGGER_NAME, __scopeAccordion);
const collapsibleContext = $1bf158f521e1b1b4$var$useAccordionCollapsibleContext($1bf158f521e1b1b4$var$TRIGGER_NAME, __scopeAccordion);
const collapsibleScope = $1bf158f521e1b1b4$var$useCollapsibleScope(__scopeAccordion);
return /*#__PURE__*/ $3DjNB$react.createElement($1bf158f521e1b1b4$var$Collection.ItemSlot, {
scope: __scopeAccordion
}, /*#__PURE__*/ $3DjNB$react.createElement($3DjNB$Trigger, $3DjNB$babelruntimehelpersesmextends({
"aria-disabled": itemContext.open && !collapsibleContext.collapsible || undefined,
"data-orientation": accordionContext.orientation,
id: itemContext.triggerId
}, collapsibleScope, triggerProps, {
ref: forwardedRef
})));
});
/*#__PURE__*/ Object.assign($1bf158f521e1b1b4$export$94e939b1f85bdd73, {
displayName: $1bf158f521e1b1b4$var$TRIGGER_NAME
});
/* -------------------------------------------------------------------------------------------------
* AccordionContent
* -----------------------------------------------------------------------------------------------*/ const $1bf158f521e1b1b4$var$CONTENT_NAME = 'AccordionContent';
/**
* `AccordionContent` contains the collapsible content for an `AccordionItem`.
*/ const $1bf158f521e1b1b4$export$985b9a77379b54a0 = /*#__PURE__*/ $3DjNB$react.forwardRef((props, forwardedRef)=>{
const { __scopeAccordion: __scopeAccordion , ...contentProps } = props;
const accordionContext = $1bf158f521e1b1b4$var$useAccordionContext($1bf158f521e1b1b4$var$ACCORDION_NAME, __scopeAccordion);
const itemContext = $1bf158f521e1b1b4$var$useAccordionItemContext($1bf158f521e1b1b4$var$CONTENT_NAME, __scopeAccordion);
const collapsibleScope = $1bf158f521e1b1b4$var$useCollapsibleScope(__scopeAccordion);
return /*#__PURE__*/ $3DjNB$react.createElement($3DjNB$Content, $3DjNB$babelruntimehelpersesmextends({
role: "region",
"aria-labelledby": itemContext.triggerId,
"data-orientation": accordionContext.orientation
}, collapsibleScope, contentProps, {
ref: forwardedRef,
style: {
['--radix-accordion-content-height']: 'var(--radix-collapsible-content-height)',
['--radix-accordion-content-width']: 'var(--radix-collapsible-content-width)',
...props.style
}
}));
});
/*#__PURE__*/ Object.assign($1bf158f521e1b1b4$export$985b9a77379b54a0, {
displayName: $1bf158f521e1b1b4$var$CONTENT_NAME
});
/* -----------------------------------------------------------------------------------------------*/ function $1bf158f521e1b1b4$var$getState(open) {
return open ? 'open' : 'closed';
}
const $1bf158f521e1b1b4$export$be92b6f5f03c0fe9 = $1bf158f521e1b1b4$export$a766cd26d0d69044;
const $1bf158f521e1b1b4$export$6d08773d2e66f8f2 = $1bf158f521e1b1b4$export$d99097c13d4dac9f;
const $1bf158f521e1b1b4$export$8b251419efc915eb = $1bf158f521e1b1b4$export$5e3e5deaaf81ee41;
const $1bf158f521e1b1b4$export$41fb9f06171c75f4 = $1bf158f521e1b1b4$export$94e939b1f85bdd73;
const $1bf158f521e1b1b4$export$7c6e2c02157bb7d2 = $1bf158f521e1b1b4$export$985b9a77379b54a0;
export {$1bf158f521e1b1b4$export$9748edc328a73be1 as createAccordionScope, $1bf158f521e1b1b4$export$a766cd26d0d69044 as Accordion, $1bf158f521e1b1b4$export$d99097c13d4dac9f as AccordionItem, $1bf158f521e1b1b4$export$5e3e5deaaf81ee41 as AccordionHeader, $1bf158f521e1b1b4$export$94e939b1f85bdd73 as AccordionTrigger, $1bf158f521e1b1b4$export$985b9a77379b54a0 as AccordionContent, $1bf158f521e1b1b4$export$be92b6f5f03c0fe9 as Root, $1bf158f521e1b1b4$export$6d08773d2e66f8f2 as Item, $1bf158f521e1b1b4$export$8b251419efc915eb as Header, $1bf158f521e1b1b4$export$41fb9f06171c75f4 as Trigger, $1bf158f521e1b1b4$export$7c6e2c02157bb7d2 as Content};
//# sourceMappingURL=index.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,64 @@
{
"name": "@radix-ui/react-accordion",
"version": "1.1.2",
"license": "MIT",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"source": "./src/index.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"README.md"
],
"sideEffects": false,
"scripts": {
"clean": "rm -rf dist",
"version": "yarn version"
},
"dependencies": {
"@babel/runtime": "^7.13.10",
"@radix-ui/primitive": "1.0.1",
"@radix-ui/react-collapsible": "1.0.3",
"@radix-ui/react-collection": "1.0.3",
"@radix-ui/react-compose-refs": "1.0.1",
"@radix-ui/react-context": "1.0.1",
"@radix-ui/react-direction": "1.0.1",
"@radix-ui/react-id": "1.0.1",
"@radix-ui/react-primitive": "1.0.3",
"@radix-ui/react-use-controllable-state": "1.0.1"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0",
"react-dom": "^16.8 || ^17.0 || ^18.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
},
"homepage": "https://radix-ui.com/primitives",
"repository": {
"type": "git",
"url": "git+https://github.com/radix-ui/primitives.git"
},
"bugs": {
"url": "https://github.com/radix-ui/primitives/issues"
}
}

View File

@@ -0,0 +1,13 @@
# `react-alert-dialog`
## Installation
```sh
$ yarn add @radix-ui/react-alert-dialog
# or
$ npm install @radix-ui/react-alert-dialog
```
## Usage
View docs [here](https://radix-ui.com/primitives/docs/components/alert-dialog).

View File

@@ -0,0 +1,50 @@
import * as React from "react";
import * as DialogPrimitive from "@radix-ui/react-dialog";
import * as Radix from "@radix-ui/react-primitive";
export const createAlertDialogScope: import("@radix-ui/react-context").CreateScope;
type DialogProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
export interface AlertDialogProps extends Omit<DialogProps, 'modal'> {
}
export const AlertDialog: React.FC<AlertDialogProps>;
type DialogTriggerProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;
export interface AlertDialogTriggerProps extends DialogTriggerProps {
}
export const AlertDialogTrigger: React.ForwardRefExoticComponent<AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
type DialogPortalProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;
export interface AlertDialogPortalProps extends DialogPortalProps {
}
export const AlertDialogPortal: React.FC<AlertDialogPortalProps>;
type DialogOverlayProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;
export interface AlertDialogOverlayProps extends DialogOverlayProps {
}
export const AlertDialogOverlay: React.ForwardRefExoticComponent<AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
type DialogContentProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;
export interface AlertDialogContentProps extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {
}
export const AlertDialogContent: React.ForwardRefExoticComponent<AlertDialogContentProps & React.RefAttributes<HTMLDivElement>>;
type DialogTitleProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;
export interface AlertDialogTitleProps extends DialogTitleProps {
}
export const AlertDialogTitle: React.ForwardRefExoticComponent<AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
type DialogDescriptionProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;
export interface AlertDialogDescriptionProps extends DialogDescriptionProps {
}
export const AlertDialogDescription: React.ForwardRefExoticComponent<AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
type DialogCloseProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;
export interface AlertDialogActionProps extends DialogCloseProps {
}
export const AlertDialogAction: React.ForwardRefExoticComponent<AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>>;
export interface AlertDialogCancelProps extends DialogCloseProps {
}
export const AlertDialogCancel: React.ForwardRefExoticComponent<AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>>;
export const Root: React.FC<AlertDialogProps>;
export const Trigger: React.ForwardRefExoticComponent<AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
export const Portal: React.FC<AlertDialogPortalProps>;
export const Overlay: React.ForwardRefExoticComponent<AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
export const Content: React.ForwardRefExoticComponent<AlertDialogContentProps & React.RefAttributes<HTMLDivElement>>;
export const Action: React.ForwardRefExoticComponent<AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>>;
export const Cancel: React.ForwardRefExoticComponent<AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>>;
export const Title: React.ForwardRefExoticComponent<AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
export const Description: React.ForwardRefExoticComponent<AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,50 @@
import * as React from "react";
import * as DialogPrimitive from "@radix-ui/react-dialog";
import * as Radix from "@radix-ui/react-primitive";
export const createAlertDialogScope: import("@radix-ui/react-context").CreateScope;
type DialogProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
export interface AlertDialogProps extends Omit<DialogProps, 'modal'> {
}
export const AlertDialog: React.FC<AlertDialogProps>;
type DialogTriggerProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;
export interface AlertDialogTriggerProps extends DialogTriggerProps {
}
export const AlertDialogTrigger: React.ForwardRefExoticComponent<AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
type DialogPortalProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;
export interface AlertDialogPortalProps extends DialogPortalProps {
}
export const AlertDialogPortal: React.FC<AlertDialogPortalProps>;
type DialogOverlayProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;
export interface AlertDialogOverlayProps extends DialogOverlayProps {
}
export const AlertDialogOverlay: React.ForwardRefExoticComponent<AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
type DialogContentProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;
export interface AlertDialogContentProps extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {
}
export const AlertDialogContent: React.ForwardRefExoticComponent<AlertDialogContentProps & React.RefAttributes<HTMLDivElement>>;
type DialogTitleProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;
export interface AlertDialogTitleProps extends DialogTitleProps {
}
export const AlertDialogTitle: React.ForwardRefExoticComponent<AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
type DialogDescriptionProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;
export interface AlertDialogDescriptionProps extends DialogDescriptionProps {
}
export const AlertDialogDescription: React.ForwardRefExoticComponent<AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
type DialogCloseProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;
export interface AlertDialogActionProps extends DialogCloseProps {
}
export const AlertDialogAction: React.ForwardRefExoticComponent<AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>>;
export interface AlertDialogCancelProps extends DialogCloseProps {
}
export const AlertDialogCancel: React.ForwardRefExoticComponent<AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>>;
export const Root: React.FC<AlertDialogProps>;
export const Trigger: React.ForwardRefExoticComponent<AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
export const Portal: React.FC<AlertDialogPortalProps>;
export const Overlay: React.ForwardRefExoticComponent<AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
export const Content: React.ForwardRefExoticComponent<AlertDialogContentProps & React.RefAttributes<HTMLDivElement>>;
export const Action: React.ForwardRefExoticComponent<AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>>;
export const Cancel: React.ForwardRefExoticComponent<AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>>;
export const Title: React.ForwardRefExoticComponent<AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
export const Description: React.ForwardRefExoticComponent<AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"mappings":";;;AAkBA,OAAA,6FAEE,CAAC;AAGH,mBAAmB,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,IAAI,CAAC,CAAC;AAC/E,iCAA2B,SAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;CAAG;AAEhE,OAAA,MAAM,aAAa,MAAM,EAAE,CAAC,gBAAgB,CAI3C,CAAC;AAUF,0BAA0B,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,OAAO,CAAC,CAAC;AACzF,wCAAkC,SAAQ,kBAAkB;CAAG;AAE/D,OAAA,MAAM,qHAML,CAAC;AAUF,yBAAyB,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,MAAM,CAAC,CAAC;AACvF,uCAAiC,SAAQ,iBAAiB;CAAG;AAE7D,OAAA,MAAM,mBAAmB,MAAM,EAAE,CAAC,sBAAsB,CAMvD,CAAC;AAWF,0BAA0B,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,OAAO,CAAC,CAAC;AACzF,wCAAkC,SAAQ,kBAAkB;CAAG;AAE/D,OAAA,MAAM,kHAML,CAAC;AAkBF,0BAA0B,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,OAAO,CAAC,CAAC;AACzF,wCACE,SAAQ,IAAI,CAAC,kBAAkB,EAAE,sBAAsB,GAAG,mBAAmB,CAAC;CAAG;AAEnF,OAAA,MAAM,kHA0CL,CAAC;AAWF,wBAAwB,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,KAAK,CAAC,CAAC;AACrF,sCAAgC,SAAQ,gBAAgB;CAAG;AAE3D,OAAA,MAAM,kHAML,CAAC;AAWF,8BAA8B,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,WAAW,CAAC,CAAC;AACjG,4CAAsC,SAAQ,sBAAsB;CAAG;AAEvE,OAAA,MAAM,gIAOJ,CAAC;AAWH,wBAAwB,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,KAAK,CAAC,CAAC;AACrF,uCAAiC,SAAQ,gBAAgB;CAAG;AAE5D,OAAA,MAAM,mHAML,CAAC;AAWF,uCAAiC,SAAQ,gBAAgB;CAAG;AAE5D,OAAA,MAAM,mHAQL,CAAC;AA6BF,OAAA,MAAM,gCAAkB,CAAC;AACzB,OAAA,MAAM,0GAA4B,CAAC;AACnC,OAAA,MAAM,wCAA0B,CAAC;AACjC,OAAA,MAAM,uGAA4B,CAAC;AACnC,OAAA,MAAM,uGAA4B,CAAC;AACnC,OAAA,MAAM,wGAA0B,CAAC;AACjC,OAAA,MAAM,wGAA0B,CAAC;AACjC,OAAA,MAAM,uGAAwB,CAAC;AAC/B,OAAA,MAAM,qHAAoC,CAAC","sources":["packages/react/alert-dialog/src/packages/react/alert-dialog/src/AlertDialog.tsx","packages/react/alert-dialog/src/packages/react/alert-dialog/src/index.ts","packages/react/alert-dialog/src/index.ts"],"sourcesContent":[null,null,"export {\n createAlertDialogScope,\n //\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogContent,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogTitle,\n AlertDialogDescription,\n //\n Root,\n Trigger,\n Portal,\n Overlay,\n Content,\n Action,\n Cancel,\n Title,\n Description,\n} from './AlertDialog';\nexport type {\n AlertDialogProps,\n AlertDialogTriggerProps,\n AlertDialogPortalProps,\n AlertDialogOverlayProps,\n AlertDialogContentProps,\n AlertDialogActionProps,\n AlertDialogCancelProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n} from './AlertDialog';\n"],"names":[],"version":3,"file":"index.d.ts.map"}

View File

@@ -0,0 +1,218 @@
var $hLIh8$babelruntimehelpersextends = require("@babel/runtime/helpers/extends");
var $hLIh8$react = require("react");
var $hLIh8$radixuireactcontext = require("@radix-ui/react-context");
var $hLIh8$radixuireactcomposerefs = require("@radix-ui/react-compose-refs");
var $hLIh8$radixuireactdialog = require("@radix-ui/react-dialog");
var $hLIh8$radixuiprimitive = require("@radix-ui/primitive");
var $hLIh8$radixuireactslot = require("@radix-ui/react-slot");
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, "createAlertDialogScope", () => $8c7baeec26a63e97$export$b8891880751c2c5b);
$parcel$export(module.exports, "AlertDialog", () => $8c7baeec26a63e97$export$de466dd8317b0b75);
$parcel$export(module.exports, "AlertDialogTrigger", () => $8c7baeec26a63e97$export$6edd7a623ef0f40b);
$parcel$export(module.exports, "AlertDialogPortal", () => $8c7baeec26a63e97$export$660f2bfdb986706c);
$parcel$export(module.exports, "AlertDialogOverlay", () => $8c7baeec26a63e97$export$a707a4895ce23256);
$parcel$export(module.exports, "AlertDialogContent", () => $8c7baeec26a63e97$export$94e6af45f0af4efd);
$parcel$export(module.exports, "AlertDialogAction", () => $8c7baeec26a63e97$export$b454f818c58ee85d);
$parcel$export(module.exports, "AlertDialogCancel", () => $8c7baeec26a63e97$export$2f67a923571aaea0);
$parcel$export(module.exports, "AlertDialogTitle", () => $8c7baeec26a63e97$export$225e0da62d314b7);
$parcel$export(module.exports, "AlertDialogDescription", () => $8c7baeec26a63e97$export$a23b55cde55ad9a5);
$parcel$export(module.exports, "Root", () => $8c7baeec26a63e97$export$be92b6f5f03c0fe9);
$parcel$export(module.exports, "Trigger", () => $8c7baeec26a63e97$export$41fb9f06171c75f4);
$parcel$export(module.exports, "Portal", () => $8c7baeec26a63e97$export$602eac185826482c);
$parcel$export(module.exports, "Overlay", () => $8c7baeec26a63e97$export$c6fdb837b070b4ff);
$parcel$export(module.exports, "Content", () => $8c7baeec26a63e97$export$7c6e2c02157bb7d2);
$parcel$export(module.exports, "Action", () => $8c7baeec26a63e97$export$e19cd5f9376f8cee);
$parcel$export(module.exports, "Cancel", () => $8c7baeec26a63e97$export$848c9b7ead0df967);
$parcel$export(module.exports, "Title", () => $8c7baeec26a63e97$export$f99233281efd08a0);
$parcel$export(module.exports, "Description", () => $8c7baeec26a63e97$export$393edc798c47379d);
/* -------------------------------------------------------------------------------------------------
* AlertDialog
* -----------------------------------------------------------------------------------------------*/ const $8c7baeec26a63e97$var$ROOT_NAME = 'AlertDialog';
const [$8c7baeec26a63e97$var$createAlertDialogContext, $8c7baeec26a63e97$export$b8891880751c2c5b] = $hLIh8$radixuireactcontext.createContextScope($8c7baeec26a63e97$var$ROOT_NAME, [
$hLIh8$radixuireactdialog.createDialogScope
]);
const $8c7baeec26a63e97$var$useDialogScope = $hLIh8$radixuireactdialog.createDialogScope();
const $8c7baeec26a63e97$export$de466dd8317b0b75 = (props)=>{
const { __scopeAlertDialog: __scopeAlertDialog , ...alertDialogProps } = props;
const dialogScope = $8c7baeec26a63e97$var$useDialogScope(__scopeAlertDialog);
return /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactdialog.Root, ($parcel$interopDefault($hLIh8$babelruntimehelpersextends))({}, dialogScope, alertDialogProps, {
modal: true
}));
};
/*#__PURE__*/ Object.assign($8c7baeec26a63e97$export$de466dd8317b0b75, {
displayName: $8c7baeec26a63e97$var$ROOT_NAME
});
/* -------------------------------------------------------------------------------------------------
* AlertDialogTrigger
* -----------------------------------------------------------------------------------------------*/ const $8c7baeec26a63e97$var$TRIGGER_NAME = 'AlertDialogTrigger';
const $8c7baeec26a63e97$export$6edd7a623ef0f40b = /*#__PURE__*/ $hLIh8$react.forwardRef((props, forwardedRef)=>{
const { __scopeAlertDialog: __scopeAlertDialog , ...triggerProps } = props;
const dialogScope = $8c7baeec26a63e97$var$useDialogScope(__scopeAlertDialog);
return /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactdialog.Trigger, ($parcel$interopDefault($hLIh8$babelruntimehelpersextends))({}, dialogScope, triggerProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/ Object.assign($8c7baeec26a63e97$export$6edd7a623ef0f40b, {
displayName: $8c7baeec26a63e97$var$TRIGGER_NAME
});
/* -------------------------------------------------------------------------------------------------
* AlertDialogPortal
* -----------------------------------------------------------------------------------------------*/ const $8c7baeec26a63e97$var$PORTAL_NAME = 'AlertDialogPortal';
const $8c7baeec26a63e97$export$660f2bfdb986706c = (props)=>{
const { __scopeAlertDialog: __scopeAlertDialog , ...portalProps } = props;
const dialogScope = $8c7baeec26a63e97$var$useDialogScope(__scopeAlertDialog);
return /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactdialog.Portal, ($parcel$interopDefault($hLIh8$babelruntimehelpersextends))({}, dialogScope, portalProps));
};
/*#__PURE__*/ Object.assign($8c7baeec26a63e97$export$660f2bfdb986706c, {
displayName: $8c7baeec26a63e97$var$PORTAL_NAME
});
/* -------------------------------------------------------------------------------------------------
* AlertDialogOverlay
* -----------------------------------------------------------------------------------------------*/ const $8c7baeec26a63e97$var$OVERLAY_NAME = 'AlertDialogOverlay';
const $8c7baeec26a63e97$export$a707a4895ce23256 = /*#__PURE__*/ $hLIh8$react.forwardRef((props, forwardedRef)=>{
const { __scopeAlertDialog: __scopeAlertDialog , ...overlayProps } = props;
const dialogScope = $8c7baeec26a63e97$var$useDialogScope(__scopeAlertDialog);
return /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactdialog.Overlay, ($parcel$interopDefault($hLIh8$babelruntimehelpersextends))({}, dialogScope, overlayProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/ Object.assign($8c7baeec26a63e97$export$a707a4895ce23256, {
displayName: $8c7baeec26a63e97$var$OVERLAY_NAME
});
/* -------------------------------------------------------------------------------------------------
* AlertDialogContent
* -----------------------------------------------------------------------------------------------*/ const $8c7baeec26a63e97$var$CONTENT_NAME = 'AlertDialogContent';
const [$8c7baeec26a63e97$var$AlertDialogContentProvider, $8c7baeec26a63e97$var$useAlertDialogContentContext] = $8c7baeec26a63e97$var$createAlertDialogContext($8c7baeec26a63e97$var$CONTENT_NAME);
const $8c7baeec26a63e97$export$94e6af45f0af4efd = /*#__PURE__*/ $hLIh8$react.forwardRef((props, forwardedRef)=>{
const { __scopeAlertDialog: __scopeAlertDialog , children: children , ...contentProps } = props;
const dialogScope = $8c7baeec26a63e97$var$useDialogScope(__scopeAlertDialog);
const contentRef = $hLIh8$react.useRef(null);
const composedRefs = $hLIh8$radixuireactcomposerefs.useComposedRefs(forwardedRef, contentRef);
const cancelRef = $hLIh8$react.useRef(null);
return /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactdialog.WarningProvider, {
contentName: $8c7baeec26a63e97$var$CONTENT_NAME,
titleName: $8c7baeec26a63e97$var$TITLE_NAME,
docsSlug: "alert-dialog"
}, /*#__PURE__*/ $hLIh8$react.createElement($8c7baeec26a63e97$var$AlertDialogContentProvider, {
scope: __scopeAlertDialog,
cancelRef: cancelRef
}, /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactdialog.Content, ($parcel$interopDefault($hLIh8$babelruntimehelpersextends))({
role: "alertdialog"
}, dialogScope, contentProps, {
ref: composedRefs,
onOpenAutoFocus: $hLIh8$radixuiprimitive.composeEventHandlers(contentProps.onOpenAutoFocus, (event)=>{
var _cancelRef$current;
event.preventDefault();
(_cancelRef$current = cancelRef.current) === null || _cancelRef$current === void 0 || _cancelRef$current.focus({
preventScroll: true
});
}),
onPointerDownOutside: (event)=>event.preventDefault()
,
onInteractOutside: (event)=>event.preventDefault()
}), /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactslot.Slottable, null, children), false)));
});
/*#__PURE__*/ Object.assign($8c7baeec26a63e97$export$94e6af45f0af4efd, {
displayName: $8c7baeec26a63e97$var$CONTENT_NAME
});
/* -------------------------------------------------------------------------------------------------
* AlertDialogTitle
* -----------------------------------------------------------------------------------------------*/ const $8c7baeec26a63e97$var$TITLE_NAME = 'AlertDialogTitle';
const $8c7baeec26a63e97$export$225e0da62d314b7 = /*#__PURE__*/ $hLIh8$react.forwardRef((props, forwardedRef)=>{
const { __scopeAlertDialog: __scopeAlertDialog , ...titleProps } = props;
const dialogScope = $8c7baeec26a63e97$var$useDialogScope(__scopeAlertDialog);
return /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactdialog.Title, ($parcel$interopDefault($hLIh8$babelruntimehelpersextends))({}, dialogScope, titleProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/ Object.assign($8c7baeec26a63e97$export$225e0da62d314b7, {
displayName: $8c7baeec26a63e97$var$TITLE_NAME
});
/* -------------------------------------------------------------------------------------------------
* AlertDialogDescription
* -----------------------------------------------------------------------------------------------*/ const $8c7baeec26a63e97$var$DESCRIPTION_NAME = 'AlertDialogDescription';
const $8c7baeec26a63e97$export$a23b55cde55ad9a5 = /*#__PURE__*/ $hLIh8$react.forwardRef((props, forwardedRef)=>{
const { __scopeAlertDialog: __scopeAlertDialog , ...descriptionProps } = props;
const dialogScope = $8c7baeec26a63e97$var$useDialogScope(__scopeAlertDialog);
return /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactdialog.Description, ($parcel$interopDefault($hLIh8$babelruntimehelpersextends))({}, dialogScope, descriptionProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/ Object.assign($8c7baeec26a63e97$export$a23b55cde55ad9a5, {
displayName: $8c7baeec26a63e97$var$DESCRIPTION_NAME
});
/* -------------------------------------------------------------------------------------------------
* AlertDialogAction
* -----------------------------------------------------------------------------------------------*/ const $8c7baeec26a63e97$var$ACTION_NAME = 'AlertDialogAction';
const $8c7baeec26a63e97$export$b454f818c58ee85d = /*#__PURE__*/ $hLIh8$react.forwardRef((props, forwardedRef)=>{
const { __scopeAlertDialog: __scopeAlertDialog , ...actionProps } = props;
const dialogScope = $8c7baeec26a63e97$var$useDialogScope(__scopeAlertDialog);
return /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactdialog.Close, ($parcel$interopDefault($hLIh8$babelruntimehelpersextends))({}, dialogScope, actionProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/ Object.assign($8c7baeec26a63e97$export$b454f818c58ee85d, {
displayName: $8c7baeec26a63e97$var$ACTION_NAME
});
/* -------------------------------------------------------------------------------------------------
* AlertDialogCancel
* -----------------------------------------------------------------------------------------------*/ const $8c7baeec26a63e97$var$CANCEL_NAME = 'AlertDialogCancel';
const $8c7baeec26a63e97$export$2f67a923571aaea0 = /*#__PURE__*/ $hLIh8$react.forwardRef((props, forwardedRef)=>{
const { __scopeAlertDialog: __scopeAlertDialog , ...cancelProps } = props;
const { cancelRef: cancelRef } = $8c7baeec26a63e97$var$useAlertDialogContentContext($8c7baeec26a63e97$var$CANCEL_NAME, __scopeAlertDialog);
const dialogScope = $8c7baeec26a63e97$var$useDialogScope(__scopeAlertDialog);
const ref = $hLIh8$radixuireactcomposerefs.useComposedRefs(forwardedRef, cancelRef);
return /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactdialog.Close, ($parcel$interopDefault($hLIh8$babelruntimehelpersextends))({}, dialogScope, cancelProps, {
ref: ref
}));
});
/*#__PURE__*/ Object.assign($8c7baeec26a63e97$export$2f67a923571aaea0, {
displayName: $8c7baeec26a63e97$var$CANCEL_NAME
});
/* ---------------------------------------------------------------------------------------------- */ const $8c7baeec26a63e97$var$DescriptionWarning = ({ contentRef: contentRef })=>{
const MESSAGE = `\`${$8c7baeec26a63e97$var$CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
You can add a description to the \`${$8c7baeec26a63e97$var$CONTENT_NAME}\` by passing a \`${$8c7baeec26a63e97$var$DESCRIPTION_NAME}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${$8c7baeec26a63e97$var$CONTENT_NAME}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;
$hLIh8$react.useEffect(()=>{
var _contentRef$current;
const hasDescription = document.getElementById((_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.getAttribute('aria-describedby'));
if (!hasDescription) console.warn(MESSAGE);
}, [
MESSAGE,
contentRef
]);
return null;
};
const $8c7baeec26a63e97$export$be92b6f5f03c0fe9 = $8c7baeec26a63e97$export$de466dd8317b0b75;
const $8c7baeec26a63e97$export$41fb9f06171c75f4 = $8c7baeec26a63e97$export$6edd7a623ef0f40b;
const $8c7baeec26a63e97$export$602eac185826482c = $8c7baeec26a63e97$export$660f2bfdb986706c;
const $8c7baeec26a63e97$export$c6fdb837b070b4ff = $8c7baeec26a63e97$export$a707a4895ce23256;
const $8c7baeec26a63e97$export$7c6e2c02157bb7d2 = $8c7baeec26a63e97$export$94e6af45f0af4efd;
const $8c7baeec26a63e97$export$e19cd5f9376f8cee = $8c7baeec26a63e97$export$b454f818c58ee85d;
const $8c7baeec26a63e97$export$848c9b7ead0df967 = $8c7baeec26a63e97$export$2f67a923571aaea0;
const $8c7baeec26a63e97$export$f99233281efd08a0 = $8c7baeec26a63e97$export$225e0da62d314b7;
const $8c7baeec26a63e97$export$393edc798c47379d = $8c7baeec26a63e97$export$a23b55cde55ad9a5;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,193 @@
import $4k4D0$babelruntimehelpersesmextends from "@babel/runtime/helpers/esm/extends";
import {createElement as $4k4D0$createElement, forwardRef as $4k4D0$forwardRef, useRef as $4k4D0$useRef, useEffect as $4k4D0$useEffect} from "react";
import {createContextScope as $4k4D0$createContextScope} from "@radix-ui/react-context";
import {useComposedRefs as $4k4D0$useComposedRefs} from "@radix-ui/react-compose-refs";
import {createDialogScope as $4k4D0$createDialogScope, Root as $4k4D0$Root, Trigger as $4k4D0$Trigger, Portal as $4k4D0$Portal, Overlay as $4k4D0$Overlay, WarningProvider as $4k4D0$WarningProvider, Content as $4k4D0$Content, Title as $4k4D0$Title, Description as $4k4D0$Description, Close as $4k4D0$Close} from "@radix-ui/react-dialog";
import {composeEventHandlers as $4k4D0$composeEventHandlers} from "@radix-ui/primitive";
import {Slottable as $4k4D0$Slottable} from "@radix-ui/react-slot";
/* -------------------------------------------------------------------------------------------------
* AlertDialog
* -----------------------------------------------------------------------------------------------*/ const $905f4ae918aab1aa$var$ROOT_NAME = 'AlertDialog';
const [$905f4ae918aab1aa$var$createAlertDialogContext, $905f4ae918aab1aa$export$b8891880751c2c5b] = $4k4D0$createContextScope($905f4ae918aab1aa$var$ROOT_NAME, [
$4k4D0$createDialogScope
]);
const $905f4ae918aab1aa$var$useDialogScope = $4k4D0$createDialogScope();
const $905f4ae918aab1aa$export$de466dd8317b0b75 = (props)=>{
const { __scopeAlertDialog: __scopeAlertDialog , ...alertDialogProps } = props;
const dialogScope = $905f4ae918aab1aa$var$useDialogScope(__scopeAlertDialog);
return /*#__PURE__*/ $4k4D0$createElement($4k4D0$Root, $4k4D0$babelruntimehelpersesmextends({}, dialogScope, alertDialogProps, {
modal: true
}));
};
/*#__PURE__*/ Object.assign($905f4ae918aab1aa$export$de466dd8317b0b75, {
displayName: $905f4ae918aab1aa$var$ROOT_NAME
});
/* -------------------------------------------------------------------------------------------------
* AlertDialogTrigger
* -----------------------------------------------------------------------------------------------*/ const $905f4ae918aab1aa$var$TRIGGER_NAME = 'AlertDialogTrigger';
const $905f4ae918aab1aa$export$6edd7a623ef0f40b = /*#__PURE__*/ $4k4D0$forwardRef((props, forwardedRef)=>{
const { __scopeAlertDialog: __scopeAlertDialog , ...triggerProps } = props;
const dialogScope = $905f4ae918aab1aa$var$useDialogScope(__scopeAlertDialog);
return /*#__PURE__*/ $4k4D0$createElement($4k4D0$Trigger, $4k4D0$babelruntimehelpersesmextends({}, dialogScope, triggerProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/ Object.assign($905f4ae918aab1aa$export$6edd7a623ef0f40b, {
displayName: $905f4ae918aab1aa$var$TRIGGER_NAME
});
/* -------------------------------------------------------------------------------------------------
* AlertDialogPortal
* -----------------------------------------------------------------------------------------------*/ const $905f4ae918aab1aa$var$PORTAL_NAME = 'AlertDialogPortal';
const $905f4ae918aab1aa$export$660f2bfdb986706c = (props)=>{
const { __scopeAlertDialog: __scopeAlertDialog , ...portalProps } = props;
const dialogScope = $905f4ae918aab1aa$var$useDialogScope(__scopeAlertDialog);
return /*#__PURE__*/ $4k4D0$createElement($4k4D0$Portal, $4k4D0$babelruntimehelpersesmextends({}, dialogScope, portalProps));
};
/*#__PURE__*/ Object.assign($905f4ae918aab1aa$export$660f2bfdb986706c, {
displayName: $905f4ae918aab1aa$var$PORTAL_NAME
});
/* -------------------------------------------------------------------------------------------------
* AlertDialogOverlay
* -----------------------------------------------------------------------------------------------*/ const $905f4ae918aab1aa$var$OVERLAY_NAME = 'AlertDialogOverlay';
const $905f4ae918aab1aa$export$a707a4895ce23256 = /*#__PURE__*/ $4k4D0$forwardRef((props, forwardedRef)=>{
const { __scopeAlertDialog: __scopeAlertDialog , ...overlayProps } = props;
const dialogScope = $905f4ae918aab1aa$var$useDialogScope(__scopeAlertDialog);
return /*#__PURE__*/ $4k4D0$createElement($4k4D0$Overlay, $4k4D0$babelruntimehelpersesmextends({}, dialogScope, overlayProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/ Object.assign($905f4ae918aab1aa$export$a707a4895ce23256, {
displayName: $905f4ae918aab1aa$var$OVERLAY_NAME
});
/* -------------------------------------------------------------------------------------------------
* AlertDialogContent
* -----------------------------------------------------------------------------------------------*/ const $905f4ae918aab1aa$var$CONTENT_NAME = 'AlertDialogContent';
const [$905f4ae918aab1aa$var$AlertDialogContentProvider, $905f4ae918aab1aa$var$useAlertDialogContentContext] = $905f4ae918aab1aa$var$createAlertDialogContext($905f4ae918aab1aa$var$CONTENT_NAME);
const $905f4ae918aab1aa$export$94e6af45f0af4efd = /*#__PURE__*/ $4k4D0$forwardRef((props, forwardedRef)=>{
const { __scopeAlertDialog: __scopeAlertDialog , children: children , ...contentProps } = props;
const dialogScope = $905f4ae918aab1aa$var$useDialogScope(__scopeAlertDialog);
const contentRef = $4k4D0$useRef(null);
const composedRefs = $4k4D0$useComposedRefs(forwardedRef, contentRef);
const cancelRef = $4k4D0$useRef(null);
return /*#__PURE__*/ $4k4D0$createElement($4k4D0$WarningProvider, {
contentName: $905f4ae918aab1aa$var$CONTENT_NAME,
titleName: $905f4ae918aab1aa$var$TITLE_NAME,
docsSlug: "alert-dialog"
}, /*#__PURE__*/ $4k4D0$createElement($905f4ae918aab1aa$var$AlertDialogContentProvider, {
scope: __scopeAlertDialog,
cancelRef: cancelRef
}, /*#__PURE__*/ $4k4D0$createElement($4k4D0$Content, $4k4D0$babelruntimehelpersesmextends({
role: "alertdialog"
}, dialogScope, contentProps, {
ref: composedRefs,
onOpenAutoFocus: $4k4D0$composeEventHandlers(contentProps.onOpenAutoFocus, (event)=>{
var _cancelRef$current;
event.preventDefault();
(_cancelRef$current = cancelRef.current) === null || _cancelRef$current === void 0 || _cancelRef$current.focus({
preventScroll: true
});
}),
onPointerDownOutside: (event)=>event.preventDefault()
,
onInteractOutside: (event)=>event.preventDefault()
}), /*#__PURE__*/ $4k4D0$createElement($4k4D0$Slottable, null, children), false)));
});
/*#__PURE__*/ Object.assign($905f4ae918aab1aa$export$94e6af45f0af4efd, {
displayName: $905f4ae918aab1aa$var$CONTENT_NAME
});
/* -------------------------------------------------------------------------------------------------
* AlertDialogTitle
* -----------------------------------------------------------------------------------------------*/ const $905f4ae918aab1aa$var$TITLE_NAME = 'AlertDialogTitle';
const $905f4ae918aab1aa$export$225e0da62d314b7 = /*#__PURE__*/ $4k4D0$forwardRef((props, forwardedRef)=>{
const { __scopeAlertDialog: __scopeAlertDialog , ...titleProps } = props;
const dialogScope = $905f4ae918aab1aa$var$useDialogScope(__scopeAlertDialog);
return /*#__PURE__*/ $4k4D0$createElement($4k4D0$Title, $4k4D0$babelruntimehelpersesmextends({}, dialogScope, titleProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/ Object.assign($905f4ae918aab1aa$export$225e0da62d314b7, {
displayName: $905f4ae918aab1aa$var$TITLE_NAME
});
/* -------------------------------------------------------------------------------------------------
* AlertDialogDescription
* -----------------------------------------------------------------------------------------------*/ const $905f4ae918aab1aa$var$DESCRIPTION_NAME = 'AlertDialogDescription';
const $905f4ae918aab1aa$export$a23b55cde55ad9a5 = /*#__PURE__*/ $4k4D0$forwardRef((props, forwardedRef)=>{
const { __scopeAlertDialog: __scopeAlertDialog , ...descriptionProps } = props;
const dialogScope = $905f4ae918aab1aa$var$useDialogScope(__scopeAlertDialog);
return /*#__PURE__*/ $4k4D0$createElement($4k4D0$Description, $4k4D0$babelruntimehelpersesmextends({}, dialogScope, descriptionProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/ Object.assign($905f4ae918aab1aa$export$a23b55cde55ad9a5, {
displayName: $905f4ae918aab1aa$var$DESCRIPTION_NAME
});
/* -------------------------------------------------------------------------------------------------
* AlertDialogAction
* -----------------------------------------------------------------------------------------------*/ const $905f4ae918aab1aa$var$ACTION_NAME = 'AlertDialogAction';
const $905f4ae918aab1aa$export$b454f818c58ee85d = /*#__PURE__*/ $4k4D0$forwardRef((props, forwardedRef)=>{
const { __scopeAlertDialog: __scopeAlertDialog , ...actionProps } = props;
const dialogScope = $905f4ae918aab1aa$var$useDialogScope(__scopeAlertDialog);
return /*#__PURE__*/ $4k4D0$createElement($4k4D0$Close, $4k4D0$babelruntimehelpersesmextends({}, dialogScope, actionProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/ Object.assign($905f4ae918aab1aa$export$b454f818c58ee85d, {
displayName: $905f4ae918aab1aa$var$ACTION_NAME
});
/* -------------------------------------------------------------------------------------------------
* AlertDialogCancel
* -----------------------------------------------------------------------------------------------*/ const $905f4ae918aab1aa$var$CANCEL_NAME = 'AlertDialogCancel';
const $905f4ae918aab1aa$export$2f67a923571aaea0 = /*#__PURE__*/ $4k4D0$forwardRef((props, forwardedRef)=>{
const { __scopeAlertDialog: __scopeAlertDialog , ...cancelProps } = props;
const { cancelRef: cancelRef } = $905f4ae918aab1aa$var$useAlertDialogContentContext($905f4ae918aab1aa$var$CANCEL_NAME, __scopeAlertDialog);
const dialogScope = $905f4ae918aab1aa$var$useDialogScope(__scopeAlertDialog);
const ref = $4k4D0$useComposedRefs(forwardedRef, cancelRef);
return /*#__PURE__*/ $4k4D0$createElement($4k4D0$Close, $4k4D0$babelruntimehelpersesmextends({}, dialogScope, cancelProps, {
ref: ref
}));
});
/*#__PURE__*/ Object.assign($905f4ae918aab1aa$export$2f67a923571aaea0, {
displayName: $905f4ae918aab1aa$var$CANCEL_NAME
});
/* ---------------------------------------------------------------------------------------------- */ const $905f4ae918aab1aa$var$DescriptionWarning = ({ contentRef: contentRef })=>{
const MESSAGE = `\`${$905f4ae918aab1aa$var$CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
You can add a description to the \`${$905f4ae918aab1aa$var$CONTENT_NAME}\` by passing a \`${$905f4ae918aab1aa$var$DESCRIPTION_NAME}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${$905f4ae918aab1aa$var$CONTENT_NAME}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;
$4k4D0$useEffect(()=>{
var _contentRef$current;
const hasDescription = document.getElementById((_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.getAttribute('aria-describedby'));
if (!hasDescription) console.warn(MESSAGE);
}, [
MESSAGE,
contentRef
]);
return null;
};
const $905f4ae918aab1aa$export$be92b6f5f03c0fe9 = $905f4ae918aab1aa$export$de466dd8317b0b75;
const $905f4ae918aab1aa$export$41fb9f06171c75f4 = $905f4ae918aab1aa$export$6edd7a623ef0f40b;
const $905f4ae918aab1aa$export$602eac185826482c = $905f4ae918aab1aa$export$660f2bfdb986706c;
const $905f4ae918aab1aa$export$c6fdb837b070b4ff = $905f4ae918aab1aa$export$a707a4895ce23256;
const $905f4ae918aab1aa$export$7c6e2c02157bb7d2 = $905f4ae918aab1aa$export$94e6af45f0af4efd;
const $905f4ae918aab1aa$export$e19cd5f9376f8cee = $905f4ae918aab1aa$export$b454f818c58ee85d;
const $905f4ae918aab1aa$export$848c9b7ead0df967 = $905f4ae918aab1aa$export$2f67a923571aaea0;
const $905f4ae918aab1aa$export$f99233281efd08a0 = $905f4ae918aab1aa$export$225e0da62d314b7;
const $905f4ae918aab1aa$export$393edc798c47379d = $905f4ae918aab1aa$export$a23b55cde55ad9a5;
export {$905f4ae918aab1aa$export$b8891880751c2c5b as createAlertDialogScope, $905f4ae918aab1aa$export$de466dd8317b0b75 as AlertDialog, $905f4ae918aab1aa$export$6edd7a623ef0f40b as AlertDialogTrigger, $905f4ae918aab1aa$export$660f2bfdb986706c as AlertDialogPortal, $905f4ae918aab1aa$export$a707a4895ce23256 as AlertDialogOverlay, $905f4ae918aab1aa$export$94e6af45f0af4efd as AlertDialogContent, $905f4ae918aab1aa$export$b454f818c58ee85d as AlertDialogAction, $905f4ae918aab1aa$export$2f67a923571aaea0 as AlertDialogCancel, $905f4ae918aab1aa$export$225e0da62d314b7 as AlertDialogTitle, $905f4ae918aab1aa$export$a23b55cde55ad9a5 as AlertDialogDescription, $905f4ae918aab1aa$export$be92b6f5f03c0fe9 as Root, $905f4ae918aab1aa$export$41fb9f06171c75f4 as Trigger, $905f4ae918aab1aa$export$602eac185826482c as Portal, $905f4ae918aab1aa$export$c6fdb837b070b4ff as Overlay, $905f4ae918aab1aa$export$7c6e2c02157bb7d2 as Content, $905f4ae918aab1aa$export$e19cd5f9376f8cee as Action, $905f4ae918aab1aa$export$848c9b7ead0df967 as Cancel, $905f4ae918aab1aa$export$f99233281efd08a0 as Title, $905f4ae918aab1aa$export$393edc798c47379d as Description};
//# sourceMappingURL=index.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,61 @@
{
"name": "@radix-ui/react-alert-dialog",
"version": "1.0.5",
"license": "MIT",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"source": "./src/index.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"src",
"dist"
],
"sideEffects": false,
"scripts": {
"clean": "rm -rf dist",
"version": "yarn version"
},
"dependencies": {
"@babel/runtime": "^7.13.10",
"@radix-ui/primitive": "1.0.1",
"@radix-ui/react-compose-refs": "1.0.1",
"@radix-ui/react-context": "1.0.1",
"@radix-ui/react-dialog": "1.0.5",
"@radix-ui/react-primitive": "1.0.3",
"@radix-ui/react-slot": "1.0.2"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0",
"react-dom": "^16.8 || ^17.0 || ^18.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
},
"homepage": "https://radix-ui.com/primitives",
"repository": {
"type": "git",
"url": "git+https://github.com/radix-ui/primitives.git"
},
"bugs": {
"url": "https://github.com/radix-ui/primitives/issues"
}
}

View File

@@ -0,0 +1,353 @@
import * as React from 'react';
import { css } from '../../../../stitches.config';
import * as AlertDialog from '@radix-ui/react-alert-dialog';
export default { title: 'Components/AlertDialog' };
export const Styled = () => (
<AlertDialog.Root>
<AlertDialog.Trigger className={triggerClass()}>delete everything</AlertDialog.Trigger>
<AlertDialog.Portal>
<AlertDialog.Overlay className={overlayClass()} />
<AlertDialog.Content className={contentClass()}>
<AlertDialog.Title className={titleClass()}>Are you sure?</AlertDialog.Title>
<AlertDialog.Description className={descriptionClass()}>
This will do a very dangerous thing. Thar be dragons!
</AlertDialog.Description>
<AlertDialog.Action className={actionClass()}>yolo, do it</AlertDialog.Action>
<AlertDialog.Cancel className={cancelClass()}>maybe not</AlertDialog.Cancel>
</AlertDialog.Content>
</AlertDialog.Portal>
</AlertDialog.Root>
);
export const Controlled = () => {
const [open, setOpen] = React.useState(false);
const [housePurchased, setHousePurchased] = React.useState(false);
return (
<div>
<div>
<img src="https://i.ibb.co/K54hsKt/house.jpg" alt="a large white house with a red roof" />
</div>
<AlertDialog.Root open={open} onOpenChange={setOpen}>
<AlertDialog.Trigger
onClick={(e) => {
if (housePurchased) {
e.preventDefault();
setHousePurchased(false);
}
}}
>
{housePurchased ? 'You bought the house! Sell it!' : 'Buy this house'}
</AlertDialog.Trigger>
<AlertDialog.Portal>
<AlertDialog.Overlay className={overlayClass()} />
<AlertDialog.Content className={contentClass()}>
<AlertDialog.Title>Are you sure?</AlertDialog.Title>
<AlertDialog.Description>
Houses are very expensive and it looks like you only have 20 in the bank. Maybe
consult with a financial advisor?
</AlertDialog.Description>
<AlertDialog.Action className={actionClass()} onClick={() => setHousePurchased(true)}>
buy it anyway
</AlertDialog.Action>
<AlertDialog.Cancel className={cancelClass()}>
good point, I'll reconsider
</AlertDialog.Cancel>
</AlertDialog.Content>
</AlertDialog.Portal>
</AlertDialog.Root>
</div>
);
};
export const Chromatic = () => (
<div
style={{
display: 'grid',
gridTemplateColumns: 'repeat(4, 1fr)',
gridTemplateRows: 'repeat(2, 1fr)',
height: '100vh',
}}
>
<div>
<h1>Uncontrolled</h1>
<h2>Closed</h2>
<AlertDialog.Root>
<AlertDialog.Trigger className={triggerClass()}>delete everything</AlertDialog.Trigger>
<AlertDialog.Portal>
<AlertDialog.Overlay className={overlayClass()} />
<AlertDialog.Content className={chromaticContentClass()}>
<AlertDialog.Title className={titleClass()}>Title</AlertDialog.Title>
<AlertDialog.Description className={descriptionClass()}>
Description
</AlertDialog.Description>
<AlertDialog.Action className={actionClass()}>Confirm</AlertDialog.Action>
<AlertDialog.Cancel className={cancelClass()}>Cancel</AlertDialog.Cancel>
</AlertDialog.Content>
</AlertDialog.Portal>
</AlertDialog.Root>
<h2>Open</h2>
<AlertDialog.Root defaultOpen>
<AlertDialog.Trigger className={triggerClass()}>delete everything</AlertDialog.Trigger>
<AlertDialog.Portal>
<AlertDialog.Overlay
className={overlayClass()}
style={{ left: 0, bottom: '50%', width: '25%' }}
/>
<AlertDialog.Content
className={chromaticContentClass()}
style={{ top: '25%', left: '12%' }}
>
<AlertDialog.Title className={titleClass()}>Title</AlertDialog.Title>
<AlertDialog.Description className={descriptionClass()}>
Description
</AlertDialog.Description>
<AlertDialog.Action className={actionClass()}>Confirm</AlertDialog.Action>
<AlertDialog.Cancel className={cancelClass()}>Cancel</AlertDialog.Cancel>
</AlertDialog.Content>
</AlertDialog.Portal>
</AlertDialog.Root>
</div>
<div>
<h1>Uncontrolled with reordered parts</h1>
<h2>Closed</h2>
<AlertDialog.Root>
<AlertDialog.Portal>
<AlertDialog.Overlay className={overlayClass()} />
<AlertDialog.Content className={chromaticContentClass()}>
<AlertDialog.Title className={titleClass()}>Title</AlertDialog.Title>
<AlertDialog.Description className={descriptionClass()}>
Description
</AlertDialog.Description>
<AlertDialog.Action className={actionClass()}>Confirm</AlertDialog.Action>
<AlertDialog.Cancel className={cancelClass()}>Cancel</AlertDialog.Cancel>
</AlertDialog.Content>
</AlertDialog.Portal>
<AlertDialog.Trigger className={triggerClass()}>delete everything</AlertDialog.Trigger>
</AlertDialog.Root>
<h2>Open</h2>
<AlertDialog.Root defaultOpen>
<AlertDialog.Portal>
<AlertDialog.Overlay
className={overlayClass()}
style={{ left: '25%', bottom: '50%', width: '25%' }}
/>
<AlertDialog.Content
className={chromaticContentClass()}
style={{ top: '25%', left: '37%' }}
>
<AlertDialog.Title className={titleClass()}>Title</AlertDialog.Title>
<AlertDialog.Description className={descriptionClass()}>
Description
</AlertDialog.Description>
<AlertDialog.Action className={actionClass()}>Confirm</AlertDialog.Action>
<AlertDialog.Cancel className={cancelClass()}>Cancel</AlertDialog.Cancel>
</AlertDialog.Content>
</AlertDialog.Portal>
<AlertDialog.Trigger className={triggerClass()}>delete everything</AlertDialog.Trigger>
</AlertDialog.Root>
</div>
<div>
<h1>Controlled</h1>
<h2>Closed</h2>
<AlertDialog.Root open={false}>
<AlertDialog.Trigger className={triggerClass()}>delete everything</AlertDialog.Trigger>
<AlertDialog.Portal>
<AlertDialog.Overlay className={overlayClass()} />
<AlertDialog.Content className={chromaticContentClass()}>
<AlertDialog.Title className={titleClass()}>Title</AlertDialog.Title>
<AlertDialog.Description className={descriptionClass()}>
Description
</AlertDialog.Description>
<AlertDialog.Action className={actionClass()}>Confirm</AlertDialog.Action>
<AlertDialog.Cancel className={cancelClass()}>Cancel</AlertDialog.Cancel>
</AlertDialog.Content>
</AlertDialog.Portal>
</AlertDialog.Root>
<h2>Open</h2>
<AlertDialog.Root open>
<AlertDialog.Trigger className={triggerClass()}>delete everything</AlertDialog.Trigger>
<AlertDialog.Portal>
<AlertDialog.Overlay
className={overlayClass()}
style={{ left: '50%', bottom: '50%', width: '25%' }}
/>
<AlertDialog.Content
className={chromaticContentClass()}
style={{ top: '25%', left: '62%' }}
>
<AlertDialog.Title className={titleClass()}>Title</AlertDialog.Title>
<AlertDialog.Description className={descriptionClass()}>
Description
</AlertDialog.Description>
<AlertDialog.Action className={actionClass()}>Confirm</AlertDialog.Action>
<AlertDialog.Cancel className={cancelClass()}>Cancel</AlertDialog.Cancel>
</AlertDialog.Content>
</AlertDialog.Portal>
</AlertDialog.Root>
</div>
<div>
<h1>Controlled with reordered parts</h1>
<h2>Closed</h2>
<AlertDialog.Root open={false}>
<AlertDialog.Portal>
<AlertDialog.Overlay className={overlayClass()} />
<AlertDialog.Content className={chromaticContentClass()}>
<AlertDialog.Title className={titleClass()}>Title</AlertDialog.Title>
<AlertDialog.Description className={descriptionClass()}>
Description
</AlertDialog.Description>
<AlertDialog.Action className={actionClass()}>Confirm</AlertDialog.Action>
<AlertDialog.Cancel className={cancelClass()}>Cancel</AlertDialog.Cancel>
</AlertDialog.Content>
</AlertDialog.Portal>
<AlertDialog.Trigger className={triggerClass()}>delete everything</AlertDialog.Trigger>
</AlertDialog.Root>
<h2>Open</h2>
<AlertDialog.Root open>
<AlertDialog.Portal>
<AlertDialog.Overlay
className={overlayClass()}
style={{ left: '75%', bottom: '50%', width: '25%' }}
/>
<AlertDialog.Content
className={chromaticContentClass()}
style={{ top: '25%', left: '88%' }}
>
<AlertDialog.Title className={titleClass()}>Title</AlertDialog.Title>
<AlertDialog.Description className={descriptionClass()}>
Description
</AlertDialog.Description>
<AlertDialog.Action className={actionClass()}>Confirm</AlertDialog.Action>
<AlertDialog.Cancel className={cancelClass()}>Cancel</AlertDialog.Cancel>
</AlertDialog.Content>
</AlertDialog.Portal>
<AlertDialog.Trigger className={triggerClass()}>delete everything</AlertDialog.Trigger>
</AlertDialog.Root>
</div>
<div>
<h1>State attributes</h1>
<h2>Closed</h2>
<AlertDialog.Root>
<AlertDialog.Trigger className={triggerAttrClass()}>delete everything</AlertDialog.Trigger>
<AlertDialog.Portal>
<AlertDialog.Overlay className={overlayAttrClass()} />
<AlertDialog.Content className={contentAttrClass()}>
<AlertDialog.Title className={titleAttrClass()}>Title</AlertDialog.Title>
<AlertDialog.Description className={descriptionAttrClass()}>
Description
</AlertDialog.Description>
<AlertDialog.Action className={actionAttrClass()}>Confirm</AlertDialog.Action>
<AlertDialog.Cancel className={cancelAttrClass()}>Cancel</AlertDialog.Cancel>
</AlertDialog.Content>
</AlertDialog.Portal>
</AlertDialog.Root>
<h2>Open</h2>
<AlertDialog.Root defaultOpen>
<AlertDialog.Trigger className={triggerAttrClass()}>delete everything</AlertDialog.Trigger>
<AlertDialog.Portal>
<AlertDialog.Overlay className={overlayAttrClass()} style={{ top: '50%' }} />
<AlertDialog.Content className={contentAttrClass()} style={{ top: '75%' }}>
<AlertDialog.Title className={titleAttrClass()}>Title</AlertDialog.Title>
<AlertDialog.Description className={descriptionAttrClass()}>
Description
</AlertDialog.Description>
<AlertDialog.Action className={actionAttrClass()}>Confirm</AlertDialog.Action>
<AlertDialog.Cancel className={cancelAttrClass()}>Cancel</AlertDialog.Cancel>
</AlertDialog.Content>
</AlertDialog.Portal>
</AlertDialog.Root>
</div>
</div>
);
Chromatic.parameters = { chromatic: { disable: false } };
const triggerClass = css({});
const RECOMMENDED_CSS__ALERT_DIALOG__OVERLAY: any = {
// ensures overlay is positionned correctly
position: 'fixed',
top: 0,
right: 0,
bottom: 0,
left: 0,
};
const overlayClass = css({
...RECOMMENDED_CSS__ALERT_DIALOG__OVERLAY,
backgroundColor: 'black',
opacity: 0.2,
});
const RECOMMENDED_CSS__ALERT_DIALOG__CONTENT: any = {
// ensures good default position for content
position: 'fixed',
top: 0,
left: 0,
};
const contentClass = css({
...RECOMMENDED_CSS__ALERT_DIALOG__CONTENT,
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
background: 'white',
minWidth: 300,
minHeight: 150,
padding: 50,
borderRadius: 10,
backgroundColor: 'white',
boxShadow: '0 2px 10px rgba(0, 0, 0, 0.12)',
});
const cancelClass = css({
appearance: 'none',
padding: 10,
border: 'none',
background: '$grey100',
});
const actionClass = css({
appearance: 'none',
padding: 10,
border: 'none',
backgroundColor: '$red',
color: '$white',
});
const titleClass = css({});
const descriptionClass = css({});
const chromaticContentClass = css(contentClass, {
padding: 10,
minWidth: 'auto',
minHeight: 'auto',
});
const styles = {
backgroundColor: 'rgba(0, 0, 255, 0.3)',
border: '2px solid blue',
padding: 10,
'&[data-state="closed"]': { borderColor: 'red' },
'&[data-state="open"]': { borderColor: 'green' },
};
const triggerAttrClass = css(styles);
const overlayAttrClass = css(overlayClass, styles);
const contentAttrClass = css(chromaticContentClass, styles);
const cancelAttrClass = css(styles);
const actionAttrClass = css(styles);
const titleAttrClass = css(styles);
const descriptionAttrClass = css(styles);

View File

@@ -0,0 +1,61 @@
import React from 'react';
import { axe } from 'jest-axe';
import { RenderResult } from '@testing-library/react';
import { render, fireEvent } from '@testing-library/react';
import * as AlertDialog from '@radix-ui/react-alert-dialog';
const OPEN_TEXT = 'Open';
const CANCEL_TEXT = 'Cancel';
const ACTION_TEXT = 'Do it';
const TITLE_TEXT = 'Warning';
const DESC_TEXT = 'This is a warning';
const OVERLAY_TEST_ID = 'test-overlay';
const DialogTest = (props: React.ComponentProps<typeof AlertDialog.Root>) => (
<AlertDialog.Root {...props}>
<AlertDialog.Trigger>{OPEN_TEXT}</AlertDialog.Trigger>
<AlertDialog.Overlay data-testid={OVERLAY_TEST_ID} />
<AlertDialog.Content>
<AlertDialog.Title>{TITLE_TEXT}</AlertDialog.Title>
<AlertDialog.Description>{DESC_TEXT}</AlertDialog.Description>
<AlertDialog.Cancel>{CANCEL_TEXT}</AlertDialog.Cancel>
<AlertDialog.Action>{ACTION_TEXT}</AlertDialog.Action>
</AlertDialog.Content>
</AlertDialog.Root>
);
describe('given a default Dialog', () => {
let rendered: RenderResult;
let title: HTMLElement;
let trigger: HTMLElement;
let cancelButton: HTMLElement;
beforeEach(() => {
rendered = render(<DialogTest />);
trigger = rendered.getByText(OPEN_TEXT);
});
it('should have no accessibility violations in default state', async () => {
expect(await axe(rendered.container)).toHaveNoViolations();
});
describe('after clicking the trigger', () => {
beforeEach(() => {
fireEvent.click(trigger);
title = rendered.getByText(TITLE_TEXT);
cancelButton = rendered.getByText(CANCEL_TEXT);
});
it('should open the content', () => {
expect(title).toBeVisible();
});
it('should have no accessibility violations when open', async () => {
expect(await axe(rendered.container)).toHaveNoViolations();
});
it('should focus the cancel button', () => {
expect(cancelButton).toHaveFocus();
});
});
});

View File

@@ -0,0 +1,307 @@
import * as React from 'react';
import { createContextScope } from '@radix-ui/react-context';
import { useComposedRefs } from '@radix-ui/react-compose-refs';
import * as DialogPrimitive from '@radix-ui/react-dialog';
import { createDialogScope } from '@radix-ui/react-dialog';
import { composeEventHandlers } from '@radix-ui/primitive';
import { Slottable } from '@radix-ui/react-slot';
import type * as Radix from '@radix-ui/react-primitive';
import type { Scope } from '@radix-ui/react-context';
/* -------------------------------------------------------------------------------------------------
* AlertDialog
* -----------------------------------------------------------------------------------------------*/
const ROOT_NAME = 'AlertDialog';
type ScopedProps<P> = P & { __scopeAlertDialog?: Scope };
const [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [
createDialogScope,
]);
const useDialogScope = createDialogScope();
type DialogProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
interface AlertDialogProps extends Omit<DialogProps, 'modal'> {}
const AlertDialog: React.FC<AlertDialogProps> = (props: ScopedProps<AlertDialogProps>) => {
const { __scopeAlertDialog, ...alertDialogProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return <DialogPrimitive.Root {...dialogScope} {...alertDialogProps} modal={true} />;
};
AlertDialog.displayName = ROOT_NAME;
/* -------------------------------------------------------------------------------------------------
* AlertDialogTrigger
* -----------------------------------------------------------------------------------------------*/
const TRIGGER_NAME = 'AlertDialogTrigger';
type AlertDialogTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;
type DialogTriggerProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;
interface AlertDialogTriggerProps extends DialogTriggerProps {}
const AlertDialogTrigger = React.forwardRef<AlertDialogTriggerElement, AlertDialogTriggerProps>(
(props: ScopedProps<AlertDialogTriggerProps>, forwardedRef) => {
const { __scopeAlertDialog, ...triggerProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return <DialogPrimitive.Trigger {...dialogScope} {...triggerProps} ref={forwardedRef} />;
}
);
AlertDialogTrigger.displayName = TRIGGER_NAME;
/* -------------------------------------------------------------------------------------------------
* AlertDialogPortal
* -----------------------------------------------------------------------------------------------*/
const PORTAL_NAME = 'AlertDialogPortal';
type DialogPortalProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;
interface AlertDialogPortalProps extends DialogPortalProps {}
const AlertDialogPortal: React.FC<AlertDialogPortalProps> = (
props: ScopedProps<AlertDialogPortalProps>
) => {
const { __scopeAlertDialog, ...portalProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return <DialogPrimitive.Portal {...dialogScope} {...portalProps} />;
};
AlertDialogPortal.displayName = PORTAL_NAME;
/* -------------------------------------------------------------------------------------------------
* AlertDialogOverlay
* -----------------------------------------------------------------------------------------------*/
const OVERLAY_NAME = 'AlertDialogOverlay';
type AlertDialogOverlayElement = React.ElementRef<typeof DialogPrimitive.Overlay>;
type DialogOverlayProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;
interface AlertDialogOverlayProps extends DialogOverlayProps {}
const AlertDialogOverlay = React.forwardRef<AlertDialogOverlayElement, AlertDialogOverlayProps>(
(props: ScopedProps<AlertDialogOverlayProps>, forwardedRef) => {
const { __scopeAlertDialog, ...overlayProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return <DialogPrimitive.Overlay {...dialogScope} {...overlayProps} ref={forwardedRef} />;
}
);
AlertDialogOverlay.displayName = OVERLAY_NAME;
/* -------------------------------------------------------------------------------------------------
* AlertDialogContent
* -----------------------------------------------------------------------------------------------*/
const CONTENT_NAME = 'AlertDialogContent';
type AlertDialogContentContextValue = {
cancelRef: React.MutableRefObject<AlertDialogCancelElement | null>;
};
const [AlertDialogContentProvider, useAlertDialogContentContext] =
createAlertDialogContext<AlertDialogContentContextValue>(CONTENT_NAME);
type AlertDialogContentElement = React.ElementRef<typeof DialogPrimitive.Content>;
type DialogContentProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;
interface AlertDialogContentProps
extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {}
const AlertDialogContent = React.forwardRef<AlertDialogContentElement, AlertDialogContentProps>(
(props: ScopedProps<AlertDialogContentProps>, forwardedRef) => {
const { __scopeAlertDialog, children, ...contentProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
const contentRef = React.useRef<AlertDialogContentElement>(null);
const composedRefs = useComposedRefs(forwardedRef, contentRef);
const cancelRef = React.useRef<AlertDialogCancelElement | null>(null);
return (
<DialogPrimitive.WarningProvider
contentName={CONTENT_NAME}
titleName={TITLE_NAME}
docsSlug="alert-dialog"
>
<AlertDialogContentProvider scope={__scopeAlertDialog} cancelRef={cancelRef}>
<DialogPrimitive.Content
role="alertdialog"
{...dialogScope}
{...contentProps}
ref={composedRefs}
onOpenAutoFocus={composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {
event.preventDefault();
cancelRef.current?.focus({ preventScroll: true });
})}
onPointerDownOutside={(event) => event.preventDefault()}
onInteractOutside={(event) => event.preventDefault()}
>
{/**
* We have to use `Slottable` here as we cannot wrap the `AlertDialogContentProvider`
* around everything, otherwise the `DescriptionWarning` would be rendered straight away.
* This is because we want the accessibility checks to run only once the content is actually
* open and that behaviour is already encapsulated in `DialogContent`.
*/}
<Slottable>{children}</Slottable>
{process.env.NODE_ENV === 'development' && (
<DescriptionWarning contentRef={contentRef} />
)}
</DialogPrimitive.Content>
</AlertDialogContentProvider>
</DialogPrimitive.WarningProvider>
);
}
);
AlertDialogContent.displayName = CONTENT_NAME;
/* -------------------------------------------------------------------------------------------------
* AlertDialogTitle
* -----------------------------------------------------------------------------------------------*/
const TITLE_NAME = 'AlertDialogTitle';
type AlertDialogTitleElement = React.ElementRef<typeof DialogPrimitive.Title>;
type DialogTitleProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;
interface AlertDialogTitleProps extends DialogTitleProps {}
const AlertDialogTitle = React.forwardRef<AlertDialogTitleElement, AlertDialogTitleProps>(
(props: ScopedProps<AlertDialogTitleProps>, forwardedRef) => {
const { __scopeAlertDialog, ...titleProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return <DialogPrimitive.Title {...dialogScope} {...titleProps} ref={forwardedRef} />;
}
);
AlertDialogTitle.displayName = TITLE_NAME;
/* -------------------------------------------------------------------------------------------------
* AlertDialogDescription
* -----------------------------------------------------------------------------------------------*/
const DESCRIPTION_NAME = 'AlertDialogDescription';
type AlertDialogDescriptionElement = React.ElementRef<typeof DialogPrimitive.Description>;
type DialogDescriptionProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;
interface AlertDialogDescriptionProps extends DialogDescriptionProps {}
const AlertDialogDescription = React.forwardRef<
AlertDialogDescriptionElement,
AlertDialogDescriptionProps
>((props: ScopedProps<AlertDialogDescriptionProps>, forwardedRef) => {
const { __scopeAlertDialog, ...descriptionProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return <DialogPrimitive.Description {...dialogScope} {...descriptionProps} ref={forwardedRef} />;
});
AlertDialogDescription.displayName = DESCRIPTION_NAME;
/* -------------------------------------------------------------------------------------------------
* AlertDialogAction
* -----------------------------------------------------------------------------------------------*/
const ACTION_NAME = 'AlertDialogAction';
type AlertDialogActionElement = React.ElementRef<typeof DialogPrimitive.Close>;
type DialogCloseProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;
interface AlertDialogActionProps extends DialogCloseProps {}
const AlertDialogAction = React.forwardRef<AlertDialogActionElement, AlertDialogActionProps>(
(props: ScopedProps<AlertDialogActionProps>, forwardedRef) => {
const { __scopeAlertDialog, ...actionProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return <DialogPrimitive.Close {...dialogScope} {...actionProps} ref={forwardedRef} />;
}
);
AlertDialogAction.displayName = ACTION_NAME;
/* -------------------------------------------------------------------------------------------------
* AlertDialogCancel
* -----------------------------------------------------------------------------------------------*/
const CANCEL_NAME = 'AlertDialogCancel';
type AlertDialogCancelElement = React.ElementRef<typeof DialogPrimitive.Close>;
interface AlertDialogCancelProps extends DialogCloseProps {}
const AlertDialogCancel = React.forwardRef<AlertDialogCancelElement, AlertDialogCancelProps>(
(props: ScopedProps<AlertDialogCancelProps>, forwardedRef) => {
const { __scopeAlertDialog, ...cancelProps } = props;
const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);
const dialogScope = useDialogScope(__scopeAlertDialog);
const ref = useComposedRefs(forwardedRef, cancelRef);
return <DialogPrimitive.Close {...dialogScope} {...cancelProps} ref={ref} />;
}
);
AlertDialogCancel.displayName = CANCEL_NAME;
/* ---------------------------------------------------------------------------------------------- */
type DescriptionWarningProps = {
contentRef: React.RefObject<AlertDialogContentElement>;
};
const DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef }) => {
const MESSAGE = `\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
You can add a description to the \`${CONTENT_NAME}\` by passing a \`${DESCRIPTION_NAME}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${CONTENT_NAME}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;
React.useEffect(() => {
const hasDescription = document.getElementById(
contentRef.current?.getAttribute('aria-describedby')!
);
if (!hasDescription) console.warn(MESSAGE);
}, [MESSAGE, contentRef]);
return null;
};
const Root = AlertDialog;
const Trigger = AlertDialogTrigger;
const Portal = AlertDialogPortal;
const Overlay = AlertDialogOverlay;
const Content = AlertDialogContent;
const Action = AlertDialogAction;
const Cancel = AlertDialogCancel;
const Title = AlertDialogTitle;
const Description = AlertDialogDescription;
export {
createAlertDialogScope,
//
AlertDialog,
AlertDialogTrigger,
AlertDialogPortal,
AlertDialogOverlay,
AlertDialogContent,
AlertDialogAction,
AlertDialogCancel,
AlertDialogTitle,
AlertDialogDescription,
//
Root,
Trigger,
Portal,
Overlay,
Content,
Action,
Cancel,
Title,
Description,
};
export type {
AlertDialogProps,
AlertDialogTriggerProps,
AlertDialogPortalProps,
AlertDialogOverlayProps,
AlertDialogContentProps,
AlertDialogActionProps,
AlertDialogCancelProps,
AlertDialogTitleProps,
AlertDialogDescriptionProps,
};

View File

@@ -0,0 +1,34 @@
export {
createAlertDialogScope,
//
AlertDialog,
AlertDialogTrigger,
AlertDialogPortal,
AlertDialogOverlay,
AlertDialogContent,
AlertDialogAction,
AlertDialogCancel,
AlertDialogTitle,
AlertDialogDescription,
//
Root,
Trigger,
Portal,
Overlay,
Content,
Action,
Cancel,
Title,
Description,
} from './AlertDialog';
export type {
AlertDialogProps,
AlertDialogTriggerProps,
AlertDialogPortalProps,
AlertDialogOverlayProps,
AlertDialogContentProps,
AlertDialogActionProps,
AlertDialogCancelProps,
AlertDialogTitleProps,
AlertDialogDescriptionProps,
} from './AlertDialog';

13
server/node_modules/@radix-ui/react-arrow/README.md generated vendored Normal file
View File

@@ -0,0 +1,13 @@
# `react-arrow`
## Installation
```sh
$ yarn add @radix-ui/react-arrow
# or
$ npm install @radix-ui/react-arrow
```
## Usage
This is an internal utility, not intended for public usage.

View File

@@ -0,0 +1,10 @@
import * as React from "react";
import * as Radix from "@radix-ui/react-primitive";
import { Primitive } from "@radix-ui/react-primitive";
type PrimitiveSvgProps = Radix.ComponentPropsWithoutRef<typeof Primitive.svg>;
export interface ArrowProps extends PrimitiveSvgProps {
}
export const Arrow: React.ForwardRefExoticComponent<ArrowProps & React.RefAttributes<SVGSVGElement>>;
export const Root: React.ForwardRefExoticComponent<ArrowProps & React.RefAttributes<SVGSVGElement>>;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,10 @@
import * as React from "react";
import * as Radix from "@radix-ui/react-primitive";
import { Primitive } from "@radix-ui/react-primitive";
type PrimitiveSvgProps = Radix.ComponentPropsWithoutRef<typeof Primitive.svg>;
export interface ArrowProps extends PrimitiveSvgProps {
}
export const Arrow: React.ForwardRefExoticComponent<ArrowProps & React.RefAttributes<SVGSVGElement>>;
export const Root: React.ForwardRefExoticComponent<ArrowProps & React.RefAttributes<SVGSVGElement>>;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"mappings":";;;AAYA,yBAAyB,MAAM,wBAAwB,CAAC,OAAO,UAAU,GAAG,CAAC,CAAC;AAC9E,2BAAqB,SAAQ,iBAAiB;CAAG;AAEjD,OAAA,MAAM,uFAeJ,CAAC;AAMH,OAAA,MAAM,sFAAY,CAAC","sources":["packages/react/arrow/src/packages/react/arrow/src/Arrow.tsx","packages/react/arrow/src/packages/react/arrow/src/index.ts","packages/react/arrow/src/index.ts"],"sourcesContent":[null,null,"export {\n Arrow,\n //\n Root,\n} from './Arrow';\nexport type { ArrowProps } from './Arrow';\n"],"names":[],"version":3,"file":"index.d.ts.map"}

View File

@@ -0,0 +1,40 @@
var $eQpDd$babelruntimehelpersextends = require("@babel/runtime/helpers/extends");
var $eQpDd$react = require("react");
var $eQpDd$radixuireactprimitive = require("@radix-ui/react-primitive");
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, "Arrow", () => $09f4ad68a9251bc3$export$21b07c8f274aebd5);
$parcel$export(module.exports, "Root", () => $09f4ad68a9251bc3$export$be92b6f5f03c0fe9);
/* -------------------------------------------------------------------------------------------------
* Arrow
* -----------------------------------------------------------------------------------------------*/ const $09f4ad68a9251bc3$var$NAME = 'Arrow';
const $09f4ad68a9251bc3$export$21b07c8f274aebd5 = /*#__PURE__*/ $eQpDd$react.forwardRef((props, forwardedRef)=>{
const { children: children , width: width = 10 , height: height = 5 , ...arrowProps } = props;
return /*#__PURE__*/ $eQpDd$react.createElement($eQpDd$radixuireactprimitive.Primitive.svg, ($parcel$interopDefault($eQpDd$babelruntimehelpersextends))({}, arrowProps, {
ref: forwardedRef,
width: width,
height: height,
viewBox: "0 0 30 10",
preserveAspectRatio: "none"
}), props.asChild ? children : /*#__PURE__*/ $eQpDd$react.createElement("polygon", {
points: "0,0 30,0 15,10"
}));
});
/*#__PURE__*/ Object.assign($09f4ad68a9251bc3$export$21b07c8f274aebd5, {
displayName: $09f4ad68a9251bc3$var$NAME
});
/* -----------------------------------------------------------------------------------------------*/ const $09f4ad68a9251bc3$export$be92b6f5f03c0fe9 = $09f4ad68a9251bc3$export$21b07c8f274aebd5;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;;;;A;;;ACKA;;oGAEA,CAEA,MAAMI,0BAAI,GAAG,OAAb,AAAA;AAMA,MAAMJ,yCAAK,GAAA,aAAGE,CAAAA,uBAAA,CAA2C,CAACI,KAAD,EAAQC,YAAR,GAAyB;IAChF,MAAM,E,UAAEC,QAAF,CAAA,SAAYC,KAAK,GAAG,EAApB,WAAwBC,MAAM,GAAG,CAAjC,GAAoC,GAAGC,UAAH,EAApC,GAAsDL,KAA5D,AAAM;IACN,OAAA,aACE,CAAA,0BAAA,CAAC,sCAAD,CAAW,GAAX,EAAA,2DAAA,CAAA,EAAA,EACMK,UADN,EADF;QAGI,GAAG,EAAEJ,YAFP;QAGE,KAAK,EAAEE,KAHT;QAIE,MAAM,EAAEC,MAJV;QAKE,OAAO,EAAC,WALV;QAME,mBAAmB,EAAC,MAApB;KANF,CAAA,EASGJ,KAAK,CAACM,OAAN,GAAgBJ,QAAhB,GAAA,aAA2B,CAAA,0BAT9B,CAAA,SAAA,EAAA;QASuC,MAAM,EAAC,gBAAP;KAAT,CAT9B,CADF,CAUgC;CAZpB,CAAd,AAeC;AAED,aAAA,CAAA,MAAA,CAAA,MAAA,CAAA,yCAAA,EAAA;IAAA,WAAA,EAAA,0BAAA;CAAA,CAAA,CAAA;AAEA,oGAAA,CAEA,MAAMP,yCAAI,GAAGD,yCAAb,AAAA;;ADpCA","sources":["packages/react/arrow/src/index.ts","packages/react/arrow/src/Arrow.tsx"],"sourcesContent":["export {\n Arrow,\n //\n Root,\n} from './Arrow';\nexport type { ArrowProps } from './Arrow';\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 * Arrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst NAME = 'Arrow';\n\ntype ArrowElement = React.ElementRef<typeof Primitive.svg>;\ntype PrimitiveSvgProps = Radix.ComponentPropsWithoutRef<typeof Primitive.svg>;\ninterface ArrowProps extends PrimitiveSvgProps {}\n\nconst Arrow = React.forwardRef<ArrowElement, ArrowProps>((props, forwardedRef) => {\n const { children, width = 10, height = 5, ...arrowProps } = props;\n return (\n <Primitive.svg\n {...arrowProps}\n ref={forwardedRef}\n width={width}\n height={height}\n viewBox=\"0 0 30 10\"\n preserveAspectRatio=\"none\"\n >\n {/* We use their children if they're slotting to replace the whole svg */}\n {props.asChild ? children : <polygon points=\"0,0 30,0 15,10\" />}\n </Primitive.svg>\n );\n});\n\nArrow.displayName = NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = Arrow;\n\nexport {\n Arrow,\n //\n Root,\n};\nexport type { ArrowProps };\n"],"names":["Arrow","Root","React","Primitive","NAME","forwardRef","props","forwardedRef","children","width","height","arrowProps","asChild"],"version":3,"file":"index.js.map"}

View File

@@ -0,0 +1,32 @@
import $jbnEx$babelruntimehelpersesmextends from "@babel/runtime/helpers/esm/extends";
import {forwardRef as $jbnEx$forwardRef, createElement as $jbnEx$createElement} from "react";
import {Primitive as $jbnEx$Primitive} from "@radix-ui/react-primitive";
/* -------------------------------------------------------------------------------------------------
* Arrow
* -----------------------------------------------------------------------------------------------*/ const $7e8f5cd07187803e$var$NAME = 'Arrow';
const $7e8f5cd07187803e$export$21b07c8f274aebd5 = /*#__PURE__*/ $jbnEx$forwardRef((props, forwardedRef)=>{
const { children: children , width: width = 10 , height: height = 5 , ...arrowProps } = props;
return /*#__PURE__*/ $jbnEx$createElement($jbnEx$Primitive.svg, $jbnEx$babelruntimehelpersesmextends({}, arrowProps, {
ref: forwardedRef,
width: width,
height: height,
viewBox: "0 0 30 10",
preserveAspectRatio: "none"
}), props.asChild ? children : /*#__PURE__*/ $jbnEx$createElement("polygon", {
points: "0,0 30,0 15,10"
}));
});
/*#__PURE__*/ Object.assign($7e8f5cd07187803e$export$21b07c8f274aebd5, {
displayName: $7e8f5cd07187803e$var$NAME
});
/* -----------------------------------------------------------------------------------------------*/ const $7e8f5cd07187803e$export$be92b6f5f03c0fe9 = $7e8f5cd07187803e$export$21b07c8f274aebd5;
export {$7e8f5cd07187803e$export$21b07c8f274aebd5 as Arrow, $7e8f5cd07187803e$export$be92b6f5f03c0fe9 as Root};
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"mappings":";;;;A;;;ACKA;;oGAEA,CAEA,MAAMI,0BAAI,GAAG,OAAb,AAAA;AAMA,MAAMJ,yCAAK,GAAA,aAAGE,CAAAA,iBAAA,CAA2C,CAACI,KAAD,EAAQC,YAAR,GAAyB;IAChF,MAAM,E,UAAEC,QAAF,CAAA,SAAYC,KAAK,GAAG,EAApB,WAAwBC,MAAM,GAAG,CAAjC,GAAoC,GAAGC,UAAH,EAApC,GAAsDL,KAA5D,AAAM;IACN,OAAA,aACE,CAAA,oBAAA,CAAC,gBAAD,CAAW,GAAX,EAAA,oCAAA,CAAA,EAAA,EACMK,UADN,EADF;QAGI,GAAG,EAAEJ,YAFP;QAGE,KAAK,EAAEE,KAHT;QAIE,MAAM,EAAEC,MAJV;QAKE,OAAO,EAAC,WALV;QAME,mBAAmB,EAAC,MAApB;KANF,CAAA,EASGJ,KAAK,CAACM,OAAN,GAAgBJ,QAAhB,GAAA,aAA2B,CAAA,oBAT9B,CAAA,SAAA,EAAA;QASuC,MAAM,EAAC,gBAAP;KAAT,CAT9B,CADF,CAUgC;CAZpB,CAAd,AAeC;AAED,aAAA,CAAA,MAAA,CAAA,MAAA,CAAA,yCAAA,EAAA;IAAA,WAAA,EAAA,0BAAA;CAAA,CAAA,CAAA;AAEA,oGAAA,CAEA,MAAMP,yCAAI,GAAGD,yCAAb,AAAA;;ADpCA","sources":["packages/react/arrow/src/index.ts","packages/react/arrow/src/Arrow.tsx"],"sourcesContent":["export {\n Arrow,\n //\n Root,\n} from './Arrow';\nexport type { ArrowProps } from './Arrow';\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 * Arrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst NAME = 'Arrow';\n\ntype ArrowElement = React.ElementRef<typeof Primitive.svg>;\ntype PrimitiveSvgProps = Radix.ComponentPropsWithoutRef<typeof Primitive.svg>;\ninterface ArrowProps extends PrimitiveSvgProps {}\n\nconst Arrow = React.forwardRef<ArrowElement, ArrowProps>((props, forwardedRef) => {\n const { children, width = 10, height = 5, ...arrowProps } = props;\n return (\n <Primitive.svg\n {...arrowProps}\n ref={forwardedRef}\n width={width}\n height={height}\n viewBox=\"0 0 30 10\"\n preserveAspectRatio=\"none\"\n >\n {/* We use their children if they're slotting to replace the whole svg */}\n {props.asChild ? children : <polygon points=\"0,0 30,0 15,10\" />}\n </Primitive.svg>\n );\n});\n\nArrow.displayName = NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = Arrow;\n\nexport {\n Arrow,\n //\n Root,\n};\nexport type { ArrowProps };\n"],"names":["Arrow","Root","React","Primitive","NAME","forwardRef","props","forwardedRef","children","width","height","arrowProps","asChild"],"version":3,"file":"index.mjs.map"}

56
server/node_modules/@radix-ui/react-arrow/package.json generated vendored Normal file
View File

@@ -0,0 +1,56 @@
{
"name": "@radix-ui/react-arrow",
"version": "1.0.3",
"license": "MIT",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"source": "./src/index.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"README.md"
],
"sideEffects": false,
"scripts": {
"clean": "rm -rf dist",
"version": "yarn version"
},
"dependencies": {
"@babel/runtime": "^7.13.10",
"@radix-ui/react-primitive": "1.0.3"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0",
"react-dom": "^16.8 || ^17.0 || ^18.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
},
"homepage": "https://radix-ui.com/primitives",
"repository": {
"type": "git",
"url": "git+https://github.com/radix-ui/primitives.git"
},
"bugs": {
"url": "https://github.com/radix-ui/primitives/issues"
}
}

13
server/node_modules/@radix-ui/react-avatar/README.md generated vendored Normal file
View File

@@ -0,0 +1,13 @@
# `react-avatar`
## Installation
```sh
$ yarn add @radix-ui/react-avatar
# or
$ npm install @radix-ui/react-avatar
```
## Usage
View docs [here](https://radix-ui.com/primitives/docs/components/avatar).

View File

@@ -0,0 +1,23 @@
import * as React from "react";
import * as Radix from "@radix-ui/react-primitive";
import { Primitive } from "@radix-ui/react-primitive";
export const createAvatarScope: import("@radix-ui/react-context").CreateScope;
type ImageLoadingStatus = 'idle' | 'loading' | 'loaded' | 'error';
type PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;
export interface AvatarProps extends PrimitiveSpanProps {
}
export const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
type PrimitiveImageProps = Radix.ComponentPropsWithoutRef<typeof Primitive.img>;
export interface AvatarImageProps extends PrimitiveImageProps {
onLoadingStatusChange?: (status: ImageLoadingStatus) => void;
}
export const AvatarImage: React.ForwardRefExoticComponent<AvatarImageProps & React.RefAttributes<HTMLImageElement>>;
export interface AvatarFallbackProps extends PrimitiveSpanProps {
delayMs?: number;
}
export const AvatarFallback: React.ForwardRefExoticComponent<AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>>;
export const Root: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
export const Image: React.ForwardRefExoticComponent<AvatarImageProps & React.RefAttributes<HTMLImageElement>>;
export const Fallback: React.ForwardRefExoticComponent<AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>>;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,23 @@
import * as React from "react";
import * as Radix from "@radix-ui/react-primitive";
import { Primitive } from "@radix-ui/react-primitive";
export const createAvatarScope: import("@radix-ui/react-context").CreateScope;
type ImageLoadingStatus = 'idle' | 'loading' | 'loaded' | 'error';
type PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;
export interface AvatarProps extends PrimitiveSpanProps {
}
export const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
type PrimitiveImageProps = Radix.ComponentPropsWithoutRef<typeof Primitive.img>;
export interface AvatarImageProps extends PrimitiveImageProps {
onLoadingStatusChange?: (status: ImageLoadingStatus) => void;
}
export const AvatarImage: React.ForwardRefExoticComponent<AvatarImageProps & React.RefAttributes<HTMLImageElement>>;
export interface AvatarFallbackProps extends PrimitiveSpanProps {
delayMs?: number;
}
export const AvatarFallback: React.ForwardRefExoticComponent<AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>>;
export const Root: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
export const Image: React.ForwardRefExoticComponent<AvatarImageProps & React.RefAttributes<HTMLImageElement>>;
export const Fallback: React.ForwardRefExoticComponent<AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>>;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"mappings":";;;AAgBA,OAAA,wFAAgF,CAAC;AAEjF,0BAA0B,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAUlE,0BAA0B,MAAM,wBAAwB,CAAC,OAAO,UAAU,IAAI,CAAC,CAAC;AAChF,4BAAsB,SAAQ,kBAAkB;CAAG;AAEnD,OAAA,MAAM,2FAcL,CAAC;AAWF,2BAA2B,MAAM,wBAAwB,CAAC,OAAO,UAAU,GAAG,CAAC,CAAC;AAChF,iCAA2B,SAAQ,mBAAmB;IACpD,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;CAC9D;AAED,OAAA,MAAM,sGAoBL,CAAC;AAWF,oCAA8B,SAAQ,kBAAkB;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,OAAA,MAAM,2GAiBL,CAAC;AAmCF,OAAA,MAAM,yFAAa,CAAC;AACpB,OAAA,MAAM,gGAAmB,CAAC;AAC1B,OAAA,MAAM,qGAAyB,CAAC","sources":["packages/react/avatar/src/packages/react/avatar/src/Avatar.tsx","packages/react/avatar/src/packages/react/avatar/src/index.ts","packages/react/avatar/src/index.ts"],"sourcesContent":[null,null,"export {\n createAvatarScope,\n //\n Avatar,\n AvatarImage,\n AvatarFallback,\n //\n Root,\n Image,\n Fallback,\n} from './Avatar';\nexport type { AvatarProps, AvatarImageProps, AvatarFallbackProps } from './Avatar';\n"],"names":[],"version":3,"file":"index.d.ts.map"}

View File

@@ -0,0 +1,129 @@
var $6FDFN$babelruntimehelpersextends = require("@babel/runtime/helpers/extends");
var $6FDFN$react = require("react");
var $6FDFN$radixuireactcontext = require("@radix-ui/react-context");
var $6FDFN$radixuireactusecallbackref = require("@radix-ui/react-use-callback-ref");
var $6FDFN$radixuireactuselayouteffect = require("@radix-ui/react-use-layout-effect");
var $6FDFN$radixuireactprimitive = require("@radix-ui/react-primitive");
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, "createAvatarScope", () => $94437fed6c1d6d8a$export$90370d16b488820f);
$parcel$export(module.exports, "Avatar", () => $94437fed6c1d6d8a$export$e2255cf6045e8d47);
$parcel$export(module.exports, "AvatarImage", () => $94437fed6c1d6d8a$export$2cd8ae1985206fe8);
$parcel$export(module.exports, "AvatarFallback", () => $94437fed6c1d6d8a$export$69fffb6a9571fbfe);
$parcel$export(module.exports, "Root", () => $94437fed6c1d6d8a$export$be92b6f5f03c0fe9);
$parcel$export(module.exports, "Image", () => $94437fed6c1d6d8a$export$3e431a229df88919);
$parcel$export(module.exports, "Fallback", () => $94437fed6c1d6d8a$export$fb8d7f40caaeea67);
/* -------------------------------------------------------------------------------------------------
* Avatar
* -----------------------------------------------------------------------------------------------*/ const $94437fed6c1d6d8a$var$AVATAR_NAME = 'Avatar';
const [$94437fed6c1d6d8a$var$createAvatarContext, $94437fed6c1d6d8a$export$90370d16b488820f] = $6FDFN$radixuireactcontext.createContextScope($94437fed6c1d6d8a$var$AVATAR_NAME);
const [$94437fed6c1d6d8a$var$AvatarProvider, $94437fed6c1d6d8a$var$useAvatarContext] = $94437fed6c1d6d8a$var$createAvatarContext($94437fed6c1d6d8a$var$AVATAR_NAME);
const $94437fed6c1d6d8a$export$e2255cf6045e8d47 = /*#__PURE__*/ $6FDFN$react.forwardRef((props, forwardedRef)=>{
const { __scopeAvatar: __scopeAvatar , ...avatarProps } = props;
const [imageLoadingStatus, setImageLoadingStatus] = $6FDFN$react.useState('idle');
return /*#__PURE__*/ $6FDFN$react.createElement($94437fed6c1d6d8a$var$AvatarProvider, {
scope: __scopeAvatar,
imageLoadingStatus: imageLoadingStatus,
onImageLoadingStatusChange: setImageLoadingStatus
}, /*#__PURE__*/ $6FDFN$react.createElement($6FDFN$radixuireactprimitive.Primitive.span, ($parcel$interopDefault($6FDFN$babelruntimehelpersextends))({}, avatarProps, {
ref: forwardedRef
})));
});
/*#__PURE__*/ Object.assign($94437fed6c1d6d8a$export$e2255cf6045e8d47, {
displayName: $94437fed6c1d6d8a$var$AVATAR_NAME
});
/* -------------------------------------------------------------------------------------------------
* AvatarImage
* -----------------------------------------------------------------------------------------------*/ const $94437fed6c1d6d8a$var$IMAGE_NAME = 'AvatarImage';
const $94437fed6c1d6d8a$export$2cd8ae1985206fe8 = /*#__PURE__*/ $6FDFN$react.forwardRef((props, forwardedRef)=>{
const { __scopeAvatar: __scopeAvatar , src: src , onLoadingStatusChange: onLoadingStatusChange = ()=>{} , ...imageProps } = props;
const context = $94437fed6c1d6d8a$var$useAvatarContext($94437fed6c1d6d8a$var$IMAGE_NAME, __scopeAvatar);
const imageLoadingStatus = $94437fed6c1d6d8a$var$useImageLoadingStatus(src);
const handleLoadingStatusChange = $6FDFN$radixuireactusecallbackref.useCallbackRef((status)=>{
onLoadingStatusChange(status);
context.onImageLoadingStatusChange(status);
});
$6FDFN$radixuireactuselayouteffect.useLayoutEffect(()=>{
if (imageLoadingStatus !== 'idle') handleLoadingStatusChange(imageLoadingStatus);
}, [
imageLoadingStatus,
handleLoadingStatusChange
]);
return imageLoadingStatus === 'loaded' ? /*#__PURE__*/ $6FDFN$react.createElement($6FDFN$radixuireactprimitive.Primitive.img, ($parcel$interopDefault($6FDFN$babelruntimehelpersextends))({}, imageProps, {
ref: forwardedRef,
src: src
})) : null;
});
/*#__PURE__*/ Object.assign($94437fed6c1d6d8a$export$2cd8ae1985206fe8, {
displayName: $94437fed6c1d6d8a$var$IMAGE_NAME
});
/* -------------------------------------------------------------------------------------------------
* AvatarFallback
* -----------------------------------------------------------------------------------------------*/ const $94437fed6c1d6d8a$var$FALLBACK_NAME = 'AvatarFallback';
const $94437fed6c1d6d8a$export$69fffb6a9571fbfe = /*#__PURE__*/ $6FDFN$react.forwardRef((props, forwardedRef)=>{
const { __scopeAvatar: __scopeAvatar , delayMs: delayMs , ...fallbackProps } = props;
const context = $94437fed6c1d6d8a$var$useAvatarContext($94437fed6c1d6d8a$var$FALLBACK_NAME, __scopeAvatar);
const [canRender, setCanRender] = $6FDFN$react.useState(delayMs === undefined);
$6FDFN$react.useEffect(()=>{
if (delayMs !== undefined) {
const timerId = window.setTimeout(()=>setCanRender(true)
, delayMs);
return ()=>window.clearTimeout(timerId)
;
}
}, [
delayMs
]);
return canRender && context.imageLoadingStatus !== 'loaded' ? /*#__PURE__*/ $6FDFN$react.createElement($6FDFN$radixuireactprimitive.Primitive.span, ($parcel$interopDefault($6FDFN$babelruntimehelpersextends))({}, fallbackProps, {
ref: forwardedRef
})) : null;
});
/*#__PURE__*/ Object.assign($94437fed6c1d6d8a$export$69fffb6a9571fbfe, {
displayName: $94437fed6c1d6d8a$var$FALLBACK_NAME
});
/* -----------------------------------------------------------------------------------------------*/ function $94437fed6c1d6d8a$var$useImageLoadingStatus(src) {
const [loadingStatus, setLoadingStatus] = $6FDFN$react.useState('idle');
$6FDFN$radixuireactuselayouteffect.useLayoutEffect(()=>{
if (!src) {
setLoadingStatus('error');
return;
}
let isMounted = true;
const image = new window.Image();
const updateStatus = (status)=>()=>{
if (!isMounted) return;
setLoadingStatus(status);
}
;
setLoadingStatus('loading');
image.onload = updateStatus('loaded');
image.onerror = updateStatus('error');
image.src = src;
return ()=>{
isMounted = false;
};
}, [
src
]);
return loadingStatus;
}
const $94437fed6c1d6d8a$export$be92b6f5f03c0fe9 = $94437fed6c1d6d8a$export$e2255cf6045e8d47;
const $94437fed6c1d6d8a$export$3e431a229df88919 = $94437fed6c1d6d8a$export$2cd8ae1985206fe8;
const $94437fed6c1d6d8a$export$fb8d7f40caaeea67 = $94437fed6c1d6d8a$export$69fffb6a9571fbfe;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,116 @@
import $8NyvN$babelruntimehelpersesmextends from "@babel/runtime/helpers/esm/extends";
import {forwardRef as $8NyvN$forwardRef, useState as $8NyvN$useState, createElement as $8NyvN$createElement, useEffect as $8NyvN$useEffect} from "react";
import {createContextScope as $8NyvN$createContextScope} from "@radix-ui/react-context";
import {useCallbackRef as $8NyvN$useCallbackRef} from "@radix-ui/react-use-callback-ref";
import {useLayoutEffect as $8NyvN$useLayoutEffect} from "@radix-ui/react-use-layout-effect";
import {Primitive as $8NyvN$Primitive} from "@radix-ui/react-primitive";
/* -------------------------------------------------------------------------------------------------
* Avatar
* -----------------------------------------------------------------------------------------------*/ const $cddcb0b647441e34$var$AVATAR_NAME = 'Avatar';
const [$cddcb0b647441e34$var$createAvatarContext, $cddcb0b647441e34$export$90370d16b488820f] = $8NyvN$createContextScope($cddcb0b647441e34$var$AVATAR_NAME);
const [$cddcb0b647441e34$var$AvatarProvider, $cddcb0b647441e34$var$useAvatarContext] = $cddcb0b647441e34$var$createAvatarContext($cddcb0b647441e34$var$AVATAR_NAME);
const $cddcb0b647441e34$export$e2255cf6045e8d47 = /*#__PURE__*/ $8NyvN$forwardRef((props, forwardedRef)=>{
const { __scopeAvatar: __scopeAvatar , ...avatarProps } = props;
const [imageLoadingStatus, setImageLoadingStatus] = $8NyvN$useState('idle');
return /*#__PURE__*/ $8NyvN$createElement($cddcb0b647441e34$var$AvatarProvider, {
scope: __scopeAvatar,
imageLoadingStatus: imageLoadingStatus,
onImageLoadingStatusChange: setImageLoadingStatus
}, /*#__PURE__*/ $8NyvN$createElement($8NyvN$Primitive.span, $8NyvN$babelruntimehelpersesmextends({}, avatarProps, {
ref: forwardedRef
})));
});
/*#__PURE__*/ Object.assign($cddcb0b647441e34$export$e2255cf6045e8d47, {
displayName: $cddcb0b647441e34$var$AVATAR_NAME
});
/* -------------------------------------------------------------------------------------------------
* AvatarImage
* -----------------------------------------------------------------------------------------------*/ const $cddcb0b647441e34$var$IMAGE_NAME = 'AvatarImage';
const $cddcb0b647441e34$export$2cd8ae1985206fe8 = /*#__PURE__*/ $8NyvN$forwardRef((props, forwardedRef)=>{
const { __scopeAvatar: __scopeAvatar , src: src , onLoadingStatusChange: onLoadingStatusChange = ()=>{} , ...imageProps } = props;
const context = $cddcb0b647441e34$var$useAvatarContext($cddcb0b647441e34$var$IMAGE_NAME, __scopeAvatar);
const imageLoadingStatus = $cddcb0b647441e34$var$useImageLoadingStatus(src);
const handleLoadingStatusChange = $8NyvN$useCallbackRef((status)=>{
onLoadingStatusChange(status);
context.onImageLoadingStatusChange(status);
});
$8NyvN$useLayoutEffect(()=>{
if (imageLoadingStatus !== 'idle') handleLoadingStatusChange(imageLoadingStatus);
}, [
imageLoadingStatus,
handleLoadingStatusChange
]);
return imageLoadingStatus === 'loaded' ? /*#__PURE__*/ $8NyvN$createElement($8NyvN$Primitive.img, $8NyvN$babelruntimehelpersesmextends({}, imageProps, {
ref: forwardedRef,
src: src
})) : null;
});
/*#__PURE__*/ Object.assign($cddcb0b647441e34$export$2cd8ae1985206fe8, {
displayName: $cddcb0b647441e34$var$IMAGE_NAME
});
/* -------------------------------------------------------------------------------------------------
* AvatarFallback
* -----------------------------------------------------------------------------------------------*/ const $cddcb0b647441e34$var$FALLBACK_NAME = 'AvatarFallback';
const $cddcb0b647441e34$export$69fffb6a9571fbfe = /*#__PURE__*/ $8NyvN$forwardRef((props, forwardedRef)=>{
const { __scopeAvatar: __scopeAvatar , delayMs: delayMs , ...fallbackProps } = props;
const context = $cddcb0b647441e34$var$useAvatarContext($cddcb0b647441e34$var$FALLBACK_NAME, __scopeAvatar);
const [canRender, setCanRender] = $8NyvN$useState(delayMs === undefined);
$8NyvN$useEffect(()=>{
if (delayMs !== undefined) {
const timerId = window.setTimeout(()=>setCanRender(true)
, delayMs);
return ()=>window.clearTimeout(timerId)
;
}
}, [
delayMs
]);
return canRender && context.imageLoadingStatus !== 'loaded' ? /*#__PURE__*/ $8NyvN$createElement($8NyvN$Primitive.span, $8NyvN$babelruntimehelpersesmextends({}, fallbackProps, {
ref: forwardedRef
})) : null;
});
/*#__PURE__*/ Object.assign($cddcb0b647441e34$export$69fffb6a9571fbfe, {
displayName: $cddcb0b647441e34$var$FALLBACK_NAME
});
/* -----------------------------------------------------------------------------------------------*/ function $cddcb0b647441e34$var$useImageLoadingStatus(src) {
const [loadingStatus, setLoadingStatus] = $8NyvN$useState('idle');
$8NyvN$useLayoutEffect(()=>{
if (!src) {
setLoadingStatus('error');
return;
}
let isMounted = true;
const image = new window.Image();
const updateStatus = (status)=>()=>{
if (!isMounted) return;
setLoadingStatus(status);
}
;
setLoadingStatus('loading');
image.onload = updateStatus('loaded');
image.onerror = updateStatus('error');
image.src = src;
return ()=>{
isMounted = false;
};
}, [
src
]);
return loadingStatus;
}
const $cddcb0b647441e34$export$be92b6f5f03c0fe9 = $cddcb0b647441e34$export$e2255cf6045e8d47;
const $cddcb0b647441e34$export$3e431a229df88919 = $cddcb0b647441e34$export$2cd8ae1985206fe8;
const $cddcb0b647441e34$export$fb8d7f40caaeea67 = $cddcb0b647441e34$export$69fffb6a9571fbfe;
export {$cddcb0b647441e34$export$90370d16b488820f as createAvatarScope, $cddcb0b647441e34$export$e2255cf6045e8d47 as Avatar, $cddcb0b647441e34$export$2cd8ae1985206fe8 as AvatarImage, $cddcb0b647441e34$export$69fffb6a9571fbfe as AvatarFallback, $cddcb0b647441e34$export$be92b6f5f03c0fe9 as Root, $cddcb0b647441e34$export$3e431a229df88919 as Image, $cddcb0b647441e34$export$fb8d7f40caaeea67 as Fallback};
//# sourceMappingURL=index.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,59 @@
{
"name": "@radix-ui/react-avatar",
"version": "1.0.4",
"license": "MIT",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"source": "./src/index.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"README.md"
],
"sideEffects": false,
"scripts": {
"clean": "rm -rf dist",
"version": "yarn version"
},
"dependencies": {
"@babel/runtime": "^7.13.10",
"@radix-ui/react-context": "1.0.1",
"@radix-ui/react-primitive": "1.0.3",
"@radix-ui/react-use-callback-ref": "1.0.1",
"@radix-ui/react-use-layout-effect": "1.0.1"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0",
"react-dom": "^16.8 || ^17.0 || ^18.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
},
"homepage": "https://radix-ui.com/primitives",
"repository": {
"type": "git",
"url": "git+https://github.com/radix-ui/primitives.git"
},
"bugs": {
"url": "https://github.com/radix-ui/primitives/issues"
}
}

13
server/node_modules/@radix-ui/react-checkbox/README.md generated vendored Normal file
View File

@@ -0,0 +1,13 @@
# `react-checkbox`
## Installation
```sh
$ yarn add @radix-ui/react-checkbox
# or
$ npm install @radix-ui/react-checkbox
```
## Usage
View docs [here](https://radix-ui.com/primitives/docs/components/checkbox).

View File

@@ -0,0 +1,26 @@
import * as React from "react";
import * as Radix from "@radix-ui/react-primitive";
import { Primitive } from "@radix-ui/react-primitive";
export const createCheckboxScope: import("@radix-ui/react-context").CreateScope;
type CheckedState = boolean | 'indeterminate';
type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
export interface CheckboxProps extends Omit<PrimitiveButtonProps, 'checked' | 'defaultChecked'> {
checked?: CheckedState;
defaultChecked?: CheckedState;
required?: boolean;
onCheckedChange?(checked: CheckedState): void;
}
export const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLButtonElement>>;
type PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;
export interface CheckboxIndicatorProps extends PrimitiveSpanProps {
/**
* Used to force mounting when more control is needed. Useful when
* controlling animation with React animation libraries.
*/
forceMount?: true;
}
export const CheckboxIndicator: React.ForwardRefExoticComponent<CheckboxIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
export const Root: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLButtonElement>>;
export const Indicator: React.ForwardRefExoticComponent<CheckboxIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,26 @@
import * as React from "react";
import * as Radix from "@radix-ui/react-primitive";
import { Primitive } from "@radix-ui/react-primitive";
export const createCheckboxScope: import("@radix-ui/react-context").CreateScope;
type CheckedState = boolean | 'indeterminate';
type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
export interface CheckboxProps extends Omit<PrimitiveButtonProps, 'checked' | 'defaultChecked'> {
checked?: CheckedState;
defaultChecked?: CheckedState;
required?: boolean;
onCheckedChange?(checked: CheckedState): void;
}
export const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLButtonElement>>;
type PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;
export interface CheckboxIndicatorProps extends PrimitiveSpanProps {
/**
* Used to force mounting when more control is needed. Useful when
* controlling animation with React animation libraries.
*/
forceMount?: true;
}
export const CheckboxIndicator: React.ForwardRefExoticComponent<CheckboxIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
export const Root: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLButtonElement>>;
export const Indicator: React.ForwardRefExoticComponent<CheckboxIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"mappings":";;;AAoBA,OAAA,0FAAsF,CAAC;AAEvF,oBAAoB,OAAO,GAAG,eAAe,CAAC;AAW9C,4BAA4B,MAAM,wBAAwB,CAAC,OAAO,UAAU,MAAM,CAAC,CAAC;AACpF,8BAAwB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,SAAS,GAAG,gBAAgB,CAAC;IACtF,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,cAAc,CAAC,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC;CAC/C;AAED,OAAA,MAAM,iGA+EL,CAAC;AAWF,0BAA0B,MAAM,wBAAwB,CAAC,OAAO,UAAU,IAAI,CAAC,CAAC;AAChF,uCAAiC,SAAQ,kBAAkB;IACzD;;;OAGG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC;CACnB;AAED,OAAA,MAAM,iHAgBL,CAAC;AA8DF,OAAA,MAAM,6FAAe,CAAC;AACtB,OAAA,MAAM,yGAA6B,CAAC","sources":["packages/react/checkbox/src/packages/react/checkbox/src/Checkbox.tsx","packages/react/checkbox/src/packages/react/checkbox/src/index.ts","packages/react/checkbox/src/index.ts"],"sourcesContent":[null,null,"export {\n createCheckboxScope,\n //\n Checkbox,\n CheckboxIndicator,\n //\n Root,\n Indicator,\n} from './Checkbox';\nexport type { CheckboxProps, CheckboxIndicatorProps } from './Checkbox';\n"],"names":[],"version":3,"file":"index.d.ts.map"}

View File

@@ -0,0 +1,185 @@
var $dKOox$babelruntimehelpersextends = require("@babel/runtime/helpers/extends");
var $dKOox$react = require("react");
var $dKOox$radixuireactcomposerefs = require("@radix-ui/react-compose-refs");
var $dKOox$radixuireactcontext = require("@radix-ui/react-context");
var $dKOox$radixuiprimitive = require("@radix-ui/primitive");
var $dKOox$radixuireactusecontrollablestate = require("@radix-ui/react-use-controllable-state");
var $dKOox$radixuireactuseprevious = require("@radix-ui/react-use-previous");
var $dKOox$radixuireactusesize = require("@radix-ui/react-use-size");
var $dKOox$radixuireactpresence = require("@radix-ui/react-presence");
var $dKOox$radixuireactprimitive = require("@radix-ui/react-primitive");
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, "createCheckboxScope", () => $a17f2c9fbf2ccf8c$export$b566c4ff5488ea01);
$parcel$export(module.exports, "Checkbox", () => $a17f2c9fbf2ccf8c$export$48513f6b9f8ce62d);
$parcel$export(module.exports, "CheckboxIndicator", () => $a17f2c9fbf2ccf8c$export$59aad738f51d1c05);
$parcel$export(module.exports, "Root", () => $a17f2c9fbf2ccf8c$export$be92b6f5f03c0fe9);
$parcel$export(module.exports, "Indicator", () => $a17f2c9fbf2ccf8c$export$adb584737d712b70);
/* -------------------------------------------------------------------------------------------------
* Checkbox
* -----------------------------------------------------------------------------------------------*/ const $a17f2c9fbf2ccf8c$var$CHECKBOX_NAME = 'Checkbox';
const [$a17f2c9fbf2ccf8c$var$createCheckboxContext, $a17f2c9fbf2ccf8c$export$b566c4ff5488ea01] = $dKOox$radixuireactcontext.createContextScope($a17f2c9fbf2ccf8c$var$CHECKBOX_NAME);
const [$a17f2c9fbf2ccf8c$var$CheckboxProvider, $a17f2c9fbf2ccf8c$var$useCheckboxContext] = $a17f2c9fbf2ccf8c$var$createCheckboxContext($a17f2c9fbf2ccf8c$var$CHECKBOX_NAME);
const $a17f2c9fbf2ccf8c$export$48513f6b9f8ce62d = /*#__PURE__*/ $dKOox$react.forwardRef((props, forwardedRef)=>{
const { __scopeCheckbox: __scopeCheckbox , name: name , checked: checkedProp , defaultChecked: defaultChecked , required: required , disabled: disabled , value: value = 'on' , onCheckedChange: onCheckedChange , ...checkboxProps } = props;
const [button, setButton] = $dKOox$react.useState(null);
const composedRefs = $dKOox$radixuireactcomposerefs.useComposedRefs(forwardedRef, (node)=>setButton(node)
);
const hasConsumerStoppedPropagationRef = $dKOox$react.useRef(false); // We set this to true by default so that events bubble to forms without JS (SSR)
const isFormControl = button ? Boolean(button.closest('form')) : true;
const [checked = false, setChecked] = $dKOox$radixuireactusecontrollablestate.useControllableState({
prop: checkedProp,
defaultProp: defaultChecked,
onChange: onCheckedChange
});
const initialCheckedStateRef = $dKOox$react.useRef(checked);
$dKOox$react.useEffect(()=>{
const form = button === null || button === void 0 ? void 0 : button.form;
if (form) {
const reset = ()=>setChecked(initialCheckedStateRef.current)
;
form.addEventListener('reset', reset);
return ()=>form.removeEventListener('reset', reset)
;
}
}, [
button,
setChecked
]);
return /*#__PURE__*/ $dKOox$react.createElement($a17f2c9fbf2ccf8c$var$CheckboxProvider, {
scope: __scopeCheckbox,
state: checked,
disabled: disabled
}, /*#__PURE__*/ $dKOox$react.createElement($dKOox$radixuireactprimitive.Primitive.button, ($parcel$interopDefault($dKOox$babelruntimehelpersextends))({
type: "button",
role: "checkbox",
"aria-checked": $a17f2c9fbf2ccf8c$var$isIndeterminate(checked) ? 'mixed' : checked,
"aria-required": required,
"data-state": $a17f2c9fbf2ccf8c$var$getState(checked),
"data-disabled": disabled ? '' : undefined,
disabled: disabled,
value: value
}, checkboxProps, {
ref: composedRefs,
onKeyDown: $dKOox$radixuiprimitive.composeEventHandlers(props.onKeyDown, (event)=>{
// According to WAI ARIA, Checkboxes don't activate on enter keypress
if (event.key === 'Enter') event.preventDefault();
}),
onClick: $dKOox$radixuiprimitive.composeEventHandlers(props.onClick, (event)=>{
setChecked((prevChecked)=>$a17f2c9fbf2ccf8c$var$isIndeterminate(prevChecked) ? true : !prevChecked
);
if (isFormControl) {
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(); // if checkbox is in a form, stop propagation from the button so that we only propagate
// one click event (from the input). We propagate changes from an input so that native
// form validation works and form events reflect checkbox updates.
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
}
})
})), isFormControl && /*#__PURE__*/ $dKOox$react.createElement($a17f2c9fbf2ccf8c$var$BubbleInput, {
control: button,
bubbles: !hasConsumerStoppedPropagationRef.current,
name: name,
value: value,
checked: checked,
required: required,
disabled: disabled // We transform because the input is absolutely positioned but we have
,
style: {
transform: 'translateX(-100%)'
}
}));
});
/*#__PURE__*/ Object.assign($a17f2c9fbf2ccf8c$export$48513f6b9f8ce62d, {
displayName: $a17f2c9fbf2ccf8c$var$CHECKBOX_NAME
});
/* -------------------------------------------------------------------------------------------------
* CheckboxIndicator
* -----------------------------------------------------------------------------------------------*/ const $a17f2c9fbf2ccf8c$var$INDICATOR_NAME = 'CheckboxIndicator';
const $a17f2c9fbf2ccf8c$export$59aad738f51d1c05 = /*#__PURE__*/ $dKOox$react.forwardRef((props, forwardedRef)=>{
const { __scopeCheckbox: __scopeCheckbox , forceMount: forceMount , ...indicatorProps } = props;
const context = $a17f2c9fbf2ccf8c$var$useCheckboxContext($a17f2c9fbf2ccf8c$var$INDICATOR_NAME, __scopeCheckbox);
return /*#__PURE__*/ $dKOox$react.createElement($dKOox$radixuireactpresence.Presence, {
present: forceMount || $a17f2c9fbf2ccf8c$var$isIndeterminate(context.state) || context.state === true
}, /*#__PURE__*/ $dKOox$react.createElement($dKOox$radixuireactprimitive.Primitive.span, ($parcel$interopDefault($dKOox$babelruntimehelpersextends))({
"data-state": $a17f2c9fbf2ccf8c$var$getState(context.state),
"data-disabled": context.disabled ? '' : undefined
}, indicatorProps, {
ref: forwardedRef,
style: {
pointerEvents: 'none',
...props.style
}
})));
});
/*#__PURE__*/ Object.assign($a17f2c9fbf2ccf8c$export$59aad738f51d1c05, {
displayName: $a17f2c9fbf2ccf8c$var$INDICATOR_NAME
});
/* ---------------------------------------------------------------------------------------------- */ const $a17f2c9fbf2ccf8c$var$BubbleInput = (props)=>{
const { control: control , checked: checked , bubbles: bubbles = true , ...inputProps } = props;
const ref = $dKOox$react.useRef(null);
const prevChecked = $dKOox$radixuireactuseprevious.usePrevious(checked);
const controlSize = $dKOox$radixuireactusesize.useSize(control); // Bubble checked change to parents (e.g form change event)
$dKOox$react.useEffect(()=>{
const input = ref.current;
const inputProto = window.HTMLInputElement.prototype;
const descriptor = Object.getOwnPropertyDescriptor(inputProto, 'checked');
const setChecked = descriptor.set;
if (prevChecked !== checked && setChecked) {
const event = new Event('click', {
bubbles: bubbles
});
input.indeterminate = $a17f2c9fbf2ccf8c$var$isIndeterminate(checked);
setChecked.call(input, $a17f2c9fbf2ccf8c$var$isIndeterminate(checked) ? false : checked);
input.dispatchEvent(event);
}
}, [
prevChecked,
checked,
bubbles
]);
return /*#__PURE__*/ $dKOox$react.createElement("input", ($parcel$interopDefault($dKOox$babelruntimehelpersextends))({
type: "checkbox",
"aria-hidden": true,
defaultChecked: $a17f2c9fbf2ccf8c$var$isIndeterminate(checked) ? false : checked
}, inputProps, {
tabIndex: -1,
ref: ref,
style: {
...props.style,
...controlSize,
position: 'absolute',
pointerEvents: 'none',
opacity: 0,
margin: 0
}
}));
};
function $a17f2c9fbf2ccf8c$var$isIndeterminate(checked) {
return checked === 'indeterminate';
}
function $a17f2c9fbf2ccf8c$var$getState(checked) {
return $a17f2c9fbf2ccf8c$var$isIndeterminate(checked) ? 'indeterminate' : checked ? 'checked' : 'unchecked';
}
const $a17f2c9fbf2ccf8c$export$be92b6f5f03c0fe9 = $a17f2c9fbf2ccf8c$export$48513f6b9f8ce62d;
const $a17f2c9fbf2ccf8c$export$adb584737d712b70 = $a17f2c9fbf2ccf8c$export$59aad738f51d1c05;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,174 @@
import $1bpvS$babelruntimehelpersesmextends from "@babel/runtime/helpers/esm/extends";
import {forwardRef as $1bpvS$forwardRef, useState as $1bpvS$useState, useRef as $1bpvS$useRef, useEffect as $1bpvS$useEffect, createElement as $1bpvS$createElement} from "react";
import {useComposedRefs as $1bpvS$useComposedRefs} from "@radix-ui/react-compose-refs";
import {createContextScope as $1bpvS$createContextScope} from "@radix-ui/react-context";
import {composeEventHandlers as $1bpvS$composeEventHandlers} from "@radix-ui/primitive";
import {useControllableState as $1bpvS$useControllableState} from "@radix-ui/react-use-controllable-state";
import {usePrevious as $1bpvS$usePrevious} from "@radix-ui/react-use-previous";
import {useSize as $1bpvS$useSize} from "@radix-ui/react-use-size";
import {Presence as $1bpvS$Presence} from "@radix-ui/react-presence";
import {Primitive as $1bpvS$Primitive} from "@radix-ui/react-primitive";
/* -------------------------------------------------------------------------------------------------
* Checkbox
* -----------------------------------------------------------------------------------------------*/ const $e698a72e93240346$var$CHECKBOX_NAME = 'Checkbox';
const [$e698a72e93240346$var$createCheckboxContext, $e698a72e93240346$export$b566c4ff5488ea01] = $1bpvS$createContextScope($e698a72e93240346$var$CHECKBOX_NAME);
const [$e698a72e93240346$var$CheckboxProvider, $e698a72e93240346$var$useCheckboxContext] = $e698a72e93240346$var$createCheckboxContext($e698a72e93240346$var$CHECKBOX_NAME);
const $e698a72e93240346$export$48513f6b9f8ce62d = /*#__PURE__*/ $1bpvS$forwardRef((props, forwardedRef)=>{
const { __scopeCheckbox: __scopeCheckbox , name: name , checked: checkedProp , defaultChecked: defaultChecked , required: required , disabled: disabled , value: value = 'on' , onCheckedChange: onCheckedChange , ...checkboxProps } = props;
const [button, setButton] = $1bpvS$useState(null);
const composedRefs = $1bpvS$useComposedRefs(forwardedRef, (node)=>setButton(node)
);
const hasConsumerStoppedPropagationRef = $1bpvS$useRef(false); // We set this to true by default so that events bubble to forms without JS (SSR)
const isFormControl = button ? Boolean(button.closest('form')) : true;
const [checked = false, setChecked] = $1bpvS$useControllableState({
prop: checkedProp,
defaultProp: defaultChecked,
onChange: onCheckedChange
});
const initialCheckedStateRef = $1bpvS$useRef(checked);
$1bpvS$useEffect(()=>{
const form = button === null || button === void 0 ? void 0 : button.form;
if (form) {
const reset = ()=>setChecked(initialCheckedStateRef.current)
;
form.addEventListener('reset', reset);
return ()=>form.removeEventListener('reset', reset)
;
}
}, [
button,
setChecked
]);
return /*#__PURE__*/ $1bpvS$createElement($e698a72e93240346$var$CheckboxProvider, {
scope: __scopeCheckbox,
state: checked,
disabled: disabled
}, /*#__PURE__*/ $1bpvS$createElement($1bpvS$Primitive.button, $1bpvS$babelruntimehelpersesmextends({
type: "button",
role: "checkbox",
"aria-checked": $e698a72e93240346$var$isIndeterminate(checked) ? 'mixed' : checked,
"aria-required": required,
"data-state": $e698a72e93240346$var$getState(checked),
"data-disabled": disabled ? '' : undefined,
disabled: disabled,
value: value
}, checkboxProps, {
ref: composedRefs,
onKeyDown: $1bpvS$composeEventHandlers(props.onKeyDown, (event)=>{
// According to WAI ARIA, Checkboxes don't activate on enter keypress
if (event.key === 'Enter') event.preventDefault();
}),
onClick: $1bpvS$composeEventHandlers(props.onClick, (event)=>{
setChecked((prevChecked)=>$e698a72e93240346$var$isIndeterminate(prevChecked) ? true : !prevChecked
);
if (isFormControl) {
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(); // if checkbox is in a form, stop propagation from the button so that we only propagate
// one click event (from the input). We propagate changes from an input so that native
// form validation works and form events reflect checkbox updates.
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
}
})
})), isFormControl && /*#__PURE__*/ $1bpvS$createElement($e698a72e93240346$var$BubbleInput, {
control: button,
bubbles: !hasConsumerStoppedPropagationRef.current,
name: name,
value: value,
checked: checked,
required: required,
disabled: disabled // We transform because the input is absolutely positioned but we have
,
style: {
transform: 'translateX(-100%)'
}
}));
});
/*#__PURE__*/ Object.assign($e698a72e93240346$export$48513f6b9f8ce62d, {
displayName: $e698a72e93240346$var$CHECKBOX_NAME
});
/* -------------------------------------------------------------------------------------------------
* CheckboxIndicator
* -----------------------------------------------------------------------------------------------*/ const $e698a72e93240346$var$INDICATOR_NAME = 'CheckboxIndicator';
const $e698a72e93240346$export$59aad738f51d1c05 = /*#__PURE__*/ $1bpvS$forwardRef((props, forwardedRef)=>{
const { __scopeCheckbox: __scopeCheckbox , forceMount: forceMount , ...indicatorProps } = props;
const context = $e698a72e93240346$var$useCheckboxContext($e698a72e93240346$var$INDICATOR_NAME, __scopeCheckbox);
return /*#__PURE__*/ $1bpvS$createElement($1bpvS$Presence, {
present: forceMount || $e698a72e93240346$var$isIndeterminate(context.state) || context.state === true
}, /*#__PURE__*/ $1bpvS$createElement($1bpvS$Primitive.span, $1bpvS$babelruntimehelpersesmextends({
"data-state": $e698a72e93240346$var$getState(context.state),
"data-disabled": context.disabled ? '' : undefined
}, indicatorProps, {
ref: forwardedRef,
style: {
pointerEvents: 'none',
...props.style
}
})));
});
/*#__PURE__*/ Object.assign($e698a72e93240346$export$59aad738f51d1c05, {
displayName: $e698a72e93240346$var$INDICATOR_NAME
});
/* ---------------------------------------------------------------------------------------------- */ const $e698a72e93240346$var$BubbleInput = (props)=>{
const { control: control , checked: checked , bubbles: bubbles = true , ...inputProps } = props;
const ref = $1bpvS$useRef(null);
const prevChecked = $1bpvS$usePrevious(checked);
const controlSize = $1bpvS$useSize(control); // Bubble checked change to parents (e.g form change event)
$1bpvS$useEffect(()=>{
const input = ref.current;
const inputProto = window.HTMLInputElement.prototype;
const descriptor = Object.getOwnPropertyDescriptor(inputProto, 'checked');
const setChecked = descriptor.set;
if (prevChecked !== checked && setChecked) {
const event = new Event('click', {
bubbles: bubbles
});
input.indeterminate = $e698a72e93240346$var$isIndeterminate(checked);
setChecked.call(input, $e698a72e93240346$var$isIndeterminate(checked) ? false : checked);
input.dispatchEvent(event);
}
}, [
prevChecked,
checked,
bubbles
]);
return /*#__PURE__*/ $1bpvS$createElement("input", $1bpvS$babelruntimehelpersesmextends({
type: "checkbox",
"aria-hidden": true,
defaultChecked: $e698a72e93240346$var$isIndeterminate(checked) ? false : checked
}, inputProps, {
tabIndex: -1,
ref: ref,
style: {
...props.style,
...controlSize,
position: 'absolute',
pointerEvents: 'none',
opacity: 0,
margin: 0
}
}));
};
function $e698a72e93240346$var$isIndeterminate(checked) {
return checked === 'indeterminate';
}
function $e698a72e93240346$var$getState(checked) {
return $e698a72e93240346$var$isIndeterminate(checked) ? 'indeterminate' : checked ? 'checked' : 'unchecked';
}
const $e698a72e93240346$export$be92b6f5f03c0fe9 = $e698a72e93240346$export$48513f6b9f8ce62d;
const $e698a72e93240346$export$adb584737d712b70 = $e698a72e93240346$export$59aad738f51d1c05;
export {$e698a72e93240346$export$b566c4ff5488ea01 as createCheckboxScope, $e698a72e93240346$export$48513f6b9f8ce62d as Checkbox, $e698a72e93240346$export$59aad738f51d1c05 as CheckboxIndicator, $e698a72e93240346$export$be92b6f5f03c0fe9 as Root, $e698a72e93240346$export$adb584737d712b70 as Indicator};
//# sourceMappingURL=index.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,63 @@
{
"name": "@radix-ui/react-checkbox",
"version": "1.0.4",
"license": "MIT",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"source": "./src/index.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"README.md"
],
"sideEffects": false,
"scripts": {
"clean": "rm -rf dist",
"version": "yarn version"
},
"dependencies": {
"@babel/runtime": "^7.13.10",
"@radix-ui/primitive": "1.0.1",
"@radix-ui/react-compose-refs": "1.0.1",
"@radix-ui/react-context": "1.0.1",
"@radix-ui/react-presence": "1.0.1",
"@radix-ui/react-primitive": "1.0.3",
"@radix-ui/react-use-controllable-state": "1.0.1",
"@radix-ui/react-use-previous": "1.0.1",
"@radix-ui/react-use-size": "1.0.1"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0",
"react-dom": "^16.8 || ^17.0 || ^18.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
},
"homepage": "https://radix-ui.com/primitives",
"repository": {
"type": "git",
"url": "git+https://github.com/radix-ui/primitives.git"
},
"bugs": {
"url": "https://github.com/radix-ui/primitives/issues"
}
}

View File

@@ -0,0 +1,13 @@
# `react-collapsible`
## Installation
```sh
$ yarn add @radix-ui/react-collapsible
# or
$ npm install @radix-ui/react-collapsible
```
## Usage
View docs [here](https://radix-ui.com/primitives/docs/components/collapsible).

View File

@@ -0,0 +1,32 @@
import * as React from "react";
import * as Radix from "@radix-ui/react-primitive";
import { Primitive } from "@radix-ui/react-primitive";
export const createCollapsibleScope: import("@radix-ui/react-context").CreateScope;
type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
export interface CollapsibleProps extends PrimitiveDivProps {
defaultOpen?: boolean;
open?: boolean;
disabled?: boolean;
onOpenChange?(open: boolean): void;
}
export const Collapsible: React.ForwardRefExoticComponent<CollapsibleProps & React.RefAttributes<HTMLDivElement>>;
type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
export interface CollapsibleTriggerProps extends PrimitiveButtonProps {
}
export const CollapsibleTrigger: React.ForwardRefExoticComponent<CollapsibleTriggerProps & React.RefAttributes<HTMLButtonElement>>;
export interface CollapsibleContentProps extends Omit<CollapsibleContentImplProps, 'present'> {
/**
* Used to force mounting when more control is needed. Useful when
* controlling animation with React animation libraries.
*/
forceMount?: true;
}
export const CollapsibleContent: React.ForwardRefExoticComponent<CollapsibleContentProps & React.RefAttributes<HTMLDivElement>>;
interface CollapsibleContentImplProps extends PrimitiveDivProps {
present: boolean;
}
export const Root: React.ForwardRefExoticComponent<CollapsibleProps & React.RefAttributes<HTMLDivElement>>;
export const Trigger: React.ForwardRefExoticComponent<CollapsibleTriggerProps & React.RefAttributes<HTMLButtonElement>>;
export const Content: React.ForwardRefExoticComponent<CollapsibleContentProps & React.RefAttributes<HTMLDivElement>>;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,32 @@
import * as React from "react";
import * as Radix from "@radix-ui/react-primitive";
import { Primitive } from "@radix-ui/react-primitive";
export const createCollapsibleScope: import("@radix-ui/react-context").CreateScope;
type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
export interface CollapsibleProps extends PrimitiveDivProps {
defaultOpen?: boolean;
open?: boolean;
disabled?: boolean;
onOpenChange?(open: boolean): void;
}
export const Collapsible: React.ForwardRefExoticComponent<CollapsibleProps & React.RefAttributes<HTMLDivElement>>;
type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
export interface CollapsibleTriggerProps extends PrimitiveButtonProps {
}
export const CollapsibleTrigger: React.ForwardRefExoticComponent<CollapsibleTriggerProps & React.RefAttributes<HTMLButtonElement>>;
export interface CollapsibleContentProps extends Omit<CollapsibleContentImplProps, 'present'> {
/**
* Used to force mounting when more control is needed. Useful when
* controlling animation with React animation libraries.
*/
forceMount?: true;
}
export const CollapsibleContent: React.ForwardRefExoticComponent<CollapsibleContentProps & React.RefAttributes<HTMLDivElement>>;
interface CollapsibleContentImplProps extends PrimitiveDivProps {
present: boolean;
}
export const Root: React.ForwardRefExoticComponent<CollapsibleProps & React.RefAttributes<HTMLDivElement>>;
export const Trigger: React.ForwardRefExoticComponent<CollapsibleTriggerProps & React.RefAttributes<HTMLButtonElement>>;
export const Content: React.ForwardRefExoticComponent<CollapsibleContentProps & React.RefAttributes<HTMLDivElement>>;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"mappings":";;;AAoBA,OAAA,6FAA+F,CAAC;AAahG,yBAAyB,MAAM,wBAAwB,CAAC,OAAO,UAAU,GAAG,CAAC,CAAC;AAC9E,iCAA2B,SAAQ,iBAAiB;IAClD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;CACpC;AAED,OAAA,MAAM,oGAkCL,CAAC;AAWF,4BAA4B,MAAM,wBAAwB,CAAC,OAAO,UAAU,MAAM,CAAC,CAAC;AACpF,wCAAkC,SAAQ,oBAAoB;CAAG;AAEjE,OAAA,MAAM,qHAkBL,CAAC;AAWF,wCAAkC,SAAQ,IAAI,CAAC,2BAA2B,EAAE,SAAS,CAAC;IACpF;;;OAGG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC;CACnB;AAED,OAAA,MAAM,kHAYL,CAAC;AAOF,qCAAsC,SAAQ,iBAAiB;IAC7D,OAAO,EAAE,OAAO,CAAC;CAClB;AAmFD,OAAA,MAAM,6FAAkB,CAAC;AACzB,OAAA,MAAM,0GAA4B,CAAC;AACnC,OAAA,MAAM,uGAA4B,CAAC","sources":["packages/react/collapsible/src/packages/react/collapsible/src/Collapsible.tsx","packages/react/collapsible/src/packages/react/collapsible/src/index.ts","packages/react/collapsible/src/index.ts"],"sourcesContent":[null,null,"export {\n createCollapsibleScope,\n //\n Collapsible,\n CollapsibleTrigger,\n CollapsibleContent,\n //\n Root,\n Trigger,\n Content,\n} from './Collapsible';\nexport type {\n CollapsibleProps,\n CollapsibleTriggerProps,\n CollapsibleContentProps,\n} from './Collapsible';\n"],"names":[],"version":3,"file":"index.d.ts.map"}

View File

@@ -0,0 +1,177 @@
var $f0mF1$babelruntimehelpersextends = require("@babel/runtime/helpers/extends");
var $f0mF1$react = require("react");
var $f0mF1$radixuiprimitive = require("@radix-ui/primitive");
var $f0mF1$radixuireactcontext = require("@radix-ui/react-context");
var $f0mF1$radixuireactusecontrollablestate = require("@radix-ui/react-use-controllable-state");
var $f0mF1$radixuireactuselayouteffect = require("@radix-ui/react-use-layout-effect");
var $f0mF1$radixuireactcomposerefs = require("@radix-ui/react-compose-refs");
var $f0mF1$radixuireactprimitive = require("@radix-ui/react-primitive");
var $f0mF1$radixuireactpresence = require("@radix-ui/react-presence");
var $f0mF1$radixuireactid = require("@radix-ui/react-id");
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, "createCollapsibleScope", () => $e729681ae85df948$export$952b32dcbe73087a);
$parcel$export(module.exports, "Collapsible", () => $e729681ae85df948$export$6eb0f7ddcda6131f);
$parcel$export(module.exports, "CollapsibleTrigger", () => $e729681ae85df948$export$c135dce7b15bbbdc);
$parcel$export(module.exports, "CollapsibleContent", () => $e729681ae85df948$export$aadde00976f34151);
$parcel$export(module.exports, "Root", () => $e729681ae85df948$export$be92b6f5f03c0fe9);
$parcel$export(module.exports, "Trigger", () => $e729681ae85df948$export$41fb9f06171c75f4);
$parcel$export(module.exports, "Content", () => $e729681ae85df948$export$7c6e2c02157bb7d2);
/* -------------------------------------------------------------------------------------------------
* Collapsible
* -----------------------------------------------------------------------------------------------*/ const $e729681ae85df948$var$COLLAPSIBLE_NAME = 'Collapsible';
const [$e729681ae85df948$var$createCollapsibleContext, $e729681ae85df948$export$952b32dcbe73087a] = $f0mF1$radixuireactcontext.createContextScope($e729681ae85df948$var$COLLAPSIBLE_NAME);
const [$e729681ae85df948$var$CollapsibleProvider, $e729681ae85df948$var$useCollapsibleContext] = $e729681ae85df948$var$createCollapsibleContext($e729681ae85df948$var$COLLAPSIBLE_NAME);
const $e729681ae85df948$export$6eb0f7ddcda6131f = /*#__PURE__*/ $f0mF1$react.forwardRef((props, forwardedRef)=>{
const { __scopeCollapsible: __scopeCollapsible , open: openProp , defaultOpen: defaultOpen , disabled: disabled , onOpenChange: onOpenChange , ...collapsibleProps } = props;
const [open = false, setOpen] = $f0mF1$radixuireactusecontrollablestate.useControllableState({
prop: openProp,
defaultProp: defaultOpen,
onChange: onOpenChange
});
return /*#__PURE__*/ $f0mF1$react.createElement($e729681ae85df948$var$CollapsibleProvider, {
scope: __scopeCollapsible,
disabled: disabled,
contentId: $f0mF1$radixuireactid.useId(),
open: open,
onOpenToggle: $f0mF1$react.useCallback(()=>setOpen((prevOpen)=>!prevOpen
)
, [
setOpen
])
}, /*#__PURE__*/ $f0mF1$react.createElement($f0mF1$radixuireactprimitive.Primitive.div, ($parcel$interopDefault($f0mF1$babelruntimehelpersextends))({
"data-state": $e729681ae85df948$var$getState(open),
"data-disabled": disabled ? '' : undefined
}, collapsibleProps, {
ref: forwardedRef
})));
});
/*#__PURE__*/ Object.assign($e729681ae85df948$export$6eb0f7ddcda6131f, {
displayName: $e729681ae85df948$var$COLLAPSIBLE_NAME
});
/* -------------------------------------------------------------------------------------------------
* CollapsibleTrigger
* -----------------------------------------------------------------------------------------------*/ const $e729681ae85df948$var$TRIGGER_NAME = 'CollapsibleTrigger';
const $e729681ae85df948$export$c135dce7b15bbbdc = /*#__PURE__*/ $f0mF1$react.forwardRef((props, forwardedRef)=>{
const { __scopeCollapsible: __scopeCollapsible , ...triggerProps } = props;
const context = $e729681ae85df948$var$useCollapsibleContext($e729681ae85df948$var$TRIGGER_NAME, __scopeCollapsible);
return /*#__PURE__*/ $f0mF1$react.createElement($f0mF1$radixuireactprimitive.Primitive.button, ($parcel$interopDefault($f0mF1$babelruntimehelpersextends))({
type: "button",
"aria-controls": context.contentId,
"aria-expanded": context.open || false,
"data-state": $e729681ae85df948$var$getState(context.open),
"data-disabled": context.disabled ? '' : undefined,
disabled: context.disabled
}, triggerProps, {
ref: forwardedRef,
onClick: $f0mF1$radixuiprimitive.composeEventHandlers(props.onClick, context.onOpenToggle)
}));
});
/*#__PURE__*/ Object.assign($e729681ae85df948$export$c135dce7b15bbbdc, {
displayName: $e729681ae85df948$var$TRIGGER_NAME
});
/* -------------------------------------------------------------------------------------------------
* CollapsibleContent
* -----------------------------------------------------------------------------------------------*/ const $e729681ae85df948$var$CONTENT_NAME = 'CollapsibleContent';
const $e729681ae85df948$export$aadde00976f34151 = /*#__PURE__*/ $f0mF1$react.forwardRef((props, forwardedRef)=>{
const { forceMount: forceMount , ...contentProps } = props;
const context = $e729681ae85df948$var$useCollapsibleContext($e729681ae85df948$var$CONTENT_NAME, props.__scopeCollapsible);
return /*#__PURE__*/ $f0mF1$react.createElement($f0mF1$radixuireactpresence.Presence, {
present: forceMount || context.open
}, ({ present: present })=>/*#__PURE__*/ $f0mF1$react.createElement($e729681ae85df948$var$CollapsibleContentImpl, ($parcel$interopDefault($f0mF1$babelruntimehelpersextends))({}, contentProps, {
ref: forwardedRef,
present: present
}))
);
});
/*#__PURE__*/ Object.assign($e729681ae85df948$export$aadde00976f34151, {
displayName: $e729681ae85df948$var$CONTENT_NAME
});
/* -----------------------------------------------------------------------------------------------*/ const $e729681ae85df948$var$CollapsibleContentImpl = /*#__PURE__*/ $f0mF1$react.forwardRef((props, forwardedRef)=>{
const { __scopeCollapsible: __scopeCollapsible , present: present , children: children , ...contentProps } = props;
const context = $e729681ae85df948$var$useCollapsibleContext($e729681ae85df948$var$CONTENT_NAME, __scopeCollapsible);
const [isPresent, setIsPresent] = $f0mF1$react.useState(present);
const ref = $f0mF1$react.useRef(null);
const composedRefs = $f0mF1$radixuireactcomposerefs.useComposedRefs(forwardedRef, ref);
const heightRef = $f0mF1$react.useRef(0);
const height = heightRef.current;
const widthRef = $f0mF1$react.useRef(0);
const width = widthRef.current; // when opening we want it to immediately open to retrieve dimensions
// when closing we delay `present` to retrieve dimensions before closing
const isOpen = context.open || isPresent;
const isMountAnimationPreventedRef = $f0mF1$react.useRef(isOpen);
const originalStylesRef = $f0mF1$react.useRef();
$f0mF1$react.useEffect(()=>{
const rAF = requestAnimationFrame(()=>isMountAnimationPreventedRef.current = false
);
return ()=>cancelAnimationFrame(rAF)
;
}, []);
$f0mF1$radixuireactuselayouteffect.useLayoutEffect(()=>{
const node = ref.current;
if (node) {
originalStylesRef.current = originalStylesRef.current || {
transitionDuration: node.style.transitionDuration,
animationName: node.style.animationName
}; // block any animations/transitions so the element renders at its full dimensions
node.style.transitionDuration = '0s';
node.style.animationName = 'none'; // get width and height from full dimensions
const rect = node.getBoundingClientRect();
heightRef.current = rect.height;
widthRef.current = rect.width; // kick off any animations/transitions that were originally set up if it isn't the initial mount
if (!isMountAnimationPreventedRef.current) {
node.style.transitionDuration = originalStylesRef.current.transitionDuration;
node.style.animationName = originalStylesRef.current.animationName;
}
setIsPresent(present);
}
/**
* depends on `context.open` because it will change to `false`
* when a close is triggered but `present` will be `false` on
* animation end (so when close finishes). This allows us to
* retrieve the dimensions *before* closing.
*/ }, [
context.open,
present
]);
return /*#__PURE__*/ $f0mF1$react.createElement($f0mF1$radixuireactprimitive.Primitive.div, ($parcel$interopDefault($f0mF1$babelruntimehelpersextends))({
"data-state": $e729681ae85df948$var$getState(context.open),
"data-disabled": context.disabled ? '' : undefined,
id: context.contentId,
hidden: !isOpen
}, contentProps, {
ref: composedRefs,
style: {
[`--radix-collapsible-content-height`]: height ? `${height}px` : undefined,
[`--radix-collapsible-content-width`]: width ? `${width}px` : undefined,
...props.style
}
}), isOpen && children);
});
/* -----------------------------------------------------------------------------------------------*/ function $e729681ae85df948$var$getState(open) {
return open ? 'open' : 'closed';
}
const $e729681ae85df948$export$be92b6f5f03c0fe9 = $e729681ae85df948$export$6eb0f7ddcda6131f;
const $e729681ae85df948$export$41fb9f06171c75f4 = $e729681ae85df948$export$c135dce7b15bbbdc;
const $e729681ae85df948$export$7c6e2c02157bb7d2 = $e729681ae85df948$export$aadde00976f34151;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,164 @@
import $73KQ4$babelruntimehelpersesmextends from "@babel/runtime/helpers/esm/extends";
import {forwardRef as $73KQ4$forwardRef, createElement as $73KQ4$createElement, useCallback as $73KQ4$useCallback, useState as $73KQ4$useState, useRef as $73KQ4$useRef, useEffect as $73KQ4$useEffect} from "react";
import {composeEventHandlers as $73KQ4$composeEventHandlers} from "@radix-ui/primitive";
import {createContextScope as $73KQ4$createContextScope} from "@radix-ui/react-context";
import {useControllableState as $73KQ4$useControllableState} from "@radix-ui/react-use-controllable-state";
import {useLayoutEffect as $73KQ4$useLayoutEffect} from "@radix-ui/react-use-layout-effect";
import {useComposedRefs as $73KQ4$useComposedRefs} from "@radix-ui/react-compose-refs";
import {Primitive as $73KQ4$Primitive} from "@radix-ui/react-primitive";
import {Presence as $73KQ4$Presence} from "@radix-ui/react-presence";
import {useId as $73KQ4$useId} from "@radix-ui/react-id";
/* -------------------------------------------------------------------------------------------------
* Collapsible
* -----------------------------------------------------------------------------------------------*/ const $409067139f391064$var$COLLAPSIBLE_NAME = 'Collapsible';
const [$409067139f391064$var$createCollapsibleContext, $409067139f391064$export$952b32dcbe73087a] = $73KQ4$createContextScope($409067139f391064$var$COLLAPSIBLE_NAME);
const [$409067139f391064$var$CollapsibleProvider, $409067139f391064$var$useCollapsibleContext] = $409067139f391064$var$createCollapsibleContext($409067139f391064$var$COLLAPSIBLE_NAME);
const $409067139f391064$export$6eb0f7ddcda6131f = /*#__PURE__*/ $73KQ4$forwardRef((props, forwardedRef)=>{
const { __scopeCollapsible: __scopeCollapsible , open: openProp , defaultOpen: defaultOpen , disabled: disabled , onOpenChange: onOpenChange , ...collapsibleProps } = props;
const [open = false, setOpen] = $73KQ4$useControllableState({
prop: openProp,
defaultProp: defaultOpen,
onChange: onOpenChange
});
return /*#__PURE__*/ $73KQ4$createElement($409067139f391064$var$CollapsibleProvider, {
scope: __scopeCollapsible,
disabled: disabled,
contentId: $73KQ4$useId(),
open: open,
onOpenToggle: $73KQ4$useCallback(()=>setOpen((prevOpen)=>!prevOpen
)
, [
setOpen
])
}, /*#__PURE__*/ $73KQ4$createElement($73KQ4$Primitive.div, $73KQ4$babelruntimehelpersesmextends({
"data-state": $409067139f391064$var$getState(open),
"data-disabled": disabled ? '' : undefined
}, collapsibleProps, {
ref: forwardedRef
})));
});
/*#__PURE__*/ Object.assign($409067139f391064$export$6eb0f7ddcda6131f, {
displayName: $409067139f391064$var$COLLAPSIBLE_NAME
});
/* -------------------------------------------------------------------------------------------------
* CollapsibleTrigger
* -----------------------------------------------------------------------------------------------*/ const $409067139f391064$var$TRIGGER_NAME = 'CollapsibleTrigger';
const $409067139f391064$export$c135dce7b15bbbdc = /*#__PURE__*/ $73KQ4$forwardRef((props, forwardedRef)=>{
const { __scopeCollapsible: __scopeCollapsible , ...triggerProps } = props;
const context = $409067139f391064$var$useCollapsibleContext($409067139f391064$var$TRIGGER_NAME, __scopeCollapsible);
return /*#__PURE__*/ $73KQ4$createElement($73KQ4$Primitive.button, $73KQ4$babelruntimehelpersesmextends({
type: "button",
"aria-controls": context.contentId,
"aria-expanded": context.open || false,
"data-state": $409067139f391064$var$getState(context.open),
"data-disabled": context.disabled ? '' : undefined,
disabled: context.disabled
}, triggerProps, {
ref: forwardedRef,
onClick: $73KQ4$composeEventHandlers(props.onClick, context.onOpenToggle)
}));
});
/*#__PURE__*/ Object.assign($409067139f391064$export$c135dce7b15bbbdc, {
displayName: $409067139f391064$var$TRIGGER_NAME
});
/* -------------------------------------------------------------------------------------------------
* CollapsibleContent
* -----------------------------------------------------------------------------------------------*/ const $409067139f391064$var$CONTENT_NAME = 'CollapsibleContent';
const $409067139f391064$export$aadde00976f34151 = /*#__PURE__*/ $73KQ4$forwardRef((props, forwardedRef)=>{
const { forceMount: forceMount , ...contentProps } = props;
const context = $409067139f391064$var$useCollapsibleContext($409067139f391064$var$CONTENT_NAME, props.__scopeCollapsible);
return /*#__PURE__*/ $73KQ4$createElement($73KQ4$Presence, {
present: forceMount || context.open
}, ({ present: present })=>/*#__PURE__*/ $73KQ4$createElement($409067139f391064$var$CollapsibleContentImpl, $73KQ4$babelruntimehelpersesmextends({}, contentProps, {
ref: forwardedRef,
present: present
}))
);
});
/*#__PURE__*/ Object.assign($409067139f391064$export$aadde00976f34151, {
displayName: $409067139f391064$var$CONTENT_NAME
});
/* -----------------------------------------------------------------------------------------------*/ const $409067139f391064$var$CollapsibleContentImpl = /*#__PURE__*/ $73KQ4$forwardRef((props, forwardedRef)=>{
const { __scopeCollapsible: __scopeCollapsible , present: present , children: children , ...contentProps } = props;
const context = $409067139f391064$var$useCollapsibleContext($409067139f391064$var$CONTENT_NAME, __scopeCollapsible);
const [isPresent, setIsPresent] = $73KQ4$useState(present);
const ref = $73KQ4$useRef(null);
const composedRefs = $73KQ4$useComposedRefs(forwardedRef, ref);
const heightRef = $73KQ4$useRef(0);
const height = heightRef.current;
const widthRef = $73KQ4$useRef(0);
const width = widthRef.current; // when opening we want it to immediately open to retrieve dimensions
// when closing we delay `present` to retrieve dimensions before closing
const isOpen = context.open || isPresent;
const isMountAnimationPreventedRef = $73KQ4$useRef(isOpen);
const originalStylesRef = $73KQ4$useRef();
$73KQ4$useEffect(()=>{
const rAF = requestAnimationFrame(()=>isMountAnimationPreventedRef.current = false
);
return ()=>cancelAnimationFrame(rAF)
;
}, []);
$73KQ4$useLayoutEffect(()=>{
const node = ref.current;
if (node) {
originalStylesRef.current = originalStylesRef.current || {
transitionDuration: node.style.transitionDuration,
animationName: node.style.animationName
}; // block any animations/transitions so the element renders at its full dimensions
node.style.transitionDuration = '0s';
node.style.animationName = 'none'; // get width and height from full dimensions
const rect = node.getBoundingClientRect();
heightRef.current = rect.height;
widthRef.current = rect.width; // kick off any animations/transitions that were originally set up if it isn't the initial mount
if (!isMountAnimationPreventedRef.current) {
node.style.transitionDuration = originalStylesRef.current.transitionDuration;
node.style.animationName = originalStylesRef.current.animationName;
}
setIsPresent(present);
}
/**
* depends on `context.open` because it will change to `false`
* when a close is triggered but `present` will be `false` on
* animation end (so when close finishes). This allows us to
* retrieve the dimensions *before* closing.
*/ }, [
context.open,
present
]);
return /*#__PURE__*/ $73KQ4$createElement($73KQ4$Primitive.div, $73KQ4$babelruntimehelpersesmextends({
"data-state": $409067139f391064$var$getState(context.open),
"data-disabled": context.disabled ? '' : undefined,
id: context.contentId,
hidden: !isOpen
}, contentProps, {
ref: composedRefs,
style: {
[`--radix-collapsible-content-height`]: height ? `${height}px` : undefined,
[`--radix-collapsible-content-width`]: width ? `${width}px` : undefined,
...props.style
}
}), isOpen && children);
});
/* -----------------------------------------------------------------------------------------------*/ function $409067139f391064$var$getState(open) {
return open ? 'open' : 'closed';
}
const $409067139f391064$export$be92b6f5f03c0fe9 = $409067139f391064$export$6eb0f7ddcda6131f;
const $409067139f391064$export$41fb9f06171c75f4 = $409067139f391064$export$c135dce7b15bbbdc;
const $409067139f391064$export$7c6e2c02157bb7d2 = $409067139f391064$export$aadde00976f34151;
export {$409067139f391064$export$952b32dcbe73087a as createCollapsibleScope, $409067139f391064$export$6eb0f7ddcda6131f as Collapsible, $409067139f391064$export$c135dce7b15bbbdc as CollapsibleTrigger, $409067139f391064$export$aadde00976f34151 as CollapsibleContent, $409067139f391064$export$be92b6f5f03c0fe9 as Root, $409067139f391064$export$41fb9f06171c75f4 as Trigger, $409067139f391064$export$7c6e2c02157bb7d2 as Content};
//# sourceMappingURL=index.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,63 @@
{
"name": "@radix-ui/react-collapsible",
"version": "1.0.3",
"license": "MIT",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"source": "./src/index.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"README.md"
],
"sideEffects": false,
"scripts": {
"clean": "rm -rf dist",
"version": "yarn version"
},
"dependencies": {
"@babel/runtime": "^7.13.10",
"@radix-ui/primitive": "1.0.1",
"@radix-ui/react-compose-refs": "1.0.1",
"@radix-ui/react-context": "1.0.1",
"@radix-ui/react-id": "1.0.1",
"@radix-ui/react-presence": "1.0.1",
"@radix-ui/react-primitive": "1.0.3",
"@radix-ui/react-use-controllable-state": "1.0.1",
"@radix-ui/react-use-layout-effect": "1.0.1"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0",
"react-dom": "^16.8 || ^17.0 || ^18.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
},
"homepage": "https://radix-ui.com/primitives",
"repository": {
"type": "git",
"url": "git+https://github.com/radix-ui/primitives.git"
},
"bugs": {
"url": "https://github.com/radix-ui/primitives/issues"
}
}

View File

@@ -0,0 +1,13 @@
# `react-collection`
## Installation
```sh
$ yarn add @radix-ui/react-collection
# or
$ npm install @radix-ui/react-collection
```
## Usage
This is an internal utility, not intended for public usage.

View File

@@ -0,0 +1,22 @@
import React from "react";
import { Slot } from "@radix-ui/react-slot";
import * as Radix from "@radix-ui/react-primitive";
type SlotProps = Radix.ComponentPropsWithoutRef<typeof Slot>;
export interface CollectionProps extends SlotProps {
scope: any;
}
export function createCollection<ItemElement extends HTMLElement, ItemData = {}>(name: string): readonly [{
readonly Provider: React.FC<{
children?: React.ReactNode;
scope: any;
}>;
readonly Slot: React.ForwardRefExoticComponent<CollectionProps & React.RefAttributes<HTMLElement>>;
readonly ItemSlot: React.ForwardRefExoticComponent<React.PropsWithoutRef<ItemData & {
children: React.ReactNode;
scope: any;
}> & React.RefAttributes<ItemElement>>;
}, (scope: any) => () => ({
ref: React.RefObject<ItemElement>;
} & ItemData)[], import("@radix-ui/react-context").CreateScope];
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,22 @@
import React from "react";
import { Slot } from "@radix-ui/react-slot";
import * as Radix from "@radix-ui/react-primitive";
type SlotProps = Radix.ComponentPropsWithoutRef<typeof Slot>;
export interface CollectionProps extends SlotProps {
scope: any;
}
export function createCollection<ItemElement extends HTMLElement, ItemData = {}>(name: string): readonly [{
readonly Provider: React.FC<{
children?: React.ReactNode;
scope: any;
}>;
readonly Slot: React.ForwardRefExoticComponent<CollectionProps & React.RefAttributes<HTMLElement>>;
readonly ItemSlot: React.ForwardRefExoticComponent<React.PropsWithoutRef<ItemData & {
children: React.ReactNode;
scope: any;
}> & React.RefAttributes<ItemElement>>;
}, (scope: any) => () => ({
ref: React.RefObject<ItemElement>;
} & ItemData)[], import("@radix-ui/react-context").CreateScope];
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"mappings":";;;AAOA,iBAAiB,MAAM,wBAAwB,CAAC,WAAW,CAAC,CAAC;AAE7D,gCAA0B,SAAQ,SAAS;IACzC,KAAK,EAAE,GAAG,CAAC;CACZ;AAOD,iCAA0B,WAAW,SAAS,WAAW,EAAE,QAAQ,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM;;mBAkBpC,MAAM,SAAS;eAAS,GAAG;;;;kBAsC/D,MAAM,SAAS;eAClB,GAAG;;WA6BkB,GAAG;SA5EmB,MAAM,SAAS,CAAC,WAAW,CAAC;kFAkGjF","sources":["packages/react/collection/src/packages/react/collection/src/Collection.tsx","packages/react/collection/src/packages/react/collection/src/index.ts","packages/react/collection/src/index.ts"],"sourcesContent":[null,null,"export { createCollection } from './Collection';\nexport type { CollectionProps } from './Collection';\n"],"names":[],"version":3,"file":"index.d.ts.map"}

View File

@@ -0,0 +1,117 @@
var $hnlpS$react = require("react");
var $hnlpS$radixuireactcontext = require("@radix-ui/react-context");
var $hnlpS$radixuireactcomposerefs = require("@radix-ui/react-compose-refs");
var $hnlpS$radixuireactslot = require("@radix-ui/react-slot");
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, "createCollection", () => $1a96635ec239608b$export$c74125a8e3af6bb2);
// We have resorted to returning slots directly rather than exposing primitives that can then
// be slotted like `<CollectionItem as={Slot}>…</CollectionItem>`.
// This is because we encountered issues with generic types that cannot be statically analysed
// due to creating them dynamically via createCollection.
function $1a96635ec239608b$export$c74125a8e3af6bb2(name) {
/* -----------------------------------------------------------------------------------------------
* CollectionProvider
* ---------------------------------------------------------------------------------------------*/ const PROVIDER_NAME = name + 'CollectionProvider';
const [createCollectionContext, createCollectionScope] = $hnlpS$radixuireactcontext.createContextScope(PROVIDER_NAME);
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, {
collectionRef: {
current: null
},
itemMap: new Map()
});
const CollectionProvider = (props)=>{
const { scope: scope , children: children } = props;
const ref = ($parcel$interopDefault($hnlpS$react)).useRef(null);
const itemMap = ($parcel$interopDefault($hnlpS$react)).useRef(new Map()).current;
return /*#__PURE__*/ ($parcel$interopDefault($hnlpS$react)).createElement(CollectionProviderImpl, {
scope: scope,
itemMap: itemMap,
collectionRef: ref
}, children);
};
/*#__PURE__*/ Object.assign(CollectionProvider, {
displayName: PROVIDER_NAME
});
/* -----------------------------------------------------------------------------------------------
* CollectionSlot
* ---------------------------------------------------------------------------------------------*/ const COLLECTION_SLOT_NAME = name + 'CollectionSlot';
const CollectionSlot = /*#__PURE__*/ ($parcel$interopDefault($hnlpS$react)).forwardRef((props, forwardedRef)=>{
const { scope: scope , children: children } = props;
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
const composedRefs = $hnlpS$radixuireactcomposerefs.useComposedRefs(forwardedRef, context.collectionRef);
return /*#__PURE__*/ ($parcel$interopDefault($hnlpS$react)).createElement($hnlpS$radixuireactslot.Slot, {
ref: composedRefs
}, children);
});
/*#__PURE__*/ Object.assign(CollectionSlot, {
displayName: COLLECTION_SLOT_NAME
});
/* -----------------------------------------------------------------------------------------------
* CollectionItem
* ---------------------------------------------------------------------------------------------*/ const ITEM_SLOT_NAME = name + 'CollectionItemSlot';
const ITEM_DATA_ATTR = 'data-radix-collection-item';
const CollectionItemSlot = /*#__PURE__*/ ($parcel$interopDefault($hnlpS$react)).forwardRef((props, forwardedRef)=>{
const { scope: scope , children: children , ...itemData } = props;
const ref = ($parcel$interopDefault($hnlpS$react)).useRef(null);
const composedRefs = $hnlpS$radixuireactcomposerefs.useComposedRefs(forwardedRef, ref);
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
($parcel$interopDefault($hnlpS$react)).useEffect(()=>{
context.itemMap.set(ref, {
ref: ref,
...itemData
});
return ()=>void context.itemMap.delete(ref)
;
});
return /*#__PURE__*/ ($parcel$interopDefault($hnlpS$react)).createElement($hnlpS$radixuireactslot.Slot, {
[ITEM_DATA_ATTR]: '',
ref: composedRefs
}, children);
});
/*#__PURE__*/ Object.assign(CollectionItemSlot, {
displayName: ITEM_SLOT_NAME
});
/* -----------------------------------------------------------------------------------------------
* useCollection
* ---------------------------------------------------------------------------------------------*/ function useCollection(scope) {
const context = useCollectionContext(name + 'CollectionConsumer', scope);
const getItems = ($parcel$interopDefault($hnlpS$react)).useCallback(()=>{
const collectionNode = context.collectionRef.current;
if (!collectionNode) return [];
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
const items = Array.from(context.itemMap.values());
const orderedItems = items.sort((a, b)=>orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
);
return orderedItems;
}, [
context.collectionRef,
context.itemMap
]);
return getItems;
}
return [
{
Provider: CollectionProvider,
Slot: CollectionSlot,
ItemSlot: CollectionItemSlot
},
useCollection,
createCollectionScope
];
}
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,110 @@
import $6vYhU$react from "react";
import {createContextScope as $6vYhU$createContextScope} from "@radix-ui/react-context";
import {useComposedRefs as $6vYhU$useComposedRefs} from "@radix-ui/react-compose-refs";
import {Slot as $6vYhU$Slot} from "@radix-ui/react-slot";
// We have resorted to returning slots directly rather than exposing primitives that can then
// be slotted like `<CollectionItem as={Slot}>…</CollectionItem>`.
// This is because we encountered issues with generic types that cannot be statically analysed
// due to creating them dynamically via createCollection.
function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
/* -----------------------------------------------------------------------------------------------
* CollectionProvider
* ---------------------------------------------------------------------------------------------*/ const PROVIDER_NAME = name + 'CollectionProvider';
const [createCollectionContext, createCollectionScope] = $6vYhU$createContextScope(PROVIDER_NAME);
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, {
collectionRef: {
current: null
},
itemMap: new Map()
});
const CollectionProvider = (props)=>{
const { scope: scope , children: children } = props;
const ref = $6vYhU$react.useRef(null);
const itemMap = $6vYhU$react.useRef(new Map()).current;
return /*#__PURE__*/ $6vYhU$react.createElement(CollectionProviderImpl, {
scope: scope,
itemMap: itemMap,
collectionRef: ref
}, children);
};
/*#__PURE__*/ Object.assign(CollectionProvider, {
displayName: PROVIDER_NAME
});
/* -----------------------------------------------------------------------------------------------
* CollectionSlot
* ---------------------------------------------------------------------------------------------*/ const COLLECTION_SLOT_NAME = name + 'CollectionSlot';
const CollectionSlot = /*#__PURE__*/ $6vYhU$react.forwardRef((props, forwardedRef)=>{
const { scope: scope , children: children } = props;
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
const composedRefs = $6vYhU$useComposedRefs(forwardedRef, context.collectionRef);
return /*#__PURE__*/ $6vYhU$react.createElement($6vYhU$Slot, {
ref: composedRefs
}, children);
});
/*#__PURE__*/ Object.assign(CollectionSlot, {
displayName: COLLECTION_SLOT_NAME
});
/* -----------------------------------------------------------------------------------------------
* CollectionItem
* ---------------------------------------------------------------------------------------------*/ const ITEM_SLOT_NAME = name + 'CollectionItemSlot';
const ITEM_DATA_ATTR = 'data-radix-collection-item';
const CollectionItemSlot = /*#__PURE__*/ $6vYhU$react.forwardRef((props, forwardedRef)=>{
const { scope: scope , children: children , ...itemData } = props;
const ref = $6vYhU$react.useRef(null);
const composedRefs = $6vYhU$useComposedRefs(forwardedRef, ref);
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
$6vYhU$react.useEffect(()=>{
context.itemMap.set(ref, {
ref: ref,
...itemData
});
return ()=>void context.itemMap.delete(ref)
;
});
return /*#__PURE__*/ $6vYhU$react.createElement($6vYhU$Slot, {
[ITEM_DATA_ATTR]: '',
ref: composedRefs
}, children);
});
/*#__PURE__*/ Object.assign(CollectionItemSlot, {
displayName: ITEM_SLOT_NAME
});
/* -----------------------------------------------------------------------------------------------
* useCollection
* ---------------------------------------------------------------------------------------------*/ function useCollection(scope) {
const context = useCollectionContext(name + 'CollectionConsumer', scope);
const getItems = $6vYhU$react.useCallback(()=>{
const collectionNode = context.collectionRef.current;
if (!collectionNode) return [];
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
const items = Array.from(context.itemMap.values());
const orderedItems = items.sort((a, b)=>orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
);
return orderedItems;
}, [
context.collectionRef,
context.itemMap
]);
return getItems;
}
return [
{
Provider: CollectionProvider,
Slot: CollectionSlot,
ItemSlot: CollectionItemSlot
},
useCollection,
createCollectionScope
];
}
export {$e02a7d9cb1dc128c$export$c74125a8e3af6bb2 as createCollection};
//# sourceMappingURL=index.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,59 @@
{
"name": "@radix-ui/react-collection",
"version": "1.0.3",
"license": "MIT",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"source": "./src/index.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"README.md"
],
"sideEffects": false,
"scripts": {
"clean": "rm -rf dist",
"version": "yarn version"
},
"dependencies": {
"@babel/runtime": "^7.13.10",
"@radix-ui/react-compose-refs": "1.0.1",
"@radix-ui/react-context": "1.0.1",
"@radix-ui/react-primitive": "1.0.3",
"@radix-ui/react-slot": "1.0.2"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0",
"react-dom": "^16.8 || ^17.0 || ^18.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
},
"homepage": "https://radix-ui.com/primitives",
"repository": {
"type": "git",
"url": "git+https://github.com/radix-ui/primitives.git"
},
"bugs": {
"url": "https://github.com/radix-ui/primitives/issues"
}
}

View File

@@ -0,0 +1,13 @@
# `react-compose-refs`
## Installation
```sh
$ yarn add @radix-ui/react-compose-refs
# or
$ npm install @radix-ui/react-compose-refs
```
## Usage
This is an internal utility, not intended for public usage.

View File

@@ -0,0 +1,14 @@
import * as React from "react";
type PossibleRef<T> = React.Ref<T> | undefined;
/**
* A utility to compose multiple refs together
* Accepts callback refs and RefObject(s)
*/
export function composeRefs<T>(...refs: PossibleRef<T>[]): (node: T) => void;
/**
* A custom hook that composes multiple refs
* Accepts callback refs and RefObject(s)
*/
export function useComposedRefs<T>(...refs: PossibleRef<T>[]): (node: T) => void;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,14 @@
import * as React from "react";
type PossibleRef<T> = React.Ref<T> | undefined;
/**
* A utility to compose multiple refs together
* Accepts callback refs and RefObject(s)
*/
export function composeRefs<T>(...refs: PossibleRef<T>[]): (node: T) => void;
/**
* A custom hook that composes multiple refs
* Accepts callback refs and RefObject(s)
*/
export function useComposedRefs<T>(...refs: PossibleRef<T>[]): (node: T) => void;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"mappings":";AAEA,iBAAiB,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;AAc/C;;;GAGG;AACH,4BAAqB,CAAC,EAAE,GAAG,IAAI,EAAE,YAAY,CAAC,CAAC,EAAE,UACjC,CAAC,UAChB;AAED;;;GAGG;AACH,gCAAyB,CAAC,EAAE,GAAG,IAAI,EAAE,YAAY,CAAC,CAAC,EAAE,qBAGpD","sources":["packages/react/compose-refs/src/packages/react/compose-refs/src/composeRefs.tsx","packages/react/compose-refs/src/packages/react/compose-refs/src/index.ts","packages/react/compose-refs/src/index.ts"],"sourcesContent":[null,null,"export { composeRefs, useComposedRefs } from './composeRefs';\n"],"names":[],"version":3,"file":"index.d.ts.map"}

View File

@@ -0,0 +1,36 @@
var $dJwbH$react = require("react");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "composeRefs", () => $9c2aaba23466b352$export$43e446d32b3d21af);
$parcel$export(module.exports, "useComposedRefs", () => $9c2aaba23466b352$export$c7b2cbe3552a0d05);
/**
* Set a given ref to a given value
* This utility takes care of different types of refs: callback refs and RefObject(s)
*/ function $9c2aaba23466b352$var$setRef(ref, value) {
if (typeof ref === 'function') ref(value);
else if (ref !== null && ref !== undefined) ref.current = value;
}
/**
* A utility to compose multiple refs together
* Accepts callback refs and RefObject(s)
*/ function $9c2aaba23466b352$export$43e446d32b3d21af(...refs) {
return (node)=>refs.forEach((ref)=>$9c2aaba23466b352$var$setRef(ref, node)
)
;
}
/**
* A custom hook that composes multiple refs
* Accepts callback refs and RefObject(s)
*/ function $9c2aaba23466b352$export$c7b2cbe3552a0d05(...refs) {
// eslint-disable-next-line react-hooks/exhaustive-deps
return $dJwbH$react.useCallback($9c2aaba23466b352$export$43e446d32b3d21af(...refs), refs);
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"mappings":";;;;;;;;ACAA;AAIA;;;GAGA,CACA,SAASG,4BAAT,CAAmBC,GAAnB,EAAwCC,KAAxC,EAAkD;IAChD,IAAI,OAAOD,GAAP,KAAe,UAAnB,EACEA,GAAG,CAACC,KAAD,CAAH,CAAAD;SACK,IAAIA,GAAG,KAAK,IAAR,IAAgBA,GAAG,KAAKE,SAA5B,EACJF,GAAD,CAAmCG,OAAnC,GAA6CF,KAA7C,CAACD;CAEJ;AAED;;;GAGA,CACA,SAASJ,yCAAT,CAAwB,GAAGQ,IAA3B,EAAmD;IACjD,OAAQC,CAAAA,IAAD,GAAaD,IAAI,CAACE,OAAL,CAAcN,CAAAA,GAAD,GAASD,4BAAM,CAACC,GAAD,EAAMK,IAAN,CAA5B;QAAA,CAApB;IAAA,CAAA;CACD;AAED;;;GAGA,CACA,SAASR,yCAAT,CAA4B,GAAGO,IAA/B,EAAuD;IACrD,uDAAA;IACA,OAAON,wBAAA,CAAkBF,yCAAW,IAAIQ,IAAJ,CAA7B,EAAwCA,IAAxC,CAAP,CAAA;CACD;;AD/BD","sources":["packages/react/compose-refs/src/index.ts","packages/react/compose-refs/src/composeRefs.tsx"],"sourcesContent":["export { composeRefs, useComposedRefs } from './composeRefs';\n","import * as React from 'react';\n\ntype PossibleRef<T> = React.Ref<T> | undefined;\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref !== null && ref !== undefined) {\n (ref as React.MutableRefObject<T>).current = value;\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs<T>(...refs: PossibleRef<T>[]) {\n return (node: T) => refs.forEach((ref) => setRef(ref, node));\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs<T>(...refs: PossibleRef<T>[]) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { composeRefs, useComposedRefs };\n"],"names":["composeRefs","useComposedRefs","React","setRef","ref","value","undefined","current","refs","node","forEach","useCallback"],"version":3,"file":"index.js.map"}

View File

@@ -0,0 +1,31 @@
import {useCallback as $3vqmr$useCallback} from "react";
/**
* Set a given ref to a given value
* This utility takes care of different types of refs: callback refs and RefObject(s)
*/ function $6ed0406888f73fc4$var$setRef(ref, value) {
if (typeof ref === 'function') ref(value);
else if (ref !== null && ref !== undefined) ref.current = value;
}
/**
* A utility to compose multiple refs together
* Accepts callback refs and RefObject(s)
*/ function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) {
return (node)=>refs.forEach((ref)=>$6ed0406888f73fc4$var$setRef(ref, node)
)
;
}
/**
* A custom hook that composes multiple refs
* Accepts callback refs and RefObject(s)
*/ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {
// eslint-disable-next-line react-hooks/exhaustive-deps
return $3vqmr$useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);
}
export {$6ed0406888f73fc4$export$43e446d32b3d21af as composeRefs, $6ed0406888f73fc4$export$c7b2cbe3552a0d05 as useComposedRefs};
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"mappings":";;ACAA;AAIA;;;GAGA,CACA,SAASG,4BAAT,CAAmBC,GAAnB,EAAwCC,KAAxC,EAAkD;IAChD,IAAI,OAAOD,GAAP,KAAe,UAAnB,EACEA,GAAG,CAACC,KAAD,CAAH,CAAAD;SACK,IAAIA,GAAG,KAAK,IAAR,IAAgBA,GAAG,KAAKE,SAA5B,EACJF,GAAD,CAAmCG,OAAnC,GAA6CF,KAA7C,CAACD;CAEJ;AAED;;;GAGA,CACA,SAASJ,yCAAT,CAAwB,GAAGQ,IAA3B,EAAmD;IACjD,OAAQC,CAAAA,IAAD,GAAaD,IAAI,CAACE,OAAL,CAAcN,CAAAA,GAAD,GAASD,4BAAM,CAACC,GAAD,EAAMK,IAAN,CAA5B;QAAA,CAApB;IAAA,CAAA;CACD;AAED;;;GAGA,CACA,SAASR,yCAAT,CAA4B,GAAGO,IAA/B,EAAuD;IACrD,uDAAA;IACA,OAAON,kBAAA,CAAkBF,yCAAW,IAAIQ,IAAJ,CAA7B,EAAwCA,IAAxC,CAAP,CAAA;CACD;;AD/BD","sources":["packages/react/compose-refs/src/index.ts","packages/react/compose-refs/src/composeRefs.tsx"],"sourcesContent":["export { composeRefs, useComposedRefs } from './composeRefs';\n","import * as React from 'react';\n\ntype PossibleRef<T> = React.Ref<T> | undefined;\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref !== null && ref !== undefined) {\n (ref as React.MutableRefObject<T>).current = value;\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs<T>(...refs: PossibleRef<T>[]) {\n return (node: T) => refs.forEach((ref) => setRef(ref, node));\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs<T>(...refs: PossibleRef<T>[]) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { composeRefs, useComposedRefs };\n"],"names":["composeRefs","useComposedRefs","React","setRef","ref","value","undefined","current","refs","node","forEach","useCallback"],"version":3,"file":"index.mjs.map"}

View File

@@ -0,0 +1,50 @@
{
"name": "@radix-ui/react-compose-refs",
"version": "1.0.1",
"license": "MIT",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"source": "./src/index.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"README.md"
],
"sideEffects": false,
"scripts": {
"clean": "rm -rf dist",
"version": "yarn version"
},
"peerDependencies": {
"@types/react": "*",
"react": "^16.8 || ^17.0 || ^18.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
},
"homepage": "https://radix-ui.com/primitives",
"repository": {
"type": "git",
"url": "git+https://github.com/radix-ui/primitives.git"
},
"bugs": {
"url": "https://github.com/radix-ui/primitives/issues"
},
"dependencies": {
"@babel/runtime": "^7.13.10"
}
}

13
server/node_modules/@radix-ui/react-context/README.md generated vendored Normal file
View File

@@ -0,0 +1,13 @@
# `react-context`
## Installation
```sh
$ yarn add @radix-ui/react-context
# or
$ npm install @radix-ui/react-context
```
## Usage
This is an internal utility, not intended for public usage.

View File

@@ -0,0 +1,26 @@
import * as React from "react";
export function createContext<ContextValueType extends object | null>(rootComponentName: string, defaultContext?: ContextValueType): readonly [{
(props: ContextValueType & {
children: React.ReactNode;
}): JSX.Element;
displayName: string;
}, (consumerName: string) => ContextValueType];
export type Scope<C = any> = {
[scopeName: string]: React.Context<C>[];
} | undefined;
type ScopeHook = (scope: Scope) => {
[__scopeProp: string]: Scope;
};
export interface CreateScope {
scopeName: string;
(): ScopeHook;
}
export function createContextScope(scopeName: string, createContextScopeDeps?: CreateScope[]): readonly [<ContextValueType extends object | null>(rootComponentName: string, defaultContext?: ContextValueType | undefined) => readonly [{
(props: ContextValueType & {
scope: Scope<ContextValueType>;
children: React.ReactNode;
}): JSX.Element;
displayName: string;
}, (consumerName: string, scope: Scope<ContextValueType | undefined>) => ContextValueType], CreateScope];
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,26 @@
import * as React from "react";
export function createContext<ContextValueType extends object | null>(rootComponentName: string, defaultContext?: ContextValueType): readonly [{
(props: ContextValueType & {
children: React.ReactNode;
}): JSX.Element;
displayName: string;
}, (consumerName: string) => ContextValueType];
export type Scope<C = any> = {
[scopeName: string]: React.Context<C>[];
} | undefined;
type ScopeHook = (scope: Scope) => {
[__scopeProp: string]: Scope;
};
export interface CreateScope {
scopeName: string;
(): ScopeHook;
}
export function createContextScope(scopeName: string, createContextScopeDeps?: CreateScope[]): readonly [<ContextValueType extends object | null>(rootComponentName: string, defaultContext?: ContextValueType | undefined) => readonly [{
(props: ContextValueType & {
scope: Scope<ContextValueType>;
children: React.ReactNode;
}): JSX.Element;
displayName: string;
}, (consumerName: string, scope: Scope<ContextValueType | undefined>) => ContextValueType], CreateScope];
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"mappings":";AAEA,8BAAuB,gBAAgB,SAAS,MAAM,GAAG,IAAI,EAC3D,iBAAiB,EAAE,MAAM,EACzB,cAAc,CAAC,EAAE,gBAAgB;YAIR,gBAAgB,GAAG;QAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;KAAE;;kBAQvC,MAAM,uBAUzC;AAMD,kBAAW,CAAC,GAAG,GAAG,IAAI;IAAE,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,CAAA;CAAE,GAAG,SAAS,CAAC;AAC9E,iBAAiB,CAAC,KAAK,EAAE,KAAK,KAAK;IAAE,CAAC,WAAW,EAAE,MAAM,GAAG,KAAK,CAAA;CAAE,CAAC;AACpE;IACE,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,SAAS,CAAC;CACf;AAED,mCAA4B,SAAS,EAAE,MAAM,EAAE,sBAAsB,GAAE,WAAW,EAAO,yEAQlE,MAAM;;;kBAQ+C,MAAM,SAAS;;;kBAUrD,MAAM,iFAgC3C","sources":["packages/react/context/src/packages/react/context/src/createContext.tsx","packages/react/context/src/packages/react/context/src/index.ts","packages/react/context/src/index.ts"],"sourcesContent":[null,null,"export { createContext, createContextScope } from './createContext';\nexport type { CreateScope, Scope } from './createContext';\n"],"names":[],"version":3,"file":"index.d.ts.map"}

View File

@@ -0,0 +1,133 @@
var $4O1Ne$react = require("react");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "createContext", () => $dec3cc0142d4f286$export$fd42f52fd3ae1109);
$parcel$export(module.exports, "createContextScope", () => $dec3cc0142d4f286$export$50c7b4e9d9f19c1);
function $dec3cc0142d4f286$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
const Context = /*#__PURE__*/ $4O1Ne$react.createContext(defaultContext);
function Provider(props) {
const { children: children , ...context } = props; // Only re-memoize when prop values change
// eslint-disable-next-line react-hooks/exhaustive-deps
const value = $4O1Ne$react.useMemo(()=>context
, Object.values(context));
return /*#__PURE__*/ $4O1Ne$react.createElement(Context.Provider, {
value: value
}, children);
}
function useContext(consumerName) {
const context = $4O1Ne$react.useContext(Context);
if (context) return context;
if (defaultContext !== undefined) return defaultContext; // if a defaultContext wasn't specified, it's a required context.
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
}
Provider.displayName = rootComponentName + 'Provider';
return [
Provider,
useContext
];
}
/* -------------------------------------------------------------------------------------------------
* createContextScope
* -----------------------------------------------------------------------------------------------*/ function $dec3cc0142d4f286$export$50c7b4e9d9f19c1(scopeName, createContextScopeDeps = []) {
let defaultContexts = [];
/* -----------------------------------------------------------------------------------------------
* createContext
* ---------------------------------------------------------------------------------------------*/ function $dec3cc0142d4f286$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
const BaseContext = /*#__PURE__*/ $4O1Ne$react.createContext(defaultContext);
const index = defaultContexts.length;
defaultContexts = [
...defaultContexts,
defaultContext
];
function Provider(props) {
const { scope: scope , children: children , ...context } = props;
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext; // Only re-memoize when prop values change
// eslint-disable-next-line react-hooks/exhaustive-deps
const value = $4O1Ne$react.useMemo(()=>context
, Object.values(context));
return /*#__PURE__*/ $4O1Ne$react.createElement(Context.Provider, {
value: value
}, children);
}
function useContext(consumerName, scope) {
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext;
const context = $4O1Ne$react.useContext(Context);
if (context) return context;
if (defaultContext !== undefined) return defaultContext; // if a defaultContext wasn't specified, it's a required context.
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
}
Provider.displayName = rootComponentName + 'Provider';
return [
Provider,
useContext
];
}
/* -----------------------------------------------------------------------------------------------
* createScope
* ---------------------------------------------------------------------------------------------*/ const createScope = ()=>{
const scopeContexts = defaultContexts.map((defaultContext)=>{
return /*#__PURE__*/ $4O1Ne$react.createContext(defaultContext);
});
return function useScope(scope) {
const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts;
return $4O1Ne$react.useMemo(()=>({
[`__scope${scopeName}`]: {
...scope,
[scopeName]: contexts
}
})
, [
scope,
contexts
]);
};
};
createScope.scopeName = scopeName;
return [
$dec3cc0142d4f286$export$fd42f52fd3ae1109,
$dec3cc0142d4f286$var$composeContextScopes(createScope, ...createContextScopeDeps)
];
}
/* -------------------------------------------------------------------------------------------------
* composeContextScopes
* -----------------------------------------------------------------------------------------------*/ function $dec3cc0142d4f286$var$composeContextScopes(...scopes) {
const baseScope = scopes[0];
if (scopes.length === 1) return baseScope;
const createScope1 = ()=>{
const scopeHooks = scopes.map((createScope)=>({
useScope: createScope(),
scopeName: createScope.scopeName
})
);
return function useComposedScopes(overrideScopes) {
const nextScopes1 = scopeHooks.reduce((nextScopes, { useScope: useScope , scopeName: scopeName })=>{
// We are calling a hook inside a callback which React warns against to avoid inconsistent
// renders, however, scoping doesn't have render side effects so we ignore the rule.
// eslint-disable-next-line react-hooks/rules-of-hooks
const scopeProps = useScope(overrideScopes);
const currentScope = scopeProps[`__scope${scopeName}`];
return {
...nextScopes,
...currentScope
};
}, {});
return $4O1Ne$react.useMemo(()=>({
[`__scope${baseScope.scopeName}`]: nextScopes1
})
, [
nextScopes1
]);
};
};
createScope1.scopeName = baseScope.scopeName;
return createScope1;
}
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More