Skip to content

[Menu] Flexify menu items #1136

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

Closed
wants to merge 72 commits into from
Closed

[Menu] Flexify menu items #1136

wants to merge 72 commits into from

Conversation

llorca
Copy link
Contributor

@llorca llorca commented May 23, 2017

Fixes #984

Changes proposed in this pull request:

Use flex for menu items for better truncation.

  • Should menu items truncate or wrap by default?

Screenshots

Menu items no longer truncate by default:
image

Menu items with buttons still work but no longer truncate:
image

For perfectly truncated one-liner menu items, a new class is now required for the menu item text itself (span.pt-menu-item-text):
image

@llorca llorca requested a review from giladgray May 23, 2017 18:34
@llorca llorca requested a review from adidahiya May 23, 2017 18:36
@blueprint-bot
Copy link

Update Classes.ts and usage

Preview: documentation | table
Coverage: core | datetime

Copy link
Contributor

@giladgray giladgray left a comment

Choose a reason for hiding this comment

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

definitely going to need to add some docs about this... the MenuItem API is unchanged as it automatically wraps text in this element, but we should note the HTML change somewhere

{labelElement}
{this.props.text}
<span className={Classes.MENU_ITEM_TEXT}>{this.props.text}</span>
{label != null && <span className={Classes.MENU_ITEM_LABEL}>{label}</span>}
Copy link
Contributor

Choose a reason for hiding this comment

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

in this codebase, we prefer to use ternary condition ? <el /> : undefined instead of boolean coercion.

@giladgray
Copy link
Contributor

NOTE: this PR targets the feature/2.0 branch to allow for breaking changes.

@blueprint-bot
Copy link

Proper ternary

Preview: documentation | table
Coverage: core | datetime

@llorca llorca requested a review from giladgray May 23, 2017 19:16
lucasray and others added 18 commits May 23, 2017 16:43
* Don't show regions that aren't in the table

* Add more tests, name variables

* Fix indent

* Update indentation
* Don't close popover if only the time changed

* Add unit tests

* Fix logic that's causing broken test

* Oops, delete .only

* Write a failing test for an edge-case

* Fix the failing test

* Clarify the boolean logic

