-
Notifications
You must be signed in to change notification settings - Fork 331
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
Material Design Menus implementation #65
Comments
Thanks for your work here @miguelcobain ! 👍 I agree that conceptually we should be thinking differently to selects. I was originally planning on calling my component Please checkout my new work at #63 - it's a departure from the classic Select. That said - In most cases, this proposed component will be used as a select - and think given that we're developing in Ember - we should keep a familiar API to what an ember select looks like. Building off your thoughts, here's my proposal: Simplest Case (Select Menu) {{paper-menu prompt="Select a Price Band"
content=priceBandOptions
optionLabelPath="content.name"
selection=priceBand}}
{{/paper-menu}} In this case, it will render like this. It would expect a single array for its content. Different Activator {{paper-menu prompt="Select a Price Band"
content=priceBandOptions
optionLabelPath="content.name"
selection=priceBand}}
{{#paper-button action="togglePaperMenu" target=this}}Show Menu{{/paper-button}}
{{/paper-menu}} If the Dividers: To show dividers, we would pass an object of arrays into content, rather than a single array. The object would look like:
This would result in a menu that looks like:
This means the Positioning I think the menu should always be positioned based on the activator. In my original POC here, the menu is positioned over the activator, 50% 50%. We could setup a generic SCSS scheme where absolutely positioned elements can be positioned depending on a relatively positioned element, much like Adobe's Illustrator's Align Palette. I feel like this would come in handy in other places in the library, too? Triggering Custom Actions {{paper-menu prompt="Select a Price Band"
content=priceBandOptions
optionLabelPath="content.name"
optionActionPath="content.actionName"
selection=priceBand}}
{{/paper-menu}} In the case that an Triggering Generic Actions We can also have a generic action name that can be bubbled (with the new selection as the argument): {{paper-menu prompt="Select a Price Band"
content=priceBandOptions
optionLabelPath="content.name"
action="priceBandSelectionDidChange"
selection=priceBand}}
{{/paper-menu}} Phew. Thoughts? It wouldn't be hard to implement all of the above based on my existing PR |
After further thought - I feel like the |
I think people should also be able to explicitly declare a menu without an array. I think your suggestion is too specific for selects. That's why I suggested having another component for selects or whatever specific implementation we have for menus. Basically what I'm trying to say is that a Our <span>{{selectedOptionLabel}}</span> {{!--defaults to prompt --}}
{{!--
insert whatever the specific activator for selects are here
the activator sends the open action (or custom event, for example) to paper-menu-container
and set isOpen to true
--}}
{{#paper-menu open=isOpen}}
{{#each item in items}}
{{#paper-menu-item action="select" param=item target=this}} {{!-- I hope that "this" is set to paper-menu-container here. Not sure. --}}
{{item.name}}
{{/paper-menu-item}}
{{/each}}
{{/paper-menu}}
Notice that the select component extends The thing is that menus don't always imply a selection. They can be just actions, for example. Want a select? Just write I really like your idea for separators! Makes a lot of sense. Users can group their items with computed properties if desired! Regarding positioning, the specs say the the menu should be positioned based on the selected item, if there is one.
That's why we can't just center 50% 50% based on the activator every time. We can have that generic action name as well, but we may deal with that later. |
I'm setting up a new branch to illustrate what I'm saying. |
Please check 5de425c It is basically a styleless implementation of selects. You can clone this branch, run |
I feel you! I like the idea that This also means that nested menus will be possible (they aren't in my proposal). If you setup Paper Menu & associated - I can port over the
For that reason - I think
Agree'd. RE: Seperators Rad! I'll set this logic up in RE: Positioning Sure - that's why I'm proposing a flexible case (like Adobe Illustrator) that will be aligned to baselinse, as per the spec. Through generic css classes Developer can choose:
It will also allow horizontal absolute offsets so that:
|
Just saw your branch. I'm about to start work - but I'll have a play with it tonight! |
Just a quick note on positioning. |
Ah word. Not always though - as in the google docs menu or the top right actions menu. I think it's really just selects that need to be opened with the current item on center - right? |
This is a select: image So, at least these two cases have this behavior. Others originate from the activator, and that should be the default. I think that |
Adding |
💯 I'm psyched will jump back into this in a few hours :) |
Just noticed that App bar drop down and Cascading drop down are pretty much the same use case. The only difference is the positioning of the menu.
|
das what im thinking! |
did some work on this last night - still needs some more ❤️ |
You can set up a PR or a public branch on your own fork. |
Ember Component's |
subscribing |
There is now a reasonable implementation of selects in https://github.com/miguelcobain/ember-paper/tree/material-menus Animation and positioning is missing, but the structure and styling is there. |
any foreseeable merge date for this PR? |
Well, this isn't a PR, but yes development is ongoing. I don't have any estimate for now, but it is more that 50% done! |
If you need help testing it let me know. |
As of now, this seems to be the only major component still left.Any update on when we can expect this will be great,Thanks! |
@msounthar |
@peec very exciting! |
Thanks @peec. Your autocomplete implementation is also great. Hoping to see it all as part of the release soon. |
@miguelcobain is something missing from @peec implementation of menu component, which delaying your merge into the master? |
@miguelcobain No problem, I am used to seeing comments from you on a given issue/PR -- this one was stale for 2 weeks. 👍 You are doing a wonderful job. |
Two questions:
I am rather keen on having an actual menu bar for application commands. Thank you for your efforts. I'm just starting with ember-paper, but am excited so far. |
@miguelcobain @DanChadwick status for this particular issue? I know that menu hasn't been upgraded for 1.0 yet, wondering where to refer to for latest intentions, if i were to contribute :) |
Ping! Can I do nested menus in 1.0? |
Nested do seem to work, although I can't get |
Menus are already implemented (not nested menus, though). |
After looking at the specs, I came to this conclusion:
Material Design doesn't define any select component. Instead it has the concept of menus. Menus are pretty much the same everywhere. Some common features are:
Use cases that menus should cover:
I'm willing to make a full-featured material menu component, or at least the base abstractions for having a decent way to compose future menus.
I separated this on a number of tasks I could identify, so we don't step on each others toes:
paper-menu
.paper-menu-item
(that's what the spec calls them)paper-menu
paper-icon
on the right or left side (image)paper-menu-item-divider
or reuse existingpaper-divider
paper-menu-container
paper-menu
and a triggering element element that shows the menu. This is generic, any element could trigger it, probably meant to be subclassed by ember-paper or to customize menu elements users.open
andclose
Proposal for the generic menu usage:
Notice that this follows ember's new motto "actions up, data down", i.e
paper-menu
hasopen
from parent component andpaper-menu-item
sends actions to parent. Correct me if I'm wrong.After this, it may be the time where we need to create specific components for each use case:
paper-button-menu
extendspaper-menu-container
paper-select
extendspaper-menu-container
paper-list-item-menu
extendspaper-menu-container
Not so sure about how one would use these concrete components, though. We'll give it some more thoughts later.
Any suggestions/comments?
The text was updated successfully, but these errors were encountered: