@nixxie-cms/auth 1.0.1

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 (42) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +6 -0
  3. package/components/Navigation/dist/nixxie-cms-auth-components-Navigation.cjs.d.ts +3 -0
  4. package/components/Navigation/dist/nixxie-cms-auth-components-Navigation.cjs.js +147 -0
  5. package/components/Navigation/dist/nixxie-cms-auth-components-Navigation.esm.js +143 -0
  6. package/components/Navigation/package.json +4 -0
  7. package/dist/declarations/src/components/Navigation.d.ts +6 -0
  8. package/dist/declarations/src/components/Navigation.d.ts.map +1 -0
  9. package/dist/declarations/src/index.d.ts +15 -0
  10. package/dist/declarations/src/index.d.ts.map +1 -0
  11. package/dist/declarations/src/pages/InitPage.d.ts +9 -0
  12. package/dist/declarations/src/pages/InitPage.d.ts.map +1 -0
  13. package/dist/declarations/src/pages/SigninPage.d.ts +9 -0
  14. package/dist/declarations/src/pages/SigninPage.d.ts.map +1 -0
  15. package/dist/declarations/src/types.d.ts +49 -0
  16. package/dist/declarations/src/types.d.ts.map +1 -0
  17. package/dist/nixxie-cms-auth.cjs.d.ts +2 -0
  18. package/dist/nixxie-cms-auth.cjs.js +552 -0
  19. package/dist/nixxie-cms-auth.esm.js +548 -0
  20. package/dist/useFromRedirect-2de239a9.cjs.js +26 -0
  21. package/dist/useFromRedirect-b3deee00.esm.js +24 -0
  22. package/package.json +56 -0
  23. package/pages/InitPage/dist/nixxie-cms-auth-pages-InitPage.cjs.d.ts +3 -0
  24. package/pages/InitPage/dist/nixxie-cms-auth-pages-InitPage.cjs.js +274 -0
  25. package/pages/InitPage/dist/nixxie-cms-auth-pages-InitPage.esm.js +266 -0
  26. package/pages/InitPage/package.json +4 -0
  27. package/pages/SigninPage/dist/nixxie-cms-auth-pages-SigninPage.cjs.d.ts +3 -0
  28. package/pages/SigninPage/dist/nixxie-cms-auth-pages-SigninPage.cjs.js +319 -0
  29. package/pages/SigninPage/dist/nixxie-cms-auth-pages-SigninPage.esm.js +311 -0
  30. package/pages/SigninPage/package.json +4 -0
  31. package/src/components/Navigation.tsx +182 -0
  32. package/src/gql/getBaseAuthSchema.ts +129 -0
  33. package/src/gql/getInitFirstItemSchema.ts +87 -0
  34. package/src/index.ts +291 -0
  35. package/src/lib/useFromRedirect.ts +23 -0
  36. package/src/pages/InitPage.tsx +292 -0
  37. package/src/pages/SigninPage.tsx +331 -0
  38. package/src/schema.ts +84 -0
  39. package/src/templates/config.ts +9 -0
  40. package/src/templates/init.ts +22 -0
  41. package/src/templates/signin.ts +20 -0
  42. package/src/types.ts +57 -0
