@tonyarbor/components 0.1.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/README.md +278 -0
- package/dist/Button.d.mts +41 -0
- package/dist/Button.d.ts +41 -0
- package/dist/Button.js +230 -0
- package/dist/Button.js.map +1 -0
- package/dist/Button.mjs +7 -0
- package/dist/Button.mjs.map +1 -0
- package/dist/Card.d.mts +31 -0
- package/dist/Card.d.ts +31 -0
- package/dist/Card.js +92 -0
- package/dist/Card.js.map +1 -0
- package/dist/Card.mjs +7 -0
- package/dist/Card.mjs.map +1 -0
- package/dist/Input.d.mts +48 -0
- package/dist/Input.d.ts +48 -0
- package/dist/Input.js +189 -0
- package/dist/Input.js.map +1 -0
- package/dist/Input.mjs +7 -0
- package/dist/Input.mjs.map +1 -0
- package/dist/Tag.d.mts +30 -0
- package/dist/Tag.d.ts +30 -0
- package/dist/Tag.js +113 -0
- package/dist/Tag.js.map +1 -0
- package/dist/Tag.mjs +7 -0
- package/dist/Tag.mjs.map +1 -0
- package/dist/chunk-ALEJXAZY.mjs +194 -0
- package/dist/chunk-ALEJXAZY.mjs.map +1 -0
- package/dist/chunk-NOHUMPXV.mjs +153 -0
- package/dist/chunk-NOHUMPXV.mjs.map +1 -0
- package/dist/chunk-QCRIECT7.mjs +77 -0
- package/dist/chunk-QCRIECT7.mjs.map +1 -0
- package/dist/chunk-ZFKW3P6P.mjs +56 -0
- package/dist/chunk-ZFKW3P6P.mjs.map +1 -0
- package/dist/index.d.mts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +510 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +19 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +81 -0
package/README.md
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
# @arbor-ds/components
|
|
2
|
+
|
|
3
|
+
React components for the Arbor Design System.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @arbor-ds/components @arbor-ds/tokens
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Peer Dependencies:**
|
|
12
|
+
- React >= 18.0.0
|
|
13
|
+
- React DOM >= 18.0.0
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Import Components
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { Button, Card, Input } from '@arbor-ds/components';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Import CSS Variables (Optional)
|
|
24
|
+
|
|
25
|
+
For design tokens to be available as CSS variables:
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import '@arbor-ds/tokens/css';
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Components
|
|
32
|
+
|
|
33
|
+
### Button
|
|
34
|
+
|
|
35
|
+
A versatile button component with multiple variants and sizes.
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
<Button variant="primary" size="md" onClick={() => console.log('Clicked')}>
|
|
39
|
+
Click me
|
|
40
|
+
</Button>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
#### Props
|
|
44
|
+
|
|
45
|
+
| Prop | Type | Default | Description |
|
|
46
|
+
|------|------|---------|-------------|
|
|
47
|
+
| `variant` | `'primary' \| 'secondary' \| 'ghost'` | `'primary'` | Visual style variant |
|
|
48
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Button size |
|
|
49
|
+
| `asChild` | `boolean` | `false` | Render as child component |
|
|
50
|
+
| `disabled` | `boolean` | `false` | Disabled state |
|
|
51
|
+
| `children` | `ReactNode` | - | Button content |
|
|
52
|
+
|
|
53
|
+
#### Examples
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
// Primary button
|
|
57
|
+
<Button variant="primary">Submit</Button>
|
|
58
|
+
|
|
59
|
+
// Secondary button
|
|
60
|
+
<Button variant="secondary">Cancel</Button>
|
|
61
|
+
|
|
62
|
+
// Ghost button
|
|
63
|
+
<Button variant="ghost">Learn more</Button>
|
|
64
|
+
|
|
65
|
+
// Small size
|
|
66
|
+
<Button size="sm">Small button</Button>
|
|
67
|
+
|
|
68
|
+
// Large size
|
|
69
|
+
<Button size="lg">Large button</Button>
|
|
70
|
+
|
|
71
|
+
// Disabled
|
|
72
|
+
<Button disabled>Disabled button</Button>
|
|
73
|
+
|
|
74
|
+
// As child (renders as link)
|
|
75
|
+
<Button asChild>
|
|
76
|
+
<a href="/home">Go home</a>
|
|
77
|
+
</Button>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
### Card
|
|
83
|
+
|
|
84
|
+
A container component with consistent styling and flexible padding.
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
<Card padding="md">
|
|
88
|
+
<h2>Card Title</h2>
|
|
89
|
+
<p>Card content goes here</p>
|
|
90
|
+
</Card>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
#### Props
|
|
94
|
+
|
|
95
|
+
| Prop | Type | Default | Description |
|
|
96
|
+
|------|------|---------|-------------|
|
|
97
|
+
| `padding` | `'none' \| 'sm' \| 'md' \| 'lg'` | `'md'` | Internal padding |
|
|
98
|
+
| `children` | `ReactNode` | - | Card content |
|
|
99
|
+
|
|
100
|
+
#### Examples
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
// Standard card
|
|
104
|
+
<Card>
|
|
105
|
+
<h3>Default padding</h3>
|
|
106
|
+
</Card>
|
|
107
|
+
|
|
108
|
+
// No padding
|
|
109
|
+
<Card padding="none">
|
|
110
|
+
<img src="/banner.jpg" alt="Banner" />
|
|
111
|
+
</Card>
|
|
112
|
+
|
|
113
|
+
// Small padding
|
|
114
|
+
<Card padding="sm">Compact content</Card>
|
|
115
|
+
|
|
116
|
+
// Large padding
|
|
117
|
+
<Card padding="lg">
|
|
118
|
+
<h1>Spacious content</h1>
|
|
119
|
+
</Card>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
### Input
|
|
125
|
+
|
|
126
|
+
A text input component with label, validation states, and helper text.
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
<Input
|
|
130
|
+
label="Email"
|
|
131
|
+
type="email"
|
|
132
|
+
placeholder="you@example.com"
|
|
133
|
+
helperText="We'll never share your email"
|
|
134
|
+
/>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### Props
|
|
138
|
+
|
|
139
|
+
| Prop | Type | Default | Description |
|
|
140
|
+
|------|------|---------|-------------|
|
|
141
|
+
| `label` | `string` | - | Input label |
|
|
142
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Input size |
|
|
143
|
+
| `state` | `'default' \| 'error' \| 'success'` | `'default'` | Validation state |
|
|
144
|
+
| `error` | `string` | - | Error message to display |
|
|
145
|
+
| `helperText` | `string` | - | Helper text below input |
|
|
146
|
+
| `type` | `string` | `'text'` | HTML input type |
|
|
147
|
+
| `placeholder` | `string` | - | Placeholder text |
|
|
148
|
+
| `disabled` | `boolean` | `false` | Disabled state |
|
|
149
|
+
|
|
150
|
+
#### Examples
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
// Basic input
|
|
154
|
+
<Input placeholder="Enter your name" />
|
|
155
|
+
|
|
156
|
+
// With label
|
|
157
|
+
<Input label="Email" type="email" />
|
|
158
|
+
|
|
159
|
+
// With helper text
|
|
160
|
+
<Input
|
|
161
|
+
label="Password"
|
|
162
|
+
type="password"
|
|
163
|
+
helperText="Must be at least 8 characters"
|
|
164
|
+
/>
|
|
165
|
+
|
|
166
|
+
// Error state
|
|
167
|
+
<Input
|
|
168
|
+
label="Username"
|
|
169
|
+
error="This username is already taken"
|
|
170
|
+
/>
|
|
171
|
+
|
|
172
|
+
// Success state
|
|
173
|
+
<Input
|
|
174
|
+
label="Email"
|
|
175
|
+
state="success"
|
|
176
|
+
value="valid@email.com"
|
|
177
|
+
/>
|
|
178
|
+
|
|
179
|
+
// Different sizes
|
|
180
|
+
<Input size="sm" placeholder="Small" />
|
|
181
|
+
<Input size="md" placeholder="Medium" />
|
|
182
|
+
<Input size="lg" placeholder="Large" />
|
|
183
|
+
|
|
184
|
+
// Disabled
|
|
185
|
+
<Input disabled placeholder="Disabled input" />
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Composition Example
|
|
191
|
+
|
|
192
|
+
```tsx
|
|
193
|
+
import { Button, Card, Input } from '@arbor-ds/components';
|
|
194
|
+
|
|
195
|
+
function LoginForm() {
|
|
196
|
+
return (
|
|
197
|
+
<Card padding="lg">
|
|
198
|
+
<h2>Sign In</h2>
|
|
199
|
+
|
|
200
|
+
<Input
|
|
201
|
+
label="Email"
|
|
202
|
+
type="email"
|
|
203
|
+
placeholder="you@example.com"
|
|
204
|
+
/>
|
|
205
|
+
|
|
206
|
+
<Input
|
|
207
|
+
label="Password"
|
|
208
|
+
type="password"
|
|
209
|
+
placeholder="••••••••"
|
|
210
|
+
/>
|
|
211
|
+
|
|
212
|
+
<Button variant="primary" size="md">
|
|
213
|
+
Sign In
|
|
214
|
+
</Button>
|
|
215
|
+
|
|
216
|
+
<Button variant="ghost" size="sm">
|
|
217
|
+
Forgot password?
|
|
218
|
+
</Button>
|
|
219
|
+
</Card>
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Accessibility
|
|
225
|
+
|
|
226
|
+
All components are built with accessibility in mind:
|
|
227
|
+
|
|
228
|
+
- **Button**: Proper focus states, keyboard navigation
|
|
229
|
+
- **Card**: Semantic HTML structure
|
|
230
|
+
- **Input**: Associated labels, ARIA attributes, error announcements
|
|
231
|
+
|
|
232
|
+
## Customization
|
|
233
|
+
|
|
234
|
+
Components accept standard HTML attributes and can be customized via:
|
|
235
|
+
|
|
236
|
+
1. **className**: Add custom CSS classes
|
|
237
|
+
2. **style**: Inline styles (merged with component styles)
|
|
238
|
+
3. **Design tokens**: Modify tokens to change global appearance
|
|
239
|
+
|
|
240
|
+
Example:
|
|
241
|
+
|
|
242
|
+
```tsx
|
|
243
|
+
<Button className="my-custom-button" style={{ marginTop: '1rem' }}>
|
|
244
|
+
Custom styled button
|
|
245
|
+
</Button>
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## TypeScript
|
|
249
|
+
|
|
250
|
+
Full TypeScript support with exported types:
|
|
251
|
+
|
|
252
|
+
```tsx
|
|
253
|
+
import type { ButtonProps, CardProps, InputProps } from '@arbor-ds/components';
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Development
|
|
257
|
+
|
|
258
|
+
### Build
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
npm run build
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Watch Mode
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
npm run dev
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Tests
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
npm test
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## License
|
|
277
|
+
|
|
278
|
+
MIT
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type ButtonVariant = 'primary' | 'secondary' | 'destructive' | 'ghost';
|
|
4
|
+
type ButtonSize = 'small' | 'medium';
|
|
5
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
6
|
+
/**
|
|
7
|
+
* The visual style variant of the button
|
|
8
|
+
* @default 'primary'
|
|
9
|
+
*/
|
|
10
|
+
variant?: ButtonVariant;
|
|
11
|
+
/**
|
|
12
|
+
* The size of the button
|
|
13
|
+
* @default 'medium'
|
|
14
|
+
*/
|
|
15
|
+
size?: ButtonSize;
|
|
16
|
+
/**
|
|
17
|
+
* If true, the component will be rendered as a child element
|
|
18
|
+
* and merge its props with the child
|
|
19
|
+
*/
|
|
20
|
+
asChild?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The content of the button
|
|
23
|
+
*/
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Button component - Arbor Design System
|
|
28
|
+
*
|
|
29
|
+
* A flexible button component with pill-shaped design following Arbor's design system.
|
|
30
|
+
* Supports primary (green), secondary (outlined), destructive (red), and ghost (link-style) variants.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <Button variant="primary" size="medium">
|
|
35
|
+
* Save Changes
|
|
36
|
+
* </Button>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
40
|
+
|
|
41
|
+
export { Button, type ButtonProps };
|
package/dist/Button.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type ButtonVariant = 'primary' | 'secondary' | 'destructive' | 'ghost';
|
|
4
|
+
type ButtonSize = 'small' | 'medium';
|
|
5
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
6
|
+
/**
|
|
7
|
+
* The visual style variant of the button
|
|
8
|
+
* @default 'primary'
|
|
9
|
+
*/
|
|
10
|
+
variant?: ButtonVariant;
|
|
11
|
+
/**
|
|
12
|
+
* The size of the button
|
|
13
|
+
* @default 'medium'
|
|
14
|
+
*/
|
|
15
|
+
size?: ButtonSize;
|
|
16
|
+
/**
|
|
17
|
+
* If true, the component will be rendered as a child element
|
|
18
|
+
* and merge its props with the child
|
|
19
|
+
*/
|
|
20
|
+
asChild?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The content of the button
|
|
23
|
+
*/
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Button component - Arbor Design System
|
|
28
|
+
*
|
|
29
|
+
* A flexible button component with pill-shaped design following Arbor's design system.
|
|
30
|
+
* Supports primary (green), secondary (outlined), destructive (red), and ghost (link-style) variants.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <Button variant="primary" size="medium">
|
|
35
|
+
* Save Changes
|
|
36
|
+
* </Button>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
40
|
+
|
|
41
|
+
export { Button, type ButtonProps };
|
package/dist/Button.js
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/Button/index.ts
|
|
31
|
+
var Button_exports = {};
|
|
32
|
+
__export(Button_exports, {
|
|
33
|
+
Button: () => Button
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(Button_exports);
|
|
36
|
+
|
|
37
|
+
// src/Button/Button.tsx
|
|
38
|
+
var React = __toESM(require("react"));
|
|
39
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
40
|
+
var import_clsx = require("clsx");
|
|
41
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
var buttonStyles = {
|
|
43
|
+
base: {
|
|
44
|
+
display: "inline-flex",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
justifyContent: "center",
|
|
47
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
48
|
+
fontWeight: "500",
|
|
49
|
+
borderRadius: "99px",
|
|
50
|
+
// Pill shape
|
|
51
|
+
border: "none",
|
|
52
|
+
cursor: "pointer",
|
|
53
|
+
transition: "all 0.2s ease-in-out",
|
|
54
|
+
outline: "none"
|
|
55
|
+
},
|
|
56
|
+
variants: {
|
|
57
|
+
primary: {
|
|
58
|
+
backgroundColor: "#0e8a0e",
|
|
59
|
+
// brand-600
|
|
60
|
+
color: "#ffffff",
|
|
61
|
+
":hover": {
|
|
62
|
+
backgroundColor: "#005700"
|
|
63
|
+
// brand-800
|
|
64
|
+
},
|
|
65
|
+
":active": {
|
|
66
|
+
backgroundColor: "#024002"
|
|
67
|
+
// brand-900
|
|
68
|
+
},
|
|
69
|
+
":focus-visible": {
|
|
70
|
+
outline: "3px solid #3cad51",
|
|
71
|
+
// brand-500
|
|
72
|
+
outlineOffset: "0px"
|
|
73
|
+
},
|
|
74
|
+
":disabled": {
|
|
75
|
+
backgroundColor: "#b3b3b3",
|
|
76
|
+
// grey-400
|
|
77
|
+
cursor: "not-allowed"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
secondary: {
|
|
81
|
+
backgroundColor: "#ffffff",
|
|
82
|
+
color: "#2f2f2f",
|
|
83
|
+
// grey-900
|
|
84
|
+
border: "1px solid #d1d1d1",
|
|
85
|
+
// grey-300
|
|
86
|
+
":hover": {
|
|
87
|
+
backgroundColor: "#f8f8f8"
|
|
88
|
+
// grey-050
|
|
89
|
+
},
|
|
90
|
+
":active": {
|
|
91
|
+
backgroundColor: "#efefef"
|
|
92
|
+
// grey-100
|
|
93
|
+
},
|
|
94
|
+
":focus-visible": {
|
|
95
|
+
outline: "3px solid #3cad51",
|
|
96
|
+
// brand-500
|
|
97
|
+
outlineOffset: "0px"
|
|
98
|
+
},
|
|
99
|
+
":disabled": {
|
|
100
|
+
backgroundColor: "#f8f8f8",
|
|
101
|
+
color: "#b3b3b3",
|
|
102
|
+
cursor: "not-allowed"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
destructive: {
|
|
106
|
+
backgroundColor: "#c93232",
|
|
107
|
+
// destructive-500
|
|
108
|
+
color: "#ffffff",
|
|
109
|
+
":hover": {
|
|
110
|
+
backgroundColor: "#920a0a"
|
|
111
|
+
// destructive-700
|
|
112
|
+
},
|
|
113
|
+
":active": {
|
|
114
|
+
backgroundColor: "#610202"
|
|
115
|
+
// destructive-800
|
|
116
|
+
},
|
|
117
|
+
":focus-visible": {
|
|
118
|
+
outline: "3px solid #e86565",
|
|
119
|
+
// destructive-300
|
|
120
|
+
outlineOffset: "0px"
|
|
121
|
+
},
|
|
122
|
+
":disabled": {
|
|
123
|
+
backgroundColor: "#b3b3b3",
|
|
124
|
+
cursor: "not-allowed"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
ghost: {
|
|
128
|
+
backgroundColor: "transparent",
|
|
129
|
+
color: "#0b800b",
|
|
130
|
+
// brand-700 for link style
|
|
131
|
+
textDecoration: "underline",
|
|
132
|
+
":hover": {
|
|
133
|
+
color: "#005700"
|
|
134
|
+
// brand-800
|
|
135
|
+
},
|
|
136
|
+
":active": {
|
|
137
|
+
color: "#024002"
|
|
138
|
+
// brand-900
|
|
139
|
+
},
|
|
140
|
+
":focus-visible": {
|
|
141
|
+
outline: "3px solid #3cad51",
|
|
142
|
+
outlineOffset: "2px"
|
|
143
|
+
},
|
|
144
|
+
":disabled": {
|
|
145
|
+
color: "#b3b3b3",
|
|
146
|
+
cursor: "not-allowed"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
sizes: {
|
|
151
|
+
small: {
|
|
152
|
+
height: "32px",
|
|
153
|
+
fontSize: "13px",
|
|
154
|
+
padding: "8px 16px"
|
|
155
|
+
},
|
|
156
|
+
medium: {
|
|
157
|
+
height: "36px",
|
|
158
|
+
fontSize: "13px",
|
|
159
|
+
padding: "8px 16px"
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
var Button = React.forwardRef(
|
|
164
|
+
({
|
|
165
|
+
variant = "primary",
|
|
166
|
+
size = "medium",
|
|
167
|
+
asChild = false,
|
|
168
|
+
className,
|
|
169
|
+
disabled,
|
|
170
|
+
style,
|
|
171
|
+
children,
|
|
172
|
+
onMouseEnter,
|
|
173
|
+
onMouseLeave,
|
|
174
|
+
onFocus,
|
|
175
|
+
onBlur,
|
|
176
|
+
...props
|
|
177
|
+
}, ref) => {
|
|
178
|
+
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
179
|
+
const [isHovered, setIsHovered] = React.useState(false);
|
|
180
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
181
|
+
const variantStyles = buttonStyles.variants[variant];
|
|
182
|
+
const sizeStyles = buttonStyles.sizes[size];
|
|
183
|
+
const combinedStyle = {
|
|
184
|
+
...buttonStyles.base,
|
|
185
|
+
...variantStyles,
|
|
186
|
+
...sizeStyles,
|
|
187
|
+
...isHovered && !disabled && variantStyles[":hover"],
|
|
188
|
+
...isFocused && !disabled && variantStyles[":focus-visible"],
|
|
189
|
+
...disabled && variantStyles[":disabled"],
|
|
190
|
+
...style
|
|
191
|
+
};
|
|
192
|
+
const handleMouseEnter = (e) => {
|
|
193
|
+
setIsHovered(true);
|
|
194
|
+
onMouseEnter?.(e);
|
|
195
|
+
};
|
|
196
|
+
const handleMouseLeave = (e) => {
|
|
197
|
+
setIsHovered(false);
|
|
198
|
+
onMouseLeave?.(e);
|
|
199
|
+
};
|
|
200
|
+
const handleFocus = (e) => {
|
|
201
|
+
setIsFocused(true);
|
|
202
|
+
onFocus?.(e);
|
|
203
|
+
};
|
|
204
|
+
const handleBlur = (e) => {
|
|
205
|
+
setIsFocused(false);
|
|
206
|
+
onBlur?.(e);
|
|
207
|
+
};
|
|
208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
209
|
+
Comp,
|
|
210
|
+
{
|
|
211
|
+
ref,
|
|
212
|
+
className: (0, import_clsx.clsx)("arbor-button", className),
|
|
213
|
+
style: combinedStyle,
|
|
214
|
+
disabled,
|
|
215
|
+
onMouseEnter: handleMouseEnter,
|
|
216
|
+
onMouseLeave: handleMouseLeave,
|
|
217
|
+
onFocus: handleFocus,
|
|
218
|
+
onBlur: handleBlur,
|
|
219
|
+
...props,
|
|
220
|
+
children
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
Button.displayName = "Button";
|
|
226
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
227
|
+
0 && (module.exports = {
|
|
228
|
+
Button
|
|
229
|
+
});
|
|
230
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Button/index.ts","../src/Button/Button.tsx"],"sourcesContent":["export { Button } from './Button';\nexport type { ButtonProps } from './Button';\n","import * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { clsx } from 'clsx';\n\nexport type ButtonVariant = 'primary' | 'secondary' | 'destructive' | 'ghost';\nexport type ButtonSize = 'small' | 'medium';\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * The visual style variant of the button\n * @default 'primary'\n */\n variant?: ButtonVariant;\n /**\n * The size of the button\n * @default 'medium'\n */\n size?: ButtonSize;\n /**\n * If true, the component will be rendered as a child element\n * and merge its props with the child\n */\n asChild?: boolean;\n /**\n * The content of the button\n */\n children: React.ReactNode;\n}\n\n// Arbor Design System button styles\nconst buttonStyles = {\n base: {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n fontWeight: '500',\n borderRadius: '99px', // Pill shape\n border: 'none',\n cursor: 'pointer',\n transition: 'all 0.2s ease-in-out',\n outline: 'none',\n },\n variants: {\n primary: {\n backgroundColor: '#0e8a0e', // brand-600\n color: '#ffffff',\n ':hover': {\n backgroundColor: '#005700', // brand-800\n },\n ':active': {\n backgroundColor: '#024002', // brand-900\n },\n ':focus-visible': {\n outline: '3px solid #3cad51', // brand-500\n outlineOffset: '0px',\n },\n ':disabled': {\n backgroundColor: '#b3b3b3', // grey-400\n cursor: 'not-allowed',\n },\n },\n secondary: {\n backgroundColor: '#ffffff',\n color: '#2f2f2f', // grey-900\n border: '1px solid #d1d1d1', // grey-300\n ':hover': {\n backgroundColor: '#f8f8f8', // grey-050\n },\n ':active': {\n backgroundColor: '#efefef', // grey-100\n },\n ':focus-visible': {\n outline: '3px solid #3cad51', // brand-500\n outlineOffset: '0px',\n },\n ':disabled': {\n backgroundColor: '#f8f8f8',\n color: '#b3b3b3',\n cursor: 'not-allowed',\n },\n },\n destructive: {\n backgroundColor: '#c93232', // destructive-500\n color: '#ffffff',\n ':hover': {\n backgroundColor: '#920a0a', // destructive-700\n },\n ':active': {\n backgroundColor: '#610202', // destructive-800\n },\n ':focus-visible': {\n outline: '3px solid #e86565', // destructive-300\n outlineOffset: '0px',\n },\n ':disabled': {\n backgroundColor: '#b3b3b3',\n cursor: 'not-allowed',\n },\n },\n ghost: {\n backgroundColor: 'transparent',\n color: '#0b800b', // brand-700 for link style\n textDecoration: 'underline',\n ':hover': {\n color: '#005700', // brand-800\n },\n ':active': {\n color: '#024002', // brand-900\n },\n ':focus-visible': {\n outline: '3px solid #3cad51',\n outlineOffset: '2px',\n },\n ':disabled': {\n color: '#b3b3b3',\n cursor: 'not-allowed',\n },\n },\n },\n sizes: {\n small: {\n height: '32px',\n fontSize: '13px',\n padding: '8px 16px',\n },\n medium: {\n height: '36px',\n fontSize: '13px',\n padding: '8px 16px',\n },\n },\n};\n\n/**\n * Button component - Arbor Design System\n *\n * A flexible button component with pill-shaped design following Arbor's design system.\n * Supports primary (green), secondary (outlined), destructive (red), and ghost (link-style) variants.\n *\n * @example\n * ```tsx\n * <Button variant=\"primary\" size=\"medium\">\n * Save Changes\n * </Button>\n * ```\n */\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n variant = 'primary',\n size = 'medium',\n asChild = false,\n className,\n disabled,\n style,\n children,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n ...props\n },\n ref\n ) => {\n const Comp = asChild ? Slot : 'button';\n const [isHovered, setIsHovered] = React.useState(false);\n const [isFocused, setIsFocused] = React.useState(false);\n\n const variantStyles = buttonStyles.variants[variant];\n const sizeStyles = buttonStyles.sizes[size];\n\n const combinedStyle: React.CSSProperties = {\n ...buttonStyles.base,\n ...variantStyles,\n ...sizeStyles,\n ...(isHovered && !disabled && variantStyles[':hover']),\n ...(isFocused && !disabled && variantStyles[':focus-visible']),\n ...(disabled && variantStyles[':disabled']),\n ...style,\n };\n\n const handleMouseEnter = (e: React.MouseEvent<HTMLButtonElement>) => {\n setIsHovered(true);\n onMouseEnter?.(e);\n };\n\n const handleMouseLeave = (e: React.MouseEvent<HTMLButtonElement>) => {\n setIsHovered(false);\n onMouseLeave?.(e);\n };\n\n const handleFocus = (e: React.FocusEvent<HTMLButtonElement>) => {\n setIsFocused(true);\n onFocus?.(e);\n };\n\n const handleBlur = (e: React.FocusEvent<HTMLButtonElement>) => {\n setIsFocused(false);\n onBlur?.(e);\n };\n\n return (\n <Comp\n ref={ref}\n className={clsx('arbor-button', className)}\n style={combinedStyle}\n disabled={disabled}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onFocus={handleFocus}\n onBlur={handleBlur}\n {...props}\n >\n {children}\n </Comp>\n );\n }\n);\n\nButton.displayName = 'Button';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,wBAAqB;AACrB,kBAAqB;AAyMf;AA7KN,IAAM,eAAe;AAAA,EACnB,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,cAAc;AAAA;AAAA,IACd,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,SAAS;AAAA,EACX;AAAA,EACA,UAAU;AAAA,IACR,SAAS;AAAA,MACP,iBAAiB;AAAA;AAAA,MACjB,OAAO;AAAA,MACP,UAAU;AAAA,QACR,iBAAiB;AAAA;AAAA,MACnB;AAAA,MACA,WAAW;AAAA,QACT,iBAAiB;AAAA;AAAA,MACnB;AAAA,MACA,kBAAkB;AAAA,QAChB,SAAS;AAAA;AAAA,QACT,eAAe;AAAA,MACjB;AAAA,MACA,aAAa;AAAA,QACX,iBAAiB;AAAA;AAAA,QACjB,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IACA,WAAW;AAAA,MACT,iBAAiB;AAAA,MACjB,OAAO;AAAA;AAAA,MACP,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Content":[],"mappings":"","names":[]}
|
package/dist/Card.d.mts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type PaddingVariant = 'none' | 'small' | 'medium' | 'large';
|
|
4
|
+
interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/**
|
|
6
|
+
* The padding variant of the card
|
|
7
|
+
* @default 'large'
|
|
8
|
+
*/
|
|
9
|
+
padding?: PaddingVariant;
|
|
10
|
+
/**
|
|
11
|
+
* The content of the card
|
|
12
|
+
*/
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Card component - Arbor Design System
|
|
17
|
+
*
|
|
18
|
+
* A container component that provides consistent styling for content cards.
|
|
19
|
+
* Uses subtle borders rather than shadows, following Arbor's minimal design approach.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <Card padding="large">
|
|
24
|
+
* <h2>Card Title</h2>
|
|
25
|
+
* <p>Card content goes here</p>
|
|
26
|
+
* </Card>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
|
|
30
|
+
|
|
31
|
+
export { Card, type CardProps };
|
package/dist/Card.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type PaddingVariant = 'none' | 'small' | 'medium' | 'large';
|
|
4
|
+
interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/**
|
|
6
|
+
* The padding variant of the card
|
|
7
|
+
* @default 'large'
|
|
8
|
+
*/
|
|
9
|
+
padding?: PaddingVariant;
|
|
10
|
+
/**
|
|
11
|
+
* The content of the card
|
|
12
|
+
*/
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Card component - Arbor Design System
|
|
17
|
+
*
|
|
18
|
+
* A container component that provides consistent styling for content cards.
|
|
19
|
+
* Uses subtle borders rather than shadows, following Arbor's minimal design approach.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <Card padding="large">
|
|
24
|
+
* <h2>Card Title</h2>
|
|
25
|
+
* <p>Card content goes here</p>
|
|
26
|
+
* </Card>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
|
|
30
|
+
|
|
31
|
+
export { Card, type CardProps };
|