@byline/ui 2.4.0 → 2.4.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 (95) hide show
  1. package/dist/react.d.ts +10 -18
  2. package/dist/react.js +2 -15
  3. package/dist/{admin/components/collections → widgets/diff-viewer}/diff-modal.d.ts +8 -1
  4. package/dist/{admin/components/collections → widgets/diff-viewer}/diff-modal.js +4 -6
  5. package/dist/widgets/diff-viewer/diff-modal.module.js +14 -0
  6. package/dist/{admin/components/collections → widgets/diff-viewer}/diff-modal_module.css +9 -9
  7. package/dist/{admin/components/collections → widgets/status-badge}/status-badge.js +1 -1
  8. package/dist/{admin/components/collections → widgets/status-badge}/status-badge.module.js +3 -3
  9. package/dist/{admin/components/collections → widgets/status-badge}/status-badge_module.css +3 -3
  10. package/package.json +2 -4
  11. package/src/react.ts +12 -34
  12. package/src/{admin/components/collections → widgets/diff-viewer}/diff-modal.tsx +16 -5
  13. package/src/{admin/components/collections → widgets/status-badge}/status-badge.tsx +1 -1
  14. package/dist/admin/components/admin-account/change-password.d.ts +0 -8
  15. package/dist/admin/components/admin-account/change-password.js +0 -192
  16. package/dist/admin/components/admin-account/change-password.module.js +0 -8
  17. package/dist/admin/components/admin-account/change-password_module.css +0 -27
  18. package/dist/admin/components/admin-account/container.d.ts +0 -29
  19. package/dist/admin/components/admin-account/container.js +0 -299
  20. package/dist/admin/components/admin-account/container.module.js +0 -28
  21. package/dist/admin/components/admin-account/container_module.css +0 -106
  22. package/dist/admin/components/admin-account/update.d.ts +0 -8
  23. package/dist/admin/components/admin-account/update.js +0 -207
  24. package/dist/admin/components/admin-account/update.module.js +0 -8
  25. package/dist/admin/components/admin-account/update_module.css +0 -27
  26. package/dist/admin/components/admin-permissions/inspector.d.ts +0 -4
  27. package/dist/admin/components/admin-permissions/inspector.js +0 -284
  28. package/dist/admin/components/admin-permissions/inspector.module.js +0 -56
  29. package/dist/admin/components/admin-permissions/inspector_module.css +0 -238
  30. package/dist/admin/components/admin-roles/create.d.ts +0 -7
  31. package/dist/admin/components/admin-roles/create.js +0 -177
  32. package/dist/admin/components/admin-roles/create.module.js +0 -8
  33. package/dist/admin/components/admin-roles/create_module.css +0 -27
  34. package/dist/admin/components/admin-roles/permissions.d.ts +0 -10
  35. package/dist/admin/components/admin-roles/permissions.js +0 -303
  36. package/dist/admin/components/admin-roles/permissions.module.js +0 -44
  37. package/dist/admin/components/admin-roles/permissions_module.css +0 -192
  38. package/dist/admin/components/admin-roles/update.d.ts +0 -8
  39. package/dist/admin/components/admin-roles/update.js +0 -166
  40. package/dist/admin/components/admin-roles/update.module.js +0 -8
  41. package/dist/admin/components/admin-roles/update_module.css +0 -27
  42. package/dist/admin/components/admin-users/create.d.ts +0 -8
  43. package/dist/admin/components/admin-users/create.js +0 -268
  44. package/dist/admin/components/admin-users/create.module.js +0 -10
  45. package/dist/admin/components/admin-users/create_module.css +0 -45
  46. package/dist/admin/components/admin-users/roles.d.ts +0 -11
  47. package/dist/admin/components/admin-users/roles.js +0 -148
  48. package/dist/admin/components/admin-users/roles.module.js +0 -18
  49. package/dist/admin/components/admin-users/roles_module.css +0 -75
  50. package/dist/admin/components/admin-users/set-password.d.ts +0 -8
  51. package/dist/admin/components/admin-users/set-password.js +0 -170
  52. package/dist/admin/components/admin-users/set-password.module.js +0 -9
  53. package/dist/admin/components/admin-users/set-password_module.css +0 -31
  54. package/dist/admin/components/admin-users/update.d.ts +0 -8
  55. package/dist/admin/components/admin-users/update.js +0 -254
  56. package/dist/admin/components/admin-users/update.module.js +0 -9
  57. package/dist/admin/components/admin-users/update_module.css +0 -34
  58. package/dist/admin/components/auth/sign-in-form.d.ts +0 -12
  59. package/dist/admin/components/auth/sign-in-form.js +0 -115
  60. package/dist/admin/components/auth/sign-in-form.module.js +0 -12
  61. package/dist/admin/components/auth/sign-in-form_module.css +0 -41
  62. package/dist/admin/components/collections/diff-modal.module.js +0 -14
  63. package/dist/services/admin-services-context.d.ts +0 -16
  64. package/dist/services/admin-services-context.js +0 -13
  65. package/dist/services/admin-services-types.d.ts +0 -129
  66. package/dist/services/admin-services-types.js +0 -1
  67. package/src/admin/components/admin-account/change-password.module.css +0 -40
  68. package/src/admin/components/admin-account/change-password.tsx +0 -232
  69. package/src/admin/components/admin-account/container.module.css +0 -158
  70. package/src/admin/components/admin-account/container.tsx +0 -230
  71. package/src/admin/components/admin-account/update.module.css +0 -40
  72. package/src/admin/components/admin-account/update.tsx +0 -263
  73. package/src/admin/components/admin-permissions/inspector.module.css +0 -326
  74. package/src/admin/components/admin-permissions/inspector.tsx +0 -298
  75. package/src/admin/components/admin-roles/create.module.css +0 -40
  76. package/src/admin/components/admin-roles/create.tsx +0 -218
  77. package/src/admin/components/admin-roles/permissions.module.css +0 -279
  78. package/src/admin/components/admin-roles/permissions.tsx +0 -396
  79. package/src/admin/components/admin-roles/update.module.css +0 -40
  80. package/src/admin/components/admin-roles/update.tsx +0 -218
  81. package/src/admin/components/admin-users/create.module.css +0 -63
  82. package/src/admin/components/admin-users/create.tsx +0 -323
  83. package/src/admin/components/admin-users/roles.module.css +0 -119
  84. package/src/admin/components/admin-users/roles.tsx +0 -172
  85. package/src/admin/components/admin-users/set-password.module.css +0 -46
  86. package/src/admin/components/admin-users/set-password.tsx +0 -199
  87. package/src/admin/components/admin-users/update.module.css +0 -49
  88. package/src/admin/components/admin-users/update.tsx +0 -328
  89. package/src/admin/components/auth/sign-in-form.module.css +0 -62
  90. package/src/admin/components/auth/sign-in-form.tsx +0 -132
  91. package/src/services/admin-services-context.tsx +0 -35
  92. package/src/services/admin-services-types.ts +0 -177
  93. /package/dist/{admin/components/collections → widgets/status-badge}/status-badge.d.ts +0 -0
  94. /package/src/{admin/components/collections → widgets/diff-viewer}/diff-modal.module.css +0 -0
  95. /package/src/{admin/components/collections → widgets/status-badge}/status-badge.module.css +0 -0
