@mittwald/flow-react-components 0.2.0-alpha.523 → 0.2.0-alpha.525

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 (160) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/assets/doc-properties.json +291 -253
  3. package/dist/css/all.css +1 -1
  4. package/dist/js/components/src/components/Autocomplete/Autocomplete.mjs +48 -36
  5. package/dist/js/components/src/components/Autocomplete/Autocomplete.mjs.map +1 -1
  6. package/dist/js/components/src/components/Checkbox/Checkbox.mjs +25 -7
  7. package/dist/js/components/src/components/Checkbox/Checkbox.mjs.map +1 -1
  8. package/dist/js/components/src/components/Checkbox/Checkbox.module.scss.mjs +3 -1
  9. package/dist/js/components/src/components/Checkbox/Checkbox.module.scss.mjs.map +1 -1
  10. package/dist/js/components/src/components/CheckboxButton/CheckboxButton.mjs +28 -6
  11. package/dist/js/components/src/components/CheckboxButton/CheckboxButton.mjs.map +1 -1
  12. package/dist/js/components/src/components/CheckboxButton/CheckboxButton.module.scss.mjs +6 -4
  13. package/dist/js/components/src/components/CheckboxButton/CheckboxButton.module.scss.mjs.map +1 -1
  14. package/dist/js/components/src/components/CheckboxGroup/CheckboxGroup.mjs +22 -26
  15. package/dist/js/components/src/components/CheckboxGroup/CheckboxGroup.mjs.map +1 -1
  16. package/dist/js/components/src/components/ComboBox/ComboBox.mjs +31 -27
  17. package/dist/js/components/src/components/ComboBox/ComboBox.mjs.map +1 -1
  18. package/dist/js/components/src/components/DatePicker/DatePicker.mjs +8 -18
  19. package/dist/js/components/src/components/DatePicker/DatePicker.mjs.map +1 -1
  20. package/dist/js/components/src/components/DateRangePicker/DateRangePicker.mjs +7 -19
  21. package/dist/js/components/src/components/DateRangePicker/DateRangePicker.mjs.map +1 -1
  22. package/dist/js/components/src/components/FieldError/FieldError.mjs +36 -5
  23. package/dist/js/components/src/components/FieldError/FieldError.mjs.map +1 -1
  24. package/dist/js/components/src/components/FileDropZone/FileDropZone.mjs +22 -11
  25. package/dist/js/components/src/components/FileDropZone/FileDropZone.mjs.map +1 -1
  26. package/dist/js/components/src/components/FileField/FileField.mjs +33 -31
  27. package/dist/js/components/src/components/FileField/FileField.mjs.map +1 -1
  28. package/dist/js/components/src/components/FormField/FormField.module.scss.mjs +1 -3
  29. package/dist/js/components/src/components/FormField/FormField.module.scss.mjs.map +1 -1
  30. package/dist/js/components/src/components/NumberField/NumberField.mjs +9 -18
  31. package/dist/js/components/src/components/NumberField/NumberField.mjs.map +1 -1
  32. package/dist/js/components/src/components/PasswordCreationField/PasswordCreationField.mjs +85 -79
  33. package/dist/js/components/src/components/PasswordCreationField/PasswordCreationField.mjs.map +1 -1
  34. package/dist/js/components/src/components/PasswordCreationField/lib/generateValidationTranslation.mjs +1 -0
  35. package/dist/js/components/src/components/PasswordCreationField/lib/generateValidationTranslation.mjs.map +1 -1
  36. package/dist/js/components/src/components/PasswordCreationField/lib/getStateFromLatestPolicyValidationResult.mjs +1 -0
  37. package/dist/js/components/src/components/PasswordCreationField/lib/getStateFromLatestPolicyValidationResult.mjs.map +1 -1
  38. package/dist/js/components/src/components/PasswordCreationField/worker/generatePassword.mjs +1 -0
  39. package/dist/js/components/src/components/PasswordCreationField/worker/generatePassword.mjs.map +1 -1
  40. package/dist/js/components/src/components/RadioGroup/RadioGroup.mjs +36 -34
  41. package/dist/js/components/src/components/RadioGroup/RadioGroup.mjs.map +1 -1
  42. package/dist/js/components/src/components/SearchField/SearchField.mjs +12 -17
  43. package/dist/js/components/src/components/SearchField/SearchField.mjs.map +1 -1
  44. package/dist/js/components/src/components/SegmentedControl/SegmentedControl.mjs +25 -23
  45. package/dist/js/components/src/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
  46. package/dist/js/components/src/components/Select/Select.mjs +30 -30
  47. package/dist/js/components/src/components/Select/Select.mjs.map +1 -1
  48. package/dist/js/components/src/components/Slider/Slider.mjs +10 -5
  49. package/dist/js/components/src/components/Slider/Slider.mjs.map +1 -1
  50. package/dist/js/components/src/components/Switch/Switch.mjs +22 -31
  51. package/dist/js/components/src/components/Switch/Switch.mjs.map +1 -1
  52. package/dist/js/components/src/components/Switch/Switch.module.scss.mjs +2 -4
  53. package/dist/js/components/src/components/Switch/Switch.module.scss.mjs.map +1 -1
  54. package/dist/js/components/src/components/TextArea/TextArea.mjs +16 -1
  55. package/dist/js/components/src/components/TextArea/TextArea.mjs.map +1 -1
  56. package/dist/js/components/src/components/TextField/TextField.mjs +14 -1
  57. package/dist/js/components/src/components/TextField/TextField.mjs.map +1 -1
  58. package/dist/js/components/src/components/TextFieldBase/TextFieldBase.mjs +13 -22
  59. package/dist/js/components/src/components/TextFieldBase/TextFieldBase.mjs.map +1 -1
  60. package/dist/js/components/src/components/TimeField/TimeField.mjs +8 -32
  61. package/dist/js/components/src/components/TimeField/TimeField.mjs.map +1 -1
  62. package/dist/js/components/src/integrations/@mittwald/password-tools-js/generatePasswordCreationFieldValidation.mjs +19 -13
  63. package/dist/js/components/src/integrations/@mittwald/password-tools-js/generatePasswordCreationFieldValidation.mjs.map +1 -1
  64. package/dist/js/components/src/integrations/react-hook-form/components/Field/Field.mjs +29 -14
  65. package/dist/js/components/src/integrations/react-hook-form/components/Field/Field.mjs.map +1 -1
  66. package/dist/js/components/src/lib/hooks/useFieldComponent.mjs +36 -0
  67. package/dist/js/components/src/lib/hooks/useFieldComponent.mjs.map +1 -0
  68. package/dist/js/components/src/lib/hooks/useFieldError.mjs +43 -0
  69. package/dist/js/components/src/lib/hooks/useFieldError.mjs.map +1 -0
  70. package/dist/js/components/src/lib/hooks/useManagedValue.mjs +7 -3
  71. package/dist/js/components/src/lib/hooks/useManagedValue.mjs.map +1 -1
  72. package/dist/types/components/Autocomplete/Autocomplete.d.ts +1 -0
  73. package/dist/types/components/Autocomplete/Autocomplete.d.ts.map +1 -1
  74. package/dist/types/components/Checkbox/Checkbox.d.ts +3 -2
  75. package/dist/types/components/Checkbox/Checkbox.d.ts.map +1 -1
  76. package/dist/types/components/CheckboxButton/CheckboxButton.d.ts +2 -2
  77. package/dist/types/components/CheckboxButton/CheckboxButton.d.ts.map +1 -1
  78. package/dist/types/components/CheckboxGroup/CheckboxGroup.d.ts.map +1 -1
  79. package/dist/types/components/ComboBox/ComboBox.d.ts.map +1 -1
  80. package/dist/types/components/ComboBox/stories/Default.stories.d.ts.map +1 -1
  81. package/dist/types/components/DatePicker/DatePicker.d.ts +1 -3
  82. package/dist/types/components/DatePicker/DatePicker.d.ts.map +1 -1
  83. package/dist/types/components/DatePicker/stories/Default.stories.d.ts.map +1 -1
  84. package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +1 -3
  85. package/dist/types/components/DateRangePicker/DateRangePicker.d.ts.map +1 -1
  86. package/dist/types/components/DateRangePicker/stories/Default.stories.d.ts.map +1 -1
  87. package/dist/types/components/FieldError/FieldError.d.ts +2 -2
  88. package/dist/types/components/FieldError/FieldError.d.ts.map +1 -1
  89. package/dist/types/components/FileDropZone/FileDropZone.d.ts.map +1 -1
  90. package/dist/types/components/FileDropZone/stories/Default.stories.d.ts.map +1 -1
  91. package/dist/types/components/FileField/FileField.d.ts.map +1 -1
  92. package/dist/types/components/NumberField/NumberField.d.ts +2 -2
  93. package/dist/types/components/NumberField/NumberField.d.ts.map +1 -1
  94. package/dist/types/components/PasswordCreationField/PasswordCreationField.d.ts.map +1 -1
  95. package/dist/types/components/RadioGroup/RadioGroup.d.ts.map +1 -1
  96. package/dist/types/components/SearchField/SearchField.d.ts.map +1 -1
  97. package/dist/types/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  98. package/dist/types/components/Select/Select.d.ts.map +1 -1
  99. package/dist/types/components/Slider/Slider.d.ts +1 -0
  100. package/dist/types/components/Slider/Slider.d.ts.map +1 -1
  101. package/dist/types/components/Switch/Switch.d.ts.map +1 -1
  102. package/dist/types/components/TextArea/TextArea.d.ts +1 -1
  103. package/dist/types/components/TextArea/TextArea.d.ts.map +1 -1
  104. package/dist/types/components/TextField/TextField.d.ts +1 -1
  105. package/dist/types/components/TextField/TextField.d.ts.map +1 -1
  106. package/dist/types/components/TextFieldBase/TextFieldBase.d.ts +2 -1
  107. package/dist/types/components/TextFieldBase/TextFieldBase.d.ts.map +1 -1
  108. package/dist/types/components/TimeField/TimeField.d.ts +2 -4
  109. package/dist/types/components/TimeField/TimeField.d.ts.map +1 -1
  110. package/dist/types/integrations/@mittwald/password-tools-js/generatePasswordCreationFieldValidation.d.ts.map +1 -1
  111. package/dist/types/integrations/react-hook-form/components/Field/Field.d.ts.map +1 -1
  112. package/dist/types/integrations/react-hook-form/components/Field/stories/Autocomplete.stories.d.ts +2 -1
  113. package/dist/types/integrations/react-hook-form/components/Field/stories/Autocomplete.stories.d.ts.map +1 -1
  114. package/dist/types/integrations/react-hook-form/components/Field/stories/Checkbox.stories.d.ts +2 -1
  115. package/dist/types/integrations/react-hook-form/components/Field/stories/Checkbox.stories.d.ts.map +1 -1
  116. package/dist/types/integrations/react-hook-form/components/Field/stories/CheckboxButton.stories.d.ts +9 -0
  117. package/dist/types/integrations/react-hook-form/components/Field/stories/CheckboxButton.stories.d.ts.map +1 -0
  118. package/dist/types/integrations/react-hook-form/components/Field/stories/CheckboxGroup.stories.d.ts +2 -1
  119. package/dist/types/integrations/react-hook-form/components/Field/stories/CheckboxGroup.stories.d.ts.map +1 -1
  120. package/dist/types/integrations/react-hook-form/components/Field/stories/ComboBox.stories.d.ts +2 -1
  121. package/dist/types/integrations/react-hook-form/components/Field/stories/ComboBox.stories.d.ts.map +1 -1
  122. package/dist/types/integrations/react-hook-form/components/Field/stories/DatePicker.stories.d.ts +2 -1
  123. package/dist/types/integrations/react-hook-form/components/Field/stories/DatePicker.stories.d.ts.map +1 -1
  124. package/dist/types/integrations/react-hook-form/components/Field/stories/DateRangePicker.stories.d.ts +2 -1
  125. package/dist/types/integrations/react-hook-form/components/Field/stories/DateRangePicker.stories.d.ts.map +1 -1
  126. package/dist/types/integrations/react-hook-form/components/Field/stories/FileField.stories.d.ts +2 -1
  127. package/dist/types/integrations/react-hook-form/components/Field/stories/FileField.stories.d.ts.map +1 -1
  128. package/dist/types/integrations/react-hook-form/components/Field/stories/MarkdownEditor.stories.d.ts +2 -1
  129. package/dist/types/integrations/react-hook-form/components/Field/stories/MarkdownEditor.stories.d.ts.map +1 -1
  130. package/dist/types/integrations/react-hook-form/components/Field/stories/NumberField.stories.d.ts +2 -1
  131. package/dist/types/integrations/react-hook-form/components/Field/stories/NumberField.stories.d.ts.map +1 -1
  132. package/dist/types/integrations/react-hook-form/components/Field/stories/PasswordCreationField.stories.d.ts +2 -1
  133. package/dist/types/integrations/react-hook-form/components/Field/stories/PasswordCreationField.stories.d.ts.map +1 -1
  134. package/dist/types/integrations/react-hook-form/components/Field/stories/RadioGroup.stories.d.ts +2 -1
  135. package/dist/types/integrations/react-hook-form/components/Field/stories/RadioGroup.stories.d.ts.map +1 -1
  136. package/dist/types/integrations/react-hook-form/components/Field/stories/SearchField.stories.d.ts +2 -1
  137. package/dist/types/integrations/react-hook-form/components/Field/stories/SearchField.stories.d.ts.map +1 -1
  138. package/dist/types/integrations/react-hook-form/components/Field/stories/SegmentedControl.stories.d.ts +2 -1
  139. package/dist/types/integrations/react-hook-form/components/Field/stories/SegmentedControl.stories.d.ts.map +1 -1
  140. package/dist/types/integrations/react-hook-form/components/Field/stories/Select.stories.d.ts +2 -1
  141. package/dist/types/integrations/react-hook-form/components/Field/stories/Select.stories.d.ts.map +1 -1
  142. package/dist/types/integrations/react-hook-form/components/Field/stories/Slider.stories.d.ts +2 -1
  143. package/dist/types/integrations/react-hook-form/components/Field/stories/Slider.stories.d.ts.map +1 -1
  144. package/dist/types/integrations/react-hook-form/components/Field/stories/Switch.stories.d.ts +2 -1
  145. package/dist/types/integrations/react-hook-form/components/Field/stories/Switch.stories.d.ts.map +1 -1
  146. package/dist/types/integrations/react-hook-form/components/Field/stories/TextArea.stories.d.ts +2 -1
  147. package/dist/types/integrations/react-hook-form/components/Field/stories/TextArea.stories.d.ts.map +1 -1
  148. package/dist/types/integrations/react-hook-form/components/Field/stories/TextField.stories.d.ts +2 -1
  149. package/dist/types/integrations/react-hook-form/components/Field/stories/TextField.stories.d.ts.map +1 -1
  150. package/dist/types/integrations/react-hook-form/components/Field/stories/TimeField.stories.d.ts +2 -1
  151. package/dist/types/integrations/react-hook-form/components/Field/stories/TimeField.stories.d.ts.map +1 -1
  152. package/dist/types/lib/hooks/useFieldComponent.d.ts +19 -0
  153. package/dist/types/lib/hooks/useFieldComponent.d.ts.map +1 -0
  154. package/dist/types/lib/hooks/useFieldError.d.ts +10 -0
  155. package/dist/types/lib/hooks/useFieldError.d.ts.map +1 -0
  156. package/dist/types/lib/hooks/useManagedValue.d.ts +9 -7
  157. package/dist/types/lib/hooks/useManagedValue.d.ts.map +1 -1
  158. package/package.json +4 -4
  159. package/dist/js/components/src/views/FieldErrorView.mjs +0 -15
  160. package/dist/js/components/src/views/FieldErrorView.mjs.map +0 -1
