Skip to content
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

upgrading to 34 #744

Merged
merged 10 commits into from
Apr 18, 2018
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
# Changelog

## 1.4.2

* Update to mdc 0.34.1.
* Select has now moved to native `select` control.
* Textfield has top level `value` method

## 1.4.1

* Bug fixes to chip module.
* Individual components moved to es5.

## 1.4.0

* Updated to mdc 0.33.0.
* Added Image List.
* Added TopAppBar.
* Removes Button's compact prop.

## 1.3.9 & 1.3.8

* Bug fixes

## 1.3.7

* Fix className bug in SSR
* Added CardActionIcons
* Added Puppeteer visual diff tests
* Fix className bug in SSR.
* Added CardActionIcons.
* Added Puppeteer visual diff tests.

## 1.3.6

Expand Down
41 changes: 11 additions & 30 deletions Select/Select.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ class Select extends MaterialComponent {
const selectedIndex =
typeof this.props.selectedIndex === 'number'
? this.props.selectedIndex
: -1;
: 0;

this.MDComponent.selectedIndex = selectedIndex;
}

const selectedIndex = this.MDComponent.selectedIndex;
if (selectedIndex === -1) {
if (selectedIndex === 0) {
this._labelRef.classList.remove('mdc-select__label--float-above');
} else {
this._labelRef.classList.add('mdc-select__label--float-above');
Expand All @@ -49,48 +49,29 @@ class Select extends MaterialComponent {
}
materialDom(props) {
return (
<div role="listbox" {...props}>
<div class="mdc-select__surface" tabindex="0">
<div {...props}>
<select class="mdc-select__native-control">
{props.hintText && <option value="" disabled selected />}
{props.children}
</select>
{props.hintText && (
<div
class="mdc-select__label"
ref={ref => {
this._labelRef = ref;
}}>
{props.hintText}
</div>
<div class="mdc-select__selected-text" />
<div class="mdc-select__bottom-line" />
</div>
<Menu className="mdc-select__menu">{props.children}</Menu>
)}
<div class="mdc-select__bottom-line" />
</div>
);
}
}

class SelectOption extends List.Item {
materialDom(props) {
const disabled = 'disabled' in props && !!props['disabled'];
const selected = 'selected' in props && !!props['selected'];

const baseProps = {
tabindex: disabled ? '-1' : '0'
};
if (disabled) {
baseProps['aria-disabled'] = 'true';
}
if (selected) {
baseProps['aria-selected'] = 'true';
}

props = Object.assign(baseProps, props);
if ('disabled' in props) {
delete props['disabled'];
}
if ('selected' in props) {
delete props['selected'];
}

return super.materialDom(props);
return <option {...props}>{props.children}</option>;
}
}

Expand Down
3 changes: 3 additions & 0 deletions TextField/TextField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ class TextFieldInput extends MaterialComponent {
componentWillUnmount() {
this.MDComponent && this.MDComponent.destroy && this.MDComponent.destroy();
}
getValue() {
return this.MDComponent ? this.MDComponent.value : null;
}
materialDom(allprops) {
let {className, ...props} = allprops;
className = className || '';
Expand Down
1 change: 1 addition & 0 deletions TextField/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default class TextField extends MaterialComponent<
static HelperText: typeof HelperText;

static uid(): number;
getValue(): string;
MDComponent: MDCTextField;
}

Expand Down
Loading