Commit Graph

46 Commits

Author SHA1 Message Date
Elizabeth Mitchell
7b52c4515f fix: remove @ariaProperty decorator
PiperOrigin-RevId: 526750432
2023-04-24 14:10:38 -07:00
Elizabeth Mitchell
0a35ff5042 fix: remove role attribute from elements
PiperOrigin-RevId: 526712160
2023-04-24 11:51:47 -07:00
Material Web Team
9d7b2910d7 fix(menu): submenus will open correctly on click
PiperOrigin-RevId: 523796693
2023-04-12 13:53:53 -07:00
Material Web Team
55df403768 fix(menu,list): new sys token mismatch between menu and list
in the latest set of tokens there was a mismatch betwee color in menu container and list-item container. In this PR we:

- Refactor menu and list token value function to have supported and unsupported token lists
- Apply menu-container-color to list-item-container-color
  - Do some appropriate token renames to reflect this
- Move menu elevation layer below the list items
  - We do this because the new v172 tokens fix the colors here by flattening elevation

PiperOrigin-RevId: 523531521
2023-04-11 16:10:36 -07:00
Daniel Freedman
9ce10bc100 chore(all): remove unnecessary property typing for strings
PiperOrigin-RevId: 523201301
2023-04-10 13:43:10 -07:00
Elizabeth Mitchell
7ccc21e0d2 fix(menu): tonal surface update
PiperOrigin-RevId: 522244590
2023-04-05 22:06:11 -07:00
Elizabeth Mitchell
d12ed3e4e3 chore(elevation)!: remove surface for tonal surface update
Changes:
- Elevation is now `inset:0;position:absolute;` by default
- Separated surface styles into a temporary `<md-elevation-surface>` element (this will be removed after tonal surface update)
PiperOrigin-RevId: 521934300
2023-04-04 20:14:24 -07:00
Material Web Team
fdd7e8221a refactor(menu,list): reexport item harnesses
PiperOrigin-RevId: 520546423
2023-03-29 23:11:48 -07:00
Material Web Team
3445b631fe fix(menu): close menu on focusout and make it configurable
PiperOrigin-RevId: 520502277
2023-03-29 18:52:12 -07:00
Material Web Team
6194541ab1 refactor(menu): turn typeahead tuple indices into an enum
PiperOrigin-RevId: 520501650
2023-03-29 18:47:58 -07:00
Material Web Team
712aab3efc feat(list,menu): implement forced colors
PiperOrigin-RevId: 520501176
2023-03-29 18:44:13 -07:00
Material Web Team
bfa1bec320 fix(menu): properly implement selected state
Before, I set the focused, actively-keyboard-interacted, or pressed element as visual selected state. That doesn't seem to be how GMDC handles it and created problems down the line with md-select where we could not show the currently-selected item + keyboard navigation at the same time.

This CL brings the behavior in line with GMDC and fixes this problem down the line for select.

Also in this CL I add the selected state to sub-menu-item when it's open

PiperOrigin-RevId: 519166067
2023-03-24 09:40:29 -07:00
Elizabeth Mitchell
715c5927a7 chore(sass): remove elevation resolvers
PiperOrigin-RevId: 518051579
2023-03-20 12:57:55 -07:00
Elizabeth Mitchell
427d33d979 fix(menu): incorrect elevation
PiperOrigin-RevId: 517485685
2023-03-17 12:58:24 -07:00
Material Web Team
ddac76e3bc fix(menu): flatten submenu slot query
PiperOrigin-RevId: 516879683
2023-03-15 11:22:17 -07:00
Material Web Team
193b220a73 feat(menu): prepare menu to support md-select
Prepare menu to support md-select by doing the following:

- Export default values for typeahead configs
- Allow setting the role of the menu
- Support spaces in typeahead
  - Make the typeahead controller public so that one can bind it to another node
  - Listen to keydown events on capture rather than bubble
  - Allow disabling typeahead with events to prevent submenu typeahead clashes
- Fire opening and closing events synchronously on quick = true
- Fix focus restoration timing as it would fight with setting custom focus on items
- Fix bug with `onWindowClick` not cleaning up
- Add `focus()` as mart of the menuitem api
- Prevent typeahead from messing with focus and leave that to the menu/list

PiperOrigin-RevId: 516640007
2023-03-14 14:51:05 -07:00
Material Web Team
533ae6c999 feat(field,menu): create a surface client rect api for positioning
Expose the field container element to allow anchoring directly to it. This is necessary because if there is supporting text below the field, anchoring a menu to the md-field will cause the menu to anchor below the supporting text which would require some manual pixel-offsets to align correctly.

PiperOrigin-RevId: 516636675
2023-03-14 14:38:55 -07:00
Elizabeth Mitchell
615527886b fix(elevation): disable pointer-events
PiperOrigin-RevId: 516274391
2023-03-13 11:43:18 -07:00
Material Web Team
35147b25b0 feat(list): add spacing tokens and inherit min-width
In this PR:
- Added spacing tokens to list-item
- Made list inherit min-width from host
- Propagated that min-width from menu to list
- Small fix to single-line list item pushing the icon out of the list item if the supporting text was too long

PiperOrigin-RevId: 515750933
2023-03-10 15:16:33 -08:00
Material Web Team
5092de07e9 refactor(menu,list): clean up list-menu tokens and remove list-item variant components
In this PR:

