@atlasauth/react 0.4.1 → 0.6.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/CHANGELOG.md +217 -0
- package/dist/AtlasProvider.d.ts +48 -7
- package/dist/AtlasProvider.js +158 -24
- package/dist/AtlasProvider.js.map +1 -1
- package/dist/api-keys.d.ts +63 -0
- package/dist/api-keys.js +227 -0
- package/dist/api-keys.js.map +1 -0
- package/dist/appearance.d.ts +27 -0
- package/dist/appearance.js +58 -1
- package/dist/appearance.js.map +1 -1
- package/dist/captcha.d.ts +43 -0
- package/dist/captcha.js +109 -0
- package/dist/captcha.js.map +1 -0
- package/dist/components.d.ts +2 -0
- package/dist/components.js +4 -1
- package/dist/components.js.map +1 -1
- package/dist/contrast.d.ts +24 -0
- package/dist/contrast.js +76 -0
- package/dist/contrast.js.map +1 -0
- package/dist/flow.d.ts +17 -2
- package/dist/flow.js +88 -9
- package/dist/flow.js.map +1 -1
- package/dist/hooks.d.ts +7 -2
- package/dist/hooks.js.map +1 -1
- package/dist/i18n.js +44 -0
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/instance-settings.d.ts +7 -0
- package/dist/instance-settings.js +12 -0
- package/dist/instance-settings.js.map +1 -0
- package/dist/sign-in.d.ts +2 -0
- package/dist/sign-in.js +8 -3
- package/dist/sign-in.js.map +1 -1
- package/dist/sign-up.d.ts +13 -0
- package/dist/sign-up.js +120 -2
- package/dist/sign-up.js.map +1 -1
- package/dist/styles.d.ts +14 -2
- package/dist/styles.js +30 -13
- package/dist/styles.js.map +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The instance's public sign-in / sign-up settings (`useAtlas().instanceSettings`),
|
|
3
|
+
* read from the same `GET /v1/appearance` response the provider already fetches
|
|
4
|
+
* for the dashboard design. The parser is shared with every framework SDK's
|
|
5
|
+
* prebuilt forms and lives in `@atlasauth/js`.
|
|
6
|
+
*/
|
|
7
|
+
export { instanceSettingsFrom, type InstanceSettings, type PublicSignUpField, } from '@atlasauth/js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.instanceSettingsFrom = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The instance's public sign-in / sign-up settings (`useAtlas().instanceSettings`),
|
|
6
|
+
* read from the same `GET /v1/appearance` response the provider already fetches
|
|
7
|
+
* for the dashboard design. The parser is shared with every framework SDK's
|
|
8
|
+
* prebuilt forms and lives in `@atlasauth/js`.
|
|
9
|
+
*/
|
|
10
|
+
var js_1 = require("@atlasauth/js");
|
|
11
|
+
Object.defineProperty(exports, "instanceSettingsFrom", { enumerable: true, get: function () { return js_1.instanceSettingsFrom; } });
|
|
12
|
+
//# sourceMappingURL=instance-settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance-settings.js","sourceRoot":"","sources":["../src/instance-settings.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,oCAIuB;AAHrB,0GAAA,oBAAoB,OAAA"}
|
package/dist/sign-in.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ export declare function useSignIn(): {
|
|
|
24
24
|
mode?: "popup" | "redirect";
|
|
25
25
|
redirectUrl?: string;
|
|
26
26
|
handlers?: OAuthPopupHandlers;
|
|
27
|
+
/** Popup mode: abort to stop waiting for the popup (e.g. a "Cancel" button). */
|
|
28
|
+
signal?: AbortSignal;
|
|
27
29
|
}) => Promise<void>;
|
|
28
30
|
};
|
|
29
31
|
/**
|
package/dist/sign-in.js
CHANGED
|
@@ -8,10 +8,11 @@ const react_1 = require("react");
|
|
|
8
8
|
const js_1 = require("@atlasauth/js");
|
|
9
9
|
const AtlasProvider_1 = require("./AtlasProvider");
|
|
10
10
|
const fapi_1 = require("./fapi");
|
|
11
|
+
const captcha_1 = require("./captcha");
|
|
11
12
|
const flow_1 = require("./flow");
|
|
12
13
|
function SignIn(props = {}) {
|
|
13
|
-
const { state, submit, client, finish } = (0, flow_1.useFlow)({ afterUrl: props.afterUrl });
|
|
14
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(flow_1.AttemptFlow, { attempt: state.attempt, busy: state.busy, errors: state.errors, titleKey: "signIn.title", hideTitle: props.hideTitle, onSubmit: submit }), !state.attempt ? ((0, jsx_runtime_1.jsx)(flow_1.SocialSignInButtons, { client: client, onComplete: finish, oneTap: props.googleOneTap, oauthMode: props.oauthMode, onProviderUnavailable: props.onProviderUnavailable, googleButton: props.googleButton })) : null] }));
|
|
14
|
+
const { state, submit, client, finish, captcha } = (0, flow_1.useFlow)({ afterUrl: props.afterUrl });
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(flow_1.AttemptFlow, { attempt: state.attempt, busy: state.busy, errors: state.errors, titleKey: "signIn.title", hideTitle: props.hideTitle, onSubmit: submit, captcha: (0, jsx_runtime_1.jsx)(captcha_1.CaptchaSlot, { controller: captcha }) }), !state.attempt ? ((0, jsx_runtime_1.jsx)(flow_1.SocialSignInButtons, { client: client, onComplete: finish, oneTap: props.googleOneTap, oauthMode: props.oauthMode, onProviderUnavailable: props.onProviderUnavailable, googleButton: props.googleButton })) : null] }));
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* §6 headless native sign-in, for a consumer that renders its OWN Google button
|
|
@@ -47,7 +48,7 @@ function useSignIn() {
|
|
|
47
48
|
return;
|
|
48
49
|
const redirectUrl = input.redirectUrl ?? window.location.href;
|
|
49
50
|
if (input.mode === 'popup') {
|
|
50
|
-
const out = await (0, js_1.startOauthPopup)(client, { provider: input.provider, redirectUrl }, input.handlers);
|
|
51
|
+
const out = await (0, js_1.startOauthPopup)(client, { provider: input.provider, redirectUrl, signal: input.signal }, input.handlers);
|
|
51
52
|
if (out.blocked && out.authorizationUrl) {
|
|
52
53
|
window.location.href = out.authorizationUrl;
|
|
53
54
|
return;
|
|
@@ -64,6 +65,10 @@ function useSignIn() {
|
|
|
64
65
|
window.location.href = out.continuationUrl;
|
|
65
66
|
return;
|
|
66
67
|
}
|
|
68
|
+
// The popup finished the sign-in itself (its link to this page was
|
|
69
|
+
// severed): the cookies are set, so re-boot signed-in.
|
|
70
|
+
if (out.sessionDetected)
|
|
71
|
+
await reload();
|
|
67
72
|
return;
|
|
68
73
|
}
|
|
69
74
|
const res = await (0, js_1.startOauthRedirect)(client, { provider: input.provider, redirectUrl });
|
package/dist/sign-in.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-in.js","sourceRoot":"","sources":["../src/sign-in.tsx"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"sign-in.js","sourceRoot":"","sources":["../src/sign-in.tsx"],"names":[],"mappings":";;AAsBA,wBA4BC;AAUD,8BAgFC;AAwBD,gDA4FC;;AAhQD,iCAAgG;AAChG,sCAMuB;AACvB,mDAA2C;AAC3C,iCAAoD;AACpD,uCAAwC;AACxC,iCASgB;AAEhB,SAAgB,MAAM,CAAC,QAAmB,EAAE;IAC1C,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,cAAO,EAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEzF,OAAO,CACL,6DACE,uBAAC,kBAAW,IACV,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,QAAQ,EAAC,cAAc,EACvB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,uBAAC,qBAAW,IA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EAAE,cAAc,EAAE,YAC5E,MAAM,GACF,CACR,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/sign-up.d.ts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { type FlowState } from './fapi';
|
|
2
2
|
import { type FlowProps } from './flow';
|
|
3
|
+
/**
|
|
4
|
+
* §10.2 `<SignUp/>` — creates an account.
|
|
5
|
+
*
|
|
6
|
+
* The first step is the create-account form: the instance's configured extra
|
|
7
|
+
* fields, email + password, the legal-consent row and — when the instance
|
|
8
|
+
* requires one on sign-up — the captcha widget. It POSTs `/v1/client/sign_ups`;
|
|
9
|
+
* from there the flow is server-driven exactly like `<SignIn>` (the shared
|
|
10
|
+
* `AttemptFlow` renders the email-code step, which `advance` posts to the
|
|
11
|
+
* sign-up's `attempt_verification`), finishing through the same ticket exchange.
|
|
12
|
+
*
|
|
13
|
+
* All of it is read from the instance's settings, so a field, a consent policy
|
|
14
|
+
* or a captcha switched on in the dashboard appears here with no code change.
|
|
15
|
+
*/
|
|
3
16
|
export declare function SignUp(props?: FlowProps): import("react").JSX.Element;
|
|
4
17
|
/**
|
|
5
18
|
* §5.1 headless sign-up — the sign-up counterpart of {@link useSignIn}. Starts a
|
package/dist/sign-up.js
CHANGED
|
@@ -8,9 +8,127 @@ const js_1 = require("@atlasauth/js");
|
|
|
8
8
|
const AtlasProvider_1 = require("./AtlasProvider");
|
|
9
9
|
const fapi_1 = require("./fapi");
|
|
10
10
|
const flow_1 = require("./flow");
|
|
11
|
+
const captcha_1 = require("./captcha");
|
|
12
|
+
const components_shared_1 = require("./components-shared");
|
|
13
|
+
/**
|
|
14
|
+
* §10.2 `<SignUp/>` — creates an account.
|
|
15
|
+
*
|
|
16
|
+
* The first step is the create-account form: the instance's configured extra
|
|
17
|
+
* fields, email + password, the legal-consent row and — when the instance
|
|
18
|
+
* requires one on sign-up — the captcha widget. It POSTs `/v1/client/sign_ups`;
|
|
19
|
+
* from there the flow is server-driven exactly like `<SignIn>` (the shared
|
|
20
|
+
* `AttemptFlow` renders the email-code step, which `advance` posts to the
|
|
21
|
+
* sign-up's `attempt_verification`), finishing through the same ticket exchange.
|
|
22
|
+
*
|
|
23
|
+
* All of it is read from the instance's settings, so a field, a consent policy
|
|
24
|
+
* or a captcha switched on in the dashboard appears here with no code change.
|
|
25
|
+
*/
|
|
11
26
|
function SignUp(props = {}) {
|
|
12
|
-
const {
|
|
13
|
-
|
|
27
|
+
const { instanceSettings } = (0, AtlasProvider_1.useAtlas)();
|
|
28
|
+
const t = (0, components_shared_1.useText)();
|
|
29
|
+
const { state, setState, submit, client, finish } = (0, flow_1.useFlow)({
|
|
30
|
+
afterUrl: props.afterUrl,
|
|
31
|
+
signInCaptcha: false,
|
|
32
|
+
});
|
|
33
|
+
const signUpFlow = instanceSettings?.captchaFlows.signUp;
|
|
34
|
+
const captcha = (0, captcha_1.useCaptcha)(signUpFlow, {
|
|
35
|
+
active: !state.attempt && (0, js_1.flowNeedsCaptcha)(signUpFlow),
|
|
36
|
+
});
|
|
37
|
+
const create = (0, react_1.useCallback)((values, consent) => {
|
|
38
|
+
void (async () => {
|
|
39
|
+
setState((current) => ({ ...current, busy: true, errors: [] }));
|
|
40
|
+
const { email = '', password = '', ...rest } = values;
|
|
41
|
+
// Drop blank optional fields so the server never sees empty strings.
|
|
42
|
+
const fields = {};
|
|
43
|
+
for (const [key, value] of Object.entries(rest))
|
|
44
|
+
if (value)
|
|
45
|
+
fields[key] = value;
|
|
46
|
+
const token = await captcha.getToken();
|
|
47
|
+
let next = await (0, js_1.startSignUp)(client, {
|
|
48
|
+
email,
|
|
49
|
+
password,
|
|
50
|
+
fields,
|
|
51
|
+
consent,
|
|
52
|
+
captchaToken: token ?? undefined,
|
|
53
|
+
});
|
|
54
|
+
const localized = (0, captcha_1.localizeCaptchaErrors)(next.errors, t);
|
|
55
|
+
next = { ...next, errors: localized.errors };
|
|
56
|
+
// The token was spent either way; a refused create needs a fresh one.
|
|
57
|
+
if (next.errors.length > 0 && captcha.needed)
|
|
58
|
+
captcha.reset();
|
|
59
|
+
await finish(next);
|
|
60
|
+
})();
|
|
61
|
+
}, [captcha, client, finish, setState, t]);
|
|
62
|
+
if (state.attempt) {
|
|
63
|
+
return ((0, jsx_runtime_1.jsx)(flow_1.AttemptFlow, { attempt: state.attempt, busy: state.busy, errors: state.errors, titleKey: "signUp.title", hideTitle: props.hideTitle, onSubmit: submit }));
|
|
64
|
+
}
|
|
65
|
+
return ((0, jsx_runtime_1.jsx)(SignUpForm, { settings: instanceSettings, busy: state.busy, errors: state.errors, hideTitle: props.hideTitle, captcha: captcha, onSubmit: create }));
|
|
66
|
+
}
|
|
67
|
+
/** The create-account step. Values are kept in state so an error never clears them. */
|
|
68
|
+
function SignUpForm({ settings, busy, errors, hideTitle, captcha, onSubmit, }) {
|
|
69
|
+
const t = (0, components_shared_1.useText)();
|
|
70
|
+
const cardClass = (0, components_shared_1.useClass)('card', 'atlas-card');
|
|
71
|
+
const titleClass = (0, components_shared_1.useClass)('headerTitle', 'atlas-title');
|
|
72
|
+
const inputClass = (0, components_shared_1.useClass)('formFieldInput', 'atlas-input');
|
|
73
|
+
const buttonClass = (0, components_shared_1.useClass)('formButtonPrimary', 'atlas-button');
|
|
74
|
+
const errorClass = (0, components_shared_1.useClass)('formFieldError', 'atlas-error');
|
|
75
|
+
const cls = (0, components_shared_1.useClasses)();
|
|
76
|
+
const [values, setValues] = (0, react_1.useState)({});
|
|
77
|
+
const [agreed, setAgreed] = (0, react_1.useState)(false);
|
|
78
|
+
const set = (name, value) => setValues((v) => ({ ...v, [name]: value }));
|
|
79
|
+
const legal = settings?.legal;
|
|
80
|
+
const showLegal = !!legal && (!!legal.termsUrl || !!legal.privacyUrl);
|
|
81
|
+
const consentOk = !legal?.required || agreed;
|
|
82
|
+
const fieldErrors = (name) => errors
|
|
83
|
+
.filter((error) => error.param === name)
|
|
84
|
+
.map((error) => ((0, jsx_runtime_1.jsx)("span", { className: errorClass, children: error.message }, error.code)));
|
|
85
|
+
const label = (f) => f.required ? f.label : t('signUp.optionalField', { label: f.label });
|
|
86
|
+
const control = (f) => {
|
|
87
|
+
const value = values[f.key] ?? '';
|
|
88
|
+
switch (f.type) {
|
|
89
|
+
case 'checkbox':
|
|
90
|
+
return ((0, jsx_runtime_1.jsx)("input", { type: "checkbox", name: f.key, checked: value === 'true', onChange: (e) => set(f.key, e.target.checked ? 'true' : '') }));
|
|
91
|
+
case 'select':
|
|
92
|
+
return ((0, jsx_runtime_1.jsxs)("select", { className: inputClass, name: f.key, value: value, required: f.required, onChange: (e) => set(f.key, e.target.value), children: [(0, jsx_runtime_1.jsx)("option", { value: "", children: f.placeholder ?? t('signUp.selectPlaceholder') }), f.options.map((o) => ((0, jsx_runtime_1.jsx)("option", { value: o, children: o }, o)))] }));
|
|
93
|
+
case 'textarea':
|
|
94
|
+
return ((0, jsx_runtime_1.jsx)("textarea", { className: inputClass, name: f.key, rows: 3, value: value, required: f.required, placeholder: f.placeholder ?? undefined, onChange: (e) => set(f.key, e.target.value) }));
|
|
95
|
+
case 'radio':
|
|
96
|
+
case 'multiselect': {
|
|
97
|
+
// Same encoding as the embed widget and hosted page: one value, or a
|
|
98
|
+
// comma-joined list for multiselect.
|
|
99
|
+
const picked = value ? value.split(', ') : [];
|
|
100
|
+
return ((0, jsx_runtime_1.jsx)("span", { className: cls('list', 'atlas-choices'), children: f.options.map((o) => ((0, jsx_runtime_1.jsxs)("label", { className: cls('listItem', 'atlas-choice'), children: [(0, jsx_runtime_1.jsx)("input", { type: f.type === 'radio' ? 'radio' : 'checkbox', name: f.key, value: o, checked: picked.includes(o), onChange: (e) => {
|
|
101
|
+
if (f.type === 'radio')
|
|
102
|
+
set(f.key, o);
|
|
103
|
+
else
|
|
104
|
+
set(f.key, (e.target.checked ? [...picked, o] : picked.filter((p) => p !== o)).join(', '));
|
|
105
|
+
} }), o] }, o))) }));
|
|
106
|
+
}
|
|
107
|
+
default: {
|
|
108
|
+
const type = ['email', 'tel', 'url', 'number', 'date'].includes(f.type) ? f.type : 'text';
|
|
109
|
+
return ((0, jsx_runtime_1.jsx)("input", { className: inputClass, type: type, name: f.key, value: value, required: f.required, placeholder: f.placeholder ?? undefined, onChange: (e) => set(f.key, e.target.value) }));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const textField = (name, labelKey, type, autoComplete) => ((0, jsx_runtime_1.jsxs)("label", { className: cls('formField', 'atlas-field'), children: [(0, jsx_runtime_1.jsx)("span", { className: cls('formFieldLabel', 'atlas-field-label'), children: t(labelKey) }), (0, jsx_runtime_1.jsx)("input", { className: inputClass, type: type, name: name, autoComplete: autoComplete, required: true, value: values[name] ?? '', onChange: (e) => set(name, e.target.value) }), fieldErrors(name)] }, name));
|
|
114
|
+
const links = showLegal
|
|
115
|
+
? [
|
|
116
|
+
legal.termsUrl ? ((0, jsx_runtime_1.jsx)("a", { className: cls('link', 'atlas-link'), href: legal.termsUrl, target: "_blank", rel: "noopener noreferrer", children: t('signUp.terms') }, "terms")) : null,
|
|
117
|
+
legal.privacyUrl ? ((0, jsx_runtime_1.jsx)("a", { className: cls('link', 'atlas-link'), href: legal.privacyUrl, target: "_blank", rel: "noopener noreferrer", children: t('signUp.privacy') }, "privacy")) : null,
|
|
118
|
+
].filter((x) => x !== null)
|
|
119
|
+
: [];
|
|
120
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: cardClass, children: [hideTitle ? null : (0, jsx_runtime_1.jsx)("h1", { className: titleClass, children: t('signUp.title') }), errors
|
|
121
|
+
.filter((error) => !error.param)
|
|
122
|
+
.map((error) => ((0, jsx_runtime_1.jsx)("p", { className: errorClass, role: "alert", children: error.message }, error.code))), (0, jsx_runtime_1.jsxs)("form", { onSubmit: (event) => {
|
|
123
|
+
event.preventDefault();
|
|
124
|
+
if (!consentOk)
|
|
125
|
+
return;
|
|
126
|
+
onSubmit(values, legal?.required ? agreed : true);
|
|
127
|
+
}, children: [(settings?.signUpFields ?? []).map((f) => {
|
|
128
|
+
const body = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: cls('formFieldLabel', 'atlas-field-label'), children: label(f) }), control(f), fieldErrors(f.key)] }));
|
|
129
|
+
// A choice group holds several inputs, so it can't sit inside one <label>.
|
|
130
|
+
return f.type === 'radio' || f.type === 'multiselect' ? ((0, jsx_runtime_1.jsx)("div", { className: cls('formField', 'atlas-field'), children: body }, f.key)) : ((0, jsx_runtime_1.jsx)("label", { className: cls('formField', 'atlas-field'), children: body }, f.key));
|
|
131
|
+
}), textField('email', 'signUp.emailLabel', 'email', 'email'), textField('password', 'signUp.passwordLabel', 'password', 'new-password'), showLegal ? ((0, jsx_runtime_1.jsxs)("label", { className: cls('formField', 'atlas-consent'), children: [legal.required ? ((0, jsx_runtime_1.jsx)("input", { type: "checkbox", name: "consent", checked: agreed, onChange: (e) => setAgreed(e.target.checked) })) : null, (0, jsx_runtime_1.jsxs)("span", { className: cls('text', 'atlas-text'), children: [t(legal.required ? 'signUp.consentAgree' : 'signUp.consentNotice'), ' ', links.map((link, i) => ((0, jsx_runtime_1.jsxs)("span", { children: [i > 0 ? ` ${t('signUp.and')} ` : null, link] }, i))), "."] }), fieldErrors('consent')] })) : null, (0, jsx_runtime_1.jsx)(captcha_1.CaptchaSlot, { controller: captcha }), (0, jsx_runtime_1.jsx)("button", { className: buttonClass, disabled: busy || !consentOk, type: "submit", children: t('signUp.submit') })] })] }));
|
|
14
132
|
}
|
|
15
133
|
/**
|
|
16
134
|
* §5.1 headless sign-up — the sign-up counterpart of {@link useSignIn}. Starts a
|
package/dist/sign-up.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-up.js","sourceRoot":"","sources":["../src/sign-up.tsx"],"names":[],"mappings":";;AAMA,wBAaC;AAQD,8BA2BC;;AAtDD,iCAA6C;AAC7C,sCAA4C;AAC5C,mDAA2C;AAC3C,iCAAo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(`appearance.elements` classes, or the host's own CSS) are APPENDED and land
|
|
18
18
|
* later in the cascade, so they win on equal specificity — the base never fights
|
|
19
19
|
* an override.
|
|
20
|
+
*
|
|
21
|
+
* Accessibility floor: label text on a primary fill reads
|
|
22
|
+
* `--atlas-color-text-on-primary` (contrast-picked from the primary by
|
|
23
|
+
* `resolveTokens`), every interactive element gets a solid 2px
|
|
24
|
+
* `:focus-visible` outline in `--atlas-color-focus-ring` (a glow alone is too
|
|
25
|
+
* faint to find the focus by), and inputs are never under 16px so iOS Safari
|
|
26
|
+
* does not zoom the page on focus.
|
|
20
27
|
*/
|
|
21
28
|
export declare const ATLAS_STYLE_ELEMENT_ID = "atlas-base-styles";
|
|
22
29
|
export declare const ATLAS_BASE_CSS: string;
|
|
@@ -39,9 +46,14 @@ export declare const ATLAS_BASE_CSS: string;
|
|
|
39
46
|
export declare const ATLAS_DESIGN_CSS: string;
|
|
40
47
|
/**
|
|
41
48
|
* The full stylesheet the provider renders: base rules + design-system rules.
|
|
42
|
-
* (Exported separately so the base rules
|
|
43
|
-
*
|
|
49
|
+
* (Exported separately so the base rules are pinned by a hash — they change
|
|
50
|
+
* only deliberately, as in 0.5.0 for accessibility.)
|
|
51
|
+
*/
|
|
52
|
+
/**
|
|
53
|
+
* Rules for the create-account form and the captcha slot (added in 0.5.0). Kept
|
|
54
|
+
* out of {@link ATLAS_BASE_CSS} so the base rules stay byte-identical.
|
|
44
55
|
*/
|
|
56
|
+
export declare const ATLAS_FLOW_CSS = ".atlas-captcha{display:flex;justify-content:center;}\n.atlas-captcha:empty{display:none;}\n.atlas-consent{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-start;font-size:.875rem;}\n.atlas-choices{display:flex;flex-direction:column;gap:6px;}\n.atlas-choice{display:flex;gap:6px;align-items:center;font-weight:400;}";
|
|
45
57
|
export declare const ATLAS_STYLES_CSS: string;
|
|
46
58
|
/**
|
|
47
59
|
* Inject the base stylesheet once. Idempotent (guards on the element id), so
|
package/dist/styles.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ATLAS_STYLES_CSS = exports.ATLAS_DESIGN_CSS = exports.ATLAS_BASE_CSS = exports.ATLAS_STYLE_ELEMENT_ID = void 0;
|
|
3
|
+
exports.ATLAS_STYLES_CSS = exports.ATLAS_FLOW_CSS = exports.ATLAS_DESIGN_CSS = exports.ATLAS_BASE_CSS = exports.ATLAS_STYLE_ELEMENT_ID = void 0;
|
|
4
4
|
exports.injectAtlasStyles = injectAtlasStyles;
|
|
5
5
|
/**
|
|
6
6
|
* §10.3 base component styles.
|
|
@@ -21,6 +21,13 @@ exports.injectAtlasStyles = injectAtlasStyles;
|
|
|
21
21
|
* (`appearance.elements` classes, or the host's own CSS) are APPENDED and land
|
|
22
22
|
* later in the cascade, so they win on equal specificity — the base never fights
|
|
23
23
|
* an override.
|
|
24
|
+
*
|
|
25
|
+
* Accessibility floor: label text on a primary fill reads
|
|
26
|
+
* `--atlas-color-text-on-primary` (contrast-picked from the primary by
|
|
27
|
+
* `resolveTokens`), every interactive element gets a solid 2px
|
|
28
|
+
* `:focus-visible` outline in `--atlas-color-focus-ring` (a glow alone is too
|
|
29
|
+
* faint to find the focus by), and inputs are never under 16px so iOS Safari
|
|
30
|
+
* does not zoom the page on focus.
|
|
24
31
|
*/
|
|
25
32
|
exports.ATLAS_STYLE_ELEMENT_ID = 'atlas-base-styles';
|
|
26
33
|
exports.ATLAS_BASE_CSS = `
|
|
@@ -35,10 +42,11 @@ exports.ATLAS_BASE_CSS = `
|
|
|
35
42
|
.atlas-field{display:flex;flex-direction:column;gap:calc(var(--atlas-spacing-unit,4px) * 1.5);font-size:.875rem;}
|
|
36
43
|
.atlas-field > span{font-weight:500;color:var(--atlas-color-text,#1c1c1f);}
|
|
37
44
|
|
|
38
|
-
.atlas-input{width:100%;padding:10px 12px;font-size
|
|
39
|
-
.atlas-input:focus{border-color:var(--atlas-color-primary,#5b5bd6);
|
|
45
|
+
.atlas-input{width:100%;padding:10px 12px;font-size:max(16px,.95rem);font-family:inherit;color:var(--atlas-color-text,#1c1c1f);background:var(--atlas-color-background,#fff);border:1px solid var(--atlas-color-border,#e4e4e9);border-radius:var(--atlas-border-radius,8px);outline:none;transition:border-color .15s ease,box-shadow .15s ease;}
|
|
46
|
+
.atlas-input:focus{border-color:var(--atlas-color-primary,#5b5bd6);}
|
|
47
|
+
:is(.atlas-input,.atlas-button,.atlas-social-button,.atlas-menu-item,.atlas-tab,.atlas-avatar):focus-visible{outline:2px solid var(--atlas-color-focus-ring,var(--atlas-color-primary,#5b5bd6));outline-offset:2px;}
|
|
40
48
|
|
|
41
|
-
.atlas-button{display:inline-flex;align-items:center;justify-content:center;width:100%;min-height:40px;padding:10px 16px;font-size:.95rem;font-weight:600;font-family:inherit;color
|
|
49
|
+
.atlas-button{display:inline-flex;align-items:center;justify-content:center;width:100%;min-height:40px;padding:10px 16px;font-size:.95rem;font-weight:600;font-family:inherit;color:var(--atlas-color-text-on-primary,#fff);background:var(--atlas-color-primary,#5b5bd6);border:1px solid transparent;border-radius:var(--atlas-border-radius,8px);cursor:pointer;transition:filter .15s ease,opacity .15s ease;}
|
|
42
50
|
.atlas-button:hover:not(:disabled){filter:brightness(1.06);}
|
|
43
51
|
.atlas-button:active:not(:disabled){filter:brightness(.94);}
|
|
44
52
|
.atlas-button:disabled{opacity:.6;cursor:not-allowed;}
|
|
@@ -56,7 +64,7 @@ exports.ATLAS_BASE_CSS = `
|
|
|
56
64
|
.atlas-social-icon svg{width:18px;height:18px;display:block;}
|
|
57
65
|
|
|
58
66
|
.atlas-user-button{position:relative;display:inline-block;}
|
|
59
|
-
.atlas-avatar{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:none;border-radius:999px;overflow:hidden;background:var(--atlas-color-primary,#5b5bd6);color
|
|
67
|
+
.atlas-avatar{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:none;border-radius:999px;overflow:hidden;background:var(--atlas-color-primary,#5b5bd6);color:var(--atlas-color-text-on-primary,#fff);font-weight:600;font-size:.875rem;cursor:pointer;}
|
|
60
68
|
.atlas-avatar img{width:100%;height:100%;object-fit:cover;display:block;}
|
|
61
69
|
|
|
62
70
|
.atlas-menu{position:absolute;right:0;top:100%;margin-top:6px;min-width:12rem;display:flex;flex-direction:column;padding:4px;background:var(--atlas-color-background,#fff);border:1px solid var(--atlas-color-border,#e4e4e9);border-radius:var(--atlas-border-radius,8px);box-shadow:0 8px 24px rgba(0,0,0,.12);z-index:50;}
|
|
@@ -113,14 +121,14 @@ exports.ATLAS_DESIGN_CSS = `
|
|
|
113
121
|
:where(.atlas-root[data-atlas-design]) .atlas-account-field{display:flex;flex-direction:column;gap:calc(var(--atlas-space-unit) * 1.5);font-size:var(--atlas-font-size-sm);color:var(--atlas-color-text);}
|
|
114
122
|
:where(.atlas-root[data-atlas-design]) .atlas-account-input{padding:6px 10px;font-family:inherit;outline:none;}
|
|
115
123
|
|
|
116
|
-
:where(.atlas-root[data-atlas-design]) :is(.atlas-input,.atlas-account-input){min-height:var(--atlas-control-height);font-size:var(--atlas-font-size-base);color:var(--atlas-color-input-text);background:var(--atlas-color-input-background);border:var(--atlas-border-width) solid var(--atlas-color-border);border-radius:var(--atlas-radius-control);}
|
|
117
|
-
:where(.atlas-root[data-atlas-design]) :is(.atlas-input:focus,.atlas-account-input:focus){border-color:var(--atlas-color-primary);
|
|
124
|
+
:where(.atlas-root[data-atlas-design]) :is(.atlas-input,.atlas-account-input){min-height:var(--atlas-control-height);font-size:max(16px,var(--atlas-font-size-base));color:var(--atlas-color-input-text);background:var(--atlas-color-input-background);border:var(--atlas-border-width) solid var(--atlas-color-border);border-radius:var(--atlas-radius-control);}
|
|
125
|
+
:where(.atlas-root[data-atlas-design]) :is(.atlas-input:focus,.atlas-account-input:focus){border-color:var(--atlas-color-primary);}
|
|
126
|
+
:where(.atlas-root[data-atlas-design]) :is(.atlas-input,.atlas-account-input,.atlas-button,.atlas-button-secondary,.atlas-social-button,.atlas-menu-item,.atlas-tab,.atlas-avatar):focus-visible{outline:2px solid var(--atlas-focus-outline-color,var(--atlas-color-primary));outline-offset:2px;}
|
|
118
127
|
:where(.atlas-root[data-atlas-input="filled"]) :is(.atlas-input,.atlas-account-input){background:color-mix(in srgb,var(--atlas-color-text) 6%,var(--atlas-color-input-background));border-color:transparent;}
|
|
119
128
|
:where(.atlas-root[data-atlas-input="underline"]) :is(.atlas-input,.atlas-account-input){background:transparent;border-width:0 0 max(1px,var(--atlas-border-width)) 0;border-radius:0;padding-left:0;padding-right:0;}
|
|
120
129
|
:where(.atlas-root[data-atlas-input="underline"]) :is(.atlas-input,.atlas-account-input):focus{box-shadow:0 1px 0 0 var(--atlas-color-primary);}
|
|
121
130
|
|
|
122
|
-
:where(.atlas-root[data-atlas-design]) .atlas-button{min-height:var(--atlas-control-height);font-size:var(--atlas-font-size-base);color:var(--atlas-color-primary-ink);background:var(--atlas-color-primary);border-width:var(--atlas-border-width);border-radius:var(--atlas-radius-control);text-transform:var(--atlas-button-text-transform);letter-spacing:var(--atlas-button-letter-spacing);}
|
|
123
|
-
:where(.atlas-root[data-atlas-design]) :is(.atlas-button,.atlas-button-secondary,.atlas-social-button):focus-visible{outline:none;box-shadow:0 0 0 3px var(--atlas-color-focus-ring);}
|
|
131
|
+
:where(.atlas-root[data-atlas-design]) .atlas-button{min-height:var(--atlas-control-height);font-size:var(--atlas-font-size-base);color:var(--atlas-color-text-on-primary,var(--atlas-color-primary-ink));background:var(--atlas-color-primary);border-width:var(--atlas-border-width);border-radius:var(--atlas-radius-control);text-transform:var(--atlas-button-text-transform);letter-spacing:var(--atlas-button-letter-spacing);}
|
|
124
132
|
:where(.atlas-root[data-atlas-button="outline"]) .atlas-button{background:transparent;color:var(--atlas-color-primary-text);border:max(1px,var(--atlas-border-width)) solid var(--atlas-color-primary);}
|
|
125
133
|
:where(.atlas-root[data-atlas-button="soft"]) .atlas-button{background:color-mix(in srgb,var(--atlas-color-primary) 14%,transparent);color:var(--atlas-color-primary-text);border-color:transparent;}
|
|
126
134
|
:where(.atlas-root[data-atlas-button="gradient"]) .atlas-button{background:linear-gradient(135deg,var(--atlas-color-primary),var(--atlas-color-accent));}
|
|
@@ -131,7 +139,7 @@ exports.ATLAS_DESIGN_CSS = `
|
|
|
131
139
|
|
|
132
140
|
:where(.atlas-root[data-atlas-social="icons"]) .atlas-social-label{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;}
|
|
133
141
|
|
|
134
|
-
:where(.atlas-root[data-atlas-design]) .atlas-avatar{background:var(--atlas-color-primary);color:var(--atlas-color-primary-ink);}
|
|
142
|
+
:where(.atlas-root[data-atlas-design]) .atlas-avatar{background:var(--atlas-color-primary);color:var(--atlas-color-text-on-primary,var(--atlas-color-primary-ink));}
|
|
135
143
|
:where(.atlas-root[data-atlas-design]) .atlas-menu{background:var(--atlas-color-surface);border:var(--atlas-card-border-width) solid var(--atlas-color-border);border-radius:var(--atlas-radius-card);box-shadow:var(--atlas-shadow-card);}
|
|
136
144
|
:where(.atlas-root[data-atlas-design]) .atlas-menu-item{color:var(--atlas-color-text);border-radius:var(--atlas-radius-control);}
|
|
137
145
|
:where(.atlas-root[data-atlas-design]) .atlas-tabs{border-bottom-color:var(--atlas-color-border);}
|
|
@@ -143,10 +151,19 @@ exports.ATLAS_DESIGN_CSS = `
|
|
|
143
151
|
`.trim();
|
|
144
152
|
/**
|
|
145
153
|
* The full stylesheet the provider renders: base rules + design-system rules.
|
|
146
|
-
* (Exported separately so the base rules
|
|
147
|
-
*
|
|
154
|
+
* (Exported separately so the base rules are pinned by a hash — they change
|
|
155
|
+
* only deliberately, as in 0.5.0 for accessibility.)
|
|
156
|
+
*/
|
|
157
|
+
/**
|
|
158
|
+
* Rules for the create-account form and the captcha slot (added in 0.5.0). Kept
|
|
159
|
+
* out of {@link ATLAS_BASE_CSS} so the base rules stay byte-identical.
|
|
148
160
|
*/
|
|
149
|
-
exports.
|
|
161
|
+
exports.ATLAS_FLOW_CSS = `.atlas-captcha{display:flex;justify-content:center;}
|
|
162
|
+
.atlas-captcha:empty{display:none;}
|
|
163
|
+
.atlas-consent{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-start;font-size:.875rem;}
|
|
164
|
+
.atlas-choices{display:flex;flex-direction:column;gap:6px;}
|
|
165
|
+
.atlas-choice{display:flex;gap:6px;align-items:center;font-weight:400;}`;
|
|
166
|
+
exports.ATLAS_STYLES_CSS = `${exports.ATLAS_BASE_CSS}\n${exports.ATLAS_DESIGN_CSS}\n${exports.ATLAS_FLOW_CSS}`;
|
|
150
167
|
/**
|
|
151
168
|
* Inject the base stylesheet once. Idempotent (guards on the element id), so
|
|
152
169
|
* multiple `<AtlasProvider>`s — or a re-mount — add it exactly once. A no-op
|
package/dist/styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":";;;AA4KA,8CAOC;AAnLD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACU,QAAA,sBAAsB,GAAG,mBAAmB,CAAC;AAE7C,QAAA,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmD7B,CAAC,IAAI,EAAE,CAAC;AAET;;;;;;;;;;;;;;;GAeG;AACU,QAAA,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkD/B,CAAC,IAAI,EAAE,CAAC;AAET;;;;GAIG;AACH;;;GAGG;AACU,QAAA,cAAc,GAAG;;;;wEAI0C,CAAC;AAE5D,QAAA,gBAAgB,GAAG,GAAG,sBAAc,KAAK,wBAAgB,KAAK,sBAAc,EAAE,CAAC;AAE5F;;;;GAIG;AACH,SAAgB,iBAAiB;IAC/B,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAO;IAC5C,IAAI,QAAQ,CAAC,cAAc,CAAC,8BAAsB,CAAC;QAAE,OAAO;IAC5D,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,EAAE,GAAG,8BAAsB,CAAC;IAClC,KAAK,CAAC,WAAW,GAAG,wBAAgB,CAAC;IACrC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlasauth/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@atlasauth/js": "0.
|
|
7
|
+
"@atlasauth/js": "0.7.0",
|
|
8
|
+
"@atlasauth/localizations": "0.2.0",
|
|
8
9
|
"@atlasauth/authz": "0.1.1",
|
|
9
|
-
"@atlasauth/design": "0.
|
|
10
|
+
"@atlasauth/design": "0.2.0"
|
|
10
11
|
},
|
|
11
12
|
"peerDependencies": {
|
|
12
13
|
"react": ">=18"
|