@flipova/foundation 1.13.0 → 2.0.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.
- package/CHANGELOG.md +181 -0
- package/README.md +53 -178
- package/components/ui/accordion/ANIMATION_CUSTOMIZATION.md +162 -0
- package/components/ui/accordion/AccordionAnimatedHeight.tsx +56 -0
- package/components/ui/accordion/AccordionAnimatedIcon.tsx +41 -0
- package/components/ui/accordion/AnimatedHeight.tsx +56 -0
- package/components/ui/accordion/AnimatedIcon.tsx +41 -0
- package/components/ui/accordion/MIGRATION_SUMMARY.md +250 -0
- package/components/ui/accordion/USAGE_EXAMPLE.tsx +179 -0
- package/components/ui/accordion/animation-config.ts +32 -0
- package/components/ui/accordion/index.tsx +253 -0
- package/components/ui/actionsheet/index.tsx +511 -0
- package/components/ui/alert/index.tsx +158 -0
- package/components/ui/alert-dialog/index.tsx +254 -0
- package/components/ui/avatar/index.tsx +139 -0
- package/components/ui/badge/index.tsx +163 -0
- package/components/ui/bottomsheet/index.tsx +477 -0
- package/components/ui/box/index.tsx +19 -0
- package/components/ui/box/index.web.tsx +19 -0
- package/components/ui/box/styles.tsx +10 -0
- package/components/ui/button/index.tsx +264 -0
- package/components/ui/calendar/creator.tsx +366 -0
- package/components/ui/calendar/index.tsx +462 -0
- package/components/ui/calendar/styles.tsx +140 -0
- package/components/ui/card/index.tsx +23 -0
- package/components/ui/card/index.web.tsx +26 -0
- package/components/ui/card/styles.tsx +16 -0
- package/components/ui/center/index.tsx +22 -0
- package/components/ui/center/index.web.tsx +20 -0
- package/components/ui/center/styles.tsx +8 -0
- package/components/ui/checkbox/index.tsx +184 -0
- package/components/ui/date-time-picker/creator.tsx +109 -0
- package/components/ui/date-time-picker/index.tsx +585 -0
- package/components/ui/date-time-picker/index.web.tsx +217 -0
- package/components/ui/date-time-picker/styles.tsx +56 -0
- package/components/ui/divider/index.tsx +40 -0
- package/components/ui/drawer/index.tsx +362 -0
- package/components/ui/fab/index.tsx +215 -0
- package/components/ui/flat-list/index.tsx +21 -0
- package/components/ui/form-control/index.tsx +352 -0
- package/components/ui/gluestack-ui-provider/config.ts +72 -0
- package/components/ui/gluestack-ui-provider/index.tsx +47 -0
- package/components/ui/gluestack-ui-provider/index.web.tsx +96 -0
- package/components/ui/gluestack-ui-provider/script.ts +19 -0
- package/components/ui/gluestack-ui-provider/tokens.d.ts +17 -0
- package/components/ui/gluestack-ui-provider/tokens.js +188 -0
- package/components/ui/gluestack-ui-provider/useGluestackColors.ts +82 -0
- package/components/ui/grid/index.tsx +283 -0
- package/components/ui/grid/index.web.tsx +66 -0
- package/components/ui/grid/styles.tsx +15 -0
- package/components/ui/heading/index.tsx +220 -0
- package/components/ui/heading/index.web.tsx +202 -0
- package/components/ui/heading/styles.tsx +43 -0
- package/components/ui/hstack/index.tsx +27 -0
- package/components/ui/hstack/index.web.tsx +26 -0
- package/components/ui/hstack/styles.tsx +25 -0
- package/components/ui/icon/index.tsx +1588 -0
- package/components/ui/icon/index.web.tsx +1573 -0
- package/components/ui/image/index.tsx +48 -0
- package/components/ui/image-background/index.tsx +25 -0
- package/components/ui/image-viewer/index.tsx +743 -0
- package/components/ui/image-viewer/index.web.tsx +302 -0
- package/components/ui/index.ts +58 -0
- package/components/ui/input/index.tsx +125 -0
- package/components/ui/input-accessory-view/index.tsx +2 -0
- package/components/ui/keyboard-avoiding-view/index.tsx +2 -0
- package/components/ui/link/index.tsx +102 -0
- package/components/ui/liquid-glass/index.tsx +74 -0
- package/components/ui/menu/index.tsx +186 -0
- package/components/ui/modal/index.tsx +237 -0
- package/components/ui/popover/index.tsx +272 -0
- package/components/ui/portal/index.tsx +17 -0
- package/components/ui/pressable/index.tsx +39 -0
- package/components/ui/progress/index.tsx +83 -0
- package/components/ui/radio/index.tsx +217 -0
- package/components/ui/refresh-control/index.tsx +2 -0
- package/components/ui/safe-area-view/index.tsx +2 -0
- package/components/ui/scroll-view/index.tsx +2 -0
- package/components/ui/section-list/index.tsx +2 -0
- package/components/ui/select/index.tsx +277 -0
- package/components/ui/select/select-actionsheet.tsx +562 -0
- package/components/ui/skeleton/index.tsx +105 -0
- package/components/ui/skeleton/index.web.tsx +103 -0
- package/components/ui/skeleton/styles.tsx +35 -0
- package/components/ui/slider/index.tsx +181 -0
- package/components/ui/spinner/index.tsx +40 -0
- package/components/ui/status-bar/index.tsx +2 -0
- package/components/ui/switch/index.tsx +41 -0
- package/components/ui/table/index.tsx +210 -0
- package/components/ui/table/index.web.tsx +157 -0
- package/components/ui/table/styles.tsx +44 -0
- package/components/ui/tabs/TabsAnimatedIndicator.tsx +160 -0
- package/components/ui/tabs/animation-config.ts +3 -0
- package/components/ui/tabs/creator.tsx +206 -0
- package/components/ui/tabs/index.tsx +484 -0
- package/components/ui/text/index.tsx +48 -0
- package/components/ui/text/index.web.tsx +45 -0
- package/components/ui/text/styles.tsx +47 -0
- package/components/ui/textarea/index.tsx +94 -0
- package/components/ui/toast/index.tsx +252 -0
- package/components/ui/tooltip/index.tsx +131 -0
- package/components/ui/view/index.tsx +2 -0
- package/components/ui/virtualized-list/index.tsx +2 -0
- package/components/ui/vstack/index.tsx +28 -0
- package/components/ui/vstack/index.web.tsx +27 -0
- package/components/ui/vstack/styles.tsx +25 -0
- package/design/canonical.index.txt +53 -0
- package/design/documentation.xml +519 -0
- package/design/manifest.xml +90 -0
- package/design/schema.xsd +639 -0
- package/design/themes.xml +204 -0
- package/design/tokens.xml +510 -0
- package/design/tools/design.js +165 -0
- package/design/tools/npm.js +65 -0
- package/design/tools/requirements.txt +35 -0
- package/design/tools/sources/.checker/__init__.py +81 -0
- package/design/tools/sources/.checker/checks.py +198 -0
- package/design/tools/sources/.checker/cli.py +154 -0
- package/design/tools/sources/.checker/io.py +242 -0
- package/design/tools/sources/.checker/model.py +144 -0
- package/design/tools/sources/.checker/registry.py +115 -0
- package/design/tools/sources/.checker/report.py +21 -0
- package/design/tools/sources/.docgen/__init__.py +45 -0
- package/design/tools/sources/.docgen/cli.py +101 -0
- package/design/tools/sources/.docgen/model.py +147 -0
- package/design/tools/sources/.docgen/reference.py +97 -0
- package/design/tools/sources/.docgen/site.py +145 -0
- package/design/tools/sources/.docgen/xsddoc.py +329 -0
- package/design/tools/sources/.generate/__init__.py +35 -0
- package/design/tools/sources/.generate/cli.py +76 -0
- package/design/tools/sources/.generate/common.py +33 -0
- package/design/tools/sources/.generate/config.py +119 -0
- package/design/tools/sources/.generate/model.py +51 -0
- package/design/tools/sources/.generate/tokens.py +141 -0
- package/design/tools/sources/.linter/__init__.py +9 -0
- package/design/tools/sources/.linter/cli.py +44 -0
- package/design/tools/sources/.linter/discovery.py +30 -0
- package/design/tools/sources/.linter/errors.py +45 -0
- package/design/tools/sources/.linter/linter.py +68 -0
- package/design/tools/sources/.xmleditor/__init__.py +74 -0
- package/design/tools/sources/.xmleditor/blocks.py +185 -0
- package/design/tools/sources/.xmleditor/cli.py +141 -0
- package/design/tools/sources/.xmleditor/editor.py +906 -0
- package/design/tools/sources/.xmleditor/model.py +708 -0
- package/design/tools/sources/.xmleditor/widgets.py +1832 -0
- package/design/tools/sources/.xmleditor/xsdmodel.py +753 -0
- package/design/tools/sources/checker.py +55 -0
- package/design/tools/sources/docgen.py +66 -0
- package/design/tools/sources/generate.py +48 -0
- package/design/tools/sources/linter.py +54 -0
- package/design/tools/sources/ruff.toml +12 -0
- package/design/tools/sources/xmleditor.py +62 -0
- package/design/tools/unix/_venv_python.sh +16 -0
- package/design/tools/unix/check.sh +13 -0
- package/design/tools/unix/doc.sh +14 -0
- package/design/tools/unix/gen.sh +14 -0
- package/design/tools/unix/lint.sh +10 -0
- package/design/tools/unix/run.sh +20 -0
- package/design/tools/unix/verify.sh +12 -0
- package/design/tools/unix/xmledit.sh +12 -0
- package/design/tools/windows/check.cmd +12 -0
- package/design/tools/windows/doc.cmd +12 -0
- package/design/tools/windows/gen.cmd +11 -0
- package/design/tools/windows/lint.cmd +9 -0
- package/design/tools/windows/run.cmd +26 -0
- package/design/tools/windows/verify.cmd +10 -0
- package/design/tools/windows/xmledit.cmd +10 -0
- package/dist/chunk-LV4UIEQN.js +9730 -0
- package/dist/chunk-LV4UIEQN.js.map +1 -0
- package/dist/chunk-WNVU3BM2.mjs +9401 -0
- package/dist/chunk-WNVU3BM2.mjs.map +1 -0
- package/dist/index.d.mts +40 -9
- package/dist/index.d.ts +40 -9
- package/dist/index.js +726 -414
- package/dist/index.mjs +1 -5
- package/dist/ui/index.d.mts +6931 -3070
- package/dist/ui/index.d.ts +6931 -3070
- package/dist/ui/index.js +779 -352
- package/dist/ui/index.mjs +1 -2
- package/package.json +66 -142
- package/dist/chunk-2XORADW6.js +0 -24552
- package/dist/chunk-2XORADW6.js.map +0 -1
- package/dist/chunk-52BHHF5M.js +0 -46
- package/dist/chunk-52BHHF5M.js.map +0 -1
- package/dist/chunk-5647JY7Z.mjs +0 -100
- package/dist/chunk-5647JY7Z.mjs.map +0 -1
- package/dist/chunk-5N5HC4ZA.mjs +0 -3
- package/dist/chunk-5N5HC4ZA.mjs.map +0 -1
- package/dist/chunk-7QFZMGL6.js +0 -8583
- package/dist/chunk-7QFZMGL6.js.map +0 -1
- package/dist/chunk-ASZEP37D.js +0 -423
- package/dist/chunk-ASZEP37D.js.map +0 -1
- package/dist/chunk-BH5SU2JQ.mjs +0 -8282
- package/dist/chunk-BH5SU2JQ.mjs.map +0 -1
- package/dist/chunk-BO65GO53.mjs +0 -422
- package/dist/chunk-BO65GO53.mjs.map +0 -1
- package/dist/chunk-BSVXX52E.mjs +0 -413
- package/dist/chunk-BSVXX52E.mjs.map +0 -1
- package/dist/chunk-DNV5UBNF.mjs +0 -3
- package/dist/chunk-DNV5UBNF.mjs.map +0 -1
- package/dist/chunk-EDTAMUO2.js +0 -8310
- package/dist/chunk-EDTAMUO2.js.map +0 -1
- package/dist/chunk-IJTI6EX4.js +0 -4
- package/dist/chunk-IJTI6EX4.js.map +0 -1
- package/dist/chunk-M3YLASM2.js +0 -428
- package/dist/chunk-M3YLASM2.js.map +0 -1
- package/dist/chunk-OXKOGLXE.js +0 -4
- package/dist/chunk-OXKOGLXE.js.map +0 -1
- package/dist/chunk-RQXQK3ZO.mjs +0 -8486
- package/dist/chunk-RQXQK3ZO.mjs.map +0 -1
- package/dist/chunk-SR25V4EA.mjs +0 -40
- package/dist/chunk-SR25V4EA.mjs.map +0 -1
- package/dist/chunk-UB34WFEQ.js +0 -106
- package/dist/chunk-UB34WFEQ.js.map +0 -1
- package/dist/chunk-ZBRWXKDF.mjs +0 -24431
- package/dist/chunk-ZBRWXKDF.mjs.map +0 -1
- package/dist/cli/ds.d.mts +0 -1
- package/dist/cli/ds.d.ts +0 -1
- package/dist/cli/ds.js +0 -602
- package/dist/cli/ds.js.map +0 -1
- package/dist/cli/ds.mjs +0 -579
- package/dist/cli/ds.mjs.map +0 -1
- package/dist/cli/flipova.d.mts +0 -1
- package/dist/cli/flipova.d.ts +0 -1
- package/dist/cli/flipova.js +0 -161
- package/dist/cli/flipova.js.map +0 -1
- package/dist/cli/flipova.mjs +0 -154
- package/dist/cli/flipova.mjs.map +0 -1
- package/dist/config/index.d.mts +0 -123
- package/dist/config/index.d.ts +0 -123
- package/dist/config/index.js +0 -28
- package/dist/config/index.js.map +0 -1
- package/dist/config/index.mjs +0 -3
- package/dist/config/index.mjs.map +0 -1
- package/dist/index-CuaJA3gM.d.mts +0 -78
- package/dist/index-CuaJA3gM.d.ts +0 -78
- package/dist/registry/index.d.mts +0 -10160
- package/dist/registry/index.d.ts +0 -10160
- package/dist/registry/index.js +0 -392
- package/dist/registry/index.js.map +0 -1
- package/dist/registry/index.mjs +0 -3
- package/dist/registry/index.mjs.map +0 -1
- package/dist/theme/index.d.mts +0 -109
- package/dist/theme/index.d.ts +0 -109
- package/dist/theme/index.js +0 -28
- package/dist/theme/index.js.map +0 -1
- package/dist/theme/index.mjs +0 -3
- package/dist/theme/index.mjs.map +0 -1
- package/dist/tokens/index.d.mts +0 -423
- package/dist/tokens/index.d.ts +0 -423
- package/dist/tokens/index.js +0 -44
- package/dist/tokens/index.js.map +0 -1
- package/dist/tokens/index.mjs +0 -3
- package/dist/tokens/index.mjs.map +0 -1
- package/dist/types/index.d.mts +0 -202
- package/dist/types/index.d.ts +0 -202
- package/dist/types/index.js +0 -4
- package/dist/types/index.js.map +0 -1
- package/dist/types/index.mjs +0 -3
- package/dist/types/index.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,186 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7e14947: Gate the release on the changelog entry instead of a commit subject.
|
|
8
|
+
|
|
9
|
+
## 2.0.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 592f9a1: Check the OIDC capability where id-token: write actually is.
|
|
14
|
+
|
|
15
|
+
## 2.0.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 6e4b031: Fix the release path, which could not complete a release at all.
|
|
20
|
+
|
|
21
|
+
Merging the 2.0.1 version pull request failed twice, for two unrelated reasons.
|
|
22
|
+
|
|
23
|
+
- The version pull request was red: `flow release check` wanted
|
|
24
|
+
`.changeset/release.md`, which `changeset version` had already consumed.
|
|
25
|
+
Deleting the changeset is what that command does, so a declaration still
|
|
26
|
+
saying `patch` made the invariant "a real bump implies the file exists" false
|
|
27
|
+
on the version pull request and on `main`. `flow release reset`, wired into
|
|
28
|
+
`npm run version:bump`, returns the declaration to `none` in the same step
|
|
29
|
+
that consumes the changeset, so the state is consistent everywhere with no
|
|
30
|
+
special case in the check.
|
|
31
|
+
- `main` refused to publish. The preflight read `git log -1 --pretty=%s` and
|
|
32
|
+
required a `chore: version packages` subject; on a repository that merges
|
|
33
|
+
pull requests the tip is always `Merge pull request #N from ...`, so the
|
|
34
|
+
check could never succeed. It now asks which commit **wrote the current
|
|
35
|
+
version** into `package.json`, with `git log -S`, and treats a version
|
|
36
|
+
already on the registry as nothing-to-do rather than as a failure.
|
|
37
|
+
|
|
38
|
+
Also here:
|
|
39
|
+
|
|
40
|
+
- `flow verify` runs the gate a contributor would otherwise forget: changeset
|
|
41
|
+
drift, generated files against the registries, registry validation, types.
|
|
42
|
+
It is a gate and not a formatter, so a failure always means "look at this".
|
|
43
|
+
- CONTRIBUTING is now organised around `npm run flow`: the cycle, the four
|
|
44
|
+
decisions you actually make, and what the tool handles for you.
|
|
45
|
+
- `flow issue new` writes the body as a literal YAML block. A Markdown body
|
|
46
|
+
dumped as a folded scalar doubles every blank line in it.
|
|
47
|
+
- the generated "How to Contribute" page had drifted from CONTRIBUTING: it is
|
|
48
|
+
generated from `design/documentation.xml`, not from the Markdown file, so it
|
|
49
|
+
still described the manual procedure. Both are now organised around
|
|
50
|
+
`npm run flow`.
|
|
51
|
+
|
|
52
|
+
## 2.0.1
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- 47775ca: Make the contribution flow enforceable rather than advisory, and give the
|
|
57
|
+
repository one entry point for the whole cycle: issue, changeset, branch,
|
|
58
|
+
commit, pull request.
|
|
59
|
+
|
|
60
|
+
### A single changeset, declared once
|
|
61
|
+
|
|
62
|
+
`.github/flow/release.yml` declares the bump and the summary for the cycle,
|
|
63
|
+
and `.changeset/release.md` is generated from it. `.changeset/` holds exactly
|
|
64
|
+
one file, and `flow release check` reports any drift between the declaration
|
|
65
|
+
and what `changeset version` actually reads. The version decision is one
|
|
66
|
+
reviewable file instead of a dozen that individually mean very little.
|
|
67
|
+
|
|
68
|
+
A changeset with malformed frontmatter used to stop the whole release with an
|
|
69
|
+
error naming neither the file nor the line. `flow release consolidate` folds
|
|
70
|
+
every existing changeset into the single one, and names the files it cannot
|
|
71
|
+
read instead of failing later.
|
|
72
|
+
|
|
73
|
+
### The cycle, end to end
|
|
74
|
+
|
|
75
|
+
`node .github/scripts/flow.mjs` walks the cycle in order and skips whatever is
|
|
76
|
+
already done: declare or adopt an issue, declare the release, branch, commit
|
|
77
|
+
with the `Issues:` trailer, push, open the pull request, link the issue. Every
|
|
78
|
+
step is also usable on its own, and a non-interactive run falls back to the
|
|
79
|
+
documented defaults instead of blocking on a prompt.
|
|
80
|
+
|
|
81
|
+
### Issues declared in the repository
|
|
82
|
+
|
|
83
|
+
`.github/issues/<id>.yml` declares one issue per file - id, title, labels,
|
|
84
|
+
body - and syncs it to GitHub, so a tracker entry is reviewable like any other
|
|
85
|
+
source file. `flow issue link <n>` adopts an issue that already exists on the
|
|
86
|
+
tracker. `flow link` resolves the local ids and writes `Closes #n` into the
|
|
87
|
+
pull request, refusing to reference a pull request, because GitHub shares one
|
|
88
|
+
numbering between issues and pull requests.
|
|
89
|
+
|
|
90
|
+
### Labels
|
|
91
|
+
|
|
92
|
+
`.github/labels.yml` declares every automation label with its colour, its
|
|
93
|
+
description and the paths that trigger it; `.github/labeler.yml` is generated
|
|
94
|
+
from it and checked for drift. The five labels left over from the removed
|
|
95
|
+
architecture (`blocks`, `hooks`, `layout`, `primitives`, `studio`) are gone.
|
|
96
|
+
|
|
97
|
+
### Release path
|
|
98
|
+
|
|
99
|
+
`package.json` is the single source of the version. The release workflow
|
|
100
|
+
refuses anything unexpected, authenticates against the registry before
|
|
101
|
+
uploading, and names the likely cause of a failure - missing, expired,
|
|
102
|
+
classic, or wrong-registry token - instead of failing with a bare `E404`. A
|
|
103
|
+
`hotfix` dispatch with a mandatory reason is the only way to skip the version
|
|
104
|
+
pull request.
|
|
105
|
+
|
|
106
|
+
### CI
|
|
107
|
+
|
|
108
|
+
- the issue-linkage failure now names the pull request and the two ways out:
|
|
109
|
+
link an issue, or label the pull request `no-issue`;
|
|
110
|
+
- labelling a pull request `changeset:major|minor|patch|none` makes the guard
|
|
111
|
+
write the changeset, commit it to the branch and explain itself;
|
|
112
|
+
- the design registry gate runs on every pull request and on `main`;
|
|
113
|
+
- line endings are normalised (`.gitattributes`), so a generated file can no
|
|
114
|
+
longer look out of date only on Windows.
|
|
115
|
+
|
|
116
|
+
## 2.0.0
|
|
117
|
+
|
|
118
|
+
### Major Changes
|
|
119
|
+
|
|
120
|
+
- 387bd75: The design system is now a **single registry-driven pipeline**: the XML registries
|
|
121
|
+
are the only source of truth, and they generate the entire gluestack/nativewind
|
|
122
|
+
theme.
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
design/tokens.xml ┐
|
|
126
|
+
├─> components/ui/gluestack-ui-provider/config.ts (colour vars, light/dark)
|
|
127
|
+
design/themes.xml ┘ components/ui/gluestack-ui-provider/tokens.js (the whole Tailwind theme)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Role ids in `themes.xml` are now the gluestack CSS variable names
|
|
131
|
+
(`primary-foreground`, `card-foreground`, ...), emitted as space-separated RGB
|
|
132
|
+
triplets so Tailwind opacity modifiers (`bg-primary/50`) keep working.
|
|
133
|
+
|
|
134
|
+
## Breaking changes
|
|
135
|
+
|
|
136
|
+
- **The XML element generator is gone.** `uiElement` / `uiHook` definitions, the
|
|
137
|
+
5-files-per-element output, the generated `foundation/**` tree, the showroom
|
|
138
|
+
pages and the generated vitest suites are removed. The component source under
|
|
139
|
+
`components/ui` is now edited directly. `design/schema.xsd` only declares
|
|
140
|
+
`foundationRegistry`, `documentation`, `tokens` and `themes`.
|
|
141
|
+
- **`tailwind.config.js` no longer contains design values.** Consumers must wire
|
|
142
|
+
the generated theme themselves:
|
|
143
|
+
```js
|
|
144
|
+
const tokens = require("@flipova/foundation/tokens");
|
|
145
|
+
module.exports = {
|
|
146
|
+
presets: [require("nativewind/preset")],
|
|
147
|
+
theme: { extend: tokens.theme },
|
|
148
|
+
};
|
|
149
|
+
```
|
|
150
|
+
`tailwind.config.js`, `globals.css` and `postcss.config.js` are app-level files
|
|
151
|
+
and are not published; see the Installation page for the three-file setup.
|
|
152
|
+
- **Removed Tailwind aliases** (all unused in `components/`): colours
|
|
153
|
+
`chart-1..5`, `sidebar-*`, `typography-*`; font families `inter`, `georgia`,
|
|
154
|
+
`melno`, `andika`, `outfit`; font weight `extrablack`.
|
|
155
|
+
- **`font-mono` / `font-serif` now resolve from the registry** (literal stacks)
|
|
156
|
+
instead of `var(--font-mono)` / `var(--font-serif)`.
|
|
157
|
+
- Apps must define `--font-sans` (used by `font-sans` / `font-body`) and
|
|
158
|
+
`--font-heading` if those families are used; otherwise the text falls back to
|
|
159
|
+
the inherited font. `font-system`, `font-mono` and `font-serif` need no
|
|
160
|
+
variable.
|
|
161
|
+
|
|
162
|
+
## Added
|
|
163
|
+
|
|
164
|
+
- New `@flipova/foundation/tokens` export (typed) exposing the generated Tailwind
|
|
165
|
+
theme, so the design tokens are reachable by package name.
|
|
166
|
+
- Semantic colours `success`, `warning`, `error`, `info` and every
|
|
167
|
+
`*-foreground` counterpart are now available as utilities
|
|
168
|
+
(`bg-success`, `text-error-foreground`, ...) - the variables existed but were
|
|
169
|
+
not mapped in Tailwind.
|
|
170
|
+
- `font-roboto` now resolves (it was previously absent from the Tailwind config
|
|
171
|
+
and silently produced nothing).
|
|
172
|
+
- Scale tokens are exposed as utilities: `spacing`, `borderRadius`, `screens`
|
|
173
|
+
(`xs:` `md:` `lg:` `2xl:`), `fontSize` (including `text-2xs`), `fontWeight`,
|
|
174
|
+
`lineHeight`, `letterSpacing`, `boxShadow` (including `shadow-hard-*` /
|
|
175
|
+
`shadow-soft-*`), `zIndex` (`z-modal`, `z-toast`, ...), `opacity`,
|
|
176
|
+
`transitionDuration` and `transitionTimingFunction`.
|
|
177
|
+
|
|
178
|
+
## 1.14.0
|
|
179
|
+
|
|
180
|
+
### Minor Changes
|
|
181
|
+
|
|
182
|
+
- 33523d8: Add comprehensive guide and documentation for integrating Flipova Foundation design tokens and theming system with external React Web component libraries (shadcn/ui, Radix UI, Material UI, Tailwind CSS).
|
|
183
|
+
|
|
3
184
|
## 1.13.0
|
|
4
185
|
|
|
5
186
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -3,213 +3,88 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@flipova/foundation)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
gluestack-ui components for React Native (iOS, Android) and Web, plus a
|
|
7
|
+
registry-driven theming pipeline.
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
## Design pipeline
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
The design pipeline has a single function:
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
> **`design/tokens.xml` + `design/themes.xml`**
|
|
14
|
+
> * -> `components/ui/gluestack-ui-provider/config.ts` (gluestack / nativewind colour vars)
|
|
15
|
+
> * -> `components/ui/gluestack-ui-provider/tokens.js` (Tailwind/nativewind token theme)
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
- **Interactive CLI Tools**: Includes `flipova` and `flipova-ds` to instantly scaffold projects, manage design system registries, and handle themes natively from the terminal.
|
|
17
|
+
Role ids in `themes.xml` are the gluestack CSS variable names (dash-prefixed at
|
|
18
|
+
generation time), so the design registry and the runtime theme config always
|
|
19
|
+
speak the same language. Every colour is emitted as a space-separated RGB
|
|
20
|
+
triplet, enabling Tailwind opacity modifiers such as `bg-primary/50`.
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
### For React Web Projects
|
|
27
|
-
|
|
28
|
-
The web version is extremely lightweight. It installs only what is necessary for DOM-based environments, completely bypassing React Native abstractions.
|
|
22
|
+
The scale tokens (spacing, radii, breakpoints, typography, shadow, z-index,
|
|
23
|
+
opacity, motion) are emitted as a Tailwind `theme` fragment, and the semantic
|
|
24
|
+
colours are derived from the `themes.xml` roles. `tailwind.config.js` contains
|
|
25
|
+
**no design value**: it just does `extend: tokens.theme`. The XML registries are
|
|
26
|
+
therefore the single source of truth for both the gluestack runtime vars and
|
|
27
|
+
the Tailwind/nativewind theme.
|
|
29
28
|
|
|
30
29
|
```bash
|
|
31
|
-
npm
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### For React Native / Expo Projects
|
|
35
|
-
|
|
36
|
-
For native environments, Flipova leverages your existing Expo and React Native ecosystem. Install the package alongside its optional native peer dependencies:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
npm install @flipova/foundation
|
|
40
|
-
|
|
41
|
-
# Install required native peer dependencies
|
|
42
|
-
npx expo install react-native-screens react-native-safe-area-context react-native-gesture-handler react-native-reanimated expo-linear-gradient expo-haptics @expo/vector-icons lucide-react-native
|
|
30
|
+
npm run design:pipeline # gen + check + verify + lint + doc
|
|
43
31
|
```
|
|
44
32
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
|
|
|
55
|
-
| **`@flipova/foundation/layout`**| Layout hooks (`useBreakpoint`, `useSafeArea`), and declarative registries. | Native |
|
|
56
|
-
| **`@flipova/foundation/tokens`**| Core design tokens (spacing, radii, colors, typography). | Native & Web |
|
|
57
|
-
| **`@flipova/foundation/theme`** | Theme system, ThemeProvider context, and ColorScheme utilities. | Native & Web |
|
|
58
|
-
| **`@flipova/foundation/config`**| Configuration engine (`defineConfig`, `FoundationProvider`). | Native & Web |
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## Core Concepts & Usage
|
|
33
|
+
| Script | What it does |
|
|
34
|
+
| :--- | :--- |
|
|
35
|
+
| `npm run design:gen` | compile tokens/themes into `config.ts` + `tokens.js` |
|
|
36
|
+
| `npm run design:gen:check` | verify regeneration is a no-op (drift check) |
|
|
37
|
+
| `npm run design:check` | determinism rules + XSD pass + ruff |
|
|
38
|
+
| `npm run design:verify` | verify the committed canonical index |
|
|
39
|
+
| `npm run design:canonical` | re-emit `design/canonical.index.txt` |
|
|
40
|
+
| `npm run design:lint` | XSD-validate every design XML |
|
|
41
|
+
| `npm run design:doc` | regenerate the docs site (`docs/generated`) |
|
|
42
|
+
| `npm run design:edit` | open the XSD-driven XML editor |
|
|
63
43
|
|
|
64
|
-
|
|
44
|
+
Never hand-edit the generated `config.ts`, `tokens.js` or `docs/generated/**` -
|
|
45
|
+
the next run overwrites them. And never add a design value to
|
|
46
|
+
`tailwind.config.js`: it only wires the generated theme.
|
|
65
47
|
|
|
66
|
-
|
|
48
|
+
## Install
|
|
67
49
|
|
|
68
50
|
```bash
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
### 2. Initialization and Theming
|
|
73
|
-
|
|
74
|
-
Whether you are on the Web or Native, initializing the design system requires a Provider.
|
|
75
|
-
|
|
76
|
-
**React Native (App.tsx):**
|
|
77
|
-
```tsx
|
|
78
|
-
import { FoundationProvider, defineConfig } from "@flipova/foundation/config";
|
|
79
|
-
import { Box, Button } from "@flipova/foundation";
|
|
80
|
-
|
|
81
|
-
const config = defineConfig({
|
|
82
|
-
defaultTheme: "light",
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
export default function App() {
|
|
86
|
-
return (
|
|
87
|
-
<FoundationProvider config={config}>
|
|
88
|
-
<Box padding="xl" backgroundColor="background">
|
|
89
|
-
<Button label="Welcome to Flipova" variant="primary" />
|
|
90
|
-
</Box>
|
|
91
|
-
</FoundationProvider>
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
**React Web (App.tsx):**
|
|
97
|
-
```tsx
|
|
98
|
-
import { ThemeProvider } from "@flipova/foundation/theme";
|
|
99
|
-
import { Box } from "@flipova/foundation/web";
|
|
100
|
-
|
|
101
|
-
export default function App() {
|
|
102
|
-
return (
|
|
103
|
-
<ThemeProvider defaultTheme="light">
|
|
104
|
-
<Box padding="xl" backgroundColor="background">
|
|
105
|
-
<h1>Web Experience</h1>
|
|
106
|
-
</Box>
|
|
107
|
-
</ThemeProvider>
|
|
108
|
-
);
|
|
109
|
-
}
|
|
51
|
+
npm install @flipova/foundation
|
|
52
|
+
npm install gluestack-ui
|
|
53
|
+
npx flipova-design init
|
|
110
54
|
```
|
|
111
55
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
The `ThemeProvider` allows you to customize the default tokens and color schemes. You can override specific variables or introduce completely new themes (e.g., "neon" or "high-contrast").
|
|
56
|
+
Then wire the generated theme into your Tailwind config (app-level files are not
|
|
57
|
+
shipped by the package):
|
|
115
58
|
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
card: "#111111",
|
|
123
|
-
border: "#333333",
|
|
124
|
-
primary: "#ff00ff",
|
|
125
|
-
muted: "#555555",
|
|
126
|
-
success: "#00ff00",
|
|
127
|
-
error: "#ff0000",
|
|
128
|
-
// ... (other required tokens)
|
|
59
|
+
```js
|
|
60
|
+
// tailwind.config.js
|
|
61
|
+
const tokens = require('@flipova/foundation/tokens');
|
|
62
|
+
module.exports = {
|
|
63
|
+
presets: [require('nativewind/preset')],
|
|
64
|
+
theme: { extend: tokens.theme },
|
|
129
65
|
};
|
|
130
|
-
|
|
131
|
-
export default function App() {
|
|
132
|
-
return (
|
|
133
|
-
<ThemeProvider
|
|
134
|
-
defaultTheme="neon"
|
|
135
|
-
customThemes={{ neon: customNeonTheme }}
|
|
136
|
-
>
|
|
137
|
-
{/* Your app */}
|
|
138
|
-
</ThemeProvider>
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
66
|
```
|
|
142
67
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
Flipova strongly discourages inline styling. Instead, all structural layouts should be composed using foundational primitives. This guarantees identical spacing and alignment across web and mobile.
|
|
146
|
-
|
|
147
|
-
- **`Box`**: The lowest-level building block. Supports padding, margins, borders, and background tokens.
|
|
148
|
-
- **`Stack`**: A vertical flex container with configurable `gap` spacing.
|
|
149
|
-
- **`Inline`**: A horizontal flex container with configurable `gap` spacing and wrapping capabilities.
|
|
150
|
-
- **`Center`**: Utility primitive to vertically and horizontally align its children.
|
|
68
|
+
and mount the provider once at the root:
|
|
151
69
|
|
|
152
|
-
**Example: Building a User Card**
|
|
153
70
|
```tsx
|
|
154
|
-
import {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
export function UserCard() {
|
|
158
|
-
return (
|
|
159
|
-
<Box padding="lg" borderRadius="md" backgroundColor="surface">
|
|
160
|
-
<Inline gap="md" align="center">
|
|
161
|
-
<Avatar src="https://example.com/avatar.png" size="lg" />
|
|
162
|
-
<Stack gap="xs" flex={1}>
|
|
163
|
-
<Text variant="heading">John Doe</Text>
|
|
164
|
-
<Text variant="body" color="muted">Software Engineer</Text>
|
|
165
|
-
</Stack>
|
|
166
|
-
<Button label="Follow" variant="secondary" />
|
|
167
|
-
</Inline>
|
|
168
|
-
</Box>
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
### 5. Managing the Design System
|
|
175
|
-
|
|
176
|
-
Flipova Foundation provides a powerful interactive CLI to manage your design system directly from the terminal.
|
|
177
|
-
|
|
178
|
-
```bash
|
|
179
|
-
npx flipova-ds
|
|
71
|
+
import { GluestackUIProvider } from '@flipova/foundation/ui';
|
|
72
|
+
// <GluestackUIProvider mode="system"> ... </GluestackUIProvider>
|
|
180
73
|
```
|
|
181
74
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
- **Manage the Registry**: Browse, add, or remove UI primitives, components, or layout definitions.
|
|
185
|
-
- **Generate Tokens**: Recompile TypeScript definitions from your `tokens.yaml` and `themes.yaml` sources.
|
|
186
|
-
- **Generate Documentation**: Build a 1-to-1 mirror MDX documentation site straight from `.meta.yaml` and TSDoc sources.
|
|
187
|
-
|
|
188
|
-
Whenever you make manual changes to `themes.yaml`, `tokens.yaml`, or registry metadata files, running `npx flipova-ds` allows you to rapidly regenerate the type definitions (`generated.ts`).
|
|
189
|
-
|
|
190
|
-
---
|
|
75
|
+
Full setup, including the required `--font-sans` / `--font-heading` variables:
|
|
76
|
+
see the documentation site.
|
|
191
77
|
|
|
192
|
-
## Documentation
|
|
78
|
+
## Documentation
|
|
193
79
|
|
|
194
|
-
|
|
80
|
+
The full guide (installation, theming, tokens, the gluestack config, tools,
|
|
81
|
+
contributing) is generated from `design/documentation.xml` into the Docusaurus
|
|
82
|
+
site under `docs/`:
|
|
195
83
|
|
|
196
84
|
```bash
|
|
197
|
-
|
|
198
|
-
npm run docs:dev
|
|
199
|
-
|
|
200
|
-
# Build static production site into docs/build
|
|
201
|
-
npm run docs:build
|
|
202
|
-
|
|
203
|
-
# Preview production build locally
|
|
204
|
-
npm run docs:preview
|
|
85
|
+
cd docs && npm start
|
|
205
86
|
```
|
|
206
87
|
|
|
207
|
-
---
|
|
208
|
-
|
|
209
|
-
## Contributing
|
|
210
|
-
|
|
211
|
-
We welcome contributions to the Flipova Foundation! Please refer to the `CONTRIBUTING.md` file in the root of the repository for detailed instructions on the development workflow, branching strategies, and instructions for adding new components.
|
|
212
|
-
|
|
213
88
|
## License
|
|
214
89
|
|
|
215
90
|
MIT © Flipova
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Accordion Animation Customization
|
|
2
|
+
|
|
3
|
+
The Accordion component now uses **React Native Reanimated** for smooth, performant animations that run on the UI thread.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
✅ **Smooth 60fps animations** on native
|
|
8
|
+
✅ **Icon rotation** when accordion expands/collapses
|
|
9
|
+
✅ **Fully customizable** animation timings and behavior
|
|
10
|
+
✅ **No JS thread blocking** - animations run independently
|
|
11
|
+
|
|
12
|
+
## Customizing Animations
|
|
13
|
+
|
|
14
|
+
All animation configurations are located in `animation-config.ts`. Simply modify this file to customize the accordion's animation behavior.
|
|
15
|
+
|
|
16
|
+
### Available Options
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
// src/components/ui/accordion/animation-config.ts
|
|
20
|
+
|
|
21
|
+
export const accordionAnimationConfig = {
|
|
22
|
+
/**
|
|
23
|
+
* Duration for content expand/collapse animation (in milliseconds)
|
|
24
|
+
* @default 300
|
|
25
|
+
*/
|
|
26
|
+
contentDuration: 300,
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Duration for icon rotation animation (in milliseconds)
|
|
30
|
+
* @default 300
|
|
31
|
+
*/
|
|
32
|
+
iconDuration: 300,
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Rotation angle for icon when accordion is expanded (in degrees)
|
|
36
|
+
* @default 180 (upside down)
|
|
37
|
+
* @example 90 (quarter turn), 270 (three-quarter turn), -180 (rotate counterclockwise)
|
|
38
|
+
*/
|
|
39
|
+
iconRotation: 180,
|
|
40
|
+
};
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Example Customizations
|
|
44
|
+
|
|
45
|
+
#### Faster Animations
|
|
46
|
+
```typescript
|
|
47
|
+
export const accordionAnimationConfig = {
|
|
48
|
+
contentDuration: 150, // Faster expand/collapse
|
|
49
|
+
iconDuration: 150, // Faster icon rotation
|
|
50
|
+
iconRotation: 180,
|
|
51
|
+
};
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### Slower, More Dramatic
|
|
55
|
+
```typescript
|
|
56
|
+
export const accordionAnimationConfig = {
|
|
57
|
+
contentDuration: 500, // Slower, more visible
|
|
58
|
+
iconDuration: 400, // Slightly faster icon
|
|
59
|
+
iconRotation: 180,
|
|
60
|
+
};
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### Different Icon Rotation
|
|
64
|
+
```typescript
|
|
65
|
+
export const accordionAnimationConfig = {
|
|
66
|
+
contentDuration: 300,
|
|
67
|
+
iconDuration: 300,
|
|
68
|
+
iconRotation: 90, // Quarter turn instead of flip
|
|
69
|
+
};
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
#### No Icon Rotation
|
|
73
|
+
```typescript
|
|
74
|
+
export const accordionAnimationConfig = {
|
|
75
|
+
contentDuration: 300,
|
|
76
|
+
iconDuration: 0, // Instant (no animation)
|
|
77
|
+
iconRotation: 0, // No rotation
|
|
78
|
+
};
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Advanced Customization
|
|
82
|
+
|
|
83
|
+
If you need more control over the animation (easing curves, spring physics, etc.), you can modify the components directly:
|
|
84
|
+
|
|
85
|
+
### Custom Easing for Content
|
|
86
|
+
|
|
87
|
+
Edit `AnimatedHeight.tsx`:
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
// Change from timing to spring
|
|
91
|
+
height.value = withSpring(measurement.height, {
|
|
92
|
+
damping: 15,
|
|
93
|
+
stiffness: 150,
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Custom Icon Animation Curve
|
|
98
|
+
|
|
99
|
+
Edit `AnimatedIcon.tsx`:
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
// Add custom easing
|
|
103
|
+
animatedValue.value = withTiming(isExpanded ? 1 : 0, {
|
|
104
|
+
duration,
|
|
105
|
+
easing: Easing.bezier(0.25, 0.1, 0.25, 1), // Custom bezier curve
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Migration from Old Implementation
|
|
110
|
+
|
|
111
|
+
### What Changed
|
|
112
|
+
|
|
113
|
+
**Before (Old Animated API):**
|
|
114
|
+
- ❌ Ran on JS thread (could drop frames)
|
|
115
|
+
- ❌ Hardcoded 200ms duration in core
|
|
116
|
+
- ❌ No icon rotation
|
|
117
|
+
- ❌ Not customizable
|
|
118
|
+
|
|
119
|
+
**After (Reanimated):**
|
|
120
|
+
- ✅ Runs on UI thread (60fps always)
|
|
121
|
+
- ✅ Customizable durations
|
|
122
|
+
- ✅ Icon rotation included
|
|
123
|
+
- ✅ Fully customizable in style file
|
|
124
|
+
|
|
125
|
+
### Breaking Changes
|
|
126
|
+
|
|
127
|
+
None! The API remains the same. Your existing accordion code will work without changes.
|
|
128
|
+
|
|
129
|
+
## Why Reanimated?
|
|
130
|
+
|
|
131
|
+
**Performance:** Animations run on the UI thread, ensuring smooth 60fps even when:
|
|
132
|
+
- Fetching data
|
|
133
|
+
- Rendering lists
|
|
134
|
+
- Running heavy JavaScript operations
|
|
135
|
+
- Navigating between screens
|
|
136
|
+
|
|
137
|
+
**Better User Experience:** Users will notice the difference, especially on:
|
|
138
|
+
- Mid-range and low-end devices
|
|
139
|
+
- During app startup
|
|
140
|
+
- When multiple things are happening at once
|
|
141
|
+
|
|
142
|
+
## Files Overview
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
accordion/
|
|
146
|
+
├── index.tsx # Main component (imports animations)
|
|
147
|
+
├── AnimatedHeight.tsx # Reanimated height animation
|
|
148
|
+
├── AnimatedIcon.tsx # Reanimated icon rotation
|
|
149
|
+
├── animation-config.ts # 👈 CUSTOMIZE HERE
|
|
150
|
+
└── ANIMATION_CUSTOMIZATION.md # This file
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Need Help?
|
|
154
|
+
|
|
155
|
+
If you want to implement more complex animations:
|
|
156
|
+
1. Check the [Reanimated documentation](https://docs.swmansion.com/react-native-reanimated/)
|
|
157
|
+
2. Look at `AnimatedHeight.tsx` and `AnimatedIcon.tsx` for examples
|
|
158
|
+
3. All standard Reanimated APIs are available
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
**Note:** These animations are optimized for native platforms. On web, they still work but use JavaScript-based animations (consistent with Reanimated's web support).
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LayoutChangeEvent } from 'react-native';
|
|
3
|
+
import Animated, {
|
|
4
|
+
useSharedValue,
|
|
5
|
+
useAnimatedStyle,
|
|
6
|
+
withTiming,
|
|
7
|
+
} from 'react-native-reanimated';
|
|
8
|
+
|
|
9
|
+
interface AnimatedHeightProps {
|
|
10
|
+
isExpanded: boolean;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
duration?: number;
|
|
13
|
+
style?: any;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const AnimatedHeight: React.FC<AnimatedHeightProps> = ({
|
|
17
|
+
isExpanded,
|
|
18
|
+
children,
|
|
19
|
+
duration = 300,
|
|
20
|
+
style,
|
|
21
|
+
}) => {
|
|
22
|
+
const measuredHeight = useSharedValue(0);
|
|
23
|
+
const progress = useSharedValue(isExpanded ? 1 : 0);
|
|
24
|
+
|
|
25
|
+
const onLayout = (event: LayoutChangeEvent) => {
|
|
26
|
+
const height = event.nativeEvent.layout.height;
|
|
27
|
+
if (height > 0 && measuredHeight.value !== height) {
|
|
28
|
+
measuredHeight.value = height;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// Update progress when isExpanded changes
|
|
33
|
+
React.useEffect(() => {
|
|
34
|
+
progress.value = withTiming(isExpanded ? 1 : 0, { duration });
|
|
35
|
+
}, [isExpanded, duration]);
|
|
36
|
+
|
|
37
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
38
|
+
const height = progress.value * measuredHeight.value;
|
|
39
|
+
return {
|
|
40
|
+
height,
|
|
41
|
+
opacity: progress.value,
|
|
42
|
+
overflow: 'hidden',
|
|
43
|
+
};
|
|
44
|
+
}, [progress, measuredHeight]);
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<Animated.View style={[animatedStyle, style]}>
|
|
48
|
+
<Animated.View
|
|
49
|
+
onLayout={onLayout}
|
|
50
|
+
style={{ position: 'absolute', width: '100%' }}
|
|
51
|
+
>
|
|
52
|
+
{children}
|
|
53
|
+
</Animated.View>
|
|
54
|
+
</Animated.View>
|
|
55
|
+
);
|
|
56
|
+
};
|