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

chore: use @carbon/styles (v11) #1709

Closed
wants to merge 36 commits into from

Conversation

gregorw
Copy link
Contributor

@gregorw gregorw commented Mar 26, 2023

Reworking #1496. See https://carbon-components-svelte-v11.onrender.com for actual results.

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 changing the technology stack in any other ways.

  • @carbon/styles
  • @ibm/plex

Here’s the list of components that need to be verified:

  • Accordion
  • AspectRatio
  • Breadcrumb
  • Breakpoint
  • Button
  • ButtonSet
  • Checkbox
  • ClickableTile
    • Light variant is not working yet. Uses layer tokens.
  • CodeSnippet
    • Copy button is misaligned
  • ComboBox
  • ComposedModal
  • ContentSwitcher
  • ContextMenu
  • CopyButton
    • Tooltip is misaligned
  • DataTable
    • stickyHeader has a bug in @carbon/styles most probably, rem(300px) is not recognized by browser.
  • DatePicker
  • Dropdown
  • ExpandableTile
  • FileUploader
  • FluidForm
  • Form
    • Docs need Stack component for vertical spacing
  • Grid
    • Needs renaming to FlexGrid at some point to clear Grid for css grids.
  • ImageLoader
  • InlineLoading
  • InlineNotification
    • Docs need Stack component for vertical spacing
  • Link
  • Loading
  • LocalStorage
    • Dark mode toggle needs fixing. See Theme/GlobalTheme
  • Modal
  • MultiSelect
  • NumberInput
  • OrderedList
  • OverflowMenu
  • Pagination
  • PaginationNav
  • PasswordInput
  • Popover
  • ProgressBar
  • ProgressIndicator
  • RadioButton
  • RadioTile
  • RecursiveList
  • Search
  • Select
  • SelectableTile
  • SkeletonPlaceholder
  • SkeletonText
  • Slider
  • StructuredList
    • Selectable version needs double-checking
  • Tabs
  • Tag
    • Interactive needs fixing
  • TextArea
  • TextInput
  • Theme
  • Tile
  • TimePicker
  • ToastNotification
    • Docs need Stack component for vertical spacing
  • Toggle
  • Tooltip
  • TooltipDefinition
  • TooltipIcon
  • TreeView
  • Truncate removed
  • UIShell
    • HeaderSearch needs to be double-checked
  • UnorderedList

Fixes #1253.

Other resources and considerations

@theetrain
Copy link
Collaborator

Thanks again for taking the time; I see you even refactored Tabs to replace the dropdown styles with a scrolling tabs list, which matches v11 implementation details.

To ensure I understand, is the proposal here to:

  1. First prove that components work with v11 styles, and refactor them accordingly
  2. Then, figure out an improved way for consumers to set up Carbon CSS in their projects
  3. Ship these components, then continue work towards carbon-components-svelte@v1
  4. Afterwards (out of scope for now), we set up svelte-package, types, and other v1 goals

If so, I'm on board with this.

@gregorw
Copy link
Contributor Author

gregorw commented Mar 27, 2023

  1. First prove that components work with v11 styles, and refactor them accordingly

Exactly, this should be our first priority. This change should then be merged to master and be released. Basically, this is new v11 styles with the minimal adaptions from v10 components. Projects that use carbon-components-svelte can than use this release.

1.1 Bugfixing, feature parity

Once v11 styles are released we might need to fix a few bugs, change a few more props – or we can start working towards feature parity.

  1. Then, figure out an improved way for consumers to set up Carbon CSS in their projects

Here it is important to understand what problem we are solving. When discussing this, I think we should also talk about if we want to support the v11 ClassPrefix component. This is related. Can library consumers choose their own class prefixes? How does that impact bundling of styles?

  1. Ship these components, then continue work towards carbon-components-svelte@v1

At this point components should already be shipped. Improvements to developer experience and work towards feature parity can be parallel as long as we manage to make small increments that are mergeable to master.

  1. Afterwards (out of scope for now), we set up svelte-package, types, and other v1 goals

As with point 3 I think improvements towards the build scripts and typescript improvements (svelte/elements) can be discussed separately and gradually merged into master.

