Initial commit — BMP Website 2026
Vollständiges Redesign mit Gold-Formularen, BMP-Logo, multi-step Forms (Bewerbung, Kontakt, Sponsoring), Netlify-Deployment. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
13
node_modules/@radix-ui/number/README.md
generated
vendored
Normal file
13
node_modules/@radix-ui/number/README.md
generated
vendored
Normal 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
3
node_modules/@radix-ui/number/dist/index.d.mts
generated
vendored
Normal 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
3
node_modules/@radix-ui/number/dist/index.d.ts
generated
vendored
Normal 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
31
node_modules/@radix-ui/number/dist/index.js
generated
vendored
Normal 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 index_exports = {};
|
||||
__export(index_exports, {
|
||||
clamp: () => clamp
|
||||
});
|
||||
module.exports = __toCommonJS(index_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
7
node_modules/@radix-ui/number/dist/index.js.map
generated
vendored
Normal 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
8
node_modules/@radix-ui/number/dist/index.mjs
generated
vendored
Normal 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
7
node_modules/@radix-ui/number/dist/index.mjs.map
generated
vendored
Normal 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": []
|
||||
}
|
||||
62
node_modules/@radix-ui/number/package.json
generated
vendored
Normal file
62
node_modules/@radix-ui/number/package.json
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"name": "@radix-ui/number",
|
||||
"version": "1.1.1",
|
||||
"license": "MIT",
|
||||
"source": "./src/index.ts",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"publishConfig": {
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"README.md"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"lint": "eslint --max-warnings 0 src",
|
||||
"clean": "rm -rf dist",
|
||||
"version": "yarn version"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@repo/eslint-config": "0.0.0",
|
||||
"@repo/typescript-config": "0.0.0",
|
||||
"eslint": "^9.18.0",
|
||||
"typescript": "^5.7.3"
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"types": "./dist/index.d.ts"
|
||||
}
|
||||
21
node_modules/@radix-ui/primitive/LICENSE
generated
vendored
Normal file
21
node_modules/@radix-ui/primitive/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 WorkOS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
3
node_modules/@radix-ui/primitive/README.md
generated
vendored
Normal file
3
node_modules/@radix-ui/primitive/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# `primitive`
|
||||
|
||||
This is an internal utility, not intended for public usage.
|
||||
20
node_modules/@radix-ui/primitive/dist/index.d.mts
generated
vendored
Normal file
20
node_modules/@radix-ui/primitive/dist/index.d.mts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
declare const canUseDOM: boolean;
|
||||
declare function composeEventHandlers<E extends {
|
||||
defaultPrevented: boolean;
|
||||
}>(originalEventHandler?: (event: E) => void, ourEventHandler?: (event: E) => void, { checkForDefaultPrevented }?: {
|
||||
checkForDefaultPrevented?: boolean | undefined;
|
||||
}): (event: E) => void;
|
||||
declare function getOwnerWindow(element: Node | null | undefined): Window & typeof globalThis;
|
||||
declare function getOwnerDocument(element: Node | null | undefined): Document;
|
||||
/**
|
||||
* Lifted from https://github.com/ariakit/ariakit/blob/main/packages/ariakit-core/src/utils/dom.ts#L37
|
||||
* MIT License, Copyright (c) AriaKit.
|
||||
*/
|
||||
declare function getActiveElement(node: Node | null | undefined, activeDescendant?: boolean): HTMLElement | null;
|
||||
declare function isFrame(element: Element): element is HTMLIFrameElement;
|
||||
|
||||
type Timeout = ReturnType<typeof setTimeout>;
|
||||
type Interval = ReturnType<typeof setInterval>;
|
||||
type Immediate = ReturnType<typeof setImmediate>;
|
||||
|
||||
export { type Immediate, type Interval, type Timeout, canUseDOM, composeEventHandlers, getActiveElement, getOwnerDocument, getOwnerWindow, isFrame };
|
||||
20
node_modules/@radix-ui/primitive/dist/index.d.ts
generated
vendored
Normal file
20
node_modules/@radix-ui/primitive/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
declare const canUseDOM: boolean;
|
||||
declare function composeEventHandlers<E extends {
|
||||
defaultPrevented: boolean;
|
||||
}>(originalEventHandler?: (event: E) => void, ourEventHandler?: (event: E) => void, { checkForDefaultPrevented }?: {
|
||||
checkForDefaultPrevented?: boolean | undefined;
|
||||
}): (event: E) => void;
|
||||
declare function getOwnerWindow(element: Node | null | undefined): Window & typeof globalThis;
|
||||
declare function getOwnerDocument(element: Node | null | undefined): Document;
|
||||
/**
|
||||
* Lifted from https://github.com/ariakit/ariakit/blob/main/packages/ariakit-core/src/utils/dom.ts#L37
|
||||
* MIT License, Copyright (c) AriaKit.
|
||||
*/
|
||||
declare function getActiveElement(node: Node | null | undefined, activeDescendant?: boolean): HTMLElement | null;
|
||||
declare function isFrame(element: Element): element is HTMLIFrameElement;
|
||||
|
||||
type Timeout = ReturnType<typeof setTimeout>;
|
||||
type Interval = ReturnType<typeof setInterval>;
|
||||
type Immediate = ReturnType<typeof setImmediate>;
|
||||
|
||||
export { type Immediate, type Interval, type Timeout, canUseDOM, composeEventHandlers, getActiveElement, getOwnerDocument, getOwnerWindow, isFrame };
|
||||
76
node_modules/@radix-ui/primitive/dist/index.js
generated
vendored
Normal file
76
node_modules/@radix-ui/primitive/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
"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);
|
||||
|
||||
// src/index.ts
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
canUseDOM: () => canUseDOM,
|
||||
composeEventHandlers: () => composeEventHandlers,
|
||||
getActiveElement: () => getActiveElement,
|
||||
getOwnerDocument: () => getOwnerDocument,
|
||||
getOwnerWindow: () => getOwnerWindow,
|
||||
isFrame: () => isFrame
|
||||
});
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
|
||||
// src/primitive.tsx
|
||||
var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
|
||||
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
||||
return function handleEvent(event) {
|
||||
originalEventHandler?.(event);
|
||||
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
||||
return ourEventHandler?.(event);
|
||||
}
|
||||
};
|
||||
}
|
||||
function getOwnerWindow(element) {
|
||||
if (!canUseDOM) {
|
||||
throw new Error("Cannot access window outside of the DOM");
|
||||
}
|
||||
return element?.ownerDocument?.defaultView ?? window;
|
||||
}
|
||||
function getOwnerDocument(element) {
|
||||
if (!canUseDOM) {
|
||||
throw new Error("Cannot access document outside of the DOM");
|
||||
}
|
||||
return element?.ownerDocument ?? document;
|
||||
}
|
||||
function getActiveElement(node, activeDescendant = false) {
|
||||
const { activeElement } = getOwnerDocument(node);
|
||||
if (!activeElement?.nodeName) {
|
||||
return null;
|
||||
}
|
||||
if (isFrame(activeElement) && activeElement.contentDocument) {
|
||||
return getActiveElement(activeElement.contentDocument.body, activeDescendant);
|
||||
}
|
||||
if (activeDescendant) {
|
||||
const id = activeElement.getAttribute("aria-activedescendant");
|
||||
if (id) {
|
||||
const element = getOwnerDocument(activeElement).getElementById(id);
|
||||
if (element) {
|
||||
return element;
|
||||
}
|
||||
}
|
||||
}
|
||||
return activeElement;
|
||||
}
|
||||
function isFrame(element) {
|
||||
return element.tagName === "IFRAME";
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
7
node_modules/@radix-ui/primitive/dist/index.js.map
generated
vendored
Normal file
7
node_modules/@radix-ui/primitive/dist/index.js.map
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../src/index.ts", "../src/primitive.tsx"],
|
||||
"sourcesContent": ["export * from './primitive';\nexport type * from './types';\n", "/* eslint-disable no-restricted-properties */\n\n/* eslint-disable no-restricted-globals */\nexport const canUseDOM = !!(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement\n);\n/* eslint-enable no-restricted-globals */\n\nexport function composeEventHandlers<E extends { defaultPrevented: boolean }>(\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.defaultPrevented) {\n return ourEventHandler?.(event);\n }\n };\n}\n\nexport function getOwnerWindow(element: Node | null | undefined) {\n if (!canUseDOM) {\n throw new Error('Cannot access window outside of the DOM');\n }\n // eslint-disable-next-line no-restricted-globals\n return element?.ownerDocument?.defaultView ?? window;\n}\n\nexport function getOwnerDocument(element: Node | null | undefined) {\n if (!canUseDOM) {\n throw new Error('Cannot access document outside of the DOM');\n }\n // eslint-disable-next-line no-restricted-globals\n return element?.ownerDocument ?? document;\n}\n\n/**\n * Lifted from https://github.com/ariakit/ariakit/blob/main/packages/ariakit-core/src/utils/dom.ts#L37\n * MIT License, Copyright (c) AriaKit.\n */\nexport function getActiveElement(\n node: Node | null | undefined,\n activeDescendant = false\n): HTMLElement | null {\n const { activeElement } = getOwnerDocument(node);\n if (!activeElement?.nodeName) {\n // `activeElement` might be an empty object if we're interacting with elements\n // inside of an iframe.\n return null;\n }\n\n if (isFrame(activeElement) && activeElement.contentDocument) {\n return getActiveElement(activeElement.contentDocument.body, activeDescendant);\n }\n\n if (activeDescendant) {\n const id = activeElement.getAttribute('aria-activedescendant');\n if (id) {\n const element = getOwnerDocument(activeElement).getElementById(id);\n if (element) {\n return element;\n }\n }\n }\n\n return activeElement as HTMLElement | null;\n}\n\nexport function isFrame(element: Element): element is HTMLIFrameElement {\n return element.tagName === 'IFRAME';\n}\n"],
|
||||
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGO,IAAM,YAAY,CAAC,EACxB,OAAO,WAAW,eAClB,OAAO,YACP,OAAO,SAAS;AAIX,SAAS,qBACd,sBACA,iBACA,EAAE,2BAA2B,KAAK,IAAI,CAAC,GACvC;AACA,SAAO,SAAS,YAAY,OAAU;AACpC,2BAAuB,KAAK;AAE5B,QAAI,6BAA6B,SAAS,CAAC,MAAM,kBAAkB;AACjE,aAAO,kBAAkB,KAAK;AAAA,IAChC;AAAA,EACF;AACF;AAEO,SAAS,eAAe,SAAkC;AAC/D,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,MAAM,yCAAyC;AAAA,EAC3D;AAEA,SAAO,SAAS,eAAe,eAAe;AAChD;AAEO,SAAS,iBAAiB,SAAkC;AACjE,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,MAAM,2CAA2C;AAAA,EAC7D;AAEA,SAAO,SAAS,iBAAiB;AACnC;AAMO,SAAS,iBACd,MACA,mBAAmB,OACC;AACpB,QAAM,EAAE,cAAc,IAAI,iBAAiB,IAAI;AAC/C,MAAI,CAAC,eAAe,UAAU;AAG5B,WAAO;AAAA,EACT;AAEA,MAAI,QAAQ,aAAa,KAAK,cAAc,iBAAiB;AAC3D,WAAO,iBAAiB,cAAc,gBAAgB,MAAM,gBAAgB;AAAA,EAC9E;AAEA,MAAI,kBAAkB;AACpB,UAAM,KAAK,cAAc,aAAa,uBAAuB;AAC7D,QAAI,IAAI;AACN,YAAM,UAAU,iBAAiB,aAAa,EAAE,eAAe,EAAE;AACjE,UAAI,SAAS;AACX,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAEO,SAAS,QAAQ,SAAgD;AACtE,SAAO,QAAQ,YAAY;AAC7B;",
|
||||
"names": []
|
||||
}
|
||||
53
node_modules/@radix-ui/primitive/dist/index.mjs
generated
vendored
Normal file
53
node_modules/@radix-ui/primitive/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
// src/primitive.tsx
|
||||
var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
|
||||
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
||||
return function handleEvent(event) {
|
||||
originalEventHandler?.(event);
|
||||
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
||||
return ourEventHandler?.(event);
|
||||
}
|
||||
};
|
||||
}
|
||||
function getOwnerWindow(element) {
|
||||
if (!canUseDOM) {
|
||||
throw new Error("Cannot access window outside of the DOM");
|
||||
}
|
||||
return element?.ownerDocument?.defaultView ?? window;
|
||||
}
|
||||
function getOwnerDocument(element) {
|
||||
if (!canUseDOM) {
|
||||
throw new Error("Cannot access document outside of the DOM");
|
||||
}
|
||||
return element?.ownerDocument ?? document;
|
||||
}
|
||||
function getActiveElement(node, activeDescendant = false) {
|
||||
const { activeElement } = getOwnerDocument(node);
|
||||
if (!activeElement?.nodeName) {
|
||||
return null;
|
||||
}
|
||||
if (isFrame(activeElement) && activeElement.contentDocument) {
|
||||
return getActiveElement(activeElement.contentDocument.body, activeDescendant);
|
||||
}
|
||||
if (activeDescendant) {
|
||||
const id = activeElement.getAttribute("aria-activedescendant");
|
||||
if (id) {
|
||||
const element = getOwnerDocument(activeElement).getElementById(id);
|
||||
if (element) {
|
||||
return element;
|
||||
}
|
||||
}
|
||||
}
|
||||
return activeElement;
|
||||
}
|
||||
function isFrame(element) {
|
||||
return element.tagName === "IFRAME";
|
||||
}
|
||||
export {
|
||||
canUseDOM,
|
||||
composeEventHandlers,
|
||||
getActiveElement,
|
||||
getOwnerDocument,
|
||||
getOwnerWindow,
|
||||
isFrame
|
||||
};
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
7
node_modules/@radix-ui/primitive/dist/index.mjs.map
generated
vendored
Normal file
7
node_modules/@radix-ui/primitive/dist/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../src/primitive.tsx"],
|
||||
"sourcesContent": ["/* eslint-disable no-restricted-properties */\n\n/* eslint-disable no-restricted-globals */\nexport const canUseDOM = !!(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement\n);\n/* eslint-enable no-restricted-globals */\n\nexport function composeEventHandlers<E extends { defaultPrevented: boolean }>(\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.defaultPrevented) {\n return ourEventHandler?.(event);\n }\n };\n}\n\nexport function getOwnerWindow(element: Node | null | undefined) {\n if (!canUseDOM) {\n throw new Error('Cannot access window outside of the DOM');\n }\n // eslint-disable-next-line no-restricted-globals\n return element?.ownerDocument?.defaultView ?? window;\n}\n\nexport function getOwnerDocument(element: Node | null | undefined) {\n if (!canUseDOM) {\n throw new Error('Cannot access document outside of the DOM');\n }\n // eslint-disable-next-line no-restricted-globals\n return element?.ownerDocument ?? document;\n}\n\n/**\n * Lifted from https://github.com/ariakit/ariakit/blob/main/packages/ariakit-core/src/utils/dom.ts#L37\n * MIT License, Copyright (c) AriaKit.\n */\nexport function getActiveElement(\n node: Node | null | undefined,\n activeDescendant = false\n): HTMLElement | null {\n const { activeElement } = getOwnerDocument(node);\n if (!activeElement?.nodeName) {\n // `activeElement` might be an empty object if we're interacting with elements\n // inside of an iframe.\n return null;\n }\n\n if (isFrame(activeElement) && activeElement.contentDocument) {\n return getActiveElement(activeElement.contentDocument.body, activeDescendant);\n }\n\n if (activeDescendant) {\n const id = activeElement.getAttribute('aria-activedescendant');\n if (id) {\n const element = getOwnerDocument(activeElement).getElementById(id);\n if (element) {\n return element;\n }\n }\n }\n\n return activeElement as HTMLElement | null;\n}\n\nexport function isFrame(element: Element): element is HTMLIFrameElement {\n return element.tagName === 'IFRAME';\n}\n"],
|
||||
"mappings": ";AAGO,IAAM,YAAY,CAAC,EACxB,OAAO,WAAW,eAClB,OAAO,YACP,OAAO,SAAS;AAIX,SAAS,qBACd,sBACA,iBACA,EAAE,2BAA2B,KAAK,IAAI,CAAC,GACvC;AACA,SAAO,SAAS,YAAY,OAAU;AACpC,2BAAuB,KAAK;AAE5B,QAAI,6BAA6B,SAAS,CAAC,MAAM,kBAAkB;AACjE,aAAO,kBAAkB,KAAK;AAAA,IAChC;AAAA,EACF;AACF;AAEO,SAAS,eAAe,SAAkC;AAC/D,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,MAAM,yCAAyC;AAAA,EAC3D;AAEA,SAAO,SAAS,eAAe,eAAe;AAChD;AAEO,SAAS,iBAAiB,SAAkC;AACjE,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,MAAM,2CAA2C;AAAA,EAC7D;AAEA,SAAO,SAAS,iBAAiB;AACnC;AAMO,SAAS,iBACd,MACA,mBAAmB,OACC;AACpB,QAAM,EAAE,cAAc,IAAI,iBAAiB,IAAI;AAC/C,MAAI,CAAC,eAAe,UAAU;AAG5B,WAAO;AAAA,EACT;AAEA,MAAI,QAAQ,aAAa,KAAK,cAAc,iBAAiB;AAC3D,WAAO,iBAAiB,cAAc,gBAAgB,MAAM,gBAAgB;AAAA,EAC9E;AAEA,MAAI,kBAAkB;AACpB,UAAM,KAAK,cAAc,aAAa,uBAAuB;AAC7D,QAAI,IAAI;AACN,YAAM,UAAU,iBAAiB,aAAa,EAAE,eAAe,EAAE;AACjE,UAAI,SAAS;AACX,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAEO,SAAS,QAAQ,SAAgD;AACtE,SAAO,QAAQ,YAAY;AAC7B;",
|
||||
"names": []
|
||||
}
|
||||
47
node_modules/@radix-ui/primitive/package.json
generated
vendored
Normal file
47
node_modules/@radix-ui/primitive/package.json
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "@radix-ui/primitive",
|
||||
"version": "1.1.3",
|
||||
"license": "MIT",
|
||||
"source": "./src/index.ts",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"files": [
|
||||
"dist",
|
||||
"README.md"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"devDependencies": {
|
||||
"eslint": "^9.18.0",
|
||||
"typescript": "^5.7.3",
|
||||
"@repo/builder": "0.0.0",
|
||||
"@repo/typescript-config": "0.0.0",
|
||||
"@repo/eslint-config": "0.0.0"
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --max-warnings 0 src",
|
||||
"clean": "rm -rf dist",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"build": "radix-build"
|
||||
},
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
node_modules/@radix-ui/react-arrow/LICENSE
generated
vendored
Normal file
21
node_modules/@radix-ui/react-arrow/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 WorkOS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
3
node_modules/@radix-ui/react-arrow/README.md
generated
vendored
Normal file
3
node_modules/@radix-ui/react-arrow/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# `react-arrow`
|
||||
|
||||
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
10
node_modules/@radix-ui/react-arrow/dist/index.d.mts
generated
vendored
Normal 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
10
node_modules/@radix-ui/react-arrow/dist/index.d.ts
generated
vendored
Normal 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
60
node_modules/@radix-ui/react-arrow/dist/index.js
generated
vendored
Normal 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);
|
||||
|
||||
// src/index.ts
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
Arrow: () => Arrow,
|
||||
Root: () => Root
|
||||
});
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
|
||||
// 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
7
node_modules/@radix-ui/react-arrow/dist/index.js.map
generated
vendored
Normal 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.ComponentRef<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
27
node_modules/@radix-ui/react-arrow/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
// 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
|
||||
7
node_modules/@radix-ui/react-arrow/dist/index.mjs.map
generated
vendored
Normal file
7
node_modules/@radix-ui/react-arrow/dist/index.mjs.map
generated
vendored
Normal 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.ComponentRef<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": []
|
||||
}
|
||||
68
node_modules/@radix-ui/react-arrow/package.json
generated
vendored
Normal file
68
node_modules/@radix-ui/react-arrow/package.json
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"name": "@radix-ui/react-arrow",
|
||||
"version": "1.1.7",
|
||||
"license": "MIT",
|
||||
"source": "./src/index.ts",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"files": [
|
||||
"dist",
|
||||
"README.md"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-primitive": "2.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^19.0.7",
|
||||
"@types/react-dom": "^19.0.3",
|
||||
"eslint": "^9.18.0",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"typescript": "^5.7.3",
|
||||
"@repo/builder": "0.0.0",
|
||||
"@repo/typescript-config": "0.0.0",
|
||||
"@repo/eslint-config": "0.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"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --max-warnings 0 src",
|
||||
"clean": "rm -rf dist",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"build": "radix-build"
|
||||
},
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
node_modules/@radix-ui/react-checkbox/LICENSE
generated
vendored
Normal file
21
node_modules/@radix-ui/react-checkbox/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 WorkOS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
3
node_modules/@radix-ui/react-checkbox/README.md
generated
vendored
Normal file
3
node_modules/@radix-ui/react-checkbox/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# `react-checkbox`
|
||||
|
||||
View docs [here](https://radix-ui.com/primitives/docs/components/checkbox).
|
||||
50
node_modules/@radix-ui/react-checkbox/dist/index.d.mts
generated
vendored
Normal file
50
node_modules/@radix-ui/react-checkbox/dist/index.d.mts
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
import * as react_jsx_runtime from 'react/jsx-runtime';
|
||||
import * as _radix_ui_react_context from '@radix-ui/react-context';
|
||||
import { Scope } from '@radix-ui/react-context';
|
||||
import * as React from 'react';
|
||||
import { Primitive } from '@radix-ui/react-primitive';
|
||||
|
||||
type ScopedProps<P> = P & {
|
||||
__scopeCheckbox?: Scope;
|
||||
};
|
||||
declare const createCheckboxScope: _radix_ui_react_context.CreateScope;
|
||||
type CheckedState = boolean | 'indeterminate';
|
||||
interface CheckboxProviderProps<State extends CheckedState = CheckedState> {
|
||||
checked?: State | boolean;
|
||||
defaultChecked?: State | boolean;
|
||||
required?: boolean;
|
||||
onCheckedChange?(checked: State | boolean): void;
|
||||
name?: string;
|
||||
form?: string;
|
||||
disabled?: boolean;
|
||||
value?: string | number | readonly string[];
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
declare function CheckboxProvider<State extends CheckedState = CheckedState>(props: ScopedProps<CheckboxProviderProps<State>>): react_jsx_runtime.JSX.Element;
|
||||
interface CheckboxTriggerProps extends Omit<React.ComponentPropsWithoutRef<typeof Primitive.button>, keyof CheckboxProviderProps> {
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
declare const CheckboxTrigger: React.ForwardRefExoticComponent<CheckboxTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
||||
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>>;
|
||||
type InputProps = React.ComponentPropsWithoutRef<typeof Primitive.input>;
|
||||
interface CheckboxBubbleInputProps extends Omit<InputProps, 'checked'> {
|
||||
}
|
||||
declare const CheckboxBubbleInput: React.ForwardRefExoticComponent<CheckboxBubbleInputProps & React.RefAttributes<HTMLInputElement>>;
|
||||
|
||||
export { Checkbox, CheckboxIndicator, type CheckboxIndicatorProps, type CheckboxProps, type CheckedState, CheckboxIndicator as Indicator, Checkbox as Root, createCheckboxScope, CheckboxBubbleInput as unstable_BubbleInput, CheckboxBubbleInput as unstable_CheckboxBubbleInput, type CheckboxBubbleInputProps as unstable_CheckboxBubbleInputProps, CheckboxProvider as unstable_CheckboxProvider, type CheckboxProviderProps as unstable_CheckboxProviderProps, CheckboxTrigger as unstable_CheckboxTrigger, type CheckboxTriggerProps as unstable_CheckboxTriggerProps, CheckboxProvider as unstable_Provider, CheckboxTrigger as unstable_Trigger };
|
||||
50
node_modules/@radix-ui/react-checkbox/dist/index.d.ts
generated
vendored
Normal file
50
node_modules/@radix-ui/react-checkbox/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
import * as react_jsx_runtime from 'react/jsx-runtime';
|
||||
import * as _radix_ui_react_context from '@radix-ui/react-context';
|
||||
import { Scope } from '@radix-ui/react-context';
|
||||
import * as React from 'react';
|
||||
import { Primitive } from '@radix-ui/react-primitive';
|
||||
|
||||
type ScopedProps<P> = P & {
|
||||
__scopeCheckbox?: Scope;
|
||||
};
|
||||
declare const createCheckboxScope: _radix_ui_react_context.CreateScope;
|
||||
type CheckedState = boolean | 'indeterminate';
|
||||
interface CheckboxProviderProps<State extends CheckedState = CheckedState> {
|
||||
checked?: State | boolean;
|
||||
defaultChecked?: State | boolean;
|
||||
required?: boolean;
|
||||
onCheckedChange?(checked: State | boolean): void;
|
||||
name?: string;
|
||||
form?: string;
|
||||
disabled?: boolean;
|
||||
value?: string | number | readonly string[];
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
declare function CheckboxProvider<State extends CheckedState = CheckedState>(props: ScopedProps<CheckboxProviderProps<State>>): react_jsx_runtime.JSX.Element;
|
||||
interface CheckboxTriggerProps extends Omit<React.ComponentPropsWithoutRef<typeof Primitive.button>, keyof CheckboxProviderProps> {
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
declare const CheckboxTrigger: React.ForwardRefExoticComponent<CheckboxTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
||||
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>>;
|
||||
type InputProps = React.ComponentPropsWithoutRef<typeof Primitive.input>;
|
||||
interface CheckboxBubbleInputProps extends Omit<InputProps, 'checked'> {
|
||||
}
|
||||
declare const CheckboxBubbleInput: React.ForwardRefExoticComponent<CheckboxBubbleInputProps & React.RefAttributes<HTMLInputElement>>;
|
||||
|
||||
export { Checkbox, CheckboxIndicator, type CheckboxIndicatorProps, type CheckboxProps, type CheckedState, CheckboxIndicator as Indicator, Checkbox as Root, createCheckboxScope, CheckboxBubbleInput as unstable_BubbleInput, CheckboxBubbleInput as unstable_CheckboxBubbleInput, type CheckboxBubbleInputProps as unstable_CheckboxBubbleInputProps, CheckboxProvider as unstable_CheckboxProvider, type CheckboxProviderProps as unstable_CheckboxProviderProps, CheckboxTrigger as unstable_CheckboxTrigger, type CheckboxTriggerProps as unstable_CheckboxTriggerProps, CheckboxProvider as unstable_Provider, CheckboxTrigger as unstable_Trigger };
|
||||
316
node_modules/@radix-ui/react-checkbox/dist/index.js
generated
vendored
Normal file
316
node_modules/@radix-ui/react-checkbox/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,316 @@
|
||||
"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);
|
||||
|
||||
// src/index.ts
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
Checkbox: () => Checkbox,
|
||||
CheckboxIndicator: () => CheckboxIndicator,
|
||||
Indicator: () => CheckboxIndicator,
|
||||
Root: () => Checkbox,
|
||||
createCheckboxScope: () => createCheckboxScope,
|
||||
unstable_BubbleInput: () => CheckboxBubbleInput,
|
||||
unstable_CheckboxBubbleInput: () => CheckboxBubbleInput,
|
||||
unstable_CheckboxProvider: () => CheckboxProvider,
|
||||
unstable_CheckboxTrigger: () => CheckboxTrigger,
|
||||
unstable_Provider: () => CheckboxProvider,
|
||||
unstable_Trigger: () => CheckboxTrigger
|
||||
});
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
|
||||
// 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 [CheckboxProviderImpl, useCheckboxContext] = createCheckboxContext(CHECKBOX_NAME);
|
||||
function CheckboxProvider(props) {
|
||||
const {
|
||||
__scopeCheckbox,
|
||||
checked: checkedProp,
|
||||
children,
|
||||
defaultChecked,
|
||||
disabled,
|
||||
form,
|
||||
name,
|
||||
onCheckedChange,
|
||||
required,
|
||||
value = "on",
|
||||
// @ts-expect-error
|
||||
internal_do_not_use_render
|
||||
} = props;
|
||||
const [checked, setChecked] = (0, import_react_use_controllable_state.useControllableState)({
|
||||
prop: checkedProp,
|
||||
defaultProp: defaultChecked ?? false,
|
||||
onChange: onCheckedChange,
|
||||
caller: CHECKBOX_NAME
|
||||
});
|
||||
const [control, setControl] = React.useState(null);
|
||||
const [bubbleInput, setBubbleInput] = React.useState(null);
|
||||
const hasConsumerStoppedPropagationRef = React.useRef(false);
|
||||
const isFormControl = control ? !!form || !!control.closest("form") : (
|
||||
// We set this to true by default so that events bubble to forms without JS (SSR)
|
||||
true
|
||||
);
|
||||
const context = {
|
||||
checked,
|
||||
disabled,
|
||||
setChecked,
|
||||
control,
|
||||
setControl,
|
||||
name,
|
||||
form,
|
||||
value,
|
||||
hasConsumerStoppedPropagationRef,
|
||||
required,
|
||||
defaultChecked: isIndeterminate(defaultChecked) ? false : defaultChecked,
|
||||
isFormControl,
|
||||
bubbleInput,
|
||||
setBubbleInput
|
||||
};
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
CheckboxProviderImpl,
|
||||
{
|
||||
scope: __scopeCheckbox,
|
||||
...context,
|
||||
children: isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children
|
||||
}
|
||||
);
|
||||
}
|
||||
var TRIGGER_NAME = "CheckboxTrigger";
|
||||
var CheckboxTrigger = React.forwardRef(
|
||||
({ __scopeCheckbox, onKeyDown, onClick, ...checkboxProps }, forwardedRef) => {
|
||||
const {
|
||||
control,
|
||||
value,
|
||||
disabled,
|
||||
checked,
|
||||
required,
|
||||
setControl,
|
||||
setChecked,
|
||||
hasConsumerStoppedPropagationRef,
|
||||
isFormControl,
|
||||
bubbleInput
|
||||
} = useCheckboxContext(TRIGGER_NAME, __scopeCheckbox);
|
||||
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, setControl);
|
||||
const initialCheckedStateRef = React.useRef(checked);
|
||||
React.useEffect(() => {
|
||||
const form = control?.form;
|
||||
if (form) {
|
||||
const reset = () => setChecked(initialCheckedStateRef.current);
|
||||
form.addEventListener("reset", reset);
|
||||
return () => form.removeEventListener("reset", reset);
|
||||
}
|
||||
}, [control, setChecked]);
|
||||
return /* @__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)(onKeyDown, (event) => {
|
||||
if (event.key === "Enter") event.preventDefault();
|
||||
}),
|
||||
onClick: (0, import_primitive.composeEventHandlers)(onClick, (event) => {
|
||||
setChecked((prevChecked) => isIndeterminate(prevChecked) ? true : !prevChecked);
|
||||
if (bubbleInput && isFormControl) {
|
||||
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
||||
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
||||
}
|
||||
})
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
CheckboxTrigger.displayName = TRIGGER_NAME;
|
||||
var Checkbox = React.forwardRef(
|
||||
(props, forwardedRef) => {
|
||||
const {
|
||||
__scopeCheckbox,
|
||||
name,
|
||||
checked,
|
||||
defaultChecked,
|
||||
required,
|
||||
disabled,
|
||||
value,
|
||||
onCheckedChange,
|
||||
form,
|
||||
...checkboxProps
|
||||
} = props;
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
CheckboxProvider,
|
||||
{
|
||||
__scopeCheckbox,
|
||||
checked,
|
||||
defaultChecked,
|
||||
disabled,
|
||||
required,
|
||||
onCheckedChange,
|
||||
name,
|
||||
form,
|
||||
value,
|
||||
internal_do_not_use_render: ({ isFormControl }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
CheckboxTrigger,
|
||||
{
|
||||
...checkboxProps,
|
||||
ref: forwardedRef,
|
||||
__scopeCheckbox
|
||||
}
|
||||
),
|
||||
isFormControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
CheckboxBubbleInput,
|
||||
{
|
||||
__scopeCheckbox
|
||||
}
|
||||
)
|
||||
] })
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
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.checked) || context.checked === true,
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_react_primitive.Primitive.span,
|
||||
{
|
||||
"data-state": getState(context.checked),
|
||||
"data-disabled": context.disabled ? "" : void 0,
|
||||
...indicatorProps,
|
||||
ref: forwardedRef,
|
||||
style: { pointerEvents: "none", ...props.style }
|
||||
}
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
CheckboxIndicator.displayName = INDICATOR_NAME;
|
||||
var BUBBLE_INPUT_NAME = "CheckboxBubbleInput";
|
||||
var CheckboxBubbleInput = React.forwardRef(
|
||||
({ __scopeCheckbox, ...props }, forwardedRef) => {
|
||||
const {
|
||||
control,
|
||||
hasConsumerStoppedPropagationRef,
|
||||
checked,
|
||||
defaultChecked,
|
||||
required,
|
||||
disabled,
|
||||
name,
|
||||
value,
|
||||
form,
|
||||
bubbleInput,
|
||||
setBubbleInput
|
||||
} = useCheckboxContext(BUBBLE_INPUT_NAME, __scopeCheckbox);
|
||||
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, setBubbleInput);
|
||||
const prevChecked = (0, import_react_use_previous.usePrevious)(checked);
|
||||
const controlSize = (0, import_react_use_size.useSize)(control);
|
||||
React.useEffect(() => {
|
||||
const input = bubbleInput;
|
||||
if (!input) return;
|
||||
const inputProto = window.HTMLInputElement.prototype;
|
||||
const descriptor = Object.getOwnPropertyDescriptor(
|
||||
inputProto,
|
||||
"checked"
|
||||
);
|
||||
const setChecked = descriptor.set;
|
||||
const bubbles = !hasConsumerStoppedPropagationRef.current;
|
||||
if (prevChecked !== checked && setChecked) {
|
||||
const event = new Event("click", { bubbles });
|
||||
input.indeterminate = isIndeterminate(checked);
|
||||
setChecked.call(input, isIndeterminate(checked) ? false : checked);
|
||||
input.dispatchEvent(event);
|
||||
}
|
||||
}, [bubbleInput, prevChecked, checked, hasConsumerStoppedPropagationRef]);
|
||||
const defaultCheckedRef = React.useRef(isIndeterminate(checked) ? false : checked);
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_react_primitive.Primitive.input,
|
||||
{
|
||||
type: "checkbox",
|
||||
"aria-hidden": true,
|
||||
defaultChecked: defaultChecked ?? defaultCheckedRef.current,
|
||||
required,
|
||||
disabled,
|
||||
name,
|
||||
value,
|
||||
form,
|
||||
...props,
|
||||
tabIndex: -1,
|
||||
ref: composedRefs,
|
||||
style: {
|
||||
...props.style,
|
||||
...controlSize,
|
||||
position: "absolute",
|
||||
pointerEvents: "none",
|
||||
opacity: 0,
|
||||
margin: 0,
|
||||
// We transform because the input is absolutely positioned but we have
|
||||
// rendered it **after** the button. This pulls it back to sit on top
|
||||
// of the button.
|
||||
transform: "translateX(-100%)"
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
CheckboxBubbleInput.displayName = BUBBLE_INPUT_NAME;
|
||||
function isFunction(value) {
|
||||
return typeof value === "function";
|
||||
}
|
||||
function isIndeterminate(checked) {
|
||||
return checked === "indeterminate";
|
||||
}
|
||||
function getState(checked) {
|
||||
return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
7
node_modules/@radix-ui/react-checkbox/dist/index.js.map
generated
vendored
Normal file
7
node_modules/@radix-ui/react-checkbox/dist/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
284
node_modules/@radix-ui/react-checkbox/dist/index.mjs
generated
vendored
Normal file
284
node_modules/@radix-ui/react-checkbox/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,284 @@
|
||||
"use client";
|
||||
|
||||
// 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 { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
||||
var CHECKBOX_NAME = "Checkbox";
|
||||
var [createCheckboxContext, createCheckboxScope] = createContextScope(CHECKBOX_NAME);
|
||||
var [CheckboxProviderImpl, useCheckboxContext] = createCheckboxContext(CHECKBOX_NAME);
|
||||
function CheckboxProvider(props) {
|
||||
const {
|
||||
__scopeCheckbox,
|
||||
checked: checkedProp,
|
||||
children,
|
||||
defaultChecked,
|
||||
disabled,
|
||||
form,
|
||||
name,
|
||||
onCheckedChange,
|
||||
required,
|
||||
value = "on",
|
||||
// @ts-expect-error
|
||||
internal_do_not_use_render
|
||||
} = props;
|
||||
const [checked, setChecked] = useControllableState({
|
||||
prop: checkedProp,
|
||||
defaultProp: defaultChecked ?? false,
|
||||
onChange: onCheckedChange,
|
||||
caller: CHECKBOX_NAME
|
||||
});
|
||||
const [control, setControl] = React.useState(null);
|
||||
const [bubbleInput, setBubbleInput] = React.useState(null);
|
||||
const hasConsumerStoppedPropagationRef = React.useRef(false);
|
||||
const isFormControl = control ? !!form || !!control.closest("form") : (
|
||||
// We set this to true by default so that events bubble to forms without JS (SSR)
|
||||
true
|
||||
);
|
||||
const context = {
|
||||
checked,
|
||||
disabled,
|
||||
setChecked,
|
||||
control,
|
||||
setControl,
|
||||
name,
|
||||
form,
|
||||
value,
|
||||
hasConsumerStoppedPropagationRef,
|
||||
required,
|
||||
defaultChecked: isIndeterminate(defaultChecked) ? false : defaultChecked,
|
||||
isFormControl,
|
||||
bubbleInput,
|
||||
setBubbleInput
|
||||
};
|
||||
return /* @__PURE__ */ jsx(
|
||||
CheckboxProviderImpl,
|
||||
{
|
||||
scope: __scopeCheckbox,
|
||||
...context,
|
||||
children: isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children
|
||||
}
|
||||
);
|
||||
}
|
||||
var TRIGGER_NAME = "CheckboxTrigger";
|
||||
var CheckboxTrigger = React.forwardRef(
|
||||
({ __scopeCheckbox, onKeyDown, onClick, ...checkboxProps }, forwardedRef) => {
|
||||
const {
|
||||
control,
|
||||
value,
|
||||
disabled,
|
||||
checked,
|
||||
required,
|
||||
setControl,
|
||||
setChecked,
|
||||
hasConsumerStoppedPropagationRef,
|
||||
isFormControl,
|
||||
bubbleInput
|
||||
} = useCheckboxContext(TRIGGER_NAME, __scopeCheckbox);
|
||||
const composedRefs = useComposedRefs(forwardedRef, setControl);
|
||||
const initialCheckedStateRef = React.useRef(checked);
|
||||
React.useEffect(() => {
|
||||
const form = control?.form;
|
||||
if (form) {
|
||||
const reset = () => setChecked(initialCheckedStateRef.current);
|
||||
form.addEventListener("reset", reset);
|
||||
return () => form.removeEventListener("reset", reset);
|
||||
}
|
||||
}, [control, setChecked]);
|
||||
return /* @__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(onKeyDown, (event) => {
|
||||
if (event.key === "Enter") event.preventDefault();
|
||||
}),
|
||||
onClick: composeEventHandlers(onClick, (event) => {
|
||||
setChecked((prevChecked) => isIndeterminate(prevChecked) ? true : !prevChecked);
|
||||
if (bubbleInput && isFormControl) {
|
||||
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
||||
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
||||
}
|
||||
})
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
CheckboxTrigger.displayName = TRIGGER_NAME;
|
||||
var Checkbox = React.forwardRef(
|
||||
(props, forwardedRef) => {
|
||||
const {
|
||||
__scopeCheckbox,
|
||||
name,
|
||||
checked,
|
||||
defaultChecked,
|
||||
required,
|
||||
disabled,
|
||||
value,
|
||||
onCheckedChange,
|
||||
form,
|
||||
...checkboxProps
|
||||
} = props;
|
||||
return /* @__PURE__ */ jsx(
|
||||
CheckboxProvider,
|
||||
{
|
||||
__scopeCheckbox,
|
||||
checked,
|
||||
defaultChecked,
|
||||
disabled,
|
||||
required,
|
||||
onCheckedChange,
|
||||
name,
|
||||
form,
|
||||
value,
|
||||
internal_do_not_use_render: ({ isFormControl }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
||||
/* @__PURE__ */ jsx(
|
||||
CheckboxTrigger,
|
||||
{
|
||||
...checkboxProps,
|
||||
ref: forwardedRef,
|
||||
__scopeCheckbox
|
||||
}
|
||||
),
|
||||
isFormControl && /* @__PURE__ */ jsx(
|
||||
CheckboxBubbleInput,
|
||||
{
|
||||
__scopeCheckbox
|
||||
}
|
||||
)
|
||||
] })
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
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.checked) || context.checked === true,
|
||||
children: /* @__PURE__ */ jsx(
|
||||
Primitive.span,
|
||||
{
|
||||
"data-state": getState(context.checked),
|
||||
"data-disabled": context.disabled ? "" : void 0,
|
||||
...indicatorProps,
|
||||
ref: forwardedRef,
|
||||
style: { pointerEvents: "none", ...props.style }
|
||||
}
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
CheckboxIndicator.displayName = INDICATOR_NAME;
|
||||
var BUBBLE_INPUT_NAME = "CheckboxBubbleInput";
|
||||
var CheckboxBubbleInput = React.forwardRef(
|
||||
({ __scopeCheckbox, ...props }, forwardedRef) => {
|
||||
const {
|
||||
control,
|
||||
hasConsumerStoppedPropagationRef,
|
||||
checked,
|
||||
defaultChecked,
|
||||
required,
|
||||
disabled,
|
||||
name,
|
||||
value,
|
||||
form,
|
||||
bubbleInput,
|
||||
setBubbleInput
|
||||
} = useCheckboxContext(BUBBLE_INPUT_NAME, __scopeCheckbox);
|
||||
const composedRefs = useComposedRefs(forwardedRef, setBubbleInput);
|
||||
const prevChecked = usePrevious(checked);
|
||||
const controlSize = useSize(control);
|
||||
React.useEffect(() => {
|
||||
const input = bubbleInput;
|
||||
if (!input) return;
|
||||
const inputProto = window.HTMLInputElement.prototype;
|
||||
const descriptor = Object.getOwnPropertyDescriptor(
|
||||
inputProto,
|
||||
"checked"
|
||||
);
|
||||
const setChecked = descriptor.set;
|
||||
const bubbles = !hasConsumerStoppedPropagationRef.current;
|
||||
if (prevChecked !== checked && setChecked) {
|
||||
const event = new Event("click", { bubbles });
|
||||
input.indeterminate = isIndeterminate(checked);
|
||||
setChecked.call(input, isIndeterminate(checked) ? false : checked);
|
||||
input.dispatchEvent(event);
|
||||
}
|
||||
}, [bubbleInput, prevChecked, checked, hasConsumerStoppedPropagationRef]);
|
||||
const defaultCheckedRef = React.useRef(isIndeterminate(checked) ? false : checked);
|
||||
return /* @__PURE__ */ jsx(
|
||||
Primitive.input,
|
||||
{
|
||||
type: "checkbox",
|
||||
"aria-hidden": true,
|
||||
defaultChecked: defaultChecked ?? defaultCheckedRef.current,
|
||||
required,
|
||||
disabled,
|
||||
name,
|
||||
value,
|
||||
form,
|
||||
...props,
|
||||
tabIndex: -1,
|
||||
ref: composedRefs,
|
||||
style: {
|
||||
...props.style,
|
||||
...controlSize,
|
||||
position: "absolute",
|
||||
pointerEvents: "none",
|
||||
opacity: 0,
|
||||
margin: 0,
|
||||
// We transform because the input is absolutely positioned but we have
|
||||
// rendered it **after** the button. This pulls it back to sit on top
|
||||
// of the button.
|
||||
transform: "translateX(-100%)"
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
CheckboxBubbleInput.displayName = BUBBLE_INPUT_NAME;
|
||||
function isFunction(value) {
|
||||
return typeof value === "function";
|
||||
}
|
||||
function isIndeterminate(checked) {
|
||||
return checked === "indeterminate";
|
||||
}
|
||||
function getState(checked) {
|
||||
return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
|
||||
}
|
||||
export {
|
||||
Checkbox,
|
||||
CheckboxIndicator,
|
||||
CheckboxIndicator as Indicator,
|
||||
Checkbox as Root,
|
||||
createCheckboxScope,
|
||||
CheckboxBubbleInput as unstable_BubbleInput,
|
||||
CheckboxBubbleInput as unstable_CheckboxBubbleInput,
|
||||
CheckboxProvider as unstable_CheckboxProvider,
|
||||
CheckboxTrigger as unstable_CheckboxTrigger,
|
||||
CheckboxProvider as unstable_Provider,
|
||||
CheckboxTrigger as unstable_Trigger
|
||||
};
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
7
node_modules/@radix-ui/react-checkbox/dist/index.mjs.map
generated
vendored
Normal file
7
node_modules/@radix-ui/react-checkbox/dist/index.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
75
node_modules/@radix-ui/react-checkbox/package.json
generated
vendored
Normal file
75
node_modules/@radix-ui/react-checkbox/package.json
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"name": "@radix-ui/react-checkbox",
|
||||
"version": "1.3.3",
|
||||
"license": "MIT",
|
||||
"source": "./src/index.ts",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"files": [
|
||||
"dist",
|
||||
"README.md"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"dependencies": {
|
||||
"@radix-ui/primitive": "1.1.3",
|
||||
"@radix-ui/react-compose-refs": "1.1.2",
|
||||
"@radix-ui/react-context": "1.1.2",
|
||||
"@radix-ui/react-primitive": "2.1.3",
|
||||
"@radix-ui/react-use-previous": "1.1.1",
|
||||
"@radix-ui/react-presence": "1.1.5",
|
||||
"@radix-ui/react-use-controllable-state": "1.2.2",
|
||||
"@radix-ui/react-use-size": "1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^19.0.7",
|
||||
"@types/react-dom": "^19.0.3",
|
||||
"eslint": "^9.18.0",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"typescript": "^5.7.3",
|
||||
"@repo/builder": "0.0.0",
|
||||
"@repo/eslint-config": "0.0.0",
|
||||
"@repo/typescript-config": "0.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"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --max-warnings 0 src",
|
||||
"clean": "rm -rf dist",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"build": "radix-build"
|
||||
},
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
node_modules/@radix-ui/react-collection/LICENSE
generated
vendored
Normal file
21
node_modules/@radix-ui/react-collection/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 WorkOS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
3
node_modules/@radix-ui/react-collection/README.md
generated
vendored
Normal file
3
node_modules/@radix-ui/react-collection/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# `react-collection`
|
||||
|
||||
This is an internal utility, not intended for public usage.
|
||||
98
node_modules/@radix-ui/react-collection/dist/index.d.mts
generated
vendored
Normal file
98
node_modules/@radix-ui/react-collection/dist/index.d.mts
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
import * as _radix_ui_react_context from '@radix-ui/react-context';
|
||||
import React from 'react';
|
||||
import { Slot } from '@radix-ui/react-slot';
|
||||
|
||||
type SlotProps$1 = React.ComponentPropsWithoutRef<typeof Slot>;
|
||||
interface CollectionProps$1 extends SlotProps$1 {
|
||||
scope: any;
|
||||
}
|
||||
declare function createCollection$1<ItemElement extends HTMLElement, ItemData = {}>(name: string): readonly [{
|
||||
readonly Provider: React.FC<{
|
||||
children?: React.ReactNode;
|
||||
scope: any;
|
||||
}>;
|
||||
readonly Slot: React.ForwardRefExoticComponent<CollectionProps$1 & React.RefAttributes<HTMLElement>>;
|
||||
readonly ItemSlot: React.ForwardRefExoticComponent<React.PropsWithoutRef<ItemData & {
|
||||
children: React.ReactNode;
|
||||
scope: any;
|
||||
}> & React.RefAttributes<ItemElement>>;
|
||||
}, (scope: any) => () => ({
|
||||
ref: React.RefObject<ItemElement | null>;
|
||||
} & ItemData)[], _radix_ui_react_context.CreateScope];
|
||||
|
||||
declare class OrderedDict<K, V> extends Map<K, V> {
|
||||
#private;
|
||||
constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);
|
||||
set(key: K, value: V): this;
|
||||
insert(index: number, key: K, value: V): this;
|
||||
with(index: number, key: K, value: V): OrderedDict<K, V>;
|
||||
before(key: K): [K, V] | undefined;
|
||||
/**
|
||||
* Sets a new key-value pair at the position before the given key.
|
||||
*/
|
||||
setBefore(key: K, newKey: K, value: V): this;
|
||||
after(key: K): [K, V] | undefined;
|
||||
/**
|
||||
* Sets a new key-value pair at the position after the given key.
|
||||
*/
|
||||
setAfter(key: K, newKey: K, value: V): this;
|
||||
first(): [K, V] | undefined;
|
||||
last(): [K, V] | undefined;
|
||||
clear(): void;
|
||||
delete(key: K): boolean;
|
||||
deleteAt(index: number): boolean;
|
||||
at(index: number): V | undefined;
|
||||
entryAt(index: number): [K, V] | undefined;
|
||||
indexOf(key: K): number;
|
||||
keyAt(index: number): K | undefined;
|
||||
from(key: K, offset: number): V | undefined;
|
||||
keyFrom(key: K, offset: number): K | undefined;
|
||||
find(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => boolean, thisArg?: any): [K, V] | undefined;
|
||||
findIndex(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => boolean, thisArg?: any): number;
|
||||
filter<KK extends K, VV extends V>(predicate: (entry: [K, V], index: number, dict: OrderedDict<K, V>) => entry is [KK, VV], thisArg?: any): OrderedDict<KK, VV>;
|
||||
filter(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown, thisArg?: any): OrderedDict<K, V>;
|
||||
map<U>(callbackfn: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => U, thisArg?: any): OrderedDict<K, U>;
|
||||
reduce(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => [K, V]): [K, V];
|
||||
reduce(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => [K, V], initialValue: [K, V]): [K, V];
|
||||
reduce<U>(callbackfn: (previousValue: U, currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => U, initialValue: U): U;
|
||||
reduceRight(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => [K, V]): [K, V];
|
||||
reduceRight(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => [K, V], initialValue: [K, V]): [K, V];
|
||||
reduceRight<U>(callbackfn: (previousValue: [K, V], currentValue: U, currentIndex: number, dictionary: OrderedDict<K, V>) => U, initialValue: U): U;
|
||||
toSorted(compareFn?: (a: [K, V], b: [K, V]) => number): OrderedDict<K, V>;
|
||||
toReversed(): OrderedDict<K, V>;
|
||||
toSpliced(start: number, deleteCount?: number): OrderedDict<K, V>;
|
||||
toSpliced(start: number, deleteCount: number, ...items: [K, V][]): OrderedDict<K, V>;
|
||||
slice(start?: number, end?: number): OrderedDict<K, V>;
|
||||
every(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown, thisArg?: any): boolean;
|
||||
some(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown, thisArg?: any): boolean;
|
||||
}
|
||||
|
||||
type SlotProps = React.ComponentPropsWithoutRef<typeof Slot>;
|
||||
interface CollectionProps extends SlotProps {
|
||||
scope: any;
|
||||
}
|
||||
interface BaseItemData {
|
||||
id?: string;
|
||||
}
|
||||
type ItemDataWithElement<ItemData extends BaseItemData, ItemElement extends HTMLElement> = ItemData & {
|
||||
element: ItemElement;
|
||||
};
|
||||
type ItemMap<ItemElement extends HTMLElement, ItemData extends BaseItemData> = OrderedDict<ItemElement, ItemDataWithElement<ItemData, ItemElement>>;
|
||||
declare function createCollection<ItemElement extends HTMLElement, ItemData extends BaseItemData = BaseItemData>(name: string): readonly [{
|
||||
readonly Provider: React.FC<{
|
||||
children?: React.ReactNode;
|
||||
scope: any;
|
||||
state?: [ItemMap: ItemMap<ItemElement, ItemData>, SetItemMap: React.Dispatch<React.SetStateAction<ItemMap<ItemElement, ItemData>>>];
|
||||
}>;
|
||||
readonly Slot: React.ForwardRefExoticComponent<CollectionProps & React.RefAttributes<HTMLElement>>;
|
||||
readonly ItemSlot: React.ForwardRefExoticComponent<React.PropsWithoutRef<ItemData & {
|
||||
children: React.ReactNode;
|
||||
scope: any;
|
||||
}> & React.RefAttributes<ItemElement>>;
|
||||
}, {
|
||||
createCollectionScope: _radix_ui_react_context.CreateScope;
|
||||
useCollection: (scope: any) => ItemMap<ItemElement, ItemData>;
|
||||
useInitCollection: () => [ItemMap<ItemElement, ItemData>, React.Dispatch<React.SetStateAction<ItemMap<ItemElement, ItemData>>>];
|
||||
}];
|
||||
|
||||
export { type CollectionProps$1 as CollectionProps, createCollection$1 as createCollection, type CollectionProps$1 as unstable_CollectionProps, createCollection as unstable_createCollection };
|
||||
98
node_modules/@radix-ui/react-collection/dist/index.d.ts
generated
vendored
Normal file
98
node_modules/@radix-ui/react-collection/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
import * as _radix_ui_react_context from '@radix-ui/react-context';
|
||||
import React from 'react';
|
||||
import { Slot } from '@radix-ui/react-slot';
|
||||
|
||||
type SlotProps$1 = React.ComponentPropsWithoutRef<typeof Slot>;
|
||||
interface CollectionProps$1 extends SlotProps$1 {
|
||||
scope: any;
|
||||
}
|
||||
declare function createCollection$1<ItemElement extends HTMLElement, ItemData = {}>(name: string): readonly [{
|
||||
readonly Provider: React.FC<{
|
||||
children?: React.ReactNode;
|
||||
scope: any;
|
||||
}>;
|
||||
readonly Slot: React.ForwardRefExoticComponent<CollectionProps$1 & React.RefAttributes<HTMLElement>>;
|
||||
readonly ItemSlot: React.ForwardRefExoticComponent<React.PropsWithoutRef<ItemData & {
|
||||
children: React.ReactNode;
|
||||
scope: any;
|
||||
}> & React.RefAttributes<ItemElement>>;
|
||||
}, (scope: any) => () => ({
|
||||
ref: React.RefObject<ItemElement | null>;
|
||||
} & ItemData)[], _radix_ui_react_context.CreateScope];
|
||||
|
||||
declare class OrderedDict<K, V> extends Map<K, V> {
|
||||
#private;
|
||||
constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);
|
||||
set(key: K, value: V): this;
|
||||
insert(index: number, key: K, value: V): this;
|
||||
with(index: number, key: K, value: V): OrderedDict<K, V>;
|
||||
before(key: K): [K, V] | undefined;
|
||||
/**
|
||||
* Sets a new key-value pair at the position before the given key.
|
||||
*/
|
||||
setBefore(key: K, newKey: K, value: V): this;
|
||||
after(key: K): [K, V] | undefined;
|
||||
/**
|
||||
* Sets a new key-value pair at the position after the given key.
|
||||
*/
|
||||
setAfter(key: K, newKey: K, value: V): this;
|
||||
first(): [K, V] | undefined;
|
||||
last(): [K, V] | undefined;
|
||||
clear(): void;
|
||||
delete(key: K): boolean;
|
||||
deleteAt(index: number): boolean;
|
||||
at(index: number): V | undefined;
|
||||
entryAt(index: number): [K, V] | undefined;
|
||||
indexOf(key: K): number;
|
||||
keyAt(index: number): K | undefined;
|
||||
from(key: K, offset: number): V | undefined;
|
||||
keyFrom(key: K, offset: number): K | undefined;
|
||||
find(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => boolean, thisArg?: any): [K, V] | undefined;
|
||||
findIndex(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => boolean, thisArg?: any): number;
|
||||
filter<KK extends K, VV extends V>(predicate: (entry: [K, V], index: number, dict: OrderedDict<K, V>) => entry is [KK, VV], thisArg?: any): OrderedDict<KK, VV>;
|
||||
filter(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown, thisArg?: any): OrderedDict<K, V>;
|
||||
map<U>(callbackfn: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => U, thisArg?: any): OrderedDict<K, U>;
|
||||
reduce(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => [K, V]): [K, V];
|
||||
reduce(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => [K, V], initialValue: [K, V]): [K, V];
|
||||
reduce<U>(callbackfn: (previousValue: U, currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => U, initialValue: U): U;
|
||||
reduceRight(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => [K, V]): [K, V];
|
||||
reduceRight(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => [K, V], initialValue: [K, V]): [K, V];
|
||||
reduceRight<U>(callbackfn: (previousValue: [K, V], currentValue: U, currentIndex: number, dictionary: OrderedDict<K, V>) => U, initialValue: U): U;
|
||||
toSorted(compareFn?: (a: [K, V], b: [K, V]) => number): OrderedDict<K, V>;
|
||||
toReversed(): OrderedDict<K, V>;
|
||||
toSpliced(start: number, deleteCount?: number): OrderedDict<K, V>;
|
||||
toSpliced(start: number, deleteCount: number, ...items: [K, V][]): OrderedDict<K, V>;
|
||||
slice(start?: number, end?: number): OrderedDict<K, V>;
|
||||
every(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown, thisArg?: any): boolean;
|
||||
some(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown, thisArg?: any): boolean;
|
||||
}
|
||||
|
||||
type SlotProps = React.ComponentPropsWithoutRef<typeof Slot>;
|
||||
interface CollectionProps extends SlotProps {
|
||||
scope: any;
|
||||
}
|
||||
interface BaseItemData {
|
||||
id?: string;
|
||||
}
|
||||
type ItemDataWithElement<ItemData extends BaseItemData, ItemElement extends HTMLElement> = ItemData & {
|
||||
element: ItemElement;
|
||||
};
|
||||
type ItemMap<ItemElement extends HTMLElement, ItemData extends BaseItemData> = OrderedDict<ItemElement, ItemDataWithElement<ItemData, ItemElement>>;
|
||||
declare function createCollection<ItemElement extends HTMLElement, ItemData extends BaseItemData = BaseItemData>(name: string): readonly [{
|
||||
readonly Provider: React.FC<{
|
||||
children?: React.ReactNode;
|
||||
scope: any;
|
||||
state?: [ItemMap: ItemMap<ItemElement, ItemData>, SetItemMap: React.Dispatch<React.SetStateAction<ItemMap<ItemElement, ItemData>>>];
|
||||
}>;
|
||||
readonly Slot: React.ForwardRefExoticComponent<CollectionProps & React.RefAttributes<HTMLElement>>;
|
||||
readonly ItemSlot: React.ForwardRefExoticComponent<React.PropsWithoutRef<ItemData & {
|
||||
children: React.ReactNode;
|
||||
scope: any;
|
||||
}> & React.RefAttributes<ItemElement>>;
|
||||
}, {
|
||||
createCollectionScope: _radix_ui_react_context.CreateScope;
|
||||
useCollection: (scope: any) => ItemMap<ItemElement, ItemData>;
|
||||
useInitCollection: () => [ItemMap<ItemElement, ItemData>, React.Dispatch<React.SetStateAction<ItemMap<ItemElement, ItemData>>>];
|
||||
}];
|
||||
|
||||
export { type CollectionProps$1 as CollectionProps, createCollection$1 as createCollection, type CollectionProps$1 as unstable_CollectionProps, createCollection as unstable_createCollection };
|
||||
577
node_modules/@radix-ui/react-collection/dist/index.js
generated
vendored
Normal file
577
node_modules/@radix-ui/react-collection/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,577 @@
|
||||
"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);
|
||||
|
||||
// src/index.ts
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
createCollection: () => createCollection,
|
||||
unstable_createCollection: () => createCollection2
|
||||
});
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
|
||||
// src/collection-legacy.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 CollectionSlotImpl = (0, import_react_slot.createSlot)(COLLECTION_SLOT_NAME);
|
||||
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)(CollectionSlotImpl, { ref: composedRefs, children });
|
||||
}
|
||||
);
|
||||
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
||||
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
||||
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
||||
const CollectionItemSlotImpl = (0, import_react_slot.createSlot)(ITEM_SLOT_NAME);
|
||||
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)(CollectionItemSlotImpl, { ...{ [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
|
||||
];
|
||||
}
|
||||
|
||||
// src/collection.tsx
|
||||
var import_react2 = __toESM(require("react"));
|
||||
var import_react_context2 = require("@radix-ui/react-context");
|
||||
var import_react_compose_refs2 = require("@radix-ui/react-compose-refs");
|
||||
var import_react_slot2 = require("@radix-ui/react-slot");
|
||||
|
||||
// src/ordered-dictionary.ts
|
||||
var __instanciated = /* @__PURE__ */ new WeakMap();
|
||||
var OrderedDict = class _OrderedDict extends Map {
|
||||
#keys;
|
||||
constructor(entries) {
|
||||
super(entries);
|
||||
this.#keys = [...super.keys()];
|
||||
__instanciated.set(this, true);
|
||||
}
|
||||
set(key, value) {
|
||||
if (__instanciated.get(this)) {
|
||||
if (this.has(key)) {
|
||||
this.#keys[this.#keys.indexOf(key)] = key;
|
||||
} else {
|
||||
this.#keys.push(key);
|
||||
}
|
||||
}
|
||||
super.set(key, value);
|
||||
return this;
|
||||
}
|
||||
insert(index, key, value) {
|
||||
const has = this.has(key);
|
||||
const length = this.#keys.length;
|
||||
const relativeIndex = toSafeInteger(index);
|
||||
let actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;
|
||||
const safeIndex = actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;
|
||||
if (safeIndex === this.size || has && safeIndex === this.size - 1 || safeIndex === -1) {
|
||||
this.set(key, value);
|
||||
return this;
|
||||
}
|
||||
const size = this.size + (has ? 0 : 1);
|
||||
if (relativeIndex < 0) {
|
||||
actualIndex++;
|
||||
}
|
||||
const keys = [...this.#keys];
|
||||
let nextValue;
|
||||
let shouldSkip = false;
|
||||
for (let i = actualIndex; i < size; i++) {
|
||||
if (actualIndex === i) {
|
||||
let nextKey = keys[i];
|
||||
if (keys[i] === key) {
|
||||
nextKey = keys[i + 1];
|
||||
}
|
||||
if (has) {
|
||||
this.delete(key);
|
||||
}
|
||||
nextValue = this.get(nextKey);
|
||||
this.set(key, value);
|
||||
} else {
|
||||
if (!shouldSkip && keys[i - 1] === key) {
|
||||
shouldSkip = true;
|
||||
}
|
||||
const currentKey = keys[shouldSkip ? i : i - 1];
|
||||
const currentValue = nextValue;
|
||||
nextValue = this.get(currentKey);
|
||||
this.delete(currentKey);
|
||||
this.set(currentKey, currentValue);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
with(index, key, value) {
|
||||
const copy = new _OrderedDict(this);
|
||||
copy.insert(index, key, value);
|
||||
return copy;
|
||||
}
|
||||
before(key) {
|
||||
const index = this.#keys.indexOf(key) - 1;
|
||||
if (index < 0) {
|
||||
return void 0;
|
||||
}
|
||||
return this.entryAt(index);
|
||||
}
|
||||
/**
|
||||
* Sets a new key-value pair at the position before the given key.
|
||||
*/
|
||||
setBefore(key, newKey, value) {
|
||||
const index = this.#keys.indexOf(key);
|
||||
if (index === -1) {
|
||||
return this;
|
||||
}
|
||||
return this.insert(index, newKey, value);
|
||||
}
|
||||
after(key) {
|
||||
let index = this.#keys.indexOf(key);
|
||||
index = index === -1 || index === this.size - 1 ? -1 : index + 1;
|
||||
if (index === -1) {
|
||||
return void 0;
|
||||
}
|
||||
return this.entryAt(index);
|
||||
}
|
||||
/**
|
||||
* Sets a new key-value pair at the position after the given key.
|
||||
*/
|
||||
setAfter(key, newKey, value) {
|
||||
const index = this.#keys.indexOf(key);
|
||||
if (index === -1) {
|
||||
return this;
|
||||
}
|
||||
return this.insert(index + 1, newKey, value);
|
||||
}
|
||||
first() {
|
||||
return this.entryAt(0);
|
||||
}
|
||||
last() {
|
||||
return this.entryAt(-1);
|
||||
}
|
||||
clear() {
|
||||
this.#keys = [];
|
||||
return super.clear();
|
||||
}
|
||||
delete(key) {
|
||||
const deleted = super.delete(key);
|
||||
if (deleted) {
|
||||
this.#keys.splice(this.#keys.indexOf(key), 1);
|
||||
}
|
||||
return deleted;
|
||||
}
|
||||
deleteAt(index) {
|
||||
const key = this.keyAt(index);
|
||||
if (key !== void 0) {
|
||||
return this.delete(key);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
at(index) {
|
||||
const key = at(this.#keys, index);
|
||||
if (key !== void 0) {
|
||||
return this.get(key);
|
||||
}
|
||||
}
|
||||
entryAt(index) {
|
||||
const key = at(this.#keys, index);
|
||||
if (key !== void 0) {
|
||||
return [key, this.get(key)];
|
||||
}
|
||||
}
|
||||
indexOf(key) {
|
||||
return this.#keys.indexOf(key);
|
||||
}
|
||||
keyAt(index) {
|
||||
return at(this.#keys, index);
|
||||
}
|
||||
from(key, offset) {
|
||||
const index = this.indexOf(key);
|
||||
if (index === -1) {
|
||||
return void 0;
|
||||
}
|
||||
let dest = index + offset;
|
||||
if (dest < 0) dest = 0;
|
||||
if (dest >= this.size) dest = this.size - 1;
|
||||
return this.at(dest);
|
||||
}
|
||||
keyFrom(key, offset) {
|
||||
const index = this.indexOf(key);
|
||||
if (index === -1) {
|
||||
return void 0;
|
||||
}
|
||||
let dest = index + offset;
|
||||
if (dest < 0) dest = 0;
|
||||
if (dest >= this.size) dest = this.size - 1;
|
||||
return this.keyAt(dest);
|
||||
}
|
||||
find(predicate, thisArg) {
|
||||
let index = 0;
|
||||
for (const entry of this) {
|
||||
if (Reflect.apply(predicate, thisArg, [entry, index, this])) {
|
||||
return entry;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return void 0;
|
||||
}
|
||||
findIndex(predicate, thisArg) {
|
||||
let index = 0;
|
||||
for (const entry of this) {
|
||||
if (Reflect.apply(predicate, thisArg, [entry, index, this])) {
|
||||
return index;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
filter(predicate, thisArg) {
|
||||
const entries = [];
|
||||
let index = 0;
|
||||
for (const entry of this) {
|
||||
if (Reflect.apply(predicate, thisArg, [entry, index, this])) {
|
||||
entries.push(entry);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return new _OrderedDict(entries);
|
||||
}
|
||||
map(callbackfn, thisArg) {
|
||||
const entries = [];
|
||||
let index = 0;
|
||||
for (const entry of this) {
|
||||
entries.push([entry[0], Reflect.apply(callbackfn, thisArg, [entry, index, this])]);
|
||||
index++;
|
||||
}
|
||||
return new _OrderedDict(entries);
|
||||
}
|
||||
reduce(...args) {
|
||||
const [callbackfn, initialValue] = args;
|
||||
let index = 0;
|
||||
let accumulator = initialValue ?? this.at(0);
|
||||
for (const entry of this) {
|
||||
if (index === 0 && args.length === 1) {
|
||||
accumulator = entry;
|
||||
} else {
|
||||
accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return accumulator;
|
||||
}
|
||||
reduceRight(...args) {
|
||||
const [callbackfn, initialValue] = args;
|
||||
let accumulator = initialValue ?? this.at(-1);
|
||||
for (let index = this.size - 1; index >= 0; index--) {
|
||||
const entry = this.at(index);
|
||||
if (index === this.size - 1 && args.length === 1) {
|
||||
accumulator = entry;
|
||||
} else {
|
||||
accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);
|
||||
}
|
||||
}
|
||||
return accumulator;
|
||||
}
|
||||
toSorted(compareFn) {
|
||||
const entries = [...this.entries()].sort(compareFn);
|
||||
return new _OrderedDict(entries);
|
||||
}
|
||||
toReversed() {
|
||||
const reversed = new _OrderedDict();
|
||||
for (let index = this.size - 1; index >= 0; index--) {
|
||||
const key = this.keyAt(index);
|
||||
const element = this.get(key);
|
||||
reversed.set(key, element);
|
||||
}
|
||||
return reversed;
|
||||
}
|
||||
toSpliced(...args) {
|
||||
const entries = [...this.entries()];
|
||||
entries.splice(...args);
|
||||
return new _OrderedDict(entries);
|
||||
}
|
||||
slice(start, end) {
|
||||
const result = new _OrderedDict();
|
||||
let stop = this.size - 1;
|
||||
if (start === void 0) {
|
||||
return result;
|
||||
}
|
||||
if (start < 0) {
|
||||
start = start + this.size;
|
||||
}
|
||||
if (end !== void 0 && end > 0) {
|
||||
stop = end - 1;
|
||||
}
|
||||
for (let index = start; index <= stop; index++) {
|
||||
const key = this.keyAt(index);
|
||||
const element = this.get(key);
|
||||
result.set(key, element);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
every(predicate, thisArg) {
|
||||
let index = 0;
|
||||
for (const entry of this) {
|
||||
if (!Reflect.apply(predicate, thisArg, [entry, index, this])) {
|
||||
return false;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
some(predicate, thisArg) {
|
||||
let index = 0;
|
||||
for (const entry of this) {
|
||||
if (Reflect.apply(predicate, thisArg, [entry, index, this])) {
|
||||
return true;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
function at(array, index) {
|
||||
if ("at" in Array.prototype) {
|
||||
return Array.prototype.at.call(array, index);
|
||||
}
|
||||
const actualIndex = toSafeIndex(array, index);
|
||||
return actualIndex === -1 ? void 0 : array[actualIndex];
|
||||
}
|
||||
function toSafeIndex(array, index) {
|
||||
const length = array.length;
|
||||
const relativeIndex = toSafeInteger(index);
|
||||
const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;
|
||||
return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;
|
||||
}
|
||||
function toSafeInteger(number) {
|
||||
return number !== number || number === 0 ? 0 : Math.trunc(number);
|
||||
}
|
||||
|
||||
// src/collection.tsx
|
||||
var import_jsx_runtime2 = require("react/jsx-runtime");
|
||||
function createCollection2(name) {
|
||||
const PROVIDER_NAME = name + "CollectionProvider";
|
||||
const [createCollectionContext, createCollectionScope] = (0, import_react_context2.createContextScope)(PROVIDER_NAME);
|
||||
const [CollectionContextProvider, useCollectionContext] = createCollectionContext(
|
||||
PROVIDER_NAME,
|
||||
{
|
||||
collectionElement: null,
|
||||
collectionRef: { current: null },
|
||||
collectionRefObject: { current: null },
|
||||
itemMap: new OrderedDict(),
|
||||
setItemMap: () => void 0
|
||||
}
|
||||
);
|
||||
const CollectionProvider = ({ state, ...props }) => {
|
||||
return state ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CollectionInit, { ...props });
|
||||
};
|
||||
CollectionProvider.displayName = PROVIDER_NAME;
|
||||
const CollectionInit = (props) => {
|
||||
const state = useInitCollection();
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CollectionProviderImpl, { ...props, state });
|
||||
};
|
||||
CollectionInit.displayName = PROVIDER_NAME + "Init";
|
||||
const CollectionProviderImpl = (props) => {
|
||||
const { scope, children, state } = props;
|
||||
const ref = import_react2.default.useRef(null);
|
||||
const [collectionElement, setCollectionElement] = import_react2.default.useState(
|
||||
null
|
||||
);
|
||||
const composeRefs = (0, import_react_compose_refs2.useComposedRefs)(ref, setCollectionElement);
|
||||
const [itemMap, setItemMap] = state;
|
||||
import_react2.default.useEffect(() => {
|
||||
if (!collectionElement) return;
|
||||
const observer = getChildListObserver(() => {
|
||||
});
|
||||
observer.observe(collectionElement, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
});
|
||||
return () => {
|
||||
observer.disconnect();
|
||||
};
|
||||
}, [collectionElement]);
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
||||
CollectionContextProvider,
|
||||
{
|
||||
scope,
|
||||
itemMap,
|
||||
setItemMap,
|
||||
collectionRef: composeRefs,
|
||||
collectionRefObject: ref,
|
||||
collectionElement,
|
||||
children
|
||||
}
|
||||
);
|
||||
};
|
||||
CollectionProviderImpl.displayName = PROVIDER_NAME + "Impl";
|
||||
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
||||
const CollectionSlotImpl = (0, import_react_slot2.createSlot)(COLLECTION_SLOT_NAME);
|
||||
const CollectionSlot = import_react2.default.forwardRef(
|
||||
(props, forwardedRef) => {
|
||||
const { scope, children } = props;
|
||||
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
||||
const composedRefs = (0, import_react_compose_refs2.useComposedRefs)(forwardedRef, context.collectionRef);
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CollectionSlotImpl, { ref: composedRefs, children });
|
||||
}
|
||||
);
|
||||
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
||||
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
||||
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
||||
const CollectionItemSlotImpl = (0, import_react_slot2.createSlot)(ITEM_SLOT_NAME);
|
||||
const CollectionItemSlot = import_react2.default.forwardRef(
|
||||
(props, forwardedRef) => {
|
||||
const { scope, children, ...itemData } = props;
|
||||
const ref = import_react2.default.useRef(null);
|
||||
const [element, setElement] = import_react2.default.useState(null);
|
||||
const composedRefs = (0, import_react_compose_refs2.useComposedRefs)(forwardedRef, ref, setElement);
|
||||
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
||||
const { setItemMap } = context;
|
||||
const itemDataRef = import_react2.default.useRef(itemData);
|
||||
if (!shallowEqual(itemDataRef.current, itemData)) {
|
||||
itemDataRef.current = itemData;
|
||||
}
|
||||
const memoizedItemData = itemDataRef.current;
|
||||
import_react2.default.useEffect(() => {
|
||||
const itemData2 = memoizedItemData;
|
||||
setItemMap((map) => {
|
||||
if (!element) {
|
||||
return map;
|
||||
}
|
||||
if (!map.has(element)) {
|
||||
map.set(element, { ...itemData2, element });
|
||||
return map.toSorted(sortByDocumentPosition);
|
||||
}
|
||||
return map.set(element, { ...itemData2, element }).toSorted(sortByDocumentPosition);
|
||||
});
|
||||
return () => {
|
||||
setItemMap((map) => {
|
||||
if (!element || !map.has(element)) {
|
||||
return map;
|
||||
}
|
||||
map.delete(element);
|
||||
return new OrderedDict(map);
|
||||
});
|
||||
};
|
||||
}, [element, memoizedItemData, setItemMap]);
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
|
||||
}
|
||||
);
|
||||
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
||||
function useInitCollection() {
|
||||
return import_react2.default.useState(new OrderedDict());
|
||||
}
|
||||
function useCollection(scope) {
|
||||
const { itemMap } = useCollectionContext(name + "CollectionConsumer", scope);
|
||||
return itemMap;
|
||||
}
|
||||
const functions = {
|
||||
createCollectionScope,
|
||||
useCollection,
|
||||
useInitCollection
|
||||
};
|
||||
return [
|
||||
{ Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
|
||||
functions
|
||||
];
|
||||
}
|
||||
function shallowEqual(a, b) {
|
||||
if (a === b) return true;
|
||||
if (typeof a !== "object" || typeof b !== "object") return false;
|
||||
if (a == null || b == null) return false;
|
||||
const keysA = Object.keys(a);
|
||||
const keysB = Object.keys(b);
|
||||
if (keysA.length !== keysB.length) return false;
|
||||
for (const key of keysA) {
|
||||
if (!Object.prototype.hasOwnProperty.call(b, key)) return false;
|
||||
if (a[key] !== b[key]) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function isElementPreceding(a, b) {
|
||||
return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);
|
||||
}
|
||||
function sortByDocumentPosition(a, b) {
|
||||
return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1;
|
||||
}
|
||||
function getChildListObserver(callback) {
|
||||
const observer = new MutationObserver((mutationsList) => {
|
||||
for (const mutation of mutationsList) {
|
||||
if (mutation.type === "childList") {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
return observer;
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
7
node_modules/@radix-ui/react-collection/dist/index.js.map
generated
vendored
Normal file
7
node_modules/@radix-ui/react-collection/dist/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
545
node_modules/@radix-ui/react-collection/dist/index.mjs
generated
vendored
Normal file
545
node_modules/@radix-ui/react-collection/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,545 @@
|
||||
"use client";
|
||||
|
||||
// src/collection-legacy.tsx
|
||||
import React from "react";
|
||||
import { createContextScope } from "@radix-ui/react-context";
|
||||
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
||||
import { createSlot } 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 CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
|
||||
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(CollectionSlotImpl, { ref: composedRefs, children });
|
||||
}
|
||||
);
|
||||
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
||||
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
||||
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
||||
const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);
|
||||
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(CollectionItemSlotImpl, { ...{ [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
|
||||
];
|
||||
}
|
||||
|
||||
// src/collection.tsx
|
||||
import React2 from "react";
|
||||
import { createContextScope as createContextScope2 } from "@radix-ui/react-context";
|
||||
import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
|
||||
import { createSlot as createSlot2 } from "@radix-ui/react-slot";
|
||||
|
||||
// src/ordered-dictionary.ts
|
||||
var __instanciated = /* @__PURE__ */ new WeakMap();
|
||||
var OrderedDict = class _OrderedDict extends Map {
|
||||
#keys;
|
||||
constructor(entries) {
|
||||
super(entries);
|
||||
this.#keys = [...super.keys()];
|
||||
__instanciated.set(this, true);
|
||||
}
|
||||
set(key, value) {
|
||||
if (__instanciated.get(this)) {
|
||||
if (this.has(key)) {
|
||||
this.#keys[this.#keys.indexOf(key)] = key;
|
||||
} else {
|
||||
this.#keys.push(key);
|
||||
}
|
||||
}
|
||||
super.set(key, value);
|
||||
return this;
|
||||
}
|
||||
insert(index, key, value) {
|
||||
const has = this.has(key);
|
||||
const length = this.#keys.length;
|
||||
const relativeIndex = toSafeInteger(index);
|
||||
let actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;
|
||||
const safeIndex = actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;
|
||||
if (safeIndex === this.size || has && safeIndex === this.size - 1 || safeIndex === -1) {
|
||||
this.set(key, value);
|
||||
return this;
|
||||
}
|
||||
const size = this.size + (has ? 0 : 1);
|
||||
if (relativeIndex < 0) {
|
||||
actualIndex++;
|
||||
}
|
||||
const keys = [...this.#keys];
|
||||
let nextValue;
|
||||
let shouldSkip = false;
|
||||
for (let i = actualIndex; i < size; i++) {
|
||||
if (actualIndex === i) {
|
||||
let nextKey = keys[i];
|
||||
if (keys[i] === key) {
|
||||
nextKey = keys[i + 1];
|
||||
}
|
||||
if (has) {
|
||||
this.delete(key);
|
||||
}
|
||||
nextValue = this.get(nextKey);
|
||||
this.set(key, value);
|
||||
} else {
|
||||
if (!shouldSkip && keys[i - 1] === key) {
|
||||
shouldSkip = true;
|
||||
}
|
||||
const currentKey = keys[shouldSkip ? i : i - 1];
|
||||
const currentValue = nextValue;
|
||||
nextValue = this.get(currentKey);
|
||||
this.delete(currentKey);
|
||||
this.set(currentKey, currentValue);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
with(index, key, value) {
|
||||
const copy = new _OrderedDict(this);
|
||||
copy.insert(index, key, value);
|
||||
return copy;
|
||||
}
|
||||
before(key) {
|
||||
const index = this.#keys.indexOf(key) - 1;
|
||||
if (index < 0) {
|
||||
return void 0;
|
||||
}
|
||||
return this.entryAt(index);
|
||||
}
|
||||
/**
|
||||
* Sets a new key-value pair at the position before the given key.
|
||||
*/
|
||||
setBefore(key, newKey, value) {
|
||||
const index = this.#keys.indexOf(key);
|
||||
if (index === -1) {
|
||||
return this;
|
||||
}
|
||||
return this.insert(index, newKey, value);
|
||||
}
|
||||
after(key) {
|
||||
let index = this.#keys.indexOf(key);
|
||||
index = index === -1 || index === this.size - 1 ? -1 : index + 1;
|
||||
if (index === -1) {
|
||||
return void 0;
|
||||
}
|
||||
return this.entryAt(index);
|
||||
}
|
||||
/**
|
||||
* Sets a new key-value pair at the position after the given key.
|
||||
*/
|
||||
setAfter(key, newKey, value) {
|
||||
const index = this.#keys.indexOf(key);
|
||||
if (index === -1) {
|
||||
return this;
|
||||
}
|
||||
return this.insert(index + 1, newKey, value);
|
||||
}
|
||||
first() {
|
||||
return this.entryAt(0);
|
||||
}
|
||||
last() {
|
||||
return this.entryAt(-1);
|
||||
}
|
||||
clear() {
|
||||
this.#keys = [];
|
||||
return super.clear();
|
||||
}
|
||||
delete(key) {
|
||||
const deleted = super.delete(key);
|
||||
if (deleted) {
|
||||
this.#keys.splice(this.#keys.indexOf(key), 1);
|
||||
}
|
||||
return deleted;
|
||||
}
|
||||
deleteAt(index) {
|
||||
const key = this.keyAt(index);
|
||||
if (key !== void 0) {
|
||||
return this.delete(key);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
at(index) {
|
||||
const key = at(this.#keys, index);
|
||||
if (key !== void 0) {
|
||||
return this.get(key);
|
||||
}
|
||||
}
|
||||
entryAt(index) {
|
||||
const key = at(this.#keys, index);
|
||||
if (key !== void 0) {
|
||||
return [key, this.get(key)];
|
||||
}
|
||||
}
|
||||
indexOf(key) {
|
||||
return this.#keys.indexOf(key);
|
||||
}
|
||||
keyAt(index) {
|
||||
return at(this.#keys, index);
|
||||
}
|
||||
from(key, offset) {
|
||||
const index = this.indexOf(key);
|
||||
if (index === -1) {
|
||||
return void 0;
|
||||
}
|
||||
let dest = index + offset;
|
||||
if (dest < 0) dest = 0;
|
||||
if (dest >= this.size) dest = this.size - 1;
|
||||
return this.at(dest);
|
||||
}
|
||||
keyFrom(key, offset) {
|
||||
const index = this.indexOf(key);
|
||||
if (index === -1) {
|
||||
return void 0;
|
||||
}
|
||||
let dest = index + offset;
|
||||
if (dest < 0) dest = 0;
|
||||
if (dest >= this.size) dest = this.size - 1;
|
||||
return this.keyAt(dest);
|
||||
}
|
||||
find(predicate, thisArg) {
|
||||
let index = 0;
|
||||
for (const entry of this) {
|
||||
if (Reflect.apply(predicate, thisArg, [entry, index, this])) {
|
||||
return entry;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return void 0;
|
||||
}
|
||||
findIndex(predicate, thisArg) {
|
||||
let index = 0;
|
||||
for (const entry of this) {
|
||||
if (Reflect.apply(predicate, thisArg, [entry, index, this])) {
|
||||
return index;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
filter(predicate, thisArg) {
|
||||
const entries = [];
|
||||
let index = 0;
|
||||
for (const entry of this) {
|
||||
if (Reflect.apply(predicate, thisArg, [entry, index, this])) {
|
||||
entries.push(entry);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return new _OrderedDict(entries);
|
||||
}
|
||||
map(callbackfn, thisArg) {
|
||||
const entries = [];
|
||||
let index = 0;
|
||||
for (const entry of this) {
|
||||
entries.push([entry[0], Reflect.apply(callbackfn, thisArg, [entry, index, this])]);
|
||||
index++;
|
||||
}
|
||||
return new _OrderedDict(entries);
|
||||
}
|
||||
reduce(...args) {
|
||||
const [callbackfn, initialValue] = args;
|
||||
let index = 0;
|
||||
let accumulator = initialValue ?? this.at(0);
|
||||
for (const entry of this) {
|
||||
if (index === 0 && args.length === 1) {
|
||||
accumulator = entry;
|
||||
} else {
|
||||
accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return accumulator;
|
||||
}
|
||||
reduceRight(...args) {
|
||||
const [callbackfn, initialValue] = args;
|
||||
let accumulator = initialValue ?? this.at(-1);
|
||||
for (let index = this.size - 1; index >= 0; index--) {
|
||||
const entry = this.at(index);
|
||||
if (index === this.size - 1 && args.length === 1) {
|
||||
accumulator = entry;
|
||||
} else {
|
||||
accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);
|
||||
}
|
||||
}
|
||||
return accumulator;
|
||||
}
|
||||
toSorted(compareFn) {
|
||||
const entries = [...this.entries()].sort(compareFn);
|
||||
return new _OrderedDict(entries);
|
||||
}
|
||||
toReversed() {
|
||||
const reversed = new _OrderedDict();
|
||||
for (let index = this.size - 1; index >= 0; index--) {
|
||||
const key = this.keyAt(index);
|
||||
const element = this.get(key);
|
||||
reversed.set(key, element);
|
||||
}
|
||||
return reversed;
|
||||
}
|
||||
toSpliced(...args) {
|
||||
const entries = [...this.entries()];
|
||||
entries.splice(...args);
|
||||
return new _OrderedDict(entries);
|
||||
}
|
||||
slice(start, end) {
|
||||
const result = new _OrderedDict();
|
||||
let stop = this.size - 1;
|
||||
if (start === void 0) {
|
||||
return result;
|
||||
}
|
||||
if (start < 0) {
|
||||
start = start + this.size;
|
||||
}
|
||||
if (end !== void 0 && end > 0) {
|
||||
stop = end - 1;
|
||||
}
|
||||
for (let index = start; index <= stop; index++) {
|
||||
const key = this.keyAt(index);
|
||||
const element = this.get(key);
|
||||
result.set(key, element);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
every(predicate, thisArg) {
|
||||
let index = 0;
|
||||
for (const entry of this) {
|
||||
if (!Reflect.apply(predicate, thisArg, [entry, index, this])) {
|
||||
return false;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
some(predicate, thisArg) {
|
||||
let index = 0;
|
||||
for (const entry of this) {
|
||||
if (Reflect.apply(predicate, thisArg, [entry, index, this])) {
|
||||
return true;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
function at(array, index) {
|
||||
if ("at" in Array.prototype) {
|
||||
return Array.prototype.at.call(array, index);
|
||||
}
|
||||
const actualIndex = toSafeIndex(array, index);
|
||||
return actualIndex === -1 ? void 0 : array[actualIndex];
|
||||
}
|
||||
function toSafeIndex(array, index) {
|
||||
const length = array.length;
|
||||
const relativeIndex = toSafeInteger(index);
|
||||
const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;
|
||||
return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;
|
||||
}
|
||||
function toSafeInteger(number) {
|
||||
return number !== number || number === 0 ? 0 : Math.trunc(number);
|
||||
}
|
||||
|
||||
// src/collection.tsx
|
||||
import { jsx as jsx2 } from "react/jsx-runtime";
|
||||
function createCollection2(name) {
|
||||
const PROVIDER_NAME = name + "CollectionProvider";
|
||||
const [createCollectionContext, createCollectionScope] = createContextScope2(PROVIDER_NAME);
|
||||
const [CollectionContextProvider, useCollectionContext] = createCollectionContext(
|
||||
PROVIDER_NAME,
|
||||
{
|
||||
collectionElement: null,
|
||||
collectionRef: { current: null },
|
||||
collectionRefObject: { current: null },
|
||||
itemMap: new OrderedDict(),
|
||||
setItemMap: () => void 0
|
||||
}
|
||||
);
|
||||
const CollectionProvider = ({ state, ...props }) => {
|
||||
return state ? /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ jsx2(CollectionInit, { ...props });
|
||||
};
|
||||
CollectionProvider.displayName = PROVIDER_NAME;
|
||||
const CollectionInit = (props) => {
|
||||
const state = useInitCollection();
|
||||
return /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state });
|
||||
};
|
||||
CollectionInit.displayName = PROVIDER_NAME + "Init";
|
||||
const CollectionProviderImpl = (props) => {
|
||||
const { scope, children, state } = props;
|
||||
const ref = React2.useRef(null);
|
||||
const [collectionElement, setCollectionElement] = React2.useState(
|
||||
null
|
||||
);
|
||||
const composeRefs = useComposedRefs2(ref, setCollectionElement);
|
||||
const [itemMap, setItemMap] = state;
|
||||
React2.useEffect(() => {
|
||||
if (!collectionElement) return;
|
||||
const observer = getChildListObserver(() => {
|
||||
});
|
||||
observer.observe(collectionElement, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
});
|
||||
return () => {
|
||||
observer.disconnect();
|
||||
};
|
||||
}, [collectionElement]);
|
||||
return /* @__PURE__ */ jsx2(
|
||||
CollectionContextProvider,
|
||||
{
|
||||
scope,
|
||||
itemMap,
|
||||
setItemMap,
|
||||
collectionRef: composeRefs,
|
||||
collectionRefObject: ref,
|
||||
collectionElement,
|
||||
children
|
||||
}
|
||||
);
|
||||
};
|
||||
CollectionProviderImpl.displayName = PROVIDER_NAME + "Impl";
|
||||
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
||||
const CollectionSlotImpl = createSlot2(COLLECTION_SLOT_NAME);
|
||||
const CollectionSlot = React2.forwardRef(
|
||||
(props, forwardedRef) => {
|
||||
const { scope, children } = props;
|
||||
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
||||
const composedRefs = useComposedRefs2(forwardedRef, context.collectionRef);
|
||||
return /* @__PURE__ */ jsx2(CollectionSlotImpl, { ref: composedRefs, children });
|
||||
}
|
||||
);
|
||||
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
||||
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
||||
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
||||
const CollectionItemSlotImpl = createSlot2(ITEM_SLOT_NAME);
|
||||
const CollectionItemSlot = React2.forwardRef(
|
||||
(props, forwardedRef) => {
|
||||
const { scope, children, ...itemData } = props;
|
||||
const ref = React2.useRef(null);
|
||||
const [element, setElement] = React2.useState(null);
|
||||
const composedRefs = useComposedRefs2(forwardedRef, ref, setElement);
|
||||
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
||||
const { setItemMap } = context;
|
||||
const itemDataRef = React2.useRef(itemData);
|
||||
if (!shallowEqual(itemDataRef.current, itemData)) {
|
||||
itemDataRef.current = itemData;
|
||||
}
|
||||
const memoizedItemData = itemDataRef.current;
|
||||
React2.useEffect(() => {
|
||||
const itemData2 = memoizedItemData;
|
||||
setItemMap((map) => {
|
||||
if (!element) {
|
||||
return map;
|
||||
}
|
||||
if (!map.has(element)) {
|
||||
map.set(element, { ...itemData2, element });
|
||||
return map.toSorted(sortByDocumentPosition);
|
||||
}
|
||||
return map.set(element, { ...itemData2, element }).toSorted(sortByDocumentPosition);
|
||||
});
|
||||
return () => {
|
||||
setItemMap((map) => {
|
||||
if (!element || !map.has(element)) {
|
||||
return map;
|
||||
}
|
||||
map.delete(element);
|
||||
return new OrderedDict(map);
|
||||
});
|
||||
};
|
||||
}, [element, memoizedItemData, setItemMap]);
|
||||
return /* @__PURE__ */ jsx2(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
|
||||
}
|
||||
);
|
||||
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
||||
function useInitCollection() {
|
||||
return React2.useState(new OrderedDict());
|
||||
}
|
||||
function useCollection(scope) {
|
||||
const { itemMap } = useCollectionContext(name + "CollectionConsumer", scope);
|
||||
return itemMap;
|
||||
}
|
||||
const functions = {
|
||||
createCollectionScope,
|
||||
useCollection,
|
||||
useInitCollection
|
||||
};
|
||||
return [
|
||||
{ Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
|
||||
functions
|
||||
];
|
||||
}
|
||||
function shallowEqual(a, b) {
|
||||
if (a === b) return true;
|
||||
if (typeof a !== "object" || typeof b !== "object") return false;
|
||||
if (a == null || b == null) return false;
|
||||
const keysA = Object.keys(a);
|
||||
const keysB = Object.keys(b);
|
||||
if (keysA.length !== keysB.length) return false;
|
||||
for (const key of keysA) {
|
||||
if (!Object.prototype.hasOwnProperty.call(b, key)) return false;
|
||||
if (a[key] !== b[key]) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function isElementPreceding(a, b) {
|
||||
return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);
|
||||
}
|
||||
function sortByDocumentPosition(a, b) {
|
||||
return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1;
|
||||
}
|
||||
function getChildListObserver(callback) {
|
||||
const observer = new MutationObserver((mutationsList) => {
|
||||
for (const mutation of mutationsList) {
|
||||
if (mutation.type === "childList") {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
return observer;
|
||||
}
|
||||
export {
|
||||
createCollection,
|
||||
createCollection2 as unstable_createCollection
|
||||
};
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
7
node_modules/@radix-ui/react-collection/dist/index.mjs.map
generated
vendored
Normal file
7
node_modules/@radix-ui/react-collection/dist/index.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
21
node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/LICENSE
generated
vendored
Normal file
21
node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 WorkOS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
3
node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/README.md
generated
vendored
Normal file
3
node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# `react-slot`
|
||||
|
||||
View docs [here](https://radix-ui.com/primitives/docs/utilities/slot).
|
||||
17
node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/dist/index.d.mts
generated
vendored
Normal file
17
node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/dist/index.d.mts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import * as React from 'react';
|
||||
|
||||
interface SlotProps extends React.HTMLAttributes<HTMLElement> {
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
declare function createSlot(ownerName: string): React.ForwardRefExoticComponent<SlotProps & React.RefAttributes<HTMLElement>>;
|
||||
declare const Slot: React.ForwardRefExoticComponent<SlotProps & React.RefAttributes<HTMLElement>>;
|
||||
interface SlottableProps {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
interface SlottableComponent extends React.FC<SlottableProps> {
|
||||
__radixId: symbol;
|
||||
}
|
||||
declare function createSlottable(ownerName: string): SlottableComponent;
|
||||
declare const Slottable: SlottableComponent;
|
||||
|
||||
export { Slot as Root, Slot, type SlotProps, Slottable, createSlot, createSlottable };
|
||||
17
node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/dist/index.d.ts
generated
vendored
Normal file
17
node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import * as React from 'react';
|
||||
|
||||
interface SlotProps extends React.HTMLAttributes<HTMLElement> {
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
declare function createSlot(ownerName: string): React.ForwardRefExoticComponent<SlotProps & React.RefAttributes<HTMLElement>>;
|
||||
declare const Slot: React.ForwardRefExoticComponent<SlotProps & React.RefAttributes<HTMLElement>>;
|
||||
interface SlottableProps {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
interface SlottableComponent extends React.FC<SlottableProps> {
|
||||
__radixId: symbol;
|
||||
}
|
||||
declare function createSlottable(ownerName: string): SlottableComponent;
|
||||
declare const Slottable: SlottableComponent;
|
||||
|
||||
export { Slot as Root, Slot, type SlotProps, Slottable, createSlot, createSlottable };
|
||||
138
node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/dist/index.js
generated
vendored
Normal file
138
node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
"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);
|
||||
|
||||
// src/index.ts
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
Root: () => Slot,
|
||||
Slot: () => Slot,
|
||||
Slottable: () => Slottable,
|
||||
createSlot: () => createSlot,
|
||||
createSlottable: () => createSlottable
|
||||
});
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
|
||||
// src/slot.tsx
|
||||
var React = __toESM(require("react"));
|
||||
var import_react_compose_refs = require("@radix-ui/react-compose-refs");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function createSlot(ownerName) {
|
||||
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
||||
const Slot2 = React.forwardRef((props, forwardedRef) => {
|
||||
const { children, ...slotProps } = props;
|
||||
const childrenArray = React.Children.toArray(children);
|
||||
const slottable = childrenArray.find(isSlottable);
|
||||
if (slottable) {
|
||||
const newElement = slottable.props.children;
|
||||
const newChildren = childrenArray.map((child) => {
|
||||
if (child === slottable) {
|
||||
if (React.Children.count(newElement) > 1) return React.Children.only(null);
|
||||
return React.isValidElement(newElement) ? newElement.props.children : null;
|
||||
} else {
|
||||
return child;
|
||||
}
|
||||
});
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
|
||||
}
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
||||
});
|
||||
Slot2.displayName = `${ownerName}.Slot`;
|
||||
return Slot2;
|
||||
}
|
||||
var Slot = /* @__PURE__ */ createSlot("Slot");
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function createSlotClone(ownerName) {
|
||||
const SlotClone = React.forwardRef((props, forwardedRef) => {
|
||||
const { children, ...slotProps } = props;
|
||||
if (React.isValidElement(children)) {
|
||||
const childrenRef = getElementRef(children);
|
||||
const props2 = mergeProps(slotProps, children.props);
|
||||
if (children.type !== React.Fragment) {
|
||||
props2.ref = forwardedRef ? (0, import_react_compose_refs.composeRefs)(forwardedRef, childrenRef) : childrenRef;
|
||||
}
|
||||
return React.cloneElement(children, props2);
|
||||
}
|
||||
return React.Children.count(children) > 1 ? React.Children.only(null) : null;
|
||||
});
|
||||
SlotClone.displayName = `${ownerName}.SlotClone`;
|
||||
return SlotClone;
|
||||
}
|
||||
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function createSlottable(ownerName) {
|
||||
const Slottable2 = ({ children }) => {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
||||
};
|
||||
Slottable2.displayName = `${ownerName}.Slottable`;
|
||||
Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
|
||||
return Slottable2;
|
||||
}
|
||||
var Slottable = /* @__PURE__ */ createSlottable("Slottable");
|
||||
function isSlottable(child) {
|
||||
return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
||||
}
|
||||
function mergeProps(slotProps, childProps) {
|
||||
const overrideProps = { ...childProps };
|
||||
for (const propName in childProps) {
|
||||
const slotPropValue = slotProps[propName];
|
||||
const childPropValue = childProps[propName];
|
||||
const isHandler = /^on[A-Z]/.test(propName);
|
||||
if (isHandler) {
|
||||
if (slotPropValue && childPropValue) {
|
||||
overrideProps[propName] = (...args) => {
|
||||
const result = childPropValue(...args);
|
||||
slotPropValue(...args);
|
||||
return result;
|
||||
};
|
||||
} else if (slotPropValue) {
|
||||
overrideProps[propName] = slotPropValue;
|
||||
}
|
||||
} else if (propName === "style") {
|
||||
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
||||
} else if (propName === "className") {
|
||||
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
||||
}
|
||||
}
|
||||
return { ...slotProps, ...overrideProps };
|
||||
}
|
||||
function getElementRef(element) {
|
||||
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
||||
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
||||
if (mayWarn) {
|
||||
return element.ref;
|
||||
}
|
||||
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
||||
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
||||
if (mayWarn) {
|
||||
return element.props.ref;
|
||||
}
|
||||
return element.props.ref || element.ref;
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
7
node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/dist/index.js.map
generated
vendored
Normal file
7
node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/dist/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
105
node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/dist/index.mjs
generated
vendored
Normal file
105
node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
// src/slot.tsx
|
||||
import * as React from "react";
|
||||
import { composeRefs } from "@radix-ui/react-compose-refs";
|
||||
import { Fragment as Fragment2, jsx } from "react/jsx-runtime";
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function createSlot(ownerName) {
|
||||
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
||||
const Slot2 = React.forwardRef((props, forwardedRef) => {
|
||||
const { children, ...slotProps } = props;
|
||||
const childrenArray = React.Children.toArray(children);
|
||||
const slottable = childrenArray.find(isSlottable);
|
||||
if (slottable) {
|
||||
const newElement = slottable.props.children;
|
||||
const newChildren = childrenArray.map((child) => {
|
||||
if (child === slottable) {
|
||||
if (React.Children.count(newElement) > 1) return React.Children.only(null);
|
||||
return React.isValidElement(newElement) ? newElement.props.children : null;
|
||||
} else {
|
||||
return child;
|
||||
}
|
||||
});
|
||||
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
|
||||
}
|
||||
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
||||
});
|
||||
Slot2.displayName = `${ownerName}.Slot`;
|
||||
return Slot2;
|
||||
}
|
||||
var Slot = /* @__PURE__ */ createSlot("Slot");
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function createSlotClone(ownerName) {
|
||||
const SlotClone = React.forwardRef((props, forwardedRef) => {
|
||||
const { children, ...slotProps } = props;
|
||||
if (React.isValidElement(children)) {
|
||||
const childrenRef = getElementRef(children);
|
||||
const props2 = mergeProps(slotProps, children.props);
|
||||
if (children.type !== React.Fragment) {
|
||||
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
||||
}
|
||||
return React.cloneElement(children, props2);
|
||||
}
|
||||
return React.Children.count(children) > 1 ? React.Children.only(null) : null;
|
||||
});
|
||||
SlotClone.displayName = `${ownerName}.SlotClone`;
|
||||
return SlotClone;
|
||||
}
|
||||
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function createSlottable(ownerName) {
|
||||
const Slottable2 = ({ children }) => {
|
||||
return /* @__PURE__ */ jsx(Fragment2, { children });
|
||||
};
|
||||
Slottable2.displayName = `${ownerName}.Slottable`;
|
||||
Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
|
||||
return Slottable2;
|
||||
}
|
||||
var Slottable = /* @__PURE__ */ createSlottable("Slottable");
|
||||
function isSlottable(child) {
|
||||
return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
||||
}
|
||||
function mergeProps(slotProps, childProps) {
|
||||
const overrideProps = { ...childProps };
|
||||
for (const propName in childProps) {
|
||||
const slotPropValue = slotProps[propName];
|
||||
const childPropValue = childProps[propName];
|
||||
const isHandler = /^on[A-Z]/.test(propName);
|
||||
if (isHandler) {
|
||||
if (slotPropValue && childPropValue) {
|
||||
overrideProps[propName] = (...args) => {
|
||||
const result = childPropValue(...args);
|
||||
slotPropValue(...args);
|
||||
return result;
|
||||
};
|
||||
} else if (slotPropValue) {
|
||||
overrideProps[propName] = slotPropValue;
|
||||
}
|
||||
} else if (propName === "style") {
|
||||
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
||||
} else if (propName === "className") {
|
||||
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
||||
}
|
||||
}
|
||||
return { ...slotProps, ...overrideProps };
|
||||
}
|
||||
function getElementRef(element) {
|
||||
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
||||
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
||||
if (mayWarn) {
|
||||
return element.ref;
|
||||
}
|
||||
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
||||
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
||||
if (mayWarn) {
|
||||
return element.props.ref;
|
||||
}
|
||||
return element.props.ref || element.ref;
|
||||
}
|
||||
export {
|
||||
Slot as Root,
|
||||
Slot,
|
||||
Slottable,
|
||||
createSlot,
|
||||
createSlottable
|
||||
};
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
7
node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/dist/index.mjs.map
generated
vendored
Normal file
7
node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/dist/index.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
63
node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/package.json
generated
vendored
Normal file
63
node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/package.json
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"name": "@radix-ui/react-slot",
|
||||
"version": "1.2.3",
|
||||
"license": "MIT",
|
||||
"source": "./src/index.ts",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"files": [
|
||||
"dist",
|
||||
"README.md"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-compose-refs": "1.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^19.0.7",
|
||||
"@types/react-dom": "^19.0.3",
|
||||
"eslint": "^9.18.0",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"typescript": "^5.7.3",
|
||||
"@repo/eslint-config": "0.0.0",
|
||||
"@repo/typescript-config": "0.0.0",
|
||||
"@repo/builder": "0.0.0"
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --max-warnings 0 src",
|
||||
"clean": "rm -rf dist",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"build": "radix-build"
|
||||
},
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
71
node_modules/@radix-ui/react-collection/package.json
generated
vendored
Normal file
71
node_modules/@radix-ui/react-collection/package.json
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"name": "@radix-ui/react-collection",
|
||||
"version": "1.1.7",
|
||||
"license": "MIT",
|
||||
"source": "./src/index.ts",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"files": [
|
||||
"dist",
|
||||
"README.md"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-compose-refs": "1.1.2",
|
||||
"@radix-ui/react-context": "1.1.2",
|
||||
"@radix-ui/react-primitive": "2.1.3",
|
||||
"@radix-ui/react-slot": "1.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^19.0.7",
|
||||
"@types/react-dom": "^19.0.3",
|
||||
"eslint": "^9.18.0",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"typescript": "^5.7.3",
|
||||
"@repo/builder": "0.0.0",
|
||||
"@repo/typescript-config": "0.0.0",
|
||||
"@repo/eslint-config": "0.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"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --max-warnings 0 src",
|
||||
"clean": "rm -rf dist",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"build": "radix-build"
|
||||
},
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
node_modules/@radix-ui/react-compose-refs/README.md
generated
vendored
Normal file
13
node_modules/@radix-ui/react-compose-refs/README.md
generated
vendored
Normal 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.
|
||||
15
node_modules/@radix-ui/react-compose-refs/dist/index.d.mts
generated
vendored
Normal file
15
node_modules/@radix-ui/react-compose-refs/dist/index.d.mts
generated
vendored
Normal 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>[]): React.RefCallback<T>;
|
||||
/**
|
||||
* A custom hook that composes multiple refs
|
||||
* Accepts callback refs and RefObject(s)
|
||||
*/
|
||||
declare function useComposedRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T>;
|
||||
|
||||
export { composeRefs, useComposedRefs };
|
||||
15
node_modules/@radix-ui/react-compose-refs/dist/index.d.ts
generated
vendored
Normal file
15
node_modules/@radix-ui/react-compose-refs/dist/index.d.ts
generated
vendored
Normal 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>[]): React.RefCallback<T>;
|
||||
/**
|
||||
* A custom hook that composes multiple refs
|
||||
* Accepts callback refs and RefObject(s)
|
||||
*/
|
||||
declare function useComposedRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T>;
|
||||
|
||||
export { composeRefs, useComposedRefs };
|
||||
74
node_modules/@radix-ui/react-compose-refs/dist/index.js
generated
vendored
Normal file
74
node_modules/@radix-ui/react-compose-refs/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
"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 index_exports = {};
|
||||
__export(index_exports, {
|
||||
composeRefs: () => composeRefs,
|
||||
useComposedRefs: () => useComposedRefs
|
||||
});
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
|
||||
// packages/react/compose-refs/src/compose-refs.tsx
|
||||
var React = __toESM(require("react"));
|
||||
function setRef(ref, value) {
|
||||
if (typeof ref === "function") {
|
||||
return ref(value);
|
||||
} else if (ref !== null && ref !== void 0) {
|
||||
ref.current = value;
|
||||
}
|
||||
}
|
||||
function composeRefs(...refs) {
|
||||
return (node) => {
|
||||
let hasCleanup = false;
|
||||
const cleanups = refs.map((ref) => {
|
||||
const cleanup = setRef(ref, node);
|
||||
if (!hasCleanup && typeof cleanup == "function") {
|
||||
hasCleanup = true;
|
||||
}
|
||||
return cleanup;
|
||||
});
|
||||
if (hasCleanup) {
|
||||
return () => {
|
||||
for (let i = 0; i < cleanups.length; i++) {
|
||||
const cleanup = cleanups[i];
|
||||
if (typeof cleanup == "function") {
|
||||
cleanup();
|
||||
} else {
|
||||
setRef(refs[i], null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
function useComposedRefs(...refs) {
|
||||
return React.useCallback(composeRefs(...refs), refs);
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
7
node_modules/@radix-ui/react-compose-refs/dist/index.js.map
generated
vendored
Normal file
7
node_modules/@radix-ui/react-compose-refs/dist/index.js.map
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../src/index.ts", "../src/compose-refs.tsx"],
|
||||
"sourcesContent": ["export { composeRefs, useComposedRefs } from './compose-refs';\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 return ref(value);\n } else if (ref !== null && ref !== undefined) {\n ref.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>[]): React.RefCallback<T> {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup == 'function') {\n hasCleanup = true;\n }\n return cleanup;\n });\n\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup == 'function') {\n cleanup();\n } else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\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>[]): React.RefCallback<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,WAAO,IAAI,KAAK;AAAA,EAClB,WAAW,QAAQ,QAAQ,QAAQ,QAAW;AAC5C,QAAI,UAAU;AAAA,EAChB;AACF;AAMA,SAAS,eAAkB,MAA8C;AACvE,SAAO,CAAC,SAAS;AACf,QAAI,aAAa;AACjB,UAAM,WAAW,KAAK,IAAI,CAAC,QAAQ;AACjC,YAAM,UAAU,OAAO,KAAK,IAAI;AAChC,UAAI,CAAC,cAAc,OAAO,WAAW,YAAY;AAC/C,qBAAa;AAAA,MACf;AACA,aAAO;AAAA,IACT,CAAC;AAMD,QAAI,YAAY;AACd,aAAO,MAAM;AACX,iBAAS,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;AACxC,gBAAM,UAAU,SAAS,CAAC;AAC1B,cAAI,OAAO,WAAW,YAAY;AAChC,oBAAQ;AAAA,UACV,OAAO;AACL,mBAAO,KAAK,CAAC,GAAG,IAAI;AAAA,UACtB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAMA,SAAS,mBAAsB,MAA8C;AAE3E,SAAa,kBAAY,YAAY,GAAG,IAAI,GAAG,IAAI;AACrD;",
|
||||
"names": []
|
||||
}
|
||||
41
node_modules/@radix-ui/react-compose-refs/dist/index.mjs
generated
vendored
Normal file
41
node_modules/@radix-ui/react-compose-refs/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
// packages/react/compose-refs/src/compose-refs.tsx
|
||||
import * as React from "react";
|
||||
function setRef(ref, value) {
|
||||
if (typeof ref === "function") {
|
||||
return ref(value);
|
||||
} else if (ref !== null && ref !== void 0) {
|
||||
ref.current = value;
|
||||
}
|
||||
}
|
||||
function composeRefs(...refs) {
|
||||
return (node) => {
|
||||
let hasCleanup = false;
|
||||
const cleanups = refs.map((ref) => {
|
||||
const cleanup = setRef(ref, node);
|
||||
if (!hasCleanup && typeof cleanup == "function") {
|
||||
hasCleanup = true;
|
||||
}
|
||||
return cleanup;
|
||||
});
|
||||
if (hasCleanup) {
|
||||
return () => {
|
||||
for (let i = 0; i < cleanups.length; i++) {
|
||||
const cleanup = cleanups[i];
|
||||
if (typeof cleanup == "function") {
|
||||
cleanup();
|
||||
} else {
|
||||
setRef(refs[i], null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
function useComposedRefs(...refs) {
|
||||
return React.useCallback(composeRefs(...refs), refs);
|
||||
}
|
||||
export {
|
||||
composeRefs,
|
||||
useComposedRefs
|
||||
};
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
7
node_modules/@radix-ui/react-compose-refs/dist/index.mjs.map
generated
vendored
Normal file
7
node_modules/@radix-ui/react-compose-refs/dist/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../src/compose-refs.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 return ref(value);\n } else if (ref !== null && ref !== undefined) {\n ref.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>[]): React.RefCallback<T> {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup == 'function') {\n hasCleanup = true;\n }\n return cleanup;\n });\n\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup == 'function') {\n cleanup();\n } else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\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>[]): React.RefCallback<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,WAAO,IAAI,KAAK;AAAA,EAClB,WAAW,QAAQ,QAAQ,QAAQ,QAAW;AAC5C,QAAI,UAAU;AAAA,EAChB;AACF;AAMA,SAAS,eAAkB,MAA8C;AACvE,SAAO,CAAC,SAAS;AACf,QAAI,aAAa;AACjB,UAAM,WAAW,KAAK,IAAI,CAAC,QAAQ;AACjC,YAAM,UAAU,OAAO,KAAK,IAAI;AAChC,UAAI,CAAC,cAAc,OAAO,WAAW,YAAY;AAC/C,qBAAa;AAAA,MACf;AACA,aAAO;AAAA,IACT,CAAC;AAMD,QAAI,YAAY;AACd,aAAO,MAAM;AACX,iBAAS,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;AACxC,gBAAM,UAAU,SAAS,CAAC;AAC1B,cAAI,OAAO,WAAW,YAAY;AAChC,oBAAQ;AAAA,UACV,OAAO;AACL,mBAAO,KAAK,CAAC,GAAG,IAAI;AAAA,UACtB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAMA,SAAS,mBAAsB,MAA8C;AAE3E,SAAa,kBAAY,YAAY,GAAG,IAAI,GAAG,IAAI;AACrD;",
|
||||
"names": []
|
||||
}
|
||||
75
node_modules/@radix-ui/react-compose-refs/package.json
generated
vendored
Normal file
75
node_modules/@radix-ui/react-compose-refs/package.json
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"name": "@radix-ui/react-compose-refs",
|
||||
"version": "1.1.2",
|
||||
"license": "MIT",
|
||||
"source": "./src/index.ts",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"publishConfig": {
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"README.md"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"lint": "eslint --max-warnings 0 src",
|
||||
"clean": "rm -rf dist",
|
||||
"version": "yarn version"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@repo/eslint-config": "0.0.0",
|
||||
"@repo/typescript-config": "0.0.0",
|
||||
"@types/react": "^19.0.7",
|
||||
"@types/react-dom": "^19.0.3",
|
||||
"eslint": "^9.18.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"typescript": "^5.7.3"
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"types": "./dist/index.d.ts"
|
||||
}
|
||||
13
node_modules/@radix-ui/react-context/README.md
generated
vendored
Normal file
13
node_modules/@radix-ui/react-context/README.md
generated
vendored
Normal 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.
|
||||
21
node_modules/@radix-ui/react-context/dist/index.d.mts
generated
vendored
Normal file
21
node_modules/@radix-ui/react-context/dist/index.d.mts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import * as React from 'react';
|
||||
|
||||
declare function createContext<ContextValueType extends object | null>(rootComponentName: string, defaultContext?: ContextValueType): readonly [React.FC<ContextValueType & {
|
||||
children: React.ReactNode;
|
||||
}>, (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) => readonly [React.FC<ContextValueType & {
|
||||
scope: Scope<ContextValueType>;
|
||||
children: React.ReactNode;
|
||||
}>, (consumerName: string, scope: Scope<ContextValueType | undefined>) => ContextValueType], CreateScope];
|
||||
|
||||
export { type CreateScope, type Scope, createContext, createContextScope };
|
||||
21
node_modules/@radix-ui/react-context/dist/index.d.ts
generated
vendored
Normal file
21
node_modules/@radix-ui/react-context/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import * as React from 'react';
|
||||
|
||||
declare function createContext<ContextValueType extends object | null>(rootComponentName: string, defaultContext?: ContextValueType): readonly [React.FC<ContextValueType & {
|
||||
children: React.ReactNode;
|
||||
}>, (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) => readonly [React.FC<ContextValueType & {
|
||||
scope: Scope<ContextValueType>;
|
||||
children: React.ReactNode;
|
||||
}>, (consumerName: string, scope: Scope<ContextValueType | undefined>) => ContextValueType], CreateScope];
|
||||
|
||||
export { type CreateScope, type Scope, createContext, createContextScope };
|
||||
114
node_modules/@radix-ui/react-context/dist/index.js
generated
vendored
Normal file
114
node_modules/@radix-ui/react-context/dist/index.js
generated
vendored
Normal 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 index_exports = {};
|
||||
__export(index_exports, {
|
||||
createContext: () => createContext2,
|
||||
createContextScope: () => createContextScope
|
||||
});
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
|
||||
// packages/react/context/src/create-context.tsx
|
||||
var React = __toESM(require("react"));
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function createContext2(rootComponentName, defaultContext) {
|
||||
const Context = React.createContext(defaultContext);
|
||||
const 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 });
|
||||
};
|
||||
Provider.displayName = rootComponentName + "Provider";
|
||||
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}\``);
|
||||
}
|
||||
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];
|
||||
const 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 });
|
||||
};
|
||||
Provider.displayName = rootComponentName + "Provider";
|
||||
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}\``);
|
||||
}
|
||||
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
|
||||
7
node_modules/@radix-ui/react-context/dist/index.js.map
generated
vendored
Normal file
7
node_modules/@radix-ui/react-context/dist/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
81
node_modules/@radix-ui/react-context/dist/index.mjs
generated
vendored
Normal file
81
node_modules/@radix-ui/react-context/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
// packages/react/context/src/create-context.tsx
|
||||
import * as React from "react";
|
||||
import { jsx } from "react/jsx-runtime";
|
||||
function createContext2(rootComponentName, defaultContext) {
|
||||
const Context = React.createContext(defaultContext);
|
||||
const Provider = (props) => {
|
||||
const { children, ...context } = props;
|
||||
const value = React.useMemo(() => context, Object.values(context));
|
||||
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
||||
};
|
||||
Provider.displayName = rootComponentName + "Provider";
|
||||
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}\``);
|
||||
}
|
||||
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];
|
||||
const 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 });
|
||||
};
|
||||
Provider.displayName = rootComponentName + "Provider";
|
||||
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}\``);
|
||||
}
|
||||
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
|
||||
7
node_modules/@radix-ui/react-context/dist/index.mjs.map
generated
vendored
Normal file
7
node_modules/@radix-ui/react-context/dist/index.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
75
node_modules/@radix-ui/react-context/package.json
generated
vendored
Normal file
75
node_modules/@radix-ui/react-context/package.json
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"name": "@radix-ui/react-context",
|
||||
"version": "1.1.2",
|
||||
"license": "MIT",
|
||||
"source": "./src/index.ts",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"publishConfig": {
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"README.md"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"lint": "eslint --max-warnings 0 src",
|
||||
"clean": "rm -rf dist",
|
||||
"version": "yarn version"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@repo/eslint-config": "0.0.0",
|
||||
"@repo/typescript-config": "0.0.0",
|
||||
"@types/react": "^19.0.7",
|
||||
"@types/react-dom": "^19.0.3",
|
||||
"eslint": "^9.18.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"typescript": "^5.7.3"
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"types": "./dist/index.d.ts"
|
||||
}
|
||||
13
node_modules/@radix-ui/react-direction/README.md
generated
vendored
Normal file
13
node_modules/@radix-ui/react-direction/README.md
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# `react-direction`
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ yarn add @radix-ui/react-direction
|
||||
# or
|
||||
$ npm install @radix-ui/react-direction
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
View docs [here](https://radix-ui.com/primitives/docs/utilities/direction).
|
||||
12
node_modules/@radix-ui/react-direction/dist/index.d.mts
generated
vendored
Normal file
12
node_modules/@radix-ui/react-direction/dist/index.d.mts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import * as React from 'react';
|
||||
|
||||
type Direction = 'ltr' | 'rtl';
|
||||
interface DirectionProviderProps {
|
||||
children?: React.ReactNode;
|
||||
dir: Direction;
|
||||
}
|
||||
declare const DirectionProvider: React.FC<DirectionProviderProps>;
|
||||
declare function useDirection(localDir?: Direction): Direction;
|
||||
declare const Provider: React.FC<DirectionProviderProps>;
|
||||
|
||||
export { DirectionProvider, Provider, useDirection };
|
||||
12
node_modules/@radix-ui/react-direction/dist/index.d.ts
generated
vendored
Normal file
12
node_modules/@radix-ui/react-direction/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import * as React from 'react';
|
||||
|
||||
type Direction = 'ltr' | 'rtl';
|
||||
interface DirectionProviderProps {
|
||||
children?: React.ReactNode;
|
||||
dir: Direction;
|
||||
}
|
||||
declare const DirectionProvider: React.FC<DirectionProviderProps>;
|
||||
declare function useDirection(localDir?: Direction): Direction;
|
||||
declare const Provider: React.FC<DirectionProviderProps>;
|
||||
|
||||
export { DirectionProvider, Provider, useDirection };
|
||||
52
node_modules/@radix-ui/react-direction/dist/index.js
generated
vendored
Normal file
52
node_modules/@radix-ui/react-direction/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"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/direction/src/index.ts
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
DirectionProvider: () => DirectionProvider,
|
||||
Provider: () => Provider,
|
||||
useDirection: () => useDirection
|
||||
});
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
|
||||
// packages/react/direction/src/direction.tsx
|
||||
var React = __toESM(require("react"));
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
var DirectionContext = React.createContext(void 0);
|
||||
var DirectionProvider = (props) => {
|
||||
const { dir, children } = props;
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DirectionContext.Provider, { value: dir, children });
|
||||
};
|
||||
function useDirection(localDir) {
|
||||
const globalDir = React.useContext(DirectionContext);
|
||||
return localDir || globalDir || "ltr";
|
||||
}
|
||||
var Provider = DirectionProvider;
|
||||
//# sourceMappingURL=index.js.map
|
||||
7
node_modules/@radix-ui/react-direction/dist/index.js.map
generated
vendored
Normal file
7
node_modules/@radix-ui/react-direction/dist/index.js.map
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../src/index.ts", "../src/direction.tsx"],
|
||||
"sourcesContent": ["export {\n useDirection,\n //\n Provider,\n //\n DirectionProvider,\n} from './direction';\n", "import * as React from 'react';\n\ntype Direction = 'ltr' | 'rtl';\nconst DirectionContext = React.createContext<Direction | undefined>(undefined);\n\n/* -------------------------------------------------------------------------------------------------\n * Direction\n * -----------------------------------------------------------------------------------------------*/\n\ninterface DirectionProviderProps {\n children?: React.ReactNode;\n dir: Direction;\n}\nconst DirectionProvider: React.FC<DirectionProviderProps> = (props) => {\n const { dir, children } = props;\n return <DirectionContext.Provider value={dir}>{children}</DirectionContext.Provider>;\n};\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction useDirection(localDir?: Direction) {\n const globalDir = React.useContext(DirectionContext);\n return localDir || globalDir || 'ltr';\n}\n\nconst Provider = DirectionProvider;\n\nexport {\n useDirection,\n //\n Provider,\n //\n DirectionProvider,\n};\n"],
|
||||
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AAed;AAZT,IAAM,mBAAyB,oBAAqC,MAAS;AAU7E,IAAM,oBAAsD,CAAC,UAAU;AACrE,QAAM,EAAE,KAAK,SAAS,IAAI;AAC1B,SAAO,4CAAC,iBAAiB,UAAjB,EAA0B,OAAO,KAAM,UAAS;AAC1D;AAIA,SAAS,aAAa,UAAsB;AAC1C,QAAM,YAAkB,iBAAW,gBAAgB;AACnD,SAAO,YAAY,aAAa;AAClC;AAEA,IAAM,WAAW;",
|
||||
"names": []
|
||||
}
|
||||
19
node_modules/@radix-ui/react-direction/dist/index.mjs
generated
vendored
Normal file
19
node_modules/@radix-ui/react-direction/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
// packages/react/direction/src/direction.tsx
|
||||
import * as React from "react";
|
||||
import { jsx } from "react/jsx-runtime";
|
||||
var DirectionContext = React.createContext(void 0);
|
||||
var DirectionProvider = (props) => {
|
||||
const { dir, children } = props;
|
||||
return /* @__PURE__ */ jsx(DirectionContext.Provider, { value: dir, children });
|
||||
};
|
||||
function useDirection(localDir) {
|
||||
const globalDir = React.useContext(DirectionContext);
|
||||
return localDir || globalDir || "ltr";
|
||||
}
|
||||
var Provider = DirectionProvider;
|
||||
export {
|
||||
DirectionProvider,
|
||||
Provider,
|
||||
useDirection
|
||||
};
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
7
node_modules/@radix-ui/react-direction/dist/index.mjs.map
generated
vendored
Normal file
7
node_modules/@radix-ui/react-direction/dist/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../src/direction.tsx"],
|
||||
"sourcesContent": ["import * as React from 'react';\n\ntype Direction = 'ltr' | 'rtl';\nconst DirectionContext = React.createContext<Direction | undefined>(undefined);\n\n/* -------------------------------------------------------------------------------------------------\n * Direction\n * -----------------------------------------------------------------------------------------------*/\n\ninterface DirectionProviderProps {\n children?: React.ReactNode;\n dir: Direction;\n}\nconst DirectionProvider: React.FC<DirectionProviderProps> = (props) => {\n const { dir, children } = props;\n return <DirectionContext.Provider value={dir}>{children}</DirectionContext.Provider>;\n};\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction useDirection(localDir?: Direction) {\n const globalDir = React.useContext(DirectionContext);\n return localDir || globalDir || 'ltr';\n}\n\nconst Provider = DirectionProvider;\n\nexport {\n useDirection,\n //\n Provider,\n //\n DirectionProvider,\n};\n"],
|
||||
"mappings": ";AAAA,YAAY,WAAW;AAed;AAZT,IAAM,mBAAyB,oBAAqC,MAAS;AAU7E,IAAM,oBAAsD,CAAC,UAAU;AACrE,QAAM,EAAE,KAAK,SAAS,IAAI;AAC1B,SAAO,oBAAC,iBAAiB,UAAjB,EAA0B,OAAO,KAAM,UAAS;AAC1D;AAIA,SAAS,aAAa,UAAsB;AAC1C,QAAM,YAAkB,iBAAW,gBAAgB;AACnD,SAAO,YAAY,aAAa;AAClC;AAEA,IAAM,WAAW;",
|
||||
"names": []
|
||||
}
|
||||
75
node_modules/@radix-ui/react-direction/package.json
generated
vendored
Normal file
75
node_modules/@radix-ui/react-direction/package.json
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"name": "@radix-ui/react-direction",
|
||||
"version": "1.1.1",
|
||||
"license": "MIT",
|
||||
"source": "./src/index.ts",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"publishConfig": {
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"README.md"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"lint": "eslint --max-warnings 0 src",
|
||||
"clean": "rm -rf dist",
|
||||
"version": "yarn version"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@repo/eslint-config": "0.0.0",
|
||||
"@repo/typescript-config": "0.0.0",
|
||||
"@types/react": "^19.0.7",
|
||||
"@types/react-dom": "^19.0.3",
|
||||
"eslint": "^9.18.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"typescript": "^5.7.3"
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"types": "./dist/index.d.ts"
|
||||
}
|
||||
21
node_modules/@radix-ui/react-dismissable-layer/LICENSE
generated
vendored
Normal file
21
node_modules/@radix-ui/react-dismissable-layer/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 WorkOS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
3
node_modules/@radix-ui/react-dismissable-layer/README.md
generated
vendored
Normal file
3
node_modules/@radix-ui/react-dismissable-layer/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# `react-dismissable-layer`
|
||||
|
||||
This is an internal utility, not intended for public usage.
|
||||
51
node_modules/@radix-ui/react-dismissable-layer/dist/index.d.mts
generated
vendored
Normal file
51
node_modules/@radix-ui/react-dismissable-layer/dist/index.d.mts
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
import * as React from 'react';
|
||||
import { Primitive } from '@radix-ui/react-primitive';
|
||||
|
||||
type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
|
||||
interface DismissableLayerProps extends PrimitiveDivProps {
|
||||
/**
|
||||
* When `true`, hover/focus/click interactions will be disabled on elements outside
|
||||
* the `DismissableLayer`. Users will need to click twice on outside elements to
|
||||
* interact with them: once to close the `DismissableLayer`, and again to trigger the element.
|
||||
*/
|
||||
disableOutsidePointerEvents?: boolean;
|
||||
/**
|
||||
* Event handler called when the escape key is down.
|
||||
* Can be prevented.
|
||||
*/
|
||||
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
||||
/**
|
||||
* Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`.
|
||||
* Can be prevented.
|
||||
*/
|
||||
onPointerDownOutside?: (event: PointerDownOutsideEvent) => void;
|
||||
/**
|
||||
* Event handler called when the focus moves outside of the `DismissableLayer`.
|
||||
* Can be prevented.
|
||||
*/
|
||||
onFocusOutside?: (event: FocusOutsideEvent) => void;
|
||||
/**
|
||||
* Event handler called when an interaction happens outside the `DismissableLayer`.
|
||||
* Specifically, when a `pointerdown` event happens outside or focus moves outside of it.
|
||||
* Can be prevented.
|
||||
*/
|
||||
onInteractOutside?: (event: PointerDownOutsideEvent | FocusOutsideEvent) => void;
|
||||
/**
|
||||
* Handler called when the `DismissableLayer` should be dismissed
|
||||
*/
|
||||
onDismiss?: () => void;
|
||||
}
|
||||
declare const DismissableLayer: React.ForwardRefExoticComponent<DismissableLayerProps & React.RefAttributes<HTMLDivElement>>;
|
||||
interface DismissableLayerBranchProps extends PrimitiveDivProps {
|
||||
}
|
||||
declare const DismissableLayerBranch: React.ForwardRefExoticComponent<DismissableLayerBranchProps & React.RefAttributes<HTMLDivElement>>;
|
||||
type PointerDownOutsideEvent = CustomEvent<{
|
||||
originalEvent: PointerEvent;
|
||||
}>;
|
||||
type FocusOutsideEvent = CustomEvent<{
|
||||
originalEvent: FocusEvent;
|
||||
}>;
|
||||
declare const Root: React.ForwardRefExoticComponent<DismissableLayerProps & React.RefAttributes<HTMLDivElement>>;
|
||||
declare const Branch: React.ForwardRefExoticComponent<DismissableLayerBranchProps & React.RefAttributes<HTMLDivElement>>;
|
||||
|
||||
export { Branch, DismissableLayer, DismissableLayerBranch, type DismissableLayerProps, Root };
|
||||
51
node_modules/@radix-ui/react-dismissable-layer/dist/index.d.ts
generated
vendored
Normal file
51
node_modules/@radix-ui/react-dismissable-layer/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
import * as React from 'react';
|
||||
import { Primitive } from '@radix-ui/react-primitive';
|
||||
|
||||
type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
|
||||
interface DismissableLayerProps extends PrimitiveDivProps {
|
||||
/**
|
||||
* When `true`, hover/focus/click interactions will be disabled on elements outside
|
||||
* the `DismissableLayer`. Users will need to click twice on outside elements to
|
||||
* interact with them: once to close the `DismissableLayer`, and again to trigger the element.
|
||||
*/
|
||||
disableOutsidePointerEvents?: boolean;
|
||||
/**
|
||||
* Event handler called when the escape key is down.
|
||||
* Can be prevented.
|
||||
*/
|
||||
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
||||
/**
|
||||
* Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`.
|
||||
* Can be prevented.
|
||||
*/
|
||||
onPointerDownOutside?: (event: PointerDownOutsideEvent) => void;
|
||||
/**
|
||||
* Event handler called when the focus moves outside of the `DismissableLayer`.
|
||||
* Can be prevented.
|
||||
*/
|
||||
onFocusOutside?: (event: FocusOutsideEvent) => void;
|
||||
/**
|
||||
* Event handler called when an interaction happens outside the `DismissableLayer`.
|
||||
* Specifically, when a `pointerdown` event happens outside or focus moves outside of it.
|
||||
* Can be prevented.
|
||||
*/
|
||||
onInteractOutside?: (event: PointerDownOutsideEvent | FocusOutsideEvent) => void;
|
||||
/**
|
||||
* Handler called when the `DismissableLayer` should be dismissed
|
||||
*/
|
||||
onDismiss?: () => void;
|
||||
}
|
||||
declare const DismissableLayer: React.ForwardRefExoticComponent<DismissableLayerProps & React.RefAttributes<HTMLDivElement>>;
|
||||
interface DismissableLayerBranchProps extends PrimitiveDivProps {
|
||||
}
|
||||
declare const DismissableLayerBranch: React.ForwardRefExoticComponent<DismissableLayerBranchProps & React.RefAttributes<HTMLDivElement>>;
|
||||
type PointerDownOutsideEvent = CustomEvent<{
|
||||
originalEvent: PointerEvent;
|
||||
}>;
|
||||
type FocusOutsideEvent = CustomEvent<{
|
||||
originalEvent: FocusEvent;
|
||||
}>;
|
||||
declare const Root: React.ForwardRefExoticComponent<DismissableLayerProps & React.RefAttributes<HTMLDivElement>>;
|
||||
declare const Branch: React.ForwardRefExoticComponent<DismissableLayerBranchProps & React.RefAttributes<HTMLDivElement>>;
|
||||
|
||||
export { Branch, DismissableLayer, DismissableLayerBranch, type DismissableLayerProps, Root };
|
||||
253
node_modules/@radix-ui/react-dismissable-layer/dist/index.js
generated
vendored
Normal file
253
node_modules/@radix-ui/react-dismissable-layer/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,253 @@
|
||||
"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);
|
||||
|
||||
// src/index.ts
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
Branch: () => Branch,
|
||||
DismissableLayer: () => DismissableLayer,
|
||||
DismissableLayerBranch: () => DismissableLayerBranch,
|
||||
Root: () => Root
|
||||
});
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
|
||||
// src/dismissable-layer.tsx
|
||||
var React = __toESM(require("react"));
|
||||
var import_primitive = require("@radix-ui/primitive");
|
||||
var import_react_primitive = require("@radix-ui/react-primitive");
|
||||
var import_react_compose_refs = require("@radix-ui/react-compose-refs");
|
||||
var import_react_use_callback_ref = require("@radix-ui/react-use-callback-ref");
|
||||
var import_react_use_escape_keydown = require("@radix-ui/react-use-escape-keydown");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
||||
var CONTEXT_UPDATE = "dismissableLayer.update";
|
||||
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
||||
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
||||
var originalBodyPointerEvents;
|
||||
var DismissableLayerContext = React.createContext({
|
||||
layers: /* @__PURE__ */ new Set(),
|
||||
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
||||
branches: /* @__PURE__ */ new Set()
|
||||
});
|
||||
var DismissableLayer = React.forwardRef(
|
||||
(props, forwardedRef) => {
|
||||
const {
|
||||
disableOutsidePointerEvents = false,
|
||||
onEscapeKeyDown,
|
||||
onPointerDownOutside,
|
||||
onFocusOutside,
|
||||
onInteractOutside,
|
||||
onDismiss,
|
||||
...layerProps
|
||||
} = props;
|
||||
const context = React.useContext(DismissableLayerContext);
|
||||
const [node, setNode] = React.useState(null);
|
||||
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
|
||||
const [, force] = React.useState({});
|
||||
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, (node2) => setNode(node2));
|
||||
const layers = Array.from(context.layers);
|
||||
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
||||
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
||||
const index = node ? layers.indexOf(node) : -1;
|
||||
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
||||
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
||||
const pointerDownOutside = usePointerDownOutside((event) => {
|
||||
const target = event.target;
|
||||
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
||||
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
||||
onPointerDownOutside?.(event);
|
||||
onInteractOutside?.(event);
|
||||
if (!event.defaultPrevented) onDismiss?.();
|
||||
}, ownerDocument);
|
||||
const focusOutside = useFocusOutside((event) => {
|
||||
const target = event.target;
|
||||
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
||||
if (isFocusInBranch) return;
|
||||
onFocusOutside?.(event);
|
||||
onInteractOutside?.(event);
|
||||
if (!event.defaultPrevented) onDismiss?.();
|
||||
}, ownerDocument);
|
||||
(0, import_react_use_escape_keydown.useEscapeKeydown)((event) => {
|
||||
const isHighestLayer = index === context.layers.size - 1;
|
||||
if (!isHighestLayer) return;
|
||||
onEscapeKeyDown?.(event);
|
||||
if (!event.defaultPrevented && onDismiss) {
|
||||
event.preventDefault();
|
||||
onDismiss();
|
||||
}
|
||||
}, ownerDocument);
|
||||
React.useEffect(() => {
|
||||
if (!node) return;
|
||||
if (disableOutsidePointerEvents) {
|
||||
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
||||
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
||||
ownerDocument.body.style.pointerEvents = "none";
|
||||
}
|
||||
context.layersWithOutsidePointerEventsDisabled.add(node);
|
||||
}
|
||||
context.layers.add(node);
|
||||
dispatchUpdate();
|
||||
return () => {
|
||||
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
||||
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
||||
}
|
||||
};
|
||||
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
||||
React.useEffect(() => {
|
||||
return () => {
|
||||
if (!node) return;
|
||||
context.layers.delete(node);
|
||||
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
||||
dispatchUpdate();
|
||||
};
|
||||
}, [node, context]);
|
||||
React.useEffect(() => {
|
||||
const handleUpdate = () => force({});
|
||||
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
||||
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
||||
}, []);
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_react_primitive.Primitive.div,
|
||||
{
|
||||
...layerProps,
|
||||
ref: composedRefs,
|
||||
style: {
|
||||
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
||||
...props.style
|
||||
},
|
||||
onFocusCapture: (0, import_primitive.composeEventHandlers)(props.onFocusCapture, focusOutside.onFocusCapture),
|
||||
onBlurCapture: (0, import_primitive.composeEventHandlers)(props.onBlurCapture, focusOutside.onBlurCapture),
|
||||
onPointerDownCapture: (0, import_primitive.composeEventHandlers)(
|
||||
props.onPointerDownCapture,
|
||||
pointerDownOutside.onPointerDownCapture
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
||||
var BRANCH_NAME = "DismissableLayerBranch";
|
||||
var DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {
|
||||
const context = React.useContext(DismissableLayerContext);
|
||||
const ref = React.useRef(null);
|
||||
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref);
|
||||
React.useEffect(() => {
|
||||
const node = ref.current;
|
||||
if (node) {
|
||||
context.branches.add(node);
|
||||
return () => {
|
||||
context.branches.delete(node);
|
||||
};
|
||||
}
|
||||
}, [context.branches]);
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.div, { ...props, ref: composedRefs });
|
||||
});
|
||||
DismissableLayerBranch.displayName = BRANCH_NAME;
|
||||
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
||||
const handlePointerDownOutside = (0, import_react_use_callback_ref.useCallbackRef)(onPointerDownOutside);
|
||||
const isPointerInsideReactTreeRef = React.useRef(false);
|
||||
const handleClickRef = React.useRef(() => {
|
||||
});
|
||||
React.useEffect(() => {
|
||||
const handlePointerDown = (event) => {
|
||||
if (event.target && !isPointerInsideReactTreeRef.current) {
|
||||
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
||||
handleAndDispatchCustomEvent(
|
||||
POINTER_DOWN_OUTSIDE,
|
||||
handlePointerDownOutside,
|
||||
eventDetail,
|
||||
{ discrete: true }
|
||||
);
|
||||
};
|
||||
var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;
|
||||
const eventDetail = { originalEvent: event };
|
||||
if (event.pointerType === "touch") {
|
||||
ownerDocument.removeEventListener("click", handleClickRef.current);
|
||||
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
||||
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
||||
} else {
|
||||
handleAndDispatchPointerDownOutsideEvent2();
|
||||
}
|
||||
} else {
|
||||
ownerDocument.removeEventListener("click", handleClickRef.current);
|
||||
}
|
||||
isPointerInsideReactTreeRef.current = false;
|
||||
};
|
||||
const timerId = window.setTimeout(() => {
|
||||
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
||||
}, 0);
|
||||
return () => {
|
||||
window.clearTimeout(timerId);
|
||||
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
||||
ownerDocument.removeEventListener("click", handleClickRef.current);
|
||||
};
|
||||
}, [ownerDocument, handlePointerDownOutside]);
|
||||
return {
|
||||
// ensures we check React component tree (not just DOM tree)
|
||||
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
||||
};
|
||||
}
|
||||
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
||||
const handleFocusOutside = (0, import_react_use_callback_ref.useCallbackRef)(onFocusOutside);
|
||||
const isFocusInsideReactTreeRef = React.useRef(false);
|
||||
React.useEffect(() => {
|
||||
const handleFocus = (event) => {
|
||||
if (event.target && !isFocusInsideReactTreeRef.current) {
|
||||
const eventDetail = { originalEvent: event };
|
||||
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
||||
discrete: false
|
||||
});
|
||||
}
|
||||
};
|
||||
ownerDocument.addEventListener("focusin", handleFocus);
|
||||
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
||||
}, [ownerDocument, handleFocusOutside]);
|
||||
return {
|
||||
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
||||
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
||||
};
|
||||
}
|
||||
function dispatchUpdate() {
|
||||
const event = new CustomEvent(CONTEXT_UPDATE);
|
||||
document.dispatchEvent(event);
|
||||
}
|
||||
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
||||
const target = detail.originalEvent.target;
|
||||
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
||||
if (handler) target.addEventListener(name, handler, { once: true });
|
||||
if (discrete) {
|
||||
(0, import_react_primitive.dispatchDiscreteCustomEvent)(target, event);
|
||||
} else {
|
||||
target.dispatchEvent(event);
|
||||
}
|
||||
}
|
||||
var Root = DismissableLayer;
|
||||
var Branch = DismissableLayerBranch;
|
||||
//# sourceMappingURL=index.js.map
|
||||
7
node_modules/@radix-ui/react-dismissable-layer/dist/index.js.map
generated
vendored
Normal file
7
node_modules/@radix-ui/react-dismissable-layer/dist/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
221
node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
generated
vendored
Normal file
221
node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,221 @@
|
||||
"use client";
|
||||
|
||||
// src/dismissable-layer.tsx
|
||||
import * as React from "react";
|
||||
import { composeEventHandlers } from "@radix-ui/primitive";
|
||||
import { Primitive, dispatchDiscreteCustomEvent } from "@radix-ui/react-primitive";
|
||||
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
||||
import { useCallbackRef } from "@radix-ui/react-use-callback-ref";
|
||||
import { useEscapeKeydown } from "@radix-ui/react-use-escape-keydown";
|
||||
import { jsx } from "react/jsx-runtime";
|
||||
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
||||
var CONTEXT_UPDATE = "dismissableLayer.update";
|
||||
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
||||
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
||||
var originalBodyPointerEvents;
|
||||
var DismissableLayerContext = React.createContext({
|
||||
layers: /* @__PURE__ */ new Set(),
|
||||
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
||||
branches: /* @__PURE__ */ new Set()
|
||||
});
|
||||
var DismissableLayer = React.forwardRef(
|
||||
(props, forwardedRef) => {
|
||||
const {
|
||||
disableOutsidePointerEvents = false,
|
||||
onEscapeKeyDown,
|
||||
onPointerDownOutside,
|
||||
onFocusOutside,
|
||||
onInteractOutside,
|
||||
onDismiss,
|
||||
...layerProps
|
||||
} = props;
|
||||
const context = React.useContext(DismissableLayerContext);
|
||||
const [node, setNode] = React.useState(null);
|
||||
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
|
||||
const [, force] = React.useState({});
|
||||
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
|
||||
const layers = Array.from(context.layers);
|
||||
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
||||
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
||||
const index = node ? layers.indexOf(node) : -1;
|
||||
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
||||
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
||||
const pointerDownOutside = usePointerDownOutside((event) => {
|
||||
const target = event.target;
|
||||
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
||||
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
||||
onPointerDownOutside?.(event);
|
||||
onInteractOutside?.(event);
|
||||
if (!event.defaultPrevented) onDismiss?.();
|
||||
}, ownerDocument);
|
||||
const focusOutside = useFocusOutside((event) => {
|
||||
const target = event.target;
|
||||
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
||||
if (isFocusInBranch) return;
|
||||
onFocusOutside?.(event);
|
||||
onInteractOutside?.(event);
|
||||
if (!event.defaultPrevented) onDismiss?.();
|
||||
}, ownerDocument);
|
||||
useEscapeKeydown((event) => {
|
||||
const isHighestLayer = index === context.layers.size - 1;
|
||||
if (!isHighestLayer) return;
|
||||
onEscapeKeyDown?.(event);
|
||||
if (!event.defaultPrevented && onDismiss) {
|
||||
event.preventDefault();
|
||||
onDismiss();
|
||||
}
|
||||
}, ownerDocument);
|
||||
React.useEffect(() => {
|
||||
if (!node) return;
|
||||
if (disableOutsidePointerEvents) {
|
||||
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
||||
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
||||
ownerDocument.body.style.pointerEvents = "none";
|
||||
}
|
||||
context.layersWithOutsidePointerEventsDisabled.add(node);
|
||||
}
|
||||
context.layers.add(node);
|
||||
dispatchUpdate();
|
||||
return () => {
|
||||
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
||||
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
||||
}
|
||||
};
|
||||
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
||||
React.useEffect(() => {
|
||||
return () => {
|
||||
if (!node) return;
|
||||
context.layers.delete(node);
|
||||
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
||||
dispatchUpdate();
|
||||
};
|
||||
}, [node, context]);
|
||||
React.useEffect(() => {
|
||||
const handleUpdate = () => force({});
|
||||
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
||||
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
||||
}, []);
|
||||
return /* @__PURE__ */ jsx(
|
||||
Primitive.div,
|
||||
{
|
||||
...layerProps,
|
||||
ref: composedRefs,
|
||||
style: {
|
||||
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
||||
...props.style
|
||||
},
|
||||
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
||||
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
||||
onPointerDownCapture: composeEventHandlers(
|
||||
props.onPointerDownCapture,
|
||||
pointerDownOutside.onPointerDownCapture
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
||||
var BRANCH_NAME = "DismissableLayerBranch";
|
||||
var DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {
|
||||
const context = React.useContext(DismissableLayerContext);
|
||||
const ref = React.useRef(null);
|
||||
const composedRefs = useComposedRefs(forwardedRef, ref);
|
||||
React.useEffect(() => {
|
||||
const node = ref.current;
|
||||
if (node) {
|
||||
context.branches.add(node);
|
||||
return () => {
|
||||
context.branches.delete(node);
|
||||
};
|
||||
}
|
||||
}, [context.branches]);
|
||||
return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });
|
||||
});
|
||||
DismissableLayerBranch.displayName = BRANCH_NAME;
|
||||
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
||||
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
||||
const isPointerInsideReactTreeRef = React.useRef(false);
|
||||
const handleClickRef = React.useRef(() => {
|
||||
});
|
||||
React.useEffect(() => {
|
||||
const handlePointerDown = (event) => {
|
||||
if (event.target && !isPointerInsideReactTreeRef.current) {
|
||||
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
||||
handleAndDispatchCustomEvent(
|
||||
POINTER_DOWN_OUTSIDE,
|
||||
handlePointerDownOutside,
|
||||
eventDetail,
|
||||
{ discrete: true }
|
||||
);
|
||||
};
|
||||
var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;
|
||||
const eventDetail = { originalEvent: event };
|
||||
if (event.pointerType === "touch") {
|
||||
ownerDocument.removeEventListener("click", handleClickRef.current);
|
||||
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
||||
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
||||
} else {
|
||||
handleAndDispatchPointerDownOutsideEvent2();
|
||||
}
|
||||
} else {
|
||||
ownerDocument.removeEventListener("click", handleClickRef.current);
|
||||
}
|
||||
isPointerInsideReactTreeRef.current = false;
|
||||
};
|
||||
const timerId = window.setTimeout(() => {
|
||||
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
||||
}, 0);
|
||||
return () => {
|
||||
window.clearTimeout(timerId);
|
||||
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
||||
ownerDocument.removeEventListener("click", handleClickRef.current);
|
||||
};
|
||||
}, [ownerDocument, handlePointerDownOutside]);
|
||||
return {
|
||||
// ensures we check React component tree (not just DOM tree)
|
||||
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
||||
};
|
||||
}
|
||||
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
||||
const handleFocusOutside = useCallbackRef(onFocusOutside);
|
||||
const isFocusInsideReactTreeRef = React.useRef(false);
|
||||
React.useEffect(() => {
|
||||
const handleFocus = (event) => {
|
||||
if (event.target && !isFocusInsideReactTreeRef.current) {
|
||||
const eventDetail = { originalEvent: event };
|
||||
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
||||
discrete: false
|
||||
});
|
||||
}
|
||||
};
|
||||
ownerDocument.addEventListener("focusin", handleFocus);
|
||||
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
||||
}, [ownerDocument, handleFocusOutside]);
|
||||
return {
|
||||
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
||||
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
||||
};
|
||||
}
|
||||
function dispatchUpdate() {
|
||||
const event = new CustomEvent(CONTEXT_UPDATE);
|
||||
document.dispatchEvent(event);
|
||||
}
|
||||
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
||||
const target = detail.originalEvent.target;
|
||||
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
||||
if (handler) target.addEventListener(name, handler, { once: true });
|
||||
if (discrete) {
|
||||
dispatchDiscreteCustomEvent(target, event);
|
||||
} else {
|
||||
target.dispatchEvent(event);
|
||||
}
|
||||
}
|
||||
var Root = DismissableLayer;
|
||||
var Branch = DismissableLayerBranch;
|
||||
export {
|
||||
Branch,
|
||||
DismissableLayer,
|
||||
DismissableLayerBranch,
|
||||
Root
|
||||
};
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
7
node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs.map
generated
vendored
Normal file
7
node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
73
node_modules/@radix-ui/react-dismissable-layer/package.json
generated
vendored
Normal file
73
node_modules/@radix-ui/react-dismissable-layer/package.json
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"name": "@radix-ui/react-dismissable-layer",
|
||||
"version": "1.1.11",
|
||||
"license": "MIT",
|
||||
"source": "./src/index.ts",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"files": [
|
||||
"dist",
|
||||
"README.md"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"dependencies": {
|
||||
"@radix-ui/primitive": "1.1.3",
|
||||
"@radix-ui/react-use-escape-keydown": "1.1.1",
|
||||
"@radix-ui/react-primitive": "2.1.3",
|
||||
"@radix-ui/react-compose-refs": "1.1.2",
|
||||
"@radix-ui/react-use-callback-ref": "1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^19.0.7",
|
||||
"@types/react-dom": "^19.0.3",
|
||||
"eslint": "^9.18.0",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"react-remove-scroll": "^2.6.3",
|
||||
"typescript": "^5.7.3",
|
||||
"@repo/builder": "0.0.0",
|
||||
"@repo/typescript-config": "0.0.0",
|
||||
"@repo/eslint-config": "0.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"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --max-warnings 0 src",
|
||||
"clean": "rm -rf dist",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"build": "radix-build"
|
||||
},
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
node_modules/@radix-ui/react-focus-guards/LICENSE
generated
vendored
Normal file
21
node_modules/@radix-ui/react-focus-guards/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 WorkOS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
3
node_modules/@radix-ui/react-focus-guards/README.md
generated
vendored
Normal file
3
node_modules/@radix-ui/react-focus-guards/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# `react-focus-guards`
|
||||
|
||||
This is an internal utility, not intended for public usage.
|
||||
13
node_modules/@radix-ui/react-focus-guards/dist/index.d.mts
generated
vendored
Normal file
13
node_modules/@radix-ui/react-focus-guards/dist/index.d.mts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import * as React from 'react';
|
||||
|
||||
interface FocusGuardsProps {
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
declare function FocusGuards(props: FocusGuardsProps): React.ReactNode;
|
||||
/**
|
||||
* Injects a pair of focus guards at the edges of the whole DOM tree
|
||||
* to ensure `focusin` & `focusout` events can be caught consistently.
|
||||
*/
|
||||
declare function useFocusGuards(): void;
|
||||
|
||||
export { FocusGuards, FocusGuards as Root, useFocusGuards };
|
||||
13
node_modules/@radix-ui/react-focus-guards/dist/index.d.ts
generated
vendored
Normal file
13
node_modules/@radix-ui/react-focus-guards/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import * as React from 'react';
|
||||
|
||||
interface FocusGuardsProps {
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
declare function FocusGuards(props: FocusGuardsProps): React.ReactNode;
|
||||
/**
|
||||
* Injects a pair of focus guards at the edges of the whole DOM tree
|
||||
* to ensure `focusin` & `focusout` events can be caught consistently.
|
||||
*/
|
||||
declare function useFocusGuards(): void;
|
||||
|
||||
export { FocusGuards, FocusGuards as Root, useFocusGuards };
|
||||
71
node_modules/@radix-ui/react-focus-guards/dist/index.js
generated
vendored
Normal file
71
node_modules/@radix-ui/react-focus-guards/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
"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);
|
||||
|
||||
// src/index.ts
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
FocusGuards: () => FocusGuards,
|
||||
Root: () => FocusGuards,
|
||||
useFocusGuards: () => useFocusGuards
|
||||
});
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
|
||||
// src/focus-guards.tsx
|
||||
var React = __toESM(require("react"));
|
||||
var count = 0;
|
||||
function FocusGuards(props) {
|
||||
useFocusGuards();
|
||||
return props.children;
|
||||
}
|
||||
function useFocusGuards() {
|
||||
React.useEffect(() => {
|
||||
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
||||
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
||||
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
||||
count++;
|
||||
return () => {
|
||||
if (count === 1) {
|
||||
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
||||
}
|
||||
count--;
|
||||
};
|
||||
}, []);
|
||||
}
|
||||
function createFocusGuard() {
|
||||
const element = document.createElement("span");
|
||||
element.setAttribute("data-radix-focus-guard", "");
|
||||
element.tabIndex = 0;
|
||||
element.style.outline = "none";
|
||||
element.style.opacity = "0";
|
||||
element.style.position = "fixed";
|
||||
element.style.pointerEvents = "none";
|
||||
return element;
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
7
node_modules/@radix-ui/react-focus-guards/dist/index.js.map
generated
vendored
Normal file
7
node_modules/@radix-ui/react-focus-guards/dist/index.js.map
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../src/index.ts", "../src/focus-guards.tsx"],
|
||||
"sourcesContent": ["'use client';\nexport {\n FocusGuards,\n //\n Root,\n //\n useFocusGuards,\n} from './focus-guards';\n", "import * as React from 'react';\n\n/** Number of components which have requested interest to have focus guards */\nlet count = 0;\n\ninterface FocusGuardsProps {\n children?: React.ReactNode;\n}\n\nfunction FocusGuards(props: FocusGuardsProps) {\n useFocusGuards();\n return props.children;\n}\n\n/**\n * Injects a pair of focus guards at the edges of the whole DOM tree\n * to ensure `focusin` & `focusout` events can be caught consistently.\n */\nfunction useFocusGuards() {\n /* eslint-disable no-restricted-globals */\n React.useEffect(() => {\n const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');\n document.body.insertAdjacentElement('afterbegin', edgeGuards[0] ?? createFocusGuard());\n document.body.insertAdjacentElement('beforeend', edgeGuards[1] ?? createFocusGuard());\n count++;\n\n return () => {\n if (count === 1) {\n document.querySelectorAll('[data-radix-focus-guard]').forEach((node) => node.remove());\n }\n count--;\n };\n }, []);\n /* eslint-enable no-restricted-globals */\n}\n\nfunction createFocusGuard() {\n // eslint-disable-next-line no-restricted-globals\n const element = document.createElement('span');\n element.setAttribute('data-radix-focus-guard', '');\n element.tabIndex = 0;\n element.style.outline = 'none';\n element.style.opacity = '0';\n element.style.position = 'fixed';\n element.style.pointerEvents = 'none';\n return element;\n}\n\nexport {\n FocusGuards,\n //\n FocusGuards as Root,\n //\n useFocusGuards,\n};\n"],
|
||||
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AAGvB,IAAI,QAAQ;AAMZ,SAAS,YAAY,OAAyB;AAC5C,iBAAe;AACf,SAAO,MAAM;AACf;AAMA,SAAS,iBAAiB;AAExB,EAAM,gBAAU,MAAM;AACpB,UAAM,aAAa,SAAS,iBAAiB,0BAA0B;AACvE,aAAS,KAAK,sBAAsB,cAAc,WAAW,CAAC,KAAK,iBAAiB,CAAC;AACrF,aAAS,KAAK,sBAAsB,aAAa,WAAW,CAAC,KAAK,iBAAiB,CAAC;AACpF;AAEA,WAAO,MAAM;AACX,UAAI,UAAU,GAAG;AACf,iBAAS,iBAAiB,0BAA0B,EAAE,QAAQ,CAAC,SAAS,KAAK,OAAO,CAAC;AAAA,MACvF;AACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,CAAC;AAEP;AAEA,SAAS,mBAAmB;AAE1B,QAAM,UAAU,SAAS,cAAc,MAAM;AAC7C,UAAQ,aAAa,0BAA0B,EAAE;AACjD,UAAQ,WAAW;AACnB,UAAQ,MAAM,UAAU;AACxB,UAAQ,MAAM,UAAU;AACxB,UAAQ,MAAM,WAAW;AACzB,UAAQ,MAAM,gBAAgB;AAC9B,SAAO;AACT;",
|
||||
"names": []
|
||||
}
|
||||
39
node_modules/@radix-ui/react-focus-guards/dist/index.mjs
generated
vendored
Normal file
39
node_modules/@radix-ui/react-focus-guards/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
"use client";
|
||||
|
||||
// src/focus-guards.tsx
|
||||
import * as React from "react";
|
||||
var count = 0;
|
||||
function FocusGuards(props) {
|
||||
useFocusGuards();
|
||||
return props.children;
|
||||
}
|
||||
function useFocusGuards() {
|
||||
React.useEffect(() => {
|
||||
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
||||
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
||||
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
||||
count++;
|
||||
return () => {
|
||||
if (count === 1) {
|
||||
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
||||
}
|
||||
count--;
|
||||
};
|
||||
}, []);
|
||||
}
|
||||
function createFocusGuard() {
|
||||
const element = document.createElement("span");
|
||||
element.setAttribute("data-radix-focus-guard", "");
|
||||
element.tabIndex = 0;
|
||||
element.style.outline = "none";
|
||||
element.style.opacity = "0";
|
||||
element.style.position = "fixed";
|
||||
element.style.pointerEvents = "none";
|
||||
return element;
|
||||
}
|
||||
export {
|
||||
FocusGuards,
|
||||
FocusGuards as Root,
|
||||
useFocusGuards
|
||||
};
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
7
node_modules/@radix-ui/react-focus-guards/dist/index.mjs.map
generated
vendored
Normal file
7
node_modules/@radix-ui/react-focus-guards/dist/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../src/focus-guards.tsx"],
|
||||
"sourcesContent": ["import * as React from 'react';\n\n/** Number of components which have requested interest to have focus guards */\nlet count = 0;\n\ninterface FocusGuardsProps {\n children?: React.ReactNode;\n}\n\nfunction FocusGuards(props: FocusGuardsProps) {\n useFocusGuards();\n return props.children;\n}\n\n/**\n * Injects a pair of focus guards at the edges of the whole DOM tree\n * to ensure `focusin` & `focusout` events can be caught consistently.\n */\nfunction useFocusGuards() {\n /* eslint-disable no-restricted-globals */\n React.useEffect(() => {\n const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');\n document.body.insertAdjacentElement('afterbegin', edgeGuards[0] ?? createFocusGuard());\n document.body.insertAdjacentElement('beforeend', edgeGuards[1] ?? createFocusGuard());\n count++;\n\n return () => {\n if (count === 1) {\n document.querySelectorAll('[data-radix-focus-guard]').forEach((node) => node.remove());\n }\n count--;\n };\n }, []);\n /* eslint-enable no-restricted-globals */\n}\n\nfunction createFocusGuard() {\n // eslint-disable-next-line no-restricted-globals\n const element = document.createElement('span');\n element.setAttribute('data-radix-focus-guard', '');\n element.tabIndex = 0;\n element.style.outline = 'none';\n element.style.opacity = '0';\n element.style.position = 'fixed';\n element.style.pointerEvents = 'none';\n return element;\n}\n\nexport {\n FocusGuards,\n //\n FocusGuards as Root,\n //\n useFocusGuards,\n};\n"],
|
||||
"mappings": ";;;AAAA,YAAY,WAAW;AAGvB,IAAI,QAAQ;AAMZ,SAAS,YAAY,OAAyB;AAC5C,iBAAe;AACf,SAAO,MAAM;AACf;AAMA,SAAS,iBAAiB;AAExB,EAAM,gBAAU,MAAM;AACpB,UAAM,aAAa,SAAS,iBAAiB,0BAA0B;AACvE,aAAS,KAAK,sBAAsB,cAAc,WAAW,CAAC,KAAK,iBAAiB,CAAC;AACrF,aAAS,KAAK,sBAAsB,aAAa,WAAW,CAAC,KAAK,iBAAiB,CAAC;AACpF;AAEA,WAAO,MAAM;AACX,UAAI,UAAU,GAAG;AACf,iBAAS,iBAAiB,0BAA0B,EAAE,QAAQ,CAAC,SAAS,KAAK,OAAO,CAAC;AAAA,MACvF;AACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,CAAC;AAEP;AAEA,SAAS,mBAAmB;AAE1B,QAAM,UAAU,SAAS,cAAc,MAAM;AAC7C,UAAQ,aAAa,0BAA0B,EAAE;AACjD,UAAQ,WAAW;AACnB,UAAQ,MAAM,UAAU;AACxB,UAAQ,MAAM,UAAU;AACxB,UAAQ,MAAM,WAAW;AACzB,UAAQ,MAAM,gBAAgB;AAC9B,SAAO;AACT;",
|
||||
"names": []
|
||||
}
|
||||
60
node_modules/@radix-ui/react-focus-guards/package.json
generated
vendored
Normal file
60
node_modules/@radix-ui/react-focus-guards/package.json
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "@radix-ui/react-focus-guards",
|
||||
"version": "1.1.3",
|
||||
"license": "MIT",
|
||||
"source": "./src/index.ts",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"files": [
|
||||
"dist",
|
||||
"README.md"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"devDependencies": {
|
||||
"@types/react": "^19.0.7",
|
||||
"@types/react-dom": "^19.0.3",
|
||||
"eslint": "^9.18.0",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"typescript": "^5.7.3",
|
||||
"@repo/builder": "0.0.0",
|
||||
"@repo/typescript-config": "0.0.0",
|
||||
"@repo/eslint-config": "0.0.0"
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --max-warnings 0 src",
|
||||
"clean": "rm -rf dist",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"build": "radix-build"
|
||||
},
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
node_modules/@radix-ui/react-focus-scope/LICENSE
generated
vendored
Normal file
21
node_modules/@radix-ui/react-focus-scope/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 WorkOS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
3
node_modules/@radix-ui/react-focus-scope/README.md
generated
vendored
Normal file
3
node_modules/@radix-ui/react-focus-scope/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# `react-focus-scope`
|
||||
|
||||
This is an internal utility, not intended for public usage.
|
||||
32
node_modules/@radix-ui/react-focus-scope/dist/index.d.mts
generated
vendored
Normal file
32
node_modules/@radix-ui/react-focus-scope/dist/index.d.mts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import * as React from 'react';
|
||||
import { Primitive } from '@radix-ui/react-primitive';
|
||||
|
||||
type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
|
||||
interface FocusScopeProps extends PrimitiveDivProps {
|
||||
/**
|
||||
* When `true`, tabbing from last item will focus first tabbable
|
||||
* and shift+tab from first item will focus last tababble.
|
||||
* @defaultValue false
|
||||
*/
|
||||
loop?: boolean;
|
||||
/**
|
||||
* When `true`, focus cannot escape the focus scope via keyboard,
|
||||
* pointer, or a programmatic focus.
|
||||
* @defaultValue false
|
||||
*/
|
||||
trapped?: boolean;
|
||||
/**
|
||||
* Event handler called when auto-focusing on mount.
|
||||
* Can be prevented.
|
||||
*/
|
||||
onMountAutoFocus?: (event: Event) => void;
|
||||
/**
|
||||
* Event handler called when auto-focusing on unmount.
|
||||
* Can be prevented.
|
||||
*/
|
||||
onUnmountAutoFocus?: (event: Event) => void;
|
||||
}
|
||||
declare const FocusScope: React.ForwardRefExoticComponent<FocusScopeProps & React.RefAttributes<HTMLDivElement>>;
|
||||
declare const Root: React.ForwardRefExoticComponent<FocusScopeProps & React.RefAttributes<HTMLDivElement>>;
|
||||
|
||||
export { FocusScope, type FocusScopeProps, Root };
|
||||
32
node_modules/@radix-ui/react-focus-scope/dist/index.d.ts
generated
vendored
Normal file
32
node_modules/@radix-ui/react-focus-scope/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import * as React from 'react';
|
||||
import { Primitive } from '@radix-ui/react-primitive';
|
||||
|
||||
type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
|
||||
interface FocusScopeProps extends PrimitiveDivProps {
|
||||
/**
|
||||
* When `true`, tabbing from last item will focus first tabbable
|
||||
* and shift+tab from first item will focus last tababble.
|
||||
* @defaultValue false
|
||||
*/
|
||||
loop?: boolean;
|
||||
/**
|
||||
* When `true`, focus cannot escape the focus scope via keyboard,
|
||||
* pointer, or a programmatic focus.
|
||||
* @defaultValue false
|
||||
*/
|
||||
trapped?: boolean;
|
||||
/**
|
||||
* Event handler called when auto-focusing on mount.
|
||||
* Can be prevented.
|
||||
*/
|
||||
onMountAutoFocus?: (event: Event) => void;
|
||||
/**
|
||||
* Event handler called when auto-focusing on unmount.
|
||||
* Can be prevented.
|
||||
*/
|
||||
onUnmountAutoFocus?: (event: Event) => void;
|
||||
}
|
||||
declare const FocusScope: React.ForwardRefExoticComponent<FocusScopeProps & React.RefAttributes<HTMLDivElement>>;
|
||||
declare const Root: React.ForwardRefExoticComponent<FocusScopeProps & React.RefAttributes<HTMLDivElement>>;
|
||||
|
||||
export { FocusScope, type FocusScopeProps, Root };
|
||||
246
node_modules/@radix-ui/react-focus-scope/dist/index.js
generated
vendored
Normal file
246
node_modules/@radix-ui/react-focus-scope/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,246 @@
|
||||
"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);
|
||||
|
||||
// src/index.ts
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
FocusScope: () => FocusScope,
|
||||
Root: () => Root
|
||||
});
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
|
||||
// src/focus-scope.tsx
|
||||
var React = __toESM(require("react"));
|
||||
var import_react_compose_refs = require("@radix-ui/react-compose-refs");
|
||||
var import_react_primitive = require("@radix-ui/react-primitive");
|
||||
var import_react_use_callback_ref = require("@radix-ui/react-use-callback-ref");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
||||
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
||||
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
||||
var FOCUS_SCOPE_NAME = "FocusScope";
|
||||
var FocusScope = React.forwardRef((props, forwardedRef) => {
|
||||
const {
|
||||
loop = false,
|
||||
trapped = false,
|
||||
onMountAutoFocus: onMountAutoFocusProp,
|
||||
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
||||
...scopeProps
|
||||
} = props;
|
||||
const [container, setContainer] = React.useState(null);
|
||||
const onMountAutoFocus = (0, import_react_use_callback_ref.useCallbackRef)(onMountAutoFocusProp);
|
||||
const onUnmountAutoFocus = (0, import_react_use_callback_ref.useCallbackRef)(onUnmountAutoFocusProp);
|
||||
const lastFocusedElementRef = React.useRef(null);
|
||||
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, (node) => setContainer(node));
|
||||
const focusScope = React.useRef({
|
||||
paused: false,
|
||||
pause() {
|
||||
this.paused = true;
|
||||
},
|
||||
resume() {
|
||||
this.paused = false;
|
||||
}
|
||||
}).current;
|
||||
React.useEffect(() => {
|
||||
if (trapped) {
|
||||
let handleFocusIn2 = function(event) {
|
||||
if (focusScope.paused || !container) return;
|
||||
const target = event.target;
|
||||
if (container.contains(target)) {
|
||||
lastFocusedElementRef.current = target;
|
||||
} else {
|
||||
focus(lastFocusedElementRef.current, { select: true });
|
||||
}
|
||||
}, handleFocusOut2 = function(event) {
|
||||
if (focusScope.paused || !container) return;
|
||||
const relatedTarget = event.relatedTarget;
|
||||
if (relatedTarget === null) return;
|
||||
if (!container.contains(relatedTarget)) {
|
||||
focus(lastFocusedElementRef.current, { select: true });
|
||||
}
|
||||
}, handleMutations2 = function(mutations) {
|
||||
const focusedElement = document.activeElement;
|
||||
if (focusedElement !== document.body) return;
|
||||
for (const mutation of mutations) {
|
||||
if (mutation.removedNodes.length > 0) focus(container);
|
||||
}
|
||||
};
|
||||
var handleFocusIn = handleFocusIn2, handleFocusOut = handleFocusOut2, handleMutations = handleMutations2;
|
||||
document.addEventListener("focusin", handleFocusIn2);
|
||||
document.addEventListener("focusout", handleFocusOut2);
|
||||
const mutationObserver = new MutationObserver(handleMutations2);
|
||||
if (container) mutationObserver.observe(container, { childList: true, subtree: true });
|
||||
return () => {
|
||||
document.removeEventListener("focusin", handleFocusIn2);
|
||||
document.removeEventListener("focusout", handleFocusOut2);
|
||||
mutationObserver.disconnect();
|
||||
};
|
||||
}
|
||||
}, [trapped, container, focusScope.paused]);
|
||||
React.useEffect(() => {
|
||||
if (container) {
|
||||
focusScopesStack.add(focusScope);
|
||||
const previouslyFocusedElement = document.activeElement;
|
||||
const hasFocusedCandidate = container.contains(previouslyFocusedElement);
|
||||
if (!hasFocusedCandidate) {
|
||||
const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
|
||||
container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
||||
container.dispatchEvent(mountEvent);
|
||||
if (!mountEvent.defaultPrevented) {
|
||||
focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
|
||||
if (document.activeElement === previouslyFocusedElement) {
|
||||
focus(container);
|
||||
}
|
||||
}
|
||||
}
|
||||
return () => {
|
||||
container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
||||
setTimeout(() => {
|
||||
const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
|
||||
container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
||||
container.dispatchEvent(unmountEvent);
|
||||
if (!unmountEvent.defaultPrevented) {
|
||||
focus(previouslyFocusedElement ?? document.body, { select: true });
|
||||
}
|
||||
container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
||||
focusScopesStack.remove(focusScope);
|
||||
}, 0);
|
||||
};
|
||||
}
|
||||
}, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
|
||||
const handleKeyDown = React.useCallback(
|
||||
(event) => {
|
||||
if (!loop && !trapped) return;
|
||||
if (focusScope.paused) return;
|
||||
const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
||||
const focusedElement = document.activeElement;
|
||||
if (isTabKey && focusedElement) {
|
||||
const container2 = event.currentTarget;
|
||||
const [first, last] = getTabbableEdges(container2);
|
||||
const hasTabbableElementsInside = first && last;
|
||||
if (!hasTabbableElementsInside) {
|
||||
if (focusedElement === container2) event.preventDefault();
|
||||
} else {
|
||||
if (!event.shiftKey && focusedElement === last) {
|
||||
event.preventDefault();
|
||||
if (loop) focus(first, { select: true });
|
||||
} else if (event.shiftKey && focusedElement === first) {
|
||||
event.preventDefault();
|
||||
if (loop) focus(last, { select: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
[loop, trapped, focusScope.paused]
|
||||
);
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
||||
});
|
||||
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
||||
function focusFirst(candidates, { select = false } = {}) {
|
||||
const previouslyFocusedElement = document.activeElement;
|
||||
for (const candidate of candidates) {
|
||||
focus(candidate, { select });
|
||||
if (document.activeElement !== previouslyFocusedElement) return;
|
||||
}
|
||||
}
|
||||
function getTabbableEdges(container) {
|
||||
const candidates = getTabbableCandidates(container);
|
||||
const first = findVisible(candidates, container);
|
||||
const last = findVisible(candidates.reverse(), container);
|
||||
return [first, last];
|
||||
}
|
||||
function getTabbableCandidates(container) {
|
||||
const nodes = [];
|
||||
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
||||
acceptNode: (node) => {
|
||||
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
||||
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
||||
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
||||
}
|
||||
});
|
||||
while (walker.nextNode()) nodes.push(walker.currentNode);
|
||||
return nodes;
|
||||
}
|
||||
function findVisible(elements, container) {
|
||||
for (const element of elements) {
|
||||
if (!isHidden(element, { upTo: container })) return element;
|
||||
}
|
||||
}
|
||||
function isHidden(node, { upTo }) {
|
||||
if (getComputedStyle(node).visibility === "hidden") return true;
|
||||
while (node) {
|
||||
if (upTo !== void 0 && node === upTo) return false;
|
||||
if (getComputedStyle(node).display === "none") return true;
|
||||
node = node.parentElement;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isSelectableInput(element) {
|
||||
return element instanceof HTMLInputElement && "select" in element;
|
||||
}
|
||||
function focus(element, { select = false } = {}) {
|
||||
if (element && element.focus) {
|
||||
const previouslyFocusedElement = document.activeElement;
|
||||
element.focus({ preventScroll: true });
|
||||
if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
|
||||
element.select();
|
||||
}
|
||||
}
|
||||
var focusScopesStack = createFocusScopesStack();
|
||||
function createFocusScopesStack() {
|
||||
let stack = [];
|
||||
return {
|
||||
add(focusScope) {
|
||||
const activeFocusScope = stack[0];
|
||||
if (focusScope !== activeFocusScope) {
|
||||
activeFocusScope?.pause();
|
||||
}
|
||||
stack = arrayRemove(stack, focusScope);
|
||||
stack.unshift(focusScope);
|
||||
},
|
||||
remove(focusScope) {
|
||||
stack = arrayRemove(stack, focusScope);
|
||||
stack[0]?.resume();
|
||||
}
|
||||
};
|
||||
}
|
||||
function arrayRemove(array, item) {
|
||||
const updatedArray = [...array];
|
||||
const index = updatedArray.indexOf(item);
|
||||
if (index !== -1) {
|
||||
updatedArray.splice(index, 1);
|
||||
}
|
||||
return updatedArray;
|
||||
}
|
||||
function removeLinks(items) {
|
||||
return items.filter((item) => item.tagName !== "A");
|
||||
}
|
||||
var Root = FocusScope;
|
||||
//# sourceMappingURL=index.js.map
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user