-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop'
- Loading branch information
Showing
21 changed files
with
124 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,19 +15,42 @@ | |
/** | ||
* Icon can be used to display a Materialize icon. | ||
* | ||
* Please note that the Materialize icons are shipped in a separate font file. This font file is automatically registered | ||
* by the [[\macgyer\yii2materializecss\assets\MaterializeAsset|MaterializeAsset]]. | ||
* To be compatible with GDPR (EU) the MaterializeFontAsset is not loaded automatically via the [[\macgyer\yii2materializecss\assets\MaterializeAsset|MaterializeAsset]]. The font asset requests the Material Icon font from Google servers (as stated in the Materialize docs). | ||
* If you are not affected by GDPR, simply load the [[\macgyer\yii2materializecss\assets\MaterializeFontAsset|MaterializeFontAsset]] in your layout or AppAsset. | ||
* | ||
* If you do not load the default [[\macgyer\yii2materializecss\assets\MaterializeAsset|MaterializeAsset]] make sure to at least load | ||
* [[\macgyer\yii2materializecss\assets\MaterializeFontAsset|MaterializeFontAsset]] (or another source providing the font file) to correctly | ||
* display the icons. | ||
* Otherwise you need to self-host the Material Icon font (i. e. do not request them from Google). You could use `material-icons` (https://www.npmjs.com/package/material-icons) to load the font files, CSS and SCSS from NPM and include them in your build process. | ||
* | ||
* @author Christoph Erdmann <[email protected]> | ||
* @package widgets | ||
* @see https://materializecss.com/icons.html | ||
*/ | ||
class Icon extends BaseWidget | ||
{ | ||
/** | ||
* Sets the [[size]] of the icon to "tiny". | ||
*/ | ||
public const SIZE_TINY = 'tiny'; | ||
/** | ||
* Sets the [[size]] of the icon to "small". This is the default. | ||
*/ | ||
public const SIZE_SMALL = 'small'; | ||
/** | ||
* Sets the [[size]] of the icon to "medium". | ||
*/ | ||
public const SIZE_MEDIUM = 'medium'; | ||
/** | ||
* Sets the [[size]] of the icon to "large". | ||
*/ | ||
public const SIZE_LARGE = 'large'; | ||
/** | ||
* Sets the [[position]] of the icon to "left". | ||
*/ | ||
public const POSITION_LEFT = 'left'; | ||
/** | ||
* Sets the [[position]] of the icon to "right". | ||
*/ | ||
public const POSITION_RIGHT = 'right'; | ||
|
||
/** | ||
* @var string the name of the icon. | ||
* | ||
|
@@ -40,11 +63,16 @@ class Icon extends BaseWidget | |
* | ||
* Currently "left" and "right" are natively supported by Materialize, but you can set this property to a custom string | ||
* which will be added to the HTML class attribute and thus can be individually styled. | ||
* | ||
* The default icon position is "left". | ||
*/ | ||
public $position; | ||
|
||
/** | ||
* @var string the size of the icon. | ||
* | ||
* The default icon size is "small". | ||
*/ | ||
public $size = self::SIZE_SMALL; | ||
|
||
/** | ||
* @var array the HTML options for the icon tag. | ||
* | ||
|
@@ -69,12 +97,15 @@ public function init() | |
if (!$this->name) { | ||
throw new InvalidConfigException('The icon name must be specified.'); | ||
} | ||
Html::addCssClass($this->options, ['widget' => 'material-icons']); | ||
|
||
if ($this->position === null) { | ||
$this->position = 'left'; | ||
if ($this->position) { | ||
Html::addCssClass($this->options, ['material-icon-position' => $this->position]); | ||
} | ||
|
||
Html::addCssClass($this->options, ['material-icons', $this->position]); | ||
if ($this->size) { | ||
Html::addCssClass($this->options, ['material-icon-size' => $this->size]); | ||
} | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,7 @@ | |
use macgyer\yii2materializecss\lib\Html; | ||
|
||
/** | ||
* DatePicker renders an date picker input element. | ||
* | ||
* Materialize is using a modified version of the JS library pickadate.js. | ||
* DatePicker renders a date picker input element. | ||
* | ||
* @see https://materializecss.com/pickers.html#date-picker | ||
* @author Christoph Erdmann <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.