@facto-to/design-system 0.1.0-beta.1 → 0.1.0-beta.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.
- package/AI.md +33 -0
- package/README.md +13 -5
- package/bin/facto-ui-skill.mjs +3 -0
- package/bin/install-skill-lib.mjs +38 -0
- package/dist/ai/LICENSE +204 -0
- package/dist/ai/SKILL.md +25 -0
- package/dist/ai/agents/openai.yaml +4 -0
- package/dist/ai/assets/AdoptionDemo.tsx +72 -0
- package/dist/ai/assets/adoption.css +30 -0
- package/dist/ai/references/api.d.ts +213 -0
- package/dist/ai/references/catalog.json +193 -0
- package/dist/ai/references/components.md +15 -0
- package/dist/ai/references/composition.md +40 -0
- package/dist/ai/references/design.md +42 -0
- package/dist/ai/references/integration.md +54 -0
- package/dist/ai/references/migration.md +43 -0
- package/dist/ai/references/multi-repo.md +24 -0
- package/dist/ai/references/tokens.css +147 -0
- package/dist/ai/references/version.json +11 -0
- package/dist/styles.css +1 -1
- package/dist/tokens.css +4 -0
- package/package.json +24 -6
package/AI.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Facto UI: AI entry point
|
|
2
|
+
|
|
3
|
+
This package includes its own version-matched Agent Skill. Start here when adopting Facto UI or replacing mismatched components/fonts/styles in one or several frontend repositories. No MCP or remote knowledge service is required. Installing npm does not automatically activate a skill in your AI client.
|
|
4
|
+
|
|
5
|
+
## Read only what this task needs
|
|
6
|
+
|
|
7
|
+
All paths below are relative to this installed package directory:
|
|
8
|
+
|
|
9
|
+
1. Read [version metadata](dist/ai/references/version.json) and compare the target application's resolved package/React versions. Prefer the installed package's references over a globally installed skill snapshot.
|
|
10
|
+
2. Read [SKILL.md](dist/ai/SKILL.md) for the workflow. For multiple repositories, read [multi-repo.md](dist/ai/references/multi-repo.md); inspect and verify each repository separately.
|
|
11
|
+
3. Find actual exports in [catalog.json](dist/ai/references/catalog.json), then search [dist/index.d.ts](dist/index.d.ts) for the selected component's exact props. Do not guess shadcn or other libraries' APIs.
|
|
12
|
+
4. For replacements, read [migration.md](dist/ai/references/migration.md). Preserve routes, data, auth, form validation and event behavior. Use a scoped token adapter for widgets without a Facto equivalent.
|
|
13
|
+
5. For fonts/themes, read [integration.md](dist/ai/references/integration.md), [design.md](dist/ai/references/design.md) and only the relevant properties in [tokens.css](dist/tokens.css).
|
|
14
|
+
6. For composed workflows, read [composition.md](dist/ai/references/composition.md) for state ownership, async guards, layered overlays, focus and Undo behavior. Adapt the [mock recipe](dist/ai/assets/AdoptionDemo.tsx) and [scoped CSS](dist/ai/assets/adoption.css) where useful. Never replace live business data/handlers with mock example state.
|
|
15
|
+
|
|
16
|
+
Quick constraints: React/React DOM 19; styles.css includes tokens; fonts.css registers Inter and must be imported to load it. Legacy HTML is not automatically restyled. SearchField uses native onChange; EnhancedSearchField and Select use onValueChange; Button defaults to type="button"; Toast is composed of provider/root/viewport, not toast.success(). There is no exported data table, chart, date picker or router.
|
|
17
|
+
|
|
18
|
+
## Optional skill installation
|
|
19
|
+
|
|
20
|
+
From the frontend repository where this package is installed:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
# Team/project-scoped Codex skill
|
|
24
|
+
node node_modules/@facto-to/design-system/bin/facto-ui-skill.mjs --target .agents/skills
|
|
25
|
+
# Team/project-scoped Claude Code skill
|
|
26
|
+
node node_modules/@facto-to/design-system/bin/facto-ui-skill.mjs --target .claude/skills
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The installed command `facto-ui-skill --target <skills-directory>` is also exposed through package-manager execution. The direct Node form above uses only the already installed package, with no download or server. For hoisted/Plug'n'Play workspaces, use the package manager's local binary runner from the correct workspace.
|
|
30
|
+
|
|
31
|
+
An explicit destination is required. Existing skills are never overwritten. For updates, compare and move the old directory outside skill search locations first. Personal skill locations can be used instead of project directories. Skill discovery is client-specific; explicit invocation is reliable after the client discovers it. Use `$facto-ui` in Codex or `/facto-ui` in Claude Code.
|
|
32
|
+
|
|
33
|
+
Alternatively, ask any coding assistant with filesystem access to read this AI.md directly; installing the Skill is optional. Give it the paths of the target repositories and the desired migration scope. This grants no automatic access to other repositories or deployment accounts.
|
package/README.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
React components and extensible design tokens with the Facto Dashboard appearance as the default. Includes self-hosted Inter fonts and TypeScript declarations.
|
|
4
4
|
|
|
5
|
+
[Source repository](https://github.com/Facto-to/design-system) · [Integration guide](https://github.com/Facto-to/design-system/blob/main/docs/usage.md)
|
|
6
|
+
|
|
7
|
+
Repository access is controlled separately from the public npm package; installing the package does not require GitHub access.
|
|
8
|
+
|
|
9
|
+
## AI-assisted adoption and migration
|
|
10
|
+
|
|
11
|
+
Coding assistants: start with [AI.md](./AI.md). This package includes the version-matched [Facto UI Skill](./dist/ai/SKILL.md), component catalog, declarations, tokens and tested mock recipe. Use it to create UI or migrate components/styles across existing frontend repositories while preserving business behavior. No MCP, GitHub access or separately downloaded documentation is required after npm installation. The skill can also be installed into Codex or Claude Code; see AI.md.
|
|
12
|
+
|
|
5
13
|
## Requirements
|
|
6
14
|
|
|
7
15
|
- React and React DOM 19.
|
|
@@ -10,16 +18,16 @@ React components and extensible design tokens with the Facto Dashboard appearanc
|
|
|
10
18
|
|
|
11
19
|
## Install
|
|
12
20
|
|
|
13
|
-
|
|
21
|
+
Install the beta (requires React 19):
|
|
14
22
|
|
|
15
23
|
```sh
|
|
16
|
-
npm install @facto-to/design-system@beta react@^19 react-dom@^19
|
|
24
|
+
npm install @facto-to/design-system@0.1.0-beta.3 react@^19 react-dom@^19
|
|
17
25
|
```
|
|
18
26
|
|
|
19
|
-
|
|
27
|
+
For local development, you can also install a generated archive:
|
|
20
28
|
|
|
21
29
|
```sh
|
|
22
|
-
npm install /path/to/facto-to-design-system-0.1.0-beta.
|
|
30
|
+
npm install /path/to/facto-to-design-system-0.1.0-beta.3.tgz
|
|
23
31
|
```
|
|
24
32
|
|
|
25
33
|
## Usage
|
|
@@ -90,7 +98,7 @@ To use only the tokens in a separate UI, import `@facto-to/design-system/tokens.
|
|
|
90
98
|
|
|
91
99
|
## Package boundaries
|
|
92
100
|
|
|
93
|
-
The package contains components, CSS, types, and
|
|
101
|
+
The package contains components, CSS, types, fonts, public AI guidance, an optional skill installer and a small synthetic adoption recipe. The Storybook application, business datasets, tests, business APIs, authentication, wallet integrations, and environment files are not included. Components do not initiate business API calls or persist form values; applications own their data and event handlers.
|
|
94
102
|
|
|
95
103
|
React and React DOM are peer dependencies; Radix primitives are runtime dependencies. Inter font files retain their SIL Open Font License in `dist/fonts/OFL.txt`. Font licensing is separate from the component source license.
|
|
96
104
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { cp, lstat, mkdir, readdir, rm, realpath } from 'node:fs/promises'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { fileURLToPath } from 'node:url'
|
|
4
|
+
|
|
5
|
+
export async function installSkill(sourceUrl, args) {
|
|
6
|
+
if (args.length !== 2 || args[0] !== '--target' || !args[1]) {
|
|
7
|
+
throw new Error('Usage: facto-ui-skill --target <skills-directory> (creates facto-ui; refuses existing files)')
|
|
8
|
+
}
|
|
9
|
+
const source = await realpath(fileURLToPath(sourceUrl))
|
|
10
|
+
async function checkTree(directory) {
|
|
11
|
+
for (const entry of await readdir(directory, { withFileTypes: true })) {
|
|
12
|
+
if (entry.isSymbolicLink()) throw new Error('Skill must not contain symlinks')
|
|
13
|
+
if (entry.isDirectory()) await checkTree(path.join(directory, entry.name))
|
|
14
|
+
else if (!entry.isFile()) throw new Error('Skill must contain only regular files')
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
await checkTree(source)
|
|
18
|
+
const parent = path.resolve(args[1])
|
|
19
|
+
// Check lexical containment before creating anything, then real containment for symlinked parents.
|
|
20
|
+
const inside = candidate => candidate === source || candidate.startsWith(source + path.sep)
|
|
21
|
+
if (inside(parent)) throw new Error('Destination cannot be inside the source skill')
|
|
22
|
+
await mkdir(parent, { recursive: true })
|
|
23
|
+
if (inside(await realpath(parent))) throw new Error('Destination cannot be inside the source skill')
|
|
24
|
+
const target = path.join(parent, 'facto-ui')
|
|
25
|
+
await mkdir(target) // non-recursive: existing directories and symlinks are never overwritten
|
|
26
|
+
try {
|
|
27
|
+
// The target is reserved above. Copy its children: Node 22 rejects cp of
|
|
28
|
+
// the source directory itself onto an existing target with errorOnExist.
|
|
29
|
+
for (const entry of await readdir(source)) {
|
|
30
|
+
await cp(path.join(source, entry), path.join(target, entry), { recursive: true, force: false, errorOnExist: true })
|
|
31
|
+
}
|
|
32
|
+
if (!(await lstat(path.join(target, 'SKILL.md'))).isFile()) throw new Error('Missing SKILL.md')
|
|
33
|
+
} catch (error) {
|
|
34
|
+
await rm(target, { recursive: true, force: true })
|
|
35
|
+
throw error
|
|
36
|
+
}
|
|
37
|
+
console.log(`Installed Facto UI skill: ${target}`)
|
|
38
|
+
}
|
package/dist/ai/LICENSE
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
Copyright 2026 Facto
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
Apache License
|
|
5
|
+
Version 2.0, January 2004
|
|
6
|
+
http://www.apache.org/licenses/
|
|
7
|
+
|
|
8
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
9
|
+
|
|
10
|
+
1. Definitions.
|
|
11
|
+
|
|
12
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
13
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
14
|
+
|
|
15
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
16
|
+
the copyright owner that is granting the License.
|
|
17
|
+
|
|
18
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
19
|
+
other entities that control, are controlled by, or are under common
|
|
20
|
+
control with that entity. For the purposes of this definition,
|
|
21
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
22
|
+
direction or management of such entity, whether by contract or
|
|
23
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
24
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
25
|
+
|
|
26
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
27
|
+
exercising permissions granted by this License.
|
|
28
|
+
|
|
29
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
30
|
+
including but not limited to software source code, documentation
|
|
31
|
+
source, and configuration files.
|
|
32
|
+
|
|
33
|
+
"Object" form shall mean any form resulting from mechanical
|
|
34
|
+
transformation or translation of a Source form, including but
|
|
35
|
+
not limited to compiled object code, generated documentation,
|
|
36
|
+
and conversions to other media types.
|
|
37
|
+
|
|
38
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
39
|
+
Object form, made available under the License, as indicated by a
|
|
40
|
+
copyright notice that is included in or attached to the work
|
|
41
|
+
(an example is provided in the Appendix below).
|
|
42
|
+
|
|
43
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
44
|
+
form, that is based on (or derived from) the Work and for which the
|
|
45
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
46
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
47
|
+
of this License, Derivative Works shall not include works that remain
|
|
48
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
49
|
+
the Work and Derivative Works thereof.
|
|
50
|
+
|
|
51
|
+
"Contribution" shall mean any work of authorship, including
|
|
52
|
+
the original version of the Work and any modifications or additions
|
|
53
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
54
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
55
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
56
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
57
|
+
means any form of electronic, verbal, or written communication sent
|
|
58
|
+
to the Licensor or its representatives, including but not limited to
|
|
59
|
+
communication on electronic mailing lists, source code control systems,
|
|
60
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
61
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
62
|
+
excluding communication that is conspicuously marked or otherwise
|
|
63
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
64
|
+
|
|
65
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
66
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
67
|
+
subsequently incorporated within the Work.
|
|
68
|
+
|
|
69
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
70
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
71
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
72
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
73
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
74
|
+
Work and such Derivative Works in Source or Object form.
|
|
75
|
+
|
|
76
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
77
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
78
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
79
|
+
(except as stated in this section) patent license to make, have made,
|
|
80
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
81
|
+
where such license applies only to those patent claims licensable
|
|
82
|
+
by such Contributor that are necessarily infringed by their
|
|
83
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
84
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
85
|
+
institute patent litigation against any entity (including a
|
|
86
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
87
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
88
|
+
or contributory patent infringement, then any patent licenses
|
|
89
|
+
granted to You under this License for that Work shall terminate
|
|
90
|
+
as of the date such litigation is filed.
|
|
91
|
+
|
|
92
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
93
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
94
|
+
modifications, and in Source or Object form, provided that You
|
|
95
|
+
meet the following conditions:
|
|
96
|
+
|
|
97
|
+
(a) You must give any other recipients of the Work or
|
|
98
|
+
Derivative Works a copy of this License; and
|
|
99
|
+
|
|
100
|
+
(b) You must cause any modified files to carry prominent notices
|
|
101
|
+
stating that You changed the files; and
|
|
102
|
+
|
|
103
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
104
|
+
that You distribute, all copyright, patent, trademark, and
|
|
105
|
+
attribution notices from the Source form of the Work,
|
|
106
|
+
excluding those notices that do not pertain to any part of
|
|
107
|
+
the Derivative Works; and
|
|
108
|
+
|
|
109
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
110
|
+
distribution, then any Derivative Works that You distribute must
|
|
111
|
+
include a readable copy of the attribution notices contained
|
|
112
|
+
within such NOTICE file, excluding those notices that do not
|
|
113
|
+
pertain to any part of the Derivative Works, in at least one
|
|
114
|
+
of the following places: within a NOTICE text file distributed
|
|
115
|
+
as part of the Derivative Works; within the Source form or
|
|
116
|
+
documentation, if provided along with the Derivative Works; or,
|
|
117
|
+
within a display generated by the Derivative Works, if and
|
|
118
|
+
wherever such third-party notices normally appear. The contents
|
|
119
|
+
of the NOTICE file are for informational purposes only and
|
|
120
|
+
do not modify the License. You may add Your own attribution
|
|
121
|
+
notices within Derivative Works that You distribute, alongside
|
|
122
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
123
|
+
that such additional attribution notices cannot be construed
|
|
124
|
+
as modifying the License.
|
|
125
|
+
|
|
126
|
+
You may add Your own copyright statement to Your modifications and
|
|
127
|
+
may provide additional or different license terms and conditions
|
|
128
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
129
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
130
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
131
|
+
the conditions stated in this License.
|
|
132
|
+
|
|
133
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
134
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
135
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
136
|
+
this License, without any additional terms or conditions.
|
|
137
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
138
|
+
the terms of any separate license agreement you may have executed
|
|
139
|
+
with Licensor regarding such Contributions.
|
|
140
|
+
|
|
141
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
142
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
143
|
+
except as required for reasonable and customary use in describing the
|
|
144
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
145
|
+
|
|
146
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
147
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
148
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
149
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
150
|
+
implied, including, without limitation, any warranties or conditions
|
|
151
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
152
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
153
|
+
appropriateness of using or redistributing the Work and assume any
|
|
154
|
+
risks associated with Your exercise of permissions under this License.
|
|
155
|
+
|
|
156
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
157
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
158
|
+
unless required by applicable law (such as deliberate and grossly
|
|
159
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
160
|
+
liable to You for damages, including any direct, indirect, special,
|
|
161
|
+
incidental, or consequential damages of any character arising as a
|
|
162
|
+
result of this License or out of the use or inability to use the
|
|
163
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
164
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
165
|
+
other commercial damages or losses), even if such Contributor
|
|
166
|
+
has been advised of the possibility of such damages.
|
|
167
|
+
|
|
168
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
169
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
170
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
171
|
+
or other liability obligations and/or rights consistent with this
|
|
172
|
+
License. However, in accepting such obligations, You may act only
|
|
173
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
174
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
175
|
+
defend, and hold each Contributor harmless for any liability
|
|
176
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
177
|
+
of your accepting any such warranty or additional liability.
|
|
178
|
+
|
|
179
|
+
END OF TERMS AND CONDITIONS
|
|
180
|
+
|
|
181
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
182
|
+
|
|
183
|
+
To apply the Apache License to your work, attach the following
|
|
184
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
185
|
+
replaced with your own identifying information. (Don't include
|
|
186
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
187
|
+
comment syntax for the file format. We also recommend that a
|
|
188
|
+
file or class name and description of purpose be included on the
|
|
189
|
+
same "printed page" as the copyright notice for easier
|
|
190
|
+
identification within third-party archives.
|
|
191
|
+
|
|
192
|
+
Copyright [yyyy] [name of copyright owner]
|
|
193
|
+
|
|
194
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
195
|
+
you may not use this file except in compliance with the License.
|
|
196
|
+
You may obtain a copy of the License at
|
|
197
|
+
|
|
198
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
199
|
+
|
|
200
|
+
Unless required by applicable law or agreed to in writing, software
|
|
201
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
202
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
203
|
+
See the License for the specific language governing permissions and
|
|
204
|
+
limitations under the License.
|
package/dist/ai/SKILL.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: facto-ui
|
|
3
|
+
description: Adopt @facto-to/design-system in new React interfaces or migrate existing demos to Facto Dashboard components, fonts, colors and spacing. Use for Facto UI integration, replacing mismatched components, scoped restyling and theme adaptation; not for payment/backend SDK integration.
|
|
4
|
+
metadata:
|
|
5
|
+
version: "1.0.0"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Facto UI
|
|
9
|
+
|
|
10
|
+
Use the published npm library as the UI source of truth. Support new interfaces, incremental component replacement, and typography/token-only adoption. Preserve the user's requested scope and the existing application's behavior.
|
|
11
|
+
|
|
12
|
+
For multiple repositories, read [multi-repo.md](references/multi-repo.md). Prefer references shipped with each installed SDK over this skill snapshot; use the installed package’s `AI.md` as the entry point when present.
|
|
13
|
+
|
|
14
|
+
## Choose the smallest appropriate change
|
|
15
|
+
|
|
16
|
+
1. Inspect the target app's package manager, framework, installed React and Facto versions, entry/root layout, global CSS and target components. Read [version.json](references/version.json). This skill's examples target that exact package version. For another version, inspect its installed declarations and CSS before using these examples; do not silently upgrade dependencies. React 18 and non-React apps cannot consume the React 19 components as-is.
|
|
17
|
+
2. For an existing demo, read [migration.md](references/migration.md). Unless asked for a rebuild, keep routes, data requests, wallet/auth integrations, validation, state and persistence. Replace only requested presentation. If the user asks only for fonts/colors, start with tokens and scoped CSS; do not replace all controls.
|
|
18
|
+
3. Read [integration.md](references/integration.md) for styles, font loading, framework constraints and version handling. Read [design.md](references/design.md) to retain the default Dashboard appearance or adapt a requested theme.
|
|
19
|
+
4. Select components using [components.md](references/components.md). Search [api.d.ts](references/api.d.ts) for the exact component's props, and use installed declarations as the final authority. Read only relevant declarations. Do not invent exports, props, a global toast store, a data table or a chart API.
|
|
20
|
+
5. For combined workflows (filters, async forms, nested Sheet/Dialog/Select, Toast), read [composition.md](references/composition.md). Adapt [AdoptionDemo.tsx](assets/AdoptionDemo.tsx) and [adoption.css](assets/adoption.css) only if useful. They are a runnable mock reference, not a replacement for existing business data or an entire application scaffold.
|
|
21
|
+
6. Verify the changed workflows with the app's typecheck/build and focused interaction checks. Inspect computed styles and representative narrow/wide layouts when a browser is available. Verify Inter actually loads for Latin text, theme overrides reach portals, and existing behavior remains intact. Report any unverified paths; building alone is not a visual audit.
|
|
22
|
+
|
|
23
|
+
Keep Dashboard defaults unless the user requests another palette. Prefer public components and --facto-* tokens over copying package implementation CSS. Importing the package does not automatically restyle legacy HTML. The library has no runtime environment variables or business API credentials. Do not add those for UI adoption.
|
|
24
|
+
|
|
25
|
+
Do not publish packages, push changes, read publisher credentials or collect customer data as part of this skill. Public documentation and mock examples are sufficient for UI integration.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
import {
|
|
5
|
+
Badge, Button, Checkbox, Dialog, DialogClose, DialogContent,
|
|
6
|
+
DialogDescription, DialogTitle, DialogTrigger, FactoTheme,
|
|
7
|
+
SearchField, Select, Stack, Surface, TextField, Toast, ToastClose,
|
|
8
|
+
ToastDescription, ToastProvider, ToastTitle, ToastViewport,
|
|
9
|
+
} from '@facto-to/design-system'
|
|
10
|
+
import '@facto-to/design-system/styles.css'
|
|
11
|
+
import '@facto-to/design-system/fonts.css'
|
|
12
|
+
import './adoption.css'
|
|
13
|
+
|
|
14
|
+
// Mock reference only. Keep the host application's data and handlers during migration.
|
|
15
|
+
export function AdoptionDemo() {
|
|
16
|
+
const [query, setQuery] = useState('')
|
|
17
|
+
const [status, setStatus] = useState('all')
|
|
18
|
+
const [enabled, setEnabled] = useState(true)
|
|
19
|
+
const [name, setName] = useState('Demo workspace')
|
|
20
|
+
const [dialogOpen, setDialogOpen] = useState(false)
|
|
21
|
+
const [saved, setSaved] = useState(false)
|
|
22
|
+
const rows = [{ id: 'sample-1', name: 'Sample invoice', status: 'paid' }]
|
|
23
|
+
const visible = rows.filter(row => row.name.toLowerCase().includes(query.toLowerCase()) && (status === 'all' || row.status === status))
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<FactoTheme className="facto-adoption">
|
|
27
|
+
<ToastProvider>
|
|
28
|
+
<Stack gap={5}>
|
|
29
|
+
<h1 className="facto-adoption__heading">Payments</h1>
|
|
30
|
+
<p className="facto-adoption__secondary">Mock component adoption example</p>
|
|
31
|
+
<Surface>
|
|
32
|
+
<Stack gap={4}>
|
|
33
|
+
<SearchField label="Search payments" value={query} onChange={event => setQuery(event.target.value)} />
|
|
34
|
+
<Select label="Status" value={status} onValueChange={setStatus} options={[
|
|
35
|
+
{ value: 'all', label: 'All' }, { value: 'paid', label: 'Paid' }, { value: 'pending', label: 'Pending' },
|
|
36
|
+
]} />
|
|
37
|
+
<div className="facto-adoption__table-scroll">
|
|
38
|
+
<table className="facto-adoption__table">
|
|
39
|
+
<caption>Sample payment records</caption>
|
|
40
|
+
<thead><tr><th scope="col">Name</th><th scope="col">Status</th></tr></thead>
|
|
41
|
+
<tbody>{visible.map(row => <tr key={row.id}><td>{row.name}</td><td><Badge tone="success">Paid</Badge></td></tr>)}</tbody>
|
|
42
|
+
</table>
|
|
43
|
+
</div>
|
|
44
|
+
{visible.length === 0 && <p role="status">No matching payments</p>}
|
|
45
|
+
<Dialog open={dialogOpen} onOpenChange={setDialogOpen}>
|
|
46
|
+
<DialogTrigger asChild><Button variant="secondary">Edit preferences</Button></DialogTrigger>
|
|
47
|
+
<DialogContent>
|
|
48
|
+
<DialogTitle>Preferences</DialogTitle>
|
|
49
|
+
<DialogDescription>Update this mock workspace.</DialogDescription>
|
|
50
|
+
<form onSubmit={event => { event.preventDefault(); setDialogOpen(false); setSaved(true) }}>
|
|
51
|
+
<Stack gap={4}>
|
|
52
|
+
<TextField label="Workspace name" name="workspaceName" value={name} onChange={event => setName(event.target.value)} required />
|
|
53
|
+
<Checkbox label="Enable notifications" checked={enabled} onCheckedChange={value => setEnabled(value === true)} />
|
|
54
|
+
<Button type="submit">Save preferences</Button>
|
|
55
|
+
<DialogClose asChild><Button variant="text">Cancel</Button></DialogClose>
|
|
56
|
+
</Stack>
|
|
57
|
+
</form>
|
|
58
|
+
</DialogContent>
|
|
59
|
+
</Dialog>
|
|
60
|
+
</Stack>
|
|
61
|
+
</Surface>
|
|
62
|
+
</Stack>
|
|
63
|
+
<Toast open={saved} onOpenChange={setSaved} tone="success">
|
|
64
|
+
<ToastTitle>Preferences saved</ToastTitle>
|
|
65
|
+
<ToastDescription>{name}</ToastDescription>
|
|
66
|
+
<ToastClose />
|
|
67
|
+
</Toast>
|
|
68
|
+
<ToastViewport />
|
|
69
|
+
</ToastProvider>
|
|
70
|
+
</FactoTheme>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* Scope to the adopted region. Works with tokens/fonts alone for legacy HTML;
|
|
2
|
+
React components additionally require styles.css. No global reset. */
|
|
3
|
+
.facto-adoption {
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
font-family: var(--facto-font-sans);
|
|
6
|
+
font-size: var(--facto-font-size);
|
|
7
|
+
line-height: var(--facto-line-height);
|
|
8
|
+
letter-spacing: var(--facto-tracking);
|
|
9
|
+
color: var(--facto-text);
|
|
10
|
+
background: var(--facto-canvas);
|
|
11
|
+
padding: var(--facto-space-6);
|
|
12
|
+
min-width: 0;
|
|
13
|
+
}
|
|
14
|
+
.facto-adoption__heading {
|
|
15
|
+
margin: 0;
|
|
16
|
+
font-size: var(--facto-font-size-heading-lg);
|
|
17
|
+
line-height: var(--facto-line-height-heading-lg);
|
|
18
|
+
font-weight: var(--facto-font-weight-semibold);
|
|
19
|
+
letter-spacing: var(--facto-tracking-heading-lg);
|
|
20
|
+
}
|
|
21
|
+
.facto-adoption__secondary { margin: 0; color: var(--facto-muted-on-subtle); }
|
|
22
|
+
/* Assign this class to legacy controls only when typography adoption is requested. */
|
|
23
|
+
.facto-adoption .facto-adoption__legacy-control { font: inherit; letter-spacing: inherit; }
|
|
24
|
+
.facto-adoption__table-scroll { overflow-x: auto; }
|
|
25
|
+
.facto-adoption__table { width: 100%; border-collapse: collapse; text-align: left; }
|
|
26
|
+
.facto-adoption__table caption { text-align: left; color: var(--facto-muted); }
|
|
27
|
+
.facto-adoption__table th, .facto-adoption__table td {
|
|
28
|
+
padding: var(--facto-space-3); border-bottom: 1px solid var(--facto-line);
|
|
29
|
+
}
|
|
30
|
+
@media (max-width: 480px) { .facto-adoption { padding: var(--facto-space-3); } }
|