Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.4.7 #67

Merged
merged 24 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
86f75d6
Fix Image component fallback class output
piqusy Dec 3, 2024
59b0360
Update changelog
piqusy Dec 3, 2024
03288c5
Update version
piqusy Dec 3, 2024
35428ae
Merge pull request #65 from infinum/fix/image-component-class-output
piqusy Dec 3, 2024
53608b5
Update dependencies
piqusy Dec 3, 2024
563b577
Merge pull request #66 from infinum/update/dependencies-1.4.7
piqusy Dec 3, 2024
d85bfc9
Fix Image component responsive output
piqusy Dec 3, 2024
b1d702f
Move $isDesktopFirst conditional of Image component few lines up
piqusy Dec 4, 2024
a32b28a
Merge pull request #68 from infinum/fix/image-component-resposiveness
piqusy Dec 4, 2024
95fce3b
Update changelog
piqusy Dec 4, 2024
ba5a429
Merge pull request #69 from infinum/fix/image-component-resposiveness
piqusy Dec 4, 2024
e4f3a3c
Add "Auto" width to wrapperContent and set is as default
piqusy Dec 5, 2024
1877c1e
Update changelog
piqusy Dec 5, 2024
3407b33
Merge pull request #70 from infinum/feature/wrapper-width---auto
piqusy Dec 5, 2024
53848f7
Add a buttonType attribute to Button component
piqusy Dec 5, 2024
8eb3192
Update changelog
piqusy Dec 5, 2024
cb36884
Set buttonType to empty by default
piqusy Dec 5, 2024
1a56577
Merge pull request #71 from infinum/feature/button-type
piqusy Dec 5, 2024
a29d6ea
Remove an empty manifest default attribute for buttonType
piqusy Dec 5, 2024
3129455
Implement a11y for Icon component
piqusy Dec 5, 2024
54eaac2
Remove labelledby from Icon and set its aria-hidden to be the default
piqusy Dec 6, 2024
f3b2de1
Merge pull request #72 from infinum/feature/a11y-icons
piqusy Dec 6, 2024
cb3a6b1
Update Node dependencies
piqusy Dec 18, 2024
867456e
Merge pull request #73 from infinum/update/node-dependencies-18122024
piqusy Dec 18, 2024
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
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a

---

## [1.4.7]

### Changed
- Fixed Image component "image" part tailwind class output if not set.
- Fix Image component responsive output Co-authored-by: [email protected]
- Add "Auto" width to wrapperContent and set is as defaults
- Add a buttonType attribute to Button component
- Implement a11y for Icon component either by setting aria-hidden to true (default) or using the existing iconName label from manifest options key
- Updated dependencies.

## [1.4.6]

### Changed
Expand Down Expand Up @@ -159,6 +169,7 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a
- Initial release.

[Unreleased]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/master...HEAD
[1.4.7]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.6...1.4.7
[1.4.6]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.5...1.4.6
[1.4.5]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.4...1.4.5
[1.4.4]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.3...1.4.4
Expand Down
5 changes: 5 additions & 0 deletions blocks/init/src/Blocks/components/button/button.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
$additionalClass = $attributes['additionalClass'] ?? '';
$additionalAttributes = $attributes['additionalAttributes'] ?? [];
$buttonId = Helpers::checkAttr('buttonId', $attributes, $manifest);
$buttonType = Helpers::checkAttr('buttonType', $attributes, $manifest);

$buttonUrl = Helpers::checkAttr('buttonUrl', $attributes, $manifest);
$buttonIsNewTab = Helpers::checkAttr('buttonIsNewTab', $attributes, $manifest);
Expand Down Expand Up @@ -59,6 +60,10 @@
$buttonAttrs['class'] = Helpers::tailwindClasses('base', $attributes, $manifest, 'button', $additionalClass);

$buttonTag = !empty($buttonUrl) ? 'a' : 'button';

if (empty($buttonUrl) && !empty($buttonType)) {
$buttonAttrs['type'] = $buttonType;
}
?>

