Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
7995a0e
feat: Add dropdown action block
ArnoEgli May 6, 2024
1a3058e
feat: change link color to primary to make them more stand out
mawiswiss May 15, 2024
eed6710
feat: add correct format for date or datetime-local input type
mawiswiss May 15, 2024
dcdd18a
Merge pull request #23 from araise-dev/feature/action-button-dropdown
ArnoEgli May 21, 2024
222cfb8
feat: add underline on link hover with transition
mawiswiss May 15, 2024
9ccebf9
feat: dispatch global event to close all dropdowns when a new one is …
mawiswiss May 15, 2024
4acf56a
Merge pull request #26 from araise-dev/feature/59-dropdown-close
mawiswiss May 23, 2024
a4ccaba
Merge pull request #25 from araise-dev/feature/99-link-color
mawiswiss May 23, 2024
4a62473
feat: add a `format` value to the stimulus controller which is optional
mawiswiss May 16, 2024
d727e65
Merge pull request #24 from araise-dev/feature/35-datetime
mawiswiss May 23, 2024
dcea6e5
feat: add utility classes for badges
mawiswiss May 22, 2024
2ed7703
Merge pull request #27 from araise-dev/feature/86-badges
mawiswiss May 23, 2024
49627f8
chore: removed deprecations in tests
tuxes3 Jun 10, 2024
f43393d
feature(test): added strategy matrix for php and symfony
tuxes3 Jun 11, 2024
9d49ebc
Merge pull request #29 from araise-dev/feature/test-matrix
tuxes3 Jun 11, 2024
111063e
feat: add flash exception
Ruesa18 Jun 25, 2024
84d9a10
docs: change theme of mermaid diagrams
Ruesa18 Jun 27, 2024
ef28eef
Merge pull request #31 from araise-dev/feature/24-documentation-desig…
tuxes3 Jun 27, 2024
3a82ac4
Merge pull request #30 from araise-dev/feature/113-add-custom-flash-m…
tuxes3 Jul 1, 2024
c8c5d6f
fix: close all dropdowns when other opens, don't prevent this from ha…
mawiswiss Jul 17, 2024
117dfbf
fix(styles): enforce text underline for links inside block content
mawiswiss Jul 17, 2024
da554b8
feat: add utility class for checkbox with global styling
mawiswiss Jul 18, 2024
d31b51e
feat: add utility class for rounded button
mawiswiss Jul 20, 2024
af44db2
feat(input): add a new stimulus controller for input masking
mawiswiss Jul 20, 2024
59e2746
fix: lazyload some stimulus controllers
mawiswiss Jul 23, 2024
b757138
docs: add information from where this code is coming from
mawiswiss Jul 23, 2024
a672023
refactor: load `imask` async when the controller is connected to the DOM
mawiswiss Jul 23, 2024
fff3a5f
Merge pull request #36 from araise-dev/feature/119-table-header
mawiswiss Jul 23, 2024
9acf1a9
Merge pull request #35 from araise-dev/feature/checkbox-styling
mawiswiss Jul 23, 2024
e117307
Merge pull request #37 from araise-dev/feature/69-input-masking
mawiswiss Jul 23, 2024
adbc99e
Merge pull request #32 from araise-dev/feature/99-link-underline
mawiswiss Jul 23, 2024
f3e7586
Merge pull request #33 from araise-dev/feature/59-fix-dropdown-contro…
mawiswiss Jul 23, 2024
ab2547c
feat: add BadgeFormatter to generate badges
Ruesa18 Jul 18, 2024
6b3b2ca
Merge pull request #34 from araise-dev/feature/86-add-badge-formatter
tuxes3 Jul 25, 2024
fb6fc18
fix(money-input-mask): do not set thousandsSeparator per default
tuxes3 Jul 29, 2024
88d7a1c
fix: set darker color to link and make it more important
mawiswiss Sep 18, 2024
fab70e3
fix: set correct default value for number masking
mawiswiss Sep 19, 2024
2d09e9d
feat: add min/max value to pass into imask.js
mawiswiss Sep 19, 2024
e1c7e23
Merge pull request #39 from araise-dev/feature/99-link-decoration
mawiswiss Sep 19, 2024
5166f43
Merge pull request #38 from araise-dev/feature/69-masking-controller
mawiswiss Sep 19, 2024
be65de3
feat(badge-formatter): added configuration option which allows changi…
tuxes3 Oct 7, 2024
1bcb713
chore: added Changelog for v1.2.0
tuxes3 Oct 8, 2024
437a826
Merge branch 'release/v1.2.0' into develop
tuxes3 Oct 8, 2024
cb2863c
feat(badge): add a badge for action button and include utility classe…
mawiswiss Dec 5, 2024
a1ba49c
fix(badge): improve styling for badge
mawiswiss Dec 5, 2024
d33a8b3
Merge pull request #41 from araise-dev/feature/button-badge
tuxes3 Dec 5, 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
48 changes: 38 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CoreBundle
name: PHP Symfony CI

