react-children-hooks 0.2.0 → 0.3.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/README.md +21 -13
- package/dist/index.cjs +131 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +107 -55
- package/dist/index.d.ts +107 -55
- package/dist/index.js +118 -46
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,28 +6,36 @@
|
|
|
6
6
|
|
|
7
7
|
### Query Hooks
|
|
8
8
|
|
|
9
|
-
- [`useChildByType`](./docs/
|
|
10
|
-
- [`
|
|
11
|
-
- [`useChildrenByType`](./docs/
|
|
12
|
-
- [`
|
|
9
|
+
- [`useChildByType`](./docs/useChildByType.md)
|
|
10
|
+
- [`useChildMatching`](./docs/useChildMatching.md)
|
|
11
|
+
- [`useChildrenByType`](./docs/useChildrenByType.md)
|
|
12
|
+
- [`useChildrenMatching`](./docs/useChildrenMatching.md)
|
|
13
13
|
|
|
14
14
|
### Validation + Query Hooks
|
|
15
15
|
|
|
16
|
-
- [`
|
|
17
|
-
- [`
|
|
18
|
-
- [`
|
|
19
|
-
- [`
|
|
16
|
+
- [`useBoundedChildrenByType`](./docs/useBoundedChildrenByType.md)
|
|
17
|
+
- [`useBoundedChildrenMatching`](./docs/useBoundedChildrenMatching.md)
|
|
18
|
+
- [`useExactChildrenByType`](./docs/useExactChildrenByType.md)
|
|
19
|
+
- [`useExactChildrenMatching`](./docs/useExactChildrenMatching.md)
|
|
20
|
+
- [`useMaximumChildrenByType`](./docs/useMaximumChildrenByType.md)
|
|
21
|
+
- [`useMaximumChildrenMatching`](./docs/useMaximumChildrenMatching.md)
|
|
22
|
+
- [`useMinimumChildrenByType`](./docs/useMinimumChildrenByType.md)
|
|
23
|
+
- [`useMinimumChildrenMatching`](./docs/useMinimumChildrenMatching.md)
|
|
24
|
+
- [`useRequiredChildByType`](./docs/useRequiredChildByType.md)
|
|
25
|
+
- [`useRequiredChildMatching`](./docs/useRequiredChildMatching.md)
|
|
20
26
|
|
|
21
27
|
### Validation Hooks
|
|
22
28
|
|
|
23
|
-
- [`
|
|
29
|
+
- [`useHasChildMatching`](./docs/useHasChildMatching.md)
|
|
24
30
|
|
|
25
31
|
### Utilities
|
|
26
32
|
|
|
27
|
-
- [`childrenToElements`](./docs/
|
|
28
|
-
- [`isElementOfType`](./docs/
|
|
29
|
-
- [`isReactElement`](./docs/
|
|
33
|
+
- [`childrenToElements`](./docs/childrenToElements.md)
|
|
34
|
+
- [`isElementOfType`](./docs/isElementOfType.md)
|
|
35
|
+
- [`isReactElement`](./docs/isReactElement.md)
|
|
30
36
|
|
|
31
37
|
### Types
|
|
32
38
|
|
|
33
|
-
-
|
|
39
|
+
- `ChildrenCountBounds`
|
|
40
|
+
- `ElementOfType`
|
|
41
|
+
- `ValidationOptions`
|
package/dist/index.cjs
CHANGED
|
@@ -23,15 +23,21 @@ __export(index_exports, {
|
|
|
23
23
|
childrenToElements: () => childrenToElements,
|
|
24
24
|
isElementOfType: () => isElementOfType,
|
|
25
25
|
isReactElement: () => isReactElement,
|
|
26
|
+
useBoundedChildrenByType: () => useBoundedChildrenByType,
|
|
27
|
+
useBoundedChildrenMatching: () => useBoundedChildrenMatching,
|
|
26
28
|
useChildByType: () => useChildByType,
|
|
27
|
-
|
|
29
|
+
useChildMatching: () => useChildMatching,
|
|
28
30
|
useChildrenByType: () => useChildrenByType,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
useChildrenMatching: () => useChildrenMatching,
|
|
32
|
+
useExactChildrenByType: () => useExactChildrenByType,
|
|
33
|
+
useExactChildrenMatching: () => useExactChildrenMatching,
|
|
34
|
+
useHasChildMatching: () => useHasChildMatching,
|
|
35
|
+
useMaximumChildrenByType: () => useMaximumChildrenByType,
|
|
36
|
+
useMaximumChildrenMatching: () => useMaximumChildrenMatching,
|
|
37
|
+
useMinimumChildrenByType: () => useMinimumChildrenByType,
|
|
38
|
+
useMinimumChildrenMatching: () => useMinimumChildrenMatching,
|
|
39
|
+
useRequiredChildByType: () => useRequiredChildByType,
|
|
40
|
+
useRequiredChildMatching: () => useRequiredChildMatching
|
|
35
41
|
});
|
|
36
42
|
module.exports = __toCommonJS(index_exports);
|
|
37
43
|
|
|
@@ -40,7 +46,7 @@ function isElementOfType(element, type) {
|
|
|
40
46
|
return element.type === type;
|
|
41
47
|
}
|
|
42
48
|
|
|
43
|
-
// src/
|
|
49
|
+
// src/useChildMatching.ts
|
|
44
50
|
var import_react3 = require("react");
|
|
45
51
|
|
|
46
52
|
// src/childrenToElements.ts
|
|
@@ -57,8 +63,8 @@ function childrenToElements(children) {
|
|
|
57
63
|
return import_react2.Children.toArray(children).filter(isReactElement);
|
|
58
64
|
}
|
|
59
65
|
|
|
60
|
-
// src/
|
|
61
|
-
function
|
|
66
|
+
// src/useChildMatching.ts
|
|
67
|
+
function useChildMatching(children, predicate) {
|
|
62
68
|
return (0, import_react3.useMemo)(
|
|
63
69
|
() => childrenToElements(children).find(predicate) ?? null,
|
|
64
70
|
[children, predicate]
|
|
@@ -67,50 +73,77 @@ function useChildWhere(children, predicate) {
|
|
|
67
73
|
|
|
68
74
|
// src/useChildByType.ts
|
|
69
75
|
function useChildByType(children, type) {
|
|
70
|
-
return
|
|
76
|
+
return useChildMatching(
|
|
71
77
|
children,
|
|
72
78
|
(element) => isElementOfType(element, type)
|
|
73
79
|
);
|
|
74
80
|
}
|
|
75
81
|
|
|
76
|
-
// src/
|
|
82
|
+
// src/reporter.ts
|
|
83
|
+
var import_runtime_reporter = require("runtime-reporter");
|
|
84
|
+
var messages = {
|
|
85
|
+
REQUIRED_CHILD_MATCHING_PREDICATE_FAILED: "{{ traceCodePrefix }}Required child validation failed{{ childNameSegment }} because no direct child satisfied the provided predicate.",
|
|
86
|
+
MINIMUM_CHILDREN_MATCHING_PREDICATE_FAILED: "{{ traceCodePrefix }}Minimum children validation failed{{ childNameSegment }} because only {{ actualCount }} direct child{{ actualCountPluralSuffix }} satisfied the provided predicate; expected at least {{ minimumCount }}.",
|
|
87
|
+
MAXIMUM_CHILDREN_MATCHING_PREDICATE_FAILED: "{{ traceCodePrefix }}Maximum children validation failed{{ childNameSegment }} because {{ actualCount }} direct child{{ actualCountPluralSuffix }} satisfied the provided predicate; expected at most {{ maximumCount }}.",
|
|
88
|
+
EXACT_CHILDREN_MATCHING_PREDICATE_FAILED: "{{ traceCodePrefix }}Exact children validation failed{{ childNameSegment }} because {{ actualCount }} direct child{{ actualCountPluralSuffix }} satisfied the provided predicate; expected exactly {{ exactCount }}.",
|
|
89
|
+
BOUNDED_CHILDREN_MATCHING_PREDICATE_FAILED: "{{ traceCodePrefix }}Bounded children validation failed{{ childNameSegment }} because {{ actualCount }} direct child{{ actualCountPluralSuffix }} satisfied the provided predicate; expected between {{ minimumCount }} and {{ maximumCount }} inclusive."
|
|
90
|
+
};
|
|
91
|
+
var reporter = (0, import_runtime_reporter.createReporter)(
|
|
92
|
+
process.env.NODE_ENV === "production" ? {} : messages,
|
|
93
|
+
{ formatMessage: (message) => message }
|
|
94
|
+
);
|
|
95
|
+
var reporter_default = reporter;
|
|
96
|
+
|
|
97
|
+
// src/useChildrenMatching.ts
|
|
77
98
|
var import_react4 = require("react");
|
|
78
|
-
function
|
|
99
|
+
function useChildrenMatching(children, predicate) {
|
|
79
100
|
return (0, import_react4.useMemo)(
|
|
80
101
|
() => childrenToElements(children).filter(predicate),
|
|
81
102
|
[children, predicate]
|
|
82
103
|
);
|
|
83
104
|
}
|
|
84
105
|
|
|
106
|
+
// src/useBoundedChildrenMatching.ts
|
|
107
|
+
function useBoundedChildrenMatching(children, predicate, bounds, options) {
|
|
108
|
+
const matchingChildren = useChildrenMatching(children, predicate);
|
|
109
|
+
if (matchingChildren.length >= bounds.minimum && matchingChildren.length <= bounds.maximum) {
|
|
110
|
+
return matchingChildren;
|
|
111
|
+
}
|
|
112
|
+
return reporter_default.fail("BOUNDED_CHILDREN_MATCHING_PREDICATE_FAILED", {
|
|
113
|
+
traceCodePrefix: options?.traceCode ? `[${options.traceCode}] ` : "",
|
|
114
|
+
childNameSegment: options?.childName ? ` for ${options.childName}` : "",
|
|
115
|
+
actualCount: matchingChildren.length,
|
|
116
|
+
actualCountPluralSuffix: matchingChildren.length === 1 ? "" : "ren",
|
|
117
|
+
minimumCount: bounds.minimum,
|
|
118
|
+
maximumCount: bounds.maximum
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// src/useBoundedChildrenByType.ts
|
|
123
|
+
function useBoundedChildrenByType(children, type, bounds, options) {
|
|
124
|
+
return useBoundedChildrenMatching(
|
|
125
|
+
children,
|
|
126
|
+
(element) => isElementOfType(element, type),
|
|
127
|
+
bounds,
|
|
128
|
+
options
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
85
132
|
// src/useChildrenByType.ts
|
|
86
133
|
function useChildrenByType(children, type) {
|
|
87
|
-
return
|
|
134
|
+
return useChildrenMatching(
|
|
88
135
|
children,
|
|
89
136
|
(element) => isElementOfType(element, type)
|
|
90
137
|
);
|
|
91
138
|
}
|
|
92
139
|
|
|
93
|
-
// src/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
REQUIRED_CHILD_WHERE_PREDICATE_FAILED: "{{ traceCodePrefix }}Required child validation failed{{ childNameSegment }} because no direct child satisfied the provided predicate.",
|
|
97
|
-
MINIMUM_CHILDREN_WHERE_PREDICATE_FAILED: "{{ traceCodePrefix }}Minimum children validation failed{{ childNameSegment }} because only {{ actualCount }} direct child{{ actualCountPluralSuffix }} satisfied the provided predicate; expected at least {{ minimumCount }}.",
|
|
98
|
-
MAXIMUM_CHILDREN_WHERE_PREDICATE_FAILED: "{{ traceCodePrefix }}Maximum children validation failed{{ childNameSegment }} because {{ actualCount }} direct child{{ actualCountPluralSuffix }} satisfied the provided predicate; expected at most {{ maximumCount }}.",
|
|
99
|
-
EXACT_CHILDREN_WHERE_PREDICATE_FAILED: "{{ traceCodePrefix }}Exact children validation failed{{ childNameSegment }} because {{ actualCount }} direct child{{ actualCountPluralSuffix }} satisfied the provided predicate; expected exactly {{ exactCount }}."
|
|
100
|
-
};
|
|
101
|
-
var reporter = (0, import_runtime_reporter.createReporter)(
|
|
102
|
-
process.env.NODE_ENV === "production" ? {} : messages,
|
|
103
|
-
{ formatMessage: (message) => message }
|
|
104
|
-
);
|
|
105
|
-
var reporter_default = reporter;
|
|
106
|
-
|
|
107
|
-
// src/useExactChildrenWhere.ts
|
|
108
|
-
function useExactChildrenWhere(children, predicate, exactCount, options) {
|
|
109
|
-
const matchingChildren = useChildrenWhere(children, predicate);
|
|
140
|
+
// src/useExactChildrenMatching.ts
|
|
141
|
+
function useExactChildrenMatching(children, predicate, exactCount, options) {
|
|
142
|
+
const matchingChildren = useChildrenMatching(children, predicate);
|
|
110
143
|
if (matchingChildren.length === exactCount) {
|
|
111
144
|
return matchingChildren;
|
|
112
145
|
}
|
|
113
|
-
return reporter_default.fail("
|
|
146
|
+
return reporter_default.fail("EXACT_CHILDREN_MATCHING_PREDICATE_FAILED", {
|
|
114
147
|
traceCodePrefix: options?.traceCode ? `[${options.traceCode}] ` : "",
|
|
115
148
|
childNameSegment: options?.childName ? ` for ${options.childName}` : "",
|
|
116
149
|
actualCount: matchingChildren.length,
|
|
@@ -119,22 +152,32 @@ function useExactChildrenWhere(children, predicate, exactCount, options) {
|
|
|
119
152
|
});
|
|
120
153
|
}
|
|
121
154
|
|
|
122
|
-
// src/
|
|
155
|
+
// src/useExactChildrenByType.ts
|
|
156
|
+
function useExactChildrenByType(children, type, exactCount, options) {
|
|
157
|
+
return useExactChildrenMatching(
|
|
158
|
+
children,
|
|
159
|
+
(element) => isElementOfType(element, type),
|
|
160
|
+
exactCount,
|
|
161
|
+
options
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// src/useHasChildMatching.ts
|
|
123
166
|
var import_react5 = require("react");
|
|
124
|
-
function
|
|
167
|
+
function useHasChildMatching(children, predicate) {
|
|
125
168
|
return (0, import_react5.useMemo)(
|
|
126
169
|
() => childrenToElements(children).some(predicate),
|
|
127
170
|
[children, predicate]
|
|
128
171
|
);
|
|
129
172
|
}
|
|
130
173
|
|
|
131
|
-
// src/
|
|
132
|
-
function
|
|
133
|
-
const matchingChildren =
|
|
174
|
+
// src/useMaximumChildrenMatching.ts
|
|
175
|
+
function useMaximumChildrenMatching(children, predicate, maximumCount, options) {
|
|
176
|
+
const matchingChildren = useChildrenMatching(children, predicate);
|
|
134
177
|
if (matchingChildren.length <= maximumCount) {
|
|
135
178
|
return matchingChildren;
|
|
136
179
|
}
|
|
137
|
-
return reporter_default.fail("
|
|
180
|
+
return reporter_default.fail("MAXIMUM_CHILDREN_MATCHING_PREDICATE_FAILED", {
|
|
138
181
|
traceCodePrefix: options?.traceCode ? `[${options.traceCode}] ` : "",
|
|
139
182
|
childNameSegment: options?.childName ? ` for ${options.childName}` : "",
|
|
140
183
|
actualCount: matchingChildren.length,
|
|
@@ -143,13 +186,23 @@ function useMaximumChildrenWhere(children, predicate, maximumCount, options) {
|
|
|
143
186
|
});
|
|
144
187
|
}
|
|
145
188
|
|
|
146
|
-
// src/
|
|
147
|
-
function
|
|
148
|
-
|
|
189
|
+
// src/useMaximumChildrenByType.ts
|
|
190
|
+
function useMaximumChildrenByType(children, type, maximumCount, options) {
|
|
191
|
+
return useMaximumChildrenMatching(
|
|
192
|
+
children,
|
|
193
|
+
(element) => isElementOfType(element, type),
|
|
194
|
+
maximumCount,
|
|
195
|
+
options
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// src/useMinimumChildrenMatching.ts
|
|
200
|
+
function useMinimumChildrenMatching(children, predicate, minimumCount, options) {
|
|
201
|
+
const matchingChildren = useChildrenMatching(children, predicate);
|
|
149
202
|
if (matchingChildren.length >= minimumCount) {
|
|
150
203
|
return matchingChildren;
|
|
151
204
|
}
|
|
152
|
-
return reporter_default.fail("
|
|
205
|
+
return reporter_default.fail("MINIMUM_CHILDREN_MATCHING_PREDICATE_FAILED", {
|
|
153
206
|
traceCodePrefix: options?.traceCode ? `[${options.traceCode}] ` : "",
|
|
154
207
|
childNameSegment: options?.childName ? ` for ${options.childName}` : "",
|
|
155
208
|
actualCount: matchingChildren.length,
|
|
@@ -158,30 +211,55 @@ function useMinimumChildrenWhere(children, predicate, minimumCount, options) {
|
|
|
158
211
|
});
|
|
159
212
|
}
|
|
160
213
|
|
|
161
|
-
// src/
|
|
162
|
-
function
|
|
163
|
-
|
|
214
|
+
// src/useMinimumChildrenByType.ts
|
|
215
|
+
function useMinimumChildrenByType(children, type, minimumCount, options) {
|
|
216
|
+
return useMinimumChildrenMatching(
|
|
217
|
+
children,
|
|
218
|
+
(element) => isElementOfType(element, type),
|
|
219
|
+
minimumCount,
|
|
220
|
+
options
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// src/useRequiredChildMatching.ts
|
|
225
|
+
function useRequiredChildMatching(children, predicate, options) {
|
|
226
|
+
const child = useChildMatching(children, predicate);
|
|
164
227
|
if (child !== null) {
|
|
165
228
|
return child;
|
|
166
229
|
}
|
|
167
|
-
return reporter_default.fail("
|
|
230
|
+
return reporter_default.fail("REQUIRED_CHILD_MATCHING_PREDICATE_FAILED", {
|
|
168
231
|
traceCodePrefix: options?.traceCode ? `[${options.traceCode}] ` : "",
|
|
169
232
|
childNameSegment: options?.childName ? ` for ${options.childName}` : ""
|
|
170
233
|
});
|
|
171
234
|
}
|
|
235
|
+
|
|
236
|
+
// src/useRequiredChildByType.ts
|
|
237
|
+
function useRequiredChildByType(children, type, options) {
|
|
238
|
+
return useRequiredChildMatching(
|
|
239
|
+
children,
|
|
240
|
+
(element) => isElementOfType(element, type),
|
|
241
|
+
options
|
|
242
|
+
);
|
|
243
|
+
}
|
|
172
244
|
// Annotate the CommonJS export names for ESM import in node:
|
|
173
245
|
0 && (module.exports = {
|
|
174
246
|
childrenToElements,
|
|
175
247
|
isElementOfType,
|
|
176
248
|
isReactElement,
|
|
249
|
+
useBoundedChildrenByType,
|
|
250
|
+
useBoundedChildrenMatching,
|
|
177
251
|
useChildByType,
|
|
178
|
-
|
|
252
|
+
useChildMatching,
|
|
179
253
|
useChildrenByType,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
254
|
+
useChildrenMatching,
|
|
255
|
+
useExactChildrenByType,
|
|
256
|
+
useExactChildrenMatching,
|
|
257
|
+
useHasChildMatching,
|
|
258
|
+
useMaximumChildrenByType,
|
|
259
|
+
useMaximumChildrenMatching,
|
|
260
|
+
useMinimumChildrenByType,
|
|
261
|
+
useMinimumChildrenMatching,
|
|
262
|
+
useRequiredChildByType,
|
|
263
|
+
useRequiredChildMatching
|
|
186
264
|
});
|
|
187
265
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/isElementOfType.ts","../src/useChildWhere.ts","../src/childrenToElements.ts","../src/isReactElement.ts","../src/useChildByType.ts","../src/useChildrenWhere.ts","../src/useChildrenByType.ts","../src/reporter.ts","../src/useExactChildrenWhere.ts","../src/useHasChildWhere.ts","../src/useMaximumChildrenWhere.ts","../src/useMinimumChildrenWhere.ts","../src/useRequiredChildWhere.ts"],"sourcesContent":["/**\n * Public package entrypoint.\n *\n * Hooks and child utilities will be exported here as the API is defined.\n */\nexport { useChildByType } from \"./useChildByType\";\nexport { useChildWhere } from \"./useChildWhere\";\nexport { useChildrenByType } from \"./useChildrenByType\";\nexport { useChildrenWhere } from \"./useChildrenWhere\";\nexport { useExactChildrenWhere } from \"./useExactChildrenWhere\";\nexport { useHasChildWhere } from \"./useHasChildWhere\";\nexport { useMaximumChildrenWhere } from \"./useMaximumChildrenWhere\";\nexport { useMinimumChildrenWhere } from \"./useMinimumChildrenWhere\";\nexport { useRequiredChildWhere } from \"./useRequiredChildWhere\";\nexport { childrenToElements } from \"./childrenToElements\";\nexport { isElementOfType } from \"./isElementOfType\";\nexport { isReactElement } from \"./isReactElement\";\nexport type { ElementOfType } from \"./types\";\nexport type { UseExactChildrenWhereOptions } from \"./useExactChildrenWhere\";\nexport type { UseMaximumChildrenWhereOptions } from \"./useMaximumChildrenWhere\";\nexport type { UseMinimumChildrenWhereOptions } from \"./useMinimumChildrenWhere\";\nexport type { UseRequiredChildWhereOptions } from \"./useRequiredChildWhere\";\n","import type { ElementType, ReactElement } from \"react\";\n\nimport type { ElementOfType } from \"./types\";\n\n/**\n * Determines whether a React element exactly matches the provided element or component type.\n *\n * @param element The React element to compare.\n * @param type The element or component type to match.\n * @returns `true` when the element's type exactly matches the provided type; otherwise `false`.\n */\nexport function isElementOfType<T extends ElementType>(\n element: ReactElement,\n type: T\n): element is ElementOfType<T> {\n return element.type === type;\n}\n","import { useMemo, type ReactElement, type ReactNode } from \"react\";\n\nimport { childrenToElements } from \"./childrenToElements\";\n\n/**\n * Returns the first direct child element that satisfies the provided predicate.\n *\n * @param children The React children value to inspect.\n * @param predicate A predicate that is called with each direct child element to determine whether it matches.\n * @returns The first direct child element that satisfies the provided predicate, or `null` when no match is found.\n */\nexport function useChildWhere<T extends ReactElement>(\n children: ReactNode,\n predicate: (element: ReactElement) => element is T\n): T | null;\nexport function useChildWhere(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean\n): ReactElement | null;\nexport function useChildWhere(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean\n): ReactElement | null {\n return useMemo(\n () => childrenToElements(children).find(predicate) ?? null,\n [children, predicate]\n );\n}\n","import { Children, type ReactElement, type ReactNode } from \"react\";\n\nimport { isReactElement } from \"./isReactElement\";\n\n/**\n * Normalizes a React children value into an array containing only valid direct child elements.\n *\n * @param children The React children value to normalize.\n * @returns An array of valid React elements from the provided direct children.\n */\nexport function childrenToElements(children: ReactNode): ReactElement[] {\n return Children.toArray(children).filter(isReactElement);\n}\n","import { isValidElement, type ReactElement, type ReactNode } from \"react\";\n\n/**\n * Determines whether a React node is a valid React element.\n *\n * @param node The React node to check.\n * @returns `true` when the node is a valid React element; otherwise `false`.\n */\nexport function isReactElement(node: ReactNode): node is ReactElement {\n return isValidElement(node);\n}\n","import type { ElementType, ReactNode } from \"react\";\n\nimport { isElementOfType } from \"./isElementOfType\";\nimport { useChildWhere } from \"./useChildWhere\";\nimport type { ElementOfType } from \"./types\";\n\n/**\n * Returns the first direct child element whose React element type exactly matches the provided type.\n *\n * @param children The React children value to inspect.\n * @param type The element or component type to match against each direct child element.\n * @returns The first direct child element whose type matches the provided element type, or `null` when no match is found.\n */\nexport function useChildByType<T extends ElementType>(\n children: ReactNode,\n type: T\n): ElementOfType<T> | null {\n return useChildWhere(children, (element): element is ElementOfType<T> =>\n isElementOfType(element, type)\n );\n}\n","import { useMemo, type ReactElement, type ReactNode } from \"react\";\n\nimport { childrenToElements } from \"./childrenToElements\";\n\n/**\n * Returns the direct child elements that satisfy the provided predicate.\n *\n * @param children The React children value to inspect.\n * @param predicate A predicate that is called with each direct child element to determine whether it should be included in the result.\n * @returns An array of direct child elements that satisfy the provided predicate.\n */\nexport function useChildrenWhere<T extends ReactElement>(\n children: ReactNode,\n predicate: (element: ReactElement) => element is T\n): T[];\nexport function useChildrenWhere(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean\n): ReactElement[];\nexport function useChildrenWhere(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean\n): ReactElement[] {\n return useMemo(\n () => childrenToElements(children).filter(predicate),\n [children, predicate]\n );\n}\n","import type { ElementType, ReactNode } from \"react\";\n\nimport { isElementOfType } from \"./isElementOfType\";\nimport { useChildrenWhere } from \"./useChildrenWhere\";\nimport type { ElementOfType } from \"./types\";\n\n/**\n * Returns the direct child elements whose React element type exactly matches the provided type.\n *\n * @param children The React children value to inspect.\n * @param type The element or component type to match against each direct child element.\n * @returns An array of direct child elements whose type matches the provided element type.\n */\nexport function useChildrenByType<T extends ElementType>(\n children: ReactNode,\n type: T\n): ElementOfType<T>[] {\n return useChildrenWhere(children, (element): element is ElementOfType<T> =>\n isElementOfType(element, type)\n );\n}\n","import { createReporter, type RuntimeReporterMessages } from \"runtime-reporter\";\n\nconst messages: RuntimeReporterMessages<\n | {\n code: \"REQUIRED_CHILD_WHERE_PREDICATE_FAILED\";\n template: \"{{ traceCodePrefix }}Required child validation failed{{ childNameSegment }} because no direct child satisfied the provided predicate.\";\n tokens: \"traceCodePrefix\" | \"childNameSegment\";\n }\n | {\n code: \"MINIMUM_CHILDREN_WHERE_PREDICATE_FAILED\";\n template: \"{{ traceCodePrefix }}Minimum children validation failed{{ childNameSegment }} because only {{ actualCount }} direct child{{ actualCountPluralSuffix }} satisfied the provided predicate; expected at least {{ minimumCount }}.\";\n tokens:\n | \"traceCodePrefix\"\n | \"childNameSegment\"\n | \"actualCount\"\n | \"actualCountPluralSuffix\"\n | \"minimumCount\";\n }\n | {\n code: \"MAXIMUM_CHILDREN_WHERE_PREDICATE_FAILED\";\n template: \"{{ traceCodePrefix }}Maximum children validation failed{{ childNameSegment }} because {{ actualCount }} direct child{{ actualCountPluralSuffix }} satisfied the provided predicate; expected at most {{ maximumCount }}.\";\n tokens:\n | \"traceCodePrefix\"\n | \"childNameSegment\"\n | \"actualCount\"\n | \"actualCountPluralSuffix\"\n | \"maximumCount\";\n }\n | {\n code: \"EXACT_CHILDREN_WHERE_PREDICATE_FAILED\";\n template: \"{{ traceCodePrefix }}Exact children validation failed{{ childNameSegment }} because {{ actualCount }} direct child{{ actualCountPluralSuffix }} satisfied the provided predicate; expected exactly {{ exactCount }}.\";\n tokens:\n | \"traceCodePrefix\"\n | \"childNameSegment\"\n | \"actualCount\"\n | \"actualCountPluralSuffix\"\n | \"exactCount\";\n }\n> = {\n REQUIRED_CHILD_WHERE_PREDICATE_FAILED:\n \"{{ traceCodePrefix }}Required child validation failed{{ childNameSegment }} because no direct child satisfied the provided predicate.\",\n MINIMUM_CHILDREN_WHERE_PREDICATE_FAILED:\n \"{{ traceCodePrefix }}Minimum children validation failed{{ childNameSegment }} because only {{ actualCount }} direct child{{ actualCountPluralSuffix }} satisfied the provided predicate; expected at least {{ minimumCount }}.\",\n MAXIMUM_CHILDREN_WHERE_PREDICATE_FAILED:\n \"{{ traceCodePrefix }}Maximum children validation failed{{ childNameSegment }} because {{ actualCount }} direct child{{ actualCountPluralSuffix }} satisfied the provided predicate; expected at most {{ maximumCount }}.\",\n EXACT_CHILDREN_WHERE_PREDICATE_FAILED:\n \"{{ traceCodePrefix }}Exact children validation failed{{ childNameSegment }} because {{ actualCount }} direct child{{ actualCountPluralSuffix }} satisfied the provided predicate; expected exactly {{ exactCount }}.\"\n};\n\n/** The runtime reporter for react-children-hooks */\nconst reporter = createReporter(\n process.env.NODE_ENV === \"production\" ? ({} as typeof messages) : messages,\n { formatMessage: (message) => message }\n);\n\nexport default reporter;\n","import type { ReactElement, ReactNode } from \"react\";\n\nimport reporter from \"./reporter\";\nimport { useChildrenWhere } from \"./useChildrenWhere\";\n\nexport type UseExactChildrenWhereOptions = {\n /**\n * An optional consumer-defined trace code that is prefixed to the thrown validation message.\n */\n traceCode?: string;\n /**\n * An optional human-readable child name that is included in the thrown validation message.\n */\n childName?: string;\n};\n\n/**\n * Returns the direct child elements that satisfy the provided predicate, or throws when the exact count is not met.\n *\n * @param children The React children value to inspect.\n * @param predicate A predicate that is called with each direct child element to determine whether it matches.\n * @param exactCount The exact number of matching direct child elements required.\n * @param options Optional reporting metadata used to derive the thrown validation message.\n * @returns The direct child elements that satisfy the provided predicate.\n */\nexport function useExactChildrenWhere<T extends ReactElement>(\n children: ReactNode,\n predicate: (element: ReactElement) => element is T,\n exactCount: number,\n options?: UseExactChildrenWhereOptions\n): T[];\nexport function useExactChildrenWhere(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean,\n exactCount: number,\n options?: UseExactChildrenWhereOptions\n): ReactElement[];\nexport function useExactChildrenWhere(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean,\n exactCount: number,\n options?: UseExactChildrenWhereOptions\n): ReactElement[] {\n const matchingChildren = useChildrenWhere(children, predicate);\n\n if (matchingChildren.length === exactCount) {\n return matchingChildren;\n }\n\n return reporter.fail(\"EXACT_CHILDREN_WHERE_PREDICATE_FAILED\", {\n traceCodePrefix: options?.traceCode ? `[${options.traceCode}] ` : \"\",\n childNameSegment: options?.childName ? ` for ${options.childName}` : \"\",\n actualCount: matchingChildren.length,\n actualCountPluralSuffix: matchingChildren.length === 1 ? \"\" : \"ren\",\n exactCount\n });\n}\n","import { useMemo, type ReactElement, type ReactNode } from \"react\";\n\nimport { childrenToElements } from \"./childrenToElements\";\n\n/**\n * Determines whether any direct child element satisfies the provided predicate.\n *\n * @param children The React children value to inspect.\n * @param predicate A predicate that is called with each direct child element to determine whether it matches.\n * @returns `true` when at least one direct child element satisfies the provided predicate; otherwise `false`.\n */\nexport function useHasChildWhere<T extends ReactElement>(\n children: ReactNode,\n predicate: (element: ReactElement) => element is T\n): boolean;\nexport function useHasChildWhere(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean\n): boolean;\nexport function useHasChildWhere(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean\n): boolean {\n return useMemo(\n () => childrenToElements(children).some(predicate),\n [children, predicate]\n );\n}\n","import type { ReactElement, ReactNode } from \"react\";\n\nimport reporter from \"./reporter\";\nimport { useChildrenWhere } from \"./useChildrenWhere\";\n\nexport type UseMaximumChildrenWhereOptions = {\n /**\n * An optional consumer-defined trace code that is prefixed to the thrown validation message.\n */\n traceCode?: string;\n /**\n * An optional human-readable child name that is included in the thrown validation message.\n */\n childName?: string;\n};\n\n/**\n * Returns the direct child elements that satisfy the provided predicate, or throws when more than the maximum count are found.\n *\n * @param children The React children value to inspect.\n * @param predicate A predicate that is called with each direct child element to determine whether it matches.\n * @param maximumCount The maximum number of matching direct child elements allowed.\n * @param options Optional reporting metadata used to derive the thrown validation message.\n * @returns The direct child elements that satisfy the provided predicate.\n */\nexport function useMaximumChildrenWhere<T extends ReactElement>(\n children: ReactNode,\n predicate: (element: ReactElement) => element is T,\n maximumCount: number,\n options?: UseMaximumChildrenWhereOptions\n): T[];\nexport function useMaximumChildrenWhere(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean,\n maximumCount: number,\n options?: UseMaximumChildrenWhereOptions\n): ReactElement[];\nexport function useMaximumChildrenWhere(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean,\n maximumCount: number,\n options?: UseMaximumChildrenWhereOptions\n): ReactElement[] {\n const matchingChildren = useChildrenWhere(children, predicate);\n\n if (matchingChildren.length <= maximumCount) {\n return matchingChildren;\n }\n\n return reporter.fail(\"MAXIMUM_CHILDREN_WHERE_PREDICATE_FAILED\", {\n traceCodePrefix: options?.traceCode ? `[${options.traceCode}] ` : \"\",\n childNameSegment: options?.childName ? ` for ${options.childName}` : \"\",\n actualCount: matchingChildren.length,\n actualCountPluralSuffix: matchingChildren.length === 1 ? \"\" : \"ren\",\n maximumCount\n });\n}\n","import type { ReactElement, ReactNode } from \"react\";\n\nimport reporter from \"./reporter\";\nimport { useChildrenWhere } from \"./useChildrenWhere\";\n\nexport type UseMinimumChildrenWhereOptions = {\n /**\n * An optional consumer-defined trace code that is prefixed to the thrown validation message.\n */\n traceCode?: string;\n /**\n * An optional human-readable child name that is included in the thrown validation message.\n */\n childName?: string;\n};\n\n/**\n * Returns the direct child elements that satisfy the provided predicate, or throws when fewer than the minimum count are found.\n *\n * @param children The React children value to inspect.\n * @param predicate A predicate that is called with each direct child element to determine whether it matches.\n * @param minimumCount The minimum number of matching direct child elements required.\n * @param options Optional reporting metadata used to derive the thrown validation message.\n * @returns The direct child elements that satisfy the provided predicate.\n */\nexport function useMinimumChildrenWhere<T extends ReactElement>(\n children: ReactNode,\n predicate: (element: ReactElement) => element is T,\n minimumCount: number,\n options?: UseMinimumChildrenWhereOptions\n): T[];\nexport function useMinimumChildrenWhere(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean,\n minimumCount: number,\n options?: UseMinimumChildrenWhereOptions\n): ReactElement[];\nexport function useMinimumChildrenWhere(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean,\n minimumCount: number,\n options?: UseMinimumChildrenWhereOptions\n): ReactElement[] {\n const matchingChildren = useChildrenWhere(children, predicate);\n\n if (matchingChildren.length >= minimumCount) {\n return matchingChildren;\n }\n\n return reporter.fail(\"MINIMUM_CHILDREN_WHERE_PREDICATE_FAILED\", {\n traceCodePrefix: options?.traceCode ? `[${options.traceCode}] ` : \"\",\n childNameSegment: options?.childName ? ` for ${options.childName}` : \"\",\n actualCount: matchingChildren.length,\n actualCountPluralSuffix: matchingChildren.length === 1 ? \"\" : \"ren\",\n minimumCount\n });\n}\n","import type { ReactElement, ReactNode } from \"react\";\n\nimport reporter from \"./reporter\";\nimport { useChildWhere } from \"./useChildWhere\";\n\nexport type UseRequiredChildWhereOptions = {\n /**\n * An optional consumer-defined trace code that is prefixed to the thrown validation message.\n */\n traceCode?: string;\n /**\n * An optional human-readable child name that is included in the thrown validation message.\n */\n childName?: string;\n};\n\n/**\n * Returns the first direct child element that satisfies the provided predicate, or throws when no match is found.\n *\n * @param children The React children value to inspect.\n * @param predicate A predicate that is called with each direct child element to determine whether it matches.\n * @param options Optional reporting metadata used to derive the thrown validation message.\n * @returns The first direct child element that satisfies the provided predicate.\n */\nexport function useRequiredChildWhere<T extends ReactElement>(\n children: ReactNode,\n predicate: (element: ReactElement) => element is T,\n options?: UseRequiredChildWhereOptions\n): T;\nexport function useRequiredChildWhere(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean,\n options?: UseRequiredChildWhereOptions\n): ReactElement;\nexport function useRequiredChildWhere(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean,\n options?: UseRequiredChildWhereOptions\n): ReactElement {\n const child = useChildWhere(children, predicate);\n\n if (child !== null) {\n return child;\n }\n\n return reporter.fail(\"REQUIRED_CHILD_WHERE_PREDICATE_FAILED\", {\n traceCodePrefix: options?.traceCode ? `[${options.traceCode}] ` : \"\",\n childNameSegment: options?.childName ? ` for ${options.childName}` : \"\"\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACWO,SAAS,gBACZ,SACA,MAC2B;AAC3B,SAAO,QAAQ,SAAS;AAC5B;;;AChBA,IAAAA,gBAA2D;;;ACA3D,IAAAC,gBAA4D;;;ACA5D,mBAAkE;AAQ3D,SAAS,eAAe,MAAuC;AAClE,aAAO,6BAAe,IAAI;AAC9B;;;ADAO,SAAS,mBAAmB,UAAqC;AACpE,SAAO,uBAAS,QAAQ,QAAQ,EAAE,OAAO,cAAc;AAC3D;;;ADOO,SAAS,cACZ,UACA,WACmB;AACnB,aAAO;AAAA,IACH,MAAM,mBAAmB,QAAQ,EAAE,KAAK,SAAS,KAAK;AAAA,IACtD,CAAC,UAAU,SAAS;AAAA,EACxB;AACJ;;;AGdO,SAAS,eACZ,UACA,MACuB;AACvB,SAAO;AAAA,IAAc;AAAA,IAAU,CAAC,YAC5B,gBAAgB,SAAS,IAAI;AAAA,EACjC;AACJ;;;ACpBA,IAAAC,gBAA2D;AAmBpD,SAAS,iBACZ,UACA,WACc;AACd,aAAO;AAAA,IACH,MAAM,mBAAmB,QAAQ,EAAE,OAAO,SAAS;AAAA,IACnD,CAAC,UAAU,SAAS;AAAA,EACxB;AACJ;;;ACdO,SAAS,kBACZ,UACA,MACkB;AAClB,SAAO;AAAA,IAAiB;AAAA,IAAU,CAAC,YAC/B,gBAAgB,SAAS,IAAI;AAAA,EACjC;AACJ;;;ACpBA,8BAA6D;AAE7D,IAAM,WAoCF;AAAA,EACA,uCACI;AAAA,EACJ,yCACI;AAAA,EACJ,yCACI;AAAA,EACJ,uCACI;AACR;AAGA,IAAM,eAAW;AAAA,EACb,QAAQ,IAAI,aAAa,eAAgB,CAAC,IAAwB;A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S,YAAY,IAAI,QAAQ,SAAS,OAAO;AAAA,IAClE,kBAAkB,SAAS,YAAY,QAAQ,QAAQ,SAAS,KAAK;AAAA,IACrE,aAAa,iBAAiB;AAAA,IAC9B,yBAAyB,iBAAiB,WAAW,IAAI,KAAK;AAAA,IAC9D;AAAA,EACJ,CAAC;AACL;;;ACtBO,SAAS,sBACZ,UACA,WACA,SACY;AACZ,QAAM,QAAQ,cAAc,UAAU,SAAS;AAE/C,MAAI,UAAU,MAAM;AAChB,WAAO;AAAA,EACX;AAEA,SAAO,iBAAS,KAAK,yCAAyC;AAAA,IAC1D,iBAAiB,SAAS,YAAY,IAAI,QAAQ,SAAS,OAAO;AAAA,IAClE,kBAAkB,SAAS,YAAY,QAAQ,QAAQ,SAAS,KAAK;AAAA,EACzE,CAAC;AACL;","names":["import_react","import_react","import_react","import_react"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/isElementOfType.ts","../src/useChildMatching.ts","../src/childrenToElements.ts","../src/isReactElement.ts","../src/useChildByType.ts","../src/reporter.ts","../src/useChildrenMatching.ts","../src/useBoundedChildrenMatching.ts","../src/useBoundedChildrenByType.ts","../src/useChildrenByType.ts","../src/useExactChildrenMatching.ts","../src/useExactChildrenByType.ts","../src/useHasChildMatching.ts","../src/useMaximumChildrenMatching.ts","../src/useMaximumChildrenByType.ts","../src/useMinimumChildrenMatching.ts","../src/useMinimumChildrenByType.ts","../src/useRequiredChildMatching.ts","../src/useRequiredChildByType.ts"],"sourcesContent":["/**\n * Public package entrypoint.\n *\n * Hooks and child utilities will be exported here as the API is defined.\n */\nexport { useChildByType } from \"./useChildByType\";\nexport { useChildMatching } from \"./useChildMatching\";\nexport { useBoundedChildrenByType } from \"./useBoundedChildrenByType\";\nexport { useBoundedChildrenMatching } from \"./useBoundedChildrenMatching\";\nexport { useChildrenByType } from \"./useChildrenByType\";\nexport { useChildrenMatching } from \"./useChildrenMatching\";\nexport { useExactChildrenByType } from \"./useExactChildrenByType\";\nexport { useExactChildrenMatching } from \"./useExactChildrenMatching\";\nexport { useHasChildMatching } from \"./useHasChildMatching\";\nexport { useMaximumChildrenByType } from \"./useMaximumChildrenByType\";\nexport { useMaximumChildrenMatching } from \"./useMaximumChildrenMatching\";\nexport { useMinimumChildrenByType } from \"./useMinimumChildrenByType\";\nexport { useMinimumChildrenMatching } from \"./useMinimumChildrenMatching\";\nexport { useRequiredChildByType } from \"./useRequiredChildByType\";\nexport { useRequiredChildMatching } from \"./useRequiredChildMatching\";\nexport { childrenToElements } from \"./childrenToElements\";\nexport { isElementOfType } from \"./isElementOfType\";\nexport { isReactElement } from \"./isReactElement\";\nexport type {\n ChildrenCountBounds,\n ElementOfType,\n ValidationOptions\n} from \"./types\";\n","import type { ElementType, ReactElement } from \"react\";\n\nimport type { ElementOfType } from \"./types\";\n\n/**\n * Determines whether a React element exactly matches the provided element or component type.\n *\n * @param element The React element to compare.\n * @param type The element or component type to match.\n * @returns `true` when the element's type exactly matches the provided type; otherwise `false`.\n */\nexport function isElementOfType<T extends ElementType>(\n element: ReactElement,\n type: T\n): element is ElementOfType<T> {\n return element.type === type;\n}\n","import { useMemo, type ReactElement, type ReactNode } from \"react\";\n\nimport { childrenToElements } from \"./childrenToElements\";\n\n/**\n * Returns the first direct child element that satisfies the provided predicate.\n *\n * @param children The React children value to inspect.\n * @param predicate A predicate that is called with each direct child element to determine whether it matches.\n * @returns The first direct child element that satisfies the provided predicate, or `null` when no match is found.\n */\nexport function useChildMatching<T extends ReactElement>(\n children: ReactNode,\n predicate: (element: ReactElement) => element is T\n): T | null;\nexport function useChildMatching(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean\n): ReactElement | null;\nexport function useChildMatching(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean\n): ReactElement | null {\n return useMemo(\n () => childrenToElements(children).find(predicate) ?? null,\n [children, predicate]\n );\n}\n","import { Children, type ReactElement, type ReactNode } from \"react\";\n\nimport { isReactElement } from \"./isReactElement\";\n\n/**\n * Normalizes a React children value into an array containing only valid direct child elements.\n *\n * @param children The React children value to normalize.\n * @returns An array of valid React elements from the provided direct children.\n */\nexport function childrenToElements(children: ReactNode): ReactElement[] {\n return Children.toArray(children).filter(isReactElement);\n}\n","import { isValidElement, type ReactElement, type ReactNode } from \"react\";\n\n/**\n * Determines whether a React node is a valid React element.\n *\n * @param node The React node to check.\n * @returns `true` when the node is a valid React element; otherwise `false`.\n */\nexport function isReactElement(node: ReactNode): node is ReactElement {\n return isValidElement(node);\n}\n","import type { ElementType, ReactNode } from \"react\";\n\nimport { isElementOfType } from \"./isElementOfType\";\nimport type { ElementOfType } from \"./types\";\nimport { useChildMatching } from \"./useChildMatching\";\n\n/**\n * Returns the first direct child element whose React element type exactly matches the provided type.\n *\n * @param children The React children value to inspect.\n * @param type The element or component type to match against each direct child element.\n * @returns The first direct child element whose type matches the provided element type, or `null` when no match is found.\n */\nexport function useChildByType<T extends ElementType>(\n children: ReactNode,\n type: T\n): ElementOfType<T> | null {\n return useChildMatching(children, (element): element is ElementOfType<T> =>\n isElementOfType(element, type)\n );\n}\n","import { createReporter, type RuntimeReporterMessages } from \"runtime-reporter\";\n\nconst messages: RuntimeReporterMessages<\n | {\n code: \"REQUIRED_CHILD_MATCHING_PREDICATE_FAILED\";\n template: \"{{ traceCodePrefix }}Required child validation failed{{ childNameSegment }} because no direct child satisfied the provided predicate.\";\n tokens: \"traceCodePrefix\" | \"childNameSegment\";\n }\n | {\n code: \"MINIMUM_CHILDREN_MATCHING_PREDICATE_FAILED\";\n template: \"{{ traceCodePrefix }}Minimum children validation failed{{ childNameSegment }} because only {{ actualCount }} direct child{{ actualCountPluralSuffix }} satisfied the provided predicate; expected at least {{ minimumCount }}.\";\n tokens:\n | \"traceCodePrefix\"\n | \"childNameSegment\"\n | \"actualCount\"\n | \"actualCountPluralSuffix\"\n | \"minimumCount\";\n }\n | {\n code: \"MAXIMUM_CHILDREN_MATCHING_PREDICATE_FAILED\";\n template: \"{{ traceCodePrefix }}Maximum children validation failed{{ childNameSegment }} because {{ actualCount }} direct child{{ actualCountPluralSuffix }} satisfied the provided predicate; expected at most {{ maximumCount }}.\";\n tokens:\n | \"traceCodePrefix\"\n | \"childNameSegment\"\n | \"actualCount\"\n | \"actualCountPluralSuffix\"\n | \"maximumCount\";\n }\n | {\n code: \"EXACT_CHILDREN_MATCHING_PREDICATE_FAILED\";\n template: \"{{ traceCodePrefix }}Exact children validation failed{{ childNameSegment }} because {{ actualCount }} direct child{{ actualCountPluralSuffix }} satisfied the provided predicate; expected exactly {{ exactCount }}.\";\n tokens:\n | \"traceCodePrefix\"\n | \"childNameSegment\"\n | \"actualCount\"\n | \"actualCountPluralSuffix\"\n | \"exactCount\";\n }\n | {\n code: \"BOUNDED_CHILDREN_MATCHING_PREDICATE_FAILED\";\n template: \"{{ traceCodePrefix }}Bounded children validation failed{{ childNameSegment }} because {{ actualCount }} direct child{{ actualCountPluralSuffix }} satisfied the provided predicate; expected between {{ minimumCount }} and {{ maximumCount }} inclusive.\";\n tokens:\n | \"traceCodePrefix\"\n | \"childNameSegment\"\n | \"actualCount\"\n | \"actualCountPluralSuffix\"\n | \"minimumCount\"\n | \"maximumCount\";\n }\n> = {\n REQUIRED_CHILD_MATCHING_PREDICATE_FAILED:\n \"{{ traceCodePrefix }}Required child validation failed{{ childNameSegment }} because no direct child satisfied the provided predicate.\",\n MINIMUM_CHILDREN_MATCHING_PREDICATE_FAILED:\n \"{{ traceCodePrefix }}Minimum children validation failed{{ childNameSegment }} because only {{ actualCount }} direct child{{ actualCountPluralSuffix }} satisfied the provided predicate; expected at least {{ minimumCount }}.\",\n MAXIMUM_CHILDREN_MATCHING_PREDICATE_FAILED:\n \"{{ traceCodePrefix }}Maximum children validation failed{{ childNameSegment }} because {{ actualCount }} direct child{{ actualCountPluralSuffix }} satisfied the provided predicate; expected at most {{ maximumCount }}.\",\n EXACT_CHILDREN_MATCHING_PREDICATE_FAILED:\n \"{{ traceCodePrefix }}Exact children validation failed{{ childNameSegment }} because {{ actualCount }} direct child{{ actualCountPluralSuffix }} satisfied the provided predicate; expected exactly {{ exactCount }}.\",\n BOUNDED_CHILDREN_MATCHING_PREDICATE_FAILED:\n \"{{ traceCodePrefix }}Bounded children validation failed{{ childNameSegment }} because {{ actualCount }} direct child{{ actualCountPluralSuffix }} satisfied the provided predicate; expected between {{ minimumCount }} and {{ maximumCount }} inclusive.\"\n};\n\n/** The runtime reporter for react-children-hooks */\nconst reporter = createReporter(\n process.env.NODE_ENV === \"production\" ? ({} as typeof messages) : messages,\n { formatMessage: (message) => message }\n);\n\nexport default reporter;\n","import { useMemo, type ReactElement, type ReactNode } from \"react\";\n\nimport { childrenToElements } from \"./childrenToElements\";\n\n/**\n * Returns the direct child elements that satisfy the provided predicate.\n *\n * @param children The React children value to inspect.\n * @param predicate A predicate that is called with each direct child element to determine whether it should be included in the result.\n * @returns An array of direct child elements that satisfy the provided predicate.\n */\nexport function useChildrenMatching<T extends ReactElement>(\n children: ReactNode,\n predicate: (element: ReactElement) => element is T\n): T[];\nexport function useChildrenMatching(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean\n): ReactElement[];\nexport function useChildrenMatching(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean\n): ReactElement[] {\n return useMemo(\n () => childrenToElements(children).filter(predicate),\n [children, predicate]\n );\n}\n","import type { ReactElement, ReactNode } from \"react\";\n\nimport reporter from \"./reporter\";\nimport type { ChildrenCountBounds, ValidationOptions } from \"./types\";\nimport { useChildrenMatching } from \"./useChildrenMatching\";\n\n/**\n * Returns the direct child elements that satisfy the provided predicate, or throws when the count falls outside the inclusive bounds.\n *\n * @param children The React children value to inspect.\n * @param predicate A predicate that is called with each direct child element to determine whether it matches.\n * @param bounds The inclusive minimum and maximum number of matching direct child elements allowed.\n * @param options Optional reporting metadata used to derive the thrown validation message.\n * @returns The direct child elements that satisfy the provided predicate.\n */\nexport function useBoundedChildrenMatching<T extends ReactElement>(\n children: ReactNode,\n predicate: (element: ReactElement) => element is T,\n bounds: ChildrenCountBounds,\n options?: ValidationOptions\n): T[];\nexport function useBoundedChildrenMatching(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean,\n bounds: ChildrenCountBounds,\n options?: ValidationOptions\n): ReactElement[];\nexport function useBoundedChildrenMatching(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean,\n bounds: ChildrenCountBounds,\n options?: ValidationOptions\n): ReactElement[] {\n const matchingChildren = useChildrenMatching(children, predicate);\n\n if (\n matchingChildren.length >= bounds.minimum &&\n matchingChildren.length <= bounds.maximum\n ) {\n return matchingChildren;\n }\n\n return reporter.fail(\"BOUNDED_CHILDREN_MATCHING_PREDICATE_FAILED\", {\n traceCodePrefix: options?.traceCode ? `[${options.traceCode}] ` : \"\",\n childNameSegment: options?.childName ? ` for ${options.childName}` : \"\",\n actualCount: matchingChildren.length,\n actualCountPluralSuffix: matchingChildren.length === 1 ? \"\" : \"ren\",\n minimumCount: bounds.minimum,\n maximumCount: bounds.maximum\n });\n}\n","import type { ElementType, ReactNode } from \"react\";\n\nimport { isElementOfType } from \"./isElementOfType\";\nimport type {\n ChildrenCountBounds,\n ElementOfType,\n ValidationOptions\n} from \"./types\";\nimport { useBoundedChildrenMatching } from \"./useBoundedChildrenMatching\";\n\n/**\n * Returns the direct child elements whose React element type exactly matches the provided type, or throws when the count falls outside the inclusive bounds.\n *\n * @param children The React children value to inspect.\n * @param type The element or component type to match against each direct child element.\n * @param bounds The inclusive minimum and maximum number of matching direct child elements allowed.\n * @param options Optional reporting metadata used to derive the thrown validation message.\n * @returns The direct child elements whose type matches the provided element type.\n */\nexport function useBoundedChildrenByType<T extends ElementType>(\n children: ReactNode,\n type: T,\n bounds: ChildrenCountBounds,\n options?: ValidationOptions\n): ElementOfType<T>[] {\n return useBoundedChildrenMatching(\n children,\n (element): element is ElementOfType<T> =>\n isElementOfType(element, type),\n bounds,\n options\n );\n}\n","import type { ElementType, ReactNode } from \"react\";\n\nimport { isElementOfType } from \"./isElementOfType\";\nimport type { ElementOfType } from \"./types\";\nimport { useChildrenMatching } from \"./useChildrenMatching\";\n\n/**\n * Returns the direct child elements whose React element type exactly matches the provided type.\n *\n * @param children The React children value to inspect.\n * @param type The element or component type to match against each direct child element.\n * @returns An array of direct child elements whose type matches the provided element type.\n */\nexport function useChildrenByType<T extends ElementType>(\n children: ReactNode,\n type: T\n): ElementOfType<T>[] {\n return useChildrenMatching(\n children,\n (element): element is ElementOfType<T> => isElementOfType(element, type)\n );\n}\n","import type { ReactElement, ReactNode } from \"react\";\n\nimport reporter from \"./reporter\";\nimport type { ValidationOptions } from \"./types\";\nimport { useChildrenMatching } from \"./useChildrenMatching\";\n\n/**\n * Returns the direct child elements that satisfy the provided predicate, or throws when the exact count is not met.\n *\n * @param children The React children value to inspect.\n * @param predicate A predicate that is called with each direct child element to determine whether it matches.\n * @param exactCount The exact number of matching direct child elements required.\n * @param options Optional reporting metadata used to derive the thrown validation message.\n * @returns The direct child elements that satisfy the provided predicate.\n */\nexport function useExactChildrenMatching<T extends ReactElement>(\n children: ReactNode,\n predicate: (element: ReactElement) => element is T,\n exactCount: number,\n options?: ValidationOptions\n): T[];\nexport function useExactChildrenMatching(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean,\n exactCount: number,\n options?: ValidationOptions\n): ReactElement[];\nexport function useExactChildrenMatching(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean,\n exactCount: number,\n options?: ValidationOptions\n): ReactElement[] {\n const matchingChildren = useChildrenMatching(children, predicate);\n\n if (matchingChildren.length === exactCount) {\n return matchingChildren;\n }\n\n return reporter.fail(\"EXACT_CHILDREN_MATCHING_PREDICATE_FAILED\", {\n traceCodePrefix: options?.traceCode ? `[${options.traceCode}] ` : \"\",\n childNameSegment: options?.childName ? ` for ${options.childName}` : \"\",\n actualCount: matchingChildren.length,\n actualCountPluralSuffix: matchingChildren.length === 1 ? \"\" : \"ren\",\n exactCount\n });\n}\n","import type { ElementType, ReactNode } from \"react\";\n\nimport { isElementOfType } from \"./isElementOfType\";\nimport type { ElementOfType, ValidationOptions } from \"./types\";\nimport { useExactChildrenMatching } from \"./useExactChildrenMatching\";\n\n/**\n * Returns the direct child elements whose React element type exactly matches the provided type, or throws when the exact count is not met.\n *\n * @param children The React children value to inspect.\n * @param type The element or component type to match against each direct child element.\n * @param exactCount The exact number of matching direct child elements required.\n * @param options Optional reporting metadata used to derive the thrown validation message.\n * @returns The direct child elements whose type matches the provided element type.\n */\nexport function useExactChildrenByType<T extends ElementType>(\n children: ReactNode,\n type: T,\n exactCount: number,\n options?: ValidationOptions\n): ElementOfType<T>[] {\n return useExactChildrenMatching(\n children,\n (element): element is ElementOfType<T> =>\n isElementOfType(element, type),\n exactCount,\n options\n );\n}\n","import { useMemo, type ReactElement, type ReactNode } from \"react\";\n\nimport { childrenToElements } from \"./childrenToElements\";\n\n/**\n * Determines whether any direct child element satisfies the provided predicate.\n *\n * @param children The React children value to inspect.\n * @param predicate A predicate that is called with each direct child element to determine whether it matches.\n * @returns `true` when at least one direct child element satisfies the provided predicate; otherwise `false`.\n */\nexport function useHasChildMatching<T extends ReactElement>(\n children: ReactNode,\n predicate: (element: ReactElement) => element is T\n): boolean;\nexport function useHasChildMatching(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean\n): boolean;\nexport function useHasChildMatching(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean\n): boolean {\n return useMemo(\n () => childrenToElements(children).some(predicate),\n [children, predicate]\n );\n}\n","import type { ReactElement, ReactNode } from \"react\";\n\nimport reporter from \"./reporter\";\nimport type { ValidationOptions } from \"./types\";\nimport { useChildrenMatching } from \"./useChildrenMatching\";\n\n/**\n * Returns the direct child elements that satisfy the provided predicate, or throws when more than the maximum count are found.\n *\n * @param children The React children value to inspect.\n * @param predicate A predicate that is called with each direct child element to determine whether it matches.\n * @param maximumCount The maximum number of matching direct child elements allowed.\n * @param options Optional reporting metadata used to derive the thrown validation message.\n * @returns The direct child elements that satisfy the provided predicate.\n */\nexport function useMaximumChildrenMatching<T extends ReactElement>(\n children: ReactNode,\n predicate: (element: ReactElement) => element is T,\n maximumCount: number,\n options?: ValidationOptions\n): T[];\nexport function useMaximumChildrenMatching(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean,\n maximumCount: number,\n options?: ValidationOptions\n): ReactElement[];\nexport function useMaximumChildrenMatching(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean,\n maximumCount: number,\n options?: ValidationOptions\n): ReactElement[] {\n const matchingChildren = useChildrenMatching(children, predicate);\n\n if (matchingChildren.length <= maximumCount) {\n return matchingChildren;\n }\n\n return reporter.fail(\"MAXIMUM_CHILDREN_MATCHING_PREDICATE_FAILED\", {\n traceCodePrefix: options?.traceCode ? `[${options.traceCode}] ` : \"\",\n childNameSegment: options?.childName ? ` for ${options.childName}` : \"\",\n actualCount: matchingChildren.length,\n actualCountPluralSuffix: matchingChildren.length === 1 ? \"\" : \"ren\",\n maximumCount\n });\n}\n","import type { ElementType, ReactNode } from \"react\";\n\nimport { isElementOfType } from \"./isElementOfType\";\nimport type { ElementOfType, ValidationOptions } from \"./types\";\nimport { useMaximumChildrenMatching } from \"./useMaximumChildrenMatching\";\n\n/**\n * Returns the direct child elements whose React element type exactly matches the provided type, or throws when more than the maximum count are found.\n *\n * @param children The React children value to inspect.\n * @param type The element or component type to match against each direct child element.\n * @param maximumCount The maximum number of matching direct child elements allowed.\n * @param options Optional reporting metadata used to derive the thrown validation message.\n * @returns The direct child elements whose type matches the provided element type.\n */\nexport function useMaximumChildrenByType<T extends ElementType>(\n children: ReactNode,\n type: T,\n maximumCount: number,\n options?: ValidationOptions\n): ElementOfType<T>[] {\n return useMaximumChildrenMatching(\n children,\n (element): element is ElementOfType<T> =>\n isElementOfType(element, type),\n maximumCount,\n options\n );\n}\n","import type { ReactElement, ReactNode } from \"react\";\n\nimport reporter from \"./reporter\";\nimport type { ValidationOptions } from \"./types\";\nimport { useChildrenMatching } from \"./useChildrenMatching\";\n\n/**\n * Returns the direct child elements that satisfy the provided predicate, or throws when fewer than the minimum count are found.\n *\n * @param children The React children value to inspect.\n * @param predicate A predicate that is called with each direct child element to determine whether it matches.\n * @param minimumCount The minimum number of matching direct child elements required.\n * @param options Optional reporting metadata used to derive the thrown validation message.\n * @returns The direct child elements that satisfy the provided predicate.\n */\nexport function useMinimumChildrenMatching<T extends ReactElement>(\n children: ReactNode,\n predicate: (element: ReactElement) => element is T,\n minimumCount: number,\n options?: ValidationOptions\n): T[];\nexport function useMinimumChildrenMatching(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean,\n minimumCount: number,\n options?: ValidationOptions\n): ReactElement[];\nexport function useMinimumChildrenMatching(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean,\n minimumCount: number,\n options?: ValidationOptions\n): ReactElement[] {\n const matchingChildren = useChildrenMatching(children, predicate);\n\n if (matchingChildren.length >= minimumCount) {\n return matchingChildren;\n }\n\n return reporter.fail(\"MINIMUM_CHILDREN_MATCHING_PREDICATE_FAILED\", {\n traceCodePrefix: options?.traceCode ? `[${options.traceCode}] ` : \"\",\n childNameSegment: options?.childName ? ` for ${options.childName}` : \"\",\n actualCount: matchingChildren.length,\n actualCountPluralSuffix: matchingChildren.length === 1 ? \"\" : \"ren\",\n minimumCount\n });\n}\n","import type { ElementType, ReactNode } from \"react\";\n\nimport { isElementOfType } from \"./isElementOfType\";\nimport type { ElementOfType, ValidationOptions } from \"./types\";\nimport { useMinimumChildrenMatching } from \"./useMinimumChildrenMatching\";\n\n/**\n * Returns the direct child elements whose React element type exactly matches the provided type, or throws when fewer than the minimum count are found.\n *\n * @param children The React children value to inspect.\n * @param type The element or component type to match against each direct child element.\n * @param minimumCount The minimum number of matching direct child elements required.\n * @param options Optional reporting metadata used to derive the thrown validation message.\n * @returns The direct child elements whose type matches the provided element type.\n */\nexport function useMinimumChildrenByType<T extends ElementType>(\n children: ReactNode,\n type: T,\n minimumCount: number,\n options?: ValidationOptions\n): ElementOfType<T>[] {\n return useMinimumChildrenMatching(\n children,\n (element): element is ElementOfType<T> =>\n isElementOfType(element, type),\n minimumCount,\n options\n );\n}\n","import type { ReactElement, ReactNode } from \"react\";\n\nimport reporter from \"./reporter\";\nimport type { ValidationOptions } from \"./types\";\nimport { useChildMatching } from \"./useChildMatching\";\n\n/**\n * Returns the first direct child element that satisfies the provided predicate, or throws when no match is found.\n *\n * @param children The React children value to inspect.\n * @param predicate A predicate that is called with each direct child element to determine whether it matches.\n * @param options Optional reporting metadata used to derive the thrown validation message.\n * @returns The first direct child element that satisfies the provided predicate.\n */\nexport function useRequiredChildMatching<T extends ReactElement>(\n children: ReactNode,\n predicate: (element: ReactElement) => element is T,\n options?: ValidationOptions\n): T;\nexport function useRequiredChildMatching(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean,\n options?: ValidationOptions\n): ReactElement;\nexport function useRequiredChildMatching(\n children: ReactNode,\n predicate: (element: ReactElement) => boolean,\n options?: ValidationOptions\n): ReactElement {\n const child = useChildMatching(children, predicate);\n\n if (child !== null) {\n return child;\n }\n\n return reporter.fail(\"REQUIRED_CHILD_MATCHING_PREDICATE_FAILED\", {\n traceCodePrefix: options?.traceCode ? `[${options.traceCode}] ` : \"\",\n childNameSegment: options?.childName ? ` for ${options.childName}` : \"\"\n });\n}\n","import type { ElementType, ReactNode } from \"react\";\n\nimport { isElementOfType } from \"./isElementOfType\";\nimport type { ElementOfType, ValidationOptions } from \"./types\";\nimport { useRequiredChildMatching } from \"./useRequiredChildMatching\";\n\n/**\n * Returns the first direct child element whose React element type exactly matches the provided type, or throws when no match is found.\n *\n * @param children The React children value to inspect.\n * @param type The element or component type to match against each direct child element.\n * @param options Optional reporting metadata used to derive the thrown validation message.\n * @returns The first direct child element whose type matches the provided element type.\n */\nexport function useRequiredChildByType<T extends ElementType>(\n children: ReactNode,\n type: T,\n options?: ValidationOptions\n): ElementOfType<T> {\n return useRequiredChildMatching(\n children,\n (element): element is ElementOfType<T> =>\n isElementOfType(element, type),\n options\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;A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