asma-ui-core 3.89.0 → 3.90.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 +56 -10
- package/dist/asma-ui-core.css +1 -1
- package/dist/components/utils/bottom-sheet/StyledBottomSheet.js +137 -0
- package/dist/components/utils/bottom-sheet/StyledBottomSheet.module.js +4 -0
- package/dist/components/utils/bottom-sheet/formatResultsLabel.js +4 -0
- package/dist/components/utils/bottom-sheet/useDragToDismiss.hook.js +40 -0
- package/dist/components/utils/popover/PopoverSheet.js +165 -0
- package/dist/datetime/components/date-picker/components/BaseDatePickerInput.js +1 -1
- package/dist/datetime/components/date-picker/components/DatePickerButton.js +5 -5
- package/dist/hooks/useBodyScrollLock.hook.js +13 -0
- package/dist/hooks/useDebouncedValue.hook.js +15 -0
- package/dist/hooks/useMediaQuery.hook.js +10 -9
- package/dist/index.js +184 -180
- package/dist/src/components/utils/bottom-sheet/StyledBottomSheet.d.ts +59 -0
- package/dist/src/components/utils/bottom-sheet/formatResultsLabel.d.ts +9 -0
- package/dist/src/components/utils/bottom-sheet/formatResultsLabel.test.d.ts +1 -0
- package/dist/src/components/utils/bottom-sheet/index.d.ts +2 -0
- package/dist/src/components/utils/bottom-sheet/story/BottomSheetCases.d.ts +1 -0
- package/dist/src/components/utils/bottom-sheet/story/BottomSheetDemo.d.ts +22 -0
- package/dist/src/components/utils/bottom-sheet/useDragToDismiss.hook.d.ts +22 -0
- package/dist/src/components/utils/popover/PopoverAnatomy.d.ts +1 -1
- package/dist/src/components/utils/popover/{StyledPopoverV2.d.ts → PopoverSheet.d.ts} +12 -2
- package/dist/src/components/utils/popover/index.d.ts +1 -1
- package/dist/src/hooks/useBodyScrollLock.hook.d.ts +7 -0
- package/dist/src/hooks/useDebouncedValue.hook.d.ts +2 -0
- package/dist/src/hooks/useMediaQuery.hook.d.ts +2 -0
- package/dist/src/index.d.ts +1 -0
- package/package.json +1 -1
- package/dist/components/utils/popover/StyledPopoverV2.js +0 -140
package/Readme.md
CHANGED
|
@@ -240,14 +240,14 @@ the trigger itself is the combobox. Both are keyboard-operable and share one lis
|
|
|
240
240
|
|
|
241
241
|
### Popover
|
|
242
242
|
|
|
243
|
-
`
|
|
243
|
+
`PopoverSheet` is the Design System popover (ASMA-8183): an anchored surface with an optional
|
|
244
244
|
title, a close control and two optional footer rows. One implementation, two variants picked by
|
|
245
245
|
**content** rather than by breakpoint.
|
|
246
246
|
|
|
247
247
|
```tsx
|
|
248
|
-
import { StyledButton,
|
|
248
|
+
import { StyledButton, PopoverSheet } from 'asma-ui-core'
|
|
249
249
|
|
|
250
|
-
<
|
|
250
|
+
<PopoverSheet
|
|
251
251
|
dataTest='case-filter'
|
|
252
252
|
variant='action'
|
|
253
253
|
title='Filtrer søknader'
|
|
@@ -268,7 +268,7 @@ import { StyledButton, StyledPopoverV2 } from 'asma-ui-core'
|
|
|
268
268
|
}
|
|
269
269
|
>
|
|
270
270
|
<CaseFilterForm value={filters} onChange={setFilters} />
|
|
271
|
-
</
|
|
271
|
+
</PopoverSheet>
|
|
272
272
|
```
|
|
273
273
|
|
|
274
274
|
The two footer rows come straight from Figma. The **Reset filter** row is `space-between`:
|
|
@@ -291,13 +291,59 @@ trigger at an 8px offset.
|
|
|
291
291
|
|
|
292
292
|
The consumer owns the trigger element (spread `triggerProps`, wire `ref` — `refLink` on
|
|
293
293
|
`StyledButton`), the filter state, and the `aria-live` region that announces the new result count.
|
|
294
|
-
Below 744px
|
|
295
|
-
`action`
|
|
294
|
+
Below 744px an `info` popover takes `100vw - 32px` and is pinned below its trigger, while an
|
|
295
|
+
`action` popover renders as a **Bottom Sheet** with the same props (see below).
|
|
296
296
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
297
|
+
### Bottom sheet
|
|
298
|
+
|
|
299
|
+
`StyledBottomSheet` (ASMA-8184) is the mobile (0–743px) form of the Action popover. You rarely use
|
|
300
|
+
it directly — `PopoverSheet variant='action'` switches to it below 744px — but it is exported for
|
|
301
|
+
screens that only ever show a sheet.
|
|
302
|
+
|
|
303
|
+
```tsx
|
|
304
|
+
<StyledBottomSheet
|
|
305
|
+
dataTest='row-actions'
|
|
306
|
+
open={open}
|
|
307
|
+
onClose={() => setOpen(false)}
|
|
308
|
+
title='Handlinger — søknad 4417'
|
|
309
|
+
>
|
|
310
|
+
{({ close }) => <RowActionButtons onDone={close} />}
|
|
311
|
+
</StyledBottomSheet>
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
A modal sheet on a native `<dialog>`: dimmed scrim, page scroll locked and made `inert`, top corners
|
|
315
|
+
28px, width up to 640px, height fitting the content up to 90vh with an internally scrolling body (a
|
|
316
|
+
full-screen dialog at `max-height: 480px`). Five equivalent dismiss routes — close button, *Vis
|
|
317
|
+
resultater*, scrim, `Esc`, dragging down past 30% — and none of them commits anything. Focus goes to
|
|
318
|
+
the sheet on open so the title is read first, and back to the trigger on close; the grabber is
|
|
319
|
+
decorative.
|
|
320
|
+
|
|
321
|
+
Pass **`resultCount`** (to the sheet or the popover) for the standard *Vis resultater (N)* control:
|
|
322
|
+
debounced ~500ms, `Ingen treff` at zero and still enabled, capped at `9999+`, and announced from a
|
|
323
|
+
live region inside the sheet — the list behind is inert, so its own live region cannot. The label
|
|
324
|
+
comes from the exported `formatResultsLabel`. Title the sheet after the object, not the action: a
|
|
325
|
+
sheet detaches from its trigger, so `Handlinger` alone does not say which row was opened.
|
|
326
|
+
|
|
327
|
+
`StyledPopover` is a different, older thing and stays permanently: the MUI-`Popover`-parity
|
|
328
|
+
positioning primitive that `StyledMenu`, the date-picker calendar, `CountryCodeSelect` and four table
|
|
329
|
+
components (`RowActionMenu`, `HeaderActionMenu`, `TableRowCountSelect`, `TablePagination`) build on.
|
|
330
|
+
New code should reach for `PopoverSheet` — but it is **not** a drop-in replacement for
|
|
331
|
+
`StyledPopover`, and most of those consumers should never move to it:
|
|
332
|
+
|
|
333
|
+
- `StyledMenu`, `RowActionMenu` and (through it) `ToolbarActionGroup` render `role="menu"` with roving
|
|
334
|
+
tabindex and arrow-key navigation — semantics `PopoverSheet` deliberately excludes.
|
|
335
|
+
- `TableRowCountSelect`, `TablePagination` and `CountryCodeSelect`'s desktop panel are `role="listbox"`
|
|
336
|
+
/ combobox pickers, not Info or Action content.
|
|
337
|
+
- The date-picker calendar is a day grid with its own mobile `Drawer` fallback already, which would
|
|
338
|
+
collide with `PopoverSheet`'s built-in <744px sheet swap.
|
|
339
|
+
|
|
340
|
+
`StyledFilterMenu` is the one real migration candidate — its `popoverContent({isOpen, onClose})` +
|
|
341
|
+
`anchorNode` render-props are exactly the shape `PopoverSheet`'s Filter pattern
|
|
342
|
+
(`resetAction`/`viewResultsAction`/`resultCount`) was modeled on — but the render-prop shapes differ
|
|
343
|
+
enough (`{isOpen, onClose}` vs `{close}`, `anchorNode` vs `renderTrigger`) that it needs its own
|
|
344
|
+
rewrite, not an import swap; tracked as a follow-up, not done here. `HeaderActionMenu` (plain
|
|
345
|
+
buttons/checkboxes, no menu role) is a plausible second candidate for the same reason, with its
|
|
346
|
+
drag-and-drop reordering needing its own verification inside a focus trap.
|
|
301
347
|
|
|
302
348
|
### Icons
|
|
303
349
|
|