Skip to content

Commit

Permalink
prepare release
Browse files Browse the repository at this point in the history
  • Loading branch information
tacman committed Oct 3, 2022
1 parent 2df176c commit af39210
Show file tree
Hide file tree
Showing 41 changed files with 487 additions and 349 deletions.
33 changes: 25 additions & 8 deletions composer.json
Expand Up @@ -12,15 +12,15 @@
"require": {
"php": "^8.1",
"knplabs/knp-menu-bundle": "^3.2",
"symfony/config": "^6.1",
"symfony/dependency-injection": "^6.1",
"symfony/http-kernel": "^6.1",
"symfony/options-resolver": "^6.1",
"symfony/security-bundle": "^6.1",
"symfony/config": "^6.1.0",
"symfony/dependency-injection": "^6.1.0",
"symfony/http-kernel": "^6.1.0",
"symfony/options-resolver": "^6.1.0",
"symfony/security-bundle": "^6.1.0",
"symfony/ux-twig-component": "^2.3",
"twig/string-extra": "^3.4",
"twig/twig": "^3.4",
"survos/core-bundle": "^1.0"
"survos/core-bundle": "^1.2.13"
},
"autoload": {
"psr-4": {
Expand All @@ -29,10 +29,10 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
"dev-master": "1.3-dev"
},
"symfony": {
"require": "^6.1"
"require": "^6.1.0"
}
},
"scripts": {
Expand All @@ -41,5 +41,22 @@
},
"require-dev": {
"phpstan/phpstan": "^1.8"
},
"conflict": {
"survos/maker-bundle": "<1.2.13",
"survos/html-prettify-bundle": "<1.2.13",
"survos/barcode-bundle": "<1.2.13",
"survos/api-grid-bundle": "<1.2.13",
"survos/second-package": "<1.2.7",
"survos/inspection-bundle": "<1.2.13",
"survos/faker-bundle": "<1.2.13",
"survos/doc-bundle": "<1.2.13",
"survos/grid-bundle": "<1.2.13",
"survos/tree-bundle": "<1.2.13",
"survos/first-package": "<1.2.7",
"survos/auth-bundle": "<1.2.13",
"survos/workflow-helper-bundle": "<1.2.13",
"survos/crawler-bundle": "<1.2.13",
"survos/location-bundle": "<1.2.13"
}
}
9 changes: 6 additions & 3 deletions src/Components/AccordionComponent.php
Expand Up @@ -3,18 +3,22 @@
namespace Survos\BootstrapBundle\Components;

use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\String\Slugger\AsciiSlugger;
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
use Symfony\UX\TwigComponent\Attribute\PreMount;
use function Symfony\Component\String\u;
use Symfony\Component\String\Slugger\AsciiSlugger;

#[AsTwigComponent('accordion', template: '@SurvosBootstrap/components/accordion.html.twig')]
class AccordionComponent
{
public string $header;

public ?string $accordion_body;

public ?string $bsParent;

public ?string $id;

public bool $open;

#[PreMount]
Expand All @@ -29,7 +33,7 @@ public function preMount(array $data): array
'bsParent' => null,
'open' => false,
]);
// $resolver->setRequired('body');
// $resolver->setRequired('body');
$resolver->setAllowedTypes('header', 'string');

$data = $resolver->resolve($data);
Expand All @@ -39,5 +43,4 @@ public function preMount(array $data): array
}
return $data;
}

}
8 changes: 6 additions & 2 deletions src/Components/AlertComponent.php
Expand Up @@ -11,20 +11,24 @@
class AlertComponent
{
public string $type;

public string $message;

public bool $dismissible;

#[PreMount]
public function preMount(array $data): array
{
// validate data
$resolver = new OptionsResolver();
$resolver->setDefaults(['type' => 'success', 'dismissible' => false]);
$resolver->setDefaults([
'type' => 'success',
'dismissible' => false,
]);
$resolver->setAllowedValues('type', ContextService::THEME_COLORS);
$resolver->setRequired('message');
$resolver->setAllowedTypes('message', 'string');

return $resolver->resolve($data);
}

}
9 changes: 7 additions & 2 deletions src/Components/BadgeComponent.php
Expand Up @@ -11,10 +11,15 @@
class BadgeComponent
{
public ?string $alignment;

public ?string $message;

public ?string $style;

public ?string $color; // background color

public ?string $text; // text color, e.g. primary, white

public ?bool $label;

#[PreMount]
Expand All @@ -28,13 +33,13 @@ public function preMount(array $data): array
'text' => null,
'label' => null,
'style' => null, // pill
'message' => null]);
'message' => null,
]);

