@flowerforce/flower-react 3.5.1-beta.2 → 4.0.4-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +264 -207
  2. package/dist/index.cjs.js +219 -629
  3. package/dist/index.esm.js +189 -603
  4. package/dist/src/components/Flower.d.ts +7 -7
  5. package/dist/src/components/FlowerAction.d.ts +2 -3
  6. package/dist/src/components/FlowerComponent.d.ts +2 -4
  7. package/dist/src/components/FlowerFlow.d.ts +2 -3
  8. package/dist/src/components/FlowerNavigate/FlowerNavigate.d.ts +3 -0
  9. package/dist/src/components/FlowerNavigate/WrapperComponent.d.ts +3 -3
  10. package/dist/src/components/FlowerNavigate/index.d.ts +2 -4
  11. package/dist/src/components/FlowerNavigate/useFlowerNavigate.d.ts +1 -1
  12. package/dist/src/components/FlowerNode.d.ts +2 -3
  13. package/dist/src/components/FlowerRoute.d.ts +2 -3
  14. package/dist/src/components/FlowerServer.d.ts +2 -3
  15. package/dist/src/components/FlowerStart.d.ts +3 -4
  16. package/dist/src/components/index.d.ts +10 -0
  17. package/dist/src/components/useFlower/utils.d.ts +20 -0
  18. package/dist/src/components/useFlower.d.ts +2 -3
  19. package/dist/src/features/index.d.ts +2 -0
  20. package/dist/src/features/reducer/flowerReducer.d.ts +6 -0
  21. package/dist/src/{selectors.d.ts → features/selectors/selectors.d.ts} +494 -383
  22. package/dist/src/index.d.ts +5 -33
  23. package/dist/src/provider/index.d.ts +1 -0
  24. package/dist/src/provider/provider.d.ts +11 -0
  25. package/dist/src/types/FlowContext.d.ts +6 -0
  26. package/dist/src/types/FlowerHooks.d.ts +27 -0
  27. package/dist/src/{components/types → types}/FlowerProvider.d.ts +3 -3
  28. package/dist/src/types/index.d.ts +10 -0
  29. package/package.json +5 -2
  30. package/dist/src/components/FlowerField.d.ts +0 -4
  31. package/dist/src/components/FlowerRule.d.ts +0 -4
  32. package/dist/src/components/FlowerValue.d.ts +0 -4
  33. package/dist/src/components/types/FlowerField.d.ts +0 -124
  34. package/dist/src/components/types/FlowerHooks.d.ts +0 -72
  35. package/dist/src/components/types/FlowerRule.d.ts +0 -35
  36. package/dist/src/components/types/FlowerValue.d.ts +0 -33
  37. package/dist/src/components/useFlowerForm.d.ts +0 -26
  38. package/dist/src/context.d.ts +0 -10
  39. package/dist/src/provider.d.ts +0 -25
  40. package/dist/src/reducer.d.ts +0 -7
  41. /package/dist/src/{components/types → types}/DefaultNode.d.ts +0 -0
  42. /package/dist/src/{components/types → types}/FlowerComponent.d.ts +0 -0
  43. /package/dist/src/{components/types → types}/FlowerFlow.d.ts +0 -0
  44. /package/dist/src/{components/types → types}/FlowerNavigate.d.ts +0 -0
  45. /package/dist/src/{components/types → types}/FlowerNode.d.ts +0 -0
  46. /package/dist/src/{components/types → types}/FlowerRoute.d.ts +0 -0
  47. /package/dist/src/{components/types → types}/FlowerServer.d.ts +0 -0
package/README.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  <a alt="Flower logo" href="https://flowerjs.it/" target="_blank" rel="noreferrer"><img src="https://flowerjs.it/_next/static/media/flower-logo.bb32f863.svg" width="50"></a>
4
4
 
