katalyst-govuk-formbuilder 1.15.0 → 1.16.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e35e122751d75be5b004444f441afcb0e9b2fb9f0b7fd0b57de26bcc1fdb53a3
4
- data.tar.gz: 0c3b132a04a168fee176634f6c5143c4b9bcaf22e06055ddd1090fcd78afd9b6
3
+ metadata.gz: 66f84bbe719cc94f15b64188e046cdb6bbb2decf066b615c6a7adaa4a37d20c8
4
+ data.tar.gz: 58deb9615c2a6b69d1601dd6f88238c68660fa624ce9c5829cb6fc7bb8d2c0b7
5
5
  SHA512:
6
- metadata.gz: 68d745fec842ae2ca7dfe82bdaa7783e4c64e4ee28e68a15e1dbedc01b45b79d7892b8d94f396feeb6cd659ece8f1c32645b7b1cd6eacafa2aa9b3c8fc44c334
7
- data.tar.gz: 489d519d8f1b1354e8bac81c928fb654e68558e797e0f8a12d0a06f8738fe887dffe2fde6c20eef3109440403a73b5bb901fcd33405acbdbb4016a6123992705
6
+ metadata.gz: e1a9e9a42d38251a62d76c0c8a6f80f3af68be97c78a87d0ec969425aa7d8044a0d7d7a5581b0c8bb5d6ff2e175386e006efbcca9b04a56865e3337d3f4fd728
7
+ data.tar.gz: 110255497782e0824b1c86ab970bfce2699cc05253fd25fe1208aa401d13d95808cd7d9d123a0281e8601394e64c4d684e8171c6ab04f757422091a663e38d17
@@ -38,12 +38,15 @@
38
38
 
39
39
 
40
40
 
41
+
42
+
43
+
41
44
 
42
45
 
43
46
 
44
47
 
45
48
  :root {
46
- --govuk-frontend-version: "5.8.0";
49
+ --govuk-frontend-version: "5.9.0";
47
50
  --govuk-frontend-breakpoint-mobile: 20rem;
48
51
  --govuk-frontend-breakpoint-tablet: 40.0625rem;
49
52
  --govuk-frontend-breakpoint-desktop: 48.0625rem;
@@ -801,6 +804,9 @@
801
804
 
802
805
 
803
806
 
807
+
808
+
809
+
804
810
 
805
811
 
806
812
 
@@ -905,6 +911,9 @@
905
911
 
906
912
 
907
913
 
914
+
915
+
916
+
908
917
 
909
918
 
910
919
 
@@ -975,6 +984,9 @@
975
984
 
976
985
 
977
986
 
987
+
988
+
989
+
978
990
 
979
991
 
980
992
 
@@ -1167,6 +1179,9 @@
1167
1179
 
1168
1180
 
1169
1181
 
1182
+
1183
+
1184
+
1170
1185
 
1171
1186
 
1172
1187
 
@@ -1234,6 +1249,9 @@
1234
1249
 
1235
1250
 
1236
1251
 
1252
+
1253
+
1254
+
1237
1255
 
1238
1256
 
1239
1257
 
@@ -1303,6 +1321,9 @@
1303
1321
 
1304
1322
 
1305
1323
 
1324
+
1325
+
1326
+
1306
1327
 
1307
1328
 
1308
1329
 
@@ -2265,6 +2286,133 @@
2265
2286
  cursor: not-allowed;
2266
2287
  }
2267
2288
 
