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

refactor: UI libs CSS+API refactor #698

Merged

Conversation

matthewlipski
Copy link
Collaborator

@matthewlipski matthewlipski commented Apr 11, 2024

TODO:

  • Suggestion Menu, Side Menu, Table Handles in component context
  • Fix Mantine Formatting Toolbar color styles button dropdown
  • Ariakit remaining styling (image replace/caption buttons, link create button)
  • ShadCN styling
  • Set base bn- classes in a more elegant way
  • Fix BlockNoteViewRaw not having schema type args

Thoughts:

  • I know that using a select for the block type dropdown is most semantically correct, but I think it's a bit redundant.
    • Adds an additional field to the API.
    • Functionally the same as color style button, i.e. items run editor commands.
    • Cannot pass a class name to target and dropdown separately as the select is treated as 1 element.
  • Since we want to minimize any changes made to the base ShadCN components, it means that some parts of the UI don't look quite right. These are fairly minor changes, just adjusting some element spacing, but we have 3 options for handling this:
    1. We leave the styling as-is, since we expect people to provide their own pre-styled ShadCN components anyway.
    2. We change the Tailwind styles within the base ShadCN components.
    3. We add an additional CSS file to with said styling fixes.
  • How should we handle icons? Currently these are set by the react package without possibility of overriding them. This also means that react-icons is a dependency in the react package.
  • We probably want to make the components in the context as generic as possible, as right now there's an ugly mix of specific and generic ones.

Copy link

vercel bot commented Apr 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
blocknote ✅ Ready (Inspect) Visit Preview Apr 30, 2024 9:27am
blocknote-website ✅ Ready (Inspect) Visit Preview Apr 30, 2024 9:27am

@matthewlipski matthewlipski changed the base branch from main to refactor/shadcn-remaning-components April 11, 2024 03:11
packages/ariakit/src/index.tsx Show resolved Hide resolved
packages/ariakit/src/menu/Menu.tsx Outdated Show resolved Hide resolved
packages/ariakit/src/style.css Outdated Show resolved Hide resolved
packages/ariakit/src/toolbar/ToolbarButton.tsx Outdated Show resolved Hide resolved
</Ariakit.Tooltip>
</Ariakit.TooltipProvider>
);
// return (
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this a todo?

packages/mantine/src/menu/Menu.tsx Outdated Show resolved Hide resolved
packages/mantine/src/panel/PanelButton.tsx Show resolved Hide resolved
packages/mantine/src/styles.css Outdated Show resolved Hide resolved
packages/mantine/src/styles.css Outdated Show resolved Hide resolved
packages/shadcn/src/toolbar/Toolbar.tsx Outdated Show resolved Hide resolved
@matthewlipski
Copy link
Collaborator Author

To make things easier, I'm implementing feedback from #684, #689, and #696 here since this PR has the biggest changes, so everything can be in one place.

examples/01-basic/01-minimal/App.tsx Outdated Show resolved Hide resolved
examples/01-basic/01-minimal/App.tsx Outdated Show resolved Hide resolved
packages/ariakit/src/ariakitStyles.css Outdated Show resolved Hide resolved
packages/mantine/src/suggestionMenu/SuggestionMenu.tsx Outdated Show resolved Hide resolved
packages/react/src/editor/ComponentsContext.tsx Outdated Show resolved Hide resolved
packages/shadcn/src/index.tsx Outdated Show resolved Hide resolved
- Re-added refs to all relevant components
- Refactored ShadCN context
- Simplified how class names are set in `react` package
- Added prefixes to all UI specific class names
- Fixed remaining select/menu/popover overflow issues
- Fixed examples
- Fixed build
@matthewlipski matthewlipski merged commit eb28c32 into refactor/shadcn-remaning-components Apr 30, 2024
2 of 3 checks passed
matthewlipski added a commit that referenced this pull request Apr 30, 2024
* Added ShadCN color styles button & form components

