@tamagui/group 2.7.7 → 3.0.0-beta.1091.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.
Files changed (49) hide show
  1. package/dist/cjs/Group.cjs +99 -132
  2. package/dist/cjs/Group.native.cjs +140 -0
  3. package/dist/cjs/Group.native.js +102 -136
  4. package/dist/cjs/Group.native.js.map +1 -1
  5. package/dist/cjs/index.cjs +9 -11
  6. package/dist/cjs/index.native.cjs +20 -0
  7. package/dist/cjs/index.native.js +9 -10
  8. package/dist/cjs/index.native.js.map +1 -1
  9. package/dist/cjs/useIndexedChildren.cjs +51 -58
  10. package/dist/cjs/useIndexedChildren.native.cjs +83 -0
  11. package/dist/cjs/useIndexedChildren.native.js +59 -65
  12. package/dist/cjs/useIndexedChildren.native.js.map +1 -1
  13. package/dist/esm/Group.mjs +80 -104
  14. package/dist/esm/Group.mjs.map +1 -1
  15. package/dist/esm/Group.native.js +84 -110
  16. package/dist/esm/Group.native.js.map +1 -1
  17. package/dist/esm/index.js +1 -2
  18. package/dist/esm/index.mjs +1 -2
  19. package/dist/esm/index.native.js +1 -2
  20. package/dist/esm/useIndexedChildren.mjs +35 -33
  21. package/dist/esm/useIndexedChildren.mjs.map +1 -1
  22. package/dist/esm/useIndexedChildren.native.js +44 -42
  23. package/dist/esm/useIndexedChildren.native.js.map +1 -1
  24. package/dist/jsx/Group.mjs +80 -104
  25. package/dist/jsx/Group.mjs.map +1 -1
  26. package/dist/jsx/Group.native.cjs +140 -0
  27. package/dist/jsx/Group.native.js +102 -136
  28. package/dist/jsx/Group.native.js.map +1 -1
  29. package/dist/jsx/index.js +1 -2
  30. package/dist/jsx/index.mjs +1 -2
  31. package/dist/jsx/index.native.cjs +20 -0
  32. package/dist/jsx/index.native.js +9 -10
  33. package/dist/jsx/index.native.js.map +1 -1
  34. package/dist/jsx/useIndexedChildren.mjs +35 -33
  35. package/dist/jsx/useIndexedChildren.mjs.map +1 -1
  36. package/dist/jsx/useIndexedChildren.native.cjs +83 -0
  37. package/dist/jsx/useIndexedChildren.native.js +59 -65
  38. package/dist/jsx/useIndexedChildren.native.js.map +1 -1
  39. package/package.json +11 -10
  40. package/src/Group.tsx +11 -19
  41. package/types/Group.d.ts +107 -78
  42. package/types/Group.d.ts.map +1 -1
  43. package/types/useIndexedChildren.d.ts +1 -1
  44. package/types/useIndexedChildren.d.ts.map +1 -1
  45. package/dist/esm/index.js.map +0 -1
  46. package/dist/esm/index.mjs.map +0 -1
  47. package/dist/esm/index.native.js.map +0 -1
  48. package/dist/jsx/index.js.map +0 -1
  49. package/dist/jsx/index.mjs.map +0 -1
@@ -7,40 +7,33 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
14
  };
15
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, {
18
- get: () => from[key],
19
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
- });
21
- }
22
- return to;
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, {
18
+ get: () => from[key],
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
+ });
21
+ }
22
+ return to;
23
23
  };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
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
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
25
+ value: mod,
26
+ enumerable: true
32
27
  }) : target, mod));
33
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
- value: true
35
- }), mod);
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
29
  var Group_exports = {};
37
30
  __export(Group_exports, {
38
- Group: () => Group,
39
- GroupFrame: () => GroupFrame,
40
- XGroup: () => XGroup,
41
- YGroup: () => YGroup,
42
- createGroupScope: () => createGroupScope,
43
- useGroupItem: () => useGroupItem
31
+ Group: () => Group,
32
+ GroupFrame: () => GroupFrame,
33
+ XGroup: () => XGroup,
34
+ YGroup: () => YGroup,
35
+ createGroupScope: () => createGroupScope,
36
+ useGroupItem: () => useGroupItem
44
37
  });
45
38
  module.exports = __toCommonJS(Group_exports);
