main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

13
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.

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

@@ -0,0 +1,3 @@
declare function clamp(value: number, [min, max]: [number, number]): number;
export { clamp };

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

@@ -0,0 +1,3 @@
declare function clamp(value: number, [min, max]: [number, number]): number;
export { clamp };

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

@@ -0,0 +1,31 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/core/number/src/index.ts
var src_exports = {};
__export(src_exports, {
clamp: () => clamp
});
module.exports = __toCommonJS(src_exports);
// packages/core/number/src/number.ts
function clamp(value, [min, max]) {
return Math.min(max, Math.max(min, value));
}
//# sourceMappingURL=index.js.map

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

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/index.ts", "../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"],
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,SAAS,MAAM,OAAe,CAAC,KAAK,GAAG,GAA6B;AAClE,SAAO,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAC3C;",
"names": []
}

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

@@ -0,0 +1,8 @@
// packages/core/number/src/number.ts
function clamp(value, [min, max]) {
return Math.min(max, Math.max(min, value));
}
export {
clamp
};
//# sourceMappingURL=index.mjs.map

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

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/number.ts"],
"sourcesContent": ["function clamp(value: number, [min, max]: [number, number]): number {\n return Math.min(max, Math.max(min, value));\n}\n\nexport { clamp };\n"],
"mappings": ";AAAA,SAAS,MAAM,OAAe,CAAC,KAAK,GAAG,GAA6B;AAClE,SAAO,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAC3C;",
"names": []
}

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

@@ -0,0 +1,38 @@
{
"name": "@radix-ui/number",
"version": "1.1.0",
"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"
}
}

13
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.

5
node_modules/@radix-ui/primitive/dist/index.d.mts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
declare function composeEventHandlers<E>(originalEventHandler?: (event: E) => void, ourEventHandler?: (event: E) => void, { checkForDefaultPrevented }?: {
checkForDefaultPrevented?: boolean | undefined;
}): (event: E) => void;
export { composeEventHandlers };

5
node_modules/@radix-ui/primitive/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
declare function composeEventHandlers<E>(originalEventHandler?: (event: E) => void, ourEventHandler?: (event: E) => void, { checkForDefaultPrevented }?: {
checkForDefaultPrevented?: boolean | undefined;
}): (event: E) => void;
export { composeEventHandlers };

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

@@ -0,0 +1,36 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/core/primitive/src/index.ts
var src_exports = {};
__export(src_exports, {
composeEventHandlers: () => composeEventHandlers
});
module.exports = __toCommonJS(src_exports);
// packages/core/primitive/src/primitive.tsx
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
return function handleEvent(event) {
originalEventHandler?.(event);
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
return ourEventHandler?.(event);
}
};
}
//# sourceMappingURL=index.js.map

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

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/index.ts", "../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"],
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,SAAS,qBACP,sBACA,iBACA,EAAE,2BAA2B,KAAK,IAAI,CAAC,GACvC;AACA,SAAO,SAAS,YAAY,OAAU;AACpC,2BAAuB,KAAK;AAE5B,QAAI,6BAA6B,SAAS,CAAG,MAA4B,kBAAkB;AACzF,aAAO,kBAAkB,KAAK;AAAA,IAChC;AAAA,EACF;AACF;",
"names": []
}

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

@@ -0,0 +1,13 @@
// packages/core/primitive/src/primitive.tsx
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
return function handleEvent(event) {
originalEventHandler?.(event);
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
return ourEventHandler?.(event);
}
};
}
export {
composeEventHandlers
};
//# sourceMappingURL=index.mjs.map

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

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/primitive.tsx"],
"sourcesContent": ["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"],
"mappings": ";AAAA,SAAS,qBACP,sBACA,iBACA,EAAE,2BAA2B,KAAK,IAAI,CAAC,GACvC;AACA,SAAO,SAAS,YAAY,OAAU;AACpC,2BAAuB,KAAK;AAE5B,QAAI,6BAA6B,SAAS,CAAG,MAA4B,kBAAkB;AACzF,aAAO,kBAAkB,KAAK;AAAA,IAChC;AAAA,EACF;AACF;",
"names": []
}

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

@@ -0,0 +1,38 @@
{
"name": "@radix-ui/primitive",
"version": "1.1.0",
"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"
}
}

13
node_modules/@radix-ui/react-accordion/README.md generated vendored Normal file
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).

125
node_modules/@radix-ui/react-accordion/dist/index.d.mts generated vendored Normal file
View File

@@ -0,0 +1,125 @@
import * as React from 'react';
import React__default from 'react';
import { Primitive } from '@radix-ui/react-primitive';
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
type Scope<C = any> = {
[scopeName: string]: React.Context<C>[];
} | undefined;
type ScopeHook = (scope: Scope) => {
[__scopeProp: string]: Scope;
};
interface CreateScope {
scopeName: string;
(): ScopeHook;
}
type Direction = 'ltr' | 'rtl';
declare const createAccordionScope: CreateScope;
interface AccordionSingleProps extends AccordionImplSingleProps {
type: 'single';
}
interface AccordionMultipleProps extends AccordionImplMultipleProps {
type: 'multiple';
}
declare const Accordion: React__default.ForwardRefExoticComponent<(AccordionSingleProps | AccordionMultipleProps) & React__default.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 = React__default.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__default.AriaAttributes['aria-orientation'];
/**
* The language read direction.
*/
dir?: Direction;
}
type CollapsibleProps = React__default.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Root>;
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`.
*/
declare const AccordionItem: React__default.ForwardRefExoticComponent<AccordionItemProps & React__default.RefAttributes<HTMLDivElement>>;
type PrimitiveHeading3Props = React__default.ComponentPropsWithoutRef<typeof Primitive.h3>;
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.
*/
declare const AccordionHeader: React__default.ForwardRefExoticComponent<AccordionHeaderProps & React__default.RefAttributes<HTMLHeadingElement>>;
type CollapsibleTriggerProps = React__default.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Trigger>;
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`.
*/
declare const AccordionTrigger: React__default.ForwardRefExoticComponent<AccordionTriggerProps & React__default.RefAttributes<HTMLButtonElement>>;
type CollapsibleContentProps = React__default.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Content>;
interface AccordionContentProps extends CollapsibleContentProps {
}
/**
* `AccordionContent` contains the collapsible content for an `AccordionItem`.
*/
declare const AccordionContent: React__default.ForwardRefExoticComponent<AccordionContentProps & React__default.RefAttributes<HTMLDivElement>>;
declare const Root: React__default.ForwardRefExoticComponent<(AccordionSingleProps | AccordionMultipleProps) & React__default.RefAttributes<HTMLDivElement>>;
declare const Item: React__default.ForwardRefExoticComponent<AccordionItemProps & React__default.RefAttributes<HTMLDivElement>>;
declare const Header: React__default.ForwardRefExoticComponent<AccordionHeaderProps & React__default.RefAttributes<HTMLHeadingElement>>;
declare const Trigger: React__default.ForwardRefExoticComponent<AccordionTriggerProps & React__default.RefAttributes<HTMLButtonElement>>;
declare const Content: React__default.ForwardRefExoticComponent<AccordionContentProps & React__default.RefAttributes<HTMLDivElement>>;
export { Accordion, AccordionContent, type AccordionContentProps, AccordionHeader, type AccordionHeaderProps, AccordionItem, type AccordionItemProps, type AccordionMultipleProps, type AccordionSingleProps, AccordionTrigger, type AccordionTriggerProps, Content, Header, Item, Root, Trigger, createAccordionScope };

125
node_modules/@radix-ui/react-accordion/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,125 @@
import * as React from 'react';
import React__default from 'react';
import { Primitive } from '@radix-ui/react-primitive';
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
type Scope<C = any> = {
[scopeName: string]: React.Context<C>[];
} | undefined;
type ScopeHook = (scope: Scope) => {
[__scopeProp: string]: Scope;
};
interface CreateScope {
scopeName: string;
(): ScopeHook;
}
type Direction = 'ltr' | 'rtl';
declare const createAccordionScope: CreateScope;
interface AccordionSingleProps extends AccordionImplSingleProps {
type: 'single';
}
interface AccordionMultipleProps extends AccordionImplMultipleProps {
type: 'multiple';
}
declare const Accordion: React__default.ForwardRefExoticComponent<(AccordionSingleProps | AccordionMultipleProps) & React__default.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 = React__default.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__default.AriaAttributes['aria-orientation'];
/**
* The language read direction.
*/
dir?: Direction;
}
type CollapsibleProps = React__default.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Root>;
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`.
*/
declare const AccordionItem: React__default.ForwardRefExoticComponent<AccordionItemProps & React__default.RefAttributes<HTMLDivElement>>;
type PrimitiveHeading3Props = React__default.ComponentPropsWithoutRef<typeof Primitive.h3>;
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.
*/
declare const AccordionHeader: React__default.ForwardRefExoticComponent<AccordionHeaderProps & React__default.RefAttributes<HTMLHeadingElement>>;
type CollapsibleTriggerProps = React__default.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Trigger>;
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`.
*/
declare const AccordionTrigger: React__default.ForwardRefExoticComponent<AccordionTriggerProps & React__default.RefAttributes<HTMLButtonElement>>;
type CollapsibleContentProps = React__default.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Content>;
interface AccordionContentProps extends CollapsibleContentProps {
}
/**
* `AccordionContent` contains the collapsible content for an `AccordionItem`.
*/
declare const AccordionContent: React__default.ForwardRefExoticComponent<AccordionContentProps & React__default.RefAttributes<HTMLDivElement>>;
declare const Root: React__default.ForwardRefExoticComponent<(AccordionSingleProps | AccordionMultipleProps) & React__default.RefAttributes<HTMLDivElement>>;
declare const Item: React__default.ForwardRefExoticComponent<AccordionItemProps & React__default.RefAttributes<HTMLDivElement>>;
declare const Header: React__default.ForwardRefExoticComponent<AccordionHeaderProps & React__default.RefAttributes<HTMLHeadingElement>>;
declare const Trigger: React__default.ForwardRefExoticComponent<AccordionTriggerProps & React__default.RefAttributes<HTMLButtonElement>>;
declare const Content: React__default.ForwardRefExoticComponent<AccordionContentProps & React__default.RefAttributes<HTMLDivElement>>;
export { Accordion, AccordionContent, type AccordionContentProps, AccordionHeader, type AccordionHeaderProps, AccordionItem, type AccordionItemProps, type AccordionMultipleProps, type AccordionSingleProps, AccordionTrigger, type AccordionTriggerProps, Content, Header, Item, Root, Trigger, createAccordionScope };

