Skip to content

Commit

Permalink
Pint formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
rawilk committed Oct 20, 2022
1 parent 1e69a9e commit e13cfd5
Show file tree
Hide file tree
Showing 34 changed files with 188 additions and 133 deletions.
8 changes: 4 additions & 4 deletions src/Components/Choice/Checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ class Checkbox extends BladeComponent
public string $type = 'checkbox';

public function __construct(
public null | string $name = null,
public null | string $id = null,
public ?string $name = null,
public ?string $id = null,
public mixed $value = null,
public null | string $label = null,
public null | string $description = '',
public ?string $label = null,
public ?string $description = '',
public bool $checked = false,
public $extraAttributes = '',
) {
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Choice/CheckboxGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class CheckboxGroup extends BladeComponent
{
public function __construct(public bool $stacked = true, public int | string $gridCols = 3)
public function __construct(public bool $stacked = true, public int|string $gridCols = 3)
{
}
}
16 changes: 8 additions & 8 deletions src/Components/Choice/SwitchToggle.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ class SwitchToggle extends BladeComponent
private string $labelId;

public function __construct(
public null | string $name = null,
public null | string $id = null,
public ?string $name = null,
public ?string $id = null,
public mixed $value = false,
public mixed $onValue = true,
public mixed $offValue = false,
public null | string $containerClass = null,
public ?string $containerClass = null,
public bool $short = false,
public null | string $label = null,
public ?string $label = null,
public string $labelPosition = 'right',
public null | string $offIcon = null, // doesn't apply to short mode
public null | string $onIcon = null, // doesn't apply to short mode
public null | string $buttonLabel = 'form-components::messages.switch_button_label',
public null | string $size = null,
public ?string $offIcon = null, // doesn't apply to short mode
public ?string $onIcon = null, // doesn't apply to short mode
public ?string $buttonLabel = 'form-components::messages.switch_button_label',
public ?string $size = null,
public bool $disabled = false,
public $extraAttributes = '',
) {
Expand Down
8 changes: 4 additions & 4 deletions src/Components/Files/FilePond.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ class FilePond extends BladeComponent
public function __construct(
public bool $multiple = false,
public bool $allowDrop = true,
public null | string $name = null,
public ?string $name = null,
public array $options = [],
public bool $disabled = false,
public null | int $maxFiles = null,
null|string $type = null,
public null | string $description = null,
public ?int $maxFiles = null,
?string $type = null,
public ?string $description = null,
/*
* When set to true, the component will watch for changes to the wire:model
* and manually remove the files from the FilePond instance if they are
Expand Down
15 changes: 8 additions & 7 deletions src/Components/Files/FileUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ class FileUpload extends BladeComponent

protected static array $assets = ['alpine'];

protected null|bool $canShowUploadProgress = null;
public null|string $label;
protected ?bool $canShowUploadProgress = null;

public ?string $label;

public function __construct(
public null | string $name = null,
public null | string $id = null,
null|string $label = 'form-components::messages.file_upload_label',
public ?string $name = null,
public ?string $id = null,
?string $label = 'form-components::messages.file_upload_label',
public bool $multiple = false,
null|string $type = null,
?string $type = null,
// Display the file upload progress if using livewire.
// Only applies if a "wire:model" attribute is set.
public bool $displayUploadProgress = true,
Expand All @@ -39,7 +40,7 @@ public function __construct(
$this->label = __($label);
}

public function canShowUploadProgress($attributes): bool
public function canShowUploadProgress(): bool
{
if (! is_null($this->canShowUploadProgress)) {
return $this->canShowUploadProgress;
Expand Down
4 changes: 2 additions & 2 deletions src/Components/FormError.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
class FormError extends BladeComponent
{
public function __construct(
public null | string $name = null,
public null | string $inputId = null,
public ?string $name = null,
public ?string $inputId = null,
public string $bag = 'default',
public string $tag = 'p',
) {
Expand Down
10 changes: 5 additions & 5 deletions src/Components/FormGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ class FormGroup extends BladeComponent

public function __construct(
public string $name = '',
public null | string | bool $label = null,
public null | string $inputId = null,
public null|string|bool $label = null,
public ?string $inputId = null,
public bool $inline = false,
bool $showErrors = true,
public null | string $helpText = null,
public ?string $helpText = null,
public bool $border = true,
public bool $isCheckboxGroup = false,
public null | string $labelId = null,
public ?string $labelId = null,
public bool $marginBottom = true,
public null | string $hint = null,
public ?string $hint = null,
public bool $optional = false,
public bool $customSelectLabel = false,
) {
Expand Down
18 changes: 9 additions & 9 deletions src/Components/Inputs/DatePicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ class DatePicker extends Input
{
protected static array $assets = ['alpine', 'flatpickr'];

public null|string $placeholder;
public ?string $placeholder;

public function __construct(
public null | string $name = null,
public null | string $id = null,
public ?string $name = null,
public ?string $id = null,
public mixed $value = null,
public null | string $maxWidth = null,
public ?string $maxWidth = null,
bool $showErrors = true,
$leadingAddon = false,
$inlineAddon = false,
Expand All @@ -27,12 +27,12 @@ public function __construct(
public bool $clickOpens = false,
public bool $allowInput = true,
public bool $enableTime = false,
public bool | null | string $format = false,
public bool|null|string $format = false,
public bool $clearable = false,
null|string $placeholder = 'form-components::messages.date_picker_placeholder',
public bool | null | string $toggleIcon = null,
public null | string $clearIcon = null,
public null | string $containerClass = null,
?string $placeholder = 'form-components::messages.date_picker_placeholder',
public bool|null|string $toggleIcon = null,
public ?string $clearIcon = null,
public ?string $containerClass = null,
public $extraAttributes = '',
public $after = null,
) {
Expand Down
8 changes: 4 additions & 4 deletions src/Components/Inputs/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ class Input extends BladeComponent
public const DEFAULT_TRAILING_ADDON_PADDING = 'pr-12';

public function __construct(
public null | string $name = null,
public null | string $id = null,
public ?string $name = null,
public ?string $id = null,
public string $type = 'text',
public mixed $value = null,
public null | string $maxWidth = null,
public ?string $maxWidth = null,
bool $showErrors = true,
public null | string $containerClass = null,
public ?string $containerClass = null,
$leadingAddon = false,
$inlineAddon = false,
$inlineAddonPadding = self::DEFAULT_INLINE_ADDON_PADDING,
Expand Down
13 changes: 7 additions & 6 deletions src/Components/Inputs/Password.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,23 @@
class Password extends Input
{
protected static array $assets = ['alpine'];

protected bool $ignoreAddons = true;

public function __construct(
public null | string $name = null,
public null | string $id = null,
public ?string $name = null,
public ?string $id = null,
public mixed $value = null,
public null | string $maxWidth = null,
public ?string $maxWidth = null,
bool $showErrors = true,
$leadingAddon = false,
$inlineAddon = false,
$inlineAddonPadding = self::DEFAULT_INLINE_ADDON_PADDING,
$leadingIcon = false,
public bool $showToggle = true,
public null | string $showPasswordIcon = null,
public null | string $hidePasswordIcon = null,
public null | string $containerClass = null,
public ?string $showPasswordIcon = null,
public ?string $hidePasswordIcon = null,
public ?string $containerClass = null,
public $extraAttributes = '',
public $after = null,
) {
Expand Down
10 changes: 5 additions & 5 deletions src/Components/Inputs/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ class Select extends Input
public const DEFAULT_TRAILING_ADDON_PADDING = 'pr-14';

public function __construct(
public null | string $name = null,
public null | string $id = null,
public array | Collection $options = [],
public ?string $name = null,
public ?string $id = null,
public array|Collection $options = [],
public mixed $value = null,
public bool $multiple = false,
public null | string $maxWidth = null,
public ?string $maxWidth = null,
bool $showErrors = true,
$leadingAddon = false,
$inlineAddon = false,
Expand All @@ -27,7 +27,7 @@ public function __construct(
$trailingAddon = false,
$trailingAddonPadding = self::DEFAULT_TRAILING_ADDON_PADDING,
$trailingIcon = false,
public null | string $containerClass = null,
public ?string $containerClass = null,
public $extraAttributes = '',
public $after = null,
) {
Expand Down
14 changes: 7 additions & 7 deletions src/Components/Inputs/TimezoneSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
class TimezoneSelect extends Select
{
public function __construct(
public null|string $name = null,
public null|string $id = null,
public ?string $name = null,
public ?string $id = null,
public mixed $value = null,
public bool $multiple = false,
public null|string $maxWidth = null, // Native only
public ?string $maxWidth = null, // Native only
bool $showErrors = true,
$leadingAddon = false, // Native only
$inlineAddon = false, // Native only
Expand All @@ -25,14 +25,14 @@ public function __construct(
public bool $searchable = true,
public bool $optional = false,
public bool|null|string $placeholder = null,
public null | string $containerClass = null, // Native only
public ?string $containerClass = null, // Native only
public $extraAttributes = '',
public $after = null, // Native only
public int $minSelected = 1,
public null|int $maxSelected = null,
public ?int $maxSelected = null,
public bool $disabled = false,
public null|string $clearIcon = null,
public null|bool $showCheckbox = null,
public ?string $clearIcon = null,
public ?bool $showCheckbox = null,
public bool $autofocus = false,
) {
parent::__construct(
Expand Down
6 changes: 5 additions & 1 deletion src/Components/Livewire/Concerns/HandlesSelectOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ trait HandlesSelectOptions
use GetsSelectOptionProperties;

public string $valueField = 'id';

public string $labelField = 'name';
public null|string $selectedLabelField = null;

public ?string $selectedLabelField = null;

public string $disabledField = 'disabled';

public string $isOptGroupField = 'is_opt_group';

public function handleSearch($search): void
Expand Down
32 changes: 26 additions & 6 deletions src/Components/Livewire/CustomSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,46 @@ abstract class CustomSelect extends Component
{
use HandlesSelectOptions;

public null|string $name = null;
public null|string $selectId = null;
public ?string $name = null;

public ?string $selectId = null;

public $value;

public bool $multiple = false;

public int $minSelected = 1;
public null|int $maxSelected = null;

public ?int $maxSelected = null;

public bool $disabled = false;
public null|string $labelledby = null;

public ?string $labelledby = null;

public bool $searchable = true;

public bool $closeOnSelect = false;

public bool $autofocus = false;

public bool $optional = false;
public null|string $clearIcon = null;

public ?string $clearIcon = null;

public bool|null|string $placeholder = null;

public bool|null|string $noOptionsText = null;

public bool|null|string $noResultsText = null;
public null|bool $showCheckbox = null;

public ?bool $showCheckbox = null;

public $search = '';

public $extraAttributes = '';

public bool $showErrors = true;

public bool $defer = false;

protected string $view = 'form-components::livewire.custom-select.custom-select';
Expand Down
7 changes: 6 additions & 1 deletion src/Concerns/HasAddons.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@
trait HasAddons
{
public $leadingAddon;

public $inlineAddon;

public $inlineAddonPadding;

public $leadingIcon;

public $trailingAddon;

public $trailingAddonPadding;

public $trailingIcon;

protected function getAddonClass(): string
Expand Down Expand Up @@ -57,7 +62,7 @@ protected function trailingAddonClass(): null|string
* (e.g. <x-slot name="leadingAddon"> instead of leading-addon="")
* we need to set them in the render method as they don't get set in the constructor.
*
* @param array $data
* @param array $data
*/
protected function setSlotAddonAttributes(array $data): void
{
Expand Down
1 change: 1 addition & 0 deletions src/Concerns/HasModels.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
trait HasModels
{
protected $hasWireModel;

protected $hasXModel;

public function hasBoundModel(): bool
Expand Down
Loading

0 comments on commit e13cfd5

Please sign in to comment.