46
39
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -53,124 +46,97 @@ var import_useIndexedChildren = require("./useIndexedChildren.native.js");
53
46
  var GROUP_NAME = "Group";
54
47
  var [createGroupContext, createGroupScope] = (0, import_create_context.createContextScope)(GROUP_NAME);
55
48
  var [GroupProvider, useGroupContext] = createGroupContext(GROUP_NAME);
49
+ var groupSizeVariant = import_core.styled.dynamic(function(val, env) {
50
+ return { borderRadius: (0, import_core.resolveSize)(val, env).frame.borderRadius };
51
+ });
56
52
  var GroupFrame = (0, import_core.styled)(import_stacks.YStack, {
57
- name: "GroupFrame",
58
- variants: {
59
- unstyled: {
60
- false: {
61
- size: "$true"
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
- }
53
+ displayName: "GroupFrame",
54
+ size: true,
55
+ variants: { size: groupSizeVariant }
78
56
  });
79
57
  function createGroup(verticalDefault) {
80
- return (0, import_helpers.withStaticProperties)(GroupFrame.styleable(function (props, ref) {
81
- var {
82
- __scopeGroup,
83
- children: childrenProp,
84
- orientation = verticalDefault ? "vertical" : "horizontal",
85
- disabled,
86
- ...restProps
87
- } = props;
88
- var vertical = orientation === "vertical";
89
- var indexedChildren = (0, import_useIndexedChildren.useIndexedChildren)(import_react.default.Children.toArray(childrenProp));
90
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(GroupProvider, {
91
- vertical,
92
- disabled,
93
- scope: __scopeGroup,
94
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(GroupFrame, {
95
- ref,
96
- flexDirection: vertical ? "column" : "row",
97
- ...restProps,
98
- children: indexedChildren
99
- })
100
- });
101
- }), {
102
- Item: GroupItem
103
- });
58
+ return (0, import_helpers.withStaticProperties)((0, import_core.createStyledHOC)(GroupFrame, function(props, ref) {
59
+ var { __scopeGroup, children: childrenProp, orientation = verticalDefault ? "vertical" : "horizontal", disabled, ...restProps } = props;
60
+ var vertical = orientation === "vertical";
61
+ var indexedChildren = (0, import_useIndexedChildren.useIndexedChildren)(import_react.default.Children.toArray(childrenProp));
62
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GroupProvider, {
63
+ vertical,
64
+ disabled,
65
+ scope: __scopeGroup,
66
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GroupFrame, {
67
+ ref,
68
+ flexDirection: vertical ? "column" : "row",
69
+ ...restProps,
70
+ children: indexedChildren
71
+ })
72
+ });
73
+ }), { Item: GroupItem });
104
74
  }
105
75
  function GroupItem(props) {
106
- var {
107
- __scopeGroup,
108
- children,
109
- forcePlacement,
110
- ...forwardedProps
111
- } = props;
112
- var context = useGroupContext("GroupItem", __scopeGroup);
113
- var treeIndex = (0, import_useIndexedChildren.useIndex)();
114
- if (!treeIndex) {
115
- throw Error("<Group.Item/> should only be used within a <Group/>");
116
- }
117
- if (! /* @__PURE__ */import_react.default.isValidElement(children)) {
118
- return children;
119
- }
120
- var isFirst = forcePlacement === "first" || forcePlacement !== "last" && treeIndex.index === 0;
121
- var isLast = forcePlacement === "last" || forcePlacement !== "first" && treeIndex.index === treeIndex.maxIndex;
122
- var radiusStyles = getZeroedRadius(isFirst, isLast, context.vertical);
123
- var groupProps = {
124
- ...forwardedProps,
125
- ...radiusStyles
126
- };
127
- if (context.disabled != null) {
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);
76
+ var { __scopeGroup, children, forcePlacement, ...forwardedProps } = props;
77
+ var context = useGroupContext("GroupItem", __scopeGroup);
78
+ var treeIndex = (0, import_useIndexedChildren.useIndex)();
79
+ if (!treeIndex) {
80
+ throw Error("<Group.Item/> should only be used within a <Group/>");
81
+ }
82
+ if (!/* @__PURE__ */ import_react.default.isValidElement(children)) {
83
+ return children;
84
+ }
85
+ var isFirst = forcePlacement === "first" || forcePlacement !== "last" && treeIndex.index === 0;
86
+ var isLast = forcePlacement === "last" || forcePlacement !== "first" && treeIndex.index === treeIndex.maxIndex;
87
+ var radiusStyles = getZeroedRadius(isFirst, isLast, context.vertical);
88
+ var groupProps = {
89
+ ...forwardedProps,
90
+ ...radiusStyles
91
+ };
92
+ if (context.disabled != null) {
93
+ var _children_props_disabled;
94
+ groupProps.disabled = (_children_props_disabled = children.props.disabled) !== null && _children_props_disabled !== void 0 ? _children_props_disabled : context.disabled;
95
+ }
96
+ var mergedProps = (0, import_core.mergeSlotStyleProps)(groupProps, children.props);
97
+ return /* @__PURE__ */ import_react.default.cloneElement(children, mergedProps);
133
98
  }
