@gov-cy/govcy-frontend-renderer 1.27.1 → 1.28.1

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
@@ -20,7 +20,7 @@ Though the project is not intended to be used for production purposes and does p
20
20
 
21
21
  The project uses [nunjucks](https://mozilla.github.io/nunjucks/) templates to built the html.
22
22
 
23
- The package currently works with the **version 3.2.0** of the design system.
23
+ The package currently works with the **version 3.3.0** of the design system.
24
24
 
25
25
  ## Features
26
26
 
@@ -167,7 +167,7 @@ frame.set("key", l_key);
167
167
  frame.set("lang", l_lang);
168
168
  frame.set("isHTML", l_isHTML);
169
169
  var t_22 = "";var t_23;
170
- t_23 = {"backLink_back": {"el": "Πίσω","en": "Back"},"common_or": {"el": "Ή","en": "Or"},"common_and": {"el": "Και","en": "And"},"common_entry": {"en": "Entry","el": "Καταχώρηση"},"common_entries": {"en": "Entries","el": "Καταχωρήσεις"},"dateInput_dayLabel": {"el": "Μέρα","en": "Day"},"dateInput_monthLabel": {"el": "Μήνας","en": "Month"},"dateInput_yearLabel": {"el": "Χρόνος","en": "Year"},"dateInput_monthValue1": {"en": "January","el": "Ιανουάριος"},"dateInput_monthValue2": {"en": "February","el": "Φεβρουάριος"},"dateInput_monthValue3": {"en": "March","el": "Μάρτιος"},"dateInput_monthValue4": {"en": "April","el": "Απρίλιος"},"dateInput_monthValue5": {"en": "May","el": "Μάϊος"},"dateInput_monthValue6": {"en": "June","el": "Ιούνιος"},"dateInput_monthValue7": {"en": "July","el": "Ιούλιος"},"dateInput_monthValue8": {"en": "August","el": "Αύγουστος"},"dateInput_monthValue9": {"en": "September","el": "Σεπτέμβριος"},"dateInput_monthValue10": {"en": "October","el": "Οκτώβριος"},"dateInput_monthValue11": {"en": "November","el": "Νοέμβριος"},"dateInput_monthValue12": {"en": "December","el": "Δεκέμβριος"},"errorMessage_hiddenError": {"en": "Error","el": "Σφάλμα"},"errorSummary_header": {"en": "There is a problem","el": "Υπάρχει πρόβλημα"},"header_menu": {"en": "Menu","el": "Μενού"},"header_mainMenuAria": {"en": "Main menu","el": "Κύριο μενού"},"fileView_view": {"en": "View","el": "Προβολή"},"fileView_delete": {"en": "Delete","el": "Διαγραφή"},"progressList_completedLabel": {"en": "Completed","el": "Ολοκληρώθηκε"},"progressList_notCompletedLabel": {"en": "Not completed","el": "Δεν ολοκληρώθηκε"},"progressList_stepLabel": {"en": "Step","el": "Βήμα"},"progressList_ofLabel": {"en": "of","el": "από"},"radios_conditionalLabel": {"en": "This option expands and has more questions,","el": "Αυτή η επιλογή επεκτείνεται και έχει περισσότερες ερωτήσεις,"},"stepByStepStatic_step": {"en": "Step","el": "Βήμα"},"taskList_withStatus": {"en": "with status ","el": "με κατάσταση "},"textArea_charRemaining": {"en": "You have <span></span> characters remaining","el": "Έχετε <span></span> χαρακτήρες που απομένουν"},"textArea_charExceeding": {"en": "You have entered <span></span> characters more","el": "Έχετε περάσει <span></span> χαρακτήρες περισσότερους"},"textArea_wordRemaining": {"en": "You have <span></span> words remaining","el": "Έχετε <span></span> λέξεις που απομένουν"},"textArea_wordsExceeding": {"en": "You have entered <span></span> words more","el": "Έχετε περάσει <span></span> λέξεις περισσότερες"},"userName_signOut": {"en": "Sign out","el": "Αποσύνδεση"},"userName_fromUser": {"en": "from user","el": "από το χρήστη"},"warning": {"en": "Warning","el": "Προσοχή"}};
170
+ t_23 = {"empty_text": {"en": "","el": ""},"backLink_back": {"el": "Πίσω","en": "Back"},"common_or": {"el": "Ή","en": "Or"},"common_and": {"el": "Και","en": "And"},"common_entry": {"en": "Entry","el": "Καταχώρηση"},"common_entries": {"en": "Entries","el": "Καταχωρήσεις"},"dateInput_dayLabel": {"el": "Μέρα","en": "Day"},"dateInput_monthLabel": {"el": "Μήνας","en": "Month"},"dateInput_yearLabel": {"el": "Χρόνος","en": "Year"},"dateInput_monthValue1": {"en": "January","el": "Ιανουάριος"},"dateInput_monthValue2": {"en": "February","el": "Φεβρουάριος"},"dateInput_monthValue3": {"en": "March","el": "Μάρτιος"},"dateInput_monthValue4": {"en": "April","el": "Απρίλιος"},"dateInput_monthValue5": {"en": "May","el": "Μάϊος"},"dateInput_monthValue6": {"en": "June","el": "Ιούνιος"},"dateInput_monthValue7": {"en": "July","el": "Ιούλιος"},"dateInput_monthValue8": {"en": "August","el": "Αύγουστος"},"dateInput_monthValue9": {"en": "September","el": "Σεπτέμβριος"},"dateInput_monthValue10": {"en": "October","el": "Οκτώβριος"},"dateInput_monthValue11": {"en": "November","el": "Νοέμβριος"},"dateInput_monthValue12": {"en": "December","el": "Δεκέμβριος"},"errorMessage_hiddenError": {"en": "Error","el": "Σφάλμα"},"errorSummary_header": {"en": "There is a problem","el": "Υπάρχει πρόβλημα"},"header_menu": {"en": "Menu","el": "Μενού"},"header_mainMenuAria": {"en": "Main menu","el": "Κύριο μενού"},"fileView_view": {"en": "View","el": "Προβολή"},"fileView_delete": {"en": "Delete","el": "Διαγραφή"},"progressList_completedLabel": {"en": "Completed","el": "Ολοκληρώθηκε"},"progressList_notCompletedLabel": {"en": "Not completed","el": "Δεν ολοκληρώθηκε"},"progressList_stepLabel": {"en": "Step","el": "Βήμα"},"progressList_ofLabel": {"en": "of","el": "από"},"radios_conditionalLabel": {"en": "This option expands and has more questions,","el": "Αυτή η επιλογή επεκτείνεται και έχει περισσότερες ερωτήσεις,"},"stepByStepStatic_step": {"en": "Step","el": "Βήμα"},"share_share": {"en": "Share","el": "Share (κοινή χρήση)"},"share_sms": {"en": "SMS","el": "SMS"},"share_email": {"en": "Email","el": "Email"},"share_preview": {"en": "Notification content","el": "Περιεχόμενο ειδοποίησης"},"share_copy": {"en": "Copy","el": "Αντιγραφή"},"share_copySuccess": {"en": "Copied","el": "Αντιγράφηκε"},"taskList_withStatus": {"en": "with status ","el": "με κατάσταση "},"textArea_charRemaining": {"en": "You have <span></span> characters remaining","el": "Έχετε <span></span> χαρακτήρες που απομένουν"},"textArea_charExceeding": {"en": "You have entered <span></span> characters more","el": "Έχετε περάσει <span></span> χαρακτήρες περισσότερους"},"textArea_wordRemaining": {"en": "You have <span></span> words remaining","el": "Έχετε <span></span> λέξεις που απομένουν"},"textArea_wordsExceeding": {"en": "You have entered <span></span> words more","el": "Έχετε περάσει <span></span> λέξεις περισσότερες"},"userName_signOut": {"en": "Sign out","el": "Αποσύνδεση"},"userName_fromUser": {"en": "from user","el": "από το χρήστη"},"warning": {"en": "Warning","el": "Προσοχή"}};
171
171
  frame.set("govcyContent", t_23, true);
172
172
  if(frame.topLevel) {
173
173
  context.setVariable("govcyContent", t_23);
@@ -5305,6 +5305,285 @@ root: root
5305
5305
  })();
