@ferrlabs/ui-ng 1.69.0 → 1.70.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/README.md +64 -0
- package/fesm2022/ferrlabs-ui-ng.mjs +507 -15
- package/fesm2022/ferrlabs-ui-ng.mjs.map +1 -1
- package/package.json +1 -1
- package/types/ferrlabs-ui-ng.d.ts +144 -1
- package/types/ferrlabs-ui-ng.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -192,6 +192,70 @@ To add a row of your own to a `flr-menu`, provide `MENU_FOCUSABLE` (`focus()`, `
|
|
|
192
192
|
the arrow keys reach it. `flr-menu-item` takes `keepOpen` (the click does not close the menu) and
|
|
193
193
|
`checked` (renders a `menuitemradio`).
|
|
194
194
|
|
|
195
|
+
## Secret field
|
|
196
|
+
|
|
197
|
+
A read-only secret, masked until the user asks for it. The value is not in the DOM while
|
|
198
|
+
masked. Show reveals it and masks it again after `revealSeconds` (30 by default, `0` keeps it
|
|
199
|
+
shown), Copy copies it without revealing it. Both buttons are named after `aria-label`.
|
|
200
|
+
|
|
201
|
+
```html
|
|
202
|
+
<flr-field label="Webhook secret">
|
|
203
|
+
<flr-secret-field aria-label="Webhook secret" [value]="secret()" [revealSeconds]="30" />
|
|
204
|
+
</flr-field>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
To fetch the secret only when it is asked for, leave `value` at `null`. The first Show or
|
|
208
|
+
Copy emits `valueRequest` and the field waits until `value` is set. Set `error` when the
|
|
209
|
+
fetch fails, and clear it on the next `valueRequest`. `revealedChange` emits `false` when the
|
|
210
|
+
value is masked again, which is the moment to drop it:
|
|
211
|
+
|
|
212
|
+
```html
|
|
213
|
+
<flr-secret-field
|
|
214
|
+
aria-label="Webhook secret"
|
|
215
|
+
[value]="secret()"
|
|
216
|
+
[error]="loadError()"
|
|
217
|
+
(valueRequest)="loadSecret()"
|
|
218
|
+
(revealedChange)="$event || secret.set(null)"
|
|
219
|
+
/>
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
A copy that follows a fetch runs after the click, and some browsers refuse a clipboard write
|
|
223
|
+
that late. The field then says so and asks the user to show the value and copy it by hand.
|
|
224
|
+
|
|
225
|
+
Every string is replaceable through `labels` (`SecretFieldLabels`).
|
|
226
|
+
|
|
227
|
+
## Combobox: unavailable options and paging
|
|
228
|
+
|
|
229
|
+
An option with `disabled: true` stays in the list and reachable with the arrow keys, so its
|
|
230
|
+
`disabledReason` is read out, but a click or Enter does not select it:
|
|
231
|
+
|
|
232
|
+
```ts
|
|
233
|
+
const options: ComboboxOption[] = [
|
|
234
|
+
{ value: 'api', label: 'Backend API', disabled: true, disabledReason: 'Linked to Mobile' },
|
|
235
|
+
{ value: 'web', label: 'Web app' },
|
|
236
|
+
];
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
For a server-searched list (`[localFilter]="false"`), set `hasMore` while pages remain.
|
|
240
|
+
`loadMore` emits once per page when the list is scrolled near its end, when the down arrow
|
|
241
|
+
is pressed on the last option, or on the "Load more" button. Append the new page to `options`
|
|
242
|
+
and set `loadingMore` meanwhile. `error` shows a message with a `retry` action in place of
|
|
243
|
+
the empty text or the "Load more" button:
|
|
244
|
+
|
|
245
|
+
```html
|
|
246
|
+
<flr-combobox
|
|
247
|
+
[options]="projects()"
|
|
248
|
+
[localFilter]="false"
|
|
249
|
+
[loading]="loading()"
|
|
250
|
+
[hasMore]="hasMore()"
|
|
251
|
+
[loadingMore]="loadingMore()"
|
|
252
|
+
[error]="loadError()"
|
|
253
|
+
(searchChange)="search($event)"
|
|
254
|
+
(loadMore)="nextPage()"
|
|
255
|
+
(retry)="reload()"
|
|
256
|
+
/>
|
|
257
|
+
```
|
|
258
|
+
|
|
195
259
|
## Versioned docs (`@ferrlabs/ui-ng/docs`)
|
|
196
260
|
|
|
197
261
|
Brand-agnostic versioned-documentation layout, shared across product sites.
|