@iabbb/bds-react 0.45.2 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Button/index.cjs +3 -1
- package/Button/index.cjs.map +1 -1
- package/CallToAction/index.cjs +3 -1
- package/CallToAction/index.cjs.map +1 -1
- package/ErrorMessage/ErrorMessage.d.ts +2 -0
- package/ErrorMessage/index.cjs +90 -0
- package/ErrorMessage/index.cjs.map +1 -0
- package/ErrorMessage/index.d.ts +1 -0
- package/ErrorMessage/index.mjs +67 -0
- package/ErrorMessage/index.mjs.map +1 -0
- package/ErrorMessage/package.json +7 -0
- package/ErrorSummary/ErrorSummary.d.ts +1 -2
- package/ErrorSummary/index.cjs +14 -9
- package/ErrorSummary/index.cjs.map +1 -1
- package/ErrorSummary/index.mjs +14 -9
- package/ErrorSummary/index.mjs.map +1 -1
- package/FieldCheckbox/FieldCheckbox.d.ts +6 -0
- package/FieldCheckbox/index.cjs +194 -0
- package/FieldCheckbox/index.cjs.map +1 -0
- package/FieldCheckbox/index.d.ts +1 -0
- package/FieldCheckbox/index.mjs +171 -0
- package/FieldCheckbox/index.mjs.map +1 -0
- package/FieldCheckbox/package.json +7 -0
- package/FieldRadio/FieldRadio.d.ts +5 -0
- package/FieldRadio/index.cjs +166 -0
- package/FieldRadio/index.cjs.map +1 -0
- package/FieldRadio/index.d.ts +1 -0
- package/FieldRadio/index.mjs +143 -0
- package/FieldRadio/index.mjs.map +1 -0
- package/FieldRadio/package.json +7 -0
- package/FieldTextInput/index.cjs +28 -14
- package/FieldTextInput/index.cjs.map +1 -1
- package/FieldTextInput/index.mjs +25 -13
- package/FieldTextInput/index.mjs.map +1 -1
- package/FieldTextarea/FieldTextarea.d.ts +9 -0
- package/FieldTextarea/index.cjs +120 -0
- package/FieldTextarea/index.cjs.map +1 -0
- package/FieldTextarea/index.d.ts +1 -0
- package/FieldTextarea/index.mjs +97 -0
- package/FieldTextarea/index.mjs.map +1 -0
- package/FieldTextarea/package.json +7 -0
- package/Fieldset/Fieldset.d.ts +9 -0
- package/Fieldset/index.cjs +119 -0
- package/Fieldset/index.cjs.map +1 -0
- package/Fieldset/index.d.ts +2 -0
- package/Fieldset/index.mjs +96 -0
- package/Fieldset/index.mjs.map +1 -0
- package/Fieldset/package.json +7 -0
- package/Pagination/index.cjs +3 -1
- package/Pagination/index.cjs.map +1 -1
- package/Typography/index.cjs +3 -1
- package/Typography/index.cjs.map +1 -1
- package/index.cjs +45 -28
- package/index.cjs.map +1 -1
- package/index.mjs +45 -28
- package/index.mjs.map +1 -1
- package/package.json +10 -10
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
|
|
7
|
+
function _interopNamespaceDefault(e) {
|
|
8
|
+
var n = Object.create(null);
|
|
9
|
+
if (e) {
|
|
10
|
+
Object.keys(e).forEach(function (k) {
|
|
11
|
+
if (k !== 'default') {
|
|
12
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return e[k]; }
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
n.default = e;
|
|
21
|
+
return Object.freeze(n);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
25
|
+
|
|
26
|
+
function _extends() {
|
|
27
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
28
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
29
|
+
var source = arguments[i];
|
|
30
|
+
for (var key in source) {
|
|
31
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
32
|
+
target[key] = source[key];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return target;
|
|
37
|
+
};
|
|
38
|
+
return _extends.apply(this, arguments);
|
|
39
|
+
}
|
|
40
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
41
|
+
if (source == null) return {};
|
|
42
|
+
var target = {};
|
|
43
|
+
var sourceKeys = Object.keys(source);
|
|
44
|
+
var key, i;
|
|
45
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
46
|
+
key = sourceKeys[i];
|
|
47
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
48
|
+
target[key] = source[key];
|
|
49
|
+
}
|
|
50
|
+
return target;
|
|
51
|
+
}
|
|
52
|
+
function _objectWithoutProperties(source, excluded) {
|
|
53
|
+
if (source == null) return {};
|
|
54
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
55
|
+
var key, i;
|
|
56
|
+
if (Object.getOwnPropertySymbols) {
|
|
57
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
58
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
59
|
+
key = sourceSymbolKeys[i];
|
|
60
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
61
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
62
|
+
target[key] = source[key];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return target;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var _excluded$1 = ["className", "children"];
|
|
69
|
+
function ErrorMessage(_ref) {
|
|
70
|
+
var className = _ref.className,
|
|
71
|
+
children = _ref.children,
|
|
72
|
+
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
73
|
+
return /*#__PURE__*/React__namespace.createElement("span", _extends({
|
|
74
|
+
className: ['bds-error', className].filter(function (x) {
|
|
75
|
+
return x;
|
|
76
|
+
}).join(' ')
|
|
77
|
+
}, props), /*#__PURE__*/React__namespace.createElement("svg", {
|
|
78
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
79
|
+
viewBox: "0 0 512 512",
|
|
80
|
+
"aria-hidden": "true",
|
|
81
|
+
height: "1em",
|
|
82
|
+
width: "1em",
|
|
83
|
+
fill: "currentColor"
|
|
84
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
85
|
+
d: "M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7.2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8.2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24v112c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224c0-17.7-14.3-32-32-32s-32 14.3-32 32 14.3 32 32 32 32-14.3 32-32z"
|
|
86
|
+
})), children);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
var _excluded = ["children", "className", "error", "hint", "isOptional", "legend", "showOptionsInline"];
|
|
90
|
+
function Fieldset(_ref) {
|
|
91
|
+
var children = _ref.children,
|
|
92
|
+
className = _ref.className,
|
|
93
|
+
error = _ref.error,
|
|
94
|
+
hint = _ref.hint,
|
|
95
|
+
isOptional = _ref.isOptional,
|
|
96
|
+
legend = _ref.legend,
|
|
97
|
+
showOptionsInline = _ref.showOptionsInline,
|
|
98
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
99
|
+
var errorId = React__namespace.useId();
|
|
100
|
+
var hintId = React__namespace.useId();
|
|
101
|
+
return /*#__PURE__*/React__namespace.createElement("fieldset", _extends({
|
|
102
|
+
"aria-describedby": error && hint ? "".concat(hintId, " ").concat(errorId) : error ? errorId : hint ? hintId : undefined,
|
|
103
|
+
"aria-invalid": !!error,
|
|
104
|
+
className: ['bds-fieldset', className].filter(function (x) {
|
|
105
|
+
return x;
|
|
106
|
+
}).join(' ')
|
|
107
|
+
}, props), /*#__PURE__*/React__namespace.createElement("legend", null, legend, isOptional && ' (optional)'), hint && /*#__PURE__*/React__namespace.createElement("span", {
|
|
108
|
+
className: "bds-hint",
|
|
109
|
+
id: hintId
|
|
110
|
+
}, hint), error && /*#__PURE__*/React__namespace.createElement(ErrorMessage, {
|
|
111
|
+
id: errorId
|
|
112
|
+
}, error), /*#__PURE__*/React__namespace.createElement("div", {
|
|
113
|
+
className: "bds-form-options",
|
|
114
|
+
"data-inline-options": showOptionsInline ? '' : undefined
|
|
115
|
+
}, children));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
exports.default = Fieldset;
|
|
119
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/Fieldset/Fieldset.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport default function ErrorMessage({ className, children, ...props }: React.ComponentPropsWithoutRef<'span'>) {\n return (\n <span className={['bds-error', className].filter((x) => x).join(' ')} {...props}>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 512 512\"\n aria-hidden=\"true\"\n height=\"1em\"\n width=\"1em\"\n fill=\"currentColor\"\n >\n <path d=\"M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7.2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8.2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24v112c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224c0-17.7-14.3-32-32-32s-32 14.3-32 32 14.3 32 32 32 32-14.3 32-32z\" />\n </svg>\n {children}\n </span>\n );\n}\n","import * as React from 'react';\nimport ErrorMessage from '../ErrorMessage';\n\nexport type FieldsetProps = {\n error?: string;\n hint?: string;\n isOptional?: boolean;\n legend: React.ReactNode | string;\n showOptionsInline?: boolean;\n};\n\nexport default function Fieldset({\n children,\n className,\n error,\n hint,\n isOptional,\n legend,\n showOptionsInline,\n ...props\n}: FieldsetProps & React.ComponentPropsWithoutRef<'fieldset'>) {\n const errorId = React.useId();\n const hintId = React.useId();\n\n return (\n <fieldset\n aria-describedby={error && hint ? `${hintId} ${errorId}` : error ? errorId : hint ? hintId : undefined}\n aria-invalid={!!error}\n className={['bds-fieldset', className].filter((x) => x).join(' ')}\n {...props}\n >\n <legend>\n {legend}\n {isOptional && ' (optional)'}\n </legend>\n {hint && (\n <span className=\"bds-hint\" id={hintId}>\n {hint}\n </span>\n )}\n {error && <ErrorMessage id={errorId}>{error}</ErrorMessage>}\n <div className=\"bds-form-options\" data-inline-options={showOptionsInline ? '' : undefined}>\n {children}\n </div>\n </fieldset>\n );\n}\n"],"names":["ErrorMessage","_ref","className","children","props","_objectWithoutProperties","_excluded","React","createElement","_extends","filter","x","join","xmlns","viewBox","height","width","fill","d","Fieldset","error","hint","isOptional","legend","showOptionsInline","errorId","useId","hintId","concat","undefined","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEe,SAASA,YAAYA,CAAAC,IAAA,EAA4E;AAAA,EAAA,IAAzEC,SAAS,GAAAD,IAAA,CAATC,SAAS;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;AAAKC,IAAAA,KAAK,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,WAAA,CAAA,CAAA;AAClE,EAAA,oBACEC,gBAAA,CAAAC,aAAA,CAAA,MAAA,EAAAC,QAAA,CAAA;IAAMP,SAAS,EAAE,CAAC,WAAW,EAAEA,SAAS,CAAC,CAACQ,MAAM,CAAC,UAACC,CAAC,EAAA;AAAA,MAAA,OAAKA,CAAC,CAAA;KAAC,CAAA,CAACC,IAAI,CAAC,GAAG,CAAA;AAAE,GAAA,EAAKR,KAAK,CAAA,eAC7EG,gBAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AACEK,IAAAA,KAAK,EAAC,4BAA4B;AAClCC,IAAAA,OAAO,EAAC,aAAa;AACrB,IAAA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,IAAI,CAAC,GAAG,CAAA;AAAE,GAAA,EAC9DR,KAAK,CAETG,eAAAA,gBAAA,CAAAC,aAAA,iBACGe,MAAM,EACND,UAAU,IAAI,aACT,CAAC,EACRD,IAAI,iBACHd,gBAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AAAMN,IAAAA,SAAS,EAAC,UAAU;AAAC4B,IAAAA,EAAE,EAAEH,MAAAA;GAC5BN,EAAAA,IACG,CACP,EACAD,KAAK,iBAAIb,gBAAA,CAAAC,aAAA,CAACR,YAAY,EAAA;AAAC8B,IAAAA,EAAE,EAAEL,OAAAA;AAAQ,GAAA,EAAEL,KAAoB,CAAC,eAC3Db,gBAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAKN,IAAAA,SAAS,EAAC,kBAAkB;IAAC,qBAAqBsB,EAAAA,iBAAiB,GAAG,EAAE,GAAGK,SAAAA;GAC7E1B,EAAAA,QACE,CACG,CAAC,CAAA;AAEf;;;;"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
function _extends() {
|
|
4
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
5
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
6
|
+
var source = arguments[i];
|
|
7
|
+
for (var key in source) {
|
|
8
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
9
|
+
target[key] = source[key];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return target;
|
|
14
|
+
};
|
|
15
|
+
return _extends.apply(this, arguments);
|
|
16
|
+
}
|
|
17
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
18
|
+
if (source == null) return {};
|
|
19
|
+
var target = {};
|
|
20
|
+
var sourceKeys = Object.keys(source);
|
|
21
|
+
var key, i;
|
|
22
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
23
|
+
key = sourceKeys[i];
|
|
24
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
25
|
+
target[key] = source[key];
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
function _objectWithoutProperties(source, excluded) {
|
|
30
|
+
if (source == null) return {};
|
|
31
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
32
|
+
var key, i;
|
|
33
|
+
if (Object.getOwnPropertySymbols) {
|
|
34
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
35
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
36
|
+
key = sourceSymbolKeys[i];
|
|
37
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
38
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
39
|
+
target[key] = source[key];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return target;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
var _excluded$1 = ["className", "children"];
|
|
46
|
+
function ErrorMessage(_ref) {
|
|
47
|
+
var className = _ref.className,
|
|
48
|
+
children = _ref.children,
|
|
49
|
+
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
50
|
+
return /*#__PURE__*/React.createElement("span", _extends({
|
|
51
|
+
className: ['bds-error', className].filter(function (x) {
|
|
52
|
+
return x;
|
|
53
|
+
}).join(' ')
|
|
54
|
+
}, props), /*#__PURE__*/React.createElement("svg", {
|
|
55
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
56
|
+
viewBox: "0 0 512 512",
|
|
57
|
+
"aria-hidden": "true",
|
|
58
|
+
height: "1em",
|
|
59
|
+
width: "1em",
|
|
60
|
+
fill: "currentColor"
|
|
61
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
62
|
+
d: "M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7.2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8.2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24v112c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224c0-17.7-14.3-32-32-32s-32 14.3-32 32 14.3 32 32 32 32-14.3 32-32z"
|
|
63
|
+
})), children);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
var _excluded = ["children", "className", "error", "hint", "isOptional", "legend", "showOptionsInline"];
|
|
67
|
+
function Fieldset(_ref) {
|
|
68
|
+
var children = _ref.children,
|
|
69
|
+
className = _ref.className,
|
|
70
|
+
error = _ref.error,
|
|
71
|
+
hint = _ref.hint,
|
|
72
|
+
isOptional = _ref.isOptional,
|
|
73
|
+
legend = _ref.legend,
|
|
74
|
+
showOptionsInline = _ref.showOptionsInline,
|
|
75
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
76
|
+
var errorId = React.useId();
|
|
77
|
+
var hintId = React.useId();
|
|
78
|
+
return /*#__PURE__*/React.createElement("fieldset", _extends({
|
|
79
|
+
"aria-describedby": error && hint ? "".concat(hintId, " ").concat(errorId) : error ? errorId : hint ? hintId : undefined,
|
|
80
|
+
"aria-invalid": !!error,
|
|
81
|
+
className: ['bds-fieldset', className].filter(function (x) {
|
|
82
|
+
return x;
|
|
83
|
+
}).join(' ')
|
|
84
|
+
}, props), /*#__PURE__*/React.createElement("legend", null, legend, isOptional && ' (optional)'), hint && /*#__PURE__*/React.createElement("span", {
|
|
85
|
+
className: "bds-hint",
|
|
86
|
+
id: hintId
|
|
87
|
+
}, hint), error && /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
88
|
+
id: errorId
|
|
89
|
+
}, error), /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: "bds-form-options",
|
|
91
|
+
"data-inline-options": showOptionsInline ? '' : undefined
|
|
92
|
+
}, children));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export { Fieldset as default };
|
|
96
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/Fieldset/Fieldset.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport default function ErrorMessage({ className, children, ...props }: React.ComponentPropsWithoutRef<'span'>) {\n return (\n <span className={['bds-error', className].filter((x) => x).join(' ')} {...props}>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 512 512\"\n aria-hidden=\"true\"\n height=\"1em\"\n width=\"1em\"\n fill=\"currentColor\"\n >\n <path d=\"M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7.2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8.2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24v112c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224c0-17.7-14.3-32-32-32s-32 14.3-32 32 14.3 32 32 32 32-14.3 32-32z\" />\n </svg>\n {children}\n </span>\n );\n}\n","import * as React from 'react';\nimport ErrorMessage from '../ErrorMessage';\n\nexport type FieldsetProps = {\n error?: string;\n hint?: string;\n isOptional?: boolean;\n legend: React.ReactNode | string;\n showOptionsInline?: boolean;\n};\n\nexport default function Fieldset({\n children,\n className,\n error,\n hint,\n isOptional,\n legend,\n showOptionsInline,\n ...props\n}: FieldsetProps & React.ComponentPropsWithoutRef<'fieldset'>) {\n const errorId = React.useId();\n const hintId = React.useId();\n\n return (\n <fieldset\n aria-describedby={error && hint ? `${hintId} ${errorId}` : error ? errorId : hint ? hintId : undefined}\n aria-invalid={!!error}\n className={['bds-fieldset', className].filter((x) => x).join(' ')}\n {...props}\n >\n <legend>\n {legend}\n {isOptional && ' (optional)'}\n </legend>\n {hint && (\n <span className=\"bds-hint\" id={hintId}>\n {hint}\n </span>\n )}\n {error && <ErrorMessage id={errorId}>{error}</ErrorMessage>}\n <div className=\"bds-form-options\" data-inline-options={showOptionsInline ? '' : undefined}>\n {children}\n </div>\n </fieldset>\n );\n}\n"],"names":["ErrorMessage","_ref","className","children","props","_objectWithoutProperties","_excluded","React","createElement","_extends","filter","x","join","xmlns","viewBox","height","width","fill","d","Fieldset","error","hint","isOptional","legend","showOptionsInline","errorId","useId","hintId","concat","undefined","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEe,SAASA,YAAYA,CAAAC,IAAA,EAA4E;AAAA,EAAA,IAAzEC,SAAS,GAAAD,IAAA,CAATC,SAAS;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;AAAKC,IAAAA,KAAK,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,WAAA,CAAA,CAAA;AAClE,EAAA,oBACEC,KAAA,CAAAC,aAAA,CAAA,MAAA,EAAAC,QAAA,CAAA;IAAMP,SAAS,EAAE,CAAC,WAAW,EAAEA,SAAS,CAAC,CAACQ,MAAM,CAAC,UAACC,CAAC,EAAA;AAAA,MAAA,OAAKA,CAAC,CAAA;KAAC,CAAA,CAACC,IAAI,CAAC,GAAG,CAAA;AAAE,GAAA,EAAKR,KAAK,CAAA,eAC7EG,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AACEK,IAAAA,KAAK,EAAC,4BAA4B;AAClCC,IAAAA,OAAO,EAAC,aAAa;AACrB,IAAA,aAAA,EAAY,MAAM;AAClBC,IAAAA,MAAM,EAAC,KAAK;AACZC,IAAAA,KAAK,EAAC,KAAK;AACXC,IAAAA,IAAI,EAAC,cAAA;GAELV,eAAAA,KAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AAAMU,IAAAA,CAAC,EAAC,4UAAA;AAA4U,GAAE,CACnV,CAAC,EACLf,QACG,CAAC,CAAA;AAEX;;;ACPe,SAASgB,QAAQA,CAAAlB,IAAA,EAS+B;AAAA,EAAA,IAR7DE,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRD,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTkB,K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,eAC3Db,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAKN,IAAAA,SAAS,EAAC,kBAAkB;IAAC,qBAAqBsB,EAAAA,iBAAiB,GAAG,EAAE,GAAGK,SAAAA;GAC7E1B,EAAAA,QACE,CACG,CAAC,CAAA;AAEf;;;;"}
|
package/Pagination/index.cjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var React = require('react');
|
|
4
6
|
|
|
5
7
|
function _interopNamespaceDefault(e) {
|
|
@@ -176,5 +178,5 @@ function Pagination(_ref) {
|
|
|
176
178
|
})))));
|
|
177
179
|
}
|
|
178
180
|
|
|
179
|
-
|
|
181
|
+
exports.default = Pagination;
|
|
180
182
|
//# sourceMappingURL=index.cjs.map
|
package/Pagination/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/Pagination/Pagination.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport type PaginationProps = {\n buildPageUrl: (page: number) => string;\n currentPage: number;\n onPageClick?: (page: number) => void;\n totalPages: number;\n};\n\nfunction usePages(currentPage: number, totalPages: number) {\n const pages = [1, currentPage - 1, currentPage, currentPage + 1, totalPages].filter(\n (x) => x >= 1 && x <= totalPages,\n );\n return [...new Set(pages)];\n}\n\nexport default function Pagination({\n buildPageUrl,\n className,\n currentPage,\n onPageClick,\n totalPages,\n ...props\n}: PaginationProps & React.ComponentPropsWithoutRef<'nav'>) {\n const pages = usePages(currentPage, totalPages);\n\n return (\n <nav aria-label=\"pagination\" className={['bds-pagination', className].filter((x) => x).join(' ')} {...props}>\n {currentPage !== 1 && (\n <>\n <a href={buildPageUrl(1)} className=\"bds-first-page\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n focusable=\"false\"\n height=\"1em\"\n width=\"100%\"\n viewBox=\"0 63.95 512 384.1\"\n >\n <path d=\"M459.5 440.6c9.5 7.9 22.8 9.7 34.1 4.4s18.4-16.6 18.4-29V96c0-12.4-7.2-23.7-18.4-29s-24.5-3.6-34.1 4.4L288 214.3v83.4l171.5 142.9zM256 352V96c0-12.4-7.2-23.7-18.4-29s-24.5-3.6-34.1 4.4l-192 160C4.2 237.5 0 246.5 0 256s4.2 18.5 11.5 24.6l192 160c9.5 7.9 22.8 9.7 34.1 4.4s18.4-16.6 18.4-29v-64z\" />\n </svg>\n First\n </a>\n <a aria-label=\"previous\" href={buildPageUrl(currentPage - 1)} rel=\"prev\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n focusable=\"false\"\n width=\"100%\"\n height=\"1em\"\n viewBox=\"0.02 95.9 192.08 320.17\"\n >\n <path d=\"M9.4 278.6c-12.5-12.5-12.5-32.8 0-45.3l128-128c9.2-9.2 22.9-11.9 34.9-6.9s19.8 16.6 19.8 29.6v256c0 12.9-7.8 24.6-19.8 29.6s-25.7 2.2-34.9-6.9l-128-128z\" />\n </svg>\n Prev.\n </a>\n </>\n )}\n <ul>\n {pages.map((page, index) => {\n const handlePageClick = () => {\n if (!onPageClick) return;\n\n onPageClick(page);\n };\n\n return (\n <React.Fragment key={page}>\n <li>\n <a\n aria-current={page === currentPage ? 'page' : undefined}\n href={buildPageUrl(page)}\n onClick={handlePageClick}\n >\n <span className=\"visually-hidden\">Page</span> {page}\n </a>\n </li>\n {pages[index + 1] > page + 1 ? <li data-overflow=\"\">...</li> : null}\n </React.Fragment>\n );\n })}\n </ul>\n {currentPage !== totalPages && (\n <>\n <a href={buildPageUrl(currentPage + 1)} rel=\"next\">\n Next\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n focusable=\"false\"\n viewBox=\"63.9 95.9 192.1 320.17\"\n width=\"100%\"\n height=\"1em\"\n >\n <path d=\"M246.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-128-128c-9.2-9.2-22.9-11.9-34.9-6.9S63.9 115 63.9 128v256c0 12.9 7.8 24.6 19.8 29.6s25.7 2.2 34.9-6.9l128-128z\" />\n </svg>\n </a>\n <a href={buildPageUrl(totalPages)} className=\"bds-last-page\">\n Last\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n focusable=\"false\"\n width=\"100%\"\n height=\"1em\"\n viewBox=\"0 63.95 512 384.1\"\n >\n <path d=\"M52.5 440.6c-9.5 7.9-22.8 9.7-34.1 4.4S0 428.4 0 416V96c0-12.4 7.2-23.7 18.4-29s24.5-3.6 34.1 4.4L224 214.3v83.4L52.5 440.6zM256 352V96c0-12.4 7.2-23.7 18.4-29s24.5-3.6 34.1 4.4l192 160c7.3 6.1 11.5 15.1 11.5 24.6s-4.2 18.5-11.5 24.6l-192 160c-9.5 7.9-22.8 9.7-34.1 4.4S256 428.4 256 416v-64z\" />\n </svg>\n </a>\n </>\n )}\n </nav>\n );\n}\n"],"names":["usePages","currentPage","totalPages","pages","filter","x","_toConsumableArray","Set","Pagination","_ref","buildPageUrl","className","onPageClick","props","_objectWithoutProperties","_excluded","React","createElement","_extends","join","Fragment","href","xmlns","focusable","height","width","viewBox","d","rel","map","page","index","handlePageClick","key","undefined","onClick"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/Pagination/Pagination.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport type PaginationProps = {\n buildPageUrl: (page: number) => string;\n currentPage: number;\n onPageClick?: (page: number) => void;\n totalPages: number;\n};\n\nfunction usePages(currentPage: number, totalPages: number) {\n const pages = [1, currentPage - 1, currentPage, currentPage + 1, totalPages].filter(\n (x) => x >= 1 && x <= totalPages,\n );\n return [...new Set(pages)];\n}\n\nexport default function Pagination({\n buildPageUrl,\n className,\n currentPage,\n onPageClick,\n totalPages,\n ...props\n}: PaginationProps & React.ComponentPropsWithoutRef<'nav'>) {\n const pages = usePages(currentPage, totalPages);\n\n return (\n <nav aria-label=\"pagination\" className={['bds-pagination', className].filter((x) => x).join(' ')} {...props}>\n {currentPage !== 1 && (\n <>\n <a href={buildPageUrl(1)} className=\"bds-first-page\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n focusable=\"false\"\n height=\"1em\"\n width=\"100%\"\n viewBox=\"0 63.95 512 384.1\"\n >\n <path d=\"M459.5 440.6c9.5 7.9 22.8 9.7 34.1 4.4s18.4-16.6 18.4-29V96c0-12.4-7.2-23.7-18.4-29s-24.5-3.6-34.1 4.4L288 214.3v83.4l171.5 142.9zM256 352V96c0-12.4-7.2-23.7-18.4-29s-24.5-3.6-34.1 4.4l-192 160C4.2 237.5 0 246.5 0 256s4.2 18.5 11.5 24.6l192 160c9.5 7.9 22.8 9.7 34.1 4.4s18.4-16.6 18.4-29v-64z\" />\n </svg>\n First\n </a>\n <a aria-label=\"previous\" href={buildPageUrl(currentPage - 1)} rel=\"prev\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n focusable=\"false\"\n width=\"100%\"\n height=\"1em\"\n viewBox=\"0.02 95.9 192.08 320.17\"\n >\n <path d=\"M9.4 278.6c-12.5-12.5-12.5-32.8 0-45.3l128-128c9.2-9.2 22.9-11.9 34.9-6.9s19.8 16.6 19.8 29.6v256c0 12.9-7.8 24.6-19.8 29.6s-25.7 2.2-34.9-6.9l-128-128z\" />\n </svg>\n Prev.\n </a>\n </>\n )}\n <ul>\n {pages.map((page, index) => {\n const handlePageClick = () => {\n if (!onPageClick) return;\n\n onPageClick(page);\n };\n\n return (\n <React.Fragment key={page}>\n <li>\n <a\n aria-current={page === currentPage ? 'page' : undefined}\n href={buildPageUrl(page)}\n onClick={handlePageClick}\n >\n <span className=\"visually-hidden\">Page</span> {page}\n </a>\n </li>\n {pages[index + 1] > page + 1 ? <li data-overflow=\"\">...</li> : null}\n </React.Fragment>\n );\n })}\n </ul>\n {currentPage !== totalPages && (\n <>\n <a href={buildPageUrl(currentPage + 1)} rel=\"next\">\n Next\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n focusable=\"false\"\n viewBox=\"63.9 95.9 192.1 320.17\"\n width=\"100%\"\n height=\"1em\"\n >\n <path d=\"M246.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-128-128c-9.2-9.2-22.9-11.9-34.9-6.9S63.9 115 63.9 128v256c0 12.9 7.8 24.6 19.8 29.6s25.7 2.2 34.9-6.9l128-128z\" />\n </svg>\n </a>\n <a href={buildPageUrl(totalPages)} className=\"bds-last-page\">\n Last\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n focusable=\"false\"\n width=\"100%\"\n height=\"1em\"\n viewBox=\"0 63.95 512 384.1\"\n >\n <path d=\"M52.5 440.6c-9.5 7.9-22.8 9.7-34.1 4.4S0 428.4 0 416V96c0-12.4 7.2-23.7 18.4-29s24.5-3.6 34.1 4.4L224 214.3v83.4L52.5 440.6zM256 352V96c0-12.4 7.2-23.7 18.4-29s24.5-3.6 34.1 4.4l192 160c7.3 6.1 11.5 15.1 11.5 24.6s-4.2 18.5-11.5 24.6l-192 160c-9.5 7.9-22.8 9.7-34.1 4.4S256 428.4 256 416v-64z\" />\n </svg>\n </a>\n </>\n )}\n </nav>\n );\n}\n"],"names":["usePages","currentPage","totalPages","pages","filter","x","_toConsumableArray","Set","Pagination","_ref","buildPageUrl","className","onPageClick","props","_objectWithoutProperties","_excluded","React","createElement","_extends","join","Fragment","href","xmlns","focusable","height","width","viewBox","d","rel","map","page","index","handlePageClick","key","undefined","onClick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,SAASA,QAAQA,CAACC,WAAmB,EAAEC,UAAkB,EAAE;EACzD,IAAMC,KAAK,GAAG,CAAC,CAAC,EAAEF,WAAW,GAAG,CAAC,EAAEA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CAAC,EAAC,yJAAA;AAAyJ,GAAE,CAChK,CACJ,CAAC,eACJX,gBAAA,CAAAC,aAAA,CAAA,GAAA,EAAA;AAAGI,IAAAA,IAAI,EAAEX,YAAY,CAACR,UAAU,CAAE;AAACS,IAAAA,SAAS,EAAC,eAAA;AAAe,GAAA,EAAC,MAE3D,eAAAK,gBAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AACEK,IAAAA,KAAK,EAAC,4BAA4B;AAClC,IAAA,aAAA,EAAY,MAAM;AAClBC,IAAAA,SAAS,EAAC,OAAO;AACjBE,IAAAA,KAAK,EAAC,MAAM;AACZD,IAAAA,MAAM,EAAC,KAAK;AACZE,IAAAA,OAAO,EAAC,mBAAA;GAERV,eAAAA,gBAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AAAMU,IAAAA,CAAC,EAAC,sSAAA;AAAsS,GAAE,CAC7S,CACJ,CACH,CAED,CAAC,CAAA;AAEV;;;;"}
|
package/Typography/index.cjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var React = require('react');
|
|
4
6
|
|
|
5
7
|
function _interopNamespaceDefault(e) {
|
|
@@ -95,5 +97,5 @@ var Typography = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
|
95
97
|
}, props));
|
|
96
98
|
});
|
|
97
99
|
|
|
98
|
-
|
|
100
|
+
exports.default = Typography;
|
|
99
101
|
//# sourceMappingURL=index.cjs.map
|
package/Typography/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/Typography/Typography.tsx"],"sourcesContent":["import * as React from 'react';\n\nconst componentMap = {\n h1: 'h1',\n h2: 'h2',\n h3: 'h3',\n h4: 'h4',\n h5: 'h5',\n body: 'p',\n};\n\nconst classMap = {\n h1: 'bds-h1',\n h2: 'bds-h2',\n h3: 'bds-h3',\n h4: 'bds-h4',\n h5: 'bds-h5',\n body: 'bds-body',\n};\n\nexport type TypographyProps = {\n component?: React.ElementType;\n variant?: 'body' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5';\n};\n\nconst Typography = React.forwardRef<HTMLOrSVGElement, React.HTMLAttributes<HTMLOrSVGElement> & TypographyProps>(\n ({ className, component, variant = 'body', ...props }, ref) => {\n const Component = component ?? (componentMap[variant] as React.ElementType);\n\n return (\n <Component className={[classMap[variant], className].filter((x) => x).join(' ')} ref={ref} {...props} />\n );\n },\n);\n\nexport default Typography;\n"],"names":["componentMap","h1","h2","h3","h4","h5","body","classMap","Typography","React","forwardRef","_ref","ref","className","component","_ref$variant","variant","props","_objectWithoutProperties","_excluded","Component","createElement","_extends","filter","x","join"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/Typography/Typography.tsx"],"sourcesContent":["import * as React from 'react';\n\nconst componentMap = {\n h1: 'h1',\n h2: 'h2',\n h3: 'h3',\n h4: 'h4',\n h5: 'h5',\n body: 'p',\n};\n\nconst classMap = {\n h1: 'bds-h1',\n h2: 'bds-h2',\n h3: 'bds-h3',\n h4: 'bds-h4',\n h5: 'bds-h5',\n body: 'bds-body',\n};\n\nexport type TypographyProps = {\n component?: React.ElementType;\n variant?: 'body' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5';\n};\n\nconst Typography = React.forwardRef<HTMLOrSVGElement, React.HTMLAttributes<HTMLOrSVGElement> & TypographyProps>(\n ({ className, component, variant = 'body', ...props }, ref) => {\n const Component = component ?? (componentMap[variant] as React.ElementType);\n\n return (\n <Component className={[classMap[variant], className].filter((x) => x).join(' ')} ref={ref} {...props} />\n );\n },\n);\n\nexport default Typography;\n"],"names":["componentMap","h1","h2","h3","h4","h5","body","classMap","Typography","React","forwardRef","_ref","ref","className","component","_ref$variant","variant","props","_objectWithoutProperties","_excluded","Component","createElement","_extends","filter","x","join"],"mappings":";;;;;;;;;;;;;;;;;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A,CAAC,CAAA;AAAA,KAAA,CAAC,CAACC,IAAI,CAAC,GAAG,CAAE;AAACb,IAAAA,GAAG,EAAEA,GAAAA;GAASK,EAAAA,KAAK,CAAG,CAAC,CAAA;AAE5G,CACF;;;;"}
|
package/index.cjs
CHANGED
|
@@ -88,7 +88,7 @@ function _nonIterableSpread() {
|
|
|
88
88
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
var _excluded$
|
|
91
|
+
var _excluded$6 = ["children", "className", "onClick", "preventDoubleClick", "variant"];
|
|
92
92
|
var DEBOUNCE_TIMEOUT_IN_SECONDS = 1;
|
|
93
93
|
var Button = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
94
94
|
var children = _ref.children,
|
|
@@ -98,7 +98,7 @@ var Button = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
|
98
98
|
preventDoubleClick = _ref$preventDoubleCli === void 0 ? false : _ref$preventDoubleCli,
|
|
99
99
|
_ref$variant = _ref.variant,
|
|
100
100
|
variant = _ref$variant === void 0 ? 'standard' : _ref$variant,
|
|
101
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
101
|
+
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
102
102
|
var debounceClicks = React__namespace.useRef(false);
|
|
103
103
|
var handleClick = function handleClick(event) {
|
|
104
104
|
// 👇 button is not configured to ignore double clicks
|
|
@@ -136,13 +136,13 @@ var Button = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
|
136
136
|
}, props), children);
|
|
137
137
|
});
|
|
138
138
|
|
|
139
|
-
var _excluded$
|
|
139
|
+
var _excluded$5 = ["children", "className", "variant"];
|
|
140
140
|
var CallToAction = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
141
141
|
var children = _ref.children,
|
|
142
142
|
className = _ref.className,
|
|
143
143
|
_ref$variant = _ref.variant,
|
|
144
144
|
variant = _ref$variant === void 0 ? 'standard' : _ref$variant,
|
|
145
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
145
|
+
props = _objectWithoutProperties(_ref, _excluded$5);
|
|
146
146
|
return /*#__PURE__*/React__namespace.createElement("a", _extends({
|
|
147
147
|
className: ['bds-cta', className].filter(function (x) {
|
|
148
148
|
return x;
|
|
@@ -191,18 +191,24 @@ function getAssociatedLegendOrLabel(input) {
|
|
|
191
191
|
return (_document$querySelect = document.querySelector("label[for='".concat(input.getAttribute('id'), "']"))) !== null && _document$querySelect !== void 0 ? _document$querySelect : input.closest('label');
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
var _excluded$
|
|
194
|
+
var _excluded$4 = ["errors", "mapNameToId"];
|
|
195
195
|
var FormErrorKey = '_form';
|
|
196
196
|
var FINAL_FORM_ERROR = 'FINAL_FORM/form-error';
|
|
197
|
-
|
|
197
|
+
function BdsErrorSummary(_ref) {
|
|
198
198
|
var errors = _ref.errors,
|
|
199
199
|
_ref$mapNameToId = _ref.mapNameToId,
|
|
200
200
|
mapNameToId = _ref$mapNameToId === void 0 ? function (name) {
|
|
201
201
|
return name;
|
|
202
202
|
} : _ref$mapNameToId,
|
|
203
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
203
|
+
props = _objectWithoutProperties(_ref, _excluded$4);
|
|
204
204
|
var headingId = React__namespace.useId();
|
|
205
|
-
var
|
|
205
|
+
var groupRef = React__namespace.useRef(null);
|
|
206
|
+
React__namespace.useEffect(function () {
|
|
207
|
+
if (!errors || Object.keys(errors).length === 0) return;
|
|
208
|
+
if (!groupRef.current) return;
|
|
209
|
+
groupRef.current.focus();
|
|
210
|
+
}, [errors]);
|
|
211
|
+
if (!errors || Object.keys(errors).length === 0) return null;
|
|
206
212
|
var handleLinkClick = function handleLinkClick(e) {
|
|
207
213
|
var inputId = getFragmentFromUrl(e.currentTarget.href);
|
|
208
214
|
if (!inputId) {
|
|
@@ -224,11 +230,10 @@ var ErrorSummary = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref)
|
|
|
224
230
|
};
|
|
225
231
|
return /*#__PURE__*/React__namespace.createElement("bds-error-summary", _extends({
|
|
226
232
|
role: "group",
|
|
227
|
-
"aria-labelledby":
|
|
228
|
-
|
|
229
|
-
ref: ref,
|
|
233
|
+
"aria-labelledby": headingId,
|
|
234
|
+
ref: groupRef,
|
|
230
235
|
tabIndex: -1
|
|
231
|
-
}, props),
|
|
236
|
+
}, props), /*#__PURE__*/React__namespace.createElement("h2", {
|
|
232
237
|
className: "bds-h5",
|
|
233
238
|
id: headingId
|
|
234
239
|
}, /*#__PURE__*/React__namespace.createElement("svg", {
|
|
@@ -264,8 +269,29 @@ var ErrorSummary = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref)
|
|
|
264
269
|
onClick: handleLinkClick
|
|
265
270
|
}, fieldMessage, messages.length > 1 ? " (".concat(index + 1, " of ").concat(messages.length, ")") : undefined));
|
|
266
271
|
}));
|
|
267
|
-
})))
|
|
268
|
-
}
|
|
272
|
+
})));
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
var _excluded$3 = ["className", "children"];
|
|
276
|
+
function ErrorMessage(_ref) {
|
|
277
|
+
var className = _ref.className,
|
|
278
|
+
children = _ref.children,
|
|
279
|
+
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
280
|
+
return /*#__PURE__*/React__namespace.createElement("span", _extends({
|
|
281
|
+
className: ['bds-error', className].filter(function (x) {
|
|
282
|
+
return x;
|
|
283
|
+
}).join(' ')
|
|
284
|
+
}, props), /*#__PURE__*/React__namespace.createElement("svg", {
|
|
285
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
286
|
+
viewBox: "0 0 512 512",
|
|
287
|
+
"aria-hidden": "true",
|
|
288
|
+
height: "1em",
|
|
289
|
+
width: "1em",
|
|
290
|
+
fill: "currentColor"
|
|
291
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
292
|
+
d: "M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7.2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8.2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24v112c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224c0-17.7-14.3-32-32-32s-32 14.3-32 32 14.3 32 32 32 32-14.3 32-32z"
|
|
293
|
+
})), children);
|
|
294
|
+
}
|
|
269
295
|
|
|
270
296
|
var _excluded$2 = ["as", "error", "hint", "id", "isOptional", "label"];
|
|
271
297
|
function FieldTextInput(_ref) {
|
|
@@ -283,27 +309,18 @@ function FieldTextInput(_ref) {
|
|
|
283
309
|
var hintId = React__namespace.useId();
|
|
284
310
|
var InputComponent = as !== null && as !== void 0 ? as : 'input';
|
|
285
311
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
286
|
-
className: "bds-
|
|
312
|
+
className: "bds-form-group"
|
|
287
313
|
}, /*#__PURE__*/React__namespace.createElement("label", {
|
|
288
314
|
htmlFor: id
|
|
289
315
|
}, label, isOptional && ' (optional)'), hint && /*#__PURE__*/React__namespace.createElement("span", {
|
|
290
316
|
className: "bds-hint",
|
|
291
317
|
id: hintId
|
|
292
|
-
}, hint), error && /*#__PURE__*/React__namespace.createElement(
|
|
293
|
-
className: "bds-error",
|
|
318
|
+
}, hint), error && /*#__PURE__*/React__namespace.createElement(ErrorMessage, {
|
|
294
319
|
id: errorId
|
|
295
|
-
}, /*#__PURE__*/React__namespace.createElement(
|
|
296
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
297
|
-
viewBox: "0 0 512 512",
|
|
298
|
-
"aria-hidden": "true",
|
|
299
|
-
height: "1em",
|
|
300
|
-
width: "1em",
|
|
301
|
-
fill: "currentColor"
|
|
302
|
-
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
303
|
-
d: "M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7.2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8.2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24v112c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224c0-17.7-14.3-32-32-32s-32 14.3-32 32 14.3 32 32 32 32-14.3 32-32z"
|
|
304
|
-
})), error), /*#__PURE__*/React__namespace.createElement(InputComponent, _extends({
|
|
320
|
+
}, error), /*#__PURE__*/React__namespace.createElement(InputComponent, _extends({
|
|
305
321
|
"aria-invalid": error ? true : undefined,
|
|
306
322
|
"aria-describedby": error && hint ? "".concat(hintId, " ").concat(errorId) : error ? errorId : hint ? hintId : undefined,
|
|
323
|
+
className: "bds-text-input",
|
|
307
324
|
id: id
|
|
308
325
|
}, props)));
|
|
309
326
|
}
|
|
@@ -430,7 +447,7 @@ var Typography = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
|
430
447
|
|
|
431
448
|
exports.Button = Button;
|
|
432
449
|
exports.CallToAction = CallToAction;
|
|
433
|
-
exports.ErrorSummary =
|
|
450
|
+
exports.ErrorSummary = BdsErrorSummary;
|
|
434
451
|
exports.FieldTextInput = FieldTextInput;
|
|
435
452
|
exports.Pagination = Pagination;
|
|
436
453
|
exports.Typography = Typography;
|