generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/rchaplin/lwb 264/specific attributes all components (#265)
* LWB-264 Adding specific attributes to Demarcation components <del> and <ins> * LWB-264 General code cleanup * LWB-264 Adding specific attributes to Embeded components * LWB-264 updating embeded components tests * LWB-264 Adding specific attributes to the SvgMathMl components * LWB-264 Adding specific attributes to the Scripting components * LWB-264 Adding specific attributes to the Table components * LWB-264 Adding specific attributes to most Form components * LWB-264 Adding all of the Input types as individual components * LWB-264 Major overhaul for attribute trait structuring * LWB-264 Adjust MaxlengthMinLength to use integers as the 2 property types. * LWB-264 Fixing the FormRelatedAttributes Trait logic * LWB-264 Fixing doc blocks for ListAttribute Trait * LWB-264 Fixing doc blocks for AutocompleteAttribute Trait * LWB-264 Adjusting Iframe component to use the DimensionalAttributes trait * LWB-264 adding in src attribute assignment for Iframe component * LWB-264 Adjusting type logic for the Button Component * LWB-264 Fixing docblocks for Text, Tel, and Url components * LWB-264 Adding DimensionalAttributes Trait usage for the MEter Component * LWB-264 Adding DimensionalAttributes Trait usage for the Canvas Component
- Loading branch information
Showing
366 changed files
with
5,339 additions
and
12,080 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<del {!! $globalAttributes !!}> | ||
<del {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</del> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<ins {!! $globalAttributes !!}> | ||
<ins {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</ins> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<embed {!! $globalAttributes !!}> | ||
<embed {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</embed> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<iframe {!! $globalAttributes !!}> | ||
<iframe {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</iframe> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<portal {!! $globalAttributes !!}> | ||
<portal {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</portal> |
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 |
---|---|---|
@@ -1,3 +1 @@ | ||
<source {!! $globalAttributes !!}> | ||
{{ $slot }} | ||
</source> | ||
<source {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<button {!! $globalAttributes !!}> | ||
<button {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</button> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<fieldset {!! $globalAttributes !!}> | ||
<fieldset {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</fieldset> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<form {!! $globalAttributes !!}> | ||
<form {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</form> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<input {!! $globalAttributes !!}> | ||
<input {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</input> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="button" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="checkbox" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="color" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="date" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="datetimelocal" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="email" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="file" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="hidden" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="image" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="month" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="number" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="password" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="radio" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="range" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="reset" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="search" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="submit" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="tel" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="text" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="time" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="url" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="week" {!! $globalAttributes !!} {!! $specificAttributes !!}> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<label {!! $globalAttributes !!}> | ||
<label {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</label> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<meter {!! $globalAttributes !!}> | ||
<meter {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</meter> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<optgroup {!! $globalAttributes !!}> | ||
<optgroup {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</optgroup> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<option {!! $globalAttributes !!}> | ||
<option {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</option> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<output {!! $globalAttributes !!}> | ||
<output {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</output> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<progress {!! $globalAttributes !!}> | ||
<progress {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</progress> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<select {!! $globalAttributes !!}> | ||
<select {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</select> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<canvas {!! $globalAttributes !!}> | ||
<canvas {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</canvas> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<script {!! $globalAttributes !!}> | ||
<script {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</script> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<math {!! $globalAttributes !!}> | ||
<math {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</math> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<svg {!! $globalAttributes !!}> | ||
<svg {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</svg> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<col {!! $globalAttributes !!}> | ||
<col {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</col> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<colgroup {!! $globalAttributes !!}> | ||
<colgroup {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</colgroup> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<td {!! $globalAttributes !!}> | ||
<td {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</td> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<th {!! $globalAttributes !!}> | ||
<th {!! $globalAttributes !!} {!! $specificAttributes !!}> | ||
{{ $slot }} | ||
</th> |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace T73biz\LwBits\Components\AttributeTraits; | ||
|
||
use Livewire\Features\SupportAttributes\AttributeCollection; | ||
|
||
trait AltAttribute | ||
{ | ||
/** | ||
* A text description of the resource. This is a required attribute for accessibility and is used by screen readers. | ||
*/ | ||
public string $alt = ''; | ||
|
||
/** | ||
* Set the alt attribute | ||
* | ||
* @throws \T73biz\LwBits\Exceptions\InvalidAttributeException | ||
*/ | ||
public function setAltAttribute(AttributeCollection &$specificAttributes): void | ||
{ | ||
if (empty($this->alt)) { | ||
throw new \T73biz\LwBits\Exceptions\InvalidAttributeException('The alt attribute is required for accessibility and must be set.'); | ||
} | ||
$specificAttributes->add(['alt' => $this->alt]); | ||
} | ||
} |
119 changes: 119 additions & 0 deletions
119
src/Components/AttributeTraits/AutocompleteAttribute.php
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 |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<?php | ||
|
||
namespace T73biz\LwBits\Components\AttributeTraits; | ||
|
||
use Livewire\Features\SupportAttributes\AttributeCollection; | ||
use T73biz\LwBits\Exceptions\InvalidAttributeException; | ||
|
||
trait AutocompleteAttribute | ||
{ | ||
/** | ||
* The HTML autocomplete attribute lets web developers specify what if any permission the user agent has to provide | ||
* automated assistance in filling out form field values, as well as guidance to the browser as to the type of | ||
* information expected in the field. | ||
* | ||
* It is available on <input> elements that take a text or numeric value as input, <textarea> elements, <select> | ||
* elements, and <form> elements. | ||
*/ | ||
public string $autocomplete = ''; | ||
|
||
/** | ||
* Set the autocomplete attribute. | ||
* | ||
* @throws \T73biz\LwBits\Exceptions\InvalidAttributeException | ||
*/ | ||
public function setAutocompleteAttribute(AttributeCollection &$specificAttributes): void | ||
{ | ||
/** | ||
* Possible Values: | ||
* - off: The browser is not allowed to automatically complete the input. Note: It can't prevent a password | ||
* manager from asking the user if they want to save username and password information. | ||
* - on: The browser is allowed to automatically complete the input with no guidance as to the type of data | ||
* expected. | ||
* - <token-list>: An ordered set of space-separated tokens consisting of autofill detail tokens. | ||
* | ||
* If the autocomplete attribute is <token-list>, each token is the string "section-", case-insensitive, | ||
* followed by the rest of the token. All form controls with the same token belong to the named group. | ||
* | ||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values | ||
*/ | ||
$allowedValues = [ | ||
'name', | ||
'honorific-prefix', | ||
'given-name', | ||
'additional-name', | ||
'family-name', | ||
'honorific-suffix', | ||
'nickname', | ||
'email', | ||
'username', | ||
'new-password', | ||
'current-password', | ||
'one-time-code', | ||
'organization-title', | ||
'organization', | ||
'street-address', | ||
'shipping', | ||
'billing', | ||
'address-line1', | ||
'address-line2', | ||
'address-line3', | ||
'address-level4', | ||
'address-level3', | ||
'address-level2', | ||
'address-level1', | ||
'country', | ||
'country-name', | ||
'postal-code', | ||
'cc-name', | ||
'cc-given-name', | ||
'cc-additional-name', | ||
'cc-family-name', | ||
'cc-number', | ||
'cc-exp', | ||
'cc-exp-month', | ||
'cc-exp-year', | ||
'cc-csc', | ||
'cc-type', | ||
'transaction-currency', | ||
'transaction-amount', | ||
'language', | ||
'bday', | ||
'bday-day', | ||
'bday-month', | ||
'bday-year', | ||
'sex', | ||
'tel', | ||
'tel-country-code', | ||
'tel-national', | ||
'tel-area-code', | ||
'tel-local', | ||
'tel-extension', | ||
'impp', | ||
'url', | ||
'photo', | ||
'webauthn', | ||
]; | ||
if (! empty($this->autocomplete)) { | ||
if (in_array($this->autocomplete, ['on', 'off'])) { | ||
$specificAttributes->add(['autocomplete' => $this->autocomplete]); | ||
|
||
return; | ||
} else { | ||
$valueParts = explode(' ', $this->autocomplete); | ||
|
||
foreach ($valueParts as $key => $valuePart) { | ||
if (str_starts_with($valuePart, 'section-') && $key !== 0) { | ||
throw new InvalidAttributeException( | ||
'The autocomplete attribute value is invalid. The section token must be the first token.' | ||
); | ||
} elseif (! in_array($valuePart, $allowedValues) && ! str_starts_with($valuePart, 'section-')) { | ||
throw new InvalidAttributeException('The autocomplete attribute value is invalid.'); | ||
} | ||
} | ||
} | ||
|
||
$specificAttributes->add(['autocomplete' => $this->autocomplete]); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace T73biz\LwBits\Components\AttributeTraits; | ||
|
||
use Livewire\Features\SupportAttributes\AttributeCollection; | ||
|
||
trait CheckedAttribute | ||
{ | ||
/** | ||
* Valid for both radio and checkbox types, checked is a Boolean attribute. If present on a radio type, it indicates | ||
* that the radio button is the currently selected one in the group of same-named radio buttons. If present on a | ||
* checkbox type, it indicates that the checkbox is checked by default (when the page loads). It does not indicate | ||
* whether this checkbox is currently checked: if the checkbox's state is changed, this content attribute does not | ||
* reflect the change. (Only the HTMLInputElement's checked IDL attribute is updated.) | ||
* | ||
* Note: | ||
* Unlike other input controls, a checkboxes and radio buttons value are only included in the submitted data | ||
* if they are currently checked. If they are, the name and the value(s) of the checked controls are submitted. | ||
* | ||
* For example, if a checkbox whose name is fruit has a value of cherry, and the checkbox is checked, the form data | ||
* submitted will include fruit=cherry. If the checkbox isn't active, it isn't listed in the form data at all. The | ||
* default value for checkboxes and radio buttons is on. | ||
*/ | ||
public bool $checked = false; | ||
|
||
/** | ||
* Set the checked attribute. | ||
*/ | ||
public function setCheckedAttribute(AttributeCollection $specificAttributes): void | ||
{ | ||
if ($this->checked) { | ||
$specificAttributes->add(['checked']); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace T73biz\LwBits\Components\AttributeTraits; | ||
|
||
use Livewire\Features\SupportAttributes\AttributeCollection; | ||
|
||
trait DimensionalAttributes | ||
{ | ||
/** | ||
* The displayed height of the resource, in CSS pixels. This must be an absolute value; percentages are not allowed. | ||
*/ | ||
public int $height = 0; | ||
|
||
/** | ||
* The displayed width of the resource, in CSS pixels. This must be an absolute value; percentages are not allowed. | ||
*/ | ||
public int $width = 0; | ||
|
||
/** | ||
* Set the dimensional attributes | ||
*/ | ||
public function setDimensionalAttributes(AttributeCollection &$specificAttributes): void | ||
{ | ||
if ($this->height > 0) { | ||
$specificAttributes->add(['height' => $this->height]); | ||
} | ||
if ($this->width > 0) { | ||
$specificAttributes->add(['width' => $this->width]); | ||
} | ||
} | ||
} |
Oops, something went wrong.