@iabbb/bds-react 0.38.2 → 0.38.4

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 (44) hide show
  1. package/package.json +7 -16
  2. package/src/Button/Button.js +54 -0
  3. package/src/Button/index.js +1 -0
  4. package/src/CallToAction/CallToAction.js +16 -0
  5. package/src/CallToAction/index.js +1 -0
  6. package/src/ErrorSummary/ErrorSummary.js +102 -0
  7. package/src/ErrorSummary/index.js +2 -0
  8. package/{ErrorSummary → src/ErrorSummary}/utils.js +14 -13
  9. package/src/FieldTextInput/FieldTextInput.js +46 -0
  10. package/src/FieldTextInput/index.js +1 -0
  11. package/src/Pagination/Pagination.js +101 -0
  12. package/src/Pagination/index.js +1 -0
  13. package/src/Typography/Typography.js +26 -0
  14. package/src/Typography/index.js +1 -0
  15. package/src/index.js +6 -0
  16. package/Button/Button.js +0 -53
  17. package/Button/Button.js.map +0 -1
  18. package/Button/index.js +0 -4
  19. package/Button/index.js.map +0 -1
  20. package/CallToAction/CallToAction.js +0 -21
  21. package/CallToAction/CallToAction.js.map +0 -1
  22. package/CallToAction/index.js +0 -4
  23. package/CallToAction/index.js.map +0 -1
  24. package/ErrorSummary/ErrorSummary.js +0 -91
  25. package/ErrorSummary/ErrorSummary.js.map +0 -1
  26. package/ErrorSummary/index.js +0 -5
  27. package/ErrorSummary/index.js.map +0 -1
  28. package/ErrorSummary/utils.js.map +0 -1
  29. package/FieldTextInput/FieldTextInput.js +0 -47
  30. package/FieldTextInput/FieldTextInput.js.map +0 -1
  31. package/FieldTextInput/index.js +0 -4
  32. package/FieldTextInput/index.js.map +0 -1
  33. package/Pagination/Pagination.js +0 -93
  34. package/Pagination/Pagination.js.map +0 -1
  35. package/Pagination/index.js +0 -4
  36. package/Pagination/index.js.map +0 -1
  37. package/Typography/Typography.js +0 -37
  38. package/Typography/Typography.js.map +0 -1
  39. package/Typography/index.js +0 -4
  40. package/Typography/index.js.map +0 -1
  41. package/_rollupPluginBabelHelpers-9e645d4a.js +0 -69
  42. package/_rollupPluginBabelHelpers-9e645d4a.js.map +0 -1
  43. package/index.js +0 -10
  44. package/index.js.map +0 -1
