@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.
Files changed (57) hide show
  1. package/Button/index.cjs +3 -1
  2. package/Button/index.cjs.map +1 -1
  3. package/CallToAction/index.cjs +3 -1
  4. package/CallToAction/index.cjs.map +1 -1
  5. package/ErrorMessage/ErrorMessage.d.ts +2 -0
  6. package/ErrorMessage/index.cjs +90 -0
  7. package/ErrorMessage/index.cjs.map +1 -0
  8. package/ErrorMessage/index.d.ts +1 -0
  9. package/ErrorMessage/index.mjs +67 -0
  10. package/ErrorMessage/index.mjs.map +1 -0
  11. package/ErrorMessage/package.json +7 -0
  12. package/ErrorSummary/ErrorSummary.d.ts +1 -2
  13. package/ErrorSummary/index.cjs +14 -9
  14. package/ErrorSummary/index.cjs.map +1 -1
  15. package/ErrorSummary/index.mjs +14 -9
  16. package/ErrorSummary/index.mjs.map +1 -1
  17. package/FieldCheckbox/FieldCheckbox.d.ts +6 -0
  18. package/FieldCheckbox/index.cjs +194 -0
  19. package/FieldCheckbox/index.cjs.map +1 -0
  20. package/FieldCheckbox/index.d.ts +1 -0
  21. package/FieldCheckbox/index.mjs +171 -0
  22. package/FieldCheckbox/index.mjs.map +1 -0
  23. package/FieldCheckbox/package.json +7 -0
  24. package/FieldRadio/FieldRadio.d.ts +5 -0
  25. package/FieldRadio/index.cjs +166 -0
  26. package/FieldRadio/index.cjs.map +1 -0
  27. package/FieldRadio/index.d.ts +1 -0
  28. package/FieldRadio/index.mjs +143 -0
  29. package/FieldRadio/index.mjs.map +1 -0
  30. package/FieldRadio/package.json +7 -0
  31. package/FieldTextInput/index.cjs +28 -14
  32. package/FieldTextInput/index.cjs.map +1 -1
  33. package/FieldTextInput/index.mjs +25 -13
  34. package/FieldTextInput/index.mjs.map +1 -1
  35. package/FieldTextarea/FieldTextarea.d.ts +9 -0
  36. package/FieldTextarea/index.cjs +120 -0
  37. package/FieldTextarea/index.cjs.map +1 -0
  38. package/FieldTextarea/index.d.ts +1 -0
  39. package/FieldTextarea/index.mjs +97 -0
  40. package/FieldTextarea/index.mjs.map +1 -0
  41. package/FieldTextarea/package.json +7 -0
  42. package/Fieldset/Fieldset.d.ts +9 -0
  43. package/Fieldset/index.cjs +119 -0
  44. package/Fieldset/index.cjs.map +1 -0
  45. package/Fieldset/index.d.ts +2 -0
  46. package/Fieldset/index.mjs +96 -0
  47. package/Fieldset/index.mjs.map +1 -0
  48. package/Fieldset/package.json +7 -0
  49. package/Pagination/index.cjs +3 -1
  50. package/Pagination/index.cjs.map +1 -1
  51. package/Typography/index.cjs +3 -1
  52. package/Typography/index.cjs.map +1 -1
  53. package/index.cjs +45 -28
  54. package/index.cjs.map +1 -1
  55. package/index.mjs +45 -28
  56. package/index.mjs.map +1 -1
  57. package/package.json +10 -10