350
node_modules/@radix-ui/react-accordion/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,350 @@
"use strict";
"use client";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/react/accordion/src/index.ts
var src_exports = {};
__export(src_exports, {
Accordion: () => Accordion,
AccordionContent: () => AccordionContent,
AccordionHeader: () => AccordionHeader,
AccordionItem: () => AccordionItem,
AccordionTrigger: () => AccordionTrigger,
Content: () => Content2,
Header: () => Header,
Item: () => Item,
Root: () => Root2,
Trigger: () => Trigger2,
createAccordionScope: () => createAccordionScope
});
module.exports = __toCommonJS(src_exports);
// packages/react/accordion/src/Accordion.tsx
var import_react = __toESM(require("react"));
var import_react_context = require("@radix-ui/react-context");
var import_react_collection = require("@radix-ui/react-collection");
var import_react_compose_refs = require("@radix-ui/react-compose-refs");
var import_primitive = require("@radix-ui/primitive");
var import_react_use_controllable_state = require("@radix-ui/react-use-controllable-state");
var import_react_primitive = require("@radix-ui/react-primitive");
var CollapsiblePrimitive = __toESM(require("@radix-ui/react-collapsible"));
var import_react_collapsible = require("@radix-ui/react-collapsible");
var import_react_id = require("@radix-ui/react-id");
var import_react_direction = require("@radix-ui/react-direction");
var import_jsx_runtime = require("react/jsx-runtime");
var ACCORDION_NAME = "Accordion";
var ACCORDION_KEYS = ["Home", "End", "ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight"];
var [Collection, useCollection, createCollectionScope] = (0, import_react_collection.createCollection)(ACCORDION_NAME);
var [createAccordionContext, createAccordionScope] = (0, import_react_context.createContextScope)(ACCORDION_NAME, [
createCollectionScope,
import_react_collapsible.createCollapsibleScope
]);
var useCollapsibleScope = (0, import_react_collapsible.createCollapsibleScope)();
var Accordion = import_react.default.forwardRef(
(props, forwardedRef) => {
const { type, ...accordionProps } = props;
const singleProps = accordionProps;
const multipleProps = accordionProps;
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Provider, { scope: props.__scopeAccordion, children: type === "multiple" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionImplMultiple, { ...multipleProps, ref: forwardedRef }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionImplSingle, { ...singleProps, ref: forwardedRef }) });
}
);
Accordion.displayName = ACCORDION_NAME;
var [AccordionValueProvider, useAccordionValueContext] = createAccordionContext(ACCORDION_NAME);
var [AccordionCollapsibleProvider, useAccordionCollapsibleContext] = createAccordionContext(
ACCORDION_NAME,
{ collapsible: false }
);
var AccordionImplSingle = import_react.default.forwardRef(
(props, forwardedRef) => {
const {
value: valueProp,
defaultValue,
onValueChange = () => {
},
collapsible = false,
...accordionSingleProps
} = props;
const [value, setValue] = (0, import_react_use_controllable_state.useControllableState)({
prop: valueProp,
defaultProp: defaultValue,
onChange: onValueChange
});
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
AccordionValueProvider,
{
scope: props.__scopeAccordion,
value: value ? [value] : [],
onItemOpen: setValue,
onItemClose: import_react.default.useCallback(() => collapsible && setValue(""), [collapsible, setValue]),
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionCollapsibleProvider, { scope: props.__scopeAccordion, collapsible, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionImpl, { ...accordionSingleProps, ref: forwardedRef }) })
}
);
}
);
var AccordionImplMultiple = import_react.default.forwardRef((props, forwardedRef) => {
const {
value: valueProp,
defaultValue,
onValueChange = () => {
},
...accordionMultipleProps
} = props;
const [value = [], setValue] = (0, import_react_use_controllable_state.useControllableState)({
prop: valueProp,
defaultProp: defaultValue,
onChange: onValueChange
});
const handleItemOpen = import_react.default.useCallback(
(itemValue) => setValue((prevValue = []) => [...prevValue, itemValue]),
[setValue]
);
const handleItemClose = import_react.default.useCallback(
(itemValue) => setValue((prevValue = []) => prevValue.filter((value2) => value2 !== itemValue)),
[setValue]
);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
AccordionValueProvider,
{
scope: props.__scopeAccordion,
value,
onItemOpen: handleItemOpen,
onItemClose: handleItemClose,
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionCollapsibleProvider, { scope: props.__scopeAccordion, collapsible: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionImpl, { ...accordionMultipleProps, ref: forwardedRef }) })
}
);
});
var [AccordionImplProvider, useAccordionContext] = createAccordionContext(ACCORDION_NAME);
var AccordionImpl = import_react.default.forwardRef(
(props, forwardedRef) => {
const { __scopeAccordion, disabled, dir, orientation = "vertical", ...accordionProps } = props;
const accordionRef = import_react.default.useRef(null);
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(accordionRef, forwardedRef);
const getItems = useCollection(__scopeAccordion);
const direction = (0, import_react_direction.useDirection)(dir);
const isDirectionLTR = direction === "ltr";
const handleKeyDown = (0, import_primitive.composeEventHandlers)(props.onKeyDown, (event) => {
if (!ACCORDION_KEYS.includes(event.key)) return;
const target = event.target;
const triggerCollection = getItems().filter((item) => !item.ref.current?.disabled);
const triggerIndex = triggerCollection.findIndex((item) => item.ref.current === target);
const triggerCount = triggerCollection.length;
if (triggerIndex === -1) return;
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[clampedIndex].ref.current?.focus();
});
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
AccordionImplProvider,
{
scope: __scopeAccordion,
disabled,
direction: dir,
orientation,
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Slot, { scope: __scopeAccordion, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_primitive.Primitive.div,
{
...accordionProps,
"data-orientation": orientation,
ref: composedRefs,
onKeyDown: disabled ? void 0 : handleKeyDown
}
) })
}
);
}
);
var ITEM_NAME = "AccordionItem";
var [AccordionItemProvider, useAccordionItemContext] = createAccordionContext(ITEM_NAME);
var AccordionItem = import_react.default.forwardRef(
(props, forwardedRef) => {
const { __scopeAccordion, value, ...accordionItemProps } = props;
const accordionContext = useAccordionContext(ITEM_NAME, __scopeAccordion);
const valueContext = useAccordionValueContext(ITEM_NAME, __scopeAccordion);
const collapsibleScope = useCollapsibleScope(__scopeAccordion);
const triggerId = (0, import_react_id.useId)();
const open = value && valueContext.value.includes(value) || false;
const disabled = accordionContext.disabled || props.disabled;
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
AccordionItemProvider,
{
scope: __scopeAccordion,
open,
disabled,
triggerId,
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
CollapsiblePrimitive.Root,
{
"data-orientation": accordionContext.orientation,
"data-state": getState(open),
...collapsibleScope,
...accordionItemProps,
ref: forwardedRef,
disabled,
open,
onOpenChange: (open2) => {
if (open2) {
valueContext.onItemOpen(value);
} else {
valueContext.onItemClose(value);
}
}
}
)
}
);
}
);
AccordionItem.displayName = ITEM_NAME;
var HEADER_NAME = "AccordionHeader";
var AccordionHeader = import_react.default.forwardRef(
(props, forwardedRef) => {
const { __scopeAccordion, ...headerProps } = props;
const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
const itemContext = useAccordionItemContext(HEADER_NAME, __scopeAccordion);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_primitive.Primitive.h3,
{
"data-orientation": accordionContext.orientation,
"data-state": getState(itemContext.open),
"data-disabled": itemContext.disabled ? "" : void 0,
...headerProps,
ref: forwardedRef
}
);
}
);
AccordionHeader.displayName = HEADER_NAME;
var TRIGGER_NAME = "AccordionTrigger";
var AccordionTrigger = import_react.default.forwardRef(
(props, forwardedRef) => {
const { __scopeAccordion, ...triggerProps } = props;
const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
const itemContext = useAccordionItemContext(TRIGGER_NAME, __scopeAccordion);
const collapsibleContext = useAccordionCollapsibleContext(TRIGGER_NAME, __scopeAccordion);
const collapsibleScope = useCollapsibleScope(__scopeAccordion);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.ItemSlot, { scope: __scopeAccordion, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
CollapsiblePrimitive.Trigger,
{
"aria-disabled": itemContext.open && !collapsibleContext.collapsible || void 0,
"data-orientation": accordionContext.orientation,
id: itemContext.triggerId,
...collapsibleScope,
...triggerProps,
ref: forwardedRef
}
) });
}
);
AccordionTrigger.displayName = TRIGGER_NAME;
var CONTENT_NAME = "AccordionContent";
var AccordionContent = import_react.default.forwardRef(
(props, forwardedRef) => {
const { __scopeAccordion, ...contentProps } = props;
const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
const itemContext = useAccordionItemContext(CONTENT_NAME, __scopeAccordion);
const collapsibleScope = useCollapsibleScope(__scopeAccordion);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
CollapsiblePrimitive.Content,
{
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
}
}
);
}
);
AccordionContent.displayName = CONTENT_NAME;
function getState(open) {
return open ? "open" : "closed";
}
var Root2 = Accordion;
var Item = AccordionItem;
var Header = AccordionHeader;
var Trigger2 = AccordionTrigger;
var Content2 = AccordionContent;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

318
node_modules/@radix-ui/react-accordion/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,318 @@
"use client";
// packages/react/accordion/src/Accordion.tsx
import React from "react";
import { createContextScope } from "@radix-ui/react-context";
import { createCollection } from "@radix-ui/react-collection";
import { useComposedRefs } from "@radix-ui/react-compose-refs";
import { composeEventHandlers } from "@radix-ui/primitive";
import { useControllableState } from "@radix-ui/react-use-controllable-state";
import { Primitive } from "@radix-ui/react-primitive";
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
import { createCollapsibleScope } from "@radix-ui/react-collapsible";
import { useId } from "@radix-ui/react-id";
import { useDirection } from "@radix-ui/react-direction";
import { jsx } from "react/jsx-runtime";
var ACCORDION_NAME = "Accordion";
var ACCORDION_KEYS = ["Home", "End", "ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight"];
var [Collection, useCollection, createCollectionScope] = createCollection(ACCORDION_NAME);
var [createAccordionContext, createAccordionScope] = createContextScope(ACCORDION_NAME, [
createCollectionScope,
createCollapsibleScope
]);
var useCollapsibleScope = createCollapsibleScope();
var Accordion = React.forwardRef(
(props, forwardedRef) => {
const { type, ...accordionProps } = props;
const singleProps = accordionProps;
const multipleProps = accordionProps;
return /* @__PURE__ */ jsx(Collection.Provider, { scope: props.__scopeAccordion, children: type === "multiple" ? /* @__PURE__ */ jsx(AccordionImplMultiple, { ...multipleProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(AccordionImplSingle, { ...singleProps, ref: forwardedRef }) });
}
);
Accordion.displayName = ACCORDION_NAME;
var [AccordionValueProvider, useAccordionValueContext] = createAccordionContext(ACCORDION_NAME);
var [AccordionCollapsibleProvider, useAccordionCollapsibleContext] = createAccordionContext(
ACCORDION_NAME,
{ collapsible: false }
);
var AccordionImplSingle = React.forwardRef(
(props, forwardedRef) => {
const {
value: valueProp,
defaultValue,
onValueChange = () => {
},
collapsible = false,
...accordionSingleProps
} = props;
const [value, setValue] = useControllableState({
prop: valueProp,
defaultProp: defaultValue,
onChange: onValueChange
});
return /* @__PURE__ */ jsx(
AccordionValueProvider,
{
scope: props.__scopeAccordion,
value: value ? [value] : [],
onItemOpen: setValue,
onItemClose: React.useCallback(() => collapsible && setValue(""), [collapsible, setValue]),
children: /* @__PURE__ */ jsx(AccordionCollapsibleProvider, { scope: props.__scopeAccordion, collapsible, children: /* @__PURE__ */ jsx(AccordionImpl, { ...accordionSingleProps, ref: forwardedRef }) })
}
);
}
);
var AccordionImplMultiple = React.forwardRef((props, forwardedRef) => {
const {
value: valueProp,
defaultValue,
onValueChange = () => {
},
...accordionMultipleProps
} = props;
const [value = [], setValue] = useControllableState({
prop: valueProp,
defaultProp: defaultValue,
onChange: onValueChange
});
const handleItemOpen = React.useCallback(
(itemValue) => setValue((prevValue = []) => [...prevValue, itemValue]),
[setValue]
);
const handleItemClose = React.useCallback(
(itemValue) => setValue((prevValue = []) => prevValue.filter((value2) => value2 !== itemValue)),
[setValue]
);
return /* @__PURE__ */ jsx(
AccordionValueProvider,
{
scope: props.__scopeAccordion,
value,
onItemOpen: handleItemOpen,
onItemClose: handleItemClose,
children: /* @__PURE__ */ jsx(AccordionCollapsibleProvider, { scope: props.__scopeAccordion, collapsible: true, children: /* @__PURE__ */ jsx(AccordionImpl, { ...accordionMultipleProps, ref: forwardedRef }) })
}
);
});
var [AccordionImplProvider, useAccordionContext] = createAccordionContext(ACCORDION_NAME);
var AccordionImpl = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAccordion, disabled, dir, orientation = "vertical", ...accordionProps } = props;
const accordionRef = React.useRef(null);
const composedRefs = useComposedRefs(accordionRef, forwardedRef);
const getItems = useCollection(__scopeAccordion);
const direction = useDirection(dir);
const isDirectionLTR = direction === "ltr";
const handleKeyDown = composeEventHandlers(props.onKeyDown, (event) => {
if (!ACCORDION_KEYS.includes(event.key)) return;
const target = event.target;
const triggerCollection = getItems().filter((item) => !item.ref.current?.disabled);
const triggerIndex = triggerCollection.findIndex((item) => item.ref.current === target);
const triggerCount = triggerCollection.length;
if (triggerIndex === -1) return;
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[clampedIndex].ref.current?.focus();
});
return /* @__PURE__ */ jsx(
AccordionImplProvider,
{
scope: __scopeAccordion,
disabled,
direction: dir,
orientation,
children: /* @__PURE__ */ jsx(Collection.Slot, { scope: __scopeAccordion, children: /* @__PURE__ */ jsx(
Primitive.div,
{
...accordionProps,
"data-orientation": orientation,
ref: composedRefs,
onKeyDown: disabled ? void 0 : handleKeyDown
}
) })
}
);
}
);
var ITEM_NAME = "AccordionItem";
var [AccordionItemProvider, useAccordionItemContext] = createAccordionContext(ITEM_NAME);
var AccordionItem = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAccordion, value, ...accordionItemProps } = props;
const accordionContext = useAccordionContext(ITEM_NAME, __scopeAccordion);
const valueContext = useAccordionValueContext(ITEM_NAME, __scopeAccordion);
const collapsibleScope = useCollapsibleScope(__scopeAccordion);
const triggerId = useId();
const open = value && valueContext.value.includes(value) || false;
const disabled = accordionContext.disabled || props.disabled;
return /* @__PURE__ */ jsx(
AccordionItemProvider,
{
scope: __scopeAccordion,
open,
disabled,
triggerId,
children: /* @__PURE__ */ jsx(
CollapsiblePrimitive.Root,
{
"data-orientation": accordionContext.orientation,
"data-state": getState(open),
...collapsibleScope,
...accordionItemProps,
ref: forwardedRef,
disabled,
open,
onOpenChange: (open2) => {
if (open2) {
valueContext.onItemOpen(value);
} else {
valueContext.onItemClose(value);
}
}
}
)
}
);
}
);
AccordionItem.displayName = ITEM_NAME;
var HEADER_NAME = "AccordionHeader";
var AccordionHeader = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAccordion, ...headerProps } = props;
const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
const itemContext = useAccordionItemContext(HEADER_NAME, __scopeAccordion);
return /* @__PURE__ */ jsx(
Primitive.h3,
{
"data-orientation": accordionContext.orientation,
"data-state": getState(itemContext.open),
"data-disabled": itemContext.disabled ? "" : void 0,
...headerProps,
ref: forwardedRef
}
);
}
);
AccordionHeader.displayName = HEADER_NAME;
var TRIGGER_NAME = "AccordionTrigger";
var AccordionTrigger = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAccordion, ...triggerProps } = props;
const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
const itemContext = useAccordionItemContext(TRIGGER_NAME, __scopeAccordion);
const collapsibleContext = useAccordionCollapsibleContext(TRIGGER_NAME, __scopeAccordion);
const collapsibleScope = useCollapsibleScope(__scopeAccordion);
return /* @__PURE__ */ jsx(Collection.ItemSlot, { scope: __scopeAccordion, children: /* @__PURE__ */ jsx(
CollapsiblePrimitive.Trigger,
{
"aria-disabled": itemContext.open && !collapsibleContext.collapsible || void 0,
"data-orientation": accordionContext.orientation,
id: itemContext.triggerId,
...collapsibleScope,
...triggerProps,
ref: forwardedRef
}
) });
}
);
AccordionTrigger.displayName = TRIGGER_NAME;
var CONTENT_NAME = "AccordionContent";
var AccordionContent = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAccordion, ...contentProps } = props;
const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
const itemContext = useAccordionItemContext(CONTENT_NAME, __scopeAccordion);
const collapsibleScope = useCollapsibleScope(__scopeAccordion);
return /* @__PURE__ */ jsx(
CollapsiblePrimitive.Content,
{
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
}
}
);
}
);
AccordionContent.displayName = CONTENT_NAME;
function getState(open) {
return open ? "open" : "closed";
}
var Root2 = Accordion;
var Item = AccordionItem;
var Header = AccordionHeader;
var Trigger2 = AccordionTrigger;
var Content2 = AccordionContent;
export {
Accordion,
AccordionContent,
AccordionHeader,
AccordionItem,
AccordionTrigger,
Content2 as Content,
Header,
Item,
Root2 as Root,
Trigger2 as Trigger,
createAccordionScope
};
//# sourceMappingURL=index.mjs.map

File diff suppressed because one or more lines are too long

63
node_modules/@radix-ui/react-accordion/package.json generated vendored Normal file
View File

