@iabbb/bds-react 0.54.0 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Button/index.cjs +3 -3
- package/Button/index.cjs.map +1 -1
- package/Button/index.mjs +3 -3
- package/Button/index.mjs.map +1 -1
- package/CallToAction/index.cjs +3 -3
- package/CallToAction/index.cjs.map +1 -1
- package/CallToAction/index.mjs +3 -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 +6 -6
- package/FieldCheckbox/index.cjs.map +1 -1
- package/FieldCheckbox/index.mjs +6 -6
- package/FieldCheckbox/index.mjs.map +1 -1
- package/FieldRadio/index.cjs +6 -6
- package/FieldRadio/index.cjs.map +1 -1
- package/FieldRadio/index.mjs +6 -6
- package/FieldRadio/index.mjs.map +1 -1
- package/FieldSelect/index.cjs +4 -5
- package/FieldSelect/index.cjs.map +1 -1
- package/FieldSelect/index.mjs +4 -5
- package/FieldSelect/index.mjs.map +1 -1
- package/FieldTextInput/FieldTextInput.d.ts +11 -5
- package/FieldTextInput/index.cjs +11 -13
- package/FieldTextInput/index.cjs.map +1 -1
- package/FieldTextInput/index.mjs +11 -13
- 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 +11 -13
- package/index.cjs.map +1 -1
- package/index.mjs +11 -13
- package/index.mjs.map +1 -1
- package/package.json +5 -5
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;
|
|
@@ -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 {/* biome-ignore lint/a11y/noLabelWithoutControl: false positive; label is provided dynamically */}\n <label htmlFor={inputId}>{label}</label>\n </div>\n </div>\n );\n },\n);\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"],"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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ACyB,KAAK,EAAE;EAE7B,IAAME,OAAO,GAAGX,EAAE,KAAA,IAAA,IAAFA,EAAE,KAAFA,
|
|
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 {/* biome-ignore lint/a11y/noLabelWithoutControl: false positive; label is provided dynamically */}\n <label htmlFor={inputId}>{label}</label>\n </div>\n </div>\n );\n },\n);\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"],"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,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AAI,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,eAEDrC,gBAAA,CAAAC,aAAA,CAAA,OAAA,EAAA;AAAOqC,IAAAA,OAAO,EAAEX;GAAUV,EAAAA,KAAa,CACpC,CACF,CAAC;AAEV,CACF;;;;"}
|
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;
|
|
@@ -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 {/* biome-ignore lint/a11y/noLabelWithoutControl: false positive; label is provided dynamically */}\n <label htmlFor={inputId}>{label}</label>\n </div>\n </div>\n );\n },\n);\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGe,SAASA,YAAYA,CAAAC,IAA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GAAAF,gBAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,aAAa,GAAAH,gBAAA,CAAA,CAAA,CAAA;AAEhC,EAAA,IAAMI,UAAU,GAAGxB,KAAK,CAACyB,KAAK,EAAE;AAChC,EAAA,IAAMC,OAAO,GAAG1B,KAAK,CAACyB,KAAK,EAAE;EAE7B,IAAME,OAAO,GAAGX,EAAE,KAAA,IAAA,IAAFA,EAAE,KAAFA,
|
|
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 {/* biome-ignore lint/a11y/noLabelWithoutControl: false positive; label is provided dynamically */}\n <label htmlFor={inputId}>{label}</label>\n </div>\n </div>\n );\n },\n);\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGe,SAASA,YAAYA,CAAAC,IAAA,EAA4E;AAAA,EAAA,IAAzEC,SAAS,GAAAD,IAAA,CAATC,SAAS;IAAEC,QAAQ,GAAAF,IAAA,CAARE,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ACEN,IAAAA,SAAS,EAAC,YAAY;AACtBc,IAAAA,KAAK,EAAC,IAAI;AACVD,IAAAA,MAAM,EAAC,IAAI;AACXwB,IAAAA,MAAM,EAAC,cAAc;AACrBtB,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,KAAA,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,eAEDrC,KAAA,CAAAC,aAAA,CAAA,OAAA,EAAA;AAAOqC,IAAAA,OAAO,EAAEX;GAAUV,EAAAA,KAAa,CACpC,CACF,CAAC;AAEV,CACF;;;;"}
|
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;
|
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 {/* biome-ignore lint/a11y/noLabelWithoutControl: false positive; label is provided dynamically */}\n <label htmlFor={inputId}>{label}</label>\n </div>\n </div>\n );\n});\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMMA,IAAAA,UAAU,gBAAGC,gBAAK,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,gBAAK,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,gBAAK,CAACgB,KAAK,EAAE;EAEhC,IAAMC,OAAO,GAAGb,EAAE,KAAA,IAAA,IAAFA,EAAE,KAAFA,
|
|
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 {/* biome-ignore lint/a11y/noLabelWithoutControl: false positive; label is provided dynamically */}\n <label htmlFor={inputId}>{label}</label>\n </div>\n </div>\n );\n});\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMMA,IAAAA,UAAU,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AAI;AAACC,IAAAA,MAAM,EAAC,IAAI;AAACC,IAAAA,OAAO,EAAC,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,eAEDhC,gBAAA,CAAAmB,aAAA,CAAA,OAAA,EAAA;AAAOgB,IAAAA,OAAO,EAAElB;GAAUZ,EAAAA,KAAa,CACpC,CACF,CAAC;AAEV,CAAC;;;;"}
|
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;
|
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 {/* biome-ignore lint/a11y/noLabelWithoutControl: false positive; label is provided dynamically */}\n <label htmlFor={inputId}>{label}</label>\n </div>\n </div>\n );\n});\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"],"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,
|
|
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 {/* biome-ignore lint/a11y/noLabelWithoutControl: false positive; label is provided dynamically */}\n <label htmlFor={inputId}>{label}</label>\n </div>\n </div>\n );\n});\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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CAAA,KAAA,EAAA;AAAKK,IAAAA,KAAK,EAAC,IAAI;AAACC,IAAAA,MAAM,EAAC,IAAI;AAACC,IAAAA,OAAO,EAAC,WAAW;AAAC,IAAA,aAAA,EAAY,MAAM;AAACC,IAAAA,SAAS,EAAC;GAC3E3B,eAAAA,KAAA,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,KAAA,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,eAEDhC,KAAA,CAAAmB,aAAA,CAAA,OAAA,EAAA;AAAOgB,IAAAA,OAAO,EAAElB;GAAUZ,EAAAA,KAAa,CACpC,CACF,CAAC;AAEV,CAAC;;;;"}
|
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", {
|
|
@@ -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\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGe,SAASA,YAAYA,CAAAC,IAAA,EAA4E;AAAA,EAAA,IAAzEC,SAAS,GAAAD,IAAA,CAATC,SAAS;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;AAAKC,IAAAA,KAAK,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,WAAA,CAAA;AAClE,EAAA,oBACEC,gBAAA,CAAAC,aAAA,CAAA,MAAA,EAAAC,QAAA,CAAA;IAAMP,SAAS,EAAE,CAAC,WAAW,EAAEA,SAAS,CAAC,CAACQ,MAAM,CAAC,UAACC,CAAC,EAAA;AAAA,MAAA,OAAKA,CAAC;KAAC,CAAA,CAACC,IAAI,CAAC,GAAG;AAAE,GAAA,EAAKR,KAAK,CAAA,eAC7EG,gBAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AACEK,IAAAA,KAAK,EAAC,4BAA4B;AAClCC,IAAAA,OAAO,EAAC,aAAa;AACrB,IAAA,aAAA,EAAY,MAAM;AAClBC,IAAAA,MAAM,EAAC,KAAK;AACZC,IAAAA,KAAK,EAAC,KAAK;AACXC,IAAAA,IAAI,EAAC;GAELV,eAAAA,gBAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AAAMU,IAAAA,CAAC,EAAC;AAA4U,GAAE,CACnV,CAAC,EACLf,QACG,CAAC;AAEX;;;ACRMgB,IAAAA,WAAW,gBAAGZ,gBAAK,CAACa,UAAU,CAClC,UAAAnB,IAAA,EAA2DoB,GAAG,EAAK;AAAA,EAAA,IAAhEC,KAAK,GAAArB,IAAA,CAALqB,KAAK;IAAEC,IAAI,GAAAtB,IAAA,CAAJsB,IAAI;IAAEC,EAAE,GAAAvB,IAAA,CAAFuB,EAAE;IAAAC,eAAA,GAAAxB,IA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AAGN,IAAI,GAAGQ,MAAM,GAAGE,SAAU;AACvGT,IAAAA,EAAE,EAAEA,EAAG;AACPH,IAAAA,GAAG,EAAEA;AAAI,GAAA,EACLjB,KAAK,CACV,CACE,CACF,CAAC;AAEV,CACF;;;;"}
|
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", {
|
|
@@ -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\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"],"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,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AAU;AAACsB,IAAAA,EAAE,EAAEO;GAC5BR,EAAAA,IACG,CACP,EACAD,KAAK,iBAAIf,KAAA,CAAAC,aAAA,CAACR,YAAY,EAAA;AAACwB,IAAAA,EAAE,EAAEK;AAAQ,GAAA,EAAEP,KAAoB,CAAC,eAC3Df,KAAA,CAAAC,aAAA,CAAA,KAAA,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;;;;"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export type FieldTextInputProps
|
|
3
|
-
as?: C;
|
|
2
|
+
export type FieldTextInputProps = {
|
|
4
3
|
error?: string;
|
|
5
|
-
hint?: string;
|
|
4
|
+
hint?: React.ReactNode | string;
|
|
6
5
|
id?: string;
|
|
7
6
|
isOptional?: boolean;
|
|
8
7
|
label: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
8
|
+
} & React.ComponentPropsWithoutRef<'input'>;
|
|
9
|
+
declare const FieldTextInput: React.ForwardRefExoticComponent<{
|
|
10
|
+
error?: string;
|
|
11
|
+
hint?: React.ReactNode | string;
|
|
12
|
+
id?: string;
|
|
13
|
+
isOptional?: boolean;
|
|
14
|
+
label: string;
|
|
15
|
+
} & Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
16
|
+
export default FieldTextInput;
|
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;
|
|
@@ -74,11 +74,9 @@ function ErrorMessage(_ref) {
|
|
|
74
74
|
})), children);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
var _excluded = ["
|
|
78
|
-
|
|
79
|
-
var
|
|
80
|
-
var as = _ref.as,
|
|
81
|
-
className = _ref.className,
|
|
77
|
+
var _excluded = ["className", "error", "hint", "id", "isOptional", "label"];
|
|
78
|
+
var FieldTextInput = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
79
|
+
var className = _ref.className,
|
|
82
80
|
error = _ref.error,
|
|
83
81
|
hint = _ref.hint,
|
|
84
82
|
id = _ref.id,
|
|
@@ -86,10 +84,9 @@ function FieldTextInput(_ref) {
|
|
|
86
84
|
isOptional = _ref$isOptional === void 0 ? false : _ref$isOptional,
|
|
87
85
|
label = _ref.label,
|
|
88
86
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
89
|
-
id =
|
|
87
|
+
id = id !== null && id !== void 0 ? id : props.name;
|
|
90
88
|
var errorId = React__namespace.useId();
|
|
91
89
|
var hintId = React__namespace.useId();
|
|
92
|
-
var InputComponent = as !== null && as !== void 0 ? as : 'input';
|
|
93
90
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
94
91
|
className: "bds-form-group"
|
|
95
92
|
}, /*#__PURE__*/React__namespace.createElement("label", {
|
|
@@ -99,15 +96,16 @@ function FieldTextInput(_ref) {
|
|
|
99
96
|
id: hintId
|
|
100
97
|
}, hint), error && /*#__PURE__*/React__namespace.createElement(ErrorMessage, {
|
|
101
98
|
id: errorId
|
|
102
|
-
}, error), /*#__PURE__*/React__namespace.createElement(
|
|
99
|
+
}, error), /*#__PURE__*/React__namespace.createElement("input", _extends({
|
|
103
100
|
"aria-invalid": error ? true : undefined,
|
|
104
101
|
"aria-describedby": error && hint ? "".concat(hintId, " ").concat(errorId) : error ? errorId : hint ? hintId : undefined,
|
|
105
102
|
className: ['bds-text-input', className].filter(function (x) {
|
|
106
103
|
return x;
|
|
107
104
|
}).join(' '),
|
|
108
|
-
id: id
|
|
105
|
+
id: id,
|
|
106
|
+
ref: ref
|
|
109
107
|
}, props)));
|
|
110
|
-
}
|
|
108
|
+
});
|
|
111
109
|
|
|
112
110
|
exports.default = FieldTextInput;
|
|
113
111
|
//# 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';\nimport ErrorMessage from '../ErrorMessage';\n\nexport type FieldTextInputProps
|
|
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\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"],"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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wB,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,UAAAC,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;IACvG/B,SAAS,EAAE,CAAC,gBAAgB,EAAEA,SAAS,CAAC,CAACQ,MAAM,CAAC,UAACC,CAAC,EAAA;AAAA,MAAA,OAAKA,CAAC;AAAA,KAAA,CAAC,CAACC,IAAI,CAAC,GAAG,CAAE;AACpEY,IAAAA,EAAE,EAAEA,EAAG;AACPH,IAAAA,GAAG,EAAEA;GACDjB,EAAAA,KAAK,CACV,CACE,CAAC;AAEV,CACF;;;;"}
|
package/FieldTextInput/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;
|
|
@@ -51,11 +51,9 @@ function ErrorMessage(_ref) {
|
|
|
51
51
|
})), children);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
var _excluded = ["
|
|
55
|
-
|
|
56
|
-
var
|
|
57
|
-
var as = _ref.as,
|
|
58
|
-
className = _ref.className,
|
|
54
|
+
var _excluded = ["className", "error", "hint", "id", "isOptional", "label"];
|
|
55
|
+
var FieldTextInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
56
|
+
var className = _ref.className,
|
|
59
57
|
error = _ref.error,
|
|
60
58
|
hint = _ref.hint,
|
|
61
59
|
id = _ref.id,
|
|
@@ -63,10 +61,9 @@ function FieldTextInput(_ref) {
|
|
|
63
61
|
isOptional = _ref$isOptional === void 0 ? false : _ref$isOptional,
|
|
64
62
|
label = _ref.label,
|
|
65
63
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
66
|
-
id =
|
|
64
|
+
id = id !== null && id !== void 0 ? id : props.name;
|
|
67
65
|
var errorId = React.useId();
|
|
68
66
|
var hintId = React.useId();
|
|
69
|
-
var InputComponent = as !== null && as !== void 0 ? as : 'input';
|
|
70
67
|
return /*#__PURE__*/React.createElement("div", {
|
|
71
68
|
className: "bds-form-group"
|
|
72
69
|
}, /*#__PURE__*/React.createElement("label", {
|
|
@@ -76,15 +73,16 @@ function FieldTextInput(_ref) {
|
|
|
76
73
|
id: hintId
|
|
77
74
|
}, hint), error && /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
78
75
|
id: errorId
|
|
79
|
-
}, error), /*#__PURE__*/React.createElement(
|
|
76
|
+
}, error), /*#__PURE__*/React.createElement("input", _extends({
|
|
80
77
|
"aria-invalid": error ? true : undefined,
|
|
81
78
|
"aria-describedby": error && hint ? "".concat(hintId, " ").concat(errorId) : error ? errorId : hint ? hintId : undefined,
|
|
82
79
|
className: ['bds-text-input', className].filter(function (x) {
|
|
83
80
|
return x;
|
|
84
81
|
}).join(' '),
|
|
85
|
-
id: id
|
|
82
|
+
id: id,
|
|
83
|
+
ref: ref
|
|
86
84
|
}, props)));
|
|
87
|
-
}
|
|
85
|
+
});
|
|
88
86
|
|
|
89
87
|
export { FieldTextInput as default };
|
|
90
88
|
//# sourceMappingURL=index.mjs.map
|