134
- var useGroupItem = function (childrenProps, forcePlacement, __scopeGroup) {
135
- var treeIndex = (0, import_useIndexedChildren.useIndex)();
136
- var context = useGroupContext("GroupItem", __scopeGroup);
137
- if (!treeIndex) {
138
- throw Error("useGroupItem should only be used within a <Group/>");
139
- }
140
- var isFirst = forcePlacement === "first" || forcePlacement !== "last" && treeIndex.index === 0;
141
- var isLast = forcePlacement === "last" || forcePlacement !== "first" && treeIndex.index === treeIndex.maxIndex;
142
- var radiusStyles = getZeroedRadius(isFirst, isLast, context.vertical);
143
- var _childrenProps_disabled;
144
- return {
145
- disabled: (_childrenProps_disabled = childrenProps.disabled) !== null && _childrenProps_disabled !== void 0 ? _childrenProps_disabled : context.disabled,
146
- ...radiusStyles
147
- };
99
+ var useGroupItem = function(childrenProps, forcePlacement, __scopeGroup) {
100
+ var treeIndex = (0, import_useIndexedChildren.useIndex)();
101
+ var context = useGroupContext("GroupItem", __scopeGroup);
102
+ if (!treeIndex) {
103
+ throw Error("useGroupItem should only be used within a <Group/>");
104
+ }
105
+ var isFirst = forcePlacement === "first" || forcePlacement !== "last" && treeIndex.index === 0;
106
+ var isLast = forcePlacement === "last" || forcePlacement !== "first" && treeIndex.index === treeIndex.maxIndex;
107
+ var radiusStyles = getZeroedRadius(isFirst, isLast, context.vertical);
108
+ var _childrenProps_disabled;
109
+ return {
110
+ disabled: (_childrenProps_disabled = childrenProps.disabled) !== null && _childrenProps_disabled !== void 0 ? _childrenProps_disabled : context.disabled,
111
+ ...radiusStyles
112
+ };
148
113
  };
149
114
  var Group = createGroup(true);
150
115
  var YGroup = Group;
151
116
  var XGroup = createGroup(false);
152
117
  function getZeroedRadius(isFirst, isLast, vertical) {
153
- if (vertical) {
154
- return {
155
- ...(isFirst ? null : {
156
- borderTopLeftRadius: 0,
157
- borderTopRightRadius: 0
158
- }),
159
- ...(isLast ? null : {
160
- borderBottomLeftRadius: 0,
161
- borderBottomRightRadius: 0
162
- })
163
- };
164
- }
165
- return {
166
- ...(isFirst ? null : {
167
- borderTopLeftRadius: 0,
168
- borderBottomLeftRadius: 0
169
- }),
170
- ...(isLast ? null : {
171
- borderTopRightRadius: 0,
172
- borderBottomRightRadius: 0
173
- })
174
- };
118
+ if (vertical) {
119
+ return {
120
+ ...isFirst ? null : {
121
+ borderTopLeftRadius: 0,
122
+ borderTopRightRadius: 0
123
+ },
124
+ ...isLast ? null : {
125
+ borderBottomLeftRadius: 0,
126
+ borderBottomRightRadius: 0
127
+ }
128
+ };
129
+ }
130
+ return {
131
+ ...isFirst ? null : {
132
+ borderTopLeftRadius: 0,
133
+ borderBottomLeftRadius: 0
134
+ },
135
+ ...isLast ? null : {
136
+ borderTopRightRadius: 0,
137
+ borderBottomRightRadius: 0
138
+ }
139
+ };
175
140
  }
141
+
176
142
  //# 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","border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L,SAAA,CAAAO,QAAA;EAClE,IAAAC,YAAA,GAAAC,eAAA,CAAAL,OAAA,EAAAE,MAAA,EAAAP,OAAA,CAAAb,QAAA;EAEA,IAAA8B,uBACE;EACF,OAAM;IAINhC,QAAM,GAAAgC,uBAAe,GAAgBD,aAAS,CAAA/B,QAAQ,MAAQ,IAAQ,IAAAgC,uBAAA,cAAAA,uBAAA,GAAAjB,OAAA,CAAAf,QAAA;IAEtE,GAAAwB;EAAO;AACuC;AACzC,IACL1E,KAAA,GAAAwC,WAAA;AACF,IAAArC,MAAA,GAAAH,KAAA;AAEO,IAAAE,MAAM,GAAAsC,WAAQ,MAAgB;AAC9B,SAAMmC,eAASA,CAAAL,OAAA,EAAAE,MAAA,EAAApB,QAAA;EACf,IAAMA,QAAA,EAAS;IAMtB,OAAS;MACH,IAAAkB,OAAU;QAEZa,mBAAO;QACLC,oBAAuB;MACvB;MACF,IAAAZ,MAAA;QACFa,sBAAA;QAEAC,uBAAO;MACL,CAAI;IACJ;EACF;EACF","ignoreList":[]}
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 = import_core.styled.dynamic(function(val, env) {\n return {\n borderRadius: (0, import_core.resolveSize)(val, env).frame.borderRadius\n };\n});\nvar GroupFrame = (0, import_core.styled)(import_stacks.YStack, {\n displayName: \"GroupFrame\",\n size: true,\n variants: {\n size: groupSizeVariant\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,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,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,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKnG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CAAE,OAAO;CAAK,YAAY;AAAK,CAAC,IAAI,QACzG,GACF;AACA,IAAI,gBAAgB,QAAQ,YAAY,UA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,mBAAmB,UAAU,mBAAmB,WAAW,UAAU,UAAU,UAAU;CACtG,IAAI,eAAe,gBAAgB,SAAS,QAAQ,QAAQ,QAAQ;CACpE,IAAI;CACJ,OAAO;EACL,WAAW,0BAA0B,cAAc,cAAc,QAAQ,4BAA4B,KAAK,IAAI,0BAA0B,QAAQ;EAChJ,GAAG;CACL;AACF;AACA,IAAI,QAAQ,YAAY,IAAI;AAC5B,IAAI,SAAS;AACb,IAAI,SAAS,YAAY,KAAK;AAC9B,SAAS,gBAAgB,SAAS,QAAQ,UAAU;CAClD,IAAI,UAAU;EACZ,OAAO;GACL,GAAG,UAAU,OAAO;IAClB,qBAAqB;IACrB,sBAAsB;GACxB;GACA,GAAG,SAAS,OAAO;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"}
@@ -3,18 +3,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
- get: () => from[key],
9
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
- });
11
- }
12
- return to;
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
+ get: () => from[key],
9
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
+ });
11
+ }
12
+ return to;
13
13
  };
