@iabbb/bds-react 0.54.0 → 0.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/Button/index.cjs +3 -3
  2. package/Button/index.cjs.map +1 -1
  3. package/Button/index.mjs +3 -3
  4. package/Button/index.mjs.map +1 -1
  5. package/CallToAction/index.cjs +3 -3
  6. package/CallToAction/index.cjs.map +1 -1
  7. package/CallToAction/index.mjs +3 -3
  8. package/CallToAction/index.mjs.map +1 -1
  9. package/ErrorMessage/index.cjs +3 -3
  10. package/ErrorMessage/index.mjs +3 -3
  11. package/ErrorSummary/index.cjs +3 -3
  12. package/ErrorSummary/index.cjs.map +1 -1
  13. package/ErrorSummary/index.mjs +3 -3
  14. package/ErrorSummary/index.mjs.map +1 -1
  15. package/FieldCharacterCountdown/FieldCharacterCountdown.d.ts +1 -1
  16. package/FieldCharacterCountdown/index.cjs +7 -8
  17. package/FieldCharacterCountdown/index.cjs.map +1 -1
  18. package/FieldCharacterCountdown/index.mjs +7 -8
  19. package/FieldCharacterCountdown/index.mjs.map +1 -1
  20. package/FieldCheckbox/index.cjs +6 -6
  21. package/FieldCheckbox/index.cjs.map +1 -1
  22. package/FieldCheckbox/index.mjs +6 -6
  23. package/FieldCheckbox/index.mjs.map +1 -1
  24. package/FieldRadio/index.cjs +6 -6
  25. package/FieldRadio/index.cjs.map +1 -1
  26. package/FieldRadio/index.mjs +6 -6
  27. package/FieldRadio/index.mjs.map +1 -1
  28. package/FieldSelect/index.cjs +4 -5
  29. package/FieldSelect/index.cjs.map +1 -1
  30. package/FieldSelect/index.mjs +4 -5
  31. package/FieldSelect/index.mjs.map +1 -1
  32. package/FieldTextInput/FieldTextInput.d.ts +11 -5
  33. package/FieldTextInput/index.cjs +11 -13
  34. package/FieldTextInput/index.cjs.map +1 -1
  35. package/FieldTextInput/index.mjs +11 -13
  36. package/FieldTextInput/index.mjs.map +1 -1
  37. package/FieldTextarea/FieldTextarea.d.ts +1 -1
  38. package/FieldTextarea/index.cjs +4 -5
  39. package/FieldTextarea/index.cjs.map +1 -1
  40. package/FieldTextarea/index.mjs +4 -5
  41. package/FieldTextarea/index.mjs.map +1 -1
  42. package/Fieldset/index.cjs +3 -3
  43. package/Fieldset/index.mjs +3 -3
  44. package/Pagination/index.cjs +3 -3
  45. package/Pagination/index.mjs +3 -3
  46. package/Typography/index.cjs +3 -3
  47. package/Typography/index.cjs.map +1 -1
  48. package/Typography/index.mjs +3 -3
  49. package/Typography/index.mjs.map +1 -1
  50. package/index.cjs +11 -13
  51. package/index.cjs.map +1 -1
  52. package/index.mjs +11 -13
  53. package/index.mjs.map +1 -1
  54. package/package.json +5 -5
package/Button/index.cjs CHANGED
@@ -38,8 +38,8 @@ function _objectWithoutProperties(e, t) {
38
38
  r,
39
39
  i = _objectWithoutPropertiesLoose(e, t);
40
40
  if (Object.getOwnPropertySymbols) {
41
- var s = Object.getOwnPropertySymbols(e);
42
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
41
+ var n = Object.getOwnPropertySymbols(e);
42
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
43
43
  }
44
44
  return i;
45
45
  }
@@ -47,7 +47,7 @@ function _objectWithoutPropertiesLoose(r, e) {
47
47
  if (null == r) return {};
48
48
  var t = {};
49
49
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
50
- if (e.includes(n)) continue;
50
+ if (-1 !== e.indexOf(n)) continue;
51
51
  t[n] = r[n];
52
52
  }
