mrsandip commited on
Commit
6301277
·
verified ·
1 Parent(s): ce77b71

Update (part 5)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. e-commerce/node_modules/@radix-ui/react-arrow/LICENSE +21 -0
  3. e-commerce/node_modules/@radix-ui/react-arrow/README.md +3 -0
  4. e-commerce/node_modules/@radix-ui/react-arrow/dist/index.d.mts +9 -0
  5. e-commerce/node_modules/@radix-ui/react-arrow/dist/index.d.ts +9 -0
  6. e-commerce/node_modules/@radix-ui/react-arrow/dist/index.js +61 -0
  7. e-commerce/node_modules/@radix-ui/react-arrow/dist/index.js.map +7 -0
  8. e-commerce/node_modules/@radix-ui/react-arrow/dist/index.mjs +30 -0
  9. e-commerce/node_modules/@radix-ui/react-arrow/dist/index.mjs.map +7 -0
  10. e-commerce/node_modules/@radix-ui/react-arrow/package.json +68 -0
  11. e-commerce/node_modules/@radix-ui/react-avatar/LICENSE +21 -0
  12. e-commerce/node_modules/@radix-ui/react-avatar/README.md +3 -0
  13. e-commerce/node_modules/@radix-ui/react-avatar/dist/index.d.mts +27 -0
  14. e-commerce/node_modules/@radix-ui/react-avatar/dist/index.d.ts +27 -0
  15. e-commerce/node_modules/@radix-ui/react-avatar/dist/index.js +195 -0
  16. e-commerce/node_modules/@radix-ui/react-avatar/dist/index.js.map +7 -0
  17. e-commerce/node_modules/@radix-ui/react-avatar/dist/index.mjs +164 -0
  18. e-commerce/node_modules/@radix-ui/react-avatar/dist/index.mjs.map +7 -0
  19. e-commerce/node_modules/@radix-ui/react-avatar/package.json +73 -0
  20. e-commerce/node_modules/@radix-ui/react-checkbox/LICENSE +21 -0
  21. e-commerce/node_modules/@radix-ui/react-checkbox/README.md +3 -0
  22. e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.d.mts +49 -0
  23. e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.d.ts +49 -0
  24. e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.js +353 -0
  25. e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.js.map +7 -0
  26. e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.mjs +322 -0
  27. e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.mjs.map +7 -0
  28. e-commerce/node_modules/@radix-ui/react-checkbox/package.json +74 -0
  29. e-commerce/node_modules/@radix-ui/react-collection/LICENSE +21 -0
  30. e-commerce/node_modules/@radix-ui/react-collection/README.md +3 -0
  31. e-commerce/node_modules/@radix-ui/react-collection/dist/index.d.mts +134 -0
  32. e-commerce/node_modules/@radix-ui/react-collection/dist/index.d.ts +134 -0
  33. e-commerce/node_modules/@radix-ui/react-collection/dist/index.js +681 -0
  34. e-commerce/node_modules/@radix-ui/react-collection/dist/index.js.map +7 -0
  35. e-commerce/node_modules/@radix-ui/react-collection/dist/index.mjs +650 -0
  36. e-commerce/node_modules/@radix-ui/react-collection/dist/index.mjs.map +7 -0
  37. e-commerce/node_modules/@radix-ui/react-collection/package.json +72 -0
  38. e-commerce/node_modules/@radix-ui/react-compose-refs/LICENSE +21 -0
  39. e-commerce/node_modules/@radix-ui/react-compose-refs/README.md +3 -0
  40. e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.d.mts +15 -0
  41. e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.d.ts +15 -0
  42. e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.js +78 -0
  43. e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.js.map +7 -0
  44. e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.mjs +47 -0
  45. e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.mjs.map +7 -0
  46. e-commerce/node_modules/@radix-ui/react-compose-refs/package.json +60 -0
  47. e-commerce/node_modules/@radix-ui/react-context/LICENSE +21 -0
  48. e-commerce/node_modules/@radix-ui/react-context/README.md +3 -0
  49. e-commerce/node_modules/@radix-ui/react-context/dist/index.d.mts +46 -0
  50. e-commerce/node_modules/@radix-ui/react-context/dist/index.d.ts +46 -0
.gitattributes CHANGED
@@ -80,3 +80,4 @@ e-commerce/node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.18.7 f
80
  e-commerce/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64-0.35.5.node filter=lfs diff=lfs merge=lfs -text
81
  e-commerce/node_modules/@next/swc-linux-x64-gnu/next-swc.linux-x64-gnu.node filter=lfs diff=lfs merge=lfs -text
82
  e-commerce/node_modules/@parcel/watcher-linux-x64-glibc/watcher.node filter=lfs diff=lfs merge=lfs -text
 
 
80
  e-commerce/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64-0.35.5.node filter=lfs diff=lfs merge=lfs -text
81
  e-commerce/node_modules/@next/swc-linux-x64-gnu/next-swc.linux-x64-gnu.node filter=lfs diff=lfs merge=lfs -text
82
  e-commerce/node_modules/@parcel/watcher-linux-x64-glibc/watcher.node filter=lfs diff=lfs merge=lfs -text
