@12-apps/ui 6.85.0 → 6.86.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.
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  SelectField
4
- } from "../../../../../chunk-GCBWZ3MX.js";
4
+ } from "../../../../../chunk-6YSGP2WS.js";
5
5
  import "../../../../../chunk-4XK6JQ4D.js";
6
6
  import "../../../../../chunk-II3YNC5S.js";
7
7
  import "../../../../../chunk-NZBEE2PR.js";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  ToggleField
4
- } from "../../../../../chunk-75I42HHE.js";
4
+ } from "../../../../../chunk-AYJGRQT4.js";
5
5
  import "../../../../../chunk-4XK6JQ4D.js";
6
6
  import "../../../../../chunk-ONMSTW4B.js";
7
7
  import "../../../../../chunk-U2QV4TTZ.js";
@@ -1,4 +1,4 @@
1
- import "../../../../../chunk-LH3YT5NL.js";
1
+ import "../../../../../chunk-TVDHA7BT.js";
2
2
  import {
3
3
  CepField
4
4
  } from "../../../../../chunk-YGWLMTPB.js";
@@ -7,13 +7,13 @@ import {
7
7
  } from "../../../../../chunk-P4Q7JK4L.js";
8
8
  import {
9
9
  ToggleField
10
- } from "../../../../../chunk-75I42HHE.js";
10
+ } from "../../../../../chunk-AYJGRQT4.js";
11
11
  import {
12
12
  TextField
13
13
  } from "../../../../../chunk-3IX2TP4I.js";
14
14
  import {
15
15
  SelectField
16
- } from "../../../../../chunk-GCBWZ3MX.js";
16
+ } from "../../../../../chunk-6YSGP2WS.js";
17
17
  import "../../../../../chunk-4XK6JQ4D.js";
18
18
  import "../../../../../chunk-II3YNC5S.js";
19
19
  import "../../../../../chunk-NZBEE2PR.js";
@@ -25,6 +25,7 @@ function SelectField({ name, options, label, placeholder }) {
25
25
  placeholder,
26
26
  value: values[name] ?? "",
27
27
  error: Boolean(error),
28
+ "aria-label": label,
28
29
  "data-testid": testId,
29
30
  onChange: (event) => setFieldValue(name, String(event.target.value))
30
31
  }
