Skip to content
This repository was archived by the owner on May 20, 2023. It is now read-only.

Commit f33be6b

Browse files
committed
Initial open source release
0 parents  commit f33be6b

File tree

165 files changed

+13512
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+13512
-0
lines changed

.analysis_options

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
analyzer:
2+
strong-mode: true

.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Files and directories created by pub
2+
.packages
3+
.pub/
4+
build/
5+
packages
6+
pubspec.lock
7+
8+
# Files created by dart2js
9+
*.dart.js
10+
*.part.js
11+
*.js.deps
12+
*.js.map
13+
*.info.json
14+
15+
# Directory created by dartdoc
16+
doc/api/
17+
18+
# JetBrains IDEs
19+
.idea/
20+
*.iml
21+
*.ipr
22+
*.iws

AUTHORS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Below is a list of people and organizations that have contributed
2+
# to the project. Names should be added to the list like so:
3+
#
4+
# Name/Organization <email address>
5+
6+
Google Inc.

LICENSE

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Copyright 2016, the Dart project authors. All rights reserved.
2+
Redistribution and use in source and binary forms, with or without
3+
modification, are permitted provided that the following conditions are
4+
met:
5+
6+
* Redistributions of source code must retain the above copyright
7+
notice, this list of conditions and the following disclaimer.
8+
* Redistributions in binary form must reproduce the above
9+
copyright notice, this list of conditions and the following
10+
disclaimer in the documentation and/or other materials provided
11+
with the distribution.
12+
* Neither the name of Google Inc. nor the names of its
13+
contributors may be used to endorse or promote products derived
14+
from this software without specific prior written permission.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# AngularDart Components
2+
3+
**Preview Release**
4+
5+
These are the AngularDart components that Google uses to build many of its web
6+
applications.
7+
8+
Only a small fragment of all the components is available right now. We want
9+
developers to have an opportunity to play around with the package as soon as
10+
possible.
11+
12+
*`<glyph>`
13+
*`<material-button>`
14+
*`<material-fab>`
15+
*`<material-checkbox>`
16+
*`<material-chip>`
17+
*`<material-expansionpanel>`
18+
*`<material-progress>`
19+
*`<material-radio>`
20+
*`<material-ripple>`
21+
*`<material-spinner>`
22+
*`<material-tab>`
23+
*`<material-toggle>`
24+
*`<material-yes-no-buttons>`
25+
*`<reorder-list>`
26+
*`<acx-scorecard>`
27+
*`<material-input>`
28+
*`<material-auto-suggest-input>`
29+
*`<material-date-range-picker>`
30+
*`<material-dialog>`
31+
*`<material-list>`
32+
*`<material-menu>`
33+
* ☐ many more, including a fast table
34+
35+
36+
## Useful links
37+
38+
* [AngularDart pub package](https://pub.dartlang.org/packages/angular2)
39+
* [AngularDart documentation](https://angulardart.org/)
40+
* [Material Design site](https://material.google.com/)
41+

lib/angular2_components.dart

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
library angular2_components;
6+
7+
import 'package:angular2/angular2.dart' show Provider;
8+
import 'src/all_components.dart';
9+
export 'src/all_components.dart';
10+
11+
/// A convenience list of all Directives exposed by this package.
12+
const List<Type> materialDirectives = const [
13+
CachingDeferredContentDirective,
14+
DeferredContentDirective,
15+
FixedMaterialTabStripComponent,
16+
FocusActivableItemDirective,
17+
FocusItemDirective,
18+
FocusListDirective,
19+
FocusableDirective,
20+
GlyphComponent,
21+
InputTextModel,
22+
MaterialButtonComponent,
23+
MaterialCheckboxComponent,
24+
MaterialChipComponent,
25+
MaterialChipsComponent,
26+
MaterialExpansionPanel,
27+
MaterialExpansionPanelSet,
28+
MaterialFabComponent,
29+
MaterialInputComponent,
30+
MaterialInputDefaultValueAccessor,
31+
MaterialProgressComponent,
32+
MaterialRadioComponent,
33+
MaterialRadioGroupComponent,
34+
MaterialRippleComponent,
35+
MaterialSpinnerComponent,
36+
MaterialTabComponent,
37+
MaterialTabPanelComponent,
38+
MaterialToggleComponent,
39+
MaterialYesNoButtonsComponent,
40+
MultilineMaterialInputComponent,
41+
ReorderItemDirective,
42+
ReorderListComponent,
43+
ScorecardComponent
44+
];
45+
46+
/// A convenience list of all bindings exposed by this package.
47+
const List<List<Provider>> materialProviders = const <List<Provider>>[
48+
rippleBindings
49+
];

lib/src/all_components.dart

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
library angular2_components.all_components;
6+
7+
export 'components/annotations/rtl_annotation.dart';
8+
export 'components/button_decorator/button_decorator.dart';
9+
export 'components/content/deferred_content.dart';
10+
export 'components/content/deferred_content_aware.dart';
11+
export 'components/focus/focus.dart';
12+
export 'components/focus/focus_activable_item.dart';
13+
export 'components/focus/focus_item.dart';
14+
export 'components/focus/focus_list.dart';
15+
export 'components/focus/keyboard_only_focus_indicator.dart';
16+
export 'components/glyph/glyph.dart';
17+
export 'components/material_button/material_button.dart';
18+
export 'components/material_button/material_button_base.dart';
19+
export 'components/material_button/material_fab.dart';
20+
export 'components/material_checkbox/material_checkbox.dart'
21+
show MaterialCheckboxComponent;
22+
export 'components/material_chips/material_chip.dart';
23+
export 'components/material_chips/material_chips.dart';
24+
export 'components/material_expansionpanel/material_expansionpanel.dart';
25+
export 'components/material_expansionpanel/material_expansionpanel_set.dart';
26+
export 'components/material_input/base_material_input.dart';
27+
export 'components/material_input/deferred_validator.dart';
28+
export 'components/material_input/input_wrapper.dart';
29+
export 'components/material_input/material_input.dart'
30+
hide materialInputErrorKey;
31+
export 'components/material_input/material_input_default_value_accessor.dart';
32+
export 'components/material_input/material_input_multiline.dart';
33+
export 'components/material_progress/material_progress.dart';
34+
export 'components/material_radio/material_radio.dart';
35+
export 'components/material_radio/material_radio_group.dart';
36+
export 'components/material_ripple/material_ripple.dart';
37+
export 'components/material_ripple/module.dart';
38+
export 'components/material_ripple/src/wave.dart';
39+
export 'components/material_spinner/material_spinner.dart';
40+
export 'components/material_tab/fixed_material_tab_strip.dart';
41+
export 'components/material_tab/material_tab.dart';
42+
export 'components/material_tab/material_tab_panel.dart';
43+
export 'components/material_tab/src/navigation_bar.dart';
44+
export 'components/material_tab/src/tab_button.dart';
45+
export 'components/material_tab/src/tab_mixin.dart';
46+
export 'components/material_tab/tab_change_event.dart';
47+
export 'components/material_toggle/material_toggle.dart';
48+
export 'components/material_yes_no_buttons/material_yes_no_buttons.dart';
49+
export 'components/reorder_list/reorder_list.dart';
50+
export 'components/scorecard/scoreboard.dart';
51+
export 'components/scorecard/scorecard.dart';
52+
export 'components/scorecard/src/scorecard_bar.dart';
53+
export 'components/theme/dark_theme.dart';
54+
export 'components/theme/module.dart';
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'dart:html';
6+
7+
import 'package:angular2/angular2.dart';
8+
9+
/// Annotation bound to a boolean which is used to indicate that a complete
10+
/// web page is RTL.
11+
///
12+
/// This is used to only read the DOM once for an app to determine if the app
13+
/// itself is RTL. Only use this for components whose RTL is not independant
14+
/// of the application as a whole.
15+
const rtlToken = const OpaqueToken('isRtl');
16+
17+
const rtlProvider =
18+
const Provider(rtlToken, useFactory: determineRtl, deps: const [Document]);
19+
20+
@Injectable()
21+
bool determineRtl(Document document) => 'rtl' == document.documentElement.dir;
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'dart:html';
6+
7+
import 'package:angular2/angular2.dart';
8+
9+
import '../focus/focus.dart';
10+
import '../../utils/angular/properties/properties.dart';
11+
import '../../utils/async/async.dart';
12+
import '../../utils/browser/events/events.dart';
13+
14+
/// ButtonDirective adds all basic required a11y functional for any element,
15+
/// that are designed to work as a button (clickable icon, etc.)
16+
///
17+
/// This does NOT consume the triggering mouse event or keyboard event, so that
18+
/// if a transitive parent wants to listen to all events in it's scope (ex.
19+
/// click on anything to hide popup), it can do so.
20+
///
21+
/// usage:
22+
/// `<your-element buttonDecorator (trigger)="yourAction()"></your-element>`
23+
/// instead of
24+
/// `<your-element (click)="yourAction()"></your-element>`
25+
@Directive(selector: '[buttonDecorator]', host: const {
26+
'(click)': r'handleClick($event)',
27+
'(keypress)': r'handleKeyPress($event)',
28+
'tabindex': '0',
29+
'role': 'button',
30+
'[attr.aria-disabled]': 'disabledStr',
31+
'[class.is-disabled]': 'disabled',
32+
})
33+
class ButtonDirective extends RootFocusable {
34+
/// Will emit Event on mouse click or keyboard activation.
35+
@Output()
36+
final LazyEventEmitter<UIEvent> trigger =
37+
new LazyEventEmitter<UIEvent>.broadcast();
38+
39+
bool _disabled = false;
40+
41+
ButtonDirective(ElementRef element) : super(element);
42+
43+
/// String value to be passed to aria-disabled.
44+
String get disabledStr => '$_disabled';
45+
46+
/// Is the button disabled.
47+
bool get disabled => _disabled;
48+
@Input()
49+
set disabled(value) {
50+
_disabled = getBool(value);
51+
}
52+
53+
54+
/// Triggers if not disabled.
55+
void handleClick(MouseEvent mouseEvent) {
56+
if (_disabled) return;
57+
trigger.add(mouseEvent);
58+
}
59+
60+
/// Triggers on enter and space if not disabled.
61+
void handleKeyPress(KeyboardEvent keyboardEvent) {
62+
if (_disabled) return;
63+
int keyCode = keyboardEvent.keyCode;
64+
if (keyCode == KeyCode.ENTER || isSpaceKey(keyboardEvent)) {
65+
trigger.add(keyboardEvent);
66+
// Required to prevent window from scrolling.
67+
keyboardEvent.preventDefault();
68+
}
69+
}
70+
71+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*
2+
* Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
3+
* for details. All rights reserved. Use of this source code is governed by a
4+
* BSD-style license that can be found in the LICENSE file.
5+
*/
6+
[buttonDecorator]{cursor:pointer}[buttonDecorator].is-disabled{cursor:not-allowed}

0 commit comments

Comments
 (0)