@iabbb/bds-react 0.46.5 → 0.47.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 +22 -34
- package/Button/index.cjs.map +1 -1
- package/Button/index.mjs +22 -34
- package/Button/index.mjs.map +1 -1
- package/CallToAction/index.cjs +22 -34
- package/CallToAction/index.cjs.map +1 -1
- package/CallToAction/index.mjs +22 -34
- package/CallToAction/index.mjs.map +1 -1
- package/ErrorMessage/index.cjs +22 -34
- package/ErrorMessage/index.cjs.map +1 -1
- package/ErrorMessage/index.mjs +22 -34
- package/ErrorMessage/index.mjs.map +1 -1
- package/ErrorSummary/index.cjs +22 -34
- package/ErrorSummary/index.cjs.map +1 -1
- package/ErrorSummary/index.mjs +22 -34
- package/ErrorSummary/index.mjs.map +1 -1
- package/FieldCheckbox/FieldCheckbox.d.ts +2 -2
- package/FieldCheckbox/index.cjs +44 -60
- package/FieldCheckbox/index.cjs.map +1 -1
- package/FieldCheckbox/index.mjs +44 -60
- package/FieldCheckbox/index.mjs.map +1 -1
- package/FieldRadio/index.cjs +44 -60
- package/FieldRadio/index.cjs.map +1 -1
- package/FieldRadio/index.mjs +44 -60
- package/FieldRadio/index.mjs.map +1 -1
- package/FieldSelect/FieldSelect.d.ts +9 -0
- package/FieldSelect/index.cjs +109 -0
- package/FieldSelect/index.cjs.map +1 -0
- package/FieldSelect/index.d.ts +1 -0
- package/FieldSelect/index.mjs +86 -0
- package/FieldSelect/index.mjs.map +1 -0
- package/FieldSelect/package.json +7 -0
- package/FieldTextInput/index.cjs +22 -34
- package/FieldTextInput/index.cjs.map +1 -1
- package/FieldTextInput/index.mjs +22 -34
- package/FieldTextInput/index.mjs.map +1 -1
- package/FieldTextarea/index.cjs +22 -34
- package/FieldTextarea/index.cjs.map +1 -1
- package/FieldTextarea/index.mjs +22 -34
- package/FieldTextarea/index.mjs.map +1 -1
- package/Fieldset/index.cjs +22 -34
- package/Fieldset/index.cjs.map +1 -1
- package/Fieldset/index.mjs +22 -34
- package/Fieldset/index.mjs.map +1 -1
- package/Pagination/index.cjs +43 -56
- package/Pagination/index.cjs.map +1 -1
- package/Pagination/index.mjs +43 -56
- package/Pagination/index.mjs.map +1 -1
- package/Typography/index.cjs +22 -34
- package/Typography/index.cjs.map +1 -1
- package/Typography/index.mjs +22 -34
- package/Typography/index.mjs.map +1 -1
- package/index.cjs +43 -56
- package/index.cjs.map +1 -1
- package/index.mjs +43 -56
- package/index.mjs.map +1 -1
- package/package.json +10 -10
package/FieldRadio/index.cjs
CHANGED
|
@@ -23,6 +23,23 @@ function _interopNamespaceDefault(e) {
|
|
|
23
23
|
|
|
24
24
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
25
25
|
|
|
26
|
+
function _arrayLikeToArray(r, a) {
|
|
27
|
+
(null == a || a > r.length) && (a = r.length);
|
|
28
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
29
|
+
return n;
|
|
30
|
+
}
|
|
31
|
+
function _arrayWithHoles(r) {
|
|
32
|
+
if (Array.isArray(r)) return r;
|
|
33
|
+
}
|
|
34
|
+
function _extends() {
|
|
35
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
36
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
37
|
+
var t = arguments[e];
|
|
38
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
39
|
+
}
|
|
40
|
+
return n;
|
|
41
|
+
}, _extends.apply(null, arguments);
|
|
42
|
+
}
|
|
26
43
|
function _iterableToArrayLimit(r, l) {
|
|
27
44
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
28
45
|
if (null != t) {
|
|
@@ -34,10 +51,7 @@ function _iterableToArrayLimit(r, l) {
|
|
|
34
51
|
f = !0,
|
|
35
52
|
o = !1;
|
|
36
53
|
try {
|
|
37
|
-
if (i = (t = t.call(r)).next, 0 === l)
|
|
38
|
-
if (Object(t) !== t) return;
|
|
39
|
-
f = !1;
|
|
40
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
54
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
41
55
|
} catch (r) {
|
|
42
56
|
o = !0, n = r;
|
|
43
57
|
} finally {
|
|
@@ -50,68 +64,38 @@ function _iterableToArrayLimit(r, l) {
|
|
|
50
64
|
return a;
|
|
51
65
|
}
|
|
52
66
|
}
|
|
53
|
-
function
|
|
54
|
-
|
|
55
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
56
|
-
var source = arguments[i];
|
|
57
|
-
for (var key in source) {
|
|
58
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
59
|
-
target[key] = source[key];
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return target;
|
|
64
|
-
};
|
|
65
|
-
return _extends.apply(this, arguments);
|
|
66
|
-
}
|
|
67
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
68
|
-
if (source == null) return {};
|
|
69
|
-
var target = {};
|
|
70
|
-
var sourceKeys = Object.keys(source);
|
|
71
|
-
var key, i;
|
|
72
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
73
|
-
key = sourceKeys[i];
|
|
74
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
75
|
-
target[key] = source[key];
|
|
76
|
-
}
|
|
77
|
-
return target;
|
|
67
|
+
function _nonIterableRest() {
|
|
68
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
78
69
|
}
|
|
79
|
-
function _objectWithoutProperties(
|
|
80
|
-
if (
|
|
81
|
-
var
|
|
82
|
-
|
|
70
|
+
function _objectWithoutProperties(e, t) {
|
|
71
|
+
if (null == e) return {};
|
|
72
|
+
var o,
|
|
73
|
+
r,
|
|
74
|
+
i = _objectWithoutPropertiesLoose(e, t);
|
|
83
75
|
if (Object.getOwnPropertySymbols) {
|
|
84
|
-
var
|
|
85
|
-
for (
|
|
86
|
-
key = sourceSymbolKeys[i];
|
|
87
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
88
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
89
|
-
target[key] = source[key];
|
|
90
|
-
}
|
|
76
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
77
|
+
for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
91
78
|
}
|
|
92
|
-
return
|
|
93
|
-
}
|
|
94
|
-
function _slicedToArray(arr, i) {
|
|
95
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
96
|
-
}
|
|
97
|
-
function _arrayWithHoles(arr) {
|
|
98
|
-
if (Array.isArray(arr)) return arr;
|
|
79
|
+
return i;
|
|
99
80
|
}
|
|
100
|
-
function
|
|
101
|
-
if (
|
|
102
|
-
|
|
103
|
-
var n
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
81
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
82
|
+
if (null == r) return {};
|
|
83
|
+
var t = {};
|
|
84
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
85
|
+
if (e.indexOf(n) >= 0) continue;
|
|
86
|
+
t[n] = r[n];
|
|
87
|
+
}
|
|
88
|
+
return t;
|
|
107
89
|
}
|
|
108
|
-
function
|
|
109
|
-
|
|
110
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
111
|
-
return arr2;
|
|
90
|
+
function _slicedToArray(r, e) {
|
|
91
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
112
92
|
}
|
|
113
|
-
function
|
|
114
|
-
|
|
93
|
+
function _unsupportedIterableToArray(r, a) {
|
|
94
|
+
if (r) {
|
|
95
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
96
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
97
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
98
|
+
}
|
|
115
99
|
}
|
|
116
100
|
|
|
117
101
|
var _excluded = ["id", "label"];
|
package/FieldRadio/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/FieldRadio/FieldRadio.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport type FieldRadioProps = {\n label: React.ReactNode | string;\n} & React.ComponentPropsWithoutRef<'input'>;\n\nconst FieldRadio = React.forwardRef<HTMLInputElement, FieldRadioProps>(({ id, label, ...props }, ref) => {\n const [isEnhanced, setIsEnhanced] = React.useState(false);\n\n const fallbackId = React.useId();\n\n const inputId = id ?? fallbackId;\n\n React.useEffect(() => {\n setIsEnhanced(true);\n }, []);\n\n return (\n <div className=\"bds-form-group\">\n <div className=\"bds-radio\" data-enhanced={isEnhanced ? '' : undefined}>\n <input {...props} id={inputId} ref={ref} type=\"radio\" />\n {isEnhanced && (\n <svg width=\"32\" height=\"32\" viewBox=\"-2 -2 40 40\" aria-hidden=\"true\" focusable=\"false\">\n <circle\n className=\"background\"\n cx=\"18\"\n cy=\"18\"\n r=\"18\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeWidth=\"1\"\n vectorEffect=\"non-scaling-stroke\"\n />\n <circle className=\"radio\" cx=\"18\" cy=\"18\" r=\"12\" fill=\"currentColor\" />\n </svg>\n )}\n <label htmlFor={inputId}>{label}</label>\n </div>\n </div>\n );\n});\n\nexport default FieldRadio;\n"],"names":["FieldRadio","React","forwardRef","_ref","ref","id","label","props","_objectWithoutProperties","_excluded","_React$useState","useState","_React$useState2","_slicedToArray","isEnhanced","setIsEnhanced","fallbackId","useId","inputId","useEffect","createElement","className","undefined","_extends","type","width","height","viewBox","focusable","cx","cy","r","stroke","fill","strokeWidth","vectorEffect","htmlFor"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/FieldRadio/FieldRadio.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport type FieldRadioProps = {\n label: React.ReactNode | string;\n} & React.ComponentPropsWithoutRef<'input'>;\n\nconst FieldRadio = React.forwardRef<HTMLInputElement, FieldRadioProps>(({ id, label, ...props }, ref) => {\n const [isEnhanced, setIsEnhanced] = React.useState(false);\n\n const fallbackId = React.useId();\n\n const inputId = id ?? fallbackId;\n\n React.useEffect(() => {\n setIsEnhanced(true);\n }, []);\n\n return (\n <div className=\"bds-form-group\">\n <div className=\"bds-radio\" data-enhanced={isEnhanced ? '' : undefined}>\n <input {...props} id={inputId} ref={ref} type=\"radio\" />\n {isEnhanced && (\n <svg width=\"32\" height=\"32\" viewBox=\"-2 -2 40 40\" aria-hidden=\"true\" focusable=\"false\">\n <circle\n className=\"background\"\n cx=\"18\"\n cy=\"18\"\n r=\"18\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeWidth=\"1\"\n vectorEffect=\"non-scaling-stroke\"\n />\n <circle className=\"radio\" cx=\"18\" cy=\"18\" r=\"12\" fill=\"currentColor\" />\n </svg>\n )}\n <label htmlFor={inputId}>{label}</label>\n </div>\n </div>\n );\n});\n\nexport default FieldRadio;\n"],"names":["FieldRadio","React","forwardRef","_ref","ref","id","label","props","_objectWithoutProperties","_excluded","_React$useState","useState","_React$useState2","_slicedToArray","isEnhanced","setIsEnhanced","fallbackId","useId","inputId","useEffect","createElement","className","undefined","_extends","type","width","height","viewBox","focusable","cx","cy","r","stroke","fill","strokeWidth","vectorEffect","htmlFor"],"mappings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F,IAAAA,EAAE,EAAEa,OAAQ;AAACd,IAAAA,GAAG,EAAEA,GAAI;AAACoB,IAAAA,IAAI,EAAC,OAAA;AAAO,GAAA,CAAE,CAAC,EACvDV,UAAU,iBACTb,gBAAA,CAAAmB,aAAA,CAAA,KAAA,EAAA;AAAKK,IAAAA,KAAK,EAAC,IAAI;AAACC,IAAAA,MAAM,EAAC,IAAI;AAACC,IAAAA,OAAO,EAAC,aAAa;AAAC,IAAA,aAAA,EAAY,MAAM;AAACC,IAAAA,SAAS,EAAC,OAAA;GAC7E3B,eAAAA,gBAAA,CAAAmB,aAAA,CAAA,QAAA,EAAA;AACEC,IAAAA,SAAS,EAAC,YAAY;AACtBQ,IAAAA,EAAE,EAAC,IAAI;AACPC,IAAAA,EAAE,EAAC,IAAI;AACPC,IAAAA,CAAC,EAAC,IAAI;AACNC,IAAAA,MAAM,EAAC,cAAc;AACrBC,IAAAA,IAAI,EAAC,MAAM;AACXC,IAAAA,WAAW,EAAC,GAAG;AACfC,IAAAA,YAAY,EAAC,oBAAA;AAAoB,GAClC,CAAC,eACFlC,gBAAA,CAAAmB,aAAA,CAAA,QAAA,EAAA;AAAQC,IAAAA,SAAS,EAAC,OAAO;AAACQ,IAAAA,EAAE,EAAC,IAAI;AAACC,IAAAA,EAAE,EAAC,IAAI;AAACC,IAAAA,CAAC,EAAC,IAAI;AAACE,IAAAA,IAAI,EAAC,cAAA;AAAc,GAAE,CACnE,CACN,eACDhC,gBAAA,CAAAmB,aAAA,CAAA,OAAA,EAAA;AAAOgB,IAAAA,OAAO,EAAElB,OAAAA;GAAUZ,EAAAA,KAAa,CACpC,CACF,CAAC,CAAA;AAEV,CAAC;;;;"}
|
package/FieldRadio/index.mjs
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
+
function _arrayLikeToArray(r, a) {
|
|
4
|
+
(null == a || a > r.length) && (a = r.length);
|
|
5
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
6
|
+
return n;
|
|
7
|
+
}
|
|
8
|
+
function _arrayWithHoles(r) {
|
|
9
|
+
if (Array.isArray(r)) return r;
|
|
10
|
+
}
|
|
11
|
+
function _extends() {
|
|
12
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
13
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
14
|
+
var t = arguments[e];
|
|
15
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
16
|
+
}
|
|
17
|
+
return n;
|
|
18
|
+
}, _extends.apply(null, arguments);
|
|
19
|
+
}
|
|
3
20
|
function _iterableToArrayLimit(r, l) {
|
|
4
21
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
5
22
|
if (null != t) {
|
|
@@ -11,10 +28,7 @@ function _iterableToArrayLimit(r, l) {
|
|
|
11
28
|
f = !0,
|
|
12
29
|
o = !1;
|
|
13
30
|
try {
|
|
14
|
-
if (i = (t = t.call(r)).next, 0 === l)
|
|
15
|
-
if (Object(t) !== t) return;
|
|
16
|
-
f = !1;
|
|
17
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
31
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
18
32
|
} catch (r) {
|
|
19
33
|
o = !0, n = r;
|
|
20
34
|
} finally {
|
|
@@ -27,68 +41,38 @@ function _iterableToArrayLimit(r, l) {
|
|
|
27
41
|
return a;
|
|
28
42
|
}
|
|
29
43
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
33
|
-
var source = arguments[i];
|
|
34
|
-
for (var key in source) {
|
|
35
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
36
|
-
target[key] = source[key];
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return target;
|
|
41
|
-
};
|
|
42
|
-
return _extends.apply(this, arguments);
|
|
43
|
-
}
|
|
44
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
45
|
-
if (source == null) return {};
|
|
46
|
-
var target = {};
|
|
47
|
-
var sourceKeys = Object.keys(source);
|
|
48
|
-
var key, i;
|
|
49
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
50
|
-
key = sourceKeys[i];
|
|
51
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
52
|
-
target[key] = source[key];
|
|
53
|
-
}
|
|
54
|
-
return target;
|
|
44
|
+
function _nonIterableRest() {
|
|
45
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
55
46
|
}
|
|
56
|
-
function _objectWithoutProperties(
|
|
57
|
-
if (
|
|
58
|
-
var
|
|
59
|
-
|
|
47
|
+
function _objectWithoutProperties(e, t) {
|
|
48
|
+
if (null == e) return {};
|
|
49
|
+
var o,
|
|
50
|
+
r,
|
|
51
|
+
i = _objectWithoutPropertiesLoose(e, t);
|
|
60
52
|
if (Object.getOwnPropertySymbols) {
|
|
61
|
-
var
|
|
62
|
-
for (
|
|
63
|
-
key = sourceSymbolKeys[i];
|
|
64
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
65
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
66
|
-
target[key] = source[key];
|
|
67
|
-
}
|
|
53
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
54
|
+
for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
68
55
|
}
|
|
69
|
-
return
|
|
70
|
-
}
|
|
71
|
-
function _slicedToArray(arr, i) {
|
|
72
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
73
|
-
}
|
|
74
|
-
function _arrayWithHoles(arr) {
|
|
75
|
-
if (Array.isArray(arr)) return arr;
|
|
56
|
+
return i;
|
|
76
57
|
}
|
|
77
|
-
function
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
var n
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
58
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
59
|
+
if (null == r) return {};
|
|
60
|
+
var t = {};
|
|
61
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
62
|
+
if (e.indexOf(n) >= 0) continue;
|
|
63
|
+
t[n] = r[n];
|
|
64
|
+
}
|
|
65
|
+
return t;
|
|
84
66
|
}
|
|
85
|
-
function
|
|
86
|
-
|
|
87
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
88
|
-
return arr2;
|
|
67
|
+
function _slicedToArray(r, e) {
|
|
68
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
89
69
|
}
|
|
90
|
-
function
|
|
91
|
-
|
|
70
|
+
function _unsupportedIterableToArray(r, a) {
|
|
71
|
+
if (r) {
|
|
72
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
73
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
74
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
75
|
+
}
|
|
92
76
|
}
|
|
93
77
|
|
|
94
78
|
var _excluded = ["id", "label"];
|
package/FieldRadio/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/FieldRadio/FieldRadio.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport type FieldRadioProps = {\n label: React.ReactNode | string;\n} & React.ComponentPropsWithoutRef<'input'>;\n\nconst FieldRadio = React.forwardRef<HTMLInputElement, FieldRadioProps>(({ id, label, ...props }, ref) => {\n const [isEnhanced, setIsEnhanced] = React.useState(false);\n\n const fallbackId = React.useId();\n\n const inputId = id ?? fallbackId;\n\n React.useEffect(() => {\n setIsEnhanced(true);\n }, []);\n\n return (\n <div className=\"bds-form-group\">\n <div className=\"bds-radio\" data-enhanced={isEnhanced ? '' : undefined}>\n <input {...props} id={inputId} ref={ref} type=\"radio\" />\n {isEnhanced && (\n <svg width=\"32\" height=\"32\" viewBox=\"-2 -2 40 40\" aria-hidden=\"true\" focusable=\"false\">\n <circle\n className=\"background\"\n cx=\"18\"\n cy=\"18\"\n r=\"18\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeWidth=\"1\"\n vectorEffect=\"non-scaling-stroke\"\n />\n <circle className=\"radio\" cx=\"18\" cy=\"18\" r=\"12\" fill=\"currentColor\" />\n </svg>\n )}\n <label htmlFor={inputId}>{label}</label>\n </div>\n </div>\n );\n});\n\nexport default FieldRadio;\n"],"names":["FieldRadio","React","forwardRef","_ref","ref","id","label","props","_objectWithoutProperties","_excluded","_React$useState","useState","_React$useState2","_slicedToArray","isEnhanced","setIsEnhanced","fallbackId","useId","inputId","useEffect","createElement","className","undefined","_extends","type","width","height","viewBox","focusable","cx","cy","r","stroke","fill","strokeWidth","vectorEffect","htmlFor"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/FieldRadio/FieldRadio.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport type FieldRadioProps = {\n label: React.ReactNode | string;\n} & React.ComponentPropsWithoutRef<'input'>;\n\nconst FieldRadio = React.forwardRef<HTMLInputElement, FieldRadioProps>(({ id, label, ...props }, ref) => {\n const [isEnhanced, setIsEnhanced] = React.useState(false);\n\n const fallbackId = React.useId();\n\n const inputId = id ?? fallbackId;\n\n React.useEffect(() => {\n setIsEnhanced(true);\n }, []);\n\n return (\n <div className=\"bds-form-group\">\n <div className=\"bds-radio\" data-enhanced={isEnhanced ? '' : undefined}>\n <input {...props} id={inputId} ref={ref} type=\"radio\" />\n {isEnhanced && (\n <svg width=\"32\" height=\"32\" viewBox=\"-2 -2 40 40\" aria-hidden=\"true\" focusable=\"false\">\n <circle\n className=\"background\"\n cx=\"18\"\n cy=\"18\"\n r=\"18\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeWidth=\"1\"\n vectorEffect=\"non-scaling-stroke\"\n />\n <circle className=\"radio\" cx=\"18\" cy=\"18\" r=\"12\" fill=\"currentColor\" />\n </svg>\n )}\n <label htmlFor={inputId}>{label}</label>\n </div>\n </div>\n );\n});\n\nexport default FieldRadio;\n"],"names":["FieldRadio","React","forwardRef","_ref","ref","id","label","props","_objectWithoutProperties","_excluded","_React$useState","useState","_React$useState2","_slicedToArray","isEnhanced","setIsEnhanced","fallbackId","useId","inputId","useEffect","createElement","className","undefined","_extends","type","width","height","viewBox","focusable","cx","cy","r","stroke","fill","strokeWidth","vectorEffect","htmlFor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMMA,IAAAA,UAAU,gBAAGC,KAAK,CAACC,UAAU,CAAoC,UAAAC,IAAA,EAA0BC,GAAG,EAAK;AAAA,EAAA,IAA/BC,EAAE,GAAAF,IAAA,CAAFE,EAAE;IAAEC,KAAK,GAAAH,IAAA,CAALG,KAAK;AAAKC,IAAAA,KAAK,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA,CAAA,CAAA;AAC3F,EAAA,IAAAC,eAAA,GAAoCT,KAAK,CAACU,QAAQ,CAAC,KAAK,CAAC;IAAAC,gBAAA,GAAAC,cAAA,CAAAH,eAAA,EAAA,CAAA,CAAA;AAAlDI,IAAAA,UAAU,GAAAF,gBAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,aAAa,GAAAH,gBAAA,CAAA,CAAA,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C,IAAAA,YAAY,EAAC,oBAAA;AAAoB,GAClC,CAAC,eACFlC,KAAA,CAAAmB,aAAA,CAAA,QAAA,EAAA;AAAQC,IAAAA,SAAS,EAAC,OAAO;AAACQ,IAAAA,EAAE,EAAC,IAAI;AAACC,IAAAA,EAAE,EAAC,IAAI;AAACC,IAAAA,CAAC,EAAC,IAAI;AAACE,IAAAA,IAAI,EAAC,cAAA;AAAc,GAAE,CACnE,CACN,eACDhC,KAAA,CAAAmB,aAAA,CAAA,OAAA,EAAA;AAAOgB,IAAAA,OAAO,EAAElB,OAAAA;GAAUZ,EAAAA,KAAa,CACpC,CACF,CAAC,CAAA;AAEV,CAAC;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type FieldSelectProps = {
|
|
3
|
+
error?: string;
|
|
4
|
+
hint?: React.ReactNode | string;
|
|
5
|
+
id?: string;
|
|
6
|
+
isOptional?: boolean;
|
|
7
|
+
label: React.ReactNode | string;
|
|
8
|
+
};
|
|
9
|
+
export default function FieldSelect({ error, hint, id, isOptional, label, ...props }: FieldSelectProps & React.ComponentPropsWithoutRef<'select'>): React.JSX.Element;
|
|
@@ -0,0 +1,109 @@
|
|
|
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
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
28
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
29
|
+
var t = arguments[e];
|
|
30
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
31
|
+
}
|
|
32
|
+
return n;
|
|
33
|
+
}, _extends.apply(null, arguments);
|
|
34
|
+
}
|
|
35
|
+
function _objectWithoutProperties(e, t) {
|
|
36
|
+
if (null == e) return {};
|
|
37
|
+
var o,
|
|
38
|
+
r,
|
|
39
|
+
i = _objectWithoutPropertiesLoose(e, t);
|
|
40
|
+
if (Object.getOwnPropertySymbols) {
|
|
41
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
42
|
+
for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
43
|
+
}
|
|
44
|
+
return i;
|
|
45
|
+
}
|
|
46
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
47
|
+
if (null == r) return {};
|
|
48
|
+
var t = {};
|
|
49
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
50
|
+
if (e.indexOf(n) >= 0) continue;
|
|
51
|
+
t[n] = r[n];
|
|
52
|
+
}
|
|
53
|
+
return t;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
var _excluded$1 = ["className", "children"];
|
|
57
|
+
function ErrorMessage(_ref) {
|
|
58
|
+
var className = _ref.className,
|
|
59
|
+
children = _ref.children,
|
|
60
|
+
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
61
|
+
return /*#__PURE__*/React__namespace.createElement("span", _extends({
|
|
62
|
+
className: ['bds-error', className].filter(function (x) {
|
|
63
|
+
return x;
|
|
64
|
+
}).join(' ')
|
|
65
|
+
}, props), /*#__PURE__*/React__namespace.createElement("svg", {
|
|
66
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
67
|
+
viewBox: "0 0 512 512",
|
|
68
|
+
"aria-hidden": "true",
|
|
69
|
+
height: "1em",
|
|
70
|
+
width: "1em",
|
|
71
|
+
fill: "currentColor"
|
|
72
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
73
|
+
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"
|
|
74
|
+
})), children);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
var _excluded = ["error", "hint", "id", "isOptional", "label"];
|
|
78
|
+
function FieldSelect(_ref) {
|
|
79
|
+
var _id;
|
|
80
|
+
var error = _ref.error,
|
|
81
|
+
hint = _ref.hint,
|
|
82
|
+
id = _ref.id,
|
|
83
|
+
_ref$isOptional = _ref.isOptional,
|
|
84
|
+
isOptional = _ref$isOptional === void 0 ? false : _ref$isOptional,
|
|
85
|
+
label = _ref.label,
|
|
86
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
87
|
+
id = (_id = id) !== null && _id !== void 0 ? _id : props.name;
|
|
88
|
+
var errorId = React__namespace.useId();
|
|
89
|
+
var hintId = React__namespace.useId();
|
|
90
|
+
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
91
|
+
className: "bds-form-group"
|
|
92
|
+
}, /*#__PURE__*/React__namespace.createElement("label", {
|
|
93
|
+
htmlFor: id
|
|
94
|
+
}, label, isOptional && ' (optional)'), hint && /*#__PURE__*/React__namespace.createElement("span", {
|
|
95
|
+
className: "bds-hint",
|
|
96
|
+
id: hintId
|
|
97
|
+
}, hint), error && /*#__PURE__*/React__namespace.createElement(ErrorMessage, {
|
|
98
|
+
id: errorId
|
|
99
|
+
}, error), /*#__PURE__*/React__namespace.createElement("div", {
|
|
100
|
+
className: "bds-select"
|
|
101
|
+
}, /*#__PURE__*/React__namespace.createElement("select", _extends({
|
|
102
|
+
"aria-invalid": error ? true : undefined,
|
|
103
|
+
"aria-describedby": error && hint ? "".concat(hintId, " ").concat(errorId) : error ? errorId : hint ? hintId : undefined,
|
|
104
|
+
id: id
|
|
105
|
+
}, props))));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
exports.default = FieldSelect;
|
|
109
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/FieldSelect/FieldSelect.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 FieldSelectProps = {\n error?: string;\n hint?: React.ReactNode | string;\n id?: string;\n isOptional?: boolean;\n label: React.ReactNode | string;\n};\n\nexport default function FieldSelect({\n error,\n hint,\n id,\n isOptional = false,\n label,\n ...props\n}: FieldSelectProps & React.ComponentPropsWithoutRef<'select'>) {\n id = id ?? props.name;\n\n const errorId = React.useId();\n const hintId = React.useId();\n\n return (\n <div className=\"bds-form-group\">\n <label htmlFor={id}>\n {label}\n {isOptional && ' (optional)'}\n </label>\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-select\">\n <select\n aria-invalid={error ? true : undefined}\n aria-describedby={error && hint ? `${hintId} ${errorId}` : error ? errorId : hint ? hintId : undefined}\n id={id}\n {...props}\n />\n </div>\n </div>\n );\n}\n"],"names":["ErrorMessage","_ref","className","children","props","_objectWithoutProperties","_excluded","React","createElement","_extends","filter","x","join","xmlns","viewBox","height","width","fill","d","FieldSelect","_id","error","hint","id","_ref$isOptional","isOptional","label","name","errorId","useId","hintId","htmlFor","undefined","concat"],"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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AAER,EAAAA;GACbG,EAAAA,KAAK,EACLD,UAAU,IAAI,aACV,CAAC,EACPH,IAAI,iBACHf,gBAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AAAMN,IAAAA,SAAS,EAAC,UAAU;AAACqB,IAAAA,EAAE,EAAEO,MAAAA;GAC5BR,EAAAA,IACG,CACP,EACAD,KAAK,iBAAId,gBAAA,CAAAC,aAAA,CAACR,YAAY,EAAA;AAACuB,IAAAA,EAAE,EAAEK,OAAAA;AAAQ,GAAA,EAAEP,KAAoB,CAAC,eAC3Dd,gBAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAKN,IAAAA,SAAS,EAAC,YAAA;AAAY,GAAA,eACzBK,gBAAA,CAAAC,aAAA,CAAA,QAAA,EAAAC,QAAA,CAAA;AACE,IAAA,cAAA,EAAcY,KAAK,GAAG,IAAI,GAAGW,SAAU;IACvC,kBAAkBX,EAAAA,KAAK,IAAIC,IAAI,GAAA,EAAA,CAAAW,MAAA,CAAMH,MAAM,OAAAG,MAAA,CAAIL,OAAO,CAAKP,GAAAA,KAAK,GAAGO,OAAO,GAAGN,IAAI,GAAGQ,MAAM,GAAGE,SAAU;AACvGT,IAAAA,EAAE,EAAEA,EAAAA;AAAG,GAAA,EACHnB,KAAK,CACV,CACE,CACF,CAAC,CAAA;AAEV;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './FieldSelect';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
function _extends() {
|
|
4
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
5
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
6
|
+
var t = arguments[e];
|
|
7
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
8
|
+
}
|
|
9
|
+
return n;
|
|
10
|
+
}, _extends.apply(null, arguments);
|
|
11
|
+
}
|
|
12
|
+
function _objectWithoutProperties(e, t) {
|
|
13
|
+
if (null == e) return {};
|
|
14
|
+
var o,
|
|
15
|
+
r,
|
|
16
|
+
i = _objectWithoutPropertiesLoose(e, t);
|
|
17
|
+
if (Object.getOwnPropertySymbols) {
|
|
18
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
19
|
+
for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
20
|
+
}
|
|
21
|
+
return i;
|
|
22
|
+
}
|
|
23
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
24
|
+
if (null == r) return {};
|
|
25
|
+
var t = {};
|
|
26
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
27
|
+
if (e.indexOf(n) >= 0) continue;
|
|
28
|
+
t[n] = r[n];
|
|
29
|
+
}
|
|
30
|
+
return t;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var _excluded$1 = ["className", "children"];
|
|
34
|
+
function ErrorMessage(_ref) {
|
|
35
|
+
var className = _ref.className,
|
|
36
|
+
children = _ref.children,
|
|
37
|
+
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
38
|
+
return /*#__PURE__*/React.createElement("span", _extends({
|
|
39
|
+
className: ['bds-error', className].filter(function (x) {
|
|
40
|
+
return x;
|
|
41
|
+
}).join(' ')
|
|
42
|
+
}, props), /*#__PURE__*/React.createElement("svg", {
|
|
43
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
44
|
+
viewBox: "0 0 512 512",
|
|
45
|
+
"aria-hidden": "true",
|
|
46
|
+
height: "1em",
|
|
47
|
+
width: "1em",
|
|
48
|
+
fill: "currentColor"
|
|
49
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
50
|
+
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"
|
|
51
|
+
})), children);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
var _excluded = ["error", "hint", "id", "isOptional", "label"];
|
|
55
|
+
function FieldSelect(_ref) {
|
|
56
|
+
var _id;
|
|
57
|
+
var error = _ref.error,
|
|
58
|
+
hint = _ref.hint,
|
|
59
|
+
id = _ref.id,
|
|
60
|
+
_ref$isOptional = _ref.isOptional,
|
|
61
|
+
isOptional = _ref$isOptional === void 0 ? false : _ref$isOptional,
|
|
62
|
+
label = _ref.label,
|
|
63
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
64
|
+
id = (_id = id) !== null && _id !== void 0 ? _id : props.name;
|
|
65
|
+
var errorId = React.useId();
|
|
66
|
+
var hintId = React.useId();
|
|
67
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
className: "bds-form-group"
|
|
69
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
70
|
+
htmlFor: id
|
|
71
|
+
}, label, isOptional && ' (optional)'), hint && /*#__PURE__*/React.createElement("span", {
|
|
72
|
+
className: "bds-hint",
|
|
73
|
+
id: hintId
|
|
74
|
+
}, hint), error && /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
75
|
+
id: errorId
|
|
76
|
+
}, error), /*#__PURE__*/React.createElement("div", {
|
|
77
|
+
className: "bds-select"
|
|
78
|
+
}, /*#__PURE__*/React.createElement("select", _extends({
|
|
79
|
+
"aria-invalid": error ? true : undefined,
|
|
80
|
+
"aria-describedby": error && hint ? "".concat(hintId, " ").concat(errorId) : error ? errorId : hint ? hintId : undefined,
|
|
81
|
+
id: id
|
|
82
|
+
}, props))));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { FieldSelect as default };
|
|
86
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/FieldSelect/FieldSelect.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 FieldSelectProps = {\n error?: string;\n hint?: React.ReactNode | string;\n id?: string;\n isOptional?: boolean;\n label: React.ReactNode | string;\n};\n\nexport default function FieldSelect({\n error,\n hint,\n id,\n isOptional = false,\n label,\n ...props\n}: FieldSelectProps & React.ComponentPropsWithoutRef<'select'>) {\n id = id ?? props.name;\n\n const errorId = React.useId();\n const hintId = React.useId();\n\n return (\n <div className=\"bds-form-group\">\n <label htmlFor={id}>\n {label}\n {isOptional && ' (optional)'}\n </label>\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-select\">\n <select\n aria-invalid={error ? true : undefined}\n aria-describedby={error && hint ? `${hintId} ${errorId}` : error ? errorId : hint ? hintId : undefined}\n id={id}\n {...props}\n />\n </div>\n </div>\n );\n}\n"],"names":["ErrorMessage","_ref","className","children","props","_objectWithoutProperties","_excluded","React","createElement","_extends","filter","x","join","xmlns","viewBox","height","width","fill","d","FieldSelect","_id","error","hint","id","_ref$isOptional","isOptional","label","name","errorId","useId","hintId","htmlFor","undefined","concat"],"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,WAAWA,CAAAlB,IAAA,EAO6B;AAAA,EAAA,IAAAmB,GAAA,CAAA;AAAA,EAAA,IAN9DC,KAAK,GAAApB,IAAA,CAALoB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AACE,IAAA,cAAA,EAAcY,KAAK,GAAG,IAAI,GAAGW,SAAU;IACvC,kBAAkBX,EAAAA,KAAK,IAAIC,IAAI,GAAA,EAAA,CAAAW,MAAA,CAAMH,MAAM,OAAAG,MAAA,CAAIL,OAAO,CAAKP,GAAAA,KAAK,GAAGO,OAAO,GAAGN,IAAI,GAAGQ,MAAM,GAAGE,SAAU;AACvGT,IAAAA,EAAE,EAAEA,EAAAA;AAAG,GAAA,EACHnB,KAAK,CACV,CACE,CACF,CAAC,CAAA;AAEV;;;;"}
|
package/FieldTextInput/index.cjs
CHANGED
|
@@ -24,45 +24,33 @@ function _interopNamespaceDefault(e) {
|
|
|
24
24
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
25
25
|
|
|
26
26
|
function _extends() {
|
|
27
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
|
28
|
-
for (var
|
|
29
|
-
var
|
|
30
|
-
for (var
|
|
31
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
32
|
-
target[key] = source[key];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
27
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
28
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
29
|
+
var t = arguments[e];
|
|
30
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
35
31
|
}
|
|
36
|
-
return
|
|
37
|
-
};
|
|
38
|
-
return _extends.apply(this, arguments);
|
|
32
|
+
return n;
|
|
33
|
+
}, _extends.apply(null, arguments);
|
|
39
34
|
}
|
|
40
|
-
function
|
|
41
|
-
if (
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
target[key] = source[key];
|
|
35
|
+
function _objectWithoutProperties(e, t) {
|
|
36
|
+
if (null == e) return {};
|
|
37
|
+
var o,
|
|
38
|
+
r,
|
|
39
|
+
i = _objectWithoutPropertiesLoose(e, t);
|
|
40
|
+
if (Object.getOwnPropertySymbols) {
|
|
41
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
42
|
+
for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
49
43
|
}
|
|
50
|
-
return
|
|
44
|
+
return i;
|
|
51
45
|
}
|
|
52
|
-
function
|
|
53
|
-
if (
|
|
54
|
-
var
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
}
|
|
46
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
47
|
+
if (null == r) return {};
|
|
48
|
+
var t = {};
|
|
49
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
50
|
+
if (e.indexOf(n) >= 0) continue;
|
|
51
|
+
t[n] = r[n];
|
|
64
52
|
}
|
|
65
|
-
return
|
|
53
|
+
return t;
|
|
66
54
|
}
|
|
67
55
|
|
|
68
56
|
var _excluded$1 = ["className", "children"];
|