If so, I'm on board with this.

I do think we are on the same page here.

@gregorw
Copy link
Contributor Author

gregorw commented Mar 27, 2023

One more thing. If we want to discuss individual components, let’s reset carbon-v11 branch to master and merge individual commits/components of this PR onto that temporary but rather short-lived branch. The idea would really be to make @carbon/styles work with the bare minimum of changes.

@gregorw gregorw force-pushed the carbon-v11 branch 2 times, most recently from 424597a to c69957f Compare March 27, 2023 22:20
@@ -117,7 +117,7 @@
class:bx--date-picker__input="{true}"
class:bx--date-picker__input--invalid="{invalid}"
class:bx--date-picker__input--sm="{size === 'sm'}"
class:bx--date-picker__input--xl="{size === 'xl'}"
class:bx--date-picker__input--lg="{size === 'lg' || size === 'xl'}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@theetrain I wonder if we should keep supporting legacy size xl for a while. What do you think?

@gregorw gregorw force-pushed the carbon-v11 branch 4 times, most recently from d7685f9 to ee3dcfa Compare March 31, 2023 17:50
@v3ss0n
Copy link

v3ss0n commented Apr 17, 2023

UIShell is broken withou this.

PS : Scss files and css files are missing from yout PR>

@gregorw gregorw force-pushed the carbon-v11 branch 4 times, most recently from 0e42e43 to a555fdc Compare September 30, 2023 13:43
gregorw added 10 commits October 7, 2023 12:17
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 added 17 commits October 7, 2023 12:24
Note that state labels `tileCollapsedLabel` and `tileExpandedLabel` are no longer supported.
For better compatibility with existing codebases sizes `field` and `small` are still supported. Note that flagship implementation does the same thing.
This removes legacy `ToggleSkeleton`.
Size `xl` changed to `lg`.
For better compatibility with existing codebases size `xl` is still supported.
Size `xl` changed to `lg`. For better compatibility with existing codebases size `xl` is still supported.
Size `xl` changed to `lg`. For better compatibility with existing codebases size `xl` is still supported.
Size `xl` changed to `lg`. For better compatibility with existing codebases size `xl` is still supported.
The `bx--aspect-ratio--object` class is gone and needs to be replaced manually.
`cols` no longer has a defaults to 50 but remains at 100% width by default.
Size `xl` changed to `lg`. For better compatibility with existing codebases size `xl` is still supported.
Size `xl` changed to `lg`. For better compatibility with existing codebases size `xl` is still supported.
Size `compact` changed to `xs`. For better compatibility with existing codebases size `compact` is still supported.
Size `xl` changed to `lg`. For better compatibility with existing codebases size `xl` is still supported.
* Breaking changes *

- The `Popover` now uses a different markup. The trigger becomes a child of the component.
- The new `PopoverContent` becomes an additional child of the `Popover` component.
- remove `relative` property
In v11 the definintion tooltip uses the `Popover` component internally. While the component is called `DefinitionTooltip` in the reference implementation, it is not renamed at this point.

- rename `tooltipText` to `definition`
- rename `tooltip` slot to `definition`
- remove `direction` (see `align`)
- use `align` values from `Popover` and set to `bottom-left` as default instead of `center`
@gregorw gregorw force-pushed the carbon-v11 branch 3 times, most recently from 5562360 to 9fe7411 Compare October 7, 2023 14:43
Refactor `Tooltip` to use `Popover` component internally.

**Breaking changes**

- `direction` is replaced by additional `align` options.
- `hideIcon` property is removed.

**Limitations**

- The reference implementaiton uses the trigger content instead of the tooltip content as primary slot. This is not considered in this refactoring since it would be too big of a change.
- Instead of `TooltipFooter` a new `Toggletip` component would be required which is not included in this patch.
@metonym metonym force-pushed the master branch 2 times, most recently from e7485c4 to 417102d Compare November 8, 2023 03:27
@theetrain
Copy link
Collaborator

Superseded by #1881

@theetrain theetrain closed this Jan 12, 2024
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?
3 participants