$data = $resolver->resolve($data);
if (empty($data['message'])) {
$data['message'] = json_encode($data);
}
return $data;
}

}
12 changes: 9 additions & 3 deletions src/Components/ButtonComponent.php
Expand Up @@ -10,12 +10,19 @@
class ButtonComponent
{
public ?string $label;

public ?string $color;

public ?string $style;

public ?string $icon;

public ?string $size;

public ?bool $outline;

public ?array $links;

public ?array $a;

#[PreMount]
Expand All @@ -32,17 +39,16 @@ public function preMount(array $data): array
'size' => null,
'outline' => false,
'a' => null, // href, target
]);
]);

$data = $resolver->resolve($data);
if ($a = $data['a']) {
$data['a'] = (new OptionsResolver())
->setDefaults([
'href' => '#',
'target' => '_blank'
'target' => '_blank',
])->resolve($a);
}
return $data;
}

}
13 changes: 10 additions & 3 deletions src/Components/CardComponent.php
Expand Up @@ -10,13 +10,21 @@
class CardComponent
{
public ?string $image;

public ?string $icon;

public ?int $h;

public ?string $alt;

public ?string $body;

public ?string $title;

public ?string $footer;

public ?string $text;

public ?array $links;

#[PreMount]
Expand All @@ -33,10 +41,9 @@ public function preMount(array $data): array
'footer' => null,
'text' => null,
'links' => null,
'h' => null
]);
'h' => null,
]);

return $resolver->resolve($data);
}

}
7 changes: 5 additions & 2 deletions src/Components/DividerComponent.php
Expand Up @@ -11,8 +11,11 @@
class DividerComponent
{
public ?string $alignment;

public ?string $color;

public ?string $message;

public ?string $style;

#[PreMount]
Expand All @@ -24,9 +27,9 @@ public function preMount(array $data): array
'alignment' => null,
'color' => null,
'style' => null, // solid
'message' => null]);
'message' => null,
]);

return $resolver->resolve($data);
}

}
54 changes: 54 additions & 0 deletions src/Components/LinkComponent.php
@@ -0,0 +1,54 @@
<?php

namespace Survos\BootstrapBundle\Components;

use Survos\BootstrapBundle\Service\ContextService;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
use Symfony\UX\TwigComponent\Attribute\PreMount;

#[AsTwigComponent('link', template: '@SurvosBootstrap/components/link.html.twig')]
class LinkComponent
{
public ?string $href;
public ?string $path;
public ?string $body;
public ?string $class;

public function __construct(private UrlGeneratorInterface $urlGenerator)
{

}

#[PreMount]
public function preMount(array $data): array
{
// validate data
$resolver = new OptionsResolver();
$resolver->setDefaults([
'href' => null,
'path' => null,
'body' => null, // what's inside the 'a' tag
'class' => null, // string or array
]);

//
if (empty($data['body'])) {
// could also say "add body or a body block
$data['body'] = json_encode($data);
}

// if the path doesn't exist, e.g. no homepage, use # (or don't generate the href?)
try {
$href = $this->urlGenerator->generate($data['path']);
} catch (RouteNotFoundException $exception) {
$href = '#';
}
$data['href'] = $href;


return $resolver->resolve($data);
}
}
3 changes: 1 addition & 2 deletions src/Components/MenuBreadcrumbComponent.php
Expand Up @@ -8,14 +8,13 @@
use Survos\BootstrapBundle\Event\KnpMenuEvent;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\String\Slugger\AsciiSlugger;
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
use Symfony\UX\TwigComponent\Attribute\ExposeInTemplate;
use Symfony\UX\TwigComponent\Attribute\PreMount;
use function Symfony\Component\String\u;
use Symfony\Component\String\Slugger\AsciiSlugger;

#[AsTwigComponent('menu_breadcrumb', template: '@SurvosBootstrap/components/menu_breadcrumb.html.twig')]
class MenuBreadcrumbComponent extends MenuComponent
{

}

0 comments on commit af39210

Please sign in to comment.