@@ -3,34 +3,25 @@
3
3
  import { jsxs, jsx } from 'react/jsx-runtime';
4
4
  import { useState } from 'react';
5
5
  import * as Aria from 'react-aria-components';
6
- import formFieldStyles from '../FormField/FormField.module.scss.mjs';
7
- import clsx from 'clsx';
8
- import '../../lib/propsContext/propsContext.mjs';
9
- import { PropsContextProvider } from '../../lib/propsContext/components/PropsContextProvider.mjs';
10
- import { FieldError } from '../FieldError/FieldError.mjs';
11
6
  import { FieldDescription } from '../FieldDescription/FieldDescription.mjs';
12
7
  import locales from '../../../../_virtual/_.locale.json@444629885187f8ca5450a1c8b14fb45c.mjs';
13
8
  import { useLocalizedStringFormatter } from 'react-aria';
9
+ import formFieldStyles from '../FormField/FormField.module.scss.mjs';
14
10
 
15
11
  const TextFieldBase = (props) => {
16
- const { children, className, input, showCharacterCount, ref, ...rest } = props;
12
+ const {
13
+ children,
14
+ className,
15
+ input,
16
+ showCharacterCount,
17
+ ref,
18
+ FieldErrorView,
19
+ ...rest
20
+ } = props;
17
21
  const [charactersCount, setCharactersCount] = useState(
18
22
  props.value?.length ?? 0
19
23
  );
20
- const rootClassName = clsx(formFieldStyles.formField, className);
21
24
  const translation = useLocalizedStringFormatter(locales);
22
- const propsContext = {
23
- Label: {
24
- className: formFieldStyles.label,
25
- optional: !props.isRequired
26
- },
27
- FieldDescription: {
28
- className: formFieldStyles.fieldDescription
29
- },
30
- FieldError: {
31
- className: formFieldStyles.customFieldError
32
- }
33
- };
34
25
  const handleOnChange = (v) => {
35
26
  if (showCharacterCount) {
36
27
  setCharactersCount(v.length);
@@ -54,14 +45,14 @@ const TextFieldBase = (props) => {
54
45
  {
55
46
  ref,
56
47
  ...rest,
57
- className: rootClassName,
48
+ className,
58
49
  onChange: handleOnChange,
59
50
  ...propsWithOptionalStringValue,
60
51
  children: [
61
- /* @__PURE__ */ jsx(PropsContextProvider, { props: propsContext, children }),
52
+ children,
62
53
  input,
63
54
  showCharacterCount && /* @__PURE__ */ jsx(FieldDescription, { className: formFieldStyles.fieldDescription, children: charactersCountDescription }),
64
- /* @__PURE__ */ jsx(FieldError, { className: formFieldStyles.fieldError })
55
+ /* @__PURE__ */ jsx(FieldErrorView, {})
65
56
  ]
66
57
  }
67
58
  );
@@ -1 +1 @@
1
- {"version":3,"file":"TextFieldBase.mjs","sources":["../../../../../../src/components/TextFieldBase/TextFieldBase.tsx"],"sourcesContent":["import { type FC, type PropsWithChildren, type ReactNode } from \"react\";\nimport { useState } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport styles from \"../FormField/FormField.module.scss\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { FieldError } from \"@/components/FieldError\";\nimport { FieldDescription } from \"@/components/FieldDescription\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\n\nexport interface TextFieldBaseProps\n extends PropsWithChildren<Omit<Aria.TextFieldProps, \"children\">>,\n Pick<FlowComponentProps<HTMLInputElement>, \"ref\"> {\n /** The input element */\n input: ReactNode;\n /** Whether a character count should be displayed inside the field description. */\n showCharacterCount?: boolean;\n}\n\nexport const TextFieldBase: FC<TextFieldBaseProps> = (props) => {\n const { children, className, input, showCharacterCount, ref, ...rest } =\n props;\n\n const [charactersCount, setCharactersCount] = useState(\n props.value?.length ?? 0,\n );\n\n const rootClassName = clsx(styles.formField, className);\n\n const translation = useLocalizedStringFormatter(locales);\n\n const propsContext: PropsContext = {\n Label: {\n className: styles.label,\n optional: !props.isRequired,\n },\n FieldDescription: {\n className: styles.fieldDescription,\n },\n FieldError: {\n className: styles.customFieldError,\n },\n };\n\n const handleOnChange = (v: string) => {\n if (showCharacterCount) {\n setCharactersCount(v.length);\n }\n if (props.onChange) {\n props.onChange(v);\n }\n };\n\n const charactersCountDescription = translation.format(\n \"textFieldBase.characters\",\n {\n count: charactersCount,\n maxCount: props.maxLength ?? 0,\n },\n );\n\n /** Prevent weird reset behavior when value is 'undefined' */\n const propsWithOptionalStringValue =\n \"value\" in props\n ? {\n value: props.value ?? \"\",\n }\n : {};\n\n return (\n <Aria.TextField\n ref={ref}\n {...rest}\n className={rootClassName}\n onChange={handleOnChange}\n {...propsWithOptionalStringValue}\n >\n <PropsContextProvider props={propsContext}>\n {children}\n </PropsContextProvider>\n {input}\n {showCharacterCount && (\n <FieldDescription className={styles.fieldDescription}>\n {charactersCountDescription}\n </FieldDescription>\n )}\n <FieldError className={styles.fieldError} />\n </Aria.TextField>\n );\n};\n\nexport default TextFieldBase;\n"],"names":["styles"],"mappings":";;;;;;;;;;;;AAsBO,MAAM,aAAA,GAAwC,CAAC,KAAA,KAAU;AAC9D,EAAA,MAAM,EAAE,UAAU,SAAA,EAAW,KAAA,EAAO,oBAAoB,GAAA,EAAK,GAAG,MAAK,GACnE,KAAA;AAEF,EAAA,MAAM,CAAC,eAAA,EAAiB,kBAAkB,CAAA,GAAI,QAAA;AAAA,IAC5C,KAAA,CAAM,OAA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YAAA,EAC1B,QAAA,EACH,CAAA;AAAA,QACC,KAAA;AAAA,QACA,sCACC,GAAA,CAAC,gBAAA,EAAA,EAAiB,SAAA,EAAWA,eAAA,CAAO,kBACjC,QAAA,EAAA,0BAAA,EACH,CAAA;AAAA,wBAEF,GAAA,CAAC,UAAA,EAAA,EAAW,SAAA,EAAWA,eAAA,CAAO,UAAA,EAAY;AAAA;AAAA;AAAA,GAC5C;AAEJ;;;;"}
1
+ {"version":3,"file":"TextFieldBase.mjs","sources":["../../../../../../src/components/TextFieldBase/TextFieldBase.tsx"],"sourcesContent":["import { type FC, type PropsWithChildren, type ReactNode } from \"react\";\nimport { useState } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport { FieldDescription } from \"@/components/FieldDescription\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport type { UseFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport styles from \"../FormField/FormField.module.scss\";\n\nexport interface TextFieldBaseProps\n extends PropsWithChildren<Omit<Aria.TextFieldProps, \"children\">>,\n Pick<FlowComponentProps<HTMLInputElement>, \"ref\">,\n Pick<UseFieldComponent, \"FieldErrorView\"> {\n /** The input element */\n input: ReactNode;\n /** Whether a character count should be displayed inside the field description. */\n showCharacterCount?: boolean;\n}\n\nexport const TextFieldBase: FC<TextFieldBaseProps> = (props) => {\n const {\n children,\n className,\n input,\n showCharacterCount,\n ref,\n FieldErrorView,\n ...rest\n } = props;\n\n const [charactersCount, setCharactersCount] = useState(\n props.value?.length ?? 0,\n );\n\n const translation = useLocalizedStringFormatter(locales);\n\n const handleOnChange = (v: string) => {\n if (showCharacterCount) {\n setCharactersCount(v.length);\n }\n if (props.onChange) {\n props.onChange(v);\n }\n };\n\n const charactersCountDescription = translation.format(\n \"textFieldBase.characters\",\n {\n count: charactersCount,\n maxCount: props.maxLength ?? 0,\n },\n );\n\n /** Prevent weird reset behavior when value is 'undefined' */\n const propsWithOptionalStringValue =\n \"value\" in props\n ? {\n value: props.value ?? \"\",\n }\n : {};\n\n return (\n <Aria.TextField\n ref={ref}\n {...rest}\n className={className}\n onChange={handleOnChange}\n {...propsWithOptionalStringValue}\n >\n {children}\n {input}\n {showCharacterCount && (\n <FieldDescription className={styles.fieldDescription}>\n {charactersCountDescription}\n </FieldDescription>\n )}\n <FieldErrorView />\n </Aria.TextField>\n );\n};\n\nexport default TextFieldBase;\n"],"names":["styles"],"mappings":";;;;;;;;AAoBO,MAAM,aAAA,GAAwC,CAAC,KAAA,KAAU;AAC9D,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA;AAAA,IACA,kBAAA;AAAA,IACA,GAAA;AAAA,IACA,cAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,CAAC,eAAA,EAAiB,kBAAkB,CAAA,GAAI,QAAA;AAAA,IAC5C,KAAA,CAAM,OAAO,MAAA,IAAU;AAAA,GACzB;AAEA,EAAA,MAAM,WAAA,GAAc,4BAA4B,OAAO,CAAA;AAEvD,EAAA,MAAM,cAAA,GAAiB,CAAC,CAAA,KAAc;AACpC,IAAA,IAAI,kBAAA,EAAoB;AACtB,MAAA,kBAAA,CAAmB,EAAE,MAAM,CAAA;AAAA,IAC7B;AACA,IAAA,IAAI,MAAM,QAAA,EAAU;AAClB,MAAA,KAAA,CAAM,SAAS,CAAC,CAAA;AAAA,IAClB;AAAA,EACF,CAAA;AAEA,EAAA,MAAM,6BAA6B,WAAA,CAAY,MAAA;AAAA,IAC7C,0BAAA;AAAA,IACA;AAAA,MACE,KAAA,EAAO,eAAA;AAAA,MACP,QAAA,EAAU,MAAM,SAAA,IAAa;AAAA;AAC/B,GACF;AAGA,EAAA,MAAM,4BAAA,GACJ,WAAW,KAAA,GACP;AAAA,IACE,KAAA,EAAO,MAAM,KAAA,IAAS;AAAA,MAExB,EAAC;AAEP,EAAA,uBACE,IAAA;AAAA,IAAC,IAAA,CAAK,SAAA;AAAA,IAAL;AAAA,MACC,GAAA;AAAA,MACC,GAAG,IAAA;AAAA,MACJ,SAAA;AAAA,MACA,QAAA,EAAU,cAAA;AAAA,MACT,GAAG,4BAAA;AAAA,MAEH,QAAA,EAAA;AAAA,QAAA,QAAA;AAAA,QACA,KAAA;AAAA,QACA,sCACC,GAAA,CAAC,gBAAA,EAAA,EAAiB,SAAA,EAAWA,eAAA,CAAO,kBACjC,QAAA,EAAA,0BAAA,EACH,CAAA;AAAA,4BAED,cAAA,EAAA,EAAe;AAAA;AAAA;AAAA,GAClB;AAEJ;;;;"}
@@ -6,45 +6,21 @@ import * as Aria from 'react-aria-components';
6
6
  import { flowComponent } from '../../lib/componentFactory/flowComponent.mjs';
7
7
  import '../../lib/propsContext/propsContext.mjs';
8
8
  import { PropsContextProvider } from '../../lib/propsContext/components/PropsContextProvider.mjs';
9
- import formFieldStyles from '../FormField/FormField.module.scss.mjs';
10
- import { FieldError } from '../FieldError/FieldError.mjs';
11
- import clsx from 'clsx';
12
9
  import styles from './TimeField.module.scss.mjs';
13
10
  import { useMakeFocusable } from '../../lib/hooks/dom/useMakeFocusable.mjs';
14
11
  import { useObjectRef } from '@react-aria/utils';
12
+ import { useFieldComponent } from '../../lib/hooks/useFieldComponent.mjs';
15
13
 
16
14
  const TimeField = flowComponent("TimeField", (props) => {
17
- const { children, errorMessage, className, ref, ...rest } = props;
18
- const rootClassName = clsx(formFieldStyles.formField, className);
19
- const propsContext = {
20
- Label: {
21
- className: formFieldStyles.label,
22
- optional: !props.isRequired,
23
- isDisabled: rest.isDisabled
24
- },
25
- FieldDescription: {
26
- className: formFieldStyles.fieldDescription
27
- },
28
- FieldError: {
29
- className: formFieldStyles.customFieldError
30
- }
31
- };
15
+ const { children, ref, ...rest } = props;
16
+ const { FieldErrorView, fieldPropsContext, fieldProps } = useFieldComponent(props);
32
17
  const localRef = useObjectRef(ref);
33
18
  useMakeFocusable(localRef);
34
- return /* @__PURE__ */ jsxs(
35
- Aria.TimeField,
36
- {
37
- ref: localRef,
38
- hourCycle: 24,
39
- className: rootClassName,
40
- ...rest,
41
- children: [
42
- /* @__PURE__ */ jsx(PropsContextProvider, { props: propsContext, children }),
43
- /* @__PURE__ */ jsx(FieldError, { className: formFieldStyles.fieldError, children: errorMessage }),
44
- /* @__PURE__ */ jsx(Aria.DateInput, { className: styles.dateInput, children: (segment) => /* @__PURE__ */ jsx(Aria.DateSegment, { segment }) })
45
- ]
46
- }
47
- );
19
+ return /* @__PURE__ */ jsxs(Aria.TimeField, { ref: localRef, hourCycle: 24, ...rest, ...fieldProps, children: [
20
+ /* @__PURE__ */ jsx(Aria.DateInput, { className: styles.dateInput, children: (segment) => /* @__PURE__ */ jsx(Aria.DateSegment, { segment }) }),
21
+ /* @__PURE__ */ jsx(PropsContextProvider, { props: fieldPropsContext, children }),
22
+ /* @__PURE__ */ jsx(FieldErrorView, {})
23
+ ] });
48
24
  });
49
25
 
50
26
  export { TimeField, TimeField as default };
@@ -1 +1 @@
1
- {"version":3,"file":"TimeField.mjs","sources":["../../../../../../src/components/TimeField/TimeField.tsx"],"sourcesContent":["import { type PropsWithChildren, type ReactNode } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport { FieldError } from \"@/components/FieldError\";\nimport clsx from \"clsx\";\nimport styles from \"./TimeField.module.scss\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\nimport { useObjectRef } from \"@react-aria/utils\";\n\nexport interface TimeFieldProps<T extends Aria.TimeValue = Aria.TimeValue>\n extends PropsWithChildren<Omit<Aria.TimeFieldProps<T>, \"children\">>,\n FlowComponentProps<HTMLInputElement> {\n /** An error message to be displayed below the field */\n errorMessage?: ReactNode;\n}\n\n/** @flr-generate all */\nexport const TimeField = flowComponent(\"TimeField\", (props) => {\n const { children, errorMessage, className, ref, ...rest } = props;\n\n const rootClassName = clsx(formFieldStyles.formField, className);\n\n const propsContext: PropsContext = {\n Label: {\n className: formFieldStyles.label,\n optional: !props.isRequired,\n isDisabled: rest.isDisabled,\n },\n FieldDescription: {\n className: formFieldStyles.fieldDescription,\n },\n FieldError: {\n className: formFieldStyles.customFieldError,\n },\n };\n\n const localRef = useObjectRef(ref);\n useMakeFocusable(localRef);\n\n return (\n <Aria.TimeField\n ref={localRef}\n hourCycle={24}\n className={rootClassName}\n {...rest}\n >\n <PropsContextProvider props={propsContext}>\n {children}\n </PropsContextProvider>\n <FieldError className={formFieldStyles.fieldError}>\n {errorMessage}\n </FieldError>\n <Aria.DateInput className={styles.dateInput}>\n {(segment) => <Aria.DateSegment segment={segment} />}\n </Aria.DateInput>\n </Aria.TimeField>\n );\n});\n\nexport default TimeField;\n"],"names":[],"mappings":";;;;;;;;;;;;;AAuBO,MAAM,SAAA,GAAY,aAAA,CAAc,WAAA,EAAa,CAAC,KAAA,KAAU;AAC7D,EAAA,MAAM,EAAE,QAAA,EAAU,YAAA,EAAc,WAAW,GAAA,EAAK,GAAG,MAAK,GAAI,KAAA;AAE5D,EAAA,MAAM,aAAA,GAAgB,IAAA,CAAK,eAAA,CAAgB,SAAA,EAAW,SAAS,CAAA;AAE/D,EAAA,MAAM,YAAA,GAA6B;AAAA,IACjC,KAAA,EAAO;AAAA,MACL,WAAW,eAAA,CAAgB,KAAA;AAAA,MAC3B,QAAA,EAAU,CAAC,KAAA,CAAM,UAAA;AAAA,MACjB,YAAY,IAAA,CAAK;AAAA,KACnB;AAAA,IACA,gBAAA,EAAkB;AAAA,MAChB,WAAW,eAAA,CAAgB;AAAA,KAC7B;AAAA,IACA,UAAA,EAAY;AAAA,MACV,WAAW,eAAA,CAAgB;AAAA;AAC7B,GACF;AAEA,EAAA,MAAM,QAAA,GAAW,aAAa,GAAG,CAAA;AACjC,EAAA,gBAAA,CAAiB,QAAQ,CAAA;AAEzB,EAAA,uBACE,IAAA;AAAA,IAAC,IAAA,CAAK,SAAA;AAAA,IAAL;AAAA,MACC,GAAA,EAAK,QAAA;AAAA,MACL,SAAA,EAAW,EAAA;AAAA,MACX,SAAA,EAAW,aAAA;AAAA,MACV,GAAG,IAAA;AAAA,MAEJ,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,oBAAA,EAAA,EAAqB,KAAA,EAAO,YAAA,EAC1B,QAAA,EACH,CAAA;AAAA,wBACA,GAAA,CAAC,UAAA,EAAA,EAAW,SAAA,EAAW,eAAA,CAAgB,YACpC,QAAA,EAAA,YAAA,EACH,CAAA;AAAA,wBACA,GAAA,CAAC,IAAA,CAAK,SAAA,EAAL,EAAe,WAAW,MAAA,CAAO,SAAA,EAC/B,QAAA,EAAA,CAAC,OAAA,qBAAY,GAAA,CAAC,IAAA,CAAK,WAAA,EAAL,EAAiB,SAAkB,CAAA,EACpD;AAAA;AAAA;AAAA,GACF;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"TimeField.mjs","sources":["../../../../../../src/components/TimeField/TimeField.tsx"],"sourcesContent":["import React, { 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 { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nexport interface TimeFieldProps<T extends Aria.TimeValue = Aria.TimeValue>\n extends PropsWithChildren<Omit<Aria.TimeFieldProps<T>, \"children\">>,\n FlowComponentProps<HTMLInputElement> {}\n\n/** @flr-generate all */\nexport const TimeField = flowComponent(\"TimeField\", (props) => {\n const { children, ref, ...rest } = props;\n\n const { FieldErrorView, fieldPropsContext, fieldProps } =\n useFieldComponent(props);\n\n const localRef = useObjectRef(ref);\n useMakeFocusable(localRef);\n\n return (\n <Aria.TimeField ref={localRef} hourCycle={24} {...rest} {...fieldProps}>\n <Aria.DateInput className={styles.dateInput}>\n {(segment) => <Aria.DateSegment segment={segment} />}\n </Aria.DateInput>\n <PropsContextProvider props={fieldPropsContext}>\n {children}\n </PropsContextProvider>\n <FieldErrorView />\n </Aria.TimeField>\n );\n});\n\nexport default TimeField;\n"],"names":[],"mappings":";;;;;;;;;;;AAgBO,MAAM,SAAA,GAAY,aAAA,CAAc,WAAA,EAAa,CAAC,KAAA,KAAU;AAC7D,EAAA,MAAM,EAAE,QAAA,EAAU,GAAA,EAAK,GAAG,MAAK,GAAI,KAAA;AAEnC,EAAA,MAAM,EAAE,cAAA,EAAgB,iBAAA,EAAmB,UAAA,EAAW,GACpD,kBAAkB,KAAK,CAAA;AAEzB,EAAA,MAAM,QAAA,GAAW,aAAa,GAAG,CAAA;AACjC,EAAA,gBAAA,CAAiB,QAAQ,CAAA;AAEzB,EAAA,uBACE,IAAA,CAAC,IAAA,CAAK,SAAA,EAAL,EAAe,GAAA,EAAK,QAAA,EAAU,SAAA,EAAW,EAAA,EAAK,GAAG,IAAA,EAAO,GAAG,UAAA,EAC1D,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,IAAA,CAAK,SAAA,EAAL,EAAe,SAAA,EAAW,MAAA,CAAO,SAAA,EAC/B,QAAA,EAAA,CAAC,OAAA,qBAAY,GAAA,CAAC,IAAA,CAAK,WAAA,EAAL,EAAiB,SAAkB,CAAA,EACpD,CAAA;AAAA,oBACA,GAAA,CAAC,oBAAA,EAAA,EAAqB,KAAA,EAAO,iBAAA,EAC1B,QAAA,EACH,CAAA;AAAA,wBACC,cAAA,EAAA,EAAe;AAAA,GAAA,EAClB,CAAA;AAEJ,CAAC;;;;"}
@@ -3,23 +3,29 @@
3
3
  import { Policy } from '@mittwald/password-tools-js/policy';
4
4
  import { defaultPasswordCreationPolicy } from './defaultPasswordCreationPolicy.mjs';
5
5
  import { isPromise } from 'remeda';
6
+ import { useMemo } from 'react';
6
7
  import '@mittwald/password-tools-js/rules';
7
8
  import '@mittwald/password-tools-js/generator';
8
9
 
9
- const generatePasswordCreationFieldValidation = (genericValidationPolicy = defaultPasswordCreationPolicy) => async (value) => {
10
- if (!value) {
11
- return true;
12
- }
13
- try {
14
- const validationPolicy = Policy.fromDeclaration(genericValidationPolicy);
15
- const validationResult = await validationPolicy.validate(value);
16
- if (isPromise(validationResult.isValid)) {
17
- return await validationResult.isValid;
10
+ const generatePasswordCreationFieldValidation = (genericValidationPolicy = defaultPasswordCreationPolicy) => {
11
+ const validationPolicy = useMemo(
12
+ () => Policy.fromDeclaration(genericValidationPolicy),
13
+ [genericValidationPolicy]
14
+ );
15
+ return async (value) => {
16
+ if (!value) {
17
+ return true;
18
18
  }
19
- return validationResult.isValid;
20
- } catch (ignoredError) {
21
- return false;
22
- }
19
+ try {
20
+ const validationResult = await validationPolicy.validate(value);
21
+ if (isPromise(validationResult.isValid)) {
22
+ return await validationResult.isValid;
23
+ }
24
+ return validationResult.isValid;
25
+ } catch (ignoredError) {
26
+ return false;
27
+ }
28
+ };
23
29
  };
24
30
 
25
31
  export { generatePasswordCreationFieldValidation };
@@ -1 +1 @@
1
- {"version":3,"file":"generatePasswordCreationFieldValidation.mjs","sources":["../../../../../../../src/integrations/@mittwald/password-tools-js/generatePasswordCreationFieldValidation.ts"],"sourcesContent":["import type { PolicyGenericDeclaration } from \"@mittwald/password-tools-js/policy\";\nimport { Policy } from \"@mittwald/password-tools-js/policy\";\nimport { defaultPasswordCreationPolicy } from \"./\";\nimport { isPromise } from \"remeda\";\n\nexport const generatePasswordCreationFieldValidation =\n (\n genericValidationPolicy: PolicyGenericDeclaration = defaultPasswordCreationPolicy,\n ) =>\n async (value: string) => {\n if (!value) {\n return true;\n }\n\n try {\n const validationPolicy = Policy.fromDeclaration(genericValidationPolicy);\n const validationResult = await validationPolicy.validate(value);\n\n if (isPromise(validationResult.isValid)) {\n return await validationResult.isValid;\n }\n\n return validationResult.isValid;\n } catch (ignoredError) {\n return false;\n }\n };\n"],"names":[],"mappings":";;;;;;AAKO,MAAM,uCAAA,GACX,CACE,uBAAA,GAAoD,6BAAA,KAEtD,OAAO,KAAA,KAAkB;AACvB,EAAA,IAAI,CAAC,KAAA,EAAO;AACV,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,IAAI;AACF,IAAA,MAAM,gBAAA,GAAmB,MAAA,CAAO,eAAA,CAAgB,uBAAuB,CAAA;AACvE,IAAA,MAAM,gBAAA,GAAmB,MAAM,gBAAA,CAAiB,QAAA,CAAS,KAAK,CAAA;AAE9D,IAAA,IAAI,SAAA,CAAU,gBAAA,CAAiB,OAAO,CAAA,EAAG;AACvC,MAAA,OAAO,MAAM,gBAAA,CAAiB,OAAA;AAAA,IAChC;AAEA,IAAA,OAAO,gBAAA,CAAiB,OAAA;AAAA,EAC1B,SAAS,YAAA,EAAc;AACrB,IAAA,OAAO,KAAA;AAAA,EACT;AACF;;;;"}
1
+ {"version":3,"file":"generatePasswordCreationFieldValidation.mjs","sources":["../../../../../../../src/integrations/@mittwald/password-tools-js/generatePasswordCreationFieldValidation.ts"],"sourcesContent":["import type { PolicyGenericDeclaration } from \"@mittwald/password-tools-js/policy\";\nimport { Policy } from \"@mittwald/password-tools-js/policy\";\nimport { defaultPasswordCreationPolicy } from \"./\";\nimport { isPromise } from \"remeda\";\nimport { useMemo } from \"react\";\n\nexport const generatePasswordCreationFieldValidation = (\n genericValidationPolicy: PolicyGenericDeclaration = defaultPasswordCreationPolicy,\n) => {\n const validationPolicy = useMemo(\n () => Policy.fromDeclaration(genericValidationPolicy),\n [genericValidationPolicy],\n );\n\n return async (value: string) => {\n if (!value) {\n return true;\n }\n\n try {\n const validationResult = await validationPolicy.validate(value);\n\n if (isPromise(validationResult.isValid)) {\n return await validationResult.isValid;\n }\n\n return validationResult.isValid;\n } catch (ignoredError) {\n return false;\n }\n };\n};\n"],"names":[],"mappings":";;;;;;;AAMO,MAAM,uCAAA,GAA0C,CACrD,uBAAA,GAAoD,6BAAA,KACjD;AACH,EAAA,MAAM,gBAAA,GAAmB,OAAA;AAAA,IACvB,MAAM,MAAA,CAAO,eAAA,CAAgB,uBAAuB,CAAA;AAAA,IACpD,CAAC,uBAAuB;AAAA,GAC1B;AAEA,EAAA,OAAO,OAAO,KAAA,KAAkB;AAC9B,IAAA,IAAI,CAAC,KAAA,EAAO;AACV,MAAA,OAAO,IAAA;AAAA,IACT;AAEA,IAAA,IAAI;AACF,MAAA,MAAM,gBAAA,GAAmB,MAAM,gBAAA,CAAiB,QAAA,CAAS,KAAK,CAAA;AAE9D,MAAA,IAAI,SAAA,CAAU,gBAAA,CAAiB,OAAO,CAAA,EAAG;AACvC,QAAA,OAAO,MAAM,gBAAA,CAAiB,OAAA;AAAA,MAChC;AAEA,MAAA,OAAO,gBAAA,CAAiB,OAAA;AAAA,IAC1B,SAAS,YAAA,EAAc;AACrB,MAAA,OAAO,KAAA;AAAA,IACT;AAAA,EACF,CAAA;AACF;;;;"}
@@ -1,15 +1,14 @@
1
1
  "use client"
2
2
  /* */
3
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { jsx } from 'react/jsx-runtime';
4
4
  import { useFormContext } from '../context/formContext.mjs';
5
- import { dynamic } from '../../../../lib/propsContext/dynamicProps/dynamic.mjs';
6
5
  import '../../../../lib/propsContext/propsContext.mjs';
7
6
  import { PropsContextProvider } from '../../../../lib/propsContext/components/PropsContextProvider.mjs';
8
7
  import { useController, useWatch } from 'react-hook-form';
9
- import FieldErrorView from '../../../../views/FieldErrorView.mjs';
10
8
  import { useLocalizedStringFormatter } from 'react-aria';
11
9
  import locales from '../../../../../../_virtual/_.locale.json@72ba2ce40f190df671686fec50c04ddf.mjs';
12
10
  import { inheritProps } from '../../../../lib/propsContext/inherit/types.mjs';
11
+ import { FieldErrorContext } from 'react-aria-components';
13
12
 
14
13
  function Field(props) {
15
14
  const { children, name, defaultValue, ...rest } = props;
@@ -37,6 +36,7 @@ function Field(props) {
37
36
  control: formContext.form.control,
38
37
  name
39
38
  }) ?? controller.field.value;
39
+ const isFieldInvalid = controller.fieldState.invalid;
40
40
  const fieldProps = {
41
41
  ...inheritProps,
42
42
  ...controller.field,
@@ -46,16 +46,7 @@ function Field(props) {
46
46
  isRequired: !!rest.rules?.required,
47
47
  validationBehavior: "aria",
48
48
  defaultValue,
49
- isInvalid: controller.fieldState.invalid,
50
- children: dynamic((p) => {
51
- if (controller.fieldState.invalid) {
52
- return /* @__PURE__ */ jsxs(Fragment, { children: [
53
- p.children,
54
- /* @__PURE__ */ jsx(FieldErrorView, { children: controller.fieldState.error?.message })
55
- ] });
56
- }
57
- return p.children;
58
- })
49
+ isInvalid: isFieldInvalid
59
50
  };
60
51
  const { value: ignoredValue, ...fieldPropsWithoutValue } = fieldProps;
61
52
  const propsContext = {
@@ -102,7 +93,31 @@ function Field(props) {
102
93
  {
103
94
  props: propsContext,
104
95
  dependencies: [controller.fieldState, controller.field, value],
105
- children
96
+ children: /* @__PURE__ */ jsx(
97
+ FieldErrorContext,
98
+ {
99
+ value: {
100
+ isInvalid: isFieldInvalid,
101
+ validationErrors: [
102
+ controller.fieldState.error?.message ?? "noMessage"
103
+ ],
104
+ validationDetails: {
105
+ valid: !isFieldInvalid,
106
+ badInput: false,
107
+ customError: isFieldInvalid,
108
+ patternMismatch: false,
109
+ rangeOverflow: false,
110
+ rangeUnderflow: false,
111
+ stepMismatch: false,
112
+ tooLong: false,
113
+ tooShort: false,
114
+ valueMissing: false,
115
+ typeMismatch: false
116
+ }
117
+ },
118
+ children
119
+ }
120
+ )
106
121
  }
107
122
  );
108
123
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Field.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/Field/Field.tsx"],"sourcesContent":["import { useFormContext } from \"@/integrations/react-hook-form/components/context/formContext\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { dynamic, PropsContextProvider } from \"@/lib/propsContext\";\nimport type { PropsWithChildren } from \"react\";\nimport {\n type ControllerProps,\n type FieldValues,\n useController,\n type UseFormReturn,\n useWatch,\n} from \"react-hook-form\";\nimport FieldErrorView from \"@/views/FieldErrorView\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport locales from \"./locales/*.locale.json\";\nimport { inheritProps } from \"@/lib/propsContext/inherit/types\";\n\nexport interface FieldProps<T extends FieldValues>\n extends Omit<ControllerProps<T>, \"render\">,\n PropsWithChildren {}\n\nexport function Field<T extends FieldValues>(props: FieldProps<T>) {\n const { children, name, defaultValue, ...rest } = props;\n\n const stringFormatter = useLocalizedStringFormatter(locales);\n\n const controller = useController({\n ...props,\n rules: {\n ...props.rules,\n minLength:\n typeof rest.rules?.minLength === \"number\"\n ? {\n value: rest.rules.minLength,\n message: stringFormatter.format(\"minLength\", {\n number: rest.rules.minLength,\n }),\n }\n : rest.rules?.minLength,\n maxLength:\n typeof rest.rules?.maxLength === \"number\"\n ? {\n value: rest.rules.maxLength,\n message: stringFormatter.format(\"maxLength\", {\n number: rest.rules.maxLength,\n }),\n }\n : rest.rules?.maxLength,\n },\n });\n const formContext = useFormContext<T>();\n /**\n * We don't use controller.field.value here, because it doesn't update when\n * the form value is updated outside of this field (e.g. when setting values\n * with form.setValue or resetting the form), and the Field unmounts in\n * between. This is generally a feature of React Hook Form, but this breaks\n * dynamic forms where fields are conditionally rendered.\n *\n * By using formContext.form.watch(name), we ensure that the field value is\n * always in sync with the form state. See:\n * https://react-hook-form.com/api/usecontroller/controller/\n */\n const value =\n useWatch({\n control: formContext.form.control,\n name,\n }) ?? controller.field.value;\n\n const fieldProps = {\n ...inheritProps,\n ...controller.field,\n value,\n name,\n form: formContext.id,\n isRequired: !!rest.rules?.required,\n validationBehavior: \"aria\" as const,\n defaultValue,\n isInvalid: controller.fieldState.invalid,\n children: dynamic((p) => {\n if (controller.fieldState.invalid) {\n return (\n <>\n {p.children}\n <FieldErrorView>\n {controller.fieldState.error?.message}\n </FieldErrorView>\n </>\n );\n }\n\n return p.children;\n }),\n };\n\n const { value: ignoredValue, ...fieldPropsWithoutValue } = fieldProps;\n\n const propsContext: PropsContext = {\n SearchField: fieldProps,\n TextField: fieldProps,\n TextArea: fieldProps,\n MarkdownEditor: fieldProps,\n Checkbox: {\n ...fieldProps,\n isSelected: value,\n },\n CheckboxGroup: {\n ...fieldProps,\n },\n CheckboxButton: {\n ...fieldProps,\n isSelected: value,\n },\n FileField: fieldProps,\n FileDropZone: fieldProps,\n NumberField: fieldProps,\n RadioGroup: fieldProps,\n Switch: {\n ...fieldProps,\n isSelected: value,\n },\n Slider: fieldProps,\n PasswordCreationField: fieldProps,\n DatePicker: fieldProps,\n DateRangePicker: fieldProps,\n TimeField: fieldProps,\n SegmentedControl: fieldProps,\n Select: {\n ...fieldProps,\n selectedKey: value,\n },\n ComboBox: {\n ...fieldPropsWithoutValue,\n selectedKey: value,\n },\n };\n\n return (\n <PropsContextProvider\n props={propsContext}\n dependencies={[controller.fieldState, controller.field, value]}\n >\n {children}\n </PropsContextProvider>\n );\n}\n\nexport const typedField = <T extends FieldValues>(\n ignoredForm: UseFormReturn<T> | UseFormReturn<T>[\"control\"],\n): typeof Field<T> => Field;\n\nexport default Field;\n"],"names":[],"mappings":";;;;;;;;;;;AAoBO,SAAS,MAA6B,KAAA,EAAsB;AACjE,EAAA,MAAM,EAAE,QAAA,EAAU,IAAA,EAAM,YAAA,EAAc,GAAG,MAAK,GAAI,KAAA;AAElD,EAAA,MAAM,eAAA,GAAkB,4BAA4B,OAAO,CAAA;AAE3D,EAAA,MAAM,aAAa,aAAA,CAAc;AAAA,IAC/B,GAAG,KAAA;AAAA,IACH,KAAA,EAAO;AAAA,MACL,GAAG,KAAA,CAAM,KAAA;AAAA,MACT,SAAA,EACE,OAAO,IAAA,CAAK,KAAA,EAAO,cAAc,QAAA,GAC7B;AAAA,QACE,KAAA,EAAO,KA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AAA,CAAW,UAAA,EAAY,UAAA,CAAW,OAAO,KAAK,CAAA;AAAA,MAE5D;AAAA;AAAA,GACH;AAEJ;AAEO,MAAM,UAAA,GAAa,CACxB,WAAA,KACoB;;;;"}
1
+ {"version":3,"file":"Field.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/Field/Field.tsx"],"sourcesContent":["import { useFormContext } from \"@/integrations/react-hook-form/components/context/formContext\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport type { PropsWithChildren } from \"react\";\nimport {\n type ControllerProps,\n type FieldValues,\n useController,\n type UseFormReturn,\n useWatch,\n} from \"react-hook-form\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport locales from \"./locales/*.locale.json\";\nimport { inheritProps } from \"@/lib/propsContext/inherit/types\";\nimport { FieldErrorContext } from \"react-aria-components\";\n\nexport interface FieldProps<T extends FieldValues>\n extends Omit<ControllerProps<T>, \"render\">,\n PropsWithChildren {}\n\nexport function Field<T extends FieldValues>(props: FieldProps<T>) {\n const { children, name, defaultValue, ...rest } = props;\n\n const stringFormatter = useLocalizedStringFormatter(locales);\n\n const controller = useController({\n ...props,\n rules: {\n ...props.rules,\n minLength:\n typeof rest.rules?.minLength === \"number\"\n ? {\n value: rest.rules.minLength,\n message: stringFormatter.format(\"minLength\", {\n number: rest.rules.minLength,\n }),\n }\n : rest.rules?.minLength,\n maxLength:\n typeof rest.rules?.maxLength === \"number\"\n ? {\n value: rest.rules.maxLength,\n message: stringFormatter.format(\"maxLength\", {\n number: rest.rules.maxLength,\n }),\n }\n : rest.rules?.maxLength,\n },\n });\n const formContext = useFormContext<T>();\n /**\n * We don't use controller.field.value here, because it doesn't update when\n * the form value is updated outside of this field (e.g. when setting values\n * with form.setValue or resetting the form), and the Field unmounts in\n * between. This is generally a feature of React Hook Form, but this breaks\n * dynamic forms where fields are conditionally rendered.\n *\n * By using formContext.form.watch(name), we ensure that the field value is\n * always in sync with the form state. See:\n * https://react-hook-form.com/api/usecontroller/controller/\n */\n const value =\n useWatch({\n control: formContext.form.control,\n name,\n }) ?? controller.field.value;\n\n const isFieldInvalid = controller.fieldState.invalid;\n\n const fieldProps = {\n ...inheritProps,\n ...controller.field,\n value,\n name,\n form: formContext.id,\n isRequired: !!rest.rules?.required,\n validationBehavior: \"aria\" as const,\n defaultValue,\n isInvalid: isFieldInvalid,\n };\n\n const { value: ignoredValue, ...fieldPropsWithoutValue } = fieldProps;\n\n const propsContext: PropsContext = {\n SearchField: fieldProps,\n TextField: fieldProps,\n TextArea: fieldProps,\n MarkdownEditor: fieldProps,\n Checkbox: {\n ...fieldProps,\n isSelected: value,\n },\n CheckboxGroup: {\n ...fieldProps,\n },\n CheckboxButton: {\n ...fieldProps,\n isSelected: value,\n },\n FileField: fieldProps,\n FileDropZone: fieldProps,\n NumberField: fieldProps,\n RadioGroup: fieldProps,\n Switch: {\n ...fieldProps,\n isSelected: value,\n },\n Slider: fieldProps,\n PasswordCreationField: fieldProps,\n DatePicker: fieldProps,\n DateRangePicker: fieldProps,\n TimeField: fieldProps,\n SegmentedControl: fieldProps,\n Select: {\n ...fieldProps,\n selectedKey: value,\n },\n ComboBox: {\n ...fieldPropsWithoutValue,\n selectedKey: value,\n },\n };\n\n return (\n <PropsContextProvider\n props={propsContext}\n dependencies={[controller.fieldState, controller.field, value]}\n >\n <FieldErrorContext\n value={{\n isInvalid: isFieldInvalid,\n validationErrors: [\n controller.fieldState.error?.message ?? \"noMessage\",\n ],\n validationDetails: {\n valid: !isFieldInvalid,\n badInput: false,\n customError: isFieldInvalid,\n patternMismatch: false,\n rangeOverflow: false,\n rangeUnderflow: false,\n stepMismatch: false,\n tooLong: false,\n tooShort: false,\n valueMissing: false,\n typeMismatch: false,\n },\n }}\n >\n {children}\n </FieldErrorContext>\n </PropsContextProvider>\n );\n}\n\nexport const typedField = <T extends FieldValues>(\n ignoredForm: UseFormReturn<T> | UseFormReturn<T>[\"control\"],\n): typeof Field<T> =>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;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,YAAA;AAAA,MACP,cAAc,CAAC,UAAA,CAAW,UAAA,EAAY,UAAA,CAAW,OAAO,KAAK,CAAA;AAAA,MAE7D,QAAA,kBAAA,GAAA;AAAA,QAAC,iBAAA;AAAA,QAAA;AAAA,UACC,KAAA,EAAO;AAAA,YACL,SAAA,EAAW,cAAA;AAAA,YACX,gBAAA,EAAkB;AAAA,cAChB,UAAA,CAAW,UAAA,CAAW,KAAA,EAAO,OAAA,IAAW;AAAA,aAC1C;AAAA,YACA,iBAAA,EAAmB;AAAA,cACjB,OAAO,CAAC,cAAA;AAAA,cACR,QAAA,EAAU,KAAA;AAAA,cACV,WAAA,EAAa,cAAA;AAAA,cACb,eAAA,EAAiB,KAAA;AAAA,cACjB,aAAA,EAAe,KAAA;AAAA,cACf,cAAA,EAAgB,KAAA;AAAA,cAChB,YAAA,EAAc,KAAA;AAAA,cACd,OAAA,EAAS,KAAA;AAAA,cACT,QAAA,EAAU,KAAA;AAAA,cACV,YAAA,EAAc,KAAA;AAAA,cACd,YAAA,EAAc;AAAA;AAChB,WACF;AAAA,UAEC;AAAA;AAAA;AACH;AAAA,GACF;AAEJ;AAEO,MAAM,UAAA,GAAa,CACxB,WAAA,KACoB;;;;"}
@@ -0,0 +1,36 @@
1
+ "use client"
2
+ /* */
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import 'react';
5
+ import '../propsContext/propsContext.mjs';
6
+ import { PropsContextProvider } from '../propsContext/components/PropsContextProvider.mjs';
7
+ import formFieldStyles from '../../components/FormField/FormField.module.scss.mjs';
8
+ import { useFieldError } from './useFieldError.mjs';
9
+ import clsx from 'clsx';
10
+
11
+ const useFieldComponent = (props) => {
12
+ const { FieldErrorView, fieldErrorViewPropsContext, FieldErrorResetContext } = useFieldError();
13
+ const fieldPropsContext = {
14
+ Label: {
15
+ className: formFieldStyles.label,
16
+ optional: !props.isRequired,
17
+ isDisabled: !!props.isDisabled
18
+ },
19
+ FieldDescription: {
20
+ className: formFieldStyles.fieldDescription
21
+ },
22
+ ...fieldErrorViewPropsContext
23
+ };
24
+ const FieldErrorViewWithPropsContext = () => /* @__PURE__ */ jsx(PropsContextProvider, { props: fieldErrorViewPropsContext, children: /* @__PURE__ */ jsx(FieldErrorView, {}) });
25
+ return {
26
+ FieldErrorResetContext,
27
+ FieldErrorView: FieldErrorViewWithPropsContext,
28
+ fieldPropsContext,
29
+ fieldProps: {
30
+ className: clsx(formFieldStyles.formField)
31
+ }
32
+ };
33
+ };
34
+
35
+ export { useFieldComponent };
36
+ //# sourceMappingURL=useFieldComponent.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFieldComponent.mjs","sources":["../../../../../../src/lib/hooks/useFieldComponent.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport React from \"react\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport { useFieldError } from \"@/lib/hooks/useFieldError\";\nimport clsx, { type ClassValue } from \"clsx\";\n\ninterface FieldComponentProps {\n className?: ClassValue;\n isRequired?: boolean;\n isDisabled?: boolean;\n}\n\nexport interface UseFieldComponent {\n FieldErrorResetContext: FC<PropsWithChildren>;\n FieldErrorView: FC;\n fieldPropsContext: PropsContext;\n fieldProps: {\n className?: ReturnType<typeof clsx>;\n };\n}\n\nexport const useFieldComponent = (\n props: FieldComponentProps,\n): UseFieldComponent => {\n const { FieldErrorView, fieldErrorViewPropsContext, FieldErrorResetContext } =\n useFieldError();\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 ...fieldErrorViewPropsContext,\n };\n\n // wrapping the FieldErrorView in a PropsContextProvider to ensure\n // it's always in the correct props context\n const FieldErrorViewWithPropsContext = () => (\n <PropsContextProvider props={fieldErrorViewPropsContext}>\n <FieldErrorView />\n </PropsContextProvider>\n );\n\n return {\n FieldErrorResetContext,\n FieldErrorView: FieldErrorViewWithPropsContext,\n fieldPropsContext,\n fieldProps: {\n className: clsx(formFieldStyles.formField),\n },\n } as const;\n};\n"],"names":[],"mappings":";;;;;;;;AAsBO,MAAM,iBAAA,GAAoB,CAC/B,KAAA,KACsB;AACtB,EAAA,MAAM,EAAE,cAAA,EAAgB,0BAAA,EAA4B,sBAAA,KAClD,aAAA,EAAc;AAIhB,EAAA,MAAM,iBAAA,GAAkC;AAAA,IACtC,KAAA,EAAO;AAAA,MACL,WAAW,eAAA,CAAgB,KAAA;AAAA,MAC3B,QAAA,EAAU,CAAC,KAAA,CAAM,UAAA;AAAA,MACjB,UAAA,EAAY,CAAC,CAAC,KAAA,CAAM;AAAA,KACtB;AAAA,IACA,gBAAA,EAAkB;AAAA,MAChB,WAAW,eAAA,CAAgB;AAAA,KAC7B;AAAA,IACA,GAAG;AAAA,GACL;AAIA,EAAA,MAAM,8BAAA,GAAiC,sBACrC,GAAA,CAAC,oBAAA,EAAA,EAAqB,OAAO,0BAAA,EAC3B,QAAA,kBAAA,GAAA,CAAC,kBAAe,CAAA,EAClB,CAAA;AAGF,EAAA,OAAO;AAAA,IACL,sBAAA;AAAA,IACA,cAAA,EAAgB,8BAAA;AAAA,IAChB,iBAAA;AAAA,IACA,UAAA,EAAY;AAAA,MACV,SAAA,EAAW,IAAA,CAAK,eAAA,CAAgB,SAAS;AAAA;AAC3C,GACF;AACF;;;;"}
@@ -0,0 +1,43 @@
1
+ "use client"
2
+ /* */
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import React, { memo, useId, useContext } from 'react';
5
+ import '../propsContext/propsContext.mjs';
6
+ import '../propsContext/components/PropsContextProvider.mjs';
7
+ import formFieldStyles from '../../components/FormField/FormField.module.scss.mjs';
8
+ import { FieldErrorContext } from 'react-aria-components';
9
+ import { FieldError } from '../../components/FieldError/FieldError.mjs';
10
+ import { TunnelExit } from '@mittwald/react-tunnel';
11
+ import { ClearPropsContext } from '../propsContext/components/ClearPropsContext.mjs';
12
+
13
+ const FieldErrorResetContext = memo((props) => /* @__PURE__ */ jsx(FieldErrorContext, { value: null, children: props.children }));
14
+ const useFieldError = () => {
15
+ const id = useId();
16
+ const tunnelId = `${id}.fieldError`;
17
+ const currentOuterErrorContext = useContext(FieldErrorContext);
18
+ const fieldErrorViewPropsContext = {
19
+ FieldError: {
20
+ tunnelId,
21
+ className: formFieldStyles.fieldError
22
+ }
23
+ };
24
+ const FieldErrorView = () => /* @__PURE__ */ jsx(TunnelExit, { id: tunnelId, children: (children) => {
25
+ const currentInnerErrorContext = useContext(FieldErrorContext);
26
+ const errorContext = currentOuterErrorContext ?? currentInnerErrorContext;
27
+ if (React.Children.count(children) >= 1) {
28
+ return /* @__PURE__ */ jsx(ClearPropsContext, { children });
29
+ }
30
+ if (errorContext?.isInvalid && errorContext.validationErrors.length === 0) {
31
+ return null;
32
+ }
33
+ return /* @__PURE__ */ jsx(ClearPropsContext, { children: /* @__PURE__ */ jsx(FieldErrorContext, { value: errorContext, children: /* @__PURE__ */ jsx(FieldError, { className: formFieldStyles.fieldError }) }) });
34
+ } });
35
+ return {
36
+ fieldErrorViewPropsContext,
37
+ FieldErrorView,
38
+ FieldErrorResetContext
39
+ };
40
+ };
41
+
42
+ export { useFieldError };
43
+ //# sourceMappingURL=useFieldError.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFieldError.mjs","sources":["../../../../../../src/lib/hooks/useFieldError.tsx"],"sourcesContent":["import React, {\n type FC,\n type PropsWithChildren,\n memo,\n useContext,\n useId,\n type ReactNode,\n} from \"react\";\nimport { type PropsContext } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport { FieldErrorContext } from \"react-aria-components\";\nimport { FieldError } from \"@/components/FieldError\";\nimport { TunnelExit } from \"@mittwald/react-tunnel\";\nimport ClearPropsContext from \"@/lib/propsContext/components/ClearPropsContext\";\n\nconst FieldErrorResetContext: FC<PropsWithChildren> = memo((props) => (\n <FieldErrorContext value={null}>{props.children}</FieldErrorContext>\n));\n\nexport const useFieldError = () => {\n const id = useId();\n const tunnelId = `${id}.fieldError`;\n const currentOuterErrorContext = useContext(FieldErrorContext);\n\n const fieldErrorViewPropsContext: PropsContext = {\n FieldError: {\n tunnelId,\n className: formFieldStyles.fieldError,\n },\n };\n\n const FieldErrorView = () => (\n <TunnelExit id={tunnelId}>\n {(children: ReactNode) => {\n const currentInnerErrorContext = useContext(FieldErrorContext);\n\n const errorContext =\n currentOuterErrorContext ?? currentInnerErrorContext;\n\n if (React.Children.count(children) >= 1) {\n return <ClearPropsContext>{children}</ClearPropsContext>;\n }\n\n if (\n errorContext?.isInvalid &&\n errorContext.validationErrors.length === 0\n ) {\n return null;\n }\n\n return (\n <ClearPropsContext>\n <FieldErrorContext value={errorContext}>\n <FieldError className={formFieldStyles.fieldError} />\n </FieldErrorContext>\n </ClearPropsContext>\n );\n }}\n </TunnelExit>\n );\n\n return {\n fieldErrorViewPropsContext,\n FieldErrorView,\n FieldErrorResetContext,\n } as const;\n};\n"],"names":[],"mappings":";;;;;;;;;;AAeA,MAAM,sBAAA,GAAgD,IAAA,CAAK,CAAC,KAAA,qBAC1D,GAAA,CAAC,qBAAkB,KAAA,EAAO,IAAA,EAAO,QAAA,EAAA,KAAA,CAAM,QAAA,EAAS,CACjD,CAAA;AAEM,MAAM,gBAAgB,MAAM;AACjC,EAAA,MAAM,KAAK,KAAA,EAAM;AACjB,EAAA,MAAM,QAAA,GAAW,GAAG,EAAE,CAAA,WAAA,CAAA;AACtB,EAAA,MAAM,wBAAA,GAA2B,WAAW,iBAAiB,CAAA;AAE7D,EAAA,MAAM,0BAAA,GAA2C;AAAA,IAC/C,UAAA,EAAY;AAAA,MACV,QAAA;AAAA,MACA,WAAW,eAAA,CAAgB;AAAA;AAC7B,GACF;AAEA,EAAA,MAAM,iBAAiB,sBACrB,GAAA,CAAC,cAAW,EAAA,EAAI,QAAA,EACb,WAAC,QAAA,KAAwB;AACxB,IAAA,MAAM,wBAAA,GAA2B,WAAW,iBAAiB,CAAA;AAE7D,IAAA,MAAM,eACJ,wBAAA,IAA4B,wBAAA;AAE9B,IAAA,IAAI,KAAA,CAAM,QAAA,CAAS,KAAA,CAAM,QAAQ,KAAK,CAAA,EAAG;AACvC,MAAA,uBAAO,GAAA,CAAC,qBAAmB,QAAA,EAAS,CAAA;AAAA,IACtC;AAEA,IAAA,IACE,YAAA,EAAc,SAAA,IACd,YAAA,CAAa,gBAAA,CAAiB,WAAW,CAAA,EACzC;AACA,MAAA,OAAO,IAAA;AAAA,IACT;AAEA,IAAA,uBACE,GAAA,CAAC,iBAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,iBAAA,EAAA,EAAkB,KAAA,EAAO,YAAA,EACxB,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,SAAA,EAAW,eAAA,CAAgB,UAAA,EAAY,CAAA,EACrD,CAAA,EACF,CAAA;AAAA,EAEJ,CAAA,EACF,CAAA;AAGF,EAAA,OAAO;AAAA,IACL,0BAAA;AAAA,IACA,cAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
@@ -2,12 +2,16 @@
2
2
  /* */
3
3
  import { useState } from 'react';
4
4
 
5
- const useManagedValue = (props, onChange = props.onChange) => {
6
- const { value: valueFromProps, defaultValue: defaultValueFromProps } = props;
5
+ const useManagedValue = (props, onChange = props.onChange, managedValuePropName = {
6
+ value: "value",
7
+ defaultValue: "defaultValue"
8
+ }) => {
9
+ const valueFromProps = props[managedValuePropName.value];
10
+ const defaultValueFromProps = props[managedValuePropName.defaultValue];
7
11
  const isControlled = typeof valueFromProps !== "undefined";
8
12
  const hasDefaultValue = typeof defaultValueFromProps !== "undefined";
9
13
  const [internalValue, setInternalValue] = useState(
10
- hasDefaultValue ? defaultValueFromProps : ""
14
+ hasDefaultValue ? defaultValueFromProps : valueFromProps
11
15
  );
12
16
  const value = isControlled ? valueFromProps : internalValue;
13
17
  const handleOnChange = (value2) => {
@@ -1 +1 @@
1
- {"version":3,"file":"useManagedValue.mjs","sources":["../../../../../../src/lib/hooks/useManagedValue.ts"],"sourcesContent":["import { useState } from \"react\";\n\ninterface MangedValueProps<V> {\n value?: V;\n defaultValue?: V;\n onChange?: (value: V) => void;\n}\n\nexport const useManagedValue = <T extends string>(\n props: MangedValueProps<T>,\n onChange = props.onChange,\n) => {\n const { value: valueFromProps, defaultValue: defaultValueFromProps } = props;\n\n const isControlled = typeof valueFromProps !== \"undefined\";\n const hasDefaultValue = typeof defaultValueFromProps !== \"undefined\";\n\n const [internalValue, setInternalValue] = useState(\n hasDefaultValue ? defaultValueFromProps : \"\",\n );\n const value = isControlled ? valueFromProps : internalValue;\n\n const handleOnChange = (value: T) => {\n onChange?.(value);\n\n if (!isControlled) {\n setInternalValue(() => value);\n }\n };\n\n return { value, handleOnChange } as const;\n};\n"],"names":["value"],"mappings":";;AAQO,MAAM,eAAA,GAAkB,CAC7B,KAAA,EACA,QAAA,GAAW,MAAM,QAAA,KACd;AACH,EAAA,MAAM,EAAE,KAAA,EAAO,cAAA,EAAgB,YAAA,EAAc,uBAAsB,GAAI,KAAA;AAEvE,EAAA,MAAM,YAAA,GAAe,OAAO,cAAA,KAAmB,WAAA;AAC/C,EAAA,MAAM,eAAA,GAAkB,OAAO,qBAAA,KAA0B,WAAA;AAEzD,EAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAI,QAAA;AAAA,IACxC,kBAAkB,qBAAA,GAAwB;AAAA,GAC5C;AACA,EAAA,MAAM,KAAA,GAAQ,eAAe,cAAA,GAAiB,aAAA;AAE9C,EAAA,MAAM,cAAA,GAAiB,CAACA,MAAAA,KAAa;AACnC,IAAA,QAAA,GAAWA,MAAK,CAAA;AAEhB,IAAA,IAAI,CAAC,YAAA,EAAc;AACjB,MAAA,gBAAA,CAAiB,MAAMA,MAAK,CAAA;AAAA,IAC9B;AAAA,EACF,CAAA;AAEA,EAAA,OAAO,EAAE,OAAO,cAAA,EAAe;AACjC;;;;"}
1
+ {"version":3,"file":"useManagedValue.mjs","sources":["../../../../../../src/lib/hooks/useManagedValue.ts"],"sourcesContent":["import { useState } from \"react\";\n\ninterface ManagedValuePropNames<K extends string> {\n value: K;\n defaultValue: K;\n}\n\ntype PossibleValueProps<P> = Extract<\n keyof Omit<P, \"onChange\">,\n string | boolean\n>;\n\nexport const useManagedValue = <\n P extends object,\n V = unknown,\n PDV extends PossibleValueProps<P> = PossibleValueProps<P>,\n>(\n props: P & { onChange?: (value: V) => void },\n onChange = props.onChange,\n managedValuePropName: ManagedValuePropNames<PDV> = {\n value: \"value\" as PDV,\n defaultValue: \"defaultValue\" as PDV,\n },\n) => {\n const valueFromProps = props[managedValuePropName.value] as V;\n const defaultValueFromProps = props[managedValuePropName.defaultValue] as V;\n\n const isControlled = typeof valueFromProps !== \"undefined\";\n const hasDefaultValue = typeof defaultValueFromProps !== \"undefined\";\n\n const [internalValue, setInternalValue] = useState(\n hasDefaultValue ? defaultValueFromProps : valueFromProps,\n );\n const value = isControlled ? valueFromProps : internalValue;\n\n const handleOnChange = (value: V) => {\n onChange?.(value);\n\n if (!isControlled) {\n setInternalValue(() => value);\n }\n };\n\n return { value, handleOnChange } as const;\n};\n"],"names":["value"],"mappings":";;AAYO,MAAM,kBAAkB,CAK7B,KAAA,EACA,QAAA,GAAW,KAAA,CAAM,UACjB,oBAAA,GAAmD;AAAA,EACjD,KAAA,EAAO,OAAA;AAAA,EACP,YAAA,EAAc;AAChB,CAAA,KACG;AACH,EAAA,MAAM,cAAA,GAAiB,KAAA,CAAM,oBAAA,CAAqB,KAAK,CAAA;AACvD,EAAA,MAAM,qBAAA,GAAwB,KAAA,CAAM,oBAAA,CAAqB,YAAY,CAAA;AAErE,EAAA,MAAM,YAAA,GAAe,OAAO,cAAA,KAAmB,WAAA;AAC/C,EAAA,MAAM,eAAA,GAAkB,OAAO,qBAAA,KAA0B,WAAA;AAEzD,EAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAI,QAAA;AAAA,IACxC,kBAAkB,qBAAA,GAAwB;AAAA,GAC5C;AACA,EAAA,MAAM,KAAA,GAAQ,eAAe,cAAA,GAAiB,aAAA;AAE9C,EAAA,MAAM,cAAA,GAAiB,CAACA,MAAAA,KAAa;AACnC,IAAA,QAAA,GAAWA,MAAK,CAAA;AAEhB,IAAA,IAAI,CAAC,YAAA,EAAc;AACjB,MAAA,gBAAA,CAAiB,MAAMA,MAAK,CAAA;AAAA,IAC9B;AAAA,EACF,CAAA;AAEA,EAAA,OAAO,EAAE,OAAO,cAAA,EAAe;AACjC;;;;"}
@@ -3,6 +3,7 @@ import { PropsWithClassName } from '../../lib/types/props';
3
3
  import { FlowComponentProps } from '../../lib/componentFactory/flowComponent';
4
4
  import * as Aria from "react-aria-components";
5
5
  export interface AutocompleteProps extends PropsWithChildren, PropsWithClassName, FlowComponentProps, Omit<Aria.AutocompleteProps, "children" | "onInputChange" | "inputValue"> {
6
+ isInvalid?: boolean;
6
7
  }
7
8
  /** @flr-generate all */
8
9
  export declare const Autocomplete: import('react').FunctionComponent<AutocompleteProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../../../src/components/Autocomplete/Autocomplete.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAE9C,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,sCAAsC,CAAC;AAc9C,MAAM,WAAW,iBACf,SAAQ,iBAAiB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,eAAe,GAAG,YAAY,CAAC;CAAG;AAEhF,wBAAwB;AACxB,eAAO,MAAM,YAAY,sGAqFvB,CAAC;AAEH,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../../../src/components/Autocomplete/Autocomplete.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAE9C,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,sCAAsC,CAAC;AAe9C,MAAM,WAAW,iBACf,SAAQ,iBAAiB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,eAAe,GAAG,YAAY,CAAC;IAC3E,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAwB;AACxB,eAAO,MAAM,YAAY,sGAmGvB,CAAC;AAEH,eAAe,YAAY,CAAC"}
@@ -1,9 +1,10 @@
1
1
  import { FlowComponentProps } from '../../lib/componentFactory/flowComponent';
2
2
  import { PropsWithChildren } from 'react';
3
3
  import * as Aria from "react-aria-components";
4
- export interface CheckboxProps extends PropsWithChildren<Omit<Aria.CheckboxProps, "children">>, FlowComponentProps<HTMLLabelElement> {
4
+ export interface CheckboxProps extends PropsWithChildren<Omit<Aria.CheckboxProps, "children">>, FlowComponentProps {
5
+ inputClassName?: string;
5
6
  }
6
7
  /** @flr-generate all */
7
- export declare const Checkbox: import('react').FunctionComponent<CheckboxProps & import('react').RefAttributes<HTMLLabelElement>>;
8
+ export declare const Checkbox: import('react').FunctionComponent<CheckboxProps & import('react').RefAttributes<HTMLDivElement>>;
8
9
  export default Checkbox;
9
10
  //# sourceMappingURL=Checkbox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAG9C,MAAM,WAAW,aACf,SAAQ,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,EAC7D,kBAAkB,CAAC,gBAAgB,CAAC;CAAG;AAE3C,wBAAwB;AACxB,eAAO,MAAM,QAAQ,oGAqBnB,CAAC;AAEH,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAO9C,MAAM,WAAW,aACf,SAAQ,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,EAC7D,kBAAkB;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAwB;AACxB,eAAO,MAAM,QAAQ,kGAgCnB,CAAC;AAEH,eAAe,QAAQ,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { CheckboxProps } from '../Checkbox';
2
2
  import { FlowComponentProps } from '../../lib/componentFactory/flowComponent';
3
- export interface CheckboxButtonProps extends CheckboxProps, FlowComponentProps<HTMLLabelElement> {
3
+ export interface CheckboxButtonProps extends CheckboxProps, FlowComponentProps {
4
4
  }
5
5
  /** @flr-generate all */
6
- export declare const CheckboxButton: import('react').FunctionComponent<CheckboxButtonProps & import('react').RefAttributes<HTMLLabelElement>>;
6
+ export declare const CheckboxButton: import('react').FunctionComponent<CheckboxButtonProps & import('react').RefAttributes<HTMLDivElement>>;
7
7
  export default CheckboxButton;
8
8
  //# sourceMappingURL=CheckboxButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxButton.d.ts","sourceRoot":"","sources":["../../../../src/components/CheckboxButton/CheckboxButton.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG/E,MAAM,WAAW,mBACf,SAAQ,aAAa,EACnB,kBAAkB,CAAC,gBAAgB,CAAC;CAAG;AAE3C,wBAAwB;AACxB,eAAO,MAAM,cAAc,0GAqBzB,CAAC;AAEH,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"CheckboxButton.d.ts","sourceRoot":"","sources":["../../../../src/components/CheckboxButton/CheckboxButton.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAM/E,MAAM,WAAW,mBACf,SAAQ,aAAa,EACnB,kBAAkB;CAAG;AAEzB,wBAAwB;AACxB,eAAO,MAAM,cAAc,wGAuCzB,CAAC;AAEH,eAAe,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/CheckboxGroup/CheckboxGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAGnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAM/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAM9C,MAAM,WAAW,kBACf,SAAQ,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC,EAClE,IAAI,CAAC,iBAAiB,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC,EACxC,kBAAkB;CAAG;AAEzB,wBAAwB;AACxB,eAAO,MAAM,aAAa,uGA6DxB,CAAC;AAEH,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"CheckboxGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/CheckboxGroup/CheckboxGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAM/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAM9C,MAAM,WAAW,kBACf,SAAQ,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC,EAClE,IAAI,CAAC,iBAAiB,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC,EACxC,kBAAkB;CAAG;AAEzB,wBAAwB;AACxB,eAAO,MAAM,aAAa,uGA0DxB,CAAC;AAEH,eAAe,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ComboBox.d.ts","sourceRoot":"","sources":["../../../../src/components/ComboBox/ComboBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAY9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,kBAAkB,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAA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1 @@
1
- {"version":3,"file":"Default.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/ComboBox/stories/Default.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAMvD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAWjD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAgB/B,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEvC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,QAAQ,EAAE,KAAsC,CAAC;AAE9D,eAAO,MAAM,QAAQ,EAAE,KAAsC,CAAC;AAE9D,eAAO,MAAM,QAAQ,EAAE,KAEtB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,KAelC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAc9B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAe5B,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KA4BpB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAe7B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,KAsBhC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,KAOhC,CAAC"}
1
+ {"version":3,"file":"Default.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/ComboBox/stories/Default.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAMvD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAWjD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAgB/B,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEvC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,QAAQ,EAAE,KAAsC,CAAC;AAE9D,eAAO,MAAM,QAAQ,EAAE,KAAsC,CAAC;AAE9D,eAAO,MAAM,QAAQ,EAAE,KAEtB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,KAelC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAc9B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAe5B,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KA4BpB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAc7B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,KAsBhC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,KAOhC,CAAC"}
@@ -1,9 +1,7 @@
1
- import { PropsWithChildren, ReactNode } from 'react';
1
+ import { PropsWithChildren } from 'react';
2
2
  import { FlowComponentProps } from '../../lib/componentFactory/flowComponent';
3
3
  import * as Aria from "react-aria-components";
4
4
  export interface DatePickerProps<T extends Aria.DateValue = Aria.DateValue> extends PropsWithChildren<Omit<Aria.DatePickerProps<T>, "children">>, FlowComponentProps {
5
- /** The error message that is displayed below the input. */
6
- errorMessage?: ReactNode;
7
5
  }
8
6
  /** @flr-generate all */
9
7
  export declare const DatePicker: import('react').FunctionComponent<DatePickerProps<Aria.DateValue> & import('react').RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAI/D,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAM9C,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,sCAAsC,CAAC;AAK9C,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CACxE,SAAQ,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAClE,kBAAkB;IACpB,2DAA2D;IAC3D,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B;AAED,wBAAwB;AACxB,eAAO,MAAM,UAAU,oHAmDrB,CAAC;AAEH,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAK9C,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,sCAAsC,CAAC;AAM9C,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CACxE,SAAQ,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAClE,kBAAkB;CAAG;AAEzB,wBAAwB;AACxB,eAAO,MAAM,UAAU,oHA0CrB,CAAC;AAEH,eAAe,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Default.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/DatePicker/stories/Default.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,UAAU,MAAM,UAAU,CAAC;AAUlC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAWjC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAC;AAEzC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,QAAQ,EAAE,KAAsC,CAAC;AAE9D,eAAO,MAAM,OAAO,EAAE,KAarB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAQ7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAU/B,CAAC"}
1
+ {"version":3,"file":"Default.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/DatePicker/stories/Default.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,UAAU,MAAM,UAAU,CAAC;AAWlC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAWjC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAC;AAEzC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,QAAQ,EAAE,KAAsC,CAAC;AAE9D,eAAO,MAAM,OAAO,EAAE,KAarB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAQ7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAU/B,CAAC"}
@@ -1,9 +1,7 @@
1
- import { PropsWithChildren, ReactNode } from 'react';
1
+ import { PropsWithChildren } from 'react';
2
2
  import { FlowComponentProps } from '../../lib/componentFactory/flowComponent';
3
3
  import * as Aria from "react-aria-components";
4
4
  export interface DateRangePickerProps<T extends Aria.DateValue = Aria.DateValue> extends PropsWithChildren<Omit<Aria.DateRangePickerProps<T>, "children">>, FlowComponentProps {
5
- /** The error message that is displayed below the input. */
6
- errorMessage?: ReactNode;
7
5
  }
8
6
  /** @flr-generate all */
9
7
  export declare const DateRangePicker: import('react').FunctionComponent<DateRangePickerProps<Aria.DateValue> & import('react').RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"DateRangePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/DateRangePicker/DateRangePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAK1D,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAM9C,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,sCAAsC,CAAC;AAI9C,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAC7E,SAAQ,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EACvE,kBAAkB;IACpB,2DAA2D;IAC3D,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B;AAED,wBAAwB;AACxB,eAAO,MAAM,eAAe,yHAmD1B,CAAC;AAEH,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"DateRangePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/DateRangePicker/DateRangePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAK9C,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,sCAAsC,CAAC;AAK9C,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAC7E,SAAQ,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EACvE,kBAAkB;CAAG;AAEzB,wBAAwB;AACxB,eAAO,MAAM,eAAe,yHAyC1B,CAAC;AAEH,eAAe,eAAe,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Default.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/DateRangePicker/stories/Default.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAK3C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,eAAe,CAWtC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9C,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,QAAQ,EAAE,KAAsC,CAAC;AAE9D,eAAO,MAAM,OAAO,EAAE,KAgBrB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAQ7B,CAAC"}
1
+ {"version":3,"file":"Default.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/DateRangePicker/stories/Default.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAM3C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,eAAe,CAQtC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9C,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,QAAQ,EAAE,KAAsC,CAAC;AAE9D,eAAO,MAAM,OAAO,EAAE,KAgBrB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAQ7B,CAAC"}