14
14
  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);
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
16
  var index_exports = {};
19
17
  module.exports = __toCommonJS(index_exports);
20
- __reExport(index_exports, require("./Group.cjs"), module.exports);
18
+ __reExport(index_exports, require("./Group.cjs"), module.exports);
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __copyProps = (to, from, except, desc) => {
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, {
10
+ get: () => from[key],
11
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
+ });
13
+ }
14
+ return to;
15
+ };
16
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var index_exports = {};
19
+ module.exports = __toCommonJS(index_exports);
20
+ __reExport(index_exports, require("./Group.native.js"), module.exports);
@@ -5,19 +5,18 @@ 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
- 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, {
10
- get: () => from[key],
11
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
- });
13
- }
14
- return to;
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, {
10
+ get: () => from[key],
11
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
+ });
13
+ }
14
+ return to;
15
15
  };
16
16
  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);
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
18
  var index_exports = {};
21
19
  module.exports = __toCommonJS(index_exports);
22
20
  __reExport(index_exports, require("./Group.native.js"), module.exports);
21
+
23
22
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA","ignoreList":[]}
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"}
@@ -5,36 +5,29 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
12
  };
13
13
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
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", {
28
- value: mod,
29
- enumerable: true
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
30
25
  }) : target, mod));
31
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: true
33
- }), mod);
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
27
  var useIndexedChildren_exports = {};