@@ -0,0 +1,63 @@
{
"name": "@radix-ui/react-accordion",
"version": "1.2.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"
},
"dependencies": {
"@radix-ui/primitive": "1.1.0",
"@radix-ui/react-collapsible": "1.1.1",
"@radix-ui/react-collection": "1.1.0",
"@radix-ui/react-compose-refs": "1.1.0",
"@radix-ui/react-context": "1.1.1",
"@radix-ui/react-direction": "1.1.0",
"@radix-ui/react-id": "1.1.0",
"@radix-ui/react-primitive": "2.0.0",
"@radix-ui/react-use-controllable-state": "1.1.0"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"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
node_modules/@radix-ui/react-alert-dialog/README.md generated vendored Normal file
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,61 @@
import * as React from 'react';
import * as DialogPrimitive from '@radix-ui/react-dialog';
type Scope<C = any> = {
[scopeName: string]: React.Context<C>[];
} | undefined;
type ScopeHook = (scope: Scope) => {
[__scopeProp: string]: Scope;
};
interface CreateScope {
scopeName: string;
(): ScopeHook;
}
declare const createAlertDialogScope: CreateScope;
type DialogProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
interface AlertDialogProps extends Omit<DialogProps, 'modal'> {
}
declare const AlertDialog: React.FC<AlertDialogProps>;
type DialogTriggerProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;
interface AlertDialogTriggerProps extends DialogTriggerProps {
}
declare const AlertDialogTrigger: React.ForwardRefExoticComponent<AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
type DialogPortalProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;
interface AlertDialogPortalProps extends DialogPortalProps {
}
declare const AlertDialogPortal: React.FC<AlertDialogPortalProps>;
type DialogOverlayProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;
interface AlertDialogOverlayProps extends DialogOverlayProps {
}
declare const AlertDialogOverlay: React.ForwardRefExoticComponent<AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
type DialogContentProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;
interface AlertDialogContentProps extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {
}
declare const AlertDialogContent: React.ForwardRefExoticComponent<AlertDialogContentProps & React.RefAttributes<HTMLDivElement>>;
type DialogTitleProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;
interface AlertDialogTitleProps extends DialogTitleProps {
}
declare const AlertDialogTitle: React.ForwardRefExoticComponent<AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
type DialogDescriptionProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;
interface AlertDialogDescriptionProps extends DialogDescriptionProps {
}
declare const AlertDialogDescription: React.ForwardRefExoticComponent<AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
type DialogCloseProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;
interface AlertDialogActionProps extends DialogCloseProps {
}
declare const AlertDialogAction: React.ForwardRefExoticComponent<AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>>;
interface AlertDialogCancelProps extends DialogCloseProps {
}
declare const AlertDialogCancel: React.ForwardRefExoticComponent<AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>>;
declare const Root: React.FC<AlertDialogProps>;
declare const Trigger: React.ForwardRefExoticComponent<AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
declare const Portal: React.FC<AlertDialogPortalProps>;
declare const Overlay: React.ForwardRefExoticComponent<AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
declare const Content: React.ForwardRefExoticComponent<AlertDialogContentProps & React.RefAttributes<HTMLDivElement>>;
declare const Action: React.ForwardRefExoticComponent<AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>>;
declare const Cancel: React.ForwardRefExoticComponent<AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>>;
declare const Title: React.ForwardRefExoticComponent<AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
declare const Description: React.ForwardRefExoticComponent<AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
export { Action, AlertDialog, AlertDialogAction, type AlertDialogActionProps, AlertDialogCancel, type AlertDialogCancelProps, AlertDialogContent, type AlertDialogContentProps, AlertDialogDescription, type AlertDialogDescriptionProps, AlertDialogOverlay, type AlertDialogOverlayProps, AlertDialogPortal, type AlertDialogPortalProps, type AlertDialogProps, AlertDialogTitle, type AlertDialogTitleProps, AlertDialogTrigger, type AlertDialogTriggerProps, Cancel, Content, Description, Overlay, Portal, Root, Title, Trigger, createAlertDialogScope };

View File

@@ -0,0 +1,61 @@
import * as React from 'react';
import * as DialogPrimitive from '@radix-ui/react-dialog';
type Scope<C = any> = {
[scopeName: string]: React.Context<C>[];
} | undefined;
type ScopeHook = (scope: Scope) => {
[__scopeProp: string]: Scope;
};
interface CreateScope {
scopeName: string;
(): ScopeHook;
}
declare const createAlertDialogScope: CreateScope;
type DialogProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
interface AlertDialogProps extends Omit<DialogProps, 'modal'> {
}
declare const AlertDialog: React.FC<AlertDialogProps>;
type DialogTriggerProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;
interface AlertDialogTriggerProps extends DialogTriggerProps {
}
declare const AlertDialogTrigger: React.ForwardRefExoticComponent<AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
type DialogPortalProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;
interface AlertDialogPortalProps extends DialogPortalProps {
}
declare const AlertDialogPortal: React.FC<AlertDialogPortalProps>;
type DialogOverlayProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;
interface AlertDialogOverlayProps extends DialogOverlayProps {
}
declare const AlertDialogOverlay: React.ForwardRefExoticComponent<AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
type DialogContentProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;
interface AlertDialogContentProps extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {
}
declare const AlertDialogContent: React.ForwardRefExoticComponent<AlertDialogContentProps & React.RefAttributes<HTMLDivElement>>;
type DialogTitleProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;
interface AlertDialogTitleProps extends DialogTitleProps {
}
declare const AlertDialogTitle: React.ForwardRefExoticComponent<AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
type DialogDescriptionProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;
interface AlertDialogDescriptionProps extends DialogDescriptionProps {
}
declare const AlertDialogDescription: React.ForwardRefExoticComponent<AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
type DialogCloseProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;
interface AlertDialogActionProps extends DialogCloseProps {
}
declare const AlertDialogAction: React.ForwardRefExoticComponent<AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>>;
interface AlertDialogCancelProps extends DialogCloseProps {
}
declare const AlertDialogCancel: React.ForwardRefExoticComponent<AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>>;
declare const Root: React.FC<AlertDialogProps>;
declare const Trigger: React.ForwardRefExoticComponent<AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
declare const Portal: React.FC<AlertDialogPortalProps>;
declare const Overlay: React.ForwardRefExoticComponent<AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
declare const Content: React.ForwardRefExoticComponent<AlertDialogContentProps & React.RefAttributes<HTMLDivElement>>;
declare const Action: React.ForwardRefExoticComponent<AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>>;
declare const Cancel: React.ForwardRefExoticComponent<AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>>;
declare const Title: React.ForwardRefExoticComponent<AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
declare const Description: React.ForwardRefExoticComponent<AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
export { Action, AlertDialog, AlertDialogAction, type AlertDialogActionProps, AlertDialogCancel, type AlertDialogCancelProps, AlertDialogContent, type AlertDialogContentProps, AlertDialogDescription, type AlertDialogDescriptionProps, AlertDialogOverlay, type AlertDialogOverlayProps, AlertDialogPortal, type AlertDialogPortalProps, type AlertDialogProps, AlertDialogTitle, type AlertDialogTitleProps, AlertDialogTrigger, type AlertDialogTriggerProps, Cancel, Content, Description, Overlay, Portal, Root, Title, Trigger, createAlertDialogScope };

201
node_modules/@radix-ui/react-alert-dialog/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,201 @@
"use strict";
"use client";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/react/alert-dialog/src/index.ts
var src_exports = {};
__export(src_exports, {
Action: () => Action,
AlertDialog: () => AlertDialog,
AlertDialogAction: () => AlertDialogAction,
AlertDialogCancel: () => AlertDialogCancel,
AlertDialogContent: () => AlertDialogContent,
AlertDialogDescription: () => AlertDialogDescription,
AlertDialogOverlay: () => AlertDialogOverlay,
AlertDialogPortal: () => AlertDialogPortal,
AlertDialogTitle: () => AlertDialogTitle,
AlertDialogTrigger: () => AlertDialogTrigger,
Cancel: () => Cancel,
Content: () => Content2,
Description: () => Description2,
Overlay: () => Overlay2,
Portal: () => Portal2,
Root: () => Root2,
Title: () => Title2,
Trigger: () => Trigger2,
createAlertDialogScope: () => createAlertDialogScope
});
module.exports = __toCommonJS(src_exports);
// packages/react/alert-dialog/src/AlertDialog.tsx
var React = __toESM(require("react"));
var import_react_context = require("@radix-ui/react-context");
var import_react_compose_refs = require("@radix-ui/react-compose-refs");
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"));
var import_react_dialog = require("@radix-ui/react-dialog");
var import_primitive = require("@radix-ui/primitive");
var import_react_slot = require("@radix-ui/react-slot");
var import_jsx_runtime = require("react/jsx-runtime");
var ROOT_NAME = "AlertDialog";
var [createAlertDialogContext, createAlertDialogScope] = (0, import_react_context.createContextScope)(ROOT_NAME, [
import_react_dialog.createDialogScope
]);
var useDialogScope = (0, import_react_dialog.createDialogScope)();
var AlertDialog = (props) => {
const { __scopeAlertDialog, ...alertDialogProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Root, { ...dialogScope, ...alertDialogProps, modal: true });
};
AlertDialog.displayName = ROOT_NAME;
var TRIGGER_NAME = "AlertDialogTrigger";
var AlertDialogTrigger = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAlertDialog, ...triggerProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Trigger, { ...dialogScope, ...triggerProps, ref: forwardedRef });
}
);
AlertDialogTrigger.displayName = TRIGGER_NAME;
var PORTAL_NAME = "AlertDialogPortal";
var AlertDialogPortal = (props) => {
const { __scopeAlertDialog, ...portalProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Portal, { ...dialogScope, ...portalProps });
};
AlertDialogPortal.displayName = PORTAL_NAME;
var OVERLAY_NAME = "AlertDialogOverlay";
var AlertDialogOverlay = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAlertDialog, ...overlayProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Overlay, { ...dialogScope, ...overlayProps, ref: forwardedRef });
}
);
AlertDialogOverlay.displayName = OVERLAY_NAME;
var CONTENT_NAME = "AlertDialogContent";
var [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME);
var AlertDialogContent = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAlertDialog, children, ...contentProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
const contentRef = React.useRef(null);
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, contentRef);
const cancelRef = React.useRef(null);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
DialogPrimitive.WarningProvider,
{
contentName: CONTENT_NAME,
titleName: TITLE_NAME,
docsSlug: "alert-dialog",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogContentProvider, { scope: __scopeAlertDialog, cancelRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
DialogPrimitive.Content,
{
role: "alertdialog",
...dialogScope,
...contentProps,
ref: composedRefs,
onOpenAutoFocus: (0, import_primitive.composeEventHandlers)(contentProps.onOpenAutoFocus, (event) => {
event.preventDefault();
cancelRef.current?.focus({ preventScroll: true });
}),
onPointerDownOutside: (event) => event.preventDefault(),
onInteractOutside: (event) => event.preventDefault(),
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_slot.Slottable, { children }),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionWarning, { contentRef })
]
}
) })
}
);
}
);
AlertDialogContent.displayName = CONTENT_NAME;
var TITLE_NAME = "AlertDialogTitle";
var AlertDialogTitle = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAlertDialog, ...titleProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Title, { ...dialogScope, ...titleProps, ref: forwardedRef });
}
);
AlertDialogTitle.displayName = TITLE_NAME;
var DESCRIPTION_NAME = "AlertDialogDescription";
var AlertDialogDescription = React.forwardRef((props, forwardedRef) => {
const { __scopeAlertDialog, ...descriptionProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Description, { ...dialogScope, ...descriptionProps, ref: forwardedRef });
});
AlertDialogDescription.displayName = DESCRIPTION_NAME;
var ACTION_NAME = "AlertDialogAction";
var AlertDialogAction = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAlertDialog, ...actionProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Close, { ...dialogScope, ...actionProps, ref: forwardedRef });
}
);
AlertDialogAction.displayName = ACTION_NAME;
var CANCEL_NAME = "AlertDialogCancel";
var AlertDialogCancel = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAlertDialog, ...cancelProps } = props;
const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);
const dialogScope = useDialogScope(__scopeAlertDialog);
const ref = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, cancelRef);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Close, { ...dialogScope, ...cancelProps, ref });
}
);
AlertDialogCancel.displayName = CANCEL_NAME;
var DescriptionWarning = ({ 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;
};
var Root2 = AlertDialog;
var Trigger2 = AlertDialogTrigger;
var Portal2 = AlertDialogPortal;
var Overlay2 = AlertDialogOverlay;
var Content2 = AlertDialogContent;
var Action = AlertDialogAction;
var Cancel = AlertDialogCancel;
var Title2 = AlertDialogTitle;
var Description2 = AlertDialogDescription;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,169 @@
"use client";
// packages/react/alert-dialog/src/AlertDialog.tsx
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 { jsx, jsxs } from "react/jsx-runtime";
var ROOT_NAME = "AlertDialog";
var [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [
createDialogScope
]);
var useDialogScope = createDialogScope();
var AlertDialog = (props) => {
const { __scopeAlertDialog, ...alertDialogProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return /* @__PURE__ */ jsx(DialogPrimitive.Root, { ...dialogScope, ...alertDialogProps, modal: true });
};
AlertDialog.displayName = ROOT_NAME;
var TRIGGER_NAME = "AlertDialogTrigger";
var AlertDialogTrigger = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAlertDialog, ...triggerProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return /* @__PURE__ */ jsx(DialogPrimitive.Trigger, { ...dialogScope, ...triggerProps, ref: forwardedRef });
}
);
AlertDialogTrigger.displayName = TRIGGER_NAME;
var PORTAL_NAME = "AlertDialogPortal";
var AlertDialogPortal = (props) => {
const { __scopeAlertDialog, ...portalProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return /* @__PURE__ */ jsx(DialogPrimitive.Portal, { ...dialogScope, ...portalProps });
};
AlertDialogPortal.displayName = PORTAL_NAME;
var OVERLAY_NAME = "AlertDialogOverlay";
var AlertDialogOverlay = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAlertDialog, ...overlayProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return /* @__PURE__ */ jsx(DialogPrimitive.Overlay, { ...dialogScope, ...overlayProps, ref: forwardedRef });
}
);
AlertDialogOverlay.displayName = OVERLAY_NAME;
var CONTENT_NAME = "AlertDialogContent";
var [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME);
var AlertDialogContent = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAlertDialog, children, ...contentProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
const contentRef = React.useRef(null);
const composedRefs = useComposedRefs(forwardedRef, contentRef);
const cancelRef = React.useRef(null);
return /* @__PURE__ */ jsx(
DialogPrimitive.WarningProvider,
{
contentName: CONTENT_NAME,
titleName: TITLE_NAME,
docsSlug: "alert-dialog",
children: /* @__PURE__ */ jsx(AlertDialogContentProvider, { scope: __scopeAlertDialog, cancelRef, children: /* @__PURE__ */ jsxs(
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(),
children: [
/* @__PURE__ */ jsx(Slottable, { children }),
/* @__PURE__ */ jsx(DescriptionWarning, { contentRef })
]
}
) })
}
);
}
);
AlertDialogContent.displayName = CONTENT_NAME;
var TITLE_NAME = "AlertDialogTitle";
var AlertDialogTitle = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAlertDialog, ...titleProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return /* @__PURE__ */ jsx(DialogPrimitive.Title, { ...dialogScope, ...titleProps, ref: forwardedRef });
}
);
AlertDialogTitle.displayName = TITLE_NAME;
var DESCRIPTION_NAME = "AlertDialogDescription";
var AlertDialogDescription = React.forwardRef((props, forwardedRef) => {
const { __scopeAlertDialog, ...descriptionProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return /* @__PURE__ */ jsx(DialogPrimitive.Description, { ...dialogScope, ...descriptionProps, ref: forwardedRef });
});
AlertDialogDescription.displayName = DESCRIPTION_NAME;
var ACTION_NAME = "AlertDialogAction";
var AlertDialogAction = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAlertDialog, ...actionProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return /* @__PURE__ */ jsx(DialogPrimitive.Close, { ...dialogScope, ...actionProps, ref: forwardedRef });
}
);
AlertDialogAction.displayName = ACTION_NAME;
var CANCEL_NAME = "AlertDialogCancel";
var AlertDialogCancel = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAlertDialog, ...cancelProps } = props;
const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);
const dialogScope = useDialogScope(__scopeAlertDialog);
const ref = useComposedRefs(forwardedRef, cancelRef);
return /* @__PURE__ */ jsx(DialogPrimitive.Close, { ...dialogScope, ...cancelProps, ref });
}
);
AlertDialogCancel.displayName = CANCEL_NAME;
var DescriptionWarning = ({ 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;
};
var Root2 = AlertDialog;
var Trigger2 = AlertDialogTrigger;
var Portal2 = AlertDialogPortal;
var Overlay2 = AlertDialogOverlay;
var Content2 = AlertDialogContent;
var Action = AlertDialogAction;
var Cancel = AlertDialogCancel;
var Title2 = AlertDialogTitle;
var Description2 = AlertDialogDescription;
export {
Action,
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogOverlay,
AlertDialogPortal,
AlertDialogTitle,
AlertDialogTrigger,
Cancel,
Content2 as Content,
Description2 as Description,
Overlay2 as Overlay,
Portal2 as Portal,
Root2 as Root,
Title2 as Title,
Trigger2 as Trigger,
createAlertDialogScope
};
//# sourceMappingURL=index.mjs.map

File diff suppressed because one or more lines are too long

60
node_modules/@radix-ui/react-alert-dialog/package.json generated vendored Normal file
View File

@@ -0,0 +1,60 @@
{
"name": "@radix-ui/react-alert-dialog",
"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": [
"src",
"dist"
],
"sideEffects": false,
"scripts": {
"clean": "rm -rf dist",
"version": "yarn version"
},
"dependencies": {
"@radix-ui/primitive": "1.1.0",
"@radix-ui/react-compose-refs": "1.1.0",
"@radix-ui/react-context": "1.1.1",
"@radix-ui/react-dialog": "1.1.2",
"@radix-ui/react-primitive": "2.0.0",
"@radix-ui/react-slot": "1.1.0"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"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,306 @@
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 { 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 = React.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 = React.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 = React.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 = React.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 = React.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 = React.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 = React.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 = React.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,
};

35
node_modules/@radix-ui/react-alert-dialog/src/index.ts generated vendored Normal file
View File

@@ -0,0 +1,35 @@
'use client';
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
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.

10
node_modules/@radix-ui/react-arrow/dist/index.d.mts generated vendored Normal file
View File

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

10
node_modules/@radix-ui/react-arrow/dist/index.d.ts generated vendored Normal file
View File

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

60
node_modules/@radix-ui/react-arrow/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/react/arrow/src/index.ts
var src_exports = {};
__export(src_exports, {
Arrow: () => Arrow,
Root: () => Root
});
module.exports = __toCommonJS(src_exports);
// packages/react/arrow/src/Arrow.tsx
var React = __toESM(require("react"));
var import_react_primitive = require("@radix-ui/react-primitive");
var import_jsx_runtime = require("react/jsx-runtime");
var NAME = "Arrow";
var Arrow = React.forwardRef((props, forwardedRef) => {
const { children, width = 10, height = 5, ...arrowProps } = props;
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_primitive.Primitive.svg,
{
...arrowProps,
ref: forwardedRef,
width,
height,
viewBox: "0 0 30 10",
preserveAspectRatio: "none",
children: props.asChild ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("polygon", { points: "0,0 30,0 15,10" })
}
);
});
Arrow.displayName = NAME;
var Root = Arrow;
//# sourceMappingURL=index.js.map

7
node_modules/@radix-ui/react-arrow/dist/index.js.map generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/index.ts", "../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\n/* -------------------------------------------------------------------------------------------------\n * Arrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst NAME = 'Arrow';\n\ntype ArrowElement = React.ElementRef<typeof Primitive.svg>;\ntype PrimitiveSvgProps = React.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"],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,6BAA0B;AAwBQ;AAlBlC,IAAM,OAAO;AAMb,IAAM,QAAc,iBAAqC,CAAC,OAAO,iBAAiB;AAChF,QAAM,EAAE,UAAU,QAAQ,IAAI,SAAS,GAAG,GAAG,WAAW,IAAI;AAC5D,SACE;AAAA,IAAC,iCAAU;AAAA,IAAV;AAAA,MACE,GAAG;AAAA,MACJ,KAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAQ;AAAA,MACR,qBAAoB;AAAA,MAGnB,gBAAM,UAAU,WAAW,4CAAC,aAAQ,QAAO,kBAAiB;AAAA;AAAA,EAC/D;AAEJ,CAAC;AAED,MAAM,cAAc;AAIpB,IAAM,OAAO;",
"names": []
}

27
node_modules/@radix-ui/react-arrow/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,27 @@
// packages/react/arrow/src/Arrow.tsx
import * as React from "react";
import { Primitive } from "@radix-ui/react-primitive";
import { jsx } from "react/jsx-runtime";
var NAME = "Arrow";
var Arrow = React.forwardRef((props, forwardedRef) => {
const { children, width = 10, height = 5, ...arrowProps } = props;
return /* @__PURE__ */ jsx(
Primitive.svg,
{
...arrowProps,
ref: forwardedRef,
width,
height,
viewBox: "0 0 30 10",
preserveAspectRatio: "none",
children: props.asChild ? children : /* @__PURE__ */ jsx("polygon", { points: "0,0 30,0 15,10" })
}
);
});
Arrow.displayName = NAME;
var Root = Arrow;
export {
Arrow,
Root
};
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/Arrow.tsx"],
"sourcesContent": ["import * as React from 'react';\nimport { Primitive } from '@radix-ui/react-primitive';\n\n/* -------------------------------------------------------------------------------------------------\n * Arrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst NAME = 'Arrow';\n\ntype ArrowElement = React.ElementRef<typeof Primitive.svg>;\ntype PrimitiveSvgProps = React.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"],
"mappings": ";AAAA,YAAY,WAAW;AACvB,SAAS,iBAAiB;AAwBQ;AAlBlC,IAAM,OAAO;AAMb,IAAM,QAAc,iBAAqC,CAAC,OAAO,iBAAiB;AAChF,QAAM,EAAE,UAAU,QAAQ,IAAI,SAAS,GAAG,GAAG,WAAW,IAAI;AAC5D,SACE;AAAA,IAAC,UAAU;AAAA,IAAV;AAAA,MACE,GAAG;AAAA,MACJ,KAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAQ;AAAA,MACR,qBAAoB;AAAA,MAGnB,gBAAM,UAAU,WAAW,oBAAC,aAAQ,QAAO,kBAAiB;AAAA;AAAA,EAC/D;AAEJ,CAAC;AAED,MAAM,cAAc;AAIpB,IAAM,OAAO;",
"names": []
}

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

