@mittwald/flow-react-components 1.4.11 → 1.4.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/AGENTS.md +10 -7
  2. package/dist/assets/component-index.json +1 -1
  3. package/dist/assets/doc-properties.json +1 -1
  4. package/dist/js/packages/components/src/components/Autocomplete/Autocomplete.mjs +14 -7
  5. package/dist/js/packages/components/src/components/Autocomplete/Autocomplete.mjs.map +1 -1
  6. package/dist/js/packages/components/src/components/Checkbox/Checkbox.mjs +3 -3
  7. package/dist/js/packages/components/src/components/Checkbox/Checkbox.mjs.map +1 -1
  8. package/dist/js/packages/components/src/components/CheckboxButton/CheckboxButton.mjs +3 -3
  9. package/dist/js/packages/components/src/components/CheckboxButton/CheckboxButton.mjs.map +1 -1
  10. package/dist/js/packages/components/src/components/CheckboxGroup/CheckboxGroup.mjs +3 -3
  11. package/dist/js/packages/components/src/components/CheckboxGroup/CheckboxGroup.mjs.map +1 -1
  12. package/dist/js/packages/components/src/components/CodeEditor/CodeEditor.mjs +24 -10
  13. package/dist/js/packages/components/src/components/CodeEditor/CodeEditor.mjs.map +1 -1
  14. package/dist/js/packages/components/src/components/ComboBox/ComboBox.mjs +3 -3
  15. package/dist/js/packages/components/src/components/ComboBox/ComboBox.mjs.map +1 -1
  16. package/dist/js/packages/components/src/components/DatePicker/DatePicker.mjs +3 -3
  17. package/dist/js/packages/components/src/components/DatePicker/DatePicker.mjs.map +1 -1
  18. package/dist/js/packages/components/src/components/DateRangePicker/DateRangePicker.mjs +3 -2
  19. package/dist/js/packages/components/src/components/DateRangePicker/DateRangePicker.mjs.map +1 -1
  20. package/dist/js/packages/components/src/components/FieldError/FieldError.mjs +40 -31
  21. package/dist/js/packages/components/src/components/FieldError/FieldError.mjs.map +1 -1
  22. package/dist/js/packages/components/src/components/FileDropZone/FileDropZone.mjs +8 -6
  23. package/dist/js/packages/components/src/components/FileDropZone/FileDropZone.mjs.map +1 -1
  24. package/dist/js/packages/components/src/components/FileField/FileField.mjs +3 -3
  25. package/dist/js/packages/components/src/components/FileField/FileField.mjs.map +1 -1
  26. package/dist/js/packages/components/src/components/NumberField/NumberField.mjs +3 -2
  27. package/dist/js/packages/components/src/components/NumberField/NumberField.mjs.map +1 -1
  28. package/dist/js/packages/components/src/components/PasswordCreationField/PasswordCreationField.mjs +42 -19
  29. package/dist/js/packages/components/src/components/PasswordCreationField/PasswordCreationField.mjs.map +1 -1
  30. package/dist/js/packages/components/src/components/PasswordCreationField/components/ComplexityIndicator/ComplexityIndicator.mjs +2 -2
  31. package/dist/js/packages/components/src/components/PasswordCreationField/components/ComplexityIndicator/ComplexityIndicator.mjs.map +1 -1
  32. package/dist/js/packages/components/src/components/PasswordCreationField/lib/usePolicyValidationResult.mjs +12 -0
  33. package/dist/js/packages/components/src/components/PasswordCreationField/lib/usePolicyValidationResult.mjs.map +1 -1
  34. package/dist/js/packages/components/src/components/RadioGroup/RadioGroup.mjs +3 -2
  35. package/dist/js/packages/components/src/components/RadioGroup/RadioGroup.mjs.map +1 -1
  36. package/dist/js/packages/components/src/components/Rating/Rating.mjs +3 -2
  37. package/dist/js/packages/components/src/components/Rating/Rating.mjs.map +1 -1
  38. package/dist/js/packages/components/src/components/SearchField/SearchField.mjs +3 -3
  39. package/dist/js/packages/components/src/components/SearchField/SearchField.mjs.map +1 -1
  40. package/dist/js/packages/components/src/components/SegmentedControl/SegmentedControl.mjs +3 -2
  41. package/dist/js/packages/components/src/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
  42. package/dist/js/packages/components/src/components/Select/Select.mjs +3 -3
  43. package/dist/js/packages/components/src/components/Select/Select.mjs.map +1 -1
  44. package/dist/js/packages/components/src/components/Slider/Slider.mjs +4 -3
  45. package/dist/js/packages/components/src/components/Slider/Slider.mjs.map +1 -1
  46. package/dist/js/packages/components/src/components/Switch/Switch.mjs +3 -2
  47. package/dist/js/packages/components/src/components/Switch/Switch.mjs.map +1 -1
  48. package/dist/js/packages/components/src/components/TextArea/TextArea.mjs +3 -3
  49. package/dist/js/packages/components/src/components/TextArea/TextArea.mjs.map +1 -1
  50. package/dist/js/packages/components/src/components/TextField/TextField.mjs +3 -3
  51. package/dist/js/packages/components/src/components/TextField/TextField.mjs.map +1 -1
  52. package/dist/js/packages/components/src/components/TimeField/TimeField.mjs +3 -2
  53. package/dist/js/packages/components/src/components/TimeField/TimeField.mjs.map +1 -1
  54. package/dist/js/packages/components/src/lib/hooks/fieldErrorRenderedContext.mjs +16 -0
  55. package/dist/js/packages/components/src/lib/hooks/fieldErrorRenderedContext.mjs.map +1 -0
  56. package/dist/js/packages/components/src/lib/hooks/useFieldComponent.mjs +8 -7
  57. package/dist/js/packages/components/src/lib/hooks/useFieldComponent.mjs.map +1 -1
  58. package/dist/js/packages/components/src/lib/hooks/useFieldError.mjs +34 -21
  59. package/dist/js/packages/components/src/lib/hooks/useFieldError.mjs.map +1 -1
  60. package/dist/types/components/FileField/FileField.d.ts +1 -1
  61. package/dist/types/components/PasswordCreationField/components/ComplexityIndicator/ComplexityIndicator.d.ts +5 -0
  62. package/dist/types/lib/hooks/fieldErrorRenderedContext.d.ts +1 -0
  63. package/dist/types/lib/hooks/useFieldComponent.d.ts +15 -4
  64. package/dist/types/lib/hooks/useFieldError.d.ts +7 -1
  65. package/package.json +9 -9
@@ -19,7 +19,7 @@ import * as Aria from "react-aria-components";
19
19
  /** @flr-generate all */
