gbs-add-block 2.0.2 → 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/.gbs/skills/gbs-components/SKILL.md +10 -8
- package/.gbs/skills/gbs-components/references/data-grid.md +0 -1
- package/.gbs/skills/gbs-components/references/install.md +2 -3
- package/.gbs/skills/gbs-components/references/overlays.md +0 -3
- package/.gbs/skills/gbs-components/references/styling.md +31 -10
- package/.gbs/skills/gbs-components/references/toaster.md +0 -1
- package/README.md +7 -3
- package/package.json +1 -1
|
@@ -15,11 +15,14 @@ npx gbs-add-block -a Button,Input,Modal --beta
|
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
Writes `component-lib/<folder>/` plus `component-lib/shared/`. Always pass
|
|
18
|
-
`--beta`. Import the
|
|
18
|
+
`--beta`. Import the barrel in your component; each stylesheet goes in the
|
|
19
|
+
global CSS **once** (Vite: `src/index.css`), never in a component file:
|
|
19
20
|
|
|
20
21
|
```ts
|
|
21
22
|
import { Button } from "component-lib/button";
|
|
22
|
-
|
|
23
|
+
```
|
|
24
|
+
```css
|
|
25
|
+
@import "../component-lib/button/styles.css";
|
|
23
26
|
```
|
|
24
27
|
|
|
25
28
|
Folder = lowercased name, except `data-grid`, `date-picker`, `file-uploader`,
|
|
@@ -78,7 +81,6 @@ import { Input } from "component-lib/input";
|
|
|
78
81
|
import { Select } from "component-lib/combobox";
|
|
79
82
|
import { Modal } from "component-lib/modal";
|
|
80
83
|
import { toast } from "component-lib/toaster";
|
|
81
|
-
// plus each styles.css, once
|
|
82
84
|
|
|
83
85
|
const ROLES = [{ value: "admin", label: "Admin" }, { value: "dev", label: "Dev" }];
|
|
84
86
|
|
|
@@ -121,12 +123,12 @@ export function InviteButton() {
|
|
|
121
123
|
|
|
122
124
|
## Details (in `references/`)
|
|
123
125
|
|
|
124
|
-
- `install.md` — CLI flags, folders,
|
|
125
|
-
- `forms.md` —
|
|
126
|
-
- `pickers.md` — Select, MultiSelect, DatePicker,
|
|
126
|
+
- `install.md` — CLI flags, folders, 1.x vs beta.
|
|
127
|
+
- `forms.md` — fields, controlled state, form posting.
|
|
128
|
+
- `pickers.md` — Select, MultiSelect, DatePicker, Uploader.
|
|
127
129
|
- `overlays.md` — Modal, dialog, Popover, Menu, Tooltip.
|
|
128
130
|
- `toaster.md` — `toast()` and `<Toaster />`.
|
|
129
131
|
- `data-grid.md` — columns, API, export.
|
|
130
|
-
- `data-display.md` — Card, Tabs, Accordion, Badge, Avatar
|
|
131
|
-
- `styling.md` — tokens, layers,
|
|
132
|
+
- `data-display.md` — Card, Tabs, Accordion, Badge, Avatar.
|
|
133
|
+
- `styling.md` — tokens, layers, slots, `data-*`, dark.
|
|
132
134
|
- `accessibility.md` — what is supplied, what you add.
|
|
@@ -5,7 +5,6 @@ A virtualized grid. Import `DataGrid` and `createColumnHelper` from
|
|
|
5
5
|
|
|
6
6
|
```tsx
|
|
7
7
|
import { createColumnHelper, DataGrid } from "component-lib/data-grid";
|
|
8
|
-
import "component-lib/data-grid/styles.css";
|
|
9
8
|
|
|
10
9
|
interface Employee { id: number; name: string; salary: number; active: boolean }
|
|
11
10
|
|
|
@@ -151,14 +151,13 @@ is replaced on update. Put your changes in your own module instead.
|
|
|
151
151
|
|
|
152
152
|
## Importing
|
|
153
153
|
|
|
154
|
-
Import the
|
|
154
|
+
Import the barrel in the component that uses it:
|
|
155
155
|
|
|
156
156
|
```ts
|
|
157
157
|
import { Input, OtpInput } from "component-lib/input";
|
|
158
|
-
import "component-lib/input/styles.css";
|
|
159
158
|
```
|
|
160
159
|
|
|
161
|
-
|
|
160
|
+
Put the stylesheet in the project's global CSS, once — never in a component file:
|
|
162
161
|
|
|
163
162
|
```css
|
|
164
163
|
@import "../component-lib/input/styles.css";
|
|
@@ -25,7 +25,6 @@ dismiss rules, a close guard, sizes, drawers and animation.
|
|
|
25
25
|
|
|
26
26
|
```tsx
|
|
27
27
|
import { Modal } from "component-lib/modal";
|
|
28
|
-
import "component-lib/modal/styles.css";
|
|
29
28
|
|
|
30
29
|
const [open, setOpen] = useState(false);
|
|
31
30
|
|
|
@@ -73,7 +72,6 @@ React.
|
|
|
73
72
|
```tsx
|
|
74
73
|
// once, e.g. app/layout.tsx or App.tsx
|
|
75
74
|
import { DialogHost } from "component-lib/dialog";
|
|
76
|
-
import "component-lib/dialog/styles.css";
|
|
77
75
|
<DialogHost />
|
|
78
76
|
|
|
79
77
|
// anywhere
|
|
@@ -142,7 +140,6 @@ import {
|
|
|
142
140
|
Menu, MenuItem, MenuCheckboxItem, MenuRadioGroup, MenuRadioItem,
|
|
143
141
|
MenuGroup, MenuSeparator, MenuSub,
|
|
144
142
|
} from "component-lib/menu";
|
|
145
|
-
import "component-lib/menu/styles.css";
|
|
146
143
|
|
|
147
144
|
<Menu trigger={<Button variant="outline">Actions</Button>} label="Row actions">
|
|
148
145
|
<MenuItem icon={<EditIcon />} shortcut="⌘E" onSelect={edit}>Edit</MenuItem>
|
|
@@ -6,18 +6,20 @@ state attributes.
|
|
|
6
6
|
|
|
7
7
|
## 1. Stylesheets are per component
|
|
8
8
|
|
|
9
|
-
Each folder has its own `styles.css`.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import "component-lib/button/styles.css";
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
or from a root stylesheet:
|
|
9
|
+
Each folder has its own `styles.css`. Put the ones you use in the project's
|
|
10
|
+
**global** stylesheet — `src/index.css` in Vite, the root layout's CSS in Next —
|
|
11
|
+
once each:
|
|
16
12
|
|
|
17
13
|
```css
|
|
18
14
|
@import "../component-lib/button/styles.css";
|
|
19
15
|
```
|
|
20
16
|
|
|
17
|
+
**Never import a stylesheet from a component file.** `import
|
|
18
|
+
"component-lib/button/styles.css"` inside a `.tsx` does bundle, but it makes CSS
|
|
19
|
+
order depend on module import order — which decides whether Tailwind utilities
|
|
20
|
+
still beat the component's own rules — and a lazy-loaded component then pulls its
|
|
21
|
+
styles in late, flashing unstyled. One global import per component, nowhere else.
|
|
22
|
+
|
|
21
23
|
Nothing renders correctly without it — the components emit class names only.
|
|
22
24
|
|
|
23
25
|
## 2. Theme with `--gbs-*` on `:root`
|
|
@@ -132,7 +134,26 @@ Do not use `!important`, and do not write selectors against internal class names
|
|
|
132
134
|
(`.bt-root`, `.dg-cell`) in app CSS — they are implementation detail. Use the
|
|
133
135
|
variables or the slots.
|
|
134
136
|
|
|
135
|
-
## 5.
|
|
137
|
+
## 5. Unlayered resets (Bootstrap, Normalize)
|
|
138
|
+
|
|
139
|
+
Component rules sit in `@layer components`. Any stylesheet that ships
|
|
140
|
+
**unlayered** beats every layered rule regardless of specificity — the cascade
|
|
141
|
+
settles layers before specificity. So Bootstrap's Reboot (`button { border-radius: 0 }`,
|
|
142
|
+
`button, input, textarea { font-size: inherit }`) overrides our classes, and
|
|
143
|
+
import order does not help.
|
|
144
|
+
|
|
145
|
+
Fix it in the project's global CSS by giving the reset its own layer, declared
|
|
146
|
+
before `components`:
|
|
147
|
+
|
|
148
|
+
```css
|
|
149
|
+
@layer bootstrap, theme, base, components, utilities;
|
|
150
|
+
@import url("bootstrap/dist/css/bootstrap.min.css") layer(bootstrap);
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Only components whose root is a native form element are affected (Button,
|
|
154
|
+
Textarea). Class names never collide — ours are two-letter prefixed.
|
|
155
|
+
|
|
156
|
+
## 6. State attributes
|
|
136
157
|
|
|
137
158
|
Components expose their state as `data-*` attributes, so you can style states
|
|
138
159
|
without tracking them in React.
|
|
@@ -153,7 +174,7 @@ without tracking them in React.
|
|
|
153
174
|
.cb-option[data-active] { outline: 2px solid var(--gbs-focus); }
|
|
154
175
|
```
|
|
155
176
|
|
|
156
|
-
##
|
|
177
|
+
## 7. Dark mode
|
|
157
178
|
|
|
158
179
|
Colours are `light-dark()` pairs driven by the page's `color-scheme`, so the
|
|
159
180
|
default is whatever the device prefers. To pin it, set `color-scheme` — the
|
|
@@ -172,7 +193,7 @@ Do not maintain a second palette for dark mode. Override the `--gbs-*` variables
|
|
|
172
193
|
with `light-dark()` pairs, or set them inside your own `[data-theme="dark"]`
|
|
173
194
|
block, and every component follows.
|
|
174
195
|
|
|
175
|
-
##
|
|
196
|
+
## 8. Right-to-left
|
|
176
197
|
|
|
177
198
|
The components use logical properties and read `dir` from the document, so RTL
|
|
178
199
|
works without configuration. Arrow keys in Menu, Switch and Tabs mirror
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# GBS Building Blocks 2.0 (v2.0.
|
|
1
|
+
# GBS Building Blocks 2.0 (v2.0.4)
|
|
2
2
|
|
|
3
3
|
Latest and upgraded version of GBS building blocks with headless UI and removed dependencies.
|
|
4
4
|
|
|
@@ -33,9 +33,13 @@ Pick a subset with `--for claude,codex`, or `--for none` for just `.gbs/`.
|
|
|
33
33
|
Commit the result so everyone's agent picks it up. Re-run to update; a file you
|
|
34
34
|
have edited is never replaced without `--force`.
|
|
35
35
|
|
|
36
|
-
## What's New 🎉 (Ver 2.0.
|
|
36
|
+
## What's New 🎉 (Ver 2.0.4)
|
|
37
37
|
|
|
38
|
-
-
|
|
38
|
+
- Agent skill: added guidance for projects that load an unlayered CSS reset
|
|
39
|
+
such as Bootstrap or Normalize. Component rules live in the `components`
|
|
40
|
+
cascade layer, and an unlayered reset outranks every layered rule whatever
|
|
41
|
+
its selectors look like, so Bootstrap's Reboot was restyling the Button.
|
|
42
|
+
Importing the reset into its own layer fixes it; the skill now says so.
|
|
39
43
|
|
|
40
44
|
## Authors
|
|
41
45
|
|