2289
+ .govuk-drop-zone {
2290
+ display: block;
2291
+ position: relative;
2292
+ z-index: 0;
2293
+ background-color: #ffffff;
2294
+ }
2295
+
2296
+ .govuk-drop-zone--disabled {
2297
+ cursor: not-allowed;
2298
+ }
2299
+
2300
+ .govuk-file-upload-button__pseudo-button {
2301
+ width: auto;
2302
+ margin-right: 10px;
2303
+ margin-bottom: 3px;
2304
+ flex-shrink: 0;
2305
+ }
2306
+
2307
+ .govuk-file-upload-button__instruction {
2308
+ margin-top: 7px;
2309
+ margin-bottom: 0;
2310
+ text-align: left;
2311
+ }
2312
+
2313
+ .govuk-file-upload-button__status {
2314
+ display: block;
2315
+ margin-bottom: 10px;
2316
+ padding: 15px 10px;
2317
+ background-color: #ffffff;
2318
+ text-align: left;
2319
+ }
2320
+
2321
+ .govuk-file-upload-button__pseudo-button-container {
2322
+ display: flex;
2323
+ align-items: baseline;
2324
+ flex-wrap: wrap;
2325
+ }
2326
+
2327
+ .govuk-file-upload-button {
2328
+ width: 100%;
2329
+ padding: 18px;
2330
+ border: 2px #b1b4b6 solid;
2331
+ background-color: #f3f2f1;
2332
+ cursor: pointer;
2333
+ }
2334
+ @media (min-width: 40.0625em) {
2335
+ .govuk-file-upload-button {
2336
+ padding: 23px;
2337
+ }
2338
+ }
2339
+ .govuk-file-upload-button .govuk-file-upload-button__pseudo-button {
2340
+ background-color: #ffffff;
2341
+ }
2342
+ .govuk-file-upload-button:hover {
2343
+ background-color: rgb(192.6, 195, 196.6);
2344
+ }
2345
+ .govuk-file-upload-button:hover .govuk-file-upload-button__pseudo-button {
2346
+ background-color: rgb(218.7, 217.8, 216.9);
2347
+ }
2348
+ .govuk-file-upload-button:hover .govuk-file-upload-button__status {
2349
+ background-color: rgb(209.8, 226.4, 240.8);
2350
+ }
2351
+ .govuk-file-upload-button:active, .govuk-file-upload-button:focus {
2352
+ border: 2px solid #0b0c0c;
2353
+ outline: 3px solid #ffdd00;
2354
+ outline-offset: 0;
2355
+ background-color: rgb(192.6, 195, 196.6);
2356
+ box-shadow: inset 0 0 0 2px;
2357
+ }
2358
+ .govuk-file-upload-button:active .govuk-file-upload-button__pseudo-button, .govuk-file-upload-button:focus .govuk-file-upload-button__pseudo-button {
2359
+ background-color: #ffdd00;
2360
+ box-shadow: 0 2px 0 #0b0c0c;
2361
+ }
2362
+ .govuk-file-upload-button:active:hover .govuk-file-upload-button__pseudo-button, .govuk-file-upload-button:focus:hover .govuk-file-upload-button__pseudo-button {
2363
+ border-color: #ffdd00;
2364
+ outline: 3px solid transparent;
2365
+ background-color: #f3f2f1;
2366
+ box-shadow: inset 0 0 0 1px #ffdd00;
2367
+ }
2368
+
2369
+ .govuk-file-upload-button--empty {
2370
+ border-style: dashed;
2371
+ background-color: #ffffff;
2372
+ }
2373
+ .govuk-file-upload-button--empty .govuk-file-upload-button__pseudo-button {
2374
+ background-color: #f3f2f1;
2375
+ }
2376
+ .govuk-file-upload-button--empty .govuk-file-upload-button__status {
2377
+ color: rgb(11.6, 44.8, 73.6);
2378
+ background-color: rgb(187.2, 212.1, 233.7);
2379
+ }
2380
+ .govuk-file-upload-button--empty:hover, .govuk-file-upload-button--empty:focus, .govuk-file-upload-button--empty:active {
2381
+ background-color: #f3f2f1;
2382
+ }
2383
+ .govuk-file-upload-button--empty:hover .govuk-file-upload-button__status, .govuk-file-upload-button--empty:focus .govuk-file-upload-button__status, .govuk-file-upload-button--empty:active .govuk-file-upload-button__status {
2384
+ background-color: rgb(209.8, 226.4, 240.8);
2385
+ }
2386
+
2387
+ .govuk-file-upload-button--dragging {
2388
+ border-style: solid;
2389
+ border-color: #0b0c0c;
2390
+ }
2391
+ .govuk-file-upload-button--dragging.govuk-file-upload-button {
2392
+ background-color: rgb(192.6, 195, 196.6);
2393
+ }
2394
+ .govuk-file-upload-button--dragging.govuk-file-upload-button--empty {
2395
+ background-color: #f3f2f1;
2396
+ }
2397
+ .govuk-file-upload-button--dragging.govuk-file-upload-button--empty:not(:disabled) .govuk-file-upload-button__status, .govuk-file-upload-button--dragging.govuk-file-upload-button--empty .govuk-file-upload-button__pseudo-button {
2398
+ background-color: #ffffff;
2399
+ }
2400
+ .govuk-file-upload-button--dragging .govuk-file-upload-button__pseudo-button {
2401
+ background-color: rgb(218.7, 217.8, 216.9);
2402
+ }
2403
+
2404
+ .govuk-file-upload-button:disabled {
2405
+ pointer-events: none;
2406
+ opacity: 0.5;
2407
+ background-color: #ffffff;
2408
+ }
2409
+ .govuk-file-upload-button:disabled .govuk-file-upload-button__pseudo-button {
2410
+ background-color: #f3f2f1;
2411
+ }
2412
+ .govuk-file-upload-button:disabled .govuk-file-upload-button__status {
2413
+ background-color: rgb(187.2, 212.1, 233.7);
2414
+ }
2415
+
2268
2416
 
2269
2417
 
2270
2418
 
@@ -107,7 +107,7 @@ class InitError extends GOVUKFrontendError {
107
107
  }
108
108
  }
109
109
 