package/package.json CHANGED
@@ -1,27 +1,18 @@
1
1
  {
2
2
  "name": "@iabbb/bds-react",
3
- "version": "0.38.2",
4
- "main": "index.js",
5
- "type": "module",
6
- "scripts": {
7
- "build": "cross-env NODE_ENV=production rollup -c",
8
- "dev": "rollup -c -w"
3
+ "version": "0.38.4",
4
+ "main": "src/index.js",
5
+ "exports": {
6
+ "./*": "./src/*",
7
+ "./package.json": "./package.json",
8
+ "./README.md": "./README.md"
9
9
  },
10
10
  "devDependencies": {
11
11
  "@babel/core": "7.22.8",
12
12
  "@babel/preset-env": "7.22.7",
13
13
  "@babel/preset-react": "7.22.5",
14
- "@rollup/plugin-babel": "6.0.3",
15
- "@rollup/plugin-commonjs": "25.0.2",
16
- "@rollup/plugin-node-resolve": "15.1.0",
17
- "@rollup/plugin-terser": "0.4.3",
18
14
  "cross-env": "7.0.3",
19
- "glob": "10.3.1",
20
- "react": "18.2.0",
21
- "rollup": "3.25.1",
22
- "rollup-plugin-delete": "2.0.0",
23
- "rollup-plugin-peer-deps-external": "2.2.4",
24
- "rollup-plugin-summary": "2.0.0"
15
+ "react": "18.2.0"
25
16
  },
26
17
  "peerDependencies": {
27
18
  "@iabbb/bds": "0.38.1",
@@ -0,0 +1,54 @@
1
+ import * as React from 'react';
2
+
3
+ const DEBOUNCE_TIMEOUT_IN_SECONDS = 1;
4
+
5
+ const Button = React.forwardRef(
6
+ ({ children, className, onClick, preventDoubleClick = false, variant = 'standard', ...props }, ref) => {
7
+ const debounceClicks = React.useRef(false);
8
+
9
+ const handleClick = (event) => {
10
+ // 👇 button is not configured to ignore double clicks
11
+ if (!preventDoubleClick) {
12
+ if (onClick) {
13
+ onClick(event);
14
+ }
15
+
16
+ return;
17
+ }
18
+
19
+ // 👇 button has been clicked recently, and subsequent clicks are prevented
20
+ if (debounceClicks.current) {
21
+ event.preventDefault();
22
+ return false;
23
+ }
24
+
25
+ if (onClick) {
26
+ onClick(event);
27
+ }
28
+
29
+ // 👇 block from double clicks
30
+ debounceClicks.current = true;
31
+
32
+ // 👇 and remove the block after a given amount of seconds
33
+ setTimeout(() => {
34
+ debounceClicks.current = false;
35
+ }, DEBOUNCE_TIMEOUT_IN_SECONDS * 1000);
36
+ };
37
+
38
+ return (
39
+ <button
40
+ className={[variant === 'unstyled' ? 'bds-button-unstyled' : 'bds-button', className]
41
+ .filter((x) => x)
42
+ .join(' ')}
43
+ data-type={variant !== 'standard' && variant !== 'unstyled' ? variant : null}
44
+ onClick={handleClick}
45
+ ref={ref}
46
+ {...props}
47
+ >
48
+ {children}
49
+ </button>
50
+ );
51
+ },
52
+ );
53
+
54
+ export default Button;
@@ -0,0 +1 @@
1
+ export { default } from './Button';
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+
3
+ const CallToAction = React.forwardRef(({ children, className, variant = 'standard', ...props }, ref) => {
4
+ return (
5
+ <a
6
+ className={['bds-cta', className].filter((x) => x).join(' ')}
7
+ data-type={variant !== 'standard' ? variant : null}
8
+ ref={ref}
9
+ {...props}
10
+ >
11
+ {children}
12
+ </a>
13
+ );
14
+ });
15
+
16
+ export default CallToAction;
@@ -0,0 +1 @@
1
+ export { default } from './CallToAction';
@@ -0,0 +1,102 @@
1
+ import * as React from 'react';
2
+
3
+ import { getAssociatedLegendOrLabel, getFragmentFromUrl } from './utils';
4
+
5
+ export const FormErrorKey = '_form';
6
+
7
+ const FINAL_FORM_ERROR = 'FINAL_FORM/form-error';
8
+
9
+ export default function BdsErrorSummary({ className, errors, mapNameToId = (name) => name, ...props }) {
10
+ const headingId = React.useId();
11
+ const groupRef = React.useRef(null);
12
+
13
+ React.useEffect(() => {
14
+ if (!errors || Object.keys(errors).length === 0) return;
15
+ if (!groupRef.current) return;
16
+
17
+ groupRef.current.focus();
18
+ }, [errors]);
19
+
20
+ if (!errors || Object.keys(errors).length === 0) return null;
21
+
22
+ const handleLinkClick = (e) => {
23
+ const inputId = getFragmentFromUrl(e.currentTarget.href);
24
+
25
+ if (!inputId) {
26
+ return;
27
+ }
28
+
29
+ const input = document.getElementById(inputId);
30
+
31
+ if (!input) {
32
+ return;
33
+ }
34
+
35
+ const legendOrLabel = getAssociatedLegendOrLabel(input);
36
+
37
+ if (!legendOrLabel) {
38
+ return;
39
+ }
40
+
41
+ e.preventDefault();
42
+
43
+ legendOrLabel.scrollIntoView();
44
+ input.focus({ preventScroll: true });
45
+ };
46
+
47
+ return (
48
+ <bds-error-summary
49
+ className={['stack', className].filter((x) => x).join(' ')}
50
+ role="group"
51
+ aria-labelledby={headingId}
52
+ ref={groupRef}
53
+ tabIndex={-1}
54
+ {...props}
55
+ >
56
+ <h2 className="bds-h5" id={headingId}>
57
+ <svg
58
+ xmlns="http://www.w3.org/2000/svg"
59
+ viewBox="0 0 512 512"
60
+ aria-hidden="true"
61
+ height="1em"
62
+ width="1em"
63
+ fill="currentColor"
64
+ >
65
+ <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" />
66
+ </svg>
67
+ Issue
68
+ </h2>
69
+ <ul>
70
+ {Object.keys(errors).map((errorKey) => {
71
+ const message = errors[errorKey];
72
+ const isFormError = [FINAL_FORM_ERROR, FormErrorKey].includes(errorKey);
73
+
74
+ if (isFormError) {
75
+ return <li key={errorKey} dangerouslySetInnerHTML={{ __html: message }} />;
76
+ }
77
+
78
+ const isArrayField = Array.isArray(message);
79
+
80
+ const messages = isArrayField ? message : [message];
81
+
82
+ return (
83
+ <React.Fragment key={errorKey}>
84
+ {messages.map((fieldMessage, index) => {
85
+ const inputId = `${mapNameToId(errorKey)}${isArrayField ? `[${index}]` : ''}`;
86
+
87
+ return (
88
+ <li key={inputId}>
89
+ <a href={`#${inputId}`} onClick={handleLinkClick}>
90
+ {fieldMessage}
91
+ {messages.length > 1 ? ` (${index + 1} of ${messages.length})` : undefined}
92
+ </a>
93
+ </li>
94
+ );
95
+ })}
96
+ </React.Fragment>
97
+ );
98
+ })}
99
+ </ul>
100
+ </bds-error-summary>
101
+ );
102
+ }
@@ -0,0 +1,2 @@
1
+ export { default } from './ErrorSummary';
2
+ export * from './ErrorSummary';
@@ -1,13 +1,15 @@
1
- function getFragmentFromUrl(url) {
1
+ export function getFragmentFromUrl(url) {
2
2
  return url.includes('#') ? url.split('#').pop() : undefined;
3
3
  }
4
- function getAssociatedLegendOrLabel(input) {
5
- var _document$querySelect;
6
- var fieldset = input.closest('fieldset');
4
+
5
+ export function getAssociatedLegendOrLabel(input) {
6
+ const fieldset = input.closest('fieldset');
7
+
7
8
  if (fieldset) {
8
- var legends = fieldset.getElementsByTagName('legend');
9
+ const legends = fieldset.getElementsByTagName('legend');
10
+
9
11
  if (legends.length) {
10
- var candidateLegend = legends[0];
12
+ const candidateLegend = legends[0];
11
13
 
12
14
  // If the input type is radio or checkbox, always use the legend if there
13
15
  // is one.
@@ -21,21 +23,20 @@ function getAssociatedLegendOrLabel(input) {
21
23
  //
22
24
  // This should avoid situations where the input either ends up off the
23
25
  // screen, or obscured by a software keyboard.
24
- var legendTop = candidateLegend.getBoundingClientRect().top;
25
- var inputRect = input.getBoundingClientRect();
26
+ const legendTop = candidateLegend.getBoundingClientRect().top;
27
+ const inputRect = input.getBoundingClientRect();
26
28
 
27
29
  // If the browser doesn't support Element.getBoundingClientRect().height
28
30
  // or window.innerHeight (like IE8), bail and just link to the label.
29
31
  if (inputRect.height && window.innerHeight) {
30
- var inputBottom = inputRect.top + inputRect.height;
32
+ const inputBottom = inputRect.top + inputRect.height;
33
+
31
34
  if (inputBottom - legendTop < window.innerHeight / 2) {
32
35
  return candidateLegend;
33
36
  }
34
37
  }
35
38
  }
36
39
  }
37
- return (_document$querySelect = document.querySelector("label[for='".concat(input.getAttribute('id'), "']"))) !== null && _document$querySelect !== void 0 ? _document$querySelect : input.closest('label');
38
- }
39
40
 
40
- export { getAssociatedLegendOrLabel, getFragmentFromUrl };
41
- //# sourceMappingURL=utils.js.map
41
+ return document.querySelector(`label[for='${input.getAttribute('id')}']`) ?? input.closest('label');
42
+ }
@@ -0,0 +1,46 @@
1
+ import * as React from 'react';
2
+
3
+ export default function FieldTextInput({ as, error, hint, id, isOptional = false, label, ...props }) {
4
+ id = id ?? props.name;
5
+
6
+ const errorId = React.useId();
7
+ const hintId = React.useId();
8
+
9
+ const InputComponent = as ?? 'input';
10
+
11
+ return (
12
+ <div className="bds-text-input stack">
13
+ <label htmlFor={id}>
14
+ {label}
15
+ {isOptional && ' (optional)'}
16
+ </label>
17
+ {hint && (
18
+ <span className="bds-hint" id={hintId}>
19
+ {hint}
20
+ </span>
21
+ )}
22
+ {error && (
23
+ <span className="bds-error" id={errorId}>
24
+ <svg
25
+ xmlns="http://www.w3.org/2000/svg"
26
+ viewBox="0 0 512 512"
27
+ aria-hidden="true"
28
+ height="1em"
29
+ width="1em"
30
+ fill="currentColor"
31
+ >
32
+ <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" />
33
+ </svg>
34
+ {error}
35
+ </span>
36
+ )}
37
+ <InputComponent
38
+ aria-invalid={error ? true : undefined}
39
+ aria-describedby={error && hint ? `${hintId} ${errorId}` : error ? errorId : hint ? hintId : undefined}
40
+ aria-required={isOptional ? undefined : true}
41
+ id={id}
42
+ {...props}
43
+ />
44
+ </div>
45
+ );
46
+ }
@@ -0,0 +1 @@
1
+ export { default } from './FieldTextInput';
@@ -0,0 +1,101 @@
1
+ import * as React from 'react';
2
+
3
+ function usePages(currentPage, totalPages) {
4
+ const pages = [1, currentPage - 1, currentPage, currentPage + 1, totalPages].filter(
5
+ (x) => x >= 1 && x <= totalPages,
6
+ );
7
+ return [...new Set(pages)];
8
+ }
9
+
10
+ export default function Pagination({ buildPageUrl, className, currentPage, onPageClick, totalPages, ...props }) {
11
+ const pages = usePages(currentPage, totalPages);
12
+
13
+ return (
14
+ <nav aria-label="pagination" className={['bds-pagination', className].filter((x) => x).join(' ')} {...props}>
15
+ {currentPage !== 1 && (
16
+ <>
17
+ <a href={buildPageUrl(1)} className="bds-first-page">
18
+ <svg
19
+ xmlns="http://www.w3.org/2000/svg"
20
+ aria-hidden="true"
21
+ focusable="false"
22
+ height="1em"
23
+ width="100%"
24
+ viewBox="0 63.95 512 384.1"
25
+ >
26
+ <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" />
27
+ </svg>
28
+ First
29
+ </a>
30
+ <a aria-label="previous" href={buildPageUrl(currentPage - 1)} rel="prev">
31
+ <svg
32
+ xmlns="http://www.w3.org/2000/svg"
33
+ aria-hidden="true"
34
+ focusable="false"
35
+ width="100%"
36
+ height="1em"
37
+ viewBox="0.02 95.9 192.08 320.17"
38
+ >
39
+ <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" />
40
+ </svg>
41
+ Prev.
42
+ </a>
43
+ </>
44
+ )}
45
+ <ul>
46
+ {pages.map((page, index) => {
47
+ const handlePageClick = () => {
48
+ if (!onPageClick) return;
49
+
50
+ onPageClick(page);
51
+ };
52
+
53
+ return (
54
+ <React.Fragment key={page}>
55
+ <li>
56
+ <a
57
+ aria-current={page === currentPage ? 'page' : undefined}
58
+ href={buildPageUrl(page)}
59
+ onClick={handlePageClick}
60
+ >
61
+ <span className="visually-hidden">Page</span> {page}
62
+ </a>
63
+ </li>
64
+ {pages[index + 1] > page + 1 ? <li data-overflow="">...</li> : null}
65
+ </React.Fragment>
66
+ );
67
+ })}
68
+ </ul>
69
+ {currentPage !== totalPages && (
70
+ <>
71
+ <a href={buildPageUrl(currentPage + 1)} rel="next">
72
+ Next
73
+ <svg
74
+ xmlns="http://www.w3.org/2000/svg"
75
+ aria-hidden="true"
76
+ focusable="false"
77
+ viewBox="63.9 95.9 192.1 320.17"
78
+ width="100%"
79
+ height="1em"
80
+ >
81
+ <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" />
82
+ </svg>
83
+ </a>
84
+ <a href={buildPageUrl(totalPages)} className="bds-last-page">
85
+ Last
86
+ <svg
87
+ xmlns="http://www.w3.org/2000/svg"
88
+ aria-hidden="true"
89
+ focusable="false"
90
+ width="100%"
91
+ height="1em"
92
+ viewBox="0 63.95 512 384.1"
93
+ >
94
+ <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" />
95
+ </svg>
96
+ </a>
97
+ </>
98
+ )}
99
+ </nav>
100
+ );
101
+ }
@@ -0,0 +1 @@
1
+ export { default } from './Pagination';
@@ -0,0 +1,26 @@
1
+ import * as React from 'react';
2
+
3
+ const componentMap = {
4
+ h1: 'h1',
5
+ h2: 'h2',
6
+ h3: 'h3',
7
+ h4: 'h4',
8
+ h5: 'h5',
9
+ body: 'p',
10
+ };
11
+
12
+ const classMap = {
13
+ h1: 'bds-h1',
14
+ h2: 'bds-h2',
15
+ h3: 'bds-h3',
16
+ h4: 'bds-h4',
17
+ h5: 'bds-h5',
18
+ body: 'bds-body',
19
+ };
20
+
21
+ const Typography = React.forwardRef(({ className, component, variant = 'body', ...props }, ref) => {
22
+ const Component = component ?? componentMap[variant];
23
+ return <Component className={[classMap[variant], className].filter((x) => x).join(' ')} ref={ref} {...props} />;
24
+ });
25
+
26
+ export default Typography;
@@ -0,0 +1 @@
1
+ export { default } from './Typography';
package/src/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export { default as Button } from './Button/index';
2
+ export { default as CallToAction } from './CallToAction/index';
3
+ export { default as ErrorSummary } from './ErrorSummary/index';
4
+ export { default as FieldTextInput } from './FieldTextInput/index';
5
+ export { default as Pagination } from './Pagination/index';
6
+ export { default as Typography } from './Typography/index';
package/Button/Button.js DELETED
@@ -1,53 +0,0 @@
1
- import { _ as _objectWithoutProperties, a as _extends } from '../_rollupPluginBabelHelpers-9e645d4a.js';
2
- import * as React from 'react';
3
-
4
- var _excluded = ["children", "className", "onClick", "preventDoubleClick", "variant"];
5
- var DEBOUNCE_TIMEOUT_IN_SECONDS = 1;
6
- var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
7
- var children = _ref.children,
8
- className = _ref.className,
9
- onClick = _ref.onClick,
10
- _ref$preventDoubleCli = _ref.preventDoubleClick,
11
- preventDoubleClick = _ref$preventDoubleCli === void 0 ? false : _ref$preventDoubleCli,
12
- _ref$variant = _ref.variant,
13
- variant = _ref$variant === void 0 ? 'standard' : _ref$variant,
14
- props = _objectWithoutProperties(_ref, _excluded);
15
- var debounceClicks = React.useRef(false);
16
- var handleClick = function handleClick(event) {
17
- // 👇 button is not configured to ignore double clicks
18
- if (!preventDoubleClick) {
19
- if (onClick) {
20
- onClick(event);
21
- }
22
- return;
23
- }
24
-
25
- // 👇 button has been clicked recently, and subsequent clicks are prevented
26
- if (debounceClicks.current) {
27
- event.preventDefault();
28
- return false;
29
- }
30
- if (onClick) {
31
- onClick(event);
32
- }
33
-
34
- // 👇 block from double clicks
35
- debounceClicks.current = true;
36
-
37
- // 👇 and remove the block after a given amount of seconds
38
- setTimeout(function () {
39
- debounceClicks.current = false;
40
- }, DEBOUNCE_TIMEOUT_IN_SECONDS * 1000);
41
- };
42
- return /*#__PURE__*/React.createElement("button", _extends({
43
- className: [variant === 'unstyled' ? 'bds-button-unstyled' : 'bds-button', className].filter(function (x) {
44
- return x;
45
- }).join(' '),
46
- "data-type": variant !== 'standard' && variant !== 'unstyled' ? variant : null,
47
- onClick: handleClick,
48
- ref: ref
49
- }, props), children);
50
- });
51
-
52
- export { Button as default };
53
- //# sourceMappingURL=Button.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Button.js","sources":["../../src/Button/Button.js"],"sourcesContent":["import * as React from 'react';\n\nconst DEBOUNCE_TIMEOUT_IN_SECONDS = 1;\n\nconst Button = React.forwardRef(\n ({ children, className, onClick, preventDoubleClick = false, variant = 'standard', ...props }, ref) => {\n const debounceClicks = React.useRef(false);\n\n const handleClick = (event) => {\n // 👇 button is not configured to ignore double clicks\n if (!preventDoubleClick) {\n if (onClick) {\n onClick(event);\n }\n\n return;\n }\n\n // 👇 button has been clicked recently, and subsequent clicks are prevented\n if (debounceClicks.current) {\n event.preventDefault();\n return false;\n }\n\n if (onClick) {\n onClick(event);\n }\n\n // 👇 block from double clicks\n debounceClicks.current = true;\n\n // 👇 and remove the block after a given amount of seconds\n setTimeout(() => {\n debounceClicks.current = false;\n }, DEBOUNCE_TIMEOUT_IN_SECONDS * 1000);\n };\n\n return (\n <button\n className={[variant === 'unstyled' ? 'bds-button-unstyled' : 'bds-button', className]\n .filter((x) => x)\n .join(' ')}\n data-type={variant !== 'standard' && variant !== 'unstyled' ? variant : null}\n onClick={handleClick}\n ref={ref}\n {...props}\n >\n {children}\n </button>\n );\n },\n);\n\nexport default Button;\n"],"names":["DEBOUNCE_TIMEOUT_IN_SECONDS","Button","React","forwardRef","_ref","ref","children","className","onClick","_ref$preventDoubleCli","preventDoubleClick","_ref$variant","variant","props","_objectWithoutProperties","_excluded","debounceClicks","useRef","handleClick","event","current","preventDefault","setTimeout","createElement","_extends","filter","x","join"],"mappings":";;;;AAEA,IAAMA,2BAA2B,GAAG,CAAC,CAAA;AAE/BC,IAAAA,MAAM,gBAAGC,KAAK,CAACC,UAAU,CAC7B,UAAAC,IAAA,EAA+FC,GAAG,EAAK;AAAA,EAAA,IAApGC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAEC,SAAS,GAAAH,IAAA,CAATG,SAAS;IAAEC,OAAO,GAAAJ,IAAA,CAAPI,OAAO;IAAAC,qBAAA,GAAAL,IAAA,CAAEM,kBAAkB;AAAlBA,IAAAA,kBAAkB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,qBAAA;IAAAE,YAAA,GAAAP,IAAA,CAAEQ,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAG,KAAA,CAAA,GAAA,UAAU,GAAAA,YAAA;AAAKE,IAAAA,KAAK,GAAAC,wBAAA,CAAAV,IAAA,EAAAW,SAAA,CAAA,CAAA;AACzF,EAAA,IAAMC,cAAc,GAAGd,KAAK,CAACe,MAAM,CAAC,KAAK,CAAC,CAAA;AAE1C,EAAA,IAAMC,WAAW,GAAG,SAAdA,WAAWA,CAAIC,KAAK,EAAK;AAC7B;IACA,IAAI,CAACT,kBAAkB,EAAE;AACvB,MAAA,IAAIF,OAAO,EAAE;QACXA,OAAO,CAACW,KAAK,CAAC,CAAA;AAChB,OAAA;AAEA,MAAA,OAAA;AACF,KAAA;;AAEA;IACA,IAAIH,cAAc,CAACI,OAAO,EAAE;MAC1BD,KAAK,CAACE,cAAc,EAAE,CAAA;AACtB,MAAA,OAAO,KAAK,CAAA;AACd,KAAA;AAEA,IAAA,IAAIb,OAAO,EAAE;MACXA,OAAO,CAACW,KAAK,CAAC,CAAA;AAChB,KAAA;;AAEA;IACAH,cAAc,CAACI,OAAO,GAAG,IAAI,CAAA;;AAE7B;AACAE,IAAAA,UAAU,CAAC,YAAM;MACfN,cAAc,CAACI,OAAO,GAAG,KAAK,CAAA;AAChC,KAAC,EAAEpB,2BAA2B,GAAG,IAAI,CAAC,CAAA;GACvC,CAAA;AAED,EAAA,oBACEE,KAAA,CAAAqB,aAAA,CAAA,QAAA,EAAAC,QAAA,CAAA;AACEjB,IAAAA,SAAS,EAAE,CAACK,OAAO,KAAK,UAAU,GAAG,qBAAqB,GAAG,YAAY,EAAEL,SAAS,CAAC,CAClFkB,MAAM,CAAC,UAACC,CAAC,EAAA;AAAA,MAAA,OAAKA,CAAC,CAAA;AAAA,KAAA,CAAC,CAChBC,IAAI,CAAC,GAAG,CAAE;IACb,WAAWf,EAAAA,OAAO,KAAK,UAAU,IAAIA,OAAO,KAAK,UAAU,GAAGA,OAAO,GAAG,IAAK;AAC7EJ,IAAAA,OAAO,EAAEU,WAAY;AACrBb,IAAAA,GAAG,EAAEA,GAAAA;GACDQ,EAAAA,KAAK,CAERP,EAAAA,QACK,CAAC,CAAA;AAEb,CACF;;;;"}
package/Button/index.js DELETED
@@ -1,4 +0,0 @@
1
- export { default } from './Button.js';
2
- import '../_rollupPluginBabelHelpers-9e645d4a.js';
3
- import 'react';
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -1,21 +0,0 @@
1
- import { _ as _objectWithoutProperties, a as _extends } from '../_rollupPluginBabelHelpers-9e645d4a.js';
2
- import * as React from 'react';
3
-
4
- var _excluded = ["children", "className", "variant"];
5
- var CallToAction = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
6
- var children = _ref.children,
7
- className = _ref.className,
8
- _ref$variant = _ref.variant,
9
- variant = _ref$variant === void 0 ? 'standard' : _ref$variant,
10
- props = _objectWithoutProperties(_ref, _excluded);
11
- return /*#__PURE__*/React.createElement("a", _extends({
12
- className: ['bds-cta', className].filter(function (x) {
13
- return x;
14
- }).join(' '),
15
- "data-type": variant !== 'standard' ? variant : null,
16
- ref: ref
17
- }, props), children);
18
- });
19
-
20
- export { CallToAction as default };
21
- //# sourceMappingURL=CallToAction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CallToAction.js","sources":["../../src/CallToAction/CallToAction.js"],"sourcesContent":["import * as React from 'react';\n\nconst CallToAction = React.forwardRef(({ children, className, variant = 'standard', ...props }, ref) => {\n return (\n <a\n className={['bds-cta', className].filter((x) => x).join(' ')}\n data-type={variant !== 'standard' ? variant : null}\n ref={ref}\n {...props}\n >\n {children}\n </a>\n );\n});\n\nexport default CallToAction;\n"],"names":["CallToAction","React","forwardRef","_ref","ref","children","className","_ref$variant","variant","props","_objectWithoutProperties","_excluded","createElement","_extends","filter","x","join"],"mappings":";;;;AAEMA,IAAAA,YAAY,gBAAGC,KAAK,CAACC,UAAU,CAAC,UAAAC,IAAA,EAA0DC,GAAG,EAAK;AAAA,EAAA,IAA/DC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAEC,SAAS,GAAAH,IAAA,CAATG,SAAS;IAAAC,YAAA,GAAAJ,IAAA,CAAEK,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAG,KAAA,CAAA,GAAA,UAAU,GAAAA,YAAA;AAAKE,IAAAA,KAAK,GAAAC,wBAAA,CAAAP,IAAA,EAAAQ,SAAA,CAAA,CAAA;AAC1F,EAAA,oBACEV,KAAA,CAAAW,aAAA,CAAA,GAAA,EAAAC,QAAA,CAAA;IACEP,SAAS,EAAE,CAAC,SAAS,EAAEA,SAAS,CAAC,CAACQ,MAAM,CAAC,UAACC,CAAC,EAAA;AAAA,MAAA,OAAKA,CAAC,CAAA;AAAA,KAAA,CAAC,CAACC,IAAI,CAAC,GAAG,CAAE;AAC7D,IAAA,WAAA,EAAWR,OAAO,KAAK,UAAU,GAAGA,OAAO,GAAG,IAAK;AACnDJ,IAAAA,GAAG,EAAEA,GAAAA;GACDK,EAAAA,KAAK,CAERJ,EAAAA,QACA,CAAC,CAAA;AAER,CAAC;;;;"}
@@ -1,4 +0,0 @@
1
- export { default } from './CallToAction.js';
2
- import '../_rollupPluginBabelHelpers-9e645d4a.js';
3
- import 'react';
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -1,91 +0,0 @@
1
- import { _ as _objectWithoutProperties, a as _extends } from '../_rollupPluginBabelHelpers-9e645d4a.js';
2
- import * as React from 'react';
3
- import { getFragmentFromUrl, getAssociatedLegendOrLabel } from './utils.js';
4
-
5
- var _excluded = ["className", "errors", "mapNameToId"];
6
- var FormErrorKey = '_form';
7
- var FINAL_FORM_ERROR = 'FINAL_FORM/form-error';
8
- function BdsErrorSummary(_ref) {
9
- var className = _ref.className,
10
- errors = _ref.errors,
11
- _ref$mapNameToId = _ref.mapNameToId,
12
- mapNameToId = _ref$mapNameToId === void 0 ? function (name) {
13
- return name;
14
- } : _ref$mapNameToId,
15
- props = _objectWithoutProperties(_ref, _excluded);
16
- var headingId = React.useId();
17
- var groupRef = React.useRef(null);
18
- React.useEffect(function () {
19
- if (!errors || Object.keys(errors).length === 0) return;
20
- if (!groupRef.current) return;
21
- groupRef.current.focus();
22
- }, [errors]);
23
- if (!errors || Object.keys(errors).length === 0) return null;
24
- var handleLinkClick = function handleLinkClick(e) {
25
- var inputId = getFragmentFromUrl(e.currentTarget.href);
26
- if (!inputId) {
27
- return;
28
- }
29
- var input = document.getElementById(inputId);
30
- if (!input) {
31
- return;
32
- }
33
- var legendOrLabel = getAssociatedLegendOrLabel(input);
34
- if (!legendOrLabel) {
35
- return;
36
- }
37
- e.preventDefault();
38
- legendOrLabel.scrollIntoView();
39
- input.focus({
40
- preventScroll: true
41
- });
42
- };
43
- return /*#__PURE__*/React.createElement("bds-error-summary", _extends({
44
- className: ['stack', className].filter(function (x) {
45
- return x;
46
- }).join(' '),
47
- role: "group",
48
- "aria-labelledby": headingId,
49
- ref: groupRef,
50
- tabIndex: -1
51
- }, props), /*#__PURE__*/React.createElement("h2", {
52
- className: "bds-h5",
53
- id: headingId
54
- }, /*#__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
- })), "Issue"), /*#__PURE__*/React.createElement("ul", null, Object.keys(errors).map(function (errorKey) {
64
- var message = errors[errorKey];
65
- var isFormError = [FINAL_FORM_ERROR, FormErrorKey].includes(errorKey);
66
- if (isFormError) {
67
- return /*#__PURE__*/React.createElement("li", {
68
- key: errorKey,
69
- dangerouslySetInnerHTML: {
70
- __html: message
71
- }
72
- });
73
- }
74
- var isArrayField = Array.isArray(message);
75
- var messages = isArrayField ? message : [message];
76
- return /*#__PURE__*/React.createElement(React.Fragment, {
77
- key: errorKey
78
- }, messages.map(function (fieldMessage, index) {
79
- var inputId = "".concat(mapNameToId(errorKey)).concat(isArrayField ? "[".concat(index, "]") : '');
80
- return /*#__PURE__*/React.createElement("li", {
81
- key: inputId
82
- }, /*#__PURE__*/React.createElement("a", {
83
- href: "#".concat(inputId),
84
- onClick: handleLinkClick
85
- }, fieldMessage, messages.length > 1 ? " (".concat(index + 1, " of ").concat(messages.length, ")") : undefined));
86
- }));
87
- })));
88
- }
89
-
90
- export { FormErrorKey, BdsErrorSummary as default };
91
- //# sourceMappingURL=ErrorSummary.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ErrorSummary.js","sources":["../../src/ErrorSummary/ErrorSummary.js"],"sourcesContent":["import * as React from 'react';\n\nimport { getAssociatedLegendOrLabel, getFragmentFromUrl } from './utils';\n\nexport const FormErrorKey = '_form';\n\nconst FINAL_FORM_ERROR = 'FINAL_FORM/form-error';\n\nexport default function BdsErrorSummary({ className, errors, mapNameToId = (name) => name, ...props }) {\n const headingId = React.useId();\n const groupRef = React.useRef(null);\n\n React.useEffect(() => {\n if (!errors || Object.keys(errors).length === 0) return;\n if (!groupRef.current) return;\n\n groupRef.current.focus();\n }, [errors]);\n\n if (!errors || Object.keys(errors).length === 0) return null;\n\n const handleLinkClick = (e) => {\n const inputId = getFragmentFromUrl(e.currentTarget.href);\n\n if (!inputId) {\n return;\n }\n\n const input = document.getElementById(inputId);\n\n if (!input) {\n return;\n }\n\n const legendOrLabel = getAssociatedLegendOrLabel(input);\n\n if (!legendOrLabel) {\n return;\n }\n\n e.preventDefault();\n\n legendOrLabel.scrollIntoView();\n input.focus({ preventScroll: true });\n };\n\n return (\n <bds-error-summary\n className={['stack', className].filter((x) => x).join(' ')}\n role=\"group\"\n aria-labelledby={headingId}\n ref={groupRef}\n tabIndex={-1}\n {...props}\n >\n <h2 className=\"bds-h5\" id={headingId}>\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 Issue\n </h2>\n <ul>\n {Object.keys(errors).map((errorKey) => {\n const message = errors[errorKey];\n const isFormError = [FINAL_FORM_ERROR, FormErrorKey].includes(errorKey);\n\n if (isFormError) {\n return <li key={errorKey} dangerouslySetInnerHTML={{ __html: message }} />;\n }\n\n const isArrayField = Array.isArray(message);\n\n const messages = isArrayField ? message : [message];\n\n return (\n <React.Fragment key={errorKey}>\n {messages.map((fieldMessage, index) => {\n const inputId = `${mapNameToId(errorKey)}${isArrayField ? `[${index}]` : ''}`;\n\n return (\n <li key={inputId}>\n <a href={`#${inputId}`} onClick={handleLinkClick}>\n {fieldMessage}\n {messages.length > 1 ? ` (${index + 1} of ${messages.length})` : undefined}\n </a>\n </li>\n );\n })}\n </React.Fragment>\n );\n })}\n </ul>\n </bds-error-summary>\n );\n}\n"],"names":["FormErrorKey","FINAL_FORM_ERROR","BdsErrorSummary","_ref","className","errors","_ref$mapNameToId","mapNameToId","name","props","_objectWithoutProperties","_excluded","headingId","React","useId","groupRef","useRef","useEffect","Object","keys","length","current","focus","handleLinkClick","e","inputId","getFragmentFromUrl","currentTarget","href","input","document","getElementById","legendOrLabel","getAssociatedLegendOrLabel","preventDefault","scrollIntoView","preventScroll","createElement","_extends","filter","x","join","role","ref","tabIndex","id","xmlns","viewBox","height","width","fill","d","map","errorKey","message","isFormError","includes","key","dangerouslySetInnerHTML","__html","isArrayField","Array","isArray","messages","Fragment","fieldMessage","index","concat","onClick","undefined"],"mappings":";;;;;AAIO,IAAMA,YAAY,GAAG,QAAO;AAEnC,IAAMC,gBAAgB,GAAG,uBAAuB,CAAA;AAEjC,SAASC,eAAeA,CAAAC,IAAA,EAAgE;AAAA,EAAA,IAA7DC,SAAS,GAAAD,IAAA,CAATC,SAAS;IAAEC,MAAM,GAAAF,IAAA,CAANE,MAAM;IAAAC,gBAAA,GAAAH,IAAA,CAAEI,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,UAACE,IAAI,EAAA;AAAA,MAAA,OAAKA,IAAI,CAAA;AAAA,KAAA,GAAAF,gBAAA;AAAKG,IAAAA,KAAK,GAAAC,wBAAA,CAAAP,IAAA,EAAAQ,SAAA,CAAA,CAAA;AACjG,EAAA,IAAMC,SAAS,GAAGC,KAAK,CAACC,KAAK,EAAE,CAAA;AAC/B,EAAA,IAAMC,QAAQ,GAAGF,KAAK,CAACG,MAAM,CAAC,IAAI,CAAC,CAAA;EAEnCH,KAAK,CAACI,SAAS,CAAC,YAAM;AACpB,IAAA,IAAI,CAACZ,MAAM,IAAIa,MAAM,CAACC,IAAI,CAACd,MAAM,CAAC,CAACe,MAAM,KAAK,CAAC,EAAE,OAAA;AACjD,IAAA,IAAI,CAACL,QAAQ,CAACM,OAAO,EAAE,OAAA;AAEvBN,IAAAA,QAAQ,CAACM,OAAO,CAACC,KAAK,EAAE,CAAA;AAC1B,GAAC,EAAE,CAACjB,MAAM,CAAC,CAAC,CAAA;AAEZ,EAAA,IAAI,CAACA,MAAM,IAAIa,MAAM,CAACC,IAAI,CAACd,MAAM,CAAC,CAACe,MAAM,KAAK,CAAC,EAAE,OAAO,IAAI,CAAA;AAE5D,EAAA,IAAMG,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,CA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,MAAA,CAAGP,YAAY,GAAAO,GAAAA,CAAAA,MAAA,CAAOD,KAAK,EAAA,GAAA,CAAA,GAAM,EAAE,CAAE,CAAA;MAE7E,oBACErD,KAAA,CAAAwB,aAAA,CAAA,IAAA,EAAA;AAAIoB,QAAAA,GAAG,EAAEhC,OAAAA;OACPZ,eAAAA,KAAA,CAAAwB,aAAA,CAAA,GAAA,EAAA;AAAGT,QAAAA,IAAI,EAAAuC,GAAAA,CAAAA,MAAA,CAAM1C,OAAO,CAAG;AAAC2C,QAAAA,OAAO,EAAE7C,eAAAA;OAC9B0C,EAAAA,YAAY,EACZF,QAAQ,CAAC3C,MAAM,GAAG,CAAC,GAAA+C,IAAAA,CAAAA,MAAA,CAAQD,KAAK,GAAG,CAAC,EAAA,MAAA,CAAA,CAAAC,MAAA,CAAOJ,QAAQ,CAAC3C,MAAM,EAAA,GAAA,CAAA,GAAMiD,SAChE,CACD,CAAC,CAAA;AAET,KAAC,CACa,CAAC,CAAA;GAEpB,CACC,CACa,CAAC,CAAA;AAExB;;;;"}
@@ -1,5 +0,0 @@
1
- export { FormErrorKey, default } from './ErrorSummary.js';
2
- import '../_rollupPluginBabelHelpers-9e645d4a.js';
3
- import 'react';
4
- import './utils.js';
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sources":["../../src/ErrorSummary/utils.js"],"sourcesContent":["export function getFragmentFromUrl(url) {\n return url.includes('#') ? url.split('#').pop() : undefined;\n}\n\nexport function getAssociatedLegendOrLabel(input) {\n const fieldset = input.closest('fieldset');\n\n if (fieldset) {\n const legends = fieldset.getElementsByTagName('legend');\n\n if (legends.length) {\n const candidateLegend = legends[0];\n\n // If the input type is radio or checkbox, always use the legend if there\n // is one.\n if (input instanceof HTMLInputElement && (input.type === 'checkbox' || input.type === 'radio')) {\n return candidateLegend;\n }\n\n // For other input types, only scroll to the fieldset’s legend (instead of\n // the label associated with the input) if the input would end up in the\n // top half of the screen.\n //\n // This should avoid situations where the input either ends up off the\n // screen, or obscured by a software keyboard.\n const legendTop = candidateLegend.getBoundingClientRect().top;\n const inputRect = input.getBoundingClientRect();\n\n // If the browser doesn't support Element.getBoundingClientRect().height\n // or window.innerHeight (like IE8), bail and just link to the label.\n if (inputRect.height && window.innerHeight) {\n const inputBottom = inputRect.top + inputRect.height;\n\n if (inputBottom - legendTop < window.innerHeight / 2) {\n return candidateLegend;\n }\n }\n }\n }\n\n return document.querySelector(`label[for='${input.getAttribute('id')}']`) ?? input.closest('label');\n}\n"],"names":["getFragmentFromUrl","url","includes","split","pop","undefined","getAssociatedLegendOrLabel","input","_document$querySelect","fieldset","closest","legends","getElementsByTagName","length","candidateLegend","HTMLInputElement","type","legendTop","getBoundingClientRect","top","inputRect","height","window","innerHeight","inputBottom","document","querySelector","concat","getAttribute"],"mappings":"AAAO,SAASA,kBAAkBA,CAACC,GAAG,EAAE;AACtC,EAAA,OAAOA,GAAG,CAACC,QAAQ,CAAC,GAAG,CAAC,GAAGD,GAAG,CAACE,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,EAAE,GAAGC,SAAS,CAAA;AAC7D,CAAA;AAEO,SAASC,0BAA0BA,CAACC,KAAK,EAAE;AAAA,EAAA,IAAAC,qBAAA,CAAA;AAChD,EAAA,IAAMC,QAAQ,GAAGF,KAAK,CAACG,OAAO,CAAC,UAAU,CAAC,CAAA;AAE1C,EAAA,IAAID,QAAQ,EAAE;AACZ,IAAA,IAAME,OAAO,GAAGF,QAAQ,CAACG,oBAAoB,CAAC,QAAQ,CAAC,CAAA;IAEvD,IAAID,OAAO,CAACE,MAAM,EAAE;AAClB,MAAA,IAAMC,eAAe,GAAGH,OAAO,CAAC,CAAC,CAAC,CAAA;;AAElC;AACA;AACA,MAAA,IAAIJ,KAAK,YAAYQ,gBAAgB,KAAKR,KAAK,CAACS,IAAI,KAAK,UAAU,IAAIT,KAAK,CAACS,IAAI,KAAK,OAAO,CAAC,EAAE;AAC9F,QAAA,OAAOF,eAAe,CAAA;AACxB,OAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;MACA,IAAMG,SAAS,GAAGH,eAAe,CAACI,qBAAqB,EAAE,CAACC,GAAG,CAAA;AAC7D,MAAA,IAAMC,SAAS,GAAGb,KAAK,CAACW,qBAAqB,EAAE,CAAA;;AAE/C;AACA;AACA,MAAA,IAAIE,SAAS,CAACC,MAAM,IAAIC,MAAM,CAACC,WAAW,EAAE;QAC1C,IAAMC,WAAW,GAAGJ,SAAS,CAACD,GAAG,GAAGC,SAAS,CAACC,MAAM,CAAA;QAEpD,IAAIG,WAAW,GAAGP,SAAS,GAAGK,MAAM,CAACC,WAAW,GAAG,CAAC,EAAE;AACpD,UAAA,OAAOT,eAAe,CAAA;AACxB,SAAA;AACF,OAAA;AACF,KAAA;AACF,GAAA;EAEA,OAAAN,CAAAA,qBAAA,GAAOiB,QAAQ,CAACC,aAAa,CAAAC,aAAAA,CAAAA,MAAA,CAAepB,KAAK,CAACqB,YAAY,CAAC,IAAI,CAAC,EAAI,IAAA,CAAA,CAAC,MAAApB,IAAAA,IAAAA,qBAAA,KAAAA,KAAAA,CAAAA,GAAAA,qBAAA,GAAID,KAAK,CAACG,OAAO,CAAC,OAAO,CAAC,CAAA;AACrG;;;;"}
@@ -1,47 +0,0 @@
1
- import { _ as _objectWithoutProperties, a as _extends } from '../_rollupPluginBabelHelpers-9e645d4a.js';
2
- import * as React from 'react';
3
-
4
- var _excluded = ["as", "error", "hint", "id", "isOptional", "label"];
5
- function FieldTextInput(_ref) {
6
- var _id;
7
- var as = _ref.as,
8
- error = _ref.error,
9
- hint = _ref.hint,
10
- id = _ref.id,
11
- _ref$isOptional = _ref.isOptional,
12
- isOptional = _ref$isOptional === void 0 ? false : _ref$isOptional,
13
- label = _ref.label,
14
- props = _objectWithoutProperties(_ref, _excluded);
15
- id = (_id = id) !== null && _id !== void 0 ? _id : props.name;
16
- var errorId = React.useId();
17
- var hintId = React.useId();
18
- var InputComponent = as !== null && as !== void 0 ? as : 'input';
19
- return /*#__PURE__*/React.createElement("div", {
20
- className: "bds-text-input stack"
21
- }, /*#__PURE__*/React.createElement("label", {
22
- htmlFor: id
23
- }, label, isOptional && ' (optional)'), hint && /*#__PURE__*/React.createElement("span", {
24
- className: "bds-hint",
25
- id: hintId
26
- }, hint), error && /*#__PURE__*/React.createElement("span", {
27
- className: "bds-error",
28
- id: errorId
29
- }, /*#__PURE__*/React.createElement("svg", {
30
- xmlns: "http://www.w3.org/2000/svg",
31
- viewBox: "0 0 512 512",
32
- "aria-hidden": "true",
33
- height: "1em",
34
- width: "1em",
35
- fill: "currentColor"
36
- }, /*#__PURE__*/React.createElement("path", {
37
- 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"
38
- })), error), /*#__PURE__*/React.createElement(InputComponent, _extends({
39
- "aria-invalid": error ? true : undefined,
40
- "aria-describedby": error && hint ? "".concat(hintId, " ").concat(errorId) : error ? errorId : hint ? hintId : undefined,
41
- "aria-required": isOptional ? undefined : true,
42
- id: id
43
- }, props)));
44
- }
45
-
46
- export { FieldTextInput as default };
47
- //# sourceMappingURL=FieldTextInput.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FieldTextInput.js","sources":["../../src/FieldTextInput/FieldTextInput.js"],"sourcesContent":["import * as React from 'react';\n\nexport default function FieldTextInput({ as, error, hint, id, isOptional = false, label, ...props }) {\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 aria-required={isOptional ? undefined : true}\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":";;;;AAEe,SAASA,cAAcA,CAAAC,IAAA,EAA+D;AAAA,EAAA,IAAAC,GAAA,CAAA;AAAA,EAAA,IAA5DC,EAAE,GAAAF,IAAA,CAAFE,EAAE;IAAEC,KAAK,GAAAH,IAAA,CAALG,KAAK;IAAEC,IAAI,GAAAJ,IAAA,CAAJI,IAAI;IAAEC,EAAE,GAAAL,IAAA,CAAFK,EAAE;IAAAC,eAAA,GAAAN,IAAA,CAAEO,UAAU;AAAVA,IAAAA,UAAU,GA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,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;AACvG,IAAA,eAAA,EAAerB,UAAU,GAAGqB,SAAS,GAAG,IAAK;AAC7CvB,IAAAA,EAAE,EAAEA,EAAAA;GACAI,EAAAA,KAAK,CACV,CACE,CAAC,CAAA;AAEV;;;;"}
@@ -1,4 +0,0 @@
1
- export { default } from './FieldTextInput.js';
2
- import '../_rollupPluginBabelHelpers-9e645d4a.js';
3
- import 'react';
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -1,93 +0,0 @@
1
- import { _ as _objectWithoutProperties, a as _extends, b as _toConsumableArray } from '../_rollupPluginBabelHelpers-9e645d4a.js';
2
- import * as React from 'react';
3
-
4
- var _excluded = ["buildPageUrl", "className", "currentPage", "onPageClick", "totalPages"];
5
- function usePages(currentPage, totalPages) {
6
- var pages = [1, currentPage - 1, currentPage, currentPage + 1, totalPages].filter(function (x) {
7
- return x >= 1 && x <= totalPages;
8
- });
9
- return _toConsumableArray(new Set(pages));
10
- }
11
- function Pagination(_ref) {
12
- var buildPageUrl = _ref.buildPageUrl,
13
- className = _ref.className,
14
- currentPage = _ref.currentPage,
15
- onPageClick = _ref.onPageClick,
16
- totalPages = _ref.totalPages,
17
- props = _objectWithoutProperties(_ref, _excluded);
18
- var pages = usePages(currentPage, totalPages);
19
- return /*#__PURE__*/React.createElement("nav", _extends({
20
- "aria-label": "pagination",
21
- className: ['bds-pagination', className].filter(function (x) {
22
- return x;
23
- }).join(' ')
24
- }, props), currentPage !== 1 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a", {
25
- href: buildPageUrl(1),
26
- className: "bds-first-page"
27
- }, /*#__PURE__*/React.createElement("svg", {
28
- xmlns: "http://www.w3.org/2000/svg",
29
- "aria-hidden": "true",
30
- focusable: "false",
31
- height: "1em",
32
- width: "100%",
33
- viewBox: "0 63.95 512 384.1"
34
- }, /*#__PURE__*/React.createElement("path", {
35
- 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"
36
- })), "First"), /*#__PURE__*/React.createElement("a", {
37
- "aria-label": "previous",
38
- href: buildPageUrl(currentPage - 1),
39
- rel: "prev"
40
- }, /*#__PURE__*/React.createElement("svg", {
41
- xmlns: "http://www.w3.org/2000/svg",
42
- "aria-hidden": "true",
43
- focusable: "false",
44
- width: "100%",
45
- height: "1em",
46
- viewBox: "0.02 95.9 192.08 320.17"
47
- }, /*#__PURE__*/React.createElement("path", {
48
- 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"
49
- })), "Prev.")), /*#__PURE__*/React.createElement("ul", null, pages.map(function (page, index) {
50
- var handlePageClick = function handlePageClick() {
51
- if (!onPageClick) return;
52
- onPageClick(page);
53
- };
54
- return /*#__PURE__*/React.createElement(React.Fragment, {
55
- key: page
56
- }, /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("a", {
57
- "aria-current": page === currentPage ? 'page' : undefined,
58
- href: buildPageUrl(page),
59
- onClick: handlePageClick
60
- }, /*#__PURE__*/React.createElement("span", {
61
- className: "visually-hidden"
62
- }, "Page"), " ", page)), pages[index + 1] > page + 1 ? /*#__PURE__*/React.createElement("li", {
63
- "data-overflow": ""
64
- }, "...") : null);
65
- })), currentPage !== totalPages && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a", {
66
- href: buildPageUrl(currentPage + 1),
67
- rel: "next"
68
- }, "Next", /*#__PURE__*/React.createElement("svg", {
69
- xmlns: "http://www.w3.org/2000/svg",
70
- "aria-hidden": "true",
71
- focusable: "false",
72
- viewBox: "63.9 95.9 192.1 320.17",
73
- width: "100%",
74
- height: "1em"
75
- }, /*#__PURE__*/React.createElement("path", {
76
- 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"
77
- }))), /*#__PURE__*/React.createElement("a", {
78
- href: buildPageUrl(totalPages),
79
- className: "bds-last-page"
80
- }, "Last", /*#__PURE__*/React.createElement("svg", {
81
- xmlns: "http://www.w3.org/2000/svg",
82
- "aria-hidden": "true",
83
- focusable: "false",
84
- width: "100%",
85
- height: "1em",
86
- viewBox: "0 63.95 512 384.1"
87
- }, /*#__PURE__*/React.createElement("path", {
88
- 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"
89
- })))));
90
- }
91
-
92
- export { Pagination as default };
93
- //# sourceMappingURL=Pagination.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Pagination.js","sources":["../../src/Pagination/Pagination.js"],"sourcesContent":["import * as React from 'react';\n\nfunction usePages(currentPage, totalPages) {\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({ buildPageUrl, className, currentPage, onPageClick, totalPages, ...props }) {\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":";;;;AAEA,SAASA,QAAQA,CAACC,WAAW,EAAEC,UAAU,EAAE;EACzC,IAAMC,KAAK,GAAG,CAAC,CAAC,EAAEF,WAAW,GAAG,CAAC,EAAEA,WAAW,EAAEA,WAAW,GAAG,CAAC,EAAEC,UAAU,CAAC,CAACE,MAAM,CACjF,UAACC,CAAC,EAAA;AAAA,IAAA,OAAKA,CAAC,IAAI,CAAC,IAAIA,CAAC,IAAIH,UAAU,CAAA;AAAA,GAClC,CAAC,CAAA;AACD,EAAA,OAAAI,kBAAA,CAAW,IAAIC,GAAG,CAACJ,KAAK,CAAC,CAAA,CAAA;AAC3B,CAAA;AAEe,SAASK,UAAUA,CAAAC,IAAA,EAA8E;AAAA,EAAA,IAA3EC,YAAY,GAAAD,IAAA,CAAZC,YAAY;IAAEC,SAAS,GAAAF,IAAA,CAATE,SAAS;IAAEV,WAAW,GAAAQ,IAAA,CAAXR,WAAW;IAAEW,WAAW,GAAAH,IAAA,CAAXG,WAAW;IAAEV,UAAU,GAAAO,IAAA,CAAVP,UAAU;AAAKW,IAAAA,KAAK,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA,CAAA,CAAA;AAC1G,EAAA,IAAMZ,KAAK,GAAGH,QAAQ,CAACC,WAAW,EAAEC,UAAU,CAAC,CAAA;AAE/C,EAAA,oBACEc,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAAC,QAAA,CAAA;AAAK,IAAA,YAAA,EAAW,YAAY;IAACP,SAAS,EAAE,CAAC,gBAAgB,EAAEA,SAAS,CAAC,CAACP,MAAM,CAAC,UAACC,CAA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B,IAAAA,GAAG,EAAC,MAAA;AAAM,GAAA,EAAC,MAEjD,eAAAZ,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AACEK,IAAAA,KAAK,EAAC,4BAA4B;AAClC,IAAA,aAAA,EAAY,MAAM;AAClBC,IAAAA,SAAS,EAAC,OAAO;AACjBG,IAAAA,OAAO,EAAC,wBAAwB;AAChCD,IAAAA,KAAK,EAAC,MAAM;AACZD,IAAAA,MAAM,EAAC,KAAA;GAEPR,eAAAA,KAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AAAMU,IAAAA,CAAC,EAAC,yJAAA;AAAyJ,GAAE,CAChK,CACJ,CAAC,eACJX,KAAA,CAAAC,aAAA,CAAA,GAAA,EAAA;AAAGI,IAAAA,IAAI,EAAEX,YAAY,CAACR,UAAU,CAAE;AAACS,IAAAA,SAAS,EAAC,eAAA;AAAe,GAAA,EAAC,MAE3D,eAAAK,KAAA,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,KAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AAAMU,IAAAA,CAAC,EAAC,sSAAA;AAAsS,GAAE,CAC7S,CACJ,CACH,CAED,CAAC,CAAA;AAEV;;;;"}
@@ -1,4 +0,0 @@
1
- export { default } from './Pagination.js';
2
- import '../_rollupPluginBabelHelpers-9e645d4a.js';
3
- import 'react';
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -1,37 +0,0 @@
1
- import { _ as _objectWithoutProperties, a as _extends } from '../_rollupPluginBabelHelpers-9e645d4a.js';
2
- import * as React from 'react';
3
-
4
- var _excluded = ["className", "component", "variant"];
5
- var componentMap = {
6
- h1: 'h1',
7
- h2: 'h2',
8
- h3: 'h3',
9
- h4: 'h4',
10
- h5: 'h5',
11
- body: 'p'
12
- };
13
- var classMap = {
14
- h1: 'bds-h1',
15
- h2: 'bds-h2',
16
- h3: 'bds-h3',
17
- h4: 'bds-h4',
18
- h5: 'bds-h5',
19
- body: 'bds-body'
20
- };
21
- var Typography = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
22
- var className = _ref.className,
23
- component = _ref.component,
24
- _ref$variant = _ref.variant,
25
- variant = _ref$variant === void 0 ? 'body' : _ref$variant,
26
- props = _objectWithoutProperties(_ref, _excluded);
27
- var Component = component !== null && component !== void 0 ? component : componentMap[variant];
28
- return /*#__PURE__*/React.createElement(Component, _extends({
29
- className: [classMap[variant], className].filter(function (x) {
30
- return x;
31
- }).join(' '),
32
- ref: ref
33
- }, props));
34
- });
35
-
36
- export { Typography as default };
37
- //# sourceMappingURL=Typography.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Typography.js","sources":["../../src/Typography/Typography.js"],"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\nconst Typography = React.forwardRef(({ className, component, variant = 'body', ...props }, ref) => {\n const Component = component ?? componentMap[variant];\n return <Component className={[classMap[variant], className].filter((x) => x).join(' ')} ref={ref} {...props} />;\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;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AC,CAAA;AACjH,CAAC;;;;"}
@@ -1,4 +0,0 @@
1
- export { default } from './Typography.js';
2
- import '../_rollupPluginBabelHelpers-9e645d4a.js';
3
- import 'react';
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -1,69 +0,0 @@
1
- function _extends() {
2
- _extends = Object.assign ? Object.assign.bind() : function (target) {
3
- for (var i = 1; i < arguments.length; i++) {
4
- var source = arguments[i];
5
- for (var key in source) {
6
- if (Object.prototype.hasOwnProperty.call(source, key)) {
7
- target[key] = source[key];
8
- }
9
- }
10
- }
11
- return target;
12
- };
13
- return _extends.apply(this, arguments);
14
- }
15
- function _objectWithoutPropertiesLoose(source, excluded) {
16
- if (source == null) return {};
17
- var target = {};
18
- var sourceKeys = Object.keys(source);
19
- var key, i;
20
- for (i = 0; i < sourceKeys.length; i++) {
21
- key = sourceKeys[i];
22
- if (excluded.indexOf(key) >= 0) continue;
23
- target[key] = source[key];
24
- }
25
- return target;
26
- }
27
- function _objectWithoutProperties(source, excluded) {
28
- if (source == null) return {};
29
- var target = _objectWithoutPropertiesLoose(source, excluded);
30
- var key, i;
31
- if (Object.getOwnPropertySymbols) {
32
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
33
- for (i = 0; i < sourceSymbolKeys.length; i++) {
34
- key = sourceSymbolKeys[i];
35
- if (excluded.indexOf(key) >= 0) continue;
36
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
37
- target[key] = source[key];
38
- }
39
- }
40
- return target;
41
- }
42
- function _toConsumableArray(arr) {
43
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
44
- }
45
- function _arrayWithoutHoles(arr) {
46
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
47
- }
48
- function _iterableToArray(iter) {
49
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
50
- }
51
- function _unsupportedIterableToArray(o, minLen) {
52
- if (!o) return;
53
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
54
- var n = Object.prototype.toString.call(o).slice(8, -1);
55
- if (n === "Object" && o.constructor) n = o.constructor.name;
56
- if (n === "Map" || n === "Set") return Array.from(o);
57
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
58
- }
59
- function _arrayLikeToArray(arr, len) {
60
- if (len == null || len > arr.length) len = arr.length;
61
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
62
- return arr2;
63
- }
64
- function _nonIterableSpread() {
65
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
66
- }
67
-
68
- export { _objectWithoutProperties as _, _extends as a, _toConsumableArray as b };
69
- //# sourceMappingURL=_rollupPluginBabelHelpers-9e645d4a.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_rollupPluginBabelHelpers-9e645d4a.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/index.js DELETED
@@ -1,10 +0,0 @@
1
- export { default as Button } from './Button/Button.js';
2
- export { default as CallToAction } from './CallToAction/CallToAction.js';
3
- export { default as ErrorSummary } from './ErrorSummary/ErrorSummary.js';
4
- export { default as FieldTextInput } from './FieldTextInput/FieldTextInput.js';
5
- export { default as Pagination } from './Pagination/Pagination.js';
6
- export { default as Typography } from './Typography/Typography.js';
7
- import './_rollupPluginBabelHelpers-9e645d4a.js';
8
- import 'react';
9
- import './ErrorSummary/utils.js';
10
- //# sourceMappingURL=index.js.map
package/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}