Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Component - Sheet #6391

Closed
Tracked by #6449
macandcheese opened this issue Jan 31, 2023 · 16 comments
Closed
Tracked by #6449

New Component - Sheet #6391

macandcheese opened this issue Jan 31, 2023 · 16 comments
Assignees
Labels
4 - verified Issues that have been released and confirmed resolved. Calcite (design) Issues logged by Calcite designers. p - medium Issue is non core or affecting less that 60% of people using the library

Comments

@macandcheese
Copy link
Contributor

macandcheese commented Jan 31, 2023

Description

As proposed, add a new "Sheet" component to our component roster.

User Stories

Functionally, this should behave similarly to a modal. The sheet should be used for content that is not displayed to a user until it is explicitly invoked. Consider displaying a bottom sheet, edge-of-page drawer, etc.

Acceptance Criteria

The component should include:

  • Page blocking scrim behind the content container.
  • 4 placement options for each edge of the screen (default to left?)
  • Like modal, dismissal can occur due to user clicking / tapping on scrim.
  • Like modal, offer properties to disable outside click.
  • By default, covers the entire viewport.
  • Alternatively, like Modal, offers a slot within Shell to constrain to the extent of the Shell component.
  • When slotted in Shell, extends over header and footer slots. Scrim extends to extent of the Shell component.

Relevant Info

This differs from the proposed enhancement to add an "overlay" mode to Shell panel in the following ways:

  • "overlay" mode of Shell Panel has no blocking scrim.
  • "overlay" mode of Shell Panel does not extend past extent of Shell center content area (does not cover header or footer)

Modal has a docked property that could conflate with a "position bottom" sheet. Explore deprecation of the former and guidance for users as to use which, when.

Helpful Details

The expected child components should be a Panel, or Flow and Flow Item. Developers should control the open state in tandem with the closable / closed state of a Panel, like Shell Panel.

https://developer.apple.com/design/human-interface-guidelines/components/presentation/sheets/

Esri team

Calcite (design)

@macandcheese macandcheese added new component Issues tied to a new component. 0 - new New issues that need assignment. needs triage Planning workflow - pending design/dev review. labels Jan 31, 2023
@github-actions github-actions bot added the Calcite (design) Issues logged by Calcite designers. label Jan 31, 2023
@github-actions
Copy link
Contributor

@macandcheese
Copy link
Contributor Author

@ashetland lets sync up on Figma spec for this once everyone's schedule calms down a bit.

@ashetland
Copy link

@ashetland lets sync up on Figma spec for this once everyone's schedule calms down a bit.

Sounds like a plan.

@alisonailea alisonailea added airtable and removed airtable new component Issues tied to a new component. labels Feb 12, 2023
@geospatialem geospatialem added 1 - assigned Issues that are assigned to a sprint and a team member. and removed 0 - new New issues that need assignment. needs triage Planning workflow - pending design/dev review. labels Feb 27, 2023
@brittneytewks brittneytewks added the p - medium Issue is non core or affecting less that 60% of people using the library label Mar 30, 2023
@driskull
Copy link
Member

driskull commented Jun 8, 2023

@macandcheese should sheet side placement be flipped in RTL direction?

@driskull
Copy link
Member

driskull commented Jun 8, 2023

Alternatively, like Modal, offers a slot within Shell to constrain to the extent of the Shell component.

I think we should have a separate issue that depends on this one to add a slot within the shell component. @macandcheese or @geospatialem do you want to create this follow up issue?

@macandcheese
Copy link
Contributor Author

macandcheese commented Jun 8, 2023

@macandcheese should sheet side placement be flipped in RTL direction?

Yep, I think we do this with Alert / Shell Panel slots, etc., with similar names.

I think we should have a separate issue that depends on this one to add a slot within the shell component.

Opened - #7154

@driskull
Copy link
Member

@macandcheese does the sheet have a close button or any other UI/slots?

@macandcheese
Copy link
Contributor Author

Nope - accepts a default content slot. The recommendation will be to use a Panel with closable and handle the Sheet in the same way a user handles the Panel closing within a Shell Panel, and provides the behavior of Scrim within modal - closing the scrim and hiding any slotted content when interacted with. This can be turned off the same way Modal does with a outside-close-disabled.

LMK if you think we should reconsider this, but the idea was to basically be a Shell Panel with Modal's page blocking scrim + positioning.

@driskull
Copy link
Member

