@ory/elements-react 1.0.0-next.4 → 1.0.0-next.41

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 (67) hide show
  1. package/CHANGELOG.md +536 -0
  2. package/DEVELOPMENT.md +94 -0
  3. package/LICENSE +201 -0
  4. package/README.md +112 -33
  5. package/babel.config.js +10 -0
  6. package/dist/client/config.d.mts +21 -0
  7. package/dist/client/config.d.ts +21 -0
  8. package/dist/client/config.js +77 -0
  9. package/dist/client/config.js.map +1 -0
  10. package/dist/client/config.mjs +51 -0
  11. package/dist/client/config.mjs.map +1 -0
  12. package/dist/client/frontendClient.d.mts +10 -0
  13. package/dist/client/frontendClient.d.ts +10 -0
  14. package/dist/client/frontendClient.js +75 -0
  15. package/dist/client/frontendClient.js.map +1 -0
  16. package/dist/client/frontendClient.mjs +54 -0
  17. package/dist/client/frontendClient.mjs.map +1 -0
  18. package/dist/client/index.d.mts +5 -0
  19. package/dist/client/index.d.ts +5 -0
  20. package/dist/client/index.js +33 -0
  21. package/dist/client/index.js.map +1 -0
  22. package/dist/client/index.mjs +10 -0
  23. package/dist/client/index.mjs.map +1 -0
  24. package/dist/client/session-provider.d.mts +62 -0
  25. package/dist/client/session-provider.d.ts +62 -0
  26. package/dist/client/session-provider.js +96 -0
  27. package/dist/client/session-provider.js.map +1 -0
  28. package/dist/client/session-provider.mjs +71 -0
  29. package/dist/client/session-provider.mjs.map +1 -0
  30. package/dist/client/useSession.d.mts +32 -0
  31. package/dist/client/useSession.d.ts +32 -0
  32. package/dist/client/useSession.js +37 -0
  33. package/dist/client/useSession.js.map +1 -0
  34. package/dist/client/useSession.mjs +13 -0
  35. package/dist/client/useSession.mjs.map +1 -0
  36. package/dist/index.d.mts +478 -1633
  37. package/dist/index.d.ts +478 -1633
  38. package/dist/index.js +2845 -5733
  39. package/dist/index.js.map +1 -1
  40. package/dist/index.mjs +2842 -5704
  41. package/dist/index.mjs.map +1 -1
  42. package/dist/theme/default/index.css +999 -286
  43. package/dist/theme/default/index.css.map +1 -1
  44. package/dist/theme/default/index.d.mts +57 -144
  45. package/dist/theme/default/index.d.ts +57 -144
  46. package/dist/theme/default/index.js +4423 -9307
  47. package/dist/theme/default/index.js.map +1 -1
  48. package/dist/theme/default/index.mjs +5569 -10414
  49. package/dist/theme/default/index.mjs.map +1 -1
  50. package/dist/theme/default/tailwind/defaults.d.mts +737 -0
  51. package/dist/theme/default/tailwind/defaults.d.ts +737 -0
  52. package/dist/theme/default/tailwind/defaults.js +219 -0
  53. package/dist/theme/default/tailwind/defaults.js.map +1 -0
  54. package/dist/theme/default/tailwind/defaults.mjs +196 -0
  55. package/dist/theme/default/tailwind/defaults.mjs.map +1 -0
  56. package/package.json +39 -13
  57. package/tailwind/defaults.ts +34 -0
  58. package/tailwind/generated/README.md +2 -0
  59. package/tailwind/generated/default-variables.css +216 -0
  60. package/tailwind/generated/variables-processed.json +161 -0
  61. package/tsconfig.json +14 -3
  62. package/tsconfig.runtime.json +4 -0
  63. package/.eslintrc.js +0 -61
  64. package/postcss.config.ts +0 -6
  65. package/tailwind.config.ts +0 -51
  66. package/test-results/.last-run.json +0 -4
  67. package/variables-processed.json +0 -193