5
- Flower React is a front-end development library built on top of Flower Core, specifically designed for React applications. It seamlessly integrates Flower's powerful capabilities into React projects, providing a user-friendly interface for creating, modifying, and monitoring workflows.
5
+ Flower React is a front-end development library built on top of Flower Core, specifically designed for React applications.
6
+ It seamlessly integrates Flower's powerful capabilities into React projects, providing a user-friendly interface to create, modify, and monitor workflows.
6
7
 
7
8
  For more info [flowerjs.it/](https://flowerjs.it/)
8
9
 
@@ -10,13 +11,11 @@ For more info [flowerjs.it/](https://flowerjs.it/)
10
11
 
11
12
  ## Features
12
13
 
13
- - **Workflow Management**: Comprehensive API for creating, updating, and managing workflows programmatically.
14
+ - **Workflow Management**: Comprehensive API to create, update, and manage workflows programmatically.
14
15
  - **Node and Connection Handling**: Functions to manage nodes and connections, including adding, removing, and editing.
15
16
  - **State Management**: Built-in state management to keep track of workflow changes and updates.
16
17
  - **Event System**: Customizable event handling to respond to user interactions and changes within the workflow.
17
18
  - **Serialization**: Convert workflows to JSON for easy storage and retrieval. (only server side flow)
18
- - **Validation**: Ensure workflows follow predefined rules and constraints to maintain integrity.
19
- - **Form Validation**: Built-in functionalities to validate form inputs within nodes, ensuring data integrity and correctness.
20
19
  - **History Management**: Internal management of flow history, tracking node traversal and changes for debugging and visualization purposes.
21
20
 
22
21
  ### Installation
@@ -45,7 +44,7 @@ yarn add @flowerforce/flower-react
45
44
 
46
45
  ## Configuration
47
46
 
48
- The **FlowerProvider** component wraps the entire application, providing a global context for managing the application flow.
47
+ The **FlowerProvider** component wraps the entire application, providing a global redux context to manage the application flow.
49
48
 
50
49
  ```jsx
51
50
  import React from 'react'
@@ -59,13 +58,44 @@ function Root() {
59
58
  )
60
59
  }
61
60
  ```
62
- > You can pass the prop `enableReduxDevtool` to the `FlowerProvider` to show the Flower Store data inside the redux devtool of your browser.
61
+ > FlowerProvider accepts some properties such as `reducers` and `configureStoreOptions` in order to inject custom reducers into redux instance provided by FlowerProvider component.
62
+ N.B.: actions and selectors from your custom reducers must use `useSelector` and `useDispatch` provided by flower-react
63
+ ```jsx
64
+ import React from 'react'
65
+ import { customReducer, customReducer2 } from 'my-custom-reducers'
66
+ import { Flower, FlowerProvider } from '@flowerforce/flower-react'
67
+
68
+ const reducers = {
69
+ customReducer: customReducer.reducer,
70
+ customReducer2: customReducer2.reducer
71
+ }
72
+
73
+ function Root() {
74
+ return (
75
+ <FlowerProvider reducers={reducers}>
76
+ <App />
77
+ </FlowerProvider>
78
+ )
79
+ }
80
+ ```
81
+ > You can pass the prop `configureStoreOptions - devTools` to the `FlowerProvider` to show the Flower Store data inside the redux devtool of your browser.
82
+ ```jsx
83
+ import React from 'react'
84
+ import { Flower, FlowerProvider } from '@flowerforce/flower-react'
63
85
 
86
+ function Root() {
87
+ return (
88
+ <FlowerProvider configureStoreOptions={{ devTools: true }}>
89
+ <App />
90
+ </FlowerProvider>
91
+ )
92
+ }
93
+ ```
64
94
  ## How to use
65
95
 
66
96
  ### Simple Example
67
97
 
68
- The **Flower** component defines an application flow with a specific name, which serves as a unique identifier for the flow. It is the main component for defining the application flow, accepting a required "name" property and an initialData field for prepopulating values.
98
+ The **Flower** component defines an application flow with a specific name, which serves as a unique identifier for the flow. It is the main component to define the application flow, accepting a required "name" property and an initialData field to prepopulate values.
69
99
 
70
100
  The **FlowerNode** component represents a UI state or a step within the application flow. Transitions between nodes can be specified using the **to** object.
71
101
 
@@ -106,14 +136,13 @@ export const Page = () => {
106
136
  Edit on [codesandbox/](https://codesandbox.io/p/sandbox/flower-react-example-1-9wsjv7)
107
137
 
108
138
 
109
- > In addition you can pass the prop ***initialState*** to the `<Flower>` component
139
+ > In addition you can pass the prop ***initialState*** to the `<Flower>` component
110
140
 
111
141
  This prop allows you to configure the following fields:
112
142
 
113
- 1) `startId`: string
114
- 2) `current`: string
115
- 3) `history`: string[]
116
-
143
+ 1) `startId`: string - First node of current flow
144
+ 2) `current`: string - Current node of current flow
145
+ 3) `history`: string[] - History of nodes in current flow
117
146
 
