forked from palantir/blueprint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [DateInput] Add support for datepicker clearButtonText and todayButtonText props. (palantir#3020) * [DateInput] Add datepicker clearButtonText and todayButtonText props support. * [DateInput] Add unit test for clearButtonText and todayButtonText props. * include integrity hashes in yarn lock (palantir#3035) * Publish - @blueprintjs/[email protected] * Publish - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] * Fix reset of active item when query hasn't changed (palantir#3072) * Fix reset active item when query hasn't changed * Address comments * [DateInput] close on tab key press (palantir#3038) * Publish - @blueprintjs/[email protected] - @blueprintjs/[email protected] * Correct Table reference to HTMLTable (palantir#3075) Also correct link to html-table page. * 🔧 fix dependencies (palantir#3078) * node-gyp resolution * * dep for build-scripts packages * yarn.lock * preview script won't fail build without GH_AUTH_TOKEN * update yarn min version in readme * fix icons alignment (palantir#3102) * [Breadcrumb] Add current prop (palantir#3104) * Render breadcrumb children (palantir#3105) * fix checkbox indicator display (palantir#3113) * Only set default font-family on body selector (palantir#3115) * [FormGroup] add contentClassName and style props (palantir#3120) * add contentClassName prop * add style prop * [Portal] add container prop (palantir#3045) * [Portal] add container prop * [Overlay] add container prop * [Popover] add container prop * [Tooltip] add container prop * [Dialog] add container prop * [Alert] add container prop * fix test failed * [portal] avoid possible crash on componentDidMount * rename container to portalContainer for overlay components * chore: remove useless code * add isotest for className prop (palantir#3119) * four args become two. add className isotest. refactor generateIsomorphicTests() to use config object in mapped type * refactor isotest suites to new config object * [Tag] fix line-height for centering (palantir#3117) * fix lint error * set tag line-height to icon size * $tag-line-height(-large) vars * fix label documentation example (palantir#3087) * fix label documentation example * Use class constants * remove first id * Label B * added new icon (palantir#3052) * [table] Perf improvements with selections (palantir#2005) * table performance improvements - reducing rerendering where possible * reinstate enum strings * fix compile errors * fix lint errors * fix test * cell: revert changes * code review suggestions; add forceRerenderOnSelectionChange flag * lint * default to false * remove unused logo styles from navbar (palantir#3123) * [Breadcrumbs] Add new component (palantir#3106) * Add breadcrumbs component * Use lambda syntax * Add overflow list props * Disable overflow menu items * Add missing prop docs * Document new Breadcrumb special case * Add Breadcrumbs prop docs * Use ul tag * Add test to OverflowList * Add tests to Breadcrumb * Add tests for Breadcrumbs * Fix docstring Co-Authored-By: invliD <[email protected]> * Improve docstring Co-Authored-By: invliD <[email protected]> * Fix Breadcrumb docs * Fix linebreak * Default breadcrumbRenderer * Explain why the menu is reversed * Add link to OL * Add code example * Re-use breadcrumbs example using different name * docs edits * Publish - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] * fix disappearing caret on focus of HTMLSelect in ControlGroup (fixes palantir#3003) (palantir#3150) * Single Month Only Prop in DateRangePicker (palantir#3142) * allow singleMonthlyOnly in DateRangePicker * updated docs comment * added singleMonthOnly props in DateRangeInput * added DateRangeInput test to ensure prop is passed * updated documentation and example labels * Allow users to browse omnibar options without query (palantir#3130) * Using tagName JSX variable for MenuItem (palantir#3061) * Using tagName JSX variable for MenuItem * Fixed minnor default issues as per the requests on PR * [Overlay] add portalClassName to IOverlayableProps (palantir#3148) * add portalClassName to IOverlayableProps * fix overlay test * unmount dialog test * fix HTML_TABLE_CONDENSED name (reverts 3.x break) (palantir#3147) * Don't clear TagInput inputValue state if controlled (palantir#3137) * Don't clear TagInput inputValue state if controlled Fixes palantir#3134 * Address PR comments * Revert fixes * remove margin on heading-only callouts (palantir#3157) * PopoverPosition = Position + auto values (palantir#3156) * [Select] Flag to optionally scroll to active item for select components (palantir#3096) * Flag to optionally scroll to active item for select components * Respect click and keyboard interactions * Change docs * edit prop docs * add uncontrolled note * docs edits (palantir#3161) * [tslint] blueprint-html-components fixer! (palantir#3162) * enable strict mode in tslint-config * sort imports before adding * blueprint-html-components fixes imports * refactors * replaceTagName util * test formatting * add test for all imports * h2/h5 * ts-lint --fix (palantir#3159) * relaxed typings for optional JSX.Elements (palantir#3118) * export type OptionalElement = JSX.Element | boolean | null | undefined; use it in `icon` props * more uses of OptionalElement * Icons docs uses props * MaybeElement, false * [Popover] add boundary prop for easier modifiers (palantir#3149) * Popover add boundariesElement prop for easier modifiers * rename to boundary * rename type to PopperBoundary * fix examples * Publish - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected]
- Loading branch information
1 parent
f0a93bf
commit ee5bbd4
Showing
121 changed files
with
2,976 additions
and
811 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,9 @@ | |
"engines": { | ||
"node": ">=6.1" | ||
}, | ||
"resolutions": { | ||
"node-gyp": "^3.6.3" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "[email protected]:palantir/blueprint.git" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
130 changes: 130 additions & 0 deletions
130
packages/core/src/components/breadcrumbs/breadcrumbs.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
/* | ||
* Copyright 2018 Palantir Technologies, Inc. All rights reserved. | ||
* | ||
* Licensed under the terms of the LICENSE file distributed with this project. | ||
*/ | ||
|
||
import classNames from "classnames"; | ||
import * as React from "react"; | ||
|
||
import { Boundary } from "../../common/boundary"; | ||
import * as Classes from "../../common/classes"; | ||
import { Position } from "../../common/position"; | ||
import { IProps } from "../../common/props"; | ||
import { Menu } from "../menu/menu"; | ||
import { MenuItem } from "../menu/menuItem"; | ||
import { IOverflowListProps, OverflowList } from "../overflow-list/overflowList"; | ||
import { IPopoverProps, Popover } from "../popover/popover"; | ||
import { Breadcrumb, IBreadcrumbProps } from "./breadcrumb"; | ||
|
||
export interface IBreadcrumbsProps extends IProps { | ||
/** | ||
* Callback invoked to render visible breadcrumbs. Best practice is to | ||
* render a `<Breadcrumb>` element. If `currentBreadcrumbRenderer` is also | ||
* supplied, that callback will be used for the current breadcrumb instead. | ||
* @default Breadcrumb | ||
*/ | ||
breadcrumbRenderer?: (props: IBreadcrumbProps) => JSX.Element; | ||
|
||
/** | ||
* Which direction the breadcrumbs should collapse from: start or end. | ||
* @default Boundary.START | ||
*/ | ||
collapseFrom?: Boundary; | ||
|
||
/** | ||
* Callback invoked to render the current breadcrumb, which is the last | ||
* element in the `items` array. | ||
* | ||
* If this prop is omitted, `breadcrumbRenderer` will be invoked for the | ||
* current breadcrumb instead. | ||
*/ | ||
currentBreadcrumbRenderer?: (props: IBreadcrumbProps) => JSX.Element; | ||
|
||
/** | ||
* All breadcrumbs to display. Breadcrumbs that do not fit in the container | ||
* will be rendered in an overflow menu instead. | ||
*/ | ||
items: IBreadcrumbProps[]; | ||
|
||
/** | ||
* The minimum number of visible breadcrumbs that should never collapse into | ||
* the overflow menu, regardless of DOM dimensions. | ||
* @default 0 | ||
*/ | ||
minVisibleItems?: number; | ||
|
||
/** | ||
* Props to spread to `OverflowList`. Note that `items`, | ||
* `overflowRenderer`, and `visibleItemRenderer` cannot be changed. | ||
*/ | ||
overflowListProps?: Partial<IOverflowListProps<IBreadcrumbProps>>; | ||
|
||
/** | ||
* Props to spread to the `Popover` showing the overflow menu. | ||
*/ | ||
popoverProps?: IPopoverProps; | ||
} | ||
|
||
export class Breadcrumbs extends React.PureComponent<IBreadcrumbsProps> { | ||
public static defaultProps: Partial<IBreadcrumbsProps> = { | ||
collapseFrom: Boundary.START, | ||
}; | ||
|
||
public render() { | ||
const { className, collapseFrom, items, minVisibleItems, overflowListProps = {} } = this.props; | ||
return ( | ||
<OverflowList | ||
collapseFrom={collapseFrom} | ||
minVisibleItems={minVisibleItems} | ||
tagName="ul" | ||
{...overflowListProps} | ||
className={classNames(Classes.BREADCRUMBS, overflowListProps.className, className)} | ||
items={items} | ||
overflowRenderer={this.renderOverflow} | ||
visibleItemRenderer={this.renderBreadcrumbWrapper} | ||
/> | ||
); | ||
} | ||
|
||
private renderOverflow = (items: IBreadcrumbProps[]) => { | ||
const { collapseFrom } = this.props; | ||
const position = collapseFrom === Boundary.END ? Position.BOTTOM_RIGHT : Position.BOTTOM_LEFT; | ||
let orderedItems = items; | ||
if (collapseFrom === Boundary.START) { | ||
// If we're collapsing from the start, the menu should be read from the bottom to the | ||
// top, continuing with the breadcrumbs to the right. Since this means the first | ||
// breadcrumb in the props must be the last in the menu, we need to reverse the overlow | ||
// order. | ||
orderedItems = items.slice().reverse(); | ||
} | ||
return ( | ||
<li> | ||
<Popover position={position} {...this.props.popoverProps}> | ||
<span className={Classes.BREADCRUMBS_COLLAPSED} /> | ||
<Menu>{orderedItems.map(this.renderOverflowBreadcrumb)}</Menu> | ||
</Popover> | ||
</li> | ||
); | ||
}; | ||
|
||
private renderOverflowBreadcrumb = (props: IBreadcrumbProps, index: number) => { | ||
const isClickable = props.href != null || props.onClick != null; | ||
return <MenuItem disabled={!isClickable} {...props} text={props.text} key={index} />; | ||
}; | ||
|
||
private renderBreadcrumbWrapper = (props: IBreadcrumbProps, index: number) => { | ||
const isCurrent = this.props.items[this.props.items.length - 1] === props; | ||
return <li key={index}>{this.renderBreadcrumb(props, isCurrent)}</li>; | ||
}; | ||
|
||
private renderBreadcrumb(props: IBreadcrumbProps, isCurrent: boolean) { | ||
if (isCurrent && this.props.currentBreadcrumbRenderer != null) { | ||
return this.props.currentBreadcrumbRenderer(props); | ||
} else if (this.props.breadcrumbRenderer != null) { | ||
return this.props.breadcrumbRenderer(props); | ||
} else { | ||
return <Breadcrumb {...props} current={isCurrent} />; | ||
} | ||
} | ||
} |
Oops, something went wrong.