110
- class GOVUKFrontendComponent {
110
+ class Component {
111
111
  /**
112
112
  * Returns the root element of the component
113
113
  *
@@ -158,12 +158,12 @@ class GOVUKFrontendComponent {
158
158
  */
159
159
 
160
160
  /**
161
- * @typedef {typeof GOVUKFrontendComponent & ChildClass} ChildClassConstructor
161
+ * @typedef {typeof Component & ChildClass} ChildClassConstructor
162
162
  */
163
- GOVUKFrontendComponent.elementType = HTMLElement;
163
+ Component.elementType = HTMLElement;
164
164
 
165
165
  const configOverride = Symbol.for('configOverride');
166
- class ConfigurableComponent extends GOVUKFrontendComponent {
166
+ class ConfigurableComponent extends Component {
167
167
  [configOverride](param) {
168
168
  return {};
169
169
  }
@@ -181,7 +181,7 @@ class ConfigurableComponent extends GOVUKFrontendComponent {
181
181
  super($root);
182
182
  this._config = void 0;
183
183
  const childConstructor = this.constructor;
184
- if (typeof childConstructor.defaults === 'undefined') {
184
+ if (!isObject(childConstructor.defaults)) {
185
185
  throw new ConfigError(formatErrorMessage(childConstructor, 'Config passed as parameter into constructor but no defaults defined'));
186
186
  }
187
187
  const datasetConfig = normaliseDataset(childConstructor, this._$root.dataset);
@@ -213,16 +213,19 @@ function normaliseString(value, property) {
213
213
  return output;
214
214
  }
215
215
  function normaliseDataset(Component, dataset) {
216
- if (typeof Component.schema === 'undefined') {
216
+ if (!isObject(Component.schema)) {
217
217
  throw new ConfigError(formatErrorMessage(Component, 'Config passed as parameter into constructor but no schema defined'));
218
218
  }
219
219
  const out = {};
220
- for (const [field, property] of Object.entries(Component.schema.properties)) {
220
+ const entries = Object.entries(Component.schema.properties);
221
+ for (const entry of entries) {
222
+ const [namespace, property] = entry;
223
+ const field = namespace.toString();
221
224
  if (field in dataset) {
222
225
  out[field] = normaliseString(dataset[field], property);
223
226
  }
224
227
  if ((property == null ? void 0 : property.type) === 'object') {
225
- out[field] = extractConfigByNamespace(Component.schema, dataset, field);
228
+ out[field] = extractConfigByNamespace(Component.schema, dataset, namespace);
226
229
  }
227
230
  }
228
231
  return out;
@@ -268,13 +271,13 @@ function extractConfigByNamespace(schema, dataset, namespace) {
268
271
  return;
269
272
  }
270
273
  const newObject = {
271
- [namespace]: ({})
274
+ [namespace]: {}
272
275
  };
273
276
  for (const [key, value] of Object.entries(dataset)) {
274
277
  let current = newObject;
275
278
  const keyParts = key.split('.');
276
279
  for (const [index, name] of keyParts.entries()) {
277
- if (typeof current === 'object') {
280
+ if (isObject(current)) {
278
281
  if (index < keyParts.length - 1) {
279
282
  if (!isObject(current[name])) {
280
283
  current[name] = {};
@@ -534,7 +537,7 @@ class Button extends ConfigurableComponent {
534
537
  */
535
538
 
536
539
  /**
537
- * @typedef {import('../../common/configuration.mjs').Schema} Schema
540
+ * @import { Schema } from '../../common/configuration.mjs'
538
541
  */
539
542
  Button.moduleName = 'govuk-button';
540
543
  Button.defaults = Object.freeze({
@@ -787,8 +790,8 @@ class CharacterCount extends ConfigurableComponent {
787
790
  */
788
791
 
789
792
  /**
790
- * @typedef {import('../../common/configuration.mjs').Schema} Schema
791
- * @typedef {import('../../i18n.mjs').TranslationPluralForms} TranslationPluralForms
793
+ * @import { Schema } from '../../common/configuration.mjs'
794
+ * @import { TranslationPluralForms } from '../../i18n.mjs'
792
795
  */
793
796
  CharacterCount.moduleName = 'govuk-character-count';
794
797
  CharacterCount.defaults = Object.freeze({
@@ -846,7 +849,7 @@ CharacterCount.schema = Object.freeze({
846
849
  *
847
850
  * @preserve
848
851
  */
849
- class Checkboxes extends GOVUKFrontendComponent {
852
+ class Checkboxes extends Component {
850
853
  /**
851
854
  * Checkboxes can be associated with a 'conditionally revealed' content block
852
855
  * – for example, a checkbox for 'Phone' could reveal an additional form field
@@ -1029,7 +1032,7 @@ class ErrorSummary extends ConfigurableComponent {
1029
1032
  */
1030
1033
 
1031
1034
  /**
1032
- * @typedef {import('../../common/configuration.mjs').Schema} Schema
1035
+ * @import { Schema } from '../../common/configuration.mjs'
1033
1036
  */
1034
1037
  ErrorSummary.moduleName = 'govuk-error-summary';
1035
1038
  ErrorSummary.defaults = Object.freeze({
@@ -1165,8 +1168,7 @@ class PasswordInput extends ConfigurableComponent {
1165
1168
  */
1166
1169
 
1167
1170
  /**
1168
- * @typedef {import('../../common/configuration.mjs').Schema} Schema
1169
- * @typedef {import('../../i18n.mjs').TranslationPluralForms} TranslationPluralForms
1171
+ * @import { Schema } from '../../common/configuration.mjs'
1170
1172
  */
1171
1173
  PasswordInput.moduleName = 'govuk-password-input';
1172
1174
  PasswordInput.defaults = Object.freeze({
@@ -1192,7 +1194,7 @@ PasswordInput.schema = Object.freeze({
1192
1194
  *
1193
1195
  * @preserve
1194
1196
  */
1195
- class Radios extends GOVUKFrontendComponent {
1197
+ class Radios extends Component {
1196
1198
  /**
1197
1199
  * Radios can be associated with a 'conditionally revealed' content block –
1198
1200
  * for example, a radio for 'Phone' could reveal an additional form field for
@@ -1,4 +1,4 @@
1
- function e(e=document.body){return!!e&&e.classList.contains("govuk-frontend-supported")}function t(e){return!!e&&"object"==typeof e&&!function(e){return Array.isArray(e)}(e)}function n(e,t){return`${e.moduleName}: ${t}`}class o extends Error{constructor(...e){super(...e),this.name="GOVUKFrontendError"}}class s extends o{constructor(e=document.body){const t="noModule"in HTMLScriptElement.prototype?'GOV.UK Frontend initialised without `<body class="govuk-frontend-supported">` from template `<script>` snippet':"GOV.UK Frontend is not supported in this browser";super(e?t:'GOV.UK Frontend initialised without `<script type="module">`'),this.name="SupportError"}}class i extends o{constructor(...e){super(...e),this.name="ConfigError"}}class r extends o{constructor(e){let t="string"==typeof e?e:"";if("object"==typeof e){const{component:o,identifier:s,element:i,expectedType:r}=e;t=s,t+=i?` is not of type ${null!=r?r:"HTMLElement"}`:" not found",t=n(o,t)}super(t),this.name="ElementError"}}class a extends o{constructor(e){super("string"==typeof e?e:n(e,"Root element (`$root`) already initialised")),this.name="InitError"}}class u{get $root(){return this._$root}constructor(e){this._$root=void 0;const t=this.constructor;if("string"!=typeof t.moduleName)throw new a("`moduleName` not defined in component");if(!(e instanceof t.elementType))throw new r({element:e,component:t,identifier:"Root element (`$root`)",expectedType:t.elementType.name});this._$root=e,t.checkSupport(),this.checkInitialised();const n=t.moduleName;this.$root.setAttribute(`data-${n}-init`,"")}checkInitialised(){const e=this.constructor,t=e.moduleName;if(t&&function(e,t){return e instanceof HTMLElement&&e.hasAttribute(`data-${t}-init`)}(this.$root,t))throw new a(e)}static checkSupport(){if(!e())throw new s}}u.elementType=HTMLElement;const c=Symbol.for("configOverride");class l extends u{[c](e){return{}}get config(){return this._config}constructor(e,t){super(e),this._config=void 0;const o=this.constructor;if(void 0===o.defaults)throw new i(n(o,"Config passed as parameter into constructor but no defaults defined"));const s=function(e,t){if(void 0===e.schema)throw new i(n(e,"Config passed as parameter into constructor but no schema defined"));const o={};for(const[n,s]of Object.entries(e.schema.properties))n in t&&(o[n]=h(t[n],s)),"object"===(null==s?void 0:s.type)&&(o[n]=p(e.schema,t,n));return o}(o,this._$root.dataset);this._config=d(o.defaults,null!=t?t:{},this[c](s),s)}}function h(e,t){const n=e?e.trim():"";let o,s=null==t?void 0:t.type;switch(s||(["true","false"].includes(n)&&(s="boolean"),n.length>0&&isFinite(Number(n))&&(s="number")),s){case"boolean":o="true"===n;break;case"number":o=Number(n);break;default:o=e}return o}function d(...e){const n={};for(const o of e)for(const e of Object.keys(o)){const s=n[e],i=o[e];t(s)&&t(i)?n[e]=d(s,i):n[e]=i}return n}function p(e,n,o){const s=e.properties[o];if("object"!==(null==s?void 0:s.type))return;const i={[o]:{}};for(const[e,s]of Object.entries(n)){let n=i;const r=e.split(".");for(const[i,a]of r.entries())"object"==typeof n&&(i<r.length-1?(t(n[a])||(n[a]={}),n=n[a]):e!==o&&(n[a]=h(s)))}return i[o]}class m{constructor(e={},t={}){var n;this.translations=void 0,this.locale=void 0,this.translations=e,this.locale=null!=(n=t.locale)?n:document.documentElement.lang||"en"}t(e,t){if(!e)throw new Error("i18n: lookup key missing");let n=this.translations[e];if("number"==typeof(null==t?void 0:t.count)&&"object"==typeof n){const o=n[this.getPluralSuffix(e,t.count)];o&&(n=o)}if("string"==typeof n){if(n.match(/%{(.\S+)}/)){if(!t)throw new Error("i18n: cannot replace placeholders in string if no option data provided");return this.replacePlaceholders(n,t)}return n}return e}replacePlaceholders(e,t){const n=Intl.NumberFormat.supportedLocalesOf(this.locale).length?new Intl.NumberFormat(this.locale):void 0;return e.replace(/%{(.\S+)}/g,(function(e,o){if(Object.prototype.hasOwnProperty.call(t,o)){const e=t[o];return!1===e||"number"!=typeof e&&"string"!=typeof e?"":"number"==typeof e?n?n.format(e):`${e}`:e}throw new Error(`i18n: no data found to replace ${e} placeholder in string`)}))}hasIntlPluralRulesSupport(){return Boolean("PluralRules"in window.Intl&&Intl.PluralRules.supportedLocalesOf(this.locale).length)}getPluralSuffix(e,t){if(t=Number(t),!isFinite(t))return"other";const n=this.translations[e],o=this.hasIntlPluralRulesSupport()?new Intl.PluralRules(this.locale).select(t):this.selectPluralFormUsingFallbackRules(t);if("object"==typeof n){if(o in n)return o;if("other"in n)return console.warn(`i18n: Missing plural form ".${o}" for "${this.locale}" locale. Falling back to ".other".`),"other"}throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`)}selectPluralFormUsingFallbackRules(e){e=Math.abs(Math.floor(e));const t=this.getPluralRulesForLocale();return t?m.pluralRules[t](e):"other"}getPluralRulesForLocale(){const e=this.locale.split("-")[0];for(const t in m.pluralRulesMap){const n=m.pluralRulesMap[t];if(n.includes(this.locale)||n.includes(e))return t}}}m.pluralRulesMap={arabic:["ar"],chinese:["my","zh","id","ja","jv","ko","ms","th","vi"],french:["hy","bn","fr","gu","hi","fa","pa","zu"],german:["af","sq","az","eu","bg","ca","da","nl","en","et","fi","ka","de","el","hu","lb","no","so","sw","sv","ta","te","tr","ur"],irish:["ga"],russian:["ru","uk"],scottish:["gd"],spanish:["pt-PT","it","es"],welsh:["cy"]},m.pluralRules={arabic:e=>0===e?"zero":1===e?"one":2===e?"two":e%100>=3&&e%100<=10?"few":e%100>=11&&e%100<=99?"many":"other",chinese:()=>"other",french:e=>0===e||1===e?"one":"other",german:e=>1===e?"one":"other",irish:e=>1===e?"one":2===e?"two":e>=3&&e<=6?"few":e>=7&&e<=10?"many":"other",russian(e){const t=e%100,n=t%10;return 1===n&&11!==t?"one":n>=2&&n<=4&&!(t>=12&&t<=14)?"few":0===n||n>=5&&n<=9||t>=11&&t<=14?"many":"other"},scottish:e=>1===e||11===e?"one":2===e||12===e?"two":e>=3&&e<=10||e>=13&&e<=19?"few":"other",spanish:e=>1===e?"one":e%1e6==0&&0!==e?"many":"other",welsh:e=>0===e?"zero":1===e?"one":2===e?"two":3===e?"few":6===e?"many":"other"};
1
+ function e(e=document.body){return!!e&&e.classList.contains("govuk-frontend-supported")}function t(e){return!!e&&"object"==typeof e&&!function(e){return Array.isArray(e)}(e)}function n(e,t){return`${e.moduleName}: ${t}`}class o extends Error{constructor(...e){super(...e),this.name="GOVUKFrontendError"}}class s extends o{constructor(e=document.body){const t="noModule"in HTMLScriptElement.prototype?'GOV.UK Frontend initialised without `<body class="govuk-frontend-supported">` from template `<script>` snippet':"GOV.UK Frontend is not supported in this browser";super(e?t:'GOV.UK Frontend initialised without `<script type="module">`'),this.name="SupportError"}}class i extends o{constructor(...e){super(...e),this.name="ConfigError"}}class r extends o{constructor(e){let t="string"==typeof e?e:"";if("object"==typeof e){const{component:o,identifier:s,element:i,expectedType:r}=e;t=s,t+=i?` is not of type ${null!=r?r:"HTMLElement"}`:" not found",t=n(o,t)}super(t),this.name="ElementError"}}class a extends o{constructor(e){super("string"==typeof e?e:n(e,"Root element (`$root`) already initialised")),this.name="InitError"}}class u{get $root(){return this._$root}constructor(e){this._$root=void 0;const t=this.constructor;if("string"!=typeof t.moduleName)throw new a("`moduleName` not defined in component");if(!(e instanceof t.elementType))throw new r({element:e,component:t,identifier:"Root element (`$root`)",expectedType:t.elementType.name});this._$root=e,t.checkSupport(),this.checkInitialised();const n=t.moduleName;this.$root.setAttribute(`data-${n}-init`,"")}checkInitialised(){const e=this.constructor,t=e.moduleName;if(t&&function(e,t){return e instanceof HTMLElement&&e.hasAttribute(`data-${t}-init`)}(this.$root,t))throw new a(e)}static checkSupport(){if(!e())throw new s}}u.elementType=HTMLElement;const c=Symbol.for("configOverride");class l extends u{[c](e){return{}}get config(){return this._config}constructor(e,o){super(e),this._config=void 0;const s=this.constructor;if(!t(s.defaults))throw new i(n(s,"Config passed as parameter into constructor but no defaults defined"));const r=function(e,o){if(!t(e.schema))throw new i(n(e,"Config passed as parameter into constructor but no schema defined"));const s={},r=Object.entries(e.schema.properties);for(const t of r){const[n,i]=t,r=n.toString();r in o&&(s[r]=h(o[r],i)),"object"===(null==i?void 0:i.type)&&(s[r]=p(e.schema,o,n))}return s}(s,this._$root.dataset);this._config=d(s.defaults,null!=o?o:{},this[c](r),r)}}function h(e,t){const n=e?e.trim():"";let o,s=null==t?void 0:t.type;switch(s||(["true","false"].includes(n)&&(s="boolean"),n.length>0&&isFinite(Number(n))&&(s="number")),s){case"boolean":o="true"===n;break;case"number":o=Number(n);break;default:o=e}return o}function d(...e){const n={};for(const o of e)for(const e of Object.keys(o)){const s=n[e],i=o[e];t(s)&&t(i)?n[e]=d(s,i):n[e]=i}return n}function p(e,n,o){const s=e.properties[o];if("object"!==(null==s?void 0:s.type))return;const i={[o]:{}};for(const[e,s]of Object.entries(n)){let n=i;const r=e.split(".");for(const[i,a]of r.entries())t(n)&&(i<r.length-1?(t(n[a])||(n[a]={}),n=n[a]):e!==o&&(n[a]=h(s)))}return i[o]}class m{constructor(e={},t={}){var n;this.translations=void 0,this.locale=void 0,this.translations=e,this.locale=null!=(n=t.locale)?n:document.documentElement.lang||"en"}t(e,t){if(!e)throw new Error("i18n: lookup key missing");let n=this.translations[e];if("number"==typeof(null==t?void 0:t.count)&&"object"==typeof n){const o=n[this.getPluralSuffix(e,t.count)];o&&(n=o)}if("string"==typeof n){if(n.match(/%{(.\S+)}/)){if(!t)throw new Error("i18n: cannot replace placeholders in string if no option data provided");return this.replacePlaceholders(n,t)}return n}return e}replacePlaceholders(e,t){const n=Intl.NumberFormat.supportedLocalesOf(this.locale).length?new Intl.NumberFormat(this.locale):void 0;return e.replace(/%{(.\S+)}/g,(function(e,o){if(Object.prototype.hasOwnProperty.call(t,o)){const e=t[o];return!1===e||"number"!=typeof e&&"string"!=typeof e?"":"number"==typeof e?n?n.format(e):`${e}`:e}throw new Error(`i18n: no data found to replace ${e} placeholder in string`)}))}hasIntlPluralRulesSupport(){return Boolean("PluralRules"in window.Intl&&Intl.PluralRules.supportedLocalesOf(this.locale).length)}getPluralSuffix(e,t){if(t=Number(t),!isFinite(t))return"other";const n=this.translations[e],o=this.hasIntlPluralRulesSupport()?new Intl.PluralRules(this.locale).select(t):this.selectPluralFormUsingFallbackRules(t);if("object"==typeof n){if(o in n)return o;if("other"in n)return console.warn(`i18n: Missing plural form ".${o}" for "${this.locale}" locale. Falling back to ".other".`),"other"}throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`)}selectPluralFormUsingFallbackRules(e){e=Math.abs(Math.floor(e));const t=this.getPluralRulesForLocale();return t?m.pluralRules[t](e):"other"}getPluralRulesForLocale(){const e=this.locale.split("-")[0];for(const t in m.pluralRulesMap){const n=m.pluralRulesMap[t];if(n.includes(this.locale)||n.includes(e))return t}}}m.pluralRulesMap={arabic:["ar"],chinese:["my","zh","id","ja","jv","ko","ms","th","vi"],french:["hy","bn","fr","gu","hi","fa","pa","zu"],german:["af","sq","az","eu","bg","ca","da","nl","en","et","fi","ka","de","el","hu","lb","no","so","sw","sv","ta","te","tr","ur"],irish:["ga"],russian:["ru","uk"],scottish:["gd"],spanish:["pt-PT","it","es"],welsh:["cy"]},m.pluralRules={arabic:e=>0===e?"zero":1===e?"one":2===e?"two":e%100>=3&&e%100<=10?"few":e%100>=11&&e%100<=99?"many":"other",chinese:()=>"other",french:e=>0===e||1===e?"one":"other",german:e=>1===e?"one":"other",irish:e=>1===e?"one":2===e?"two":e>=3&&e<=6?"few":e>=7&&e<=10?"many":"other",russian(e){const t=e%100,n=t%10;return 1===n&&11!==t?"one":n>=2&&n<=4&&!(t>=12&&t<=14)?"few":0===n||n>=5&&n<=9||t>=11&&t<=14?"many":"other"},scottish:e=>1===e||11===e?"one":2===e||12===e?"two":e>=3&&e<=10||e>=13&&e<=19?"few":"other",spanish:e=>1===e?"one":e%1e6==0&&0!==e?"many":"other",welsh:e=>0===e?"zero":1===e?"one":2===e?"two":3===e?"few":6===e?"many":"other"};
2
2
  /**
3
3
  * JavaScript enhancements for the Button component
4
4
  *
@@ -11,6 +11,14 @@
11
11
  .govuk-textarea {
12
12
  margin-bottom: govuk-spacing(1);
13
13
  }
14
+
15
+ // If the textarea enters the error state whilst the user is focused on it,
16
+ // show the error state. This presents feedback to the user that the value
17
+ // has become invalid without needing to see the counter.
18
+ .govuk-textarea--error:focus {
19
+ border-color: $govuk-error-colour;
20
+ box-shadow: inset 0 0 0 $govuk-border-width-form-element $govuk-error-colour;
21
+ }
14
22
  }
15
23
 
16
24
  .govuk-character-count__message {
@@ -3,7 +3,11 @@
3
3
  @import "../label/index";
4
4
 
5
5
  @include govuk-exports("govuk/component/file-upload") {
6
+ $file-upload-border-width: 2px;
6
7
  $component-padding: govuk-spacing(1);
8
+ $empty-button-background-colour: govuk-colour("white");
9
+ $empty-pseudo-button-background-colour: govuk-colour("light-grey");
10
+ $empty-status-background-colour: govuk-tint(govuk-colour("blue"), 70%);
7
11
 
8
12
  .govuk-file-upload {
9
13
  @include govuk-font($size: 19);
@@ -46,6 +50,169 @@
46
50
  cursor: not-allowed;
47
51
  }
48
52
  }
53
+
54
+ .govuk-drop-zone {
55
+ display: block;
56
+ position: relative;
57
+ z-index: 0;
58
+ background-color: $govuk-body-background-colour;
59
+ }
60
+
61
+ // required because disabling pointer events
62
+ // on the button means that the cursor style
63
+ // be applied on the button itself
64
+ .govuk-drop-zone--disabled {
65
+ cursor: not-allowed;
66
+ }
67
+
68
+ .govuk-file-upload-button__pseudo-button {
69
+ width: auto;
70
+ margin-right: govuk-spacing(2);
71
+ margin-bottom: $govuk-border-width-form-element + 1;
72
+ flex-shrink: 0;
73
+ }
74
+
75
+ .govuk-file-upload-button__instruction {
76
+ margin-top: govuk-spacing(2) - ($govuk-border-width-form-element + 1);
77
+ margin-bottom: 0;
78
+ text-align: left;
79
+ }
80
+
81
+ .govuk-file-upload-button__status {
82
+ display: block;
83
+ margin-bottom: govuk-spacing(2);
84
+ padding: govuk-spacing(3) govuk-spacing(2);
85
+ background-color: govuk-colour("white");
86
+ text-align: left;
87
+ }
88
+
89
+ // bugs documented with button using flex
90
+ // https://github.com/philipwalton/flexbugs#flexbug-9
91
+ // so we need a container here
92
+ .govuk-file-upload-button__pseudo-button-container {
93
+ display: flex;
94
+ align-items: baseline;
95
+ flex-wrap: wrap;
96
+ }
97
+
98
+ .govuk-file-upload-button {
99
+ width: 100%;
100
+ // align the padding to be same as notification banner and error summary accounting for the thicker borders
101
+ padding: (govuk-spacing(3) + $govuk-border-width - $file-upload-border-width);
102
+ border: $file-upload-border-width govuk-colour("mid-grey") solid;
103
+ background-color: govuk-colour("light-grey");
104
+ cursor: pointer;
105
+
106
+ @include govuk-media-query($from: tablet) {
107
+ padding: (govuk-spacing(4) + $govuk-border-width - $file-upload-border-width);
108
+ }
109
+
110
+ .govuk-file-upload-button__pseudo-button {
111
+ background-color: govuk-colour("white");
112
+ }
113
+
114
+ &:hover {
115
+ background-color: govuk-tint(govuk-colour("mid-grey"), 20%);
116
+
117
+ .govuk-file-upload-button__pseudo-button {
118
+ background-color: govuk-shade(govuk-colour("light-grey"), 10%);
119
+ }
120
+
121
+ .govuk-file-upload-button__status {
122
+ background-color: govuk-tint(govuk-colour("blue"), 80%);
123
+ }
124
+ }
125
+
126
+ &:active,
127
+ &:focus {
128
+ border: $file-upload-border-width solid govuk-colour("black");
129
+ outline: $govuk-focus-width solid $govuk-focus-colour;
130
+ // Ensure outline appears outside of the element
131
+ outline-offset: 0;
132
+ background-color: govuk-tint(govuk-colour("mid-grey"), 20%);
133
+ // Double the border by adding its width again. Use `box-shadow` for this
134
+ // instead of changing `border-width` - this is for consistency with
135
+ // components such as textarea where we avoid changing `border-width` as
136
+ // it will change the element size. Also, `outline` cannot be utilised
137
+ // here as it is already used for the yellow focus state.
138
+ box-shadow: inset 0 0 0 $govuk-border-width-form-element;
139
+
140
+ .govuk-file-upload-button__pseudo-button {
141
+ background-color: $govuk-focus-colour;
142
+ box-shadow: 0 2px 0 govuk-colour("black");
143
+ }
144
+
145
+ &:hover .govuk-file-upload-button__pseudo-button {
146
+ border-color: $govuk-focus-colour;
147
+ outline: 3px solid transparent;
148
+ background-color: govuk-colour("light-grey");
149
+ box-shadow: inset 0 0 0 1px $govuk-focus-colour;
150
+ }
151
+ }
152
+ }
153
+
154
+ .govuk-file-upload-button--empty {
155
+ border-style: dashed;
156
+ background-color: $empty-button-background-colour;
157
+
158
+ .govuk-file-upload-button__pseudo-button {
159
+ background-color: $empty-pseudo-button-background-colour;
160
+ }
161
+
162
+ .govuk-file-upload-button__status {
163
+ color: govuk-shade(govuk-colour("blue"), 60%);
164
+ background-color: $empty-status-background-colour;
165
+ }
166
+
167
+ &:hover,
168
+ &:focus,
169
+ &:active {
170
+ background-color: govuk-colour("light-grey");
171
+
172
+ .govuk-file-upload-button__status {
173
+ background-color: govuk-tint(govuk-colour("blue"), 80%);
174
+ }
175
+ }
176
+ }
177
+
178
+ .govuk-file-upload-button--dragging {
179
+ border-style: solid;
180
+ border-color: govuk-colour("black");
181
+
182
+ // extra specificity to apply when
183
+ // empty
184
+ &.govuk-file-upload-button {
185
+ background-color: govuk-tint(govuk-colour("mid-grey"), 20%);
186
+ }
187
+
188
+ &.govuk-file-upload-button--empty {
189
+ background-color: govuk-colour("light-grey");
190
+ }
191
+
192
+ &.govuk-file-upload-button--empty:not(:disabled) .govuk-file-upload-button__status,
193
+ &.govuk-file-upload-button--empty .govuk-file-upload-button__pseudo-button {
194
+ background-color: govuk-colour("white");
195
+ }
196
+
197
+ .govuk-file-upload-button__pseudo-button {
198
+ background-color: govuk-shade(govuk-colour("light-grey"), 10%);
199
+ }
200
+ }
201
+
202
+ .govuk-file-upload-button:disabled {
203
+ pointer-events: none;
204
+ opacity: 0.5;
205
+
206
+ background-color: $empty-button-background-colour;
207
+
208
+ .govuk-file-upload-button__pseudo-button {
209
+ background-color: $empty-pseudo-button-background-colour;
210
+ }
211
+
212
+ .govuk-file-upload-button__status {
213
+ background-color: $empty-status-background-colour;
214
+ }
215
+ }
49
216
  }
50
217
 
51
218
  /*# sourceMappingURL=_index.scss.map */
@@ -204,18 +204,9 @@
204
204
 
205
205
  .govuk-header__menu-button {
206
206
  @include govuk-font($size: 16);
207
- position: absolute;
208
- // calculate top offset by:
209
- // - getting the vertical spacing for the top and the bottom of the header
210
- // - adding that to the crown height
211
- // - dividing it by 2 so you have the vertical centre of the header
212
- // - subtracting half the height of the menu button
213
- top: (((govuk-spacing($govuk-header-vertical-spacing-value) * 2) + $govuk-header-crown-height) / 2) -
214
- ($govuk-header-menu-button-height / 2);
215
- right: 0;
216
207
  max-width: $govuk-header-menu-button-width;
217
208
  min-height: $govuk-header-menu-button-height;
218
- margin: 0;
209
+ margin-bottom: govuk-spacing(1);
219
210
  padding: 0;
220
211
  border: 0;
221
212
  color: govuk-colour("white");
@@ -246,6 +237,19 @@
246
237
  @include govuk-shape-arrow($direction: up, $base: 10px, $display: inline-block);
247
238
  }
248
239
 
240
+ @include govuk-media-query($from: mobile) {
241
+ position: absolute;
242
+ // calculate top offset by:
243
+ // - getting the vertical spacing for the top and the bottom of the header
244
+ // - adding that to the crown height
245
+ // - dividing it by 2 so you have the vertical centre of the header
246
+ // - subtracting half the height of the menu button
247
+ top: (((govuk-spacing($govuk-header-vertical-spacing-value) * 2) + $govuk-header-crown-height) / 2) -
248
+ ($govuk-header-menu-button-height / 2);
249
+ right: 0;
250
+ margin: 0;
251
+ }
252
+
249
253
  @include govuk-media-query($from: tablet) {
250
254
  top: govuk-spacing(3);
251
255
  }
@@ -96,18 +96,21 @@
96
96
  padding: 0; // Reset default user agent styles
97
97
  }
98
98
 
99
- .govuk-summary-list__actions-list-item {
99
+ .govuk-summary-list__actions-list-item,
100
+ .govuk-summary-card__action {
100
101
  display: inline-block;
101
102
  }
102
103
 
103
104
  @include govuk-media-query($until: tablet) {
104
- .govuk-summary-list__actions-list-item {
105
+ .govuk-summary-list__actions-list-item,
106
+ .govuk-summary-card__action {
105
107
  margin-right: govuk-spacing(2);
106
108
  padding-right: govuk-spacing(2);
107
109
  border-right: 1px solid $govuk-border-colour;
108
110
  }
109
111
 
110
- .govuk-summary-list__actions-list-item:last-child {
112
+ .govuk-summary-list__actions-list-item:last-child,
113
+ .govuk-summary-card__action:last-child {
111
114
  margin-right: 0;
112
115
  padding-right: 0;
113
116
  border: 0;
@@ -115,16 +118,19 @@
115
118
  }
116
119
 
117
120
  @include govuk-media-query($from: tablet) {
118
- .govuk-summary-list__actions-list-item {
121
+ .govuk-summary-list__actions-list-item,
122
+ .govuk-summary-card__action {
119
123
  margin-left: govuk-spacing(2);
120
124
  padding-left: govuk-spacing(2);
121
125
  }
122
126
 
123
- .govuk-summary-list__actions-list-item:not(:first-child) {
127
+ .govuk-summary-list__actions-list-item:not(:first-child),
128
+ .govuk-summary-card__action:not(:first-child) {
124
129
  border-left: 1px solid $govuk-border-colour;
125
130
  }
126
131
 
127
- .govuk-summary-list__actions-list-item:first-child {
132
+ .govuk-summary-list__actions-list-item:first-child,
133
+ .govuk-summary-card__action:first-child {
128
134
  margin-left: 0;
129
135
  padding-left: 0;
130
136
  border: 0;
@@ -220,13 +226,6 @@
220
226
 
221
227
  .govuk-summary-card__action {
222
228
  display: inline;
223
- margin: 0 govuk-spacing(2) 0 0;
224
- padding-right: govuk-spacing(2);
225
- border-right: 1px solid $govuk-border-colour;
226
-
227
- @include govuk-media-query($from: "tablet") {
228
- margin-right: 0;
229
- }
230
229
 
231
230
  // We use the following media query to target IE11 and 10 only to add margin
232
231
  // between actions.
@@ -243,14 +242,6 @@
243
242
  }
244
243
 
245
244
  .govuk-summary-card__action:last-child {
246
- margin: 0;
247
- padding-right: 0;
248
- border-right: none;
249
-
250
- @include govuk-media-query($from: "tablet") {
251
- padding-left: govuk-spacing(2);
252
- }
253
-
254
245
  // See above comment for why this is here
255
246
  @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
256
247
  margin-bottom: 0;
@@ -1,7 +1,7 @@
1
1
  :root {
2
2
  // This variable is automatically overwritten during builds and releases.
3
3
  // It doesn't need to be updated manually.
4
- --govuk-frontend-version: "5.8.0";
4
+ --govuk-frontend-version: "5.9.0";
5
5
 
6
6
  // CSS custom property for each breakpoint
7
7
  @each $name, $value in $govuk-breakpoints {
@@ -67,7 +67,7 @@
67
67
  }
68
68
 
69
69
  // Output a warning if $websafe is set.
70
- @if $websafe and not index($govuk-suppressed-warnings, "organisation-colour-websafe-param") {
70
+ @if $websafe and _should-warn("organisation-colour-websafe-param") {
71
71
  @warn _warning-text("organisation-colour-websafe-param",
72
72
  "The `$websafe` parameter of `govuk-organisation-colour` has been " +
73
73
  "renamed to `$contrast-safe`. The old parameter name will be removed in " +
@@ -77,7 +77,7 @@
77
77
 
78
78
  $org-colour: map-get($govuk-colours-organisations, $organisation);
79
79
 
80
- @if map-has-key($org-colour, deprecation-message) and not index($govuk-suppressed-warnings, "organisation-colours") {
80
+ @if map-has-key($org-colour, deprecation-message) and _should-warn("organisation-colours") {
81
81
  @warn _warning-text(
82
82
  "organisation-colours",
83
83
  map-get($org-colour, deprecation-message)
@@ -1,3 +1,5 @@
1
+ @import "../settings/warnings";
2
+
1
3
  ////
2
4
  /// @group settings/colours
3
5
  ////
@@ -11,6 +13,7 @@
11
13
  ///
12
14
  /// @type Boolean
13
15
  /// @access public
16
+ /// @deprecated Using new organisation colours will become the default in Frontend v6.0.
14
17
 
15
18
  $govuk-new-organisation-colours: false !default;
16
19
 
@@ -211,6 +214,7 @@ $_govuk-organisation-colours: (
211
214
  /// nor provide better contrast than the base colour.
212
215
  ///
213
216
  /// @access private
217
+ /// @deprecated Migrate to using the new organisation colour palette instead.
214
218
 
215
219
  $_govuk-legacy-organisation-colours: (
216
220
  "attorney-generals-office": (
@@ -349,11 +353,20 @@ $_govuk-legacy-organisation-colours: (
349
353
  /// @type Map
350
354
  /// @access public
351
355
 
352
- $govuk-colours-organisations: if(
353
- $govuk-new-organisation-colours,
354
- $_govuk-organisation-colours,
355
- $_govuk-legacy-organisation-colours
356
- ) !default;
356
+ $govuk-colours-organisations: $_govuk-legacy-organisation-colours !default;
357
+
358
+ @if $govuk-new-organisation-colours and $govuk-colours-organisations == $_govuk-legacy-organisation-colours {
359
+ $govuk-colours-organisations: $_govuk-organisation-colours;
360
+ }
361
+
362
+ // Output a deprecation warning if the legacy colour palette is being used.
363
+ // Remove in next major version.
364
+ @if $govuk-colours-organisations == $_govuk-legacy-organisation-colours {
365
+ @include _warning(
366
+ "legacy-organisation-colours",
367
+ "The legacy organisation colour palette has been deprecated and will be removed in the next major version."
368
+ );
369
+ }
357
370
 
358
371
  /// Organisation colour aliases
359
372
  ///
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: katalyst-govuk-formbuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.15.0
4
+ version: 1.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katalyst Interactive
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-02-26 00:00:00.000000000 Z
10
+ date: 2025-03-14 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: govuk_design_system_formbuilder
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '0'
18
+ version: 5.8.0
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: '0'
25
+ version: 5.8.0
26
26
  description: UK.GOV form builder ready for use in Katalyst projects
27
27
  email:
28
28
  - developers@katalyst.com.au