83
+ e-commerce/node_modules/@swc/core-linux-x64-gnu/swc.linux-x64-gnu.node filter=lfs diff=lfs merge=lfs -text
e-commerce/node_modules/@radix-ui/react-arrow/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2022 WorkOS
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
e-commerce/node_modules/@radix-ui/react-arrow/README.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # `react-arrow`
2
+
3
+ This is an internal utility, not intended for public usage.
e-commerce/node_modules/@radix-ui/react-arrow/dist/index.d.mts ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from 'react';
2
+ import { Primitive } from '@radix-ui/react-primitive';
3
+
4
+ type PrimitiveSvgProps = React.ComponentPropsWithoutRef<typeof Primitive.svg>;
5
+ interface ArrowProps extends PrimitiveSvgProps {
6
+ }
7
+ declare const Arrow: React.ForwardRefExoticComponent<ArrowProps & React.RefAttributes<SVGSVGElement>>;
8
+
9
+ export { Arrow, type ArrowProps, Arrow as Root };
e-commerce/node_modules/@radix-ui/react-arrow/dist/index.d.ts ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from 'react';
2
+ import { Primitive } from '@radix-ui/react-primitive';
3
+
4
+ type PrimitiveSvgProps = React.ComponentPropsWithoutRef<typeof Primitive.svg>;
5
+ interface ArrowProps extends PrimitiveSvgProps {
6
+ }
7
+ declare const Arrow: React.ForwardRefExoticComponent<ArrowProps & React.RefAttributes<SVGSVGElement>>;
8
+
9
+ export { Arrow, type ArrowProps, Arrow as Root };
e-commerce/node_modules/@radix-ui/react-arrow/dist/index.js ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+
32
+ // src/index.ts
33
+ var index_exports = {};
34
+ __export(index_exports, {
35
+ Arrow: () => Arrow,
36
+ Root: () => Arrow
37
+ });
38
+ module.exports = __toCommonJS(index_exports);
39
+
40
+ // src/arrow.tsx
41
+ var React = __toESM(require("react"));
42
+ var import_react_primitive = require("@radix-ui/react-primitive");
43
+ var import_jsx_runtime = require("react/jsx-runtime");
44
+ var Arrow = /* @__PURE__ */ React.forwardRef(
45
+ /* @__PURE__ */ __name(function Arrow2(props, forwardedRef) {
46
+ const { children, width = 10, height = 5, ...arrowProps } = props;
47
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
48
+ import_react_primitive.Primitive.svg,
49
+ {
50
+ ...arrowProps,
51
+ ref: forwardedRef,
52
+ width,
53
+ height,
54
+ viewBox: "0 0 30 10",
55
+ preserveAspectRatio: "none",
56
+ children: props.asChild ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("polygon", { points: "0,0 30,0 15,10" })
57
+ }
58
+ );
59
+ }, "Arrow")
60
+ );
61
+ //# sourceMappingURL=index.js.map
e-commerce/node_modules/@radix-ui/react-arrow/dist/index.js.map ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts", "../src/arrow.tsx"],
4
+ "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<typeof Primitive.svg>;\ntype PrimitiveSvgProps = React.ComponentPropsWithoutRef<typeof Primitive.svg>;\ninterface ArrowProps extends PrimitiveSvgProps {}\n\nconst Arrow = /* @__PURE__ */ React.forwardRef<ArrowElement, ArrowProps>(\n function Arrow(props, forwardedRef) {\n const { children, width = 10, height = 5, ...arrowProps } = props;\n return (\n <Primitive.svg\n {...arrowProps}\n ref={forwardedRef}\n width={width}\n height={height}\n viewBox=\"0 0 30 10\"\n preserveAspectRatio=\"none\"\n >\n {/* We use their children if they're slotting to replace the whole svg */}\n {props.asChild ? children : <polygon points=\"0,0 30,0 15,10\" />}\n </Primitive.svg>\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nexport {\n Arrow,\n //\n Arrow as Root,\n};\nexport type { ArrowProps };\n"],
5
+ "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;",
6
+ "names": ["Arrow"]
7
+ }
e-commerce/node_modules/@radix-ui/react-arrow/dist/index.mjs ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
+
5
+ // src/arrow.tsx
6
+ import * as React from "react";
7
+ import { Primitive } from "@radix-ui/react-primitive";
8
+ import { jsx } from "react/jsx-runtime";
9
+ var Arrow = /* @__PURE__ */ React.forwardRef(
10
+ /* @__PURE__ */ __name(function Arrow2(props, forwardedRef) {
11
+ const { children, width = 10, height = 5, ...arrowProps } = props;
12
+ return /* @__PURE__ */ jsx(
13
+ Primitive.svg,
14
+ {
15
+ ...arrowProps,
16
+ ref: forwardedRef,
17
+ width,
18
+ height,
19
+ viewBox: "0 0 30 10",
20
+ preserveAspectRatio: "none",
21
+ children: props.asChild ? children : /* @__PURE__ */ jsx("polygon", { points: "0,0 30,0 15,10" })
22
+ }
23
+ );
24
+ }, "Arrow")
25
+ );
26
+ export {
27
+ Arrow,
28
+ Arrow as Root
29
+ };
30
+ //# sourceMappingURL=index.mjs.map
e-commerce/node_modules/@radix-ui/react-arrow/dist/index.mjs.map ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/arrow.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nimport { Primitive } from '@radix-ui/react-primitive';\n\n/* -------------------------------------------------------------------------------------------------\n * Arrow\n * -----------------------------------------------------------------------------------------------*/\n\ntype ArrowElement = React.ComponentRef<typeof Primitive.svg>;\ntype PrimitiveSvgProps = React.ComponentPropsWithoutRef<typeof Primitive.svg>;\ninterface ArrowProps extends PrimitiveSvgProps {}\n\nconst Arrow = /* @__PURE__ */ React.forwardRef<ArrowElement, ArrowProps>(\n function Arrow(props, forwardedRef) {\n const { children, width = 10, height = 5, ...arrowProps } = props;\n return (\n <Primitive.svg\n {...arrowProps}\n ref={forwardedRef}\n width={width}\n height={height}\n viewBox=\"0 0 30 10\"\n preserveAspectRatio=\"none\"\n >\n {/* We use their children if they're slotting to replace the whole svg */}\n {props.asChild ? children : <polygon points=\"0,0 30,0 15,10\" />}\n </Primitive.svg>\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nexport {\n Arrow,\n //\n Arrow as Root,\n};\nexport type { ArrowProps };\n"],
5
+ "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;",
6
+ "names": ["Arrow"]
7
+ }
e-commerce/node_modules/@radix-ui/react-arrow/package.json ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@radix-ui/react-arrow",
3
+ "version": "1.1.17",
4
+ "license": "MIT",
5
+ "source": "./src/index.ts",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.mjs",
8
+ "files": [
9
+ "dist",
10
+ "README.md"
11
+ ],
12
+ "sideEffects": false,
13
+ "dependencies": {
14
+ "@radix-ui/react-primitive": "2.2.0"
15
+ },
16
+ "devDependencies": {
17
+ "@types/react": "^19.3.0",
18
+ "@types/react-dom": "^19.3.0",
19
+ "react": "^19.3.0",
20
+ "react-dom": "^19.3.0",
21
+ "typescript": "^5.9.3",
22
+ "@repo/builder": "0.0.0",
23
+ "@repo/typescript-config": "0.0.0"
24
+ },
25
+ "peerDependencies": {
26
+ "@types/react": "*",
27
+ "@types/react-dom": "*",
28
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
29
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
30
+ },
31
+ "peerDependenciesMeta": {
32
+ "@types/react": {
33
+ "optional": true
34
+ },
35
+ "@types/react-dom": {
36
+ "optional": true
37
+ }
38
+ },
39
+ "homepage": "https://radix-ui.com/primitives",
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "git+https://github.com/radix-ui/primitives.git",
43
+ "directory": "packages/react/arrow"
44
+ },
45
+ "bugs": {
46
+ "url": "https://github.com/radix-ui/primitives/issues"
47
+ },
48
+ "scripts": {
49
+ "lint": "oxlint --max-warnings 0 src",
50
+ "clean": "rm -rf dist",
51
+ "reset": "rm -rf dist node_modules",
52
+ "typecheck": "tsc --noEmit",
53
+ "build": "radix-build"
54
+ },
55
+ "types": "./dist/index.d.ts",
56
+ "exports": {
57
+ ".": {
58
+ "import": {
59
+ "types": "./dist/index.d.mts",
60
+ "default": "./dist/index.mjs"
61
+ },
62
+ "require": {
63
+ "types": "./dist/index.d.ts",
64
+ "default": "./dist/index.js"
65
+ }
66
+ }
67
+ }
68
+ }
e-commerce/node_modules/@radix-ui/react-avatar/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2022 WorkOS
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
e-commerce/node_modules/@radix-ui/react-avatar/README.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # `react-avatar`
2
+
3
+ View docs [here](https://radix-ui.com/primitives/docs/components/avatar).
e-commerce/node_modules/@radix-ui/react-avatar/dist/index.d.mts ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as _radix_ui_react_context from '@radix-ui/react-context';
2
+ import * as React from 'react';
3
+ import { Primitive } from '@radix-ui/react-primitive';
4
+
5
+ declare const createAvatarScope: _radix_ui_react_context.CreateScope;
6
+ declare const ImageLoadingStatus: {
7
+ readonly Idle: "idle";
8
+ readonly Loading: "loading";
9
+ readonly Loaded: "loaded";
10
+ readonly Error: "error";
11
+ };
12
+ type ImageLoadingStatus = (typeof ImageLoadingStatus)[keyof typeof ImageLoadingStatus];
13
+ type PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;
14
+ interface AvatarProps extends PrimitiveSpanProps {
15
+ }
16
+ declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
17
+ type PrimitiveImageProps = React.ComponentPropsWithoutRef<typeof Primitive.img>;
18
+ interface AvatarImageProps extends PrimitiveImageProps {
19
+ onLoadingStatusChange?: ((status: ImageLoadingStatus) => void) | undefined;
20
+ }
21
+ declare const AvatarImage: React.ForwardRefExoticComponent<AvatarImageProps & React.RefAttributes<HTMLImageElement>>;
22
+ interface AvatarFallbackProps extends PrimitiveSpanProps {
23
+ delayMs?: number | undefined;
24
+ }
25
+ declare const AvatarFallback: React.ForwardRefExoticComponent<AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>>;
26
+
27
+ export { Avatar, AvatarFallback, type AvatarFallbackProps, AvatarImage, type AvatarImageProps, type AvatarProps, AvatarFallback as Fallback, AvatarImage as Image, Avatar as Root, createAvatarScope };
e-commerce/node_modules/@radix-ui/react-avatar/dist/index.d.ts ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as _radix_ui_react_context from '@radix-ui/react-context';
2
+ import * as React from 'react';
3
+ import { Primitive } from '@radix-ui/react-primitive';
4
+
5
+ declare const createAvatarScope: _radix_ui_react_context.CreateScope;
6
+ declare const ImageLoadingStatus: {
7
+ readonly Idle: "idle";
8
+ readonly Loading: "loading";
9
+ readonly Loaded: "loaded";
10
+ readonly Error: "error";
11
+ };
12
+ type ImageLoadingStatus = (typeof ImageLoadingStatus)[keyof typeof ImageLoadingStatus];
13
+ type PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;
14
+ interface AvatarProps extends PrimitiveSpanProps {
15
+ }
16
+ declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
17
+ type PrimitiveImageProps = React.ComponentPropsWithoutRef<typeof Primitive.img>;
18
+ interface AvatarImageProps extends PrimitiveImageProps {
19
+ onLoadingStatusChange?: ((status: ImageLoadingStatus) => void) | undefined;
20
+ }
21
+ declare const AvatarImage: React.ForwardRefExoticComponent<AvatarImageProps & React.RefAttributes<HTMLImageElement>>;
22
+ interface AvatarFallbackProps extends PrimitiveSpanProps {
23
+ delayMs?: number | undefined;
24
+ }
25
+ declare const AvatarFallback: React.ForwardRefExoticComponent<AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>>;
26
+
27
+ export { Avatar, AvatarFallback, type AvatarFallbackProps, AvatarImage, type AvatarImageProps, type AvatarProps, AvatarFallback as Fallback, AvatarImage as Image, Avatar as Root, createAvatarScope };
e-commerce/node_modules/@radix-ui/react-avatar/dist/index.js ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+
32
+ // src/index.ts
33
+ var index_exports = {};
34
+ __export(index_exports, {
35
+ Avatar: () => Avatar,
36
+ AvatarFallback: () => AvatarFallback,
37
+ AvatarImage: () => AvatarImage,
38
+ Fallback: () => AvatarFallback,
39
+ Image: () => AvatarImage,
40
+ Root: () => Avatar,
41
+ createAvatarScope: () => createAvatarScope
42
+ });
43
+ module.exports = __toCommonJS(index_exports);
44
+
45
+ // src/avatar.tsx
46
+ var React = __toESM(require("react"));
47
+ var import_is_development = require("@radix-ui/primitive/is-development");
48
+ var import_react_context = require("@radix-ui/react-context");
49
+ var import_react_use_callback_ref = require("@radix-ui/react-use-callback-ref");
50
+ var import_react_use_layout_effect = require("@radix-ui/react-use-layout-effect");
51
+ var import_react_primitive = require("@radix-ui/react-primitive");
52
+ var import_jsx_runtime = require("react/jsx-runtime");
53
+ var AVATAR_NAME = "Avatar";
54
+ var [createAvatarContext, createAvatarScope] = (0, import_react_context.createContextScope)(AVATAR_NAME);
55
+ var ImageLoadingStatus = {
56
+ Idle: "idle",
57
+ Loading: "loading",
58
+ Loaded: "loaded",
59
+ Error: "error"
60
+ };
61
+ var STATIC_IMAGE_COUNT_STATE = [
62
+ 0,
63
+ () => void 0
64
+ ];
65
+ var [AvatarProvider, useAvatarContext] = createAvatarContext(AVATAR_NAME);
66
+ var Avatar = /* @__PURE__ */ React.forwardRef(
67
+ // blank line to reduce diff noise
68
+ /* @__PURE__ */ __name(function Avatar2(props, forwardedRef) {
69
+ const { __scopeAvatar, ...avatarProps } = props;
70
+ const [imageLoadingStatus, setImageLoadingStatus] = React.useState(
71
+ ImageLoadingStatus.Idle
72
+ );
73
+ const [imageCount, setImageCount] = useImageCount();
74
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
75
+ AvatarProvider,
76
+ {
77
+ scope: __scopeAvatar,
78
+ imageLoadingStatus,
79
+ setImageLoadingStatus,
80
+ imageCount,
81
+ setImageCount,
82
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.span, { ...avatarProps, ref: forwardedRef })
83
+ }
84
+ );
85
+ }, "Avatar")
86
+ );
87
+ var IMAGE_NAME = "AvatarImage";
88
+ var AvatarImage = /* @__PURE__ */ React.forwardRef(
89
+ /* @__PURE__ */ __name(function AvatarImage2(props, forwardedRef) {
90
+ const { __scopeAvatar, src, onLoadingStatusChange, ...imageProps } = props;
91
+ const context = useAvatarContext(IMAGE_NAME, __scopeAvatar);
92
+ useUpdateImageCount(context.setImageCount);
93
+ const imageLoadingStatus = useImageLoadingStatus(src, {
94
+ referrerPolicy: imageProps.referrerPolicy,
95
+ crossOrigin: imageProps.crossOrigin,
96
+ loadingStatus: context.imageLoadingStatus,
97
+ setLoadingStatus: context.setImageLoadingStatus
98
+ });
99
+ const handleLoadingStatusChange = (0, import_react_use_callback_ref.useCallbackRef)((status) => {
100
+ onLoadingStatusChange?.(status);
101
+ });
102
+ const loadingStatusRef = React.useRef(imageLoadingStatus);
103
+ (0, import_react_use_layout_effect.useLayoutEffect)(() => {
104
+ const previousLoadingStatus = loadingStatusRef.current;
105
+ loadingStatusRef.current = imageLoadingStatus;
106
+ if (imageLoadingStatus !== previousLoadingStatus) {
107
+ handleLoadingStatusChange(imageLoadingStatus);
108
+ }
109
+ }, [imageLoadingStatus, handleLoadingStatusChange]);
110
+ return imageLoadingStatus === ImageLoadingStatus.Loaded ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.img, { ...imageProps, ref: forwardedRef, src }) : null;
111
+ }, "AvatarImage")
112
+ );
113
+ var FALLBACK_NAME = "AvatarFallback";
114
+ var AvatarFallback = /* @__PURE__ */ React.forwardRef(
115
+ /* @__PURE__ */ __name(function AvatarFallback2(props, forwardedRef) {
116
+ const { __scopeAvatar, delayMs, ...fallbackProps } = props;
117
+ const context = useAvatarContext(FALLBACK_NAME, __scopeAvatar);
118
+ const [canRender, setCanRender] = React.useState(delayMs === void 0);
119
+ React.useEffect(() => {
120
+ if (delayMs !== void 0) {
121
+ const timerId = window.setTimeout(() => setCanRender(true), delayMs);
122
+ return () => window.clearTimeout(timerId);
123
+ }
124
+ }, [delayMs]);
125
+ return canRender && context.imageLoadingStatus !== ImageLoadingStatus.Loaded ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.span, { ...fallbackProps, ref: forwardedRef }) : null;
126
+ }, "AvatarFallback")
127
+ );
128
+ function useImageLoadingStatus(src, {
129
+ loadingStatus,
130
+ setLoadingStatus,
131
+ referrerPolicy,
132
+ crossOrigin
133
+ }) {
134
+ (0, import_react_use_layout_effect.useLayoutEffect)(() => {
135
+ if (!src) {
136
+ setLoadingStatus(ImageLoadingStatus.Error);
137
+ return;
138
+ }
139
+ const image = new window.Image();
140
+ const handleLoad = /* @__PURE__ */ __name((event) => {
141
+ const image2 = event.currentTarget;
142
+ setLoadingStatus(getImageLoadingStatus(image2));
143
+ }, "handleLoad");
144
+ const handleError = /* @__PURE__ */ __name(() => setLoadingStatus(ImageLoadingStatus.Error), "handleError");
145
+ image.addEventListener("load", handleLoad);
146
+ image.addEventListener("error", handleError);
147
+ if (referrerPolicy) {
148
+ image.referrerPolicy = referrerPolicy;
149
+ }
150
+ image.crossOrigin = crossOrigin ?? null;
151
+ image.src = src;
152
+ setLoadingStatus(getImageLoadingStatus(image));
153
+ return () => {
154
+ image.removeEventListener("load", handleLoad);
155
+ image.removeEventListener("error", handleError);
156
+ setLoadingStatus(ImageLoadingStatus.Idle);
157
+ };
158
+ }, [src, crossOrigin, referrerPolicy, setLoadingStatus]);
159
+ return loadingStatus;
160
+ }
161
+ __name(useImageLoadingStatus, "useImageLoadingStatus");
162
+ function getImageLoadingStatus(image) {
163
+ return image.complete ? image.naturalWidth > 0 ? ImageLoadingStatus.Loaded : ImageLoadingStatus.Error : ImageLoadingStatus.Loading;
164
+ }
165
+ __name(getImageLoadingStatus, "getImageLoadingStatus");
166
+ function useImageCount() {
167
+ let state = STATIC_IMAGE_COUNT_STATE;
168
+ if (import_is_development.IS_DEVELOPMENT) {
169
+ state = React.useState(0);
170
+ const [imageCount] = state;
171
+ const hasWarnedRef = React.useRef(false);
172
+ React.useEffect(() => {
173
+ if (imageCount > 1 && !hasWarnedRef.current) {
174
+ hasWarnedRef.current = true;
175
+ console.warn(
176
+ "Avatar: Only one `Avatar.Image` component should be rendered per `Avatar.Root`, but multiple were detected. This will lead to unexpected behavior."
177
+ );
178
+ }
179
+ }, [imageCount]);
180
+ }
181
+ return state;
182
+ }
183
+ __name(useImageCount, "useImageCount");
184
+ function useUpdateImageCount(setImageCount) {
185
+ if (import_is_development.IS_DEVELOPMENT) {
186
+ React.useEffect(() => {
187
+ setImageCount((imageCount) => imageCount + 1);
188
+ return () => {
189
+ setImageCount((imageCount) => imageCount - 1);
190
+ };
191
+ }, [setImageCount]);
192
+ }
193
+ }
194
+ __name(useUpdateImageCount, "useUpdateImageCount");
195
+ //# sourceMappingURL=index.js.map
e-commerce/node_modules/@radix-ui/react-avatar/dist/index.js.map ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts", "../src/avatar.tsx"],
4
+ "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> = 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<React.SetStateAction<ImageLoadingStatus>>;\n imageCount: number;\n setImageCount: React.Dispatch<React.SetStateAction<number>>;\n};\n\nconst STATIC_IMAGE_COUNT_STATE: [number, React.Dispatch<React.SetStateAction<number>>] = [\n 0,\n () => void 0,\n];\n\nconst [AvatarProvider, useAvatarContext] = createAvatarContext<AvatarContextValue>(AVATAR_NAME);\n\ntype AvatarElement = React.ComponentRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;\ninterface AvatarProps extends PrimitiveSpanProps {}\n\nconst Avatar = /* @__PURE__ */ React.forwardRef<AvatarElement, AvatarProps>(\n // blank line to reduce diff noise\n function Avatar(props: ScopedProps<AvatarProps>, forwardedRef) {\n const { __scopeAvatar, ...avatarProps } = props;\n const [imageLoadingStatus, setImageLoadingStatus] = React.useState<ImageLoadingStatus>(\n ImageLoadingStatus.Idle,\n );\n const [imageCount, setImageCount] = useImageCount();\n\n return (\n <AvatarProvider\n scope={__scopeAvatar}\n imageLoadingStatus={imageLoadingStatus}\n setImageLoadingStatus={setImageLoadingStatus}\n imageCount={imageCount}\n setImageCount={setImageCount}\n >\n <Primitive.span {...avatarProps} ref={forwardedRef} />\n </AvatarProvider>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AvatarImage\n * -----------------------------------------------------------------------------------------------*/\n\nconst IMAGE_NAME = 'AvatarImage';\n\ntype AvatarImageElement = React.ComponentRef<typeof Primitive.img>;\ntype PrimitiveImageProps = React.ComponentPropsWithoutRef<typeof Primitive.img>;\ninterface AvatarImageProps extends PrimitiveImageProps {\n onLoadingStatusChange?: ((status: ImageLoadingStatus) => void) | undefined;\n}\n\nconst AvatarImage = /* @__PURE__ */ React.forwardRef<AvatarImageElement, AvatarImageProps>(\n function AvatarImage(props: ScopedProps<AvatarImageProps>, 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>(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 <Primitive.img {...imageProps} ref={forwardedRef} src={src} />\n ) : null;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AvatarFallback\n * -----------------------------------------------------------------------------------------------*/\n\nconst FALLBACK_NAME = 'AvatarFallback';\n\ntype AvatarFallbackElement = React.ComponentRef<typeof Primitive.span>;\ninterface AvatarFallbackProps extends PrimitiveSpanProps {\n delayMs?: number | undefined;\n}\n\nconst AvatarFallback = /* @__PURE__ */ React.forwardRef<AvatarFallbackElement, AvatarFallbackProps>(\n function AvatarFallback(props: ScopedProps<AvatarFallbackProps>, 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 <Primitive.span {...fallbackProps} ref={forwardedRef} />\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<React.SetStateAction<ImageLoadingStatus>>;\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<React.SetStateAction<number>>) {\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"],
5
+ "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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AS,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,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;",
6
+ "names": ["Avatar", "AvatarImage", "AvatarFallback", "image"]
7
+ }
e-commerce/node_modules/@radix-ui/react-avatar/dist/index.mjs ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
+
5
+ // src/avatar.tsx
6
+ import * as React from "react";
7
+ import { IS_DEVELOPMENT } from "@radix-ui/primitive/is-development";
8
+ import { createContextScope } from "@radix-ui/react-context";
9
+ import { useCallbackRef } from "@radix-ui/react-use-callback-ref";
10
+ import { useLayoutEffect } from "@radix-ui/react-use-layout-effect";
11
+ import { Primitive } from "@radix-ui/react-primitive";
12
+ import { jsx } from "react/jsx-runtime";
13
+ var AVATAR_NAME = "Avatar";
14
+ var [createAvatarContext, createAvatarScope] = createContextScope(AVATAR_NAME);
15
+ var ImageLoadingStatus = {
16
+ Idle: "idle",
17
+ Loading: "loading",
18
+ Loaded: "loaded",
19
+ Error: "error"
20
+ };
21
+ var STATIC_IMAGE_COUNT_STATE = [
22
+ 0,
23
+ () => void 0
24
+ ];
25
+ var [AvatarProvider, useAvatarContext] = createAvatarContext(AVATAR_NAME);
26
+ var Avatar = /* @__PURE__ */ React.forwardRef(
27
+ // blank line to reduce diff noise
28
+ /* @__PURE__ */ __name(function Avatar2(props, forwardedRef) {
29
+ const { __scopeAvatar, ...avatarProps } = props;
30
+ const [imageLoadingStatus, setImageLoadingStatus] = React.useState(
31
+ ImageLoadingStatus.Idle
32
+ );
33
+ const [imageCount, setImageCount] = useImageCount();
34
+ return /* @__PURE__ */ jsx(
35
+ AvatarProvider,
36
+ {
37
+ scope: __scopeAvatar,
38
+ imageLoadingStatus,
39
+ setImageLoadingStatus,
40
+ imageCount,
41
+ setImageCount,
42
+ children: /* @__PURE__ */ jsx(Primitive.span, { ...avatarProps, ref: forwardedRef })
43
+ }
44
+ );
45
+ }, "Avatar")
46
+ );
47
+ var IMAGE_NAME = "AvatarImage";
48
+ var AvatarImage = /* @__PURE__ */ React.forwardRef(
49
+ /* @__PURE__ */ __name(function AvatarImage2(props, forwardedRef) {
50
+ const { __scopeAvatar, src, onLoadingStatusChange, ...imageProps } = props;
51
+ const context = useAvatarContext(IMAGE_NAME, __scopeAvatar);
52
+ useUpdateImageCount(context.setImageCount);
53
+ const imageLoadingStatus = useImageLoadingStatus(src, {
54
+ referrerPolicy: imageProps.referrerPolicy,
55
+ crossOrigin: imageProps.crossOrigin,
56
+ loadingStatus: context.imageLoadingStatus,
57
+ setLoadingStatus: context.setImageLoadingStatus
58
+ });
59
+ const handleLoadingStatusChange = useCallbackRef((status) => {
60
+ onLoadingStatusChange?.(status);
61
+ });
62
+ const loadingStatusRef = React.useRef(imageLoadingStatus);
63
+ useLayoutEffect(() => {
64
+ const previousLoadingStatus = loadingStatusRef.current;
65
+ loadingStatusRef.current = imageLoadingStatus;
66
+ if (imageLoadingStatus !== previousLoadingStatus) {
67
+ handleLoadingStatusChange(imageLoadingStatus);
68
+ }
69
+ }, [imageLoadingStatus, handleLoadingStatusChange]);
70
+ return imageLoadingStatus === ImageLoadingStatus.Loaded ? /* @__PURE__ */ jsx(Primitive.img, { ...imageProps, ref: forwardedRef, src }) : null;
71
+ }, "AvatarImage")
72
+ );
73
+ var FALLBACK_NAME = "AvatarFallback";
74
+ var AvatarFallback = /* @__PURE__ */ React.forwardRef(
75
+ /* @__PURE__ */ __name(function AvatarFallback2(props, forwardedRef) {
76
+ const { __scopeAvatar, delayMs, ...fallbackProps } = props;
77
+ const context = useAvatarContext(FALLBACK_NAME, __scopeAvatar);
78
+ const [canRender, setCanRender] = React.useState(delayMs === void 0);
79
+ React.useEffect(() => {
80
+ if (delayMs !== void 0) {
81
+ const timerId = window.setTimeout(() => setCanRender(true), delayMs);
82
+ return () => window.clearTimeout(timerId);
83
+ }
84
+ }, [delayMs]);
85
+ return canRender && context.imageLoadingStatus !== ImageLoadingStatus.Loaded ? /* @__PURE__ */ jsx(Primitive.span, { ...fallbackProps, ref: forwardedRef }) : null;
86
+ }, "AvatarFallback")
87
+ );
88
+ function useImageLoadingStatus(src, {
89
+ loadingStatus,
90
+ setLoadingStatus,
91
+ referrerPolicy,
92
+ crossOrigin
93
+ }) {
94
+ useLayoutEffect(() => {
95
+ if (!src) {
96
+ setLoadingStatus(ImageLoadingStatus.Error);
97
+ return;
98
+ }
99
+ const image = new window.Image();
100
+ const handleLoad = /* @__PURE__ */ __name((event) => {
101
+ const image2 = event.currentTarget;
102
+ setLoadingStatus(getImageLoadingStatus(image2));
103
+ }, "handleLoad");
104
+ const handleError = /* @__PURE__ */ __name(() => setLoadingStatus(ImageLoadingStatus.Error), "handleError");
105
+ image.addEventListener("load", handleLoad);
106
+ image.addEventListener("error", handleError);
107
+ if (referrerPolicy) {
108
+ image.referrerPolicy = referrerPolicy;
109
+ }
110
+ image.crossOrigin = crossOrigin ?? null;
111
+ image.src = src;
112
+ setLoadingStatus(getImageLoadingStatus(image));
113
+ return () => {
114
+ image.removeEventListener("load", handleLoad);
115
+ image.removeEventListener("error", handleError);
116
+ setLoadingStatus(ImageLoadingStatus.Idle);
117
+ };
118
+ }, [src, crossOrigin, referrerPolicy, setLoadingStatus]);
119
+ return loadingStatus;
120
+ }
121
+ __name(useImageLoadingStatus, "useImageLoadingStatus");
122
+ function getImageLoadingStatus(image) {
123
+ return image.complete ? image.naturalWidth > 0 ? ImageLoadingStatus.Loaded : ImageLoadingStatus.Error : ImageLoadingStatus.Loading;
124
+ }
125
+ __name(getImageLoadingStatus, "getImageLoadingStatus");
126
+ function useImageCount() {
127
+ let state = STATIC_IMAGE_COUNT_STATE;
128
+ if (IS_DEVELOPMENT) {
129
+ state = React.useState(0);
130
+ const [imageCount] = state;
131
+ const hasWarnedRef = React.useRef(false);
132
+ React.useEffect(() => {
133
+ if (imageCount > 1 && !hasWarnedRef.current) {
134
+ hasWarnedRef.current = true;
135
+ console.warn(
136
+ "Avatar: Only one `Avatar.Image` component should be rendered per `Avatar.Root`, but multiple were detected. This will lead to unexpected behavior."
137
+ );
138
+ }
139
+ }, [imageCount]);
140
+ }
141
+ return state;
142
+ }
143
+ __name(useImageCount, "useImageCount");
144
+ function useUpdateImageCount(setImageCount) {
145
+ if (IS_DEVELOPMENT) {
146
+ React.useEffect(() => {
147
+ setImageCount((imageCount) => imageCount + 1);
148
+ return () => {
149
+ setImageCount((imageCount) => imageCount - 1);
150
+ };
151
+ }, [setImageCount]);
152
+ }
153
+ }
154
+ __name(useUpdateImageCount, "useUpdateImageCount");
155
+ export {
156
+ Avatar,
157
+ AvatarFallback,
158
+ AvatarImage,
159
+ AvatarFallback as Fallback,
160
+ AvatarImage as Image,
161
+ Avatar as Root,
162
+ createAvatarScope
163
+ };
164
+ //# sourceMappingURL=index.mjs.map
e-commerce/node_modules/@radix-ui/react-avatar/dist/index.mjs.map ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/avatar.tsx"],
4
+ "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> = 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<React.SetStateAction<ImageLoadingStatus>>;\n imageCount: number;\n setImageCount: React.Dispatch<React.SetStateAction<number>>;\n};\n\nconst STATIC_IMAGE_COUNT_STATE: [number, React.Dispatch<React.SetStateAction<number>>] = [\n 0,\n () => void 0,\n];\n\nconst [AvatarProvider, useAvatarContext] = createAvatarContext<AvatarContextValue>(AVATAR_NAME);\n\ntype AvatarElement = React.ComponentRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;\ninterface AvatarProps extends PrimitiveSpanProps {}\n\nconst Avatar = /* @__PURE__ */ React.forwardRef<AvatarElement, AvatarProps>(\n // blank line to reduce diff noise\n function Avatar(props: ScopedProps<AvatarProps>, forwardedRef) {\n const { __scopeAvatar, ...avatarProps } = props;\n const [imageLoadingStatus, setImageLoadingStatus] = React.useState<ImageLoadingStatus>(\n ImageLoadingStatus.Idle,\n );\n const [imageCount, setImageCount] = useImageCount();\n\n return (\n <AvatarProvider\n scope={__scopeAvatar}\n imageLoadingStatus={imageLoadingStatus}\n setImageLoadingStatus={setImageLoadingStatus}\n imageCount={imageCount}\n setImageCount={setImageCount}\n >\n <Primitive.span {...avatarProps} ref={forwardedRef} />\n </AvatarProvider>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AvatarImage\n * -----------------------------------------------------------------------------------------------*/\n\nconst IMAGE_NAME = 'AvatarImage';\n\ntype AvatarImageElement = React.ComponentRef<typeof Primitive.img>;\ntype PrimitiveImageProps = React.ComponentPropsWithoutRef<typeof Primitive.img>;\ninterface AvatarImageProps extends PrimitiveImageProps {\n onLoadingStatusChange?: ((status: ImageLoadingStatus) => void) | undefined;\n}\n\nconst AvatarImage = /* @__PURE__ */ React.forwardRef<AvatarImageElement, AvatarImageProps>(\n function AvatarImage(props: ScopedProps<AvatarImageProps>, 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>(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 <Primitive.img {...imageProps} ref={forwardedRef} src={src} />\n ) : null;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AvatarFallback\n * -----------------------------------------------------------------------------------------------*/\n\nconst FALLBACK_NAME = 'AvatarFallback';\n\ntype AvatarFallbackElement = React.ComponentRef<typeof Primitive.span>;\ninterface AvatarFallbackProps extends PrimitiveSpanProps {\n delayMs?: number | undefined;\n}\n\nconst AvatarFallback = /* @__PURE__ */ React.forwardRef<AvatarFallbackElement, AvatarFallbackProps>(\n function AvatarFallback(props: ScopedProps<AvatarFallbackProps>, 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 <Primitive.span {...fallbackProps} ref={forwardedRef} />\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<React.SetStateAction<ImageLoadingStatus>>;\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<React.SetStateAction<number>>) {\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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AAA,IACF,GAAG,CAAC,aAAa,CAAC;AAAA,EACpB;AACF;AATS;",
6
+ "names": ["Avatar", "AvatarImage", "AvatarFallback", "image"]
7
+ }
e-commerce/node_modules/@radix-ui/react-avatar/package.json ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@radix-ui/react-avatar",
3
+ "version": "1.3.0",
4
+ "license": "MIT",
5
+ "source": "./src/index.ts",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.mjs",
8
+ "files": [
9
+ "dist",
10
+ "README.md"
11
+ ],
12
+ "sideEffects": false,
13
+ "dependencies": {
14
+ "@radix-ui/primitive": "1.2.0",
15
+ "@radix-ui/react-context": "1.3.0",
16
+ "@radix-ui/react-primitive": "2.2.0",
17
+ "@radix-ui/react-use-callback-ref": "1.1.5",
18
+ "@radix-ui/react-use-is-hydrated": "0.1.3",
19
+ "@radix-ui/react-use-layout-effect": "1.1.4"
20
+ },
21
+ "devDependencies": {
22
+ "@types/react": "^19.3.0",
23
+ "@types/react-dom": "^19.3.0",
24
+ "react": "^19.3.0",
25
+ "react-dom": "^19.3.0",
26
+ "typescript": "^5.9.3",
27
+ "@repo/builder": "0.0.0",
28
+ "@repo/typescript-config": "0.0.0"
29
+ },
30
+ "peerDependencies": {
31
+ "@types/react": "*",
32
+ "@types/react-dom": "*",
33
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
34
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
35
+ },
36
+ "peerDependenciesMeta": {
37
+ "@types/react": {
38
+ "optional": true
39
+ },
40
+ "@types/react-dom": {
41
+ "optional": true
42
+ }
43
+ },
44
+ "homepage": "https://radix-ui.com/primitives",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "git+https://github.com/radix-ui/primitives.git",
48
+ "directory": "packages/react/avatar"
49
+ },
50
+ "bugs": {
51
+ "url": "https://github.com/radix-ui/primitives/issues"
52
+ },
53
+ "scripts": {
54
+ "lint": "oxlint --max-warnings 0 src",
55
+ "clean": "rm -rf dist",
56
+ "reset": "rm -rf dist node_modules",
57
+ "typecheck": "tsc --noEmit",
58
+ "build": "radix-build"
59
+ },
60
+ "types": "./dist/index.d.ts",
61
+ "exports": {
62
+ ".": {
63
+ "import": {
64
+ "types": "./dist/index.d.mts",
65
+ "default": "./dist/index.mjs"
66
+ },
67
+ "require": {
68
+ "types": "./dist/index.d.ts",
69
+ "default": "./dist/index.js"
70
+ }
71
+ }
72
+ }
73
+ }
e-commerce/node_modules/@radix-ui/react-checkbox/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2022 WorkOS
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
e-commerce/node_modules/@radix-ui/react-checkbox/README.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # `react-checkbox`
2
+
3
+ View docs [here](https://radix-ui.com/primitives/docs/components/checkbox).
e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.d.mts ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as _radix_ui_react_context from '@radix-ui/react-context';
2
+ import { Scope } from '@radix-ui/react-context';
3
+ import * as React from 'react';
4
+ import { Primitive } from '@radix-ui/react-primitive';
5
+
6
+ type ScopedProps<P> = P & {
7
+ __scopeCheckbox?: Scope | undefined;
8
+ };
9
+ declare const createCheckboxScope: _radix_ui_react_context.CreateScope;
10
+ type CheckedState = boolean | 'indeterminate';
11
+ interface CheckboxProviderProps<State extends CheckedState = CheckedState> {
12
+ checked?: State | boolean | undefined;
13
+ defaultChecked?: State | boolean | undefined;
14
+ required?: boolean | undefined;
15
+ onCheckedChange?: ((checked: State | boolean) => void) | undefined;
16
+ name?: string | undefined;
17
+ form?: string | undefined;
18
+ disabled?: boolean | undefined;
19
+ value?: string | number | readonly string[] | undefined;
20
+ children?: React.ReactNode | undefined;
21
+ }
22
+ declare function CheckboxProvider<State extends CheckedState = CheckedState>(props: ScopedProps<CheckboxProviderProps<State>>): React.JSX.Element;
23
+ interface CheckboxTriggerProps extends Omit<React.ComponentPropsWithoutRef<typeof Primitive.button>, keyof CheckboxProviderProps> {
24
+ children?: React.ReactNode | undefined;
25
+ }
26
+ declare const CheckboxTrigger: React.ForwardRefExoticComponent<CheckboxTriggerProps & React.RefAttributes<HTMLButtonElement>>;
27
+ type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;
28
+ interface CheckboxProps extends Omit<PrimitiveButtonProps, 'checked' | 'defaultChecked'> {
29
+ checked?: CheckedState | undefined;
30
+ defaultChecked?: CheckedState | undefined;
31
+ required?: boolean | undefined;
32
+ onCheckedChange?: ((checked: CheckedState) => void) | undefined;
33
+ }
34
+ declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLButtonElement>>;
35
+ type PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;
36
+ interface CheckboxIndicatorProps extends PrimitiveSpanProps {
37
+ /**
38
+ * Used to force mounting when more control is needed. Useful when
39
+ * controlling animation with React animation libraries.
40
+ */
41
+ forceMount?: true | undefined;
42
+ }
43
+ declare const CheckboxIndicator: React.ForwardRefExoticComponent<CheckboxIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
44
+ type InputProps = React.ComponentPropsWithoutRef<typeof Primitive.input>;
45
+ interface CheckboxBubbleInputProps extends Omit<InputProps, 'checked'> {
46
+ }
47
+ declare const CheckboxBubbleInput: React.ForwardRefExoticComponent<CheckboxBubbleInputProps & React.RefAttributes<HTMLInputElement>>;
48
+
49
+ 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 };
e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.d.ts ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as _radix_ui_react_context from '@radix-ui/react-context';
2
+ import { Scope } from '@radix-ui/react-context';
3
+ import * as React from 'react';
4
+ import { Primitive } from '@radix-ui/react-primitive';
5
+
6
+ type ScopedProps<P> = P & {
7
+ __scopeCheckbox?: Scope | undefined;
8
+ };
9
+ declare const createCheckboxScope: _radix_ui_react_context.CreateScope;
10
+ type CheckedState = boolean | 'indeterminate';
11
+ interface CheckboxProviderProps<State extends CheckedState = CheckedState> {
12
+ checked?: State | boolean | undefined;
13
+ defaultChecked?: State | boolean | undefined;
14
+ required?: boolean | undefined;
15
+ onCheckedChange?: ((checked: State | boolean) => void) | undefined;
16
+ name?: string | undefined;
17
+ form?: string | undefined;
18
+ disabled?: boolean | undefined;
19
+ value?: string | number | readonly string[] | undefined;
20
+ children?: React.ReactNode | undefined;
21
+ }
22
+ declare function CheckboxProvider<State extends CheckedState = CheckedState>(props: ScopedProps<CheckboxProviderProps<State>>): React.JSX.Element;
23
+ interface CheckboxTriggerProps extends Omit<React.ComponentPropsWithoutRef<typeof Primitive.button>, keyof CheckboxProviderProps> {
24
+ children?: React.ReactNode | undefined;
25
+ }
26
+ declare const CheckboxTrigger: React.ForwardRefExoticComponent<CheckboxTriggerProps & React.RefAttributes<HTMLButtonElement>>;
27
+ type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;
28
+ interface CheckboxProps extends Omit<PrimitiveButtonProps, 'checked' | 'defaultChecked'> {
29
+ checked?: CheckedState | undefined;
30
+ defaultChecked?: CheckedState | undefined;
31
+ required?: boolean | undefined;
32
+ onCheckedChange?: ((checked: CheckedState) => void) | undefined;
33
+ }
34
+ declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLButtonElement>>;
35
+ type PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;
36
+ interface CheckboxIndicatorProps extends PrimitiveSpanProps {
37
+ /**
38
+ * Used to force mounting when more control is needed. Useful when
39
+ * controlling animation with React animation libraries.
40
+ */
41
+ forceMount?: true | undefined;
42
+ }
43
+ declare const CheckboxIndicator: React.ForwardRefExoticComponent<CheckboxIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
44
+ type InputProps = React.ComponentPropsWithoutRef<typeof Primitive.input>;
45
+ interface CheckboxBubbleInputProps extends Omit<InputProps, 'checked'> {
46
+ }
47
+ declare const CheckboxBubbleInput: React.ForwardRefExoticComponent<CheckboxBubbleInputProps & React.RefAttributes<HTMLInputElement>>;
48
+
49
+ 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 };
e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.js ADDED
@@ -0,0 +1,353 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+
32
+ // src/index.ts
33
+ var index_exports = {};
34
+ __export(index_exports, {
35
+ Checkbox: () => Checkbox,
36
+ CheckboxIndicator: () => CheckboxIndicator,
37
+ Indicator: () => CheckboxIndicator,
38
+ Root: () => Checkbox,
39
+ createCheckboxScope: () => createCheckboxScope,
40
+ unstable_BubbleInput: () => CheckboxBubbleInput,
41
+ unstable_CheckboxBubbleInput: () => CheckboxBubbleInput,
42
+ unstable_CheckboxProvider: () => CheckboxProvider,
43
+ unstable_CheckboxTrigger: () => CheckboxTrigger,
44
+ unstable_Provider: () => CheckboxProvider,
45
+ unstable_Trigger: () => CheckboxTrigger
46
+ });
47
+ module.exports = __toCommonJS(index_exports);
48
+
49
+ // src/checkbox.tsx
50
+ var React = __toESM(require("react"));
51
+ var import_react_compose_refs = require("@radix-ui/react-compose-refs");
52
+ var import_react_context = require("@radix-ui/react-context");
53
+ var import_primitive = require("@radix-ui/primitive");
54
+ var import_react_use_controllable_state = require("@radix-ui/react-use-controllable-state");
55
+ var import_react_use_size = require("@radix-ui/react-use-size");
56
+ var import_react_presence = require("@radix-ui/react-presence");
57
+ var import_react_primitive = require("@radix-ui/react-primitive");
58
+ var import_jsx_runtime = require("react/jsx-runtime");
59
+ var CHECKBOX_NAME = "Checkbox";
60
+ var [createCheckboxContext, createCheckboxScope] = (0, import_react_context.createContextScope)(CHECKBOX_NAME);
61
+ var [CheckboxProviderImpl, useCheckboxContext] = createCheckboxContext(CHECKBOX_NAME);
62
+ function CheckboxProvider(props) {
63
+ const {
64
+ __scopeCheckbox,
65
+ checked: checkedProp,
66
+ children,
67
+ defaultChecked,
68
+ disabled,
69
+ form,
70
+ name,
71
+ onCheckedChange,
72
+ required,
73
+ value = "on",
74
+ // @ts-expect-error
75
+ internal_do_not_use_render
76
+ } = props;
77
+ const [checked, setChecked] = (0, import_react_use_controllable_state.useControllableState)({
78
+ prop: checkedProp,
79
+ defaultProp: defaultChecked ?? false,
80
+ onChange: onCheckedChange,
81
+ caller: CHECKBOX_NAME
82
+ });
83
+ const [control, setControl] = React.useState(null);
84
+ const [bubbleInput, setBubbleInput] = React.useState(null);
85
+ const [userClick, setUserClick] = React.useState(null);
86
+ const isFormControl = control ? !!form || !!control.closest("form") : (
87
+ // We set this to true by default so that events bubble to forms without JS (SSR)
88
+ true
89
+ );
90
+ const context = {
91
+ checked,
92
+ disabled,
93
+ setChecked,
94
+ control,
95
+ setControl,
96
+ name,
97
+ form,
98
+ value,
99
+ userClick,
100
+ onUserClick: setUserClick,
101
+ required,
102
+ defaultChecked: isIndeterminate(defaultChecked) ? false : defaultChecked,
103
+ isFormControl,
104
+ bubbleInput,
105
+ setBubbleInput
106
+ };
107
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
108
+ CheckboxProviderImpl,
109
+ {
110
+ scope: __scopeCheckbox,
111
+ ...context,
112
+ children: isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children
113
+ }
114
+ );
115
+ }
116
+ __name(CheckboxProvider, "CheckboxProvider");
117
+ var TRIGGER_NAME = "CheckboxTrigger";
118
+ var CheckboxTrigger = /* @__PURE__ */ React.forwardRef(
119
+ /* @__PURE__ */ __name(function CheckboxTrigger2({ __scopeCheckbox, onKeyDown, onClick, ...checkboxProps }, forwardedRef) {
120
+ const {
121
+ control,
122
+ value,
123
+ disabled,
124
+ checked,
125
+ required,
126
+ setControl,
127
+ setChecked,
128
+ onUserClick,
129
+ isFormControl,
130
+ bubbleInput
131
+ } = useCheckboxContext(TRIGGER_NAME, __scopeCheckbox);
132
+ const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, setControl);
133
+ const initialCheckedStateRef = React.useRef(checked);
134
+ React.useEffect(() => {
135
+ const form = control?.form;
136
+ if (form) {
137
+ const reset = /* @__PURE__ */ __name(() => setChecked(initialCheckedStateRef.current), "reset");
138
+ form.addEventListener("reset", reset);
139
+ return () => form.removeEventListener("reset", reset);
140
+ }
141
+ }, [control, setChecked]);
142
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
143
+ import_react_primitive.Primitive.button,
144
+ {
145
+ type: "button",
146
+ role: "checkbox",
147
+ "aria-checked": isIndeterminate(checked) ? "mixed" : checked,
148
+ "aria-required": required,
149
+ "data-state": getState(checked),
150
+ "data-disabled": disabled ? "" : void 0,
151
+ disabled,
152
+ value,
153
+ ...checkboxProps,
154
+ ref: composedRefs,
155
+ onKeyDown: (0, import_primitive.composeEventHandlers)(onKeyDown, (event) => {
156
+ if (event.key === "Enter") event.preventDefault();
157
+ }),
158
+ onClick: (0, import_primitive.composeEventHandlers)(onClick, (event) => {
159
+ const hasConsumerStoppedPropagation = event.isPropagationStopped();
160
+ onUserClick({
161
+ requestedChecked: isIndeterminate(checked) ? true : !checked,
162
+ hasConsumerStoppedPropagation
163
+ });
164
+ setChecked((prevChecked) => isIndeterminate(prevChecked) ? true : !prevChecked);
165
+ if (bubbleInput && isFormControl) {
166
+ if (!hasConsumerStoppedPropagation) event.stopPropagation();
167
+ }
168
+ })
169
+ }
170
+ );
171
+ }, "CheckboxTrigger")
172
+ );
173
+ var Checkbox = /* @__PURE__ */ React.forwardRef(
174
+ // blank line to reduce diff noise
175
+ /* @__PURE__ */ __name(function Checkbox2(props, forwardedRef) {
176
+ const {
177
+ __scopeCheckbox,
178
+ name,
179
+ checked,
180
+ defaultChecked,
181
+ required,
182
+ disabled,
183
+ value,
184
+ onCheckedChange,
185
+ form,
186
+ ...checkboxProps
187
+ } = props;
188
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
189
+ CheckboxProvider,
190
+ {
191
+ __scopeCheckbox,
192
+ checked,
193
+ defaultChecked,
194
+ disabled,
195
+ required,
196
+ onCheckedChange,
197
+ name,
198
+ form,
199
+ value,
200
+ internal_do_not_use_render: ({ isFormControl }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
201
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
202
+ CheckboxTrigger,
203
+ {
204
+ ...checkboxProps,
205
+ ref: forwardedRef,
206
+ __scopeCheckbox
207
+ }
208
+ ),
209
+ isFormControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
210
+ CheckboxBubbleInput,
211
+ {
212
+ __scopeCheckbox
213
+ }
214
+ )
215
+ ] })
216
+ }
217
+ );
218
+ }, "Checkbox")
219
+ );
220
+ var INDICATOR_NAME = "CheckboxIndicator";
221
+ var CheckboxIndicator = /* @__PURE__ */ React.forwardRef(
222
+ // blank line to reduce diff noise
223
+ /* @__PURE__ */ __name(function CheckboxIndicator2(props, forwardedRef) {
224
+ const { __scopeCheckbox, forceMount, ...indicatorProps } = props;
225
+ const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);
226
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
227
+ import_react_presence.Presence,
228
+ {
229
+ present: forceMount || isIndeterminate(context.checked) || context.checked === true,
230
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
231
+ import_react_primitive.Primitive.span,
232
+ {
233
+ "data-state": getState(context.checked),
234
+ "data-disabled": context.disabled ? "" : void 0,
235
+ ...indicatorProps,
236
+ ref: forwardedRef,
237
+ style: { pointerEvents: "none", ...props.style }
238
+ }
239
+ )
240
+ }
241
+ );
242
+ }, "CheckboxIndicator")
243
+ );
244
+ var BUBBLE_INPUT_NAME = "CheckboxBubbleInput";
245
+ var CheckboxBubbleInput = /* @__PURE__ */ React.forwardRef(
246
+ // blank line to reduce diff noise
247
+ /* @__PURE__ */ __name(function CheckboxBubbleInput2({ __scopeCheckbox, onClick, ...props }, forwardedRef) {
248
+ const {
249
+ control,
250
+ userClick,
251
+ checked,
252
+ defaultChecked,
253
+ required,
254
+ disabled,
255
+ name,
256
+ value,
257
+ form,
258
+ bubbleInput,
259
+ setBubbleInput
260
+ } = useCheckboxContext(BUBBLE_INPUT_NAME, __scopeCheckbox);
261
+ const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, setBubbleInput);
262
+ const controlSize = (0, import_react_use_size.useSize)(control);
263
+ const shouldStopClickPropagationRef = React.useRef(false);
264
+ const prevCheckedRef = React.useRef(checked);
265
+ const handledUserClickRef = React.useRef(userClick);
266
+ const pendingUserClickRef = React.useRef(null);
267
+ React.useEffect(() => {
268
+ const input = bubbleInput;
269
+ if (!input) return;
270
+ const inputProto = window.HTMLInputElement.prototype;
271
+ const descriptor = Object.getOwnPropertyDescriptor(
272
+ inputProto,
273
+ "checked"
274
+ );
275
+ const setChecked = descriptor.set;
276
+ if (!setChecked) return;
277
+ const checkedChanged = prevCheckedRef.current !== checked;
278
+ prevCheckedRef.current = checked;
279
+ const isNewUserClick = userClick !== null && userClick !== handledUserClickRef.current;
280
+ handledUserClickRef.current = userClick;
281
+ if (isNewUserClick) {
282
+ pendingUserClickRef.current = checkedChanged ? null : userClick;
283
+ if (checkedChanged) {
284
+ input.indeterminate = isIndeterminate(checked);
285
+ setChecked.call(input, isIndeterminate(checked) ? false : checked);
286
+ }
287
+ input.dispatchEvent(
288
+ new Event("click", { bubbles: !userClick.hasConsumerStoppedPropagation })
289
+ );
290
+ } else if (checkedChanged) {
291
+ const pendingUserClick = pendingUserClickRef.current;
292
+ pendingUserClickRef.current = null;
293
+ const isPendingUserChange = pendingUserClick?.requestedChecked === checked;
294
+ shouldStopClickPropagationRef.current = true;
295
+ input.indeterminate = isIndeterminate(checked);
296
+ setChecked.call(input, isIndeterminate(checked) ? false : checked);
297
+ input.dispatchEvent(
298
+ new Event("click", {
299
+ bubbles: !(isPendingUserChange && pendingUserClick.hasConsumerStoppedPropagation)
300
+ })
301
+ );
302
+ shouldStopClickPropagationRef.current = false;
303
+ }
304
+ }, [bubbleInput, checked, userClick]);
305
+ const defaultCheckedRef = React.useRef(isIndeterminate(checked) ? false : checked);
306
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
307
+ import_react_primitive.Primitive.input,
308
+ {
309
+ type: "checkbox",
310
+ "aria-hidden": true,
311
+ defaultChecked: defaultChecked ?? defaultCheckedRef.current,
312
+ required,
313
+ disabled,
314
+ name,
315
+ value,
316
+ form,
317
+ ...props,
318
+ tabIndex: -1,
319
+ ref: composedRefs,
320
+ onClick: (0, import_primitive.composeEventHandlers)(onClick, (event) => {
321
+ if (shouldStopClickPropagationRef.current) {
322
+ event.stopPropagation();
323
+ }
324
+ }),
325
+ style: {
326
+ ...props.style,
327
+ ...controlSize,
328
+ position: "absolute",
329
+ pointerEvents: "none",
330
+ opacity: 0,
331
+ margin: 0,
332
+ // We transform because the input is absolutely positioned but we have
333
+ // rendered it **after** the button. This pulls it back to sit on top
334
+ // of the button.
335
+ transform: "translateX(-100%)"
336
+ }
337
+ }
338
+ );
339
+ }, "CheckboxBubbleInput")
340
+ );
341
+ function isFunction(value) {
342
+ return typeof value === "function";
343
+ }
344
+ __name(isFunction, "isFunction");
345
+ function isIndeterminate(checked) {
346
+ return checked === "indeterminate";
347
+ }
348
+ __name(isIndeterminate, "isIndeterminate");
349
+ function getState(checked) {
350
+ return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
351
+ }
352
+ __name(getState, "getState");
353
+ //# sourceMappingURL=index.js.map
e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.js.map ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts", "../src/checkbox.tsx"],
4
+ "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> = 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<State extends CheckedState | boolean = CheckedState> = {\n checked: State | boolean;\n setChecked: React.Dispatch<React.SetStateAction<State | boolean>>;\n disabled: boolean | undefined;\n control: HTMLButtonElement | null;\n setControl: React.Dispatch<React.SetStateAction<HTMLButtonElement | null>>;\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<React.SetStateAction<HTMLInputElement | null>>;\n};\n\nconst [CheckboxProviderImpl, useCheckboxContext] =\n createCheckboxContext<CheckboxContextValue>(CHECKBOX_NAME);\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxProvider\n * -----------------------------------------------------------------------------------------------*/\n\ninterface CheckboxProviderProps<State extends CheckedState = CheckedState> {\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<State extends CheckedState = CheckedState>(\n props: ScopedProps<CheckboxProviderProps<State>>,\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<HTMLButtonElement | null>(null);\n const [bubbleInput, setBubbleInput] = React.useState<HTMLInputElement | null>(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<CheckboxUserClick | null>(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<State> = {\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 <CheckboxProviderImpl\n scope={__scopeCheckbox}\n {...(context as unknown as CheckboxContextValue<CheckedState>)}\n >\n {isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children}\n </CheckboxProviderImpl>\n );\n}\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'CheckboxTrigger';\n\ninterface CheckboxTriggerProps extends Omit<\n React.ComponentPropsWithoutRef<typeof Primitive.button>,\n keyof CheckboxProviderProps\n> {\n children?: React.ReactNode | undefined;\n}\n\nconst CheckboxTrigger = /* @__PURE__ */ React.forwardRef<HTMLButtonElement, CheckboxTriggerProps>(\n function CheckboxTrigger(\n { __scopeCheckbox, onKeyDown, onClick, ...checkboxProps }: ScopedProps<CheckboxTriggerProps>,\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 <Primitive.button\n type=\"button\"\n role=\"checkbox\"\n aria-checked={isIndeterminate(checked) ? 'mixed' : checked}\n aria-required={required}\n data-state={getState(checked)}\n data-disabled={disabled ? '' : undefined}\n disabled={disabled}\n value={value}\n {...checkboxProps}\n ref={composedRefs}\n onKeyDown={composeEventHandlers(onKeyDown, (event) => {\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<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface CheckboxProps extends Omit<PrimitiveButtonProps, 'checked' | 'defaultChecked'> {\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<CheckboxElement, CheckboxProps>(\n // blank line to reduce diff noise\n function Checkbox(props: ScopedProps<CheckboxProps>, 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 <CheckboxProvider\n __scopeCheckbox={__scopeCheckbox}\n checked={checked}\n defaultChecked={defaultChecked}\n disabled={disabled}\n required={required}\n onCheckedChange={onCheckedChange}\n name={name}\n form={form}\n value={value}\n // @ts-expect-error\n internal_do_not_use_render={({ isFormControl }: CheckboxContextValue) => (\n <>\n <CheckboxTrigger\n {...checkboxProps}\n ref={forwardedRef}\n // @ts-expect-error\n __scopeCheckbox={__scopeCheckbox}\n />\n {isFormControl && (\n <CheckboxBubbleInput\n // @ts-expect-error\n __scopeCheckbox={__scopeCheckbox}\n />\n )}\n </>\n )}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'CheckboxIndicator';\n\ntype CheckboxIndicatorElement = React.ComponentRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;\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<CheckboxIndicatorProps>, forwardedRef) {\n const { __scopeCheckbox, forceMount, ...indicatorProps } = props;\n const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);\n return (\n <Presence\n present={forceMount || isIndeterminate(context.checked) || context.checked === true}\n >\n <Primitive.span\n data-state={getState(context.checked)}\n data-disabled={context.disabled ? '' : undefined}\n {...indicatorProps}\n ref={forwardedRef}\n style={{ pointerEvents: 'none', ...props.style }}\n />\n </Presence>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxBubbleInput\n * -----------------------------------------------------------------------------------------------*/\n\nconst BUBBLE_INPUT_NAME = 'CheckboxBubbleInput';\n\ntype InputProps = React.ComponentPropsWithoutRef<typeof Primitive.input>;\ninterface CheckboxBubbleInputProps extends Omit<InputProps, 'checked'> {}\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<CheckboxBubbleInputProps>,\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<CheckboxUserClick | null>(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 <Primitive.input\n type=\"checkbox\"\n aria-hidden\n defaultChecked={defaultChecked ?? defaultCheckedRef.current}\n required={required}\n disabled={disabled}\n name={name}\n value={value}\n form={form}\n {...props}\n tabIndex={-1}\n ref={composedRefs}\n onClick={composeEventHandlers(onClick, (event) => {\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"],
5
+ "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,k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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
+
5
+ // src/checkbox.tsx
6
+ import * as React from "react";
7
+ import { useComposedRefs } from "@radix-ui/react-compose-refs";
8
+ import { createContextScope } from "@radix-ui/react-context";
9
+ import { composeEventHandlers } from "@radix-ui/primitive";
10
+ import { useControllableState } from "@radix-ui/react-use-controllable-state";
11
+ import { useSize } from "@radix-ui/react-use-size";
12
+ import { Presence } from "@radix-ui/react-presence";
13
+ import { Primitive } from "@radix-ui/react-primitive";
14
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
+ var CHECKBOX_NAME = "Checkbox";
16
+ var [createCheckboxContext, createCheckboxScope] = createContextScope(CHECKBOX_NAME);
17
+ var [CheckboxProviderImpl, useCheckboxContext] = createCheckboxContext(CHECKBOX_NAME);
18
+ function CheckboxProvider(props) {
19
+ const {
20
+ __scopeCheckbox,
21
+ checked: checkedProp,
22
+ children,
23
+ defaultChecked,
24
+ disabled,
25
+ form,
26
+ name,
27
+ onCheckedChange,
28
+ required,
29
+ value = "on",
30
+ // @ts-expect-error
31
+ internal_do_not_use_render
32
+ } = props;
33
+ const [checked, setChecked] = useControllableState({
34
+ prop: checkedProp,
35
+ defaultProp: defaultChecked ?? false,
36
+ onChange: onCheckedChange,
37
+ caller: CHECKBOX_NAME
38
+ });
39
+ const [control, setControl] = React.useState(null);
40
+ const [bubbleInput, setBubbleInput] = React.useState(null);
41
+ const [userClick, setUserClick] = React.useState(null);
42
+ const isFormControl = control ? !!form || !!control.closest("form") : (
43
+ // We set this to true by default so that events bubble to forms without JS (SSR)
44
+ true
45
+ );
46
+ const context = {
47
+ checked,
48
+ disabled,
49
+ setChecked,
50
+ control,
51
+ setControl,
52
+ name,
53
+ form,
54
+ value,
55
+ userClick,
56
+ onUserClick: setUserClick,
57
+ required,
58
+ defaultChecked: isIndeterminate(defaultChecked) ? false : defaultChecked,
59
+ isFormControl,
60
+ bubbleInput,
61
+ setBubbleInput
62
+ };
63
+ return /* @__PURE__ */ jsx(
64
+ CheckboxProviderImpl,
65
+ {
66
+ scope: __scopeCheckbox,
67
+ ...context,
68
+ children: isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children
69
+ }
70
+ );
71
+ }
72
+ __name(CheckboxProvider, "CheckboxProvider");
73
+ var TRIGGER_NAME = "CheckboxTrigger";
74
+ var CheckboxTrigger = /* @__PURE__ */ React.forwardRef(
75
+ /* @__PURE__ */ __name(function CheckboxTrigger2({ __scopeCheckbox, onKeyDown, onClick, ...checkboxProps }, forwardedRef) {
76
+ const {
77
+ control,
78
+ value,
79
+ disabled,
80
+ checked,
81
+ required,
82
+ setControl,
83
+ setChecked,
84
+ onUserClick,
85
+ isFormControl,
86
+ bubbleInput
87
+ } = useCheckboxContext(TRIGGER_NAME, __scopeCheckbox);
88
+ const composedRefs = useComposedRefs(forwardedRef, setControl);
89
+ const initialCheckedStateRef = React.useRef(checked);
90
+ React.useEffect(() => {
91
+ const form = control?.form;
92
+ if (form) {
93
+ const reset = /* @__PURE__ */ __name(() => setChecked(initialCheckedStateRef.current), "reset");
94
+ form.addEventListener("reset", reset);
95
+ return () => form.removeEventListener("reset", reset);
96
+ }
97
+ }, [control, setChecked]);
98
+ return /* @__PURE__ */ jsx(
99
+ Primitive.button,
100
+ {
101
+ type: "button",
102
+ role: "checkbox",
103
+ "aria-checked": isIndeterminate(checked) ? "mixed" : checked,
104
+ "aria-required": required,
105
+ "data-state": getState(checked),
106
+ "data-disabled": disabled ? "" : void 0,
107
+ disabled,
108
+ value,
109
+ ...checkboxProps,
110
+ ref: composedRefs,
111
+ onKeyDown: composeEventHandlers(onKeyDown, (event) => {
112
+ if (event.key === "Enter") event.preventDefault();
113
+ }),
114
+ onClick: composeEventHandlers(onClick, (event) => {
115
+ const hasConsumerStoppedPropagation = event.isPropagationStopped();
116
+ onUserClick({
117
+ requestedChecked: isIndeterminate(checked) ? true : !checked,
118
+ hasConsumerStoppedPropagation
119
+ });
120
+ setChecked((prevChecked) => isIndeterminate(prevChecked) ? true : !prevChecked);
121
+ if (bubbleInput && isFormControl) {
122
+ if (!hasConsumerStoppedPropagation) event.stopPropagation();
123
+ }
124
+ })
125
+ }
126
+ );
127
+ }, "CheckboxTrigger")
128
+ );
129
+ var Checkbox = /* @__PURE__ */ React.forwardRef(
130
+ // blank line to reduce diff noise
131
+ /* @__PURE__ */ __name(function Checkbox2(props, forwardedRef) {
132
+ const {
133
+ __scopeCheckbox,
134
+ name,
135
+ checked,
136
+ defaultChecked,
137
+ required,
138
+ disabled,
139
+ value,
140
+ onCheckedChange,
141
+ form,
142
+ ...checkboxProps
143
+ } = props;
144
+ return /* @__PURE__ */ jsx(
145
+ CheckboxProvider,
146
+ {
147
+ __scopeCheckbox,
148
+ checked,
149
+ defaultChecked,
150
+ disabled,
151
+ required,
152
+ onCheckedChange,
153
+ name,
154
+ form,
155
+ value,
156
+ internal_do_not_use_render: ({ isFormControl }) => /* @__PURE__ */ jsxs(Fragment, { children: [
157
+ /* @__PURE__ */ jsx(
158
+ CheckboxTrigger,
159
+ {
160
+ ...checkboxProps,
161
+ ref: forwardedRef,
162
+ __scopeCheckbox
163
+ }
164
+ ),
165
+ isFormControl && /* @__PURE__ */ jsx(
166
+ CheckboxBubbleInput,
167
+ {
168
+ __scopeCheckbox
169
+ }
170
+ )
171
+ ] })
172
+ }
173
+ );
174
+ }, "Checkbox")
175
+ );
176
+ var INDICATOR_NAME = "CheckboxIndicator";
177
+ var CheckboxIndicator = /* @__PURE__ */ React.forwardRef(
178
+ // blank line to reduce diff noise
179
+ /* @__PURE__ */ __name(function CheckboxIndicator2(props, forwardedRef) {
180
+ const { __scopeCheckbox, forceMount, ...indicatorProps } = props;
181
+ const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);
182
+ return /* @__PURE__ */ jsx(
183
+ Presence,
184
+ {
185
+ present: forceMount || isIndeterminate(context.checked) || context.checked === true,
186
+ children: /* @__PURE__ */ jsx(
187
+ Primitive.span,
188
+ {
189
+ "data-state": getState(context.checked),
190
+ "data-disabled": context.disabled ? "" : void 0,
191
+ ...indicatorProps,
192
+ ref: forwardedRef,
193
+ style: { pointerEvents: "none", ...props.style }
194
+ }
195
+ )
196
+ }
197
+ );
198
+ }, "CheckboxIndicator")
199
+ );
200
+ var BUBBLE_INPUT_NAME = "CheckboxBubbleInput";
201
+ var CheckboxBubbleInput = /* @__PURE__ */ React.forwardRef(
202
+ // blank line to reduce diff noise
203
+ /* @__PURE__ */ __name(function CheckboxBubbleInput2({ __scopeCheckbox, onClick, ...props }, forwardedRef) {
204
+ const {
205
+ control,
206
+ userClick,
207
+ checked,
208
+ defaultChecked,
209
+ required,
210
+ disabled,
211
+ name,
212
+ value,
213
+ form,
214
+ bubbleInput,
215
+ setBubbleInput
216
+ } = useCheckboxContext(BUBBLE_INPUT_NAME, __scopeCheckbox);
217
+ const composedRefs = useComposedRefs(forwardedRef, setBubbleInput);
218
+ const controlSize = useSize(control);
219
+ const shouldStopClickPropagationRef = React.useRef(false);
220
+ const prevCheckedRef = React.useRef(checked);
221
+ const handledUserClickRef = React.useRef(userClick);
222
+ const pendingUserClickRef = React.useRef(null);
223
+ React.useEffect(() => {
224
+ const input = bubbleInput;
225
+ if (!input) return;
226
+ const inputProto = window.HTMLInputElement.prototype;
227
+ const descriptor = Object.getOwnPropertyDescriptor(
228
+ inputProto,
229
+ "checked"
230
+ );
231
+ const setChecked = descriptor.set;
232
+ if (!setChecked) return;
233
+ const checkedChanged = prevCheckedRef.current !== checked;
234
+ prevCheckedRef.current = checked;
235
+ const isNewUserClick = userClick !== null && userClick !== handledUserClickRef.current;
236
+ handledUserClickRef.current = userClick;
237
+ if (isNewUserClick) {
238
+ pendingUserClickRef.current = checkedChanged ? null : userClick;
239
+ if (checkedChanged) {
240
+ input.indeterminate = isIndeterminate(checked);
241
+ setChecked.call(input, isIndeterminate(checked) ? false : checked);
242
+ }
243
+ input.dispatchEvent(
244
+ new Event("click", { bubbles: !userClick.hasConsumerStoppedPropagation })
245
+ );
246
+ } else if (checkedChanged) {
247
+ const pendingUserClick = pendingUserClickRef.current;
248
+ pendingUserClickRef.current = null;
249
+ const isPendingUserChange = pendingUserClick?.requestedChecked === checked;
250
+ shouldStopClickPropagationRef.current = true;
251
+ input.indeterminate = isIndeterminate(checked);
252
+ setChecked.call(input, isIndeterminate(checked) ? false : checked);
253
+ input.dispatchEvent(
254
+ new Event("click", {
255
+ bubbles: !(isPendingUserChange && pendingUserClick.hasConsumerStoppedPropagation)
256
+ })
257
+ );
258
+ shouldStopClickPropagationRef.current = false;
259
+ }
260
+ }, [bubbleInput, checked, userClick]);
261
+ const defaultCheckedRef = React.useRef(isIndeterminate(checked) ? false : checked);
262
+ return /* @__PURE__ */ jsx(
263
+ Primitive.input,
264
+ {
265
+ type: "checkbox",
266
+ "aria-hidden": true,
267
+ defaultChecked: defaultChecked ?? defaultCheckedRef.current,
268
+ required,
269
+ disabled,
270
+ name,
271
+ value,
272
+ form,
273
+ ...props,
274
+ tabIndex: -1,
275
+ ref: composedRefs,
276
+ onClick: composeEventHandlers(onClick, (event) => {
277
+ if (shouldStopClickPropagationRef.current) {
278
+ event.stopPropagation();
279
+ }
280
+ }),
281
+ style: {
282
+ ...props.style,
283
+ ...controlSize,
284
+ position: "absolute",
285
+ pointerEvents: "none",
286
+ opacity: 0,
287
+ margin: 0,
288
+ // We transform because the input is absolutely positioned but we have
289
+ // rendered it **after** the button. This pulls it back to sit on top
290
+ // of the button.
291
+ transform: "translateX(-100%)"
292
+ }
293
+ }
294
+ );
295
+ }, "CheckboxBubbleInput")
296
+ );
297
+ function isFunction(value) {
298
+ return typeof value === "function";
299
+ }
300
+ __name(isFunction, "isFunction");
301
+ function isIndeterminate(checked) {
302
+ return checked === "indeterminate";
303
+ }
304
+ __name(isIndeterminate, "isIndeterminate");
305
+ function getState(checked) {
306
+ return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
307
+ }
308
+ __name(getState, "getState");
309
+ export {
310
+ Checkbox,
311
+ CheckboxIndicator,
312
+ CheckboxIndicator as Indicator,
313
+ Checkbox as Root,
314
+ createCheckboxScope,
315
+ CheckboxBubbleInput as unstable_BubbleInput,
316
+ CheckboxBubbleInput as unstable_CheckboxBubbleInput,
317
+ CheckboxProvider as unstable_CheckboxProvider,
318
+ CheckboxTrigger as unstable_CheckboxTrigger,
319
+ CheckboxProvider as unstable_Provider,
320
+ CheckboxTrigger as unstable_Trigger
321
+ };
322
+ //# sourceMappingURL=index.mjs.map
e-commerce/node_modules/@radix-ui/react-checkbox/dist/index.mjs.map ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/checkbox.tsx"],
4
+ "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> = 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<State extends CheckedState | boolean = CheckedState> = {\n checked: State | boolean;\n setChecked: React.Dispatch<React.SetStateAction<State | boolean>>;\n disabled: boolean | undefined;\n control: HTMLButtonElement | null;\n setControl: React.Dispatch<React.SetStateAction<HTMLButtonElement | null>>;\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<React.SetStateAction<HTMLInputElement | null>>;\n};\n\nconst [CheckboxProviderImpl, useCheckboxContext] =\n createCheckboxContext<CheckboxContextValue>(CHECKBOX_NAME);\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxProvider\n * -----------------------------------------------------------------------------------------------*/\n\ninterface CheckboxProviderProps<State extends CheckedState = CheckedState> {\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<State extends CheckedState = CheckedState>(\n props: ScopedProps<CheckboxProviderProps<State>>,\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<HTMLButtonElement | null>(null);\n const [bubbleInput, setBubbleInput] = React.useState<HTMLInputElement | null>(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<CheckboxUserClick | null>(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<State> = {\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 <CheckboxProviderImpl\n scope={__scopeCheckbox}\n {...(context as unknown as CheckboxContextValue<CheckedState>)}\n >\n {isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children}\n </CheckboxProviderImpl>\n );\n}\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'CheckboxTrigger';\n\ninterface CheckboxTriggerProps extends Omit<\n React.ComponentPropsWithoutRef<typeof Primitive.button>,\n keyof CheckboxProviderProps\n> {\n children?: React.ReactNode | undefined;\n}\n\nconst CheckboxTrigger = /* @__PURE__ */ React.forwardRef<HTMLButtonElement, CheckboxTriggerProps>(\n function CheckboxTrigger(\n { __scopeCheckbox, onKeyDown, onClick, ...checkboxProps }: ScopedProps<CheckboxTriggerProps>,\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 <Primitive.button\n type=\"button\"\n role=\"checkbox\"\n aria-checked={isIndeterminate(checked) ? 'mixed' : checked}\n aria-required={required}\n data-state={getState(checked)}\n data-disabled={disabled ? '' : undefined}\n disabled={disabled}\n value={value}\n {...checkboxProps}\n ref={composedRefs}\n onKeyDown={composeEventHandlers(onKeyDown, (event) => {\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<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface CheckboxProps extends Omit<PrimitiveButtonProps, 'checked' | 'defaultChecked'> {\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<CheckboxElement, CheckboxProps>(\n // blank line to reduce diff noise\n function Checkbox(props: ScopedProps<CheckboxProps>, 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 <CheckboxProvider\n __scopeCheckbox={__scopeCheckbox}\n checked={checked}\n defaultChecked={defaultChecked}\n disabled={disabled}\n required={required}\n onCheckedChange={onCheckedChange}\n name={name}\n form={form}\n value={value}\n // @ts-expect-error\n internal_do_not_use_render={({ isFormControl }: CheckboxContextValue) => (\n <>\n <CheckboxTrigger\n {...checkboxProps}\n ref={forwardedRef}\n // @ts-expect-error\n __scopeCheckbox={__scopeCheckbox}\n />\n {isFormControl && (\n <CheckboxBubbleInput\n // @ts-expect-error\n __scopeCheckbox={__scopeCheckbox}\n />\n )}\n </>\n )}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'CheckboxIndicator';\n\ntype CheckboxIndicatorElement = React.ComponentRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;\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<CheckboxIndicatorProps>, forwardedRef) {\n const { __scopeCheckbox, forceMount, ...indicatorProps } = props;\n const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);\n return (\n <Presence\n present={forceMount || isIndeterminate(context.checked) || context.checked === true}\n >\n <Primitive.span\n data-state={getState(context.checked)}\n data-disabled={context.disabled ? '' : undefined}\n {...indicatorProps}\n ref={forwardedRef}\n style={{ pointerEvents: 'none', ...props.style }}\n />\n </Presence>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxBubbleInput\n * -----------------------------------------------------------------------------------------------*/\n\nconst BUBBLE_INPUT_NAME = 'CheckboxBubbleInput';\n\ntype InputProps = React.ComponentPropsWithoutRef<typeof Primitive.input>;\ninterface CheckboxBubbleInputProps extends Omit<InputProps, 'checked'> {}\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<CheckboxBubbleInputProps>,\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<CheckboxUserClick | null>(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 <Primitive.input\n type=\"checkbox\"\n aria-hidden\n defaultChecked={defaultChecked ?? defaultCheckedRef.current}\n required={required}\n disabled={disabled}\n name={name}\n value={value}\n form={form}\n {...props}\n tabIndex={-1}\n ref={composedRefs}\n onClick={composeEventHandlers(onClick, (event) => {\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"],
5
+ "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,IACA,QAAQ;AAAA;AAAA,IAER;AAAA,EACF,IAAI;AAEJ,QAAM,CAAC,SAAS,UAAU,IAAI,q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A,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;",
6
+ "names": ["CheckboxTrigger", "Checkbox", "CheckboxIndicator", "CheckboxBubbleInput"]
7
+ }
e-commerce/node_modules/@radix-ui/react-checkbox/package.json ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@radix-ui/react-checkbox",
3
+ "version": "1.4.0",
4
+ "license": "MIT",
5
+ "source": "./src/index.ts",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.mjs",
8
+ "files": [
9
+ "dist",
10
+ "README.md"
11
+ ],
12
+ "sideEffects": false,
13
+ "dependencies": {
14
+ "@radix-ui/primitive": "1.2.0",
15
+ "@radix-ui/react-compose-refs": "1.1.5",
16
+ "@radix-ui/react-context": "1.3.0",
17
+ "@radix-ui/react-presence": "1.1.11",
18
+ "@radix-ui/react-primitive": "2.2.0",
19
+ "@radix-ui/react-use-controllable-state": "1.3.0",
20
+ "@radix-ui/react-use-size": "1.1.5"
21
+ },
22
+ "devDependencies": {
23
+ "@types/react": "^19.3.0",
24
+ "@types/react-dom": "^19.3.0",
25
+ "react": "^19.3.0",
26
+ "react-dom": "^19.3.0",
27
+ "typescript": "^5.9.3",
28
+ "@repo/builder": "0.0.0",
29
+ "@repo/typescript-config": "0.0.0"
30
+ },
31
+ "peerDependencies": {
32
+ "@types/react": "*",
33
+ "@types/react-dom": "*",
34
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
35
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
36
+ },
37
+ "peerDependenciesMeta": {
38
+ "@types/react": {
39
+ "optional": true
40
+ },
41
+ "@types/react-dom": {
42
+ "optional": true
43
+ }
44
+ },
45
+ "homepage": "https://radix-ui.com/primitives",
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/radix-ui/primitives.git",
49
+ "directory": "packages/react/checkbox"
50
+ },
51
+ "bugs": {
52
+ "url": "https://github.com/radix-ui/primitives/issues"
53
+ },
54
+ "scripts": {
55
+ "lint": "oxlint --max-warnings 0 src",
56
+ "clean": "rm -rf dist",
57
+ "reset": "rm -rf dist node_modules",
58
+ "typecheck": "tsc --noEmit",
59
+ "build": "radix-build"
60
+ },
61
+ "types": "./dist/index.d.ts",
62
+ "exports": {
63
+ ".": {
64
+ "import": {
65
+ "types": "./dist/index.d.mts",
66
+ "default": "./dist/index.mjs"
67
+ },
68
+ "require": {
69
+ "types": "./dist/index.d.ts",
70
+ "default": "./dist/index.js"
71
+ }
72
+ }
73
+ }
74
+ }
e-commerce/node_modules/@radix-ui/react-collection/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2022 WorkOS
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
e-commerce/node_modules/@radix-ui/react-collection/README.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # `react-collection`
2
+
3
+ This is an internal utility, not intended for public usage.
e-commerce/node_modules/@radix-ui/react-collection/dist/index.d.mts ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as _radix_ui_react_context from '@radix-ui/react-context';
2
+ import * as React from 'react';
3
+ import { Slot } from '@radix-ui/react-slot';
4
+
5
+ type SlotProps$1 = React.ComponentPropsWithoutRef<typeof Slot>;
6
+ interface CollectionProps extends SlotProps$1 {
7
+ scope: any;
8
+ }
9
+ declare function createCollection$1<ItemElement extends HTMLElement, ItemData = {}>(name: string): readonly [{
10
+ readonly Provider: React.FC<{
11
+ children?: React.ReactNode | undefined;
12
+ scope: any;
13
+ }>;
14
+ readonly Slot: React.ForwardRefExoticComponent<CollectionProps & React.RefAttributes<HTMLElement>>;
15
+ readonly ItemSlot: React.ForwardRefExoticComponent<React.PropsWithoutRef<ItemData & {
16
+ children: React.ReactNode;
17
+ scope: any;
18
+ }> & React.RefAttributes<ItemElement>>;
19
+ }, (scope: any) => () => ({
20
+ ref: React.RefObject<ItemElement | null>;
21
+ } & ItemData)[], _radix_ui_react_context.CreateScope];
22
+
23
+ declare class OrderedDict<K, V> extends Map<K, V> {
24
+ #private;
25
+ constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);
26
+ set(key: K, value: V): this;
27
+ /**
28
+ * Sets a key-value pair so that it ends up at the given index.
29
+ * - Existing keys are moved
30
+ * - Negative indices count from the end of the resulting dictionary, so
31
+ * inserting at -1 makes the item the last one, -2 the second to last, etc.
32
+ * - Out-of-range indices are clamped
33
+ */
34
+ insert(index: number, key: K, value: V): this;
35
+ with(index: number, key: K, value: V): OrderedDict<K, V>;
36
+ before(key: K): [K, V] | undefined;
37
+ /**
38
+ * Sets a new key-value pair at the position before the given key.
39
+ */
40
+ setBefore(key: K, newKey: K, value: V): this;
41
+ after(key: K): [K, V] | undefined;
42
+ /**
43
+ * Sets a new key-value pair at the position after the given key.
44
+ */
45
+ setAfter(key: K, newKey: K, value: V): this;
46
+ first(): [K, V] | undefined;
47
+ last(): [K, V] | undefined;
48
+ clear(): void;
49
+ delete(key: K): boolean;
50
+ deleteAt(index: number): boolean;
51
+ at(index: number): V | undefined;
52
+ entryAt(index: number): [K, V] | undefined;
53
+ indexOf(key: K): number;
54
+ keyAt(index: number): K | undefined;
55
+ from(key: K, offset: number): V | undefined;
56
+ keyFrom(key: K, offset: number): K | undefined;
57
+ find(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => boolean, thisArg?: any): [K, V] | undefined;
58
+ findIndex(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => boolean, thisArg?: any): number;
59
+ filter<KK extends K, VV extends V>(predicate: (entry: [K, V], index: number, dict: OrderedDict<K, V>) => entry is [KK, VV], thisArg?: any): OrderedDict<KK, VV>;
60
+ filter(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown, thisArg?: any): OrderedDict<K, V>;
61
+ map<U>(callbackfn: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => U, thisArg?: any): OrderedDict<K, U>;
62
+ reduce(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => [K, V]): [K, V];
63
+ reduce(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => [K, V], initialValue: [K, V]): [K, V];
64
+ reduce<U>(callbackfn: (previousValue: U, currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => U, initialValue: U): U;
65
+ reduceRight(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => [K, V]): [K, V];
66
+ reduceRight(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => [K, V], initialValue: [K, V]): [K, V];
67
+ reduceRight<U>(callbackfn: (previousValue: U, currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => U, initialValue: U): U;
68
+ /**
69
+ * Sorts the dictionary in place. This method mutates the dictionary and
70
+ * returns a reference to the same object
71
+ *
72
+ * @param compareFn Function used to determine the order of the elements. It
73
+ * is expected to return a negative value if the first argument is less than
74
+ * the second argument, zero if they're equal, and a positive value otherwise.
75
+ */
76
+ sort(compareFn: (a: [K, V], b: [K, V]) => number): OrderedDict<K, V>;
77
+ /**
78
+ * Returns a copy of the dictionary with its elements sorted.
79
+ *
80
+ * @param compareFn Function used to determine the order of the elements. It
81
+ * is expected to return a negative value if the first argument is less than
82
+ * the second argument, zero if they're equal, and a positive value otherwise.
83
+ */
84
+ toSorted(compareFn: (a: [K, V], b: [K, V]) => number): OrderedDict<K, V>;
85
+ toReversed(): OrderedDict<K, V>;
86
+ toSpliced(start: number, deleteCount?: number): OrderedDict<K, V>;
87
+ toSpliced(start: number, deleteCount: number, ...items: [K, V][]): OrderedDict<K, V>;
88
+ slice(start?: number, end?: number): OrderedDict<K, V>;
89
+ every(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown, thisArg?: any): boolean;
90
+ some(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown, thisArg?: any): boolean;
91
+ }
92
+ type ReadOnlyOrderedDict<K, V> = Omit<OrderedDict<K, V>, 'set' | 'insert' | 'setBefore' | 'setAfter' | 'clear' | 'delete' | 'deleteAt' | 'sort'>;
93
+
94
+ type SlotProps = React.ComponentPropsWithoutRef<typeof Slot>;
95
+ interface CollectionSlotProps extends SlotProps {
96
+ scope: any;
97
+ }
98
+ interface BaseItemData {
99
+ id?: string | undefined;
100
+ }
101
+ type ItemDataWithElement<ItemData extends BaseItemData, ItemElement extends HTMLElement> = ItemData & {
102
+ element: ItemElement;
103
+ };
104
+ type BaseCollectionDict<ItemElement extends HTMLElement, ItemData extends BaseItemData> = OrderedDict<ItemElement, ItemDataWithElement<ItemData, ItemElement>>;
105
+ type CollectionDict<ItemElement extends HTMLElement, ItemData> = ReadOnlyOrderedDict<ItemElement, ItemDataWithElement<ItemData & BaseItemData, ItemElement>>;
106
+ /**
107
+ * Creates a collection that tracks its items in document order and exposes them
108
+ * during render via `useCollection`.
109
+ *
110
+ * Item data passed to `ItemSlot` (every prop other than `scope` and `children`)
111
+ * must be referentially stable across renders. It is compared shallowly, and any
112
+ * change re-registers the item and replaces the item map. Memoize objects,
113
+ * arrays and callbacks with `useMemo` / `useCallback`, or define them outside of
114
+ * render.
115
+ */
116
+ declare function createCollection<ItemElement extends HTMLElement, ItemData extends {} = {}>(name: string): readonly [{
117
+ readonly Provider: React.FC<{
118
+ children?: React.ReactNode | undefined;
119
+ scope: any;
120
+ state?: [ItemMap: BaseCollectionDict<ItemElement, ItemData & BaseItemData>, SetItemMap: React.Dispatch<React.SetStateAction<BaseCollectionDict<ItemElement, ItemData & BaseItemData>>>] | undefined;
121
+ }>;
122
+ readonly Slot: React.ForwardRefExoticComponent<CollectionSlotProps & React.RefAttributes<HTMLElement>>;
123
+ readonly ItemSlot: React.ForwardRefExoticComponent<React.PropsWithoutRef<ItemData & BaseItemData & {
124
+ children: React.ReactNode;
125
+ scope: any;
126
+ }> & React.RefAttributes<ItemElement>>;
127
+ }, {
128
+ createCollectionScope: _radix_ui_react_context.CreateScope;
129
+ useCollection: (scope: any) => CollectionDict<ItemElement, ItemData & BaseItemData>;
130
+ useGetCollection: (scope: any) => () => CollectionDict<ItemElement, ItemData & BaseItemData>;
131
+ useInitCollection: () => [BaseCollectionDict<ItemElement, ItemData & BaseItemData>, React.Dispatch<React.SetStateAction<BaseCollectionDict<ItemElement, ItemData & BaseItemData>>>];
132
+ }];
133
+
134
+ export { type CollectionProps, createCollection$1 as createCollection, type CollectionDict as unstable_CollectionDict, type CollectionSlotProps as unstable_CollectionSlotProps, createCollection as unstable_createCollection };
e-commerce/node_modules/@radix-ui/react-collection/dist/index.d.ts ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as _radix_ui_react_context from '@radix-ui/react-context';
2
+ import * as React from 'react';
3
+ import { Slot } from '@radix-ui/react-slot';
4
+
5
+ type SlotProps$1 = React.ComponentPropsWithoutRef<typeof Slot>;
6
+ interface CollectionProps extends SlotProps$1 {
7
+ scope: any;
8
+ }
9
+ declare function createCollection$1<ItemElement extends HTMLElement, ItemData = {}>(name: string): readonly [{
10
+ readonly Provider: React.FC<{
11
+ children?: React.ReactNode | undefined;
12
+ scope: any;
13
+ }>;
14
+ readonly Slot: React.ForwardRefExoticComponent<CollectionProps & React.RefAttributes<HTMLElement>>;
15
+ readonly ItemSlot: React.ForwardRefExoticComponent<React.PropsWithoutRef<ItemData & {
16
+ children: React.ReactNode;
17
+ scope: any;
18
+ }> & React.RefAttributes<ItemElement>>;
19
+ }, (scope: any) => () => ({
20
+ ref: React.RefObject<ItemElement | null>;
21
+ } & ItemData)[], _radix_ui_react_context.CreateScope];
22
+
23
+ declare class OrderedDict<K, V> extends Map<K, V> {
24
+ #private;
25
+ constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);
26
+ set(key: K, value: V): this;
27
+ /**
28
+ * Sets a key-value pair so that it ends up at the given index.
29
+ * - Existing keys are moved
30
+ * - Negative indices count from the end of the resulting dictionary, so
31
+ * inserting at -1 makes the item the last one, -2 the second to last, etc.
32
+ * - Out-of-range indices are clamped
33
+ */
34
+ insert(index: number, key: K, value: V): this;
35
+ with(index: number, key: K, value: V): OrderedDict<K, V>;
36
+ before(key: K): [K, V] | undefined;
37
+ /**
38
+ * Sets a new key-value pair at the position before the given key.
39
+ */
40
+ setBefore(key: K, newKey: K, value: V): this;
41
+ after(key: K): [K, V] | undefined;
42
+ /**
43
+ * Sets a new key-value pair at the position after the given key.
44
+ */
45
+ setAfter(key: K, newKey: K, value: V): this;
46
+ first(): [K, V] | undefined;
47
+ last(): [K, V] | undefined;
48
+ clear(): void;
49
+ delete(key: K): boolean;
50
+ deleteAt(index: number): boolean;
51
+ at(index: number): V | undefined;
52
+ entryAt(index: number): [K, V] | undefined;
53
+ indexOf(key: K): number;
54
+ keyAt(index: number): K | undefined;
55
+ from(key: K, offset: number): V | undefined;
56
+ keyFrom(key: K, offset: number): K | undefined;
57
+ find(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => boolean, thisArg?: any): [K, V] | undefined;
58
+ findIndex(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => boolean, thisArg?: any): number;
59
+ filter<KK extends K, VV extends V>(predicate: (entry: [K, V], index: number, dict: OrderedDict<K, V>) => entry is [KK, VV], thisArg?: any): OrderedDict<KK, VV>;
60
+ filter(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown, thisArg?: any): OrderedDict<K, V>;
61
+ map<U>(callbackfn: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => U, thisArg?: any): OrderedDict<K, U>;
62
+ reduce(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => [K, V]): [K, V];
63
+ reduce(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => [K, V], initialValue: [K, V]): [K, V];
64
+ reduce<U>(callbackfn: (previousValue: U, currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => U, initialValue: U): U;
65
+ reduceRight(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => [K, V]): [K, V];
66
+ reduceRight(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => [K, V], initialValue: [K, V]): [K, V];
67
+ reduceRight<U>(callbackfn: (previousValue: U, currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => U, initialValue: U): U;
68
+ /**
69
+ * Sorts the dictionary in place. This method mutates the dictionary and
70
+ * returns a reference to the same object
71
+ *
72
+ * @param compareFn Function used to determine the order of the elements. It
73
+ * is expected to return a negative value if the first argument is less than
74
+ * the second argument, zero if they're equal, and a positive value otherwise.
75
+ */
76
+ sort(compareFn: (a: [K, V], b: [K, V]) => number): OrderedDict<K, V>;
77
+ /**
78
+ * Returns a copy of the dictionary with its elements sorted.
79
+ *
80
+ * @param compareFn Function used to determine the order of the elements. It
81
+ * is expected to return a negative value if the first argument is less than
82
+ * the second argument, zero if they're equal, and a positive value otherwise.
83
+ */
84
+ toSorted(compareFn: (a: [K, V], b: [K, V]) => number): OrderedDict<K, V>;
85
+ toReversed(): OrderedDict<K, V>;
86
+ toSpliced(start: number, deleteCount?: number): OrderedDict<K, V>;
87
+ toSpliced(start: number, deleteCount: number, ...items: [K, V][]): OrderedDict<K, V>;
88
+ slice(start?: number, end?: number): OrderedDict<K, V>;
89
+ every(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown, thisArg?: any): boolean;
90
+ some(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown, thisArg?: any): boolean;
91
+ }
92
+ type ReadOnlyOrderedDict<K, V> = Omit<OrderedDict<K, V>, 'set' | 'insert' | 'setBefore' | 'setAfter' | 'clear' | 'delete' | 'deleteAt' | 'sort'>;
93
+
94
+ type SlotProps = React.ComponentPropsWithoutRef<typeof Slot>;
95
+ interface CollectionSlotProps extends SlotProps {
96
+ scope: any;
97
+ }
98
+ interface BaseItemData {
99
+ id?: string | undefined;
100
+ }
101
+ type ItemDataWithElement<ItemData extends BaseItemData, ItemElement extends HTMLElement> = ItemData & {
102
+ element: ItemElement;
103
+ };
104
+ type BaseCollectionDict<ItemElement extends HTMLElement, ItemData extends BaseItemData> = OrderedDict<ItemElement, ItemDataWithElement<ItemData, ItemElement>>;
105
+ type CollectionDict<ItemElement extends HTMLElement, ItemData> = ReadOnlyOrderedDict<ItemElement, ItemDataWithElement<ItemData & BaseItemData, ItemElement>>;
106
+ /**
107
+ * Creates a collection that tracks its items in document order and exposes them
108
+ * during render via `useCollection`.
109
+ *
110
+ * Item data passed to `ItemSlot` (every prop other than `scope` and `children`)
111
+ * must be referentially stable across renders. It is compared shallowly, and any
112
+ * change re-registers the item and replaces the item map. Memoize objects,
113
+ * arrays and callbacks with `useMemo` / `useCallback`, or define them outside of
114
+ * render.
115
+ */
116
+ declare function createCollection<ItemElement extends HTMLElement, ItemData extends {} = {}>(name: string): readonly [{
117
+ readonly Provider: React.FC<{
118
+ children?: React.ReactNode | undefined;
119
+ scope: any;
120
+ state?: [ItemMap: BaseCollectionDict<ItemElement, ItemData & BaseItemData>, SetItemMap: React.Dispatch<React.SetStateAction<BaseCollectionDict<ItemElement, ItemData & BaseItemData>>>] | undefined;
121
+ }>;
122
+ readonly Slot: React.ForwardRefExoticComponent<CollectionSlotProps & React.RefAttributes<HTMLElement>>;
123
+ readonly ItemSlot: React.ForwardRefExoticComponent<React.PropsWithoutRef<ItemData & BaseItemData & {
124
+ children: React.ReactNode;
125
+ scope: any;
126
+ }> & React.RefAttributes<ItemElement>>;
127
+ }, {
128
+ createCollectionScope: _radix_ui_react_context.CreateScope;
129
+ useCollection: (scope: any) => CollectionDict<ItemElement, ItemData & BaseItemData>;
130
+ useGetCollection: (scope: any) => () => CollectionDict<ItemElement, ItemData & BaseItemData>;
131
+ useInitCollection: () => [BaseCollectionDict<ItemElement, ItemData & BaseItemData>, React.Dispatch<React.SetStateAction<BaseCollectionDict<ItemElement, ItemData & BaseItemData>>>];
132
+ }];
133
+
134
+ export { type CollectionProps, createCollection$1 as createCollection, type CollectionDict as unstable_CollectionDict, type CollectionSlotProps as unstable_CollectionSlotProps, createCollection as unstable_createCollection };
e-commerce/node_modules/@radix-ui/react-collection/dist/index.js ADDED
@@ -0,0 +1,681 @@
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+
32
+ // src/index.ts
33
+ var index_exports = {};
34
+ __export(index_exports, {
35
+ createCollection: () => createCollection,
36
+ unstable_createCollection: () => createCollection2
37
+ });
38
+ module.exports = __toCommonJS(index_exports);
39
+
40
+ // src/collection-legacy.tsx
41
+ var React = __toESM(require("react"));
42
+ var import_react_context = require("@radix-ui/react-context");
43
+ var import_react_compose_refs = require("@radix-ui/react-compose-refs");
44
+ var import_react_slot = require("@radix-ui/react-slot");
45
+ var import_jsx_runtime = require("react/jsx-runtime");
46
+ // @__NO_SIDE_EFFECTS__
47
+ function createCollection(name) {
48
+ const PROVIDER_NAME = name + "CollectionProvider";
49
+ const [createCollectionContext, createCollectionScope] = (0, import_react_context.createContextScope)(PROVIDER_NAME);
50
+ const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
51
+ PROVIDER_NAME,
52
+ { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
53
+ );
54
+ const CollectionProvider = /* @__PURE__ */ __name((props) => {
55
+ const { scope, children } = props;
56
+ const ref = React.useRef(null);
57
+ const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;
58
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
59
+ }, "CollectionProvider");
60
+ CollectionProvider.displayName = PROVIDER_NAME;
61
+ const COLLECTION_SLOT_NAME = name + "CollectionSlot";
62
+ const CollectionSlotImpl = (0, import_react_slot.createSlot)(COLLECTION_SLOT_NAME);
63
+ const CollectionSlot = React.forwardRef(
64
+ (props, forwardedRef) => {
65
+ const { scope, children } = props;
66
+ const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
67
+ const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, context.collectionRef);
68
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollectionSlotImpl, { ref: composedRefs, children });
69
+ }
70
+ );
71
+ CollectionSlot.displayName = COLLECTION_SLOT_NAME;
72
+ const ITEM_SLOT_NAME = name + "CollectionItemSlot";
73
+ const ITEM_DATA_ATTR = "data-radix-collection-item";
74
+ const CollectionItemSlotImpl = (0, import_react_slot.createSlot)(ITEM_SLOT_NAME);
75
+ const CollectionItemSlot = React.forwardRef(
76
+ (props, forwardedRef) => {
77
+ const { scope, children, ...itemData } = props;
78
+ const ref = React.useRef(null);
79
+ const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref);
80
+ const context = useCollectionContext(ITEM_SLOT_NAME, scope);
81
+ React.useEffect(() => {
82
+ context.itemMap.set(ref, { ref, ...itemData });
83
+ return () => void context.itemMap.delete(ref);
84
+ });
85
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
86
+ }
87
+ );
88
+ CollectionItemSlot.displayName = ITEM_SLOT_NAME;
89
+ function useCollection(scope) {
90
+ const context = useCollectionContext(name + "CollectionConsumer", scope);
91
+ const getItems = React.useCallback(() => {
92
+ const collectionNode = context.collectionRef.current;
93
+ if (!collectionNode) return [];
94
+ const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
95
+ const items = Array.from(context.itemMap.values());
96
+ const orderedItems = items.sort(
97
+ (a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
98
+ );
99
+ return orderedItems;
100
+ }, [context.collectionRef, context.itemMap]);
101
+ return getItems;
102
+ }
103
+ __name(useCollection, "useCollection");
104
+ return [
105
+ { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
106
+ useCollection,
107
+ createCollectionScope
108
+ ];
109
+ }
110
+ __name(createCollection, "createCollection");
111
+
112
+ // src/collection.tsx
113
+ var React2 = __toESM(require("react"));
114
+ var import_react_context2 = require("@radix-ui/react-context");
115
+ var import_react_compose_refs2 = require("@radix-ui/react-compose-refs");
116
+ var import_react_slot2 = require("@radix-ui/react-slot");
117
+ var import_react_use_layout_effect = require("@radix-ui/react-use-layout-effect");
118
+
119
+ // src/ordered-dictionary.ts
120
+ var __instanciated = /* @__PURE__ */ new WeakMap();
121
+ var OrderedDict = class _OrderedDict extends Map {
122
+ static {
123
+ __name(this, "OrderedDict");
124
+ }
125
+ #keys;
126
+ constructor(entries) {
127
+ super(entries);
128
+ this.#keys = [...super.keys()];
129
+ __instanciated.set(this, true);
130
+ }
131
+ set(key, value) {
132
+ if (__instanciated.get(this) && !this.has(key)) {
133
+ this.#keys.push(key);
134
+ }
135
+ super.set(key, value);
136
+ return this;
137
+ }
138
+ /**
139
+ * Sets a key-value pair so that it ends up at the given index.
140
+ * - Existing keys are moved
141
+ * - Negative indices count from the end of the resulting dictionary, so
142
+ * inserting at -1 makes the item the last one, -2 the second to last, etc.
143
+ * - Out-of-range indices are clamped
144
+ */
145
+ insert(index, key, value) {
146
+ const has = this.has(key);
147
+ const finalSize = has ? this.size : this.size + 1;
148
+ const relativeIndex = toSafeInteger(index);
149
+ const targetIndex = relativeIndex >= 0 ? Math.min(relativeIndex, finalSize - 1) : Math.max(finalSize + relativeIndex, 0);
150
+ if (has ? this.#keys.indexOf(key) === targetIndex : targetIndex === this.size) {
151
+ this.set(key, value);
152
+ return this;
153
+ }
154
+ const keys = this.#keys.filter((existingKey) => existingKey !== key);
155
+ keys.splice(targetIndex, 0, key);
156
+ const entries = keys.map((entryKey) => [
157
+ entryKey,
158
+ entryKey === key ? value : this.get(entryKey)
159
+ ]);
160
+ this.clear();
161
+ for (const [entryKey, entryValue] of entries) {
162
+ this.set(entryKey, entryValue);
163
+ }
164
+ return this;
165
+ }
166
+ with(index, key, value) {
167
+ const copy = new _OrderedDict(this);
168
+ copy.insert(index, key, value);
169
+ return copy;
170
+ }
171
+ before(key) {
172
+ const index = this.#keys.indexOf(key) - 1;
173
+ if (index < 0) {
174
+ return void 0;
175
+ }
176
+ return this.entryAt(index);
177
+ }
178
+ /**
179
+ * Sets a new key-value pair at the position before the given key.
180
+ */
181
+ setBefore(key, newKey, value) {
182
+ const index = this.#keys.indexOf(key);
183
+ if (index === -1) {
184
+ return this;
185
+ }
186
+ const currentIndex = this.#keys.indexOf(newKey);
187
+ const targetIndex = currentIndex !== -1 && currentIndex < index ? index - 1 : index;
188
+ return this.insert(targetIndex, newKey, value);
189
+ }
190
+ after(key) {
191
+ let index = this.#keys.indexOf(key);
192
+ index = index === -1 || index === this.size - 1 ? -1 : index + 1;
193
+ if (index === -1) {
194
+ return void 0;
195
+ }
196
+ return this.entryAt(index);
197
+ }
198
+ /**
199
+ * Sets a new key-value pair at the position after the given key.
200
+ */
201
+ setAfter(key, newKey, value) {
202
+ const index = this.#keys.indexOf(key);
203
+ if (index === -1) {
204
+ return this;
205
+ }
206
+ const currentIndex = this.#keys.indexOf(newKey);
207
+ const targetIndex = currentIndex !== -1 && currentIndex <= index ? index : index + 1;
208
+ return this.insert(targetIndex, newKey, value);
209
+ }
210
+ first() {
211
+ return this.entryAt(0);
212
+ }
213
+ last() {
214
+ return this.entryAt(-1);
215
+ }
216
+ clear() {
217
+ this.#keys = [];
218
+ return super.clear();
219
+ }
220
+ delete(key) {
221
+ const deleted = super.delete(key);
222
+ if (deleted) {
223
+ this.#keys.splice(this.#keys.indexOf(key), 1);
224
+ }
225
+ return deleted;
226
+ }
227
+ deleteAt(index) {
228
+ const key = this.keyAt(index);
229
+ if (key !== void 0) {
230
+ return this.delete(key);
231
+ }
232
+ return false;
233
+ }
234
+ at(index) {
235
+ const key = at(this.#keys, index);
236
+ if (key !== void 0) {
237
+ return this.get(key);
238
+ }
239
+ }
240
+ entryAt(index) {
241
+ const key = at(this.#keys, index);
242
+ if (key !== void 0) {
243
+ return [key, this.get(key)];
244
+ }
245
+ }
246
+ indexOf(key) {
247
+ return this.#keys.indexOf(key);
248
+ }
249
+ keyAt(index) {
250
+ return at(this.#keys, index);
251
+ }
252
+ from(key, offset) {
253
+ const index = this.indexOf(key);
254
+ if (index === -1) {
255
+ return void 0;
256
+ }
257
+ let dest = index + offset;
258
+ if (dest < 0) dest = 0;
259
+ if (dest >= this.size) dest = this.size - 1;
260
+ return this.at(dest);
261
+ }
262
+ keyFrom(key, offset) {
263
+ const index = this.indexOf(key);
264
+ if (index === -1) {
265
+ return void 0;
266
+ }
267
+ let dest = index + offset;
268
+ if (dest < 0) dest = 0;
269
+ if (dest >= this.size) dest = this.size - 1;
270
+ return this.keyAt(dest);
271
+ }
272
+ find(predicate, thisArg) {
273
+ let index = 0;
274
+ for (const entry of this) {
275
+ if (Reflect.apply(predicate, thisArg, [entry, index, this])) {
276
+ return entry;
277
+ }
278
+ index++;
279
+ }
280
+ return void 0;
281
+ }
282
+ findIndex(predicate, thisArg) {
283
+ let index = 0;
284
+ for (const entry of this) {
285
+ if (Reflect.apply(predicate, thisArg, [entry, index, this])) {
286
+ return index;
287
+ }
288
+ index++;
289
+ }
290
+ return -1;
291
+ }
292
+ filter(predicate, thisArg) {
293
+ const entries = [];
294
+ let index = 0;
295
+ for (const entry of this) {
296
+ if (Reflect.apply(predicate, thisArg, [entry, index, this])) {
297
+ entries.push(entry);
298
+ }
299
+ index++;
300
+ }
301
+ return new _OrderedDict(entries);
302
+ }
303
+ map(callbackfn, thisArg) {
304
+ const entries = [];
305
+ let index = 0;
306
+ for (const entry of this) {
307
+ entries.push([entry[0], Reflect.apply(callbackfn, thisArg, [entry, index, this])]);
308
+ index++;
309
+ }
310
+ return new _OrderedDict(entries);
311
+ }
312
+ reduce(...args) {
313
+ const [callbackfn, initialValue] = args;
314
+ const hasInitialValue = args.length > 1;
315
+ if (!hasInitialValue && this.size === 0) {
316
+ throw new TypeError("Reduce of empty OrderedDict with no initial value");
317
+ }
318
+ let index = 0;
319
+ let accumulator = initialValue;
320
+ for (const entry of this) {
321
+ if (index === 0 && !hasInitialValue) {
322
+ accumulator = entry;
323
+ } else {
324
+ accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);
325
+ }
326
+ index++;
327
+ }
328
+ return accumulator;
329
+ }
330
+ reduceRight(...args) {
331
+ const [callbackfn, initialValue] = args;
332
+ const hasInitialValue = args.length > 1;
333
+ if (!hasInitialValue && this.size === 0) {
334
+ throw new TypeError("Reduce of empty OrderedDict with no initial value");
335
+ }
336
+ let accumulator = initialValue;
337
+ for (let index = this.size - 1; index >= 0; index--) {
338
+ const entry = this.entryAt(index);
339
+ if (index === this.size - 1 && !hasInitialValue) {
340
+ accumulator = entry;
341
+ } else {
342
+ accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);
343
+ }
344
+ }
345
+ return accumulator;
346
+ }
347
+ /**
348
+ * Sorts the dictionary in place. This method mutates the dictionary and
349
+ * returns a reference to the same object
350
+ *
351
+ * @param compareFn Function used to determine the order of the elements. It
352
+ * is expected to return a negative value if the first argument is less than
353
+ * the second argument, zero if they're equal, and a positive value otherwise.
354
+ */
355
+ sort(compareFn) {
356
+ if (typeof compareFn !== "function") {
357
+ throw new TypeError(`OrderedDict.sort requires a compare function`);
358
+ }
359
+ const entries = [...this.entries()].sort(compareFn);
360
+ this.clear();
361
+ for (const [key, value] of entries) {
362
+ this.set(key, value);
363
+ }
364
+ return this;
365
+ }
366
+ /**
367
+ * Returns a copy of the dictionary with its elements sorted.
368
+ *
369
+ * @param compareFn Function used to determine the order of the elements. It
370
+ * is expected to return a negative value if the first argument is less than
371
+ * the second argument, zero if they're equal, and a positive value otherwise.
372
+ */
373
+ toSorted(compareFn) {
374
+ if (typeof compareFn !== "function") {
375
+ throw new TypeError(`OrderedDict.toSorted requires a compare function`);
376
+ }
377
+ const entries = [...this.entries()].sort(compareFn);
378
+ return new _OrderedDict(entries);
379
+ }
380
+ toReversed() {
381
+ const reversed = new _OrderedDict();
382
+ for (let index = this.size - 1; index >= 0; index--) {
383
+ const key = this.keyAt(index);
384
+ const element = this.get(key);
385
+ reversed.set(key, element);
386
+ }
387
+ return reversed;
388
+ }
389
+ toSpliced(...args) {
390
+ const entries = [...this.entries()];
391
+ entries.splice(...args);
392
+ return new _OrderedDict(entries);
393
+ }
394
+ slice(start, end) {
395
+ const result = new _OrderedDict();
396
+ for (const key of this.#keys.slice(start, end)) {
397
+ result.set(key, this.get(key));
398
+ }
399
+ return result;
400
+ }
401
+ every(predicate, thisArg) {
402
+ let index = 0;
403
+ for (const entry of this) {
404
+ if (!Reflect.apply(predicate, thisArg, [entry, index, this])) {
405
+ return false;
406
+ }
407
+ index++;
408
+ }
409
+ return true;
410
+ }
411
+ some(predicate, thisArg) {
412
+ let index = 0;
413
+ for (const entry of this) {
414
+ if (Reflect.apply(predicate, thisArg, [entry, index, this])) {
415
+ return true;
416
+ }
417
+ index++;
418
+ }
419
+ return false;
420
+ }
421
+ };
422
+ function at(array, index) {
423
+ if ("at" in Array.prototype) {
424
+ return Array.prototype.at.call(array, index);
425
+ }
426
+ const actualIndex = toSafeIndex(array, index);
427
+ return actualIndex === -1 ? void 0 : array[actualIndex];
428
+ }
429
+ __name(at, "at");
430
+ function toSafeIndex(array, index) {
431
+ const length = array.length;
432
+ const relativeIndex = toSafeInteger(index);
433
+ const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;
434
+ return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;
435
+ }
436
+ __name(toSafeIndex, "toSafeIndex");
437
+ function toSafeInteger(number) {
438
+ return number !== number || number === 0 ? 0 : Math.trunc(number);
439
+ }
440
+ __name(toSafeInteger, "toSafeInteger");
441
+
442
+ // src/collection.tsx
443
+ var import_jsx_runtime2 = require("react/jsx-runtime");
444
+ // @__NO_SIDE_EFFECTS__
445
+ function createCollection2(name) {
446
+ const PROVIDER_NAME = name + "CollectionProvider";
447
+ const [createCollectionContext, createCollectionScope] = (0, import_react_context2.createContextScope)(PROVIDER_NAME);
448
+ const [CollectionStableContextProvider, useStableCollectionContext] = createCollectionContext(PROVIDER_NAME);
449
+ CollectionStableContextProvider.displayName = name + "CollectionStableContextProvider";
450
+ const [CollectionStatefulContextProvider, useStatefulCollectionContext] = createCollectionContext(PROVIDER_NAME);
451
+ CollectionStatefulContextProvider.displayName = name + "CollectionStatefulContextProvider";
452
+ const CollectionProvider = /* @__PURE__ */ __name(({ state, ...props }) => {
453
+ return state ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CollectionInit, { ...props });
454
+ }, "CollectionProvider");
455
+ CollectionProvider.displayName = PROVIDER_NAME;
456
+ const CollectionInit = /* @__PURE__ */ __name((props) => {
457
+ const state = useInitCollection();
458
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CollectionProviderImpl, { ...props, state });
459
+ }, "CollectionInit");
460
+ CollectionInit.displayName = name + "CollectionInit";
461
+ const CollectionProviderImpl = /* @__PURE__ */ __name((props) => {
462
+ const { scope, children, state } = props;
463
+ const ref = React2.useRef(null);
464
+ const [collectionElement, setCollectionElement] = React2.useState(
465
+ null
466
+ );
467
+ const composeRefs = (0, import_react_compose_refs2.useComposedRefs)(ref, setCollectionElement);
468
+ const [collection, setCollection] = state;
469
+ const registryRef = React2.useRef(
470
+ new OrderedDict()
471
+ );
472
+ const getCollection = React2.useCallback(() => {
473
+ const registry = registryRef.current;
474
+ if (!isInDocumentOrder(registry)) {
475
+ registry.sort(sortByDocumentPosition);
476
+ }
477
+ return registry;
478
+ }, []);
479
+ React2.useEffect(() => {
480
+ if (!collectionElement) {
481
+ return;
482
+ }
483
+ const observer = getChildListObserver(() => {
484
+ setCollection((map) => {
485
+ const sorted = map.toSorted(sortByDocumentPosition);
486
+ const orderChanged = sorted.some(([key], index) => map.keyAt(index) !== key);
487
+ return orderChanged ? sorted : map;
488
+ });
489
+ });
490
+ observer.observe(collectionElement, {
491
+ childList: true,
492
+ subtree: true
493
+ });
494
+ return () => {
495
+ observer.disconnect();
496
+ };
497
+ }, [collectionElement, setCollection]);
498
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
499
+ CollectionStableContextProvider,
500
+ {
501
+ scope,
502
+ collectionElementRef: composeRefs,
503
+ collectionElementRefObject: ref,
504
+ getCollection,
505
+ setCollection,
506
+ registryRef,
507
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
508
+ CollectionStatefulContextProvider,
509
+ {
510
+ scope,
511
+ collectionElement,
512
+ collection,
513
+ children
514
+ }
515
+ )
516
+ }
517
+ );
518
+ }, "CollectionProviderImpl");
519
+ CollectionProviderImpl.displayName = name + "CollectionProviderImpl";
520
+ const COLLECTION_SLOT_NAME = name + "CollectionSlot";
521
+ const CollectionSlotImpl = (0, import_react_slot2.createSlot)(COLLECTION_SLOT_NAME);
522
+ const CollectionSlot = React2.forwardRef(
523
+ (props, forwardedRef) => {
524
+ const { scope, children } = props;
525
+ const context = useStableCollectionContext(COLLECTION_SLOT_NAME, scope);
526
+ const composedRefs = (0, import_react_compose_refs2.useComposedRefs)(forwardedRef, context.collectionElementRef);
527
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CollectionSlotImpl, { ref: composedRefs, children });
528
+ }
529
+ );
530
+ CollectionSlot.displayName = COLLECTION_SLOT_NAME;
531
+ const ITEM_SLOT_NAME = name + "CollectionItemSlot";
532
+ const ITEM_DATA_ATTR = "data-radix-collection-item";
533
+ const CollectionItemSlotImpl = (0, import_react_slot2.createSlot)(ITEM_SLOT_NAME);
534
+ const CollectionItemSlot = React2.forwardRef(
535
+ (props, forwardedRef) => {
536
+ const { scope, children, ...itemData } = props;
537
+ const ref = React2.useRef(null);
538
+ const context = useStableCollectionContext(ITEM_SLOT_NAME, scope);
539
+ const { setCollection, registryRef } = context;
540
+ const itemDataRef = React2.useRef(itemData);
541
+ if (!shallowEqual(itemDataRef.current, itemData)) {
542
+ itemDataRef.current = itemData;
543
+ }
544
+ const memoizedItemData = itemDataRef.current;
545
+ const registerElement = React2.useCallback(
546
+ (node) => {
547
+ const registry = registryRef.current;
548
+ if (node) {
549
+ registry.set(node, {
550
+ ...itemDataRef.current,
551
+ element: node
552
+ });
553
+ } else if (ref.current) {
554
+ registry.delete(ref.current);
555
+ }
556
+ },
557
+ [registryRef]
558
+ );
559
+ const composedRefs = (0, import_react_compose_refs2.useComposedRefs)(forwardedRef, registerElement, ref);
560
+ (0, import_react_use_layout_effect.useLayoutEffect)(() => {
561
+ const node = ref.current;
562
+ const registry = registryRef.current;
563
+ if (node && registry.has(node)) {
564
+ registry.set(node, { ...memoizedItemData, element: node });
565
+ }
566
+ }, [memoizedItemData, registryRef]);
567
+ const registeredRef = React2.useRef(null);
568
+ React2.useEffect(() => {
569
+ const element = ref.current;
570
+ const registered = registeredRef.current;
571
+ if ((registered?.element ?? null) === element && (!element || registered?.itemData === memoizedItemData)) {
572
+ return;
573
+ }
574
+ registeredRef.current = element ? { element, itemData: memoizedItemData } : null;
575
+ setCollection((map) => {
576
+ const next = new OrderedDict(map);
577
+ if (registered && registered.element !== element) {
578
+ next.delete(registered.element);
579
+ }
580
+ if (element) {
581
+ next.set(element, { ...memoizedItemData, element });
582
+ }
583
+ return next.sort(sortByDocumentPosition);
584
+ });
585
+ });
586
+ React2.useEffect(() => {
587
+ return () => {
588
+ const registered = registeredRef.current;
589
+ registeredRef.current = null;
590
+ if (!registered) {
591
+ return;
592
+ }
593
+ setCollection((map) => {
594
+ if (!map.has(registered.element)) {
595
+ return map;
596
+ }
597
+ const next = new OrderedDict(map);
598
+ next.delete(registered.element);
599
+ return next;
600
+ });
601
+ };
602
+ }, [setCollection]);
603
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
604
+ }
605
+ );
606
+ CollectionItemSlot.displayName = ITEM_SLOT_NAME;
607
+ function useInitCollection() {
608
+ return React2.useState(new OrderedDict());
609
+ }
610
+ __name(useInitCollection, "useInitCollection");
611
+ function useCollection(scope) {
612
+ const { collection } = useStatefulCollectionContext(name + "CollectionConsumer", scope);
613
+ return collection;
614
+ }
615
+ __name(useCollection, "useCollection");
616
+ function useGetCollection(scope) {
617
+ const { getCollection } = useStableCollectionContext(name + "CollectionConsumer", scope);
618
+ return getCollection;
619
+ }
620
+ __name(useGetCollection, "useGetCollection");
621
+ const functions = {
622
+ createCollectionScope,
623
+ useCollection,
624
+ useGetCollection,
625
+ useInitCollection
626
+ };
627
+ return [
628
+ { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
629
+ functions
630
+ ];
631
+ }
632
+ __name(createCollection2, "createCollection");
633
+ function shallowEqual(a, b) {
634
+ if (a === b) return true;
635
+ if (typeof a !== "object" || typeof b !== "object") return false;
636
+ if (a == null || b == null) return false;
637
+ const keysA = Object.keys(a);
638
+ const keysB = Object.keys(b);
639
+ if (keysA.length !== keysB.length) return false;
640
+ for (const key of keysA) {
641
+ if (!Object.prototype.hasOwnProperty.call(b, key)) return false;
642
+ if (a[key] !== b[key]) return false;
643
+ }
644
+ return true;
645
+ }
646
+ __name(shallowEqual, "shallowEqual");
647
+ function isElementPreceding(a, b) {
648
+ return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);
649
+ }
650
+ __name(isElementPreceding, "isElementPreceding");
651
+ function isInDocumentOrder(dict) {
652
+ let previous;
653
+ for (const element of dict.keys()) {
654
+ if (previous) {
655
+ const position = previous.compareDocumentPosition(element);
656
+ if (!(position & Node.DOCUMENT_POSITION_DISCONNECTED) && position & Node.DOCUMENT_POSITION_PRECEDING) {
657
+ return false;
658
+ }
659
+ }
660
+ previous = element;
661
+ }
662
+ return true;
663
+ }
664
+ __name(isInDocumentOrder, "isInDocumentOrder");
665
+ function sortByDocumentPosition(a, b) {
666
+ return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1;
667
+ }
668
+ __name(sortByDocumentPosition, "sortByDocumentPosition");
669
+ function getChildListObserver(callback) {
670
+ const observer = new MutationObserver((mutationsList) => {
671
+ for (const mutation of mutationsList) {
672
+ if (mutation.type === "childList") {
673
+ callback();
674
+ return;
675
+ }
676
+ }
677
+ });
678
+ return observer;
679
+ }
680
+ __name(getChildListObserver, "getChildListObserver");
681
+ //# sourceMappingURL=index.js.map
e-commerce/node_modules/@radix-ui/react-collection/dist/index.js.map ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts", "../src/collection-legacy.tsx", "../src/collection.tsx", "../src/ordered-dictionary.ts"],
4
+ "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<typeof Slot>;\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 `<CollectionItem as={Slot}>\u2026</CollectionItem>`.\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<CollectionElement | null>;\n itemMap: Map<\n React.RefObject<ItemElement | null>,\n { ref: React.RefObject<ItemElement | null> } & ItemData\n >;\n };\n\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext<ContextValue>(\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<CollectionElement>(null);\n const itemMap = React.useRef<ContextValue['itemMap']>(new Map()).current;\n return (\n <CollectionProviderImpl scope={scope} itemMap={itemMap} collectionRef={ref}>\n {children}\n </CollectionProviderImpl>\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<CollectionElement, CollectionProps>(\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 <CollectionSlotImpl ref={composedRefs}>{children}</CollectionSlotImpl>;\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<ItemElement, CollectionItemSlotProps>(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef<ItemElement>(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 <CollectionItemSlotImpl {...{ [ITEM_DATA_ATTR]: '' }} ref={composedRefs}>\n {children}\n </CollectionItemSlotImpl>\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<typeof Slot>;\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<ItemElement, ItemDataWithElement<ItemData, ItemElement>>;\n\ntype CollectionDict<ItemElement extends HTMLElement, ItemData> = ReadOnlyOrderedDict<\n ItemElement,\n ItemDataWithElement<ItemData & BaseItemData, ItemElement>\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<CollectionElement | null>;\n collectionElementRefObject: React.RefObject<CollectionElement | null>;\n setCollection: React.Dispatch<\n React.SetStateAction<BaseCollectionDict<ItemElement, AllItemData>>\n >;\n getCollection: () => CollectionDict<ItemElement, AllItemData>;\n registryRef: React.RefObject<BaseCollectionDict<ItemElement, AllItemData>>;\n }\n\n interface CollectionStatefulContextValue {\n collectionElement: CollectionElement | null;\n collection: CollectionDict<ItemElement, AllItemData>;\n }\n\n const [CollectionStableContextProvider, useStableCollectionContext] =\n createCollectionContext<CollectionStableContextValue>(PROVIDER_NAME);\n CollectionStableContextProvider.displayName = name + 'CollectionStableContextProvider';\n\n const [CollectionStatefulContextProvider, useStatefulCollectionContext] =\n createCollectionContext<CollectionStatefulContextValue>(PROVIDER_NAME);\n CollectionStatefulContextProvider.displayName = name + 'CollectionStatefulContextProvider';\n\n type CollectionState = [\n ItemMap: BaseCollectionDict<ItemElement, AllItemData>,\n SetItemMap: React.Dispatch<React.SetStateAction<BaseCollectionDict<ItemElement, AllItemData>>>,\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 <CollectionProviderImpl {...props} state={state} />\n ) : (\n <CollectionInit {...props} />\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 <CollectionProviderImpl {...props} state={state} />;\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<CollectionElement>(null);\n const [collectionElement, setCollectionElement] = React.useState<CollectionElement | null>(\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<BaseCollectionDict<ItemElement, AllItemData>>(\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 <CollectionStableContextProvider\n scope={scope}\n collectionElementRef={composeRefs}\n collectionElementRefObject={ref}\n getCollection={getCollection}\n setCollection={setCollection}\n registryRef={registryRef}\n >\n <CollectionStatefulContextProvider\n scope={scope}\n collectionElement={collectionElement}\n collection={collection}\n >\n {children}\n </CollectionStatefulContextProvider>\n </CollectionStableContextProvider>\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<CollectionElement, CollectionSlotProps>(\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 <CollectionSlotImpl ref={composedRefs}>{children}</CollectionSlotImpl>;\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<ItemElement, CollectionItemSlotProps>(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef<ItemElement>(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 <CollectionItemSlotImpl {...{ [ITEM_DATA_ATTR]: '' }} ref={composedRefs as any}>\n {children}\n </CollectionItemSlotImpl>\n );\n },\n );\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useInitCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useInitCollection() {\n return React.useState<BaseCollectionDict<ItemElement, AllItemData>>(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<E extends HTMLElement, T extends BaseItemData>(\n dict: BaseCollectionDict<E, T>,\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<E extends HTMLElement, T extends BaseItemData>(\n a: EntryOf<BaseCollectionDict<E, T>>,\n b: EntryOf<BaseCollectionDict<E, T>>,\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<OrderedDict<any, any>, boolean>();\nexport class OrderedDict<K, V> extends Map<K, V> {\n #keys: K[];\n\n constructor(iterable?: Iterable<readonly [K, V]> | 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<K, V>) => 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<K, V>) => 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<KK extends K, VV extends V>(\n predicate: (entry: [K, V], index: number, dict: OrderedDict<K, V>) => entry is [KK, VV],\n thisArg?: any,\n ): OrderedDict<KK, VV>;\n\n filter(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any,\n ): OrderedDict<K, V>;\n\n filter(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => 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<U>(\n callbackfn: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => U,\n thisArg?: any,\n ): OrderedDict<K, U> {\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<K, V>,\n ) => [K, V],\n ): [K, V];\n reduce(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => [K, V],\n initialValue: [K, V],\n ): [K, V];\n reduce<U>(\n callbackfn: (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => U,\n initialValue: U,\n ): U;\n\n reduce<U>(\n ...args: [\n (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\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<K, V>,\n ) => [K, V],\n ): [K, V];\n reduceRight(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => [K, V],\n initialValue: [K, V],\n ): [K, V];\n reduceRight<U>(\n callbackfn: (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => U,\n initialValue: U,\n ): U;\n\n reduceRight<U>(\n ...args: [\n (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\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<K, V> {\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<K, V> {\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<K, V> {\n const reversed = new OrderedDict<K, V>();\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<K, V>;\n toSpliced(start: number, deleteCount: number, ...items: [K, V][]): OrderedDict<K, V>;\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<K, V>();\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<K, V>) => 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<K, V>) => 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<D extends OrderedDict<any, any>> =\n D extends OrderedDict<infer K, any> ? K : never;\nexport type ValueOf<D extends OrderedDict<any, any>> =\n D extends OrderedDict<any, infer V> ? V : never;\nexport type EntryOf<D extends OrderedDict<any, any>> = [KeyOf<D>, ValueOf<D>];\nexport type KeyFrom<E extends EntryOf<any>> = E[0];\nexport type ValueFrom<E extends EntryOf<any>> = E[1];\n\nfunction at<T>(array: ArrayLike<T>, 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<any>, 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<K, V> = Omit<\n OrderedDict<K, V>,\n 'set' | 'insert' | 'setBefore' | 'setAfter' | 'clear' | 'delete' | 'deleteAt' | 'sort'\n>;\n"],
5
+ "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,QAAI,yCAAmB,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,EAAE;AACjE,WACE,4CAAC,0BAAuB,OAAc,SAAkB,eAAe,KACpE,UACH;AAAA,EAEJ,GAX6F;AAa7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ACT;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;",
6
+ "names": ["createCollection", "React", "import_react_context", "import_react_compose_refs", "import_react_slot", "import_jsx_runtime", "createCollection"]
7
+ }
e-commerce/node_modules/@radix-ui/react-collection/dist/index.mjs ADDED
@@ -0,0 +1,650 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 
 
 
 
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
+
5
+ // src/collection-legacy.tsx
6
+ import * as React from "react";
7
+ import { createContextScope } from "@radix-ui/react-context";
8
+ import { useComposedRefs } from "@radix-ui/react-compose-refs";
9
+ import { createSlot } from "@radix-ui/react-slot";
10
+ import { jsx } from "react/jsx-runtime";
11
+ // @__NO_SIDE_EFFECTS__
12
+ function createCollection(name) {
13
+ const PROVIDER_NAME = name + "CollectionProvider";
14
+ const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);
15
+ const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
16
+ PROVIDER_NAME,
17
+ { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
18
+ );
19
+ const CollectionProvider = /* @__PURE__ */ __name((props) => {
20
+ const { scope, children } = props;
21
+ const ref = React.useRef(null);
22
+ const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;
23
+ return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
24
+ }, "CollectionProvider");
25
+ CollectionProvider.displayName = PROVIDER_NAME;
26
+ const COLLECTION_SLOT_NAME = name + "CollectionSlot";
27
+ const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
28
+ const CollectionSlot = React.forwardRef(
29
+ (props, forwardedRef) => {
30
+ const { scope, children } = props;
31
+ const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
32
+ const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
33
+ return /* @__PURE__ */ jsx(CollectionSlotImpl, { ref: composedRefs, children });
34
+ }
35
+ );
36
+ CollectionSlot.displayName = COLLECTION_SLOT_NAME;
37
+ const ITEM_SLOT_NAME = name + "CollectionItemSlot";
38
+ const ITEM_DATA_ATTR = "data-radix-collection-item";
39
+ const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);
40
+ const CollectionItemSlot = React.forwardRef(
41
+ (props, forwardedRef) => {
42
+ const { scope, children, ...itemData } = props;
43
+ const ref = React.useRef(null);
44
+ const composedRefs = useComposedRefs(forwardedRef, ref);
45
+ const context = useCollectionContext(ITEM_SLOT_NAME, scope);
46
+ React.useEffect(() => {
47
+ context.itemMap.set(ref, { ref, ...itemData });
48
+ return () => void context.itemMap.delete(ref);
49
+ });
50
+ return /* @__PURE__ */ jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
51
+ }
52
+ );
53
+ CollectionItemSlot.displayName = ITEM_SLOT_NAME;
54
+ function useCollection(scope) {
55
+ const context = useCollectionContext(name + "CollectionConsumer", scope);
56
+ const getItems = React.useCallback(() => {
57
+ const collectionNode = context.collectionRef.current;
58
+ if (!collectionNode) return [];
59
+ const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
60
+ const items = Array.from(context.itemMap.values());
61
+ const orderedItems = items.sort(
62
+ (a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
63
+ );
64
+ return orderedItems;
65
+ }, [context.collectionRef, context.itemMap]);
66
+ return getItems;
67
+ }
68
+ __name(useCollection, "useCollection");
69
+ return [
70
+ { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
71
+ useCollection,
72
+ createCollectionScope
73
+ ];
74
+ }
75
+ __name(createCollection, "createCollection");
76
+
77
+ // src/collection.tsx
78
+ import * as React2 from "react";
79
+ import { createContextScope as createContextScope2 } from "@radix-ui/react-context";
80
+ import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
81
+ import { createSlot as createSlot2 } from "@radix-ui/react-slot";
82
+ import { useLayoutEffect } from "@radix-ui/react-use-layout-effect";
83
+
84
+ // src/ordered-dictionary.ts
85
+ var __instanciated = /* @__PURE__ */ new WeakMap();
86
+ var OrderedDict = class _OrderedDict extends Map {
87
+ static {
88
+ __name(this, "OrderedDict");
89
+ }
90
+ #keys;
91
+ constructor(entries) {
92
+ super(entries);
93
+ this.#keys = [...super.keys()];
94
+ __instanciated.set(this, true);
95
+ }
96
+ set(key, value) {
97
+ if (__instanciated.get(this) && !this.has(key)) {
98
+ this.#keys.push(key);
99
+ }
100
+ super.set(key, value);
101
+ return this;
102
+ }
103
+ /**
104
+ * Sets a key-value pair so that it ends up at the given index.
105
+ * - Existing keys are moved
106
+ * - Negative indices count from the end of the resulting dictionary, so
107
+ * inserting at -1 makes the item the last one, -2 the second to last, etc.
108
+ * - Out-of-range indices are clamped
109
+ */
110
+ insert(index, key, value) {
111
+ const has = this.has(key);
112
+ const finalSize = has ? this.size : this.size + 1;
113
+ const relativeIndex = toSafeInteger(index);
114
+ const targetIndex = relativeIndex >= 0 ? Math.min(relativeIndex, finalSize - 1) : Math.max(finalSize + relativeIndex, 0);
115
+ if (has ? this.#keys.indexOf(key) === targetIndex : targetIndex === this.size) {
116
+ this.set(key, value);
117
+ return this;
118
+ }
119
+ const keys = this.#keys.filter((existingKey) => existingKey !== key);
120
+ keys.splice(targetIndex, 0, key);
121
+ const entries = keys.map((entryKey) => [
122
+ entryKey,
123
+ entryKey === key ? value : this.get(entryKey)
124
+ ]);
125
+ this.clear();
126
+ for (const [entryKey, entryValue] of entries) {
127
+ this.set(entryKey, entryValue);
128
+ }
129
+ return this;
130
+ }
131
+ with(index, key, value) {
132
+ const copy = new _OrderedDict(this);
133
+ copy.insert(index, key, value);
134
+ return copy;
135
+ }
136
+ before(key) {
137
+ const index = this.#keys.indexOf(key) - 1;
138
+ if (index < 0) {
139
+ return void 0;
140
+ }
141
+ return this.entryAt(index);
142
+ }
143
+ /**
144
+ * Sets a new key-value pair at the position before the given key.
145
+ */
146
+ setBefore(key, newKey, value) {
147
+ const index = this.#keys.indexOf(key);
148
+ if (index === -1) {
149
+ return this;
150
+ }
151
+ const currentIndex = this.#keys.indexOf(newKey);
152
+ const targetIndex = currentIndex !== -1 && currentIndex < index ? index - 1 : index;
153
+ return this.insert(targetIndex, newKey, value);
154
+ }
155
+ after(key) {
156
+ let index = this.#keys.indexOf(key);
157
+ index = index === -1 || index === this.size - 1 ? -1 : index + 1;
158
+ if (index === -1) {
159
+ return void 0;
160
+ }
161
+ return this.entryAt(index);
162
+ }
163
+ /**
164
+ * Sets a new key-value pair at the position after the given key.
165
+ */
166
+ setAfter(key, newKey, value) {
167
+ const index = this.#keys.indexOf(key);
168
+ if (index === -1) {
169
+ return this;
170
+ }
171
+ const currentIndex = this.#keys.indexOf(newKey);
172
+ const targetIndex = currentIndex !== -1 && currentIndex <= index ? index : index + 1;
173
+ return this.insert(targetIndex, newKey, value);
174
+ }
175
+ first() {
176
+ return this.entryAt(0);
177
+ }
178
+ last() {
179
+ return this.entryAt(-1);
180
+ }
181
+ clear() {
182
+ this.#keys = [];
183
+ return super.clear();
184
+ }
185
+ delete(key) {
186
+ const deleted = super.delete(key);
187
+ if (deleted) {
188
+ this.#keys.splice(this.#keys.indexOf(key), 1);
189
+ }
190
+ return deleted;
191
+ }
192
+ deleteAt(index) {
193
+ const key = this.keyAt(index);
194
+ if (key !== void 0) {
195
+ return this.delete(key);
196
+ }
197
+ return false;
198
+ }
199
+ at(index) {
200
+ const key = at(this.#keys, index);
201
+ if (key !== void 0) {
202
+ return this.get(key);
203
+ }
204
+ }
205
+ entryAt(index) {
206
+ const key = at(this.#keys, index);
207
+ if (key !== void 0) {
208
+ return [key, this.get(key)];
209
+ }
210
+ }
211
+ indexOf(key) {
212
+ return this.#keys.indexOf(key);
213
+ }
214
+ keyAt(index) {
215
+ return at(this.#keys, index);
216
+ }
217
+ from(key, offset) {
218
+ const index = this.indexOf(key);
219
+ if (index === -1) {
220
+ return void 0;
221
+ }
222
+ let dest = index + offset;
223
+ if (dest < 0) dest = 0;
224
+ if (dest >= this.size) dest = this.size - 1;
225
+ return this.at(dest);
226
+ }
227
+ keyFrom(key, offset) {
228
+ const index = this.indexOf(key);
229
+ if (index === -1) {
230
+ return void 0;
231
+ }
232
+ let dest = index + offset;
233
+ if (dest < 0) dest = 0;
234
+ if (dest >= this.size) dest = this.size - 1;
235
+ return this.keyAt(dest);
236
+ }
237
+ find(predicate, thisArg) {
238
+ let index = 0;
239
+ for (const entry of this) {
240
+ if (Reflect.apply(predicate, thisArg, [entry, index, this])) {
241
+ return entry;
242
+ }
243
+ index++;
244
+ }
245
+ return void 0;
246
+ }
247
+ findIndex(predicate, thisArg) {
248
+ let index = 0;
249
+ for (const entry of this) {
250
+ if (Reflect.apply(predicate, thisArg, [entry, index, this])) {
251
+ return index;
252
+ }
253
+ index++;
254
+ }
255
+ return -1;
256
+ }
257
+ filter(predicate, thisArg) {
258
+ const entries = [];
259
+ let index = 0;
260
+ for (const entry of this) {
261
+ if (Reflect.apply(predicate, thisArg, [entry, index, this])) {
262
+ entries.push(entry);
263
+ }
264
+ index++;
265
+ }
266
+ return new _OrderedDict(entries);
267
+ }
268
+ map(callbackfn, thisArg) {
269
+ const entries = [];
270
+ let index = 0;
271
+ for (const entry of this) {
272
+ entries.push([entry[0], Reflect.apply(callbackfn, thisArg, [entry, index, this])]);
273
+ index++;
274
+ }
275
+ return new _OrderedDict(entries);
276
+ }
277
+ reduce(...args) {
278
+ const [callbackfn, initialValue] = args;
279
+ const hasInitialValue = args.length > 1;
280
+ if (!hasInitialValue && this.size === 0) {
281
+ throw new TypeError("Reduce of empty OrderedDict with no initial value");
282
+ }
283
+ let index = 0;
284
+ let accumulator = initialValue;
285
+ for (const entry of this) {
286
+ if (index === 0 && !hasInitialValue) {
287
+ accumulator = entry;
288
+ } else {
289
+ accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);
290
+ }
291
+ index++;
292
+ }
293
+ return accumulator;
294
+ }
295
+ reduceRight(...args) {
296
+ const [callbackfn, initialValue] = args;
297
+ const hasInitialValue = args.length > 1;
298
+ if (!hasInitialValue && this.size === 0) {
299
+ throw new TypeError("Reduce of empty OrderedDict with no initial value");
300
+ }
301
+ let accumulator = initialValue;
302
+ for (let index = this.size - 1; index >= 0; index--) {
303
+ const entry = this.entryAt(index);
304
+ if (index === this.size - 1 && !hasInitialValue) {
305
+ accumulator = entry;
306
+ } else {
307
+ accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);
308
+ }
309
+ }
310
+ return accumulator;
311
+ }
312
+ /**
313
+ * Sorts the dictionary in place. This method mutates the dictionary and
314
+ * returns a reference to the same object
315
+ *
316
+ * @param compareFn Function used to determine the order of the elements. It
317
+ * is expected to return a negative value if the first argument is less than
318
+ * the second argument, zero if they're equal, and a positive value otherwise.
319
+ */
320
+ sort(compareFn) {
321
+ if (typeof compareFn !== "function") {
322
+ throw new TypeError(`OrderedDict.sort requires a compare function`);
323
+ }
324
+ const entries = [...this.entries()].sort(compareFn);
325
+ this.clear();
326
+ for (const [key, value] of entries) {
327
+ this.set(key, value);
328
+ }
329
+ return this;
330
+ }
331
+ /**
332
+ * Returns a copy of the dictionary with its elements sorted.
333
+ *
334
+ * @param compareFn Function used to determine the order of the elements. It
335
+ * is expected to return a negative value if the first argument is less than
336
+ * the second argument, zero if they're equal, and a positive value otherwise.
337
+ */
338
+ toSorted(compareFn) {
339
+ if (typeof compareFn !== "function") {
340
+ throw new TypeError(`OrderedDict.toSorted requires a compare function`);
341
+ }
342
+ const entries = [...this.entries()].sort(compareFn);
343
+ return new _OrderedDict(entries);
344
+ }
345
+ toReversed() {
346
+ const reversed = new _OrderedDict();
347
+ for (let index = this.size - 1; index >= 0; index--) {
348
+ const key = this.keyAt(index);
349
+ const element = this.get(key);
350
+ reversed.set(key, element);
351
+ }
352
+ return reversed;
353
+ }
354
+ toSpliced(...args) {
355
+ const entries = [...this.entries()];
356
+ entries.splice(...args);
357
+ return new _OrderedDict(entries);
358
+ }
359
+ slice(start, end) {
360
+ const result = new _OrderedDict();
361
+ for (const key of this.#keys.slice(start, end)) {
362
+ result.set(key, this.get(key));
363
+ }
364
+ return result;
365
+ }
366
+ every(predicate, thisArg) {
367
+ let index = 0;
368
+ for (const entry of this) {
369
+ if (!Reflect.apply(predicate, thisArg, [entry, index, this])) {
370
+ return false;
371
+ }
372
+ index++;
373
+ }
374
+ return true;
375
+ }
376
+ some(predicate, thisArg) {
377
+ let index = 0;
378
+ for (const entry of this) {
379
+ if (Reflect.apply(predicate, thisArg, [entry, index, this])) {
380
+ return true;
381
+ }
382
+ index++;
383
+ }
384
+ return false;
385
+ }
386
+ };
387
+ function at(array, index) {
388
+ if ("at" in Array.prototype) {
389
+ return Array.prototype.at.call(array, index);
390
+ }
391
+ const actualIndex = toSafeIndex(array, index);
392
+ return actualIndex === -1 ? void 0 : array[actualIndex];
393
+ }
394
+ __name(at, "at");
395
+ function toSafeIndex(array, index) {
396
+ const length = array.length;
397
+ const relativeIndex = toSafeInteger(index);
398
+ const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;
399
+ return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;
400
+ }
401
+ __name(toSafeIndex, "toSafeIndex");
402
+ function toSafeInteger(number) {
403
+ return number !== number || number === 0 ? 0 : Math.trunc(number);
404
+ }
405
+ __name(toSafeInteger, "toSafeInteger");
406
+
407
+ // src/collection.tsx
408
+ import { jsx as jsx2 } from "react/jsx-runtime";
409
+ // @__NO_SIDE_EFFECTS__
410
+ function createCollection2(name) {
411
+ const PROVIDER_NAME = name + "CollectionProvider";
412
+ const [createCollectionContext, createCollectionScope] = createContextScope2(PROVIDER_NAME);
413
+ const [CollectionStableContextProvider, useStableCollectionContext] = createCollectionContext(PROVIDER_NAME);
414
+ CollectionStableContextProvider.displayName = name + "CollectionStableContextProvider";
415
+ const [CollectionStatefulContextProvider, useStatefulCollectionContext] = createCollectionContext(PROVIDER_NAME);
416
+ CollectionStatefulContextProvider.displayName = name + "CollectionStatefulContextProvider";
417
+ const CollectionProvider = /* @__PURE__ */ __name(({ state, ...props }) => {
418
+ return state ? /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ jsx2(CollectionInit, { ...props });
419
+ }, "CollectionProvider");
420
+ CollectionProvider.displayName = PROVIDER_NAME;
421
+ const CollectionInit = /* @__PURE__ */ __name((props) => {
422
+ const state = useInitCollection();
423
+ return /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state });
424
+ }, "CollectionInit");
425
+ CollectionInit.displayName = name + "CollectionInit";
426
+ const CollectionProviderImpl = /* @__PURE__ */ __name((props) => {
427
+ const { scope, children, state } = props;
428
+ const ref = React2.useRef(null);
429
+ const [collectionElement, setCollectionElement] = React2.useState(
430
+ null
431
+ );
432
+ const composeRefs = useComposedRefs2(ref, setCollectionElement);
433
+ const [collection, setCollection] = state;
434
+ const registryRef = React2.useRef(
435
+ new OrderedDict()
436
+ );
437
+ const getCollection = React2.useCallback(() => {
438
+ const registry = registryRef.current;
439
+ if (!isInDocumentOrder(registry)) {
440
+ registry.sort(sortByDocumentPosition);
441
+ }
442
+ return registry;
443
+ }, []);
444
+ React2.useEffect(() => {
445
+ if (!collectionElement) {
446
+ return;
447
+ }
448
+ const observer = getChildListObserver(() => {
449
+ setCollection((map) => {
450
+ const sorted = map.toSorted(sortByDocumentPosition);
451
+ const orderChanged = sorted.some(([key], index) => map.keyAt(index) !== key);
452
+ return orderChanged ? sorted : map;
453
+ });
454
+ });
455
+ observer.observe(collectionElement, {
456
+ childList: true,
457
+ subtree: true
458
+ });
459
+ return () => {
460
+ observer.disconnect();
461
+ };
462
+ }, [collectionElement, setCollection]);
463
+ return /* @__PURE__ */ jsx2(
464
+ CollectionStableContextProvider,
465
+ {
466
+ scope,
467
+ collectionElementRef: composeRefs,
468
+ collectionElementRefObject: ref,
469
+ getCollection,
470
+ setCollection,
471
+ registryRef,
472
+ children: /* @__PURE__ */ jsx2(
473
+ CollectionStatefulContextProvider,
474
+ {
475
+ scope,
476
+ collectionElement,
477
+ collection,
478
+ children
479
+ }
480
+ )
481
+ }
482
+ );
483
+ }, "CollectionProviderImpl");
484
+ CollectionProviderImpl.displayName = name + "CollectionProviderImpl";
485
+ const COLLECTION_SLOT_NAME = name + "CollectionSlot";
486
+ const CollectionSlotImpl = createSlot2(COLLECTION_SLOT_NAME);
487
+ const CollectionSlot = React2.forwardRef(
488
+ (props, forwardedRef) => {
489
+ const { scope, children } = props;
490
+ const context = useStableCollectionContext(COLLECTION_SLOT_NAME, scope);
491
+ const composedRefs = useComposedRefs2(forwardedRef, context.collectionElementRef);
492
+ return /* @__PURE__ */ jsx2(CollectionSlotImpl, { ref: composedRefs, children });
493
+ }
494
+ );
495
+ CollectionSlot.displayName = COLLECTION_SLOT_NAME;
496
+ const ITEM_SLOT_NAME = name + "CollectionItemSlot";
497
+ const ITEM_DATA_ATTR = "data-radix-collection-item";
498
+ const CollectionItemSlotImpl = createSlot2(ITEM_SLOT_NAME);
499
+ const CollectionItemSlot = React2.forwardRef(
500
+ (props, forwardedRef) => {
501
+ const { scope, children, ...itemData } = props;
502
+ const ref = React2.useRef(null);
503
+ const context = useStableCollectionContext(ITEM_SLOT_NAME, scope);
504
+ const { setCollection, registryRef } = context;
505
+ const itemDataRef = React2.useRef(itemData);
506
+ if (!shallowEqual(itemDataRef.current, itemData)) {
507
+ itemDataRef.current = itemData;
508
+ }
509
+ const memoizedItemData = itemDataRef.current;
510
+ const registerElement = React2.useCallback(
511
+ (node) => {
512
+ const registry = registryRef.current;
513
+ if (node) {
514
+ registry.set(node, {
515
+ ...itemDataRef.current,
516
+ element: node
517
+ });
518
+ } else if (ref.current) {
519
+ registry.delete(ref.current);
520
+ }
521
+ },
522
+ [registryRef]
523
+ );
524
+ const composedRefs = useComposedRefs2(forwardedRef, registerElement, ref);
525
+ useLayoutEffect(() => {
526
+ const node = ref.current;
527
+ const registry = registryRef.current;
528
+ if (node && registry.has(node)) {
529
+ registry.set(node, { ...memoizedItemData, element: node });
530
+ }
531
+ }, [memoizedItemData, registryRef]);
532
+ const registeredRef = React2.useRef(null);
533
+ React2.useEffect(() => {
534
+ const element = ref.current;
535
+ const registered = registeredRef.current;
536
+ if ((registered?.element ?? null) === element && (!element || registered?.itemData === memoizedItemData)) {
537
+ return;
538
+ }
539
+ registeredRef.current = element ? { element, itemData: memoizedItemData } : null;
540
+ setCollection((map) => {
541
+ const next = new OrderedDict(map);
542
+ if (registered && registered.element !== element) {
543
+ next.delete(registered.element);
544
+ }
545
+ if (element) {
546
+ next.set(element, { ...memoizedItemData, element });
547
+ }
548
+ return next.sort(sortByDocumentPosition);
549
+ });
550
+ });
551
+ React2.useEffect(() => {
552
+ return () => {
553
+ const registered = registeredRef.current;
554
+ registeredRef.current = null;
555
+ if (!registered) {
556
+ return;
557
+ }
558
+ setCollection((map) => {
559
+ if (!map.has(registered.element)) {
560
+ return map;
561
+ }
562
+ const next = new OrderedDict(map);
563
+ next.delete(registered.element);
564
+ return next;
565
+ });
566
+ };
567
+ }, [setCollection]);
568
+ return /* @__PURE__ */ jsx2(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
569
+ }
570
+ );
571
+ CollectionItemSlot.displayName = ITEM_SLOT_NAME;
572
+ function useInitCollection() {
573
+ return React2.useState(new OrderedDict());
574
+ }
575
+ __name(useInitCollection, "useInitCollection");
576
+ function useCollection(scope) {
577
+ const { collection } = useStatefulCollectionContext(name + "CollectionConsumer", scope);
578
+ return collection;
579
+ }
580
+ __name(useCollection, "useCollection");
581
+ function useGetCollection(scope) {
582
+ const { getCollection } = useStableCollectionContext(name + "CollectionConsumer", scope);
583
+ return getCollection;
584
+ }
585
+ __name(useGetCollection, "useGetCollection");
586
+ const functions = {
587
+ createCollectionScope,
588
+ useCollection,
589
+ useGetCollection,
590
+ useInitCollection
591
+ };
592
+ return [
593
+ { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
594
+ functions
595
+ ];
596
+ }
597
+ __name(createCollection2, "createCollection");
598
+ function shallowEqual(a, b) {
599
+ if (a === b) return true;
600
+ if (typeof a !== "object" || typeof b !== "object") return false;
601
+ if (a == null || b == null) return false;
602
+ const keysA = Object.keys(a);
603
+ const keysB = Object.keys(b);
604
+ if (keysA.length !== keysB.length) return false;
605
+ for (const key of keysA) {
606
+ if (!Object.prototype.hasOwnProperty.call(b, key)) return false;
607
+ if (a[key] !== b[key]) return false;
608
+ }
609
+ return true;
610
+ }
611
+ __name(shallowEqual, "shallowEqual");
612
+ function isElementPreceding(a, b) {
613
+ return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);
614
+ }
615
+ __name(isElementPreceding, "isElementPreceding");
616
+ function isInDocumentOrder(dict) {
617
+ let previous;
618
+ for (const element of dict.keys()) {
619
+ if (previous) {
620
+ const position = previous.compareDocumentPosition(element);
621
+ if (!(position & Node.DOCUMENT_POSITION_DISCONNECTED) && position & Node.DOCUMENT_POSITION_PRECEDING) {
622
+ return false;
623
+ }
624
+ }
625
+ previous = element;
626
+ }
627
+ return true;
628
+ }
629
+ __name(isInDocumentOrder, "isInDocumentOrder");
630
+ function sortByDocumentPosition(a, b) {
631
+ return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1;
632
+ }
633
+ __name(sortByDocumentPosition, "sortByDocumentPosition");
634
+ function getChildListObserver(callback) {
635
+ const observer = new MutationObserver((mutationsList) => {
636
+ for (const mutation of mutationsList) {
637
+ if (mutation.type === "childList") {
638
+ callback();
639
+ return;
640
+ }
641
+ }
642
+ });
643
+ return observer;
644
+ }
645
+ __name(getChildListObserver, "getChildListObserver");
646
+ export {
647
+ createCollection,
648
+ createCollection2 as unstable_createCollection
649
+ };
650
+ //# sourceMappingURL=index.mjs.map
e-commerce/node_modules/@radix-ui/react-collection/dist/index.mjs.map ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/collection-legacy.tsx", "../src/collection.tsx", "../src/ordered-dictionary.ts"],
4
+ "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<typeof Slot>;\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 `<CollectionItem as={Slot}>\u2026</CollectionItem>`.\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<CollectionElement | null>;\n itemMap: Map<\n React.RefObject<ItemElement | null>,\n { ref: React.RefObject<ItemElement | null> } & ItemData\n >;\n };\n\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext<ContextValue>(\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<CollectionElement>(null);\n const itemMap = React.useRef<ContextValue['itemMap']>(new Map()).current;\n return (\n <CollectionProviderImpl scope={scope} itemMap={itemMap} collectionRef={ref}>\n {children}\n </CollectionProviderImpl>\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<CollectionElement, CollectionProps>(\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 <CollectionSlotImpl ref={composedRefs}>{children}</CollectionSlotImpl>;\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<ItemElement, CollectionItemSlotProps>(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef<ItemElement>(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 <CollectionItemSlotImpl {...{ [ITEM_DATA_ATTR]: '' }} ref={composedRefs}>\n {children}\n </CollectionItemSlotImpl>\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<typeof Slot>;\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<ItemElement, ItemDataWithElement<ItemData, ItemElement>>;\n\ntype CollectionDict<ItemElement extends HTMLElement, ItemData> = ReadOnlyOrderedDict<\n ItemElement,\n ItemDataWithElement<ItemData & BaseItemData, ItemElement>\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<CollectionElement | null>;\n collectionElementRefObject: React.RefObject<CollectionElement | null>;\n setCollection: React.Dispatch<\n React.SetStateAction<BaseCollectionDict<ItemElement, AllItemData>>\n >;\n getCollection: () => CollectionDict<ItemElement, AllItemData>;\n registryRef: React.RefObject<BaseCollectionDict<ItemElement, AllItemData>>;\n }\n\n interface CollectionStatefulContextValue {\n collectionElement: CollectionElement | null;\n collection: CollectionDict<ItemElement, AllItemData>;\n }\n\n const [CollectionStableContextProvider, useStableCollectionContext] =\n createCollectionContext<CollectionStableContextValue>(PROVIDER_NAME);\n CollectionStableContextProvider.displayName = name + 'CollectionStableContextProvider';\n\n const [CollectionStatefulContextProvider, useStatefulCollectionContext] =\n createCollectionContext<CollectionStatefulContextValue>(PROVIDER_NAME);\n CollectionStatefulContextProvider.displayName = name + 'CollectionStatefulContextProvider';\n\n type CollectionState = [\n ItemMap: BaseCollectionDict<ItemElement, AllItemData>,\n SetItemMap: React.Dispatch<React.SetStateAction<BaseCollectionDict<ItemElement, AllItemData>>>,\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 <CollectionProviderImpl {...props} state={state} />\n ) : (\n <CollectionInit {...props} />\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 <CollectionProviderImpl {...props} state={state} />;\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<CollectionElement>(null);\n const [collectionElement, setCollectionElement] = React.useState<CollectionElement | null>(\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<BaseCollectionDict<ItemElement, AllItemData>>(\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 <CollectionStableContextProvider\n scope={scope}\n collectionElementRef={composeRefs}\n collectionElementRefObject={ref}\n getCollection={getCollection}\n setCollection={setCollection}\n registryRef={registryRef}\n >\n <CollectionStatefulContextProvider\n scope={scope}\n collectionElement={collectionElement}\n collection={collection}\n >\n {children}\n </CollectionStatefulContextProvider>\n </CollectionStableContextProvider>\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<CollectionElement, CollectionSlotProps>(\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 <CollectionSlotImpl ref={composedRefs}>{children}</CollectionSlotImpl>;\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<ItemElement, CollectionItemSlotProps>(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef<ItemElement>(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 <CollectionItemSlotImpl {...{ [ITEM_DATA_ATTR]: '' }} ref={composedRefs as any}>\n {children}\n </CollectionItemSlotImpl>\n );\n },\n );\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useInitCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useInitCollection() {\n return React.useState<BaseCollectionDict<ItemElement, AllItemData>>(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<E extends HTMLElement, T extends BaseItemData>(\n dict: BaseCollectionDict<E, T>,\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<E extends HTMLElement, T extends BaseItemData>(\n a: EntryOf<BaseCollectionDict<E, T>>,\n b: EntryOf<BaseCollectionDict<E, T>>,\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<OrderedDict<any, any>, boolean>();\nexport class OrderedDict<K, V> extends Map<K, V> {\n #keys: K[];\n\n constructor(iterable?: Iterable<readonly [K, V]> | 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<K, V>) => 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<K, V>) => 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<KK extends K, VV extends V>(\n predicate: (entry: [K, V], index: number, dict: OrderedDict<K, V>) => entry is [KK, VV],\n thisArg?: any,\n ): OrderedDict<KK, VV>;\n\n filter(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any,\n ): OrderedDict<K, V>;\n\n filter(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => 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<U>(\n callbackfn: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => U,\n thisArg?: any,\n ): OrderedDict<K, U> {\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<K, V>,\n ) => [K, V],\n ): [K, V];\n reduce(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => [K, V],\n initialValue: [K, V],\n ): [K, V];\n reduce<U>(\n callbackfn: (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => U,\n initialValue: U,\n ): U;\n\n reduce<U>(\n ...args: [\n (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\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<K, V>,\n ) => [K, V],\n ): [K, V];\n reduceRight(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => [K, V],\n initialValue: [K, V],\n ): [K, V];\n reduceRight<U>(\n callbackfn: (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => U,\n initialValue: U,\n ): U;\n\n reduceRight<U>(\n ...args: [\n (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\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<K, V> {\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<K, V> {\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<K, V> {\n const reversed = new OrderedDict<K, V>();\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<K, V>;\n toSpliced(start: number, deleteCount: number, ...items: [K, V][]): OrderedDict<K, V>;\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<K, V>();\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<K, V>) => 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<K, V>) => 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<D extends OrderedDict<any, any>> =\n D extends OrderedDict<infer K, any> ? K : never;\nexport type ValueOf<D extends OrderedDict<any, any>> =\n D extends OrderedDict<any, infer V> ? V : never;\nexport type EntryOf<D extends OrderedDict<any, any>> = [KeyOf<D>, ValueOf<D>];\nexport type KeyFrom<E extends EntryOf<any>> = E[0];\nexport type ValueFrom<E extends EntryOf<any>> = E[1];\n\nfunction at<T>(array: ArrayLike<T>, 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<any>, 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<K, V> = Omit<\n OrderedDict<K, V>,\n 'set' | 'insert' | 'setBefore' | 'setAfter' | 'clear' |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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;",
6
+ "names": ["React", "createContextScope", "useComposedRefs", "createSlot", "jsx", "createCollection", "createContextScope", "useComposedRefs", "createSlot"]
7
+ }
e-commerce/node_modules/@radix-ui/react-collection/package.json ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@radix-ui/react-collection",
3
+ "version": "1.2.0",
4
+ "license": "MIT",
5
+ "source": "./src/index.ts",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.mjs",
8
+ "files": [
9
+ "dist",
10
+ "README.md"
11
+ ],
12
+ "sideEffects": false,
13
+ "dependencies": {
14
+ "@radix-ui/react-compose-refs": "1.1.5",
15
+ "@radix-ui/react-context": "1.3.0",
16
+ "@radix-ui/react-primitive": "2.2.0",
17
+ "@radix-ui/react-slot": "1.5.0",
18
+ "@radix-ui/react-use-layout-effect": "1.1.4"
19
+ },
20
+ "devDependencies": {
21
+ "@types/react": "^19.3.0",
22
+ "@types/react-dom": "^19.3.0",
23
+ "react": "^19.3.0",
24
+ "react-dom": "^19.3.0",
25
+ "typescript": "^5.9.3",
26
+ "@repo/builder": "0.0.0",
27
+ "@repo/typescript-config": "0.0.0"
28
+ },
29
+ "peerDependencies": {
30
+ "@types/react": "*",
31
+ "@types/react-dom": "*",
32
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
33
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
34
+ },
35
+ "peerDependenciesMeta": {
36
+ "@types/react": {
37
+ "optional": true
38
+ },
39
+ "@types/react-dom": {
40
+ "optional": true
41
+ }
42
+ },
43
+ "homepage": "https://radix-ui.com/primitives",
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/radix-ui/primitives.git",
47
+ "directory": "packages/react/collection"
48
+ },
49
+ "bugs": {
50
+ "url": "https://github.com/radix-ui/primitives/issues"
51
+ },
52
+ "scripts": {
53
+ "lint": "oxlint --max-warnings 0 src",
54
+ "clean": "rm -rf dist",
55
+ "reset": "rm -rf dist node_modules",
56
+ "typecheck": "tsc --noEmit",
57
+ "build": "radix-build"
58
+ },
59
+ "types": "./dist/index.d.ts",
60
+ "exports": {
61
+ ".": {
62
+ "import": {
63
+ "types": "./dist/index.d.mts",
64
+ "default": "./dist/index.mjs"
65
+ },
66
+ "require": {
67
+ "types": "./dist/index.d.ts",
68
+ "default": "./dist/index.js"
69
+ }
70
+ }
71
+ }
72
+ }
e-commerce/node_modules/@radix-ui/react-compose-refs/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2022 WorkOS
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
e-commerce/node_modules/@radix-ui/react-compose-refs/README.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # `react-compose-refs`
2
+
3
+ This is an internal utility, not intended for public usage.
e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.d.mts ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from 'react';
2
+
3
+ type PossibleRef<T> = React.Ref<T> | undefined;
4
+ /**
5
+ * A utility to compose multiple refs together
6
+ * Accepts callback refs and RefObject(s)
7
+ */
8
+ declare function composeRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T>;
9
+ /**
10
+ * A custom hook that composes multiple refs
11
+ * Accepts callback refs and RefObject(s)
12
+ */
13
+ declare function useComposedRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T>;
14
+
15
+ export { composeRefs, useComposedRefs };
e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.d.ts ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from 'react';
2
+
3
+ type PossibleRef<T> = React.Ref<T> | undefined;
4
+ /**
5
+ * A utility to compose multiple refs together
6
+ * Accepts callback refs and RefObject(s)
7
+ */
8
+ declare function composeRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T>;
9
+ /**
10
+ * A custom hook that composes multiple refs
11
+ * Accepts callback refs and RefObject(s)
12
+ */
13
+ declare function useComposedRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T>;
14
+
15
+ export { composeRefs, useComposedRefs };
e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.js ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/index.ts
32
+ var index_exports = {};
33
+ __export(index_exports, {
34
+ composeRefs: () => composeRefs,
35
+ useComposedRefs: () => useComposedRefs
36
+ });
37
+ module.exports = __toCommonJS(index_exports);
38
+
39
+ // src/compose-refs.tsx
40
+ var React = __toESM(require("react"));
41
+ function setRef(ref, value) {
42
+ if (typeof ref === "function") {
43
+ return ref(value);
44
+ } else if (ref !== null && ref !== void 0) {
45
+ ref.current = value;
46
+ }
47
+ }
48
+ __name(setRef, "setRef");
49
+ function composeRefs(...refs) {
50
+ return (node) => {
51
+ let hasCleanup = false;
52
+ const cleanups = refs.map((ref) => {
53
+ const cleanup = setRef(ref, node);
54
+ if (!hasCleanup && typeof cleanup == "function") {
55
+ hasCleanup = true;
56
+ }
57
+ return cleanup;
58
+ });
59
+ if (hasCleanup) {
60
+ return () => {
61
+ for (let i = 0; i < cleanups.length; i++) {
62
+ const cleanup = cleanups[i];
63
+ if (typeof cleanup == "function") {
64
+ cleanup();
65
+ } else {
66
+ setRef(refs[i], null);
67
+ }
68
+ }
69
+ };
70
+ }
71
+ };
72
+ }
73
+ __name(composeRefs, "composeRefs");
74
+ function useComposedRefs(...refs) {
75
+ return React.useCallback(composeRefs(...refs), refs);
76
+ }
77
+ __name(useComposedRefs, "useComposedRefs");
78
+ //# sourceMappingURL=index.js.map
e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.js.map ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts", "../src/compose-refs.tsx"],
4
+ "sourcesContent": ["export { composeRefs, useComposedRefs } from './compose-refs';\n", "import * as React from 'react';\n\ntype PossibleRef<T> = React.Ref<T> | undefined;\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === 'function') {\n return ref(value);\n } else if (ref !== null && ref !== undefined) {\n ref.current = value;\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup == 'function') {\n hasCleanup = true;\n }\n return cleanup;\n });\n\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup == 'function') {\n cleanup();\n } else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { composeRefs, useComposedRefs };\n"],
5
+ "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;",
6
+ "names": []
7
+ }
e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.mjs ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/compose-refs.tsx
5
+ import * as React from "react";
6
+ function setRef(ref, value) {
7
+ if (typeof ref === "function") {
8
+ return ref(value);
9
+ } else if (ref !== null && ref !== void 0) {
10
+ ref.current = value;
11
+ }
12
+ }
13
+ __name(setRef, "setRef");
14
+ function composeRefs(...refs) {
15
+ return (node) => {
16
+ let hasCleanup = false;
17
+ const cleanups = refs.map((ref) => {
18
+ const cleanup = setRef(ref, node);
19
+ if (!hasCleanup && typeof cleanup == "function") {
20
+ hasCleanup = true;
21
+ }
22
+ return cleanup;
23
+ });
24
+ if (hasCleanup) {
25
+ return () => {
26
+ for (let i = 0; i < cleanups.length; i++) {
27
+ const cleanup = cleanups[i];
28
+ if (typeof cleanup == "function") {
29
+ cleanup();
30
+ } else {
31
+ setRef(refs[i], null);
32
+ }
33
+ }
34
+ };
35
+ }
36
+ };
37
+ }
38
+ __name(composeRefs, "composeRefs");
39
+ function useComposedRefs(...refs) {
40
+ return React.useCallback(composeRefs(...refs), refs);
41
+ }
42
+ __name(useComposedRefs, "useComposedRefs");
43
+ export {
44
+ composeRefs,
45
+ useComposedRefs
46
+ };
47
+ //# sourceMappingURL=index.mjs.map
e-commerce/node_modules/@radix-ui/react-compose-refs/dist/index.mjs.map ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/compose-refs.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\n\ntype PossibleRef<T> = React.Ref<T> | undefined;\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === 'function') {\n return ref(value);\n } else if (ref !== null && ref !== undefined) {\n ref.current = value;\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup == 'function') {\n hasCleanup = true;\n }\n return cleanup;\n });\n\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup == 'function') {\n cleanup();\n } else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { composeRefs, useComposedRefs };\n"],
5
+ "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;",
6
+ "names": []
7
+ }
e-commerce/node_modules/@radix-ui/react-compose-refs/package.json ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@radix-ui/react-compose-refs",
3
+ "version": "1.1.5",
4
+ "license": "MIT",
5
+ "source": "./src/index.ts",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.mjs",
8
+ "files": [
9
+ "dist",
10
+ "README.md"
11
+ ],
12
+ "sideEffects": false,
13
+ "devDependencies": {
14
+ "@types/react": "^19.2.2",
15
+ "@types/react-dom": "^19.2.2",
16
+ "react": "^19.2.0",
17
+ "react-dom": "^19.2.0",
18
+ "typescript": "^5.9.3",
19
+ "@repo/builder": "0.0.0",
20
+ "@repo/typescript-config": "0.0.0"
21
+ },
22
+ "peerDependencies": {
23
+ "@types/react": "*",
24
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
25
+ },
26
+ "peerDependenciesMeta": {
27
+ "@types/react": {
28
+ "optional": true
29
+ }
30
+ },
31
+ "homepage": "https://radix-ui.com/primitives",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/radix-ui/primitives.git",
35
+ "directory": "packages/react/compose-refs"
36
+ },
37
+ "bugs": {
38
+ "url": "https://github.com/radix-ui/primitives/issues"
39
+ },
40
+ "scripts": {
41
+ "lint": "oxlint --max-warnings 0 src",
42
+ "clean": "rm -rf dist",
43
+ "reset": "rm -rf dist node_modules",
44
+ "typecheck": "tsc --noEmit",
45
+ "build": "radix-build"
46
+ },
47
+ "types": "./dist/index.d.ts",
48
+ "exports": {
49
+ ".": {
50
+ "import": {
51
+ "types": "./dist/index.d.mts",
52
+ "default": "./dist/index.mjs"
53
+ },
54
+ "require": {
55
+ "types": "./dist/index.d.ts",
56
+ "default": "./dist/index.js"
57
+ }
58
+ }
59
+ }
60
+ }
e-commerce/node_modules/@radix-ui/react-context/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2022 WorkOS
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
e-commerce/node_modules/@radix-ui/react-context/README.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # `react-context`
2
+
3
+ This is an internal utility, not intended for public usage.
e-commerce/node_modules/@radix-ui/react-context/dist/index.d.mts ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from 'react';
2
+
3
+ type ContextProvider<ContextValueType extends object | null> = React.FC<ContextValueType & {
4
+ children: React.ReactNode;
5
+ }>;
6
+ interface UseAssertedContext<ContextValueType extends object | null> {
7
+ (consumerName: string): ContextValueType;
8
+ }
9
+ interface UseContext<ContextValueType extends object | null> {
10
+ (consumerName: string): ContextValueType;
11
+ (consumerName: string, options: {
12
+ optional: true;
13
+ }): ContextValueType | undefined;
14
+ }
15
+ declare function createContext<ContextValueType extends object | null>(rootComponentName: string): readonly [ContextProvider<ContextValueType>, UseContext<ContextValueType>];
16
+ declare function createContext<ContextValueType extends object | null>(rootComponentName: string, defaultContext: ContextValueType): readonly [ContextProvider<ContextValueType>, UseAssertedContext<ContextValueType>];
17
+ type Scope<C = any> = {
18
+ [scopeName: string]: React.Context<C>[];
19
+ } | undefined;
20
+ type ScopeHook = (scope: Scope) => {
21
+ [__scopeProp: string]: Scope;
22
+ };
23
+ interface CreateScope {
24
+ scopeName: string;
25
+ (): ScopeHook;
26
+ }
27
+ type ScopedContextProvider<ContextValueType extends object | null> = React.FC<ContextValueType & {
28
+ scope: Scope<ContextValueType>;
29
+ children: React.ReactNode;
30
+ }>;
31
+ interface UseScopedContext<ContextValueType extends object | null> {
32
+ (consumerName: string, scope: Scope<ContextValueType | undefined>): ContextValueType;
33
+ (consumerName: string, scope: Scope<ContextValueType | undefined>, options: {
34
+ optional?: true | undefined;
35
+ }): ContextValueType | undefined;
36
+ }
37
+ interface UseAssertedScopedContext<ContextValueType extends object | null> {
38
+ (consumerName: string, scope: Scope<ContextValueType | undefined>): ContextValueType;
39
+ }
40
+ interface CreateScopedContext {
41
+ <ContextValueType extends object | null>(rootComponentName: string): readonly [ScopedContextProvider<ContextValueType>, UseScopedContext<ContextValueType>];
42
+ <ContextValueType extends object | null>(rootComponentName: string, defaultContext: ContextValueType): readonly [ScopedContextProvider<ContextValueType>, UseAssertedScopedContext<ContextValueType>];
43
+ }
44
+ declare function createContextScope(scopeName: string, createContextScopeDeps?: CreateScope[]): readonly [CreateScopedContext, CreateScope];
45
+
46
+ export { type CreateScope, type Scope, createContext, createContextScope };
e-commerce/node_modules/@radix-ui/react-context/dist/index.d.ts ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from 'react';
2
+
3
+ type ContextProvider<ContextValueType extends object | null> = React.FC<ContextValueType & {
4
+ children: React.ReactNode;
5
+ }>;
6
+ interface UseAssertedContext<ContextValueType extends object | null> {
7
+ (consumerName: string): ContextValueType;
8
+ }
9
+ interface UseContext<ContextValueType extends object | null> {
10
+ (consumerName: string): ContextValueType;
11
+ (consumerName: string, options: {
12
+ optional: true;
13
+ }): ContextValueType | undefined;
14
+ }
15
+ declare function createContext<ContextValueType extends object | null>(rootComponentName: string): readonly [ContextProvider<ContextValueType>, UseContext<ContextValueType>];
16
+ declare function createContext<ContextValueType extends object | null>(rootComponentName: string, defaultContext: ContextValueType): readonly [ContextProvider<ContextValueType>, UseAssertedContext<ContextValueType>];
17
+ type Scope<C = any> = {
18
+ [scopeName: string]: React.Context<C>[];
19
+ } | undefined;
20
+ type ScopeHook = (scope: Scope) => {
21
+ [__scopeProp: string]: Scope;
22
+ };
23
+ interface CreateScope {
24
+ scopeName: string;
25
+ (): ScopeHook;
26
+ }
27
+ type ScopedContextProvider<ContextValueType extends object | null> = React.FC<ContextValueType & {
28
+ scope: Scope<ContextValueType>;
29
+ children: React.ReactNode;
30
+ }>;
31
+ interface UseScopedContext<ContextValueType extends object | null> {
32
+ (consumerName: string, scope: Scope<ContextValueType | undefined>): ContextValueType;
33
+ (consumerName: string, scope: Scope<ContextValueType | undefined>, options: {
34
+ optional?: true | undefined;
35
+ }): ContextValueType | undefined;
36
+ }
37
+ interface UseAssertedScopedContext<ContextValueType extends object | null> {
38
+ (consumerName: string, scope: Scope<ContextValueType | undefined>): ContextValueType;
39
+ }
40
+ interface CreateScopedContext {
41
+ <ContextValueType extends object | null>(rootComponentName: string): readonly [ScopedContextProvider<ContextValueType>, UseScopedContext<ContextValueType>];
42
+ <ContextValueType extends object | null>(rootComponentName: string, defaultContext: ContextValueType): readonly [ScopedContextProvider<ContextValueType>, UseAssertedScopedContext<ContextValueType>];
43
+ }
44
+ declare function createContextScope(scopeName: string, createContextScopeDeps?: CreateScope[]): readonly [CreateScopedContext, CreateScope];
45
+
46
+ export { type CreateScope, type Scope, createContext, createContextScope };