bwh-auth 0.6.0 → 0.6.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.
package/dist/index.cjs CHANGED
@@ -1124,6 +1124,7 @@ var touchRow = {
1124
1124
  boxSizing: "border-box",
1125
1125
  overflowWrap: "anywhere"
1126
1126
  };
1127
+ var wrapStyle = { minWidth: 0, overflowWrap: "anywhere" };
1127
1128
  var mutedStyle = { opacity: 0.7 };
1128
1129
  var gridStyle = {
1129
1130
  display: "grid",
@@ -1170,7 +1171,7 @@ function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected
1170
1171
  ),
1171
1172
  " ",
1172
1173
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { minWidth: 0, overflowWrap: "anywhere" }, children: [
1173
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { children: scope.id }),
1174
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { style: wrapStyle, children: scope.id }),
1174
1175
  " ",
1175
1176
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: mutedStyle, children: scope.description })
1176
1177
  ] })
@@ -1187,7 +1188,7 @@ function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected
1187
1188
  ] }, scope.id);
1188
1189
  };
1189
1190
  if (layout === null) {
1190
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("fieldset", { style: { display: "grid", gap: "0.25rem", border: 0, padding: 0, minWidth: 0 }, children: [
1191
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("fieldset", { style: { display: "grid", gap: "0.25rem", border: 0, padding: 0, minWidth: 0, overflowWrap: "anywhere" }, children: [
1191
1192
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("legend", { children: "Permissions" }),
1192
1193
  scopes.map((scope) => renderRow(scope, false))
1193
1194
  ] });
@@ -1196,12 +1197,12 @@ function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected
1196
1197
  const plain = layout.filter((group) => !group.sensitive);
1197
1198
  const sensitive = layout.filter((group) => group.sensitive);
1198
1199
  const Chip = Badge ?? DefaultBadge;
1199
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gap: "1rem", minWidth: 0 }, children: [
1200
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gap: "0.25rem" }, children: [
1200
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gap: "1rem", minWidth: 0, overflowWrap: "anywhere" }, children: [
1201
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gap: "0.25rem", minWidth: 0, overflowWrap: "anywhere" }, children: [
1201
1202
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: "Permissions" }),
1202
1203
  offeredPresets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: mutedStyle, children: "Start from a preset, then adjust any permission below. The credential stores exactly the permissions you tick." })
1203
1204
  ] }),
