@iress-oss/ids-mcp-server 6.0.0-alpha.3 → 6.0.0-alpha.4

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.
@@ -46,11 +46,12 @@ import {
46
46
  } from '@/main';
47
47
  import { IressCheckboxGroup } from '../CheckboxGroup';
48
48
  import { toArray } from '../../../helpers/formatting/toArray';
49
+ import { useWatch } from 'react-hook-form';
49
50
  interface FieldValues {
50
51
  'let-them-eat-cake'?: FormControlValue\[\];
51
52
  }
52
53
  const SelectedValues \= () \=> {
53
- const value \= IressForm.useWatch<FieldValues\>({ name: 'let-them-eat-cake' });
54
+ const value \= useWatch<FieldValues\>({ name: 'let-them-eat-cake' });
54
55
  const valueString \= toArray(value).join(', ');
55
56
  return (
56
57
  <IressPanel\>
@@ -1,7 +1,7 @@
1
1
  Iress Design System
2
2
  ===================
3
3
 
4
- 6.0.0-alpha.3
4
+ 6.0.0-alpha.4
5
5
 
6
6
  The Iress Design System (IDS) serves as a shared visual language, working code, design tools and resources, human interface guidelines, and a community. It supports designers and developers building digital products for both B2B (Financial Advisors, Paraplanners) and B2B2C (client customers) segments.
7
7
 
@@ -10,7 +10,7 @@ Use the `IressForm` component when you want to request, validate and process dat
10
10
 
11
11
  Hide codedrawOpen in CodeSandbox
12
12
 
13
- <ForwardedForm
13
+ <IressForm
14
14
  actions\={<IressButton mode\="primary" type\="submit"\>Submit</IressButton\>}
15
15
  pattern\="short"
16
16
  \>
@@ -42,7 +42,7 @@ Hide codedrawOpen in CodeSandbox
42
42
  required: 'Email is required'
43
43
  }}
44
44
  />
45
- </ForwardedForm\>
45
+ </IressForm\>
46
46
 
47
47
  ```
48
48
 
@@ -80,10 +80,19 @@ string
80
80
  | \- | short |
81
81
  | Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
82
82
 
83
+ Installation
84
+ ------------
85
+
86
+ As of version 6, `react-hook-form` has been moved to a peer dependency. You will need to install it alongside `@iress-oss/ids-components` in order to use the `IressForm` or `IressHookForm` component.
87
+
88
+ yarn add @iress-oss/ids-components react-hook-form
89
+
90
+ ```
91
+
83
92
  Key concepts
84
93
  ------------
85
94
 
