-
-
Notifications
You must be signed in to change notification settings - Fork 232
Get blueprint namespace directly from blueprintjs #182
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
Get blueprint namespace directly from blueprintjs #182
Conversation
src/util/OptionalBlueprint.tsx
Outdated
import type { IconNames } from '@blueprintjs/icons'; | ||
import classNames from 'classnames'; | ||
import _ from 'lodash'; | ||
import * as React from 'react'; | ||
|
||
// Performs a top level import of blueprint and gets the classes. | ||
async function getBluePrintClasses() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping it optional would be nice - why did you end up removing this? Lack of support in build tools?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Top level async statements are not supported when the target is es2017
; the library would have to be bumped up to es2020
in order to take advantage of that.
Without top level awaits (and support for import
to be called as a function), this approach wouldn't work.
If you're willing to have the module/lib updated to es2020
, I'd be happy to make that change and include this back into the PR.
I'm going to pull this back and create a clean PR which addresses the bp3 issue. If you'd like a PR around loading this dynamically, I'll do that, separately, but it will require a lot of upgrading to the build tooling, which obfuscates the issue. |
I appreciate all the action here - I'm working on adding |
Should have a release today |
@nomcopter appreciated, thanks! TBH, I like this solution, allowing us to define it in code, but I wasn't sure if that was in the spirit that you intend for the library |
Yeah it would be nice to do it automatically with proper optional dependencies or by just requiring blueprint but build tooling support for the former is obnoxious and restrictive downstream and the latter complicates things for those that don't want it. Appreciate the thorough issues and PR! |
Fixes #181
Changes proposed in this pull request:
Update
OptionalBlueprint
to set the blueprint namespace constant using a from theClasses
type exported from blueprint.Confirmed that it is available in both 3.0 and 4.0:
https://github.com/palantir/blueprint/blob/develop/packages/core/src/common/classes.ts#L316
https://github.com/palantir/blueprint/blob/%40blueprintjs/core%403.54.0/packages/core/src/common/classes.ts#L322
Reviewers should focus on:
The buttons being sized correctly in react mosaic when using blueprintjs 4.0 and react mosaic 5.0