53
53
  return t;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../src/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\n\nconst DEBOUNCE_TIMEOUT_IN_SECONDS = 1;\n\nexport interface ButtonProps extends React.ComponentPropsWithoutRef<'button'> {\n preventDoubleClick?: boolean;\n variant?: 'cancel' | 'featured' | 'quote' | 'reverse' | 'search' | 'standard' | 'unstyled';\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ children, className, onClick, preventDoubleClick = false, variant = 'standard', ...props }, ref) => {\n const debounceClicks = React.useRef(false);\n\n const handleClick: React.MouseEventHandler<HTMLButtonElement> = (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;\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;AAO/BC,IAAAA,MAAM,gBAAGC,gBAAK,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,O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A,OAAO,KAAK,UAAU,GAAGA,OAAO,GAAG,IAAK;AAC7EJ,IAAAA,OAAO,EAAEU,WAAY;AACrBb,IAAAA,GAAG,EAAEA;GACDQ,EAAAA,KAAK,CAERP,EAAAA,QACK,CAAC;AAEb,CACF;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../src/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\n\nconst DEBOUNCE_TIMEOUT_IN_SECONDS = 1;\n\nexport interface ButtonProps extends React.ComponentPropsWithoutRef<'button'> {\n preventDoubleClick?: boolean;\n variant?: 'cancel' | 'featured' | 'quote' | 'reverse' | 'search' | 'standard' | 'unstyled';\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ children, className, onClick, preventDoubleClick = false, variant = 'standard', ...props }, ref) => {\n const debounceClicks = React.useRef(false);\n\n const handleClick: React.MouseEventHandler<HTMLButtonElement> = (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;\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","prevent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AG,IAAI,CAAC;GACvC;AAED,EAAA,oBACEE,gBAAA,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;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;GACDQ,EAAAA,KAAK,CAERP,EAAAA,QACK,CAAC;AAEb,CACF;;;;"}
package/Button/index.mjs CHANGED
@@ -15,8 +15,8 @@ function _objectWithoutProperties(e, t) {
15
15
  r,
16
16
  i = _objectWithoutPropertiesLoose(e, t);
17
17
  if (Object.getOwnPropertySymbols) {
18
- var s = Object.getOwnPropertySymbols(e);
19
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
18
+ var n = Object.getOwnPropertySymbols(e);
19
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
20
20
  }
21
21
  return i;
22
22
  }
@@ -24,7 +24,7 @@ function _objectWithoutPropertiesLoose(r, e) {
24
24
  if (null == r) return {};
25
25
  var t = {};
26
26
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
27
- if (e.includes(n)) continue;
27
+ if (-1 !== e.indexOf(n)) continue;
28
28
  t[n] = r[n];
29
29
  }
30
30
  return t;
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\n\nconst DEBOUNCE_TIMEOUT_IN_SECONDS = 1;\n\nexport interface ButtonProps extends React.ComponentPropsWithoutRef<'button'> {\n preventDoubleClick?: boolean;\n variant?: 'cancel' | 'featured' | 'quote' | 'reverse' | 'search' | 'standard' | 'unstyled';\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ children, className, onClick, preventDoubleClick = false, variant = 'standard', ...props }, ref) => {\n const debounceClicks = React.useRef(false);\n\n const handleClick: React.MouseEventHandler<HTMLButtonElement> = (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;\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;AAO/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,C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E;IACb,WAAWf,EAAAA,OAAO,KAAK,UAAU,IAAIA,OAAO,KAAK,UAAU,GAAGA,OAAO,GAAG,IAAK;AAC7EJ,IAAAA,OAAO,EAAEU,WAAY;AACrBb,IAAAA,GAAG,EAAEA;GACDQ,EAAAA,KAAK,CAERP,EAAAA,QACK,CAAC;AAEb,CACF;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\n\nconst DEBOUNCE_TIMEOUT_IN_SECONDS = 1;\n\nexport interface ButtonProps extends React.ComponentPropsWithoutRef<'button'> {\n preventDoubleClick?: boolean;\n variant?: 'cancel' | 'featured' | 'quote' | 'reverse' | 'search' | 'standard' | 'unstyled';\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ children, className, onClick, preventDoubleClick = false, variant = 'standard', ...props }, ref) => {\n const debounceClicks = React.useRef(false);\n\n const handleClick: React.MouseEventHandler<HTMLButtonElement> = (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;\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;AAO/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,MAAA,GAAA,KAAK,GAAAA,qBAAA;IAAAE,YAAA,GAAAP,IAAA,CAAEQ,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAG,MAAA,GAAA,UAAU,GAAAA,YAAA;AAAKE,IAAAA,KAAK,GAAAC,wBAAA,CAAAV,IAAA,EAAAW,SAAA,CAAA;AACzF,EAAA,IAAMC,cAAc,GAAGd,KAAK,CAACe,MAAM,CAAC,KAAK,CAAC;AAE1C,EAAA,IAAMC,WAAuD,GAAG,SAA1DA,WAAuDA,CAAIC,KAAK,EAAK;AACzE;IACA,IAAI,CAACT,kBAAkB,EAAE;AACvB,MAAA,IAAIF,OAAO,EAAE;QACXA,OAAO,CAACW,KAAK,CAAC;AAChB;AAEA,MAAA;AACF;;AAEA;IACA,IAAIH,cAAc,CAACI,OAAO,EAAE;MAC1BD,KAAK,CAACE,cAAc,EAAE;AACtB,MAAA;AACF;AAEA,IAAA,IAAIb,OAAO,EAAE;MACXA,OAAO,CAACW,KAAK,CAAC;AAChB;;AAEA;IACAH,cAAc,CAACI,OAAO,GAAG,IAAI;;AAE7B;AACAE,IAAAA,UAAU,CAAC,YAAM;MACfN,cAAc,CAACI,OAAO,GAAG,KAAK;AAChC,KAAC,EAAEpB,2BAA2B,GAAG,IAAI,CAAC;GACvC;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;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;GACDQ,EAAAA,KAAK,CAERP,EAAAA,QACK,CAAC;AAEb,CACF;;;;"}
@@ -38,8 +38,8 @@ function _objectWithoutProperties(e, t) {
38
38
  r,
39
39
  i = _objectWithoutPropertiesLoose(e, t);
40
40
  if (Object.getOwnPropertySymbols) {
41
- var s = Object.getOwnPropertySymbols(e);
42
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
41
+ var n = Object.getOwnPropertySymbols(e);
42
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
43
43
  }
44
44
  return i;
45
45
  }
@@ -47,7 +47,7 @@ function _objectWithoutPropertiesLoose(r, e) {
47
47
  if (null == r) return {};
48
48
  var t = {};
49
49
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
50
- if (e.includes(n)) continue;
50
+ if (-1 !== e.indexOf(n)) continue;
51
51
  t[n] = r[n];
52
52
  }
53
53
  return t;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../src/CallToAction/CallToAction.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport interface CallToActionProps extends React.ComponentPropsWithoutRef<'a'> {\n variant?: 'featured' | 'quote' | 'standard';\n}\n\nconst CallToAction = React.forwardRef<HTMLAnchorElement, CallToActionProps>(\n ({ 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);\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMMA,IAAAA,YAAY,gBAAGC,gBAAK,CAACC,UAAU,CACnC,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;AACpD,EAAA,oBACEV,gBAAA,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;AAAA,KAAA,CAAC,CAACC,IAAI,CAAC,GAAG,CAAE;AAC7D,IAAA,WAAA,EAAWR,OAAO,KAAK,UAAU,GAAGA,OAAO,GAAG,IAAK;AACnDJ,IAAAA,GAAG,EAAEA;GACDK,EAAAA,KAAK,CAERJ,EAAAA,QACA,CAAC;AAER,CACF;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../src/CallToAction/CallToAction.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport interface CallToActionProps extends React.ComponentPropsWithoutRef<'a'> {\n variant?: 'featured' | 'quote' | 'standard';\n}\n\nconst CallToAction = React.forwardRef<HTMLAnchorElement, CallToActionProps>(\n ({ 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);\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMMA,IAAAA,YAAY,gBAAGC,gBAAK,CAACC,UAAU,CACnC,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,MAAA,GAAA,UAAU,GAAAA,YAAA;AAAKE,IAAAA,KAAK,GAAAC,wBAAA,CAAAP,IAAA,EAAAQ,SAAA,CAAA;AACpD,EAAA,oBACEV,gBAAA,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;AAAA,KAAA,CAAC,CAACC,IAAI,CAAC,GAAG,CAAE;AAC7D,IAAA,WAAA,EAAWR,OAAO,KAAK,UAAU,GAAGA,OAAO,GAAG,IAAK;AACnDJ,IAAAA,GAAG,EAAEA;GACDK,EAAAA,KAAK,CAERJ,EAAAA,QACA,CAAC;AAER,CACF;;;;"}
@@ -15,8 +15,8 @@ function _objectWithoutProperties(e, t) {
15
15
  r,
16
16
  i = _objectWithoutPropertiesLoose(e, t);
17
17
  if (Object.getOwnPropertySymbols) {
18
- var s = Object.getOwnPropertySymbols(e);
19
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
18
+ var n = Object.getOwnPropertySymbols(e);
19
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
20
20
  }
21
21
  return i;
22
22
  }
@@ -24,7 +24,7 @@ function _objectWithoutPropertiesLoose(r, e) {
24
24
  if (null == r) return {};
25
25
  var t = {};
26
26
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
27
- if (e.includes(n)) continue;
27
+ if (-1 !== e.indexOf(n)) continue;
28
28
  t[n] = r[n];
29
29
  }
30
30
  return t;
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/CallToAction/CallToAction.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport interface CallToActionProps extends React.ComponentPropsWithoutRef<'a'> {\n variant?: 'featured' | 'quote' | 'standard';\n}\n\nconst CallToAction = React.forwardRef<HTMLAnchorElement, CallToActionProps>(\n ({ 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);\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMMA,IAAAA,YAAY,gBAAGC,KAAK,CAACC,UAAU,CACnC,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;AACpD,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;AAAA,KAAA,CAAC,CAACC,IAAI,CAAC,GAAG,CAAE;AAC7D,IAAA,WAAA,EAAWR,OAAO,KAAK,UAAU,GAAGA,OAAO,GAAG,IAAK;AACnDJ,IAAAA,GAAG,EAAEA;GACDK,EAAAA,KAAK,CAERJ,EAAAA,QACA,CAAC;AAER,CACF;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/CallToAction/CallToAction.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport interface CallToActionProps extends React.ComponentPropsWithoutRef<'a'> {\n variant?: 'featured' | 'quote' | 'standard';\n}\n\nconst CallToAction = React.forwardRef<HTMLAnchorElement, CallToActionProps>(\n ({ 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);\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMMA,IAAAA,YAAY,gBAAGC,KAAK,CAACC,UAAU,CACnC,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,MAAA,GAAA,UAAU,GAAAA,YAAA;AAAKE,IAAAA,KAAK,GAAAC,wBAAA,CAAAP,IAAA,EAAAQ,SAAA,CAAA;AACpD,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;AAAA,KAAA,CAAC,CAACC,IAAI,CAAC,GAAG,CAAE;AAC7D,IAAA,WAAA,EAAWR,OAAO,KAAK,UAAU,GAAGA,OAAO,GAAG,IAAK;AACnDJ,IAAAA,GAAG,EAAEA;GACDK,EAAAA,KAAK,CAERJ,EAAAA,QACA,CAAC;AAER,CACF;;;;"}
@@ -38,8 +38,8 @@ function _objectWithoutProperties(e, t) {
38
38
  r,
39
39
  i = _objectWithoutPropertiesLoose(e, t);
40
40
  if (Object.getOwnPropertySymbols) {
41
- var s = Object.getOwnPropertySymbols(e);
42
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
41
+ var n = Object.getOwnPropertySymbols(e);
42
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
43
43
  }
44
44
  return i;
45
45
  }
@@ -47,7 +47,7 @@ function _objectWithoutPropertiesLoose(r, e) {
47
47
  if (null == r) return {};
48
48
  var t = {};
49
49
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
50
- if (e.includes(n)) continue;
50
+ if (-1 !== e.indexOf(n)) continue;
51
51
  t[n] = r[n];
52
52
  }
53
53
  return t;
@@ -15,8 +15,8 @@ function _objectWithoutProperties(e, t) {
15
15
  r,
16
16
  i = _objectWithoutPropertiesLoose(e, t);
17
17
  if (Object.getOwnPropertySymbols) {
18
- var s = Object.getOwnPropertySymbols(e);
19
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
18
+ var n = Object.getOwnPropertySymbols(e);
19
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
20
20
  }
21
21
  return i;
22
22
  }
@@ -24,7 +24,7 @@ function _objectWithoutPropertiesLoose(r, e) {
24
24
  if (null == r) return {};
25
25
  var t = {};
26
26
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
27
- if (e.includes(n)) continue;
27
+ if (-1 !== e.indexOf(n)) continue;
28
28
  t[n] = r[n];
29
29
  }
30
30
  return t;
@@ -38,8 +38,8 @@ function _objectWithoutProperties(e, t) {
38
38
  r,
39
39
  i = _objectWithoutPropertiesLoose(e, t);
40
40
  if (Object.getOwnPropertySymbols) {
41
- var s = Object.getOwnPropertySymbols(e);
42
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
41
+ var n = Object.getOwnPropertySymbols(e);
42
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
43
43
  }
44
44
  return i;
45
45
  }
@@ -47,7 +47,7 @@ function _objectWithoutPropertiesLoose(r, e) {
47
47
  if (null == r) return {};
48
48
  var t = {};
49
49
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
50
- if (e.includes(n)) continue;
50
+ if (-1 !== e.indexOf(n)) continue;
51
51
  t[n] = r[n];
52
52
  }
53
53
  return t;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../src/ErrorSummary/utils.ts","../../src/ErrorSummary/ErrorSummary.tsx"],"sourcesContent":["export function getFragmentFromUrl(url: string) {\n return url.includes('#') ? url.split('#').pop() : undefined;\n}\n\nexport function getAssociatedLegendOrLabel(input: HTMLElement) {\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","import * as React from 'react';\n\nimport { getAssociatedLegendOrLabel, getFragmentFromUrl } from './utils';\n\ndeclare global {\n namespace JSX {\n interface IntrinsicElements {\n 'bds-error-summary': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;\n }\n }\n}\n\nexport const FormErrorKey = '_form';\n\nconst FINAL_FORM_ERROR = 'FINAL_FORM/form-error';\n\nexport type ErrorSummaryProps = {\n errors: Record<string, Array<string> | string> | null;\n mapNameToId?: (name: string) => string;\n};\n\nexport default function BdsErrorSummary({\n errors,\n mapNameToId = (name) => name,\n ...props\n}: ErrorSummaryProps & React.ComponentPropsWithoutRef<'div'>) {\n const headingId = React.useId();\n const groupRef = React.useRef<HTMLElement>(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 // biome-ignore lint/a11y/useSemanticElements: <fieldset> is not what we want here\n // biome-ignore lint/a11y/noInteractiveElementToNoninteractiveRole: group is not an interactive role\n <bds-error-summary role=\"group\" aria-labelledby={headingId} ref={groupRef} tabIndex={-1} {...props}>\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 // biome-ignore lint/security/noDangerouslySetInnerHtml: some generic form errors may include links\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":["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","FormErrorKey","FINAL_FORM_ERROR","BdsErrorSummary","_ref","errors","_ref$mapNameToId","mapNameToId","name","props","_objectWithoutProperties","_excluded","headingId","React","useId","groupRef","useRef","useEffect","Object","keys","current","focus","handleLinkClick","e","inputId","currentTarget","href","getElementById","legendOrLabel","preventDefault","scrollIntoView","preventScroll","createElement","_extends","role","ref","tabIndex","className","id","xmlns","viewBox","width","fill","d","map","errorKey","message","isFormError","key","dangerouslySetInnerHTML","__html","isArrayField","Array","isArray","messages","Fragment","fieldMessage","index","onClick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,SAASA,kBAAkBA,CAACC,GAAW,EAAE;AAC9C,EAAA,OAAOA,GAAG,CAACC,QAAQ,CAAC,GAAG,CAAC,GAAGD,GAAG,CAACE,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,EAAE,GAAGC,SAAS;AAC7D;AAEO,SAASC,0BAA0BA,CAACC,KAAkB,EAAE;AAAA,EAAA,IAAAC,qBAAA;AAC7D,EAAA,IAAMC,QAAQ,GAAGF,KAAK,CAACG,OAAO,CAAC,UAAU,CAAC;AAE1C,EAAA,IAAID,QAAQ,EAAE;AACZ,IAAA,IAAME,OAAO,GAAGF,QAAQ,CAACG,oBAAoB,CAAC,QAAQ,CAAC;IAEvD,IAAID,OAAO,CAACE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A,MAAA,IAAMK,YAAY,GAAGC,KAAK,CAACC,OAAO,CAACP,OAAO,CAAC;MAE3C,IAAMQ,QAAQ,GAAGH,YAAY,GAAGL,OAAO,GAAG,CAACA,OAAO,CAAC;AAEnD,MAAA,oBACEjC,gBAAA,CAAAmB,aAAA,CAACnB,gBAAK,CAAC0C,QAAQ,EAAA;AAACP,QAAAA,GAAG,EAAEH;OAClBS,EAAAA,QAAQ,CAACV,GAAG,CAAC,UAACY,YAAY,EAAEC,KAAK,EAAK;AACrC,QAAA,IAAMjC,OAAO,GAAAzB,EAAAA,CAAAA,MAAA,CAAMQ,WAAW,CAACsC,QAAQ,CAAC,CAAA,CAAA9C,MAAA,CAAGoD,YAAY,GAAApD,GAAAA,CAAAA,MAAA,CAAO0D,KAAK,EAAA,GAAA,CAAA,GAAM,EAAE,CAAE;QAE7E,oBACE5C,gBAAA,CAAAmB,aAAA,CAAA,IAAA,EAAA;AAAIgB,UAAAA,GAAG,EAAExB;SACPX,eAAAA,gBAAA,CAAAmB,aAAA,CAAA,GAAA,EAAA;AAAGN,UAAAA,IAAI,EAAA3B,GAAAA,CAAAA,MAAA,CAAMyB,OAAO,CAAG;AAACkC,UAAAA,OAAO,EAAEpC;SAC9BkC,EAAAA,YAAY,EACZF,QAAQ,CAACrE,MAAM,GAAG,CAAC,GAAAc,IAAAA,CAAAA,MAAA,CAAQ0D,KAAK,GAAG,CAAC,EAAA,MAAA,CAAA,CAAA1D,MAAA,CAAOuD,QAAQ,CAACrE,MAAM,EAAA,GAAA,CAAA,GAAMR,SAChE,CACD,CAAC;AAET,OAAC,CACa,CAAC;AAErB,KAAC,CACC,CACa;AAAC;AAExB;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../src/ErrorSummary/utils.ts","../../src/ErrorSummary/ErrorSummary.tsx"],"sourcesContent":["export function getFragmentFromUrl(url: string) {\n return url.includes('#') ? url.split('#').pop() : undefined;\n}\n\nexport function getAssociatedLegendOrLabel(input: HTMLElement) {\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","import * as React from 'react';\n\nimport { getAssociatedLegendOrLabel, getFragmentFromUrl } from './utils';\n\ndeclare global {\n namespace JSX {\n interface IntrinsicElements {\n 'bds-error-summary': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;\n }\n }\n}\n\nexport const FormErrorKey = '_form';\n\nconst FINAL_FORM_ERROR = 'FINAL_FORM/form-error';\n\nexport type ErrorSummaryProps = {\n errors: Record<string, Array<string> | string> | null;\n mapNameToId?: (name: string) => string;\n};\n\nexport default function BdsErrorSummary({\n errors,\n mapNameToId = (name) => name,\n ...props\n}: ErrorSummaryProps & React.ComponentPropsWithoutRef<'div'>) {\n const headingId = React.useId();\n const groupRef = React.useRef<HTMLElement>(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 // biome-ignore lint/a11y/useSemanticElements: <fieldset> is not what we want here\n // biome-ignore lint/a11y/noInteractiveElementToNoninteractiveRole: group is not an interactive role\n <bds-error-summary role=\"group\" aria-labelledby={headingId} ref={groupRef} tabIndex={-1} {...props}>\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 // biome-ignore lint/security/noDangerouslySetInnerHtml: some generic form errors may include links\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":["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","FormErrorKey","FINAL_FORM_ERROR","BdsErrorSummary","_ref","errors","_ref$mapNameToId","mapNameToId","name","props","_objectWithoutProperties","_excluded","headingId","React","useId","groupRef","useRef","useEffect","Object","keys","current","focus","handleLinkClick","e","inputId","currentTarget","href","getElementById","legendOrLabel","preventDefault","scrollIntoView","preventScroll","createElement","_extends","role","ref","tabIndex","className","id","xmlns","viewBox","width","fill","d","map","errorKey","message","isFormError","key","dangerouslySetInnerHTML","__html","isArrayField","Array","isArray","messages","Fragment","fieldMessage","index","onClick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,SAASA,kBAAkBA,CAACC,GAAW,EAAE;AAC9C,EAAA,OAAOA,GAAG,CAACC,QAAQ,CAAC,GAAG,CAAC,GAAGD,GAAG,CAACE,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,EAAE,GAAGC,SAAS;AAC7D;AAEO,SAASC,0BAA0BA,CAACC,KAAkB,EAAE;AAAA,EAAA,IAAAC,qBAAA;AAC7D,EAAA,IAAMC,QAAQ,GAAGF,KAAK,CAACG,OAAO,CAAC,UAAU,CAAC;AAE1C,EAAA,IAAID,QAAQ,EAAE;AACZ,IAAA,IAAME,OAAO,GAAGF,QAAQ,CAACG,oBAAoB,CAAC,QAAQ,CAAC;IAEvD,IAAID,OAAO,CAACE,MAAM,EAAE;AAClB,MAAA,IAAMC,eAAe,GAAGH,OAAO,CAAC,CAAC,CAAC;;AAElC;AACA;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GAAGL,OAAO,GAAG,CAACA,OAAO,CAAC;AAEnD,MAAA,oBACEjC,gBAAA,CAAAmB,aAAA,CAACnB,gBAAK,CAAC0C,QAAQ,EAAA;AAACP,QAAAA,GAAG,EAAEH;OAClBS,EAAAA,QAAQ,CAACV,GAAG,CAAC,UAACY,YAAY,EAAEC,KAAK,EAAK;AACrC,QAAA,IAAMjC,OAAO,GAAAzB,EAAAA,CAAAA,MAAA,CAAMQ,WAAW,CAACsC,QAAQ,CAAC,CAAA,CAAA9C,MAAA,CAAGoD,YAAY,GAAApD,GAAAA,CAAAA,MAAA,CAAO0D,KAAK,EAAA,GAAA,CAAA,GAAM,EAAE,CAAE;QAE7E,oBACE5C,gBAAA,CAAAmB,aAAA,CAAA,IAAA,EAAA;AAAIgB,UAAAA,GAAG,EAAExB;SACPX,eAAAA,gBAAA,CAAAmB,aAAA,CAAA,GAAA,EAAA;AAAGN,UAAAA,IAAI,EAAA3B,GAAAA,CAAAA,MAAA,CAAMyB,OAAO,CAAG;AAACkC,UAAAA,OAAO,EAAEpC;SAC9BkC,EAAAA,YAAY,EACZF,QAAQ,CAACrE,MAAM,GAAG,CAAC,GAAAc,IAAAA,CAAAA,MAAA,CAAQ0D,KAAK,GAAG,CAAC,EAAA,MAAA,CAAA,CAAA1D,MAAA,CAAOuD,QAAQ,CAACrE,MAAM,EAAA,GAAA,CAAA,GAAMR,SAChE,CACD,CAAC;AAET,OAAC,CACa,CAAC;AAErB,KAAC,CACC,CACa;AAAC;AAExB;;;;;"}
@@ -15,8 +15,8 @@ function _objectWithoutProperties(e, t) {
15
15
  r,
16
16
  i = _objectWithoutPropertiesLoose(e, t);
17
17
  if (Object.getOwnPropertySymbols) {
18
- var s = Object.getOwnPropertySymbols(e);
19
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
18
+ var n = Object.getOwnPropertySymbols(e);
19
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
20
20
  }
21
21
  return i;
22
22
  }
@@ -24,7 +24,7 @@ function _objectWithoutPropertiesLoose(r, e) {
24
24
  if (null == r) return {};
25
25
  var t = {};
26
26
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
27
- if (e.includes(n)) continue;
27
+ if (-1 !== e.indexOf(n)) continue;
28
28
  t[n] = r[n];
29
29
  }
30
30
  return t;
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/ErrorSummary/utils.ts","../../src/ErrorSummary/ErrorSummary.tsx"],"sourcesContent":["export function getFragmentFromUrl(url: string) {\n return url.includes('#') ? url.split('#').pop() : undefined;\n}\n\nexport function getAssociatedLegendOrLabel(input: HTMLElement) {\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","import * as React from 'react';\n\nimport { getAssociatedLegendOrLabel, getFragmentFromUrl } from './utils';\n\ndeclare global {\n namespace JSX {\n interface IntrinsicElements {\n 'bds-error-summary': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;\n }\n }\n}\n\nexport const FormErrorKey = '_form';\n\nconst FINAL_FORM_ERROR = 'FINAL_FORM/form-error';\n\nexport type ErrorSummaryProps = {\n errors: Record<string, Array<string> | string> | null;\n mapNameToId?: (name: string) => string;\n};\n\nexport default function BdsErrorSummary({\n errors,\n mapNameToId = (name) => name,\n ...props\n}: ErrorSummaryProps & React.ComponentPropsWithoutRef<'div'>) {\n const headingId = React.useId();\n const groupRef = React.useRef<HTMLElement>(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 // biome-ignore lint/a11y/useSemanticElements: <fieldset> is not what we want here\n // biome-ignore lint/a11y/noInteractiveElementToNoninteractiveRole: group is not an interactive role\n <bds-error-summary role=\"group\" aria-labelledby={headingId} ref={groupRef} tabIndex={-1} {...props}>\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 // biome-ignore lint/security/noDangerouslySetInnerHtml: some generic form errors may include links\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":["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","FormErrorKey","FINAL_FORM_ERROR","BdsErrorSummary","_ref","errors","_ref$mapNameToId","mapNameToId","name","props","_objectWithoutProperties","_excluded","headingId","React","useId","groupRef","useRef","useEffect","Object","keys","current","focus","handleLinkClick","e","inputId","currentTarget","href","getElementById","legendOrLabel","preventDefault","scrollIntoView","preventScroll","createElement","_extends","role","ref","tabIndex","className","id","xmlns","viewBox","width","fill","d","map","errorKey","message","isFormError","key","dangerouslySetInnerHTML","__html","isArrayField","Array","isArray","messages","Fragment","fieldMessage","index","onClick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,SAASA,kBAAkBA,CAACC,GAAW,EAAE;AAC9C,EAAA,OAAOA,GAAG,CA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,EAAA,MAAA,CAAA,CAAA1D,MAAA,CAAOuD,QAAQ,CAACrE,MAAM,EAAA,GAAA,CAAA,GAAMR,SAChE,CACD,CAAC;AAET,OAAC,CACa,CAAC;AAErB,KAAC,CACC,CACa;AAAC;AAExB;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/ErrorSummary/utils.ts","../../src/ErrorSummary/ErrorSummary.tsx"],"sourcesContent":["export function getFragmentFromUrl(url: string) {\n return url.includes('#') ? url.split('#').pop() : undefined;\n}\n\nexport function getAssociatedLegendOrLabel(input: HTMLElement) {\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","import * as React from 'react';\n\nimport { getAssociatedLegendOrLabel, getFragmentFromUrl } from './utils';\n\ndeclare global {\n namespace JSX {\n interface IntrinsicElements {\n 'bds-error-summary': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;\n }\n }\n}\n\nexport const FormErrorKey = '_form';\n\nconst FINAL_FORM_ERROR = 'FINAL_FORM/form-error';\n\nexport type ErrorSummaryProps = {\n errors: Record<string, Array<string> | string> | null;\n mapNameToId?: (name: string) => string;\n};\n\nexport default function BdsErrorSummary({\n errors,\n mapNameToId = (name) => name,\n ...props\n}: ErrorSummaryProps & React.ComponentPropsWithoutRef<'div'>) {\n const headingId = React.useId();\n const groupRef = React.useRef<HTMLElement>(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 // biome-ignore lint/a11y/useSemanticElements: <fieldset> is not what we want here\n // biome-ignore lint/a11y/noInteractiveElementToNoninteractiveRole: group is not an interactive role\n <bds-error-summary role=\"group\" aria-labelledby={headingId} ref={groupRef} tabIndex={-1} {...props}>\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 // biome-ignore lint/security/noDangerouslySetInnerHtml: some generic form errors may include links\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":["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","FormErrorKey","FINAL_FORM_ERROR","BdsErrorSummary","_ref","errors","_ref$mapNameToId","mapNameToId","name","props","_objectWithoutProperties","_excluded","headingId","React","useId","groupRef","useRef","useEffect","Object","keys","current","focus","handleLinkClick","e","inputId","currentTarget","href","getElementById","legendOrLabel","preventDefault","scrollIntoView","preventScroll","createElement","_extends","role","ref","tabIndex","className","id","xmlns","viewBox","width","fill","d","map","errorKey","message","isFormError","key","dangerouslySetInnerHTML","__html","isArrayField","Array","isArray","messages","Fragment","fieldMessage","index","onClick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,SAASA,kBAAkBA,CAACC,GAAW,EAAE;AAC9C,EAAA,OAAOA,GAAG,CAACC,QAAQ,CAAC,GAAG,CAAC,GAAGD,GAAG,CAACE,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,EAAE,GAAGC,SAAS;AAC7D;AAEO,SAASC,0BA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a;AAAC;AAExB;;;;"}
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  export type FieldCharacterCountdownProps = {
3
3
  error?: string;
4
- hint?: string;
4
+ hint?: React.ReactNode | string;
5
5
  id?: string;
6
6
  isOptional?: boolean;
7
7
  label: string;
@@ -48,12 +48,12 @@ function _iterableToArrayLimit(r, l) {
48
48
  i,
49
49
  u,
50
50
  a = [],
51
- f = !0,
52
- o = !1;
51
+ f = true,
52
+ o = false;
53
53
  try {
54
54
  if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
55
55
  } catch (r) {
56
- o = !0, n = r;
56
+ o = true, n = r;
57
57
  } finally {
58
58
  try {
59
59
  if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
@@ -73,8 +73,8 @@ function _objectWithoutProperties(e, t) {
73
73
  r,
74
74
  i = _objectWithoutPropertiesLoose(e, t);
75
75
  if (Object.getOwnPropertySymbols) {
76
- var s = Object.getOwnPropertySymbols(e);
77
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
76
+ var n = Object.getOwnPropertySymbols(e);
77
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
78
78
  }
79
79
  return i;
80
80
  }
@@ -82,7 +82,7 @@ function _objectWithoutPropertiesLoose(r, e) {
82
82
  if (null == r) return {};
83
83
  var t = {};
84
84
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
85
- if (e.includes(n)) continue;
85
+ if (-1 !== e.indexOf(n)) continue;
86
86
  t[n] = r[n];
87
87
  }
88
88
  return t;
@@ -203,7 +203,6 @@ function useDebounce(callback, delay) {
203
203
 
204
204
  var _excluded = ["error", "hint", "id", "isOptional", "label", "maxCharacters", "onChange"];
205
205
  function FieldCharacterCountdown(_ref) {
206
- var _id;
207
206
  var error = _ref.error,
208
207
  hint = _ref.hint,
209
208
  id = _ref.id,
@@ -214,7 +213,7 @@ function FieldCharacterCountdown(_ref) {
214
213
  _onChange = _ref.onChange,
215
214
  props = _objectWithoutProperties(_ref, _excluded);
216
215
  var characterCountdown = useCharacterCountdown(maxCharacters, (props.value || '').length);
217
- id = (_id = id) !== null && _id !== void 0 ? _id : props.name;
216
+ id = id !== null && id !== void 0 ? id : props.name;
218
217
  var errorId = React__namespace.useId();
219
218
  var hintId = React__namespace.useId();
220
219
  return /*#__PURE__*/React__namespace.createElement("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/FieldCharacterCountdown/useCharacterCountdown.ts","../../src/FieldCharacterCountdown/FieldCharacterCountdown.tsx"],"sourcesContent":["// biome-ignore lint/style/useImportType: following this rule does not work for some reason\nimport * 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\nconst visuallyHiddenAnnouncementUpdateTimeInSeconds = 1;\n\nexport default function useCharacterCountdown(maxCharacters: number, currentCharacters = 0) {\n const [remainingCharacters, setRemainingCharacters] = React.useState(maxCharacters - currentCharacters);\n\n // When JS fails to load, the default label 👇 will still let the user know about the limit.\n const [label, setLabel] = React.useState(`You can use up to ${maxCharacters} characters`);\n const [visuallyHiddenAnnouncement, setVisuallyHiddenAnnouncement] = React.useState(label);\n\n // This should lag behind the visual update -- otherwise, screen reader users will be interrupted with a lot of chatter while typing\n const updateVisuallyHiddenAnnouncement = useDebounce((charactersToAnnounce: number) => {\n if (charactersToAnnounce >= 0) {\n setVisuallyHiddenAnnouncement(`You have ${charactersToAnnounce} characters remaining`);\n } else {\n setVisuallyHiddenAnnouncement(`You have ${charactersToAnnounce * -1} characters too many`);\n }\n }, visuallyHiddenAnnouncementUpdateTimeInSeconds * 1000);\n\n React.useEffect(() => {\n if (remainingCharacters >= 0) {\n setLabel(`<strong>${remainingCharacters}</strong> characters remaining`);\n } else {\n setLabel(`You have <strong>${remainingCharacters * -1}</strong> characters too many`);\n }\n\n updateVisuallyHiddenAnnouncement(remainingCharacters);\n }, [remainingCharacters, updateVisuallyHiddenAnnouncement]);\n\n return {\n hasExceededLimit: remainingCharacters < 0,\n handleTextareaChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setRemainingCharacters(maxCharacters - e.target.value.length);\n },\n label,\n visuallyHiddenAnnouncement,\n };\n}\n\n/**\n * Simple debounce implementation. Will call the given\n * function once after the time given has passed since\n * it was last called.\n * Lifted from downshift/utils (not exposed in lib).\n * @param {Function} fn the function to call after the time\n * @param {Number} time the time to wait\n * @return {Function} the debounced function\n */\n// biome-ignore lint/suspicious/noExplicitAny: We don't know or care what parameters the function accepts\nfunction debounce(fn: (...rest: any[]) => any, time: number) {\n let timeoutId: number | null = 0;\n\n function cancel() {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n }\n\n function wrapper(...args) {\n cancel();\n timeoutId = setTimeout(() => {\n timeoutId = null;\n fn(...args);\n }, time);\n }\n\n wrapper.cancel = cancel;\n\n return wrapper;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: We don't know or care what parameters the function accepts\nfunction useDebounce<T extends (...rest: any[]) => any>(callback: T, delay: number) {\n return React.useRef(debounce((...params) => callback(...params), delay)).current;\n}\n","import * as React from 'react';\n\nimport ErrorMessage from '../ErrorMessage';\nimport useCharacterCountdown from './useCharacterCountdown';\n\nexport type FieldCharacterCountdownProps = {\n error?: string;\n hint?: string;\n id?: string;\n isOptional?: boolean;\n label: string;\n maxCharacters: number;\n};\n\nexport default function FieldCharacterCountdown({\n error,\n hint,\n id,\n isOptional = false,\n label,\n maxCharacters,\n onChange,\n ...props\n}: FieldCharacterCountdownProps & React.ComponentPropsWithoutRef<'textarea'>) {\n const characterCountdown = useCharacterCountdown(maxCharacters, ((props.value as string) || '').length);\n\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 onChange={(e) => {\n if (onChange) {\n onChange(e);\n }\n\n characterCountdown.handleTextareaChange(e);\n }}\n {...props}\n />\n <div\n aria-hidden=\"true\"\n className=\"bds-character-count\"\n data-exceeds-limit={characterCountdown.hasExceededLimit ? true : undefined}\n // biome-ignore lint/security/noDangerouslySetInnerHtml: HTML is expected and used for highlighting the number itself\n dangerouslySetInnerHTML={{\n __html: characterCountdown.label,\n }}\n />\n <div aria-live=\"polite\" className=\"visually-hidden\">\n {characterCountdown.visuallyHiddenAnnouncement}\n </div>\n </div>\n );\n}\n"],"names":["ErrorMessage","_ref","className","children","props","_objectWithoutProperties","_excluded","React","createElement","_extends","filter","x","join","xmlns","viewBox","height","width","fill","d","visuallyHiddenAnnouncementUpdateTimeInSeconds","useCharacterCountdown","maxCharacters","currentCharacters","arguments","length","undefined","_React$useState","useState","_React$useState2","_slicedToArray","remainingCharacters","setRemainingCharacters","_React$useState3","concat","_React$useState4","label","setLabel","_React$useState5","_React$useState6","visuallyHiddenAnnouncement","setVisuallyHiddenAnnouncement","updateVisuallyHiddenAnnouncement","useDebounce","charactersToAnnounce","useEffect","hasExceededLimit","handleTextareaChange","e","target","value","debounce","fn","time","timeoutId","cancel","clearTimeout","wrapper","_len","args","Array","_key","setTimeout","apply","callback","delay","useRef","current","FieldCharacterCountdown","_id","error","hint","id","_ref$isOptional","isOptional","onChange","characterCountdown","name","errorId","useId","hintId","htmlFor","dangerouslySetInnerHTML","__html"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGe,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;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;KAAC,CAAA,CAACC,IAAI,CAAC,GAAG;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,I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ACxBqE,IAAAA,EAAE,EAAEA,EAAG;AACPG,IAAAA,QAAQ,EAAE,SAAVA,QAAQA,CAAG3B,CAAC,EAAK;AACf,MAAA,IAAI2B,SAAQ,EAAE;QACZA,SAAQ,CAAC3B,CAAC,CAAC;AACb;AAEA4B,MAAAA,kBAAkB,CAAC7B,oBAAoB,CAACC,CAAC,CAAC;AAC5C;AAAE,GAAA,EACE3C,KAAK,CACV,CAAC,eACFG,gBAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AACE,IAAA,aAAA,EAAY,MAAM;AAClBN,IAAAA,SAAS,EAAC,qBAAqB;AAC/B,IAAA,oBAAA,EAAoByE,kBAAkB,CAAC9B,gBAAgB,GAAG,IAAI,GAAGpB;AACjE;AAAA;AACAwD,IAAAA,uBAAuB,EAAE;MACvBC,MAAM,EAAEP,kBAAkB,CAACxC;AAC7B;AAAE,GACH,CAAC,eACF5B,gBAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAK,IAAA,WAAA,EAAU,QAAQ;AAACN,IAAAA,SAAS,EAAC;AAAiB,GAAA,EAChDyE,kBAAkB,CAACpC,0BACjB,CACF,CAAC;AAEV;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/FieldCharacterCountdown/useCharacterCountdown.ts","../../src/FieldCharacterCountdown/FieldCharacterCountdown.tsx"],"sourcesContent":["// biome-ignore lint/style/useImportType: following this rule does not work for some reason\nimport * 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\nconst visuallyHiddenAnnouncementUpdateTimeInSeconds = 1;\n\nexport default function useCharacterCountdown(maxCharacters: number, currentCharacters = 0) {\n const [remainingCharacters, setRemainingCharacters] = React.useState(maxCharacters - currentCharacters);\n\n // When JS fails to load, the default label 👇 will still let the user know about the limit.\n const [label, setLabel] = React.useState(`You can use up to ${maxCharacters} characters`);\n const [visuallyHiddenAnnouncement, setVisuallyHiddenAnnouncement] = React.useState(label);\n\n // This should lag behind the visual update -- otherwise, screen reader users will be interrupted with a lot of chatter while typing\n const updateVisuallyHiddenAnnouncement = useDebounce((charactersToAnnounce: number) => {\n if (charactersToAnnounce >= 0) {\n setVisuallyHiddenAnnouncement(`You have ${charactersToAnnounce} characters remaining`);\n } else {\n setVisuallyHiddenAnnouncement(`You have ${charactersToAnnounce * -1} characters too many`);\n }\n }, visuallyHiddenAnnouncementUpdateTimeInSeconds * 1000);\n\n React.useEffect(() => {\n if (remainingCharacters >= 0) {\n setLabel(`<strong>${remainingCharacters}</strong> characters remaining`);\n } else {\n setLabel(`You have <strong>${remainingCharacters * -1}</strong> characters too many`);\n }\n\n updateVisuallyHiddenAnnouncement(remainingCharacters);\n }, [remainingCharacters, updateVisuallyHiddenAnnouncement]);\n\n return {\n hasExceededLimit: remainingCharacters < 0,\n handleTextareaChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setRemainingCharacters(maxCharacters - e.target.value.length);\n },\n label,\n visuallyHiddenAnnouncement,\n };\n}\n\n/**\n * Simple debounce implementation. Will call the given\n * function once after the time given has passed since\n * it was last called.\n * Lifted from downshift/utils (not exposed in lib).\n * @param {Function} fn the function to call after the time\n * @param {Number} time the time to wait\n * @return {Function} the debounced function\n */\n// biome-ignore lint/suspicious/noExplicitAny: We don't know or care what parameters the function accepts\nfunction debounce(fn: (...rest: any[]) => any, time: number) {\n let timeoutId: number | null = 0;\n\n function cancel() {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n }\n\n function wrapper(...args) {\n cancel();\n timeoutId = setTimeout(() => {\n timeoutId = null;\n fn(...args);\n }, time);\n }\n\n wrapper.cancel = cancel;\n\n return wrapper;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: We don't know or care what parameters the function accepts\nfunction useDebounce<T extends (...rest: any[]) => any>(callback: T, delay: number) {\n return React.useRef(debounce((...params) => callback(...params), delay)).current;\n}\n","import * as React from 'react';\n\nimport ErrorMessage from '../ErrorMessage';\nimport useCharacterCountdown from './useCharacterCountdown';\n\nexport type FieldCharacterCountdownProps = {\n error?: string;\n hint?: React.ReactNode | string;\n id?: string;\n isOptional?: boolean;\n label: string;\n maxCharacters: number;\n};\n\nexport default function FieldCharacterCountdown({\n error,\n hint,\n id,\n isOptional = false,\n label,\n maxCharacters,\n onChange,\n ...props\n}: FieldCharacterCountdownProps & React.ComponentPropsWithoutRef<'textarea'>) {\n const characterCountdown = useCharacterCountdown(maxCharacters, ((props.value as string) || '').length);\n\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 onChange={(e) => {\n if (onChange) {\n onChange(e);\n }\n\n characterCountdown.handleTextareaChange(e);\n }}\n {...props}\n />\n <div\n aria-hidden=\"true\"\n className=\"bds-character-count\"\n data-exceeds-limit={characterCountdown.hasExceededLimit ? true : undefined}\n // biome-ignore lint/security/noDangerouslySetInnerHtml: HTML is expected and used for highlighting the number itself\n dangerouslySetInnerHTML={{\n __html: characterCountdown.label,\n }}\n />\n <div aria-live=\"polite\" className=\"visually-hidden\">\n {characterCountdown.visuallyHiddenAnnouncement}\n </div>\n </div>\n );\n}\n"],"names":["ErrorMessage","_ref","className","children","props","_objectWithoutProperties","_excluded","React","createElement","_extends","filter","x","join","xmlns","viewBox","height","width","fill","d","visuallyHiddenAnnouncementUpdateTimeInSeconds","useCharacterCountdown","maxCharacters","currentCharacters","arguments","length","undefined","_React$useState","useState","_React$useState2","_slicedToArray","remainingCharacters","setRemainingCharacters","_React$useState3","concat","_React$useState4","label","setLabel","_React$useState5","_React$useState6","visuallyHiddenAnnouncement","setVisuallyHiddenAnnouncement","updateVisuallyHiddenAnnouncement","useDebounce","charactersToAnnounce","useEffect","hasExceededLimit","handleTextareaChange","e","target","value","debounce","fn","time","timeoutId","cancel","clearTimeout","wrapper","_len","args","Array","_key","setTimeout","apply","callback","delay","useRef","current","FieldCharacterCountdown","error","hint","id","_ref$isOptional","isOptional","onChange","characterCountdown","name","errorId","useId","hintId","htmlFor","dangerouslySetInnerHTML","__html"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGe,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;AAClE,EAAA,oBACEC,gBAAA,CAAAC,aAAA,CAAA,MAAA,EAAAC,QAAA,CAAA;IAAMP,SAAS,EAAE,CAAC,WAA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AACE,IAAA,cAAA,EAAc2D,KAAK,GAAG,IAAI,GAAG3C,SAAU;IACvC,kBAAkB2C,EAAAA,KAAK,IAAIC,IAAI,GAAA,EAAA,CAAApC,MAAA,CAAM6C,MAAM,OAAA7C,MAAA,CAAI2C,OAAO,CAAKR,GAAAA,KAAK,GAAGQ,OAAO,GAAGP,IAAI,GAAGS,MAAM,GAAGrD,SAAU;AACvGvB,IAAAA,SAAS,EAAC,cAAc;AACxBoE,IAAAA,EAAE,EAAEA,EAAG;AACPG,IAAAA,QAAQ,EAAE,SAAVA,QAAQA,CAAG1B,CAAC,EAAK;AACf,MAAA,IAAI0B,SAAQ,EAAE;QACZA,SAAQ,CAAC1B,CAAC,CAAC;AACb;AAEA2B,MAAAA,kBAAkB,CAAC5B,oBAAoB,CAACC,CAAC,CAAC;AAC5C;AAAE,GAAA,EACE3C,KAAK,CACV,CAAC,eACFG,gBAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AACE,IAAA,aAAA,EAAY,MAAM;AAClBN,IAAAA,SAAS,EAAC,qBAAqB;AAC/B,IAAA,oBAAA,EAAoBwE,kBAAkB,CAAC7B,gBAAgB,GAAG,IAAI,GAAGpB;AACjE;AAAA;AACAuD,IAAAA,uBAAuB,EAAE;MACvBC,MAAM,EAAEP,kBAAkB,CAACvC;AAC7B;AAAE,GACH,CAAC,eACF5B,gBAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAK,IAAA,WAAA,EAAU,QAAQ;AAACN,IAAAA,SAAS,EAAC;AAAiB,GAAA,EAChDwE,kBAAkB,CAACnC,0BACjB,CACF,CAAC;AAEV;;;;;"}
@@ -25,12 +25,12 @@ function _iterableToArrayLimit(r, l) {
25
25
  i,
26
26
  u,
27
27
  a = [],
28
- f = !0,
29
- o = !1;
28
+ f = true,
29
+ o = false;
30
30
  try {
31
31
  if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
32
32
  } catch (r) {
33
- o = !0, n = r;
33
+ o = true, n = r;
34
34
  } finally {
35
35
  try {
36
36
  if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
@@ -50,8 +50,8 @@ function _objectWithoutProperties(e, t) {
50
50
  r,
51
51
  i = _objectWithoutPropertiesLoose(e, t);
52
52
  if (Object.getOwnPropertySymbols) {
53
- var s = Object.getOwnPropertySymbols(e);
54
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
53
+ var n = Object.getOwnPropertySymbols(e);
54
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
55
55
  }
56
56
  return i;
57
57
  }
@@ -59,7 +59,7 @@ function _objectWithoutPropertiesLoose(r, e) {
59
59
  if (null == r) return {};
60
60
  var t = {};
61
61
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
62
- if (e.includes(n)) continue;
62
+ if (-1 !== e.indexOf(n)) continue;
63
63
  t[n] = r[n];
64
64
  }
65
65
  return t;
@@ -180,7 +180,6 @@ function useDebounce(callback, delay) {
180
180
 
181
181
  var _excluded = ["error", "hint", "id", "isOptional", "label", "maxCharacters", "onChange"];
182
182
  function FieldCharacterCountdown(_ref) {
183
- var _id;
184
183
  var error = _ref.error,
185
184
  hint = _ref.hint,
186
185
  id = _ref.id,
@@ -191,7 +190,7 @@ function FieldCharacterCountdown(_ref) {
191
190
  _onChange = _ref.onChange,
192
191
  props = _objectWithoutProperties(_ref, _excluded);
193
192
  var characterCountdown = useCharacterCountdown(maxCharacters, (props.value || '').length);
194
- id = (_id = id) !== null && _id !== void 0 ? _id : props.name;
193
+ id = id !== null && id !== void 0 ? id : props.name;
195
194
  var errorId = React.useId();
196
195
  var hintId = React.useId();
197
196
  return /*#__PURE__*/React.createElement("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/FieldCharacterCountdown/useCharacterCountdown.ts","../../src/FieldCharacterCountdown/FieldCharacterCountdown.tsx"],"sourcesContent":["// biome-ignore lint/style/useImportType: following this rule does not work for some reason\nimport * 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\nconst visuallyHiddenAnnouncementUpdateTimeInSeconds = 1;\n\nexport default function useCharacterCountdown(maxCharacters: number, currentCharacters = 0) {\n const [remainingCharacters, setRemainingCharacters] = React.useState(maxCharacters - currentCharacters);\n\n // When JS fails to load, the default label 👇 will still let the user know about the limit.\n const [label, setLabel] = React.useState(`You can use up to ${maxCharacters} characters`);\n const [visuallyHiddenAnnouncement, setVisuallyHiddenAnnouncement] = React.useState(label);\n\n // This should lag behind the visual update -- otherwise, screen reader users will be interrupted with a lot of chatter while typing\n const updateVisuallyHiddenAnnouncement = useDebounce((charactersToAnnounce: number) => {\n if (charactersToAnnounce >= 0) {\n setVisuallyHiddenAnnouncement(`You have ${charactersToAnnounce} characters remaining`);\n } else {\n setVisuallyHiddenAnnouncement(`You have ${charactersToAnnounce * -1} characters too many`);\n }\n }, visuallyHiddenAnnouncementUpdateTimeInSeconds * 1000);\n\n React.useEffect(() => {\n if (remainingCharacters >= 0) {\n setLabel(`<strong>${remainingCharacters}</strong> characters remaining`);\n } else {\n setLabel(`You have <strong>${remainingCharacters * -1}</strong> characters too many`);\n }\n\n updateVisuallyHiddenAnnouncement(remainingCharacters);\n }, [remainingCharacters, updateVisuallyHiddenAnnouncement]);\n\n return {\n hasExceededLimit: remainingCharacters < 0,\n handleTextareaChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setRemainingCharacters(maxCharacters - e.target.value.length);\n },\n label,\n visuallyHiddenAnnouncement,\n };\n}\n\n/**\n * Simple debounce implementation. Will call the given\n * function once after the time given has passed since\n * it was last called.\n * Lifted from downshift/utils (not exposed in lib).\n * @param {Function} fn the function to call after the time\n * @param {Number} time the time to wait\n * @return {Function} the debounced function\n */\n// biome-ignore lint/suspicious/noExplicitAny: We don't know or care what parameters the function accepts\nfunction debounce(fn: (...rest: any[]) => any, time: number) {\n let timeoutId: number | null = 0;\n\n function cancel() {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n }\n\n function wrapper(...args) {\n cancel();\n timeoutId = setTimeout(() => {\n timeoutId = null;\n fn(...args);\n }, time);\n }\n\n wrapper.cancel = cancel;\n\n return wrapper;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: We don't know or care what parameters the function accepts\nfunction useDebounce<T extends (...rest: any[]) => any>(callback: T, delay: number) {\n return React.useRef(debounce((...params) => callback(...params), delay)).current;\n}\n","import * as React from 'react';\n\nimport ErrorMessage from '../ErrorMessage';\nimport useCharacterCountdown from './useCharacterCountdown';\n\nexport type FieldCharacterCountdownProps = {\n error?: string;\n hint?: string;\n id?: string;\n isOptional?: boolean;\n label: string;\n maxCharacters: number;\n};\n\nexport default function FieldCharacterCountdown({\n error,\n hint,\n id,\n isOptional = false,\n label,\n maxCharacters,\n onChange,\n ...props\n}: FieldCharacterCountdownProps & React.ComponentPropsWithoutRef<'textarea'>) {\n const characterCountdown = useCharacterCountdown(maxCharacters, ((props.value as string) || '').length);\n\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 onChange={(e) => {\n if (onChange) {\n onChange(e);\n }\n\n characterCountdown.handleTextareaChange(e);\n }}\n {...props}\n />\n <div\n aria-hidden=\"true\"\n className=\"bds-character-count\"\n data-exceeds-limit={characterCountdown.hasExceededLimit ? true : undefined}\n // biome-ignore lint/security/noDangerouslySetInnerHtml: HTML is expected and used for highlighting the number itself\n dangerouslySetInnerHTML={{\n __html: characterCountdown.label,\n }}\n />\n <div aria-live=\"polite\" className=\"visually-hidden\">\n {characterCountdown.visuallyHiddenAnnouncement}\n </div>\n </div>\n );\n}\n"],"names":["ErrorMessage","_ref","className","children","props","_objectWithoutProperties","_excluded","React","createElement","_extends","filter","x","join","xmlns","viewBox","height","width","fill","d","visuallyHiddenAnnouncementUpdateTimeInSeconds","useCharacterCountdown","maxCharacters","currentCharacters","arguments","length","undefined","_React$useState","useState","_React$useState2","_slicedToArray","remainingCharacters","setRemainingCharacters","_React$useState3","concat","_React$useState4","label","setLabel","_React$useState5","_React$useState6","visuallyHiddenAnnouncement","setVisuallyHiddenAnnouncement","updateVisuallyHiddenAnnouncement","useDebounce","charactersToAnnounce","useEffect","hasExceededLimit","handleTextareaChange","e","target","value","debounce","fn","time","timeoutId","cancel","clearTimeout","wrapper","_len","args","Array","_key","setTimeout","apply","callback","delay","useRef","current","FieldCharacterCountdown","_id","error","hint","id","_ref$isOptional","isOptional","onChange","characterCountdown","name","errorId","useId","hintId","htmlFor","dangerouslySetInn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wD,IAAAA,uBAAuB,EAAE;MACvBC,MAAM,EAAEP,kBAAkB,CAACxC;AAC7B;AAAE,GACH,CAAC,eACF5B,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAK,IAAA,WAAA,EAAU,QAAQ;AAACN,IAAAA,SAAS,EAAC;AAAiB,GAAA,EAChDyE,kBAAkB,CAACpC,0BACjB,CACF,CAAC;AAEV;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/FieldCharacterCountdown/useCharacterCountdown.ts","../../src/FieldCharacterCountdown/FieldCharacterCountdown.tsx"],"sourcesContent":["// biome-ignore lint/style/useImportType: following this rule does not work for some reason\nimport * 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\nconst visuallyHiddenAnnouncementUpdateTimeInSeconds = 1;\n\nexport default function useCharacterCountdown(maxCharacters: number, currentCharacters = 0) {\n const [remainingCharacters, setRemainingCharacters] = React.useState(maxCharacters - currentCharacters);\n\n // When JS fails to load, the default label 👇 will still let the user know about the limit.\n const [label, setLabel] = React.useState(`You can use up to ${maxCharacters} characters`);\n const [visuallyHiddenAnnouncement, setVisuallyHiddenAnnouncement] = React.useState(label);\n\n // This should lag behind the visual update -- otherwise, screen reader users will be interrupted with a lot of chatter while typing\n const updateVisuallyHiddenAnnouncement = useDebounce((charactersToAnnounce: number) => {\n if (charactersToAnnounce >= 0) {\n setVisuallyHiddenAnnouncement(`You have ${charactersToAnnounce} characters remaining`);\n } else {\n setVisuallyHiddenAnnouncement(`You have ${charactersToAnnounce * -1} characters too many`);\n }\n }, visuallyHiddenAnnouncementUpdateTimeInSeconds * 1000);\n\n React.useEffect(() => {\n if (remainingCharacters >= 0) {\n setLabel(`<strong>${remainingCharacters}</strong> characters remaining`);\n } else {\n setLabel(`You have <strong>${remainingCharacters * -1}</strong> characters too many`);\n }\n\n updateVisuallyHiddenAnnouncement(remainingCharacters);\n }, [remainingCharacters, updateVisuallyHiddenAnnouncement]);\n\n return {\n hasExceededLimit: remainingCharacters < 0,\n handleTextareaChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setRemainingCharacters(maxCharacters - e.target.value.length);\n },\n label,\n visuallyHiddenAnnouncement,\n };\n}\n\n/**\n * Simple debounce implementation. Will call the given\n * function once after the time given has passed since\n * it was last called.\n * Lifted from downshift/utils (not exposed in lib).\n * @param {Function} fn the function to call after the time\n * @param {Number} time the time to wait\n * @return {Function} the debounced function\n */\n// biome-ignore lint/suspicious/noExplicitAny: We don't know or care what parameters the function accepts\nfunction debounce(fn: (...rest: any[]) => any, time: number) {\n let timeoutId: number | null = 0;\n\n function cancel() {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n }\n\n function wrapper(...args) {\n cancel();\n timeoutId = setTimeout(() => {\n timeoutId = null;\n fn(...args);\n }, time);\n }\n\n wrapper.cancel = cancel;\n\n return wrapper;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: We don't know or care what parameters the function accepts\nfunction useDebounce<T extends (...rest: any[]) => any>(callback: T, delay: number) {\n return React.useRef(debounce((...params) => callback(...params), delay)).current;\n}\n","import * as React from 'react';\n\nimport ErrorMessage from '../ErrorMessage';\nimport useCharacterCountdown from './useCharacterCountdown';\n\nexport type FieldCharacterCountdownProps = {\n error?: string;\n hint?: React.ReactNode | string;\n id?: string;\n isOptional?: boolean;\n label: string;\n maxCharacters: number;\n};\n\nexport default function FieldCharacterCountdown({\n error,\n hint,\n id,\n isOptional = false,\n label,\n maxCharacters,\n onChange,\n ...props\n}: FieldCharacterCountdownProps & React.ComponentPropsWithoutRef<'textarea'>) {\n const characterCountdown = useCharacterCountdown(maxCharacters, ((props.value as string) || '').length);\n\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 onChange={(e) => {\n if (onChange) {\n onChange(e);\n }\n\n characterCountdown.handleTextareaChange(e);\n }}\n {...props}\n />\n <div\n aria-hidden=\"true\"\n className=\"bds-character-count\"\n data-exceeds-limit={characterCountdown.hasExceededLimit ? true : undefined}\n // biome-ignore lint/security/noDangerouslySetInnerHtml: HTML is expected and used for highlighting the number itself\n dangerouslySetInnerHTML={{\n __html: characterCountdown.label,\n }}\n />\n <div aria-live=\"polite\" className=\"visually-hidden\">\n {characterCountdown.visuallyHiddenAnnouncement}\n </div>\n </div>\n );\n}\n"],"names":["ErrorMessage","_ref","className","children","props","_objectWithoutProperties","_excluded","React","createElement","_extends","filter","x","join","xmlns","viewBox","height","width","fill","d","visuallyHiddenAnnouncementUpdateTimeInSeconds","useCharacterCountdown","maxCharacters","currentCharacters","arguments","length","undefined","_React$useState","useState","_React$useState2","_slicedToArray","remainingCharacters","setRemainingCharacters","_React$useState3","concat","_React$useState4","label","setLabel","_React$useState5","_React$useState6","visuallyHiddenAnnouncement","setVisuallyHiddenAnnouncement","updateVisuallyHiddenAnnouncement","useDebounce","charactersToAnnounce","useEffect","hasExceededLimit","handleTextareaChange","e","target","value","debounce","fn","time","timeoutId","cancel","clearTimeout","wrapper","_len","args","Array","_key","setTimeout","apply","callback","delay","useRef","current","FieldCharacterCountdown","error","hint","id","_ref$isOptional","isOptional","onChange","characterCountdown","name","errorId","useId","hintId","htmlFor","dangerouslySetInnerHTML","__html"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGe,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;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;KAAC,CAAA,CAACC,IAAI,CAAC,GAAG;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;GAELV,eAAAA,KAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AAAMU,IAAAA,CAAC,EAAC;AAA4U,GAAE,CACnV,CAAC,EACLf,QACG,CA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