@@ -1,29 +0,0 @@
1
- /**
2
- * This Source Code is subject to the terms of the Mozilla Public
3
- * License, v. 2.0. If a copy of the MPL was not distributed with this
4
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
- *
6
- * Copyright (c) Infonomic Company Limited
7
- */
8
- /**
9
- * Self-service account container.
10
- *
11
- * Same drawer pattern as `admin-users/ui/container.tsx` but
12
- * narrower: only Profile and Password sections (no Roles, no
13
- * Delete) — those are admin-only actions on someone else, not
14
- * self-service. Each card surfaces the read-only summary plus an
15
- * "Edit" affordance that opens the matching drawer.
16
- *
17
- * Forms lift the fresh `AccountResponse` back into local state on
18
- * success so the container's bumped `vid` is in hand for any
19
- * subsequent edit without a refetch.
20
- *
21
- * Stable override handles: see `container.module.css`.
22
- */
23
- import type React from 'react';
24
- import type { AccountResponse } from '@byline/admin/admin-account';
25
- interface AccountSelfContainerProps {
26
- account: AccountResponse;
27
- }
28
- export declare function AccountSelfContainer({ account }: AccountSelfContainerProps): React.JSX.Element;
29
- export {};
@@ -1,299 +0,0 @@
1
- "use client";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { useState } from "react";
4
- import classnames from "classnames";
5
- import { LocalDateTime } from "../../../fields/local-date-time.js";
6
- import { Button, CloseIcon, Drawer, EditIcon, IconButton } from "../../../uikit.js";
7
- import { ChangeAccountPassword } from "./change-password.js";
8
- import container_module from "./container.module.js";
9
- import { UpdateAccount } from "./update.js";
10
- const panels = {
11
- update: {
12
- title: 'Profile',
13
- component: UpdateAccount
14
- },
15
- change_password: {
16
- title: 'Change Password',
17
- component: ChangeAccountPassword
18
- },
19
- empty: {
20
- title: '',
21
- component: ()=>null
22
- }
23
- };
24
- function ContainerSection({ title, onEdit, children }) {
25
- return /*#__PURE__*/ jsxs("div", {
26
- className: classnames('byline-account-section', container_module.section),
27
- children: [
28
- /*#__PURE__*/ jsxs("div", {
29
- className: classnames('byline-account-section-head', container_module["section-head"]),
30
- children: [
31
- /*#__PURE__*/ jsx("h2", {
32
- children: title
33
- }),
34
- onEdit ? /*#__PURE__*/ jsx(IconButton, {
35
- variant: "text",
36
- onClick: onEdit,
37
- "aria-label": `Edit ${title}`,
38
- children: /*#__PURE__*/ jsx(EditIcon, {
39
- width: "20px",
40
- height: "20px"
41
- })
42
- }) : null
43
- ]
44
- }),
45
- /*#__PURE__*/ jsx("div", {
46
- children: children
47
- })
48
- ]
49
- });
50
- }
51
- function AccountSelfContainer({ account }) {
52
- const [currentAccount, setCurrentAccount] = useState(account);
53
- const [current, setCurrent] = useState('empty');
54
- const [isDrawerOpen, setIsDrawerOpen] = useState(false);
55
- const openDrawer = (key)=>()=>{
56
- setCurrent(key);
57
- setIsDrawerOpen(true);
58
- };
59
- const closeDrawer = ()=>{
60
- setCurrent('empty');
61
- setIsDrawerOpen(false);
62
- };
63
- const handleSuccess = (updated)=>{
64
- setCurrentAccount(updated);
65
- };
66
- const Panel = panels[current].component;
67
- return /*#__PURE__*/ jsxs(Fragment, {
68
- children: [
69
- /*#__PURE__*/ jsxs("div", {
70
- className: classnames('byline-account-grid', container_module.grid),
71
- children: [
72
- /*#__PURE__*/ jsx("div", {
73
- className: classnames('byline-account-column', container_module.column),
74
- children: /*#__PURE__*/ jsxs(ContainerSection, {
75
- title: "Profile",
76
- onEdit: openDrawer('update'),
77
- children: [
78
- /*#__PURE__*/ jsxs("p", {
79
- className: classnames('byline-account-line', container_module.line),
80
- children: [
81
- /*#__PURE__*/ jsx("span", {
82
- className: "muted",
83
- children: "Email:"
84
- }),
85
- " ",
86
- currentAccount.email
87
- ]
88
- }),
89
- /*#__PURE__*/ jsxs("p", {
90
- className: classnames('byline-account-line', container_module.line),
91
- children: [
92
- /*#__PURE__*/ jsx("span", {
93
- className: "muted",
94
- children: "Given name:"
95
- }),
96
- ' ',
97
- currentAccount.given_name ?? /*#__PURE__*/ jsx("span", {
98
- className: classnames('muted', 'byline-account-not-set', container_module["not-set"]),
99
- children: "Not set"
100
- })
101
- ]
102
- }),
103
- /*#__PURE__*/ jsxs("p", {
104
- className: classnames('byline-account-line', container_module.line),
105
- children: [
106
- /*#__PURE__*/ jsx("span", {
107
- className: "muted",
108
- children: "Family name:"
109
- }),
110
- ' ',
111
- currentAccount.family_name ?? /*#__PURE__*/ jsx("span", {
112
- className: classnames('muted', 'byline-account-not-set', container_module["not-set"]),
113
- children: "Not set"
114
- })
115
- ]
116
- }),
117
- /*#__PURE__*/ jsxs("p", {
118
- className: classnames('byline-account-cta-line', container_module["cta-line"]),
119
- children: [
120
- /*#__PURE__*/ jsx("span", {
121
- className: "muted",
122
- children: "Username:"
123
- }),
124
- ' ',
125
- currentAccount.username ?? /*#__PURE__*/ jsx("span", {
126
- className: classnames('muted', 'byline-account-not-set', container_module["not-set"]),
127
- children: "Not set"
128
- })
129
- ]
130
- }),
131
- /*#__PURE__*/ jsx(Button, {
132
- size: "sm",
133
- onClick: openDrawer('update'),
134
- children: "Edit Profile"
135
- }),
136
- /*#__PURE__*/ jsxs("div", {
137
- className: classnames('muted', 'byline-account-meta', container_module.meta),
138
- children: [
139
- /*#__PURE__*/ jsxs("p", {
140
- children: [
141
- /*#__PURE__*/ jsx("span", {
142
- className: "font-bold",
143
- children: "Created:\xa0"
144
- }),
145
- /*#__PURE__*/ jsx(LocalDateTime, {
146
- value: currentAccount.created_at
147
- })
148
- ]
149
- }),
150
- /*#__PURE__*/ jsxs("p", {
151
- children: [
152
- /*#__PURE__*/ jsx("span", {
153
- className: "font-bold",
154
- children: "Updated:\xa0"
155
- }),
156
- /*#__PURE__*/ jsx(LocalDateTime, {
157
- value: currentAccount.updated_at
158
- })
159
- ]
160
- }),
161
- /*#__PURE__*/ jsxs("p", {
162
- className: classnames('byline-account-line', container_module.line),
163
- children: [
164
- /*#__PURE__*/ jsx("span", {
165
- className: "font-bold",
166
- children: "Last login:\xa0"
167
- }),
168
- /*#__PURE__*/ jsx(LocalDateTime, {
169
- value: currentAccount.last_login,
170
- fallback: "Never"
171
- })
172
- ]
173
- })
174
- ]
175
- })
176
- ]
177
- })
178
- }),
179
- /*#__PURE__*/ jsxs("div", {
180
- className: classnames('byline-account-column', container_module.column),
181
- children: [
182
- /*#__PURE__*/ jsxs(ContainerSection, {
183
- title: "Password",
184
- onEdit: openDrawer('change_password'),
185
- children: [
186
- /*#__PURE__*/ jsx("p", {
187
- className: classnames('byline-account-cta-line', container_module["cta-line"]),
188
- children: "Change the password used to sign in to the admin. You'll need to enter your current password to confirm the change."
189
- }),
190
- /*#__PURE__*/ jsx(Button, {
191
- size: "sm",
192
- onClick: openDrawer('change_password'),
193
- children: "Change Password"
194
- })
195
- ]
196
- }),
197
- /*#__PURE__*/ jsxs(ContainerSection, {
198
- title: "Account Status",
199
- children: [
200
- /*#__PURE__*/ jsxs("p", {
201
- className: classnames('byline-account-line', container_module.line),
202
- children: [
203
- /*#__PURE__*/ jsx("span", {
204
- className: "muted",
205
- children: "Super admin:"
206
- }),
207
- ' ',
208
- currentAccount.is_super_admin ? 'Yes' : 'No'
209
- ]
210
- }),
211
- /*#__PURE__*/ jsxs("p", {
212
- className: classnames('byline-account-line', container_module.line),
213
- children: [
214
- /*#__PURE__*/ jsx("span", {
215
- className: "muted",
216
- children: "Email verified:"
217
- }),
218
- ' ',
219
- currentAccount.is_email_verified ? 'Yes' : 'No'
220
- ]
221
- }),
222
- /*#__PURE__*/ jsxs("p", {
223
- className: classnames('byline-account-line', container_module.line),
224
- children: [
225
- /*#__PURE__*/ jsx("span", {
226
- className: "muted",
227
- children: "Status:"
228
- }),
229
- ' ',
230
- /*#__PURE__*/ jsx("span", {
231
- className: currentAccount.is_enabled ? classnames('byline-account-status-on', container_module["status-on"]) : classnames('byline-account-status-off', container_module["status-off"]),
232
- children: currentAccount.is_enabled ? 'Enabled' : 'Disabled'
233
- })
234
- ]
235
- }),
236
- /*#__PURE__*/ jsx("p", {
237
- className: classnames('muted', 'byline-account-status-help', container_module["status-help"]),
238
- children: "These flags are managed by an admin with the appropriate permissions and are not self-editable."
239
- })
240
- ]
241
- })
242
- ]
243
- })
244
- ]
245
- }),
246
- /*#__PURE__*/ jsx(Drawer, {
247
- id: "admin-account-drawer",
248
- closeOnOverlayClick: false,
249
- width: "medium",
250
- topOffset: "46px",
251
- isOpen: isDrawerOpen,
252
- onDismiss: closeDrawer,
253
- className: classnames('byline-account-drawer', container_module.drawer),
254
- children: /*#__PURE__*/ jsxs(Drawer.Container, {
255
- "aria-hidden": !isDrawerOpen,
256
- className: classnames('byline-account-drawer-body', container_module["drawer-body"]),
257
- children: [
258
- /*#__PURE__*/ jsxs(Drawer.TopActions, {
259
- children: [
260
- /*#__PURE__*/ jsx("button", {
261
- type: "button",
262
- tabIndex: 0,
263
- className: classnames('byline-account-drawer-skip', container_module["drawer-skip"]),
264
- children: "no action"
265
- }),
266
- /*#__PURE__*/ jsx(IconButton, {
267
- "aria-label": "Close",
268
- size: "sm",
269
- onClick: closeDrawer,
270
- children: /*#__PURE__*/ jsx(CloseIcon, {
271
- width: "14px",
272
- height: "14px",
273
- svgClassName: "white-icon stroke-white"
274
- })
275
- })
276
- ]
277
- }),
278
- /*#__PURE__*/ jsx(Drawer.Header, {
279
- children: /*#__PURE__*/ jsx("h2", {
280
- children: panels[current].title
281
- })
282
- }),
283
- /*#__PURE__*/ jsx(Drawer.Content, {
284
- children: /*#__PURE__*/ jsx("div", {
285
- className: classnames('byline-account-drawer-scroll', container_module["drawer-scroll"]),
286
- children: /*#__PURE__*/ jsx(Panel, {
287
- account: currentAccount,
288
- onClose: closeDrawer,
289
- onSuccess: handleSuccess
290
- })
291
- })
292
- })
293
- ]
294
- })
295
- })
296
- ]
297
- });
298
- }
299
- export { AccountSelfContainer };
@@ -1,28 +0,0 @@
1
- import "./container_module.css";
2
- const container_module = {
3
- grid: "grid-M14d6Z",
4
- column: "column-YKfq3y",
5
- section: "section-WX0QOA",
6
- "section-head": "section-head-guWrAF",
7
- sectionHead: "section-head-guWrAF",
8
- line: "line-TNRwdi",
9
- "cta-line": "cta-line-qcZUDE",
10
- ctaLine: "cta-line-qcZUDE",
11
- meta: "meta-URTGBr",
12
- "status-on": "status-on-JXT2DX",
13
- statusOn: "status-on-JXT2DX",
14
- "status-off": "status-off-bUWxMM",
15
- statusOff: "status-off-bUWxMM",
16
- "status-help": "status-help-AiHEz2",
17
- statusHelp: "status-help-AiHEz2",
18
- "not-set": "not-set-ta8t00",
19
- notSet: "not-set-ta8t00",
20
- drawer: "drawer-WDDzCN",
21
- "drawer-body": "drawer-body-iWh3us",
22
- drawerBody: "drawer-body-iWh3us",
23
- "drawer-scroll": "drawer-scroll-h8UCvI",
24
- drawerScroll: "drawer-scroll-h8UCvI",
25
- "drawer-skip": "drawer-skip-Y3GQsE",
26
- drawerSkip: "drawer-skip-Y3GQsE"
27
- };
28
- export default container_module;
@@ -1,106 +0,0 @@
1
- :is(.grid-M14d6Z, .byline-account-grid) {
2
- gap: var(--spacing-16);
3
- margin-bottom: var(--spacing-48);
4
- flex-direction: column;
5
- display: flex;
6
- }
7
-
8
- @media (min-width: 40rem) {
9
- :is(.grid-M14d6Z, .byline-account-grid) {
10
- grid-template-columns: 1fr 1fr;
11
- display: grid;
12
- }
13
- }
14
-
15
- :is(.column-YKfq3y, .byline-account-column) {
16
- gap: var(--spacing-16);
17
- margin-bottom: var(--spacing-16);
18
- flex-direction: column;
19
- display: flex;
20
- }
21
-
22
- :is(.section-WX0QOA, .byline-account-section) {
23
- padding: var(--spacing-16);
24
- border: var(--border-width-thin) var(--border-style-solid) var(--gray-100);
25
- background-color: var(--canvas-25);
26
- border-radius: var(--border-radius-sm);
27
- }
28
-
29
- :is(.section-head-guWrAF, .byline-account-section-head) {
30
- margin-bottom: var(--spacing-8);
31
- justify-content: space-between;
32
- align-items: center;
33
- display: flex;
34
- }
35
-
36
- :is(.line-TNRwdi, .byline-account-line) {
37
- margin-bottom: 0;
38
- }
39
-
40
- :is(.cta-line-qcZUDE, .byline-account-cta-line) {
41
- margin-bottom: var(--spacing-12);
42
- }
43
-
44
- :is(.meta-URTGBr, .byline-account-meta) {
45
- margin-top: var(--spacing-16);
46
- font-size: var(--font-size-xs);
47
- }
48
-
49
- :is(.status-on-JXT2DX, .byline-account-status-on) {
50
- color: var(--green-600);
51
- }
52
-
53
- :is(.status-off-bUWxMM, .byline-account-status-off) {
54
- color: var(--red-600);
55
- }
56
-
57
- :is(.status-help-AiHEz2, .byline-account-status-help) {
58
- margin-top: var(--spacing-12);
59
- font-size: var(--font-size-xs);
60
- margin-bottom: 0;
61
- }
62
-
63
- :is(.not-set-ta8t00, .byline-account-not-set) {
64
- font-style: italic;
65
- }
66
-
67
- @media (min-width: 48rem) {
68
- :is(.drawer-WDDzCN, .byline-account-drawer) {
69
- width: 500px;
70
- }
71
- }
72
-
73
- :is(.drawer-body-iWh3us, .byline-account-drawer-body) {
74
- padding: var(--spacing-8);
75
- }
76
-
77
- :is(.drawer-scroll-h8UCvI, .byline-account-drawer-scroll) {
78
- max-height: calc(100vh - 160px);
79
- overflow-y: auto;
80
- }
81
-
82
- :is(.drawer-skip-Y3GQsE, .byline-account-drawer-skip) {
83
- clip: rect(0, 0, 0, 0);
84
- white-space: nowrap;
85
- border: 0;
86
- width: 1px;
87
- height: 1px;
88
- margin: -1px;
89
- padding: 0;
90
- position: absolute;
91
- overflow: hidden;
92
- }
93
-
94
- :is(:is([data-theme="dark"], .dark) .section-WX0QOA, :is([data-theme="dark"], .dark) .byline-account-section) {
95
- border-color: var(--gray-700);
96
- background-color: var(--canvas-800);
97
- }
98
-
99
- :is(:is([data-theme="dark"], .dark) .status-on-JXT2DX, :is([data-theme="dark"], .dark) .byline-account-status-on) {
100
- color: var(--green-400);
101
- }
102
-
103
- :is(:is([data-theme="dark"], .dark) .status-off-bUWxMM, :is([data-theme="dark"], .dark) .byline-account-status-off) {
104
- color: var(--red-400);
105
- }
106
-
@@ -1,8 +0,0 @@
1
- import type { AccountResponse } from '@byline/admin/admin-account';
2
- interface UpdateAccountProps {
3
- account: AccountResponse;
4
- onClose?: () => void;
5
- onSuccess?: (account: AccountResponse) => void;
6
- }
7
- export declare function UpdateAccount({ account, onClose, onSuccess }: UpdateAccountProps): import("react").JSX.Element;
8
- export {};