From 77ec9702573f7a08a9566364761791eb03a4749c Mon Sep 17 00:00:00 2001 From: iszmais Date: Wed, 3 Jul 2024 13:49:16 +0200 Subject: [PATCH] Add check and uncheck glyph --- .../UI/src/Component/Symbol/Glyph/Factory.php | 48 +++++++++++++++++++ .../Component/Symbol/Glyph/Factory.php | 17 +++++++ .../src/examples/Symbol/Glyph/Check/check.php | 38 +++++++++++++++ .../examples/Symbol/Glyph/Uncheck/uncheck.php | 38 +++++++++++++++ 4 files changed, 141 insertions(+) create mode 100644 components/ILIAS/UI/src/examples/Symbol/Glyph/Check/check.php create mode 100644 components/ILIAS/UI/src/examples/Symbol/Glyph/Uncheck/uncheck.php diff --git a/components/ILIAS/UI/src/Component/Symbol/Glyph/Factory.php b/components/ILIAS/UI/src/Component/Symbol/Glyph/Factory.php index 6a2ad6a07b92..1cef1b013acc 100755 --- a/components/ILIAS/UI/src/Component/Symbol/Glyph/Factory.php +++ b/components/ILIAS/UI/src/Component/Symbol/Glyph/Factory.php @@ -1460,4 +1460,52 @@ public function link(string $action = null): Glyph; * @return \ILIAS\UI\Component\Symbol\Glyph\Glyph */ public function launch(string $action = null): Glyph; + + /** + * --- + * description: + * purpose: > + * The Check Glyph indicates a positive status (e.g. approved/complete/ok/yes/finished/passed) + * composition: > + * The Check Glyph uses a checkmark. + * context: + * - The Check Glyph can be used in combination with the Uncheck Glyph to display binary states. + * rules: + * accessibility: + * 1: > + * The aria-label MUST be 'check'. + * style: + * 1: > + * The Check Glyph SHOULD display a checkmark in the geometric focus of a mono-colored symmetric shape + * usage: + * 1: > + * The Check Glyph SHOULD be used to display a unary state or one option of a binary state. + * --- + * @return \ILIAS\UI\Component\Symbol\Glyph\Glyph + */ + public function check(): Glyph; + + /** + * --- + * description: + * purpose: > + * The Uncheck Glyph indicates a negative status (e.g. disapproved/blocked/no/failed/rejected) + * composition: > + * The Check Glyph uses a diagonal cross. + * context: + * - The Uncheck Glyph can be used in combination with the Check Glyph to display binary states. + * rules: + * accessibility: + * 1: > + * The aria-label MUST be 'uncheck'. + * style: + * 1: > + * The uncheck Glyph SHOULD display a symmetric diagonal cross in the geometric focus of a mono-colored symmetric shape + * usage: + * 1: > + * The Uncheck Glyph SHOULD be used to display a unary state or one option of a binary state. + * --- + * @return \ILIAS\UI\Component\Symbol\Glyph\Glyph + */ + public function uncheck(): Glyph; } diff --git a/components/ILIAS/UI/src/Implementation/Component/Symbol/Glyph/Factory.php b/components/ILIAS/UI/src/Implementation/Component/Symbol/Glyph/Factory.php index 6b1491d49242..081a51799cec 100755 --- a/components/ILIAS/UI/src/Implementation/Component/Symbol/Glyph/Factory.php +++ b/components/ILIAS/UI/src/Implementation/Component/Symbol/Glyph/Factory.php @@ -21,6 +21,7 @@ namespace ILIAS\UI\Implementation\Component\Symbol\Glyph; use ILIAS\UI\Component\Symbol\Glyph as G; +use ILIAS\UI\NotImplementedException; class Factory implements G\Factory { @@ -432,4 +433,20 @@ public function launch(string $action = null): G\Glyph { return new Glyph(G\Glyph::LAUNCH, "launch", $action); } + + /** + * @inheritdoc + */ + public function check(): G\Glyph + { + throw new NotImplementedException(); + } + + /** + * @inheritdoc + */ + public function uncheck(): G\Glyph + { + throw new NotImplementedException(); + } } diff --git a/components/ILIAS/UI/src/examples/Symbol/Glyph/Check/check.php b/components/ILIAS/UI/src/examples/Symbol/Glyph/Check/check.php new file mode 100644 index 000000000000..614456ded28d --- /dev/null +++ b/components/ILIAS/UI/src/examples/Symbol/Glyph/Check/check.php @@ -0,0 +1,38 @@ +ui()->factory(); + $renderer = $DIC->ui()->renderer(); + + $glyph = $f->symbol()->glyph()->check(); + + //Showcase the various states of this Glyph + $list = $f->listing()->descriptive([ + "Active" => $glyph, + "Inactive" => $glyph->withUnavailableAction(), + "Highlighted" => $glyph->withHighlight() + ]); + + return $renderer->render($list); +} diff --git a/components/ILIAS/UI/src/examples/Symbol/Glyph/Uncheck/uncheck.php b/components/ILIAS/UI/src/examples/Symbol/Glyph/Uncheck/uncheck.php new file mode 100644 index 000000000000..4545cb7f5aa1 --- /dev/null +++ b/components/ILIAS/UI/src/examples/Symbol/Glyph/Uncheck/uncheck.php @@ -0,0 +1,38 @@ +ui()->factory(); + $renderer = $DIC->ui()->renderer(); + + $glyph = $f->symbol()->glyph()->uncheck(); + + //Showcase the various states of this Glyph + $list = $f->listing()->descriptive([ + "Active" => $glyph, + "Inactive" => $glyph->withUnavailableAction(), + "Highlighted" => $glyph->withHighlight() + ]); + + return $renderer->render($list); +}