1204
- offeredPresets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gap: "0.625rem" }, children: [
1205
+ offeredPresets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gap: "0.625rem", minWidth: 0 }, children: [
1205
1206
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { role: "group", "aria-label": "Presets", style: { display: "flex", flexWrap: "wrap", gap: "0.5rem" }, children: offeredPresets.map((preset) => {
1206
1207
  const isPressed = pressed?.id === preset.id;
1207
1208
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
@@ -1210,7 +1211,7 @@ function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected
1210
1211
  type: "button",
1211
1212
  variant: isPressed ? "default" : "outline",
1212
1213
  "aria-pressed": isPressed,
1213
- style: { minHeight: 44, maxWidth: "100%", overflowWrap: "anywhere", whiteSpace: "normal", textAlign: "left" },
1214
+ style: { height: "auto", minHeight: 44, minWidth: 0, maxWidth: "100%", overflowWrap: "anywhere", whiteSpace: "normal", textAlign: "left" },
1214
1215
  onClick: () => commit(withScopes([], preset.scopes, closed)),
1215
1216
  children: preset.label
1216
1217
  },
@@ -1231,8 +1232,8 @@ function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected
1231
1232
  const listId = `${parentId}-scopes`;
1232
1233
  const isOpen = open[group.id] === true;
1233
1234
  const warning = group.description !== null && group.description !== "" ? group.description : null;
1234
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("fieldset", { style: { ...boxStyle, display: "grid", gap: "0.375rem", paddingBottom: "0.875rem" }, children: [
1235
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("legend", { style: { padding: "0 0.375rem", fontWeight: 600, display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
1235
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("fieldset", { style: { ...boxStyle, display: "grid", gridTemplateColumns: "minmax(0, 1fr)", gap: "0.375rem", paddingBottom: "0.875rem" }, children: [
1236
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("legend", { style: { padding: "0 0.375rem", fontWeight: 600, display: "flex", alignItems: "center", gap: "0.5rem", maxWidth: "100%", minWidth: 0 }, children: [
1236
1237
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { overflowWrap: "anywhere" }, children: group.label }),
1237
1238
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Chip, { style: { fontSize: 12, fontWeight: 500, border: "1px solid currentColor", borderRadius: 999, padding: "3px 8px", lineHeight: 1 }, children: "Sensitive" })
1238
1239
  ] }),
@@ -1275,7 +1276,7 @@ function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected
1275
1276
  variant: "ghost",
1276
1277
  "aria-expanded": isOpen,
1277
1278
  "aria-controls": listId,
1278
- style: { minHeight: 44, whiteSpace: "normal", textAlign: "left" },
1279
+ style: { height: "auto", minHeight: 44, minWidth: 0, maxWidth: "100%", overflowWrap: "anywhere", whiteSpace: "normal", textAlign: "left" },
1279
1280
  onClick: () => setOpen((current) => ({ ...current, [group.id]: !isOpen })),
1280
1281
  children: [
1281
1282
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react3.ChevronRight, { "aria-hidden": "true", size: 16, style: { flex: "none", transition: "transform 120ms", transform: isOpen ? "rotate(90deg)" : "none" } }),
@@ -1286,7 +1287,7 @@ function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected
1286
1287
  ]
1287
1288
  }
1288
1289
  ) }),
1289
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { id: listId, style: { ...gridStyle, columnGap: "1.5rem", gap: "0 1.5rem", paddingLeft: "1.5rem", marginLeft: 7, borderLeft: "2px solid rgba(128, 128, 128, 0.35)" }, children: group.scopes.map((scope) => renderRow(scope, true)) })
1290
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { id: listId, style: { ...gridStyle, minWidth: 0, columnGap: "1.5rem", gap: "0 1.5rem", paddingLeft: "1.5rem", marginLeft: 7, borderLeft: "2px solid rgba(128, 128, 128, 0.35)" }, children: group.scopes.map((scope) => renderRow(scope, true)) })
1290
1291
  ] }, group.id);
1291
1292
  }),
1292
1293
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { borderTop: "1px solid rgba(128, 128, 128, 0.35)", paddingTop: "0.875rem", display: "grid", gap: "0.5rem" }, children: [
@@ -1298,7 +1299,7 @@ function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected
1298
1299
 
1299
1300
  // src/api-credentials-section.tsx
1300
1301
  var import_jsx_runtime5 = require("react/jsx-runtime");
1301
- function ApiCredentialsSection({ indexUrl, components, links = [], csrfToken, request, onSuccess, onError }) {
1302
+ function ApiCredentialsSection({ indexUrl, components, links = [], csrfToken, request, onSuccess, onError, layout = "stacked" }) {
1302
1303
  const { Card, CardContent, CardDescription, CardHeader, CardTitle } = resolveAuthComponents(components);
1303
1304
  const [index, setIndex] = React6.useState(null);
1304
1305
  const [issued, setIssued] = React6.useState([]);
@@ -1345,7 +1346,7 @@ function ApiCredentialsSection({ indexUrl, components, links = [], csrfToken, re
1345
1346
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CardTitle, { children: "API access" }),
1346
1347
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CardDescription, { children: "Connect apps that use the API. Register an OAuth app for apps that sign you in, or create an API token for apps that ask for a key. Each carries only the permissions you choose, and never more than your own access." })
1347
1348
  ] }),
