@gov-cy/govcy-frontend-renderer 1.10.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -67,6 +67,17 @@ const inputData =
67
67
  {
68
68
  "site" : {
69
69
  "lang" : "en",
70
+ "languages": [
71
+ {"code": "el", "label": "EL", "alt": "Ελληνική γλώσσα", "href": "?lang=el"},
72
+ {"code": "en", "label": "EN", "alt": "English language", "href": "?lang=en"}
73
+ ],
74
+ "footerLinks": [
75
+ {"label": {"en":"Privacy statement", "el":"Δήλωση απορρήτου"}, "href": "#"},
76
+ {"label": {"en":"Cookies", "el":"Cookies"}, "href": "#"},
77
+ {"label": {"en":"Accessibility", "el":"Προσβασιμότητα"}, "href": "#"},
78
+ {"label": {"en":"Help us improve this service", "el":"Βοηθήστε μας να βελτιώσουμε αυτή την υπηρεσία"}, "href": "#"}
79
+ ],
80
+ "menu" : {"en":"Menu", "el":"Μενου"},
70
81
  "title" : {"en":"Service title", "el":"Τιτλός υπηρεσίας"},
71
82
  "headerTitle" : {"en":"Header title", "el":"Τιτλός επικεφαλιδας"},
72
83
  "description" : {"en":"Service description", "el":"Περιγραφή υπηρεσίας"},
@@ -145,6 +156,17 @@ const inputData =
145
156
  {
146
157
  "site" : {
147
158
  "lang" : "en",
159
+ "languages": [
160
+ {"code": "el", "label": "EL", "alt": "Ελληνική γλώσσα", "href": "?lang=el"},
161
+ {"code": "en", "label": "EN", "alt": "English language", "href": "?lang=en"}
162
+ ],
163
+ "footerLinks": [
164
+ {"label": {"en":"Privacy statement", "el":"Δήλωση απορρήτου"}, "href": "#"},
165
+ {"label": {"en":"Cookies", "el":"Cookies"}, "href": "#"},
166
+ {"label": {"en":"Accessibility", "el":"Προσβασιμότητα"}, "href": "#"},
167
+ {"label": {"en":"Help us improve this service", "el":"Βοηθήστε μας να βελτιώσουμε αυτή την υπηρεσία"}, "href": "#"}
168
+ ],
169
+ "menu" : {"en":"Menu", "el":"Μενου"},
148
170
  "title" : {"en":"Service title", "el":"Τιτλός υπηρεσίας"},
149
171
  "headerTitle" : {"en":"Header title", "el":"Τιτλός επικεφαλιδας"},
150
172
  "description" : {"en":"Service description", "el":"Περιγραφή υπηρεσίας"},
@@ -279,6 +301,9 @@ In the examples above an `inputData` object is defined and it is used to pass th
279
301
  The `inputData` object has the following structure:
280
302
 
281
303
  - **site.lang**: the language of the site. It is used both in the `<html lang` attribute and to define the default language to be used by the individual design elements defined in the template.
304
+ - **site.languages**: the languages in the language menu.
305
+ - **site.footerLinks**: the links of the footer.
306
+ - **site.menu**: the menu label.
282
307
  - **site.title**: the title of the site. It is used in the `<title>`, `<meta property="og:title"` and `<meta property="twitter:title"` tags of the head.
283
308
  - **site.description**: the description of the site. It is used in the `<meta name="description"`, `<meta property="og:description"` and `<meta property="twitter:description"` tags of the head.
284
309
  - **site.url**: the URL of the site. It is used in the `<meta property="og:url"` and `<meta property="twitter:url"` tags of the head.
@@ -2634,6 +2634,12 @@ t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"id"), env.opts.aut
2634
2634
  t_2 += "\" ";
2635
2635
  ;
2636
2636
  }
2637
+ if(runtime.memberLookup((l_params),"method")) {
2638
+ t_2 += " method=\"";
2639
+ t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"method"), env.opts.autoescape);
2640
+ t_2 += "\" ";
2641
+ ;
2642
+ }
2637
2643
  t_2 += "action=\"";
2638
2644
  t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"action"), env.opts.autoescape);
2639
2645
  t_2 += "\" class=\"govcy-form";
@@ -2643,7 +2649,7 @@ t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"classes"), env.opt
2643
2649
  ;
2644
2650
  }
2645
2651
  t_2 += "\" novalidate=\"\">\n ";
