mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-03-31 15:07:47 +01:00
addoptions to flasher libraries builders
This commit is contained in:
@@ -2,8 +2,11 @@
|
||||
|
||||
namespace PHPSTORM_META;
|
||||
|
||||
use Flasher\Noty\Prime\NotyBuilder;
|
||||
|
||||
expectedArguments(NotyBuilder::showMethod(), 1, ['fadeIn', 'slideDown', 'show']);
|
||||
expectedArguments(NotyBuilder::showEasing(), 1, ['swing', 'linear']);
|
||||
expectedArguments(NotyBuilder::positionClass(), 1, ['toast-top-right', 'toast-top-center', 'toast-bottom-center', 'toast-top-full-width', 'toast-bottom-full-width', 'toast-top-left', 'toast-bottom-right', 'toast-bottom-left']);
|
||||
expectedArguments(\Flasher\Noty\Prime\NotyBuilder::layout(), 0, 'top', 'topLeft', 'topCenter', 'topRight', 'center', 'centerLeft', 'centerRight', 'bottom', 'bottomLeft', 'bottomCenter', 'bottomRight');
|
||||
expectedArguments(\Flasher\Noty\Prime\NotyBuilder::theme(), 0, 'relax', 'mint', 'metroui');
|
||||
expectedArguments(\Flasher\Noty\Prime\NotyBuilder::timeout(), 0, false, 1000, 3000, 3500, 5000);
|
||||
expectedArguments(\Flasher\Noty\Prime\NotyBuilder::closeWith(), 0, 'click', 'button', array('click', 'button'));
|
||||
expectedArguments(\Flasher\Noty\Prime\NotyBuilder::animation(), 0, 'open', 'close');
|
||||
expectedArguments(\Flasher\Noty\Prime\NotyBuilder::sounds(), 0, 'sources', 'volume', 'conditions');
|
||||
expectedArguments(\Flasher\Noty\Prime\NotyBuilder::docTitle(), 0, 'conditions');
|
||||
expectedArguments(\Flasher\Noty\Prime\NotyBuilder::queue(), 0, 'global');
|
||||
|
||||
@@ -7,6 +7,8 @@ use Flasher\Prime\Notification\NotificationBuilder;
|
||||
final class NotyBuilder extends NotificationBuilder
|
||||
{
|
||||
/**
|
||||
* This string can contain HTML too. But be careful and don't pass user inputs to this parameter.
|
||||
*
|
||||
* @param string $text
|
||||
*
|
||||
* @return NotyBuilder
|
||||
@@ -28,6 +30,9 @@ final class NotyBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* top, topLeft, topCenter, topRight, center, centerLeft, centerRight, bottom, bottomLeft, bottomCenter,
|
||||
* bottomRight - ClassName generator uses this value → noty_layout__${layout}
|
||||
*
|
||||
* @param string $layout
|
||||
*
|
||||
* @return $this
|
||||
@@ -40,6 +45,8 @@ final class NotyBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* relax, mint, metroui - ClassName generator uses this value → noty_theme__${theme}
|
||||
*
|
||||
* @param string $theme
|
||||
*
|
||||
* @return $this
|
||||
@@ -52,6 +59,8 @@ final class NotyBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* false, 1000, 3000, 3500, etc. Delay for closing event in milliseconds (ms). Set 'false' for sticky notifications.
|
||||
*
|
||||
* @param int|bool $timeout
|
||||
*
|
||||
* @return $this
|
||||
@@ -64,6 +73,8 @@ final class NotyBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* true, false - Displays a progress bar if timeout is not false.
|
||||
*
|
||||
* @param bool $progressBar
|
||||
*
|
||||
* @return $this
|
||||
@@ -76,18 +87,23 @@ final class NotyBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $closeWith
|
||||
* click, button
|
||||
*
|
||||
* @param string|array $closeWith
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function closeWith($closeWith)
|
||||
{
|
||||
$this->option('closeWith', $closeWith);
|
||||
$this->option('closeWith', (array) $closeWith);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* If string, assumed to be CSS class name. If null, no animation at all. If function, runs the function. (v3.0.1+)
|
||||
* You can use animate.css class names or your custom css animations as well.
|
||||
*
|
||||
* @param string $animation
|
||||
* @param string $effect
|
||||
*
|
||||
@@ -113,6 +129,19 @@ final class NotyBuilder extends NotificationBuilder
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $option
|
||||
* @param mixed $docTitle
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function docTitle($option, $docTitle)
|
||||
{
|
||||
$this->option('docTitle'.$option, $docTitle);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $modal
|
||||
*
|
||||
@@ -126,6 +155,22 @@ final class NotyBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* You can use this id with querySelectors. Generated automatically if false.
|
||||
*
|
||||
* @param bool|string $id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function id($id)
|
||||
{
|
||||
$this->option('id', $id);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOM insert method depends on this parameter. If false uses append, if true uses prepend.
|
||||
*
|
||||
* @param bool $force
|
||||
*
|
||||
* @return $this
|
||||
@@ -138,6 +183,20 @@ final class NotyBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $queue
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function queue($queue)
|
||||
{
|
||||
$this->option('queue', $queue);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* If true closes all visible notifications and shows itself. If string(queueName) closes all visible notification on this queue and shows itself.
|
||||
*
|
||||
* @param string|bool $killer
|
||||
*
|
||||
* @return $this
|
||||
@@ -150,6 +209,8 @@ final class NotyBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom container selector string. Like '.my-custom-container'. Layout parameter will be ignored.
|
||||
*
|
||||
* @param string|bool $container
|
||||
*
|
||||
* @return $this
|
||||
@@ -162,6 +223,8 @@ final class NotyBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* An array of Noty.button, for creating confirmation dialogs.
|
||||
*
|
||||
* @param array $buttons
|
||||
*
|
||||
* @return $this
|
||||
@@ -172,4 +235,18 @@ final class NotyBuilder extends NotificationBuilder
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* If true Noty uses PageVisibility API to handle timeout. To ensure that users do not miss their notifications.
|
||||
*
|
||||
* @param bool $visibilityControl
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function visibilityControl($visibilityControl)
|
||||
{
|
||||
$this->option('visibilityControl', $visibilityControl);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ final class Configuration implements ConfigurationInterface
|
||||
->defaultValue(array(
|
||||
'layout' => 'topRight',
|
||||
'theme' => 'mint',
|
||||
'timeout' => false,
|
||||
'timeout' => 5000,
|
||||
'progressBar' => true,
|
||||
'animation.open' => 'noty_effects_open',
|
||||
'animation.close' => 'noty_effects_close',
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace PHPSTORM_META;
|
||||
|
||||
expectedArguments(\Flasher\Notyf\Prime\NotyfBuilder::duration(), 0, 2000, 3000, 4000, 5000);
|
||||
expectedArguments(\Flasher\Notyf\Prime\NotyfBuilder::position(), 0, 'x', 'y');
|
||||
expectedArguments(\Flasher\Notyf\Prime\NotyfBuilder::position(), 1, 'top', 'right', 'bottom', 'left', 'center');
|
||||
|
||||
@@ -6,4 +6,63 @@ use Flasher\Prime\Notification\NotificationBuilder;
|
||||
|
||||
final class NotyfBuilder extends NotificationBuilder
|
||||
{
|
||||
/**
|
||||
* Number of miliseconds before hiding the notification. Use 0 for infinite duration.
|
||||
*
|
||||
* @param int $duration
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function duration($duration)
|
||||
{
|
||||
$this->option('duration', $duration);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to show the notification with a ripple effect
|
||||
*
|
||||
* @param bool $ripple
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function ripple($ripple)
|
||||
{
|
||||
$this->option('ripple', $ripple);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Viewport location where notifications are rendered
|
||||
*
|
||||
* @param string $position
|
||||
* @param string $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function position($position, $value)
|
||||
{
|
||||
$option = $this->getEnvelope()->getOption('position', array());
|
||||
$option[$position] = $value;
|
||||
|
||||
$this->option('position', $option);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to allow users to dismiss the notification with a button
|
||||
*
|
||||
* @param bool $dismissible
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function dismissible($dismissible)
|
||||
{
|
||||
$this->option('dismissible', $dismissible);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace PHPSTORM_META;
|
||||
|
||||
expectedArguments(\Flasher\Pnotify\Prime\PnotifyBuilder::styling(), 0, 'brighttheme', 'bootstrap3', 'fontawesome');
|
||||
expectedArguments(\Flasher\Pnotify\Prime\PnotifyBuilder::type(), 0, 'notice', 'info', 'success', 'error');
|
||||
expectedArguments(\Flasher\Pnotify\Prime\PnotifyBuilder::animation(), 0, 'none', 'fade');
|
||||
expectedArguments(\Flasher\Pnotify\Prime\PnotifyBuilder::animateSpeed(), 0, 'slow', 'normal', 'fast');
|
||||
expectedArguments(\Flasher\Pnotify\Prime\PnotifyBuilder::desktop(), 0, 'desktop', 'fallback', 'icon', 'tag', 'title', 'text');
|
||||
expectedArguments(\Flasher\Pnotify\Prime\PnotifyBuilder::buttons(), 0, 'closer', 'closer_hover', 'sticker', 'sticker_hover', 'show_on_nonblock', 'labels', 'classes');
|
||||
expectedArguments(\Flasher\Pnotify\Prime\PnotifyBuilder::nonblock(), 0, 'nonblock');
|
||||
expectedArguments(\Flasher\Pnotify\Prime\PnotifyBuilder::mobile(), 0, 'swipe_dismiss', 'styling');
|
||||
expectedArguments(\Flasher\Pnotify\Prime\PnotifyBuilder::animate(), 0, 'animate', 'in_class', 'out_class');
|
||||
expectedArguments(\Flasher\Pnotify\Prime\PnotifyBuilder::confirm(), 0, 'confirm', 'prompt', 'prompt_class', 'prompt_default', 'prompt_multi_line', 'align', 'buttons');
|
||||
expectedArguments(\Flasher\Pnotify\Prime\PnotifyBuilder::history(), 0, 'history', 'menu', 'fixed', 'maxonscreen', 'labels');
|
||||
|
||||
@@ -6,4 +6,430 @@ use Flasher\Prime\Notification\NotificationBuilder;
|
||||
|
||||
final class PnotifyBuilder extends NotificationBuilder
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function warning($message = null, array $options = array())
|
||||
{
|
||||
return $this->type('notice', $message, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* The notice's title.
|
||||
*
|
||||
* @param bool|string $title
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function title($title)
|
||||
{
|
||||
$this->option('title', addslashes($title));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to escape the content of the title. (Not allow HTML.)
|
||||
*
|
||||
* @param bool $titleEscape
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function titleEscape($titleEscape = true)
|
||||
{
|
||||
$this->option('title_escape', $titleEscape);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The notice's text.
|
||||
*
|
||||
* @param string $text
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function text($text)
|
||||
{
|
||||
$this->option('text', addslashes($text));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function message($message)
|
||||
{
|
||||
parent::message($message);
|
||||
|
||||
return $this->text($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to escape the content of the text. (Not allow HTML.)
|
||||
*
|
||||
* @param bool $textEscape
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function textEscape($textEscape = true)
|
||||
{
|
||||
$this->option('text_escape', $textEscape);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* What styling classes to use. (Can be either "brighttheme", "bootstrap3", "fontawesome", or a custom style
|
||||
* object. See the source in the end of pnotify.js for the properties in a style object.)
|
||||
*
|
||||
* @param string $styling
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function styling($styling)
|
||||
{
|
||||
$this->option('styling', $styling);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional classes to be added to the notice. (For custom styling.)
|
||||
*
|
||||
* @param string $addClass
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addClass($addClass)
|
||||
{
|
||||
$this->option('addclass', $addClass);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class to be added to the notice for corner styling.
|
||||
*
|
||||
* @param string $cornerClass
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function cornerClass($cornerClass)
|
||||
{
|
||||
$this->option('cornerclass', $cornerClass);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the notice when it is created. Turn this off to add notifications to the history without displaying them.
|
||||
*
|
||||
* @param bool $autoDisplay
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function autoDisplay($autoDisplay = true)
|
||||
{
|
||||
$this->option('auto_display', $autoDisplay);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Width of the notice.
|
||||
*
|
||||
* @param int $width
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function width($width)
|
||||
{
|
||||
$this->option('width', $width);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimum height of the notice. It will expand to fit content.
|
||||
*
|
||||
* @param string $minHeight
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function minHeight($minHeight)
|
||||
{
|
||||
$this->option('minHeight', $minHeight);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set icon to true to use the default icon for the selected style/type, false for no icon, or a string for your
|
||||
* own icon class.
|
||||
*
|
||||
* @param bool $icon
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function icon($icon = true)
|
||||
{
|
||||
$this->option('icon', $icon);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The animation to use when displaying and hiding the notice. "none" and "fade" are supported through CSS. Others
|
||||
* are supported through the Animate module and Animate.css.
|
||||
*
|
||||
* @param string $animation
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function animation($animation)
|
||||
{
|
||||
$this->option('animation', $animation);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Speed at which the notice animates in and out. "slow", "normal", or "fast". Respectively, 400ms, 250ms, 100ms.
|
||||
*
|
||||
* @param string $animateSpeed
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function animateSpeed($animateSpeed)
|
||||
{
|
||||
$this->option('animate_speed', $animateSpeed);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a drop shadow.
|
||||
*
|
||||
* @param bool $shadow
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function shadow($shadow = true)
|
||||
{
|
||||
$this->option('shadow', $shadow);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* After a delay, remove the notice.
|
||||
*
|
||||
* @param bool $hide
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function hide($hide = true)
|
||||
{
|
||||
$this->option('hide', $hide);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delay in milliseconds before the notice is removed.
|
||||
*
|
||||
* @param int $timer
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function timer($timer)
|
||||
{
|
||||
$this->option('delay', $timer);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the hide timer if the mouse moves over the notice.
|
||||
*
|
||||
* @param bool $mouseReset
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function mouseReset($mouseReset = true)
|
||||
{
|
||||
$this->option('mouse_reset', $mouseReset);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the notice's elements from the DOM after it is removed.
|
||||
*
|
||||
* @param bool $remove
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function remove($remove = true)
|
||||
{
|
||||
$this->option('remove', $remove);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change new lines to br tags.
|
||||
*
|
||||
* @param bool $insertBrs
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function insertBrs($insertBrs = true)
|
||||
{
|
||||
$this->option('insert_brs', $insertBrs);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to remove the notice from the global array when it is closed.
|
||||
*
|
||||
* @param bool $destroy
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function destroy($destroy = true)
|
||||
{
|
||||
$this->option('destroy', $destroy);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Desktop Module
|
||||
*
|
||||
* @param string $desktop
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function desktop($desktop, $value)
|
||||
{
|
||||
$option = $this->getEnvelope()->getOption('desktop', array());
|
||||
$option[$desktop] = $value;
|
||||
|
||||
$this->option('desktop', $option);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Buttons Module
|
||||
*
|
||||
* @param string $buttons
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function buttons($buttons, $value)
|
||||
{
|
||||
$option = $this->getEnvelope()->getOption('buttons', array());
|
||||
$option[$buttons] = $value;
|
||||
|
||||
$this->option('buttons', $option);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* NonBlock Module
|
||||
*
|
||||
* @param string $nonblock
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function nonblock($nonblock, $value)
|
||||
{
|
||||
$option = $this->getEnvelope()->getOption('nonblock', array());
|
||||
$option[$nonblock] = $value;
|
||||
|
||||
$this->option('nonblock', $option);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mobile Module
|
||||
*
|
||||
* @param string $mobile
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function mobile($mobile, $value)
|
||||
{
|
||||
$option = $this->getEnvelope()->getOption('mobile', array());
|
||||
$option[$mobile] = $value;
|
||||
|
||||
$this->option('mobile', $option);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Animate Module
|
||||
*
|
||||
* @param string $animate
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function animate($animate, $value)
|
||||
{
|
||||
$option = $this->getEnvelope()->getOption('animate', array());
|
||||
$option[$animate] = $value;
|
||||
|
||||
$this->option('animate', $option);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm Module
|
||||
*
|
||||
* @param string $confirm
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function confirm($confirm, $value)
|
||||
{
|
||||
$option = $this->getEnvelope()->getOption('confirm', array());
|
||||
$option[$confirm] = $value;
|
||||
|
||||
$this->option('confirm', $option);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* History Module
|
||||
*
|
||||
* @param string $history
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function history($history, $value)
|
||||
{
|
||||
$option = $this->getEnvelope()->getOption('history', array());
|
||||
$option[$history] = $value;
|
||||
|
||||
$this->option('history', $option);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,12 @@
|
||||
|
||||
namespace PHPSTORM_META;
|
||||
|
||||
use Flasher\Prime\Notification\NotificationBuilderInterface;
|
||||
use Flasher\Prime\Notification\NotificationInterface;
|
||||
|
||||
registerArgumentsSet('notificationTypes', NotificationInterface::TYPE_SUCCESS, NotificationInterface::TYPE_ERROR, NotificationInterface::TYPE_WARNING, NotificationInterface::TYPE_INFO);
|
||||
|
||||
override(Envelope::get(0), type(0));
|
||||
|
||||
expectedArguments(NotificationBuilderInterface::type(), 1, argumentsSet('notificationTypes'));
|
||||
expectedArguments(NotificationBuilderInterface::addFlash(), 1, argumentsSet('notificationTypes'));
|
||||
expectedArguments(NotificationInterface::setType(), 1, argumentsSet('notificationTypes'));
|
||||
expectedArguments(\Flasher\Prime\Notification\NotificationBuilderInterface::type(), 0, argumentsSet('notificationTypes'));
|
||||
expectedArguments(\Flasher\Prime\Notification\NotificationBuilderInterface::addFlash(), 0, argumentsSet('notificationTypes'));
|
||||
expectedArguments(\Flasher\Prime\Notification\NotificationInterface::setType(), 0, argumentsSet('notificationTypes'));
|
||||
|
||||
expectedReturnValues(NotificationInterface::getType(), argumentsSet('notificationTypes'));
|
||||
expectedReturnValues(\Flasher\Prime\Notification\NotificationInterface::getType(), argumentsSet('notificationTypes'));
|
||||
|
||||
@@ -5,14 +5,8 @@ PHPFlasher.addFactory('sweet_alert', (function () {
|
||||
|
||||
exports.render = function (data) {
|
||||
var notification = data.notification;
|
||||
var options = {
|
||||
title: ' ',
|
||||
text: notification.message,
|
||||
icon: notification.type,
|
||||
...notification.options
|
||||
}
|
||||
|
||||
window.SwalToast.fire(options);
|
||||
window.SwalToast.fire(notification.options);
|
||||
};
|
||||
|
||||
exports.renderOptions = function (options) {
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace PHPSTORM_META;
|
||||
|
||||
expectedArguments(\Flasher\SweetAlert\Prime\SweetAlertBuilder::icon(), 0, 'warning', 'error', 'success', 'info', 'question');
|
||||
expectedArguments(\Flasher\SweetAlert\Prime\SweetAlertBuilder::showClass(), 0, 'popup', 'backdrop', 'icon');
|
||||
expectedArguments(\Flasher\SweetAlert\Prime\SweetAlertBuilder::hideClass(), 0, 'popup', 'backdrop', 'icon');
|
||||
expectedArguments(\Flasher\SweetAlert\Prime\SweetAlertBuilder::input(), 0, 'text', 'email', 'password', 'number', 'tel', 'range', 'textarea', 'select', 'radio', 'checkbox', 'file', 'url');
|
||||
expectedArguments(\Flasher\SweetAlert\Prime\SweetAlertBuilder::position(), 0, 'top', 'top-start', 'top-end', 'center', 'center-start', 'center-end', 'bottom', 'bottom-start', 'bottom-end');
|
||||
expectedArguments(\Flasher\SweetAlert\Prime\SweetAlertBuilder::toast(), 1, 'top', 'top-start', 'top-end', 'center', 'center-start', 'center-end', 'bottom', 'bottom-start', 'bottom-end');
|
||||
expectedArguments(\Flasher\SweetAlert\Prime\SweetAlertBuilder::grow(), 0, 'row', 'column', 'fullscreen', false);
|
||||
expectedArguments(\Flasher\SweetAlert\Prime\SweetAlertBuilder::customClass(), 0, 'container', 'popup', 'header', 'title', 'closeButton', 'icon', 'image', 'content', 'input', 'inputLabel', 'validationMessage', 'actions', 'confirmButton', 'denyButton', 'cancelButton', 'loader', 'footer');
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -35,7 +35,6 @@ final class Configuration implements ConfigurationInterface
|
||||
->arrayNode('styles')
|
||||
->prototype('scalar')->end()
|
||||
->defaultValue(array(
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/10.10.2/sweetalert2.min.css',
|
||||
))
|
||||
->end()
|
||||
@@ -43,22 +42,8 @@ final class Configuration implements ConfigurationInterface
|
||||
->ignoreExtraKeys(false)
|
||||
->prototype('variable')->end()
|
||||
->defaultValue(array(
|
||||
'timer' => 5000,
|
||||
'padding' => '1.25rem',
|
||||
'showConfirmButton' => false,
|
||||
'showCloseButton' => false,
|
||||
'toast' => true,
|
||||
'position' => 'top-end',
|
||||
'timerProgressBar' => true,
|
||||
'animation' => true,
|
||||
'showClass' => array(
|
||||
'popup' => 'animate__animated animate__fadeInDown',
|
||||
),
|
||||
'hideClass' => array(
|
||||
'popup' => 'animate__animated animate__fadeOutUp',
|
||||
),
|
||||
'backdrop' => true,
|
||||
'grow' => true,
|
||||
'timer' => 50000,
|
||||
'timerProgressBar' => true,
|
||||
))
|
||||
->end()
|
||||
->end()
|
||||
|
||||
@@ -5,14 +5,8 @@ PHPFlasher.addFactory('sweet_alert', (function () {
|
||||
|
||||
exports.render = function (data) {
|
||||
var notification = data.notification;
|
||||
var options = {
|
||||
title: ' ',
|
||||
text: notification.message,
|
||||
icon: notification.type,
|
||||
...notification.options
|
||||
}
|
||||
|
||||
window.SwalToast.fire(options);
|
||||
window.SwalToast.fire(notification.options);
|
||||
};
|
||||
|
||||
exports.renderOptions = function (options) {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "@php-flasher/flasher",
|
||||
"description": "Flasher factory adapter for the PHP Flasher library",
|
||||
"license": "MIT",
|
||||
"version": "0.1.0",
|
||||
"scripts": {
|
||||
"build": "babel src -d dist",
|
||||
"lint": "eslint src test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.12",
|
||||
"@babel/preset-env": "^7.12"
|
||||
}
|
||||
}
|
||||
@@ -1,36 +1,40 @@
|
||||
{% if 'success' == envelope.type %}
|
||||
{% set title = 'Success' %}
|
||||
{% set text_color = 'text-green-600' %}
|
||||
{% set ring_color = 'ring-green-300' %}
|
||||
{% set background_color = 'bg-green-600' %}
|
||||
{% set progress_background_color = 'bg-green-100' %}
|
||||
{% set border_color = 'border-green-600' %}
|
||||
{% set icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="check w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg>' %}
|
||||
{% set icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="check w-7 h-7"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg>' %}
|
||||
{% elseif 'error' == envelope.type %}
|
||||
{% set title = 'Error' %}
|
||||
{% set text_color = 'text-red-600' %}
|
||||
{% set ring_color = 'ring-red-300' %}
|
||||
{% set background_color = 'bg-red-600' %}
|
||||
{% set progress_background_color = 'bg-red-100' %}
|
||||
{% set border_color = 'border-red-600' %}
|
||||
{% set icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="x w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>' %}
|
||||
{% set icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="x w-7 h-7"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>' %}
|
||||
{% elseif 'warning' == envelope.type %}
|
||||
{% set title = 'Warning' %}
|
||||
{% set text_color = 'text-yellow-600' %}
|
||||
{% set ring_color = 'ring-yellow-300' %}
|
||||
{% set background_color = 'bg-yellow-600' %}
|
||||
{% set progress_background_color = 'bg-yellow-100' %}
|
||||
{% set border_color = 'border-yellow-600' %}
|
||||
{% set icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="exclamation w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>' %}
|
||||
{% set icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="exclamation w-7 h-7"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>' %}
|
||||
{% else %}
|
||||
{% set title = 'Info' %}
|
||||
{% set text_color = 'text-blue-600' %}
|
||||
{% set ring_color = 'ring-blue-300' %}
|
||||
{% set background_color = 'bg-blue-600' %}
|
||||
{% set progress_background_color = 'bg-blue-100' %}
|
||||
{% set border_color = 'border-blue-600' %}
|
||||
{% set icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="exclamation-circle w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>' %}
|
||||
{% set icon = '<svg class="w-8 h-8" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>' %}
|
||||
{% endif %}
|
||||
|
||||
<div class="bg-white shadow-lg border-l-4 mt-2 cursor-pointer {{ border_color }}">
|
||||
<div class="bg-white shadow-inner border-l-4 mt-2 cursor-pointer {{ border_color }}">
|
||||
<div class="flex items-center px-2 py-3 rounded-lg shadow-lg overflow-hidden">
|
||||
<div class="inline-flex items-center {{ background_color }} p-2 text-white text-sm rounded-full flex-shrink-0">
|
||||
<div class="inline-flex items-center {{ background_color }} p-1 text-white text-sm rounded-full flex-shrink-0">
|
||||
{{ icon | raw }}
|
||||
</div>
|
||||
<div class="ml-4 w-0 flex-1">
|
||||
|
||||
@@ -4,33 +4,33 @@
|
||||
{% set background_color = 'bg-green-50' %}
|
||||
{% set progress_background_color = 'bg-green-200' %}
|
||||
{% set border_color = 'border-green-600' %}
|
||||
{% set icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="check w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg>' %}
|
||||
{% set icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="check w-8 h-8"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg>' %}
|
||||
{% elseif 'error' == envelope.type %}
|
||||
{% set title = 'Error' %}
|
||||
{% set text_color = 'text-red-700' %}
|
||||
{% set background_color = 'bg-red-50' %}
|
||||
{% set progress_background_color = 'bg-red-200' %}
|
||||
{% set border_color = 'border-red-600' %}
|
||||
{% set icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="x w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>' %}
|
||||
{% set icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="x w-8 h-8"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>' %}
|
||||
{% elseif 'warning' == envelope.type %}
|
||||
{% set title = 'Warning' %}
|
||||
{% set text_color = 'text-yellow-700' %}
|
||||
{% set background_color = 'bg-yellow-50' %}
|
||||
{% set progress_background_color = 'bg-yellow-200' %}
|
||||
{% set border_color = 'border-yellow-600' %}
|
||||
{% set icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="exclamation w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>' %}
|
||||
{% set icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="exclamation w-8 h-8"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>' %}
|
||||
{% else %}
|
||||
{% set title = 'Info' %}
|
||||
{% set text_color = 'text-blue-700' %}
|
||||
{% set background_color = 'bg-blue-50' %}
|
||||
{% set progress_background_color = 'bg-blue-200' %}
|
||||
{% set border_color = 'border-blue-600' %}
|
||||
{% set icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="exclamation-circle w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>' %}
|
||||
{% set icon = '<svg class="w-8 h-8" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>' %}
|
||||
{% endif %}
|
||||
|
||||
<div class="bg-white shadow-lg border-l-4 mt-2 cursor-pointer {{ background_color }} {{ border_color }}">
|
||||
<div class="flex items-center px-2 py-3 rounded-lg shadow-lg overflow-hidden">
|
||||
<div class="inline-flex items-center p-2 text-white text-sm rounded-full border-2 {{ border_color }} {{ text_color }} flex-shrink-0">
|
||||
<div class="inline-flex items-center p-2 text-white text-sm rounded-full {{ text_color }} flex-shrink-0">
|
||||
{{ icon | raw }}
|
||||
</div>
|
||||
<div class="ml-4 w-0 flex-1">
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
{% if 'success' == envelope.type %}
|
||||
{% set title = 'Success' %}
|
||||
{% set text_color = 'text-green-600' %}
|
||||
{% set ring_color = 'ring-green-300' %}
|
||||
{% set background_color = 'bg-green-600' %}
|
||||
{% set progress_background_color = 'bg-green-100' %}
|
||||
{% set border_color = 'border-green-600' %}
|
||||
{% set icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="check w-8 h-8"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg>' %}
|
||||
{% elseif 'error' == envelope.type %}
|
||||
{% set title = 'Error' %}
|
||||
{% set text_color = 'text-red-600' %}
|
||||
{% set ring_color = 'ring-red-300' %}
|
||||
{% set background_color = 'bg-red-600' %}
|
||||
{% set progress_background_color = 'bg-red-100' %}
|
||||
{% set border_color = 'border-red-600' %}
|
||||
{% set icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="x w-8 h-8"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>' %}
|
||||
{% elseif 'warning' == envelope.type %}
|
||||
{% set title = 'Warning' %}
|
||||
{% set text_color = 'text-yellow-600' %}
|
||||
{% set ring_color = 'ring-yellow-300' %}
|
||||
{% set background_color = 'bg-yellow-600' %}
|
||||
{% set progress_background_color = 'bg-yellow-100' %}
|
||||
{% set border_color = 'border-yellow-600' %}
|
||||
{% set icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="exclamation w-8 h-8"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>' %}
|
||||
{% else %}
|
||||
{% set title = 'Info' %}
|
||||
{% set text_color = 'text-blue-600' %}
|
||||
{% set ring_color = 'ring-blue-300' %}
|
||||
{% set background_color = 'bg-blue-600' %}
|
||||
{% set progress_background_color = 'bg-blue-100' %}
|
||||
{% set border_color = 'border-blue-600' %}
|
||||
{% set icon = '<svg class="w-8 h-8" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>' %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
<div class="bg-white shadow-inner border-l-4 mt-2 cursor-pointer {{ border_color }}">
|
||||
<div class="flex items-center px-2 py-3 rounded-lg shadow-lg overflow-hidden">
|
||||
<div class="inline-flex items-center {{ text_color }} p-1 text-xl rounded-full flex-shrink-0">
|
||||
{{ icon | raw }}
|
||||
</div>
|
||||
<div class="ml-4 w-0 flex-1">
|
||||
<p class="text-base leading-5 font-medium capitalize {{ text_color }}">
|
||||
{{ title | trans }}
|
||||
</p>
|
||||
<p class="mt-1 text-sm leading-5 text-gray-500">
|
||||
{{ envelope.message }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="h-0.5 flex {{ progress_background_color }}">
|
||||
<span class="flasher-progress {{ background_color }}"></span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace PHPSTORM_META;
|
||||
|
||||
use Flasher\Toastr\Prime\ToastrBuilder;
|
||||
|
||||
expectedArguments(ToastrBuilder::showMethod(), 1, ['fadeIn', 'slideDown', 'show']);
|
||||
expectedArguments(ToastrBuilder::showEasing(), 1, ['swing', 'linear']);
|
||||
expectedArguments(ToastrBuilder::positionClass(), 1, ['toast-top-right', 'toast-top-center', 'toast-bottom-center', 'toast-top-full-width', 'toast-bottom-full-width', 'toast-top-left', 'toast-bottom-right', 'toast-bottom-left']);
|
||||
expectedArguments(\Flasher\Toastr\Prime\ToastrBuilder::showMethod(), 0, 'fadeIn', 'fadeOut', 'slideDown', 'show');
|
||||
expectedArguments(\Flasher\Toastr\Prime\ToastrBuilder::hideMethod(), 0, 'fadeIn', 'fadeOut', 'slideDown', 'show');
|
||||
expectedArguments(\Flasher\Toastr\Prime\ToastrBuilder::showEasing(), 0, 'swing', 'linear');
|
||||
expectedArguments(\Flasher\Toastr\Prime\ToastrBuilder::hideEasing(), 0, 'swing', 'linear');
|
||||
expectedArguments(\Flasher\Toastr\Prime\ToastrBuilder::positionClass(), 0, 'toast-top-right', 'toast-top-center', 'toast-bottom-center', 'toast-top-full-width', 'toast-bottom-full-width', 'toast-top-left', 'toast-bottom-right', 'toast-bottom-left');
|
||||
|
||||
@@ -20,6 +20,8 @@ final class ToastrBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* enable a close button
|
||||
*
|
||||
* @param bool $closeButton
|
||||
*
|
||||
* @return $this
|
||||
@@ -68,6 +70,8 @@ final class ToastrBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* override the close button's HTML.
|
||||
*
|
||||
* @param string $closeHtml
|
||||
*
|
||||
* @return $this
|
||||
@@ -128,6 +132,8 @@ final class ToastrBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* In case you want to escape HTML characters in title and message
|
||||
*
|
||||
* @param bool $escapeHtml
|
||||
*
|
||||
* @return $this
|
||||
@@ -140,6 +146,8 @@ final class ToastrBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* How long the toast will display after a user hovers over it
|
||||
*
|
||||
* @param int $extendedTimeOut
|
||||
*
|
||||
* @return $this
|
||||
@@ -212,6 +220,8 @@ final class ToastrBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* Show newest toast at bottom (top is default)
|
||||
*
|
||||
* @param bool $newestOnTop
|
||||
*
|
||||
* @return $this
|
||||
@@ -260,6 +270,8 @@ final class ToastrBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* Rather than having identical toasts stack, set the preventDuplicates property to true. Duplicates are matched to the previous toast based on their message content.
|
||||
*
|
||||
* @param bool $preventDuplicates
|
||||
*
|
||||
* @return $this
|
||||
@@ -272,6 +284,8 @@ final class ToastrBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* Visually indicate how long before a toast expires.
|
||||
*
|
||||
* @param bool $progressBar
|
||||
*
|
||||
* @return $this
|
||||
@@ -296,6 +310,8 @@ final class ToastrBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* Flip the toastr to be displayed properly for right-to-left languages.
|
||||
*
|
||||
* @param bool $rtl
|
||||
*
|
||||
* @return $this
|
||||
@@ -368,14 +384,21 @@ final class ToastrBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $timeOut
|
||||
* How long the toast will display without user interaction
|
||||
*
|
||||
* @param int $timeOut
|
||||
* @param int $extendedTimeOut
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function timeOut($timeOut)
|
||||
public function timeOut($timeOut, $extendedTimeOut = null)
|
||||
{
|
||||
$this->option('timeOut', $timeOut);
|
||||
|
||||
if (null !== $extendedTimeOut) {
|
||||
$this->extendedTimeOut($extendedTimeOut);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -402,4 +425,13 @@ final class ToastrBuilder extends NotificationBuilder
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent from Auto Hiding
|
||||
*/
|
||||
public function persistent()
|
||||
{
|
||||
$this->timeOut(0);
|
||||
$this->extendedTimeOut(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user