Skip to content

Commit

Permalink
Merge pull request #48 from Neovici/documentation
Browse files Browse the repository at this point in the history
Behavior documentation

Approved by megheaiulian and Wurper.
  • Loading branch information
dotpointer authored Apr 24, 2018
2 parents f0eab79 + f397e1b commit 7e2a7b8
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions cosmoz-tabbed-behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
window.Cosmoz = window.Cosmoz || {};

/**
* Behavior for cosmoz-tabs.
*
* @polymerBehavior Cosmoz.TabbedBehavior
*/
Cosmoz.TabbedBehaviorImpl = {
/**
* Fired when the element should have it's selection state toggled.
* Fired when the element should have the selection state toggled.
*
* @event cosmoz-tab-toggle
*/
Expand All @@ -30,7 +32,7 @@

properties: {
/**
* True if the item is selected.
* Item selection state, true if it is selected.
*/
isSelected: {
type: Boolean,
Expand All @@ -40,8 +42,9 @@
},

/**
* True if item is in accordion mode.
* This property should be forwarded by an ancestor `Cosmoz.TabbableBehavior` element.
* Accordion mode element state, true if it is in accordion mode.
* Should be forwarded by a `Cosmoz.TabbableBehavior` ancestor
* element.
*/
accordion: {
type: Boolean,
Expand All @@ -51,39 +54,40 @@
},

/**
* The items's heading text.
* Item heading text.
*/
heading: {
type: String,
notify: true
},

/**
* The icon of the item.
* Icon name of the item.
*/
icon: {
type: String,
value: 'radio-button-unchecked',
},

/**
* The icon of the item when it is selected.
* Icon name of the item when it is selected.
*/
selectedIcon: {
type: String,
value: 'radio-button-checked',
},

/**
* The color of the items's icon.
* Color of the item icon.
*/
iconColor: {
type: String,
value: '#15b0d3',
},

/**
* When not empty the element will contain a `paper-bagde` with the label set to this property.
* When not empty the element will contain a `paper-bagde` with the
* label set to this property.
*/
badge: {
type: String,
Expand All @@ -93,28 +97,30 @@
},

/**
* Computes the element's opened icon depending on the `opened` property
* Computes the element opened icon name depending on the `opened`
* property.
*
* @param {Boolean} isSelected True if tab is opened
* @return {void}
* @param {boolean} isSelected Whether tab is opened or not.
* @returns {string} Opened icon name.
*/
_computeOpenedIcon: function (isSelected) {
return isSelected ? 'expand-less' : 'expand-more';
},

/**
* Returns the element's icon.
* Gets the element icon name.
*
* @returns {void}
* @returns {string} Name of the element icon.
*/
getIcon: function () {
return this.isSelected && !this.accordion ? this.selectedIcon : this.icon;
},

/**
* Returns the element's icon style.
* Gets the element icon style property and value if icon color is
* set, otherwise return nothing.
*
* @returns {void}
* @returns {string/void} Style color property and value for the icon.
*/
getIconStyle: function () {
if (this.iconColor) {
Expand Down

0 comments on commit 7e2a7b8

Please sign in to comment.