20
20
  var SearchField = flowComponent("SearchField", (props) => {
21
21
  const { children, className, ref, ...rest } = useControlledHostValueProps(props, "");
22
- const { FieldErrorView, FieldErrorCaptureContext, fieldProps, fieldPropsContext } = useFieldComponent(props, "SearchField");
22
+ const { FieldErrorView, FieldErrorCaptureContext, wrapperProps, controlProps, fieldPropsContext } = useFieldComponent(props, "SearchField");
23
23
  const rootClassName = clsx(FormField_module_default.formField, SearchField_module_default.searchField, className);
24
24
  const searchText = useLocalizedStringFormatter(__locale_default, "SearchField").format(`search`);
25
25
  const propsContext = {
@@ -35,9 +35,9 @@ var SearchField = flowComponent("SearchField", (props) => {
35
35
  };
36
36
  return /* @__PURE__ */ jsxs(Aria.SearchField, {
37
37
  ...rest,
38
- ...fieldProps,
38
+ ...controlProps,
39
39
  "aria-label": searchText,
40
- className: clsx(rootClassName, fieldProps.className),
40
+ className: clsx(rootClassName, wrapperProps.className),
41
41
  children: [/* @__PURE__ */ jsxs(PropsContextProvider, {
42
42
  props: propsContext,
43
43
  children: [/* @__PURE__ */ jsx(FieldErrorCaptureContext, { children }), /* @__PURE__ */ jsxs("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"SearchField.mjs","names":[],"sources":["../../../../../../../src/components/SearchField/SearchField.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport styles from \"./SearchField.module.scss\";\nimport clsx from \"clsx\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { Button } from \"@/components/Button\";\nimport { IconClose, IconSearch } from \"@/components/Icon/components/icons\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider/useLocalizedStringFormatter\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { useControlledHostValueProps } from \"@/lib/remote/useControlledHostValueProps\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\n\nexport interface SearchFieldProps\n extends\n PropsWithChildren<Omit<Aria.SearchFieldProps, \"children\">>,\n FlowComponentProps<HTMLInputElement> {}\n\n/** @flr-generate all */\nexport const SearchField = flowComponent(\"SearchField\", (props) => {\n const { children, className, ref, ...rest } = useControlledHostValueProps(\n props,\n \"\",\n );\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldProps,\n fieldPropsContext,\n } = useFieldComponent(props, \"SearchField\");\n\n const rootClassName = clsx(\n formFieldStyles.formField,\n styles.searchField,\n className,\n );\n\n const stringFormatter = useLocalizedStringFormatter(locales, \"SearchField\");\n const searchText = stringFormatter.format(`search`);\n\n const propsContext: PropsContext = {\n Kbd: {\n isDisabled: props.isDisabled,\n tunnel: {\n id: \"kbd\",\n component: \"SearchField\",\n },\n className: styles.kbd,\n },\n ...fieldPropsContext,\n };\n\n return (\n <Aria.SearchField\n {...rest}\n {...fieldProps}\n aria-label={searchText}\n className={clsx(rootClassName, fieldProps.className)}\n >\n <PropsContextProvider props={propsContext}>\n <FieldErrorCaptureContext>{children}</FieldErrorCaptureContext>\n\n <div className={styles.inputContainer}>\n <IconSearch className={styles.searchIcon} />\n <Aria.Input\n placeholder={searchText}\n className={styles.input}\n ref={ref}\n />\n <UiComponentTunnelExit id=\"kbd\" component=\"SearchField\" />\n <Button\n className={styles.clearButton}\n variant=\"plain\"\n color=\"secondary\"\n >\n <IconClose />\n </Button>\n </div>\n </PropsContextProvider>\n <FieldErrorView />\n </Aria.SearchField>\n );\n});\n\nexport default SearchField;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBA,IAAa,cAAc,cAAc,gBAAgB,UAAU;CACjE,MAAM,EAAE,UAAU,WAAW,KAAK,GAAG,SAAS,4BAC5C,OACA,EACF;CAEA,MAAM,EACJ,gBACA,0BACA,YACA,sBACE,kBAAkB,OAAO,aAAa;CAE1C,MAAM,gBAAgB,KACpB,yBAAgB,WAChB,2BAAO,aACP,SACF;CAGA,MAAM,aADkB,4BAA4B,kBAAS,aAC1C,CAAA,CAAgB,OAAO,QAAQ;CAElD,MAAM,eAA6B;EACjC,KAAK;GACH,YAAY,MAAM;GAClB,QAAQ;IACN,IAAI;IACJ,WAAW;GACb;GACA,WAAW,2BAAO;EACpB;EACA,GAAG;CACL;CAEA,OACE,qBAAC,KAAK,aAAN;EACE,GAAI;EACJ,GAAI;EACJ,cAAY;EACZ,WAAW,KAAK,eAAe,WAAW,SAAS;EAJrD,UAAA,CAME,qBAAC,sBAAD;GAAsB,OAAO;GAA7B,UAAA,CACE,oBAAC,0BAAD,EAA2B,SAAmC,CAAA,GAE9D,qBAAC,OAAD;IAAK,WAAW,2BAAO;IAAvB,UAAA;KACE,oBAAC,YAAD,EAAY,WAAW,2BAAO,WAAa,CAAA;KAC3C,oBAAC,KAAK,OAAN;MACE,aAAa;MACb,WAAW,2BAAO;MACb;KACN,CAAA;KACD,oBAAC,uBAAD;MAAuB,IAAG;MAAM,WAAU;KAAe,CAAA;KACzD,oBAAC,QAAD;MACE,WAAW,2BAAO;MAClB,SAAQ;MACR,OAAM;MAEN,UAAA,oBAAC,WAAD,CAAY,CAAA;KACN,CAAA;IACL;GACe,CAAA,CAAA;EACtB,CAAA,GAAA,oBAAC,gBAAD,CAAiB,CAAA,CACD;;AAEtB,CAAC"}
1
+ {"version":3,"file":"SearchField.mjs","names":[],"sources":["../../../../../../../src/components/SearchField/SearchField.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport styles from \"./SearchField.module.scss\";\nimport clsx from \"clsx\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { Button } from \"@/components/Button\";\nimport { IconClose, IconSearch } from \"@/components/Icon/components/icons\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider/useLocalizedStringFormatter\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { useControlledHostValueProps } from \"@/lib/remote/useControlledHostValueProps\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\n\nexport interface SearchFieldProps\n extends\n PropsWithChildren<Omit<Aria.SearchFieldProps, \"children\">>,\n FlowComponentProps<HTMLInputElement> {}\n\n/** @flr-generate all */\nexport const SearchField = flowComponent(\"SearchField\", (props) => {\n const { children, className, ref, ...rest } = useControlledHostValueProps(\n props,\n \"\",\n );\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n wrapperProps,\n controlProps,\n fieldPropsContext,\n } = useFieldComponent(props, \"SearchField\");\n\n const rootClassName = clsx(\n formFieldStyles.formField,\n styles.searchField,\n className,\n );\n\n const stringFormatter = useLocalizedStringFormatter(locales, \"SearchField\");\n const searchText = stringFormatter.format(`search`);\n\n const propsContext: PropsContext = {\n Kbd: {\n isDisabled: props.isDisabled,\n tunnel: {\n id: \"kbd\",\n component: \"SearchField\",\n },\n className: styles.kbd,\n },\n ...fieldPropsContext,\n };\n\n return (\n <Aria.SearchField\n {...rest}\n {...controlProps}\n aria-label={searchText}\n className={clsx(rootClassName, wrapperProps.className)}\n >\n <PropsContextProvider props={propsContext}>\n <FieldErrorCaptureContext>{children}</FieldErrorCaptureContext>\n\n <div className={styles.inputContainer}>\n <IconSearch className={styles.searchIcon} />\n <Aria.Input\n placeholder={searchText}\n className={styles.input}\n ref={ref}\n />\n <UiComponentTunnelExit id=\"kbd\" component=\"SearchField\" />\n <Button\n className={styles.clearButton}\n variant=\"plain\"\n color=\"secondary\"\n >\n <IconClose />\n </Button>\n </div>\n </PropsContextProvider>\n <FieldErrorView />\n </Aria.SearchField>\n );\n});\n\nexport default SearchField;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBA,IAAa,cAAc,cAAc,gBAAgB,UAAU;CACjE,MAAM,EAAE,UAAU,WAAW,KAAK,GAAG,SAAS,4BAC5C,OACA,EACF;CAEA,MAAM,EACJ,gBACA,0BACA,cACA,cACA,sBACE,kBAAkB,OAAO,aAAa;CAE1C,MAAM,gBAAgB,KACpB,yBAAgB,WAChB,2BAAO,aACP,SACF;CAGA,MAAM,aADkB,4BAA4B,kBAAS,aAC1C,CAAA,CAAgB,OAAO,QAAQ;CAElD,MAAM,eAA6B;EACjC,KAAK;GACH,YAAY,MAAM;GAClB,QAAQ;IACN,IAAI;IACJ,WAAW;GACb;GACA,WAAW,2BAAO;EACpB;EACA,GAAG;CACL;CAEA,OACE,qBAAC,KAAK,aAAN;EACE,GAAI;EACJ,GAAI;EACJ,cAAY;EACZ,WAAW,KAAK,eAAe,aAAa,SAAS;EAJvD,UAAA,CAME,qBAAC,sBAAD;GAAsB,OAAO;GAA7B,UAAA,CACE,oBAAC,0BAAD,EAA2B,SAAmC,CAAA,GAE9D,qBAAC,OAAD;IAAK,WAAW,2BAAO;IAAvB,UAAA;KACE,oBAAC,YAAD,EAAY,WAAW,2BAAO,WAAa,CAAA;KAC3C,oBAAC,KAAK,OAAN;MACE,aAAa;MACb,WAAW,2BAAO;MACb;KACN,CAAA;KACD,oBAAC,uBAAD;MAAuB,IAAG;MAAM,WAAU;KAAe,CAAA;KACzD,oBAAC,QAAD;MACE,WAAW,2BAAO;MAClB,SAAQ;MACR,OAAM;MAEN,UAAA,oBAAC,WAAD,CAAY,CAAA;KACN,CAAA;IACL;GACe,CAAA,CAAA;EACtB,CAAA,GAAA,oBAAC,gBAAD,CAAiB,CAAA,CACD;;AAEtB,CAAC"}
@@ -22,7 +22,7 @@ import * as Aria from "react-aria-components";
22
22
  var SegmentedControl = flowComponent("SegmentedControl", (props) => {
23
23
  useWarnDeprecation()("The 'SegmentedControl' component is deprecated and will be removed in a future release. Use 'Tabs' instead when it switches content, or 'RadioGroup' instead when it sets a value.");
24
24
  const { children, className, containerBreakpointSize = "m", ref, ...rest } = props;
25
- const { FieldErrorView, fieldPropsContext, fieldProps, FieldErrorCaptureContext } = useFieldComponent(props, "SegmentedControl");
25
+ const { FieldErrorView, fieldPropsContext, wrapperProps, controlProps, FieldErrorCaptureContext } = useFieldComponent(props, "SegmentedControl");
26
26
  const rootClassName = clsx(FormField_module_default.formField, SegmentedControl_module_default.segmentedControlContainer, SegmentedControl_module_default[getContainerBreakpointSizeClassName(containerBreakpointSize)], className);
27
27
  const propsContext = {
28
28
  Segment: {
@@ -38,7 +38,8 @@ var SegmentedControl = flowComponent("SegmentedControl", (props) => {
38
38
  useMakeFocusable(objectRef);
39
39
  return /* @__PURE__ */ jsxs(Aria.RadioGroup, {
40
40
  ...rest,
41
- className: clsx(rootClassName, fieldProps.className),
41
+ "aria-describedby": controlProps["aria-describedby"],
42
+ className: clsx(rootClassName, wrapperProps.className),
42
43
  ref: objectRef,
43
44
  children: [/* @__PURE__ */ jsx(FieldErrorCaptureContext, { children: /* @__PURE__ */ jsxs(PropsContextProvider, {
44
45
  dependencies: ["segment"],
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentedControl.mjs","names":[],"sources":["../../../../../../../src/components/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport type { PropsWithContainerBreakpointSize } from \"@/lib/types/props\";\nimport { type PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport styles from \"./SegmentedControl.module.scss\";\nimport { getContainerBreakpointSizeClassName } from \"@/lib/getContainerBreakpointSizeClassName\";\nimport { type PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport clsx from \"clsx\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { UiComponentTunnelExit } from \"../UiComponentTunnel/UiComponentTunnelExit\";\nimport { useWarnDeprecation } from \"@/components/DeprecationWarningProvider\";\n\nexport interface SegmentedControlProps\n extends\n PropsWithChildren<Omit<Aria.RadioGroupProps, \"children\" | \"ref\">>,\n FlowComponentProps<HTMLDivElement>,\n PropsWithContainerBreakpointSize {}\n\n/**\n * @deprecated Use `Tabs` to switch content, or `RadioGroup` to select a value.\n * @flr-generate all\n */\nexport const SegmentedControl = flowComponent(\"SegmentedControl\", (props) => {\n const warnDeprecation = useWarnDeprecation();\n warnDeprecation(\n \"The 'SegmentedControl' component is deprecated and will be removed in a future release. Use 'Tabs' instead when it switches content, or 'RadioGroup' instead when it sets a value.\",\n );\n\n const {\n children,\n className,\n containerBreakpointSize = \"m\",\n ref,\n ...rest\n } = props;\n\n const {\n FieldErrorView,\n fieldPropsContext,\n fieldProps,\n FieldErrorCaptureContext,\n } = useFieldComponent(props, \"SegmentedControl\");\n\n const rootClassName = clsx(\n formFieldStyles.formField,\n styles.segmentedControlContainer,\n styles[getContainerBreakpointSizeClassName(containerBreakpointSize)],\n className,\n );\n\n const propsContext: PropsContext = {\n Segment: {\n tunnel: {\n id: \"segments\",\n component: \"SegmentedControl\",\n },\n className: styles.segment,\n },\n ...fieldPropsContext,\n };\n\n const objectRef = useObjectRef(ref);\n useMakeFocusable(objectRef);\n\n return (\n <Aria.RadioGroup\n {...rest}\n className={clsx(rootClassName, fieldProps.className)}\n ref={objectRef}\n >\n <FieldErrorCaptureContext>\n <PropsContextProvider dependencies={[\"segment\"]} props={propsContext}>\n <div className={styles.segmentedControl}>\n <div className={styles.segments}>\n <UiComponentTunnelExit\n id=\"segments\"\n component=\"SegmentedControl\"\n />\n </div>\n </div>\n {children}\n </PropsContextProvider>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </Aria.RadioGroup>\n );\n});\n\nexport default SegmentedControl;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6BA,IAAa,mBAAmB,cAAc,qBAAqB,UAAU;CAE3E,mBAAA,CAAA,CACE,oLACF;CAEA,MAAM,EACJ,UACA,WACA,0BAA0B,KAC1B,KACA,GAAG,SACD;CAEJ,MAAM,EACJ,gBACA,mBACA,YACA,6BACE,kBAAkB,OAAO,kBAAkB;CAE/C,MAAM,gBAAgB,KACpB,yBAAgB,WAChB,gCAAO,2BACP,gCAAO,oCAAoC,uBAAuB,IAClE,SACF;CAEA,MAAM,eAA6B;EACjC,SAAS;GACP,QAAQ;IACN,IAAI;IACJ,WAAW;GACb;GACA,WAAW,gCAAO;EACpB;EACA,GAAG;CACL;CAEA,MAAM,YAAY,aAAa,GAAG;CAClC,iBAAiB,SAAS;CAE1B,OACE,qBAAC,KAAK,YAAN;EACE,GAAI;EACJ,WAAW,KAAK,eAAe,WAAW,SAAS;EACnD,KAAK;EAHP,UAAA,CAKE,oBAAC,0BAAD,EAAA,UACE,qBAAC,sBAAD;GAAsB,cAAc,CAAC,SAAS;GAAG,OAAO;GAAxD,UAAA,CACE,oBAAC,OAAD;IAAK,WAAW,gCAAO;IACrB,UAAA,oBAAC,OAAD;KAAK,WAAW,gCAAO;KACrB,UAAA,oBAAC,uBAAD;MACE,IAAG;MACH,WAAU;KACX,CAAA;IACE,CAAA;GACF,CAAA,GACJ,QACmB;EACE,CAAA,EAAA,CAAA,GAC1B,oBAAC,gBAAD,CAAiB,CAAA,CACF;;AAErB,CAAC"}
1
+ {"version":3,"file":"SegmentedControl.mjs","names":[],"sources":["../../../../../../../src/components/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport type { PropsWithContainerBreakpointSize } from \"@/lib/types/props\";\nimport { type PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport styles from \"./SegmentedControl.module.scss\";\nimport { getContainerBreakpointSizeClassName } from \"@/lib/getContainerBreakpointSizeClassName\";\nimport { type PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport clsx from \"clsx\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { UiComponentTunnelExit } from \"../UiComponentTunnel/UiComponentTunnelExit\";\nimport { useWarnDeprecation } from \"@/components/DeprecationWarningProvider\";\n\nexport interface SegmentedControlProps\n extends\n PropsWithChildren<Omit<Aria.RadioGroupProps, \"children\" | \"ref\">>,\n FlowComponentProps<HTMLDivElement>,\n PropsWithContainerBreakpointSize {}\n\n/**\n * @deprecated Use `Tabs` to switch content, or `RadioGroup` to select a value.\n * @flr-generate all\n */\nexport const SegmentedControl = flowComponent(\"SegmentedControl\", (props) => {\n const warnDeprecation = useWarnDeprecation();\n warnDeprecation(\n \"The 'SegmentedControl' component is deprecated and will be removed in a future release. Use 'Tabs' instead when it switches content, or 'RadioGroup' instead when it sets a value.\",\n );\n\n const {\n children,\n className,\n containerBreakpointSize = \"m\",\n ref,\n ...rest\n } = props;\n\n const {\n FieldErrorView,\n fieldPropsContext,\n wrapperProps,\n controlProps,\n FieldErrorCaptureContext,\n } = useFieldComponent(props, \"SegmentedControl\");\n\n const rootClassName = clsx(\n formFieldStyles.formField,\n styles.segmentedControlContainer,\n styles[getContainerBreakpointSizeClassName(containerBreakpointSize)],\n className,\n );\n\n const propsContext: PropsContext = {\n Segment: {\n tunnel: {\n id: \"segments\",\n component: \"SegmentedControl\",\n },\n className: styles.segment,\n },\n ...fieldPropsContext,\n };\n\n const objectRef = useObjectRef(ref);\n useMakeFocusable(objectRef);\n\n return (\n <Aria.RadioGroup\n {...rest}\n aria-describedby={controlProps[\"aria-describedby\"]}\n className={clsx(rootClassName, wrapperProps.className)}\n ref={objectRef}\n >\n <FieldErrorCaptureContext>\n <PropsContextProvider dependencies={[\"segment\"]} props={propsContext}>\n <div className={styles.segmentedControl}>\n <div className={styles.segments}>\n <UiComponentTunnelExit\n id=\"segments\"\n component=\"SegmentedControl\"\n />\n </div>\n </div>\n {children}\n </PropsContextProvider>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </Aria.RadioGroup>\n );\n});\n\nexport default SegmentedControl;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6BA,IAAa,mBAAmB,cAAc,qBAAqB,UAAU;CAE3E,mBAAA,CAAA,CACE,oLACF;CAEA,MAAM,EACJ,UACA,WACA,0BAA0B,KAC1B,KACA,GAAG,SACD;CAEJ,MAAM,EACJ,gBACA,mBACA,cACA,cACA,6BACE,kBAAkB,OAAO,kBAAkB;CAE/C,MAAM,gBAAgB,KACpB,yBAAgB,WAChB,gCAAO,2BACP,gCAAO,oCAAoC,uBAAuB,IAClE,SACF;CAEA,MAAM,eAA6B;EACjC,SAAS;GACP,QAAQ;IACN,IAAI;IACJ,WAAW;GACb;GACA,WAAW,gCAAO;EACpB;EACA,GAAG;CACL;CAEA,MAAM,YAAY,aAAa,GAAG;CAClC,iBAAiB,SAAS;CAE1B,OACE,qBAAC,KAAK,YAAN;EACE,GAAI;EACJ,oBAAkB,aAAa;EAC/B,WAAW,KAAK,eAAe,aAAa,SAAS;EACrD,KAAK;EAJP,UAAA,CAME,oBAAC,0BAAD,EAAA,UACE,qBAAC,sBAAD;GAAsB,cAAc,CAAC,SAAS;GAAG,OAAO;GAAxD,UAAA,CACE,oBAAC,OAAD;IAAK,WAAW,gCAAO;IACrB,UAAA,oBAAC,OAAD;KAAK,WAAW,gCAAO;KACrB,UAAA,oBAAC,uBAAD;MACE,IAAG;MACH,WAAU;KACX,CAAA;IACE,CAAA;GACF,CAAA,GACJ,QACmB;EACE,CAAA,EAAA,CAAA,GAC1B,oBAAC,gBAAD,CAAiB,CAAA,CACF;;AAErB,CAAC"}
@@ -21,7 +21,7 @@ var Select = flowComponent("Select", (props) => {
21
21
  const { children, className, onChange, onSelectionChange, isReadOnly, ref, ...rest } = props;
22
22
  const warnDeprecation = useWarnDeprecation();
23
23
  if (onSelectionChange !== void 0) warnDeprecation("The 'onSelectionChange' prop is deprecated and will be removed in a future release. Use 'onChange' instead.");
24
- const { FieldErrorView, fieldPropsContext, fieldProps, FieldErrorCaptureContext } = useFieldComponent(props, "Select");
24
+ const { FieldErrorView, fieldPropsContext, wrapperProps, controlProps, FieldErrorCaptureContext } = useFieldComponent(props, "Select");
25
25
  const rootClassName = clsx(Select_module_default.select, FormField_module_default.formField, className);
26
26
  const propsContext = {
27
27
  Option: { tunnel: getOptionsTunnelProps("Select") },
@@ -31,8 +31,8 @@ var Select = flowComponent("Select", (props) => {
31
31
  const isOpen = controller.useIsOpen();
32
32
  return /* @__PURE__ */ jsxs(Aria.Select, {
33
33
  ...rest,
34
- ...fieldProps,
35
- className: clsx(rootClassName, fieldProps.className),
34
+ ...controlProps,
35
+ className: clsx(rootClassName, wrapperProps.className),
36
36
  onChange: (value) => {
37
37
  if (!isReadOnly) {
38
38
  onChange?.(value);
@@ -1 +1 @@
1
- {"version":3,"file":"Select.mjs","names":[],"sources":["../../../../../../../src/components/Select/Select.tsx"],"sourcesContent":["import { type PropsWithChildren } from \"react\";\nimport type { Key } from \"react-aria-components\";\nimport * as Aria from \"react-aria-components\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport styles from \"./Select.module.scss\";\nimport clsx from \"clsx\";\nimport { IconChevronDown } from \"@/components/Icon/components/icons\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { Options } from \"@/components/Options\";\nimport { getOptionsTunnelProps } from \"@/components/Option/optionsTunnel\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport { useOverlayController } from \"@/lib/controller\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { UiComponentTunnelExit } from \"../UiComponentTunnel/UiComponentTunnelExit\";\nimport { useWarnDeprecation } from \"@/components/DeprecationWarningProvider\";\n\nexport interface SelectProps\n extends\n PropsWithChildren<\n Omit<\n Aria.SelectProps<string, \"single\" | \"multiple\">,\n \"children\" | \"className\" | \"ref\"\n >\n >,\n FlowComponentProps<HTMLButtonElement>,\n PropsWithClassName {\n /** Handler that is called when the selected value changes. */\n onChange?: (value: Key | Key[] | null) => void;\n /** @deprecated Use `onChange` instead. */\n onSelectionChange?: (value: Key | Key[] | null) => void;\n /** Whether the component is read only. */\n isReadOnly?: boolean;\n}\n\n/** @flr-generate all */\nexport const Select = flowComponent(\"Select\", (props) => {\n const {\n children,\n className,\n onChange,\n onSelectionChange,\n isReadOnly,\n ref,\n ...rest\n } = props;\n\n const warnDeprecation = useWarnDeprecation();\n if (onSelectionChange !== undefined) {\n warnDeprecation(\n \"The 'onSelectionChange' prop is deprecated and will be removed in a future release. Use 'onChange' instead.\",\n );\n }\n\n const {\n FieldErrorView,\n fieldPropsContext,\n fieldProps,\n FieldErrorCaptureContext,\n } = useFieldComponent(props, \"Select\");\n\n const rootClassName = clsx(\n styles.select,\n formFieldStyles.formField,\n className,\n );\n\n const propsContext: PropsContext = {\n Option: {\n tunnel: getOptionsTunnelProps(\"Select\"),\n },\n ...fieldPropsContext,\n };\n\n const controller = useOverlayController(\"Select\", {\n reuseControllerFromContext: false,\n });\n const isOpen = controller.useIsOpen();\n\n return (\n <Aria.Select\n {...rest}\n {...fieldProps}\n className={clsx(rootClassName, fieldProps.className)}\n onChange={(value) => {\n if (!isReadOnly) {\n onChange?.(value);\n onSelectionChange?.(value);\n }\n }}\n onOpenChange={(isOpen) => !isReadOnly && controller.setOpen(isOpen)}\n isOpen={isOpen}\n data-readonly={isReadOnly}\n >\n <FieldErrorCaptureContext>\n <PropsContextProvider props={propsContext}>\n <Aria.Button\n data-readonly={isReadOnly}\n className={styles.toggle}\n ref={ref}\n >\n <Aria.SelectValue>\n {({ selectedText, isPlaceholder }) =>\n isPlaceholder || !selectedText ? undefined : selectedText\n }\n </Aria.SelectValue>\n <IconChevronDown />\n </Aria.Button>\n {children}\n <Options controller={controller}>\n <UiComponentTunnelExit id=\"options\" component=\"Select\" />\n </Options>\n </PropsContextProvider>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </Aria.Select>\n );\n});\n\nexport default Select;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsCA,IAAa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../src/components/Select/Select.tsx"],"sourcesContent":["import { type PropsWithChildren } from \"react\";\nimport type { Key } from \"react-aria-components\";\nimport * as Aria from \"react-aria-components\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport styles from \"./Select.module.scss\";\nimport clsx from \"clsx\";\nimport { IconChevronDown } from \"@/components/Icon/components/icons\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { Options } from \"@/components/Options\";\nimport { getOptionsTunnelProps } from \"@/components/Option/optionsTunnel\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport { useOverlayController } from \"@/lib/controller\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { UiComponentTunnelExit } from \"../UiComponentTunnel/UiComponentTunnelExit\";\nimport { useWarnDeprecation } from \"@/components/DeprecationWarningProvider\";\n\nexport interface SelectProps\n extends\n PropsWithChildren<\n Omit<\n Aria.SelectProps<string, \"single\" | \"multiple\">,\n \"children\" | \"className\" | \"ref\"\n >\n >,\n FlowComponentProps<HTMLButtonElement>,\n PropsWithClassName {\n /** Handler that is called when the selected value changes. */\n onChange?: (value: Key | Key[] | null) => void;\n /** @deprecated Use `onChange` instead. */\n onSelectionChange?: (value: Key | Key[] | null) => void;\n /** Whether the component is read only. */\n isReadOnly?: boolean;\n}\n\n/** @flr-generate all */\nexport const Select = flowComponent(\"Select\", (props) => {\n const {\n children,\n className,\n onChange,\n onSelectionChange,\n isReadOnly,\n ref,\n ...rest\n } = props;\n\n const warnDeprecation = useWarnDeprecation();\n if (onSelectionChange !== undefined) {\n warnDeprecation(\n \"The 'onSelectionChange' prop is deprecated and will be removed in a future release. Use 'onChange' instead.\",\n );\n }\n\n const {\n FieldErrorView,\n fieldPropsContext,\n wrapperProps,\n controlProps,\n FieldErrorCaptureContext,\n } = useFieldComponent(props, \"Select\");\n\n const rootClassName = clsx(\n styles.select,\n formFieldStyles.formField,\n className,\n );\n\n const propsContext: PropsContext = {\n Option: {\n tunnel: getOptionsTunnelProps(\"Select\"),\n },\n ...fieldPropsContext,\n };\n\n const controller = useOverlayController(\"Select\", {\n reuseControllerFromContext: false,\n });\n const isOpen = controller.useIsOpen();\n\n return (\n <Aria.Select\n {...rest}\n {...controlProps}\n className={clsx(rootClassName, wrapperProps.className)}\n onChange={(value) => {\n if (!isReadOnly) {\n onChange?.(value);\n onSelectionChange?.(value);\n }\n }}\n onOpenChange={(isOpen) => !isReadOnly && controller.setOpen(isOpen)}\n isOpen={isOpen}\n data-readonly={isReadOnly}\n >\n <FieldErrorCaptureContext>\n <PropsContextProvider props={propsContext}>\n <Aria.Button\n data-readonly={isReadOnly}\n className={styles.toggle}\n ref={ref}\n >\n <Aria.SelectValue>\n {({ selectedText, isPlaceholder }) =>\n isPlaceholder || !selectedText ? undefined : selectedText\n }\n </Aria.SelectValue>\n <IconChevronDown />\n </Aria.Button>\n {children}\n <Options controller={controller}>\n <UiComponentTunnelExit id=\"options\" component=\"Select\" />\n </Options>\n </PropsContextProvider>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </Aria.Select>\n );\n});\n\nexport default Select;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsCA,IAAa,SAAS,cAAc,WAAW,UAAU;CACvD,MAAM,EACJ,UACA,WACA,UACA,mBACA,YACA,KACA,GAAG,SACD;CAEJ,MAAM,kBAAkB,mBAAmB;CAC3C,IAAI,sBAAsB,KAAA,GACxB,gBACE,6GACF;CAGF,MAAM,EACJ,gBACA,mBACA,cACA,cACA,6BACE,kBAAkB,OAAO,QAAQ;CAErC,MAAM,gBAAgB,KACpB,sBAAO,QACP,yBAAgB,WAChB,SACF;CAEA,MAAM,eAA6B;EACjC,QAAQ,EACN,QAAQ,sBAAsB,QAAQ,EACxC;EACA,GAAG;CACL;CAEA,MAAM,aAAa,qBAAqB,UAAU,EAChD,4BAA4B,MAC9B,CAAC;CACD,MAAM,SAAS,WAAW,UAAU;CAEpC,OACE,qBAAC,KAAK,QAAN;EACE,GAAI;EACJ,GAAI;EACJ,WAAW,KAAK,eAAe,aAAa,SAAS;EACrD,WAAW,UAAU;GACnB,IAAI,CAAC,YAAY;IACf,WAAW,KAAK;IAChB,oBAAoB,KAAK;GAC3B;EACF;EACA,eAAe,WAAW,CAAC,cAAc,WAAW,QAAQ,MAAM;EAC1D;EACR,iBAAe;EAZjB,UAAA,CAcE,oBAAC,0BAAD,EAAA,UACE,qBAAC,sBAAD;GAAsB,OAAO;GAA7B,UAAA;IACE,qBAAC,KAAK,QAAN;KACE,iBAAe;KACf,WAAW,sBAAO;KACb;KAHP,UAAA,CAKE,oBAAC,KAAK,aAAN,EAAA,WACI,EAAE,cAAc,oBAChB,iBAAiB,CAAC,eAAe,KAAA,IAAY,aAE/B,CAAA,GAClB,oBAAC,iBAAD,CAAkB,CAAA,CACP;;IACZ;IACD,oBAAC,SAAD;KAAqB;KACnB,UAAA,oBAAC,uBAAD;MAAuB,IAAG;MAAU,WAAU;KAAU,CAAA;IACjD,CAAA;GACW;EACE,CAAA,EAAA,CAAA,GAC1B,oBAAC,gBAAD,CAAiB,CAAA,CACN;;AAEjB,CAAC"}
@@ -17,9 +17,9 @@ import * as Aria from "react-aria-components";
17
17
  //#region src/components/Slider/Slider.tsx
18
18
  /** @flr-generate all */
19
19
  var Slider = flowComponent("Slider", (props) => {
20
- const { className, children, name, isDisabled, defaultValue, showInitialMarker, isReadOnly, ref, step, sliderOnly, ...rest } = props;
20
+ const { className, children, name, isDisabled, defaultValue, showInitialMarker, isReadOnly, ref, step, sliderOnly, "aria-describedby": ignoredAriaDescribedBy, ...rest } = props;
21
21
  const rootClassName = clsx(Slider_module_default.slider, isDisabled && Slider_module_default.disabled, className);
22
- const { FieldErrorView, FieldErrorCaptureContext, fieldPropsContext, fieldProps } = useFieldComponent(props, "Slider");
22
+ const { FieldErrorView, FieldErrorCaptureContext, fieldPropsContext, wrapperProps, controlProps } = useFieldComponent(props, "Slider");
23
23
  const stringFormatter = useLocalizedStringFormatter(__locale_default, "Slider");
24
24
  const objectRef = useObjectRef(ref);
25
25
  const propsContext = {
@@ -34,7 +34,7 @@ var Slider = flowComponent("Slider", (props) => {
34
34
  }
35
35
  };
36
36
  return /* @__PURE__ */ jsx("div", {
37
- ...fieldProps,
37
+ className: wrapperProps.className,
38
38
  children: /* @__PURE__ */ jsx(Aria.Slider, {
39
39
  ...rest,
40
40
  className: rootClassName,
@@ -92,6 +92,7 @@ var Slider = flowComponent("Slider", (props) => {
92
92
  }),
93
93
  /* @__PURE__ */ jsx(Aria.SliderThumb, {
94
94
  inputRef: objectRef,
95
+ "aria-describedby": controlProps["aria-describedby"],
95
96
  name,
96
97
  className: Slider_module_default.handle,
97
98
  isDisabled: isReadOnly
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.mjs","names":[],"sources":["../../../../../../../src/components/Slider/Slider.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport styles from \"./Slider.module.scss\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { Button } from \"@/components/Button\";\nimport { IconMinus, IconPlus } from \"@/components/Icon/components/icons\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider/useLocalizedStringFormatter\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\n\nexport interface SliderProps\n extends\n FlowComponentProps<HTMLInputElement>,\n PropsWithChildren<Aria.SliderProps>,\n Pick<Aria.SliderThumbProps, \"name\"> {\n /** Whether the marker for the initial value should be visible */\n showInitialMarker?: boolean;\n /** Whether the component is read only. */\n isReadOnly?: boolean;\n /** Whether the component is invalid. */\n isInvalid?: boolean;\n /** Hide Buttons, Label and Value */\n sliderOnly?: boolean;\n}\n\n/** @flr-generate all */\nexport const Slider = flowComponent(\"Slider\", (props) => {\n const {\n className,\n children,\n name,\n isDisabled,\n defaultValue,\n showInitialMarker,\n isReadOnly,\n ref,\n step,\n sliderOnly,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.slider,\n isDisabled && styles.disabled,\n className,\n );\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n fieldProps,\n } = useFieldComponent(props, \"Slider\");\n\n const stringFormatter = useLocalizedStringFormatter(locales, \"Slider\");\n\n const objectRef = useObjectRef(ref);\n\n const propsContext: PropsContext = {\n ...fieldPropsContext,\n Label: {\n tunnel: {\n id: \"label\",\n component: \"Slider\",\n },\n ...fieldPropsContext.Label,\n className: styles.label,\n },\n };\n\n return (\n <div {...fieldProps}>\n <Aria.Slider\n {...rest}\n className={rootClassName}\n isDisabled={isDisabled}\n defaultValue={defaultValue}\n step={step}\n >\n <PropsContextProvider props={propsContext}>\n <FieldErrorCaptureContext>{children}</FieldErrorCaptureContext>\n\n {!sliderOnly && (\n <div className={styles.text}>\n <Aria.SliderOutput className={styles.value} />{\" \"}\n <UiComponentTunnelExit id=\"label\" component=\"Slider\" />\n </div>\n )}\n\n <Aria.SliderTrack className={styles.track}>\n {({ state }) => (\n <PropsContextProvider\n props={{\n Button: {\n isPending: false,\n isFailed: false,\n isSucceeded: false,\n isReadOnly: isReadOnly,\n excludeFromTabOrder: true,\n isDisabled,\n variant: \"plain\",\n color: \"secondary\",\n size: \"s\",\n },\n }}\n >\n {!sliderOnly && (\n <>\n <Button\n onPress={() => state.decrementThumb(0, step)}\n aria-label={stringFormatter.format(\"decrement\")}\n className={styles.decrement}\n >\n <IconMinus />\n </Button>\n <Button\n onPress={() => state.incrementThumb(0, step)}\n aria-label={stringFormatter.format(\"increment\")}\n className={styles.increment}\n >\n <IconPlus />\n </Button>\n </>\n )}\n\n <div\n className={styles.fill}\n style={{\n \"--slider--value\": state.getThumbPercent(0),\n }}\n />\n\n {showInitialMarker &&\n defaultValue &&\n typeof defaultValue === \"number\" && (\n <div\n className={styles.initialMarker}\n style={{\n \"--slider--initial-value\":\n state.getValuePercent(defaultValue),\n }}\n />\n )}\n <Aria.SliderThumb\n inputRef={objectRef}\n name={name}\n className={styles.handle}\n isDisabled={isReadOnly}\n />\n </PropsContextProvider>\n )}\n </Aria.SliderTrack>\n <FieldErrorView />\n </PropsContextProvider>\n </Aria.Slider>\n </div>\n );\n});\n\nexport default Slider;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgCA,IAAa,SAAS,cAAc,WAAW,UAAU;CACvD,MAAM,EACJ,WACA,UACA,MACA,YACA,cACA,mBACA,YACA,KACA,MACA,YACA,GAAG,SACD;CAEJ,MAAM,gBAAgB,KACpB,sBAAO,QACP,cAAc,sBAAO,UACrB,SACF;CAEA,MAAM,EACJ,gBACA,0BACA,mBACA,eACE,kBAAkB,OAAO,QAAQ;CAErC,MAAM,kBAAkB,4BAA4B,kBAAS,QAAQ;CAErE,MAAM,YAAY,aAAa,GAAG;CAElC,MAAM,eAA6B;EACjC,GAAG;EACH,OAAO;GACL,QAAQ;IACN,IAAI;IACJ,WAAW;GACb;GACA,GAAG,kBAAkB;GACrB,WAAW,sBAAO;EACpB;CACF;CAEA,OACE,oBAAC,OAAD;EAAK,GAAI;EACP,UAAA,oBAAC,KAAK,QAAN;GACE,GAAI;GACJ,WAAW;GACC;GACE;GACR;GAEN,UAAA,qBAAC,sBAAD;IAAsB,OAAO;IAA7B,UAAA;KACE,oBAAC,0BAAD,EAA2B,SAAmC,CAAA;KAE7D,CAAC,cACA,qBAAC,OAAD;MAAK,WAAW,sBAAO;MAAvB,UAAA;OACE,oBAAC,KAAK,cAAN,EAAmB,WAAW,sBAAO,MAAQ,CAAA;OAAE;OAC/C,oBAAC,uBAAD;QAAuB,IAAG;QAAQ,WAAU;OAAU,CAAA;MACnD;;KAGP,oBAAC,KAAK,aAAN;MAAkB,WAAW,sBAAO;MAChC,WAAA,EAAE,YACF,qBAAC,sBAAD;OACE,OAAO,EACL,QAAQ;QACN,WAAW;QACX,UAAU;QACV,aAAa;QACD;QACZ,qBAAqB;QACrB;QACA,SAAS;QACT,OAAO;QACP,MAAM;OACR,EACF;OAbF,UAAA;QAeG,CAAC,cACA,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,QAAD;SACE,eAAe,MAAM,eAAe,GAAG,IAAI;SAC3C,cAAY,gBAAgB,OAAO,WAAW;SAC9C,WAAW,sBAAO;SAElB,UAAA,oBAAC,WAAD,CAAY,CAAA;QACN,CAAA,GACR,oBAAC,QAAD;SACE,eAAe,MAAM,eAAe,GAAG,IAAI;SAC3C,cAAY,gBAAgB,OAAO,WAAW;SAC9C,WAAW,sBAAO;SAElB,UAAA,oBAAC,UAAD,CAAW,CAAA;QACL,CAAA,CACR,EAAA,CAAA;QAGJ,oBAAC,OAAD;SACE,WAAW,sBAAO;SAClB,OAAO,EACL,mBAAmB,MAAM,gBAAgB,CAAC,EAC5C;QACD,CAAA;QAEA,qBACC,gBACA,OAAO,iBAAiB,YACtB,oBAAC,OAAD;SACE,WAAW,sBAAO;SAClB,OAAO,EACL,2BACE,MAAM,gBAAgB,YAAY,EACtC;QACD,CAAA;QAEL,oBAAC,KAAK,aAAN;SACE,UAAU;SACJ;SACN,WAAW,sBAAO;SAClB,YAAY;QACb,CAAA;OACmB;;KAER,CAAA;KAClB,oBAAC,gBAAD,CAAiB,CAAA;IACG;;EACX,CAAA;CACV,CAAA;AAET,CAAC"}
1
+ {"version":3,"file":"Slider.mjs","names":[],"sources":["../../../../../../../src/components/Slider/Slider.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport styles from \"./Slider.module.scss\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { Button } from \"@/components/Button\";\nimport { IconMinus, IconPlus } from \"@/components/Icon/components/icons\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider/useLocalizedStringFormatter\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\n\nexport interface SliderProps\n extends\n FlowComponentProps<HTMLInputElement>,\n PropsWithChildren<Aria.SliderProps>,\n Pick<Aria.SliderThumbProps, \"name\"> {\n /** Whether the marker for the initial value should be visible */\n showInitialMarker?: boolean;\n /** Whether the component is read only. */\n isReadOnly?: boolean;\n /** Whether the component is invalid. */\n isInvalid?: boolean;\n /** Hide Buttons, Label and Value */\n sliderOnly?: boolean;\n}\n\n/** @flr-generate all */\nexport const Slider = flowComponent(\"Slider\", (props) => {\n const {\n className,\n children,\n name,\n isDisabled,\n defaultValue,\n showInitialMarker,\n isReadOnly,\n ref,\n step,\n sliderOnly,\n // Reaches the thumb through `controlProps` – react-aria would add it a\n // second time from the slider.\n \"aria-describedby\": ignoredAriaDescribedBy,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.slider,\n isDisabled && styles.disabled,\n className,\n );\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n wrapperProps,\n controlProps,\n } = useFieldComponent(props, \"Slider\");\n\n const stringFormatter = useLocalizedStringFormatter(locales, \"Slider\");\n\n const objectRef = useObjectRef(ref);\n\n const propsContext: PropsContext = {\n ...fieldPropsContext,\n Label: {\n tunnel: {\n id: \"label\",\n component: \"Slider\",\n },\n ...fieldPropsContext.Label,\n className: styles.label,\n },\n };\n\n return (\n <div className={wrapperProps.className}>\n <Aria.Slider\n {...rest}\n className={rootClassName}\n isDisabled={isDisabled}\n defaultValue={defaultValue}\n step={step}\n >\n <PropsContextProvider props={propsContext}>\n <FieldErrorCaptureContext>{children}</FieldErrorCaptureContext>\n\n {!sliderOnly && (\n <div className={styles.text}>\n <Aria.SliderOutput className={styles.value} />{\" \"}\n <UiComponentTunnelExit id=\"label\" component=\"Slider\" />\n </div>\n )}\n\n <Aria.SliderTrack className={styles.track}>\n {({ state }) => (\n <PropsContextProvider\n props={{\n Button: {\n isPending: false,\n isFailed: false,\n isSucceeded: false,\n isReadOnly: isReadOnly,\n excludeFromTabOrder: true,\n isDisabled,\n variant: \"plain\",\n color: \"secondary\",\n size: \"s\",\n },\n }}\n >\n {!sliderOnly && (\n <>\n <Button\n onPress={() => state.decrementThumb(0, step)}\n aria-label={stringFormatter.format(\"decrement\")}\n className={styles.decrement}\n >\n <IconMinus />\n </Button>\n <Button\n onPress={() => state.incrementThumb(0, step)}\n aria-label={stringFormatter.format(\"increment\")}\n className={styles.increment}\n >\n <IconPlus />\n </Button>\n </>\n )}\n\n <div\n className={styles.fill}\n style={{\n \"--slider--value\": state.getThumbPercent(0),\n }}\n />\n\n {showInitialMarker &&\n defaultValue &&\n typeof defaultValue === \"number\" && (\n <div\n className={styles.initialMarker}\n style={{\n \"--slider--initial-value\":\n state.getValuePercent(defaultValue),\n }}\n />\n )}\n <Aria.SliderThumb\n inputRef={objectRef}\n aria-describedby={controlProps[\"aria-describedby\"]}\n name={name}\n className={styles.handle}\n isDisabled={isReadOnly}\n />\n </PropsContextProvider>\n )}\n </Aria.SliderTrack>\n <FieldErrorView />\n </PropsContextProvider>\n </Aria.Slider>\n </div>\n );\n});\n\nexport default Slider;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgCA,IAAa,SAAS,cAAc,WAAW,UAAU;CACvD,MAAM,EACJ,WACA,UACA,MACA,YACA,cACA,mBACA,YACA,KACA,MACA,YAG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;SAC3C,cAAY,gBAAgB,OAAO,WAAW;SAC9C,WAAW,sBAAO;SAElB,UAAA,oBAAC,UAAD,CAAW,CAAA;QACL,CAAA,CACR,EAAA,CAAA;QAGJ,oBAAC,OAAD;SACE,WAAW,sBAAO;SAClB,OAAO,EACL,mBAAmB,MAAM,gBAAgB,CAAC,EAC5C;QACD,CAAA;QAEA,qBACC,gBACA,OAAO,iBAAiB,YACtB,oBAAC,OAAD;SACE,WAAW,sBAAO;SAClB,OAAO,EACL,2BACE,MAAM,gBAAgB,YAAY,EACtC;QACD,CAAA;QAEL,oBAAC,KAAK,aAAN;SACE,UAAU;SACV,oBAAkB,aAAa;SACzB;SACN,WAAW,sBAAO;SAClB,YAAY;QACb,CAAA;OACmB;;KAER,CAAA;KAClB,oBAAC,gBAAD,CAAiB,CAAA;IACG;;EACX,CAAA;CACV,CAAA;AAET,CAAC"}
@@ -18,7 +18,7 @@ var Switch = flowComponent("Switch", (props) => {
18
18
  const { children, className, labelPosition = "trailing", ref, ...rest } = props;
19
19
  const rootClassName = clsx(Switch_module_default.switch, labelPosition !== "trailing" && Switch_module_default[`label-${labelPosition}`], className);
20
20
  const objectRef = useObjectRef(ref);
21
- const { FieldErrorView, FieldErrorCaptureContext, fieldPropsContext, fieldProps } = useFieldComponent(props, "Switch");
21
+ const { FieldErrorView, FieldErrorCaptureContext, fieldPropsContext, wrapperProps, controlProps } = useFieldComponent(props, "Switch");
22
22
  const propsContext = {
23
23
  ...fieldPropsContext,
24
24
  Label: {
@@ -28,9 +28,10 @@ var Switch = flowComponent("Switch", (props) => {
28
28
  }
29
29
  };
30
30
  return /* @__PURE__ */ jsxs("div", {
31
- ...fieldProps,
31
+ className: wrapperProps.className,
32
32
  children: [/* @__PURE__ */ jsx(FieldErrorCaptureContext, { children: /* @__PURE__ */ jsx(Aria.Switch, {
33
33
  ...rest,
34
+ "aria-describedby": controlProps["aria-describedby"],
34
35
  className: rootClassName,
35
36
  inputRef: objectRef,
36
37
  children: ({ isSelected }) => /* @__PURE__ */ jsxs(PropsContextProvider, {
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.mjs","names":[],"sources":["../../../../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import { type PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport styles from \"./Switch.module.scss\";\nimport clsx from \"clsx\";\nimport { IconCheck, IconClose } from \"@/components/Icon/components/icons\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport labelStyles from \"@/components/Label/Label.module.scss\";\nimport { useObjectRef } from \"react-aria\";\n\nexport interface SwitchProps\n extends\n PropsWithChildren<Omit<Aria.SwitchProps, \"children\" | \"inputRef\">>,\n FlowComponentProps<HTMLInputElement> {\n /**\n * Whether the label should appear before or after the switch. @default\n * \"trailing\"\n */\n labelPosition?: \"leading\" | \"trailing\";\n}\n\n/** @flr-generate all */\nexport const Switch = flowComponent(\"Switch\", (props) => {\n const {\n children,\n className,\n labelPosition = \"trailing\",\n ref,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.switch,\n labelPosition !== \"trailing\" && styles[`label-${labelPosition}`],\n className,\n );\n\n const objectRef = useObjectRef(ref);\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n fieldProps,\n } = useFieldComponent(props, \"Switch\");\n\n const propsContext: PropsContext = {\n ...fieldPropsContext,\n Label: {\n ...fieldPropsContext.Label,\n optional: false,\n className: styles.label,\n },\n };\n\n return (\n <div {...fieldProps}>\n <FieldErrorCaptureContext>\n <Aria.Switch {...rest} className={rootClassName} inputRef={objectRef}>\n {({ isSelected }) => (\n <PropsContextProvider props={propsContext}>\n <div className={styles.track}>\n <div className={styles.handle}>\n {isSelected ? <IconCheck size=\"s\" /> : <IconClose size=\"s\" />}\n </div>\n </div>\n <div className={labelStyles.label}>{children}</div>\n </PropsContextProvider>\n )}\n </Aria.Switch>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </div>\n );\n});\n\nexport default Switch;\n"],"mappings":";;;;;;;;;;;;;;;;AAwBA,IAAa,SAAS,cAAc,WAAW,UAAU;CACvD,MAAM,EACJ,UACA,WACA,gBAAgB,YAChB,KACA,GAAG,SACD;CAEJ,MAAM,gBAAgB,KACpB,sBAAO,QACP,kBAAkB,cAAc,sBAAO,SAAS,kBAChD,SACF;CAEA,MAAM,YAAY,aAAa,GAAG;CAElC,MAAM,EACJ,gBACA,0BACA,mBACA,eACE,kBAAkB,OAAO,QAAQ;CAErC,MAAM,eAA6B;EACjC,GAAG;EACH,OAAO;GACL,GAAG,kBAAkB;GACrB,UAAU;GACV,WAAW,sBAAO;EACpB;CACF;CAEA,OACE,qBAAC,OAAD;EAAK,GAAI;EAAT,UAAA,CACE,oBAAC,0BAAD,EAAA,UACE,oBAAC,KAAK,QAAN;GAAa,GAAI;GAAM,WAAW;GAAe,UAAU;GACvD,WAAA,EAAE,iBACF,qBAAC,sBAAD;IAAsB,OAAO;IAA7B,UAAA,CACE,oBAAC,OAAD;KAAK,WAAW,sBAAO;KACrB,UAAA,oBAAC,OAAD;MAAK,WAAW,sBAAO;MACpB,UAAA,aAAa,oBAAC,WAAD,EAAW,MAAK,IAAK,CAAA,IAAI,oBAAC,WAAD,EAAW,MAAK,IAAK,CAAA;KACzD,CAAA;IACF,CAAA,GACL,oBAAC,OAAD;KAAK,WAAW,qBAAY;KAAQ;IAAc,CAAA,CAC9B;;EAEb,CAAA,EACW,CAAA,GAC1B,oBAAC,gBAAD,CAAiB,CAAA,CACd;;AAET,CAAC"}
1
+ {"version":3,"file":"Switch.mjs","names":[],"sources":["../../../../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import { type PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport styles from \"./Switch.module.scss\";\nimport clsx from \"clsx\";\nimport { IconCheck, IconClose } from \"@/components/Icon/components/icons\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport labelStyles from \"@/components/Label/Label.module.scss\";\nimport { useObjectRef } from \"react-aria\";\n\nexport interface SwitchProps\n extends\n PropsWithChildren<Omit<Aria.SwitchProps, \"children\" | \"inputRef\">>,\n FlowComponentProps<HTMLInputElement> {\n /**\n * Whether the label should appear before or after the switch. @default\n * \"trailing\"\n */\n labelPosition?: \"leading\" | \"trailing\";\n}\n\n/** @flr-generate all */\nexport const Switch = flowComponent(\"Switch\", (props) => {\n const {\n children,\n className,\n labelPosition = \"trailing\",\n ref,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.switch,\n labelPosition !== \"trailing\" && styles[`label-${labelPosition}`],\n className,\n );\n\n const objectRef = useObjectRef(ref);\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n wrapperProps,\n controlProps,\n } = useFieldComponent(props, \"Switch\");\n\n const propsContext: PropsContext = {\n ...fieldPropsContext,\n Label: {\n ...fieldPropsContext.Label,\n optional: false,\n className: styles.label,\n },\n };\n\n return (\n <div className={wrapperProps.className}>\n <FieldErrorCaptureContext>\n <Aria.Switch\n {...rest}\n aria-describedby={controlProps[\"aria-describedby\"]}\n className={rootClassName}\n inputRef={objectRef}\n >\n {({ isSelected }) => (\n <PropsContextProvider props={propsContext}>\n <div className={styles.track}>\n <div className={styles.handle}>\n {isSelected ? <IconCheck size=\"s\" /> : <IconClose size=\"s\" />}\n </div>\n </div>\n <div className={labelStyles.label}>{children}</div>\n </PropsContextProvider>\n )}\n </Aria.Switch>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </div>\n );\n});\n\nexport default Switch;\n"],"mappings":";;;;;;;;;;;;;;;;AAwBA,IAAa,SAAS,cAAc,WAAW,UAAU;CACvD,MAAM,EACJ,UACA,WACA,gBAAgB,YAChB,KACA,GAAG,SACD;CAEJ,MAAM,gBAAgB,KACpB,sBAAO,QACP,kBAAkB,cAAc,sBAAO,SAAS,kBAChD,SACF;CAEA,MAAM,YAAY,aAAa,GAAG;CAElC,MAAM,EACJ,gBACA,0BACA,mBACA,cACA,iBACE,kBAAkB,OAAO,QAAQ;CAErC,MAAM,eAA6B;EACjC,GAAG;EACH,OAAO;GACL,GAAG,kBAAkB;GACrB,UAAU;GACV,WAAW,sBAAO;EACpB;CACF;CAEA,OACE,qBAAC,OAAD;EAAK,WAAW,aAAa;EAA7B,UAAA,CACE,oBAAC,0BAAD,EAAA,UACE,oBAAC,KAAK,QAAN;GACE,GAAI;GACJ,oBAAkB,aAAa;GAC/B,WAAW;GACX,UAAU;GAER,WAAA,EAAE,iBACF,qBAAC,sBAAD;IAAsB,OAAO;IAA7B,UAAA,CACE,oBAAC,OAAD;KAAK,WAAW,sBAAO;KACrB,UAAA,oBAAC,OAAD;MAAK,WAAW,sBAAO;MACpB,UAAA,aAAa,oBAAC,WAAD,EAAW,MAAK,IAAK,CAAA,IAAI,oBAAC,WAAD,EAAW,MAAK,IAAK,CAAA;KACzD,CAAA;IACF,CAAA,GACL,oBAAC,OAAD;KAAK,WAAW,qBAAY;KAAQ;IAAc,CAAA,CAC9B;;EAEb,CAAA,EACW,CAAA,GAC1B,oBAAC,gBAAD,CAAiB,CAAA,CACd;;AAET,CAAC"}
@@ -21,11 +21,11 @@ var TextArea = flowComponent("TextArea", (props) => {
21
21
  const { children, placeholder, rows = 5, autoResizeMaxRows = rows, ref, allowVerticalResize, allowHorizontalResize, showCharacterCount, className, onChange, isReadOnly, value, ...rest } = useControlledHostValueProps(props, "");
22
22
  if (allowHorizontalResize !== void 0) warnDeprecation("The 'allowHorizontalResize' prop is deprecated and will be removed in a future release. Use 'allowResize' instead.");
23
23
  if (allowVerticalResize !== void 0) warnDeprecation("The 'allowVerticalResize' prop is deprecated and will be removed in a future release. Use 'allowResize' instead.");
24
- const { FieldErrorView, FieldErrorCaptureContext, fieldPropsContext, fieldProps } = useFieldComponent(props, "TextArea");
24
+ const { FieldErrorView, FieldErrorCaptureContext, fieldPropsContext, wrapperProps, controlProps } = useFieldComponent(props, "TextArea");
25
25
  let { allowResize } = props;
26
26
  if (allowVerticalResize) allowResize = "vertical";
27
27
  else if (allowHorizontalResize) allowResize = "horizontal";
28
- const rootClassName = clsx(fieldProps.className, className);
28
+ const rootClassName = clsx(wrapperProps.className, className);
29
29
  const inputClassName = clsx(TextArea_module_default.input, typeof allowResize === "boolean" && allowResize ? TextArea_module_default.resize : null, allowResize === "horizontal" ? TextArea_module_default.horizontalResize : allowResize === "vertical" ? TextArea_module_default.verticalResize : null);
30
30
  const handleChange = (v) => {
31
31
  if (isReadOnly) return;
@@ -78,7 +78,7 @@ var TextArea = flowComponent("TextArea", (props) => {
78
78
  ]);
79
79
  return /* @__PURE__ */ jsx(Aria.TextField, {
80
80
  ...rest,
81
- ...fieldProps,
81
+ ...controlProps,
82
82
  value,
83
83
  className: rootClassName,
84
84
  onChange: handleChange,
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.mjs","names":[],"sources":["../../../../../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport styles from \"./TextArea.module.scss\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport clsx from \"clsx\";\nimport {\n type PropsWithChildren,\n useEffect,\n useLayoutEffect,\n useState,\n} from \"react\";\nimport { useControlledHostValueProps } from \"@/lib/remote/useControlledHostValueProps\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider/useLocalizedStringFormatter\";\nimport locales from \"./locales/*.locale.json\";\nimport { FieldDescription } from \"@/components/FieldDescription\";\nimport { useWarnDeprecation } from \"@/components/DeprecationWarningProvider\";\n\nexport interface TextAreaProps\n extends\n PropsWithChildren<Omit<Aria.TextFieldProps, \"children\">>,\n Pick<Aria.TextAreaProps, \"placeholder\" | \"rows\" | \"aria-hidden\">,\n FlowComponentProps<HTMLTextAreaElement> {\n /** Whether a character count should be displayed inside the field description. */\n showCharacterCount?: boolean;\n /**\n * Whether the text area should grow if its content gets longer than its\n * initial height.\n */\n autoResizeMaxRows?: number;\n /** Allows the user to manually resize the textArea horizontally. */\n allowResize?: boolean | \"horizontal\" | \"vertical\";\n /** @deprecated Use `allowResize` instead. */\n allowHorizontalResize?: boolean;\n /** @deprecated Use `allowResize` instead. */\n allowVerticalResize?: boolean;\n}\n\n/** @flr-generate all */\nexport const TextArea = flowComponent(\"TextArea\", (props) => {\n const warnDeprecation = useWarnDeprecation();\n const {\n children,\n placeholder,\n rows = 5,\n autoResizeMaxRows = rows,\n ref,\n allowVerticalResize,\n allowHorizontalResize,\n showCharacterCount,\n className,\n onChange,\n isReadOnly,\n value,\n ...rest\n } = useControlledHostValueProps(props, \"\");\n\n if (allowHorizontalResize !== undefined) {\n warnDeprecation(\n \"The 'allowHorizontalResize' prop is deprecated and will be removed in a future release. Use 'allowResize' instead.\",\n );\n }\n if (allowVerticalResize !== undefined) {\n warnDeprecation(\n \"The 'allowVerticalResize' prop is deprecated and will be removed in a future release. Use 'allowResize' instead.\",\n );\n }\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n fieldProps,\n } = useFieldComponent(props, \"TextArea\");\n\n let { allowResize } = props;\n if (allowVerticalResize) {\n allowResize = \"vertical\";\n } else if (allowHorizontalResize) {\n allowResize = \"horizontal\";\n }\n\n const rootClassName = clsx(fieldProps.className, className);\n\n const inputClassName = clsx(\n styles.input,\n typeof allowResize === \"boolean\" && allowResize ? styles.resize : null,\n allowResize === \"horizontal\"\n ? styles.horizontalResize\n : allowResize === \"vertical\"\n ? styles.verticalResize\n : null,\n );\n\n const handleChange = (v: string) => {\n if (isReadOnly) {\n return;\n }\n\n if (onChange) {\n onChange(v);\n }\n };\n\n const translation = useLocalizedStringFormatter(locales, \"TextArea\");\n\n // Derived, so that a value the field never saw typed is counted as well.\n const charactersCountDescription = translation.format(\"characters\", {\n count: value.length,\n maxCount: props.maxLength ?? 0,\n });\n\n const localRef = useObjectRef(ref);\n\n const [resized, setResized] = useState(false);\n\n const autoResizable = rows !== autoResizeMaxRows;\n\n const verticallyResizable =\n allowResize && (!autoResizable || (autoResizable && resized));\n\n useEffect(() => {\n const textarea = localRef.current;\n if (!textarea) return;\n\n const startHeight = textarea.offsetHeight;\n let tracking = false;\n\n const handleMouseDown = () => {\n tracking = true;\n };\n\n const handleMouseMove = () => {\n if (!tracking || resized) return;\n\n const currentHeight = textarea.offsetHeight;\n\n if (currentHeight !== startHeight) {\n setResized(true);\n tracking = false;\n }\n };\n\n const handleMouseUp = () => {\n tracking = false;\n };\n\n window.addEventListener(\"mousedown\", handleMouseDown);\n window.addEventListener(\"mousemove\", handleMouseMove);\n window.addEventListener(\"mouseup\", handleMouseUp);\n\n return () => {\n window.removeEventListener(\"mousedown\", handleMouseDown);\n window.removeEventListener(\"mousemove\", handleMouseMove);\n window.removeEventListener(\"mouseup\", handleMouseUp);\n };\n }, [resized]);\n\n /*\n * The height depends on the rendered content, so it cannot be a style. It is\n * synced to the value instead of to the `change` event, because a value the\n * field never saw typed — an initial value, or a draft loaded into a\n * controlled field — has to resize it just the same.\n */\n useLayoutEffect(() => {\n const textArea = localRef.current;\n if (!textArea || !autoResizable || verticallyResizable) {\n return;\n }\n // https://stackoverflow.com/a/60795884\n textArea.style.height = \"0px\";\n // + 2 to add border height\n textArea.style.height = `${textArea.scrollHeight + 2}px`;\n }, [value, autoResizable, verticallyResizable]);\n\n return (\n <Aria.TextField\n {...rest}\n {...fieldProps}\n value={value}\n className={rootClassName}\n onChange={handleChange}\n >\n <PropsContextProvider props={fieldPropsContext}>\n <FieldErrorCaptureContext>{children}</FieldErrorCaptureContext>\n <Aria.TextArea\n rows={rows}\n {...(isReadOnly ? { \"data-readonly\": true } : {})}\n aria-readonly={isReadOnly}\n aria-hidden={props[\"aria-hidden\"]}\n placeholder={placeholder}\n className={inputClassName}\n ref={localRef}\n style={{\n \"--text-area--rows\": rows,\n \"--text-area--max-rows\": verticallyResizable\n ? undefined\n : autoResizeMaxRows,\n }}\n />\n {showCharacterCount && (\n <FieldDescription>{charactersCountDescription}</FieldDescription>\n )}\n <FieldErrorView />\n </PropsContextProvider>\n </Aria.TextField>\n );\n});\n\nexport default TextArea;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyCA,IAAa,WAAW,cAAc,aAAa,UAAU;CAC3D,MAAM,kBAAkB,mBAAmB;CAC3C,MAAM,EACJ,UACA,aACA,OAAO,GACP,oBAAoB,MACpB,KACA,qBACA,uBACA,oBACA,WACA,UACA,YACA,OACA,GAAG,SACD,4BAA4B,OAAO,EAAE;CAEzC,IAAI,0BAA0B,KAAA,GAC5B,gBACE,oHACF;CAEF,IAAI,wBAAwB,KAAA,GAC1B,gBACE,kHACF;CAGF,MAAM,EACJ,gBACA,0BACA,mBACA,eACE,kBAAkB,OAAO,UAAU;CAEvC,IAAI,EAAE,gBAAgB;CACtB,IAAI,qBACF,cAAc;MACT,IAAI,uBACT,cAAc;CAGhB,MAAM,gBAAgB,KAAK,WAAW,WAAW,SAAS;CAE1D,MAAM,iBAAiB,KACrB,wBAAO,OACP,OAAO,gBAAgB,aAAa,cAAc,wBAAO,SAAS,MAClE,gBAAgB,eACZ,wBAAO,mBACP,gBAAgB,aACd,wBAAO,iBACP,IACR;CAEA,MAAM,gBAAgB,MAAc;EAClC,IAAI,YACF;EAGF,IAAI,UACF,SAAS,CAAC;CAEd;CAKA,MAAM,6BAHc,4BAA4B,kBAAS,UAGtB,CAAA,CAAY,OAAO,cAAc;EAClE,OAAO,MAAM;EACb,UAAU,MA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KAAK;KACL,OAAO;MACL,qBAAqB;MACrB,yBAAyB,sBACrB,KAAA,IACA;KACN;IACD,CAAA;IACA,sBACC,oBAAC,kBAAD,EAAA,UAAmB,2BAA6C,CAAA;IAElE,oBAAC,gBAAD,CAAiB,CAAA;GACG;;CACR,CAAA;AAEpB,CAAC"}
1
+ {"version":3,"file":"TextArea.mjs","names":[],"sources":["../../../../../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport styles from \"./TextArea.module.scss\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport clsx from \"clsx\";\nimport {\n type PropsWithChildren,\n useEffect,\n useLayoutEffect,\n useState,\n} from \"react\";\nimport { useControlledHostValueProps } from \"@/lib/remote/useControlledHostValueProps\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider/useLocalizedStringFormatter\";\nimport locales from \"./locales/*.locale.json\";\nimport { FieldDescription } from \"@/components/FieldDescription\";\nimport { useWarnDeprecation } from \"@/components/DeprecationWarningProvider\";\n\nexport interface TextAreaProps\n extends\n PropsWithChildren<Omit<Aria.TextFieldProps, \"children\">>,\n Pick<Aria.TextAreaProps, \"placeholder\" | \"rows\" | \"aria-hidden\">,\n FlowComponentProps<HTMLTextAreaElement> {\n /** Whether a character count should be displayed inside the field description. */\n showCharacterCount?: boolean;\n /**\n * Whether the text area should grow if its content gets longer than its\n * initial height.\n */\n autoResizeMaxRows?: number;\n /** Allows the user to manually resize the textArea horizontally. */\n allowResize?: boolean | \"horizontal\" | \"vertical\";\n /** @deprecated Use `allowResize` instead. */\n allowHorizontalResize?: boolean;\n /** @deprecated Use `allowResize` instead. */\n allowVerticalResize?: boolean;\n}\n\n/** @flr-generate all */\nexport const TextArea = flowComponent(\"TextArea\", (props) => {\n const warnDeprecation = useWarnDeprecation();\n const {\n children,\n placeholder,\n rows = 5,\n autoResizeMaxRows = rows,\n ref,\n allowVerticalResize,\n allowHorizontalResize,\n showCharacterCount,\n className,\n onChange,\n isReadOnly,\n value,\n ...rest\n } = useControlledHostValueProps(props, \"\");\n\n if (allowHorizontalResize !== undefined) {\n warnDeprecation(\n \"The 'allowHorizontalResize' prop is deprecated and will be removed in a future release. Use 'allowResize' instead.\",\n );\n }\n if (allowVerticalResize !== undefined) {\n warnDeprecation(\n \"The 'allowVerticalResize' prop is deprecated and will be removed in a future release. Use 'allowResize' instead.\",\n );\n }\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n wrapperProps,\n controlProps,\n } = useFieldComponent(props, \"TextArea\");\n\n let { allowResize } = props;\n if (allowVerticalResize) {\n allowResize = \"vertical\";\n } else if (allowHorizontalResize) {\n allowResize = \"horizontal\";\n }\n\n const rootClassName = clsx(wrapperProps.className, className);\n\n const inputClassName = clsx(\n styles.input,\n typeof allowResize === \"boolean\" && allowResize ? styles.resize : null,\n allowResize === \"horizontal\"\n ? styles.horizontalResize\n : allowResize === \"vertical\"\n ? styles.verticalResize\n : null,\n );\n\n const handleChange = (v: string) => {\n if (isReadOnly) {\n return;\n }\n\n if (onChange) {\n onChange(v);\n }\n };\n\n const translation = useLocalizedStringFormatter(locales, \"TextArea\");\n\n // Derived, so that a value the field never saw typed is counted as well.\n const charactersCountDescription = translation.format(\"characters\", {\n count: value.length,\n maxCount: props.maxLength ?? 0,\n });\n\n const localRef = useObjectRef(ref);\n\n const [resized, setResized] = useState(false);\n\n const autoResizable = rows !== autoResizeMaxRows;\n\n const verticallyResizable =\n allowResize && (!autoResizable || (autoResizable && resized));\n\n useEffect(() => {\n const textarea = localRef.current;\n if (!textarea) return;\n\n const startHeight = textarea.offsetHeight;\n let tracking = false;\n\n const handleMouseDown = () => {\n tracking = true;\n };\n\n const handleMouseMove = () => {\n if (!tracking || resized) return;\n\n const currentHeight = textarea.offsetHeight;\n\n if (currentHeight !== startHeight) {\n setResized(true);\n tracking = false;\n }\n };\n\n const handleMouseUp = () => {\n tracking = false;\n };\n\n window.addEventListener(\"mousedown\", handleMouseDown);\n window.addEventListener(\"mousemove\", handleMouseMove);\n window.addEventListener(\"mouseup\", handleMouseUp);\n\n return () => {\n window.removeEventListener(\"mousedown\", handleMouseDown);\n window.removeEventListener(\"mousemove\", handleMouseMove);\n window.removeEventListener(\"mouseup\", handleMouseUp);\n };\n }, [resized]);\n\n /*\n * The height depends on the rendered content, so it cannot be a style. It is\n * synced to the value instead of to the `change` event, because a value the\n * field never saw typed — an initial value, or a draft loaded into a\n * controlled field — has to resize it just the same.\n */\n useLayoutEffect(() => {\n const textArea = localRef.current;\n if (!textArea || !autoResizable || verticallyResizable) {\n return;\n }\n // https://stackoverflow.com/a/60795884\n textArea.style.height = \"0px\";\n // + 2 to add border height\n textArea.style.height = `${textArea.scrollHeight + 2}px`;\n }, [value, autoResizable, verticallyResizable]);\n\n return (\n <Aria.TextField\n {...rest}\n {...controlProps}\n value={value}\n className={rootClassName}\n onChange={handleChange}\n >\n <PropsContextProvider props={fieldPropsContext}>\n <FieldErrorCaptureContext>{children}</FieldErrorCaptureContext>\n <Aria.TextArea\n rows={rows}\n {...(isReadOnly ? { \"data-readonly\": true } : {})}\n aria-readonly={isReadOnly}\n aria-hidden={props[\"aria-hidden\"]}\n placeholder={placeholder}\n className={inputClassName}\n ref={localRef}\n style={{\n \"--text-area--rows\": rows,\n \"--text-area--max-rows\": verticallyResizable\n ? undefined\n : autoResizeMaxRows,\n }}\n />\n {showCharacterCount && (\n <FieldDescription>{charactersCountDescription}</FieldDescription>\n )}\n <FieldErrorView />\n </PropsContextProvider>\n </Aria.TextField>\n );\n});\n\nexport default TextArea;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyCA,IAAa,WAAW,cAAc,aAAa,UAAU;CAC3D,MAAM,kBAAkB,mBAAmB;CAC3C,MA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EACpD,OAAO,iBAAiB,aAAa,eAAe;EACpD,OAAO,iBAAiB,WAAW,aAAa;EAEhD,aAAa;GACX,OAAO,oBAAoB,aAAa,eAAe;GACvD,OAAO,oBAAoB,aAAa,eAAe;GACvD,OAAO,oBAAoB,WAAW,aAAa;EACrD;CACF,GAAG,CAAC,OAAO,CAAC;CAQZ,sBAAsB;EACpB,MAAM,WAAW,SAAS;EAC1B,IAAI,CAAC,YAAY,CAAC,iBAAiB,qBACjC;EAGF,SAAS,MAAM,SAAS;EAExB,SAAS,MAAM,SAAS,GAAG,SAAS,eAAe,EAAE;CACvD,GAAG;EAAC;EAAO;EAAe;CAAmB,CAAC;CAE9C,OACE,oBAAC,KAAK,WAAN;EACE,GAAI;EACJ,GAAI;EACG;EACP,WAAW;EACX,UAAU;EAEV,UAAA,qBAAC,sBAAD;GAAsB,OAAO;GAA7B,UAAA;IACE,oBAAC,0BAAD,EAA2B,SAAmC,CAAA;IAC9D,oBAAC,KAAK,UAAN;KACQ;KACN,GAAK,aAAa,EAAE,iBAAiB,KAAK,IAAI,CAAC;KAC/C,iBAAe;KACf,eAAa,MAAM;KACN;KACb,WAAW;KACX,KAAK;KACL,OAAO;MACL,qBAAqB;MACrB,yBAAyB,sBACrB,KAAA,IACA;KACN;IACD,CAAA;IACA,sBACC,oBAAC,kBAAD,EAAA,UAAmB,2BAA6C,CAAA;IAElE,oBAAC,gBAAD,CAAiB,CAAA;GACG;;CACR,CAAA;AAEpB,CAAC"}
@@ -22,8 +22,8 @@ var TextField = flowComponent("TextField", (props) => {
22
22
  const { className, showCharacterCount, form, placeholder, ref, type: typeFromProps, children, onChange, ...rest } = useControlledHostValueProps(props, "");
23
23
  const [charactersCount, setCharactersCount] = useState(props.defaultValue?.length ?? props.value?.length ?? 0);
24
24
  const [type, setType] = useState(typeFromProps);
25
- const { FieldErrorView, FieldErrorCaptureContext, fieldPropsContext, fieldProps } = useFieldComponent(props, "TextField");
26
- const rootClassName = clsx(fieldProps.className, className);
25
+ const { FieldErrorView, FieldErrorCaptureContext, fieldPropsContext, wrapperProps, controlProps } = useFieldComponent(props, "TextField");
26
+ const rootClassName = clsx(wrapperProps.className, className);
27
27
  const propsContext = {
28
28
  Button: {
29
29
  className: TextField_module_default.button,
@@ -54,7 +54,7 @@ var TextField = flowComponent("TextField", (props) => {
54
54
  });
55
55
  return /* @__PURE__ */ jsx(Aria.TextField, {
56
56
  ...rest,
57
- ...fieldProps,
57
+ ...controlProps,
58
58
  className: rootClassName,
59
59
  onChange: handleChange,
60
60
  type,
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.mjs","names":[],"sources":["../../../../../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport * as Aria from \"react-aria-components\";\nimport { type PropsWithChildren, useState } from \"react\";\nimport { useControlledHostValueProps } from \"@/lib/remote/useControlledHostValueProps\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport styles from \"./TextField.module.scss\";\nimport { FieldDescription } from \"@/components/FieldDescription\";\nimport locales from \"./locales/*.locale.json\";\nimport { Button } from \"@/components/Button\";\nimport { IconHide, IconShow } from \"@/components/Icon/components/icons\";\nimport clsx from \"clsx\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\n\nexport interface TextFieldProps\n extends\n PropsWithChildren<Omit<Aria.TextFieldProps, \"children\">>,\n Pick<Aria.InputProps, \"placeholder\">,\n FlowComponentProps<HTMLInputElement> {\n /** Whether a character count should be displayed inside the field description. */\n showCharacterCount?: boolean;\n}\n\n/** @flr-generate all */\nexport const TextField = flowComponent(\"TextField\", (props) => {\n const {\n className,\n showCharacterCount,\n form,\n placeholder,\n ref,\n type: typeFromProps,\n children,\n onChange,\n ...rest\n } = useControlledHostValueProps(props, \"\");\n\n const [charactersCount, setCharactersCount] = useState(\n props.defaultValue?.length ?? props.value?.length ?? 0,\n );\n\n const [type, setType] = useState(typeFromProps);\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n fieldProps,\n } = useFieldComponent(props, \"TextField\");\n\n const rootClassName = clsx(fieldProps.className, className);\n\n const propsContext: PropsContext = {\n Button: {\n className: styles.button,\n variant: \"plain\",\n color: \"secondary\",\n tunnel: {\n id: \"button\",\n component: \"TextField\",\n },\n },\n CopyButton: {\n className: styles.button,\n tunnel: {\n id: \"button\",\n component: \"TextField\",\n },\n },\n ...fieldPropsContext,\n };\n\n const handleChange = (v: string) => {\n if (showCharacterCount) {\n setCharactersCount(v.length);\n }\n if (onChange) {\n onChange(v);\n }\n };\n\n const translation = useLocalizedStringFormatter(locales, \"TextField\");\n\n const charactersCountDescription = translation.format(\"characters\", {\n count: charactersCount,\n maxCount: props.maxLength ?? 0,\n });\n\n return (\n <Aria.TextField\n {...rest}\n {...fieldProps}\n className={rootClassName}\n onChange={handleChange}\n type={type}\n >\n <PropsContextProvider props={propsContext}>\n <FieldErrorCaptureContext>\n {children}\n <div className={styles.inputContainer}>\n <Aria.Input\n form={form}\n placeholder={placeholder}\n className={styles.input}\n ref={ref}\n />\n <UiComponentTunnelExit id=\"button\" component=\"TextField\" />\n {typeFromProps === \"password\" && (\n <Button\n color=\"secondary\"\n variant=\"plain\"\n className={styles.button}\n onPress={() =>\n setType(type === \"password\" ? \"text\" : \"password\")\n }\n aria-label={translation.format(\n `password.${type === \"password\" ? \"show\" : \"hide\"}`,\n )}\n >\n {type === \"password\" ? <IconShow /> : <IconHide />}\n </Button>\n )}\n </div>\n {showCharacterCount && (\n <FieldDescription>{charactersCountDescription}</FieldDescription>\n )}\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </PropsContextProvider>\n </Aria.TextField>\n );\n});\n\nexport default TextField;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4BA,IAAa,YAAY,cA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a,SAAS,UAAU;OAEnD,cAAY,YAAY,OACtB,YAAY,SAAS,aAAa,SAAS,QAC7C;OAEC,UAAA,SAAS,aAAa,oBAAC,UAAD,CAAW,CAAA,IAAI,oBAAC,UAAD,CAAW,CAAA;MAC3C,CAAA;KAEP;;IACJ,sBACC,oBAAC,kBAAD,EAAA,UAAmB,2BAA6C,CAAA;GAE1C,EAAA,CAAA,GAC1B,oBAAC,gBAAD,CAAiB,CAAA,CACG;;CACR,CAAA;AAEpB,CAAC"}
1
+ {"version":3,"file":"TextField.mjs","names":[],"sources":["../../../../../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport * as Aria from \"react-aria-components\";\nimport { type PropsWithChildren, useState } from \"react\";\nimport { useControlledHostValueProps } from \"@/lib/remote/useControlledHostValueProps\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport styles from \"./TextField.module.scss\";\nimport { FieldDescription } from \"@/components/FieldDescription\";\nimport locales from \"./locales/*.locale.json\";\nimport { Button } from \"@/components/Button\";\nimport { IconHide, IconShow } from \"@/components/Icon/components/icons\";\nimport clsx from \"clsx\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\n\nexport interface TextFieldProps\n extends\n PropsWithChildren<Omit<Aria.TextFieldProps, \"children\">>,\n Pick<Aria.InputProps, \"placeholder\">,\n FlowComponentProps<HTMLInputElement> {\n /** Whether a character count should be displayed inside the field description. */\n showCharacterCount?: boolean;\n}\n\n/** @flr-generate all */\nexport const TextField = flowComponent(\"TextField\", (props) => {\n const {\n className,\n showCharacterCount,\n form,\n placeholder,\n ref,\n type: typeFromProps,\n children,\n onChange,\n ...rest\n } = useControlledHostValueProps(props, \"\");\n\n const [charactersCount, setCharactersCount] = useState(\n props.defaultValue?.length ?? props.value?.length ?? 0,\n );\n\n const [type, setType] = useState(typeFromProps);\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n wrapperProps,\n controlProps,\n } = useFieldComponent(props, \"TextField\");\n\n const rootClassName = clsx(wrapperProps.className, className);\n\n const propsContext: PropsContext = {\n Button: {\n className: styles.button,\n variant: \"plain\",\n color: \"secondary\",\n tunnel: {\n id: \"button\",\n component: \"TextField\",\n },\n },\n CopyButton: {\n className: styles.button,\n tunnel: {\n id: \"button\",\n component: \"TextField\",\n },\n },\n ...fieldPropsContext,\n };\n\n const handleChange = (v: string) => {\n if (showCharacterCount) {\n setCharactersCount(v.length);\n }\n if (onChange) {\n onChange(v);\n }\n };\n\n const translation = useLocalizedStringFormatter(locales, \"TextField\");\n\n const charactersCountDescription = translation.format(\"characters\", {\n count: charactersCount,\n maxCount: props.maxLength ?? 0,\n });\n\n return (\n <Aria.TextField\n {...rest}\n {...controlProps}\n className={rootClassName}\n onChange={handleChange}\n type={type}\n >\n <PropsContextProvider props={propsContext}>\n <FieldErrorCaptureContext>\n {children}\n <div className={styles.inputContainer}>\n <Aria.Input\n form={form}\n placeholder={placeholder}\n className={styles.input}\n ref={ref}\n />\n <UiComponentTunnelExit id=\"button\" component=\"TextField\" />\n {typeFromProps === \"password\" && (\n <Button\n color=\"secondary\"\n variant=\"plain\"\n className={styles.button}\n onPress={() =>\n setType(type === \"password\" ? \"text\" : \"password\")\n }\n aria-label={translation.format(\n `password.${type === \"password\" ? \"show\" : \"hide\"}`,\n )}\n >\n {type === \"password\" ? <IconShow /> : <IconHide />}\n </Button>\n )}\n </div>\n {showCharacterCount && (\n <FieldDescription>{charactersCountDescription}</FieldDescription>\n )}\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </PropsContextProvider>\n </Aria.TextField>\n );\n});\n\nexport default TextField;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4BA,IAAa,YAAY,cAAc,cAAc,UAAU;CAC7D,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EnD,cAAY,YAAY,OACtB,YAAY,SAAS,aAAa,SAAS,QAC7C;OAEC,UAAA,SAAS,aAAa,oBAAC,UAAD,CAAW,CAAA,IAAI,oBAAC,UAAD,CAAW,CAAA;MAC3C,CAAA;KAEP;;IACJ,sBACC,oBAAC,kBAAD,EAAA,UAAmB,2BAA6C,CAAA;GAE1C,EAAA,CAAA,GAC1B,oBAAC,gBAAD,CAAiB,CAAA,CACG;;CACR,CAAA;AAEpB,CAAC"}
@@ -12,11 +12,12 @@ import * as Aria from "react-aria-components";
12
12
  /** @flr-generate all */
13
13
  var TimeField = flowComponent("TimeField", (props) => {
14
14
  const { children, ref, ...rest } = props;
15
- const { FieldErrorView, FieldErrorCaptureContext, fieldPropsContext, fieldProps } = useFieldComponent(props, "TimeField");
15
+ const { FieldErrorView, FieldErrorCaptureContext, fieldPropsContext, wrapperProps, controlProps } = useFieldComponent(props, "TimeField");
16
16
  return /* @__PURE__ */ jsxs(Aria.TimeField, {
17
17
  hourCycle: 24,
18
18
  ...rest,
19
- ...fieldProps,
19
+ ...wrapperProps,
20
+ ...controlProps,
20
21
  children: [/* @__PURE__ */ jsxs(FieldErrorCaptureContext, { children: [/* @__PURE__ */ jsx(DateInput, {
21
22
  className: TimeField_module_default.dateInput,
22
23
  ref
@@ -1 +1 @@
1
- {"version":3,"file":"TimeField.mjs","names":[],"sources":["../../../../../../../src/components/TimeField/TimeField.tsx"],"sourcesContent":["import { type PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport styles from \"./TimeField.module.scss\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport DateInput from \"@/components/DateInput\";\n\nexport interface TimeFieldProps<T extends Aria.TimeValue = Aria.TimeValue>\n extends\n PropsWithChildren<Omit<Aria.TimeFieldProps<T>, \"children\">>,\n FlowComponentProps<HTMLSpanElement> {}\n\n/** @flr-generate all */\nexport const TimeField = flowComponent(\"TimeField\", (props) => {\n const { children, ref, ...rest } = props;\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n fieldProps,\n } = useFieldComponent(props, \"TimeField\");\n\n return (\n <Aria.TimeField hourCycle={24} {...rest} {...fieldProps}>\n <FieldErrorCaptureContext>\n <DateInput className={styles.dateInput} ref={ref} />\n <PropsContextProvider props={fieldPropsContext}>\n {children}\n </PropsContextProvider>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </Aria.TimeField>\n );\n});\n\nexport default TimeField;\n"],"mappings":";;;;;;;;;;;;AAiBA,IAAa,YAAY,cAAc,cAAc,UAAU;CAC7D,MAAM,EAAE,UAAU,KAAK,GAAG,SAAS;CAEnC,MAAM,EACJ,gBACA,0BACA,mBACA,eACE,kBAAkB,OAAO,WAAW;CAExC,OACE,qBAAC,KAAK,WAAN;EAAgB,WAAW;EAAI,GAAI;EAAM,GAAI;EAA7C,UAAA,CACE,qBAAC,0BAAD,EAAA,UAAA,CACE,oBAAC,WAAD;GAAW,WAAW,yBAAO;GAAgB;EAAM,CAAA,GACnD,oBAAC,sBAAD;GAAsB,OAAO;GAC1B;EACmB,CAAA,CACE,EAAA,CAAA,GAC1B,oBAAC,gBAAD,CAAiB,CAAA,CACH;;AAEpB,CAAC"}
1
+ {"version":3,"file":"TimeField.mjs","names":[],"sources":["../../../../../../../src/components/TimeField/TimeField.tsx"],"sourcesContent":["import { type PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport styles from \"./TimeField.module.scss\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport DateInput from \"@/components/DateInput\";\n\nexport interface TimeFieldProps<T extends Aria.TimeValue = Aria.TimeValue>\n extends\n PropsWithChildren<Omit<Aria.TimeFieldProps<T>, \"children\">>,\n FlowComponentProps<HTMLSpanElement> {}\n\n/** @flr-generate all */\nexport const TimeField = flowComponent(\"TimeField\", (props) => {\n const { children, ref, ...rest } = props;\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n wrapperProps,\n controlProps,\n } = useFieldComponent(props, \"TimeField\");\n\n return (\n <Aria.TimeField\n hourCycle={24}\n {...rest}\n {...wrapperProps}\n {...controlProps}\n >\n <FieldErrorCaptureContext>\n <DateInput className={styles.dateInput} ref={ref} />\n <PropsContextProvider props={fieldPropsContext}>\n {children}\n </PropsContextProvider>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </Aria.TimeField>\n );\n});\n\nexport default TimeField;\n"],"mappings":";;;;;;;;;;;;AAiBA,IAAa,YAAY,cAAc,cAAc,UAAU;CAC7D,MAAM,EAAE,UAAU,KAAK,GAAG,SAAS;CAEnC,MAAM,EACJ,gBACA,0BACA,mBACA,cACA,iBACE,kBAAkB,OAAO,WAAW;CAExC,OACE,qBAAC,KAAK,WAAN;EACE,WAAW;EACX,GAAI;EACJ,GAAI;EACJ,GAAI;EAJN,UAAA,CAME,qBAAC,0BAAD,EAAA,UAAA,CACE,oBAAC,WAAD;GAAW,WAAW,yBAAO;GAAgB;EAAM,CAAA,GACnD,oBAAC,sBAAD;GAAsB,OAAO;GAC1B;EACmB,CAAA,CACE,EAAA,CAAA,GAC1B,oBAAC,gBAAD,CAAiB,CAAA,CACH;;AAEpB,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use client"
2
+ /* */
3
+ import { createContext } from "react";
4
+ //#region src/lib/hooks/fieldErrorRenderedContext.ts
5
+ /**
6
+ * Lets a rendered `FieldError` tell its field which id it has, so the field
7
+ * references the error only while it exists. `undefined` reports that it is
8
+ * gone.
9
+ *
10
+ * @internal
11
+ */
12
+ var FieldErrorRenderedContext = createContext(void 0);
13
+ //#endregion
14
+ export { FieldErrorRenderedContext };
15
+
16
+ //# sourceMappingURL=fieldErrorRenderedContext.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fieldErrorRenderedContext.mjs","names":[],"sources":["../../../../../../../src/lib/hooks/fieldErrorRenderedContext.ts"],"sourcesContent":["import { createContext } from \"react\";\n\n/**\n * Lets a rendered `FieldError` tell its field which id it has, so the field\n * references the error only while it exists. `undefined` reports that it is\n * gone.\n *\n * @internal\n */\nexport const FieldErrorRenderedContext = createContext<\n ((fieldErrorId: string | undefined) => void) | undefined\n>(undefined);\n"],"mappings":";;;;;;;;;;;AASA,IAAa,4BAA4B,cAEvC,KAAA,CAAS"}
@@ -2,12 +2,14 @@
2
2
  /* */
3
3
  import FormField_module_default from "../../components/FormField/FormField.module.mjs";
4
4
  import { useFieldError } from "./useFieldError.mjs";
5
- import clsx from "clsx";
5
+ import "clsx";
6
6
  import { useId } from "react";
7
7
  //#region src/lib/hooks/useFieldComponent.tsx
8
+ /** Joins id references, dropping empty ones. @internal */
9
+ var joinIds = (...ids) => ids.filter(Boolean).join(" ") || void 0;
8
10
  var useFieldComponent = (props, component) => {
9
11
  const fieldErrorId = useId();
10
- const { FieldErrorView, FieldErrorCaptureContext } = useFieldError({
12
+ const { FieldErrorView, FieldErrorCaptureContext, renderedFieldErrorId } = useFieldError({
11
13
  fieldErrorId,
12
14
  component
13
15
  });
@@ -22,13 +24,12 @@ var useFieldComponent = (props, component) => {
22
24
  },
23
25
  FieldDescription: { className: FormField_module_default.fieldDescription }
24
26
  },
25
- fieldProps: {
26
- "aria-describedby": props.isInvalid ? fieldErrorId : props["aria-describedby"],
27
- className: clsx(FormField_module_default.formField)
28
- }
27
+ wrapperProps: { className: FormField_module_default.formField },
28
+ controlProps: { "aria-describedby": joinIds(renderedFieldErrorId, props["aria-describedby"]) },
29
+ renderedFieldErrorId
29
30
  };
30
31
  };
31
32
  //#endregion
32
- export { useFieldComponent };
33
+ export { joinIds, useFieldComponent };
33
34
 
34
35
  //# sourceMappingURL=useFieldComponent.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFieldComponent.mjs","names":[],"sources":["../../../../../../../src/lib/hooks/useFieldComponent.tsx"],"sourcesContent":["import { type FC, type PropsWithChildren, useId } from \"react\";\nimport { type PropsContext } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport { useFieldError } from \"@/lib/hooks/useFieldError\";\nimport clsx, { type ClassValue } from \"clsx\";\nimport type { FlowComponentName } from \"@/components/propTypes\";\n\ninterface FieldComponentProps {\n className?: ClassValue;\n isRequired?: boolean;\n isDisabled?: boolean;\n isInvalid?: boolean;\n \"aria-describedby\"?: string;\n}\n\nexport interface UseFieldComponent {\n FieldErrorCaptureContext: FC<PropsWithChildren>;\n FieldErrorView: FC;\n fieldPropsContext: PropsContext;\n fieldProps: {\n \"aria-describedby\"?: string;\n className?: ReturnType<typeof clsx>;\n };\n}\n\nexport const useFieldComponent = (\n props: FieldComponentProps,\n component: FlowComponentName,\n): UseFieldComponent => {\n const fieldErrorId = useId();\n const { FieldErrorView, FieldErrorCaptureContext } = useFieldError({\n fieldErrorId,\n component,\n });\n\n // setting up the props context for all components that\n // are part of a form control\n const fieldPropsContext: PropsContext = {\n Label: {\n className: formFieldStyles.label,\n optional: !props.isRequired,\n isDisabled: !!props.isDisabled,\n },\n FieldDescription: {\n className: formFieldStyles.fieldDescription,\n },\n };\n\n return {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n fieldProps: {\n \"aria-describedby\": props.isInvalid\n ? fieldErrorId\n : props[\"aria-describedby\"],\n className: clsx(formFieldStyles.formField),\n },\n } as const;\n};\n"],"mappings":";;;;;;;AAyBA,IAAa,qBACX,OACA,cACsB;CACtB,MAAM,eAAe,MAAM;CAC3B,MAAM,EAAE,gBAAgB,6BAA6B,cAAc;EACjE;EACA;CACF,CAAC;CAeD,OAAO;EACL;EACA;EACA,mBAAA;GAbA,OAAO;IACL,WAAW,yBAAgB;IAC3B,UAAU,CAAC,MAAM;IACjB,YAAY,CAAC,CAAC,MAAM;GACtB;GACA,kBAAkB,EAChB,WAAW,yBAAgB,iBAC7B;EAMA;EACA,YAAY;GACV,oBAAoB,MAAM,YACtB,eACA,MAAM;GACV,WAAW,KAAK,yBAAgB,SAAS;EAC3C;CACF;AACF"}
1
+ {"version":3,"file":"useFieldComponent.mjs","names":[],"sources":["../../../../../../../src/lib/hooks/useFieldComponent.tsx"],"sourcesContent":["import { type FC, type PropsWithChildren, useId } from \"react\";\nimport { type PropsContext } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport { useFieldError } from \"@/lib/hooks/useFieldError\";\nimport { type ClassValue } from \"clsx\";\nimport type { FlowComponentName } from \"@/components/propTypes\";\n\ninterface FieldComponentProps {\n className?: ClassValue;\n isRequired?: boolean;\n isDisabled?: boolean;\n \"aria-describedby\"?: string;\n}\n\nexport interface UseFieldComponent {\n FieldErrorCaptureContext: FC<PropsWithChildren>;\n FieldErrorView: FC;\n fieldPropsContext: PropsContext;\n /** For the field's outer element. */\n wrapperProps: {\n className: string;\n };\n /**\n * For what assistive technology lands on — the input, or the group of a\n * grouped control. Where the react-aria root forwards `aria-describedby` to\n * its input itself, spread it on the root together with `wrapperProps`.\n * Spread it after `rest`: it already contains the consumer's\n * `aria-describedby`, which `rest` would otherwise put back alone.\n */\n controlProps: {\n \"aria-describedby\"?: string;\n };\n /** The id of the error while one is rendered, without the consumer's ids. */\n renderedFieldErrorId?: string;\n}\n\n/** Joins id references, dropping empty ones. @internal */\nexport const joinIds = (...ids: (string | false | null | undefined)[]) =>\n ids.filter(Boolean).join(\" \") || undefined;\n\nexport const useFieldComponent = (\n props: FieldComponentProps,\n component: FlowComponentName,\n): UseFieldComponent => {\n const fieldErrorId = useId();\n const { FieldErrorView, FieldErrorCaptureContext, renderedFieldErrorId } =\n useFieldError({\n fieldErrorId,\n component,\n });\n\n // setting up the props context for all components that\n // are part of a form control\n const fieldPropsContext: PropsContext = {\n Label: {\n className: formFieldStyles.label,\n optional: !props.isRequired,\n isDisabled: !!props.isDisabled,\n },\n FieldDescription: {\n className: formFieldStyles.fieldDescription,\n },\n };\n\n return {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n wrapperProps: {\n className: formFieldStyles.formField,\n },\n controlProps: {\n // Reference the error only while it is rendered – an id that points to\n // nothing fails HTML validators and a11y checks.\n \"aria-describedby\": joinIds(\n renderedFieldErrorId,\n props[\"aria-describedby\"],\n ),\n },\n renderedFieldErrorId,\n } as const;\n};\n"],"mappings":";;;;;;;;AAqCA,IAAa,WAAW,GAAG,QACzB,IAAI,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,KAAK,KAAA;AAEnC,IAAa,qBACX,OACA,cACsB;CACtB,MAAM,eAAe,MAAM;CAC3B,MAAM,EAAE,gBAAgB,0BAA0B,yBAChD,cAAc;EACZ;EACA;CACF,CAAC;CAeH,OAAO;EACL;EACA;EACA,mBAAA;GAbA,OAAO;IACL,WAAW,yBAAgB;IAC3B,UAAU,CAAC,MAAM;IACjB,YAAY,CAAC,CAAC,MAAM;GACtB;GACA,kBAAkB,EAChB,WAAW,yBAAgB,iBAC7B;EAMA;EACA,cAAc,EACZ,WAAW,yBAAgB,UAC7B;EACA,cAAc,EAGZ,oBAAoB,QAClB,sBACA,MAAM,mBACR,EACF;EACA;CACF;AACF"}
@@ -5,7 +5,8 @@ import { PropsContextProvider } from "../propsContext/components/PropsContextPro
5
5
  import { ClearPropsContext } from "../propsContext/components/ClearPropsContext.mjs";
6
6
  import { UiComponentTunnelExit } from "../../components/UiComponentTunnel/UiComponentTunnelExit.mjs";
7
7
  import FormField_module_default from "../../components/FormField/FormField.module.mjs";
8
- import React, { useMemo } from "react";
8
+ import { FieldErrorRenderedContext } from "./fieldErrorRenderedContext.mjs";
9
+ import React, { useMemo, useState } from "react";
9
10
  import { jsx } from "react/jsx-runtime";
10
11
  //#region src/lib/hooks/useFieldError.tsx
11
12
  var useFieldError = (options) => {
@@ -19,27 +20,39 @@ var useFieldError = (options) => {
19
20
  },
20
21
  className: FormField_module_default.fieldError
21
22
  } };
22
- const FieldErrorCaptureContext = useMemo(() => (props) => {
23
- return /* @__PURE__ */ jsx(PropsContextProvider, {
24
- props: fieldErrorCapturePropsContext,
25
- dependencies: [tunnelId],
26
- children: props.children
27
- });
28
- }, [tunnelId]);
29
- const FieldErrorView = () => {
30
- if (currentTunnelId) return null;
31
- return /* @__PURE__ */ jsx(UiComponentTunnelExit, {
32
- id: tunnelId,
33
- component: options.component,
34
- children: (children) => {
35
- const childrenArray = React.Children.toArray(children);
36
- return /* @__PURE__ */ jsx(ClearPropsContext, { children: childrenArray[0] });
37
- }
38
- });
39
- };
23
+ const [renderedFieldErrorId, setRenderedFieldErrorId] = useState();
40
24
  return {
41
- FieldErrorCaptureContext,
42
- FieldErrorView
25
+ FieldErrorCaptureContext: useMemo(() => (props) => {
26
+ return /* @__PURE__ */ jsx(PropsContextProvider, {
27
+ props: fieldErrorCapturePropsContext,
28
+ dependencies: [tunnelId],
29
+ children: props.children
30
+ });
31
+ }, [tunnelId]),
32
+ FieldErrorView: useMemo(() => () => {
33
+ if (currentTunnelId) return null;
34
+ return /* @__PURE__ */ jsx(FieldErrorRenderedContext, {
35
+ value: setRenderedFieldErrorId,
36
+ children: /* @__PURE__ */ jsx(UiComponentTunnelExit, {
37
+ id: tunnelId,
38
+ component: options.component,
39
+ children: (children) => {
40
+ const childrenArray = React.Children.toArray(children);
41
+ return /* @__PURE__ */ jsx(ClearPropsContext, { children: childrenArray[0] });
42
+ }
43
+ })
44
+ });
45
+ }, [
46
+ currentTunnelId,
47
+ tunnelId,
48
+ options.component
49
+ ]),
50
+ /**
51
+ * The id of the error while one is rendered for this field. A nested field
52
+ * (a `Checkbox` inside a `CheckboxButton`) renders its error at the outer
53
+ * one, so only the outer field ever gets an id here.
54
+ */
55
+ renderedFieldErrorId
43
56
  };
44
57
  };
45
58
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"useFieldError.mjs","names":[],"sources":["../../../../../../../src/lib/hooks/useFieldError.tsx"],"sourcesContent":["import React, { type FC, type PropsWithChildren, useMemo } from \"react\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport ClearPropsContext from \"@/lib/propsContext/components/ClearPropsContext\";\nimport { useProps } from \"@/lib/hooks/useProps\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\nimport type { FlowComponentName } from \"@/components/propTypes\";\n\nexport interface UseFieldErrorOptions {\n fieldErrorId: string;\n tunnelId?: string;\n component: FlowComponentName;\n}\n\nexport const useFieldError = (options: UseFieldErrorOptions) => {\n const fieldErrorProps = useProps(\"FieldError\", {});\n const currentTunnelId = fieldErrorProps.tunnel?.id;\n const tunnelId =\n options.tunnelId ?? currentTunnelId ?? `${options.fieldErrorId}.fieldError`;\n\n const fieldErrorCapturePropsContext: PropsContext = {\n FieldError: {\n id: options.fieldErrorId,\n tunnel: { id: tunnelId, component: options.component },\n className: formFieldStyles.fieldError,\n },\n };\n\n const FieldErrorCaptureContext: FC<PropsWithChildren> = useMemo(\n () => (props) => {\n return (\n <PropsContextProvider\n props={fieldErrorCapturePropsContext}\n dependencies={[tunnelId]}\n >\n {props.children}\n </PropsContextProvider>\n );\n },\n [tunnelId],\n );\n\n const FieldErrorView = () => {\n if (currentTunnelId) {\n return null;\n }\n\n return (\n <UiComponentTunnelExit id={tunnelId} component={options.component}>\n {(children) => {\n const childrenArray = React.Children.toArray(children);\n return <ClearPropsContext>{childrenArray[0]}</ClearPropsContext>;\n }}\n </UiComponentTunnelExit>\n );\n };\n\n return {\n FieldErrorCaptureContext,\n FieldErrorView,\n } as const;\n};\n"],"mappings":";;;;;;;;;;AAcA,IAAa,iBAAiB,YAAkC;CAE9D,MAAM,kBADkB,SAAS,cAAc,CAAC,CACxB,CAAA,CAAgB,QAAQ;CAChD,MAAM,WACJ,QAAQ,YAAY,mBAAmB,GAAG,QAAQ,aAAa;CAEjE,MAAM,gCAA8C,EAClD,YAAY;EACV,IAAI,QAAQ;EACZ,QAAQ;GAAE,IAAI;GAAU,WAAW,QAAQ;EAAU;EACrD,WAAW,yBAAgB;CAC7B,EACF;CAEA,MAAM,2BAAkD,eAC/C,UAAU;EACf,OACE,oBAAC,sBAAD;GACE,OAAO;GACP,cAAc,CAAC,QAAQ;GAEtB,UAAA,MAAM;EACa,CAAA;CAE1B,GACA,CAAC,QAAQ,CACX;CAEA,MAAM,uBAAuB;EAC3B,IAAI,iBACF,OAAO;EAGT,OACE,oBAAC,uBAAD;GAAuB,IAAI;GAAU,WAAW,QAAQ;GACpD,WAAA,aAAa;IACb,MAAM,gBAAgB,MAAM,SAAS,QAAQ,QAAQ;IACrD,OAAO,oBAAC,mBAAD,EAAA,UAAoB,cAAc,GAAsB,CAAA;GACjE;EACqB,CAAA;CAE3B;CAEA,OAAO;EACL;EACA;CACF;AACF"}
1
+ {"version":3,"file":"useFieldError.mjs","names":[],"sources":["../../../../../../../src/lib/hooks/useFieldError.tsx"],"sourcesContent":["import React, {\n type FC,\n type PropsWithChildren,\n useMemo,\n useState,\n} from \"react\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport ClearPropsContext from \"@/lib/propsContext/components/ClearPropsContext\";\nimport { useProps } from \"@/lib/hooks/useProps\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\nimport type { FlowComponentName } from \"@/components/propTypes\";\nimport { FieldErrorRenderedContext } from \"@/lib/hooks/fieldErrorRenderedContext\";\n\nexport interface UseFieldErrorOptions {\n fieldErrorId: string;\n tunnelId?: string;\n component: FlowComponentName;\n}\n\nexport const useFieldError = (options: UseFieldErrorOptions) => {\n const fieldErrorProps = useProps(\"FieldError\", {});\n const currentTunnelId = fieldErrorProps.tunnel?.id;\n const tunnelId =\n options.tunnelId ?? currentTunnelId ?? `${options.fieldErrorId}.fieldError`;\n\n const fieldErrorCapturePropsContext: PropsContext = {\n FieldError: {\n id: options.fieldErrorId,\n tunnel: { id: tunnelId, component: options.component },\n className: formFieldStyles.fieldError,\n },\n };\n\n const [renderedFieldErrorId, setRenderedFieldErrorId] = useState<string>();\n\n const FieldErrorCaptureContext: FC<PropsWithChildren> = useMemo(\n () => (props) => {\n return (\n <PropsContextProvider\n props={fieldErrorCapturePropsContext}\n dependencies={[tunnelId]}\n >\n {props.children}\n </PropsContextProvider>\n );\n },\n [tunnelId],\n );\n\n // Keep the component identity stable: a new one per render makes React\n // remount the error on every render of the field (each keystroke).\n const FieldErrorView: FC = useMemo(\n () => () => {\n if (currentTunnelId) {\n return null;\n }\n\n return (\n <FieldErrorRenderedContext value={setRenderedFieldErrorId}>\n <UiComponentTunnelExit id={tunnelId} component={options.component}>\n {(children) => {\n const childrenArray = React.Children.toArray(children);\n return <ClearPropsContext>{childrenArray[0]}</ClearPropsContext>;\n }}\n </UiComponentTunnelExit>\n </FieldErrorRenderedContext>\n );\n },\n [currentTunnelId, tunnelId, options.component],\n );\n\n return {\n FieldErrorCaptureContext,\n FieldErrorView,\n /**\n * The id of the error while one is rendered for this field. A nested field\n * (a `Checkbox` inside a `CheckboxButton`) renders its error at the outer\n * one, so only the outer field ever gets an id here.\n */\n renderedFieldErrorId,\n } as const;\n};\n"],"mappings":";;;;;;;;;;;AAoBA,IAAa,iBAAiB,YAAkC;CAE9D,MAAM,kBADkB,SAAS,cAAc,CAAC,CACxB,CAAA,CAAgB,QAAQ;CAChD,MAAM,WACJ,QAAQ,YAAY,mBAAmB,GAAG,QAAQ,aAAa;CAEjE,MAAM,gCAA8C,EAClD,YAAY;EACV,IAAI,QAAQ;EACZ,QAAQ;GAAE,IAAI;GAAU,WAAW,QAAQ;EAAU;EACrD,WAAW,yBAAgB;CAC7B,EACF;CAEA,MAAM,CAAC,sBAAsB,2BAA2B,SAAiB;CAsCzE,OAAO;EACL,0BArCsD,eAC/C,UAAU;GACf,OACE,oBAAC,sBAAD;IACE,OAAO;IACP,cAAc,CAAC,QAAQ;IAEtB,UAAA,MAAM;GACa,CAAA;EAE1B,GACA,CAAC,QAAQ,CA0BT;EACA,gBAtByB,oBACb;GACV,IAAI,iBACF,OAAO;GAGT,OACE,oBAAC,2BAAD;IAA2B,OAAO;IAChC,UAAA,oBAAC,uBAAD;KAAuB,IAAI;KAAU,WAAW,QAAQ;KACpD,WAAA,aAAa;MACb,MAAM,gBAAgB,MAAM,SAAS,QAAQ,QAAQ;MACrD,OAAO,oBAAC,mBAAD,EAAA,UAAoB,cAAc,GAAsB,CAAA;KACjE;IACqB,CAAA;GACE,CAAA;EAE/B,GACA;GAAC;GAAiB;GAAU,QAAQ;EAAS,CAK7C;;;;;;EAMA;CACF;AACF"}
@@ -2,7 +2,7 @@ import { PropsWithChildren } from 'react';
2
2
  import { FileInputOnChangeHandler } from './components/FileInput';
3
3
  import { FlowComponentProps } from '../../lib/componentFactory/flowComponent';
4
4
  import type * as Aria from "react-aria-components";
5
- export interface FileFieldProps extends PropsWithChildren, FlowComponentProps<HTMLInputElement>, Pick<Aria.InputProps, "accept" | "multiple" | "name">, Pick<Aria.TextFieldProps, "isRequired" | "isInvalid" | "validationBehavior" | "isDisabled"> {
5
+ export interface FileFieldProps extends PropsWithChildren, FlowComponentProps<HTMLInputElement>, Pick<Aria.InputProps, "accept" | "multiple" | "name" | "aria-describedby">, Pick<Aria.TextFieldProps, "isRequired" | "isInvalid" | "validationBehavior" | "isDisabled"> {
6
6
  /** Handler that is called when the file input changes. */
7
7
  onChange?: FileInputOnChangeHandler;
8
8
  /** Whether the component is read only. */