@@ -36,4 +37,4 @@ function SelectField({ name, options, label, placeholder }) {
36
37
  export {
37
38
  SelectField
38
39
  };
39
- //# sourceMappingURL=chunk-GCBWZ3MX.js.map
40
+ //# sourceMappingURL=chunk-6YSGP2WS.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/form/total-form/Fields/SelectField.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\n\nimport { FormControl, FormLabel, FormMessage } from '../../Form';\nimport { Select } from '../../Select';\nimport type { SelectOption } from '../../Select';\nimport { useFormContext } from '../FormContext';\n\n/** Props for the `total-form` {@link SelectField}. */\nexport interface SelectFieldProps {\n /** Field name; also the key into the form's values/errors. */\n name: string;\n /** Selectable options. */\n options: SelectOption[];\n /** Optional visible label rendered above the select. */\n label?: string;\n /** Placeholder shown when no option is selected. */\n placeholder?: string;\n}\n\n/**\n * Select field bound to {@link useFormContext}. Composes the existing\n * `@12-apps/ui` `Form*` primitives and the `Select` control, reading its\n * value/error from context and writing the chosen value back through it.\n *\n * Renders its error via `total-form-field-<name>-message` and the select via\n * `total-form-field-<name>`.\n */\nexport function SelectField({ name, options, label, placeholder }: SelectFieldProps): React.ReactElement {\n const { values, errors, setFieldValue } = useFormContext();\n const error = errors[name];\n const testId = `total-form-field-${name}`;\n\n return (\n <FormControl fullWidth>\n {label && (\n <FormLabel htmlFor={name} error={Boolean(error)}>\n {label}\n </FormLabel>\n )}\n <Select\n options={options}\n placeholder={placeholder}\n value={values[name] ?? ''}\n error={Boolean(error)}\n data-testid={testId}\n onChange={(event) => setFieldValue(name, String(event.target.value))}\n />\n {error && (\n <FormMessage error dataTestId={`${testId}-message`}>\n {error}\n </FormMessage>\n )}\n </FormControl>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAmCI,SAEI,KAFJ;AANG,SAAS,YAAY,EAAE,MAAM,SAAS,OAAO,YAAY,GAAyC;AACvG,QAAM,EAAE,QAAQ,QAAQ,cAAc,IAAI,eAAe;AACzD,QAAM,QAAQ,OAAO,IAAI;AACzB,QAAM,SAAS,oBAAoB,IAAI;AAEvC,SACE,qBAAC,eAAY,WAAS,MACnB;AAAA,aACC,oBAAC,aAAU,SAAS,MAAM,OAAO,QAAQ,KAAK,GAC3C,iBACH;AAAA,IAEF;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,OAAO,OAAO,IAAI,KAAK;AAAA,QACvB,OAAO,QAAQ,KAAK;AAAA,QACpB,eAAa;AAAA,QACb,UAAU,CAAC,UAAU,cAAc,MAAM,OAAO,MAAM,OAAO,KAAK,CAAC;AAAA;AAAA,IACrE;AAAA,IACC,SACC,oBAAC,eAAY,OAAK,MAAC,YAAY,GAAG,MAAM,YACrC,iBACH;AAAA,KAEJ;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../src/components/form/total-form/Fields/SelectField.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\n\nimport { FormControl, FormLabel, FormMessage } from '../../Form';\nimport { Select } from '../../Select';\nimport type { SelectOption } from '../../Select';\nimport { useFormContext } from '../FormContext';\n\n/** Props for the `total-form` {@link SelectField}. */\nexport interface SelectFieldProps {\n /** Field name; also the key into the form's values/errors. */\n name: string;\n /** Selectable options. */\n options: SelectOption[];\n /** Optional visible label rendered above the select. */\n label?: string;\n /** Placeholder shown when no option is selected. */\n placeholder?: string;\n}\n\n/**\n * Select field bound to {@link useFormContext}. Composes the existing\n * `@12-apps/ui` `Form*` primitives and the `Select` control, reading its\n * value/error from context and writing the chosen value back through it.\n *\n * Renders its error via `total-form-field-<name>-message` and the select via\n * `total-form-field-<name>`.\n */\nexport function SelectField({ name, options, label, placeholder }: SelectFieldProps): React.ReactElement {\n const { values, errors, setFieldValue } = useFormContext();\n const error = errors[name];\n const testId = `total-form-field-${name}`;\n\n return (\n <FormControl fullWidth>\n {label && (\n <FormLabel htmlFor={name} error={Boolean(error)}>\n {label}\n </FormLabel>\n )}\n <Select\n options={options}\n placeholder={placeholder}\n value={values[name] ?? ''}\n error={Boolean(error)}\n // The `<label htmlFor>` above names nothing: the combobox is MUI's\n // display div, not a labelable element. `Select` puts `aria-label` on\n // that div, so the question names the control (FUT-4157).\n aria-label={label}\n data-testid={testId}\n onChange={(event) => setFieldValue(name, String(event.target.value))}\n />\n {error && (\n <FormMessage error dataTestId={`${testId}-message`}>\n {error}\n </FormMessage>\n )}\n </FormControl>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAmCI,SAEI,KAFJ;AANG,SAAS,YAAY,EAAE,MAAM,SAAS,OAAO,YAAY,GAAyC;AACvG,QAAM,EAAE,QAAQ,QAAQ,cAAc,IAAI,eAAe;AACzD,QAAM,QAAQ,OAAO,IAAI;AACzB,QAAM,SAAS,oBAAoB,IAAI;AAEvC,SACE,qBAAC,eAAY,WAAS,MACnB;AAAA,aACC,oBAAC,aAAU,SAAS,MAAM,OAAO,QAAQ,KAAK,GAC3C,iBACH;AAAA,IAEF;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,OAAO,OAAO,IAAI,KAAK;AAAA,QACvB,OAAO,QAAQ,KAAK;AAAA,QAIpB,cAAY;AAAA,QACZ,eAAa;AAAA,QACb,UAAU,CAAC,UAAU,cAAc,MAAM,OAAO,MAAM,OAAO,KAAK,CAAC;AAAA;AAAA,IACrE;AAAA,IACC,SACC,oBAAC,eAAY,OAAK,MAAC,YAAY,GAAG,MAAM,YACrC,iBACH;AAAA,KAEJ;AAEJ;","names":[]}
@@ -25,6 +25,7 @@ function ToggleField({ name, options, label }) {
25
25
  options,
26
26
  value: values[name] ?? "",
27
27
  fullWidth: true,
28
+ "aria-label": label,
28
29
  dataTestId: testId,
29
30
  onChange: (_event, next) => {
30
31
  if (typeof next === "string") setFieldValue(name, next);
@@ -38,4 +39,4 @@ function ToggleField({ name, options, label }) {
38
39
  export {
39
40
  ToggleField
40
41
  };
41
- //# sourceMappingURL=chunk-75I42HHE.js.map
42
+ //# sourceMappingURL=chunk-AYJGRQT4.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/form/total-form/Fields/ToggleField.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\n\nimport { FormControl, FormLabel, FormMessage } from '../../Form';\nimport { ToggleGroup } from '../../ToggleGroup';\nimport type { ToggleOption } from '../../ToggleGroup';\nimport { useFormContext } from '../FormContext';\n\n/** Props for the `total-form` {@link ToggleField}. */\nexport interface ToggleFieldProps {\n /** Field name; also the key into the form's values/errors. */\n name: string;\n /** The mutually-exclusive options (one is always selected). */\n options: ToggleOption[];\n /** Optional visible label rendered above the toggle. */\n label?: string;\n}\n\n/**\n * Exclusive toggle (segmented control) bound to {@link useFormContext} — a\n * label-height-matched alternative to {@link SelectField} for a short, always-set\n * enum. Composes the `Form*` primitives and the `ToggleGroup` control, reading\n * its value from context and writing the chosen value back through it. Ignores a\n * deselect (clicking the active segment) so a value is always kept.\n *\n * Renders its error via `total-form-field-<name>-message` and the toggle via\n * `total-form-field-<name>` (each segment at `total-form-field-<name>-item-<value>`).\n */\nexport function ToggleField({ name, options, label }: ToggleFieldProps): React.ReactElement {\n const { values, errors, setFieldValue } = useFormContext();\n const error = errors[name];\n const testId = `total-form-field-${name}`;\n\n return (\n <FormControl fullWidth>\n {label && (\n <FormLabel htmlFor={name} error={Boolean(error)}>\n {label}\n </FormLabel>\n )}\n <ToggleGroup\n variant=\"exclusive\"\n options={options}\n value={values[name] ?? ''}\n fullWidth\n dataTestId={testId}\n onChange={(_event, next) => {\n if (typeof next === 'string') setFieldValue(name, next);\n }}\n />\n {error && (\n <FormMessage error dataTestId={`${testId}-message`}>\n {error}\n </FormMessage>\n )}\n </FormControl>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAmCI,SAEI,KAFJ;AANG,SAAS,YAAY,EAAE,MAAM,SAAS,MAAM,GAAyC;AAC1F,QAAM,EAAE,QAAQ,QAAQ,cAAc,IAAI,eAAe;AACzD,QAAM,QAAQ,OAAO,IAAI;AACzB,QAAM,SAAS,oBAAoB,IAAI;AAEvC,SACE,qBAAC,eAAY,WAAS,MACnB;AAAA,aACC,oBAAC,aAAU,SAAS,MAAM,OAAO,QAAQ,KAAK,GAC3C,iBACH;AAAA,IAEF;AAAA,MAAC;AAAA;AAAA,QACC,SAAQ;AAAA,QACR;AAAA,QACA,OAAO,OAAO,IAAI,KAAK;AAAA,QACvB,WAAS;AAAA,QACT,YAAY;AAAA,QACZ,UAAU,CAAC,QAAQ,SAAS;AAC1B,cAAI,OAAO,SAAS,SAAU,eAAc,MAAM,IAAI;AAAA,QACxD;AAAA;AAAA,IACF;AAAA,IACC,SACC,oBAAC,eAAY,OAAK,MAAC,YAAY,GAAG,MAAM,YACrC,iBACH;AAAA,KAEJ;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../src/components/form/total-form/Fields/ToggleField.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\n\nimport { FormControl, FormLabel, FormMessage } from '../../Form';\nimport { ToggleGroup } from '../../ToggleGroup';\nimport type { ToggleOption } from '../../ToggleGroup';\nimport { useFormContext } from '../FormContext';\n\n/** Props for the `total-form` {@link ToggleField}. */\nexport interface ToggleFieldProps {\n /** Field name; also the key into the form's values/errors. */\n name: string;\n /** The mutually-exclusive options (one is always selected). */\n options: ToggleOption[];\n /** Optional visible label rendered above the toggle. */\n label?: string;\n}\n\n/**\n * Exclusive toggle (segmented control) bound to {@link useFormContext} — a\n * label-height-matched alternative to {@link SelectField} for a short, always-set\n * enum. Composes the `Form*` primitives and the `ToggleGroup` control, reading\n * its value from context and writing the chosen value back through it. Ignores a\n * deselect (clicking the active segment) so a value is always kept.\n *\n * Renders its error via `total-form-field-<name>-message` and the toggle via\n * `total-form-field-<name>` (each segment at `total-form-field-<name>-item-<value>`).\n */\nexport function ToggleField({ name, options, label }: ToggleFieldProps): React.ReactElement {\n const { values, errors, setFieldValue } = useFormContext();\n const error = errors[name];\n const testId = `total-form-field-${name}`;\n\n return (\n <FormControl fullWidth>\n {label && (\n <FormLabel htmlFor={name} error={Boolean(error)}>\n {label}\n </FormLabel>\n )}\n <ToggleGroup\n variant=\"exclusive\"\n options={options}\n value={values[name] ?? ''}\n fullWidth\n // A `role=\"group\"` div is not labelable, so the `<label htmlFor>`\n // above names nothing; the group carries the question itself (FUT-4157).\n aria-label={label}\n dataTestId={testId}\n onChange={(_event, next) => {\n if (typeof next === 'string') setFieldValue(name, next);\n }}\n />\n {error && (\n <FormMessage error dataTestId={`${testId}-message`}>\n {error}\n </FormMessage>\n )}\n </FormControl>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAmCI,SAEI,KAFJ;AANG,SAAS,YAAY,EAAE,MAAM,SAAS,MAAM,GAAyC;AAC1F,QAAM,EAAE,QAAQ,QAAQ,cAAc,IAAI,eAAe;AACzD,QAAM,QAAQ,OAAO,IAAI;AACzB,QAAM,SAAS,oBAAoB,IAAI;AAEvC,SACE,qBAAC,eAAY,WAAS,MACnB;AAAA,aACC,oBAAC,aAAU,SAAS,MAAM,OAAO,QAAQ,KAAK,GAC3C,iBACH;AAAA,IAEF;AAAA,MAAC;AAAA;AAAA,QACC,SAAQ;AAAA,QACR;AAAA,QACA,OAAO,OAAO,IAAI,KAAK;AAAA,QACvB,WAAS;AAAA,QAGT,cAAY;AAAA,QACZ,YAAY;AAAA,QACZ,UAAU,CAAC,QAAQ,SAAS;AAC1B,cAAI,OAAO,SAAS,SAAU,eAAc,MAAM,IAAI;AAAA,QACxD;AAAA;AAAA,IACF;AAAA,IACC,SACC,oBAAC,eAAY,OAAK,MAAC,YAAY,GAAG,MAAM,YACrC,iBACH;AAAA,KAEJ;AAEJ;","names":[]}
@@ -6,13 +6,13 @@ import {
6
6
  } from "./chunk-P4Q7JK4L.js";
7
7
  import {
8
8
  ToggleField
9
- } from "./chunk-75I42HHE.js";
9
+ } from "./chunk-AYJGRQT4.js";
10
10
  import {
11
11
  TextField
12
12
  } from "./chunk-3IX2TP4I.js";
13
13
  import {
14
14
  SelectField
15
- } from "./chunk-GCBWZ3MX.js";
15
+ } from "./chunk-6YSGP2WS.js";
16
16
  import {
17
17
  __export
18
18
  } from "./chunk-PZ5AY32C.js";
@@ -30,4 +30,4 @@ __export(Fields_exports, {
30
30
  export {
31
31
  Fields_exports
32
32
  };
33
- //# sourceMappingURL=chunk-LH3YT5NL.js.map
33
+ //# sourceMappingURL=chunk-TVDHA7BT.js.map
@@ -9,18 +9,18 @@ import {
9
9
  } from "../chunk-CPAJYJUD.js";
10
10
  import {
11
11
  Fields_exports
12
- } from "../chunk-LH3YT5NL.js";
12
+ } from "../chunk-TVDHA7BT.js";
13
13
  import "../chunk-YGWLMTPB.js";
14
14
  import {
15
15
  CategoryField
16
16
  } from "../chunk-P4Q7JK4L.js";
17
- import "../chunk-75I42HHE.js";
17
+ import "../chunk-AYJGRQT4.js";
18
18
  import {
19
19
  TextField
20
20
  } from "../chunk-3IX2TP4I.js";
21
21
  import {
22
22
  SelectField
23
- } from "../chunk-GCBWZ3MX.js";
23
+ } from "../chunk-6YSGP2WS.js";
24
24
  import {
25
25
  FormContext,
26
26
  useFormContext
@@ -1 +1 @@
1
- {"version":3,"file":"SelectField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/total-form/Fields/SelectField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjD,sDAAsD;AACtD,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,gBAAgB,GAAG,KAAK,CAAC,YAAY,CA2BvG"}
1
+ {"version":3,"file":"SelectField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/total-form/Fields/SelectField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjD,sDAAsD;AACtD,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,gBAAgB,GAAG,KAAK,CAAC,YAAY,CA+BvG"}
@@ -1 +1 @@
1
- {"version":3,"file":"ToggleField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/total-form/Fields/ToggleField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,sDAAsD;AACtD,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,gBAAgB,GAAG,KAAK,CAAC,YAAY,CA6B1F"}
1
+ {"version":3,"file":"ToggleField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/total-form/Fields/ToggleField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,sDAAsD;AACtD,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,gBAAgB,GAAG,KAAK,CAAC,YAAY,CAgC1F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@12-apps/ui",
3
- "version": "6.85.0",
3
+ "version": "6.86.0",
4
4
  "license": "MIT",
5
5
  "packageManager": "pnpm@10.34.5",
6
6
  "type": "module",
@@ -44,6 +44,10 @@ export function SelectField({ name, options, label, placeholder }: SelectFieldPr
44
44
  placeholder={placeholder}
45
45
  value={values[name] ?? ''}
46
46
  error={Boolean(error)}
47
+ // The `<label htmlFor>` above names nothing: the combobox is MUI's
48
+ // display div, not a labelable element. `Select` puts `aria-label` on
49
+ // that div, so the question names the control (FUT-4157).
50
+ aria-label={label}
47
51
  data-testid={testId}
48
52
  onChange={(event) => setFieldValue(name, String(event.target.value))}
49
53
  />
@@ -44,6 +44,9 @@ export function ToggleField({ name, options, label }: ToggleFieldProps): React.R
44
44
  options={options}
45
45
  value={values[name] ?? ''}
46
46
  fullWidth
47
+ // A `role="group"` div is not labelable, so the `<label htmlFor>`
48
+ // above names nothing; the group carries the question itself (FUT-4157).
49
+ aria-label={label}
47
50
  dataTestId={testId}
48
51
  onChange={(_event, next) => {
49
52
  if (typeof next === 'string') setFieldValue(name, next);