5306
5306
  })();
5307
5307
 
5308
+ (function() {(window.nunjucksPrecompiled = window.nunjucksPrecompiled || {})["elements/share.njk"] = (function() {
5309
+ function root(env, context, frame, runtime, cb) {
5310
+ var lineno = 0;
5311
+ var colno = 0;
5312
+ var output = "";
5313
+ try {
5314
+ var parentTemplate = null;
5315
+ output += "\n";
5316
+ var macro_t_1 = runtime.makeMacro(
5317
+ ["params"],
5318
+ [],
5319
+ function (l_params, kwargs) {
5320
+ var callerFrame = frame;
5321
+ frame = new runtime.Frame();
5322
+ kwargs = kwargs || {};
5323
+ if (Object.prototype.hasOwnProperty.call(kwargs, "caller")) {
5324
+ frame.set("caller", kwargs.caller); }
5325
+ frame.set("params", l_params);
5326
+ var t_2 = "";env.getTemplate("utilities/govcyUtilities.njk", false, "elements/share.njk", false, function(t_4,t_3) {
5327
+ if(t_4) { cb(t_4); return; }
5328
+ t_3.getExported(function(t_5,t_3) {
5329
+ if(t_5) { cb(t_5); return; }
5330
+ if(Object.prototype.hasOwnProperty.call(t_3, "govcyLocalizeContent")) {
5331
+ var t_6 = t_3.govcyLocalizeContent;
5332
+ } else {
5333
+ cb(new Error("cannot import 'govcyLocalizeContent'")); return;
5334
+ }
5335
+ context.setVariable("govcyLocalizeContent", t_6);
5336
+ if(Object.prototype.hasOwnProperty.call(t_3, "govcyLangAttribute")) {
5337
+ var t_7 = t_3.govcyLangAttribute;
5338
+ } else {
5339
+ cb(new Error("cannot import 'govcyLangAttribute'")); return;
5340
+ }
5341
+ context.setVariable("govcyLangAttribute", t_7);
5342
+ if(Object.prototype.hasOwnProperty.call(t_3, "govcyGetContent")) {
5343
+ var t_8 = t_3.govcyGetContent;
5344
+ } else {
5345
+ cb(new Error("cannot import 'govcyGetContent'")); return;
5346
+ }
5347
+ context.setVariable("govcyGetContent", t_8);
5348
+ if(runtime.memberLookup((l_params),"text")) {
5349
+ var t_9;
5350
+ t_9 = (lineno = 20, colno = 39, runtime.callWrap(t_6, "govcyLocalizeContent", context, [runtime.memberLookup((l_params),"text"),runtime.memberLookup((l_params),"lang")]));
5351
+ frame.set("text", t_9, true);
5352
+ if(frame.topLevel) {
5353
+ context.setVariable("text", t_9);
5354
+ }
5355
+ if(frame.topLevel) {
5356
+ context.addExport("text", t_9);
5357
+ }
5358
+ if(runtime.contextOrFrameLookup(context, frame, "text")) {
5359
+ var t_10;
5360
+ t_10 = env.getFilter("default").call(context, runtime.memberLookup((l_params),"hasShare"),true);
5361
+ frame.set("hasShare", t_10, true);
5362
+ if(frame.topLevel) {
5363
+ context.setVariable("hasShare", t_10);
5364
+ }
5365
+ if(frame.topLevel) {
5366
+ context.addExport("hasShare", t_10);
5367
+ }
5368
+ var t_11;
5369
+ t_11 = env.getFilter("default").call(context, runtime.memberLookup((l_params),"hasSms"),true);
5370
+ frame.set("hasSms", t_11, true);
5371
+ if(frame.topLevel) {
5372
+ context.setVariable("hasSms", t_11);
5373
+ }
5374
+ if(frame.topLevel) {
5375
+ context.addExport("hasSms", t_11);
5376
+ }
5377
+ var t_12;
5378
+ t_12 = env.getFilter("default").call(context, runtime.memberLookup((l_params),"hasEmail"),true);
5379
+ frame.set("hasEmail", t_12, true);
5380
+ if(frame.topLevel) {
5381
+ context.setVariable("hasEmail", t_12);
5382
+ }
5383
+ if(frame.topLevel) {
5384
+ context.addExport("hasEmail", t_12);
5385
+ }
5386
+ var t_13;
5387
+ t_13 = env.getFilter("default").call(context, runtime.memberLookup((l_params),"hasPreview"),true);
5388
+ frame.set("hasPreview", t_13, true);
5389
+ if(frame.topLevel) {
5390
+ context.setVariable("hasPreview", t_13);
5391
+ }
5392
+ if(frame.topLevel) {
5393
+ context.addExport("hasPreview", t_13);
5394
+ }
5395
+ var t_14;
5396
+ t_14 = env.getFilter("default").call(context, runtime.memberLookup((l_params),"hasCopy"),true);
5397
+ frame.set("hasCopy", t_14, true);
5398
+ if(frame.topLevel) {
5399
+ context.setVariable("hasCopy", t_14);
5400
+ }
5401
+ if(frame.topLevel) {
5402
+ context.addExport("hasCopy", t_14);
5403
+ }
5404
+ if(runtime.contextOrFrameLookup(context, frame, "hasShare") || runtime.contextOrFrameLookup(context, frame, "hasSms") || runtime.contextOrFrameLookup(context, frame, "hasEmail") || runtime.contextOrFrameLookup(context, frame, "hasPreview") || runtime.contextOrFrameLookup(context, frame, "hasCopy")) {
5405
+ var t_15;
5406
+ t_15 = (lineno = 30, colno = 48, runtime.callWrap(t_8, "govcyGetContent", context, ["share_share",runtime.memberLookup((l_params),"lang")]));
5407
+ frame.set("shareLabel", t_15, true);
5408
+ if(frame.topLevel) {
5409
+ context.setVariable("shareLabel", t_15);
5410
+ }
5411
+ if(frame.topLevel) {
5412
+ context.addExport("shareLabel", t_15);
5413
+ }
5414
+ var t_16;
5415
+ t_16 = (lineno = 31, colno = 46, runtime.callWrap(t_8, "govcyGetContent", context, ["share_sms",runtime.memberLookup((l_params),"lang")]));
5416
+ frame.set("smsLabel", t_16, true);
5417
+ if(frame.topLevel) {
5418
+ context.setVariable("smsLabel", t_16);
5419
+ }
5420
+ if(frame.topLevel) {
5421
+ context.addExport("smsLabel", t_16);
5422
+ }
5423
+ var t_17;
5424
+ t_17 = (lineno = 32, colno = 48, runtime.callWrap(t_8, "govcyGetContent", context, ["share_email",runtime.memberLookup((l_params),"lang")]));
5425
+ frame.set("emailLabel", t_17, true);
5426
+ if(frame.topLevel) {
5427
+ context.setVariable("emailLabel", t_17);
5428
+ }
5429
+ if(frame.topLevel) {
5430
+ context.addExport("emailLabel", t_17);
5431
+ }
5432
+ var t_18;
5433
+ t_18 = (runtime.memberLookup((l_params),"previewTitle")?(lineno = 33, colno = 55, runtime.callWrap(t_6, "govcyLocalizeContent", context, [runtime.memberLookup((l_params),"previewTitle"),runtime.memberLookup((l_params),"lang")])):(lineno = 33, colno = 133, runtime.callWrap(t_8, "govcyGetContent", context, ["share_preview",runtime.memberLookup((l_params),"lang")])));
5434
+ frame.set("previewLabel", t_18, true);
5435
+ if(frame.topLevel) {
5436
+ context.setVariable("previewLabel", t_18);
5437
+ }
5438
+ if(frame.topLevel) {
5439
+ context.addExport("previewLabel", t_18);
5440
+ }
5441
+ var t_19;
5442
+ t_19 = (lineno = 34, colno = 47, runtime.callWrap(t_8, "govcyGetContent", context, ["share_copy",runtime.memberLookup((l_params),"lang")]));
5443
+ frame.set("copyLabel", t_19, true);
5444
+ if(frame.topLevel) {
5445
+ context.setVariable("copyLabel", t_19);
5446
+ }
5447
+ if(frame.topLevel) {
5448
+ context.addExport("copyLabel", t_19);
5449
+ }
5450
+ var t_20;
5451
+ t_20 = (lineno = 35, colno = 49, runtime.callWrap(t_8, "govcyGetContent", context, ["share_copySuccess",runtime.memberLookup((l_params),"lang")]));
5452
+ frame.set("copySuccess", t_20, true);
5453
+ if(frame.topLevel) {
5454
+ context.setVariable("copySuccess", t_20);
5455
+ }
5456
+ if(frame.topLevel) {
5457
+ context.addExport("copySuccess", t_20);
5458
+ }
5459
+ var t_21;
5460
+ t_21 = (runtime.memberLookup((l_params),"title")?(lineno = 36, colno = 48, runtime.callWrap(t_6, "govcyLocalizeContent", context, [runtime.memberLookup((l_params),"title"),runtime.memberLookup((l_params),"lang")])):"");
5461
+ frame.set("title", t_21, true);
5462
+ if(frame.topLevel) {
5463
+ context.setVariable("title", t_21);
5464
+ }
5465
+ if(frame.topLevel) {
5466
+ context.addExport("title", t_21);
5467
+ }
5468
+ var t_22;
5469
+ t_22 = "";
5470
+ frame.set("resolvedUrl", t_22, true);
5471
+ if(frame.topLevel) {
5472
+ context.setVariable("resolvedUrl", t_22);
5473
+ }
5474
+ if(frame.topLevel) {
5475
+ context.addExport("resolvedUrl", t_22);
5476
+ }
5477
+ if(runtime.memberLookup((l_params),"url")) {
5478
+ var t_23;
5479
+ t_23 = (lineno = 40, colno = 58, runtime.callWrap(t_6, "govcyLocalizeContent", context, [runtime.memberLookup((l_params),"url"),runtime.memberLookup((l_params),"lang")]));
5480
+ frame.set("resolvedUrl", t_23, true);
5481
+ if(frame.topLevel) {
5482
+ context.setVariable("resolvedUrl", t_23);
5483
+ }
5484
+ if(frame.topLevel) {
5485
+ context.addExport("resolvedUrl", t_23);
5486
+ }
5487
+ ;
5488
+ }
5489
+ t_2 += "<div";
5490
+ if(runtime.memberLookup((l_params),"id")) {
5491
+ t_2 += " id=\"";
5492
+ t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"id"), env.opts.autoescape);
5493
+ t_2 += "\"";
5494
+ ;
5495
+ }
5496
+ t_2 += "\n class=\"govcy-share";
5497
+ if(runtime.memberLookup((l_params),"classes")) {
5498
+ t_2 += " ";
5499
+ t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"classes"), env.opts.autoescape);
5500
+ ;
5501
+ }
5502
+ t_2 += "\"\n data-govcy-share-title=\"";
5503
+ t_2 += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "title"), env.opts.autoescape);
5504
+ t_2 += "\"\n data-govcy-share-text=\"";
5505
+ t_2 += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "text"), env.opts.autoescape);
5506
+ t_2 += "\"\n data-govcy-share-url=\"";
5507
+ t_2 += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "resolvedUrl"), env.opts.autoescape);
5508
+ t_2 += "\"\n data-govcy-share-copy-success-message=\"";
5509
+ t_2 += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "copySuccess"), env.opts.autoescape);
5510
+ t_2 += "\"\n ";
5511
+ t_2 += runtime.suppressValue((lineno = 49, colno = 37, runtime.callWrap(t_7, "govcyLangAttribute", context, [runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
5512
+ t_2 += ">";
5513
+ if(runtime.contextOrFrameLookup(context, frame, "hasShare") || runtime.contextOrFrameLookup(context, frame, "hasSms") || runtime.contextOrFrameLookup(context, frame, "hasEmail")) {
5514
+ t_2 += "<ul class=\"govcy-list-unstyled govcy-share__list\">";
5515
+ if(runtime.contextOrFrameLookup(context, frame, "hasShare")) {
5516
+ t_2 += "<li class=\"govcy-mb-2 govcy-share__item\">\n <a tabindex=\"0\" role=\"button\" class=\"govcy-link-no-visited-state govcy-share__btn\">\n <svg aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" class=\"govcy-share__icon\" viewBox=\"0 0 16 16\">\n <path fill-rule=\"evenodd\" d=\"M3.5 6a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h9a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5h-2a.5.5 0 0 1 0-1h2A1.5 1.5 0 0 1 14 6.5v8a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 14.5v-8A1.5 1.5 0 0 1 3.5 5h2a.5.5 0 0 1 0 1z\"/>\n <path fill-rule=\"evenodd\" d=\"M7.646.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 1.707V10.5a.5.5 0 0 1-1 0V1.707L5.354 3.854a.5.5 0 1 1-.708-.708z\"/>\n </svg>\n ";
5517
+ t_2 += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "shareLabel"), env.opts.autoescape);
5518
+ t_2 += "\n </a>\n </li>";
5519
+ ;
5520
+ }
5521
+ if(runtime.contextOrFrameLookup(context, frame, "hasSms")) {
5522
+ t_2 += "<li class=\"govcy-mb-2 govcy-share__item\">\n <a role=\"button\" class=\"govcy-link-no-visited-state govcy-share__sms\" href=\"sms:?body=";
5523
+ t_2 += runtime.suppressValue(env.getFilter("urlencode").call(context, ("" + "" + runtime.contextOrFrameLookup(context, frame, "text"))), env.opts.autoescape);
5524
+ t_2 += "\">\n <svg aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" class=\"govcy-share__icon\" viewBox=\"0 0 16 16\">\n <path d=\"M2 1a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h9.586a2 2 0 0 1 1.414.586l2 2V2a1 1 0 0 0-1-1zm12-1a2 2 0 0 1 2 2v12.793a.5.5 0 0 1-.854.353l-2.853-2.853a1 1 0 0 0-.707-.293H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2z\"/>\n <path d=\"M3 3.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5M3 6a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9A.5.5 0 0 1 3 6m0 2.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5\"/>\n </svg>\n ";
5525
+ t_2 += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "smsLabel"), env.opts.autoescape);
5526
+ t_2 += "\n </a>\n </li>";
5527
+ ;
5528
+ }
5529
+ if(runtime.contextOrFrameLookup(context, frame, "hasEmail")) {
5530
+ t_2 += "<li class=\"govcy-mb-2 govcy-share__item\">\n <a role=\"button\" class=\"govcy-link-no-visited-state govcy-share__email\" href=\"mailto:?subject=";
5531
+ t_2 += runtime.suppressValue(env.getFilter("urlencode").call(context, ("" + "" + runtime.contextOrFrameLookup(context, frame, "title"))), env.opts.autoescape);
5532
+ t_2 += "&body=";
5533
+ t_2 += runtime.suppressValue(env.getFilter("urlencode").call(context, ("" + "" + runtime.contextOrFrameLookup(context, frame, "text"))), env.opts.autoescape);
5534
+ t_2 += "\">\n <svg aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" class=\"govcy-share__icon\" viewBox=\"0 0 16 16\">\n <path d=\"M2 2a2 2 0 0 0-2 2v8.01A2 2 0 0 0 2 14h5.5a.5.5 0 0 0 0-1H2a1 1 0 0 1-.966-.741l5.64-3.471L8 9.583l7-4.2V8.5a.5.5 0 0 0 1 0V4a2 2 0 0 0-2-2zm3.708 6.208L1 11.105V5.383zM1 4.217V4a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v.217l-7 4.2z\"/>\n <path d=\"M14.247 14.269c1.01 0 1.587-.857 1.587-2.025v-.21C15.834 10.43 14.64 9 12.52 9h-.035C10.42 9 9 10.36 9 12.432v.214C9 14.82 10.438 16 12.358 16h.044c.594 0 1.018-.074 1.237-.175v-.73c-.245.11-.673.18-1.18.18h-.044c-1.334 0-2.571-.788-2.571-2.655v-.157c0-1.657 1.058-2.724 2.64-2.724h.04c1.535 0 2.484 1.05 2.484 2.326v.118c0 .975-.324 1.39-.639 1.39-.232 0-.41-.148-.41-.42v-2.19h-.906v.569h-.03c-.084-.298-.368-.63-.954-.63-.778 0-1.259.555-1.259 1.4v.528c0 .892.49 1.434 1.26 1.434.471 0 .896-.227 1.014-.643h.043c.118.42.617.648 1.12.648m-2.453-1.588v-.227c0-.546.227-.791.573-.791.297 0 .572.192.572.708v.367c0 .573-.253.744-.564.744-.354 0-.581-.215-.581-.8Z\"/>\n </svg>\n ";
5535
+ t_2 += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "emailLabel"), env.opts.autoescape);
5536
+ t_2 += "\n </a>\n </li>";
5537
+ ;
5538
+ }
5539
+ t_2 += "</ul>";
5540
+ ;
5541
+ }
5542
+ if(runtime.contextOrFrameLookup(context, frame, "hasPreview")) {
5543
+ t_2 += "<p class=\"govcy-fw-bolder\">";
5544
+ t_2 += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "previewLabel"), env.opts.autoescape);
5545
+ t_2 += "</p>\n <pre class=\"govcy-share__message\">";
5546
+ t_2 += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "text"), env.opts.autoescape);
5547
+ t_2 += "</pre>";
5548
+ ;
5549
+ }
5550
+ if(runtime.contextOrFrameLookup(context, frame, "hasCopy")) {
5551
+ t_2 += "<ul class=\"govcy-list-unstyled govcy-share__list\">\n <li class=\"govcy-mb-2 govcy-share__item\">\n <a tabindex=\"0\" role=\"button\" class=\"govcy-link-no-visited-state govcy-share__copy-btn\">\n <svg aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" class=\"govcy-share__icon\" viewBox=\"0 0 16 16\">\n <path fill-rule=\"evenodd\" d=\"M4 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2zm2-1a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1zM2 5a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-1h1v1a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h1v1z\"/>\n </svg>\n ";
5552
+ t_2 += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "copyLabel"), env.opts.autoescape);
5553
+ t_2 += "\n </a>\n </li>\n </ul>\n <div class=\"govcy-share__toast\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\"></div>";
5554
+ ;
5555
+ }
5556
+ t_2 += "</div>";
5557
+ ;
5558
+ }
5559
+ ;
5560
+ }
5561
+ ;
5562
+ }
5563
+ })});
5564
+ frame = callerFrame;
5565
+ return new runtime.SafeString(t_2);
5566
+ });
5567
+ context.addExport("share");
5568
+ context.setVariable("share", macro_t_1);
5569
+ output += "\n";
5570
+ if(parentTemplate) {
5571
+ parentTemplate.rootRenderFunc(env, context, frame, runtime, cb);
5572
+ } else {
5573
+ cb(null, output);
5574
+ }
5575
+ ;
5576
+ } catch (e) {
5577
+ cb(runtime.handleError(e, lineno, colno));
5578
+ }
5579
+ }
5580
+ return {
5581
+ root: root
5582
+ };
5583
+
5584
+ })();
5585
+ })();
5586
+
5308
5587
  (function() {(window.nunjucksPrecompiled = window.nunjucksPrecompiled || {})["elements/stepByStepStatic.njk"] = (function() {
5309
5588
  function root(env, context, frame, runtime, cb) {
5310
5589
  var lineno = 0;
@@ -7826,7 +8105,7 @@ var output = "";
7826
8105
  try {
7827
8106
  var parentTemplate = null;
7828
8107
  var t_1;
7829
- 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","userName","warning","multipleThingsTable","inset"];
8108
+ 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","userName","warning","share","multipleThingsTable","inset"];
7830
8109
  frame.set("macroSimpleBlocks", t_1, true);
7831
8110
  if(frame.topLevel) {
7832
8111
  context.setVariable("macroSimpleBlocks", t_1);
@@ -16556,6 +16556,13 @@ var GovcyFrontendRendererBrowser = (function () {
16556
16556
  parent.querySelectorAll('.govcy-radio-input').forEach((element) => {
16557
16557
  new GOVCY.ConditionalContactToggler(element);
16558
16558
  });
16559
+
16560
+ // Initialize Share
16561
+ if (typeof GOVCY.Share !== 'undefined') {
16562
+ parent.querySelectorAll('.govcy-share').forEach((element) => {
16563
+ new GOVCY.Share(element);
16564
+ });
16565
+ }
16559
16566
  }
16560
16567
  }
16561
16568
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gov-cy/govcy-frontend-renderer",
3
- "version": "1.27.1",
3
+ "version": "1.28.1",
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",
@@ -0,0 +1,109 @@
1
+ {# share
2
+ @param {string} id The id of the share component. Will escape text. Optional
3
+ @param {string} classes Additional classes to add to the share wrapper. Optional
4
+ @param {string} lang The language used. Can be 'en','el'. Optional.
5
+ @param {object} text The text to be shared. Required. Example `{en:"Content",el:"Περιεχόμενο"}`
6
+ @param {object|string} url The URL to be shared. Optional. Can be localized object `{en:"#",el:"#"}`
7
+ @param {object} title The title used in share actions. Optional. Example `{en:"Title",el:"Τίτλος"}`
8
+ @param {object} previewTitle The preview action label/title. Optional. Example `{en:"Preview",el:"Προεπισκόπηση"}`
9
+ @param {boolean} hasShare Whether to show native share action. Optional, default is true.
10
+ @param {boolean} hasSms Whether to show SMS action. Optional, default is true.
11
+ @param {boolean} hasEmail Whether to show email action. Optional, default is true.
12
+ @param {boolean} hasPreview Whether to show preview action. Optional, default is true.
13
+ @param {boolean} hasCopy Whether to show copy action. Optional, default is true.
14
+ @returns govcy share html
15
+ #}
16
+ {% macro share(params) -%}
17
+ {#- Import localizer from utilities -#}
18
+ {%- from "../utilities/govcyUtilities.njk" import govcyLocalizeContent, govcyLangAttribute, govcyGetContent -%}
19
+ {#- Required content and defaults -#}
20
+ {%- if params.text -%}
21
+ {%- set text = govcyLocalizeContent(params.text, params.lang) -%}
22
+ {%- if text -%}
23
+ {#- set default values -#}
24
+ {%- set hasShare = params.hasShare | default(true) -%}
25
+ {%- set hasSms = params.hasSms | default(true) -%}
26
+ {%- set hasEmail = params.hasEmail | default(true) -%}
27
+ {%- set hasPreview = params.hasPreview | default(true) -%}
28
+ {%- set hasCopy = params.hasCopy | default(true) -%}
29
+
30
+ {%- if hasShare or hasSms or hasEmail or hasPreview or hasCopy -%}
31
+ {%- set shareLabel = govcyGetContent('share_share', params.lang) -%}
32
+ {%- set smsLabel = govcyGetContent('share_sms', params.lang) -%}
33
+ {%- set emailLabel = govcyGetContent('share_email', params.lang) -%}
34
+ {%- set previewLabel = govcyLocalizeContent(params.previewTitle, params.lang) if params.previewTitle else govcyGetContent('share_preview', params.lang) -%}
35
+ {%- set copyLabel = govcyGetContent('share_copy', params.lang) -%}
36
+ {%- set copySuccess = govcyGetContent('share_copySuccess', params.lang) -%}
37
+ {%- set title = govcyLocalizeContent(params.title, params.lang) if params.title else '' -%}
38
+
39
+ {%- set resolvedUrl = '' -%}
40
+ {%- if params.url -%}
41
+ {%- set resolvedUrl = govcyLocalizeContent(params.url, params.lang) -%}
42
+ {%- endif -%}
43
+
44
+ <div{% if params.id %} id="{{ params.id }}"{% endif %}
45
+ class="govcy-share{% if params.classes %} {{ params.classes }}{% endif %}"
46
+ data-govcy-share-title="{{ title }}"
47
+ data-govcy-share-text="{{ text }}"
48
+ data-govcy-share-url="{{ resolvedUrl }}"
49
+ data-govcy-share-copy-success-message="{{ copySuccess }}"
50
+ {{ govcyLangAttribute(params.lang) }}>
51
+ {%- if hasShare or hasSms or hasEmail -%}
52
+ <ul class="govcy-list-unstyled govcy-share__list">
53
+ {%- if hasShare -%}
54
+ <li class="govcy-mb-2 govcy-share__item">
55
+ <a tabindex="0" role="button" class="govcy-link-no-visited-state govcy-share__btn">
56
+ <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="govcy-share__icon" viewBox="0 0 16 16">
57
+ <path fill-rule="evenodd" d="M3.5 6a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h9a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5h-2a.5.5 0 0 1 0-1h2A1.5 1.5 0 0 1 14 6.5v8a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 14.5v-8A1.5 1.5 0 0 1 3.5 5h2a.5.5 0 0 1 0 1z"/>
58
+ <path fill-rule="evenodd" d="M7.646.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 1.707V10.5a.5.5 0 0 1-1 0V1.707L5.354 3.854a.5.5 0 1 1-.708-.708z"/>
59
+ </svg>
60
+ {{ shareLabel }}
61
+ </a>
62
+ </li>
63
+ {%- endif -%}
64
+ {%- if hasSms -%}
65
+ <li class="govcy-mb-2 govcy-share__item">
66
+ <a role="button" class="govcy-link-no-visited-state govcy-share__sms" href="sms:?body={{ ('' ~ text) | urlencode }}">
67
+ <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="govcy-share__icon" viewBox="0 0 16 16">
68
+ <path d="M2 1a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h9.586a2 2 0 0 1 1.414.586l2 2V2a1 1 0 0 0-1-1zm12-1a2 2 0 0 1 2 2v12.793a.5.5 0 0 1-.854.353l-2.853-2.853a1 1 0 0 0-.707-.293H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2z"/>
69
+ <path d="M3 3.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5M3 6a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9A.5.5 0 0 1 3 6m0 2.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5"/>
70
+ </svg>
71
+ {{ smsLabel }}
72
+ </a>
73
+ </li>
74
+ {%- endif -%}
75
+ {%- if hasEmail -%}
76
+ <li class="govcy-mb-2 govcy-share__item">
77
+ <a role="button" class="govcy-link-no-visited-state govcy-share__email" href="mailto:?subject={{ ('' ~ title) | urlencode }}&body={{ ('' ~ text) | urlencode }}">
78
+ <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="govcy-share__icon" viewBox="0 0 16 16">
79
+ <path d="M2 2a2 2 0 0 0-2 2v8.01A2 2 0 0 0 2 14h5.5a.5.5 0 0 0 0-1H2a1 1 0 0 1-.966-.741l5.64-3.471L8 9.583l7-4.2V8.5a.5.5 0 0 0 1 0V4a2 2 0 0 0-2-2zm3.708 6.208L1 11.105V5.383zM1 4.217V4a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v.217l-7 4.2z"/>
80
+ <path d="M14.247 14.269c1.01 0 1.587-.857 1.587-2.025v-.21C15.834 10.43 14.64 9 12.52 9h-.035C10.42 9 9 10.36 9 12.432v.214C9 14.82 10.438 16 12.358 16h.044c.594 0 1.018-.074 1.237-.175v-.73c-.245.11-.673.18-1.18.18h-.044c-1.334 0-2.571-.788-2.571-2.655v-.157c0-1.657 1.058-2.724 2.64-2.724h.04c1.535 0 2.484 1.05 2.484 2.326v.118c0 .975-.324 1.39-.639 1.39-.232 0-.41-.148-.41-.42v-2.19h-.906v.569h-.03c-.084-.298-.368-.63-.954-.63-.778 0-1.259.555-1.259 1.4v.528c0 .892.49 1.434 1.26 1.434.471 0 .896-.227 1.014-.643h.043c.118.42.617.648 1.12.648m-2.453-1.588v-.227c0-.546.227-.791.573-.791.297 0 .572.192.572.708v.367c0 .573-.253.744-.564.744-.354 0-.581-.215-.581-.8Z"/>
81
+ </svg>
82
+ {{ emailLabel }}
83
+ </a>
84
+ </li>
85
+ {%- endif -%}
86
+ </ul>
87
+ {%- endif -%}
88
+ {%- if hasPreview -%}
89
+ <p class="govcy-fw-bolder">{{ previewLabel }}</p>
90
+ <pre class="govcy-share__message">{{ text }}</pre>
91
+ {%- endif -%}
92
+ {%- if hasCopy -%}
93
+ <ul class="govcy-list-unstyled govcy-share__list">
94
+ <li class="govcy-mb-2 govcy-share__item">
95
+ <a tabindex="0" role="button" class="govcy-link-no-visited-state govcy-share__copy-btn">
96
+ <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="govcy-share__icon" viewBox="0 0 16 16">
97
+ <path fill-rule="evenodd" d="M4 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2zm2-1a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1zM2 5a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-1h1v1a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h1v1z"/>
98
+ </svg>
99
+ {{ copyLabel }}
100
+ </a>
101
+ </li>
102
+ </ul>
103
+ <div class="govcy-share__toast" role="alert" aria-live="assertive" aria-atomic="true"></div>
104
+ {%- endif -%}
105
+ </div>
106
+ {%- endif -%}
107
+ {%- endif -%}
108
+ {%- endif -%}
109
+ {%- endmacro %}
@@ -26,7 +26,7 @@ To use:
26
26
  'errorMessage','select','textElement','htmlElement','textInput','radios','checkboxes',
27
27
  'fileInput','fileView','backLink','tag','table', 'summaryList', 'textArea','markdown',
28
28
  'panel', 'datePicker','dateInput', 'taskList', 'errorSummary', 'details', 'stepByStepStatic',
29
- 'progressList', 'userName', 'warning','multipleThingsTable', 'inset'] -%}
29
+ 'progressList', 'userName', 'warning','share','multipleThingsTable', 'inset'] -%}
30
30
  {%- set macroCallerBlocks = ['formControl','form','fieldset'] -%}
31
31
  {%- macro govcyElement(component, params) -%}
32
32
  {#- Simple blocks -#}
@@ -45,4 +45,4 @@ To use:
45
45
  {%- endcall -%}
46
46
  {%- endif -%}
47
47
  {%- endfor -%}
48
- {%- endmacro -%}
48
+ {%- endmacro -%}
@@ -39,6 +39,7 @@
39
39
  {% macro govcyGetContent(key, lang, isHTML) -%}
40
40
  {# Centralized multilingual content storage #}
41
41
  {%- set govcyContent = {
42
+ empty_text: {en:"",el:""},
42
43
  backLink_back: {el: "Πίσω", en: "Back"},
43
44
  common_or: {el: "Ή", en: "Or"},
44
45
  common_and: {el: "Και", en: "And"},
@@ -71,6 +72,12 @@
71
72
  progressList_ofLabel: {en:"of",el:"από"},
72
73
  radios_conditionalLabel: {en:"This option expands and has more questions,",el:"Αυτή η επιλογή επεκτείνεται και έχει περισσότερες ερωτήσεις,"},
73
74
  stepByStepStatic_step: {en:"Step",el:"Βήμα"},
75
+ share_share: {en:"Share",el:"Share (κοινή χρήση)"},
76
+ share_sms: {en:"SMS",el:"SMS"},
77
+ share_email: {en:"Email",el:"Email"},
78
+ share_preview: {en:"Notification content",el:"Περιεχόμενο ειδοποίησης"},
79
+ share_copy: {en:"Copy",el:"Αντιγραφή"},
80
+ share_copySuccess: {en:"Copied",el:"Αντιγράφηκε"},
74
81
  taskList_withStatus: {en:"with status ",el:"με κατάσταση "},
75
82
  textArea_charRemaining: {en:"You have <span></span> characters remaining",el:"Έχετε <span></span> χαρακτήρες που απομένουν"},
76
83
  textArea_charExceeding: {en:"You have entered <span></span> characters more",el:"Έχετε περάσει <span></span> χαρακτήρες περισσότερους"},