nikgraf / belle Goto Github PK
View Code? Open in Web Editor NEWConfigurable React Components with great UX
Home Page: http://nikgraf.github.io/belle/
License: MIT License
Configurable React Components with great UX
Home Page: http://nikgraf.github.io/belle/
License: MIT License
Same for disabledHover. It should extend disabledStyle.
I noticed I made this mistake at the Select. There might be other places. We should double-check.
When a user does a mouseDown or touchStart at the ComboBox we should provide an activeStyle. While this is not necessary for the default belle styling we have right now it is for different themes e.g Bootstrap.
Running
npm install belle
on Windows 8.1, I get the following error:
545 error Windows_NT 6.3.9600
546 error argv "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "install" "belle"
547 error node v0.12.2
548 error npm v2.7.4
549 error code ELIFECYCLE
550 error [email protected] postinstall: rm -rf node_modules/react/ && rm -rf node_modules/underscore/
550 error Exit status 1
551 error Failed at the [email protected] postinstall script 'rm -rf node_modules/react/ && rm -rf node_modules/underscore/'.
551 error This is most likely a problem with the belle package,
551 error not with npm itself.
551 error Tell the author that this fails on your system:
551 error rm -rf node_modules/react/ && rm -rf node_modules/underscore/
551 error You can get their info via:
551 error npm owner ls belle
551 error There is likely additional logging output above.
Apparently, as for line 551, it tries to execute this command :
rm -rf node_modules/react/ && rm -rf node_modules/underscore/
which of course is not valid on Windows.
Have anyone had better luck installing it?
In here an issue with resizing probably was discovered. This would need investigation. At best an example or a test.
We used checked as it made sense to mimic the checkbox API. Since we are moving to onUpdate it's better to align the APIs & use value instead.
This is more experimental, but for example when fading from hover/default state to active state we could leverage animations to give the components a better feeling.
Also switching from default state to hover could be a slide colour fade.
Would be good if both behave the same way. Let's see if there is a good path towards that goal.
How to: Put Select, TextInput, ComboBox next to each other and make sure the Text and border bottom are the same horizontal lines
I like your code and I would love to see jss (https://github.com/jsstyles/jss) to be used for styling. It would simplify the code in some places and you can get rid of some helper functions. It has also react integration https://github.com/jsstyles/react-jss which basically ensures you have only sheets rendered into document, which are also in use by rendered components. Also jss styles can't clash.
clone belle
cd belle
npm install
cd examples
npm install
npm start
...
Error: Cannot find module 'react' from '~/dev/belle/lib/components'
[Error: write after end]
Error: Cannot find module 'react' from '~/dev/belle/lib/config'
[Error: write after end]
This feature was really a bold move & there are still some issues. Question is if we should deprecate it at all.
While a lot of people use underscore, some use lowdash or just go with ImmutableJS. In order to pre-subscribe belle users to underscore we might want to create little micro library only with the functions we really need.
Proposed way of tackling this:
Open question:
Todos:
The reason for keep the focus state independent from DOM focus was WAI-ARIA specification that current date should be focused as date picker of focused. And focus behavior while tabbling which was not achievable with DOM focus.
<ActionArea>
rather than touchStart or mouseDown ?Initially we were striving to build components that behave exactly like HTML native ones, but with additional features & more control over them. This idea was mainly driven by React's concept of "Learn once, write anywhere". This would have included getting all the events right. So we aimed to implement the onChange callback to return an object that would look like:
{
target: domNode(with value),
currentTarget: domNode of current target,
…
}
At the React Europe conference I talk to some of the React core contributors what they would recommend. The feedback was not trying to mimic the current API. One reason is that after the 0.14 beta announcement we see React going in a direction with a React core & different packages to render to different targets. We might even see a future where components work for multiple targets. This would mean the API should be designed in a way to work on different targets. Putting DOM events in there would be the wrong direction. Another reason is that I don't even know if it's possible to get it right in all the browsers. It's more of a gut feeling, as I haven't really tried apart from the target property.
After Jyoti & I decided we won't mimic the API we needed to come up with our own that can be applied consistently. We didn't even need to think about it. It was obvious the changed value is the relevant information. Luckily we got another good advice on the conference: "Whenever you create an event like callback wrap it into an object. You never know what you might want to add in the future and you don't want to break the API". While we won't add anything from the beginning I already can imagine how beneficial this advice was. We ended up with this structure { value: value }
.
Last but not least we needed a name for the callback. OnChange came naturally as we already had it in the code. Unfortunately there was an issue. We didn't feel comfortable using the same name as React does, but applying different behaviour. As a developer coming from HTML/JS you already had to learn that onChange behaves differently than in the specs. Should we break with this behaviour once again? I wasn't happy about it. Even someone from the React core team told me something like: "Maybe it wasn't the best choice we picked the name onChange". So we saw an opportunity here. If we don't mimic the original API, we don't want to add confusion. So we decided to go with onUpdate
. An alternative name would have been onModify
. If you think that would have been better for some reason let us know.
The final API:
this.props.onUpdate({ value: value });
Did we miss something? Should we do it in another way? Let us know what you think?
Originally this came up in this discussion: #60
@jpuri I noticed when clicking mouseDown on a star of the Rating component, then drag & release somewhere else the stars are not set. Not even the old value is there.
Short demo video: https://youtu.be/8ZxPsG4KMj0
Add one more pseudoClass style disabledStyle
. It can either leverage the same style injection as active or be updated based on the props (Probably the second one). Keep in mind to provide a version for the primary button as well.
The Toggle is larger enough, but when sliding in one direction, but moving back it's very easy to loose track of the Toggle. The field of where touch events are allowed should be bit bigger.
My first guess is that we should add the height on the top & bottom as sliding area.
Hi Nikgraf,
Cool branch off! One note - there might be a memory/element leak somewhere. I noticed that after typing in the demo textbox (http://nikgraf.github.io/belle/#text-input) my browser tends to go ballistic and adds hundreds of new DOM elements on key keystroke, which brings it to a halt and introduces a lengthy lag between keydown and character appearing on the screen. After a few lines document.getElementsByTagName('*') reporting 20,000 elements (vs 300 at the start).
I didn't have a chance to investigate whether the problem is with the textbox itself or the page wrapping or any external change listeners.
This could make it way easier for people to understand this huge list of properties.
I thought of these groups
What do you think? I'm open to any other grouping suggestions. /cc @jpuri
In some situation I noticed the contrast is too little and you barely can see which option you chose.
When a user does a mouseDown or touchStart at the Select we should provide an activeStyle. While this is not necessary for the default belle styling we have right now it is for different themes e.g Bootstrap.
Documentation Select:
Combobox
Toggle
Minor issues:
Right now if you switch themes some styles seem to not be applied e.g. focusStyle on Rating
Brainstorming with @crtvhd
<Toggle />
<label>
<Toggle />g
Hello
</label>
--> by default is checkbox
<Toggle>
<Choice id="yes" className="first-choice">On</Choice>
<Choice id="no" className="first-choice">Off</Choice>
</Toggle>
<Toggle>
<Choice className="first-choice">On</Choice>
<Choice style={{ color: red }}>Off</Choice>
</Toggle>
Yes/No
<label>
<Toggle
defaultChecked={this.state.baconIsReady}
onChange={this.handleBaconChange} />
<span>Wrapper label tag</span>
</label>
<Toggle>
<Choice id="" className="first-choice">On</Choice>
<Choice style={{ color: red }}>Off</Choice>
</Toggle>
As you can't slide the toggle the component anyway touching the handle I wonder why this is needed. /cc @jpuri
I think we should have this, it will be useful esp. if number of options in select to too long.
This might required to update babel.
<ComboBox>
<Option value="apple">Apple</Option>
<Option value="orange">Orange</Option>
<ComboBox>
<Autocomplete>
<NoEntryPlaceholder>No entry found.</NoEntryPlaceholder>
<Option value="apple">Apple</Option>
<Option value="orange">Orange</Option>
<Autocomplete>
placeholder
(text) it will be used as placeholder for the input.defaultValue
(text) is defined the initial input value is set & can be changed.<div>
<input type="text">
optional: <span>carret</span>
<ul>
<li>
<Option />
</li>
…
optional: no entry found placeholder
</ul>
</div>
This is needed in case the screen width becomes smaller than the TextInput width & eventually the content will flow into the next line.
Add one more pseudoClass style disabledStyle
. It can either leverage the same style injection as active or be updated based on the props (Probably the second one). Keep in mind to provide a version for the primary button as well.
Right now updating the styles will cause issues with the height calculations as the styles are cached & not updated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.