@ory/elements-react 0.0.0-pr.6b3fe62 → 0.0.0-pr.7af5f16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -190,21 +190,29 @@ function nodesToAuthMethodGroups(nodes, excludeAuthMethods = []) {
190
190
  function useNodesGroups(nodes, { omit } = {}) {
191
191
  const groupSorter = useGroupSorter();
192
192
  const groups = useMemo(() => {
193
- var _a;
193
+ var _a, _b;
194
194
  const groups2 = {};
195
+ const groupRetained = {};
195
196
  for (const node of nodes) {
197
+ const groupNodes = (_a = groups2[node.group]) != null ? _a : [];
198
+ groupNodes.push(node);
199
+ groups2[node.group] = groupNodes;
196
200
  if ((omit == null ? void 0 : omit.includes("script")) && isUiNodeScriptAttributes(node.attributes)) {
197
201
  continue;
198
202
  }
199
203
  if ((omit == null ? void 0 : omit.includes("input_hidden")) && isUiNodeInputAttributes(node.attributes) && node.attributes.type === "hidden") {
200
204
  continue;
201
205
  }
202
- const groupNodes = (_a = groups2[node.group]) != null ? _a : [];
203
- groupNodes.push(node);
204
- groups2[node.group] = groupNodes;
206
+ groupRetained[node.group] = ((_b = groupRetained[node.group]) != null ? _b : 0) + 1;
207
+ }
208
+ const finalGroups = {};
209
+ for (const [group, count] of Object.entries(groupRetained)) {
210
+ if (count > 0) {
211
+ finalGroups[group] = groups2[group];
212
+ }
205
213
  }
206
- return groups2;
207
- }, [nodes]);
214
+ return finalGroups;
215
+ }, [nodes, omit]);
208
216
  const entries = useMemo(
209
217
  () => Object.entries(groups).sort(([a], [b]) => groupSorter(a, b)),
210
218
  [groups, groupSorter]
@@ -903,7 +911,7 @@ function OryForm({
903
911
  }),
904
912
  type: "error"
905
913
  };
906
- return /* @__PURE__ */ jsxs("div", { "data-testid": dataTestId, children: [
914
+ return /* @__PURE__ */ jsxs("div", { className: "grid gap-8", "data-testid": dataTestId, children: [
907
915
  /* @__PURE__ */ jsx(Message.Root, { children: /* @__PURE__ */ jsx(Message.Content, { message: m }, m.id) }),
908
916
  /* @__PURE__ */ jsx(OryCardFooter, {})
909
917
  ] });
@@ -1236,7 +1244,7 @@ function OryTwoStepCard() {
1236
1244
  showSsoDivider && /* @__PURE__ */ jsx(Card.Divider, {}),
1237
1245
  nonSsoNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsx(Node, { node }, k))
1238
1246
  ] }),
1239
- formState.current === "select_method" && /* @__PURE__ */ jsxs(Form.Group, { children: [
1247
+ formState.current === "select_method" && Object.entries(authMethodBlocks).length > 0 && /* @__PURE__ */ jsxs(Form.Group, { children: [
1240
1248
  Object.entries(authMethodBlocks).length > 0 && /* @__PURE__ */ jsx(Card.Divider, {}),
1241
1249
  Object.entries(authMethodBlocks).length > 0 && /* @__PURE__ */ jsx(
1242
1250
  AuthMethodList,
@@ -1250,9 +1258,9 @@ function OryTwoStepCard() {
1250
1258
  ),
1251
1259
  authMethodAdditionalNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsx(Node, { node }, k))
1252
1260
  ] }),
1253
- formState.current === "method_active" && /* @__PURE__ */ jsxs(Form.Group, { children: [
1261
+ formState.current === "method_active" && finalNodes.length > 0 && /* @__PURE__ */ jsxs(Form.Group, { children: [
1254
1262
  ui.nodes.filter(
1255
- (n) => isUiNodeScriptAttributes(n.attributes) || n.group === UiNodeGroupEnum.Captcha
1263
+ (n) => isUiNodeScriptAttributes(n.attributes) || n.group === UiNodeGroupEnum.Captcha || n.group === UiNodeGroupEnum.Default || n.group === UiNodeGroupEnum.Profile
1256
1264
  ).map((node, k) => /* @__PURE__ */ jsx(Node, { node }, k)),
1257
1265
  finalNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsx(Node, { node }, k))
1258
1266
  ] }),