@tamagui/group 2.7.7 → 3.0.0-beta.643.1
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 +104 -132
- package/dist/cjs/Group.native.cjs +147 -0
- package/dist/cjs/Group.native.js +109 -136
- package/dist/cjs/Group.native.js.map +1 -1
- package/dist/cjs/index.cjs +10 -11
- package/dist/cjs/index.native.cjs +21 -0
- package/dist/cjs/index.native.js +10 -10
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/useIndexedChildren.cjs +52 -58
- package/dist/cjs/useIndexedChildren.native.cjs +84 -0
- package/dist/cjs/useIndexedChildren.native.js +60 -65
- package/dist/cjs/useIndexedChildren.native.js.map +1 -1
- package/dist/esm/Group.mjs +84 -104
- package/dist/esm/Group.mjs.map +1 -1
- package/dist/esm/Group.native.js +90 -110
- package/dist/esm/Group.native.js.map +1 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.mjs +1 -2
- package/dist/esm/index.native.js +1 -2
- package/dist/esm/useIndexedChildren.mjs +35 -33
- package/dist/esm/useIndexedChildren.mjs.map +1 -1
- package/dist/esm/useIndexedChildren.native.js +44 -42
- package/dist/esm/useIndexedChildren.native.js.map +1 -1
- package/dist/jsx/Group.mjs +84 -104
- package/dist/jsx/Group.mjs.map +1 -1
- package/dist/jsx/Group.native.cjs +147 -0
- package/dist/jsx/Group.native.js +109 -136
- package/dist/jsx/Group.native.js.map +1 -1
- package/dist/jsx/index.js +1 -2
- package/dist/jsx/index.mjs +1 -2
- package/dist/jsx/index.native.cjs +21 -0
- package/dist/jsx/index.native.js +10 -10
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/useIndexedChildren.mjs +35 -33
- package/dist/jsx/useIndexedChildren.mjs.map +1 -1
- package/dist/jsx/useIndexedChildren.native.cjs +84 -0
- package/dist/jsx/useIndexedChildren.native.js +60 -65
- package/dist/jsx/useIndexedChildren.native.js.map +1 -1
- package/package.json +9 -9
- package/src/Group.tsx +20 -19
- package/types/Group.d.ts +107 -78
- package/types/Group.d.ts.map +1 -1
- package/types/useIndexedChildren.d.ts +1 -1
- package/types/useIndexedChildren.d.ts.map +1 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs.map +0 -1
package/dist/cjs/Group.native.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
var __create = Object.create;
|
|
4
5
|
var __defProp = Object.defineProperty;
|
|
5
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -7,40 +8,33 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
7
8
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
10
|
var __export = (target, all) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
for (var name in all) __defProp(target, name, {
|
|
12
|
+
get: all[name],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
14
15
|
};
|
|
15
16
|
var __copyProps = (to, from, except, desc) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
19
|
+
get: () => from[key],
|
|
20
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
23
24
|
};
|
|
24
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
-
|
|
26
|
-
|
|
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
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: true
|
|
32
28
|
}) : target, mod));
|
|
33
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
34
|
-
value: true
|
|
35
|
-
}), mod);
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
30
|
var Group_exports = {};
|
|
37
31
|
__export(Group_exports, {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
32
|
+
Group: () => Group,
|
|
33
|
+
GroupFrame: () => GroupFrame,
|
|
34
|
+
XGroup: () => XGroup,
|
|
35
|
+
YGroup: () => YGroup,
|
|
36
|
+
createGroupScope: () => createGroupScope,
|
|
37
|
+
useGroupItem: () => useGroupItem
|
|
44
38
|
});
|
|
45
39
|
module.exports = __toCommonJS(Group_exports);
|
|
46
40
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -53,124 +47,103 @@ var import_useIndexedChildren = require("./useIndexedChildren.native.js");
|
|
|
53
47
|
var GROUP_NAME = "Group";
|
|
54
48
|
var [createGroupContext, createGroupScope] = (0, import_create_context.createContextScope)(GROUP_NAME);
|
|
55
49
|
var [GroupProvider, useGroupContext] = createGroupContext(GROUP_NAME);
|
|
50
|
+
var groupSizeVariant = function(val, param) {
|
|
51
|
+
var { tokens } = param;
|
|
52
|
+
var radiusToken = (0, import_core.resolveSizeToken)(val, "radius");
|
|
53
|
+
var _tokens_radius_radiusToken;
|
|
54
|
+
return { borderRadius: (_tokens_radius_radiusToken = tokens.radius[radiusToken]) !== null && _tokens_radius_radiusToken !== void 0 ? _tokens_radius_radiusToken : radiusToken };
|
|
55
|
+
};
|
|
56
56
|
var GroupFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
size: function (val, param) {
|
|
65
|
-
var {
|
|
66
|
-
tokens
|
|
67
|
-
} = param;
|
|
68
|
-
var _tokens_radius_val, _ref;
|
|
69
|
-
var borderRadius = (_ref = (_tokens_radius_val = tokens.radius[val]) !== null && _tokens_radius_val !== void 0 ? _tokens_radius_val : val) !== null && _ref !== void 0 ? _ref : tokens.radius["$true"];
|
|
70
|
-
return {
|
|
71
|
-
borderRadius
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
defaultVariants: {
|
|
76
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
77
|
-
}
|
|
57
|
+
displayName: "GroupFrame",
|
|
58
|
+
size: true,
|
|
59
|
+
variants: { size: {
|
|
60
|
+
true: groupSizeVariant,
|
|
61
|
+
any: groupSizeVariant
|
|
62
|
+
} }
|
|
78
63
|
});
|
|
79
64
|
function createGroup(verticalDefault) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
flexDirection: vertical ? "column" : "row",
|
|
97
|
-
...restProps,
|
|
98
|
-
children: indexedChildren
|
|
99
|
-
})
|
|
100
|
-
});
|
|
101
|
-
}), {
|
|
102
|
-
Item: GroupItem
|
|
103
|
-
});
|
|
65
|
+
return (0, import_helpers.withStaticProperties)((0, import_core.createStyledHOC)(GroupFrame, function(props, ref) {
|
|
66
|
+
var { __scopeGroup, children: childrenProp, orientation = verticalDefault ? "vertical" : "horizontal", disabled, ...restProps } = props;
|
|
67
|
+
var vertical = orientation === "vertical";
|
|
68
|
+
var indexedChildren = (0, import_useIndexedChildren.useIndexedChildren)(import_react.default.Children.toArray(childrenProp));
|
|
69
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GroupProvider, {
|
|
70
|
+
vertical,
|
|
71
|
+
disabled,
|
|
72
|
+
scope: __scopeGroup,
|
|
73
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GroupFrame, {
|
|
74
|
+
ref,
|
|
75
|
+
flexDirection: vertical ? "column" : "row",
|
|
76
|
+
...restProps,
|
|
77
|
+
children: indexedChildren
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
}), { Item: GroupItem });
|
|
104
81
|
}
|
|
105
82
|
function GroupItem(props) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
var _children_props_disabled;
|
|
129
|
-
groupProps.disabled = (_children_props_disabled = children.props.disabled) !== null && _children_props_disabled !== void 0 ? _children_props_disabled : context.disabled;
|
|
130
|
-
}
|
|
131
|
-
var mergedProps = (0, import_core.mergeSlotStyleProps)(groupProps, children.props);
|
|
132
|
-
return /* @__PURE__ */import_react.default.cloneElement(children, mergedProps);
|
|
83
|
+
var { __scopeGroup, children, forcePlacement, ...forwardedProps } = props;
|
|
84
|
+
var context = useGroupContext("GroupItem", __scopeGroup);
|
|
85
|
+
var treeIndex = (0, import_useIndexedChildren.useIndex)();
|
|
86
|
+
if (!treeIndex) {
|
|
87
|
+
throw Error("<Group.Item/> should only be used within a <Group/>");
|
|
88
|
+
}
|
|
89
|
+
if (!/* @__PURE__ */ import_react.default.isValidElement(children)) {
|
|
90
|
+
return children;
|
|
91
|
+
}
|
|
92
|
+
var isFirst = forcePlacement === "first" || forcePlacement !== "last" && treeIndex.index === 0;
|
|
93
|
+
var isLast = forcePlacement === "last" || forcePlacement !== "first" && treeIndex.index === treeIndex.maxIndex;
|
|
94
|
+
var radiusStyles = getZeroedRadius(isFirst, isLast, context.vertical);
|
|
95
|
+
var groupProps = {
|
|
96
|
+
...forwardedProps,
|
|
97
|
+
...radiusStyles
|
|
98
|
+
};
|
|
99
|
+
if (context.disabled != null) {
|
|
100
|
+
var _children_props_disabled;
|
|
101
|
+
groupProps.disabled = (_children_props_disabled = children.props.disabled) !== null && _children_props_disabled !== void 0 ? _children_props_disabled : context.disabled;
|
|
102
|
+
}
|
|
103
|
+
var mergedProps = (0, import_core.mergeSlotStyleProps)(groupProps, children.props);
|
|
104
|
+
return /* @__PURE__ */ import_react.default.cloneElement(children, mergedProps);
|
|
133
105
|
}
|
|
134
|
-
var useGroupItem = function
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
106
|
+
var useGroupItem = function(childrenProps, forcePlacement, __scopeGroup) {
|
|
107
|
+
var treeIndex = (0, import_useIndexedChildren.useIndex)();
|
|
108
|
+
var context = useGroupContext("GroupItem", __scopeGroup);
|
|
109
|
+
if (!treeIndex) {
|
|
110
|
+
throw Error("useGroupItem should only be used within a <Group/>");
|
|
111
|
+
}
|
|
112
|
+
var isFirst = forcePlacement === "first" || forcePlacement !== "last" && treeIndex.index === 0;
|
|
113
|
+
var isLast = forcePlacement === "last" || forcePlacement !== "first" && treeIndex.index === treeIndex.maxIndex;
|
|
114
|
+
var radiusStyles = getZeroedRadius(isFirst, isLast, context.vertical);
|
|
115
|
+
var _childrenProps_disabled;
|
|
116
|
+
return {
|
|
117
|
+
disabled: (_childrenProps_disabled = childrenProps.disabled) !== null && _childrenProps_disabled !== void 0 ? _childrenProps_disabled : context.disabled,
|
|
118
|
+
...radiusStyles
|
|
119
|
+
};
|
|
148
120
|
};
|
|
149
121
|
var Group = createGroup(true);
|
|
150
122
|
var YGroup = Group;
|
|
151
123
|
var XGroup = createGroup(false);
|
|
152
124
|
function getZeroedRadius(isFirst, isLast, vertical) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
125
|
+
if (vertical) {
|
|
126
|
+
return {
|
|
127
|
+
...isFirst ? null : {
|
|
128
|
+
borderTopLeftRadius: 0,
|
|
129
|
+
borderTopRightRadius: 0
|
|
130
|
+
},
|
|
131
|
+
...isLast ? null : {
|
|
132
|
+
borderBottomLeftRadius: 0,
|
|
133
|
+
borderBottomRightRadius: 0
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
...isFirst ? null : {
|
|
139
|
+
borderTopLeftRadius: 0,
|
|
140
|
+
borderBottomLeftRadius: 0
|
|
141
|
+
},
|
|
142
|
+
...isLast ? null : {
|
|
143
|
+
borderTopRightRadius: 0,
|
|
144
|
+
borderBottomRightRadius: 0
|
|
145
|
+
}
|
|
146
|
+
};
|
|
175
147
|
}
|
|
148
|
+
|
|
176
149
|
//# sourceMappingURL=Group.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","Group_exports","__export","Group","GroupFrame","XGroup","YGroup","createGroupScope","useGroupItem","module","exports","import_jsx_runtime","require","import_core","import_create_context","import_helpers","import_stacks","import_react","__toESM","import_useIndexedChildren","GROUP_NAME","createGroupContext","createContextScope","GroupProvider","useGroupContext","styled","YStack","name","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","mergedProps","mergeSlotStyleProps","cloneElement","childrenProps","_childrenProps_disabled","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],"sources":["../../src/Group.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,KAAA,EAAAA,CAAA,KAAAA,KAAA;EAAAC,UAAA,EAAAA,CAAA,KAAAA,UAAA;EAAAC,MAAA,EAAAA,CAAA,KAAAA,MAAA;EAAAC,MAAA,EAAAA,CAAA,KAAAA,MAAA;EAAAC,gBAAA,EAAAA,CAAA,KAAAA,gBAAA;EAAAC,YAAA,EAAAA,CAAA,KAAAA;AAAA;AACAC,MAAA,CAAAC,OAAA,GAAAd,YAA4C,CAAAK,aAAA;AAE5C,IAAAU,kBAAA,GAAAC,OAAmC;AACnC,IAAAC,WAAA,GAAAD,OAAqC;AACrC,IAAA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
|
|
1
|
+
{"version":3,"file":"Group.native.js","names":[],"sources":["cjs/Group.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Group_exports = {};\n__export(Group_exports, {\n Group: () => Group,\n GroupFrame: () => GroupFrame,\n XGroup: () => XGroup,\n YGroup: () => YGroup,\n createGroupScope: () => createGroupScope,\n useGroupItem: () => useGroupItem\n});\nmodule.exports = __toCommonJS(Group_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_core = require(\"@tamagui/core\");\nvar import_create_context = require(\"@tamagui/create-context\");\nvar import_helpers = require(\"@tamagui/helpers\");\nvar import_stacks = require(\"@tamagui/stacks\");\nvar import_react = __toESM(require(\"react\"), 1);\nvar import_useIndexedChildren = require(\"./useIndexedChildren\");\nvar GROUP_NAME = \"Group\";\nvar [createGroupContext, createGroupScope] = (0, import_create_context.createContextScope)(GROUP_NAME);\nvar [GroupProvider, useGroupContext] = createGroupContext(GROUP_NAME);\nvar groupSizeVariant = function(val, param) {\n var { tokens } = param;\n var radiusToken = (0, import_core.resolveSizeToken)(val, \"radius\");\n var _tokens_radius_radiusToken;\n return {\n borderRadius: (_tokens_radius_radiusToken = tokens.radius[radiusToken]) !== null && _tokens_radius_radiusToken !== void 0 ? _tokens_radius_radiusToken : radiusToken\n };\n};\nvar GroupFrame = (0, import_core.styled)(import_stacks.YStack, {\n displayName: \"GroupFrame\",\n size: true,\n variants: {\n size: {\n true: groupSizeVariant,\n any: groupSizeVariant\n }\n }\n});\nfunction createGroup(verticalDefault) {\n return (0, import_helpers.withStaticProperties)((0, import_core.createStyledHOC)(GroupFrame, function(props, ref) {\n var { __scopeGroup, children: childrenProp, orientation = verticalDefault ? \"vertical\" : \"horizontal\", disabled, ...restProps } = props;\n var vertical = orientation === \"vertical\";\n var indexedChildren = (0, import_useIndexedChildren.useIndexedChildren)(import_react.default.Children.toArray(childrenProp));\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GroupProvider, {\n vertical,\n disabled,\n scope: __scopeGroup,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GroupFrame, {\n ref,\n flexDirection: vertical ? \"column\" : \"row\",\n ...restProps,\n children: indexedChildren\n })\n });\n }), {\n Item: GroupItem\n });\n}\nfunction GroupItem(props) {\n var { __scopeGroup, children, forcePlacement, ...forwardedProps } = props;\n var context = useGroupContext(\"GroupItem\", __scopeGroup);\n var treeIndex = (0, import_useIndexedChildren.useIndex)();\n if (!treeIndex) {\n throw Error(\"<Group.Item/> should only be used within a <Group/>\");\n }\n if (!/* @__PURE__ */ import_react.default.isValidElement(children)) {\n return children;\n }\n var isFirst = forcePlacement === \"first\" || forcePlacement !== \"last\" && treeIndex.index === 0;\n var isLast = forcePlacement === \"last\" || forcePlacement !== \"first\" && treeIndex.index === treeIndex.maxIndex;\n var radiusStyles = getZeroedRadius(isFirst, isLast, context.vertical);\n var groupProps = {\n ...forwardedProps,\n ...radiusStyles\n };\n if (context.disabled != null) {\n var _children_props_disabled;\n groupProps.disabled = (_children_props_disabled = children.props.disabled) !== null && _children_props_disabled !== void 0 ? _children_props_disabled : context.disabled;\n }\n var mergedProps = (0, import_core.mergeSlotStyleProps)(groupProps, children.props);\n return /* @__PURE__ */ import_react.default.cloneElement(children, mergedProps);\n}\nvar useGroupItem = function(childrenProps, forcePlacement, __scopeGroup) {\n var treeIndex = (0, import_useIndexedChildren.useIndex)();\n var context = useGroupContext(\"GroupItem\", __scopeGroup);\n if (!treeIndex) {\n throw Error(\"useGroupItem should only be used within a <Group/>\");\n }\n var isFirst = forcePlacement === \"first\" || forcePlacement !== \"last\" && treeIndex.index === 0;\n var isLast = forcePlacement === \"last\" || forcePlacement !== \"first\" && treeIndex.index === treeIndex.maxIndex;\n var radiusStyles = getZeroedRadius(isFirst, isLast, context.vertical);\n var _childrenProps_disabled;\n return {\n disabled: (_childrenProps_disabled = childrenProps.disabled) !== null && _childrenProps_disabled !== void 0 ? _childrenProps_disabled : context.disabled,\n ...radiusStyles\n };\n};\nvar Group = createGroup(true);\nvar YGroup = Group;\nvar XGroup = createGroup(false);\nfunction getZeroedRadius(isFirst, isLast, vertical) {\n if (vertical) {\n return {\n ...isFirst ? null : {\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0\n },\n ...isLast ? null : {\n borderBottomLeftRadius: 0,\n borderBottomRightRadius: 0\n }\n };\n }\n return {\n ...isFirst ? null : {\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0\n },\n ...isLast ? null : {\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0\n }\n };\n}\n//# sourceMappingURL=Group.js.map\n"],"mappings":";;;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAA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AO;IACjB,wBAAwB;IACxB,yBAAyB;GAC3B;EACF;CACF;CACA,OAAO;EACL,GAAG,UAAU,OAAO;GAClB,qBAAqB;GACrB,wBAAwB;EAC1B;EACA,GAAG,SAAS,OAAO;GACjB,sBAAsB;GACtB,yBAAyB;EAC3B;CACF;AACF"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
+
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
6
|
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
9
|
+
get: () => from[key],
|
|
10
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return to;
|
|
13
14
|
};
|
|
14
15
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
16
|
-
value: true
|
|
17
|
-
}), mod);
|
|
16
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
17
|
var index_exports = {};
|
|
19
18
|
module.exports = __toCommonJS(index_exports);
|
|
20
|
-
__reExport(index_exports, require("./Group.cjs"), module.exports);
|
|
19
|
+
__reExport(index_exports, require("./Group.cjs"), module.exports);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
11
|
+
get: () => from[key],
|
|
12
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var index_exports = {};
|
|
20
|
+
module.exports = __toCommonJS(index_exports);
|
|
21
|
+
__reExport(index_exports, require("./Group.native.js"), module.exports);
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
8
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
11
|
+
get: () => from[key],
|
|
12
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
15
16
|
};
|
|
16
17
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
17
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
18
|
-
value: true
|
|
19
|
-
}), mod);
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
19
|
var index_exports = {};
|
|
21
20
|
module.exports = __toCommonJS(index_exports);
|
|
22
21
|
__reExport(index_exports, require("./Group.native.js"), module.exports);
|
|
22
|
+
|
|
23
23
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.native.js","names":[],"sources":["cjs/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\nmodule.exports = __toCommonJS(index_exports);\n__reExport(index_exports, require(\"./Group\"), module.exports);\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,cAAc,QAAQ,KAAK,kBAAkB,YAAY,QAAQ,KAAK,SAAS,GAAG,gBAAgB,YAAY,cAAc,KAAK,SAAS;AAC9I,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,OAAO,UAAU,aAAa,aAAa;AAC3C,WAAW,eAAe,QAAQ,mBAAS,GAAG,OAAO,OAAO"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -5,36 +6,29 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
5
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
8
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
12
13
|
};
|
|
13
14
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: () => from[key],
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
21
22
|
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
|
|
24
|
-
|
|
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", {
|
|
28
|
-
value: mod,
|
|
29
|
-
enumerable: true
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
30
26
|
}) : target, mod));
|
|
31
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
-
value: true
|
|
33
|
-
}), mod);
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
34
28
|
var useIndexedChildren_exports = {};
|
|
35
29
|
__export(useIndexedChildren_exports, {
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
useIndex: () => useIndex,
|
|
31
|
+
useIndexedChildren: () => useIndexedChildren
|
|
38
32
|
});
|
|
39
33
|
module.exports = __toCommonJS(useIndexedChildren_exports);
|
|
40
34
|
var React = __toESM(require("react"), 1);
|
|
@@ -42,41 +36,41 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
42
36
|
const MaxIndexContext = React.createContext([]);
|
|
43
37
|
const IndexContext = React.createContext(null);
|
|
44
38
|
function useIndex() {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
39
|
+
const maxIndexPath = React.useContext(MaxIndexContext);
|
|
40
|
+
const indexPathString = React.useContext(IndexContext);
|
|
41
|
+
return React.useMemo(() => {
|
|
42
|
+
if (indexPathString === null) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
const indexPath = parseIndexPath(indexPathString);
|
|
46
|
+
const maxIndex = maxIndexPath[maxIndexPath.length - 1];
|
|
47
|
+
const index = indexPath[indexPath.length - 1];
|
|
48
|
+
return {
|
|
49
|
+
maxIndex,
|
|
50
|
+
maxIndexPath,
|
|
51
|
+
index,
|
|
52
|
+
indexPath,
|
|
53
|
+
indexPathString,
|
|
54
|
+
isFirst: index === 0,
|
|
55
|
+
isLast: index === maxIndex,
|
|
56
|
+
isEven: index % 2 === 0,
|
|
57
|
+
isOdd: Math.abs(index % 2) === 1
|
|
58
|
+
};
|
|
59
|
+
}, [maxIndexPath, indexPathString]);
|
|
66
60
|
}
|
|
67
61
|
function useIndexedChildren(children) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
62
|
+
const parentMaxIndexPath = React.useContext(MaxIndexContext);
|
|
63
|
+
const indexPathString = React.useContext(IndexContext);
|
|
64
|
+
const childrenCount = React.Children.count(children);
|
|
65
|
+
const maxIndexPath = React.useMemo(() => parentMaxIndexPath.concat(childrenCount - 1), [childrenCount]);
|
|
66
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MaxIndexContext.Provider, {
|
|
67
|
+
value: maxIndexPath,
|
|
68
|
+
children: React.Children.map(children, (child, index) => React.isValidElement(child) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IndexContext.Provider, {
|
|
69
|
+
value: indexPathString ? `${indexPathString}.${index.toString()}` : index.toString(),
|
|
70
|
+
children: child
|
|
71
|
+
}, child.key) : child)
|
|
72
|
+
});
|
|
79
73
|
}
|
|
80
74
|
function parseIndexPath(indexPathString) {
|
|
81
|
-
|
|
82
|
-
}
|
|
75
|
+
return indexPathString.split(".").map((index) => Number.parseInt(index, 10));
|
|
76
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all) __defProp(target, name, {
|
|
12
|
+
get: all[name],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
19
|
+
get: () => from[key],
|
|
20
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: true
|
|
28
|
+
}) : target, mod));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var useIndexedChildren_exports = {};
|
|
31
|
+
__export(useIndexedChildren_exports, {
|
|
32
|
+
useIndex: () => useIndex,
|
|
33
|
+
useIndexedChildren: () => useIndexedChildren
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(useIndexedChildren_exports);
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var React = __toESM(require("react"), 1);
|
|
38
|
+
var MaxIndexContext = /* @__PURE__ */ React.createContext([]);
|
|
39
|
+
var IndexContext = /* @__PURE__ */ React.createContext(null);
|
|
40
|
+
function useIndex() {
|
|
41
|
+
var maxIndexPath = React.useContext(MaxIndexContext);
|
|
42
|
+
var indexPathString = React.useContext(IndexContext);
|
|
43
|
+
return React.useMemo(function() {
|
|
44
|
+
if (indexPathString === null) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
var indexPath = parseIndexPath(indexPathString);
|
|
48
|
+
var maxIndex = maxIndexPath[maxIndexPath.length - 1];
|
|
49
|
+
var index = indexPath[indexPath.length - 1];
|
|
50
|
+
return {
|
|
51
|
+
maxIndex,
|
|
52
|
+
maxIndexPath,
|
|
53
|
+
index,
|
|
54
|
+
indexPath,
|
|
55
|
+
indexPathString,
|
|
56
|
+
isFirst: index === 0,
|
|
57
|
+
isLast: index === maxIndex,
|
|
58
|
+
isEven: index % 2 === 0,
|
|
59
|
+
isOdd: Math.abs(index % 2) === 1
|
|
60
|
+
};
|
|
61
|
+
}, [maxIndexPath, indexPathString]);
|
|
62
|
+
}
|
|
63
|
+
function useIndexedChildren(children) {
|
|
64
|
+
var parentMaxIndexPath = React.useContext(MaxIndexContext);
|
|
65
|
+
var indexPathString = React.useContext(IndexContext);
|
|
66
|
+
var childrenCount = React.Children.count(children);
|
|
67
|
+
var maxIndexPath = React.useMemo(function() {
|
|
68
|
+
return parentMaxIndexPath.concat(childrenCount - 1);
|
|
69
|
+
}, [childrenCount]);
|
|
70
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MaxIndexContext.Provider, {
|
|
71
|
+
value: maxIndexPath,
|
|
72
|
+
children: React.Children.map(children, function(child, index) {
|
|
73
|
+
return /* @__PURE__ */ React.isValidElement(child) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IndexContext.Provider, {
|
|
74
|
+
value: indexPathString ? `${indexPathString}.${index.toString()}` : index.toString(),
|
|
75
|
+
children: child
|
|
76
|
+
}, child.key) : child;
|
|
77
|
+
})
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function parseIndexPath(indexPathString) {
|
|
81
|
+
return indexPathString.split(".").map(function(index) {
|
|
82
|
+
return Number.parseInt(index, 10);
|
|
83
|
+
});
|
|
84
|
+
}
|