Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- Enh #34: Add `InputHidden` class for HTML `<input type="hidden">` element with attributes and rendering capabilities (@terabytesoftw)
- Enh #35: Add `InputRadio` class for HTML `<input type="radio">` element with attributes and rendering capabilities (@terabytesoftw)
- Enh #36: Add `InputNumber` class for HTML `<input type="number">` element with attributes and rendering capabilities (@terabytesoftw)
- Bug #37: Apply last changes from `ui-awesome/html-core` package to `ui-awesome/html` package (@terabytesoftw)

## 0.3.0 March 31, 2024

Expand Down
14 changes: 10 additions & 4 deletions src/Form/InputCheckbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,13 @@ protected function run(): string
}

if ($this->notLabel || $this->label === '') {
return $this->buildElement('', ['{label}' => '', '{unchecked}' => $unchecked]);
return $this->buildElement(
'',
[
'{label}' => '',
'{unchecked}' => $unchecked,
],
);
}

$labelTag = Label::tag()->attributes($this->labelAttributes);
Expand All @@ -156,11 +162,11 @@ protected function run(): string

$labelTag = $labelTag
->html(
PHP_EOL,
"\n",
Html::element($this->getTag(), '', $this->getAttributes()),
PHP_EOL,
"\n",
$this->label,
PHP_EOL,
"\n",
);

return $this->buildElement(
Expand Down
6 changes: 3 additions & 3 deletions src/Form/InputRadio.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ protected function run(): string

$labelTag = $labelTag
->html(
PHP_EOL,
"\n",
Html::element($this->getTag(), '', $this->getAttributes()),
PHP_EOL,
"\n",
$this->label,
PHP_EOL,
"\n",
);

return $this->buildElement(
Expand Down
19 changes: 17 additions & 2 deletions src/List/Dl.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Stringable;
use UIAwesome\Html\Core\Element\BaseBlock;
use UIAwesome\Html\Helper\LineBreakNormalizer;
use UIAwesome\Html\Interop\{BlockInterface, Lists};

/**
Expand Down Expand Up @@ -47,7 +48,7 @@ public function dd(string|Stringable $content): static
{
$dd = Dd::tag()->content($content);

return $this->html($dd->render(), PHP_EOL);
return $this->html($dd->render(), "\n");
}

/**
Expand All @@ -67,7 +68,21 @@ public function dt(string|Stringable $content): static
{
$dt = Dt::tag()->content($content);

return $this->html($dt->render(), PHP_EOL);
return $this->html($dt->render(), "\n");
}

/**
* Cleans up the output after rendering the block element.
*
* Removes excessive consecutive newlines from the rendered output to ensure clean HTML structure.
*
* @param string $result Rendered HTML output.
*
* @return string Cleaned HTML output with excessive newlines removed.
*/
protected function afterRun(string $result): string
{
return parent::afterRun(LineBreakNormalizer::normalize($result));
}

/**
Expand Down
17 changes: 16 additions & 1 deletion src/List/Ol.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Stringable;
use UIAwesome\Html\Core\Element\BaseBlock;
use UIAwesome\Html\Helper\LineBreakNormalizer;
use UIAwesome\Html\Interop\{BlockInterface, Lists};
use UIAwesome\Html\List\Attribute\{HasReversed, HasStart};

Expand Down Expand Up @@ -83,7 +84,21 @@ public function li(string|Stringable $content, int|string|null $value = null): s
$li = $li->value($value);
}

return $this->html($li->render(), PHP_EOL);
return $this->html($li->render(), "\n");
}

/**
* Cleans up the output after rendering the block element.
*
* Removes excessive consecutive newlines from the rendered output to ensure clean HTML structure.
*
* @param string $result Rendered HTML output.
*
* @return string Cleaned HTML output with excessive newlines removed.
*/
protected function afterRun(string $result): string
{
return parent::afterRun(LineBreakNormalizer::normalize($result));
}

/**
Expand Down
17 changes: 16 additions & 1 deletion src/List/Ul.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Stringable;
use UIAwesome\Html\Core\Element\BaseBlock;
use UIAwesome\Html\Helper\LineBreakNormalizer;
use UIAwesome\Html\Interop\{BlockInterface, Lists};

/**
Expand Down Expand Up @@ -77,7 +78,21 @@ public function li(string|Stringable $content, int|string|null $value = null): s
$li = $li->value($value);
}

return $this->html($li->render(), PHP_EOL);
return $this->html($li->render(), "\n");
}

/**
* Cleans up the output after rendering the block element.
*
* Removes excessive consecutive newlines from the rendered output to ensure clean HTML structure.
*
* @param string $result Rendered HTML output.
*
* @return string Cleaned HTML output with excessive newlines removed.
*/
protected function afterRun(string $result): string
{
return parent::afterRun(LineBreakNormalizer::normalize($result));
}

/**
Expand Down
Loading
Loading