* Change !== to !=
* move empty content check from Tooltip to Popover
* remove now unused things
* add empty content option to Popover example
- Put dialog example first (_finally_...)
- Document the default behavior correctly (`inline={false}` by default)
…place (#1154)

* Clean up navbar styles, rename pages

* Add sidebar to hold toggles eventually

* Add toggle for ghost cells

* Add toggle for 'Show focus cell', with slight refactors

* Enable context menu

* Enable full-table selection

* Enable multiple selections

* Enable row and column selection

* Enable row and column resizing

* Enable row and column reordering

* Show column menus

* Enable column name editing

* Show inline, better styles

* Change row and column counts

* Make sidebar scrollable

* Show row and column headers loading

* Show row headers

* Enable most features by default

* Increase default row count

* Show cells loading

* Enable cell selection

* Enable cell editing

* Enable zebra striping

* Custom regions

* Better styles

* Focus style control

* Sync focus style on componentDidMount too
- Upgrade to Chai 4.0 to get includeDeepMembers assertion
- Remove tests that were mostly tautological and relied on old lenient APIs
…component (#1140)

* Write AbstractHeader and AbstractHeaderCell

* Refactor RowHeader to extend from AbstractHeader

* Move IColumnHeaderRenderer into columnHeader.tsx

* Extend IHeaderProps in ColumnHeader

* Refactor ColumnHeader to extend from AbstractHeader

* Refactor {Row,Column}HeaderCell to extend from AbstractHeaderCell

* Fix lint

* Respond to self-CR feedback

* Various cleanups

- Reorder protected methods alphabetically
- Delete unneeded onResizeGuide from IColumnHeaderProps
- Rename handleDoubleClick to handleResizeHandleDoubleClick

* Write abstractHeader2.tsx using composition this time

* Use AbstractHeader2 in ColumnHeader2 and RowHeader2

* Make AbstractHeaderCell a component, not a superclass

* Delete old inheritance-approach files

* Fix file path references

* Fix bug: pass classname to AbstractHeaderCell

* Rename *2.tsx to *.tsx

* Respond to self CR

* Respond to Adi CR feedback

* Rename to Header and HeaderCell

* Spread props

* Spread props in header cell components

* Oops, add 'from'
* Rename perf.html, make it the home page for the table preview

* Change page titles

* Fix lint
…false (#1171)

* Have focused cell follow selection if allowMultipleSelection=false

* Add test

* Fix broken test
* Move focus cell to (0,0) on FULL_TABLE selection

* Add test
* Row => Rows

* Fix name renderFocuStyleSelectMenu => renderFocusStyleSelectMenu

* Fix console errors

* Reorder stuff in the sidebar

* Rename multi-selection option

* Respond to Gilad CR feedback
jrafidi and others added 6 commits June 16, 2017 11:13
Add support for a portal classname from the react context
* initial TagInput implementation
* docs + polish
* tests! sufficient coverage 👍
* move code to subdirectory, use "fake" names
* add Tag active prop and .pt-active style support
* left/right arrows to navigate through tags list and remove _any_ (not just last)
* fix lint
* refactor keyboard logic and introduce NONE constant
* set explicit width to break long words
* notes, remove commented code
* 🌳  remove logs
* rename dir to tag-input
* add docs about keyboard interactions
…1239)

* Have EditableCell fully control value in child EditableText

* Respond to CR feedback

* Add test
@cmslewis
Copy link
Contributor

@llorca what's the story on this PR?

@llorca
Copy link
Contributor Author

llorca commented Jun 19, 2017

@cmslewis I suspect it hasn't been looked at because it's not a priority. It's ready to go though, there's one question I want feedback on (see description) and I still need full review over code/docs/approach.

cmslewis and others added 10 commits June 20, 2017 15:19
* Add cell-content menu, refactor

* Change cell content based on selection

* Add option for long text

* Delete 'Fill with random text' option

* Use Utils.times instead of for loop

* CR feedback

* Respond to CR feedback

* More CR feedback

* Add basic truncation

* Add default value for zebra striping to fix warning

* Add select menu for truncated popover mode

* Move to switch statement

* Fix lint

* Clearer [title] tooltip message

* Show disabled child elements in sidebar, use Classes everywhere
* Add Utils.some

* [Temporary] Change feature flags in Table example

* Add new classes for reorder handle

* Add ignoredSelector prop to DragSelectable

* Add preliminary styles for reorder handle

* Add reorder handle to column interaction bar

* Ignore reorder handle selector

* Reorder handle works

* Renable drag-reordering on rows

* Delete commented code

* Show column grab cursor only over reorder handle

* Move selection only if it existed before reorder

* Don't disable drage selection for column headers

* Different handle colors on :hover and :active

* Delete console.logs

* Select clicked handle's column if not selected

* Reenable old reordering interaction if useInteractionBar={false}

* Delete reorderHandle.tsx, put Orientation back in resizeHandle.tsx

* Code cleanups

* Rename to isEntireCellTargetReorderable

* Delete orientation.ts

* Have Header apply the TABLE_HEADER_REORDERABLE class

* Reply to CR feedback

* Fix tests

* Write new tests, fix bug

* Add deprecation warning to HeaderCell#isReorderable

* Fix lint

* Fix deprecation version

* Fix deprecation message
* Rename existing store

* Add new store for dense grid

* Column reordering works

* Move column-reorder handling into store

* Row reordering works

* Fix bug with row-count changing, clean up code

* Fix row and column counts

* Delete commented code

* Fix column-count updating

* Have column names reorder along with column content

* Fix editing of column names

* Fix description for setOrderedColumnKeys

* Fix row insertion
* passes all Tag props to its onRemove handler

* PR feedback, renamed argument for clarity

* Fixes lint
* Adds focus cell tab and enter microinteraction behavior

* Comments, refactor common code

* Add tests
* Add Utils.some

* [Temporary] Change feature flags in Table example

* Add new classes for reorder handle

* Add ignoredSelector prop to DragSelectable

* Add preliminary styles for reorder handle

* Add reorder handle to column interaction bar

* Ignore reorder handle selector

* Reorder handle works

* Renable drag-reordering on rows

* Delete commented code

* Show column grab cursor only over reorder handle

* Move selection only if it existed before reorder

* Don't disable drage selection for column headers

* Different handle colors on :hover and :active

* Delete console.logs

* Select clicked handle's column if not selected

* Reenable old reordering interaction if useInteractionBar={false}

* Delete reorderHandle.tsx, put Orientation back in resizeHandle.tsx

* Code cleanups

* Rename to isEntireCellTargetReorderable

* Delete orientation.ts

* Have Header apply the TABLE_HEADER_REORDERABLE class

* Reply to CR feedback

* Fix tests

* Write new tests, fix bug

* Add deprecation warning to HeaderCell#isReorderable

* Fix lint

* Fix deprecation version

* Fix deprecation message

* Add reorderable example to site-docs
* Prepare Release 1.21.0

* [Table] Add docs about reorderable content (#1271)

* Add Utils.some

* [Temporary] Change feature flags in Table example

* Add new classes for reorder handle

* Add ignoredSelector prop to DragSelectable

* Add preliminary styles for reorder handle

* Add reorder handle to column interaction bar

* Ignore reorder handle selector

* Reorder handle works

* Renable drag-reordering on rows

* Delete commented code

* Show column grab cursor only over reorder handle

* Move selection only if it existed before reorder

* Don't disable drage selection for column headers

* Different handle colors on :hover and :active

* Delete console.logs

* Select clicked handle's column if not selected

* Reenable old reordering interaction if useInteractionBar={false}

* Delete reorderHandle.tsx, put Orientation back in resizeHandle.tsx

* Code cleanups

* Rename to isEntireCellTargetReorderable

* Delete orientation.ts

* Have Header apply the TABLE_HEADER_REORDERABLE class

* Reply to CR feedback

* Fix tests

* Write new tests, fix bug

* Add deprecation warning to HeaderCell#isReorderable

* Fix lint

* Fix deprecation version

* Fix deprecation message

* Add reorderable example to site-docs
@llorca llorca mentioned this pull request Jun 26, 2017
2 tasks
cmslewis added 2 commits June 27, 2017 10:52
* Add failing test

* Use basic for loop to fix text

* Change describe.only => describe
* Add and wire up the onVisibleCellsChange prop

* Add tests

* Invoke callback when grid changes also

* Fix lint, tests

* Expose rowIndices and columnIndices instead of four params

* Add logger switch to table example

* Fix lint

* Fix lint again

* Response to CR feedback
@cmslewis
Copy link
Contributor

@llorca the optimal approach to me is to widen the menu to fit each item on one line provided there's enough horizontal space. But for a simple default, I'd prefer to see the full list item with line wrapping.

Copy link
Contributor

@cmslewis cmslewis left a comment

Choose a reason for hiding this comment

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

Approving the code changes, but looks like we should still add documentation about the change before merging.

@llorca
Copy link
Contributor Author

llorca commented Jun 27, 2017

Docs added ✅

@blueprint-bot
Copy link

Add docs about new `pt-menu-item-text` class

Preview: documentation | table
Coverage: core | datetime

@llorca
Copy link
Contributor Author

llorca commented Jun 27, 2017

Messed up branching -- gonna open a new PR. Sorry!

@llorca llorca closed this Jun 27, 2017
@llorca llorca deleted the al/menu-flex2 branch June 27, 2017 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.