@slotted/angular 0.1.0-beta.13 → 0.1.0-beta.15
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/docs/drawer.examples.md +1 -1
- package/docs/drawer.json +6 -4
- package/docs/drawer.md +4 -4
- package/fesm2022/slotted-angular-drawer.mjs +145 -194
- package/fesm2022/slotted-angular-drawer.mjs.map +1 -1
- package/package.json +3 -3
- package/types/slotted-angular-drawer.d.ts +8 -15
- package/types/slotted-angular-drawer.d.ts.map +1 -1
package/docs/drawer.examples.md
CHANGED
|
@@ -167,7 +167,7 @@ Excerpt — not a complete module
|
|
|
167
167
|
|
|
168
168
|
### A bottom sheet as a phone draws one
|
|
169
169
|
|
|
170
|
-
The sheet measures what it holds — the default size on top and bottom — stops at forty rems on a wide layer, and
|
|
170
|
+
The sheet measures what it holds — the default size on top and bottom — stops at forty rems on a wide layer, and is moved by the platform’s own scroll, so the finger, the fling and the landing on a stop run on the compositor. The sheet and its content are one scroll: pushing up lifts the sheet to the top of the screen and, without letting go, goes on through the list under the header, which sticks there; pulling down from the top of the list brings the sheet down. A fling out of the list stops at its top and never closes the sheet. A tap on the grabber walks the stops.
|
|
171
171
|
|
|
172
172
|
Example
|
|
173
173
|
|
package/docs/drawer.json
CHANGED
|
@@ -292,7 +292,7 @@
|
|
|
292
292
|
"type": "'panel' | 'resizer'",
|
|
293
293
|
"defaultValue": "panel",
|
|
294
294
|
"appliesTo": "<sl-drawer>, provideDrawerDefaults",
|
|
295
|
-
"description": "What a touch moves a bottom sheet by: panel, anywhere on the panel,
|
|
295
|
+
"description": "What a touch moves a bottom sheet by: panel, anywhere on the panel, the sheet and its content scrolling as one; or resizer, the separator only, the body scrolling on its own at the highest stop. A mouse drags the separator, and the sheet settles on the nearest stop."
|
|
296
296
|
},
|
|
297
297
|
{
|
|
298
298
|
"name": "scrimFrom",
|
|
@@ -419,7 +419,7 @@
|
|
|
419
419
|
{
|
|
420
420
|
"name": "extentChangeRequest",
|
|
421
421
|
"payload": "DrawerExtentRequest",
|
|
422
|
-
"when": "Before the panel’s measure changes, with the reason pointer for a drag or a tap on the grip, keyboard for an arrow key, Home, End or Enter, and programmatic for a change from code. A drag of the separator fires on every pointer move and can report a value below minExtent; a
|
|
422
|
+
"when": "Before the panel’s measure changes, with the reason pointer for a drag or a tap on the grip, keyboard for an arrow key, Home, End or Enter, and programmatic for a change from code. A drag of the separator fires on every pointer move and can report a value below minExtent; a bottom sheet fires once its scroll comes to rest, with the stop it rests on. undefined means the panel is back on its size step, or on the height of its content under size=\"content\"."
|
|
423
423
|
},
|
|
424
424
|
{
|
|
425
425
|
"name": "closed",
|
|
@@ -432,7 +432,7 @@
|
|
|
432
432
|
"Under mode=\"inline\" the panel has no role, because a navigation drawer is a navigation landmark and a filter panel is complementary; write the landmark yourself, such as <nav slDrawerBody>. The trigger has no aria-haspopup there, because an inline drawer is a disclosure, not a popup.",
|
|
433
433
|
"aria-modal=\"true\" is written only while the drawer is modal, which is the only state in which the page behind is inert. modal is always false under mode=\"inline\". An aria-label written on <sl-drawer> is moved to the panel, which is the element the role is on.",
|
|
434
434
|
"The separator follows the WAI-ARIA window splitter pattern. The arrow keys move it in the direction they point, Home and End go to the limits, and Enter collapses the panel to its minimum and then restores it. Enter never closes the drawer; Escape does. The values are percentages, and there is no aria-valuetext, so a screen reader announces 40 rather than 40 per cent.",
|
|
435
|
-
"A bottom sheet moves under a touch on its body as well as on its separator, and every stop a finger reaches, the height of the content among them, is also reachable with the arrow keys on the separator.
|
|
435
|
+
"A bottom sheet moves under a touch on its body as well as on its separator, and every stop a finger reaches, the height of the content among them, is also reachable with the arrow keys on the separator. It is moved by the page’s own scroll, so a control whose touch-action takes vertical movement keeps its gesture, and a region inside data-drawer-drag=\"none\" keeps its scroll from passing on to the sheet.",
|
|
436
436
|
"A closed panel is inert in both modes, so its controls are in neither the tab order nor the accessibility tree.",
|
|
437
437
|
"Focus moves into an overlay panel when it opens, to the first focusable element unless initialFocus names another, and returns on close to the element that had it before; if that element has left the document, focus goes to its nearest ancestor still in it. An inline drawer moves no focus when it opens, and on close restores focus only when focus is inside the panel or on the page body.",
|
|
438
438
|
"The ✕ button and the separator are each at least --slotted-target-min across, so both meet the WCAG 2.2 minimum target size of 24 by 24 pixels."
|
|
@@ -470,6 +470,8 @@
|
|
|
470
470
|
"--slotted-drawer-resizer-line-color",
|
|
471
471
|
"--slotted-drawer-rule-color",
|
|
472
472
|
"--slotted-drawer-scrim",
|
|
473
|
+
"--slotted-drawer-sheet-floor",
|
|
474
|
+
"--slotted-drawer-sheet-height",
|
|
473
475
|
"--slotted-drawer-sheet-inline-size",
|
|
474
476
|
"--slotted-drawer-surface",
|
|
475
477
|
"--slotted-drawer-title-color",
|
|
@@ -568,7 +570,7 @@
|
|
|
568
570
|
{
|
|
569
571
|
"id": "sheet",
|
|
570
572
|
"title": "A bottom sheet as a phone draws one",
|
|
571
|
-
"note": "The sheet measures what it holds — the default size on top and bottom — stops at forty rems on a wide layer, and
|
|
573
|
+
"note": "The sheet measures what it holds — the default size on top and bottom — stops at forty rems on a wide layer, and is moved by the platform’s own scroll, so the finger, the fling and the landing on a stop run on the compositor. The sheet and its content are one scroll: pushing up lifts the sheet to the top of the screen and, without letting go, goes on through the list under the header, which sticks there; pulling down from the top of the list brings the sheet down. A fling out of the list stops at its top and never closes the sheet. A tap on the grabber walks the stops.",
|
|
572
574
|
"language": "ts",
|
|
573
575
|
"source": "import { Component, computed, signal } from '@angular/core';\nimport { SlButton } from '@slotted/angular/button';\nimport {\n SlDrawer,\n SlDrawerBody,\n SlDrawerClose,\n SlDrawerDescription,\n SlDrawerFooter,\n SlDrawerHeader,\n SlDrawerResizer,\n SlDrawerTitle,\n SlDrawerTrigger,\n} from '@slotted/angular/drawer';\nimport { SlFieldGroup, SlFieldGroupLegend } from '@slotted/angular/field-group';\nimport { SlInline } from '@slotted/angular/inline';\nimport { SlRadio, SlRadioGroup } from '@slotted/angular/radio-group';\nimport { SlText } from '@slotted/angular/typography';\n\nconst WINDOWS = [\n { value: 'morning', label: 'Thursday 8 October, 8 AM to noon' },\n { value: 'afternoon', label: 'Thursday 8 October, 1 to 5 PM' },\n { value: 'friday', label: 'Friday 9 October, 8 AM to noon' },\n];\n\n@Component({\n selector: 'app-drawer-sheet',\n imports: [\n SlButton,\n SlDrawer,\n SlDrawerBody,\n SlDrawerClose,\n SlDrawerDescription,\n SlDrawerFooter,\n SlDrawerHeader,\n SlDrawerResizer,\n SlDrawerTitle,\n SlDrawerTrigger,\n SlFieldGroup,\n SlFieldGroupLegend,\n SlInline,\n SlRadio,\n SlRadioGroup,\n SlText,\n ],\n template: `\n <div slInline align=\"center\" [gap]=\"3\">\n <span slText size=\"sm\">Pickup: {{ pickupLabel() }}</span>\n <button slButton size=\"sm\" tone=\"secondary\" variant=\"outline\" [slDrawerTrigger]=\"drawer\">\n Reschedule\n </button>\n <sl-drawer #drawer=\"slDrawer\" side=\"bottom\" [open]=\"open()\" (openChange)=\"toggle($event)\">\n <div slDrawerResizer></div>\n <header slDrawerHeader>\n <h2 slDrawerTitle>Reschedule pickup</h2>\n <p slDrawerDescription>Shipment SH-4471, UPS Ground from Reno, NV.</p>\n <button slDrawerClose></button>\n </header>\n <div slDrawerBody>\n <fieldset slFieldGroup>\n <legend slFieldGroupLegend>Pickup window</legend>\n <div slRadioGroup [value]=\"draft()\" (valueChange)=\"draft.set($event.value ?? draft())\">\n @for (window of windows; track window.value) {\n <div slRadio [value]=\"window.value\">{{ window.label }}</div>\n }\n </div>\n </fieldset>\n </div>\n <footer slDrawerFooter>\n <button slButton variant=\"ghost\" tone=\"secondary\" (click)=\"open.set(false)\">\n Cancel\n </button>\n <button slButton (click)=\"reschedule()\">Reschedule</button>\n </footer>\n </sl-drawer>\n </div>\n `,\n})\nexport class DrawerSheet {\n readonly windows = WINDOWS;\n readonly open = signal(false);\n readonly pickup = signal('morning');\n readonly draft = signal(this.pickup());\n readonly pickupLabel = computed(\n () => WINDOWS.find((window) => window.value === this.pickup())?.label,\n );\n\n toggle(next: boolean): void {\n if (next) this.draft.set(this.pickup());\n this.open.set(next);\n }\n\n reschedule(): void {\n this.pickup.set(this.draft());\n this.open.set(false);\n }\n}\n",
|
|
574
576
|
"verdict": "example"
|
package/docs/drawer.md
CHANGED
|
@@ -139,7 +139,7 @@ export class DrawerBasic {
|
|
|
139
139
|
| `escape` | `'close' \| 'none'` | close | <sl-drawer>, provideDrawerDefaults | Whether Escape asks to close the drawer. Escape reaches only the topmost layer, and a layer that refuses it does not pass it to the one below. |
|
|
140
140
|
| `outsidePress` | `'close' \| 'none'` | close | <sl-drawer>, provideDrawerDefaults | Whether a press outside the layer, the scrim included, asks to close the drawer. It has no effect under mode="inline". |
|
|
141
141
|
| `back` | `'close' \| 'none'` | close | <sl-drawer>, provideDrawerDefaults | Whether the browser’s back button or a phone’s back gesture closes a modal drawer instead of leaving the page. The drawer holds one history entry while it is open. It has no effect under mode="inline". |
|
|
142
|
-
| `drag` | `'panel' \| 'resizer'` | panel | <sl-drawer>, provideDrawerDefaults | What a touch moves a bottom sheet by: panel, anywhere on the panel,
|
|
142
|
+
| `drag` | `'panel' \| 'resizer'` | panel | <sl-drawer>, provideDrawerDefaults | What a touch moves a bottom sheet by: panel, anywhere on the panel, the sheet and its content scrolling as one; or resizer, the separator only, the body scrolling on its own at the highest stop. A mouse drags the separator, and the sheet settles on the nearest stop. |
|
|
143
143
|
| `scrimFrom` | `number` | 0 | <sl-drawer> | While the measure is below this fraction, the scrim is not painted, a press reaches the page, and the root carries data-undimmed. Use it with [modal]="false" and outsidePress="none". |
|
|
144
144
|
| `loading` | `boolean` | false | <sl-drawer> | Marks the body as busy with aria-busy and gives it a minimum height, so the panel does not jump when the content arrives. The header, the ✕, Escape and the separator stay available. |
|
|
145
145
|
| `messages` | `Partial<DrawerMessages>` | — | <sl-drawer> | Words laid over the current language, key by key: close, the name of the ✕. An aria-label on slDrawerClose takes precedence. |
|
|
@@ -163,7 +163,7 @@ export class DrawerBasic {
|
|
|
163
163
|
| `openChangeRequest` | `DrawerChangeRequest` | Before the drawer opens or closes, for every way it can: the trigger, the ✕, Escape, a press outside, the back gesture and a call from code. The request carries value, previous, reason (pointer, keyboard, dismiss, escape, outsidePress, back or programmatic), result, the source event and cancel(), which keeps the drawer as it is. |
|
|
164
164
|
| `openChangeComplete` | `boolean` | After the entrance or the exit has ended: true once the drawer is settled open, false once it has left — the moment an application that renders the drawer conditionally removes it, so the exit runs. A drawer mounted open enters from its closed style, as one opened later does. |
|
|
165
165
|
| `extentChange` | `number \| undefined` | The two-way half of extent, which [(extent)] binds. It fires once the measure has changed. |
|
|
166
|
-
| `extentChangeRequest` | `DrawerExtentRequest` | Before the panel’s measure changes, with the reason pointer for a drag or a tap on the grip, keyboard for an arrow key, Home, End or Enter, and programmatic for a change from code. A drag of the separator fires on every pointer move and can report a value below minExtent; a
|
|
166
|
+
| `extentChangeRequest` | `DrawerExtentRequest` | Before the panel’s measure changes, with the reason pointer for a drag or a tap on the grip, keyboard for an arrow key, Home, End or Enter, and programmatic for a change from code. A drag of the separator fires on every pointer move and can report a value below minExtent; a bottom sheet fires once its scroll comes to rest, with the stop it rests on. undefined means the panel is back on its size step, or on the height of its content under size="content". |
|
|
167
167
|
| `closed` | `string \| undefined` | Once the drawer has closed, with the result of the close, or undefined for a close that carried none. |
|
|
168
168
|
|
|
169
169
|
## Axes and defaults
|
|
@@ -186,14 +186,14 @@ export class DrawerBasic {
|
|
|
186
186
|
- Under mode="inline" the panel has no role, because a navigation drawer is a navigation landmark and a filter panel is complementary; write the landmark yourself, such as <nav slDrawerBody>. The trigger has no aria-haspopup there, because an inline drawer is a disclosure, not a popup.
|
|
187
187
|
- aria-modal="true" is written only while the drawer is modal, which is the only state in which the page behind is inert. modal is always false under mode="inline". An aria-label written on <sl-drawer> is moved to the panel, which is the element the role is on.
|
|
188
188
|
- The separator follows the WAI-ARIA window splitter pattern. The arrow keys move it in the direction they point, Home and End go to the limits, and Enter collapses the panel to its minimum and then restores it. Enter never closes the drawer; Escape does. The values are percentages, and there is no aria-valuetext, so a screen reader announces 40 rather than 40 per cent.
|
|
189
|
-
- A bottom sheet moves under a touch on its body as well as on its separator, and every stop a finger reaches, the height of the content among them, is also reachable with the arrow keys on the separator.
|
|
189
|
+
- A bottom sheet moves under a touch on its body as well as on its separator, and every stop a finger reaches, the height of the content among them, is also reachable with the arrow keys on the separator. It is moved by the page’s own scroll, so a control whose touch-action takes vertical movement keeps its gesture, and a region inside data-drawer-drag="none" keeps its scroll from passing on to the sheet.
|
|
190
190
|
- A closed panel is inert in both modes, so its controls are in neither the tab order nor the accessibility tree.
|
|
191
191
|
- Focus moves into an overlay panel when it opens, to the first focusable element unless initialFocus names another, and returns on close to the element that had it before; if that element has left the document, focus goes to its nearest ancestor still in it. An inline drawer moves no focus when it opens, and on close restores focus only when focus is inside the panel or on the page body.
|
|
192
192
|
- The ✕ button and the separator are each at least --slotted-target-min across, so both meet the WCAG 2.2 minimum target size of 24 by 24 pixels.
|
|
193
193
|
|
|
194
194
|
## Tokens
|
|
195
195
|
|
|
196
|
-
`--slotted-border-strong`, `--slotted-border-subtle`, `--slotted-border-width-thick`, `--slotted-border-width-thin`, `--slotted-control-font-family`, `--slotted-control-icon-size-md`, `--slotted-control-inner-size-md`, `--slotted-control-radius`, `--slotted-control-transition-duration`, `--slotted-control-transition-easing`, `--slotted-drawer-backdrop-filter`, `--slotted-drawer-body-color`, `--slotted-drawer-border-color`, `--slotted-drawer-close-active-background`, `--slotted-drawer-close-color`, `--slotted-drawer-close-hover-background`, `--slotted-drawer-color`, `--slotted-drawer-description-color`, `--slotted-drawer-extent`, `--slotted-drawer-extent-lg`, `--slotted-drawer-extent-md`, `--slotted-drawer-extent-sm`, `--slotted-drawer-extent-xl`, `--slotted-drawer-footer-surface`, `--slotted-drawer-radius`, `--slotted-drawer-radius-expanded`, `--slotted-drawer-resizer-line-active-color`, `--slotted-drawer-resizer-line-color`, `--slotted-drawer-rule-color`, `--slotted-drawer-scrim`, `--slotted-drawer-sheet-inline-size`, `--slotted-drawer-surface`, `--slotted-drawer-title-color`, `--slotted-drawer-title-font-family`, `--slotted-duration-instant`, `--slotted-duration-long`, `--slotted-duration-medium`, `--slotted-duration-short`, `--slotted-easing-enter`, `--slotted-easing-exit`, `--slotted-easing-standard`, `--slotted-focus-ring-color`, `--slotted-focus-ring-offset`, `--slotted-focus-ring-width`, `--slotted-font-family-heading`, `--slotted-font-family-sans`, `--slotted-font-size-lg`, `--slotted-font-size-md`, `--slotted-font-size-xl`, `--slotted-font-weight-semibold`, `--slotted-line-height-lg`, `--slotted-line-height-md`, `--slotted-radius-full`, `--slotted-radius-lg`, `--slotted-radius-sm`, `--slotted-scrim`, `--slotted-shadow-lg`, `--slotted-space-11`, `--slotted-space-12`, `--slotted-space-2`, `--slotted-space-4`, `--slotted-space-5`, `--slotted-space-6`, `--slotted-space-7`, `--slotted-space-8`, `--slotted-space-9`, `--slotted-surface-raised`, `--slotted-surface-sunken`, `--slotted-target-comfortable`, `--slotted-target-min`, `--slotted-text`, `--slotted-text-muted`, `--slotted-tone-secondary-subtle-active`, `--slotted-tone-secondary-subtle-hover`, `--slotted-z-index-overlay`
|
|
196
|
+
`--slotted-border-strong`, `--slotted-border-subtle`, `--slotted-border-width-thick`, `--slotted-border-width-thin`, `--slotted-control-font-family`, `--slotted-control-icon-size-md`, `--slotted-control-inner-size-md`, `--slotted-control-radius`, `--slotted-control-transition-duration`, `--slotted-control-transition-easing`, `--slotted-drawer-backdrop-filter`, `--slotted-drawer-body-color`, `--slotted-drawer-border-color`, `--slotted-drawer-close-active-background`, `--slotted-drawer-close-color`, `--slotted-drawer-close-hover-background`, `--slotted-drawer-color`, `--slotted-drawer-description-color`, `--slotted-drawer-extent`, `--slotted-drawer-extent-lg`, `--slotted-drawer-extent-md`, `--slotted-drawer-extent-sm`, `--slotted-drawer-extent-xl`, `--slotted-drawer-footer-surface`, `--slotted-drawer-radius`, `--slotted-drawer-radius-expanded`, `--slotted-drawer-resizer-line-active-color`, `--slotted-drawer-resizer-line-color`, `--slotted-drawer-rule-color`, `--slotted-drawer-scrim`, `--slotted-drawer-sheet-floor`, `--slotted-drawer-sheet-height`, `--slotted-drawer-sheet-inline-size`, `--slotted-drawer-surface`, `--slotted-drawer-title-color`, `--slotted-drawer-title-font-family`, `--slotted-duration-instant`, `--slotted-duration-long`, `--slotted-duration-medium`, `--slotted-duration-short`, `--slotted-easing-enter`, `--slotted-easing-exit`, `--slotted-easing-standard`, `--slotted-focus-ring-color`, `--slotted-focus-ring-offset`, `--slotted-focus-ring-width`, `--slotted-font-family-heading`, `--slotted-font-family-sans`, `--slotted-font-size-lg`, `--slotted-font-size-md`, `--slotted-font-size-xl`, `--slotted-font-weight-semibold`, `--slotted-line-height-lg`, `--slotted-line-height-md`, `--slotted-radius-full`, `--slotted-radius-lg`, `--slotted-radius-sm`, `--slotted-scrim`, `--slotted-shadow-lg`, `--slotted-space-11`, `--slotted-space-12`, `--slotted-space-2`, `--slotted-space-4`, `--slotted-space-5`, `--slotted-space-6`, `--slotted-space-7`, `--slotted-space-8`, `--slotted-space-9`, `--slotted-surface-raised`, `--slotted-surface-sunken`, `--slotted-target-comfortable`, `--slotted-target-min`, `--slotted-text`, `--slotted-text-muted`, `--slotted-tone-secondary-subtle-active`, `--slotted-tone-secondary-subtle-hover`, `--slotted-z-index-overlay`
|
|
197
197
|
|
|
198
198
|
## Examples
|
|
199
199
|
|