<<?php echo $buttonTag; // phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped ?>
Expand Down
3 changes: 3 additions & 0 deletions blocks/init/src/Blocks/components/button/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
"buttonId": {
"type": "string"
},
"buttonType": {
"type": "string"
},
"buttonColor": {
"type": "string",
"default": "navy-500"
Expand Down
19 changes: 18 additions & 1 deletion blocks/init/src/Blocks/components/icon/icon.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
$additionalClass = $attributes['additionalClass'] ?? '';

$iconName = Helpers::checkAttr('iconName', $attributes, $manifest);
$iconAriaHidden = Helpers::checkAttr('iconAriaHidden', $attributes, $manifest);

if (!isset($manifest['icons'][$iconName])) {
return;
Expand All @@ -29,7 +30,23 @@
$className = Helpers::tailwindClasses('base', $attributes, $manifest, $additionalClass);

if (!empty($className)) {
$icon = str_replace('<svg ', '<svg class="' . htmlspecialchars($className) . '" ', $icon);
$icon = str_replace('<svg ', '<svg class="' . esc_attr($className) . '" ', $icon);
}

if ($iconAriaHidden) {
$icon = str_replace('<svg ', '<svg aria-hidden="true" ', $icon);
} else {
$iconTitle = '';
$iconOption = array_filter($manifest['options']['iconName'], fn($option) => $option['value'] === $iconName);

if (!empty($iconOption)) {
$iconTitle = reset($iconOption)['label'];
}

if (!empty($iconTitle)) {
$titleTag = '<title>' . esc_html($iconTitle) . '</title>';
$icon = str_replace('</svg>', $titleTag . '</svg>', $icon);
}
}

// phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
Expand Down
4 changes: 4 additions & 0 deletions blocks/init/src/Blocks/components/icon/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
"iconUse": {
"type": "boolean",
"default": true
},
"iconAriaHidden": {
"type": "boolean",
"default": true
}
},
"options": {
Expand Down
13 changes: 9 additions & 4 deletions blocks/init/src/Blocks/components/image/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,20 @@
$isDesktopFirst = $imageData['_desktopFirst'] ?? false;

$breakpointData = Helpers::getSettingsGlobalVariablesBreakpoints();
$breakpoints = Helpers::getTwBreakpoints();
$breakpoints = Helpers::getTwBreakpoints($isDesktopFirst);

if (!$isDesktopFirst) {
$breakpoints = array_reverse($breakpoints);
}
?>

<picture
<?php if (!empty($additionalClass['picture'])) { ?>
class="<?php echo esc_attr($additionalClass['picture']); ?>"
<?php } ?>
>
<?php foreach ($breakpoints as $breakpoint) { ?>
<?php
foreach ($breakpoints as $breakpoint) { ?>
<?php
if (!isset($imageData[$breakpoint])) {
continue;
Expand All @@ -45,7 +50,7 @@ class="<?php echo esc_attr($additionalClass['picture']); ?>"
continue;
}

$breakpointWidth = $breakpointData[$breakpoint];
$breakpointWidth = $breakpointData[str_replace('max-', '', $breakpoint)];

$widthMode = $isDesktopFirst ? 'max-width' : 'min-width';

Expand All @@ -57,7 +62,7 @@ class="<?php echo esc_attr($additionalClass['picture']); ?>"
<img
src="<?php echo esc_url($imageData['_default']['url'] ?? ''); ?>"
alt="<?php echo esc_attr($imageAlt); ?>"
class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest, $additionalClass['image'] ?? $additionalClass)); ?>"
class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest, $additionalClass['image'] ?? '')); ?>"
/>
</picture>

8 changes: 7 additions & 1 deletion blocks/init/src/Blocks/wrapper/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"wrapperContentWidth": {
"type": "object",
"default": {
"_default": "full",
"_default": "auto",
"_desktopFirst": true
}
},
Expand Down Expand Up @@ -289,6 +289,11 @@
}
],
"wrapperContentWidth": [
{
"label": "Auto",
"value": "auto",
"separator": "below"
},
{
"label": "Full",
"value": "full",
Expand Down Expand Up @@ -439,6 +444,7 @@
"wrapperContentWidth": {
"responsive": true,
"twClasses": {
"auto": "w-auto",
"full": "w-full",
"half": "w-1/2",
"one-third": "w-1/3",
Expand Down
Loading
Loading