@@ -0,0 +1,143 @@
1
+ import * as React from 'react';
2
+
3
+ function _iterableToArrayLimit(r, l) {
4
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
5
+ if (null != t) {
6
+ var e,
7
+ n,
8
+ i,
9
+ u,
10
+ a = [],
11
+ f = !0,
12
+ o = !1;
13
+ 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);
18
+ } catch (r) {
19
+ o = !0, n = r;
20
+ } finally {
21
+ try {
22
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
23
+ } finally {
24
+ if (o) throw n;
25
+ }
26
+ }
27
+ return a;
28
+ }
29
+ }
30
+ function _extends() {
31
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
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;
55
+ }
56
+ function _objectWithoutProperties(source, excluded) {
57
+ if (source == null) return {};
58
+ var target = _objectWithoutPropertiesLoose(source, excluded);
59
+ var key, i;
60
+ if (Object.getOwnPropertySymbols) {
61
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
62
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
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
+ }
68
+ }
69
+ return target;
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;
76
+ }
77
+ function _unsupportedIterableToArray(o, minLen) {
78
+ if (!o) return;
79
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
80
+ var n = Object.prototype.toString.call(o).slice(8, -1);
81
+ if (n === "Object" && o.constructor) n = o.constructor.name;
82
+ if (n === "Map" || n === "Set") return Array.from(o);
83
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
84
+ }
85
+ function _arrayLikeToArray(arr, len) {
86
+ if (len == null || len > arr.length) len = arr.length;
87
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
88
+ return arr2;
89
+ }
90
+ function _nonIterableRest() {
91
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
92
+ }
93
+
94
+ var _excluded = ["id", "label"];
95
+ function FieldRadio(_ref) {
96
+ var id = _ref.id,
97
+ label = _ref.label,
98
+ props = _objectWithoutProperties(_ref, _excluded);
99
+ var _React$useState = React.useState(false),
100
+ _React$useState2 = _slicedToArray(_React$useState, 2),
101
+ isEnhanced = _React$useState2[0],
102
+ setIsEnhanced = _React$useState2[1];
103
+ var fallbackId = React.useId();
104
+ var inputId = id !== null && id !== void 0 ? id : fallbackId;
105
+ React.useEffect(function () {
106
+ setIsEnhanced(true);
107
+ }, []);
108
+ return /*#__PURE__*/React.createElement("div", {
109
+ className: "bds-form-group"
110
+ }, /*#__PURE__*/React.createElement("div", {
111
+ className: "bds-radio",
112
+ "data-enhanced": isEnhanced ? '' : undefined
113
+ }, /*#__PURE__*/React.createElement("input", _extends({}, props, {
114
+ id: inputId,
115
+ type: "radio"
116
+ })), isEnhanced && /*#__PURE__*/React.createElement("svg", {
117
+ width: "32",
118
+ height: "32",
119
+ viewBox: "-2 -2 40 40",
120
+ "aria-hidden": "true",
121
+ focusable: "false"
122
+ }, /*#__PURE__*/React.createElement("circle", {
123
+ className: "background",
124
+ cx: "18",
125
+ cy: "18",
126
+ r: "18",
127
+ stroke: "currentColor",
128
+ fill: "none",
129
+ strokeWidth: "1",
130
+ vectorEffect: "non-scaling-stroke"
131
+ }), /*#__PURE__*/React.createElement("circle", {
132
+ className: "radio",
133
+ cx: "18",
134
+ cy: "18",
135
+ r: "12",
136
+ fill: "currentColor"
137
+ })), /*#__PURE__*/React.createElement("label", {
138
+ htmlFor: inputId
139
+ }, label)));
140
+ }
141
+
142
+ export { FieldRadio as default };
143
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../src/FieldRadio/FieldRadio.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport type FieldRadioProps = {\n label: string;\n};\n\nexport default function FieldRadio({\n id,\n label,\n ...props\n}: FieldRadioProps & React.ComponentPropsWithoutRef<'input'>) {\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} 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"],"names":["FieldRadio","_ref","id","label","props","_objectWithoutProperties","_excluded","_React$useState","React","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMe,SAASA,UAAUA,CAAAC,IAAA,EAI4B;AAAA,EAAA,IAH5DC,EAAE,GAAAD,IAAA,CAAFC,EAAE;IACFC,KAAK,GAAAF,IAAA,CAALE,KAAK;AACFC,IAAAA,KAAK,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA,CAAA,CAAA;AAER,EAAA,IAAAC,eAAA,GAAoCC,KAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;IAAAC,gBAAA,GAAAC,cAAA,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,IAAAA,MAAM,EAAC,cAAc;AACrBC,IAAAA,IAAI,EAAC,MAAM;AACXC,IAAAA,WAAW,EAAC,GAAG;AACfC,IAAAA,YAAY,EAAC,oBAAA;AAAoB,GAClC,CAAC,eACFzB,KAAA,CAAAU,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,eACDvB,KAAA,CAAAU,aAAA,CAAA,OAAA,EAAA;AAAOgB,IAAAA,OAAO,EAAElB,OAAAA;GAAUb,EAAAA,KAAa,CACpC,CACF,CAAC,CAAA;AAEV;;;;"}
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@iabbb/bds-react/FieldRadio",
3
+ "private": true,
4
+ "main": "./index.cjs",
5
+ "module": "./index.mjs",
6
+ "types": "./index.d.ts"
7
+ }
@@ -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) {
@@ -63,6 +65,27 @@ function _objectWithoutProperties(source, excluded) {
63
65
  return target;
64
66
  }
65
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
+
66
89
  var _excluded = ["as", "error", "hint", "id", "isOptional", "label"];
67
90
  function FieldTextInput(_ref) {
68
91
  var _id;
@@ -79,30 +102,21 @@ function FieldTextInput(_ref) {
79
102
  var hintId = React__namespace.useId();
80
103
  var InputComponent = as !== null && as !== void 0 ? as : 'input';
81
104
  return /*#__PURE__*/React__namespace.createElement("div", {
82
- className: "bds-text-input stack"
105
+ className: "bds-form-group"
83
106
  }, /*#__PURE__*/React__namespace.createElement("label", {
84
107
  htmlFor: id
85
108
  }, label, isOptional && ' (optional)'), hint && /*#__PURE__*/React__namespace.createElement("span", {
86
109
  className: "bds-hint",
87
110
  id: hintId
88
- }, hint), error && /*#__PURE__*/React__namespace.createElement("span", {
89
- className: "bds-error",
111
+ }, hint), error && /*#__PURE__*/React__namespace.createElement(ErrorMessage, {
90
112
  id: errorId
91
- }, /*#__PURE__*/React__namespace.createElement("svg", {
92
- xmlns: "http://www.w3.org/2000/svg",
93
- viewBox: "0 0 512 512",
94
- "aria-hidden": "true",
95
- height: "1em",
96
- width: "1em",
97
- fill: "currentColor"
98
- }, /*#__PURE__*/React__namespace.createElement("path", {
99
- 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"
100
- })), error), /*#__PURE__*/React__namespace.createElement(InputComponent, _extends({
113
+ }, error), /*#__PURE__*/React__namespace.createElement(InputComponent, _extends({
101
114
  "aria-invalid": error ? true : undefined,
102
115
  "aria-describedby": error && hint ? "".concat(hintId, " ").concat(errorId) : error ? errorId : hint ? hintId : undefined,
116
+ className: "bds-text-input",
103
117
  id: id
104
118
  }, props)));
105
119
  }
106
120
 
107
- module.exports = FieldTextInput;
121
+ exports.default = FieldTextInput;
108
122
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../src/FieldTextInput/FieldTextInput.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport type FieldTextInputProps<C> = {\n as?: C;\n error?: string;\n hint?: string;\n id?: string;\n isOptional?: boolean;\n label: string;\n};\n\nexport default function FieldTextInput<C extends React.ElementType>({\n as,\n error,\n hint,\n id,\n isOptional = false,\n label,\n ...props\n}: FieldTextInputProps<C> & React.ComponentPropsWithoutRef<C>) {\n id = id ?? props.name;\n\n const errorId = React.useId();\n const hintId = React.useId();\n\n const InputComponent = as ?? 'input';\n\n return (\n <div className=\"bds-text-input stack\">\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 && (\n <span className=\"bds-error\" id={errorId}>\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 {error}\n </span>\n )}\n <InputComponent\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 );\n}\n"],"names":["FieldTextInput","_ref","_id","as","error","hint","id","_ref$isOptional","isOptional","label","props","_objectWithoutProperties","_excluded","name","errorId","React","useId","hintId","InputComponent","createElement","className","htmlFor","xmlns","viewBox","height","width","fill","d","_extends","undefined","concat"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWe,SAASA,cAAcA,CAAAC,IAAA,EAQyB;AAAA,EAAA,IAAAC,GAAA,CAAA;AAAA,EAAA,IAP7DC,EAAE,GAAAF,IAAA,CAAFE,EAAE;IACFC,KAAK,GAAAH,IAAA,CAALG,KAAK;IACLC,IAAI,GAAAJ,IAAA,CAAJI,IAAI;IACJC,EAAE,GAAAL,IAAA,CAAFK,EAAE;IAAAC,eAAA,GAAAN,IAAA,CACFO,UAAU;AAAVA,IAAAA,UAAU,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,eAAA;IAClBE,KAAK,GAAAR,IAAA,CAALQ,KAAK;AACFC,IAAAA,KAAK,GAAAC,wBAAA,CAAAV,IAAA,EAAAW,SAAA,CAAA,CAAA;EAERN,EAAE,GAAA,CAAAJ,GAAA,GAAGI,EAAE,MAAA,IAAA,IAAAJ,GAAA,KAAA,KAAA,CAAA,GAAAA,GAAA,GAAIQ,KAAK,CAACG,IAAI,CAAA;AAErB,EAAA,IAAMC,OAAO,GAAGC,gBAAK,CAACC,KAAK,EAAE,CAAA;AAC7B,EAAA,IAAMC,MAAM,GAAGF,gBAAK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AAO,CAAKV,GAAAA,KAAK,GAAGU,OAAO,GAAGT,IAAI,GAAGY,MAAM,GAAGY,SAAU;AACvGvB,IAAAA,EAAE,EAAEA,EAAAA;GACAI,EAAAA,KAAK,CACV,CACE,CAAC,CAAA;AAEV;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/FieldTextInput/FieldTextInput.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 FieldTextInputProps<C> = {\n as?: C;\n error?: string;\n hint?: string;\n id?: string;\n isOptional?: boolean;\n label: string;\n};\n\nexport default function FieldTextInput<C extends React.ElementType>({\n as,\n error,\n hint,\n id,\n isOptional = false,\n label,\n ...props\n}: FieldTextInputProps<C> & React.ComponentPropsWithoutRef<C>) {\n id = id ?? props.name;\n\n const errorId = React.useId();\n const hintId = React.useId();\n\n const InputComponent = as ?? 'input';\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 <InputComponent\n aria-invalid={error ? true : undefined}\n aria-describedby={error && hint ? `${hintId} ${errorId}` : error ? errorId : hint ? hintId : undefined}\n className=\"bds-text-input\"\n id={id}\n {...props}\n />\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","FieldTextInput","_id","as","error","hint","id","_ref$isOptional","isOptional","label","name","errorId","useId","hintId","InputComponent","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,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,gBAAA,CAAAC,aAAA,CAAA,MAA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,MAAA,EAAA;AAAMN,IAAAA,SAAS,EAAC,UAAU;AAACsB,IAAAA,EAAE,EAAEO,MAAAA;GAC5BR,EAAAA,IACG,CACP,EACAD,KAAK,iBAAIf,gBAAA,CAAAC,aAAA,CAACR,YAAY,EAAA;AAACwB,IAAAA,EAAE,EAAEK,OAAAA;GAAUP,EAAAA,KAAoB,CAAC,eAC3Df,gBAAA,CAAAC,aAAA,CAACwB,cAAc,EAAAvB,QAAA,CAAA;AACb,IAAA,cAAA,EAAca,KAAK,GAAG,IAAI,GAAGY,SAAU;IACvC,kBAAkBZ,EAAAA,KAAK,IAAIC,IAAI,GAAA,EAAA,CAAAY,MAAA,CAAMJ,MAAM,OAAAI,MAAA,CAAIN,OAAO,CAAKP,GAAAA,KAAK,GAAGO,OAAO,GAAGN,IAAI,GAAGQ,MAAM,GAAGG,SAAU;AACvGhC,IAAAA,SAAS,EAAC,gBAAgB;AAC1BsB,IAAAA,EAAE,EAAEA,EAAAA;GACApB,EAAAA,KAAK,CACV,CACE,CAAC,CAAA;AAEV;;;;"}
@@ -42,6 +42,27 @@ function _objectWithoutProperties(source, excluded) {
42
42
  return target;
43
43
  }
44
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
+
45
66
  var _excluded = ["as", "error", "hint", "id", "isOptional", "label"];
46
67
  function FieldTextInput(_ref) {
47
68
  var _id;
@@ -58,27 +79,18 @@ function FieldTextInput(_ref) {
58
79
  var hintId = React.useId();
59
80
  var InputComponent = as !== null && as !== void 0 ? as : 'input';
60
81
  return /*#__PURE__*/React.createElement("div", {
61
- className: "bds-text-input stack"
82
+ className: "bds-form-group"
62
83
  }, /*#__PURE__*/React.createElement("label", {
63
84
  htmlFor: id
64
85
  }, label, isOptional && ' (optional)'), hint && /*#__PURE__*/React.createElement("span", {
65
86
  className: "bds-hint",
66
87
  id: hintId
67
- }, hint), error && /*#__PURE__*/React.createElement("span", {
68
- className: "bds-error",
88
+ }, hint), error && /*#__PURE__*/React.createElement(ErrorMessage, {
69
89
  id: errorId
70
- }, /*#__PURE__*/React.createElement("svg", {
71
- xmlns: "http://www.w3.org/2000/svg",
72
- viewBox: "0 0 512 512",
73
- "aria-hidden": "true",
74
- height: "1em",
75
- width: "1em",
76
- fill: "currentColor"
77
- }, /*#__PURE__*/React.createElement("path", {
78
- 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"
79
- })), error), /*#__PURE__*/React.createElement(InputComponent, _extends({
90
+ }, error), /*#__PURE__*/React.createElement(InputComponent, _extends({
80
91
  "aria-invalid": error ? true : undefined,
81
92
  "aria-describedby": error && hint ? "".concat(hintId, " ").concat(errorId) : error ? errorId : hint ? hintId : undefined,
93
+ className: "bds-text-input",
82
94
  id: id
83
95
  }, props)));
84
96
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/FieldTextInput/FieldTextInput.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport type FieldTextInputProps<C> = {\n as?: C;\n error?: string;\n hint?: string;\n id?: string;\n isOptional?: boolean;\n label: string;\n};\n\nexport default function FieldTextInput<C extends React.ElementType>({\n as,\n error,\n hint,\n id,\n isOptional = false,\n label,\n ...props\n}: FieldTextInputProps<C> & React.ComponentPropsWithoutRef<C>) {\n id = id ?? props.name;\n\n const errorId = React.useId();\n const hintId = React.useId();\n\n const InputComponent = as ?? 'input';\n\n return (\n <div className=\"bds-text-input stack\">\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 && (\n <span className=\"bds-error\" id={errorId}>\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 {error}\n </span>\n )}\n <InputComponent\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 );\n}\n"],"names":["FieldTextInput","_ref","_id","as","error","hint","id","_ref$isOptional","isOptional","label","props","_objectWithoutProperties","_excluded","name","errorId","React","useId","hintId","InputComponent","createElement","className","htmlFor","xmlns","viewBox","height","width","fill","d","_extends","undefined","concat"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWe,SAASA,cAAcA,CAAAC,IAAA,EAQyB;AAAA,EAAA,IAAAC,GAAA,CAAA;AAAA,EAAA,IAP7DC,EAAE,GAAAF,IAAA,CAAFE,EAAE;IACFC,KAAK,GAAAH,IAAA,CAALG,KAAK;IACLC,IAAI,GAAAJ,IAAA,CAAJI,IAAI;IACJC,EAAE,GAAAL,IAAA,CAAFK,EAAE;IAAAC,eAAA,GAAAN,IAAA,CACFO,UAAU;AAAVA,IAAAA,UAAU,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,eAAA;IAClBE,KAAK,GAAAR,IAAA,CAALQ,KAAK;AACFC,IAAAA,KAAK,GAAAC,wBAAA,CAAAV,IAAA,EAAAW,SAAA,CAAA,CAAA;EAERN,EAAE,GAAA,CAAAJ,GAAA,GAAGI,EAAE,MAAA,IAAA,IAAAJ,GAAA,KAAA,KAAA,CAAA,GAAAA,GAAA,GAAIQ,KAAK,CAACG,IAAI,CAAA;AAErB,EAAA,IAAMC,OAAO,GAAGC,KAAK,CAACC,KAAK,EAAE,CAAA;AAC7B,EAAA,IAAMC,MAAM,GAAGF,KAAK,CAACC,KAAK,EAAE,CAAA;EAE5B,IAAME,cAAc,GAAGf,EAAE,KAAA,IAAA,IAAFA,EAAE,KAAFA,KAAAA,CAAAA,GAAAA,EAAE,GAAI,OAAO,CAAA;EAEpC,oBACEY,KAAA,CAAAI,aAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,SAAS,EAAC,sBAAA;GACbL,eAAAA,KAAA,CAAAI,aAAA,CAAA,OAAA,EAAA;AAAOE,IAAAA,OAAO,EAAEf,EAAAA;GACbG,EAAAA,KAAK,EACLD,UAAU,IAAI,aACV,CAAC,EACPH,IAAI,iBACHU,KAAA,CAAAI,aAAA,CAAA,MAAA,EAAA;AAAMC,IAAAA,SAAS,EAAC,UAAU;AAACd,IAAAA,EAAE,EAAEW,MAAAA;AAAO,GAAA,EACnCZ,IACG,CACP,EACAD,KAAK,iBACJW,KAAA,CAAAI,aAAA,CAAA,MAAA,EAAA;AAAMC,IAAAA,SAAS,EAAC,WAAW;AAACd,IAAAA,EAAE,EAAEQ,OAAAA;GAC9BC,eAAAA,KAAA,CAAAI,aAAA,CAAA,KAAA,EAAA;AACEG,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;GAELX,eAAAA,KAAA,CAAAI,aAAA,CAAA,MAAA,EAAA;AAAMQ,IAAAA,CAAC,EAAC,4UAAA;AAA4U,GAAE,CACnV,CAAC,EACLvB,KACG,CACP,eACDW,KAAA,CAAAI,aAAA,CAACD,cAAc,EAAAU,QAAA,CAAA;AACb,IAAA,cAAA,EAAcxB,KAAK,GAAG,IAAI,GAAGyB,SAAU;IACvC,kBAAkBzB,EAAAA,KAAK,IAAIC,IAAI,GAAA,EAAA,CAAAyB,MAAA,CAAMb,MAAM,OAAAa,MAAA,CAAIhB,OAAO,CAAKV,GAAAA,KAAK,GAAGU,OAAO,GAAGT,IAAI,GAAGY,MAAM,GAAGY,SAAU;AACvGvB,IAAAA,EAAE,EAAEA,EAAAA;GACAI,EAAAA,KAAK,CACV,CACE,CAAC,CAAA;AAEV;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/FieldTextInput/FieldTextInput.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 FieldTextInputProps<C> = {\n as?: C;\n error?: string;\n hint?: string;\n id?: string;\n isOptional?: boolean;\n label: string;\n};\n\nexport default function FieldTextInput<C extends React.ElementType>({\n as,\n error,\n hint,\n id,\n isOptional = false,\n label,\n ...props\n}: FieldTextInputProps<C> & React.ComponentPropsWithoutRef<C>) {\n id = id ?? props.name;\n\n const errorId = React.useId();\n const hintId = React.useId();\n\n const InputComponent = as ?? 'input';\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 <InputComponent\n aria-invalid={error ? true : undefined}\n aria-describedby={error && hint ? `${hintId} ${errorId}` : error ? errorId : hint ? hintId : undefined}\n className=\"bds-text-input\"\n id={id}\n {...props}\n />\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","FieldTextInput","_id","as","error","hint","id","_ref$isOptional","isOptional","label","name","errorId","useId","hintId","InputComponent","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;;;ACNe,SAASgB,cAAcA,CAAAlB,IAAA,EAQyB;AAAA,EAAA,IAAAmB,GAAA,CAAA;AAAA,EAAA,IAP7DC,EAAE,GAAApB,IAAA,CAAFoB,EAAE;IACFC,KAAK,GAAArB,IAAA,CAALqB,KAAK;IACLC,IAAI,GAAAtB,IAAA,CAAJsB,IAAI;IACJC,EAAE,GAA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GAAGY,SAAU;IACvC,kBAAkBZ,EAAAA,KAAK,IAAIC,IAAI,GAAA,EAAA,CAAAY,MAAA,CAAMJ,MAAM,OAAAI,MAAA,CAAIN,OAAO,CAAKP,GAAAA,KAAK,GAAGO,OAAO,GAAGN,IAAI,GAAGQ,MAAM,GAAGG,SAAU;AACvGhC,IAAAA,SAAS,EAAC,gBAAgB;AAC1BsB,IAAAA,EAAE,EAAEA,EAAAA;GACApB,EAAAA,KAAK,CACV,CACE,CAAC,CAAA;AAEV;;;;"}
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ export type FieldTextareaProps = {
3
+ error?: string;
4
+ hint?: string;
5
+ id?: string;
6
+ isOptional?: boolean;
7
+ label: string;
8
+ };
9
+ export default function FieldTextarea({ error, hint, id, isOptional, label, ...props }: FieldTextareaProps & React.ComponentPropsWithoutRef<'textarea'>): React.JSX.Element;
@@ -0,0 +1,120 @@
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 = ["error", "hint", "id", "isOptional", "label"];
90
+ function FieldTextarea(_ref) {
91
+ var _id;
92
+ var error = _ref.error,
93
+ hint = _ref.hint,
94
+ id = _ref.id,
95
+ _ref$isOptional = _ref.isOptional,
96
+ isOptional = _ref$isOptional === void 0 ? false : _ref$isOptional,
97
+ label = _ref.label,
98
+ props = _objectWithoutProperties(_ref, _excluded);
99
+ id = (_id = id) !== null && _id !== void 0 ? _id : props.name;
100
+ var errorId = React__namespace.useId();
101
+ var hintId = React__namespace.useId();
102
+ return /*#__PURE__*/React__namespace.createElement("div", {
103
+ className: "bds-form-group"
104
+ }, /*#__PURE__*/React__namespace.createElement("label", {
105
+ htmlFor: id
106
+ }, label, isOptional && ' (optional)'), hint && /*#__PURE__*/React__namespace.createElement("span", {
107
+ className: "bds-hint",
108
+ id: hintId
109
+ }, hint), error && /*#__PURE__*/React__namespace.createElement(ErrorMessage, {
110
+ id: errorId
111
+ }, error), /*#__PURE__*/React__namespace.createElement("textarea", _extends({
112
+ "aria-invalid": error ? true : undefined,
113
+ "aria-describedby": error && hint ? "".concat(hintId, " ").concat(errorId) : error ? errorId : hint ? hintId : undefined,
114
+ className: "bds-textarea",
115
+ id: id
116
+ }, props)));
117
+ }
118
+
119
+ exports.default = FieldTextarea;
120
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/FieldTextarea/FieldTextarea.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';\n\nimport ErrorMessage from '../ErrorMessage';\n\nexport type FieldTextareaProps = {\n error?: string;\n hint?: string;\n id?: string;\n isOptional?: boolean;\n label: string;\n};\n\nexport default function FieldTextarea({\n error,\n hint,\n id,\n isOptional = false,\n label,\n ...props\n}: FieldTextareaProps & React.ComponentPropsWithoutRef<'textarea'>) {\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 <textarea\n aria-invalid={error ? true : undefined}\n aria-describedby={error && hint ? `${hintId} ${errorId}` : error ? errorId : hint ? hintId : undefined}\n className=\"bds-textarea\"\n id={id}\n {...props}\n />\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","FieldTextarea","_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,QAA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
+ _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 = ["error", "hint", "id", "isOptional", "label"];
67
+ function FieldTextarea(_ref) {
68
+ var _id;
69
+ var error = _ref.error,
70
+ hint = _ref.hint,
71
+ id = _ref.id,
72
+ _ref$isOptional = _ref.isOptional,
73
+ isOptional = _ref$isOptional === void 0 ? false : _ref$isOptional,
74
+ label = _ref.label,
75
+ props = _objectWithoutProperties(_ref, _excluded);
76
+ id = (_id = id) !== null && _id !== void 0 ? _id : props.name;
77
+ var errorId = React.useId();
78
+ var hintId = React.useId();
79
+ return /*#__PURE__*/React.createElement("div", {
80
+ className: "bds-form-group"
81
+ }, /*#__PURE__*/React.createElement("label", {
82
+ htmlFor: id
83
+ }, label, isOptional && ' (optional)'), hint && /*#__PURE__*/React.createElement("span", {
84
+ className: "bds-hint",
85
+ id: hintId
86
+ }, hint), error && /*#__PURE__*/React.createElement(ErrorMessage, {
87
+ id: errorId
88
+ }, error), /*#__PURE__*/React.createElement("textarea", _extends({
89
+ "aria-invalid": error ? true : undefined,
90
+ "aria-describedby": error && hint ? "".concat(hintId, " ").concat(errorId) : error ? errorId : hint ? hintId : undefined,
91
+ className: "bds-textarea",
92
+ id: id
93
+ }, props)));
94
+ }
95
+
96
+ export { FieldTextarea as default };
97
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/FieldTextarea/FieldTextarea.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';\n\nimport ErrorMessage from '../ErrorMessage';\n\nexport type FieldTextareaProps = {\n error?: string;\n hint?: string;\n id?: string;\n isOptional?: boolean;\n label: string;\n};\n\nexport default function FieldTextarea({\n error,\n hint,\n id,\n isOptional = false,\n label,\n ...props\n}: FieldTextareaProps & React.ComponentPropsWithoutRef<'textarea'>) {\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 <textarea\n aria-invalid={error ? true : undefined}\n aria-describedby={error && hint ? `${hintId} ${errorId}` : error ? errorId : hint ? hintId : undefined}\n className=\"bds-textarea\"\n id={id}\n {...props}\n />\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","FieldTextarea","_id","error","hint","id","_ref$isOptional","isOptional","label","name","errorId","useId","hintId","htmlF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AEA,EAAAA;GACAnB,EAAAA,KAAK,CACV,CACE,CAAC,CAAA;AAEV;;;;"}
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@iabbb/bds-react/FieldTextarea",
3
+ "private": true,
4
+ "main": "./index.cjs",
5
+ "module": "./index.mjs",
6
+ "types": "./index.d.ts"
7
+ }
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ export type FieldsetProps = {
3
+ error?: string;
4
+ hint?: string;
5
+ isOptional?: boolean;
6
+ legend: React.ReactNode | string;
7
+ showOptionsInline?: boolean;
8
+ };
9
+ export default function Fieldset({ children, className, error, hint, isOptional, legend, showOptionsInline, ...props }: FieldsetProps & React.ComponentPropsWithoutRef<'fieldset'>): React.JSX.Element;