118
147
 
119
148
  ### Navigate with routes
@@ -133,7 +162,7 @@ export const Page = () => {
133
162
  return (
134
163
  <Flower name="demo">
135
164
  {/* autonext */}
136
- <FlowerRoute id="start" to={{ step1: null }} />
165
+ <FlowerRoute id="start" to={{ step1: null }} />
137
166
  <FlowerNode
138
167
  id="step1"
139
168
  to={{
@@ -210,64 +239,6 @@ export const Page = () => {
210
239
 
211
240
  Edit on [codesandbox/](https://codesandbox.io/p/sandbox/flower-react-example-1-forked-5c4rs4)
212
241
 
213
- ### Basic WRITE | READ State
214
-
215
- To modify the internal state of Flower, besides passing initialData as a prop, we can always modify and read the state through the components **FlowerField** and **FlowerValue**.
216
-
217
- _FlowerField_ pass two props, onChange and value, to properly modify and read the value from the state of Flower.
218
- _FlowerValue_ pass value, to properly read the value from the state of Flower.
219
-
220
- Here's an example of how it works:
221
-
222
- ```jsx
223
- import React from 'react'
224
- import {
225
- Flower,
226
- FlowerRoute,
227
- FlowerNavigate,
228
- FlowerNode,
229
- FlowerField,
230
- FlowerValue
231
- } from '@flowerforce/flower-react'
232
-
233
- export const Page = () => {
234
- return (
235
- <Flower name="demo">
236
- <FlowerNode
237
- id="step1"
238
- to={{
239
- step3: {
240
- rules: { $and: [{ skipStep2: { $eq: true } }] }
241
- },
242
- step2: null
243
- }}
244
- >
245
- ...
246
-
247
- <FlowerField id="skipStep2">
248
- {({ onChange, value }) => <input type="checkbox" checked={value} onChange={e => onChange(e.target.checked)} />}
249
- </FlowerField>
250
-
251
- <FlowerNavigate action="next">
252
- <button>click me to go next</button>
253
- </FlowerNavigate>
254
- </FlowerNode>
255
-
256
- <FlowerNode id="step2">...</FlowerNode>
257
-
258
- <FlowerNode id="step3">
259
- <FlowerValue id="enableFinal">
260
- {({ value }) => <span>skipStep2: {String(!!value)}</span>}
261
- </FlowerValue>
262
- </FlowerNode>
263
-
264
- </Flower>
265
- )
266
- }
267
-
268
- ```
269
-
270
- Edit on [codesandbox/](https://codesandbox.io/p/sandbox/flower-react-example-3-forked-r3hgnj)
271
242
 
272
243
  ### Action Node
273
244
 
@@ -424,7 +395,7 @@ export const Page = () => {
424
395
 
425
396
  Edit on [codesandbox/](https://codesandbox.io/p/sandbox/flower-react-example-1-forked-6wj3l9)
426
397
 
427
- #### External use
398
+ #### External use of useFlower
428
399
 
429
400
  ```jsx
430
401
  import React from 'react'
@@ -461,9 +432,9 @@ Edit on [codesandbox/](https://codesandbox.io/p/sandbox/flower-react-example-1-f
461
432
 
462
433
  ### Utils Callback onEnter - onExit
463
434
 
464
- onEnter (function): A callback function that is executed when entering the node state. It's useful for performing specific operations when the user transitions to this state.
435
+ onEnter (function): A callback function that is executed when entering the node state. It's useful to perform specific operations when the user transitions to this state.
465
436
 
466
- onExit (function): A callback function that is executed when exiting the node state. It's useful for performing specific operations when the user leaves this state.
437
+ onExit (function): A callback function that is executed when exiting the node state. It's useful to perform specific operations when the user leaves this state.
467
438
 
468
439
  ```jsx
469
440
  import React from 'react'
@@ -499,24 +470,230 @@ export const Page = () => {
499
470
  }
500
471
  ```
501
472
 
502
- ## Form
503
473
 
504
- Flower enables the quick creation of forms.
505
474
 
506
- It keeps track of the form's validity status. This status not only facilitates displaying error messages to the user but can also be leveraged for implementing flow rules.
507
475
 
508
- ### Basic Usage
476
+ ## Operators Rules
477
+
478
+ The "rules" in Flower are used to define conditions and conditional behaviors within the workflow. These rules allow to dynamically change the display or behavior of certain fields or components based on specific conditions.
479
+
480
+ The rules schema follows the MongoDB style, below is the list of available operators:
481
+
482
+ - $exists: Checks if a value exists or not.
483
+ - $eq: Checks if two values are equal.
484
+ - $ne: Checks if two values are not equal.
485
+ - $gt: Checks if the first value is greater than the second.
486
+ - $gte: Checks if the first value is greater than or equal to the second.
487
+ - $lt: Checks if the first value is less than the second.
488
+ - $lte: Checks if the first value is less than or equal to the second.
489
+ - $strGt: Checks if the length of a string is greater than the specified value.
490
+ - $strGte: Checks if the length of a string is greater than or equal to the specified value.
491
+ - $strLt: Checks if the length of a string is less than the specified value.
492
+ - $strLte: Checks if the length of a string is less than or equal to the specified value.
493
+ - $in: Checks if a value is present in a given array.
494
+ - $nin: Checks if a value is not present in a given array.
495
+ - $all: Checks if all values are present in a given array.
496
+ - $regex: Checks if a string matches a regular expression.
497
+
498
+ ### Examples
499
+
500
+ Rules in $and | $or
501
+
502
+ ```jsx
503
+ <FlowerNode id="node"
504
+ to={{
505
+ node2: {
506
+ rules: { $and: [
507
+ { myValue: { $exists: true } },
508
+ { myValue: { $strGt: 6 } }
509
+
510
+ ]}
511
+ }
512
+ }}>
513
+ ...
514
+ </Flower>
515
+
516
+ <FlowerNode id="node"
517
+ to={{
518
+ node2: {
519
+ rules: { $or: [
520
+ { myValue: { $exists: false } },
521
+ { myValue: { $strGt: 6 } }
522
+
523
+ ]}
524
+ }
525
+ }}>
526
+ ...
527
+ </Flower>
528
+
529
+ ```
530
+
531
+ Compare state value, use '$ref:'
532
+
533
+ ```jsx
534
+ <Flower name="demo" initialData={{ myValue1: 'test', myValue2: 'test2' }}>
535
+ <FlowerNode id="node"
536
+ to={{
537
+ node2: {
538
+ rules: [
539
+ { myValue1: { $eq: '$ref:myValue2' } }
540
+ ]}
541
+ }}>
542
+ ...
543
+ </Flower>
544
+ ```
545
+
546
+ ## Display Rules
547
+
548
+ Showing or Hiding Fields: You can use rules to show or hide specific fields based on user choices. For example, hiding a "Buttons" unless the user selects a certain option.
549
+
550
+ We can use the FlowerRule component to hide a part of the UI according to certain rules.
551
+
552
+ If the "alwaysDisplay" property is passed, however, the component will not be automatically hidden, but a "hidden" property will be provided when the rules are not met.
553
+
554
+ ### Example
555
+
556
+ ```jsx
557
+ import React from 'react'
558
+ import {
559
+ Flower,
560
+ FlowerRoute,
561
+ FlowerNode,
562
+ FlowerRule,
563
+ FlowerNavigate
564
+ } from '@flowerforce/flower-react'
565
+
566
+ export const Page = () => {
567
+ return (
568
+ <Flower name="demo" initialData={{ enableNav: true }}>
569
+ <FlowerNode id="step1" to={{ step2: null }}>
570
+ ...
571
+ {/* show / hidden based on rule */}
572
+ <FlowerRule rules={{ enableNav: { $eq: true } }}>
573
+ <p>Buttons nav are enabled</p>
574
+ </FlowerRule>
575
+ {/* always visible component, hidden prop is true when rule is not matched */}
576
+ <FlowerNavigate
577
+ action="next"
578
+ rules={{ enableNav: { $eq: true } }}
579
+ alwaysDisplay
580
+ >
581
+ {({ onClick, hidden }) => (
582
+ <button disabled={hidden} onClick={onClick}>
583
+ Next &#8594;
584
+ </button>
585
+ )}
586
+ </FlowerNavigate>
587
+ {/* visible only when rule is matched */}
588
+ <FlowerNavigate action="reset" rules={{ enableNav: { $eq: true } }}>
589
+ <button>Reset</button>
590
+ </FlowerNavigate>
591
+ </FlowerNode>
592
+ ...
593
+ </Flower>
594
+ )
595
+ }
596
+ ```
597
+
598
+ Edit on [codesandbox/](https://codesandbox.io/p/sandbox/flower-react-example-1-forked-sfn6ml)
599
+
600
+
601
+ # FlowerForm Integrations
602
+ Next to FlowerReact, we find FlowerForm, another library designed to manage data and forms independently from the flow process.
603
+ (add link to new form documentation)
604
+
605
+ ### Basic WRITE | READ State - move this in form
606
+
607
+ To modify the internal state of Flower, besides passing initialData as a prop, we can always modify and read the state through the components **FlowerField** and **FlowerValue**.
608
+
609
+ N.B.: We must use FlowerField component provided by `@flowerforce/flower-react-form`
610
+ N.B.: We must use FlowerValue component provided by `@flowerforce/flower-react-shared`
611
+
612
+
613
+ _FlowerField_ pass two props, onChange and value, to properly modify and read the value from the state of Flower.
614
+ _FlowerValue_ pass value, to properly read the value from the state of Flower.
615
+
616
+ Here's an example of how it works:
509
617
 
510
618
  ```jsx
619
+ import React from 'react'
511
620
  import {
512
621
  Flower,
622
+ FlowerRoute,
513
623
  FlowerNavigate,
514
624
  FlowerNode,
515
625
  FlowerField,
626
+ } from '@flowerforce/flower-react'
627
+
628
+
629
+ import {
630
+ FlowerField,
631
+ } from '@flowerforce/flower-react-form'
632
+
633
+ import { FlowerValue } from '@flowerforce/flower-react-shared'
634
+
635
+
636
+ export const Page = () => {
637
+ return (
638
+ <Flower name="demo">
639
+ <FlowerNode
640
+ id="step1"
641
+ to={{
642
+ step3: {
643
+ rules: { $and: [{ skipStep2: { $eq: true } }] }
644
+ },
645
+ step2: null
646
+ }}
647
+ >
648
+ ...
649
+
650
+ <FlowerField id="skipStep2">
651
+ {({ onChange, value }) => <input type="checkbox" checked={value} onChange={e => onChange(e.target.checked)} />}
652
+ </FlowerField>
653
+
654
+ <FlowerNavigate action="next">
655
+ <button>click me to go next</button>
656
+ </FlowerNavigate>
657
+ </FlowerNode>
658
+
659
+ <FlowerNode id="step2">...</FlowerNode>
660
+
661
+ <FlowerNode id="step3">
662
+ <FlowerValue id="enableFinal">
663
+ {({ value }) => <span>skipStep2: {String(!!value)}</span>}
664
+ </FlowerValue>
665
+ </FlowerNode>
666
+
667
+ </Flower>
668
+ )
669
+ }
670
+
671
+ ```
672
+
673
+ Edit on [codesandbox/](https://codesandbox.io/p/sandbox/flower-react-example-3-forked-r3hgnj)
674
+
675
+ ## Form - move this in form
676
+ N.B.: `@flowerforce/flower-react-form` provides its own provider `FormProvider` and an equivalent of `<Flower>` component called `<FlowerForm>`
677
+ In this case we don't need to use it as form components reads from <Flower> context and mantains consistency between flowname and formname
678
+
679
+ For more info [flowerjs.it/flower-react-form](https://flowerjs.it/flower-react-form) /// we must generate pages in website for specific documentation
680
+
681
+ ### Basic Usage
682
+
683
+ ```jsx
684
+ import {
685
+ Flower,
686
+ FlowerNavigate,
687
+ FlowerNode,
516
688
  FlowerAction,
517
- useFlower,
518
- useFlowerForm
689
+ useFlower
519
690
  } from '@flowerforce/flower-react'
691
+
692
+ import {
693
+ FlowerField,
694
+ useFlowerForm
695
+ } from '@flowerforce/flower-react-form'
696
+
520
697
  import { useEffect } from 'react'
521
698
  import './styles.css'
522
699
 
@@ -610,7 +787,7 @@ export default function App() {
610
787
 
611
788
  <FlowerNavigate
612
789
  action="next"
613
- rules={{ $and: [{ '$form.isValid': { $eq: true } }] }}
790
+ rules={{ $and: [{ '$data.isValid': { $eq: true } }] }}
614
791
  alwaysDisplay
615
792
  >
616
793
  {({ onClick, hidden }) => (
@@ -656,130 +833,6 @@ export default function App() {
656
833
 
657
834
  Edit on [codesandbox/](https://codesandbox.io/p/sandbox/flower-react-example-1-forked-2f43gh)
658
835
 
659
- ## Operators Rules
660
-
661
- The "rules" in Flower are used to define conditions and conditional behaviors within the workflow. These rules allow for dynamically changing the display or behavior of certain fields or components based on specific conditions.
662
-
663
- The rules schema follows the MongoDB style, below is the list of available operators:
664
-
665
- - $exists: Checks if a value exists or not.
666
- - $eq: Checks if two values are equal.
667
- - $ne: Checks if two values are not equal.
668
- - $gt: Checks if the first value is greater than the second.
669
- - $gte: Checks if the first value is greater than or equal to the second.
670
- - $lt: Checks if the first value is less than the second.
671
- - $lte: Checks if the first value is less than or equal to the second.
672
- - $strGt: Checks if the length of a string is greater than the specified value.
673
- - $strGte: Checks if the length of a string is greater than or equal to the specified value.
674
- - $strLt: Checks if the length of a string is less than the specified value.
675
- - $strLte: Checks if the length of a string is less than or equal to the specified value.
676
- - $in: Checks if a value is present in a given array.
677
- - $nin: Checks if a value is not present in a given array.
678
- - $all: Checks if all values are present in a given array.
679
- - $regex: Checks if a string matches a regular expression.
680
-
681
- ### Examples
682
-
683
- Rules in $and | $or
684
-
685
- ```jsx
686
- <FlowerNode id="node"
687
- to={{
688
- node2: {
689
- rules: { $and: [
690
- { myValue: { $exists: true } },
691
- { myValue: { $strGt: 6 } }
692
-
693
- ]}
694
- }
695
- }}>
696
- ...
697
- </Flower>
698
-
699
- <FlowerNode id="node"
700
- to={{
701
- node2: {
702
- rules: { $or: [
703
- { myValue: { $exists: false } },
704
- { myValue: { $strGt: 6 } }
705
-
706
- ]}
707
- }
708
- }}>
709
- ...
710
- </Flower>
711
-
712
- ```
713
-
714
- Compare state value, use '$ref:'
715
-
716
- ```jsx
717
- <Flower name="demo" initialData={{ myValue1: 'test', myValue2: 'test2' }}>
718
- <FlowerNode id="node"
719
- to={{
720
- node2: {
721
- rules: [
722
- { myValue1: { $eq: '$ref:myValue2' } }
723
- ]}
724
- }}>
725
- ...
726
- </Flower>
727
- ```
728
-
729
- ## Display Rules
730
-
731
- Showing or Hiding Fields: You can use rules to show or hide specific fields based on user choices. For example, hiding a "Buttons" unless the user selects a certain option.
732
-
733
- We can use the FlowerRule component to hide a part of the UI according to certain rules.
734
-
735
- If the "alwaysDisplay" property is passed, however, the component will not be automatically hidden, but a "hidden" property will be provided when the rules are not met.
736
-
737
- ### Example
738
-
739
- ```jsx
740
- import React from 'react'
741
- import {
742
- Flower,
743
- FlowerRoute,
744
- FlowerNode,
745
- FlowerRule,
746
- FlowerNavigate
747
- } from '@flowerforce/flower-react'
748
-
749
- export const Page = () => {
750
- return (
751
- <Flower name="demo" initialData={{ enableNav: true }}>
752
- <FlowerNode id="step1" to={{ step2: null }}>
753
- ...
754
- {/* show / hidden based on rule */}
755
- <FlowerRule rules={{ enableNav: { $eq: true } }}>
756
- <p>Buttons nav are enabled</p>
757
- </FlowerRule>
758
- {/* always visible component, hidden prop is true when rule is not matched */}
759
- <FlowerNavigate
760
- action="next"
761
- rules={{ enableNav: { $eq: true } }}
762
- alwaysDisplay
763
- >
764
- {({ onClick, hidden }) => (
765
- <button disabled={hidden} onClick={onClick}>
766
- Next &#8594;
767
- </button>
768
- )}
769
- </FlowerNavigate>
770
- {/* visible only when rule is matched */}
771
- <FlowerNavigate action="reset" rules={{ enableNav: { $eq: true } }}>
772
- <button>Reset</button>
773
- </FlowerNavigate>
774
- </FlowerNode>
775
- ...
776
- </Flower>
777
- )
778
- }
779
- ```
780
-
781
- Edit on [codesandbox/](https://codesandbox.io/p/sandbox/flower-react-example-1-forked-sfn6ml)
782
-
783
836
 
784
837
  # Debugging Your Flower Application with @flowerforce/devtool
785
838
  To enhance the debugging process of your Flower application, we offer a specialized library named @flowerforce/devtool. This tool is designed to provide a more convenient and powerful debugging experience.
@@ -875,7 +928,7 @@ First, create the JSON file at the same level as the component file.
875
928
 
876
929
  ```
877
930
  src
878
-
931
+
879
932
 
880
933
  └───components
881
934
  │ │
@@ -904,7 +957,7 @@ The keys in the JSON file have the following purposes:
904
957
  - `type`: indicates what is being described with this JSON file, in this case, a component
905
958
  - `name`: the name of the component being configured
906
959
  - `category`: components are grouped into categories in Flower's graphical interface, so you can choose a category to which the component belongs
907
- - `description`: a brief description of the component that will be displayed in the graphical interface. This is particularly useful for understanding the functionality of a specific component without reading the code
960
+ - `description`: a brief description of the component that will be displayed in the graphical interface. This is particularly useful to understand the functionality of a specific component without reading the code
908
961
  - `editing`: in this key, we will insert the options that will allow us to configure the component's behavior directly from the graphical interface
909
962
 
910
963
  Once you have completed these two steps, you will be able to use your `Text component` through the graphical interface.
@@ -927,3 +980,7 @@ In any case, there is a JSON schema that will guide you in writing the file asso
927
980
  # Documentation
928
981
 
929
982
  The Flower React docs are published at [flowerjs.it/](https://flowerjs.it)
983
+
984
+
985
+
986
+