Skip to content

Commit

Permalink
Merge branch 'master' into button-icon-color
Browse files Browse the repository at this point in the history
  • Loading branch information
asudoh authored Feb 6, 2020
2 parents c879413 + 1ac4f59 commit 96beda4
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,22 @@ module.exports = {
exampleUploadStates: true,
},
},
{
name: 'legacy',
label: 'Legacy file uploader',
context: {
id: 'legacy-file-uploader',
legacy: true,
},
},
{
name: 'legacy with example upload states',
label: 'Legacy file uploader with example upload states',
context: {
id: 'legacy-file-uploader-states',
legacy: true,
exampleUploadStates: true,
},
},
],
};
51 changes: 51 additions & 0 deletions packages/components/src/components/file-uploader/file-uploader.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
LICENSE file in the root directory of this source tree.
-->

{{#unless legacy}}
<div class="{{prefix}}--form-item">
<strong class="{{prefix}}--file--label">Account
photo</strong>
Expand Down Expand Up @@ -57,3 +58,53 @@
</div>
</div>
</div>
{{else}}
<div class="{{prefix}}--form-item">
<strong class="{{prefix}}--file--label">Account
photo</strong>
<p class="{{prefix}}--label-description">Only .jpg and .png files. 500kb max file size.</p>
<div class="{{prefix}}--file" data-file data-file-demo-state-manager>
<label for="legacy-file-uploader" class="{{prefix}}--file-btn {{prefix}}--btn {{prefix}}--btn--primary"
role="button" tabindex="0">Add file</label>
<input type="file" class="{{prefix}}--file-input" id="legacy-file-uploader" data-file-uploader
data-target="[data-file-container]" multiple />
<div data-file-container data-file-drop-container class="{{prefix}}--file-container">
{{#if exampleUploadStates}}
<div class="{{prefix}}--file__selected-file">
<p class="{{prefix}}--file-filename">Lorem ipsum dolor sit amet consectetur adipisicing elit. Libero vero
sapiente illum reprehenderit molestiae perferendis voluptatem temporibus laudantium ducimus magni voluptatum
veniam, odit nesciunt corporis numquam maxime sunt excepturi sint!</p>
<span data-for="{{id}}" class="{{prefix}}--file__state-container">
{{ carbon-icon 'CheckmarkFilled16' class=(add prefix '--file-complete') }}
</span>
</div>
<div class="{{prefix}}--file__selected-file {{prefix}}--file__selected-file--invalid" data-invalid>
<p class="{{prefix}}--file-filename">color.jpeg</p>
<span data-for="{{id}}" class="{{prefix}}--file__state-container">
{{ carbon-icon 'WarningFilled16' class=(add prefix '--file--invalid')}}
{{ carbon-icon 'Close16' class=(add prefix '--file-close') aria-label="Remove uploaded file" tabindex="0" }}
</span>
<div class="{{prefix}}--form-requirement">
<div class="{{prefix}}--form-requirement__title">File size exceeds limit.</div>
<p class="{{prefix}}--form-requirement__supplement">500 kb max file size. Select a new file and try
again.</p>
</div>
</div>
<div class="{{prefix}}--file__selected-file">
<p class="{{prefix}}--file-filename">color.jpeg</p>
<span data-for="{{id}}" class="{{prefix}}--file__state-container">
<div class="{{prefix}}--inline-loading__animation">
<div data-inline-loading-spinner="" class="{{prefix}}--loading {{prefix}}--loading--small">
<svg class="{{prefix}}--loading__svg" viewBox="-75 -75 150 150">
<circle class="{{prefix}}--loading__background" cx="0" cy="0" r="26.8125"></circle>
<circle class="{{prefix}}--loading__stroke" cx="0" cy="0" r="26.8125"></circle>
</svg>
</div>
</div>
</span>
</div>
{{/if}}
</div>
</div>
</div>
{{/unless}}
4 changes: 2 additions & 2 deletions packages/react/src/components/Tooltip/Tooltip-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ storiesOf('Tooltip', module)
'default (bottom)',
() => (
<div style={{ marginTop: '2rem' }}>
<Tooltip {...props.withIcon()}>
<p>
<Tooltip {...props.withIcon()} tooltipBodyId="tooltip-body">
<p id="tooltip-body">
This is some tooltip text. This box shows the maximum amount of text
that should appear inside. If more room is needed please use a modal
instead.
Expand Down
16 changes: 15 additions & 1 deletion packages/react/src/components/Tooltip/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ class Tooltip extends Component {
*/
tooltipId: PropTypes.string,

/**
* The ID of the tooltip body content.
*/
tooltipBodyId: PropTypes.string,

/**
* Optional starting value for uncontrolled state
*/
Expand Down Expand Up @@ -369,6 +374,7 @@ class Tooltip extends Component {
`__carbon-tooltip_${Math.random()
.toString(36)
.substr(2)}`),
tooltipBodyId,
children,
className,
triggerClassName,
Expand Down Expand Up @@ -412,6 +418,7 @@ class Tooltip extends Component {
onMouseOut: this.handleMouse,
onFocus: this.handleMouse,
onBlur: this.handleMouse,
'aria-controls': !open ? undefined : tooltipId,
'aria-haspopup': 'true',
'aria-expanded': open,
'aria-describedby': open ? tooltipId : null,
Expand Down Expand Up @@ -469,7 +476,14 @@ class Tooltip extends Component {
onContextMenu={this.handleMouse}
role="tooltip">
<span className={`${prefix}--tooltip__caret`} />
{children}
<div
className={`${prefix}--tooltip__content`}
tabindex="-1"
role="dialog"
aria-describedby={tooltipBodyId}
aria-labelledby={triggerId}>
{children}
</div>
</div>
</FloatingMenu>
)}
Expand Down
12 changes: 7 additions & 5 deletions packages/react/src/components/UIShell/HeaderSideNavItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ const HeaderSideNavItems = ({
children,
hasDivider,
}) => {
const className = cx({
[`${prefix}--side-nav__header-navigation`]: true,
[`${prefix}--side-nav__header-divider`]: hasDivider,
customClassName,
});
const className = cx(
{
[`${prefix}--side-nav__header-navigation`]: true,
[`${prefix}--side-nav__header-divider`]: hasDivider,
},
customClassName
);
return <div className={className}>{children}</div>;
};

Expand Down

0 comments on commit 96beda4

Please sign in to comment.