Skip to content

Commit

Permalink
upgrading to 34 (#744)
Browse files Browse the repository at this point in the history
* upgrading to 34

* Sync with Prettier

* text field value support

* Sync with Prettier

* Sync with Prettier

* fixing tests
  • Loading branch information
prateekbh authored Apr 18, 2018
1 parent 46cd9c7 commit 94b608c
Show file tree
Hide file tree
Showing 34 changed files with 4,799 additions and 3,735 deletions.
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

0 comments on commit 94b608c

Please sign in to comment.