@iabbb/bds-react 0.45.3 → 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/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 +31 -19
- package/index.cjs.map +1 -1
- package/index.mjs +31 -19
- package/index.mjs.map +1 -1
- package/package.json +10 -10
|
@@ -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,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,MAAA,EAAA;AAAMU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IAAAA,EAAE,EAAEK,OAAAA;AAAQ,GAAA,EAAEP,KAAoB,CAAC,eAC3Dd,gBAAA,CAAAC,aAAA,aAAAC,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;AACvG9B,IAAAA,SAAS,EAAC,cAAc;AACxBqB,IAAAA,EAAE,EAAEA,EAAAA;GACAnB,EAAAA,KAAK,CACV,CACE,CAAC,CAAA;AAEV;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './FieldTextarea';
|
|
@@ -0,0 +1,97 @@
|
|
|
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 = ["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","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,aAAaA,CAAAlB,IAAA,EAO+B;AAAA,EAAA,IAAAmB,GAAA,CAAA;AAAA,EAAA,IANlEC,KAAK,GAAApB,IAAA,CAALoB,KAAK;IACLC,IAAI,GAAArB,IAAA,CAAJqB,IAAI;IACJC,EAAE,GAAAtB,IAAA,CAAFsB,EAAE;IAAAC,eAAA,GAAAvB,IAAA,CACFwB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,GAAGE,SAAU;AACvG9B,IAAAA,SAAS,EAAC,cAAc;AACxBqB,IAAAA,EAAE,EAAEA,EAAAA;GACAnB,EAAAA,KAAK,CACV,CACE,CAAC,CAAA;AAEV;;;;"}
|
|
@@ -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;
|
|
@@ -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,K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C,CAACQ,MAAM,CAAC,UAACC,CAAC,EAAA;AAAA,MAAA,OAAKA,CAAC,CAAA;KAAC,CAAA,CAACC,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,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,CAACR,YAAY,EAAA;AAAC8B,IAAAA,EAAE,EAAEL,OAAAA;AAAQ,GAAA,EAAEL,KAAoB,CAAC,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,E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A,MAAM,EAAC,KAAA;GAEPR,eAAAA,gBAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AAAMU,IAAAA,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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,YAAY,GAAG;AACnBC,EAAAA,EAAE,EAAE,IAAI;AACRC,EAAAA,EAAE,EAAE,IAAI;AACRC,EAAAA,EAAE,EAAE,IAAI;AACRC,EAAAA,EAAE,EAAE,IAAI;AACRC,EAAAA,EAAE,EAAE,IAAI;AACRC,EAAAA,IAAI,EAAE,GAAA;AACR,CAAC,CAAA;AAED,IAAMC,QAAQ,GAAG;AACfN,EAAAA,EAAE,EAAE,QAAQ;AACZC,EAAAA,EAAE,EAAE,QAAQ;AACZC,EAAAA,EAAE,EAAE,QAAQ;AACZC,EAAAA,EAAE,EAAE,QAAQ;AACZC,EAAAA,EAAE,EAAE,QAAQ;AACZC,EAAAA,IAAI,EAAE,UAAA;AACR,CAAC,CAAA;AAOKE,IAAAA,UAAU,gBAAGC,gBAAK,CAACC,UAAU,CACjC,UAAAC,IAAA,EAAuDC,GAAG,EAAK;AAAA,EAAA,IAA5DC,SAAS,GAAAF,IAAA,CAATE,SAAS;IAAEC,SAAS,GAAAH,IAAA,CAATG,SAAS;IAAAC,YAAA,GAAAJ,IAAA,CAAEK,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,YAAA;AAAKE,IAAAA,KAAK,GAAAC,wBAAA,CAAAP,IAAA,EAAAQ,SAAA,CAAA,CAAA;EACjD,IAAMC,SAAS,GAAGN,SAAS,KAATA,IAAAA,IAAAA,SAAS,KAATA,KAAAA,CAAAA,GAAAA,SAAS,GAAKd,YAAY,CAACgB,OAAO,CAAuB,CAAA;AAE3E,EAAA,oBACEP,gBAAA,CAAAY,aAAA,CAACD,SAAS,EAAAE,QAAA,CAAA;AAACT,IAAAA,SAAS,EAAE,CAACN,QAAQ,CA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