@iabbb/bds-react 0.40.0-beta.2 → 0.40.0-beta.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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ErrorSummary = require('@iabbb/bds/ErrorSummary');
5
+ var ErrorSummary = require('@iabbb/bds/ErrorSummary/index.cjs');
6
6
  var ssrDomShim = require('@lit-labs/ssr-dom-shim');
7
7
  var React = require('react');
8
8
 
@@ -174,7 +174,7 @@ var e = new Set(["children", "localName", "ref", "style", "className"]),
174
174
  n = new WeakMap(),
175
175
  l = function l(e, _l, t, o, a) {
176
176
  var i = null == a ? void 0 : a[_l];
177
- void 0 === i || t === o ? (e[_l] = t, null == t && _l in ssrDomShim.HTMLElement.prototype && e.removeAttribute(_l)) : function (e, l, t) {
177
+ void 0 === i || t === o ? (e[_l] = t, null == t && _l in HTMLElement.prototype && e.removeAttribute(_l)) : function (e, l, t) {
178
178
  var o = n.get(e);
179
179
  void 0 === o && n.set(e, o = new Map());
180
180
  var a = o.get(l);
@@ -219,6 +219,14 @@ var e = new Set(["children", "localName", "ref", "style", "className"]),
219
219
  };
220
220
 
221
221
  var _excluded = ["className", "errors", "mapNameToId"];
222
+ if (globalThis.window === undefined) {
223
+ var window = {
224
+ customElements: ssrDomShim.customElements,
225
+ HTMLElement: ssrDomShim.HTMLElement
226
+ };
227
+ // Copy initial window globals to node global
228
+ Object.assign(globalThis, window);
229
+ }
222
230
  var ReactErrorSummary = t({
223
231
  tagName: 'bds-error-summary',
224
232
  elementClass: ErrorSummary,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../src/ErrorSummary/ErrorSummary.tsx"],"sourcesContent":["// https://github.com/IABBB/bds/blob/19862b9c179f6cc650d2973a83cce5ab3516fc99/packages/react/src/ErrorSummary/ErrorSummary.js\r\n// todo - exports?\r\nimport ErrorSummary from '@iabbb/bds/ErrorSummary';\r\nimport { createComponent } from '@lit-labs/react';\r\nimport * as React from 'react';\r\n\r\nconst ReactErrorSummary = createComponent({\r\n tagName: 'bds-error-summary',\r\n elementClass: ErrorSummary,\r\n react: React,\r\n});\r\n\r\ndeclare global {\r\n namespace JSX {\r\n interface IntrinsicElements {\r\n 'bds-error-summary': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;\r\n }\r\n }\r\n}\r\n\r\nexport const FormErrorKey = '_form';\r\n\r\nconst FINAL_FORM_ERROR = 'FINAL_FORM/form-error';\r\n\r\nexport type ErrorSummaryProps = {\r\n errors: Record<string, Array<string> | string> | null;\r\n mapNameToId?: (name: string) => string;\r\n};\r\n\r\nexport default function BdsErrorSummary({\r\n className,\r\n errors,\r\n mapNameToId = (name) => name,\r\n ...props\r\n}: ErrorSummaryProps & React.ComponentPropsWithoutRef<'div'>) {\r\n const headingId = React.useId();\r\n const groupRef = React.useRef<HTMLElement>(null);\r\n\r\n React.useEffect(() => {\r\n if (!errors || Object.keys(errors).length === 0) return;\r\n if (!groupRef.current) return;\r\n\r\n groupRef.current.focus();\r\n }, [errors]);\r\n\r\n if (!errors || Object.keys(errors).length === 0) return null;\r\n\r\n return (\r\n <ReactErrorSummary\r\n className={['stack', className].filter((x) => x).join(' ')}\r\n role=\"group\"\r\n aria-labelledby={headingId}\r\n ref={groupRef}\r\n tabIndex={-1}\r\n {...props}\r\n >\r\n <h2 className=\"bds-h5\" id={headingId}>\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 512 512\"\r\n aria-hidden=\"true\"\r\n height=\"1em\"\r\n width=\"1em\"\r\n fill=\"currentColor\"\r\n >\r\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\" />\r\n </svg>\r\n Issue\r\n </h2>\r\n <ul>\r\n {Object.keys(errors).map((errorKey) => {\r\n const message = errors[errorKey];\r\n const isFormError = [FINAL_FORM_ERROR, FormErrorKey].includes(errorKey);\r\n\r\n if (isFormError) {\r\n return <li key={errorKey} dangerouslySetInnerHTML={{ __html: message }} />;\r\n }\r\n\r\n const isArrayField = Array.isArray(message);\r\n\r\n const messages = isArrayField ? message : [message];\r\n\r\n return (\r\n <React.Fragment key={errorKey}>\r\n {messages.map((fieldMessage, index) => {\r\n const inputId = `${mapNameToId(errorKey)}${isArrayField ? `[${index}]` : ''}`;\r\n\r\n return (\r\n <li key={inputId}>\r\n <a href={`#${inputId}`}>\r\n {fieldMessage}\r\n {messages.length > 1 ? ` (${index + 1} of ${messages.length})` : undefined}\r\n </a>\r\n </li>\r\n );\r\n })}\r\n </React.Fragment>\r\n );\r\n })}\r\n </ul>\r\n </ReactErrorSummary>\r\n );\r\n}\r\n"],"names":["ReactErrorSummary","createComponent","tagName","elementClass","ErrorSummary","react","React","FormErrorKey","FINAL_FORM_ERROR","BdsErrorSummary","_ref","className","errors","_ref$mapNameToId","mapNameToId","name","props","_objectWithoutProperties","_excluded","headingId","useId","groupRef","useRef","useEffect","Object","keys","length","current","focus","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","inputId","concat","href","undefined"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ChE,CACD,CAAC,CAAA;AAET,KAAC,CACa,CAAC,CAAA;GAEpB,CACC,CACa,CAAC,CAAA;AAExB;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../../.yarn/__virtual__/@lit-labs-react-virtual-4509891a2a/0/cache/@lit-labs-react-npm-2.0.0-0a425990f1-28737941de.zip/node_modules/@lit-labs/react/create-component.js","../../src/ErrorSummary/ErrorSummary.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst e=new Set([\"children\",\"localName\",\"ref\",\"style\",\"className\"]),n=new WeakMap,l=(e,l,t,o,a)=>{const i=null==a?void 0:a[l];void 0===i||t===o?(e[l]=t,null==t&&l in HTMLElement.prototype&&e.removeAttribute(l)):((e,l,t)=>{let o=n.get(e);void 0===o&&n.set(e,o=new Map);let a=o.get(l);void 0!==t?void 0===a?(o.set(l,a={handleEvent:t}),e.addEventListener(l,a)):a.handleEvent=t:void 0!==a&&(o.delete(l),e.removeEventListener(l,a))})(e,i,t)},t=({react:n,tagName:t,elementClass:o,events:a,displayName:i})=>{const s=new Set(Object.keys(null!=a?a:{})),c=n.forwardRef(((i,c)=>{const r=n.useRef(null),d=n.useRef(null),u={},v={};for(const[n,l]of Object.entries(i))e.has(n)?u[\"className\"===n?\"class\":n]=l:s.has(n)||n in o.prototype?v[n]=l:u[n]=l;return n.useLayoutEffect((()=>{if(null!==d.current){for(const e in v)l(d.current,e,i[e],r.current?r.current[e]:void 0,a);r.current=i}})),n.useLayoutEffect((()=>{var e;null===(e=d.current)||void 0===e||e.removeAttribute(\"defer-hydration\")}),[]),u.suppressHydrationWarning=!0,n.createElement(t,{...u,ref:e=>{d.current=e,\"function\"==typeof c?c(e):null!==c&&(c.current=e)}})}));return c.displayName=null!=i?i:o.name,c};export{t as createComponent};\n//# sourceMappingURL=create-component.js.map\n","import ErrorSummary from '@iabbb/bds/ErrorSummary';\r\nimport { createComponent } from '@lit-labs/react';\r\nimport { customElements, HTMLElement } from '@lit-labs/ssr-dom-shim';\r\nimport * as React from 'react';\r\n\r\nif (globalThis.window === undefined) {\r\n const window = { customElements, HTMLElement };\r\n // Copy initial window globals to node global\r\n Object.assign(globalThis, window);\r\n}\r\n\r\nconst ReactErrorSummary = createComponent({\r\n tagName: 'bds-error-summary',\r\n elementClass: ErrorSummary,\r\n react: React,\r\n});\r\n\r\ndeclare global {\r\n namespace JSX {\r\n interface IntrinsicElements {\r\n 'bds-error-summary': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;\r\n }\r\n }\r\n}\r\n\r\nexport const FormErrorKey = '_form';\r\n\r\nconst FINAL_FORM_ERROR = 'FINAL_FORM/form-error';\r\n\r\nexport type ErrorSummaryProps = {\r\n errors: Record<string, Array<string> | string> | null;\r\n mapNameToId?: (name: string) => string;\r\n};\r\n\r\nexport default function BdsErrorSummary({\r\n className,\r\n errors,\r\n mapNameToId = (name) => name,\r\n ...props\r\n}: ErrorSummaryProps & React.ComponentPropsWithoutRef<'div'>) {\r\n const headingId = React.useId();\r\n const groupRef = React.useRef<HTMLElement>(null);\r\n\r\n React.useEffect(() => {\r\n if (!errors || Object.keys(errors).length === 0) return;\r\n if (!groupRef.current) return;\r\n\r\n groupRef.current.focus();\r\n }, [errors]);\r\n\r\n if (!errors || Object.keys(errors).length === 0) return null;\r\n\r\n return (\r\n <ReactErrorSummary\r\n className={['stack', className].filter((x) => x).join(' ')}\r\n role=\"group\"\r\n aria-labelledby={headingId}\r\n ref={groupRef}\r\n tabIndex={-1}\r\n {...props}\r\n >\r\n <h2 className=\"bds-h5\" id={headingId}>\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 512 512\"\r\n aria-hidden=\"true\"\r\n height=\"1em\"\r\n width=\"1em\"\r\n fill=\"currentColor\"\r\n >\r\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\" />\r\n </svg>\r\n Issue\r\n </h2>\r\n <ul>\r\n {Object.keys(errors).map((errorKey) => {\r\n const message = errors[errorKey];\r\n const isFormError = [FINAL_FORM_ERROR, FormErrorKey].includes(errorKey);\r\n\r\n if (isFormError) {\r\n return <li key={errorKey} dangerouslySetInnerHTML={{ __html: message }} />;\r\n }\r\n\r\n const isArrayField = Array.isArray(message);\r\n\r\n const messages = isArrayField ? message : [message];\r\n\r\n return (\r\n <React.Fragment key={errorKey}>\r\n {messages.map((fieldMessage, index) => {\r\n const inputId = `${mapNameToId(errorKey)}${isArrayField ? `[${index}]` : ''}`;\r\n\r\n return (\r\n <li key={inputId}>\r\n <a href={`#${inputId}`}>\r\n {fieldMessage}\r\n {messages.length > 1 ? ` (${index + 1} of ${messages.length})` : undefined}\r\n </a>\r\n </li>\r\n );\r\n })}\r\n </React.Fragment>\r\n );\r\n })}\r\n </ul>\r\n </ReactErrorSummary>\r\n );\r\n}\r\n"],"names":["e","Set","n","WeakMap","l","t","o","a","i","HTMLElement","prototype","removeAttribute","get","set","Map","handleEvent","addEventListener","removeEventListener","_ref","react","tagName","elementClass","events","displayName","s","Object","keys","c","forwardRef","r","useRef","d","u","v","_i","_Object$entries","entries","length","_Object$entries$_i","_slicedToArray","has","useLayoutEffect","current","suppressHydrationWarning","createElement","_objectSpread","ref","name","globalThis","window","undefined","customElements","assign","ReactErrorSummary","createComponent","ErrorSummary","React","FormErrorKey","FINAL_FORM_ERROR","BdsErrorSummary","className","errors","_ref$mapNameToId","mapNameToId","props","_objectWithoutProperties","_excluded","headingId","useId","groupRef","useEffect","focus","_extends","filter","x","join","role","tabIndex","id","xmlns","viewBox","height","width","fill","map","errorKey","message","isFormError","includes","key","dangerouslySetInnerHTML","__html","isArrayField","Array","isArray","messages","Fragment","fieldMessage","index","inputId","concat","href"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiGA,IAAMA,CAAA,GAA0B,IAAIC,GAAA,CAAI,CACtC,UAAA,EACA,WACA,EAAA,KAAA,EACA,OACA,EAAA,WAAA,CAAA,CAAA;EAGIC,CAAA,GAGF,IAAIC,OAAA,EAAA;EAsCFC,CAAA,GAAc,SAAAA,CAAAA,CAClBJ,CAAA,EACAI,EAAA,EACAC,CAAA,EACAC,CAAA,EACAC,CAAA,EAAA;AAEA,IAAA,IAAMC,CAAA,GAAQ,IAAA,IAAAD,CAAA,GAAAA,KAAAA,CAAAA,GAAAA,CAAA,CAASH,EAAA,CAAA,CAAA;AAAA,IAAA,KAET,CAAVI,KAAAA,CAAA,IAAuBH,CAAA,KAAUC,CAAA,IAKrCN,CAAA,CAAKI,EAAA,CAAA,GAAmBC,CAAA,EAWtB,QAACA,CAAA,IACDD,EAAA,IAAQK,WAAA,CAAYC,SAAA,IAEpBV,CAAA,CAAKW,eAAA,CAAgBP,EAAA,KA1DQ,UAC/BJ,CAAA,EACAI,CAAA,EACAC,CAAA,EAAA;AAEA,MAAA,IAAIC,CAAA,GAASJ,CAAA,CAAeU,GAAA,CAAIZ,CAAA,CAAA,CAAA;AAAA,MAAA,KACjB,CAAXM,KAAAA,CAAA,IACFJ,CAAA,CAAeW,GAAA,CAAIb,CAAA,EAAOM,CAAA,GAAS,IAAIQ,GAAA,EAAA,CAAA,CAAA;AAEzC,MAAA,IAAIP,CAAA,GAAUD,CAAA,CAAOM,GAAA,CAAIR,CA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,SAAA;AAAE,OAAE,CAAC,CAAA;AAC5E,KAAA;AAEA,IAAA,IAAMM,YAAY,GAAGC,KAAK,CAACC,OAAO,CAACR,OAAO,CAAC,CAAA;IAE3C,IAAMS,QAAQ,GAAGH,YAAY,GAAGN,OAAO,GAAG,CAACA,OAAO,CAAC,CAAA;AAEnD,IAAA,oBACE9B,gBAAA,CAAAZ,aAAA,CAACY,gBAAK,CAACwC,QAAQ,EAAA;AAACP,MAAAA,GAAG,EAAEJ,QAAAA;KAClBU,EAAAA,QAAQ,CAACX,GAAG,CAAC,UAACa,YAAY,EAAEC,KAAK,EAAK;AACrC,MAAA,IAAMC,OAAO,GAAAC,EAAAA,CAAAA,MAAA,CAAMrC,WAAW,CAACsB,QAAQ,CAAC,CAAA,CAAAe,MAAA,CAAGR,YAAY,GAAAQ,GAAAA,CAAAA,MAAA,CAAOF,KAAK,EAAA,GAAA,CAAA,GAAM,EAAE,CAAE,CAAA;MAE7E,oBACE1C,gBAAA,CAAAZ,aAAA,CAAA,IAAA,EAAA;AAAI6C,QAAAA,GAAG,EAAEU,OAAAA;OACP3C,eAAAA,gBAAA,CAAAZ,aAAA,CAAA,GAAA,EAAA;QAAGyD,IAAI,EAAA,GAAA,CAAAD,MAAA,CAAMD,OAAO,CAAA;OACjBF,EAAAA,YAAY,EACZF,QAAQ,CAAC1D,MAAM,GAAG,CAAC,GAAA+D,IAAAA,CAAAA,MAAA,CAAQF,KAAK,GAAG,CAAC,EAAA,MAAA,CAAA,CAAAE,MAAA,CAAOL,QAAQ,CAAC1D,MAAM,EAAA,GAAA,CAAA,GAAMa,SAChE,CACD,CAAC,CAAA;AAET,KAAC,CACa,CAAC,CAAA;GAEpB,CACC,CACa,CAAC,CAAA;AAExB;;;;;","x_google_ignoreList":[0]}
@@ -1,5 +1,5 @@
1
- import ErrorSummary from '@iabbb/bds/ErrorSummary';
2
- import { HTMLElement } from '@lit-labs/ssr-dom-shim';
1
+ import ErrorSummary from '@iabbb/bds/ErrorSummary/index.mjs';
2
+ import { customElements, HTMLElement as HTMLElement$1 } from '@lit-labs/ssr-dom-shim';
3
3
  import * as React from 'react';
4
4
 
5
5
  function _iterableToArrayLimit(r, l) {
@@ -196,6 +196,14 @@ var e = new Set(["children", "localName", "ref", "style", "className"]),
196
196
  };
197
197
 
198
198
  var _excluded = ["className", "errors", "mapNameToId"];
199
+ if (globalThis.window === undefined) {
200
+ var window = {
201
+ customElements: customElements,
202
+ HTMLElement: HTMLElement$1
203
+ };
204
+ // Copy initial window globals to node global
205
+ Object.assign(globalThis, window);
206
+ }
199
207
  var ReactErrorSummary = t({
200
208
  tagName: 'bds-error-summary',
201
209
  elementClass: ErrorSummary,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/ErrorSummary/ErrorSummary.tsx"],"sourcesContent":["// https://github.com/IABBB/bds/blob/19862b9c179f6cc650d2973a83cce5ab3516fc99/packages/react/src/ErrorSummary/ErrorSummary.js\r\n// todo - exports?\r\nimport ErrorSummary from '@iabbb/bds/ErrorSummary';\r\nimport { createComponent } from '@lit-labs/react';\r\nimport * as React from 'react';\r\n\r\nconst ReactErrorSummary = createComponent({\r\n tagName: 'bds-error-summary',\r\n elementClass: ErrorSummary,\r\n react: React,\r\n});\r\n\r\ndeclare global {\r\n namespace JSX {\r\n interface IntrinsicElements {\r\n 'bds-error-summary': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;\r\n }\r\n }\r\n}\r\n\r\nexport const FormErrorKey = '_form';\r\n\r\nconst FINAL_FORM_ERROR = 'FINAL_FORM/form-error';\r\n\r\nexport type ErrorSummaryProps = {\r\n errors: Record<string, Array<string> | string> | null;\r\n mapNameToId?: (name: string) => string;\r\n};\r\n\r\nexport default function BdsErrorSummary({\r\n className,\r\n errors,\r\n mapNameToId = (name) => name,\r\n ...props\r\n}: ErrorSummaryProps & React.ComponentPropsWithoutRef<'div'>) {\r\n const headingId = React.useId();\r\n const groupRef = React.useRef<HTMLElement>(null);\r\n\r\n React.useEffect(() => {\r\n if (!errors || Object.keys(errors).length === 0) return;\r\n if (!groupRef.current) return;\r\n\r\n groupRef.current.focus();\r\n }, [errors]);\r\n\r\n if (!errors || Object.keys(errors).length === 0) return null;\r\n\r\n return (\r\n <ReactErrorSummary\r\n className={['stack', className].filter((x) => x).join(' ')}\r\n role=\"group\"\r\n aria-labelledby={headingId}\r\n ref={groupRef}\r\n tabIndex={-1}\r\n {...props}\r\n >\r\n <h2 className=\"bds-h5\" id={headingId}>\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 512 512\"\r\n aria-hidden=\"true\"\r\n height=\"1em\"\r\n width=\"1em\"\r\n fill=\"currentColor\"\r\n >\r\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\" />\r\n </svg>\r\n Issue\r\n </h2>\r\n <ul>\r\n {Object.keys(errors).map((errorKey) => {\r\n const message = errors[errorKey];\r\n const isFormError = [FINAL_FORM_ERROR, FormErrorKey].includes(errorKey);\r\n\r\n if (isFormError) {\r\n return <li key={errorKey} dangerouslySetInnerHTML={{ __html: message }} />;\r\n }\r\n\r\n const isArrayField = Array.isArray(message);\r\n\r\n const messages = isArrayField ? message : [message];\r\n\r\n return (\r\n <React.Fragment key={errorKey}>\r\n {messages.map((fieldMessage, index) => {\r\n const inputId = `${mapNameToId(errorKey)}${isArrayField ? `[${index}]` : ''}`;\r\n\r\n return (\r\n <li key={inputId}>\r\n <a href={`#${inputId}`}>\r\n {fieldMessage}\r\n {messages.length > 1 ? ` (${index + 1} of ${messages.length})` : undefined}\r\n </a>\r\n </li>\r\n );\r\n })}\r\n </React.Fragment>\r\n );\r\n })}\r\n </ul>\r\n </ReactErrorSummary>\r\n );\r\n}\r\n"],"names":["ReactErrorSummary","createComponent","tagName","elementClass","ErrorSummary","react","React","FormErrorKey","FINAL_FORM_ERROR","BdsErrorSummary","_ref","className","errors","_ref$mapNameToId","mapNameToId","name","props","_objectWithoutProperties","_excluded","headingId","useId","groupRef","useRef","useEffect","Object","keys","length","current","focus","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","inputId","concat","href","undefined"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,IAAMA,iBAAiB,GAAGC,CAAe,CAAC;AACxCC,EAAAA,OAAO,EAAE,mBAAmB;AAC5BC,EAAAA,YAAY,EAAEC,YAAY;AAC1BC,EAAAA,KAAK,EAAEC,KAAAA;AACT,CAAC,CAAC,CAAA;AAUK,IAAMC,YAAY,GAAG,QAAO;AAEnC,IAAMC,gBAAgB,GAAG,uBAAuB,CAAA;AAOjC,SAASC,eAAeA,CAAAC,IAAA,EAKuB;AAAA,EAAA,IAJ5DC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,MAAM,GAAAF,IAAA,CAANE,MAAM;IAAAC,gBAAA,GAAAH,IAAA,CACNI,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,UAACE,IAAI,EAAA;AAAA,MAAA,OAAKA,IAAI,CAAA;AAAA,KAAA,GAA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AC,EAAAA,CAAAA,MAAA,CAAM9C,WAAW,CAAC+B,QAAQ,CAAC,CAAA,CAAAe,MAAA,CAAGR,YAAY,GAAAQ,GAAAA,CAAAA,MAAA,CAAOF,KAAK,EAAA,GAAA,CAAA,GAAM,EAAE,CAAE,CAAA;MAE7E,oBACEpD,KAAA,CAAAuB,aAAA,CAAA,IAAA,EAAA;AAAIoB,QAAAA,GAAG,EAAEU,OAAAA;OACPrD,eAAAA,KAAA,CAAAuB,aAAA,CAAA,GAAA,EAAA;QAAGgC,IAAI,EAAA,GAAA,CAAAD,MAAA,CAAMD,OAAO,CAAA;OACjBF,EAAAA,YAAY,EACZF,QAAQ,CAAC7B,MAAM,GAAG,CAAC,GAAAkC,IAAAA,CAAAA,MAAA,CAAQF,KAAK,GAAG,CAAC,EAAA,MAAA,CAAA,CAAAE,MAAA,CAAOL,QAAQ,CAAC7B,MAAM,EAAA,GAAA,CAAA,GAAMoC,SAChE,CACD,CAAC,CAAA;AAET,KAAC,CACa,CAAC,CAAA;GAEpB,CACC,CACa,CAAC,CAAA;AAExB;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../../.yarn/__virtual__/@lit-labs-react-virtual-4509891a2a/0/cache/@lit-labs-react-npm-2.0.0-0a425990f1-28737941de.zip/node_modules/@lit-labs/react/create-component.js","../../src/ErrorSummary/ErrorSummary.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst e=new Set([\"children\",\"localName\",\"ref\",\"style\",\"className\"]),n=new WeakMap,l=(e,l,t,o,a)=>{const i=null==a?void 0:a[l];void 0===i||t===o?(e[l]=t,null==t&&l in HTMLElement.prototype&&e.removeAttribute(l)):((e,l,t)=>{let o=n.get(e);void 0===o&&n.set(e,o=new Map);let a=o.get(l);void 0!==t?void 0===a?(o.set(l,a={handleEvent:t}),e.addEventListener(l,a)):a.handleEvent=t:void 0!==a&&(o.delete(l),e.removeEventListener(l,a))})(e,i,t)},t=({react:n,tagName:t,elementClass:o,events:a,displayName:i})=>{const s=new Set(Object.keys(null!=a?a:{})),c=n.forwardRef(((i,c)=>{const r=n.useRef(null),d=n.useRef(null),u={},v={};for(const[n,l]of Object.entries(i))e.has(n)?u[\"className\"===n?\"class\":n]=l:s.has(n)||n in o.prototype?v[n]=l:u[n]=l;return n.useLayoutEffect((()=>{if(null!==d.current){for(const e in v)l(d.current,e,i[e],r.current?r.current[e]:void 0,a);r.current=i}})),n.useLayoutEffect((()=>{var e;null===(e=d.current)||void 0===e||e.removeAttribute(\"defer-hydration\")}),[]),u.suppressHydrationWarning=!0,n.createElement(t,{...u,ref:e=>{d.current=e,\"function\"==typeof c?c(e):null!==c&&(c.current=e)}})}));return c.displayName=null!=i?i:o.name,c};export{t as createComponent};\n//# sourceMappingURL=create-component.js.map\n","import ErrorSummary from '@iabbb/bds/ErrorSummary';\r\nimport { createComponent } from '@lit-labs/react';\r\nimport { customElements, HTMLElement } from '@lit-labs/ssr-dom-shim';\r\nimport * as React from 'react';\r\n\r\nif (globalThis.window === undefined) {\r\n const window = { customElements, HTMLElement };\r\n // Copy initial window globals to node global\r\n Object.assign(globalThis, window);\r\n}\r\n\r\nconst ReactErrorSummary = createComponent({\r\n tagName: 'bds-error-summary',\r\n elementClass: ErrorSummary,\r\n react: React,\r\n});\r\n\r\ndeclare global {\r\n namespace JSX {\r\n interface IntrinsicElements {\r\n 'bds-error-summary': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;\r\n }\r\n }\r\n}\r\n\r\nexport const FormErrorKey = '_form';\r\n\r\nconst FINAL_FORM_ERROR = 'FINAL_FORM/form-error';\r\n\r\nexport type ErrorSummaryProps = {\r\n errors: Record<string, Array<string> | string> | null;\r\n mapNameToId?: (name: string) => string;\r\n};\r\n\r\nexport default function BdsErrorSummary({\r\n className,\r\n errors,\r\n mapNameToId = (name) => name,\r\n ...props\r\n}: ErrorSummaryProps & React.ComponentPropsWithoutRef<'div'>) {\r\n const headingId = React.useId();\r\n const groupRef = React.useRef<HTMLElement>(null);\r\n\r\n React.useEffect(() => {\r\n if (!errors || Object.keys(errors).length === 0) return;\r\n if (!groupRef.current) return;\r\n\r\n groupRef.current.focus();\r\n }, [errors]);\r\n\r\n if (!errors || Object.keys(errors).length === 0) return null;\r\n\r\n return (\r\n <ReactErrorSummary\r\n className={['stack', className].filter((x) => x).join(' ')}\r\n role=\"group\"\r\n aria-labelledby={headingId}\r\n ref={groupRef}\r\n tabIndex={-1}\r\n {...props}\r\n >\r\n <h2 className=\"bds-h5\" id={headingId}>\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 512 512\"\r\n aria-hidden=\"true\"\r\n height=\"1em\"\r\n width=\"1em\"\r\n fill=\"currentColor\"\r\n >\r\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\" />\r\n </svg>\r\n Issue\r\n </h2>\r\n <ul>\r\n {Object.keys(errors).map((errorKey) => {\r\n const message = errors[errorKey];\r\n const isFormError = [FINAL_FORM_ERROR, FormErrorKey].includes(errorKey);\r\n\r\n if (isFormError) {\r\n return <li key={errorKey} dangerouslySetInnerHTML={{ __html: message }} />;\r\n }\r\n\r\n const isArrayField = Array.isArray(message);\r\n\r\n const messages = isArrayField ? message : [message];\r\n\r\n return (\r\n <React.Fragment key={errorKey}>\r\n {messages.map((fieldMessage, index) => {\r\n const inputId = `${mapNameToId(errorKey)}${isArrayField ? `[${index}]` : ''}`;\r\n\r\n return (\r\n <li key={inputId}>\r\n <a href={`#${inputId}`}>\r\n {fieldMessage}\r\n {messages.length > 1 ? ` (${index + 1} of ${messages.length})` : undefined}\r\n </a>\r\n </li>\r\n );\r\n })}\r\n </React.Fragment>\r\n );\r\n })}\r\n </ul>\r\n </ReactErrorSummary>\r\n );\r\n}\r\n"],"names":["e","Set","n","WeakMap","l","t","o","a","i","HTMLElement","prototype","removeAttribute","get","set","Map","handleEvent","addEventListener","removeEventListener","_ref","react","tagName","elementClass","events","displayName","s","Object","keys","c","forwardRef","r","useRef","d","u","v","_i","_Object$entries","entries","length","_Object$entries$_i","_slicedToArray","has","useLayoutEffect","current","suppressHydrationWarning","createElement","_objectSpread","ref","name","globalThis","window","undefined","customElements","assign","ReactErrorSummary","createComponent","ErrorSummary","React","FormErrorKey","FINAL_FORM_ERROR","BdsErrorSummary","className","errors","_ref$mapNameToId","mapNameToId","props","_objectWithoutProperties","_excluded","headingId","useId","groupRef","useEffect","focus","_extends","filter","x","join","role","tabIndex","id","xmlns","viewBox","height","width","fill","map","errorKey","message","isFormError","includes","key","dangerouslySetInnerHTML","__html","isArrayField","Array","isArray","messages","Fragment","fieldMessage","index","inputId","concat","href"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiGA,IAAMA,CAAA,GAA0B,IAAIC,GAAA,CAAI,CACtC,UAAA,EACA,WACA,EAAA,KAAA,EACA,OACA,EAAA,WAAA,CAAA,CAAA;EAGIC,CAAA,GAGF,IAAIC,OAAA,EAAA;EAsCFC,CAAA,GAAc,SAAAA,CAAAA,CAClBJ,CAAA,EACAI,EAAA,EACAC,CAAA,EACAC,CAAA,EACAC,CAAA,EAAA;AAEA,IAAA,IAAMC,CAAA,GAAQ,IAAA,IAAAD,CAAA,GAAAA,KAAAA,CAAAA,GAAAA,CAAA,CAASH,EA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CAAAZ,aAAA,CAAA,GAAA,EAAA;QAAGyD,IAAI,EAAA,GAAA,CAAAD,MAAA,CAAMD,OAAO,CAAA;OACjBF,EAAAA,YAAY,EACZF,QAAQ,CAAC1D,MAAM,GAAG,CAAC,GAAA+D,IAAAA,CAAAA,MAAA,CAAQF,KAAK,GAAG,CAAC,EAAA,MAAA,CAAA,CAAAE,MAAA,CAAOL,QAAQ,CAAC1D,MAAM,EAAA,GAAA,CAAA,GAAMa,SAChE,CACD,CAAC,CAAA;AAET,KAAC,CACa,CAAC,CAAA;GAEpB,CACC,CACa,CAAC,CAAA;AAExB;;;;","x_google_ignoreList":[0]}
package/index.cjs CHANGED
@@ -70,6 +70,28 @@ function _objectSpread2(e) {
70
70
  }
71
71
  return e;
72
72
  }
73
+ function _classCallCheck(instance, Constructor) {
74
+ if (!(instance instanceof Constructor)) {
75
+ throw new TypeError("Cannot call a class as a function");
76
+ }
77
+ }
78
+ function _defineProperties(target, props) {
79
+ for (var i = 0; i < props.length; i++) {
80
+ var descriptor = props[i];
81
+ descriptor.enumerable = descriptor.enumerable || false;
82
+ descriptor.configurable = true;
83
+ if ("value" in descriptor) descriptor.writable = true;
84
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
85
+ }
86
+ }
87
+ function _createClass(Constructor, protoProps, staticProps) {
88
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
89
+ if (staticProps) _defineProperties(Constructor, staticProps);
90
+ Object.defineProperty(Constructor, "prototype", {
91
+ writable: false
92
+ });
93
+ return Constructor;
94
+ }
73
95
  function _defineProperty(obj, key, value) {
74
96
  key = _toPropertyKey(key);
75
97
  if (key in obj) {
@@ -98,6 +120,46 @@ function _extends() {
98
120
  };
99
121
  return _extends.apply(this, arguments);
100
122
  }
123
+ function _inherits(subClass, superClass) {
124
+ if (typeof superClass !== "function" && superClass !== null) {
125
+ throw new TypeError("Super expression must either be null or a function");
126
+ }
127
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
128
+ constructor: {
129
+ value: subClass,
130
+ writable: true,
131
+ configurable: true
132
+ }
133
+ });
134
+ Object.defineProperty(subClass, "prototype", {
135
+ writable: false
136
+ });
137
+ if (superClass) _setPrototypeOf(subClass, superClass);
138
+ }
139
+ function _getPrototypeOf(o) {
140
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
141
+ return o.__proto__ || Object.getPrototypeOf(o);
142
+ };
143
+ return _getPrototypeOf(o);
144
+ }
145
+ function _setPrototypeOf(o, p) {
146
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
147
+ o.__proto__ = p;
148
+ return o;
149
+ };
150
+ return _setPrototypeOf(o, p);
151
+ }
152
+ function _isNativeReflectConstruct() {
153
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
154
+ if (Reflect.construct.sham) return false;
155
+ if (typeof Proxy === "function") return true;
156
+ try {
157
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
158
+ return true;
159
+ } catch (e) {
160
+ return false;
161
+ }
162
+ }
101
163
  function _objectWithoutPropertiesLoose(source, excluded) {
102
164
  if (source == null) return {};
103
165
  var target = {};
@@ -125,6 +187,34 @@ function _objectWithoutProperties(source, excluded) {
125
187
  }
126
188
  return target;
127
189
  }
190
+ function _assertThisInitialized(self) {
191
+ if (self === void 0) {
192
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
193
+ }
194
+ return self;
195
+ }
196
+ function _possibleConstructorReturn(self, call) {
197
+ if (call && (typeof call === "object" || typeof call === "function")) {
198
+ return call;
199
+ } else if (call !== void 0) {
200
+ throw new TypeError("Derived constructors may only return object or undefined");
201
+ }
202
+ return _assertThisInitialized(self);
203
+ }
204
+ function _createSuper(Derived) {
205
+ var hasNativeReflectConstruct = _isNativeReflectConstruct();
206
+ return function _createSuperInternal() {
207
+ var Super = _getPrototypeOf(Derived),
208
+ result;
209
+ if (hasNativeReflectConstruct) {
210
+ var NewTarget = _getPrototypeOf(this).constructor;
211
+ result = Reflect.construct(Super, arguments, NewTarget);
212
+ } else {
213
+ result = Super.apply(this, arguments);
214
+ }
215
+ return _possibleConstructorReturn(this, result);
216
+ };
217
+ }
128
218
  function _slicedToArray(arr, i) {
129
219
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
130
220
  }
@@ -291,7 +381,248 @@ var e = new Set(["children", "localName", "ref", "style", "className"]),
291
381
  return c.displayName = null != i ? i : o.name, c;
292
382
  };
293
383
 
384
+ // Shim the global element internals object
385
+ // Methods should be fine as noops and properties can generally
386
+ // be while on the server.
387
+ var ElementInternalsShim = /*#__PURE__*/function () {
388
+ function ElementInternals(_host) {
389
+ _classCallCheck(this, ElementInternals);
390
+ this.ariaAtomic = '';
391
+ this.ariaAutoComplete = '';
392
+ this.ariaBraileLabel = '';
393
+ this.ariaBraileRoleDescription = '';
394
+ this.ariaBusy = '';
395
+ this.ariaChecked = '';
396
+ this.ariaColCount = '';
397
+ this.ariaColIndex = '';
398
+ this.ariaColSpan = '';
399
+ this.ariaCurrent = '';
400
+ this.ariaDescription = '';
401
+ this.ariaDisabled = '';
402
+ this.ariaExpanded = '';
403
+ this.ariaHasPopup = '';
404
+ this.ariaHidden = '';
405
+ this.ariaInvalid = '';
406
+ this.ariaKeyShortcuts = '';
407
+ this.ariaLabel = '';
408
+ this.ariaLevel = '';
409
+ this.ariaLive = '';
410
+ this.ariaModal = '';
411
+ this.ariaMultiLine = '';
412
+ this.ariaMultiSelectable = '';
413
+ this.ariaOrientation = '';
414
+ this.ariaPlaceholder = '';
415
+ this.ariaPosInSet = '';
416
+ this.ariaPressed = '';
417
+ this.ariaReadOnly = '';
418
+ this.ariaRequired = '';
419
+ this.ariaRoleDescription = '';
420
+ this.ariaRowCount = '';
421
+ this.ariaRowIndex = '';
422
+ this.ariaRowSpan = '';
423
+ this.ariaSelected = '';
424
+ this.ariaSetSize = '';
425
+ this.ariaSort = '';
426
+ this.ariaValueMax = '';
427
+ this.ariaValueMin = '';
428
+ this.ariaValueNow = '';
429
+ this.ariaValueText = '';
430
+ this.role = '';
431
+ this.form = null;
432
+ this.labels = [];
433
+ this.states = new Set();
434
+ this.validationMessage = '';
435
+ this.validity = {};
436
+ this.willValidate = true;
437
+ this.__host = _host;
438
+ }
439
+ _createClass(ElementInternals, [{
440
+ key: "shadowRoot",
441
+ get: function get() {
442
+ // Grab the shadow root instance from the Element shim
443
+ // to ensure that the shadow root is always available
444
+ // to the internals instance even if the mode is 'closed'
445
+ return this.__host.__shadowRoot;
446
+ }
447
+ }, {
448
+ key: "checkValidity",
449
+ value: function checkValidity() {
450
+ // TODO(augustjk) Consider actually implementing logic.
451
+ // See https://github.com/lit/lit/issues/3740
452
+ console.warn('`ElementInternals.checkValidity()` was called on the server.' + 'This method always returns true.');
453
+ return true;
454
+ }
455
+ }, {
456
+ key: "reportValidity",
457
+ value: function reportValidity() {
458
+ return true;
459
+ }
460
+ }, {
461
+ key: "setFormValue",
462
+ value: function setFormValue() {}
463
+ }, {
464
+ key: "setValidity",
465
+ value: function setValidity() {}
466
+ }]);
467
+ return ElementInternals;
468
+ }();
469
+
470
+ var attributes = new WeakMap();
471
+ var attributesForElement = function attributesForElement(element) {
472
+ var attrs = attributes.get(element);
473
+ if (attrs === undefined) {
474
+ attributes.set(element, attrs = new Map());
475
+ }
476
+ return attrs;
477
+ };
478
+ // The typings around the exports below are a little funky:
479
+ //
480
+ // 1. We want the `name` of the shim classes to match the real ones at runtime,
481
+ // hence e.g. `class Element`.
482
+ // 2. We can't shadow the global types with a simple class declaration, because
483
+ // then we can't reference the global types for casting, hence e.g.
484
+ // `const ElementShim = class Element`.
485
+ // 3. We want to export the classes typed as the real ones, hence e.g.
486
+ // `const ElementShimWithRealType = ElementShim as object as typeof Element;`.
487
+ // 4. We want the exported names to match the real ones, hence e.g.
488
+ // `export {ElementShimWithRealType as Element}`.
489
+ var ElementShim = /*#__PURE__*/function () {
490
+ function Element() {
491
+ _classCallCheck(this, Element);
492
+ this.__shadowRootMode = null;
493
+ this.__shadowRoot = null;
494
+ this.__internals = null;
495
+ }
496
+ _createClass(Element, [{
497
+ key: "attributes",
498
+ get: function get() {
499
+ return Array.from(attributesForElement(this)).map(function (_ref) {
500
+ var _ref2 = _slicedToArray(_ref, 2),
501
+ name = _ref2[0],
502
+ value = _ref2[1];
503
+ return {
504
+ name: name,
505
+ value: value
506
+ };
507
+ });
508
+ }
509
+ }, {
510
+ key: "shadowRoot",
511
+ get: function get() {
512
+ if (this.__shadowRootMode === 'closed') {
513
+ return null;
514
+ }
515
+ return this.__shadowRoot;
516
+ }
517
+ }, {
518
+ key: "setAttribute",
519
+ value: function setAttribute(name, value) {
520
+ // Emulate browser behavior that silently casts all values to string. E.g.
521
+ // `42` becomes `"42"` and `{}` becomes `"[object Object]""`.
522
+ attributesForElement(this).set(name, String(value));
523
+ }
524
+ }, {
525
+ key: "removeAttribute",
526
+ value: function removeAttribute(name) {
527
+ attributesForElement(this)["delete"](name);
528
+ }
529
+ }, {
530
+ key: "hasAttribute",
531
+ value: function hasAttribute(name) {
532
+ return attributesForElement(this).has(name);
533
+ }
534
+ }, {
535
+ key: "attachShadow",
536
+ value: function attachShadow(init) {
537
+ var shadowRoot = {
538
+ host: this
539
+ };
540
+ this.__shadowRootMode = init.mode;
541
+ if (init && init.mode === 'open') {
542
+ this.__shadowRoot = shadowRoot;
543
+ }
544
+ return shadowRoot;
545
+ }
546
+ }, {
547
+ key: "attachInternals",
548
+ value: function attachInternals() {
549
+ if (this.__internals !== null) {
550
+ throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': " + "ElementInternals for the specified element was already attached.");
551
+ }
552
+ var internals = new ElementInternalsShim(this);
553
+ this.__internals = internals;
554
+ return internals;
555
+ }
556
+ }, {
557
+ key: "getAttribute",
558
+ value: function getAttribute(name) {
559
+ var value = attributesForElement(this).get(name);
560
+ return value !== null && value !== void 0 ? value : null;
561
+ }
562
+ }]);
563
+ return Element;
564
+ }();
565
+ var HTMLElementShim = /*#__PURE__*/function (_ElementShim) {
566
+ _inherits(HTMLElement, _ElementShim);
567
+ var _super = _createSuper(HTMLElement);
568
+ function HTMLElement() {
569
+ _classCallCheck(this, HTMLElement);
570
+ return _super.apply(this, arguments);
571
+ }
572
+ return _createClass(HTMLElement);
573
+ }(ElementShim);
574
+ var HTMLElementShimWithRealType = HTMLElementShim;
575
+ var CustomElementRegistryShim = /*#__PURE__*/function () {
576
+ function CustomElementRegistry() {
577
+ _classCallCheck(this, CustomElementRegistry);
578
+ this.__definitions = new Map();
579
+ }
580
+ _createClass(CustomElementRegistry, [{
581
+ key: "define",
582
+ value: function define(name, ctor) {
583
+ var _ctor$observedAttribu;
584
+ if (this.__definitions.has(name)) {
585
+ if (process.env.NODE_ENV === 'development') {
586
+ console.warn("'CustomElementRegistry' already has \"".concat(name, "\" defined. ") + "This may have been caused by live reload or hot module " + "replacement in which case it can be safely ignored.\n" + "Make sure to test your application with a production build as " + "repeat registrations will throw in production.");
587
+ } else {
588
+ throw new Error("Failed to execute 'define' on 'CustomElementRegistry': " + "the name \"".concat(name, "\" has already been used with this registry"));
589
+ }
590
+ }
591
+ this.__definitions.set(name, {
592
+ ctor: ctor,
593
+ // Note it's important we read `observedAttributes` in case it is a getter
594
+ // with side-effects, as is the case in Lit, where it triggers class
595
+ // finalization.
596
+ //
597
+ // TODO(aomarks) To be spec compliant, we should also capture the
598
+ // registration-time lifecycle methods like `connectedCallback`. For them
599
+ // to be actually accessible to e.g. the Lit SSR element renderer, though,
600
+ // we'd need to introduce a new API for accessing them (since `get` only
601
+ // returns the constructor).
602
+ observedAttributes: (_ctor$observedAttribu = ctor.observedAttributes) !== null && _ctor$observedAttribu !== void 0 ? _ctor$observedAttribu : []
603
+ });
604
+ }
605
+ }, {
606
+ key: "get",
607
+ value: function get(name) {
608
+ var definition = this.__definitions.get(name);
609
+ return definition === null || definition === void 0 ? void 0 : definition.ctor;
610
+ }
611
+ }]);
612
+ return CustomElementRegistry;
613
+ }();
614
+ var CustomElementRegistryShimWithRealType = CustomElementRegistryShim;
615
+ var customElements = new CustomElementRegistryShimWithRealType();
616
+
294
617
  var _excluded$3 = ["className", "errors", "mapNameToId"];
618
+ if (globalThis.window === undefined) {
619
+ var window = {
620
+ customElements: customElements,
621
+ HTMLElement: HTMLElementShimWithRealType
622
+ };
623
+ // Copy initial window globals to node global
624
+ Object.assign(globalThis, window);
625
+ }
295
626
  var ReactErrorSummary = t({
296
627
  tagName: 'bds-error-summary',
297
628
  elementClass: ErrorSummary,