@@ -0,0 +1,55 @@
{
"name": "@radix-ui/react-arrow",
"version": "1.1.0",
"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": {
"@radix-ui/react-primitive": "2.0.0"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"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
node_modules/@radix-ui/react-aspect-ratio/README.md generated vendored Normal file
View File

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

View File

@@ -0,0 +1,11 @@
import * as React from 'react';
import { Primitive } from '@radix-ui/react-primitive';
type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
interface AspectRatioProps extends PrimitiveDivProps {
ratio?: number;
}
declare const AspectRatio: React.ForwardRefExoticComponent<AspectRatioProps & React.RefAttributes<HTMLDivElement>>;
declare const Root: React.ForwardRefExoticComponent<AspectRatioProps & React.RefAttributes<HTMLDivElement>>;
export { AspectRatio, type AspectRatioProps, Root };

View File

@@ -0,0 +1,11 @@
import * as React from 'react';
import { Primitive } from '@radix-ui/react-primitive';
type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
interface AspectRatioProps extends PrimitiveDivProps {
ratio?: number;
}
declare const AspectRatio: React.ForwardRefExoticComponent<AspectRatioProps & React.RefAttributes<HTMLDivElement>>;
declare const Root: React.ForwardRefExoticComponent<AspectRatioProps & React.RefAttributes<HTMLDivElement>>;
export { AspectRatio, type AspectRatioProps, Root };

View File

@@ -0,0 +1,79 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/react/aspect-ratio/src/index.ts
var src_exports = {};
__export(src_exports, {
AspectRatio: () => AspectRatio,
Root: () => Root
});
module.exports = __toCommonJS(src_exports);
// packages/react/aspect-ratio/src/AspectRatio.tsx
var React = __toESM(require("react"));
var import_react_primitive = require("@radix-ui/react-primitive");
var import_jsx_runtime = require("react/jsx-runtime");
var NAME = "AspectRatio";
var AspectRatio = React.forwardRef(
(props, forwardedRef) => {
const { ratio = 1 / 1, style, ...aspectRatioProps } = props;
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"div",
{
style: {
// ensures inner element is contained
position: "relative",
// ensures padding bottom trick maths works
width: "100%",
paddingBottom: `${100 / ratio}%`
},
"data-radix-aspect-ratio-wrapper": "",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_primitive.Primitive.div,
{
...aspectRatioProps,
ref: forwardedRef,
style: {
...style,
// ensures children expand in ratio
position: "absolute",
top: 0,
right: 0,
bottom: 0,
left: 0
}
}
)
}
);
}
);
AspectRatio.displayName = NAME;
var Root = AspectRatio;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/index.ts", "../src/AspectRatio.tsx"],
"sourcesContent": ["export {\n AspectRatio,\n //\n Root,\n} from './AspectRatio';\nexport type { AspectRatioProps } from './AspectRatio';\n", "import * as React from 'react';\nimport { Primitive } from '@radix-ui/react-primitive';\n\n/* -------------------------------------------------------------------------------------------------\n * AspectRatio\n * -----------------------------------------------------------------------------------------------*/\n\nconst NAME = 'AspectRatio';\n\ntype AspectRatioElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface AspectRatioProps extends PrimitiveDivProps {\n ratio?: number;\n}\n\nconst AspectRatio = React.forwardRef<AspectRatioElement, AspectRatioProps>(\n (props, forwardedRef) => {\n const { ratio = 1 / 1, style, ...aspectRatioProps } = props;\n return (\n <div\n style={{\n // ensures inner element is contained\n position: 'relative',\n // ensures padding bottom trick maths works\n width: '100%',\n paddingBottom: `${100 / ratio}%`,\n }}\n data-radix-aspect-ratio-wrapper=\"\"\n >\n <Primitive.div\n {...aspectRatioProps}\n ref={forwardedRef}\n style={{\n ...style,\n // ensures children expand in ratio\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n }}\n />\n </div>\n );\n }\n);\n\nAspectRatio.displayName = NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = AspectRatio;\n\nexport {\n AspectRatio,\n //\n Root,\n};\nexport type { AspectRatioProps };\n"],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,6BAA0B;AA4BlB;AAtBR,IAAM,OAAO;AAQb,IAAM,cAAoB;AAAA,EACxB,CAAC,OAAO,iBAAiB;AACvB,UAAM,EAAE,QAAQ,IAAI,GAAG,OAAO,GAAG,iBAAiB,IAAI;AACtD,WACE;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA;AAAA,UAEL,UAAU;AAAA;AAAA,UAEV,OAAO;AAAA,UACP,eAAe,GAAG,MAAM,KAAK;AAAA,QAC/B;AAAA,QACA,mCAAgC;AAAA,QAEhC;AAAA,UAAC,iCAAU;AAAA,UAAV;AAAA,YACE,GAAG;AAAA,YACJ,KAAK;AAAA,YACL,OAAO;AAAA,cACL,GAAG;AAAA;AAAA,cAEH,UAAU;AAAA,cACV,KAAK;AAAA,cACL,OAAO;AAAA,cACP,QAAQ;AAAA,cACR,MAAM;AAAA,YACR;AAAA;AAAA,QACF;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;AAI1B,IAAM,OAAO;",
"names": []
}

View File