1348
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CardContent, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "grid", gap: "1.5rem", minWidth: 0 }, children: [
1349
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CardContent, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "grid", gap: "1.5rem", minWidth: 0, overflowWrap: "anywhere" }, children: [
1349
1350
  links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dl", { style: { display: "grid", gap: "0.5rem", minWidth: 0 }, children: links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { minWidth: 0 }, children: [
1350
1351
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dt", { children: link.label }),
1351
1352
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("dd", { style: { margin: 0, overflowWrap: "anywhere" }, children: [
@@ -1366,8 +1367,17 @@ function ApiCredentialsSection({ indexUrl, components, links = [], csrfToken, re
1366
1367
  loadError !== null && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { role: "alert", children: loadError }),
1367
1368
  index !== null && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1368
1369
  (index.issue_token_href === null || index.register_app_href === null) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { role: "status", children: "Creating new credentials is unavailable right now. You can still revoke existing ones." }),
1369
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TokenSection, { index, ...shared, onIssued: addIssued, reload }),
1370
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AppSection, { index, ...shared, onIssued: addIssued, reload })
1370
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1371
+ "div",
1372
+ {
1373
+ "data-layout": layout,
1374
+ style: layout === "columns" ? { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 460px), 1fr))", gap: "1.5rem", alignItems: "start", minWidth: 0 } : { display: "grid", gridTemplateColumns: "minmax(0, 1fr)", gap: "1.5rem", minWidth: 0 },
1375
+ children: [
1376
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TokenSection, { index, ...shared, onIssued: addIssued, reload }),
1377
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AppSection, { index, ...shared, onIssued: addIssued, reload })
1378
+ ]
1379
+ }
1380
+ )
1371
1381
  ] })
1372
1382
  ] }) })
1373
1383
  ] });