2646
- t_2 += runtime.suppressValue((lineno = 13, colno = 13, runtime.callWrap(runtime.contextOrFrameLookup(context, frame, "caller"), "caller", context, [])), env.opts.autoescape);
2652
+ t_2 += runtime.suppressValue((lineno = 14, colno = 13, runtime.callWrap(runtime.contextOrFrameLookup(context, frame, "caller"), "caller", context, [])), env.opts.autoescape);
2647
2653
  if(runtime.memberLookup((l_params),"elements")) {
2648
2654
  env.getTemplate("govcyElement.njk", false, "elements/form.njk", false, function(t_4,t_3) {
2649
2655
  if(t_4) { cb(t_4); return; }
@@ -2669,7 +2675,7 @@ frame.set("loop.revindex0", t_8 - t_7 - 1);
2669
2675
  frame.set("loop.first", t_7 === 0);
2670
2676
  frame.set("loop.last", t_7 === t_8 - 1);
2671
2677
  frame.set("loop.length", t_8);
2672
- t_2 += runtime.suppressValue((lineno = 19, colno = 33, runtime.callWrap(t_6, "govcyElement", context, [runtime.memberLookup((t_10),"element"),runtime.memberLookup((t_10),"params"),runtime.makeKeywordArgs({"caller": (function (){var macro_t_11 = runtime.makeMacro(
2678
+ t_2 += runtime.suppressValue((lineno = 20, colno = 33, runtime.callWrap(t_6, "govcyElement", context, [runtime.memberLookup((t_10),"element"),runtime.memberLookup((t_10),"params"),runtime.makeKeywordArgs({"caller": (function (){var macro_t_11 = runtime.makeMacro(
2673
2679
  [],
2674
2680
  [],
2675
2681
  function (kwargs) {
@@ -3425,6 +3431,331 @@ root: root
3425
3431
  })();
3426
3432
  })();
3427
3433
 
3434
+ (function() {(window.nunjucksPrecompiled = window.nunjucksPrecompiled || {})["elements/progressList.njk"] = (function() {
3435
+ function root(env, context, frame, runtime, cb) {
3436
+ var lineno = 0;
3437
+ var colno = 0;
3438
+ var output = "";
3439
+ try {
3440
+ var parentTemplate = null;
3441
+ output += "\r\n";
3442
+ var macro_t_1 = runtime.makeMacro(
3443
+ ["params"],
3444
+ [],
3445
+ function (l_params, kwargs) {
3446
+ var callerFrame = frame;
3447
+ frame = new runtime.Frame();
3448
+ kwargs = kwargs || {};
3449
+ if (Object.prototype.hasOwnProperty.call(kwargs, "caller")) {
3450
+ frame.set("caller", kwargs.caller); }
3451
+ frame.set("params", l_params);
3452
+ var t_2 = "";env.getTemplate("utilities/govcyUtilities.njk", false, "elements/progressList.njk", false, function(t_4,t_3) {
3453
+ if(t_4) { cb(t_4); return; }
3454
+ t_3.getExported(function(t_5,t_3) {
3455
+ if(t_5) { cb(t_5); return; }
3456
+ if(Object.prototype.hasOwnProperty.call(t_3, "govcyLocalizeContent")) {
3457
+ var t_6 = t_3.govcyLocalizeContent;
3458
+ } else {
3459
+ cb(new Error("cannot import 'govcyLocalizeContent'")); return;
3460
+ }
3461
+ context.setVariable("govcyLocalizeContent", t_6);
3462
+ if(Object.prototype.hasOwnProperty.call(t_3, "govcyLangAttribute")) {
3463
+ var t_7 = t_3.govcyLangAttribute;
3464
+ } else {
3465
+ cb(new Error("cannot import 'govcyLangAttribute'")); return;
3466
+ }
3467
+ context.setVariable("govcyLangAttribute", t_7);
3468
+ var t_8;
3469
+ t_8 = env.getFilter("default").call(context, runtime.memberLookup((l_params),"showSteps"),false);
3470
+ frame.set("showSteps", t_8, true);
3471
+ if(frame.topLevel) {
3472
+ context.setVariable("showSteps", t_8);
3473
+ }
3474
+ if(frame.topLevel) {
3475
+ context.addExport("showSteps", t_8);
3476
+ }
3477
+ var t_9;
3478
+ t_9 = env.getFilter("int").call(context, runtime.memberLookup((l_params),"current"));
3479
+ frame.set("current", t_9, true);
3480
+ if(frame.topLevel) {
3481
+ context.setVariable("current", t_9);
3482
+ }
3483
+ if(frame.topLevel) {
3484
+ context.addExport("current", t_9);
3485
+ }
3486
+ var t_10;
3487
+ t_10 = env.getFilter("int").call(context, runtime.memberLookup((l_params),"total"));
3488
+ frame.set("total", t_10, true);
3489
+ if(frame.topLevel) {
3490
+ context.setVariable("total", t_10);
3491
+ }
3492
+ if(frame.topLevel) {
3493
+ context.addExport("total", t_10);
3494
+ }
3495
+ if(runtime.memberLookup((l_params),"completedLabel")) {
3496
+ var t_11;
3497
+ t_11 = (function() {
3498
+ var output = "";
3499
+ output += runtime.suppressValue((lineno = 30, colno = 55, runtime.callWrap(t_6, "govcyLocalizeContent", context, [runtime.memberLookup((l_params),"completedLabel"),runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
3500
+ ;
3501
+ return output;
3502
+ })()
3503
+ ;
3504
+ frame.set("completedLabel", t_11, true);
3505
+ if(frame.topLevel) {
3506
+ context.setVariable("completedLabel", t_11);
3507
+ }
3508
+ if(frame.topLevel) {
3509
+ context.addExport("completedLabel", t_11);
3510
+ }
3511
+ ;
3512
+ }
3513
+ else {
3514
+ var t_12;
3515
+ t_12 = (function() {
3516
+ var output = "";
3517
+ output += runtime.suppressValue((lineno = 32, colno = 55, runtime.callWrap(t_6, "govcyLocalizeContent", context, [{"en": "Completed","el": "Ολοκληρώθηκε"},runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
3518
+ ;
3519
+ return output;
3520
+ })()
3521
+ ;
3522
+ frame.set("completedLabel", t_12, true);
3523
+ if(frame.topLevel) {
3524
+ context.setVariable("completedLabel", t_12);
3525
+ }
3526
+ if(frame.topLevel) {
3527
+ context.addExport("completedLabel", t_12);
3528
+ }
3529
+ ;
3530
+ }
3531
+ if(runtime.memberLookup((l_params),"notCompletedLabel")) {
3532
+ var t_13;
3533
+ t_13 = (function() {
3534
+ var output = "";
3535
+ output += runtime.suppressValue((lineno = 36, colno = 58, runtime.callWrap(t_6, "govcyLocalizeContent", context, [runtime.memberLookup((l_params),"notCompletedLabel"),runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
3536
+ ;
3537
+ return output;
3538
+ })()
3539
+ ;
3540
+ frame.set("notCompletedLabel", t_13, true);
3541
+ if(frame.topLevel) {
3542
+ context.setVariable("notCompletedLabel", t_13);
3543
+ }
3544
+ if(frame.topLevel) {
3545
+ context.addExport("notCompletedLabel", t_13);
3546
+ }
3547
+ ;
3548
+ }
3549
+ else {
3550
+ var t_14;
3551
+ t_14 = (function() {
3552
+ var output = "";
3553
+ output += runtime.suppressValue((lineno = 38, colno = 58, runtime.callWrap(t_6, "govcyLocalizeContent", context, [{"en": "Not completed","el": "Δεν ολοκληρώθηκε"},runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
3554
+ ;
3555
+ return output;
3556
+ })()
3557
+ ;
3558
+ frame.set("notCompletedLabel", t_14, true);
3559
+ if(frame.topLevel) {
3560
+ context.setVariable("notCompletedLabel", t_14);
3561
+ }
3562
+ if(frame.topLevel) {
3563
+ context.addExport("notCompletedLabel", t_14);
3564
+ }
3565
+ ;
3566
+ }
3567
+ if(runtime.memberLookup((l_params),"stepLabel")) {
3568
+ var t_15;
3569
+ t_15 = (function() {
3570
+ var output = "";
3571
+ output += runtime.suppressValue((lineno = 42, colno = 50, runtime.callWrap(t_6, "govcyLocalizeContent", context, [runtime.memberLookup((l_params),"stepLabel"),runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
3572
+ ;
3573
+ return output;
3574
+ })()
3575
+ ;
3576
+ frame.set("stepLabel", t_15, true);
3577
+ if(frame.topLevel) {
3578
+ context.setVariable("stepLabel", t_15);
3579
+ }
3580
+ if(frame.topLevel) {
3581
+ context.addExport("stepLabel", t_15);
3582
+ }
3583
+ ;
3584
+ }
3585
+ else {
3586
+ var t_16;
3587
+ t_16 = (function() {
3588
+ var output = "";
3589
+ output += runtime.suppressValue((lineno = 44, colno = 50, runtime.callWrap(t_6, "govcyLocalizeContent", context, [{"en": "Step","el": "Βήμα"},runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
3590
+ ;
3591
+ return output;
3592
+ })()
3593
+ ;
3594
+ frame.set("stepLabel", t_16, true);
3595
+ if(frame.topLevel) {
3596
+ context.setVariable("stepLabel", t_16);
3597
+ }
3598
+ if(frame.topLevel) {
3599
+ context.addExport("stepLabel", t_16);
3600
+ }
3601
+ ;
3602
+ }
3603
+ if(runtime.memberLookup((l_params),"ofLabel")) {
3604
+ var t_17;
3605
+ t_17 = (function() {
3606
+ var output = "";
3607
+ output += runtime.suppressValue((lineno = 48, colno = 48, runtime.callWrap(t_6, "govcyLocalizeContent", context, [runtime.memberLookup((l_params),"ofLabel"),runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
3608
+ ;
3609
+ return output;
3610
+ })()
3611
+ ;
3612
+ frame.set("ofLabel", t_17, true);
3613
+ if(frame.topLevel) {
3614
+ context.setVariable("ofLabel", t_17);
3615
+ }
3616
+ if(frame.topLevel) {
3617
+ context.addExport("ofLabel", t_17);
3618
+ }
3619
+ ;
3620
+ }
3621
+ else {
3622
+ var t_18;
3623
+ t_18 = (function() {
3624
+ var output = "";
3625
+ output += runtime.suppressValue((lineno = 50, colno = 48, runtime.callWrap(t_6, "govcyLocalizeContent", context, [{"en": "of","el": "από"},runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
3626
+ ;
3627
+ return output;
3628
+ })()
3629
+ ;
3630
+ frame.set("ofLabel", t_18, true);
3631
+ if(frame.topLevel) {
3632
+ context.setVariable("ofLabel", t_18);
3633
+ }
3634
+ if(frame.topLevel) {
3635
+ context.addExport("ofLabel", t_18);
3636
+ }
3637
+ ;
3638
+ }
3639
+ if(runtime.contextOrFrameLookup(context, frame, "current") && runtime.contextOrFrameLookup(context, frame, "total")) {
3640
+ t_2 += "<style>\r\n.govcy-step-indicator {\r\n margin-left: 0px;\r\n margin-right: 0px;\r\n margin-bottom: .5rem !important;\r\n}\r\n.govcy-step-indicator__segments {\r\n display: flex;\r\n list-style: none;\r\n margin: 0px;\r\n padding: 0px;\r\n}\r\n\r\n.govcy-step-indicator__segment {\r\n flex: 1 1 0%;\r\n margin-left: 1px;\r\n margin-right: 1px;\r\n max-width: 15rem;\r\n min-height: 0.5rem;\r\n position: relative;\r\n}\r\n\r\n.govcy-step-indicator__segment::after {\r\n background-color: #A6A8AA;\r\n content: \"\";\r\n display: block;\r\n height: 0.5rem;\r\n left: 0px;\r\n position: absolute;\r\n right: 0px;\r\n top: 0px;\r\n}\r\n.govcy-step-indicator__segment--complete::after {\r\n background-color: #254355;\r\n}\r\n.govcy-step-indicator__segment--current::after {\r\n background-color: #1D70B8;\r\n}\r\n\r\n/* Label */\r\n.govcy-step-indicator__label {\r\n padding-left: 0.5rem;\r\n padding-right: 0.5rem;\r\n text-align: center;\r\n color: #6d6e70;\r\n line-height:1.1rem;\r\n margin-top: calc(0.75rem);\r\n}\r\n\r\n.govcy-step-indicator__segment--complete .govcy-step-indicator__label {\r\n color: #254355;\r\n}\r\n\r\n.govcy-step-indicator__segment--current .govcy-step-indicator__label {\r\n color: #1D70B8;\r\n font-weight: 700;\r\n}\r\n\r\n@media (min-width: 0px) {\r\n .govcy-step-indicator__counter {\r\n margin-bottom: .5rem !important;\r\n }\r\n .govcy-step-indicator__current-counter {\r\n width: 24px;\r\n height: 24px;\r\n border:1px solid #1D70B8;\r\n background: #1D70B8;\r\n color:#fff;\r\n border-radius: 9999px;\r\n font-weight: 600;\r\n display:inline-block;\r\n text-align:center;\r\n }\r\n /* Hide label on small screens */\r\n .govcy-step-indicator__label {\r\n display:none;\r\n }\r\n}\r\n@media (min-width: 768px) {\r\n .govcy-step-indicator__counter {\r\n font-size:20px;\r\n line-height:19px;\r\n margin-bottom: .5rem !important;\r\n }\r\n .govcy-step-indicator__current-counter {\r\n border-radius:9999px;\r\n border:1px solid #1D70B8;\r\n background: #1D70B8;\r\n color:#fff;\r\n padding:10px;\r\n line-height:19px;\r\n font-weight:600;\r\n font-size:20px;\r\n display:inline-block;\r\n width:40px;\r\n height:40px;\r\n text-align:center;\r\n }\r\n /* Show label on big screens */\r\n .govcy-step-indicator__label {\r\n display:block;\r\n }\r\n}\r\n</style>";
3641
+ if(runtime.contextOrFrameLookup(context, frame, "showSteps")) {
3642
+ t_2 += "\r\n <div ";
3643
+ if(runtime.memberLookup((l_params),"id")) {
3644
+ t_2 += "id=\"";
3645
+ t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"id"), env.opts.autoescape);
3646
+ t_2 += "\" ";
3647
+ ;
3648
+ }
3649
+ t_2 += "class=\"govcy-step-indicator";
3650
+ if(runtime.memberLookup((l_params),"classes")) {
3651
+ t_2 += " ";
3652
+ t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"classes"), env.opts.autoescape);
3653
+ ;
3654
+ }
3655
+ t_2 += "\"";
3656
+ t_2 += runtime.suppressValue((lineno = 160, colno = 167, runtime.callWrap(t_7, "govcyLangAttribute", context, [runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
3657
+ t_2 += ">\r\n <ol class=\"govcy-step-indicator__segments\">";
3658
+ frame = frame.push();
3659
+ var t_21 = (lineno = 162, colno = 26, runtime.callWrap(runtime.contextOrFrameLookup(context, frame, "range"), "range", context, [1,runtime.contextOrFrameLookup(context, frame, "total") + 1]));
3660
+ if(t_21) {t_21 = runtime.fromIterator(t_21);
3661
+ var t_20 = t_21.length;
3662
+ for(var t_19=0; t_19 < t_21.length; t_19++) {
3663
+ var t_22 = t_21[t_19];
3664
+ frame.set("i", t_22);
3665
+ frame.set("loop.index", t_19 + 1);
3666
+ frame.set("loop.index0", t_19);
3667
+ frame.set("loop.revindex", t_20 - t_19);
3668
+ frame.set("loop.revindex0", t_20 - t_19 - 1);
3669
+ frame.set("loop.first", t_19 === 0);
3670
+ frame.set("loop.last", t_19 === t_20 - 1);
3671
+ frame.set("loop.length", t_20);
3672
+ t_2 += "\r\n <li class=\"govcy-step-indicator__segment";
3673
+ if(t_22 < runtime.contextOrFrameLookup(context, frame, "current")) {
3674
+ t_2 += " govcy-step-indicator__segment--complete";
3675
+ ;
3676
+ }
3677
+ if(t_22 == runtime.contextOrFrameLookup(context, frame, "current")) {
3678
+ t_2 += " govcy-step-indicator__segment--current";
3679
+ ;
3680
+ }
3681
+ t_2 += "\"";
3682
+ if(t_22 == runtime.contextOrFrameLookup(context, frame, "current")) {
3683
+ t_2 += " aria-current=\"step\"";
3684
+ ;
3685
+ }
3686
+ t_2 += ">";
3687
+ if(runtime.memberLookup((l_params),"steps") && runtime.memberLookup((runtime.memberLookup((l_params),"steps")),t_22 - 1) && runtime.memberLookup((runtime.memberLookup((runtime.memberLookup((l_params),"steps")),t_22 - 1)),"text")) {
3688
+ t_2 += "<span class=\"govcy-step-indicator__label\">\r\n ";
3689
+ t_2 += runtime.suppressValue((lineno = 166, colno = 47, runtime.callWrap(t_6, "govcyLocalizeContent", context, [runtime.memberLookup((runtime.memberLookup((runtime.memberLookup((l_params),"steps")),t_22 - 1)),"text"),runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
3690
+ if(t_22 < runtime.contextOrFrameLookup(context, frame, "current")) {
3691
+ t_2 += "\r\n <span class=\"govcy-visually-hidden\">";
3692
+ t_2 += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "completedLabel"), env.opts.autoescape);
3693
+ t_2 += "</span>";
3694
+ ;
3695
+ }
3696
+ else {
3697
+ if(t_22 > runtime.contextOrFrameLookup(context, frame, "current")) {
3698
+ t_2 += "\r\n <span class=\"govcy-visually-hidden\">";
3699
+ t_2 += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "notCompletedLabel"), env.opts.autoescape);
3700
+ t_2 += "</span>";
3701
+ ;
3702
+ }
3703
+ ;
3704
+ }
3705
+ t_2 += "\r\n </span>";
3706
+ ;
3707
+ }
3708
+ t_2 += "\r\n </li>";
3709
+ ;
3710
+ }
3711
+ }
3712
+ frame = frame.pop();
3713
+ t_2 += "\r\n </ol>\r\n </div>";
3714
+ ;
3715
+ }
3716
+ t_2 += "\r\n <div ";
3717
+ if(runtime.memberLookup((l_params),"id")) {
3718
+ t_2 += "id=\"";
3719
+ t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"id"), env.opts.autoescape);
3720
+ t_2 += "-counter\" ";
3721
+ ;
3722
+ }
3723
+ t_2 += "class=\"govcy-step-indicator__counter\"";
3724
+ t_2 += runtime.suppressValue((lineno = 179, colno = 125, runtime.callWrap(t_7, "govcyLangAttribute", context, [runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
3725
+ t_2 += ">\r\n <span class=\"govcy-visually-hidden\">";
3726
+ t_2 += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "stepLabel"), env.opts.autoescape);
3727
+ t_2 += " </span>\r\n <span class=\"govcy-step-indicator__current-counter\">";
3728
+ t_2 += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "current"), env.opts.autoescape);
3729
+ t_2 += "</span> ";
3730
+ t_2 += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "ofLabel"), env.opts.autoescape);
3731
+ t_2 += " ";
3732
+ t_2 += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "total"), env.opts.autoescape);
3733
+ t_2 += "\r\n </div>";
3734
+ ;
3735
+ }
3736
+ })});
3737
+ frame = callerFrame;
3738
+ return new runtime.SafeString(t_2);
3739
+ });
3740
+ context.addExport("progressList");
3741
+ context.setVariable("progressList", macro_t_1);
3742
+ if(parentTemplate) {
3743
+ parentTemplate.rootRenderFunc(env, context, frame, runtime, cb);
3744
+ } else {
3745
+ cb(null, output);
3746
+ }
3747
+ ;
3748
+ } catch (e) {
3749
+ cb(runtime.handleError(e, lineno, colno));
3750
+ }
3751
+ }
3752
+ return {
3753
+ root: root
3754
+ };
3755
+
3756
+ })();
3757
+ })();
3758
+
3428
3759
  (function() {(window.nunjucksPrecompiled = window.nunjucksPrecompiled || {})["elements/radios.njk"] = (function() {
3429
3760
  function root(env, context, frame, runtime, cb) {
3430
3761
  var lineno = 0;
@@ -6132,7 +6463,7 @@ var t_8 = t_4.govcyLangAttribute;
6132
6463
  cb(new Error("cannot import 'govcyLangAttribute'")); return;
6133
6464
  }
6134
6465
  context.setVariable("govcyLangAttribute", t_8);
6135
- if(runtime.contextOrFrameLookup(context, frame, "textType") == "p" || runtime.contextOrFrameLookup(context, frame, "textType") == "h1" || runtime.contextOrFrameLookup(context, frame, "textType") == "h2" || runtime.contextOrFrameLookup(context, frame, "textType") == "h3" || runtime.contextOrFrameLookup(context, frame, "textType") == "h4") {
6466
+ if(runtime.contextOrFrameLookup(context, frame, "textType") == "p" || runtime.contextOrFrameLookup(context, frame, "textType") == "h1" || runtime.contextOrFrameLookup(context, frame, "textType") == "h2" || runtime.contextOrFrameLookup(context, frame, "textType") == "h3" || runtime.contextOrFrameLookup(context, frame, "textType") == "h4" || runtime.contextOrFrameLookup(context, frame, "textType") == "span") {
6136
6467
  var t_9;
6137
6468
  t_9 = runtime.contextOrFrameLookup(context, frame, "textType");
6138
6469
  frame.set("textTag", t_9, true);
@@ -6658,7 +6989,7 @@ var output = "";
6658
6989
  try {
6659
6990
  var parentTemplate = null;
6660
6991
  var t_1;
6661
- t_1 = ["label","legend","hint","button","errorMessage","select","textElement","htmlElement","textInput","radios","checkboxes","fileInput","fileView","backLink","tag","table","summaryList","textArea","markdown","panel","datePicker","dateInput","taskList","errorSummary","details","stepByStepStatic"];
6992
+ t_1 = ["label","legend","hint","button","errorMessage","select","textElement","htmlElement","textInput","radios","checkboxes","fileInput","fileView","backLink","tag","table","summaryList","textArea","markdown","panel","datePicker","dateInput","taskList","errorSummary","details","stepByStepStatic","progressList"];
6662
6993
  frame.set("macroSimpleBlocks", t_1, true);
6663
6994
  if(frame.topLevel) {
6664
6995
  context.setVariable("macroSimpleBlocks", t_1);
@@ -6706,7 +7037,7 @@ if(t_10) { cb(t_10); return; }
6706
7037
  t_9.getExported(function(t_11,t_9) {
6707
7038
  if(t_11) { cb(t_11); return; }
6708
7039
  frame.set("comp", t_9);
6709
- t_4 += runtime.suppressValue((lineno = 34, colno = 22, runtime.callWrap(runtime.memberLookup((t_9),t_8), "comp[\"c\"]", context, [l_params])), env.opts.autoescape);
7040
+ t_4 += runtime.suppressValue((lineno = 35, colno = 22, runtime.callWrap(runtime.memberLookup((t_9),t_8), "comp[\"c\"]", context, [l_params])), env.opts.autoescape);
6710
7041
  })});
6711
7042
  }
6712
7043
  ;
@@ -6733,7 +7064,7 @@ if(t_17) { cb(t_17); return; }
6733
7064
  t_16.getExported(function(t_18,t_16) {
6734
7065
  if(t_18) { cb(t_18); return; }
6735
7066
  frame.set("compm", t_16);
6736
- t_4 += runtime.suppressValue((lineno = 41, colno = 29, runtime.callWrap(runtime.memberLookup((t_16),t_15), "compm[\"c\"]", context, [l_params,runtime.makeKeywordArgs({"caller": (function (){var macro_t_19 = runtime.makeMacro(
7067
+ t_4 += runtime.suppressValue((lineno = 42, colno = 29, runtime.callWrap(runtime.memberLookup((t_16),t_15), "compm[\"c\"]", context, [l_params,runtime.makeKeywordArgs({"caller": (function (){var macro_t_19 = runtime.makeMacro(
6737
7068
  [],
6738
7069
  [],
6739
7070
  function (kwargs) {
@@ -6742,7 +7073,7 @@ frame = frame.push(true);
6742
7073
  kwargs = kwargs || {};
6743
7074
  if (Object.prototype.hasOwnProperty.call(kwargs, "caller")) {
6744
7075
  frame.set("caller", kwargs.caller); }
6745
- var t_20 = "";t_20 += runtime.suppressValue((lineno = 42, colno = 25, runtime.callWrap(runtime.contextOrFrameLookup(context, frame, "caller"), "caller", context, [])), env.opts.autoescape);
7076
+ var t_20 = "";t_20 += runtime.suppressValue((lineno = 43, colno = 25, runtime.callWrap(runtime.contextOrFrameLookup(context, frame, "caller"), "caller", context, [])), env.opts.autoescape);
6746
7077
  ;
6747
7078
  frame = frame.pop();
6748
7079
  return new runtime.SafeString(t_20);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gov-cy/govcy-frontend-renderer",
3
- "version": "1.10.0",
3
+ "version": "1.12.0",
4
4
  "description": "Render html for design elements of the Unified design system using njk or json template.",
5
5
  "author": "DMRID - DSF Team",
6
6
  "license": "MIT",
@@ -2,6 +2,7 @@
2
2
  @param {string} action. Will escape text
3
3
  @param {string} id The hint id. Will escape text
4
4
  @param {string} classes Additional classes to add to the outer div. Optional
5
+ @param {string} method The form method. Will escape text. Optional
5
6
  @param {array} elements If defined will be rendered elements inside the form.
6
7
  i.e. `[
7
8
  {element:"button",params:{text:{en:"Button 1",el:"Κουμπί 1"},lang:"en",id:"govcy-test-23b"} },
@@ -10,7 +11,7 @@
10
11
  @returns govcy form html
11
12
  #}
12
13
  {% macro form(params) -%}
13
- <form {% if params.id %}id="{{ params.id }}" {% endif %}action="{{ params.action }}" class="govcy-form{% if params.classes %} {{ params.classes }}{% endif %}" novalidate="">
14
+ <form {% if params.id %}id="{{ params.id }}" {% endif %}{% if params.method %} method="{{ params.method }}" {% endif %}action="{{ params.action }}" class="govcy-form{% if params.classes %} {{ params.classes }}{% endif %}" novalidate="">
14
15
  {{ caller() }}
15
16
  {#- if it has elements to be called -#}
16
17
  {%- if params.elements -%}
@@ -0,0 +1,185 @@
1
+ {# progressList
2
+ @param {string} lang The language used. Can be 'en','el'. Optional.
3
+ @param {int} current The current step number.
4
+ @param {int} total The total number of steps.
5
+ @param {array} labels if defined, will render the labels inside the progress list. Optional.
6
+ i.e. `[
7
+ {"text":{"en":"Step 1","el":"Βήμα 1"} },
8
+ {"text":{"en":"Step 2","el":"Βήμα 2"} },
9
+ {"text":{"en":"Step 3","el":"Βήμα 3"} },
10
+ {"text":{"en":"Step 4","el":"Βήμα 4"} },
11
+ {"text":{"en":"Step 5","el":"Βήμα 5"} }
12
+ ]`
13
+ @param {boolean} showSteps. Whether to show the steps or not. Optional, default is false. Can be true,false
14
+ @param {string} completedLabel The completed label text. Optional. Will escape text. Example `{en:"Completed",el:"Ολοκληρώθηκε"}`
15
+ @param {string} notCompletedLabel The not completed label text. Optional. Will escape text. Example `{en:"Not completed",el:"Δεν ολοκληρώθηκε"}`
16
+ @param {string} stepLabel The step label text. Optional. Will escape text. Example `{en:"Step",el:"Βήμα"}`
17
+ @param {string} ofLabel The of label text. Optional. Will escape text. Example `{en:"of",el:"από"}`
18
+ @param {string} id The label id. Will escape text
19
+ @param {string} classes Additional classes to add to the outer div. Optional
20
+ @returns govcy progressList html
21
+ #}
22
+ {% macro progressList(params) -%}
23
+ {#- Import localizer from utilities -#}
24
+ {%- from "../utilities/govcyUtilities.njk" import govcyLocalizeContent, govcyLangAttribute -%}
25
+ {#- set default values -#}
26
+ {%- set showSteps = params.showSteps | default(false) -%}
27
+ {%- set current = params.current | int -%}
28
+ {%- set total = params.total | int -%}
29
+ {#- set completed label -#}
30
+ {%- if params.completedLabel -%}
31
+ {%- set completedLabel -%} {{- govcyLocalizeContent(params.completedLabel, params.lang) -}}{%- endset -%}
32
+ {%- else -%}
33
+ {%- set completedLabel -%} {{- govcyLocalizeContent({en:"Completed",el:"Ολοκληρώθηκε"}, params.lang) -}}{%- endset -%}
34
+ {%- endif -%}
35
+ {#- set not completed label -#}
36
+ {%- if params.notCompletedLabel -%}
37
+ {%- set notCompletedLabel -%} {{- govcyLocalizeContent(params.notCompletedLabel, params.lang) -}}{%- endset -%}
38
+ {%- else -%}
39
+ {%- set notCompletedLabel -%} {{- govcyLocalizeContent({en:"Not completed",el:"Δεν ολοκληρώθηκε"}, params.lang) -}}{%- endset -%}
40
+ {%- endif -%}
41
+ {#- set step label -#}
42
+ {%- if params.stepLabel -%}
43
+ {%- set stepLabel -%} {{- govcyLocalizeContent(params.stepLabel, params.lang) -}}{%- endset -%}
44
+ {%- else -%}
45
+ {%- set stepLabel -%} {{- govcyLocalizeContent({en:"Step",el:"Βήμα"}, params.lang) -}}{%- endset -%}
46
+ {%- endif -%}
47
+ {#- set of label -#}
48
+ {%- if params.ofLabel -%}
49
+ {%- set ofLabel -%} {{- govcyLocalizeContent(params.ofLabel, params.lang) -}}{%- endset -%}
50
+ {%- else -%}
51
+ {%- set ofLabel -%} {{- govcyLocalizeContent({en:"of",el:"από"}, params.lang) -}}{%- endset -%}
52
+ {%- endif -%}
53
+ {#- current and total are mandatory -#}
54
+ {%- if current and total %}
55
+ {#- style to be removed after included in the UDS -#}
56
+ <style>
57
+ .govcy-step-indicator {
58
+ margin-left: 0px;
59
+ margin-right: 0px;
60
+ margin-bottom: .5rem !important;
61
+ }
62
+ .govcy-step-indicator__segments {
63
+ display: flex;
64
+ list-style: none;
65
+ margin: 0px;
66
+ padding: 0px;
67
+ }
68
+
69
+ .govcy-step-indicator__segment {
70
+ flex: 1 1 0%;
71
+ margin-left: 1px;
72
+ margin-right: 1px;
73
+ max-width: 15rem;
74
+ min-height: 0.5rem;
75
+ position: relative;
76
+ }
77
+
78
+ .govcy-step-indicator__segment::after {
79
+ background-color: #A6A8AA;
80
+ content: "";
81
+ display: block;
82
+ height: 0.5rem;
83
+ left: 0px;
84
+ position: absolute;
85
+ right: 0px;
86
+ top: 0px;
87
+ }
88
+ .govcy-step-indicator__segment--complete::after {
89
+ background-color: #254355;
90
+ }
91
+ .govcy-step-indicator__segment--current::after {
92
+ background-color: #1D70B8;
93
+ }
94
+
95
+ /* Label */
96
+ .govcy-step-indicator__label {
97
+ padding-left: 0.5rem;
98
+ padding-right: 0.5rem;
99
+ text-align: center;
100
+ color: #6d6e70;
101
+ line-height:1.1rem;
102
+ margin-top: calc(0.75rem);
103
+ }
104
+
105
+ .govcy-step-indicator__segment--complete .govcy-step-indicator__label {
106
+ color: #254355;
107
+ }
108
+
109
+ .govcy-step-indicator__segment--current .govcy-step-indicator__label {
110
+ color: #1D70B8;
111
+ font-weight: 700;
112
+ }
113
+
114
+ @media (min-width: 0px) {
115
+ .govcy-step-indicator__counter {
116
+ margin-bottom: .5rem !important;
117
+ }
118
+ .govcy-step-indicator__current-counter {
119
+ width: 24px;
120
+ height: 24px;
121
+ border:1px solid #1D70B8;
122
+ background: #1D70B8;
123
+ color:#fff;
124
+ border-radius: 9999px;
125
+ font-weight: 600;
126
+ display:inline-block;
127
+ text-align:center;
128
+ }
129
+ /* Hide label on small screens */
130
+ .govcy-step-indicator__label {
131
+ display:none;
132
+ }
133
+ }
134
+ @media (min-width: 768px) {
135
+ .govcy-step-indicator__counter {
136
+ font-size:20px;
137
+ line-height:19px;
138
+ margin-bottom: .5rem !important;
139
+ }
140
+ .govcy-step-indicator__current-counter {
141
+ border-radius:9999px;
142
+ border:1px solid #1D70B8;
143
+ background: #1D70B8;
144
+ color:#fff;
145
+ padding:10px;
146
+ line-height:19px;
147
+ font-weight:600;
148
+ font-size:20px;
149
+ display:inline-block;
150
+ width:40px;
151
+ height:40px;
152
+ text-align:center;
153
+ }
154
+ /* Show label on big screens */
155
+ .govcy-step-indicator__label {
156
+ display:block;
157
+ }
158
+ }
159
+ </style>
160
+ {%- if showSteps %}
161
+ <div {% if params.id %}id="{{ params.id }}" {% endif %}class="govcy-step-indicator{% if params.classes %} {{ params.classes }}{% endif %}"{{ govcyLangAttribute(params.lang) }}>
162
+ <ol class="govcy-step-indicator__segments">
163
+ {%- for i in range(1, total + 1) %}
164
+ <li class="govcy-step-indicator__segment{% if i < current %} govcy-step-indicator__segment--complete{% endif %}{% if i == current %} govcy-step-indicator__segment--current{% endif %}"{% if i == current %} aria-current="step"{% endif %}>
165
+ {%- if params.steps and params.steps[i - 1] and params.steps[i - 1].text -%}
166
+ <span class="govcy-step-indicator__label">
167
+ {{ govcyLocalizeContent(params.steps[i - 1].text, params.lang) }}
168
+ {%- if i < current %}
169
+ <span class="govcy-visually-hidden">{{ completedLabel }}</span>
170
+ {%- elif i > current %}
171
+ <span class="govcy-visually-hidden">{{ notCompletedLabel }}</span>
172
+ {%- endif %}
173
+ </span>
174
+ {%- endif %}
175
+ </li>
176
+ {%- endfor %}
177
+ </ol>
178
+ </div>
179
+ {%- endif %}
180
+ <div {% if params.id %}id="{{ params.id }}-counter" {% endif %}class="govcy-step-indicator__counter"{{ govcyLangAttribute(params.lang) }}>
181
+ <span class="govcy-visually-hidden">{{ stepLabel }} </span>
182
+ <span class="govcy-step-indicator__current-counter">{{ current }}</span> {{ ofLabel }} {{ total }}
183
+ </div>
184
+ {%- endif %}
185
+ {%- endmacro %}
@@ -1,7 +1,7 @@
1
1
  {# textElement
2
2
  @param {string} lang The language used. Can be 'en','el'. Optional.
3
3
  @param {object} text The text. Will escape text, Example `{en:"Content",el:"Περιεχομένο"}`
4
- @param {string} type The type of the element. Can be `p`,`h1`,`h2`,`h3`,`h4`. Default is `p`
4
+ @param {string} type The type of the element. Can be `p`,`h1`,`h2`,`h3`,`h4`,`span`. Default is `p`
5
5
  @param {string} id The elemen't id. Will escape text. Optional
6
6
  @param {string} classes Additional classes to add to the outer div. Optional
7
7
  @returns html Elements with sanitzed html
@@ -13,7 +13,7 @@
13
13
  {%- if params.text -%}
14
14
  {#- Import localizer from utilities -#}
15
15
  {%- from "../utilities/govcyUtilities.njk" import govcyLocalizeContent, govcyLangAttribute -%}
16
- {%- if textType == 'p' or textType == 'h1' or textType == 'h2' or textType == 'h3' or textType == 'h4' -%}
16
+ {%- if textType == 'p' or textType == 'h1' or textType == 'h2' or textType == 'h3' or textType == 'h4' or textType == 'span' -%}
17
17
  {%- set textTag = textType -%}
18
18
  <{{ textType }}{% if params.id %} id="{{ params.id }}"{% endif %}{% if params.classes %} class="{{ params.classes }}"{% endif %}{{ govcyLangAttribute(params.lang) }}>
19
19
  {{ govcyLocalizeContent(params.text, params.lang) }}
@@ -25,7 +25,8 @@ To use:
25
25
  {%- set macroSimpleBlocks = ['label', 'legend', 'hint', 'button',
26
26
  'errorMessage','select','textElement','htmlElement','textInput','radios','checkboxes',
27
27
  'fileInput','fileView','backLink','tag','table', 'summaryList', 'textArea','markdown',
28
- 'panel', 'datePicker','dateInput', 'taskList', 'errorSummary', 'details', 'stepByStepStatic'] -%}
28
+ 'panel', 'datePicker','dateInput', 'taskList', 'errorSummary', 'details', 'stepByStepStatic',
29
+ 'progressList'] -%}
29
30
  {%- set macroCallerBlocks = ['formControl','form','fieldset'] -%}
30
31
  {%- macro govcyElement(component, params) -%}
31
32
  {#- Simple blocks -#}
@@ -5,6 +5,18 @@ To use this template you need to pass the following data:
5
5
  {
6
6
  site: {
7
7
  "lang": "en",
8
+ "languages": [
9
+ {"code": "el", "label": "EL", "alt": "Ελληνική γλώσσα", "href": "?lang=el"},
10
+ {"code": "en", "label": "EN", "alt": "English language", "href": "?lang=en"},
11
+ {"code": "tr", "label": "TR", "alt": "Türkçe", "href": "?lang=tr"}
12
+ ],
13
+ "footerLinks": [
14
+ {"label": {"en":"Privacy statement", "el":"Δήλωση απορρήτου"}, "href": "#"},
15
+ {"label": {"en":"Cookies", "el":"Cookies"}, "href": "#"},
16
+ {"label": {"en":"Accessibility", "el":"Προσβασιμότητα"}, "href": "#"},
17
+ {"label": {"en":"Help us improve this service", "el":"Βοηθήστε μας να βελτιώσουμε αυτή την υπηρεσία"}, "href": "#"},
18
+ ],
19
+ "menu" : {"en":"Menu", "el":"Μενου"},
8
20
  "title" : {"en":"Service title", "el":"Τιτλός υπηρεσίας"},
9
21
  "headerTitle" : {"en":"Header title", "el":"Τιτλός επικεφαλιδας"},
10
22
  "description" : {"en":"Service description", "el":"Περιγραφή υπηρεσίας"},
@@ -83,9 +95,34 @@ To use this template you need to pass the following data:
83
95
  <a href="https://gov.cy" class="govcy-logo" title="Go to the gov.cy homepage"><img alt="gov.cy Logo"></a>
84
96
  <span class="govcy-service-name">{{ govcyLocalizeContent(site.headerTitle, site.lang) }}</span>
85
97
  </div>
98
+ {%- if site.languages -%}
99
+ <ul class="govcy-menu-items">
100
+ {%- for iLang in site.languages %}
101
+ <li class="govcy-desktop-menu-only"><span><a href="{{ iLang.href }}"
102
+ class="govcy-menu-item{% if iLang.code == site.lang %} active{% endif %}"
103
+ {% if iLang.code == site.lang %} aria-current="true"{% endif %}
104
+ aria-label="{{ iLang.alt }}" lang="{{ iLang.code }}">{{ iLang.label }}</a></span>
105
+ </li>{%- endfor %}
106
+ <li class="govcy-mobile-menu govcy-mobile-menu-only govcy-dropdown govcy-ms-auto"><span><a href="#" class="govcy-menu-item govcy-expand-btn">{{ govcyLocalizeContent(pageData.menu, site.lang) }}</a></span></li>
107
+ </ul>
108
+ {%- endif %}
86
109
  </div>
87
110
  </div>
88
111
  </div>
112
+
113
+ {%- if site.languages -%}
114
+ <div class="govcy-header-menu-area">
115
+ <nav class="govcy-mainmenu" aria-label="{{ govcyLocalizeContent(pageData.menu, site.lang) }}">
116
+ <div class="govcy-container">
117
+ <ul class="govcy-menu-items govcy-header-language-area govcy-mobile-menu-only">
118
+ {%- for iLang in site.languages %}
119
+ <li><a href="{{ iLang.href }}" class="govcy-menu-item{% if iLang.code == site.lang %} active{% endif %}" {% if iLang.code == site.lang %} aria-current="true"{% endif %} aria-label="{{ iLang.alt }}" lang="{{ iLang.code }}">{{ iLang.label }}</a></li>
120
+ {%- endfor %}
121
+ </ul>
122
+ </div>
123
+ </nav>
124
+ </div>
125
+ {%- endif %}
89
126
  {% endblock %}
90
127
  </header>
91
128
 
@@ -115,12 +152,13 @@ To use this template you need to pass the following data:
115
152
  <div class="govcy-container">
116
153
  <div class="govcy-d-flex govcy-justify-content-between govcy-align-items-end govcy-flex-wrap">
117
154
  <div class="govcy-my-4">
155
+ {%- if site.footerLinks %}
118
156
  <ul>
119
- <li><a href="#">Privacy statement</a></li>
120
- <li><a href="#">Cookies</a></li>
121
- <li><a href="#">Accessibility</a></li>
122
- <li><a href="#">Help us improve this service</a></li>
157
+ {%- for iLink in site.footerLinks %}
158
+ <li><a href="{{ iLink.href }}">{{ govcyLocalizeContent(iLink.label, site.lang) }}</a></li>
159
+ {%- endfor %}
123
160
  </ul>
161
+ {%- endif %}
124
162
  <div class="govcy-d-flex govcy-align-items-center govcy-flex-wrap">
125
163
  <span class="govcy-fs-2 govcy-fw-bold govcy-mr-6">gov.cy</span>
126
164
  <span class="govcy-mr-6 govcy-mt-2 govcy-mb-2">&copy; Republic of Cyprus, 2023</span>