@@ -0,0 +1,319 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var NextHead = require('next/head');
6
+ var react = require('react');
7
+ var notice = require('@keystar/ui/notice');
8
+ var passwordField = require('@keystar/ui/password-field');
9
+ var slots = require('@keystar/ui/slots');
10
+ var style = require('@keystar/ui/style');
11
+ var textField = require('@keystar/ui/text-field');
12
+ var typography = require('@keystar/ui/typography');
13
+ var apollo = require('@nixxie-cms/core/admin-ui/apollo');
14
+ var components = require('@nixxie-cms/core/admin-ui/components');
15
+ var router = require('@nixxie-cms/core/admin-ui/router');
16
+ var useFromRedirect = require('../../../dist/useFromRedirect-2de239a9.cjs.js');
17
+ var jsxRuntime = require('react/jsx-runtime');
18
+
19
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
20
+
21
+ var NextHead__default = /*#__PURE__*/_interopDefault(NextHead);
22
+
23
+ var SigninPage = props => () => /*#__PURE__*/jsxRuntime.jsx(SigninPage$1, {
24
+ ...props
25
+ });
26
+ function SigninPage$1({
27
+ identityField,
28
+ secretField,
29
+ authGqlNames
30
+ }) {
31
+ var _data$authenticate, _data$authenticate2;
32
+ const router$1 = router.useRouter();
33
+ const redirect = useFromRedirect.useRedirect();
34
+ const [state, setState] = react.useState({
35
+ identity: '',
36
+ secret: ''
37
+ });
38
+ const {
39
+ authenticateItemWithPassword,
40
+ ItemAuthenticationWithPasswordSuccess: successTypename,
41
+ ItemAuthenticationWithPasswordFailure: failureTypename
42
+ } = authGqlNames;
43
+ const [tryAuthenticate, {
44
+ error,
45
+ loading,
46
+ data
47
+ }] = apollo.useMutation(apollo.gql`
48
+ mutation NxAuthSignin ($identity: String!, $secret: String!) {
49
+ authenticate: ${authenticateItemWithPassword}(${identityField}: $identity, ${secretField}: $secret) {
50
+ ... on ${successTypename} {
51
+ item {
52
+ id
53
+ }
54
+ }
55
+ ... on ${failureTypename} {
56
+ message
57
+ }
58
+ }
59
+ }`, {
60
+ refetchQueries: ['NxFetchAdminMeta']
61
+ });
62
+ const onSubmit = async event => {
63
+ if (event.target !== event.currentTarget) return;
64
+ event.preventDefault();
65
+ try {
66
+ const {
67
+ data
68
+ } = await tryAuthenticate({
69
+ variables: {
70
+ identity: state.identity,
71
+ secret: state.secret
72
+ }
73
+ });
74
+ if (data !== null && data !== void 0 && data.authenticate.item) {
75
+ router$1.push(redirect);
76
+ }
77
+ } catch (e) {
78
+ console.error(e);
79
+ return;
80
+ }
81
+ };
82
+ const pending = loading || (data === null || data === void 0 || (_data$authenticate = data.authenticate) === null || _data$authenticate === void 0 ? void 0 : _data$authenticate.__typename) === successTypename;
83
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
84
+ children: [/*#__PURE__*/jsxRuntime.jsx(NextHead__default["default"], {
85
+ children: /*#__PURE__*/jsxRuntime.jsx("title", {
86
+ children: "Nixxie \u2014 Sign in"
87
+ }, "title")
88
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
89
+ className: style.css({
90
+ display: 'flex',
91
+ minHeight: '100vh',
92
+ fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
93
+ }),
94
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
95
+ className: style.css({
96
+ width: 420,
97
+ backgroundColor: '#000000',
98
+ display: 'flex',
99
+ flexDirection: 'column',
100
+ justifyContent: 'space-between',
101
+ padding: '48px',
102
+ flexShrink: 0,
103
+ '@media (max-width: 900px)': {
104
+ display: 'none'
105
+ }
106
+ }),
107
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
108
+ className: style.css({
109
+ display: 'flex',
110
+ alignItems: 'center',
111
+ gap: 10
112
+ }),
113
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
114
+ className: style.css({
115
+ display: 'inline-flex',
116
+ alignItems: 'center',
117
+ justifyContent: 'center',
118
+ width: 30,
119
+ height: 30,
120
+ borderRadius: 7,
121
+ border: '1.5px solid rgba(255,255,255,0.18)',
122
+ flexShrink: 0
123
+ }),
124
+ children: /*#__PURE__*/jsxRuntime.jsx("svg", {
125
+ width: "14",
126
+ height: "14",
127
+ viewBox: "0 0 14 14",
128
+ fill: "none",
129
+ children: /*#__PURE__*/jsxRuntime.jsx("path", {
130
+ d: "M2.5 11V3L11.5 11V3",
131
+ stroke: "white",
132
+ strokeWidth: "1.8",
133
+ strokeLinecap: "round",
134
+ strokeLinejoin: "round"
135
+ })
136
+ })
137
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
138
+ className: style.css({
139
+ fontSize: 15,
140
+ fontWeight: 600,
141
+ color: '#ffffff',
142
+ letterSpacing: '-0.03em',
143
+ lineHeight: 1
144
+ }),
145
+ children: "Nixxie"
146
+ })]
147
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
148
+ children: [/*#__PURE__*/jsxRuntime.jsxs("p", {
149
+ className: style.css({
150
+ margin: '0 0 16px',
151
+ fontSize: 34,
152
+ fontWeight: 700,
153
+ color: '#ffffff',
154
+ letterSpacing: '-0.04em',
155
+ lineHeight: 1.15
156
+ }),
157
+ children: ["Content.", /*#__PURE__*/jsxRuntime.jsx("br", {}), "Managed", /*#__PURE__*/jsxRuntime.jsx("br", {}), "Beautifully."]
158
+ }), /*#__PURE__*/jsxRuntime.jsxs("p", {
159
+ className: style.css({
160
+ margin: 0,
161
+ fontSize: 13.5,
162
+ color: 'rgba(255,255,255,0.38)',
163
+ lineHeight: 1.65
164
+ }),
165
+ children: ["A professional CMS built for modern", /*#__PURE__*/jsxRuntime.jsx("br", {}), "teams who care about craft."]
166
+ })]
167
+ }), /*#__PURE__*/jsxRuntime.jsx("p", {
168
+ className: style.css({
169
+ margin: 0,
170
+ fontSize: 10.5,
171
+ color: 'rgba(255,255,255,0.18)',
172
+ letterSpacing: '0.06em',
173
+ textTransform: 'uppercase'
174
+ }),
175
+ children: "Nixxie CMS"
176
+ })]
177
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
178
+ className: style.css({
179
+ flex: 1,
180
+ backgroundColor: '#ffffff',
181
+ display: 'flex',
182
+ alignItems: 'center',
183
+ justifyContent: 'center',
184
+ padding: '48px 64px',
185
+ '@media (max-width: 600px)': {
186
+ padding: '32px 24px'
187
+ }
188
+ }),
189
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
190
+ className: style.css({
191
+ width: '100%',
192
+ maxWidth: 360
193
+ }),
194
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
195
+ className: style.css({
196
+ display: 'inline-flex',
197
+ alignItems: 'center',
198
+ justifyContent: 'center',
199
+ width: 36,
200
+ height: 36,
201
+ borderRadius: 8,
202
+ backgroundColor: '#000000',
203
+ marginBottom: 32
204
+ }),
205
+ children: /*#__PURE__*/jsxRuntime.jsx("svg", {
206
+ width: "16",
207
+ height: "16",
208
+ viewBox: "0 0 14 14",
209
+ fill: "none",
210
+ children: /*#__PURE__*/jsxRuntime.jsx("path", {
211
+ d: "M2.5 11V3L11.5 11V3",
212
+ stroke: "white",
213
+ strokeWidth: "1.8",
214
+ strokeLinecap: "round",
215
+ strokeLinejoin: "round"
216
+ })
217
+ })
218
+ }), /*#__PURE__*/jsxRuntime.jsx("h1", {
219
+ className: style.css({
220
+ margin: '0 0 6px',
221
+ fontSize: 23,
222
+ fontWeight: 700,
223
+ color: '#0a0a0a',
224
+ letterSpacing: '-0.03em',
225
+ lineHeight: 1.2
226
+ }),
227
+ children: "Sign in"
228
+ }), /*#__PURE__*/jsxRuntime.jsx("p", {
229
+ className: style.css({
230
+ margin: '0 0 28px',
231
+ fontSize: 13.5,
232
+ color: '#8a8a8a',
233
+ lineHeight: 1.5
234
+ }),
235
+ children: "Welcome back. Enter your credentials to continue."
236
+ }), /*#__PURE__*/jsxRuntime.jsx(components.GraphQLErrorNotice, {
237
+ errors: [error]
238
+ }), (data === null || data === void 0 || (_data$authenticate2 = data.authenticate) === null || _data$authenticate2 === void 0 ? void 0 : _data$authenticate2.__typename) === failureTypename && /*#__PURE__*/jsxRuntime.jsx(notice.Notice, {
239
+ tone: "critical",
240
+ children: /*#__PURE__*/jsxRuntime.jsx(slots.Content, {
241
+ children: /*#__PURE__*/jsxRuntime.jsx(typography.Text, {
242
+ children: data === null || data === void 0 ? void 0 : data.authenticate.message
243
+ })
244
+ })
245
+ }), /*#__PURE__*/jsxRuntime.jsxs("form", {
246
+ onSubmit: onSubmit,
247
+ className: style.css({
248
+ display: 'flex',
249
+ flexDirection: 'column',
250
+ gap: 16
251
+ }),
252
+ children: [/*#__PURE__*/jsxRuntime.jsx(textField.TextField, {
253
+ autoFocus: true,
254
+ id: "identity",
255
+ isRequired: true,
256
+ label: capitalizeFirstLetter(identityField),
257
+ name: "identity",
258
+ onChange: v => setState({
259
+ ...state,
260
+ identity: v
261
+ }),
262
+ value: state.identity
263
+ }), /*#__PURE__*/jsxRuntime.jsx(passwordField.PasswordField, {
264
+ id: "password",
265
+ isRequired: true,
266
+ label: capitalizeFirstLetter(secretField)
267
+ // @ts-expect-error — valid prop, types need to be fixed in "@keystar/ui"
268
+ ,
269
+ name: "password",
270
+ onChange: v => setState({
271
+ ...state,
272
+ secret: v
273
+ }),
274
+ type: "password",
275
+ value: state.secret
276
+ }), /*#__PURE__*/jsxRuntime.jsx("button", {
277
+ type: "submit",
278
+ disabled: pending,
279
+ className: style.css({
280
+ marginTop: 4,
281
+ display: 'flex',
282
+ alignItems: 'center',
283
+ justifyContent: 'center',
284
+ paddingInline: 20,
285
+ paddingBlock: 11,
286
+ backgroundColor: '#000000',
287
+ color: '#ffffff',
288
+ borderRadius: 7,
289
+ fontSize: 14,
290
+ fontWeight: 600,
291
+ letterSpacing: '-0.01em',
292
+ cursor: pending ? 'default' : 'pointer',
293
+ opacity: pending ? 0.6 : 1,
294
+ transition: 'opacity 150ms, background-color 150ms',
295
+ width: '100%',
296
+ border: 'none',
297
+ fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, sans-serif",
298
+ '&:hover:not(:disabled)': {
299
+ backgroundColor: '#1a1a1a'
300
+ },
301
+ '&:focus-visible': {
302
+ outline: '2px solid #000',
303
+ outlineOffset: 3,
304
+ borderRadius: 7
305
+ }
306
+ }),
307
+ children: pending ? 'Signing in…' : 'Sign in'
308
+ })]
309
+ })]
310
+ })
311
+ })]
312
+ })]
313
+ });
314
+ }
315
+ function capitalizeFirstLetter(value) {
316
+ return value.charAt(0).toUpperCase() + value.slice(1);
317
+ }
318
+
319
+ exports["default"] = SigninPage;
@@ -0,0 +1,311 @@
1
+ import NextHead from 'next/head';
2
+ import { useState } from 'react';
3
+ import { Notice } from '@keystar/ui/notice';
4
+ import { PasswordField } from '@keystar/ui/password-field';
5
+ import { Content } from '@keystar/ui/slots';
6
+ import { css } from '@keystar/ui/style';
7
+ import { TextField } from '@keystar/ui/text-field';
8
+ import { Text } from '@keystar/ui/typography';
9
+ import { useMutation, gql } from '@nixxie-cms/core/admin-ui/apollo';
10
+ import { GraphQLErrorNotice } from '@nixxie-cms/core/admin-ui/components';
11
+ import { useRouter } from '@nixxie-cms/core/admin-ui/router';
12
+ import { u as useRedirect } from '../../../dist/useFromRedirect-b3deee00.esm.js';
13
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
14
+
15
+ var SigninPage = props => () => /*#__PURE__*/jsx(SigninPage$1, {
16
+ ...props
17
+ });
18
+ function SigninPage$1({
19
+ identityField,
20
+ secretField,
21
+ authGqlNames
22
+ }) {
23
+ var _data$authenticate, _data$authenticate2;
24
+ const router = useRouter();
25
+ const redirect = useRedirect();
26
+ const [state, setState] = useState({
27
+ identity: '',
28
+ secret: ''
29
+ });
30
+ const {
31
+ authenticateItemWithPassword,
32
+ ItemAuthenticationWithPasswordSuccess: successTypename,
33
+ ItemAuthenticationWithPasswordFailure: failureTypename
34
+ } = authGqlNames;
35
+ const [tryAuthenticate, {
36
+ error,
37
+ loading,
38
+ data
39
+ }] = useMutation(gql`
40
+ mutation NxAuthSignin ($identity: String!, $secret: String!) {
41
+ authenticate: ${authenticateItemWithPassword}(${identityField}: $identity, ${secretField}: $secret) {
42
+ ... on ${successTypename} {
43
+ item {
44
+ id
45
+ }
46
+ }
47
+ ... on ${failureTypename} {
48
+ message
49
+ }
50
+ }
51
+ }`, {
52
+ refetchQueries: ['NxFetchAdminMeta']
53
+ });
54
+ const onSubmit = async event => {
55
+ if (event.target !== event.currentTarget) return;
56
+ event.preventDefault();
57
+ try {
58
+ const {
59
+ data
60
+ } = await tryAuthenticate({
61
+ variables: {
62
+ identity: state.identity,
63
+ secret: state.secret
64
+ }
65
+ });
66
+ if (data !== null && data !== void 0 && data.authenticate.item) {
67
+ router.push(redirect);
68
+ }
69
+ } catch (e) {
70
+ console.error(e);
71
+ return;
72
+ }
73
+ };
74
+ const pending = loading || (data === null || data === void 0 || (_data$authenticate = data.authenticate) === null || _data$authenticate === void 0 ? void 0 : _data$authenticate.__typename) === successTypename;
75
+ return /*#__PURE__*/jsxs(Fragment, {
76
+ children: [/*#__PURE__*/jsx(NextHead, {
77
+ children: /*#__PURE__*/jsx("title", {
78
+ children: "Nixxie \u2014 Sign in"
79
+ }, "title")
80
+ }), /*#__PURE__*/jsxs("div", {
81
+ className: css({
82
+ display: 'flex',
83
+ minHeight: '100vh',
84
+ fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
85
+ }),
86
+ children: [/*#__PURE__*/jsxs("div", {
87
+ className: css({
88
+ width: 420,
89
+ backgroundColor: '#000000',
90
+ display: 'flex',
91
+ flexDirection: 'column',
92
+ justifyContent: 'space-between',
93
+ padding: '48px',
94
+ flexShrink: 0,
95
+ '@media (max-width: 900px)': {
96
+ display: 'none'
97
+ }
98
+ }),
99
+ children: [/*#__PURE__*/jsxs("div", {
100
+ className: css({
101
+ display: 'flex',
102
+ alignItems: 'center',
103
+ gap: 10
104
+ }),
105
+ children: [/*#__PURE__*/jsx("span", {
106
+ className: css({
107
+ display: 'inline-flex',
108
+ alignItems: 'center',
109
+ justifyContent: 'center',
110
+ width: 30,
111
+ height: 30,
112
+ borderRadius: 7,
113
+ border: '1.5px solid rgba(255,255,255,0.18)',
114
+ flexShrink: 0
115
+ }),
116
+ children: /*#__PURE__*/jsx("svg", {
117
+ width: "14",
118
+ height: "14",
119
+ viewBox: "0 0 14 14",
120
+ fill: "none",
121
+ children: /*#__PURE__*/jsx("path", {
122
+ d: "M2.5 11V3L11.5 11V3",
123
+ stroke: "white",
124
+ strokeWidth: "1.8",
125
+ strokeLinecap: "round",
126
+ strokeLinejoin: "round"
127
+ })
128
+ })
129
+ }), /*#__PURE__*/jsx("span", {
130
+ className: css({
131
+ fontSize: 15,
132
+ fontWeight: 600,
133
+ color: '#ffffff',
134
+ letterSpacing: '-0.03em',
135
+ lineHeight: 1
136
+ }),
137
+ children: "Nixxie"
138
+ })]
139
+ }), /*#__PURE__*/jsxs("div", {
140
+ children: [/*#__PURE__*/jsxs("p", {
141
+ className: css({
142
+ margin: '0 0 16px',
143
+ fontSize: 34,
144
+ fontWeight: 700,
145
+ color: '#ffffff',
146
+ letterSpacing: '-0.04em',
147
+ lineHeight: 1.15
148
+ }),
149
+ children: ["Content.", /*#__PURE__*/jsx("br", {}), "Managed", /*#__PURE__*/jsx("br", {}), "Beautifully."]
150
+ }), /*#__PURE__*/jsxs("p", {
151
+ className: css({
152
+ margin: 0,
153
+ fontSize: 13.5,
154
+ color: 'rgba(255,255,255,0.38)',
155
+ lineHeight: 1.65
156
+ }),
157
+ children: ["A professional CMS built for modern", /*#__PURE__*/jsx("br", {}), "teams who care about craft."]
158
+ })]
159
+ }), /*#__PURE__*/jsx("p", {
160
+ className: css({
161
+ margin: 0,
162
+ fontSize: 10.5,
163
+ color: 'rgba(255,255,255,0.18)',
164
+ letterSpacing: '0.06em',
165
+ textTransform: 'uppercase'
166
+ }),
167
+ children: "Nixxie CMS"
168
+ })]
169
+ }), /*#__PURE__*/jsx("div", {
170
+ className: css({
171
+ flex: 1,
172
+ backgroundColor: '#ffffff',
173
+ display: 'flex',
174
+ alignItems: 'center',
175
+ justifyContent: 'center',
176
+ padding: '48px 64px',
177
+ '@media (max-width: 600px)': {
178
+ padding: '32px 24px'
179
+ }
180
+ }),
181
+ children: /*#__PURE__*/jsxs("div", {
182
+ className: css({
183
+ width: '100%',
184
+ maxWidth: 360
185
+ }),
186
+ children: [/*#__PURE__*/jsx("div", {
187
+ className: css({
188
+ display: 'inline-flex',
189
+ alignItems: 'center',
190
+ justifyContent: 'center',
191
+ width: 36,
192
+ height: 36,
193
+ borderRadius: 8,
194
+ backgroundColor: '#000000',
195
+ marginBottom: 32
196
+ }),
197
+ children: /*#__PURE__*/jsx("svg", {
198
+ width: "16",
199
+ height: "16",
200
+ viewBox: "0 0 14 14",
201
+ fill: "none",
202
+ children: /*#__PURE__*/jsx("path", {
203
+ d: "M2.5 11V3L11.5 11V3",
204
+ stroke: "white",
205
+ strokeWidth: "1.8",
206
+ strokeLinecap: "round",
207
+ strokeLinejoin: "round"
208
+ })
209
+ })
210
+ }), /*#__PURE__*/jsx("h1", {
211
+ className: css({
212
+ margin: '0 0 6px',
213
+ fontSize: 23,
214
+ fontWeight: 700,
215
+ color: '#0a0a0a',
216
+ letterSpacing: '-0.03em',
217
+ lineHeight: 1.2
218
+ }),
219
+ children: "Sign in"
220
+ }), /*#__PURE__*/jsx("p", {
221
+ className: css({
222
+ margin: '0 0 28px',
223
+ fontSize: 13.5,
224
+ color: '#8a8a8a',
225
+ lineHeight: 1.5
226
+ }),
227
+ children: "Welcome back. Enter your credentials to continue."
228
+ }), /*#__PURE__*/jsx(GraphQLErrorNotice, {
229
+ errors: [error]
230
+ }), (data === null || data === void 0 || (_data$authenticate2 = data.authenticate) === null || _data$authenticate2 === void 0 ? void 0 : _data$authenticate2.__typename) === failureTypename && /*#__PURE__*/jsx(Notice, {
231
+ tone: "critical",
232
+ children: /*#__PURE__*/jsx(Content, {
233
+ children: /*#__PURE__*/jsx(Text, {
234
+ children: data === null || data === void 0 ? void 0 : data.authenticate.message
235
+ })
236
+ })
237
+ }), /*#__PURE__*/jsxs("form", {
238
+ onSubmit: onSubmit,
239
+ className: css({
240
+ display: 'flex',
241
+ flexDirection: 'column',
242
+ gap: 16
243
+ }),
244
+ children: [/*#__PURE__*/jsx(TextField, {
245
+ autoFocus: true,
246
+ id: "identity",
247
+ isRequired: true,
248
+ label: capitalizeFirstLetter(identityField),
249
+ name: "identity",
250
+ onChange: v => setState({
251
+ ...state,
252
+ identity: v
253
+ }),
254
+ value: state.identity
255
+ }), /*#__PURE__*/jsx(PasswordField, {
256
+ id: "password",
257
+ isRequired: true,
258
+ label: capitalizeFirstLetter(secretField)
259
+ // @ts-expect-error — valid prop, types need to be fixed in "@keystar/ui"
260
+ ,
261
+ name: "password",
262
+ onChange: v => setState({
263
+ ...state,
264
+ secret: v
265
+ }),
266
+ type: "password",
267
+ value: state.secret
268
+ }), /*#__PURE__*/jsx("button", {
269
+ type: "submit",
270
+ disabled: pending,
271
+ className: css({
272
+ marginTop: 4,
273
+ display: 'flex',
274
+ alignItems: 'center',
275
+ justifyContent: 'center',
276
+ paddingInline: 20,
277
+ paddingBlock: 11,
278
+ backgroundColor: '#000000',
279
+ color: '#ffffff',
280
+ borderRadius: 7,
281
+ fontSize: 14,
282
+ fontWeight: 600,
283
+ letterSpacing: '-0.01em',
284
+ cursor: pending ? 'default' : 'pointer',
285
+ opacity: pending ? 0.6 : 1,
286
+ transition: 'opacity 150ms, background-color 150ms',
287
+ width: '100%',
288
+ border: 'none',
289
+ fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, sans-serif",
290
+ '&:hover:not(:disabled)': {
291
+ backgroundColor: '#1a1a1a'
292
+ },
293
+ '&:focus-visible': {
294
+ outline: '2px solid #000',
295
+ outlineOffset: 3,
296
+ borderRadius: 7
297
+ }
298
+ }),
299
+ children: pending ? 'Signing in…' : 'Sign in'
300
+ })]
301
+ })]
302
+ })
303
+ })]
304
+ })]
305
+ });
306
+ }
307
+ function capitalizeFirstLetter(value) {
308
+ return value.charAt(0).toUpperCase() + value.slice(1);
309
+ }
310
+
311
+ export { SigninPage as default };
@@ -0,0 +1,4 @@
1
+ {
2
+ "main": "dist/nixxie-cms-auth-pages-SigninPage.cjs.js",
3
+ "module": "dist/nixxie-cms-auth-pages-SigninPage.esm.js"
4
+ }