on:
push:
Expand All @@ -7,18 +7,46 @@ on:
branches: [ main, develop ]

jobs:
phpunit:
build:
runs-on: ubuntu-latest

strategy:
matrix:
php: [8.1, 8.2, 8.3]
symfony: [6.4.*, 7.0.*, 7.1.*]
exclude:
- php: 8.1
symfony: 7.1.*
- php: 8.1
symfony: 7.0.*

services:
mysql:
image: mysql:latest
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping --silent"
--health-interval 10s
--health-timeout 5s
--health-retries 3

steps:
- uses: shivammathur/setup-php@2cb9b829437ee246e9b3cac53555a39208ca6d28
- uses: actions/checkout@v4
- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
- uses: actions/checkout@v2
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Execute tests (Unit and Feature tests) via PHPUnit
php-version: ${{ matrix.php }}
tools: flex
- name: Download dependencies
env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}
uses: ramsey/composer-install@v2
- name: Run test suite on PHP ${{ matrix.php }} and Symfony ${{ matrix.symfony }}
run: vendor/bin/simple-phpunit
- name: Check Code Styles
- name: Run ECS
run: vendor/bin/ecs
- name: Check PHP Stan
- name: Run PHPStan
run: vendor/bin/phpstan analyse src tests
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# CHANGELOG

## v1.2.0
- Removed symfony ^5.4 support
- Introduced `FlashBagExecption` to handle flash messages in a more flexible way
- Introduced `BadgeFormatter` to display badges in a standardized way
- Improved `datetime_controller.js` to handle more date formats
- Introduced `input-mask_controller.js` to handle input masks like Money or Security-Numbers