- Remove unnecessary list-item variants
  - `md-list-item-icon` -> md-icon[data-variant=icon]
  - `md-list-item-video` -> video[data-variant=video]
  - `md-list-item-avatar` -> :is(img,div)[data-variant=avatar]
  - `md-list-item-avatar` -> img[data-variant=avatar]
- also upgrade menu tokens to maximize token sharing in list-item and menu-item
- testing menu and list for unused & undefined tokens
- fixed some small things in list to align with spec more

PiperOrigin-RevId: 513932810
2023-03-06 07:01:56 -08:00
Elizabeth Mitchell
828d7aeb4d fix(all): update non-menu components to v0.161
PiperOrigin-RevId: 512101052
2023-02-24 10:16:16 -08:00
Daniel Freedman
45a6d45577 fix(list,menu)!: move to -text-type tokens
PiperOrigin-RevId: 510452426
2023-02-17 09:37:08 -08:00
Elizabeth Mitchell
6c2aef6901 chore(all): add keep-sorted comments to Sass imports
PiperOrigin-RevId: 509583504
2023-02-14 11:10:23 -08:00
Elizabeth Mitchell
ff84a66f3e fix(ripple)!: remove "state-layer" from token names
PiperOrigin-RevId: 509298729
2023-02-13 12:17:37 -08:00
Material Web Team
e15c4b86d5 feat(menu,list): expose menu theme mixins and remove divider
PiperOrigin-RevId: 506741566
2023-02-02 15:40:21 -08:00
Material Web Team
8f69e62ba7 refactor(menu): rename selected to active for future md-select work
PiperOrigin-RevId: 506740196
2023-02-02 15:34:35 -08:00
Material Web Team
1f2a4d963d chore: fix build for menu and dialog
PiperOrigin-RevId: 506728081
2023-02-02 14:44:43 -08:00
Material Web Team
7d5af92ad0 Implements md-menu
PiperOrigin-RevId: 504701523
2023-01-25 17:14:44 -08:00
Material Web Team
4077c71461 Implement List
PiperOrigin-RevId: 503258388
2023-01-19 13:59:41 -08:00
Elizabeth Mitchell
527b273d8f fix(list): use new elevation component
PiperOrigin-RevId: 499297946
2023-01-03 13:09:48 -08:00
Elizabeth Mitchell
563518b59f fix(menu): use new elevation component
PiperOrigin-RevId: 499297369
2023-01-03 13:06:52 -08:00
Elizabeth Mitchell
eedb7f5d3c chore: replace * selector with :host
PiperOrigin-RevId: 493992896
2022-12-08 14:15:19 -08:00
Elizabeth Mitchell
89eee57074 chore(elevation): branch elevation styles
PiperOrigin-RevId: 493625319
2022-12-07 09:27:08 -08:00
Elizabeth Mitchell
1bc1d2b627 chore(menu): merge static/theme-styles
PiperOrigin-RevId: 485370563
2022-11-01 11:23:34 -07:00
Elizabeth Mitchell
f2b4eec8f0 chore(menu): update to use local custom properties
PiperOrigin-RevId: 485342145
2022-11-01 09:46:05 -07:00
Elizabeth Mitchell
73ca8ae0eb chore: use relative paths
PiperOrigin-RevId: 481941267
2022-10-18 09:28:59 -07:00
Material Web Team
76bb318d11 chore: rename tslint rule
PiperOrigin-RevId: 478066127
2022-09-30 13:23:53 -07:00
Alexander Marks
30c95aeee1 chore: add ".js" extensions to import statements.
In particular, this allows external build tools like Rollup and @web/dev-server to understand imports of Lit, which is configured to require the ".js" extension via its export conditions (so that Lit import maps can remain minimal).

PiperOrigin-RevId: 469772992
2022-08-24 11:01:21 -07:00
Joy Zhong
a29ac8bebb feat(menu): Add menu button component. This manages focus automatically on menu open, setting focus to menu item (rather than menu root) if the menu open originated from a keyboard event.
PiperOrigin-RevId: 469294184
2022-08-22 15:09:54 -07:00
Joy Zhong
f305806955 feat(menu): Implement menu theming API. Use menu surface/list/list item theme() mixins to style subcomponents.
PiperOrigin-RevId: 468705317
2022-08-19 08:15:55 -07:00
Joy Zhong
305b790faa fix(menu): Fix focus management bugs (TAB on menu item closes menu without restoring focus to anchor element, on menu open, menu respects focusState option (first item, last item, or list root).
PiperOrigin-RevId: 466956413
2022-08-11 08:12:17 -07:00
Joy Zhong
7e35820536 feat(menu): Add aria-label support in menu, and set role=menu/menuitem for menu and menu item components.
PiperOrigin-RevId: 466359528
2022-08-09 07:58:41 -07:00
Joy Zhong
884c3a204b feat(menusurface): Add flipMenuHorizontally property, add unit tests.
PiperOrigin-RevId: 465404408
2022-08-04 14:25:14 -07:00
Joy Zhong
d37e23de0d feat(menu): Fix menu closing on menu item click.
PiperOrigin-RevId: 464533483
2022-08-01 07:44:37 -07:00
Joy Zhong
60c4a413d3 feat(menu): Add initial menu base component class.
PiperOrigin-RevId: 463403263
2022-07-26 12:40:08 -07:00
Joy Zhong
de2993744d feat(menu): Add menu foundation/adapter and Sass (forked from MDC).
PiperOrigin-RevId: 462177572
2022-07-20 10:40:30 -07:00