* refactor: UI libs CSS+API refactor (#698)

* Cleaned up component context API

* WIP

* Refactored CSS & ShadCN API

* Fixed Ariakit component props

* Fixed Mantine component props

* Fixed ShadCN component props

* Cleanup

* Misc fixes

* - Added remaining components to context
- Re-added refs to all relevant components
- Refactored ShadCN context
- Simplified how class names are set in `react` package
- Added prefixes to all UI specific class names
- Fixed remaining select/menu/popover overflow issues
- Fixed examples
- Fixed build

* Changed ShadCN suggestion menu to use Card

* Small fix

* Fixed linting

* Fixed `BlockNoteViewRaw` typing

* Misc fixes

* Misc fixes

* Fixed unit tests

* Fixed Mantine sub menus

* Misc UI fixes

* Misc changes

* fix import

* fix tablehandles performance issue / max call stack

* Fixed PW tests

* Small fix

* Added ShadCN/Ariakit tests

* fix draghandles

* add vercel rewrites

* improve shadcn setup

* Fixed remaining Ariakit/ShadCN/Mantine styles

* extract strings from react package

* extract all strings

* clean i18n setup

* fix build

* Fixed dark mode for Ariakit/ShadCN

* Misc fixes

---------

Co-authored-by: yousefed <[email protected]>

---------

Co-authored-by: yousefed <[email protected]>
matthewlipski added a commit that referenced this pull request Apr 30, 2024
* Extracted mantine & ariakit packages

* fix: ShadCN color styles button & form components (#696)

* Added ShadCN color styles button & form components

* refactor: UI libs CSS+API refactor (#698)

* Cleaned up component context API

* WIP

* Refactored CSS & ShadCN API

* Fixed Ariakit component props

* Fixed Mantine component props

* Fixed ShadCN component props

* Cleanup

* Misc fixes

* - Added remaining components to context
- Re-added refs to all relevant components
- Refactored ShadCN context
- Simplified how class names are set in `react` package
- Added prefixes to all UI specific class names
- Fixed remaining select/menu/popover overflow issues
- Fixed examples
- Fixed build

* Changed ShadCN suggestion menu to use Card

* Small fix

* Fixed linting

* Fixed `BlockNoteViewRaw` typing

* Misc fixes

* Misc fixes

* Fixed unit tests

* Fixed Mantine sub menus

* Misc UI fixes

* Misc changes

* fix import

* fix tablehandles performance issue / max call stack

* Fixed PW tests

* Small fix

* Added ShadCN/Ariakit tests

* fix draghandles

* add vercel rewrites

* improve shadcn setup

* Fixed remaining Ariakit/ShadCN/Mantine styles

* extract strings from react package

* extract all strings

* clean i18n setup

* fix build

* Fixed dark mode for Ariakit/ShadCN

* Misc fixes

---------

Co-authored-by: yousefed <[email protected]>

---------

Co-authored-by: yousefed <[email protected]>

---------

Co-authored-by: yousefed <[email protected]>
matthewlipski added a commit that referenced this pull request Apr 30, 2024
* Extracted Mantine panel components

* Added ShadCN panel implementation

* Added Ariakit image panel components

* refactor: Extract Mantine & Ariakit packages (#689)

* Extracted mantine & ariakit packages

* fix: ShadCN color styles button & form components (#696)

* Added ShadCN color styles button & form components

* refactor: UI libs CSS+API refactor (#698)

* Cleaned up component context API

* WIP

* Refactored CSS & ShadCN API

* Fixed Ariakit component props

* Fixed Mantine component props

* Fixed ShadCN component props

* Cleanup

* Misc fixes

* - Added remaining components to context
- Re-added refs to all relevant components
- Refactored ShadCN context
- Simplified how class names are set in `react` package
- Added prefixes to all UI specific class names
- Fixed remaining select/menu/popover overflow issues
- Fixed examples
- Fixed build

* Changed ShadCN suggestion menu to use Card

* Small fix

* Fixed linting

* Fixed `BlockNoteViewRaw` typing

* Misc fixes

* Misc fixes

* Fixed unit tests

* Fixed Mantine sub menus

* Misc UI fixes

* Misc changes

* fix import

* fix tablehandles performance issue / max call stack

* Fixed PW tests

* Small fix

* Added ShadCN/Ariakit tests

* fix draghandles

* add vercel rewrites

* improve shadcn setup

* Fixed remaining Ariakit/ShadCN/Mantine styles

* extract strings from react package

* extract all strings

* clean i18n setup

* fix build

* Fixed dark mode for Ariakit/ShadCN

* Misc fixes

---------

Co-authored-by: yousefed <[email protected]>

---------

Co-authored-by: yousefed <[email protected]>

---------

Co-authored-by: yousefed <[email protected]>

---------

Co-authored-by: yousefed <[email protected]>
YousefED added a commit that referenced this pull request May 5, 2024
* wip

* Refactored image toolbar

* Refactored image toolbar, hyperlink toolbar, and table handles

* Implemented PR feedback

* Implemented PR feedback

* Cleaned up component code

* wip: ariakit

* wip

* fix

* fix merge

* wip

* wip

* fix

* wip

* wip

* wip: suggestionmenu

* extract suggestion menu

* wip

* side menu button

* move mantine elements to mantine dir

* shadcn wip

* wip

* fix

* shadcn fixes

* refactor: Extract image panel components (#684)

* Extracted Mantine panel components

* Added ShadCN panel implementation

* Added Ariakit image panel components

* Revert "refactor: Extract image panel components (#684)" (#716)

This reverts commit 600f0c5.

* refactor: Extract image panel components (#717)

* Extracted Mantine panel components

* Added ShadCN panel implementation

* Added Ariakit image panel components

* refactor: Extract Mantine & Ariakit packages (#689)

* Extracted mantine & ariakit packages

* fix: ShadCN color styles button & form components (#696)

* Added ShadCN color styles button & form components

* refactor: UI libs CSS+API refactor (#698)

* Cleaned up component context API

* WIP

* Refactored CSS & ShadCN API

* Fixed Ariakit component props

* Fixed Mantine component props

* Fixed ShadCN component props

* Cleanup

* Misc fixes

* - Added remaining components to context
- Re-added refs to all relevant components
- Refactored ShadCN context
- Simplified how class names are set in `react` package
- Added prefixes to all UI specific class names
- Fixed remaining select/menu/popover overflow issues
- Fixed examples
- Fixed build

* Changed ShadCN suggestion menu to use Card

* Small fix

* Fixed linting

* Fixed `BlockNoteViewRaw` typing

* Misc fixes

* Misc fixes

* Fixed unit tests

* Fixed Mantine sub menus

* Misc UI fixes

* Misc changes

* fix import

* fix tablehandles performance issue / max call stack

* Fixed PW tests

* Small fix

* Added ShadCN/Ariakit tests

* fix draghandles

* add vercel rewrites

* improve shadcn setup

* Fixed remaining Ariakit/ShadCN/Mantine styles

* extract strings from react package

* extract all strings

* clean i18n setup

* fix build

* Fixed dark mode for Ariakit/ShadCN

* Misc fixes

---------

Co-authored-by: yousefed <[email protected]>

---------

Co-authored-by: yousefed <[email protected]>

---------

Co-authored-by: yousefed <[email protected]>

---------

Co-authored-by: yousefed <[email protected]>

* Updated package versions

* Updated screenshots

* Updated screenshots

* Updated screenshots

* Updated screenshots

* Updated docs

* Addressed most TODOs and small fixes

* Added ShadCN form

* update docs

* i18n + docs

* Updated theming code

* fix build and lint

---------

Co-authored-by: Matthew Lipski <[email protected]>
Co-authored-by: Matthew Lipski <[email protected]>
YousefED added a commit that referenced this pull request May 5, 2024
* wip

* Refactored image toolbar

* Refactored image toolbar, hyperlink toolbar, and table handles

* Implemented PR feedback

* Implemented PR feedback

* Cleaned up component code

* wip: ariakit

* wip

* fix

* fix merge

* wip

* wip

* fix

* wip

* wip

* wip: suggestionmenu

* extract suggestion menu

* wip

* side menu button

* move mantine elements to mantine dir

* shadcn wip

* wip

* fix

* shadcn fixes

* refactor: Extract image panel components (#684)

* Extracted Mantine panel components

* Added ShadCN panel implementation

* Added Ariakit image panel components

* Revert "refactor: Extract image panel components (#684)" (#716)

This reverts commit 600f0c5.

* refactor: Extract image panel components (#717)

* Extracted Mantine panel components

* Added ShadCN panel implementation

* Added Ariakit image panel components

* refactor: Extract Mantine & Ariakit packages (#689)

* Extracted mantine & ariakit packages

* fix: ShadCN color styles button & form components (#696)

* Added ShadCN color styles button & form components

* refactor: UI libs CSS+API refactor (#698)

* Cleaned up component context API

* WIP

* Refactored CSS & ShadCN API

* Fixed Ariakit component props

* Fixed Mantine component props

* Fixed ShadCN component props

* Cleanup

* Misc fixes

* - Added remaining components to context
- Re-added refs to all relevant components
- Refactored ShadCN context
- Simplified how class names are set in `react` package
- Added prefixes to all UI specific class names
- Fixed remaining select/menu/popover overflow issues
- Fixed examples
- Fixed build

* Changed ShadCN suggestion menu to use Card

* Small fix

* Fixed linting

* Fixed `BlockNoteViewRaw` typing

* Misc fixes

* Misc fixes

* Fixed unit tests

* Fixed Mantine sub menus

* Misc UI fixes

* Misc changes

* fix import

* fix tablehandles performance issue / max call stack

* Fixed PW tests

* Small fix

* Added ShadCN/Ariakit tests

* fix draghandles

* add vercel rewrites

* improve shadcn setup

* Fixed remaining Ariakit/ShadCN/Mantine styles

* extract strings from react package

* extract all strings

* clean i18n setup

* fix build

* Fixed dark mode for Ariakit/ShadCN

* Misc fixes

---------

Co-authored-by: yousefed <[email protected]>

---------

Co-authored-by: yousefed <[email protected]>

---------

Co-authored-by: yousefed <[email protected]>

---------

Co-authored-by: yousefed <[email protected]>

* Updated package versions

* Updated screenshots

* Updated screenshots

* Updated screenshots

* Updated screenshots

* Updated docs

* Addressed most TODOs and small fixes

* Added ShadCN form

* update docs

* i18n + docs

* fix keyboard handling of menus (tab, escape, etc.)

* remove unnecessary default props  on BlockNoteDefaultUI

* fix mantine menu items with keyboard + small cleanup

* add button labels and type checks

* Updated theming code

* suggestion menu aria improvements

* small toolbarButton fix

* playwright fixes

* fix lint

* fix build and lint

* fix pw tests

* address PR feedback

* Merge remote-tracking branch 'origin/refactor/multi-ui-libs' into feature/accessibility-improvements

---------

Co-authored-by: Matthew Lipski <[email protected]>
Co-authored-by: Matthew Lipski <[email protected]>
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.

2 participants