diff --git a/src/lib/KratosForm.svelte b/src/lib/KratosForm.svelte index 474dff5..6008566 100644 --- a/src/lib/KratosForm.svelte +++ b/src/lib/KratosForm.svelte @@ -9,10 +9,21 @@ isUiNodeImageAttributes, isUiNodeInputAttributes, isUiNodeScriptAttributes, - isUiNodeTextAttributes + isUiNodeTextAttributes, + filterNodesByGroups } from '@ory/integrations/ui'; export let ui: UiContainer; + + let groups = [ + ...new Set(ui.nodes.map((node) => node.group).filter((group) => group != 'default')) + ]; + export let grouped_nodes = groups.map((group) => + filterNodesByGroups({ + nodes: ui.nodes, + groups: group + }) + ); {#if ui.messages} @@ -48,38 +59,68 @@ {/each} {/if} -
- {#each ui.nodes as node} - {#if isUiNodeTextAttributes(node.attributes)} - {node.attributes.text.text} - {:else if isUiNodeInputAttributes(node.attributes)} - {#if node.attributes.type == 'button' || node.attributes.type == 'submit'} -
- -
- {:else if node.attributes.type == 'text' || node.attributes.type == 'password' || node.attributes.type == 'number' || node.attributes.type == 'email' || node.attributes.type == 'tel' || node.attributes.type == 'datetime-local' || node.attributes.type == 'date' || node.attributes.type == 'url'} -
- {#if node.meta.label} -
- {:else if node.attributes.type == 'checkbox'} -
- -
- {:else if node.attributes.type == 'hidden'} - - {/if} - {:else if isUiNodeImageAttributes(node.attributes)} - {getNodeLabel(node)} - {:else if isUiNodeAnchorAttributes(node.attributes)} - - {getNodeLabel(node)} - - {:else if isUiNodeScriptAttributes(node.attributes)} - {#if browser} - + {/if} + {:else if isUiNodeImageAttributes(node.attributes)} + {getNodeLabel(node)} + {:else if isUiNodeAnchorAttributes(node.attributes)} + + {getNodeLabel(node)} + + {:else if isUiNodeScriptAttributes(node.attributes)} + {#if browser} + + {/if} {/if} - {/if} - {/each} -
+ {/each} + +{/each}