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

Update Carbon to version 11 #1496

Closed
wants to merge 9 commits into from

Conversation

gregorw
Copy link
Contributor

@gregorw gregorw commented Sep 24, 2022

This PR introduces v11 carbon styles. As a first step, I would make sure that all existing components still work, before introducing new components or altering existing ones.

Here’s the list of components that need to be verified (patches welcome):

  • @carbon/styles
  • @ibm/plex
  • Accordion
  • AspectRatio
  • Breadcrumb
  • Breakpoint
  • Button
  • ButtonSet
  • Checkbox
  • ClickableTile
    • Light variant is not working yet. Uses layer tokens.
  • CodeSnippet
  • ComboBox
  • ComposedModal
  • ContentSwitcher
  • ContextMenu
  • CopyButton
  • DataTable
  • DatePicker
  • Dropdown
  • ExpandableTile
  • FileUploader
  • FluidForm
  • Form
  • Grid
  • ImageLoader
  • InlineLoading
  • InlineNotification
  • Link
  • Loading
  • LocalStorage
  • Modal
  • MultiSelect
  • NumberInput
  • OrderedList
  • OverflowMenu
  • Pagination
  • PaginationNav
  • PasswordInput
  • Popover
  • ProgressBar
  • ProgressIndicator
  • RadioButton
  • RadioTile
  • RecursiveList
  • Search
  • Select
  • SelectableTile
  • SkeletonPlaceholder
  • SkeletonText
  • Slider
  • StructuredList
  • Tabs
  • Tag
  • TextArea
  • TextInput
  • Theme
  • Tile
  • TimePicker
  • ToastNotification
  • Toggle
  • Tooltip
  • TooltipDefinition
  • TooltipIcon
  • TreeView
  • Truncate
  • UIShell
  • UnorderedList

The current state is deployed here: https://carbon-components-svelte-v11.onrender.com

The roadmap to 1.0 #1614 will defines later steps.

Fixes #1253.

Other resources and onsiderations

@gregorw gregorw marked this pull request as ready for review September 25, 2022 18:21
@gregorw gregorw marked this pull request as draft September 25, 2022 18:22
@gregorw gregorw marked this pull request as ready for review October 1, 2022 20:57
@gregorw gregorw marked this pull request as draft October 11, 2022 21:18
@gregorw gregorw force-pushed the carbon-v11 branch 3 times, most recently from f6bd83b to 7a6b31b Compare October 11, 2022 22:26
@gregorw gregorw force-pushed the carbon-v11 branch 2 times, most recently from 7ffd4e0 to 18149ac Compare November 3, 2022 20:20
@theetrain
Copy link
Collaborator

Hi @gregorw, thank you very much for taking the time to explore v11 style adoption! I have recently posted our v1 roadmap announcement here; #1614 please have a look.

For v11 styles and tokens, we're considering to use SCSS directly in carbon-components-svelte, which would require consumers to have vitePreprocess installed so that when they import components such as import { Button } from 'carbon-components-svelte, it will have @use directives for its corresponding styles set up. With svelte-add we can make it easy for folks to set up carbon-components-svelte with SCSS in one command.

Let us know your thoughts here or in the announcement above.

@gregorw
Copy link
Contributor Author

gregorw commented Jan 6, 2023

Hi @theetrain, thanks for your comment and the roadmap write up. This sounds great!

When it comes to using Carbon styles on a component basis instead of a global import I have tinkered with this here: https://github.com/gregorw/svelte-carbon-v11. In general, I like the idea and a first draft looks promising.

At the same time, I believe it is required to load some global resets and styles anyways. Also, I’m not entirely sure how configuration works like this since a global configuration would need to be handed down into all individual components, e.g. $use-flexbox-grid, $prefix, …

Also, when including styles within the components, some warnings may come up like this:

Plugin svelte: Unused CSS selector ".cds--btn-set--stacked .cds--btn.cds--btn--disabled:first-of-type"

Since this is a Svelte warning it won’t be shown on a global SCSS import.

I wonder what the benefit of a per-component style import really is. It seems to me that handing down global configuration into each component and dealing with a number of svelte warnings could be cumbersome, considering that the global import will probably still be required for resets. But it’s certainly worth trying. I may also be missing something since I have limited experience with Dart Sass.

For some stats: Total bundle sizes of full @carbon/styles import are below:

 68K bundle.css
4.9K bundle.js
 86K bundle.js.map

Build duration is ~10s.

See [@carbon/layout](https://github.com/carbon-design-system/carbon/blob/main/docs/migration/v11.md#carbonlayout) migration guide:

    $layout-01 	Removed, use $spacing-05 instead
    $layout-02 	Removed, use $spacing-06 instead
    $layout-03 	Removed, use $spacing-07 instead
    $layout-04 	Removed, use $spacing-09 instead
    $layout-05 	Removed, use $spacing-10 instead
    $layout-06 	Removed, use $spacing-12 instead
    $layout-07 	Removed, use $spacing-13 instead
Upgrading to css-grid should be separate.
In v11 [Tabs](https://carbondesignsystem.com/migrating/guide/design/#tabs-breaking) received some additional modifiers. In this commit we only want to make sure that the Svelte v10 tabs still work using v11 styles. This probably needs additional testing.
@gregorw
Copy link
Contributor Author

gregorw commented Jan 15, 2023

@theetrain I would suggest to rebase carbon-v11 branch onto master. Then, I’d create smaller PRs onto that intermediate branch. Once carbon-v11 is stable we can merge to master. What do you think? I’m a bit worried that this PR would become too large otherwise. Also, this allows other contributors to verify some of the components.
When it comes to using component based styles, I’d suggest to refactor this after (global) v11 styles have been adopted (this PR) since this would be too many moving parts at the same time from my perspective. cc @metonym
ps: I’m open for a 15–30 minutes call to discuss how we should proceed.

@theetrain
Copy link
Collaborator

All good points. Right now I'm using the carbon-v11 branch to experiment with svelte-package and scss to see what performs best for the developer and end user experience. I'll soon move this conversation to a new ticket to keep track of the moving parts and proposal. I'll be sure to mention you when that's up. 😃

I could also move this conversation to #1253 since we have interested folks subscribed there already.

@gregorw
Copy link
Contributor Author

gregorw commented Jan 15, 2023

@theetrain I’ll let you be in the lead. Let me know when I can help please. From my point of view the first step on the roadmap “Adopt Carbon v11 styles” is already quite involved. As far as I am concerned I would tackle this first before coming up with new proposals for better developer experience. In short, we should adopt @carbon/styles as first priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When will Carbon v11 be available for Svelte?
2 participants