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

[Enhancement] Use part html attribute to make styling easier #7353

Closed
2 of 3 tasks
maxpatiiuk opened this issue Jul 20, 2023 · 1 comment
Closed
2 of 3 tasks

[Enhancement] Use part html attribute to make styling easier #7353

maxpatiiuk opened this issue Jul 20, 2023 · 1 comment
Labels
ArcGIS Maps SDK for JavaScript Issues logged by ArcGIS SDK for JavaScript team members. calcite-components Issues specific to the @esri/calcite-components package. enhancement Issues tied to a new feature or request. has workaround Issues have a workaround available in the meantime.

Comments

@maxpatiiuk
Copy link
Member

Check existing issues

Description

A part html attribute exists to allow developers using web components to style elements in shadow DOM.

Calcite does not appear to be using it at all at the moment.

Acceptance Criteria

part and exportparts html attributes are utilized generously in Calcite web components to make styling easier

Alternatively, add more css variables and props to give more control of web component internals

Relevant Info

Stencil docs:

MDN docs:

Which Component

I need this in <calcite-action> and <calcite-slider> at the moment, but theoretically in all components

Example Use Case

I am using <calcite-action> and <calcite-slider> inside of <calcite-action-group>.

  • I need to add border radius for the 4 edge buttons of the d-pad and the slider (can't simply add border radius to <calcite-action-group> as that will cut off the focus outline)

  • I wish to add a style like this to only have focus outline when using keyboard:

    button:focus:not(:focus-visible) {
      outline: none !important;
    }
  • I need to disable the margin on the slider div container.

  • The calcite-action > button has padding-inline and padding-block values that don't match:

    Screenshot 2023-07-20 at 16 09 22

    As a result, when I put actions in a 3x3 grid, the grid is shaped like a rectangle rather than a square

At the moment, I solve these issues by injecting my styles into the web component by creating a <style> tag inside of it using JavaScript, but that solution is hacky and fragile:

Screenshot 2023-07-20 at 15 55 35

Priority impact

p3 - want for upcoming milestone

Calcite package

  • @esri/calcite-components
  • @esri/calcite-components-react

Esri team

ArcGIS Maps SDK for JavaScript

@maxpatiiuk maxpatiiuk added 0 - new New issues that need assignment. enhancement Issues tied to a new feature or request. needs triage Planning workflow - pending design/dev review. labels Jul 20, 2023
@github-actions github-actions bot added p3 - want for upcoming milestone calcite-components Issues specific to the @esri/calcite-components package. ArcGIS Maps SDK for JavaScript Issues logged by ArcGIS SDK for JavaScript team members. labels Jul 20, 2023
@maxpatiiuk maxpatiiuk changed the title feat: Use part html attribute to make styling easier [Enhancement] Use part html attribute to make styling easier Jul 20, 2023
@macandcheese
Copy link
Contributor

Following up from Teams - At this point we aren't planning to add css parts. We've discussed it as something to re-evaluate in the future, but for now we plan to use css variables to expose intended theming.

That said - our upcoming work to introduce design tokens should make overriding things like box-shadow, border-radius, etc., much easier with system or component level theming. This effort can be tracked here: #7180

The Action Pad should be able to achieve that layout in the meantime: https://codepen.io/mac_and_cheese/pen/mdQzRXo?editors=1000

@macandcheese macandcheese added has workaround Issues have a workaround available in the meantime. and removed 0 - new New issues that need assignment. needs triage Planning workflow - pending design/dev review. labels Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ArcGIS Maps SDK for JavaScript Issues logged by ArcGIS SDK for JavaScript team members. calcite-components Issues specific to the @esri/calcite-components package. enhancement Issues tied to a new feature or request. has workaround Issues have a workaround available in the meantime.
Projects
None yet
Development

No branches or pull requests

2 participants