@fvc/box 1.1.1 → 1.1.2-rc.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.
Files changed (2) hide show
  1. package/README.md +189 -0
  2. package/package.json +11 -1
package/README.md ADDED
@@ -0,0 +1,189 @@
1
+ # @fvc/box
2
+
3
+ `@fvc/box` provides FE-VIS flexbox layout primitives on top of Ant Design Grid. It exposes a `Box` component for flex containers and compound subcomponents `Box.Row` and `Box.Column` for grid-based layouts, keeping the Ant Design Row/Col API familiar while adding direction, alignment, gap, and block layout controls as props.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ bun add @fvc/box
9
+ ```
10
+
11
+ ## Peer Dependencies
12
+
13
+ ```bash
14
+ bun add react antd
15
+ ```
16
+
17
+ ## Import
18
+
19
+ ```tsx
20
+ import { Box } from '@fvc/box';
21
+ ```
22
+
23
+ ## Quick Start
24
+
25
+ ```tsx
26
+ import { Box } from '@fvc/box';
27
+
28
+ export function ActionBar() {
29
+ return (
30
+ <Box direction="row" justify="space-between" align="center">
31
+ <span>Title</span>
32
+ <button>Save</button>
33
+ </Box>
34
+ );
35
+ }
36
+ ```
37
+
38
+ ## Components
39
+
40
+ | Component | Use case |
41
+ | --- | --- |
42
+ | `Box` | Flex container with direction, alignment, gap, and wrap controls. |
43
+ | `Box.Row` | Ant Design Row wrapper with `testId` support. |
44
+ | `Box.Column` | Ant Design Col wrapper with `col` shorthand and `testId` support. |
45
+
46
+ ## Common Usage
47
+
48
+ ### Flex Row
49
+
50
+ ```tsx
51
+ <Box direction="row" align="center" justify="space-between">
52
+ <Label>Status</Label>
53
+ <Value>Active</Value>
54
+ </Box>
55
+ ```
56
+
57
+ ### Flex Column
58
+
59
+ ```tsx
60
+ <Box direction="column" rowGap={1}>
61
+ <Field label="Name" />
62
+ <Field label="Email" />
63
+ <Field label="Phone" />
64
+ </Box>
65
+ ```
66
+
67
+ ### No Wrap
68
+
69
+ ```tsx
70
+ <Box direction="row" wrap={false}>
71
+ <Tag>Tag 1</Tag>
72
+ <Tag>Tag 2</Tag>
73
+ </Box>
74
+ ```
75
+
76
+ ### Full Width
77
+
78
+ ```tsx
79
+ <Box direction="row" block>
80
+ <SearchInput />
81
+ <Button type="primary">Search</Button>
82
+ </Box>
83
+ ```
84
+
85
+ ### Inline Flex
86
+
87
+ ```tsx
88
+ <Box display="inline-flex" align="center" direction="row">
89
+ <Icon />
90
+ <span>Label</span>
91
+ </Box>
92
+ ```
93
+
94
+ ### Row and Column Grid
95
+
96
+ ```tsx
97
+ <Box.Row gutter={16}>
98
+ <Box.Column col={12}>
99
+ <Input name="firstName" label="First name" />
100
+ </Box.Column>
101
+ <Box.Column col={12}>
102
+ <Input name="lastName" label="Last name" />
103
+ </Box.Column>
104
+ </Box.Row>
105
+ ```
106
+
107
+ ## Props
108
+
109
+ ### Box
110
+
111
+ | Prop | Type | Description |
112
+ | --- | --- | --- |
113
+ | `display` | `'flex' \| 'inline-flex'` | Display mode. Defaults to `'flex'`. |
114
+ | `direction` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Flex direction. |
115
+ | `align` | `'flex-start' \| 'center' \| 'flex-end'` | Cross-axis alignment. |
116
+ | `justify` | `'flex-start' \| 'center' \| 'flex-end' \| 'space-between' \| 'space-around'` | Main-axis alignment. |
117
+ | `wrap` | `boolean` | Enable flex wrapping. Defaults to `true`. |
118
+ | `block` | `boolean` | Set width to 100%. |
119
+ | `rowGap` | `number` | Gap between rows in `rem` units. |
120
+ | `height` | `string` | Sets `minHeight`. |
121
+ | `className` | `string` | Additional CSS class names. |
122
+ | `style` | `CSSProperties` | Inline styles. |
123
+ | `testId` | `string` | Maps to `data-testid`. |
124
+ | `children` | `ReactNode` | Content. |
125
+
126
+ ### Box.Column
127
+
128
+ | Prop | Type | Description |
129
+ | --- | --- | --- |
130
+ | `col` | `number` | Shorthand for `span`. |
131
+ | `testId` | `string` | Maps to `data-testid`. |
132
+ | *All `ColProps`* | — | All Ant Design Col props (`span`, `offset`, `xs`, `sm`, `md`, `lg`, `xl`, `xxl`, etc.). |
133
+
134
+ ### Box.Row
135
+
136
+ | Prop | Type | Description |
137
+ | --- | --- | --- |
138
+ | `testId` | `string` | Maps to `data-testid`. |
139
+ | *All `RowProps`* | — | All Ant Design Row props (`gutter`, `align`, `justify`, `wrap`, etc.). |
140
+
141
+ ## Consumer Example
142
+
143
+ ```tsx
144
+ import { Box } from '@fvc/box';
145
+
146
+ export function FilterBar({ onSearch, onReset }) {
147
+ return (
148
+ <Box direction="column" rowGap={1} block>
149
+ <Box.Row gutter={16}>
150
+ <Box.Column col={8}>
151
+ <Input name="name" label="Name" />
152
+ </Box.Column>
153
+ <Box.Column col={8}>
154
+ <Input name="status" label="Status" />
155
+ </Box.Column>
156
+ <Box.Column col={8}>
157
+ <Input name="date" label="Date" />
158
+ </Box.Column>
159
+ </Box.Row>
160
+
161
+ <Box direction="row" justify="flex-end">
162
+ <Button type="secondary" onClick={onReset}>Reset</Button>
163
+ <Button type="primary" onClick={onSearch}>Search</Button>
164
+ </Box>
165
+ </Box>
166
+ );
167
+ }
168
+ ```
169
+
170
+ ## Testing
171
+
172
+ ```tsx
173
+ <Box direction="row" testId="action-bar">
174
+ <Button>Save</Button>
175
+ </Box>
176
+ ```
177
+
178
+ ```tsx
179
+ screen.getByTestId('action-bar');
180
+ ```
181
+
182
+ ## Development
183
+
184
+ ```bash
185
+ bun run lint
186
+ bun run type-check
187
+ bun run test
188
+ bun run build
189
+ ```
package/package.json CHANGED
@@ -1,6 +1,16 @@
1
1
  {
2
2
  "name": "@fvc/box",
3
- "version": "1.1.1",
3
+ "version": "1.1.2-rc.0",
4
+ "keywords": [
5
+ "react",
6
+ "react-component",
7
+ "fvc",
8
+ "fe-vis-core",
9
+ "ui",
10
+ "box",
11
+ "design-system",
12
+ "antd"
13
+ ],
4
14
  "main": "./dist/lib/index.js",
5
15
  "types": "./dist/lib/box/src/index.d.ts",
6
16
  "files": [