@@ -0,0 +1,46 @@
// packages/react/aspect-ratio/src/AspectRatio.tsx
import * as React from "react";
import { Primitive } from "@radix-ui/react-primitive";
import { jsx } from "react/jsx-runtime";
var NAME = "AspectRatio";
var AspectRatio = React.forwardRef(
(props, forwardedRef) => {
const { ratio = 1 / 1, style, ...aspectRatioProps } = props;
return /* @__PURE__ */ jsx(
"div",
{
style: {
// ensures inner element is contained
position: "relative",
// ensures padding bottom trick maths works
width: "100%",
paddingBottom: `${100 / ratio}%`
},
"data-radix-aspect-ratio-wrapper": "",
children: /* @__PURE__ */ jsx(
Primitive.div,
{
...aspectRatioProps,
ref: forwardedRef,
style: {
...style,
// ensures children expand in ratio
position: "absolute",
top: 0,
right: 0,
bottom: 0,
left: 0
}
}
)
}
);
}
);
AspectRatio.displayName = NAME;
var Root = AspectRatio;
export {
AspectRatio,
Root
};
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/AspectRatio.tsx"],
"sourcesContent": ["import * as React from 'react';\nimport { Primitive } from '@radix-ui/react-primitive';\n\n/* -------------------------------------------------------------------------------------------------\n * AspectRatio\n * -----------------------------------------------------------------------------------------------*/\n\nconst NAME = 'AspectRatio';\n\ntype AspectRatioElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface AspectRatioProps extends PrimitiveDivProps {\n ratio?: number;\n}\n\nconst AspectRatio = React.forwardRef<AspectRatioElement, AspectRatioProps>(\n (props, forwardedRef) => {\n const { ratio = 1 / 1, style, ...aspectRatioProps } = props;\n return (\n <div\n style={{\n // ensures inner element is contained\n position: 'relative',\n // ensures padding bottom trick maths works\n width: '100%',\n paddingBottom: `${100 / ratio}%`,\n }}\n data-radix-aspect-ratio-wrapper=\"\"\n >\n <Primitive.div\n {...aspectRatioProps}\n ref={forwardedRef}\n style={{\n ...style,\n // ensures children expand in ratio\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n }}\n />\n </div>\n );\n }\n);\n\nAspectRatio.displayName = NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = AspectRatio;\n\nexport {\n AspectRatio,\n //\n Root,\n};\nexport type { AspectRatioProps };\n"],
"mappings": ";AAAA,YAAY,WAAW;AACvB,SAAS,iBAAiB;AA4BlB;AAtBR,IAAM,OAAO;AAQb,IAAM,cAAoB;AAAA,EACxB,CAAC,OAAO,iBAAiB;AACvB,UAAM,EAAE,QAAQ,IAAI,GAAG,OAAO,GAAG,iBAAiB,IAAI;AACtD,WACE;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA;AAAA,UAEL,UAAU;AAAA;AAAA,UAEV,OAAO;AAAA,UACP,eAAe,GAAG,MAAM,KAAK;AAAA,QAC/B;AAAA,QACA,mCAAgC;AAAA,QAEhC;AAAA,UAAC,UAAU;AAAA,UAAV;AAAA,YACE,GAAG;AAAA,YACJ,KAAK;AAAA,YACL,OAAO;AAAA,cACL,GAAG;AAAA;AAAA,cAEH,UAAU;AAAA,cACV,KAAK;AAAA,cACL,OAAO;AAAA,cACP,QAAQ;AAAA,cACR,MAAM;AAAA,YACR;AAAA;AAAA,QACF;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;AAI1B,IAAM,OAAO;",
"names": []
}

55
node_modules/@radix-ui/react-aspect-ratio/package.json generated vendored Normal file
View File

@@ -0,0 +1,55 @@
{
"name": "@radix-ui/react-aspect-ratio",
"version": "1.1.0",
"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": {
"@radix-ui/react-primitive": "2.0.0"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"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
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).

34
node_modules/@radix-ui/react-avatar/dist/index.d.mts generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import * as React from 'react';
import { Primitive } from '@radix-ui/react-primitive';
type Scope<C = any> = {
[scopeName: string]: React.Context<C>[];
} | undefined;
type ScopeHook = (scope: Scope) => {
[__scopeProp: string]: Scope;
};
interface CreateScope {
scopeName: string;
(): ScopeHook;
}
declare const createAvatarScope: CreateScope;
type ImageLoadingStatus = 'idle' | 'loading' | 'loaded' | 'error';
type PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;
interface AvatarProps extends PrimitiveSpanProps {
}
declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
type PrimitiveImageProps = React.ComponentPropsWithoutRef<typeof Primitive.img>;
interface AvatarImageProps extends PrimitiveImageProps {
onLoadingStatusChange?: (status: ImageLoadingStatus) => void;
}
declare const AvatarImage: React.ForwardRefExoticComponent<AvatarImageProps & React.RefAttributes<HTMLImageElement>>;
interface AvatarFallbackProps extends PrimitiveSpanProps {
delayMs?: number;
}
declare const AvatarFallback: React.ForwardRefExoticComponent<AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>>;
declare const Root: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
declare const Image: React.ForwardRefExoticComponent<AvatarImageProps & React.RefAttributes<HTMLImageElement>>;
declare const Fallback: React.ForwardRefExoticComponent<AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>>;
export { Avatar, AvatarFallback, type AvatarFallbackProps, AvatarImage, type AvatarImageProps, type AvatarProps, Fallback, Image, Root, createAvatarScope };

34
node_modules/@radix-ui/react-avatar/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import * as React from 'react';
import { Primitive } from '@radix-ui/react-primitive';
type Scope<C = any> = {
[scopeName: string]: React.Context<C>[];
} | undefined;
type ScopeHook = (scope: Scope) => {
[__scopeProp: string]: Scope;
};
interface CreateScope {
scopeName: string;
(): ScopeHook;
}
declare const createAvatarScope: CreateScope;
type ImageLoadingStatus = 'idle' | 'loading' | 'loaded' | 'error';
type PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;
interface AvatarProps extends PrimitiveSpanProps {
}
declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
type PrimitiveImageProps = React.ComponentPropsWithoutRef<typeof Primitive.img>;
interface AvatarImageProps extends PrimitiveImageProps {
onLoadingStatusChange?: (status: ImageLoadingStatus) => void;
}
declare const AvatarImage: React.ForwardRefExoticComponent<AvatarImageProps & React.RefAttributes<HTMLImageElement>>;
interface AvatarFallbackProps extends PrimitiveSpanProps {
delayMs?: number;
}
declare const AvatarFallback: React.ForwardRefExoticComponent<AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>>;
declare const Root: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
declare const Image: React.ForwardRefExoticComponent<AvatarImageProps & React.RefAttributes<HTMLImageElement>>;
declare const Fallback: React.ForwardRefExoticComponent<AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>>;
export { Avatar, AvatarFallback, type AvatarFallbackProps, AvatarImage, type AvatarImageProps, type AvatarProps, Fallback, Image, Root, createAvatarScope };

135
node_modules/@radix-ui/react-avatar/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,135 @@
"use strict";
"use client";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/react/avatar/src/index.ts
var src_exports = {};
__export(src_exports, {
Avatar: () => Avatar,
AvatarFallback: () => AvatarFallback,
AvatarImage: () => AvatarImage,
Fallback: () => Fallback,
Image: () => Image,
Root: () => Root,
createAvatarScope: () => createAvatarScope
});
module.exports = __toCommonJS(src_exports);
// packages/react/avatar/src/Avatar.tsx
var React = __toESM(require("react"));
var import_react_context = require("@radix-ui/react-context");
var import_react_use_callback_ref = require("@radix-ui/react-use-callback-ref");
var import_react_use_layout_effect = require("@radix-ui/react-use-layout-effect");
var import_react_primitive = require("@radix-ui/react-primitive");
var import_jsx_runtime = require("react/jsx-runtime");
var AVATAR_NAME = "Avatar";
var [createAvatarContext, createAvatarScope] = (0, import_react_context.createContextScope)(AVATAR_NAME);
var [AvatarProvider, useAvatarContext] = createAvatarContext(AVATAR_NAME);
var Avatar = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAvatar, ...avatarProps } = props;
const [imageLoadingStatus, setImageLoadingStatus] = React.useState("idle");
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
AvatarProvider,
{
scope: __scopeAvatar,
imageLoadingStatus,
onImageLoadingStatusChange: setImageLoadingStatus,
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.span, { ...avatarProps, ref: forwardedRef })
}
);
}
);
Avatar.displayName = AVATAR_NAME;
var IMAGE_NAME = "AvatarImage";
var AvatarImage = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAvatar, src, onLoadingStatusChange = () => {
}, ...imageProps } = props;
const context = useAvatarContext(IMAGE_NAME, __scopeAvatar);
const imageLoadingStatus = useImageLoadingStatus(src, imageProps.referrerPolicy);
const handleLoadingStatusChange = (0, import_react_use_callback_ref.useCallbackRef)((status) => {
onLoadingStatusChange(status);
context.onImageLoadingStatusChange(status);
});
(0, import_react_use_layout_effect.useLayoutEffect)(() => {
if (imageLoadingStatus !== "idle") {
handleLoadingStatusChange(imageLoadingStatus);
}
}, [imageLoadingStatus, handleLoadingStatusChange]);
return imageLoadingStatus === "loaded" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.img, { ...imageProps, ref: forwardedRef, src }) : null;
}
);
AvatarImage.displayName = IMAGE_NAME;
var FALLBACK_NAME = "AvatarFallback";
var AvatarFallback = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAvatar, delayMs, ...fallbackProps } = props;
const context = useAvatarContext(FALLBACK_NAME, __scopeAvatar);
const [canRender, setCanRender] = React.useState(delayMs === void 0);
React.useEffect(() => {
if (delayMs !== void 0) {
const timerId = window.setTimeout(() => setCanRender(true), delayMs);
return () => window.clearTimeout(timerId);
}
}, [delayMs]);
return canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.span, { ...fallbackProps, ref: forwardedRef }) : null;
}
);
AvatarFallback.displayName = FALLBACK_NAME;
function useImageLoadingStatus(src, referrerPolicy) {
const [loadingStatus, setLoadingStatus] = React.useState("idle");
(0, import_react_use_layout_effect.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;
if (referrerPolicy) {
image.referrerPolicy = referrerPolicy;
}
return () => {
isMounted = false;
};
}, [src, referrerPolicy]);
return loadingStatus;
}
var Root = Avatar;
var Image = AvatarImage;
var Fallback = AvatarFallback;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

103
node_modules/@radix-ui/react-avatar/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,103 @@
"use client";
// packages/react/avatar/src/Avatar.tsx
import * as React from "react";
import { createContextScope } from "@radix-ui/react-context";
import { useCallbackRef } from "@radix-ui/react-use-callback-ref";
import { useLayoutEffect } from "@radix-ui/react-use-layout-effect";
import { Primitive } from "@radix-ui/react-primitive";
import { jsx } from "react/jsx-runtime";
var AVATAR_NAME = "Avatar";
var [createAvatarContext, createAvatarScope] = createContextScope(AVATAR_NAME);
var [AvatarProvider, useAvatarContext] = createAvatarContext(AVATAR_NAME);
var Avatar = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAvatar, ...avatarProps } = props;
const [imageLoadingStatus, setImageLoadingStatus] = React.useState("idle");
return /* @__PURE__ */ jsx(
AvatarProvider,
{
scope: __scopeAvatar,
imageLoadingStatus,
onImageLoadingStatusChange: setImageLoadingStatus,
children: /* @__PURE__ */ jsx(Primitive.span, { ...avatarProps, ref: forwardedRef })
}
);
}
);
Avatar.displayName = AVATAR_NAME;
var IMAGE_NAME = "AvatarImage";
var AvatarImage = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAvatar, src, onLoadingStatusChange = () => {
}, ...imageProps } = props;
const context = useAvatarContext(IMAGE_NAME, __scopeAvatar);
const imageLoadingStatus = useImageLoadingStatus(src, imageProps.referrerPolicy);
const handleLoadingStatusChange = useCallbackRef((status) => {
onLoadingStatusChange(status);
context.onImageLoadingStatusChange(status);
});
useLayoutEffect(() => {
if (imageLoadingStatus !== "idle") {
handleLoadingStatusChange(imageLoadingStatus);
}
}, [imageLoadingStatus, handleLoadingStatusChange]);
return imageLoadingStatus === "loaded" ? /* @__PURE__ */ jsx(Primitive.img, { ...imageProps, ref: forwardedRef, src }) : null;
}
);
AvatarImage.displayName = IMAGE_NAME;
var FALLBACK_NAME = "AvatarFallback";
var AvatarFallback = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAvatar, delayMs, ...fallbackProps } = props;
const context = useAvatarContext(FALLBACK_NAME, __scopeAvatar);
const [canRender, setCanRender] = React.useState(delayMs === void 0);
React.useEffect(() => {
if (delayMs !== void 0) {
const timerId = window.setTimeout(() => setCanRender(true), delayMs);
return () => window.clearTimeout(timerId);
}
}, [delayMs]);
return canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ jsx(Primitive.span, { ...fallbackProps, ref: forwardedRef }) : null;
}
);
AvatarFallback.displayName = FALLBACK_NAME;
function useImageLoadingStatus(src, referrerPolicy) {
const [loadingStatus, setLoadingStatus] = React.useState("idle");
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;
if (referrerPolicy) {
image.referrerPolicy = referrerPolicy;
}
return () => {
isMounted = false;
};
}, [src, referrerPolicy]);
return loadingStatus;
}
var Root = Avatar;
var Image = AvatarImage;
var Fallback = AvatarFallback;
export {
Avatar,
AvatarFallback,
AvatarImage,
Fallback,
Image,
Root,
createAvatarScope
};
//# sourceMappingURL=index.mjs.map

File diff suppressed because one or more lines are too long

58
node_modules/@radix-ui/react-avatar/package.json generated vendored Normal file
View File

@@ -0,0 +1,58 @@
{
"name": "@radix-ui/react-avatar",
"version": "1.1.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"
},
"dependencies": {
"@radix-ui/react-context": "1.1.1",
"@radix-ui/react-primitive": "2.0.0",
"@radix-ui/react-use-callback-ref": "1.1.0",
"@radix-ui/react-use-layout-effect": "1.1.0"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"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
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).

37
node_modules/@radix-ui/react-checkbox/dist/index.d.mts generated vendored Normal file
View File

@@ -0,0 +1,37 @@
import * as React from 'react';
import { Primitive } from '@radix-ui/react-primitive';
type Scope<C = any> = {
[scopeName: string]: React.Context<C>[];
} | undefined;
type ScopeHook = (scope: Scope) => {
[__scopeProp: string]: Scope;
};
interface CreateScope {
scopeName: string;
(): ScopeHook;
}
declare const createCheckboxScope: CreateScope;
type CheckedState = boolean | 'indeterminate';
type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;
interface CheckboxProps extends Omit<PrimitiveButtonProps, 'checked' | 'defaultChecked'> {
checked?: CheckedState;
defaultChecked?: CheckedState;
required?: boolean;
onCheckedChange?(checked: CheckedState): void;
}
declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLButtonElement>>;
type PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;
interface CheckboxIndicatorProps extends PrimitiveSpanProps {
/**
* Used to force mounting when more control is needed. Useful when
* controlling animation with React animation libraries.
*/
forceMount?: true;
}
declare const CheckboxIndicator: React.ForwardRefExoticComponent<CheckboxIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
declare const Root: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLButtonElement>>;
declare const Indicator: React.ForwardRefExoticComponent<CheckboxIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
export { Checkbox, CheckboxIndicator, type CheckboxIndicatorProps, type CheckboxProps, type CheckedState, Indicator, Root, createCheckboxScope };

