@nnc-digital/nnc-design-system 0.4.29 → 0.4.31
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/build/index.esm.js +65 -50
- package/build/index.esm.js.map +1 -1
- package/build/index.js +65 -50
- package/build/index.js.map +1 -1
- package/build/library/components/BinCollection/BinCollection.styles.d.ts +1 -0
- package/build/library/components/TextInput/TextInput.types.d.ts +4 -0
- package/package.json +1 -1
package/build/index.esm.js
CHANGED
|
@@ -4028,18 +4028,19 @@ var Button$4 = function (_a) {
|
|
|
4028
4028
|
};
|
|
4029
4029
|
|
|
4030
4030
|
var Container$17 = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n"], ["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n"])));
|
|
4031
|
-
styled.label(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: block;\n margin-bottom: 15px;\n"], ["\n display: block;\n margin-bottom: 15px;\n"])));
|
|
4032
|
-
var
|
|
4033
|
-
var
|
|
4031
|
+
var Label$5 = styled.label(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: block;\n margin-bottom: 15px;\n"], ["\n display: block;\n margin-bottom: 15px;\n"])));
|
|
4032
|
+
var VisuallyHiddenLabel = styled(Label$5)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n clip-path: inset(50%);\n border: 0;\n white-space: nowrap;\n"], ["\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n clip-path: inset(50%);\n border: 0;\n white-space: nowrap;\n"])));
|
|
4033
|
+
var BinCollectionButtonStyles = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n button {\n margin: 10px 10px 12px 10px;\n }\n"], ["\n button {\n margin: 10px 10px 12px 10px;\n }\n"])));
|
|
4034
|
+
var FormContainer$1 = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n ", "\n"], ["\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n ", "\n"])), function (props) {
|
|
4034
4035
|
return props.isLoading && "\n opacity: 0.5; \n pointer-events: none;\n ";
|
|
4035
4036
|
});
|
|
4036
|
-
var ErrorTextWrapper = styled.div(
|
|
4037
|
-
var DropDownSelectContainer = styled.div(
|
|
4038
|
-
var FormInnerContainer = styled.div(
|
|
4039
|
-
styled.label(
|
|
4040
|
-
styled.div(
|
|
4041
|
-
styled.input(
|
|
4042
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;
|
|
4037
|
+
var ErrorTextWrapper = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: block;\n width: 100%;\n"], ["\n display: block;\n width: 100%;\n"])));
|
|
4038
|
+
var DropDownSelectContainer = styled.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n padding-bottom: 20px;\n width: 90%;\n"], ["\n padding-bottom: 20px;\n width: 90%;\n"])));
|
|
4039
|
+
var FormInnerContainer = styled.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: flex-start;\n"], ["\n display: flex;\n align-items: center;\n justify-content: flex-start;\n"])));
|
|
4040
|
+
styled.label(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n margin-right: ", ";\n"], ["\n display: flex;\n align-items: center;\n margin-right: ", ";\n"])), function (props) { return props.theme.theme_vars.spacingSizes.small; });
|
|
4041
|
+
styled.div(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n display: flex;\n justify-content: left;\n margin-bottom: .5em;\n width: 100%;\n"], ["\n display: flex;\n justify-content: left;\n margin-bottom: .5em;\n width: 100%;\n"])));
|
|
4042
|
+
styled.input(templateObject_11 || (templateObject_11 = __makeTemplateObject([""], [""])));
|
|
4043
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11;
|
|
4043
4044
|
|
|
4044
4045
|
const Container$16 = styled.div`
|
|
4045
4046
|
display: flex;
|
|
@@ -4085,17 +4086,6 @@ var FormWithLine = function (_a) {
|
|
|
4085
4086
|
children)));
|
|
4086
4087
|
};
|
|
4087
4088
|
|
|
4088
|
-
/**
|
|
4089
|
-
* Primary UI component for user interaction
|
|
4090
|
-
* If value is set then treat as controlled component
|
|
4091
|
-
*/
|
|
4092
|
-
var Input$6 = function (_a) {
|
|
4093
|
-
var _b = _a.type, type = _b === void 0 ? 'text' : _b, _c = _a.placeholder, placeholder = _c === void 0 ? '' : _c, _d = _a.isErrored, isErrored = _d === void 0 ? false : _d, errorText = _a.errorText, name = _a.name, maxLength = _a.maxLength, defaultValue = _a.defaultValue, onChange = _a.onChange, id = _a.id, value = _a.value;
|
|
4094
|
-
return (React.createElement(React.Fragment, null,
|
|
4095
|
-
errorText && React.createElement(ErrorText$1, null, errorText),
|
|
4096
|
-
typeof value !== 'undefined' ? (React.createElement(StyledInput, { onChange: onChange, type: type, placeholder: placeholder, name: name, isErrored: isErrored, maxLength: maxLength, value: value, id: id })) : (React.createElement(StyledInput, { onChange: onChange, type: type, placeholder: placeholder, name: name, isErrored: isErrored, maxLength: maxLength, defaultValue: defaultValue, id: id }))));
|
|
4097
|
-
};
|
|
4098
|
-
|
|
4099
4089
|
const StyledButton = styled.button`
|
|
4100
4090
|
font-weight: 700;
|
|
4101
4091
|
border: none;
|
|
@@ -4353,12 +4343,25 @@ var BinCollection = function (_a) {
|
|
|
4353
4343
|
setErrorText('No addresses found for the provided postcode.');
|
|
4354
4344
|
return;
|
|
4355
4345
|
}
|
|
4356
|
-
//
|
|
4357
|
-
var
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4346
|
+
// Separate numeric and named addresses
|
|
4347
|
+
var numericAddresses = [];
|
|
4348
|
+
var namedAddresses = [];
|
|
4349
|
+
response.data.data.forEach(function (item) {
|
|
4350
|
+
var address = "".concat(item.Address);
|
|
4351
|
+
if (/^\d/.test(address)) { // Address starts with a number
|
|
4352
|
+
numericAddresses.push({ value: item.UPRN, title: address });
|
|
4353
|
+
}
|
|
4354
|
+
else {
|
|
4355
|
+
namedAddresses.push({ value: item.UPRN, title: address });
|
|
4356
|
+
}
|
|
4357
|
+
});
|
|
4358
|
+
// Sort numeric addresses by the whole number
|
|
4359
|
+
numericAddresses.sort(function (a, b) { return parseInt(a.title, 10) - parseInt(b.title, 10); });
|
|
4360
|
+
// Sort named addresses alphabetically
|
|
4361
|
+
namedAddresses.sort(function (a, b) { return a.title.localeCompare(b.title); });
|
|
4362
|
+
// Combine the sorted arrays
|
|
4363
|
+
var sortedAddresses = numericAddresses.concat(namedAddresses);
|
|
4364
|
+
setAddressOptions(sortedAddresses);
|
|
4362
4365
|
})
|
|
4363
4366
|
.catch(function (error) {
|
|
4364
4367
|
setIsLoading(false);
|
|
@@ -4491,7 +4494,8 @@ var BinCollection = function (_a) {
|
|
|
4491
4494
|
React.createElement(Heading, { level: 2, text: "Bin collection checker" }),
|
|
4492
4495
|
React.createElement(ErrorTextWrapper, null, errorText && React.createElement(ErrorText$1, null, errorText)),
|
|
4493
4496
|
React.createElement(FormInnerContainer, null,
|
|
4494
|
-
React.createElement(
|
|
4497
|
+
React.createElement(VisuallyHiddenLabel, { id: "postcode-label", htmlFor: "postcode-input" }, "Enter a postcode"),
|
|
4498
|
+
React.createElement(StyledTextInput, { type: "text", placeholder: "Enter a postcode", name: "postcode", id: "postcode-input", isErrored: isError, "aria-labelledby": "postcode-label", autoComplete: "postal-code" }),
|
|
4495
4499
|
React.createElement(BinCollectionButtonStyles, null,
|
|
4496
4500
|
React.createElement(FormButton, { size: "large", type: "submit", "aria-label": "Submit", text: "Find" }))))),
|
|
4497
4501
|
addressOptions.length > 0 && (React.createElement(DropDownSelectContainer, null,
|
|
@@ -13855,10 +13859,10 @@ let pico$1 = picocolors.exports;
|
|
|
13855
13859
|
|
|
13856
13860
|
let tokenizer$1 = tokenize;
|
|
13857
13861
|
|
|
13858
|
-
let Input$
|
|
13862
|
+
let Input$6;
|
|
13859
13863
|
|
|
13860
13864
|
function registerInput(dependant) {
|
|
13861
|
-
Input$
|
|
13865
|
+
Input$6 = dependant;
|
|
13862
13866
|
}
|
|
13863
13867
|
|
|
13864
13868
|
const HIGHLIGHT_THEME = {
|
|
@@ -13899,7 +13903,7 @@ function getTokenType([type, value], processor) {
|
|
|
13899
13903
|
}
|
|
13900
13904
|
|
|
13901
13905
|
function terminalHighlight$2(css) {
|
|
13902
|
-
let processor = tokenizer$1(new Input$
|
|
13906
|
+
let processor = tokenizer$1(new Input$6(css), { ignoreErrors: true });
|
|
13903
13907
|
let result = '';
|
|
13904
13908
|
while (!processor.endOfFile()) {
|
|
13905
13909
|
let token = processor.nextToken();
|
|
@@ -18286,7 +18290,7 @@ let fromOffsetCache = Symbol('fromOffsetCache');
|
|
|
18286
18290
|
let sourceMapAvailable$1 = Boolean(SourceMapConsumer$1 && SourceMapGenerator$1);
|
|
18287
18291
|
let pathAvailable$1 = Boolean(resolve$1 && isAbsolute);
|
|
18288
18292
|
|
|
18289
|
-
class Input$
|
|
18293
|
+
class Input$5 {
|
|
18290
18294
|
constructor(css, opts = {}) {
|
|
18291
18295
|
if (
|
|
18292
18296
|
css === null ||
|
|
@@ -18512,18 +18516,18 @@ class Input$4 {
|
|
|
18512
18516
|
}
|
|
18513
18517
|
}
|
|
18514
18518
|
|
|
18515
|
-
var input = Input$
|
|
18516
|
-
Input$
|
|
18519
|
+
var input = Input$5;
|
|
18520
|
+
Input$5.default = Input$5;
|
|
18517
18521
|
|
|
18518
18522
|
if (terminalHighlight && terminalHighlight.registerInput) {
|
|
18519
|
-
terminalHighlight.registerInput(Input$
|
|
18523
|
+
terminalHighlight.registerInput(Input$5);
|
|
18520
18524
|
}
|
|
18521
18525
|
|
|
18522
18526
|
let { SourceMapConsumer, SourceMapGenerator } = sourceMap;
|
|
18523
18527
|
let { dirname, resolve, relative, sep } = require$$2;
|
|
18524
18528
|
let { pathToFileURL } = require$$1$1;
|
|
18525
18529
|
|
|
18526
|
-
let Input$
|
|
18530
|
+
let Input$4 = input;
|
|
18527
18531
|
|
|
18528
18532
|
let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
|
|
18529
18533
|
let pathAvailable = Boolean(dirname && resolve && relative && sep);
|
|
@@ -18558,7 +18562,7 @@ class MapGenerator$2 {
|
|
|
18558
18562
|
}
|
|
18559
18563
|
});
|
|
18560
18564
|
} else {
|
|
18561
|
-
let input = new Input$
|
|
18565
|
+
let input = new Input$4(this.css, this.opts);
|
|
18562
18566
|
if (input.map) this.previousMaps.push(input.map);
|
|
18563
18567
|
}
|
|
18564
18568
|
}
|
|
@@ -20198,10 +20202,10 @@ var parser = Parser$1;
|
|
|
20198
20202
|
|
|
20199
20203
|
let Container$P = container;
|
|
20200
20204
|
let Parser = parser;
|
|
20201
|
-
let Input$
|
|
20205
|
+
let Input$3 = input;
|
|
20202
20206
|
|
|
20203
20207
|
function parse$3(css, opts) {
|
|
20204
|
-
let input = new Input$
|
|
20208
|
+
let input = new Input$3(css, opts);
|
|
20205
20209
|
let parser = new Parser(input);
|
|
20206
20210
|
try {
|
|
20207
20211
|
parser.parse();
|
|
@@ -20990,7 +20994,7 @@ let Declaration$1 = declaration;
|
|
|
20990
20994
|
let PreviousMap = previousMap;
|
|
20991
20995
|
let Comment$1 = comment;
|
|
20992
20996
|
let AtRule$1 = atRule;
|
|
20993
|
-
let Input$
|
|
20997
|
+
let Input$2 = input;
|
|
20994
20998
|
let Root$1 = root;
|
|
20995
20999
|
let Rule$1 = rule;
|
|
20996
21000
|
|
|
@@ -21001,7 +21005,7 @@ function fromJSON$1(json, inputs) {
|
|
|
21001
21005
|
if (ownInputs) {
|
|
21002
21006
|
inputs = [];
|
|
21003
21007
|
for (let input of ownInputs) {
|
|
21004
|
-
let inputHydrated = { ...input, __proto__: Input$
|
|
21008
|
+
let inputHydrated = { ...input, __proto__: Input$2.prototype };
|
|
21005
21009
|
if (inputHydrated.map) {
|
|
21006
21010
|
inputHydrated.map = {
|
|
21007
21011
|
...inputHydrated.map,
|
|
@@ -21051,7 +21055,7 @@ let Warning = warning;
|
|
|
21051
21055
|
let Comment = comment;
|
|
21052
21056
|
let AtRule = atRule;
|
|
21053
21057
|
let Result$1 = result;
|
|
21054
|
-
let Input = input;
|
|
21058
|
+
let Input$1 = input;
|
|
21055
21059
|
let parse = parse_1;
|
|
21056
21060
|
let list = list_1;
|
|
21057
21061
|
let Rule = rule;
|
|
@@ -21129,7 +21133,7 @@ postcss.Comment = Comment;
|
|
|
21129
21133
|
postcss.Warning = Warning;
|
|
21130
21134
|
postcss.AtRule = AtRule;
|
|
21131
21135
|
postcss.Result = Result$1;
|
|
21132
|
-
postcss.Input = Input;
|
|
21136
|
+
postcss.Input = Input$1;
|
|
21133
21137
|
postcss.Rule = Rule;
|
|
21134
21138
|
postcss.Root = Root;
|
|
21135
21139
|
postcss.Node = Node;
|
|
@@ -23483,6 +23487,17 @@ const SubmitButton = styled.input`
|
|
|
23483
23487
|
}
|
|
23484
23488
|
`;
|
|
23485
23489
|
|
|
23490
|
+
/**
|
|
23491
|
+
* Primary UI component for user interaction
|
|
23492
|
+
* If value is set then treat as controlled component
|
|
23493
|
+
*/
|
|
23494
|
+
var Input = function (_a) {
|
|
23495
|
+
var _b = _a.type, type = _b === void 0 ? 'text' : _b, _c = _a.placeholder, placeholder = _c === void 0 ? '' : _c, _d = _a.isErrored, isErrored = _d === void 0 ? false : _d, errorText = _a.errorText, name = _a.name, maxLength = _a.maxLength, defaultValue = _a.defaultValue, onChange = _a.onChange, id = _a.id, value = _a.value;
|
|
23496
|
+
return (React.createElement(React.Fragment, null,
|
|
23497
|
+
errorText && React.createElement(ErrorText$1, null, errorText),
|
|
23498
|
+
typeof value !== 'undefined' ? (React.createElement(StyledInput, { onChange: onChange, type: type, placeholder: placeholder, name: name, isErrored: isErrored, maxLength: maxLength, value: value, id: id })) : (React.createElement(StyledInput, { onChange: onChange, type: type, placeholder: placeholder, name: name, isErrored: isErrored, maxLength: maxLength, defaultValue: defaultValue, id: id }))));
|
|
23499
|
+
};
|
|
23500
|
+
|
|
23486
23501
|
var CustomSearch = function (_a) {
|
|
23487
23502
|
var method = _a.method, path = _a.path, label = _a.label, _b = _a.hasHiddenLabel, hasHiddenLabel = _b === void 0 ? true : _b, fieldName = _a.fieldName, placeholder = _a.placeholder, searchText = _a.searchText, id = _a.id;
|
|
23488
23503
|
if (!id) {
|
|
@@ -23493,7 +23508,7 @@ var CustomSearch = function (_a) {
|
|
|
23493
23508
|
React.createElement("div", { role: "search" },
|
|
23494
23509
|
React.createElement(Label$3, { htmlFor: id, hasHiddenLabel: hasHiddenLabel }, label),
|
|
23495
23510
|
React.createElement(InputWrapper$1, null,
|
|
23496
|
-
React.createElement(Input
|
|
23511
|
+
React.createElement(Input, { name: fieldName, placeholder: placeholder, id: id }),
|
|
23497
23512
|
React.createElement(SubmitButton, { type: "submit", value: searchText }))))));
|
|
23498
23513
|
};
|
|
23499
23514
|
|
|
@@ -28058,7 +28073,7 @@ var PostCodeSearch = function (_a) {
|
|
|
28058
28073
|
React.createElement(Label$2, { htmlFor: "postcode" },
|
|
28059
28074
|
"Enter your postcode",
|
|
28060
28075
|
React.createElement(HintText, { text: themeContext.cardinal_name === 'north' ? 'For example NN16 0AP' : 'For example NN1 1DE' }),
|
|
28061
|
-
React.createElement(Input
|
|
28076
|
+
React.createElement(Input, { type: "text", placeholder: "Enter a postcode", name: "postcode", errorText: errorText, isErrored: isError, maxLength: 10 })),
|
|
28062
28077
|
React.createElement(FormButton, { type: "submit", "aria-label": "Submit", text: "Find" })))) : (React.createElement(PostcodeResult, null,
|
|
28063
28078
|
React.createElement(Line, null),
|
|
28064
28079
|
isMultiple ? (React.createElement("div", { className: "result" },
|
|
@@ -30316,13 +30331,13 @@ var DirectoryServiceList = function (_a) {
|
|
|
30316
30331
|
React.createElement(Column, { small: "full", medium: "one-half", large: "one-third" },
|
|
30317
30332
|
React.createElement(Label$1, { htmlFor: "directorySearch" }, "What are you looking for?"),
|
|
30318
30333
|
React.createElement(HintText, { text: "Enter a search word or phrase" }),
|
|
30319
|
-
React.createElement(Input
|
|
30334
|
+
React.createElement(Input, { name: "directorySearch", type: "text", defaultValue: searchTerm, id: "directorySearch", onChange: function (e) {
|
|
30320
30335
|
setSearchTerm(e.target.value);
|
|
30321
30336
|
} })),
|
|
30322
30337
|
React.createElement(Column, { small: "full", medium: "one-half", large: "one-third" },
|
|
30323
30338
|
React.createElement(Label$1, { htmlFor: "postcode" }, "Postcode (optional)"),
|
|
30324
30339
|
React.createElement(HintText, { text: "Enter a postcode" }),
|
|
30325
|
-
React.createElement(Input
|
|
30340
|
+
React.createElement(Input, { name: "postcode", type: "text", defaultValue: postcodeSearch, id: "postcode", onChange: function (e) { return setPostcodeSearch(e.target.value); } })),
|
|
30326
30341
|
React.createElement(Column, { small: "full", medium: "one-half", large: "one-third" },
|
|
30327
30342
|
React.createElement(ButtonContainer$1, null,
|
|
30328
30343
|
React.createElement(Button$1, { onClick: submitSearch, type: "submit" },
|
|
@@ -30356,10 +30371,10 @@ var DirectoryServiceList = function (_a) {
|
|
|
30356
30371
|
React.createElement(Row$1, null,
|
|
30357
30372
|
React.createElement(Column, { small: "full", medium: "one-half", large: "one-half" },
|
|
30358
30373
|
React.createElement(Label$1, { htmlFor: "minimum_age" }, "From"),
|
|
30359
|
-
React.createElement(Input
|
|
30374
|
+
React.createElement(Input, { name: "minimum_age", onChange: function (e) { return handleAgeChange(e, 'minimumAge'); }, value: ageInMonths && typeof minimumAge === 'number' ? minimumAge / 12 : minimumAge, id: "minimum_age", type: "number" })),
|
|
30360
30375
|
React.createElement(Column, { small: "full", medium: "one-half", large: "one-half" },
|
|
30361
30376
|
React.createElement(Label$1, { htmlFor: "maximum_age" }, "To"),
|
|
30362
|
-
React.createElement(Input
|
|
30377
|
+
React.createElement(Input, { name: "maximum_age", onChange: function (e) { return handleAgeChange(e, 'maximumAge'); }, value: ageInMonths && typeof maximumAge === 'number' ? maximumAge / 12 : maximumAge, id: "maximum_age", type: "number" })))))), categories === null || categories === void 0 ? void 0 :
|
|
30363
30378
|
categories.map(function (category, categoryIndex) { return (React.createElement(Column, { small: "full", medium: "full", large: "full", key: category.label },
|
|
30364
30379
|
React.createElement(Fieldset$1, null,
|
|
30365
30380
|
React.createElement(Legend$1, null,
|
|
@@ -32092,7 +32107,7 @@ var DirectoryDocumentList = function (_a) {
|
|
|
32092
32107
|
React.createElement(Column, { small: "full", medium: "one-half", large: "one-third" },
|
|
32093
32108
|
React.createElement(Label, { htmlFor: "directorySearch" }, "What are you looking for?"),
|
|
32094
32109
|
React.createElement(HintText, { text: "Enter a search word or phrase" }),
|
|
32095
|
-
React.createElement(Input
|
|
32110
|
+
React.createElement(Input, { name: "directorySearch", type: "text", defaultValue: searchTerm, id: "directorySearch", onChange: function (e) {
|
|
32096
32111
|
setSearchTerm(e.target.value);
|
|
32097
32112
|
} })),
|
|
32098
32113
|
React.createElement(Column, { small: "full", medium: "one-half", large: "one-third" },
|