Skip to content

Commit 83c5658

Browse files
Move common interfaces to php-forge/html-interop. (#336)
1 parent f6fe500 commit 83c5658

34 files changed

+364
-657
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Change Log
22

3-
## 0.1.2 Under development
3+
## 0.2.0 February 27, 2024
4+
5+
- Enh #336: Move common interfaces to `php-forge/html-interop` package (@terabytesoftw)
46

57
## 0.1.1 February 25, 2024
68

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"ext-mbstring": "*",
1717
"enshrined/svg-sanitize": "^0.17.0",
1818
"php-forge/awesome-widget": "^0.1.2",
19+
"php-forge/html-interop": "^0.1",
1920
"voku/anti-xss": "^4.1"
2021
},
2122
"require-dev": {

src/FormControl/Base/AbstractSelect.php

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,36 @@
55
namespace PHPForge\Html\FormControl\Base;
66

77
use InvalidArgumentException;
8-
use PHPForge\Html\{
9-
Attribute\Aria\HasAriaLabel,
10-
Attribute\CanBeAutofocus,
11-
Attribute\Custom\HasAttributes,
12-
Attribute\Custom\HasLabelCollection,
13-
Attribute\Custom\HasPrefixCollection,
14-
Attribute\Custom\HasSuffixCollection,
15-
Attribute\Field\HasGenerateField,
16-
Attribute\HasClass,
17-
Attribute\HasId,
18-
Attribute\HasStyle,
19-
Attribute\HasTabindex,
20-
Attribute\Input\CanBeDisabled,
21-
Attribute\Input\CanBeMultiple,
22-
Attribute\Input\CanBeRequired,
23-
Attribute\Input\HasName,
24-
Attribute\Input\HasSize,
25-
Attribute\Input\HasValue,
26-
Attribute\Tag\HasGroup,
27-
Attribute\Tag\HasItems,
28-
Attribute\Tag\HasItemsAttributes,
29-
Attribute\Tag\HasPrompt,
30-
FormControl\Input\Contract\InputInterface,
31-
FormControl\Input\Contract\RequiredInterface,
32-
FormControl\Input\Contract\ValueInterface,
33-
FormControl\Label,
34-
Tag
8+
use PHPForge\{
9+
Html\Attribute\Aria\HasAriaLabel,
10+
Html\Attribute\CanBeAutofocus,
11+
Html\Attribute\Custom\HasAttributes,
12+
Html\Attribute\Custom\HasLabelCollection,
13+
Html\Attribute\Custom\HasPrefixCollection,
14+
Html\Attribute\Custom\HasSuffixCollection,
15+
Html\Attribute\Field\HasGenerateField,
16+
Html\Attribute\HasClass,
17+
Html\Attribute\HasId,
18+
Html\Attribute\HasStyle,
19+
Html\Attribute\HasTabindex,
20+
Html\Attribute\Input\CanBeDisabled,
21+
Html\Attribute\Input\CanBeMultiple,
22+
Html\Attribute\Input\CanBeRequired,
23+
Html\Attribute\Input\HasName,
24+
Html\Attribute\Input\HasSize,
25+
Html\Attribute\Input\HasValue,
26+
Html\Attribute\Tag\HasGroup,
27+
Html\Attribute\Tag\HasItems,
28+
Html\Attribute\Tag\HasItemsAttributes,
29+
Html\Attribute\Tag\HasPrompt,
30+
Html\FormControl\Label,
31+
Html\Interop\InputInterface,
32+
Html\Interop\RequiredInterface,
33+
Html\Interop\ValueInterface,
34+
Html\Tag,
35+
Widget\Element,
36+
Widget\ElementInterface
3537
};
36-
use PHPForge\Widget\Element;
3738
use Stringable;
3839

3940
use function array_merge;
@@ -47,7 +48,11 @@
4748
/**
4849
* Provides a foundation for creating HTML `select` elements with various attributes and content.
4950
*/
50-
abstract class AbstractSelect extends Element implements InputInterface, RequiredInterface, ValueInterface
51+
abstract class AbstractSelect extends Element implements
52+
ElementInterface,
53+
InputInterface,
54+
RequiredInterface,
55+
ValueInterface
5156
{
5257
use CanBeAutofocus;
5358
use CanBeDisabled;

src/FormControl/Input/Base/AbstractChoiceList.php

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,35 @@
44

55
namespace PHPForge\Html\FormControl\Input\Base;
66

7-
use PHPForge\Html\{
8-
Attribute\Aria\HasAriaDescribedBy,
9-
Attribute\Aria\HasAriaLabel,
10-
Attribute\CanBeAutofocus,
11-
Attribute\Custom\HasAttributes,
12-
Attribute\Custom\HasContainerCollection,
13-
Attribute\Custom\HasEnclosedByLabel,
14-
Attribute\Custom\HasLabelCollection,
15-
Attribute\Custom\HasLabelItemClass,
16-
Attribute\Custom\HasSeparator,
17-
Attribute\Custom\HasTemplate,
18-
Attribute\Custom\HasUncheckedCollection,
19-
Attribute\Field\HasGenerateField,
20-
Attribute\HasClass,
21-
Attribute\HasId,
22-
Attribute\HasTabindex,
23-
Attribute\Input\CanBeChecked,
24-
Attribute\Input\CanBeRequired,
25-
Attribute\Input\HasName,
26-
FormControl\Input\Contract\AriaDescribedByInterface,
27-
FormControl\Input\Contract\CheckedInterface,
28-
FormControl\Input\Contract\InputInterface,
29-
FormControl\Input\Contract\LabelInterface,
30-
FormControl\Input\Contract\RequiredInterface,
31-
Helper\Utils,
32-
Tag
7+
use PHPForge\{
8+
Html\Attribute\Aria\HasAriaDescribedBy,
9+
Html\Attribute\Aria\HasAriaLabel,
10+
Html\Attribute\CanBeAutofocus,
11+
Html\Attribute\Custom\HasAttributes,
12+
Html\Attribute\Custom\HasContainerCollection,
13+
Html\Attribute\Custom\HasEnclosedByLabel,
14+
Html\Attribute\Custom\HasLabelCollection,
15+
Html\Attribute\Custom\HasLabelItemClass,
16+
Html\Attribute\Custom\HasSeparator,
17+
Html\Attribute\Custom\HasTemplate,
18+
Html\Attribute\Custom\HasUncheckedCollection,
19+
Html\Attribute\Field\HasGenerateField,
20+
Html\Attribute\HasClass,
21+
Html\Attribute\HasId,
22+
Html\Attribute\HasTabindex,
23+
Html\Attribute\Input\CanBeChecked,
24+
Html\Attribute\Input\CanBeRequired,
25+
Html\Attribute\Input\HasName,
26+
Html\FormControl\Input\Contract\LabelInterface,
27+
Html\Helper\Utils,
28+
Html\Interop\AriaDescribedByInterface,
29+
Html\Interop\CheckedInterface,
30+
Html\Interop\InputInterface,
31+
Html\Interop\RequiredInterface,
32+
Html\Tag,
33+
Widget\Element,
34+
Widget\ElementInterface
3335
};
34-
use PHPForge\Widget\Element;
3536

3637
use function in_array;
3738
use function is_bool;
@@ -41,6 +42,7 @@
4142
abstract class AbstractChoiceList extends Element implements
4243
AriaDescribedByInterface,
4344
CheckedInterface,
45+
ElementInterface,
4446
InputInterface,
4547
LabelInterface,
4648
RequiredInterface

src/FormControl/Input/Base/AbstractHidden.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44

55
namespace PHPForge\Html\FormControl\Input\Base;
66

7-
use PHPForge\Html\{
8-
Attribute\Custom\HasAttributes,
9-
Attribute\Custom\HasTemplate,
10-
Attribute\Custom\HasValidateString,
11-
Attribute\HasClass,
12-
Attribute\HasId,
13-
Attribute\HasStyle,
14-
Attribute\Input\HasName,
15-
Attribute\Input\HasValue,
16-
FormControl\Input\Contract\ValueInterface,
17-
Tag
7+
use PHPForge\{
8+
Html\Attribute\Custom\HasAttributes,
9+
Html\Attribute\Custom\HasTemplate,
10+
Html\Attribute\Custom\HasValidateString,
11+
Html\Attribute\HasClass,
12+
Html\Attribute\HasId,
13+
Html\Attribute\HasStyle,
14+
Html\Attribute\Input\HasName,
15+
Html\Attribute\Input\HasValue,
16+
Html\Interop\ValueInterface,
17+
Html\Tag
1818
};
1919
use PHPForge\Widget\Element;
2020

src/FormControl/Input/Base/AbstractInput.php

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,38 @@
44

55
namespace PHPForge\Html\FormControl\Input\Base;
66

7-
use PHPForge\Html\{
8-
Attribute\Aria\HasAriaDescribedBy,
9-
Attribute\Aria\HasAriaLabel,
10-
Attribute\CanBeAutofocus,
11-
Attribute\CanBeHidden,
12-
Attribute\Custom\HasAttributes,
13-
Attribute\Custom\HasPrefixCollection,
14-
Attribute\Custom\HasSuffixCollection,
15-
Attribute\Custom\HasTemplate,
16-
Attribute\Field\HasGenerateField,
17-
Attribute\HasClass,
18-
Attribute\HasData,
19-
Attribute\HasId,
20-
Attribute\HasLang,
21-
Attribute\HasStyle,
22-
Attribute\HasTabindex,
23-
Attribute\HasTitle,
24-
Attribute\Input\CanBeDisabled,
25-
Attribute\Input\CanBeReadonly,
26-
Attribute\Input\HasForm,
27-
Attribute\Input\HasName,
28-
FormControl\Input\Contract\AriaDescribedByInterface,
29-
FormControl\Input\Contract\InputInterface,
30-
Tag
7+
use PHPForge\{
8+
Html\Attribute\Aria\HasAriaDescribedBy,
9+
Html\Attribute\Aria\HasAriaLabel,
10+
Html\Attribute\CanBeAutofocus,
11+
Html\Attribute\CanBeHidden,
12+
Html\Attribute\Custom\HasAttributes,
13+
Html\Attribute\Custom\HasPrefixCollection,
14+
Html\Attribute\Custom\HasSuffixCollection,
15+
Html\Attribute\Custom\HasTemplate,
16+
Html\Attribute\Field\HasGenerateField,
17+
Html\Attribute\HasClass,
18+
Html\Attribute\HasData,
19+
Html\Attribute\HasId,
20+
Html\Attribute\HasLang,
21+
Html\Attribute\HasStyle,
22+
Html\Attribute\HasTabindex,
23+
Html\Attribute\HasTitle,
24+
Html\Attribute\Input\CanBeDisabled,
25+
Html\Attribute\Input\CanBeReadonly,
26+
Html\Attribute\Input\HasForm,
27+
Html\Attribute\Input\HasName,
28+
Html\Interop\AriaDescribedByInterface,
29+
Html\Interop\InputInterface,
30+
Html\Tag,
31+
Widget\Element,
32+
Widget\ElementInterface,
3133
};
32-
use PHPForge\Widget\Element;
3334

3435
/**
3536
* Provides a foundation for creating HTML `input` custom elements with various attributes and content.
3637
*/
37-
abstract class AbstractInput extends Element implements AriaDescribedByInterface, InputInterface
38+
abstract class AbstractInput extends Element implements AriaDescribedByInterface, ElementInterface, InputInterface
3839
{
3940
use CanBeAutofocus;
4041
use CanBeDisabled;

src/FormControl/Input/Base/AbstractInputChoice.php

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,55 @@
44

55
namespace PHPForge\Html\FormControl\Input\Base;
66

7-
use PHPForge\Html\{
8-
Attribute\Aria\HasAriaDescribedBy,
9-
Attribute\Aria\HasAriaLabel,
10-
Attribute\CanBeAutofocus,
11-
Attribute\CanBeHidden,
12-
Attribute\Custom\HasAttributes,
13-
Attribute\Custom\HasContainerCollection,
14-
Attribute\Custom\HasContent,
15-
Attribute\Custom\HasEnclosedByLabel,
16-
Attribute\Custom\HasLabelCollection,
17-
Attribute\Custom\HasPrefixCollection,
18-
Attribute\Custom\HasSeparator,
19-
Attribute\Custom\HasSuffixCollection,
20-
Attribute\Custom\HasTemplate,
21-
Attribute\Custom\HasUncheckedCollection,
22-
Attribute\Custom\HasValidateScalar,
23-
Attribute\Field\HasGenerateField,
24-
Attribute\HasClass,
25-
Attribute\HasData,
26-
Attribute\HasId,
27-
Attribute\HasLang,
28-
Attribute\HasStyle,
29-
Attribute\HasTabindex,
30-
Attribute\HasTitle,
31-
Attribute\Input\CanBeChecked,
32-
Attribute\Input\CanBeDisabled,
33-
Attribute\Input\CanBeReadonly,
34-
Attribute\Input\CanBeRequired,
35-
Attribute\Input\HasForm,
36-
Attribute\Input\HasName,
37-
Attribute\Input\HasValue,
38-
FormControl\Input\Contract\AriaDescribedByInterface,
39-
FormControl\Input\Contract\CheckedInterface,
40-
FormControl\Input\Contract\InputInterface,
41-
FormControl\Input\Contract\LabelInterface,
42-
FormControl\Input\Contract\RequiredInterface,
43-
FormControl\Label,
44-
Tag
7+
use PHPForge\{
8+
Html\Attribute\Aria\HasAriaDescribedBy,
9+
Html\Attribute\Aria\HasAriaLabel,
10+
Html\Attribute\CanBeAutofocus,
11+
Html\Attribute\CanBeHidden,
12+
Html\Attribute\Custom\HasAttributes,
13+
Html\Attribute\Custom\HasContainerCollection,
14+
Html\Attribute\Custom\HasContent,
15+
Html\Attribute\Custom\HasEnclosedByLabel,
16+
Html\Attribute\Custom\HasLabelCollection,
17+
Html\Attribute\Custom\HasPrefixCollection,
18+
Html\Attribute\Custom\HasSeparator,
19+
Html\Attribute\Custom\HasSuffixCollection,
20+
Html\Attribute\Custom\HasTemplate,
21+
Html\Attribute\Custom\HasUncheckedCollection,
22+
Html\Attribute\Custom\HasValidateScalar,
23+
Html\Attribute\Field\HasGenerateField,
24+
Html\Attribute\HasClass,
25+
Html\Attribute\HasData,
26+
Html\Attribute\HasId,
27+
Html\Attribute\HasLang,
28+
Html\Attribute\HasStyle,
29+
Html\Attribute\HasTabindex,
30+
Html\Attribute\HasTitle,
31+
Html\Attribute\Input\CanBeChecked,
32+
Html\Attribute\Input\CanBeDisabled,
33+
Html\Attribute\Input\CanBeReadonly,
34+
Html\Attribute\Input\CanBeRequired,
35+
Html\Attribute\Input\HasForm,
36+
Html\Attribute\Input\HasName,
37+
Html\Attribute\Input\HasValue,
38+
Html\FormControl\Input\Contract\LabelInterface,
39+
Html\FormControl\Label,
40+
Html\Interop\AriaDescribedByInterface,
41+
Html\Interop\CheckedInterface,
42+
Html\Interop\InputInterface,
43+
Html\Interop\RequiredInterface,
44+
Html\Tag,
45+
Widget\Element,
46+
Widget\ElementInterface
4547
};
46-
use PHPForge\Widget\Element;
4748

4849
/**
4950
* Provides a foundation for creating HTML elements with various attributes and content.
5051
*/
5152
abstract class AbstractInputChoice extends Element implements
5253
AriaDescribedByInterface,
5354
CheckedInterface,
55+
ElementInterface,
5456
InputInterface,
5557
LabelInterface,
5658
RequiredInterface

src/FormControl/Input/Color.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,21 @@
44

55
namespace PHPForge\Html\FormControl\Input;
66

7-
use PHPForge\Html\Attribute\{Custom\HasValidateString, Input\CanBeRequired, Input\HasValue};
7+
use PHPForge\{
8+
Html\Attribute\Custom\HasValidateString,
9+
Html\Attribute\Input\CanBeRequired,
10+
Html\Attribute\Input\HasValue,
11+
Html\Interop\RequiredInterface,
12+
Html\Interop\ValueInterface
13+
};
814

915
/**
1016
* The input element with a type attribute whose value is "color" represents a color-well control, for setting the
1117
* element’s value to a string representing a simple color.
1218
*
1319
* @link https://www.w3.org/TR/2012/WD-html-markup-20120329/input.color.html#input.color
1420
*/
15-
final class Color extends Base\AbstractInput implements Contract\RequiredInterface, Contract\ValueInterface
21+
final class Color extends Base\AbstractInput implements RequiredInterface, ValueInterface
1622
{
1723
use CanBeRequired;
1824
use HasValidateString;

0 commit comments

Comments
 (0)