37
node_modules/@radix-ui/react-checkbox/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,37 @@
import * as React from 'react';
import { Primitive } from '@radix-ui/react-primitive';
type Scope<C = any> = {
[scopeName: string]: React.Context<C>[];
} | undefined;
type ScopeHook = (scope: Scope) => {
[__scopeProp: string]: Scope;
};
interface CreateScope {
scopeName: string;
(): ScopeHook;
}
declare const createCheckboxScope: CreateScope;
type CheckedState = boolean | 'indeterminate';
type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;
interface CheckboxProps extends Omit<PrimitiveButtonProps, 'checked' | 'defaultChecked'> {
checked?: CheckedState;
defaultChecked?: CheckedState;
required?: boolean;
onCheckedChange?(checked: CheckedState): void;
}
declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLButtonElement>>;
type PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;
interface CheckboxIndicatorProps extends PrimitiveSpanProps {
/**
* Used to force mounting when more control is needed. Useful when
* controlling animation with React animation libraries.
*/
forceMount?: true;
}
declare const CheckboxIndicator: React.ForwardRefExoticComponent<CheckboxIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
declare const Root: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLButtonElement>>;
declare const Indicator: React.ForwardRefExoticComponent<CheckboxIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
export { Checkbox, CheckboxIndicator, type CheckboxIndicatorProps, type CheckboxProps, type CheckedState, Indicator, Root, createCheckboxScope };

197
node_modules/@radix-ui/react-checkbox/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,197 @@
"use strict";
"use client";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/react/checkbox/src/index.ts
var src_exports = {};
__export(src_exports, {
Checkbox: () => Checkbox,
CheckboxIndicator: () => CheckboxIndicator,
Indicator: () => Indicator,
Root: () => Root,
createCheckboxScope: () => createCheckboxScope
});
module.exports = __toCommonJS(src_exports);
// packages/react/checkbox/src/Checkbox.tsx
var React = __toESM(require("react"));
var import_react_compose_refs = require("@radix-ui/react-compose-refs");
var import_react_context = require("@radix-ui/react-context");
var import_primitive = require("@radix-ui/primitive");
var import_react_use_controllable_state = require("@radix-ui/react-use-controllable-state");
var import_react_use_previous = require("@radix-ui/react-use-previous");
var import_react_use_size = require("@radix-ui/react-use-size");
var import_react_presence = require("@radix-ui/react-presence");
var import_react_primitive = require("@radix-ui/react-primitive");
var import_jsx_runtime = require("react/jsx-runtime");
var CHECKBOX_NAME = "Checkbox";
var [createCheckboxContext, createCheckboxScope] = (0, import_react_context.createContextScope)(CHECKBOX_NAME);
var [CheckboxProvider, useCheckboxContext] = createCheckboxContext(CHECKBOX_NAME);
var Checkbox = React.forwardRef(
(props, forwardedRef) => {
const {
__scopeCheckbox,
name,
checked: checkedProp,
defaultChecked,
required,
disabled,
value = "on",
onCheckedChange,
form,
...checkboxProps
} = props;
const [button, setButton] = React.useState(null);
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, (node) => setButton(node));
const hasConsumerStoppedPropagationRef = React.useRef(false);
const isFormControl = button ? form || !!button.closest("form") : true;
const [checked = false, setChecked] = (0, import_react_use_controllable_state.useControllableState)({
prop: checkedProp,
defaultProp: defaultChecked,
onChange: onCheckedChange
});
const initialCheckedStateRef = React.useRef(checked);
React.useEffect(() => {
const form2 = button?.form;
if (form2) {
const reset = () => setChecked(initialCheckedStateRef.current);
form2.addEventListener("reset", reset);
return () => form2.removeEventListener("reset", reset);
}
}, [button, setChecked]);
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CheckboxProvider, { scope: __scopeCheckbox, state: checked, disabled, children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_primitive.Primitive.button,
{
type: "button",
role: "checkbox",
"aria-checked": isIndeterminate(checked) ? "mixed" : checked,
"aria-required": required,
"data-state": getState(checked),
"data-disabled": disabled ? "" : void 0,
disabled,
value,
...checkboxProps,
ref: composedRefs,
onKeyDown: (0, import_primitive.composeEventHandlers)(props.onKeyDown, (event) => {
if (event.key === "Enter") event.preventDefault();
}),
onClick: (0, import_primitive.composeEventHandlers)(props.onClick, (event) => {
setChecked((prevChecked) => isIndeterminate(prevChecked) ? true : !prevChecked);
if (isFormControl) {
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
}
})
}
),
isFormControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
BubbleInput,
{
control: button,
bubbles: !hasConsumerStoppedPropagationRef.current,
name,
value,
checked,
required,
disabled,
form,
style: { transform: "translateX(-100%)" },
defaultChecked: isIndeterminate(defaultChecked) ? false : defaultChecked
}
)
] });
}
);
Checkbox.displayName = CHECKBOX_NAME;
var INDICATOR_NAME = "CheckboxIndicator";
var CheckboxIndicator = React.forwardRef(
(props, forwardedRef) => {
const { __scopeCheckbox, forceMount, ...indicatorProps } = props;
const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || isIndeterminate(context.state) || context.state === true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_primitive.Primitive.span,
{
"data-state": getState(context.state),
"data-disabled": context.disabled ? "" : void 0,
...indicatorProps,
ref: forwardedRef,
style: { pointerEvents: "none", ...props.style }
}
) });
}
);
CheckboxIndicator.displayName = INDICATOR_NAME;
var BubbleInput = (props) => {
const { control, checked, bubbles = true, defaultChecked, ...inputProps } = props;
const ref = React.useRef(null);
const prevChecked = (0, import_react_use_previous.usePrevious)(checked);
const controlSize = (0, import_react_use_size.useSize)(control);
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 });
input.indeterminate = isIndeterminate(checked);
setChecked.call(input, isIndeterminate(checked) ? false : checked);
input.dispatchEvent(event);
}
}, [prevChecked, checked, bubbles]);
const defaultCheckedRef = React.useRef(isIndeterminate(checked) ? false : checked);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"input",
{
type: "checkbox",
"aria-hidden": true,
defaultChecked: defaultChecked ?? defaultCheckedRef.current,
...inputProps,
tabIndex: -1,
ref,
style: {
...props.style,
...controlSize,
position: "absolute",
pointerEvents: "none",
opacity: 0,
margin: 0
}
}
);
};
function isIndeterminate(checked) {
return checked === "indeterminate";
}
function getState(checked) {
return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
}
var Root = Checkbox;
var Indicator = CheckboxIndicator;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

165
node_modules/@radix-ui/react-checkbox/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,165 @@
"use client";
// packages/react/checkbox/src/Checkbox.tsx
import * as React from "react";
import { useComposedRefs } from "@radix-ui/react-compose-refs";
import { createContextScope } from "@radix-ui/react-context";
import { composeEventHandlers } from "@radix-ui/primitive";
import { useControllableState } from "@radix-ui/react-use-controllable-state";
import { usePrevious } from "@radix-ui/react-use-previous";
import { useSize } from "@radix-ui/react-use-size";
import { Presence } from "@radix-ui/react-presence";
import { Primitive } from "@radix-ui/react-primitive";
import { jsx, jsxs } from "react/jsx-runtime";
var CHECKBOX_NAME = "Checkbox";
var [createCheckboxContext, createCheckboxScope] = createContextScope(CHECKBOX_NAME);
var [CheckboxProvider, useCheckboxContext] = createCheckboxContext(CHECKBOX_NAME);
var Checkbox = React.forwardRef(
(props, forwardedRef) => {
const {
__scopeCheckbox,
name,
checked: checkedProp,
defaultChecked,
required,
disabled,
value = "on",
onCheckedChange,
form,
...checkboxProps
} = props;
const [button, setButton] = React.useState(null);
const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));
const hasConsumerStoppedPropagationRef = React.useRef(false);
const isFormControl = button ? form || !!button.closest("form") : true;
const [checked = false, setChecked] = useControllableState({
prop: checkedProp,
defaultProp: defaultChecked,
onChange: onCheckedChange
});
const initialCheckedStateRef = React.useRef(checked);
React.useEffect(() => {
const form2 = button?.form;
if (form2) {
const reset = () => setChecked(initialCheckedStateRef.current);
form2.addEventListener("reset", reset);
return () => form2.removeEventListener("reset", reset);
}
}, [button, setChecked]);
return /* @__PURE__ */ jsxs(CheckboxProvider, { scope: __scopeCheckbox, state: checked, disabled, children: [
/* @__PURE__ */ jsx(
Primitive.button,
{
type: "button",
role: "checkbox",
"aria-checked": isIndeterminate(checked) ? "mixed" : checked,
"aria-required": required,
"data-state": getState(checked),
"data-disabled": disabled ? "" : void 0,
disabled,
value,
...checkboxProps,
ref: composedRefs,
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
if (event.key === "Enter") event.preventDefault();
}),
onClick: composeEventHandlers(props.onClick, (event) => {
setChecked((prevChecked) => isIndeterminate(prevChecked) ? true : !prevChecked);
if (isFormControl) {
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
}
})
}
),
isFormControl && /* @__PURE__ */ jsx(
BubbleInput,
{
control: button,
bubbles: !hasConsumerStoppedPropagationRef.current,
name,
value,
checked,
required,
disabled,
form,
style: { transform: "translateX(-100%)" },
defaultChecked: isIndeterminate(defaultChecked) ? false : defaultChecked
}
)
] });
}
);
Checkbox.displayName = CHECKBOX_NAME;
var INDICATOR_NAME = "CheckboxIndicator";
var CheckboxIndicator = React.forwardRef(
(props, forwardedRef) => {
const { __scopeCheckbox, forceMount, ...indicatorProps } = props;
const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);
return /* @__PURE__ */ jsx(Presence, { present: forceMount || isIndeterminate(context.state) || context.state === true, children: /* @__PURE__ */ jsx(
Primitive.span,
{
"data-state": getState(context.state),
"data-disabled": context.disabled ? "" : void 0,
...indicatorProps,
ref: forwardedRef,
style: { pointerEvents: "none", ...props.style }
}
) });
}
);
CheckboxIndicator.displayName = INDICATOR_NAME;
var BubbleInput = (props) => {
const { control, checked, bubbles = true, defaultChecked, ...inputProps } = props;
const ref = React.useRef(null);
const prevChecked = usePrevious(checked);
const controlSize = useSize(control);
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 });
input.indeterminate = isIndeterminate(checked);
setChecked.call(input, isIndeterminate(checked) ? false : checked);
input.dispatchEvent(event);
}
}, [prevChecked, checked, bubbles]);
const defaultCheckedRef = React.useRef(isIndeterminate(checked) ? false : checked);
return /* @__PURE__ */ jsx(
"input",
{
type: "checkbox",
"aria-hidden": true,
defaultChecked: defaultChecked ?? defaultCheckedRef.current,
...inputProps,
tabIndex: -1,
ref,
style: {
...props.style,
...controlSize,
position: "absolute",
pointerEvents: "none",
opacity: 0,
margin: 0
}
}
);
};
function isIndeterminate(checked) {
return checked === "indeterminate";
}
function getState(checked) {
return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
}
var Root = Checkbox;
var Indicator = CheckboxIndicator;
export {
Checkbox,
CheckboxIndicator,
Indicator,
Root,
createCheckboxScope
};
//# sourceMappingURL=index.mjs.map

File diff suppressed because one or more lines are too long

62
node_modules/@radix-ui/react-checkbox/package.json generated vendored Normal file
View File

@@ -0,0 +1,62 @@
{
"name": "@radix-ui/react-checkbox",
"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": {
"@radix-ui/primitive": "1.1.0",
"@radix-ui/react-compose-refs": "1.1.0",
"@radix-ui/react-context": "1.1.1",
"@radix-ui/react-presence": "1.1.1",
"@radix-ui/react-primitive": "2.0.0",
"@radix-ui/react-use-controllable-state": "1.1.0",
"@radix-ui/react-use-previous": "1.1.0",
"@radix-ui/react-use-size": "1.1.0"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"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
node_modules/@radix-ui/react-collapsible/README.md generated vendored Normal file
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,43 @@
import * as React from 'react';
import { Primitive } from '@radix-ui/react-primitive';
type Scope<C = any> = {
[scopeName: string]: React.Context<C>[];
} | undefined;
type ScopeHook = (scope: Scope) => {
[__scopeProp: string]: Scope;
};
interface CreateScope {
scopeName: string;
(): ScopeHook;
}
declare const createCollapsibleScope: CreateScope;
type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
interface CollapsibleProps extends PrimitiveDivProps {
defaultOpen?: boolean;
open?: boolean;
disabled?: boolean;
onOpenChange?(open: boolean): void;
}
declare const Collapsible: React.ForwardRefExoticComponent<CollapsibleProps & React.RefAttributes<HTMLDivElement>>;
type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;
interface CollapsibleTriggerProps extends PrimitiveButtonProps {
}
declare const CollapsibleTrigger: React.ForwardRefExoticComponent<CollapsibleTriggerProps & React.RefAttributes<HTMLButtonElement>>;
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;
}
declare const CollapsibleContent: React.ForwardRefExoticComponent<CollapsibleContentProps & React.RefAttributes<HTMLDivElement>>;
interface CollapsibleContentImplProps extends PrimitiveDivProps {
present: boolean;
}
declare const Root: React.ForwardRefExoticComponent<CollapsibleProps & React.RefAttributes<HTMLDivElement>>;
declare const Trigger: React.ForwardRefExoticComponent<CollapsibleTriggerProps & React.RefAttributes<HTMLButtonElement>>;
declare const Content: React.ForwardRefExoticComponent<CollapsibleContentProps & React.RefAttributes<HTMLDivElement>>;
export { Collapsible, CollapsibleContent, type CollapsibleContentProps, type CollapsibleProps, CollapsibleTrigger, type CollapsibleTriggerProps, Content, Root, Trigger, createCollapsibleScope };

View File

@@ -0,0 +1,43 @@
import * as React from 'react';
import { Primitive } from '@radix-ui/react-primitive';
type Scope<C = any> = {
[scopeName: string]: React.Context<C>[];
} | undefined;
type ScopeHook = (scope: Scope) => {
[__scopeProp: string]: Scope;
};
interface CreateScope {
scopeName: string;
(): ScopeHook;
}
declare const createCollapsibleScope: CreateScope;
type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
interface CollapsibleProps extends PrimitiveDivProps {
defaultOpen?: boolean;
open?: boolean;
disabled?: boolean;
onOpenChange?(open: boolean): void;
}
declare const Collapsible: React.ForwardRefExoticComponent<CollapsibleProps & React.RefAttributes<HTMLDivElement>>;
type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;
interface CollapsibleTriggerProps extends PrimitiveButtonProps {
}
declare const CollapsibleTrigger: React.ForwardRefExoticComponent<CollapsibleTriggerProps & React.RefAttributes<HTMLButtonElement>>;
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;
}
declare const CollapsibleContent: React.ForwardRefExoticComponent<CollapsibleContentProps & React.RefAttributes<HTMLDivElement>>;
interface CollapsibleContentImplProps extends PrimitiveDivProps {
present: boolean;
}
declare const Root: React.ForwardRefExoticComponent<CollapsibleProps & React.RefAttributes<HTMLDivElement>>;
declare const Trigger: React.ForwardRefExoticComponent<CollapsibleTriggerProps & React.RefAttributes<HTMLButtonElement>>;
declare const Content: React.ForwardRefExoticComponent<CollapsibleContentProps & React.RefAttributes<HTMLDivElement>>;
export { Collapsible, CollapsibleContent, type CollapsibleContentProps, type CollapsibleProps, CollapsibleTrigger, type CollapsibleTriggerProps, Content, Root, Trigger, createCollapsibleScope };