@@ -1,110 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as React from 'react';
3
- import React__default, { PropsWithChildren, ComponentType, ComponentPropsWithoutRef, FormEventHandler, Dispatch, MouseEventHandler, DetailedHTMLProps, HTMLAttributes } from 'react';
4
- import { UiNodeInputAttributes, UiNode, UiNodeAnchorAttributes, UiNodeTextAttributes, UiNodeImageAttributes, UiText, ConfigurationParameters, FlowError, LoginFlow, RecoveryFlow, RegistrationFlow, SettingsFlow, VerificationFlow } from '@ory/client-fetch';
2
+ import { OryCardContentProps, OryCardProps, OryNodeOidcButtonProps, OryFormRootProps, OryMessageContentProps, OryFlowComponentOverrides, OryFlowComponents, OryClientConfiguration } from '@ory/elements-react';
3
+ import * as react from 'react';
4
+ import { PropsWithChildren, ElementType } from 'react';
5
+ import { FlowError, GenericError, Session, LoginFlow, RecoveryFlow, RegistrationFlow, SettingsFlow, VerificationFlow, OAuth2ConsentRequest } from '@ory/client-fetch';
5
6
 
6
- type OryCardContentProps = PropsWithChildren;
7
- type OryCardFooterProps = Record<string, never>;
8
- type OryCardProps = PropsWithChildren;
9
- /**
10
- * Card components are used to show login, registration, recovery, and verification flows.
11
- */
12
- type OryCardComponents = {
13
- /**
14
- * The card container is the main container of the card.
15
- */
16
- Card: ComponentType<OryCardProps>;
17
- /**
18
- * The card footer is the footer of the card container.
19
- */
20
- CardFooter: ComponentType<OryCardFooterProps>;
21
- /**
22
- * The card header is the header of the card container.
23
- */
24
- CardHeader: ComponentType<OryCardProps>;
25
- /**
26
- * The card content is the main content of the card container.
27
- */
28
- CardContent: ComponentType<OryCardContentProps>;
29
- /**
30
- * The card logo is the logo of the card container.
31
- */
32
- CardLogo: ComponentType;
33
- };
34
-
35
- type HeadlessButtonProps = {
36
- attributes: UiNodeInputAttributes;
37
- node: UiNode;
38
- } & Omit<ComponentPropsWithoutRef<"button">, "children">;
39
- type HeadlessLinkButtonProps = {
40
- attributes: UiNodeAnchorAttributes;
41
- node: UiNode;
42
- } & Omit<ComponentPropsWithoutRef<"a">, "children">;
43
- type HeadlessLabelProps = {
44
- attributes: UiNodeInputAttributes;
45
- node: UiNode;
46
- } & ComponentPropsWithoutRef<"label">;
47
- type HeadlessTextProps = {
48
- attributes: UiNodeTextAttributes;
49
- node: UiNode;
50
- };
51
- type HeadlessAuthMethodListItemProps = {
52
- setGroups: Dispatch<React__default.SetStateAction<string[]>>;
53
- setStep: Dispatch<React__default.SetStateAction<number>>;
54
- group: string;
55
- };
56
- type HeadlessImageProps = {
57
- attributes: UiNodeImageAttributes;
58
- node: UiNode;
59
- };
60
- type HeadlessFormProps = ComponentPropsWithoutRef<"form"> & {
61
- onSubmit: FormEventHandler<HTMLFormElement>;
62
- };
63
- type HeadlessInputProps = {
64
- attributes: UiNodeInputAttributes;
65
- node: UiNode;
66
- onClick?: MouseEventHandler;
67
- };
68
- type OryFlowComponents = OryFormComponents & OryCardComponents;
69
-
70
- type HorizontalDividerProps = Record<string, never>;
71
-
72
- type HeadlessGroupContainerProps = PropsWithChildren;
73
-
74
- type HeadlessMessagesProps = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
75
- type HeadlessMessageProps = {
76
- message: UiText;
77
- };
78
-
79
- type HeadlessSocialButtonContainerProps = PropsWithChildren<{
80
- nodes: UiNode[];
81
- }>;
82
- type HeadlessSocialButtonProps = PropsWithChildren<{
83
- node: UiNode;
84
- attributes: UiNodeInputAttributes;
85
- }>;
86
-
87
- type OryFormComponents = {
88
- Button: ComponentType<HeadlessButtonProps>;
89
- LinkButton: ComponentType<HeadlessLinkButtonProps>;
90
- Input: ComponentType<HeadlessInputProps>;
91
- PinCodeInput: ComponentType<HeadlessInputProps>;
92
- Image: ComponentType<HeadlessImageProps>;
93
- Label: ComponentType<HeadlessLabelProps>;
94
- Checkbox: ComponentType<HeadlessInputProps>;
95
- Text: ComponentType<HeadlessTextProps>;
96
- FormContainer: ComponentType<HeadlessFormProps>;
97
- SocialButton: ComponentType<HeadlessSocialButtonProps>;
98
- SocialButtonContainer: ComponentType<HeadlessSocialButtonContainerProps>;
99
- AuthMethodListItem: ComponentType<HeadlessAuthMethodListItemProps>;
100
- HorizontalDivider: ComponentType<HorizontalDividerProps>;
101
- FormGroup: ComponentType<HeadlessGroupContainerProps>;
102
- MessageContainer: ComponentType<HeadlessMessagesProps>;
103
- Message: ComponentType<HeadlessMessageProps>;
104
- CurrentIdentifierButton: ComponentType<HeadlessButtonProps>;
105
- };
106
-
107
- declare function DefaultCardContent({ children }: OryCardContentProps): React.ReactNode;
7
+ declare function DefaultCardContent({ children }: OryCardContentProps): react.ReactNode;
108
8
 
