bwh-auth 0.5.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/README.md CHANGED
@@ -242,6 +242,30 @@ It talks to the auth package's credential service (`oauth_server.credentials`) t
242
242
  />
243
243
  ```
244
244
 
245
+ ### Grouped scope picker
246
+
247
+ When the index carries scope groups, both forms replace the flat checkbox list with a grouped picker. Every key is optional, and everything here is presentation: the credential stores exactly the scope ids that end up ticked, and the form posts `scopes` as explicit ids only (never a group or preset id).
248
+
249
+ | Index key | Shape | Used by |
250
+ | --- | --- | --- |
251
+ | `scope_groups` | `[{ id, label, description \| null, sensitive, scopes: [ids] }]` | OAuth-app form; token form unless `token_scope_groups` is present |
252
+ | `scope_presets` | `[{ id, label, description, scopes: [ids] }]` | likewise, with `token_scope_presets` |
253
+ | `scope_implications` | `{ "billing:write": ["billing:read"] }` | likewise, with `token_scope_implications` |
254
+ | `token_scopes` | `[{ id, description }]` | A narrower scope list for the token form (default: `scopes`) |
255
+ | `token_scope_groups`, `token_scope_presets`, `token_scope_implications` | as above | Token form |
256
+ | `token_connection_scopes`, `connection_token_lifetimes` | `[{ id, description }]`, ISO-8601 durations | Token form only: connection scopes are listed after the token scopes, and a token carrying one is offered `connection_token_lifetimes` instead of `token_lifetimes` |
257
+
258
+ - **No groups: nothing changes.** The picker renders the flat list exactly as before (no presets, no summary).
259
+ - **Presets** are a row of buttons. Clicking one replaces the selection with exactly that preset's scopes. `aria-pressed` is true only while the selection equals the preset exactly; a line below shows its description, or "Custom selection" otherwise. There is no "select all".
260
+ - **Groups** render as one `<fieldset>` each, in an auto-fill grid (`minmax(min(100%, 300px), 1fr)`, so phones get one column) with 44px touch targets. Scopes the groups do not name collect in a final "Other permissions" group. A preset that names a scope the surface does not offer is not shown.
261
+ - **Sensitive groups** render as one parent checkbox (checked when all its scopes are ticked, `indeterminate` and `aria-checked="mixed"` when some are), a "Sensitive" badge and the group description as a warning. Clicking the parent ticks or clears every scope in the group. An "Adjust individual ... permissions" button (`aria-expanded`) reveals the group's scopes as ordinary checkboxes.
262
+ - **Implications** are a picker-only cascade. Ticking a scope also ticks everything it needs (transitively); unticking a scope also unticks every scope that needs it. Presets and the sensitive parent apply the cascade too. A scope that a ticked scope needs shows a muted "needed by ..." note. The server never infers one scope from another, so existing grants do not widen.
263
+ - **Summary:** "This credential will request N permissions:" followed by the explicit ids.
264
+
265
+ New optional `components` for the picker, each falling back to a native element: `Badge` (the "Sensitive" label) and `Alert` (the sensitive-group warning). Presets and the disclosure use your `Button` (`variant="default"`/`"outline"`/`"ghost"`, `aria-pressed`, `aria-expanded`). Scope checkboxes use `Checkbox` when injected; the sensitive parent is always a native `<input type="checkbox">`, because it needs `indeterminate` and `aria-checked="mixed"`.
266
+
267
+ `ScopePicker`, the group and preset types, and the pure helpers in `scope-selection` (`closeImplications`, `withScopes`, `withoutScopes`, ...) are exported for apps that build their own forms.
268
+
245
269
  ## Endpoint Defaults
246
270
 
247
271
  Auth forms default to the Laravel package API routes where the Laravel package owns the endpoint: