@modular-component/with-conditional-render 0.2.1 → 0.2.3

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 (3) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +16 -8
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @modular-component/with-conditional-render
2
2
 
3
+ ## 0.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [208e156]
8
+ - @modular-component/core@0.2.3
9
+
10
+ ## 0.2.2
11
+
12
+ ### Patch Changes
13
+
14
+ - 77c46f4: Fix an issue in core rendering system
15
+ - Updated dependencies [77c46f4]
16
+ - @modular-component/core@0.2.2
17
+
3
18
  ## 0.2.1
4
19
 
5
20
  ### Patch Changes
package/README.md CHANGED
@@ -13,20 +13,28 @@ Provides three stages that allow conditional rendering in `ModularComponent`s:
13
13
 
14
14
  ```tsx
15
15
  import { ModularComponent } from '@modular-component/core'
16
- import { condition, conditionalFallback, conditionalRender } from '@modular-component/with-conditional-render'
16
+ import {
17
+ condition,
18
+ conditionalFallback,
19
+ conditionalRender,
20
+ } from '@modular-component/with-conditional-render'
17
21
 
18
22
  const ConditionalComponent = ModularComponent<{ enabled?: boolean }>()
19
23
  .with(condition('disabled', ({ props }) => props.enabled !== true))
20
24
  .with(conditionalFallback('disabled', () => <>I'm disabled!</>))
21
- .with(lifecycle(() => {
22
- // Some data fetching logic...
23
- return { loading, data }
24
- }))
25
+ .with(
26
+ lifecycle(() => {
27
+ // Some data fetching logic...
28
+ return { loading, data }
29
+ }),
30
+ )
25
31
  .with(condition('loading', ({ lifecycle }) => lifecycle.loading === false))
26
32
  .with(conditionalFallback('loading', () => <>I'm loading!</>))
27
- .with(conditionalRender(({ lifecycle }) => (
28
- <>I'm enabled and loaded, here is the content: {lifecycle.data}</>
29
- )))
33
+ .with(
34
+ conditionalRender(({ lifecycle }) => (
35
+ <>I'm enabled and loaded, here is the content: {lifecycle.data}</>
36
+ )),
37
+ )
30
38
  ```
31
39
 
32
40
  ## Multiple conditions and fallbacks
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "Default",
9
9
  "Conditional"
10
10
  ],
11
- "version": "0.2.1",
11
+ "version": "0.2.3",
12
12
  "type": "module",
13
13
  "license": "MIT",
14
14
  "publishConfig": {
@@ -26,7 +26,7 @@
26
26
  "license": "cp ../../LICENSE ./LICENSE"
27
27
  },
28
28
  "dependencies": {
29
- "@modular-component/core": "0.2.1"
29
+ "@modular-component/core": "0.2.3"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": ">=17 <19"