186
node_modules/@radix-ui/react-collapsible/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,186 @@
"use strict";
"use client";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/react/collapsible/src/index.ts
var src_exports = {};
__export(src_exports, {
Collapsible: () => Collapsible,
CollapsibleContent: () => CollapsibleContent,
CollapsibleTrigger: () => CollapsibleTrigger,
Content: () => Content,
Root: () => Root,
Trigger: () => Trigger,
createCollapsibleScope: () => createCollapsibleScope
});
module.exports = __toCommonJS(src_exports);
// packages/react/collapsible/src/Collapsible.tsx
var React = __toESM(require("react"));
var import_primitive = require("@radix-ui/primitive");
var import_react_context = require("@radix-ui/react-context");
var import_react_use_controllable_state = require("@radix-ui/react-use-controllable-state");
var import_react_use_layout_effect = require("@radix-ui/react-use-layout-effect");
var import_react_compose_refs = require("@radix-ui/react-compose-refs");
var import_react_primitive = require("@radix-ui/react-primitive");
var import_react_presence = require("@radix-ui/react-presence");
var import_react_id = require("@radix-ui/react-id");
var import_jsx_runtime = require("react/jsx-runtime");
var COLLAPSIBLE_NAME = "Collapsible";
var [createCollapsibleContext, createCollapsibleScope] = (0, import_react_context.createContextScope)(COLLAPSIBLE_NAME);
var [CollapsibleProvider, useCollapsibleContext] = createCollapsibleContext(COLLAPSIBLE_NAME);
var Collapsible = React.forwardRef(
(props, forwardedRef) => {
const {
__scopeCollapsible,
open: openProp,
defaultOpen,
disabled,
onOpenChange,
...collapsibleProps
} = props;
const [open = false, setOpen] = (0, import_react_use_controllable_state.useControllableState)({
prop: openProp,
defaultProp: defaultOpen,
onChange: onOpenChange
});
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
CollapsibleProvider,
{
scope: __scopeCollapsible,
disabled,
contentId: (0, import_react_id.useId)(),
open,
onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_primitive.Primitive.div,
{
"data-state": getState(open),
"data-disabled": disabled ? "" : void 0,
...collapsibleProps,
ref: forwardedRef
}
)
}
);
}
);
Collapsible.displayName = COLLAPSIBLE_NAME;
var TRIGGER_NAME = "CollapsibleTrigger";
var CollapsibleTrigger = React.forwardRef(
(props, forwardedRef) => {
const { __scopeCollapsible, ...triggerProps } = props;
const context = useCollapsibleContext(TRIGGER_NAME, __scopeCollapsible);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_primitive.Primitive.button,
{
type: "button",
"aria-controls": context.contentId,
"aria-expanded": context.open || false,
"data-state": getState(context.open),
"data-disabled": context.disabled ? "" : void 0,
disabled: context.disabled,
...triggerProps,
ref: forwardedRef,
onClick: (0, import_primitive.composeEventHandlers)(props.onClick, context.onOpenToggle)
}
);
}
);
CollapsibleTrigger.displayName = TRIGGER_NAME;
var CONTENT_NAME = "CollapsibleContent";
var CollapsibleContent = React.forwardRef(
(props, forwardedRef) => {
const { forceMount, ...contentProps } = props;
const context = useCollapsibleContext(CONTENT_NAME, props.__scopeCollapsible);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || context.open, children: ({ present }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsibleContentImpl, { ...contentProps, ref: forwardedRef, present }) });
}
);
CollapsibleContent.displayName = CONTENT_NAME;
var CollapsibleContentImpl = React.forwardRef((props, forwardedRef) => {
const { __scopeCollapsible, present, children, ...contentProps } = props;
const context = useCollapsibleContext(CONTENT_NAME, __scopeCollapsible);
const [isPresent, setIsPresent] = React.useState(present);
const ref = React.useRef(null);
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref);
const heightRef = React.useRef(0);
const height = heightRef.current;
const widthRef = React.useRef(0);
const width = widthRef.current;
const isOpen = context.open || isPresent;
const isMountAnimationPreventedRef = React.useRef(isOpen);
const originalStylesRef = React.useRef();
React.useEffect(() => {
const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);
return () => cancelAnimationFrame(rAF);
}, []);
(0, import_react_use_layout_effect.useLayoutEffect)(() => {
const node = ref.current;
if (node) {
originalStylesRef.current = originalStylesRef.current || {
transitionDuration: node.style.transitionDuration,
animationName: node.style.animationName
};
node.style.transitionDuration = "0s";
node.style.animationName = "none";
const rect = node.getBoundingClientRect();
heightRef.current = rect.height;
widthRef.current = rect.width;
if (!isMountAnimationPreventedRef.current) {
node.style.transitionDuration = originalStylesRef.current.transitionDuration;
node.style.animationName = originalStylesRef.current.animationName;
}
setIsPresent(present);
}
}, [context.open, present]);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_primitive.Primitive.div,
{
"data-state": getState(context.open),
"data-disabled": context.disabled ? "" : void 0,
id: context.contentId,
hidden: !isOpen,
...contentProps,
ref: composedRefs,
style: {
[`--radix-collapsible-content-height`]: height ? `${height}px` : void 0,
[`--radix-collapsible-content-width`]: width ? `${width}px` : void 0,
...props.style
},
children: isOpen && children
}
);
});
function getState(open) {
return open ? "open" : "closed";
}
var Root = Collapsible;
var Trigger = CollapsibleTrigger;
var Content = CollapsibleContent;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

154
node_modules/@radix-ui/react-collapsible/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,154 @@
"use client";
// packages/react/collapsible/src/Collapsible.tsx
import * as React from "react";
import { composeEventHandlers } from "@radix-ui/primitive";
import { createContextScope } from "@radix-ui/react-context";
import { useControllableState } from "@radix-ui/react-use-controllable-state";
import { useLayoutEffect } from "@radix-ui/react-use-layout-effect";
import { useComposedRefs } from "@radix-ui/react-compose-refs";
import { Primitive } from "@radix-ui/react-primitive";
import { Presence } from "@radix-ui/react-presence";
import { useId } from "@radix-ui/react-id";
import { jsx } from "react/jsx-runtime";
var COLLAPSIBLE_NAME = "Collapsible";
var [createCollapsibleContext, createCollapsibleScope] = createContextScope(COLLAPSIBLE_NAME);
var [CollapsibleProvider, useCollapsibleContext] = createCollapsibleContext(COLLAPSIBLE_NAME);
var Collapsible = React.forwardRef(
(props, forwardedRef) => {
const {
__scopeCollapsible,
open: openProp,
defaultOpen,
disabled,
onOpenChange,
...collapsibleProps
} = props;
const [open = false, setOpen] = useControllableState({
prop: openProp,
defaultProp: defaultOpen,
onChange: onOpenChange
});
return /* @__PURE__ */ jsx(
CollapsibleProvider,
{
scope: __scopeCollapsible,
disabled,
contentId: useId(),
open,
onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
children: /* @__PURE__ */ jsx(
Primitive.div,
{
"data-state": getState(open),
"data-disabled": disabled ? "" : void 0,
...collapsibleProps,
ref: forwardedRef
}
)
}
);
}
);
Collapsible.displayName = COLLAPSIBLE_NAME;
var TRIGGER_NAME = "CollapsibleTrigger";
var CollapsibleTrigger = React.forwardRef(
(props, forwardedRef) => {
const { __scopeCollapsible, ...triggerProps } = props;
const context = useCollapsibleContext(TRIGGER_NAME, __scopeCollapsible);
return /* @__PURE__ */ jsx(
Primitive.button,
{
type: "button",
"aria-controls": context.contentId,
"aria-expanded": context.open || false,
"data-state": getState(context.open),
"data-disabled": context.disabled ? "" : void 0,
disabled: context.disabled,
...triggerProps,
ref: forwardedRef,
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
}
);
}
);
CollapsibleTrigger.displayName = TRIGGER_NAME;
var CONTENT_NAME = "CollapsibleContent";
var CollapsibleContent = React.forwardRef(
(props, forwardedRef) => {
const { forceMount, ...contentProps } = props;
const context = useCollapsibleContext(CONTENT_NAME, props.__scopeCollapsible);
return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: ({ present }) => /* @__PURE__ */ jsx(CollapsibleContentImpl, { ...contentProps, ref: forwardedRef, present }) });
}
);
CollapsibleContent.displayName = CONTENT_NAME;
var CollapsibleContentImpl = React.forwardRef((props, forwardedRef) => {
const { __scopeCollapsible, present, children, ...contentProps } = props;
const context = useCollapsibleContext(CONTENT_NAME, __scopeCollapsible);
const [isPresent, setIsPresent] = React.useState(present);
const ref = React.useRef(null);
const composedRefs = useComposedRefs(forwardedRef, ref);
const heightRef = React.useRef(0);
const height = heightRef.current;
const widthRef = React.useRef(0);
const width = widthRef.current;
const isOpen = context.open || isPresent;
const isMountAnimationPreventedRef = React.useRef(isOpen);
const originalStylesRef = React.useRef();
React.useEffect(() => {
const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);
return () => cancelAnimationFrame(rAF);
}, []);
useLayoutEffect(() => {
const node = ref.current;
if (node) {
originalStylesRef.current = originalStylesRef.current || {
transitionDuration: node.style.transitionDuration,
animationName: node.style.animationName
};
node.style.transitionDuration = "0s";
node.style.animationName = "none";
const rect = node.getBoundingClientRect();
heightRef.current = rect.height;
widthRef.current = rect.width;
if (!isMountAnimationPreventedRef.current) {
node.style.transitionDuration = originalStylesRef.current.transitionDuration;
node.style.animationName = originalStylesRef.current.animationName;
}
setIsPresent(present);
}
}, [context.open, present]);
return /* @__PURE__ */ jsx(
Primitive.div,
{
"data-state": getState(context.open),
"data-disabled": context.disabled ? "" : void 0,
id: context.contentId,
hidden: !isOpen,
...contentProps,
ref: composedRefs,
style: {
[`--radix-collapsible-content-height`]: height ? `${height}px` : void 0,
[`--radix-collapsible-content-width`]: width ? `${width}px` : void 0,
...props.style
},
children: isOpen && children
}
);
});
function getState(open) {
return open ? "open" : "closed";
}
var Root = Collapsible;
var Trigger = CollapsibleTrigger;
var Content = CollapsibleContent;
export {
Collapsible,
CollapsibleContent,
CollapsibleTrigger,
Content,
Root,
Trigger,
createCollapsibleScope
};
//# sourceMappingURL=index.mjs.map

File diff suppressed because one or more lines are too long

62
node_modules/@radix-ui/react-collapsible/package.json generated vendored Normal file
View File

