@mittwald/flow-react-components 0.2.0-alpha.187 → 0.2.0-alpha.188

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 (32) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/assets/doc-properties.json +350 -15
  3. package/dist/js/components/src/components/NumberField/NumberField.mjs +25 -3
  4. package/dist/js/components/src/components/NumberField/NumberField.mjs.map +1 -1
  5. package/dist/js/components/src/components/TextArea/TextArea.mjs +20 -10
  6. package/dist/js/components/src/components/TextArea/TextArea.mjs.map +1 -1
  7. package/dist/js/components/src/components/TextField/TextField.mjs +6 -5
  8. package/dist/js/components/src/components/TextField/TextField.mjs.map +1 -1
  9. package/dist/js/components/src/integrations/react-hook-form/components/ActionGroupWrapper/SubmitButtonStateProvider.mjs +14 -7
  10. package/dist/js/components/src/integrations/react-hook-form/components/ActionGroupWrapper/SubmitButtonStateProvider.mjs.map +1 -1
  11. package/dist/js/components/src/integrations/react-hook-form/components/Field/Field.mjs +69 -71
  12. package/dist/js/components/src/integrations/react-hook-form/components/Field/Field.mjs.map +1 -1
  13. package/dist/js/components/src/lib/react/ReactAriaControlledValueFix.mjs +27 -0
  14. package/dist/js/components/src/lib/react/ReactAriaControlledValueFix.mjs.map +1 -0
  15. package/dist/types/components/NumberField/NumberField.d.ts +2 -2
  16. package/dist/types/components/NumberField/NumberField.d.ts.map +1 -1
  17. package/dist/types/components/TextArea/TextArea.d.ts +1 -2
  18. package/dist/types/components/TextArea/TextArea.d.ts.map +1 -1
  19. package/dist/types/components/TextField/TextField.d.ts +1 -2
  20. package/dist/types/components/TextField/TextField.d.ts.map +1 -1
  21. package/dist/types/integrations/react-hook-form/components/ActionGroupWrapper/SubmitButtonStateProvider.d.ts.map +1 -1
  22. package/dist/types/integrations/react-hook-form/components/Field/Field.d.ts +2 -2
  23. package/dist/types/integrations/react-hook-form/components/Field/Field.d.ts.map +1 -1
  24. package/dist/types/integrations/react-hook-form/components/Field/stories/Select.stories.d.ts.map +1 -1
  25. package/dist/types/integrations/react-hook-form/components/Field/stories/TextField.stories.d.ts.map +1 -1
  26. package/dist/types/integrations/react-hook-form/components/Form/Form.test.d.ts +2 -0
  27. package/dist/types/integrations/react-hook-form/components/Form/Form.test.d.ts.map +1 -0
  28. package/dist/types/lib/react/ReactAriaControlledValueFix.d.ts +16 -0
  29. package/dist/types/lib/react/ReactAriaControlledValueFix.d.ts.map +1 -0
  30. package/dist/types/lib/react/ReactAriaControlledValueFix.test.d.ts +2 -0
  31. package/dist/types/lib/react/ReactAriaControlledValueFix.test.d.ts.map +1 -0
  32. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.2.0-alpha.188](https://github.com/mittwald/flow/compare/0.2.0-alpha.187...0.2.0-alpha.188) (2025-05-19)
7
+
8
+ ### Bug Fixes
9
+
10
+ * fix RHF form reset issue ([#1465](https://github.com/mittwald/flow/issues/1465)) ([e3ec221](https://github.com/mittwald/flow/commit/e3ec22151192974b7ba7be0e67088ba1e1f5895c))
11
+
6
12
  # [0.2.0-alpha.187](https://github.com/mittwald/flow/compare/0.2.0-alpha.186...0.2.0-alpha.187) (2025-05-16)
7
13
 
8
14
  ### Bug Fixes
@@ -210181,21 +210181,6 @@
210181
210181
  "name": "boolean"
210182
210182
  }
210183
210183
  },
210184
- "control": {
210185
- "defaultValue": null,
210186
- "description": "",
210187
- "name": "control",
210188
- "declarations": [
210189
- {
210190
- "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/controller.d.ts",
210191
- "name": "TypeLiteral"
210192
- }
210193
- ],
210194
- "required": false,
210195
- "type": {
210196
- "name": "Control<T>"
210197
- }
210198
- },
210199
210184
  "rules": {
210200
210185
  "defaultValue": null,
210201
210186
  "description": "",
@@ -210285,6 +210270,10 @@
210285
210270
  "description": "",
210286
210271
  "name": "getFieldState",
210287
210272
  "declarations": [
210273
+ {
210274
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210275
+ "name": "TypeLiteral"
210276
+ },
210288
210277
  {
210289
210278
  "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210290
210279
  "name": "TypeLiteral"
@@ -210300,6 +210289,10 @@
210300
210289
  "description": "",
210301
210290
  "name": "setError",
210302
210291
  "declarations": [
210292
+ {
210293
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210294
+ "name": "TypeLiteral"
210295
+ },
210303
210296
  {
210304
210297
  "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210305
210298
  "name": "TypeLiteral"
@@ -210405,6 +210398,10 @@
210405
210398
  "description": "",
210406
210399
  "name": "handleSubmit",
210407
210400
  "declarations": [
210401
+ {
210402
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210403
+ "name": "TypeLiteral"
210404
+ },
210408
210405
  {
210409
210406
  "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210410
210407
  "name": "TypeLiteral"
@@ -210420,6 +210417,10 @@
210420
210417
  "description": "",
210421
210418
  "name": "unregister",
210422
210419
  "declarations": [
210420
+ {
210421
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210422
+ "name": "TypeLiteral"
210423
+ },
210423
210424
  {
210424
210425
  "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210425
210426
  "name": "TypeLiteral"
@@ -210450,6 +210451,10 @@
210450
210451
  "description": "",
210451
210452
  "name": "register",
210452
210453
  "declarations": [
210454
+ {
210455
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210456
+ "name": "TypeLiteral"
210457
+ },
210453
210458
  {
210454
210459
  "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210455
210460
  "name": "TypeLiteral"
@@ -210474,6 +210479,336 @@
210474
210479
  "type": {
210475
210480
  "name": "UseFormSetFocus<T>"
210476
210481
  }
210482
+ },
210483
+ "_subjects": {
210484
+ "defaultValue": null,
210485
+ "description": "",
210486
+ "name": "_subjects",
210487
+ "declarations": [
210488
+ {
210489
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210490
+ "name": "TypeLiteral"
210491
+ }
210492
+ ],
210493
+ "required": true,
210494
+ "type": {
210495
+ "name": "Subjects<T>"
210496
+ }
210497
+ },
210498
+ "_removeUnmounted": {
210499
+ "defaultValue": null,
210500
+ "description": "",
210501
+ "name": "_removeUnmounted",
210502
+ "declarations": [
210503
+ {
210504
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210505
+ "name": "TypeLiteral"
210506
+ }
210507
+ ],
210508
+ "required": true,
210509
+ "type": {
210510
+ "name": "Noop"
210511
+ }
210512
+ },
210513
+ "_names": {
210514
+ "defaultValue": null,
210515
+ "description": "",
210516
+ "name": "_names",
210517
+ "declarations": [
210518
+ {
210519
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210520
+ "name": "TypeLiteral"
210521
+ }
210522
+ ],
210523
+ "required": true,
210524
+ "type": {
210525
+ "name": "Names"
210526
+ }
210527
+ },
210528
+ "_state": {
210529
+ "defaultValue": null,
210530
+ "description": "",
210531
+ "name": "_state",
210532
+ "declarations": [
210533
+ {
210534
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210535
+ "name": "TypeLiteral"
210536
+ }
210537
+ ],
210538
+ "required": true,
210539
+ "type": {
210540
+ "name": "{ mount: boolean; action: boolean; watch: boolean; }"
210541
+ }
210542
+ },
210543
+ "_reset": {
210544
+ "defaultValue": null,
210545
+ "description": "",
210546
+ "name": "_reset",
210547
+ "declarations": [
210548
+ {
210549
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210550
+ "name": "TypeLiteral"
210551
+ }
210552
+ ],
210553
+ "required": true,
210554
+ "type": {
210555
+ "name": "UseFormReset<T>"
210556
+ }
210557
+ },
210558
+ "_options": {
210559
+ "defaultValue": null,
210560
+ "description": "",
210561
+ "name": "_options",
210562
+ "declarations": [
210563
+ {
210564
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210565
+ "name": "TypeLiteral"
210566
+ }
210567
+ ],
210568
+ "required": true,
210569
+ "type": {
210570
+ "name": "Partial<{ mode: \"onBlur\" | \"onChange\" | \"onSubmit\" | \"all\" | \"onTouched\"; disabled: boolean; reValidateMode: \"onBlur\" | \"onChange\" | \"onSubmit\"; defaultValues: AsyncDefaultValues<T> | DefaultValues<...>; ... 10 more ...; delayError: number; }>"
210571
+ }
210572
+ },
210573
+ "_getDirty": {
210574
+ "defaultValue": null,
210575
+ "description": "",
210576
+ "name": "_getDirty",
210577
+ "declarations": [
210578
+ {
210579
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210580
+ "name": "TypeLiteral"
210581
+ }
210582
+ ],
210583
+ "required": true,
210584
+ "type": {
210585
+ "name": "GetIsDirty"
210586
+ }
210587
+ },
210588
+ "_resetDefaultValues": {
210589
+ "defaultValue": null,
210590
+ "description": "",
210591
+ "name": "_resetDefaultValues",
210592
+ "declarations": [
210593
+ {
210594
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210595
+ "name": "TypeLiteral"
210596
+ }
210597
+ ],
210598
+ "required": true,
210599
+ "type": {
210600
+ "name": "Noop"
210601
+ }
210602
+ },
210603
+ "_formState": {
210604
+ "defaultValue": null,
210605
+ "description": "",
210606
+ "name": "_formState",
210607
+ "declarations": [
210608
+ {
210609
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210610
+ "name": "TypeLiteral"
210611
+ }
210612
+ ],
210613
+ "required": true,
210614
+ "type": {
210615
+ "name": "FormState<T>"
210616
+ }
210617
+ },
210618
+ "_updateValid": {
210619
+ "defaultValue": null,
210620
+ "description": "",
210621
+ "name": "_updateValid",
210622
+ "declarations": [
210623
+ {
210624
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210625
+ "name": "TypeLiteral"
210626
+ }
210627
+ ],
210628
+ "required": true,
210629
+ "type": {
210630
+ "name": "(shouldUpdateValid?: boolean | undefined) => void"
210631
+ }
210632
+ },
210633
+ "_updateFormState": {
210634
+ "defaultValue": null,
210635
+ "description": "",
210636
+ "name": "_updateFormState",
210637
+ "declarations": [
210638
+ {
210639
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210640
+ "name": "TypeLiteral"
210641
+ }
210642
+ ],
210643
+ "required": true,
210644
+ "type": {
210645
+ "name": "(formState: Partial<FormState<T>>) => void"
210646
+ }
210647
+ },
210648
+ "_fields": {
210649
+ "defaultValue": null,
210650
+ "description": "",
210651
+ "name": "_fields",
210652
+ "declarations": [
210653
+ {
210654
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210655
+ "name": "TypeLiteral"
210656
+ }
210657
+ ],
210658
+ "required": true,
210659
+ "type": {
210660
+ "name": "Partial<{ [key: string]: Partial<...> | Field; }>"
210661
+ }
210662
+ },
210663
+ "_formValues": {
210664
+ "defaultValue": null,
210665
+ "description": "",
210666
+ "name": "_formValues",
210667
+ "declarations": [
210668
+ {
210669
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210670
+ "name": "TypeLiteral"
210671
+ }
210672
+ ],
210673
+ "required": true,
210674
+ "type": {
210675
+ "name": "FieldValues"
210676
+ }
210677
+ },
210678
+ "_proxyFormState": {
210679
+ "defaultValue": null,
210680
+ "description": "",
210681
+ "name": "_proxyFormState",
210682
+ "declarations": [
210683
+ {
210684
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210685
+ "name": "TypeLiteral"
210686
+ }
210687
+ ],
210688
+ "required": true,
210689
+ "type": {
210690
+ "name": "ReadFormState"
210691
+ }
210692
+ },
210693
+ "_defaultValues": {
210694
+ "defaultValue": null,
210695
+ "description": "",
210696
+ "name": "_defaultValues",
210697
+ "declarations": [
210698
+ {
210699
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210700
+ "name": "TypeLiteral"
210701
+ }
210702
+ ],
210703
+ "required": true,
210704
+ "type": {
210705
+ "name": "Partial<DefaultValues<T>>"
210706
+ }
210707
+ },
210708
+ "_getWatch": {
210709
+ "defaultValue": null,
210710
+ "description": "",
210711
+ "name": "_getWatch",
210712
+ "declarations": [
210713
+ {
210714
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210715
+ "name": "TypeLiteral"
210716
+ }
210717
+ ],
210718
+ "required": true,
210719
+ "type": {
210720
+ "name": "WatchInternal<T>"
210721
+ }
210722
+ },
210723
+ "_updateFieldArray": {
210724
+ "defaultValue": null,
210725
+ "description": "",
210726
+ "name": "_updateFieldArray",
210727
+ "declarations": [
210728
+ {
210729
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210730
+ "name": "TypeLiteral"
210731
+ }
210732
+ ],
210733
+ "required": true,
210734
+ "type": {
210735
+ "name": "BatchFieldArrayUpdate"
210736
+ }
210737
+ },
210738
+ "_getFieldArray": {
210739
+ "defaultValue": null,
210740
+ "description": "",
210741
+ "name": "_getFieldArray",
210742
+ "declarations": [
210743
+ {
210744
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210745
+ "name": "TypeLiteral"
210746
+ }
210747
+ ],
210748
+ "required": true,
210749
+ "type": {
210750
+ "name": "<TFieldArrayValues>(name: string) => Partial<TFieldArrayValues>[]"
210751
+ }
210752
+ },
210753
+ "_setErrors": {
210754
+ "defaultValue": null,
210755
+ "description": "",
210756
+ "name": "_setErrors",
210757
+ "declarations": [
210758
+ {
210759
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210760
+ "name": "TypeLiteral"
210761
+ }
210762
+ ],
210763
+ "required": true,
210764
+ "type": {
210765
+ "name": "(errors: FieldErrors<T>) => void"
210766
+ }
210767
+ },
210768
+ "_updateDisabledField": {
210769
+ "defaultValue": null,
210770
+ "description": "",
210771
+ "name": "_updateDisabledField",
210772
+ "declarations": [
210773
+ {
210774
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210775
+ "name": "TypeLiteral"
210776
+ }
210777
+ ],
210778
+ "required": true,
210779
+ "type": {
210780
+ "name": "(props: { disabled?: boolean | undefined; name: string; value?: unknown; } & ({ field?: Field | undefined; fields?: undefined; } | { field?: undefined; fields?: Partial<{ [key: string]: Partial<...> | Field; }> | undefined; })) => void"
210781
+ }
210782
+ },
210783
+ "_executeSchema": {
210784
+ "defaultValue": null,
210785
+ "description": "",
210786
+ "name": "_executeSchema",
210787
+ "declarations": [
210788
+ {
210789
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210790
+ "name": "TypeLiteral"
210791
+ }
210792
+ ],
210793
+ "required": true,
210794
+ "type": {
210795
+ "name": "(names: string[]) => Promise<{ errors: FieldErrors; }>"
210796
+ }
210797
+ },
210798
+ "_disableForm": {
210799
+ "defaultValue": null,
210800
+ "description": "",
210801
+ "name": "_disableForm",
210802
+ "declarations": [
210803
+ {
210804
+ "fileName": "flow/node_modules/.pnpm/react-hook-form@7.54.2_react@19.1.0/node_modules/react-hook-form/dist/types/form.d.ts",
210805
+ "name": "TypeLiteral"
210806
+ }
210807
+ ],
210808
+ "required": true,
210809
+ "type": {
210810
+ "name": "(disabled?: boolean | undefined) => void"
210811
+ }
210477
210812
  }
210478
210813
  }
210479
210814
  },
@@ -1,7 +1,6 @@
1
1
  "use client"
2
2
  /* */
3
3
  import { jsx, jsxs } from 'react/jsx-runtime';
4
- import 'react';
5
4
  import * as Aria from 'react-aria-components';
6
5
  import formFieldStyles from '../FormField/FormField.module.scss.mjs';
7
6
  import styles from './NumberField.module.scss.mjs';
@@ -11,6 +10,7 @@ import '../../lib/propsContext/propsContext.mjs';
11
10
  import { PropsContextProvider } from '../../lib/propsContext/PropsContextProvider.mjs';
12
11
  import { FieldError } from '../FieldError/FieldError.mjs';
13
12
  import { Button } from '../Button/Button.mjs';
13
+ import 'react';
14
14
  import '@tabler/icons-react';
15
15
  import '../Icon/Icon.mjs';
16
16
  import '../../lib/viewComponentContext/viewComponentContext.mjs';
@@ -19,9 +19,17 @@ import { IconChevronUp } from '../Icon/components/icons/IconChevronUp.mjs';
19
19
  import { IconMinus } from '../Icon/components/icons/IconMinus.mjs';
20
20
  import { IconPlus } from '../Icon/components/icons/IconPlus.mjs';
21
21
  import { flowComponent } from '../../lib/componentFactory/flowComponent.mjs';
22
+ import { ReactAriaControlledValueFix } from '../../lib/react/ReactAriaControlledValueFix.mjs';
22
23
 
23
24
  const NumberField = flowComponent("NumberField", (props) => {
24
- const { children, className, ref, isWheelDisabled = true, ...rest } = props;
25
+ const {
26
+ children,
27
+ className,
28
+ ref,
29
+ defaultValue,
30
+ isWheelDisabled = true,
31
+ ...rest
32
+ } = props;
25
33
  const rootClassName = clsx(formFieldStyles.formField, className);
26
34
  const propsContext = {
27
35
  Label: {
@@ -57,7 +65,21 @@ const NumberField = flowComponent("NumberField", (props) => {
57
65
  ]
58
66
  }
59
67
  ),
60
- /* @__PURE__ */ jsx(Aria.Input, { className: styles.input, ref }),
68
+ /* @__PURE__ */ jsx(
69
+ ReactAriaControlledValueFix,
70
+ {
71
+ inputContext: Aria.InputContext,
72
+ props,
73
+ children: /* @__PURE__ */ jsx(
74
+ Aria.Input,
75
+ {
76
+ className: styles.input,
77
+ ref,
78
+ defaultValue
79
+ }
80
+ )
81
+ }
82
+ ),
61
83
  /* @__PURE__ */ jsxs(
62
84
  Button,
63
85
  {
@@ -1 +1 @@
1
- {"version":3,"file":"NumberField.mjs","sources":["../../../../../../src/components/NumberField/NumberField.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport React from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport formFieldStyles from \"../FormField/FormField.module.scss\";\nimport styles from \"./NumberField.module.scss\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport ClearPropsContext from \"@/components/ClearPropsContext/ClearPropsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { FieldError } from \"@/components/FieldError\";\nimport { Button } from \"@/components/Button\";\nimport {\n IconChevronDown,\n IconChevronUp,\n IconMinus,\n IconPlus,\n} from \"@/components/Icon/components/icons\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\n\nexport interface NumberFieldProps\n extends PropsWithChildren<Omit<Aria.NumberFieldProps, \"children\">>,\n FlowComponentProps<HTMLInputElement> {}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const NumberField = flowComponent(\"NumberField\", (props) => {\n const { children, className, ref, isWheelDisabled = true, ...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 },\n FieldDescription: {\n className: formFieldStyles.fieldDescription,\n },\n FieldError: {\n className: formFieldStyles.customFieldError,\n },\n };\n\n return (\n <ClearPropsContext>\n <Aria.NumberField\n isWheelDisabled={isWheelDisabled}\n {...rest}\n className={rootClassName}\n >\n <Aria.Group className={styles.group}>\n <Button\n ariaSlot=\"decrement\"\n className={styles.decrementButton}\n size=\"s\"\n variant=\"plain\"\n color=\"secondary\"\n >\n <IconChevronDown />\n <IconMinus className={styles.coarsePointerIcon} />\n </Button>\n <Aria.Input className={styles.input} ref={ref} />\n <Button\n ariaSlot=\"increment\"\n className={styles.incrementButton}\n size=\"s\"\n variant=\"plain\"\n color=\"secondary\"\n >\n <IconChevronUp />\n <IconPlus className={styles.coarsePointerIcon} />\n </Button>\n </Aria.Group>\n <PropsContextProvider props={propsContext}>\n {children}\n </PropsContextProvider>\n <FieldError className={formFieldStyles.fieldError} />\n </Aria.NumberField>\n </ClearPropsContext>\n );\n});\n\nexport default NumberField;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AA4BO,MAAM,WAAc,GAAA,aAAA,CAAc,aAAe,EAAA,CAAC,KAAU,KAAA;AACjE,EAAM,MAAA,EAAE,UAAU,SAAW,EAAA,GAAA,EAAK,kBAAkB,IAAM,EAAA,GAAG,MAAS,GAAA,KAAA;AAEtE,EAAA,MAAM,aAAgB,GAAA,IAAA,CAAK,eAAgB,CAAA,SAAA,EAAW,SAAS,CAAA;AAE/D,EAAA,MAAM,YAA6B,GAAA;AAAA,IACjC,KAAO,EAAA;AAAA,MACL,WAAW,eAAgB,CAAA,KAAA;AAAA,MAC3B,QAAA,EAAU,CAAC,KAAM,CAAA;AAAA,KACnB;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,WAAW,eAAgB,CAAA;AAAA,KAC7B;AAAA,IACA,UAAY,EAAA;AAAA,MACV,WAAW,eAAgB,CAAA;AAAA;AAC7B,GACF;AAEA,EAAA,2BACG,iBACC,EAAA,EAAA,QAAA,kBAAA,IAAA;AAAA,IAAC,IAAK,CAAA,WAAA;AAAA,IAAL;AAAA,MACC,eAAA;AAAA,MACC,GAAG,IAAA;AAAA,MACJ,SAAW,EAAA,aAAA;AAAA,MAEX,QAAA,EAAA;AAAA,wBAAA,IAAA,CAAC,IAAK,CAAA,KAAA,EAAL,EAAW,SAAA,EAAW,OAAO,KAC5B,EAAA,QAAA,EAAA;AAAA,0BAAA,IAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,QAAS,EAAA,WAAA;AAAA,cACT,WAAW,MAAO,CAAA,eAAA;AAAA,cAClB,IAAK,EAAA,GAAA;AAAA,cACL,OAAQ,EAAA,OAAA;AAAA,cACR,KAAM,EAAA,WAAA;AAAA,cAEN,QAAA,EAAA;AAAA,gCAAA,GAAA,CAAC,eAAgB,EAAA,EAAA,CAAA;AAAA,gCAChB,GAAA,CAAA,SAAA,EAAA,EAAU,SAAW,EAAA,MAAA,CAAO,iBAAmB,EAAA;AAAA;AAAA;AAAA,WAClD;AAAA,8BACC,IAAK,CAAA,KAAA,EAAL,EAAW,SAAW,EAAA,MAAA,CAAO,OAAO,GAAU,EAAA,CAAA;AAAA,0BAC/C,IAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,QAAS,EAAA,WAAA;AAAA,cACT,WAAW,MAAO,CAAA,eAAA;AAAA,cAClB,IAAK,EAAA,GAAA;AAAA,cACL,OAAQ,EAAA,OAAA;AAAA,cACR,KAAM,EAAA,WAAA;AAAA,cAEN,QAAA,EAAA;AAAA,gCAAA,GAAA,CAAC,aAAc,EAAA,EAAA,CAAA;AAAA,gCACd,GAAA,CAAA,QAAA,EAAA,EAAS,SAAW,EAAA,MAAA,CAAO,iBAAmB,EAAA;AAAA;AAAA;AAAA;AACjD,SACF,EAAA,CAAA;AAAA,wBACC,GAAA,CAAA,oBAAA,EAAA,EAAqB,KAAO,EAAA,YAAA,EAC1B,QACH,EAAA,CAAA;AAAA,wBACC,GAAA,CAAA,UAAA,EAAA,EAAW,SAAW,EAAA,eAAA,CAAgB,UAAY,EAAA;AAAA;AAAA;AAAA,GAEvD,EAAA,CAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"NumberField.mjs","sources":["../../../../../../src/components/NumberField/NumberField.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport formFieldStyles from \"../FormField/FormField.module.scss\";\nimport styles from \"./NumberField.module.scss\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport ClearPropsContext from \"@/components/ClearPropsContext/ClearPropsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { FieldError } from \"@/components/FieldError\";\nimport { Button } from \"@/components/Button\";\nimport {\n IconChevronDown,\n IconChevronUp,\n IconMinus,\n IconPlus,\n} from \"@/components/Icon/components/icons\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { ReactAriaControlledValueFix } from \"@/lib/react/ReactAriaControlledValueFix\";\n\nexport interface NumberFieldProps\n extends PropsWithChildren<Omit<Aria.NumberFieldProps, \"children\">>,\n FlowComponentProps<HTMLInputElement> {}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const NumberField = flowComponent(\"NumberField\", (props) => {\n const {\n children,\n className,\n ref,\n defaultValue,\n isWheelDisabled = true,\n ...rest\n } = 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 },\n FieldDescription: {\n className: formFieldStyles.fieldDescription,\n },\n FieldError: {\n className: formFieldStyles.customFieldError,\n },\n };\n\n return (\n <ClearPropsContext>\n <Aria.NumberField\n isWheelDisabled={isWheelDisabled}\n {...rest}\n className={rootClassName}\n >\n <Aria.Group className={styles.group}>\n <Button\n ariaSlot=\"decrement\"\n className={styles.decrementButton}\n size=\"s\"\n variant=\"plain\"\n color=\"secondary\"\n >\n <IconChevronDown />\n <IconMinus className={styles.coarsePointerIcon} />\n </Button>\n <ReactAriaControlledValueFix\n inputContext={Aria.InputContext}\n props={props}\n >\n <Aria.Input\n className={styles.input}\n ref={ref}\n defaultValue={defaultValue}\n />\n </ReactAriaControlledValueFix>\n <Button\n ariaSlot=\"increment\"\n className={styles.incrementButton}\n size=\"s\"\n variant=\"plain\"\n color=\"secondary\"\n >\n <IconChevronUp />\n <IconPlus className={styles.coarsePointerIcon} />\n </Button>\n </Aria.Group>\n <PropsContextProvider props={propsContext}>\n {children}\n </PropsContextProvider>\n <FieldError className={formFieldStyles.fieldError} />\n </Aria.NumberField>\n </ClearPropsContext>\n );\n});\n\nexport default NumberField;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AA4BO,MAAM,WAAc,GAAA,aAAA,CAAc,aAAe,EAAA,CAAC,KAAU,KAAA;AACjE,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,GAAA;AAAA,IACA,YAAA;AAAA,IACA,eAAkB,GAAA,IAAA;AAAA,IAClB,GAAG;AAAA,GACD,GAAA,KAAA;AAEJ,EAAA,MAAM,aAAgB,GAAA,IAAA,CAAK,eAAgB,CAAA,SAAA,EAAW,SAAS,CAAA;AAE/D,EAAA,MAAM,YAA6B,GAAA;AAAA,IACjC,KAAO,EAAA;AAAA,MACL,WAAW,eAAgB,CAAA,KAAA;AAAA,MAC3B,QAAA,EAAU,CAAC,KAAM,CAAA;AAAA,KACnB;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,WAAW,eAAgB,CAAA;AAAA,KAC7B;AAAA,IACA,UAAY,EAAA;AAAA,MACV,WAAW,eAAgB,CAAA;AAAA;AAC7B,GACF;AAEA,EAAA,2BACG,iBACC,EAAA,EAAA,QAAA,kBAAA,IAAA;AAAA,IAAC,IAAK,CAAA,WAAA;AAAA,IAAL;AAAA,MACC,eAAA;AAAA,MACC,GAAG,IAAA;AAAA,MACJ,SAAW,EAAA,aAAA;AAAA,MAEX,QAAA,EAAA;AAAA,wBAAA,IAAA,CAAC,IAAK,CAAA,KAAA,EAAL,EAAW,SAAA,EAAW,OAAO,KAC5B,EAAA,QAAA,EAAA;AAAA,0BAAA,IAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,QAAS,EAAA,WAAA;AAAA,cACT,WAAW,MAAO,CAAA,eAAA;AAAA,cAClB,IAAK,EAAA,GAAA;AAAA,cACL,OAAQ,EAAA,OAAA;AAAA,cACR,KAAM,EAAA,WAAA;AAAA,cAEN,QAAA,EAAA;AAAA,gCAAA,GAAA,CAAC,eAAgB,EAAA,EAAA,CAAA;AAAA,gCAChB,GAAA,CAAA,SAAA,EAAA,EAAU,SAAW,EAAA,MAAA,CAAO,iBAAmB,EAAA;AAAA;AAAA;AAAA,WAClD;AAAA,0BACA,GAAA;AAAA,YAAC,2BAAA;AAAA,YAAA;AAAA,cACC,cAAc,IAAK,CAAA,YAAA;AAAA,cACnB,KAAA;AAAA,cAEA,QAAA,kBAAA,GAAA;AAAA,gBAAC,IAAK,CAAA,KAAA;AAAA,gBAAL;AAAA,kBACC,WAAW,MAAO,CAAA,KAAA;AAAA,kBAClB,GAAA;AAAA,kBACA;AAAA;AAAA;AACF;AAAA,WACF;AAAA,0BACA,IAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,QAAS,EAAA,WAAA;AAAA,cACT,WAAW,MAAO,CAAA,eAAA;AAAA,cAClB,IAAK,EAAA,GAAA;AAAA,cACL,OAAQ,EAAA,OAAA;AAAA,cACR,KAAM,EAAA,WAAA;AAAA,cAEN,QAAA,EAAA;AAAA,gCAAA,GAAA,CAAC,aAAc,EAAA,EAAA,CAAA;AAAA,gCACd,GAAA,CAAA,QAAA,EAAA,EAAS,SAAW,EAAA,MAAA,CAAO,iBAAmB,EAAA;AAAA;AAAA;AAAA;AACjD,SACF,EAAA,CAAA;AAAA,wBACC,GAAA,CAAA,oBAAA,EAAA,EAAqB,KAAO,EAAA,YAAA,EAC1B,QACH,EAAA,CAAA;AAAA,wBACC,GAAA,CAAA,UAAA,EAAA,EAAW,SAAW,EAAA,eAAA,CAAgB,UAAY,EAAA;AAAA;AAAA;AAAA,GAEvD,EAAA,CAAA;AAEJ,CAAC;;;;"}
@@ -8,11 +8,13 @@ import styles from './TextArea.module.scss.mjs';
8
8
  import { ClearPropsContext } from '../ClearPropsContext/ClearPropsContext.mjs';
9
9
  import { flowComponent } from '../../lib/componentFactory/flowComponent.mjs';
10
10
  import { mergeRefs } from '@react-aria/utils';
11
+ import { ReactAriaControlledValueFix } from '../../lib/react/ReactAriaControlledValueFix.mjs';
11
12
 
12
13
  const TextArea = flowComponent("TextArea", (props) => {
13
14
  const {
14
15
  children,
15
16
  placeholder,
17
+ defaultValue,
16
18
  rows = 5,
17
19
  autoResizeMaxRows = rows,
18
20
  ref,
@@ -30,17 +32,25 @@ const TextArea = flowComponent("TextArea", (props) => {
30
32
  }
31
33
  };
32
34
  const input = /* @__PURE__ */ jsx(
33
- Aria.TextArea,
35
+ ReactAriaControlledValueFix,
34
36
  {
35
- rows,
36
- placeholder,
37
- className: styles.textArea,
38
- ref: mergeRefs(localRef, ref),
39
- onChange: updateHeight,
40
- style: {
41
- minHeight: getHeight(rows),
42
- maxHeight: getHeight(autoResizeMaxRows)
43
- }
37
+ inputContext: Aria.TextAreaContext,
38
+ props,
39
+ children: /* @__PURE__ */ jsx(
40
+ Aria.TextArea,
41
+ {
42
+ rows,
43
+ placeholder,
44
+ className: styles.textArea,
45
+ ref: mergeRefs(localRef, ref),
46
+ onChange: updateHeight,
47
+ defaultValue,
48
+ style: {
49
+ minHeight: getHeight(rows),
50
+ maxHeight: getHeight(autoResizeMaxRows)
51
+ }
52
+ }
53
+ )
44
54
  }
45
55
  );
46
56
  return /* @__PURE__ */ jsx(ClearPropsContext, { children: /* @__PURE__ */ jsx(TextFieldBase, { ...rest, input, children }) });
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.mjs","sources":["../../../../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import React, { useRef } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport type { TextFieldBaseProps } from \"@/components/TextFieldBase\";\nimport { TextFieldBase } from \"@/components/TextFieldBase\";\nimport styles from \"./TextArea.module.scss\";\nimport ClearPropsContext from \"@/components/ClearPropsContext/ClearPropsContext\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { mergeRefs } from \"@react-aria/utils\";\n\nexport interface TextAreaProps\n extends Omit<TextFieldBaseProps, \"input\" | \"ref\">,\n Pick<Aria.TextAreaProps, \"placeholder\" | \"rows\">,\n FlowComponentProps<HTMLTextAreaElement> {\n /**\n * Whether the text area should grow if its content gets longer than its\n * initial height.\n */\n autoResizeMaxRows?: number;\n}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const TextArea = flowComponent(\"TextArea\", (props) => {\n const {\n children,\n placeholder,\n rows = 5,\n autoResizeMaxRows = rows,\n ref,\n ...rest\n } = props;\n\n const localRef = useRef<HTMLTextAreaElement>(null);\n\n const getHeight = (rows: number) => {\n return `calc(var(--line-height--m) * ${rows} + (var(--form-control--padding-y) * 2))`;\n };\n\n const updateHeight = () => {\n if (localRef.current && rows !== autoResizeMaxRows) {\n // https://stackoverflow.com/a/60795884\n localRef.current.style.height = \"0px\";\n const scrollHeight = localRef.current.scrollHeight;\n localRef.current.style.height = scrollHeight + \"px\";\n }\n };\n\n const input = (\n <Aria.TextArea\n rows={rows}\n placeholder={placeholder}\n className={styles.textArea}\n ref={mergeRefs(localRef, ref)}\n onChange={updateHeight}\n style={{\n minHeight: getHeight(rows),\n maxHeight: getHeight(autoResizeMaxRows),\n }}\n />\n );\n\n return (\n <ClearPropsContext>\n <TextFieldBase {...rest} input={input}>\n {children}\n </TextFieldBase>\n </ClearPropsContext>\n );\n});\n\nexport default TextArea;\n"],"names":["rows"],"mappings":";;;;;;;;;AAyBO,MAAM,QAAW,GAAA,aAAA,CAAc,UAAY,EAAA,CAAC,KAAU,KAAA;AAC3D,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,WAAA;AAAA,IACA,IAAO,GAAA,CAAA;AAAA,IACP,iBAAoB,GAAA,IAAA;AAAA,IACpB,GAAA;AAAA,IACA,GAAG;AAAA,GACD,GAAA,KAAA;AAEJ,EAAM,MAAA,QAAA,GAAW,OAA4B,IAAI,CAAA;AAEjD,EAAM,MAAA,SAAA,GAAY,CAACA,KAAiB,KAAA;AAClC,IAAA,OAAO,gCAAgCA,KAAI,CAAA,wCAAA,CAAA;AAAA,GAC7C;AAEA,EAAA,MAAM,eAAe,MAAM;AACzB,IAAI,IAAA,QAAA,CAAS,OAAW,IAAA,IAAA,KAAS,iBAAmB,EAAA;AAElD,MAAS,QAAA,CAAA,OAAA,CAAQ,MAAM,MAAS,GAAA,KAAA;AAChC,MAAM,MAAA,YAAA,GAAe,SAAS,OAAQ,CAAA,YAAA;AACtC,MAAS,QAAA,CAAA,OAAA,CAAQ,KAAM,CAAA,MAAA,GAAS,YAAe,GAAA,IAAA;AAAA;AACjD,GACF;AAEA,EAAA,MAAM,KACJ,mBAAA,GAAA;AAAA,IAAC,IAAK,CAAA,QAAA;AAAA,IAAL;AAAA,MACC,IAAA;AAAA,MACA,WAAA;AAAA,MACA,WAAW,MAAO,CAAA,QAAA;AAAA,MAClB,GAAA,EAAK,SAAU,CAAA,QAAA,EAAU,GAAG,CAAA;AAAA,MAC5B,QAAU,EAAA,YAAA;AAAA,MACV,KAAO,EAAA;AAAA,QACL,SAAA,EAAW,UAAU,IAAI,CAAA;AAAA,QACzB,SAAA,EAAW,UAAU,iBAAiB;AAAA;AACxC;AAAA,GACF;AAGF,EACE,uBAAA,GAAA,CAAC,qBACC,QAAC,kBAAA,GAAA,CAAA,aAAA,EAAA,EAAe,GAAG,IAAM,EAAA,KAAA,EACtB,UACH,CACF,EAAA,CAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"TextArea.mjs","sources":["../../../../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import { useRef } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport type { TextFieldBaseProps } from \"@/components/TextFieldBase\";\nimport { TextFieldBase } from \"@/components/TextFieldBase\";\nimport styles from \"./TextArea.module.scss\";\nimport ClearPropsContext from \"@/components/ClearPropsContext/ClearPropsContext\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { mergeRefs } from \"@react-aria/utils\";\nimport { ReactAriaControlledValueFix } from \"@/lib/react/ReactAriaControlledValueFix\";\n\nexport interface TextAreaProps\n extends Omit<TextFieldBaseProps, \"input\" | \"ref\">,\n Pick<Aria.TextAreaProps, \"placeholder\" | \"rows\">,\n FlowComponentProps<HTMLTextAreaElement> {\n /**\n * Whether the text area should grow if its content gets longer than its\n * initial height.\n */\n autoResizeMaxRows?: number;\n}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const TextArea = flowComponent(\"TextArea\", (props) => {\n const {\n children,\n placeholder,\n defaultValue,\n rows = 5,\n autoResizeMaxRows = rows,\n ref,\n ...rest\n } = props;\n\n const localRef = useRef<HTMLTextAreaElement>(null);\n\n const getHeight = (rows: number) => {\n return `calc(var(--line-height--m) * ${rows} + (var(--form-control--padding-y) * 2))`;\n };\n\n const updateHeight = () => {\n if (localRef.current && rows !== autoResizeMaxRows) {\n // https://stackoverflow.com/a/60795884\n localRef.current.style.height = \"0px\";\n const scrollHeight = localRef.current.scrollHeight;\n localRef.current.style.height = scrollHeight + \"px\";\n }\n };\n\n const input = (\n <ReactAriaControlledValueFix\n inputContext={Aria.TextAreaContext}\n props={props}\n >\n <Aria.TextArea\n rows={rows}\n placeholder={placeholder}\n className={styles.textArea}\n ref={mergeRefs(localRef, ref)}\n onChange={updateHeight}\n defaultValue={defaultValue}\n style={{\n minHeight: getHeight(rows),\n maxHeight: getHeight(autoResizeMaxRows),\n }}\n />\n </ReactAriaControlledValueFix>\n );\n\n return (\n <ClearPropsContext>\n <TextFieldBase {...rest} input={input}>\n {children}\n </TextFieldBase>\n </ClearPropsContext>\n );\n});\n\nexport default TextArea;\n"],"names":["rows"],"mappings":";;;;;;;;;;AA0BO,MAAM,QAAW,GAAA,aAAA,CAAc,UAAY,EAAA,CAAC,KAAU,KAAA;AAC3D,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA;AAAA,IACA,IAAO,GAAA,CAAA;AAAA,IACP,iBAAoB,GAAA,IAAA;AAAA,IACpB,GAAA;AAAA,IACA,GAAG;AAAA,GACD,GAAA,KAAA;AAEJ,EAAM,MAAA,QAAA,GAAW,OAA4B,IAAI,CAAA;AAEjD,EAAM,MAAA,SAAA,GAAY,CAACA,KAAiB,KAAA;AAClC,IAAA,OAAO,gCAAgCA,KAAI,CAAA,wCAAA,CAAA;AAAA,GAC7C;AAEA,EAAA,MAAM,eAAe,MAAM;AACzB,IAAI,IAAA,QAAA,CAAS,OAAW,IAAA,IAAA,KAAS,iBAAmB,EAAA;AAElD,MAAS,QAAA,CAAA,OAAA,CAAQ,MAAM,MAAS,GAAA,KAAA;AAChC,MAAM,MAAA,YAAA,GAAe,SAAS,OAAQ,CAAA,YAAA;AACtC,MAAS,QAAA,CAAA,OAAA,CAAQ,KAAM,CAAA,MAAA,GAAS,YAAe,GAAA,IAAA;AAAA;AACjD,GACF;AAEA,EAAA,MAAM,KACJ,mBAAA,GAAA;AAAA,IAAC,2BAAA;AAAA,IAAA;AAAA,MACC,cAAc,IAAK,CAAA,eAAA;AAAA,MACnB,KAAA;AAAA,MAEA,QAAA,kBAAA,GAAA;AAAA,QAAC,IAAK,CAAA,QAAA;AAAA,QAAL;AAAA,UACC,IAAA;AAAA,UACA,WAAA;AAAA,UACA,WAAW,MAAO,CAAA,QAAA;AAAA,UAClB,GAAA,EAAK,SAAU,CAAA,QAAA,EAAU,GAAG,CAAA;AAAA,UAC5B,QAAU,EAAA,YAAA;AAAA,UACV,YAAA;AAAA,UACA,KAAO,EAAA;AAAA,YACL,SAAA,EAAW,UAAU,IAAI,CAAA;AAAA,YACzB,SAAA,EAAW,UAAU,iBAAiB;AAAA;AACxC;AAAA;AACF;AAAA,GACF;AAGF,EACE,uBAAA,GAAA,CAAC,qBACC,QAAC,kBAAA,GAAA,CAAA,aAAA,EAAA,EAAe,GAAG,IAAM,EAAA,KAAA,EACtB,UACH,CACF,EAAA,CAAA;AAEJ,CAAC;;;;"}
@@ -1,24 +1,25 @@
1
1
  "use client"
2
2
  /* */
3
3
  import { jsx } from 'react/jsx-runtime';
4
- import 'react';
5
4
  import * as Aria from 'react-aria-components';
6
5
  import { TextFieldBase } from '../TextFieldBase/TextFieldBase.mjs';
7
6
  import styles from './TextField.module.scss.mjs';
8
7
  import { ClearPropsContext } from '../ClearPropsContext/ClearPropsContext.mjs';
9
8
  import { flowComponent } from '../../lib/componentFactory/flowComponent.mjs';
9
+ import { ReactAriaControlledValueFix } from '../../lib/react/ReactAriaControlledValueFix.mjs';
10
10
 
11
11
  const TextField = flowComponent("TextField", (props) => {
12
- const { children, placeholder, ref, form, ...rest } = props;
13
- const input = /* @__PURE__ */ jsx(
12
+ const { children, defaultValue, placeholder, ref, form, ...rest } = props;
13
+ const input = /* @__PURE__ */ jsx(ReactAriaControlledValueFix, { inputContext: Aria.InputContext, props, children: /* @__PURE__ */ jsx(
14
14
  Aria.Input,
15
15
  {
16
16
  form,
17
17
  placeholder,
18
18
  className: styles.textField,
19
- ref
19
+ ref,
20
+ defaultValue
20
21
  }
21
- );
22
+ ) });
22
23
  return /* @__PURE__ */ jsx(ClearPropsContext, { children: /* @__PURE__ */ jsx(TextFieldBase, { ...rest, input, children }) });
23
24
  });
24
25
 
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.mjs","sources":["../../../../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import React from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport type { TextFieldBaseProps } from \"@/components/TextFieldBase\";\nimport { TextFieldBase } from \"@/components/TextFieldBase\";\nimport styles from \"./TextField.module.scss\";\nimport ClearPropsContext from \"@/components/ClearPropsContext/ClearPropsContext\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\n\nexport interface TextFieldProps\n extends Omit<TextFieldBaseProps, \"input\" | \"className\">,\n Pick<Aria.InputProps, \"placeholder\" | \"form\">,\n PropsWithClassName,\n FlowComponentProps<HTMLInputElement> {}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const TextField = flowComponent(\"TextField\", (props) => {\n const { children, placeholder, ref, form, ...rest } = props;\n\n const input = (\n <Aria.Input\n form={form}\n placeholder={placeholder}\n className={styles.textField}\n ref={ref}\n />\n );\n\n return (\n <ClearPropsContext>\n <TextFieldBase {...rest} input={input}>\n {children}\n </TextFieldBase>\n </ClearPropsContext>\n );\n});\n\nexport default TextField;\n"],"names":[],"mappings":";;;;;;;;AAoBO,MAAM,SAAY,GAAA,aAAA,CAAc,WAAa,EAAA,CAAC,KAAU,KAAA;AAC7D,EAAA,MAAM,EAAE,QAAU,EAAA,WAAA,EAAa,KAAK,IAAM,EAAA,GAAG,MAAS,GAAA,KAAA;AAEtD,EAAA,MAAM,KACJ,mBAAA,GAAA;AAAA,IAAC,IAAK,CAAA,KAAA;AAAA,IAAL;AAAA,MACC,IAAA;AAAA,MACA,WAAA;AAAA,MACA,WAAW,MAAO,CAAA,SAAA;AAAA,MAClB;AAAA;AAAA,GACF;AAGF,EACE,uBAAA,GAAA,CAAC,qBACC,QAAC,kBAAA,GAAA,CAAA,aAAA,EAAA,EAAe,GAAG,IAAM,EAAA,KAAA,EACtB,UACH,CACF,EAAA,CAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"TextField.mjs","sources":["../../../../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport type { TextFieldBaseProps } from \"@/components/TextFieldBase\";\nimport { TextFieldBase } from \"@/components/TextFieldBase\";\nimport styles from \"./TextField.module.scss\";\nimport ClearPropsContext from \"@/components/ClearPropsContext/ClearPropsContext\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport { ReactAriaControlledValueFix } from \"@/lib/react/ReactAriaControlledValueFix\";\n\nexport interface TextFieldProps\n extends Omit<TextFieldBaseProps, \"input\" | \"className\">,\n Pick<Aria.InputProps, \"placeholder\" | \"form\">,\n PropsWithClassName,\n FlowComponentProps<HTMLInputElement> {}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const TextField = flowComponent(\"TextField\", (props) => {\n const { children, defaultValue, placeholder, ref, form, ...rest } = props;\n\n const input = (\n <ReactAriaControlledValueFix inputContext={Aria.InputContext} props={props}>\n <Aria.Input\n form={form}\n placeholder={placeholder}\n className={styles.textField}\n ref={ref}\n defaultValue={defaultValue}\n />\n </ReactAriaControlledValueFix>\n );\n\n return (\n <ClearPropsContext>\n <TextFieldBase {...rest} input={input}>\n {children}\n </TextFieldBase>\n </ClearPropsContext>\n );\n});\n\nexport default TextField;\n"],"names":[],"mappings":";;;;;;;;AAoBO,MAAM,SAAY,GAAA,aAAA,CAAc,WAAa,EAAA,CAAC,KAAU,KAAA;AAC7D,EAAM,MAAA,EAAE,UAAU,YAAc,EAAA,WAAA,EAAa,KAAK,IAAM,EAAA,GAAG,MAAS,GAAA,KAAA;AAEpE,EAAA,MAAM,wBACH,GAAA,CAAA,2BAAA,EAAA,EAA4B,YAAc,EAAA,IAAA,CAAK,cAAc,KAC5D,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,IAAK,CAAA,KAAA;AAAA,IAAL;AAAA,MACC,IAAA;AAAA,MACA,WAAA;AAAA,MACA,WAAW,MAAO,CAAA,SAAA;AAAA,MAClB,GAAA;AAAA,MACA;AAAA;AAAA,GAEJ,EAAA,CAAA;AAGF,EACE,uBAAA,GAAA,CAAC,qBACC,QAAC,kBAAA,GAAA,CAAA,aAAA,EAAA,EAAe,GAAG,IAAM,EAAA,KAAA,EACtB,UACH,CACF,EAAA,CAAA;AAEJ,CAAC;;;;"}
@@ -1,23 +1,30 @@
1
1
  "use client"
2
2
  /* */
3
3
  import { jsx } from 'react/jsx-runtime';
4
- import 'react';
4
+ import { useState, useEffect } from 'react';
5
5
  import { ActionStateContext } from '../../../../components/Action/ActionStateContext.mjs';
6
6
  import { useFormContext } from '../context/formContext.mjs';
7
- import { useFormState } from 'react-hook-form';
8
7
 
9
8
  const ActionStateContextWrapper = (props) => {
10
9
  const { children, isAsyncSubmit } = props;
11
10
  const form = useFormContext().form;
12
- const { isSubmitted, isSubmitting, isSubmitSuccessful, errors } = useFormState(form);
13
- const submitErrors = isSubmitted && errors && Object.entries(errors).length > 0 ? errors : void 0;
14
- const submitSucceeded = isSubmitted && isSubmitSuccessful;
11
+ const [submitErrors, setSubmitErrors] = useState(void 0);
12
+ const [hasSucceeded, setHasSucceeded] = useState(false);
13
+ const [isStarted, setIsStarted] = useState(false);
14
+ useEffect(() => {
15
+ const { isSubmitted, isSubmitting, isSubmitSuccessful, errors } = form.formState;
16
+ setSubmitErrors(
17
+ isSubmitted && errors && Object.entries(errors).length > 0 ? errors : void 0
18
+ );
19
+ setHasSucceeded(isSubmitted && isSubmitSuccessful);
20
+ setIsStarted(isSubmitting && isAsyncSubmit.current);
21
+ }, [form.formState, isAsyncSubmit.current]);
15
22
  return /* @__PURE__ */ jsx(
16
23
  ActionStateContext,
17
24
  {
18
- isStarted: isSubmitting && isAsyncSubmit.current,
25
+ isStarted,
19
26
  hasFailedWithError: submitErrors,
20
- hasSucceeded: submitSucceeded,
27
+ hasSucceeded,
21
28
  children
22
29
  }
23
30
  );
@@ -1 +1 @@
1
- {"version":3,"file":"SubmitButtonStateProvider.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/ActionGroupWrapper/SubmitButtonStateProvider.tsx"],"sourcesContent":["import type { FC, MutableRefObject, PropsWithChildren } from \"react\";\nimport React from \"react\";\nimport { ActionStateContext } from \"@/components/Action/ActionStateContext\";\nimport { useFormContext } from \"@/integrations/react-hook-form/components/context/formContext\";\nimport { useFormState } from \"react-hook-form\";\n\ninterface Props extends PropsWithChildren {\n isAsyncSubmit: MutableRefObject<boolean>;\n}\n\nconst ActionStateContextWrapper: FC<Props> = (props) => {\n const { children, isAsyncSubmit } = props;\n\n const form = useFormContext().form;\n\n const { isSubmitted, isSubmitting, isSubmitSuccessful, errors } =\n useFormState(form);\n\n const submitErrors =\n isSubmitted && errors && Object.entries(errors).length > 0\n ? errors\n : undefined;\n\n const submitSucceeded = isSubmitted && isSubmitSuccessful;\n\n return (\n <ActionStateContext\n isStarted={isSubmitting && isAsyncSubmit.current}\n hasFailedWithError={submitErrors}\n hasSucceeded={submitSucceeded}\n >\n {children}\n </ActionStateContext>\n );\n};\n\nexport const SubmitButtonStateProvider: FC<Props> = (props) => {\n const { children, isAsyncSubmit } = props;\n\n return (\n <ActionStateContextWrapper isAsyncSubmit={isAsyncSubmit}>\n {children}\n </ActionStateContextWrapper>\n );\n};\n"],"names":[],"mappings":";;;;;;AAUA,MAAM,yBAAA,GAAuC,CAAC,KAAU,KAAA;AACtD,EAAM,MAAA,EAAE,QAAU,EAAA,aAAA,EAAkB,GAAA,KAAA;AAEpC,EAAM,MAAA,IAAA,GAAO,gBAAiB,CAAA,IAAA;AAE9B,EAAA,MAAM,EAAE,WAAa,EAAA,YAAA,EAAc,oBAAoB,MAAO,EAAA,GAC5D,aAAa,IAAI,CAAA;AAEnB,EAAM,MAAA,YAAA,GACJ,eAAe,MAAU,IAAA,MAAA,CAAO,QAAQ,MAAM,CAAA,CAAE,MAAS,GAAA,CAAA,GACrD,MACA,GAAA,MAAA;AAEN,EAAA,MAAM,kBAAkB,WAAe,IAAA,kBAAA;AAEvC,EACE,uBAAA,GAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,gBAAgB,aAAc,CAAA,OAAA;AAAA,MACzC,kBAAoB,EAAA,YAAA;AAAA,MACpB,YAAc,EAAA,eAAA;AAAA,MAEb;AAAA;AAAA,GACH;AAEJ,CAAA;AAEa,MAAA,yBAAA,GAAuC,CAAC,KAAU,KAAA;AAC7D,EAAM,MAAA,EAAE,QAAU,EAAA,aAAA,EAAkB,GAAA,KAAA;AAEpC,EACE,uBAAA,GAAA,CAAC,yBAA0B,EAAA,EAAA,aAAA,EACxB,QACH,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"SubmitButtonStateProvider.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/ActionGroupWrapper/SubmitButtonStateProvider.tsx"],"sourcesContent":["import type { FC, MutableRefObject, PropsWithChildren } from \"react\";\nimport { useEffect, useState } from \"react\";\nimport { ActionStateContext } from \"@/components/Action/ActionStateContext\";\nimport { useFormContext } from \"@/integrations/react-hook-form/components/context/formContext\";\n\ninterface Props extends PropsWithChildren {\n isAsyncSubmit: MutableRefObject<boolean>;\n}\n\nconst ActionStateContextWrapper: FC<Props> = (props) => {\n const { children, isAsyncSubmit } = props;\n\n const form = useFormContext().form;\n\n const [submitErrors, setSubmitErrors] = useState<unknown>(undefined);\n const [hasSucceeded, setHasSucceeded] = useState(false);\n const [isStarted, setIsStarted] = useState(false);\n\n useEffect(() => {\n /**\n * The mapping into sepearte states inside this effect is required, because\n * otherwise the reset() function of RHF does not work as expected\n * (subsequent resets not working, default values are not correctly re-used,\n * ...).\n *\n * A side note: This only happens if 'isSubmitted' and/or 'isSubmitting' are\n * extracted from the form state.\n */\n const { isSubmitted, isSubmitting, isSubmitSuccessful, errors } =\n form.formState;\n\n setSubmitErrors(\n isSubmitted && errors && Object.entries(errors).length > 0\n ? errors\n : undefined,\n );\n setHasSucceeded(isSubmitted && isSubmitSuccessful);\n setIsStarted(isSubmitting && isAsyncSubmit.current);\n }, [form.formState, isAsyncSubmit.current]);\n\n return (\n <ActionStateContext\n isStarted={isStarted}\n hasFailedWithError={submitErrors}\n hasSucceeded={hasSucceeded}\n >\n {children}\n </ActionStateContext>\n );\n};\n\nexport const SubmitButtonStateProvider: FC<Props> = (props) => {\n const { children, isAsyncSubmit } = props;\n\n return (\n <ActionStateContextWrapper isAsyncSubmit={isAsyncSubmit}>\n {children}\n </ActionStateContextWrapper>\n );\n};\n"],"names":[],"mappings":";;;;;AASA,MAAM,yBAAA,GAAuC,CAAC,KAAU,KAAA;AACtD,EAAM,MAAA,EAAE,QAAU,EAAA,aAAA,EAAkB,GAAA,KAAA;AAEpC,EAAM,MAAA,IAAA,GAAO,gBAAiB,CAAA,IAAA;AAE9B,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAI,SAAkB,MAAS,CAAA;AACnE,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAI,SAAS,KAAK,CAAA;AACtD,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAS,KAAK,CAAA;AAEhD,EAAA,SAAA,CAAU,MAAM;AAUd,IAAA,MAAM,EAAE,WAAa,EAAA,YAAA,EAAc,kBAAoB,EAAA,MAAA,KACrD,IAAK,CAAA,SAAA;AAEP,IAAA,eAAA;AAAA,MACE,WAAA,IAAe,UAAU,MAAO,CAAA,OAAA,CAAQ,MAAM,CAAE,CAAA,MAAA,GAAS,IACrD,MACA,GAAA;AAAA,KACN;AACA,IAAA,eAAA,CAAgB,eAAe,kBAAkB,CAAA;AACjD,IAAa,YAAA,CAAA,YAAA,IAAgB,cAAc,OAAO,CAAA;AAAA,KACjD,CAAC,IAAA,CAAK,SAAW,EAAA,aAAA,CAAc,OAAO,CAAC,CAAA;AAE1C,EACE,uBAAA,GAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACC,SAAA;AAAA,MACA,kBAAoB,EAAA,YAAA;AAAA,MACpB,YAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ,CAAA;AAEa,MAAA,yBAAA,GAAuC,CAAC,KAAU,KAAA;AAC7D,EAAM,MAAA,EAAE,QAAU,EAAA,aAAA,EAAkB,GAAA,KAAA;AAEpC,EACE,uBAAA,GAAA,CAAC,yBAA0B,EAAA,EAAA,aAAA,EACxB,QACH,EAAA,CAAA;AAEJ;;;;"}
@@ -8,82 +8,80 @@ import '../../../../lib/viewComponentContext/viewComponentContext.mjs';
8
8
  import { dynamic } from '../../../../lib/propsContext/dynamicProps/dynamic.mjs';
9
9
  import { PropsContextProvider } from '../../../../lib/propsContext/PropsContextProvider.mjs';
10
10
  import FieldErrorView from '../../../../views/FieldErrorView.mjs';
11
- import { Controller } from 'react-hook-form';
11
+ import { useController } from 'react-hook-form';
12
12
 
13
13
  function Field(props) {
14
- const { children, control, ...rest } = props;
14
+ const { children, name, defaultValue, ...rest } = props;
15
15
  const formContext = useFormContext();
16
- const controlFromContext = formContext.form?.control;
16
+ const form = formContext.form;
17
+ const uncontrolledField = {
18
+ field: form.register(name),
19
+ fieldState: form.getFieldState(name)
20
+ };
21
+ const controlledField = useController(props);
22
+ const buildFieldProps = (field) => ({
23
+ ...field.field,
24
+ defaultValue,
25
+ name,
26
+ form: formContext.id,
27
+ isRequired: !!rest.rules?.required,
28
+ validationBehavior: "aria",
29
+ isInvalid: field.fieldState.invalid,
30
+ onChange: (value) => {
31
+ field.field.onChange({
32
+ target: {
33
+ value
34
+ }
35
+ });
36
+ },
37
+ children: dynamic((p) => /* @__PURE__ */ jsxs(Fragment, { children: [
38
+ p.children,
39
+ /* @__PURE__ */ jsx(FieldErrorView, { children: field.fieldState.error?.message })
40
+ ] }))
41
+ });
42
+ const uncontrolledProps = buildFieldProps(uncontrolledField);
43
+ const controlledProps = buildFieldProps(controlledField);
44
+ const controlledValue = controlledField.field.value;
45
+ const propsContext = {
46
+ SearchField: uncontrolledProps,
47
+ TextField: uncontrolledProps,
48
+ TextArea: uncontrolledProps,
49
+ Checkbox: {
50
+ ...controlledProps,
51
+ isSelected: controlledValue
52
+ },
53
+ CheckboxGroup: controlledProps,
54
+ CheckboxButton: {
55
+ ...controlledProps,
56
+ isSelected: controlledValue
57
+ },
58
+ FileField: controlledProps,
59
+ NumberField: controlledProps,
60
+ RadioGroup: controlledProps,
61
+ Switch: {
62
+ ...controlledProps,
63
+ isSelected: controlledValue
64
+ },
65
+ Select: {
66
+ ...controlledProps,
67
+ selectedKey: controlledValue
68
+ },
69
+ Slider: controlledProps,
70
+ DatePicker: controlledProps,
71
+ DateRangePicker: controlledProps,
72
+ TimeField: controlledProps,
73
+ SegmentedControl: controlledProps,
74
+ ComboBox: {
75
+ ...controlledProps,
76
+ defaultInputValue: controlledValue
77
+ }
78
+ };
17
79
  return /* @__PURE__ */ jsx(
18
- Controller,
80
+ PropsContextProvider,
19
81
  {
20
- ...rest,
21
- control: control ?? controlFromContext,
22
- render: (renderProps) => {
23
- const {
24
- field,
25
- fieldState: { error, invalid }
26
- } = renderProps;
27
- const formControlProps = {
28
- ...field,
29
- form: formContext.id,
30
- isRequired: !!rest.rules?.required,
31
- isInvalid: invalid,
32
- validationBehavior: "aria",
33
- children: dynamic((p) => /* @__PURE__ */ jsxs(Fragment, { children: [
34
- p.children,
35
- /* @__PURE__ */ jsx(FieldErrorView, { children: error?.message })
36
- ] }))
37
- };
38
- const uncontrolledFormControlProps = {
39
- ...formControlProps,
40
- value: void 0,
41
- defaultValue: field.value
42
- };
43
- const propsContext = {
44
- // uncontrolled fields – see https://github.com/mittwald/flow/issues/1341
45
- SearchField: uncontrolledFormControlProps,
46
- TextField: uncontrolledFormControlProps,
47
- TextArea: uncontrolledFormControlProps,
48
- Checkbox: {
49
- ...formControlProps,
50
- isSelected: formControlProps.value
51
- },
52
- CheckboxGroup: formControlProps,
53
- CheckboxButton: {
54
- ...formControlProps,
55
- isSelected: formControlProps.value
56
- },
57
- FileField: formControlProps,
58
- NumberField: formControlProps,
59
- RadioGroup: formControlProps,
60
- Switch: {
61
- ...formControlProps,
62
- isSelected: formControlProps.value
63
- },
64
- Select: {
65
- ...formControlProps,
66
- selectedKey: formControlProps.value
67
- },
68
- Slider: formControlProps,
69
- DatePicker: formControlProps,
70
- DateRangePicker: formControlProps,
71
- TimeField: formControlProps,
72
- SegmentedControl: formControlProps,
73
- ComboBox: {
74
- ...formControlProps,
75
- defaultInputValue: formControlProps.value
76
- }
77
- };
78
- return /* @__PURE__ */ jsx(
79
- PropsContextProvider,
80
- {
81
- props: propsContext,
82
- dependencies: [renderProps],
83
- children
84
- }
85
- );
86
- }
82
+ props: propsContext,
83
+ dependencies: [controlledField.fieldState, uncontrolledField.fieldState],
84
+ children
87
85
  }
88
86
  );
89
87
  }
@@ -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 FieldErrorView from \"@/views/FieldErrorView\";\nimport type { PropsWithChildren } from \"react\";\nimport type {\n ControllerProps,\n FieldValues,\n UseFormReturn,\n} from \"react-hook-form\";\nimport { Controller } from \"react-hook-form\";\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, control, ...rest } = props;\n\n const formContext = useFormContext<T>();\n const controlFromContext = formContext.form?.control;\n\n return (\n <Controller\n {...rest}\n control={control ?? controlFromContext}\n render={(renderProps) => {\n const {\n field,\n fieldState: { error, invalid },\n } = renderProps;\n\n const formControlProps = {\n ...field,\n form: formContext.id,\n isRequired: !!rest.rules?.required,\n isInvalid: invalid,\n validationBehavior: \"aria\" as const,\n children: dynamic((p) => (\n <>\n {p.children}\n <FieldErrorView>{error?.message}</FieldErrorView>\n </>\n )),\n };\n\n const uncontrolledFormControlProps = {\n ...formControlProps,\n value: undefined,\n defaultValue: field.value,\n };\n\n const propsContext: PropsContext = {\n // uncontrolled fields – see https://github.com/mittwald/flow/issues/1341\n SearchField: uncontrolledFormControlProps,\n TextField: uncontrolledFormControlProps,\n TextArea: uncontrolledFormControlProps,\n\n Checkbox: {\n ...formControlProps,\n isSelected: formControlProps.value,\n },\n CheckboxGroup: formControlProps,\n CheckboxButton: {\n ...formControlProps,\n isSelected: formControlProps.value,\n },\n FileField: formControlProps,\n NumberField: formControlProps,\n RadioGroup: formControlProps,\n Switch: {\n ...formControlProps,\n isSelected: formControlProps.value,\n },\n Select: {\n ...formControlProps,\n selectedKey: formControlProps.value,\n },\n Slider: formControlProps,\n DatePicker: formControlProps,\n DateRangePicker: formControlProps,\n TimeField: formControlProps,\n SegmentedControl: formControlProps,\n ComboBox: {\n ...formControlProps,\n defaultInputValue: formControlProps.value,\n },\n };\n\n return (\n <PropsContextProvider\n props={propsContext}\n dependencies={[renderProps]}\n >\n {children}\n </PropsContextProvider>\n );\n }}\n />\n );\n}\n\nexport const typedField = <T extends FieldValues>(\n ignoredForm: UseFormReturn<T>,\n): typeof Field<T> => Field;\n"],"names":[],"mappings":";;;;;;;;;;AAgBO,SAAS,MAA6B,KAAsB,EAAA;AACjE,EAAA,MAAM,EAAE,QAAA,EAAU,OAAS,EAAA,GAAG,MAAS,GAAA,KAAA;AAEvC,EAAA,MAAM,cAAc,cAAkB,EAAA;AACtC,EAAM,MAAA,kBAAA,GAAqB,YAAY,IAAM,EAAA,OAAA;AAE7C,EACE,uBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,SAAS,OAAW,IAAA,kBAAA;AAAA,MACpB,MAAA,EAAQ,CAAC,WAAgB,KAAA;AACvB,QAAM,MAAA;AAAA,UACJ,KAAA;AAAA,UACA,UAAA,EAAY,EAAE,KAAA,EAAO,OAAQ;AAAA,SAC3B,GAAA,WAAA;AAEJ,QAAA,MAAM,gBAAmB,GAAA;AAAA,UACvB,GAAG,KAAA;AAAA,UACH,MAAM,WAAY,CAAA,EAAA;AAAA,UAClB,UAAY,EAAA,CAAC,CAAC,IAAA,CAAK,KAAO,EAAA,QAAA;AAAA,UAC1B,SAAW,EAAA,OAAA;AAAA,UACX,kBAAoB,EAAA,MAAA;AAAA,UACpB,QAAU,EAAA,OAAA,CAAQ,CAAC,CAAA,qBAEd,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,YAAE,CAAA,CAAA,QAAA;AAAA,4BACH,GAAA,CAAC,cAAgB,EAAA,EAAA,QAAA,EAAA,KAAA,EAAO,OAAQ,EAAA;AAAA,WAAA,EAClC,CACD;AAAA,SACH;AAEA,QAAA,MAAM,4BAA+B,GAAA;AAAA,UACnC,GAAG,gBAAA;AAAA,UACH,KAAO,EAAA,MAAA;AAAA,UACP,cAAc,KAAM,CAAA;AAAA,SACtB;AAEA,QAAA,MAAM,YAA6B,GAAA;AAAA;AAAA,UAEjC,WAAa,EAAA,4BAAA;AAAA,UACb,SAAW,EAAA,4BAAA;AAAA,UACX,QAAU,EAAA,4BAAA;AAAA,UAEV,QAAU,EAAA;AAAA,YACR,GAAG,gBAAA;AAAA,YACH,YAAY,gBAAiB,CAAA;AAAA,WAC/B;AAAA,UACA,aAAe,EAAA,gBAAA;AAAA,UACf,cAAgB,EAAA;AAAA,YACd,GAAG,gBAAA;AAAA,YACH,YAAY,gBAAiB,CAAA;AAAA,WAC/B;AAAA,UACA,SAAW,EAAA,gBAAA;AAAA,UACX,WAAa,EAAA,gBAAA;AAAA,UACb,UAAY,EAAA,gBAAA;AAAA,UACZ,MAAQ,EAAA;AAAA,YACN,GAAG,gBAAA;AAAA,YACH,YAAY,gBAAiB,CAAA;AAAA,WAC/B;AAAA,UACA,MAAQ,EAAA;AAAA,YACN,GAAG,gBAAA;AAAA,YACH,aAAa,gBAAiB,CAAA;AAAA,WAChC;AAAA,UACA,MAAQ,EAAA,gBAAA;AAAA,UACR,UAAY,EAAA,gBAAA;AAAA,UACZ,eAAiB,EAAA,gBAAA;AAAA,UACjB,SAAW,EAAA,gBAAA;AAAA,UACX,gBAAkB,EAAA,gBAAA;AAAA,UAClB,QAAU,EAAA;AAAA,YACR,GAAG,gBAAA;AAAA,YACH,mBAAmB,gBAAiB,CAAA;AAAA;AACtC,SACF;AAEA,QACE,uBAAA,GAAA;AAAA,UAAC,oBAAA;AAAA,UAAA;AAAA,YACC,KAAO,EAAA,YAAA;AAAA,YACP,YAAA,EAAc,CAAC,WAAW,CAAA;AAAA,YAEzB;AAAA;AAAA,SACH;AAAA;AAEJ;AAAA,GACF;AAEJ;AAEa,MAAA,UAAA,GAAa,CACxB,WACoB,KAAA;;;;"}
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 FieldErrorView from \"@/views/FieldErrorView\";\nimport type { PropsWithChildren } from \"react\";\nimport {\n useController,\n type ControllerProps,\n type FieldValues,\n type UseFormReturn,\n} from \"react-hook-form\";\n\nexport interface FieldProps<T extends FieldValues>\n extends Omit<ControllerProps<T>, \"render\" | \"control\">,\n PropsWithChildren {}\n\nexport function Field<T extends FieldValues>(props: FieldProps<T>) {\n const { children, name, defaultValue, ...rest } = props;\n\n const formContext = useFormContext<T>();\n const form = formContext.form;\n\n const uncontrolledField = {\n field: form.register(name),\n fieldState: form.getFieldState(name),\n };\n const controlledField = useController(props);\n\n const buildFieldProps = (\n field: typeof uncontrolledField | typeof controlledField,\n ) => ({\n ...field.field,\n defaultValue,\n name,\n form: formContext.id,\n isRequired: !!rest.rules?.required,\n validationBehavior: \"aria\" as const,\n isInvalid: field.fieldState.invalid,\n onChange: (value: unknown) => {\n field.field.onChange({\n target: {\n value,\n },\n });\n },\n children: dynamic((p) => (\n <>\n {p.children}\n <FieldErrorView>{field.fieldState.error?.message}</FieldErrorView>\n </>\n )),\n });\n\n const uncontrolledProps = buildFieldProps(uncontrolledField);\n const controlledProps = buildFieldProps(controlledField);\n const controlledValue = controlledField.field.value;\n\n const propsContext: PropsContext = {\n SearchField: uncontrolledProps,\n TextField: uncontrolledProps,\n TextArea: uncontrolledProps,\n\n Checkbox: {\n ...controlledProps,\n isSelected: controlledValue,\n },\n CheckboxGroup: controlledProps,\n CheckboxButton: {\n ...controlledProps,\n isSelected: controlledValue,\n },\n FileField: controlledProps,\n NumberField: controlledProps,\n RadioGroup: controlledProps,\n Switch: {\n ...controlledProps,\n isSelected: controlledValue,\n },\n Select: {\n ...controlledProps,\n selectedKey: controlledValue,\n },\n Slider: controlledProps,\n DatePicker: controlledProps,\n DateRangePicker: controlledProps,\n TimeField: controlledProps,\n SegmentedControl: controlledProps,\n ComboBox: {\n ...controlledProps,\n defaultInputValue: controlledValue,\n },\n };\n\n return (\n <PropsContextProvider\n props={propsContext}\n dependencies={[controlledField.fieldState, uncontrolledField.fieldState]}\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"],"names":[],"mappings":";;;;;;;;;;AAgBO,SAAS,MAA6B,KAAsB,EAAA;AACjE,EAAA,MAAM,EAAE,QAAU,EAAA,IAAA,EAAM,YAAc,EAAA,GAAG,MAAS,GAAA,KAAA;AAElD,EAAA,MAAM,cAAc,cAAkB,EAAA;AACtC,EAAA,MAAM,OAAO,WAAY,CAAA,IAAA;AAEzB,EAAA,MAAM,iBAAoB,GAAA;AAAA,IACxB,KAAA,EAAO,IAAK,CAAA,QAAA,CAAS,IAAI,CAAA;AAAA,IACzB,UAAA,EAAY,IAAK,CAAA,aAAA,CAAc,IAAI;AAAA,GACrC;AACA,EAAM,MAAA,eAAA,GAAkB,cAAc,KAAK,CAAA;AAE3C,EAAM,MAAA,eAAA,GAAkB,CACtB,KACI,MAAA;AAAA,IACJ,GAAG,KAAM,CAAA,KAAA;AAAA,IACT,YAAA;AAAA,IACA,IAAA;AAAA,IACA,MAAM,WAAY,CAAA,EAAA;AAAA,IAClB,UAAY,EAAA,CAAC,CAAC,IAAA,CAAK,KAAO,EAAA,QAAA;AAAA,IAC1B,kBAAoB,EAAA,MAAA;AAAA,IACpB,SAAA,EAAW,MAAM,UAAW,CAAA,OAAA;AAAA,IAC5B,QAAA,EAAU,CAAC,KAAmB,KAAA;AAC5B,MAAA,KAAA,CAAM,MAAM,QAAS,CAAA;AAAA,QACnB,MAAQ,EAAA;AAAA,UACN;AAAA;AACF,OACD,CAAA;AAAA,KACH;AAAA,IACA,QAAU,EAAA,OAAA,CAAQ,CAAC,CAAA,qBAEd,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,MAAE,CAAA,CAAA,QAAA;AAAA,sBACF,GAAA,CAAA,cAAA,EAAA,EAAgB,QAAM,EAAA,KAAA,CAAA,UAAA,CAAW,OAAO,OAAQ,EAAA;AAAA,KAAA,EACnD,CACD;AAAA,GACH,CAAA;AAEA,EAAM,MAAA,iBAAA,GAAoB,gBAAgB,iBAAiB,CAAA;AAC3D,EAAM,MAAA,eAAA,GAAkB,gBAAgB,eAAe,CAAA;AACvD,EAAM,MAAA,eAAA,GAAkB,gBAAgB,KAAM,CAAA,KAAA;AAE9C,EAAA,MAAM,YAA6B,GAAA;AAAA,IACjC,WAAa,EAAA,iBAAA;AAAA,IACb,SAAW,EAAA,iBAAA;AAAA,IACX,QAAU,EAAA,iBAAA;AAAA,IAEV,QAAU,EAAA;AAAA,MACR,GAAG,eAAA;AAAA,MACH,UAAY,EAAA;AAAA,KACd;AAAA,IACA,aAAe,EAAA,eAAA;AAAA,IACf,cAAgB,EAAA;AAAA,MACd,GAAG,eAAA;AAAA,MACH,UAAY,EAAA;AAAA,KACd;AAAA,IACA,SAAW,EAAA,eAAA;AAAA,IACX,WAAa,EAAA,eAAA;AAAA,IACb,UAAY,EAAA,eAAA;AAAA,IACZ,MAAQ,EAAA;AAAA,MACN,GAAG,eAAA;AAAA,MACH,UAAY,EAAA;AAAA,KACd;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,GAAG,eAAA;AAAA,MACH,WAAa,EAAA;AAAA,KACf;AAAA,IACA,MAAQ,EAAA,eAAA;AAAA,IACR,UAAY,EAAA,eAAA;AAAA,IACZ,eAAiB,EAAA,eAAA;AAAA,IACjB,SAAW,EAAA,eAAA;AAAA,IACX,gBAAkB,EAAA,eAAA;AAAA,IAClB,QAAU,EAAA;AAAA,MACR,GAAG,eAAA;AAAA,MACH,iBAAmB,EAAA;AAAA;AACrB,GACF;AAEA,EACE,uBAAA,GAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,KAAO,EAAA,YAAA;AAAA,MACP,YAAc,EAAA,CAAC,eAAgB,CAAA,UAAA,EAAY,kBAAkB,UAAU,CAAA;AAAA,MAEtE;AAAA;AAAA,GACH;AAEJ;AAEa,MAAA,UAAA,GAAa,CACxB,WACoB,KAAA;;;;"}
@@ -0,0 +1,27 @@
1
+ "use client"
2
+ /* */
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import * as Aria from 'react-aria-components';
5
+ import { Children, isValidElement } from 'react';
6
+
7
+ const ReactAriaControlledValueFix = (props) => {
8
+ const { inputContext: context, children, props: originalInputProps } = props;
9
+ const child = Children.only(children);
10
+ if (!isValidElement(child)) {
11
+ throw new Error("Expected valid element");
12
+ }
13
+ const inputProps = child.props;
14
+ const inputRef = inputProps["ref"];
15
+ const [contextProps, contextRef] = Aria.useContextProps(
16
+ inputProps,
17
+ inputRef,
18
+ context
19
+ );
20
+ if (originalInputProps && typeof originalInputProps === "object" && !("value" in originalInputProps)) {
21
+ delete contextProps["value"];
22
+ }
23
+ return /* @__PURE__ */ jsx(Aria.Provider, { values: [[context, { ...contextProps, ref: contextRef }]], children: child });
24
+ };
25
+
26
+ export { ReactAriaControlledValueFix };
27
+ //# sourceMappingURL=ReactAriaControlledValueFix.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactAriaControlledValueFix.mjs","sources":["../../../../../../src/lib/react/ReactAriaControlledValueFix.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport {\n Children,\n isValidElement,\n type Context,\n type FC,\n type ForwardedRef,\n type PropsWithChildren,\n} from \"react\";\n\nexport interface ReactAriaControlledValueFixProps extends PropsWithChildren {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n inputContext: Context<any>;\n props: unknown;\n}\n\ninterface ChildProps {\n [key: string]: unknown;\n ref: ForwardedRef<Element>;\n}\n\n/**\n * React Aria (accidentally?!) enforces controlled inputs by always setting the\n * value prop on Inputs and TextAreas. This component uses React Arias context\n * prop API to only set the value prop, if it is present in the original\n * Input/TextArea component.\n *\n * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/textfield/src/useTextField.ts#L182\n * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/numberfield/src/useNumberField.ts#L206\n */\nexport const ReactAriaControlledValueFix: FC<\n ReactAriaControlledValueFixProps\n> = (props) => {\n const { inputContext: context, children, props: originalInputProps } = props;\n\n const child = Children.only(children);\n if (!isValidElement<ChildProps>(child)) {\n throw new Error(\"Expected valid element\");\n }\n\n const inputProps = child.props;\n const inputRef = inputProps[\"ref\"];\n\n const [contextProps, contextRef] = Aria.useContextProps(\n inputProps,\n inputRef,\n context,\n );\n\n // Here does the workaround his job\n if (\n originalInputProps &&\n typeof originalInputProps === \"object\" &&\n !(\"value\" in originalInputProps)\n ) {\n delete contextProps[\"value\"];\n }\n\n return (\n <Aria.Provider values={[[context, { ...contextProps, ref: contextRef }]]}>\n {child}\n </Aria.Provider>\n );\n};\n"],"names":[],"mappings":";;;;AA8Ba,MAAA,2BAAA,GAET,CAAC,KAAU,KAAA;AACb,EAAA,MAAM,EAAE,YAAc,EAAA,OAAA,EAAS,QAAU,EAAA,KAAA,EAAO,oBAAuB,GAAA,KAAA;AAEvE,EAAM,MAAA,KAAA,GAAQ,QAAS,CAAA,IAAA,CAAK,QAAQ,CAAA;AACpC,EAAI,IAAA,CAAC,cAA2B,CAAA,KAAK,CAAG,EAAA;AACtC,IAAM,MAAA,IAAI,MAAM,wBAAwB,CAAA;AAAA;AAG1C,EAAA,MAAM,aAAa,KAAM,CAAA,KAAA;AACzB,EAAM,MAAA,QAAA,GAAW,WAAW,KAAK,CAAA;AAEjC,EAAA,MAAM,CAAC,YAAA,EAAc,UAAU,CAAA,GAAI,IAAK,CAAA,eAAA;AAAA,IACtC,UAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACF;AAGA,EAAA,IACE,sBACA,OAAO,kBAAA,KAAuB,QAC9B,IAAA,EAAE,WAAW,kBACb,CAAA,EAAA;AACA,IAAA,OAAO,aAAa,OAAO,CAAA;AAAA;AAG7B,EAAA,2BACG,IAAK,CAAA,QAAA,EAAL,EAAc,MAAA,EAAQ,CAAC,CAAC,OAAA,EAAS,EAAE,GAAG,cAAc,GAAK,EAAA,UAAA,EAAY,CAAC,GACpE,QACH,EAAA,KAAA,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren, default as React } 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 NumberFieldProps extends PropsWithChildren<Omit<Aria.NumberFieldProps, "children">>, FlowComponentProps<HTMLInputElement> {
@@ -7,6 +7,6 @@ export interface NumberFieldProps extends PropsWithChildren<Omit<Aria.NumberFiel
7
7
  * @flr-generate all
8
8
  * @flr-clear-props-context
9
9
  */
10
- export declare const NumberField: React.FunctionComponent<NumberFieldProps & React.RefAttributes<HTMLInputElement>>;
10
+ export declare const NumberField: import('react').FunctionComponent<NumberFieldProps & import('react').RefAttributes<HTMLInputElement>>;
11
11
  export default NumberField;
12
12
  //# sourceMappingURL=NumberField.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NumberField.d.ts","sourceRoot":"","sources":["../../../../src/components/NumberField/NumberField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAe9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG/E,MAAM,WAAW,gBACf,SAAQ,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC,EAChE,kBAAkB,CAAC,gBAAgB,CAAC;CAAG;AAE3C;;;GAGG;AACH,eAAO,MAAM,WAAW,mFAuDtB,CAAC;AAEH,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"NumberField.d.ts","sourceRoot":"","sources":["../../../../src/components/NumberField/NumberField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAe9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAI/E,MAAM,WAAW,gBACf,SAAQ,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC,EAChE,kBAAkB,CAAC,gBAAgB,CAAC;CAAG;AAE3C;;;GAGG;AACH,eAAO,MAAM,WAAW,uGAuEtB,CAAC;AAEH,eAAe,WAAW,CAAC"}
@@ -1,4 +1,3 @@
1
- import { default as React } from 'react';
2
1
  import { TextFieldBaseProps } from '../TextFieldBase';
3
2
  import { FlowComponentProps } from '../../lib/componentFactory/flowComponent';
4
3
  import * as Aria from "react-aria-components";
@@ -13,6 +12,6 @@ export interface TextAreaProps extends Omit<TextFieldBaseProps, "input" | "ref">
13
12
  * @flr-generate all
14
13
  * @flr-clear-props-context
15
14
  */
16
- export declare const TextArea: React.FunctionComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
15
+ export declare const TextArea: import('react').FunctionComponent<TextAreaProps & import('react').RefAttributes<HTMLTextAreaElement>>;
17
16
  export default TextArea;
18
17
  //# sourceMappingURL=TextArea.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../../src/components/TextArea/TextArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAI/E,MAAM,WAAW,aACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,KAAK,CAAC,EAC/C,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,aAAa,GAAG,MAAM,CAAC,EAChD,kBAAkB,CAAC,mBAAmB,CAAC;IACzC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,mFA8CnB,CAAC;AAEH,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../../src/components/TextArea/TextArea.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAK/E,MAAM,WAAW,aACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,KAAK,CAAC,EAC/C,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,aAAa,GAAG,MAAM,CAAC,EAChD,kBAAkB,CAAC,mBAAmB,CAAC;IACzC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,uGAqDnB,CAAC;AAEH,eAAe,QAAQ,CAAC"}
@@ -1,4 +1,3 @@
1
- import { default as React } from 'react';
2
1
  import { TextFieldBaseProps } from '../TextFieldBase';
3
2
  import { FlowComponentProps } from '../../lib/componentFactory/flowComponent';
4
3
  import { PropsWithClassName } from '../../lib/types/props';
@@ -9,6 +8,6 @@ export interface TextFieldProps extends Omit<TextFieldBaseProps, "input" | "clas
9
8
  * @flr-generate all
10
9
  * @flr-clear-props-context
11
10
  */
12
- export declare const TextField: React.FunctionComponent<TextFieldProps & React.RefAttributes<HTMLInputElement>>;
11
+ export declare const TextField: import('react').FunctionComponent<TextFieldProps & import('react').RefAttributes<HTMLInputElement>>;
13
12
  export default TextField;
14
13
  //# sourceMappingURL=TextField.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,MAAM,WAAW,cACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,WAAW,CAAC,EACrD,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,GAAG,MAAM,CAAC,EAC7C,kBAAkB,EAClB,kBAAkB,CAAC,gBAAgB,CAAC;CAAG;AAE3C;;;GAGG;AACH,eAAO,MAAM,SAAS,iFAmBpB,CAAC;AAEH,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG5D,MAAM,WAAW,cACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,WAAW,CAAC,EACrD,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,GAAG,MAAM,CAAC,EAC7C,kBAAkB,EAClB,kBAAkB,CAAC,gBAAgB,CAAC;CAAG;AAE3C;;;GAGG;AACH,eAAO,MAAM,SAAS,qGAsBpB,CAAC;AAEH,eAAe,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SubmitButtonStateProvider.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/ActionGroupWrapper/SubmitButtonStateProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAMrE,UAAU,KAAM,SAAQ,iBAAiB;IACvC,aAAa,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;CAC1C;AA4BD,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,KAAK,CAQ/C,CAAC"}
1
+ {"version":3,"file":"SubmitButtonStateProvider.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/ActionGroupWrapper/SubmitButtonStateProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAKrE,UAAU,KAAM,SAAQ,iBAAiB;IACvC,aAAa,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;CAC1C;AA4CD,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,KAAK,CAQ/C,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { ControllerProps, FieldValues, UseFormReturn } from 'react-hook-form';
3
- export interface FieldProps<T extends FieldValues> extends Omit<ControllerProps<T>, "render">, PropsWithChildren {
3
+ export interface FieldProps<T extends FieldValues> extends Omit<ControllerProps<T>, "render" | "control">, PropsWithChildren {
4
4
  }
5
5
  export declare function Field<T extends FieldValues>(props: FieldProps<T>): import("react/jsx-runtime").JSX.Element;
6
- export declare const typedField: <T extends FieldValues>(ignoredForm: UseFormReturn<T>) => typeof Field<T>;
6
+ export declare const typedField: <T extends FieldValues>(ignoredForm: UseFormReturn<T> | UseFormReturn<T>["control"]) => typeof Field<T>;
7
7
  //# sourceMappingURL=Field.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/Field/Field.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,aAAa,EACd,MAAM,iBAAiB,CAAC;AAGzB,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,WAAW,CAC/C,SAAQ,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EACxC,iBAAiB;CAAG;AAExB,wBAAgB,KAAK,CAAC,CAAC,SAAS,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,2CAoFhE;AAED,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,WAAW,EAC9C,aAAa,aAAa,CAAC,CAAC,CAAC,KAC5B,OAAO,KAAK,CAAC,CAAC,CAAU,CAAC"}
1
+ {"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/Field/Field.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,aAAa,EACnB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,WAAW,CAC/C,SAAQ,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC,EACpD,iBAAiB;CAAG;AAExB,wBAAgB,KAAK,CAAC,CAAC,SAAS,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,2CAqFhE;AAED,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,WAAW,EAC9C,aAAa,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAC1D,OAAO,KAAK,CAAC,CAAC,CAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Select.stories.d.ts","sourceRoot":"","sources":["../../../../../../../src/integrations/react-hook-form/components/Field/stories/Select.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAKvD,OAAO,EAAE,KAAK,EAAoB,MAAM,gCAAgC,CAAC;AAUzE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,KAAK,CAiE5B,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC;AAEpC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
1
+ {"version":3,"file":"Select.stories.d.ts","sourceRoot":"","sources":["../../../../../../../src/integrations/react-hook-form/components/Field/stories/Select.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAIvD,OAAO,EAAE,KAAK,EAAoB,MAAM,gCAAgC,CAAC;AAUzE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,KAAK,CA0E5B,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC;AAEpC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.stories.d.ts","sourceRoot":"","sources":["../../../../../../../src/integrations/react-hook-form/components/Field/stories/TextField.stories.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAoB,MAAM,gCAAgC,CAAC;AAGzE,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAKvD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,KAAK,CAgE5B,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC;AAEpC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,oBAAoB,EAAE,KAsClC,CAAC"}
1
+ {"version":3,"file":"TextField.stories.d.ts","sourceRoot":"","sources":["../../../../../../../src/integrations/react-hook-form/components/Field/stories/TextField.stories.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAoB,MAAM,gCAAgC,CAAC;AAGzE,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAKvD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,KAAK,CAyE5B,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC;AAEpC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,oBAAoB,EAAE,KAsClC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Form.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Form.test.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/Form/Form.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { Context, FC, PropsWithChildren } from 'react';
2
+ export interface ReactAriaControlledValueFixProps extends PropsWithChildren {
3
+ inputContext: Context<any>;
4
+ props: unknown;
5
+ }
6
+ /**
7
+ * React Aria (accidentally?!) enforces controlled inputs by always setting the
8
+ * value prop on Inputs and TextAreas. This component uses React Arias context
9
+ * prop API to only set the value prop, if it is present in the original
10
+ * Input/TextArea component.
11
+ *
12
+ * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/textfield/src/useTextField.ts#L182
13
+ * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/numberfield/src/useNumberField.ts#L206
14
+ */
15
+ export declare const ReactAriaControlledValueFix: FC<ReactAriaControlledValueFixProps>;
16
+ //# sourceMappingURL=ReactAriaControlledValueFix.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactAriaControlledValueFix.d.ts","sourceRoot":"","sources":["../../../../src/lib/react/ReactAriaControlledValueFix.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,OAAO,EACZ,KAAK,EAAE,EAEP,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAC;AAEf,MAAM,WAAW,gCAAiC,SAAQ,iBAAiB;IAEzE,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,KAAK,EAAE,OAAO,CAAC;CAChB;AAOD;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,EAAE,EAAE,CAC1C,gCAAgC,CAgCjC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ReactAriaControlledValueFix.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactAriaControlledValueFix.test.d.ts","sourceRoot":"","sources":["../../../../src/lib/react/ReactAriaControlledValueFix.test.tsx"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/flow-react-components",
3
- "version": "0.2.0-alpha.187",
3
+ "version": "0.2.0-alpha.188",
4
4
  "type": "module",
5
5
  "description": "A React implementation of Flow, mittwald’s design system",
6
6
  "homepage": "https://mittwald.github.io/flow",
@@ -53,7 +53,7 @@
53
53
  "dependencies": {
54
54
  "@chakra-ui/live-region": "^2.1.0",
55
55
  "@internationalized/string-compiler": "^3.2.6",
56
- "@mittwald/react-tunnel": "0.2.0-alpha.187",
56
+ "@mittwald/react-tunnel": "0.2.0-alpha.188",
57
57
  "@mittwald/react-use-promise": "^3.0.4",
58
58
  "@react-aria/form": "^3.0.14",
59
59
  "@react-aria/utils": "^3.28.1",
@@ -92,7 +92,7 @@
92
92
  "devDependencies": {
93
93
  "@faker-js/faker": "^9.6.0",
94
94
  "@internationalized/date": "^3.7.0",
95
- "@mittwald/flow-design-tokens": "0.2.0-alpha.187",
95
+ "@mittwald/flow-design-tokens": "0.2.0-alpha.188",
96
96
  "@mittwald/react-use-promise": "^2.6.0",
97
97
  "@mittwald/remote-dom-react": "1.2.2-mittwald.3",
98
98
  "@mittwald/typescript-config": "",
@@ -173,5 +173,5 @@
173
173
  "optional": true
174
174
  }
175
175
  },
176
- "gitHead": "bf723899648ba469d1ee6204b6015c8fa33c0e64"
176
+ "gitHead": "a379b6e19e297e82fb50d6eef262de77526ba305"
177
177
  }