@tamagui/group 2.0.0-rc.8 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Group.cjs +112 -96
- package/dist/cjs/Group.native.js +111 -101
- package/dist/cjs/Group.native.js.map +1 -1
- package/dist/cjs/index.cjs +7 -5
- package/dist/cjs/index.native.js +7 -5
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/useIndexedChildren.cjs +40 -36
- package/dist/cjs/useIndexedChildren.native.js +42 -38
- package/dist/cjs/useIndexedChildren.native.js.map +1 -1
- package/dist/esm/Group.mjs +81 -67
- package/dist/esm/Group.mjs.map +1 -1
- package/dist/esm/Group.native.js +80 -72
- package/dist/esm/Group.native.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -6
- package/dist/esm/useIndexedChildren.mjs +14 -12
- package/dist/esm/useIndexedChildren.mjs.map +1 -1
- package/dist/esm/useIndexedChildren.native.js +16 -14
- package/dist/esm/useIndexedChildren.native.js.map +1 -1
- package/dist/jsx/Group.mjs +81 -67
- package/dist/jsx/Group.mjs.map +1 -1
- package/dist/jsx/Group.native.js +111 -101
- package/dist/jsx/Group.native.js.map +1 -1
- package/dist/jsx/index.js +1 -1
- package/dist/jsx/index.js.map +1 -6
- package/dist/jsx/index.native.js +7 -5
- package/dist/jsx/useIndexedChildren.mjs +14 -12
- package/dist/jsx/useIndexedChildren.mjs.map +1 -1
- package/dist/jsx/useIndexedChildren.native.js +42 -38
- package/dist/jsx/useIndexedChildren.native.js.map +1 -1
- package/package.json +13 -17
- package/dist/cjs/Group.js +0 -108
- package/dist/cjs/Group.js.map +0 -6
- package/dist/cjs/index.js +0 -15
- package/dist/cjs/index.js.map +0 -6
- package/dist/cjs/useIndexedChildren.js +0 -70
- package/dist/cjs/useIndexedChildren.js.map +0 -6
- package/dist/esm/Group.js +0 -90
- package/dist/esm/Group.js.map +0 -6
- package/dist/esm/useIndexedChildren.js +0 -47
- package/dist/esm/useIndexedChildren.js.map +0 -6
- package/dist/jsx/Group.js +0 -90
- package/dist/jsx/Group.js.map +0 -6
- package/dist/jsx/useIndexedChildren.js +0 -47
- package/dist/jsx/useIndexedChildren.js.map +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toESM","mod","isNodeMode","__esModule","value","__toCommonJS","Group_exports","Group","GroupFrame","XGroup","YGroup","createGroupScope","useGroupItem","module","exports","import_jsx_runtime","require","import_core","import_create_context","import_helpers","import_stacks","import_react","import_useIndexedChildren","GROUP_NAME","createGroupContext","createContextScope","GroupProvider","useGroupContext","styled","YStack","variants","unstyled","false","size","val","param","tokens","_tokens_radius_val","_ref","borderRadius","radius","
|
|
1
|
+
{"version":3,"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toESM","mod","isNodeMode","__esModule","value","__toCommonJS","Group_exports","Group","GroupFrame","XGroup","YGroup","createGroupScope","useGroupItem","module","exports","import_jsx_runtime","require","import_core","import_create_context","import_helpers","import_stacks","import_react","import_useIndexedChildren","GROUP_NAME","createGroupContext","createContextScope","GroupProvider","useGroupContext","styled","YStack","variants","unstyled","false","size","val","param","tokens","_tokens_radius_val","_ref","borderRadius","radius","defaultVariants","process","env","TAMAGUI_HEADLESS","createGroup","verticalDefault","withStaticProperties","styleable","props","ref","__scopeGroup","children","childrenProp","orientation","disabled","restProps","vertical","indexedChildren","useIndexedChildren","default","Children","toArray","jsx","scope","flexDirection","Item","GroupItem","forcePlacement","forwardedProps","context","treeIndex","useIndex","Error","isValidElement","isFirst","index","isLast","maxIndex","radiusStyles","getZeroedRadius","groupProps","_children_props_disabled"],"sources":["../../src/Group.tsx"],"sourcesContent":[null],"mappings":"AACA,YAAS;;AAET,IAAAA,QAAS,GAAAC,MAAA,CAAAC,MAAA;AACT,IAAAC,SAAS,GAAAF,MAAA,CAAAG,cAA4B;AACrC,IAAAC,gBAAS,GAAcJ,MAAA,CAAAK,wBAAA;AACvB,IAAAC,iBAAkB,GAAAN,MAAA,CAAAO,mBAAA;AAClB,IAAAC,YAAS,GAAUR,MAAA,CAAAS,cAAA;AA2DT,IAAAC,YAAA,GAAAV,MAAA,CAAAW,SAAA,CAAAC,cAAA;AApDV,IAAAC,QAAM,GAAAA,CAAAC,MAAa,EAAAC,GAAA;EAGnB,KAAO,IAAAC,IAAA,IAAAD,GAAA,EACPb,SAAO,CAAAY,MAAA,EAAeE,IAAA;IAAAC,GAAA,EAAAF,GAAe,CAAAC,IAAI;IAAAE,UAAA;EAAsC;AAExE;AAAkC,IACvCC,WAAM,GAAAA,CAAAC,EAAA,EAAAC,IAAA,EAAAC,MAAA,EAAAC,IAAA;EAEN,IAAAF,IAAA,IAAU,OAAAA,IAAA,wBAAAA,IAAA;IACR,SAAAG,GAAU,IAAAlB,iBAAA,CAAAe,IAAA,GACR,KAAAX,YAAO,CAAAe,IAAA,CAAAL,EAAA,EAAAI,GAAA,KAAAA,GAAA,KAAAF,MAAA,EACLpB,SAAM,CAAAkB,EAAA,EAAAI,GAAA;MAAAP,GAAA,EAAAA,CAAA,KAAAI,IAAA,CAAAG,GAAA;MAAAN,UAAA,IAAAK,IAAA,GAAAnB,gBAAA,CAAAiB,IAAA,EAAAG,GAAA,MAAAD,IAAA,CAAAL;IAAA;EAAA;EACR,OACFE,EAAA;AAAA;AAGE,IAAAM,OAAA,GAAMA,CAAAC,GAAA,EAAAC,UAAe,EAAAd,MAAO,MAAUA,MAAK,GAAAa,GAAO,QAAO,GAAA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IAAA,GAAAC;EAAA,IAAApB,KAAA;EACL,IAAAqB,OAAA,GAAA3C,eAAA,cAAAwB,YAAA;EACF,IAAAoB,SAAA,OAAAjD,yBAAA,CAAAkD,QAAA;EAEO,IAAM,CAAAD,SAAQ;IACd,MAAME,KAAS;EACf;EAMP,qBAASpD,YAAkC,CAAAuC,OAAiB,CAAAc,cAAmB,CAAAtB,QAAA;IAC7E,OAAIA,QAAU;EAEZ;EAAO,IACLuB,OAAI,GAAAP,cAAmB,gBAAAA,cAAwB,eAAsBG,SAAE,CAAAK,KAAA;EAAA,IACvEC,MAAI,GAAAT,cAAkB,eAAAA,cAA2B,gBAAAG,SAA2B,CAAAK,KAAA,KAAAL,SAAA,CAAAO,QAAA;EAAA,IAC9EC,YAAA,GAAAC,eAAA,CAAAL,OAAA,EAAAE,MAAA,EAAAP,OAAA,CAAAb,QAAA;EACF,IAAAwB,UAAA;IAEA,GAAAZ,cAAO;IACL,GAAIU;EAAqE;EAE3E,IAAAT,OAAA,CAAAf,QAAA;IACF,IAAA2B,wBAAA","ignoreList":[]}
|
package/dist/jsx/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./Group";
|
|
1
|
+
export * from "./Group.mjs";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/jsx/index.js.map
CHANGED
package/dist/jsx/index.native.js
CHANGED
|
@@ -5,15 +5,17 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
9
10
|
get: () => from[key],
|
|
10
11
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
12
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
17
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
16
|
-
value:
|
|
18
|
+
value: true
|
|
17
19
|
}), mod);
|
|
18
20
|
var index_exports = {};
|
|
19
21
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
const MaxIndexContext = React.createContext([])
|
|
4
|
-
|
|
3
|
+
const MaxIndexContext = React.createContext([]);
|
|
4
|
+
const IndexContext = React.createContext(null);
|
|
5
5
|
function useIndex() {
|
|
6
|
-
const maxIndexPath = React.useContext(MaxIndexContext)
|
|
7
|
-
|
|
6
|
+
const maxIndexPath = React.useContext(MaxIndexContext);
|
|
7
|
+
const indexPathString = React.useContext(IndexContext);
|
|
8
8
|
return React.useMemo(() => {
|
|
9
|
-
if (indexPathString === null)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
if (indexPathString === null) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const indexPath = parseIndexPath(indexPathString);
|
|
13
|
+
const maxIndex = maxIndexPath[maxIndexPath.length - 1];
|
|
14
|
+
const index = indexPath[indexPath.length - 1];
|
|
13
15
|
return {
|
|
14
16
|
maxIndex,
|
|
15
17
|
maxIndexPath,
|
|
@@ -24,10 +26,10 @@ function useIndex() {
|
|
|
24
26
|
}, [maxIndexPath, indexPathString]);
|
|
25
27
|
}
|
|
26
28
|
function useIndexedChildren(children) {
|
|
27
|
-
const parentMaxIndexPath = React.useContext(MaxIndexContext)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const parentMaxIndexPath = React.useContext(MaxIndexContext);
|
|
30
|
+
const indexPathString = React.useContext(IndexContext);
|
|
31
|
+
const childrenCount = React.Children.count(children);
|
|
32
|
+
const maxIndexPath = React.useMemo(() => parentMaxIndexPath.concat(childrenCount - 1), [childrenCount]);
|
|
31
33
|
return /* @__PURE__ */jsx(MaxIndexContext.Provider, {
|
|
32
34
|
value: maxIndexPath,
|
|
33
35
|
children: React.Children.map(children, (child, index) => React.isValidElement(child) ? /* @__PURE__ */jsx(IndexContext.Provider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","jsx","MaxIndexContext","createContext","IndexContext","useIndex","maxIndexPath","useContext","indexPathString","useMemo","indexPath","parseIndexPath","maxIndex","length","index","isFirst","isLast","isEven","isOdd","Math","abs","useIndexedChildren","children","parentMaxIndexPath","childrenCount","Children","count","concat","Provider","value","map","child","isValidElement","toString","key","split","Number","parseInt"],"sources":["../../src/useIndexedChildren.tsx"],"sourcesContent":[null],"mappings":"AAyBA,YAAYA,KAAA,MAAW;AA+Cb,SAAAC,GAAA;AA7CV,MAAMC,eAAA,GAAkBF,KAAA,CAAMG,aAAA,CAAwB,EAAE;
|
|
1
|
+
{"version":3,"names":["React","jsx","MaxIndexContext","createContext","IndexContext","useIndex","maxIndexPath","useContext","indexPathString","useMemo","indexPath","parseIndexPath","maxIndex","length","index","isFirst","isLast","isEven","isOdd","Math","abs","useIndexedChildren","children","parentMaxIndexPath","childrenCount","Children","count","concat","Provider","value","map","child","isValidElement","toString","key","split","Number","parseInt"],"sources":["../../src/useIndexedChildren.tsx"],"sourcesContent":[null],"mappings":"AAyBA,YAAYA,KAAA,MAAW;AA+Cb,SAAAC,GAAA;AA7CV,MAAMC,eAAA,GAAkBF,KAAA,CAAMG,aAAA,CAAwB,EAAE;AACxD,MAAMC,YAAA,GAAeJ,KAAA,CAAMG,aAAA,CAA6B,IAAI;AAGrD,SAASE,SAAA,EAAW;EACzB,MAAMC,YAAA,GAAeN,KAAA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AAOjB,KAAA,KACpCd,KAAA,CAAMgC,cAAA,CAAeD,KAAK,IACxB,eAAA9B,GAAA,CAACG,YAAA,CAAawB,QAAA,EAAb;MAECC,KAAA,EACErB,eAAA,GACI,GAAGA,eAAe,IAAIM,KAAA,CAAMmB,QAAA,CAAS,CAAC,KACtCnB,KAAA,CAAMmB,QAAA,CAAS;MAGpBX,QAAA,EAAAS;IAAA,GAPIA,KAAA,CAAMG,GAQb,IAEAH,KAEJ;EAAA,CACF;AAEJ;AAQA,SAASpB,eAAeH,eAAA,EAAyB;EAC/C,OAAOA,eAAA,CAAgB2B,KAAA,CAAM,GAAG,EAAEL,GAAA,CAAKhB,KAAA,IAAUsB,MAAA,CAAOC,QAAA,CAASvB,KAAA,EAAO,EAAE,CAAC;AAC7E","ignoreList":[]}
|
|
@@ -4,51 +4,55 @@ var __create = Object.create;
|
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
8
|
-
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __export = (target, all) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
18
|
get: () => from[key],
|
|
18
19
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
20
|
});
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
22
24
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
34
|
+
value: true
|
|
35
|
+
}), mod);
|
|
34
36
|
var useIndexedChildren_exports = {};
|
|
35
37
|
__export(useIndexedChildren_exports, {
|
|
36
38
|
useIndex: () => useIndex,
|
|
37
39
|
useIndexedChildren: () => useIndexedChildren
|
|
38
40
|
});
|
|
39
41
|
module.exports = __toCommonJS(useIndexedChildren_exports);
|
|
40
|
-
var import_jsx_runtime = require("react/jsx-runtime")
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
|
+
var React = __toESM(require("react"), 1);
|
|
44
|
+
var MaxIndexContext = /* @__PURE__ */React.createContext([]);
|
|
45
|
+
var IndexContext = /* @__PURE__ */React.createContext(null);
|
|
44
46
|
function useIndex() {
|
|
45
|
-
var maxIndexPath = React.useContext(MaxIndexContext)
|
|
46
|
-
|
|
47
|
+
var maxIndexPath = React.useContext(MaxIndexContext);
|
|
48
|
+
var indexPathString = React.useContext(IndexContext);
|
|
47
49
|
return React.useMemo(function () {
|
|
48
|
-
if (indexPathString === null)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
if (indexPathString === null) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
var indexPath = parseIndexPath(indexPathString);
|
|
54
|
+
var maxIndex = maxIndexPath[maxIndexPath.length - 1];
|
|
55
|
+
var index = indexPath[indexPath.length - 1];
|
|
52
56
|
return {
|
|
53
57
|
maxIndex,
|
|
54
58
|
maxIndexPath,
|
|
@@ -63,12 +67,12 @@ function useIndex() {
|
|
|
63
67
|
}, [maxIndexPath, indexPathString]);
|
|
64
68
|
}
|
|
65
69
|
function useIndexedChildren(children) {
|
|
66
|
-
var parentMaxIndexPath = React.useContext(MaxIndexContext)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
var parentMaxIndexPath = React.useContext(MaxIndexContext);
|
|
71
|
+
var indexPathString = React.useContext(IndexContext);
|
|
72
|
+
var childrenCount = React.Children.count(children);
|
|
73
|
+
var maxIndexPath = React.useMemo(function () {
|
|
74
|
+
return parentMaxIndexPath.concat(childrenCount - 1);
|
|
75
|
+
}, [childrenCount]);
|
|
72
76
|
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(MaxIndexContext.Provider, {
|
|
73
77
|
value: maxIndexPath,
|
|
74
78
|
children: React.Children.map(children, function (child, index) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toESM","mod","isNodeMode","__esModule","value","__toCommonJS","useIndexedChildren_exports","useIndex","useIndexedChildren","module","exports","import_jsx_runtime","require","React","MaxIndexContext","createContext","IndexContext","maxIndexPath","useContext","indexPathString","useMemo","indexPath","parseIndexPath","maxIndex","length","index"],"sources":["../../src/useIndexedChildren.tsx"],"sourcesContent":[null],"mappings":"AAyBA,YAAY;;AA+CF,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA;AA7CV,IAAAC,SAAM,GAAAF,MAAA,CAAAG,cAAwB;
|
|
1
|
+
{"version":3,"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toESM","mod","isNodeMode","__esModule","value","__toCommonJS","useIndexedChildren_exports","useIndex","useIndexedChildren","module","exports","import_jsx_runtime","require","React","MaxIndexContext","createContext","IndexContext","maxIndexPath","useContext","indexPathString","useMemo","indexPath","parseIndexPath","maxIndex","length","index"],"sources":["../../src/useIndexedChildren.tsx"],"sourcesContent":[null],"mappings":"AAyBA,YAAY;;AA+CF,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA;AA7CV,IAAAC,SAAM,GAAAF,MAAA,CAAAG,cAAwB;AAC9B,IAAAC,gBAAM,GAAeJ,MAAM,CAAAK,wBAAiC;AAGrD,IAAAC,iBAAoB,GAAAN,MAAA,CAAAO,mBAAA;AACzB,IAAAC,YAAM,GAAAR,MAAe,CAAAS,cAAiB;AACtC,IAAAC,YAAM,GAAAV,MAAA,CAAkBW,SAAM,CAAAC,cAAW;AAEzC,IAAAC,QAAO,GAAMA,CAAAC,MAAA,EAAQC,GAAA,KAAM;EACzB,SAAIC,IAAA,IAAAD,GAAA,EACFb,SAAO,CAAAY,MAAA,EAAAE,IAAA;IAAAC,GAAA,EAAAF,GAAA,CAAAC,IAAA;IAAAE,UAAA;EAAA;AAAA;AAGT,IAAAC,WAAM,GAAAA,CAAAC,EAAA,EAAYC,IAAA,EAAAC,MAAA,EAAeC,IAAA;EACjC,IAAAF,IAAM,WAAW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KAAA,CAAAK,UAAA,CAAAJ,eAAA;EAAA,IAAAK,eAGG,GAAAN,KAAA,CAAAK,UACO,CAAAF,YAAe;EACH,OAGpBH,KAAA,CAAAO,OAAA;IAAA,IAAAD,eAAA;MAPI,OAAM;IAQb;IAIJ,IACFE,SAAA,GAAAC,cAAA,CAAAH,eAAA;IAEJ,IAAAI,QAAA,GAAAN,YAAA,CAAAA,YAAA,CAAAO,MAAA;IAQA,IAAAC,KAAS,GAAAJ,SAAe,CAAAA,SAAA,CAAAG,MAAyB;IAC/C,OAAO;MACTD,QAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/group",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"files": [
|
|
@@ -19,15 +19,12 @@
|
|
|
19
19
|
"./package.json": "./package.json",
|
|
20
20
|
".": {
|
|
21
21
|
"types": "./types/index.d.ts",
|
|
22
|
-
"react-native":
|
|
23
|
-
|
|
24
|
-
"import": "./dist/esm/index.native.js",
|
|
25
|
-
"require": "./dist/cjs/index.native.js"
|
|
26
|
-
},
|
|
22
|
+
"react-native": "./dist/esm/index.native.js",
|
|
23
|
+
"browser": "./dist/esm/index.mjs",
|
|
27
24
|
"module": "./dist/esm/index.mjs",
|
|
28
25
|
"import": "./dist/esm/index.mjs",
|
|
29
26
|
"require": "./dist/cjs/index.cjs",
|
|
30
|
-
"default": "./dist/
|
|
27
|
+
"default": "./dist/esm/index.mjs"
|
|
31
28
|
}
|
|
32
29
|
},
|
|
33
30
|
"publishConfig": {
|
|
@@ -40,21 +37,20 @@
|
|
|
40
37
|
"clean:build": "tamagui-build clean:build"
|
|
41
38
|
},
|
|
42
39
|
"dependencies": {
|
|
43
|
-
"@tamagui/core": "2.0.0
|
|
44
|
-
"@tamagui/create-context": "2.0.0
|
|
45
|
-
"@tamagui/helpers": "2.0.0
|
|
46
|
-
"@tamagui/spacer": "2.0.0
|
|
47
|
-
"@tamagui/stacks": "2.0.0
|
|
48
|
-
"@tamagui/use-controllable-state": "2.0.0
|
|
40
|
+
"@tamagui/core": "2.0.0",
|
|
41
|
+
"@tamagui/create-context": "2.0.0",
|
|
42
|
+
"@tamagui/helpers": "2.0.0",
|
|
43
|
+
"@tamagui/spacer": "2.0.0",
|
|
44
|
+
"@tamagui/stacks": "2.0.0",
|
|
45
|
+
"@tamagui/use-controllable-state": "2.0.0"
|
|
49
46
|
},
|
|
50
47
|
"devDependencies": {
|
|
51
|
-
"@tamagui/build": "2.0.0
|
|
48
|
+
"@tamagui/build": "2.0.0",
|
|
52
49
|
"react": ">=19",
|
|
53
|
-
"react-native": "0.
|
|
50
|
+
"react-native": "0.83.2"
|
|
54
51
|
},
|
|
55
52
|
"peerDependencies": {
|
|
56
|
-
"react": ">=19"
|
|
57
|
-
"react-native": "*"
|
|
53
|
+
"react": ">=19"
|
|
58
54
|
},
|
|
59
55
|
"module:jsx": "dist/jsx"
|
|
60
56
|
}
|
package/dist/cjs/Group.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
-
mod
|
|
22
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
|
-
var Group_exports = {};
|
|
24
|
-
__export(Group_exports, {
|
|
25
|
-
Group: () => Group,
|
|
26
|
-
GroupFrame: () => GroupFrame,
|
|
27
|
-
XGroup: () => XGroup,
|
|
28
|
-
YGroup: () => YGroup,
|
|
29
|
-
createGroupScope: () => createGroupScope,
|
|
30
|
-
useGroupItem: () => useGroupItem
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(Group_exports);
|
|
33
|
-
var import_core = require("@tamagui/core"), import_create_context = require("@tamagui/create-context"), import_helpers = require("@tamagui/helpers"), import_stacks = require("@tamagui/stacks"), import_react = __toESM(require("react"), 1), import_useIndexedChildren = require("./useIndexedChildren"), import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
-
const GROUP_NAME = "Group", [createGroupContext, createGroupScope] = (0, import_create_context.createContextScope)(GROUP_NAME), [GroupProvider, useGroupContext] = createGroupContext(GROUP_NAME), GroupFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
35
|
-
name: "GroupFrame",
|
|
36
|
-
variants: {
|
|
37
|
-
unstyled: {
|
|
38
|
-
false: {
|
|
39
|
-
size: "$true"
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
size: (val, { tokens }) => ({
|
|
43
|
-
borderRadius: tokens.radius[val] ?? val ?? tokens.radius.$true
|
|
44
|
-
})
|
|
45
|
-
},
|
|
46
|
-
defaultVariants: {
|
|
47
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
function createGroup(verticalDefault) {
|
|
51
|
-
return (0, import_helpers.withStaticProperties)(
|
|
52
|
-
GroupFrame.styleable((props, ref) => {
|
|
53
|
-
const {
|
|
54
|
-
__scopeGroup,
|
|
55
|
-
children: childrenProp,
|
|
56
|
-
orientation = verticalDefault ? "vertical" : "horizontal",
|
|
57
|
-
disabled,
|
|
58
|
-
...restProps
|
|
59
|
-
} = props, vertical = orientation === "vertical", indexedChildren = (0, import_useIndexedChildren.useIndexedChildren)(import_react.default.Children.toArray(childrenProp));
|
|
60
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GroupProvider, { vertical, disabled, scope: __scopeGroup, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
61
|
-
GroupFrame,
|
|
62
|
-
{
|
|
63
|
-
ref,
|
|
64
|
-
flexDirection: vertical ? "column" : "row",
|
|
65
|
-
...restProps,
|
|
66
|
-
children: indexedChildren
|
|
67
|
-
}
|
|
68
|
-
) });
|
|
69
|
-
}),
|
|
70
|
-
{
|
|
71
|
-
Item: GroupItem
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
function GroupItem(props) {
|
|
76
|
-
const { __scopeGroup, children, forcePlacement, ...forwardedProps } = props, context = useGroupContext("GroupItem", __scopeGroup), treeIndex = (0, import_useIndexedChildren.useIndex)();
|
|
77
|
-
if (!treeIndex)
|
|
78
|
-
throw Error("<Group.Item/> should only be used within a <Group/>");
|
|
79
|
-
if (!import_react.default.isValidElement(children))
|
|
80
|
-
return children;
|
|
81
|
-
const isFirst = forcePlacement === "first" || forcePlacement !== "last" && treeIndex.index === 0, isLast = forcePlacement === "last" || forcePlacement !== "first" && treeIndex.index === treeIndex.maxIndex, radiusStyles = getZeroedRadius(isFirst, isLast, context.vertical), groupProps = {
|
|
82
|
-
...forwardedProps,
|
|
83
|
-
...radiusStyles
|
|
84
|
-
};
|
|
85
|
-
context.disabled != null && (groupProps.disabled = children.props.disabled ?? context.disabled);
|
|
86
|
-
const mergedProps = (0, import_core.mergeSlotStyleProps)(groupProps, children.props);
|
|
87
|
-
return import_react.default.cloneElement(children, mergedProps);
|
|
88
|
-
}
|
|
89
|
-
const useGroupItem = (childrenProps, forcePlacement, __scopeGroup) => {
|
|
90
|
-
const treeIndex = (0, import_useIndexedChildren.useIndex)(), context = useGroupContext("GroupItem", __scopeGroup);
|
|
91
|
-
if (!treeIndex)
|
|
92
|
-
throw Error("useGroupItem should only be used within a <Group/>");
|
|
93
|
-
const isFirst = forcePlacement === "first" || forcePlacement !== "last" && treeIndex.index === 0, isLast = forcePlacement === "last" || forcePlacement !== "first" && treeIndex.index === treeIndex.maxIndex, radiusStyles = getZeroedRadius(isFirst, isLast, context.vertical);
|
|
94
|
-
return {
|
|
95
|
-
disabled: childrenProps.disabled ?? context.disabled,
|
|
96
|
-
...radiusStyles
|
|
97
|
-
};
|
|
98
|
-
}, Group = createGroup(!0), YGroup = Group, XGroup = createGroup(!1);
|
|
99
|
-
function getZeroedRadius(isFirst, isLast, vertical) {
|
|
100
|
-
return vertical ? {
|
|
101
|
-
...isFirst ? null : { borderTopLeftRadius: 0, borderTopRightRadius: 0 },
|
|
102
|
-
...isLast ? null : { borderBottomLeftRadius: 0, borderBottomRightRadius: 0 }
|
|
103
|
-
} : {
|
|
104
|
-
...isFirst ? null : { borderTopLeftRadius: 0, borderBottomLeftRadius: 0 },
|
|
105
|
-
...isLast ? null : { borderTopRightRadius: 0, borderBottomRightRadius: 0 }
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=Group.js.map
|
package/dist/cjs/Group.js.map
DELETED
|
@@ -1,6 +0,0 @@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qB,GAAG,sBAAsB,EAAE;AAAA,IACvE,GAAI,SAAS,OAAO,EAAE,wBAAwB,GAAG,yBAAyB,EAAE;AAAA,EAC9E,IAGK;AAAA,IACL,GAAI,UAAU,OAAO,EAAE,qBAAqB,GAAG,wBAAwB,EAAE;AAAA,IACzE,GAAI,SAAS,OAAO,EAAE,sBAAsB,GAAG,yBAAyB,EAAE;AAAA,EAC5E;AACF;",
|
|
5
|
-
"names": ["React"]
|
|
6
|
-
}
|
package/dist/cjs/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
9
|
-
return to;
|
|
10
|
-
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
11
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
12
|
-
var index_exports = {};
|
|
13
|
-
module.exports = __toCommonJS(index_exports);
|
|
14
|
-
__reExport(index_exports, require("./Group"), module.exports);
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
-
mod
|
|
22
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
|
-
var useIndexedChildren_exports = {};
|
|
24
|
-
__export(useIndexedChildren_exports, {
|
|
25
|
-
useIndex: () => useIndex,
|
|
26
|
-
useIndexedChildren: () => useIndexedChildren
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(useIndexedChildren_exports);
|
|
29
|
-
var React = __toESM(require("react"), 1), import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
-
const MaxIndexContext = React.createContext([]), IndexContext = React.createContext(null);
|
|
31
|
-
function useIndex() {
|
|
32
|
-
const maxIndexPath = React.useContext(MaxIndexContext), indexPathString = React.useContext(IndexContext);
|
|
33
|
-
return React.useMemo(() => {
|
|
34
|
-
if (indexPathString === null)
|
|
35
|
-
return null;
|
|
36
|
-
const indexPath = parseIndexPath(indexPathString), maxIndex = maxIndexPath[maxIndexPath.length - 1], index = indexPath[indexPath.length - 1];
|
|
37
|
-
return {
|
|
38
|
-
maxIndex,
|
|
39
|
-
maxIndexPath,
|
|
40
|
-
index,
|
|
41
|
-
indexPath,
|
|
42
|
-
indexPathString,
|
|
43
|
-
isFirst: index === 0,
|
|
44
|
-
isLast: index === maxIndex,
|
|
45
|
-
isEven: index % 2 === 0,
|
|
46
|
-
isOdd: Math.abs(index % 2) === 1
|
|
47
|
-
};
|
|
48
|
-
}, [maxIndexPath, indexPathString]);
|
|
49
|
-
}
|
|
50
|
-
function useIndexedChildren(children) {
|
|
51
|
-
const parentMaxIndexPath = React.useContext(MaxIndexContext), indexPathString = React.useContext(IndexContext), childrenCount = React.Children.count(children), maxIndexPath = React.useMemo(
|
|
52
|
-
() => parentMaxIndexPath.concat(childrenCount - 1),
|
|
53
|
-
[childrenCount]
|
|
54
|
-
);
|
|
55
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MaxIndexContext.Provider, { value: maxIndexPath, children: React.Children.map(
|
|
56
|
-
children,
|
|
57
|
-
(child, index) => React.isValidElement(child) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
58
|
-
IndexContext.Provider,
|
|
59
|
-
{
|
|
60
|
-
value: indexPathString ? `${indexPathString}.${index.toString()}` : index.toString(),
|
|
61
|
-
children: child
|
|
62
|
-
},
|
|
63
|
-
child.key
|
|
64
|
-
) : child
|
|
65
|
-
) });
|
|
66
|
-
}
|
|
67
|
-
function parseIndexPath(indexPathString) {
|
|
68
|
-
return indexPathString.split(".").map((index) => Number.parseInt(index, 10));
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=useIndexedChildren.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/useIndexedChildren.tsx"],
|
|
4
|
-
"mappings": ";;;;;;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