35
28
  __export(useIndexedChildren_exports, {
36
- useIndex: () => useIndex,
37
- useIndexedChildren: () => useIndexedChildren
29
+ useIndex: () => useIndex,
30
+ useIndexedChildren: () => useIndexedChildren
38
31
  });
39
32
  module.exports = __toCommonJS(useIndexedChildren_exports);
40
33
  var React = __toESM(require("react"), 1);
@@ -42,41 +35,41 @@ var import_jsx_runtime = require("react/jsx-runtime");
42
35
  const MaxIndexContext = React.createContext([]);
43
36
  const IndexContext = React.createContext(null);
44
37
  function useIndex() {
45
- const maxIndexPath = React.useContext(MaxIndexContext);
46
- const indexPathString = React.useContext(IndexContext);
47
- return React.useMemo(() => {
48
- if (indexPathString === null) {
49
- return null;
50
- }
51
- const indexPath = parseIndexPath(indexPathString);
52
- const maxIndex = maxIndexPath[maxIndexPath.length - 1];
53
- const index = indexPath[indexPath.length - 1];
54
- return {
55
- maxIndex,
56
- maxIndexPath,
57
- index,
58
- indexPath,
59
- indexPathString,
60
- isFirst: index === 0,
61
- isLast: index === maxIndex,
62
- isEven: index % 2 === 0,
63
- isOdd: Math.abs(index % 2) === 1
64
- };
65
- }, [maxIndexPath, indexPathString]);
38
+ const maxIndexPath = React.useContext(MaxIndexContext);
39
+ const indexPathString = React.useContext(IndexContext);
40
+ return React.useMemo(() => {
41
+ if (indexPathString === null) {
42
+ return null;
43
+ }
44
+ const indexPath = parseIndexPath(indexPathString);
45
+ const maxIndex = maxIndexPath[maxIndexPath.length - 1];
46
+ const index = indexPath[indexPath.length - 1];
47
+ return {
48
+ maxIndex,
49
+ maxIndexPath,
50
+ index,
51
+ indexPath,
52
+ indexPathString,
53
+ isFirst: index === 0,
54
+ isLast: index === maxIndex,
55
+ isEven: index % 2 === 0,
56
+ isOdd: Math.abs(index % 2) === 1
57
+ };
58
+ }, [maxIndexPath, indexPathString]);
66
59
  }
67
60
  function useIndexedChildren(children) {
68
- const parentMaxIndexPath = React.useContext(MaxIndexContext);
69
- const indexPathString = React.useContext(IndexContext);
70
- const childrenCount = React.Children.count(children);
71
- const maxIndexPath = React.useMemo(() => parentMaxIndexPath.concat(childrenCount - 1), [childrenCount]);
72
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(MaxIndexContext.Provider, {
73
- value: maxIndexPath,
74
- children: React.Children.map(children, (child, index) => React.isValidElement(child) ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(IndexContext.Provider, {
75
- value: indexPathString ? `${indexPathString}.${index.toString()}` : index.toString(),
76
- children: child
77
- }, child.key) : child)
78
- });
61
+ const parentMaxIndexPath = React.useContext(MaxIndexContext);
62
+ const indexPathString = React.useContext(IndexContext);
63
+ const childrenCount = React.Children.count(children);
64
+ const maxIndexPath = React.useMemo(() => parentMaxIndexPath.concat(childrenCount - 1), [childrenCount]);
65
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MaxIndexContext.Provider, {
66
+ value: maxIndexPath,
67
+ children: React.Children.map(children, (child, index) => React.isValidElement(child) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IndexContext.Provider, {
68
+ value: indexPathString ? `${indexPathString}.${index.toString()}` : index.toString(),
69
+ children: child
70
+ }, child.key) : child)
71
+ });
79
72
  }
80
73
  function parseIndexPath(indexPathString) {
81
- return indexPathString.split(".").map(index => Number.parseInt(index, 10));
82
- }
74
+ return indexPathString.split(".").map((index) => Number.parseInt(index, 10));
75
+ }