diff --git a/.gitattributes b/.gitattributes index 549cdfd433fb3cbdd8fc58079d4b65d5080c7999..9cb18000bc405f64bb29738584ea41a0c47a28c7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -80,3 +80,4 @@ e-commerce/node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.18.7 f e-commerce/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64-0.35.5.node filter=lfs diff=lfs merge=lfs -text e-commerce/node_modules/@next/swc-linux-x64-gnu/next-swc.linux-x64-gnu.node filter=lfs diff=lfs merge=lfs -text e-commerce/node_modules/@parcel/watcher-linux-x64-glibc/watcher.node filter=lfs diff=lfs merge=lfs -text +e-commerce/node_modules/@swc/core-linux-x64-gnu/swc.linux-x64-gnu.node filter=lfs diff=lfs merge=lfs -text diff --git a/e-commerce/node_modules/@radix-ui/react-arrow/LICENSE b/e-commerce/node_modules/@radix-ui/react-arrow/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a18858fb7b014098cba85703e66609be66a26ef5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-arrow/LICENSE @@ -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. diff --git a/e-commerce/node_modules/@radix-ui/react-arrow/README.md b/e-commerce/node_modules/@radix-ui/react-arrow/README.md new file mode 100644 index 0000000000000000000000000000000000000000..4030b172f224ff7c1d73da3bd1c4a13bdbf3963e --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-arrow/README.md @@ -0,0 +1,3 @@ +# `react-arrow` + +This is an internal utility, not intended for public usage. diff --git a/e-commerce/node_modules/@radix-ui/react-arrow/dist/index.d.mts b/e-commerce/node_modules/@radix-ui/react-arrow/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..1ad170b5276e1bedbe4576228d25a79048daa3cd --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-arrow/dist/index.d.mts @@ -0,0 +1,9 @@ +import * as React from 'react'; +import { Primitive } from '@radix-ui/react-primitive'; + +type PrimitiveSvgProps = React.ComponentPropsWithoutRef; +interface ArrowProps extends PrimitiveSvgProps { +} +declare const Arrow: React.ForwardRefExoticComponent>; + +export { Arrow, type ArrowProps, Arrow as Root }; diff --git a/e-commerce/node_modules/@radix-ui/react-arrow/dist/index.d.ts b/e-commerce/node_modules/@radix-ui/react-arrow/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1ad170b5276e1bedbe4576228d25a79048daa3cd --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-arrow/dist/index.d.ts @@ -0,0 +1,9 @@ +import * as React from 'react'; +import { Primitive } from '@radix-ui/react-primitive'; + +type PrimitiveSvgProps = React.ComponentPropsWithoutRef; +interface ArrowProps extends PrimitiveSvgProps { +} +declare const Arrow: React.ForwardRefExoticComponent>; + +export { Arrow, type ArrowProps, Arrow as Root }; diff --git a/e-commerce/node_modules/@radix-ui/react-arrow/dist/index.js b/e-commerce/node_modules/@radix-ui/react-arrow/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a27d8163e7627037858b6896668889249c4bec31 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-arrow/dist/index.js @@ -0,0 +1,61 @@ +"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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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: () => Arrow +}); +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 Arrow = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function Arrow2(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") +); +//# sourceMappingURL=index.js.map diff --git a/e-commerce/node_modules/@radix-ui/react-arrow/dist/index.js.map b/e-commerce/node_modules/@radix-ui/react-arrow/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..3a53030b1c844c28de718d2956acc8ccc12e0df2 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-arrow/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts", "../src/arrow.tsx"], + "sourcesContent": ["'use client';\nexport {\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\ntype ArrowElement = React.ComponentRef;\ntype PrimitiveSvgProps = React.ComponentPropsWithoutRef;\ninterface ArrowProps extends PrimitiveSvgProps {}\n\nconst Arrow = /* @__PURE__ */ React.forwardRef(\n function Arrow(props, forwardedRef) {\n const { children, width = 10, height = 5, ...arrowProps } = props;\n return (\n \n {/* We use their children if they're slotting to replace the whole svg */}\n {props.asChild ? children : }\n \n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nexport {\n Arrow,\n //\n Arrow as Root,\n};\nexport type { ArrowProps };\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,6BAA0B;AAuBU;AAbpC,IAAM,QAAwB,gBAAM;AAAA,EAClC,gCAASA,OAAM,OAAO,cAAc;AAClC,UAAM,EAAE,UAAU,QAAQ,IAAI,SAAS,GAAG,GAAG,WAAW,IAAI;AAC5D,WACE;AAAA,MAAC,iCAAU;AAAA,MAAV;AAAA,QACE,GAAG;AAAA,QACJ,KAAK;AAAA,QACL;AAAA,QACA;AAAA,QACA,SAAQ;AAAA,QACR,qBAAoB;AAAA,QAGnB,gBAAM,UAAU,WAAW,4CAAC,aAAQ,QAAO,kBAAiB;AAAA;AAAA,IAC/D;AAAA,EAEJ,GAfA;AAgBF;", + "names": ["Arrow"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-arrow/dist/index.mjs b/e-commerce/node_modules/@radix-ui/react-arrow/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d380b99aa4edcd19b962060142be7aa07c8ce931 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-arrow/dist/index.mjs @@ -0,0 +1,30 @@ +"use client"; +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// src/arrow.tsx +import * as React from "react"; +import { Primitive } from "@radix-ui/react-primitive"; +import { jsx } from "react/jsx-runtime"; +var Arrow = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function Arrow2(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") +); +export { + Arrow, + Arrow as Root +}; +//# sourceMappingURL=index.mjs.map diff --git a/e-commerce/node_modules/@radix-ui/react-arrow/dist/index.mjs.map b/e-commerce/node_modules/@radix-ui/react-arrow/dist/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..e7c7c615c6ae66a4ffad4039de820a4fb0c3a741 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-arrow/dist/index.mjs.map @@ -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\ntype ArrowElement = React.ComponentRef;\ntype PrimitiveSvgProps = React.ComponentPropsWithoutRef;\ninterface ArrowProps extends PrimitiveSvgProps {}\n\nconst Arrow = /* @__PURE__ */ React.forwardRef(\n function Arrow(props, forwardedRef) {\n const { children, width = 10, height = 5, ...arrowProps } = props;\n return (\n \n {/* We use their children if they're slotting to replace the whole svg */}\n {props.asChild ? children : }\n \n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nexport {\n Arrow,\n //\n Arrow as Root,\n};\nexport type { ArrowProps };\n"], + "mappings": ";;;;;AAAA,YAAY,WAAW;AACvB,SAAS,iBAAiB;AAuBU;AAbpC,IAAM,QAAwB,gBAAM;AAAA,EAClC,gCAASA,OAAM,OAAO,cAAc;AAClC,UAAM,EAAE,UAAU,QAAQ,IAAI,SAAS,GAAG,GAAG,WAAW,IAAI;AAC5D,WACE;AAAA,MAAC,UAAU;AAAA,MAAV;AAAA,QACE,GAAG;AAAA,QACJ,KAAK;AAAA,QACL;AAAA,QACA;AAAA,QACA,SAAQ;AAAA,QACR,qBAAoB;AAAA,QAGnB,gBAAM,UAAU,WAAW,oBAAC,aAAQ,QAAO,kBAAiB;AAAA;AAAA,IAC/D;AAAA,EAEJ,GAfA;AAgBF;", + "names": ["Arrow"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-arrow/package.json b/e-commerce/node_modules/@radix-ui/react-arrow/package.json new file mode 100644 index 0000000000000000000000000000000000000000..39acbbcc08d8952f3a5ddb81d582bf2550ee20a5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-arrow/package.json @@ -0,0 +1,68 @@ +{ + "name": "@radix-ui/react-arrow", + "version": "1.1.17", + "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.2.0" + }, + "devDependencies": { + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "react": "^19.3.0", + "react-dom": "^19.3.0", + "typescript": "^5.9.3", + "@repo/builder": "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", + "directory": "packages/react/arrow" + }, + "bugs": { + "url": "https://github.com/radix-ui/primitives/issues" + }, + "scripts": { + "lint": "oxlint --max-warnings 0 src", + "clean": "rm -rf dist", + "reset": "rm -rf dist node_modules", + "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" + } + } + } +} \ No newline at end of file diff --git a/e-commerce/node_modules/@radix-ui/react-avatar/LICENSE b/e-commerce/node_modules/@radix-ui/react-avatar/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a18858fb7b014098cba85703e66609be66a26ef5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-avatar/LICENSE @@ -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. diff --git a/e-commerce/node_modules/@radix-ui/react-avatar/README.md b/e-commerce/node_modules/@radix-ui/react-avatar/README.md new file mode 100644 index 0000000000000000000000000000000000000000..cfe4acf4f522690d80028bb7aeccb5ad692326a9 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-avatar/README.md @@ -0,0 +1,3 @@ +# `react-avatar` + +View docs [here](https://radix-ui.com/primitives/docs/components/avatar). diff --git a/e-commerce/node_modules/@radix-ui/react-avatar/dist/index.d.mts b/e-commerce/node_modules/@radix-ui/react-avatar/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..48c61e83da8d1fc6e77f94f0746137e9f81e08ec --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-avatar/dist/index.d.mts @@ -0,0 +1,27 @@ +import * as _radix_ui_react_context from '@radix-ui/react-context'; +import * as React from 'react'; +import { Primitive } from '@radix-ui/react-primitive'; + +declare const createAvatarScope: _radix_ui_react_context.CreateScope; +declare const ImageLoadingStatus: { + readonly Idle: "idle"; + readonly Loading: "loading"; + readonly Loaded: "loaded"; + readonly Error: "error"; +}; +type ImageLoadingStatus = (typeof ImageLoadingStatus)[keyof typeof ImageLoadingStatus]; +type PrimitiveSpanProps = React.ComponentPropsWithoutRef; +interface AvatarProps extends PrimitiveSpanProps { +} +declare const Avatar: React.ForwardRefExoticComponent>; +type PrimitiveImageProps = React.ComponentPropsWithoutRef; +interface AvatarImageProps extends PrimitiveImageProps { + onLoadingStatusChange?: ((status: ImageLoadingStatus) => void) | undefined; +} +declare const AvatarImage: React.ForwardRefExoticComponent>; +interface AvatarFallbackProps extends PrimitiveSpanProps { + delayMs?: number | undefined; +} +declare const AvatarFallback: React.ForwardRefExoticComponent>; + +export { Avatar, AvatarFallback, type AvatarFallbackProps, AvatarImage, type AvatarImageProps, type AvatarProps, AvatarFallback as Fallback, AvatarImage as Image, Avatar as Root, createAvatarScope }; diff --git a/e-commerce/node_modules/@radix-ui/react-avatar/dist/index.d.ts b/e-commerce/node_modules/@radix-ui/react-avatar/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..48c61e83da8d1fc6e77f94f0746137e9f81e08ec --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-avatar/dist/index.d.ts @@ -0,0 +1,27 @@ +import * as _radix_ui_react_context from '@radix-ui/react-context'; +import * as React from 'react'; +import { Primitive } from '@radix-ui/react-primitive'; + +declare const createAvatarScope: _radix_ui_react_context.CreateScope; +declare const ImageLoadingStatus: { + readonly Idle: "idle"; + readonly Loading: "loading"; + readonly Loaded: "loaded"; + readonly Error: "error"; +}; +type ImageLoadingStatus = (typeof ImageLoadingStatus)[keyof typeof ImageLoadingStatus]; +type PrimitiveSpanProps = React.ComponentPropsWithoutRef; +interface AvatarProps extends PrimitiveSpanProps { +} +declare const Avatar: React.ForwardRefExoticComponent>; +type PrimitiveImageProps = React.ComponentPropsWithoutRef; +interface AvatarImageProps extends PrimitiveImageProps { + onLoadingStatusChange?: ((status: ImageLoadingStatus) => void) | undefined; +} +declare const AvatarImage: React.ForwardRefExoticComponent>; +interface AvatarFallbackProps extends PrimitiveSpanProps { + delayMs?: number | undefined; +} +declare const AvatarFallback: React.ForwardRefExoticComponent>; + +export { Avatar, AvatarFallback, type AvatarFallbackProps, AvatarImage, type AvatarImageProps, type AvatarProps, AvatarFallback as Fallback, AvatarImage as Image, Avatar as Root, createAvatarScope }; diff --git a/e-commerce/node_modules/@radix-ui/react-avatar/dist/index.js b/e-commerce/node_modules/@radix-ui/react-avatar/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..9f3f7104caa4f33044e5e0bba6f4d3e0b8d18efa --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-avatar/dist/index.js @@ -0,0 +1,195 @@ +"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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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, { + Avatar: () => Avatar, + AvatarFallback: () => AvatarFallback, + AvatarImage: () => AvatarImage, + Fallback: () => AvatarFallback, + Image: () => AvatarImage, + Root: () => Avatar, + createAvatarScope: () => createAvatarScope +}); +module.exports = __toCommonJS(index_exports); + +// src/avatar.tsx +var React = __toESM(require("react")); +var import_is_development = require("@radix-ui/primitive/is-development"); +var import_react_context = require("@radix-ui/react-context"); +var import_react_use_callback_ref = require("@radix-ui/react-use-callback-ref"); +var import_react_use_layout_effect = require("@radix-ui/react-use-layout-effect"); +var import_react_primitive = require("@radix-ui/react-primitive"); +var import_jsx_runtime = require("react/jsx-runtime"); +var AVATAR_NAME = "Avatar"; +var [createAvatarContext, createAvatarScope] = (0, import_react_context.createContextScope)(AVATAR_NAME); +var ImageLoadingStatus = { + Idle: "idle", + Loading: "loading", + Loaded: "loaded", + Error: "error" +}; +var STATIC_IMAGE_COUNT_STATE = [ + 0, + () => void 0 +]; +var [AvatarProvider, useAvatarContext] = createAvatarContext(AVATAR_NAME); +var Avatar = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function Avatar2(props, forwardedRef) { + const { __scopeAvatar, ...avatarProps } = props; + const [imageLoadingStatus, setImageLoadingStatus] = React.useState( + ImageLoadingStatus.Idle + ); + const [imageCount, setImageCount] = useImageCount(); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + AvatarProvider, + { + scope: __scopeAvatar, + imageLoadingStatus, + setImageLoadingStatus, + imageCount, + setImageCount, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.span, { ...avatarProps, ref: forwardedRef }) + } + ); + }, "Avatar") +); +var IMAGE_NAME = "AvatarImage"; +var AvatarImage = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function AvatarImage2(props, forwardedRef) { + const { __scopeAvatar, src, onLoadingStatusChange, ...imageProps } = props; + const context = useAvatarContext(IMAGE_NAME, __scopeAvatar); + useUpdateImageCount(context.setImageCount); + const imageLoadingStatus = useImageLoadingStatus(src, { + referrerPolicy: imageProps.referrerPolicy, + crossOrigin: imageProps.crossOrigin, + loadingStatus: context.imageLoadingStatus, + setLoadingStatus: context.setImageLoadingStatus + }); + const handleLoadingStatusChange = (0, import_react_use_callback_ref.useCallbackRef)((status) => { + onLoadingStatusChange?.(status); + }); + const loadingStatusRef = React.useRef(imageLoadingStatus); + (0, import_react_use_layout_effect.useLayoutEffect)(() => { + const previousLoadingStatus = loadingStatusRef.current; + loadingStatusRef.current = imageLoadingStatus; + if (imageLoadingStatus !== previousLoadingStatus) { + handleLoadingStatusChange(imageLoadingStatus); + } + }, [imageLoadingStatus, handleLoadingStatusChange]); + return imageLoadingStatus === ImageLoadingStatus.Loaded ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.img, { ...imageProps, ref: forwardedRef, src }) : null; + }, "AvatarImage") +); +var FALLBACK_NAME = "AvatarFallback"; +var AvatarFallback = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function AvatarFallback2(props, forwardedRef) { + const { __scopeAvatar, delayMs, ...fallbackProps } = props; + const context = useAvatarContext(FALLBACK_NAME, __scopeAvatar); + const [canRender, setCanRender] = React.useState(delayMs === void 0); + React.useEffect(() => { + if (delayMs !== void 0) { + const timerId = window.setTimeout(() => setCanRender(true), delayMs); + return () => window.clearTimeout(timerId); + } + }, [delayMs]); + return canRender && context.imageLoadingStatus !== ImageLoadingStatus.Loaded ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.span, { ...fallbackProps, ref: forwardedRef }) : null; + }, "AvatarFallback") +); +function useImageLoadingStatus(src, { + loadingStatus, + setLoadingStatus, + referrerPolicy, + crossOrigin +}) { + (0, import_react_use_layout_effect.useLayoutEffect)(() => { + if (!src) { + setLoadingStatus(ImageLoadingStatus.Error); + return; + } + const image = new window.Image(); + const handleLoad = /* @__PURE__ */ __name((event) => { + const image2 = event.currentTarget; + setLoadingStatus(getImageLoadingStatus(image2)); + }, "handleLoad"); + const handleError = /* @__PURE__ */ __name(() => setLoadingStatus(ImageLoadingStatus.Error), "handleError"); + image.addEventListener("load", handleLoad); + image.addEventListener("error", handleError); + if (referrerPolicy) { + image.referrerPolicy = referrerPolicy; + } + image.crossOrigin = crossOrigin ?? null; + image.src = src; + setLoadingStatus(getImageLoadingStatus(image)); + return () => { + image.removeEventListener("load", handleLoad); + image.removeEventListener("error", handleError); + setLoadingStatus(ImageLoadingStatus.Idle); + }; + }, [src, crossOrigin, referrerPolicy, setLoadingStatus]); + return loadingStatus; +} +__name(useImageLoadingStatus, "useImageLoadingStatus"); +function getImageLoadingStatus(image) { + return image.complete ? image.naturalWidth > 0 ? ImageLoadingStatus.Loaded : ImageLoadingStatus.Error : ImageLoadingStatus.Loading; +} +__name(getImageLoadingStatus, "getImageLoadingStatus"); +function useImageCount() { + let state = STATIC_IMAGE_COUNT_STATE; + if (import_is_development.IS_DEVELOPMENT) { + state = React.useState(0); + const [imageCount] = state; + const hasWarnedRef = React.useRef(false); + React.useEffect(() => { + if (imageCount > 1 && !hasWarnedRef.current) { + hasWarnedRef.current = true; + console.warn( + "Avatar: Only one `Avatar.Image` component should be rendered per `Avatar.Root`, but multiple were detected. This will lead to unexpected behavior." + ); + } + }, [imageCount]); + } + return state; +} +__name(useImageCount, "useImageCount"); +function useUpdateImageCount(setImageCount) { + if (import_is_development.IS_DEVELOPMENT) { + React.useEffect(() => { + setImageCount((imageCount) => imageCount + 1); + return () => { + setImageCount((imageCount) => imageCount - 1); + }; + }, [setImageCount]); + } +} +__name(useUpdateImageCount, "useUpdateImageCount"); +//# sourceMappingURL=index.js.map diff --git a/e-commerce/node_modules/@radix-ui/react-avatar/dist/index.js.map b/e-commerce/node_modules/@radix-ui/react-avatar/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..529c514fb241369db301ccbbb5df1157c5d1d33a --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-avatar/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts", "../src/avatar.tsx"], + "sourcesContent": ["'use client';\nexport {\n createAvatarScope,\n //\n Avatar,\n AvatarImage,\n AvatarFallback,\n //\n Root,\n Image,\n Fallback,\n} from './avatar';\nexport type { AvatarProps, AvatarImageProps, AvatarFallbackProps } from './avatar';\n", "import * as React from 'react';\nimport { IS_DEVELOPMENT } from '@radix-ui/primitive/is-development';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { Primitive } from '@radix-ui/react-primitive';\n\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Avatar\n * -----------------------------------------------------------------------------------------------*/\n\nconst AVATAR_NAME = 'Avatar';\n\ntype ScopedProps

= P & { __scopeAvatar?: Scope | undefined };\nconst [createAvatarContext, createAvatarScope] = createContextScope(AVATAR_NAME);\n\nconst ImageLoadingStatus = {\n Idle: 'idle',\n Loading: 'loading',\n Loaded: 'loaded',\n Error: 'error',\n} as const;\n\ntype ImageLoadingStatus = (typeof ImageLoadingStatus)[keyof typeof ImageLoadingStatus];\n\ntype AvatarContextValue = {\n imageLoadingStatus: ImageLoadingStatus;\n setImageLoadingStatus: React.Dispatch>;\n imageCount: number;\n setImageCount: React.Dispatch>;\n};\n\nconst STATIC_IMAGE_COUNT_STATE: [number, React.Dispatch>] = [\n 0,\n () => void 0,\n];\n\nconst [AvatarProvider, useAvatarContext] = createAvatarContext(AVATAR_NAME);\n\ntype AvatarElement = React.ComponentRef;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef;\ninterface AvatarProps extends PrimitiveSpanProps {}\n\nconst Avatar = /* @__PURE__ */ React.forwardRef(\n // blank line to reduce diff noise\n function Avatar(props: ScopedProps, forwardedRef) {\n const { __scopeAvatar, ...avatarProps } = props;\n const [imageLoadingStatus, setImageLoadingStatus] = React.useState(\n ImageLoadingStatus.Idle,\n );\n const [imageCount, setImageCount] = useImageCount();\n\n return (\n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AvatarImage\n * -----------------------------------------------------------------------------------------------*/\n\nconst IMAGE_NAME = 'AvatarImage';\n\ntype AvatarImageElement = React.ComponentRef;\ntype PrimitiveImageProps = React.ComponentPropsWithoutRef;\ninterface AvatarImageProps extends PrimitiveImageProps {\n onLoadingStatusChange?: ((status: ImageLoadingStatus) => void) | undefined;\n}\n\nconst AvatarImage = /* @__PURE__ */ React.forwardRef(\n function AvatarImage(props: ScopedProps, forwardedRef) {\n const { __scopeAvatar, src, onLoadingStatusChange, ...imageProps } = props;\n const context = useAvatarContext(IMAGE_NAME, __scopeAvatar);\n useUpdateImageCount(context.setImageCount);\n\n const imageLoadingStatus = useImageLoadingStatus(src, {\n referrerPolicy: imageProps.referrerPolicy,\n crossOrigin: imageProps.crossOrigin,\n loadingStatus: context.imageLoadingStatus,\n setLoadingStatus: context.setImageLoadingStatus,\n });\n const handleLoadingStatusChange = useCallbackRef((status: ImageLoadingStatus) => {\n onLoadingStatusChange?.(status);\n });\n\n const loadingStatusRef = React.useRef(imageLoadingStatus);\n\n useLayoutEffect(() => {\n const previousLoadingStatus = loadingStatusRef.current;\n loadingStatusRef.current = imageLoadingStatus;\n\n if (imageLoadingStatus !== previousLoadingStatus) {\n handleLoadingStatusChange(imageLoadingStatus);\n }\n }, [imageLoadingStatus, handleLoadingStatusChange]);\n\n return imageLoadingStatus === ImageLoadingStatus.Loaded ? (\n \n ) : null;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AvatarFallback\n * -----------------------------------------------------------------------------------------------*/\n\nconst FALLBACK_NAME = 'AvatarFallback';\n\ntype AvatarFallbackElement = React.ComponentRef;\ninterface AvatarFallbackProps extends PrimitiveSpanProps {\n delayMs?: number | undefined;\n}\n\nconst AvatarFallback = /* @__PURE__ */ React.forwardRef(\n function AvatarFallback(props: ScopedProps, forwardedRef) {\n const { __scopeAvatar, delayMs, ...fallbackProps } = props;\n const context = useAvatarContext(FALLBACK_NAME, __scopeAvatar);\n const [canRender, setCanRender] = React.useState(delayMs === undefined);\n\n React.useEffect(() => {\n if (delayMs !== undefined) {\n const timerId = window.setTimeout(() => setCanRender(true), delayMs);\n return () => window.clearTimeout(timerId);\n }\n }, [delayMs]);\n\n return canRender && context.imageLoadingStatus !== ImageLoadingStatus.Loaded ? (\n \n ) : null;\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction useImageLoadingStatus(\n src: string | undefined,\n {\n loadingStatus,\n setLoadingStatus,\n referrerPolicy,\n crossOrigin,\n }: {\n referrerPolicy: React.HTMLAttributeReferrerPolicy | undefined;\n crossOrigin: string | undefined;\n loadingStatus: ImageLoadingStatus;\n setLoadingStatus: React.Dispatch>;\n },\n) {\n useLayoutEffect(() => {\n if (!src) {\n setLoadingStatus(ImageLoadingStatus.Error);\n return;\n }\n\n const image = new window.Image();\n const handleLoad = (event: Event) => {\n const image = event.currentTarget as HTMLImageElement;\n setLoadingStatus(getImageLoadingStatus(image));\n };\n const handleError = () => setLoadingStatus(ImageLoadingStatus.Error);\n image.addEventListener('load', handleLoad);\n image.addEventListener('error', handleError);\n if (referrerPolicy) {\n image.referrerPolicy = referrerPolicy;\n }\n image.crossOrigin = crossOrigin ?? null;\n image.src = src;\n\n setLoadingStatus(getImageLoadingStatus(image));\n return () => {\n image.removeEventListener('load', handleLoad);\n image.removeEventListener('error', handleError);\n setLoadingStatus(ImageLoadingStatus.Idle);\n };\n }, [src, crossOrigin, referrerPolicy, setLoadingStatus]);\n\n return loadingStatus;\n}\n\nfunction getImageLoadingStatus(image: HTMLImageElement) {\n return image.complete\n ? image.naturalWidth > 0\n ? ImageLoadingStatus.Loaded\n : ImageLoadingStatus.Error\n : ImageLoadingStatus.Loading;\n}\n\n// Image count is only used in development to warn about multiple images, which\n// is unsupported. Gating behind a development flag to avoid performance\n// overhead in production is safe because useState is guaranteed to run\n// consistently in the same environment.\n// oxlint-disable react-hooks/rules-of-hooks\nfunction useImageCount() {\n let state = STATIC_IMAGE_COUNT_STATE;\n if (IS_DEVELOPMENT) {\n state = React.useState(0);\n const [imageCount] = state;\n const hasWarnedRef = React.useRef(false);\n React.useEffect(() => {\n if (imageCount > 1 && !hasWarnedRef.current) {\n hasWarnedRef.current = true;\n console.warn(\n 'Avatar: Only one `Avatar.Image` component should be rendered per `Avatar.Root`, but multiple were detected. This will lead to unexpected behavior.',\n );\n }\n }, [imageCount]);\n }\n\n return state;\n}\n\nfunction useUpdateImageCount(setImageCount: React.Dispatch>) {\n if (IS_DEVELOPMENT) {\n React.useEffect(() => {\n setImageCount((imageCount) => imageCount + 1);\n return () => {\n setImageCount((imageCount) => imageCount - 1);\n };\n }, [setImageCount]);\n }\n}\n// oxlint-enable react-hooks/rules-of-hooks\n\nexport {\n createAvatarScope,\n //\n Avatar,\n AvatarImage,\n AvatarFallback,\n //\n Avatar as Root,\n AvatarImage as Image,\n AvatarFallback as Fallback,\n};\nexport type { AvatarProps, AvatarImageProps, AvatarFallbackProps };\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,4BAA+B;AAC/B,2BAAmC;AACnC,oCAA+B;AAC/B,qCAAgC;AAChC,6BAA0B;AAyDlB;AAjDR,IAAM,cAAc;AAGpB,IAAM,CAAC,qBAAqB,iBAAiB,QAAI,yCAAmB,WAAW;AAE/E,IAAM,qBAAqB;AAAA,EACzB,MAAM;AAAA,EACN,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,OAAO;AACT;AAWA,IAAM,2BAAmF;AAAA,EACvF;AAAA,EACA,MAAM;AACR;AAEA,IAAM,CAAC,gBAAgB,gBAAgB,IAAI,oBAAwC,WAAW;AAM9F,IAAM,SAAyB,gBAAM;AAAA;AAAA,EAEnC,gCAASA,QAAO,OAAiC,cAAc;AAC7D,UAAM,EAAE,eAAe,GAAG,YAAY,IAAI;AAC1C,UAAM,CAAC,oBAAoB,qBAAqB,IAAU;AAAA,MACxD,mBAAmB;AAAA,IACrB;AACA,UAAM,CAAC,YAAY,aAAa,IAAI,cAAc;AAElD,WACE;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA,QACP;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAEA,sDAAC,iCAAU,MAAV,EAAgB,G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K;AACvC,IAAM,gBAAU,MAAM;AACpB,UAAI,aAAa,KAAK,CAAC,aAAa,SAAS;AAC3C,qBAAa,UAAU;AACvB,gBAAQ;AAAA,UACN;AAAA,QACF;AAAA,MACF;AAAA,IACF,GAAG,CAAC,UAAU,CAAC;AAAA,EACjB;AAEA,SAAO;AACT;AAjBS;AAmBT,SAAS,oBAAoB,eAA6D;AACxF,MAAI,sCAAgB;AAClB,IAAM,gBAAU,MAAM;AACpB,oBAAc,CAAC,eAAe,aAAa,CAAC;AAC5C,aAAO,MAAM;AACX,sBAAc,CAAC,eAAe,aAAa,CAAC;AAAA,MAC9C;AAAA,IACF,GAAG,CAAC,aAAa,CAAC;AAAA,EACpB;AACF;AATS;", + "names": ["Avatar", "AvatarImage", "AvatarFallback", "image"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-avatar/dist/index.mjs b/e-commerce/node_modules/@radix-ui/react-avatar/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ba6ea3ae587dfde69c33921e011f0cf24071964e --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-avatar/dist/index.mjs @@ -0,0 +1,164 @@ +"use client"; +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// src/avatar.tsx +import * as React from "react"; +import { IS_DEVELOPMENT } from "@radix-ui/primitive/is-development"; +import { createContextScope } from "@radix-ui/react-context"; +import { useCallbackRef } from "@radix-ui/react-use-callback-ref"; +import { useLayoutEffect } from "@radix-ui/react-use-layout-effect"; +import { Primitive } from "@radix-ui/react-primitive"; +import { jsx } from "react/jsx-runtime"; +var AVATAR_NAME = "Avatar"; +var [createAvatarContext, createAvatarScope] = createContextScope(AVATAR_NAME); +var ImageLoadingStatus = { + Idle: "idle", + Loading: "loading", + Loaded: "loaded", + Error: "error" +}; +var STATIC_IMAGE_COUNT_STATE = [ + 0, + () => void 0 +]; +var [AvatarProvider, useAvatarContext] = createAvatarContext(AVATAR_NAME); +var Avatar = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function Avatar2(props, forwardedRef) { + const { __scopeAvatar, ...avatarProps } = props; + const [imageLoadingStatus, setImageLoadingStatus] = React.useState( + ImageLoadingStatus.Idle + ); + const [imageCount, setImageCount] = useImageCount(); + return /* @__PURE__ */ jsx( + AvatarProvider, + { + scope: __scopeAvatar, + imageLoadingStatus, + setImageLoadingStatus, + imageCount, + setImageCount, + children: /* @__PURE__ */ jsx(Primitive.span, { ...avatarProps, ref: forwardedRef }) + } + ); + }, "Avatar") +); +var IMAGE_NAME = "AvatarImage"; +var AvatarImage = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function AvatarImage2(props, forwardedRef) { + const { __scopeAvatar, src, onLoadingStatusChange, ...imageProps } = props; + const context = useAvatarContext(IMAGE_NAME, __scopeAvatar); + useUpdateImageCount(context.setImageCount); + const imageLoadingStatus = useImageLoadingStatus(src, { + referrerPolicy: imageProps.referrerPolicy, + crossOrigin: imageProps.crossOrigin, + loadingStatus: context.imageLoadingStatus, + setLoadingStatus: context.setImageLoadingStatus + }); + const handleLoadingStatusChange = useCallbackRef((status) => { + onLoadingStatusChange?.(status); + }); + const loadingStatusRef = React.useRef(imageLoadingStatus); + useLayoutEffect(() => { + const previousLoadingStatus = loadingStatusRef.current; + loadingStatusRef.current = imageLoadingStatus; + if (imageLoadingStatus !== previousLoadingStatus) { + handleLoadingStatusChange(imageLoadingStatus); + } + }, [imageLoadingStatus, handleLoadingStatusChange]); + return imageLoadingStatus === ImageLoadingStatus.Loaded ? /* @__PURE__ */ jsx(Primitive.img, { ...imageProps, ref: forwardedRef, src }) : null; + }, "AvatarImage") +); +var FALLBACK_NAME = "AvatarFallback"; +var AvatarFallback = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function AvatarFallback2(props, forwardedRef) { + const { __scopeAvatar, delayMs, ...fallbackProps } = props; + const context = useAvatarContext(FALLBACK_NAME, __scopeAvatar); + const [canRender, setCanRender] = React.useState(delayMs === void 0); + React.useEffect(() => { + if (delayMs !== void 0) { + const timerId = window.setTimeout(() => setCanRender(true), delayMs); + return () => window.clearTimeout(timerId); + } + }, [delayMs]); + return canRender && context.imageLoadingStatus !== ImageLoadingStatus.Loaded ? /* @__PURE__ */ jsx(Primitive.span, { ...fallbackProps, ref: forwardedRef }) : null; + }, "AvatarFallback") +); +function useImageLoadingStatus(src, { + loadingStatus, + setLoadingStatus, + referrerPolicy, + crossOrigin +}) { + useLayoutEffect(() => { + if (!src) { + setLoadingStatus(ImageLoadingStatus.Error); + return; + } + const image = new window.Image(); + const handleLoad = /* @__PURE__ */ __name((event) => { + const image2 = event.currentTarget; + setLoadingStatus(getImageLoadingStatus(image2)); + }, "handleLoad"); + const handleError = /* @__PURE__ */ __name(() => setLoadingStatus(ImageLoadingStatus.Error), "handleError"); + image.addEventListener("load", handleLoad); + image.addEventListener("error", handleError); + if (referrerPolicy) { + image.referrerPolicy = referrerPolicy; + } + image.crossOrigin = crossOrigin ?? null; + image.src = src; + setLoadingStatus(getImageLoadingStatus(image)); + return () => { + image.removeEventListener("load", handleLoad); + image.removeEventListener("error", handleError); + setLoadingStatus(ImageLoadingStatus.Idle); + }; + }, [src, crossOrigin, referrerPolicy, setLoadingStatus]); + return loadingStatus; +} +__name(useImageLoadingStatus, "useImageLoadingStatus"); +function getImageLoadingStatus(image) { + return image.complete ? image.naturalWidth > 0 ? ImageLoadingStatus.Loaded : ImageLoadingStatus.Error : ImageLoadingStatus.Loading; +} +__name(getImageLoadingStatus, "getImageLoadingStatus"); +function useImageCount() { + let state = STATIC_IMAGE_COUNT_STATE; + if (IS_DEVELOPMENT) { + state = React.useState(0); + const [imageCount] = state; + const hasWarnedRef = React.useRef(false); + React.useEffect(() => { + if (imageCount > 1 && !hasWarnedRef.current) { + hasWarnedRef.current = true; + console.warn( + "Avatar: Only one `Avatar.Image` component should be rendered per `Avatar.Root`, but multiple were detected. This will lead to unexpected behavior." + ); + } + }, [imageCount]); + } + return state; +} +__name(useImageCount, "useImageCount"); +function useUpdateImageCount(setImageCount) { + if (IS_DEVELOPMENT) { + React.useEffect(() => { + setImageCount((imageCount) => imageCount + 1); + return () => { + setImageCount((imageCount) => imageCount - 1); + }; + }, [setImageCount]); + } +} +__name(useUpdateImageCount, "useUpdateImageCount"); +export { + Avatar, + AvatarFallback, + AvatarImage, + AvatarFallback as Fallback, + AvatarImage as Image, + Avatar as Root, + createAvatarScope +}; +//# sourceMappingURL=index.mjs.map diff --git a/e-commerce/node_modules/@radix-ui/react-avatar/dist/index.mjs.map b/e-commerce/node_modules/@radix-ui/react-avatar/dist/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..54417cf8e6ee35ca0bf1a2a8db2720bd09185e99 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-avatar/dist/index.mjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/avatar.tsx"], + "sourcesContent": ["import * as React from 'react';\nimport { IS_DEVELOPMENT } from '@radix-ui/primitive/is-development';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { Primitive } from '@radix-ui/react-primitive';\n\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Avatar\n * -----------------------------------------------------------------------------------------------*/\n\nconst AVATAR_NAME = 'Avatar';\n\ntype ScopedProps

= P & { __scopeAvatar?: Scope | undefined };\nconst [createAvatarContext, createAvatarScope] = createContextScope(AVATAR_NAME);\n\nconst ImageLoadingStatus = {\n Idle: 'idle',\n Loading: 'loading',\n Loaded: 'loaded',\n Error: 'error',\n} as const;\n\ntype ImageLoadingStatus = (typeof ImageLoadingStatus)[keyof typeof ImageLoadingStatus];\n\ntype AvatarContextValue = {\n imageLoadingStatus: ImageLoadingStatus;\n setImageLoadingStatus: React.Dispatch>;\n imageCount: number;\n setImageCount: React.Dispatch>;\n};\n\nconst STATIC_IMAGE_COUNT_STATE: [number, React.Dispatch>] = [\n 0,\n () => void 0,\n];\n\nconst [AvatarProvider, useAvatarContext] = createAvatarContext(AVATAR_NAME);\n\ntype AvatarElement = React.ComponentRef;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef;\ninterface AvatarProps extends PrimitiveSpanProps {}\n\nconst Avatar = /* @__PURE__ */ React.forwardRef(\n // blank line to reduce diff noise\n function Avatar(props: ScopedProps, forwardedRef) {\n const { __scopeAvatar, ...avatarProps } = props;\n const [imageLoadingStatus, setImageLoadingStatus] = React.useState(\n ImageLoadingStatus.Idle,\n );\n const [imageCount, setImageCount] = useImageCount();\n\n return (\n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AvatarImage\n * -----------------------------------------------------------------------------------------------*/\n\nconst IMAGE_NAME = 'AvatarImage';\n\ntype AvatarImageElement = React.ComponentRef;\ntype PrimitiveImageProps = React.ComponentPropsWithoutRef;\ninterface AvatarImageProps extends PrimitiveImageProps {\n onLoadingStatusChange?: ((status: ImageLoadingStatus) => void) | undefined;\n}\n\nconst AvatarImage = /* @__PURE__ */ React.forwardRef(\n function AvatarImage(props: ScopedProps, forwardedRef) {\n const { __scopeAvatar, src, onLoadingStatusChange, ...imageProps } = props;\n const context = useAvatarContext(IMAGE_NAME, __scopeAvatar);\n useUpdateImageCount(context.setImageCount);\n\n const imageLoadingStatus = useImageLoadingStatus(src, {\n referrerPolicy: imageProps.referrerPolicy,\n crossOrigin: imageProps.crossOrigin,\n loadingStatus: context.imageLoadingStatus,\n setLoadingStatus: context.setImageLoadingStatus,\n });\n const handleLoadingStatusChange = useCallbackRef((status: ImageLoadingStatus) => {\n onLoadingStatusChange?.(status);\n });\n\n const loadingStatusRef = React.useRef(imageLoadingStatus);\n\n useLayoutEffect(() => {\n const previousLoadingStatus = loadingStatusRef.current;\n loadingStatusRef.current = imageLoadingStatus;\n\n if (imageLoadingStatus !== previousLoadingStatus) {\n handleLoadingStatusChange(imageLoadingStatus);\n }\n }, [imageLoadingStatus, handleLoadingStatusChange]);\n\n return imageLoadingStatus === ImageLoadingStatus.Loaded ? (\n \n ) : null;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AvatarFallback\n * -----------------------------------------------------------------------------------------------*/\n\nconst FALLBACK_NAME = 'AvatarFallback';\n\ntype AvatarFallbackElement = React.ComponentRef;\ninterface AvatarFallbackProps extends PrimitiveSpanProps {\n delayMs?: number | undefined;\n}\n\nconst AvatarFallback = /* @__PURE__ */ React.forwardRef(\n function AvatarFallback(props: ScopedProps, forwardedRef) {\n const { __scopeAvatar, delayMs, ...fallbackProps } = props;\n const context = useAvatarContext(FALLBACK_NAME, __scopeAvatar);\n const [canRender, setCanRender] = React.useState(delayMs === undefined);\n\n React.useEffect(() => {\n if (delayMs !== undefined) {\n const timerId = window.setTimeout(() => setCanRender(true), delayMs);\n return () => window.clearTimeout(timerId);\n }\n }, [delayMs]);\n\n return canRender && context.imageLoadingStatus !== ImageLoadingStatus.Loaded ? (\n \n ) : null;\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction useImageLoadingStatus(\n src: string | undefined,\n {\n loadingStatus,\n setLoadingStatus,\n referrerPolicy,\n crossOrigin,\n }: {\n referrerPolicy: React.HTMLAttributeReferrerPolicy | undefined;\n crossOrigin: string | undefined;\n loadingStatus: ImageLoadingStatus;\n setLoadingStatus: React.Dispatch>;\n },\n) {\n useLayoutEffect(() => {\n if (!src) {\n setLoadingStatus(ImageLoadingStatus.Error);\n return;\n }\n\n const image = new window.Image();\n const handleLoad = (event: Event) => {\n const image = event.currentTarget as HTMLImageElement;\n setLoadingStatus(getImageLoadingStatus(image));\n };\n const handleError = () => setLoadingStatus(ImageLoadingStatus.Error);\n image.addEventListener('load', handleLoad);\n image.addEventListener('error', handleError);\n if (referrerPolicy) {\n image.referrerPolicy = referrerPolicy;\n }\n image.crossOrigin = crossOrigin ?? null;\n image.src = src;\n\n setLoadingStatus(getImageLoadingStatus(image));\n return () => {\n image.removeEventListener('load', handleLoad);\n image.removeEventListener('error', handleError);\n setLoadingStatus(ImageLoadingStatus.Idle);\n };\n }, [src, crossOrigin, referrerPolicy, setLoadingStatus]);\n\n return loadingStatus;\n}\n\nfunction getImageLoadingStatus(image: HTMLImageElement) {\n return image.complete\n ? image.naturalWidth > 0\n ? ImageLoadingStatus.Loaded\n : ImageLoadingStatus.Error\n : ImageLoadingStatus.Loading;\n}\n\n// Image count is only used in development to warn about multiple images, which\n// is unsupported. Gating behind a development flag to avoid performance\n// overhead in production is safe because useState is guaranteed to run\n// consistently in the same environment.\n// oxlint-disable react-hooks/rules-of-hooks\nfunction useImageCount() {\n let state = STATIC_IMAGE_COUNT_STATE;\n if (IS_DEVELOPMENT) {\n state = React.useState(0);\n const [imageCount] = state;\n const hasWarnedRef = React.useRef(false);\n React.useEffect(() => {\n if (imageCount > 1 && !hasWarnedRef.current) {\n hasWarnedRef.current = true;\n console.warn(\n 'Avatar: Only one `Avatar.Image` component should be rendered per `Avatar.Root`, but multiple were detected. This will lead to unexpected behavior.',\n );\n }\n }, [imageCount]);\n }\n\n return state;\n}\n\nfunction useUpdateImageCount(setImageCount: React.Dispatch>) {\n if (IS_DEVELOPMENT) {\n React.useEffect(() => {\n setImageCount((imageCount) => imageCount + 1);\n return () => {\n setImageCount((imageCount) => imageCount - 1);\n };\n }, [setImageCount]);\n }\n}\n// oxlint-enable react-hooks/rules-of-hooks\n\nexport {\n createAvatarScope,\n //\n Avatar,\n AvatarImage,\n AvatarFallback,\n //\n Avatar as Root,\n AvatarImage as Image,\n AvatarFallback as Fallback,\n};\nexport type { AvatarProps, AvatarImageProps, AvatarFallbackProps };\n"], + "mappings": ";;;;;AAAA,YAAY,WAAW;AACvB,SAAS,sBAAsB;AAC/B,SAAS,0BAA0B;AACnC,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAChC,SAAS,iBAAiB;AAyDlB;AAjDR,IAAM,cAAc;AAGpB,IAAM,CAAC,qB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,QAAI,gBAAgB;AAClB,YAAM,iBAAiB;AAAA,IACzB;AACA,UAAM,cAAc,eAAe;AACnC,UAAM,MAAM;AAEZ,qBAAiB,sBAAsB,KAAK,CAAC;AAC7C,WAAO,MAAM;AACX,YAAM,oBAAoB,QAAQ,UAAU;AAC5C,YAAM,oBAAoB,SAAS,WAAW;AAC9C,uBAAiB,mBAAmB,IAAI;AAAA,IAC1C;AAAA,EACF,GAAG,CAAC,KAAK,aAAa,gBAAgB,gBAAgB,CAAC;AAEvD,SAAO;AACT;AA3CS;AA6CT,SAAS,sBAAsB,OAAyB;AACtD,SAAO,MAAM,WACT,MAAM,eAAe,IACnB,mBAAmB,SACnB,mBAAmB,QACrB,mBAAmB;AACzB;AANS;AAaT,SAAS,gBAAgB;AACvB,MAAI,QAAQ;AACZ,MAAI,gBAAgB;AAClB,YAAc,eAAS,CAAC;AACxB,UAAM,CAAC,UAAU,IAAI;AACrB,UAAM,eAAqB,aAAO,KAAK;AACvC,IAAM,gBAAU,MAAM;AACpB,UAAI,aAAa,KAAK,CAAC,aAAa,SAAS;AAC3C,qBAAa,UAAU;AACvB,gBAAQ;AAAA,UACN;AAAA,QACF;AAAA,MACF;AAAA,IACF,GAAG,CAAC,UAAU,CAAC;AAAA,EACjB;AAEA,SAAO;AACT;AAjBS;AAmBT,SAAS,oBAAoB,eAA6D;AACxF,MAAI,gBAAgB;AAClB,IAAM,gBAAU,MAAM;AACpB,oBAAc,CAAC,eAAe,aAAa,CAAC;AAC5C,aAAO,MAAM;AACX,sBAAc,CAAC,eAAe,aAAa,CAAC;AAAA,MAC9C;AAAA,IACF,GAAG,CAAC,aAAa,CAAC;AAAA,EACpB;AACF;AATS;", + "names": ["Avatar", "AvatarImage", "AvatarFallback", "image"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-avatar/package.json b/e-commerce/node_modules/@radix-ui/react-avatar/package.json new file mode 100644 index 0000000000000000000000000000000000000000..9c0825e98f95c5cffba1a9fae42b72c815c23048 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-avatar/package.json @@ -0,0 +1,73 @@ +{ + "name": "@radix-ui/react-avatar", + "version": "1.3.0", + "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.2.0", + "@radix-ui/react-context": "1.3.0", + "@radix-ui/react-primitive": "2.2.0", + "@radix-ui/react-use-callback-ref": "1.1.5", + "@radix-ui/react-use-is-hydrated": "0.1.3", + "@radix-ui/react-use-layout-effect": "1.1.4" + }, + "devDependencies": { + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "react": "^19.3.0", + "react-dom": "^19.3.0", + "typescript": "^5.9.3", + "@repo/builder": "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", + "directory": "packages/react/avatar" + }, + "bugs": { + "url": "https://github.com/radix-ui/primitives/issues" + }, + "scripts": { + "lint": "oxlint --max-warnings 0 src", + "clean": "rm -rf dist", + "reset": "rm -rf dist node_modules", + "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" + } + } + } +} \ No newline at end of file diff --git a/e-commerce/node_modules/@radix-ui/react-checkbox/LICENSE b/e-commerce/node_modules/@radix-ui/react-checkbox/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a18858fb7b014098cba85703e66609be66a26ef5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-checkbox/LICENSE @@ -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. diff --git a/e-commerce/node_modules/@radix-ui/react-checkbox/README.md b/e-commerce/node_modules/@radix-ui/react-checkbox/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f934a79a159d54908beb179aceded5aa8beffa75 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-checkbox/README.md @@ -0,0 +1,3 @@ +# `react-checkbox` + +View docs [here](https://radix-ui.com/primitives/docs/components/checkbox). diff --git a/e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.d.mts b/e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..814f6dd6ee44d08b07b3ce4af30a74e3651ac743 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.d.mts @@ -0,0 +1,49 @@ +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 & { + __scopeCheckbox?: Scope | undefined; +}; +declare const createCheckboxScope: _radix_ui_react_context.CreateScope; +type CheckedState = boolean | 'indeterminate'; +interface CheckboxProviderProps { + checked?: State | boolean | undefined; + defaultChecked?: State | boolean | undefined; + required?: boolean | undefined; + onCheckedChange?: ((checked: State | boolean) => void) | undefined; + name?: string | undefined; + form?: string | undefined; + disabled?: boolean | undefined; + value?: string | number | readonly string[] | undefined; + children?: React.ReactNode | undefined; +} +declare function CheckboxProvider(props: ScopedProps>): React.JSX.Element; +interface CheckboxTriggerProps extends Omit, keyof CheckboxProviderProps> { + children?: React.ReactNode | undefined; +} +declare const CheckboxTrigger: React.ForwardRefExoticComponent>; +type PrimitiveButtonProps = React.ComponentPropsWithoutRef; +interface CheckboxProps extends Omit { + checked?: CheckedState | undefined; + defaultChecked?: CheckedState | undefined; + required?: boolean | undefined; + onCheckedChange?: ((checked: CheckedState) => void) | undefined; +} +declare const Checkbox: React.ForwardRefExoticComponent>; +type PrimitiveSpanProps = React.ComponentPropsWithoutRef; +interface CheckboxIndicatorProps extends PrimitiveSpanProps { + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const CheckboxIndicator: React.ForwardRefExoticComponent>; +type InputProps = React.ComponentPropsWithoutRef; +interface CheckboxBubbleInputProps extends Omit { +} +declare const CheckboxBubbleInput: React.ForwardRefExoticComponent>; + +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 }; diff --git a/e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.d.ts b/e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..814f6dd6ee44d08b07b3ce4af30a74e3651ac743 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.d.ts @@ -0,0 +1,49 @@ +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 & { + __scopeCheckbox?: Scope | undefined; +}; +declare const createCheckboxScope: _radix_ui_react_context.CreateScope; +type CheckedState = boolean | 'indeterminate'; +interface CheckboxProviderProps { + checked?: State | boolean | undefined; + defaultChecked?: State | boolean | undefined; + required?: boolean | undefined; + onCheckedChange?: ((checked: State | boolean) => void) | undefined; + name?: string | undefined; + form?: string | undefined; + disabled?: boolean | undefined; + value?: string | number | readonly string[] | undefined; + children?: React.ReactNode | undefined; +} +declare function CheckboxProvider(props: ScopedProps>): React.JSX.Element; +interface CheckboxTriggerProps extends Omit, keyof CheckboxProviderProps> { + children?: React.ReactNode | undefined; +} +declare const CheckboxTrigger: React.ForwardRefExoticComponent>; +type PrimitiveButtonProps = React.ComponentPropsWithoutRef; +interface CheckboxProps extends Omit { + checked?: CheckedState | undefined; + defaultChecked?: CheckedState | undefined; + required?: boolean | undefined; + onCheckedChange?: ((checked: CheckedState) => void) | undefined; +} +declare const Checkbox: React.ForwardRefExoticComponent>; +type PrimitiveSpanProps = React.ComponentPropsWithoutRef; +interface CheckboxIndicatorProps extends PrimitiveSpanProps { + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const CheckboxIndicator: React.ForwardRefExoticComponent>; +type InputProps = React.ComponentPropsWithoutRef; +interface CheckboxBubbleInputProps extends Omit { +} +declare const CheckboxBubbleInput: React.ForwardRefExoticComponent>; + +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 }; diff --git a/e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.js b/e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..290059372bf74047ad8ba6752a3469e8db068678 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.js @@ -0,0 +1,353 @@ +"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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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_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 [userClick, setUserClick] = React.useState(null); + 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, + userClick, + onUserClick: setUserClick, + 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 + } + ); +} +__name(CheckboxProvider, "CheckboxProvider"); +var TRIGGER_NAME = "CheckboxTrigger"; +var CheckboxTrigger = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function CheckboxTrigger2({ __scopeCheckbox, onKeyDown, onClick, ...checkboxProps }, forwardedRef) { + const { + control, + value, + disabled, + checked, + required, + setControl, + setChecked, + onUserClick, + 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 = /* @__PURE__ */ __name(() => setChecked(initialCheckedStateRef.current), "reset"); + 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) => { + const hasConsumerStoppedPropagation = event.isPropagationStopped(); + onUserClick({ + requestedChecked: isIndeterminate(checked) ? true : !checked, + hasConsumerStoppedPropagation + }); + setChecked((prevChecked) => isIndeterminate(prevChecked) ? true : !prevChecked); + if (bubbleInput && isFormControl) { + if (!hasConsumerStoppedPropagation) event.stopPropagation(); + } + }) + } + ); + }, "CheckboxTrigger") +); +var Checkbox = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function Checkbox2(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") +); +var INDICATOR_NAME = "CheckboxIndicator"; +var CheckboxIndicator = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function CheckboxIndicator2(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") +); +var BUBBLE_INPUT_NAME = "CheckboxBubbleInput"; +var CheckboxBubbleInput = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function CheckboxBubbleInput2({ __scopeCheckbox, onClick, ...props }, forwardedRef) { + const { + control, + userClick, + 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 controlSize = (0, import_react_use_size.useSize)(control); + const shouldStopClickPropagationRef = React.useRef(false); + const prevCheckedRef = React.useRef(checked); + const handledUserClickRef = React.useRef(userClick); + const pendingUserClickRef = React.useRef(null); + React.useEffect(() => { + const input = bubbleInput; + if (!input) return; + const inputProto = window.HTMLInputElement.prototype; + const descriptor = Object.getOwnPropertyDescriptor( + inputProto, + "checked" + ); + const setChecked = descriptor.set; + if (!setChecked) return; + const checkedChanged = prevCheckedRef.current !== checked; + prevCheckedRef.current = checked; + const isNewUserClick = userClick !== null && userClick !== handledUserClickRef.current; + handledUserClickRef.current = userClick; + if (isNewUserClick) { + pendingUserClickRef.current = checkedChanged ? null : userClick; + if (checkedChanged) { + input.indeterminate = isIndeterminate(checked); + setChecked.call(input, isIndeterminate(checked) ? false : checked); + } + input.dispatchEvent( + new Event("click", { bubbles: !userClick.hasConsumerStoppedPropagation }) + ); + } else if (checkedChanged) { + const pendingUserClick = pendingUserClickRef.current; + pendingUserClickRef.current = null; + const isPendingUserChange = pendingUserClick?.requestedChecked === checked; + shouldStopClickPropagationRef.current = true; + input.indeterminate = isIndeterminate(checked); + setChecked.call(input, isIndeterminate(checked) ? false : checked); + input.dispatchEvent( + new Event("click", { + bubbles: !(isPendingUserChange && pendingUserClick.hasConsumerStoppedPropagation) + }) + ); + shouldStopClickPropagationRef.current = false; + } + }, [bubbleInput, checked, userClick]); + 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, + onClick: (0, import_primitive.composeEventHandlers)(onClick, (event) => { + if (shouldStopClickPropagationRef.current) { + event.stopPropagation(); + } + }), + 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") +); +function isFunction(value) { + return typeof value === "function"; +} +__name(isFunction, "isFunction"); +function isIndeterminate(checked) { + return checked === "indeterminate"; +} +__name(isIndeterminate, "isIndeterminate"); +function getState(checked) { + return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked"; +} +__name(getState, "getState"); +//# sourceMappingURL=index.js.map diff --git a/e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.js.map b/e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7bd784144551f6636071a0b1b1ba22859cfa40c8 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts", "../src/checkbox.tsx"], + "sourcesContent": ["'use client';\nexport {\n createCheckboxScope,\n //\n Checkbox,\n CheckboxProvider as unstable_CheckboxProvider,\n CheckboxTrigger as unstable_CheckboxTrigger,\n CheckboxIndicator,\n CheckboxBubbleInput as unstable_CheckboxBubbleInput,\n //\n Root,\n Provider as unstable_Provider,\n Trigger as unstable_Trigger,\n Indicator,\n BubbleInput as unstable_BubbleInput,\n} from './checkbox';\nexport type {\n CheckboxProps,\n CheckboxProviderProps as unstable_CheckboxProviderProps,\n CheckboxTriggerProps as unstable_CheckboxTriggerProps,\n CheckboxIndicatorProps,\n CheckboxBubbleInputProps as unstable_CheckboxBubbleInputProps,\n CheckedState,\n} from './checkbox';\n", "import * as React from 'react';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useSize } from '@radix-ui/react-use-size';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\n\nimport type { Scope } from '@radix-ui/react-context';\n\nconst CHECKBOX_NAME = 'Checkbox';\n\ntype ScopedProps

= P & { __scopeCheckbox?: Scope | undefined };\nconst [createCheckboxContext, createCheckboxScope] = createContextScope(CHECKBOX_NAME);\n\ntype CheckedState = boolean | 'indeterminate';\n\ninterface CheckboxUserClick {\n requestedChecked: boolean;\n hasConsumerStoppedPropagation: boolean;\n}\n\ntype CheckboxContextValue = {\n checked: State | boolean;\n setChecked: React.Dispatch>;\n disabled: boolean | undefined;\n control: HTMLButtonElement | null;\n setControl: React.Dispatch>;\n name: string | undefined;\n form: string | undefined;\n value: string | number | readonly string[];\n userClick: CheckboxUserClick | null;\n onUserClick: (userClick: CheckboxUserClick) => void;\n required: boolean | undefined;\n defaultChecked: boolean | undefined;\n isFormControl: boolean;\n bubbleInput: HTMLInputElement | null;\n setBubbleInput: React.Dispatch>;\n};\n\nconst [CheckboxProviderImpl, useCheckboxContext] =\n createCheckboxContext(CHECKBOX_NAME);\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxProvider\n * -----------------------------------------------------------------------------------------------*/\n\ninterface CheckboxProviderProps {\n checked?: State | boolean | undefined;\n defaultChecked?: State | boolean | undefined;\n required?: boolean | undefined;\n onCheckedChange?: ((checked: State | boolean) => void) | undefined;\n name?: string | undefined;\n form?: string | undefined;\n disabled?: boolean | undefined;\n value?: string | number | readonly string[] | undefined;\n children?: React.ReactNode | undefined;\n}\n\nfunction CheckboxProvider(\n props: ScopedProps>,\n) {\n const {\n __scopeCheckbox,\n checked: checkedProp,\n children,\n defaultChecked,\n disabled,\n form,\n name,\n onCheckedChange,\n required,\n value = 'on',\n // @ts-expect-error\n internal_do_not_use_render,\n } = props;\n\n const [checked, setChecked] = useControllableState({\n prop: checkedProp,\n defaultProp: defaultChecked ?? false,\n onChange: onCheckedChange,\n caller: CHECKBOX_NAME,\n });\n const [control, setControl] = React.useState(null);\n const [bubbleInput, setBubbleInput] = React.useState(null);\n // The latest user click on the trigger. The bubble input dispatches the click\n // to the form once React has handled it, whether or not `checked` changes in\n // the same render.\n const [userClick, setUserClick] = React.useState(null);\n const isFormControl = control\n ? !!form || !!control.closest('form')\n : // We set this to true by default so that events bubble to forms without JS (SSR)\n true;\n\n const context: CheckboxContextValue = {\n checked: checked,\n disabled: disabled,\n setChecked: setChecked,\n control: control,\n setControl: setControl,\n name: name,\n form: form,\n value: value,\n userClick: userClick,\n onUserClick: setUserClick,\n required: required,\n defaultChecked: isIndeterminate(defaultChecked) ? false : defaultChecked,\n isFormControl: isFormControl,\n bubbleInput,\n setBubbleInput,\n };\n\n return (\n )}\n >\n {isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children}\n \n );\n}\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'CheckboxTrigger';\n\ninterface CheckboxTriggerProps extends Omit<\n React.ComponentPropsWithoutRef,\n keyof CheckboxProviderProps\n> {\n children?: React.ReactNode | undefined;\n}\n\nconst CheckboxTrigger = /* @__PURE__ */ React.forwardRef(\n function CheckboxTrigger(\n { __scopeCheckbox, onKeyDown, onClick, ...checkboxProps }: ScopedProps,\n forwardedRef,\n ) {\n const {\n control,\n value,\n disabled,\n checked,\n required,\n setControl,\n setChecked,\n onUserClick,\n isFormControl,\n bubbleInput,\n } = useCheckboxContext(TRIGGER_NAME, __scopeCheckbox);\n const composedRefs = useComposedRefs(forwardedRef, setControl);\n\n const initialCheckedStateRef = React.useRef(checked);\n React.useEffect(() => {\n const form = control?.form;\n if (form) {\n const reset = () => setChecked(initialCheckedStateRef.current);\n form.addEventListener('reset', reset);\n return () => form.removeEventListener('reset', reset);\n }\n }, [control, setChecked]);\n\n return (\n {\n // According to WAI ARIA, Checkboxes don't activate on enter keypress\n if (event.key === 'Enter') event.preventDefault();\n })}\n onClick={composeEventHandlers(onClick, (event) => {\n const hasConsumerStoppedPropagation = event.isPropagationStopped();\n onUserClick({\n requestedChecked: isIndeterminate(checked) ? true : !checked,\n hasConsumerStoppedPropagation,\n });\n setChecked((prevChecked) => (isIndeterminate(prevChecked) ? true : !prevChecked));\n if (bubbleInput && isFormControl) {\n // if checkbox has a bubble input and is a form control, stop\n // propagation from the button so that we only propagate one click\n // event (from the input). We propagate changes from an input so\n // that native form validation works and form events reflect\n // checkbox updates.\n if (!hasConsumerStoppedPropagation) event.stopPropagation();\n }\n })}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * Checkbox\n * -----------------------------------------------------------------------------------------------*/\n\ntype CheckboxElement = React.ComponentRef;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef;\ninterface CheckboxProps extends Omit {\n checked?: CheckedState | undefined;\n defaultChecked?: CheckedState | undefined;\n required?: boolean | undefined;\n onCheckedChange?: ((checked: CheckedState) => void) | undefined;\n}\n\nconst Checkbox = /* @__PURE__ */ React.forwardRef(\n // blank line to reduce diff noise\n function Checkbox(props: ScopedProps, forwardedRef) {\n const {\n __scopeCheckbox,\n name,\n checked,\n defaultChecked,\n required,\n disabled,\n value,\n onCheckedChange,\n form,\n ...checkboxProps\n } = props;\n\n return (\n (\n <>\n \n {isFormControl && (\n \n )}\n \n )}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'CheckboxIndicator';\n\ntype CheckboxIndicatorElement = React.ComponentRef;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef;\ninterface CheckboxIndicatorProps extends PrimitiveSpanProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst CheckboxIndicator = /* @__PURE__ */ React.forwardRef<\n CheckboxIndicatorElement,\n CheckboxIndicatorProps\n>(\n // blank line to reduce diff noise\n function CheckboxIndicator(props: ScopedProps, forwardedRef) {\n const { __scopeCheckbox, forceMount, ...indicatorProps } = props;\n const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);\n return (\n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxBubbleInput\n * -----------------------------------------------------------------------------------------------*/\n\nconst BUBBLE_INPUT_NAME = 'CheckboxBubbleInput';\n\ntype InputProps = React.ComponentPropsWithoutRef;\ninterface CheckboxBubbleInputProps extends Omit {}\n\nconst CheckboxBubbleInput = /* @__PURE__ */ React.forwardRef<\n HTMLInputElement,\n CheckboxBubbleInputProps\n>(\n // blank line to reduce diff noise\n function CheckboxBubbleInput(\n { __scopeCheckbox, onClick, ...props }: ScopedProps,\n forwardedRef,\n ) {\n const {\n control,\n userClick,\n checked,\n defaultChecked,\n required,\n disabled,\n name,\n value,\n form,\n bubbleInput,\n setBubbleInput,\n } = useCheckboxContext(BUBBLE_INPUT_NAME, __scopeCheckbox);\n\n const composedRefs = useComposedRefs(forwardedRef, setBubbleInput);\n const controlSize = useSize(control);\n // When the checked change is not driven by a user interaction (e.g. a\n // controlled `checked` update), the `click` event we dispatch to notify\n // forms must not reach ancestor `onClick` handlers. We can't simply make it\n // non-bubbling because React derives the checkbox's `change` event from a\n // bubbling `click`. Instead we stop propagation of the synthetic click,\n // which still lets the `change` event reach the form.\n const shouldStopClickPropagationRef = React.useRef(false);\n const prevCheckedRef = React.useRef(checked);\n // The user click this input last dispatched, so each click is dispatched\n // once.\n const handledUserClickRef = React.useRef(userClick);\n // A dispatched user click whose `checked` change hasn't been applied yet\n // (e.g. a controlled parent applying it later). When it is applied, it\n // must still respect the consumer stopping the click's propagation.\n const pendingUserClickRef = React.useRef(null);\n\n // Bubble checked change to parents (e.g form change event)\n React.useEffect(() => {\n const input = bubbleInput;\n if (!input) return;\n\n const inputProto = window.HTMLInputElement.prototype;\n const descriptor = Object.getOwnPropertyDescriptor(\n inputProto,\n 'checked',\n ) as PropertyDescriptor;\n const setChecked = descriptor.set;\n if (!setChecked) return;\n\n const checkedChanged = prevCheckedRef.current !== checked;\n prevCheckedRef.current = checked;\n const isNewUserClick = userClick !== null && userClick !== handledUserClickRef.current;\n handledUserClickRef.current = userClick;\n\n if (isNewUserClick) {\n // Dispatch the user's click even if `checked` hasn't changed (yet), so\n // ancestors are notified of every click on the trigger.\n pendingUserClickRef.current = checkedChanged ? null : userClick;\n if (checkedChanged) {\n input.indeterminate = isIndeterminate(checked);\n setChecked.call(input, isIndeterminate(checked) ? false : checked);\n }\n input.dispatchEvent(\n new Event('click', { bubbles: !userClick.hasConsumerStoppedPropagation }),\n );\n } else if (checkedChanged) {\n const pendingUserClick = pendingUserClickRef.current;\n pendingUserClickRef.current = null;\n const isPendingUserChange = pendingUserClick?.requestedChecked === checked;\n // The user's click already reached ancestors, and programmatic\n // updates never do, so this click only notifies the form.\n shouldStopClickPropagationRef.current = true;\n input.indeterminate = isIndeterminate(checked);\n setChecked.call(input, isIndeterminate(checked) ? false : checked);\n input.dispatchEvent(\n new Event('click', {\n bubbles: !(isPendingUserChange && pendingUserClick.hasConsumerStoppedPropagation),\n }),\n );\n shouldStopClickPropagationRef.current = false;\n }\n }, [bubbleInput, checked, userClick]);\n\n const defaultCheckedRef = React.useRef(isIndeterminate(checked) ? false : checked);\n return (\n {\n // Prevent the synthetic click dispatched on controlled/programmatic\n // updates from triggering ancestor `onClick` handlers, while still\n // allowing the resulting `change` event to reach the form.\n if (shouldStopClickPropagationRef.current) {\n event.stopPropagation();\n }\n })}\n style={{\n ...props.style,\n ...controlSize,\n position: 'absolute',\n pointerEvents: 'none',\n opacity: 0,\n margin: 0,\n // We transform because the input is absolutely positioned but we have\n // rendered it **after** the button. This pulls it back to sit on top\n // of the button.\n transform: 'translateX(-100%)',\n }}\n />\n );\n },\n);\n\n/* ---------------------------------------------------------------------------------------------- */\n\nfunction isFunction(value: unknown): value is (...args: any[]) => any {\n return typeof value === 'function';\n}\n\nfunction isIndeterminate(checked?: CheckedState): checked is 'indeterminate' {\n return checked === 'indeterminate';\n}\n\nfunction getState(checked: CheckedState) {\n return isIndeterminate(checked) ? 'indeterminate' : checked ? 'checked' : 'unchecked';\n}\n\nexport {\n createCheckboxScope,\n //\n Checkbox,\n CheckboxProvider,\n CheckboxTrigger,\n CheckboxIndicator,\n CheckboxBubbleInput,\n //\n Checkbox as Root,\n CheckboxProvider as Provider,\n CheckboxTrigger as Trigger,\n CheckboxIndicator as Indicator,\n CheckboxBubbleInput as BubbleInput,\n};\nexport type {\n CheckboxProps,\n CheckboxProviderProps,\n CheckboxTriggerProps,\n CheckboxIndicatorProps,\n CheckboxBubbleInputProps,\n CheckedState,\n};\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,gCAAgC;AAChC,2BAAmC;AACnC,uBAAqC;AACrC,0CAAqC;AACrC,4BAAwB;AACxB,4BAAyB;AACzB,6BAA0B;AA2GtB;AAvGJ,IAAM,gBAAgB;AAGtB,IAAM,CAAC,uBAAuB,mBAAmB,QAAI,yCAAmB,aAAa;AA2BrF,IAAM,CAAC,sBAAsB,kBAAkB,IAC7C,sBAA4C,aAAa;AAkB3D,SAAS,iBACP,OACA;AACA,QAAM;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA;AAAA,IAER;AAA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AC,iCAAU;AAAA,MAAV;AAAA,QACC,MAAK;AAAA,QACL,eAAW;AAAA,QACX,gBAAgB,kBAAkB,kBAAkB;AAAA,QACpD;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACC,GAAG;AAAA,QACJ,UAAU;AAAA,QACV,KAAK;AAAA,QACL,aAAS,uCAAqB,SAAS,CAAC,UAAU;AAIhD,cAAI,8BAA8B,SAAS;AACzC,kBAAM,gBAAgB;AAAA,UACxB;AAAA,QACF,CAAC;AAAA,QACD,OAAO;AAAA,UACL,GAAG,MAAM;AAAA,UACT,GAAG;AAAA,UACH,UAAU;AAAA,UACV,eAAe;AAAA,UACf,SAAS;AAAA,UACT,QAAQ;AAAA;AAAA;AAAA;AAAA,UAIR,WAAW;AAAA,QACb;AAAA;AAAA,IACF;AAAA,EAEJ,GAvHA;AAwHF;AAIA,SAAS,WAAW,OAAkD;AACpE,SAAO,OAAO,UAAU;AAC1B;AAFS;AAIT,SAAS,gBAAgB,SAAoD;AAC3E,SAAO,YAAY;AACrB;AAFS;AAIT,SAAS,SAAS,SAAuB;AACvC,SAAO,gBAAgB,OAAO,IAAI,kBAAkB,UAAU,YAAY;AAC5E;AAFS;", + "names": ["CheckboxTrigger", "Checkbox", "CheckboxIndicator", "CheckboxBubbleInput"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.mjs b/e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6ba39ec6fa4841c630d093291586a86cfb0980f4 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.mjs @@ -0,0 +1,322 @@ +"use client"; +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// 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 { 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 [userClick, setUserClick] = React.useState(null); + 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, + userClick, + onUserClick: setUserClick, + 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 + } + ); +} +__name(CheckboxProvider, "CheckboxProvider"); +var TRIGGER_NAME = "CheckboxTrigger"; +var CheckboxTrigger = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function CheckboxTrigger2({ __scopeCheckbox, onKeyDown, onClick, ...checkboxProps }, forwardedRef) { + const { + control, + value, + disabled, + checked, + required, + setControl, + setChecked, + onUserClick, + 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 = /* @__PURE__ */ __name(() => setChecked(initialCheckedStateRef.current), "reset"); + 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) => { + const hasConsumerStoppedPropagation = event.isPropagationStopped(); + onUserClick({ + requestedChecked: isIndeterminate(checked) ? true : !checked, + hasConsumerStoppedPropagation + }); + setChecked((prevChecked) => isIndeterminate(prevChecked) ? true : !prevChecked); + if (bubbleInput && isFormControl) { + if (!hasConsumerStoppedPropagation) event.stopPropagation(); + } + }) + } + ); + }, "CheckboxTrigger") +); +var Checkbox = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function Checkbox2(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") +); +var INDICATOR_NAME = "CheckboxIndicator"; +var CheckboxIndicator = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function CheckboxIndicator2(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") +); +var BUBBLE_INPUT_NAME = "CheckboxBubbleInput"; +var CheckboxBubbleInput = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function CheckboxBubbleInput2({ __scopeCheckbox, onClick, ...props }, forwardedRef) { + const { + control, + userClick, + checked, + defaultChecked, + required, + disabled, + name, + value, + form, + bubbleInput, + setBubbleInput + } = useCheckboxContext(BUBBLE_INPUT_NAME, __scopeCheckbox); + const composedRefs = useComposedRefs(forwardedRef, setBubbleInput); + const controlSize = useSize(control); + const shouldStopClickPropagationRef = React.useRef(false); + const prevCheckedRef = React.useRef(checked); + const handledUserClickRef = React.useRef(userClick); + const pendingUserClickRef = React.useRef(null); + React.useEffect(() => { + const input = bubbleInput; + if (!input) return; + const inputProto = window.HTMLInputElement.prototype; + const descriptor = Object.getOwnPropertyDescriptor( + inputProto, + "checked" + ); + const setChecked = descriptor.set; + if (!setChecked) return; + const checkedChanged = prevCheckedRef.current !== checked; + prevCheckedRef.current = checked; + const isNewUserClick = userClick !== null && userClick !== handledUserClickRef.current; + handledUserClickRef.current = userClick; + if (isNewUserClick) { + pendingUserClickRef.current = checkedChanged ? null : userClick; + if (checkedChanged) { + input.indeterminate = isIndeterminate(checked); + setChecked.call(input, isIndeterminate(checked) ? false : checked); + } + input.dispatchEvent( + new Event("click", { bubbles: !userClick.hasConsumerStoppedPropagation }) + ); + } else if (checkedChanged) { + const pendingUserClick = pendingUserClickRef.current; + pendingUserClickRef.current = null; + const isPendingUserChange = pendingUserClick?.requestedChecked === checked; + shouldStopClickPropagationRef.current = true; + input.indeterminate = isIndeterminate(checked); + setChecked.call(input, isIndeterminate(checked) ? false : checked); + input.dispatchEvent( + new Event("click", { + bubbles: !(isPendingUserChange && pendingUserClick.hasConsumerStoppedPropagation) + }) + ); + shouldStopClickPropagationRef.current = false; + } + }, [bubbleInput, checked, userClick]); + 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, + onClick: composeEventHandlers(onClick, (event) => { + if (shouldStopClickPropagationRef.current) { + event.stopPropagation(); + } + }), + 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") +); +function isFunction(value) { + return typeof value === "function"; +} +__name(isFunction, "isFunction"); +function isIndeterminate(checked) { + return checked === "indeterminate"; +} +__name(isIndeterminate, "isIndeterminate"); +function getState(checked) { + return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked"; +} +__name(getState, "getState"); +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 diff --git a/e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.mjs.map b/e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..cfe7a787ada8ea37a712201f6922839dd3a18c30 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.mjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/checkbox.tsx"], + "sourcesContent": ["import * as React from 'react';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useSize } from '@radix-ui/react-use-size';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\n\nimport type { Scope } from '@radix-ui/react-context';\n\nconst CHECKBOX_NAME = 'Checkbox';\n\ntype ScopedProps

= P & { __scopeCheckbox?: Scope | undefined };\nconst [createCheckboxContext, createCheckboxScope] = createContextScope(CHECKBOX_NAME);\n\ntype CheckedState = boolean | 'indeterminate';\n\ninterface CheckboxUserClick {\n requestedChecked: boolean;\n hasConsumerStoppedPropagation: boolean;\n}\n\ntype CheckboxContextValue = {\n checked: State | boolean;\n setChecked: React.Dispatch>;\n disabled: boolean | undefined;\n control: HTMLButtonElement | null;\n setControl: React.Dispatch>;\n name: string | undefined;\n form: string | undefined;\n value: string | number | readonly string[];\n userClick: CheckboxUserClick | null;\n onUserClick: (userClick: CheckboxUserClick) => void;\n required: boolean | undefined;\n defaultChecked: boolean | undefined;\n isFormControl: boolean;\n bubbleInput: HTMLInputElement | null;\n setBubbleInput: React.Dispatch>;\n};\n\nconst [CheckboxProviderImpl, useCheckboxContext] =\n createCheckboxContext(CHECKBOX_NAME);\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxProvider\n * -----------------------------------------------------------------------------------------------*/\n\ninterface CheckboxProviderProps {\n checked?: State | boolean | undefined;\n defaultChecked?: State | boolean | undefined;\n required?: boolean | undefined;\n onCheckedChange?: ((checked: State | boolean) => void) | undefined;\n name?: string | undefined;\n form?: string | undefined;\n disabled?: boolean | undefined;\n value?: string | number | readonly string[] | undefined;\n children?: React.ReactNode | undefined;\n}\n\nfunction CheckboxProvider(\n props: ScopedProps>,\n) {\n const {\n __scopeCheckbox,\n checked: checkedProp,\n children,\n defaultChecked,\n disabled,\n form,\n name,\n onCheckedChange,\n required,\n value = 'on',\n // @ts-expect-error\n internal_do_not_use_render,\n } = props;\n\n const [checked, setChecked] = useControllableState({\n prop: checkedProp,\n defaultProp: defaultChecked ?? false,\n onChange: onCheckedChange,\n caller: CHECKBOX_NAME,\n });\n const [control, setControl] = React.useState(null);\n const [bubbleInput, setBubbleInput] = React.useState(null);\n // The latest user click on the trigger. The bubble input dispatches the click\n // to the form once React has handled it, whether or not `checked` changes in\n // the same render.\n const [userClick, setUserClick] = React.useState(null);\n const isFormControl = control\n ? !!form || !!control.closest('form')\n : // We set this to true by default so that events bubble to forms without JS (SSR)\n true;\n\n const context: CheckboxContextValue = {\n checked: checked,\n disabled: disabled,\n setChecked: setChecked,\n control: control,\n setControl: setControl,\n name: name,\n form: form,\n value: value,\n userClick: userClick,\n onUserClick: setUserClick,\n required: required,\n defaultChecked: isIndeterminate(defaultChecked) ? false : defaultChecked,\n isFormControl: isFormControl,\n bubbleInput,\n setBubbleInput,\n };\n\n return (\n )}\n >\n {isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children}\n \n );\n}\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'CheckboxTrigger';\n\ninterface CheckboxTriggerProps extends Omit<\n React.ComponentPropsWithoutRef,\n keyof CheckboxProviderProps\n> {\n children?: React.ReactNode | undefined;\n}\n\nconst CheckboxTrigger = /* @__PURE__ */ React.forwardRef(\n function CheckboxTrigger(\n { __scopeCheckbox, onKeyDown, onClick, ...checkboxProps }: ScopedProps,\n forwardedRef,\n ) {\n const {\n control,\n value,\n disabled,\n checked,\n required,\n setControl,\n setChecked,\n onUserClick,\n isFormControl,\n bubbleInput,\n } = useCheckboxContext(TRIGGER_NAME, __scopeCheckbox);\n const composedRefs = useComposedRefs(forwardedRef, setControl);\n\n const initialCheckedStateRef = React.useRef(checked);\n React.useEffect(() => {\n const form = control?.form;\n if (form) {\n const reset = () => setChecked(initialCheckedStateRef.current);\n form.addEventListener('reset', reset);\n return () => form.removeEventListener('reset', reset);\n }\n }, [control, setChecked]);\n\n return (\n {\n // According to WAI ARIA, Checkboxes don't activate on enter keypress\n if (event.key === 'Enter') event.preventDefault();\n })}\n onClick={composeEventHandlers(onClick, (event) => {\n const hasConsumerStoppedPropagation = event.isPropagationStopped();\n onUserClick({\n requestedChecked: isIndeterminate(checked) ? true : !checked,\n hasConsumerStoppedPropagation,\n });\n setChecked((prevChecked) => (isIndeterminate(prevChecked) ? true : !prevChecked));\n if (bubbleInput && isFormControl) {\n // if checkbox has a bubble input and is a form control, stop\n // propagation from the button so that we only propagate one click\n // event (from the input). We propagate changes from an input so\n // that native form validation works and form events reflect\n // checkbox updates.\n if (!hasConsumerStoppedPropagation) event.stopPropagation();\n }\n })}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * Checkbox\n * -----------------------------------------------------------------------------------------------*/\n\ntype CheckboxElement = React.ComponentRef;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef;\ninterface CheckboxProps extends Omit {\n checked?: CheckedState | undefined;\n defaultChecked?: CheckedState | undefined;\n required?: boolean | undefined;\n onCheckedChange?: ((checked: CheckedState) => void) | undefined;\n}\n\nconst Checkbox = /* @__PURE__ */ React.forwardRef(\n // blank line to reduce diff noise\n function Checkbox(props: ScopedProps, forwardedRef) {\n const {\n __scopeCheckbox,\n name,\n checked,\n defaultChecked,\n required,\n disabled,\n value,\n onCheckedChange,\n form,\n ...checkboxProps\n } = props;\n\n return (\n (\n <>\n \n {isFormControl && (\n \n )}\n \n )}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'CheckboxIndicator';\n\ntype CheckboxIndicatorElement = React.ComponentRef;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef;\ninterface CheckboxIndicatorProps extends PrimitiveSpanProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst CheckboxIndicator = /* @__PURE__ */ React.forwardRef<\n CheckboxIndicatorElement,\n CheckboxIndicatorProps\n>(\n // blank line to reduce diff noise\n function CheckboxIndicator(props: ScopedProps, forwardedRef) {\n const { __scopeCheckbox, forceMount, ...indicatorProps } = props;\n const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);\n return (\n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxBubbleInput\n * -----------------------------------------------------------------------------------------------*/\n\nconst BUBBLE_INPUT_NAME = 'CheckboxBubbleInput';\n\ntype InputProps = React.ComponentPropsWithoutRef;\ninterface CheckboxBubbleInputProps extends Omit {}\n\nconst CheckboxBubbleInput = /* @__PURE__ */ React.forwardRef<\n HTMLInputElement,\n CheckboxBubbleInputProps\n>(\n // blank line to reduce diff noise\n function CheckboxBubbleInput(\n { __scopeCheckbox, onClick, ...props }: ScopedProps,\n forwardedRef,\n ) {\n const {\n control,\n userClick,\n checked,\n defaultChecked,\n required,\n disabled,\n name,\n value,\n form,\n bubbleInput,\n setBubbleInput,\n } = useCheckboxContext(BUBBLE_INPUT_NAME, __scopeCheckbox);\n\n const composedRefs = useComposedRefs(forwardedRef, setBubbleInput);\n const controlSize = useSize(control);\n // When the checked change is not driven by a user interaction (e.g. a\n // controlled `checked` update), the `click` event we dispatch to notify\n // forms must not reach ancestor `onClick` handlers. We can't simply make it\n // non-bubbling because React derives the checkbox's `change` event from a\n // bubbling `click`. Instead we stop propagation of the synthetic click,\n // which still lets the `change` event reach the form.\n const shouldStopClickPropagationRef = React.useRef(false);\n const prevCheckedRef = React.useRef(checked);\n // The user click this input last dispatched, so each click is dispatched\n // once.\n const handledUserClickRef = React.useRef(userClick);\n // A dispatched user click whose `checked` change hasn't been applied yet\n // (e.g. a controlled parent applying it later). When it is applied, it\n // must still respect the consumer stopping the click's propagation.\n const pendingUserClickRef = React.useRef(null);\n\n // Bubble checked change to parents (e.g form change event)\n React.useEffect(() => {\n const input = bubbleInput;\n if (!input) return;\n\n const inputProto = window.HTMLInputElement.prototype;\n const descriptor = Object.getOwnPropertyDescriptor(\n inputProto,\n 'checked',\n ) as PropertyDescriptor;\n const setChecked = descriptor.set;\n if (!setChecked) return;\n\n const checkedChanged = prevCheckedRef.current !== checked;\n prevCheckedRef.current = checked;\n const isNewUserClick = userClick !== null && userClick !== handledUserClickRef.current;\n handledUserClickRef.current = userClick;\n\n if (isNewUserClick) {\n // Dispatch the user's click even if `checked` hasn't changed (yet), so\n // ancestors are notified of every click on the trigger.\n pendingUserClickRef.current = checkedChanged ? null : userClick;\n if (checkedChanged) {\n input.indeterminate = isIndeterminate(checked);\n setChecked.call(input, isIndeterminate(checked) ? false : checked);\n }\n input.dispatchEvent(\n new Event('click', { bubbles: !userClick.hasConsumerStoppedPropagation }),\n );\n } else if (checkedChanged) {\n const pendingUserClick = pendingUserClickRef.current;\n pendingUserClickRef.current = null;\n const isPendingUserChange = pendingUserClick?.requestedChecked === checked;\n // The user's click already reached ancestors, and programmatic\n // updates never do, so this click only notifies the form.\n shouldStopClickPropagationRef.current = true;\n input.indeterminate = isIndeterminate(checked);\n setChecked.call(input, isIndeterminate(checked) ? false : checked);\n input.dispatchEvent(\n new Event('click', {\n bubbles: !(isPendingUserChange && pendingUserClick.hasConsumerStoppedPropagation),\n }),\n );\n shouldStopClickPropagationRef.current = false;\n }\n }, [bubbleInput, checked, userClick]);\n\n const defaultCheckedRef = React.useRef(isIndeterminate(checked) ? false : checked);\n return (\n {\n // Prevent the synthetic click dispatched on controlled/programmatic\n // updates from triggering ancestor `onClick` handlers, while still\n // allowing the resulting `change` event to reach the form.\n if (shouldStopClickPropagationRef.current) {\n event.stopPropagation();\n }\n })}\n style={{\n ...props.style,\n ...controlSize,\n position: 'absolute',\n pointerEvents: 'none',\n opacity: 0,\n margin: 0,\n // We transform because the input is absolutely positioned but we have\n // rendered it **after** the button. This pulls it back to sit on top\n // of the button.\n transform: 'translateX(-100%)',\n }}\n />\n );\n },\n);\n\n/* ---------------------------------------------------------------------------------------------- */\n\nfunction isFunction(value: unknown): value is (...args: any[]) => any {\n return typeof value === 'function';\n}\n\nfunction isIndeterminate(checked?: CheckedState): checked is 'indeterminate' {\n return checked === 'indeterminate';\n}\n\nfunction getState(checked: CheckedState) {\n return isIndeterminate(checked) ? 'indeterminate' : checked ? 'checked' : 'unchecked';\n}\n\nexport {\n createCheckboxScope,\n //\n Checkbox,\n CheckboxProvider,\n CheckboxTrigger,\n CheckboxIndicator,\n CheckboxBubbleInput,\n //\n Checkbox as Root,\n CheckboxProvider as Provider,\n CheckboxTrigger as Trigger,\n CheckboxIndicator as Indicator,\n CheckboxBubbleInput as BubbleInput,\n};\nexport type {\n CheckboxProps,\n CheckboxProviderProps,\n CheckboxTriggerProps,\n CheckboxIndicatorProps,\n CheckboxBubbleInputProps,\n CheckedState,\n};\n"], + "mappings": ";;;;;AAAA,YAAY,WAAW;AACvB,SAAS,uBAAuB;AAChC,SAAS,0BAA0B;AACnC,SAAS,4BAA4B;AACrC,SAAS,4BAA4B;AACrC,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AA2GtB,SAkIM,UAlIN,KAkIM,YAlIN;AAvGJ,IAAM,gBAAgB;AAGtB,IAAM,CAAC,uBAAuB,mBAAmB,IAAI,mBAAmB,aAAa;AA2BrF,IAAM,CAAC,sBAAsB,kBAAkB,IAC7C,sBAA4C,aAAa;AAkB3D,SAAS,iBACP,OACA;AACA,QAAM;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,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OAAO;AACjF,WACE;AAAA,MAAC,UAAU;AAAA,MAAV;AAAA,QACC,MAAK;AAAA,QACL,eAAW;AAAA,QACX,gBAAgB,kBAAkB,kBAAkB;AAAA,QACpD;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACC,GAAG;AAAA,QACJ,UAAU;AAAA,QACV,KAAK;AAAA,QACL,SAAS,qBAAqB,SAAS,CAAC,UAAU;AAIhD,cAAI,8BAA8B,SAAS;AACzC,kBAAM,gBAAgB;AAAA,UACxB;AAAA,QACF,CAAC;AAAA,QACD,OAAO;AAAA,UACL,GAAG,MAAM;AAAA,UACT,GAAG;AAAA,UACH,UAAU;AAAA,UACV,eAAe;AAAA,UACf,SAAS;AAAA,UACT,QAAQ;AAAA;AAAA;AAAA;AAAA,UAIR,WAAW;AAAA,QACb;AAAA;AAAA,IACF;AAAA,EAEJ,GAvHA;AAwHF;AAIA,SAAS,WAAW,OAAkD;AACpE,SAAO,OAAO,UAAU;AAC1B;AAFS;AAIT,SAAS,gBAAgB,SAAoD;AAC3E,SAAO,YAAY;AACrB;AAFS;AAIT,SAAS,SAAS,SAAuB;AACvC,SAAO,gBAAgB,OAAO,IAAI,kBAAkB,UAAU,YAAY;AAC5E;AAFS;", + "names": ["CheckboxTrigger", "Checkbox", "CheckboxIndicator", "CheckboxBubbleInput"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-checkbox/package.json b/e-commerce/node_modules/@radix-ui/react-checkbox/package.json new file mode 100644 index 0000000000000000000000000000000000000000..ad5fc60476bfe0b85e9f5bd8c984ac6ed2d0db56 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-checkbox/package.json @@ -0,0 +1,74 @@ +{ + "name": "@radix-ui/react-checkbox", + "version": "1.4.0", + "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.2.0", + "@radix-ui/react-compose-refs": "1.1.5", + "@radix-ui/react-context": "1.3.0", + "@radix-ui/react-presence": "1.1.11", + "@radix-ui/react-primitive": "2.2.0", + "@radix-ui/react-use-controllable-state": "1.3.0", + "@radix-ui/react-use-size": "1.1.5" + }, + "devDependencies": { + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "react": "^19.3.0", + "react-dom": "^19.3.0", + "typescript": "^5.9.3", + "@repo/builder": "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", + "directory": "packages/react/checkbox" + }, + "bugs": { + "url": "https://github.com/radix-ui/primitives/issues" + }, + "scripts": { + "lint": "oxlint --max-warnings 0 src", + "clean": "rm -rf dist", + "reset": "rm -rf dist node_modules", + "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" + } + } + } +} \ No newline at end of file diff --git a/e-commerce/node_modules/@radix-ui/react-collection/LICENSE b/e-commerce/node_modules/@radix-ui/react-collection/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a18858fb7b014098cba85703e66609be66a26ef5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-collection/LICENSE @@ -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. diff --git a/e-commerce/node_modules/@radix-ui/react-collection/README.md b/e-commerce/node_modules/@radix-ui/react-collection/README.md new file mode 100644 index 0000000000000000000000000000000000000000..0b031dc63ea39c02410ffb5e252a9c8e9a5df75b --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-collection/README.md @@ -0,0 +1,3 @@ +# `react-collection` + +This is an internal utility, not intended for public usage. diff --git a/e-commerce/node_modules/@radix-ui/react-collection/dist/index.d.mts b/e-commerce/node_modules/@radix-ui/react-collection/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..bb3b8c559f9925ecda01a5223f2b2feee1056690 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-collection/dist/index.d.mts @@ -0,0 +1,134 @@ +import * as _radix_ui_react_context from '@radix-ui/react-context'; +import * as React from 'react'; +import { Slot } from '@radix-ui/react-slot'; + +type SlotProps$1 = React.ComponentPropsWithoutRef; +interface CollectionProps extends SlotProps$1 { + scope: any; +} +declare function createCollection$1(name: string): readonly [{ + readonly Provider: React.FC<{ + children?: React.ReactNode | undefined; + scope: any; + }>; + readonly Slot: React.ForwardRefExoticComponent>; + readonly ItemSlot: React.ForwardRefExoticComponent & React.RefAttributes>; +}, (scope: any) => () => ({ + ref: React.RefObject; +} & ItemData)[], _radix_ui_react_context.CreateScope]; + +declare class OrderedDict extends Map { + #private; + constructor(iterable?: Iterable | null | undefined); + set(key: K, value: V): this; + /** + * Sets a key-value pair so that it ends up at the given index. + * - Existing keys are moved + * - Negative indices count from the end of the resulting dictionary, so + * inserting at -1 makes the item the last one, -2 the second to last, etc. + * - Out-of-range indices are clamped + */ + insert(index: number, key: K, value: V): this; + with(index: number, key: K, value: V): OrderedDict; + 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) => boolean, thisArg?: any): [K, V] | undefined; + findIndex(predicate: (entry: [K, V], index: number, dictionary: OrderedDict) => boolean, thisArg?: any): number; + filter(predicate: (entry: [K, V], index: number, dict: OrderedDict) => entry is [KK, VV], thisArg?: any): OrderedDict; + filter(predicate: (entry: [K, V], index: number, dictionary: OrderedDict) => unknown, thisArg?: any): OrderedDict; + map(callbackfn: (entry: [K, V], index: number, dictionary: OrderedDict) => U, thisArg?: any): OrderedDict; + reduce(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict) => [K, V]): [K, V]; + reduce(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict) => [K, V], initialValue: [K, V]): [K, V]; + reduce(callbackfn: (previousValue: U, currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict) => U, initialValue: U): U; + reduceRight(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict) => [K, V]): [K, V]; + reduceRight(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict) => [K, V], initialValue: [K, V]): [K, V]; + reduceRight(callbackfn: (previousValue: U, currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict) => U, initialValue: U): U; + /** + * Sorts the dictionary in place. This method mutates the dictionary and + * returns a reference to the same object + * + * @param compareFn Function used to determine the order of the elements. It + * is expected to return a negative value if the first argument is less than + * the second argument, zero if they're equal, and a positive value otherwise. + */ + sort(compareFn: (a: [K, V], b: [K, V]) => number): OrderedDict; + /** + * Returns a copy of the dictionary with its elements sorted. + * + * @param compareFn Function used to determine the order of the elements. It + * is expected to return a negative value if the first argument is less than + * the second argument, zero if they're equal, and a positive value otherwise. + */ + toSorted(compareFn: (a: [K, V], b: [K, V]) => number): OrderedDict; + toReversed(): OrderedDict; + toSpliced(start: number, deleteCount?: number): OrderedDict; + toSpliced(start: number, deleteCount: number, ...items: [K, V][]): OrderedDict; + slice(start?: number, end?: number): OrderedDict; + every(predicate: (entry: [K, V], index: number, dictionary: OrderedDict) => unknown, thisArg?: any): boolean; + some(predicate: (entry: [K, V], index: number, dictionary: OrderedDict) => unknown, thisArg?: any): boolean; +} +type ReadOnlyOrderedDict = Omit, 'set' | 'insert' | 'setBefore' | 'setAfter' | 'clear' | 'delete' | 'deleteAt' | 'sort'>; + +type SlotProps = React.ComponentPropsWithoutRef; +interface CollectionSlotProps extends SlotProps { + scope: any; +} +interface BaseItemData { + id?: string | undefined; +} +type ItemDataWithElement = ItemData & { + element: ItemElement; +}; +type BaseCollectionDict = OrderedDict>; +type CollectionDict = ReadOnlyOrderedDict>; +/** + * Creates a collection that tracks its items in document order and exposes them + * during render via `useCollection`. + * + * Item data passed to `ItemSlot` (every prop other than `scope` and `children`) + * must be referentially stable across renders. It is compared shallowly, and any + * change re-registers the item and replaces the item map. Memoize objects, + * arrays and callbacks with `useMemo` / `useCallback`, or define them outside of + * render. + */ +declare function createCollection(name: string): readonly [{ + readonly Provider: React.FC<{ + children?: React.ReactNode | undefined; + scope: any; + state?: [ItemMap: BaseCollectionDict, SetItemMap: React.Dispatch>>] | undefined; + }>; + readonly Slot: React.ForwardRefExoticComponent>; + readonly ItemSlot: React.ForwardRefExoticComponent & React.RefAttributes>; +}, { + createCollectionScope: _radix_ui_react_context.CreateScope; + useCollection: (scope: any) => CollectionDict; + useGetCollection: (scope: any) => () => CollectionDict; + useInitCollection: () => [BaseCollectionDict, React.Dispatch>>]; +}]; + +export { type CollectionProps, createCollection$1 as createCollection, type CollectionDict as unstable_CollectionDict, type CollectionSlotProps as unstable_CollectionSlotProps, createCollection as unstable_createCollection }; diff --git a/e-commerce/node_modules/@radix-ui/react-collection/dist/index.d.ts b/e-commerce/node_modules/@radix-ui/react-collection/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bb3b8c559f9925ecda01a5223f2b2feee1056690 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-collection/dist/index.d.ts @@ -0,0 +1,134 @@ +import * as _radix_ui_react_context from '@radix-ui/react-context'; +import * as React from 'react'; +import { Slot } from '@radix-ui/react-slot'; + +type SlotProps$1 = React.ComponentPropsWithoutRef; +interface CollectionProps extends SlotProps$1 { + scope: any; +} +declare function createCollection$1(name: string): readonly [{ + readonly Provider: React.FC<{ + children?: React.ReactNode | undefined; + scope: any; + }>; + readonly Slot: React.ForwardRefExoticComponent>; + readonly ItemSlot: React.ForwardRefExoticComponent & React.RefAttributes>; +}, (scope: any) => () => ({ + ref: React.RefObject; +} & ItemData)[], _radix_ui_react_context.CreateScope]; + +declare class OrderedDict extends Map { + #private; + constructor(iterable?: Iterable | null | undefined); + set(key: K, value: V): this; + /** + * Sets a key-value pair so that it ends up at the given index. + * - Existing keys are moved + * - Negative indices count from the end of the resulting dictionary, so + * inserting at -1 makes the item the last one, -2 the second to last, etc. + * - Out-of-range indices are clamped + */ + insert(index: number, key: K, value: V): this; + with(index: number, key: K, value: V): OrderedDict; + 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) => boolean, thisArg?: any): [K, V] | undefined; + findIndex(predicate: (entry: [K, V], index: number, dictionary: OrderedDict) => boolean, thisArg?: any): number; + filter(predicate: (entry: [K, V], index: number, dict: OrderedDict) => entry is [KK, VV], thisArg?: any): OrderedDict; + filter(predicate: (entry: [K, V], index: number, dictionary: OrderedDict) => unknown, thisArg?: any): OrderedDict; + map(callbackfn: (entry: [K, V], index: number, dictionary: OrderedDict) => U, thisArg?: any): OrderedDict; + reduce(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict) => [K, V]): [K, V]; + reduce(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict) => [K, V], initialValue: [K, V]): [K, V]; + reduce(callbackfn: (previousValue: U, currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict) => U, initialValue: U): U; + reduceRight(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict) => [K, V]): [K, V]; + reduceRight(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict) => [K, V], initialValue: [K, V]): [K, V]; + reduceRight(callbackfn: (previousValue: U, currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict) => U, initialValue: U): U; + /** + * Sorts the dictionary in place. This method mutates the dictionary and + * returns a reference to the same object + * + * @param compareFn Function used to determine the order of the elements. It + * is expected to return a negative value if the first argument is less than + * the second argument, zero if they're equal, and a positive value otherwise. + */ + sort(compareFn: (a: [K, V], b: [K, V]) => number): OrderedDict; + /** + * Returns a copy of the dictionary with its elements sorted. + * + * @param compareFn Function used to determine the order of the elements. It + * is expected to return a negative value if the first argument is less than + * the second argument, zero if they're equal, and a positive value otherwise. + */ + toSorted(compareFn: (a: [K, V], b: [K, V]) => number): OrderedDict; + toReversed(): OrderedDict; + toSpliced(start: number, deleteCount?: number): OrderedDict; + toSpliced(start: number, deleteCount: number, ...items: [K, V][]): OrderedDict; + slice(start?: number, end?: number): OrderedDict; + every(predicate: (entry: [K, V], index: number, dictionary: OrderedDict) => unknown, thisArg?: any): boolean; + some(predicate: (entry: [K, V], index: number, dictionary: OrderedDict) => unknown, thisArg?: any): boolean; +} +type ReadOnlyOrderedDict = Omit, 'set' | 'insert' | 'setBefore' | 'setAfter' | 'clear' | 'delete' | 'deleteAt' | 'sort'>; + +type SlotProps = React.ComponentPropsWithoutRef; +interface CollectionSlotProps extends SlotProps { + scope: any; +} +interface BaseItemData { + id?: string | undefined; +} +type ItemDataWithElement = ItemData & { + element: ItemElement; +}; +type BaseCollectionDict = OrderedDict>; +type CollectionDict = ReadOnlyOrderedDict>; +/** + * Creates a collection that tracks its items in document order and exposes them + * during render via `useCollection`. + * + * Item data passed to `ItemSlot` (every prop other than `scope` and `children`) + * must be referentially stable across renders. It is compared shallowly, and any + * change re-registers the item and replaces the item map. Memoize objects, + * arrays and callbacks with `useMemo` / `useCallback`, or define them outside of + * render. + */ +declare function createCollection(name: string): readonly [{ + readonly Provider: React.FC<{ + children?: React.ReactNode | undefined; + scope: any; + state?: [ItemMap: BaseCollectionDict, SetItemMap: React.Dispatch>>] | undefined; + }>; + readonly Slot: React.ForwardRefExoticComponent>; + readonly ItemSlot: React.ForwardRefExoticComponent & React.RefAttributes>; +}, { + createCollectionScope: _radix_ui_react_context.CreateScope; + useCollection: (scope: any) => CollectionDict; + useGetCollection: (scope: any) => () => CollectionDict; + useInitCollection: () => [BaseCollectionDict, React.Dispatch>>]; +}]; + +export { type CollectionProps, createCollection$1 as createCollection, type CollectionDict as unstable_CollectionDict, type CollectionSlotProps as unstable_CollectionSlotProps, createCollection as unstable_createCollection }; diff --git a/e-commerce/node_modules/@radix-ui/react-collection/dist/index.js b/e-commerce/node_modules/@radix-ui/react-collection/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..57f8fe9300517039740ac9b7108ac2f323a3ac0f --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-collection/dist/index.js @@ -0,0 +1,681 @@ +"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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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 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"); +// @__NO_SIDE_EFFECTS__ +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 = /* @__PURE__ */ __name((props) => { + const { scope, children } = props; + const ref = React.useRef(null); + const itemMap = React.useRef(/* @__PURE__ */ new Map()).current; + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children }); + }, "CollectionProvider"); + CollectionProvider.displayName = PROVIDER_NAME; + const COLLECTION_SLOT_NAME = name + "CollectionSlot"; + const CollectionSlotImpl = (0, import_react_slot.createSlot)(COLLECTION_SLOT_NAME); + const CollectionSlot = React.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 = React.forwardRef( + (props, forwardedRef) => { + const { scope, children, ...itemData } = props; + const ref = React.useRef(null); + const composedRefs = (0, import_react_compose_refs.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__ */ (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 = 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; + } + __name(useCollection, "useCollection"); + return [ + { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot }, + useCollection, + createCollectionScope + ]; +} +__name(createCollection, "createCollection"); + +// src/collection.tsx +var 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"); +var import_react_use_layout_effect = require("@radix-ui/react-use-layout-effect"); + +// src/ordered-dictionary.ts +var __instanciated = /* @__PURE__ */ new WeakMap(); +var OrderedDict = class _OrderedDict extends Map { + static { + __name(this, "OrderedDict"); + } + #keys; + constructor(entries) { + super(entries); + this.#keys = [...super.keys()]; + __instanciated.set(this, true); + } + set(key, value) { + if (__instanciated.get(this) && !this.has(key)) { + this.#keys.push(key); + } + super.set(key, value); + return this; + } + /** + * Sets a key-value pair so that it ends up at the given index. + * - Existing keys are moved + * - Negative indices count from the end of the resulting dictionary, so + * inserting at -1 makes the item the last one, -2 the second to last, etc. + * - Out-of-range indices are clamped + */ + insert(index, key, value) { + const has = this.has(key); + const finalSize = has ? this.size : this.size + 1; + const relativeIndex = toSafeInteger(index); + const targetIndex = relativeIndex >= 0 ? Math.min(relativeIndex, finalSize - 1) : Math.max(finalSize + relativeIndex, 0); + if (has ? this.#keys.indexOf(key) === targetIndex : targetIndex === this.size) { + this.set(key, value); + return this; + } + const keys = this.#keys.filter((existingKey) => existingKey !== key); + keys.splice(targetIndex, 0, key); + const entries = keys.map((entryKey) => [ + entryKey, + entryKey === key ? value : this.get(entryKey) + ]); + this.clear(); + for (const [entryKey, entryValue] of entries) { + this.set(entryKey, entryValue); + } + 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; + } + const currentIndex = this.#keys.indexOf(newKey); + const targetIndex = currentIndex !== -1 && currentIndex < index ? index - 1 : index; + return this.insert(targetIndex, 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; + } + const currentIndex = this.#keys.indexOf(newKey); + const targetIndex = currentIndex !== -1 && currentIndex <= index ? index : index + 1; + return this.insert(targetIndex, 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; + const hasInitialValue = args.length > 1; + if (!hasInitialValue && this.size === 0) { + throw new TypeError("Reduce of empty OrderedDict with no initial value"); + } + let index = 0; + let accumulator = initialValue; + for (const entry of this) { + if (index === 0 && !hasInitialValue) { + accumulator = entry; + } else { + accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]); + } + index++; + } + return accumulator; + } + reduceRight(...args) { + const [callbackfn, initialValue] = args; + const hasInitialValue = args.length > 1; + if (!hasInitialValue && this.size === 0) { + throw new TypeError("Reduce of empty OrderedDict with no initial value"); + } + let accumulator = initialValue; + for (let index = this.size - 1; index >= 0; index--) { + const entry = this.entryAt(index); + if (index === this.size - 1 && !hasInitialValue) { + accumulator = entry; + } else { + accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]); + } + } + return accumulator; + } + /** + * Sorts the dictionary in place. This method mutates the dictionary and + * returns a reference to the same object + * + * @param compareFn Function used to determine the order of the elements. It + * is expected to return a negative value if the first argument is less than + * the second argument, zero if they're equal, and a positive value otherwise. + */ + sort(compareFn) { + if (typeof compareFn !== "function") { + throw new TypeError(`OrderedDict.sort requires a compare function`); + } + const entries = [...this.entries()].sort(compareFn); + this.clear(); + for (const [key, value] of entries) { + this.set(key, value); + } + return this; + } + /** + * Returns a copy of the dictionary with its elements sorted. + * + * @param compareFn Function used to determine the order of the elements. It + * is expected to return a negative value if the first argument is less than + * the second argument, zero if they're equal, and a positive value otherwise. + */ + toSorted(compareFn) { + if (typeof compareFn !== "function") { + throw new TypeError(`OrderedDict.toSorted requires a compare function`); + } + 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(); + for (const key of this.#keys.slice(start, end)) { + result.set(key, this.get(key)); + } + 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]; +} +__name(at, "at"); +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; +} +__name(toSafeIndex, "toSafeIndex"); +function toSafeInteger(number) { + return number !== number || number === 0 ? 0 : Math.trunc(number); +} +__name(toSafeInteger, "toSafeInteger"); + +// src/collection.tsx +var import_jsx_runtime2 = require("react/jsx-runtime"); +// @__NO_SIDE_EFFECTS__ +function createCollection2(name) { + const PROVIDER_NAME = name + "CollectionProvider"; + const [createCollectionContext, createCollectionScope] = (0, import_react_context2.createContextScope)(PROVIDER_NAME); + const [CollectionStableContextProvider, useStableCollectionContext] = createCollectionContext(PROVIDER_NAME); + CollectionStableContextProvider.displayName = name + "CollectionStableContextProvider"; + const [CollectionStatefulContextProvider, useStatefulCollectionContext] = createCollectionContext(PROVIDER_NAME); + CollectionStatefulContextProvider.displayName = name + "CollectionStatefulContextProvider"; + const CollectionProvider = /* @__PURE__ */ __name(({ state, ...props }) => { + return state ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CollectionInit, { ...props }); + }, "CollectionProvider"); + CollectionProvider.displayName = PROVIDER_NAME; + const CollectionInit = /* @__PURE__ */ __name((props) => { + const state = useInitCollection(); + return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CollectionProviderImpl, { ...props, state }); + }, "CollectionInit"); + CollectionInit.displayName = name + "CollectionInit"; + const CollectionProviderImpl = /* @__PURE__ */ __name((props) => { + const { scope, children, state } = props; + const ref = React2.useRef(null); + const [collectionElement, setCollectionElement] = React2.useState( + null + ); + const composeRefs = (0, import_react_compose_refs2.useComposedRefs)(ref, setCollectionElement); + const [collection, setCollection] = state; + const registryRef = React2.useRef( + new OrderedDict() + ); + const getCollection = React2.useCallback(() => { + const registry = registryRef.current; + if (!isInDocumentOrder(registry)) { + registry.sort(sortByDocumentPosition); + } + return registry; + }, []); + React2.useEffect(() => { + if (!collectionElement) { + return; + } + const observer = getChildListObserver(() => { + setCollection((map) => { + const sorted = map.toSorted(sortByDocumentPosition); + const orderChanged = sorted.some(([key], index) => map.keyAt(index) !== key); + return orderChanged ? sorted : map; + }); + }); + observer.observe(collectionElement, { + childList: true, + subtree: true + }); + return () => { + observer.disconnect(); + }; + }, [collectionElement, setCollection]); + return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( + CollectionStableContextProvider, + { + scope, + collectionElementRef: composeRefs, + collectionElementRefObject: ref, + getCollection, + setCollection, + registryRef, + children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( + CollectionStatefulContextProvider, + { + scope, + collectionElement, + collection, + children + } + ) + } + ); + }, "CollectionProviderImpl"); + CollectionProviderImpl.displayName = name + "CollectionProviderImpl"; + const COLLECTION_SLOT_NAME = name + "CollectionSlot"; + const CollectionSlotImpl = (0, import_react_slot2.createSlot)(COLLECTION_SLOT_NAME); + const CollectionSlot = React2.forwardRef( + (props, forwardedRef) => { + const { scope, children } = props; + const context = useStableCollectionContext(COLLECTION_SLOT_NAME, scope); + const composedRefs = (0, import_react_compose_refs2.useComposedRefs)(forwardedRef, context.collectionElementRef); + 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 = React2.forwardRef( + (props, forwardedRef) => { + const { scope, children, ...itemData } = props; + const ref = React2.useRef(null); + const context = useStableCollectionContext(ITEM_SLOT_NAME, scope); + const { setCollection, registryRef } = context; + const itemDataRef = React2.useRef(itemData); + if (!shallowEqual(itemDataRef.current, itemData)) { + itemDataRef.current = itemData; + } + const memoizedItemData = itemDataRef.current; + const registerElement = React2.useCallback( + (node) => { + const registry = registryRef.current; + if (node) { + registry.set(node, { + ...itemDataRef.current, + element: node + }); + } else if (ref.current) { + registry.delete(ref.current); + } + }, + [registryRef] + ); + const composedRefs = (0, import_react_compose_refs2.useComposedRefs)(forwardedRef, registerElement, ref); + (0, import_react_use_layout_effect.useLayoutEffect)(() => { + const node = ref.current; + const registry = registryRef.current; + if (node && registry.has(node)) { + registry.set(node, { ...memoizedItemData, element: node }); + } + }, [memoizedItemData, registryRef]); + const registeredRef = React2.useRef(null); + React2.useEffect(() => { + const element = ref.current; + const registered = registeredRef.current; + if ((registered?.element ?? null) === element && (!element || registered?.itemData === memoizedItemData)) { + return; + } + registeredRef.current = element ? { element, itemData: memoizedItemData } : null; + setCollection((map) => { + const next = new OrderedDict(map); + if (registered && registered.element !== element) { + next.delete(registered.element); + } + if (element) { + next.set(element, { ...memoizedItemData, element }); + } + return next.sort(sortByDocumentPosition); + }); + }); + React2.useEffect(() => { + return () => { + const registered = registeredRef.current; + registeredRef.current = null; + if (!registered) { + return; + } + setCollection((map) => { + if (!map.has(registered.element)) { + return map; + } + const next = new OrderedDict(map); + next.delete(registered.element); + return next; + }); + }; + }, [setCollection]); + return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children }); + } + ); + CollectionItemSlot.displayName = ITEM_SLOT_NAME; + function useInitCollection() { + return React2.useState(new OrderedDict()); + } + __name(useInitCollection, "useInitCollection"); + function useCollection(scope) { + const { collection } = useStatefulCollectionContext(name + "CollectionConsumer", scope); + return collection; + } + __name(useCollection, "useCollection"); + function useGetCollection(scope) { + const { getCollection } = useStableCollectionContext(name + "CollectionConsumer", scope); + return getCollection; + } + __name(useGetCollection, "useGetCollection"); + const functions = { + createCollectionScope, + useCollection, + useGetCollection, + useInitCollection + }; + return [ + { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot }, + functions + ]; +} +__name(createCollection2, "createCollection"); +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; +} +__name(shallowEqual, "shallowEqual"); +function isElementPreceding(a, b) { + return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING); +} +__name(isElementPreceding, "isElementPreceding"); +function isInDocumentOrder(dict) { + let previous; + for (const element of dict.keys()) { + if (previous) { + const position = previous.compareDocumentPosition(element); + if (!(position & Node.DOCUMENT_POSITION_DISCONNECTED) && position & Node.DOCUMENT_POSITION_PRECEDING) { + return false; + } + } + previous = element; + } + return true; +} +__name(isInDocumentOrder, "isInDocumentOrder"); +function sortByDocumentPosition(a, b) { + return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1; +} +__name(sortByDocumentPosition, "sortByDocumentPosition"); +function getChildListObserver(callback) { + const observer = new MutationObserver((mutationsList) => { + for (const mutation of mutationsList) { + if (mutation.type === "childList") { + callback(); + return; + } + } + }); + return observer; +} +__name(getChildListObserver, "getChildListObserver"); +//# sourceMappingURL=index.js.map diff --git a/e-commerce/node_modules/@radix-ui/react-collection/dist/index.js.map b/e-commerce/node_modules/@radix-ui/react-collection/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..1bd2ffc5349756b89f71db9180a6f9cb09483a74 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-collection/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts", "../src/collection-legacy.tsx", "../src/collection.tsx", "../src/ordered-dictionary.ts"], + "sourcesContent": ["'use client';\nexport { createCollection } from './collection-legacy';\nexport type { CollectionProps } from './collection-legacy';\n\nexport { createCollection as unstable_createCollection } from './collection';\nexport type {\n CollectionSlotProps as unstable_CollectionSlotProps,\n CollectionDict as unstable_CollectionDict,\n} from './collection';\n", "import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createSlot, type Slot } from '@radix-ui/react-slot';\n\ntype SlotProps = React.ComponentPropsWithoutRef;\ntype CollectionElement = HTMLElement;\ninterface CollectionProps extends SlotProps {\n scope: any;\n}\n\n// We have resorted to returning slots directly rather than exposing primitives that can then\n// be slotted like `\u2026`.\n// This is because we encountered issues with generic types that cannot be statically analysed\n// due to creating them dynamically via createCollection.\n\n/* @__NO_SIDE_EFFECTS__ */ function createCollection<\n ItemElement extends HTMLElement,\n ItemData = {},\n>(name: string) {\n /* -----------------------------------------------------------------------------------------------\n * CollectionProvider\n * ---------------------------------------------------------------------------------------------*/\n\n const PROVIDER_NAME = name + 'CollectionProvider';\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n\n type ContextValue = {\n collectionRef: React.RefObject;\n itemMap: Map<\n React.RefObject,\n { ref: React.RefObject } & ItemData\n >;\n };\n\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: new Map() },\n );\n\n const CollectionProvider: React.FC<{ children?: React.ReactNode | undefined; scope: any }> = (\n props,\n ) => {\n const { scope, children } = props;\n const ref = React.useRef(null);\n const itemMap = React.useRef(new Map()).current;\n return (\n \n {children}\n \n );\n };\n\n CollectionProvider.displayName = PROVIDER_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionSlot\n * ---------------------------------------------------------------------------------------------*/\n\n const COLLECTION_SLOT_NAME = name + 'CollectionSlot';\n\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return {children};\n },\n );\n\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionItem\n * ---------------------------------------------------------------------------------------------*/\n\n const ITEM_SLOT_NAME = name + 'CollectionItemSlot';\n const ITEM_DATA_ATTR = 'data-radix-collection-item';\n\n type CollectionItemSlotProps = ItemData & {\n children: React.ReactNode;\n scope: any;\n };\n\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...(itemData as unknown as ItemData) });\n return () => void context.itemMap.delete(ref);\n });\n\n return (\n \n {children}\n \n );\n },\n );\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useCollection(scope: any) {\n const context = useCollectionContext(name + 'CollectionConsumer', scope);\n\n const getItems = React.useCallback(() => {\n const collectionNode = context.collectionRef.current;\n if (!collectionNode) return [];\n const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));\n const items = Array.from(context.itemMap.values());\n const orderedItems = items.sort(\n (a, b) => orderedNodes.indexOf(a.ref.current!) - orderedNodes.indexOf(b.ref.current!),\n );\n return orderedItems;\n }, [context.collectionRef, context.itemMap]);\n\n return getItems;\n }\n\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope,\n ] as const;\n}\n\nexport { createCollection };\nexport type { CollectionProps };\n", "import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createSlot, type Slot } from '@radix-ui/react-slot';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport type { EntryOf } from './ordered-dictionary';\nimport { OrderedDict, type ReadOnlyOrderedDict } from './ordered-dictionary';\n\ntype SlotProps = React.ComponentPropsWithoutRef;\ntype CollectionElement = HTMLElement;\ninterface CollectionSlotProps extends SlotProps {\n scope: any;\n}\n\ninterface BaseItemData {\n id?: string | undefined;\n}\n\ntype ItemDataWithElement<\n ItemData extends BaseItemData,\n ItemElement extends HTMLElement,\n> = ItemData & {\n element: ItemElement;\n};\n\ntype BaseCollectionDict<\n ItemElement extends HTMLElement,\n ItemData extends BaseItemData,\n> = OrderedDict>;\n\ntype CollectionDict = ReadOnlyOrderedDict<\n ItemElement,\n ItemDataWithElement\n>;\n\n/**\n * Creates a collection that tracks its items in document order and exposes them\n * during render via `useCollection`.\n *\n * Item data passed to `ItemSlot` (every prop other than `scope` and `children`)\n * must be referentially stable across renders. It is compared shallowly, and any\n * change re-registers the item and replaces the item map. Memoize objects,\n * arrays and callbacks with `useMemo` / `useCallback`, or define them outside of\n * render.\n */\n/* @__NO_SIDE_EFFECTS__ */ function createCollection<\n ItemElement extends HTMLElement,\n ItemData extends {} = {},\n>(name: string) {\n type AllItemData = ItemData & BaseItemData;\n /* -----------------------------------------------------------------------------------------------\n * CollectionProvider\n * ---------------------------------------------------------------------------------------------*/\n\n const PROVIDER_NAME = name + 'CollectionProvider';\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n\n interface CollectionStableContextValue {\n collectionElementRef: React.Ref;\n collectionElementRefObject: React.RefObject;\n setCollection: React.Dispatch<\n React.SetStateAction>\n >;\n getCollection: () => CollectionDict;\n registryRef: React.RefObject>;\n }\n\n interface CollectionStatefulContextValue {\n collectionElement: CollectionElement | null;\n collection: CollectionDict;\n }\n\n const [CollectionStableContextProvider, useStableCollectionContext] =\n createCollectionContext(PROVIDER_NAME);\n CollectionStableContextProvider.displayName = name + 'CollectionStableContextProvider';\n\n const [CollectionStatefulContextProvider, useStatefulCollectionContext] =\n createCollectionContext(PROVIDER_NAME);\n CollectionStatefulContextProvider.displayName = name + 'CollectionStatefulContextProvider';\n\n type CollectionState = [\n ItemMap: BaseCollectionDict,\n SetItemMap: React.Dispatch>>,\n ];\n\n const CollectionProvider: React.FC<{\n children?: React.ReactNode | undefined;\n scope: any;\n state?: CollectionState | undefined;\n }> = ({ state, ...props }) => {\n return state ? (\n \n ) : (\n \n );\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n\n const CollectionInit: React.FC<{\n children?: React.ReactNode | undefined;\n scope: any;\n }> = (props) => {\n const state = useInitCollection();\n return ;\n };\n CollectionInit.displayName = name + 'CollectionInit';\n\n const CollectionProviderImpl: React.FC<{\n children?: React.ReactNode | undefined;\n scope: any;\n state: CollectionState;\n }> = (props) => {\n const { scope, children, state } = props;\n const ref = React.useRef(null);\n const [collectionElement, setCollectionElement] = React.useState(\n null,\n );\n const composeRefs = useComposedRefs(ref, setCollectionElement);\n const [collection, setCollection] = state;\n\n // Written only during commit (from item ref callbacks and layout effects),\n // so it never includes items from renders that React discards.\n const registryRef = React.useRef>(\n new OrderedDict(),\n );\n const getCollection = React.useCallback(() => {\n const registry = registryRef.current;\n if (!isInDocumentOrder(registry)) {\n registry.sort(sortByDocumentPosition);\n }\n return registry;\n }, []);\n\n React.useEffect(() => {\n if (!collectionElement) {\n return;\n }\n\n const observer = getChildListObserver(() => {\n setCollection((map) => {\n const sorted = map.toSorted(sortByDocumentPosition);\n const orderChanged = sorted.some(([key], index) => map.keyAt(index) !== key);\n\n return orderChanged ? sorted : map;\n });\n });\n observer.observe(collectionElement, {\n childList: true,\n subtree: true,\n });\n return () => {\n observer.disconnect();\n };\n }, [collectionElement, setCollection]);\n\n return (\n \n \n {children}\n \n \n );\n };\n\n CollectionProviderImpl.displayName = name + 'CollectionProviderImpl';\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionSlot\n * ---------------------------------------------------------------------------------------------*/\n\n const COLLECTION_SLOT_NAME = name + 'CollectionSlot';\n\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useStableCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionElementRef);\n return {children};\n },\n );\n\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionItem\n * ---------------------------------------------------------------------------------------------*/\n\n const ITEM_SLOT_NAME = name + 'CollectionItemSlot';\n const ITEM_DATA_ATTR = 'data-radix-collection-item';\n\n type CollectionItemSlotProps = AllItemData & {\n children: React.ReactNode;\n scope: any;\n };\n\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n /**\n * Registers its child element as a collection item. Every prop other than\n * `scope` and `children` is item data and must be referentially stable across\n * renders (see `createCollection`).\n */\n const CollectionItemSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef(null);\n const context = useStableCollectionContext(ITEM_SLOT_NAME, scope);\n\n const { setCollection, registryRef } = context;\n\n const itemDataRef = React.useRef(itemData);\n if (!shallowEqual(itemDataRef.current, itemData)) {\n itemDataRef.current = itemData;\n }\n const memoizedItemData = itemDataRef.current;\n\n // TODO: Once React 19 is the minimum supported version, return a cleanup\n // function that unregisters `node` instead of handling `null`, which\n // depends on `ref.current` still holding the previous element.\n const registerElement = React.useCallback(\n (node: ItemElement | null) => {\n const registry = registryRef.current;\n if (node) {\n registry.set(node, {\n ...(itemDataRef.current as unknown as AllItemData),\n element: node,\n });\n } else if (ref.current) {\n registry.delete(ref.current);\n }\n },\n [registryRef],\n );\n const composedRefs = useComposedRefs(forwardedRef, registerElement, ref);\n\n useLayoutEffect(() => {\n const node = ref.current;\n const registry = registryRef.current;\n if (node && registry.has(node)) {\n registry.set(node, { ...(memoizedItemData as unknown as AllItemData), element: node });\n }\n }, [memoizedItemData, registryRef]);\n\n const registeredRef = React.useRef<{\n element: ItemElement;\n itemData: typeof memoizedItemData;\n } | null>(null);\n\n React.useEffect(() => {\n const element = ref.current;\n const registered = registeredRef.current;\n if (\n (registered?.element ?? null) === element &&\n (!element || registered?.itemData === memoizedItemData)\n ) {\n return;\n }\n\n registeredRef.current = element ? { element, itemData: memoizedItemData } : null;\n setCollection((map) => {\n const next = new OrderedDict(map);\n if (registered && registered.element !== element) {\n next.delete(registered.element);\n }\n if (element) {\n next.set(element, { ...(memoizedItemData as unknown as AllItemData), element });\n }\n return next.sort(sortByDocumentPosition);\n });\n });\n\n React.useEffect(() => {\n return () => {\n const registered = registeredRef.current;\n registeredRef.current = null;\n if (!registered) {\n return;\n }\n setCollection((map) => {\n if (!map.has(registered.element)) {\n return map;\n }\n const next = new OrderedDict(map);\n next.delete(registered.element);\n return next;\n });\n };\n }, [setCollection]);\n\n return (\n \n {children}\n \n );\n },\n );\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useInitCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useInitCollection() {\n return React.useState>(new OrderedDict());\n }\n\n /* -----------------------------------------------------------------------------------------------\n * useCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useCollection(scope: any) {\n const { collection } = useStatefulCollectionContext(name + 'CollectionConsumer', scope);\n return collection;\n }\n\n function useGetCollection(scope: any) {\n const { getCollection } = useStableCollectionContext(name + 'CollectionConsumer', scope);\n return getCollection;\n }\n\n const functions = {\n createCollectionScope,\n useCollection,\n useGetCollection,\n useInitCollection,\n };\n\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n functions,\n ] as const;\n}\n\nexport { createCollection };\nexport type { CollectionSlotProps, CollectionDict };\n\nfunction shallowEqual(a: any, b: any) {\n if (a === b) return true;\n if (typeof a !== 'object' || typeof b !== 'object') return false;\n if (a == null || b == null) return false;\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n if (keysA.length !== keysB.length) return false;\n for (const key of keysA) {\n if (!Object.prototype.hasOwnProperty.call(b, key)) return false;\n if (a[key] !== b[key]) return false;\n }\n return true;\n}\n\nfunction isElementPreceding(a: Element, b: Element) {\n return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);\n}\n\nfunction isInDocumentOrder(\n dict: BaseCollectionDict,\n) {\n let previous: Element | undefined;\n for (const element of dict.keys()) {\n if (previous) {\n const position = previous.compareDocumentPosition(element);\n if (\n !(position & Node.DOCUMENT_POSITION_DISCONNECTED) &&\n position & Node.DOCUMENT_POSITION_PRECEDING\n ) {\n return false;\n }\n }\n previous = element;\n }\n return true;\n}\n\nfunction sortByDocumentPosition(\n a: EntryOf>,\n b: EntryOf>,\n) {\n return !a[1].element || !b[1].element\n ? 0\n : isElementPreceding(a[1].element, b[1].element)\n ? -1\n : 1;\n}\n\nfunction getChildListObserver(callback: () => void) {\n const observer = new MutationObserver((mutationsList) => {\n for (const mutation of mutationsList) {\n if (mutation.type === 'childList') {\n callback();\n return;\n }\n }\n });\n\n return observer;\n}\n", "// Not a real member because it shouldn't be accessible, but the super class\n// calls `set` which needs to read the instanciation state, so it can't be a\n// private member.\nconst __instanciated = new WeakMap, boolean>();\nexport class OrderedDict extends Map {\n #keys: K[];\n\n constructor(iterable?: Iterable | null | undefined);\n constructor(entries?: readonly (readonly [K, V])[] | null) {\n super(entries);\n this.#keys = [...super.keys()];\n __instanciated.set(this, true);\n }\n\n set(key: K, value: V) {\n if (__instanciated.get(this) && !this.has(key)) {\n this.#keys.push(key);\n }\n super.set(key, value);\n return this;\n }\n\n /**\n * Sets a key-value pair so that it ends up at the given index.\n * - Existing keys are moved\n * - Negative indices count from the end of the resulting dictionary, so\n * inserting at -1 makes the item the last one, -2 the second to last, etc.\n * - Out-of-range indices are clamped\n */\n insert(index: number, key: K, value: V) {\n const has = this.has(key);\n const finalSize = has ? this.size : this.size + 1;\n const relativeIndex = toSafeInteger(index);\n const targetIndex =\n relativeIndex >= 0\n ? Math.min(relativeIndex, finalSize - 1)\n : Math.max(finalSize + relativeIndex, 0);\n\n if (has ? this.#keys.indexOf(key) === targetIndex : targetIndex === this.size) {\n this.set(key, value);\n return this;\n }\n\n const keys = this.#keys.filter((existingKey) => existingKey !== key);\n keys.splice(targetIndex, 0, key);\n const entries = keys.map((entryKey): [K, V] => [\n entryKey,\n entryKey === key ? value : this.get(entryKey)!,\n ]);\n this.clear();\n for (const [entryKey, entryValue] of entries) {\n this.set(entryKey, entryValue);\n }\n return this;\n }\n\n with(index: number, key: K, value: V) {\n const copy = new OrderedDict(this);\n copy.insert(index, key, value);\n return copy;\n }\n\n before(key: K) {\n const index = this.#keys.indexOf(key) - 1;\n if (index < 0) {\n return undefined;\n }\n return this.entryAt(index);\n }\n\n /**\n * Sets a new key-value pair at the position before the given key.\n */\n setBefore(key: K, newKey: K, value: V) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n const currentIndex = this.#keys.indexOf(newKey);\n const targetIndex = currentIndex !== -1 && currentIndex < index ? index - 1 : index;\n return this.insert(targetIndex, newKey, value);\n }\n\n after(key: K) {\n let index = this.#keys.indexOf(key);\n index = index === -1 || index === this.size - 1 ? -1 : index + 1;\n if (index === -1) {\n return undefined;\n }\n return this.entryAt(index);\n }\n\n /**\n * Sets a new key-value pair at the position after the given key.\n */\n setAfter(key: K, newKey: K, value: V) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n const currentIndex = this.#keys.indexOf(newKey);\n const targetIndex = currentIndex !== -1 && currentIndex <= index ? index : index + 1;\n return this.insert(targetIndex, newKey, value);\n }\n\n first() {\n return this.entryAt(0);\n }\n\n last() {\n return this.entryAt(-1);\n }\n\n clear() {\n this.#keys = [];\n return super.clear();\n }\n\n delete(key: K) {\n const deleted = super.delete(key);\n if (deleted) {\n this.#keys.splice(this.#keys.indexOf(key), 1);\n }\n return deleted;\n }\n\n deleteAt(index: number) {\n const key = this.keyAt(index);\n if (key !== undefined) {\n return this.delete(key);\n }\n return false;\n }\n\n at(index: number) {\n const key = at(this.#keys, index);\n if (key !== undefined) {\n return this.get(key);\n }\n }\n\n entryAt(index: number): [K, V] | undefined {\n const key = at(this.#keys, index);\n if (key !== undefined) {\n return [key, this.get(key)!];\n }\n }\n\n indexOf(key: K) {\n return this.#keys.indexOf(key);\n }\n\n keyAt(index: number) {\n return at(this.#keys, index);\n }\n\n from(key: K, offset: number) {\n const index = this.indexOf(key);\n if (index === -1) {\n return undefined;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.at(dest);\n }\n\n keyFrom(key: K, offset: number) {\n const index = this.indexOf(key);\n if (index === -1) {\n return undefined;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.keyAt(dest);\n }\n\n find(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict) => boolean,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return entry;\n }\n index++;\n }\n return undefined;\n }\n\n findIndex(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict) => boolean,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return index;\n }\n index++;\n }\n return -1;\n }\n\n filter(\n predicate: (entry: [K, V], index: number, dict: OrderedDict) => entry is [KK, VV],\n thisArg?: any,\n ): OrderedDict;\n\n filter(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict) => unknown,\n thisArg?: any,\n ): OrderedDict;\n\n filter(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict) => unknown,\n thisArg?: any,\n ) {\n const entries: Array<[K, V]> = [];\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n entries.push(entry);\n }\n index++;\n }\n return new OrderedDict(entries);\n }\n\n map(\n callbackfn: (entry: [K, V], index: number, dictionary: OrderedDict) => U,\n thisArg?: any,\n ): OrderedDict {\n const entries: [K, U][] = [];\n let index = 0;\n for (const entry of this) {\n entries.push([entry[0], Reflect.apply(callbackfn, thisArg, [entry, index, this])]);\n index++;\n }\n return new OrderedDict(entries);\n }\n\n reduce(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict,\n ) => [K, V],\n ): [K, V];\n reduce(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict,\n ) => [K, V],\n initialValue: [K, V],\n ): [K, V];\n reduce(\n callbackfn: (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict,\n ) => U,\n initialValue: U,\n ): U;\n\n reduce(\n ...args: [\n (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict,\n ) => U,\n U?,\n ]\n ) {\n const [callbackfn, initialValue] = args;\n const hasInitialValue = args.length > 1;\n if (!hasInitialValue && this.size === 0) {\n throw new TypeError('Reduce of empty OrderedDict with no initial value');\n }\n let index = 0;\n let accumulator = initialValue as U;\n for (const entry of this) {\n if (index === 0 && !hasInitialValue) {\n accumulator = entry as any;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n index++;\n }\n return accumulator;\n }\n\n reduceRight(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict,\n ) => [K, V],\n ): [K, V];\n reduceRight(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict,\n ) => [K, V],\n initialValue: [K, V],\n ): [K, V];\n reduceRight(\n callbackfn: (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict,\n ) => U,\n initialValue: U,\n ): U;\n\n reduceRight(\n ...args: [\n (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict,\n ) => U,\n U?,\n ]\n ) {\n const [callbackfn, initialValue] = args;\n const hasInitialValue = args.length > 1;\n if (!hasInitialValue && this.size === 0) {\n throw new TypeError('Reduce of empty OrderedDict with no initial value');\n }\n let accumulator = initialValue as U;\n for (let index = this.size - 1; index >= 0; index--) {\n const entry = this.entryAt(index)!;\n if (index === this.size - 1 && !hasInitialValue) {\n accumulator = entry as any;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n }\n return accumulator;\n }\n\n /**\n * Sorts the dictionary in place. This method mutates the dictionary and\n * returns a reference to the same object\n *\n * @param compareFn Function used to determine the order of the elements. It\n * is expected to return a negative value if the first argument is less than\n * the second argument, zero if they're equal, and a positive value otherwise.\n */\n sort(compareFn: (a: [K, V], b: [K, V]) => number): OrderedDict {\n if (typeof compareFn !== 'function') {\n throw new TypeError(`OrderedDict.sort requires a compare function`);\n }\n const entries = [...this.entries()].sort(compareFn);\n this.clear();\n for (const [key, value] of entries) {\n this.set(key, value);\n }\n return this;\n }\n\n /**\n * Returns a copy of the dictionary with its elements sorted.\n *\n * @param compareFn Function used to determine the order of the elements. It\n * is expected to return a negative value if the first argument is less than\n * the second argument, zero if they're equal, and a positive value otherwise.\n */\n toSorted(compareFn: (a: [K, V], b: [K, V]) => number): OrderedDict {\n if (typeof compareFn !== 'function') {\n throw new TypeError(`OrderedDict.toSorted requires a compare function`);\n }\n const entries = [...this.entries()].sort(compareFn);\n return new OrderedDict(entries);\n }\n\n toReversed(): OrderedDict {\n const reversed = new OrderedDict();\n for (let index = this.size - 1; index >= 0; index--) {\n const key = this.keyAt(index)!;\n const element = this.get(key)!;\n reversed.set(key, element);\n }\n return reversed;\n }\n\n toSpliced(start: number, deleteCount?: number): OrderedDict;\n toSpliced(start: number, deleteCount: number, ...items: [K, V][]): OrderedDict;\n\n toSpliced(...args: [start: number, deleteCount: number, ...items: [K, V][]]) {\n const entries = [...this.entries()];\n entries.splice(...args);\n return new OrderedDict(entries);\n }\n\n slice(start?: number, end?: number) {\n const result = new OrderedDict();\n for (const key of this.#keys.slice(start, end)) {\n result.set(key, this.get(key)!);\n }\n return result;\n }\n\n every(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict) => unknown,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (!Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return false;\n }\n index++;\n }\n return true;\n }\n\n some(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict) => unknown,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return true;\n }\n index++;\n }\n return false;\n }\n}\n\nexport type KeyOf> =\n D extends OrderedDict ? K : never;\nexport type ValueOf> =\n D extends OrderedDict ? V : never;\nexport type EntryOf> = [KeyOf, ValueOf];\nexport type KeyFrom> = E[0];\nexport type ValueFrom> = E[1];\n\nfunction at(array: ArrayLike, index: number): T | undefined {\n if ('at' in Array.prototype) {\n return Array.prototype.at.call(array, index);\n }\n const actualIndex = toSafeIndex(array, index);\n return actualIndex === -1 ? undefined : array[actualIndex];\n}\n\nfunction toSafeIndex(array: ArrayLike, index: number) {\n const length = array.length;\n const relativeIndex = toSafeInteger(index);\n const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n}\n\nfunction toSafeInteger(number: number) {\n // eslint-disable-next-line no-self-compare\n return number !== number || number === 0 ? 0 : Math.trunc(number);\n}\n\nexport type ReadOnlyOrderedDict = Omit<\n OrderedDict,\n 'set' | 'insert' | 'setBefore' | 'setAfter' | 'clear' | 'delete' | 'deleteAt' | 'sort'\n>;\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,mCAAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,2BAAmC;AACnC,gCAAgC;AAChC,wBAAsC;AA4ChC;AAAA;AA/BqB,SAAS,iBAGlC,MAAc;AAKd,QAAM,gBAAgB,OAAO;AAC7B,QAAM,CAAC,yBAAyB,qBAAqB,QAA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AACpB,MAAI,OAAO,MAAM,YAAY,OAAO,MAAM,SAAU,QAAO;AAC3D,MAAI,KAAK,QAAQ,KAAK,KAAM,QAAO;AACnC,QAAM,QAAQ,OAAO,KAAK,CAAC;AAC3B,QAAM,QAAQ,OAAO,KAAK,CAAC;AAC3B,MAAI,MAAM,WAAW,MAAM,OAAQ,QAAO;AAC1C,aAAW,OAAO,OAAO;AACvB,QAAI,CAAC,OAAO,UAAU,eAAe,KAAK,GAAG,GAAG,EAAG,QAAO;AAC1D,QAAI,EAAE,GAAG,MAAM,EAAE,GAAG,EAAG,QAAO;AAAA,EAChC;AACA,SAAO;AACT;AAZS;AAcT,SAAS,mBAAmB,GAAY,GAAY;AAClD,SAAO,CAAC,EAAE,EAAE,wBAAwB,CAAC,IAAI,KAAK;AAChD;AAFS;AAIT,SAAS,kBACP,MACA;AACA,MAAI;AACJ,aAAW,WAAW,KAAK,KAAK,GAAG;AACjC,QAAI,UAAU;AACZ,YAAM,WAAW,SAAS,wBAAwB,OAAO;AACzD,UACE,EAAE,WAAW,KAAK,mCAClB,WAAW,KAAK,6BAChB;AACA,eAAO;AAAA,MACT;AAAA,IACF;AACA,eAAW;AAAA,EACb;AACA,SAAO;AACT;AAjBS;AAmBT,SAAS,uBACP,GACA,GACA;AACA,SAAO,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,EAAE,CAAC,EAAE,UAC1B,IACA,mBAAmB,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,IAC3C,KACA;AACR;AATS;AAWT,SAAS,qBAAqB,UAAsB;AAClD,QAAM,WAAW,IAAI,iBAAiB,CAAC,kBAAkB;AACvD,eAAW,YAAY,eAAe;AACpC,UAAI,SAAS,SAAS,aAAa;AACjC,iBAAS;AACT;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AAED,SAAO;AACT;AAXS;", + "names": ["createCollection", "React", "import_react_context", "import_react_compose_refs", "import_react_slot", "import_jsx_runtime", "createCollection"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-collection/dist/index.mjs b/e-commerce/node_modules/@radix-ui/react-collection/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ff09a4e5b15fac4c160f63e47bc1c3f13ac38df6 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-collection/dist/index.mjs @@ -0,0 +1,650 @@ +"use client"; +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// src/collection-legacy.tsx +import * as 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"; +// @__NO_SIDE_EFFECTS__ +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 = /* @__PURE__ */ __name((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"); + 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; + } + __name(useCollection, "useCollection"); + return [ + { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot }, + useCollection, + createCollectionScope + ]; +} +__name(createCollection, "createCollection"); + +// src/collection.tsx +import * as 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"; +import { useLayoutEffect } from "@radix-ui/react-use-layout-effect"; + +// src/ordered-dictionary.ts +var __instanciated = /* @__PURE__ */ new WeakMap(); +var OrderedDict = class _OrderedDict extends Map { + static { + __name(this, "OrderedDict"); + } + #keys; + constructor(entries) { + super(entries); + this.#keys = [...super.keys()]; + __instanciated.set(this, true); + } + set(key, value) { + if (__instanciated.get(this) && !this.has(key)) { + this.#keys.push(key); + } + super.set(key, value); + return this; + } + /** + * Sets a key-value pair so that it ends up at the given index. + * - Existing keys are moved + * - Negative indices count from the end of the resulting dictionary, so + * inserting at -1 makes the item the last one, -2 the second to last, etc. + * - Out-of-range indices are clamped + */ + insert(index, key, value) { + const has = this.has(key); + const finalSize = has ? this.size : this.size + 1; + const relativeIndex = toSafeInteger(index); + const targetIndex = relativeIndex >= 0 ? Math.min(relativeIndex, finalSize - 1) : Math.max(finalSize + relativeIndex, 0); + if (has ? this.#keys.indexOf(key) === targetIndex : targetIndex === this.size) { + this.set(key, value); + return this; + } + const keys = this.#keys.filter((existingKey) => existingKey !== key); + keys.splice(targetIndex, 0, key); + const entries = keys.map((entryKey) => [ + entryKey, + entryKey === key ? value : this.get(entryKey) + ]); + this.clear(); + for (const [entryKey, entryValue] of entries) { + this.set(entryKey, entryValue); + } + 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; + } + const currentIndex = this.#keys.indexOf(newKey); + const targetIndex = currentIndex !== -1 && currentIndex < index ? index - 1 : index; + return this.insert(targetIndex, 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; + } + const currentIndex = this.#keys.indexOf(newKey); + const targetIndex = currentIndex !== -1 && currentIndex <= index ? index : index + 1; + return this.insert(targetIndex, 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; + const hasInitialValue = args.length > 1; + if (!hasInitialValue && this.size === 0) { + throw new TypeError("Reduce of empty OrderedDict with no initial value"); + } + let index = 0; + let accumulator = initialValue; + for (const entry of this) { + if (index === 0 && !hasInitialValue) { + accumulator = entry; + } else { + accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]); + } + index++; + } + return accumulator; + } + reduceRight(...args) { + const [callbackfn, initialValue] = args; + const hasInitialValue = args.length > 1; + if (!hasInitialValue && this.size === 0) { + throw new TypeError("Reduce of empty OrderedDict with no initial value"); + } + let accumulator = initialValue; + for (let index = this.size - 1; index >= 0; index--) { + const entry = this.entryAt(index); + if (index === this.size - 1 && !hasInitialValue) { + accumulator = entry; + } else { + accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]); + } + } + return accumulator; + } + /** + * Sorts the dictionary in place. This method mutates the dictionary and + * returns a reference to the same object + * + * @param compareFn Function used to determine the order of the elements. It + * is expected to return a negative value if the first argument is less than + * the second argument, zero if they're equal, and a positive value otherwise. + */ + sort(compareFn) { + if (typeof compareFn !== "function") { + throw new TypeError(`OrderedDict.sort requires a compare function`); + } + const entries = [...this.entries()].sort(compareFn); + this.clear(); + for (const [key, value] of entries) { + this.set(key, value); + } + return this; + } + /** + * Returns a copy of the dictionary with its elements sorted. + * + * @param compareFn Function used to determine the order of the elements. It + * is expected to return a negative value if the first argument is less than + * the second argument, zero if they're equal, and a positive value otherwise. + */ + toSorted(compareFn) { + if (typeof compareFn !== "function") { + throw new TypeError(`OrderedDict.toSorted requires a compare function`); + } + 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(); + for (const key of this.#keys.slice(start, end)) { + result.set(key, this.get(key)); + } + 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]; +} +__name(at, "at"); +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; +} +__name(toSafeIndex, "toSafeIndex"); +function toSafeInteger(number) { + return number !== number || number === 0 ? 0 : Math.trunc(number); +} +__name(toSafeInteger, "toSafeInteger"); + +// src/collection.tsx +import { jsx as jsx2 } from "react/jsx-runtime"; +// @__NO_SIDE_EFFECTS__ +function createCollection2(name) { + const PROVIDER_NAME = name + "CollectionProvider"; + const [createCollectionContext, createCollectionScope] = createContextScope2(PROVIDER_NAME); + const [CollectionStableContextProvider, useStableCollectionContext] = createCollectionContext(PROVIDER_NAME); + CollectionStableContextProvider.displayName = name + "CollectionStableContextProvider"; + const [CollectionStatefulContextProvider, useStatefulCollectionContext] = createCollectionContext(PROVIDER_NAME); + CollectionStatefulContextProvider.displayName = name + "CollectionStatefulContextProvider"; + const CollectionProvider = /* @__PURE__ */ __name(({ state, ...props }) => { + return state ? /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ jsx2(CollectionInit, { ...props }); + }, "CollectionProvider"); + CollectionProvider.displayName = PROVIDER_NAME; + const CollectionInit = /* @__PURE__ */ __name((props) => { + const state = useInitCollection(); + return /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state }); + }, "CollectionInit"); + CollectionInit.displayName = name + "CollectionInit"; + const CollectionProviderImpl = /* @__PURE__ */ __name((props) => { + const { scope, children, state } = props; + const ref = React2.useRef(null); + const [collectionElement, setCollectionElement] = React2.useState( + null + ); + const composeRefs = useComposedRefs2(ref, setCollectionElement); + const [collection, setCollection] = state; + const registryRef = React2.useRef( + new OrderedDict() + ); + const getCollection = React2.useCallback(() => { + const registry = registryRef.current; + if (!isInDocumentOrder(registry)) { + registry.sort(sortByDocumentPosition); + } + return registry; + }, []); + React2.useEffect(() => { + if (!collectionElement) { + return; + } + const observer = getChildListObserver(() => { + setCollection((map) => { + const sorted = map.toSorted(sortByDocumentPosition); + const orderChanged = sorted.some(([key], index) => map.keyAt(index) !== key); + return orderChanged ? sorted : map; + }); + }); + observer.observe(collectionElement, { + childList: true, + subtree: true + }); + return () => { + observer.disconnect(); + }; + }, [collectionElement, setCollection]); + return /* @__PURE__ */ jsx2( + CollectionStableContextProvider, + { + scope, + collectionElementRef: composeRefs, + collectionElementRefObject: ref, + getCollection, + setCollection, + registryRef, + children: /* @__PURE__ */ jsx2( + CollectionStatefulContextProvider, + { + scope, + collectionElement, + collection, + children + } + ) + } + ); + }, "CollectionProviderImpl"); + CollectionProviderImpl.displayName = name + "CollectionProviderImpl"; + const COLLECTION_SLOT_NAME = name + "CollectionSlot"; + const CollectionSlotImpl = createSlot2(COLLECTION_SLOT_NAME); + const CollectionSlot = React2.forwardRef( + (props, forwardedRef) => { + const { scope, children } = props; + const context = useStableCollectionContext(COLLECTION_SLOT_NAME, scope); + const composedRefs = useComposedRefs2(forwardedRef, context.collectionElementRef); + 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 context = useStableCollectionContext(ITEM_SLOT_NAME, scope); + const { setCollection, registryRef } = context; + const itemDataRef = React2.useRef(itemData); + if (!shallowEqual(itemDataRef.current, itemData)) { + itemDataRef.current = itemData; + } + const memoizedItemData = itemDataRef.current; + const registerElement = React2.useCallback( + (node) => { + const registry = registryRef.current; + if (node) { + registry.set(node, { + ...itemDataRef.current, + element: node + }); + } else if (ref.current) { + registry.delete(ref.current); + } + }, + [registryRef] + ); + const composedRefs = useComposedRefs2(forwardedRef, registerElement, ref); + useLayoutEffect(() => { + const node = ref.current; + const registry = registryRef.current; + if (node && registry.has(node)) { + registry.set(node, { ...memoizedItemData, element: node }); + } + }, [memoizedItemData, registryRef]); + const registeredRef = React2.useRef(null); + React2.useEffect(() => { + const element = ref.current; + const registered = registeredRef.current; + if ((registered?.element ?? null) === element && (!element || registered?.itemData === memoizedItemData)) { + return; + } + registeredRef.current = element ? { element, itemData: memoizedItemData } : null; + setCollection((map) => { + const next = new OrderedDict(map); + if (registered && registered.element !== element) { + next.delete(registered.element); + } + if (element) { + next.set(element, { ...memoizedItemData, element }); + } + return next.sort(sortByDocumentPosition); + }); + }); + React2.useEffect(() => { + return () => { + const registered = registeredRef.current; + registeredRef.current = null; + if (!registered) { + return; + } + setCollection((map) => { + if (!map.has(registered.element)) { + return map; + } + const next = new OrderedDict(map); + next.delete(registered.element); + return next; + }); + }; + }, [setCollection]); + return /* @__PURE__ */ jsx2(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children }); + } + ); + CollectionItemSlot.displayName = ITEM_SLOT_NAME; + function useInitCollection() { + return React2.useState(new OrderedDict()); + } + __name(useInitCollection, "useInitCollection"); + function useCollection(scope) { + const { collection } = useStatefulCollectionContext(name + "CollectionConsumer", scope); + return collection; + } + __name(useCollection, "useCollection"); + function useGetCollection(scope) { + const { getCollection } = useStableCollectionContext(name + "CollectionConsumer", scope); + return getCollection; + } + __name(useGetCollection, "useGetCollection"); + const functions = { + createCollectionScope, + useCollection, + useGetCollection, + useInitCollection + }; + return [ + { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot }, + functions + ]; +} +__name(createCollection2, "createCollection"); +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; +} +__name(shallowEqual, "shallowEqual"); +function isElementPreceding(a, b) { + return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING); +} +__name(isElementPreceding, "isElementPreceding"); +function isInDocumentOrder(dict) { + let previous; + for (const element of dict.keys()) { + if (previous) { + const position = previous.compareDocumentPosition(element); + if (!(position & Node.DOCUMENT_POSITION_DISCONNECTED) && position & Node.DOCUMENT_POSITION_PRECEDING) { + return false; + } + } + previous = element; + } + return true; +} +__name(isInDocumentOrder, "isInDocumentOrder"); +function sortByDocumentPosition(a, b) { + return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1; +} +__name(sortByDocumentPosition, "sortByDocumentPosition"); +function getChildListObserver(callback) { + const observer = new MutationObserver((mutationsList) => { + for (const mutation of mutationsList) { + if (mutation.type === "childList") { + callback(); + return; + } + } + }); + return observer; +} +__name(getChildListObserver, "getChildListObserver"); +export { + createCollection, + createCollection2 as unstable_createCollection +}; +//# sourceMappingURL=index.mjs.map diff --git a/e-commerce/node_modules/@radix-ui/react-collection/dist/index.mjs.map b/e-commerce/node_modules/@radix-ui/react-collection/dist/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..b26001efdf3a958640df939d45ed99fe525cb767 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-collection/dist/index.mjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/collection-legacy.tsx", "../src/collection.tsx", "../src/ordered-dictionary.ts"], + "sourcesContent": ["import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createSlot, type Slot } from '@radix-ui/react-slot';\n\ntype SlotProps = React.ComponentPropsWithoutRef;\ntype CollectionElement = HTMLElement;\ninterface CollectionProps extends SlotProps {\n scope: any;\n}\n\n// We have resorted to returning slots directly rather than exposing primitives that can then\n// be slotted like `\u2026`.\n// This is because we encountered issues with generic types that cannot be statically analysed\n// due to creating them dynamically via createCollection.\n\n/* @__NO_SIDE_EFFECTS__ */ function createCollection<\n ItemElement extends HTMLElement,\n ItemData = {},\n>(name: string) {\n /* -----------------------------------------------------------------------------------------------\n * CollectionProvider\n * ---------------------------------------------------------------------------------------------*/\n\n const PROVIDER_NAME = name + 'CollectionProvider';\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n\n type ContextValue = {\n collectionRef: React.RefObject;\n itemMap: Map<\n React.RefObject,\n { ref: React.RefObject } & ItemData\n >;\n };\n\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: new Map() },\n );\n\n const CollectionProvider: React.FC<{ children?: React.ReactNode | undefined; scope: any }> = (\n props,\n ) => {\n const { scope, children } = props;\n const ref = React.useRef(null);\n const itemMap = React.useRef(new Map()).current;\n return (\n \n {children}\n \n );\n };\n\n CollectionProvider.displayName = PROVIDER_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionSlot\n * ---------------------------------------------------------------------------------------------*/\n\n const COLLECTION_SLOT_NAME = name + 'CollectionSlot';\n\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return {children};\n },\n );\n\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionItem\n * ---------------------------------------------------------------------------------------------*/\n\n const ITEM_SLOT_NAME = name + 'CollectionItemSlot';\n const ITEM_DATA_ATTR = 'data-radix-collection-item';\n\n type CollectionItemSlotProps = ItemData & {\n children: React.ReactNode;\n scope: any;\n };\n\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...(itemData as unknown as ItemData) });\n return () => void context.itemMap.delete(ref);\n });\n\n return (\n \n {children}\n \n );\n },\n );\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useCollection(scope: any) {\n const context = useCollectionContext(name + 'CollectionConsumer', scope);\n\n const getItems = React.useCallback(() => {\n const collectionNode = context.collectionRef.current;\n if (!collectionNode) return [];\n const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));\n const items = Array.from(context.itemMap.values());\n const orderedItems = items.sort(\n (a, b) => orderedNodes.indexOf(a.ref.current!) - orderedNodes.indexOf(b.ref.current!),\n );\n return orderedItems;\n }, [context.collectionRef, context.itemMap]);\n\n return getItems;\n }\n\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope,\n ] as const;\n}\n\nexport { createCollection };\nexport type { CollectionProps };\n", "import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createSlot, type Slot } from '@radix-ui/react-slot';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport type { EntryOf } from './ordered-dictionary';\nimport { OrderedDict, type ReadOnlyOrderedDict } from './ordered-dictionary';\n\ntype SlotProps = React.ComponentPropsWithoutRef;\ntype CollectionElement = HTMLElement;\ninterface CollectionSlotProps extends SlotProps {\n scope: any;\n}\n\ninterface BaseItemData {\n id?: string | undefined;\n}\n\ntype ItemDataWithElement<\n ItemData extends BaseItemData,\n ItemElement extends HTMLElement,\n> = ItemData & {\n element: ItemElement;\n};\n\ntype BaseCollectionDict<\n ItemElement extends HTMLElement,\n ItemData extends BaseItemData,\n> = OrderedDict>;\n\ntype CollectionDict = ReadOnlyOrderedDict<\n ItemElement,\n ItemDataWithElement\n>;\n\n/**\n * Creates a collection that tracks its items in document order and exposes them\n * during render via `useCollection`.\n *\n * Item data passed to `ItemSlot` (every prop other than `scope` and `children`)\n * must be referentially stable across renders. It is compared shallowly, and any\n * change re-registers the item and replaces the item map. Memoize objects,\n * arrays and callbacks with `useMemo` / `useCallback`, or define them outside of\n * render.\n */\n/* @__NO_SIDE_EFFECTS__ */ function createCollection<\n ItemElement extends HTMLElement,\n ItemData extends {} = {},\n>(name: string) {\n type AllItemData = ItemData & BaseItemData;\n /* -----------------------------------------------------------------------------------------------\n * CollectionProvider\n * ---------------------------------------------------------------------------------------------*/\n\n const PROVIDER_NAME = name + 'CollectionProvider';\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n\n interface CollectionStableContextValue {\n collectionElementRef: React.Ref;\n collectionElementRefObject: React.RefObject;\n setCollection: React.Dispatch<\n React.SetStateAction>\n >;\n getCollection: () => CollectionDict;\n registryRef: React.RefObject>;\n }\n\n interface CollectionStatefulContextValue {\n collectionElement: CollectionElement | null;\n collection: CollectionDict;\n }\n\n const [CollectionStableContextProvider, useStableCollectionContext] =\n createCollectionContext(PROVIDER_NAME);\n CollectionStableContextProvider.displayName = name + 'CollectionStableContextProvider';\n\n const [CollectionStatefulContextProvider, useStatefulCollectionContext] =\n createCollectionContext(PROVIDER_NAME);\n CollectionStatefulContextProvider.displayName = name + 'CollectionStatefulContextProvider';\n\n type CollectionState = [\n ItemMap: BaseCollectionDict,\n SetItemMap: React.Dispatch>>,\n ];\n\n const CollectionProvider: React.FC<{\n children?: React.ReactNode | undefined;\n scope: any;\n state?: CollectionState | undefined;\n }> = ({ state, ...props }) => {\n return state ? (\n \n ) : (\n \n );\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n\n const CollectionInit: React.FC<{\n children?: React.ReactNode | undefined;\n scope: any;\n }> = (props) => {\n const state = useInitCollection();\n return ;\n };\n CollectionInit.displayName = name + 'CollectionInit';\n\n const CollectionProviderImpl: React.FC<{\n children?: React.ReactNode | undefined;\n scope: any;\n state: CollectionState;\n }> = (props) => {\n const { scope, children, state } = props;\n const ref = React.useRef(null);\n const [collectionElement, setCollectionElement] = React.useState(\n null,\n );\n const composeRefs = useComposedRefs(ref, setCollectionElement);\n const [collection, setCollection] = state;\n\n // Written only during commit (from item ref callbacks and layout effects),\n // so it never includes items from renders that React discards.\n const registryRef = React.useRef>(\n new OrderedDict(),\n );\n const getCollection = React.useCallback(() => {\n const registry = registryRef.current;\n if (!isInDocumentOrder(registry)) {\n registry.sort(sortByDocumentPosition);\n }\n return registry;\n }, []);\n\n React.useEffect(() => {\n if (!collectionElement) {\n return;\n }\n\n const observer = getChildListObserver(() => {\n setCollection((map) => {\n const sorted = map.toSorted(sortByDocumentPosition);\n const orderChanged = sorted.some(([key], index) => map.keyAt(index) !== key);\n\n return orderChanged ? sorted : map;\n });\n });\n observer.observe(collectionElement, {\n childList: true,\n subtree: true,\n });\n return () => {\n observer.disconnect();\n };\n }, [collectionElement, setCollection]);\n\n return (\n \n \n {children}\n \n \n );\n };\n\n CollectionProviderImpl.displayName = name + 'CollectionProviderImpl';\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionSlot\n * ---------------------------------------------------------------------------------------------*/\n\n const COLLECTION_SLOT_NAME = name + 'CollectionSlot';\n\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useStableCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionElementRef);\n return {children};\n },\n );\n\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionItem\n * ---------------------------------------------------------------------------------------------*/\n\n const ITEM_SLOT_NAME = name + 'CollectionItemSlot';\n const ITEM_DATA_ATTR = 'data-radix-collection-item';\n\n type CollectionItemSlotProps = AllItemData & {\n children: React.ReactNode;\n scope: any;\n };\n\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n /**\n * Registers its child element as a collection item. Every prop other than\n * `scope` and `children` is item data and must be referentially stable across\n * renders (see `createCollection`).\n */\n const CollectionItemSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef(null);\n const context = useStableCollectionContext(ITEM_SLOT_NAME, scope);\n\n const { setCollection, registryRef } = context;\n\n const itemDataRef = React.useRef(itemData);\n if (!shallowEqual(itemDataRef.current, itemData)) {\n itemDataRef.current = itemData;\n }\n const memoizedItemData = itemDataRef.current;\n\n // TODO: Once React 19 is the minimum supported version, return a cleanup\n // function that unregisters `node` instead of handling `null`, which\n // depends on `ref.current` still holding the previous element.\n const registerElement = React.useCallback(\n (node: ItemElement | null) => {\n const registry = registryRef.current;\n if (node) {\n registry.set(node, {\n ...(itemDataRef.current as unknown as AllItemData),\n element: node,\n });\n } else if (ref.current) {\n registry.delete(ref.current);\n }\n },\n [registryRef],\n );\n const composedRefs = useComposedRefs(forwardedRef, registerElement, ref);\n\n useLayoutEffect(() => {\n const node = ref.current;\n const registry = registryRef.current;\n if (node && registry.has(node)) {\n registry.set(node, { ...(memoizedItemData as unknown as AllItemData), element: node });\n }\n }, [memoizedItemData, registryRef]);\n\n const registeredRef = React.useRef<{\n element: ItemElement;\n itemData: typeof memoizedItemData;\n } | null>(null);\n\n React.useEffect(() => {\n const element = ref.current;\n const registered = registeredRef.current;\n if (\n (registered?.element ?? null) === element &&\n (!element || registered?.itemData === memoizedItemData)\n ) {\n return;\n }\n\n registeredRef.current = element ? { element, itemData: memoizedItemData } : null;\n setCollection((map) => {\n const next = new OrderedDict(map);\n if (registered && registered.element !== element) {\n next.delete(registered.element);\n }\n if (element) {\n next.set(element, { ...(memoizedItemData as unknown as AllItemData), element });\n }\n return next.sort(sortByDocumentPosition);\n });\n });\n\n React.useEffect(() => {\n return () => {\n const registered = registeredRef.current;\n registeredRef.current = null;\n if (!registered) {\n return;\n }\n setCollection((map) => {\n if (!map.has(registered.element)) {\n return map;\n }\n const next = new OrderedDict(map);\n next.delete(registered.element);\n return next;\n });\n };\n }, [setCollection]);\n\n return (\n \n {children}\n \n );\n },\n );\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useInitCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useInitCollection() {\n return React.useState>(new OrderedDict());\n }\n\n /* -----------------------------------------------------------------------------------------------\n * useCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useCollection(scope: any) {\n const { collection } = useStatefulCollectionContext(name + 'CollectionConsumer', scope);\n return collection;\n }\n\n function useGetCollection(scope: any) {\n const { getCollection } = useStableCollectionContext(name + 'CollectionConsumer', scope);\n return getCollection;\n }\n\n const functions = {\n createCollectionScope,\n useCollection,\n useGetCollection,\n useInitCollection,\n };\n\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n functions,\n ] as const;\n}\n\nexport { createCollection };\nexport type { CollectionSlotProps, CollectionDict };\n\nfunction shallowEqual(a: any, b: any) {\n if (a === b) return true;\n if (typeof a !== 'object' || typeof b !== 'object') return false;\n if (a == null || b == null) return false;\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n if (keysA.length !== keysB.length) return false;\n for (const key of keysA) {\n if (!Object.prototype.hasOwnProperty.call(b, key)) return false;\n if (a[key] !== b[key]) return false;\n }\n return true;\n}\n\nfunction isElementPreceding(a: Element, b: Element) {\n return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);\n}\n\nfunction isInDocumentOrder(\n dict: BaseCollectionDict,\n) {\n let previous: Element | undefined;\n for (const element of dict.keys()) {\n if (previous) {\n const position = previous.compareDocumentPosition(element);\n if (\n !(position & Node.DOCUMENT_POSITION_DISCONNECTED) &&\n position & Node.DOCUMENT_POSITION_PRECEDING\n ) {\n return false;\n }\n }\n previous = element;\n }\n return true;\n}\n\nfunction sortByDocumentPosition(\n a: EntryOf>,\n b: EntryOf>,\n) {\n return !a[1].element || !b[1].element\n ? 0\n : isElementPreceding(a[1].element, b[1].element)\n ? -1\n : 1;\n}\n\nfunction getChildListObserver(callback: () => void) {\n const observer = new MutationObserver((mutationsList) => {\n for (const mutation of mutationsList) {\n if (mutation.type === 'childList') {\n callback();\n return;\n }\n }\n });\n\n return observer;\n}\n", "// Not a real member because it shouldn't be accessible, but the super class\n// calls `set` which needs to read the instanciation state, so it can't be a\n// private member.\nconst __instanciated = new WeakMap, boolean>();\nexport class OrderedDict extends Map {\n #keys: K[];\n\n constructor(iterable?: Iterable | null | undefined);\n constructor(entries?: readonly (readonly [K, V])[] | null) {\n super(entries);\n this.#keys = [...super.keys()];\n __instanciated.set(this, true);\n }\n\n set(key: K, value: V) {\n if (__instanciated.get(this) && !this.has(key)) {\n this.#keys.push(key);\n }\n super.set(key, value);\n return this;\n }\n\n /**\n * Sets a key-value pair so that it ends up at the given index.\n * - Existing keys are moved\n * - Negative indices count from the end of the resulting dictionary, so\n * inserting at -1 makes the item the last one, -2 the second to last, etc.\n * - Out-of-range indices are clamped\n */\n insert(index: number, key: K, value: V) {\n const has = this.has(key);\n const finalSize = has ? this.size : this.size + 1;\n const relativeIndex = toSafeInteger(index);\n const targetIndex =\n relativeIndex >= 0\n ? Math.min(relativeIndex, finalSize - 1)\n : Math.max(finalSize + relativeIndex, 0);\n\n if (has ? this.#keys.indexOf(key) === targetIndex : targetIndex === this.size) {\n this.set(key, value);\n return this;\n }\n\n const keys = this.#keys.filter((existingKey) => existingKey !== key);\n keys.splice(targetIndex, 0, key);\n const entries = keys.map((entryKey): [K, V] => [\n entryKey,\n entryKey === key ? value : this.get(entryKey)!,\n ]);\n this.clear();\n for (const [entryKey, entryValue] of entries) {\n this.set(entryKey, entryValue);\n }\n return this;\n }\n\n with(index: number, key: K, value: V) {\n const copy = new OrderedDict(this);\n copy.insert(index, key, value);\n return copy;\n }\n\n before(key: K) {\n const index = this.#keys.indexOf(key) - 1;\n if (index < 0) {\n return undefined;\n }\n return this.entryAt(index);\n }\n\n /**\n * Sets a new key-value pair at the position before the given key.\n */\n setBefore(key: K, newKey: K, value: V) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n const currentIndex = this.#keys.indexOf(newKey);\n const targetIndex = currentIndex !== -1 && currentIndex < index ? index - 1 : index;\n return this.insert(targetIndex, newKey, value);\n }\n\n after(key: K) {\n let index = this.#keys.indexOf(key);\n index = index === -1 || index === this.size - 1 ? -1 : index + 1;\n if (index === -1) {\n return undefined;\n }\n return this.entryAt(index);\n }\n\n /**\n * Sets a new key-value pair at the position after the given key.\n */\n setAfter(key: K, newKey: K, value: V) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n const currentIndex = this.#keys.indexOf(newKey);\n const targetIndex = currentIndex !== -1 && currentIndex <= index ? index : index + 1;\n return this.insert(targetIndex, newKey, value);\n }\n\n first() {\n return this.entryAt(0);\n }\n\n last() {\n return this.entryAt(-1);\n }\n\n clear() {\n this.#keys = [];\n return super.clear();\n }\n\n delete(key: K) {\n const deleted = super.delete(key);\n if (deleted) {\n this.#keys.splice(this.#keys.indexOf(key), 1);\n }\n return deleted;\n }\n\n deleteAt(index: number) {\n const key = this.keyAt(index);\n if (key !== undefined) {\n return this.delete(key);\n }\n return false;\n }\n\n at(index: number) {\n const key = at(this.#keys, index);\n if (key !== undefined) {\n return this.get(key);\n }\n }\n\n entryAt(index: number): [K, V] | undefined {\n const key = at(this.#keys, index);\n if (key !== undefined) {\n return [key, this.get(key)!];\n }\n }\n\n indexOf(key: K) {\n return this.#keys.indexOf(key);\n }\n\n keyAt(index: number) {\n return at(this.#keys, index);\n }\n\n from(key: K, offset: number) {\n const index = this.indexOf(key);\n if (index === -1) {\n return undefined;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.at(dest);\n }\n\n keyFrom(key: K, offset: number) {\n const index = this.indexOf(key);\n if (index === -1) {\n return undefined;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.keyAt(dest);\n }\n\n find(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict) => boolean,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return entry;\n }\n index++;\n }\n return undefined;\n }\n\n findIndex(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict) => boolean,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return index;\n }\n index++;\n }\n return -1;\n }\n\n filter(\n predicate: (entry: [K, V], index: number, dict: OrderedDict) => entry is [KK, VV],\n thisArg?: any,\n ): OrderedDict;\n\n filter(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict) => unknown,\n thisArg?: any,\n ): OrderedDict;\n\n filter(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict) => unknown,\n thisArg?: any,\n ) {\n const entries: Array<[K, V]> = [];\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n entries.push(entry);\n }\n index++;\n }\n return new OrderedDict(entries);\n }\n\n map(\n callbackfn: (entry: [K, V], index: number, dictionary: OrderedDict) => U,\n thisArg?: any,\n ): OrderedDict {\n const entries: [K, U][] = [];\n let index = 0;\n for (const entry of this) {\n entries.push([entry[0], Reflect.apply(callbackfn, thisArg, [entry, index, this])]);\n index++;\n }\n return new OrderedDict(entries);\n }\n\n reduce(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict,\n ) => [K, V],\n ): [K, V];\n reduce(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict,\n ) => [K, V],\n initialValue: [K, V],\n ): [K, V];\n reduce(\n callbackfn: (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict,\n ) => U,\n initialValue: U,\n ): U;\n\n reduce(\n ...args: [\n (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict,\n ) => U,\n U?,\n ]\n ) {\n const [callbackfn, initialValue] = args;\n const hasInitialValue = args.length > 1;\n if (!hasInitialValue && this.size === 0) {\n throw new TypeError('Reduce of empty OrderedDict with no initial value');\n }\n let index = 0;\n let accumulator = initialValue as U;\n for (const entry of this) {\n if (index === 0 && !hasInitialValue) {\n accumulator = entry as any;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n index++;\n }\n return accumulator;\n }\n\n reduceRight(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict,\n ) => [K, V],\n ): [K, V];\n reduceRight(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict,\n ) => [K, V],\n initialValue: [K, V],\n ): [K, V];\n reduceRight(\n callbackfn: (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict,\n ) => U,\n initialValue: U,\n ): U;\n\n reduceRight(\n ...args: [\n (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict,\n ) => U,\n U?,\n ]\n ) {\n const [callbackfn, initialValue] = args;\n const hasInitialValue = args.length > 1;\n if (!hasInitialValue && this.size === 0) {\n throw new TypeError('Reduce of empty OrderedDict with no initial value');\n }\n let accumulator = initialValue as U;\n for (let index = this.size - 1; index >= 0; index--) {\n const entry = this.entryAt(index)!;\n if (index === this.size - 1 && !hasInitialValue) {\n accumulator = entry as any;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n }\n return accumulator;\n }\n\n /**\n * Sorts the dictionary in place. This method mutates the dictionary and\n * returns a reference to the same object\n *\n * @param compareFn Function used to determine the order of the elements. It\n * is expected to return a negative value if the first argument is less than\n * the second argument, zero if they're equal, and a positive value otherwise.\n */\n sort(compareFn: (a: [K, V], b: [K, V]) => number): OrderedDict {\n if (typeof compareFn !== 'function') {\n throw new TypeError(`OrderedDict.sort requires a compare function`);\n }\n const entries = [...this.entries()].sort(compareFn);\n this.clear();\n for (const [key, value] of entries) {\n this.set(key, value);\n }\n return this;\n }\n\n /**\n * Returns a copy of the dictionary with its elements sorted.\n *\n * @param compareFn Function used to determine the order of the elements. It\n * is expected to return a negative value if the first argument is less than\n * the second argument, zero if they're equal, and a positive value otherwise.\n */\n toSorted(compareFn: (a: [K, V], b: [K, V]) => number): OrderedDict {\n if (typeof compareFn !== 'function') {\n throw new TypeError(`OrderedDict.toSorted requires a compare function`);\n }\n const entries = [...this.entries()].sort(compareFn);\n return new OrderedDict(entries);\n }\n\n toReversed(): OrderedDict {\n const reversed = new OrderedDict();\n for (let index = this.size - 1; index >= 0; index--) {\n const key = this.keyAt(index)!;\n const element = this.get(key)!;\n reversed.set(key, element);\n }\n return reversed;\n }\n\n toSpliced(start: number, deleteCount?: number): OrderedDict;\n toSpliced(start: number, deleteCount: number, ...items: [K, V][]): OrderedDict;\n\n toSpliced(...args: [start: number, deleteCount: number, ...items: [K, V][]]) {\n const entries = [...this.entries()];\n entries.splice(...args);\n return new OrderedDict(entries);\n }\n\n slice(start?: number, end?: number) {\n const result = new OrderedDict();\n for (const key of this.#keys.slice(start, end)) {\n result.set(key, this.get(key)!);\n }\n return result;\n }\n\n every(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict) => unknown,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (!Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return false;\n }\n index++;\n }\n return true;\n }\n\n some(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict) => unknown,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return true;\n }\n index++;\n }\n return false;\n }\n}\n\nexport type KeyOf> =\n D extends OrderedDict ? K : never;\nexport type ValueOf> =\n D extends OrderedDict ? V : never;\nexport type EntryOf> = [KeyOf, ValueOf];\nexport type KeyFrom> = E[0];\nexport type ValueFrom> = E[1];\n\nfunction at(array: ArrayLike, index: number): T | undefined {\n if ('at' in Array.prototype) {\n return Array.prototype.at.call(array, index);\n }\n const actualIndex = toSafeIndex(array, index);\n return actualIndex === -1 ? undefined : array[actualIndex];\n}\n\nfunction toSafeIndex(array: ArrayLike, index: number) {\n const length = array.length;\n const relativeIndex = toSafeInteger(index);\n const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n}\n\nfunction toSafeInteger(number: number) {\n // eslint-disable-next-line no-self-compare\n return number !== number || number === 0 ? 0 : Math.trunc(number);\n}\n\nexport type ReadOnlyOrderedDict = Omit<\n OrderedDict,\n 'set' | 'insert' | 'setBefore' | 'setAfter' | 'clear' | 'delete' | 'deleteAt' | 'sort'\n>;\n"], + "mappings": ";;;;;AAAA,YAAY,WAAW;AACvB,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAChC,SAAS,kBAA6B;AA4ChC;AAAA;AA/BqB,SAAS,iBAGlC,MAAc;AAKd,QAAM,gBAAgB,OAAO;AAC7B,QAAM,CAAC,yBAAyB,qBAAqB,IAAI,mBAAmB,aAAa;AAUzF,QAAM,CAAC,wBAAwB,oBAAoB,IAAI;AAAA,IACrD;AAAA,IACA,EAAE,eAAe,EAAE,SAAS,KAAK,GAAG,SAAS,oBAAI,IAAI,EAAE;AAAA,EACzD;AAEA,QAAM,qBAAuF,wBAC3F,UACG;AACH,UAAM,EAAE,OAAO,SAAS,IAAI;AAC5B,UAAM,MAAY,aAA0B,IAAI;AAChD,UAAM,UAAgB,aAAgC,oBAAI,IAAI,CAAC,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AAW,OAAO,OAAO;AACvB,QAAI,CAAC,OAAO,UAAU,eAAe,KAAK,GAAG,GAAG,EAAG,QAAO;AAC1D,QAAI,EAAE,GAAG,MAAM,EAAE,GAAG,EAAG,QAAO;AAAA,EAChC;AACA,SAAO;AACT;AAZS;AAcT,SAAS,mBAAmB,GAAY,GAAY;AAClD,SAAO,CAAC,EAAE,EAAE,wBAAwB,CAAC,IAAI,KAAK;AAChD;AAFS;AAIT,SAAS,kBACP,MACA;AACA,MAAI;AACJ,aAAW,WAAW,KAAK,KAAK,GAAG;AACjC,QAAI,UAAU;AACZ,YAAM,WAAW,SAAS,wBAAwB,OAAO;AACzD,UACE,EAAE,WAAW,KAAK,mCAClB,WAAW,KAAK,6BAChB;AACA,eAAO;AAAA,MACT;AAAA,IACF;AACA,eAAW;AAAA,EACb;AACA,SAAO;AACT;AAjBS;AAmBT,SAAS,uBACP,GACA,GACA;AACA,SAAO,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,EAAE,CAAC,EAAE,UAC1B,IACA,mBAAmB,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,IAC3C,KACA;AACR;AATS;AAWT,SAAS,qBAAqB,UAAsB;AAClD,QAAM,WAAW,IAAI,iBAAiB,CAAC,kBAAkB;AACvD,eAAW,YAAY,eAAe;AACpC,UAAI,SAAS,SAAS,aAAa;AACjC,iBAAS;AACT;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AAED,SAAO;AACT;AAXS;", + "names": ["React", "createContextScope", "useComposedRefs", "createSlot", "jsx", "createCollection", "createContextScope", "useComposedRefs", "createSlot"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-collection/package.json b/e-commerce/node_modules/@radix-ui/react-collection/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0b9fd4b8f6e1d819eab360232ec2d0455c575b0a --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-collection/package.json @@ -0,0 +1,72 @@ +{ + "name": "@radix-ui/react-collection", + "version": "1.2.0", + "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.5", + "@radix-ui/react-context": "1.3.0", + "@radix-ui/react-primitive": "2.2.0", + "@radix-ui/react-slot": "1.5.0", + "@radix-ui/react-use-layout-effect": "1.1.4" + }, + "devDependencies": { + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "react": "^19.3.0", + "react-dom": "^19.3.0", + "typescript": "^5.9.3", + "@repo/builder": "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", + "directory": "packages/react/collection" + }, + "bugs": { + "url": "https://github.com/radix-ui/primitives/issues" + }, + "scripts": { + "lint": "oxlint --max-warnings 0 src", + "clean": "rm -rf dist", + "reset": "rm -rf dist node_modules", + "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" + } + } + } +} \ No newline at end of file diff --git a/e-commerce/node_modules/@radix-ui/react-compose-refs/LICENSE b/e-commerce/node_modules/@radix-ui/react-compose-refs/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a18858fb7b014098cba85703e66609be66a26ef5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-compose-refs/LICENSE @@ -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. diff --git a/e-commerce/node_modules/@radix-ui/react-compose-refs/README.md b/e-commerce/node_modules/@radix-ui/react-compose-refs/README.md new file mode 100644 index 0000000000000000000000000000000000000000..c9e42dc3e6fe6f6f761a46244c39b68390963e3b --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-compose-refs/README.md @@ -0,0 +1,3 @@ +# `react-compose-refs` + +This is an internal utility, not intended for public usage. diff --git a/e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.d.mts b/e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c7a149ce7ef47762597bf59309ce8c8a97c65508 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.d.mts @@ -0,0 +1,15 @@ +import * as React from 'react'; + +type PossibleRef = React.Ref | undefined; +/** + * A utility to compose multiple refs together + * Accepts callback refs and RefObject(s) + */ +declare function composeRefs(...refs: PossibleRef[]): React.RefCallback; +/** + * A custom hook that composes multiple refs + * Accepts callback refs and RefObject(s) + */ +declare function useComposedRefs(...refs: PossibleRef[]): React.RefCallback; + +export { composeRefs, useComposedRefs }; diff --git a/e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.d.ts b/e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c7a149ce7ef47762597bf59309ce8c8a97c65508 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.d.ts @@ -0,0 +1,15 @@ +import * as React from 'react'; + +type PossibleRef = React.Ref | undefined; +/** + * A utility to compose multiple refs together + * Accepts callback refs and RefObject(s) + */ +declare function composeRefs(...refs: PossibleRef[]): React.RefCallback; +/** + * A custom hook that composes multiple refs + * Accepts callback refs and RefObject(s) + */ +declare function useComposedRefs(...refs: PossibleRef[]): React.RefCallback; + +export { composeRefs, useComposedRefs }; diff --git a/e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.js b/e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..7be9deb43fa56a06f8a742cd8a771d7230e00f07 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.js @@ -0,0 +1,78 @@ +"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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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, { + composeRefs: () => composeRefs, + useComposedRefs: () => useComposedRefs +}); +module.exports = __toCommonJS(index_exports); + +// 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; + } +} +__name(setRef, "setRef"); +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); + } + } + }; + } + }; +} +__name(composeRefs, "composeRefs"); +function useComposedRefs(...refs) { + return React.useCallback(composeRefs(...refs), refs); +} +__name(useComposedRefs, "useComposedRefs"); +//# sourceMappingURL=index.js.map diff --git a/e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.js.map b/e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..cdfd9611e7ce95f24f87560ce2b6cea0baf1031b --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.js.map @@ -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 = React.Ref | 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(ref: PossibleRef, 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(...refs: PossibleRef[]): React.RefCallback {\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(...refs: PossibleRef[]): React.RefCallback {\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;AANS;AAYT,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;AA5BS;AAkCT,SAAS,mBAAsB,MAA8C;AAE3E,SAAa,kBAAY,YAAY,GAAG,IAAI,GAAG,IAAI;AACrD;AAHS;", + "names": [] +} diff --git a/e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.mjs b/e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4023d9eb1c63882b64ee199353d5e2bccc97ec2a --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.mjs @@ -0,0 +1,47 @@ +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// 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; + } +} +__name(setRef, "setRef"); +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); + } + } + }; + } + }; +} +__name(composeRefs, "composeRefs"); +function useComposedRefs(...refs) { + return React.useCallback(composeRefs(...refs), refs); +} +__name(useComposedRefs, "useComposedRefs"); +export { + composeRefs, + useComposedRefs +}; +//# sourceMappingURL=index.mjs.map diff --git a/e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.mjs.map b/e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..25a4bded8427b04157a7ab195e49ac9e0e468db4 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.mjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/compose-refs.tsx"], + "sourcesContent": ["import * as React from 'react';\n\ntype PossibleRef = React.Ref | 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(ref: PossibleRef, 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(...refs: PossibleRef[]): React.RefCallback {\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(...refs: PossibleRef[]): React.RefCallback {\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;AANS;AAYT,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;AA5BS;AAkCT,SAAS,mBAAsB,MAA8C;AAE3E,SAAa,kBAAY,YAAY,GAAG,IAAI,GAAG,IAAI;AACrD;AAHS;", + "names": [] +} diff --git a/e-commerce/node_modules/@radix-ui/react-compose-refs/package.json b/e-commerce/node_modules/@radix-ui/react-compose-refs/package.json new file mode 100644 index 0000000000000000000000000000000000000000..4a4f8b8c106527cab0e0b7e613884beb36e7a4d5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-compose-refs/package.json @@ -0,0 +1,60 @@ +{ + "name": "@radix-ui/react-compose-refs", + "version": "1.1.5", + "license": "MIT", + "source": "./src/index.ts", + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "files": [ + "dist", + "README.md" + ], + "sideEffects": false, + "devDependencies": { + "@types/react": "^19.2.2", + "@types/react-dom": "^19.2.2", + "react": "^19.2.0", + "react-dom": "^19.2.0", + "typescript": "^5.9.3", + "@repo/builder": "0.0.0", + "@repo/typescript-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", + "directory": "packages/react/compose-refs" + }, + "bugs": { + "url": "https://github.com/radix-ui/primitives/issues" + }, + "scripts": { + "lint": "oxlint --max-warnings 0 src", + "clean": "rm -rf dist", + "reset": "rm -rf dist node_modules", + "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" + } + } + } +} \ No newline at end of file diff --git a/e-commerce/node_modules/@radix-ui/react-context/LICENSE b/e-commerce/node_modules/@radix-ui/react-context/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a18858fb7b014098cba85703e66609be66a26ef5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-context/LICENSE @@ -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. diff --git a/e-commerce/node_modules/@radix-ui/react-context/README.md b/e-commerce/node_modules/@radix-ui/react-context/README.md new file mode 100644 index 0000000000000000000000000000000000000000..a637314dec76395862fd9b93fdb3869ed843504d --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-context/README.md @@ -0,0 +1,3 @@ +# `react-context` + +This is an internal utility, not intended for public usage. diff --git a/e-commerce/node_modules/@radix-ui/react-context/dist/index.d.mts b/e-commerce/node_modules/@radix-ui/react-context/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..19719869c4925f9ae804abd04be001b6ed502995 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-context/dist/index.d.mts @@ -0,0 +1,46 @@ +import * as React from 'react'; + +type ContextProvider = React.FC; +interface UseAssertedContext { + (consumerName: string): ContextValueType; +} +interface UseContext { + (consumerName: string): ContextValueType; + (consumerName: string, options: { + optional: true; + }): ContextValueType | undefined; +} +declare function createContext(rootComponentName: string): readonly [ContextProvider, UseContext]; +declare function createContext(rootComponentName: string, defaultContext: ContextValueType): readonly [ContextProvider, UseAssertedContext]; +type Scope = { + [scopeName: string]: React.Context[]; +} | undefined; +type ScopeHook = (scope: Scope) => { + [__scopeProp: string]: Scope; +}; +interface CreateScope { + scopeName: string; + (): ScopeHook; +} +type ScopedContextProvider = React.FC; + children: React.ReactNode; +}>; +interface UseScopedContext { + (consumerName: string, scope: Scope): ContextValueType; + (consumerName: string, scope: Scope, options: { + optional?: true | undefined; + }): ContextValueType | undefined; +} +interface UseAssertedScopedContext { + (consumerName: string, scope: Scope): ContextValueType; +} +interface CreateScopedContext { + (rootComponentName: string): readonly [ScopedContextProvider, UseScopedContext]; + (rootComponentName: string, defaultContext: ContextValueType): readonly [ScopedContextProvider, UseAssertedScopedContext]; +} +declare function createContextScope(scopeName: string, createContextScopeDeps?: CreateScope[]): readonly [CreateScopedContext, CreateScope]; + +export { type CreateScope, type Scope, createContext, createContextScope }; diff --git a/e-commerce/node_modules/@radix-ui/react-context/dist/index.d.ts b/e-commerce/node_modules/@radix-ui/react-context/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..19719869c4925f9ae804abd04be001b6ed502995 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-context/dist/index.d.ts @@ -0,0 +1,46 @@ +import * as React from 'react'; + +type ContextProvider = React.FC; +interface UseAssertedContext { + (consumerName: string): ContextValueType; +} +interface UseContext { + (consumerName: string): ContextValueType; + (consumerName: string, options: { + optional: true; + }): ContextValueType | undefined; +} +declare function createContext(rootComponentName: string): readonly [ContextProvider, UseContext]; +declare function createContext(rootComponentName: string, defaultContext: ContextValueType): readonly [ContextProvider, UseAssertedContext]; +type Scope = { + [scopeName: string]: React.Context[]; +} | undefined; +type ScopeHook = (scope: Scope) => { + [__scopeProp: string]: Scope; +}; +interface CreateScope { + scopeName: string; + (): ScopeHook; +} +type ScopedContextProvider = React.FC; + children: React.ReactNode; +}>; +interface UseScopedContext { + (consumerName: string, scope: Scope): ContextValueType; + (consumerName: string, scope: Scope, options: { + optional?: true | undefined; + }): ContextValueType | undefined; +} +interface UseAssertedScopedContext { + (consumerName: string, scope: Scope): ContextValueType; +} +interface CreateScopedContext { + (rootComponentName: string): readonly [ScopedContextProvider, UseScopedContext]; + (rootComponentName: string, defaultContext: ContextValueType): readonly [ScopedContextProvider, UseAssertedScopedContext]; +} +declare function createContextScope(scopeName: string, createContextScopeDeps?: CreateScope[]): readonly [CreateScopedContext, CreateScope]; + +export { type CreateScope, type Scope, createContext, createContextScope }; diff --git a/e-commerce/node_modules/@radix-ui/react-context/dist/index.js b/e-commerce/node_modules/@radix-ui/react-context/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..25733db0ddd0b387e3fe2daf59f483223bdd0269 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-context/dist/index.js @@ -0,0 +1,129 @@ +"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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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, { + createContext: () => createContext2, + createContextScope: () => createContextScope +}); +module.exports = __toCommonJS(index_exports); + +// src/create-context.tsx +var React = __toESM(require("react")); +var import_jsx_runtime = require("react/jsx-runtime"); +// @__NO_SIDE_EFFECTS__ +function createContext2(rootComponentName, defaultContext) { + const Context = React.createContext(defaultContext); + Context.displayName = rootComponentName + "Context"; + const Provider = /* @__PURE__ */ __name((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"); + Provider.displayName = rootComponentName + "Provider"; + function useContext2(consumerName, options = {}) { + const { optional = false } = options; + const context = React.useContext(Context); + if (context) return context; + if (defaultContext !== void 0) return defaultContext; + if (optional) return void 0; + throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``); + } + __name(useContext2, "useContext"); + return [Provider, useContext2]; +} +__name(createContext2, "createContext"); +// @__NO_SIDE_EFFECTS__ +function createContextScope(scopeName, createContextScopeDeps = []) { + let defaultContexts = []; + function createContext3(rootComponentName, defaultContext) { + const BaseContext = React.createContext(defaultContext); + BaseContext.displayName = rootComponentName + "Context"; + const index = defaultContexts.length; + defaultContexts = [...defaultContexts, defaultContext]; + const Provider = /* @__PURE__ */ __name((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"); + Provider.displayName = rootComponentName + "Provider"; + function useContext2(consumerName, scope, options = {}) { + const { optional = false } = options; + const Context = scope?.[scopeName]?.[index] || BaseContext; + const context = React.useContext(Context); + if (context) return context; + if (defaultContext !== void 0) return defaultContext; + if (optional) return void 0; + throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``); + } + __name(useContext2, "useContext"); + return [Provider, useContext2]; + } + __name(createContext3, "createContext"); + const createScope = /* @__PURE__ */ __name(() => { + const scopeContexts = defaultContexts.map((defaultContext) => { + return React.createContext(defaultContext); + }); + return /* @__PURE__ */ __name(function useScope(scope) { + const contexts = scope?.[scopeName] || scopeContexts; + return React.useMemo( + () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }), + [scope, contexts] + ); + }, "useScope"); + }, "createScope"); + createScope.scopeName = scopeName; + return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)]; +} +__name(createContextScope, "createContextScope"); +function composeContextScopes(...scopes) { + const baseScope = scopes[0]; + if (scopes.length === 1) return baseScope; + const createScope = /* @__PURE__ */ __name(() => { + const scopeHooks = scopes.map((createScope2) => ({ + useScope: createScope2(), + scopeName: createScope2.scopeName + })); + return /* @__PURE__ */ __name(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]); + }, "useComposedScopes"); + }, "createScope"); + createScope.scopeName = baseScope.scopeName; + return createScope; +} +__name(composeContextScopes, "composeContextScopes"); +//# sourceMappingURL=index.js.map diff --git a/e-commerce/node_modules/@radix-ui/react-context/dist/index.js.map b/e-commerce/node_modules/@radix-ui/react-context/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..002cb0b3ee01955cdd5ad13f06bbd5966358e7f2 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-context/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts", "../src/create-context.tsx"], + "sourcesContent": ["export { createContext, createContextScope } from './create-context';\nexport type { CreateScope, Scope } from './create-context';\n", "import * as React from 'react';\n\ntype ContextProvider = React.FC<\n ContextValueType & {\n children: React.ReactNode;\n }\n>;\n\ninterface UseAssertedContext {\n (consumerName: string): ContextValueType;\n}\n\ninterface UseContext {\n (consumerName: string): ContextValueType;\n (consumerName: string, options: { optional: true }): ContextValueType | undefined;\n}\n\nfunction createContext(\n rootComponentName: string,\n): readonly [ContextProvider, UseContext];\nfunction createContext(\n rootComponentName: string,\n defaultContext: ContextValueType,\n): readonly [ContextProvider, UseAssertedContext];\n\n/* @__NO_SIDE_EFFECTS__ */ function createContext(\n rootComponentName: string,\n defaultContext?: ContextValueType,\n): readonly [ContextProvider, UseContext] {\n const Context = React.createContext(defaultContext);\n Context.displayName = rootComponentName + 'Context';\n\n const Provider: ContextProvider = (props) => {\n const { children, ...context } = props;\n // Only re-memoize when prop values change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const value = React.useMemo(() => context, Object.values(context)) as ContextValueType;\n return {children};\n };\n\n Provider.displayName = rootComponentName + 'Provider';\n\n function useContext(consumerName: string): ContextValueType;\n function useContext(\n consumerName: string,\n options: { optional: true },\n ): ContextValueType | undefined;\n\n function useContext(\n consumerName: string,\n options: { optional?: boolean | undefined } = {},\n ): ContextValueType | undefined {\n const { optional = false } = options;\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== undefined) return defaultContext;\n if (optional) return undefined;\n // if a defaultContext wasn't specified, it's a required context.\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n\n return [Provider, useContext];\n}\n\n/* -------------------------------------------------------------------------------------------------\n * createContextScope\n * -----------------------------------------------------------------------------------------------*/\n\ntype Scope = { [scopeName: string]: React.Context[] } | undefined;\ntype ScopeHook = (scope: Scope) => { [__scopeProp: string]: Scope };\ninterface CreateScope {\n scopeName: string;\n (): ScopeHook;\n}\n\ntype ScopedContextProvider = React.FC<\n ContextValueType & {\n scope: Scope;\n children: React.ReactNode;\n }\n>;\n\ninterface UseScopedContext {\n (consumerName: string, scope: Scope): ContextValueType;\n (\n consumerName: string,\n scope: Scope,\n options: { optional?: true | undefined },\n ): ContextValueType | undefined;\n}\n\ninterface UseAssertedScopedContext {\n (consumerName: string, scope: Scope): ContextValueType;\n}\n\ninterface CreateScopedContext {\n (\n rootComponentName: string,\n ): readonly [ScopedContextProvider, UseScopedContext];\n (\n rootComponentName: string,\n defaultContext: ContextValueType,\n ): readonly [ScopedContextProvider, UseAssertedScopedContext];\n}\n\n/* @__NO_SIDE_EFFECTS__ */ function createContextScope(\n scopeName: string,\n createContextScopeDeps: CreateScope[] = [],\n): readonly [CreateScopedContext, CreateScope] {\n let defaultContexts: any[] = [];\n\n /* -----------------------------------------------------------------------------------------------\n * createContext\n * ---------------------------------------------------------------------------------------------*/\n\n function createContext(\n rootComponentName: string,\n defaultContext?: ContextValueType,\n ) {\n const BaseContext = React.createContext(defaultContext);\n BaseContext.displayName = rootComponentName + 'Context';\n const index = defaultContexts.length;\n defaultContexts = [...defaultContexts, defaultContext];\n\n const Provider: ScopedContextProvider = (props) => {\n const { scope, children, ...context } = props;\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n // Only re-memoize when prop values change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const value = React.useMemo(() => context, Object.values(context)) as ContextValueType;\n return {children};\n };\n\n Provider.displayName = rootComponentName + 'Provider';\n\n function useContext(\n consumerName: string,\n scope: Scope,\n ): ContextValueType;\n function useContext(\n consumerName: string,\n scope: Scope,\n options: { optional: true },\n ): ContextValueType | undefined;\n\n function useContext(\n consumerName: string,\n scope: Scope,\n options: { optional?: boolean | undefined } = {},\n ): ContextValueType | undefined {\n const { optional = false } = options;\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== undefined) return defaultContext;\n if (optional) return undefined;\n // if a defaultContext wasn't specified, it's a required context.\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n\n return [Provider, useContext] as const;\n }\n\n /* -----------------------------------------------------------------------------------------------\n * createScope\n * ---------------------------------------------------------------------------------------------*/\n\n const createScope: CreateScope = () => {\n const scopeContexts = defaultContexts.map((defaultContext) => {\n return React.createContext(defaultContext);\n });\n return function useScope(scope: Scope) {\n const contexts = scope?.[scopeName] || scopeContexts;\n return React.useMemo(\n () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),\n [scope, contexts],\n );\n };\n };\n\n createScope.scopeName = scopeName;\n return [createContext, composeContextScopes(createScope, ...createContextScopeDeps)] as const;\n}\n\n/* -------------------------------------------------------------------------------------------------\n * composeContextScopes\n * -----------------------------------------------------------------------------------------------*/\n\nfunction composeContextScopes(...scopes: [CreateScope, ...CreateScope[]]): CreateScope {\n const baseScope = scopes[0];\n if (scopes.length === 1) return baseScope;\n\n const createScope: CreateScope = () => {\n const scopeHooks = scopes.map((createScope) => ({\n useScope: createScope(),\n scopeName: createScope.scopeName,\n }));\n\n return function useComposedScopes(overrideScopes) {\n const nextScopes = scopeHooks.reduce((nextScopes, { useScope, scopeName }) => {\n // We are calling a hook inside a callback which React warns against to avoid inconsistent\n // renders, however, scoping doesn't have render side effects so we ignore the rule.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const scopeProps = useScope(overrideScopes);\n const currentScope = scopeProps[`__scope${scopeName}`];\n return { ...nextScopes, ...currentScope };\n }, {});\n\n return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);\n };\n };\n\n createScope.scopeName = baseScope.scopeName;\n return createScope;\n}\n\n/* -----------------------------------------------------------------------------------------------*/\n\nexport { createContext, createContextScope };\nexport type {\n CreateScope,\n CreateScopedContext,\n Scope,\n UseAssertedContext,\n UseAssertedScopedContext,\n UseContext,\n UseScopedContext,\n};\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,uBAAAA;AAAA,EAAA;AAAA;AAAA;;;ACAA,YAAuB;AAqCZ;AAAA;AAZgB,SAASC,eAClC,mBACA,gBAC4E;AAC5E,QAAM,UAAgB,oBAA4C,cAAc;AAChF,UAAQ,cAAc,oBAAoB;AAE1C,QAAM,WAA8C,wBAAC,UAAU;AAC7D,UAAM,EAAE,UAAU,GAAG,QAAQ,IAAI;AAGjC,UAAM,QAAc,cAAQ,MAAM,SAAS,OAAO,OAAO,OAAO,CAAC;AACjE,WAAO,4CAAC,QAAQ,UAAR,EAAiB,OAAe,UAAS;AAAA,EACnD,GANoD;AAQpD,WAAS,cAAc,oBAAoB;AAQ3C,WAASC,YACP,cACA,UAA8C,CAAC,GACjB;AAC9B,UAAM,EAAE,WAAW,MAAM,IAAI;AAC7B,UAAM,UAAgB,iBAAW,OAAO;AACxC,QAAI,QAAS,QAAO;AACpB,QAAI,mBAAmB,OAAW,QAAO;AACzC,QAAI,SAAU,QAAO;AAErB,UAAM,IAAI,MAAM,KAAK,YAA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SAAS,KAAK;AACvC,aAAa;AAAA,QACX,OAAO,EAAE,CAAC,UAAU,SAAS,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,EAAE;AAAA,QACtE,CAAC,OAAO,QAAQ;AAAA,MAClB;AAAA,IACF,GANO;AAAA,EAOT,GAXiC;AAajC,cAAY,YAAY;AACxB,SAAO,CAACA,gBAAe,qBAAqB,aAAa,GAAG,sBAAsB,CAAC;AACrF;AA7EoC;AAmFpC,SAAS,wBAAwB,QAAsD;AACrF,QAAM,YAAY,OAAO,CAAC;AAC1B,MAAI,OAAO,WAAW,EAAG,QAAO;AAEhC,QAAM,cAA2B,6BAAM;AACrC,UAAM,aAAa,OAAO,IAAI,CAACE,kBAAiB;AAAA,MAC9C,UAAUA,aAAY;AAAA,MACtB,WAAWA,aAAY;AAAA,IACzB,EAAE;AAEF,WAAO,gCAAS,kBAAkB,gBAAgB;AAChD,YAAM,aAAa,WAAW,OAAO,CAACC,aAAY,EAAE,UAAU,UAAU,MAAM;AAI5E,cAAM,aAAa,SAAS,cAAc;AAC1C,cAAM,eAAe,WAAW,UAAU,SAAS,EAAE;AACrD,eAAO,EAAE,GAAGA,aAAY,GAAG,aAAa;AAAA,MAC1C,GAAG,CAAC,CAAC;AAEL,aAAa,cAAQ,OAAO,EAAE,CAAC,UAAU,UAAU,SAAS,EAAE,GAAG,WAAW,IAAI,CAAC,UAAU,CAAC;AAAA,IAC9F,GAXO;AAAA,EAYT,GAlBiC;AAoBjC,cAAY,YAAY,UAAU;AAClC,SAAO;AACT;AA1BS;", + "names": ["createContext", "createContext", "useContext", "createScope", "nextScopes"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-context/dist/index.mjs b/e-commerce/node_modules/@radix-ui/react-context/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..0d63a50fc22ec377def94d5ed3864c6739154790 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-context/dist/index.mjs @@ -0,0 +1,98 @@ +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// src/create-context.tsx +import * as React from "react"; +import { jsx } from "react/jsx-runtime"; +// @__NO_SIDE_EFFECTS__ +function createContext2(rootComponentName, defaultContext) { + const Context = React.createContext(defaultContext); + Context.displayName = rootComponentName + "Context"; + const Provider = /* @__PURE__ */ __name((props) => { + const { children, ...context } = props; + const value = React.useMemo(() => context, Object.values(context)); + return /* @__PURE__ */ jsx(Context.Provider, { value, children }); + }, "Provider"); + Provider.displayName = rootComponentName + "Provider"; + function useContext2(consumerName, options = {}) { + const { optional = false } = options; + const context = React.useContext(Context); + if (context) return context; + if (defaultContext !== void 0) return defaultContext; + if (optional) return void 0; + throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``); + } + __name(useContext2, "useContext"); + return [Provider, useContext2]; +} +__name(createContext2, "createContext"); +// @__NO_SIDE_EFFECTS__ +function createContextScope(scopeName, createContextScopeDeps = []) { + let defaultContexts = []; + function createContext3(rootComponentName, defaultContext) { + const BaseContext = React.createContext(defaultContext); + BaseContext.displayName = rootComponentName + "Context"; + const index = defaultContexts.length; + defaultContexts = [...defaultContexts, defaultContext]; + const Provider = /* @__PURE__ */ __name((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"); + Provider.displayName = rootComponentName + "Provider"; + function useContext2(consumerName, scope, options = {}) { + const { optional = false } = options; + const Context = scope?.[scopeName]?.[index] || BaseContext; + const context = React.useContext(Context); + if (context) return context; + if (defaultContext !== void 0) return defaultContext; + if (optional) return void 0; + throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``); + } + __name(useContext2, "useContext"); + return [Provider, useContext2]; + } + __name(createContext3, "createContext"); + const createScope = /* @__PURE__ */ __name(() => { + const scopeContexts = defaultContexts.map((defaultContext) => { + return React.createContext(defaultContext); + }); + return /* @__PURE__ */ __name(function useScope(scope) { + const contexts = scope?.[scopeName] || scopeContexts; + return React.useMemo( + () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }), + [scope, contexts] + ); + }, "useScope"); + }, "createScope"); + createScope.scopeName = scopeName; + return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)]; +} +__name(createContextScope, "createContextScope"); +function composeContextScopes(...scopes) { + const baseScope = scopes[0]; + if (scopes.length === 1) return baseScope; + const createScope = /* @__PURE__ */ __name(() => { + const scopeHooks = scopes.map((createScope2) => ({ + useScope: createScope2(), + scopeName: createScope2.scopeName + })); + return /* @__PURE__ */ __name(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]); + }, "useComposedScopes"); + }, "createScope"); + createScope.scopeName = baseScope.scopeName; + return createScope; +} +__name(composeContextScopes, "composeContextScopes"); +export { + createContext2 as createContext, + createContextScope +}; +//# sourceMappingURL=index.mjs.map diff --git a/e-commerce/node_modules/@radix-ui/react-context/dist/index.mjs.map b/e-commerce/node_modules/@radix-ui/react-context/dist/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..7c57952ba6127f2a70de075c1f304d8ecd84d4ef --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-context/dist/index.mjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/create-context.tsx"], + "sourcesContent": ["import * as React from 'react';\n\ntype ContextProvider = React.FC<\n ContextValueType & {\n children: React.ReactNode;\n }\n>;\n\ninterface UseAssertedContext {\n (consumerName: string): ContextValueType;\n}\n\ninterface UseContext {\n (consumerName: string): ContextValueType;\n (consumerName: string, options: { optional: true }): ContextValueType | undefined;\n}\n\nfunction createContext(\n rootComponentName: string,\n): readonly [ContextProvider, UseContext];\nfunction createContext(\n rootComponentName: string,\n defaultContext: ContextValueType,\n): readonly [ContextProvider, UseAssertedContext];\n\n/* @__NO_SIDE_EFFECTS__ */ function createContext(\n rootComponentName: string,\n defaultContext?: ContextValueType,\n): readonly [ContextProvider, UseContext] {\n const Context = React.createContext(defaultContext);\n Context.displayName = rootComponentName + 'Context';\n\n const Provider: ContextProvider = (props) => {\n const { children, ...context } = props;\n // Only re-memoize when prop values change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const value = React.useMemo(() => context, Object.values(context)) as ContextValueType;\n return {children};\n };\n\n Provider.displayName = rootComponentName + 'Provider';\n\n function useContext(consumerName: string): ContextValueType;\n function useContext(\n consumerName: string,\n options: { optional: true },\n ): ContextValueType | undefined;\n\n function useContext(\n consumerName: string,\n options: { optional?: boolean | undefined } = {},\n ): ContextValueType | undefined {\n const { optional = false } = options;\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== undefined) return defaultContext;\n if (optional) return undefined;\n // if a defaultContext wasn't specified, it's a required context.\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n\n return [Provider, useContext];\n}\n\n/* -------------------------------------------------------------------------------------------------\n * createContextScope\n * -----------------------------------------------------------------------------------------------*/\n\ntype Scope = { [scopeName: string]: React.Context[] } | undefined;\ntype ScopeHook = (scope: Scope) => { [__scopeProp: string]: Scope };\ninterface CreateScope {\n scopeName: string;\n (): ScopeHook;\n}\n\ntype ScopedContextProvider = React.FC<\n ContextValueType & {\n scope: Scope;\n children: React.ReactNode;\n }\n>;\n\ninterface UseScopedContext {\n (consumerName: string, scope: Scope): ContextValueType;\n (\n consumerName: string,\n scope: Scope,\n options: { optional?: true | undefined },\n ): ContextValueType | undefined;\n}\n\ninterface UseAssertedScopedContext {\n (consumerName: string, scope: Scope): ContextValueType;\n}\n\ninterface CreateScopedContext {\n (\n rootComponentName: string,\n ): readonly [ScopedContextProvider, UseScopedContext];\n (\n rootComponentName: string,\n defaultContext: ContextValueType,\n ): readonly [ScopedContextProvider, UseAssertedScopedContext];\n}\n\n/* @__NO_SIDE_EFFECTS__ */ function createContextScope(\n scopeName: string,\n createContextScopeDeps: CreateScope[] = [],\n): readonly [CreateScopedContext, CreateScope] {\n let defaultContexts: any[] = [];\n\n /* -----------------------------------------------------------------------------------------------\n * createContext\n * ---------------------------------------------------------------------------------------------*/\n\n function createContext(\n rootComponentName: string,\n defaultContext?: ContextValueType,\n ) {\n const BaseContext = React.createContext(defaultContext);\n BaseContext.displayName = rootComponentName + 'Context';\n const index = defaultContexts.length;\n defaultContexts = [...defaultContexts, defaultContext];\n\n const Provider: ScopedContextProvider = (props) => {\n const { scope, children, ...context } = props;\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n // Only re-memoize when prop values change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const value = React.useMemo(() => context, Object.values(context)) as ContextValueType;\n return {children};\n };\n\n Provider.displayName = rootComponentName + 'Provider';\n\n function useContext(\n consumerName: string,\n scope: Scope,\n ): ContextValueType;\n function useContext(\n consumerName: string,\n scope: Scope,\n options: { optional: true },\n ): ContextValueType | undefined;\n\n function useContext(\n consumerName: string,\n scope: Scope,\n options: { optional?: boolean | undefined } = {},\n ): ContextValueType | undefined {\n const { optional = false } = options;\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== undefined) return defaultContext;\n if (optional) return undefined;\n // if a defaultContext wasn't specified, it's a required context.\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n\n return [Provider, useContext] as const;\n }\n\n /* -----------------------------------------------------------------------------------------------\n * createScope\n * ---------------------------------------------------------------------------------------------*/\n\n const createScope: CreateScope = () => {\n const scopeContexts = defaultContexts.map((defaultContext) => {\n return React.createContext(defaultContext);\n });\n return function useScope(scope: Scope) {\n const contexts = scope?.[scopeName] || scopeContexts;\n return React.useMemo(\n () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),\n [scope, contexts],\n );\n };\n };\n\n createScope.scopeName = scopeName;\n return [createContext, composeContextScopes(createScope, ...createContextScopeDeps)] as const;\n}\n\n/* -------------------------------------------------------------------------------------------------\n * composeContextScopes\n * -----------------------------------------------------------------------------------------------*/\n\nfunction composeContextScopes(...scopes: [CreateScope, ...CreateScope[]]): CreateScope {\n const baseScope = scopes[0];\n if (scopes.length === 1) return baseScope;\n\n const createScope: CreateScope = () => {\n const scopeHooks = scopes.map((createScope) => ({\n useScope: createScope(),\n scopeName: createScope.scopeName,\n }));\n\n return function useComposedScopes(overrideScopes) {\n const nextScopes = scopeHooks.reduce((nextScopes, { useScope, scopeName }) => {\n // We are calling a hook inside a callback which React warns against to avoid inconsistent\n // renders, however, scoping doesn't have render side effects so we ignore the rule.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const scopeProps = useScope(overrideScopes);\n const currentScope = scopeProps[`__scope${scopeName}`];\n return { ...nextScopes, ...currentScope };\n }, {});\n\n return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);\n };\n };\n\n createScope.scopeName = baseScope.scopeName;\n return createScope;\n}\n\n/* -----------------------------------------------------------------------------------------------*/\n\nexport { createContext, createContextScope };\nexport type {\n CreateScope,\n CreateScopedContext,\n Scope,\n UseAssertedContext,\n UseAssertedScopedContext,\n UseContext,\n UseScopedContext,\n};\n"], + "mappings": ";;;;AAAA,YAAY,WAAW;AAqCZ;AAAA;AAZgB,SAASA,eAClC,mBACA,gBAC4E;AAC5E,QAAM,UAAgB,oBAA4C,cAAc;AAChF,UAAQ,cAAc,oBAAoB;AAE1C,QAAM,WAA8C,wBAAC,UAAU;AAC7D,UAAM,EAAE,UAAU,GAAG,QAAQ,IAAI;AAGjC,UAAM,QAAc,cAAQ,MAAM,SAAS,OAAO,OAAO,OAAO,CAAC;AACjE,WAAO,oBAAC,QAAQ,UAAR,EAAiB,OAAe,UAAS;AAAA,EACnD,GANoD;AAQpD,W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Context", "useContext", "createScope", "nextScopes"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-context/package.json b/e-commerce/node_modules/@radix-ui/react-context/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69065375f36999cc77dc0c96294dde9f6b8e4dff --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-context/package.json @@ -0,0 +1,60 @@ +{ + "name": "@radix-ui/react-context", + "version": "1.3.0", + "license": "MIT", + "source": "./src/index.ts", + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "files": [ + "dist", + "README.md" + ], + "sideEffects": false, + "devDependencies": { + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "react": "^19.3.0", + "react-dom": "^19.3.0", + "typescript": "^5.9.3", + "@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", + "directory": "packages/react/context" + }, + "bugs": { + "url": "https://github.com/radix-ui/primitives/issues" + }, + "scripts": { + "lint": "oxlint --max-warnings 0 src", + "clean": "rm -rf dist", + "reset": "rm -rf dist node_modules", + "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" + } + } + } +} \ No newline at end of file diff --git a/e-commerce/node_modules/@radix-ui/react-dialog/LICENSE b/e-commerce/node_modules/@radix-ui/react-dialog/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a18858fb7b014098cba85703e66609be66a26ef5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dialog/LICENSE @@ -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. diff --git a/e-commerce/node_modules/@radix-ui/react-dialog/README.md b/e-commerce/node_modules/@radix-ui/react-dialog/README.md new file mode 100644 index 0000000000000000000000000000000000000000..0cd9f9b457b600566d1f56e2f1191e646643c70b --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dialog/README.md @@ -0,0 +1,3 @@ +# `react-dialog` + +View docs [here](https://radix-ui.com/primitives/docs/components/dialog). diff --git a/e-commerce/node_modules/@radix-ui/react-dialog/dist/index.d.mts b/e-commerce/node_modules/@radix-ui/react-dialog/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..76834f2a55ca1216e0b908a7253aff39dc60b984 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dialog/dist/index.d.mts @@ -0,0 +1,99 @@ +import * as _radix_ui_react_context from '@radix-ui/react-context'; +import { Scope } from '@radix-ui/react-context'; +import * as React from 'react'; +import { DismissableLayer } from '@radix-ui/react-dismissable-layer'; +import { FocusScope } from '@radix-ui/react-focus-scope'; +import { Portal } from '@radix-ui/react-portal'; +import { Primitive } from '@radix-ui/react-primitive'; + +type ScopedProps

= P & { + __scopeDialog?: Scope | undefined; +}; +declare const createDialogScope: _radix_ui_react_context.CreateScope; +interface DialogProps { + children?: React.ReactNode | undefined; + open?: boolean | undefined; + defaultOpen?: boolean | undefined; + onOpenChange?: ((open: boolean) => void) | undefined; + modal?: boolean | undefined; +} +declare const Dialog: React.FC; +type PrimitiveButtonProps = React.ComponentPropsWithoutRef; +interface DialogTriggerProps extends PrimitiveButtonProps { +} +declare const DialogTrigger: React.ForwardRefExoticComponent>; +type PortalProps = React.ComponentPropsWithoutRef; +interface DialogPortalProps { + children?: React.ReactNode | undefined; + /** + * Specify a container element to portal the content into. + */ + container?: PortalProps['container'] | undefined; + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const DialogPortal: React.FC; +interface DialogOverlayProps extends DialogOverlayImplProps { + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const DialogOverlay: React.ForwardRefExoticComponent>; +type PrimitiveDivProps = React.ComponentPropsWithoutRef; +interface DialogOverlayImplProps extends PrimitiveDivProps { +} +interface DialogContentProps extends DialogContentTypeProps { + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const DialogContent: React.ForwardRefExoticComponent>; +interface DialogContentTypeProps extends Omit { +} +type DismissableLayerProps = React.ComponentPropsWithoutRef; +type FocusScopeProps = React.ComponentPropsWithoutRef; +interface DialogContentImplProps extends Omit { + /** + * When `true`, focus cannot escape the `Content` via keyboard, + * pointer, or a programmatic focus. + * @defaultValue false + */ + trapFocus?: FocusScopeProps['trapped'] | undefined; + /** + * Event handler called when auto-focusing on open. + * Can be prevented. + */ + onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'] | undefined; + /** + * Event handler called when auto-focusing on close. + * Can be prevented. + */ + onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'] | undefined; +} +type PrimitiveHeading2Props = React.ComponentPropsWithoutRef; +interface DialogTitleProps extends PrimitiveHeading2Props { +} +declare const DialogTitle: React.ForwardRefExoticComponent>; +type PrimitiveParagraphProps = React.ComponentPropsWithoutRef; +interface DialogDescriptionProps extends PrimitiveParagraphProps { +} +declare const DialogDescription: React.ForwardRefExoticComponent>; +interface DialogCloseProps extends PrimitiveButtonProps { +} +declare const DialogClose: React.ForwardRefExoticComponent>; +/** @deprecated Noop component to avoid breaking changes. */ +declare const WarningProvider: React.FC>; + +export { DialogClose as Close, DialogContent as Content, DialogDescription as Description, Dialog, DialogClose, type DialogCloseProps, DialogContent, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogOverlay, type DialogOverlayProps, DialogPortal, type DialogPortalProps, type DialogProps, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerProps, DialogOverlay as Overlay, DialogPortal as Portal, Dialog as Root, DialogTitle as Title, DialogTrigger as Trigger, WarningProvider, createDialogScope }; diff --git a/e-commerce/node_modules/@radix-ui/react-dialog/dist/index.d.ts b/e-commerce/node_modules/@radix-ui/react-dialog/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..76834f2a55ca1216e0b908a7253aff39dc60b984 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dialog/dist/index.d.ts @@ -0,0 +1,99 @@ +import * as _radix_ui_react_context from '@radix-ui/react-context'; +import { Scope } from '@radix-ui/react-context'; +import * as React from 'react'; +import { DismissableLayer } from '@radix-ui/react-dismissable-layer'; +import { FocusScope } from '@radix-ui/react-focus-scope'; +import { Portal } from '@radix-ui/react-portal'; +import { Primitive } from '@radix-ui/react-primitive'; + +type ScopedProps

= P & { + __scopeDialog?: Scope | undefined; +}; +declare const createDialogScope: _radix_ui_react_context.CreateScope; +interface DialogProps { + children?: React.ReactNode | undefined; + open?: boolean | undefined; + defaultOpen?: boolean | undefined; + onOpenChange?: ((open: boolean) => void) | undefined; + modal?: boolean | undefined; +} +declare const Dialog: React.FC; +type PrimitiveButtonProps = React.ComponentPropsWithoutRef; +interface DialogTriggerProps extends PrimitiveButtonProps { +} +declare const DialogTrigger: React.ForwardRefExoticComponent>; +type PortalProps = React.ComponentPropsWithoutRef; +interface DialogPortalProps { + children?: React.ReactNode | undefined; + /** + * Specify a container element to portal the content into. + */ + container?: PortalProps['container'] | undefined; + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const DialogPortal: React.FC; +interface DialogOverlayProps extends DialogOverlayImplProps { + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const DialogOverlay: React.ForwardRefExoticComponent>; +type PrimitiveDivProps = React.ComponentPropsWithoutRef; +interface DialogOverlayImplProps extends PrimitiveDivProps { +} +interface DialogContentProps extends DialogContentTypeProps { + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const DialogContent: React.ForwardRefExoticComponent>; +interface DialogContentTypeProps extends Omit { +} +type DismissableLayerProps = React.ComponentPropsWithoutRef; +type FocusScopeProps = React.ComponentPropsWithoutRef; +interface DialogContentImplProps extends Omit { + /** + * When `true`, focus cannot escape the `Content` via keyboard, + * pointer, or a programmatic focus. + * @defaultValue false + */ + trapFocus?: FocusScopeProps['trapped'] | undefined; + /** + * Event handler called when auto-focusing on open. + * Can be prevented. + */ + onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'] | undefined; + /** + * Event handler called when auto-focusing on close. + * Can be prevented. + */ + onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'] | undefined; +} +type PrimitiveHeading2Props = React.ComponentPropsWithoutRef; +interface DialogTitleProps extends PrimitiveHeading2Props { +} +declare const DialogTitle: React.ForwardRefExoticComponent>; +type PrimitiveParagraphProps = React.ComponentPropsWithoutRef; +interface DialogDescriptionProps extends PrimitiveParagraphProps { +} +declare const DialogDescription: React.ForwardRefExoticComponent>; +interface DialogCloseProps extends PrimitiveButtonProps { +} +declare const DialogClose: React.ForwardRefExoticComponent>; +/** @deprecated Noop component to avoid breaking changes. */ +declare const WarningProvider: React.FC>; + +export { DialogClose as Close, DialogContent as Content, DialogDescription as Description, Dialog, DialogClose, type DialogCloseProps, DialogContent, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogOverlay, type DialogOverlayProps, DialogPortal, type DialogPortalProps, type DialogProps, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerProps, DialogOverlay as Overlay, DialogPortal as Portal, Dialog as Root, DialogTitle as Title, DialogTrigger as Trigger, WarningProvider, createDialogScope }; diff --git a/e-commerce/node_modules/@radix-ui/react-dialog/dist/index.js b/e-commerce/node_modules/@radix-ui/react-dialog/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c5732fd5d7227eee94a3784a2f8b8b1e474ba8ed --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dialog/dist/index.js @@ -0,0 +1,381 @@ +"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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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, { + Close: () => DialogClose, + Content: () => DialogContent, + Description: () => DialogDescription, + Dialog: () => Dialog, + DialogClose: () => DialogClose, + DialogContent: () => DialogContent, + DialogDescription: () => DialogDescription, + DialogOverlay: () => DialogOverlay, + DialogPortal: () => DialogPortal, + DialogTitle: () => DialogTitle, + DialogTrigger: () => DialogTrigger, + Overlay: () => DialogOverlay, + Portal: () => DialogPortal, + Root: () => Dialog, + Title: () => DialogTitle, + Trigger: () => DialogTrigger, + WarningProvider: () => WarningProvider, + createDialogScope: () => createDialogScope +}); +module.exports = __toCommonJS(index_exports); + +// src/dialog.tsx +var React = __toESM(require("react")); +var import_primitive = require("@radix-ui/primitive"); +var import_react_compose_refs = require("@radix-ui/react-compose-refs"); +var import_react_context = require("@radix-ui/react-context"); +var import_react_id = require("@radix-ui/react-id"); +var import_react_use_controllable_state = require("@radix-ui/react-use-controllable-state"); +var import_react_dismissable_layer = require("@radix-ui/react-dismissable-layer"); +var import_react_focus_scope = require("@radix-ui/react-focus-scope"); +var import_react_portal = require("@radix-ui/react-portal"); +var import_react_presence = require("@radix-ui/react-presence"); +var import_react_primitive = require("@radix-ui/react-primitive"); +var import_react_focus_guards = require("@radix-ui/react-focus-guards"); +var import_react_use_layout_effect = require("@radix-ui/react-use-layout-effect"); +var import_react_remove_scroll = require("react-remove-scroll"); +var import_aria_hidden = require("aria-hidden"); +var import_react_slot = require("@radix-ui/react-slot"); +var import_jsx_runtime = require("react/jsx-runtime"); +var DIALOG_NAME = "Dialog"; +var [createDialogContext, createDialogScope] = (0, import_react_context.createContextScope)(DIALOG_NAME); +var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME); +var Dialog = /* @__PURE__ */ __name((props) => { + const { + __scopeDialog, + children, + open: openProp, + defaultOpen, + onOpenChange, + modal = true + } = props; + const triggerRef = React.useRef(null); + const contentRef = React.useRef(null); + const { nodes: branchNodes, registry: branchRegistry } = (0, import_react_focus_scope.useFocusScopeBranchRegistry)(); + const [open, setOpen] = (0, import_react_use_controllable_state.useControllableState)({ + prop: openProp, + defaultProp: defaultOpen ?? false, + onChange: onOpenChange, + caller: DIALOG_NAME + }); + const [titleCount, setTitleCount] = React.useState(0); + const [descriptionCount, setDescriptionCount] = React.useState(0); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + DialogProvider, + { + scope: __scopeDialog, + triggerRef, + contentRef, + contentId: (0, import_react_id.useId)(), + titleId: (0, import_react_id.useId)(), + descriptionId: (0, import_react_id.useId)(), + titlePresent: titleCount > 0, + descriptionPresent: descriptionCount > 0, + setTitleCount, + setDescriptionCount, + open, + onOpenChange: setOpen, + onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]), + modal, + branchNodes, + branchRegistry, + children + } + ); +}, "Dialog"); +var TRIGGER_NAME = "DialogTrigger"; +var DialogTrigger = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function DialogTrigger2(props, forwardedRef) { + const { __scopeDialog, ...triggerProps } = props; + const context = useDialogContext(TRIGGER_NAME, __scopeDialog); + const composedTriggerRef = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, context.triggerRef); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.button, + { + type: "button", + "aria-haspopup": "dialog", + "aria-expanded": context.open, + "aria-controls": context.open ? context.contentId : void 0, + "data-state": getState(context.open), + ...triggerProps, + ref: composedTriggerRef, + onClick: (0, import_primitive.composeEventHandlers)(props.onClick, context.onOpenToggle) + } + ); + }, "DialogTrigger") +); +var PORTAL_NAME = "DialogPortal"; +var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, { + forceMount: void 0 +}); +var DialogPortal = /* @__PURE__ */ __name((props) => { + const { __scopeDialog, forceMount, children, container } = props; + const context = useDialogContext(PORTAL_NAME, __scopeDialog); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PortalProvider, { scope: __scopeDialog, forceMount, children: React.Children.map(children, (child) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || context.open, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_portal.Portal, { asChild: true, container, children: child }) })) }); +}, "DialogPortal"); +var OVERLAY_NAME = "DialogOverlay"; +var DialogOverlay = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function DialogOverlay2(props, forwardedRef) { + const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog); + const { forceMount = portalContext.forceMount, ...overlayProps } = props; + const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog); + return context.modal ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || context.open, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null; + }, "DialogOverlay") +); +var Slot = (0, import_react_slot.createSlot)("DialogOverlay.RemoveScroll"); +var DialogOverlayImpl = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DialogOverlayImpl2(props, forwardedRef) { + const { __scopeDialog, ...overlayProps } = props; + const context = useDialogContext(OVERLAY_NAME, __scopeDialog); + const registerDismissableSurface = (0, import_react_dismissable_layer.useDismissableLayerSurface)(); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, registerDismissableSurface); + return ( + // Make sure `Content` is scrollable even when it doesn't live inside + // `RemoveScroll` (eg. when `Overlay` and `Content` are siblings). Nested + // layers are registered as branches and added as shards so they remain + // scrollable too. See https://github.com/radix-ui/primitives/issues/3423 + /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_remove_scroll.RemoveScroll, + { + as: Slot, + allowPinchZoom: true, + shards: React.useMemo( + () => [context.contentRef, ...context.branchNodes.map((node) => ({ current: node }))], + [context.contentRef, context.branchNodes] + ), + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.div, + { + "data-state": getState(context.open), + ...overlayProps, + ref: composedRefs, + style: { pointerEvents: "auto", ...overlayProps.style } + } + ) + } + ) + ); + }, "DialogOverlayImpl") +); +var CONTENT_NAME = "DialogContent"; +var DialogContent = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function DialogContent2(props, forwardedRef) { + const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog); + const { forceMount = portalContext.forceMount, ...contentProps } = props; + const context = useDialogContext(CONTENT_NAME, props.__scopeDialog); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) }); + }, "DialogContent") +); +var DialogContentModal = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DialogContentModal2(props, forwardedRef) { + const context = useDialogContext(CONTENT_NAME, props.__scopeDialog); + const contentRef = React.useRef(null); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, context.contentRef, contentRef); + React.useEffect(() => { + const content = contentRef.current; + if (content) return (0, import_aria_hidden.hideOthers)(content); + }, []); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + DialogContentImpl, + { + ...props, + ref: composedRefs, + trapFocus: context.open, + disableOutsidePointerEvents: context.open, + onCloseAutoFocus: (0, import_primitive.composeEventHandlers)(props.onCloseAutoFocus, (event) => { + event.preventDefault(); + context.triggerRef.current?.focus(); + }), + onPointerDownOutside: (0, import_primitive.composeEventHandlers)(props.onPointerDownOutside, (event) => { + const originalEvent = event.detail.originalEvent; + const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true; + const isRightClick = originalEvent.button === 2 || ctrlLeftClick; + if (isRightClick) event.preventDefault(); + }), + onFocusOutside: (0, import_primitive.composeEventHandlers)( + props.onFocusOutside, + (event) => event.preventDefault() + ) + } + ); + }, "DialogContentModal") +); +var DialogContentNonModal = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DialogContentNonModal2(props, forwardedRef) { + const context = useDialogContext(CONTENT_NAME, props.__scopeDialog); + const hasInteractedOutsideRef = React.useRef(false); + const hasPointerDownOutsideRef = React.useRef(false); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + DialogContentImpl, + { + ...props, + ref: forwardedRef, + trapFocus: false, + disableOutsidePointerEvents: false, + onCloseAutoFocus: (event) => { + props.onCloseAutoFocus?.(event); + if (!event.defaultPrevented) { + if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus(); + event.preventDefault(); + } + hasInteractedOutsideRef.current = false; + hasPointerDownOutsideRef.current = false; + }, + onInteractOutside: (event) => { + props.onInteractOutside?.(event); + if (!event.defaultPrevented) { + hasInteractedOutsideRef.current = true; + if (event.detail.originalEvent.type === "pointerdown") { + hasPointerDownOutsideRef.current = true; + } + } + const target = event.target; + const targetIsTrigger = context.triggerRef.current?.contains(target); + if (targetIsTrigger) event.preventDefault(); + if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) { + event.preventDefault(); + } + } + } + ); + }, "DialogContentNonModal") +); +var DialogContentImpl = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DialogContentImpl2(props, forwardedRef) { + const { + __scopeDialog, + trapFocus, + onOpenAutoFocus, + onCloseAutoFocus, + "aria-describedby": ariaDescribedby, + children, + ...contentProps + } = props; + const context = useDialogContext(CONTENT_NAME, __scopeDialog); + (0, import_react_focus_guards.useFocusGuards)(); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_focus_scope.FocusScopeBranchProvider, { registry: context.branchRegistry, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_focus_scope.FocusScope, + { + asChild: true, + loop: true, + trapped: trapFocus, + branches: context.branchNodes, + onMountAutoFocus: onOpenAutoFocus, + onUnmountAutoFocus: onCloseAutoFocus, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_dismissable_layer.DismissableLayer, + { + role: "dialog", + id: context.contentId, + "aria-labelledby": context.titlePresent ? context.titleId : void 0, + "aria-describedby": context.descriptionPresent ? concatAriaDescribedby(ariaDescribedby, context.descriptionId) : ariaDescribedby, + "data-state": getState(context.open), + ...contentProps, + ref: forwardedRef, + deferPointerDownOutside: true, + onDismiss: () => context.onOpenChange(false), + children + } + ) + } + ) }); + }, "DialogContentImpl") +); +var DialogTitle = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function DialogTitle2(props, forwardedRef) { + const { __scopeDialog, ...titleProps } = props; + const context = useDialogContext("DialogTitle", __scopeDialog); + const { setTitleCount } = context; + (0, import_react_use_layout_effect.useLayoutEffect)(() => { + setTitleCount((count) => count + 1); + return () => setTitleCount((count) => count - 1); + }, [setTitleCount]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef }); + }, "DialogTitle") +); +var DialogDescription = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DialogDescription2(props, forwardedRef) { + const { __scopeDialog, ...descriptionProps } = props; + const context = useDialogContext("DialogDescription", __scopeDialog); + const { setDescriptionCount } = context; + (0, import_react_use_layout_effect.useLayoutEffect)(() => { + setDescriptionCount((count) => count + 1); + return () => setDescriptionCount((count) => count - 1); + }, [setDescriptionCount]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef }); + }, "DialogDescription") +); +var CLOSE_NAME = "DialogClose"; +var DialogClose = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function DialogClose2(props, forwardedRef) { + const { __scopeDialog, ...closeProps } = props; + const context = useDialogContext(CLOSE_NAME, __scopeDialog); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.button, + { + type: "button", + ...closeProps, + ref: forwardedRef, + onClick: (0, import_primitive.composeEventHandlers)(props.onClick, () => context.onOpenChange(false)) + } + ); + }, "DialogClose") +); +var WarningProvider = /* @__PURE__ */ __name((props) => { + return props.children; +}, "WarningProvider"); +function concatAriaDescribedby(...values) { + const ids = /* @__PURE__ */ new Set(); + for (const value of values) { + if (typeof value !== "string") continue; + for (const id of String(value).trim().split(/\s+/)) { + if (id) ids.add(id); + } + } + return ids.size > 0 ? Array.from(ids).join(" ") : void 0; +} +__name(concatAriaDescribedby, "concatAriaDescribedby"); +function getState(open) { + return open ? "open" : "closed"; +} +__name(getState, "getState"); +//# sourceMappingURL=index.js.map diff --git a/e-commerce/node_modules/@radix-ui/react-dialog/dist/index.js.map b/e-commerce/node_modules/@radix-ui/react-dialog/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..48a0d28ee1f47210ad3b71120d16a56abd720d68 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dialog/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts", "../src/dialog.tsx"], + "sourcesContent": ["'use client';\nexport {\n createDialogScope,\n //\n Dialog,\n DialogTrigger,\n DialogPortal,\n DialogOverlay,\n DialogContent,\n DialogTitle,\n DialogDescription,\n DialogClose,\n //\n Root,\n Trigger,\n Portal,\n Overlay,\n Content,\n Title,\n Description,\n Close,\n /** @deprecated Noop component to avoid breaking changes. */\n WarningProvider,\n} from './dialog';\nexport type {\n DialogProps,\n DialogTriggerProps,\n DialogPortalProps,\n DialogOverlayProps,\n DialogContentProps,\n DialogTitleProps,\n DialogDescriptionProps,\n DialogCloseProps,\n} from './dialog';\n", "import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useId } from '@radix-ui/react-id';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { DismissableLayer, useDismissableLayerSurface } from '@radix-ui/react-dismissable-layer';\nimport {\n FocusScope,\n FocusScopeBranchProvider,\n useFocusScopeBranchRegistry,\n} from '@radix-ui/react-focus-scope';\nimport { Portal as PortalPrimitive } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { RemoveScroll } from 'react-remove-scroll';\nimport { hideOthers } from 'aria-hidden';\nimport { createSlot } from '@radix-ui/react-slot';\n\nimport type { Scope } from '@radix-ui/react-context';\nimport type { FocusScopeBranchRegistry } from '@radix-ui/react-focus-scope';\n\n/* -------------------------------------------------------------------------------------------------\n * Dialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst DIALOG_NAME = 'Dialog';\n\ntype ScopedProps

= P & { __scopeDialog?: Scope | undefined };\nconst [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);\n\ntype DialogContextValue = {\n triggerRef: React.RefObject;\n contentRef: React.RefObject;\n contentId: string;\n titleId: string;\n descriptionId: string;\n titlePresent: boolean;\n descriptionPresent: boolean;\n setTitleCount: React.Dispatch>;\n setDescriptionCount: React.Dispatch>;\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpenToggle(): void;\n modal: boolean;\n // Nodes of nested, portalled layers (eg. a non-modal `Popover`) that should\n // be treated as part of this Dialog for focus trapping and scroll locking.\n // See https://github.com/radix-ui/primitives/issues/3423\n branchNodes: HTMLElement[];\n branchRegistry: FocusScopeBranchRegistry;\n};\n\nconst [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);\n\ninterface DialogProps {\n children?: React.ReactNode | undefined;\n open?: boolean | undefined;\n defaultOpen?: boolean | undefined;\n onOpenChange?: ((open: boolean) => void) | undefined;\n modal?: boolean | undefined;\n}\n\nconst Dialog: React.FC = (props: ScopedProps) => {\n const {\n __scopeDialog,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = true,\n } = props;\n const triggerRef = React.useRef(null);\n const contentRef = React.useRef(null);\n const { nodes: branchNodes, registry: branchRegistry } = useFocusScopeBranchRegistry();\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n caller: DIALOG_NAME,\n });\n\n const [titleCount, setTitleCount] = React.useState(0);\n const [descriptionCount, setDescriptionCount] = React.useState(0);\n\n return (\n 0}\n descriptionPresent={descriptionCount > 0}\n setTitleCount={setTitleCount}\n setDescriptionCount={setDescriptionCount}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n modal={modal}\n branchNodes={branchNodes}\n branchRegistry={branchRegistry}\n >\n {children}\n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DialogTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'DialogTrigger';\n\ntype DialogTriggerElement = React.ComponentRef;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef;\ninterface DialogTriggerProps extends PrimitiveButtonProps {}\n\nconst DialogTrigger = /* @__PURE__ */ React.forwardRef(\n function DialogTrigger(props: ScopedProps, forwardedRef) {\n const { __scopeDialog, ...triggerProps } = props;\n const context = useDialogContext(TRIGGER_NAME, __scopeDialog);\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);\n return (\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'DialogPortal';\n\ntype PortalContextValue = { forceMount?: true | undefined };\nconst [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, {\n forceMount: undefined,\n});\n\ntype PortalProps = React.ComponentPropsWithoutRef;\ninterface DialogPortalProps {\n children?: React.ReactNode | undefined;\n /**\n * Specify a container element to portal the content into.\n */\n container?: PortalProps['container'] | undefined;\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst DialogPortal: React.FC = (props: ScopedProps) => {\n const { __scopeDialog, forceMount, children, container } = props;\n const context = useDialogContext(PORTAL_NAME, __scopeDialog);\n return (\n \n {React.Children.map(children, (child) => (\n \n \n {child}\n \n \n ))}\n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'DialogOverlay';\n\ntype DialogOverlayElement = DialogOverlayImplElement;\ninterface DialogOverlayProps extends DialogOverlayImplProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst DialogOverlay = /* @__PURE__ */ React.forwardRef(\n function DialogOverlay(props: ScopedProps, forwardedRef) {\n const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);\n const { forceMount = portalContext.forceMount, ...overlayProps } = props;\n const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);\n return context.modal ? (\n \n \n \n ) : null;\n },\n);\n\ntype DialogOverlayImplElement = React.ComponentRef;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef;\ninterface DialogOverlayImplProps extends PrimitiveDivProps {}\n\nconst Slot = createSlot('DialogOverlay.RemoveScroll');\n\nconst DialogOverlayImpl = /* @__PURE__ */ React.forwardRef<\n DialogOverlayImplElement,\n DialogOverlayImplProps\n>(\n // blank line to reduce diff noise\n function DialogOverlayImpl(props: ScopedProps, forwardedRef) {\n const { __scopeDialog, ...overlayProps } = props;\n const context = useDialogContext(OVERLAY_NAME, __scopeDialog);\n\n // Register the overlay as a dismiss surface so a consumer calling\n // `stopPropagation` on it (eg. to avoid triggering parent handlers) does not\n // prevent the dialog from closing. See: https://github.com/radix-ui/primitives/issues/3346\n const registerDismissableSurface = useDismissableLayerSurface();\n const composedRefs = useComposedRefs(forwardedRef, registerDismissableSurface);\n\n return (\n // Make sure `Content` is scrollable even when it doesn't live inside\n // `RemoveScroll` (eg. when `Overlay` and `Content` are siblings). Nested\n // layers are registered as branches and added as shards so they remain\n // scrollable too. See https://github.com/radix-ui/primitives/issues/3423\n [context.contentRef, ...context.branchNodes.map((node) => ({ current: node }))],\n [context.contentRef, context.branchNodes],\n )}\n >\n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'DialogContent';\n\ntype DialogContentElement = DialogContentTypeElement;\ninterface DialogContentProps extends DialogContentTypeProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst DialogContent = /* @__PURE__ */ React.forwardRef(\n function DialogContent(props: ScopedProps, forwardedRef) {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n return (\n \n {context.modal ? (\n \n ) : (\n \n )}\n \n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype DialogContentTypeElement = DialogContentImplElement;\ninterface DialogContentTypeProps extends Omit<\n DialogContentImplProps,\n 'trapFocus' | 'disableOutsidePointerEvents'\n> {}\n\nconst DialogContentModal = /* @__PURE__ */ React.forwardRef<\n DialogContentTypeElement,\n DialogContentTypeProps\n>(\n // blank line to reduce diff noise\n function DialogContentModal(props: ScopedProps, forwardedRef) {\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n const contentRef = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n const content = contentRef.current;\n if (content) return hideOthers(content);\n }, []);\n\n return (\n {\n event.preventDefault();\n context.triggerRef.current?.focus();\n })}\n onPointerDownOutside={composeEventHandlers(props.onPointerDownOutside, (event) => {\n const originalEvent = event.detail.originalEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n\n // If the event is a right-click, we shouldn't close because\n // it is effectively as if we right-clicked the `Overlay`.\n if (isRightClick) event.preventDefault();\n })}\n // When focus is trapped, a `focusout` event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={composeEventHandlers(props.onFocusOutside, (event) =>\n event.preventDefault(),\n )}\n />\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst DialogContentNonModal = /* @__PURE__ */ React.forwardRef<\n DialogContentTypeElement,\n DialogContentTypeProps\n>(\n // blank line to reduce diff noise\n function DialogContentNonModal(props: ScopedProps, forwardedRef) {\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n const hasInteractedOutsideRef = React.useRef(false);\n const hasPointerDownOutsideRef = React.useRef(false);\n\n return (\n {\n props.onCloseAutoFocus?.(event);\n\n if (!event.defaultPrevented) {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault();\n }\n\n hasInteractedOutsideRef.current = false;\n hasPointerDownOutsideRef.current = false;\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event);\n\n if (!event.defaultPrevented) {\n hasInteractedOutsideRef.current = true;\n if (event.detail.originalEvent.type === 'pointerdown') {\n hasPointerDownOutsideRef.current = true;\n }\n }\n\n // Prevent dismissing when clicking the trigger.\n // As the trigger is already setup to close, without doing so would\n // cause it to close and immediately open.\n const target = event.target as HTMLElement;\n const targetIsTrigger = context.triggerRef.current?.contains(target);\n if (targetIsTrigger) event.preventDefault();\n\n // On Safari if the trigger is inside a container with tabIndex={0}, when clicked\n // we will get the pointer down outside event on the trigger, but then a subsequent\n // focus outside event on the container, we ignore any focus outside event when we've\n // already had a pointer down outside event.\n if (event.detail.originalEvent.type === 'focusin' && hasPointerDownOutsideRef.current) {\n event.preventDefault();\n }\n }}\n />\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype DialogContentImplElement = React.ComponentRef;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef;\ntype FocusScopeProps = React.ComponentPropsWithoutRef;\ninterface DialogContentImplProps extends Omit {\n /**\n * When `true`, focus cannot escape the `Content` via keyboard,\n * pointer, or a programmatic focus.\n * @defaultValue false\n */\n trapFocus?: FocusScopeProps['trapped'] | undefined;\n\n /**\n * Event handler called when auto-focusing on open.\n * Can be prevented.\n */\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'] | undefined;\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'] | undefined;\n}\n\nconst DialogContentImpl = /* @__PURE__ */ React.forwardRef<\n DialogContentImplElement,\n DialogContentImplProps\n>(\n // blank line to reduce diff noise\n function DialogContentImpl(props: ScopedProps, forwardedRef) {\n const {\n __scopeDialog,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n 'aria-describedby': ariaDescribedby,\n children,\n ...contentProps\n } = props;\n const context = useDialogContext(CONTENT_NAME, __scopeDialog);\n\n // Make sure the whole tree has focus guards as our `Dialog` will be\n // the last element in the DOM (because of the `Portal`)\n useFocusGuards();\n\n return (\n \n \n context.onOpenChange(false)}\n >\n {children}\n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\ntype DialogTitleElement = React.ComponentRef;\ntype PrimitiveHeading2Props = React.ComponentPropsWithoutRef;\ninterface DialogTitleProps extends PrimitiveHeading2Props {}\n\nconst DialogTitle = /* @__PURE__ */ React.forwardRef(\n function DialogTitle(props: ScopedProps, forwardedRef) {\n const { __scopeDialog, ...titleProps } = props;\n const context = useDialogContext('DialogTitle', __scopeDialog);\n const { setTitleCount } = context;\n useLayoutEffect(() => {\n setTitleCount((count) => count + 1);\n return () => setTitleCount((count) => count - 1);\n }, [setTitleCount]);\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\ntype DialogDescriptionElement = React.ComponentRef;\ntype PrimitiveParagraphProps = React.ComponentPropsWithoutRef;\ninterface DialogDescriptionProps extends PrimitiveParagraphProps {}\n\nconst DialogDescription = /* @__PURE__ */ React.forwardRef<\n DialogDescriptionElement,\n DialogDescriptionProps\n>(\n // blank line to reduce diff noise\n function DialogDescription(props: ScopedProps, forwardedRef) {\n const { __scopeDialog, ...descriptionProps } = props;\n const context = useDialogContext('DialogDescription', __scopeDialog);\n const { setDescriptionCount } = context;\n useLayoutEffect(() => {\n setDescriptionCount((count) => count + 1);\n return () => setDescriptionCount((count) => count - 1);\n }, [setDescriptionCount]);\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'DialogClose';\n\ntype DialogCloseElement = React.ComponentRef;\ninterface DialogCloseProps extends PrimitiveButtonProps {}\n\nconst DialogClose = /* @__PURE__ */ React.forwardRef(\n function DialogClose(props: ScopedProps, forwardedRef) {\n const { __scopeDialog, ...closeProps } = props;\n const context = useDialogContext(CLOSE_NAME, __scopeDialog);\n return (\n context.onOpenChange(false))}\n />\n );\n },\n);\n\n/** @deprecated Noop component to avoid breaking changes. */\nexport const WarningProvider: React.FC<\n ScopedProps<{\n children?: React.ReactNode | undefined;\n contentName: string;\n titleName: string;\n docsSlug: 'dialog';\n }>\n> = (props) => {\n return props.children;\n};\n\n/* -----------------------------------------------------------------------------------------------*/\n\n// TODO: Move to primitive once that package exposed individual sub-modules\nfunction concatAriaDescribedby(...values: unknown[]): string | undefined {\n const ids = new Set();\n for (const value of values) {\n if (typeof value !== 'string') continue;\n for (const id of String(value).trim().split(/\\s+/)) {\n if (id) ids.add(id);\n }\n }\n\n return ids.size > 0 ? Array.from(ids).join(' ') : undefined;\n}\n\nfunction getState(open: boolean) {\n return open ? 'open' : 'closed';\n}\n\nexport {\n createDialogScope,\n //\n Dialog,\n DialogTrigger,\n DialogPortal,\n DialogOverlay,\n DialogContent,\n DialogTitle,\n DialogDescription,\n DialogClose,\n //\n Dialog as Root,\n DialogTrigger as Trigger,\n DialogPortal as Portal,\n DialogOverlay as Overlay,\n DialogContent as Content,\n DialogTitle as Title,\n DialogDescription as Description,\n DialogClose as Close,\n};\nexport type {\n DialogProps,\n DialogTriggerProps,\n DialogPortalProps,\n DialogOverlayProps,\n DialogContentProps,\n DialogTitleProps,\n DialogDescriptionProps,\n DialogCloseProps,\n};\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,uBAAqC;AACrC,gCAAgC;AAChC,2BAAmC;AACnC,sBAAsB;AACtB,0CAAqC;AACrC,qCAA6D;AAC7D,+BAIO;AACP,0BAA0C;AAC1C,4BAAyB;AACzB,6BAA0B;AAC1B,gCAA+B;AAC/B,qCAAgC;AAChC,iCAA6B;AAC7B,yBAA2B;AAC3B,wBAA2B;AAoEvB;AA3DJ,IAAM,cAAc;AAGpB,IAAM,CAAC,qBAAqB,iBAAiB,QAAI,yCAAmB,WAAW;AAuB/E,IAAM,CAAC,gBAAgB,gBAAgB,IAAI,oBAAwC,WAAW;AAU9F,IAAM,SAAgC,wBAAC,UAAoC;AACzE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IAC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OT,wBAAC,UAAU;AACb,SAAO,MAAM;AACf,GAFI;AAOJ,SAAS,yBAAyB,QAAuC;AACvE,QAAM,MAAM,oBAAI,IAAY;AAC5B,aAAW,SAAS,QAAQ;AAC1B,QAAI,OAAO,UAAU,SAAU;AAC/B,eAAW,MAAM,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,GAAG;AAClD,UAAI,GAAI,KAAI,IAAI,EAAE;AAAA,IACpB;AAAA,EACF;AAEA,SAAO,IAAI,OAAO,IAAI,MAAM,KAAK,GAAG,EAAE,KAAK,GAAG,IAAI;AACpD;AAVS;AAYT,SAAS,SAAS,MAAe;AAC/B,SAAO,OAAO,SAAS;AACzB;AAFS;", + "names": ["DialogTrigger", "PortalPrimitive", "DialogOverlay", "DialogOverlayImpl", "DialogContent", "DialogContentModal", "DialogContentNonModal", "DialogContentImpl", "DialogTitle", "DialogDescription", "DialogClose"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-dialog/dist/index.mjs b/e-commerce/node_modules/@radix-ui/react-dialog/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4291db7bf7fab93f4b07d8c9d23e07fceed89e79 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dialog/dist/index.mjs @@ -0,0 +1,354 @@ +"use client"; +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// src/dialog.tsx +import * as React from "react"; +import { composeEventHandlers } from "@radix-ui/primitive"; +import { useComposedRefs } from "@radix-ui/react-compose-refs"; +import { createContextScope } from "@radix-ui/react-context"; +import { useId } from "@radix-ui/react-id"; +import { useControllableState } from "@radix-ui/react-use-controllable-state"; +import { DismissableLayer, useDismissableLayerSurface } from "@radix-ui/react-dismissable-layer"; +import { + FocusScope, + FocusScopeBranchProvider, + useFocusScopeBranchRegistry +} from "@radix-ui/react-focus-scope"; +import { Portal as PortalPrimitive } from "@radix-ui/react-portal"; +import { Presence } from "@radix-ui/react-presence"; +import { Primitive } from "@radix-ui/react-primitive"; +import { useFocusGuards } from "@radix-ui/react-focus-guards"; +import { useLayoutEffect } from "@radix-ui/react-use-layout-effect"; +import { RemoveScroll } from "react-remove-scroll"; +import { hideOthers } from "aria-hidden"; +import { createSlot } from "@radix-ui/react-slot"; +import { jsx } from "react/jsx-runtime"; +var DIALOG_NAME = "Dialog"; +var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME); +var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME); +var Dialog = /* @__PURE__ */ __name((props) => { + const { + __scopeDialog, + children, + open: openProp, + defaultOpen, + onOpenChange, + modal = true + } = props; + const triggerRef = React.useRef(null); + const contentRef = React.useRef(null); + const { nodes: branchNodes, registry: branchRegistry } = useFocusScopeBranchRegistry(); + const [open, setOpen] = useControllableState({ + prop: openProp, + defaultProp: defaultOpen ?? false, + onChange: onOpenChange, + caller: DIALOG_NAME + }); + const [titleCount, setTitleCount] = React.useState(0); + const [descriptionCount, setDescriptionCount] = React.useState(0); + return /* @__PURE__ */ jsx( + DialogProvider, + { + scope: __scopeDialog, + triggerRef, + contentRef, + contentId: useId(), + titleId: useId(), + descriptionId: useId(), + titlePresent: titleCount > 0, + descriptionPresent: descriptionCount > 0, + setTitleCount, + setDescriptionCount, + open, + onOpenChange: setOpen, + onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]), + modal, + branchNodes, + branchRegistry, + children + } + ); +}, "Dialog"); +var TRIGGER_NAME = "DialogTrigger"; +var DialogTrigger = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function DialogTrigger2(props, forwardedRef) { + const { __scopeDialog, ...triggerProps } = props; + const context = useDialogContext(TRIGGER_NAME, __scopeDialog); + const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef); + return /* @__PURE__ */ jsx( + Primitive.button, + { + type: "button", + "aria-haspopup": "dialog", + "aria-expanded": context.open, + "aria-controls": context.open ? context.contentId : void 0, + "data-state": getState(context.open), + ...triggerProps, + ref: composedTriggerRef, + onClick: composeEventHandlers(props.onClick, context.onOpenToggle) + } + ); + }, "DialogTrigger") +); +var PORTAL_NAME = "DialogPortal"; +var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, { + forceMount: void 0 +}); +var DialogPortal = /* @__PURE__ */ __name((props) => { + const { __scopeDialog, forceMount, children, container } = props; + const context = useDialogContext(PORTAL_NAME, __scopeDialog); + return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopeDialog, forceMount, children: React.Children.map(children, (child) => /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(PortalPrimitive, { asChild: true, container, children: child }) })) }); +}, "DialogPortal"); +var OVERLAY_NAME = "DialogOverlay"; +var DialogOverlay = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function DialogOverlay2(props, forwardedRef) { + const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog); + const { forceMount = portalContext.forceMount, ...overlayProps } = props; + const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog); + return context.modal ? /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null; + }, "DialogOverlay") +); +var Slot = createSlot("DialogOverlay.RemoveScroll"); +var DialogOverlayImpl = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DialogOverlayImpl2(props, forwardedRef) { + const { __scopeDialog, ...overlayProps } = props; + const context = useDialogContext(OVERLAY_NAME, __scopeDialog); + const registerDismissableSurface = useDismissableLayerSurface(); + const composedRefs = useComposedRefs(forwardedRef, registerDismissableSurface); + return ( + // Make sure `Content` is scrollable even when it doesn't live inside + // `RemoveScroll` (eg. when `Overlay` and `Content` are siblings). Nested + // layers are registered as branches and added as shards so they remain + // scrollable too. See https://github.com/radix-ui/primitives/issues/3423 + /* @__PURE__ */ jsx( + RemoveScroll, + { + as: Slot, + allowPinchZoom: true, + shards: React.useMemo( + () => [context.contentRef, ...context.branchNodes.map((node) => ({ current: node }))], + [context.contentRef, context.branchNodes] + ), + children: /* @__PURE__ */ jsx( + Primitive.div, + { + "data-state": getState(context.open), + ...overlayProps, + ref: composedRefs, + style: { pointerEvents: "auto", ...overlayProps.style } + } + ) + } + ) + ); + }, "DialogOverlayImpl") +); +var CONTENT_NAME = "DialogContent"; +var DialogContent = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function DialogContent2(props, forwardedRef) { + const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog); + const { forceMount = portalContext.forceMount, ...contentProps } = props; + const context = useDialogContext(CONTENT_NAME, props.__scopeDialog); + return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) }); + }, "DialogContent") +); +var DialogContentModal = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DialogContentModal2(props, forwardedRef) { + const context = useDialogContext(CONTENT_NAME, props.__scopeDialog); + const contentRef = React.useRef(null); + const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef); + React.useEffect(() => { + const content = contentRef.current; + if (content) return hideOthers(content); + }, []); + return /* @__PURE__ */ jsx( + DialogContentImpl, + { + ...props, + ref: composedRefs, + trapFocus: context.open, + disableOutsidePointerEvents: context.open, + onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => { + event.preventDefault(); + context.triggerRef.current?.focus(); + }), + onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => { + const originalEvent = event.detail.originalEvent; + const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true; + const isRightClick = originalEvent.button === 2 || ctrlLeftClick; + if (isRightClick) event.preventDefault(); + }), + onFocusOutside: composeEventHandlers( + props.onFocusOutside, + (event) => event.preventDefault() + ) + } + ); + }, "DialogContentModal") +); +var DialogContentNonModal = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DialogContentNonModal2(props, forwardedRef) { + const context = useDialogContext(CONTENT_NAME, props.__scopeDialog); + const hasInteractedOutsideRef = React.useRef(false); + const hasPointerDownOutsideRef = React.useRef(false); + return /* @__PURE__ */ jsx( + DialogContentImpl, + { + ...props, + ref: forwardedRef, + trapFocus: false, + disableOutsidePointerEvents: false, + onCloseAutoFocus: (event) => { + props.onCloseAutoFocus?.(event); + if (!event.defaultPrevented) { + if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus(); + event.preventDefault(); + } + hasInteractedOutsideRef.current = false; + hasPointerDownOutsideRef.current = false; + }, + onInteractOutside: (event) => { + props.onInteractOutside?.(event); + if (!event.defaultPrevented) { + hasInteractedOutsideRef.current = true; + if (event.detail.originalEvent.type === "pointerdown") { + hasPointerDownOutsideRef.current = true; + } + } + const target = event.target; + const targetIsTrigger = context.triggerRef.current?.contains(target); + if (targetIsTrigger) event.preventDefault(); + if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) { + event.preventDefault(); + } + } + } + ); + }, "DialogContentNonModal") +); +var DialogContentImpl = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DialogContentImpl2(props, forwardedRef) { + const { + __scopeDialog, + trapFocus, + onOpenAutoFocus, + onCloseAutoFocus, + "aria-describedby": ariaDescribedby, + children, + ...contentProps + } = props; + const context = useDialogContext(CONTENT_NAME, __scopeDialog); + useFocusGuards(); + return /* @__PURE__ */ jsx(FocusScopeBranchProvider, { registry: context.branchRegistry, children: /* @__PURE__ */ jsx( + FocusScope, + { + asChild: true, + loop: true, + trapped: trapFocus, + branches: context.branchNodes, + onMountAutoFocus: onOpenAutoFocus, + onUnmountAutoFocus: onCloseAutoFocus, + children: /* @__PURE__ */ jsx( + DismissableLayer, + { + role: "dialog", + id: context.contentId, + "aria-labelledby": context.titlePresent ? context.titleId : void 0, + "aria-describedby": context.descriptionPresent ? concatAriaDescribedby(ariaDescribedby, context.descriptionId) : ariaDescribedby, + "data-state": getState(context.open), + ...contentProps, + ref: forwardedRef, + deferPointerDownOutside: true, + onDismiss: () => context.onOpenChange(false), + children + } + ) + } + ) }); + }, "DialogContentImpl") +); +var DialogTitle = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function DialogTitle2(props, forwardedRef) { + const { __scopeDialog, ...titleProps } = props; + const context = useDialogContext("DialogTitle", __scopeDialog); + const { setTitleCount } = context; + useLayoutEffect(() => { + setTitleCount((count) => count + 1); + return () => setTitleCount((count) => count - 1); + }, [setTitleCount]); + return /* @__PURE__ */ jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef }); + }, "DialogTitle") +); +var DialogDescription = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DialogDescription2(props, forwardedRef) { + const { __scopeDialog, ...descriptionProps } = props; + const context = useDialogContext("DialogDescription", __scopeDialog); + const { setDescriptionCount } = context; + useLayoutEffect(() => { + setDescriptionCount((count) => count + 1); + return () => setDescriptionCount((count) => count - 1); + }, [setDescriptionCount]); + return /* @__PURE__ */ jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef }); + }, "DialogDescription") +); +var CLOSE_NAME = "DialogClose"; +var DialogClose = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function DialogClose2(props, forwardedRef) { + const { __scopeDialog, ...closeProps } = props; + const context = useDialogContext(CLOSE_NAME, __scopeDialog); + return /* @__PURE__ */ jsx( + Primitive.button, + { + type: "button", + ...closeProps, + ref: forwardedRef, + onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false)) + } + ); + }, "DialogClose") +); +var WarningProvider = /* @__PURE__ */ __name((props) => { + return props.children; +}, "WarningProvider"); +function concatAriaDescribedby(...values) { + const ids = /* @__PURE__ */ new Set(); + for (const value of values) { + if (typeof value !== "string") continue; + for (const id of String(value).trim().split(/\s+/)) { + if (id) ids.add(id); + } + } + return ids.size > 0 ? Array.from(ids).join(" ") : void 0; +} +__name(concatAriaDescribedby, "concatAriaDescribedby"); +function getState(open) { + return open ? "open" : "closed"; +} +__name(getState, "getState"); +export { + DialogClose as Close, + DialogContent as Content, + DialogDescription as Description, + Dialog, + DialogClose, + DialogContent, + DialogDescription, + DialogOverlay, + DialogPortal, + DialogTitle, + DialogTrigger, + DialogOverlay as Overlay, + DialogPortal as Portal, + Dialog as Root, + DialogTitle as Title, + DialogTrigger as Trigger, + WarningProvider, + createDialogScope +}; +//# sourceMappingURL=index.mjs.map diff --git a/e-commerce/node_modules/@radix-ui/react-dialog/dist/index.mjs.map b/e-commerce/node_modules/@radix-ui/react-dialog/dist/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..5a323bc74f58f4204861d2ddaf22b93908f556af --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dialog/dist/index.mjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/dialog.tsx"], + "sourcesContent": ["import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useId } from '@radix-ui/react-id';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { DismissableLayer, useDismissableLayerSurface } from '@radix-ui/react-dismissable-layer';\nimport {\n FocusScope,\n FocusScopeBranchProvider,\n useFocusScopeBranchRegistry,\n} from '@radix-ui/react-focus-scope';\nimport { Portal as PortalPrimitive } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { RemoveScroll } from 'react-remove-scroll';\nimport { hideOthers } from 'aria-hidden';\nimport { createSlot } from '@radix-ui/react-slot';\n\nimport type { Scope } from '@radix-ui/react-context';\nimport type { FocusScopeBranchRegistry } from '@radix-ui/react-focus-scope';\n\n/* -------------------------------------------------------------------------------------------------\n * Dialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst DIALOG_NAME = 'Dialog';\n\ntype ScopedProps

= P & { __scopeDialog?: Scope | undefined };\nconst [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);\n\ntype DialogContextValue = {\n triggerRef: React.RefObject;\n contentRef: React.RefObject;\n contentId: string;\n titleId: string;\n descriptionId: string;\n titlePresent: boolean;\n descriptionPresent: boolean;\n setTitleCount: React.Dispatch>;\n setDescriptionCount: React.Dispatch>;\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpenToggle(): void;\n modal: boolean;\n // Nodes of nested, portalled layers (eg. a non-modal `Popover`) that should\n // be treated as part of this Dialog for focus trapping and scroll locking.\n // See https://github.com/radix-ui/primitives/issues/3423\n branchNodes: HTMLElement[];\n branchRegistry: FocusScopeBranchRegistry;\n};\n\nconst [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);\n\ninterface DialogProps {\n children?: React.ReactNode | undefined;\n open?: boolean | undefined;\n defaultOpen?: boolean | undefined;\n onOpenChange?: ((open: boolean) => void) | undefined;\n modal?: boolean | undefined;\n}\n\nconst Dialog: React.FC = (props: ScopedProps) => {\n const {\n __scopeDialog,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = true,\n } = props;\n const triggerRef = React.useRef(null);\n const contentRef = React.useRef(null);\n const { nodes: branchNodes, registry: branchRegistry } = useFocusScopeBranchRegistry();\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n caller: DIALOG_NAME,\n });\n\n const [titleCount, setTitleCount] = React.useState(0);\n const [descriptionCount, setDescriptionCount] = React.useState(0);\n\n return (\n 0}\n descriptionPresent={descriptionCount > 0}\n setTitleCount={setTitleCount}\n setDescriptionCount={setDescriptionCount}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n modal={modal}\n branchNodes={branchNodes}\n branchRegistry={branchRegistry}\n >\n {children}\n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DialogTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'DialogTrigger';\n\ntype DialogTriggerElement = React.ComponentRef;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef;\ninterface DialogTriggerProps extends PrimitiveButtonProps {}\n\nconst DialogTrigger = /* @__PURE__ */ React.forwardRef(\n function DialogTrigger(props: ScopedProps, forwardedRef) {\n const { __scopeDialog, ...triggerProps } = props;\n const context = useDialogContext(TRIGGER_NAME, __scopeDialog);\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);\n return (\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'DialogPortal';\n\ntype PortalContextValue = { forceMount?: true | undefined };\nconst [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, {\n forceMount: undefined,\n});\n\ntype PortalProps = React.ComponentPropsWithoutRef;\ninterface DialogPortalProps {\n children?: React.ReactNode | undefined;\n /**\n * Specify a container element to portal the content into.\n */\n container?: PortalProps['container'] | undefined;\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst DialogPortal: React.FC = (props: ScopedProps) => {\n const { __scopeDialog, forceMount, children, container } = props;\n const context = useDialogContext(PORTAL_NAME, __scopeDialog);\n return (\n \n {React.Children.map(children, (child) => (\n \n \n {child}\n \n \n ))}\n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'DialogOverlay';\n\ntype DialogOverlayElement = DialogOverlayImplElement;\ninterface DialogOverlayProps extends DialogOverlayImplProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst DialogOverlay = /* @__PURE__ */ React.forwardRef(\n function DialogOverlay(props: ScopedProps, forwardedRef) {\n const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);\n const { forceMount = portalContext.forceMount, ...overlayProps } = props;\n const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);\n return context.modal ? (\n \n \n \n ) : null;\n },\n);\n\ntype DialogOverlayImplElement = React.ComponentRef;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef;\ninterface DialogOverlayImplProps extends PrimitiveDivProps {}\n\nconst Slot = createSlot('DialogOverlay.RemoveScroll');\n\nconst DialogOverlayImpl = /* @__PURE__ */ React.forwardRef<\n DialogOverlayImplElement,\n DialogOverlayImplProps\n>(\n // blank line to reduce diff noise\n function DialogOverlayImpl(props: ScopedProps, forwardedRef) {\n const { __scopeDialog, ...overlayProps } = props;\n const context = useDialogContext(OVERLAY_NAME, __scopeDialog);\n\n // Register the overlay as a dismiss surface so a consumer calling\n // `stopPropagation` on it (eg. to avoid triggering parent handlers) does not\n // prevent the dialog from closing. See: https://github.com/radix-ui/primitives/issues/3346\n const registerDismissableSurface = useDismissableLayerSurface();\n const composedRefs = useComposedRefs(forwardedRef, registerDismissableSurface);\n\n return (\n // Make sure `Content` is scrollable even when it doesn't live inside\n // `RemoveScroll` (eg. when `Overlay` and `Content` are siblings). Nested\n // layers are registered as branches and added as shards so they remain\n // scrollable too. See https://github.com/radix-ui/primitives/issues/3423\n [context.contentRef, ...context.branchNodes.map((node) => ({ current: node }))],\n [context.contentRef, context.branchNodes],\n )}\n >\n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'DialogContent';\n\ntype DialogContentElement = DialogContentTypeElement;\ninterface DialogContentProps extends DialogContentTypeProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst DialogContent = /* @__PURE__ */ React.forwardRef(\n function DialogContent(props: ScopedProps, forwardedRef) {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n return (\n \n {context.modal ? (\n \n ) : (\n \n )}\n \n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype DialogContentTypeElement = DialogContentImplElement;\ninterface DialogContentTypeProps extends Omit<\n DialogContentImplProps,\n 'trapFocus' | 'disableOutsidePointerEvents'\n> {}\n\nconst DialogContentModal = /* @__PURE__ */ React.forwardRef<\n DialogContentTypeElement,\n DialogContentTypeProps\n>(\n // blank line to reduce diff noise\n function DialogContentModal(props: ScopedProps, forwardedRef) {\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n const contentRef = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n const content = contentRef.current;\n if (content) return hideOthers(content);\n }, []);\n\n return (\n {\n event.preventDefault();\n context.triggerRef.current?.focus();\n })}\n onPointerDownOutside={composeEventHandlers(props.onPointerDownOutside, (event) => {\n const originalEvent = event.detail.originalEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n\n // If the event is a right-click, we shouldn't close because\n // it is effectively as if we right-clicked the `Overlay`.\n if (isRightClick) event.preventDefault();\n })}\n // When focus is trapped, a `focusout` event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={composeEventHandlers(props.onFocusOutside, (event) =>\n event.preventDefault(),\n )}\n />\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst DialogContentNonModal = /* @__PURE__ */ React.forwardRef<\n DialogContentTypeElement,\n DialogContentTypeProps\n>(\n // blank line to reduce diff noise\n function DialogContentNonModal(props: ScopedProps, forwardedRef) {\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n const hasInteractedOutsideRef = React.useRef(false);\n const hasPointerDownOutsideRef = React.useRef(false);\n\n return (\n {\n props.onCloseAutoFocus?.(event);\n\n if (!event.defaultPrevented) {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault();\n }\n\n hasInteractedOutsideRef.current = false;\n hasPointerDownOutsideRef.current = false;\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event);\n\n if (!event.defaultPrevented) {\n hasInteractedOutsideRef.current = true;\n if (event.detail.originalEvent.type === 'pointerdown') {\n hasPointerDownOutsideRef.current = true;\n }\n }\n\n // Prevent dismissing when clicking the trigger.\n // As the trigger is already setup to close, without doing so would\n // cause it to close and immediately open.\n const target = event.target as HTMLElement;\n const targetIsTrigger = context.triggerRef.current?.contains(target);\n if (targetIsTrigger) event.preventDefault();\n\n // On Safari if the trigger is inside a container with tabIndex={0}, when clicked\n // we will get the pointer down outside event on the trigger, but then a subsequent\n // focus outside event on the container, we ignore any focus outside event when we've\n // already had a pointer down outside event.\n if (event.detail.originalEvent.type === 'focusin' && hasPointerDownOutsideRef.current) {\n event.preventDefault();\n }\n }}\n />\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype DialogContentImplElement = React.ComponentRef;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef;\ntype FocusScopeProps = React.ComponentPropsWithoutRef;\ninterface DialogContentImplProps extends Omit {\n /**\n * When `true`, focus cannot escape the `Content` via keyboard,\n * pointer, or a programmatic focus.\n * @defaultValue false\n */\n trapFocus?: FocusScopeProps['trapped'] | undefined;\n\n /**\n * Event handler called when auto-focusing on open.\n * Can be prevented.\n */\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'] | undefined;\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'] | undefined;\n}\n\nconst DialogContentImpl = /* @__PURE__ */ React.forwardRef<\n DialogContentImplElement,\n DialogContentImplProps\n>(\n // blank line to reduce diff noise\n function DialogContentImpl(props: ScopedProps, forwardedRef) {\n const {\n __scopeDialog,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n 'aria-describedby': ariaDescribedby,\n children,\n ...contentProps\n } = props;\n const context = useDialogContext(CONTENT_NAME, __scopeDialog);\n\n // Make sure the whole tree has focus guards as our `Dialog` will be\n // the last element in the DOM (because of the `Portal`)\n useFocusGuards();\n\n return (\n \n \n context.onOpenChange(false)}\n >\n {children}\n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\ntype DialogTitleElement = React.ComponentRef;\ntype PrimitiveHeading2Props = React.ComponentPropsWithoutRef;\ninterface DialogTitleProps extends PrimitiveHeading2Props {}\n\nconst DialogTitle = /* @__PURE__ */ React.forwardRef(\n function DialogTitle(props: ScopedProps, forwardedRef) {\n const { __scopeDialog, ...titleProps } = props;\n const context = useDialogContext('DialogTitle', __scopeDialog);\n const { setTitleCount } = context;\n useLayoutEffect(() => {\n setTitleCount((count) => count + 1);\n return () => setTitleCount((count) => count - 1);\n }, [setTitleCount]);\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\ntype DialogDescriptionElement = React.ComponentRef;\ntype PrimitiveParagraphProps = React.ComponentPropsWithoutRef;\ninterface DialogDescriptionProps extends PrimitiveParagraphProps {}\n\nconst DialogDescription = /* @__PURE__ */ React.forwardRef<\n DialogDescriptionElement,\n DialogDescriptionProps\n>(\n // blank line to reduce diff noise\n function DialogDescription(props: ScopedProps, forwardedRef) {\n const { __scopeDialog, ...descriptionProps } = props;\n const context = useDialogContext('DialogDescription', __scopeDialog);\n const { setDescriptionCount } = context;\n useLayoutEffect(() => {\n setDescriptionCount((count) => count + 1);\n return () => setDescriptionCount((count) => count - 1);\n }, [setDescriptionCount]);\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'DialogClose';\n\ntype DialogCloseElement = React.ComponentRef;\ninterface DialogCloseProps extends PrimitiveButtonProps {}\n\nconst DialogClose = /* @__PURE__ */ React.forwardRef(\n function DialogClose(props: ScopedProps, forwardedRef) {\n const { __scopeDialog, ...closeProps } = props;\n const context = useDialogContext(CLOSE_NAME, __scopeDialog);\n return (\n context.onOpenChange(false))}\n />\n );\n },\n);\n\n/** @deprecated Noop component to avoid breaking changes. */\nexport const WarningProvider: React.FC<\n ScopedProps<{\n children?: React.ReactNode | undefined;\n contentName: string;\n titleName: string;\n docsSlug: 'dialog';\n }>\n> = (props) => {\n return props.children;\n};\n\n/* -----------------------------------------------------------------------------------------------*/\n\n// TODO: Move to primitive once that package exposed individual sub-modules\nfunction concatAriaDescribedby(...values: unknown[]): string | undefined {\n const ids = new Set();\n for (const value of values) {\n if (typeof value !== 'string') continue;\n for (const id of String(value).trim().split(/\\s+/)) {\n if (id) ids.add(id);\n }\n }\n\n return ids.size > 0 ? Array.from(ids).join(' ') : undefined;\n}\n\nfunction getState(open: boolean) {\n return open ? 'open' : 'closed';\n}\n\nexport {\n createDialogScope,\n //\n Dialog,\n DialogTrigger,\n DialogPortal,\n DialogOverlay,\n DialogContent,\n DialogTitle,\n DialogDescription,\n DialogClose,\n //\n Dialog as Root,\n DialogTrigger as Trigger,\n DialogPortal as Portal,\n DialogOverlay as Overlay,\n DialogContent as Content,\n DialogTitle as Title,\n DialogDescription as Description,\n DialogClose as Close,\n};\nexport type {\n DialogProps,\n DialogTriggerProps,\n DialogPortalProps,\n DialogOverlayProps,\n DialogContentProps,\n DialogTitleProps,\n DialogDescript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BAAoB,CAAC,UAAU,QAAQ,CAAC;AACxC,aAAO,MAAM,oBAAoB,CAAC,UAAU,QAAQ,CAAC;AAAA,IACvD,GAAG,CAAC,mBAAmB,CAAC;AACxB,WAAO,oBAAC,UAAU,GAAV,EAAY,IAAI,QAAQ,eAAgB,GAAG,kBAAkB,KAAK,cAAc;AAAA,EAC1F,GATA;AAUF;AAMA,IAAM,aAAa;AAKnB,IAAM,cAA8B,gBAAM;AAAA,EACxC,gCAASC,aAAY,OAAsC,cAAc;AACvE,UAAM,EAAE,eAAe,GAAG,WAAW,IAAI;AACzC,UAAM,UAAU,iBAAiB,YAAY,aAAa;AAC1D,WACE;AAAA,MAAC,UAAU;AAAA,MAAV;AAAA,QACC,MAAK;AAAA,QACJ,GAAG;AAAA,QACJ,KAAK;AAAA,QACL,SAAS,qBAAqB,MAAM,SAAS,MAAM,QAAQ,aAAa,KAAK,CAAC;AAAA;AAAA,IAChF;AAAA,EAEJ,GAXA;AAYF;AAGO,IAAM,kBAOT,wBAAC,UAAU;AACb,SAAO,MAAM;AACf,GAFI;AAOJ,SAAS,yBAAyB,QAAuC;AACvE,QAAM,MAAM,oBAAI,IAAY;AAC5B,aAAW,SAAS,QAAQ;AAC1B,QAAI,OAAO,UAAU,SAAU;AAC/B,eAAW,MAAM,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,GAAG;AAClD,UAAI,GAAI,KAAI,IAAI,EAAE;AAAA,IACpB;AAAA,EACF;AAEA,SAAO,IAAI,OAAO,IAAI,MAAM,KAAK,GAAG,EAAE,KAAK,GAAG,IAAI;AACpD;AAVS;AAYT,SAAS,SAAS,MAAe;AAC/B,SAAO,OAAO,SAAS;AACzB;AAFS;", + "names": ["DialogTrigger", "DialogOverlay", "DialogOverlayImpl", "DialogContent", "DialogContentModal", "DialogContentNonModal", "DialogContentImpl", "DialogTitle", "DialogDescription", "DialogClose"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-dialog/package.json b/e-commerce/node_modules/@radix-ui/react-dialog/package.json new file mode 100644 index 0000000000000000000000000000000000000000..db0a434cb5f21cc27818fa3a0a97bea0a3a4febf --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dialog/package.json @@ -0,0 +1,82 @@ +{ + "name": "@radix-ui/react-dialog", + "version": "1.3.0", + "license": "MIT", + "source": "./src/index.ts", + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "files": [ + "dist", + "README.md" + ], + "sideEffects": false, + "dependencies": { + "aria-hidden": "^1.2.4", + "react-remove-scroll": "^2.7.2", + "@radix-ui/primitive": "1.2.0", + "@radix-ui/react-compose-refs": "1.1.5", + "@radix-ui/react-dismissable-layer": "1.2.0", + "@radix-ui/react-context": "1.3.0", + "@radix-ui/react-focus-guards": "1.2.0", + "@radix-ui/react-focus-scope": "1.3.0", + "@radix-ui/react-portal": "1.2.0", + "@radix-ui/react-presence": "1.1.11", + "@radix-ui/react-id": "1.1.4", + "@radix-ui/react-primitive": "2.2.0", + "@radix-ui/react-use-layout-effect": "1.1.4", + "@radix-ui/react-slot": "1.5.0", + "@radix-ui/react-use-controllable-state": "1.3.0" + }, + "devDependencies": { + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "react": "^19.3.0", + "react-dom": "^19.3.0", + "typescript": "^5.9.3", + "@repo/builder": "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", + "directory": "packages/react/dialog" + }, + "bugs": { + "url": "https://github.com/radix-ui/primitives/issues" + }, + "scripts": { + "lint": "oxlint --max-warnings 0 src", + "clean": "rm -rf dist", + "reset": "rm -rf dist node_modules", + "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" + } + } + } +} \ No newline at end of file diff --git a/e-commerce/node_modules/@radix-ui/react-direction/LICENSE b/e-commerce/node_modules/@radix-ui/react-direction/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a18858fb7b014098cba85703e66609be66a26ef5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-direction/LICENSE @@ -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. diff --git a/e-commerce/node_modules/@radix-ui/react-direction/README.md b/e-commerce/node_modules/@radix-ui/react-direction/README.md new file mode 100644 index 0000000000000000000000000000000000000000..6ef44f47b9c6b6646513956d3df1ac636fc1b125 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-direction/README.md @@ -0,0 +1,3 @@ +# `react-direction` + +View docs [here](https://radix-ui.com/primitives/docs/utilities/direction). diff --git a/e-commerce/node_modules/@radix-ui/react-direction/dist/index.d.mts b/e-commerce/node_modules/@radix-ui/react-direction/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..feaee59025a1c6787cdb755da792a22ed4175e30 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-direction/dist/index.d.mts @@ -0,0 +1,15 @@ +import * as React from 'react'; + +declare const Direction: { + readonly LTR: "ltr"; + readonly RTL: "rtl"; +}; +type Direction = (typeof Direction)[keyof typeof Direction]; +interface DirectionProviderProps { + children?: React.ReactNode | undefined; + dir: Direction; +} +declare const DirectionProvider: React.FC; +declare function useDirection(localDir?: Direction): Direction; + +export { DirectionProvider, DirectionProvider as Provider, useDirection }; diff --git a/e-commerce/node_modules/@radix-ui/react-direction/dist/index.d.ts b/e-commerce/node_modules/@radix-ui/react-direction/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..feaee59025a1c6787cdb755da792a22ed4175e30 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-direction/dist/index.d.ts @@ -0,0 +1,15 @@ +import * as React from 'react'; + +declare const Direction: { + readonly LTR: "ltr"; + readonly RTL: "rtl"; +}; +type Direction = (typeof Direction)[keyof typeof Direction]; +interface DirectionProviderProps { + children?: React.ReactNode | undefined; + dir: Direction; +} +declare const DirectionProvider: React.FC; +declare function useDirection(localDir?: Direction): Direction; + +export { DirectionProvider, DirectionProvider as Provider, useDirection }; diff --git a/e-commerce/node_modules/@radix-ui/react-direction/dist/index.js b/e-commerce/node_modules/@radix-ui/react-direction/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..06e2f060ba0548ead7c8f2afdca5d0ceaaf25188 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-direction/dist/index.js @@ -0,0 +1,58 @@ +"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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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, { + DirectionProvider: () => DirectionProvider, + Provider: () => DirectionProvider, + useDirection: () => useDirection +}); +module.exports = __toCommonJS(index_exports); + +// src/direction.tsx +var React = __toESM(require("react")); +var import_jsx_runtime = require("react/jsx-runtime"); +var Direction = { + LTR: "ltr", + RTL: "rtl" +}; +var DirectionContext = React.createContext(void 0); +var DirectionProvider = /* @__PURE__ */ __name((props) => { + const { dir, children } = props; + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DirectionContext.Provider, { value: dir, children }); +}, "DirectionProvider"); +function useDirection(localDir) { + const globalDir = React.useContext(DirectionContext); + return localDir || globalDir || Direction.LTR; +} +__name(useDirection, "useDirection"); +//# sourceMappingURL=index.js.map diff --git a/e-commerce/node_modules/@radix-ui/react-direction/dist/index.js.map b/e-commerce/node_modules/@radix-ui/react-direction/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7051c42d7c5e5ac0ba05e17bc33d92bd530470d1 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-direction/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts", "../src/direction.tsx"], + "sourcesContent": ["'use client';\nexport {\n useDirection,\n //\n Provider,\n //\n DirectionProvider,\n} from './direction';\n", "import * as React from 'react';\n\nconst Direction = {\n LTR: 'ltr',\n RTL: 'rtl',\n} as const;\n\ntype Direction = (typeof Direction)[keyof typeof Direction];\n\nconst DirectionContext = React.createContext(undefined);\n\n/* -------------------------------------------------------------------------------------------------\n * Direction\n * -----------------------------------------------------------------------------------------------*/\n\ninterface DirectionProviderProps {\n children?: React.ReactNode | undefined;\n dir: Direction;\n}\nconst DirectionProvider: React.FC = (props) => {\n const { dir, children } = props;\n return {children};\n};\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction useDirection(localDir?: Direction) {\n const globalDir = React.useContext(DirectionContext);\n return localDir || globalDir || Direction.LTR;\n}\n\nexport {\n useDirection,\n //\n DirectionProvider as Provider,\n //\n DirectionProvider,\n};\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AAqBd;AAnBT,IAAM,YAAY;AAAA,EAChB,KAAK;AAAA,EACL,KAAK;AACP;AAIA,IAAM,mBAAyB,oBAAqC,MAAS;AAU7E,IAAM,oBAAsD,wBAAC,UAAU;AACrE,QAAM,EAAE,KAAK,SAAS,IAAI;AAC1B,SAAO,4CAAC,iBAAiB,UAAjB,EAA0B,OAAO,KAAM,UAAS;AAC1D,GAH4D;AAO5D,SAAS,aAAa,UAAsB;AAC1C,QAAM,YAAkB,iBAAW,gBAAgB;AACnD,SAAO,YAAY,aAAa,UAAU;AAC5C;AAHS;", + "names": [] +} diff --git a/e-commerce/node_modules/@radix-ui/react-direction/dist/index.mjs b/e-commerce/node_modules/@radix-ui/react-direction/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..860364723e9ecb975b894bd0ac3a2da704e9f648 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-direction/dist/index.mjs @@ -0,0 +1,27 @@ +"use client"; +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// src/direction.tsx +import * as React from "react"; +import { jsx } from "react/jsx-runtime"; +var Direction = { + LTR: "ltr", + RTL: "rtl" +}; +var DirectionContext = React.createContext(void 0); +var DirectionProvider = /* @__PURE__ */ __name((props) => { + const { dir, children } = props; + return /* @__PURE__ */ jsx(DirectionContext.Provider, { value: dir, children }); +}, "DirectionProvider"); +function useDirection(localDir) { + const globalDir = React.useContext(DirectionContext); + return localDir || globalDir || Direction.LTR; +} +__name(useDirection, "useDirection"); +export { + DirectionProvider, + DirectionProvider as Provider, + useDirection +}; +//# sourceMappingURL=index.mjs.map diff --git a/e-commerce/node_modules/@radix-ui/react-direction/dist/index.mjs.map b/e-commerce/node_modules/@radix-ui/react-direction/dist/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..bc5b90065ba3dfb3591a24587d3839843f1b71ac --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-direction/dist/index.mjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/direction.tsx"], + "sourcesContent": ["import * as React from 'react';\n\nconst Direction = {\n LTR: 'ltr',\n RTL: 'rtl',\n} as const;\n\ntype Direction = (typeof Direction)[keyof typeof Direction];\n\nconst DirectionContext = React.createContext(undefined);\n\n/* -------------------------------------------------------------------------------------------------\n * Direction\n * -----------------------------------------------------------------------------------------------*/\n\ninterface DirectionProviderProps {\n children?: React.ReactNode | undefined;\n dir: Direction;\n}\nconst DirectionProvider: React.FC = (props) => {\n const { dir, children } = props;\n return {children};\n};\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction useDirection(localDir?: Direction) {\n const globalDir = React.useContext(DirectionContext);\n return localDir || globalDir || Direction.LTR;\n}\n\nexport {\n useDirection,\n //\n DirectionProvider as Provider,\n //\n DirectionProvider,\n};\n"], + "mappings": ";;;;;AAAA,YAAY,WAAW;AAqBd;AAnBT,IAAM,YAAY;AAAA,EAChB,KAAK;AAAA,EACL,KAAK;AACP;AAIA,IAAM,mBAAyB,oBAAqC,MAAS;AAU7E,IAAM,oBAAsD,wBAAC,UAAU;AACrE,QAAM,EAAE,KAAK,SAAS,IAAI;AAC1B,SAAO,oBAAC,iBAAiB,UAAjB,EAA0B,OAAO,KAAM,UAAS;AAC1D,GAH4D;AAO5D,SAAS,aAAa,UAAsB;AAC1C,QAAM,YAAkB,iBAAW,gBAAgB;AACnD,SAAO,YAAY,aAAa,UAAU;AAC5C;AAHS;", + "names": [] +} diff --git a/e-commerce/node_modules/@radix-ui/react-direction/package.json b/e-commerce/node_modules/@radix-ui/react-direction/package.json new file mode 100644 index 0000000000000000000000000000000000000000..db6a68ce16d0ec036298ae63f286973464fdebaa --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-direction/package.json @@ -0,0 +1,60 @@ +{ + "name": "@radix-ui/react-direction", + "version": "1.2.0", + "license": "MIT", + "source": "./src/index.ts", + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "files": [ + "dist", + "README.md" + ], + "sideEffects": false, + "devDependencies": { + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "react": "^19.3.0", + "react-dom": "^19.3.0", + "typescript": "^5.9.3", + "@repo/builder": "0.0.0", + "@repo/typescript-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", + "directory": "packages/react/direction" + }, + "bugs": { + "url": "https://github.com/radix-ui/primitives/issues" + }, + "scripts": { + "lint": "oxlint --max-warnings 0 src", + "clean": "rm -rf dist", + "reset": "rm -rf dist node_modules", + "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" + } + } + } +} \ No newline at end of file diff --git a/e-commerce/node_modules/@radix-ui/react-dismissable-layer/LICENSE b/e-commerce/node_modules/@radix-ui/react-dismissable-layer/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a18858fb7b014098cba85703e66609be66a26ef5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dismissable-layer/LICENSE @@ -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. diff --git a/e-commerce/node_modules/@radix-ui/react-dismissable-layer/README.md b/e-commerce/node_modules/@radix-ui/react-dismissable-layer/README.md new file mode 100644 index 0000000000000000000000000000000000000000..fbb8e092a16d1a67c3f08c573303b40997c0c086 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dismissable-layer/README.md @@ -0,0 +1,3 @@ +# `react-dismissable-layer` + +This is an internal utility, not intended for public usage. diff --git a/e-commerce/node_modules/@radix-ui/react-dismissable-layer/dist/index.d.mts b/e-commerce/node_modules/@radix-ui/react-dismissable-layer/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0fd172ed6a12dcc2da198e464be7c9a2455a0893 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dismissable-layer/dist/index.d.mts @@ -0,0 +1,60 @@ +import * as React from 'react'; +import { Primitive } from '@radix-ui/react-primitive'; + +type PrimitiveDivProps = React.ComponentPropsWithoutRef; +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 | undefined; + /** + * When `true`, a `'pointerdown'` event outside of the layered element will + * wait for the interaction's click event before dispatching, allowing + * third-party code to stop propagation of later events and cancel dismissal. + */ + deferPointerDownOutside?: boolean | undefined; + /** + * Event handler called when the escape key is down. + * Can be prevented. + */ + onEscapeKeyDown?: ((event: KeyboardEvent) => void) | undefined; + /** + * Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`. + * Can be prevented. + */ + onPointerDownOutside?: ((event: PointerDownOutsideEvent) => void) | undefined; + /** + * Event handler called when the focus moves outside of the `DismissableLayer`. + * Can be prevented. + */ + onFocusOutside?: ((event: FocusOutsideEvent) => void) | undefined; + /** + * 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) | undefined; + /** + * Handler called when the `DismissableLayer` should be dismissed + */ + onDismiss?: (() => void) | undefined; +} +declare const DismissableLayer: React.ForwardRefExoticComponent>; +type DismissableLayerBranchElement = React.ComponentRef; +interface DismissableLayerBranchProps extends PrimitiveDivProps { +} +declare const DismissableLayerBranch: React.ForwardRefExoticComponent>; +/** + * Registers a node as a "dismiss surface" for the enclosing DismissableLayer + */ +declare function useDismissableLayerSurface(): React.RefCallback; +type PointerDownOutsideEvent = CustomEvent<{ + originalEvent: PointerEvent; +}>; +type FocusOutsideEvent = CustomEvent<{ + originalEvent: FocusEvent; +}>; + +export { DismissableLayerBranch as Branch, DismissableLayer, DismissableLayerBranch, type DismissableLayerProps, DismissableLayer as Root, useDismissableLayerSurface }; diff --git a/e-commerce/node_modules/@radix-ui/react-dismissable-layer/dist/index.d.ts b/e-commerce/node_modules/@radix-ui/react-dismissable-layer/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0fd172ed6a12dcc2da198e464be7c9a2455a0893 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dismissable-layer/dist/index.d.ts @@ -0,0 +1,60 @@ +import * as React from 'react'; +import { Primitive } from '@radix-ui/react-primitive'; + +type PrimitiveDivProps = React.ComponentPropsWithoutRef; +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 | undefined; + /** + * When `true`, a `'pointerdown'` event outside of the layered element will + * wait for the interaction's click event before dispatching, allowing + * third-party code to stop propagation of later events and cancel dismissal. + */ + deferPointerDownOutside?: boolean | undefined; + /** + * Event handler called when the escape key is down. + * Can be prevented. + */ + onEscapeKeyDown?: ((event: KeyboardEvent) => void) | undefined; + /** + * Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`. + * Can be prevented. + */ + onPointerDownOutside?: ((event: PointerDownOutsideEvent) => void) | undefined; + /** + * Event handler called when the focus moves outside of the `DismissableLayer`. + * Can be prevented. + */ + onFocusOutside?: ((event: FocusOutsideEvent) => void) | undefined; + /** + * 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) | undefined; + /** + * Handler called when the `DismissableLayer` should be dismissed + */ + onDismiss?: (() => void) | undefined; +} +declare const DismissableLayer: React.ForwardRefExoticComponent>; +type DismissableLayerBranchElement = React.ComponentRef; +interface DismissableLayerBranchProps extends PrimitiveDivProps { +} +declare const DismissableLayerBranch: React.ForwardRefExoticComponent>; +/** + * Registers a node as a "dismiss surface" for the enclosing DismissableLayer + */ +declare function useDismissableLayerSurface(): React.RefCallback; +type PointerDownOutsideEvent = CustomEvent<{ + originalEvent: PointerEvent; +}>; +type FocusOutsideEvent = CustomEvent<{ + originalEvent: FocusEvent; +}>; + +export { DismissableLayerBranch as Branch, DismissableLayer, DismissableLayerBranch, type DismissableLayerProps, DismissableLayer as Root, useDismissableLayerSurface }; diff --git a/e-commerce/node_modules/@radix-ui/react-dismissable-layer/dist/index.js b/e-commerce/node_modules/@radix-ui/react-dismissable-layer/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..402fee19053394d5a404bc818d9dff4348cc1e21 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dismissable-layer/dist/index.js @@ -0,0 +1,393 @@ +"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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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: () => DismissableLayerBranch, + DismissableLayer: () => DismissableLayer, + DismissableLayerBranch: () => DismissableLayerBranch, + Root: () => DismissableLayer, + useDismissableLayerSurface: () => useDismissableLayerSurface +}); +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_jsx_runtime = require("react/jsx-runtime"); +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(), + // Outside elements that belong to a layer's own dismiss affordance (eg, a + // dialog overlay). Pressing them should dismiss the layer regardless of + // whether or not they stop propagation. + // + // See https://github.com/radix-ui/primitives/issues/3346 + dismissableSurfaces: /* @__PURE__ */ new Set() +}); +var DismissableLayer = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DismissableLayer2(props, forwardedRef) { + const { + disableOutsidePointerEvents = false, + deferPointerDownOutside = 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, setNode); + const layers = Array.from(context.layers); + const [highestLayerWithOutsidePointerEventsDisabled] = [ + ...context.layersWithOutsidePointerEventsDisabled + ].slice(-1); + const highestLayerWithOutsidePointerEventsDisabledIndex = highestLayerWithOutsidePointerEventsDisabled ? layers.indexOf(highestLayerWithOutsidePointerEventsDisabled) : -1; + const index = node ? layers.indexOf(node) : -1; + const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0; + const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex; + const isDeferredPointerDownOutsideRef = React.useRef(false); + const pointerDownOutside = usePointerDownOutside( + (event) => { + onPointerDownOutside?.(event); + onInteractOutside?.(event); + if (!event.defaultPrevented) onDismiss?.(); + }, + { + ownerDocument, + deferPointerDownOutside, + isDeferredPointerDownOutsideRef, + dismissableSurfaces: context.dismissableSurfaces, + shouldHandlePointerDownOutside: React.useCallback( + (target) => { + if (!(target instanceof Node)) { + return false; + } + const isPointerDownOnBranch = [...context.branches].some( + (branch) => branch.contains(target) + ); + return isPointerEventsEnabled && !isPointerDownOnBranch; + }, + [context.branches, isPointerEventsEnabled] + ) + } + ); + const focusOutside = useFocusOutside((event) => { + if (deferPointerDownOutside && isDeferredPointerDownOutsideRef.current) { + return; + } + 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); + const isHighestLayer = node ? index === layers.length - 1 : false; + const handleKeyDown = (0, import_react_use_callback_ref.useCallbackRef)((event) => { + if (event.key !== "Escape") { + return; + } + onEscapeKeyDown?.(event); + if (!event.defaultPrevented && onDismiss) { + event.preventDefault(); + onDismiss(); + } + }); + React.useEffect(() => { + if (!isHighestLayer) { + return; + } + ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true }); + return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true }); + }, [ownerDocument, isHighestLayer, handleKeyDown]); + 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.delete(node); + if (context.layersWithOutsidePointerEventsDisabled.size === 0) { + 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 = /* @__PURE__ */ __name(() => force({}), "handleUpdate"); + 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") +); +var DismissableLayerBranch = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function DismissableLayerBranch2(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")); +function useDismissableLayerSurface() { + const context = React.useContext(DismissableLayerContext); + const [node, setNode] = React.useState(null); + React.useEffect(() => { + if (!node) { + return; + } + context.dismissableSurfaces.add(node); + return () => { + context.dismissableSurfaces.delete(node); + }; + }, [node, context.dismissableSurfaces]); + return setNode; +} +__name(useDismissableLayerSurface, "useDismissableLayerSurface"); +var IS_TRUE = /* @__PURE__ */ __name(() => true, "IS_TRUE"); +function usePointerDownOutside(onPointerDownOutside, args) { + const { + ownerDocument = globalThis?.document, + deferPointerDownOutside = false, + isDeferredPointerDownOutsideRef, + dismissableSurfaces, + shouldHandlePointerDownOutside = IS_TRUE + } = args; + const handlePointerDownOutside = (0, import_react_use_callback_ref.useCallbackRef)(onPointerDownOutside); + const isPointerInsideReactTreeRef = React.useRef(false); + const isPointerDownOutsideRef = React.useRef(false); + const interceptedOutsideInteractionEventsRef = React.useRef(/* @__PURE__ */ new Map()); + const handleClickRef = React.useRef(() => { + }); + React.useEffect(() => { + function resetOutsideInteraction() { + isPointerDownOutsideRef.current = false; + isDeferredPointerDownOutsideRef.current = false; + interceptedOutsideInteractionEventsRef.current.clear(); + } + __name(resetOutsideInteraction, "resetOutsideInteraction"); + function isOutsideInteractionIntercepted() { + return Array.from(interceptedOutsideInteractionEventsRef.current.values()).some(Boolean); + } + __name(isOutsideInteractionIntercepted, "isOutsideInteractionIntercepted"); + function handleInteractionCapture(event) { + if (!isPointerDownOutsideRef.current) { + return; + } + const target = event.target; + const isDismissableSurface = target instanceof Node && [...dismissableSurfaces].some((surface) => surface.contains(target)); + if (!isDismissableSurface) { + interceptedOutsideInteractionEventsRef.current.set(event.type, true); + } + if (event.type === "click") { + window.setTimeout(() => { + if (isPointerDownOutsideRef.current) { + handleClickRef.current(); + } + }, 0); + } + } + __name(handleInteractionCapture, "handleInteractionCapture"); + function handleInteractionBubble(event) { + if (isPointerDownOutsideRef.current) { + interceptedOutsideInteractionEventsRef.current.set(event.type, false); + } + } + __name(handleInteractionBubble, "handleInteractionBubble"); + const handlePointerDown = /* @__PURE__ */ __name((event) => { + if (event.target && !isPointerInsideReactTreeRef.current) { + let handleAndDispatchPointerDownOutsideEvent2 = function() { + ownerDocument.removeEventListener("click", handleClickRef.current); + const wasOutsideInteractionIntercepted = isOutsideInteractionIntercepted(); + resetOutsideInteraction(); + if (!wasOutsideInteractionIntercepted) { + handleAndDispatchCustomEvent( + POINTER_DOWN_OUTSIDE, + handlePointerDownOutside, + eventDetail, + { discrete: true } + ); + } + }; + var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2; + __name(handleAndDispatchPointerDownOutsideEvent2, "handleAndDispatchPointerDownOutsideEvent"); + if (!shouldHandlePointerDownOutside(event.target)) { + ownerDocument.removeEventListener("click", handleClickRef.current); + resetOutsideInteraction(); + isPointerInsideReactTreeRef.current = false; + return; + } + const eventDetail = { originalEvent: event }; + isPointerDownOutsideRef.current = true; + isDeferredPointerDownOutsideRef.current = deferPointerDownOutside && event.button === 0; + interceptedOutsideInteractionEventsRef.current.clear(); + if (!deferPointerDownOutside || event.button !== 0) { + handleAndDispatchPointerDownOutsideEvent2(); + } else { + ownerDocument.removeEventListener("click", handleClickRef.current); + handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2; + ownerDocument.addEventListener("click", handleClickRef.current, { once: true }); + } + } else { + ownerDocument.removeEventListener("click", handleClickRef.current); + resetOutsideInteraction(); + } + isPointerInsideReactTreeRef.current = false; + }, "handlePointerDown"); + const outsideInteractionEvents = [ + "pointerup", + "mousedown", + "mouseup", + "touchstart", + "touchend", + "click" + ]; + for (const eventName of outsideInteractionEvents) { + ownerDocument.addEventListener(eventName, handleInteractionCapture, true); + ownerDocument.addEventListener(eventName, handleInteractionBubble); + } + const timerId = window.setTimeout(() => { + ownerDocument.addEventListener("pointerdown", handlePointerDown); + }, 0); + return () => { + window.clearTimeout(timerId); + ownerDocument.removeEventListener("pointerdown", handlePointerDown); + ownerDocument.removeEventListener("click", handleClickRef.current); + for (const eventName of outsideInteractionEvents) { + ownerDocument.removeEventListener(eventName, handleInteractionCapture, true); + ownerDocument.removeEventListener(eventName, handleInteractionBubble); + } + }; + }, [ + ownerDocument, + handlePointerDownOutside, + deferPointerDownOutside, + isDeferredPointerDownOutsideRef, + dismissableSurfaces, + shouldHandlePointerDownOutside + ]); + return { + // ensures we check React component tree (not just DOM tree) + onPointerDownCapture: /* @__PURE__ */ __name(() => isPointerInsideReactTreeRef.current = true, "onPointerDownCapture") + }; +} +__name(usePointerDownOutside, "usePointerDownOutside"); +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 = /* @__PURE__ */ __name((event) => { + if (event.target && !isFocusInsideReactTreeRef.current) { + const eventDetail = { originalEvent: event }; + handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, { + discrete: false + }); + } + }, "handleFocus"); + ownerDocument.addEventListener("focusin", handleFocus); + return () => ownerDocument.removeEventListener("focusin", handleFocus); + }, [ownerDocument, handleFocusOutside]); + return { + onFocusCapture: /* @__PURE__ */ __name(() => isFocusInsideReactTreeRef.current = true, "onFocusCapture"), + onBlurCapture: /* @__PURE__ */ __name(() => isFocusInsideReactTreeRef.current = false, "onBlurCapture") + }; +} +__name(useFocusOutside, "useFocusOutside"); +function dispatchUpdate() { + const event = new CustomEvent(CONTEXT_UPDATE); + document.dispatchEvent(event); +} +__name(dispatchUpdate, "dispatchUpdate"); +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); + } +} +__name(handleAndDispatchCustomEvent, "handleAndDispatchCustomEvent"); +//# sourceMappingURL=index.js.map diff --git a/e-commerce/node_modules/@radix-ui/react-dismissable-layer/dist/index.js.map b/e-commerce/node_modules/@radix-ui/react-dismissable-layer/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..63431f0bb07ecc407069df0147e0110261d7d599 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dismissable-layer/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts", "../src/dismissable-layer.tsx"], + "sourcesContent": ["'use client';\nexport {\n DismissableLayer,\n DismissableLayerBranch,\n //\n Root,\n Branch,\n /** @internal */\n useDismissableLayerSurface,\n} from './dismissable-layer';\nexport type { DismissableLayerProps } from './dismissable-layer';\n", "import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { Primitive, dispatchDiscreteCustomEvent } from '@radix-ui/react-primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\n\n/* -------------------------------------------------------------------------------------------------\n * DismissableLayer\n * -----------------------------------------------------------------------------------------------*/\nconst CONTEXT_UPDATE = 'dismissableLayer.update';\nconst POINTER_DOWN_OUTSIDE = 'dismissableLayer.pointerDownOutside';\nconst FOCUS_OUTSIDE = 'dismissableLayer.focusOutside';\n\nlet originalBodyPointerEvents: string;\n\nconst DismissableLayerContext = React.createContext({\n layers: new Set(),\n layersWithOutsidePointerEventsDisabled: new Set(),\n branches: new Set(),\n\n // Outside elements that belong to a layer's own dismiss affordance (eg, a\n // dialog overlay). Pressing them should dismiss the layer regardless of\n // whether or not they stop propagation.\n //\n // See https://github.com/radix-ui/primitives/issues/3346\n dismissableSurfaces: new Set(),\n});\n\ntype DismissableLayerElement = React.ComponentRef;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef;\ninterface DismissableLayerProps extends PrimitiveDivProps {\n /**\n * When `true`, hover/focus/click interactions will be disabled on elements outside\n * the `DismissableLayer`. Users will need to click twice on outside elements to\n * interact with them: once to close the `DismissableLayer`, and again to trigger the element.\n */\n disableOutsidePointerEvents?: boolean | undefined;\n /**\n * When `true`, a `'pointerdown'` event outside of the layered element will\n * wait for the interaction's click event before dispatching, allowing\n * third-party code to stop propagation of later events and cancel dismissal.\n */\n deferPointerDownOutside?: boolean | undefined;\n /**\n * Event handler called when the escape key is down.\n * Can be prevented.\n */\n onEscapeKeyDown?: ((event: KeyboardEvent) => void) | undefined;\n /**\n * Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`.\n * Can be prevented.\n */\n onPointerDownOutside?: ((event: PointerDownOutsideEvent) => void) | undefined;\n /**\n * Event handler called when the focus moves outside of the `DismissableLayer`.\n * Can be prevented.\n */\n onFocusOutside?: ((event: FocusOutsideEvent) => void) | undefined;\n /**\n * Event handler called when an interaction happens outside the `DismissableLayer`.\n * Specifically, when a `pointerdown` event happens outside or focus moves outside of it.\n * Can be prevented.\n */\n onInteractOutside?: ((event: PointerDownOutsideEvent | FocusOutsideEvent) => void) | undefined;\n /**\n * Handler called when the `DismissableLayer` should be dismissed\n */\n onDismiss?: (() => void) | undefined;\n}\n\nconst DismissableLayer = /* @__PURE__ */ React.forwardRef<\n DismissableLayerElement,\n DismissableLayerProps\n>(\n // blank line to reduce diff noise\n function DismissableLayer(props, forwardedRef) {\n const {\n disableOutsidePointerEvents = false,\n deferPointerDownOutside = false,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n ...layerProps\n } = props;\n const context = React.useContext(DismissableLayerContext);\n const [node, setNode] = React.useState(null);\n const ownerDocument = node?.ownerDocument ?? globalThis?.document;\n const [, force] = React.useState({});\n const composedRefs = useComposedRefs(forwardedRef, setNode);\n const layers = Array.from(context.layers);\n const [highestLayerWithOutsidePointerEventsDisabled] = [\n ...context.layersWithOutsidePointerEventsDisabled,\n ].slice(-1);\n const highestLayerWithOutsidePointerEventsDisabledIndex =\n highestLayerWithOutsidePointerEventsDisabled\n ? layers.indexOf(highestLayerWithOutsidePointerEventsDisabled)\n : -1;\n const index = node ? layers.indexOf(node) : -1;\n const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;\n const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;\n const isDeferredPointerDownOutsideRef = React.useRef(false);\n\n const pointerDownOutside = usePointerDownOutside(\n (event) => {\n onPointerDownOutside?.(event);\n onInteractOutside?.(event);\n if (!event.defaultPrevented) onDismiss?.();\n },\n {\n ownerDocument,\n deferPointerDownOutside,\n isDeferredPointerDownOutsideRef,\n dismissableSurfaces: context.dismissableSurfaces,\n shouldHandlePointerDownOutside: React.useCallback(\n (target: EventTarget | null) => {\n if (!(target instanceof Node)) {\n return false;\n }\n\n const isPointerDownOnBranch = [...context.branches].some((branch) =>\n branch.contains(target),\n );\n return isPointerEventsEnabled && !isPointerDownOnBranch;\n },\n [context.branches, isPointerEventsEnabled],\n ),\n },\n );\n\n const focusOutside = useFocusOutside((event) => {\n if (deferPointerDownOutside && isDeferredPointerDownOutsideRef.current) {\n return;\n }\n\n const target = event.target as HTMLElement;\n const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));\n if (isFocusInBranch) return;\n onFocusOutside?.(event);\n onInteractOutside?.(event);\n if (!event.defaultPrevented) onDismiss?.();\n }, ownerDocument);\n\n const isHighestLayer = node ? index === layers.length - 1 : false;\n\n // Stabilize via `useCallbackRef` rather than `useEffectEvent`: React's\n // native `useEffectEvent` returns a stale closure inside `forwardRef`\n // components on React 19.2.x, which caused escape handlers to observe\n // mount-time props/state instead of the latest values.\n //\n // We should revert this to use useEffectEvent when the fix lands in React.\n //\n // - https://github.com/radix-ui/primitives/issues/4014\n // - https://github.com/react/react/pull/34831\n const handleKeyDown = useCallbackRef((event: KeyboardEvent) => {\n if (event.key !== 'Escape') {\n return;\n }\n\n onEscapeKeyDown?.(event);\n if (!event.defaultPrevented && onDismiss) {\n event.preventDefault();\n onDismiss();\n }\n });\n\n React.useEffect(() => {\n if (!isHighestLayer) {\n return;\n }\n\n ownerDocument.addEventListener('keydown', handleKeyDown, { capture: true });\n return () => ownerDocument.removeEventListener('keydown', handleKeyDown, { capture: true });\n }, [ownerDocument, isHighestLayer, handleKeyDown]);\n\n React.useEffect(() => {\n if (!node) return;\n if (disableOutsidePointerEvents) {\n if (context.layersWithOutsidePointerEventsDisabled.size === 0) {\n originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;\n ownerDocument.body.style.pointerEvents = 'none';\n }\n context.layersWithOutsidePointerEventsDisabled.add(node);\n }\n context.layers.add(node);\n dispatchUpdate();\n return () => {\n // We must remove this layer from the disabled set whenever\n // `disableOutsidePointerEvents` becomes `false` (eg, when a modal\n // closes but stays mounted during an exit animation) and not only on\n // unmount. Otherwise the `body` `pointer-events` could be left as\n // `none` when multiple layers overlap.\n // See: https://github.com/radix-ui/primitives/issues/3645\n if (disableOutsidePointerEvents) {\n context.layersWithOutsidePointerEventsDisabled.delete(node);\n if (context.layersWithOutsidePointerEventsDisabled.size === 0) {\n ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;\n }\n }\n };\n }, [node, ownerDocument, disableOutsidePointerEvents, context]);\n\n /**\n * We purposefully prevent combining this effect with the `disableOutsidePointerEvents` effect\n * because a change to `disableOutsidePointerEvents` would remove this layer from the stack\n * and add it to the end again so the layering order wouldn't be _creation order_.\n * We only want them to be removed from context stacks when unmounted.\n */\n React.useEffect(() => {\n return () => {\n if (!node) return;\n context.layers.delete(node);\n context.layersWithOutsidePointerEventsDisabled.delete(node);\n dispatchUpdate();\n };\n }, [node, context]);\n\n React.useEffect(() => {\n const handleUpdate = () => force({});\n document.addEventListener(CONTEXT_UPDATE, handleUpdate);\n return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);\n }, []);\n\n return (\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DismissableLayerBranch\n * -----------------------------------------------------------------------------------------------*/\n\ntype DismissableLayerBranchElement = React.ComponentRef;\ninterface DismissableLayerBranchProps extends PrimitiveDivProps {}\n\nconst DismissableLayerBranch = /* @__PURE__ */ React.forwardRef<\n DismissableLayerBranchElement,\n DismissableLayerBranchProps\n>(function DismissableLayerBranch(props, forwardedRef) {\n const context = React.useContext(DismissableLayerContext);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n\n React.useEffect(() => {\n const node = ref.current;\n if (node) {\n context.branches.add(node);\n return () => {\n context.branches.delete(node);\n };\n }\n }, [context.branches]);\n\n return ;\n});\n\n/* -----------------------------------------------------------------------------------------------*/\n\n/**\n * Registers a node as a \"dismiss surface\" for the enclosing DismissableLayer\n */\nfunction useDismissableLayerSurface(): React.RefCallback {\n const context = React.useContext(DismissableLayerContext);\n const [node, setNode] = React.useState(null);\n\n React.useEffect(() => {\n if (!node) {\n return;\n }\n context.dismissableSurfaces.add(node);\n return () => {\n context.dismissableSurfaces.delete(node);\n };\n }, [node, context.dismissableSurfaces]);\n\n return setNode;\n}\n\ntype PointerDownOutsideEvent = CustomEvent<{ originalEvent: PointerEvent }>;\ntype FocusOutsideEvent = CustomEvent<{ originalEvent: FocusEvent }>;\n\nconst IS_TRUE = () => true;\n\n/**\n * Listens for `pointerdown` outside a react subtree. We detect the start of the interaction on\n * `pointerdown`, then wait for `click` so external code can intercept later mouse events.\n * Returns props to pass to the node we want to check for outside events.\n */\nfunction usePointerDownOutside(\n onPointerDownOutside: ((event: PointerDownOutsideEvent) => void) | undefined,\n args: {\n ownerDocument: Document | undefined;\n deferPointerDownOutside: boolean;\n isDeferredPointerDownOutsideRef: React.RefObject;\n dismissableSurfaces: Set;\n shouldHandlePointerDownOutside?: ((target: EventTarget | null) => boolean) | undefined;\n },\n) {\n const {\n ownerDocument = globalThis?.document,\n deferPointerDownOutside = false,\n isDeferredPointerDownOutsideRef,\n dismissableSurfaces,\n shouldHandlePointerDownOutside = IS_TRUE,\n } = args;\n const handlePointerDownOutside = useCallbackRef(onPointerDownOutside) as EventListener;\n const isPointerInsideReactTreeRef = React.useRef(false);\n const isPointerDownOutsideRef = React.useRef(false);\n const interceptedOutsideInteractionEventsRef = React.useRef>(new Map());\n const handleClickRef = React.useRef(() => {});\n\n React.useEffect(() => {\n function resetOutsideInteraction() {\n isPointerDownOutsideRef.current = false;\n isDeferredPointerDownOutsideRef.current = false;\n interceptedOutsideInteractionEventsRef.current.clear();\n }\n\n function isOutsideInteractionIntercepted() {\n return Array.from(interceptedOutsideInteractionEventsRef.current.values()).some(Boolean);\n }\n\n function handleInteractionCapture(event: Event) {\n if (!isPointerDownOutsideRef.current) {\n return;\n }\n\n const target = event.target;\n const isDismissableSurface =\n target instanceof Node &&\n [...dismissableSurfaces].some((surface) => surface.contains(target as Node));\n\n if (!isDismissableSurface) {\n interceptedOutsideInteractionEventsRef.current.set(event.type, true);\n }\n\n if (event.type === 'click') {\n window.setTimeout(() => {\n if (isPointerDownOutsideRef.current) {\n handleClickRef.current();\n }\n }, 0);\n }\n }\n\n function handleInteractionBubble(event: Event) {\n if (isPointerDownOutsideRef.current) {\n interceptedOutsideInteractionEventsRef.current.set(event.type, false);\n }\n }\n\n const handlePointerDown = (event: PointerEvent) => {\n if (event.target && !isPointerInsideReactTreeRef.current) {\n if (!shouldHandlePointerDownOutside(event.target)) {\n ownerDocument.removeEventListener('click', handleClickRef.current);\n resetOutsideInteraction();\n isPointerInsideReactTreeRef.current = false;\n return;\n }\n\n const eventDetail = { originalEvent: event };\n isPointerDownOutsideRef.current = true;\n isDeferredPointerDownOutsideRef.current = deferPointerDownOutside && event.button === 0;\n interceptedOutsideInteractionEventsRef.current.clear();\n\n function handleAndDispatchPointerDownOutsideEvent() {\n ownerDocument.removeEventListener('click', handleClickRef.current);\n const wasOutsideInteractionIntercepted = isOutsideInteractionIntercepted();\n resetOutsideInteraction();\n\n if (!wasOutsideInteractionIntercepted) {\n handleAndDispatchCustomEvent(\n POINTER_DOWN_OUTSIDE,\n handlePointerDownOutside,\n eventDetail,\n { discrete: true },\n );\n }\n }\n\n /**\n * When deferring, we need to wait for a click event because:\n *\n * 1. On touch devices, browsers implement a ~350ms delay between the\n * time the user stops touching the display and when the browser\n * executes events. We need to ensure we don't reactivate\n * pointer-events within this timeframe otherwise the browser may\n * execute events that should have been prevented.\n *\n * 2. Browser extensions and other third-party code may call\n * `stopPropagation` on later mouse events like `mousedown`,\n * `mouseup`, or `click`. Waiting lets those intercepted events\n * cancel the outside interaction before we dismiss the layer. See\n * https://github.com/radix-ui/primitives/issues/2055\n *\n * Additionally, this also lets us deal automatically with cancellations\n * when a click event isn't raised because the page was considered\n * scrolled/drag-scrolled, long-pressed, etc.\n *\n * This is why we also continuously remove the previous listener,\n * because we cannot be certain that it was raised, and therefore\n * cleaned-up.\n *\n * For non-primary buttons, we dispatch the event immediately because we\n * cannot be certain that the event was canceled.\n */\n if (!deferPointerDownOutside || event.button !== 0) {\n handleAndDispatchPointerDownOutsideEvent();\n } else {\n ownerDocument.removeEventListener('click', handleClickRef.current);\n handleClickRef.current = handleAndDispatchPointerDownOutsideEvent;\n ownerDocument.addEventListener('click', handleClickRef.current, { once: true });\n }\n } else {\n // We need to remove the event listener in case the outside click has been canceled.\n // See: https://github.com/radix-ui/primitives/issues/2171\n ownerDocument.removeEventListener('click', handleClickRef.current);\n resetOutsideInteraction();\n }\n isPointerInsideReactTreeRef.current = false;\n };\n\n const outsideInteractionEvents = [\n 'pointerup',\n 'mousedown',\n 'mouseup',\n 'touchstart',\n 'touchend',\n 'click',\n ];\n\n for (const eventName of outsideInteractionEvents) {\n ownerDocument.addEventListener(eventName, handleInteractionCapture, true);\n ownerDocument.addEventListener(eventName, handleInteractionBubble);\n }\n\n /**\n * if this hook executes in a component that mounts via a `pointerdown` event, the event\n * would bubble up to the document and trigger a `pointerDownOutside` event. We avoid\n * this by delaying the event listener registration on the document.\n * This is not React specific, but rather how the DOM works, ie:\n * ```\n * button.addEventListener('pointerdown', () => {\n * console.log('I will log');\n * document.addEventListener('pointerdown', () => {\n * console.log('I will also log');\n * })\n * });\n */\n const timerId = window.setTimeout(() => {\n ownerDocument.addEventListener('pointerdown', handlePointerDown);\n }, 0);\n return () => {\n window.clearTimeout(timerId);\n ownerDocument.removeEventListener('pointerdown', handlePointerDown);\n ownerDocument.removeEventListener('click', handleClickRef.current);\n for (const eventName of outsideInteractionEvents) {\n ownerDocument.removeEventListener(eventName, handleInteractionCapture, true);\n ownerDocument.removeEventListener(eventName, handleInteractionBubble);\n }\n };\n }, [\n ownerDocument,\n handlePointerDownOutside,\n deferPointerDownOutside,\n isDeferredPointerDownOutsideRef,\n dismissableSurfaces,\n shouldHandlePointerDownOutside,\n ]);\n\n return {\n // ensures we check React component tree (not just DOM tree)\n onPointerDownCapture: () => (isPointerInsideReactTreeRef.current = true),\n };\n}\n\n/**\n * Listens for when focus happens outside a react subtree.\n * Returns props to pass to the root (node) of the subtree we want to check.\n */\nfunction useFocusOutside(\n onFocusOutside?: (event: FocusOutsideEvent) => void,\n ownerDocument: Document = globalThis?.document,\n) {\n const handleFocusOutside = useCallbackRef(onFocusOutside) as EventListener;\n const isFocusInsideReactTreeRef = React.useRef(false);\n\n React.useEffect(() => {\n const handleFocus = (event: FocusEvent) => {\n if (event.target && !isFocusInsideReactTreeRef.current) {\n const eventDetail = { originalEvent: event };\n handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {\n discrete: false,\n });\n }\n };\n ownerDocument.addEventListener('focusin', handleFocus);\n return () => ownerDocument.removeEventListener('focusin', handleFocus);\n }, [ownerDocument, handleFocusOutside]);\n\n return {\n onFocusCapture: () => (isFocusInsideReactTreeRef.current = true),\n onBlurCapture: () => (isFocusInsideReactTreeRef.current = false),\n };\n}\n\nfunction dispatchUpdate() {\n const event = new CustomEvent(CONTEXT_UPDATE);\n document.dispatchEvent(event);\n}\n\nfunction handleAndDispatchCustomEvent(\n name: string,\n handler: ((event: E) => void) | undefined,\n detail: { originalEvent: OriginalEvent } & (E extends CustomEvent ? D : never),\n { discrete }: { discrete: boolean },\n) {\n const target = detail.originalEvent.target;\n const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });\n if (handler) target.addEventListener(name, handler as EventListener, { once: true });\n\n if (discrete) {\n dispatchDiscreteCustomEvent(target, event);\n } else {\n target.dispatchEvent(event);\n }\n}\n\nexport {\n DismissableLayer,\n DismissableLayerBranch,\n useDismissableLayerSurface,\n //\n DismissableLayer as Root,\n DismissableLayerBranch as Branch,\n};\nexport type { DismissableLayerProps };\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,uBAAqC;AACrC,6BAAuD;AACvD,gCAAgC;AAChC,oCAA+B;AA6NzB;AAxNN,IAAM,iBAAiB;AACvB,IAAM,uBAAuB;AAC7B,IAAM,gBAAgB;AAEtB,IAAI;AAEJ,IAAM,0BAAgC,oBAAc;AAAA,EAClD,QAAQ,oBAAI,IAA6B;AAAA,EACzC,wCAAwC,oBAAI,IAA6B;AAAA,EACzE,UAAU,oBAAI,IAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOjD,qBAAqB,oBAAI,IAAmC;AAC9D,CAAC;AA4CD,IAAM,mBAAmC,gBAAM;AAAA;AAAA,EAK7C,gCAASA,kBAAiB,OAAO,cAAc;AAC7C,UAAM;AAAA,MACJ,8BAA8B;AAAA,MAC9B,0BAA0B;AAAA,MAC1B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA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AAO,MAAM,cAAc,oBAAoB,WAAW,WAAW;AAAA,EACvE,GAAG,CAAC,eAAe,kBAAkB,CAAC;AAEtC,SAAO;AAAA,IACL,gBAAgB,6BAAO,0BAA0B,UAAU,MAA3C;AAAA,IAChB,eAAe,6BAAO,0BAA0B,UAAU,OAA3C;AAAA,EACjB;AACF;AAxBS;AA0BT,SAAS,iBAAiB;AACxB,QAAM,QAAQ,IAAI,YAAY,cAAc;AAC5C,WAAS,cAAc,KAAK;AAC9B;AAHS;AAKT,SAAS,6BACP,MACA,SACA,QACA,EAAE,SAAS,GACX;AACA,QAAM,SAAS,OAAO,cAAc;AACpC,QAAM,QAAQ,IAAI,YAAY,MAAM,EAAE,SAAS,OAAO,YAAY,MAAM,OAAO,CAAC;AAChF,MAAI,QAAS,QAAO,iBAAiB,MAAM,SAA0B,EAAE,MAAM,KAAK,CAAC;AAEnF,MAAI,UAAU;AACZ,4DAA4B,QAAQ,KAAK;AAAA,EAC3C,OAAO;AACL,WAAO,cAAc,KAAK;AAAA,EAC5B;AACF;AAfS;", + "names": ["DismissableLayer", "DismissableLayerBranch", "handleAndDispatchPointerDownOutsideEvent"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs b/e-commerce/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..8b8b80f54b3b11264b3156f13a537e3d7d534490 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs @@ -0,0 +1,362 @@ +"use client"; +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// 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 { jsx } from "react/jsx-runtime"; +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(), + // Outside elements that belong to a layer's own dismiss affordance (eg, a + // dialog overlay). Pressing them should dismiss the layer regardless of + // whether or not they stop propagation. + // + // See https://github.com/radix-ui/primitives/issues/3346 + dismissableSurfaces: /* @__PURE__ */ new Set() +}); +var DismissableLayer = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DismissableLayer2(props, forwardedRef) { + const { + disableOutsidePointerEvents = false, + deferPointerDownOutside = 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, setNode); + const layers = Array.from(context.layers); + const [highestLayerWithOutsidePointerEventsDisabled] = [ + ...context.layersWithOutsidePointerEventsDisabled + ].slice(-1); + const highestLayerWithOutsidePointerEventsDisabledIndex = highestLayerWithOutsidePointerEventsDisabled ? layers.indexOf(highestLayerWithOutsidePointerEventsDisabled) : -1; + const index = node ? layers.indexOf(node) : -1; + const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0; + const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex; + const isDeferredPointerDownOutsideRef = React.useRef(false); + const pointerDownOutside = usePointerDownOutside( + (event) => { + onPointerDownOutside?.(event); + onInteractOutside?.(event); + if (!event.defaultPrevented) onDismiss?.(); + }, + { + ownerDocument, + deferPointerDownOutside, + isDeferredPointerDownOutsideRef, + dismissableSurfaces: context.dismissableSurfaces, + shouldHandlePointerDownOutside: React.useCallback( + (target) => { + if (!(target instanceof Node)) { + return false; + } + const isPointerDownOnBranch = [...context.branches].some( + (branch) => branch.contains(target) + ); + return isPointerEventsEnabled && !isPointerDownOnBranch; + }, + [context.branches, isPointerEventsEnabled] + ) + } + ); + const focusOutside = useFocusOutside((event) => { + if (deferPointerDownOutside && isDeferredPointerDownOutsideRef.current) { + return; + } + 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); + const isHighestLayer = node ? index === layers.length - 1 : false; + const handleKeyDown = useCallbackRef((event) => { + if (event.key !== "Escape") { + return; + } + onEscapeKeyDown?.(event); + if (!event.defaultPrevented && onDismiss) { + event.preventDefault(); + onDismiss(); + } + }); + React.useEffect(() => { + if (!isHighestLayer) { + return; + } + ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true }); + return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true }); + }, [ownerDocument, isHighestLayer, handleKeyDown]); + 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.delete(node); + if (context.layersWithOutsidePointerEventsDisabled.size === 0) { + 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 = /* @__PURE__ */ __name(() => force({}), "handleUpdate"); + 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") +); +var DismissableLayerBranch = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function DismissableLayerBranch2(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")); +function useDismissableLayerSurface() { + const context = React.useContext(DismissableLayerContext); + const [node, setNode] = React.useState(null); + React.useEffect(() => { + if (!node) { + return; + } + context.dismissableSurfaces.add(node); + return () => { + context.dismissableSurfaces.delete(node); + }; + }, [node, context.dismissableSurfaces]); + return setNode; +} +__name(useDismissableLayerSurface, "useDismissableLayerSurface"); +var IS_TRUE = /* @__PURE__ */ __name(() => true, "IS_TRUE"); +function usePointerDownOutside(onPointerDownOutside, args) { + const { + ownerDocument = globalThis?.document, + deferPointerDownOutside = false, + isDeferredPointerDownOutsideRef, + dismissableSurfaces, + shouldHandlePointerDownOutside = IS_TRUE + } = args; + const handlePointerDownOutside = useCallbackRef(onPointerDownOutside); + const isPointerInsideReactTreeRef = React.useRef(false); + const isPointerDownOutsideRef = React.useRef(false); + const interceptedOutsideInteractionEventsRef = React.useRef(/* @__PURE__ */ new Map()); + const handleClickRef = React.useRef(() => { + }); + React.useEffect(() => { + function resetOutsideInteraction() { + isPointerDownOutsideRef.current = false; + isDeferredPointerDownOutsideRef.current = false; + interceptedOutsideInteractionEventsRef.current.clear(); + } + __name(resetOutsideInteraction, "resetOutsideInteraction"); + function isOutsideInteractionIntercepted() { + return Array.from(interceptedOutsideInteractionEventsRef.current.values()).some(Boolean); + } + __name(isOutsideInteractionIntercepted, "isOutsideInteractionIntercepted"); + function handleInteractionCapture(event) { + if (!isPointerDownOutsideRef.current) { + return; + } + const target = event.target; + const isDismissableSurface = target instanceof Node && [...dismissableSurfaces].some((surface) => surface.contains(target)); + if (!isDismissableSurface) { + interceptedOutsideInteractionEventsRef.current.set(event.type, true); + } + if (event.type === "click") { + window.setTimeout(() => { + if (isPointerDownOutsideRef.current) { + handleClickRef.current(); + } + }, 0); + } + } + __name(handleInteractionCapture, "handleInteractionCapture"); + function handleInteractionBubble(event) { + if (isPointerDownOutsideRef.current) { + interceptedOutsideInteractionEventsRef.current.set(event.type, false); + } + } + __name(handleInteractionBubble, "handleInteractionBubble"); + const handlePointerDown = /* @__PURE__ */ __name((event) => { + if (event.target && !isPointerInsideReactTreeRef.current) { + let handleAndDispatchPointerDownOutsideEvent2 = function() { + ownerDocument.removeEventListener("click", handleClickRef.current); + const wasOutsideInteractionIntercepted = isOutsideInteractionIntercepted(); + resetOutsideInteraction(); + if (!wasOutsideInteractionIntercepted) { + handleAndDispatchCustomEvent( + POINTER_DOWN_OUTSIDE, + handlePointerDownOutside, + eventDetail, + { discrete: true } + ); + } + }; + var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2; + __name(handleAndDispatchPointerDownOutsideEvent2, "handleAndDispatchPointerDownOutsideEvent"); + if (!shouldHandlePointerDownOutside(event.target)) { + ownerDocument.removeEventListener("click", handleClickRef.current); + resetOutsideInteraction(); + isPointerInsideReactTreeRef.current = false; + return; + } + const eventDetail = { originalEvent: event }; + isPointerDownOutsideRef.current = true; + isDeferredPointerDownOutsideRef.current = deferPointerDownOutside && event.button === 0; + interceptedOutsideInteractionEventsRef.current.clear(); + if (!deferPointerDownOutside || event.button !== 0) { + handleAndDispatchPointerDownOutsideEvent2(); + } else { + ownerDocument.removeEventListener("click", handleClickRef.current); + handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2; + ownerDocument.addEventListener("click", handleClickRef.current, { once: true }); + } + } else { + ownerDocument.removeEventListener("click", handleClickRef.current); + resetOutsideInteraction(); + } + isPointerInsideReactTreeRef.current = false; + }, "handlePointerDown"); + const outsideInteractionEvents = [ + "pointerup", + "mousedown", + "mouseup", + "touchstart", + "touchend", + "click" + ]; + for (const eventName of outsideInteractionEvents) { + ownerDocument.addEventListener(eventName, handleInteractionCapture, true); + ownerDocument.addEventListener(eventName, handleInteractionBubble); + } + const timerId = window.setTimeout(() => { + ownerDocument.addEventListener("pointerdown", handlePointerDown); + }, 0); + return () => { + window.clearTimeout(timerId); + ownerDocument.removeEventListener("pointerdown", handlePointerDown); + ownerDocument.removeEventListener("click", handleClickRef.current); + for (const eventName of outsideInteractionEvents) { + ownerDocument.removeEventListener(eventName, handleInteractionCapture, true); + ownerDocument.removeEventListener(eventName, handleInteractionBubble); + } + }; + }, [ + ownerDocument, + handlePointerDownOutside, + deferPointerDownOutside, + isDeferredPointerDownOutsideRef, + dismissableSurfaces, + shouldHandlePointerDownOutside + ]); + return { + // ensures we check React component tree (not just DOM tree) + onPointerDownCapture: /* @__PURE__ */ __name(() => isPointerInsideReactTreeRef.current = true, "onPointerDownCapture") + }; +} +__name(usePointerDownOutside, "usePointerDownOutside"); +function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) { + const handleFocusOutside = useCallbackRef(onFocusOutside); + const isFocusInsideReactTreeRef = React.useRef(false); + React.useEffect(() => { + const handleFocus = /* @__PURE__ */ __name((event) => { + if (event.target && !isFocusInsideReactTreeRef.current) { + const eventDetail = { originalEvent: event }; + handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, { + discrete: false + }); + } + }, "handleFocus"); + ownerDocument.addEventListener("focusin", handleFocus); + return () => ownerDocument.removeEventListener("focusin", handleFocus); + }, [ownerDocument, handleFocusOutside]); + return { + onFocusCapture: /* @__PURE__ */ __name(() => isFocusInsideReactTreeRef.current = true, "onFocusCapture"), + onBlurCapture: /* @__PURE__ */ __name(() => isFocusInsideReactTreeRef.current = false, "onBlurCapture") + }; +} +__name(useFocusOutside, "useFocusOutside"); +function dispatchUpdate() { + const event = new CustomEvent(CONTEXT_UPDATE); + document.dispatchEvent(event); +} +__name(dispatchUpdate, "dispatchUpdate"); +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); + } +} +__name(handleAndDispatchCustomEvent, "handleAndDispatchCustomEvent"); +export { + DismissableLayerBranch as Branch, + DismissableLayer, + DismissableLayerBranch, + DismissableLayer as Root, + useDismissableLayerSurface +}; +//# sourceMappingURL=index.mjs.map diff --git a/e-commerce/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs.map b/e-commerce/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..33e4e1475a555107d9b3f889af1df49696c7220b --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/dismissable-layer.tsx"], + "sourcesContent": ["import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { Primitive, dispatchDiscreteCustomEvent } from '@radix-ui/react-primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\n\n/* -------------------------------------------------------------------------------------------------\n * DismissableLayer\n * -----------------------------------------------------------------------------------------------*/\nconst CONTEXT_UPDATE = 'dismissableLayer.update';\nconst POINTER_DOWN_OUTSIDE = 'dismissableLayer.pointerDownOutside';\nconst FOCUS_OUTSIDE = 'dismissableLayer.focusOutside';\n\nlet originalBodyPointerEvents: string;\n\nconst DismissableLayerContext = React.createContext({\n layers: new Set(),\n layersWithOutsidePointerEventsDisabled: new Set(),\n branches: new Set(),\n\n // Outside elements that belong to a layer's own dismiss affordance (eg, a\n // dialog overlay). Pressing them should dismiss the layer regardless of\n // whether or not they stop propagation.\n //\n // See https://github.com/radix-ui/primitives/issues/3346\n dismissableSurfaces: new Set(),\n});\n\ntype DismissableLayerElement = React.ComponentRef;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef;\ninterface DismissableLayerProps extends PrimitiveDivProps {\n /**\n * When `true`, hover/focus/click interactions will be disabled on elements outside\n * the `DismissableLayer`. Users will need to click twice on outside elements to\n * interact with them: once to close the `DismissableLayer`, and again to trigger the element.\n */\n disableOutsidePointerEvents?: boolean | undefined;\n /**\n * When `true`, a `'pointerdown'` event outside of the layered element will\n * wait for the interaction's click event before dispatching, allowing\n * third-party code to stop propagation of later events and cancel dismissal.\n */\n deferPointerDownOutside?: boolean | undefined;\n /**\n * Event handler called when the escape key is down.\n * Can be prevented.\n */\n onEscapeKeyDown?: ((event: KeyboardEvent) => void) | undefined;\n /**\n * Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`.\n * Can be prevented.\n */\n onPointerDownOutside?: ((event: PointerDownOutsideEvent) => void) | undefined;\n /**\n * Event handler called when the focus moves outside of the `DismissableLayer`.\n * Can be prevented.\n */\n onFocusOutside?: ((event: FocusOutsideEvent) => void) | undefined;\n /**\n * Event handler called when an interaction happens outside the `DismissableLayer`.\n * Specifically, when a `pointerdown` event happens outside or focus moves outside of it.\n * Can be prevented.\n */\n onInteractOutside?: ((event: PointerDownOutsideEvent | FocusOutsideEvent) => void) | undefined;\n /**\n * Handler called when the `DismissableLayer` should be dismissed\n */\n onDismiss?: (() => void) | undefined;\n}\n\nconst DismissableLayer = /* @__PURE__ */ React.forwardRef<\n DismissableLayerElement,\n DismissableLayerProps\n>(\n // blank line to reduce diff noise\n function DismissableLayer(props, forwardedRef) {\n const {\n disableOutsidePointerEvents = false,\n deferPointerDownOutside = false,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n ...layerProps\n } = props;\n const context = React.useContext(DismissableLayerContext);\n const [node, setNode] = React.useState(null);\n const ownerDocument = node?.ownerDocument ?? globalThis?.document;\n const [, force] = React.useState({});\n const composedRefs = useComposedRefs(forwardedRef, setNode);\n const layers = Array.from(context.layers);\n const [highestLayerWithOutsidePointerEventsDisabled] = [\n ...context.layersWithOutsidePointerEventsDisabled,\n ].slice(-1);\n const highestLayerWithOutsidePointerEventsDisabledIndex =\n highestLayerWithOutsidePointerEventsDisabled\n ? layers.indexOf(highestLayerWithOutsidePointerEventsDisabled)\n : -1;\n const index = node ? layers.indexOf(node) : -1;\n const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;\n const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;\n const isDeferredPointerDownOutsideRef = React.useRef(false);\n\n const pointerDownOutside = usePointerDownOutside(\n (event) => {\n onPointerDownOutside?.(event);\n onInteractOutside?.(event);\n if (!event.defaultPrevented) onDismiss?.();\n },\n {\n ownerDocument,\n deferPointerDownOutside,\n isDeferredPointerDownOutsideRef,\n dismissableSurfaces: context.dismissableSurfaces,\n shouldHandlePointerDownOutside: React.useCallback(\n (target: EventTarget | null) => {\n if (!(target instanceof Node)) {\n return false;\n }\n\n const isPointerDownOnBranch = [...context.branches].some((branch) =>\n branch.contains(target),\n );\n return isPointerEventsEnabled && !isPointerDownOnBranch;\n },\n [context.branches, isPointerEventsEnabled],\n ),\n },\n );\n\n const focusOutside = useFocusOutside((event) => {\n if (deferPointerDownOutside && isDeferredPointerDownOutsideRef.current) {\n return;\n }\n\n const target = event.target as HTMLElement;\n const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));\n if (isFocusInBranch) return;\n onFocusOutside?.(event);\n onInteractOutside?.(event);\n if (!event.defaultPrevented) onDismiss?.();\n }, ownerDocument);\n\n const isHighestLayer = node ? index === layers.length - 1 : false;\n\n // Stabilize via `useCallbackRef` rather than `useEffectEvent`: React's\n // native `useEffectEvent` returns a stale closure inside `forwardRef`\n // components on React 19.2.x, which caused escape handlers to observe\n // mount-time props/state instead of the latest values.\n //\n // We should revert this to use useEffectEvent when the fix lands in React.\n //\n // - https://github.com/radix-ui/primitives/issues/4014\n // - https://github.com/react/react/pull/34831\n const handleKeyDown = useCallbackRef((event: KeyboardEvent) => {\n if (event.key !== 'Escape') {\n return;\n }\n\n onEscapeKeyDown?.(event);\n if (!event.defaultPrevented && onDismiss) {\n event.preventDefault();\n onDismiss();\n }\n });\n\n React.useEffect(() => {\n if (!isHighestLayer) {\n return;\n }\n\n ownerDocument.addEventListener('keydown', handleKeyDown, { capture: true });\n return () => ownerDocument.removeEventListener('keydown', handleKeyDown, { capture: true });\n }, [ownerDocument, isHighestLayer, handleKeyDown]);\n\n React.useEffect(() => {\n if (!node) return;\n if (disableOutsidePointerEvents) {\n if (context.layersWithOutsidePointerEventsDisabled.size === 0) {\n originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;\n ownerDocument.body.style.pointerEvents = 'none';\n }\n context.layersWithOutsidePointerEventsDisabled.add(node);\n }\n context.layers.add(node);\n dispatchUpdate();\n return () => {\n // We must remove this layer from the disabled set whenever\n // `disableOutsidePointerEvents` becomes `false` (eg, when a modal\n // closes but stays mounted during an exit animation) and not only on\n // unmount. Otherwise the `body` `pointer-events` could be left as\n // `none` when multiple layers overlap.\n // See: https://github.com/radix-ui/primitives/issues/3645\n if (disableOutsidePointerEvents) {\n context.layersWithOutsidePointerEventsDisabled.delete(node);\n if (context.layersWithOutsidePointerEventsDisabled.size === 0) {\n ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;\n }\n }\n };\n }, [node, ownerDocument, disableOutsidePointerEvents, context]);\n\n /**\n * We purposefully prevent combining this effect with the `disableOutsidePointerEvents` effect\n * because a change to `disableOutsidePointerEvents` would remove this layer from the stack\n * and add it to the end again so the layering order wouldn't be _creation order_.\n * We only want them to be removed from context stacks when unmounted.\n */\n React.useEffect(() => {\n return () => {\n if (!node) return;\n context.layers.delete(node);\n context.layersWithOutsidePointerEventsDisabled.delete(node);\n dispatchUpdate();\n };\n }, [node, context]);\n\n React.useEffect(() => {\n const handleUpdate = () => force({});\n document.addEventListener(CONTEXT_UPDATE, handleUpdate);\n return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);\n }, []);\n\n return (\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DismissableLayerBranch\n * -----------------------------------------------------------------------------------------------*/\n\ntype DismissableLayerBranchElement = React.ComponentRef;\ninterface DismissableLayerBranchProps extends PrimitiveDivProps {}\n\nconst DismissableLayerBranch = /* @__PURE__ */ React.forwardRef<\n DismissableLayerBranchElement,\n DismissableLayerBranchProps\n>(function DismissableLayerBranch(props, forwardedRef) {\n const context = React.useContext(DismissableLayerContext);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n\n React.useEffect(() => {\n const node = ref.current;\n if (node) {\n context.branches.add(node);\n return () => {\n context.branches.delete(node);\n };\n }\n }, [context.branches]);\n\n return ;\n});\n\n/* -----------------------------------------------------------------------------------------------*/\n\n/**\n * Registers a node as a \"dismiss surface\" for the enclosing DismissableLayer\n */\nfunction useDismissableLayerSurface(): React.RefCallback {\n const context = React.useContext(DismissableLayerContext);\n const [node, setNode] = React.useState(null);\n\n React.useEffect(() => {\n if (!node) {\n return;\n }\n context.dismissableSurfaces.add(node);\n return () => {\n context.dismissableSurfaces.delete(node);\n };\n }, [node, context.dismissableSurfaces]);\n\n return setNode;\n}\n\ntype PointerDownOutsideEvent = CustomEvent<{ originalEvent: PointerEvent }>;\ntype FocusOutsideEvent = CustomEvent<{ originalEvent: FocusEvent }>;\n\nconst IS_TRUE = () => true;\n\n/**\n * Listens for `pointerdown` outside a react subtree. We detect the start of the interaction on\n * `pointerdown`, then wait for `click` so external code can intercept later mouse events.\n * Returns props to pass to the node we want to check for outside events.\n */\nfunction usePointerDownOutside(\n onPointerDownOutside: ((event: PointerDownOutsideEvent) => void) | undefined,\n args: {\n ownerDocument: Document | undefined;\n deferPointerDownOutside: boolean;\n isDeferredPointerDownOutsideRef: React.RefObject;\n dismissableSurfaces: Set;\n shouldHandlePointerDownOutside?: ((target: EventTarget | null) => boolean) | undefined;\n },\n) {\n const {\n ownerDocument = globalThis?.document,\n deferPointerDownOutside = false,\n isDeferredPointerDownOutsideRef,\n dismissableSurfaces,\n shouldHandlePointerDownOutside = IS_TRUE,\n } = args;\n const handlePointerDownOutside = useCallbackRef(onPointerDownOutside) as EventListener;\n const isPointerInsideReactTreeRef = React.useRef(false);\n const isPointerDownOutsideRef = React.useRef(false);\n const interceptedOutsideInteractionEventsRef = React.useRef>(new Map());\n const handleClickRef = React.useRef(() => {});\n\n React.useEffect(() => {\n function resetOutsideInteraction() {\n isPointerDownOutsideRef.current = false;\n isDeferredPointerDownOutsideRef.current = false;\n interceptedOutsideInteractionEventsRef.current.clear();\n }\n\n function isOutsideInteractionIntercepted() {\n return Array.from(interceptedOutsideInteractionEventsRef.current.values()).some(Boolean);\n }\n\n function handleInteractionCapture(event: Event) {\n if (!isPointerDownOutsideRef.current) {\n return;\n }\n\n const target = event.target;\n const isDismissableSurface =\n target instanceof Node &&\n [...dismissableSurfaces].some((surface) => surface.contains(target as Node));\n\n if (!isDismissableSurface) {\n interceptedOutsideInteractionEventsRef.current.set(event.type, true);\n }\n\n if (event.type === 'click') {\n window.setTimeout(() => {\n if (isPointerDownOutsideRef.current) {\n handleClickRef.current();\n }\n }, 0);\n }\n }\n\n function handleInteractionBubble(event: Event) {\n if (isPointerDownOutsideRef.current) {\n interceptedOutsideInteractionEventsRef.current.set(event.type, false);\n }\n }\n\n const handlePointerDown = (event: PointerEvent) => {\n if (event.target && !isPointerInsideReactTreeRef.current) {\n if (!shouldHandlePointerDownOutside(event.target)) {\n ownerDocument.removeEventListener('click', handleClickRef.current);\n resetOutsideInteraction();\n isPointerInsideReactTreeRef.current = false;\n return;\n }\n\n const eventDetail = { originalEvent: event };\n isPointerDownOutsideRef.current = true;\n isDeferredPointerDownOutsideRef.current = deferPointerDownOutside && event.button === 0;\n interceptedOutsideInteractionEventsRef.current.clear();\n\n function handleAndDispatchPointerDownOutsideEvent() {\n ownerDocument.removeEventListener('click', handleClickRef.current);\n const wasOutsideInteractionIntercepted = isOutsideInteractionIntercepted();\n resetOutsideInteraction();\n\n if (!wasOutsideInteractionIntercepted) {\n handleAndDispatchCustomEvent(\n POINTER_DOWN_OUTSIDE,\n handlePointerDownOutside,\n eventDetail,\n { discrete: true },\n );\n }\n }\n\n /**\n * When deferring, we need to wait for a click event because:\n *\n * 1. On touch devices, browsers implement a ~350ms delay between the\n * time the user stops touching the display and when the browser\n * executes events. We need to ensure we don't reactivate\n * pointer-events within this timeframe otherwise the browser may\n * execute events that should have been prevented.\n *\n * 2. Browser extensions and other third-party code may call\n * `stopPropagation` on later mouse events like `mousedown`,\n * `mouseup`, or `click`. Waiting lets those intercepted events\n * cancel the outside interaction before we dismiss the layer. See\n * https://github.com/radix-ui/primitives/issues/2055\n *\n * Additionally, this also lets us deal automatically with cancellations\n * when a click event isn't raised because the page was considered\n * scrolled/drag-scrolled, long-pressed, etc.\n *\n * This is why we also continuously remove the previous listener,\n * because we cannot be certain that it was raised, and therefore\n * cleaned-up.\n *\n * For non-primary buttons, we dispatch the event immediately because we\n * cannot be certain that the event was canceled.\n */\n if (!deferPointerDownOutside || event.button !== 0) {\n handleAndDispatchPointerDownOutsideEvent();\n } else {\n ownerDocument.removeEventListener('click', handleClickRef.current);\n handleClickRef.current = handleAndDispatchPointerDownOutsideEvent;\n ownerDocument.addEventListener('click', handleClickRef.current, { once: true });\n }\n } else {\n // We need to remove the event listener in case the outside click has been canceled.\n // See: https://github.com/radix-ui/primitives/issues/2171\n ownerDocument.removeEventListener('click', handleClickRef.current);\n resetOutsideInteraction();\n }\n isPointerInsideReactTreeRef.current = false;\n };\n\n const outsideInteractionEvents = [\n 'pointerup',\n 'mousedown',\n 'mouseup',\n 'touchstart',\n 'touchend',\n 'click',\n ];\n\n for (const eventName of outsideInteractionEvents) {\n ownerDocument.addEventListener(eventName, handleInteractionCapture, true);\n ownerDocument.addEventListener(eventName, handleInteractionBubble);\n }\n\n /**\n * if this hook executes in a component that mounts via a `pointerdown` event, the event\n * would bubble up to the document and trigger a `pointerDownOutside` event. We avoid\n * this by delaying the event listener registration on the document.\n * This is not React specific, but rather how the DOM works, ie:\n * ```\n * button.addEventListener('pointerdown', () => {\n * console.log('I will log');\n * document.addEventListener('pointerdown', () => {\n * console.log('I will also log');\n * })\n * });\n */\n const timerId = window.setTimeout(() => {\n ownerDocument.addEventListener('pointerdown', handlePointerDown);\n }, 0);\n return () => {\n window.clearTimeout(timerId);\n ownerDocument.removeEventListener('pointerdown', handlePointerDown);\n ownerDocument.removeEventListener('click', handleClickRef.current);\n for (const eventName of outsideInteractionEvents) {\n ownerDocument.removeEventListener(eventName, handleInteractionCapture, true);\n ownerDocument.removeEventListener(eventName, handleInteractionBubble);\n }\n };\n }, [\n ownerDocument,\n handlePointerDownOutside,\n deferPointerDownOutside,\n isDeferredPointerDownOutsideRef,\n dismissableSurfaces,\n shouldHandlePointerDownOutside,\n ]);\n\n return {\n // ensures we check React component tree (not just DOM tree)\n onPointerDownCapture: () => (isPointerInsideReactTreeRef.current = true),\n };\n}\n\n/**\n * Listens for when focus happens outside a react subtree.\n * Returns props to pass to the root (node) of the subtree we want to check.\n */\nfunction useFocusOutside(\n onFocusOutside?: (event: FocusOutsideEvent) => void,\n ownerDocument: Document = globalThis?.document,\n) {\n const handleFocusOutside = useCallbackRef(onFocusOutside) as EventListener;\n const isFocusInsideReactTreeRef = React.useRef(false);\n\n React.useEffect(() => {\n const handleFocus = (event: FocusEvent) => {\n if (event.target && !isFocusInsideReactTreeRef.current) {\n const eventDetail = { originalEvent: event };\n handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {\n discrete: false,\n });\n }\n };\n ownerDocument.addEventListener('focusin', handleFocus);\n return () => ownerDocument.removeEventListener('focusin', handleFocus);\n }, [ownerDocument, handleFocusOutside]);\n\n return {\n onFocusCapture: () => (isFocusInsideReactTreeRef.current = true),\n onBlurCapture: () => (isFocusInsideReactTreeRef.current = false),\n };\n}\n\nfunction dispatchUpdate() {\n const event = new CustomEvent(CONTEXT_UPDATE);\n document.dispatchEvent(event);\n}\n\nfunction handleAndDispatchCustomEvent(\n name: string,\n handler: ((event: E) => void) | undefined,\n detail: { originalEvent: OriginalEvent } & (E extends CustomEvent ? D : never),\n { discrete }: { discrete: boolean },\n) {\n const target = detail.originalEvent.target;\n const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });\n if (handler) target.addEventListener(name, handler as EventListener, { once: true });\n\n if (discrete) {\n dispatchDiscreteCustomEvent(target, event);\n } else {\n target.dispatchEvent(event);\n }\n}\n\nexport {\n DismissableLayer,\n DismissableLayerBranch,\n useDismissableLayerSurface,\n //\n DismissableLayer as Root,\n DismissableLayerBranch as Branch,\n};\nexport type { DismissableLayerProps };\n"], + "mappings": ";;;;;AAAA,YAAY,WAAW;AACvB,SAAS,4BAA4B;AACrC,SAAS,WAAW,mCAAmC;AACvD,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AA6NzB;AAxNN,IAAM,iBAAiB;AACvB,IAAM,uBAAuB;AAC7B,IAAM,gBAAgB;AAEtB,IAAI;AAEJ,IAAM,0BAAgC,oBAAc;AAAA,EAClD,QAAQ,oBAAI,IAA6B;AAAA,EACzC,wCAAwC,oBAAI,IAA6B;AAAA,EACzE,UAAU,oBAAI,IAAmC;AAAA;AAAA;AAAA;AAAA;A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AAC,UAAsB;AACzC,UAAI,MAAM,UAAU,CAAC,0BAA0B,SAAS;AACtD,cAAM,cAAc,EAAE,eAAe,MAAM;AAC3C,qCAA6B,eAAe,oBAAoB,aAAa;AAAA,UAC3E,UAAU;AAAA,QACZ,CAAC;AAAA,MACH;AAAA,IACF,GAPoB;AAQpB,kBAAc,iBAAiB,WAAW,WAAW;AACrD,WAAO,MAAM,cAAc,oBAAoB,WAAW,WAAW;AAAA,EACvE,GAAG,CAAC,eAAe,kBAAkB,CAAC;AAEtC,SAAO;AAAA,IACL,gBAAgB,6BAAO,0BAA0B,UAAU,MAA3C;AAAA,IAChB,eAAe,6BAAO,0BAA0B,UAAU,OAA3C;AAAA,EACjB;AACF;AAxBS;AA0BT,SAAS,iBAAiB;AACxB,QAAM,QAAQ,IAAI,YAAY,cAAc;AAC5C,WAAS,cAAc,KAAK;AAC9B;AAHS;AAKT,SAAS,6BACP,MACA,SACA,QACA,EAAE,SAAS,GACX;AACA,QAAM,SAAS,OAAO,cAAc;AACpC,QAAM,QAAQ,IAAI,YAAY,MAAM,EAAE,SAAS,OAAO,YAAY,MAAM,OAAO,CAAC;AAChF,MAAI,QAAS,QAAO,iBAAiB,MAAM,SAA0B,EAAE,MAAM,KAAK,CAAC;AAEnF,MAAI,UAAU;AACZ,gCAA4B,QAAQ,KAAK;AAAA,EAC3C,OAAO;AACL,WAAO,cAAc,KAAK;AAAA,EAC5B;AACF;AAfS;", + "names": ["DismissableLayer", "DismissableLayerBranch", "handleAndDispatchPointerDownOutsideEvent"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-dismissable-layer/package.json b/e-commerce/node_modules/@radix-ui/react-dismissable-layer/package.json new file mode 100644 index 0000000000000000000000000000000000000000..38a62128f788c78795ef7889bd4e12a21cddb115 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dismissable-layer/package.json @@ -0,0 +1,74 @@ +{ + "name": "@radix-ui/react-dismissable-layer", + "version": "1.2.0", + "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.2.0", + "@radix-ui/react-compose-refs": "1.1.5", + "@radix-ui/react-primitive": "2.2.0", + "@radix-ui/react-use-callback-ref": "1.1.5", + "@radix-ui/react-use-effect-event": "0.0.5" + }, + "devDependencies": { + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "react": "^19.3.0", + "react-dom": "^19.3.0", + "react-remove-scroll": "^2.7.2", + "typescript": "^5.9.3", + "@repo/builder": "0.0.0", + "@repo/test-utils": "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", + "directory": "packages/react/dismissable-layer" + }, + "bugs": { + "url": "https://github.com/radix-ui/primitives/issues" + }, + "scripts": { + "lint": "oxlint --max-warnings 0 src", + "clean": "rm -rf dist", + "reset": "rm -rf dist node_modules", + "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" + } + } + } +} \ No newline at end of file diff --git a/e-commerce/node_modules/@radix-ui/react-dropdown-menu/LICENSE b/e-commerce/node_modules/@radix-ui/react-dropdown-menu/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a18858fb7b014098cba85703e66609be66a26ef5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dropdown-menu/LICENSE @@ -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. diff --git a/e-commerce/node_modules/@radix-ui/react-dropdown-menu/README.md b/e-commerce/node_modules/@radix-ui/react-dropdown-menu/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d1e96feb24b6a55e0897c5ba9171b2a7a636ec7a --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dropdown-menu/README.md @@ -0,0 +1,3 @@ +# `react-dropdown-menu` + +View docs [here](https://radix-ui.com/primitives/docs/components/dropdown-menu). diff --git a/e-commerce/node_modules/@radix-ui/react-dropdown-menu/dist/index.d.mts b/e-commerce/node_modules/@radix-ui/react-dropdown-menu/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..3da1d1525bea586326aca5d8d6499db4c72b8956 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dropdown-menu/dist/index.d.mts @@ -0,0 +1,85 @@ +import * as _radix_ui_react_context from '@radix-ui/react-context'; +import * as React from 'react'; +import { Primitive } from '@radix-ui/react-primitive'; +import * as MenuPrimitive from '@radix-ui/react-menu'; + +declare const Direction: { + readonly LTR: "ltr"; + readonly RTL: "rtl"; +}; +type Direction = (typeof Direction)[keyof typeof Direction]; +declare const createDropdownMenuScope: _radix_ui_react_context.CreateScope; +interface DropdownMenuProps { + children?: React.ReactNode | undefined; + dir?: Direction | undefined; + open?: boolean | undefined; + defaultOpen?: boolean | undefined; + onOpenChange?: ((open: boolean) => void) | undefined; + modal?: boolean | undefined; +} +declare const DropdownMenu: React.FC; +type PrimitiveButtonProps = React.ComponentPropsWithoutRef; +interface DropdownMenuTriggerProps extends PrimitiveButtonProps { +} +declare const DropdownMenuTrigger: React.ForwardRefExoticComponent>; +type MenuPortalProps = React.ComponentPropsWithoutRef; +interface DropdownMenuPortalProps extends MenuPortalProps { +} +declare const DropdownMenuPortal: React.FC; +type MenuContentProps = React.ComponentPropsWithoutRef; +interface DropdownMenuContentProps extends Omit { +} +declare const DropdownMenuContent: React.ForwardRefExoticComponent>; +type MenuGroupProps = React.ComponentPropsWithoutRef; +interface DropdownMenuGroupProps extends MenuGroupProps { +} +declare const DropdownMenuGroup: React.ForwardRefExoticComponent>; +type MenuLabelProps = React.ComponentPropsWithoutRef; +interface DropdownMenuLabelProps extends MenuLabelProps { +} +declare const DropdownMenuLabel: React.ForwardRefExoticComponent>; +type MenuItemProps = React.ComponentPropsWithoutRef; +interface DropdownMenuItemProps extends MenuItemProps { +} +declare const DropdownMenuItem: React.ForwardRefExoticComponent>; +type MenuCheckboxItemProps = React.ComponentPropsWithoutRef; +interface DropdownMenuCheckboxItemProps extends MenuCheckboxItemProps { +} +declare const DropdownMenuCheckboxItem: React.ForwardRefExoticComponent>; +type MenuRadioGroupProps = React.ComponentPropsWithoutRef; +interface DropdownMenuRadioGroupProps extends MenuRadioGroupProps { +} +declare const DropdownMenuRadioGroup: React.ForwardRefExoticComponent>; +type MenuRadioItemProps = React.ComponentPropsWithoutRef; +interface DropdownMenuRadioItemProps extends MenuRadioItemProps { +} +declare const DropdownMenuRadioItem: React.ForwardRefExoticComponent>; +type MenuItemIndicatorProps = React.ComponentPropsWithoutRef; +interface DropdownMenuItemIndicatorProps extends MenuItemIndicatorProps { +} +declare const DropdownMenuItemIndicator: React.ForwardRefExoticComponent>; +type MenuSeparatorProps = React.ComponentPropsWithoutRef; +interface DropdownMenuSeparatorProps extends MenuSeparatorProps { +} +declare const DropdownMenuSeparator: React.ForwardRefExoticComponent>; +type MenuArrowProps = React.ComponentPropsWithoutRef; +interface DropdownMenuArrowProps extends MenuArrowProps { +} +declare const DropdownMenuArrow: React.ForwardRefExoticComponent>; +interface DropdownMenuSubProps { + children?: React.ReactNode | undefined; + open?: boolean | undefined; + defaultOpen?: boolean | undefined; + onOpenChange?: ((open: boolean) => void) | undefined; +} +declare const DropdownMenuSub: React.FC; +type MenuSubTriggerProps = React.ComponentPropsWithoutRef; +interface DropdownMenuSubTriggerProps extends MenuSubTriggerProps { +} +declare const DropdownMenuSubTrigger: React.ForwardRefExoticComponent>; +type MenuSubContentProps = React.ComponentPropsWithoutRef; +interface DropdownMenuSubContentProps extends MenuSubContentProps { +} +declare const DropdownMenuSubContent: React.ForwardRefExoticComponent>; + +export { DropdownMenuArrow as Arrow, DropdownMenuCheckboxItem as CheckboxItem, DropdownMenuContent as Content, DropdownMenu, DropdownMenuArrow, type DropdownMenuArrowProps, DropdownMenuCheckboxItem, type DropdownMenuCheckboxItemProps, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuGroup, type DropdownMenuGroupProps, DropdownMenuItem, DropdownMenuItemIndicator, type DropdownMenuItemIndicatorProps, type DropdownMenuItemProps, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, type DropdownMenuPortalProps, type DropdownMenuProps, DropdownMenuRadioGroup, type DropdownMenuRadioGroupProps, DropdownMenuRadioItem, type DropdownMenuRadioItemProps, DropdownMenuSeparator, type DropdownMenuSeparatorProps, DropdownMenuSub, DropdownMenuSubContent, type DropdownMenuSubContentProps, type DropdownMenuSubProps, DropdownMenuSubTrigger, type DropdownMenuSubTriggerProps, DropdownMenuTrigger, type DropdownMenuTriggerProps, DropdownMenuGroup as Group, DropdownMenuItem as Item, DropdownMenuItemIndicator as ItemIndicator, DropdownMenuLabel as Label, DropdownMenuPortal as Portal, DropdownMenuRadioGroup as RadioGroup, DropdownMenuRadioItem as RadioItem, DropdownMenu as Root, DropdownMenuSeparator as Separator, DropdownMenuSub as Sub, DropdownMenuSubContent as SubContent, DropdownMenuSubTrigger as SubTrigger, DropdownMenuTrigger as Trigger, createDropdownMenuScope }; diff --git a/e-commerce/node_modules/@radix-ui/react-dropdown-menu/dist/index.d.ts b/e-commerce/node_modules/@radix-ui/react-dropdown-menu/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3da1d1525bea586326aca5d8d6499db4c72b8956 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dropdown-menu/dist/index.d.ts @@ -0,0 +1,85 @@ +import * as _radix_ui_react_context from '@radix-ui/react-context'; +import * as React from 'react'; +import { Primitive } from '@radix-ui/react-primitive'; +import * as MenuPrimitive from '@radix-ui/react-menu'; + +declare const Direction: { + readonly LTR: "ltr"; + readonly RTL: "rtl"; +}; +type Direction = (typeof Direction)[keyof typeof Direction]; +declare const createDropdownMenuScope: _radix_ui_react_context.CreateScope; +interface DropdownMenuProps { + children?: React.ReactNode | undefined; + dir?: Direction | undefined; + open?: boolean | undefined; + defaultOpen?: boolean | undefined; + onOpenChange?: ((open: boolean) => void) | undefined; + modal?: boolean | undefined; +} +declare const DropdownMenu: React.FC; +type PrimitiveButtonProps = React.ComponentPropsWithoutRef; +interface DropdownMenuTriggerProps extends PrimitiveButtonProps { +} +declare const DropdownMenuTrigger: React.ForwardRefExoticComponent>; +type MenuPortalProps = React.ComponentPropsWithoutRef; +interface DropdownMenuPortalProps extends MenuPortalProps { +} +declare const DropdownMenuPortal: React.FC; +type MenuContentProps = React.ComponentPropsWithoutRef; +interface DropdownMenuContentProps extends Omit { +} +declare const DropdownMenuContent: React.ForwardRefExoticComponent>; +type MenuGroupProps = React.ComponentPropsWithoutRef; +interface DropdownMenuGroupProps extends MenuGroupProps { +} +declare const DropdownMenuGroup: React.ForwardRefExoticComponent>; +type MenuLabelProps = React.ComponentPropsWithoutRef; +interface DropdownMenuLabelProps extends MenuLabelProps { +} +declare const DropdownMenuLabel: React.ForwardRefExoticComponent>; +type MenuItemProps = React.ComponentPropsWithoutRef; +interface DropdownMenuItemProps extends MenuItemProps { +} +declare const DropdownMenuItem: React.ForwardRefExoticComponent>; +type MenuCheckboxItemProps = React.ComponentPropsWithoutRef; +interface DropdownMenuCheckboxItemProps extends MenuCheckboxItemProps { +} +declare const DropdownMenuCheckboxItem: React.ForwardRefExoticComponent>; +type MenuRadioGroupProps = React.ComponentPropsWithoutRef; +interface DropdownMenuRadioGroupProps extends MenuRadioGroupProps { +} +declare const DropdownMenuRadioGroup: React.ForwardRefExoticComponent>; +type MenuRadioItemProps = React.ComponentPropsWithoutRef; +interface DropdownMenuRadioItemProps extends MenuRadioItemProps { +} +declare const DropdownMenuRadioItem: React.ForwardRefExoticComponent>; +type MenuItemIndicatorProps = React.ComponentPropsWithoutRef; +interface DropdownMenuItemIndicatorProps extends MenuItemIndicatorProps { +} +declare const DropdownMenuItemIndicator: React.ForwardRefExoticComponent>; +type MenuSeparatorProps = React.ComponentPropsWithoutRef; +interface DropdownMenuSeparatorProps extends MenuSeparatorProps { +} +declare const DropdownMenuSeparator: React.ForwardRefExoticComponent>; +type MenuArrowProps = React.ComponentPropsWithoutRef; +interface DropdownMenuArrowProps extends MenuArrowProps { +} +declare const DropdownMenuArrow: React.ForwardRefExoticComponent>; +interface DropdownMenuSubProps { + children?: React.ReactNode | undefined; + open?: boolean | undefined; + defaultOpen?: boolean | undefined; + onOpenChange?: ((open: boolean) => void) | undefined; +} +declare const DropdownMenuSub: React.FC; +type MenuSubTriggerProps = React.ComponentPropsWithoutRef; +interface DropdownMenuSubTriggerProps extends MenuSubTriggerProps { +} +declare const DropdownMenuSubTrigger: React.ForwardRefExoticComponent>; +type MenuSubContentProps = React.ComponentPropsWithoutRef; +interface DropdownMenuSubContentProps extends MenuSubContentProps { +} +declare const DropdownMenuSubContent: React.ForwardRefExoticComponent>; + +export { DropdownMenuArrow as Arrow, DropdownMenuCheckboxItem as CheckboxItem, DropdownMenuContent as Content, DropdownMenu, DropdownMenuArrow, type DropdownMenuArrowProps, DropdownMenuCheckboxItem, type DropdownMenuCheckboxItemProps, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuGroup, type DropdownMenuGroupProps, DropdownMenuItem, DropdownMenuItemIndicator, type DropdownMenuItemIndicatorProps, type DropdownMenuItemProps, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, type DropdownMenuPortalProps, type DropdownMenuProps, DropdownMenuRadioGroup, type DropdownMenuRadioGroupProps, DropdownMenuRadioItem, type DropdownMenuRadioItemProps, DropdownMenuSeparator, type DropdownMenuSeparatorProps, DropdownMenuSub, DropdownMenuSubContent, type DropdownMenuSubContentProps, type DropdownMenuSubProps, DropdownMenuSubTrigger, type DropdownMenuSubTriggerProps, DropdownMenuTrigger, type DropdownMenuTriggerProps, DropdownMenuGroup as Group, DropdownMenuItem as Item, DropdownMenuItemIndicator as ItemIndicator, DropdownMenuLabel as Label, DropdownMenuPortal as Portal, DropdownMenuRadioGroup as RadioGroup, DropdownMenuRadioItem as RadioItem, DropdownMenu as Root, DropdownMenuSeparator as Separator, DropdownMenuSub as Sub, DropdownMenuSubContent as SubContent, DropdownMenuSubTrigger as SubTrigger, DropdownMenuTrigger as Trigger, createDropdownMenuScope }; diff --git a/e-commerce/node_modules/@radix-ui/react-dropdown-menu/dist/index.js b/e-commerce/node_modules/@radix-ui/react-dropdown-menu/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..bebbcf754e77fa8531ed5000231b51d99d0c1806 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dropdown-menu/dist/index.js @@ -0,0 +1,302 @@ +"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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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: () => DropdownMenuArrow, + CheckboxItem: () => DropdownMenuCheckboxItem, + Content: () => DropdownMenuContent, + DropdownMenu: () => DropdownMenu, + DropdownMenuArrow: () => DropdownMenuArrow, + DropdownMenuCheckboxItem: () => DropdownMenuCheckboxItem, + DropdownMenuContent: () => DropdownMenuContent, + DropdownMenuGroup: () => DropdownMenuGroup, + DropdownMenuItem: () => DropdownMenuItem, + DropdownMenuItemIndicator: () => DropdownMenuItemIndicator, + DropdownMenuLabel: () => DropdownMenuLabel, + DropdownMenuPortal: () => DropdownMenuPortal, + DropdownMenuRadioGroup: () => DropdownMenuRadioGroup, + DropdownMenuRadioItem: () => DropdownMenuRadioItem, + DropdownMenuSeparator: () => DropdownMenuSeparator, + DropdownMenuSub: () => DropdownMenuSub, + DropdownMenuSubContent: () => DropdownMenuSubContent, + DropdownMenuSubTrigger: () => DropdownMenuSubTrigger, + DropdownMenuTrigger: () => DropdownMenuTrigger, + Group: () => DropdownMenuGroup, + Item: () => DropdownMenuItem, + ItemIndicator: () => DropdownMenuItemIndicator, + Label: () => DropdownMenuLabel, + Portal: () => DropdownMenuPortal, + RadioGroup: () => DropdownMenuRadioGroup, + RadioItem: () => DropdownMenuRadioItem, + Root: () => DropdownMenu, + Separator: () => DropdownMenuSeparator, + Sub: () => DropdownMenuSub, + SubContent: () => DropdownMenuSubContent, + SubTrigger: () => DropdownMenuSubTrigger, + Trigger: () => DropdownMenuTrigger, + createDropdownMenuScope: () => createDropdownMenuScope +}); +module.exports = __toCommonJS(index_exports); + +// src/dropdown-menu.tsx +var React = __toESM(require("react")); +var import_primitive = require("@radix-ui/primitive"); +var import_react_compose_refs = require("@radix-ui/react-compose-refs"); +var import_react_context = require("@radix-ui/react-context"); +var import_react_use_controllable_state = require("@radix-ui/react-use-controllable-state"); +var import_react_primitive = require("@radix-ui/react-primitive"); +var MenuPrimitive = __toESM(require("@radix-ui/react-menu")); +var import_react_menu = require("@radix-ui/react-menu"); +var import_react_id = require("@radix-ui/react-id"); +var import_jsx_runtime = require("react/jsx-runtime"); +var DROPDOWN_MENU_NAME = "DropdownMenu"; +var [createDropdownMenuContext, createDropdownMenuScope] = (0, import_react_context.createContextScope)( + DROPDOWN_MENU_NAME, + [import_react_menu.createMenuScope] +); +var useMenuScope = (0, import_react_menu.createMenuScope)(); +var [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(DROPDOWN_MENU_NAME); +var DropdownMenu = /* @__PURE__ */ __name((props) => { + const { + __scopeDropdownMenu, + children, + dir, + open: openProp, + defaultOpen, + onOpenChange, + modal = true + } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + const triggerRef = React.useRef(null); + const [open, setOpen] = (0, import_react_use_controllable_state.useControllableState)({ + prop: openProp, + defaultProp: defaultOpen ?? false, + onChange: onOpenChange, + caller: DROPDOWN_MENU_NAME + }); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + DropdownMenuProvider, + { + scope: __scopeDropdownMenu, + triggerId: (0, import_react_id.useId)(), + triggerRef, + contentId: (0, import_react_id.useId)(), + open, + onOpenChange: setOpen, + onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]), + modal, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Root, { ...menuScope, open, onOpenChange: setOpen, dir, modal, children }) + } + ); +}, "DropdownMenu"); +var TRIGGER_NAME = "DropdownMenuTrigger"; +var DropdownMenuTrigger = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DropdownMenuTrigger2(props, forwardedRef) { + const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props; + const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu); + const menuScope = useMenuScope(__scopeDropdownMenu); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, context.triggerRef); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Anchor, { asChild: true, ...menuScope, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.button, + { + type: "button", + id: context.triggerId, + "aria-haspopup": "menu", + "aria-expanded": context.open, + "aria-controls": context.open ? context.contentId : void 0, + "data-state": context.open ? "open" : "closed", + "data-disabled": disabled ? "" : void 0, + disabled, + ...triggerProps, + ref: composedRefs, + onPointerDown: (0, import_primitive.composeEventHandlers)(props.onPointerDown, (event) => { + if (!disabled && event.button === 0 && event.ctrlKey === false) { + context.onOpenToggle(); + if (!context.open) event.preventDefault(); + } + }), + onKeyDown: (0, import_primitive.composeEventHandlers)(props.onKeyDown, (event) => { + if (disabled) return; + if (["Enter", " "].includes(event.key)) context.onOpenToggle(); + if (event.key === "ArrowDown") context.onOpenChange(true); + if (["Enter", " ", "ArrowDown"].includes(event.key)) event.preventDefault(); + }) + } + ) }); + }, "DropdownMenuTrigger") +); +var DropdownMenuPortal = /* @__PURE__ */ __name((props) => { + const { __scopeDropdownMenu, ...portalProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Portal, { ...menuScope, ...portalProps }); +}, "DropdownMenuPortal"); +var CONTENT_NAME = "DropdownMenuContent"; +var DropdownMenuContent = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DropdownMenuContent2(props, forwardedRef) { + const { __scopeDropdownMenu, ...contentProps } = props; + const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu); + const menuScope = useMenuScope(__scopeDropdownMenu); + const hasInteractedOutsideRef = React.useRef(false); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + MenuPrimitive.Content, + { + id: context.contentId, + "aria-labelledby": context.triggerId, + ...menuScope, + ...contentProps, + ref: forwardedRef, + onCloseAutoFocus: (0, import_primitive.composeEventHandlers)(props.onCloseAutoFocus, (event) => { + if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus(); + hasInteractedOutsideRef.current = false; + event.preventDefault(); + }), + onInteractOutside: (0, import_primitive.composeEventHandlers)(props.onInteractOutside, (event) => { + const originalEvent = event.detail.originalEvent; + const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true; + const isRightClick = originalEvent.button === 2 || ctrlLeftClick; + if (!context.modal || isRightClick) hasInteractedOutsideRef.current = true; + }), + style: { + ...props.style, + // re-namespace exposed content custom properties + ...{ + "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)", + "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)", + "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)", + "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)", + "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)" + } + } + } + ); + }, "DropdownMenuContent") +); +var DropdownMenuGroup = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DropdownMenuGroup2(props, forwardedRef) { + const { __scopeDropdownMenu, ...groupProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Group, { ...menuScope, ...groupProps, ref: forwardedRef }); + }, "DropdownMenuGroup") +); +var DropdownMenuLabel = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DropdownMenuLabel2(props, forwardedRef) { + const { __scopeDropdownMenu, ...labelProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Label, { ...menuScope, ...labelProps, ref: forwardedRef }); + }, "DropdownMenuLabel") +); +var DropdownMenuItem = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DropdownMenuItem2(props, forwardedRef) { + const { __scopeDropdownMenu, ...itemProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Item, { ...menuScope, ...itemProps, ref: forwardedRef }); + }, "DropdownMenuItem") +); +var DropdownMenuCheckboxItem = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function DropdownMenuCheckboxItem2(props, forwardedRef) { + const { __scopeDropdownMenu, ...checkboxItemProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.CheckboxItem, { ...menuScope, ...checkboxItemProps, ref: forwardedRef }); +}, "DropdownMenuCheckboxItem")); +var DropdownMenuRadioGroup = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function DropdownMenuRadioGroup2(props, forwardedRef) { + const { __scopeDropdownMenu, ...radioGroupProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.RadioGroup, { ...menuScope, ...radioGroupProps, ref: forwardedRef }); +}, "DropdownMenuRadioGroup")); +var DropdownMenuRadioItem = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function DropdownMenuRadioItem2(props, forwardedRef) { + const { __scopeDropdownMenu, ...radioItemProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.RadioItem, { ...menuScope, ...radioItemProps, ref: forwardedRef }); +}, "DropdownMenuRadioItem")); +var DropdownMenuItemIndicator = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function DropdownMenuItemIndicator2(props, forwardedRef) { + const { __scopeDropdownMenu, ...itemIndicatorProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.ItemIndicator, { ...menuScope, ...itemIndicatorProps, ref: forwardedRef }); +}, "DropdownMenuItemIndicator")); +var DropdownMenuSeparator = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function DropdownMenuSeparator2(props, forwardedRef) { + const { __scopeDropdownMenu, ...separatorProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Separator, { ...menuScope, ...separatorProps, ref: forwardedRef }); +}, "DropdownMenuSeparator")); +var DropdownMenuArrow = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DropdownMenuArrow2(props, forwardedRef) { + const { __scopeDropdownMenu, ...arrowProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Arrow, { ...menuScope, ...arrowProps, ref: forwardedRef }); + }, "DropdownMenuArrow") +); +var DropdownMenuSub = /* @__PURE__ */ __name((props) => { + const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + const [open, setOpen] = (0, import_react_use_controllable_state.useControllableState)({ + prop: openProp, + defaultProp: defaultOpen ?? false, + onChange: onOpenChange, + caller: "DropdownMenuSub" + }); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Sub, { ...menuScope, open, onOpenChange: setOpen, children }); +}, "DropdownMenuSub"); +var DropdownMenuSubTrigger = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function DropdownMenuSubTrigger2(props, forwardedRef) { + const { __scopeDropdownMenu, ...subTriggerProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.SubTrigger, { ...menuScope, ...subTriggerProps, ref: forwardedRef }); +}, "DropdownMenuSubTrigger")); +var DropdownMenuSubContent = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function DropdownMenuSubContent2(props, forwardedRef) { + const { __scopeDropdownMenu, ...subContentProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + MenuPrimitive.SubContent, + { + ...menuScope, + ...subContentProps, + ref: forwardedRef, + style: { + ...props.style, + // re-namespace exposed content custom properties + ...{ + "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)", + "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)", + "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)", + "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)", + "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)" + } + } + } + ); +}, "DropdownMenuSubContent")); +//# sourceMappingURL=index.js.map diff --git a/e-commerce/node_modules/@radix-ui/react-dropdown-menu/dist/index.js.map b/e-commerce/node_modules/@radix-ui/react-dropdown-menu/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..adf7047e2f6ed814ca05a3168673f128127ba07a --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dropdown-menu/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts", "../src/dropdown-menu.tsx"], + "sourcesContent": ["'use client';\nexport {\n createDropdownMenuScope,\n //\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuPortal,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuItemIndicator,\n DropdownMenuSeparator,\n DropdownMenuArrow,\n DropdownMenuSub,\n DropdownMenuSubTrigger,\n DropdownMenuSubContent,\n //\n Root,\n Trigger,\n Portal,\n Content,\n Group,\n Label,\n Item,\n CheckboxItem,\n RadioGroup,\n RadioItem,\n ItemIndicator,\n Separator,\n Arrow,\n Sub,\n SubTrigger,\n SubContent,\n} from './dropdown-menu';\nexport type {\n DropdownMenuProps,\n DropdownMenuTriggerProps,\n DropdownMenuPortalProps,\n DropdownMenuContentProps,\n DropdownMenuGroupProps,\n DropdownMenuLabelProps,\n DropdownMenuItemProps,\n DropdownMenuCheckboxItemProps,\n DropdownMenuRadioGroupProps,\n DropdownMenuRadioItemProps,\n DropdownMenuItemIndicatorProps,\n DropdownMenuSeparatorProps,\n DropdownMenuArrowProps,\n DropdownMenuSubProps,\n DropdownMenuSubTriggerProps,\n DropdownMenuSubContentProps,\n} from './dropdown-menu';\n", "import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as MenuPrimitive from '@radix-ui/react-menu';\nimport { createMenuScope } from '@radix-ui/react-menu';\nimport { useId } from '@radix-ui/react-id';\n\nimport type { Scope } from '@radix-ui/react-context';\n\nconst Direction = {\n LTR: 'ltr',\n RTL: 'rtl',\n} as const;\n\ntype Direction = (typeof Direction)[keyof typeof Direction];\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenu\n * -----------------------------------------------------------------------------------------------*/\n\nconst DROPDOWN_MENU_NAME = 'DropdownMenu';\n\ntype ScopedProps

= P & { __scopeDropdownMenu?: Scope | undefined };\nconst [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(\n DROPDOWN_MENU_NAME,\n [createMenuScope],\n);\nconst useMenuScope = createMenuScope();\n\ntype DropdownMenuContextValue = {\n triggerId: string;\n triggerRef: React.RefObject;\n contentId: string;\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpenToggle(): void;\n modal: boolean;\n};\n\nconst [DropdownMenuProvider, useDropdownMenuContext] =\n createDropdownMenuContext(DROPDOWN_MENU_NAME);\n\ninterface DropdownMenuProps {\n children?: React.ReactNode | undefined;\n dir?: Direction | undefined;\n open?: boolean | undefined;\n defaultOpen?: boolean | undefined;\n onOpenChange?: ((open: boolean) => void) | undefined;\n modal?: boolean | undefined;\n}\n\nconst DropdownMenu: React.FC = (props: ScopedProps) => {\n const {\n __scopeDropdownMenu,\n children,\n dir,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = true,\n } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const triggerRef = React.useRef(null);\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n caller: DROPDOWN_MENU_NAME,\n });\n\n return (\n setOpen((prevOpen) => !prevOpen), [setOpen])}\n modal={modal}\n >\n \n {children}\n \n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'DropdownMenuTrigger';\n\ntype DropdownMenuTriggerElement = React.ComponentRef;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuTriggerProps extends PrimitiveButtonProps {}\n\nconst DropdownMenuTrigger = /* @__PURE__ */ React.forwardRef<\n DropdownMenuTriggerElement,\n DropdownMenuTriggerProps\n>(\n // blank line to reduce diff noise\n function DropdownMenuTrigger(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;\n const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const composedRefs = useComposedRefs(forwardedRef, context.triggerRef);\n return (\n \n {\n // only call handler if it's the left button (mousedown gets triggered by all mouse buttons)\n // but not when the control key is pressed (avoiding MacOS right click)\n if (!disabled && event.button === 0 && event.ctrlKey === false) {\n context.onOpenToggle();\n // prevent trigger focusing when opening\n // this allows the content to be given focus without competition\n if (!context.open) event.preventDefault();\n }\n })}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (disabled) return;\n if (['Enter', ' '].includes(event.key)) context.onOpenToggle();\n if (event.key === 'ArrowDown') context.onOpenChange(true);\n // prevent keydown from scrolling window / first focused item to execute\n // that keydown (inadvertently closing the menu)\n if (['Enter', ' ', 'ArrowDown'].includes(event.key)) event.preventDefault();\n })}\n />\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuPortal\n * -----------------------------------------------------------------------------------------------*/\n\ntype MenuPortalProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuPortalProps extends MenuPortalProps {}\n\nconst DropdownMenuPortal: React.FC = (\n props: ScopedProps,\n) => {\n const { __scopeDropdownMenu, ...portalProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'DropdownMenuContent';\n\ntype DropdownMenuContentElement = React.ComponentRef;\ntype MenuContentProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuContentProps extends Omit {}\n\nconst DropdownMenuContent = /* @__PURE__ */ React.forwardRef<\n DropdownMenuContentElement,\n DropdownMenuContentProps\n>(\n // blank line to reduce diff noise\n function DropdownMenuContent(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, ...contentProps } = props;\n const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const hasInteractedOutsideRef = React.useRef(false);\n\n return (\n {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n hasInteractedOutsideRef.current = false;\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault();\n })}\n onInteractOutside={composeEventHandlers(props.onInteractOutside, (event) => {\n const originalEvent = event.detail.originalEvent as PointerEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n if (!context.modal || isRightClick) hasInteractedOutsideRef.current = true;\n })}\n style={{\n ...props.style,\n // re-namespace exposed content custom properties\n ...{\n '--radix-dropdown-menu-content-transform-origin':\n 'var(--radix-popper-transform-origin)',\n '--radix-dropdown-menu-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-dropdown-menu-content-available-height':\n 'var(--radix-popper-available-height)',\n '--radix-dropdown-menu-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-dropdown-menu-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuGroup\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuGroupElement = React.ComponentRef;\ntype MenuGroupProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuGroupProps extends MenuGroupProps {}\n\nconst DropdownMenuGroup = /* @__PURE__ */ React.forwardRef<\n DropdownMenuGroupElement,\n DropdownMenuGroupProps\n>(\n // blank line to reduce diff noise\n function DropdownMenuGroup(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, ...groupProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuLabel\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuLabelElement = React.ComponentRef;\ntype MenuLabelProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuLabelProps extends MenuLabelProps {}\n\nconst DropdownMenuLabel = /* @__PURE__ */ React.forwardRef<\n DropdownMenuLabelElement,\n DropdownMenuLabelProps\n>(\n // blank line to reduce diff noise\n function DropdownMenuLabel(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, ...labelProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuItem\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuItemElement = React.ComponentRef;\ntype MenuItemProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuItemProps extends MenuItemProps {}\n\nconst DropdownMenuItem = /* @__PURE__ */ React.forwardRef<\n DropdownMenuItemElement,\n DropdownMenuItemProps\n>(\n // blank line to reduce diff noise\n function DropdownMenuItem(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, ...itemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuCheckboxItem\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuCheckboxItemElement = React.ComponentRef;\ntype MenuCheckboxItemProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuCheckboxItemProps extends MenuCheckboxItemProps {}\n\nconst DropdownMenuCheckboxItem = /* @__PURE__ */ React.forwardRef<\n DropdownMenuCheckboxItemElement,\n DropdownMenuCheckboxItemProps\n>(function DropdownMenuCheckboxItem(\n props: ScopedProps,\n forwardedRef,\n) {\n const { __scopeDropdownMenu, ...checkboxItemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuRadioGroup\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuRadioGroupElement = React.ComponentRef;\ntype MenuRadioGroupProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuRadioGroupProps extends MenuRadioGroupProps {}\n\nconst DropdownMenuRadioGroup = /* @__PURE__ */ React.forwardRef<\n DropdownMenuRadioGroupElement,\n DropdownMenuRadioGroupProps\n>(function DropdownMenuRadioGroup(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, ...radioGroupProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuRadioItem\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuRadioItemElement = React.ComponentRef;\ntype MenuRadioItemProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuRadioItemProps extends MenuRadioItemProps {}\n\nconst DropdownMenuRadioItem = /* @__PURE__ */ React.forwardRef<\n DropdownMenuRadioItemElement,\n DropdownMenuRadioItemProps\n>(function DropdownMenuRadioItem(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, ...radioItemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuItemIndicatorElement = React.ComponentRef;\ntype MenuItemIndicatorProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuItemIndicatorProps extends MenuItemIndicatorProps {}\n\nconst DropdownMenuItemIndicator = /* @__PURE__ */ React.forwardRef<\n DropdownMenuItemIndicatorElement,\n DropdownMenuItemIndicatorProps\n>(function DropdownMenuItemIndicator(\n props: ScopedProps,\n forwardedRef,\n) {\n const { __scopeDropdownMenu, ...itemIndicatorProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSeparator\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuSeparatorElement = React.ComponentRef;\ntype MenuSeparatorProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuSeparatorProps extends MenuSeparatorProps {}\n\nconst DropdownMenuSeparator = /* @__PURE__ */ React.forwardRef<\n DropdownMenuSeparatorElement,\n DropdownMenuSeparatorProps\n>(function DropdownMenuSeparator(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, ...separatorProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuArrow\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuArrowElement = React.ComponentRef;\ntype MenuArrowProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuArrowProps extends MenuArrowProps {}\n\nconst DropdownMenuArrow = /* @__PURE__ */ React.forwardRef<\n DropdownMenuArrowElement,\n DropdownMenuArrowProps\n>(\n // blank line to reduce diff noise\n function DropdownMenuArrow(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, ...arrowProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSub\n * -----------------------------------------------------------------------------------------------*/\n\ninterface DropdownMenuSubProps {\n children?: React.ReactNode | undefined;\n open?: boolean | undefined;\n defaultOpen?: boolean | undefined;\n onOpenChange?: ((open: boolean) => void) | undefined;\n}\n\nconst DropdownMenuSub: React.FC = (\n props: ScopedProps,\n) => {\n const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n caller: 'DropdownMenuSub',\n });\n\n return (\n \n {children}\n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSubTrigger\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuSubTriggerElement = React.ComponentRef;\ntype MenuSubTriggerProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuSubTriggerProps extends MenuSubTriggerProps {}\n\nconst DropdownMenuSubTrigger = /* @__PURE__ */ React.forwardRef<\n DropdownMenuSubTriggerElement,\n DropdownMenuSubTriggerProps\n>(function DropdownMenuSubTrigger(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, ...subTriggerProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSubContent\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuSubContentElement = React.ComponentRef;\ntype MenuSubContentProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuSubContentProps extends MenuSubContentProps {}\n\nconst DropdownMenuSubContent = /* @__PURE__ */ React.forwardRef<\n DropdownMenuSubContentElement,\n DropdownMenuSubContentProps\n>(function DropdownMenuSubContent(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, ...subContentProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n\n return (\n \n );\n});\n\n/* -----------------------------------------------------------------------------------------------*/\n\nexport {\n createDropdownMenuScope,\n //\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuPortal,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuItemIndicator,\n DropdownMenuSeparator,\n DropdownMenuArrow,\n DropdownMenuSub,\n DropdownMenuSubTrigger,\n DropdownMenuSubContent,\n //\n DropdownMenu as Root,\n DropdownMenuTrigger as Trigger,\n DropdownMenuPortal as Portal,\n DropdownMenuContent as Content,\n DropdownMenuGroup as Group,\n DropdownMenuLabel as Label,\n DropdownMenuItem as Item,\n DropdownMenuCheckboxItem as CheckboxItem,\n DropdownMenuRadioGroup as RadioGroup,\n DropdownMenuRadioItem as RadioItem,\n DropdownMenuItemIndicator as ItemIndicator,\n DropdownMenuSeparator as Separator,\n DropdownMenuArrow as Arrow,\n DropdownMenuSub as Sub,\n DropdownMenuSubTrigger as SubTrigger,\n DropdownMenuSubContent as SubContent,\n};\nexport type {\n DropdownMenuProps,\n DropdownMenuTriggerProps,\n DropdownMenuPortalProps,\n DropdownMenuContentProps,\n DropdownMenuGroupProps,\n DropdownMenuLabelProps,\n DropdownMenuItemProps,\n DropdownMenuCheckboxItemProps,\n DropdownMenuRadioGroupProps,\n DropdownMenuRadioItemProps,\n DropdownMenuItemIndicatorProps,\n DropdownMenuSeparatorProps,\n DropdownMenuArrowProps,\n DropdownMenuSubProps,\n DropdownMenuSubTriggerProps,\n DropdownMenuSubContentProps,\n};\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,uBAAqC;AACrC,gCAAgC;AAChC,2BAAmC;AACnC,0CAAqC;AACrC,6BAA0B;AAC1B,oBAA+B;AAC/B,wBAAgC;AAChC,sBAAsB;AA4EhB;AA7DN,IAAM,qBAAqB;AAG3B,IAAM,CAAC,2BAA2B,uBAAuB,QAAI;AAAA,EAC3D;AAAA,EACA,CAAC,iCAAe;AAClB;AACA,IAAM,mBAAe,mCAAgB;AAYrC,IAAM,CAAC,sBAAsB,sBAAsB,IACjD,0BAAoD,kBAAkB;AAWxE,IAAM,eAA4C,wBAAC,UAA0C;AAC3F,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,E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ropdownMenuContent", "DropdownMenuGroup", "DropdownMenuLabel", "DropdownMenuItem", "DropdownMenuCheckboxItem", "DropdownMenuRadioGroup", "DropdownMenuRadioItem", "DropdownMenuItemIndicator", "DropdownMenuSeparator", "DropdownMenuArrow", "DropdownMenuSubTrigger", "DropdownMenuSubContent"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs b/e-commerce/node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..0395cf017e9b35798e41a0ca13fbe23c5d898a81 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs @@ -0,0 +1,271 @@ +"use client"; +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// src/dropdown-menu.tsx +import * as React from "react"; +import { composeEventHandlers } from "@radix-ui/primitive"; +import { useComposedRefs } from "@radix-ui/react-compose-refs"; +import { createContextScope } from "@radix-ui/react-context"; +import { useControllableState } from "@radix-ui/react-use-controllable-state"; +import { Primitive } from "@radix-ui/react-primitive"; +import * as MenuPrimitive from "@radix-ui/react-menu"; +import { createMenuScope } from "@radix-ui/react-menu"; +import { useId } from "@radix-ui/react-id"; +import { jsx } from "react/jsx-runtime"; +var DROPDOWN_MENU_NAME = "DropdownMenu"; +var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope( + DROPDOWN_MENU_NAME, + [createMenuScope] +); +var useMenuScope = createMenuScope(); +var [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(DROPDOWN_MENU_NAME); +var DropdownMenu = /* @__PURE__ */ __name((props) => { + const { + __scopeDropdownMenu, + children, + dir, + open: openProp, + defaultOpen, + onOpenChange, + modal = true + } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + const triggerRef = React.useRef(null); + const [open, setOpen] = useControllableState({ + prop: openProp, + defaultProp: defaultOpen ?? false, + onChange: onOpenChange, + caller: DROPDOWN_MENU_NAME + }); + return /* @__PURE__ */ jsx( + DropdownMenuProvider, + { + scope: __scopeDropdownMenu, + triggerId: useId(), + triggerRef, + contentId: useId(), + open, + onOpenChange: setOpen, + onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]), + modal, + children: /* @__PURE__ */ jsx(MenuPrimitive.Root, { ...menuScope, open, onOpenChange: setOpen, dir, modal, children }) + } + ); +}, "DropdownMenu"); +var TRIGGER_NAME = "DropdownMenuTrigger"; +var DropdownMenuTrigger = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DropdownMenuTrigger2(props, forwardedRef) { + const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props; + const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu); + const menuScope = useMenuScope(__scopeDropdownMenu); + const composedRefs = useComposedRefs(forwardedRef, context.triggerRef); + return /* @__PURE__ */ jsx(MenuPrimitive.Anchor, { asChild: true, ...menuScope, children: /* @__PURE__ */ jsx( + Primitive.button, + { + type: "button", + id: context.triggerId, + "aria-haspopup": "menu", + "aria-expanded": context.open, + "aria-controls": context.open ? context.contentId : void 0, + "data-state": context.open ? "open" : "closed", + "data-disabled": disabled ? "" : void 0, + disabled, + ...triggerProps, + ref: composedRefs, + onPointerDown: composeEventHandlers(props.onPointerDown, (event) => { + if (!disabled && event.button === 0 && event.ctrlKey === false) { + context.onOpenToggle(); + if (!context.open) event.preventDefault(); + } + }), + onKeyDown: composeEventHandlers(props.onKeyDown, (event) => { + if (disabled) return; + if (["Enter", " "].includes(event.key)) context.onOpenToggle(); + if (event.key === "ArrowDown") context.onOpenChange(true); + if (["Enter", " ", "ArrowDown"].includes(event.key)) event.preventDefault(); + }) + } + ) }); + }, "DropdownMenuTrigger") +); +var DropdownMenuPortal = /* @__PURE__ */ __name((props) => { + const { __scopeDropdownMenu, ...portalProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ jsx(MenuPrimitive.Portal, { ...menuScope, ...portalProps }); +}, "DropdownMenuPortal"); +var CONTENT_NAME = "DropdownMenuContent"; +var DropdownMenuContent = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DropdownMenuContent2(props, forwardedRef) { + const { __scopeDropdownMenu, ...contentProps } = props; + const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu); + const menuScope = useMenuScope(__scopeDropdownMenu); + const hasInteractedOutsideRef = React.useRef(false); + return /* @__PURE__ */ jsx( + MenuPrimitive.Content, + { + id: context.contentId, + "aria-labelledby": context.triggerId, + ...menuScope, + ...contentProps, + ref: forwardedRef, + onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => { + if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus(); + hasInteractedOutsideRef.current = false; + event.preventDefault(); + }), + onInteractOutside: composeEventHandlers(props.onInteractOutside, (event) => { + const originalEvent = event.detail.originalEvent; + const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true; + const isRightClick = originalEvent.button === 2 || ctrlLeftClick; + if (!context.modal || isRightClick) hasInteractedOutsideRef.current = true; + }), + style: { + ...props.style, + // re-namespace exposed content custom properties + ...{ + "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)", + "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)", + "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)", + "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)", + "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)" + } + } + } + ); + }, "DropdownMenuContent") +); +var DropdownMenuGroup = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DropdownMenuGroup2(props, forwardedRef) { + const { __scopeDropdownMenu, ...groupProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ jsx(MenuPrimitive.Group, { ...menuScope, ...groupProps, ref: forwardedRef }); + }, "DropdownMenuGroup") +); +var DropdownMenuLabel = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DropdownMenuLabel2(props, forwardedRef) { + const { __scopeDropdownMenu, ...labelProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ jsx(MenuPrimitive.Label, { ...menuScope, ...labelProps, ref: forwardedRef }); + }, "DropdownMenuLabel") +); +var DropdownMenuItem = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DropdownMenuItem2(props, forwardedRef) { + const { __scopeDropdownMenu, ...itemProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ jsx(MenuPrimitive.Item, { ...menuScope, ...itemProps, ref: forwardedRef }); + }, "DropdownMenuItem") +); +var DropdownMenuCheckboxItem = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function DropdownMenuCheckboxItem2(props, forwardedRef) { + const { __scopeDropdownMenu, ...checkboxItemProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ jsx(MenuPrimitive.CheckboxItem, { ...menuScope, ...checkboxItemProps, ref: forwardedRef }); +}, "DropdownMenuCheckboxItem")); +var DropdownMenuRadioGroup = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function DropdownMenuRadioGroup2(props, forwardedRef) { + const { __scopeDropdownMenu, ...radioGroupProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ jsx(MenuPrimitive.RadioGroup, { ...menuScope, ...radioGroupProps, ref: forwardedRef }); +}, "DropdownMenuRadioGroup")); +var DropdownMenuRadioItem = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function DropdownMenuRadioItem2(props, forwardedRef) { + const { __scopeDropdownMenu, ...radioItemProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ jsx(MenuPrimitive.RadioItem, { ...menuScope, ...radioItemProps, ref: forwardedRef }); +}, "DropdownMenuRadioItem")); +var DropdownMenuItemIndicator = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function DropdownMenuItemIndicator2(props, forwardedRef) { + const { __scopeDropdownMenu, ...itemIndicatorProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ jsx(MenuPrimitive.ItemIndicator, { ...menuScope, ...itemIndicatorProps, ref: forwardedRef }); +}, "DropdownMenuItemIndicator")); +var DropdownMenuSeparator = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function DropdownMenuSeparator2(props, forwardedRef) { + const { __scopeDropdownMenu, ...separatorProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ jsx(MenuPrimitive.Separator, { ...menuScope, ...separatorProps, ref: forwardedRef }); +}, "DropdownMenuSeparator")); +var DropdownMenuArrow = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function DropdownMenuArrow2(props, forwardedRef) { + const { __scopeDropdownMenu, ...arrowProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ jsx(MenuPrimitive.Arrow, { ...menuScope, ...arrowProps, ref: forwardedRef }); + }, "DropdownMenuArrow") +); +var DropdownMenuSub = /* @__PURE__ */ __name((props) => { + const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + const [open, setOpen] = useControllableState({ + prop: openProp, + defaultProp: defaultOpen ?? false, + onChange: onOpenChange, + caller: "DropdownMenuSub" + }); + return /* @__PURE__ */ jsx(MenuPrimitive.Sub, { ...menuScope, open, onOpenChange: setOpen, children }); +}, "DropdownMenuSub"); +var DropdownMenuSubTrigger = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function DropdownMenuSubTrigger2(props, forwardedRef) { + const { __scopeDropdownMenu, ...subTriggerProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ jsx(MenuPrimitive.SubTrigger, { ...menuScope, ...subTriggerProps, ref: forwardedRef }); +}, "DropdownMenuSubTrigger")); +var DropdownMenuSubContent = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function DropdownMenuSubContent2(props, forwardedRef) { + const { __scopeDropdownMenu, ...subContentProps } = props; + const menuScope = useMenuScope(__scopeDropdownMenu); + return /* @__PURE__ */ jsx( + MenuPrimitive.SubContent, + { + ...menuScope, + ...subContentProps, + ref: forwardedRef, + style: { + ...props.style, + // re-namespace exposed content custom properties + ...{ + "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)", + "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)", + "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)", + "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)", + "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)" + } + } + } + ); +}, "DropdownMenuSubContent")); +export { + DropdownMenuArrow as Arrow, + DropdownMenuCheckboxItem as CheckboxItem, + DropdownMenuContent as Content, + DropdownMenu, + DropdownMenuArrow, + DropdownMenuCheckboxItem, + DropdownMenuContent, + DropdownMenuGroup, + DropdownMenuItem, + DropdownMenuItemIndicator, + DropdownMenuLabel, + DropdownMenuPortal, + DropdownMenuRadioGroup, + DropdownMenuRadioItem, + DropdownMenuSeparator, + DropdownMenuSub, + DropdownMenuSubContent, + DropdownMenuSubTrigger, + DropdownMenuTrigger, + DropdownMenuGroup as Group, + DropdownMenuItem as Item, + DropdownMenuItemIndicator as ItemIndicator, + DropdownMenuLabel as Label, + DropdownMenuPortal as Portal, + DropdownMenuRadioGroup as RadioGroup, + DropdownMenuRadioItem as RadioItem, + DropdownMenu as Root, + DropdownMenuSeparator as Separator, + DropdownMenuSub as Sub, + DropdownMenuSubContent as SubContent, + DropdownMenuSubTrigger as SubTrigger, + DropdownMenuTrigger as Trigger, + createDropdownMenuScope +}; +//# sourceMappingURL=index.mjs.map diff --git a/e-commerce/node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs.map b/e-commerce/node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..ffc042b402393b4d9965717873e1ce8e40f7e681 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/dropdown-menu.tsx"], + "sourcesContent": ["import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as MenuPrimitive from '@radix-ui/react-menu';\nimport { createMenuScope } from '@radix-ui/react-menu';\nimport { useId } from '@radix-ui/react-id';\n\nimport type { Scope } from '@radix-ui/react-context';\n\nconst Direction = {\n LTR: 'ltr',\n RTL: 'rtl',\n} as const;\n\ntype Direction = (typeof Direction)[keyof typeof Direction];\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenu\n * -----------------------------------------------------------------------------------------------*/\n\nconst DROPDOWN_MENU_NAME = 'DropdownMenu';\n\ntype ScopedProps

= P & { __scopeDropdownMenu?: Scope | undefined };\nconst [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(\n DROPDOWN_MENU_NAME,\n [createMenuScope],\n);\nconst useMenuScope = createMenuScope();\n\ntype DropdownMenuContextValue = {\n triggerId: string;\n triggerRef: React.RefObject;\n contentId: string;\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpenToggle(): void;\n modal: boolean;\n};\n\nconst [DropdownMenuProvider, useDropdownMenuContext] =\n createDropdownMenuContext(DROPDOWN_MENU_NAME);\n\ninterface DropdownMenuProps {\n children?: React.ReactNode | undefined;\n dir?: Direction | undefined;\n open?: boolean | undefined;\n defaultOpen?: boolean | undefined;\n onOpenChange?: ((open: boolean) => void) | undefined;\n modal?: boolean | undefined;\n}\n\nconst DropdownMenu: React.FC = (props: ScopedProps) => {\n const {\n __scopeDropdownMenu,\n children,\n dir,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = true,\n } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const triggerRef = React.useRef(null);\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n caller: DROPDOWN_MENU_NAME,\n });\n\n return (\n setOpen((prevOpen) => !prevOpen), [setOpen])}\n modal={modal}\n >\n \n {children}\n \n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'DropdownMenuTrigger';\n\ntype DropdownMenuTriggerElement = React.ComponentRef;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuTriggerProps extends PrimitiveButtonProps {}\n\nconst DropdownMenuTrigger = /* @__PURE__ */ React.forwardRef<\n DropdownMenuTriggerElement,\n DropdownMenuTriggerProps\n>(\n // blank line to reduce diff noise\n function DropdownMenuTrigger(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;\n const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const composedRefs = useComposedRefs(forwardedRef, context.triggerRef);\n return (\n \n {\n // only call handler if it's the left button (mousedown gets triggered by all mouse buttons)\n // but not when the control key is pressed (avoiding MacOS right click)\n if (!disabled && event.button === 0 && event.ctrlKey === false) {\n context.onOpenToggle();\n // prevent trigger focusing when opening\n // this allows the content to be given focus without competition\n if (!context.open) event.preventDefault();\n }\n })}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (disabled) return;\n if (['Enter', ' '].includes(event.key)) context.onOpenToggle();\n if (event.key === 'ArrowDown') context.onOpenChange(true);\n // prevent keydown from scrolling window / first focused item to execute\n // that keydown (inadvertently closing the menu)\n if (['Enter', ' ', 'ArrowDown'].includes(event.key)) event.preventDefault();\n })}\n />\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuPortal\n * -----------------------------------------------------------------------------------------------*/\n\ntype MenuPortalProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuPortalProps extends MenuPortalProps {}\n\nconst DropdownMenuPortal: React.FC = (\n props: ScopedProps,\n) => {\n const { __scopeDropdownMenu, ...portalProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'DropdownMenuContent';\n\ntype DropdownMenuContentElement = React.ComponentRef;\ntype MenuContentProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuContentProps extends Omit {}\n\nconst DropdownMenuContent = /* @__PURE__ */ React.forwardRef<\n DropdownMenuContentElement,\n DropdownMenuContentProps\n>(\n // blank line to reduce diff noise\n function DropdownMenuContent(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, ...contentProps } = props;\n const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const hasInteractedOutsideRef = React.useRef(false);\n\n return (\n {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n hasInteractedOutsideRef.current = false;\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault();\n })}\n onInteractOutside={composeEventHandlers(props.onInteractOutside, (event) => {\n const originalEvent = event.detail.originalEvent as PointerEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n if (!context.modal || isRightClick) hasInteractedOutsideRef.current = true;\n })}\n style={{\n ...props.style,\n // re-namespace exposed content custom properties\n ...{\n '--radix-dropdown-menu-content-transform-origin':\n 'var(--radix-popper-transform-origin)',\n '--radix-dropdown-menu-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-dropdown-menu-content-available-height':\n 'var(--radix-popper-available-height)',\n '--radix-dropdown-menu-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-dropdown-menu-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuGroup\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuGroupElement = React.ComponentRef;\ntype MenuGroupProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuGroupProps extends MenuGroupProps {}\n\nconst DropdownMenuGroup = /* @__PURE__ */ React.forwardRef<\n DropdownMenuGroupElement,\n DropdownMenuGroupProps\n>(\n // blank line to reduce diff noise\n function DropdownMenuGroup(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, ...groupProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuLabel\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuLabelElement = React.ComponentRef;\ntype MenuLabelProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuLabelProps extends MenuLabelProps {}\n\nconst DropdownMenuLabel = /* @__PURE__ */ React.forwardRef<\n DropdownMenuLabelElement,\n DropdownMenuLabelProps\n>(\n // blank line to reduce diff noise\n function DropdownMenuLabel(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, ...labelProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuItem\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuItemElement = React.ComponentRef;\ntype MenuItemProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuItemProps extends MenuItemProps {}\n\nconst DropdownMenuItem = /* @__PURE__ */ React.forwardRef<\n DropdownMenuItemElement,\n DropdownMenuItemProps\n>(\n // blank line to reduce diff noise\n function DropdownMenuItem(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, ...itemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuCheckboxItem\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuCheckboxItemElement = React.ComponentRef;\ntype MenuCheckboxItemProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuCheckboxItemProps extends MenuCheckboxItemProps {}\n\nconst DropdownMenuCheckboxItem = /* @__PURE__ */ React.forwardRef<\n DropdownMenuCheckboxItemElement,\n DropdownMenuCheckboxItemProps\n>(function DropdownMenuCheckboxItem(\n props: ScopedProps,\n forwardedRef,\n) {\n const { __scopeDropdownMenu, ...checkboxItemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuRadioGroup\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuRadioGroupElement = React.ComponentRef;\ntype MenuRadioGroupProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuRadioGroupProps extends MenuRadioGroupProps {}\n\nconst DropdownMenuRadioGroup = /* @__PURE__ */ React.forwardRef<\n DropdownMenuRadioGroupElement,\n DropdownMenuRadioGroupProps\n>(function DropdownMenuRadioGroup(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, ...radioGroupProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuRadioItem\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuRadioItemElement = React.ComponentRef;\ntype MenuRadioItemProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuRadioItemProps extends MenuRadioItemProps {}\n\nconst DropdownMenuRadioItem = /* @__PURE__ */ React.forwardRef<\n DropdownMenuRadioItemElement,\n DropdownMenuRadioItemProps\n>(function DropdownMenuRadioItem(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, ...radioItemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuItemIndicatorElement = React.ComponentRef;\ntype MenuItemIndicatorProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuItemIndicatorProps extends MenuItemIndicatorProps {}\n\nconst DropdownMenuItemIndicator = /* @__PURE__ */ React.forwardRef<\n DropdownMenuItemIndicatorElement,\n DropdownMenuItemIndicatorProps\n>(function DropdownMenuItemIndicator(\n props: ScopedProps,\n forwardedRef,\n) {\n const { __scopeDropdownMenu, ...itemIndicatorProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSeparator\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuSeparatorElement = React.ComponentRef;\ntype MenuSeparatorProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuSeparatorProps extends MenuSeparatorProps {}\n\nconst DropdownMenuSeparator = /* @__PURE__ */ React.forwardRef<\n DropdownMenuSeparatorElement,\n DropdownMenuSeparatorProps\n>(function DropdownMenuSeparator(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, ...separatorProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuArrow\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuArrowElement = React.ComponentRef;\ntype MenuArrowProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuArrowProps extends MenuArrowProps {}\n\nconst DropdownMenuArrow = /* @__PURE__ */ React.forwardRef<\n DropdownMenuArrowElement,\n DropdownMenuArrowProps\n>(\n // blank line to reduce diff noise\n function DropdownMenuArrow(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, ...arrowProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSub\n * -----------------------------------------------------------------------------------------------*/\n\ninterface DropdownMenuSubProps {\n children?: React.ReactNode | undefined;\n open?: boolean | undefined;\n defaultOpen?: boolean | undefined;\n onOpenChange?: ((open: boolean) => void) | undefined;\n}\n\nconst DropdownMenuSub: React.FC = (\n props: ScopedProps,\n) => {\n const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n caller: 'DropdownMenuSub',\n });\n\n return (\n \n {children}\n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSubTrigger\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuSubTriggerElement = React.ComponentRef;\ntype MenuSubTriggerProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuSubTriggerProps extends MenuSubTriggerProps {}\n\nconst DropdownMenuSubTrigger = /* @__PURE__ */ React.forwardRef<\n DropdownMenuSubTriggerElement,\n DropdownMenuSubTriggerProps\n>(function DropdownMenuSubTrigger(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, ...subTriggerProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return ;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSubContent\n * -----------------------------------------------------------------------------------------------*/\n\ntype DropdownMenuSubContentElement = React.ComponentRef;\ntype MenuSubContentProps = React.ComponentPropsWithoutRef;\ninterface DropdownMenuSubContentProps extends MenuSubContentProps {}\n\nconst DropdownMenuSubContent = /* @__PURE__ */ React.forwardRef<\n DropdownMenuSubContentElement,\n DropdownMenuSubContentProps\n>(function DropdownMenuSubContent(props: ScopedProps, forwardedRef) {\n const { __scopeDropdownMenu, ...subContentProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n\n return (\n \n );\n});\n\n/* -----------------------------------------------------------------------------------------------*/\n\nexport {\n createDropdownMenuScope,\n //\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuPortal,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuItemIndicator,\n DropdownMenuSeparator,\n DropdownMenuArrow,\n DropdownMenuSub,\n DropdownMenuSubTrigger,\n DropdownMenuSubContent,\n //\n DropdownMenu as Root,\n DropdownMenuTrigger as Trigger,\n DropdownMenuPortal as Portal,\n DropdownMenuContent as Content,\n DropdownMenuGroup as Group,\n DropdownMenuLabel as Label,\n DropdownMenuItem as Item,\n DropdownMenuCheckboxItem as CheckboxItem,\n DropdownMenuRadioGroup as RadioGroup,\n DropdownMenuRadioItem as RadioItem,\n DropdownMenuItemIndicator as ItemIndicator,\n DropdownMenuSeparator as Separator,\n DropdownMenuArrow as Arrow,\n DropdownMenuSub as Sub,\n DropdownMenuSubTrigger as SubTrigger,\n DropdownMenuSubContent as SubContent,\n};\nexport type {\n DropdownMenuProps,\n DropdownMenuTriggerProps,\n DropdownMenuPortalProps,\n DropdownMenuContentProps,\n DropdownMenuGroupProps,\n DropdownMenuLabelProps,\n DropdownMenuItemProps,\n DropdownMenuCheckboxItemProps,\n DropdownMenuRadioGroupProps,\n DropdownMenuRadioItemProps,\n DropdownMenuItemIndicatorProps,\n DropdownMenuSeparatorProps,\n DropdownMenuArrowProps,\n DropdownMenuSubProps,\n DropdownMenuSubTriggerProps,\n DropdownMenuSubContentProps,\n};\n"], + "mappings": ";;;;;AAAA,YAAY,WAAW;AACvB,SAAS,4BAA4B;AACrC,SAAS,uBAAuB;AAChC,SAAS,0BAA0B;AACnC,SAAS,4BAA4B;AACrC,SAAS,iBAAiB;AAC1B,YAAY,mBAAmB;AAC/B,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ACpD,QAAM,YAAY,aAAa,mBAAmB;AAElD,SACE;AAAA,IAAe;AAAA,IAAd;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACJ,KAAK;AAAA,MACL,OAAO;AAAA,QACL,GAAG,MAAM;AAAA;AAAA,QAET,GAAG;AAAA,UACD,kDAAkD;AAAA,UAClD,iDAAiD;AAAA,UACjD,kDAAkD;AAAA,UAClD,uCAAuC;AAAA,UACvC,wCAAwC;AAAA,QAC1C;AAAA,MACF;AAAA;AAAA,EACF;AAEJ,GAtBE,yBAsBD;", + "names": ["DropdownMenuTrigger", "DropdownMenuContent", "DropdownMenuGroup", "DropdownMenuLabel", "DropdownMenuItem", "DropdownMenuCheckboxItem", "DropdownMenuRadioGroup", "DropdownMenuRadioItem", "DropdownMenuItemIndicator", "DropdownMenuSeparator", "DropdownMenuArrow", "DropdownMenuSubTrigger", "DropdownMenuSubContent"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-dropdown-menu/package.json b/e-commerce/node_modules/@radix-ui/react-dropdown-menu/package.json new file mode 100644 index 0000000000000000000000000000000000000000..878c671a0b914d67c2c5e5b7fe21c95c77993d84 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-dropdown-menu/package.json @@ -0,0 +1,76 @@ +{ + "name": "@radix-ui/react-dropdown-menu", + "version": "2.2.0", + "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.2.0", + "@radix-ui/react-compose-refs": "1.1.5", + "@radix-ui/react-context": "1.3.0", + "@radix-ui/react-menu": "2.2.0", + "@radix-ui/react-id": "1.1.4", + "@radix-ui/react-primitive": "2.2.0", + "@radix-ui/react-use-controllable-state": "1.3.0" + }, + "devDependencies": { + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "react": "^19.3.0", + "react-dom": "^19.3.0", + "typescript": "^5.9.3", + "@repo/builder": "0.0.0", + "@repo/test-data": "0.0.0", + "@repo/test-utils": "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", + "directory": "packages/react/dropdown-menu" + }, + "bugs": { + "url": "https://github.com/radix-ui/primitives/issues" + }, + "scripts": { + "lint": "oxlint --max-warnings 0 src", + "clean": "rm -rf dist", + "reset": "rm -rf dist node_modules", + "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" + } + } + } +} \ No newline at end of file diff --git a/e-commerce/node_modules/@radix-ui/react-focus-guards/LICENSE b/e-commerce/node_modules/@radix-ui/react-focus-guards/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a18858fb7b014098cba85703e66609be66a26ef5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-focus-guards/LICENSE @@ -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. diff --git a/e-commerce/node_modules/@radix-ui/react-focus-guards/README.md b/e-commerce/node_modules/@radix-ui/react-focus-guards/README.md new file mode 100644 index 0000000000000000000000000000000000000000..c0de2543c69255a28b9d5aaf63d62bcb262e9b57 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-focus-guards/README.md @@ -0,0 +1,3 @@ +# `react-focus-guards` + +This is an internal utility, not intended for public usage. diff --git a/e-commerce/node_modules/@radix-ui/react-focus-guards/dist/index.d.mts b/e-commerce/node_modules/@radix-ui/react-focus-guards/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..5d9b7bf98159b7f8d404d20334b533d408c9c09a --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-focus-guards/dist/index.d.mts @@ -0,0 +1,13 @@ +import * as React from 'react'; + +interface FocusGuardsProps { + children?: React.ReactNode | undefined; +} +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 }; diff --git a/e-commerce/node_modules/@radix-ui/react-focus-guards/dist/index.d.ts b/e-commerce/node_modules/@radix-ui/react-focus-guards/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5d9b7bf98159b7f8d404d20334b533d408c9c09a --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-focus-guards/dist/index.d.ts @@ -0,0 +1,13 @@ +import * as React from 'react'; + +interface FocusGuardsProps { + children?: React.ReactNode | undefined; +} +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 }; diff --git a/e-commerce/node_modules/@radix-ui/react-focus-guards/dist/index.js b/e-commerce/node_modules/@radix-ui/react-focus-guards/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..cffd2b558e59419e9eb863494f92579fe1f9c764 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-focus-guards/dist/index.js @@ -0,0 +1,85 @@ +"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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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; +var guards = null; +function FocusGuards(props) { + useFocusGuards(); + return props.children; +} +__name(FocusGuards, "FocusGuards"); +function useFocusGuards() { + React.useEffect(() => { + if (!guards) { + guards = { start: createFocusGuard(), end: createFocusGuard() }; + } + const { start, end } = guards; + if (document.body.firstElementChild !== start) { + document.body.insertAdjacentElement("afterbegin", start); + } + if (document.body.lastElementChild !== end) { + document.body.insertAdjacentElement("beforeend", end); + } + count++; + return () => { + if (count === 1) { + guards?.start.remove(); + guards?.end.remove(); + guards = null; + } + count = Math.max(0, count - 1); + }; + }, []); +} +__name(useFocusGuards, "useFocusGuards"); +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; +} +__name(createFocusGuard, "createFocusGuard"); +//# sourceMappingURL=index.js.map diff --git a/e-commerce/node_modules/@radix-ui/react-focus-guards/dist/index.js.map b/e-commerce/node_modules/@radix-ui/react-focus-guards/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..89be3c5dd5d38e4bb25a0b62898ab60a3d7f716a --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-focus-guards/dist/index.js.map @@ -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\n/**\n * Cached references to the single shared pair of edge guards. Keeping these at\n * module scope lets us avoid scanning the whole document (`querySelectorAll`)\n * and re-inserting the guards on every overlay mount.\n */\nlet guards: { start: HTMLSpanElement; end: HTMLSpanElement } | null = null;\n\ninterface FocusGuardsProps {\n children?: React.ReactNode | undefined;\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 React.useEffect(() => {\n if (!guards) {\n guards = { start: createFocusGuard(), end: createFocusGuard() };\n }\n const { start, end } = guards;\n\n // Only mutate the DOM when the edge invariant is actually broken. Writing\n // to `document.body` dirties layout and forces a synchronous reflow once\n // sibling effects read layout (Popper measuring, react-remove-scroll,\n // aria-hidden, FocusScope), so skipping no-op moves avoids that cost on\n // every mount. The trailing guard still gets re-asserted to last whenever a\n // newly portaled node lands after it (portals append to the end of\n // `document.body`). See https://github.com/radix-ui/primitives/issues/2812\n if (document.body.firstElementChild !== start) {\n document.body.insertAdjacentElement('afterbegin', start);\n }\n if (document.body.lastElementChild !== end) {\n document.body.insertAdjacentElement('beforeend', end);\n }\n count++;\n\n return () => {\n if (count === 1) {\n guards?.start.remove();\n guards?.end.remove();\n guards = null;\n }\n count = Math.max(0, count - 1);\n };\n }, []);\n}\n\nfunction createFocusGuard() {\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;AAOZ,IAAI,SAAkE;AAMtE,SAAS,YAAY,OAAyB;AAC5C,iBAAe;AACf,SAAO,MAAM;AACf;AAHS;AAST,SAAS,iBAAiB;AACxB,EAAM,gBAAU,MAAM;AACpB,QAAI,CAAC,QAAQ;AACX,eAAS,EAAE,OAAO,iBAAiB,GAAG,KAAK,iBAAiB,EAAE;AAAA,IAChE;AACA,UAAM,EAAE,OAAO,IAAI,IAAI;AASvB,QAAI,SAAS,KAAK,sBAAsB,OAAO;AAC7C,eAAS,KAAK,sBAAsB,cAAc,KAAK;AAAA,IACzD;AACA,QAAI,SAAS,KAAK,qBAAqB,KAAK;AAC1C,eAAS,KAAK,sBAAsB,aAAa,GAAG;AAAA,IACtD;AACA;AAEA,WAAO,MAAM;AACX,UAAI,UAAU,GAAG;AACf,gBAAQ,MAAM,OAAO;AACrB,gBAAQ,IAAI,OAAO;AACnB,iBAAS;AAAA,MACX;AACA,cAAQ,KAAK,IAAI,GAAG,QAAQ,CAAC;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,CAAC;AACP;AA/BS;AAiCT,SAAS,mBAAmB;AAC1B,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;AATS;", + "names": [] +} diff --git a/e-commerce/node_modules/@radix-ui/react-focus-guards/dist/index.mjs b/e-commerce/node_modules/@radix-ui/react-focus-guards/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a0ee52d04e9b9d2c28bc6d9b16edddc2224b49c2 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-focus-guards/dist/index.mjs @@ -0,0 +1,54 @@ +"use client"; +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// src/focus-guards.tsx +import * as React from "react"; +var count = 0; +var guards = null; +function FocusGuards(props) { + useFocusGuards(); + return props.children; +} +__name(FocusGuards, "FocusGuards"); +function useFocusGuards() { + React.useEffect(() => { + if (!guards) { + guards = { start: createFocusGuard(), end: createFocusGuard() }; + } + const { start, end } = guards; + if (document.body.firstElementChild !== start) { + document.body.insertAdjacentElement("afterbegin", start); + } + if (document.body.lastElementChild !== end) { + document.body.insertAdjacentElement("beforeend", end); + } + count++; + return () => { + if (count === 1) { + guards?.start.remove(); + guards?.end.remove(); + guards = null; + } + count = Math.max(0, count - 1); + }; + }, []); +} +__name(useFocusGuards, "useFocusGuards"); +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; +} +__name(createFocusGuard, "createFocusGuard"); +export { + FocusGuards, + FocusGuards as Root, + useFocusGuards +}; +//# sourceMappingURL=index.mjs.map diff --git a/e-commerce/node_modules/@radix-ui/react-focus-guards/dist/index.mjs.map b/e-commerce/node_modules/@radix-ui/react-focus-guards/dist/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..92f9f27f499e1a2a167f1f38c5d65b18f3cad695 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-focus-guards/dist/index.mjs.map @@ -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\n/**\n * Cached references to the single shared pair of edge guards. Keeping these at\n * module scope lets us avoid scanning the whole document (`querySelectorAll`)\n * and re-inserting the guards on every overlay mount.\n */\nlet guards: { start: HTMLSpanElement; end: HTMLSpanElement } | null = null;\n\ninterface FocusGuardsProps {\n children?: React.ReactNode | undefined;\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 React.useEffect(() => {\n if (!guards) {\n guards = { start: createFocusGuard(), end: createFocusGuard() };\n }\n const { start, end } = guards;\n\n // Only mutate the DOM when the edge invariant is actually broken. Writing\n // to `document.body` dirties layout and forces a synchronous reflow once\n // sibling effects read layout (Popper measuring, react-remove-scroll,\n // aria-hidden, FocusScope), so skipping no-op moves avoids that cost on\n // every mount. The trailing guard still gets re-asserted to last whenever a\n // newly portaled node lands after it (portals append to the end of\n // `document.body`). See https://github.com/radix-ui/primitives/issues/2812\n if (document.body.firstElementChild !== start) {\n document.body.insertAdjacentElement('afterbegin', start);\n }\n if (document.body.lastElementChild !== end) {\n document.body.insertAdjacentElement('beforeend', end);\n }\n count++;\n\n return () => {\n if (count === 1) {\n guards?.start.remove();\n guards?.end.remove();\n guards = null;\n }\n count = Math.max(0, count - 1);\n };\n }, []);\n}\n\nfunction createFocusGuard() {\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;AAOZ,IAAI,SAAkE;AAMtE,SAAS,YAAY,OAAyB;AAC5C,iBAAe;AACf,SAAO,MAAM;AACf;AAHS;AAST,SAAS,iBAAiB;AACxB,EAAM,gBAAU,MAAM;AACpB,QAAI,CAAC,QAAQ;AACX,eAAS,EAAE,OAAO,iBAAiB,GAAG,KAAK,iBAAiB,EAAE;AAAA,IAChE;AACA,UAAM,EAAE,OAAO,IAAI,IAAI;AASvB,QAAI,SAAS,KAAK,sBAAsB,OAAO;AAC7C,eAAS,KAAK,sBAAsB,cAAc,KAAK;AAAA,IACzD;AACA,QAAI,SAAS,KAAK,qBAAqB,KAAK;AAC1C,eAAS,KAAK,sBAAsB,aAAa,GAAG;AAAA,IACtD;AACA;AAEA,WAAO,MAAM;AACX,UAAI,UAAU,GAAG;AACf,gBAAQ,MAAM,OAAO;AACrB,gBAAQ,IAAI,OAAO;AACnB,iBAAS;AAAA,MACX;AACA,cAAQ,KAAK,IAAI,GAAG,QAAQ,CAAC;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,CAAC;AACP;AA/BS;AAiCT,SAAS,mBAAmB;AAC1B,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;AATS;", + "names": [] +} diff --git a/e-commerce/node_modules/@radix-ui/react-focus-guards/package.json b/e-commerce/node_modules/@radix-ui/react-focus-guards/package.json new file mode 100644 index 0000000000000000000000000000000000000000..43e0d0aa5a8a37fbc62464cd7ca6ef0e98c35ab8 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-focus-guards/package.json @@ -0,0 +1,60 @@ +{ + "name": "@radix-ui/react-focus-guards", + "version": "1.2.0", + "license": "MIT", + "source": "./src/index.ts", + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "files": [ + "dist", + "README.md" + ], + "sideEffects": false, + "devDependencies": { + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "react": "^19.3.0", + "react-dom": "^19.3.0", + "typescript": "^5.9.3", + "@repo/builder": "0.0.0", + "@repo/typescript-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", + "directory": "packages/react/focus-guards" + }, + "bugs": { + "url": "https://github.com/radix-ui/primitives/issues" + }, + "scripts": { + "lint": "oxlint --max-warnings 0 src", + "clean": "rm -rf dist", + "reset": "rm -rf dist node_modules", + "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" + } + } + } +} \ No newline at end of file diff --git a/e-commerce/node_modules/@radix-ui/react-focus-scope/LICENSE b/e-commerce/node_modules/@radix-ui/react-focus-scope/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a18858fb7b014098cba85703e66609be66a26ef5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-focus-scope/LICENSE @@ -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. diff --git a/e-commerce/node_modules/@radix-ui/react-focus-scope/README.md b/e-commerce/node_modules/@radix-ui/react-focus-scope/README.md new file mode 100644 index 0000000000000000000000000000000000000000..46f03117fb1211fd95ebb2f9813522c1a7f54f5a --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-focus-scope/README.md @@ -0,0 +1,3 @@ +# `react-focus-scope` + +This is an internal utility, not intended for public usage. diff --git a/e-commerce/node_modules/@radix-ui/react-focus-scope/dist/index.d.mts b/e-commerce/node_modules/@radix-ui/react-focus-scope/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6fcb4af8ebc3569fd08983edc488f6a3a824b542 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-focus-scope/dist/index.d.mts @@ -0,0 +1,75 @@ +import * as React from 'react'; +import { Primitive } from '@radix-ui/react-primitive'; + +type PrimitiveDivProps = React.ComponentPropsWithoutRef; +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 | undefined; + /** + * When `true`, focus cannot escape the focus scope via keyboard, + * pointer, or a programmatic focus. + * @defaultValue false + */ + trapped?: boolean | undefined; + /** + * A list of nodes that should be treated as part of the focus scope even + * though they don't live within the scope's DOM subtree (eg. portalled + * content of a nested, non-modal layer). When the scope is `trapped`, focus + * is allowed to move into these branches without being reclaimed. + * + * See: https://github.com/radix-ui/primitives/issues/3423 + */ + branches?: HTMLElement[] | undefined; + /** + * Event handler called when auto-focusing on mount. + * Can be prevented. + */ + onMountAutoFocus?: ((event: Event) => void) | undefined; + /** + * Event handler called when auto-focusing on unmount. + * Can be prevented. + */ + onUnmountAutoFocus?: ((event: Event) => void) | undefined; +} +declare const FocusScope: React.ForwardRefExoticComponent>; +/** + * Lets portalled content that is a React descendant of a (modal) layer — but rendered outside of + * that layer's DOM subtree — register itself as a "branch" of the layer's focus scope. + * + * A modal container (eg. `Dialog`) creates a registry via `useFocusScopeBranchRegistry`, renders a + * `FocusScopeBranchProvider` around its children, and passes the collected `nodes` to its trapped + * `FocusScope` (so focus isn't reclaimed from the branch) and, if applicable, to its `RemoveScroll` + * `shards` (so the branch remains scrollable). Nested layers (eg. a non-modal `Popover`) register + * their content node with `useFocusScopeBranch`. + * + * See: https://github.com/radix-ui/primitives/issues/3423 + */ +interface FocusScopeBranchRegistry { + add: (node: HTMLElement) => void; + remove: (node: HTMLElement) => void; +} +interface FocusScopeBranchProviderProps { + /** + * The registry nested layers should register themselves with. When nullish the provider is + * transparent, letting nested layers register against the next registry up the tree instead. This + * is the case for layers that don't trap focus or lock scroll, which have nothing to host. + */ + registry: FocusScopeBranchRegistry | null | undefined; + children?: React.ReactNode | undefined; +} +declare function FocusScopeBranchProvider({ registry, children }: FocusScopeBranchProviderProps): string | number | bigint | boolean | Iterable | Promise> | Iterable | null | undefined> | React.JSX.Element | null | undefined; +declare function useFocusScopeBranchRegistry(): { + readonly nodes: HTMLElement[]; + readonly registry: FocusScopeBranchRegistry; +}; +/** + * Registers `node` as a branch of the nearest ancestor `FocusScopeBranchProvider`. No-ops when + * there is no ancestor registry (eg. the layer isn't nested inside a modal layer). + */ +declare function useFocusScopeBranch(node: HTMLElement | null): void; + +export { FocusScope, FocusScopeBranchProvider, type FocusScopeBranchProviderProps, type FocusScopeBranchRegistry, type FocusScopeProps, FocusScope as Root, useFocusScopeBranch, useFocusScopeBranchRegistry }; diff --git a/e-commerce/node_modules/@radix-ui/react-focus-scope/dist/index.d.ts b/e-commerce/node_modules/@radix-ui/react-focus-scope/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6fcb4af8ebc3569fd08983edc488f6a3a824b542 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-focus-scope/dist/index.d.ts @@ -0,0 +1,75 @@ +import * as React from 'react'; +import { Primitive } from '@radix-ui/react-primitive'; + +type PrimitiveDivProps = React.ComponentPropsWithoutRef; +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 | undefined; + /** + * When `true`, focus cannot escape the focus scope via keyboard, + * pointer, or a programmatic focus. + * @defaultValue false + */ + trapped?: boolean | undefined; + /** + * A list of nodes that should be treated as part of the focus scope even + * though they don't live within the scope's DOM subtree (eg. portalled + * content of a nested, non-modal layer). When the scope is `trapped`, focus + * is allowed to move into these branches without being reclaimed. + * + * See: https://github.com/radix-ui/primitives/issues/3423 + */ + branches?: HTMLElement[] | undefined; + /** + * Event handler called when auto-focusing on mount. + * Can be prevented. + */ + onMountAutoFocus?: ((event: Event) => void) | undefined; + /** + * Event handler called when auto-focusing on unmount. + * Can be prevented. + */ + onUnmountAutoFocus?: ((event: Event) => void) | undefined; +} +declare const FocusScope: React.ForwardRefExoticComponent>; +/** + * Lets portalled content that is a React descendant of a (modal) layer — but rendered outside of + * that layer's DOM subtree — register itself as a "branch" of the layer's focus scope. + * + * A modal container (eg. `Dialog`) creates a registry via `useFocusScopeBranchRegistry`, renders a + * `FocusScopeBranchProvider` around its children, and passes the collected `nodes` to its trapped + * `FocusScope` (so focus isn't reclaimed from the branch) and, if applicable, to its `RemoveScroll` + * `shards` (so the branch remains scrollable). Nested layers (eg. a non-modal `Popover`) register + * their content node with `useFocusScopeBranch`. + * + * See: https://github.com/radix-ui/primitives/issues/3423 + */ +interface FocusScopeBranchRegistry { + add: (node: HTMLElement) => void; + remove: (node: HTMLElement) => void; +} +interface FocusScopeBranchProviderProps { + /** + * The registry nested layers should register themselves with. When nullish the provider is + * transparent, letting nested layers register against the next registry up the tree instead. This + * is the case for layers that don't trap focus or lock scroll, which have nothing to host. + */ + registry: FocusScopeBranchRegistry | null | undefined; + children?: React.ReactNode | undefined; +} +declare function FocusScopeBranchProvider({ registry, children }: FocusScopeBranchProviderProps): string | number | bigint | boolean | Iterable | Promise> | Iterable | null | undefined> | React.JSX.Element | null | undefined; +declare function useFocusScopeBranchRegistry(): { + readonly nodes: HTMLElement[]; + readonly registry: FocusScopeBranchRegistry; +}; +/** + * Registers `node` as a branch of the nearest ancestor `FocusScopeBranchProvider`. No-ops when + * there is no ancestor registry (eg. the layer isn't nested inside a modal layer). + */ +declare function useFocusScopeBranch(node: HTMLElement | null): void; + +export { FocusScope, FocusScopeBranchProvider, type FocusScopeBranchProviderProps, type FocusScopeBranchRegistry, type FocusScopeProps, FocusScope as Root, useFocusScopeBranch, useFocusScopeBranchRegistry }; diff --git a/e-commerce/node_modules/@radix-ui/react-focus-scope/dist/index.js b/e-commerce/node_modules/@radix-ui/react-focus-scope/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..b0720f20151604c8c207f40cbe73128001bac032 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-focus-scope/dist/index.js @@ -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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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, + FocusScopeBranchProvider: () => FocusScopeBranchProvider, + Root: () => FocusScope, + useFocusScopeBranch: () => useFocusScopeBranch, + useFocusScopeBranchRegistry: () => useFocusScopeBranchRegistry +}); +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 FocusScope = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function FocusScope2(props, forwardedRef) { + const { + loop = false, + trapped = false, + branches, + 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, setContainer); + const branchesRef = React.useRef(branches); + React.useEffect(() => { + branchesRef.current = branches; + }); + const isTargetInScope = React.useCallback( + (target) => { + if (!target) return false; + if (container?.contains(target)) return true; + return Boolean(branchesRef.current?.some((branch) => branch.contains(target))); + }, + [container] + ); + 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 (isTargetInScope(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 (!isTargetInScope(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; + __name(handleFocusIn2, "handleFocusIn"); + __name(handleFocusOut2, "handleFocusOut"); + __name(handleMutations2, "handleMutations"); + 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, isTargetInScope]); + 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); + const ownerDocument = container.ownerDocument; + const UnmountEvent = CustomEvent; + setTimeout(() => { + const unmountEvent = new UnmountEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS); + container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus); + container.dispatchEvent(unmountEvent); + if (!unmountEvent.defaultPrevented) { + focus(previouslyFocusedElement ?? ownerDocument.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") +); +var FocusScopeBranchContext = React.createContext(null); +function FocusScopeBranchProvider({ registry, children }) { + if (!registry) { + return children; + } + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FocusScopeBranchContext.Provider, { value: registry, children }); +} +__name(FocusScopeBranchProvider, "FocusScopeBranchProvider"); +function useFocusScopeBranchRegistry() { + const [nodes, setNodes] = React.useState([]); + const registry = React.useMemo( + () => ({ + add: /* @__PURE__ */ __name((node) => setNodes((prev) => prev.includes(node) ? prev : [...prev, node]), "add"), + remove: /* @__PURE__ */ __name((node) => setNodes((prev) => prev.filter((current) => current !== node)), "remove") + }), + [] + ); + return { nodes, registry }; +} +__name(useFocusScopeBranchRegistry, "useFocusScopeBranchRegistry"); +function useFocusScopeBranch(node) { + const registry = React.useContext(FocusScopeBranchContext); + React.useEffect(() => { + if (!node || !registry) return; + registry.add(node); + return () => registry.remove(node); + }, [node, registry]); +} +__name(useFocusScopeBranch, "useFocusScopeBranch"); +function focusFirst(candidates, { select = false } = {}) { + const previouslyFocusedElement = document.activeElement; + for (const candidate of candidates) { + focus(candidate, { select }); + if (document.activeElement !== previouslyFocusedElement) return; + } +} +__name(focusFirst, "focusFirst"); +function getTabbableEdges(container) { + const candidates = getTabbableCandidates(container); + const first = findVisible(candidates, container); + const last = findVisible(candidates.reverse(), container); + return [first, last]; +} +__name(getTabbableEdges, "getTabbableEdges"); +function getTabbableCandidates(container) { + const nodes = []; + const document2 = container.ownerDocument; + const walker = document2.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, { + acceptNode: /* @__PURE__ */ __name((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; + }, "acceptNode") + }); + while (walker.nextNode()) { + nodes.push(walker.currentNode); + } + return nodes; +} +__name(getTabbableCandidates, "getTabbableCandidates"); +function findVisible(elements, container) { + const canUseCheckVisibility = typeof container.checkVisibility === "function" && container.checkVisibility({ checkVisibilityCSS: true }); + for (const element of elements) { + const hidden = canUseCheckVisibility ? !element.checkVisibility({ checkVisibilityCSS: true }) : isHidden(element, { upTo: container }); + if (!hidden) { + return element; + } + } +} +__name(findVisible, "findVisible"); +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; +} +__name(isHidden, "isHidden"); +function isSelectableInput(element) { + return element.tagName === "INPUT" && typeof element.select === "function"; +} +__name(isSelectableInput, "isSelectableInput"); +function focus(element, { select = false } = {}) { + if (element && element.focus) { + const ownerDocument = element.ownerDocument ?? document; + const previouslyFocusedElement = ownerDocument.activeElement; + element.focus({ preventScroll: true }); + if (element !== previouslyFocusedElement && isSelectableInput(element) && select) + element.select(); + } +} +__name(focus, "focus"); +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(); + } + }; +} +__name(createFocusScopesStack, "createFocusScopesStack"); +function arrayRemove(array, item) { + const updatedArray = [...array]; + const index = updatedArray.indexOf(item); + if (index !== -1) { + updatedArray.splice(index, 1); + } + return updatedArray; +} +__name(arrayRemove, "arrayRemove"); +function removeLinks(items) { + return items.filter((item) => item.tagName !== "A"); +} +__name(removeLinks, "removeLinks"); +//# sourceMappingURL=index.js.map diff --git a/e-commerce/node_modules/@radix-ui/react-focus-scope/dist/index.js.map b/e-commerce/node_modules/@radix-ui/react-focus-scope/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..68d18b4d66153078a8ab444507d8e276b2c6924b --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-focus-scope/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts", "../src/focus-scope.tsx"], + "sourcesContent": ["'use client';\nexport {\n FocusScope,\n FocusScopeBranchProvider,\n useFocusScopeBranchRegistry,\n useFocusScopeBranch,\n //\n Root,\n} from './focus-scope';\nexport type {\n FocusScopeProps,\n FocusScopeBranchProviderProps,\n FocusScopeBranchRegistry,\n} from './focus-scope';\n", "import * as React from 'react';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\n\nconst AUTOFOCUS_ON_MOUNT = 'focusScope.autoFocusOnMount';\nconst AUTOFOCUS_ON_UNMOUNT = 'focusScope.autoFocusOnUnmount';\nconst EVENT_OPTIONS = { bubbles: false, cancelable: true };\n\ntype FocusableTarget = HTMLElement | { focus(): void };\n\n/* -------------------------------------------------------------------------------------------------\n * FocusScope\n * -----------------------------------------------------------------------------------------------*/\n\ntype FocusScopeElement = React.ComponentRef;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef;\ninterface FocusScopeProps extends PrimitiveDivProps {\n /**\n * When `true`, tabbing from last item will focus first tabbable\n * and shift+tab from first item will focus last tababble.\n * @defaultValue false\n */\n loop?: boolean | undefined;\n\n /**\n * When `true`, focus cannot escape the focus scope via keyboard,\n * pointer, or a programmatic focus.\n * @defaultValue false\n */\n trapped?: boolean | undefined;\n\n /**\n * A list of nodes that should be treated as part of the focus scope even\n * though they don't live within the scope's DOM subtree (eg. portalled\n * content of a nested, non-modal layer). When the scope is `trapped`, focus\n * is allowed to move into these branches without being reclaimed.\n *\n * See: https://github.com/radix-ui/primitives/issues/3423\n */\n branches?: HTMLElement[] | undefined;\n\n /**\n * Event handler called when auto-focusing on mount.\n * Can be prevented.\n */\n onMountAutoFocus?: ((event: Event) => void) | undefined;\n\n /**\n * Event handler called when auto-focusing on unmount.\n * Can be prevented.\n */\n onUnmountAutoFocus?: ((event: Event) => void) | undefined;\n}\n\nconst FocusScope = /* @__PURE__ */ React.forwardRef(\n function FocusScope(props, forwardedRef) {\n const {\n loop = false,\n trapped = false,\n branches,\n onMountAutoFocus: onMountAutoFocusProp,\n onUnmountAutoFocus: onUnmountAutoFocusProp,\n ...scopeProps\n } = props;\n const [container, setContainer] = React.useState(null);\n const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp);\n const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);\n const lastFocusedElementRef = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, setContainer);\n\n // Keep the latest branches in a ref so the trap effect below doesn't need to resubscribe its\n // listeners whenever the branch list updates. We sync it in the commit phase (not during render)\n // to stay safe under concurrent rendering, where a render can be discarded or replayed. The trap's\n // focus event handlers only run in response to user interaction (well after commit), so reading\n // the ref from them always sees the committed branch list.\n const branchesRef = React.useRef(branches);\n React.useEffect(() => {\n branchesRef.current = branches;\n });\n const isTargetInScope = React.useCallback(\n (target: HTMLElement | null) => {\n if (!target) return false;\n if (container?.contains(target)) return true;\n return Boolean(branchesRef.current?.some((branch) => branch.contains(target)));\n },\n [container],\n );\n\n const focusScope = React.useRef({\n paused: false,\n pause() {\n this.paused = true;\n },\n resume() {\n this.paused = false;\n },\n }).current;\n\n // Takes care of trapping focus if focus is moved outside programmatically for example\n React.useEffect(() => {\n if (trapped) {\n function handleFocusIn(event: FocusEvent) {\n if (focusScope.paused || !container) return;\n const target = event.target as HTMLElement | null;\n if (isTargetInScope(target)) {\n lastFocusedElementRef.current = target;\n } else {\n focus(lastFocusedElementRef.current, { select: true });\n }\n }\n\n function handleFocusOut(event: FocusEvent) {\n if (focusScope.paused || !container) return;\n const relatedTarget = event.relatedTarget as HTMLElement | null;\n\n // A `focusout` event with a `null` `relatedTarget` will happen in at\n // least two cases:\n // 1. When the user switches app/tabs/windows/the browser itself loses\n // focus.\n // 2. In Google Chrome, when the focused element is removed from the\n // DOM.\n //\n // We let the browser do its thing here because:\n // 1. The browser already keeps a memory of what's focused for when\n // the page gets refocused.\n // 2. In Google Chrome, if we try to focus the deleted focused element\n // (as per below), it throws the CPU to 100%, so we avoid doing\n // anything for this reason here too.\n if (relatedTarget === null) return;\n\n // If the focus has moved to an actual legitimate element\n // (`relatedTarget !== null`) that is outside the container (and any\n // registered branches), we move focus to the last valid focused\n // element inside.\n if (!isTargetInScope(relatedTarget)) {\n focus(lastFocusedElementRef.current, { select: true });\n }\n }\n\n // When the focused element gets removed from the DOM, browsers move focus\n // back to the document.body. In this case, we move focus to the container\n // to keep focus trapped correctly.\n function handleMutations(mutations: MutationRecord[]) {\n const focusedElement = document.activeElement as HTMLElement | null;\n if (focusedElement !== document.body) return;\n for (const mutation of mutations) {\n if (mutation.removedNodes.length > 0) focus(container);\n }\n }\n\n document.addEventListener('focusin', handleFocusIn);\n document.addEventListener('focusout', handleFocusOut);\n const mutationObserver = new MutationObserver(handleMutations);\n if (container) mutationObserver.observe(container, { childList: true, subtree: true });\n\n return () => {\n document.removeEventListener('focusin', handleFocusIn);\n document.removeEventListener('focusout', handleFocusOut);\n mutationObserver.disconnect();\n };\n }\n }, [trapped, container, focusScope.paused, isTargetInScope]);\n\n React.useEffect(() => {\n if (container) {\n focusScopesStack.add(focusScope);\n const previouslyFocusedElement = document.activeElement as HTMLElement | null;\n const hasFocusedCandidate = container.contains(previouslyFocusedElement);\n\n if (!hasFocusedCandidate) {\n const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);\n container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);\n container.dispatchEvent(mountEvent);\n if (!mountEvent.defaultPrevented) {\n focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });\n if (document.activeElement === previouslyFocusedElement) {\n focus(container);\n }\n }\n }\n\n return () => {\n container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);\n const ownerDocument = container.ownerDocument;\n const UnmountEvent = CustomEvent;\n\n // We hit a react bug (fixed in v17) with focusing in unmount.\n // We need to delay the focus a little to get around it for now.\n // See: https://github.com/facebook/react/issues/17894\n setTimeout(() => {\n const unmountEvent = new UnmountEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);\n container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);\n container.dispatchEvent(unmountEvent);\n if (!unmountEvent.defaultPrevented) {\n focus(previouslyFocusedElement ?? ownerDocument.body, { select: true });\n }\n // we need to remove the listener after we `dispatchEvent`\n container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);\n\n focusScopesStack.remove(focusScope);\n }, 0);\n };\n }\n }, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);\n\n // Takes care of looping focus (when tabbing whilst at the edges)\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent) => {\n if (!loop && !trapped) return;\n if (focusScope.paused) return;\n\n const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;\n const focusedElement = document.activeElement as HTMLElement | null;\n\n if (isTabKey && focusedElement) {\n const container = event.currentTarget as HTMLElement;\n const [first, last] = getTabbableEdges(container);\n const hasTabbableElementsInside = first && last;\n\n // we can only wrap focus if we have tabbable edges\n if (!hasTabbableElementsInside) {\n if (focusedElement === container) event.preventDefault();\n } else {\n if (!event.shiftKey && focusedElement === last) {\n event.preventDefault();\n if (loop) focus(first, { select: true });\n } else if (event.shiftKey && focusedElement === first) {\n event.preventDefault();\n if (loop) focus(last, { select: true });\n }\n }\n }\n },\n [loop, trapped, focusScope.paused],\n );\n\n return (\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * FocusScope branch registry\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * Lets portalled content that is a React descendant of a (modal) layer \u2014 but rendered outside of\n * that layer's DOM subtree \u2014 register itself as a \"branch\" of the layer's focus scope.\n *\n * A modal container (eg. `Dialog`) creates a registry via `useFocusScopeBranchRegistry`, renders a\n * `FocusScopeBranchProvider` around its children, and passes the collected `nodes` to its trapped\n * `FocusScope` (so focus isn't reclaimed from the branch) and, if applicable, to its `RemoveScroll`\n * `shards` (so the branch remains scrollable). Nested layers (eg. a non-modal `Popover`) register\n * their content node with `useFocusScopeBranch`.\n *\n * See: https://github.com/radix-ui/primitives/issues/3423\n */\ninterface FocusScopeBranchRegistry {\n add: (node: HTMLElement) => void;\n remove: (node: HTMLElement) => void;\n}\n\nconst FocusScopeBranchContext = React.createContext(null);\n\ninterface FocusScopeBranchProviderProps {\n /**\n * The registry nested layers should register themselves with. When nullish the provider is\n * transparent, letting nested layers register against the next registry up the tree instead. This\n * is the case for layers that don't trap focus or lock scroll, which have nothing to host.\n */\n registry: FocusScopeBranchRegistry | null | undefined;\n children?: React.ReactNode | undefined;\n}\n\nfunction FocusScopeBranchProvider({ registry, children }: FocusScopeBranchProviderProps) {\n if (!registry) {\n return children;\n }\n return (\n {children}\n );\n}\n\nfunction useFocusScopeBranchRegistry() {\n const [nodes, setNodes] = React.useState([]);\n const registry = React.useMemo(\n () => ({\n add: (node) => setNodes((prev) => (prev.includes(node) ? prev : [...prev, node])),\n remove: (node) => setNodes((prev) => prev.filter((current) => current !== node)),\n }),\n [],\n );\n return { nodes, registry } as const;\n}\n\n/**\n * Registers `node` as a branch of the nearest ancestor `FocusScopeBranchProvider`. No-ops when\n * there is no ancestor registry (eg. the layer isn't nested inside a modal layer).\n */\nfunction useFocusScopeBranch(node: HTMLElement | null) {\n const registry = React.useContext(FocusScopeBranchContext);\n React.useEffect(() => {\n if (!node || !registry) return;\n registry.add(node);\n return () => registry.remove(node);\n }, [node, registry]);\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Utils\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * Attempts focusing the first element in a list of candidates.\n * Stops when focus has actually moved.\n */\nfunction focusFirst(candidates: HTMLElement[], { select = false } = {}) {\n const previouslyFocusedElement = document.activeElement;\n for (const candidate of candidates) {\n focus(candidate, { select });\n if (document.activeElement !== previouslyFocusedElement) return;\n }\n}\n\n/**\n * Returns the first and last tabbable elements inside a container.\n */\nfunction getTabbableEdges(container: HTMLElement) {\n const candidates = getTabbableCandidates(container);\n const first = findVisible(candidates, container);\n const last = findVisible(candidates.reverse(), container);\n return [first, last] as const;\n}\n\n/**\n * Returns a list of potential tabbable candidates.\n *\n * NOTE: This is only a close approximation. For example it doesn't take into account cases like when\n * elements are not visible. This cannot be worked out easily by just reading a property, but rather\n * necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker\n * Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1\n */\nfunction getTabbableCandidates(container: HTMLElement) {\n const nodes: HTMLElement[] = [];\n const document = container.ownerDocument;\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node: Element) => {\n const isHiddenInput =\n node.tagName === 'INPUT' && (node as HTMLInputElement).type === 'hidden';\n if ((node as HTMLInputElement).disabled || (node as HTMLElement).hidden || isHiddenInput) {\n return NodeFilter.FILTER_SKIP;\n }\n // `.tabIndex` is not the same as the `tabindex` attribute. It works on the\n // runtime's understanding of tabbability, so this automatically accounts\n // for any kind of element that could be tabbed to.\n return (node as HTMLElement).tabIndex >= 0\n ? NodeFilter.FILTER_ACCEPT\n : NodeFilter.FILTER_SKIP;\n },\n });\n while (walker.nextNode()) {\n nodes.push(walker.currentNode as HTMLElement);\n }\n // we do not take into account the order of nodes with positive `tabIndex` as it\n // hinders accessibility to have tab order different from visual order.\n return nodes;\n}\n\n/**\n * Returns the first visible element in a list.\n * NOTE: Only checks visibility up to the `container`.\n */\nfunction findVisible(elements: HTMLElement[], container: HTMLElement) {\n // `checkVisibility` performs a single native check for `visibility: hidden`\n // and `display: none` across the ancestor chain. This avoids the repeated\n // `getComputedStyle` calls per ancestor that the fallback path requires,\n // which reduces the cost of style resolution triggered by earlier DOM writes\n // (e.g. react-remove-scroll, DismissableLayer setting body styles).\n const canUseCheckVisibility =\n typeof container.checkVisibility === 'function' &&\n container.checkVisibility({ checkVisibilityCSS: true });\n\n for (const element of elements) {\n const hidden = canUseCheckVisibility\n ? !element.checkVisibility({ checkVisibilityCSS: true })\n : isHidden(element, { upTo: container });\n // we stop checking if it's hidden at the `container` level (excluding)\n if (!hidden) {\n return element;\n }\n }\n}\n\nfunction isHidden(node: HTMLElement, { upTo }: { upTo?: HTMLElement | undefined }) {\n if (getComputedStyle(node).visibility === 'hidden') return true;\n while (node) {\n // we stop at `upTo` (excluding it)\n if (upTo !== undefined && node === upTo) return false;\n if (getComputedStyle(node).display === 'none') return true;\n node = node.parentElement as HTMLElement;\n }\n return false;\n}\n\nfunction isSelectableInput(element: FocusableTarget): element is HTMLInputElement {\n return (\n (element as HTMLElement).tagName === 'INPUT' &&\n typeof (element as HTMLInputElement).select === 'function'\n );\n}\n\nfunction focus(element?: FocusableTarget | null, { select = false } = {}) {\n // only focus if that element is focusable\n if (element && element.focus) {\n // Prefer the element's own document over the global one: they can differ for elements in\n // another realm, and the global may no longer exist when this runs from the unmount timer.\n const ownerDocument = (element as Partial).ownerDocument ?? document;\n const previouslyFocusedElement = ownerDocument.activeElement;\n // NOTE: we prevent scrolling on focus, to minimize jarring transitions for users\n element.focus({ preventScroll: true });\n // only select if its not the same element, it supports selection and we need to select\n if (element !== previouslyFocusedElement && isSelectableInput(element) && select)\n element.select();\n }\n}\n\n/* -------------------------------------------------------------------------------------------------\n * FocusScope stack\n * -----------------------------------------------------------------------------------------------*/\n\ntype FocusScopeAPI = { paused: boolean; pause(): void; resume(): void };\nconst focusScopesStack = createFocusScopesStack();\n\nfunction createFocusScopesStack() {\n /** A stack of focus scopes, with the active one at the top */\n let stack: FocusScopeAPI[] = [];\n\n return {\n add(focusScope: FocusScopeAPI) {\n // pause the currently active focus scope (at the top of the stack)\n const activeFocusScope = stack[0];\n if (focusScope !== activeFocusScope) {\n activeFocusScope?.pause();\n }\n // remove in case it already exists (because we'll re-add it at the top of the stack)\n stack = arrayRemove(stack, focusScope);\n stack.unshift(focusScope);\n },\n\n remove(focusScope: FocusScopeAPI) {\n stack = arrayRemove(stack, focusScope);\n stack[0]?.resume();\n },\n };\n}\n\nfunction arrayRemove(array: T[], item: T) {\n const updatedArray = [...array];\n const index = updatedArray.indexOf(item);\n if (index !== -1) {\n updatedArray.splice(index, 1);\n }\n return updatedArray;\n}\n\nfunction removeLinks(items: HTMLElement[]) {\n return items.filter((item) => item.tagName !== 'A');\n}\n\nexport {\n FocusScope,\n FocusScopeBranchProvider,\n useFocusScopeBranchRegistry,\n useFocusScopeBranch,\n //\n FocusScope as Root,\n};\nexport type { FocusScopeProps, FocusScopeBranchProviderProps, FocusScopeBranchRegistry };\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,gCAAgC;AAChC,6BAA0B;AAC1B,oCAA+B;AA2OzB;AAzON,IAAM,qBAAqB;AAC3B,IAAM,uBAAuB;AAC7B,IAAM,gBAAgB,EAAE,SAAS,OAAO,YAAY,KAAK;AAgDzD,IAAM,aAA6B,gBAAM;AAAA,EACvC,gCAASA,YAAW,OAAO,cAAc;A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OAAQ,QAAO;AACtD,WAAO,KAAK;AAAA,EACd;AACA,SAAO;AACT;AATS;AAWT,SAAS,kBAAkB,SAAuD;AAChF,SACG,QAAwB,YAAY,WACrC,OAAQ,QAA6B,WAAW;AAEpD;AALS;AAOT,SAAS,MAAM,SAAkC,EAAE,SAAS,MAAM,IAAI,CAAC,GAAG;AAExE,MAAI,WAAW,QAAQ,OAAO;AAG5B,UAAM,gBAAiB,QAAiC,iBAAiB;AACzE,UAAM,2BAA2B,cAAc;AAE/C,YAAQ,MAAM,EAAE,eAAe,KAAK,CAAC;AAErC,QAAI,YAAY,4BAA4B,kBAAkB,OAAO,KAAK;AACxE,cAAQ,OAAO;AAAA,EACnB;AACF;AAbS;AAoBT,IAAM,mBAAmB,uBAAuB;AAEhD,SAAS,yBAAyB;AAEhC,MAAI,QAAyB,CAAC;AAE9B,SAAO;AAAA,IACL,IAAI,YAA2B;AAE7B,YAAM,mBAAmB,MAAM,CAAC;AAChC,UAAI,eAAe,kBAAkB;AACnC,0BAAkB,MAAM;AAAA,MAC1B;AAEA,cAAQ,YAAY,OAAO,UAAU;AACrC,YAAM,QAAQ,UAAU;AAAA,IAC1B;AAAA,IAEA,OAAO,YAA2B;AAChC,cAAQ,YAAY,OAAO,UAAU;AACrC,YAAM,CAAC,GAAG,OAAO;AAAA,IACnB;AAAA,EACF;AACF;AArBS;AAuBT,SAAS,YAAe,OAAY,MAAS;AAC3C,QAAM,eAAe,CAAC,GAAG,KAAK;AAC9B,QAAM,QAAQ,aAAa,QAAQ,IAAI;AACvC,MAAI,UAAU,IAAI;AAChB,iBAAa,OAAO,OAAO,CAAC;AAAA,EAC9B;AACA,SAAO;AACT;AAPS;AAST,SAAS,YAAY,OAAsB;AACzC,SAAO,MAAM,OAAO,CAAC,SAAS,KAAK,YAAY,GAAG;AACpD;AAFS;", + "names": ["FocusScope", "handleFocusIn", "handleFocusOut", "handleMutations", "container", "document"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-focus-scope/dist/index.mjs b/e-commerce/node_modules/@radix-ui/react-focus-scope/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..692ec7d0d36895f87ec69c0811efc562b2e5ca82 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-focus-scope/dist/index.mjs @@ -0,0 +1,285 @@ +"use client"; +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// src/focus-scope.tsx +import * as React from "react"; +import { useComposedRefs } from "@radix-ui/react-compose-refs"; +import { Primitive } from "@radix-ui/react-primitive"; +import { useCallbackRef } from "@radix-ui/react-use-callback-ref"; +import { jsx } from "react/jsx-runtime"; +var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount"; +var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount"; +var EVENT_OPTIONS = { bubbles: false, cancelable: true }; +var FocusScope = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function FocusScope2(props, forwardedRef) { + const { + loop = false, + trapped = false, + branches, + onMountAutoFocus: onMountAutoFocusProp, + onUnmountAutoFocus: onUnmountAutoFocusProp, + ...scopeProps + } = props; + const [container, setContainer] = React.useState(null); + const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp); + const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp); + const lastFocusedElementRef = React.useRef(null); + const composedRefs = useComposedRefs(forwardedRef, setContainer); + const branchesRef = React.useRef(branches); + React.useEffect(() => { + branchesRef.current = branches; + }); + const isTargetInScope = React.useCallback( + (target) => { + if (!target) return false; + if (container?.contains(target)) return true; + return Boolean(branchesRef.current?.some((branch) => branch.contains(target))); + }, + [container] + ); + 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 (isTargetInScope(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 (!isTargetInScope(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; + __name(handleFocusIn2, "handleFocusIn"); + __name(handleFocusOut2, "handleFocusOut"); + __name(handleMutations2, "handleMutations"); + 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, isTargetInScope]); + 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); + const ownerDocument = container.ownerDocument; + const UnmountEvent = CustomEvent; + setTimeout(() => { + const unmountEvent = new UnmountEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS); + container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus); + container.dispatchEvent(unmountEvent); + if (!unmountEvent.defaultPrevented) { + focus(previouslyFocusedElement ?? ownerDocument.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__ */ jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown }); + }, "FocusScope") +); +var FocusScopeBranchContext = React.createContext(null); +function FocusScopeBranchProvider({ registry, children }) { + if (!registry) { + return children; + } + return /* @__PURE__ */ jsx(FocusScopeBranchContext.Provider, { value: registry, children }); +} +__name(FocusScopeBranchProvider, "FocusScopeBranchProvider"); +function useFocusScopeBranchRegistry() { + const [nodes, setNodes] = React.useState([]); + const registry = React.useMemo( + () => ({ + add: /* @__PURE__ */ __name((node) => setNodes((prev) => prev.includes(node) ? prev : [...prev, node]), "add"), + remove: /* @__PURE__ */ __name((node) => setNodes((prev) => prev.filter((current) => current !== node)), "remove") + }), + [] + ); + return { nodes, registry }; +} +__name(useFocusScopeBranchRegistry, "useFocusScopeBranchRegistry"); +function useFocusScopeBranch(node) { + const registry = React.useContext(FocusScopeBranchContext); + React.useEffect(() => { + if (!node || !registry) return; + registry.add(node); + return () => registry.remove(node); + }, [node, registry]); +} +__name(useFocusScopeBranch, "useFocusScopeBranch"); +function focusFirst(candidates, { select = false } = {}) { + const previouslyFocusedElement = document.activeElement; + for (const candidate of candidates) { + focus(candidate, { select }); + if (document.activeElement !== previouslyFocusedElement) return; + } +} +__name(focusFirst, "focusFirst"); +function getTabbableEdges(container) { + const candidates = getTabbableCandidates(container); + const first = findVisible(candidates, container); + const last = findVisible(candidates.reverse(), container); + return [first, last]; +} +__name(getTabbableEdges, "getTabbableEdges"); +function getTabbableCandidates(container) { + const nodes = []; + const document2 = container.ownerDocument; + const walker = document2.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, { + acceptNode: /* @__PURE__ */ __name((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; + }, "acceptNode") + }); + while (walker.nextNode()) { + nodes.push(walker.currentNode); + } + return nodes; +} +__name(getTabbableCandidates, "getTabbableCandidates"); +function findVisible(elements, container) { + const canUseCheckVisibility = typeof container.checkVisibility === "function" && container.checkVisibility({ checkVisibilityCSS: true }); + for (const element of elements) { + const hidden = canUseCheckVisibility ? !element.checkVisibility({ checkVisibilityCSS: true }) : isHidden(element, { upTo: container }); + if (!hidden) { + return element; + } + } +} +__name(findVisible, "findVisible"); +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; +} +__name(isHidden, "isHidden"); +function isSelectableInput(element) { + return element.tagName === "INPUT" && typeof element.select === "function"; +} +__name(isSelectableInput, "isSelectableInput"); +function focus(element, { select = false } = {}) { + if (element && element.focus) { + const ownerDocument = element.ownerDocument ?? document; + const previouslyFocusedElement = ownerDocument.activeElement; + element.focus({ preventScroll: true }); + if (element !== previouslyFocusedElement && isSelectableInput(element) && select) + element.select(); + } +} +__name(focus, "focus"); +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(); + } + }; +} +__name(createFocusScopesStack, "createFocusScopesStack"); +function arrayRemove(array, item) { + const updatedArray = [...array]; + const index = updatedArray.indexOf(item); + if (index !== -1) { + updatedArray.splice(index, 1); + } + return updatedArray; +} +__name(arrayRemove, "arrayRemove"); +function removeLinks(items) { + return items.filter((item) => item.tagName !== "A"); +} +__name(removeLinks, "removeLinks"); +export { + FocusScope, + FocusScopeBranchProvider, + FocusScope as Root, + useFocusScopeBranch, + useFocusScopeBranchRegistry +}; +//# sourceMappingURL=index.mjs.map diff --git a/e-commerce/node_modules/@radix-ui/react-focus-scope/dist/index.mjs.map b/e-commerce/node_modules/@radix-ui/react-focus-scope/dist/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..b5c049a200b2d2f0e5825f559acea9019d6e1d23 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-focus-scope/dist/index.mjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/focus-scope.tsx"], + "sourcesContent": ["import * as React from 'react';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\n\nconst AUTOFOCUS_ON_MOUNT = 'focusScope.autoFocusOnMount';\nconst AUTOFOCUS_ON_UNMOUNT = 'focusScope.autoFocusOnUnmount';\nconst EVENT_OPTIONS = { bubbles: false, cancelable: true };\n\ntype FocusableTarget = HTMLElement | { focus(): void };\n\n/* -------------------------------------------------------------------------------------------------\n * FocusScope\n * -----------------------------------------------------------------------------------------------*/\n\ntype FocusScopeElement = React.ComponentRef;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef;\ninterface FocusScopeProps extends PrimitiveDivProps {\n /**\n * When `true`, tabbing from last item will focus first tabbable\n * and shift+tab from first item will focus last tababble.\n * @defaultValue false\n */\n loop?: boolean | undefined;\n\n /**\n * When `true`, focus cannot escape the focus scope via keyboard,\n * pointer, or a programmatic focus.\n * @defaultValue false\n */\n trapped?: boolean | undefined;\n\n /**\n * A list of nodes that should be treated as part of the focus scope even\n * though they don't live within the scope's DOM subtree (eg. portalled\n * content of a nested, non-modal layer). When the scope is `trapped`, focus\n * is allowed to move into these branches without being reclaimed.\n *\n * See: https://github.com/radix-ui/primitives/issues/3423\n */\n branches?: HTMLElement[] | undefined;\n\n /**\n * Event handler called when auto-focusing on mount.\n * Can be prevented.\n */\n onMountAutoFocus?: ((event: Event) => void) | undefined;\n\n /**\n * Event handler called when auto-focusing on unmount.\n * Can be prevented.\n */\n onUnmountAutoFocus?: ((event: Event) => void) | undefined;\n}\n\nconst FocusScope = /* @__PURE__ */ React.forwardRef(\n function FocusScope(props, forwardedRef) {\n const {\n loop = false,\n trapped = false,\n branches,\n onMountAutoFocus: onMountAutoFocusProp,\n onUnmountAutoFocus: onUnmountAutoFocusProp,\n ...scopeProps\n } = props;\n const [container, setContainer] = React.useState(null);\n const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp);\n const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);\n const lastFocusedElementRef = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, setContainer);\n\n // Keep the latest branches in a ref so the trap effect below doesn't need to resubscribe its\n // listeners whenever the branch list updates. We sync it in the commit phase (not during render)\n // to stay safe under concurrent rendering, where a render can be discarded or replayed. The trap's\n // focus event handlers only run in response to user interaction (well after commit), so reading\n // the ref from them always sees the committed branch list.\n const branchesRef = React.useRef(branches);\n React.useEffect(() => {\n branchesRef.current = branches;\n });\n const isTargetInScope = React.useCallback(\n (target: HTMLElement | null) => {\n if (!target) return false;\n if (container?.contains(target)) return true;\n return Boolean(branchesRef.current?.some((branch) => branch.contains(target)));\n },\n [container],\n );\n\n const focusScope = React.useRef({\n paused: false,\n pause() {\n this.paused = true;\n },\n resume() {\n this.paused = false;\n },\n }).current;\n\n // Takes care of trapping focus if focus is moved outside programmatically for example\n React.useEffect(() => {\n if (trapped) {\n function handleFocusIn(event: FocusEvent) {\n if (focusScope.paused || !container) return;\n const target = event.target as HTMLElement | null;\n if (isTargetInScope(target)) {\n lastFocusedElementRef.current = target;\n } else {\n focus(lastFocusedElementRef.current, { select: true });\n }\n }\n\n function handleFocusOut(event: FocusEvent) {\n if (focusScope.paused || !container) return;\n const relatedTarget = event.relatedTarget as HTMLElement | null;\n\n // A `focusout` event with a `null` `relatedTarget` will happen in at\n // least two cases:\n // 1. When the user switches app/tabs/windows/the browser itself loses\n // focus.\n // 2. In Google Chrome, when the focused element is removed from the\n // DOM.\n //\n // We let the browser do its thing here because:\n // 1. The browser already keeps a memory of what's focused for when\n // the page gets refocused.\n // 2. In Google Chrome, if we try to focus the deleted focused element\n // (as per below), it throws the CPU to 100%, so we avoid doing\n // anything for this reason here too.\n if (relatedTarget === null) return;\n\n // If the focus has moved to an actual legitimate element\n // (`relatedTarget !== null`) that is outside the container (and any\n // registered branches), we move focus to the last valid focused\n // element inside.\n if (!isTargetInScope(relatedTarget)) {\n focus(lastFocusedElementRef.current, { select: true });\n }\n }\n\n // When the focused element gets removed from the DOM, browsers move focus\n // back to the document.body. In this case, we move focus to the container\n // to keep focus trapped correctly.\n function handleMutations(mutations: MutationRecord[]) {\n const focusedElement = document.activeElement as HTMLElement | null;\n if (focusedElement !== document.body) return;\n for (const mutation of mutations) {\n if (mutation.removedNodes.length > 0) focus(container);\n }\n }\n\n document.addEventListener('focusin', handleFocusIn);\n document.addEventListener('focusout', handleFocusOut);\n const mutationObserver = new MutationObserver(handleMutations);\n if (container) mutationObserver.observe(container, { childList: true, subtree: true });\n\n return () => {\n document.removeEventListener('focusin', handleFocusIn);\n document.removeEventListener('focusout', handleFocusOut);\n mutationObserver.disconnect();\n };\n }\n }, [trapped, container, focusScope.paused, isTargetInScope]);\n\n React.useEffect(() => {\n if (container) {\n focusScopesStack.add(focusScope);\n const previouslyFocusedElement = document.activeElement as HTMLElement | null;\n const hasFocusedCandidate = container.contains(previouslyFocusedElement);\n\n if (!hasFocusedCandidate) {\n const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);\n container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);\n container.dispatchEvent(mountEvent);\n if (!mountEvent.defaultPrevented) {\n focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });\n if (document.activeElement === previouslyFocusedElement) {\n focus(container);\n }\n }\n }\n\n return () => {\n container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);\n const ownerDocument = container.ownerDocument;\n const UnmountEvent = CustomEvent;\n\n // We hit a react bug (fixed in v17) with focusing in unmount.\n // We need to delay the focus a little to get around it for now.\n // See: https://github.com/facebook/react/issues/17894\n setTimeout(() => {\n const unmountEvent = new UnmountEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);\n container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);\n container.dispatchEvent(unmountEvent);\n if (!unmountEvent.defaultPrevented) {\n focus(previouslyFocusedElement ?? ownerDocument.body, { select: true });\n }\n // we need to remove the listener after we `dispatchEvent`\n container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);\n\n focusScopesStack.remove(focusScope);\n }, 0);\n };\n }\n }, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);\n\n // Takes care of looping focus (when tabbing whilst at the edges)\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent) => {\n if (!loop && !trapped) return;\n if (focusScope.paused) return;\n\n const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;\n const focusedElement = document.activeElement as HTMLElement | null;\n\n if (isTabKey && focusedElement) {\n const container = event.currentTarget as HTMLElement;\n const [first, last] = getTabbableEdges(container);\n const hasTabbableElementsInside = first && last;\n\n // we can only wrap focus if we have tabbable edges\n if (!hasTabbableElementsInside) {\n if (focusedElement === container) event.preventDefault();\n } else {\n if (!event.shiftKey && focusedElement === last) {\n event.preventDefault();\n if (loop) focus(first, { select: true });\n } else if (event.shiftKey && focusedElement === first) {\n event.preventDefault();\n if (loop) focus(last, { select: true });\n }\n }\n }\n },\n [loop, trapped, focusScope.paused],\n );\n\n return (\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * FocusScope branch registry\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * Lets portalled content that is a React descendant of a (modal) layer \u2014 but rendered outside of\n * that layer's DOM subtree \u2014 register itself as a \"branch\" of the layer's focus scope.\n *\n * A modal container (eg. `Dialog`) creates a registry via `useFocusScopeBranchRegistry`, renders a\n * `FocusScopeBranchProvider` around its children, and passes the collected `nodes` to its trapped\n * `FocusScope` (so focus isn't reclaimed from the branch) and, if applicable, to its `RemoveScroll`\n * `shards` (so the branch remains scrollable). Nested layers (eg. a non-modal `Popover`) register\n * their content node with `useFocusScopeBranch`.\n *\n * See: https://github.com/radix-ui/primitives/issues/3423\n */\ninterface FocusScopeBranchRegistry {\n add: (node: HTMLElement) => void;\n remove: (node: HTMLElement) => void;\n}\n\nconst FocusScopeBranchContext = React.createContext(null);\n\ninterface FocusScopeBranchProviderProps {\n /**\n * The registry nested layers should register themselves with. When nullish the provider is\n * transparent, letting nested layers register against the next registry up the tree instead. This\n * is the case for layers that don't trap focus or lock scroll, which have nothing to host.\n */\n registry: FocusScopeBranchRegistry | null | undefined;\n children?: React.ReactNode | undefined;\n}\n\nfunction FocusScopeBranchProvider({ registry, children }: FocusScopeBranchProviderProps) {\n if (!registry) {\n return children;\n }\n return (\n {children}\n );\n}\n\nfunction useFocusScopeBranchRegistry() {\n const [nodes, setNodes] = React.useState([]);\n const registry = React.useMemo(\n () => ({\n add: (node) => setNodes((prev) => (prev.includes(node) ? prev : [...prev, node])),\n remove: (node) => setNodes((prev) => prev.filter((current) => current !== node)),\n }),\n [],\n );\n return { nodes, registry } as const;\n}\n\n/**\n * Registers `node` as a branch of the nearest ancestor `FocusScopeBranchProvider`. No-ops when\n * there is no ancestor registry (eg. the layer isn't nested inside a modal layer).\n */\nfunction useFocusScopeBranch(node: HTMLElement | null) {\n const registry = React.useContext(FocusScopeBranchContext);\n React.useEffect(() => {\n if (!node || !registry) return;\n registry.add(node);\n return () => registry.remove(node);\n }, [node, registry]);\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Utils\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * Attempts focusing the first element in a list of candidates.\n * Stops when focus has actually moved.\n */\nfunction focusFirst(candidates: HTMLElement[], { select = false } = {}) {\n const previouslyFocusedElement = document.activeElement;\n for (const candidate of candidates) {\n focus(candidate, { select });\n if (document.activeElement !== previouslyFocusedElement) return;\n }\n}\n\n/**\n * Returns the first and last tabbable elements inside a container.\n */\nfunction getTabbableEdges(container: HTMLElement) {\n const candidates = getTabbableCandidates(container);\n const first = findVisible(candidates, container);\n const last = findVisible(candidates.reverse(), container);\n return [first, last] as const;\n}\n\n/**\n * Returns a list of potential tabbable candidates.\n *\n * NOTE: This is only a close approximation. For example it doesn't take into account cases like when\n * elements are not visible. This cannot be worked out easily by just reading a property, but rather\n * necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker\n * Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1\n */\nfunction getTabbableCandidates(container: HTMLElement) {\n const nodes: HTMLElement[] = [];\n const document = container.ownerDocument;\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node: Element) => {\n const isHiddenInput =\n node.tagName === 'INPUT' && (node as HTMLInputElement).type === 'hidden';\n if ((node as HTMLInputElement).disabled || (node as HTMLElement).hidden || isHiddenInput) {\n return NodeFilter.FILTER_SKIP;\n }\n // `.tabIndex` is not the same as the `tabindex` attribute. It works on the\n // runtime's understanding of tabbability, so this automatically accounts\n // for any kind of element that could be tabbed to.\n return (node as HTMLElement).tabIndex >= 0\n ? NodeFilter.FILTER_ACCEPT\n : NodeFilter.FILTER_SKIP;\n },\n });\n while (walker.nextNode()) {\n nodes.push(walker.currentNode as HTMLElement);\n }\n // we do not take into account the order of nodes with positive `tabIndex` as it\n // hinders accessibility to have tab order different from visual order.\n return nodes;\n}\n\n/**\n * Returns the first visible element in a list.\n * NOTE: Only checks visibility up to the `container`.\n */\nfunction findVisible(elements: HTMLElement[], container: HTMLElement) {\n // `checkVisibility` performs a single native check for `visibility: hidden`\n // and `display: none` across the ancestor chain. This avoids the repeated\n // `getComputedStyle` calls per ancestor that the fallback path requires,\n // which reduces the cost of style resolution triggered by earlier DOM writes\n // (e.g. react-remove-scroll, DismissableLayer setting body styles).\n const canUseCheckVisibility =\n typeof container.checkVisibility === 'function' &&\n container.checkVisibility({ checkVisibilityCSS: true });\n\n for (const element of elements) {\n const hidden = canUseCheckVisibility\n ? !element.checkVisibility({ checkVisibilityCSS: true })\n : isHidden(element, { upTo: container });\n // we stop checking if it's hidden at the `container` level (excluding)\n if (!hidden) {\n return element;\n }\n }\n}\n\nfunction isHidden(node: HTMLElement, { upTo }: { upTo?: HTMLElement | undefined }) {\n if (getComputedStyle(node).visibility === 'hidden') return true;\n while (node) {\n // we stop at `upTo` (excluding it)\n if (upTo !== undefined && node === upTo) return false;\n if (getComputedStyle(node).display === 'none') return true;\n node = node.parentElement as HTMLElement;\n }\n return false;\n}\n\nfunction isSelectableInput(element: FocusableTarget): element is HTMLInputElement {\n return (\n (element as HTMLElement).tagName === 'INPUT' &&\n typeof (element as HTMLInputElement).select === 'function'\n );\n}\n\nfunction focus(element?: FocusableTarget | null, { select = false } = {}) {\n // only focus if that element is focusable\n if (element && element.focus) {\n // Prefer the element's own document over the global one: they can differ for elements in\n // another realm, and the global may no longer exist when this runs from the unmount timer.\n const ownerDocument = (element as Partial).ownerDocument ?? document;\n const previouslyFocusedElement = ownerDocument.activeElement;\n // NOTE: we prevent scrolling on focus, to minimize jarring transitions for users\n element.focus({ preventScroll: true });\n // only select if its not the same element, it supports selection and we need to select\n if (element !== previouslyFocusedElement && isSelectableInput(element) && select)\n element.select();\n }\n}\n\n/* -------------------------------------------------------------------------------------------------\n * FocusScope stack\n * -----------------------------------------------------------------------------------------------*/\n\ntype FocusScopeAPI = { paused: boolean; pause(): void; resume(): void };\nconst focusScopesStack = createFocusScopesStack();\n\nfunction createFocusScopesStack() {\n /** A stack of focus scopes, with the active one at the top */\n let stack: FocusScopeAPI[] = [];\n\n return {\n add(focusScope: FocusScopeAPI) {\n // pause the currently active focus scope (at the top of the stack)\n const activeFocusScope = stack[0];\n if (focusScope !== activeFocusScope) {\n activeFocusScope?.pause();\n }\n // remove in case it already exists (because we'll re-add it at the top of the stack)\n stack = arrayRemove(stack, focusScope);\n stack.unshift(focusScope);\n },\n\n remove(focusScope: FocusScopeAPI) {\n stack = arrayRemove(stack, focusScope);\n stack[0]?.resume();\n },\n };\n}\n\nfunction arrayRemove(array: T[], item: T) {\n const updatedArray = [...array];\n const index = updatedArray.indexOf(item);\n if (index !== -1) {\n updatedArray.splice(index, 1);\n }\n return updatedArray;\n}\n\nfunction removeLinks(items: HTMLElement[]) {\n return items.filter((item) => item.tagName !== 'A');\n}\n\nexport {\n FocusScope,\n FocusScopeBranchProvider,\n useFocusScopeBranchRegistry,\n useFocusScopeBranch,\n //\n FocusScope as Root,\n};\nexport type { FocusScopeProps, FocusScopeBranchProviderProps, FocusScopeBranchRegistry };\n"], + "mappings": ";;;;;AAAA,YAAY,WAAW;AACvB,SAAS,uBAAuB;AAChC,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AA2OzB;AAzON,IAAM,qBAAqB;AAC3B,IAAM,uBAAuB;AAC7B,IAAM,gBAAgB,EAAE,SAAS,OAAO,YAAY,KAAK;AAgDzD,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container", "document"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-focus-scope/package.json b/e-commerce/node_modules/@radix-ui/react-focus-scope/package.json new file mode 100644 index 0000000000000000000000000000000000000000..5987992773ef58bb0708fa3d03734f0ab4dd2c3a --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-focus-scope/package.json @@ -0,0 +1,71 @@ +{ + "name": "@radix-ui/react-focus-scope", + "version": "1.3.0", + "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.5", + "@radix-ui/react-primitive": "2.2.0", + "@radix-ui/react-use-callback-ref": "1.1.5" + }, + "devDependencies": { + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "react": "^19.3.0", + "react-dom": "^19.3.0", + "typescript": "^5.9.3", + "@repo/builder": "0.0.0", + "@repo/test-utils": "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", + "directory": "packages/react/focus-scope" + }, + "bugs": { + "url": "https://github.com/radix-ui/primitives/issues" + }, + "scripts": { + "lint": "oxlint --max-warnings 0 src", + "clean": "rm -rf dist", + "reset": "rm -rf dist node_modules", + "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" + } + } + } +} \ No newline at end of file diff --git a/e-commerce/node_modules/@radix-ui/react-id/LICENSE b/e-commerce/node_modules/@radix-ui/react-id/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a18858fb7b014098cba85703e66609be66a26ef5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-id/LICENSE @@ -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. diff --git a/e-commerce/node_modules/@radix-ui/react-id/README.md b/e-commerce/node_modules/@radix-ui/react-id/README.md new file mode 100644 index 0000000000000000000000000000000000000000..b4b5cfbd4cfd2a1b93ee7ee12064176b200ead30 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-id/README.md @@ -0,0 +1,3 @@ +# `react-id` + +View docs [here](https://radix-ui.com/primitives/docs/utilities/id-provider). diff --git a/e-commerce/node_modules/@radix-ui/react-id/dist/index.d.mts b/e-commerce/node_modules/@radix-ui/react-id/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..411b3336d2b8894d6fc67a27b47f5488f7bacd13 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-id/dist/index.d.mts @@ -0,0 +1,3 @@ +declare function useId(deterministicId?: string): string; + +export { useId }; diff --git a/e-commerce/node_modules/@radix-ui/react-id/dist/index.d.ts b/e-commerce/node_modules/@radix-ui/react-id/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..411b3336d2b8894d6fc67a27b47f5488f7bacd13 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-id/dist/index.d.ts @@ -0,0 +1,3 @@ +declare function useId(deterministicId?: string): string; + +export { useId }; diff --git a/e-commerce/node_modules/@radix-ui/react-id/dist/index.js b/e-commerce/node_modules/@radix-ui/react-id/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..1d0fa06ec47eb5b7369cb23faa27f983cdd778bb --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-id/dist/index.js @@ -0,0 +1,51 @@ +"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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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, { + useId: () => useId +}); +module.exports = __toCommonJS(index_exports); + +// src/id.tsx +var React = __toESM(require("react")); +var import_react_use_layout_effect = require("@radix-ui/react-use-layout-effect"); +var useReactId = React[" useId ".trim().toString()] || (() => void 0); +var count = 0; +function useId(deterministicId) { + const [id, setId] = React.useState(useReactId()); + (0, import_react_use_layout_effect.useLayoutEffect)(() => { + if (!deterministicId) setId((reactId) => reactId ?? String(count++)); + }, [deterministicId]); + return deterministicId || (id ? `radix-${id}` : ""); +} +__name(useId, "useId"); +//# sourceMappingURL=index.js.map diff --git a/e-commerce/node_modules/@radix-ui/react-id/dist/index.js.map b/e-commerce/node_modules/@radix-ui/react-id/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..079b28350739bb6a0f43d99fe3d8786854099b73 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-id/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts", "../src/id.tsx"], + "sourcesContent": ["export { useId } from './id';\n", "import * as React from 'react';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\n\n// We spaces with `.trim().toString()` to prevent bundlers from trying to `import { useId } from 'react';`\nconst useReactId = (React as any)[' useId '.trim().toString()] || (() => undefined);\nlet count = 0;\n\nfunction useId(deterministicId?: string): string {\n const [id, setId] = React.useState(useReactId());\n // React versions older than 18 will have client-side ids only.\n useLayoutEffect(() => {\n if (!deterministicId) setId((reactId) => reactId ?? String(count++));\n }, [deterministicId]);\n return deterministicId || (id ? `radix-${id}` : '');\n}\n\nexport { useId };\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,qCAAgC;AAGhC,IAAM,aAAc,MAAc,UAAU,KAAK,EAAE,SAAS,CAAC,MAAM,MAAM;AACzE,IAAI,QAAQ;AAEZ,SAAS,MAAM,iBAAkC;AAC/C,QAAM,CAAC,IAAI,KAAK,IAAU,eAA6B,WAAW,CAAC;AAEnE,sDAAgB,MAAM;AACpB,QAAI,CAAC,gBAAiB,OAAM,CAAC,YAAY,WAAW,OAAO,OAAO,CAAC;AAAA,EACrE,GAAG,CAAC,eAAe,CAAC;AACpB,SAAO,oBAAoB,KAAK,SAAS,EAAE,KAAK;AAClD;AAPS;", + "names": [] +} diff --git a/e-commerce/node_modules/@radix-ui/react-id/dist/index.mjs b/e-commerce/node_modules/@radix-ui/react-id/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..64422fc96d085f5961d830a957eb298a22f6d83f --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-id/dist/index.mjs @@ -0,0 +1,20 @@ +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// src/id.tsx +import * as React from "react"; +import { useLayoutEffect } from "@radix-ui/react-use-layout-effect"; +var useReactId = React[" useId ".trim().toString()] || (() => void 0); +var count = 0; +function useId(deterministicId) { + const [id, setId] = React.useState(useReactId()); + useLayoutEffect(() => { + if (!deterministicId) setId((reactId) => reactId ?? String(count++)); + }, [deterministicId]); + return deterministicId || (id ? `radix-${id}` : ""); +} +__name(useId, "useId"); +export { + useId +}; +//# sourceMappingURL=index.mjs.map diff --git a/e-commerce/node_modules/@radix-ui/react-id/dist/index.mjs.map b/e-commerce/node_modules/@radix-ui/react-id/dist/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..0f38f378fb3a5282830723414c5256d3c09f7f73 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-id/dist/index.mjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/id.tsx"], + "sourcesContent": ["import * as React from 'react';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\n\n// We spaces with `.trim().toString()` to prevent bundlers from trying to `import { useId } from 'react';`\nconst useReactId = (React as any)[' useId '.trim().toString()] || (() => undefined);\nlet count = 0;\n\nfunction useId(deterministicId?: string): string {\n const [id, setId] = React.useState(useReactId());\n // React versions older than 18 will have client-side ids only.\n useLayoutEffect(() => {\n if (!deterministicId) setId((reactId) => reactId ?? String(count++));\n }, [deterministicId]);\n return deterministicId || (id ? `radix-${id}` : '');\n}\n\nexport { useId };\n"], + "mappings": ";;;;AAAA,YAAY,WAAW;AACvB,SAAS,uBAAuB;AAGhC,IAAM,aAAc,MAAc,UAAU,KAAK,EAAE,SAAS,CAAC,MAAM,MAAM;AACzE,IAAI,QAAQ;AAEZ,SAAS,MAAM,iBAAkC;AAC/C,QAAM,CAAC,IAAI,KAAK,IAAU,eAA6B,WAAW,CAAC;AAEnE,kBAAgB,MAAM;AACpB,QAAI,CAAC,gBAAiB,OAAM,CAAC,YAAY,WAAW,OAAO,OAAO,CAAC;AAAA,EACrE,GAAG,CAAC,eAAe,CAAC;AACpB,SAAO,oBAAoB,KAAK,SAAS,EAAE,KAAK;AAClD;AAPS;", + "names": [] +} diff --git a/e-commerce/node_modules/@radix-ui/react-id/package.json b/e-commerce/node_modules/@radix-ui/react-id/package.json new file mode 100644 index 0000000000000000000000000000000000000000..de46da2928f32eab8b5839706100b1c857303544 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-id/package.json @@ -0,0 +1,63 @@ +{ + "name": "@radix-ui/react-id", + "version": "1.1.4", + "license": "MIT", + "source": "./src/index.ts", + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "files": [ + "dist", + "README.md" + ], + "sideEffects": false, + "devDependencies": { + "@types/react": "^19.2.2", + "@types/react-dom": "^19.2.2", + "react": "^19.2.0", + "react-dom": "^19.2.0", + "typescript": "^5.9.3", + "@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", + "directory": "packages/react/id" + }, + "bugs": { + "url": "https://github.com/radix-ui/primitives/issues" + }, + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.4" + }, + "scripts": { + "lint": "oxlint --max-warnings 0 src", + "clean": "rm -rf dist", + "reset": "rm -rf dist node_modules", + "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" + } + } + } +} \ No newline at end of file diff --git a/e-commerce/node_modules/@radix-ui/react-label/LICENSE b/e-commerce/node_modules/@radix-ui/react-label/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a18858fb7b014098cba85703e66609be66a26ef5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-label/LICENSE @@ -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. diff --git a/e-commerce/node_modules/@radix-ui/react-label/README.md b/e-commerce/node_modules/@radix-ui/react-label/README.md new file mode 100644 index 0000000000000000000000000000000000000000..939fd9151edd673c3ff5f3beb40f68576e3e38a4 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-label/README.md @@ -0,0 +1,3 @@ +# `react-label` + +View docs [here](https://radix-ui.com/primitives/docs/utilities/label). diff --git a/e-commerce/node_modules/@radix-ui/react-label/dist/index.d.mts b/e-commerce/node_modules/@radix-ui/react-label/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..40003ebc69c15e948cd89cc91cc7f2ef3205e7d6 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-label/dist/index.d.mts @@ -0,0 +1,9 @@ +import * as React from 'react'; +import { Primitive } from '@radix-ui/react-primitive'; + +type PrimitiveLabelProps = React.ComponentPropsWithoutRef; +interface LabelProps extends PrimitiveLabelProps { +} +declare const Label: React.ForwardRefExoticComponent>; + +export { Label, type LabelProps, Label as Root }; diff --git a/e-commerce/node_modules/@radix-ui/react-label/dist/index.d.ts b/e-commerce/node_modules/@radix-ui/react-label/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..40003ebc69c15e948cd89cc91cc7f2ef3205e7d6 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-label/dist/index.d.ts @@ -0,0 +1,9 @@ +import * as React from 'react'; +import { Primitive } from '@radix-ui/react-primitive'; + +type PrimitiveLabelProps = React.ComponentPropsWithoutRef; +interface LabelProps extends PrimitiveLabelProps { +} +declare const Label: React.ForwardRefExoticComponent>; + +export { Label, type LabelProps, Label as Root }; diff --git a/e-commerce/node_modules/@radix-ui/react-label/dist/index.js b/e-commerce/node_modules/@radix-ui/react-label/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ba55ad5018b8b1e1e807ba3b66a67f0ec676fcbe --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-label/dist/index.js @@ -0,0 +1,61 @@ +"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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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, { + Label: () => Label, + Root: () => Label +}); +module.exports = __toCommonJS(index_exports); + +// src/label.tsx +var React = __toESM(require("react")); +var import_react_primitive = require("@radix-ui/react-primitive"); +var import_jsx_runtime = require("react/jsx-runtime"); +var Label = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function Label2(props, forwardedRef) { + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.label, + { + ...props, + ref: forwardedRef, + onMouseDown: (event) => { + const target = event.target; + if (target.closest("button, input, select, textarea")) return; + props.onMouseDown?.(event); + if (!event.defaultPrevented && event.detail > 1) event.preventDefault(); + } + } + ); + }, "Label") +); +//# sourceMappingURL=index.js.map diff --git a/e-commerce/node_modules/@radix-ui/react-label/dist/index.js.map b/e-commerce/node_modules/@radix-ui/react-label/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..66f227284b06ccc020be601e4dee0ce36a4de5b1 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-label/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts", "../src/label.tsx"], + "sourcesContent": ["'use client';\nexport {\n Label,\n //\n Root,\n} from './label';\nexport type { LabelProps } from './label';\n", "import * as React from 'react';\nimport { Primitive } from '@radix-ui/react-primitive';\n\n/* -------------------------------------------------------------------------------------------------\n * Label\n * -----------------------------------------------------------------------------------------------*/\n\ntype LabelElement = React.ComponentRef;\ntype PrimitiveLabelProps = React.ComponentPropsWithoutRef;\ninterface LabelProps extends PrimitiveLabelProps {}\n\nconst Label = /* @__PURE__ */ React.forwardRef(\n function Label(props, forwardedRef) {\n return (\n {\n // only prevent text selection if clicking inside the label itself\n const target = event.target as HTMLElement;\n if (target.closest('button, input, select, textarea')) return;\n\n props.onMouseDown?.(event);\n // prevent text selection when double clicking label\n if (!event.defaultPrevented && event.detail > 1) event.preventDefault();\n }}\n />\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nexport {\n Label,\n //\n Label as Root,\n};\nexport type { LabelProps };\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,6BAA0B;AAapB;AAHN,IAAM,QAAwB,gBAAM;AAAA,EAClC,gCAASA,OAAM,OAAO,cAAc;AAClC,WACE;AAAA,MAAC,iCAAU;AAAA,MAAV;AAAA,QACE,GAAG;AAAA,QACJ,KAAK;AAAA,QACL,aAAa,CAAC,UAAU;AAEtB,gBAAM,SAAS,MAAM;AACrB,cAAI,OAAO,QAAQ,iCAAiC,EAAG;AAEvD,gBAAM,cAAc,KAAK;AAEzB,cAAI,CAAC,MAAM,oBAAoB,MAAM,SAAS,EAAG,OAAM,eAAe;AAAA,QACxE;AAAA;AAAA,IACF;AAAA,EAEJ,GAhBA;AAiBF;", + "names": ["Label"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-label/dist/index.mjs b/e-commerce/node_modules/@radix-ui/react-label/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..afaece3f4073f8fb367915004dc0508ffa53b6a1 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-label/dist/index.mjs @@ -0,0 +1,30 @@ +"use client"; +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// src/label.tsx +import * as React from "react"; +import { Primitive } from "@radix-ui/react-primitive"; +import { jsx } from "react/jsx-runtime"; +var Label = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function Label2(props, forwardedRef) { + return /* @__PURE__ */ jsx( + Primitive.label, + { + ...props, + ref: forwardedRef, + onMouseDown: (event) => { + const target = event.target; + if (target.closest("button, input, select, textarea")) return; + props.onMouseDown?.(event); + if (!event.defaultPrevented && event.detail > 1) event.preventDefault(); + } + } + ); + }, "Label") +); +export { + Label, + Label as Root +}; +//# sourceMappingURL=index.mjs.map diff --git a/e-commerce/node_modules/@radix-ui/react-label/dist/index.mjs.map b/e-commerce/node_modules/@radix-ui/react-label/dist/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..6616e1d2d3f57adfacd4897d0959912cf6608a2e --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-label/dist/index.mjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/label.tsx"], + "sourcesContent": ["import * as React from 'react';\nimport { Primitive } from '@radix-ui/react-primitive';\n\n/* -------------------------------------------------------------------------------------------------\n * Label\n * -----------------------------------------------------------------------------------------------*/\n\ntype LabelElement = React.ComponentRef;\ntype PrimitiveLabelProps = React.ComponentPropsWithoutRef;\ninterface LabelProps extends PrimitiveLabelProps {}\n\nconst Label = /* @__PURE__ */ React.forwardRef(\n function Label(props, forwardedRef) {\n return (\n {\n // only prevent text selection if clicking inside the label itself\n const target = event.target as HTMLElement;\n if (target.closest('button, input, select, textarea')) return;\n\n props.onMouseDown?.(event);\n // prevent text selection when double clicking label\n if (!event.defaultPrevented && event.detail > 1) event.preventDefault();\n }}\n />\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nexport {\n Label,\n //\n Label as Root,\n};\nexport type { LabelProps };\n"], + "mappings": ";;;;;AAAA,YAAY,WAAW;AACvB,SAAS,iBAAiB;AAapB;AAHN,IAAM,QAAwB,gBAAM;AAAA,EAClC,gCAASA,OAAM,OAAO,cAAc;AAClC,WACE;AAAA,MAAC,UAAU;AAAA,MAAV;AAAA,QACE,GAAG;AAAA,QACJ,KAAK;AAAA,QACL,aAAa,CAAC,UAAU;AAEtB,gBAAM,SAAS,MAAM;AACrB,cAAI,OAAO,QAAQ,iCAAiC,EAAG;AAEvD,gBAAM,cAAc,KAAK;AAEzB,cAAI,CAAC,MAAM,oBAAoB,MAAM,SAAS,EAAG,OAAM,eAAe;AAAA,QACxE;AAAA;AAAA,IACF;AAAA,EAEJ,GAhBA;AAiBF;", + "names": ["Label"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-label/package.json b/e-commerce/node_modules/@radix-ui/react-label/package.json new file mode 100644 index 0000000000000000000000000000000000000000..4931b39311ff006235272228602c32aec38f8afe --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-label/package.json @@ -0,0 +1,68 @@ +{ + "name": "@radix-ui/react-label", + "version": "2.1.17", + "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.2.0" + }, + "devDependencies": { + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "react": "^19.3.0", + "react-dom": "^19.3.0", + "typescript": "^5.9.3", + "@repo/builder": "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", + "directory": "packages/react/label" + }, + "bugs": { + "url": "https://github.com/radix-ui/primitives/issues" + }, + "scripts": { + "lint": "oxlint --max-warnings 0 src", + "clean": "rm -rf dist", + "reset": "rm -rf dist node_modules", + "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" + } + } + } +} \ No newline at end of file diff --git a/e-commerce/node_modules/@radix-ui/react-menu/LICENSE b/e-commerce/node_modules/@radix-ui/react-menu/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a18858fb7b014098cba85703e66609be66a26ef5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-menu/LICENSE @@ -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. diff --git a/e-commerce/node_modules/@radix-ui/react-menu/README.md b/e-commerce/node_modules/@radix-ui/react-menu/README.md new file mode 100644 index 0000000000000000000000000000000000000000..9b13105179be45b0a4402f3bc231fa89836bbeb1 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-menu/README.md @@ -0,0 +1,3 @@ +# `react-menu` + +This is an internal utility, not intended for public usage. diff --git a/e-commerce/node_modules/@radix-ui/react-menu/dist/index.d.mts b/e-commerce/node_modules/@radix-ui/react-menu/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..1f385b4a19143cd9f48de06a3f4069cb8b682afb --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-menu/dist/index.d.mts @@ -0,0 +1,163 @@ +import * as _radix_ui_react_context from '@radix-ui/react-context'; +import * as React from 'react'; +import { DismissableLayer } from '@radix-ui/react-dismissable-layer'; +import { FocusScope } from '@radix-ui/react-focus-scope'; +import * as PopperPrimitive from '@radix-ui/react-popper'; +import { Portal } from '@radix-ui/react-portal'; +import { Primitive } from '@radix-ui/react-primitive'; +import * as RovingFocusGroup from '@radix-ui/react-roving-focus'; + +declare const Direction: { + readonly LTR: "ltr"; + readonly RTL: "rtl"; +}; +type Direction = (typeof Direction)[keyof typeof Direction]; +declare const createMenuScope: _radix_ui_react_context.CreateScope; +interface MenuProps { + children?: React.ReactNode | undefined; + open?: boolean | undefined; + onOpenChange?: ((open: boolean) => void) | undefined; + dir?: Direction | undefined; + modal?: boolean | undefined; +} +declare const Menu: React.FC; +type PopperAnchorProps = React.ComponentPropsWithoutRef; +interface MenuAnchorProps extends PopperAnchorProps { +} +declare const MenuAnchor: React.ForwardRefExoticComponent>; +type PortalProps = React.ComponentPropsWithoutRef; +interface MenuPortalProps { + children?: React.ReactNode | undefined; + /** + * Specify a container element to portal the content into. + */ + container?: PortalProps['container'] | undefined; + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const MenuPortal: React.FC; +/** + * We purposefully don't union MenuRootContent and MenuSubContent props here because + * they have conflicting prop types. We agreed that we would allow MenuSubContent to + * accept props that it would just ignore. + */ +interface MenuContentProps extends MenuRootContentTypeProps { + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const MenuContent: React.ForwardRefExoticComponent>; +interface MenuRootContentTypeProps extends Omit { +} +type FocusScopeProps = React.ComponentPropsWithoutRef; +type DismissableLayerProps = React.ComponentPropsWithoutRef; +type RovingFocusGroupProps = React.ComponentPropsWithoutRef; +type PopperContentProps = React.ComponentPropsWithoutRef; +type MenuContentImplPrivateProps = { + onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'] | undefined; + onDismiss?: DismissableLayerProps['onDismiss'] | undefined; + disableOutsidePointerEvents?: DismissableLayerProps['disableOutsidePointerEvents'] | undefined; + /** + * Whether scrolling outside the `MenuContent` should be prevented + * (default: `false`) + */ + disableOutsideScroll?: boolean | undefined; + /** + * Whether focus should be trapped within the `MenuContent` + * (default: false) + */ + trapFocus?: FocusScopeProps['trapped'] | undefined; +}; +interface MenuContentImplProps extends MenuContentImplPrivateProps, Omit { + /** + * Event handler called when auto-focusing on close. + * Can be prevented. + */ + onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'] | undefined; + /** + * Whether keyboard navigation should loop around + * @defaultValue false + */ + loop?: RovingFocusGroupProps['loop'] | undefined; + onEntryFocus?: RovingFocusGroupProps['onEntryFocus'] | undefined; + onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'] | undefined; + onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'] | undefined; + onFocusOutside?: DismissableLayerProps['onFocusOutside'] | undefined; + onInteractOutside?: DismissableLayerProps['onInteractOutside'] | undefined; +} +type PrimitiveDivProps = React.ComponentPropsWithoutRef; +interface MenuGroupProps extends PrimitiveDivProps { +} +declare const MenuGroup: React.ForwardRefExoticComponent>; +interface MenuLabelProps extends PrimitiveDivProps { +} +declare const MenuLabel: React.ForwardRefExoticComponent>; +interface MenuItemProps extends Omit { + onSelect?: ((event: Event) => void) | undefined; +} +declare const MenuItem: React.ForwardRefExoticComponent>; +interface MenuItemImplProps extends PrimitiveDivProps { + disabled?: boolean | undefined; + textValue?: string | undefined; +} +type CheckedState = boolean | 'indeterminate'; +interface MenuCheckboxItemProps extends MenuItemProps { + checked?: CheckedState | undefined; + onCheckedChange?: ((checked: boolean) => void) | undefined; +} +declare const MenuCheckboxItem: React.ForwardRefExoticComponent>; +interface MenuRadioGroupProps extends MenuGroupProps { + value?: string | undefined; + onValueChange?: ((value: string) => void) | undefined; +} +declare const MenuRadioGroup: React.ForwardRefExoticComponent>; +interface MenuRadioItemProps extends MenuItemProps { + value: string; +} +declare const MenuRadioItem: React.ForwardRefExoticComponent>; +type PrimitiveSpanProps = React.ComponentPropsWithoutRef; +interface MenuItemIndicatorProps extends PrimitiveSpanProps { + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const MenuItemIndicator: React.ForwardRefExoticComponent>; +interface MenuSeparatorProps extends PrimitiveDivProps { +} +declare const MenuSeparator: React.ForwardRefExoticComponent>; +type PopperArrowProps = React.ComponentPropsWithoutRef; +interface MenuArrowProps extends PopperArrowProps { +} +declare const MenuArrow: React.ForwardRefExoticComponent>; +interface MenuSubProps { + children?: React.ReactNode | undefined; + open?: boolean | undefined; + onOpenChange?: ((open: boolean) => void) | undefined; +} +declare const MenuSub: React.FC; +interface MenuSubTriggerProps extends MenuItemImplProps { +} +declare const MenuSubTrigger: React.ForwardRefExoticComponent>; +type AlignSubContent = Exclude<(typeof PopperPrimitive.ALIGN_OPTIONS)[number], 'center'>; +interface MenuSubContentProps extends Omit { + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; + /** + * Controls the direction the subcontent appears from its anchor menu item + * Default: start + */ + align?: AlignSubContent | undefined; +} +declare const MenuSubContent: React.ForwardRefExoticComponent>; + +export { MenuAnchor as Anchor, MenuArrow as Arrow, MenuCheckboxItem as CheckboxItem, MenuContent as Content, MenuGroup as Group, MenuItem as Item, MenuItemIndicator as ItemIndicator, MenuLabel as Label, Menu, MenuAnchor, type MenuAnchorProps, MenuArrow, type MenuArrowProps, MenuCheckboxItem, type MenuCheckboxItemProps, MenuContent, type MenuContentProps, MenuGroup, type MenuGroupProps, MenuItem, MenuItemIndicator, type MenuItemIndicatorProps, type MenuItemProps, MenuLabel, type MenuLabelProps, MenuPortal, type MenuPortalProps, type MenuProps, MenuRadioGroup, type MenuRadioGroupProps, MenuRadioItem, type MenuRadioItemProps, MenuSeparator, type MenuSeparatorProps, MenuSub, MenuSubContent, type MenuSubContentProps, type MenuSubProps, MenuSubTrigger, type MenuSubTriggerProps, MenuPortal as Portal, MenuRadioGroup as RadioGroup, MenuRadioItem as RadioItem, Menu as Root, MenuSeparator as Separator, MenuSub as Sub, MenuSubContent as SubContent, MenuSubTrigger as SubTrigger, createMenuScope }; diff --git a/e-commerce/node_modules/@radix-ui/react-menu/dist/index.d.ts b/e-commerce/node_modules/@radix-ui/react-menu/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1f385b4a19143cd9f48de06a3f4069cb8b682afb --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-menu/dist/index.d.ts @@ -0,0 +1,163 @@ +import * as _radix_ui_react_context from '@radix-ui/react-context'; +import * as React from 'react'; +import { DismissableLayer } from '@radix-ui/react-dismissable-layer'; +import { FocusScope } from '@radix-ui/react-focus-scope'; +import * as PopperPrimitive from '@radix-ui/react-popper'; +import { Portal } from '@radix-ui/react-portal'; +import { Primitive } from '@radix-ui/react-primitive'; +import * as RovingFocusGroup from '@radix-ui/react-roving-focus'; + +declare const Direction: { + readonly LTR: "ltr"; + readonly RTL: "rtl"; +}; +type Direction = (typeof Direction)[keyof typeof Direction]; +declare const createMenuScope: _radix_ui_react_context.CreateScope; +interface MenuProps { + children?: React.ReactNode | undefined; + open?: boolean | undefined; + onOpenChange?: ((open: boolean) => void) | undefined; + dir?: Direction | undefined; + modal?: boolean | undefined; +} +declare const Menu: React.FC; +type PopperAnchorProps = React.ComponentPropsWithoutRef; +interface MenuAnchorProps extends PopperAnchorProps { +} +declare const MenuAnchor: React.ForwardRefExoticComponent>; +type PortalProps = React.ComponentPropsWithoutRef; +interface MenuPortalProps { + children?: React.ReactNode | undefined; + /** + * Specify a container element to portal the content into. + */ + container?: PortalProps['container'] | undefined; + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const MenuPortal: React.FC; +/** + * We purposefully don't union MenuRootContent and MenuSubContent props here because + * they have conflicting prop types. We agreed that we would allow MenuSubContent to + * accept props that it would just ignore. + */ +interface MenuContentProps extends MenuRootContentTypeProps { + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const MenuContent: React.ForwardRefExoticComponent>; +interface MenuRootContentTypeProps extends Omit { +} +type FocusScopeProps = React.ComponentPropsWithoutRef; +type DismissableLayerProps = React.ComponentPropsWithoutRef; +type RovingFocusGroupProps = React.ComponentPropsWithoutRef; +type PopperContentProps = React.ComponentPropsWithoutRef; +type MenuContentImplPrivateProps = { + onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'] | undefined; + onDismiss?: DismissableLayerProps['onDismiss'] | undefined; + disableOutsidePointerEvents?: DismissableLayerProps['disableOutsidePointerEvents'] | undefined; + /** + * Whether scrolling outside the `MenuContent` should be prevented + * (default: `false`) + */ + disableOutsideScroll?: boolean | undefined; + /** + * Whether focus should be trapped within the `MenuContent` + * (default: false) + */ + trapFocus?: FocusScopeProps['trapped'] | undefined; +}; +interface MenuContentImplProps extends MenuContentImplPrivateProps, Omit { + /** + * Event handler called when auto-focusing on close. + * Can be prevented. + */ + onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'] | undefined; + /** + * Whether keyboard navigation should loop around + * @defaultValue false + */ + loop?: RovingFocusGroupProps['loop'] | undefined; + onEntryFocus?: RovingFocusGroupProps['onEntryFocus'] | undefined; + onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'] | undefined; + onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'] | undefined; + onFocusOutside?: DismissableLayerProps['onFocusOutside'] | undefined; + onInteractOutside?: DismissableLayerProps['onInteractOutside'] | undefined; +} +type PrimitiveDivProps = React.ComponentPropsWithoutRef; +interface MenuGroupProps extends PrimitiveDivProps { +} +declare const MenuGroup: React.ForwardRefExoticComponent>; +interface MenuLabelProps extends PrimitiveDivProps { +} +declare const MenuLabel: React.ForwardRefExoticComponent>; +interface MenuItemProps extends Omit { + onSelect?: ((event: Event) => void) | undefined; +} +declare const MenuItem: React.ForwardRefExoticComponent>; +interface MenuItemImplProps extends PrimitiveDivProps { + disabled?: boolean | undefined; + textValue?: string | undefined; +} +type CheckedState = boolean | 'indeterminate'; +interface MenuCheckboxItemProps extends MenuItemProps { + checked?: CheckedState | undefined; + onCheckedChange?: ((checked: boolean) => void) | undefined; +} +declare const MenuCheckboxItem: React.ForwardRefExoticComponent>; +interface MenuRadioGroupProps extends MenuGroupProps { + value?: string | undefined; + onValueChange?: ((value: string) => void) | undefined; +} +declare const MenuRadioGroup: React.ForwardRefExoticComponent>; +interface MenuRadioItemProps extends MenuItemProps { + value: string; +} +declare const MenuRadioItem: React.ForwardRefExoticComponent>; +type PrimitiveSpanProps = React.ComponentPropsWithoutRef; +interface MenuItemIndicatorProps extends PrimitiveSpanProps { + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const MenuItemIndicator: React.ForwardRefExoticComponent>; +interface MenuSeparatorProps extends PrimitiveDivProps { +} +declare const MenuSeparator: React.ForwardRefExoticComponent>; +type PopperArrowProps = React.ComponentPropsWithoutRef; +interface MenuArrowProps extends PopperArrowProps { +} +declare const MenuArrow: React.ForwardRefExoticComponent>; +interface MenuSubProps { + children?: React.ReactNode | undefined; + open?: boolean | undefined; + onOpenChange?: ((open: boolean) => void) | undefined; +} +declare const MenuSub: React.FC; +interface MenuSubTriggerProps extends MenuItemImplProps { +} +declare const MenuSubTrigger: React.ForwardRefExoticComponent>; +type AlignSubContent = Exclude<(typeof PopperPrimitive.ALIGN_OPTIONS)[number], 'center'>; +interface MenuSubContentProps extends Omit { + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; + /** + * Controls the direction the subcontent appears from its anchor menu item + * Default: start + */ + align?: AlignSubContent | undefined; +} +declare const MenuSubContent: React.ForwardRefExoticComponent>; + +export { MenuAnchor as Anchor, MenuArrow as Arrow, MenuCheckboxItem as CheckboxItem, MenuContent as Content, MenuGroup as Group, MenuItem as Item, MenuItemIndicator as ItemIndicator, MenuLabel as Label, Menu, MenuAnchor, type MenuAnchorProps, MenuArrow, type MenuArrowProps, MenuCheckboxItem, type MenuCheckboxItemProps, MenuContent, type MenuContentProps, MenuGroup, type MenuGroupProps, MenuItem, MenuItemIndicator, type MenuItemIndicatorProps, type MenuItemProps, MenuLabel, type MenuLabelProps, MenuPortal, type MenuPortalProps, type MenuProps, MenuRadioGroup, type MenuRadioGroupProps, MenuRadioItem, type MenuRadioItemProps, MenuSeparator, type MenuSeparatorProps, MenuSub, MenuSubContent, type MenuSubContentProps, type MenuSubProps, MenuSubTrigger, type MenuSubTriggerProps, MenuPortal as Portal, MenuRadioGroup as RadioGroup, MenuRadioItem as RadioItem, Menu as Root, MenuSeparator as Separator, MenuSub as Sub, MenuSubContent as SubContent, MenuSubTrigger as SubTrigger, createMenuScope }; diff --git a/e-commerce/node_modules/@radix-ui/react-menu/dist/index.js b/e-commerce/node_modules/@radix-ui/react-menu/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..16093978940f31b3c2e0947caf971b764f0ca454 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-menu/dist/index.js @@ -0,0 +1,924 @@ +"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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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, { + Anchor: () => MenuAnchor, + Arrow: () => MenuArrow, + CheckboxItem: () => MenuCheckboxItem, + Content: () => MenuContent, + Group: () => MenuGroup, + Item: () => MenuItem, + ItemIndicator: () => MenuItemIndicator, + Label: () => MenuLabel, + Menu: () => Menu, + MenuAnchor: () => MenuAnchor, + MenuArrow: () => MenuArrow, + MenuCheckboxItem: () => MenuCheckboxItem, + MenuContent: () => MenuContent, + MenuGroup: () => MenuGroup, + MenuItem: () => MenuItem, + MenuItemIndicator: () => MenuItemIndicator, + MenuLabel: () => MenuLabel, + MenuPortal: () => MenuPortal, + MenuRadioGroup: () => MenuRadioGroup, + MenuRadioItem: () => MenuRadioItem, + MenuSeparator: () => MenuSeparator, + MenuSub: () => MenuSub, + MenuSubContent: () => MenuSubContent, + MenuSubTrigger: () => MenuSubTrigger, + Portal: () => MenuPortal, + RadioGroup: () => MenuRadioGroup, + RadioItem: () => MenuRadioItem, + Root: () => Menu, + Separator: () => MenuSeparator, + Sub: () => MenuSub, + SubContent: () => MenuSubContent, + SubTrigger: () => MenuSubTrigger, + createMenuScope: () => createMenuScope +}); +module.exports = __toCommonJS(index_exports); + +// src/menu.tsx +var React = __toESM(require("react")); +var import_primitive = require("@radix-ui/primitive"); +var import_react_collection = require("@radix-ui/react-collection"); +var import_react_compose_refs = require("@radix-ui/react-compose-refs"); +var import_react_context = require("@radix-ui/react-context"); +var import_react_direction = require("@radix-ui/react-direction"); +var import_react_dismissable_layer = require("@radix-ui/react-dismissable-layer"); +var import_react_focus_guards = require("@radix-ui/react-focus-guards"); +var import_react_focus_scope = require("@radix-ui/react-focus-scope"); +var import_react_id = require("@radix-ui/react-id"); +var PopperPrimitive = __toESM(require("@radix-ui/react-popper")); +var import_react_popper = require("@radix-ui/react-popper"); +var import_react_portal = require("@radix-ui/react-portal"); +var import_react_presence = require("@radix-ui/react-presence"); +var import_react_primitive = require("@radix-ui/react-primitive"); +var RovingFocusGroup = __toESM(require("@radix-ui/react-roving-focus")); +var import_react_roving_focus = require("@radix-ui/react-roving-focus"); +var import_react_slot = require("@radix-ui/react-slot"); +var import_react_use_callback_ref = require("@radix-ui/react-use-callback-ref"); +var import_aria_hidden = require("aria-hidden"); +var import_react_remove_scroll = require("react-remove-scroll"); +var import_jsx_runtime = require("react/jsx-runtime"); +var Direction = { + LTR: "ltr", + RTL: "rtl" +}; +var SELECTION_KEYS = ["Enter", " "]; +var FIRST_KEYS = ["ArrowDown", "PageUp", "Home"]; +var LAST_KEYS = ["ArrowUp", "PageDown", "End"]; +var FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS]; +var SUB_OPEN_KEYS = { + ltr: [...SELECTION_KEYS, "ArrowRight"], + rtl: [...SELECTION_KEYS, "ArrowLeft"] +}; +var SUB_CLOSE_KEYS = { + ltr: ["ArrowLeft"], + rtl: ["ArrowRight"] +}; +var MENU_NAME = "Menu"; +var [Collection, useCollection, createCollectionScope] = (0, import_react_collection.createCollection)(MENU_NAME); +var [createMenuContext, createMenuScope] = (0, import_react_context.createContextScope)(MENU_NAME, [ + createCollectionScope, + import_react_popper.createPopperScope, + import_react_roving_focus.createRovingFocusGroupScope +]); +var usePopperScope = (0, import_react_popper.createPopperScope)(); +var useRovingFocusGroupScope = (0, import_react_roving_focus.createRovingFocusGroupScope)(); +var [MenuProvider, useMenuContext] = createMenuContext(MENU_NAME); +var [MenuRootProvider, useMenuRootContext] = createMenuContext(MENU_NAME); +var Menu = /* @__PURE__ */ __name((props) => { + const { __scopeMenu, open = false, children, dir, onOpenChange, modal = true } = props; + const popperScope = usePopperScope(__scopeMenu); + const [content, setContent] = React.useState(null); + const isUsingKeyboardRef = React.useRef(false); + const handleOpenChange = (0, import_react_use_callback_ref.useCallbackRef)(onOpenChange); + const direction = (0, import_react_direction.useDirection)(dir); + React.useEffect(() => { + const handleKeyDown = /* @__PURE__ */ __name(() => { + isUsingKeyboardRef.current = true; + document.addEventListener("pointerdown", handlePointer, { capture: true, once: true }); + document.addEventListener("pointermove", handlePointer, { capture: true, once: true }); + }, "handleKeyDown"); + const handlePointer = /* @__PURE__ */ __name(() => isUsingKeyboardRef.current = false, "handlePointer"); + document.addEventListener("keydown", handleKeyDown, { capture: true }); + return () => { + document.removeEventListener("keydown", handleKeyDown, { capture: true }); + document.removeEventListener("pointerdown", handlePointer, { capture: true }); + document.removeEventListener("pointermove", handlePointer, { capture: true }); + }; + }, []); + React.useEffect(() => { + if (!open) { + return; + } + const handleBlur = /* @__PURE__ */ __name(() => handleOpenChange(false), "handleBlur"); + window.addEventListener("blur", handleBlur); + return () => window.removeEventListener("blur", handleBlur); + }, [open, handleOpenChange]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperPrimitive.Root, { ...popperScope, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + MenuProvider, + { + scope: __scopeMenu, + open, + onOpenChange: handleOpenChange, + content, + onContentChange: setContent, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + MenuRootProvider, + { + scope: __scopeMenu, + onClose: React.useCallback(() => handleOpenChange(false), [handleOpenChange]), + isUsingKeyboardRef, + dir: direction, + modal, + children + } + ) + } + ) }); +}, "Menu"); +var MenuAnchor = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuAnchor2(props, forwardedRef) { + const { __scopeMenu, ...anchorProps } = props; + const popperScope = usePopperScope(__scopeMenu); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperPrimitive.Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef }); + }, "MenuAnchor") +); +var PORTAL_NAME = "MenuPortal"; +var [PortalProvider, usePortalContext] = createMenuContext(PORTAL_NAME, { + forceMount: void 0 +}); +var MenuPortal = /* @__PURE__ */ __name((props) => { + const { __scopeMenu, forceMount, children, container } = props; + const context = useMenuContext(PORTAL_NAME, __scopeMenu); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PortalProvider, { scope: __scopeMenu, forceMount, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || context.open, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_portal.Portal, { asChild: true, container, children }) }) }); +}, "MenuPortal"); +var CONTENT_NAME = "MenuContent"; +var [MenuContentProvider, useMenuContentContext] = createMenuContext(CONTENT_NAME); +var MenuContent = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuContent2(props, forwardedRef) { + const portalContext = usePortalContext(CONTENT_NAME, props.__scopeMenu); + const { forceMount = portalContext.forceMount, ...contentProps } = props; + const context = useMenuContext(CONTENT_NAME, props.__scopeMenu); + const rootContext = useMenuRootContext(CONTENT_NAME, props.__scopeMenu); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || context.open, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Slot, { scope: props.__scopeMenu, children: rootContext.modal ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuRootContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuRootContentNonModal, { ...contentProps, ref: forwardedRef }) }) }) }); + }, "MenuContent") +); +var MenuRootContentModal = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function MenuRootContentModal2(props, forwardedRef) { + const context = useMenuContext(CONTENT_NAME, props.__scopeMenu); + const ref = React.useRef(null); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref); + React.useEffect(() => { + const content = ref.current; + if (content) return (0, import_aria_hidden.hideOthers)(content); + }, []); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + MenuContentImpl, + { + ...props, + ref: composedRefs, + trapFocus: context.open, + disableOutsidePointerEvents: context.open, + disableOutsideScroll: true, + onFocusOutside: (0, import_primitive.composeEventHandlers)( + props.onFocusOutside, + (event) => event.preventDefault(), + { checkForDefaultPrevented: false } + ), + onDismiss: () => context.onOpenChange(false) + } + ); + }, "MenuRootContentModal") +); +var MenuRootContentNonModal = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function MenuRootContentNonModal2(props, forwardedRef) { + const context = useMenuContext(CONTENT_NAME, props.__scopeMenu); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + MenuContentImpl, + { + ...props, + ref: forwardedRef, + trapFocus: false, + disableOutsidePointerEvents: false, + disableOutsideScroll: false, + onDismiss: () => context.onOpenChange(false) + } + ); +}, "MenuRootContentNonModal")); +var Slot = (0, import_react_slot.createSlot)("MenuContent.ScrollLock"); +var MenuContentImpl = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function MenuContentImpl2(props, forwardedRef) { + const { + __scopeMenu, + loop = false, + trapFocus, + onOpenAutoFocus, + onCloseAutoFocus, + disableOutsidePointerEvents, + onEntryFocus, + onEscapeKeyDown, + onPointerDownOutside, + onFocusOutside, + onInteractOutside, + onDismiss, + disableOutsideScroll, + ...contentProps + } = props; + const context = useMenuContext(CONTENT_NAME, __scopeMenu); + const rootContext = useMenuRootContext(CONTENT_NAME, __scopeMenu); + const popperScope = usePopperScope(__scopeMenu); + const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu); + const getItems = useCollection(__scopeMenu); + const [currentItemId, setCurrentItemId] = React.useState(null); + const contentRef = React.useRef(null); + const [branchNode, setBranchNode] = React.useState(null); + (0, import_react_focus_scope.useFocusScopeBranch)(branchNode); + const { nodes: branchNodes, registry: branchRegistry } = (0, import_react_focus_scope.useFocusScopeBranchRegistry)(); + const isModal = Boolean(trapFocus || disableOutsideScroll); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)( + forwardedRef, + contentRef, + context.onContentChange, + setBranchNode + ); + const timerRef = React.useRef(0); + const searchRef = React.useRef(""); + const pointerGraceTimerRef = React.useRef(0); + const pointerGraceIntentRef = React.useRef(null); + const pointerDirRef = React.useRef("right"); + const lastPointerXRef = React.useRef(0); + const shards = React.useMemo( + () => disableOutsideScroll ? [contentRef, ...branchNodes.map((node) => ({ current: node }))] : [], + [contentRef, branchNodes, disableOutsideScroll] + ); + const ScrollLockWrapper = disableOutsideScroll ? import_react_remove_scroll.RemoveScroll : React.Fragment; + const scrollLockWrapperProps = disableOutsideScroll ? { + as: Slot, + allowPinchZoom: true, + shards + } : void 0; + const handleTypeaheadSearch = /* @__PURE__ */ __name((key) => { + const search = searchRef.current + key; + const items = getItems().filter((item) => !item.disabled); + const currentItem = document.activeElement; + const currentMatch = items.find((item) => item.ref.current === currentItem)?.textValue; + const values = items.map((item) => item.textValue); + const nextMatch = getNextMatch(values, search, currentMatch); + const newItem = items.find((item) => item.textValue === nextMatch)?.ref.current; + function updateSearch(value) { + searchRef.current = value; + window.clearTimeout(timerRef.current); + if (value !== "") timerRef.current = window.setTimeout(() => updateSearch(""), 1e3); + } + __name(updateSearch, "updateSearch"); + updateSearch(search); + if (newItem) { + setTimeout(() => newItem.focus()); + } + }, "handleTypeaheadSearch"); + React.useEffect(() => { + return () => window.clearTimeout(timerRef.current); + }, []); + (0, import_react_focus_guards.useFocusGuards)(); + const isPointerMovingToSubmenu = React.useCallback((event) => { + const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side; + return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area); + }, []); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + MenuContentProvider, + { + scope: __scopeMenu, + searchRef, + onItemEnter: React.useCallback( + (event) => { + if (isPointerMovingToSubmenu(event)) event.preventDefault(); + }, + [isPointerMovingToSubmenu] + ), + onItemLeave: React.useCallback( + (event) => { + if (isPointerMovingToSubmenu(event)) return; + contentRef.current?.focus(); + setCurrentItemId(null); + }, + [isPointerMovingToSubmenu] + ), + onTriggerLeave: React.useCallback( + (event) => { + if (isPointerMovingToSubmenu(event)) event.preventDefault(); + }, + [isPointerMovingToSubmenu] + ), + pointerGraceTimerRef, + onPointerGraceIntentChange: React.useCallback((intent) => { + pointerGraceIntentRef.current = intent; + }, []), + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_focus_scope.FocusScopeBranchProvider, { registry: isModal ? branchRegistry : null, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollLockWrapper, { ...scrollLockWrapperProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_focus_scope.FocusScope, + { + asChild: true, + trapped: trapFocus, + branches: branchNodes, + onMountAutoFocus: (0, import_primitive.composeEventHandlers)(onOpenAutoFocus, (event) => { + event.preventDefault(); + contentRef.current?.focus({ preventScroll: true }); + }), + onUnmountAutoFocus: onCloseAutoFocus, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_dismissable_layer.DismissableLayer, + { + asChild: true, + disableOutsidePointerEvents, + onEscapeKeyDown, + onPointerDownOutside, + onFocusOutside, + onInteractOutside, + onDismiss, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + RovingFocusGroup.Root, + { + asChild: true, + ...rovingFocusGroupScope, + dir: rootContext.dir, + orientation: "vertical", + loop, + currentTabStopId: currentItemId, + onCurrentTabStopIdChange: setCurrentItemId, + onEntryFocus: (0, import_primitive.composeEventHandlers)(onEntryFocus, (event) => { + if (!rootContext.isUsingKeyboardRef.current) event.preventDefault(); + }), + preventScrollOnEntryFocus: true, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + PopperPrimitive.Content, + { + role: "menu", + "aria-orientation": "vertical", + "data-state": getOpenState(context.open), + "data-radix-menu-content": "", + dir: rootContext.dir, + ...popperScope, + ...contentProps, + ref: composedRefs, + style: { outline: "none", ...contentProps.style }, + onKeyDown: (0, import_primitive.composeEventHandlers)(contentProps.onKeyDown, (event) => { + const target = event.target; + const isKeyDownInside = target.closest("[data-radix-menu-content]") === event.currentTarget; + const isModifierKey = event.ctrlKey || event.altKey || event.metaKey; + const isCharacterKey = event.key.length === 1; + if (isKeyDownInside) { + if (event.key === "Tab") event.preventDefault(); + if (!isModifierKey && isCharacterKey) handleTypeaheadSearch(event.key); + } + const content = contentRef.current; + if (event.target !== content) return; + if (!FIRST_LAST_KEYS.includes(event.key)) return; + event.preventDefault(); + const items = getItems().filter((item) => !item.disabled); + const candidateNodes = items.map((item) => item.ref.current); + if (LAST_KEYS.includes(event.key)) candidateNodes.reverse(); + focusFirst(candidateNodes); + }), + onBlur: (0, import_primitive.composeEventHandlers)(props.onBlur, (event) => { + if (!event.currentTarget.contains(event.target)) { + window.clearTimeout(timerRef.current); + searchRef.current = ""; + } + }), + onPointerMove: (0, import_primitive.composeEventHandlers)( + props.onPointerMove, + whenMouse((event) => { + const target = event.target; + const pointerXHasChanged = lastPointerXRef.current !== event.clientX; + if (event.currentTarget.contains(target) && pointerXHasChanged) { + const newDir = event.clientX > lastPointerXRef.current ? "right" : "left"; + pointerDirRef.current = newDir; + lastPointerXRef.current = event.clientX; + } + }) + ) + } + ) + } + ) + } + ) + } + ) }) }) + } + ); + }, "MenuContentImpl") +); +var MenuGroup = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuGroup2(props, forwardedRef) { + const { __scopeMenu, ...groupProps } = props; + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.div, { role: "group", ...groupProps, ref: forwardedRef }); + }, "MenuGroup") +); +var MenuLabel = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuLabel2(props, forwardedRef) { + const { __scopeMenu, ...labelProps } = props; + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.div, { ...labelProps, ref: forwardedRef }); + }, "MenuLabel") +); +var ITEM_NAME = "MenuItem"; +var ITEM_SELECT = "menu.itemSelect"; +var MenuItem = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function MenuItem2(props, forwardedRef) { + const { disabled = false, onSelect, ...itemProps } = props; + const ref = React.useRef(null); + const rootContext = useMenuRootContext(ITEM_NAME, props.__scopeMenu); + const contentContext = useMenuContentContext(ITEM_NAME, props.__scopeMenu); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref); + const isPointerDownRef = React.useRef(false); + const handleSelect = /* @__PURE__ */ __name(() => { + const menuItem = ref.current; + if (!disabled && menuItem) { + const itemSelectEvent = new CustomEvent(ITEM_SELECT, { bubbles: true, cancelable: true }); + menuItem.addEventListener(ITEM_SELECT, (event) => onSelect?.(event), { once: true }); + (0, import_react_primitive.dispatchDiscreteCustomEvent)(menuItem, itemSelectEvent); + if (itemSelectEvent.defaultPrevented) { + isPointerDownRef.current = false; + } else { + rootContext.onClose(); + } + } + }, "handleSelect"); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + MenuItemImpl, + { + ...itemProps, + ref: composedRefs, + disabled, + onClick: (0, import_primitive.composeEventHandlers)(props.onClick, handleSelect), + onPointerDown: (event) => { + props.onPointerDown?.(event); + isPointerDownRef.current = true; + }, + onPointerUp: (0, import_primitive.composeEventHandlers)(props.onPointerUp, (event) => { + if (!isPointerDownRef.current) event.currentTarget?.click(); + }), + onKeyDown: (0, import_primitive.composeEventHandlers)(props.onKeyDown, (event) => { + if (disabled || event.target !== event.currentTarget) { + return; + } + const isTypingAhead = contentContext.searchRef.current !== ""; + if (isTypingAhead && event.key === " ") { + return; + } + if (SELECTION_KEYS.includes(event.key)) { + event.currentTarget.click(); + event.preventDefault(); + } + }) + } + ); + }, "MenuItem") +); +var MenuItemImpl = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuItemImpl2(props, forwardedRef) { + const { __scopeMenu, disabled = false, textValue, ...itemProps } = props; + const contentContext = useMenuContentContext(ITEM_NAME, __scopeMenu); + const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu); + const ref = React.useRef(null); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref); + const [isFocused, setIsFocused] = React.useState(false); + const [textContent, setTextContent] = React.useState(""); + React.useEffect(() => { + const menuItem = ref.current; + if (menuItem) { + setTextContent((menuItem.textContent ?? "").trim()); + } + }, [itemProps.children]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + Collection.ItemSlot, + { + scope: __scopeMenu, + disabled, + textValue: textValue ?? textContent, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RovingFocusGroup.Item, { asChild: true, ...rovingFocusGroupScope, focusable: !disabled, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.div, + { + role: "menuitem", + "data-highlighted": isFocused ? "" : void 0, + "aria-disabled": disabled || void 0, + "data-disabled": disabled ? "" : void 0, + ...itemProps, + ref: composedRefs, + onPointerMove: (0, import_primitive.composeEventHandlers)( + props.onPointerMove, + whenMouse((event) => { + if (disabled) { + contentContext.onItemLeave(event); + } else { + contentContext.onItemEnter(event); + if (!event.defaultPrevented) { + const item = event.currentTarget; + item.focus({ preventScroll: true }); + } + } + }) + ), + onPointerLeave: (0, import_primitive.composeEventHandlers)( + props.onPointerLeave, + whenMouse((event) => contentContext.onItemLeave(event)) + ), + onFocus: (0, import_primitive.composeEventHandlers)(props.onFocus, () => setIsFocused(true)), + onBlur: (0, import_primitive.composeEventHandlers)(props.onBlur, () => setIsFocused(false)) + } + ) }) + } + ); + }, "MenuItemImpl") +); +var MenuCheckboxItem = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function MenuCheckboxItem2(props, forwardedRef) { + const { checked = false, onCheckedChange, ...checkboxItemProps } = props; + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + MenuItem, + { + role: "menuitemcheckbox", + "aria-checked": isIndeterminate(checked) ? "mixed" : checked, + ...checkboxItemProps, + ref: forwardedRef, + "data-state": getCheckedState(checked), + onSelect: (0, import_primitive.composeEventHandlers)( + checkboxItemProps.onSelect, + () => onCheckedChange?.(isIndeterminate(checked) ? true : !checked), + { checkForDefaultPrevented: false } + ) + } + ) }); + }, "MenuCheckboxItem") +); +var RADIO_GROUP_NAME = "MenuRadioGroup"; +var [RadioGroupProvider, useRadioGroupContext] = createMenuContext( + RADIO_GROUP_NAME, + { value: void 0, onValueChange: /* @__PURE__ */ __name(() => { + }, "onValueChange") } +); +var MenuRadioGroup = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuRadioGroup2(props, forwardedRef) { + const { value, onValueChange, ...groupProps } = props; + const handleValueChange = (0, import_react_use_callback_ref.useCallbackRef)(onValueChange); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupProvider, { scope: props.__scopeMenu, value, onValueChange: handleValueChange, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuGroup, { ...groupProps, ref: forwardedRef }) }); + }, "MenuRadioGroup") +); +var RADIO_ITEM_NAME = "MenuRadioItem"; +var MenuRadioItem = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuRadioItem2(props, forwardedRef) { + const { value, ...radioItemProps } = props; + const context = useRadioGroupContext(RADIO_ITEM_NAME, props.__scopeMenu); + const checked = value === context.value; + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + MenuItem, + { + role: "menuitemradio", + "aria-checked": checked, + ...radioItemProps, + ref: forwardedRef, + "data-state": getCheckedState(checked), + onSelect: (0, import_primitive.composeEventHandlers)( + radioItemProps.onSelect, + () => context.onValueChange?.(value), + { checkForDefaultPrevented: false } + ) + } + ) }); + }, "MenuRadioItem") +); +var ITEM_INDICATOR_NAME = "MenuItemIndicator"; +var [ItemIndicatorProvider, useItemIndicatorContext] = createMenuContext( + ITEM_INDICATOR_NAME, + { checked: false } +); +var MenuItemIndicator = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function MenuItemIndicator2(props, forwardedRef) { + const { __scopeMenu, forceMount, ...itemIndicatorProps } = props; + const indicatorContext = useItemIndicatorContext(ITEM_INDICATOR_NAME, __scopeMenu); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_presence.Presence, + { + present: forceMount || isIndeterminate(indicatorContext.checked) || indicatorContext.checked === true, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.span, + { + ...itemIndicatorProps, + ref: forwardedRef, + "data-state": getCheckedState(indicatorContext.checked) + } + ) + } + ); + }, "MenuItemIndicator") +); +var MenuSeparator = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuSeparator2(props, forwardedRef) { + const { __scopeMenu, ...separatorProps } = props; + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.div, + { + role: "separator", + "aria-orientation": "horizontal", + ...separatorProps, + ref: forwardedRef + } + ); + }, "MenuSeparator") +); +var MenuArrow = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuArrow2(props, forwardedRef) { + const { __scopeMenu, ...arrowProps } = props; + const popperScope = usePopperScope(__scopeMenu); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperPrimitive.Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef }); + }, "MenuArrow") +); +var SUB_NAME = "MenuSub"; +var [MenuSubProvider, useMenuSubContext] = createMenuContext(SUB_NAME); +var MenuSub = /* @__PURE__ */ __name((props) => { + const { __scopeMenu, children, open = false, onOpenChange } = props; + const parentMenuContext = useMenuContext(SUB_NAME, __scopeMenu); + const popperScope = usePopperScope(__scopeMenu); + const [trigger, setTrigger] = React.useState(null); + const [content, setContent] = React.useState(null); + const handleOpenChange = (0, import_react_use_callback_ref.useCallbackRef)(onOpenChange); + React.useEffect(() => { + if (parentMenuContext.open === false) handleOpenChange(false); + return () => handleOpenChange(false); + }, [parentMenuContext.open, handleOpenChange]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperPrimitive.Root, { ...popperScope, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + MenuProvider, + { + scope: __scopeMenu, + open, + onOpenChange: handleOpenChange, + content, + onContentChange: setContent, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + MenuSubProvider, + { + scope: __scopeMenu, + contentId: (0, import_react_id.useId)(), + triggerId: (0, import_react_id.useId)(), + trigger, + onTriggerChange: setTrigger, + children + } + ) + } + ) }); +}, "MenuSub"); +var SUB_TRIGGER_NAME = "MenuSubTrigger"; +var MenuSubTrigger = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuSubTrigger2(props, forwardedRef) { + const context = useMenuContext(SUB_TRIGGER_NAME, props.__scopeMenu); + const rootContext = useMenuRootContext(SUB_TRIGGER_NAME, props.__scopeMenu); + const subContext = useMenuSubContext(SUB_TRIGGER_NAME, props.__scopeMenu); + const contentContext = useMenuContentContext(SUB_TRIGGER_NAME, props.__scopeMenu); + const openTimerRef = React.useRef(null); + const { pointerGraceTimerRef, onPointerGraceIntentChange } = contentContext; + const scope = { __scopeMenu: props.__scopeMenu }; + const clearOpenTimer = React.useCallback(() => { + if (openTimerRef.current) window.clearTimeout(openTimerRef.current); + openTimerRef.current = null; + }, []); + React.useEffect(() => clearOpenTimer, [clearOpenTimer]); + React.useEffect(() => { + const pointerGraceTimer = pointerGraceTimerRef.current; + return () => { + window.clearTimeout(pointerGraceTimer); + onPointerGraceIntentChange(null); + }; + }, [pointerGraceTimerRef, onPointerGraceIntentChange]); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, subContext.onTriggerChange); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuAnchor, { asChild: true, ...scope, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + MenuItemImpl, + { + id: subContext.triggerId, + "aria-haspopup": "menu", + "aria-expanded": context.open, + "aria-controls": context.open ? subContext.contentId : void 0, + "data-state": getOpenState(context.open), + ...props, + ref: composedRefs, + onClick: (event) => { + props.onClick?.(event); + if (props.disabled || event.defaultPrevented) return; + event.currentTarget.focus(); + if (!context.open) context.onOpenChange(true); + }, + onPointerMove: (0, import_primitive.composeEventHandlers)( + props.onPointerMove, + whenMouse((event) => { + contentContext.onItemEnter(event); + if (event.defaultPrevented) return; + if (!props.disabled && !context.open && !openTimerRef.current) { + contentContext.onPointerGraceIntentChange(null); + openTimerRef.current = window.setTimeout(() => { + context.onOpenChange(true); + clearOpenTimer(); + }, 100); + } + }) + ), + onPointerLeave: (0, import_primitive.composeEventHandlers)( + props.onPointerLeave, + whenMouse((event) => { + clearOpenTimer(); + const contentRect = context.content?.getBoundingClientRect(); + if (contentRect) { + const side = context.content?.dataset.side; + const rightSide = side === "right"; + const bleed = rightSide ? -5 : 5; + const contentNearEdge = contentRect[rightSide ? "left" : "right"]; + const contentFarEdge = contentRect[rightSide ? "right" : "left"]; + contentContext.onPointerGraceIntentChange({ + area: [ + // Apply a bleed on clientX to ensure that our exit point is + // consistently within polygon bounds + { x: event.clientX + bleed, y: event.clientY }, + { x: contentNearEdge, y: contentRect.top }, + { x: contentFarEdge, y: contentRect.top }, + { x: contentFarEdge, y: contentRect.bottom }, + { x: contentNearEdge, y: contentRect.bottom } + ], + side + }); + window.clearTimeout(pointerGraceTimerRef.current); + pointerGraceTimerRef.current = window.setTimeout( + () => contentContext.onPointerGraceIntentChange(null), + 300 + ); + } else { + contentContext.onTriggerLeave(event); + if (event.defaultPrevented) return; + contentContext.onPointerGraceIntentChange(null); + } + }) + ), + onKeyDown: (0, import_primitive.composeEventHandlers)(props.onKeyDown, (event) => { + if (props.disabled || event.target !== event.currentTarget) { + return; + } + const isTypingAhead = contentContext.searchRef.current !== ""; + if (isTypingAhead && event.key === " ") { + return; + } + if (SUB_OPEN_KEYS[rootContext.dir].includes(event.key)) { + context.onOpenChange(true); + context.content?.focus(); + event.preventDefault(); + } + }) + } + ) }); + }, "MenuSubTrigger") +); +var SUB_CONTENT_NAME = "MenuSubContent"; +var MenuSubContent = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuSubContent2(props, forwardedRef) { + const portalContext = usePortalContext(CONTENT_NAME, props.__scopeMenu); + const { forceMount = portalContext.forceMount, align = "start", ...subContentProps } = props; + const context = useMenuContext(CONTENT_NAME, props.__scopeMenu); + const rootContext = useMenuRootContext(CONTENT_NAME, props.__scopeMenu); + const subContext = useMenuSubContext(SUB_CONTENT_NAME, props.__scopeMenu); + const ref = React.useRef(null); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || context.open, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Slot, { scope: props.__scopeMenu, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + MenuContentImpl, + { + id: subContext.contentId, + "aria-labelledby": subContext.triggerId, + ...subContentProps, + ref: composedRefs, + align, + side: rootContext.dir === Direction.RTL ? "left" : "right", + disableOutsidePointerEvents: false, + disableOutsideScroll: false, + trapFocus: false, + onOpenAutoFocus: (event) => { + if (rootContext.isUsingKeyboardRef.current) ref.current?.focus(); + event.preventDefault(); + }, + onCloseAutoFocus: (event) => event.preventDefault(), + onFocusOutside: (0, import_primitive.composeEventHandlers)(props.onFocusOutside, (event) => { + if (event.target !== subContext.trigger) context.onOpenChange(false); + }), + onEscapeKeyDown: (0, import_primitive.composeEventHandlers)(props.onEscapeKeyDown, (event) => { + rootContext.onClose(); + event.preventDefault(); + }), + onKeyDown: (0, import_primitive.composeEventHandlers)(props.onKeyDown, (event) => { + const isKeyDownInside = event.currentTarget.contains(event.target); + const isCloseKey = SUB_CLOSE_KEYS[rootContext.dir].includes(event.key); + if (isKeyDownInside && isCloseKey) { + context.onOpenChange(false); + subContext.trigger?.focus(); + event.preventDefault(); + } + }) + } + ) }) }) }); + }, "MenuSubContent") +); +function getOpenState(open) { + return open ? "open" : "closed"; +} +__name(getOpenState, "getOpenState"); +function isIndeterminate(checked) { + return checked === "indeterminate"; +} +__name(isIndeterminate, "isIndeterminate"); +function getCheckedState(checked) { + return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked"; +} +__name(getCheckedState, "getCheckedState"); +function focusFirst(candidates) { + const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement; + for (const candidate of candidates) { + if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return; + candidate.focus(); + if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return; + } +} +__name(focusFirst, "focusFirst"); +function wrapArray(array, startIndex) { + return array.map((_, index) => array[(startIndex + index) % array.length]); +} +__name(wrapArray, "wrapArray"); +function getNextMatch(values, search, currentMatch) { + const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]); + const normalizedSearch = isRepeated ? search[0] : search; + const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1; + let wrappedValues = wrapArray(values, Math.max(currentMatchIndex, 0)); + const excludeCurrentMatch = normalizedSearch.length === 1; + if (excludeCurrentMatch) wrappedValues = wrappedValues.filter((v) => v !== currentMatch); + const nextMatch = wrappedValues.find( + (value) => value.toLowerCase().startsWith(normalizedSearch.toLowerCase()) + ); + return nextMatch !== currentMatch ? nextMatch : void 0; +} +__name(getNextMatch, "getNextMatch"); +function isPointInPolygon(point, polygon) { + const { x, y } = point; + let inside = false; + for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) { + const ii = polygon[i]; + const jj = polygon[j]; + const xi = ii.x; + const yi = ii.y; + const xj = jj.x; + const yj = jj.y; + const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi; + if (intersect) inside = !inside; + } + return inside; +} +__name(isPointInPolygon, "isPointInPolygon"); +function isPointerInGraceArea(event, area) { + if (!area) return false; + const cursorPos = { x: event.clientX, y: event.clientY }; + return isPointInPolygon(cursorPos, area); +} +__name(isPointerInGraceArea, "isPointerInGraceArea"); +function whenMouse(handler) { + return (event) => event.pointerType === "mouse" ? handler(event) : void 0; +} +__name(whenMouse, "whenMouse"); +//# sourceMappingURL=index.js.map diff --git a/e-commerce/node_modules/@radix-ui/react-menu/dist/index.js.map b/e-commerce/node_modules/@radix-ui/react-menu/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..328432e46060e49d538cc6503d5e41f2de10a323 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-menu/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts", "../src/menu.tsx"], + "sourcesContent": ["'use client';\nexport {\n createMenuScope,\n //\n Menu,\n MenuAnchor,\n MenuPortal,\n MenuContent,\n MenuGroup,\n MenuLabel,\n MenuItem,\n MenuCheckboxItem,\n MenuRadioGroup,\n MenuRadioItem,\n MenuItemIndicator,\n MenuSeparator,\n MenuArrow,\n MenuSub,\n MenuSubTrigger,\n MenuSubContent,\n //\n Root,\n Anchor,\n Portal,\n Content,\n Group,\n Label,\n Item,\n CheckboxItem,\n RadioGroup,\n RadioItem,\n ItemIndicator,\n Separator,\n Arrow,\n Sub,\n SubTrigger,\n SubContent,\n} from './menu';\nexport type {\n MenuProps,\n MenuAnchorProps,\n MenuPortalProps,\n MenuContentProps,\n MenuGroupProps,\n MenuLabelProps,\n MenuItemProps,\n MenuCheckboxItemProps,\n MenuRadioGroupProps,\n MenuRadioItemProps,\n MenuItemIndicatorProps,\n MenuSeparatorProps,\n MenuArrowProps,\n MenuSubProps,\n MenuSubTriggerProps,\n MenuSubContentProps,\n} from './menu';\n", "import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createCollection } from '@radix-ui/react-collection';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useDirection } from '@radix-ui/react-direction';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport {\n FocusScope,\n FocusScopeBranchProvider,\n useFocusScopeBranch,\n useFocusScopeBranchRegistry,\n} from '@radix-ui/react-focus-scope';\nimport { useId } from '@radix-ui/react-id';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { createPopperScope } from '@radix-ui/react-popper';\nimport { Portal as PortalPrimitive } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive, dispatchDiscreteCustomEvent } from '@radix-ui/react-primitive';\nimport * as RovingFocusGroup from '@radix-ui/react-roving-focus';\nimport { createRovingFocusGroupScope } from '@radix-ui/react-roving-focus';\nimport { createSlot } from '@radix-ui/react-slot';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { hideOthers } from 'aria-hidden';\nimport { RemoveScroll } from 'react-remove-scroll';\n\nimport type { Scope } from '@radix-ui/react-context';\n\nconst Direction = {\n LTR: 'ltr',\n RTL: 'rtl',\n} as const;\n\ntype Direction = (typeof Direction)[keyof typeof Direction];\n\nconst SELECTION_KEYS = ['Enter', ' '];\nconst FIRST_KEYS = ['ArrowDown', 'PageUp', 'Home'];\nconst LAST_KEYS = ['ArrowUp', 'PageDown', 'End'];\nconst FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];\nconst SUB_OPEN_KEYS: Record = {\n ltr: [...SELECTION_KEYS, 'ArrowRight'],\n rtl: [...SELECTION_KEYS, 'ArrowLeft'],\n};\nconst SUB_CLOSE_KEYS: Record = {\n ltr: ['ArrowLeft'],\n rtl: ['ArrowRight'],\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Menu\n * -----------------------------------------------------------------------------------------------*/\n\nconst MENU_NAME = 'Menu';\n\ntype ItemData = { disabled: boolean; textValue: string };\nconst [Collection, useCollection, createCollectionScope] = createCollection<\n MenuItemElement,\n ItemData\n>(MENU_NAME);\n\ntype ScopedProps

= P & { __scopeMenu?: Scope | undefined };\nconst [createMenuContext, createMenuScope] = createContextScope(MENU_NAME, [\n createCollectionScope,\n createPopperScope,\n createRovingFocusGroupScope,\n]);\nconst usePopperScope = createPopperScope();\nconst useRovingFocusGroupScope = createRovingFocusGroupScope();\n\ntype MenuContextValue = {\n open: boolean;\n onOpenChange(open: boolean): void;\n content: MenuContentElement | null;\n onContentChange(content: MenuContentElement | null): void;\n};\n\nconst [MenuProvider, useMenuContext] = createMenuContext(MENU_NAME);\n\ntype MenuRootContextValue = {\n onClose(): void;\n isUsingKeyboardRef: React.RefObject;\n dir: Direction;\n modal: boolean;\n};\n\nconst [MenuRootProvider, useMenuRootContext] = createMenuContext(MENU_NAME);\n\ninterface MenuProps {\n children?: React.ReactNode | undefined;\n open?: boolean | undefined;\n onOpenChange?: ((open: boolean) => void) | undefined;\n dir?: Direction | undefined;\n modal?: boolean | undefined;\n}\n\nconst Menu: React.FC = (props: ScopedProps) => {\n const { __scopeMenu, open = false, children, dir, onOpenChange, modal = true } = props;\n const popperScope = usePopperScope(__scopeMenu);\n const [content, setContent] = React.useState(null);\n const isUsingKeyboardRef = React.useRef(false);\n const handleOpenChange = useCallbackRef(onOpenChange);\n const direction = useDirection(dir);\n\n React.useEffect(() => {\n // Capture phase ensures we set the boolean before any side effects execute\n // in response to the key or pointer event as they might depend on this value.\n const handleKeyDown = () => {\n isUsingKeyboardRef.current = true;\n document.addEventListener('pointerdown', handlePointer, { capture: true, once: true });\n document.addEventListener('pointermove', handlePointer, { capture: true, once: true });\n };\n const handlePointer = () => (isUsingKeyboardRef.current = false);\n document.addEventListener('keydown', handleKeyDown, { capture: true });\n return () => {\n document.removeEventListener('keydown', handleKeyDown, { capture: true });\n document.removeEventListener('pointerdown', handlePointer, { capture: true });\n document.removeEventListener('pointermove', handlePointer, { capture: true });\n };\n }, []);\n\n // Close the menu (and any open submenus) when the window loses focus, e.g. when\n // switching to another browser tab or application. Without this, submenus would\n // remain open when the page is re-focused, leaving the menu in an inconsistent state.\n // See: https://github.com/radix-ui/primitives/issues/3257\n React.useEffect(() => {\n if (!open) {\n return;\n }\n const handleBlur = () => handleOpenChange(false);\n window.addEventListener('blur', handleBlur);\n return () => window.removeEventListener('blur', handleBlur);\n }, [open, handleOpenChange]);\n\n return (\n \n \n handleOpenChange(false), [handleOpenChange])}\n isUsingKeyboardRef={isUsingKeyboardRef}\n dir={direction}\n modal={modal}\n >\n {children}\n \n \n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * MenuAnchor\n * -----------------------------------------------------------------------------------------------*/\n\ntype MenuAnchorElement = React.ComponentRef;\ntype PopperAnchorProps = React.ComponentPropsWithoutRef;\ninterface MenuAnchorProps extends PopperAnchorProps {}\n\nconst MenuAnchor = /* @__PURE__ */ React.forwardRef(\n function MenuAnchor(props: ScopedProps, forwardedRef) {\n const { __scopeMenu, ...anchorProps } = props;\n const popperScope = usePopperScope(__scopeMenu);\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'MenuPortal';\n\ntype PortalContextValue = { forceMount?: true | undefined };\nconst [PortalProvider, usePortalContext] = createMenuContext(PORTAL_NAME, {\n forceMount: undefined,\n});\n\ntype PortalProps = React.ComponentPropsWithoutRef;\ninterface MenuPortalProps {\n children?: React.ReactNode | undefined;\n /**\n * Specify a container element to portal the content into.\n */\n container?: PortalProps['container'] | undefined;\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst MenuPortal: React.FC = (props: ScopedProps) => {\n const { __scopeMenu, forceMount, children, container } = props;\n const context = useMenuContext(PORTAL_NAME, __scopeMenu);\n return (\n \n \n \n {children}\n \n \n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * MenuContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'MenuContent';\n\ntype MenuContentContextValue = {\n onItemEnter(event: React.PointerEvent): void;\n onItemLeave(event: React.PointerEvent): void;\n onTriggerLeave(event: React.PointerEvent): void;\n searchRef: React.RefObject;\n pointerGraceTimerRef: React.MutableRefObject;\n onPointerGraceIntentChange(intent: GraceIntent | null): void;\n};\nconst [MenuContentProvider, useMenuContentContext] =\n createMenuContext(CONTENT_NAME);\n\ntype MenuContentElement = MenuRootContentTypeElement;\n/**\n * We purposefully don't union MenuRootContent and MenuSubContent props here because\n * they have conflicting prop types. We agreed that we would allow MenuSubContent to\n * accept props that it would just ignore.\n */\ninterface MenuContentProps extends MenuRootContentTypeProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst MenuContent = /* @__PURE__ */ React.forwardRef(\n function MenuContent(props: ScopedProps, forwardedRef) {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopeMenu);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);\n const rootContext = useMenuRootContext(CONTENT_NAME, props.__scopeMenu);\n\n return (\n \n \n \n {rootContext.modal ? (\n \n ) : (\n \n )}\n \n \n \n );\n },\n);\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype MenuRootContentTypeElement = MenuContentImplElement;\ninterface MenuRootContentTypeProps extends Omit<\n MenuContentImplProps,\n keyof MenuContentImplPrivateProps\n> {}\n\nconst MenuRootContentModal = /* @__PURE__ */ React.forwardRef<\n MenuRootContentTypeElement,\n MenuRootContentTypeProps\n>(\n // blank line to reduce diff noise\n function MenuRootContentModal(props: ScopedProps, forwardedRef) {\n const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n\n // Hide everything from ARIA except the `MenuContent`\n React.useEffect(() => {\n const content = ref.current;\n if (content) return hideOthers(content);\n }, []);\n\n return (\n event.preventDefault(),\n { checkForDefaultPrevented: false },\n )}\n onDismiss={() => context.onOpenChange(false)}\n />\n );\n },\n);\n\nconst MenuRootContentNonModal = /* @__PURE__ */ React.forwardRef<\n MenuRootContentTypeElement,\n MenuRootContentTypeProps\n>(function MenuRootContentNonModal(props: ScopedProps, forwardedRef) {\n const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);\n return (\n context.onOpenChange(false)}\n />\n );\n});\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype MenuContentImplElement = React.ComponentRef;\ntype FocusScopeProps = React.ComponentPropsWithoutRef;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef;\ntype RovingFocusGroupProps = React.ComponentPropsWithoutRef;\ntype PopperContentProps = React.ComponentPropsWithoutRef;\ntype MenuContentImplPrivateProps = {\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'] | undefined;\n onDismiss?: DismissableLayerProps['onDismiss'] | undefined;\n disableOutsidePointerEvents?: DismissableLayerProps['disableOutsidePointerEvents'] | undefined;\n\n /**\n * Whether scrolling outside the `MenuContent` should be prevented\n * (default: `false`)\n */\n disableOutsideScroll?: boolean | undefined;\n\n /**\n * Whether focus should be trapped within the `MenuContent`\n * (default: false)\n */\n trapFocus?: FocusScopeProps['trapped'] | undefined;\n};\ninterface MenuContentImplProps\n extends MenuContentImplPrivateProps, Omit {\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'] | undefined;\n\n /**\n * Whether keyboard navigation should loop around\n * @defaultValue false\n */\n loop?: RovingFocusGroupProps['loop'] | undefined;\n\n onEntryFocus?: RovingFocusGroupProps['onEntryFocus'] | undefined;\n onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'] | undefined;\n onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'] | undefined;\n onFocusOutside?: DismissableLayerProps['onFocusOutside'] | undefined;\n onInteractOutside?: DismissableLayerProps['onInteractOutside'] | undefined;\n}\n\nconst Slot = createSlot('MenuContent.ScrollLock');\n\nconst MenuContentImpl = /* @__PURE__ */ React.forwardRef<\n MenuContentImplElement,\n MenuContentImplProps\n>(\n // blank line to reduce diff noise\n function MenuContentImpl(props: ScopedProps, forwardedRef) {\n const {\n __scopeMenu,\n loop = false,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEntryFocus,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n disableOutsideScroll,\n ...contentProps\n } = props;\n const context = useMenuContext(CONTENT_NAME, __scopeMenu);\n const rootContext = useMenuRootContext(CONTENT_NAME, __scopeMenu);\n const popperScope = usePopperScope(__scopeMenu);\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu);\n const getItems = useCollection(__scopeMenu);\n const [currentItemId, setCurrentItemId] = React.useState(null);\n const contentRef = React.useRef(null);\n\n // When this `Menu` is nested inside a modal layer (eg. a `Dialog`) but portalled outside of it,\n // register its content with the ancestor layer so focus isn't reclaimed and scroll isn't locked\n // for it (only relevant for non-modal menus, which don't trap focus / lock scroll themselves).\n // It also exposes its own registry so nested, portalled layers can do the same against it.\n // See: https://github.com/radix-ui/primitives/issues/3423\n const [branchNode, setBranchNode] = React.useState(null);\n useFocusScopeBranch(branchNode);\n const { nodes: branchNodes, registry: branchRegistry } = useFocusScopeBranchRegistry();\n // Only modal menus trap focus / lock scroll, so only they need to host branches. Non-modal\n // menus stay transparent and let nested layers register against the next modal ancestor.\n const isModal = Boolean(trapFocus || disableOutsideScroll);\n const composedRefs = useComposedRefs(\n forwardedRef,\n contentRef,\n context.onContentChange,\n setBranchNode,\n );\n const timerRef = React.useRef(0);\n const searchRef = React.useRef('');\n const pointerGraceTimerRef = React.useRef(0);\n const pointerGraceIntentRef = React.useRef(null);\n const pointerDirRef = React.useRef('right');\n const lastPointerXRef = React.useRef(0);\n const shards = React.useMemo(\n () =>\n disableOutsideScroll ? [contentRef, ...branchNodes.map((node) => ({ current: node }))] : [],\n [contentRef, branchNodes, disableOutsideScroll],\n );\n\n const ScrollLockWrapper = disableOutsideScroll ? RemoveScroll : React.Fragment;\n const scrollLockWrapperProps = disableOutsideScroll\n ? {\n as: Slot,\n allowPinchZoom: true,\n shards,\n }\n : undefined;\n\n const handleTypeaheadSearch = (key: string) => {\n const search = searchRef.current + key;\n const items = getItems().filter((item) => !item.disabled);\n const currentItem = document.activeElement;\n const currentMatch = items.find((item) => item.ref.current === currentItem)?.textValue;\n const values = items.map((item) => item.textValue);\n const nextMatch = getNextMatch(values, search, currentMatch);\n const newItem = items.find((item) => item.textValue === nextMatch)?.ref.current;\n\n // Reset `searchRef` 1 second after it was last updated\n function updateSearch(value: string) {\n searchRef.current = value;\n window.clearTimeout(timerRef.current);\n if (value !== '') timerRef.current = window.setTimeout(() => updateSearch(''), 1000);\n }\n updateSearch(search);\n\n if (newItem) {\n /**\n * Imperative focus during keydown is risky so we prevent React's batching updates\n * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332\n */\n setTimeout(() => (newItem as HTMLElement).focus());\n }\n };\n\n React.useEffect(() => {\n return () => window.clearTimeout(timerRef.current);\n }, []);\n\n // Make sure the whole tree has focus guards as our `MenuContent` may be\n // the last element in the DOM (because of the `Portal`)\n useFocusGuards();\n\n const isPointerMovingToSubmenu = React.useCallback((event: React.PointerEvent) => {\n const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side;\n return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area);\n }, []);\n\n return (\n {\n if (isPointerMovingToSubmenu(event)) event.preventDefault();\n },\n [isPointerMovingToSubmenu],\n )}\n onItemLeave={React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) return;\n contentRef.current?.focus();\n setCurrentItemId(null);\n },\n [isPointerMovingToSubmenu],\n )}\n onTriggerLeave={React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) event.preventDefault();\n },\n [isPointerMovingToSubmenu],\n )}\n pointerGraceTimerRef={pointerGraceTimerRef}\n onPointerGraceIntentChange={React.useCallback((intent) => {\n pointerGraceIntentRef.current = intent;\n }, [])}\n >\n \n \n {\n // when opening, explicitly focus the content area only and leave\n // `onEntryFocus` in control of focusing first item\n event.preventDefault();\n contentRef.current?.focus({ preventScroll: true });\n })}\n onUnmountAutoFocus={onCloseAutoFocus}\n >\n \n {\n // only focus first item when using keyboard\n if (!rootContext.isUsingKeyboardRef.current) event.preventDefault();\n })}\n preventScrollOnEntryFocus\n >\n {\n // submenu key events bubble through portals. We only care\n // about keys in this menu.\n const target = event.target as HTMLElement;\n const isKeyDownInside =\n target.closest('[data-radix-menu-content]') === event.currentTarget;\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;\n const isCharacterKey = event.key.length === 1;\n if (isKeyDownInside) {\n // menus should not be navigated using tab key so we\n // prevent it\n if (event.key === 'Tab') event.preventDefault();\n if (!isModifierKey && isCharacterKey) handleTypeaheadSearch(event.key);\n }\n // focus first/last item based on key pressed\n const content = contentRef.current;\n if (event.target !== content) return;\n if (!FIRST_LAST_KEYS.includes(event.key)) return;\n event.preventDefault();\n const items = getItems().filter((item) => !item.disabled);\n const candidateNodes = items.map((item) => item.ref.current!);\n if (LAST_KEYS.includes(event.key)) candidateNodes.reverse();\n focusFirst(candidateNodes);\n })}\n onBlur={composeEventHandlers(props.onBlur, (event) => {\n // clear search buffer when leaving the menu\n if (!event.currentTarget.contains(event.target)) {\n window.clearTimeout(timerRef.current);\n searchRef.current = '';\n }\n })}\n onPointerMove={composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n const target = event.target as HTMLElement;\n const pointerXHasChanged = lastPointerXRef.current !== event.clientX;\n\n // We don't use `event.movementX` for this check because\n // Safari will always return `0` on a pointer event.\n if (event.currentTarget.contains(target) && pointerXHasChanged) {\n const newDir = event.clientX > lastPointerXRef.current ? 'right' : 'left';\n pointerDirRef.current = newDir;\n lastPointerXRef.current = event.clientX;\n }\n }),\n )}\n />\n \n \n \n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuGroup\n * -----------------------------------------------------------------------------------------------*/\n\ntype MenuGroupElement = React.ComponentRef;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef;\ninterface MenuGroupProps extends PrimitiveDivProps {}\n\nconst MenuGroup = /* @__PURE__ */ React.forwardRef(\n function MenuGroup(props: ScopedProps, forwardedRef) {\n const { __scopeMenu, ...groupProps } = props;\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuLabel\n * -----------------------------------------------------------------------------------------------*/\n\ntype MenuLabelElement = React.ComponentRef;\ninterface MenuLabelProps extends PrimitiveDivProps {}\n\nconst MenuLabel = /* @__PURE__ */ React.forwardRef(\n function MenuLabel(props: ScopedProps, forwardedRef) {\n const { __scopeMenu, ...labelProps } = props;\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'MenuItem';\nconst ITEM_SELECT = 'menu.itemSelect';\n\ntype MenuItemElement = MenuItemImplElement;\ninterface MenuItemProps extends Omit {\n onSelect?: ((event: Event) => void) | undefined;\n}\n\nconst MenuItem = /* @__PURE__ */ React.forwardRef(\n // blank line to reduce diff noise\n function MenuItem(props: ScopedProps, forwardedRef) {\n const { disabled = false, onSelect, ...itemProps } = props;\n const ref = React.useRef(null);\n const rootContext = useMenuRootContext(ITEM_NAME, props.__scopeMenu);\n const contentContext = useMenuContentContext(ITEM_NAME, props.__scopeMenu);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const isPointerDownRef = React.useRef(false);\n\n const handleSelect = () => {\n const menuItem = ref.current;\n if (!disabled && menuItem) {\n const itemSelectEvent = new CustomEvent(ITEM_SELECT, { bubbles: true, cancelable: true });\n menuItem.addEventListener(ITEM_SELECT, (event) => onSelect?.(event), { once: true });\n dispatchDiscreteCustomEvent(menuItem, itemSelectEvent);\n if (itemSelectEvent.defaultPrevented) {\n isPointerDownRef.current = false;\n } else {\n rootContext.onClose();\n }\n }\n };\n\n return (\n {\n props.onPointerDown?.(event);\n isPointerDownRef.current = true;\n }}\n onPointerUp={composeEventHandlers(props.onPointerUp, (event) => {\n // Pointer down can move to a different menu item which should activate it on pointer up.\n // We dispatch a click for selection to allow composition with click based triggers and to\n // prevent Firefox from getting stuck in text selection mode when the menu closes.\n if (!isPointerDownRef.current) event.currentTarget?.click();\n })}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n // Only react to keys originating from the item itself. Focusable\n // descendants (eg. an `input` inside a `Dialog` rendered within the\n // item) bubble their key events here through React's event system\n // even when portaled out of the item's DOM subtree, which would\n // otherwise let the item swallow selection keys.\n // See: https://github.com/radix-ui/primitives/issues/3232\n if (disabled || event.target !== event.currentTarget) {\n return;\n }\n\n const isTypingAhead = contentContext.searchRef.current !== '';\n if (isTypingAhead && event.key === ' ') {\n return;\n }\n\n if (SELECTION_KEYS.includes(event.key)) {\n event.currentTarget.click();\n /**\n * We prevent default browser behaviour for selection keys as they should trigger\n * a selection only:\n * - prevents space from scrolling the page.\n * - if keydown causes focus to move, prevents keydown from firing on the new target.\n */\n event.preventDefault();\n }\n })}\n />\n );\n },\n);\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype MenuItemImplElement = React.ComponentRef;\ninterface MenuItemImplProps extends PrimitiveDivProps {\n disabled?: boolean | undefined;\n textValue?: string | undefined;\n}\n\nconst MenuItemImpl = /* @__PURE__ */ React.forwardRef(\n function MenuItemImpl(props: ScopedProps, forwardedRef) {\n const { __scopeMenu, disabled = false, textValue, ...itemProps } = props;\n const contentContext = useMenuContentContext(ITEM_NAME, __scopeMenu);\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const [isFocused, setIsFocused] = React.useState(false);\n\n // get the item's `.textContent` as default strategy for typeahead `textValue`\n const [textContent, setTextContent] = React.useState('');\n React.useEffect(() => {\n const menuItem = ref.current;\n if (menuItem) {\n setTextContent((menuItem.textContent ?? '').trim());\n }\n }, [itemProps.children]);\n\n return (\n \n \n {\n if (disabled) {\n contentContext.onItemLeave(event);\n } else {\n contentContext.onItemEnter(event);\n if (!event.defaultPrevented) {\n const item = event.currentTarget;\n item.focus({ preventScroll: true });\n }\n }\n }),\n )}\n onPointerLeave={composeEventHandlers(\n props.onPointerLeave,\n whenMouse((event) => contentContext.onItemLeave(event)),\n )}\n onFocus={composeEventHandlers(props.onFocus, () => setIsFocused(true))}\n onBlur={composeEventHandlers(props.onBlur, () => setIsFocused(false))}\n />\n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuCheckboxItem\n * -----------------------------------------------------------------------------------------------*/\n\ntype MenuCheckboxItemElement = MenuItemElement;\n\ntype CheckedState = boolean | 'indeterminate';\n\ninterface MenuCheckboxItemProps extends MenuItemProps {\n checked?: CheckedState | undefined;\n // `onCheckedChange` can never be called with `\"indeterminate\"` from the inside\n onCheckedChange?: ((checked: boolean) => void) | undefined;\n}\n\nconst MenuCheckboxItem = /* @__PURE__ */ React.forwardRef<\n MenuCheckboxItemElement,\n MenuCheckboxItemProps\n>(\n // blank line to reduce diff noise\n function MenuCheckboxItem(props: ScopedProps, forwardedRef) {\n const { checked = false, onCheckedChange, ...checkboxItemProps } = props;\n return (\n \n onCheckedChange?.(isIndeterminate(checked) ? true : !checked),\n { checkForDefaultPrevented: false },\n )}\n />\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuRadioGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_GROUP_NAME = 'MenuRadioGroup';\n\nconst [RadioGroupProvider, useRadioGroupContext] = createMenuContext(\n RADIO_GROUP_NAME,\n { value: undefined, onValueChange: () => {} },\n);\n\ntype MenuRadioGroupElement = React.ComponentRef;\ninterface MenuRadioGroupProps extends MenuGroupProps {\n value?: string | undefined;\n onValueChange?: ((value: string) => void) | undefined;\n}\n\nconst MenuRadioGroup = /* @__PURE__ */ React.forwardRef(\n function MenuRadioGroup(props: ScopedProps, forwardedRef) {\n const { value, onValueChange, ...groupProps } = props;\n const handleValueChange = useCallbackRef(onValueChange);\n return (\n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuRadioItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_ITEM_NAME = 'MenuRadioItem';\n\ntype MenuRadioItemElement = React.ComponentRef;\ninterface MenuRadioItemProps extends MenuItemProps {\n value: string;\n}\n\nconst MenuRadioItem = /* @__PURE__ */ React.forwardRef(\n function MenuRadioItem(props: ScopedProps, forwardedRef) {\n const { value, ...radioItemProps } = props;\n const context = useRadioGroupContext(RADIO_ITEM_NAME, props.__scopeMenu);\n const checked = value === context.value;\n return (\n \n context.onValueChange?.(value),\n { checkForDefaultPrevented: false },\n )}\n />\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_INDICATOR_NAME = 'MenuItemIndicator';\n\ntype CheckboxContextValue = { checked: CheckedState };\n\nconst [ItemIndicatorProvider, useItemIndicatorContext] = createMenuContext(\n ITEM_INDICATOR_NAME,\n { checked: false },\n);\n\ntype MenuItemIndicatorElement = React.ComponentRef;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef;\ninterface MenuItemIndicatorProps extends PrimitiveSpanProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst MenuItemIndicator = /* @__PURE__ */ React.forwardRef<\n MenuItemIndicatorElement,\n MenuItemIndicatorProps\n>(\n // blank line to reduce diff noise\n function MenuItemIndicator(props: ScopedProps, forwardedRef) {\n const { __scopeMenu, forceMount, ...itemIndicatorProps } = props;\n const indicatorContext = useItemIndicatorContext(ITEM_INDICATOR_NAME, __scopeMenu);\n return (\n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuSeparator\n * -----------------------------------------------------------------------------------------------*/\n\ntype MenuSeparatorElement = React.ComponentRef;\ninterface MenuSeparatorProps extends PrimitiveDivProps {}\n\nconst MenuSeparator = /* @__PURE__ */ React.forwardRef(\n function MenuSeparator(props: ScopedProps, forwardedRef) {\n const { __scopeMenu, ...separatorProps } = props;\n return (\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuArrow\n * -----------------------------------------------------------------------------------------------*/\n\ntype MenuArrowElement = React.ComponentRef;\ntype PopperArrowProps = React.ComponentPropsWithoutRef;\ninterface MenuArrowProps extends PopperArrowProps {}\n\nconst MenuArrow = /* @__PURE__ */ React.forwardRef(\n function MenuArrow(props: ScopedProps, forwardedRef) {\n const { __scopeMenu, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopeMenu);\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuSub\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_NAME = 'MenuSub';\n\ntype MenuSubContextValue = {\n contentId: string;\n triggerId: string;\n trigger: MenuSubTriggerElement | null;\n onTriggerChange(trigger: MenuSubTriggerElement | null): void;\n};\n\nconst [MenuSubProvider, useMenuSubContext] = createMenuContext(SUB_NAME);\n\ninterface MenuSubProps {\n children?: React.ReactNode | undefined;\n open?: boolean | undefined;\n onOpenChange?: ((open: boolean) => void) | undefined;\n}\n\nconst MenuSub: React.FC = (props: ScopedProps) => {\n const { __scopeMenu, children, open = false, onOpenChange } = props;\n const parentMenuContext = useMenuContext(SUB_NAME, __scopeMenu);\n const popperScope = usePopperScope(__scopeMenu);\n const [trigger, setTrigger] = React.useState(null);\n const [content, setContent] = React.useState(null);\n const handleOpenChange = useCallbackRef(onOpenChange);\n\n // Prevent the parent menu from reopening with open submenus.\n React.useEffect(() => {\n if (parentMenuContext.open === false) handleOpenChange(false);\n return () => handleOpenChange(false);\n }, [parentMenuContext.open, handleOpenChange]);\n\n return (\n \n \n \n {children}\n \n \n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * MenuSubTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_TRIGGER_NAME = 'MenuSubTrigger';\n\ntype MenuSubTriggerElement = MenuItemImplElement;\ninterface MenuSubTriggerProps extends MenuItemImplProps {}\n\nconst MenuSubTrigger = /* @__PURE__ */ React.forwardRef(\n function MenuSubTrigger(props: ScopedProps, forwardedRef) {\n const context = useMenuContext(SUB_TRIGGER_NAME, props.__scopeMenu);\n const rootContext = useMenuRootContext(SUB_TRIGGER_NAME, props.__scopeMenu);\n const subContext = useMenuSubContext(SUB_TRIGGER_NAME, props.__scopeMenu);\n const contentContext = useMenuContentContext(SUB_TRIGGER_NAME, props.__scopeMenu);\n const openTimerRef = React.useRef(null);\n const { pointerGraceTimerRef, onPointerGraceIntentChange } = contentContext;\n const scope = { __scopeMenu: props.__scopeMenu };\n\n const clearOpenTimer = React.useCallback(() => {\n if (openTimerRef.current) window.clearTimeout(openTimerRef.current);\n openTimerRef.current = null;\n }, []);\n\n React.useEffect(() => clearOpenTimer, [clearOpenTimer]);\n\n React.useEffect(() => {\n const pointerGraceTimer = pointerGraceTimerRef.current;\n return () => {\n window.clearTimeout(pointerGraceTimer);\n onPointerGraceIntentChange(null);\n };\n }, [pointerGraceTimerRef, onPointerGraceIntentChange]);\n\n const composedRefs = useComposedRefs(forwardedRef, subContext.onTriggerChange);\n\n return (\n \n {\n props.onClick?.(event);\n if (props.disabled || event.defaultPrevented) return;\n /**\n * We manually focus because iOS Safari doesn't always focus on click (e.g. buttons)\n * and we rely heavily on `onFocusOutside` for submenus to close when switching\n * between separate submenus.\n */\n event.currentTarget.focus();\n if (!context.open) context.onOpenChange(true);\n }}\n onPointerMove={composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n contentContext.onItemEnter(event);\n if (event.defaultPrevented) return;\n if (!props.disabled && !context.open && !openTimerRef.current) {\n contentContext.onPointerGraceIntentChange(null);\n openTimerRef.current = window.setTimeout(() => {\n context.onOpenChange(true);\n clearOpenTimer();\n }, 100);\n }\n }),\n )}\n onPointerLeave={composeEventHandlers(\n props.onPointerLeave,\n whenMouse((event) => {\n clearOpenTimer();\n\n const contentRect = context.content?.getBoundingClientRect();\n if (contentRect) {\n // TODO: make sure to update this when we change positioning logic\n const side = context.content?.dataset.side as Side;\n const rightSide = side === 'right';\n const bleed = rightSide ? -5 : +5;\n const contentNearEdge = contentRect[rightSide ? 'left' : 'right'];\n const contentFarEdge = contentRect[rightSide ? 'right' : 'left'];\n\n contentContext.onPointerGraceIntentChange({\n area: [\n // Apply a bleed on clientX to ensure that our exit point is\n // consistently within polygon bounds\n { x: event.clientX + bleed, y: event.clientY },\n { x: contentNearEdge, y: contentRect.top },\n { x: contentFarEdge, y: contentRect.top },\n { x: contentFarEdge, y: contentRect.bottom },\n { x: contentNearEdge, y: contentRect.bottom },\n ],\n side,\n });\n\n window.clearTimeout(pointerGraceTimerRef.current);\n pointerGraceTimerRef.current = window.setTimeout(\n () => contentContext.onPointerGraceIntentChange(null),\n 300,\n );\n } else {\n contentContext.onTriggerLeave(event);\n if (event.defaultPrevented) return;\n\n // There's 100ms where the user may leave an item before the submenu was opened.\n contentContext.onPointerGraceIntentChange(null);\n }\n }),\n )}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n // Only react to keys originating from the trigger itself. Focusable descendants\n // (eg. content rendered within the trigger) bubble their key events here through\n // React's event system even when portaled, which would otherwise let the trigger\n // swallow them. See: https://github.com/radix-ui/primitives/issues/3232\n if (props.disabled || event.target !== event.currentTarget) {\n return;\n }\n\n const isTypingAhead = contentContext.searchRef.current !== '';\n if (isTypingAhead && event.key === ' ') {\n return;\n }\n\n if (SUB_OPEN_KEYS[rootContext.dir].includes(event.key)) {\n context.onOpenChange(true);\n // The trigger may hold focus if opened via pointer interaction\n // so we ensure content is given focus again when switching to keyboard.\n context.content?.focus();\n // prevent window from scrolling\n event.preventDefault();\n }\n })}\n />\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuSubContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_CONTENT_NAME = 'MenuSubContent';\n\ntype AlignSubContent = Exclude<(typeof PopperPrimitive.ALIGN_OPTIONS)[number], 'center'>;\n\ntype MenuSubContentElement = MenuContentImplElement;\ninterface MenuSubContentProps extends Omit<\n MenuContentImplProps,\n keyof MenuContentImplPrivateProps | 'onCloseAutoFocus' | 'onEntryFocus' | 'side' | 'align'\n> {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n\n /**\n * Controls the direction the subcontent appears from its anchor menu item\n * Default: start\n */\n align?: AlignSubContent | undefined;\n}\n\nconst MenuSubContent = /* @__PURE__ */ React.forwardRef(\n function MenuSubContent(props: ScopedProps, forwardedRef) {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopeMenu);\n const { forceMount = portalContext.forceMount, align = 'start', ...subContentProps } = props;\n const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);\n const rootContext = useMenuRootContext(CONTENT_NAME, props.__scopeMenu);\n const subContext = useMenuSubContext(SUB_CONTENT_NAME, props.__scopeMenu);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n return (\n \n \n \n {\n // when opening a submenu, focus content for keyboard users only\n if (rootContext.isUsingKeyboardRef.current) ref.current?.focus();\n event.preventDefault();\n }}\n // The menu might close because of focusing another menu item in the parent menu. We\n // don't want it to refocus the trigger in that case so we handle trigger focus ourselves.\n onCloseAutoFocus={(event) => event.preventDefault()}\n onFocusOutside={composeEventHandlers(props.onFocusOutside, (event) => {\n // We prevent closing when the trigger is focused to avoid triggering a re-open animation\n // on pointer interaction.\n if (event.target !== subContext.trigger) context.onOpenChange(false);\n })}\n onEscapeKeyDown={composeEventHandlers(props.onEscapeKeyDown, (event) => {\n rootContext.onClose();\n // ensure pressing escape in submenu doesn't escape full screen mode\n event.preventDefault();\n })}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n // Submenu key events bubble through portals. We only care about keys in this menu.\n const isKeyDownInside = event.currentTarget.contains(event.target as HTMLElement);\n const isCloseKey = SUB_CLOSE_KEYS[rootContext.dir].includes(event.key);\n if (isKeyDownInside && isCloseKey) {\n context.onOpenChange(false);\n // We focus manually because we prevented it in `onCloseAutoFocus`\n subContext.trigger?.focus();\n // prevent window from scrolling\n event.preventDefault();\n }\n })}\n />\n \n \n \n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getOpenState(open: boolean) {\n return open ? 'open' : 'closed';\n}\n\nfunction isIndeterminate(checked?: CheckedState): checked is 'indeterminate' {\n return checked === 'indeterminate';\n}\n\nfunction getCheckedState(checked: CheckedState) {\n return isIndeterminate(checked) ? 'indeterminate' : checked ? 'checked' : 'unchecked';\n}\n\nfunction focusFirst(candidates: HTMLElement[]) {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates) {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus();\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\n\n/**\n * Wraps an array around itself at a given start index\n * Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`\n */\nfunction wrapArray(array: T[], startIndex: number) {\n return array.map((_, index) => array[(startIndex + index) % array.length]!);\n}\n\n/**\n * This is the \"meat\" of the typeahead matching logic. It takes in all the values,\n * the search and the current match, and returns the next match (or `undefined`).\n *\n * We normalize the search because if a user has repeatedly pressed a character,\n * we want the exact same behavior as if we only had that one character\n * (ie. cycle through options starting with that character)\n *\n * We also reorder the values by wrapping the array around the current match.\n * This is so we always look forward from the current match, and picking the first\n * match will always be the correct one.\n *\n * Finally, if the normalized search is exactly one character, we exclude the\n * current match from the values because otherwise it would be the first to match always\n * and focus would never move. This is as opposed to the regular case, where we\n * don't want focus to move if the current match still matches.\n */\nfunction getNextMatch(values: string[], search: string, currentMatch?: string) {\n const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);\n const normalizedSearch = isRepeated ? search[0]! : search;\n const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1;\n let wrappedValues = wrapArray(values, Math.max(currentMatchIndex, 0));\n const excludeCurrentMatch = normalizedSearch.length === 1;\n if (excludeCurrentMatch) wrappedValues = wrappedValues.filter((v) => v !== currentMatch);\n const nextMatch = wrappedValues.find((value) =>\n value.toLowerCase().startsWith(normalizedSearch.toLowerCase()),\n );\n return nextMatch !== currentMatch ? nextMatch : undefined;\n}\n\ntype Point = { x: number; y: number };\ntype Polygon = Point[];\ntype Side = 'left' | 'right';\ntype GraceIntent = { area: Polygon; side: Side };\n\n// Determine if a point is inside of a polygon.\n// Based on https://github.com/substack/point-in-polygon\nfunction isPointInPolygon(point: Point, polygon: Polygon) {\n const { x, y } = point;\n let inside = false;\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const ii = polygon[i]!;\n const jj = polygon[j]!;\n const xi = ii.x;\n const yi = ii.y;\n const xj = jj.x;\n const yj = jj.y;\n\n // oxfmt-ignore\n const intersect = ((yi > y) !== (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);\n if (intersect) inside = !inside;\n }\n\n return inside;\n}\n\nfunction isPointerInGraceArea(event: React.PointerEvent, area?: Polygon) {\n if (!area) return false;\n const cursorPos = { x: event.clientX, y: event.clientY };\n return isPointInPolygon(cursorPos, area);\n}\n\nfunction whenMouse(handler: React.PointerEventHandler): React.PointerEventHandler {\n return (event) => (event.pointerType === 'mouse' ? handler(event) : undefined);\n}\n\nexport {\n createMenuScope,\n //\n Menu,\n MenuAnchor,\n MenuPortal,\n MenuContent,\n MenuGroup,\n MenuLabel,\n MenuItem,\n MenuCheckboxItem,\n MenuRadioGroup,\n MenuRadioItem,\n MenuItemIndicator,\n MenuSeparator,\n MenuArrow,\n MenuSub,\n MenuSubTrigger,\n MenuSubContent,\n //\n Menu as Root,\n MenuAnchor as Anchor,\n MenuPortal as Portal,\n MenuContent as Content,\n MenuGroup as Group,\n MenuLabel as Label,\n MenuItem as Item,\n MenuCheckboxItem as CheckboxItem,\n MenuRadioGroup as RadioGroup,\n MenuRadioItem as RadioItem,\n MenuItemIndicator as ItemIndicator,\n MenuSeparator as Separator,\n MenuArrow as Arrow,\n MenuSub as Sub,\n MenuSubTrigger as SubTrigger,\n MenuSubContent as SubContent,\n};\nexport type {\n MenuProps,\n MenuAnchorProps,\n MenuPortalProps,\n MenuContentProps,\n MenuGroupProps,\n MenuLabelProps,\n MenuItemProps,\n MenuCheckboxItemProps,\n MenuRadioGroupProps,\n MenuRadioItemProps,\n MenuItemIndicatorProps,\n MenuSeparatorProps,\n MenuArrowProps,\n MenuSubProps,\n MenuSubTriggerProps,\n MenuSubContentProps,\n};\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,uBAAqC;AACrC,8BAAiC;AACjC,gCAAgC;AAChC,2BAAmC;AACnC,6BAA6B;AAC7B,qCAAiC;AACjC,gCAA+B;AAC/B,+BAKO;AACP,sBAAsB;AACtB,sBAAiC;AACjC,0BAAkC;AAClC,0BAA0C;AAC1C,4BAAyB;AACzB,6BAAuD;AACvD,uBAAkC;AAClC,gCAA4C;AAC5C,wBAA2B;AAC3B,oCAA+B;AAC/B,yBAA2B;AAC3B,iCAA6B;AAsHrB;AAlHR,IAAM,YAAY;AAAA,EAChB,KAAK;AAAA,EACL,KAAK;AACP;AAIA,IAAM,iBAAiB,CAAC,SAAS,GAAG;AACpC,IAAM,aAAa,CAAC,aAAa,UAAU,MAAM;AACjD,IAAM,YAAY,CAAC,WAAW,YAAY,KAAK;AAC/C,IAAM,kBAAkB,CAAC,GAAG,YAAY,GAAG,SAAS;AACpD,IAAM,gBAA6C;AAAA,EACjD,KAAK,CAAC,GAAG,gBAAgB,YAAY;AAAA,EACrC,KAAK,CAAC,GAAG,gBAAgB,WAAW;AACtC;AACA,IAAM,iBAA8C;AAAA,EAClD,KAAK,CAAC,WAAW;AAAA,EACjB,KAAK,CAAC,YAAY;AACpB;AAMA,IAAM,YAAY;AAGlB,IAAM,CAAC,YAAY,eAAe,qBAAqB,Q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B,QAAM,YAAY,EAAE,GAAG,MAAM,SAAS,GAAG,MAAM,QAAQ;AACvD,SAAO,iBAAiB,WAAW,IAAI;AACzC;AAJS;AAMT,SAAS,UAAa,SAAqE;AACzF,SAAO,CAAC,UAAW,MAAM,gBAAgB,UAAU,QAAQ,KAAK,IAAI;AACtE;AAFS;", + "names": ["MenuAnchor", "PortalPrimitive", "MenuContent", "MenuRootContentModal", "MenuRootContentNonModal", "MenuContentImpl", "MenuGroup", "MenuLabel", "MenuItem", "MenuItemImpl", "MenuCheckboxItem", "MenuRadioGroup", "MenuRadioItem", "MenuItemIndicator", "MenuSeparator", "MenuArrow", "MenuSubTrigger", "MenuSubContent"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-menu/dist/index.mjs b/e-commerce/node_modules/@radix-ui/react-menu/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..10ac48bd44116ba4ce0f131020b7d13a3a65cb0e --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-menu/dist/index.mjs @@ -0,0 +1,898 @@ +"use client"; +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// src/menu.tsx +import * as React from "react"; +import { composeEventHandlers } from "@radix-ui/primitive"; +import { createCollection } from "@radix-ui/react-collection"; +import { useComposedRefs } from "@radix-ui/react-compose-refs"; +import { createContextScope } from "@radix-ui/react-context"; +import { useDirection } from "@radix-ui/react-direction"; +import { DismissableLayer } from "@radix-ui/react-dismissable-layer"; +import { useFocusGuards } from "@radix-ui/react-focus-guards"; +import { + FocusScope, + FocusScopeBranchProvider, + useFocusScopeBranch, + useFocusScopeBranchRegistry +} from "@radix-ui/react-focus-scope"; +import { useId } from "@radix-ui/react-id"; +import * as PopperPrimitive from "@radix-ui/react-popper"; +import { createPopperScope } from "@radix-ui/react-popper"; +import { Portal as PortalPrimitive } from "@radix-ui/react-portal"; +import { Presence } from "@radix-ui/react-presence"; +import { Primitive, dispatchDiscreteCustomEvent } from "@radix-ui/react-primitive"; +import * as RovingFocusGroup from "@radix-ui/react-roving-focus"; +import { createRovingFocusGroupScope } from "@radix-ui/react-roving-focus"; +import { createSlot } from "@radix-ui/react-slot"; +import { useCallbackRef } from "@radix-ui/react-use-callback-ref"; +import { hideOthers } from "aria-hidden"; +import { RemoveScroll } from "react-remove-scroll"; +import { jsx } from "react/jsx-runtime"; +var Direction = { + LTR: "ltr", + RTL: "rtl" +}; +var SELECTION_KEYS = ["Enter", " "]; +var FIRST_KEYS = ["ArrowDown", "PageUp", "Home"]; +var LAST_KEYS = ["ArrowUp", "PageDown", "End"]; +var FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS]; +var SUB_OPEN_KEYS = { + ltr: [...SELECTION_KEYS, "ArrowRight"], + rtl: [...SELECTION_KEYS, "ArrowLeft"] +}; +var SUB_CLOSE_KEYS = { + ltr: ["ArrowLeft"], + rtl: ["ArrowRight"] +}; +var MENU_NAME = "Menu"; +var [Collection, useCollection, createCollectionScope] = createCollection(MENU_NAME); +var [createMenuContext, createMenuScope] = createContextScope(MENU_NAME, [ + createCollectionScope, + createPopperScope, + createRovingFocusGroupScope +]); +var usePopperScope = createPopperScope(); +var useRovingFocusGroupScope = createRovingFocusGroupScope(); +var [MenuProvider, useMenuContext] = createMenuContext(MENU_NAME); +var [MenuRootProvider, useMenuRootContext] = createMenuContext(MENU_NAME); +var Menu = /* @__PURE__ */ __name((props) => { + const { __scopeMenu, open = false, children, dir, onOpenChange, modal = true } = props; + const popperScope = usePopperScope(__scopeMenu); + const [content, setContent] = React.useState(null); + const isUsingKeyboardRef = React.useRef(false); + const handleOpenChange = useCallbackRef(onOpenChange); + const direction = useDirection(dir); + React.useEffect(() => { + const handleKeyDown = /* @__PURE__ */ __name(() => { + isUsingKeyboardRef.current = true; + document.addEventListener("pointerdown", handlePointer, { capture: true, once: true }); + document.addEventListener("pointermove", handlePointer, { capture: true, once: true }); + }, "handleKeyDown"); + const handlePointer = /* @__PURE__ */ __name(() => isUsingKeyboardRef.current = false, "handlePointer"); + document.addEventListener("keydown", handleKeyDown, { capture: true }); + return () => { + document.removeEventListener("keydown", handleKeyDown, { capture: true }); + document.removeEventListener("pointerdown", handlePointer, { capture: true }); + document.removeEventListener("pointermove", handlePointer, { capture: true }); + }; + }, []); + React.useEffect(() => { + if (!open) { + return; + } + const handleBlur = /* @__PURE__ */ __name(() => handleOpenChange(false), "handleBlur"); + window.addEventListener("blur", handleBlur); + return () => window.removeEventListener("blur", handleBlur); + }, [open, handleOpenChange]); + return /* @__PURE__ */ jsx(PopperPrimitive.Root, { ...popperScope, children: /* @__PURE__ */ jsx( + MenuProvider, + { + scope: __scopeMenu, + open, + onOpenChange: handleOpenChange, + content, + onContentChange: setContent, + children: /* @__PURE__ */ jsx( + MenuRootProvider, + { + scope: __scopeMenu, + onClose: React.useCallback(() => handleOpenChange(false), [handleOpenChange]), + isUsingKeyboardRef, + dir: direction, + modal, + children + } + ) + } + ) }); +}, "Menu"); +var MenuAnchor = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuAnchor2(props, forwardedRef) { + const { __scopeMenu, ...anchorProps } = props; + const popperScope = usePopperScope(__scopeMenu); + return /* @__PURE__ */ jsx(PopperPrimitive.Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef }); + }, "MenuAnchor") +); +var PORTAL_NAME = "MenuPortal"; +var [PortalProvider, usePortalContext] = createMenuContext(PORTAL_NAME, { + forceMount: void 0 +}); +var MenuPortal = /* @__PURE__ */ __name((props) => { + const { __scopeMenu, forceMount, children, container } = props; + const context = useMenuContext(PORTAL_NAME, __scopeMenu); + return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopeMenu, forceMount, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(PortalPrimitive, { asChild: true, container, children }) }) }); +}, "MenuPortal"); +var CONTENT_NAME = "MenuContent"; +var [MenuContentProvider, useMenuContentContext] = createMenuContext(CONTENT_NAME); +var MenuContent = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuContent2(props, forwardedRef) { + const portalContext = usePortalContext(CONTENT_NAME, props.__scopeMenu); + const { forceMount = portalContext.forceMount, ...contentProps } = props; + const context = useMenuContext(CONTENT_NAME, props.__scopeMenu); + const rootContext = useMenuRootContext(CONTENT_NAME, props.__scopeMenu); + return /* @__PURE__ */ jsx(Collection.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: props.__scopeMenu, children: rootContext.modal ? /* @__PURE__ */ jsx(MenuRootContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(MenuRootContentNonModal, { ...contentProps, ref: forwardedRef }) }) }) }); + }, "MenuContent") +); +var MenuRootContentModal = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function MenuRootContentModal2(props, forwardedRef) { + const context = useMenuContext(CONTENT_NAME, props.__scopeMenu); + const ref = React.useRef(null); + const composedRefs = useComposedRefs(forwardedRef, ref); + React.useEffect(() => { + const content = ref.current; + if (content) return hideOthers(content); + }, []); + return /* @__PURE__ */ jsx( + MenuContentImpl, + { + ...props, + ref: composedRefs, + trapFocus: context.open, + disableOutsidePointerEvents: context.open, + disableOutsideScroll: true, + onFocusOutside: composeEventHandlers( + props.onFocusOutside, + (event) => event.preventDefault(), + { checkForDefaultPrevented: false } + ), + onDismiss: () => context.onOpenChange(false) + } + ); + }, "MenuRootContentModal") +); +var MenuRootContentNonModal = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function MenuRootContentNonModal2(props, forwardedRef) { + const context = useMenuContext(CONTENT_NAME, props.__scopeMenu); + return /* @__PURE__ */ jsx( + MenuContentImpl, + { + ...props, + ref: forwardedRef, + trapFocus: false, + disableOutsidePointerEvents: false, + disableOutsideScroll: false, + onDismiss: () => context.onOpenChange(false) + } + ); +}, "MenuRootContentNonModal")); +var Slot = createSlot("MenuContent.ScrollLock"); +var MenuContentImpl = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function MenuContentImpl2(props, forwardedRef) { + const { + __scopeMenu, + loop = false, + trapFocus, + onOpenAutoFocus, + onCloseAutoFocus, + disableOutsidePointerEvents, + onEntryFocus, + onEscapeKeyDown, + onPointerDownOutside, + onFocusOutside, + onInteractOutside, + onDismiss, + disableOutsideScroll, + ...contentProps + } = props; + const context = useMenuContext(CONTENT_NAME, __scopeMenu); + const rootContext = useMenuRootContext(CONTENT_NAME, __scopeMenu); + const popperScope = usePopperScope(__scopeMenu); + const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu); + const getItems = useCollection(__scopeMenu); + const [currentItemId, setCurrentItemId] = React.useState(null); + const contentRef = React.useRef(null); + const [branchNode, setBranchNode] = React.useState(null); + useFocusScopeBranch(branchNode); + const { nodes: branchNodes, registry: branchRegistry } = useFocusScopeBranchRegistry(); + const isModal = Boolean(trapFocus || disableOutsideScroll); + const composedRefs = useComposedRefs( + forwardedRef, + contentRef, + context.onContentChange, + setBranchNode + ); + const timerRef = React.useRef(0); + const searchRef = React.useRef(""); + const pointerGraceTimerRef = React.useRef(0); + const pointerGraceIntentRef = React.useRef(null); + const pointerDirRef = React.useRef("right"); + const lastPointerXRef = React.useRef(0); + const shards = React.useMemo( + () => disableOutsideScroll ? [contentRef, ...branchNodes.map((node) => ({ current: node }))] : [], + [contentRef, branchNodes, disableOutsideScroll] + ); + const ScrollLockWrapper = disableOutsideScroll ? RemoveScroll : React.Fragment; + const scrollLockWrapperProps = disableOutsideScroll ? { + as: Slot, + allowPinchZoom: true, + shards + } : void 0; + const handleTypeaheadSearch = /* @__PURE__ */ __name((key) => { + const search = searchRef.current + key; + const items = getItems().filter((item) => !item.disabled); + const currentItem = document.activeElement; + const currentMatch = items.find((item) => item.ref.current === currentItem)?.textValue; + const values = items.map((item) => item.textValue); + const nextMatch = getNextMatch(values, search, currentMatch); + const newItem = items.find((item) => item.textValue === nextMatch)?.ref.current; + function updateSearch(value) { + searchRef.current = value; + window.clearTimeout(timerRef.current); + if (value !== "") timerRef.current = window.setTimeout(() => updateSearch(""), 1e3); + } + __name(updateSearch, "updateSearch"); + updateSearch(search); + if (newItem) { + setTimeout(() => newItem.focus()); + } + }, "handleTypeaheadSearch"); + React.useEffect(() => { + return () => window.clearTimeout(timerRef.current); + }, []); + useFocusGuards(); + const isPointerMovingToSubmenu = React.useCallback((event) => { + const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side; + return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area); + }, []); + return /* @__PURE__ */ jsx( + MenuContentProvider, + { + scope: __scopeMenu, + searchRef, + onItemEnter: React.useCallback( + (event) => { + if (isPointerMovingToSubmenu(event)) event.preventDefault(); + }, + [isPointerMovingToSubmenu] + ), + onItemLeave: React.useCallback( + (event) => { + if (isPointerMovingToSubmenu(event)) return; + contentRef.current?.focus(); + setCurrentItemId(null); + }, + [isPointerMovingToSubmenu] + ), + onTriggerLeave: React.useCallback( + (event) => { + if (isPointerMovingToSubmenu(event)) event.preventDefault(); + }, + [isPointerMovingToSubmenu] + ), + pointerGraceTimerRef, + onPointerGraceIntentChange: React.useCallback((intent) => { + pointerGraceIntentRef.current = intent; + }, []), + children: /* @__PURE__ */ jsx(FocusScopeBranchProvider, { registry: isModal ? branchRegistry : null, children: /* @__PURE__ */ jsx(ScrollLockWrapper, { ...scrollLockWrapperProps, children: /* @__PURE__ */ jsx( + FocusScope, + { + asChild: true, + trapped: trapFocus, + branches: branchNodes, + onMountAutoFocus: composeEventHandlers(onOpenAutoFocus, (event) => { + event.preventDefault(); + contentRef.current?.focus({ preventScroll: true }); + }), + onUnmountAutoFocus: onCloseAutoFocus, + children: /* @__PURE__ */ jsx( + DismissableLayer, + { + asChild: true, + disableOutsidePointerEvents, + onEscapeKeyDown, + onPointerDownOutside, + onFocusOutside, + onInteractOutside, + onDismiss, + children: /* @__PURE__ */ jsx( + RovingFocusGroup.Root, + { + asChild: true, + ...rovingFocusGroupScope, + dir: rootContext.dir, + orientation: "vertical", + loop, + currentTabStopId: currentItemId, + onCurrentTabStopIdChange: setCurrentItemId, + onEntryFocus: composeEventHandlers(onEntryFocus, (event) => { + if (!rootContext.isUsingKeyboardRef.current) event.preventDefault(); + }), + preventScrollOnEntryFocus: true, + children: /* @__PURE__ */ jsx( + PopperPrimitive.Content, + { + role: "menu", + "aria-orientation": "vertical", + "data-state": getOpenState(context.open), + "data-radix-menu-content": "", + dir: rootContext.dir, + ...popperScope, + ...contentProps, + ref: composedRefs, + style: { outline: "none", ...contentProps.style }, + onKeyDown: composeEventHandlers(contentProps.onKeyDown, (event) => { + const target = event.target; + const isKeyDownInside = target.closest("[data-radix-menu-content]") === event.currentTarget; + const isModifierKey = event.ctrlKey || event.altKey || event.metaKey; + const isCharacterKey = event.key.length === 1; + if (isKeyDownInside) { + if (event.key === "Tab") event.preventDefault(); + if (!isModifierKey && isCharacterKey) handleTypeaheadSearch(event.key); + } + const content = contentRef.current; + if (event.target !== content) return; + if (!FIRST_LAST_KEYS.includes(event.key)) return; + event.preventDefault(); + const items = getItems().filter((item) => !item.disabled); + const candidateNodes = items.map((item) => item.ref.current); + if (LAST_KEYS.includes(event.key)) candidateNodes.reverse(); + focusFirst(candidateNodes); + }), + onBlur: composeEventHandlers(props.onBlur, (event) => { + if (!event.currentTarget.contains(event.target)) { + window.clearTimeout(timerRef.current); + searchRef.current = ""; + } + }), + onPointerMove: composeEventHandlers( + props.onPointerMove, + whenMouse((event) => { + const target = event.target; + const pointerXHasChanged = lastPointerXRef.current !== event.clientX; + if (event.currentTarget.contains(target) && pointerXHasChanged) { + const newDir = event.clientX > lastPointerXRef.current ? "right" : "left"; + pointerDirRef.current = newDir; + lastPointerXRef.current = event.clientX; + } + }) + ) + } + ) + } + ) + } + ) + } + ) }) }) + } + ); + }, "MenuContentImpl") +); +var MenuGroup = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuGroup2(props, forwardedRef) { + const { __scopeMenu, ...groupProps } = props; + return /* @__PURE__ */ jsx(Primitive.div, { role: "group", ...groupProps, ref: forwardedRef }); + }, "MenuGroup") +); +var MenuLabel = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuLabel2(props, forwardedRef) { + const { __scopeMenu, ...labelProps } = props; + return /* @__PURE__ */ jsx(Primitive.div, { ...labelProps, ref: forwardedRef }); + }, "MenuLabel") +); +var ITEM_NAME = "MenuItem"; +var ITEM_SELECT = "menu.itemSelect"; +var MenuItem = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function MenuItem2(props, forwardedRef) { + const { disabled = false, onSelect, ...itemProps } = props; + const ref = React.useRef(null); + const rootContext = useMenuRootContext(ITEM_NAME, props.__scopeMenu); + const contentContext = useMenuContentContext(ITEM_NAME, props.__scopeMenu); + const composedRefs = useComposedRefs(forwardedRef, ref); + const isPointerDownRef = React.useRef(false); + const handleSelect = /* @__PURE__ */ __name(() => { + const menuItem = ref.current; + if (!disabled && menuItem) { + const itemSelectEvent = new CustomEvent(ITEM_SELECT, { bubbles: true, cancelable: true }); + menuItem.addEventListener(ITEM_SELECT, (event) => onSelect?.(event), { once: true }); + dispatchDiscreteCustomEvent(menuItem, itemSelectEvent); + if (itemSelectEvent.defaultPrevented) { + isPointerDownRef.current = false; + } else { + rootContext.onClose(); + } + } + }, "handleSelect"); + return /* @__PURE__ */ jsx( + MenuItemImpl, + { + ...itemProps, + ref: composedRefs, + disabled, + onClick: composeEventHandlers(props.onClick, handleSelect), + onPointerDown: (event) => { + props.onPointerDown?.(event); + isPointerDownRef.current = true; + }, + onPointerUp: composeEventHandlers(props.onPointerUp, (event) => { + if (!isPointerDownRef.current) event.currentTarget?.click(); + }), + onKeyDown: composeEventHandlers(props.onKeyDown, (event) => { + if (disabled || event.target !== event.currentTarget) { + return; + } + const isTypingAhead = contentContext.searchRef.current !== ""; + if (isTypingAhead && event.key === " ") { + return; + } + if (SELECTION_KEYS.includes(event.key)) { + event.currentTarget.click(); + event.preventDefault(); + } + }) + } + ); + }, "MenuItem") +); +var MenuItemImpl = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuItemImpl2(props, forwardedRef) { + const { __scopeMenu, disabled = false, textValue, ...itemProps } = props; + const contentContext = useMenuContentContext(ITEM_NAME, __scopeMenu); + const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu); + const ref = React.useRef(null); + const composedRefs = useComposedRefs(forwardedRef, ref); + const [isFocused, setIsFocused] = React.useState(false); + const [textContent, setTextContent] = React.useState(""); + React.useEffect(() => { + const menuItem = ref.current; + if (menuItem) { + setTextContent((menuItem.textContent ?? "").trim()); + } + }, [itemProps.children]); + return /* @__PURE__ */ jsx( + Collection.ItemSlot, + { + scope: __scopeMenu, + disabled, + textValue: textValue ?? textContent, + children: /* @__PURE__ */ jsx(RovingFocusGroup.Item, { asChild: true, ...rovingFocusGroupScope, focusable: !disabled, children: /* @__PURE__ */ jsx( + Primitive.div, + { + role: "menuitem", + "data-highlighted": isFocused ? "" : void 0, + "aria-disabled": disabled || void 0, + "data-disabled": disabled ? "" : void 0, + ...itemProps, + ref: composedRefs, + onPointerMove: composeEventHandlers( + props.onPointerMove, + whenMouse((event) => { + if (disabled) { + contentContext.onItemLeave(event); + } else { + contentContext.onItemEnter(event); + if (!event.defaultPrevented) { + const item = event.currentTarget; + item.focus({ preventScroll: true }); + } + } + }) + ), + onPointerLeave: composeEventHandlers( + props.onPointerLeave, + whenMouse((event) => contentContext.onItemLeave(event)) + ), + onFocus: composeEventHandlers(props.onFocus, () => setIsFocused(true)), + onBlur: composeEventHandlers(props.onBlur, () => setIsFocused(false)) + } + ) }) + } + ); + }, "MenuItemImpl") +); +var MenuCheckboxItem = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function MenuCheckboxItem2(props, forwardedRef) { + const { checked = false, onCheckedChange, ...checkboxItemProps } = props; + return /* @__PURE__ */ jsx(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ jsx( + MenuItem, + { + role: "menuitemcheckbox", + "aria-checked": isIndeterminate(checked) ? "mixed" : checked, + ...checkboxItemProps, + ref: forwardedRef, + "data-state": getCheckedState(checked), + onSelect: composeEventHandlers( + checkboxItemProps.onSelect, + () => onCheckedChange?.(isIndeterminate(checked) ? true : !checked), + { checkForDefaultPrevented: false } + ) + } + ) }); + }, "MenuCheckboxItem") +); +var RADIO_GROUP_NAME = "MenuRadioGroup"; +var [RadioGroupProvider, useRadioGroupContext] = createMenuContext( + RADIO_GROUP_NAME, + { value: void 0, onValueChange: /* @__PURE__ */ __name(() => { + }, "onValueChange") } +); +var MenuRadioGroup = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuRadioGroup2(props, forwardedRef) { + const { value, onValueChange, ...groupProps } = props; + const handleValueChange = useCallbackRef(onValueChange); + return /* @__PURE__ */ jsx(RadioGroupProvider, { scope: props.__scopeMenu, value, onValueChange: handleValueChange, children: /* @__PURE__ */ jsx(MenuGroup, { ...groupProps, ref: forwardedRef }) }); + }, "MenuRadioGroup") +); +var RADIO_ITEM_NAME = "MenuRadioItem"; +var MenuRadioItem = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuRadioItem2(props, forwardedRef) { + const { value, ...radioItemProps } = props; + const context = useRadioGroupContext(RADIO_ITEM_NAME, props.__scopeMenu); + const checked = value === context.value; + return /* @__PURE__ */ jsx(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ jsx( + MenuItem, + { + role: "menuitemradio", + "aria-checked": checked, + ...radioItemProps, + ref: forwardedRef, + "data-state": getCheckedState(checked), + onSelect: composeEventHandlers( + radioItemProps.onSelect, + () => context.onValueChange?.(value), + { checkForDefaultPrevented: false } + ) + } + ) }); + }, "MenuRadioItem") +); +var ITEM_INDICATOR_NAME = "MenuItemIndicator"; +var [ItemIndicatorProvider, useItemIndicatorContext] = createMenuContext( + ITEM_INDICATOR_NAME, + { checked: false } +); +var MenuItemIndicator = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function MenuItemIndicator2(props, forwardedRef) { + const { __scopeMenu, forceMount, ...itemIndicatorProps } = props; + const indicatorContext = useItemIndicatorContext(ITEM_INDICATOR_NAME, __scopeMenu); + return /* @__PURE__ */ jsx( + Presence, + { + present: forceMount || isIndeterminate(indicatorContext.checked) || indicatorContext.checked === true, + children: /* @__PURE__ */ jsx( + Primitive.span, + { + ...itemIndicatorProps, + ref: forwardedRef, + "data-state": getCheckedState(indicatorContext.checked) + } + ) + } + ); + }, "MenuItemIndicator") +); +var MenuSeparator = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuSeparator2(props, forwardedRef) { + const { __scopeMenu, ...separatorProps } = props; + return /* @__PURE__ */ jsx( + Primitive.div, + { + role: "separator", + "aria-orientation": "horizontal", + ...separatorProps, + ref: forwardedRef + } + ); + }, "MenuSeparator") +); +var MenuArrow = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuArrow2(props, forwardedRef) { + const { __scopeMenu, ...arrowProps } = props; + const popperScope = usePopperScope(__scopeMenu); + return /* @__PURE__ */ jsx(PopperPrimitive.Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef }); + }, "MenuArrow") +); +var SUB_NAME = "MenuSub"; +var [MenuSubProvider, useMenuSubContext] = createMenuContext(SUB_NAME); +var MenuSub = /* @__PURE__ */ __name((props) => { + const { __scopeMenu, children, open = false, onOpenChange } = props; + const parentMenuContext = useMenuContext(SUB_NAME, __scopeMenu); + const popperScope = usePopperScope(__scopeMenu); + const [trigger, setTrigger] = React.useState(null); + const [content, setContent] = React.useState(null); + const handleOpenChange = useCallbackRef(onOpenChange); + React.useEffect(() => { + if (parentMenuContext.open === false) handleOpenChange(false); + return () => handleOpenChange(false); + }, [parentMenuContext.open, handleOpenChange]); + return /* @__PURE__ */ jsx(PopperPrimitive.Root, { ...popperScope, children: /* @__PURE__ */ jsx( + MenuProvider, + { + scope: __scopeMenu, + open, + onOpenChange: handleOpenChange, + content, + onContentChange: setContent, + children: /* @__PURE__ */ jsx( + MenuSubProvider, + { + scope: __scopeMenu, + contentId: useId(), + triggerId: useId(), + trigger, + onTriggerChange: setTrigger, + children + } + ) + } + ) }); +}, "MenuSub"); +var SUB_TRIGGER_NAME = "MenuSubTrigger"; +var MenuSubTrigger = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuSubTrigger2(props, forwardedRef) { + const context = useMenuContext(SUB_TRIGGER_NAME, props.__scopeMenu); + const rootContext = useMenuRootContext(SUB_TRIGGER_NAME, props.__scopeMenu); + const subContext = useMenuSubContext(SUB_TRIGGER_NAME, props.__scopeMenu); + const contentContext = useMenuContentContext(SUB_TRIGGER_NAME, props.__scopeMenu); + const openTimerRef = React.useRef(null); + const { pointerGraceTimerRef, onPointerGraceIntentChange } = contentContext; + const scope = { __scopeMenu: props.__scopeMenu }; + const clearOpenTimer = React.useCallback(() => { + if (openTimerRef.current) window.clearTimeout(openTimerRef.current); + openTimerRef.current = null; + }, []); + React.useEffect(() => clearOpenTimer, [clearOpenTimer]); + React.useEffect(() => { + const pointerGraceTimer = pointerGraceTimerRef.current; + return () => { + window.clearTimeout(pointerGraceTimer); + onPointerGraceIntentChange(null); + }; + }, [pointerGraceTimerRef, onPointerGraceIntentChange]); + const composedRefs = useComposedRefs(forwardedRef, subContext.onTriggerChange); + return /* @__PURE__ */ jsx(MenuAnchor, { asChild: true, ...scope, children: /* @__PURE__ */ jsx( + MenuItemImpl, + { + id: subContext.triggerId, + "aria-haspopup": "menu", + "aria-expanded": context.open, + "aria-controls": context.open ? subContext.contentId : void 0, + "data-state": getOpenState(context.open), + ...props, + ref: composedRefs, + onClick: (event) => { + props.onClick?.(event); + if (props.disabled || event.defaultPrevented) return; + event.currentTarget.focus(); + if (!context.open) context.onOpenChange(true); + }, + onPointerMove: composeEventHandlers( + props.onPointerMove, + whenMouse((event) => { + contentContext.onItemEnter(event); + if (event.defaultPrevented) return; + if (!props.disabled && !context.open && !openTimerRef.current) { + contentContext.onPointerGraceIntentChange(null); + openTimerRef.current = window.setTimeout(() => { + context.onOpenChange(true); + clearOpenTimer(); + }, 100); + } + }) + ), + onPointerLeave: composeEventHandlers( + props.onPointerLeave, + whenMouse((event) => { + clearOpenTimer(); + const contentRect = context.content?.getBoundingClientRect(); + if (contentRect) { + const side = context.content?.dataset.side; + const rightSide = side === "right"; + const bleed = rightSide ? -5 : 5; + const contentNearEdge = contentRect[rightSide ? "left" : "right"]; + const contentFarEdge = contentRect[rightSide ? "right" : "left"]; + contentContext.onPointerGraceIntentChange({ + area: [ + // Apply a bleed on clientX to ensure that our exit point is + // consistently within polygon bounds + { x: event.clientX + bleed, y: event.clientY }, + { x: contentNearEdge, y: contentRect.top }, + { x: contentFarEdge, y: contentRect.top }, + { x: contentFarEdge, y: contentRect.bottom }, + { x: contentNearEdge, y: contentRect.bottom } + ], + side + }); + window.clearTimeout(pointerGraceTimerRef.current); + pointerGraceTimerRef.current = window.setTimeout( + () => contentContext.onPointerGraceIntentChange(null), + 300 + ); + } else { + contentContext.onTriggerLeave(event); + if (event.defaultPrevented) return; + contentContext.onPointerGraceIntentChange(null); + } + }) + ), + onKeyDown: composeEventHandlers(props.onKeyDown, (event) => { + if (props.disabled || event.target !== event.currentTarget) { + return; + } + const isTypingAhead = contentContext.searchRef.current !== ""; + if (isTypingAhead && event.key === " ") { + return; + } + if (SUB_OPEN_KEYS[rootContext.dir].includes(event.key)) { + context.onOpenChange(true); + context.content?.focus(); + event.preventDefault(); + } + }) + } + ) }); + }, "MenuSubTrigger") +); +var SUB_CONTENT_NAME = "MenuSubContent"; +var MenuSubContent = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function MenuSubContent2(props, forwardedRef) { + const portalContext = usePortalContext(CONTENT_NAME, props.__scopeMenu); + const { forceMount = portalContext.forceMount, align = "start", ...subContentProps } = props; + const context = useMenuContext(CONTENT_NAME, props.__scopeMenu); + const rootContext = useMenuRootContext(CONTENT_NAME, props.__scopeMenu); + const subContext = useMenuSubContext(SUB_CONTENT_NAME, props.__scopeMenu); + const ref = React.useRef(null); + const composedRefs = useComposedRefs(forwardedRef, ref); + return /* @__PURE__ */ jsx(Collection.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx( + MenuContentImpl, + { + id: subContext.contentId, + "aria-labelledby": subContext.triggerId, + ...subContentProps, + ref: composedRefs, + align, + side: rootContext.dir === Direction.RTL ? "left" : "right", + disableOutsidePointerEvents: false, + disableOutsideScroll: false, + trapFocus: false, + onOpenAutoFocus: (event) => { + if (rootContext.isUsingKeyboardRef.current) ref.current?.focus(); + event.preventDefault(); + }, + onCloseAutoFocus: (event) => event.preventDefault(), + onFocusOutside: composeEventHandlers(props.onFocusOutside, (event) => { + if (event.target !== subContext.trigger) context.onOpenChange(false); + }), + onEscapeKeyDown: composeEventHandlers(props.onEscapeKeyDown, (event) => { + rootContext.onClose(); + event.preventDefault(); + }), + onKeyDown: composeEventHandlers(props.onKeyDown, (event) => { + const isKeyDownInside = event.currentTarget.contains(event.target); + const isCloseKey = SUB_CLOSE_KEYS[rootContext.dir].includes(event.key); + if (isKeyDownInside && isCloseKey) { + context.onOpenChange(false); + subContext.trigger?.focus(); + event.preventDefault(); + } + }) + } + ) }) }) }); + }, "MenuSubContent") +); +function getOpenState(open) { + return open ? "open" : "closed"; +} +__name(getOpenState, "getOpenState"); +function isIndeterminate(checked) { + return checked === "indeterminate"; +} +__name(isIndeterminate, "isIndeterminate"); +function getCheckedState(checked) { + return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked"; +} +__name(getCheckedState, "getCheckedState"); +function focusFirst(candidates) { + const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement; + for (const candidate of candidates) { + if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return; + candidate.focus(); + if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return; + } +} +__name(focusFirst, "focusFirst"); +function wrapArray(array, startIndex) { + return array.map((_, index) => array[(startIndex + index) % array.length]); +} +__name(wrapArray, "wrapArray"); +function getNextMatch(values, search, currentMatch) { + const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]); + const normalizedSearch = isRepeated ? search[0] : search; + const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1; + let wrappedValues = wrapArray(values, Math.max(currentMatchIndex, 0)); + const excludeCurrentMatch = normalizedSearch.length === 1; + if (excludeCurrentMatch) wrappedValues = wrappedValues.filter((v) => v !== currentMatch); + const nextMatch = wrappedValues.find( + (value) => value.toLowerCase().startsWith(normalizedSearch.toLowerCase()) + ); + return nextMatch !== currentMatch ? nextMatch : void 0; +} +__name(getNextMatch, "getNextMatch"); +function isPointInPolygon(point, polygon) { + const { x, y } = point; + let inside = false; + for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) { + const ii = polygon[i]; + const jj = polygon[j]; + const xi = ii.x; + const yi = ii.y; + const xj = jj.x; + const yj = jj.y; + const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi; + if (intersect) inside = !inside; + } + return inside; +} +__name(isPointInPolygon, "isPointInPolygon"); +function isPointerInGraceArea(event, area) { + if (!area) return false; + const cursorPos = { x: event.clientX, y: event.clientY }; + return isPointInPolygon(cursorPos, area); +} +__name(isPointerInGraceArea, "isPointerInGraceArea"); +function whenMouse(handler) { + return (event) => event.pointerType === "mouse" ? handler(event) : void 0; +} +__name(whenMouse, "whenMouse"); +export { + MenuAnchor as Anchor, + MenuArrow as Arrow, + MenuCheckboxItem as CheckboxItem, + MenuContent as Content, + MenuGroup as Group, + MenuItem as Item, + MenuItemIndicator as ItemIndicator, + MenuLabel as Label, + Menu, + MenuAnchor, + MenuArrow, + MenuCheckboxItem, + MenuContent, + MenuGroup, + MenuItem, + MenuItemIndicator, + MenuLabel, + MenuPortal, + MenuRadioGroup, + MenuRadioItem, + MenuSeparator, + MenuSub, + MenuSubContent, + MenuSubTrigger, + MenuPortal as Portal, + MenuRadioGroup as RadioGroup, + MenuRadioItem as RadioItem, + Menu as Root, + MenuSeparator as Separator, + MenuSub as Sub, + MenuSubContent as SubContent, + MenuSubTrigger as SubTrigger, + createMenuScope +}; +//# sourceMappingURL=index.mjs.map diff --git a/e-commerce/node_modules/@radix-ui/react-menu/dist/index.mjs.map b/e-commerce/node_modules/@radix-ui/react-menu/dist/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..0a13f07f6985c92badd24823befd5bd8ea78d407 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-menu/dist/index.mjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/menu.tsx"], + "sourcesContent": ["import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createCollection } from '@radix-ui/react-collection';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useDirection } from '@radix-ui/react-direction';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport {\n FocusScope,\n FocusScopeBranchProvider,\n useFocusScopeBranch,\n useFocusScopeBranchRegistry,\n} from '@radix-ui/react-focus-scope';\nimport { useId } from '@radix-ui/react-id';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { createPopperScope } from '@radix-ui/react-popper';\nimport { Portal as PortalPrimitive } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive, dispatchDiscreteCustomEvent } from '@radix-ui/react-primitive';\nimport * as RovingFocusGroup from '@radix-ui/react-roving-focus';\nimport { createRovingFocusGroupScope } from '@radix-ui/react-roving-focus';\nimport { createSlot } from '@radix-ui/react-slot';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { hideOthers } from 'aria-hidden';\nimport { RemoveScroll } from 'react-remove-scroll';\n\nimport type { Scope } from '@radix-ui/react-context';\n\nconst Direction = {\n LTR: 'ltr',\n RTL: 'rtl',\n} as const;\n\ntype Direction = (typeof Direction)[keyof typeof Direction];\n\nconst SELECTION_KEYS = ['Enter', ' '];\nconst FIRST_KEYS = ['ArrowDown', 'PageUp', 'Home'];\nconst LAST_KEYS = ['ArrowUp', 'PageDown', 'End'];\nconst FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];\nconst SUB_OPEN_KEYS: Record = {\n ltr: [...SELECTION_KEYS, 'ArrowRight'],\n rtl: [...SELECTION_KEYS, 'ArrowLeft'],\n};\nconst SUB_CLOSE_KEYS: Record = {\n ltr: ['ArrowLeft'],\n rtl: ['ArrowRight'],\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Menu\n * -----------------------------------------------------------------------------------------------*/\n\nconst MENU_NAME = 'Menu';\n\ntype ItemData = { disabled: boolean; textValue: string };\nconst [Collection, useCollection, createCollectionScope] = createCollection<\n MenuItemElement,\n ItemData\n>(MENU_NAME);\n\ntype ScopedProps

= P & { __scopeMenu?: Scope | undefined };\nconst [createMenuContext, createMenuScope] = createContextScope(MENU_NAME, [\n createCollectionScope,\n createPopperScope,\n createRovingFocusGroupScope,\n]);\nconst usePopperScope = createPopperScope();\nconst useRovingFocusGroupScope = createRovingFocusGroupScope();\n\ntype MenuContextValue = {\n open: boolean;\n onOpenChange(open: boolean): void;\n content: MenuContentElement | null;\n onContentChange(content: MenuContentElement | null): void;\n};\n\nconst [MenuProvider, useMenuContext] = createMenuContext(MENU_NAME);\n\ntype MenuRootContextValue = {\n onClose(): void;\n isUsingKeyboardRef: React.RefObject;\n dir: Direction;\n modal: boolean;\n};\n\nconst [MenuRootProvider, useMenuRootContext] = createMenuContext(MENU_NAME);\n\ninterface MenuProps {\n children?: React.ReactNode | undefined;\n open?: boolean | undefined;\n onOpenChange?: ((open: boolean) => void) | undefined;\n dir?: Direction | undefined;\n modal?: boolean | undefined;\n}\n\nconst Menu: React.FC = (props: ScopedProps) => {\n const { __scopeMenu, open = false, children, dir, onOpenChange, modal = true } = props;\n const popperScope = usePopperScope(__scopeMenu);\n const [content, setContent] = React.useState(null);\n const isUsingKeyboardRef = React.useRef(false);\n const handleOpenChange = useCallbackRef(onOpenChange);\n const direction = useDirection(dir);\n\n React.useEffect(() => {\n // Capture phase ensures we set the boolean before any side effects execute\n // in response to the key or pointer event as they might depend on this value.\n const handleKeyDown = () => {\n isUsingKeyboardRef.current = true;\n document.addEventListener('pointerdown', handlePointer, { capture: true, once: true });\n document.addEventListener('pointermove', handlePointer, { capture: true, once: true });\n };\n const handlePointer = () => (isUsingKeyboardRef.current = false);\n document.addEventListener('keydown', handleKeyDown, { capture: true });\n return () => {\n document.removeEventListener('keydown', handleKeyDown, { capture: true });\n document.removeEventListener('pointerdown', handlePointer, { capture: true });\n document.removeEventListener('pointermove', handlePointer, { capture: true });\n };\n }, []);\n\n // Close the menu (and any open submenus) when the window loses focus, e.g. when\n // switching to another browser tab or application. Without this, submenus would\n // remain open when the page is re-focused, leaving the menu in an inconsistent state.\n // See: https://github.com/radix-ui/primitives/issues/3257\n React.useEffect(() => {\n if (!open) {\n return;\n }\n const handleBlur = () => handleOpenChange(false);\n window.addEventListener('blur', handleBlur);\n return () => window.removeEventListener('blur', handleBlur);\n }, [open, handleOpenChange]);\n\n return (\n \n \n handleOpenChange(false), [handleOpenChange])}\n isUsingKeyboardRef={isUsingKeyboardRef}\n dir={direction}\n modal={modal}\n >\n {children}\n \n \n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * MenuAnchor\n * -----------------------------------------------------------------------------------------------*/\n\ntype MenuAnchorElement = React.ComponentRef;\ntype PopperAnchorProps = React.ComponentPropsWithoutRef;\ninterface MenuAnchorProps extends PopperAnchorProps {}\n\nconst MenuAnchor = /* @__PURE__ */ React.forwardRef(\n function MenuAnchor(props: ScopedProps, forwardedRef) {\n const { __scopeMenu, ...anchorProps } = props;\n const popperScope = usePopperScope(__scopeMenu);\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'MenuPortal';\n\ntype PortalContextValue = { forceMount?: true | undefined };\nconst [PortalProvider, usePortalContext] = createMenuContext(PORTAL_NAME, {\n forceMount: undefined,\n});\n\ntype PortalProps = React.ComponentPropsWithoutRef;\ninterface MenuPortalProps {\n children?: React.ReactNode | undefined;\n /**\n * Specify a container element to portal the content into.\n */\n container?: PortalProps['container'] | undefined;\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst MenuPortal: React.FC = (props: ScopedProps) => {\n const { __scopeMenu, forceMount, children, container } = props;\n const context = useMenuContext(PORTAL_NAME, __scopeMenu);\n return (\n \n \n \n {children}\n \n \n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * MenuContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'MenuContent';\n\ntype MenuContentContextValue = {\n onItemEnter(event: React.PointerEvent): void;\n onItemLeave(event: React.PointerEvent): void;\n onTriggerLeave(event: React.PointerEvent): void;\n searchRef: React.RefObject;\n pointerGraceTimerRef: React.MutableRefObject;\n onPointerGraceIntentChange(intent: GraceIntent | null): void;\n};\nconst [MenuContentProvider, useMenuContentContext] =\n createMenuContext(CONTENT_NAME);\n\ntype MenuContentElement = MenuRootContentTypeElement;\n/**\n * We purposefully don't union MenuRootContent and MenuSubContent props here because\n * they have conflicting prop types. We agreed that we would allow MenuSubContent to\n * accept props that it would just ignore.\n */\ninterface MenuContentProps extends MenuRootContentTypeProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst MenuContent = /* @__PURE__ */ React.forwardRef(\n function MenuContent(props: ScopedProps, forwardedRef) {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopeMenu);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);\n const rootContext = useMenuRootContext(CONTENT_NAME, props.__scopeMenu);\n\n return (\n \n \n \n {rootContext.modal ? (\n \n ) : (\n \n )}\n \n \n \n );\n },\n);\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype MenuRootContentTypeElement = MenuContentImplElement;\ninterface MenuRootContentTypeProps extends Omit<\n MenuContentImplProps,\n keyof MenuContentImplPrivateProps\n> {}\n\nconst MenuRootContentModal = /* @__PURE__ */ React.forwardRef<\n MenuRootContentTypeElement,\n MenuRootContentTypeProps\n>(\n // blank line to reduce diff noise\n function MenuRootContentModal(props: ScopedProps, forwardedRef) {\n const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n\n // Hide everything from ARIA except the `MenuContent`\n React.useEffect(() => {\n const content = ref.current;\n if (content) return hideOthers(content);\n }, []);\n\n return (\n event.preventDefault(),\n { checkForDefaultPrevented: false },\n )}\n onDismiss={() => context.onOpenChange(false)}\n />\n );\n },\n);\n\nconst MenuRootContentNonModal = /* @__PURE__ */ React.forwardRef<\n MenuRootContentTypeElement,\n MenuRootContentTypeProps\n>(function MenuRootContentNonModal(props: ScopedProps, forwardedRef) {\n const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);\n return (\n context.onOpenChange(false)}\n />\n );\n});\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype MenuContentImplElement = React.ComponentRef;\ntype FocusScopeProps = React.ComponentPropsWithoutRef;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef;\ntype RovingFocusGroupProps = React.ComponentPropsWithoutRef;\ntype PopperContentProps = React.ComponentPropsWithoutRef;\ntype MenuContentImplPrivateProps = {\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'] | undefined;\n onDismiss?: DismissableLayerProps['onDismiss'] | undefined;\n disableOutsidePointerEvents?: DismissableLayerProps['disableOutsidePointerEvents'] | undefined;\n\n /**\n * Whether scrolling outside the `MenuContent` should be prevented\n * (default: `false`)\n */\n disableOutsideScroll?: boolean | undefined;\n\n /**\n * Whether focus should be trapped within the `MenuContent`\n * (default: false)\n */\n trapFocus?: FocusScopeProps['trapped'] | undefined;\n};\ninterface MenuContentImplProps\n extends MenuContentImplPrivateProps, Omit {\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'] | undefined;\n\n /**\n * Whether keyboard navigation should loop around\n * @defaultValue false\n */\n loop?: RovingFocusGroupProps['loop'] | undefined;\n\n onEntryFocus?: RovingFocusGroupProps['onEntryFocus'] | undefined;\n onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'] | undefined;\n onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'] | undefined;\n onFocusOutside?: DismissableLayerProps['onFocusOutside'] | undefined;\n onInteractOutside?: DismissableLayerProps['onInteractOutside'] | undefined;\n}\n\nconst Slot = createSlot('MenuContent.ScrollLock');\n\nconst MenuContentImpl = /* @__PURE__ */ React.forwardRef<\n MenuContentImplElement,\n MenuContentImplProps\n>(\n // blank line to reduce diff noise\n function MenuContentImpl(props: ScopedProps, forwardedRef) {\n const {\n __scopeMenu,\n loop = false,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEntryFocus,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n disableOutsideScroll,\n ...contentProps\n } = props;\n const context = useMenuContext(CONTENT_NAME, __scopeMenu);\n const rootContext = useMenuRootContext(CONTENT_NAME, __scopeMenu);\n const popperScope = usePopperScope(__scopeMenu);\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu);\n const getItems = useCollection(__scopeMenu);\n const [currentItemId, setCurrentItemId] = React.useState(null);\n const contentRef = React.useRef(null);\n\n // When this `Menu` is nested inside a modal layer (eg. a `Dialog`) but portalled outside of it,\n // register its content with the ancestor layer so focus isn't reclaimed and scroll isn't locked\n // for it (only relevant for non-modal menus, which don't trap focus / lock scroll themselves).\n // It also exposes its own registry so nested, portalled layers can do the same against it.\n // See: https://github.com/radix-ui/primitives/issues/3423\n const [branchNode, setBranchNode] = React.useState(null);\n useFocusScopeBranch(branchNode);\n const { nodes: branchNodes, registry: branchRegistry } = useFocusScopeBranchRegistry();\n // Only modal menus trap focus / lock scroll, so only they need to host branches. Non-modal\n // menus stay transparent and let nested layers register against the next modal ancestor.\n const isModal = Boolean(trapFocus || disableOutsideScroll);\n const composedRefs = useComposedRefs(\n forwardedRef,\n contentRef,\n context.onContentChange,\n setBranchNode,\n );\n const timerRef = React.useRef(0);\n const searchRef = React.useRef('');\n const pointerGraceTimerRef = React.useRef(0);\n const pointerGraceIntentRef = React.useRef(null);\n const pointerDirRef = React.useRef('right');\n const lastPointerXRef = React.useRef(0);\n const shards = React.useMemo(\n () =>\n disableOutsideScroll ? [contentRef, ...branchNodes.map((node) => ({ current: node }))] : [],\n [contentRef, branchNodes, disableOutsideScroll],\n );\n\n const ScrollLockWrapper = disableOutsideScroll ? RemoveScroll : React.Fragment;\n const scrollLockWrapperProps = disableOutsideScroll\n ? {\n as: Slot,\n allowPinchZoom: true,\n shards,\n }\n : undefined;\n\n const handleTypeaheadSearch = (key: string) => {\n const search = searchRef.current + key;\n const items = getItems().filter((item) => !item.disabled);\n const currentItem = document.activeElement;\n const currentMatch = items.find((item) => item.ref.current === currentItem)?.textValue;\n const values = items.map((item) => item.textValue);\n const nextMatch = getNextMatch(values, search, currentMatch);\n const newItem = items.find((item) => item.textValue === nextMatch)?.ref.current;\n\n // Reset `searchRef` 1 second after it was last updated\n function updateSearch(value: string) {\n searchRef.current = value;\n window.clearTimeout(timerRef.current);\n if (value !== '') timerRef.current = window.setTimeout(() => updateSearch(''), 1000);\n }\n updateSearch(search);\n\n if (newItem) {\n /**\n * Imperative focus during keydown is risky so we prevent React's batching updates\n * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332\n */\n setTimeout(() => (newItem as HTMLElement).focus());\n }\n };\n\n React.useEffect(() => {\n return () => window.clearTimeout(timerRef.current);\n }, []);\n\n // Make sure the whole tree has focus guards as our `MenuContent` may be\n // the last element in the DOM (because of the `Portal`)\n useFocusGuards();\n\n const isPointerMovingToSubmenu = React.useCallback((event: React.PointerEvent) => {\n const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side;\n return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area);\n }, []);\n\n return (\n {\n if (isPointerMovingToSubmenu(event)) event.preventDefault();\n },\n [isPointerMovingToSubmenu],\n )}\n onItemLeave={React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) return;\n contentRef.current?.focus();\n setCurrentItemId(null);\n },\n [isPointerMovingToSubmenu],\n )}\n onTriggerLeave={React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) event.preventDefault();\n },\n [isPointerMovingToSubmenu],\n )}\n pointerGraceTimerRef={pointerGraceTimerRef}\n onPointerGraceIntentChange={React.useCallback((intent) => {\n pointerGraceIntentRef.current = intent;\n }, [])}\n >\n \n \n {\n // when opening, explicitly focus the content area only and leave\n // `onEntryFocus` in control of focusing first item\n event.preventDefault();\n contentRef.current?.focus({ preventScroll: true });\n })}\n onUnmountAutoFocus={onCloseAutoFocus}\n >\n \n {\n // only focus first item when using keyboard\n if (!rootContext.isUsingKeyboardRef.current) event.preventDefault();\n })}\n preventScrollOnEntryFocus\n >\n {\n // submenu key events bubble through portals. We only care\n // about keys in this menu.\n const target = event.target as HTMLElement;\n const isKeyDownInside =\n target.closest('[data-radix-menu-content]') === event.currentTarget;\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;\n const isCharacterKey = event.key.length === 1;\n if (isKeyDownInside) {\n // menus should not be navigated using tab key so we\n // prevent it\n if (event.key === 'Tab') event.preventDefault();\n if (!isModifierKey && isCharacterKey) handleTypeaheadSearch(event.key);\n }\n // focus first/last item based on key pressed\n const content = contentRef.current;\n if (event.target !== content) return;\n if (!FIRST_LAST_KEYS.includes(event.key)) return;\n event.preventDefault();\n const items = getItems().filter((item) => !item.disabled);\n const candidateNodes = items.map((item) => item.ref.current!);\n if (LAST_KEYS.includes(event.key)) candidateNodes.reverse();\n focusFirst(candidateNodes);\n })}\n onBlur={composeEventHandlers(props.onBlur, (event) => {\n // clear search buffer when leaving the menu\n if (!event.currentTarget.contains(event.target)) {\n window.clearTimeout(timerRef.current);\n searchRef.current = '';\n }\n })}\n onPointerMove={composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n const target = event.target as HTMLElement;\n const pointerXHasChanged = lastPointerXRef.current !== event.clientX;\n\n // We don't use `event.movementX` for this check because\n // Safari will always return `0` on a pointer event.\n if (event.currentTarget.contains(target) && pointerXHasChanged) {\n const newDir = event.clientX > lastPointerXRef.current ? 'right' : 'left';\n pointerDirRef.current = newDir;\n lastPointerXRef.current = event.clientX;\n }\n }),\n )}\n />\n \n \n \n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuGroup\n * -----------------------------------------------------------------------------------------------*/\n\ntype MenuGroupElement = React.ComponentRef;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef;\ninterface MenuGroupProps extends PrimitiveDivProps {}\n\nconst MenuGroup = /* @__PURE__ */ React.forwardRef(\n function MenuGroup(props: ScopedProps, forwardedRef) {\n const { __scopeMenu, ...groupProps } = props;\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuLabel\n * -----------------------------------------------------------------------------------------------*/\n\ntype MenuLabelElement = React.ComponentRef;\ninterface MenuLabelProps extends PrimitiveDivProps {}\n\nconst MenuLabel = /* @__PURE__ */ React.forwardRef(\n function MenuLabel(props: ScopedProps, forwardedRef) {\n const { __scopeMenu, ...labelProps } = props;\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'MenuItem';\nconst ITEM_SELECT = 'menu.itemSelect';\n\ntype MenuItemElement = MenuItemImplElement;\ninterface MenuItemProps extends Omit {\n onSelect?: ((event: Event) => void) | undefined;\n}\n\nconst MenuItem = /* @__PURE__ */ React.forwardRef(\n // blank line to reduce diff noise\n function MenuItem(props: ScopedProps, forwardedRef) {\n const { disabled = false, onSelect, ...itemProps } = props;\n const ref = React.useRef(null);\n const rootContext = useMenuRootContext(ITEM_NAME, props.__scopeMenu);\n const contentContext = useMenuContentContext(ITEM_NAME, props.__scopeMenu);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const isPointerDownRef = React.useRef(false);\n\n const handleSelect = () => {\n const menuItem = ref.current;\n if (!disabled && menuItem) {\n const itemSelectEvent = new CustomEvent(ITEM_SELECT, { bubbles: true, cancelable: true });\n menuItem.addEventListener(ITEM_SELECT, (event) => onSelect?.(event), { once: true });\n dispatchDiscreteCustomEvent(menuItem, itemSelectEvent);\n if (itemSelectEvent.defaultPrevented) {\n isPointerDownRef.current = false;\n } else {\n rootContext.onClose();\n }\n }\n };\n\n return (\n {\n props.onPointerDown?.(event);\n isPointerDownRef.current = true;\n }}\n onPointerUp={composeEventHandlers(props.onPointerUp, (event) => {\n // Pointer down can move to a different menu item which should activate it on pointer up.\n // We dispatch a click for selection to allow composition with click based triggers and to\n // prevent Firefox from getting stuck in text selection mode when the menu closes.\n if (!isPointerDownRef.current) event.currentTarget?.click();\n })}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n // Only react to keys originating from the item itself. Focusable\n // descendants (eg. an `input` inside a `Dialog` rendered within the\n // item) bubble their key events here through React's event system\n // even when portaled out of the item's DOM subtree, which would\n // otherwise let the item swallow selection keys.\n // See: https://github.com/radix-ui/primitives/issues/3232\n if (disabled || event.target !== event.currentTarget) {\n return;\n }\n\n const isTypingAhead = contentContext.searchRef.current !== '';\n if (isTypingAhead && event.key === ' ') {\n return;\n }\n\n if (SELECTION_KEYS.includes(event.key)) {\n event.currentTarget.click();\n /**\n * We prevent default browser behaviour for selection keys as they should trigger\n * a selection only:\n * - prevents space from scrolling the page.\n * - if keydown causes focus to move, prevents keydown from firing on the new target.\n */\n event.preventDefault();\n }\n })}\n />\n );\n },\n);\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype MenuItemImplElement = React.ComponentRef;\ninterface MenuItemImplProps extends PrimitiveDivProps {\n disabled?: boolean | undefined;\n textValue?: string | undefined;\n}\n\nconst MenuItemImpl = /* @__PURE__ */ React.forwardRef(\n function MenuItemImpl(props: ScopedProps, forwardedRef) {\n const { __scopeMenu, disabled = false, textValue, ...itemProps } = props;\n const contentContext = useMenuContentContext(ITEM_NAME, __scopeMenu);\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const [isFocused, setIsFocused] = React.useState(false);\n\n // get the item's `.textContent` as default strategy for typeahead `textValue`\n const [textContent, setTextContent] = React.useState('');\n React.useEffect(() => {\n const menuItem = ref.current;\n if (menuItem) {\n setTextContent((menuItem.textContent ?? '').trim());\n }\n }, [itemProps.children]);\n\n return (\n \n \n {\n if (disabled) {\n contentContext.onItemLeave(event);\n } else {\n contentContext.onItemEnter(event);\n if (!event.defaultPrevented) {\n const item = event.currentTarget;\n item.focus({ preventScroll: true });\n }\n }\n }),\n )}\n onPointerLeave={composeEventHandlers(\n props.onPointerLeave,\n whenMouse((event) => contentContext.onItemLeave(event)),\n )}\n onFocus={composeEventHandlers(props.onFocus, () => setIsFocused(true))}\n onBlur={composeEventHandlers(props.onBlur, () => setIsFocused(false))}\n />\n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuCheckboxItem\n * -----------------------------------------------------------------------------------------------*/\n\ntype MenuCheckboxItemElement = MenuItemElement;\n\ntype CheckedState = boolean | 'indeterminate';\n\ninterface MenuCheckboxItemProps extends MenuItemProps {\n checked?: CheckedState | undefined;\n // `onCheckedChange` can never be called with `\"indeterminate\"` from the inside\n onCheckedChange?: ((checked: boolean) => void) | undefined;\n}\n\nconst MenuCheckboxItem = /* @__PURE__ */ React.forwardRef<\n MenuCheckboxItemElement,\n MenuCheckboxItemProps\n>(\n // blank line to reduce diff noise\n function MenuCheckboxItem(props: ScopedProps, forwardedRef) {\n const { checked = false, onCheckedChange, ...checkboxItemProps } = props;\n return (\n \n onCheckedChange?.(isIndeterminate(checked) ? true : !checked),\n { checkForDefaultPrevented: false },\n )}\n />\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuRadioGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_GROUP_NAME = 'MenuRadioGroup';\n\nconst [RadioGroupProvider, useRadioGroupContext] = createMenuContext(\n RADIO_GROUP_NAME,\n { value: undefined, onValueChange: () => {} },\n);\n\ntype MenuRadioGroupElement = React.ComponentRef;\ninterface MenuRadioGroupProps extends MenuGroupProps {\n value?: string | undefined;\n onValueChange?: ((value: string) => void) | undefined;\n}\n\nconst MenuRadioGroup = /* @__PURE__ */ React.forwardRef(\n function MenuRadioGroup(props: ScopedProps, forwardedRef) {\n const { value, onValueChange, ...groupProps } = props;\n const handleValueChange = useCallbackRef(onValueChange);\n return (\n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuRadioItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_ITEM_NAME = 'MenuRadioItem';\n\ntype MenuRadioItemElement = React.ComponentRef;\ninterface MenuRadioItemProps extends MenuItemProps {\n value: string;\n}\n\nconst MenuRadioItem = /* @__PURE__ */ React.forwardRef(\n function MenuRadioItem(props: ScopedProps, forwardedRef) {\n const { value, ...radioItemProps } = props;\n const context = useRadioGroupContext(RADIO_ITEM_NAME, props.__scopeMenu);\n const checked = value === context.value;\n return (\n \n context.onValueChange?.(value),\n { checkForDefaultPrevented: false },\n )}\n />\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_INDICATOR_NAME = 'MenuItemIndicator';\n\ntype CheckboxContextValue = { checked: CheckedState };\n\nconst [ItemIndicatorProvider, useItemIndicatorContext] = createMenuContext(\n ITEM_INDICATOR_NAME,\n { checked: false },\n);\n\ntype MenuItemIndicatorElement = React.ComponentRef;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef;\ninterface MenuItemIndicatorProps extends PrimitiveSpanProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst MenuItemIndicator = /* @__PURE__ */ React.forwardRef<\n MenuItemIndicatorElement,\n MenuItemIndicatorProps\n>(\n // blank line to reduce diff noise\n function MenuItemIndicator(props: ScopedProps, forwardedRef) {\n const { __scopeMenu, forceMount, ...itemIndicatorProps } = props;\n const indicatorContext = useItemIndicatorContext(ITEM_INDICATOR_NAME, __scopeMenu);\n return (\n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuSeparator\n * -----------------------------------------------------------------------------------------------*/\n\ntype MenuSeparatorElement = React.ComponentRef;\ninterface MenuSeparatorProps extends PrimitiveDivProps {}\n\nconst MenuSeparator = /* @__PURE__ */ React.forwardRef(\n function MenuSeparator(props: ScopedProps, forwardedRef) {\n const { __scopeMenu, ...separatorProps } = props;\n return (\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuArrow\n * -----------------------------------------------------------------------------------------------*/\n\ntype MenuArrowElement = React.ComponentRef;\ntype PopperArrowProps = React.ComponentPropsWithoutRef;\ninterface MenuArrowProps extends PopperArrowProps {}\n\nconst MenuArrow = /* @__PURE__ */ React.forwardRef(\n function MenuArrow(props: ScopedProps, forwardedRef) {\n const { __scopeMenu, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopeMenu);\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuSub\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_NAME = 'MenuSub';\n\ntype MenuSubContextValue = {\n contentId: string;\n triggerId: string;\n trigger: MenuSubTriggerElement | null;\n onTriggerChange(trigger: MenuSubTriggerElement | null): void;\n};\n\nconst [MenuSubProvider, useMenuSubContext] = createMenuContext(SUB_NAME);\n\ninterface MenuSubProps {\n children?: React.ReactNode | undefined;\n open?: boolean | undefined;\n onOpenChange?: ((open: boolean) => void) | undefined;\n}\n\nconst MenuSub: React.FC = (props: ScopedProps) => {\n const { __scopeMenu, children, open = false, onOpenChange } = props;\n const parentMenuContext = useMenuContext(SUB_NAME, __scopeMenu);\n const popperScope = usePopperScope(__scopeMenu);\n const [trigger, setTrigger] = React.useState(null);\n const [content, setContent] = React.useState(null);\n const handleOpenChange = useCallbackRef(onOpenChange);\n\n // Prevent the parent menu from reopening with open submenus.\n React.useEffect(() => {\n if (parentMenuContext.open === false) handleOpenChange(false);\n return () => handleOpenChange(false);\n }, [parentMenuContext.open, handleOpenChange]);\n\n return (\n \n \n \n {children}\n \n \n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * MenuSubTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_TRIGGER_NAME = 'MenuSubTrigger';\n\ntype MenuSubTriggerElement = MenuItemImplElement;\ninterface MenuSubTriggerProps extends MenuItemImplProps {}\n\nconst MenuSubTrigger = /* @__PURE__ */ React.forwardRef(\n function MenuSubTrigger(props: ScopedProps, forwardedRef) {\n const context = useMenuContext(SUB_TRIGGER_NAME, props.__scopeMenu);\n const rootContext = useMenuRootContext(SUB_TRIGGER_NAME, props.__scopeMenu);\n const subContext = useMenuSubContext(SUB_TRIGGER_NAME, props.__scopeMenu);\n const contentContext = useMenuContentContext(SUB_TRIGGER_NAME, props.__scopeMenu);\n const openTimerRef = React.useRef(null);\n const { pointerGraceTimerRef, onPointerGraceIntentChange } = contentContext;\n const scope = { __scopeMenu: props.__scopeMenu };\n\n const clearOpenTimer = React.useCallback(() => {\n if (openTimerRef.current) window.clearTimeout(openTimerRef.current);\n openTimerRef.current = null;\n }, []);\n\n React.useEffect(() => clearOpenTimer, [clearOpenTimer]);\n\n React.useEffect(() => {\n const pointerGraceTimer = pointerGraceTimerRef.current;\n return () => {\n window.clearTimeout(pointerGraceTimer);\n onPointerGraceIntentChange(null);\n };\n }, [pointerGraceTimerRef, onPointerGraceIntentChange]);\n\n const composedRefs = useComposedRefs(forwardedRef, subContext.onTriggerChange);\n\n return (\n \n {\n props.onClick?.(event);\n if (props.disabled || event.defaultPrevented) return;\n /**\n * We manually focus because iOS Safari doesn't always focus on click (e.g. buttons)\n * and we rely heavily on `onFocusOutside` for submenus to close when switching\n * between separate submenus.\n */\n event.currentTarget.focus();\n if (!context.open) context.onOpenChange(true);\n }}\n onPointerMove={composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n contentContext.onItemEnter(event);\n if (event.defaultPrevented) return;\n if (!props.disabled && !context.open && !openTimerRef.current) {\n contentContext.onPointerGraceIntentChange(null);\n openTimerRef.current = window.setTimeout(() => {\n context.onOpenChange(true);\n clearOpenTimer();\n }, 100);\n }\n }),\n )}\n onPointerLeave={composeEventHandlers(\n props.onPointerLeave,\n whenMouse((event) => {\n clearOpenTimer();\n\n const contentRect = context.content?.getBoundingClientRect();\n if (contentRect) {\n // TODO: make sure to update this when we change positioning logic\n const side = context.content?.dataset.side as Side;\n const rightSide = side === 'right';\n const bleed = rightSide ? -5 : +5;\n const contentNearEdge = contentRect[rightSide ? 'left' : 'right'];\n const contentFarEdge = contentRect[rightSide ? 'right' : 'left'];\n\n contentContext.onPointerGraceIntentChange({\n area: [\n // Apply a bleed on clientX to ensure that our exit point is\n // consistently within polygon bounds\n { x: event.clientX + bleed, y: event.clientY },\n { x: contentNearEdge, y: contentRect.top },\n { x: contentFarEdge, y: contentRect.top },\n { x: contentFarEdge, y: contentRect.bottom },\n { x: contentNearEdge, y: contentRect.bottom },\n ],\n side,\n });\n\n window.clearTimeout(pointerGraceTimerRef.current);\n pointerGraceTimerRef.current = window.setTimeout(\n () => contentContext.onPointerGraceIntentChange(null),\n 300,\n );\n } else {\n contentContext.onTriggerLeave(event);\n if (event.defaultPrevented) return;\n\n // There's 100ms where the user may leave an item before the submenu was opened.\n contentContext.onPointerGraceIntentChange(null);\n }\n }),\n )}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n // Only react to keys originating from the trigger itself. Focusable descendants\n // (eg. content rendered within the trigger) bubble their key events here through\n // React's event system even when portaled, which would otherwise let the trigger\n // swallow them. See: https://github.com/radix-ui/primitives/issues/3232\n if (props.disabled || event.target !== event.currentTarget) {\n return;\n }\n\n const isTypingAhead = contentContext.searchRef.current !== '';\n if (isTypingAhead && event.key === ' ') {\n return;\n }\n\n if (SUB_OPEN_KEYS[rootContext.dir].includes(event.key)) {\n context.onOpenChange(true);\n // The trigger may hold focus if opened via pointer interaction\n // so we ensure content is given focus again when switching to keyboard.\n context.content?.focus();\n // prevent window from scrolling\n event.preventDefault();\n }\n })}\n />\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuSubContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_CONTENT_NAME = 'MenuSubContent';\n\ntype AlignSubContent = Exclude<(typeof PopperPrimitive.ALIGN_OPTIONS)[number], 'center'>;\n\ntype MenuSubContentElement = MenuContentImplElement;\ninterface MenuSubContentProps extends Omit<\n MenuContentImplProps,\n keyof MenuContentImplPrivateProps | 'onCloseAutoFocus' | 'onEntryFocus' | 'side' | 'align'\n> {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n\n /**\n * Controls the direction the subcontent appears from its anchor menu item\n * Default: start\n */\n align?: AlignSubContent | undefined;\n}\n\nconst MenuSubContent = /* @__PURE__ */ React.forwardRef(\n function MenuSubContent(props: ScopedProps, forwardedRef) {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopeMenu);\n const { forceMount = portalContext.forceMount, align = 'start', ...subContentProps } = props;\n const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);\n const rootContext = useMenuRootContext(CONTENT_NAME, props.__scopeMenu);\n const subContext = useMenuSubContext(SUB_CONTENT_NAME, props.__scopeMenu);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n return (\n \n \n \n {\n // when opening a submenu, focus content for keyboard users only\n if (rootContext.isUsingKeyboardRef.current) ref.current?.focus();\n event.preventDefault();\n }}\n // The menu might close because of focusing another menu item in the parent menu. We\n // don't want it to refocus the trigger in that case so we handle trigger focus ourselves.\n onCloseAutoFocus={(event) => event.preventDefault()}\n onFocusOutside={composeEventHandlers(props.onFocusOutside, (event) => {\n // We prevent closing when the trigger is focused to avoid triggering a re-open animation\n // on pointer interaction.\n if (event.target !== subContext.trigger) context.onOpenChange(false);\n })}\n onEscapeKeyDown={composeEventHandlers(props.onEscapeKeyDown, (event) => {\n rootContext.onClose();\n // ensure pressing escape in submenu doesn't escape full screen mode\n event.preventDefault();\n })}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n // Submenu key events bubble through portals. We only care about keys in this menu.\n const isKeyDownInside = event.currentTarget.contains(event.target as HTMLElement);\n const isCloseKey = SUB_CLOSE_KEYS[rootContext.dir].includes(event.key);\n if (isKeyDownInside && isCloseKey) {\n context.onOpenChange(false);\n // We focus manually because we prevented it in `onCloseAutoFocus`\n subContext.trigger?.focus();\n // prevent window from scrolling\n event.preventDefault();\n }\n })}\n />\n \n \n \n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getOpenState(open: boolean) {\n return open ? 'open' : 'closed';\n}\n\nfunction isIndeterminate(checked?: CheckedState): checked is 'indeterminate' {\n return checked === 'indeterminate';\n}\n\nfunction getCheckedState(checked: CheckedState) {\n return isIndeterminate(checked) ? 'indeterminate' : checked ? 'checked' : 'unchecked';\n}\n\nfunction focusFirst(candidates: HTMLElement[]) {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates) {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus();\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\n\n/**\n * Wraps an array around itself at a given start index\n * Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`\n */\nfunction wrapArray(array: T[], startIndex: number) {\n return array.map((_, index) => array[(startIndex + index) % array.length]!);\n}\n\n/**\n * This is the \"meat\" of the typeahead matching logic. It takes in all the values,\n * the search and the current match, and returns the next match (or `undefined`).\n *\n * We normalize the search because if a user has repeatedly pressed a character,\n * we want the exact same behavior as if we only had that one character\n * (ie. cycle through options starting with that character)\n *\n * We also reorder the values by wrapping the array around the current match.\n * This is so we always look forward from the current match, and picking the first\n * match will always be the correct one.\n *\n * Finally, if the normalized search is exactly one character, we exclude the\n * current match from the values because otherwise it would be the first to match always\n * and focus would never move. This is as opposed to the regular case, where we\n * don't want focus to move if the current match still matches.\n */\nfunction getNextMatch(values: string[], search: string, currentMatch?: string) {\n const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);\n const normalizedSearch = isRepeated ? search[0]! : search;\n const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1;\n let wrappedValues = wrapArray(values, Math.max(currentMatchIndex, 0));\n const excludeCurrentMatch = normalizedSearch.length === 1;\n if (excludeCurrentMatch) wrappedValues = wrappedValues.filter((v) => v !== currentMatch);\n const nextMatch = wrappedValues.find((value) =>\n value.toLowerCase().startsWith(normalizedSearch.toLowerCase()),\n );\n return nextMatch !== currentMatch ? nextMatch : undefined;\n}\n\ntype Point = { x: number; y: number };\ntype Polygon = Point[];\ntype Side = 'left' | 'right';\ntype GraceIntent = { area: Polygon; side: Side };\n\n// Determine if a point is inside of a polygon.\n// Based on https://github.com/substack/point-in-polygon\nfunction isPointInPolygon(point: Point, polygon: Polygon) {\n const { x, y } = point;\n let inside = false;\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const ii = polygon[i]!;\n const jj = polygon[j]!;\n const xi = ii.x;\n const yi = ii.y;\n const xj = jj.x;\n const yj = jj.y;\n\n // oxfmt-ignore\n const intersect = ((yi > y) !== (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);\n if (intersect) inside = !inside;\n }\n\n return inside;\n}\n\nfunction isPointerInGraceArea(event: React.PointerEvent, area?: Polygon) {\n if (!area) return false;\n const cursorPos = { x: event.clientX, y: event.clientY };\n return isPointInPolygon(cursorPos, area);\n}\n\nfunction whenMouse(handler: React.PointerEventHandler): React.PointerEventHandler {\n return (event) => (event.pointerType === 'mouse' ? handler(event) : undefined);\n}\n\nexport {\n createMenuScope,\n //\n Menu,\n MenuAnchor,\n MenuPortal,\n MenuContent,\n MenuGroup,\n MenuLabel,\n MenuItem,\n MenuCheckboxItem,\n MenuRadioGroup,\n MenuRadioItem,\n MenuItemIndicator,\n MenuSeparator,\n MenuArrow,\n MenuSub,\n MenuSubTrigger,\n MenuSubContent,\n //\n Menu as Root,\n MenuAnchor as Anchor,\n MenuPortal as Portal,\n MenuContent as Content,\n MenuGroup as Group,\n MenuLabel as Label,\n MenuItem as Item,\n MenuCheckboxItem as CheckboxItem,\n MenuRadioGroup as RadioGroup,\n MenuRadioItem as RadioItem,\n MenuItemIndicator as ItemIndicator,\n MenuSeparator as Separator,\n MenuArrow as Arrow,\n MenuSub as Sub,\n MenuSubTrigger as SubTrigger,\n MenuSubContent as SubContent,\n};\nexport type {\n MenuProps,\n MenuAnchorProps,\n MenuPortalProps,\n MenuContentProps,\n MenuGroupProps,\n MenuLabelProps,\n MenuItemProps,\n MenuCheckboxItemProps,\n MenuRadioGroupProps,\n MenuRadioItemProps,\n MenuItemIndicatorProps,\n MenuSeparatorProps,\n MenuArrowProps,\n MenuSubProps,\n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"MenuRootContentNonModal", "MenuContentImpl", "MenuGroup", "MenuLabel", "MenuItem", "MenuItemImpl", "MenuCheckboxItem", "MenuRadioGroup", "MenuRadioItem", "MenuItemIndicator", "MenuSeparator", "MenuArrow", "MenuSubTrigger", "MenuSubContent"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-menu/package.json b/e-commerce/node_modules/@radix-ui/react-menu/package.json new file mode 100644 index 0000000000000000000000000000000000000000..e9f500b3403dc51a56b37a9e8de086e6e7e40ed7 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-menu/package.json @@ -0,0 +1,86 @@ +{ + "name": "@radix-ui/react-menu", + "version": "2.2.0", + "license": "MIT", + "source": "./src/index.ts", + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "files": [ + "dist", + "README.md" + ], + "sideEffects": false, + "dependencies": { + "aria-hidden": "^1.2.4", + "react-remove-scroll": "^2.7.2", + "@radix-ui/primitive": "1.2.0", + "@radix-ui/react-context": "1.3.0", + "@radix-ui/react-compose-refs": "1.1.5", + "@radix-ui/react-direction": "1.2.0", + "@radix-ui/react-collection": "1.2.0", + "@radix-ui/react-dismissable-layer": "1.2.0", + "@radix-ui/react-focus-guards": "1.2.0", + "@radix-ui/react-focus-scope": "1.3.0", + "@radix-ui/react-id": "1.1.4", + "@radix-ui/react-popper": "1.4.0", + "@radix-ui/react-primitive": "2.2.0", + "@radix-ui/react-presence": "1.1.11", + "@radix-ui/react-use-callback-ref": "1.1.5", + "@radix-ui/react-roving-focus": "1.2.0", + "@radix-ui/react-portal": "1.2.0", + "@radix-ui/react-slot": "1.5.0" + }, + "devDependencies": { + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "react": "^19.3.0", + "react-dom": "^19.3.0", + "typescript": "^5.9.3", + "@repo/builder": "0.0.0", + "@repo/test-data": "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", + "directory": "packages/react/menu" + }, + "bugs": { + "url": "https://github.com/radix-ui/primitives/issues" + }, + "scripts": { + "lint": "oxlint --max-warnings 0 src", + "clean": "rm -rf dist", + "reset": "rm -rf dist node_modules", + "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" + } + } + } +} \ No newline at end of file diff --git a/e-commerce/node_modules/@radix-ui/react-popover/LICENSE b/e-commerce/node_modules/@radix-ui/react-popover/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a18858fb7b014098cba85703e66609be66a26ef5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-popover/LICENSE @@ -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. diff --git a/e-commerce/node_modules/@radix-ui/react-popover/README.md b/e-commerce/node_modules/@radix-ui/react-popover/README.md new file mode 100644 index 0000000000000000000000000000000000000000..aae69b625c341062799387ca13addb41fd6c855d --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-popover/README.md @@ -0,0 +1,3 @@ +# `react-popover` + +View docs [here](https://radix-ui.com/primitives/docs/components/popover). diff --git a/e-commerce/node_modules/@radix-ui/react-popover/dist/index.d.mts b/e-commerce/node_modules/@radix-ui/react-popover/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..575e65147614e5f91c66175867191d6b742c09a9 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-popover/dist/index.d.mts @@ -0,0 +1,99 @@ +import * as _radix_ui_react_context from '@radix-ui/react-context'; +import * as React from 'react'; +import { DismissableLayer } from '@radix-ui/react-dismissable-layer'; +import { FocusScope, FocusScopeBranchRegistry } from '@radix-ui/react-focus-scope'; +import * as PopperPrimitive from '@radix-ui/react-popper'; +import { Portal } from '@radix-ui/react-portal'; +import { Primitive } from '@radix-ui/react-primitive'; + +declare const createPopoverScope: _radix_ui_react_context.CreateScope; +interface PopoverProps { + children?: React.ReactNode | undefined; + open?: boolean | undefined; + defaultOpen?: boolean | undefined; + onOpenChange?: ((open: boolean) => void) | undefined; + modal?: boolean | undefined; +} +declare const Popover: React.FC; +type PopperAnchorProps = React.ComponentPropsWithoutRef; +interface PopoverAnchorProps extends PopperAnchorProps { +} +declare const PopoverAnchor: React.ForwardRefExoticComponent>; +type PrimitiveButtonProps = React.ComponentPropsWithoutRef; +interface PopoverTriggerProps extends PrimitiveButtonProps { +} +declare const PopoverTrigger: React.ForwardRefExoticComponent>; +type PortalProps = React.ComponentPropsWithoutRef; +interface PopoverPortalProps { + children?: React.ReactNode | undefined; + /** + * Specify a container element to portal the content into. + */ + container?: PortalProps['container'] | undefined; + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const PopoverPortal: React.FC; +interface PopoverContentProps extends PopoverContentTypeProps { + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const PopoverContent: React.ForwardRefExoticComponent>; +interface PopoverContentTypeProps extends Omit { +} +type FocusScopeProps = React.ComponentPropsWithoutRef; +type DismissableLayerProps = React.ComponentPropsWithoutRef; +type PopperContentProps = React.ComponentPropsWithoutRef; +interface PopoverContentImplProps extends Omit, Omit { + /** + * Whether focus should be trapped within the `Popover` + * (default: false) + */ + trapFocus?: FocusScopeProps['trapped'] | undefined; + /** + * Event handler called when auto-focusing on open. + * Can be prevented. + */ + onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'] | undefined; + /** + * Event handler called when auto-focusing on close. + * Can be prevented. + */ + onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'] | undefined; + /** + * Branch nodes registered by nested, portalled layers. Passed to the trapped + * `FocusScope` so focus isn't reclaimed from them. Only provided by the modal + * variant. + * @internal + */ + branchNodes?: HTMLElement[] | undefined; + /** + * Registry that nested, portalled layers use to register themselves as branches of this modal + * `Popover`. Only provided by the modal variant. + * @internal + */ + branchRegistry?: FocusScopeBranchRegistry | undefined; +} +type PrimitiveHeading2Props = React.ComponentPropsWithoutRef; +interface PopoverTitleProps extends PrimitiveHeading2Props { +} +declare const PopoverTitle: React.ForwardRefExoticComponent>; +type PrimitiveParagraphProps = React.ComponentPropsWithoutRef; +interface PopoverDescriptionProps extends PrimitiveParagraphProps { +} +declare const PopoverDescription: React.ForwardRefExoticComponent>; +interface PopoverCloseProps extends PrimitiveButtonProps { +} +declare const PopoverClose: React.ForwardRefExoticComponent>; +type PopperArrowProps = React.ComponentPropsWithoutRef; +interface PopoverArrowProps extends PopperArrowProps { +} +declare const PopoverArrow: React.ForwardRefExoticComponent>; + +export { PopoverAnchor as Anchor, PopoverArrow as Arrow, PopoverClose as Close, PopoverContent as Content, PopoverDescription as Description, Popover, PopoverAnchor, type PopoverAnchorProps, PopoverArrow, type PopoverArrowProps, PopoverClose, type PopoverCloseProps, PopoverContent, type PopoverContentProps, PopoverDescription, type PopoverDescriptionProps, PopoverPortal, type PopoverPortalProps, type PopoverProps, PopoverTitle, type PopoverTitleProps, PopoverTrigger, type PopoverTriggerProps, PopoverPortal as Portal, Popover as Root, PopoverTitle as Title, PopoverTrigger as Trigger, createPopoverScope }; diff --git a/e-commerce/node_modules/@radix-ui/react-popover/dist/index.d.ts b/e-commerce/node_modules/@radix-ui/react-popover/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..575e65147614e5f91c66175867191d6b742c09a9 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-popover/dist/index.d.ts @@ -0,0 +1,99 @@ +import * as _radix_ui_react_context from '@radix-ui/react-context'; +import * as React from 'react'; +import { DismissableLayer } from '@radix-ui/react-dismissable-layer'; +import { FocusScope, FocusScopeBranchRegistry } from '@radix-ui/react-focus-scope'; +import * as PopperPrimitive from '@radix-ui/react-popper'; +import { Portal } from '@radix-ui/react-portal'; +import { Primitive } from '@radix-ui/react-primitive'; + +declare const createPopoverScope: _radix_ui_react_context.CreateScope; +interface PopoverProps { + children?: React.ReactNode | undefined; + open?: boolean | undefined; + defaultOpen?: boolean | undefined; + onOpenChange?: ((open: boolean) => void) | undefined; + modal?: boolean | undefined; +} +declare const Popover: React.FC; +type PopperAnchorProps = React.ComponentPropsWithoutRef; +interface PopoverAnchorProps extends PopperAnchorProps { +} +declare const PopoverAnchor: React.ForwardRefExoticComponent>; +type PrimitiveButtonProps = React.ComponentPropsWithoutRef; +interface PopoverTriggerProps extends PrimitiveButtonProps { +} +declare const PopoverTrigger: React.ForwardRefExoticComponent>; +type PortalProps = React.ComponentPropsWithoutRef; +interface PopoverPortalProps { + children?: React.ReactNode | undefined; + /** + * Specify a container element to portal the content into. + */ + container?: PortalProps['container'] | undefined; + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const PopoverPortal: React.FC; +interface PopoverContentProps extends PopoverContentTypeProps { + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const PopoverContent: React.ForwardRefExoticComponent>; +interface PopoverContentTypeProps extends Omit { +} +type FocusScopeProps = React.ComponentPropsWithoutRef; +type DismissableLayerProps = React.ComponentPropsWithoutRef; +type PopperContentProps = React.ComponentPropsWithoutRef; +interface PopoverContentImplProps extends Omit, Omit { + /** + * Whether focus should be trapped within the `Popover` + * (default: false) + */ + trapFocus?: FocusScopeProps['trapped'] | undefined; + /** + * Event handler called when auto-focusing on open. + * Can be prevented. + */ + onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'] | undefined; + /** + * Event handler called when auto-focusing on close. + * Can be prevented. + */ + onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'] | undefined; + /** + * Branch nodes registered by nested, portalled layers. Passed to the trapped + * `FocusScope` so focus isn't reclaimed from them. Only provided by the modal + * variant. + * @internal + */ + branchNodes?: HTMLElement[] | undefined; + /** + * Registry that nested, portalled layers use to register themselves as branches of this modal + * `Popover`. Only provided by the modal variant. + * @internal + */ + branchRegistry?: FocusScopeBranchRegistry | undefined; +} +type PrimitiveHeading2Props = React.ComponentPropsWithoutRef; +interface PopoverTitleProps extends PrimitiveHeading2Props { +} +declare const PopoverTitle: React.ForwardRefExoticComponent>; +type PrimitiveParagraphProps = React.ComponentPropsWithoutRef; +interface PopoverDescriptionProps extends PrimitiveParagraphProps { +} +declare const PopoverDescription: React.ForwardRefExoticComponent>; +interface PopoverCloseProps extends PrimitiveButtonProps { +} +declare const PopoverClose: React.ForwardRefExoticComponent>; +type PopperArrowProps = React.ComponentPropsWithoutRef; +interface PopoverArrowProps extends PopperArrowProps { +} +declare const PopoverArrow: React.ForwardRefExoticComponent>; + +export { PopoverAnchor as Anchor, PopoverArrow as Arrow, PopoverClose as Close, PopoverContent as Content, PopoverDescription as Description, Popover, PopoverAnchor, type PopoverAnchorProps, PopoverArrow, type PopoverArrowProps, PopoverClose, type PopoverCloseProps, PopoverContent, type PopoverContentProps, PopoverDescription, type PopoverDescriptionProps, PopoverPortal, type PopoverPortalProps, type PopoverProps, PopoverTitle, type PopoverTitleProps, PopoverTrigger, type PopoverTriggerProps, PopoverPortal as Portal, Popover as Root, PopoverTitle as Title, PopoverTrigger as Trigger, createPopoverScope }; diff --git a/e-commerce/node_modules/@radix-ui/react-popover/dist/index.js b/e-commerce/node_modules/@radix-ui/react-popover/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..2d2b091f1e43429ff0ba3f19e6188dc3f2015a7c --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-popover/dist/index.js @@ -0,0 +1,413 @@ +"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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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, { + Anchor: () => PopoverAnchor, + Arrow: () => PopoverArrow, + Close: () => PopoverClose, + Content: () => PopoverContent, + Description: () => PopoverDescription, + Popover: () => Popover, + PopoverAnchor: () => PopoverAnchor, + PopoverArrow: () => PopoverArrow, + PopoverClose: () => PopoverClose, + PopoverContent: () => PopoverContent, + PopoverDescription: () => PopoverDescription, + PopoverPortal: () => PopoverPortal, + PopoverTitle: () => PopoverTitle, + PopoverTrigger: () => PopoverTrigger, + Portal: () => PopoverPortal, + Root: () => Popover, + Title: () => PopoverTitle, + Trigger: () => PopoverTrigger, + createPopoverScope: () => createPopoverScope +}); +module.exports = __toCommonJS(index_exports); + +// src/popover.tsx +var React = __toESM(require("react")); +var import_react_use_layout_effect = require("@radix-ui/react-use-layout-effect"); +var import_primitive = require("@radix-ui/primitive"); +var import_react_compose_refs = require("@radix-ui/react-compose-refs"); +var import_react_context = require("@radix-ui/react-context"); +var import_react_dismissable_layer = require("@radix-ui/react-dismissable-layer"); +var import_react_focus_guards = require("@radix-ui/react-focus-guards"); +var import_react_focus_scope = require("@radix-ui/react-focus-scope"); +var import_react_id = require("@radix-ui/react-id"); +var PopperPrimitive = __toESM(require("@radix-ui/react-popper")); +var import_react_popper = require("@radix-ui/react-popper"); +var import_react_portal = require("@radix-ui/react-portal"); +var import_react_presence = require("@radix-ui/react-presence"); +var import_react_primitive = require("@radix-ui/react-primitive"); +var import_react_slot = require("@radix-ui/react-slot"); +var import_react_use_controllable_state = require("@radix-ui/react-use-controllable-state"); +var import_aria_hidden = require("aria-hidden"); +var import_react_remove_scroll = require("react-remove-scroll"); +var import_jsx_runtime = require("react/jsx-runtime"); +var POPOVER_NAME = "Popover"; +var [createPopoverContext, createPopoverScope] = (0, import_react_context.createContextScope)(POPOVER_NAME, [ + import_react_popper.createPopperScope +]); +var usePopperScope = (0, import_react_popper.createPopperScope)(); +var [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME); +var Popover = /* @__PURE__ */ __name((props) => { + const { + __scopePopover, + children, + open: openProp, + defaultOpen, + onOpenChange, + modal = false + } = props; + const popperScope = usePopperScope(__scopePopover); + const triggerRef = React.useRef(null); + const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false); + const [titleCount, setTitleCount] = React.useState(0); + const [descriptionCount, setDescriptionCount] = React.useState(0); + const [open, setOpen] = (0, import_react_use_controllable_state.useControllableState)({ + prop: openProp, + defaultProp: defaultOpen ?? false, + onChange: onOpenChange, + caller: POPOVER_NAME + }); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperPrimitive.Root, { ...popperScope, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + PopoverProvider, + { + scope: __scopePopover, + contentId: (0, import_react_id.useId)(), + titleId: (0, import_react_id.useId)(), + descriptionId: (0, import_react_id.useId)(), + titlePresent: titleCount > 0, + descriptionPresent: descriptionCount > 0, + setTitleCount, + setDescriptionCount, + triggerRef, + open, + onOpenChange: setOpen, + onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]), + hasCustomAnchor, + onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []), + onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), []), + modal, + children + } + ) }); +}, "Popover"); +var ANCHOR_NAME = "PopoverAnchor"; +var PopoverAnchor = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function PopoverAnchor2(props, forwardedRef) { + const { __scopePopover, ...anchorProps } = props; + const context = usePopoverContext(ANCHOR_NAME, __scopePopover); + const popperScope = usePopperScope(__scopePopover); + const { onCustomAnchorAdd, onCustomAnchorRemove } = context; + React.useEffect(() => { + onCustomAnchorAdd(); + return () => onCustomAnchorRemove(); + }, [onCustomAnchorAdd, onCustomAnchorRemove]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperPrimitive.Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef }); + }, "PopoverAnchor") +); +var TRIGGER_NAME = "PopoverTrigger"; +var PopoverTrigger = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function PopoverTrigger2(props, forwardedRef) { + const { __scopePopover, ...triggerProps } = props; + const context = usePopoverContext(TRIGGER_NAME, __scopePopover); + const popperScope = usePopperScope(__scopePopover); + const composedTriggerRef = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, context.triggerRef); + const trigger = /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.button, + { + type: "button", + "aria-haspopup": "dialog", + "aria-expanded": context.open, + "aria-controls": context.open ? context.contentId : void 0, + "data-state": getState(context.open), + ...triggerProps, + ref: composedTriggerRef, + onClick: (0, import_primitive.composeEventHandlers)(props.onClick, context.onOpenToggle) + } + ); + return context.hasCustomAnchor ? trigger : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperPrimitive.Anchor, { asChild: true, ...popperScope, children: trigger }); + }, "PopoverTrigger") +); +var PORTAL_NAME = "PopoverPortal"; +var [PortalProvider, usePortalContext] = createPopoverContext(PORTAL_NAME, { + forceMount: void 0 +}); +var PopoverPortal = /* @__PURE__ */ __name((props) => { + const { __scopePopover, forceMount, children, container } = props; + const context = usePopoverContext(PORTAL_NAME, __scopePopover); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PortalProvider, { scope: __scopePopover, forceMount, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || context.open, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_portal.Portal, { asChild: true, container, children }) }) }); +}, "PopoverPortal"); +var CONTENT_NAME = "PopoverContent"; +var PopoverContent = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function PopoverContent2(props, forwardedRef) { + const portalContext = usePortalContext(CONTENT_NAME, props.__scopePopover); + const { forceMount = portalContext.forceMount, ...contentProps } = props; + const context = usePopoverContext(CONTENT_NAME, props.__scopePopover); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverContentNonModal, { ...contentProps, ref: forwardedRef }) }); + }, "PopoverContent") +); +var Slot = (0, import_react_slot.createSlot)("PopoverContent.RemoveScroll"); +var PopoverContentModal = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function PopoverContentModal2(props, forwardedRef) { + const context = usePopoverContext(CONTENT_NAME, props.__scopePopover); + const contentRef = React.useRef(null); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, contentRef); + const isRightClickOutsideRef = React.useRef(false); + const { nodes: branchNodes, registry: branchRegistry } = (0, import_react_focus_scope.useFocusScopeBranchRegistry)(); + React.useEffect(() => { + const content = contentRef.current; + if (content) return (0, import_aria_hidden.hideOthers)(content); + }, []); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_remove_scroll.RemoveScroll, + { + as: Slot, + allowPinchZoom: true, + shards: React.useMemo( + () => [contentRef, ...branchNodes.map((node) => ({ current: node }))], + [contentRef, branchNodes] + ), + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + PopoverContentImpl, + { + ...props, + ref: composedRefs, + branchNodes, + branchRegistry, + trapFocus: context.open, + disableOutsidePointerEvents: true, + onCloseAutoFocus: (0, import_primitive.composeEventHandlers)(props.onCloseAutoFocus, (event) => { + event.preventDefault(); + if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus(); + }), + onPointerDownOutside: (0, import_primitive.composeEventHandlers)( + props.onPointerDownOutside, + (event) => { + const originalEvent = event.detail.originalEvent; + const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true; + const isRightClick = originalEvent.button === 2 || ctrlLeftClick; + isRightClickOutsideRef.current = isRightClick; + }, + { checkForDefaultPrevented: false } + ), + onFocusOutside: (0, import_primitive.composeEventHandlers)( + props.onFocusOutside, + (event) => event.preventDefault(), + { checkForDefaultPrevented: false } + ) + } + ) + } + ); + }, "PopoverContentModal") +); +var PopoverContentNonModal = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function PopoverContentNonModal2(props, forwardedRef) { + const context = usePopoverContext(CONTENT_NAME, props.__scopePopover); + const hasInteractedOutsideRef = React.useRef(false); + const hasPointerDownOutsideRef = React.useRef(false); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + PopoverContentImpl, + { + ...props, + ref: forwardedRef, + trapFocus: false, + disableOutsidePointerEvents: false, + onCloseAutoFocus: (event) => { + props.onCloseAutoFocus?.(event); + if (!event.defaultPrevented) { + if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus(); + event.preventDefault(); + } + hasInteractedOutsideRef.current = false; + hasPointerDownOutsideRef.current = false; + }, + onInteractOutside: (event) => { + props.onInteractOutside?.(event); + if (!event.defaultPrevented) { + hasInteractedOutsideRef.current = true; + if (event.detail.originalEvent.type === "pointerdown") { + hasPointerDownOutsideRef.current = true; + } + } + const target = event.target; + const targetIsTrigger = context.triggerRef.current?.contains(target); + if (targetIsTrigger) event.preventDefault(); + if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) { + event.preventDefault(); + } + } + } + ); + }, "PopoverContentNonModal") +); +var PopoverContentImpl = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function PopoverContentImpl2(props, forwardedRef) { + const { + __scopePopover, + trapFocus, + onOpenAutoFocus, + onCloseAutoFocus, + disableOutsidePointerEvents, + onEscapeKeyDown, + onPointerDownOutside, + onFocusOutside, + onInteractOutside, + "aria-describedby": ariaDescribedby, + branchNodes, + branchRegistry, + ...contentProps + } = props; + const context = usePopoverContext(CONTENT_NAME, __scopePopover); + const popperScope = usePopperScope(__scopePopover); + const [contentNode, setContentNode] = React.useState(null); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, setContentNode); + (0, import_react_focus_scope.useFocusScopeBranch)(contentNode); + (0, import_react_focus_guards.useFocusGuards)(); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_focus_scope.FocusScopeBranchProvider, { registry: branchRegistry, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_focus_scope.FocusScope, + { + asChild: true, + loop: true, + trapped: trapFocus, + branches: branchNodes, + onMountAutoFocus: onOpenAutoFocus, + onUnmountAutoFocus: onCloseAutoFocus, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_dismissable_layer.DismissableLayer, + { + asChild: true, + disableOutsidePointerEvents, + onInteractOutside, + onEscapeKeyDown, + onPointerDownOutside, + onFocusOutside, + onDismiss: () => context.onOpenChange(false), + deferPointerDownOutside: true, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + PopperPrimitive.Content, + { + "data-state": getState(context.open), + role: "dialog", + id: context.contentId, + "aria-labelledby": context.titlePresent ? context.titleId : void 0, + "aria-describedby": context.descriptionPresent ? concatAriaDescribedby(ariaDescribedby, context.descriptionId) : ariaDescribedby, + ...popperScope, + ...contentProps, + ref: composedRefs, + style: { + ...contentProps.style, + // re-namespace exposed content custom properties + ...{ + "--radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)", + "--radix-popover-content-available-width": "var(--radix-popper-available-width)", + "--radix-popover-content-available-height": "var(--radix-popper-available-height)", + "--radix-popover-trigger-width": "var(--radix-popper-anchor-width)", + "--radix-popover-trigger-height": "var(--radix-popper-anchor-height)" + } + } + } + ) + } + ) + } + ) }); + }, "PopoverContentImpl") +); +var PopoverTitle = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function PopoverTitle2(props, forwardedRef) { + const { __scopePopover, ...titleProps } = props; + const context = usePopoverContext("PopoverTitle", __scopePopover); + const { setTitleCount } = context; + (0, import_react_use_layout_effect.useLayoutEffect)(() => { + setTitleCount((count) => count + 1); + return () => setTitleCount((count) => count - 1); + }, [setTitleCount]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef }); + }, "PopoverTitle") +); +var PopoverDescription = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function PopoverDescription2(props, forwardedRef) { + const { __scopePopover, ...descriptionProps } = props; + const context = usePopoverContext("PopoverDescription", __scopePopover); + const { setDescriptionCount } = context; + (0, import_react_use_layout_effect.useLayoutEffect)(() => { + setDescriptionCount((count) => count + 1); + return () => setDescriptionCount((count) => count - 1); + }, [setDescriptionCount]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef }); +}, "PopoverDescription")); +var CLOSE_NAME = "PopoverClose"; +var PopoverClose = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function PopoverClose2(props, forwardedRef) { + const { __scopePopover, ...closeProps } = props; + const context = usePopoverContext(CLOSE_NAME, __scopePopover); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.button, + { + type: "button", + ...closeProps, + ref: forwardedRef, + onClick: (0, import_primitive.composeEventHandlers)(props.onClick, () => context.onOpenChange(false)) + } + ); + }, "PopoverClose") +); +var PopoverArrow = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function PopoverArrow2(props, forwardedRef) { + const { __scopePopover, ...arrowProps } = props; + const popperScope = usePopperScope(__scopePopover); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperPrimitive.Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef }); + }, "PopoverArrow") +); +function getState(open) { + return open ? "open" : "closed"; +} +__name(getState, "getState"); +function concatAriaDescribedby(...values) { + const ids = /* @__PURE__ */ new Set(); + for (const value of values) { + if (typeof value !== "string") continue; + for (const id of String(value).trim().split(/\s+/)) { + if (id) ids.add(id); + } + } + return ids.size > 0 ? Array.from(ids).join(" ") : void 0; +} +__name(concatAriaDescribedby, "concatAriaDescribedby"); +//# sourceMappingURL=index.js.map diff --git a/e-commerce/node_modules/@radix-ui/react-popover/dist/index.js.map b/e-commerce/node_modules/@radix-ui/react-popover/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a783d4c68e09004531f29a34d00b3f9e3ca7c832 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-popover/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts", "../src/popover.tsx"], + "sourcesContent": ["'use client';\nexport {\n createPopoverScope,\n //\n Popover,\n PopoverAnchor,\n PopoverTrigger,\n PopoverPortal,\n PopoverContent,\n PopoverTitle,\n PopoverDescription,\n PopoverClose,\n PopoverArrow,\n //\n Root,\n Anchor,\n Trigger,\n Portal,\n Content,\n Title,\n Description,\n Close,\n Arrow,\n} from './popover';\nexport type {\n PopoverProps,\n PopoverAnchorProps,\n PopoverTriggerProps,\n PopoverPortalProps,\n PopoverContentProps,\n PopoverTitleProps,\n PopoverDescriptionProps,\n PopoverCloseProps,\n PopoverArrowProps,\n} from './popover';\n", "import * as React from 'react';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport {\n FocusScope,\n FocusScopeBranchProvider,\n useFocusScopeBranch,\n useFocusScopeBranchRegistry,\n} from '@radix-ui/react-focus-scope';\nimport type { FocusScopeBranchRegistry } from '@radix-ui/react-focus-scope';\nimport { useId } from '@radix-ui/react-id';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { createPopperScope } from '@radix-ui/react-popper';\nimport { Portal as PortalPrimitive } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { createSlot } from '@radix-ui/react-slot';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { hideOthers } from 'aria-hidden';\nimport { RemoveScroll } from 'react-remove-scroll';\n\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Popover\n * -----------------------------------------------------------------------------------------------*/\n\nconst POPOVER_NAME = 'Popover';\n\ntype ScopedProps

= P & { __scopePopover?: Scope | undefined };\nconst [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [\n createPopperScope,\n]);\nconst usePopperScope = createPopperScope();\n\ninterface PopoverContextValue {\n triggerRef: React.RefObject;\n contentId: string;\n titleId: string;\n descriptionId: string;\n titlePresent: boolean;\n descriptionPresent: boolean;\n setTitleCount: React.Dispatch>;\n setDescriptionCount: React.Dispatch>;\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpenToggle(): void;\n hasCustomAnchor: boolean;\n onCustomAnchorAdd(): void;\n onCustomAnchorRemove(): void;\n modal: boolean;\n}\n\nconst [PopoverProvider, usePopoverContext] =\n createPopoverContext(POPOVER_NAME);\n\ninterface PopoverProps {\n children?: React.ReactNode | undefined;\n open?: boolean | undefined;\n defaultOpen?: boolean | undefined;\n onOpenChange?: ((open: boolean) => void) | undefined;\n modal?: boolean | undefined;\n}\n\nconst Popover: React.FC = (props: ScopedProps) => {\n const {\n __scopePopover,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = false,\n } = props;\n const popperScope = usePopperScope(__scopePopover);\n const triggerRef = React.useRef(null);\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);\n const [titleCount, setTitleCount] = React.useState(0);\n const [descriptionCount, setDescriptionCount] = React.useState(0);\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n caller: POPOVER_NAME,\n });\n\n return (\n \n 0}\n descriptionPresent={descriptionCount > 0}\n setTitleCount={setTitleCount}\n setDescriptionCount={setDescriptionCount}\n triggerRef={triggerRef}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n hasCustomAnchor={hasCustomAnchor}\n onCustomAnchorAdd={React.useCallback(() => setHasCustomAnchor(true), [])}\n onCustomAnchorRemove={React.useCallback(() => setHasCustomAnchor(false), [])}\n modal={modal}\n >\n {children}\n \n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverAnchor\n * -----------------------------------------------------------------------------------------------*/\n\nconst ANCHOR_NAME = 'PopoverAnchor';\n\ntype PopoverAnchorElement = React.ComponentRef;\ntype PopperAnchorProps = React.ComponentPropsWithoutRef;\ninterface PopoverAnchorProps extends PopperAnchorProps {}\n\nconst PopoverAnchor = /* @__PURE__ */ React.forwardRef(\n function PopoverAnchor(props: ScopedProps, forwardedRef) {\n const { __scopePopover, ...anchorProps } = props;\n const context = usePopoverContext(ANCHOR_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n const { onCustomAnchorAdd, onCustomAnchorRemove } = context;\n\n React.useEffect(() => {\n onCustomAnchorAdd();\n return () => onCustomAnchorRemove();\n }, [onCustomAnchorAdd, onCustomAnchorRemove]);\n\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'PopoverTrigger';\n\ntype PopoverTriggerElement = React.ComponentRef;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef;\ninterface PopoverTriggerProps extends PrimitiveButtonProps {}\n\nconst PopoverTrigger = /* @__PURE__ */ React.forwardRef(\n function PopoverTrigger(props: ScopedProps, forwardedRef) {\n const { __scopePopover, ...triggerProps } = props;\n const context = usePopoverContext(TRIGGER_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);\n\n const trigger = (\n \n );\n\n return context.hasCustomAnchor ? (\n trigger\n ) : (\n \n {trigger}\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'PopoverPortal';\n\ntype PortalContextValue = { forceMount?: true | undefined };\nconst [PortalProvider, usePortalContext] = createPopoverContext(PORTAL_NAME, {\n forceMount: undefined,\n});\n\ntype PortalProps = React.ComponentPropsWithoutRef;\ninterface PopoverPortalProps {\n children?: React.ReactNode | undefined;\n /**\n * Specify a container element to portal the content into.\n */\n container?: PortalProps['container'] | undefined;\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst PopoverPortal: React.FC = (props: ScopedProps) => {\n const { __scopePopover, forceMount, children, container } = props;\n const context = usePopoverContext(PORTAL_NAME, __scopePopover);\n return (\n \n \n \n {children}\n \n \n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopoverContent';\n\ninterface PopoverContentProps extends PopoverContentTypeProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst PopoverContent = /* @__PURE__ */ React.forwardRef<\n PopoverContentTypeElement,\n PopoverContentProps\n>(\n // blank line to reduce diff noise\n function PopoverContent(props: ScopedProps, forwardedRef) {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopePopover);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n return (\n \n {context.modal ? (\n \n ) : (\n \n )}\n \n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Slot = createSlot('PopoverContent.RemoveScroll');\n\ntype PopoverContentTypeElement = PopoverContentImplElement;\ninterface PopoverContentTypeProps extends Omit<\n PopoverContentImplProps,\n 'trapFocus' | 'disableOutsidePointerEvents' | 'branchRegistry' | 'branchNodes'\n> {}\n\nconst PopoverContentModal = /* @__PURE__ */ React.forwardRef<\n PopoverContentTypeElement,\n PopoverContentTypeProps\n>(\n // blank line to reduce diff noise\n function PopoverContentModal(props: ScopedProps, forwardedRef) {\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n const contentRef = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n const isRightClickOutsideRef = React.useRef(false);\n\n // Allows nested portalled layers to register themselves as branches of this\n // modal `Popover` so focus isn't reclaimed and scroll isn't locked for\n // them. See: https://github.com/radix-ui/primitives/issues/3423\n const { nodes: branchNodes, registry: branchRegistry } = useFocusScopeBranchRegistry();\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n const content = contentRef.current;\n if (content) return hideOthers(content);\n }, []);\n\n return (\n [contentRef, ...branchNodes.map((node) => ({ current: node }))],\n [contentRef, branchNodes],\n )}\n >\n {\n event.preventDefault();\n if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();\n })}\n onPointerDownOutside={composeEventHandlers(\n props.onPointerDownOutside,\n (event) => {\n const originalEvent = event.detail.originalEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n\n isRightClickOutsideRef.current = isRightClick;\n },\n { checkForDefaultPrevented: false },\n )}\n // When focus is trapped, a `focusout` event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={composeEventHandlers(\n props.onFocusOutside,\n (event) => event.preventDefault(),\n { checkForDefaultPrevented: false },\n )}\n />\n \n );\n },\n);\n\nconst PopoverContentNonModal = /* @__PURE__ */ React.forwardRef<\n PopoverContentTypeElement,\n PopoverContentTypeProps\n>(\n // blank line to reduce diff noise\n function PopoverContentNonModal(props: ScopedProps, forwardedRef) {\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n const hasInteractedOutsideRef = React.useRef(false);\n const hasPointerDownOutsideRef = React.useRef(false);\n\n return (\n {\n props.onCloseAutoFocus?.(event);\n\n if (!event.defaultPrevented) {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault();\n }\n\n hasInteractedOutsideRef.current = false;\n hasPointerDownOutsideRef.current = false;\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event);\n\n if (!event.defaultPrevented) {\n hasInteractedOutsideRef.current = true;\n if (event.detail.originalEvent.type === 'pointerdown') {\n hasPointerDownOutsideRef.current = true;\n }\n }\n\n // Prevent dismissing when clicking the trigger.\n // As the trigger is already setup to close, without doing so would\n // cause it to close and immediately open.\n const target = event.target as HTMLElement;\n const targetIsTrigger = context.triggerRef.current?.contains(target);\n if (targetIsTrigger) event.preventDefault();\n\n // On Safari if the trigger is inside a container with tabIndex={0}, when clicked\n // we will get the pointer down outside event on the trigger, but then a subsequent\n // focus outside event on the container, we ignore any focus outside event when we've\n // already had a pointer down outside event.\n if (event.detail.originalEvent.type === 'focusin' && hasPointerDownOutsideRef.current) {\n event.preventDefault();\n }\n }}\n />\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype PopoverContentImplElement = React.ComponentRef;\ntype FocusScopeProps = React.ComponentPropsWithoutRef;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef;\ntype PopperContentProps = React.ComponentPropsWithoutRef;\ninterface PopoverContentImplProps\n extends Omit, Omit {\n /**\n * Whether focus should be trapped within the `Popover`\n * (default: false)\n */\n trapFocus?: FocusScopeProps['trapped'] | undefined;\n\n /**\n * Event handler called when auto-focusing on open.\n * Can be prevented.\n */\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'] | undefined;\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'] | undefined;\n\n /**\n * Branch nodes registered by nested, portalled layers. Passed to the trapped\n * `FocusScope` so focus isn't reclaimed from them. Only provided by the modal\n * variant.\n * @internal\n */\n branchNodes?: HTMLElement[] | undefined;\n\n /**\n * Registry that nested, portalled layers use to register themselves as branches of this modal\n * `Popover`. Only provided by the modal variant.\n * @internal\n */\n branchRegistry?: FocusScopeBranchRegistry | undefined;\n}\n\nconst PopoverContentImpl = /* @__PURE__ */ React.forwardRef<\n PopoverContentImplElement,\n PopoverContentImplProps\n>(\n // blank line to reduce diff noise\n function PopoverContentImpl(props: ScopedProps, forwardedRef) {\n const {\n __scopePopover,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n 'aria-describedby': ariaDescribedby,\n branchNodes,\n branchRegistry,\n ...contentProps\n } = props;\n const context = usePopoverContext(CONTENT_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n\n // When this `Popover` is nested inside a modal layer (eg. a `Dialog`) but\n // portalled outside of it, register its content with the ancestor layer so\n // focus isn't reclaimed and scroll isn't locked for it. No-ops when there\n // is no ancestor layer. See:\n // https://github.com/radix-ui/primitives/issues/3423\n const [contentNode, setContentNode] = React.useState(null);\n const composedRefs = useComposedRefs(forwardedRef, setContentNode);\n useFocusScopeBranch(contentNode);\n\n // Make sure the whole tree has focus guards as our `Popover` may be\n // the last element in the DOM (because of the `Portal`)\n useFocusGuards();\n\n return (\n \n \n context.onOpenChange(false)}\n deferPointerDownOutside\n >\n \n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverTitle\n * -----------------------------------------------------------------------------------------------*/\n\ntype PopoverTitleElement = React.ComponentRef;\ntype PrimitiveHeading2Props = React.ComponentPropsWithoutRef;\ninterface PopoverTitleProps extends PrimitiveHeading2Props {}\n\nconst PopoverTitle = /* @__PURE__ */ React.forwardRef(\n function PopoverTitle(props: ScopedProps, forwardedRef) {\n const { __scopePopover, ...titleProps } = props;\n const context = usePopoverContext('PopoverTitle', __scopePopover);\n const { setTitleCount } = context;\n useLayoutEffect(() => {\n setTitleCount((count) => count + 1);\n return () => setTitleCount((count) => count - 1);\n }, [setTitleCount]);\n\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverDescription\n * -----------------------------------------------------------------------------------------------*/\n\ntype PopoverDescriptionElement = React.ComponentRef;\ntype PrimitiveParagraphProps = React.ComponentPropsWithoutRef;\ninterface PopoverDescriptionProps extends PrimitiveParagraphProps {}\n\nconst PopoverDescription = /* @__PURE__ */ React.forwardRef<\n PopoverDescriptionElement,\n PopoverDescriptionProps\n>(function PopoverDescription(props: ScopedProps, forwardedRef) {\n const { __scopePopover, ...descriptionProps } = props;\n const context = usePopoverContext('PopoverDescription', __scopePopover);\n const { setDescriptionCount } = context;\n useLayoutEffect(() => {\n setDescriptionCount((count) => count + 1);\n return () => setDescriptionCount((count) => count - 1);\n }, [setDescriptionCount]);\n\n return ;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'PopoverClose';\n\ntype PopoverCloseElement = React.ComponentRef;\ninterface PopoverCloseProps extends PrimitiveButtonProps {}\n\nconst PopoverClose = /* @__PURE__ */ React.forwardRef(\n function PopoverClose(props: ScopedProps, forwardedRef) {\n const { __scopePopover, ...closeProps } = props;\n const context = usePopoverContext(CLOSE_NAME, __scopePopover);\n return (\n context.onOpenChange(false))}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverArrow\n * -----------------------------------------------------------------------------------------------*/\n\ntype PopoverArrowElement = React.ComponentRef;\ntype PopperArrowProps = React.ComponentPropsWithoutRef;\ninterface PopoverArrowProps extends PopperArrowProps {}\n\nconst PopoverArrow = /* @__PURE__ */ React.forwardRef(\n function PopoverArrow(props: ScopedProps, forwardedRef) {\n const { __scopePopover, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopePopover);\n return ;\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open: boolean) {\n return open ? 'open' : 'closed';\n}\n\n// TODO: Move to primitive once that package exposed individual sub-modules\nfunction concatAriaDescribedby(...values: unknown[]): string | undefined {\n const ids = new Set();\n for (const value of values) {\n if (typeof value !== 'string') continue;\n for (const id of String(value).trim().split(/\\s+/)) {\n if (id) ids.add(id);\n }\n }\n\n return ids.size > 0 ? Array.from(ids).join(' ') : undefined;\n}\n\nexport {\n createPopoverScope,\n //\n Popover,\n PopoverAnchor,\n PopoverTrigger,\n PopoverPortal,\n PopoverContent,\n PopoverTitle,\n PopoverDescription,\n PopoverClose,\n PopoverArrow,\n //\n Popover as Root,\n PopoverAnchor as Anchor,\n PopoverTrigger as Trigger,\n PopoverPortal as Portal,\n PopoverContent as Content,\n PopoverTitle as Title,\n PopoverDescription as Description,\n PopoverClose as Close,\n PopoverArrow as Arrow,\n};\nexport type {\n PopoverProps,\n PopoverAnchorProps,\n PopoverTriggerProps,\n PopoverPortalProps,\n PopoverContentProps,\n PopoverTitleProps,\n PopoverDescriptionProps,\n PopoverCloseProps,\n PopoverArrowProps,\n};\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,qCAAgC;AAChC,uBAAqC;AACrC,gCAAgC;AAChC,2BAAmC;AACnC,qCAAiC;AACjC,gCAA+B;AAC/B,+BAKO;AAEP,sBAAsB;AACtB,sBAAiC;AACjC,0BAAkC;AAClC,0BAA0C;AAC1C,4BAAyB;AACzB,6BAA0B;AAC1B,wBAA2B;AAC3B,0CAAqC;AACrC,yBAA2B;AAC3B,iCAA6B;AAoEvB;AA5DN,IA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AAE,MAAM,KAAK,GAAG;AAClD,UAAI,GAAI,KAAI,IAAI,EAAE;AAAA,IACpB;AAAA,EACF;AAEA,SAAO,IAAI,OAAO,IAAI,MAAM,KAAK,GAAG,EAAE,KAAK,GAAG,IAAI;AACpD;AAVS;", + "names": ["PopoverAnchor", "PopoverTrigger", "PortalPrimitive", "PopoverContent", "PopoverContentModal", "PopoverContentNonModal", "PopoverContentImpl", "PopoverTitle", "PopoverDescription", "PopoverClose", "PopoverArrow"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-popover/dist/index.mjs b/e-commerce/node_modules/@radix-ui/react-popover/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9479aabbdc92c0e339e9f18e36c759748ebe4cae --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-popover/dist/index.mjs @@ -0,0 +1,387 @@ +"use client"; +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// src/popover.tsx +import * as React from "react"; +import { useLayoutEffect } from "@radix-ui/react-use-layout-effect"; +import { composeEventHandlers } from "@radix-ui/primitive"; +import { useComposedRefs } from "@radix-ui/react-compose-refs"; +import { createContextScope } from "@radix-ui/react-context"; +import { DismissableLayer } from "@radix-ui/react-dismissable-layer"; +import { useFocusGuards } from "@radix-ui/react-focus-guards"; +import { + FocusScope, + FocusScopeBranchProvider, + useFocusScopeBranch, + useFocusScopeBranchRegistry +} from "@radix-ui/react-focus-scope"; +import { useId } from "@radix-ui/react-id"; +import * as PopperPrimitive from "@radix-ui/react-popper"; +import { createPopperScope } from "@radix-ui/react-popper"; +import { Portal as PortalPrimitive } from "@radix-ui/react-portal"; +import { Presence } from "@radix-ui/react-presence"; +import { Primitive } from "@radix-ui/react-primitive"; +import { createSlot } from "@radix-ui/react-slot"; +import { useControllableState } from "@radix-ui/react-use-controllable-state"; +import { hideOthers } from "aria-hidden"; +import { RemoveScroll } from "react-remove-scroll"; +import { jsx } from "react/jsx-runtime"; +var POPOVER_NAME = "Popover"; +var [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [ + createPopperScope +]); +var usePopperScope = createPopperScope(); +var [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME); +var Popover = /* @__PURE__ */ __name((props) => { + const { + __scopePopover, + children, + open: openProp, + defaultOpen, + onOpenChange, + modal = false + } = props; + const popperScope = usePopperScope(__scopePopover); + const triggerRef = React.useRef(null); + const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false); + const [titleCount, setTitleCount] = React.useState(0); + const [descriptionCount, setDescriptionCount] = React.useState(0); + const [open, setOpen] = useControllableState({ + prop: openProp, + defaultProp: defaultOpen ?? false, + onChange: onOpenChange, + caller: POPOVER_NAME + }); + return /* @__PURE__ */ jsx(PopperPrimitive.Root, { ...popperScope, children: /* @__PURE__ */ jsx( + PopoverProvider, + { + scope: __scopePopover, + contentId: useId(), + titleId: useId(), + descriptionId: useId(), + titlePresent: titleCount > 0, + descriptionPresent: descriptionCount > 0, + setTitleCount, + setDescriptionCount, + triggerRef, + open, + onOpenChange: setOpen, + onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]), + hasCustomAnchor, + onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []), + onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), []), + modal, + children + } + ) }); +}, "Popover"); +var ANCHOR_NAME = "PopoverAnchor"; +var PopoverAnchor = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function PopoverAnchor2(props, forwardedRef) { + const { __scopePopover, ...anchorProps } = props; + const context = usePopoverContext(ANCHOR_NAME, __scopePopover); + const popperScope = usePopperScope(__scopePopover); + const { onCustomAnchorAdd, onCustomAnchorRemove } = context; + React.useEffect(() => { + onCustomAnchorAdd(); + return () => onCustomAnchorRemove(); + }, [onCustomAnchorAdd, onCustomAnchorRemove]); + return /* @__PURE__ */ jsx(PopperPrimitive.Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef }); + }, "PopoverAnchor") +); +var TRIGGER_NAME = "PopoverTrigger"; +var PopoverTrigger = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function PopoverTrigger2(props, forwardedRef) { + const { __scopePopover, ...triggerProps } = props; + const context = usePopoverContext(TRIGGER_NAME, __scopePopover); + const popperScope = usePopperScope(__scopePopover); + const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef); + const trigger = /* @__PURE__ */ jsx( + Primitive.button, + { + type: "button", + "aria-haspopup": "dialog", + "aria-expanded": context.open, + "aria-controls": context.open ? context.contentId : void 0, + "data-state": getState(context.open), + ...triggerProps, + ref: composedTriggerRef, + onClick: composeEventHandlers(props.onClick, context.onOpenToggle) + } + ); + return context.hasCustomAnchor ? trigger : /* @__PURE__ */ jsx(PopperPrimitive.Anchor, { asChild: true, ...popperScope, children: trigger }); + }, "PopoverTrigger") +); +var PORTAL_NAME = "PopoverPortal"; +var [PortalProvider, usePortalContext] = createPopoverContext(PORTAL_NAME, { + forceMount: void 0 +}); +var PopoverPortal = /* @__PURE__ */ __name((props) => { + const { __scopePopover, forceMount, children, container } = props; + const context = usePopoverContext(PORTAL_NAME, __scopePopover); + return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopePopover, forceMount, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(PortalPrimitive, { asChild: true, container, children }) }) }); +}, "PopoverPortal"); +var CONTENT_NAME = "PopoverContent"; +var PopoverContent = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function PopoverContent2(props, forwardedRef) { + const portalContext = usePortalContext(CONTENT_NAME, props.__scopePopover); + const { forceMount = portalContext.forceMount, ...contentProps } = props; + const context = usePopoverContext(CONTENT_NAME, props.__scopePopover); + return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx(PopoverContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(PopoverContentNonModal, { ...contentProps, ref: forwardedRef }) }); + }, "PopoverContent") +); +var Slot = createSlot("PopoverContent.RemoveScroll"); +var PopoverContentModal = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function PopoverContentModal2(props, forwardedRef) { + const context = usePopoverContext(CONTENT_NAME, props.__scopePopover); + const contentRef = React.useRef(null); + const composedRefs = useComposedRefs(forwardedRef, contentRef); + const isRightClickOutsideRef = React.useRef(false); + const { nodes: branchNodes, registry: branchRegistry } = useFocusScopeBranchRegistry(); + React.useEffect(() => { + const content = contentRef.current; + if (content) return hideOthers(content); + }, []); + return /* @__PURE__ */ jsx( + RemoveScroll, + { + as: Slot, + allowPinchZoom: true, + shards: React.useMemo( + () => [contentRef, ...branchNodes.map((node) => ({ current: node }))], + [contentRef, branchNodes] + ), + children: /* @__PURE__ */ jsx( + PopoverContentImpl, + { + ...props, + ref: composedRefs, + branchNodes, + branchRegistry, + trapFocus: context.open, + disableOutsidePointerEvents: true, + onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => { + event.preventDefault(); + if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus(); + }), + onPointerDownOutside: composeEventHandlers( + props.onPointerDownOutside, + (event) => { + const originalEvent = event.detail.originalEvent; + const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true; + const isRightClick = originalEvent.button === 2 || ctrlLeftClick; + isRightClickOutsideRef.current = isRightClick; + }, + { checkForDefaultPrevented: false } + ), + onFocusOutside: composeEventHandlers( + props.onFocusOutside, + (event) => event.preventDefault(), + { checkForDefaultPrevented: false } + ) + } + ) + } + ); + }, "PopoverContentModal") +); +var PopoverContentNonModal = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function PopoverContentNonModal2(props, forwardedRef) { + const context = usePopoverContext(CONTENT_NAME, props.__scopePopover); + const hasInteractedOutsideRef = React.useRef(false); + const hasPointerDownOutsideRef = React.useRef(false); + return /* @__PURE__ */ jsx( + PopoverContentImpl, + { + ...props, + ref: forwardedRef, + trapFocus: false, + disableOutsidePointerEvents: false, + onCloseAutoFocus: (event) => { + props.onCloseAutoFocus?.(event); + if (!event.defaultPrevented) { + if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus(); + event.preventDefault(); + } + hasInteractedOutsideRef.current = false; + hasPointerDownOutsideRef.current = false; + }, + onInteractOutside: (event) => { + props.onInteractOutside?.(event); + if (!event.defaultPrevented) { + hasInteractedOutsideRef.current = true; + if (event.detail.originalEvent.type === "pointerdown") { + hasPointerDownOutsideRef.current = true; + } + } + const target = event.target; + const targetIsTrigger = context.triggerRef.current?.contains(target); + if (targetIsTrigger) event.preventDefault(); + if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) { + event.preventDefault(); + } + } + } + ); + }, "PopoverContentNonModal") +); +var PopoverContentImpl = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function PopoverContentImpl2(props, forwardedRef) { + const { + __scopePopover, + trapFocus, + onOpenAutoFocus, + onCloseAutoFocus, + disableOutsidePointerEvents, + onEscapeKeyDown, + onPointerDownOutside, + onFocusOutside, + onInteractOutside, + "aria-describedby": ariaDescribedby, + branchNodes, + branchRegistry, + ...contentProps + } = props; + const context = usePopoverContext(CONTENT_NAME, __scopePopover); + const popperScope = usePopperScope(__scopePopover); + const [contentNode, setContentNode] = React.useState(null); + const composedRefs = useComposedRefs(forwardedRef, setContentNode); + useFocusScopeBranch(contentNode); + useFocusGuards(); + return /* @__PURE__ */ jsx(FocusScopeBranchProvider, { registry: branchRegistry, children: /* @__PURE__ */ jsx( + FocusScope, + { + asChild: true, + loop: true, + trapped: trapFocus, + branches: branchNodes, + onMountAutoFocus: onOpenAutoFocus, + onUnmountAutoFocus: onCloseAutoFocus, + children: /* @__PURE__ */ jsx( + DismissableLayer, + { + asChild: true, + disableOutsidePointerEvents, + onInteractOutside, + onEscapeKeyDown, + onPointerDownOutside, + onFocusOutside, + onDismiss: () => context.onOpenChange(false), + deferPointerDownOutside: true, + children: /* @__PURE__ */ jsx( + PopperPrimitive.Content, + { + "data-state": getState(context.open), + role: "dialog", + id: context.contentId, + "aria-labelledby": context.titlePresent ? context.titleId : void 0, + "aria-describedby": context.descriptionPresent ? concatAriaDescribedby(ariaDescribedby, context.descriptionId) : ariaDescribedby, + ...popperScope, + ...contentProps, + ref: composedRefs, + style: { + ...contentProps.style, + // re-namespace exposed content custom properties + ...{ + "--radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)", + "--radix-popover-content-available-width": "var(--radix-popper-available-width)", + "--radix-popover-content-available-height": "var(--radix-popper-available-height)", + "--radix-popover-trigger-width": "var(--radix-popper-anchor-width)", + "--radix-popover-trigger-height": "var(--radix-popper-anchor-height)" + } + } + } + ) + } + ) + } + ) }); + }, "PopoverContentImpl") +); +var PopoverTitle = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function PopoverTitle2(props, forwardedRef) { + const { __scopePopover, ...titleProps } = props; + const context = usePopoverContext("PopoverTitle", __scopePopover); + const { setTitleCount } = context; + useLayoutEffect(() => { + setTitleCount((count) => count + 1); + return () => setTitleCount((count) => count - 1); + }, [setTitleCount]); + return /* @__PURE__ */ jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef }); + }, "PopoverTitle") +); +var PopoverDescription = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function PopoverDescription2(props, forwardedRef) { + const { __scopePopover, ...descriptionProps } = props; + const context = usePopoverContext("PopoverDescription", __scopePopover); + const { setDescriptionCount } = context; + useLayoutEffect(() => { + setDescriptionCount((count) => count + 1); + return () => setDescriptionCount((count) => count - 1); + }, [setDescriptionCount]); + return /* @__PURE__ */ jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef }); +}, "PopoverDescription")); +var CLOSE_NAME = "PopoverClose"; +var PopoverClose = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function PopoverClose2(props, forwardedRef) { + const { __scopePopover, ...closeProps } = props; + const context = usePopoverContext(CLOSE_NAME, __scopePopover); + return /* @__PURE__ */ jsx( + Primitive.button, + { + type: "button", + ...closeProps, + ref: forwardedRef, + onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false)) + } + ); + }, "PopoverClose") +); +var PopoverArrow = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function PopoverArrow2(props, forwardedRef) { + const { __scopePopover, ...arrowProps } = props; + const popperScope = usePopperScope(__scopePopover); + return /* @__PURE__ */ jsx(PopperPrimitive.Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef }); + }, "PopoverArrow") +); +function getState(open) { + return open ? "open" : "closed"; +} +__name(getState, "getState"); +function concatAriaDescribedby(...values) { + const ids = /* @__PURE__ */ new Set(); + for (const value of values) { + if (typeof value !== "string") continue; + for (const id of String(value).trim().split(/\s+/)) { + if (id) ids.add(id); + } + } + return ids.size > 0 ? Array.from(ids).join(" ") : void 0; +} +__name(concatAriaDescribedby, "concatAriaDescribedby"); +export { + PopoverAnchor as Anchor, + PopoverArrow as Arrow, + PopoverClose as Close, + PopoverContent as Content, + PopoverDescription as Description, + Popover, + PopoverAnchor, + PopoverArrow, + PopoverClose, + PopoverContent, + PopoverDescription, + PopoverPortal, + PopoverTitle, + PopoverTrigger, + PopoverPortal as Portal, + Popover as Root, + PopoverTitle as Title, + PopoverTrigger as Trigger, + createPopoverScope +}; +//# sourceMappingURL=index.mjs.map diff --git a/e-commerce/node_modules/@radix-ui/react-popover/dist/index.mjs.map b/e-commerce/node_modules/@radix-ui/react-popover/dist/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..912cc5644b1a515cc1604c4fcb7d91fa2717ea54 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-popover/dist/index.mjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/popover.tsx"], + "sourcesContent": ["import * as React from 'react';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport {\n FocusScope,\n FocusScopeBranchProvider,\n useFocusScopeBranch,\n useFocusScopeBranchRegistry,\n} from '@radix-ui/react-focus-scope';\nimport type { FocusScopeBranchRegistry } from '@radix-ui/react-focus-scope';\nimport { useId } from '@radix-ui/react-id';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { createPopperScope } from '@radix-ui/react-popper';\nimport { Portal as PortalPrimitive } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { createSlot } from '@radix-ui/react-slot';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { hideOthers } from 'aria-hidden';\nimport { RemoveScroll } from 'react-remove-scroll';\n\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Popover\n * -----------------------------------------------------------------------------------------------*/\n\nconst POPOVER_NAME = 'Popover';\n\ntype ScopedProps

= P & { __scopePopover?: Scope | undefined };\nconst [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [\n createPopperScope,\n]);\nconst usePopperScope = createPopperScope();\n\ninterface PopoverContextValue {\n triggerRef: React.RefObject;\n contentId: string;\n titleId: string;\n descriptionId: string;\n titlePresent: boolean;\n descriptionPresent: boolean;\n setTitleCount: React.Dispatch>;\n setDescriptionCount: React.Dispatch>;\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpenToggle(): void;\n hasCustomAnchor: boolean;\n onCustomAnchorAdd(): void;\n onCustomAnchorRemove(): void;\n modal: boolean;\n}\n\nconst [PopoverProvider, usePopoverContext] =\n createPopoverContext(POPOVER_NAME);\n\ninterface PopoverProps {\n children?: React.ReactNode | undefined;\n open?: boolean | undefined;\n defaultOpen?: boolean | undefined;\n onOpenChange?: ((open: boolean) => void) | undefined;\n modal?: boolean | undefined;\n}\n\nconst Popover: React.FC = (props: ScopedProps) => {\n const {\n __scopePopover,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = false,\n } = props;\n const popperScope = usePopperScope(__scopePopover);\n const triggerRef = React.useRef(null);\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);\n const [titleCount, setTitleCount] = React.useState(0);\n const [descriptionCount, setDescriptionCount] = React.useState(0);\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n caller: POPOVER_NAME,\n });\n\n return (\n \n 0}\n descriptionPresent={descriptionCount > 0}\n setTitleCount={setTitleCount}\n setDescriptionCount={setDescriptionCount}\n triggerRef={triggerRef}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n hasCustomAnchor={hasCustomAnchor}\n onCustomAnchorAdd={React.useCallback(() => setHasCustomAnchor(true), [])}\n onCustomAnchorRemove={React.useCallback(() => setHasCustomAnchor(false), [])}\n modal={modal}\n >\n {children}\n \n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverAnchor\n * -----------------------------------------------------------------------------------------------*/\n\nconst ANCHOR_NAME = 'PopoverAnchor';\n\ntype PopoverAnchorElement = React.ComponentRef;\ntype PopperAnchorProps = React.ComponentPropsWithoutRef;\ninterface PopoverAnchorProps extends PopperAnchorProps {}\n\nconst PopoverAnchor = /* @__PURE__ */ React.forwardRef(\n function PopoverAnchor(props: ScopedProps, forwardedRef) {\n const { __scopePopover, ...anchorProps } = props;\n const context = usePopoverContext(ANCHOR_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n const { onCustomAnchorAdd, onCustomAnchorRemove } = context;\n\n React.useEffect(() => {\n onCustomAnchorAdd();\n return () => onCustomAnchorRemove();\n }, [onCustomAnchorAdd, onCustomAnchorRemove]);\n\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'PopoverTrigger';\n\ntype PopoverTriggerElement = React.ComponentRef;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef;\ninterface PopoverTriggerProps extends PrimitiveButtonProps {}\n\nconst PopoverTrigger = /* @__PURE__ */ React.forwardRef(\n function PopoverTrigger(props: ScopedProps, forwardedRef) {\n const { __scopePopover, ...triggerProps } = props;\n const context = usePopoverContext(TRIGGER_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);\n\n const trigger = (\n \n );\n\n return context.hasCustomAnchor ? (\n trigger\n ) : (\n \n {trigger}\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'PopoverPortal';\n\ntype PortalContextValue = { forceMount?: true | undefined };\nconst [PortalProvider, usePortalContext] = createPopoverContext(PORTAL_NAME, {\n forceMount: undefined,\n});\n\ntype PortalProps = React.ComponentPropsWithoutRef;\ninterface PopoverPortalProps {\n children?: React.ReactNode | undefined;\n /**\n * Specify a container element to portal the content into.\n */\n container?: PortalProps['container'] | undefined;\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst PopoverPortal: React.FC = (props: ScopedProps) => {\n const { __scopePopover, forceMount, children, container } = props;\n const context = usePopoverContext(PORTAL_NAME, __scopePopover);\n return (\n \n \n \n {children}\n \n \n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopoverContent';\n\ninterface PopoverContentProps extends PopoverContentTypeProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst PopoverContent = /* @__PURE__ */ React.forwardRef<\n PopoverContentTypeElement,\n PopoverContentProps\n>(\n // blank line to reduce diff noise\n function PopoverContent(props: ScopedProps, forwardedRef) {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopePopover);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n return (\n \n {context.modal ? (\n \n ) : (\n \n )}\n \n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Slot = createSlot('PopoverContent.RemoveScroll');\n\ntype PopoverContentTypeElement = PopoverContentImplElement;\ninterface PopoverContentTypeProps extends Omit<\n PopoverContentImplProps,\n 'trapFocus' | 'disableOutsidePointerEvents' | 'branchRegistry' | 'branchNodes'\n> {}\n\nconst PopoverContentModal = /* @__PURE__ */ React.forwardRef<\n PopoverContentTypeElement,\n PopoverContentTypeProps\n>(\n // blank line to reduce diff noise\n function PopoverContentModal(props: ScopedProps, forwardedRef) {\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n const contentRef = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n const isRightClickOutsideRef = React.useRef(false);\n\n // Allows nested portalled layers to register themselves as branches of this\n // modal `Popover` so focus isn't reclaimed and scroll isn't locked for\n // them. See: https://github.com/radix-ui/primitives/issues/3423\n const { nodes: branchNodes, registry: branchRegistry } = useFocusScopeBranchRegistry();\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n const content = contentRef.current;\n if (content) return hideOthers(content);\n }, []);\n\n return (\n [contentRef, ...branchNodes.map((node) => ({ current: node }))],\n [contentRef, branchNodes],\n )}\n >\n {\n event.preventDefault();\n if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();\n })}\n onPointerDownOutside={composeEventHandlers(\n props.onPointerDownOutside,\n (event) => {\n const originalEvent = event.detail.originalEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n\n isRightClickOutsideRef.current = isRightClick;\n },\n { checkForDefaultPrevented: false },\n )}\n // When focus is trapped, a `focusout` event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={composeEventHandlers(\n props.onFocusOutside,\n (event) => event.preventDefault(),\n { checkForDefaultPrevented: false },\n )}\n />\n \n );\n },\n);\n\nconst PopoverContentNonModal = /* @__PURE__ */ React.forwardRef<\n PopoverContentTypeElement,\n PopoverContentTypeProps\n>(\n // blank line to reduce diff noise\n function PopoverContentNonModal(props: ScopedProps, forwardedRef) {\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n const hasInteractedOutsideRef = React.useRef(false);\n const hasPointerDownOutsideRef = React.useRef(false);\n\n return (\n {\n props.onCloseAutoFocus?.(event);\n\n if (!event.defaultPrevented) {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault();\n }\n\n hasInteractedOutsideRef.current = false;\n hasPointerDownOutsideRef.current = false;\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event);\n\n if (!event.defaultPrevented) {\n hasInteractedOutsideRef.current = true;\n if (event.detail.originalEvent.type === 'pointerdown') {\n hasPointerDownOutsideRef.current = true;\n }\n }\n\n // Prevent dismissing when clicking the trigger.\n // As the trigger is already setup to close, without doing so would\n // cause it to close and immediately open.\n const target = event.target as HTMLElement;\n const targetIsTrigger = context.triggerRef.current?.contains(target);\n if (targetIsTrigger) event.preventDefault();\n\n // On Safari if the trigger is inside a container with tabIndex={0}, when clicked\n // we will get the pointer down outside event on the trigger, but then a subsequent\n // focus outside event on the container, we ignore any focus outside event when we've\n // already had a pointer down outside event.\n if (event.detail.originalEvent.type === 'focusin' && hasPointerDownOutsideRef.current) {\n event.preventDefault();\n }\n }}\n />\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype PopoverContentImplElement = React.ComponentRef;\ntype FocusScopeProps = React.ComponentPropsWithoutRef;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef;\ntype PopperContentProps = React.ComponentPropsWithoutRef;\ninterface PopoverContentImplProps\n extends Omit, Omit {\n /**\n * Whether focus should be trapped within the `Popover`\n * (default: false)\n */\n trapFocus?: FocusScopeProps['trapped'] | undefined;\n\n /**\n * Event handler called when auto-focusing on open.\n * Can be prevented.\n */\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'] | undefined;\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'] | undefined;\n\n /**\n * Branch nodes registered by nested, portalled layers. Passed to the trapped\n * `FocusScope` so focus isn't reclaimed from them. Only provided by the modal\n * variant.\n * @internal\n */\n branchNodes?: HTMLElement[] | undefined;\n\n /**\n * Registry that nested, portalled layers use to register themselves as branches of this modal\n * `Popover`. Only provided by the modal variant.\n * @internal\n */\n branchRegistry?: FocusScopeBranchRegistry | undefined;\n}\n\nconst PopoverContentImpl = /* @__PURE__ */ React.forwardRef<\n PopoverContentImplElement,\n PopoverContentImplProps\n>(\n // blank line to reduce diff noise\n function PopoverContentImpl(props: ScopedProps, forwardedRef) {\n const {\n __scopePopover,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n 'aria-describedby': ariaDescribedby,\n branchNodes,\n branchRegistry,\n ...contentProps\n } = props;\n const context = usePopoverContext(CONTENT_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n\n // When this `Popover` is nested inside a modal layer (eg. a `Dialog`) but\n // portalled outside of it, register its content with the ancestor layer so\n // focus isn't reclaimed and scroll isn't locked for it. No-ops when there\n // is no ancestor layer. See:\n // https://github.com/radix-ui/primitives/issues/3423\n const [contentNode, setContentNode] = React.useState(null);\n const composedRefs = useComposedRefs(forwardedRef, setContentNode);\n useFocusScopeBranch(contentNode);\n\n // Make sure the whole tree has focus guards as our `Popover` may be\n // the last element in the DOM (because of the `Portal`)\n useFocusGuards();\n\n return (\n \n \n context.onOpenChange(false)}\n deferPointerDownOutside\n >\n \n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverTitle\n * -----------------------------------------------------------------------------------------------*/\n\ntype PopoverTitleElement = React.ComponentRef;\ntype PrimitiveHeading2Props = React.ComponentPropsWithoutRef;\ninterface PopoverTitleProps extends PrimitiveHeading2Props {}\n\nconst PopoverTitle = /* @__PURE__ */ React.forwardRef(\n function PopoverTitle(props: ScopedProps, forwardedRef) {\n const { __scopePopover, ...titleProps } = props;\n const context = usePopoverContext('PopoverTitle', __scopePopover);\n const { setTitleCount } = context;\n useLayoutEffect(() => {\n setTitleCount((count) => count + 1);\n return () => setTitleCount((count) => count - 1);\n }, [setTitleCount]);\n\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverDescription\n * -----------------------------------------------------------------------------------------------*/\n\ntype PopoverDescriptionElement = React.ComponentRef;\ntype PrimitiveParagraphProps = React.ComponentPropsWithoutRef;\ninterface PopoverDescriptionProps extends PrimitiveParagraphProps {}\n\nconst PopoverDescription = /* @__PURE__ */ React.forwardRef<\n PopoverDescriptionElement,\n PopoverDescriptionProps\n>(function PopoverDescription(props: ScopedProps, forwardedRef) {\n const { __scopePopover, ...descriptionProps } = props;\n const context = usePopoverContext('PopoverDescription', __scopePopover);\n const { setDescriptionCount } = context;\n useLayoutEffect(() => {\n setDescriptionCount((count) => count + 1);\n return () => setDescriptionCount((count) => count - 1);\n }, [setDescriptionCount]);\n\n return ;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'PopoverClose';\n\ntype PopoverCloseElement = React.ComponentRef;\ninterface PopoverCloseProps extends PrimitiveButtonProps {}\n\nconst PopoverClose = /* @__PURE__ */ React.forwardRef(\n function PopoverClose(props: ScopedProps, forwardedRef) {\n const { __scopePopover, ...closeProps } = props;\n const context = usePopoverContext(CLOSE_NAME, __scopePopover);\n return (\n context.onOpenChange(false))}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverArrow\n * -----------------------------------------------------------------------------------------------*/\n\ntype PopoverArrowElement = React.ComponentRef;\ntype PopperArrowProps = React.ComponentPropsWithoutRef;\ninterface PopoverArrowProps extends PopperArrowProps {}\n\nconst PopoverArrow = /* @__PURE__ */ React.forwardRef(\n function PopoverArrow(props: ScopedProps, forwardedRef) {\n const { __scopePopover, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopePopover);\n return ;\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open: boolean) {\n return open ? 'open' : 'closed';\n}\n\n// TODO: Move to primitive once that package exposed individual sub-modules\nfunction concatAriaDescribedby(...values: unknown[]): string | undefined {\n const ids = new Set();\n for (const value of values) {\n if (typeof value !== 'string') continue;\n for (const id of String(value).trim().split(/\\s+/)) {\n if (id) ids.add(id);\n }\n }\n\n return ids.size > 0 ? Array.from(ids).join(' ') : undefined;\n}\n\nexport {\n createPopoverScope,\n //\n Popover,\n PopoverAnchor,\n PopoverTrigger,\n PopoverPortal,\n PopoverContent,\n PopoverTitle,\n PopoverDescription,\n PopoverClose,\n PopoverArrow,\n //\n Popover as Root,\n PopoverAnchor as Anchor,\n PopoverTrigger as Trigger,\n PopoverPortal as Portal,\n PopoverContent as Content,\n PopoverTitle as Title,\n PopoverDescription as Description,\n PopoverClose as Close,\n PopoverArrow as Arrow,\n};\nexport type {\n PopoverProps,\n PopoverAnchorProps,\n PopoverTriggerProps,\n PopoverPortalProps,\n PopoverContentProps,\n PopoverTitleProps,\n PopoverDescriptionProps,\n PopoverCloseProps,\n PopoverArrowProps,\n};\n"], + "mappings": ";;;;;AAAA,YAAY,WAAW;AACvB,SAAS,uBAAuB;AAChC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AW,IAAI;AAC1C,UAAM,cAAc,eAAe,cAAc;AACjD,WAAO,oBAAiB,uBAAhB,EAAuB,GAAG,aAAc,GAAG,YAAY,KAAK,cAAc;AAAA,EACpF,GAJA;AAKF;AAIA,SAAS,SAAS,MAAe;AAC/B,SAAO,OAAO,SAAS;AACzB;AAFS;AAKT,SAAS,yBAAyB,QAAuC;AACvE,QAAM,MAAM,oBAAI,IAAY;AAC5B,aAAW,SAAS,QAAQ;AAC1B,QAAI,OAAO,UAAU,SAAU;AAC/B,eAAW,MAAM,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,GAAG;AAClD,UAAI,GAAI,KAAI,IAAI,EAAE;AAAA,IACpB;AAAA,EACF;AAEA,SAAO,IAAI,OAAO,IAAI,MAAM,KAAK,GAAG,EAAE,KAAK,GAAG,IAAI;AACpD;AAVS;", + "names": ["PopoverAnchor", "PopoverTrigger", "PopoverContent", "PopoverContentModal", "PopoverContentNonModal", "PopoverContentImpl", "PopoverTitle", "PopoverDescription", "PopoverClose", "PopoverArrow"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-popover/package.json b/e-commerce/node_modules/@radix-ui/react-popover/package.json new file mode 100644 index 0000000000000000000000000000000000000000..22127b8150fb4f2afa9adc4a945a1ede160dd7ac --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-popover/package.json @@ -0,0 +1,83 @@ +{ + "name": "@radix-ui/react-popover", + "version": "1.3.0", + "license": "MIT", + "source": "./src/index.ts", + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "files": [ + "dist", + "README.md" + ], + "sideEffects": false, + "dependencies": { + "aria-hidden": "^1.2.4", + "react-remove-scroll": "^2.7.2", + "@radix-ui/primitive": "1.2.0", + "@radix-ui/react-compose-refs": "1.1.5", + "@radix-ui/react-context": "1.3.0", + "@radix-ui/react-dismissable-layer": "1.2.0", + "@radix-ui/react-focus-guards": "1.2.0", + "@radix-ui/react-id": "1.1.4", + "@radix-ui/react-popper": "1.4.0", + "@radix-ui/react-portal": "1.2.0", + "@radix-ui/react-presence": "1.1.11", + "@radix-ui/react-primitive": "2.2.0", + "@radix-ui/react-slot": "1.5.0", + "@radix-ui/react-use-controllable-state": "1.3.0", + "@radix-ui/react-use-layout-effect": "1.1.4", + "@radix-ui/react-focus-scope": "1.3.0" + }, + "devDependencies": { + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "react": "^19.3.0", + "react-dom": "^19.3.0", + "typescript": "^5.9.3", + "@repo/typescript-config": "0.0.0", + "@repo/builder": "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", + "directory": "packages/react/popover" + }, + "bugs": { + "url": "https://github.com/radix-ui/primitives/issues" + }, + "scripts": { + "lint": "oxlint --max-warnings 0 src", + "clean": "rm -rf dist", + "reset": "rm -rf dist node_modules", + "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" + } + } + } +} \ No newline at end of file diff --git a/e-commerce/node_modules/@radix-ui/react-popper/LICENSE b/e-commerce/node_modules/@radix-ui/react-popper/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a18858fb7b014098cba85703e66609be66a26ef5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-popper/LICENSE @@ -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. diff --git a/e-commerce/node_modules/@radix-ui/react-popper/README.md b/e-commerce/node_modules/@radix-ui/react-popper/README.md new file mode 100644 index 0000000000000000000000000000000000000000..187ada0533f0c3f9079ce91584112e30d6824323 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-popper/README.md @@ -0,0 +1,3 @@ +# `react-popper` + +This is an internal utility, not intended for public usage. diff --git a/e-commerce/node_modules/@radix-ui/react-popper/dist/index.d.mts b/e-commerce/node_modules/@radix-ui/react-popper/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..57abb24ff789dffcc887200ae8cfa047cb883ea9 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-popper/dist/index.d.mts @@ -0,0 +1,52 @@ +import * as _radix_ui_react_context from '@radix-ui/react-context'; +import * as React from 'react'; +import * as ArrowPrimitive from '@radix-ui/react-arrow'; +import { Primitive } from '@radix-ui/react-primitive'; +import { Measurable } from '@radix-ui/rect'; + +declare const SIDE_OPTIONS: readonly ["top", "right", "bottom", "left"]; +declare const ALIGN_OPTIONS: readonly ["start", "center", "end"]; +type Side = (typeof SIDE_OPTIONS)[number]; +type Align = (typeof ALIGN_OPTIONS)[number]; +declare const Sticky: { + readonly Partial: "partial"; + readonly Always: "always"; +}; +type Sticky = (typeof Sticky)[keyof typeof Sticky]; +declare const UpdatePositionStrategy: { + readonly Optimized: "optimized"; + readonly Always: "always"; +}; +type UpdatePositionStrategy = (typeof UpdatePositionStrategy)[keyof typeof UpdatePositionStrategy]; +declare const createPopperScope: _radix_ui_react_context.CreateScope; +interface PopperProps { + children?: React.ReactNode | undefined; +} +declare const Popper: React.FC; +type PrimitiveDivProps = React.ComponentPropsWithoutRef; +interface PopperAnchorProps extends PrimitiveDivProps { + virtualRef?: React.RefObject | undefined; +} +declare const PopperAnchor: React.ForwardRefExoticComponent>; +type Boundary = Element | null; +interface PopperContentProps extends PrimitiveDivProps { + side?: Side | undefined; + sideOffset?: number | undefined; + align?: Align | undefined; + alignOffset?: number | undefined; + arrowPadding?: number | undefined; + avoidCollisions?: boolean | undefined; + collisionBoundary?: Boundary | Boundary[] | undefined; + collisionPadding?: number | Partial> | undefined; + sticky?: Sticky | undefined; + hideWhenDetached?: boolean | undefined; + updatePositionStrategy?: UpdatePositionStrategy | undefined; + onPlaced?: (() => void) | undefined; +} +declare const PopperContent: React.ForwardRefExoticComponent>; +type ArrowProps = React.ComponentPropsWithoutRef; +interface PopperArrowProps extends ArrowProps { +} +declare const PopperArrow: React.ForwardRefExoticComponent>; + +export { ALIGN_OPTIONS, PopperAnchor as Anchor, PopperArrow as Arrow, PopperContent as Content, Popper, PopperAnchor, type PopperAnchorProps, PopperArrow, type PopperArrowProps, PopperContent, type PopperContentProps, type PopperProps, Popper as Root, SIDE_OPTIONS, createPopperScope }; diff --git a/e-commerce/node_modules/@radix-ui/react-popper/dist/index.d.ts b/e-commerce/node_modules/@radix-ui/react-popper/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..57abb24ff789dffcc887200ae8cfa047cb883ea9 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-popper/dist/index.d.ts @@ -0,0 +1,52 @@ +import * as _radix_ui_react_context from '@radix-ui/react-context'; +import * as React from 'react'; +import * as ArrowPrimitive from '@radix-ui/react-arrow'; +import { Primitive } from '@radix-ui/react-primitive'; +import { Measurable } from '@radix-ui/rect'; + +declare const SIDE_OPTIONS: readonly ["top", "right", "bottom", "left"]; +declare const ALIGN_OPTIONS: readonly ["start", "center", "end"]; +type Side = (typeof SIDE_OPTIONS)[number]; +type Align = (typeof ALIGN_OPTIONS)[number]; +declare const Sticky: { + readonly Partial: "partial"; + readonly Always: "always"; +}; +type Sticky = (typeof Sticky)[keyof typeof Sticky]; +declare const UpdatePositionStrategy: { + readonly Optimized: "optimized"; + readonly Always: "always"; +}; +type UpdatePositionStrategy = (typeof UpdatePositionStrategy)[keyof typeof UpdatePositionStrategy]; +declare const createPopperScope: _radix_ui_react_context.CreateScope; +interface PopperProps { + children?: React.ReactNode | undefined; +} +declare const Popper: React.FC; +type PrimitiveDivProps = React.ComponentPropsWithoutRef; +interface PopperAnchorProps extends PrimitiveDivProps { + virtualRef?: React.RefObject | undefined; +} +declare const PopperAnchor: React.ForwardRefExoticComponent>; +type Boundary = Element | null; +interface PopperContentProps extends PrimitiveDivProps { + side?: Side | undefined; + sideOffset?: number | undefined; + align?: Align | undefined; + alignOffset?: number | undefined; + arrowPadding?: number | undefined; + avoidCollisions?: boolean | undefined; + collisionBoundary?: Boundary | Boundary[] | undefined; + collisionPadding?: number | Partial> | undefined; + sticky?: Sticky | undefined; + hideWhenDetached?: boolean | undefined; + updatePositionStrategy?: UpdatePositionStrategy | undefined; + onPlaced?: (() => void) | undefined; +} +declare const PopperContent: React.ForwardRefExoticComponent>; +type ArrowProps = React.ComponentPropsWithoutRef; +interface PopperArrowProps extends ArrowProps { +} +declare const PopperArrow: React.ForwardRefExoticComponent>; + +export { ALIGN_OPTIONS, PopperAnchor as Anchor, PopperArrow as Arrow, PopperContent as Content, Popper, PopperAnchor, type PopperAnchorProps, PopperArrow, type PopperArrowProps, PopperContent, type PopperContentProps, type PopperProps, Popper as Root, SIDE_OPTIONS, createPopperScope }; diff --git a/e-commerce/node_modules/@radix-ui/react-popper/dist/index.js b/e-commerce/node_modules/@radix-ui/react-popper/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..03d64e2b5963fcbe48c1327808815e61a3fa99fe --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-popper/dist/index.js @@ -0,0 +1,396 @@ +"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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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, { + ALIGN_OPTIONS: () => ALIGN_OPTIONS, + Anchor: () => PopperAnchor, + Arrow: () => PopperArrow, + Content: () => PopperContent, + Popper: () => Popper, + PopperAnchor: () => PopperAnchor, + PopperArrow: () => PopperArrow, + PopperContent: () => PopperContent, + Root: () => Popper, + SIDE_OPTIONS: () => SIDE_OPTIONS, + createPopperScope: () => createPopperScope +}); +module.exports = __toCommonJS(index_exports); + +// src/popper.tsx +var React = __toESM(require("react")); +var import_react_dom = require("@floating-ui/react-dom"); +var ArrowPrimitive = __toESM(require("@radix-ui/react-arrow")); +var import_react_compose_refs = require("@radix-ui/react-compose-refs"); +var import_react_context = require("@radix-ui/react-context"); +var import_react_primitive = require("@radix-ui/react-primitive"); +var import_react_use_callback_ref = require("@radix-ui/react-use-callback-ref"); +var import_react_use_layout_effect = require("@radix-ui/react-use-layout-effect"); +var import_react_use_size = require("@radix-ui/react-use-size"); +var import_jsx_runtime = require("react/jsx-runtime"); +var SIDE_OPTIONS = ["top", "right", "bottom", "left"]; +var ALIGN_OPTIONS = ["start", "center", "end"]; +var Sticky = { + Partial: "partial", + Always: "always" +}; +var UpdatePositionStrategy = { + Optimized: "optimized", + Always: "always" +}; +var POPPER_NAME = "Popper"; +var [createPopperContext, createPopperScope] = (0, import_react_context.createContextScope)(POPPER_NAME); +var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME); +var Popper = /* @__PURE__ */ __name((props) => { + const { __scopePopper, children } = props; + const [anchor, setAnchor] = React.useState(null); + const [placementState, setPlacementState] = React.useState(void 0); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + PopperProvider, + { + scope: __scopePopper, + anchor, + onAnchorChange: setAnchor, + placementState, + setPlacementState, + children + } + ); +}, "Popper"); +var ANCHOR_NAME = "PopperAnchor"; +var PopperAnchor = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function PopperAnchor2(props, forwardedRef) { + const { __scopePopper, virtualRef, ...anchorProps } = props; + const context = usePopperContext(ANCHOR_NAME, __scopePopper); + const ref = React.useRef(null); + const onAnchorChange = context.onAnchorChange; + const callbackRef = React.useCallback( + (node) => { + ref.current = node; + if (node) { + onAnchorChange(node); + } + }, + [onAnchorChange] + ); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, callbackRef); + const anchorRef = React.useRef(null); + React.useEffect(() => { + if (!virtualRef) { + return; + } + const previousAnchor = anchorRef.current; + anchorRef.current = virtualRef.current; + if (previousAnchor !== anchorRef.current) { + onAnchorChange(anchorRef.current); + } + }); + const sideAndAlign = context.placementState && getSideAndAlignFromPlacement(context.placementState); + const placedSide = sideAndAlign?.[0]; + const placedAlign = sideAndAlign?.[1]; + return virtualRef ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.div, + { + "data-radix-popper-side": placedSide, + "data-radix-popper-align": placedAlign, + ...anchorProps, + ref: composedRefs + } + ); + }, "PopperAnchor") +); +var CONTENT_NAME = "PopperContent"; +var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME); +var PopperContent = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function PopperContent2(props, forwardedRef) { + const { + __scopePopper, + side = "bottom", + sideOffset = 0, + align = "center", + alignOffset = 0, + arrowPadding = 0, + avoidCollisions = true, + collisionBoundary = [], + collisionPadding: collisionPaddingProp = 0, + sticky = Sticky.Partial, + hideWhenDetached = false, + updatePositionStrategy = UpdatePositionStrategy.Optimized, + onPlaced, + ...contentProps + } = props; + const context = usePopperContext(CONTENT_NAME, __scopePopper); + const [content, setContent] = React.useState(null); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, setContent); + const [arrow, setArrow] = React.useState(null); + const arrowSize = (0, import_react_use_size.useSize)(arrow); + const arrowWidth = arrowSize?.width ?? 0; + const arrowHeight = arrowSize?.height ?? 0; + const desiredPlacement = side + (align !== "center" ? "-" + align : ""); + const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp }; + const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary]; + const hasExplicitBoundaries = boundary.length > 0; + const detectOverflowOptions = { + padding: collisionPadding, + boundary: boundary.filter(isNotNull), + // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries + altBoundary: hasExplicitBoundaries + }; + const { refs, floatingStyles, placement, isPositioned, middlewareData } = (0, import_react_dom.useFloating)({ + // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues + strategy: "fixed", + placement: desiredPlacement, + whileElementsMounted: /* @__PURE__ */ __name((...args) => { + const cleanup = (0, import_react_dom.autoUpdate)(...args, { + animationFrame: updatePositionStrategy === UpdatePositionStrategy.Always + }); + return cleanup; + }, "whileElementsMounted"), + elements: { + reference: context.anchor + }, + middleware: [ + (0, import_react_dom.offset)({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }), + avoidCollisions && (0, import_react_dom.shift)({ + mainAxis: true, + crossAxis: false, + // Spread rather than passing `limiter: undefined`, which + // `exactOptionalPropertyTypes` rejects for Floating UI's optional option. + ...sticky === Sticky.Partial ? { limiter: (0, import_react_dom.limitShift)() } : {}, + ...detectOverflowOptions + }), + avoidCollisions && (0, import_react_dom.flip)({ ...detectOverflowOptions }), + (0, import_react_dom.size)({ + ...detectOverflowOptions, + apply: /* @__PURE__ */ __name(({ elements, rects, availableWidth, availableHeight }) => { + const { width: anchorWidth, height: anchorHeight } = rects.reference; + const contentStyle = elements.floating.style; + contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`); + contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`); + contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`); + contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`); + }, "apply") + }), + arrow && (0, import_react_dom.arrow)({ element: arrow, padding: arrowPadding }), + transformOrigin({ arrowWidth, arrowHeight }), + hideWhenDetached && // `hide` detects whether the anchor (reference) is clipped, so when + // no explicit `collisionBoundary` is set we omit `boundary` entirely + // and fall back to Floating UI's default clipping ancestors (e.g. a + // scrollable menu). This lets an occluded submenu hide once its anchor + // scrolls out of view (#3237). The collision/size middlewares + // deliberately keep the viewport-based default to avoid clamping + // content rendered inside transformed or overflow-clipping portal + // containers. The key is omitted rather than set to `undefined` + // because `exactOptionalPropertyTypes` rejects the explicit value. + (0, import_react_dom.hide)( + hasExplicitBoundaries ? { strategy: "referenceHidden", ...detectOverflowOptions } : { + strategy: "referenceHidden", + padding: detectOverflowOptions.padding, + altBoundary: detectOverflowOptions.altBoundary + } + ) + ] + }); + const setPlacementState = context.setPlacementState; + (0, import_react_use_layout_effect.useLayoutEffect)(() => { + setPlacementState(placement); + return () => { + setPlacementState(void 0); + }; + }, [placement, setPlacementState]); + const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement); + const handlePlaced = (0, import_react_use_callback_ref.useCallbackRef)(onPlaced); + (0, import_react_use_layout_effect.useLayoutEffect)(() => { + if (isPositioned) { + handlePlaced?.(); + } + }, [isPositioned, handlePlaced]); + const arrowX = middlewareData.arrow?.x; + const arrowY = middlewareData.arrow?.y; + const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0; + const [contentZIndex, setContentZIndex] = React.useState(); + (0, import_react_use_layout_effect.useLayoutEffect)(() => { + if (content) setContentZIndex(window.getComputedStyle(content).zIndex); + }, [content]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + "div", + { + ref: refs.setFloating, + "data-radix-popper-content-wrapper": "", + style: { + ...floatingStyles, + transform: isPositioned ? floatingStyles.transform : "translate(0, -200%)", + // keep off the page when measuring + minWidth: "max-content", + zIndex: contentZIndex, + "--radix-popper-transform-origin": [ + middlewareData.transformOrigin?.x, + middlewareData.transformOrigin?.y + ].join(" "), + // hide the content if using the hide middleware and should be hidden + // set visibility to hidden and disable pointer events so the UI behaves + // as if the PopperContent isn't there at all + ...middlewareData.hide?.referenceHidden && { + visibility: "hidden", + pointerEvents: "none" + } + }, + dir: props.dir, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + PopperContentProvider, + { + scope: __scopePopper, + placedSide, + placedAlign, + onArrowChange: setArrow, + arrowX, + arrowY, + shouldHideArrow: cannotCenterArrow, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.div, + { + "data-side": placedSide, + "data-align": placedAlign, + ...contentProps, + ref: composedRefs, + style: { + ...contentProps.style, + // if the PopperContent hasn't been placed yet (not all + // measurements done) we prevent animations so that users' + // animations don't kick in too early from the wrong sides. + animation: !isPositioned ? "none" : contentProps.style?.animation + } + } + ) + } + ) + } + ); + }, "PopperContent") +); +var ARROW_NAME = "PopperArrow"; +var OPPOSITE_SIDE = { + top: "bottom", + right: "left", + bottom: "top", + left: "right" +}; +var PopperArrow = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function PopperArrow2(props, forwardedRef) { + const { __scopePopper, ...arrowProps } = props; + const contentContext = useContentContext(ARROW_NAME, __scopePopper); + const baseSide = OPPOSITE_SIDE[contentContext.placedSide]; + return ( + // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`) + // doesn't report size as we'd expect on SVG elements. + // it reports their bounding box which is effectively the largest path inside the SVG. + /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + "span", + { + ref: contentContext.onArrowChange, + style: { + position: "absolute", + left: contentContext.arrowX, + top: contentContext.arrowY, + [baseSide]: 0, + transformOrigin: { + top: "", + right: "0 0", + bottom: "center 0", + left: "100% 0" + }[contentContext.placedSide], + transform: { + top: "translateY(100%)", + right: "translateY(50%) rotate(90deg) translateX(-50%)", + bottom: `rotate(180deg)`, + left: "translateY(50%) rotate(-90deg) translateX(50%)" + }[contentContext.placedSide], + visibility: contentContext.shouldHideArrow ? "hidden" : void 0 + }, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + ArrowPrimitive.Root, + { + ...arrowProps, + ref: forwardedRef, + style: { + ...arrowProps.style, + // ensures the element can be measured correctly (mostly for if SVG) + display: "block" + } + } + ) + } + ) + ); + }, "PopperArrow") +); +function isNotNull(value) { + return value !== null; +} +__name(isNotNull, "isNotNull"); +var transformOrigin = /* @__PURE__ */ __name((options) => ({ + name: "transformOrigin", + options, + fn(data) { + const { placement, rects, middlewareData } = data; + const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0; + const isArrowHidden = cannotCenterArrow; + const arrowWidth = isArrowHidden ? 0 : options.arrowWidth; + const arrowHeight = isArrowHidden ? 0 : options.arrowHeight; + const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement); + const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign]; + const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2; + const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2; + let x = ""; + let y = ""; + if (placedSide === "bottom") { + x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`; + y = `${-arrowHeight}px`; + } else if (placedSide === "top") { + x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`; + y = `${rects.floating.height + arrowHeight}px`; + } else if (placedSide === "right") { + x = `${-arrowHeight}px`; + y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`; + } else if (placedSide === "left") { + x = `${rects.floating.width + arrowHeight}px`; + y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`; + } + return { data: { x, y } }; + } +}), "transformOrigin"); +function getSideAndAlignFromPlacement(placement) { + const [side, align = "center"] = placement.split("-"); + return [side, align]; +} +__name(getSideAndAlignFromPlacement, "getSideAndAlignFromPlacement"); +//# sourceMappingURL=index.js.map diff --git a/e-commerce/node_modules/@radix-ui/react-popper/dist/index.js.map b/e-commerce/node_modules/@radix-ui/react-popper/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..eed702dfc8561d55dd310978b7f726f8c5639f23 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-popper/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts", "../src/popper.tsx"], + "sourcesContent": ["'use client';\nexport {\n createPopperScope,\n //\n Popper,\n PopperAnchor,\n PopperContent,\n PopperArrow,\n //\n Root,\n Anchor,\n Content,\n Arrow,\n //\n SIDE_OPTIONS,\n ALIGN_OPTIONS,\n} from './popper';\nexport type {\n PopperProps,\n PopperAnchorProps,\n PopperContentProps,\n PopperArrowProps,\n} from './popper';\n", "import * as React from 'react';\nimport {\n useFloating,\n autoUpdate,\n offset,\n shift,\n limitShift,\n hide,\n arrow as floatingUIarrow,\n flip,\n size,\n} from '@floating-ui/react-dom';\nimport * as ArrowPrimitive from '@radix-ui/react-arrow';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { useSize } from '@radix-ui/react-use-size';\n\nimport type { Placement, Middleware } from '@floating-ui/react-dom';\nimport type { Scope } from '@radix-ui/react-context';\nimport type { Measurable } from '@radix-ui/rect';\n\nconst SIDE_OPTIONS = ['top', 'right', 'bottom', 'left'] as const;\nconst ALIGN_OPTIONS = ['start', 'center', 'end'] as const;\n\ntype Side = (typeof SIDE_OPTIONS)[number];\ntype Align = (typeof ALIGN_OPTIONS)[number];\n\nconst Sticky = {\n Partial: 'partial',\n Always: 'always',\n} as const;\n\nconst UpdatePositionStrategy = {\n Optimized: 'optimized',\n Always: 'always',\n} as const;\n\ntype Sticky = (typeof Sticky)[keyof typeof Sticky];\ntype UpdatePositionStrategy = (typeof UpdatePositionStrategy)[keyof typeof UpdatePositionStrategy];\n\n/* -------------------------------------------------------------------------------------------------\n * Popper\n * -----------------------------------------------------------------------------------------------*/\n\nconst POPPER_NAME = 'Popper';\n\ntype ScopedProps

= P & { __scopePopper?: Scope | undefined };\nconst [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);\n\ntype PopperContextValue = {\n anchor: Measurable | null;\n onAnchorChange(anchor: Measurable | null): void;\n placementState: Placement | undefined;\n setPlacementState: React.Dispatch>;\n};\nconst [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);\n\ninterface PopperProps {\n children?: React.ReactNode | undefined;\n}\nconst Popper: React.FC = (props: ScopedProps) => {\n const { __scopePopper, children } = props;\n const [anchor, setAnchor] = React.useState(null);\n const [placementState, setPlacementState] = React.useState(undefined);\n return (\n \n {children}\n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PopperAnchor\n * -----------------------------------------------------------------------------------------------*/\n\nconst ANCHOR_NAME = 'PopperAnchor';\n\ntype PopperAnchorElement = React.ComponentRef;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef;\ninterface PopperAnchorProps extends PrimitiveDivProps {\n virtualRef?: React.RefObject | undefined;\n}\n\nconst PopperAnchor = /* @__PURE__ */ React.forwardRef(\n function PopperAnchor(props: ScopedProps, forwardedRef) {\n const { __scopePopper, virtualRef, ...anchorProps } = props;\n const context = usePopperContext(ANCHOR_NAME, __scopePopper);\n const ref = React.useRef(null);\n const onAnchorChange = context.onAnchorChange;\n\n // For DOM anchors, set the anchor from a callback ref rather than an\n // effect. React invokes callback refs during the commit phase which does\n // not count toward the nested update depth limit, so mounting many\n // Popper-based components at once doesn't trigger \"Maximum update depth\n // exceeded\"\n // see https://github.com/radix-ui/primitives/issues/3858\n const callbackRef = React.useCallback(\n (node: PopperAnchorElement | null) => {\n ref.current = node;\n if (node) {\n onAnchorChange(node);\n }\n },\n [onAnchorChange],\n );\n const composedRefs = useComposedRefs(forwardedRef, callbackRef);\n\n const anchorRef = React.useRef(null);\n React.useEffect(() => {\n if (!virtualRef) {\n return;\n }\n\n const previousAnchor = anchorRef.current;\n anchorRef.current = virtualRef.current;\n if (previousAnchor !== anchorRef.current) {\n onAnchorChange(anchorRef.current);\n }\n });\n\n const sideAndAlign =\n context.placementState && getSideAndAlignFromPlacement(context.placementState);\n const placedSide = sideAndAlign?.[0];\n const placedAlign = sideAndAlign?.[1];\n\n return virtualRef ? null : (\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopperContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopperContent';\n\ntype PopperContentContextValue = {\n placedSide: Side;\n placedAlign: Align;\n onArrowChange(arrow: HTMLSpanElement | null): void;\n arrowX?: number | undefined;\n arrowY?: number | undefined;\n shouldHideArrow: boolean;\n};\n\nconst [PopperContentProvider, useContentContext] =\n createPopperContext(CONTENT_NAME);\n\ntype Boundary = Element | null;\n\ntype PopperContentElement = React.ComponentRef;\ninterface PopperContentProps extends PrimitiveDivProps {\n side?: Side | undefined;\n sideOffset?: number | undefined;\n align?: Align | undefined;\n alignOffset?: number | undefined;\n arrowPadding?: number | undefined;\n avoidCollisions?: boolean | undefined;\n collisionBoundary?: Boundary | Boundary[] | undefined;\n collisionPadding?: number | Partial> | undefined;\n sticky?: Sticky | undefined;\n hideWhenDetached?: boolean | undefined;\n updatePositionStrategy?: UpdatePositionStrategy | undefined;\n onPlaced?: (() => void) | undefined;\n}\n\nconst PopperContent = /* @__PURE__ */ React.forwardRef(\n function PopperContent(props: ScopedProps, forwardedRef) {\n const {\n __scopePopper,\n side = 'bottom',\n sideOffset = 0,\n align = 'center',\n alignOffset = 0,\n arrowPadding = 0,\n avoidCollisions = true,\n collisionBoundary = [],\n collisionPadding: collisionPaddingProp = 0,\n sticky = Sticky.Partial,\n hideWhenDetached = false,\n updatePositionStrategy = UpdatePositionStrategy.Optimized,\n onPlaced,\n ...contentProps\n } = props;\n\n const context = usePopperContext(CONTENT_NAME, __scopePopper);\n\n const [content, setContent] = React.useState(null);\n const composedRefs = useComposedRefs(forwardedRef, setContent);\n\n const [arrow, setArrow] = React.useState(null);\n const arrowSize = useSize(arrow);\n const arrowWidth = arrowSize?.width ?? 0;\n const arrowHeight = arrowSize?.height ?? 0;\n\n const desiredPlacement = (side + (align !== 'center' ? '-' + align : '')) as Placement;\n\n const collisionPadding =\n typeof collisionPaddingProp === 'number'\n ? collisionPaddingProp\n : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };\n\n const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];\n const hasExplicitBoundaries = boundary.length > 0;\n\n const detectOverflowOptions = {\n padding: collisionPadding,\n boundary: boundary.filter(isNotNull),\n // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries\n altBoundary: hasExplicitBoundaries,\n };\n\n const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({\n // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues\n strategy: 'fixed',\n placement: desiredPlacement,\n whileElementsMounted: (...args) => {\n const cleanup = autoUpdate(...args, {\n animationFrame: updatePositionStrategy === UpdatePositionStrategy.Always,\n });\n return cleanup;\n },\n elements: {\n reference: context.anchor,\n },\n middleware: [\n offset({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),\n avoidCollisions &&\n shift({\n mainAxis: true,\n crossAxis: false,\n // Spread rather than passing `limiter: undefined`, which\n // `exactOptionalPropertyTypes` rejects for Floating UI's optional option.\n ...(sticky === Sticky.Partial ? { limiter: limitShift() } : {}),\n ...detectOverflowOptions,\n }),\n avoidCollisions && flip({ ...detectOverflowOptions }),\n size({\n ...detectOverflowOptions,\n apply: ({ elements, rects, availableWidth, availableHeight }) => {\n const { width: anchorWidth, height: anchorHeight } = rects.reference;\n const contentStyle = elements.floating.style;\n contentStyle.setProperty('--radix-popper-available-width', `${availableWidth}px`);\n contentStyle.setProperty('--radix-popper-available-height', `${availableHeight}px`);\n contentStyle.setProperty('--radix-popper-anchor-width', `${anchorWidth}px`);\n contentStyle.setProperty('--radix-popper-anchor-height', `${anchorHeight}px`);\n },\n }),\n arrow && floatingUIarrow({ element: arrow, padding: arrowPadding }),\n transformOrigin({ arrowWidth, arrowHeight }),\n hideWhenDetached &&\n // `hide` detects whether the anchor (reference) is clipped, so when\n // no explicit `collisionBoundary` is set we omit `boundary` entirely\n // and fall back to Floating UI's default clipping ancestors (e.g. a\n // scrollable menu). This lets an occluded submenu hide once its anchor\n // scrolls out of view (#3237). The collision/size middlewares\n // deliberately keep the viewport-based default to avoid clamping\n // content rendered inside transformed or overflow-clipping portal\n // containers. The key is omitted rather than set to `undefined`\n // because `exactOptionalPropertyTypes` rejects the explicit value.\n hide(\n hasExplicitBoundaries\n ? { strategy: 'referenceHidden', ...detectOverflowOptions }\n : {\n strategy: 'referenceHidden',\n padding: detectOverflowOptions.padding,\n altBoundary: detectOverflowOptions.altBoundary,\n },\n ),\n ],\n });\n\n const setPlacementState = context.setPlacementState;\n useLayoutEffect(() => {\n setPlacementState(placement);\n return () => {\n setPlacementState(undefined);\n };\n }, [placement, setPlacementState]);\n\n const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);\n\n const handlePlaced = useCallbackRef(onPlaced);\n useLayoutEffect(() => {\n if (isPositioned) {\n handlePlaced?.();\n }\n }, [isPositioned, handlePlaced]);\n\n const arrowX = middlewareData.arrow?.x;\n const arrowY = middlewareData.arrow?.y;\n const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;\n\n const [contentZIndex, setContentZIndex] = React.useState();\n useLayoutEffect(() => {\n if (content) setContentZIndex(window.getComputedStyle(content).zIndex);\n }, [content]);\n\n return (\n

= P & { __scopePopper?: Scope | undefined };\nconst [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);\n\ntype PopperContextValue = {\n anchor: Measurable | null;\n onAnchorChange(anchor: Measurable | null): void;\n placementState: Placement | undefined;\n setPlacementState: React.Dispatch>;\n};\nconst [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);\n\ninterface PopperProps {\n children?: React.ReactNode | undefined;\n}\nconst Popper: React.FC = (props: ScopedProps) => {\n const { __scopePopper, children } = props;\n const [anchor, setAnchor] = React.useState(null);\n const [placementState, setPlacementState] = React.useState(undefined);\n return (\n \n {children}\n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PopperAnchor\n * -----------------------------------------------------------------------------------------------*/\n\nconst ANCHOR_NAME = 'PopperAnchor';\n\ntype PopperAnchorElement = React.ComponentRef;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef;\ninterface PopperAnchorProps extends PrimitiveDivProps {\n virtualRef?: React.RefObject | undefined;\n}\n\nconst PopperAnchor = /* @__PURE__ */ React.forwardRef(\n function PopperAnchor(props: ScopedProps, forwardedRef) {\n const { __scopePopper, virtualRef, ...anchorProps } = props;\n const context = usePopperContext(ANCHOR_NAME, __scopePopper);\n const ref = React.useRef(null);\n const onAnchorChange = context.onAnchorChange;\n\n // For DOM anchors, set the anchor from a callback ref rather than an\n // effect. React invokes callback refs during the commit phase which does\n // not count toward the nested update depth limit, so mounting many\n // Popper-based components at once doesn't trigger \"Maximum update depth\n // exceeded\"\n // see https://github.com/radix-ui/primitives/issues/3858\n const callbackRef = React.useCallback(\n (node: PopperAnchorElement | null) => {\n ref.current = node;\n if (node) {\n onAnchorChange(node);\n }\n },\n [onAnchorChange],\n );\n const composedRefs = useComposedRefs(forwardedRef, callbackRef);\n\n const anchorRef = React.useRef(null);\n React.useEffect(() => {\n if (!virtualRef) {\n return;\n }\n\n const previousAnchor = anchorRef.current;\n anchorRef.current = virtualRef.current;\n if (previousAnchor !== anchorRef.current) {\n onAnchorChange(anchorRef.current);\n }\n });\n\n const sideAndAlign =\n context.placementState && getSideAndAlignFromPlacement(context.placementState);\n const placedSide = sideAndAlign?.[0];\n const placedAlign = sideAndAlign?.[1];\n\n return virtualRef ? null : (\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopperContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopperContent';\n\ntype PopperContentContextValue = {\n placedSide: Side;\n placedAlign: Align;\n onArrowChange(arrow: HTMLSpanElement | null): void;\n arrowX?: number | undefined;\n arrowY?: number | undefined;\n shouldHideArrow: boolean;\n};\n\nconst [PopperContentProvider, useContentContext] =\n createPopperContext(CONTENT_NAME);\n\ntype Boundary = Element | null;\n\ntype PopperContentElement = React.ComponentRef;\ninterface PopperContentProps extends PrimitiveDivProps {\n side?: Side | undefined;\n sideOffset?: number | undefined;\n align?: Align | undefined;\n alignOffset?: number | undefined;\n arrowPadding?: number | undefined;\n avoidCollisions?: boolean | undefined;\n collisionBoundary?: Boundary | Boundary[] | undefined;\n collisionPadding?: number | Partial> | undefined;\n sticky?: Sticky | undefined;\n hideWhenDetached?: boolean | undefined;\n updatePositionStrategy?: UpdatePositionStrategy | undefined;\n onPlaced?: (() => void) | undefined;\n}\n\nconst PopperContent = /* @__PURE__ */ React.forwardRef(\n function PopperContent(props: ScopedProps, forwardedRef) {\n const {\n __scopePopper,\n side = 'bottom',\n sideOffset = 0,\n align = 'center',\n alignOffset = 0,\n arrowPadding = 0,\n avoidCollisions = true,\n collisionBoundary = [],\n collisionPadding: collisionPaddingProp = 0,\n sticky = Sticky.Partial,\n hideWhenDetached = false,\n updatePositionStrategy = UpdatePositionStrategy.Optimized,\n onPlaced,\n ...contentProps\n } = props;\n\n const context = usePopperContext(CONTENT_NAME, __scopePopper);\n\n const [content, setContent] = React.useState(null);\n const composedRefs = useComposedRefs(forwardedRef, setContent);\n\n const [arrow, setArrow] = React.useState(null);\n const arrowSize = useSize(arrow);\n const arrowWidth = arrowSize?.width ?? 0;\n const arrowHeight = arrowSize?.height ?? 0;\n\n const desiredPlacement = (side + (align !== 'center' ? '-' + align : '')) as Placement;\n\n const collisionPadding =\n typeof collisionPaddingProp === 'number'\n ? collisionPaddingProp\n : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };\n\n const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];\n const hasExplicitBoundaries = boundary.length > 0;\n\n const detectOverflowOptions = {\n padding: collisionPadding,\n boundary: boundary.filter(isNotNull),\n // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries\n altBoundary: hasExplicitBoundaries,\n };\n\n const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({\n // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues\n strategy: 'fixed',\n placement: desiredPlacement,\n whileElementsMounted: (...args) => {\n const cleanup = autoUpdate(...args, {\n animationFrame: updatePositionStrategy === UpdatePositionStrategy.Always,\n });\n return cleanup;\n },\n elements: {\n reference: context.anchor,\n },\n middleware: [\n offset({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),\n avoidCollisions &&\n shift({\n mainAxis: true,\n crossAxis: false,\n // Spread rather than passing `limiter: undefined`, which\n // `exactOptionalPropertyTypes` rejects for Floating UI's optional option.\n ...(sticky === Sticky.Partial ? { limiter: limitShift() } : {}),\n ...detectOverflowOptions,\n }),\n avoidCollisions && flip({ ...detectOverflowOptions }),\n size({\n ...detectOverflowOptions,\n apply: ({ elements, rects, availableWidth, availableHeight }) => {\n const { width: anchorWidth, height: anchorHeight } = rects.reference;\n const contentStyle = elements.floating.style;\n contentStyle.setProperty('--radix-popper-available-width', `${availableWidth}px`);\n contentStyle.setProperty('--radix-popper-available-height', `${availableHeight}px`);\n contentStyle.setProperty('--radix-popper-anchor-width', `${anchorWidth}px`);\n contentStyle.setProperty('--radix-popper-anchor-height', `${anchorHeight}px`);\n },\n }),\n arrow && floatingUIarrow({ element: arrow, padding: arrowPadding }),\n transformOrigin({ arrowWidth, arrowHeight }),\n hideWhenDetached &&\n // `hide` detects whether the anchor (reference) is clipped, so when\n // no explicit `collisionBoundary` is set we omit `boundary` entirely\n // and fall back to Floating UI's default clipping ancestors (e.g. a\n // scrollable menu). This lets an occluded submenu hide once its anchor\n // scrolls out of view (#3237). The collision/size middlewares\n // deliberately keep the viewport-based default to avoid clamping\n // content rendered inside transformed or overflow-clipping portal\n // containers. The key is omitted rather than set to `undefined`\n // because `exactOptionalPropertyTypes` rejects the explicit value.\n hide(\n hasExplicitBoundaries\n ? { strategy: 'referenceHidden', ...detectOverflowOptions }\n : {\n strategy: 'referenceHidden',\n padding: detectOverflowOptions.padding,\n altBoundary: detectOverflowOptions.altBoundary,\n },\n ),\n ],\n });\n\n const setPlacementState = context.setPlacementState;\n useLayoutEffect(() => {\n setPlacementState(placement);\n return () => {\n setPlacementState(undefined);\n };\n }, [placement, setPlacementState]);\n\n const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);\n\n const handlePlaced = useCallbackRef(onPlaced);\n useLayoutEffect(() => {\n if (isPositioned) {\n handlePlaced?.();\n }\n }, [isPositioned, handlePlaced]);\n\n const arrowX = middlewareData.arrow?.x;\n const arrowY = middlewareData.arrow?.y;\n const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;\n\n const [contentZIndex, setContentZIndex] = React.useState();\n useLayoutEffect(() => {\n if (content) setContentZIndex(window.getComputedStyle(content).zIndex);\n }, [content]);\n\n return (\n

= P & { + __scopeRadioGroup?: Scope | undefined; +}; +declare const createRadioGroupScope: _radix_ui_react_context.CreateScope; +type RadioGroupContextValue = { + name?: string | undefined; + form?: string | undefined; + required: boolean; + disabled: boolean; + value: string | null; + onValueChange(value: string): void; +}; +type RovingFocusGroupProps = React.ComponentPropsWithoutRef; +type PrimitiveDivProps = React.ComponentPropsWithoutRef; +interface RadioGroupProps extends PrimitiveDivProps { + name?: RadioGroupContextValue['name'] | undefined; + form?: React.ComponentPropsWithoutRef['form'] | undefined; + required?: React.ComponentPropsWithoutRef['required'] | undefined; + disabled?: React.ComponentPropsWithoutRef['disabled'] | undefined; + dir?: RovingFocusGroupProps['dir'] | undefined; + orientation?: RovingFocusGroupProps['orientation'] | undefined; + loop?: RovingFocusGroupProps['loop'] | undefined; + defaultValue?: string | undefined; + value?: string | null | undefined; + onValueChange?: RadioGroupContextValue['onValueChange'] | undefined; +} +declare const RadioGroup: React.ForwardRefExoticComponent>; +interface RadioGroupItemProviderProps { + value: string; + disabled?: boolean | undefined; + children?: React.ReactNode | undefined; +} +declare function RadioGroupItemProvider(props: ScopedProps): React.JSX.Element; +interface RadioGroupItemTriggerProps extends React.ComponentPropsWithoutRef { +} +declare const RadioGroupItemTrigger: React.ForwardRefExoticComponent>; +type RadioProps = React.ComponentPropsWithoutRef; +interface RadioGroupItemProps extends Omit { + value: string; +} +declare const RadioGroupItem: React.ForwardRefExoticComponent>; +interface RadioGroupItemBubbleInputProps extends React.ComponentPropsWithoutRef { +} +declare const RadioGroupItemBubbleInput: React.ForwardRefExoticComponent>; +type RadioIndicatorProps = React.ComponentPropsWithoutRef; +interface RadioGroupIndicatorProps extends RadioIndicatorProps { +} +declare const RadioGroupIndicator: React.ForwardRefExoticComponent>; + +export { RadioGroupIndicator as Indicator, RadioGroupItem as Item, RadioGroup, RadioGroupIndicator, type RadioGroupIndicatorProps, RadioGroupItem, type RadioGroupItemProps, type RadioGroupProps, RadioGroup as Root, createRadioGroupScope, RadioGroupItemBubbleInput as unstable_ItemBubbleInput, RadioGroupItemProvider as unstable_ItemProvider, RadioGroupItemTrigger as unstable_ItemTrigger, RadioGroupItemBubbleInput as unstable_RadioGroupItemBubbleInput, type RadioGroupItemBubbleInputProps as unstable_RadioGroupItemBubbleInputProps, RadioGroupItemProvider as unstable_RadioGroupItemProvider, type RadioGroupItemProviderProps as unstable_RadioGroupItemProviderProps, RadioGroupItemTrigger as unstable_RadioGroupItemTrigger, type RadioGroupItemTriggerProps as unstable_RadioGroupItemTriggerProps }; diff --git a/e-commerce/node_modules/@radix-ui/react-radio-group/dist/index.d.ts b/e-commerce/node_modules/@radix-ui/react-radio-group/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c3547ff3cb58a0193873f1e3973c3ac568718bc5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-radio-group/dist/index.d.ts @@ -0,0 +1,91 @@ +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'; +import * as RovingFocusGroup from '@radix-ui/react-roving-focus'; + +interface RadioProviderProps { + checked?: boolean | undefined; + required?: boolean | undefined; + disabled?: boolean | undefined; + name?: string | undefined; + form?: string | undefined; + value?: string | number | readonly string[] | undefined; + onCheck?: (() => void) | undefined; + children?: React.ReactNode | undefined; +} +interface RadioTriggerProps extends Omit, keyof RadioProviderProps> { + children?: React.ReactNode | undefined; +} +declare const RadioTrigger: React.ForwardRefExoticComponent>; +type PrimitiveButtonProps = React.ComponentPropsWithoutRef; +interface RadioProps$1 extends Omit { + checked?: boolean | undefined; + required?: boolean | undefined; + onCheck?: (() => void) | undefined; +} +declare const Radio: React.ForwardRefExoticComponent>; +type PrimitiveSpanProps = React.ComponentPropsWithoutRef; +interface RadioIndicatorProps$1 extends PrimitiveSpanProps { + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const RadioIndicator: React.ForwardRefExoticComponent>; +type InputProps = React.ComponentPropsWithoutRef; +interface RadioBubbleInputProps extends Omit { +} +declare const RadioBubbleInput: React.ForwardRefExoticComponent>; + +type ScopedProps

= P & { + __scopeRadioGroup?: Scope | undefined; +}; +declare const createRadioGroupScope: _radix_ui_react_context.CreateScope; +type RadioGroupContextValue = { + name?: string | undefined; + form?: string | undefined; + required: boolean; + disabled: boolean; + value: string | null; + onValueChange(value: string): void; +}; +type RovingFocusGroupProps = React.ComponentPropsWithoutRef; +type PrimitiveDivProps = React.ComponentPropsWithoutRef; +interface RadioGroupProps extends PrimitiveDivProps { + name?: RadioGroupContextValue['name'] | undefined; + form?: React.ComponentPropsWithoutRef['form'] | undefined; + required?: React.ComponentPropsWithoutRef['required'] | undefined; + disabled?: React.ComponentPropsWithoutRef['disabled'] | undefined; + dir?: RovingFocusGroupProps['dir'] | undefined; + orientation?: RovingFocusGroupProps['orientation'] | undefined; + loop?: RovingFocusGroupProps['loop'] | undefined; + defaultValue?: string | undefined; + value?: string | null | undefined; + onValueChange?: RadioGroupContextValue['onValueChange'] | undefined; +} +declare const RadioGroup: React.ForwardRefExoticComponent>; +interface RadioGroupItemProviderProps { + value: string; + disabled?: boolean | undefined; + children?: React.ReactNode | undefined; +} +declare function RadioGroupItemProvider(props: ScopedProps): React.JSX.Element; +interface RadioGroupItemTriggerProps extends React.ComponentPropsWithoutRef { +} +declare const RadioGroupItemTrigger: React.ForwardRefExoticComponent>; +type RadioProps = React.ComponentPropsWithoutRef; +interface RadioGroupItemProps extends Omit { + value: string; +} +declare const RadioGroupItem: React.ForwardRefExoticComponent>; +interface RadioGroupItemBubbleInputProps extends React.ComponentPropsWithoutRef { +} +declare const RadioGroupItemBubbleInput: React.ForwardRefExoticComponent>; +type RadioIndicatorProps = React.ComponentPropsWithoutRef; +interface RadioGroupIndicatorProps extends RadioIndicatorProps { +} +declare const RadioGroupIndicator: React.ForwardRefExoticComponent>; + +export { RadioGroupIndicator as Indicator, RadioGroupItem as Item, RadioGroup, RadioGroupIndicator, type RadioGroupIndicatorProps, RadioGroupItem, type RadioGroupItemProps, type RadioGroupProps, RadioGroup as Root, createRadioGroupScope, RadioGroupItemBubbleInput as unstable_ItemBubbleInput, RadioGroupItemProvider as unstable_ItemProvider, RadioGroupItemTrigger as unstable_ItemTrigger, RadioGroupItemBubbleInput as unstable_RadioGroupItemBubbleInput, type RadioGroupItemBubbleInputProps as unstable_RadioGroupItemBubbleInputProps, RadioGroupItemProvider as unstable_RadioGroupItemProvider, type RadioGroupItemProviderProps as unstable_RadioGroupItemProviderProps, RadioGroupItemTrigger as unstable_RadioGroupItemTrigger, type RadioGroupItemTriggerProps as unstable_RadioGroupItemTriggerProps }; diff --git a/e-commerce/node_modules/@radix-ui/react-radio-group/dist/index.js b/e-commerce/node_modules/@radix-ui/react-radio-group/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..b7fff9ed8a1f370f8d66d0f3ba6f6cb04adacc4b --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-radio-group/dist/index.js @@ -0,0 +1,477 @@ +"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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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, { + Indicator: () => RadioGroupIndicator, + Item: () => RadioGroupItem, + RadioGroup: () => RadioGroup, + RadioGroupIndicator: () => RadioGroupIndicator, + RadioGroupItem: () => RadioGroupItem, + Root: () => RadioGroup, + createRadioGroupScope: () => createRadioGroupScope, + unstable_ItemBubbleInput: () => RadioGroupItemBubbleInput, + unstable_ItemProvider: () => RadioGroupItemProvider, + unstable_ItemTrigger: () => RadioGroupItemTrigger, + unstable_RadioGroupItemBubbleInput: () => RadioGroupItemBubbleInput, + unstable_RadioGroupItemProvider: () => RadioGroupItemProvider, + unstable_RadioGroupItemTrigger: () => RadioGroupItemTrigger +}); +module.exports = __toCommonJS(index_exports); + +// src/radio-group.tsx +var React2 = __toESM(require("react")); +var import_primitive2 = require("@radix-ui/primitive"); +var import_react_compose_refs2 = require("@radix-ui/react-compose-refs"); +var import_react_context2 = require("@radix-ui/react-context"); +var import_react_primitive2 = require("@radix-ui/react-primitive"); +var RovingFocusGroup = __toESM(require("@radix-ui/react-roving-focus")); +var import_react_roving_focus = require("@radix-ui/react-roving-focus"); +var import_react_use_controllable_state = require("@radix-ui/react-use-controllable-state"); +var import_react_direction = require("@radix-ui/react-direction"); + +// src/radio.tsx +var React = __toESM(require("react")); +var import_primitive = require("@radix-ui/primitive"); +var import_react_compose_refs = require("@radix-ui/react-compose-refs"); +var import_react_context = require("@radix-ui/react-context"); +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 RADIO_NAME = "Radio"; +var [createRadioContext, createRadioScope] = (0, import_react_context.createContextScope)(RADIO_NAME); +var [RadioProviderImpl, useRadioContext] = createRadioContext(RADIO_NAME); +function RadioProvider(props) { + const { + __scopeRadio, + checked = false, + children, + disabled, + form, + name, + onCheck, + required, + value = "on", + // @ts-expect-error + internal_do_not_use_render + } = props; + const [control, setControl] = React.useState(null); + const [bubbleInput, setBubbleInput] = React.useState(null); + const [userClick, setUserClick] = React.useState(null); + 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, + required, + name, + form, + value, + control, + setControl, + userClick, + onUserClick: setUserClick, + isFormControl, + bubbleInput, + setBubbleInput, + onCheck: /* @__PURE__ */ __name(() => onCheck?.(), "onCheck") + }; + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioProviderImpl, { scope: __scopeRadio, ...context, children: isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children }); +} +__name(RadioProvider, "RadioProvider"); +var TRIGGER_NAME = "RadioTrigger"; +var RadioTrigger = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function RadioTrigger2({ __scopeRadio, onClick, ...radioProps }, forwardedRef) { + const { + checked, + disabled, + value, + setControl, + onCheck, + onUserClick, + isFormControl, + bubbleInput + } = useRadioContext(TRIGGER_NAME, __scopeRadio); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, setControl); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.button, + { + type: "button", + role: "radio", + "aria-checked": checked, + "data-state": getState(checked), + "data-disabled": disabled ? "" : void 0, + disabled, + value, + ...radioProps, + ref: composedRefs, + onClick: (0, import_primitive.composeEventHandlers)(onClick, (event) => { + const hasConsumerStoppedPropagation = event.isPropagationStopped(); + if (!checked) { + onUserClick({ hasConsumerStoppedPropagation }); + onCheck(); + } + if (bubbleInput && isFormControl) { + if (!hasConsumerStoppedPropagation) { + event.stopPropagation(); + } + } + }) + } + ); + }, "RadioTrigger") +); +var INDICATOR_NAME = "RadioIndicator"; +var RadioIndicator = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function RadioIndicator2(props, forwardedRef) { + const { __scopeRadio, forceMount, ...indicatorProps } = props; + const context = useRadioContext(INDICATOR_NAME, __scopeRadio); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || context.checked, 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 + } + ) }); + }, "RadioIndicator") +); +var BUBBLE_INPUT_NAME = "RadioBubbleInput"; +var RadioBubbleInput = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function RadioBubbleInput2({ __scopeRadio, onClick, ...props }, forwardedRef) { + const { + control, + checked, + required, + disabled, + name, + value, + form, + bubbleInput, + setBubbleInput, + userClick + } = useRadioContext(BUBBLE_INPUT_NAME, __scopeRadio); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, setBubbleInput); + const controlSize = (0, import_react_use_size.useSize)(control); + const shouldStopClickPropagationRef = React.useRef(false); + const prevCheckedRef = React.useRef(checked); + const handledUserClickRef = React.useRef(userClick); + const pendingUserClickRef = React.useRef(null); + React.useEffect(() => { + const input = bubbleInput; + if (!input) return; + const inputProto = window.HTMLInputElement.prototype; + const descriptor = Object.getOwnPropertyDescriptor( + inputProto, + "checked" + ); + const setChecked = descriptor.set; + if (!setChecked) return; + const checkedChanged = prevCheckedRef.current !== checked; + prevCheckedRef.current = checked; + const isNewUserClick = userClick !== null && userClick !== handledUserClickRef.current; + handledUserClickRef.current = userClick; + if (isNewUserClick) { + pendingUserClickRef.current = checkedChanged ? null : userClick; + if (checkedChanged) { + setChecked.call(input, checked); + } + input.dispatchEvent( + new Event("click", { bubbles: !userClick.hasConsumerStoppedPropagation }) + ); + } else if (checkedChanged) { + const pendingUserClick = pendingUserClickRef.current; + pendingUserClickRef.current = null; + const isPendingUserChange = checked && pendingUserClick !== null; + shouldStopClickPropagationRef.current = true; + setChecked.call(input, checked); + input.dispatchEvent( + new Event("click", { + bubbles: !(isPendingUserChange && pendingUserClick.hasConsumerStoppedPropagation) + }) + ); + shouldStopClickPropagationRef.current = false; + } + }, [bubbleInput, checked, userClick]); + const defaultCheckedRef = React.useRef(checked); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.input, + { + type: "radio", + "aria-hidden": true, + defaultChecked: defaultCheckedRef.current, + required, + disabled, + name, + value, + form, + ...props, + tabIndex: -1, + ref: composedRefs, + onClick: (0, import_primitive.composeEventHandlers)(onClick, (event) => { + if (shouldStopClickPropagationRef.current) { + event.stopPropagation(); + } + }), + 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%)" + } + } + ); + }, "RadioBubbleInput") +); +function isFunction(value) { + return typeof value === "function"; +} +__name(isFunction, "isFunction"); +function getState(checked) { + return checked ? "checked" : "unchecked"; +} +__name(getState, "getState"); + +// src/radio-group.tsx +var import_jsx_runtime2 = require("react/jsx-runtime"); +var ARROW_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]; +var RADIO_GROUP_NAME = "RadioGroup"; +var [createRadioGroupContext, createRadioGroupScope] = (0, import_react_context2.createContextScope)(RADIO_GROUP_NAME, [ + import_react_roving_focus.createRovingFocusGroupScope, + createRadioScope +]); +var useRovingFocusGroupScope = (0, import_react_roving_focus.createRovingFocusGroupScope)(); +var useRadioScope = createRadioScope(); +var [RadioGroupProvider, useRadioGroupContext] = createRadioGroupContext(RADIO_GROUP_NAME); +var RadioGroup = /* @__PURE__ */ React2.forwardRef( + /* @__PURE__ */ __name(function RadioGroup2(props, forwardedRef) { + const { + __scopeRadioGroup, + name, + form, + defaultValue, + value: valueProp, + required = false, + disabled = false, + orientation, + dir, + loop = true, + onValueChange, + ...groupProps + } = props; + const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup); + const direction = (0, import_react_direction.useDirection)(dir); + const [value, setValue] = (0, import_react_use_controllable_state.useControllableState)({ + prop: valueProp, + defaultProp: defaultValue ?? null, + onChange: onValueChange, + caller: RADIO_GROUP_NAME + }); + const [control, setControl] = React2.useState(null); + const composedRefs = (0, import_react_compose_refs2.useComposedRefs)(forwardedRef, setControl); + const initialValueRef = React2.useRef(value); + React2.useEffect(() => { + const associatedForm = form ? control?.ownerDocument.getElementById(form) : control?.closest("form"); + if (associatedForm instanceof HTMLFormElement) { + const reset = /* @__PURE__ */ __name(() => setValue(initialValueRef.current), "reset"); + associatedForm.addEventListener("reset", reset); + return () => associatedForm.removeEventListener("reset", reset); + } + }, [control, form, setValue]); + return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( + RadioGroupProvider, + { + scope: __scopeRadioGroup, + name, + form, + required, + disabled, + value, + onValueChange: setValue, + children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( + RovingFocusGroup.Root, + { + asChild: true, + ...rovingFocusGroupScope, + orientation, + dir: direction, + loop, + children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( + import_react_primitive2.Primitive.div, + { + role: "radiogroup", + "aria-required": required, + "aria-orientation": orientation, + "data-disabled": disabled ? "" : void 0, + dir: direction, + ...groupProps, + ref: composedRefs + } + ) + } + ) + } + ); + }, "RadioGroup") +); +var ITEM_PROVIDER_NAME = "RadioGroupItemProvider"; +var ITEM_TRIGGER_NAME = "RadioGroupItemTrigger"; +function RadioGroupItemProvider(props) { + const { + __scopeRadioGroup, + value, + disabled, + children, + // @ts-expect-error + internal_do_not_use_render + } = props; + const context = useRadioGroupContext(ITEM_PROVIDER_NAME, __scopeRadioGroup); + const radioScope = useRadioScope(__scopeRadioGroup); + const isDisabled = context.disabled || disabled; + return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( + RadioProvider, + { + ...radioScope, + checked: context.value === value, + disabled: isDisabled, + required: context.required, + name: context.name, + form: context.form, + value, + onCheck: () => context.onValueChange(value), + internal_do_not_use_render, + children + } + ); +} +__name(RadioGroupItemProvider, "RadioGroupItemProvider"); +var RadioGroupItemTrigger = /* @__PURE__ */ React2.forwardRef(/* @__PURE__ */ __name(function RadioGroupItemTrigger2(props, forwardedRef) { + const { __scopeRadioGroup, ...triggerProps } = props; + const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup); + const radioScope = useRadioScope(__scopeRadioGroup); + const { checked, disabled } = useRadioContext(ITEM_TRIGGER_NAME, radioScope.__scopeRadio); + const ref = React2.useRef(null); + const composedRefs = (0, import_react_compose_refs2.useComposedRefs)(forwardedRef, ref); + const isArrowKeyPressedRef = React2.useRef(false); + React2.useEffect(() => { + const handleKeyDown = /* @__PURE__ */ __name((event) => { + if (ARROW_KEYS.includes(event.key)) { + isArrowKeyPressedRef.current = true; + } + }, "handleKeyDown"); + const handleKeyUp = /* @__PURE__ */ __name(() => isArrowKeyPressedRef.current = false, "handleKeyUp"); + document.addEventListener("keydown", handleKeyDown); + document.addEventListener("keyup", handleKeyUp); + return () => { + document.removeEventListener("keydown", handleKeyDown); + document.removeEventListener("keyup", handleKeyUp); + }; + }, []); + return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( + RovingFocusGroup.Item, + { + asChild: true, + ...rovingFocusGroupScope, + focusable: !disabled, + active: checked, + children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( + RadioTrigger, + { + ...radioScope, + ...triggerProps, + ref: composedRefs, + onKeyDown: (0, import_primitive2.composeEventHandlers)(triggerProps.onKeyDown, (event) => { + if (event.key === "Enter") event.preventDefault(); + }), + onFocus: (0, import_primitive2.composeEventHandlers)(triggerProps.onFocus, () => { + if (isArrowKeyPressedRef.current) { + ref.current?.click(); + } + }) + } + ) + } + ); +}, "RadioGroupItemTrigger")); +var RadioGroupItem = /* @__PURE__ */ React2.forwardRef( + /* @__PURE__ */ __name(function RadioGroupItem2(props, forwardedRef) { + const { __scopeRadioGroup, value, disabled, ...itemProps } = props; + return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( + RadioGroupItemProvider, + { + __scopeRadioGroup, + value, + disabled, + internal_do_not_use_render: ({ isFormControl }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [ + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( + RadioGroupItemTrigger, + { + ...itemProps, + ref: forwardedRef, + __scopeRadioGroup + } + ), + isFormControl && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( + RadioGroupItemBubbleInput, + { + __scopeRadioGroup + } + ) + ] }) + } + ); + }, "RadioGroupItem") +); +var RadioGroupItemBubbleInput = /* @__PURE__ */ React2.forwardRef(/* @__PURE__ */ __name(function RadioGroupItemBubbleInput2(props, forwardedRef) { + const { __scopeRadioGroup, ...bubbleProps } = props; + const radioScope = useRadioScope(__scopeRadioGroup); + return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RadioBubbleInput, { ...radioScope, ...bubbleProps, ref: forwardedRef }); +}, "RadioGroupItemBubbleInput")); +var RadioGroupIndicator = /* @__PURE__ */ React2.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function RadioGroupIndicator2(props, forwardedRef) { + const { __scopeRadioGroup, ...indicatorProps } = props; + const radioScope = useRadioScope(__scopeRadioGroup); + return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RadioIndicator, { ...radioScope, ...indicatorProps, ref: forwardedRef }); + }, "RadioGroupIndicator") +); +//# sourceMappingURL=index.js.map diff --git a/e-commerce/node_modules/@radix-ui/react-radio-group/dist/index.js.map b/e-commerce/node_modules/@radix-ui/react-radio-group/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..94f7bb471325a29ebbeb69a078e095ef21c19457 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-radio-group/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts", "../src/radio-group.tsx", "../src/radio.tsx"], + "sourcesContent": ["'use client';\nexport {\n createRadioGroupScope,\n //\n RadioGroup,\n RadioGroupItem,\n RadioGroupItemProvider as unstable_RadioGroupItemProvider,\n RadioGroupItemTrigger as unstable_RadioGroupItemTrigger,\n RadioGroupItemBubbleInput as unstable_RadioGroupItemBubbleInput,\n RadioGroupIndicator,\n //\n Root,\n Item,\n ItemProvider as unstable_ItemProvider,\n ItemTrigger as unstable_ItemTrigger,\n ItemBubbleInput as unstable_ItemBubbleInput,\n Indicator,\n} from './radio-group';\nexport type {\n RadioGroupProps,\n RadioGroupItemProps,\n RadioGroupItemProviderProps as unstable_RadioGroupItemProviderProps,\n RadioGroupItemTriggerProps as unstable_RadioGroupItemTriggerProps,\n RadioGroupItemBubbleInputProps as unstable_RadioGroupItemBubbleInputProps,\n RadioGroupIndicatorProps,\n} from './radio-group';\n", "import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as RovingFocusGroup from '@radix-ui/react-roving-focus';\nimport { createRovingFocusGroupScope } from '@radix-ui/react-roving-focus';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useDirection } from '@radix-ui/react-direction';\nimport {\n type Radio,\n RadioProvider,\n RadioTrigger,\n RadioBubbleInput,\n RadioIndicator,\n createRadioScope,\n useRadioContext,\n} from './radio';\n\nimport type { Scope } from '@radix-ui/react-context';\n\nconst ARROW_KEYS = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];\n\n/* -------------------------------------------------------------------------------------------------\n * RadioGroup\n * -----------------------------------------------------------------------------------------------*/\nconst RADIO_GROUP_NAME = 'RadioGroup';\n\ntype ScopedProps

= P & { __scopeRadioGroup?: Scope | undefined };\nconst [createRadioGroupContext, createRadioGroupScope] = createContextScope(RADIO_GROUP_NAME, [\n createRovingFocusGroupScope,\n createRadioScope,\n]);\nconst useRovingFocusGroupScope = createRovingFocusGroupScope();\nconst useRadioScope = createRadioScope();\n\ntype RadioGroupContextValue = {\n name?: string | undefined;\n form?: string | undefined;\n required: boolean;\n disabled: boolean;\n value: string | null;\n onValueChange(value: string): void;\n};\n\nconst [RadioGroupProvider, useRadioGroupContext] =\n createRadioGroupContext(RADIO_GROUP_NAME);\n\ntype RadioGroupElement = React.ComponentRef;\ntype RovingFocusGroupProps = React.ComponentPropsWithoutRef;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef;\ninterface RadioGroupProps extends PrimitiveDivProps {\n name?: RadioGroupContextValue['name'] | undefined;\n form?: React.ComponentPropsWithoutRef['form'] | undefined;\n required?: React.ComponentPropsWithoutRef['required'] | undefined;\n disabled?: React.ComponentPropsWithoutRef['disabled'] | undefined;\n dir?: RovingFocusGroupProps['dir'] | undefined;\n orientation?: RovingFocusGroupProps['orientation'] | undefined;\n loop?: RovingFocusGroupProps['loop'] | undefined;\n defaultValue?: string | undefined;\n value?: string | null | undefined;\n onValueChange?: RadioGroupContextValue['onValueChange'] | undefined;\n}\n\nconst RadioGroup = /* @__PURE__ */ React.forwardRef(\n function RadioGroup(props: ScopedProps, forwardedRef) {\n const {\n __scopeRadioGroup,\n name,\n form,\n defaultValue,\n value: valueProp,\n required = false,\n disabled = false,\n orientation,\n dir,\n loop = true,\n onValueChange,\n ...groupProps\n } = props;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);\n const direction = useDirection(dir);\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue ?? null,\n onChange: onValueChange as (value: string | null) => void,\n caller: RADIO_GROUP_NAME,\n });\n const [control, setControl] = React.useState(null);\n const composedRefs = useComposedRefs(forwardedRef, setControl);\n\n const initialValueRef = React.useRef(value);\n React.useEffect(() => {\n const associatedForm = form\n ? control?.ownerDocument.getElementById(form)\n : control?.closest('form');\n if (associatedForm instanceof HTMLFormElement) {\n const reset = () => setValue(initialValueRef.current);\n associatedForm.addEventListener('reset', reset);\n return () => associatedForm.removeEventListener('reset', reset);\n }\n }, [control, form, setValue]);\n\n return (\n \n \n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * RadioGroupItemProvider\n * -----------------------------------------------------------------------------------------------*/\nconst ITEM_PROVIDER_NAME = 'RadioGroupItemProvider';\nconst ITEM_TRIGGER_NAME = 'RadioGroupItemTrigger';\n\ninterface RadioGroupItemProviderProps {\n value: string;\n disabled?: boolean | undefined;\n children?: React.ReactNode | undefined;\n}\n\nfunction RadioGroupItemProvider(props: ScopedProps) {\n const {\n __scopeRadioGroup,\n value,\n disabled,\n children,\n // @ts-expect-error\n internal_do_not_use_render,\n } = props;\n const context = useRadioGroupContext(ITEM_PROVIDER_NAME, __scopeRadioGroup);\n const radioScope = useRadioScope(__scopeRadioGroup);\n const isDisabled = context.disabled || disabled;\n\n return (\n context.onValueChange(value)}\n // @ts-expect-error\n internal_do_not_use_render={internal_do_not_use_render}\n >\n {children}\n \n );\n}\n\n/* -------------------------------------------------------------------------------------------------\n * RadioGroupItemTrigger\n * -----------------------------------------------------------------------------------------------*/\n\ntype RadioGroupItemTriggerElement = React.ComponentRef;\ninterface RadioGroupItemTriggerProps extends React.ComponentPropsWithoutRef {}\n\nconst RadioGroupItemTrigger = /* @__PURE__ */ React.forwardRef<\n RadioGroupItemTriggerElement,\n RadioGroupItemTriggerProps\n>(function RadioGroupItemTrigger(props: ScopedProps, forwardedRef) {\n const { __scopeRadioGroup, ...triggerProps } = props;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);\n const radioScope = useRadioScope(__scopeRadioGroup);\n const { checked, disabled } = useRadioContext(ITEM_TRIGGER_NAME, radioScope.__scopeRadio);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const isArrowKeyPressedRef = React.useRef(false);\n\n React.useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (ARROW_KEYS.includes(event.key)) {\n isArrowKeyPressedRef.current = true;\n }\n };\n const handleKeyUp = () => (isArrowKeyPressedRef.current = false);\n document.addEventListener('keydown', handleKeyDown);\n document.addEventListener('keyup', handleKeyUp);\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n document.removeEventListener('keyup', handleKeyUp);\n };\n }, []);\n\n return (\n \n {\n // According to WAI ARIA, radio groups don't activate items on enter\n // keypress\n if (event.key === 'Enter') event.preventDefault();\n })}\n onFocus={composeEventHandlers(triggerProps.onFocus, () => {\n /**\n * Our `RovingFocusGroup` will focus the radio when navigating with\n * arrow keys and we need to \"check\" it in that case. We click it to\n * \"check\" it (instead of updating `context.value`) so that the radio\n * change event fires.\n */\n if (isArrowKeyPressedRef.current) {\n ref.current?.click();\n }\n })}\n />\n \n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * RadioGroupItem\n * -----------------------------------------------------------------------------------------------*/\n\ntype RadioGroupItemElement = React.ComponentRef;\ntype RadioProps = React.ComponentPropsWithoutRef;\ninterface RadioGroupItemProps extends Omit {\n value: string;\n}\n\nconst RadioGroupItem = /* @__PURE__ */ React.forwardRef(\n function RadioGroupItem(props: ScopedProps, forwardedRef) {\n const { __scopeRadioGroup, value, disabled, ...itemProps } = props;\n\n return (\n (\n <>\n \n {isFormControl && (\n \n )}\n \n )}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * RadioGroupItemBubbleInput\n * -----------------------------------------------------------------------------------------------*/\n\ntype RadioGroupItemBubbleInputElement = React.ComponentRef;\ninterface RadioGroupItemBubbleInputProps extends React.ComponentPropsWithoutRef<\n typeof RadioBubbleInput\n> {}\n\nconst RadioGroupItemBubbleInput = /* @__PURE__ */ React.forwardRef<\n RadioGroupItemBubbleInputElement,\n RadioGroupItemBubbleInputProps\n>(function RadioGroupItemBubbleInput(\n props: ScopedProps,\n forwardedRef,\n) {\n const { __scopeRadioGroup, ...bubbleProps } = props;\n const radioScope = useRadioScope(__scopeRadioGroup);\n return ;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * RadioGroupIndicator\n * -----------------------------------------------------------------------------------------------*/\n\ntype RadioGroupIndicatorElement = React.ComponentRef;\ntype RadioIndicatorProps = React.ComponentPropsWithoutRef;\ninterface RadioGroupIndicatorProps extends RadioIndicatorProps {}\n\nconst RadioGroupIndicator = /* @__PURE__ */ React.forwardRef<\n RadioGroupIndicatorElement,\n RadioGroupIndicatorProps\n>(\n // blank line to reduce diff noise\n function RadioGroupIndicator(props: ScopedProps, forwardedRef) {\n const { __scopeRadioGroup, ...indicatorProps } = props;\n const radioScope = useRadioScope(__scopeRadioGroup);\n return ;\n },\n);\n\n/* ---------------------------------------------------------------------------------------------- */\n\nexport {\n createRadioGroupScope,\n //\n RadioGroup,\n RadioGroupItem,\n RadioGroupItemProvider,\n RadioGroupItemTrigger,\n RadioGroupItemBubbleInput,\n RadioGroupIndicator,\n //\n RadioGroup as Root,\n RadioGroupItem as Item,\n RadioGroupItemProvider as ItemProvider,\n RadioGroupItemTrigger as ItemTrigger,\n RadioGroupItemBubbleInput as ItemBubbleInput,\n RadioGroupIndicator as Indicator,\n};\nexport type {\n RadioGroupProps,\n RadioGroupItemProps,\n RadioGroupItemProviderProps,\n RadioGroupItemTriggerProps,\n RadioGroupItemBubbleInputProps,\n RadioGroupIndicatorProps,\n};\n", "import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useSize } from '@radix-ui/react-use-size';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\n\nimport type { Scope } from '@radix-ui/react-context';\n\nconst RADIO_NAME = 'Radio';\n\ntype ScopedProps

= P & { __scopeRadio?: Scope | undefined };\nconst [createRadioContext, createRadioScope] = createContextScope(RADIO_NAME);\n\ntype RadioUserClick = {\n hasConsumerStoppedPropagation: boolean;\n};\n\ntype RadioContextValue = {\n checked: boolean;\n disabled: boolean | undefined;\n required: boolean | undefined;\n name: string | undefined;\n form: string | undefined;\n value: string | number | readonly string[];\n control: HTMLButtonElement | null;\n setControl: React.Dispatch>;\n userClick: RadioUserClick | null;\n onUserClick: (userClick: RadioUserClick) => void;\n isFormControl: boolean;\n bubbleInput: HTMLInputElement | null;\n setBubbleInput: React.Dispatch>;\n onCheck(): void;\n};\n\nconst [RadioProviderImpl, useRadioContext] = createRadioContext(RADIO_NAME);\n\n/* -------------------------------------------------------------------------------------------------\n * RadioProvider\n * -----------------------------------------------------------------------------------------------*/\n\ninterface RadioProviderProps {\n checked?: boolean | undefined;\n required?: boolean | undefined;\n disabled?: boolean | undefined;\n name?: string | undefined;\n form?: string | undefined;\n value?: string | number | readonly string[] | undefined;\n onCheck?: (() => void) | undefined;\n children?: React.ReactNode | undefined;\n}\n\nfunction RadioProvider(props: ScopedProps) {\n const {\n __scopeRadio,\n checked = false,\n children,\n disabled,\n form,\n name,\n onCheck,\n required,\n value = 'on',\n // @ts-expect-error\n internal_do_not_use_render,\n } = props;\n\n const [control, setControl] = React.useState(null);\n const [bubbleInput, setBubbleInput] = React.useState(null);\n // The latest user click on the trigger that checks the radio. The bubble\n // input dispatches the click to the form once React has handled it, whether\n // or not `checked` changes in the same render.\n const [userClick, setUserClick] = React.useState(null);\n\n const isFormControl = control\n ? !!form || !!control.closest('form')\n : // We set this to true by default so that events bubble to forms without JS (SSR)\n true;\n\n const context: RadioContextValue = {\n checked,\n disabled,\n required,\n name,\n form,\n value,\n control,\n setControl,\n userClick,\n onUserClick: setUserClick,\n isFormControl,\n bubbleInput,\n setBubbleInput,\n onCheck: () => onCheck?.(),\n };\n\n return (\n \n {isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children}\n \n );\n}\n\n/* -------------------------------------------------------------------------------------------------\n * RadioTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'RadioTrigger';\n\ninterface RadioTriggerProps extends Omit<\n React.ComponentPropsWithoutRef,\n keyof RadioProviderProps\n> {\n children?: React.ReactNode | undefined;\n}\n\nconst RadioTrigger = /* @__PURE__ */ React.forwardRef(\n function RadioTrigger(\n { __scopeRadio, onClick, ...radioProps }: ScopedProps,\n forwardedRef,\n ) {\n const {\n checked,\n disabled,\n value,\n setControl,\n onCheck,\n onUserClick,\n isFormControl,\n bubbleInput,\n } = useRadioContext(TRIGGER_NAME, __scopeRadio);\n const composedRefs = useComposedRefs(forwardedRef, setControl);\n\n return (\n {\n const hasConsumerStoppedPropagation = event.isPropagationStopped();\n // radios cannot be unchecked so we only communicate a checked state.\n if (!checked) {\n onUserClick({ hasConsumerStoppedPropagation });\n onCheck();\n }\n\n if (bubbleInput && isFormControl) {\n // if radio has a bubble input and is a form control, stop\n // propagation from the button so that we only propagate one click\n // event (from the input). We propagate changes from an input so\n // that native form validation works and form events reflect radio\n // updates.\n if (!hasConsumerStoppedPropagation) {\n event.stopPropagation();\n }\n }\n })}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * Radio\n * -----------------------------------------------------------------------------------------------*/\n\ntype RadioElement = React.ComponentRef;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef;\ninterface RadioProps extends Omit {\n checked?: boolean | undefined;\n required?: boolean | undefined;\n onCheck?: (() => void) | undefined;\n}\n\nconst Radio = /* @__PURE__ */ React.forwardRef(\n // blank line to reduce diff noise\n function Radio(props: ScopedProps, forwardedRef) {\n const { __scopeRadio, name, checked, required, disabled, value, onCheck, form, ...radioProps } =\n props;\n\n return (\n (\n <>\n \n {isFormControl && (\n \n )}\n \n )}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * RadioIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'RadioIndicator';\n\ntype RadioIndicatorElement = React.ComponentRef;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef;\nexport interface RadioIndicatorProps extends PrimitiveSpanProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst RadioIndicator = /* @__PURE__ */ React.forwardRef(\n function RadioIndicator(props: ScopedProps, forwardedRef) {\n const { __scopeRadio, forceMount, ...indicatorProps } = props;\n const context = useRadioContext(INDICATOR_NAME, __scopeRadio);\n return (\n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * RadioBubbleInput\n * -----------------------------------------------------------------------------------------------*/\n\nconst BUBBLE_INPUT_NAME = 'RadioBubbleInput';\n\ntype InputProps = React.ComponentPropsWithoutRef;\ninterface RadioBubbleInputProps extends Omit {}\n\nconst RadioBubbleInput = /* @__PURE__ */ React.forwardRef(\n function RadioBubbleInput(\n { __scopeRadio, onClick, ...props }: ScopedProps,\n forwardedRef,\n ) {\n const {\n control,\n checked,\n required,\n disabled,\n name,\n value,\n form,\n bubbleInput,\n setBubbleInput,\n userClick,\n } = useRadioContext(BUBBLE_INPUT_NAME, __scopeRadio);\n\n const composedRefs = useComposedRefs(forwardedRef, setBubbleInput);\n const controlSize = useSize(control);\n // When the checked change is not driven by a user interaction (e.g. a\n // controlled `checked` update), the `click` event we dispatch to notify\n // forms must not reach ancestor `onClick` handlers. We can't simply make it\n // non-bubbling because React derives the radio's `change` event from a\n // bubbling `click`. Instead we stop propagation of the synthetic click,\n // which still lets the `change` event reach the form.\n const shouldStopClickPropagationRef = React.useRef(false);\n const prevCheckedRef = React.useRef(checked);\n // The user click this input last dispatched, so each click is dispatched\n // once.\n const handledUserClickRef = React.useRef(userClick);\n // A dispatched user click whose check hasn't been applied yet (e.g. a\n // controlled parent applying it later). When it is applied, it must still\n // respect the consumer stopping the click's propagation.\n const pendingUserClickRef = React.useRef(null);\n\n // Bubble checked change to parents (e.g form change event)\n React.useEffect(() => {\n const input = bubbleInput;\n if (!input) return;\n\n const inputProto = window.HTMLInputElement.prototype;\n const descriptor = Object.getOwnPropertyDescriptor(\n inputProto,\n 'checked',\n ) as PropertyDescriptor;\n const setChecked = descriptor.set;\n if (!setChecked) return;\n\n const checkedChanged = prevCheckedRef.current !== checked;\n prevCheckedRef.current = checked;\n const isNewUserClick = userClick !== null && userClick !== handledUserClickRef.current;\n handledUserClickRef.current = userClick;\n\n if (isNewUserClick) {\n // Dispatch the user's click even if the radio isn't checked (yet), so\n // ancestors are notified of every click on the trigger.\n pendingUserClickRef.current = checkedChanged ? null : userClick;\n if (checkedChanged) {\n setChecked.call(input, checked);\n }\n input.dispatchEvent(\n new Event('click', { bubbles: !userClick.hasConsumerStoppedPropagation }),\n );\n } else if (checkedChanged) {\n const pendingUserClick = pendingUserClickRef.current;\n pendingUserClickRef.current = null;\n const isPendingUserChange = checked && pendingUserClick !== null;\n // The user's click already reached ancestors, and programmatic\n // updates never do, so this click only notifies the form.\n shouldStopClickPropagationRef.current = true;\n setChecked.call(input, checked);\n input.dispatchEvent(\n new Event('click', {\n bubbles: !(isPendingUserChange && pendingUserClick.hasConsumerStoppedPropagation),\n }),\n );\n shouldStopClickPropagationRef.current = false;\n }\n }, [bubbleInput, checked, userClick]);\n\n const defaultCheckedRef = React.useRef(checked);\n return (\n {\n // Prevent the synthetic click dispatched on controlled/programmatic\n // updates from triggering ancestor `onClick` handlers, while still\n // allowing the resulting `change` event to reach the form.\n if (shouldStopClickPropagationRef.current) {\n event.stopPropagation();\n }\n })}\n style={{\n ...props.style,\n ...controlSize,\n position: 'absolute',\n pointerEvents: 'none',\n opacity: 0,\n margin: 0,\n // We transform because the input is absolutely positioned but we have\n // rendered it **after** the button. This pulls it back to sit on top\n // of the button.\n transform: 'translateX(-100%)',\n }}\n />\n );\n },\n);\n\n/* ---------------------------------------------------------------------------------------------- */\n\nfunction isFunction(value: unknown): value is (...args: any[]) => any {\n return typeof value === 'function';\n}\n\nfunction getState(checked: boolean) {\n return checked ? 'checked' : 'unchecked';\n}\n\nexport {\n createRadioScope,\n useRadioContext,\n //\n Radio,\n RadioProvider,\n RadioTrigger,\n RadioIndicator,\n RadioBubbleInput,\n};\nexport type { RadioProps, RadioProviderProps, RadioTriggerProps, RadioBubbleInputProps };\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,SAAuB;AACvB,IAAAC,oBAAqC;AACrC,IAAAC,6BAAgC;AAChC,IAAAC,wBAAmC;AACnC,IAAAC,0BAA0B;AAC1B,uBAAkC;AAClC,gCAA4C;AAC5C,0CAAqC;AACrC,6BAA6B;;;ACR7B,YAAuB;AACvB,uBAAqC;AACrC,gCAAgC;AAChC,2BAAmC;AACnC,4BAAwB;AACxB,4BAAyB;AACzB,6BAA0B;AA4FtB;AAxFJ,IAAM,aAAa;AAGnB,IAAM,CAAC,oBAAoB,gBAAgB,QAAI,yCAAmB,UAAU;AAuB5E,IAAM,CAAC,mBAAmB,eAAe,IAAI,mBAAsC,UAAU;AAiB7F,SAAS,cAAc,OAAwC;AAC7D,QAAM;AAAA,IACJ;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA;AAAA,IAER;AAAA,EACF,IAAI;AAEJ,QAAM,CAAC,SAAS,UAAU,IAAU,eAAmC,IAAI;AAC3E,QAAM,CAAC,aAAa,cAAc,IAAU,eAAkC,IAAI;AAIlF,QAAM,CA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yC,cAAc;AAC7E,UAAM,EAAE,mBAAmB,OAAO,UAAU,GAAG,UAAU,IAAI;AAE7D,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QAEA,4BAA4B,CAAC,EAAE,cAAc,MAC3C,8EACE;AAAA;AAAA,YAAC;AAAA;AAAA,cACE,GAAG;AAAA,cACJ,KAAK;AAAA,cAEL;AAAA;AAAA,UACF;AAAA,UACC,iBACC;AAAA,YAAC;AAAA;AAAA,cAEC;AAAA;AAAA,UACF;AAAA,WAEJ;AAAA;AAAA,IAEJ;AAAA,EAEJ,GA3BA;AA4BF;AAWA,IAAM,4BAA4C,gBAAM,kBAGtD,gCAASC,2BACT,OACA,cACA;AACA,QAAM,EAAE,mBAAmB,GAAG,YAAY,IAAI;AAC9C,QAAM,aAAa,cAAc,iBAAiB;AAClD,SAAO,6CAAC,oBAAkB,GAAG,YAAa,GAAG,aAAa,KAAK,cAAc;AAC/E,GAPE,4BAOD;AAUD,IAAM,sBAAsC,gBAAM;AAAA;AAAA,EAKhD,gCAASC,qBAAoB,OAA8C,cAAc;AACvF,UAAM,EAAE,mBAAmB,GAAG,eAAe,IAAI;AACjD,UAAM,aAAa,cAAc,iBAAiB;AAClD,WAAO,6CAAC,kBAAgB,GAAG,YAAa,GAAG,gBAAgB,KAAK,cAAc;AAAA,EAChF,GAJA;AAKF;", + "names": ["React", "import_primitive", "import_react_compose_refs", "import_react_context", "import_react_primitive", "RadioTrigger", "RadioIndicator", "RadioBubbleInput", "import_jsx_runtime", "RadioGroup", "RadioGroupItemTrigger", "RadioGroupItem", "RadioGroupItemBubbleInput", "RadioGroupIndicator"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-radio-group/dist/index.mjs b/e-commerce/node_modules/@radix-ui/react-radio-group/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b6bc29c397b3e31807eace8ba5180b487ebec2d0 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-radio-group/dist/index.mjs @@ -0,0 +1,446 @@ +"use client"; +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// src/radio-group.tsx +import * as React2 from "react"; +import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive"; +import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs"; +import { createContextScope as createContextScope2 } from "@radix-ui/react-context"; +import { Primitive as Primitive2 } from "@radix-ui/react-primitive"; +import * as RovingFocusGroup from "@radix-ui/react-roving-focus"; +import { createRovingFocusGroupScope } from "@radix-ui/react-roving-focus"; +import { useControllableState } from "@radix-ui/react-use-controllable-state"; +import { useDirection } from "@radix-ui/react-direction"; + +// src/radio.tsx +import * as React from "react"; +import { composeEventHandlers } from "@radix-ui/primitive"; +import { useComposedRefs } from "@radix-ui/react-compose-refs"; +import { createContextScope } from "@radix-ui/react-context"; +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 RADIO_NAME = "Radio"; +var [createRadioContext, createRadioScope] = createContextScope(RADIO_NAME); +var [RadioProviderImpl, useRadioContext] = createRadioContext(RADIO_NAME); +function RadioProvider(props) { + const { + __scopeRadio, + checked = false, + children, + disabled, + form, + name, + onCheck, + required, + value = "on", + // @ts-expect-error + internal_do_not_use_render + } = props; + const [control, setControl] = React.useState(null); + const [bubbleInput, setBubbleInput] = React.useState(null); + const [userClick, setUserClick] = React.useState(null); + 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, + required, + name, + form, + value, + control, + setControl, + userClick, + onUserClick: setUserClick, + isFormControl, + bubbleInput, + setBubbleInput, + onCheck: /* @__PURE__ */ __name(() => onCheck?.(), "onCheck") + }; + return /* @__PURE__ */ jsx(RadioProviderImpl, { scope: __scopeRadio, ...context, children: isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children }); +} +__name(RadioProvider, "RadioProvider"); +var TRIGGER_NAME = "RadioTrigger"; +var RadioTrigger = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function RadioTrigger2({ __scopeRadio, onClick, ...radioProps }, forwardedRef) { + const { + checked, + disabled, + value, + setControl, + onCheck, + onUserClick, + isFormControl, + bubbleInput + } = useRadioContext(TRIGGER_NAME, __scopeRadio); + const composedRefs = useComposedRefs(forwardedRef, setControl); + return /* @__PURE__ */ jsx( + Primitive.button, + { + type: "button", + role: "radio", + "aria-checked": checked, + "data-state": getState(checked), + "data-disabled": disabled ? "" : void 0, + disabled, + value, + ...radioProps, + ref: composedRefs, + onClick: composeEventHandlers(onClick, (event) => { + const hasConsumerStoppedPropagation = event.isPropagationStopped(); + if (!checked) { + onUserClick({ hasConsumerStoppedPropagation }); + onCheck(); + } + if (bubbleInput && isFormControl) { + if (!hasConsumerStoppedPropagation) { + event.stopPropagation(); + } + } + }) + } + ); + }, "RadioTrigger") +); +var INDICATOR_NAME = "RadioIndicator"; +var RadioIndicator = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function RadioIndicator2(props, forwardedRef) { + const { __scopeRadio, forceMount, ...indicatorProps } = props; + const context = useRadioContext(INDICATOR_NAME, __scopeRadio); + return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.checked, children: /* @__PURE__ */ jsx( + Primitive.span, + { + "data-state": getState(context.checked), + "data-disabled": context.disabled ? "" : void 0, + ...indicatorProps, + ref: forwardedRef + } + ) }); + }, "RadioIndicator") +); +var BUBBLE_INPUT_NAME = "RadioBubbleInput"; +var RadioBubbleInput = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function RadioBubbleInput2({ __scopeRadio, onClick, ...props }, forwardedRef) { + const { + control, + checked, + required, + disabled, + name, + value, + form, + bubbleInput, + setBubbleInput, + userClick + } = useRadioContext(BUBBLE_INPUT_NAME, __scopeRadio); + const composedRefs = useComposedRefs(forwardedRef, setBubbleInput); + const controlSize = useSize(control); + const shouldStopClickPropagationRef = React.useRef(false); + const prevCheckedRef = React.useRef(checked); + const handledUserClickRef = React.useRef(userClick); + const pendingUserClickRef = React.useRef(null); + React.useEffect(() => { + const input = bubbleInput; + if (!input) return; + const inputProto = window.HTMLInputElement.prototype; + const descriptor = Object.getOwnPropertyDescriptor( + inputProto, + "checked" + ); + const setChecked = descriptor.set; + if (!setChecked) return; + const checkedChanged = prevCheckedRef.current !== checked; + prevCheckedRef.current = checked; + const isNewUserClick = userClick !== null && userClick !== handledUserClickRef.current; + handledUserClickRef.current = userClick; + if (isNewUserClick) { + pendingUserClickRef.current = checkedChanged ? null : userClick; + if (checkedChanged) { + setChecked.call(input, checked); + } + input.dispatchEvent( + new Event("click", { bubbles: !userClick.hasConsumerStoppedPropagation }) + ); + } else if (checkedChanged) { + const pendingUserClick = pendingUserClickRef.current; + pendingUserClickRef.current = null; + const isPendingUserChange = checked && pendingUserClick !== null; + shouldStopClickPropagationRef.current = true; + setChecked.call(input, checked); + input.dispatchEvent( + new Event("click", { + bubbles: !(isPendingUserChange && pendingUserClick.hasConsumerStoppedPropagation) + }) + ); + shouldStopClickPropagationRef.current = false; + } + }, [bubbleInput, checked, userClick]); + const defaultCheckedRef = React.useRef(checked); + return /* @__PURE__ */ jsx( + Primitive.input, + { + type: "radio", + "aria-hidden": true, + defaultChecked: defaultCheckedRef.current, + required, + disabled, + name, + value, + form, + ...props, + tabIndex: -1, + ref: composedRefs, + onClick: composeEventHandlers(onClick, (event) => { + if (shouldStopClickPropagationRef.current) { + event.stopPropagation(); + } + }), + 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%)" + } + } + ); + }, "RadioBubbleInput") +); +function isFunction(value) { + return typeof value === "function"; +} +__name(isFunction, "isFunction"); +function getState(checked) { + return checked ? "checked" : "unchecked"; +} +__name(getState, "getState"); + +// src/radio-group.tsx +import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime"; +var ARROW_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]; +var RADIO_GROUP_NAME = "RadioGroup"; +var [createRadioGroupContext, createRadioGroupScope] = createContextScope2(RADIO_GROUP_NAME, [ + createRovingFocusGroupScope, + createRadioScope +]); +var useRovingFocusGroupScope = createRovingFocusGroupScope(); +var useRadioScope = createRadioScope(); +var [RadioGroupProvider, useRadioGroupContext] = createRadioGroupContext(RADIO_GROUP_NAME); +var RadioGroup = /* @__PURE__ */ React2.forwardRef( + /* @__PURE__ */ __name(function RadioGroup2(props, forwardedRef) { + const { + __scopeRadioGroup, + name, + form, + defaultValue, + value: valueProp, + required = false, + disabled = false, + orientation, + dir, + loop = true, + onValueChange, + ...groupProps + } = props; + const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup); + const direction = useDirection(dir); + const [value, setValue] = useControllableState({ + prop: valueProp, + defaultProp: defaultValue ?? null, + onChange: onValueChange, + caller: RADIO_GROUP_NAME + }); + const [control, setControl] = React2.useState(null); + const composedRefs = useComposedRefs2(forwardedRef, setControl); + const initialValueRef = React2.useRef(value); + React2.useEffect(() => { + const associatedForm = form ? control?.ownerDocument.getElementById(form) : control?.closest("form"); + if (associatedForm instanceof HTMLFormElement) { + const reset = /* @__PURE__ */ __name(() => setValue(initialValueRef.current), "reset"); + associatedForm.addEventListener("reset", reset); + return () => associatedForm.removeEventListener("reset", reset); + } + }, [control, form, setValue]); + return /* @__PURE__ */ jsx2( + RadioGroupProvider, + { + scope: __scopeRadioGroup, + name, + form, + required, + disabled, + value, + onValueChange: setValue, + children: /* @__PURE__ */ jsx2( + RovingFocusGroup.Root, + { + asChild: true, + ...rovingFocusGroupScope, + orientation, + dir: direction, + loop, + children: /* @__PURE__ */ jsx2( + Primitive2.div, + { + role: "radiogroup", + "aria-required": required, + "aria-orientation": orientation, + "data-disabled": disabled ? "" : void 0, + dir: direction, + ...groupProps, + ref: composedRefs + } + ) + } + ) + } + ); + }, "RadioGroup") +); +var ITEM_PROVIDER_NAME = "RadioGroupItemProvider"; +var ITEM_TRIGGER_NAME = "RadioGroupItemTrigger"; +function RadioGroupItemProvider(props) { + const { + __scopeRadioGroup, + value, + disabled, + children, + // @ts-expect-error + internal_do_not_use_render + } = props; + const context = useRadioGroupContext(ITEM_PROVIDER_NAME, __scopeRadioGroup); + const radioScope = useRadioScope(__scopeRadioGroup); + const isDisabled = context.disabled || disabled; + return /* @__PURE__ */ jsx2( + RadioProvider, + { + ...radioScope, + checked: context.value === value, + disabled: isDisabled, + required: context.required, + name: context.name, + form: context.form, + value, + onCheck: () => context.onValueChange(value), + internal_do_not_use_render, + children + } + ); +} +__name(RadioGroupItemProvider, "RadioGroupItemProvider"); +var RadioGroupItemTrigger = /* @__PURE__ */ React2.forwardRef(/* @__PURE__ */ __name(function RadioGroupItemTrigger2(props, forwardedRef) { + const { __scopeRadioGroup, ...triggerProps } = props; + const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup); + const radioScope = useRadioScope(__scopeRadioGroup); + const { checked, disabled } = useRadioContext(ITEM_TRIGGER_NAME, radioScope.__scopeRadio); + const ref = React2.useRef(null); + const composedRefs = useComposedRefs2(forwardedRef, ref); + const isArrowKeyPressedRef = React2.useRef(false); + React2.useEffect(() => { + const handleKeyDown = /* @__PURE__ */ __name((event) => { + if (ARROW_KEYS.includes(event.key)) { + isArrowKeyPressedRef.current = true; + } + }, "handleKeyDown"); + const handleKeyUp = /* @__PURE__ */ __name(() => isArrowKeyPressedRef.current = false, "handleKeyUp"); + document.addEventListener("keydown", handleKeyDown); + document.addEventListener("keyup", handleKeyUp); + return () => { + document.removeEventListener("keydown", handleKeyDown); + document.removeEventListener("keyup", handleKeyUp); + }; + }, []); + return /* @__PURE__ */ jsx2( + RovingFocusGroup.Item, + { + asChild: true, + ...rovingFocusGroupScope, + focusable: !disabled, + active: checked, + children: /* @__PURE__ */ jsx2( + RadioTrigger, + { + ...radioScope, + ...triggerProps, + ref: composedRefs, + onKeyDown: composeEventHandlers2(triggerProps.onKeyDown, (event) => { + if (event.key === "Enter") event.preventDefault(); + }), + onFocus: composeEventHandlers2(triggerProps.onFocus, () => { + if (isArrowKeyPressedRef.current) { + ref.current?.click(); + } + }) + } + ) + } + ); +}, "RadioGroupItemTrigger")); +var RadioGroupItem = /* @__PURE__ */ React2.forwardRef( + /* @__PURE__ */ __name(function RadioGroupItem2(props, forwardedRef) { + const { __scopeRadioGroup, value, disabled, ...itemProps } = props; + return /* @__PURE__ */ jsx2( + RadioGroupItemProvider, + { + __scopeRadioGroup, + value, + disabled, + internal_do_not_use_render: ({ isFormControl }) => /* @__PURE__ */ jsxs2(Fragment2, { children: [ + /* @__PURE__ */ jsx2( + RadioGroupItemTrigger, + { + ...itemProps, + ref: forwardedRef, + __scopeRadioGroup + } + ), + isFormControl && /* @__PURE__ */ jsx2( + RadioGroupItemBubbleInput, + { + __scopeRadioGroup + } + ) + ] }) + } + ); + }, "RadioGroupItem") +); +var RadioGroupItemBubbleInput = /* @__PURE__ */ React2.forwardRef(/* @__PURE__ */ __name(function RadioGroupItemBubbleInput2(props, forwardedRef) { + const { __scopeRadioGroup, ...bubbleProps } = props; + const radioScope = useRadioScope(__scopeRadioGroup); + return /* @__PURE__ */ jsx2(RadioBubbleInput, { ...radioScope, ...bubbleProps, ref: forwardedRef }); +}, "RadioGroupItemBubbleInput")); +var RadioGroupIndicator = /* @__PURE__ */ React2.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function RadioGroupIndicator2(props, forwardedRef) { + const { __scopeRadioGroup, ...indicatorProps } = props; + const radioScope = useRadioScope(__scopeRadioGroup); + return /* @__PURE__ */ jsx2(RadioIndicator, { ...radioScope, ...indicatorProps, ref: forwardedRef }); + }, "RadioGroupIndicator") +); +export { + RadioGroupIndicator as Indicator, + RadioGroupItem as Item, + RadioGroup, + RadioGroupIndicator, + RadioGroupItem, + RadioGroup as Root, + createRadioGroupScope, + RadioGroupItemBubbleInput as unstable_ItemBubbleInput, + RadioGroupItemProvider as unstable_ItemProvider, + RadioGroupItemTrigger as unstable_ItemTrigger, + RadioGroupItemBubbleInput as unstable_RadioGroupItemBubbleInput, + RadioGroupItemProvider as unstable_RadioGroupItemProvider, + RadioGroupItemTrigger as unstable_RadioGroupItemTrigger +}; +//# sourceMappingURL=index.mjs.map diff --git a/e-commerce/node_modules/@radix-ui/react-radio-group/dist/index.mjs.map b/e-commerce/node_modules/@radix-ui/react-radio-group/dist/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..062336d745fe486551e7d6974405ca66717d67c5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-radio-group/dist/index.mjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/radio-group.tsx", "../src/radio.tsx"], + "sourcesContent": ["import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as RovingFocusGroup from '@radix-ui/react-roving-focus';\nimport { createRovingFocusGroupScope } from '@radix-ui/react-roving-focus';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useDirection } from '@radix-ui/react-direction';\nimport {\n type Radio,\n RadioProvider,\n RadioTrigger,\n RadioBubbleInput,\n RadioIndicator,\n createRadioScope,\n useRadioContext,\n} from './radio';\n\nimport type { Scope } from '@radix-ui/react-context';\n\nconst ARROW_KEYS = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];\n\n/* -------------------------------------------------------------------------------------------------\n * RadioGroup\n * -----------------------------------------------------------------------------------------------*/\nconst RADIO_GROUP_NAME = 'RadioGroup';\n\ntype ScopedProps

= P & { __scopeRadioGroup?: Scope | undefined };\nconst [createRadioGroupContext, createRadioGroupScope] = createContextScope(RADIO_GROUP_NAME, [\n createRovingFocusGroupScope,\n createRadioScope,\n]);\nconst useRovingFocusGroupScope = createRovingFocusGroupScope();\nconst useRadioScope = createRadioScope();\n\ntype RadioGroupContextValue = {\n name?: string | undefined;\n form?: string | undefined;\n required: boolean;\n disabled: boolean;\n value: string | null;\n onValueChange(value: string): void;\n};\n\nconst [RadioGroupProvider, useRadioGroupContext] =\n createRadioGroupContext(RADIO_GROUP_NAME);\n\ntype RadioGroupElement = React.ComponentRef;\ntype RovingFocusGroupProps = React.ComponentPropsWithoutRef;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef;\ninterface RadioGroupProps extends PrimitiveDivProps {\n name?: RadioGroupContextValue['name'] | undefined;\n form?: React.ComponentPropsWithoutRef['form'] | undefined;\n required?: React.ComponentPropsWithoutRef['required'] | undefined;\n disabled?: React.ComponentPropsWithoutRef['disabled'] | undefined;\n dir?: RovingFocusGroupProps['dir'] | undefined;\n orientation?: RovingFocusGroupProps['orientation'] | undefined;\n loop?: RovingFocusGroupProps['loop'] | undefined;\n defaultValue?: string | undefined;\n value?: string | null | undefined;\n onValueChange?: RadioGroupContextValue['onValueChange'] | undefined;\n}\n\nconst RadioGroup = /* @__PURE__ */ React.forwardRef(\n function RadioGroup(props: ScopedProps, forwardedRef) {\n const {\n __scopeRadioGroup,\n name,\n form,\n defaultValue,\n value: valueProp,\n required = false,\n disabled = false,\n orientation,\n dir,\n loop = true,\n onValueChange,\n ...groupProps\n } = props;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);\n const direction = useDirection(dir);\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue ?? null,\n onChange: onValueChange as (value: string | null) => void,\n caller: RADIO_GROUP_NAME,\n });\n const [control, setControl] = React.useState(null);\n const composedRefs = useComposedRefs(forwardedRef, setControl);\n\n const initialValueRef = React.useRef(value);\n React.useEffect(() => {\n const associatedForm = form\n ? control?.ownerDocument.getElementById(form)\n : control?.closest('form');\n if (associatedForm instanceof HTMLFormElement) {\n const reset = () => setValue(initialValueRef.current);\n associatedForm.addEventListener('reset', reset);\n return () => associatedForm.removeEventListener('reset', reset);\n }\n }, [control, form, setValue]);\n\n return (\n \n \n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * RadioGroupItemProvider\n * -----------------------------------------------------------------------------------------------*/\nconst ITEM_PROVIDER_NAME = 'RadioGroupItemProvider';\nconst ITEM_TRIGGER_NAME = 'RadioGroupItemTrigger';\n\ninterface RadioGroupItemProviderProps {\n value: string;\n disabled?: boolean | undefined;\n children?: React.ReactNode | undefined;\n}\n\nfunction RadioGroupItemProvider(props: ScopedProps) {\n const {\n __scopeRadioGroup,\n value,\n disabled,\n children,\n // @ts-expect-error\n internal_do_not_use_render,\n } = props;\n const context = useRadioGroupContext(ITEM_PROVIDER_NAME, __scopeRadioGroup);\n const radioScope = useRadioScope(__scopeRadioGroup);\n const isDisabled = context.disabled || disabled;\n\n return (\n context.onValueChange(value)}\n // @ts-expect-error\n internal_do_not_use_render={internal_do_not_use_render}\n >\n {children}\n \n );\n}\n\n/* -------------------------------------------------------------------------------------------------\n * RadioGroupItemTrigger\n * -----------------------------------------------------------------------------------------------*/\n\ntype RadioGroupItemTriggerElement = React.ComponentRef;\ninterface RadioGroupItemTriggerProps extends React.ComponentPropsWithoutRef {}\n\nconst RadioGroupItemTrigger = /* @__PURE__ */ React.forwardRef<\n RadioGroupItemTriggerElement,\n RadioGroupItemTriggerProps\n>(function RadioGroupItemTrigger(props: ScopedProps, forwardedRef) {\n const { __scopeRadioGroup, ...triggerProps } = props;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);\n const radioScope = useRadioScope(__scopeRadioGroup);\n const { checked, disabled } = useRadioContext(ITEM_TRIGGER_NAME, radioScope.__scopeRadio);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const isArrowKeyPressedRef = React.useRef(false);\n\n React.useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (ARROW_KEYS.includes(event.key)) {\n isArrowKeyPressedRef.current = true;\n }\n };\n const handleKeyUp = () => (isArrowKeyPressedRef.current = false);\n document.addEventListener('keydown', handleKeyDown);\n document.addEventListener('keyup', handleKeyUp);\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n document.removeEventListener('keyup', handleKeyUp);\n };\n }, []);\n\n return (\n \n {\n // According to WAI ARIA, radio groups don't activate items on enter\n // keypress\n if (event.key === 'Enter') event.preventDefault();\n })}\n onFocus={composeEventHandlers(triggerProps.onFocus, () => {\n /**\n * Our `RovingFocusGroup` will focus the radio when navigating with\n * arrow keys and we need to \"check\" it in that case. We click it to\n * \"check\" it (instead of updating `context.value`) so that the radio\n * change event fires.\n */\n if (isArrowKeyPressedRef.current) {\n ref.current?.click();\n }\n })}\n />\n \n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * RadioGroupItem\n * -----------------------------------------------------------------------------------------------*/\n\ntype RadioGroupItemElement = React.ComponentRef;\ntype RadioProps = React.ComponentPropsWithoutRef;\ninterface RadioGroupItemProps extends Omit {\n value: string;\n}\n\nconst RadioGroupItem = /* @__PURE__ */ React.forwardRef(\n function RadioGroupItem(props: ScopedProps, forwardedRef) {\n const { __scopeRadioGroup, value, disabled, ...itemProps } = props;\n\n return (\n (\n <>\n \n {isFormControl && (\n \n )}\n \n )}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * RadioGroupItemBubbleInput\n * -----------------------------------------------------------------------------------------------*/\n\ntype RadioGroupItemBubbleInputElement = React.ComponentRef;\ninterface RadioGroupItemBubbleInputProps extends React.ComponentPropsWithoutRef<\n typeof RadioBubbleInput\n> {}\n\nconst RadioGroupItemBubbleInput = /* @__PURE__ */ React.forwardRef<\n RadioGroupItemBubbleInputElement,\n RadioGroupItemBubbleInputProps\n>(function RadioGroupItemBubbleInput(\n props: ScopedProps,\n forwardedRef,\n) {\n const { __scopeRadioGroup, ...bubbleProps } = props;\n const radioScope = useRadioScope(__scopeRadioGroup);\n return ;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * RadioGroupIndicator\n * -----------------------------------------------------------------------------------------------*/\n\ntype RadioGroupIndicatorElement = React.ComponentRef;\ntype RadioIndicatorProps = React.ComponentPropsWithoutRef;\ninterface RadioGroupIndicatorProps extends RadioIndicatorProps {}\n\nconst RadioGroupIndicator = /* @__PURE__ */ React.forwardRef<\n RadioGroupIndicatorElement,\n RadioGroupIndicatorProps\n>(\n // blank line to reduce diff noise\n function RadioGroupIndicator(props: ScopedProps, forwardedRef) {\n const { __scopeRadioGroup, ...indicatorProps } = props;\n const radioScope = useRadioScope(__scopeRadioGroup);\n return ;\n },\n);\n\n/* ---------------------------------------------------------------------------------------------- */\n\nexport {\n createRadioGroupScope,\n //\n RadioGroup,\n RadioGroupItem,\n RadioGroupItemProvider,\n RadioGroupItemTrigger,\n RadioGroupItemBubbleInput,\n RadioGroupIndicator,\n //\n RadioGroup as Root,\n RadioGroupItem as Item,\n RadioGroupItemProvider as ItemProvider,\n RadioGroupItemTrigger as ItemTrigger,\n RadioGroupItemBubbleInput as ItemBubbleInput,\n RadioGroupIndicator as Indicator,\n};\nexport type {\n RadioGroupProps,\n RadioGroupItemProps,\n RadioGroupItemProviderProps,\n RadioGroupItemTriggerProps,\n RadioGroupItemBubbleInputProps,\n RadioGroupIndicatorProps,\n};\n", "import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useSize } from '@radix-ui/react-use-size';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\n\nimport type { Scope } from '@radix-ui/react-context';\n\nconst RADIO_NAME = 'Radio';\n\ntype ScopedProps

= P & { __scopeRadio?: Scope | undefined };\nconst [createRadioContext, createRadioScope] = createContextScope(RADIO_NAME);\n\ntype RadioUserClick = {\n hasConsumerStoppedPropagation: boolean;\n};\n\ntype RadioContextValue = {\n checked: boolean;\n disabled: boolean | undefined;\n required: boolean | undefined;\n name: string | undefined;\n form: string | undefined;\n value: string | number | readonly string[];\n control: HTMLButtonElement | null;\n setControl: React.Dispatch>;\n userClick: RadioUserClick | null;\n onUserClick: (userClick: RadioUserClick) => void;\n isFormControl: boolean;\n bubbleInput: HTMLInputElement | null;\n setBubbleInput: React.Dispatch>;\n onCheck(): void;\n};\n\nconst [RadioProviderImpl, useRadioContext] = createRadioContext(RADIO_NAME);\n\n/* -------------------------------------------------------------------------------------------------\n * RadioProvider\n * -----------------------------------------------------------------------------------------------*/\n\ninterface RadioProviderProps {\n checked?: boolean | undefined;\n required?: boolean | undefined;\n disabled?: boolean | undefined;\n name?: string | undefined;\n form?: string | undefined;\n value?: string | number | readonly string[] | undefined;\n onCheck?: (() => void) | undefined;\n children?: React.ReactNode | undefined;\n}\n\nfunction RadioProvider(props: ScopedProps) {\n const {\n __scopeRadio,\n checked = false,\n children,\n disabled,\n form,\n name,\n onCheck,\n required,\n value = 'on',\n // @ts-expect-error\n internal_do_not_use_render,\n } = props;\n\n const [control, setControl] = React.useState(null);\n const [bubbleInput, setBubbleInput] = React.useState(null);\n // The latest user click on the trigger that checks the radio. The bubble\n // input dispatches the click to the form once React has handled it, whether\n // or not `checked` changes in the same render.\n const [userClick, setUserClick] = React.useState(null);\n\n const isFormControl = control\n ? !!form || !!control.closest('form')\n : // We set this to true by default so that events bubble to forms without JS (SSR)\n true;\n\n const context: RadioContextValue = {\n checked,\n disabled,\n required,\n name,\n form,\n value,\n control,\n setControl,\n userClick,\n onUserClick: setUserClick,\n isFormControl,\n bubbleInput,\n setBubbleInput,\n onCheck: () => onCheck?.(),\n };\n\n return (\n \n {isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children}\n \n );\n}\n\n/* -------------------------------------------------------------------------------------------------\n * RadioTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'RadioTrigger';\n\ninterface RadioTriggerProps extends Omit<\n React.ComponentPropsWithoutRef,\n keyof RadioProviderProps\n> {\n children?: React.ReactNode | undefined;\n}\n\nconst RadioTrigger = /* @__PURE__ */ React.forwardRef(\n function RadioTrigger(\n { __scopeRadio, onClick, ...radioProps }: ScopedProps,\n forwardedRef,\n ) {\n const {\n checked,\n disabled,\n value,\n setControl,\n onCheck,\n onUserClick,\n isFormControl,\n bubbleInput,\n } = useRadioContext(TRIGGER_NAME, __scopeRadio);\n const composedRefs = useComposedRefs(forwardedRef, setControl);\n\n return (\n {\n const hasConsumerStoppedPropagation = event.isPropagationStopped();\n // radios cannot be unchecked so we only communicate a checked state.\n if (!checked) {\n onUserClick({ hasConsumerStoppedPropagation });\n onCheck();\n }\n\n if (bubbleInput && isFormControl) {\n // if radio has a bubble input and is a form control, stop\n // propagation from the button so that we only propagate one click\n // event (from the input). We propagate changes from an input so\n // that native form validation works and form events reflect radio\n // updates.\n if (!hasConsumerStoppedPropagation) {\n event.stopPropagation();\n }\n }\n })}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * Radio\n * -----------------------------------------------------------------------------------------------*/\n\ntype RadioElement = React.ComponentRef;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef;\ninterface RadioProps extends Omit {\n checked?: boolean | undefined;\n required?: boolean | undefined;\n onCheck?: (() => void) | undefined;\n}\n\nconst Radio = /* @__PURE__ */ React.forwardRef(\n // blank line to reduce diff noise\n function Radio(props: ScopedProps, forwardedRef) {\n const { __scopeRadio, name, checked, required, disabled, value, onCheck, form, ...radioProps } =\n props;\n\n return (\n (\n <>\n \n {isFormControl && (\n \n )}\n \n )}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * RadioIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'RadioIndicator';\n\ntype RadioIndicatorElement = React.ComponentRef;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef;\nexport interface RadioIndicatorProps extends PrimitiveSpanProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst RadioIndicator = /* @__PURE__ */ React.forwardRef(\n function RadioIndicator(props: ScopedProps, forwardedRef) {\n const { __scopeRadio, forceMount, ...indicatorProps } = props;\n const context = useRadioContext(INDICATOR_NAME, __scopeRadio);\n return (\n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * RadioBubbleInput\n * -----------------------------------------------------------------------------------------------*/\n\nconst BUBBLE_INPUT_NAME = 'RadioBubbleInput';\n\ntype InputProps = React.ComponentPropsWithoutRef;\ninterface RadioBubbleInputProps extends Omit {}\n\nconst RadioBubbleInput = /* @__PURE__ */ React.forwardRef(\n function RadioBubbleInput(\n { __scopeRadio, onClick, ...props }: ScopedProps,\n forwardedRef,\n ) {\n const {\n control,\n checked,\n required,\n disabled,\n name,\n value,\n form,\n bubbleInput,\n setBubbleInput,\n userClick,\n } = useRadioContext(BUBBLE_INPUT_NAME, __scopeRadio);\n\n const composedRefs = useComposedRefs(forwardedRef, setBubbleInput);\n const controlSize = useSize(control);\n // When the checked change is not driven by a user interaction (e.g. a\n // controlled `checked` update), the `click` event we dispatch to notify\n // forms must not reach ancestor `onClick` handlers. We can't simply make it\n // non-bubbling because React derives the radio's `change` event from a\n // bubbling `click`. Instead we stop propagation of the synthetic click,\n // which still lets the `change` event reach the form.\n const shouldStopClickPropagationRef = React.useRef(false);\n const prevCheckedRef = React.useRef(checked);\n // The user click this input last dispatched, so each click is dispatched\n // once.\n const handledUserClickRef = React.useRef(userClick);\n // A dispatched user click whose check hasn't been applied yet (e.g. a\n // controlled parent applying it later). When it is applied, it must still\n // respect the consumer stopping the click's propagation.\n const pendingUserClickRef = React.useRef(null);\n\n // Bubble checked change to parents (e.g form change event)\n React.useEffect(() => {\n const input = bubbleInput;\n if (!input) return;\n\n const inputProto = window.HTMLInputElement.prototype;\n const descriptor = Object.getOwnPropertyDescriptor(\n inputProto,\n 'checked',\n ) as PropertyDescriptor;\n const setChecked = descriptor.set;\n if (!setChecked) return;\n\n const checkedChanged = prevCheckedRef.current !== checked;\n prevCheckedRef.current = checked;\n const isNewUserClick = userClick !== null && userClick !== handledUserClickRef.current;\n handledUserClickRef.current = userClick;\n\n if (isNewUserClick) {\n // Dispatch the user's click even if the radio isn't checked (yet), so\n // ancestors are notified of every click on the trigger.\n pendingUserClickRef.current = checkedChanged ? null : userClick;\n if (checkedChanged) {\n setChecked.call(input, checked);\n }\n input.dispatchEvent(\n new Event('click', { bubbles: !userClick.hasConsumerStoppedPropagation }),\n );\n } else if (checkedChanged) {\n const pendingUserClick = pendingUserClickRef.current;\n pendingUserClickRef.current = null;\n const isPendingUserChange = checked && pendingUserClick !== null;\n // The user's click already reached ancestors, and programmatic\n // updates never do, so this click only notifies the form.\n shouldStopClickPropagationRef.current = true;\n setChecked.call(input, checked);\n input.dispatchEvent(\n new Event('click', {\n bubbles: !(isPendingUserChange && pendingUserClick.hasConsumerStoppedPropagation),\n }),\n );\n shouldStopClickPropagationRef.current = false;\n }\n }, [bubbleInput, checked, userClick]);\n\n const defaultCheckedRef = React.useRef(checked);\n return (\n {\n // Prevent the synthetic click dispatched on controlled/programmatic\n // updates from triggering ancestor `onClick` handlers, while still\n // allowing the resulting `change` event to reach the form.\n if (shouldStopClickPropagationRef.current) {\n event.stopPropagation();\n }\n })}\n style={{\n ...props.style,\n ...controlSize,\n position: 'absolute',\n pointerEvents: 'none',\n opacity: 0,\n margin: 0,\n // We transform because the input is absolutely positioned but we have\n // rendered it **after** the button. This pulls it back to sit on top\n // of the button.\n transform: 'translateX(-100%)',\n }}\n />\n );\n },\n);\n\n/* ---------------------------------------------------------------------------------------------- */\n\nfunction isFunction(value: unknown): value is (...args: any[]) => any {\n return typeof value === 'function';\n}\n\nfunction getState(checked: boolean) {\n return checked ? 'checked' : 'unchecked';\n}\n\nexport {\n createRadioScope,\n useRadioContext,\n //\n Radio,\n RadioProvider,\n RadioTrigger,\n RadioIndicator,\n RadioBubbleInput,\n};\nexport type { RadioProps, RadioProviderProps, RadioTriggerProps, RadioBubbleInputProps };\n"], + "mappings": ";;;;;AAAA,YAAYA,YAAW;AACvB,SAAS,wBAAAC,6BAA4B;AACrC,SAAS,mBAAAC,wBAAuB;AAChC,SAAS,sBAAAC,2BAA0B;AACnC,SAAS,aAAAC,kBAAiB;AAC1B,YAAY,sBAAsB;AAClC,SAAS,mCAAmC;AAC5C,SAAS,4BAA4B;AACrC,SAAS,oBAAoB;;;ACR7B,YAAY,WAAW;AACvB,SAAS,4BAA4B;AACrC,SAAS,uBAAuB;AAChC,SAAS,0BAA0B;AACnC,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AA4FtB,SAqGM,UArGN,KAqGM,YArGN;AAxFJ,IAAM,aAAa;AAGnB,IAAM,CAAC,oBAAoB,gBAAgB,IAAI,mBAAmB,UAAU;AAuB5E,IAAM,CAAC,mBAAmB,eAAe,IAAI,mBAAsC,UAAU;AAiB7F,SAAS,cAAc,OAAwC;AAC7D,QAAM;AAAA,IACJ;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA;AAAA,IAER;AAAA,EACF,IAAI;AAEJ,QAAM,CAAC,SAAS,UAAU,IAAU,eAAmC,IAAI;AAC3E,QAAM,CAAC,aAAa,cAAc,IAAU,eAAkC,IAAI;AAIlF,QAAM,CAAC,WAAW,YAAY,IAAU,eAAgC,IAAI;AAE5E,QAAM,gBAAgB,UAClB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,QAAQ,MAAM;AAAA;AAAA,IAElC;AAAA;AAEJ,QAAM,UAA6B;AAAA,IACjC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb;AAAA,IACA;AAAA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C;AAAA,YAAC;AAAA;AAAA,cACE,GAAG;AAAA,cACJ,KAAK;AAAA,cAEL;AAAA;AAAA,UACF;AAAA,UACC,iBACC,gBAAAA;AAAA,YAAC;AAAA;AAAA,cAEC;AAAA;AAAA,UACF;AAAA,WAEJ;AAAA;AAAA,IAEJ;AAAA,EAEJ,GA3BA;AA4BF;AAWA,IAAM,4BAA4C,gBAAM,kBAGtD,gCAASS,2BACT,OACA,cACA;AACA,QAAM,EAAE,mBAAmB,GAAG,YAAY,IAAI;AAC9C,QAAM,aAAa,cAAc,iBAAiB;AAClD,SAAO,gBAAAT,KAAC,oBAAkB,GAAG,YAAa,GAAG,aAAa,KAAK,cAAc;AAC/E,GAPE,4BAOD;AAUD,IAAM,sBAAsC,gBAAM;AAAA;AAAA,EAKhD,gCAASU,qBAAoB,OAA8C,cAAc;AACvF,UAAM,EAAE,mBAAmB,GAAG,eAAe,IAAI;AACjD,UAAM,aAAa,cAAc,iBAAiB;AAClD,WAAO,gBAAAV,KAAC,kBAAgB,GAAG,YAAa,GAAG,gBAAgB,KAAK,cAAc;AAAA,EAChF,GAJA;AAKF;", + "names": ["React", "composeEventHandlers", "useComposedRefs", "createContextScope", "Primitive", "RadioTrigger", "RadioIndicator", "RadioBubbleInput", "Fragment", "jsx", "jsxs", "createContextScope", "RadioGroup", "useComposedRefs", "Primitive", "RadioGroupItemTrigger", "composeEventHandlers", "RadioGroupItem", "RadioGroupItemBubbleInput", "RadioGroupIndicator"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-radio-group/package.json b/e-commerce/node_modules/@radix-ui/react-radio-group/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0b2e3fcc44e29cdc9c2f51631827341b33c93fa9 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-radio-group/package.json @@ -0,0 +1,76 @@ +{ + "name": "@radix-ui/react-radio-group", + "version": "1.5.0", + "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.2.0", + "@radix-ui/react-compose-refs": "1.1.5", + "@radix-ui/react-context": "1.3.0", + "@radix-ui/react-direction": "1.2.0", + "@radix-ui/react-presence": "1.1.11", + "@radix-ui/react-primitive": "2.2.0", + "@radix-ui/react-roving-focus": "1.2.0", + "@radix-ui/react-use-controllable-state": "1.3.0", + "@radix-ui/react-use-size": "1.1.5" + }, + "devDependencies": { + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "react": "^19.3.0", + "react-dom": "^19.3.0", + "typescript": "^5.9.3", + "@repo/builder": "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", + "directory": "packages/react/radio-group" + }, + "bugs": { + "url": "https://github.com/radix-ui/primitives/issues" + }, + "scripts": { + "lint": "oxlint --max-warnings 0 src", + "clean": "rm -rf dist", + "reset": "rm -rf dist node_modules", + "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" + } + } + } +} \ No newline at end of file diff --git a/e-commerce/node_modules/@radix-ui/react-roving-focus/LICENSE b/e-commerce/node_modules/@radix-ui/react-roving-focus/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a18858fb7b014098cba85703e66609be66a26ef5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-roving-focus/LICENSE @@ -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. diff --git a/e-commerce/node_modules/@radix-ui/react-roving-focus/README.md b/e-commerce/node_modules/@radix-ui/react-roving-focus/README.md new file mode 100644 index 0000000000000000000000000000000000000000..bc1d8c035336ae4ca27bc783defa948b0cceb5f0 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-roving-focus/README.md @@ -0,0 +1,3 @@ +# `react-roving-focus` + +This is an internal utility, not intended for public usage. diff --git a/e-commerce/node_modules/@radix-ui/react-roving-focus/dist/index.d.mts b/e-commerce/node_modules/@radix-ui/react-roving-focus/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c5bf7301c92bfd65a637158a421852909321428a --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-roving-focus/dist/index.d.mts @@ -0,0 +1,55 @@ +import * as _radix_ui_react_context from '@radix-ui/react-context'; +import * as React from 'react'; +import { Primitive } from '@radix-ui/react-primitive'; + +declare const createRovingFocusGroupScope: _radix_ui_react_context.CreateScope; +declare const Orientation: { + readonly Vertical: "vertical"; + readonly Horizontal: "horizontal"; +}; +type Orientation = (typeof Orientation)[keyof typeof Orientation]; +declare const Direction: { + readonly LTR: "ltr"; + readonly RTL: "rtl"; +}; +type Direction = (typeof Direction)[keyof typeof Direction]; +interface RovingFocusGroupOptions { + /** + * The orientation of the group. + * Mainly so arrow navigation is done accordingly (left & right vs. up & down) + */ + orientation?: Orientation | undefined; + /** + * The direction of navigation between items. + */ + dir?: Direction | undefined; + /** + * Whether keyboard navigation should loop around + * @defaultValue false + */ + loop?: boolean | undefined; +} +interface RovingFocusGroupProps extends RovingFocusGroupImplProps { +} +declare const RovingFocusGroup: React.ForwardRefExoticComponent>; +type PrimitiveDivProps = React.ComponentPropsWithoutRef; +interface RovingFocusGroupImplProps extends Omit, RovingFocusGroupOptions { + currentTabStopId?: string | null | undefined; + defaultCurrentTabStopId?: string | undefined; + onCurrentTabStopIdChange?: ((tabStopId: string | null) => void) | undefined; + onEntryFocus?: ((event: Event) => void) | undefined; + preventScrollOnEntryFocus?: boolean | undefined; +} +type PrimitiveSpanProps = React.ComponentPropsWithoutRef; +interface RovingFocusItemProps extends Omit { + tabStopId?: string | undefined; + focusable?: boolean | undefined; + active?: boolean | undefined; + children?: React.ReactNode | ((props: { + hasTabStop: boolean; + isCurrentTabStop: boolean; + }) => React.ReactNode) | undefined; +} +declare const RovingFocusGroupItem: React.ForwardRefExoticComponent>; + +export { RovingFocusGroupItem as Item, RovingFocusGroup as Root, RovingFocusGroup, RovingFocusGroupItem, type RovingFocusGroupProps, type RovingFocusItemProps, createRovingFocusGroupScope }; diff --git a/e-commerce/node_modules/@radix-ui/react-roving-focus/dist/index.d.ts b/e-commerce/node_modules/@radix-ui/react-roving-focus/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c5bf7301c92bfd65a637158a421852909321428a --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-roving-focus/dist/index.d.ts @@ -0,0 +1,55 @@ +import * as _radix_ui_react_context from '@radix-ui/react-context'; +import * as React from 'react'; +import { Primitive } from '@radix-ui/react-primitive'; + +declare const createRovingFocusGroupScope: _radix_ui_react_context.CreateScope; +declare const Orientation: { + readonly Vertical: "vertical"; + readonly Horizontal: "horizontal"; +}; +type Orientation = (typeof Orientation)[keyof typeof Orientation]; +declare const Direction: { + readonly LTR: "ltr"; + readonly RTL: "rtl"; +}; +type Direction = (typeof Direction)[keyof typeof Direction]; +interface RovingFocusGroupOptions { + /** + * The orientation of the group. + * Mainly so arrow navigation is done accordingly (left & right vs. up & down) + */ + orientation?: Orientation | undefined; + /** + * The direction of navigation between items. + */ + dir?: Direction | undefined; + /** + * Whether keyboard navigation should loop around + * @defaultValue false + */ + loop?: boolean | undefined; +} +interface RovingFocusGroupProps extends RovingFocusGroupImplProps { +} +declare const RovingFocusGroup: React.ForwardRefExoticComponent>; +type PrimitiveDivProps = React.ComponentPropsWithoutRef; +interface RovingFocusGroupImplProps extends Omit, RovingFocusGroupOptions { + currentTabStopId?: string | null | undefined; + defaultCurrentTabStopId?: string | undefined; + onCurrentTabStopIdChange?: ((tabStopId: string | null) => void) | undefined; + onEntryFocus?: ((event: Event) => void) | undefined; + preventScrollOnEntryFocus?: boolean | undefined; +} +type PrimitiveSpanProps = React.ComponentPropsWithoutRef; +interface RovingFocusItemProps extends Omit { + tabStopId?: string | undefined; + focusable?: boolean | undefined; + active?: boolean | undefined; + children?: React.ReactNode | ((props: { + hasTabStop: boolean; + isCurrentTabStop: boolean; + }) => React.ReactNode) | undefined; +} +declare const RovingFocusGroupItem: React.ForwardRefExoticComponent>; + +export { RovingFocusGroupItem as Item, RovingFocusGroup as Root, RovingFocusGroup, RovingFocusGroupItem, type RovingFocusGroupProps, type RovingFocusItemProps, createRovingFocusGroupScope }; diff --git a/e-commerce/node_modules/@radix-ui/react-roving-focus/dist/index.js b/e-commerce/node_modules/@radix-ui/react-roving-focus/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..3e7d36c508597ae5923ee7c88f86d69cf6235a73 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-roving-focus/dist/index.js @@ -0,0 +1,289 @@ +"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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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, { + Item: () => RovingFocusGroupItem, + Root: () => RovingFocusGroup, + RovingFocusGroup: () => RovingFocusGroup, + RovingFocusGroupItem: () => RovingFocusGroupItem, + createRovingFocusGroupScope: () => createRovingFocusGroupScope +}); +module.exports = __toCommonJS(index_exports); + +// src/roving-focus-group.tsx +var React = __toESM(require("react")); +var import_primitive = require("@radix-ui/primitive"); +var import_react_collection = require("@radix-ui/react-collection"); +var import_react_compose_refs = require("@radix-ui/react-compose-refs"); +var import_react_context = require("@radix-ui/react-context"); +var import_react_id = require("@radix-ui/react-id"); +var import_react_primitive = require("@radix-ui/react-primitive"); +var import_react_use_callback_ref = require("@radix-ui/react-use-callback-ref"); +var import_react_use_controllable_state = require("@radix-ui/react-use-controllable-state"); +var import_react_direction = require("@radix-ui/react-direction"); +var import_react_use_layout_effect = require("@radix-ui/react-use-layout-effect"); +var import_react_use_is_hydrated = require("@radix-ui/react-use-is-hydrated"); +var import_jsx_runtime = require("react/jsx-runtime"); +var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus"; +var EVENT_OPTIONS = { bubbles: false, cancelable: true }; +var GROUP_NAME = "RovingFocusGroup"; +var [Collection, useCollection, createCollectionScope] = (0, import_react_collection.createCollection)(GROUP_NAME); +var [createRovingFocusGroupContext, createRovingFocusGroupScope] = (0, import_react_context.createContextScope)( + GROUP_NAME, + [createCollectionScope] +); +var Orientation = { + Vertical: "vertical", + Horizontal: "horizontal" +}; +var Direction = { + LTR: "ltr", + RTL: "rtl" +}; +var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME); +var RovingFocusGroup = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function RovingFocusGroup2(props, forwardedRef) { + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) }); + }, "RovingFocusGroup") +); +var RovingFocusGroupImpl = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function RovingFocusGroupImpl2(props, forwardedRef) { + const { + __scopeRovingFocusGroup, + orientation, + loop = false, + dir, + currentTabStopId: currentTabStopIdProp, + defaultCurrentTabStopId, + onCurrentTabStopIdChange, + onEntryFocus, + preventScrollOnEntryFocus = false, + ...groupProps + } = props; + const ref = React.useRef(null); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref); + const direction = (0, import_react_direction.useDirection)(dir); + const [currentTabStopId, setCurrentTabStopId] = (0, import_react_use_controllable_state.useControllableState)({ + prop: currentTabStopIdProp, + defaultProp: defaultCurrentTabStopId ?? null, + onChange: onCurrentTabStopIdChange, + caller: GROUP_NAME + }); + const [isTabbingBackOut, setIsTabbingBackOut] = React.useState(false); + const handleEntryFocus = (0, import_react_use_callback_ref.useCallbackRef)(onEntryFocus); + const getItems = useCollection(__scopeRovingFocusGroup); + const isClickFocusRef = React.useRef(false); + const [focusableItemsCount, setFocusableItemsCount] = React.useState(0); + React.useEffect(() => { + const node = ref.current; + if (node) { + node.addEventListener(ENTRY_FOCUS, handleEntryFocus); + return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus); + } + }, [handleEntryFocus]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + RovingFocusProvider, + { + scope: __scopeRovingFocusGroup, + orientation, + dir: direction, + loop, + currentTabStopId, + onItemFocus: React.useCallback( + (tabStopId) => setCurrentTabStopId(tabStopId), + [setCurrentTabStopId] + ), + onItemShiftTab: React.useCallback(() => setIsTabbingBackOut(true), []), + onFocusableItemAdd: React.useCallback( + () => setFocusableItemsCount((prevCount) => prevCount + 1), + [] + ), + onFocusableItemRemove: React.useCallback( + () => setFocusableItemsCount((prevCount) => prevCount - 1), + [] + ), + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.div, + { + tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0, + "data-orientation": orientation, + ...groupProps, + ref: composedRefs, + style: { outline: "none", ...props.style }, + onMouseDown: (0, import_primitive.composeEventHandlers)(props.onMouseDown, () => { + isClickFocusRef.current = true; + }), + onFocus: (0, import_primitive.composeEventHandlers)(props.onFocus, (event) => { + const isKeyboardFocus = !isClickFocusRef.current; + if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) { + const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS); + event.currentTarget.dispatchEvent(entryFocusEvent); + if (!entryFocusEvent.defaultPrevented) { + const items = getItems().filter((item) => item.focusable); + const activeItem = items.find((item) => item.active); + const currentItem = items.find((item) => item.id === currentTabStopId); + const candidateItems = [activeItem, currentItem, ...items].filter( + Boolean + ); + const candidateNodes = candidateItems.map((item) => item.ref.current); + focusFirst(candidateNodes, preventScrollOnEntryFocus); + } + } + isClickFocusRef.current = false; + }), + onBlur: (0, import_primitive.composeEventHandlers)(props.onBlur, () => setIsTabbingBackOut(false)) + } + ) + } + ); +}, "RovingFocusGroupImpl")); +var ITEM_NAME = "RovingFocusGroupItem"; +var RovingFocusGroupItem = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function RovingFocusGroupItem2(props, forwardedRef) { + const { + __scopeRovingFocusGroup, + focusable = true, + active = false, + tabStopId, + children, + ...itemProps + } = props; + const autoId = (0, import_react_id.useId)(); + const id = tabStopId || autoId; + const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup); + const isCurrentTabStop = context.currentTabStopId === id; + const getItems = useCollection(__scopeRovingFocusGroup); + const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context; + const isHydrated = (0, import_react_use_is_hydrated.useIsHydrated)(); + (0, import_react_use_layout_effect.useLayoutEffect)(() => { + if (!isHydrated || !focusable) { + return; + } + onFocusableItemAdd(); + return () => onFocusableItemRemove(); + }, [isHydrated, focusable, onFocusableItemAdd, onFocusableItemRemove]); + React.useEffect(() => { + if (isHydrated || !focusable) { + return; + } + onFocusableItemAdd(); + return () => onFocusableItemRemove(); + }, [isHydrated, focusable, onFocusableItemAdd, onFocusableItemRemove]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + Collection.ItemSlot, + { + scope: __scopeRovingFocusGroup, + id, + focusable, + active, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.span, + { + tabIndex: isCurrentTabStop ? 0 : -1, + "data-orientation": context.orientation, + ...itemProps, + ref: forwardedRef, + onMouseDown: (0, import_primitive.composeEventHandlers)(props.onMouseDown, (event) => { + if (!focusable) event.preventDefault(); + else context.onItemFocus(id); + }), + onFocus: (0, import_primitive.composeEventHandlers)(props.onFocus, () => context.onItemFocus(id)), + onKeyDown: (0, import_primitive.composeEventHandlers)(props.onKeyDown, (event) => { + if (event.key === "Tab" && event.shiftKey) { + context.onItemShiftTab(); + return; + } + if (event.target !== event.currentTarget) return; + const focusIntent = getFocusIntent(event, context.orientation, context.dir); + if (focusIntent !== void 0) { + if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return; + event.preventDefault(); + const items = getItems().filter((item) => item.focusable); + let candidateNodes = items.map((item) => item.ref.current); + if (focusIntent === "last") candidateNodes.reverse(); + else if (focusIntent === "prev" || focusIntent === "next") { + if (focusIntent === "prev") candidateNodes.reverse(); + const currentIndex = candidateNodes.indexOf(event.currentTarget); + candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1); + } + setTimeout(() => focusFirst(candidateNodes)); + } + }), + children: typeof children === "function" ? children({ isCurrentTabStop, hasTabStop: currentTabStopId != null }) : children + } + ) + } + ); + }, "RovingFocusGroupItem") +); +var MAP_KEY_TO_FOCUS_INTENT = { + ArrowLeft: "prev", + ArrowUp: "prev", + ArrowRight: "next", + ArrowDown: "next", + PageUp: "first", + Home: "first", + PageDown: "last", + End: "last" +}; +function getDirectionAwareKey(key, dir) { + if (dir !== Direction.RTL) return key; + return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key; +} +__name(getDirectionAwareKey, "getDirectionAwareKey"); +function getFocusIntent(event, orientation, dir) { + const key = getDirectionAwareKey(event.key, dir); + if (orientation === Orientation.Vertical && ["ArrowLeft", "ArrowRight"].includes(key)) { + return void 0; + } + if (orientation === Orientation.Horizontal && ["ArrowUp", "ArrowDown"].includes(key)) { + return void 0; + } + return MAP_KEY_TO_FOCUS_INTENT[key]; +} +__name(getFocusIntent, "getFocusIntent"); +function focusFirst(candidates, preventScroll = false) { + const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement; + for (const candidate of candidates) { + if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return; + candidate.focus({ preventScroll }); + if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return; + } +} +__name(focusFirst, "focusFirst"); +function wrapArray(array, startIndex) { + return array.map((_, index) => array[(startIndex + index) % array.length]); +} +__name(wrapArray, "wrapArray"); +//# sourceMappingURL=index.js.map diff --git a/e-commerce/node_modules/@radix-ui/react-roving-focus/dist/index.js.map b/e-commerce/node_modules/@radix-ui/react-roving-focus/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e6f94f51df2b35910455daf6cd98b40af3fe3e21 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-roving-focus/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts", "../src/roving-focus-group.tsx"], + "sourcesContent": ["'use client';\nexport {\n createRovingFocusGroupScope,\n //\n RovingFocusGroup,\n RovingFocusGroupItem,\n //\n Root,\n Item,\n} from './roving-focus-group';\nexport type { RovingFocusGroupProps, RovingFocusItemProps } from './roving-focus-group';\n", "import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createCollection } from '@radix-ui/react-collection';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useId } from '@radix-ui/react-id';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useDirection } from '@radix-ui/react-direction';\nimport type { Scope } from '@radix-ui/react-context';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\n\nimport { useIsHydrated } from '@radix-ui/react-use-is-hydrated';\n\nconst ENTRY_FOCUS = 'rovingFocusGroup.onEntryFocus';\nconst EVENT_OPTIONS = { bubbles: false, cancelable: true };\n\n/* -------------------------------------------------------------------------------------------------\n * RovingFocusGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'RovingFocusGroup';\n\ntype ItemData = { id: string; focusable: boolean; active: boolean };\nconst [Collection, useCollection, createCollectionScope] = createCollection<\n HTMLSpanElement,\n ItemData\n>(GROUP_NAME);\n\ntype ScopedProps

= P & { __scopeRovingFocusGroup?: Scope | undefined };\nconst [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(\n GROUP_NAME,\n [createCollectionScope],\n);\n\nconst Orientation = {\n Vertical: 'vertical',\n Horizontal: 'horizontal',\n} as const;\n\nconst Direction = {\n LTR: 'ltr',\n RTL: 'rtl',\n} as const;\n\ntype Orientation = (typeof Orientation)[keyof typeof Orientation];\ntype Direction = (typeof Direction)[keyof typeof Direction];\n\ninterface RovingFocusGroupOptions {\n /**\n * The orientation of the group.\n * Mainly so arrow navigation is done accordingly (left & right vs. up & down)\n */\n orientation?: Orientation | undefined;\n /**\n * The direction of navigation between items.\n */\n dir?: Direction | undefined;\n /**\n * Whether keyboard navigation should loop around\n * @defaultValue false\n */\n loop?: boolean | undefined;\n}\n\ntype RovingContextValue = RovingFocusGroupOptions & {\n currentTabStopId: string | null;\n onItemFocus(tabStopId: string): void;\n onItemShiftTab(): void;\n onFocusableItemAdd(): void;\n onFocusableItemRemove(): void;\n};\n\nconst [RovingFocusProvider, useRovingFocusContext] =\n createRovingFocusGroupContext(GROUP_NAME);\n\ntype RovingFocusGroupElement = RovingFocusGroupImplElement;\ninterface RovingFocusGroupProps extends RovingFocusGroupImplProps {}\n\nconst RovingFocusGroup = /* @__PURE__ */ React.forwardRef<\n RovingFocusGroupElement,\n RovingFocusGroupProps\n>(\n // blank line to reduce diff noise\n function RovingFocusGroup(props: ScopedProps, forwardedRef) {\n return (\n \n \n \n \n \n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype RovingFocusGroupImplElement = React.ComponentRef;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef;\ninterface RovingFocusGroupImplProps\n extends Omit, RovingFocusGroupOptions {\n currentTabStopId?: string | null | undefined;\n defaultCurrentTabStopId?: string | undefined;\n onCurrentTabStopIdChange?: ((tabStopId: string | null) => void) | undefined;\n onEntryFocus?: ((event: Event) => void) | undefined;\n preventScrollOnEntryFocus?: boolean | undefined;\n}\n\nconst RovingFocusGroupImpl = /* @__PURE__ */ React.forwardRef<\n RovingFocusGroupImplElement,\n RovingFocusGroupImplProps\n>(function RovingFocusGroupImpl(props: ScopedProps, forwardedRef) {\n const {\n __scopeRovingFocusGroup,\n orientation,\n loop = false,\n dir,\n currentTabStopId: currentTabStopIdProp,\n defaultCurrentTabStopId,\n onCurrentTabStopIdChange,\n onEntryFocus,\n preventScrollOnEntryFocus = false,\n ...groupProps\n } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const direction = useDirection(dir);\n const [currentTabStopId, setCurrentTabStopId] = useControllableState({\n prop: currentTabStopIdProp,\n defaultProp: defaultCurrentTabStopId ?? null,\n onChange: onCurrentTabStopIdChange,\n caller: GROUP_NAME,\n });\n const [isTabbingBackOut, setIsTabbingBackOut] = React.useState(false);\n const handleEntryFocus = useCallbackRef(onEntryFocus);\n const getItems = useCollection(__scopeRovingFocusGroup);\n const isClickFocusRef = React.useRef(false);\n const [focusableItemsCount, setFocusableItemsCount] = React.useState(0);\n\n React.useEffect(() => {\n const node = ref.current;\n if (node) {\n node.addEventListener(ENTRY_FOCUS, handleEntryFocus);\n return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);\n }\n }, [handleEntryFocus]);\n\n return (\n setCurrentTabStopId(tabStopId),\n [setCurrentTabStopId],\n )}\n onItemShiftTab={React.useCallback(() => setIsTabbingBackOut(true), [])}\n onFocusableItemAdd={React.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount + 1),\n [],\n )}\n onFocusableItemRemove={React.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount - 1),\n [],\n )}\n >\n {\n isClickFocusRef.current = true;\n })}\n onFocus={composeEventHandlers(props.onFocus, (event) => {\n // We normally wouldn't need this check, because we already check\n // that the focus is on the current target and not bubbling to it.\n // We do this because Safari doesn't focus buttons when clicked, and\n // instead, the wrapper will get focused and not through a bubbling event.\n const isKeyboardFocus = !isClickFocusRef.current;\n\n if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {\n const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);\n event.currentTarget.dispatchEvent(entryFocusEvent);\n\n if (!entryFocusEvent.defaultPrevented) {\n const items = getItems().filter((item) => item.focusable);\n const activeItem = items.find((item) => item.active);\n const currentItem = items.find((item) => item.id === currentTabStopId);\n const candidateItems = [activeItem, currentItem, ...items].filter(\n Boolean,\n ) as typeof items;\n const candidateNodes = candidateItems.map((item) => item.ref.current!);\n focusFirst(candidateNodes, preventScrollOnEntryFocus);\n }\n }\n\n isClickFocusRef.current = false;\n })}\n onBlur={composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))}\n />\n \n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * RovingFocusGroupItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'RovingFocusGroupItem';\n\ntype RovingFocusItemElement = React.ComponentRef;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef;\ninterface RovingFocusItemProps extends Omit {\n tabStopId?: string | undefined;\n focusable?: boolean | undefined;\n active?: boolean | undefined;\n children?:\n | React.ReactNode\n | ((props: { hasTabStop: boolean; isCurrentTabStop: boolean }) => React.ReactNode)\n | undefined;\n}\n\nconst RovingFocusGroupItem = /* @__PURE__ */ React.forwardRef<\n RovingFocusItemElement,\n RovingFocusItemProps\n>(\n // blank line to reduce diff noise\n function RovingFocusGroupItem(props: ScopedProps, forwardedRef) {\n const {\n __scopeRovingFocusGroup,\n focusable = true,\n active = false,\n tabStopId,\n children,\n ...itemProps\n } = props;\n const autoId = useId();\n const id = tabStopId || autoId;\n const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);\n const isCurrentTabStop = context.currentTabStopId === id;\n const getItems = useCollection(__scopeRovingFocusGroup);\n\n const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context;\n\n const isHydrated = useIsHydrated();\n\n // The group's tab stop is driven by how many focusable items are registered\n // (`tabIndex={focusableItemsCount === 0 ? -1 : 0}`). Registering focusable\n // items happens in an effect, so the group renders with `tabIndex={-1}` and\n // only becomes tabbable once items have registered.\n //\n // Post-hydration (e.g. when a `Dialog`/`Popover` opens) we register in a\n // layout effect so the count (and therefore the group's `tabIndex`) is\n // resolved before paint. Otherwise focus libraries such as `FocusScope` can\n // read the stale `tabIndex={-1}` and skip the group when auto-focusing on\n // open.\n //\n // See: https://github.com/radix-ui/primitives/issues/3077\n useLayoutEffect(() => {\n if (!isHydrated || !focusable) {\n return;\n }\n\n onFocusableItemAdd();\n return () => onFocusableItemRemove();\n }, [isHydrated, focusable, onFocusableItemAdd, onFocusableItemRemove]);\n\n // Before hydration we register in a passive effect instead. Running a\n // layout effect during hydration would trigger a synchronous re-render\n // mid-hydration, so we keep the pre-hydration path asynchronous.\n React.useEffect(() => {\n if (isHydrated || !focusable) {\n return;\n }\n\n onFocusableItemAdd();\n return () => onFocusableItemRemove();\n }, [isHydrated, focusable, onFocusableItemAdd, onFocusableItemRemove]);\n\n return (\n \n {\n // We prevent focusing non-focusable items on `mousedown`.\n // Even though the item has tabIndex={-1}, that only means take it out of the tab order.\n if (!focusable) event.preventDefault();\n // Safari doesn't focus a button when clicked so we run our logic on mousedown also\n else context.onItemFocus(id);\n })}\n onFocus={composeEventHandlers(props.onFocus, () => context.onItemFocus(id))}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (event.key === 'Tab' && event.shiftKey) {\n context.onItemShiftTab();\n return;\n }\n\n if (event.target !== event.currentTarget) return;\n\n const focusIntent = getFocusIntent(event, context.orientation, context.dir);\n\n if (focusIntent !== undefined) {\n if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;\n event.preventDefault();\n const items = getItems().filter((item) => item.focusable);\n let candidateNodes = items.map((item) => item.ref.current!);\n\n if (focusIntent === 'last') candidateNodes.reverse();\n else if (focusIntent === 'prev' || focusIntent === 'next') {\n if (focusIntent === 'prev') candidateNodes.reverse();\n const currentIndex = candidateNodes.indexOf(event.currentTarget);\n candidateNodes = context.loop\n ? wrapArray(candidateNodes, currentIndex + 1)\n : candidateNodes.slice(currentIndex + 1);\n }\n\n /**\n * Imperative focus during keydown is risky so we prevent React's batching updates\n * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332\n */\n setTimeout(() => focusFirst(candidateNodes));\n }\n })}\n >\n {typeof children === 'function'\n ? children({ isCurrentTabStop, hasTabStop: currentTabStopId != null })\n : children}\n \n \n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst MAP_KEY_TO_FOCUS_INTENT: Record = {\n ArrowLeft: 'prev',\n ArrowUp: 'prev',\n ArrowRight: 'next',\n ArrowDown: 'next',\n PageUp: 'first',\n Home: 'first',\n PageDown: 'last',\n End: 'last',\n};\n\nfunction getDirectionAwareKey(key: string, dir?: Direction) {\n if (dir !== Direction.RTL) return key;\n return key === 'ArrowLeft' ? 'ArrowRight' : key === 'ArrowRight' ? 'ArrowLeft' : key;\n}\n\ntype FocusIntent = 'first' | 'last' | 'prev' | 'next';\n\nfunction getFocusIntent(event: React.KeyboardEvent, orientation?: Orientation, dir?: Direction) {\n const key = getDirectionAwareKey(event.key, dir);\n if (orientation === Orientation.Vertical && ['ArrowLeft', 'ArrowRight'].includes(key)) {\n return undefined;\n }\n if (orientation === Orientation.Horizontal && ['ArrowUp', 'ArrowDown'].includes(key)) {\n return undefined;\n }\n return MAP_KEY_TO_FOCUS_INTENT[key];\n}\n\nfunction focusFirst(candidates: HTMLElement[], preventScroll = false) {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates) {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus({ preventScroll });\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\n\n/**\n * Wraps an array around itself at a given start index\n * Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`\n */\nfunction wrapArray(array: T[], startIndex: number) {\n return array.map((_, index) => array[(startIndex + index) % array.length]!);\n}\n\nexport {\n createRovingFocusGroupScope,\n //\n RovingFocusGroup,\n RovingFocusGroupItem,\n //\n RovingFocusGroup as Root,\n RovingFocusGroupItem as Item,\n};\nexport type { RovingFocusGroupProps, RovingFocusItemProps };\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,uBAAqC;AACrC,8BAAiC;AACjC,gCAAgC;AAChC,2BAAmC;AACnC,sBAAsB;AACtB,6BAA0B;AAC1B,oCAA+B;AAC/B,0CAAqC;AACrC,6BAA6B;AAE7B,qCAAgC;AAEhC,mCAA8B;AA4EpB;AA1EV,IAAM,cAAc;AACpB,IAAM,gBAAgB,EAAE,SAAS,OAAO,YAAY,KAAK;AAMzD,IAAM,aAAa;AAGnB,IAAM,CAAC,YAAY,eAAe,qBAAqB,QAAI,0CAGzD,UAAU;AAGZ,IAAM,CAAC,+BAA+B,2BAA2B,QAAI;AAAA,EACnE;AAAA,EACA,CAAC,qBAAqB;AACxB;AAEA,IAAM,cAAc;AAAA,EAClB,UAAU;AAAA,EACV,YAAY;AACd;AAEA,IAAM,YAAY;AAAA,EAChB,KAAK;AAAA,EACL,KAAK;AACP;AA8BA,IAAM,CAAC,qBAAqB,qBAAqB,IAC/C,8BAAkD,UAAU;AAK9D,IAAM,mBAAmC,gBAAM;AAAA;AAAA,EAK7C,gCAASA,kBAAiB,OAA2C,c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AAAA,EACR,MAAM;AAAA,EACN,UAAU;AAAA,EACV,KAAK;AACP;AAEA,SAAS,qBAAqB,KAAa,KAAiB;AAC1D,MAAI,QAAQ,UAAU,IAAK,QAAO;AAClC,SAAO,QAAQ,cAAc,eAAe,QAAQ,eAAe,cAAc;AACnF;AAHS;AAOT,SAAS,eAAe,OAA4B,aAA2B,KAAiB;AAC9F,QAAM,MAAM,qBAAqB,MAAM,KAAK,GAAG;AAC/C,MAAI,gBAAgB,YAAY,YAAY,CAAC,aAAa,YAAY,EAAE,SAAS,GAAG,GAAG;AACrF,WAAO;AAAA,EACT;AACA,MAAI,gBAAgB,YAAY,cAAc,CAAC,WAAW,WAAW,EAAE,SAAS,GAAG,GAAG;AACpF,WAAO;AAAA,EACT;AACA,SAAO,wBAAwB,GAAG;AACpC;AATS;AAWT,SAAS,WAAW,YAA2B,gBAAgB,OAAO;AACpE,QAAM,6BAA6B,SAAS;AAC5C,aAAW,aAAa,YAAY;AAElC,QAAI,cAAc,2BAA4B;AAC9C,cAAU,MAAM,EAAE,cAAc,CAAC;AACjC,QAAI,SAAS,kBAAkB,2BAA4B;AAAA,EAC7D;AACF;AARS;AAcT,SAAS,UAAa,OAAY,YAAoB;AACpD,SAAO,MAAM,IAAO,CAAC,GAAG,UAAU,OAAO,aAAa,SAAS,MAAM,MAAM,CAAE;AAC/E;AAFS;", + "names": ["RovingFocusGroup", "RovingFocusGroupImpl", "RovingFocusGroupItem"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-roving-focus/dist/index.mjs b/e-commerce/node_modules/@radix-ui/react-roving-focus/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4ddf08025f14b83c4ebaa00d3fc75359f1d7b64b --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-roving-focus/dist/index.mjs @@ -0,0 +1,258 @@ +"use client"; +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// src/roving-focus-group.tsx +import * as React from "react"; +import { composeEventHandlers } from "@radix-ui/primitive"; +import { createCollection } from "@radix-ui/react-collection"; +import { useComposedRefs } from "@radix-ui/react-compose-refs"; +import { createContextScope } from "@radix-ui/react-context"; +import { useId } from "@radix-ui/react-id"; +import { Primitive } from "@radix-ui/react-primitive"; +import { useCallbackRef } from "@radix-ui/react-use-callback-ref"; +import { useControllableState } from "@radix-ui/react-use-controllable-state"; +import { useDirection } from "@radix-ui/react-direction"; +import { useLayoutEffect } from "@radix-ui/react-use-layout-effect"; +import { useIsHydrated } from "@radix-ui/react-use-is-hydrated"; +import { jsx } from "react/jsx-runtime"; +var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus"; +var EVENT_OPTIONS = { bubbles: false, cancelable: true }; +var GROUP_NAME = "RovingFocusGroup"; +var [Collection, useCollection, createCollectionScope] = createCollection(GROUP_NAME); +var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope( + GROUP_NAME, + [createCollectionScope] +); +var Orientation = { + Vertical: "vertical", + Horizontal: "horizontal" +}; +var Direction = { + LTR: "ltr", + RTL: "rtl" +}; +var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME); +var RovingFocusGroup = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function RovingFocusGroup2(props, forwardedRef) { + return /* @__PURE__ */ jsx(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) }); + }, "RovingFocusGroup") +); +var RovingFocusGroupImpl = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function RovingFocusGroupImpl2(props, forwardedRef) { + const { + __scopeRovingFocusGroup, + orientation, + loop = false, + dir, + currentTabStopId: currentTabStopIdProp, + defaultCurrentTabStopId, + onCurrentTabStopIdChange, + onEntryFocus, + preventScrollOnEntryFocus = false, + ...groupProps + } = props; + const ref = React.useRef(null); + const composedRefs = useComposedRefs(forwardedRef, ref); + const direction = useDirection(dir); + const [currentTabStopId, setCurrentTabStopId] = useControllableState({ + prop: currentTabStopIdProp, + defaultProp: defaultCurrentTabStopId ?? null, + onChange: onCurrentTabStopIdChange, + caller: GROUP_NAME + }); + const [isTabbingBackOut, setIsTabbingBackOut] = React.useState(false); + const handleEntryFocus = useCallbackRef(onEntryFocus); + const getItems = useCollection(__scopeRovingFocusGroup); + const isClickFocusRef = React.useRef(false); + const [focusableItemsCount, setFocusableItemsCount] = React.useState(0); + React.useEffect(() => { + const node = ref.current; + if (node) { + node.addEventListener(ENTRY_FOCUS, handleEntryFocus); + return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus); + } + }, [handleEntryFocus]); + return /* @__PURE__ */ jsx( + RovingFocusProvider, + { + scope: __scopeRovingFocusGroup, + orientation, + dir: direction, + loop, + currentTabStopId, + onItemFocus: React.useCallback( + (tabStopId) => setCurrentTabStopId(tabStopId), + [setCurrentTabStopId] + ), + onItemShiftTab: React.useCallback(() => setIsTabbingBackOut(true), []), + onFocusableItemAdd: React.useCallback( + () => setFocusableItemsCount((prevCount) => prevCount + 1), + [] + ), + onFocusableItemRemove: React.useCallback( + () => setFocusableItemsCount((prevCount) => prevCount - 1), + [] + ), + children: /* @__PURE__ */ jsx( + Primitive.div, + { + tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0, + "data-orientation": orientation, + ...groupProps, + ref: composedRefs, + style: { outline: "none", ...props.style }, + onMouseDown: composeEventHandlers(props.onMouseDown, () => { + isClickFocusRef.current = true; + }), + onFocus: composeEventHandlers(props.onFocus, (event) => { + const isKeyboardFocus = !isClickFocusRef.current; + if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) { + const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS); + event.currentTarget.dispatchEvent(entryFocusEvent); + if (!entryFocusEvent.defaultPrevented) { + const items = getItems().filter((item) => item.focusable); + const activeItem = items.find((item) => item.active); + const currentItem = items.find((item) => item.id === currentTabStopId); + const candidateItems = [activeItem, currentItem, ...items].filter( + Boolean + ); + const candidateNodes = candidateItems.map((item) => item.ref.current); + focusFirst(candidateNodes, preventScrollOnEntryFocus); + } + } + isClickFocusRef.current = false; + }), + onBlur: composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false)) + } + ) + } + ); +}, "RovingFocusGroupImpl")); +var ITEM_NAME = "RovingFocusGroupItem"; +var RovingFocusGroupItem = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function RovingFocusGroupItem2(props, forwardedRef) { + const { + __scopeRovingFocusGroup, + focusable = true, + active = false, + tabStopId, + children, + ...itemProps + } = props; + const autoId = useId(); + const id = tabStopId || autoId; + const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup); + const isCurrentTabStop = context.currentTabStopId === id; + const getItems = useCollection(__scopeRovingFocusGroup); + const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context; + const isHydrated = useIsHydrated(); + useLayoutEffect(() => { + if (!isHydrated || !focusable) { + return; + } + onFocusableItemAdd(); + return () => onFocusableItemRemove(); + }, [isHydrated, focusable, onFocusableItemAdd, onFocusableItemRemove]); + React.useEffect(() => { + if (isHydrated || !focusable) { + return; + } + onFocusableItemAdd(); + return () => onFocusableItemRemove(); + }, [isHydrated, focusable, onFocusableItemAdd, onFocusableItemRemove]); + return /* @__PURE__ */ jsx( + Collection.ItemSlot, + { + scope: __scopeRovingFocusGroup, + id, + focusable, + active, + children: /* @__PURE__ */ jsx( + Primitive.span, + { + tabIndex: isCurrentTabStop ? 0 : -1, + "data-orientation": context.orientation, + ...itemProps, + ref: forwardedRef, + onMouseDown: composeEventHandlers(props.onMouseDown, (event) => { + if (!focusable) event.preventDefault(); + else context.onItemFocus(id); + }), + onFocus: composeEventHandlers(props.onFocus, () => context.onItemFocus(id)), + onKeyDown: composeEventHandlers(props.onKeyDown, (event) => { + if (event.key === "Tab" && event.shiftKey) { + context.onItemShiftTab(); + return; + } + if (event.target !== event.currentTarget) return; + const focusIntent = getFocusIntent(event, context.orientation, context.dir); + if (focusIntent !== void 0) { + if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return; + event.preventDefault(); + const items = getItems().filter((item) => item.focusable); + let candidateNodes = items.map((item) => item.ref.current); + if (focusIntent === "last") candidateNodes.reverse(); + else if (focusIntent === "prev" || focusIntent === "next") { + if (focusIntent === "prev") candidateNodes.reverse(); + const currentIndex = candidateNodes.indexOf(event.currentTarget); + candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1); + } + setTimeout(() => focusFirst(candidateNodes)); + } + }), + children: typeof children === "function" ? children({ isCurrentTabStop, hasTabStop: currentTabStopId != null }) : children + } + ) + } + ); + }, "RovingFocusGroupItem") +); +var MAP_KEY_TO_FOCUS_INTENT = { + ArrowLeft: "prev", + ArrowUp: "prev", + ArrowRight: "next", + ArrowDown: "next", + PageUp: "first", + Home: "first", + PageDown: "last", + End: "last" +}; +function getDirectionAwareKey(key, dir) { + if (dir !== Direction.RTL) return key; + return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key; +} +__name(getDirectionAwareKey, "getDirectionAwareKey"); +function getFocusIntent(event, orientation, dir) { + const key = getDirectionAwareKey(event.key, dir); + if (orientation === Orientation.Vertical && ["ArrowLeft", "ArrowRight"].includes(key)) { + return void 0; + } + if (orientation === Orientation.Horizontal && ["ArrowUp", "ArrowDown"].includes(key)) { + return void 0; + } + return MAP_KEY_TO_FOCUS_INTENT[key]; +} +__name(getFocusIntent, "getFocusIntent"); +function focusFirst(candidates, preventScroll = false) { + const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement; + for (const candidate of candidates) { + if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return; + candidate.focus({ preventScroll }); + if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return; + } +} +__name(focusFirst, "focusFirst"); +function wrapArray(array, startIndex) { + return array.map((_, index) => array[(startIndex + index) % array.length]); +} +__name(wrapArray, "wrapArray"); +export { + RovingFocusGroupItem as Item, + RovingFocusGroup as Root, + RovingFocusGroup, + RovingFocusGroupItem, + createRovingFocusGroupScope +}; +//# sourceMappingURL=index.mjs.map diff --git a/e-commerce/node_modules/@radix-ui/react-roving-focus/dist/index.mjs.map b/e-commerce/node_modules/@radix-ui/react-roving-focus/dist/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..5a6413b0d65ac84d4da15d9efc15425ea8edc609 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-roving-focus/dist/index.mjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/roving-focus-group.tsx"], + "sourcesContent": ["import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createCollection } from '@radix-ui/react-collection';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useId } from '@radix-ui/react-id';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useDirection } from '@radix-ui/react-direction';\nimport type { Scope } from '@radix-ui/react-context';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\n\nimport { useIsHydrated } from '@radix-ui/react-use-is-hydrated';\n\nconst ENTRY_FOCUS = 'rovingFocusGroup.onEntryFocus';\nconst EVENT_OPTIONS = { bubbles: false, cancelable: true };\n\n/* -------------------------------------------------------------------------------------------------\n * RovingFocusGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'RovingFocusGroup';\n\ntype ItemData = { id: string; focusable: boolean; active: boolean };\nconst [Collection, useCollection, createCollectionScope] = createCollection<\n HTMLSpanElement,\n ItemData\n>(GROUP_NAME);\n\ntype ScopedProps

= P & { __scopeRovingFocusGroup?: Scope | undefined };\nconst [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(\n GROUP_NAME,\n [createCollectionScope],\n);\n\nconst Orientation = {\n Vertical: 'vertical',\n Horizontal: 'horizontal',\n} as const;\n\nconst Direction = {\n LTR: 'ltr',\n RTL: 'rtl',\n} as const;\n\ntype Orientation = (typeof Orientation)[keyof typeof Orientation];\ntype Direction = (typeof Direction)[keyof typeof Direction];\n\ninterface RovingFocusGroupOptions {\n /**\n * The orientation of the group.\n * Mainly so arrow navigation is done accordingly (left & right vs. up & down)\n */\n orientation?: Orientation | undefined;\n /**\n * The direction of navigation between items.\n */\n dir?: Direction | undefined;\n /**\n * Whether keyboard navigation should loop around\n * @defaultValue false\n */\n loop?: boolean | undefined;\n}\n\ntype RovingContextValue = RovingFocusGroupOptions & {\n currentTabStopId: string | null;\n onItemFocus(tabStopId: string): void;\n onItemShiftTab(): void;\n onFocusableItemAdd(): void;\n onFocusableItemRemove(): void;\n};\n\nconst [RovingFocusProvider, useRovingFocusContext] =\n createRovingFocusGroupContext(GROUP_NAME);\n\ntype RovingFocusGroupElement = RovingFocusGroupImplElement;\ninterface RovingFocusGroupProps extends RovingFocusGroupImplProps {}\n\nconst RovingFocusGroup = /* @__PURE__ */ React.forwardRef<\n RovingFocusGroupElement,\n RovingFocusGroupProps\n>(\n // blank line to reduce diff noise\n function RovingFocusGroup(props: ScopedProps, forwardedRef) {\n return (\n \n \n \n \n \n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype RovingFocusGroupImplElement = React.ComponentRef;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef;\ninterface RovingFocusGroupImplProps\n extends Omit, RovingFocusGroupOptions {\n currentTabStopId?: string | null | undefined;\n defaultCurrentTabStopId?: string | undefined;\n onCurrentTabStopIdChange?: ((tabStopId: string | null) => void) | undefined;\n onEntryFocus?: ((event: Event) => void) | undefined;\n preventScrollOnEntryFocus?: boolean | undefined;\n}\n\nconst RovingFocusGroupImpl = /* @__PURE__ */ React.forwardRef<\n RovingFocusGroupImplElement,\n RovingFocusGroupImplProps\n>(function RovingFocusGroupImpl(props: ScopedProps, forwardedRef) {\n const {\n __scopeRovingFocusGroup,\n orientation,\n loop = false,\n dir,\n currentTabStopId: currentTabStopIdProp,\n defaultCurrentTabStopId,\n onCurrentTabStopIdChange,\n onEntryFocus,\n preventScrollOnEntryFocus = false,\n ...groupProps\n } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const direction = useDirection(dir);\n const [currentTabStopId, setCurrentTabStopId] = useControllableState({\n prop: currentTabStopIdProp,\n defaultProp: defaultCurrentTabStopId ?? null,\n onChange: onCurrentTabStopIdChange,\n caller: GROUP_NAME,\n });\n const [isTabbingBackOut, setIsTabbingBackOut] = React.useState(false);\n const handleEntryFocus = useCallbackRef(onEntryFocus);\n const getItems = useCollection(__scopeRovingFocusGroup);\n const isClickFocusRef = React.useRef(false);\n const [focusableItemsCount, setFocusableItemsCount] = React.useState(0);\n\n React.useEffect(() => {\n const node = ref.current;\n if (node) {\n node.addEventListener(ENTRY_FOCUS, handleEntryFocus);\n return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);\n }\n }, [handleEntryFocus]);\n\n return (\n setCurrentTabStopId(tabStopId),\n [setCurrentTabStopId],\n )}\n onItemShiftTab={React.useCallback(() => setIsTabbingBackOut(true), [])}\n onFocusableItemAdd={React.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount + 1),\n [],\n )}\n onFocusableItemRemove={React.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount - 1),\n [],\n )}\n >\n {\n isClickFocusRef.current = true;\n })}\n onFocus={composeEventHandlers(props.onFocus, (event) => {\n // We normally wouldn't need this check, because we already check\n // that the focus is on the current target and not bubbling to it.\n // We do this because Safari doesn't focus buttons when clicked, and\n // instead, the wrapper will get focused and not through a bubbling event.\n const isKeyboardFocus = !isClickFocusRef.current;\n\n if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {\n const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);\n event.currentTarget.dispatchEvent(entryFocusEvent);\n\n if (!entryFocusEvent.defaultPrevented) {\n const items = getItems().filter((item) => item.focusable);\n const activeItem = items.find((item) => item.active);\n const currentItem = items.find((item) => item.id === currentTabStopId);\n const candidateItems = [activeItem, currentItem, ...items].filter(\n Boolean,\n ) as typeof items;\n const candidateNodes = candidateItems.map((item) => item.ref.current!);\n focusFirst(candidateNodes, preventScrollOnEntryFocus);\n }\n }\n\n isClickFocusRef.current = false;\n })}\n onBlur={composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))}\n />\n \n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * RovingFocusGroupItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'RovingFocusGroupItem';\n\ntype RovingFocusItemElement = React.ComponentRef;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef;\ninterface RovingFocusItemProps extends Omit {\n tabStopId?: string | undefined;\n focusable?: boolean | undefined;\n active?: boolean | undefined;\n children?:\n | React.ReactNode\n | ((props: { hasTabStop: boolean; isCurrentTabStop: boolean }) => React.ReactNode)\n | undefined;\n}\n\nconst RovingFocusGroupItem = /* @__PURE__ */ React.forwardRef<\n RovingFocusItemElement,\n RovingFocusItemProps\n>(\n // blank line to reduce diff noise\n function RovingFocusGroupItem(props: ScopedProps, forwardedRef) {\n const {\n __scopeRovingFocusGroup,\n focusable = true,\n active = false,\n tabStopId,\n children,\n ...itemProps\n } = props;\n const autoId = useId();\n const id = tabStopId || autoId;\n const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);\n const isCurrentTabStop = context.currentTabStopId === id;\n const getItems = useCollection(__scopeRovingFocusGroup);\n\n const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context;\n\n const isHydrated = useIsHydrated();\n\n // The group's tab stop is driven by how many focusable items are registered\n // (`tabIndex={focusableItemsCount === 0 ? -1 : 0}`). Registering focusable\n // items happens in an effect, so the group renders with `tabIndex={-1}` and\n // only becomes tabbable once items have registered.\n //\n // Post-hydration (e.g. when a `Dialog`/`Popover` opens) we register in a\n // layout effect so the count (and therefore the group's `tabIndex`) is\n // resolved before paint. Otherwise focus libraries such as `FocusScope` can\n // read the stale `tabIndex={-1}` and skip the group when auto-focusing on\n // open.\n //\n // See: https://github.com/radix-ui/primitives/issues/3077\n useLayoutEffect(() => {\n if (!isHydrated || !focusable) {\n return;\n }\n\n onFocusableItemAdd();\n return () => onFocusableItemRemove();\n }, [isHydrated, focusable, onFocusableItemAdd, onFocusableItemRemove]);\n\n // Before hydration we register in a passive effect instead. Running a\n // layout effect during hydration would trigger a synchronous re-render\n // mid-hydration, so we keep the pre-hydration path asynchronous.\n React.useEffect(() => {\n if (isHydrated || !focusable) {\n return;\n }\n\n onFocusableItemAdd();\n return () => onFocusableItemRemove();\n }, [isHydrated, focusable, onFocusableItemAdd, onFocusableItemRemove]);\n\n return (\n \n {\n // We prevent focusing non-focusable items on `mousedown`.\n // Even though the item has tabIndex={-1}, that only means take it out of the tab order.\n if (!focusable) event.preventDefault();\n // Safari doesn't focus a button when clicked so we run our logic on mousedown also\n else context.onItemFocus(id);\n })}\n onFocus={composeEventHandlers(props.onFocus, () => context.onItemFocus(id))}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (event.key === 'Tab' && event.shiftKey) {\n context.onItemShiftTab();\n return;\n }\n\n if (event.target !== event.currentTarget) return;\n\n const focusIntent = getFocusIntent(event, context.orientation, context.dir);\n\n if (focusIntent !== undefined) {\n if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;\n event.preventDefault();\n const items = getItems().filter((item) => item.focusable);\n let candidateNodes = items.map((item) => item.ref.current!);\n\n if (focusIntent === 'last') candidateNodes.reverse();\n else if (focusIntent === 'prev' || focusIntent === 'next') {\n if (focusIntent === 'prev') candidateNodes.reverse();\n const currentIndex = candidateNodes.indexOf(event.currentTarget);\n candidateNodes = context.loop\n ? wrapArray(candidateNodes, currentIndex + 1)\n : candidateNodes.slice(currentIndex + 1);\n }\n\n /**\n * Imperative focus during keydown is risky so we prevent React's batching updates\n * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332\n */\n setTimeout(() => focusFirst(candidateNodes));\n }\n })}\n >\n {typeof children === 'function'\n ? children({ isCurrentTabStop, hasTabStop: currentTabStopId != null })\n : children}\n \n \n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst MAP_KEY_TO_FOCUS_INTENT: Record = {\n ArrowLeft: 'prev',\n ArrowUp: 'prev',\n ArrowRight: 'next',\n ArrowDown: 'next',\n PageUp: 'first',\n Home: 'first',\n PageDown: 'last',\n End: 'last',\n};\n\nfunction getDirectionAwareKey(key: string, dir?: Direction) {\n if (dir !== Direction.RTL) return key;\n return key === 'ArrowLeft' ? 'ArrowRight' : key === 'ArrowRight' ? 'ArrowLeft' : key;\n}\n\ntype FocusIntent = 'first' | 'last' | 'prev' | 'next';\n\nfunction getFocusIntent(event: React.KeyboardEvent, orientation?: Orientation, dir?: Direction) {\n const key = getDirectionAwareKey(event.key, dir);\n if (orientation === Orientation.Vertical && ['ArrowLeft', 'ArrowRight'].includes(key)) {\n return undefined;\n }\n if (orientation === Orientation.Horizontal && ['ArrowUp', 'ArrowDown'].includes(key)) {\n return undefined;\n }\n return MAP_KEY_TO_FOCUS_INTENT[key];\n}\n\nfunction focusFirst(candidates: HTMLElement[], preventScroll = false) {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates) {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus({ preventScroll });\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\n\n/**\n * Wraps an array around itself at a given start index\n * Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`\n */\nfunction wrapArray(array: T[], startIndex: number) {\n return array.map((_, index) => array[(startIndex + index) % array.length]!);\n}\n\nexport {\n createRovingFocusGroupScope,\n //\n RovingFocusGroup,\n RovingFocusGroupItem,\n //\n RovingFocusGroup as Root,\n RovingFocusGroupItem as Item,\n};\nexport type { RovingFocusGroupProps, RovingFocusItemProps };\n"], + "mappings": ";;;;;AAAA,YAAY,WAAW;AACvB,SAAS,4BAA4B;AACrC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,0BAA0B;AACnC,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAC/B,SAAS,4BAA4B;AACrC,SAAS,oBAAoB;AAE7B,SAAS,uBAAuB;AAEhC,SAAS,qBAAqB;AA4EpB;AA1EV,IAAM,cAAc;AACpB,IAAM,gBAAgB,EAAE,SAAS,OAAO,YAAY,KAAK;AAMzD,IAAM,aAAa;AAGnB,IAAM,CAAC,YAAY,eAAe,qBAAqB,IAAI,iBAGzD,UAAU;AAGZ,IAAM,CAAC,+BAA+B,2BAA2B,IAAI;AAAA,EACnE;AAAA,EACA,CAAC,qBAAqB;AACxB;AAEA,IAAM,cAAc;AAAA,EAClB,UAAU;AAAA,EACV,YAAY;AACd;AAEA,IAAM,YAAY;AAAA,EAChB,KAAK;AAAA,EACL,KAAK;AACP;AA8BA,IAAM,CAAC,qBAAqB,qBAAqB,IAC/C,8BAAkD,UAAU;AAK9D,IAAM,mBAAmC,gBAAM;AAAA;AAAA,EAK7C,gCAASA,kBAAiB,OAA2C,cAAc;AACjF,WACE,oBAAC,WAAW,UAAX,EAAoB,OAAO,MAAM,yBAChC,8BAAC,WAAW,MAAX,EAAgB,OAAO,MAAM,yBAC5B,8BAAC,wBAAsB,GAAG,OAAO,KAAK,cAAc,GACtD,GACF;AAAA,EAEJ,GARA;AASF;AAeA,IAAM,uBAAuC,gBAAM,iBAGjD,gCAASC,sBAAqB,OAA+C,cAAc;AAC3F,QAAM;AAAA,IACJ;AAAA,I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AgB,YAAY,YAAY,CAAC,aAAa,YAAY,EAAE,SAAS,GAAG,GAAG;AACrF,WAAO;AAAA,EACT;AACA,MAAI,gBAAgB,YAAY,cAAc,CAAC,WAAW,WAAW,EAAE,SAAS,GAAG,GAAG;AACpF,WAAO;AAAA,EACT;AACA,SAAO,wBAAwB,GAAG;AACpC;AATS;AAWT,SAAS,WAAW,YAA2B,gBAAgB,OAAO;AACpE,QAAM,6BAA6B,SAAS;AAC5C,aAAW,aAAa,YAAY;AAElC,QAAI,cAAc,2BAA4B;AAC9C,cAAU,MAAM,EAAE,cAAc,CAAC;AACjC,QAAI,SAAS,kBAAkB,2BAA4B;AAAA,EAC7D;AACF;AARS;AAcT,SAAS,UAAa,OAAY,YAAoB;AACpD,SAAO,MAAM,IAAO,CAAC,GAAG,UAAU,OAAO,aAAa,SAAS,MAAM,MAAM,CAAE;AAC/E;AAFS;", + "names": ["RovingFocusGroup", "RovingFocusGroupImpl", "RovingFocusGroupItem"] +} diff --git a/e-commerce/node_modules/@radix-ui/react-roving-focus/package.json b/e-commerce/node_modules/@radix-ui/react-roving-focus/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3a8c185586ba0582f13d490b46c82af865cf29ee --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-roving-focus/package.json @@ -0,0 +1,78 @@ +{ + "name": "@radix-ui/react-roving-focus", + "version": "1.2.0", + "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.2.0", + "@radix-ui/react-compose-refs": "1.1.5", + "@radix-ui/react-context": "1.3.0", + "@radix-ui/react-direction": "1.2.0", + "@radix-ui/react-collection": "1.2.0", + "@radix-ui/react-id": "1.1.4", + "@radix-ui/react-primitive": "2.2.0", + "@radix-ui/react-use-callback-ref": "1.1.5", + "@radix-ui/react-use-controllable-state": "1.3.0", + "@radix-ui/react-use-is-hydrated": "0.1.3", + "@radix-ui/react-use-layout-effect": "1.1.4" + }, + "devDependencies": { + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "react": "^19.3.0", + "react-dom": "^19.3.0", + "typescript": "^5.9.3", + "@repo/typescript-config": "0.0.0", + "@repo/builder": "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", + "directory": "packages/react/roving-focus" + }, + "bugs": { + "url": "https://github.com/radix-ui/primitives/issues" + }, + "scripts": { + "lint": "oxlint --max-warnings 0 src", + "clean": "rm -rf dist", + "reset": "rm -rf dist node_modules", + "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" + } + } + } +} \ No newline at end of file diff --git a/e-commerce/node_modules/@radix-ui/react-scroll-area/LICENSE b/e-commerce/node_modules/@radix-ui/react-scroll-area/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a18858fb7b014098cba85703e66609be66a26ef5 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-scroll-area/LICENSE @@ -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. diff --git a/e-commerce/node_modules/@radix-ui/react-scroll-area/README.md b/e-commerce/node_modules/@radix-ui/react-scroll-area/README.md new file mode 100644 index 0000000000000000000000000000000000000000..44cee383609ad358f2239e381f15c5beb548e880 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-scroll-area/README.md @@ -0,0 +1,3 @@ +# `react-scroll-area` + +View docs [here](https://radix-ui.com/primitives/docs/components/scroll-area). diff --git a/e-commerce/node_modules/@radix-ui/react-scroll-area/dist/index.d.mts b/e-commerce/node_modules/@radix-ui/react-scroll-area/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..838db8cffd8fcf31f0cb84c20723d452d15b1e41 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-scroll-area/dist/index.d.mts @@ -0,0 +1,146 @@ +import * as _radix_ui_react_context from '@radix-ui/react-context'; +import * as React from 'react'; +import { Primitive } from '@radix-ui/react-primitive'; + +declare const ScrollAreaType: { + readonly Auto: "auto"; + readonly Always: "always"; + readonly Scroll: "scroll"; + readonly Hover: "hover"; +}; +type ScrollAreaType = (typeof ScrollAreaType)[keyof typeof ScrollAreaType]; +declare const Orientation: { + readonly Vertical: "vertical"; + readonly Horizontal: "horizontal"; +}; +type Orientation = (typeof Orientation)[keyof typeof Orientation]; +declare const Direction: { + readonly LTR: "ltr"; + readonly RTL: "rtl"; +}; +type Direction = (typeof Direction)[keyof typeof Direction]; +type Sizes = { + content: number; + viewport: number; + scrollbar: { + size: number; + paddingStart: number; + paddingEnd: number; + }; +}; +declare const createScrollAreaScope: _radix_ui_react_context.CreateScope; +type ScrollAreaContextValue = { + type: ScrollAreaType; + dir: Direction; + scrollHideDelay: number; + scrollArea: ScrollAreaElement | null; + viewport: ScrollAreaViewportElement | null; + onViewportChange(viewport: ScrollAreaViewportElement | null): void; + content: HTMLDivElement | null; + onContentChange(content: HTMLDivElement): void; + scrollbarX: ScrollAreaScrollbarElement | null; + onScrollbarXChange(scrollbar: ScrollAreaScrollbarElement | null): void; + scrollbarXEnabled: boolean; + onScrollbarXEnabledChange(rendered: boolean): void; + scrollbarY: ScrollAreaScrollbarElement | null; + onScrollbarYChange(scrollbar: ScrollAreaScrollbarElement | null): void; + scrollbarYEnabled: boolean; + onScrollbarYEnabledChange(rendered: boolean): void; + onCornerWidthChange(width: number): void; + onCornerHeightChange(height: number): void; +}; +type ScrollAreaElement = React.ComponentRef; +type PrimitiveDivProps = React.ComponentPropsWithoutRef; +interface ScrollAreaProps extends PrimitiveDivProps { + type?: ScrollAreaContextValue['type'] | undefined; + dir?: ScrollAreaContextValue['dir'] | undefined; + scrollHideDelay?: number | undefined; +} +declare const ScrollArea: React.ForwardRefExoticComponent>; +type ScrollAreaViewportElement = React.ComponentRef; +interface ScrollAreaViewportProps extends PrimitiveDivProps { + nonce?: string | undefined; + /** + * Disables implicit rendering of an additional wrapper element that measures + * the content size. When `true`, a child `` must be + * rendered as a direct child of the viewport. + * + * Implicit rendering of the content element will be removed in the next major + * release. + */ + disableImplicitContentElement?: boolean | undefined; +} +declare const ScrollAreaViewport: React.ForwardRefExoticComponent>; +interface ScrollAreaContentProps extends PrimitiveDivProps { +} +declare const ScrollAreaContent: React.ForwardRefExoticComponent>; +type ScrollAreaScrollbarElement = ScrollAreaScrollbarVisibleElement; +interface ScrollAreaScrollbarProps extends ScrollAreaScrollbarVisibleProps { + forceMount?: true | undefined; +} +declare const ScrollAreaScrollbar: React.ForwardRefExoticComponent>; +type ScrollAreaScrollbarVisibleElement = ScrollAreaScrollbarAxisElement; +interface ScrollAreaScrollbarVisibleProps extends Omit { + orientation?: Orientation | undefined; +} +type ScrollAreaScrollbarAxisPrivateProps = { + hasThumb: boolean; + sizes: Sizes; + onSizesChange(sizes: Sizes): void; + onThumbChange(thumb: ScrollAreaThumbElement | null): void; + onThumbPointerDown(pointerPos: number): void; + onThumbPointerUp(): void; + onThumbPositionChange(): void; + onWheelScroll(scrollPos: number): void; + onDragScroll(pointerPos: number): void; +}; +type ScrollAreaScrollbarAxisElement = ScrollAreaScrollbarImplElement; +interface ScrollAreaScrollbarAxisProps extends Omit, ScrollAreaScrollbarAxisPrivateProps { +} +type ScrollbarContext = { + hasThumb: boolean; + scrollbar: ScrollAreaScrollbarElement | null; + onThumbChange(thumb: ScrollAreaThumbElement | null): void; + onThumbPointerUp(): void; + onThumbPointerDown(pointerPos: { + x: number; + y: number; + }): void; + onThumbPositionChange(): void; +}; +type ScrollAreaScrollbarImplElement = React.ComponentRef; +type ScrollAreaScrollbarImplPrivateProps = { + sizes: Sizes; + hasThumb: boolean; + onThumbChange: ScrollbarContext['onThumbChange']; + onThumbPointerUp: ScrollbarContext['onThumbPointerUp']; + onThumbPointerDown: ScrollbarContext['onThumbPointerDown']; + onThumbPositionChange: ScrollbarContext['onThumbPositionChange']; + onWheelScroll(event: WheelEvent, maxScrollPos: number): void; + onDragScroll(pointerPos: { + x: number; + y: number; + }): void; + onResize(): void; +}; +interface ScrollAreaScrollbarImplProps extends Omit, ScrollAreaScrollbarImplPrivateProps { +} +type ScrollAreaThumbElement = ScrollAreaThumbImplElement; +interface ScrollAreaThumbProps extends ScrollAreaThumbImplProps { + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const ScrollAreaThumb: React.ForwardRefExoticComponent>; +type ScrollAreaThumbImplElement = React.ComponentRef; +interface ScrollAreaThumbImplProps extends PrimitiveDivProps { +} +interface ScrollAreaCornerProps extends ScrollAreaCornerImplProps { +} +declare const ScrollAreaCorner: React.ForwardRefExoticComponent>; +interface ScrollAreaCornerImplProps extends PrimitiveDivProps { +} + +export { ScrollAreaContent as Content, ScrollAreaCorner as Corner, ScrollArea as Root, ScrollArea, ScrollAreaContent, type ScrollAreaContentProps, ScrollAreaCorner, type ScrollAreaCornerProps, type ScrollAreaProps, ScrollAreaScrollbar, type ScrollAreaScrollbarProps, ScrollAreaThumb, type ScrollAreaThumbProps, ScrollAreaViewport, type ScrollAreaViewportProps, ScrollAreaScrollbar as Scrollbar, ScrollAreaThumb as Thumb, ScrollAreaViewport as Viewport, createScrollAreaScope }; diff --git a/e-commerce/node_modules/@radix-ui/react-scroll-area/dist/index.d.ts b/e-commerce/node_modules/@radix-ui/react-scroll-area/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..838db8cffd8fcf31f0cb84c20723d452d15b1e41 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-scroll-area/dist/index.d.ts @@ -0,0 +1,146 @@ +import * as _radix_ui_react_context from '@radix-ui/react-context'; +import * as React from 'react'; +import { Primitive } from '@radix-ui/react-primitive'; + +declare const ScrollAreaType: { + readonly Auto: "auto"; + readonly Always: "always"; + readonly Scroll: "scroll"; + readonly Hover: "hover"; +}; +type ScrollAreaType = (typeof ScrollAreaType)[keyof typeof ScrollAreaType]; +declare const Orientation: { + readonly Vertical: "vertical"; + readonly Horizontal: "horizontal"; +}; +type Orientation = (typeof Orientation)[keyof typeof Orientation]; +declare const Direction: { + readonly LTR: "ltr"; + readonly RTL: "rtl"; +}; +type Direction = (typeof Direction)[keyof typeof Direction]; +type Sizes = { + content: number; + viewport: number; + scrollbar: { + size: number; + paddingStart: number; + paddingEnd: number; + }; +}; +declare const createScrollAreaScope: _radix_ui_react_context.CreateScope; +type ScrollAreaContextValue = { + type: ScrollAreaType; + dir: Direction; + scrollHideDelay: number; + scrollArea: ScrollAreaElement | null; + viewport: ScrollAreaViewportElement | null; + onViewportChange(viewport: ScrollAreaViewportElement | null): void; + content: HTMLDivElement | null; + onContentChange(content: HTMLDivElement): void; + scrollbarX: ScrollAreaScrollbarElement | null; + onScrollbarXChange(scrollbar: ScrollAreaScrollbarElement | null): void; + scrollbarXEnabled: boolean; + onScrollbarXEnabledChange(rendered: boolean): void; + scrollbarY: ScrollAreaScrollbarElement | null; + onScrollbarYChange(scrollbar: ScrollAreaScrollbarElement | null): void; + scrollbarYEnabled: boolean; + onScrollbarYEnabledChange(rendered: boolean): void; + onCornerWidthChange(width: number): void; + onCornerHeightChange(height: number): void; +}; +type ScrollAreaElement = React.ComponentRef; +type PrimitiveDivProps = React.ComponentPropsWithoutRef; +interface ScrollAreaProps extends PrimitiveDivProps { + type?: ScrollAreaContextValue['type'] | undefined; + dir?: ScrollAreaContextValue['dir'] | undefined; + scrollHideDelay?: number | undefined; +} +declare const ScrollArea: React.ForwardRefExoticComponent>; +type ScrollAreaViewportElement = React.ComponentRef; +interface ScrollAreaViewportProps extends PrimitiveDivProps { + nonce?: string | undefined; + /** + * Disables implicit rendering of an additional wrapper element that measures + * the content size. When `true`, a child `` must be + * rendered as a direct child of the viewport. + * + * Implicit rendering of the content element will be removed in the next major + * release. + */ + disableImplicitContentElement?: boolean | undefined; +} +declare const ScrollAreaViewport: React.ForwardRefExoticComponent>; +interface ScrollAreaContentProps extends PrimitiveDivProps { +} +declare const ScrollAreaContent: React.ForwardRefExoticComponent>; +type ScrollAreaScrollbarElement = ScrollAreaScrollbarVisibleElement; +interface ScrollAreaScrollbarProps extends ScrollAreaScrollbarVisibleProps { + forceMount?: true | undefined; +} +declare const ScrollAreaScrollbar: React.ForwardRefExoticComponent>; +type ScrollAreaScrollbarVisibleElement = ScrollAreaScrollbarAxisElement; +interface ScrollAreaScrollbarVisibleProps extends Omit { + orientation?: Orientation | undefined; +} +type ScrollAreaScrollbarAxisPrivateProps = { + hasThumb: boolean; + sizes: Sizes; + onSizesChange(sizes: Sizes): void; + onThumbChange(thumb: ScrollAreaThumbElement | null): void; + onThumbPointerDown(pointerPos: number): void; + onThumbPointerUp(): void; + onThumbPositionChange(): void; + onWheelScroll(scrollPos: number): void; + onDragScroll(pointerPos: number): void; +}; +type ScrollAreaScrollbarAxisElement = ScrollAreaScrollbarImplElement; +interface ScrollAreaScrollbarAxisProps extends Omit, ScrollAreaScrollbarAxisPrivateProps { +} +type ScrollbarContext = { + hasThumb: boolean; + scrollbar: ScrollAreaScrollbarElement | null; + onThumbChange(thumb: ScrollAreaThumbElement | null): void; + onThumbPointerUp(): void; + onThumbPointerDown(pointerPos: { + x: number; + y: number; + }): void; + onThumbPositionChange(): void; +}; +type ScrollAreaScrollbarImplElement = React.ComponentRef; +type ScrollAreaScrollbarImplPrivateProps = { + sizes: Sizes; + hasThumb: boolean; + onThumbChange: ScrollbarContext['onThumbChange']; + onThumbPointerUp: ScrollbarContext['onThumbPointerUp']; + onThumbPointerDown: ScrollbarContext['onThumbPointerDown']; + onThumbPositionChange: ScrollbarContext['onThumbPositionChange']; + onWheelScroll(event: WheelEvent, maxScrollPos: number): void; + onDragScroll(pointerPos: { + x: number; + y: number; + }): void; + onResize(): void; +}; +interface ScrollAreaScrollbarImplProps extends Omit, ScrollAreaScrollbarImplPrivateProps { +} +type ScrollAreaThumbElement = ScrollAreaThumbImplElement; +interface ScrollAreaThumbProps extends ScrollAreaThumbImplProps { + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const ScrollAreaThumb: React.ForwardRefExoticComponent>; +type ScrollAreaThumbImplElement = React.ComponentRef; +interface ScrollAreaThumbImplProps extends PrimitiveDivProps { +} +interface ScrollAreaCornerProps extends ScrollAreaCornerImplProps { +} +declare const ScrollAreaCorner: React.ForwardRefExoticComponent>; +interface ScrollAreaCornerImplProps extends PrimitiveDivProps { +} + +export { ScrollAreaContent as Content, ScrollAreaCorner as Corner, ScrollArea as Root, ScrollArea, ScrollAreaContent, type ScrollAreaContentProps, ScrollAreaCorner, type ScrollAreaCornerProps, type ScrollAreaProps, ScrollAreaScrollbar, type ScrollAreaScrollbarProps, ScrollAreaThumb, type ScrollAreaThumbProps, ScrollAreaViewport, type ScrollAreaViewportProps, ScrollAreaScrollbar as Scrollbar, ScrollAreaThumb as Thumb, ScrollAreaViewport as Viewport, createScrollAreaScope }; diff --git a/e-commerce/node_modules/@radix-ui/react-scroll-area/dist/index.js b/e-commerce/node_modules/@radix-ui/react-scroll-area/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..26fefcd9eafb2d7da77f633c4f56b95065d78c0f --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-scroll-area/dist/index.js @@ -0,0 +1,864 @@ +"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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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, { + Content: () => ScrollAreaContent, + Corner: () => ScrollAreaCorner, + Root: () => ScrollArea, + ScrollArea: () => ScrollArea, + ScrollAreaContent: () => ScrollAreaContent, + ScrollAreaCorner: () => ScrollAreaCorner, + ScrollAreaScrollbar: () => ScrollAreaScrollbar, + ScrollAreaThumb: () => ScrollAreaThumb, + ScrollAreaViewport: () => ScrollAreaViewport, + Scrollbar: () => ScrollAreaScrollbar, + Thumb: () => ScrollAreaThumb, + Viewport: () => ScrollAreaViewport, + createScrollAreaScope: () => createScrollAreaScope +}); +module.exports = __toCommonJS(index_exports); + +// src/scroll-area.tsx +var React2 = __toESM(require("react")); +var import_react_primitive = require("@radix-ui/react-primitive"); +var import_react_presence = require("@radix-ui/react-presence"); +var import_react_slot = require("@radix-ui/react-slot"); +var import_react_context = require("@radix-ui/react-context"); +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_direction = require("@radix-ui/react-direction"); +var import_react_use_layout_effect = require("@radix-ui/react-use-layout-effect"); +var import_number = require("@radix-ui/number"); +var import_primitive = require("@radix-ui/primitive"); +var import_is_development = require("@radix-ui/primitive/is-development"); + +// src/use-state-machine.ts +var React = __toESM(require("react")); +function useStateMachine(initialState, machine) { + return React.useReducer((state, event) => { + const nextState = machine[state][event]; + return nextState ?? state; + }, initialState); +} +__name(useStateMachine, "useStateMachine"); + +// src/scroll-area.tsx +var import_jsx_runtime = require("react/jsx-runtime"); +var ScrollAreaType = { + Auto: "auto", + Always: "always", + Scroll: "scroll", + Hover: "hover" +}; +var Orientation = { + Vertical: "vertical", + Horizontal: "horizontal" +}; +var Direction = { + LTR: "ltr", + RTL: "rtl" +}; +var SCROLL_AREA_NAME = "ScrollArea"; +var [createScrollAreaContext, createScrollAreaScope] = (0, import_react_context.createContextScope)(SCROLL_AREA_NAME); +var [ScrollAreaProvider, useScrollAreaContext] = createScrollAreaContext(SCROLL_AREA_NAME); +var ScrollArea = /* @__PURE__ */ React2.forwardRef( + /* @__PURE__ */ __name(function ScrollArea2(props, forwardedRef) { + const { + __scopeScrollArea, + type = ScrollAreaType.Hover, + dir, + scrollHideDelay = 600, + ...scrollAreaProps + } = props; + const [scrollArea, setScrollArea] = React2.useState(null); + const [viewport, setViewport] = React2.useState(null); + const [content, setContent] = React2.useState(null); + const [scrollbarX, setScrollbarX] = React2.useState(null); + const [scrollbarY, setScrollbarY] = React2.useState(null); + const [cornerWidth, setCornerWidth] = React2.useState(0); + const [cornerHeight, setCornerHeight] = React2.useState(0); + const [scrollbarXEnabled, setScrollbarXEnabled] = React2.useState(false); + const [scrollbarYEnabled, setScrollbarYEnabled] = React2.useState(false); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, setScrollArea); + const direction = (0, import_react_direction.useDirection)(dir); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + ScrollAreaProvider, + { + scope: __scopeScrollArea, + type, + dir: direction, + scrollHideDelay, + scrollArea, + viewport, + onViewportChange: setViewport, + content, + onContentChange: setContent, + scrollbarX, + onScrollbarXChange: setScrollbarX, + scrollbarXEnabled, + onScrollbarXEnabledChange: setScrollbarXEnabled, + scrollbarY, + onScrollbarYChange: setScrollbarY, + scrollbarYEnabled, + onScrollbarYEnabledChange: setScrollbarYEnabled, + onCornerWidthChange: setCornerWidth, + onCornerHeightChange: setCornerHeight, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.div, + { + dir: direction, + ...scrollAreaProps, + ref: composedRefs, + style: { + position: "relative", + // Pass corner sizes as CSS vars to reduce re-renders of context consumers + "--radix-scroll-area-corner-width": cornerWidth + "px", + "--radix-scroll-area-corner-height": cornerHeight + "px", + ...props.style + } + } + ) + } + ); + }, "ScrollArea") +); +var VIEWPORT_NAME = "ScrollAreaViewport"; +var Slottable = (0, import_react_slot.createSlottable)(VIEWPORT_NAME); +var ScrollAreaViewport = /* @__PURE__ */ React2.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function ScrollAreaViewport2(props, forwardedRef) { + const { __scopeScrollArea, children, nonce, disableImplicitContentElement, ...viewportProps } = props; + const context = useScrollAreaContext(VIEWPORT_NAME, __scopeScrollArea); + const ref = React2.useRef(null); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref, context.onViewportChange); + const canSlotOntoChildren = React2.isValidElement(children); + if (import_is_development.IS_DEVELOPMENT) { + const hasWarnedRef = React2.useRef(false); + const shouldWarn = props.asChild === true && !disableImplicitContentElement && !canSlotOntoChildren; + React2.useEffect(() => { + if (shouldWarn && !hasWarnedRef.current) { + hasWarnedRef.current = true; + console.warn( + `${VIEWPORT_NAME}: \`asChild\` expects a single React element child, so its props have been applied to the implicitly rendered content element instead. Wrap the children in a single element, or opt into \`disableImplicitContentElement\` and render a \`ScrollArea.Content\` inside the viewport.` + ); + } + }, [shouldWarn]); + } + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollAreaViewportStyle, { nonce }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.div, + { + "data-radix-scroll-area-viewport": "", + ...viewportProps, + ref: composedRefs, + style: { + /** + * We don't support `visible` because the intention is to have at least one scrollbar + * if this component is used and `visible` will behave like `auto` in that case + * https://developer.mozilla.org/en-US/docs/Web/CSS/overflow#description + * + * We don't handle `auto` because the intention is for the native implementation + * to be hidden if using this component. We just want to ensure the node is scrollable + * so could have used either `scroll` or `auto` here. We picked `scroll` to prevent + * the browser from having to work out whether to render native scrollbars or not, + * we tell it to with the intention of hiding them in CSS. + */ + overflowX: context.scrollbarXEnabled ? "scroll" : "hidden", + overflowY: context.scrollbarYEnabled ? "scroll" : "hidden", + ...props.style + }, + children: disableImplicitContentElement ? children : canSlotOntoChildren ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Slottable, { child: children, children: (slottable) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + ScrollAreaContent, + { + __scopeScrollArea, + children: slottable + } + ) }) : ( + // When `children` isn't a single element there is nothing for + // `Slot` to redirect onto, so target the wrapper. This mirrors the + // old [incorrect] behavior, but it's better than throwing on a + // patch update. + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Slottable, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + ScrollAreaContent, + { + __scopeScrollArea, + children + } + ) }) + ) + } + ) + ] }); + }, "ScrollAreaViewport") +); +var ScrollAreaViewportStyle = /* @__PURE__ */ React2.memo( + /* @__PURE__ */ __name(function ScrollAreaViewportStyle2({ nonce }) { + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + "style", + { + dangerouslySetInnerHTML: { + __html: `[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}` + }, + nonce + } + ); + }, "ScrollAreaViewportStyle"), + (prevProps, nextProps) => prevProps.nonce === nextProps.nonce +); +var CONTENT_NAME = "ScrollAreaContent"; +var ScrollAreaContent = /* @__PURE__ */ React2.forwardRef(/* @__PURE__ */ __name(function ScrollAreaContent2(props, forwardedRef) { + const { __scopeScrollArea, children, ...contentProps } = props; + const context = useScrollAreaContext(CONTENT_NAME, __scopeScrollArea); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, context.onContentChange); + return ( + // `display: table` ensures our content div will match the size of its + // children in both horizontal and vertical axis so we can determine if + // scroll width/height changed and recalculate thumb sizes. This doesn't + // account for children with *percentage* widths that change. We'll wait to + // see what use-cases consumers come up with there before trying to resolve + // it. + /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.div, + { + ...contentProps, + ref: composedRefs, + style: { minWidth: "100%", display: "table", ...props.style }, + children + } + ) + ); +}, "ScrollAreaContent")); +var SCROLLBAR_NAME = "ScrollAreaScrollbar"; +var ScrollAreaScrollbar = /* @__PURE__ */ React2.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function ScrollAreaScrollbar2(props, forwardedRef) { + const { forceMount, ...scrollbarProps } = props; + const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea); + const { onScrollbarXEnabledChange, onScrollbarYEnabledChange } = context; + const isHorizontal = props.orientation === Orientation.Horizontal; + React2.useEffect(() => { + isHorizontal ? onScrollbarXEnabledChange(true) : onScrollbarYEnabledChange(true); + return () => { + isHorizontal ? onScrollbarXEnabledChange(false) : onScrollbarYEnabledChange(false); + }; + }, [isHorizontal, onScrollbarXEnabledChange, onScrollbarYEnabledChange]); + return context.type === ScrollAreaType.Hover ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollAreaScrollbarHover, { ...scrollbarProps, ref: forwardedRef, forceMount }) : context.type === ScrollAreaType.Scroll ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollAreaScrollbarScroll, { ...scrollbarProps, ref: forwardedRef, forceMount }) : context.type === ScrollAreaType.Auto ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollAreaScrollbarAuto, { ...scrollbarProps, ref: forwardedRef, forceMount }) : context.type === ScrollAreaType.Always ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollAreaScrollbarVisible, { ...scrollbarProps, ref: forwardedRef, "data-state": "visible" }) : null; + }, "ScrollAreaScrollbar") +); +var ScrollAreaScrollbarHover = /* @__PURE__ */ React2.forwardRef(/* @__PURE__ */ __name(function ScrollAreaScrollbarHover2(props, forwardedRef) { + const { forceMount, ...scrollbarProps } = props; + const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea); + const [visible, setVisible] = React2.useState(false); + React2.useEffect(() => { + const scrollArea = context.scrollArea; + let hideTimer = 0; + if (scrollArea) { + const handlePointerEnter = /* @__PURE__ */ __name(() => { + window.clearTimeout(hideTimer); + setVisible(true); + }, "handlePointerEnter"); + const handlePointerLeave = /* @__PURE__ */ __name(() => { + hideTimer = window.setTimeout(() => setVisible(false), context.scrollHideDelay); + }, "handlePointerLeave"); + scrollArea.addEventListener("pointerenter", handlePointerEnter); + scrollArea.addEventListener("pointerleave", handlePointerLeave); + return () => { + window.clearTimeout(hideTimer); + scrollArea.removeEventListener("pointerenter", handlePointerEnter); + scrollArea.removeEventListener("pointerleave", handlePointerLeave); + }; + } + }, [context.scrollArea, context.scrollHideDelay]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || visible, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + ScrollAreaScrollbarAuto, + { + "data-state": visible ? "visible" : "hidden", + ...scrollbarProps, + ref: forwardedRef + } + ) }); +}, "ScrollAreaScrollbarHover")); +var ScrollAreaScrollbarScroll = /* @__PURE__ */ React2.forwardRef(/* @__PURE__ */ __name(function ScrollAreaScrollbarScroll2(props, forwardedRef) { + const { forceMount, ...scrollbarProps } = props; + const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea); + const isHorizontal = props.orientation === Orientation.Horizontal; + const debounceScrollEnd = useDebounceCallback(() => send("SCROLL_END"), 100); + const [state, send] = useStateMachine("hidden", { + hidden: { + SCROLL: "scrolling" + }, + scrolling: { + SCROLL_END: "idle", + POINTER_ENTER: "interacting" + }, + interacting: { + SCROLL: "interacting", + POINTER_LEAVE: "idle" + }, + idle: { + HIDE: "hidden", + SCROLL: "scrolling", + POINTER_ENTER: "interacting" + } + }); + React2.useEffect(() => { + if (state === "idle") { + const hideTimer = window.setTimeout(() => send("HIDE"), context.scrollHideDelay); + return () => window.clearTimeout(hideTimer); + } + }, [state, context.scrollHideDelay, send]); + React2.useEffect(() => { + const viewport = context.viewport; + const scrollDirection = isHorizontal ? "scrollLeft" : "scrollTop"; + if (viewport) { + let prevScrollPos = viewport[scrollDirection]; + const handleScroll = /* @__PURE__ */ __name(() => { + const scrollPos = viewport[scrollDirection]; + const hasScrollInDirectionChanged = prevScrollPos !== scrollPos; + if (hasScrollInDirectionChanged) { + send("SCROLL"); + debounceScrollEnd(); + } + prevScrollPos = scrollPos; + }, "handleScroll"); + viewport.addEventListener("scroll", handleScroll); + return () => viewport.removeEventListener("scroll", handleScroll); + } + }, [context.viewport, isHorizontal, send, debounceScrollEnd]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || state !== "hidden", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + ScrollAreaScrollbarVisible, + { + "data-state": state === "hidden" ? "hidden" : "visible", + ...scrollbarProps, + ref: forwardedRef, + onPointerEnter: (0, import_primitive.composeEventHandlers)(props.onPointerEnter, () => send("POINTER_ENTER")), + onPointerLeave: (0, import_primitive.composeEventHandlers)(props.onPointerLeave, () => send("POINTER_LEAVE")) + } + ) }); +}, "ScrollAreaScrollbarScroll")); +var ScrollAreaScrollbarAuto = /* @__PURE__ */ React2.forwardRef(/* @__PURE__ */ __name(function ScrollAreaScrollbarAuto2(props, forwardedRef) { + const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea); + const { forceMount, ...scrollbarProps } = props; + const [visible, setVisible] = React2.useState(false); + const isHorizontal = props.orientation === Orientation.Horizontal; + const handleResize = useDebounceCallback(() => { + if (context.viewport) { + const isOverflowX = context.viewport.offsetWidth < context.viewport.scrollWidth; + const isOverflowY = context.viewport.offsetHeight < context.viewport.scrollHeight; + setVisible(isHorizontal ? isOverflowX : isOverflowY); + } + }, 10); + useResizeObserver(context.viewport, handleResize); + useResizeObserver(context.content, handleResize); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || visible, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + ScrollAreaScrollbarVisible, + { + "data-state": visible ? "visible" : "hidden", + ...scrollbarProps, + ref: forwardedRef + } + ) }); +}, "ScrollAreaScrollbarAuto")); +var ScrollAreaScrollbarVisible = /* @__PURE__ */ React2.forwardRef(/* @__PURE__ */ __name(function ScrollAreaScrollbarVisible2(props, forwardedRef) { + const { orientation = Orientation.Vertical, ...scrollbarProps } = props; + const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea); + const thumbRef = React2.useRef(null); + const pointerOffsetRef = React2.useRef(0); + const [sizes, setSizes] = React2.useState({ + content: 0, + viewport: 0, + scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 } + }); + const thumbRatio = getThumbRatio(sizes.viewport, sizes.content); + const commonProps = { + ...scrollbarProps, + sizes, + onSizesChange: setSizes, + hasThumb: Boolean(thumbRatio > 0 && thumbRatio < 1), + onThumbChange: /* @__PURE__ */ __name((thumb) => thumbRef.current = thumb, "onThumbChange"), + onThumbPointerUp: /* @__PURE__ */ __name(() => pointerOffsetRef.current = 0, "onThumbPointerUp"), + onThumbPointerDown: /* @__PURE__ */ __name((pointerPos) => pointerOffsetRef.current = pointerPos, "onThumbPointerDown") + }; + function getScrollPosition(pointerPos, dir) { + return getScrollPositionFromPointer(pointerPos, pointerOffsetRef.current, sizes, dir); + } + __name(getScrollPosition, "getScrollPosition"); + if (orientation === Orientation.Horizontal) { + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + ScrollAreaScrollbarX, + { + ...commonProps, + ref: forwardedRef, + onThumbPositionChange: () => { + if (context.viewport && thumbRef.current) { + const scrollPos = context.viewport.scrollLeft; + const offset = getThumbOffsetFromScroll(scrollPos, sizes, context.dir); + thumbRef.current.style.transform = `translate3d(${offset}px, 0, 0)`; + } + }, + onWheelScroll: (scrollPos) => { + if (context.viewport) context.viewport.scrollLeft = scrollPos; + }, + onDragScroll: (pointerPos) => { + if (context.viewport) { + context.viewport.scrollLeft = getScrollPosition(pointerPos, context.dir); + } + } + } + ); + } + if (orientation === Orientation.Vertical) { + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + ScrollAreaScrollbarY, + { + ...commonProps, + ref: forwardedRef, + onThumbPositionChange: () => { + if (context.viewport && thumbRef.current) { + const scrollPos = context.viewport.scrollTop; + const offset = getThumbOffsetFromScroll(scrollPos, sizes); + thumbRef.current.style.transform = `translate3d(0, ${offset}px, 0)`; + } + }, + onWheelScroll: (scrollPos) => { + if (context.viewport) context.viewport.scrollTop = scrollPos; + }, + onDragScroll: (pointerPos) => { + if (context.viewport) context.viewport.scrollTop = getScrollPosition(pointerPos); + } + } + ); + } + return null; +}, "ScrollAreaScrollbarVisible")); +var ScrollAreaScrollbarX = /* @__PURE__ */ React2.forwardRef(/* @__PURE__ */ __name(function ScrollAreaScrollbarX2(props, forwardedRef) { + const { sizes, onSizesChange, ...scrollbarProps } = props; + const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea); + const [computedStyle, setComputedStyle] = React2.useState(); + const ref = React2.useRef(null); + const composeRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref, context.onScrollbarXChange); + React2.useEffect(() => { + if (ref.current) setComputedStyle(getComputedStyle(ref.current)); + }, [ref]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + ScrollAreaScrollbarImpl, + { + "data-orientation": "horizontal", + ...scrollbarProps, + ref: composeRefs, + sizes, + style: { + bottom: 0, + left: context.dir === Direction.RTL ? "var(--radix-scroll-area-corner-width)" : 0, + right: context.dir === Direction.LTR ? "var(--radix-scroll-area-corner-width)" : 0, + "--radix-scroll-area-thumb-width": getThumbSize(sizes) + "px", + ...props.style + }, + onThumbPointerDown: (pointerPos) => props.onThumbPointerDown(pointerPos.x), + onDragScroll: (pointerPos) => props.onDragScroll(pointerPos.x), + onWheelScroll: (event, maxScrollPos) => { + if (context.viewport) { + const scrollPos = context.viewport.scrollLeft + event.deltaX; + props.onWheelScroll(scrollPos); + if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) { + event.preventDefault(); + } + } + }, + onResize: () => { + if (ref.current && context.viewport && computedStyle) { + onSizesChange({ + content: context.viewport.scrollWidth, + viewport: context.viewport.offsetWidth, + scrollbar: { + size: ref.current.clientWidth, + paddingStart: toInt(computedStyle.paddingLeft), + paddingEnd: toInt(computedStyle.paddingRight) + } + }); + } + } + } + ); +}, "ScrollAreaScrollbarX")); +var ScrollAreaScrollbarY = /* @__PURE__ */ React2.forwardRef(/* @__PURE__ */ __name(function ScrollAreaScrollbarY2(props, forwardedRef) { + const { sizes, onSizesChange, ...scrollbarProps } = props; + const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea); + const [computedStyle, setComputedStyle] = React2.useState(); + const ref = React2.useRef(null); + const composeRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref, context.onScrollbarYChange); + React2.useEffect(() => { + if (ref.current) setComputedStyle(getComputedStyle(ref.current)); + }, [ref]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + ScrollAreaScrollbarImpl, + { + "data-orientation": "vertical", + ...scrollbarProps, + ref: composeRefs, + sizes, + style: { + top: 0, + right: context.dir === Direction.LTR ? 0 : void 0, + left: context.dir === Direction.RTL ? 0 : void 0, + bottom: "var(--radix-scroll-area-corner-height)", + "--radix-scroll-area-thumb-height": getThumbSize(sizes) + "px", + ...props.style + }, + onThumbPointerDown: (pointerPos) => props.onThumbPointerDown(pointerPos.y), + onDragScroll: (pointerPos) => props.onDragScroll(pointerPos.y), + onWheelScroll: (event, maxScrollPos) => { + if (context.viewport) { + const scrollPos = context.viewport.scrollTop + event.deltaY; + props.onWheelScroll(scrollPos); + if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) { + event.preventDefault(); + } + } + }, + onResize: () => { + if (ref.current && context.viewport && computedStyle) { + onSizesChange({ + content: context.viewport.scrollHeight, + viewport: context.viewport.offsetHeight, + scrollbar: { + size: ref.current.clientHeight, + paddingStart: toInt(computedStyle.paddingTop), + paddingEnd: toInt(computedStyle.paddingBottom) + } + }); + } + } + } + ); +}, "ScrollAreaScrollbarY")); +var [ScrollbarProvider, useScrollbarContext] = createScrollAreaContext(SCROLLBAR_NAME); +var ScrollAreaScrollbarImpl = /* @__PURE__ */ React2.forwardRef(/* @__PURE__ */ __name(function ScrollAreaScrollbarImpl2(props, forwardedRef) { + const { + __scopeScrollArea, + sizes, + hasThumb, + onThumbChange, + onThumbPointerUp, + onThumbPointerDown, + onThumbPositionChange, + onDragScroll, + onWheelScroll, + onResize, + ...scrollbarProps + } = props; + const context = useScrollAreaContext(SCROLLBAR_NAME, __scopeScrollArea); + const [scrollbar, setScrollbar] = React2.useState(null); + const composeRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, setScrollbar); + const rectRef = React2.useRef(null); + const prevWebkitUserSelectRef = React2.useRef(""); + const viewport = context.viewport; + const maxScrollPos = sizes.content - sizes.viewport; + const handleWheelScroll = (0, import_react_use_callback_ref.useCallbackRef)(onWheelScroll); + const handleThumbPositionChange = (0, import_react_use_callback_ref.useCallbackRef)(onThumbPositionChange); + const handleResize = useDebounceCallback(onResize, 10); + function handleDragScroll(event) { + if (rectRef.current) { + const x = event.clientX - rectRef.current.left; + const y = event.clientY - rectRef.current.top; + onDragScroll({ x, y }); + } + } + __name(handleDragScroll, "handleDragScroll"); + React2.useEffect(() => { + const handleWheel = /* @__PURE__ */ __name((event) => { + const element = event.target; + const isScrollbarWheel = scrollbar?.contains(element); + if (isScrollbarWheel) handleWheelScroll(event, maxScrollPos); + }, "handleWheel"); + document.addEventListener("wheel", handleWheel, { passive: false }); + return () => document.removeEventListener("wheel", handleWheel, { passive: false }); + }, [viewport, scrollbar, maxScrollPos, handleWheelScroll]); + React2.useEffect(handleThumbPositionChange, [sizes, handleThumbPositionChange]); + useResizeObserver(scrollbar, handleResize); + useResizeObserver(context.content, handleResize); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + ScrollbarProvider, + { + scope: __scopeScrollArea, + scrollbar, + hasThumb, + onThumbChange: (0, import_react_use_callback_ref.useCallbackRef)(onThumbChange), + onThumbPointerUp: (0, import_react_use_callback_ref.useCallbackRef)(onThumbPointerUp), + onThumbPositionChange: handleThumbPositionChange, + onThumbPointerDown: (0, import_react_use_callback_ref.useCallbackRef)(onThumbPointerDown), + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.div, + { + ...scrollbarProps, + ref: composeRefs, + style: { position: "absolute", ...scrollbarProps.style }, + onPointerDown: (0, import_primitive.composeEventHandlers)(props.onPointerDown, (event) => { + const mainPointer = 0; + if (event.button === mainPointer) { + const element = event.target; + element.setPointerCapture(event.pointerId); + rectRef.current = scrollbar.getBoundingClientRect(); + prevWebkitUserSelectRef.current = document.body.style.webkitUserSelect; + document.body.style.webkitUserSelect = "none"; + if (context.viewport) context.viewport.style.scrollBehavior = "auto"; + handleDragScroll(event); + } + }), + onPointerMove: (0, import_primitive.composeEventHandlers)(props.onPointerMove, handleDragScroll), + onPointerUp: (0, import_primitive.composeEventHandlers)(props.onPointerUp, (event) => { + const element = event.target; + if (element.hasPointerCapture(event.pointerId)) { + element.releasePointerCapture(event.pointerId); + } + document.body.style.webkitUserSelect = prevWebkitUserSelectRef.current; + if (context.viewport) context.viewport.style.scrollBehavior = ""; + rectRef.current = null; + }) + } + ) + } + ); +}, "ScrollAreaScrollbarImpl")); +var THUMB_NAME = "ScrollAreaThumb"; +var ScrollAreaThumb = /* @__PURE__ */ React2.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function ScrollAreaThumb2(props, forwardedRef) { + const { forceMount, ...thumbProps } = props; + const scrollbarContext = useScrollbarContext(THUMB_NAME, props.__scopeScrollArea); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || scrollbarContext.hasThumb, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollAreaThumbImpl, { ref: forwardedRef, ...thumbProps }) }); + }, "ScrollAreaThumb") +); +var ScrollAreaThumbImpl = /* @__PURE__ */ React2.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function ScrollAreaThumbImpl2(props, forwardedRef) { + const { __scopeScrollArea, style, ...thumbProps } = props; + const scrollAreaContext = useScrollAreaContext(THUMB_NAME, __scopeScrollArea); + const scrollbarContext = useScrollbarContext(THUMB_NAME, __scopeScrollArea); + const { onThumbPositionChange } = scrollbarContext; + const composedRef = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, scrollbarContext.onThumbChange); + const removeUnlinkedScrollListenerRef = React2.useRef(void 0); + const debounceScrollEnd = useDebounceCallback(() => { + if (removeUnlinkedScrollListenerRef.current) { + removeUnlinkedScrollListenerRef.current(); + removeUnlinkedScrollListenerRef.current = void 0; + } + }, 100); + React2.useEffect(() => { + const viewport = scrollAreaContext.viewport; + if (viewport) { + const handleScroll = /* @__PURE__ */ __name(() => { + debounceScrollEnd(); + if (!removeUnlinkedScrollListenerRef.current) { + const listener = addUnlinkedScrollListener(viewport, onThumbPositionChange); + removeUnlinkedScrollListenerRef.current = listener; + onThumbPositionChange(); + } + }, "handleScroll"); + onThumbPositionChange(); + viewport.addEventListener("scroll", handleScroll); + return () => viewport.removeEventListener("scroll", handleScroll); + } + }, [scrollAreaContext.viewport, debounceScrollEnd, onThumbPositionChange]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.div, + { + "data-state": scrollbarContext.hasThumb ? "visible" : "hidden", + ...thumbProps, + ref: composedRef, + style: { + width: "var(--radix-scroll-area-thumb-width)", + height: "var(--radix-scroll-area-thumb-height)", + ...style + }, + onPointerDownCapture: (0, import_primitive.composeEventHandlers)(props.onPointerDownCapture, (event) => { + const thumb = event.target; + const thumbRect = thumb.getBoundingClientRect(); + const x = event.clientX - thumbRect.left; + const y = event.clientY - thumbRect.top; + scrollbarContext.onThumbPointerDown({ x, y }); + }), + onPointerUp: (0, import_primitive.composeEventHandlers)(props.onPointerUp, scrollbarContext.onThumbPointerUp) + } + ); + }, "ScrollAreaThumbImpl") +); +var CORNER_NAME = "ScrollAreaCorner"; +var ScrollAreaCorner = /* @__PURE__ */ React2.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function ScrollAreaCorner2(props, forwardedRef) { + const context = useScrollAreaContext(CORNER_NAME, props.__scopeScrollArea); + const hasBothScrollbarsVisible = Boolean(context.scrollbarX && context.scrollbarY); + const hasCorner = context.type !== ScrollAreaType.Scroll && hasBothScrollbarsVisible; + return hasCorner ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollAreaCornerImpl, { ...props, ref: forwardedRef }) : null; + }, "ScrollAreaCorner") +); +var ScrollAreaCornerImpl = /* @__PURE__ */ React2.forwardRef(/* @__PURE__ */ __name(function ScrollAreaCornerImpl2(props, forwardedRef) { + const { __scopeScrollArea, ...cornerProps } = props; + const context = useScrollAreaContext(CORNER_NAME, __scopeScrollArea); + const [width, setWidth] = React2.useState(0); + const [height, setHeight] = React2.useState(0); + const hasSize = Boolean(width && height); + const { onCornerWidthChange, onCornerHeightChange } = context; + useResizeObserver(context.scrollbarX, () => { + const height2 = context.scrollbarX?.offsetHeight || 0; + context.onCornerHeightChange(height2); + setHeight(height2); + }); + useResizeObserver(context.scrollbarY, () => { + const width2 = context.scrollbarY?.offsetWidth || 0; + context.onCornerWidthChange(width2); + setWidth(width2); + }); + React2.useEffect(() => { + return () => { + onCornerWidthChange(0); + onCornerHeightChange(0); + }; + }, [onCornerWidthChange, onCornerHeightChange]); + return hasSize ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.div, + { + ...cornerProps, + ref: forwardedRef, + style: { + width, + height, + position: "absolute", + right: context.dir === Direction.LTR ? 0 : void 0, + left: context.dir === Direction.RTL ? 0 : void 0, + bottom: 0, + ...props.style + } + } + ) : null; +}, "ScrollAreaCornerImpl")); +function toInt(value) { + return value ? parseInt(value, 10) : 0; +} +__name(toInt, "toInt"); +function getThumbRatio(viewportSize, contentSize) { + const ratio = viewportSize / contentSize; + return isNaN(ratio) ? 0 : ratio; +} +__name(getThumbRatio, "getThumbRatio"); +function getThumbSize(sizes) { + const ratio = getThumbRatio(sizes.viewport, sizes.content); + const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd; + const thumbSize = (sizes.scrollbar.size - scrollbarPadding) * ratio; + return Math.max(thumbSize, 18); +} +__name(getThumbSize, "getThumbSize"); +function getScrollPositionFromPointer(pointerPos, pointerOffset, sizes, dir = Direction.LTR) { + const thumbSizePx = getThumbSize(sizes); + const thumbCenter = thumbSizePx / 2; + const offset = pointerOffset || thumbCenter; + const thumbOffsetFromEnd = thumbSizePx - offset; + const minPointerPos = sizes.scrollbar.paddingStart + offset; + const maxPointerPos = sizes.scrollbar.size - sizes.scrollbar.paddingEnd - thumbOffsetFromEnd; + const maxScrollPos = sizes.content - sizes.viewport; + const scrollRange = dir === Direction.LTR ? [0, maxScrollPos] : [maxScrollPos * -1, 0]; + const interpolate = linearScale([minPointerPos, maxPointerPos], scrollRange); + return interpolate(pointerPos); +} +__name(getScrollPositionFromPointer, "getScrollPositionFromPointer"); +function getThumbOffsetFromScroll(scrollPos, sizes, dir = Direction.LTR) { + const thumbSizePx = getThumbSize(sizes); + const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd; + const scrollbar = sizes.scrollbar.size - scrollbarPadding; + const maxScrollPos = sizes.content - sizes.viewport; + const maxThumbPos = scrollbar - thumbSizePx; + const scrollClampRange = dir === Direction.LTR ? [0, maxScrollPos] : [maxScrollPos * -1, 0]; + const scrollWithoutMomentum = (0, import_number.clamp)(scrollPos, scrollClampRange); + const interpolate = linearScale([0, maxScrollPos], [0, maxThumbPos]); + return interpolate(scrollWithoutMomentum); +} +__name(getThumbOffsetFromScroll, "getThumbOffsetFromScroll"); +function linearScale(input, output) { + return (value) => { + if (input[0] === input[1] || output[0] === output[1]) return output[0]; + const ratio = (output[1] - output[0]) / (input[1] - input[0]); + return output[0] + ratio * (value - input[0]); + }; +} +__name(linearScale, "linearScale"); +function isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos) { + return scrollPos > 0 && scrollPos < maxScrollPos; +} +__name(isScrollingWithinScrollbarBounds, "isScrollingWithinScrollbarBounds"); +var addUnlinkedScrollListener = /* @__PURE__ */ __name((node, handler = () => { +}) => { + let prevPosition = { left: node.scrollLeft, top: node.scrollTop }; + let rAF = 0; + function loop() { + const position = { left: node.scrollLeft, top: node.scrollTop }; + const isHorizontalScroll = prevPosition.left !== position.left; + const isVerticalScroll = prevPosition.top !== position.top; + if (isHorizontalScroll || isVerticalScroll) handler(); + prevPosition = position; + rAF = window.requestAnimationFrame(loop); + } + __name(loop, "loop"); + loop(); + return () => window.cancelAnimationFrame(rAF); +}, "addUnlinkedScrollListener"); +function useDebounceCallback(callback, delay) { + const handleCallback = (0, import_react_use_callback_ref.useCallbackRef)(callback); + const debounceTimerRef = React2.useRef(0); + React2.useEffect(() => () => window.clearTimeout(debounceTimerRef.current), []); + return React2.useCallback(() => { + window.clearTimeout(debounceTimerRef.current); + debounceTimerRef.current = window.setTimeout(handleCallback, delay); + }, [handleCallback, delay]); +} +__name(useDebounceCallback, "useDebounceCallback"); +function useResizeObserver(element, onResize) { + const handleResize = (0, import_react_use_callback_ref.useCallbackRef)(onResize); + (0, import_react_use_layout_effect.useLayoutEffect)(() => { + let rAF = 0; + if (element) { + const resizeObserver = new ResizeObserver(() => { + cancelAnimationFrame(rAF); + rAF = window.requestAnimationFrame(handleResize); + }); + resizeObserver.observe(element); + return () => { + window.cancelAnimationFrame(rAF); + resizeObserver.unobserve(element); + }; + } + }, [element, handleResize]); +} +__name(useResizeObserver, "useResizeObserver"); +//# sourceMappingURL=index.js.map diff --git a/e-commerce/node_modules/@radix-ui/react-scroll-area/dist/index.js.map b/e-commerce/node_modules/@radix-ui/react-scroll-area/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..8eee11eb790bb928c004aed3e29d2ea7cf581d25 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-scroll-area/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts", "../src/scroll-area.tsx", "../src/use-state-machine.ts"], + "sourcesContent": ["'use client';\nexport {\n createScrollAreaScope,\n //\n ScrollArea,\n ScrollAreaViewport,\n ScrollAreaContent,\n ScrollAreaScrollbar,\n ScrollAreaThumb,\n ScrollAreaCorner,\n //\n Root,\n Viewport,\n Content,\n Scrollbar,\n Thumb,\n Corner,\n} from './scroll-area';\nexport type {\n ScrollAreaProps,\n ScrollAreaViewportProps,\n ScrollAreaContentProps,\n ScrollAreaScrollbarProps,\n ScrollAreaThumbProps,\n ScrollAreaCornerProps,\n} from './scroll-area';\n", "import * as React from 'react';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { Presence } from '@radix-ui/react-presence';\nimport { createSlottable } from '@radix-ui/react-slot';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useDirection } from '@radix-ui/react-direction';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { clamp } from '@radix-ui/number';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { IS_DEVELOPMENT } from '@radix-ui/primitive/is-development';\nimport { useStateMachine } from './use-state-machine';\n\nimport type { Scope } from '@radix-ui/react-context';\n\nconst ScrollAreaType = {\n Auto: 'auto',\n Always: 'always',\n Scroll: 'scroll',\n Hover: 'hover',\n} as const;\n\nconst Orientation = {\n Vertical: 'vertical',\n Horizontal: 'horizontal',\n} as const;\n\nconst Direction = {\n LTR: 'ltr',\n RTL: 'rtl',\n} as const;\n\ntype ScrollAreaType = (typeof ScrollAreaType)[keyof typeof ScrollAreaType];\ntype Orientation = (typeof Orientation)[keyof typeof Orientation];\ntype Direction = (typeof Direction)[keyof typeof Direction];\n\ntype Sizes = {\n content: number;\n viewport: number;\n scrollbar: {\n size: number;\n paddingStart: number;\n paddingEnd: number;\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ScrollArea\n * -----------------------------------------------------------------------------------------------*/\n\nconst SCROLL_AREA_NAME = 'ScrollArea';\n\ntype ScopedProps

= P & { __scopeScrollArea?: Scope | undefined };\nconst [createScrollAreaContext, createScrollAreaScope] = createContextScope(SCROLL_AREA_NAME);\n\ntype ScrollAreaContextValue = {\n type: ScrollAreaType;\n dir: Direction;\n scrollHideDelay: number;\n scrollArea: ScrollAreaElement | null;\n viewport: ScrollAreaViewportElement | null;\n onViewportChange(viewport: ScrollAreaViewportElement | null): void;\n content: HTMLDivElement | null;\n onContentChange(content: HTMLDivElement): void;\n scrollbarX: ScrollAreaScrollbarElement | null;\n onScrollbarXChange(scrollbar: ScrollAreaScrollbarElement | null): void;\n scrollbarXEnabled: boolean;\n onScrollbarXEnabledChange(rendered: boolean): void;\n scrollbarY: ScrollAreaScrollbarElement | null;\n onScrollbarYChange(scrollbar: ScrollAreaScrollbarElement | null): void;\n scrollbarYEnabled: boolean;\n onScrollbarYEnabledChange(rendered: boolean): void;\n onCornerWidthChange(width: number): void;\n onCornerHeightChange(height: number): void;\n};\n\nconst [ScrollAreaProvider, useScrollAreaContext] =\n createScrollAreaContext(SCROLL_AREA_NAME);\n\ntype ScrollAreaElement = React.ComponentRef;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef;\ninterface ScrollAreaProps extends PrimitiveDivProps {\n type?: ScrollAreaContextValue['type'] | undefined;\n dir?: ScrollAreaContextValue['dir'] | undefined;\n scrollHideDelay?: number | undefined;\n}\n\nconst ScrollArea = /* @__PURE__ */ React.forwardRef(\n function ScrollArea(props: ScopedProps, forwardedRef) {\n const {\n __scopeScrollArea,\n type = ScrollAreaType.Hover,\n dir,\n scrollHideDelay = 600,\n ...scrollAreaProps\n } = props;\n const [scrollArea, setScrollArea] = React.useState(null);\n const [viewport, setViewport] = React.useState(null);\n const [content, setContent] = React.useState(null);\n const [scrollbarX, setScrollbarX] = React.useState(null);\n const [scrollbarY, setScrollbarY] = React.useState(null);\n const [cornerWidth, setCornerWidth] = React.useState(0);\n const [cornerHeight, setCornerHeight] = React.useState(0);\n const [scrollbarXEnabled, setScrollbarXEnabled] = React.useState(false);\n const [scrollbarYEnabled, setScrollbarYEnabled] = React.useState(false);\n const composedRefs = useComposedRefs(forwardedRef, setScrollArea);\n const direction = useDirection(dir);\n\n return (\n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * ScrollAreaViewport\n * -----------------------------------------------------------------------------------------------*/\n\nconst VIEWPORT_NAME = 'ScrollAreaViewport';\nconst Slottable = createSlottable(VIEWPORT_NAME);\n\ntype ScrollAreaViewportElement = React.ComponentRef;\ninterface ScrollAreaViewportProps extends PrimitiveDivProps {\n nonce?: string | undefined;\n /**\n * Disables implicit rendering of an additional wrapper element that measures\n * the content size. When `true`, a child `` must be\n * rendered as a direct child of the viewport.\n *\n * Implicit rendering of the content element will be removed in the next major\n * release.\n */\n disableImplicitContentElement?: boolean | undefined;\n}\n\nconst ScrollAreaViewport = /* @__PURE__ */ React.forwardRef<\n ScrollAreaViewportElement,\n ScrollAreaViewportProps\n>(\n // blank line to reduce diff noise\n function ScrollAreaViewport(props: ScopedProps, forwardedRef) {\n const { __scopeScrollArea, children, nonce, disableImplicitContentElement, ...viewportProps } =\n props;\n const context = useScrollAreaContext(VIEWPORT_NAME, __scopeScrollArea);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref, context.onViewportChange);\n\n // `Slot` can only redirect props onto a single element, so `asChild` can\n // only reach the consumer's element when `children` is one.\n const canSlotOntoChildren = React.isValidElement(children);\n\n // oxlint-disable react-hooks/rules-of-hooks\n if (IS_DEVELOPMENT) {\n const hasWarnedRef = React.useRef(false);\n const shouldWarn =\n props.asChild === true && !disableImplicitContentElement && !canSlotOntoChildren;\n React.useEffect(() => {\n if (shouldWarn && !hasWarnedRef.current) {\n hasWarnedRef.current = true;\n console.warn(\n `${VIEWPORT_NAME}: \\`asChild\\` expects a single React element child, so its props have been applied to the implicitly rendered content element instead. Wrap the children in a single element, or opt into \\`disableImplicitContentElement\\` and render a \\`ScrollArea.Content\\` inside the viewport.`,\n );\n }\n }, [shouldWarn]);\n }\n // oxlint-enable react-hooks/rules-of-hooks\n\n return (\n <>\n \n

= P & { __scopeScrollArea?: Scope | undefined };\nconst [createScrollAreaContext, createScrollAreaScope] = createContextScope(SCROLL_AREA_NAME);\n\ntype ScrollAreaContextValue = {\n type: ScrollAreaType;\n dir: Direction;\n scrollHideDelay: number;\n scrollArea: ScrollAreaElement | null;\n viewport: ScrollAreaViewportElement | null;\n onViewportChange(viewport: ScrollAreaViewportElement | null): void;\n content: HTMLDivElement | null;\n onContentChange(content: HTMLDivElement): void;\n scrollbarX: ScrollAreaScrollbarElement | null;\n onScrollbarXChange(scrollbar: ScrollAreaScrollbarElement | null): void;\n scrollbarXEnabled: boolean;\n onScrollbarXEnabledChange(rendered: boolean): void;\n scrollbarY: ScrollAreaScrollbarElement | null;\n onScrollbarYChange(scrollbar: ScrollAreaScrollbarElement | null): void;\n scrollbarYEnabled: boolean;\n onScrollbarYEnabledChange(rendered: boolean): void;\n onCornerWidthChange(width: number): void;\n onCornerHeightChange(height: number): void;\n};\n\nconst [ScrollAreaProvider, useScrollAreaContext] =\n createScrollAreaContext(SCROLL_AREA_NAME);\n\ntype ScrollAreaElement = React.ComponentRef;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef;\ninterface ScrollAreaProps extends PrimitiveDivProps {\n type?: ScrollAreaContextValue['type'] | undefined;\n dir?: ScrollAreaContextValue['dir'] | undefined;\n scrollHideDelay?: number | undefined;\n}\n\nconst ScrollArea = /* @__PURE__ */ React.forwardRef(\n function ScrollArea(props: ScopedProps, forwardedRef) {\n const {\n __scopeScrollArea,\n type = ScrollAreaType.Hover,\n dir,\n scrollHideDelay = 600,\n ...scrollAreaProps\n } = props;\n const [scrollArea, setScrollArea] = React.useState(null);\n const [viewport, setViewport] = React.useState(null);\n const [content, setContent] = React.useState(null);\n const [scrollbarX, setScrollbarX] = React.useState(null);\n const [scrollbarY, setScrollbarY] = React.useState(null);\n const [cornerWidth, setCornerWidth] = React.useState(0);\n const [cornerHeight, setCornerHeight] = React.useState(0);\n const [scrollbarXEnabled, setScrollbarXEnabled] = React.useState(false);\n const [scrollbarYEnabled, setScrollbarYEnabled] = React.useState(false);\n const composedRefs = useComposedRefs(forwardedRef, setScrollArea);\n const direction = useDirection(dir);\n\n return (\n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * ScrollAreaViewport\n * -----------------------------------------------------------------------------------------------*/\n\nconst VIEWPORT_NAME = 'ScrollAreaViewport';\nconst Slottable = createSlottable(VIEWPORT_NAME);\n\ntype ScrollAreaViewportElement = React.ComponentRef;\ninterface ScrollAreaViewportProps extends PrimitiveDivProps {\n nonce?: string | undefined;\n /**\n * Disables implicit rendering of an additional wrapper element that measures\n * the content size. When `true`, a child `` must be\n * rendered as a direct child of the viewport.\n *\n * Implicit rendering of the content element will be removed in the next major\n * release.\n */\n disableImplicitContentElement?: boolean | undefined;\n}\n\nconst ScrollAreaViewport = /* @__PURE__ */ React.forwardRef<\n ScrollAreaViewportElement,\n ScrollAreaViewportProps\n>(\n // blank line to reduce diff noise\n function ScrollAreaViewport(props: ScopedProps, forwardedRef) {\n const { __scopeScrollArea, children, nonce, disableImplicitContentElement, ...viewportProps } =\n props;\n const context = useScrollAreaContext(VIEWPORT_NAME, __scopeScrollArea);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref, context.onViewportChange);\n\n // `Slot` can only redirect props onto a single element, so `asChild` can\n // only reach the consumer's element when `children` is one.\n const canSlotOntoChildren = React.isValidElement(children);\n\n // oxlint-disable react-hooks/rules-of-hooks\n if (IS_DEVELOPMENT) {\n const hasWarnedRef = React.useRef(false);\n const shouldWarn =\n props.asChild === true && !disableImplicitContentElement && !canSlotOntoChildren;\n React.useEffect(() => {\n if (shouldWarn && !hasWarnedRef.current) {\n hasWarnedRef.current = true;\n console.warn(\n `${VIEWPORT_NAME}: \\`asChild\\` expects a single React element child, so its props have been applied to the implicitly rendered content element instead. Wrap the children in a single element, or opt into \\`disableImplicitContentElement\\` and render a \\`ScrollArea.Content\\` inside the viewport.`,\n );\n }\n }, [shouldWarn]);\n }\n // oxlint-enable react-hooks/rules-of-hooks\n\n return (\n <>\n \n

= P & { + __scopeSelect?: Scope | undefined; +}; +declare const createSelectScope: _radix_ui_react_context.CreateScope; +interface SelectSharedProps { + children?: React.ReactNode | undefined; + open?: boolean | undefined; + defaultOpen?: boolean | undefined; + onOpenChange?: ((open: boolean) => void) | undefined; + dir?: Direction | undefined; + name?: string | undefined; + autoComplete?: string | undefined; + disabled?: boolean | undefined; + required?: boolean | undefined; + form?: string | undefined; +} +type SelectProps = SelectSharedProps & { + value?: string | undefined; + defaultValue?: string | undefined; + onValueChange?: ((value: string) => void) | undefined; +}; +interface SelectProviderProps extends SelectSharedProps { + value?: string | undefined; + defaultValue?: string | undefined; + onValueChange?: ((value: string) => void) | undefined; +} +declare function SelectProvider(props: ScopedProps): React.JSX.Element; +declare const Select: React.FC; +type PrimitiveButtonProps = React.ComponentPropsWithoutRef; +interface SelectTriggerProps extends PrimitiveButtonProps { +} +declare const SelectTrigger: React.ForwardRefExoticComponent>; +type PrimitiveSpanProps = React.ComponentPropsWithoutRef; +interface SelectValueProps extends Omit { + placeholder?: React.ReactNode | undefined; +} +declare const SelectValue: React.ForwardRefExoticComponent>; +interface SelectIconProps extends PrimitiveSpanProps { +} +declare const SelectIcon: React.ForwardRefExoticComponent>; +type PortalProps = React.ComponentPropsWithoutRef; +interface SelectPortalProps { + children?: React.ReactNode | undefined; + /** + * Specify a container element to portal the content into. + */ + container?: PortalProps['container'] | undefined; + /** + * Used to force mounting when more control is needed. Useful when controlling + * animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const SelectPortal: React.FC; +interface SelectContentProps extends SelectContentImplProps { + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const SelectContent: React.ForwardRefExoticComponent>; +type DismissableLayerProps = React.ComponentPropsWithoutRef; +type FocusScopeProps = React.ComponentPropsWithoutRef; +type SelectPopperPrivateProps = { + onPlaced?: PopperContentProps['onPlaced'] | undefined; +}; +interface SelectContentImplProps extends Omit, Omit { + /** + * Event handler called when auto-focusing on close. + * Can be prevented. + */ + onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'] | undefined; + /** + * Event handler called when the escape key is down. + * Can be prevented. + */ + onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'] | undefined; + /** + * Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`. + * Can be prevented. + */ + onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'] | undefined; + position?: Position | undefined; +} +interface SelectItemAlignedPositionProps extends PrimitiveDivProps, SelectPopperPrivateProps { +} +type PopperContentProps = React.ComponentPropsWithoutRef; +interface SelectPopperPositionProps extends PopperContentProps, SelectPopperPrivateProps { +} +type PrimitiveDivProps = React.ComponentPropsWithoutRef; +interface SelectViewportProps extends PrimitiveDivProps { + nonce?: string | undefined; +} +declare const SelectViewport: React.ForwardRefExoticComponent>; +interface SelectGroupProps extends PrimitiveDivProps { +} +declare const SelectGroup: React.ForwardRefExoticComponent>; +interface SelectLabelProps extends PrimitiveDivProps { +} +declare const SelectLabel: React.ForwardRefExoticComponent>; +interface SelectItemProps extends PrimitiveDivProps { + value: string; + disabled?: boolean | undefined; + textValue?: string | undefined; +} +declare const SelectItem: React.ForwardRefExoticComponent>; +interface SelectItemTextProps extends PrimitiveSpanProps { +} +declare const SelectItemText: React.ForwardRefExoticComponent>; +interface SelectItemIndicatorProps extends PrimitiveSpanProps { +} +declare const SelectItemIndicator: React.ForwardRefExoticComponent>; +interface SelectScrollUpButtonProps extends Omit { +} +declare const SelectScrollUpButton: React.ForwardRefExoticComponent>; +interface SelectScrollDownButtonProps extends Omit { +} +declare const SelectScrollDownButton: React.ForwardRefExoticComponent>; +interface SelectScrollButtonImplProps extends PrimitiveDivProps { + onAutoScroll(): void; +} +interface SelectSeparatorProps extends PrimitiveDivProps { +} +declare const SelectSeparator: React.ForwardRefExoticComponent>; +type PopperArrowProps = React.ComponentPropsWithoutRef; +interface SelectArrowProps extends PopperArrowProps { +} +declare const SelectArrow: React.ForwardRefExoticComponent>; +type PrimitiveSelectProps = React.ComponentPropsWithoutRef; +interface SelectBubbleInputProps extends Omit { +} +declare const SelectBubbleInput: React.ForwardRefExoticComponent>; + +export { SelectArrow as Arrow, SelectContent as Content, SelectGroup as Group, SelectIcon as Icon, SelectItem as Item, SelectItemIndicator as ItemIndicator, SelectItemText as ItemText, SelectLabel as Label, SelectPortal as Portal, Select as Root, SelectScrollDownButton as ScrollDownButton, SelectScrollUpButton as ScrollUpButton, Select, SelectArrow, type SelectArrowProps, SelectContent, type SelectContentProps, SelectGroup, type SelectGroupProps, SelectIcon, type SelectIconProps, SelectItem, SelectItemIndicator, type SelectItemIndicatorProps, type SelectItemProps, SelectItemText, type SelectItemTextProps, SelectLabel, type SelectLabelProps, SelectPortal, type SelectPortalProps, type SelectProps, SelectScrollDownButton, type SelectScrollDownButtonProps, SelectScrollUpButton, type SelectScrollUpButtonProps, SelectSeparator, type SelectSeparatorProps, type SelectSharedProps, SelectTrigger, type SelectTriggerProps, SelectValue, type SelectValueProps, SelectViewport, type SelectViewportProps, SelectSeparator as Separator, SelectTrigger as Trigger, SelectValue as Value, SelectViewport as Viewport, createSelectScope, SelectBubbleInput as unstable_BubbleInput, SelectProvider as unstable_Provider, SelectBubbleInput as unstable_SelectBubbleInput, type SelectBubbleInputProps as unstable_SelectBubbleInputProps, SelectProvider as unstable_SelectProvider, type SelectProviderProps as unstable_SelectProviderProps }; diff --git a/e-commerce/node_modules/@radix-ui/react-select/dist/index.d.ts b/e-commerce/node_modules/@radix-ui/react-select/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..362f2ddb9929b7ab7dfdfdd4f3c0d5be52043526 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-select/dist/index.d.ts @@ -0,0 +1,154 @@ +import * as _radix_ui_react_context from '@radix-ui/react-context'; +import { Scope } from '@radix-ui/react-context'; +import * as React from 'react'; +import { DismissableLayer } from '@radix-ui/react-dismissable-layer'; +import { FocusScope } from '@radix-ui/react-focus-scope'; +import * as PopperPrimitive from '@radix-ui/react-popper'; +import { Portal } from '@radix-ui/react-portal'; +import { Primitive } from '@radix-ui/react-primitive'; + +declare const Position: { + readonly ItemAligned: "item-aligned"; + readonly Popper: "popper"; +}; +type Position = (typeof Position)[keyof typeof Position]; +declare const Direction: { + readonly LTR: "ltr"; + readonly RTL: "rtl"; +}; +type Direction = (typeof Direction)[keyof typeof Direction]; +type ScopedProps

= P & { + __scopeSelect?: Scope | undefined; +}; +declare const createSelectScope: _radix_ui_react_context.CreateScope; +interface SelectSharedProps { + children?: React.ReactNode | undefined; + open?: boolean | undefined; + defaultOpen?: boolean | undefined; + onOpenChange?: ((open: boolean) => void) | undefined; + dir?: Direction | undefined; + name?: string | undefined; + autoComplete?: string | undefined; + disabled?: boolean | undefined; + required?: boolean | undefined; + form?: string | undefined; +} +type SelectProps = SelectSharedProps & { + value?: string | undefined; + defaultValue?: string | undefined; + onValueChange?: ((value: string) => void) | undefined; +}; +interface SelectProviderProps extends SelectSharedProps { + value?: string | undefined; + defaultValue?: string | undefined; + onValueChange?: ((value: string) => void) | undefined; +} +declare function SelectProvider(props: ScopedProps): React.JSX.Element; +declare const Select: React.FC; +type PrimitiveButtonProps = React.ComponentPropsWithoutRef; +interface SelectTriggerProps extends PrimitiveButtonProps { +} +declare const SelectTrigger: React.ForwardRefExoticComponent>; +type PrimitiveSpanProps = React.ComponentPropsWithoutRef; +interface SelectValueProps extends Omit { + placeholder?: React.ReactNode | undefined; +} +declare const SelectValue: React.ForwardRefExoticComponent>; +interface SelectIconProps extends PrimitiveSpanProps { +} +declare const SelectIcon: React.ForwardRefExoticComponent>; +type PortalProps = React.ComponentPropsWithoutRef; +interface SelectPortalProps { + children?: React.ReactNode | undefined; + /** + * Specify a container element to portal the content into. + */ + container?: PortalProps['container'] | undefined; + /** + * Used to force mounting when more control is needed. Useful when controlling + * animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const SelectPortal: React.FC; +interface SelectContentProps extends SelectContentImplProps { + /** + * Used to force mounting when more control is needed. Useful when + * controlling animation with React animation libraries. + */ + forceMount?: true | undefined; +} +declare const SelectContent: React.ForwardRefExoticComponent>; +type DismissableLayerProps = React.ComponentPropsWithoutRef; +type FocusScopeProps = React.ComponentPropsWithoutRef; +type SelectPopperPrivateProps = { + onPlaced?: PopperContentProps['onPlaced'] | undefined; +}; +interface SelectContentImplProps extends Omit, Omit { + /** + * Event handler called when auto-focusing on close. + * Can be prevented. + */ + onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'] | undefined; + /** + * Event handler called when the escape key is down. + * Can be prevented. + */ + onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'] | undefined; + /** + * Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`. + * Can be prevented. + */ + onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'] | undefined; + position?: Position | undefined; +} +interface SelectItemAlignedPositionProps extends PrimitiveDivProps, SelectPopperPrivateProps { +} +type PopperContentProps = React.ComponentPropsWithoutRef; +interface SelectPopperPositionProps extends PopperContentProps, SelectPopperPrivateProps { +} +type PrimitiveDivProps = React.ComponentPropsWithoutRef; +interface SelectViewportProps extends PrimitiveDivProps { + nonce?: string | undefined; +} +declare const SelectViewport: React.ForwardRefExoticComponent>; +interface SelectGroupProps extends PrimitiveDivProps { +} +declare const SelectGroup: React.ForwardRefExoticComponent>; +interface SelectLabelProps extends PrimitiveDivProps { +} +declare const SelectLabel: React.ForwardRefExoticComponent>; +interface SelectItemProps extends PrimitiveDivProps { + value: string; + disabled?: boolean | undefined; + textValue?: string | undefined; +} +declare const SelectItem: React.ForwardRefExoticComponent>; +interface SelectItemTextProps extends PrimitiveSpanProps { +} +declare const SelectItemText: React.ForwardRefExoticComponent>; +interface SelectItemIndicatorProps extends PrimitiveSpanProps { +} +declare const SelectItemIndicator: React.ForwardRefExoticComponent>; +interface SelectScrollUpButtonProps extends Omit { +} +declare const SelectScrollUpButton: React.ForwardRefExoticComponent>; +interface SelectScrollDownButtonProps extends Omit { +} +declare const SelectScrollDownButton: React.ForwardRefExoticComponent>; +interface SelectScrollButtonImplProps extends PrimitiveDivProps { + onAutoScroll(): void; +} +interface SelectSeparatorProps extends PrimitiveDivProps { +} +declare const SelectSeparator: React.ForwardRefExoticComponent>; +type PopperArrowProps = React.ComponentPropsWithoutRef; +interface SelectArrowProps extends PopperArrowProps { +} +declare const SelectArrow: React.ForwardRefExoticComponent>; +type PrimitiveSelectProps = React.ComponentPropsWithoutRef; +interface SelectBubbleInputProps extends Omit { +} +declare const SelectBubbleInput: React.ForwardRefExoticComponent>; + +export { SelectArrow as Arrow, SelectContent as Content, SelectGroup as Group, SelectIcon as Icon, SelectItem as Item, SelectItemIndicator as ItemIndicator, SelectItemText as ItemText, SelectLabel as Label, SelectPortal as Portal, Select as Root, SelectScrollDownButton as ScrollDownButton, SelectScrollUpButton as ScrollUpButton, Select, SelectArrow, type SelectArrowProps, SelectContent, type SelectContentProps, SelectGroup, type SelectGroupProps, SelectIcon, type SelectIconProps, SelectItem, SelectItemIndicator, type SelectItemIndicatorProps, type SelectItemProps, SelectItemText, type SelectItemTextProps, SelectLabel, type SelectLabelProps, SelectPortal, type SelectPortalProps, type SelectProps, SelectScrollDownButton, type SelectScrollDownButtonProps, SelectScrollUpButton, type SelectScrollUpButtonProps, SelectSeparator, type SelectSeparatorProps, type SelectSharedProps, SelectTrigger, type SelectTriggerProps, SelectValue, type SelectValueProps, SelectViewport, type SelectViewportProps, SelectSeparator as Separator, SelectTrigger as Trigger, SelectValue as Value, SelectViewport as Viewport, createSelectScope, SelectBubbleInput as unstable_BubbleInput, SelectProvider as unstable_Provider, SelectBubbleInput as unstable_SelectBubbleInput, type SelectBubbleInputProps as unstable_SelectBubbleInputProps, SelectProvider as unstable_SelectProvider, type SelectProviderProps as unstable_SelectProviderProps }; diff --git a/e-commerce/node_modules/@radix-ui/react-select/dist/index.js b/e-commerce/node_modules/@radix-ui/react-select/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..cbf979150635ccf619d7e74f7681d92b7564eb8b --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-select/dist/index.js @@ -0,0 +1,1325 @@ +"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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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: () => SelectArrow, + Content: () => SelectContent, + Group: () => SelectGroup, + Icon: () => SelectIcon, + Item: () => SelectItem, + ItemIndicator: () => SelectItemIndicator, + ItemText: () => SelectItemText, + Label: () => SelectLabel, + Portal: () => SelectPortal, + Root: () => Select, + ScrollDownButton: () => SelectScrollDownButton, + ScrollUpButton: () => SelectScrollUpButton, + Select: () => Select, + SelectArrow: () => SelectArrow, + SelectContent: () => SelectContent, + SelectGroup: () => SelectGroup, + SelectIcon: () => SelectIcon, + SelectItem: () => SelectItem, + SelectItemIndicator: () => SelectItemIndicator, + SelectItemText: () => SelectItemText, + SelectLabel: () => SelectLabel, + SelectPortal: () => SelectPortal, + SelectScrollDownButton: () => SelectScrollDownButton, + SelectScrollUpButton: () => SelectScrollUpButton, + SelectSeparator: () => SelectSeparator, + SelectTrigger: () => SelectTrigger, + SelectValue: () => SelectValue, + SelectViewport: () => SelectViewport, + Separator: () => SelectSeparator, + Trigger: () => SelectTrigger, + Value: () => SelectValue, + Viewport: () => SelectViewport, + createSelectScope: () => createSelectScope, + unstable_BubbleInput: () => SelectBubbleInput, + unstable_Provider: () => SelectProvider, + unstable_SelectBubbleInput: () => SelectBubbleInput, + unstable_SelectProvider: () => SelectProvider +}); +module.exports = __toCommonJS(index_exports); + +// src/select.tsx +var React = __toESM(require("react")); +var ReactDOM = __toESM(require("react-dom")); +var import_number = require("@radix-ui/number"); +var import_primitive = require("@radix-ui/primitive"); +var import_react_collection = require("@radix-ui/react-collection"); +var import_react_compose_refs = require("@radix-ui/react-compose-refs"); +var import_react_context = require("@radix-ui/react-context"); +var import_react_direction = require("@radix-ui/react-direction"); +var import_react_dismissable_layer = require("@radix-ui/react-dismissable-layer"); +var import_react_focus_guards = require("@radix-ui/react-focus-guards"); +var import_react_focus_scope = require("@radix-ui/react-focus-scope"); +var import_react_id = require("@radix-ui/react-id"); +var PopperPrimitive = __toESM(require("@radix-ui/react-popper")); +var import_react_popper = require("@radix-ui/react-popper"); +var import_react_portal = require("@radix-ui/react-portal"); +var import_react_presence = require("@radix-ui/react-presence"); +var import_react_primitive = require("@radix-ui/react-primitive"); +var import_react_slot = require("@radix-ui/react-slot"); +var import_react_use_callback_ref = require("@radix-ui/react-use-callback-ref"); +var import_react_use_controllable_state = require("@radix-ui/react-use-controllable-state"); +var import_react_use_layout_effect = require("@radix-ui/react-use-layout-effect"); +var import_react_visually_hidden = require("@radix-ui/react-visually-hidden"); +var import_aria_hidden = require("aria-hidden"); +var import_react_remove_scroll = require("react-remove-scroll"); +var import_jsx_runtime = require("react/jsx-runtime"); +var Position = { + ItemAligned: "item-aligned", + Popper: "popper" +}; +var Direction = { + LTR: "ltr", + RTL: "rtl" +}; +var OPEN_KEYS = [" ", "Enter", "ArrowUp", "ArrowDown"]; +var SELECTION_KEYS = [" ", "Enter"]; +var SELECT_NAME = "Select"; +var [Collection, useCollection, createCollectionScope] = (0, import_react_collection.createCollection)(SELECT_NAME); +var [createSelectContext, createSelectScope] = (0, import_react_context.createContextScope)(SELECT_NAME, [ + createCollectionScope, + import_react_popper.createPopperScope +]); +var usePopperScope = (0, import_react_popper.createPopperScope)(); +var [SelectProviderImpl, useSelectContext] = createSelectContext(SELECT_NAME); +var [SelectNativeOptionsProvider, useSelectNativeOptionsContext] = createSelectContext(SELECT_NAME); +function SelectProvider(props) { + const { + __scopeSelect, + children, + open: openProp, + defaultOpen, + onOpenChange, + value: valueProp, + defaultValue, + onValueChange, + dir, + name, + autoComplete, + disabled, + required, + form, + // @ts-expect-error internal render prop used by `Select` to compose its default parts + internal_do_not_use_render + } = props; + const popperScope = usePopperScope(__scopeSelect); + const [trigger, setTrigger] = React.useState(null); + const [valueNode, setValueNode] = React.useState(null); + const [valueNodeHasChildren, setValueNodeHasChildren] = React.useState(false); + const direction = (0, import_react_direction.useDirection)(dir); + const [open, setOpen] = (0, import_react_use_controllable_state.useControllableState)({ + prop: openProp, + defaultProp: defaultOpen ?? false, + onChange: onOpenChange, + caller: SELECT_NAME + }); + const [value, setValue] = (0, import_react_use_controllable_state.useControllableState)({ + prop: valueProp, + defaultProp: defaultValue, + onChange: onValueChange, + caller: SELECT_NAME + }); + const triggerPointerDownPosRef = React.useRef(null); + const hasConsumerStoppedPropagationRef = React.useRef(false); + const [userSelection, setUserSelection] = React.useState(null); + const handleUserSelect = /* @__PURE__ */ __name((nextValue) => { + setUserSelection({ + value: nextValue, + hasConsumerStoppedPropagation: hasConsumerStoppedPropagationRef.current + }); + setValue(nextValue); + }, "handleUserSelect"); + const initialValueRef = React.useRef(value); + React.useEffect(() => { + const associatedForm = form ? trigger?.ownerDocument.getElementById(form) : trigger?.form; + if (associatedForm instanceof HTMLFormElement) { + const reset = /* @__PURE__ */ __name(() => setValue(initialValueRef.current), "reset"); + associatedForm.addEventListener("reset", reset); + return () => associatedForm.removeEventListener("reset", reset); + } + }, [form, trigger, setValue]); + const isFormControl = trigger ? !!form || !!trigger.closest("form") : true; + const [nativeOptionsSet, setNativeOptionsSet] = React.useState(/* @__PURE__ */ new Set()); + const contentId = (0, import_react_id.useId)(); + const nativeSelectKey = Array.from(nativeOptionsSet).map((option) => option.props.value).join(";"); + const handleNativeOptionAdd = React.useCallback((option) => { + setNativeOptionsSet((prev) => new Set(prev).add(option)); + }, []); + const handleNativeOptionRemove = React.useCallback((option) => { + setNativeOptionsSet((prev) => { + const optionsSet = new Set(prev); + optionsSet.delete(option); + return optionsSet; + }); + }, []); + const context = { + required, + trigger, + onTriggerChange: setTrigger, + valueNode, + onValueNodeChange: setValueNode, + valueNodeHasChildren, + onValueNodeHasChildrenChange: setValueNodeHasChildren, + contentId, + value, + onValueChange: setValue, + hasConsumerStoppedPropagationRef, + userSelection, + onUserSelect: handleUserSelect, + open, + onOpenChange: setOpen, + dir: direction, + triggerPointerDownPosRef, + disabled, + name, + autoComplete, + form, + nativeOptions: nativeOptionsSet, + nativeSelectKey, + isFormControl + }; + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperPrimitive.Root, { ...popperScope, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectProviderImpl, { scope: __scopeSelect, ...context, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Provider, { scope: __scopeSelect, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + SelectNativeOptionsProvider, + { + scope: __scopeSelect, + onNativeOptionAdd: handleNativeOptionAdd, + onNativeOptionRemove: handleNativeOptionRemove, + children: isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children + } + ) }) }) }); +} +__name(SelectProvider, "SelectProvider"); +var Select = /* @__PURE__ */ __name((props) => { + const { __scopeSelect, children, ...providerProps } = props; + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + SelectProvider, + { + __scopeSelect, + ...providerProps, + internal_do_not_use_render: ({ isFormControl }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ + children, + isFormControl ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + SelectBubbleInput, + { + __scopeSelect + } + ) : null + ] }) + } + ); +}, "Select"); +var TRIGGER_NAME = "SelectTrigger"; +var SelectTrigger = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function SelectTrigger2(props, forwardedRef) { + const { __scopeSelect, disabled = false, ...triggerProps } = props; + const popperScope = usePopperScope(__scopeSelect); + const context = useSelectContext(TRIGGER_NAME, __scopeSelect); + const isDisabled = context.disabled || disabled; + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, context.onTriggerChange); + const getItems = useCollection(__scopeSelect); + const pointerTypeRef = React.useRef("touch"); + const [searchRef, handleTypeaheadSearch, resetTypeahead] = useTypeaheadSearch((search) => { + const enabledItems = getItems().filter((item) => !item.disabled); + const currentItem = enabledItems.find((item) => item.value === context.value); + const nextItem = findNextItem(enabledItems, search, currentItem); + if (nextItem !== void 0) { + context.onUserSelect(nextItem.value); + } + }); + const handleOpen = /* @__PURE__ */ __name((pointerEvent) => { + if (!isDisabled) { + context.onOpenChange(true); + resetTypeahead(); + } + if (pointerEvent) { + context.triggerPointerDownPosRef.current = { + x: Math.round(pointerEvent.pageX), + y: Math.round(pointerEvent.pageY) + }; + } + }, "handleOpen"); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperPrimitive.Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.button, + { + type: "button", + role: "combobox", + "aria-controls": context.open ? context.contentId : void 0, + "aria-expanded": context.open, + "aria-required": context.required, + "aria-autocomplete": "none", + dir: context.dir, + "data-state": context.open ? "open" : "closed", + disabled: isDisabled, + "data-disabled": isDisabled ? "" : void 0, + "data-placeholder": shouldShowPlaceholder(context.value) ? "" : void 0, + ...triggerProps, + ref: composedRefs, + onClick: (0, import_primitive.composeEventHandlers)(triggerProps.onClick, (event) => { + event.currentTarget.focus(); + if (pointerTypeRef.current !== "mouse") { + handleOpen(event); + } + }), + onPointerDown: (0, import_primitive.composeEventHandlers)(triggerProps.onPointerDown, (event) => { + pointerTypeRef.current = event.pointerType; + const target = event.target; + if (target.hasPointerCapture(event.pointerId)) { + target.releasePointerCapture(event.pointerId); + } + if (event.button === 0 && event.ctrlKey === false && event.pointerType === "mouse") { + handleOpen(event); + event.preventDefault(); + } + }), + onKeyDown: (0, import_primitive.composeEventHandlers)(triggerProps.onKeyDown, (event) => { + const isTypingAhead = searchRef.current !== ""; + const isModifierKey = event.ctrlKey || event.altKey || event.metaKey; + if (!isModifierKey && event.key.length === 1) { + context.hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(); + handleTypeaheadSearch(event.key); + } + if (isTypingAhead && event.key === " ") return; + if (OPEN_KEYS.includes(event.key)) { + handleOpen(); + event.preventDefault(); + } + }) + } + ) }); + }, "SelectTrigger") +); +var VALUE_NAME = "SelectValue"; +var SelectValue = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function SelectValue2(props, forwardedRef) { + const { __scopeSelect, className, style, children, placeholder = "", ...valueProps } = props; + const context = useSelectContext(VALUE_NAME, __scopeSelect); + const { onValueNodeHasChildrenChange } = context; + const hasChildren = children !== void 0; + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, context.onValueNodeChange); + (0, import_react_use_layout_effect.useLayoutEffect)(() => { + onValueNodeHasChildrenChange(hasChildren); + }, [onValueNodeHasChildrenChange, hasChildren]); + const showPlaceholder = shouldShowPlaceholder(context.value); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.span, + { + ...valueProps, + asChild: showPlaceholder ? false : valueProps.asChild, + ref: composedRefs, + style: { pointerEvents: "none" }, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(React.Fragment, { children: showPlaceholder ? placeholder : children }, showPlaceholder ? "placeholder" : "value") + } + ); + }, "SelectValue") +); +var SelectIcon = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function SelectIcon2(props, forwardedRef) { + const { __scopeSelect, children, ...iconProps } = props; + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.span, { "aria-hidden": true, ...iconProps, ref: forwardedRef, children: children || "\u25BC" }); + }, "SelectIcon") +); +var PORTAL_NAME = "SelectPortal"; +var [PortalProvider, usePortalContext] = createSelectContext(PORTAL_NAME, { + forceMount: void 0 +}); +var SelectPortal = /* @__PURE__ */ __name((props) => { + const { __scopeSelect, forceMount, ...portalProps } = props; + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PortalProvider, { scope: props.__scopeSelect, forceMount, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_portal.Portal, { asChild: true, ...portalProps }) }); +}, "SelectPortal"); +var CONTENT_NAME = "SelectContent"; +var SelectContent = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function SelectContent2(props, forwardedRef) { + const portalContext = usePortalContext(CONTENT_NAME, props.__scopeSelect); + const { forceMount = portalContext.forceMount, ...contentProps } = props; + const context = useSelectContext(CONTENT_NAME, props.__scopeSelect); + const [fragment, setFragment] = React.useState(); + (0, import_react_use_layout_effect.useLayoutEffect)(() => { + setFragment(new DocumentFragment()); + }, []); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || context.open, children: ({ present }) => present ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContentImpl, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContentFragment, { ...contentProps, fragment }) }); + }, "SelectContent") +); +var SelectContentFragment = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function SelectContentFragment2(props, forwardedRef) { + const { __scopeSelect, children, fragment } = props; + if (!fragment) return null; + return ReactDOM.createPortal( + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContentProvider, { scope: __scopeSelect, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Slot, { scope: __scopeSelect, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: forwardedRef, children }) }) }), + fragment + ); +}, "SelectContentFragment")); +var CONTENT_MARGIN = 10; +var [SelectContentProvider, useSelectContentContext] = createSelectContext(CONTENT_NAME); +var Slot = (0, import_react_slot.createSlot)("SelectContent.RemoveScroll"); +var SelectContentImpl = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function SelectContentImpl2(props, forwardedRef) { + const { __scopeSelect } = props; + const { + position = Position.ItemAligned, + onCloseAutoFocus, + onEscapeKeyDown, + onPointerDownOutside, + // + // PopperContent props + side, + sideOffset, + align, + alignOffset, + arrowPadding, + collisionBoundary, + collisionPadding, + sticky, + hideWhenDetached, + avoidCollisions, + // + ...contentProps + } = props; + const context = useSelectContext(CONTENT_NAME, __scopeSelect); + const [content, setContent] = React.useState(null); + const [viewport, setViewport] = React.useState(null); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, setContent); + const [selectedItem, setSelectedItem] = React.useState(null); + const [selectedItemText, setSelectedItemText] = React.useState( + null + ); + const getItems = useCollection(__scopeSelect); + const [isPositioned, setIsPositioned] = React.useState(false); + const firstValidItemFoundRef = React.useRef(false); + const firstItemFoundRef = React.useRef(false); + const firstItemTextFoundRef = React.useRef(false); + React.useEffect(() => { + if (content) return (0, import_aria_hidden.hideOthers)(content); + }, [content]); + (0, import_react_focus_guards.useFocusGuards)(); + const focusFirst = React.useCallback( + (candidates) => { + const [firstItem, ...restItems] = getItems().map((item) => item.ref.current); + const [lastItem] = restItems.slice(-1); + const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement; + for (const candidate of candidates) { + if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return; + candidate?.scrollIntoView({ block: "nearest" }); + if (candidate === firstItem && viewport) viewport.scrollTop = 0; + if (candidate === lastItem && viewport) viewport.scrollTop = viewport.scrollHeight; + candidate?.focus(); + if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return; + } + }, + [getItems, viewport] + ); + const focusSelectedItem = React.useCallback( + () => focusFirst([selectedItem, content]), + [focusFirst, selectedItem, content] + ); + React.useEffect(() => { + if (isPositioned) { + focusSelectedItem(); + } + }, [isPositioned, focusSelectedItem]); + const { onOpenChange, triggerPointerDownPosRef } = context; + React.useEffect(() => { + if (content) { + let pointerMoveDelta = { x: 0, y: 0 }; + const handlePointerMove = /* @__PURE__ */ __name((event) => { + pointerMoveDelta = { + x: Math.abs(Math.round(event.pageX) - (triggerPointerDownPosRef.current?.x ?? 0)), + y: Math.abs(Math.round(event.pageY) - (triggerPointerDownPosRef.current?.y ?? 0)) + }; + }, "handlePointerMove"); + const handlePointerUp = /* @__PURE__ */ __name((event) => { + if (pointerMoveDelta.x <= 10 && pointerMoveDelta.y <= 10) { + event.preventDefault(); + } else { + if (!event.composedPath().includes(content)) { + onOpenChange(false); + } + } + document.removeEventListener("pointermove", handlePointerMove); + triggerPointerDownPosRef.current = null; + }, "handlePointerUp"); + if (triggerPointerDownPosRef.current !== null) { + document.addEventListener("pointermove", handlePointerMove); + document.addEventListener("pointerup", handlePointerUp, { capture: true, once: true }); + } + return () => { + document.removeEventListener("pointermove", handlePointerMove); + document.removeEventListener("pointerup", handlePointerUp, { capture: true }); + }; + } + }, [content, onOpenChange, triggerPointerDownPosRef]); + React.useEffect(() => { + const close = /* @__PURE__ */ __name(() => onOpenChange(false), "close"); + window.addEventListener("blur", close); + window.addEventListener("resize", close); + return () => { + window.removeEventListener("blur", close); + window.removeEventListener("resize", close); + }; + }, [onOpenChange]); + const [searchRef, handleTypeaheadSearch] = useTypeaheadSearch((search) => { + const enabledItems = getItems().filter((item) => !item.disabled); + const currentItem = enabledItems.find((item) => item.ref.current === document.activeElement); + const nextItem = findNextItem(enabledItems, search, currentItem); + if (nextItem) { + setTimeout(() => nextItem.ref.current?.focus()); + } + }); + const itemRefCallback = React.useCallback( + (node, value, disabled) => { + const isFirstItem = !firstItemFoundRef.current; + if (isFirstItem) firstItemFoundRef.current = true; + const isFirstValidItem = !firstValidItemFoundRef.current && !disabled; + const isSelectedItem = context.value !== void 0 && context.value === value; + if (isSelectedItem || isFirstValidItem) { + setSelectedItem(node); + if (isFirstValidItem) firstValidItemFoundRef.current = true; + } else if (isFirstItem) { + setSelectedItem(node); + } + }, + [context.value] + ); + const handleItemLeave = React.useCallback(() => content?.focus(), [content]); + const itemTextRefCallback = React.useCallback( + (node, value, disabled) => { + if (!node) return; + const isFirstItem = !firstItemTextFoundRef.current; + if (isFirstItem) firstItemTextFoundRef.current = true; + const isFirstValidItem = !firstValidItemFoundRef.current && !disabled; + const isSelectedItem = context.value !== void 0 && context.value === value; + if (isSelectedItem || isFirstValidItem) { + setSelectedItemText(node); + } else if (isFirstItem) { + setSelectedItemText(node); + } + }, + [context.value] + ); + const SelectPosition = position === Position.Popper ? SelectPopperPosition : SelectItemAlignedPosition; + const popperContentProps = SelectPosition === SelectPopperPosition ? { + side, + sideOffset, + align, + alignOffset, + arrowPadding, + collisionBoundary, + collisionPadding, + sticky, + hideWhenDetached, + avoidCollisions + } : {}; + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + SelectContentProvider, + { + scope: __scopeSelect, + content, + viewport, + onViewportChange: setViewport, + itemRefCallback, + selectedItem, + onItemLeave: handleItemLeave, + itemTextRefCallback, + focusSelectedItem, + selectedItemText, + position, + isPositioned, + searchRef, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_remove_scroll.RemoveScroll, { as: Slot, allowPinchZoom: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_focus_scope.FocusScope, + { + asChild: true, + trapped: context.open, + onMountAutoFocus: (event) => { + event.preventDefault(); + }, + onUnmountAutoFocus: (0, import_primitive.composeEventHandlers)(onCloseAutoFocus, (event) => { + context.trigger?.focus({ preventScroll: true }); + event.preventDefault(); + }), + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_dismissable_layer.DismissableLayer, + { + asChild: true, + disableOutsidePointerEvents: true, + onEscapeKeyDown, + onPointerDownOutside, + onFocusOutside: (event) => event.preventDefault(), + onDismiss: () => context.onOpenChange(false), + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + SelectPosition, + { + role: "listbox", + id: context.contentId, + "data-state": context.open ? "open" : "closed", + dir: context.dir, + onContextMenu: (event) => event.preventDefault(), + ...contentProps, + ...popperContentProps, + onPlaced: () => setIsPositioned(true), + ref: composedRefs, + style: { + // flex layout so we can place the scroll buttons properly + display: "flex", + flexDirection: "column", + // reset the outline by default as the content MAY get focused + outline: "none", + ...contentProps.style + }, + onKeyDown: (0, import_primitive.composeEventHandlers)(contentProps.onKeyDown, (event) => { + const isModifierKey = event.ctrlKey || event.altKey || event.metaKey; + if (event.key === "Tab") event.preventDefault(); + if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key); + if (["ArrowUp", "ArrowDown", "Home", "End"].includes(event.key)) { + const items = getItems().filter((item) => !item.disabled); + let candidateNodes = items.map((item) => item.ref.current); + if (["ArrowUp", "End"].includes(event.key)) { + candidateNodes = candidateNodes.slice().reverse(); + } + if (["ArrowUp", "ArrowDown"].includes(event.key)) { + const currentElement = event.target; + const currentIndex = candidateNodes.indexOf(currentElement); + candidateNodes = candidateNodes.slice(currentIndex + 1); + } + setTimeout(() => focusFirst(candidateNodes)); + event.preventDefault(); + } + }) + } + ) + } + ) + } + ) }) + } + ); + }, "SelectContentImpl") +); +var SelectItemAlignedPosition = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function SelectItemAlignedPosition2(props, forwardedRef) { + const { __scopeSelect, onPlaced, ...popperProps } = props; + const context = useSelectContext(CONTENT_NAME, __scopeSelect); + const contentContext = useSelectContentContext(CONTENT_NAME, __scopeSelect); + const [contentWrapper, setContentWrapper] = React.useState(null); + const [content, setContent] = React.useState(null); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, setContent); + const getItems = useCollection(__scopeSelect); + const shouldExpandOnScrollRef = React.useRef(false); + const shouldRepositionRef = React.useRef(true); + const { viewport, selectedItem, selectedItemText, focusSelectedItem } = contentContext; + const position = React.useCallback(() => { + if (context.trigger && context.valueNode && contentWrapper && content && viewport && selectedItem && selectedItemText) { + const triggerRect = context.trigger.getBoundingClientRect(); + const contentRect = content.getBoundingClientRect(); + const valueNodeRect = context.valueNode.getBoundingClientRect(); + const itemTextRect = selectedItemText.getBoundingClientRect(); + if (context.dir !== Direction.RTL) { + const itemTextOffset = itemTextRect.left - contentRect.left; + const left = valueNodeRect.left - itemTextOffset; + const leftDelta = triggerRect.left - left; + const minContentWidth = triggerRect.width + leftDelta; + const contentWidth = Math.max(minContentWidth, contentRect.width); + const rightEdge = window.innerWidth - CONTENT_MARGIN; + const clampedLeft = (0, import_number.clamp)(left, [ + CONTENT_MARGIN, + // Prevents the content from going off the starting edge of the + // viewport. It may still go off the ending edge, but this can be + // controlled by the user since they may want to manage overflow in a + // specific way. + // https://github.com/radix-ui/primitives/issues/2049 + Math.max(CONTENT_MARGIN, rightEdge - contentWidth) + ]); + contentWrapper.style.minWidth = minContentWidth + "px"; + contentWrapper.style.left = clampedLeft + "px"; + } else { + const itemTextOffset = contentRect.right - itemTextRect.right; + const right = window.innerWidth - valueNodeRect.right - itemTextOffset; + const rightDelta = window.innerWidth - triggerRect.right - right; + const minContentWidth = triggerRect.width + rightDelta; + const contentWidth = Math.max(minContentWidth, contentRect.width); + const leftEdge = window.innerWidth - CONTENT_MARGIN; + const clampedRight = (0, import_number.clamp)(right, [ + CONTENT_MARGIN, + Math.max(CONTENT_MARGIN, leftEdge - contentWidth) + ]); + contentWrapper.style.minWidth = minContentWidth + "px"; + contentWrapper.style.right = clampedRight + "px"; + } + const items = getItems(); + const availableHeight = window.innerHeight - CONTENT_MARGIN * 2; + const itemsHeight = viewport.scrollHeight; + const contentStyles = window.getComputedStyle(content); + const contentBorderTopWidth = parseInt(contentStyles.borderTopWidth, 10); + const contentPaddingTop = parseInt(contentStyles.paddingTop, 10); + const contentBorderBottomWidth = parseInt(contentStyles.borderBottomWidth, 10); + const contentPaddingBottom = parseInt(contentStyles.paddingBottom, 10); + const fullContentHeight = contentBorderTopWidth + contentPaddingTop + itemsHeight + contentPaddingBottom + contentBorderBottomWidth; + const minContentHeight = Math.min(selectedItem.offsetHeight * 5, fullContentHeight); + const viewportStyles = window.getComputedStyle(viewport); + const viewportPaddingTop = parseInt(viewportStyles.paddingTop, 10); + const viewportPaddingBottom = parseInt(viewportStyles.paddingBottom, 10); + const topEdgeToTriggerMiddle = triggerRect.top + triggerRect.height / 2 - CONTENT_MARGIN; + const triggerMiddleToBottomEdge = availableHeight - topEdgeToTriggerMiddle; + const selectedItemHalfHeight = selectedItem.offsetHeight / 2; + const itemOffsetMiddle = selectedItem.offsetTop + selectedItemHalfHeight; + const contentTopToItemMiddle = contentBorderTopWidth + contentPaddingTop + itemOffsetMiddle; + const itemMiddleToContentBottom = fullContentHeight - contentTopToItemMiddle; + const willAlignWithoutTopOverflow = contentTopToItemMiddle <= topEdgeToTriggerMiddle; + if (willAlignWithoutTopOverflow) { + const isLastItem = items.length > 0 && selectedItem === items[items.length - 1].ref.current; + contentWrapper.style.bottom = "0px"; + const viewportOffsetBottom = content.clientHeight - viewport.offsetTop - viewport.offsetHeight; + const clampedTriggerMiddleToBottomEdge = Math.max( + triggerMiddleToBottomEdge, + selectedItemHalfHeight + // viewport might have padding bottom, include it to avoid a scrollable viewport + (isLastItem ? viewportPaddingBottom : 0) + viewportOffsetBottom + contentBorderBottomWidth + ); + const height = contentTopToItemMiddle + clampedTriggerMiddleToBottomEdge; + contentWrapper.style.height = height + "px"; + } else { + const isFirstItem = items.length > 0 && selectedItem === items[0].ref.current; + contentWrapper.style.top = "0px"; + const clampedTopEdgeToTriggerMiddle = Math.max( + topEdgeToTriggerMiddle, + contentBorderTopWidth + viewport.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport + (isFirstItem ? viewportPaddingTop : 0) + selectedItemHalfHeight + ); + const height = clampedTopEdgeToTriggerMiddle + itemMiddleToContentBottom; + contentWrapper.style.height = height + "px"; + viewport.scrollTop = contentTopToItemMiddle - topEdgeToTriggerMiddle + viewport.offsetTop; + } + contentWrapper.style.margin = `${CONTENT_MARGIN}px 0`; + contentWrapper.style.minHeight = minContentHeight + "px"; + contentWrapper.style.maxHeight = availableHeight + "px"; + onPlaced?.(); + requestAnimationFrame(() => shouldExpandOnScrollRef.current = true); + } + }, [ + getItems, + context.trigger, + context.valueNode, + contentWrapper, + content, + viewport, + selectedItem, + selectedItemText, + context.dir, + onPlaced + ]); + (0, import_react_use_layout_effect.useLayoutEffect)(() => position(), [position]); + const [contentZIndex, setContentZIndex] = React.useState(); + (0, import_react_use_layout_effect.useLayoutEffect)(() => { + if (content) setContentZIndex(window.getComputedStyle(content).zIndex); + }, [content]); + const handleScrollButtonChange = React.useCallback( + (node) => { + if (node && shouldRepositionRef.current === true) { + position(); + focusSelectedItem?.(); + shouldRepositionRef.current = false; + } + }, + [position, focusSelectedItem] + ); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + SelectViewportProvider, + { + scope: __scopeSelect, + contentWrapper, + shouldExpandOnScrollRef, + onScrollButtonChange: handleScrollButtonChange, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + "div", + { + ref: setContentWrapper, + style: { + display: "flex", + flexDirection: "column", + position: "fixed", + zIndex: contentZIndex + }, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.div, + { + ...popperProps, + ref: composedRefs, + style: { + // When we get the height of the content, it includes borders. If we were to set + // the height without having `boxSizing: 'border-box'` it would be too big. + boxSizing: "border-box", + // We need to ensure the content doesn't get taller than the wrapper + maxHeight: "100%", + ...popperProps.style + } + } + ) + } + ) + } + ); +}, "SelectItemAlignedPosition")); +var SelectPopperPosition = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function SelectPopperPosition2(props, forwardedRef) { + const { + __scopeSelect, + align = "start", + collisionPadding = CONTENT_MARGIN, + ...popperProps + } = props; + const popperScope = usePopperScope(__scopeSelect); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + PopperPrimitive.Content, + { + ...popperScope, + ...popperProps, + ref: forwardedRef, + align, + collisionPadding, + style: { + // Ensure border-box for floating-ui calculations + boxSizing: "border-box", + ...popperProps.style, + // re-namespace exposed content custom properties + ...{ + "--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)", + "--radix-select-content-available-width": "var(--radix-popper-available-width)", + "--radix-select-content-available-height": "var(--radix-popper-available-height)", + "--radix-select-trigger-width": "var(--radix-popper-anchor-width)", + "--radix-select-trigger-height": "var(--radix-popper-anchor-height)" + } + } + } + ); +}, "SelectPopperPosition")); +var [SelectViewportProvider, useSelectViewportContext] = createSelectContext(CONTENT_NAME, {}); +var VIEWPORT_NAME = "SelectViewport"; +var SelectViewport = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function SelectViewport2(props, forwardedRef) { + const { __scopeSelect, nonce, ...viewportProps } = props; + const contentContext = useSelectContentContext(VIEWPORT_NAME, __scopeSelect); + const viewportContext = useSelectViewportContext(VIEWPORT_NAME, __scopeSelect); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, contentContext.onViewportChange); + const prevScrollTopRef = React.useRef(0); + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + "style", + { + dangerouslySetInnerHTML: { + __html: `[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}` + }, + nonce + } + ), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Slot, { scope: __scopeSelect, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.div, + { + "data-radix-select-viewport": "", + role: "presentation", + ...viewportProps, + ref: composedRefs, + style: { + // we use position: 'relative' here on the `viewport` so that when we call + // `selectedItem.offsetTop` in calculations, the offset is relative to the viewport + // (independent of the scrollUpButton). + position: "relative", + flex: 1, + // Viewport should only be scrollable in the vertical direction. + // This won't work in vertical writing modes, so we'll need to + // revisit this if/when that is supported + // https://developer.chrome.com/blog/vertical-form-controls + overflow: "hidden auto", + ...viewportProps.style + }, + onScroll: (0, import_primitive.composeEventHandlers)(viewportProps.onScroll, (event) => { + const viewport = event.currentTarget; + const { contentWrapper, shouldExpandOnScrollRef } = viewportContext; + if (shouldExpandOnScrollRef?.current && contentWrapper) { + const scrolledBy = Math.abs(prevScrollTopRef.current - viewport.scrollTop); + if (scrolledBy > 0) { + const availableHeight = window.innerHeight - CONTENT_MARGIN * 2; + const cssMinHeight = parseFloat(contentWrapper.style.minHeight); + const cssHeight = parseFloat(contentWrapper.style.height); + const prevHeight = Math.max(cssMinHeight, cssHeight); + if (prevHeight < availableHeight) { + const nextHeight = prevHeight + scrolledBy; + const clampedNextHeight = Math.min(availableHeight, nextHeight); + const heightDiff = nextHeight - clampedNextHeight; + contentWrapper.style.height = clampedNextHeight + "px"; + if (contentWrapper.style.bottom === "0px") { + viewport.scrollTop = heightDiff > 0 ? heightDiff : 0; + contentWrapper.style.justifyContent = "flex-end"; + } + } + } + } + prevScrollTopRef.current = viewport.scrollTop; + }) + } + ) }) + ] }); + }, "SelectViewport") +); +var GROUP_NAME = "SelectGroup"; +var [SelectGroupContextProvider, useSelectGroupContext] = createSelectContext(GROUP_NAME); +var SelectGroup = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function SelectGroup2(props, forwardedRef) { + const { __scopeSelect, ...groupProps } = props; + const groupId = (0, import_react_id.useId)(); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectGroupContextProvider, { scope: __scopeSelect, id: groupId, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.div, { role: "group", "aria-labelledby": groupId, ...groupProps, ref: forwardedRef }) }); + }, "SelectGroup") +); +var LABEL_NAME = "SelectLabel"; +var SelectLabel = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function SelectLabel2(props, forwardedRef) { + const { __scopeSelect, ...labelProps } = props; + const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.div, { id: groupContext.id, ...labelProps, ref: forwardedRef }); + }, "SelectLabel") +); +var ITEM_NAME = "SelectItem"; +var [SelectItemContextProvider, useSelectItemContext] = createSelectContext(ITEM_NAME); +var SelectItem = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function SelectItem2(props, forwardedRef) { + const { + __scopeSelect, + value, + disabled = false, + textValue: textValueProp, + ...itemProps + } = props; + const context = useSelectContext(ITEM_NAME, __scopeSelect); + const contentContext = useSelectContentContext(ITEM_NAME, __scopeSelect); + const isSelected = context.value === value; + const [textValue, setTextValue] = React.useState(textValueProp ?? ""); + const [isFocused, setIsFocused] = React.useState(false); + const handleItemRefCallback = (0, import_react_use_callback_ref.useCallbackRef)( + (node) => contentContext.itemRefCallback?.(node, value, disabled) + ); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, handleItemRefCallback); + const textId = (0, import_react_id.useId)(); + const pointerTypeRef = React.useRef("touch"); + function handleSelect(event) { + context.hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(); + context.onUserSelect(value); + context.onOpenChange(false); + } + __name(handleSelect, "handleSelect"); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + SelectItemContextProvider, + { + scope: __scopeSelect, + value, + disabled, + textId, + isSelected, + onItemTextChange: React.useCallback((node) => { + setTextValue((prevTextValue) => prevTextValue || (node?.textContent ?? "").trim()); + }, []), + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + Collection.ItemSlot, + { + scope: __scopeSelect, + value, + disabled, + textValue, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.div, + { + role: "option", + "aria-labelledby": textId, + "data-highlighted": isFocused ? "" : void 0, + "aria-selected": isSelected && isFocused, + "data-state": isSelected ? "checked" : "unchecked", + "aria-disabled": disabled || void 0, + "data-disabled": disabled ? "" : void 0, + tabIndex: disabled ? void 0 : -1, + ...itemProps, + ref: composedRefs, + onFocus: (0, import_primitive.composeEventHandlers)(itemProps.onFocus, () => setIsFocused(true)), + onBlur: (0, import_primitive.composeEventHandlers)(itemProps.onBlur, () => setIsFocused(false)), + onClick: (0, import_primitive.composeEventHandlers)(itemProps.onClick, (event) => { + if (disabled) { + return; + } + if (pointerTypeRef.current !== "mouse") { + handleSelect(event); + } + }), + onPointerUp: (0, import_primitive.composeEventHandlers)(itemProps.onPointerUp, (event) => { + if (disabled) { + return; + } + if (pointerTypeRef.current === "mouse") { + handleSelect(event); + } + }), + onPointerDown: (0, import_primitive.composeEventHandlers)(itemProps.onPointerDown, (event) => { + pointerTypeRef.current = event.pointerType; + }), + onPointerMove: (0, import_primitive.composeEventHandlers)(itemProps.onPointerMove, (event) => { + pointerTypeRef.current = event.pointerType; + if (disabled) { + contentContext.onItemLeave?.(); + } else if (pointerTypeRef.current === "mouse") { + event.currentTarget.focus({ preventScroll: true }); + } + }), + onPointerLeave: (0, import_primitive.composeEventHandlers)(itemProps.onPointerLeave, (event) => { + if (event.currentTarget === document.activeElement) { + contentContext.onItemLeave?.(); + } + }), + onKeyDown: (0, import_primitive.composeEventHandlers)(itemProps.onKeyDown, (event) => { + if (disabled || event.target !== event.currentTarget) { + return; + } + const isTypingAhead = contentContext.searchRef?.current !== ""; + if (isTypingAhead && event.key === " ") { + return; + } + if (SELECTION_KEYS.includes(event.key)) { + handleSelect(event); + } + if (event.key === " ") { + event.preventDefault(); + } + }) + } + ) + } + ) + } + ); + }, "SelectItem") +); +var ITEM_TEXT_NAME = "SelectItemText"; +var SelectItemText = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function SelectItemText2(props, forwardedRef) { + const { __scopeSelect, className, style, ...itemTextProps } = props; + const context = useSelectContext(ITEM_TEXT_NAME, __scopeSelect); + const contentContext = useSelectContentContext(ITEM_TEXT_NAME, __scopeSelect); + const itemContext = useSelectItemContext(ITEM_TEXT_NAME, __scopeSelect); + const nativeOptionsContext = useSelectNativeOptionsContext(ITEM_TEXT_NAME, __scopeSelect); + const [itemTextNode, setItemTextNode] = React.useState(null); + const handleItemTextRefCallback = (0, import_react_use_callback_ref.useCallbackRef)( + (node) => contentContext.itemTextRefCallback?.(node, itemContext.value, itemContext.disabled) + ); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)( + forwardedRef, + setItemTextNode, + itemContext.onItemTextChange, + handleItemTextRefCallback + ); + const textContent = itemTextNode?.textContent; + const nativeOption = React.useMemo( + () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: itemContext.value, disabled: itemContext.disabled, children: textContent }, itemContext.value), + [itemContext.disabled, itemContext.value, textContent] + ); + const { onNativeOptionAdd, onNativeOptionRemove } = nativeOptionsContext; + (0, import_react_use_layout_effect.useLayoutEffect)(() => { + onNativeOptionAdd(nativeOption); + return () => onNativeOptionRemove(nativeOption); + }, [onNativeOptionAdd, onNativeOptionRemove, nativeOption]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.span, { id: itemContext.textId, ...itemTextProps, ref: composedRefs }), + itemContext.isSelected && context.valueNode && !context.valueNodeHasChildren && !shouldShowPlaceholder(context.value) ? ReactDOM.createPortal(itemTextProps.children, context.valueNode) : null + ] }); + }, "SelectItemText") +); +var ITEM_INDICATOR_NAME = "SelectItemIndicator"; +var SelectItemIndicator = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function SelectItemIndicator2(props, forwardedRef) { + const { __scopeSelect, ...itemIndicatorProps } = props; + const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect); + return itemContext.isSelected ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.span, { "aria-hidden": true, ...itemIndicatorProps, ref: forwardedRef }) : null; + }, "SelectItemIndicator") +); +var SCROLL_UP_BUTTON_NAME = "SelectScrollUpButton"; +var SelectScrollUpButton = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function SelectScrollUpButton2(props, forwardedRef) { + const contentContext = useSelectContentContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect); + const viewportContext = useSelectViewportContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect); + const [canScrollUp, setCanScrollUp] = React.useState(false); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, viewportContext.onScrollButtonChange); + (0, import_react_use_layout_effect.useLayoutEffect)(() => { + if (contentContext.viewport && contentContext.isPositioned) { + let handleScroll2 = function() { + const canScrollUp2 = viewport.scrollTop > 0; + setCanScrollUp(canScrollUp2); + }; + var handleScroll = handleScroll2; + __name(handleScroll2, "handleScroll"); + const viewport = contentContext.viewport; + handleScroll2(); + viewport.addEventListener("scroll", handleScroll2); + return () => viewport.removeEventListener("scroll", handleScroll2); + } + }, [contentContext.viewport, contentContext.isPositioned]); + return canScrollUp ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + SelectScrollButtonImpl, + { + ...props, + ref: composedRefs, + onAutoScroll: () => { + const { viewport, selectedItem } = contentContext; + if (viewport && selectedItem) { + viewport.scrollTop = viewport.scrollTop - selectedItem.offsetHeight; + } + } + } + ) : null; +}, "SelectScrollUpButton")); +var SCROLL_DOWN_BUTTON_NAME = "SelectScrollDownButton"; +var SelectScrollDownButton = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function SelectScrollDownButton2(props, forwardedRef) { + const contentContext = useSelectContentContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect); + const viewportContext = useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect); + const [canScrollDown, setCanScrollDown] = React.useState(false); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, viewportContext.onScrollButtonChange); + (0, import_react_use_layout_effect.useLayoutEffect)(() => { + if (contentContext.viewport && contentContext.isPositioned) { + let handleScroll2 = function() { + const maxScroll = viewport.scrollHeight - viewport.clientHeight; + const canScrollDown2 = Math.ceil(viewport.scrollTop) < maxScroll; + setCanScrollDown(canScrollDown2); + }; + var handleScroll = handleScroll2; + __name(handleScroll2, "handleScroll"); + const viewport = contentContext.viewport; + handleScroll2(); + viewport.addEventListener("scroll", handleScroll2); + return () => viewport.removeEventListener("scroll", handleScroll2); + } + }, [contentContext.viewport, contentContext.isPositioned]); + return canScrollDown ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + SelectScrollButtonImpl, + { + ...props, + ref: composedRefs, + onAutoScroll: () => { + const { viewport, selectedItem } = contentContext; + if (viewport && selectedItem) { + viewport.scrollTop = viewport.scrollTop + selectedItem.offsetHeight; + } + } + } + ) : null; +}, "SelectScrollDownButton")); +var SelectScrollButtonImpl = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function SelectScrollButtonImpl2(props, forwardedRef) { + const { __scopeSelect, onAutoScroll, ...scrollIndicatorProps } = props; + const contentContext = useSelectContentContext("SelectScrollButton", __scopeSelect); + const autoScrollTimerRef = React.useRef(null); + const getItems = useCollection(__scopeSelect); + const clearAutoScrollTimer = React.useCallback(() => { + if (autoScrollTimerRef.current !== null) { + window.clearInterval(autoScrollTimerRef.current); + autoScrollTimerRef.current = null; + } + }, []); + React.useEffect(() => { + return () => clearAutoScrollTimer(); + }, [clearAutoScrollTimer]); + (0, import_react_use_layout_effect.useLayoutEffect)(() => { + const activeItem = getItems().find((item) => item.ref.current === document.activeElement); + activeItem?.ref.current?.scrollIntoView({ block: "nearest" }); + }, [getItems]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( + import_react_primitive.Primitive.div, + { + "aria-hidden": true, + ...scrollIndicatorProps, + ref: forwardedRef, + style: { flexShrink: 0, ...scrollIndicatorProps.style }, + onPointerDown: (0, import_primitive.composeEventHandlers)(scrollIndicatorProps.onPointerDown, () => { + if (autoScrollTimerRef.current === null) { + autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50); + } + }), + onPointerMove: (0, import_primitive.composeEventHandlers)(scrollIndicatorProps.onPointerMove, () => { + contentContext.onItemLeave?.(); + if (autoScrollTimerRef.current === null) { + autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50); + } + }), + onPointerLeave: (0, import_primitive.composeEventHandlers)(scrollIndicatorProps.onPointerLeave, () => { + clearAutoScrollTimer(); + }) + } + ); +}, "SelectScrollButtonImpl")); +var SelectSeparator = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function SelectSeparator2(props, forwardedRef) { + const { __scopeSelect, ...separatorProps } = props; + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.div, { "aria-hidden": true, ...separatorProps, ref: forwardedRef }); + }, "SelectSeparator") +); +var ARROW_NAME = "SelectArrow"; +var SelectArrow = /* @__PURE__ */ React.forwardRef( + /* @__PURE__ */ __name(function SelectArrow2(props, forwardedRef) { + const { __scopeSelect, ...arrowProps } = props; + const popperScope = usePopperScope(__scopeSelect); + const contentContext = useSelectContentContext(ARROW_NAME, __scopeSelect); + return contentContext.position === Position.Popper ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperPrimitive.Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef }) : null; + }, "SelectArrow") +); +var BUBBLE_INPUT_NAME = "SelectBubbleInput"; +var SelectBubbleInput = /* @__PURE__ */ React.forwardRef( + // blank line to reduce diff noise + /* @__PURE__ */ __name(function SelectBubbleInput2({ __scopeSelect, ...props }, forwardedRef) { + const context = useSelectContext(BUBBLE_INPUT_NAME, __scopeSelect); + const { value, onValueChange, required, disabled, name, autoComplete, form, userSelection } = context; + const { nativeOptions, nativeSelectKey } = context; + const ref = React.useRef(null); + const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref); + const selectValue = value ?? ""; + const prevValueRef = React.useRef(selectValue); + const handledUserSelectionRef = React.useRef(userSelection); + const isDispatchingUserSelectionRef = React.useRef(false); + const hasEmptyValueOption = Array.from(nativeOptions).some( + (option) => (option.props.value ?? "") === "" + ); + React.useEffect(() => { + const select = ref.current; + if (!select) return; + const selectProto = window.HTMLSelectElement.prototype; + const descriptor = Object.getOwnPropertyDescriptor( + selectProto, + "value" + ); + const setValue = descriptor.set; + const isNewUserSelection = userSelection !== null && userSelection !== handledUserSelectionRef.current; + handledUserSelectionRef.current = userSelection; + const valueChanged = prevValueRef.current !== selectValue; + prevValueRef.current = selectValue; + const isUserInteraction = isNewUserSelection && valueChanged; + if (isNewUserSelection && !valueChanged && userSelection.value !== selectValue && !userSelection.hasConsumerStoppedPropagation && setValue) { + isDispatchingUserSelectionRef.current = true; + try { + setValue.call(select, userSelection.value); + select.dispatchEvent(new Event("change", { bubbles: true })); + } finally { + isDispatchingUserSelectionRef.current = false; + setValue.call(select, selectValue); + } + return; + } + const bubbles = isUserInteraction && !userSelection.hasConsumerStoppedPropagation; + if (valueChanged && setValue) { + const event = new Event("change", { bubbles }); + setValue.call(select, selectValue); + select.dispatchEvent(event); + } + }, [selectValue, userSelection]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)( + import_react_primitive.Primitive.select, + { + "aria-hidden": true, + required, + tabIndex: -1, + name, + autoComplete, + disabled, + form, + onChange: (event) => { + if (!isDispatchingUserSelectionRef.current) { + onValueChange(event.target.value); + } + }, + ...props, + style: { ...import_react_visually_hidden.VISUALLY_HIDDEN_STYLES, ...props.style }, + ref: composedRefs, + defaultValue: selectValue, + children: [ + shouldShowPlaceholder(value) && !hasEmptyValueOption ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "" }) : null, + Array.from(nativeOptions) + ] + }, + nativeSelectKey + ); + }, "SelectBubbleInput") +); +function isFunction(value) { + return typeof value === "function"; +} +__name(isFunction, "isFunction"); +function shouldShowPlaceholder(value) { + return value === "" || value === void 0; +} +__name(shouldShowPlaceholder, "shouldShowPlaceholder"); +function useTypeaheadSearch(onSearchChange) { + const handleSearchChange = (0, import_react_use_callback_ref.useCallbackRef)(onSearchChange); + const searchRef = React.useRef(""); + const timerRef = React.useRef(0); + const handleTypeaheadSearch = React.useCallback( + (key) => { + const search = searchRef.current + key; + handleSearchChange(search); + function updateSearch(value) { + searchRef.current = value; + window.clearTimeout(timerRef.current); + if (value !== "") timerRef.current = window.setTimeout(() => updateSearch(""), 1e3); + } + __name(updateSearch, "updateSearch"); + updateSearch(search); + }, + [handleSearchChange] + ); + const resetTypeahead = React.useCallback(() => { + searchRef.current = ""; + window.clearTimeout(timerRef.current); + }, []); + React.useEffect(() => { + return () => window.clearTimeout(timerRef.current); + }, []); + return [searchRef, handleTypeaheadSearch, resetTypeahead]; +} +__name(useTypeaheadSearch, "useTypeaheadSearch"); +function findNextItem(items, search, currentItem) { + const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]); + const normalizedSearch = isRepeated ? search[0] : search; + const currentItemIndex = currentItem ? items.indexOf(currentItem) : -1; + let wrappedItems = wrapArray(items, Math.max(currentItemIndex, 0)); + const excludeCurrentItem = normalizedSearch.length === 1; + if (excludeCurrentItem) wrappedItems = wrappedItems.filter((v) => v !== currentItem); + const nextItem = wrappedItems.find( + (item) => item.textValue.toLowerCase().startsWith(normalizedSearch.toLowerCase()) + ); + return nextItem !== currentItem ? nextItem : void 0; +} +__name(findNextItem, "findNextItem"); +function wrapArray(array, startIndex) { + return array.map((_, index) => array[(startIndex + index) % array.length]); +} +__name(wrapArray, "wrapArray"); +//# sourceMappingURL=index.js.map diff --git a/e-commerce/node_modules/@radix-ui/react-select/dist/index.js.map b/e-commerce/node_modules/@radix-ui/react-select/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..db334de9ce1b33a250f0cd708d65ef265db1bf99 --- /dev/null +++ b/e-commerce/node_modules/@radix-ui/react-select/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts", "../src/select.tsx"], + "sourcesContent": ["'use client';\nexport {\n createSelectScope,\n //\n Select,\n SelectProvider as unstable_SelectProvider,\n SelectTrigger,\n SelectValue,\n SelectIcon,\n SelectPortal,\n SelectContent,\n SelectViewport,\n SelectGroup,\n SelectLabel,\n SelectItem,\n SelectItemText,\n SelectItemIndicator,\n SelectScrollUpButton,\n SelectScrollDownButton,\n SelectSeparator,\n SelectArrow,\n SelectBubbleInput as unstable_SelectBubbleInput,\n //\n Root,\n Provider as unstable_Provider,\n Trigger,\n Value,\n Icon,\n Portal,\n Content,\n Viewport,\n Group,\n Label,\n Item,\n ItemText,\n ItemIndicator,\n ScrollUpButton,\n ScrollDownButton,\n Separator,\n Arrow,\n BubbleInput as unstable_BubbleInput,\n} from './select';\nexport type {\n SelectProps,\n SelectProviderProps as unstable_SelectProviderProps,\n SelectSharedProps,\n SelectTriggerProps,\n SelectValueProps,\n SelectIconProps,\n SelectPortalProps,\n SelectContentProps,\n SelectViewportProps,\n SelectGroupProps,\n SelectLabelProps,\n SelectItemProps,\n SelectItemTextProps,\n SelectItemIndicatorProps,\n SelectScrollUpButtonProps,\n SelectScrollDownButtonProps,\n SelectSeparatorProps,\n SelectArrowProps,\n SelectBubbleInputProps as unstable_SelectBubbleInputProps,\n} from './select';\n", "import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { clamp } from '@radix-ui/number';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createCollection } from '@radix-ui/react-collection';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useDirection } from '@radix-ui/react-direction';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport { FocusScope } from '@radix-ui/react-focus-scope';\nimport { useId } from '@radix-ui/react-id';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { createPopperScope } from '@radix-ui/react-popper';\nimport { Portal as PortalPrimitive } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { createSlot } from '@radix-ui/react-slot';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { VISUALLY_HIDDEN_STYLES } from '@radix-ui/react-visually-hidden';\nimport { hideOthers } from 'aria-hidden';\nimport { RemoveScroll } from 'react-remove-scroll';\n\nimport type { Scope } from '@radix-ui/react-context';\n\nconst Position = {\n ItemAligned: 'item-aligned',\n Popper: 'popper',\n} as const;\n\nconst Direction = {\n LTR: 'ltr',\n RTL: 'rtl',\n} as const;\n\ntype Position = (typeof Position)[keyof typeof Position];\ntype Direction = (typeof Direction)[keyof typeof Direction];\n\nconst OPEN_KEYS = [' ', 'Enter', 'ArrowUp', 'ArrowDown'];\nconst SELECTION_KEYS = [' ', 'Enter'];\n\n/* -------------------------------------------------------------------------------------------------\n * Select\n * -----------------------------------------------------------------------------------------------*/\n\nconst SELECT_NAME = 'Select';\n\ntype ItemData = { value: string; disabled: boolean; textValue: string };\nconst [Collection, useCollection, createCollectionScope] = createCollection<\n SelectItemElement,\n ItemData\n>(SELECT_NAME);\n\ntype ScopedProps

= P & { __scopeSelect?: Scope | undefined };\nconst [createSelectContext, createSelectScope] = createContextScope(SELECT_NAME, [\n createCollectionScope,\n createPopperScope,\n]);\nconst usePopperScope = createPopperScope();\n\ninterface SelectUserSelection {\n value: string;\n hasConsumerStoppedPropagation: boolean;\n}\n\ninterface SelectContextValue {\n trigger: SelectTriggerElement | null;\n onTriggerChange(node: SelectTriggerElement | null): void;\n valueNode: SelectValueElement | null;\n onValueNodeChange(node: SelectValueElement): void;\n valueNodeHasChildren: boolean;\n onValueNodeHasChildrenChange(hasChildren: boolean): void;\n contentId: string;\n value: string | undefined;\n onValueChange(value: string): void;\n hasConsumerStoppedPropagationRef: React.RefObject;\n userSelection: SelectUserSelection | null;\n onUserSelect(value: string): void;\n open: boolean;\n required?: boolean | undefined;\n onOpenChange(open: boolean): void;\n dir: SelectProps['dir'];\n triggerPointerDownPosRef: React.MutableRefObject<{ x: number; y: number } | null>;\n disabled?: boolean | undefined;\n name?: string | undefined;\n autoComplete?: string | undefined;\n form?: string | undefined;\n nativeOptions: Set;\n nativeSelectKey: string;\n isFormControl: boolean;\n}\n\nconst [SelectProviderImpl, useSelectContext] = createSelectContext(SELECT_NAME);\n\ntype NativeOption = React.ReactElement>;\n\ntype SelectNativeOptionsContextValue = {\n onNativeOptionAdd(option: NativeOption): void;\n onNativeOptionRemove(option: NativeOption): void;\n};\nconst [SelectNativeOptionsProvider, useSelectNativeOptionsContext] =\n createSelectContext(SELECT_NAME);\n\ninterface ControlledClearableSelectProps {\n value: string | undefined;\n defaultValue?: never | undefined;\n onValueChange: (value: string | undefined) => void;\n}\n\ninterface ControlledUnclearableSelectProps {\n value: string;\n defaultValue?: never | undefined;\n onValueChange: (value: string) => void;\n}\n\ninterface UncontrolledSelectProps {\n value?: never | undefined;\n defaultValue?: string | undefined;\n onValueChange?:\n | {\n (value: string): void;\n (value: string | undefined): void;\n }\n | undefined;\n}\n\ntype SelectControlProps =\n | ControlledClearableSelectProps\n | ControlledUnclearableSelectProps\n | UncontrolledSelectProps;\n\nexport interface SelectSharedProps {\n children?: React.ReactNode | undefined;\n open?: boolean | undefined;\n defaultOpen?: boolean | undefined;\n onOpenChange?: ((open: boolean) => void) | undefined;\n dir?: Direction | undefined;\n name?: string | undefined;\n autoComplete?: string | undefined;\n disabled?: boolean | undefined;\n required?: boolean | undefined;\n form?: string | undefined;\n}\n\n// TODO: Should improve typing somewhat, but this would be a breaking change.\n// Consider using in the next major version (along with some testing to be sure\n// it works as expected and doesn't cause problems)\ntype _FutureSelectProps = SelectSharedProps & SelectControlProps;\n\ntype SelectProps = SelectSharedProps & {\n value?: string | undefined;\n defaultValue?: string | undefined;\n onValueChange?: ((value: string) => void) | undefined;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * SelectProvider\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SelectProviderProps extends SelectSharedProps {\n value?: string | undefined;\n defaultValue?: string | undefined;\n onValueChange?: ((value: string) => void) | undefined;\n}\n\nfunction SelectProvider(props: ScopedProps) {\n const {\n __scopeSelect,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n value: valueProp,\n defaultValue,\n onValueChange,\n dir,\n name,\n autoComplete,\n disabled,\n required,\n form,\n // @ts-expect-error internal render prop used by `Select` to compose its default parts\n internal_do_not_use_render,\n } = props;\n const popperScope = usePopperScope(__scopeSelect);\n const [trigger, setTrigger] = React.useState(null);\n const [valueNode, setValueNode] = React.useState(null);\n const [valueNodeHasChildren, setValueNodeHasChildren] = React.useState(false);\n const direction = useDirection(dir);\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n caller: SELECT_NAME,\n });\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue,\n onChange: onValueChange as any,\n caller: SELECT_NAME,\n });\n const triggerPointerDownPosRef = React.useRef<{ x: number; y: number } | null>(null);\n const hasConsumerStoppedPropagationRef = React.useRef(false);\n\n // The latest value selected by the user. The bubble input notifies the form\n // of it once React has handled the selection, whether or not the value\n // changes in the same render.\n //\n // See https://github.com/radix-ui/primitives/issues/4102\n const [userSelection, setUserSelection] = React.useState(null);\n const handleUserSelect = (nextValue: string) => {\n setUserSelection({\n value: nextValue,\n hasConsumerStoppedPropagation: hasConsumerStoppedPropagationRef.current,\n });\n setValue(nextValue);\n };\n\n const initialValueRef = React.useRef(value);\n React.useEffect(() => {\n const associatedForm = form ? trigger?.ownerDocument.getElementById(form) : trigger?.form;\n if (associatedForm instanceof HTMLFormElement) {\n const reset = () => setValue(initialValueRef.current);\n associatedForm.addEventListener('reset', reset);\n return () => associatedForm.removeEventListener('reset', reset);\n }\n }, [form, trigger, setValue]);\n\n // We set this to true by default so that events bubble to forms without JS (SSR)\n const isFormControl = trigger ? !!form || !!trigger.closest('form') : true;\n const [nativeOptionsSet, setNativeOptionsSet] = React.useState(new Set());\n const contentId = useId();\n\n // The native `select` only associates the correct default value if the corresponding\n // `option` is rendered as a child **at the same time** as itself.\n // Because it might take a few renders for our items to gather the information to build\n // the native `option`(s), we generate a key on the `select` to make sure React re-builds it\n // each time the options change.\n const nativeSelectKey = Array.from(nativeOptionsSet)\n .map((option) => option.props.value)\n .join(';');\n\n const handleNativeOptionAdd = React.useCallback((option: NativeOption) => {\n setNativeOptionsSet((prev) => new Set(prev).add(option));\n }, []);\n\n const handleNativeOptionRemove = React.useCallback((option: NativeOption) => {\n setNativeOptionsSet((prev) => {\n const optionsSet = new Set(prev);\n optionsSet.delete(option);\n return optionsSet;\n });\n }, []);\n\n const context: SelectContextValue = {\n required,\n trigger,\n onTriggerChange: setTrigger,\n valueNode,\n onValueNodeChange: setValueNode,\n valueNodeHasChildren,\n onValueNodeHasChildrenChange: setValueNodeHasChildren,\n contentId,\n value,\n onValueChange: setValue,\n hasConsumerStoppedPropagationRef,\n userSelection,\n onUserSelect: handleUserSelect,\n open,\n onOpenChange: setOpen,\n dir: direction,\n triggerPointerDownPosRef,\n disabled,\n name,\n autoComplete,\n form,\n nativeOptions: nativeOptionsSet,\n nativeSelectKey,\n isFormControl,\n };\n\n return (\n \n \n \n \n {isFunction(internal_do_not_use_render)\n ? internal_do_not_use_render(context)\n : children}\n \n \n \n \n );\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Select\n * -----------------------------------------------------------------------------------------------*/\n\nconst Select: React.FC = (props: ScopedProps) => {\n const { __scopeSelect, children, ...providerProps } = props;\n return (\n (\n <>\n {children}\n {isFormControl ? (\n \n ) : null}\n \n )}\n />\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * SelectTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'SelectTrigger';\n\ntype SelectTriggerElement = React.ComponentRef;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef;\ninterface SelectTriggerProps extends PrimitiveButtonProps {}\n\nconst SelectTrigger = /* @__PURE__ */ React.forwardRef(\n function SelectTrigger(props: ScopedProps, forwardedRef) {\n const { __scopeSelect, disabled = false, ...triggerProps } = props;\n const popperScope = usePopperScope(__scopeSelect);\n const context = useSelectContext(TRIGGER_NAME, __scopeSelect);\n const isDisabled = context.disabled || disabled;\n const composedRefs = useComposedRefs(forwardedRef, context.onTriggerChange);\n const getItems = useCollection(__scopeSelect);\n const pointerTypeRef = React.useRef('touch');\n\n const [searchRef, handleTypeaheadSearch, resetTypeahead] = useTypeaheadSearch((search) => {\n const enabledItems = getItems().filter((item) => !item.disabled);\n const currentItem = enabledItems.find((item) => item.value === context.value);\n const nextItem = findNextItem(enabledItems, search, currentItem);\n if (nextItem !== undefined) {\n context.onUserSelect(nextItem.value);\n }\n });\n\n const handleOpen = (pointerEvent?: React.MouseEvent | React.PointerEvent) => {\n if (!isDisabled) {\n context.onOpenChange(true);\n // reset typeahead when we open\n resetTypeahead();\n }\n\n if (pointerEvent) {\n context.triggerPointerDownPosRef.current = {\n x: Math.round(pointerEvent.pageX),\n y: Math.round(pointerEvent.pageY),\n };\n }\n };\n\n return (\n \n {\n // Whilst browsers generally have no issue focusing the trigger when clicking\n // on a label, Safari seems to struggle with the fact that there's no `onClick`.\n // We force `focus` in this case. Note: this doesn't create any other side-effect\n // because we are preventing default in `onPointerDown` so effectively\n // this only runs for a label \"click\"\n event.currentTarget.focus();\n\n // Open on click when using a touch or pen device\n if (pointerTypeRef.current !== 'mouse') {\n handleOpen(event);\n }\n })}\n onPointerDown={composeEventHandlers(triggerProps.onPointerDown, (event) => {\n pointerTypeRef.current = event.pointerType;\n\n // prevent implicit pointer capture\n // https://www.w3.org/TR/pointerevents3/#implicit-pointer-capture\n const target = event.target as HTMLElement;\n if (target.hasPointerCapture(event.pointerId)) {\n target.releasePointerCapture(event.pointerId);\n }\n\n // only call handler if it's the left button (mousedown gets triggered by all mouse buttons)\n // but not when the control key is pressed (avoiding MacOS right click); also not for touch\n // devices because that would open the menu on scroll. (pen devices behave as touch on iOS).\n if (event.button === 0 && event.ctrlKey === false && event.pointerType === 'mouse') {\n handleOpen(event);\n // prevent trigger from stealing focus from the active item after opening.\n event.preventDefault();\n }\n })}\n onKeyDown={composeEventHandlers(triggerProps.onKeyDown, (event) => {\n const isTypingAhead = searchRef.current !== '';\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;\n if (!isModifierKey && event.key.length === 1) {\n context.hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();\n handleTypeaheadSearch(event.key);\n }\n if (isTypingAhead && event.key === ' ') return;\n if (OPEN_KEYS.includes(event.key)) {\n handleOpen();\n event.preventDefault();\n }\n })}\n />\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * SelectValue\n * -----------------------------------------------------------------------------------------------*/\n\nconst VALUE_NAME = 'SelectValue';\n\ntype SelectValueElement = React.ComponentRef;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef;\ninterface SelectValueProps extends Omit {\n placeholder?: React.ReactNode | undefined;\n}\n\nconst SelectValue = /* @__PURE__ */ React.forwardRef(\n function SelectValue(props: ScopedProps, forwardedRef) {\n // We ignore `className` and `style` as this part shouldn't be styled.\n const { __scopeSelect, className, style, children, placeholder = '', ...valueProps } = props;\n const context = useSelectContext(VALUE_NAME, __scopeSelect);\n const { onValueNodeHasChildrenChange } = context;\n const hasChildren = children !== undefined;\n const composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange);\n\n useLayoutEffect(() => {\n onValueNodeHasChildrenChange(hasChildren);\n }, [onValueNodeHasChildrenChange, hasChildren]);\n\n const showPlaceholder = shouldShowPlaceholder(context.value);\n\n return (\n \n \n {showPlaceholder ? placeholder : children}\n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * SelectIcon\n * -----------------------------------------------------------------------------------------------*/\n\ntype SelectIconElement = React.ComponentRef;\ninterface SelectIconProps extends PrimitiveSpanProps {}\n\nconst SelectIcon = /* @__PURE__ */ React.forwardRef(\n function SelectIcon(props: ScopedProps, forwardedRef) {\n const { __scopeSelect, children, ...iconProps } = props;\n return (\n \n {children || '\u25BC'}\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * SelectPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'SelectPortal';\n\ntype PortalContextValue = { forceMount?: true | undefined };\nconst [PortalProvider, usePortalContext] = createSelectContext(PORTAL_NAME, {\n forceMount: undefined,\n});\n\ntype PortalProps = React.ComponentPropsWithoutRef;\ninterface SelectPortalProps {\n children?: React.ReactNode | undefined;\n /**\n * Specify a container element to portal the content into.\n */\n container?: PortalProps['container'] | undefined;\n /**\n * Used to force mounting when more control is needed. Useful when controlling\n * animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst SelectPortal: React.FC = (props: ScopedProps) => {\n const { __scopeSelect, forceMount, ...portalProps } = props;\n return (\n \n \n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * SelectContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'SelectContent';\n\ntype SelectContentElement = SelectContentImplElement;\ninterface SelectContentProps extends SelectContentImplProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true | undefined;\n}\n\nconst SelectContent = /* @__PURE__ */ React.forwardRef(\n function SelectContent(props: ScopedProps, forwardedRef) {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopeSelect);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = useSelectContext(CONTENT_NAME, props.__scopeSelect);\n const [fragment, setFragment] = React.useState();\n\n // setting the fragment in `useLayoutEffect` as `DocumentFragment` doesn't exist on the server\n useLayoutEffect(() => {\n setFragment(new DocumentFragment());\n }, []);\n\n // The `Select` items collect their data (e.g. to build the native `option`s\n // and to display the selected value) by mounting their children. We keep\n // them mounted in a detached fragment whenever the content isn't present so\n // that this data stays up to date even while the select is closed (or\n // animating out).\n return (\n \n {({ present }) =>\n present ? (\n \n ) : (\n \n )\n }\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * SelectContentFragment\n * -----------------------------------------------------------------------------------------------*/\n\ntype SelectContentFragmentElement = React.ComponentRef;\ninterface SelectContentFragmentProps extends SelectContentImplProps {\n fragment?: DocumentFragment | undefined;\n}\n\nconst SelectContentFragment = /* @__PURE__ */ React.forwardRef<\n SelectContentFragmentElement,\n SelectContentFragmentProps\n>(function SelectContentFragment(props: ScopedProps, forwardedRef) {\n const { __scopeSelect, children, fragment } = props;\n if (!fragment) return null;\n\n return ReactDOM.createPortal(\n \n \n

{children}
\n \n ,\n fragment,\n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * SelectContentImpl\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_MARGIN = 10;\n\ntype SelectContentContextValue = {\n content?: SelectContentElement | null | undefined;\n viewport?: SelectViewportElement | null | undefined;\n onViewportChange?: ((node: SelectViewportElement | null) => void) | undefined;\n itemRefCallback?:\n | ((node: SelectItemElement | null, value: string, disabled: boolean) => void)\n | undefined;\n selectedItem?: SelectItemElement | null | undefined;\n onItemLeave?: (() => void) | undefined;\n itemTextRefCallback?:\n | ((node: SelectItemTextElement | null, value: string, disabled: boolean) => void)\n | undefined;\n focusSelectedItem?: (() => void) | undefined;\n selectedItemText?: SelectItemTextElement | null | undefined;\n position?: SelectContentProps['position'] | undefined;\n isPositioned?: boolean | undefined;\n searchRef?: React.RefObject | undefined;\n};\n\nconst [SelectContentProvider, useSelectContentContext] =\n createSelectContext(CONTENT_NAME);\n\ntype SelectContentImplElement = SelectPopperPositionElement | SelectItemAlignedPositionElement;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef;\ntype FocusScopeProps = React.ComponentPropsWithoutRef;\n\ntype SelectPopperPrivateProps = { onPlaced?: PopperContentProps['onPlaced'] | undefined };\n\ninterface SelectContentImplProps\n extends\n Omit,\n Omit {\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'] | undefined;\n /**\n * Event handler called when the escape key is down.\n * Can be prevented.\n */\n onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'] | undefined;\n /**\n * Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`.\n * Can be prevented.\n */\n onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'] | undefined;\n\n position?: Position | undefined;\n}\n\nconst Slot = createSlot('SelectContent.RemoveScroll');\n\nconst SelectContentImpl = /* @__PURE__ */ React.forwardRef<\n SelectContentImplElement,\n SelectContentImplProps\n>(\n // blank line to reduce diff noise\n function SelectContentImpl(props: ScopedProps, forwardedRef) {\n const { __scopeSelect } = props;\n const {\n position = Position.ItemAligned,\n onCloseAutoFocus,\n onEscapeKeyDown,\n onPointerDownOutside,\n //\n // PopperContent props\n side,\n sideOffset,\n align,\n alignOffset,\n arrowPadding,\n collisionBoundary,\n collisionPadding,\n sticky,\n hideWhenDetached,\n avoidCollisions,\n //\n ...contentProps\n } = props;\n const context = useSelectContext(CONTENT_NAME, __scopeSelect);\n const [content, setContent] = React.useState(null);\n const [viewport, setViewport] = React.useState(null);\n const composedRefs = useComposedRefs(forwardedRef, setContent);\n const [selectedItem, setSelectedItem] = React.useState(null);\n const [selectedItemText, setSelectedItemText] = React.useState(\n null,\n );\n const getItems = useCollection(__scopeSelect);\n const [isPositioned, setIsPositioned] = React.useState(false);\n const firstValidItemFoundRef = React.useRef(false);\n const firstItemFoundRef = React.useRef(false);\n const firstItemTextFoundRef = React.useRef(false);\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n if (content) return hideOthers(content);\n }, [content]);\n\n // Make sure the whole tree has focus guards as our `Select` may be\n // the last element in the DOM (because of the `Portal`)\n useFocusGuards();\n\n const focusFirst = React.useCallback(\n (candidates: Array) => {\n const [firstItem, ...restItems] = getItems().map((item) => item.ref.current);\n const [lastItem] = restItems.slice(-1);\n\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates) {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate?.scrollIntoView({ block: 'nearest' });\n // viewport might have padding so scroll to its edges when focusing first/last items.\n if (candidate === firstItem && viewport) viewport.scrollTop = 0;\n if (candidate === lastItem && viewport) viewport.scrollTop = viewport.scrollHeight;\n candidate?.focus();\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n },\n [getItems, viewport],\n );\n\n const focusSelectedItem = React.useCallback(\n () => focusFirst([selectedItem, content]),\n [focusFirst, selectedItem, content],\n );\n\n // Since this is not dependent on layout, we want to ensure this runs at the same time as\n // other effects across components. Hence why we don't call `focusSelectedItem` inside `position`.\n React.useEffect(() => {\n if (isPositioned) {\n focusSelectedItem();\n }\n }, [isPositioned, focusSelectedItem]);\n\n // prevent selecting items on `pointerup` in some cases after opening from `pointerdown`\n // and close on `pointerup` outside.\n const { onOpenChange, triggerPointerDownPosRef } = context;\n React.useEffect(() => {\n if (content) {\n let pointerMoveDelta = { x: 0, y: 0 };\n\n const handlePointerMove = (event: PointerEvent) => {\n pointerMoveDelta = {\n x: Math.abs(Math.round(event.pageX) - (triggerPointerDownPosRef.current?.x ?? 0)),\n y: Math.abs(Math.round(event.pageY) - (triggerPointerDownPosRef.current?.y ?? 0)),\n };\n };\n const handlePointerUp = (event: PointerEvent) => {\n // If the pointer hasn't moved by a certain threshold then we prevent selecting item on `pointerup`.\n if (pointerMoveDelta.x <= 10 && pointerMoveDelta.y <= 10) {\n event.preventDefault();\n } else {\n // otherwise, if the event was outside the content, close.\n // `event.target` is retargeted to the shadow host for this\n // document-level listener, so use `composedPath()` which pierces\n // open shadow roots to reliably detect events inside the content.\n if (!event.composedPath().includes(content)) {\n onOpenChange(false);\n }\n }\n document.removeEventListener('pointermove', handlePointerMove);\n triggerPointerDownPosRef.current = null;\n };\n\n if (triggerPointerDownPosRef.current !== null) {\n document.addEventListener('pointermove', handlePointerMove);\n document.addEventListener('pointerup', handlePointerUp, { capture: true, once: true });\n }\n\n return () => {\n document.removeEventListener('pointermove', handlePointerMove);\n document.removeEventListener('pointerup', handlePointerUp, { capture: true });\n };\n }\n }, [content, onOpenChange, triggerPointerDownPosRef]);\n\n React.useEffect(() => {\n const close = () => onOpenChange(false);\n window.addEventListener('blur', close);\n window.addEventListener('resize', close);\n return () => {\n window.removeEventListener('blur', close);\n window.removeEventListener('resize', close);\n };\n }, [onOpenChange]);\n\n const [searchRef, handleTypeaheadSearch] = useTypeaheadSearch((search) => {\n const enabledItems = getItems().filter((item) => !item.disabled);\n const currentItem = enabledItems.find((item) => item.ref.current === document.activeElement);\n const nextItem = findNextItem(enabledItems, search, currentItem);\n if (nextItem) {\n /**\n * Imperative focus during keydown is risky so we prevent React's batching updates\n * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332\n */\n setTimeout(() => nextItem.ref.current?.focus());\n }\n });\n\n const itemRefCallback = React.useCallback(\n (node: SelectItemElement | null, value: string, disabled: boolean) => {\n const isFirstItem = !firstItemFoundRef.current;\n if (isFirstItem) firstItemFoundRef.current = true;\n\n const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;\n const isSelectedItem = context.value !== undefined && context.value === value;\n if (isSelectedItem || isFirstValidItem) {\n setSelectedItem(node);\n if (isFirstValidItem) firstValidItemFoundRef.current = true;\n } else if (isFirstItem) {\n setSelectedItem(node);\n }\n },\n [context.value],\n );\n const handleItemLeave = React.useCallback(() => content?.focus(), [content]);\n const itemTextRefCallback = React.useCallback(\n (node: SelectItemTextElement | null, value: string, disabled: boolean) => {\n if (!node) return;\n\n const isFirstItem = !firstItemTextFoundRef.current;\n if (isFirstItem) firstItemTextFoundRef.current = true;\n\n const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;\n const isSelectedItem = context.value !== undefined && context.value === value;\n if (isSelectedItem || isFirstValidItem) {\n setSelectedItemText(node);\n } else if (isFirstItem) {\n setSelectedItemText(node);\n }\n },\n [context.value],\n );\n\n const SelectPosition =\n position === Position.Popper ? SelectPopperPosition : SelectItemAlignedPosition;\n\n // Silently ignore props that are not supported by `SelectItemAlignedPosition`\n const popperContentProps =\n SelectPosition === SelectPopperPosition\n ? {\n side,\n sideOffset,\n align,\n alignOffset,\n arrowPadding,\n collisionBoundary,\n collisionPadding,\n sticky,\n hideWhenDetached,\n avoidCollisions,\n }\n : {};\n\n return (\n \n \n {\n // we prevent open autofocus because we manually focus the selected item\n event.preventDefault();\n }}\n onUnmountAutoFocus={composeEventHandlers(onCloseAutoFocus, (event) => {\n context.trigger?.focus({ preventScroll: true });\n event.preventDefault();\n })}\n >\n event.preventDefault()}\n onDismiss={() => context.onOpenChange(false)}\n >\n event.preventDefault()}\n {...contentProps}\n {...popperContentProps}\n onPlaced={() => setIsPositioned(true)}\n ref={composedRefs}\n style={{\n // flex layout so we can place the scroll buttons properly\n display: 'flex',\n flexDirection: 'column',\n // reset the outline by default as the content MAY get focused\n outline: 'none',\n ...contentProps.style,\n }}\n onKeyDown={composeEventHandlers(contentProps.onKeyDown, (event) => {\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;\n\n // select should not be navigated using tab key so we prevent it\n if (event.key === 'Tab') event.preventDefault();\n\n if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);\n\n if (['ArrowUp', 'ArrowDown', 'Home', 'End'].includes(event.key)) {\n const items = getItems().filter((item) => !item.disabled);\n let candidateNodes = items.map((item) => item.ref.current!);\n\n if (['ArrowUp', 'End'].includes(event.key)) {\n candidateNodes = candidateNodes.slice().reverse();\n }\n if (['ArrowUp', 'ArrowDown'].includes(event.key)) {\n const currentElement = event.target as SelectItemElement;\n const currentIndex = candidateNodes.indexOf(currentElement);\n candidateNodes = candidateNodes.slice(currentIndex + 1);\n }\n\n /**\n * Imperative focus during keydown is risky so we prevent React's batching updates\n * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332\n */\n setTimeout(() => focusFirst(candidateNodes));\n\n event.preventDefault();\n }\n })}\n />\n \n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItemAlignedPosition\n * -----------------------------------------------------------------------------------------------*/\n\ntype SelectItemAlignedPositionElement = React.ComponentRef;\ninterface SelectItemAlignedPositionProps extends PrimitiveDivProps, SelectPopperPrivateProps {}\n\nconst SelectItemAlignedPosition = /* @__PURE__ */ React.forwardRef<\n SelectItemAlignedPositionElement,\n SelectItemAlignedPositionProps\n>(function SelectItemAlignedPosition(\n props: ScopedProps,\n forwardedRef,\n) {\n const { __scopeSelect, onPlaced, ...popperProps } = props;\n const context = useSelectContext(CONTENT_NAME, __scopeSelect);\n const contentContext = useSelectContentContext(CONTENT_NAME, __scopeSelect);\n const [contentWrapper, setContentWrapper] = React.useState(null);\n const [content, setContent] = React.useState(null);\n const composedRefs = useComposedRefs(forwardedRef, setContent);\n const getItems = useCollection(__scopeSelect);\n const shouldExpandOnScrollRef = React.useRef(false);\n const shouldRepositionRef = React.useRef(true);\n\n const { viewport, selectedItem, selectedItemText, focusSelectedItem } = contentContext;\n const position = React.useCallback(() => {\n if (\n context.trigger &&\n context.valueNode &&\n contentWrapper &&\n content &&\n viewport &&\n selectedItem &&\n selectedItemText\n ) {\n const triggerRect = context.trigger.getBoundingClientRect();\n\n // -----------------------------------------------------------------------------------------\n // Horizontal positioning\n // -----------------------------------------------------------------------------------------\n const contentRect = content.getBoundingClientRect();\n const valueNodeRect = context.valueNode.getBoundingClientRect();\n const itemTextRect = selectedItemText.getBoundingClientRect();\n\n if (context.dir !== Direction.RTL) {\n const itemTextOffset = itemTextRect.left - contentRect.left;\n const left = valueNodeRect.left - itemTextOffset;\n const leftDelta = triggerRect.left - left;\n const minContentWidth = triggerRect.width + leftDelta;\n const contentWidth = Math.max(minContentWidth, contentRect.width);\n const rightEdge = window.innerWidth - CONTENT_MARGIN;\n const clampedLeft = clamp(left, [\n CONTENT_MARGIN,\n // Prevents the content from going off the starting edge of the\n // viewport. It may still go off the ending edge, but this can be\n // controlled by the user since they may want to manage overflow in a\n // specific way.\n // https://github.com/radix-ui/primitives/issues/2049\n Math.max(CONTENT_MARGIN, rightEdge - contentWidth),\n ]);\n\n contentWrapper.style.minWidth = minContentWidth + 'px';\n contentWrapper.style.left = clampedLeft + 'px';\n } else {\n const itemTextOffset = contentRect.right - itemTextRect.right;\n const right = window.innerWidth - valueNodeRect.right - itemTextOffset;\n const rightDelta = window.innerWidth - triggerRect.right - right;\n const minContentWidth = triggerRect.width + rightDelta;\n const contentWidth = Math.max(minContentWidth, contentRect.width);\n const leftEdge = window.innerWidth - CONTENT_MARGIN;\n const clampedRight = clamp(right, [\n CONTENT_MARGIN,\n Math.max(CONTENT_MARGIN, leftEdge - contentWidth),\n ]);\n\n contentWrapper.style.minWidth = minContentWidth + 'px';\n contentWrapper.style.right = clampedRight + 'px';\n }\n\n // -----------------------------------------------------------------------------------------\n // Vertical positioning\n // -----------------------------------------------------------------------------------------\n const items = getItems();\n const availableHeight = window.innerHeight - CONTENT_MARGIN * 2;\n const itemsHeight = viewport.scrollHeight;\n\n const contentStyles = window.getComputedStyle(content);\n const contentBorderTopWidth = parseInt(contentStyles.borderTopWidth, 10);\n const contentPaddingTop = parseInt(contentStyles.paddingTop, 10);\n const contentBorderBottomWidth = parseInt(contentStyles.borderBottomWidth, 10);\n const contentPaddingBottom = parseInt(contentStyles.paddingBottom, 10);\n const fullContentHeight =\n contentBorderTopWidth +\n contentPaddingTop +\n itemsHeight +\n contentPaddingBottom +\n contentBorderBottomWidth;\n const minContentHeight = Math.min(selectedItem.offsetHeight * 5, fullContentHeight);\n\n const viewportStyles = window.getComputedStyle(viewport);\n const viewportPaddingTop = parseInt(viewportStyles.paddingTop, 10);\n const viewportPaddingBottom = parseInt(viewportStyles.paddingBottom, 10);\n\n const topEdgeToTriggerMiddle = triggerRect.top + triggerRect.height / 2 - CONTENT_MARGIN;\n const triggerMiddleToBottomEdge = availableHeight - topEdgeToTriggerMiddle;\n\n const selectedItemHalfHeight = selectedItem.offsetHeight / 2;\n const itemOffsetMiddle = selectedItem.offsetTop + selectedItemHalfHeight;\n const contentTopToItemMiddle = contentBorderTopWidth + contentPaddingTop + itemOffsetMiddle;\n const itemMiddleToContentBottom = fullContentHeight - contentTopToItemMiddle;\n\n const willAlignWithoutTopOverflow = contentTopToItemMiddle <= topEdgeToTriggerMiddle;\n\n if (willAlignWithoutTopOverflow) {\n const isLastItem =\n items.length > 0 && selectedItem === items[items.length - 1]!.ref.current;\n contentWrapper.style.bottom = 0 + 'px';\n const viewportOffsetBottom =\n content.clientHeight - viewport.offsetTop - viewport.offsetHeight;\n const clampedTriggerMiddleToBottomEdge = Math.max(\n triggerMiddleToBottomEdge,\n selectedItemHalfHeight +\n // viewport might have padding bottom, include it to avoid a scrollable viewport\n (isLastItem ? viewportPaddingBottom : 0) +\n viewportOffsetBottom +\n contentBorderBottomWidth,\n );\n const height = contentTopToItemMiddle + clampedTriggerMiddleToBottomEdge;\n contentWrapper.style.height = height + 'px';\n } else {\n const isFirstItem = items.length > 0 && selectedItem === items[0]!.ref.current;\n contentWrapper.style.top = 0 + 'px';\n const clampedTopEdgeToTriggerMiddle = Math.max(\n topEdgeToTriggerMiddle,\n contentBorderTopWidth +\n viewport.offsetTop +\n // viewport might have padding top, include it to avoid a scrollable viewport\n (isFirstItem ? viewportPaddingTop : 0) +\n selectedItemHalfHeight,\n );\n const height = clampedTopEdgeToTriggerMiddle + itemMiddleToContentBottom;\n contentWrapper.style.height = height + 'px';\n viewport.scrollTop = contentTopToItemMiddle - topEdgeToTriggerMiddle + viewport.offsetTop;\n }\n\n contentWrapper.style.margin = `${CONTENT_MARGIN}px 0`;\n contentWrapper.style.minHeight = minContentHeight + 'px';\n contentWrapper.style.maxHeight = availableHeight + 'px';\n // -----------------------------------------------------------------------------------------\n\n onPlaced?.();\n\n // we don't want the initial scroll position adjustment to trigger \"expand on scroll\"\n // so we explicitly turn it on only after they've registered.\n requestAnimationFrame(() => (shouldExpandOnScrollRef.current = true));\n }\n }, [\n getItems,\n context.trigger,\n context.valueNode,\n contentWrapper,\n content,\n viewport,\n selectedItem,\n selectedItemText,\n context.dir,\n onPlaced,\n ]);\n\n useLayoutEffect(() => position(), [position]);\n\n // copy z-index from content to wrapper\n const [contentZIndex, setContentZIndex] = React.useState();\n useLayoutEffect(() => {\n if (content) setContentZIndex(window.getComputedStyle(content).zIndex);\n }, [content]);\n\n // When the viewport becomes scrollable at the top, the scroll up button will mount.\n // Because it is part of the normal flow, it will push down the viewport, thus throwing our\n // trigger => selectedItem alignment off by the amount the viewport was pushed down.\n // We wait for this to happen and then re-run the positining logic one more time to account for it.\n const handleScrollButtonChange = React.useCallback(\n (node: SelectScrollButtonImplElement | null) => {\n if (node && shouldRepositionRef.current === true) {\n position();\n focusSelectedItem?.();\n shouldRepositionRef.current = false;\n }\n },\n [position, focusSelectedItem],\n );\n\n return (\n \n \n \n \n \n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * SelectPopperPosition\n * -----------------------------------------------------------------------------------------------*/\n\ntype SelectPopperPositionElement = React.ComponentRef;\ntype PopperContentProps = React.ComponentPropsWithoutRef;\ninterface SelectPopperPositionProps extends PopperContentProps, SelectPopperPrivateProps {}\n\nconst SelectPopperPosition = /* @__PURE__ */ React.forwardRef<\n SelectPopperPositionElement,\n SelectPopperPositionProps\n>(function SelectPopperPosition(props: ScopedProps, forwardedRef) {\n const {\n __scopeSelect,\n align = 'start',\n collisionPadding = CONTENT_MARGIN,\n ...popperProps\n } = props;\n const popperScope = usePopperScope(__scopeSelect);\n\n return (\n \n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * SelectViewport\n * -----------------------------------------------------------------------------------------------*/\n\ntype SelectViewportContextValue = {\n contentWrapper?: HTMLDivElement | null | undefined;\n shouldExpandOnScrollRef?: React.RefObject | undefined;\n onScrollButtonChange?: ((node: SelectScrollButtonImplElement | null) => void) | undefined;\n};\n\nconst [SelectViewportProvider, useSelectViewportContext] =\n createSelectContext(CONTENT_NAME, {});\n\nconst VIEWPORT_NAME = 'SelectViewport';\n\ntype SelectViewportElement = React.ComponentRef;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef;\ninterface SelectViewportProps extends PrimitiveDivProps {\n nonce?: string | undefined;\n}\n\nconst SelectViewport = /* @__PURE__ */ React.forwardRef(\n function SelectViewport(props: ScopedProps, forwardedRef) {\n const { __scopeSelect, nonce, ...viewportProps } = props;\n const contentContext = useSelectContentContext(VIEWPORT_NAME, __scopeSelect);\n const viewportContext = useSelectViewportContext(VIEWPORT_NAME, __scopeSelect);\n const composedRefs = useComposedRefs(forwardedRef, contentContext.onViewportChange);\n const prevScrollTopRef = React.useRef(0);\n return (\n <>\n {/* Hide scrollbars cross-browser and enable momentum scroll for touch devices */}\n \n \n {\n const viewport = event.currentTarget;\n const { contentWrapper, shouldExpandOnScrollRef } = viewportContext;\n if (shouldExpandOnScrollRef?.current && contentWrapper) {\n const scrolledBy = Math.abs(prevScrollTopRef.current - viewport.scrollTop);\n if (scrolledBy > 0) {\n const availableHeight = window.innerHeight - CONTENT_MARGIN * 2;\n const cssMinHeight = parseFloat(contentWrapper.style.minHeight);\n const cssHeight = parseFloat(contentWrapper.style.height);\n const prevHeight = Math.max(cssMinHeight, cssHeight);\n\n if (prevHeight < availableHeight) {\n const nextHeight = prevHeight + scrolledBy;\n const clampedNextHeight = Math.min(availableHeight, nextHeight);\n const heightDiff = nextHeight - clampedNextHeight;\n\n contentWrapper.style.height = clampedNextHeight + 'px';\n if (contentWrapper.style.bottom === '0px') {\n viewport.scrollTop = heightDiff > 0 ? heightDiff : 0;\n // ensure the content stays pinned to the bottom\n contentWrapper.style.justifyContent = 'flex-end';\n }\n }\n }\n }\n prevScrollTopRef.current = viewport.scrollTop;\n })}\n />\n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * SelectGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'SelectGroup';\n\ntype SelectGroupContextValue = { id: string };\n\nconst [SelectGroupContextProvider, useSelectGroupContext] =\n createSelectContext(GROUP_NAME);\n\ntype SelectGroupElement = React.ComponentRef;\ninterface SelectGroupProps extends PrimitiveDivProps {}\n\nconst SelectGroup = /* @__PURE__ */ React.forwardRef(\n function SelectGroup(props: ScopedProps, forwardedRef) {\n const { __scopeSelect, ...groupProps } = props;\n const groupId = useId();\n return (\n \n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * SelectLabel\n * -----------------------------------------------------------------------------------------------*/\n\nconst LABEL_NAME = 'SelectLabel';\n\ntype SelectLabelElement = React.ComponentRef;\ninterface SelectLabelProps extends PrimitiveDivProps {}\n\nconst SelectLabel = /* @__PURE__ */ React.forwardRef(\n function SelectLabel(props: ScopedProps, forwardedRef) {\n const { __scopeSelect, ...labelProps } = props;\n const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'SelectItem';\n\ntype SelectItemContextValue = {\n value: string;\n disabled: boolean;\n textId: string;\n isSelected: boolean;\n onItemTextChange(node: SelectItemTextElement | null): void;\n};\n\nconst [SelectItemContextProvider, useSelectItemContext] =\n createSelectContext(ITEM_NAME);\n\ntype SelectItemElement = React.ComponentRef;\ninterface SelectItemProps extends PrimitiveDivProps {\n value: string;\n disabled?: boolean | undefined;\n textValue?: string | undefined;\n}\n\nconst SelectItem = /* @__PURE__ */ React.forwardRef(\n function SelectItem(props: ScopedProps, forwardedRef) {\n const {\n __scopeSelect,\n value,\n disabled = false,\n textValue: textValueProp,\n ...itemProps\n } = props;\n const context = useSelectContext(ITEM_NAME, __scopeSelect);\n const contentContext = useSelectContentContext(ITEM_NAME, __scopeSelect);\n const isSelected = context.value === value;\n const [textValue, setTextValue] = React.useState(textValueProp ?? '');\n const [isFocused, setIsFocused] = React.useState(false);\n const handleItemRefCallback = useCallbackRef((node: SelectItemElement | null) =>\n contentContext.itemRefCallback?.(node, value, disabled),\n );\n const composedRefs = useComposedRefs(forwardedRef, handleItemRefCallback);\n const textId = useId();\n const pointerTypeRef = React.useRef('touch');\n\n function handleSelect(event: { isPropagationStopped(): boolean }) {\n context.hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();\n context.onUserSelect(value);\n context.onOpenChange(false);\n }\n\n return (\n {\n setTextValue((prevTextValue) => prevTextValue || (node?.textContent ?? '').trim());\n }, [])}\n >\n \n setIsFocused(true))}\n onBlur={composeEventHandlers(itemProps.onBlur, () => setIsFocused(false))}\n onClick={composeEventHandlers(itemProps.onClick, (event) => {\n if (disabled) {\n return;\n }\n\n // Open on click when using a touch or pen device\n if (pointerTypeRef.current !== 'mouse') {\n handleSelect(event);\n }\n })}\n onPointerUp={composeEventHandlers(itemProps.onPointerUp, (event) => {\n if (disabled) {\n return;\n }\n\n // Using a mouse you should be able to do pointer down, move through\n // the list, and release the pointer over the item to select it.\n if (pointerTypeRef.current === 'mouse') {\n handleSelect(event);\n }\n })}\n onPointerDown={composeEventHandlers(itemProps.onPointerDown, (event) => {\n pointerTypeRef.current = event.pointerType;\n })}\n onPointerMove={composeEventHandlers(itemProps.onPointerMove, (event) => {\n // Remember pointer type when sliding over to this item from another one\n pointerTypeRef.current = event.pointerType;\n if (disabled) {\n contentContext.onItemLeave?.();\n } else if (pointerTypeRef.current === 'mouse') {\n // even though safari doesn't support this option, it's acceptable\n // as it only means it might scroll a few pixels when using the pointer.\n event.currentTarget.focus({ preventScroll: true });\n }\n })}\n onPointerLeave={composeEventHandlers(itemProps.onPointerLeave, (event) => {\n if (event.currentTarget === document.activeElement) {\n contentContext.onItemLeave?.();\n }\n })}\n onKeyDown={composeEventHandlers(itemProps.onKeyDown, (event) => {\n // Only react to keys originating from the item itself. Focusable\n // descendants (eg. an `input` inside a `Dialog` rendered within\n // the item) bubble their key events here through React's event\n // system even when portaled out of the item's DOM subtree.\n // See: https://github.com/radix-ui/primitives/issues/3232\n if (disabled || event.target !== event.currentTarget) {\n return;\n }\n\n const isTypingAhead = contentContext.searchRef?.current !== '';\n if (isTypingAhead && event.key === ' ') {\n return;\n }\n\n if (SELECTION_KEYS.includes(event.key)) {\n handleSelect(event);\n }\n // prevent page scroll if using the space key to select an item\n if (event.key === ' ') {\n event.preventDefault();\n }\n })}\n />\n \n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItemText\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_TEXT_NAME = 'SelectItemText';\n\ntype SelectItemTextElement = React.ComponentRef;\ninterface SelectItemTextProps extends PrimitiveSpanProps {}\n\nconst SelectItemText = /* @__PURE__ */ React.forwardRef(\n function SelectItemText(props: ScopedProps, forwardedRef) {\n // We ignore `className` and `style` as this part shouldn't be styled.\n const { __scopeSelect, className, style, ...itemTextProps } = props;\n const context = useSelectContext(ITEM_TEXT_NAME, __scopeSelect);\n const contentContext = useSelectContentContext(ITEM_TEXT_NAME, __scopeSelect);\n const itemContext = useSelectItemContext(ITEM_TEXT_NAME, __scopeSelect);\n const nativeOptionsContext = useSelectNativeOptionsContext(ITEM_TEXT_NAME, __scopeSelect);\n const [itemTextNode, setItemTextNode] = React.useState(null);\n const handleItemTextRefCallback = useCallbackRef((node: SelectItemTextElement | null) =>\n contentContext.itemTextRefCallback?.(node, itemContext.value, itemContext.disabled),\n );\n const composedRefs = useComposedRefs(\n forwardedRef,\n setItemTextNode,\n itemContext.onItemTextChange,\n handleItemTextRefCallback,\n );\n\n const textContent = itemTextNode?.textContent;\n const nativeOption = React.useMemo(\n () => (\n \n ),\n [itemContext.disabled, itemContext.value, textContent],\n );\n\n const { onNativeOptionAdd, onNativeOptionRemove } = nativeOptionsContext;\n useLayoutEffect(() => {\n onNativeOptionAdd(nativeOption);\n return () => onNativeOptionRemove(nativeOption);\n }, [onNativeOptionAdd, onNativeOptionRemove, nativeOption]);\n\n return (\n <>\n \n\n {/* Portal the select item text into the trigger value node.\n When the value is empty we show the placeholder instead, so a\n selected \"clear\" item (empty value) must not portal its text. */}\n {itemContext.isSelected &&\n context.valueNode &&\n !context.valueNodeHasChildren &&\n !shouldShowPlaceholder(context.value)\n ? ReactDOM.createPortal(itemTextProps.children, context.valueNode)\n : null}\n \n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_INDICATOR_NAME = 'SelectItemIndicator';\n\ntype SelectItemIndicatorElement = React.ComponentRef;\ninterface SelectItemIndicatorProps extends PrimitiveSpanProps {}\n\nconst SelectItemIndicator = /* @__PURE__ */ React.forwardRef<\n SelectItemIndicatorElement,\n SelectItemIndicatorProps\n>(\n // blank line to reduce diff noise\n function SelectItemIndicator(props: ScopedProps, forwardedRef) {\n const { __scopeSelect, ...itemIndicatorProps } = props;\n const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect);\n return itemContext.isSelected ? (\n \n ) : null;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * SelectScrollUpButton\n * -----------------------------------------------------------------------------------------------*/\n\nconst SCROLL_UP_BUTTON_NAME = 'SelectScrollUpButton';\n\ntype SelectScrollUpButtonElement = SelectScrollButtonImplElement;\ninterface SelectScrollUpButtonProps extends Omit {}\n\nconst SelectScrollUpButton = /* @__PURE__ */ React.forwardRef<\n SelectScrollUpButtonElement,\n SelectScrollUpButtonProps\n>(function SelectScrollUpButton(props: ScopedProps, forwardedRef) {\n const contentContext = useSelectContentContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect);\n const viewportContext = useSelectViewportContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect);\n const [canScrollUp, setCanScrollUp] = React.useState(false);\n const composedRefs = useComposedRefs(forwardedRef, viewportContext.onScrollButtonChange);\n\n useLayoutEffect(() => {\n if (contentContext.viewport && contentContext.isPositioned) {\n const viewport = contentContext.viewport;\n function handleScroll() {\n const canScrollUp = viewport.scrollTop > 0;\n setCanScrollUp(canScrollUp);\n }\n handleScroll();\n viewport.addEventListener('scroll', handleScroll);\n return () => viewport.removeEventListener('scroll', handleScroll);\n }\n }, [contentContext.viewport, contentContext.isPositioned]);\n\n return canScrollUp ? (\n {\n const { viewport, selectedItem } = contentContext;\n if (viewport && selectedItem) {\n viewport.scrollTop = viewport.scrollTop - selectedItem.offsetHeight;\n }\n }}\n />\n ) : null;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * SelectScrollDownButton\n * -----------------------------------------------------------------------------------------------*/\n\nconst SCROLL_DOWN_BUTTON_NAME = 'SelectScrollDownButton';\n\ntype SelectScrollDownButtonElement = SelectScrollButtonImplElement;\ninterface SelectScrollDownButtonProps extends Omit {}\n\nconst SelectScrollDownButton = /* @__PURE__ */ React.forwardRef<\n SelectScrollDownButtonElement,\n SelectScrollDownButtonProps\n>(function SelectScrollDownButton(props: ScopedProps, forwardedRef) {\n const contentContext = useSelectContentContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);\n const viewportContext = useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);\n const [canScrollDown, setCanScrollDown] = React.useState(false);\n const composedRefs = useComposedRefs(forwardedRef, viewportContext.onScrollButtonChange);\n\n useLayoutEffect(() => {\n if (contentContext.viewport && contentContext.isPositioned) {\n const viewport = contentContext.viewport;\n function handleScroll() {\n const maxScroll = viewport.scrollHeight - viewport.clientHeight;\n // we use Math.ceil here because if the UI is zoomed-in\n // `scrollTop` is not always reported as an integer\n const canScrollDown = Math.ceil(viewport.scrollTop) < maxScroll;\n setCanScrollDown(canScrollDown);\n }\n handleScroll();\n viewport.addEventListener('scroll', handleScroll);\n return () => viewport.removeEventListener('scroll', handleScroll);\n }\n }, [contentContext.viewport, contentContext.isPositioned]);\n\n return canScrollDown ? (\n {\n const { viewport, selectedItem } = contentContext;\n if (viewport && selectedItem) {\n viewport.scrollTop = viewport.scrollTop + selectedItem.offsetHeight;\n }\n }}\n />\n ) : null;\n});\n\ntype SelectScrollButtonImplElement = React.ComponentRef;\ninterface SelectScrollButtonImplProps extends PrimitiveDivProps {\n onAutoScroll(): void;\n}\n\nconst SelectScrollButtonImpl = /* @__PURE__ */ React.forwardRef<\n SelectScrollButtonImplElement,\n SelectScrollButtonImplProps\n>(function SelectScrollButtonImpl(props: ScopedProps, forwardedRef) {\n const { __scopeSelect, onAutoScroll, ...scrollIndicatorProps } = props;\n const contentContext = useSelectContentContext('SelectScrollButton', __scopeSelect);\n const autoScrollTimerRef = React.useRef(null);\n const getItems = useCollection(__scopeSelect);\n\n const clearAutoScrollTimer = React.useCallback(() => {\n if (autoScrollTimerRef.current !== null) {\n window.clearInterval(autoScrollTimerRef.current);\n autoScrollTimerRef.current = null;\n }\n }, []);\n\n React.useEffect(() => {\n return () => clearAutoScrollTimer();\n }, [clearAutoScrollTimer]);\n\n // When the viewport becomes scrollable on either side, the relevant scroll button will mount.\n // Because it is part of the normal flow, it will push down (top button) or shrink (bottom button)\n // the viewport, potentially causing the active item to now be partially out of view.\n // We re-run the `scrollIntoView` logic to make sure it stays within the viewport.\n useLayoutEffect(() => {\n const activeItem = getItems().find((item) => item.ref.current === document.activeElement);\n activeItem?.ref.current?.scrollIntoView({ block: 'nearest' });\n }, [getItems]);\n\n return (\n {\n if (autoScrollTimerRef.current === null) {\n autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);\n }\n })}\n onPointerMove={composeEventHandlers(scrollIndicatorProps.onPointerMove, () => {\n contentContext.onItemLeave?.();\n if (autoScrollTimerRef.current === null) {\n autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);\n }\n })}\n onPointerLeave={composeEventHandlers(scrollIndicatorProps.onPointerLeave, () => {\n clearAutoScrollTimer();\n })}\n />\n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * SelectSeparator\n * -----------------------------------------------------------------------------------------------*/\n\ntype SelectSeparatorElement = React.ComponentRef;\ninterface SelectSeparatorProps extends PrimitiveDivProps {}\n\nconst SelectSeparator = /* @__PURE__ */ React.forwardRef<\n SelectSeparatorElement,\n SelectSeparatorProps\n>(\n // blank line to reduce diff noise\n function SelectSeparator(props: ScopedProps, forwardedRef) {\n const { __scopeSelect, ...separatorProps } = props;\n return ;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * SelectArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'SelectArrow';\n\ntype SelectArrowElement = React.ComponentRef;\ntype PopperArrowProps = React.ComponentPropsWithoutRef;\ninterface SelectArrowProps extends PopperArrowProps {}\n\nconst SelectArrow = /* @__PURE__ */ React.forwardRef(\n function SelectArrow(props: ScopedProps, forwardedRef) {\n const { __scopeSelect, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopeSelect);\n const contentContext = useSelectContentContext(ARROW_NAME, __scopeSelect);\n return contentContext.position === Position.Popper ? (\n \n ) : null;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * SelectBubbleInput\n * -----------------------------------------------------------------------------------------------*/\n\nconst BUBBLE_INPUT_NAME = 'SelectBubbleInput';\n\ntype SelectBubbleInputElement = React.ComponentRef;\ntype PrimitiveSelectProps = React.ComponentPropsWithoutRef;\ninterface SelectBubbleInputProps extends Omit {}\n\nconst SelectBubbleInput = /* @__PURE__ */ React.forwardRef<\n SelectBubbleInputElement,\n SelectBubbleInputProps\n>(\n // blank line to reduce diff noise\n function SelectBubbleInput(\n { __scopeSelect, ...props }: ScopedProps,\n forwardedRef,\n ) {\n const context = useSelectContext(BUBBLE_INPUT_NAME, __scopeSelect);\n const { value, onValueChange, required, disabled, name, autoComplete, form, userSelection } =\n context;\n const { nativeOptions, nativeSelectKey } = context;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const selectValue = value ?? '';\n const prevValueRef = React.useRef(selectValue);\n // The user selection this input last accounted for, so each selection\n // notifies the form once.\n const handledUserSelectionRef = React.useRef(userSelection);\n const isDispatchingUserSelectionRef = React.useRef(false);\n\n // A consumer may render a `Select.Item` with an empty value to act as a\n // \"clear\" option. In that case it already provides a native `