109
9
  declare function DefaultCardFooter(): react_jsx_runtime.JSX.Element | null;
110
10
 
@@ -112,80 +12,93 @@ declare function DefaultCardHeader(): react_jsx_runtime.JSX.Element;
112
12
 
113
13
  declare function DefaultCardLogo(): react_jsx_runtime.JSX.Element;
114
14
 
15
+ declare function DefaultCurrentIdentifierButton(): react_jsx_runtime.JSX.Element | null;
16
+
17
+ declare function DefaultCardLayout({ children }: PropsWithChildren): react_jsx_runtime.JSX.Element;
18
+
115
19
  declare function DefaultCard({ children }: OryCardProps): react_jsx_runtime.JSX.Element;
116
20
 
117
- declare function DefaultFormContainer({ children, onSubmit, action, method, }: PropsWithChildren<HeadlessFormProps>): react_jsx_runtime.JSX.Element;
118
- declare function DefaultMessageContainer({ children }: PropsWithChildren): react_jsx_runtime.JSX.Element | null;
119
- declare function DefaultMessage({ message }: HeadlessMessageProps): react_jsx_runtime.JSX.Element;
120
-
121
- declare const OryDefaultComponents: OryFlowComponents;
122
-
123
- type OryClientConfiguration = {
124
- /**
125
- * The name of the application the user is logging in to.
126
- */
127
- name: string;
128
- /**
129
- * An optional logo URL to display in the UI instead of the name.
130
- */
131
- logoUrl?: string;
132
- stylesheet?: string;
133
- favicon?: string;
134
- sdk: {
135
- url: string;
136
- options?: Partial<ConfigurationParameters>;
137
- };
138
- project: {
139
- registration_enabled: boolean;
140
- verification_enabled: boolean;
141
- recovery_enabled: boolean;
142
- recovery_ui_url: string;
143
- registration_ui_url: string;
144
- verification_ui_url: string;
145
- login_ui_url: string;
146
- };
21
+ type DefaultSocialButtonProps = OryNodeOidcButtonProps & {
22
+ showLabel?: boolean;
23
+ logos?: Record<string, ElementType>;
147
24
  };
25
+ declare function DefaultButtonSocial({ attributes, node, onClick, showLabel: _showLabel, logos: providedLogos, }: DefaultSocialButtonProps): react_jsx_runtime.JSX.Element;
26
+ declare namespace DefaultButtonSocial {
27
+ var WithLogos: (logos: Record<string, ElementType>) => (props: DefaultSocialButtonProps) => react_jsx_runtime.JSX.Element;
28
+ }
29
+
30
+ declare function DefaultFormContainer({ children, onSubmit, action, method, }: PropsWithChildren<OryFormRootProps>): react_jsx_runtime.JSX.Element;
31
+ declare function DefaultMessageContainer({ children }: PropsWithChildren): react_jsx_runtime.JSX.Element | null;
32
+ declare function DefaultMessage({ message }: OryMessageContentProps): react_jsx_runtime.JSX.Element;
33
+
34
+ declare function getOryComponents(overrides?: OryFlowComponentOverrides): OryFlowComponents;
148
35
 
36
+ /**
37
+ * A union type of all possible errors that can be returned by the Ory SDK.
38
+ */
39
+ type OryError = FlowError | OAuth2Error | {
40
+ error: GenericError;
41
+ };
42
+ /**
43
+ * An OAuth2 error response.
44
+ */
45
+ type OAuth2Error = {
46
+ error: string;
47
+ error_description: string;
48
+ };
149
49
  type ErrorFlowContextProps = {
150
- error: FlowError;
151
- components?: Partial<OryFlowComponents>;
50
+ error: OryError;
51
+ components?: OryFlowComponentOverrides;
152
52
  config: OryClientConfiguration;
53
+ session?: Session;
153
54
  };
154
- declare function Error({ error, children, }: PropsWithChildren<ErrorFlowContextProps>): react_jsx_runtime.JSX.Element;
55
+ declare function Error({ error, components: Components, config, session, }: PropsWithChildren<ErrorFlowContextProps>): react_jsx_runtime.JSX.Element;
155
56
 
156
57
  type LoginFlowContextProps = {
157
58
  flow: LoginFlow;
158
- components?: Partial<OryFlowComponents>;
59
+ components?: OryFlowComponentOverrides;
159
60
  config: OryClientConfiguration;
160
61
  };
161
62
  declare function Login({ flow, config, children, components: flowOverrideComponents, }: PropsWithChildren<LoginFlowContextProps>): react_jsx_runtime.JSX.Element;
162
63
 
163
64
  type RecoveryFlowContextProps = {
164
65
  flow: RecoveryFlow;
165
- components?: Partial<OryFlowComponents>;
66
+ components?: OryFlowComponentOverrides;
166
67
  config: OryClientConfiguration;
167
68
  };
168
69
  declare function Recovery({ flow, config, children, components: flowOverrideComponents, }: PropsWithChildren<RecoveryFlowContextProps>): react_jsx_runtime.JSX.Element;
169
70
 
170
71
  type RegistrationFlowContextProps = {
171
72
  flow: RegistrationFlow;
172
- components?: Partial<OryFlowComponents>;
73
+ components?: OryFlowComponentOverrides;
173
74
  config: OryClientConfiguration;
174
75
  };
175
76
  declare function Registration({ flow, children, components: flowOverrideComponents, config, }: PropsWithChildren<RegistrationFlowContextProps>): react_jsx_runtime.JSX.Element;
176
77
 
177
78
  type SettingsFlowContextProps = {
178
79
  flow: SettingsFlow;
179
- components?: Partial<OryFlowComponents>;
80
+ components?: OryFlowComponentOverrides;
180
81
  config: OryClientConfiguration;
181
82
  };
182
83
  declare function Settings({ flow, config, children, components: flowOverrideComponents, }: PropsWithChildren<SettingsFlowContextProps>): react_jsx_runtime.JSX.Element;
183
84
 
184
85
  type VerificationFlowContextProps = {
185
86
  flow: VerificationFlow;
186
- components?: Partial<OryFlowComponents>;
87
+ components?: OryFlowComponentOverrides;
187
88
  config: OryClientConfiguration;
188
89
  };
189
90
  declare function Verification({ flow, config, children, components: flowOverrideComponents, }: PropsWithChildren<VerificationFlowContextProps>): react_jsx_runtime.JSX.Element;
190
91
 
191
- export { DefaultCard, DefaultCardContent, DefaultCardFooter, DefaultCardHeader, DefaultCardLogo, DefaultFormContainer, DefaultMessage, DefaultMessageContainer, Error, type ErrorFlowContextProps, Login, type LoginFlowContextProps, OryDefaultComponents, Recovery, type RecoveryFlowContextProps, Registration, Settings, type SettingsFlowContextProps, Verification, type VerificationFlowContextProps };
92
+ type PropsWithComponents = {
93
+ components?: OryFlowComponentOverrides;
94
+ };
95
+ type ConsentFlowContextProps = {
96
+ consentChallenge: OAuth2ConsentRequest;
97
+ session: Session;
98
+ config: OryClientConfiguration;
99
+ csrfToken: string;
100
+ formActionUrl: string;
101
+ } & PropsWithComponents;
102
+ declare function Consent({ consentChallenge, session, config, components: Passed, children, csrfToken, formActionUrl, }: PropsWithChildren<ConsentFlowContextProps>): react_jsx_runtime.JSX.Element;
103
+
104
+ export { Consent, type ConsentFlowContextProps, DefaultButtonSocial, DefaultCard, DefaultCardContent, DefaultCardFooter, DefaultCardHeader, DefaultCardLayout, DefaultCardLogo, DefaultCurrentIdentifierButton, DefaultFormContainer, DefaultMessage, DefaultMessageContainer, Error, type ErrorFlowContextProps, Login, type LoginFlowContextProps, type OAuth2Error, type OryError, Recovery, type RecoveryFlowContextProps, Registration, Settings, type SettingsFlowContextProps, Verification, type VerificationFlowContextProps, getOryComponents };