@iabbb/bds-react 0.55.0 → 0.56.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Button/index.cjs +5 -4
- package/Button/index.cjs.map +1 -1
- package/Button/index.mjs +5 -4
- package/Button/index.mjs.map +1 -1
- package/CallToAction/index.cjs +4 -3
- package/CallToAction/index.cjs.map +1 -1
- package/CallToAction/index.mjs +4 -3
- package/CallToAction/index.mjs.map +1 -1
- package/ErrorMessage/index.cjs +3 -3
- package/ErrorMessage/index.mjs +3 -3
- package/ErrorSummary/index.cjs +3 -3
- package/ErrorSummary/index.cjs.map +1 -1
- package/ErrorSummary/index.mjs +3 -3
- package/ErrorSummary/index.mjs.map +1 -1
- package/FieldCharacterCountdown/FieldCharacterCountdown.d.ts +1 -1
- package/FieldCharacterCountdown/index.cjs +7 -8
- package/FieldCharacterCountdown/index.cjs.map +1 -1
- package/FieldCharacterCountdown/index.mjs +7 -8
- package/FieldCharacterCountdown/index.mjs.map +1 -1
- package/FieldCheckbox/index.cjs +7 -6
- package/FieldCheckbox/index.cjs.map +1 -1
- package/FieldCheckbox/index.mjs +7 -6
- package/FieldCheckbox/index.mjs.map +1 -1
- package/FieldRadio/index.cjs +7 -6
- package/FieldRadio/index.cjs.map +1 -1
- package/FieldRadio/index.mjs +7 -6
- package/FieldRadio/index.mjs.map +1 -1
- package/FieldSelect/index.cjs +5 -5
- package/FieldSelect/index.cjs.map +1 -1
- package/FieldSelect/index.mjs +5 -5
- package/FieldSelect/index.mjs.map +1 -1
- package/FieldTextInput/FieldTextInput.d.ts +2 -2
- package/FieldTextInput/index.cjs +5 -5
- package/FieldTextInput/index.cjs.map +1 -1
- package/FieldTextInput/index.mjs +5 -5
- package/FieldTextInput/index.mjs.map +1 -1
- package/FieldTextarea/FieldTextarea.d.ts +1 -1
- package/FieldTextarea/index.cjs +4 -5
- package/FieldTextarea/index.cjs.map +1 -1
- package/FieldTextarea/index.mjs +4 -5
- package/FieldTextarea/index.mjs.map +1 -1
- package/Fieldset/index.cjs +3 -3
- package/Fieldset/index.mjs +3 -3
- package/Pagination/index.cjs +3 -3
- package/Pagination/index.mjs +3 -3
- package/Typography/index.cjs +3 -3
- package/Typography/index.cjs.map +1 -1
- package/Typography/index.mjs +3 -3
- package/Typography/index.mjs.map +1 -1
- package/index.cjs +8 -6
- package/index.cjs.map +1 -1
- package/index.mjs +8 -6
- package/index.mjs.map +1 -1
- package/package.json +10 -10
|
@@ -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","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;AA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3B,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,KAAA,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,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,IA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AAA,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,KAAA,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,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAK,IAAA,WAAA,EAAU,QAAQ;AAACN,IAAAA,SAAS,EAAC;AAAiB,GAAA,EAChDwE,kBAAkB,CAACnC,0BACjB,CACF,CAAC;AAEV;;;;"}
|
package/FieldCheckbox/index.cjs
CHANGED
|
@@ -48,12 +48,12 @@ function _iterableToArrayLimit(r, l) {
|
|
|
48
48
|
i,
|
|
49
49
|
u,
|
|
50
50
|
a = [],
|
|
51
|
-
f =
|
|
52
|
-
o =
|
|
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 =
|
|
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
|
|
77
|
-
for (r = 0; r <
|
|
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.
|
|
85
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
86
86
|
t[n] = r[n];
|
|
87
87
|
}
|
|
88
88
|
return t;
|
|
@@ -174,6 +174,7 @@ var FieldCheckbox = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref
|
|
|
174
174
|
htmlFor: inputId
|
|
175
175
|
}, label)));
|
|
176
176
|
});
|
|
177
|
+
FieldCheckbox.displayName = 'FieldCheckbox';
|
|
177
178
|
|
|
178
179
|
exports.default = FieldCheckbox;
|
|
179
180
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/FieldCheckbox/FieldCheckbox.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\nimport ErrorMessage from '../ErrorMessage';\n\nexport type FieldCheckboxProps = {\n error?: string;\n label: React.ReactNode | string;\n} & React.ComponentPropsWithoutRef<'input'>;\n\nconst FieldCheckbox = React.forwardRef<HTMLInputElement, FieldCheckboxProps>(\n ({ error, id, label, ...props }, ref) => {\n const [isEnhanced, setIsEnhanced] = React.useState(false);\n\n const fallbackId = React.useId();\n const errorId = React.useId();\n\n const inputId = id ?? fallbackId;\n\n React.useEffect(() => {\n setIsEnhanced(true);\n }, []);\n\n return (\n <div className=\"bds-form-group\">\n {error && <ErrorMessage id={errorId}>{error}</ErrorMessage>}\n <div className=\"bds-checkbox\" data-enhanced={isEnhanced ? '' : undefined}>\n <input\n {...props}\n aria-describedby={error ? errorId : undefined}\n aria-invalid={error ? true : undefined}\n id={inputId}\n ref={ref}\n type=\"checkbox\"\n />\n {isEnhanced && (\n <svg width=\"32\" height=\"32\" viewBox=\"0 0 32 32\" aria-hidden=\"true\" focusable=\"false\">\n <rect\n className=\"background\"\n width=\"31\"\n height=\"31\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeWidth=\"1\"\n x=\"0.5\"\n y=\"0.5\"\n vectorEffect=\"non-scaling-stroke\"\n />\n <path\n className=\"checkmark\"\n d=\"M 6 14 L 13 23 L 26 7\"\n stroke=\"#fff\"\n strokeDasharray=\"140\"\n strokeDashoffset=\"140\"\n />\n </svg>\n )}\n
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/FieldCheckbox/FieldCheckbox.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\nimport ErrorMessage from '../ErrorMessage';\n\nexport type FieldCheckboxProps = {\n error?: string;\n label: React.ReactNode | string;\n} & React.ComponentPropsWithoutRef<'input'>;\n\nconst FieldCheckbox = React.forwardRef<HTMLInputElement, FieldCheckboxProps>(\n ({ error, id, label, ...props }, ref) => {\n const [isEnhanced, setIsEnhanced] = React.useState(false);\n\n const fallbackId = React.useId();\n const errorId = React.useId();\n\n const inputId = id ?? fallbackId;\n\n React.useEffect(() => {\n setIsEnhanced(true);\n }, []);\n\n return (\n <div className=\"bds-form-group\">\n {error && <ErrorMessage id={errorId}>{error}</ErrorMessage>}\n <div className=\"bds-checkbox\" data-enhanced={isEnhanced ? '' : undefined}>\n <input\n {...props}\n aria-describedby={error ? errorId : undefined}\n aria-invalid={error ? true : undefined}\n id={inputId}\n ref={ref}\n type=\"checkbox\"\n />\n {isEnhanced && (\n <svg width=\"32\" height=\"32\" viewBox=\"0 0 32 32\" aria-hidden=\"true\" focusable=\"false\">\n <rect\n className=\"background\"\n width=\"31\"\n height=\"31\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeWidth=\"1\"\n x=\"0.5\"\n y=\"0.5\"\n vectorEffect=\"non-scaling-stroke\"\n />\n <path\n className=\"checkmark\"\n d=\"M 6 14 L 13 23 L 26 7\"\n stroke=\"#fff\"\n strokeDasharray=\"140\"\n strokeDashoffset=\"140\"\n />\n </svg>\n )}\n <label htmlFor={inputId}>{label}</label>\n </div>\n </div>\n );\n },\n);\n\nFieldCheckbox.displayName = 'FieldCheckbox';\n\nexport default FieldCheckbox;\n"],"names":["ErrorMessage","_ref","className","children","props","_objectWithoutProperties","_excluded","React","createElement","_extends","filter","x","join","xmlns","viewBox","height","width","fill","d","FieldCheckbox","forwardRef","ref","error","id","label","_React$useState","useState","_React$useState2","_slicedToArray","isEnhanced","setIsEnhanced","fallbackId","useId","errorId","inputId","useEffect","undefined","type","focusable","stroke","strokeWidth","y","vectorEffect","strokeDasharray","strokeDashoffset","htmlFor","displayName"],"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;IA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B,IAAAA,IAAI,EAAC,MAAM;AACXuB,IAAAA,WAAW,EAAC,GAAG;AACf7B,IAAAA,CAAC,EAAC,KAAK;AACP8B,IAAAA,CAAC,EAAC,KAAK;AACPC,IAAAA,YAAY,EAAC;AAAoB,GAClC,CAAC,eACFnC,gBAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AACEN,IAAAA,SAAS,EAAC,WAAW;AACrBgB,IAAAA,CAAC,EAAC,uBAAuB;AACzBqB,IAAAA,MAAM,EAAC,MAAM;AACbI,IAAAA,eAAe,EAAC,KAAK;AACrBC,IAAAA,gBAAgB,EAAC;AAAK,GACvB,CACE,CACN,eACDrC,gBAAA,CAAAC,aAAA,CAAA,OAAA,EAAA;AAAOqC,IAAAA,OAAO,EAAEX;GAAUV,EAAAA,KAAa,CACpC,CACF,CAAC;AAEV,CACF;AAEAL,aAAa,CAAC2B,WAAW,GAAG,eAAe;;;;"}
|
package/FieldCheckbox/index.mjs
CHANGED
|
@@ -25,12 +25,12 @@ function _iterableToArrayLimit(r, l) {
|
|
|
25
25
|
i,
|
|
26
26
|
u,
|
|
27
27
|
a = [],
|
|
28
|
-
f =
|
|
29
|
-
o =
|
|
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 =
|
|
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
|
|
54
|
-
for (r = 0; r <
|
|
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.
|
|
62
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
63
63
|
t[n] = r[n];
|
|
64
64
|
}
|
|
65
65
|
return t;
|
|
@@ -151,6 +151,7 @@ var FieldCheckbox = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
151
151
|
htmlFor: inputId
|
|
152
152
|
}, label)));
|
|
153
153
|
});
|
|
154
|
+
FieldCheckbox.displayName = 'FieldCheckbox';
|
|
154
155
|
|
|
155
156
|
export { FieldCheckbox as default };
|
|
156
157
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/FieldCheckbox/FieldCheckbox.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\nimport ErrorMessage from '../ErrorMessage';\n\nexport type FieldCheckboxProps = {\n error?: string;\n label: React.ReactNode | string;\n} & React.ComponentPropsWithoutRef<'input'>;\n\nconst FieldCheckbox = React.forwardRef<HTMLInputElement, FieldCheckboxProps>(\n ({ error, id, label, ...props }, ref) => {\n const [isEnhanced, setIsEnhanced] = React.useState(false);\n\n const fallbackId = React.useId();\n const errorId = React.useId();\n\n const inputId = id ?? fallbackId;\n\n React.useEffect(() => {\n setIsEnhanced(true);\n }, []);\n\n return (\n <div className=\"bds-form-group\">\n {error && <ErrorMessage id={errorId}>{error}</ErrorMessage>}\n <div className=\"bds-checkbox\" data-enhanced={isEnhanced ? '' : undefined}>\n <input\n {...props}\n aria-describedby={error ? errorId : undefined}\n aria-invalid={error ? true : undefined}\n id={inputId}\n ref={ref}\n type=\"checkbox\"\n />\n {isEnhanced && (\n <svg width=\"32\" height=\"32\" viewBox=\"0 0 32 32\" aria-hidden=\"true\" focusable=\"false\">\n <rect\n className=\"background\"\n width=\"31\"\n height=\"31\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeWidth=\"1\"\n x=\"0.5\"\n y=\"0.5\"\n vectorEffect=\"non-scaling-stroke\"\n />\n <path\n className=\"checkmark\"\n d=\"M 6 14 L 13 23 L 26 7\"\n stroke=\"#fff\"\n strokeDasharray=\"140\"\n strokeDashoffset=\"140\"\n />\n </svg>\n )}\n
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/FieldCheckbox/FieldCheckbox.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\nimport ErrorMessage from '../ErrorMessage';\n\nexport type FieldCheckboxProps = {\n error?: string;\n label: React.ReactNode | string;\n} & React.ComponentPropsWithoutRef<'input'>;\n\nconst FieldCheckbox = React.forwardRef<HTMLInputElement, FieldCheckboxProps>(\n ({ error, id, label, ...props }, ref) => {\n const [isEnhanced, setIsEnhanced] = React.useState(false);\n\n const fallbackId = React.useId();\n const errorId = React.useId();\n\n const inputId = id ?? fallbackId;\n\n React.useEffect(() => {\n setIsEnhanced(true);\n }, []);\n\n return (\n <div className=\"bds-form-group\">\n {error && <ErrorMessage id={errorId}>{error}</ErrorMessage>}\n <div className=\"bds-checkbox\" data-enhanced={isEnhanced ? '' : undefined}>\n <input\n {...props}\n aria-describedby={error ? errorId : undefined}\n aria-invalid={error ? true : undefined}\n id={inputId}\n ref={ref}\n type=\"checkbox\"\n />\n {isEnhanced && (\n <svg width=\"32\" height=\"32\" viewBox=\"0 0 32 32\" aria-hidden=\"true\" focusable=\"false\">\n <rect\n className=\"background\"\n width=\"31\"\n height=\"31\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeWidth=\"1\"\n x=\"0.5\"\n y=\"0.5\"\n vectorEffect=\"non-scaling-stroke\"\n />\n <path\n className=\"checkmark\"\n d=\"M 6 14 L 13 23 L 26 7\"\n stroke=\"#fff\"\n strokeDasharray=\"140\"\n strokeDashoffset=\"140\"\n />\n </svg>\n )}\n <label htmlFor={inputId}>{label}</label>\n </div>\n </div>\n );\n },\n);\n\nFieldCheckbox.displayName = 'FieldCheckbox';\n\nexport default FieldCheckbox;\n"],"names":["ErrorMessage","_ref","className","children","props","_objectWithoutProperties","_excluded","React","createElement","_extends","filter","x","join","xmlns","viewBox","height","width","fill","d","FieldCheckbox","forwardRef","ref","error","id","label","_React$useState","useState","_React$useState2","_slicedToArray","isEnhanced","setIsEnhanced","fallbackId","useId","errorId","inputId","useEffect","undefined","type","focusable","stroke","strokeWidth","y","vectorEffect","strokeDasharray","strokeDashoffset","htmlFor","displayName"],"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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gBAAgB,EAAC;AAAK,GACvB,CACE,CACN,eACDrC,KAAA,CAAAC,aAAA,CAAA,OAAA,EAAA;AAAOqC,IAAAA,OAAO,EAAEX;GAAUV,EAAAA,KAAa,CACpC,CACF,CAAC;AAEV,CACF;AAEAL,aAAa,CAAC2B,WAAW,GAAG,eAAe;;;;"}
|
package/FieldRadio/index.cjs
CHANGED
|
@@ -48,12 +48,12 @@ function _iterableToArrayLimit(r, l) {
|
|
|
48
48
|
i,
|
|
49
49
|
u,
|
|
50
50
|
a = [],
|
|
51
|
-
f =
|
|
52
|
-
o =
|
|
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 =
|
|
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
|
|
77
|
-
for (r = 0; r <
|
|
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.
|
|
85
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
86
86
|
t[n] = r[n];
|
|
87
87
|
}
|
|
88
88
|
return t;
|
|
@@ -146,6 +146,7 @@ var FieldRadio = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
|
146
146
|
htmlFor: inputId
|
|
147
147
|
}, label)));
|
|
148
148
|
});
|
|
149
|
+
FieldRadio.displayName = 'FieldRadio';
|
|
149
150
|
|
|
150
151
|
exports.default = FieldRadio;
|
|
151
152
|
//# sourceMappingURL=index.cjs.map
|
package/FieldRadio/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/FieldRadio/FieldRadio.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport type FieldRadioProps = {\n label: React.ReactNode | string;\n} & React.ComponentPropsWithoutRef<'input'>;\n\nconst FieldRadio = React.forwardRef<HTMLInputElement, FieldRadioProps>(({ id, label, ...props }, ref) => {\n const [isEnhanced, setIsEnhanced] = React.useState(false);\n\n const fallbackId = React.useId();\n\n const inputId = id ?? fallbackId;\n\n React.useEffect(() => {\n setIsEnhanced(true);\n }, []);\n\n return (\n <div className=\"bds-form-group\">\n <div className=\"bds-radio\" data-enhanced={isEnhanced ? '' : undefined}>\n <input {...props} id={inputId} ref={ref} type=\"radio\" />\n {isEnhanced && (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\">\n <circle\n className=\"background\"\n cx=\"12\"\n cy=\"12\"\n /* subtract half of the strokeWidth to get radius. credit: https://stackoverflow.com/questions/64149284/svg-stroke-width-changes-dimensions-of-the-object */\n r=\"11.5\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeWidth=\"1\"\n vectorEffect=\"non-scaling-stroke\"\n />\n {/* radius set through CSS when selected */}\n <circle className=\"radio\" cx=\"12\" cy=\"12\" fill=\"currentColor\" />\n </svg>\n )}\n
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/FieldRadio/FieldRadio.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport type FieldRadioProps = {\n label: React.ReactNode | string;\n} & React.ComponentPropsWithoutRef<'input'>;\n\nconst FieldRadio = React.forwardRef<HTMLInputElement, FieldRadioProps>(({ id, label, ...props }, ref) => {\n const [isEnhanced, setIsEnhanced] = React.useState(false);\n\n const fallbackId = React.useId();\n\n const inputId = id ?? fallbackId;\n\n React.useEffect(() => {\n setIsEnhanced(true);\n }, []);\n\n return (\n <div className=\"bds-form-group\">\n <div className=\"bds-radio\" data-enhanced={isEnhanced ? '' : undefined}>\n <input {...props} id={inputId} ref={ref} type=\"radio\" />\n {isEnhanced && (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\">\n <circle\n className=\"background\"\n cx=\"12\"\n cy=\"12\"\n /* subtract half of the strokeWidth to get radius. credit: https://stackoverflow.com/questions/64149284/svg-stroke-width-changes-dimensions-of-the-object */\n r=\"11.5\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeWidth=\"1\"\n vectorEffect=\"non-scaling-stroke\"\n />\n {/* radius set through CSS when selected */}\n <circle className=\"radio\" cx=\"12\" cy=\"12\" fill=\"currentColor\" />\n </svg>\n )}\n <label htmlFor={inputId}>{label}</label>\n </div>\n </div>\n );\n});\n\nFieldRadio.displayName = 'FieldRadio';\n\nexport default FieldRadio;\n"],"names":["FieldRadio","React","forwardRef","_ref","ref","id","label","props","_objectWithoutProperties","_excluded","_React$useState","useState","_React$useState2","_slicedToArray","isEnhanced","setIsEnhanced","fallbackId","useId","inputId","useEffect","createElement","className","undefined","_extends","type","width","height","viewBox","focusable","cx","cy","r","stroke","fill","strokeWidth","vectorEffect","htmlFor","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMMA,IAAAA,UAAU,gBAAGC,gBAAK,CAACC,UAAU,CAAoC,UAAAC,IAAA,EAA0BC,G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AC,WAAW;AAAC,IAAA,aAAA,EAAY,MAAM;AAACC,IAAAA,SAAS,EAAC;GAC3E3B,eAAAA,gBAAA,CAAAmB,aAAA,CAAA,QAAA,EAAA;AACEC,IAAAA,SAAS,EAAC,YAAY;AACtBQ,IAAAA,EAAE,EAAC,IAAI;AACPC,IAAAA,EAAE,EAAC;AACH;AACAC,IAAAA,CAAC,EAAC,MAAM;AACRC,IAAAA,MAAM,EAAC,cAAc;AACrBC,IAAAA,IAAI,EAAC,MAAM;AACXC,IAAAA,WAAW,EAAC,GAAG;AACfC,IAAAA,YAAY,EAAC;AAAoB,GAClC,CAAC,eAEFlC,gBAAA,CAAAmB,aAAA,CAAA,QAAA,EAAA;AAAQC,IAAAA,SAAS,EAAC,OAAO;AAACQ,IAAAA,EAAE,EAAC,IAAI;AAACC,IAAAA,EAAE,EAAC,IAAI;AAACG,IAAAA,IAAI,EAAC;AAAc,GAAE,CAC5D,CACN,eACDhC,gBAAA,CAAAmB,aAAA,CAAA,OAAA,EAAA;AAAOgB,IAAAA,OAAO,EAAElB;GAAUZ,EAAAA,KAAa,CACpC,CACF,CAAC;AAEV,CAAC;AAEDN,UAAU,CAACqC,WAAW,GAAG,YAAY;;;;"}
|
package/FieldRadio/index.mjs
CHANGED
|
@@ -25,12 +25,12 @@ function _iterableToArrayLimit(r, l) {
|
|
|
25
25
|
i,
|
|
26
26
|
u,
|
|
27
27
|
a = [],
|
|
28
|
-
f =
|
|
29
|
-
o =
|
|
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 =
|
|
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
|
|
54
|
-
for (r = 0; r <
|
|
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.
|
|
62
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
63
63
|
t[n] = r[n];
|
|
64
64
|
}
|
|
65
65
|
return t;
|
|
@@ -123,6 +123,7 @@ var FieldRadio = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
123
123
|
htmlFor: inputId
|
|
124
124
|
}, label)));
|
|
125
125
|
});
|
|
126
|
+
FieldRadio.displayName = 'FieldRadio';
|
|
126
127
|
|
|
127
128
|
export { FieldRadio as default };
|
|
128
129
|
//# sourceMappingURL=index.mjs.map
|
package/FieldRadio/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/FieldRadio/FieldRadio.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport type FieldRadioProps = {\n label: React.ReactNode | string;\n} & React.ComponentPropsWithoutRef<'input'>;\n\nconst FieldRadio = React.forwardRef<HTMLInputElement, FieldRadioProps>(({ id, label, ...props }, ref) => {\n const [isEnhanced, setIsEnhanced] = React.useState(false);\n\n const fallbackId = React.useId();\n\n const inputId = id ?? fallbackId;\n\n React.useEffect(() => {\n setIsEnhanced(true);\n }, []);\n\n return (\n <div className=\"bds-form-group\">\n <div className=\"bds-radio\" data-enhanced={isEnhanced ? '' : undefined}>\n <input {...props} id={inputId} ref={ref} type=\"radio\" />\n {isEnhanced && (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\">\n <circle\n className=\"background\"\n cx=\"12\"\n cy=\"12\"\n /* subtract half of the strokeWidth to get radius. credit: https://stackoverflow.com/questions/64149284/svg-stroke-width-changes-dimensions-of-the-object */\n r=\"11.5\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeWidth=\"1\"\n vectorEffect=\"non-scaling-stroke\"\n />\n {/* radius set through CSS when selected */}\n <circle className=\"radio\" cx=\"12\" cy=\"12\" fill=\"currentColor\" />\n </svg>\n )}\n
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/FieldRadio/FieldRadio.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport type FieldRadioProps = {\n label: React.ReactNode | string;\n} & React.ComponentPropsWithoutRef<'input'>;\n\nconst FieldRadio = React.forwardRef<HTMLInputElement, FieldRadioProps>(({ id, label, ...props }, ref) => {\n const [isEnhanced, setIsEnhanced] = React.useState(false);\n\n const fallbackId = React.useId();\n\n const inputId = id ?? fallbackId;\n\n React.useEffect(() => {\n setIsEnhanced(true);\n }, []);\n\n return (\n <div className=\"bds-form-group\">\n <div className=\"bds-radio\" data-enhanced={isEnhanced ? '' : undefined}>\n <input {...props} id={inputId} ref={ref} type=\"radio\" />\n {isEnhanced && (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\">\n <circle\n className=\"background\"\n cx=\"12\"\n cy=\"12\"\n /* subtract half of the strokeWidth to get radius. credit: https://stackoverflow.com/questions/64149284/svg-stroke-width-changes-dimensions-of-the-object */\n r=\"11.5\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeWidth=\"1\"\n vectorEffect=\"non-scaling-stroke\"\n />\n {/* radius set through CSS when selected */}\n <circle className=\"radio\" cx=\"12\" cy=\"12\" fill=\"currentColor\" />\n </svg>\n )}\n <label htmlFor={inputId}>{label}</label>\n </div>\n </div>\n );\n});\n\nFieldRadio.displayName = 'FieldRadio';\n\nexport default FieldRadio;\n"],"names":["FieldRadio","React","forwardRef","_ref","ref","id","label","props","_objectWithoutProperties","_excluded","_React$useState","useState","_React$useState2","_slicedToArray","isEnhanced","setIsEnhanced","fallbackId","useId","inputId","useEffect","createElement","className","undefined","_extends","type","width","height","viewBox","focusable","cx","cy","r","stroke","fill","strokeWidth","vectorEffect","htmlFor","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMMA,IAAAA,UAAU,gBAAGC,KAAK,CAACC,UAAU,CAAoC,UAAAC,IAAA,EAA0BC,GAAG,EAAK;AAAA,EAAA,IAA/BC,EAAE,GAAAF,IAAA,CAAFE,EAAE;IAAEC,KAAK,GAAAH,IAAA,CAALG,KAAK;AAAKC,IAAAA,KAAK,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA,CAAA;AAC3F,EAAA,IAAAC,eAAA,GAAoCT,KAAK,CAACU,QAAQ,CAAC,KAAK,CAAC;IAAAC,gBAAA,GAAAC,cAAA,CAAAH,eAAA,EAAA,CAAA,CAAA;AAAlDI,IAAAA,UAAU,GAAAF,gBAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,aAAa,GAAAH,gBAAA,CAAA,CAAA,CAAA;AAEhC,EAAA,IAAMI,UAAU,GAAGf,KAAK,CAACgB,KAAK,EAAE;EAEhC,IAAMC,OAAO,GAAGb,EAAE,KAAA,IAAA,IAAFA,EAAE,KAAFA,MAAAA,GAAAA,EAAE,GAAIW,UAAU;EAEhCf,KAAK,CAACkB,SAAS,CAAC,YAAM;IACpBJ,aAAa,CAAC,IAAI,CAAC;GACpB,EAAE,EAAE,CAAC;EAEN,oBACEd,KAAA,CAAAmB,aAAA,CAAA,KAAA,EAAA;AAA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AW,GAAG,YAAY;;;;"}
|
package/FieldSelect/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
|
|
42
|
-
for (r = 0; r <
|
|
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.
|
|
50
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
51
51
|
t[n] = r[n];
|
|
52
52
|
}
|
|
53
53
|
return t;
|
|
@@ -76,7 +76,6 @@ function ErrorMessage(_ref) {
|
|
|
76
76
|
|
|
77
77
|
var _excluded = ["error", "hint", "id", "isOptional", "label"];
|
|
78
78
|
var FieldSelect = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
79
|
-
var _id;
|
|
80
79
|
var error = _ref.error,
|
|
81
80
|
hint = _ref.hint,
|
|
82
81
|
id = _ref.id,
|
|
@@ -84,7 +83,7 @@ var FieldSelect = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref)
|
|
|
84
83
|
isOptional = _ref$isOptional === void 0 ? false : _ref$isOptional,
|
|
85
84
|
label = _ref.label,
|
|
86
85
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
87
|
-
id =
|
|
86
|
+
id = id !== null && id !== void 0 ? id : props.name;
|
|
88
87
|
var errorId = React__namespace.useId();
|
|
89
88
|
var hintId = React__namespace.useId();
|
|
90
89
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
@@ -105,6 +104,7 @@ var FieldSelect = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref)
|
|
|
105
104
|
ref: ref
|
|
106
105
|
}, props))));
|
|
107
106
|
});
|
|
107
|
+
FieldSelect.displayName = 'FieldSelect';
|
|
108
108
|
|
|
109
109
|
exports.default = FieldSelect;
|
|
110
110
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/FieldSelect/FieldSelect.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';\nimport ErrorMessage from '../ErrorMessage';\n\nexport type FieldSelectProps = {\n error?: string;\n hint?: React.ReactNode | string;\n id?: string;\n isOptional?: boolean;\n label: React.ReactNode | string;\n} & React.ComponentPropsWithoutRef<'select'>;\n\nconst FieldSelect = React.forwardRef<HTMLSelectElement, FieldSelectProps>(\n ({ error, hint, id, isOptional = false, label, ...props }, ref) => {\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 <div className=\"bds-select\">\n <select\n aria-invalid={error ? true : undefined}\n aria-describedby={error && hint ? `${hintId} ${errorId}` : error ? errorId : hint ? hintId : undefined}\n id={id}\n ref={ref}\n {...props}\n />\n </div>\n </div>\n );\n },\n);\n\nexport default FieldSelect;\n"],"names":["ErrorMessage","_ref","className","children","props","_objectWithoutProperties","_excluded","React","createElement","_extends","filter","x","join","xmlns","viewBox","height","width","fill","d","FieldSelect","forwardRef","ref","
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/FieldSelect/FieldSelect.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';\nimport ErrorMessage from '../ErrorMessage';\n\nexport type FieldSelectProps = {\n error?: string;\n hint?: React.ReactNode | string;\n id?: string;\n isOptional?: boolean;\n label: React.ReactNode | string;\n} & React.ComponentPropsWithoutRef<'select'>;\n\nconst FieldSelect = React.forwardRef<HTMLSelectElement, FieldSelectProps>(\n ({ error, hint, id, isOptional = false, label, ...props }, ref) => {\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 <div className=\"bds-select\">\n <select\n aria-invalid={error ? true : undefined}\n aria-describedby={error && hint ? `${hintId} ${errorId}` : error ? errorId : hint ? hintId : undefined}\n id={id}\n ref={ref}\n {...props}\n />\n </div>\n </div>\n );\n },\n);\n\nFieldSelect.displayName = 'FieldSelect';\n\nexport default FieldSelect;\n"],"names":["ErrorMessage","_ref","className","children","props","_objectWithoutProperties","_excluded","React","createElement","_extends","filter","x","join","xmlns","viewBox","height","width","fill","d","FieldSelect","forwardRef","ref","error","hint","id","_ref$isOptional","isOptional","label","name","errorId","useId","hintId","htmlFor","undefined","concat","displayName"],"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,E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CAAAC,aAAA,CAAA,OAAA,EAAA;AAAOwB,IAAAA,OAAO,EAAER;GACbG,EAAAA,KAAK,EACLD,UAAU,IAAI,aACV,CAAC,EACPH,IAAI,iBACHhB,gBAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AAAMN,IAAAA,SAAS,EAAC,UAAU;AAACsB,IAAAA,EAAE,EAAEO;GAC5BR,EAAAA,IACG,CACP,EACAD,KAAK,iBAAIf,gBAAA,CAAAC,aAAA,CAACR,YAAY,EAAA;AAACwB,IAAAA,EAAE,EAAEK;AAAQ,GAAA,EAAEP,KAAoB,CAAC,eAC3Df,gBAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAKN,IAAAA,SAAS,EAAC;AAAY,GAAA,eACzBK,gBAAA,CAAAC,aAAA,CAAA,QAAA,EAAAC,QAAA,CAAA;AACE,IAAA,cAAA,EAAca,KAAK,GAAG,IAAI,GAAGW,SAAU;IACvC,kBAAkBX,EAAAA,KAAK,IAAIC,IAAI,GAAA,EAAA,CAAAW,MAAA,CAAMH,MAAM,OAAAG,MAAA,CAAIL,OAAO,CAAKP,GAAAA,KAAK,GAAGO,OAAO,GAAGN,IAAI,GAAGQ,MAAM,GAAGE,SAAU;AACvGT,IAAAA,EAAE,EAAEA,EAAG;AACPH,IAAAA,GAAG,EAAEA;AAAI,GAAA,EACLjB,KAAK,CACV,CACE,CACF,CAAC;AAEV,CACF;AAEAe,WAAW,CAACgB,WAAW,GAAG,aAAa;;;;"}
|
package/FieldSelect/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
|
|
19
|
-
for (r = 0; r <
|
|
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.
|
|
27
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
28
28
|
t[n] = r[n];
|
|
29
29
|
}
|
|
30
30
|
return t;
|
|
@@ -53,7 +53,6 @@ function ErrorMessage(_ref) {
|
|
|
53
53
|
|
|
54
54
|
var _excluded = ["error", "hint", "id", "isOptional", "label"];
|
|
55
55
|
var FieldSelect = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
56
|
-
var _id;
|
|
57
56
|
var error = _ref.error,
|
|
58
57
|
hint = _ref.hint,
|
|
59
58
|
id = _ref.id,
|
|
@@ -61,7 +60,7 @@ var FieldSelect = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
61
60
|
isOptional = _ref$isOptional === void 0 ? false : _ref$isOptional,
|
|
62
61
|
label = _ref.label,
|
|
63
62
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
64
|
-
id =
|
|
63
|
+
id = id !== null && id !== void 0 ? id : props.name;
|
|
65
64
|
var errorId = React.useId();
|
|
66
65
|
var hintId = React.useId();
|
|
67
66
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -82,6 +81,7 @@ var FieldSelect = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
82
81
|
ref: ref
|
|
83
82
|
}, props))));
|
|
84
83
|
});
|
|
84
|
+
FieldSelect.displayName = 'FieldSelect';
|
|
85
85
|
|
|
86
86
|
export { FieldSelect as default };
|
|
87
87
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/FieldSelect/FieldSelect.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';\nimport ErrorMessage from '../ErrorMessage';\n\nexport type FieldSelectProps = {\n error?: string;\n hint?: React.ReactNode | string;\n id?: string;\n isOptional?: boolean;\n label: React.ReactNode | string;\n} & React.ComponentPropsWithoutRef<'select'>;\n\nconst FieldSelect = React.forwardRef<HTMLSelectElement, FieldSelectProps>(\n ({ error, hint, id, isOptional = false, label, ...props }, ref) => {\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 <div className=\"bds-select\">\n <select\n aria-invalid={error ? true : undefined}\n aria-describedby={error && hint ? `${hintId} ${errorId}` : error ? errorId : hint ? hintId : undefined}\n id={id}\n ref={ref}\n {...props}\n />\n </div>\n </div>\n );\n },\n);\n\nexport default FieldSelect;\n"],"names":["ErrorMessage","_ref","className","children","props","_objectWithoutProperties","_excluded","React","createElement","_extends","filter","x","join","xmlns","viewBox","height","width","fill","d","FieldSelect","forwardRef","ref","
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/FieldSelect/FieldSelect.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';\nimport ErrorMessage from '../ErrorMessage';\n\nexport type FieldSelectProps = {\n error?: string;\n hint?: React.ReactNode | string;\n id?: string;\n isOptional?: boolean;\n label: React.ReactNode | string;\n} & React.ComponentPropsWithoutRef<'select'>;\n\nconst FieldSelect = React.forwardRef<HTMLSelectElement, FieldSelectProps>(\n ({ error, hint, id, isOptional = false, label, ...props }, ref) => {\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 <div className=\"bds-select\">\n <select\n aria-invalid={error ? true : undefined}\n aria-describedby={error && hint ? `${hintId} ${errorId}` : error ? errorId : hint ? hintId : undefined}\n id={id}\n ref={ref}\n {...props}\n />\n </div>\n </div>\n );\n },\n);\n\nFieldSelect.displayName = 'FieldSelect';\n\nexport default FieldSelect;\n"],"names":["ErrorMessage","_ref","className","children","props","_objectWithoutProperties","_excluded","React","createElement","_extends","filter","x","join","xmlns","viewBox","height","width","fill","d","FieldSelect","forwardRef","ref","error","hint","id","_ref$isOptional","isOptional","label","name","errorId","useId","hintId","htmlFor","undefined","concat","displayName"],"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,CAA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AA,EAAA;AAAKN,IAAAA,SAAS,EAAC;AAAY,GAAA,eACzBK,KAAA,CAAAC,aAAA,CAAA,QAAA,EAAAC,QAAA,CAAA;AACE,IAAA,cAAA,EAAca,KAAK,GAAG,IAAI,GAAGW,SAAU;IACvC,kBAAkBX,EAAAA,KAAK,IAAIC,IAAI,GAAA,EAAA,CAAAW,MAAA,CAAMH,MAAM,OAAAG,MAAA,CAAIL,OAAO,CAAKP,GAAAA,KAAK,GAAGO,OAAO,GAAGN,IAAI,GAAGQ,MAAM,GAAGE,SAAU;AACvGT,IAAAA,EAAE,EAAEA,EAAG;AACPH,IAAAA,GAAG,EAAEA;AAAI,GAAA,EACLjB,KAAK,CACV,CACE,CACF,CAAC;AAEV,CACF;AAEAe,WAAW,CAACgB,WAAW,GAAG,aAAa;;;;"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export type FieldTextInputProps = {
|
|
3
3
|
error?: string;
|
|
4
|
-
hint?: string;
|
|
4
|
+
hint?: React.ReactNode | string;
|
|
5
5
|
id?: string;
|
|
6
6
|
isOptional?: boolean;
|
|
7
7
|
label: string;
|
|
8
8
|
} & React.ComponentPropsWithoutRef<'input'>;
|
|
9
9
|
declare const FieldTextInput: React.ForwardRefExoticComponent<{
|
|
10
10
|
error?: string;
|
|
11
|
-
hint?: string;
|
|
11
|
+
hint?: React.ReactNode | string;
|
|
12
12
|
id?: string;
|
|
13
13
|
isOptional?: boolean;
|
|
14
14
|
label: string;
|
package/FieldTextInput/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
|
|
42
|
-
for (r = 0; r <
|
|
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.
|
|
50
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
51
51
|
t[n] = r[n];
|
|
52
52
|
}
|
|
53
53
|
return t;
|
|
@@ -76,7 +76,6 @@ function ErrorMessage(_ref) {
|
|
|
76
76
|
|
|
77
77
|
var _excluded = ["className", "error", "hint", "id", "isOptional", "label"];
|
|
78
78
|
var FieldTextInput = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
79
|
-
var _id;
|
|
80
79
|
var className = _ref.className,
|
|
81
80
|
error = _ref.error,
|
|
82
81
|
hint = _ref.hint,
|
|
@@ -85,7 +84,7 @@ var FieldTextInput = /*#__PURE__*/React__namespace.forwardRef(function (_ref, re
|
|
|
85
84
|
isOptional = _ref$isOptional === void 0 ? false : _ref$isOptional,
|
|
86
85
|
label = _ref.label,
|
|
87
86
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
88
|
-
id =
|
|
87
|
+
id = id !== null && id !== void 0 ? id : props.name;
|
|
89
88
|
var errorId = React__namespace.useId();
|
|
90
89
|
var hintId = React__namespace.useId();
|
|
91
90
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
@@ -107,6 +106,7 @@ var FieldTextInput = /*#__PURE__*/React__namespace.forwardRef(function (_ref, re
|
|
|
107
106
|
ref: ref
|
|
108
107
|
}, props)));
|
|
109
108
|
});
|
|
109
|
+
FieldTextInput.displayName = 'FieldTextInput';
|
|
110
110
|
|
|
111
111
|
exports.default = FieldTextInput;
|
|
112
112
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/FieldTextInput/FieldTextInput.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\nimport ErrorMessage from '../ErrorMessage';\n\nexport type FieldTextInputProps = {\n error?: string;\n hint?: string;\n id?: string;\n isOptional?: boolean;\n label: string;\n} & React.ComponentPropsWithoutRef<'input'>;\n\nconst FieldTextInput = React.forwardRef<HTMLInputElement, FieldTextInputProps>(\n ({ className, error, hint, id, isOptional = false, label, ...props }, ref) => {\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 <input\n aria-invalid={error ? true : undefined}\n aria-describedby={error && hint ? `${hintId} ${errorId}` : error ? errorId : hint ? hintId : undefined}\n className={['bds-text-input', className].filter((x) => x).join(' ')}\n id={id}\n ref={ref}\n {...props}\n />\n </div>\n );\n },\n);\n\nexport default FieldTextInput;\n"],"names":["ErrorMessage","_ref","className","children","props","_objectWithoutProperties","_excluded","React","createElement","_extends","filter","x","join","xmlns","viewBox","height","width","fill","d","FieldTextInput","forwardRef","ref","
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/ErrorMessage/ErrorMessage.tsx","../../src/FieldTextInput/FieldTextInput.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\nimport ErrorMessage from '../ErrorMessage';\n\nexport type FieldTextInputProps = {\n error?: string;\n hint?: React.ReactNode | string;\n id?: string;\n isOptional?: boolean;\n label: string;\n} & React.ComponentPropsWithoutRef<'input'>;\n\nconst FieldTextInput = React.forwardRef<HTMLInputElement, FieldTextInputProps>(\n ({ className, error, hint, id, isOptional = false, label, ...props }, ref) => {\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 <input\n aria-invalid={error ? true : undefined}\n aria-describedby={error && hint ? `${hintId} ${errorId}` : error ? errorId : hint ? hintId : undefined}\n className={['bds-text-input', className].filter((x) => x).join(' ')}\n id={id}\n ref={ref}\n {...props}\n />\n </div>\n );\n },\n);\n\nFieldTextInput.displayName = 'FieldTextInput';\n\nexport default FieldTextInput;\n"],"names":["ErrorMessage","_ref","className","children","props","_objectWithoutProperties","_excluded","React","createElement","_extends","filter","x","join","xmlns","viewBox","height","width","fill","d","FieldTextInput","forwardRef","ref","error","hint","id","_ref$isOptional","isOptional","label","name","errorId","useId","hintId","htmlFor","undefined","concat","displayName"],"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,E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