86
- As of version 5, `IressForm` is built on top of [React Hook Forms](https://react-hook-form.com/). This provides you the power of React Hook Forms with the convenience of IDS form components. However, there are some key differences to be aware of as it may affect how you build your forms.
95
+ `IressForm` is built on top of [React Hook Forms](https://react-hook-form.com/). This provides you the power of React Hook Forms with the convenience of IDS form components. However, there are some key differences to be aware of as it may affect how you build your forms.
87
96
 
88
97
  ### State management
89
98
 
@@ -91,8 +100,8 @@ As of version 5, `IressForm` is built on top of [React Hook Forms](https://react
91
100
 
92
101
  Due to this change, there are a few things you should consider during development:
93
102
 
94
- * Avoid using the `useState` hook to manage form state. Instead, use the `IressForm.useForm` hook or the `ref` of the `IressForm` component to interact with the form state. The initial value of the form can be set using the `defaultValues` prop, but from then on you should be using either the hook or ref to interact with the form state.
95
- * Avoid using `onChange` handlers on form fields to react to form values. Instead, use the `IressForm.useWatch` hook to watch the value of a field and conditionally render fields based on the value of another field.
103
+ * Avoid using the `useState` hook to manage form state. Instead, use the `useFormContext()` hook from `react-hook-form` or the `ref` of the `IressForm` component to interact with the form state. The initial value of the form can be set using the `defaultValues` prop, but from then on you should be using either the hook or ref to interact with the form state.
104
+ * Avoid using `onChange` handlers on form fields to react to form values. Instead, use the `useWatch` hook from `react-hook-form` to watch the value of a field and conditionally render fields based on the value of another field.
96
105
 
97
106
  See below an example comparing a version 4 and version 5 `IressForm` when managing form state.
98
107
 
@@ -104,7 +113,7 @@ Old
104
113
 
105
114
  New
106
115
 
107
- <table class="css-1n5o7vh-diff-container"><tbody><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text">import { IressForm, IressField, IressInput, IressCheckboxGroup, IressCheckbox } from '@iress/components';</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text">import { IressForm, IressFormField, IressInput, IressCheckboxGroup, IressCheckbox } from '@iress-oss/ids-components';</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-10regm7-empty-line"><pre></pre></td><td class="css-vl0irh-content css-10regm7-empty-line"><pre class="css-o1u8iu-content-text"></pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-10regm7-empty-line"><pre></pre></td><td class="css-vl0irh-content css-10regm7-empty-line"><pre class="css-o1u8iu-content-text"></pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text">export const App = () =&gt; {</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text">const ConditionalFields = () =&gt; {</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> // We need to create our own state to manage the visibility of the fields, </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> // Instead of creating our own state, we can now use the form state via the useWatch hook, </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> // which means we have two sources of truth potentially making our code harder to maintain</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> // meaning we still have a single source of truth</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> const [show, setShow] = useState(['name']);</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> const show = IressForm.useWatch({ name: 'show'});</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-10regm7-empty-line"><pre></pre></td><td class="css-vl0irh-content css-10regm7-empty-line"><pre class="css-o1u8iu-content-text"></pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text"> return (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressForm&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressField label="Show fields"&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;IressFormField </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressCheckboxGroup value={show} onChange={(newValues) =&gt; setShow(newValues)}&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> label="Show fields" </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> name="show"</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> render={(controlledProps) =&gt; (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;IressCheckboxGroup {...controlledProps}&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text"> &lt;IressCheckbox value="name"&gt;Name&lt;/IressCheckbox&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text"> &lt;IressCheckbox value="email"&gt;Email&lt;/IressCheckbox&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text"> &lt;/IressCheckboxGroup&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;/IressField&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> )}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> {show.includes('name') &amp;&amp; (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> /&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressField label="Name"&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> {show?.includes('name') &amp;&amp; (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressInput name="name" /&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;IressFormField </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;/IressField&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> label="Name" </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> )}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> name="name"</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> {show.includes('email') &amp;&amp; (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> render={(controlledProps) =&gt; &lt;IressInput {...controlledProps} /&gt;}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressField label="Email"&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> /&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressInput name="email" type="email" /&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> )}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;/IressField&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> {show?.includes('email') &amp;&amp; (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> )}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;IressFormField </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;/IressForm&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> label="Email" </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> name="email"</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> render={(controlledProps) =&gt; &lt;IressInput {...controlledProps} type="email" /&gt;}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> /&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> )}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;/&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text"> );</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text">};</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-10regm7-empty-line css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-10regm7-empty-line css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"></pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text">export const App = () =&gt; (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;IressForm defaultValues={{ show: ['name'] }}&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;ConditionalFields /&gt; </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;/IressForm&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text">);</pre></td></tr></tbody></table>
116
+ <table class="css-1n5o7vh-diff-container"><tbody><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text">import { IressForm, IressField, IressInput, IressCheckboxGroup, IressCheckbox } from '@iress/components';</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text">import { IressForm, IressFormField, IressInput, IressCheckboxGroup, IressCheckbox } from '@iress-oss/ids-components';</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text">import { useWatch } from 'react-hook-form';</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text">export const App = () =&gt; {</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> // We need to create our own state to manage the visibility of the fields, </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text">const ConditionalFields = () =&gt; {</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> // which means we have two sources of truth potentially making our code harder to maintain</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> // Instead of creating our own state, we can now use the form state via the useWatch hook, </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> const [show, setShow] = useState(['name']);</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> // meaning we still have a single source of truth</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> const show = useWatch({ name: 'show'});</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text"> return (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressForm&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressField label="Show fields"&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;IressFormField </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressCheckboxGroup value={show} onChange={(newValues) =&gt; setShow(newValues)}&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> label="Show fields" </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> name="show"</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> render={(controlledProps) =&gt; (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;IressCheckboxGroup {...controlledProps}&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text"> &lt;IressCheckbox value="name"&gt;Name&lt;/IressCheckbox&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text"> &lt;IressCheckbox value="email"&gt;Email&lt;/IressCheckbox&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text"> &lt;/IressCheckboxGroup&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;/IressField&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> )}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> {show.includes('name') &amp;&amp; (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> /&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressField label="Name"&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> {show?.includes('name') &amp;&amp; (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressInput name="name" /&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;IressFormField </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;/IressField&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> label="Name" </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> )}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> name="name"</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> {show.includes('email') &amp;&amp; (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> render={(controlledProps) =&gt; &lt;IressInput {...controlledProps} /&gt;}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressField label="Email"&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> /&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressInput name="email" type="email" /&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> )}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;/IressField&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> {show?.includes('email') &amp;&amp; (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> )}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;IressFormField </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;/IressForm&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> label="Email" </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> name="email"</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> render={(controlledProps) =&gt; &lt;IressInput {...controlledProps} type="email" /&gt;}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> /&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> )}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;/&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text"> );</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text">};</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-10regm7-empty-line css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-10regm7-empty-line css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"></pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text">export const App = () =&gt; (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;IressForm defaultValues={{ show: ['name'] }}&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;ConditionalFields /&gt; </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;/IressForm&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text">);</pre></td></tr></tbody></table>
108
117
 
109
118
  Hide codedrawOpen in CodeSandbox
110
119
 
@@ -114,8 +123,9 @@ export const App = () => {
114
123
  // We need to create our own state to manage the visibility of the fields, // which means we have two sources of truth potentially making our code harder to maintain const \[show, setShow\] = useState(\['name'\]);
115
124
  return ( <IressForm> <IressField label="Show fields"> <IressCheckboxGroup value={show} onChange={(newValues) => setShow(newValues)}> <IressCheckbox value="name">Name</IressCheckbox> <IressCheckbox value="email">Email</IressCheckbox> </IressCheckboxGroup> </IressField> {show.includes('name') && ( <IressField label="Name"> <IressInput name="name" /> </IressField> )} {show.includes('email') && ( <IressField label="Email"> <IressInput name="email" type="email" /> </IressField> )} </IressForm> );
116
125
  };\`} newValue\={\`import { IressForm, IressFormField, IressInput, IressCheckboxGroup, IressCheckbox } from '@iress-oss/ids-components';
126
+ import { useWatch } from 'react-hook-form';
117
127
  const ConditionalFields = () => {
118
- // Instead of creating our own state, we can now use the form state via the useWatch hook, // meaning we still have a single source of truth const show = IressForm.useWatch({ name: 'show'});
128
+ // Instead of creating our own state, we can now use the form state via the useWatch hook, // meaning we still have a single source of truth const show = useWatch({ name: 'show'});
119
129
  return ( <> <IressFormField label="Show fields" name="show" render={(controlledProps) => ( <IressCheckboxGroup {...controlledProps}> <IressCheckbox value="name">Name</IressCheckbox> <IressCheckbox value="email">Email</IressCheckbox> </IressCheckboxGroup> )} /> {show?.includes('name') && ( <IressFormField label="Name" name="name" render={(controlledProps) => <IressInput {...controlledProps} />} /> )} {show?.includes('email') && ( <IressFormField label="Email" name="email" render={(controlledProps) => <IressInput {...controlledProps} type="email" />} /> )} </> );
120
130
  };
121
131
  export const App = () => (
@@ -213,7 +223,7 @@ array
213
223
 
214
224
  For most scenarios, you should use the `onSubmit` event to sync the form data with other state management systems (eg. server, browser storage or state management libraries such as Redux). This event is emitted when the form passes validation, and contains a map of the field names and the data entered by the user.
215
225
 
216
- For more complex scenarios, you may need to sync a field value before the form is submitted. In this case, you can use the `IressForm.useWatch` hook to watch the value of a field and sync it with your state.
226
+ For more complex scenarios, you may need to sync a field value before the form is submitted. In this case, you can use the `useWatch` hook to watch the value of a field and sync it with your state.
217
227
 
218
228
  Consider the following for your development:
219
229
 
@@ -277,7 +287,7 @@ Here are some examples of how to use `IressFormField` with different form contro
277
287
 
278
288
  Hide codedrawOpen in CodeSandbox
279
289
 
280
- <ForwardedForm
290
+ <IressForm
281
291
  actions\={<IressButton mode\="primary" type\="submit"\>Submit</IressButton\>}
282
292
  heading\="All supported form fields"
283
293
  pattern\="long"
@@ -368,7 +378,7 @@ Hide codedrawOpen in CodeSandbox
368
378
  required: true
369
379
  }}
370
380
  />
371
- </ForwardedForm\>
381
+ </IressForm\>
372
382
 
373
383
  ```
374
384
 
@@ -424,7 +434,7 @@ A boolean which, if `true`, indicates that the input must have a value before th
424
434
 
425
435
  Hide codedrawOpen in CodeSandbox
426
436
 
427
- <ForwardedForm\>
437
+ <IressForm\>
428
438
  <IressFormField
429
439
  hint\=""
430
440
  label\="Default message"
@@ -448,7 +458,7 @@ Hide codedrawOpen in CodeSandbox
448
458
  type\="submit"
449
459
  \>
450
460
  Validate </IressButton\>
451
- </ForwardedForm\>
461
+ </IressForm\>
452
462
 
453
463
  ```
454
464
 
@@ -471,7 +481,7 @@ The maximum character length of the value to accept for this input.
471
481
 
472
482
  Hide codedrawOpen in CodeSandbox
473
483
 
474
- <ForwardedForm\>
484
+ <IressForm\>
475
485
  <IressFormField
476
486
  hint\="Enter a maximum length of 5 characters"
477
487
  label\="Default message"
@@ -498,7 +508,7 @@ Hide codedrawOpen in CodeSandbox
498
508
  type\="submit"
499
509
  \>
500
510
  Validate </IressButton\>
501
- </ForwardedForm\>
511
+ </IressForm\>
502
512
 
503
513
  ```
504
514
 
@@ -521,7 +531,7 @@ The minimum character length of the value to accept for this input.
521
531
 
522
532
  Hide codedrawOpen in CodeSandbox
523
533
 
524
- <ForwardedForm\>
534
+ <IressForm\>
525
535
  <IressFormField
526
536
  hint\="Enter a minimum length of 7 characters"
527
537
  label\="Default message"
@@ -548,7 +558,7 @@ Hide codedrawOpen in CodeSandbox
548
558
  type\="submit"
549
559
  \>
550
560
  Validate </IressButton\>
551
- </ForwardedForm\>
561
+ </IressForm\>
552
562
 
553
563
  ```
554
564
 
@@ -570,7 +580,7 @@ The maximum number to accept for this input.
570
580
 
571
581
  Hide codedrawOpen in CodeSandbox
572
582
 
573
- <ForwardedForm\>
583
+ <IressForm\>
574
584
  <IressFormField
575
585
  hint\="Select a maximum of 2"
576
586
  label\="Default message"
@@ -597,7 +607,7 @@ Hide codedrawOpen in CodeSandbox
597
607
  type\="submit"
598
608
  \>
599
609
  Validate </IressButton\>
600
- </ForwardedForm\>
610
+ </IressForm\>
601
611
 
602
612
  ```
603
613
 
@@ -619,7 +629,7 @@ The minimum number to accept for this input.
619
629
 
620
630
  Hide codedrawOpen in CodeSandbox
621
631
 
622
- <ForwardedForm\>
632
+ <IressForm\>
623
633
  <IressFormField
624
634
  hint\="Select a minimum of 20"
625
635
  label\="Default message"
@@ -646,7 +656,7 @@ Hide codedrawOpen in CodeSandbox
646
656
  type\="submit"
647
657
  \>
648
658
  Validate </IressButton\>
649
- </ForwardedForm\>
659
+ </IressForm\>
650
660
 
651
661
  ```
652
662
 
@@ -668,7 +678,7 @@ The accepted regex pattern for the input.
668
678
 
669
679
  Hide codedrawOpen in CodeSandbox
670
680
 
671
- <ForwardedForm\>
681
+ <IressForm\>
672
682
  <IressFormField
673
683
  hint\="Enter a valid email address"
674
684
  label\="Default message"
@@ -690,7 +700,7 @@ Hide codedrawOpen in CodeSandbox
690
700
  type\="submit"
691
701
  \>
692
702
  Validate </IressButton\>
693
- </ForwardedForm\>
703
+ </IressForm\>
694
704
 
695
705
  ```
696
706
 
@@ -792,7 +802,7 @@ Ensures the input is a valid email address.
792
802
 
793
803
  Hide codedrawOpen in CodeSandbox
794
804
 
795
- <ForwardedForm\>
805
+ <IressForm\>
796
806
  <IressFormField
797
807
  hint\="Enter an email address"
798
808
  label\="Default message"
@@ -816,7 +826,7 @@ Hide codedrawOpen in CodeSandbox
816
826
  type\="submit"
817
827
  \>
818
828
  Validate </IressButton\>
819
- </ForwardedForm\>
829
+ </IressForm\>
820
830
 
821
831
  ```
822
832
 
@@ -842,7 +852,7 @@ You can pass a callback function as the argument to validate, or you can pass an
842
852
 
843
853
  Hide codedrawOpen in CodeSandbox
844
854
 
845
- <ForwardedForm\>
855
+ <IressForm\>
846
856
  <IressFormFieldset
847
857
  hint\="If checkbox, click two items to pass. Anything else, make sure it is Google."
848
858
  label\="Default message"
@@ -882,7 +892,7 @@ Hide codedrawOpen in CodeSandbox
882
892
  type\="submit"
883
893
  \>
884
894
  Validate </IressButton\>
885
- </ForwardedForm\>
895
+ </IressForm\>
886
896
 
887
897
  ```
888
898
 
@@ -1030,7 +1040,7 @@ You can set the `defaultValues` prop to pre-fill the form values.
1030
1040
 
1031
1041
  Hide codedrawOpen in CodeSandbox
1032
1042
 
1033
- <ForwardedForm
1043
+ <IressForm
1034
1044
  actions\={<IressButton mode\="primary" type\="submit"\>Submit</IressButton\>}
1035
1045
  defaultValues\={{
1036
1046
  email: 'luke.skywalker@iress.com',
@@ -1066,7 +1076,7 @@ Hide codedrawOpen in CodeSandbox
1066
1076
  required: 'Email is required'
1067
1077
  }}
1068
1078
  />
1069
- </ForwardedForm\>
1079
+ </IressForm\>
1070
1080
 
1071
1081
  ```
1072
1082
 
@@ -1981,7 +1991,7 @@ Hide codedrawOpen in CodeSandbox
1981
1991
  <p\>
1982
1992
  Try hitting submit to see that only email is being validated </p\>
1983
1993
  </IressText\>
1984
- <ForwardedForm
1994
+ <IressForm
1985
1995
  actions\={<IressButton mode\="primary" type\="submit"\>Submit</IressButton\>}
1986
1996
  pattern\="short"
1987
1997
  \>
@@ -2006,7 +2016,7 @@ Hide codedrawOpen in CodeSandbox
2006
2016
  required: 'Email is required'
2007
2017
  }}
2008
2018
  />
2009
- </ForwardedForm\>
2019
+ </IressForm\>
2010
2020
  </IressStack\>
2011
2021
 
2012
2022
  ```
@@ -2070,6 +2080,7 @@ import {
2070
2080
  IressPanel,
2071
2081
  IressText,
2072
2082
  } from '@/main';
2083
+ import { useForm } from 'react-hook-form';
2073
2084
  interface FieldValues {
2074
2085
  firstName: string;
2075
2086
  lastName: string;
@@ -2080,8 +2091,9 @@ interface FieldValues {
2080
2091
  export const HookFormExample \= () \=> {
2081
2092
  const initialInsuredAtPolicyLevel \= false;
2082
2093
  const initialSumInsured \= 5000;
2083
- const form \= IressHookForm.useForm<FieldValues\>();
2094
+ const form \= useForm<FieldValues\>();
2084
2095
  const { watch, control } \= form;
2096
+ // eslint-disable-next-line react-hooks/incompatible-library
2085
2097
  const firstName \= watch('firstName');
2086
2098
  const lastName \= watch('lastName');
2087
2099
  const insuredAtPolicyLevel \= watch('insuredAtPolicyLevel');
@@ -2225,7 +2237,7 @@ boolean
2225
2237
 
2226
2238
  Hide codedrawOpen in CodeSandbox
2227
2239
 
2228
- <ForwardedForm
2240
+ <IressForm
2229
2241
  actions\={<IressButton mode\="primary" type\="submit"\>Submit</IressButton\>}
2230
2242
  alert\={<IressFormValidationSummary />}
2231
2243
  heading\="Try hitting submit to see the validation summary"
@@ -2317,7 +2329,7 @@ Hide codedrawOpen in CodeSandbox
2317
2329
  required: true
2318
2330
  }}
2319
2331
  />
2320
- </ForwardedForm\>
2332
+ </IressForm\>
2321
2333
 
2322
2334
  ```
2323
2335
 
@@ -2465,7 +2477,7 @@ When resetting fields that accept non-string values (like `IressRichSelect`), yo
2465
2477
 
2466
2478
  **Problem:**
2467
2479
 
2468
- const { resetField } \= IressForm.useFormContext();
2480
+ const { resetField } \= useFormContext();
2469
2481
  resetField('rich-select', {
2470
2482
  label: '',
2471
2483
  value: '',
@@ -2477,17 +2489,9 @@ In this case, it will look like it cleared the field, but actually it has not. T
2477
2489
 
2478
2490
  **Solution:** Override the `onChange` handler to pass the actual value as a second parameter:
2479
2491
 
2480
- const { resetField } \= IressForm.useFormContext();
2492
+ const { resetField } \= useFormContext();
2481
2493
  resetField('rich-select', null); // or undefined
2482
2494
 
2483
2495
  ```
2484
2496
 
2485
2497
  This will properly reset the field to null and clear the field value.
2486
-
2487
- ### Conflicting versions of React Hook Forms
2488
-
2489
- If you are using React Hook Forms in your application, please ensure it is the same version IDS uses, otherwise there will be conflicts.
2490
-
2491
- The version we are using in IDS is:
2492
-
2493
- yarn add react-hook-form@7.55.0
@@ -672,7 +672,12 @@ import {
672
672
  IressCloseButton,
673
673
  IressHookForm,
674
674
  } from '@/main';
675
- import { type Control, type UseFormGetValues } from 'react-hook-form';
675
+ import {
676
+ useFieldArray,
677
+ useForm,
678
+ type Control,
679
+ type UseFormGetValues,
680
+ } from 'react-hook-form';
676
681
  interface Client {
677
682
  name: string | undefined;
678
683
  salary: number | undefined;
@@ -796,12 +801,12 @@ const DependantSection: React.FC<DependantProps\> \= ({
796
801
  );
797
802
  };
798
803
  export const FormGroups \= () \=> {
799
- const form \= IressHookForm.useForm<FormValues\>({
804
+ const form \= useForm<FormValues\>({
800
805
  defaultValues: defaultValues,
801
806
  mode: 'onBlur',
802
807
  });
803
808
  const { control, getValues } \= form;
804
- const { fields, append, update, remove } \= IressHookForm.useFieldArray({
809
+ const { fields, append, update, remove } \= useFieldArray({
805
810
  name: 'dependants',
806
811
  control,
807
812
  });
@@ -968,10 +973,10 @@ array
968
973
  | \- | Choose option...nonesimplesupportedControlsreadOnly |
969
974
  | Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
970
975
 
971
- Conditional fields (useWatch)
972
- -----------------------------
976
+ Conditional fields (`useWatch`)
977
+ -------------------------------
973
978
 
974
- When you have fields that are conditionally shown, you can use the `IressForm.useWatch` hook to watch the value of another field and conditionally render the field.
979
+ When you have fields that are conditionally shown, you can use the `useWatch` hook to watch the value of another field and conditionally render the field.
975
980
 
976
981
  **Notes:**
977
982
 
@@ -982,7 +987,7 @@ When you have fields that are conditionally shown, you can use the `IressForm.us
982
987
  Conditional fields using `useWatch`
983
988
  -----------------------------------
984
989
 
985
- This example demonstrates how to use the `IressForm.useWatch()` hook to watch the value of a field and conditionally render other fields based on that value.
990
+ This example demonstrates how to use the `useWatch()` hook to watch the value of a field and conditionally render other fields based on that value.
986
991
 
987
992
  \*RequiredSelect fields to show
988
993
 
@@ -1003,6 +1008,7 @@ import {
1003
1008
  IressInput,
1004
1009
  IressText,
1005
1010
  } from '@/main';
1011
+ import { useWatch } from 'react-hook-form';
1006
1012
  interface FieldValues {
1007
1013
  show?: string\[\];
1008
1014
  name?: string;
@@ -1011,15 +1017,14 @@ interface FieldValues {
1011
1017
  /\*\*
1012
1018
  \* Conditional fields need to be rendered in a sub-component, to allow it to use the \`useWatch\` \* hook to watch the value of the field dictating the display of conditional fields. \*/
1013
1019
  const FormSectionWithConditionalFields \= () \=> {
1014
- const show \= IressForm.useWatch<FieldValues\>({ name: 'show' });
1020
+ const show \= useWatch<FieldValues\>({ name: 'show' });
1015
1021
  return (
1016
1022
  <IressText\>
1017
1023
  <h2\>
1018
1024
  Conditional fields using <code\>useWatch</code\>
1019
1025
  </h2\>
1020
1026
  <p\>
1021
- This example demonstrates how to use the{' '}
1022
- <code\>IressForm.useWatch()</code\> hook to watch the value of a field and conditionally render other fields based on that value. </p\>
1027
+ This example demonstrates how to use the <code\>useWatch()</code\> hook to watch the value of a field and conditionally render other fields based on that value. </p\>
1023
1028
  <IressFormField
1024
1029
  name\="show"
1025
1030
  label\="Select fields to show"
@@ -1115,14 +1120,14 @@ Hide codedrawOpen in CodeSandbox
1115
1120
 
1116
1121
  import {
1117
1122
  IressButton,
1118
- IressForm,
1119
1123
  IressFormField,
1120
1124
  IressHookForm,
1121
1125
  IressInput,
1122
1126
  IressStack,
1123
1127
  } from '@/main';
1128
+ import { useForm } from 'react-hook-form';
1124
1129
  export const HiddenInputsForm \= () \=> {
1125
- const form \= IressForm.useForm();
1130
+ const form \= useForm();
1126
1131
  const { register } \= form;
1127
1132
  // This is a hidden input field that the user cannot see or interact with.
1128
1133
  // This is the recommended way to handle hidden inputs in Iress forms.
@@ -1219,10 +1224,10 @@ import {
1219
1224
  IressButton,
1220
1225
  IressText,
1221
1226
  IressDivider,
1222
- IressForm,
1223
1227
  IressHookForm,
1224
1228
  } from '@/main';
1225
1229
  import { useState } from 'react';
1230
+ import { useForm } from 'react-hook-form';
1226
1231
  interface FormData {
1227
1232
  primaryField: string;
1228
1233
  dependentField: string;
@@ -1255,7 +1260,7 @@ const validateBudgetInput \= (
1255
1260
  };
1256
1261
  export const ValidationDependOnOtherFields \= () \=> {
1257
1262
  const \[submitted, setSubmitted\] \= useState<FormData | undefined\>(undefined);
1258
- const form \= IressForm.useForm<FormData\>({
1263
+ const form \= useForm<FormData\>({
1259
1264
  defaultValues: {
1260
1265
  primaryField: '',
1261
1266
  dependentField: '',
@@ -1,226 +1,4 @@
1
- CodeSandbox was updated!
1
+ Redirecting to CodeSandbox...
2
+ -----------------------------
2
3
 
3
- Sandbox
4
-
5
- [Drafts](https://codesandbox.io/dashboard/drafts)
6
-
7
- /
8
-
9
- dank-haze-jls882
10
-
11
- A
12
-
13
- VS CodeShare
14
-
15
- Sign In
16
-
17
- index.html - nodebox - CodeSandbox
18
-
19
- *
20
-
21
- *
22
-
23
- * 1
24
-
25
- *
26
-
27
- *
28
-
29
-
30
- *
31
-
32
- *
33
-
34
-
35
- Explorer
36
- --------
37
-
38
- *
39
-
40
-
41
- Drag a view here to display.
42
-
43
- ### Sandbox Info
44
-
45
- ### nodebox
46
-
47
- *
48
- *
49
- *
50
- *
51
- *
52
-
53
- index.html
54
-
55
- index.tsx
56
-
57
- package.json
58
-
59
- ### Dependencies
60
-
61
- react
62
-
63
- latest
64
-
65
- [
66
-
67
- ](https://www.npmjs.com/package/react)
68
-
69
- react-dom
70
-
71
- latest
72
-
73
- [
74
-
75
- ](https://www.npmjs.com/package/react-dom)
76
-
77
- @iress-oss/ids-components
78
-
79
- alpha
80
-
81
- [
82
-
83
- ](https://www.npmjs.com/package/@iress-oss/ids-components)
84
-
85
- ### Outline
86
-
87
- *
88
- *
89
-
90
-
91
- *
92
-
93
- Show All Commands
94
-
95
- Ctrl+Shift+P
96
-
97
- Go to File
98
-
99
- Ctrl+P
100
-
101
- Find in Files
102
-
103
- Ctrl+Shift+F
104
-
105
- Toggle Full Screen
106
-
107
- F11
108
-
109
- Show Settings
110
-
111
- Ctrl+,
112
-
113
- index.html
114
-
115
- *
116
-
117
- *
118
- *
119
- *
120
-
121
-
122
- index.html
123
-
124
- html
125
-
126
- 1
127
-
128
- 2
129
-
130
- 3
131
-
132
- 4
133
-
134
- 5
135
-
136
- 6
137
-
138
- 7
139
-
140
- 8
141
-
142
- 9
143
-
144
- <html\>
145
-
146
-   <head\>
147
-
148
-     <title\>Iress Design System</title\>
149
-
150
-   </head\>
151
-
152
-   <body\>
153
-
154
-     <div id\="root"\></div\>
155
-
156
-   </body\>
157
-
158
- </html\>
159
-
160
- Press desired key combination and then press ENTER.
161
-
162
- *
163
- *
164
-
165
- Show All Commands
166
-
167
- Ctrl+Shift+P
168
-
169
- Go to File
170
-
171
- Ctrl+P
172
-
173
- Find in Files
174
-
175
- Ctrl+Shift+F
176
-
177
- Toggle Full Screen
178
-
179
- F11
180
-
181
- Show Settings
182
-
183
- Ctrl+,
184
-
185
- Preview
186
-
187
- *
188
-
189
- *
190
- *
191
-
192
-
193
- [
194
-
195
- ](https://jls882.csb.app/)
196
-
197
- *
198
- *
199
-
200
- Drag a view here to display.
201
-
202
- *
203
-
204
- Drag a view here to display.
205
-
206
- CodeSandbox - Sandbox (Web)
207
-
208
- 0 0
209
-
210
- 1
211
-
212
- Prettier
213
-
214
- Layout: us
215
-
216
- html
217
-
218
- LF
219
-
220
- UTF-8
221
-
222
- Spaces: 2
223
-
224
- Ln 1, Col 1
225
-
226
- Open preview
4
+ [Click here to open CodeSandbox](https://codesandbox.io/api/v1/sandboxes/define?parameters=N4IgZglgNgpgziAXKCA7AJjAHgOgC5xZKgDGA9qnjJUiBALYAOZATngAQBKMAhiR2BZl67AOQte_UQG4AOqgbM2XSXgAiAeQCy7QcLES-eALTphAehJQI1PDPmLWHYOwCSEuHAAKPVDCgANG4e3kIAbhCYLOwAvrpCIqIAAhAhxmSe5pFwxuRMFLZw9gr5ysmp8DkZcFnoOXnMfpQ16BBweObtAJ6wOCSexfLm5uzw1pSmbTwARrDGflgm4zDshvzGEoLwABbmFFBdxthKJg0FzfLkqO3sAIKMjOwAvOwAFACUzwB87MDy7KsYHgAK4sVDsAA87kqPj8UHY0wA5k9ZCAeFA8KivtDPOw1PAIIjwQBlLrtGAiWH-CHmHHeXz-L5yVAxZnybhGTRaPqGKicMhkPCvMwkYH0Ww4RFAgCisHFlAAQl1XOhXuIBXZ3gBCd44CQYGAsV7_SEc_g4Yl4FgQfhaMiYL4mgFQkJecKRQ2O8EAn0Q-6Pcxen2Q2mu91RIMhs14C1Wm14O0OgLyd7MkABOhwBVoHgsLpIMDouAwGIZtCYXDbPD0KDEEBXKg0RAgCFVmuR1u8dCR514CB4WDYkJ4glE9ik8n0Gl9gcwDvmbZdjvTe1dHuQ1phdiRFEgISCrE0zfzlfoNfyGltqBe9OZ7OoXP5xCFqDF0sgRh8ADWPClOAAVnAFB1g2ti0H83qopgjDUJgqAkDYcCoogvxOuwqJrJiSDoSAUA8FQ7Sosm3oAhhqimMIyE4XhBFYcRwaoikaTVLU9TCI0hRUai6KMNsPCoiaMTyDEt5tPej4FkWJYxDEQA).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iress-oss/ids-mcp-server",
3
- "version": "6.0.0-alpha.3",
3
+ "version": "6.0.0-alpha.4",
4
4
  "description": "Model Context Protocol (MCP) server for Iress Design System (IDS) component library - provides AI assistants with contextual information about IDS components, design tokens, and usage patterns",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -45,19 +45,18 @@
45
45
  "@types/minimist": "1.2.5",
46
46
  "@types/node": "^24.10.1",
47
47
  "@types/turndown": "5.0.6",
48
- "@vitest/coverage-v8": "4.0.10",
48
+ "@vitest/coverage-v8": "4.0.13",
49
49
  "minimist": "1.2.8",
50
50
  "playwright": "1.56.1",
51
- "rimraf": "6.1.0",
51
+ "rimraf": "6.1.2",
52
52
  "tsx": "4.20.6",
53
53
  "turndown": "7.2.2",
54
54
  "turndown-plugin-gfm": "1.0.2",
55
55
  "typescript": "5.9.3",
56
- "vitest": "4.0.10"
56
+ "vitest": "4.0.13"
57
57
  },
58
58
  "repository": {
59
59
  "type": "git",
60
60
  "url": "https://github.com/iress/design-system"
61
- },
62
- "stableVersion": "6.0.0-alpha.2"
61
+ }
63
62
  }