@startupjs-ui/collapse 0.1.13 → 0.1.19
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.
- package/CHANGELOG.md +19 -0
- package/README.mdx +39 -8
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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.1.19](https://github.com/startupjs/startupjs-ui/compare/v0.1.18...v0.1.19) (2026-03-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **docs:** don't load all icons to keep bundle small ([#17](https://github.com/startupjs/startupjs-ui/issues/17)) ([d7eb70b](https://github.com/startupjs/startupjs-ui/commit/d7eb70bc11f5b15923f2e43b7ef1f86ea066494e))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.1.16](https://github.com/startupjs/startupjs-ui/compare/v0.1.15...v0.1.16) (2026-02-10)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @startupjs-ui/collapse
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [0.1.13](https://github.com/startupjs/startupjs-ui/compare/v0.1.12...v0.1.13) (2026-02-03)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @startupjs-ui/collapse
|
package/README.mdx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { $ } from 'startupjs'
|
|
2
2
|
import { useState } from 'react'
|
|
3
3
|
import { Sandbox } from '@startupjs-ui/docs'
|
|
4
|
-
import { faAngleRight } from '@fortawesome/free-solid-svg-icons'
|
|
4
|
+
import { faAngleRight } from '@fortawesome/free-solid-svg-icons/faAngleRight'
|
|
5
5
|
import Collapse, { _PropsJsonSchema as CollapsePropsJsonSchema } from './index'
|
|
6
6
|
import { _PropsJsonSchema as CollapseHeaderPropsJsonSchema } from './CollapseHeader'
|
|
7
7
|
import { _PropsJsonSchema as CollapseContentPropsJsonSchema } from './CollapseContent'
|
|
@@ -11,7 +11,7 @@ import Div from '@startupjs-ui/div'
|
|
|
11
11
|
|
|
12
12
|
Inherits [react-native-collapsible](https://github.com/oblador/react-native-collapsible).
|
|
13
13
|
|
|
14
|
-
Collapse
|
|
14
|
+
Collapse lets you toggle the visibility of a content section with a smooth animation.
|
|
15
15
|
|
|
16
16
|
```jsx
|
|
17
17
|
import { Collapse } from 'startupjs-ui'
|
|
@@ -19,6 +19,8 @@ import { Collapse } from 'startupjs-ui'
|
|
|
19
19
|
|
|
20
20
|
## Simple example
|
|
21
21
|
|
|
22
|
+
Use the `open` and `onChange` props to control visibility. Pass a `title` to display a default header.
|
|
23
|
+
|
|
22
24
|
```jsx example noscroll
|
|
23
25
|
const [open, setOpen] = useState(false)
|
|
24
26
|
return (
|
|
@@ -30,7 +32,7 @@ return (
|
|
|
30
32
|
|
|
31
33
|
## Pure collapse
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
The pure variant strips all default styling (background, paddings, etc.), which is useful when embedding a Collapse inside other components like `Card`. Set `variant='pure'` to enable it.
|
|
34
36
|
|
|
35
37
|
```jsx example noscroll
|
|
36
38
|
const [open, setOpen] = useState(false)
|
|
@@ -48,7 +50,7 @@ return (
|
|
|
48
50
|
|
|
49
51
|
## Advanced usage
|
|
50
52
|
|
|
51
|
-
Collapse consists of two
|
|
53
|
+
Collapse consists of two sub-components: `Collapse.Header` and `Collapse.Content`. Use these instead of the `title` prop and direct children when you need custom markup. Each sub-component inherits the `variant` from the parent Collapse, but you can override it by passing `variant` directly to the sub-component.
|
|
52
54
|
|
|
53
55
|
```jsx example noscroll
|
|
54
56
|
const [open, setOpen] = useState(false)
|
|
@@ -64,7 +66,7 @@ return (
|
|
|
64
66
|
|
|
65
67
|
## Icon configuration
|
|
66
68
|
|
|
67
|
-
You can provide a custom icon by
|
|
69
|
+
You can provide a custom icon by passing it to the `icon` prop. The icon should be an arrow-like icon pointing right, as it rotates 90 degrees when the collapse opens.
|
|
68
70
|
|
|
69
71
|
```jsx example
|
|
70
72
|
const [open, setOpen] = useState(false)
|
|
@@ -80,13 +82,42 @@ return (
|
|
|
80
82
|
)
|
|
81
83
|
```
|
|
82
84
|
|
|
83
|
-
### No
|
|
85
|
+
### No icon
|
|
86
|
+
|
|
87
|
+
You can remove the icon entirely by setting `icon={false}`.
|
|
88
|
+
|
|
89
|
+
## Animation options
|
|
90
|
+
|
|
91
|
+
The collapse animation can be customized through props passed to `Collapse` (or directly to `Collapse.Content`):
|
|
92
|
+
|
|
93
|
+
- **duration** -- animation duration in milliseconds
|
|
94
|
+
- **easing** -- easing function or preset name for the animation curve
|
|
95
|
+
- **collapsedHeight** -- the height of the content area when collapsed (defaults to fully collapsed)
|
|
96
|
+
- **align** -- vertical alignment of the content when partially collapsed (`top`, `center`, or `bottom`)
|
|
97
|
+
- **enablePointerEvents** -- allow pointer events on the content while it is collapsed
|
|
98
|
+
- **renderChildrenCollapsed** -- render children even when the section is collapsed (useful for preserving state)
|
|
99
|
+
- **onAnimationEnd** -- callback fired after the collapse or expand animation finishes
|
|
100
|
+
|
|
101
|
+
## Custom styles
|
|
102
|
+
|
|
103
|
+
You can customize the appearance using style props:
|
|
104
|
+
|
|
105
|
+
- **style** -- custom styles for the root container
|
|
106
|
+
- **collapsibleContainerStyle** -- custom styles for the collapsible content wrapper
|
|
107
|
+
|
|
108
|
+
When using `Collapse.Header`, additional style props are available:
|
|
109
|
+
|
|
110
|
+
- **style** -- custom styles for the header root
|
|
111
|
+
- **iconStyle** -- custom styles for the header icon
|
|
112
|
+
- **containerStyle** -- custom styles for the header content container
|
|
113
|
+
|
|
114
|
+
## Two-way binding
|
|
84
115
|
|
|
85
|
-
|
|
116
|
+
Instead of manually managing the `open` and `onChange` props, you can use the `$open` prop with a scoped model for automatic two-way data binding.
|
|
86
117
|
|
|
87
118
|
## Accordion
|
|
88
119
|
|
|
89
|
-
|
|
120
|
+
You can build accordion behavior using multiple Collapse components with shared state.
|
|
90
121
|
|
|
91
122
|
```jsx example noscroll
|
|
92
123
|
const [expand, setExpand] = useState()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startupjs-ui/collapse",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
"types": "index.d.ts",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@startupjs-ui/core": "^0.1.
|
|
12
|
-
"@startupjs-ui/div": "^0.1.
|
|
13
|
-
"@startupjs-ui/icon": "^0.1.
|
|
14
|
-
"@startupjs-ui/span": "^0.1.
|
|
11
|
+
"@startupjs-ui/core": "^0.1.19",
|
|
12
|
+
"@startupjs-ui/div": "^0.1.19",
|
|
13
|
+
"@startupjs-ui/icon": "^0.1.19",
|
|
14
|
+
"@startupjs-ui/span": "^0.1.19",
|
|
15
15
|
"react-native-collapsible": "^1.6.2"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
"react-native": "*",
|
|
20
20
|
"startupjs": "*"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "bfcca786dc363f42a09b6eef4feb7ca8139302fc"
|
|
23
23
|
}
|