@@ -1427,7 +1437,7 @@ function TokenSection({ index, components, csrfToken, request, onIssued, reload,
1427
1437
  }
1428
1438
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { style: { display: "grid", gap: "0.75rem", minWidth: 0 }, children: [
1429
1439
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { children: "API tokens" }),
1430
- index.issue_token_href !== null && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("form", { onSubmit: create, style: { display: "grid", gap: "0.75rem" }, children: [
1440
+ index.issue_token_href !== null && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("form", { onSubmit: create, style: { display: "grid", gap: "0.75rem", minWidth: 0 }, children: [
1431
1441
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "grid", gap: "0.25rem" }, children: [
1432
1442
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Label, { htmlFor: "api-token-name", children: "Token name" }),
1433
1443
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Input, { id: "api-token-name", value: name, maxLength: 120, onChange: (event) => setName(event.target.value) })
@@ -1535,7 +1545,7 @@ function AppSection({ index, components, csrfToken, request, onIssued, reload, o
1535
1545
  }
1536
1546
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { style: { display: "grid", gap: "0.75rem", minWidth: 0 }, children: [
1537
1547
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { children: "OAuth apps" }),
1538
- index.register_app_href !== null && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("form", { onSubmit: register, style: { display: "grid", gap: "0.75rem" }, children: [
1548
+ index.register_app_href !== null && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("form", { onSubmit: register, style: { display: "grid", gap: "0.75rem", minWidth: 0 }, children: [
1539
1549
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "grid", gap: "0.25rem" }, children: [
1540
1550
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Label, { htmlFor: "oauth-app-name", children: "App name" }),
1541
1551
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Input, { id: "oauth-app-name", value: name, maxLength: 120, onChange: (event) => setName(event.target.value) })
package/dist/index.d.cts CHANGED
@@ -387,6 +387,12 @@ interface ApiCredentialsSectionProps {
387
387
  request?: ApiCredentialRequest;
388
388
  onSuccess?: (message: string) => void;
389
389
  onError?: (field: string, message: string) => void;
390
+ /**
391
+ * `stacked` (default) puts the token and OAuth-app sections one under the other.
392
+ * `columns` lays them side by side when the container is wide enough (about 960px);
393
+ * narrower containers stack them.
394
+ */
395
+ layout?: 'stacked' | 'columns';
390
396
  }
391
397
  /**
392
398
  * A person's credentials for apps that use the API: personal API tokens (for
@@ -397,7 +403,7 @@ interface ApiCredentialsSectionProps {
397
403
  * in this component's memory; afterwards only the lists are reloaded, so it is
398
404
  * never part of page props or browser history.
399
405
  */
400
- declare function ApiCredentialsSection({ indexUrl, components, links, csrfToken, request, onSuccess, onError }: ApiCredentialsSectionProps): React.JSX.Element;
406
+ declare function ApiCredentialsSection({ indexUrl, components, links, csrfToken, request, onSuccess, onError, layout }: ApiCredentialsSectionProps): React.JSX.Element;
401
407
  /** PT4H → "4 hours", P30D → "30 days", P1Y → "1 year". Unknown shapes are shown as given. */
402
408
  declare function describeDuration(spec: string): string;
403
409
 
package/dist/index.d.ts CHANGED
@@ -387,6 +387,12 @@ interface ApiCredentialsSectionProps {
387
387
  request?: ApiCredentialRequest;
388
388
  onSuccess?: (message: string) => void;
389
389
  onError?: (field: string, message: string) => void;
390
+ /**
391
+ * `stacked` (default) puts the token and OAuth-app sections one under the other.
392
+ * `columns` lays them side by side when the container is wide enough (about 960px);
393
+ * narrower containers stack them.
394
+ */
395
+ layout?: 'stacked' | 'columns';
390
396
  }
391
397
  /**
392
398
  * A person's credentials for apps that use the API: personal API tokens (for
@@ -397,7 +403,7 @@ interface ApiCredentialsSectionProps {
397
403
  * in this component's memory; afterwards only the lists are reloaded, so it is
398
404
  * never part of page props or browser history.
399
405
  */
400
- declare function ApiCredentialsSection({ indexUrl, components, links, csrfToken, request, onSuccess, onError }: ApiCredentialsSectionProps): React.JSX.Element;
406
+ declare function ApiCredentialsSection({ indexUrl, components, links, csrfToken, request, onSuccess, onError, layout }: ApiCredentialsSectionProps): React.JSX.Element;
401
407
  /** PT4H → "4 hours", P30D → "30 days", P1Y → "1 year". Unknown shapes are shown as given. */
402
408
  declare function describeDuration(spec: string): string;
403
409
 
package/dist/index.js CHANGED
@@ -1061,6 +1061,7 @@ var touchRow = {
1061
1061
  boxSizing: "border-box",
1062
1062
  overflowWrap: "anywhere"
1063
1063
  };
1064
+ var wrapStyle = { minWidth: 0, overflowWrap: "anywhere" };
1064
1065
  var mutedStyle = { opacity: 0.7 };
1065
1066
  var gridStyle = {
1066
1067
  display: "grid",
@@ -1107,7 +1108,7 @@ function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected
1107
1108
  ),
1108
1109
  " ",
1109
1110
  /* @__PURE__ */ jsxs4("span", { style: { minWidth: 0, overflowWrap: "anywhere" }, children: [
1110
- /* @__PURE__ */ jsx4("code", { children: scope.id }),
1111
+ /* @__PURE__ */ jsx4("code", { style: wrapStyle, children: scope.id }),
1111
1112
  " ",
1112
1113
  /* @__PURE__ */ jsx4("span", { style: mutedStyle, children: scope.description })
1113
1114
  ] })
@@ -1124,7 +1125,7 @@ function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected
1124
1125
  ] }, scope.id);
1125
1126
  };
1126
1127
  if (layout === null) {
1127
- return /* @__PURE__ */ jsxs4("fieldset", { style: { display: "grid", gap: "0.25rem", border: 0, padding: 0, minWidth: 0 }, children: [
1128
+ return /* @__PURE__ */ jsxs4("fieldset", { style: { display: "grid", gap: "0.25rem", border: 0, padding: 0, minWidth: 0, overflowWrap: "anywhere" }, children: [
1128
1129
  /* @__PURE__ */ jsx4("legend", { children: "Permissions" }),
1129
1130
  scopes.map((scope) => renderRow(scope, false))
1130
1131
  ] });
@@ -1133,12 +1134,12 @@ function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected
1133
1134
  const plain = layout.filter((group) => !group.sensitive);
1134
1135
  const sensitive = layout.filter((group) => group.sensitive);
1135
1136
  const Chip = Badge ?? DefaultBadge;
1136
- return /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gap: "1rem", minWidth: 0 }, children: [
1137
- /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gap: "0.25rem" }, children: [
1137
+ return /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gap: "1rem", minWidth: 0, overflowWrap: "anywhere" }, children: [
1138
+ /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gap: "0.25rem", minWidth: 0, overflowWrap: "anywhere" }, children: [
1138
1139
  /* @__PURE__ */ jsx4("strong", { children: "Permissions" }),
1139
1140
  offeredPresets.length > 0 && /* @__PURE__ */ jsx4("span", { style: mutedStyle, children: "Start from a preset, then adjust any permission below. The credential stores exactly the permissions you tick." })
1140
1141
  ] }),
1141
- offeredPresets.length > 0 && /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gap: "0.625rem" }, children: [
1142
+ offeredPresets.length > 0 && /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gap: "0.625rem", minWidth: 0 }, children: [
1142
1143
  /* @__PURE__ */ jsx4("div", { role: "group", "aria-label": "Presets", style: { display: "flex", flexWrap: "wrap", gap: "0.5rem" }, children: offeredPresets.map((preset) => {
1143
1144
  const isPressed = pressed?.id === preset.id;
1144
1145
  return /* @__PURE__ */ jsx4(
@@ -1147,7 +1148,7 @@ function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected
1147
1148
  type: "button",
1148
1149
  variant: isPressed ? "default" : "outline",
1149
1150
  "aria-pressed": isPressed,
1150
- style: { minHeight: 44, maxWidth: "100%", overflowWrap: "anywhere", whiteSpace: "normal", textAlign: "left" },
1151
+ style: { height: "auto", minHeight: 44, minWidth: 0, maxWidth: "100%", overflowWrap: "anywhere", whiteSpace: "normal", textAlign: "left" },
1151
1152
  onClick: () => commit(withScopes([], preset.scopes, closed)),
1152
1153
  children: preset.label
1153
1154
  },
@@ -1168,8 +1169,8 @@ function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected
1168
1169
  const listId = `${parentId}-scopes`;
1169
1170
  const isOpen = open[group.id] === true;
1170
1171
  const warning = group.description !== null && group.description !== "" ? group.description : null;
1171
- return /* @__PURE__ */ jsxs4("fieldset", { style: { ...boxStyle, display: "grid", gap: "0.375rem", paddingBottom: "0.875rem" }, children: [
1172
- /* @__PURE__ */ jsxs4("legend", { style: { padding: "0 0.375rem", fontWeight: 600, display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
1172
+ return /* @__PURE__ */ jsxs4("fieldset", { style: { ...boxStyle, display: "grid", gridTemplateColumns: "minmax(0, 1fr)", gap: "0.375rem", paddingBottom: "0.875rem" }, children: [
1173
+ /* @__PURE__ */ jsxs4("legend", { style: { padding: "0 0.375rem", fontWeight: 600, display: "flex", alignItems: "center", gap: "0.5rem", maxWidth: "100%", minWidth: 0 }, children: [
1173
1174
  /* @__PURE__ */ jsx4("span", { style: { overflowWrap: "anywhere" }, children: group.label }),
1174
1175
  /* @__PURE__ */ jsx4(Chip, { style: { fontSize: 12, fontWeight: 500, border: "1px solid currentColor", borderRadius: 999, padding: "3px 8px", lineHeight: 1 }, children: "Sensitive" })
1175
1176
  ] }),
@@ -1212,7 +1213,7 @@ function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected
1212
1213
  variant: "ghost",
1213
1214
  "aria-expanded": isOpen,
1214
1215
  "aria-controls": listId,
1215
- style: { minHeight: 44, whiteSpace: "normal", textAlign: "left" },
1216
+ style: { height: "auto", minHeight: 44, minWidth: 0, maxWidth: "100%", overflowWrap: "anywhere", whiteSpace: "normal", textAlign: "left" },
1216
1217
  onClick: () => setOpen((current) => ({ ...current, [group.id]: !isOpen })),
1217
1218
  children: [
1218
1219
  /* @__PURE__ */ jsx4(ChevronRight, { "aria-hidden": "true", size: 16, style: { flex: "none", transition: "transform 120ms", transform: isOpen ? "rotate(90deg)" : "none" } }),
@@ -1223,7 +1224,7 @@ function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected
1223
1224
  ]
1224
1225
  }
1225
1226
  ) }),
1226
- isOpen && /* @__PURE__ */ jsx4("div", { id: listId, style: { ...gridStyle, columnGap: "1.5rem", gap: "0 1.5rem", paddingLeft: "1.5rem", marginLeft: 7, borderLeft: "2px solid rgba(128, 128, 128, 0.35)" }, children: group.scopes.map((scope) => renderRow(scope, true)) })
1227
+ isOpen && /* @__PURE__ */ jsx4("div", { id: listId, style: { ...gridStyle, minWidth: 0, columnGap: "1.5rem", gap: "0 1.5rem", paddingLeft: "1.5rem", marginLeft: 7, borderLeft: "2px solid rgba(128, 128, 128, 0.35)" }, children: group.scopes.map((scope) => renderRow(scope, true)) })
1227
1228
  ] }, group.id);
1228
1229
  }),
1229
1230
  /* @__PURE__ */ jsxs4("div", { style: { borderTop: "1px solid rgba(128, 128, 128, 0.35)", paddingTop: "0.875rem", display: "grid", gap: "0.5rem" }, children: [
@@ -1235,7 +1236,7 @@ function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected
1235
1236
 
1236
1237
  // src/api-credentials-section.tsx
1237
1238
  import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1238
- function ApiCredentialsSection({ indexUrl, components, links = [], csrfToken, request, onSuccess, onError }) {
1239
+ function ApiCredentialsSection({ indexUrl, components, links = [], csrfToken, request, onSuccess, onError, layout = "stacked" }) {
1239
1240
  const { Card, CardContent, CardDescription, CardHeader, CardTitle } = resolveAuthComponents(components);
1240
1241
  const [index, setIndex] = React6.useState(null);
1241
1242
  const [issued, setIssued] = React6.useState([]);
@@ -1282,7 +1283,7 @@ function ApiCredentialsSection({ indexUrl, components, links = [], csrfToken, re
1282
1283
  /* @__PURE__ */ jsx5(CardTitle, { children: "API access" }),
1283
1284
  /* @__PURE__ */ jsx5(CardDescription, { children: "Connect apps that use the API. Register an OAuth app for apps that sign you in, or create an API token for apps that ask for a key. Each carries only the permissions you choose, and never more than your own access." })
1284
1285
  ] }),
1285
- /* @__PURE__ */ jsx5(CardContent, { children: /* @__PURE__ */ jsxs5("div", { style: { display: "grid", gap: "1.5rem", minWidth: 0 }, children: [
1286
+ /* @__PURE__ */ jsx5(CardContent, { children: /* @__PURE__ */ jsxs5("div", { style: { display: "grid", gap: "1.5rem", minWidth: 0, overflowWrap: "anywhere" }, children: [
1286
1287
  links.length > 0 && /* @__PURE__ */ jsx5("dl", { style: { display: "grid", gap: "0.5rem", minWidth: 0 }, children: links.map((link) => /* @__PURE__ */ jsxs5("div", { style: { minWidth: 0 }, children: [
1287
1288
  /* @__PURE__ */ jsx5("dt", { children: link.label }),
1288
1289
  /* @__PURE__ */ jsxs5("dd", { style: { margin: 0, overflowWrap: "anywhere" }, children: [
@@ -1303,8 +1304,17 @@ function ApiCredentialsSection({ indexUrl, components, links = [], csrfToken, re
1303
1304
  loadError !== null && /* @__PURE__ */ jsx5("p", { role: "alert", children: loadError }),
1304
1305
  index !== null && /* @__PURE__ */ jsxs5(Fragment2, { children: [
1305
1306
  (index.issue_token_href === null || index.register_app_href === null) && /* @__PURE__ */ jsx5("p", { role: "status", children: "Creating new credentials is unavailable right now. You can still revoke existing ones." }),
1306
- /* @__PURE__ */ jsx5(TokenSection, { index, ...shared, onIssued: addIssued, reload }),
1307
- /* @__PURE__ */ jsx5(AppSection, { index, ...shared, onIssued: addIssued, reload })
1307
+ /* @__PURE__ */ jsxs5(
1308
+ "div",
1309
+ {
1310
+ "data-layout": layout,
1311
+ style: layout === "columns" ? { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 460px), 1fr))", gap: "1.5rem", alignItems: "start", minWidth: 0 } : { display: "grid", gridTemplateColumns: "minmax(0, 1fr)", gap: "1.5rem", minWidth: 0 },
1312
+ children: [
1313
+ /* @__PURE__ */ jsx5(TokenSection, { index, ...shared, onIssued: addIssued, reload }),
1314
+ /* @__PURE__ */ jsx5(AppSection, { index, ...shared, onIssued: addIssued, reload })
1315
+ ]
1316
+ }
1317
+ )
1308
1318
  ] })
1309
1319
  ] }) })
1310
1320
  ] });
@@ -1364,7 +1374,7 @@ function TokenSection({ index, components, csrfToken, request, onIssued, reload,
1364
1374
  }
1365
1375
  return /* @__PURE__ */ jsxs5("section", { style: { display: "grid", gap: "0.75rem", minWidth: 0 }, children: [
1366
1376
  /* @__PURE__ */ jsx5("h3", { children: "API tokens" }),
1367
- index.issue_token_href !== null && /* @__PURE__ */ jsxs5("form", { onSubmit: create, style: { display: "grid", gap: "0.75rem" }, children: [
1377
+ index.issue_token_href !== null && /* @__PURE__ */ jsxs5("form", { onSubmit: create, style: { display: "grid", gap: "0.75rem", minWidth: 0 }, children: [
1368
1378
  /* @__PURE__ */ jsxs5("div", { style: { display: "grid", gap: "0.25rem" }, children: [
1369
1379
  /* @__PURE__ */ jsx5(Label, { htmlFor: "api-token-name", children: "Token name" }),
1370
1380
  /* @__PURE__ */ jsx5(Input, { id: "api-token-name", value: name, maxLength: 120, onChange: (event) => setName(event.target.value) })
@@ -1472,7 +1482,7 @@ function AppSection({ index, components, csrfToken, request, onIssued, reload, o
1472
1482
  }
1473
1483
  return /* @__PURE__ */ jsxs5("section", { style: { display: "grid", gap: "0.75rem", minWidth: 0 }, children: [
1474
1484
  /* @__PURE__ */ jsx5("h3", { children: "OAuth apps" }),
1475
- index.register_app_href !== null && /* @__PURE__ */ jsxs5("form", { onSubmit: register, style: { display: "grid", gap: "0.75rem" }, children: [
1485
+ index.register_app_href !== null && /* @__PURE__ */ jsxs5("form", { onSubmit: register, style: { display: "grid", gap: "0.75rem", minWidth: 0 }, children: [
1476
1486
  /* @__PURE__ */ jsxs5("div", { style: { display: "grid", gap: "0.25rem" }, children: [
1477
1487
  /* @__PURE__ */ jsx5(Label, { htmlFor: "oauth-app-name", children: "App name" }),
1478
1488
  /* @__PURE__ */ jsx5(Input, { id: "oauth-app-name", value: name, maxLength: 120, onChange: (event) => setName(event.target.value) })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bwh-auth",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Shared React auth UI and browser WebAuthn helpers for BWH applications.",
5
5
  "license": "MIT",
6
6
  "type": "module",