@ministryofjustice/frontend 2.1.3 → 2.2.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.
@@ -0,0 +1,3 @@
1
+ {% macro mojDatePicker(params) %}
2
+ {%- include "./template.njk" -%}
3
+ {% endmacro %}
@@ -0,0 +1,50 @@
1
+ {% from "govuk/components/input/macro.njk" import govukInput %}
2
+ {% from "govuk/macros/attributes.njk" import govukAttributes %}
3
+
4
+ {% set classNames = "moj-js-datepicker-input " %}
5
+
6
+ {%- if params.classes %}
7
+ {% set classNames = classNames + " " + params.classes %}
8
+ {% endif %}
9
+
10
+ {% set attributes = {
11
+ "data-module": 'moj-date-picker',
12
+ "data-min-date": {
13
+ value: params.minDate,
14
+ optional: true
15
+ },
16
+ "data-max-date": {
17
+ value: params.maxDate,
18
+ optional: true
19
+ },
20
+ "data-excluded-dates": {
21
+ value: params.excludedDates,
22
+ optional: true
23
+ },
24
+ "data-excluded-days": {
25
+ value: params.excludedDays,
26
+ optional: true
27
+ },
28
+ "data-leading-zeros": {
29
+ value: params.leadingZeros,
30
+ optional: true
31
+ },
32
+ "data-week-start-day": {
33
+ value: params.weekStartDay,
34
+ optional: true
35
+ }
36
+ } %}
37
+
38
+ <div class="moj-datepicker" {{ govukAttributes(attributes) }}>
39
+ {{ govukInput({
40
+ classes: classNames,
41
+ id: params.id,
42
+ name: params.name,
43
+ value: params.value,
44
+ autocomplete: "off",
45
+ formGroup: params.formGroup,
46
+ label: params.label,
47
+ hint: params.hint,
48
+ errorMessage: params.errorMessage
49
+ }) }}
50
+ </div>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ministryofjustice/frontend",
3
3
  "description": "The MOJ Frontend contains the code you need to start building user interfaces for UK Ministry of Justice government services.",
4
- "version": "2.1.3",
4
+ "version": "2.2.0",
5
5
  "main": "moj/all.js",
6
6
  "sass": "moj/all.scss",
7
7
  "engines": {