gbs-add-block 2.0.4 → 2.3.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.
- package/.gbs/skills/gbs-components/SKILL.md +190 -134
- package/.gbs/skills/gbs-components/references/install.md +25 -3
- package/.gbs/skills/gbs-components/references/styling.md +246 -201
- package/CHANGELOG.md +74 -0
- package/README.md +157 -11
- package/index.cjs +212 -3
- package/package.json +41 -10
- package/schema/passport-v1.schema.json +204 -0
- package/source/beta-components/accordion/passport.json +259 -0
- package/source/beta-components/accordion/styles.css +207 -208
- package/source/beta-components/alert/passport.json +250 -0
- package/source/beta-components/alert/styles.css +154 -155
- package/source/beta-components/avatar/passport.json +294 -0
- package/source/beta-components/avatar/styles.css +201 -203
- package/source/beta-components/badge/passport.json +332 -0
- package/source/beta-components/badge/styles.css +203 -204
- package/source/beta-components/breadcrumb/passport.json +243 -0
- package/source/beta-components/breadcrumb/styles.css +138 -139
- package/source/beta-components/button/passport.json +402 -0
- package/source/beta-components/button/passport.manual.json +31 -0
- package/source/beta-components/button/styles.css +232 -233
- package/source/beta-components/card/passport.json +337 -0
- package/source/beta-components/card/styles.css +230 -231
- package/source/beta-components/checkbox/passport.json +456 -0
- package/source/beta-components/checkbox/styles.css +211 -212
- package/source/beta-components/combobox/passport.json +456 -0
- package/source/beta-components/combobox/styles.css +419 -417
- package/source/beta-components/data-grid/agent/coerce.ts +368 -0
- package/source/beta-components/data-grid/agent/contract.ts +410 -0
- package/source/beta-components/data-grid/agent/dataset.ts +92 -0
- package/source/beta-components/data-grid/agent/engine.ts +470 -0
- package/source/beta-components/data-grid/agent/executors.ts +155 -0
- package/source/beta-components/data-grid/agent/index.ts +79 -0
- package/source/beta-components/data-grid/agent/intent.ts +324 -0
- package/source/beta-components/data-grid/agent/operations.ts +335 -0
- package/source/beta-components/data-grid/agent/validate.ts +630 -0
- package/source/beta-components/data-grid/agent/webmcp.ts +107 -0
- package/source/beta-components/data-grid/index.ts +14 -7
- package/source/beta-components/data-grid/passport.json +1051 -0
- package/source/beta-components/data-grid/passport.manual.json +255 -0
- package/source/beta-components/data-grid/react/AskGrid.tsx +164 -0
- package/source/beta-components/data-grid/react/DataGrid.tsx +39 -0
- package/source/beta-components/data-grid/styles.css +874 -717
- package/source/beta-components/date-picker/passport.json +407 -0
- package/source/beta-components/date-picker/styles.css +445 -446
- package/source/beta-components/dialog/passport.json +344 -0
- package/source/beta-components/dialog/styles.css +280 -278
- package/source/beta-components/file-uploader/passport.json +518 -0
- package/source/beta-components/file-uploader/styles.css +394 -395
- package/source/beta-components/input/passport.json +536 -0
- package/source/beta-components/input/styles.css +295 -296
- package/source/beta-components/menu/passport.json +322 -0
- package/source/beta-components/menu/styles.css +224 -222
- package/source/beta-components/modal/passport.json +289 -0
- package/source/beta-components/modal/styles.css +241 -239
- package/source/beta-components/number-input/passport.json +541 -0
- package/source/beta-components/number-input/styles.css +230 -231
- package/source/beta-components/popover/passport.json +238 -0
- package/source/beta-components/popover/styles.css +148 -146
- package/source/beta-components/progress/passport.json +270 -0
- package/source/beta-components/progress/styles.css +200 -202
- package/source/beta-components/radio-group/passport.json +477 -0
- package/source/beta-components/radio-group/styles.css +241 -242
- package/source/beta-components/shared/core/agent/adapter.ts +65 -0
- package/source/beta-components/shared/core/agent/history.ts +120 -0
- package/source/beta-components/shared/core/agent/index.ts +46 -0
- package/source/beta-components/shared/core/agent/numbers.ts +217 -0
- package/source/beta-components/shared/core/agent/schema.ts +180 -0
- package/source/beta-components/shared/core/agent/types.ts +169 -0
- package/source/beta-components/shared/core/agent/webmcp.ts +328 -0
- package/source/beta-components/shared/index.ts +9 -0
- package/source/beta-components/shared/react/GramproAIProvider.tsx +50 -0
- package/source/beta-components/shared/react/useAskAgent.ts +217 -0
- package/source/beta-components/shared/styles.css +79 -0
- package/source/beta-components/shared/version.json +4 -4
- package/source/beta-components/shared/version.ts +6 -6
- package/source/beta-components/skeleton/passport.json +251 -0
- package/source/beta-components/skeleton/styles.css +185 -186
- package/source/beta-components/spinner/passport.json +245 -0
- package/source/beta-components/spinner/styles.css +145 -146
- package/source/beta-components/switch/passport.json +421 -0
- package/source/beta-components/switch/styles.css +194 -196
- package/source/beta-components/tabs/passport.json +315 -0
- package/source/beta-components/tabs/styles.css +234 -235
- package/source/beta-components/textarea/passport.json +382 -0
- package/source/beta-components/textarea/styles.css +158 -159
- package/source/beta-components/toaster/passport.json +221 -0
- package/source/beta-components/toaster/styles.css +282 -283
- package/source/beta-components/tooltip/passport.json +170 -0
- package/source/beta-components/tooltip/styles.css +71 -72
- package/tools/env.cjs +61 -0
- package/tools/passport/cli.cjs +79 -0
- package/tools/passport/extract.cjs +493 -0
- package/tools/passport/index.cjs +185 -0
- package/tools/passport/merge.cjs +131 -0
- package/tools/passport/policy.cjs +65 -0
- package/tools/passport/validate.cjs +277 -0
- package/tools/ts-require.cjs +79 -0
- package/source/beta-components/accordion/__tests__/core.test.ts +0 -58
- package/source/beta-components/alert/__tests__/core.test.ts +0 -17
- package/source/beta-components/avatar/__tests__/core.test.ts +0 -88
- package/source/beta-components/badge/__tests__/core.test.ts +0 -46
- package/source/beta-components/breadcrumb/__tests__/core.test.ts +0 -58
- package/source/beta-components/button/__tests__/core.test.ts +0 -31
- package/source/beta-components/card/__tests__/core.test.ts +0 -57
- package/source/beta-components/checkbox/__tests__/core.test.ts +0 -40
- package/source/beta-components/combobox/__tests__/core.test.ts +0 -134
- package/source/beta-components/data-grid/__tests__/core.test.ts +0 -356
- package/source/beta-components/data-grid/__tests__/export.test.ts +0 -70
- package/source/beta-components/data-grid/__tests__/pdf.test.ts +0 -209
- package/source/beta-components/date-picker/__tests__/core.test.ts +0 -273
- package/source/beta-components/dialog/__tests__/core.test.ts +0 -86
- package/source/beta-components/file-uploader/__tests__/core.test.ts +0 -395
- package/source/beta-components/input/__tests__/core.test.ts +0 -75
- package/source/beta-components/menu/__tests__/core.test.ts +0 -120
- package/source/beta-components/modal/__tests__/core.test.ts +0 -55
- package/source/beta-components/number-input/__tests__/core.test.ts +0 -151
- package/source/beta-components/progress/__tests__/core.test.ts +0 -56
- package/source/beta-components/radio-group/__tests__/core.test.ts +0 -64
- package/source/beta-components/shared/__tests__/boundaries.test.ts +0 -95
- package/source/beta-components/shared/__tests__/core.test.ts +0 -55
- package/source/beta-components/shared/__tests__/position.test.ts +0 -143
- package/source/beta-components/skeleton/__tests__/core.test.ts +0 -41
- package/source/beta-components/spinner/__tests__/core.test.ts +0 -48
- package/source/beta-components/switch/__tests__/core.test.ts +0 -64
- package/source/beta-components/tabs/__tests__/core.test.ts +0 -51
- package/source/beta-components/textarea/__tests__/core.test.ts +0 -38
- package/source/beta-components/toaster/__tests__/core.test.ts +0 -256
- package/source/beta-components/tooltip/__tests__/core.test.ts +0 -42
|
@@ -1,134 +1,190 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: gbs-components
|
|
3
|
-
description: Builds UI with the
|
|
4
|
-
autoAttach: ["src/**/*.tsx", "src/**/*.jsx", "app/**/*.tsx", "components/**/*.tsx"]
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# GBS components (2.0 beta)
|
|
8
|
-
|
|
9
|
-
## Install before you import
|
|
10
|
-
|
|
11
|
-
Not an npm dependency — the CLI **copies source into the repo**:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npx gbs-add-block -a Button,Input,Modal --beta
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Writes `component-lib/<folder>/` plus `component-lib/shared/`. Always pass
|
|
18
|
-
`--beta`. Import the barrel in your component
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
1
|
+
---
|
|
2
|
+
name: gbs-components
|
|
3
|
+
description: Builds UI with the GramproKit component library (gbs-add-block). Use when adding or changing UI in apps that have a component-lib/ folder.
|
|
4
|
+
autoAttach: ["src/**/*.tsx", "src/**/*.jsx", "app/**/*.tsx", "components/**/*.tsx"]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# GBS components (2.0 beta)
|
|
8
|
+
|
|
9
|
+
## Install before you import
|
|
10
|
+
|
|
11
|
+
Not an npm dependency — the CLI **copies source into the repo**:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx gbs-add-block -a Button,Input,Modal --beta
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Writes `component-lib/<folder>/` plus `component-lib/shared/`. Always pass
|
|
18
|
+
`--beta`. Import the barrel in your component:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { Button } from "component-lib/button";
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Styles are **one line** in the global CSS (Vite: `src/index.css`), never in a
|
|
25
|
+
component file. The CLI generates `component-lib/gbs.css` listing every
|
|
26
|
+
stylesheet you installed, and rewrites it on each install:
|
|
27
|
+
|
|
28
|
+
```css
|
|
29
|
+
@import "./component-lib/gbs.css";
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
With **Tailwind v4 only**, import it after the framework and into Tailwind's
|
|
33
|
+
components layer, or utilities stop overriding component rules:
|
|
34
|
+
|
|
35
|
+
```css
|
|
36
|
+
@import "tailwindcss";
|
|
37
|
+
@import "./component-lib/gbs.css" layer(components);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The installer prints whichever line applies. Component CSS is unlayered, so
|
|
41
|
+
Tailwind v3, Bootstrap and no-framework projects need nothing extra.
|
|
42
|
+
|
|
43
|
+
Folder = lowercased name, except `data-grid`, `date-picker`, `file-uploader`,
|
|
44
|
+
`number-input`, `radio-group`.
|
|
45
|
+
|
|
46
|
+
## Rules most often missed
|
|
47
|
+
|
|
48
|
+
1. **Change handlers are named per component.** `onValueChange`: Input,
|
|
49
|
+
OtpInput, Textarea, NumberInput, CheckboxGroup, RadioGroup, Tabs, Accordion,
|
|
50
|
+
MenuRadioGroup. `onCheckedChange`: Checkbox, Switch, MenuCheckboxItem.
|
|
51
|
+
`onChange`: Select, MultiSelect, DatePicker, DateRangePicker, FileUploader.
|
|
52
|
+
`onOpenChange`: Modal, Popover, Menu.
|
|
53
|
+
2. **Never hand-roll `<label>`, hint or error markup.** Fields take `label`,
|
|
54
|
+
`description` and `error`; `error` also marks the control invalid and wires
|
|
55
|
+
`aria-describedby`. A `<label>` wrapper breaks it.
|
|
56
|
+
3. **Style via `classNames` slots** (`classNames={{ root, label }}`);
|
|
57
|
+
`className` hits the root only. Theme globally with `--gbs-*` on `:root`.
|
|
58
|
+
4. **Mount `<Toaster />` and `<DialogHost />` once at the app root**, or
|
|
59
|
+
`toast()` and `dialog.confirm()` do nothing.
|
|
60
|
+
5. **All are client components** (`"use client"`); a Next.js Server Component
|
|
61
|
+
can render them but not pass function props.
|
|
62
|
+
6. **Compound families throw outside their parent**: Tab/TabList/TabPanel need
|
|
63
|
+
Tabs, AccordionItem needs Accordion, MenuItem needs Menu.
|
|
64
|
+
|
|
65
|
+
## Inventory (required props in parens)
|
|
66
|
+
|
|
67
|
+
**Forms** — Input, Textarea, NumberInput (locale-aware), OtpInput; Checkbox +
|
|
68
|
+
CheckboxGroup; Radio (`value`) + RadioGroup; Switch (applies immediately);
|
|
69
|
+
Select and MultiSelect (`options`; searchable, client or server); DatePicker and
|
|
70
|
+
DateRangePicker; FileUploader (chunked).
|
|
71
|
+
|
|
72
|
+
**Actions** — Button: variants, sizes, icons, auto-loading from a returned
|
|
73
|
+
promise; `render` draws a router link.
|
|
74
|
+
|
|
75
|
+
**Overlays** — Modal (native `<dialog>`, also drawers); `dialog` + DialogHost
|
|
76
|
+
(`await dialog.confirm/alert/prompt`); Popover (`trigger`); Menu (`trigger`) with
|
|
77
|
+
MenuItem, MenuCheckboxItem, MenuRadioGroup, MenuRadioItem, MenuGroup,
|
|
78
|
+
MenuSeparator, MenuSub; Tooltip (`content`); `toast` + Toaster.
|
|
79
|
+
|
|
80
|
+
**Data** — DataGrid (`data`, `columns`) + createColumnHelper: virtualized;
|
|
81
|
+
sort, filter, edit, CSV/Excel/PDF export. Optional agent surface: `ai` renders a
|
|
82
|
+
natural-language box, and `registerGridTool` exposes the grid to a browser agent
|
|
83
|
+
over WebMCP (see "Agent surface").
|
|
84
|
+
|
|
85
|
+
**Display** — Tabs/TabList/Tab (`value`)/TabPanel (`value`); Accordion +
|
|
86
|
+
AccordionItem (`value`); Card/CardHeader/CardBody/CardFooter/Stat; Alert; Badge
|
|
87
|
+
and Tag; Avatar and AvatarGroup; Progress and CircularProgress (`value={null}`
|
|
88
|
+
is indeterminate); Skeleton and Empty; Spinner; Breadcrumb (`items`,
|
|
89
|
+
`renderLink`).
|
|
90
|
+
|
|
91
|
+
## Example
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
"use client";
|
|
95
|
+
import { useState } from "react";
|
|
96
|
+
import { Button } from "component-lib/button";
|
|
97
|
+
import { Input } from "component-lib/input";
|
|
98
|
+
import { Select } from "component-lib/combobox";
|
|
99
|
+
import { Modal } from "component-lib/modal";
|
|
100
|
+
import { toast } from "component-lib/toaster";
|
|
101
|
+
|
|
102
|
+
const ROLES = [{ value: "admin", label: "Admin" }, { value: "dev", label: "Dev" }];
|
|
103
|
+
|
|
104
|
+
export function InviteButton() {
|
|
105
|
+
const [open, setOpen] = useState(false);
|
|
106
|
+
const [email, setEmail] = useState("");
|
|
107
|
+
const [role, setRole] = useState<string | null>(null);
|
|
108
|
+
const invalid = !!email && !email.includes("@");
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<>
|
|
112
|
+
<Button onClick={() => setOpen(true)}>Invite</Button>
|
|
113
|
+
<Modal open={open} onOpenChange={setOpen} title="Invite a teammate"
|
|
114
|
+
footer={({ close }) => (
|
|
115
|
+
<Button disabled={!email || invalid} onClick={async () => {
|
|
116
|
+
await invite({ email, role });
|
|
117
|
+
toast.success("Invitation sent");
|
|
118
|
+
close();
|
|
119
|
+
}}>Send</Button>
|
|
120
|
+
)}>
|
|
121
|
+
<Input label="Email" type="email" value={email} onValueChange={setEmail}
|
|
122
|
+
required error={invalid ? "Enter a valid email" : undefined} />
|
|
123
|
+
<Select label="Role" options={ROLES} value={role} onChange={setRole} />
|
|
124
|
+
</Modal>
|
|
125
|
+
</>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Agent surface (DataGrid, optional)
|
|
131
|
+
|
|
132
|
+
Entirely opt-in. Without it, nothing changes and nothing is downloaded.
|
|
133
|
+
|
|
134
|
+
**A person typing.** `ai` renders a box above the grid. It needs a provider
|
|
135
|
+
supplying an adapter; with no provider it renders nothing at all.
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
import { GramproAIProvider } from "component-lib/shared";
|
|
139
|
+
import { DataGrid } from "component-lib/data-grid";
|
|
140
|
+
|
|
141
|
+
<GramproAIProvider adapter={myAdapter}>
|
|
142
|
+
<DataGrid data={rows} columns={cols} ai semantics={SEMANTICS} />
|
|
143
|
+
</GramproAIProvider>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
`adapter` is one function — `(utterance, contract, responseSchema) => envelope`.
|
|
147
|
+
No model is bundled, downloaded or named; the app brings its own, and the key
|
|
148
|
+
belongs on the app's server, never in client JavaScript.
|
|
149
|
+
|
|
150
|
+
**A browser agent.** `registerGridTool(agent)` registers one WebMCP tool,
|
|
151
|
+
`operate_grid`, whose schema is generated from the live grid. Requires no model
|
|
152
|
+
at all.
|
|
153
|
+
|
|
154
|
+
**Both go through the same validator**, which refuses an unknown column, an
|
|
155
|
+
operator the type lacks, a policy-denied column, or an irreversible operation
|
|
156
|
+
with no confirmation — and returns the reason. A producer proposes; it never
|
|
157
|
+
acts. Do not add repair, retries or a second execution path.
|
|
158
|
+
|
|
159
|
+
**Data leaves the page with a remote adapter.** The contract carries real
|
|
160
|
+
values from low-cardinality columns, so the model can map "Kerala" to `region`.
|
|
161
|
+
Mark personal columns `semantics: { email: { pii: true } }` — a PII column is
|
|
162
|
+
denied *and* never summarised — or pass `stats: false` to summarise nothing.
|
|
163
|
+
`policy.denyFilter` does **not** stop a column being described.
|
|
164
|
+
|
|
165
|
+
**`semantics` is where most quality comes from**: per column, give `synonyms`,
|
|
166
|
+
`description`, `unit`, `higherIsBetter`, `pii`. Reach for it before reaching for
|
|
167
|
+
a bigger model.
|
|
168
|
+
|
|
169
|
+
## Don't
|
|
170
|
+
|
|
171
|
+
- Raw `<button>`, `<input>`, `<select>`, `<table>`, `<dialog>`, or a hand-built
|
|
172
|
+
modal/menu/tooltip, when a component exists.
|
|
173
|
+
- Deep imports (`.../input/react/Input`); import the barrel. Only `<name>/core`
|
|
174
|
+
is also public.
|
|
175
|
+
- Editing `component-lib/shared/`; the CLI replaces it on update.
|
|
176
|
+
- Invented props: no `asChild`, no `variant` on Input, no `onChange` on Switch.
|
|
177
|
+
- `!important` or internal class selectors; set `--gbs-*` or pass `classNames`.
|
|
178
|
+
- A Tooltip as a name; icon buttons need `aria-label`.
|
|
179
|
+
|
|
180
|
+
## Details (in `references/`)
|
|
181
|
+
|
|
182
|
+
- `install.md` — CLI flags, folders, 1.x vs beta.
|
|
183
|
+
- `forms.md` — fields, controlled state, form posting.
|
|
184
|
+
- `pickers.md` — Select, MultiSelect, DatePicker, Uploader.
|
|
185
|
+
- `overlays.md` — Modal, dialog, Popover, Menu, Tooltip.
|
|
186
|
+
- `toaster.md` — `toast()` and `<Toaster />`.
|
|
187
|
+
- `data-grid.md` — columns, API, export.
|
|
188
|
+
- `data-display.md` — Card, Tabs, Accordion, Badge, Avatar.
|
|
189
|
+
- `styling.md` — tokens, layers, slots, `data-*`, dark.
|
|
190
|
+
- `accessibility.md` — what is supplied, what you add.
|
|
@@ -157,12 +157,33 @@ Import the barrel in the component that uses it:
|
|
|
157
157
|
import { Input, OtpInput } from "component-lib/input";
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
-
Put the
|
|
160
|
+
Put the styles in the project's global CSS, once — never in a component file.
|
|
161
|
+
The CLI writes `component-lib/gbs.css` importing every stylesheet you installed
|
|
162
|
+
and rewrites it on each install, so this one line stays correct as you add
|
|
163
|
+
components:
|
|
161
164
|
|
|
162
165
|
```css
|
|
163
|
-
@import "
|
|
166
|
+
@import "./component-lib/gbs.css";
|
|
164
167
|
```
|
|
165
168
|
|
|
169
|
+
With **Tailwind v4 only**, import it after the framework and into Tailwind's
|
|
170
|
+
components layer. Tailwind v4 puts its own utilities in a cascade layer, and an
|
|
171
|
+
unlayered component rule would outrank them:
|
|
172
|
+
|
|
173
|
+
```css
|
|
174
|
+
@import "tailwindcss";
|
|
175
|
+
@import "./component-lib/gbs.css" layer(components);
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Both the order and the `layer()` matter. Imported before the framework, the
|
|
179
|
+
layer registers first and Tailwind's preflight lands after it, stripping the
|
|
180
|
+
component rules. Imported without `layer()`, `className` stops overriding them.
|
|
181
|
+
Tailwind v3, Bootstrap and projects with no framework need neither — the
|
|
182
|
+
installer prints whichever line applies to yours.
|
|
183
|
+
|
|
184
|
+
Individual stylesheets remain importable (`component-lib/input/styles.css`) if
|
|
185
|
+
you would rather curate the list yourself.
|
|
186
|
+
|
|
166
187
|
Most repos set a path alias. The library's own READMEs are written with
|
|
167
188
|
`@/components/<folder>`; the DataGrid README uses `component-lib/data-grid`.
|
|
168
189
|
Both mean the installed folder — follow whatever the host repo already uses.
|
|
@@ -173,7 +194,8 @@ Both mean the installed folder — follow whatever the host repo already uses.
|
|
|
173
194
|
| --- | --- |
|
|
174
195
|
| `component-lib/<folder>` | Components, hooks, types, locale defaults. **Use this.** |
|
|
175
196
|
| `component-lib/<folder>/core` | Framework-free helpers; safe on a server. Documented per component. |
|
|
176
|
-
| `component-lib
|
|
197
|
+
| `component-lib/gbs.css` | Generated barrel of every installed stylesheet. **Import this.** |
|
|
198
|
+
| `component-lib/<folder>/styles.css` | One component's stylesheet, if you curate the list yourself. |
|
|
177
199
|
| `component-lib/shared` | Shared helpers, mostly used by the components themselves. |
|
|
178
200
|
|
|
179
201
|
Anything deeper (`component-lib/input/react/Input`) is internal. It will resolve,
|