@@ -0,0 +1,62 @@
{
"name": "@radix-ui/react-collapsible",
"version": "1.1.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"
},
"dependencies": {
"@radix-ui/primitive": "1.1.0",
"@radix-ui/react-compose-refs": "1.1.0",
"@radix-ui/react-context": "1.1.1",
"@radix-ui/react-id": "1.1.0",
"@radix-ui/react-presence": "1.1.1",
"@radix-ui/react-primitive": "2.0.0",
"@radix-ui/react-use-controllable-state": "1.1.0",
"@radix-ui/react-use-layout-effect": "1.1.0"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"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
node_modules/@radix-ui/react-collection/README.md generated vendored Normal file
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,34 @@
import * as React from 'react';
import React__default from 'react';
import { Slot } from '@radix-ui/react-slot';
type Scope<C = any> = {
[scopeName: string]: React.Context<C>[];
} | undefined;
type ScopeHook = (scope: Scope) => {
[__scopeProp: string]: Scope;
};
interface CreateScope {
scopeName: string;
(): ScopeHook;
}
type SlotProps = React__default.ComponentPropsWithoutRef<typeof Slot>;
interface CollectionProps extends SlotProps {
scope: any;
}
declare function createCollection<ItemElement extends HTMLElement, ItemData = {}>(name: string): readonly [{
readonly Provider: React__default.FC<{
children?: React__default.ReactNode;
scope: any;
}>;
readonly Slot: React__default.ForwardRefExoticComponent<CollectionProps & React__default.RefAttributes<HTMLElement>>;
readonly ItemSlot: React__default.ForwardRefExoticComponent<React__default.PropsWithoutRef<ItemData & {
children: React__default.ReactNode;
scope: any;
}> & React__default.RefAttributes<ItemElement>>;
}, (scope: any) => () => ({
ref: React__default.RefObject<ItemElement>;
} & ItemData)[], CreateScope];
export { type CollectionProps, createCollection };

View File

@@ -0,0 +1,34 @@
import * as React from 'react';
import React__default from 'react';
import { Slot } from '@radix-ui/react-slot';
type Scope<C = any> = {
[scopeName: string]: React.Context<C>[];
} | undefined;
type ScopeHook = (scope: Scope) => {
[__scopeProp: string]: Scope;
};
interface CreateScope {
scopeName: string;
(): ScopeHook;
}
type SlotProps = React__default.ComponentPropsWithoutRef<typeof Slot>;
interface CollectionProps extends SlotProps {
scope: any;
}
declare function createCollection<ItemElement extends HTMLElement, ItemData = {}>(name: string): readonly [{
readonly Provider: React__default.FC<{
children?: React__default.ReactNode;
scope: any;
}>;
readonly Slot: React__default.ForwardRefExoticComponent<CollectionProps & React__default.RefAttributes<HTMLElement>>;
readonly ItemSlot: React__default.ForwardRefExoticComponent<React__default.PropsWithoutRef<ItemData & {
children: React__default.ReactNode;
scope: any;
}> & React__default.RefAttributes<ItemElement>>;
}, (scope: any) => () => ({
ref: React__default.RefObject<ItemElement>;
} & ItemData)[], CreateScope];
export { type CollectionProps, createCollection };

104
node_modules/@radix-ui/react-collection/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,104 @@
"use strict";
"use client";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/react/collection/src/index.ts
var src_exports = {};
__export(src_exports, {
createCollection: () => createCollection
});
module.exports = __toCommonJS(src_exports);
// packages/react/collection/src/Collection.tsx
var import_react = __toESM(require("react"));
var import_react_context = require("@radix-ui/react-context");
var import_react_compose_refs = require("@radix-ui/react-compose-refs");
var import_react_slot = require("@radix-ui/react-slot");
var import_jsx_runtime = require("react/jsx-runtime");
function createCollection(name) {
const PROVIDER_NAME = name + "CollectionProvider";
const [createCollectionContext, createCollectionScope] = (0, import_react_context.createContextScope)(PROVIDER_NAME);
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
PROVIDER_NAME,
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
);
const CollectionProvider = (props) => {
const { scope, children } = props;
const ref = import_react.default.useRef(null);
const itemMap = import_react.default.useRef(/* @__PURE__ */ new Map()).current;
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
};
CollectionProvider.displayName = PROVIDER_NAME;
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
const CollectionSlot = import_react.default.forwardRef(
(props, forwardedRef) => {
const { scope, children } = props;
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, context.collectionRef);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_slot.Slot, { ref: composedRefs, children });
}
);
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
const ITEM_DATA_ATTR = "data-radix-collection-item";
const CollectionItemSlot = import_react.default.forwardRef(
(props, forwardedRef) => {
const { scope, children, ...itemData } = props;
const ref = import_react.default.useRef(null);
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref);
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
import_react.default.useEffect(() => {
context.itemMap.set(ref, { ref, ...itemData });
return () => void context.itemMap.delete(ref);
});
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_slot.Slot, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
}
);
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
function useCollection(scope) {
const context = useCollectionContext(name + "CollectionConsumer", scope);
const getItems = import_react.default.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

72
node_modules/@radix-ui/react-collection/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,72 @@
"use client";
// packages/react/collection/src/Collection.tsx
import React from "react";
import { createContextScope } from "@radix-ui/react-context";
import { useComposedRefs } from "@radix-ui/react-compose-refs";
import { Slot } from "@radix-ui/react-slot";
import { jsx } from "react/jsx-runtime";
function createCollection(name) {
const PROVIDER_NAME = name + "CollectionProvider";
const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
PROVIDER_NAME,
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
);
const CollectionProvider = (props) => {
const { scope, children } = props;
const ref = React.useRef(null);
const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;
return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
};
CollectionProvider.displayName = PROVIDER_NAME;
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
const CollectionSlot = React.forwardRef(
(props, forwardedRef) => {
const { scope, children } = props;
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
return /* @__PURE__ */ jsx(Slot, { ref: composedRefs, children });
}
);
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
const ITEM_DATA_ATTR = "data-radix-collection-item";
const CollectionItemSlot = React.forwardRef(
(props, forwardedRef) => {
const { scope, children, ...itemData } = props;
const ref = React.useRef(null);
const composedRefs = useComposedRefs(forwardedRef, ref);
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
React.useEffect(() => {
context.itemMap.set(ref, { ref, ...itemData });
return () => void context.itemMap.delete(ref);
});
return /* @__PURE__ */ jsx(Slot, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
}
);
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
function useCollection(scope) {
const context = useCollectionContext(name + "CollectionConsumer", scope);
const getItems = 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 {
createCollection
};
//# sourceMappingURL=index.mjs.map

File diff suppressed because one or more lines are too long

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,28 @@
import * as react_jsx_runtime from 'react/jsx-runtime';
import * as React from 'react';
declare function createContext<ContextValueType extends object | null>(rootComponentName: string, defaultContext?: ContextValueType): readonly [{
(props: ContextValueType & {
children: React.ReactNode;
}): react_jsx_runtime.JSX.Element;
displayName: string;
}, (consumerName: string) => ContextValueType];
type Scope<C = any> = {
[scopeName: string]: React.Context<C>[];
} | undefined;
type ScopeHook = (scope: Scope) => {
[__scopeProp: string]: Scope;
};
interface CreateScope {
scopeName: string;
(): ScopeHook;
}
declare 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;
}): react_jsx_runtime.JSX.Element;
displayName: string;
}, (consumerName: string, scope: Scope<ContextValueType | undefined>) => ContextValueType], CreateScope];
export { type CreateScope, type Scope, createContext, createContextScope };

View File

@@ -0,0 +1,28 @@
import * as react_jsx_runtime from 'react/jsx-runtime';
import * as React from 'react';
declare function createContext<ContextValueType extends object | null>(rootComponentName: string, defaultContext?: ContextValueType): readonly [{
(props: ContextValueType & {
children: React.ReactNode;
}): react_jsx_runtime.JSX.Element;
displayName: string;
}, (consumerName: string) => ContextValueType];
type Scope<C = any> = {
[scopeName: string]: React.Context<C>[];
} | undefined;
type ScopeHook = (scope: Scope) => {
[__scopeProp: string]: Scope;
};
interface CreateScope {
scopeName: string;
(): ScopeHook;
}
declare 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;
}): react_jsx_runtime.JSX.Element;
displayName: string;
}, (consumerName: string, scope: Scope<ContextValueType | undefined>) => ContextValueType], CreateScope];
export { type CreateScope, type Scope, createContext, createContextScope };

View File

@@ -0,0 +1,114 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/react/context/src/index.ts
var src_exports = {};
__export(src_exports, {
createContext: () => createContext2,
createContextScope: () => createContextScope
});
module.exports = __toCommonJS(src_exports);
// packages/react/context/src/createContext.tsx
var React = __toESM(require("react"));
var import_jsx_runtime = require("react/jsx-runtime");
function createContext2(rootComponentName, defaultContext) {
const Context = React.createContext(defaultContext);
function Provider(props) {
const { children, ...context } = props;
const value = React.useMemo(() => context, Object.values(context));
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Provider, { value, children });
}
function useContext2(consumerName) {
const context = React.useContext(Context);
if (context) return context;
if (defaultContext !== void 0) return defaultContext;
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
}
Provider.displayName = rootComponentName + "Provider";
return [Provider, useContext2];
}
function createContextScope(scopeName, createContextScopeDeps = []) {
let defaultContexts = [];
function createContext3(rootComponentName, defaultContext) {
const BaseContext = React.createContext(defaultContext);
const index = defaultContexts.length;
defaultContexts = [...defaultContexts, defaultContext];
function Provider(props) {
const { scope, children, ...context } = props;
const Context = scope?.[scopeName][index] || BaseContext;
const value = React.useMemo(() => context, Object.values(context));
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Provider, { value, children });
}
function useContext2(consumerName, scope) {
const Context = scope?.[scopeName][index] || BaseContext;
const context = React.useContext(Context);
if (context) return context;
if (defaultContext !== void 0) return defaultContext;
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
}
Provider.displayName = rootComponentName + "Provider";
return [Provider, useContext2];
}
const createScope = () => {
const scopeContexts = defaultContexts.map((defaultContext) => {
return React.createContext(defaultContext);
});
return function useScope(scope) {
const contexts = scope?.[scopeName] || scopeContexts;
return React.useMemo(
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
[scope, contexts]
);
};
};
createScope.scopeName = scopeName;
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
}
function composeContextScopes(...scopes) {
const baseScope = scopes[0];
if (scopes.length === 1) return baseScope;
const createScope = () => {
const scopeHooks = scopes.map((createScope2) => ({
useScope: createScope2(),
scopeName: createScope2.scopeName
}));
return function useComposedScopes(overrideScopes) {
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
const scopeProps = useScope(overrideScopes);
const currentScope = scopeProps[`__scope${scopeName}`];
return { ...nextScopes2, ...currentScope };
}, {});
return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
};
};
createScope.scopeName = baseScope.scopeName;
return createScope;
}
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,81 @@
// packages/react/context/src/createContext.tsx
import * as React from "react";
import { jsx } from "react/jsx-runtime";
function createContext2(rootComponentName, defaultContext) {
const Context = React.createContext(defaultContext);
function Provider(props) {
const { children, ...context } = props;
const value = React.useMemo(() => context, Object.values(context));
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
}
function useContext2(consumerName) {
const context = React.useContext(Context);
if (context) return context;
if (defaultContext !== void 0) return defaultContext;
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
}
Provider.displayName = rootComponentName + "Provider";
return [Provider, useContext2];
}
function createContextScope(scopeName, createContextScopeDeps = []) {
let defaultContexts = [];
function createContext3(rootComponentName, defaultContext) {
const BaseContext = React.createContext(defaultContext);
const index = defaultContexts.length;
defaultContexts = [...defaultContexts, defaultContext];
function Provider(props) {
const { scope, children, ...context } = props;
const Context = scope?.[scopeName][index] || BaseContext;
const value = React.useMemo(() => context, Object.values(context));
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
}
function useContext2(consumerName, scope) {
const Context = scope?.[scopeName][index] || BaseContext;
const context = React.useContext(Context);
if (context) return context;
if (defaultContext !== void 0) return defaultContext;
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
}
Provider.displayName = rootComponentName + "Provider";
return [Provider, useContext2];
}
const createScope = () => {
const scopeContexts = defaultContexts.map((defaultContext) => {
return React.createContext(defaultContext);
});
return function useScope(scope) {
const contexts = scope?.[scopeName] || scopeContexts;
return React.useMemo(
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
[scope, contexts]
);
};
};
createScope.scopeName = scopeName;
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
}
function composeContextScopes(...scopes) {
const baseScope = scopes[0];
if (scopes.length === 1) return baseScope;
const createScope = () => {
const scopeHooks = scopes.map((createScope2) => ({
useScope: createScope2(),
scopeName: createScope2.scopeName
}));
return function useComposedScopes(overrideScopes) {
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
const scopeProps = useScope(overrideScopes);
const currentScope = scopeProps[`__scope${scopeName}`];
return { ...nextScopes2, ...currentScope };
}, {});
return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
};
};
createScope.scopeName = baseScope.scopeName;
return createScope;
}
export {
createContext2 as createContext,
createContextScope
};
//# sourceMappingURL=index.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,47 @@
{
"name": "@radix-ui/react-context",
"version": "1.1.0",
"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 || ^19.0 || ^19.0.0-rc"
},
"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"
}
}

58
node_modules/@radix-ui/react-collection/package.json generated vendored Normal file
View File

@@ -0,0 +1,58 @@
{
"name": "@radix-ui/react-collection",
"version": "1.1.0",
"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": {
"@radix-ui/react-compose-refs": "1.1.0",
"@radix-ui/react-context": "1.1.0",
"@radix-ui/react-primitive": "2.0.0",
"@radix-ui/react-slot": "1.1.0"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"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
node_modules/@radix-ui/react-compose-refs/README.md generated vendored Normal file
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,15 @@
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)
*/
declare function composeRefs<T>(...refs: PossibleRef<T>[]): (node: T) => void;
/**
* A custom hook that composes multiple refs
* Accepts callback refs and RefObject(s)
*/
declare function useComposedRefs<T>(...refs: PossibleRef<T>[]): (node: T) => void;
export { composeRefs, useComposedRefs };

View File

@@ -0,0 +1,15 @@
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)
*/
declare function composeRefs<T>(...refs: PossibleRef<T>[]): (node: T) => void;
/**
* A custom hook that composes multiple refs
* Accepts callback refs and RefObject(s)
*/
declare function useComposedRefs<T>(...refs: PossibleRef<T>[]): (node: T) => void;
export { composeRefs, useComposedRefs };

View File

@@ -0,0 +1,53 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/react/compose-refs/src/index.ts
var src_exports = {};
__export(src_exports, {
composeRefs: () => composeRefs,
useComposedRefs: () => useComposedRefs
});
module.exports = __toCommonJS(src_exports);
// packages/react/compose-refs/src/composeRefs.tsx
var React = __toESM(require("react"));
function setRef(ref, value) {
if (typeof ref === "function") {
ref(value);
} else if (ref !== null && ref !== void 0) {
ref.current = value;
}
}
function composeRefs(...refs) {
return (node) => refs.forEach((ref) => setRef(ref, node));
}
function useComposedRefs(...refs) {
return React.useCallback(composeRefs(...refs), refs);
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/index.ts", "../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"],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AAQvB,SAAS,OAAU,KAAqB,OAAU;AAChD,MAAI,OAAO,QAAQ,YAAY;AAC7B,QAAI,KAAK;AAAA,EACX,WAAW,QAAQ,QAAQ,QAAQ,QAAW;AAC5C,IAAC,IAAkC,UAAU;AAAA,EAC/C;AACF;AAMA,SAAS,eAAkB,MAAwB;AACjD,SAAO,CAAC,SAAY,KAAK,QAAQ,CAAC,QAAQ,OAAO,KAAK,IAAI,CAAC;AAC7D;AAMA,SAAS,mBAAsB,MAAwB;AAErD,SAAa,kBAAY,YAAY,GAAG,IAAI,GAAG,IAAI;AACrD;",
"names": []
}

View File

@@ -0,0 +1,20 @@
// packages/react/compose-refs/src/composeRefs.tsx
import * as React from "react";
function setRef(ref, value) {
if (typeof ref === "function") {
ref(value);
} else if (ref !== null && ref !== void 0) {
ref.current = value;
}
}
function composeRefs(...refs) {
return (node) => refs.forEach((ref) => setRef(ref, node));
}
function useComposedRefs(...refs) {
return React.useCallback(composeRefs(...refs), refs);
}
export {
composeRefs,
useComposedRefs
};
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/composeRefs.tsx"],
"sourcesContent": ["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"],
"mappings": ";AAAA,YAAY,WAAW;AAQvB,SAAS,OAAU,KAAqB,OAAU;AAChD,MAAI,OAAO,QAAQ,YAAY;AAC7B,QAAI,KAAK;AAAA,EACX,WAAW,QAAQ,QAAQ,QAAQ,QAAW;AAC5C,IAAC,IAAkC,UAAU;AAAA,EAC/C;AACF;AAMA,SAAS,eAAkB,MAAwB;AACjD,SAAO,CAAC,SAAY,KAAK,QAAQ,CAAC,QAAQ,OAAO,KAAK,IAAI,CAAC;AAC7D;AAMA,SAAS,mBAAsB,MAAwB;AAErD,SAAa,kBAAY,YAAY,GAAG,IAAI,GAAG,IAAI;AACrD;",
"names": []
}

47
node_modules/@radix-ui/react-compose-refs/package.json generated vendored Normal file
View File

@@ -0,0 +1,47 @@
{
"name": "@radix-ui/react-compose-refs",
"version": "1.1.0",
"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 || ^19.0 || ^19.0.0-rc"
},
"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"
}
}

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