## v1.0.6
- More documentation and better styling of the documentation
- Deprecated methods `getContainer` and `get` of `BaseCommand`
Expand Down
26 changes: 13 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,26 @@
"php": ">=8.1",
"ext-bcmath": "*",
"doctrine/collections": "~1.0|~2.0",
"symfony/console": "^5.4|^6.4|^7.0",
"symfony/framework-bundle": "^5.4|^6.4|^7.0",
"symfony/http-kernel": "^5.4|^6.4|^7.0",
"symfony/intl" : "^5.4|^6.4|^7.0",
"symfony/options-resolver" : "^5.4|^6.4|^7.0",
"symfony/console": "^6.4|^7.0",
"symfony/framework-bundle": "^6.4|^7.0",
"symfony/http-kernel": "^6.4|^7.0",
"symfony/intl" : "^6.4|^7.0",
"symfony/options-resolver" : "^6.4|^7.0",
"whatwedo/twig-bootstrap-icons": "^1.0.0",
"symfony/translation": "^5.4|^6.4|^7.0",
"symfony/form": "^5.4|^6.4|^7.0",
"symfony/stopwatch": "^5.4|^6.4|^7.0",
"symfony/translation": "^6.4|^7.0",
"symfony/form": "^6.4|^7.0",
"symfony/stopwatch": "^6.4|^7.0",
"symfony/test-pack": "^1.1.0",
"symfony/orm-pack": "^2.4.1"
},
"require-dev": {
"symfony/phpunit-bridge": "^5.4|^6.4|^7.0",
"symfony/config": "^5.4|^6.4|^7.0",
"symfony/dependency-injection": "^5.4|^6.4|^7.0",
"symfony/yaml": "^5.4|^6.4|^7.0",
"symfony/phpunit-bridge": "^6.4|^7.0",
"symfony/config": "^6.4|^7.0",
"symfony/dependency-injection": "^6.4|^7.0",
"symfony/yaml": "^6.4|^7.0",
"doctrine/doctrine-bundle": "^2.5.5",
"whatwedo/php-coding-standard": "^1.0",
"symfony/twig-bundle": "^5.4|^6.4|^7.0",
"symfony/twig-bundle": "^6.4|^7.0",
"phpstan/phpstan": "^1.7"
},
"autoload": {
Expand Down
14 changes: 13 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,19 @@
<!-- Source: https://github.com/Leward/mermaid-docsify -->
<script type="module">
import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs";
mermaid.initialize({ startOnLoad: true });
mermaid.initialize({
startOnLoad: true,
theme: 'base',
themeVariables: {
darkMode: true,
primaryColor: '#5b47d1',
primaryTextColor: '#ffffff',
primaryBorderColor: '#1b1447',
lineColor: '#fc00ff',
secondaryColor: '#fc00ff',
tertiaryColor: '#fc00ff',
},
});
window.mermaid = mermaid;
</script>
<script src="https://unpkg.com/docsify-mermaid@2.0.0/dist/docsify-mermaid.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/araiseCoreExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
* This is the class that loads and manages your bundle configuration.
Expand Down
25 changes: 25 additions & 0 deletions src/Exception/FlashBagExecption.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace araise\CoreBundle\Exception;


class FlashBagExecption extends \Exception
{
private string $flashType;

public function __construct(string $flashType, string $flashMessage, string $message = '', int $code = 0, ?\Throwable $previous = null)
{
$this->flashType = $flashType;
parent::__construct($message !== '' ? $message : $flashMessage, $code, $previous);
}

public function getFlashType(): string
{
return $this->flashType;
}

public function getFlashMessage(): string
{
return $this->message;
}
}
60 changes: 60 additions & 0 deletions src/Formatter/BadgeFormatter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

namespace araise\CoreBundle\Formatter;

use araise\CoreBundle\Util\StringConverter;
use Symfony\Component\OptionsResolver\OptionsResolver;

class BadgeFormatter extends TwigFormatter
{
public const OPT_BACKGROUND_COLOR_CLASS = 'background_color_class';

public const OPT_BACKGROUND_COLOR_HEX = 'background_color_hex';

public const OPT_TYPE = 'type';

public const OPT_LINK = 'link';

public const OPT_CONFIGURATION = 'configuration';

public function getString(mixed $value): string
{
return StringConverter::toString($value);
}

public function getHtml(mixed $value): string
{
$this->processOptions(($this->options[self::OPT_CONFIGURATION])($value, $this->options));
return $this->twig->render($this->options[self::OPT_TEMPLATE], [
'value' => $this->getString($value),
'type' => $this->options[self::OPT_TYPE],
'background_color_class' => $this->options[self::OPT_BACKGROUND_COLOR_CLASS],
'background_color_hex' => $this->options[self::OPT_BACKGROUND_COLOR_HEX],
'link' => $this->options[self::OPT_LINK],
]);
}

protected function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefault(self::OPT_TEMPLATE, '@araiseCore/formatter/badge.html.twig');
$resolver->setDefaults([
self::OPT_BACKGROUND_COLOR_CLASS => null,
self::OPT_BACKGROUND_COLOR_HEX => null,
self::OPT_TYPE => 'neutral',
self::OPT_LINK => null,
self::OPT_CONFIGURATION => static fn (mixed $value, array $options): array => $options,
]);
$resolver->setAllowedTypes(self::OPT_BACKGROUND_COLOR_CLASS, ['string', 'null']);
$resolver->setAllowedTypes(self::OPT_BACKGROUND_COLOR_HEX, ['string', 'null']);
$resolver->setAllowedTypes(self::OPT_TYPE, 'string');
$resolver->setAllowedTypes(self::OPT_LINK, ['string', 'null']);
$resolver->setAllowedTypes(self::OPT_CONFIGURATION, 'callable');
$resolver->setAllowedValues(self::OPT_TYPE, [
'primary',
'neutral',
'error',
'warning',
'success',
]);
}
}
5 changes: 3 additions & 2 deletions src/Manager/FormatterManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
namespace araise\CoreBundle\Manager;

use araise\CoreBundle\Formatter\FormatterInterface;
use Symfony\Component\DependencyInjection\Attribute\TaggedIterator;
use Symfony\Component\DependencyInjection\Attribute\AutowireIterator;