Do we need...

  • outsideCloseDisabled prop?
  • escapeDisabled prop?
  • scale prop?
  • width prop?
  • kind prop?
  • beforeClose prop?
  • Is this focus trapped?

cc @macandcheese

@macandcheese
Copy link
Contributor Author

Do we need...

  • outsideCloseDisabled prop? ✅
  • escapeDisabled prop? ✅
  • scale prop? 🙅
  • width prop? 🅰️
  • kind prop? 🙅 / 🅱️
  • beforeClose prop? ✅
  • Is this focus trapped? ✅

cc @macandcheese

🅰️ - Shell Panel has W/H-scale props and css vars. Shell Panel also has horizontal / vertical layout. Since Sheet will have "position" (t/b/l/r) instead of layout - we can likely have a single scale and min/max css vars for resizing.

🅱️ - not to start at least.

Also from Shell Panel:

resizable : For now we can use the exact affordances of Shell Panel. In the future all of these should get an improvement ((#5652))
displayMode: overlay(default) / float :
Group 14

Resizing and display-mode can follow up as well if needed, would consider them nice to have at launch.

Let me know what you think of the above - or if having this hybrid approach is too confusing. The main reason for not having slotted areas like Modal (header, content, footer, etc.) is to more easily allow Panel to be the main and expected content placed in a sheet - which itself has the same slots.

@driskull
Copy link
Member

@macandcheese @jcfranco should sheet have the same zindex as modal or do we need another layer/token variable?

@macandcheese
Copy link
Contributor Author

macandcheese commented Aug 22, 2023

Same as Modal I'd think. Similarly we'd want to document / recommend a user only displays one Sheet at a time / not use with Modals active.

@driskull
Copy link
Member

Lets do resizing as a followup next milestone, we can do displayMode for the initial release.

@driskull
Copy link
Member

@macandcheese should sheet handle overflow to allow scrolling if the content is larger than the sheet? Modal does this so wanted to check.

Otherwise, the user would have to rely on something like panel to handle overflow of content.

driskull added a commit that referenced this issue Aug 28, 2023
**Related Issue:** #6391

## Summary

- Adds new `calcite-sheet` component.
- Adds e2e tests
- Adds screenshot tests
- Adds html page with examples
- Modeled after the Modal component.
- Added to index page
- Added to stencil config

## After merged

- [Shell] Add "Sheet" Slot
  - Will try to do for this release if it gets merged in time 
  - Issue: #7154 
  - PR: #7579

## Future

- Resizable (need issue) @macandcheese 

## API

### Example

```html
<calcite-sheet open label="libero nunc" position="inline-start">
  <calcite-panel closable heading="Ultrices neque"
    ><p>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
      magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
      consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
      Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    </p>
    <calcite-button slot="footer" width="half" appearance="outline">tincidunt lobortis</calcite-button>
    <calcite-button slot="footer" width="half" appearance="outline">amet porttitor</calcite-button>
  </calcite-panel>
  <script>
    document.addEventListener("calcitePanelClose", () => {
      document.querySelector("calcite-sheet").open = false;
    });
  </script>
</calcite-sheet>
```

## Properties

| Property | Attribute | Description | Type | Default |
| ---------------------- | ------------------------ |
---------------------------------------------------------------------------------------------------------------------------
| ---------------------------------------------------------------- |
---------------- |
| `beforeClose` | -- | Passes a function to run before the component
closes. | `(el: HTMLCalciteSheetElement) => Promise<void>` | `undefined`
|
| `displayMode` | `display-mode` | Specifies the display mode -
`"float"` (content is separated detached), or `"overlay"` (displays on
top of center content). | `"float" \| "overlay"` | `"overlay"` |
| `escapeDisabled` | `escape-disabled` | When `true`, disables the
default close on escape behavior. | `boolean` | `false` |
| `focusTrapDisabled` | `focus-trap-disabled` | When `true`, prevents
focus trapping. | `boolean` | `false` |
| `heightScale` | `height-scale` | When `position` is `"block-start"` or
`"block-end"`, specifies the height of the component. | `"l" \| "m" \|
"s"` | `"m"` |
| `label` _(required)_ | `label` | Specifies the label of the component.
| `string` | `undefined` |
| `open` | `open` | When `true`, displays and positions the component. |
`boolean` | `false` |
| `outsideCloseDisabled` | `outside-close-disabled` | When `true`,
disables the closing of the component when clicked outside. | `boolean`
| `false` |
| `position` | `position` | When `true`, disables the closing of the
component when clicked outside. | `"block-end" \| "block-start" \|
"inline-end" \| "inline-start"` | `"inline-start"` |
| `widthScale` | `width-scale` | When `position` is `"inline-start"` or
`"inline-end"`, specifies the width of the component. | `"l" \| "m" \|
"s"` | `"m"` |


## Events

| Event | Description | Type |
| ------------------------- |
--------------------------------------------------------------------------------------------------------
| ------------------- |
| `calciteSheetBeforeClose` | Fires when the component is requested to
be closed and before the closing transition begins. |
`CustomEvent<void>` |
| `calciteSheetBeforeOpen` | Fires when the component is added to the
DOM but not rendered, and before the opening transition begins. |
`CustomEvent<void>` |
| `calciteSheetClose` | Fires when the component is closed and animation
is complete. | `CustomEvent<void>` |
| `calciteSheetOpen` | Fires when the component is open and animation is
complete. | `CustomEvent<void>` |


## Methods

### `setFocus() => Promise<void>`

Sets focus on the component's "close" button (the first focusable item).

#### Returns

Type: `Promise<void>`



### `updateFocusTrapElements() => Promise<void>`

Updates the element(s) that are used within the focus-trap of the
component.

#### Returns

Type: `Promise<void>`




## CSS Custom Properties

| Name | Description |
| ---------------------------------- |
----------------------------------------------------------------------------------------------------
|
| `--calcite-sheet-height` | When `position` is `"block-start"` or
`"block-end"`, specifies the height of the component. |
| `--calcite-sheet-max-height` | When `position` is `"block-start"` or
`"block-end"`, specifies the maximum height of the component. |
| `--calcite-sheet-max-width` | When `position` is `"inline-start"` or
`"inline-end"`, specifies the maximum width of the component. |
| `--calcite-sheet-min-height` | When `position` is `"block-start"` or
`"block-end"`, specifies the minimum height of the component. |
| `--calcite-sheet-min-width` | When `position` is `"inline-start"` or
`"inline-end"`, specifies the minimum width of the component. |
| `--calcite-sheet-scrim-background` | Specifies the background color of
the sheet scrim. |
| `--calcite-sheet-width` | When `position` is `"inline-start"` or
`"inline-end"`, specifies the width of the component. |

---------

Co-authored-by: Adam <adam@tirel.la>
@driskull driskull added 3 - installed Issues that have been merged to master branch and are ready for final confirmation. and removed 1 - assigned Issues that are assigned to a sprint and a team member. labels Aug 28, 2023
@github-actions github-actions bot assigned geospatialem and unassigned driskull Aug 28, 2023
@github-actions
Copy link
Contributor

Installed and assigned for verification.

benelan pushed a commit that referenced this issue Aug 28, 2023
**Related Issue:** #6391

## Summary

- Adds new `calcite-sheet` component.
- Adds e2e tests
- Adds screenshot tests
- Adds html page with examples
- Modeled after the Modal component.
- Added to index page
- Added to stencil config

## After merged

- [Shell] Add "Sheet" Slot
  - Will try to do for this release if it gets merged in time 
  - Issue: #7154 
  - PR: #7579

## Future

- Resizable (need issue) @macandcheese 

## API

### Example

```html
<calcite-sheet open label="libero nunc" position="inline-start">
  <calcite-panel closable heading="Ultrices neque"
    ><p>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
      magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
      consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
      Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    </p>
    <calcite-button slot="footer" width="half" appearance="outline">tincidunt lobortis</calcite-button>
    <calcite-button slot="footer" width="half" appearance="outline">amet porttitor</calcite-button>
  </calcite-panel>
  <script>
    document.addEventListener("calcitePanelClose", () => {
      document.querySelector("calcite-sheet").open = false;
    });
  </script>
</calcite-sheet>
```

## Properties

| Property | Attribute | Description | Type | Default |
| ---------------------- | ------------------------ |
---------------------------------------------------------------------------------------------------------------------------
| ---------------------------------------------------------------- |
---------------- |
| `beforeClose` | -- | Passes a function to run before the component
closes. | `(el: HTMLCalciteSheetElement) => Promise<void>` | `undefined`
|
| `displayMode` | `display-mode` | Specifies the display mode -
`"float"` (content is separated detached), or `"overlay"` (displays on
top of center content). | `"float" \| "overlay"` | `"overlay"` |
| `escapeDisabled` | `escape-disabled` | When `true`, disables the
default close on escape behavior. | `boolean` | `false` |
| `focusTrapDisabled` | `focus-trap-disabled` | When `true`, prevents
focus trapping. | `boolean` | `false` |
| `heightScale` | `height-scale` | When `position` is `"block-start"` or
`"block-end"`, specifies the height of the component. | `"l" \| "m" \|
"s"` | `"m"` |
| `label` _(required)_ | `label` | Specifies the label of the component.
| `string` | `undefined` |
| `open` | `open` | When `true`, displays and positions the component. |
`boolean` | `false` |
| `outsideCloseDisabled` | `outside-close-disabled` | When `true`,
disables the closing of the component when clicked outside. | `boolean`
| `false` |
| `position` | `position` | When `true`, disables the closing of the
component when clicked outside. | `"block-end" \| "block-start" \|
"inline-end" \| "inline-start"` | `"inline-start"` |
| `widthScale` | `width-scale` | When `position` is `"inline-start"` or
`"inline-end"`, specifies the width of the component. | `"l" \| "m" \|
"s"` | `"m"` |


## Events

| Event | Description | Type |
| ------------------------- |
--------------------------------------------------------------------------------------------------------
| ------------------- |
| `calciteSheetBeforeClose` | Fires when the component is requested to
be closed and before the closing transition begins. |
`CustomEvent<void>` |
| `calciteSheetBeforeOpen` | Fires when the component is added to the
DOM but not rendered, and before the opening transition begins. |
`CustomEvent<void>` |
| `calciteSheetClose` | Fires when the component is closed and animation
is complete. | `CustomEvent<void>` |
| `calciteSheetOpen` | Fires when the component is open and animation is
complete. | `CustomEvent<void>` |


## Methods

### `setFocus() => Promise<void>`

Sets focus on the component's "close" button (the first focusable item).

#### Returns

Type: `Promise<void>`



### `updateFocusTrapElements() => Promise<void>`

Updates the element(s) that are used within the focus-trap of the
component.

#### Returns

Type: `Promise<void>`




## CSS Custom Properties

| Name | Description |
| ---------------------------------- |
----------------------------------------------------------------------------------------------------
|
| `--calcite-sheet-height` | When `position` is `"block-start"` or
`"block-end"`, specifies the height of the component. |
| `--calcite-sheet-max-height` | When `position` is `"block-start"` or
`"block-end"`, specifies the maximum height of the component. |
| `--calcite-sheet-max-width` | When `position` is `"inline-start"` or
`"inline-end"`, specifies the maximum width of the component. |
| `--calcite-sheet-min-height` | When `position` is `"block-start"` or
`"block-end"`, specifies the minimum height of the component. |
| `--calcite-sheet-min-width` | When `position` is `"inline-start"` or
`"inline-end"`, specifies the minimum width of the component. |
| `--calcite-sheet-scrim-background` | Specifies the background color of
the sheet scrim. |
| `--calcite-sheet-width` | When `position` is `"inline-start"` or
`"inline-end"`, specifies the width of the component. |

---------

Co-authored-by: Adam <adam@tirel.la>
@geospatialem geospatialem added figma changes Issues that require additions or updates to the Figma UI Kit 4 - verified Issues that have been released and confirmed resolved. and removed 3 - installed Issues that have been merged to master branch and are ready for final confirmation. labels Aug 30, 2023
@geospatialem
Copy link
Member

Verified in 1.7.0-next.13 with the following:

Properties

  • beforeClose
  • displayMode
  • escapeDisabled
  • heightScale
  • focusTrapDisabled
  • label
  • open
  • outsideCloseDisabled
  • position
  • widthScale

Events

  • calciteSheetBeforeClose
  • calciteSheetClose
  • calciteSheetBeforeOpen
  • calciteSheetOpen

Methods

  • setFocus
  • updateFocusTrapElements

cc @SkyeSeitz @ashetland @brittneytewks for Figma UI kit updates

@SkyeSeitz SkyeSeitz removed the figma changes Issues that require additions or updates to the Figma UI Kit label Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - verified Issues that have been released and confirmed resolved. Calcite (design) Issues logged by Calcite designers. p - medium Issue is non core or affecting less that 60% of people using the library
Projects
None yet
Development

No branches or pull requests

7 participants