class FormatterManager
{
Expand All @@ -43,7 +43,8 @@ class FormatterManager
* @param FormatterInterface[] $formatters
*/
public function __construct(
#[TaggedIterator('araise_core.formatter')] iterable $formatters
#[AutowireIterator('araise_core.formatter')]
iterable $formatters
) {
foreach ($formatters as $formatter) {
$this->formatters[$formatter::class] = $formatter;
Expand Down
13 changes: 11 additions & 2 deletions src/Resources/assets/controllers/datetime_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ import easepickStyle from '!!raw-loader!@easepick/bundle/dist/index.css'

export default class extends Controller {
static values = {
lang: String
/**
* The language to use within the date picker (translation of months and days)
*/
lang: String,
/**
* The format passed from the server to correctly parse the date
*/
format: String
}

connect() {
if (this.element.tagName !== 'INPUT') {
return;
Expand All @@ -14,14 +22,15 @@ export default class extends Controller {
const enableTime = type === 'time' || type === 'datetime-local';
let plugins = [KbdPlugin];

if(enableTime) {
if (enableTime) {
plugins.push(TimePlugin);
}

const picker = new easepick.create({
element: this.element,
css: easepickStyle,
lang: this.langValue || 'de-DE',
format: this.formatValue || (enableTime ? "YYYY-MM-DDTHH:mm" : "YYYY-MM-DD"),
readonly: false,
plugins: plugins,
calendars: type === 'time' ? 0 : 1,
Expand Down
3 changes: 1 addition & 2 deletions src/Resources/assets/controllers/dropdown_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ export default class extends Controller {
}

toggle (event) {
event.stopPropagation();

const dropdownDiv = this.menuTarget;
if (this.hasMenuTarget && dropdownDiv.classList.contains('hidden')) {
window.dispatchEvent(new Event('araise-dropdown:open'));
dropdownDiv.classList.remove('hidden');
} else {
dropdownDiv.classList.add('hidden');
Expand Down
31 changes: 31 additions & 0 deletions src/Resources/assets/controllers/input-mask_controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Controller } from "@hotwired/stimulus"

const typeMapping = {
'Number': Number,
};
export default class extends Controller {
static values = {
mask: String,
scale: { type: Number, default: 2 },
radix: { type: String, default: '.' },
thousandsSeparator: { type: String, default: '\'' },
normalizeZeros: { type: Boolean, default: false },
min: Number,
max: Number,
};
async connect() {
const { default: IMask } = await import('imask');
this.mask = IMask(this.element, {
mask: typeMapping[this.maskValue] || this.maskValue,
scale: this.scaleValue,
radix: this.radixValue,
thousandsSeparator: this.thousandsSeparatorValue,
normalizeZeros: this.normalizeZerosValue,
min: this.hasMinValue ? this.minValue : null,
max: this.hasMaxValue ? this.maxValue : null,
});
}
disconnect() {
this.mask?.destroy();
}
}
15 changes: 11 additions & 4 deletions src/Resources/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@
"combobox": {
"main": "controllers/combobox_controller.js",
"webpackMode": "eager",
"fetch": "eager",
"fetch": "lazy",
"enabled": true
},
"datetime": {
"main": "controllers/datetime_controller.js",
"webpackMode": "eager",
"fetch": "eager",
"fetch": "lazy",
"enabled": true
},
"input-mask": {
"main": "controllers/input-mask_controller.js",
"webpackMode": "eager",
"fetch": "lazy",
"enabled": true
},
"dropdown": {
Expand All @@ -24,7 +30,7 @@
"modal-form": {
"main": "controllers/modal-form_controller.js",
"webpackMode": "eager",
"fetch": "eager",
"fetch": "lazy",
"enabled": true
},
"reload-content": {
Expand All @@ -36,7 +42,7 @@
"modal": {
"main": "controllers/modal_controller.js",
"webpackMode": "eager",
"fetch": "eager",
"fetch": "lazy",
"enabled": true
}
}
Expand All @@ -51,6 +57,7 @@
"dependencies": {
"@easepick/bundle": "^1.2.1",
"flatpickr": "^4.6.9",
"imask": "^7.6.1",
"raw-loader": "^4.0.2",
"stimulus-dropdown": "^2.0.0",
"stimulus-use": "^0.51.1",
Expand Down
Loading
Loading