@bwui/react 0.1.2 → 0.1.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/README.md +12 -4
- package/dist/pages.d.ts +3 -1
- package/dist/pages.js +2 -2
- package/package.json +3 -3
- package/src/pages.tsx +4 -1
package/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# `@bwui/react`
|
|
2
2
|
|
|
3
|
-
Typed React adapter for Brickwork
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
**Early (0.1.x).** Typed React adapter for Brickwork: same `bw-*` contract as
|
|
4
|
+
Django and HTML, but not Django-level production proof. Components emit the
|
|
5
|
+
same `bw-*` classes as the HTML gallery and `django-brickwork`. Peer CSS is
|
|
6
|
+
`@bwui/css`; this package does not bundle the stylesheet.
|
|
6
7
|
|
|
7
8
|
```bash
|
|
8
9
|
npm install @bwui/react @bwui/css
|
|
@@ -17,13 +18,20 @@ export function App() {
|
|
|
17
18
|
}
|
|
18
19
|
```
|
|
19
20
|
|
|
21
|
+
## Runnable example
|
|
22
|
+
|
|
23
|
+
One three-page site (Northline: `Homepage`, `Landing`, `ContactForm`) is the
|
|
24
|
+
runnable example. It is one file, `App.tsx`, and it is what the demo host
|
|
25
|
+
preview renders and the brickworkui.com React copy tab shows (monorepo path
|
|
26
|
+
`examples/react-vite`). Start there rather than from an isolated snippet.
|
|
27
|
+
|
|
20
28
|
## Four jobs
|
|
21
29
|
|
|
22
30
|
| Job | Export |
|
|
23
31
|
|---|---|
|
|
24
32
|
| Homepage | `<Homepage>` |
|
|
25
33
|
| Landing | `<Landing>` |
|
|
26
|
-
| Forms | `<Form>`, `<Field>`, `<Input>`, `<Checkbox>`, `<Combobox>`, `<DatePicker>`, `<DateRangePicker>`, `<TimeInput>`, `<ContactForm>` |
|
|
34
|
+
| Forms | `<Form>`, `<Field>`, `<Input>`, `<Checkbox>`, `<Combobox>`, `<DatePicker>`, `<DateRangePicker>`, `<TimeInput>`, `<ContactForm>` (`cancelHref` sets where Cancel leads) |
|
|
27
35
|
| Components | `<Button>`, `<Card>`, `<Modal>`, `<DataTable>`, `<CommandPalette>`, … |
|
|
28
36
|
|
|
29
37
|
Copy Pro gallery HTML from brickworkui.com. `@bwui/gallery` is not an npm
|
package/dist/pages.d.ts
CHANGED
|
@@ -38,5 +38,7 @@ export type ContactFormProps = {
|
|
|
38
38
|
value: string;
|
|
39
39
|
label: string;
|
|
40
40
|
}>;
|
|
41
|
+
/** Where "Cancel" leads. Defaults to the gallery homepage route. */
|
|
42
|
+
cancelHref?: string;
|
|
41
43
|
};
|
|
42
|
-
export declare function ContactForm({ title, description, onSubmit, topics, }: ContactFormProps): React.JSX.Element;
|
|
44
|
+
export declare function ContactForm({ title, description, onSubmit, topics, cancelHref, }: ContactFormProps): React.JSX.Element;
|
package/dist/pages.js
CHANGED
|
@@ -69,7 +69,7 @@ export function ContactForm({ title = 'Contact', description = 'Gallery form rec
|
|
|
69
69
|
{ value: 'product', label: 'Product question' },
|
|
70
70
|
{ value: 'partnership', label: 'Partnership' },
|
|
71
71
|
{ value: 'support', label: 'Support' },
|
|
72
|
-
], }) {
|
|
72
|
+
], cancelHref = '/gallery/homepage', }) {
|
|
73
73
|
return (_jsxs(_Fragment, { children: [_jsx(SkipLink, {}), _jsx("main", { id: "main", style: {
|
|
74
74
|
padding: 'var(--bw-space-10) var(--bw-space-6)',
|
|
75
75
|
maxWidth: '32rem',
|
|
@@ -80,5 +80,5 @@ export function ContactForm({ title = 'Contact', description = 'Gallery form rec
|
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
e.preventDefault();
|
|
83
|
-
}, style: { gap: 'var(--bw-space-4)' }, children: [_jsxs(Field, { children: [_jsx(Label, { htmlFor: "bw-contact-name", children: "Name" }), _jsx(Input, { id: "bw-contact-name", name: "name", autoComplete: "name", required: true })] }), _jsxs(Field, { children: [_jsx(Label, { htmlFor: "bw-contact-email", children: "Email" }), _jsx(Input, { id: "bw-contact-email", name: "email", type: "email", autoComplete: "email", required: true }), _jsx(Hint, { children: "We only use this to reply." })] }), _jsxs(Field, { children: [_jsx(Label, { htmlFor: "bw-contact-topic", children: "Topic" }), _jsx(Combobox, { id: "bw-contact-topic", name: "topic", options: topics, placeholder: "Search topics" })] }), _jsxs(Field, { children: [_jsx(Label, { htmlFor: "bw-contact-date", children: "Preferred date" }), _jsx(DatePicker, { id: "bw-contact-date", name: "date" })] }), _jsxs(Field, { children: [_jsx(Label, { htmlFor: "bw-contact-from", children: "Availability" }), _jsx(DateRangePicker, { startId: "bw-contact-from", endId: "bw-contact-to", startName: "from", endName: "to" })] }), _jsxs(Field, { children: [_jsx(Label, { htmlFor: "bw-contact-time", children: "Call time" }), _jsx(TimeInput, { id: "bw-contact-time", name: "time" })] }), _jsxs(Field, { children: [_jsx(Label, { htmlFor: "bw-contact-message", children: "Message" }), _jsx(Textarea, { id: "bw-contact-message", name: "message", rows: 5, required: true })] }), _jsx(Field, { children: _jsxs(Cluster, { children: [_jsx(Checkbox, { id: "bw-contact-copy", name: "copy" }), _jsx(Label, { htmlFor: "bw-contact-copy", children: "Send me a copy" })] }) }), _jsxs(FormActions, { children: [_jsx(Button, { type: "submit", variant: "primary", children: "Send message" }), _jsx(ButtonLink, { href:
|
|
83
|
+
}, style: { gap: 'var(--bw-space-4)' }, children: [_jsxs(Field, { children: [_jsx(Label, { htmlFor: "bw-contact-name", children: "Name" }), _jsx(Input, { id: "bw-contact-name", name: "name", autoComplete: "name", required: true })] }), _jsxs(Field, { children: [_jsx(Label, { htmlFor: "bw-contact-email", children: "Email" }), _jsx(Input, { id: "bw-contact-email", name: "email", type: "email", autoComplete: "email", required: true }), _jsx(Hint, { children: "We only use this to reply." })] }), _jsxs(Field, { children: [_jsx(Label, { htmlFor: "bw-contact-topic", children: "Topic" }), _jsx(Combobox, { id: "bw-contact-topic", name: "topic", options: topics, placeholder: "Search topics" })] }), _jsxs(Field, { children: [_jsx(Label, { htmlFor: "bw-contact-date", children: "Preferred date" }), _jsx(DatePicker, { id: "bw-contact-date", name: "date" })] }), _jsxs(Field, { children: [_jsx(Label, { htmlFor: "bw-contact-from", children: "Availability" }), _jsx(DateRangePicker, { startId: "bw-contact-from", endId: "bw-contact-to", startName: "from", endName: "to" })] }), _jsxs(Field, { children: [_jsx(Label, { htmlFor: "bw-contact-time", children: "Call time" }), _jsx(TimeInput, { id: "bw-contact-time", name: "time" })] }), _jsxs(Field, { children: [_jsx(Label, { htmlFor: "bw-contact-message", children: "Message" }), _jsx(Textarea, { id: "bw-contact-message", name: "message", rows: 5, required: true })] }), _jsx(Field, { children: _jsxs(Cluster, { children: [_jsx(Checkbox, { id: "bw-contact-copy", name: "copy" }), _jsx(Label, { htmlFor: "bw-contact-copy", children: "Send me a copy" })] }) }), _jsxs(FormActions, { children: [_jsx(Button, { type: "submit", variant: "primary", children: "Send message" }), _jsx(ButtonLink, { href: cancelHref, variant: "ghost", children: "Cancel" })] })] })] }) })] }));
|
|
84
84
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bwui/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "React adapter for Brickwork: typed components bound to the Brickwork token substrate and bw-* class contract.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"react-dom": ">=18"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@bwui/css": "0.1.
|
|
30
|
-
"@bwui/tokens": "0.1.
|
|
29
|
+
"@bwui/css": "0.1.3",
|
|
30
|
+
"@bwui/tokens": "0.1.3"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/react": "^18",
|
package/src/pages.tsx
CHANGED
|
@@ -254,6 +254,8 @@ export type ContactFormProps = {
|
|
|
254
254
|
description?: React.ReactNode
|
|
255
255
|
onSubmit?: React.FormEventHandler<HTMLFormElement>
|
|
256
256
|
topics?: Array<{ value: string; label: string }>
|
|
257
|
+
/** Where "Cancel" leads. Defaults to the gallery homepage route. */
|
|
258
|
+
cancelHref?: string
|
|
257
259
|
}
|
|
258
260
|
|
|
259
261
|
export function ContactForm({
|
|
@@ -265,6 +267,7 @@ export function ContactForm({
|
|
|
265
267
|
{ value: 'partnership', label: 'Partnership' },
|
|
266
268
|
{ value: 'support', label: 'Support' },
|
|
267
269
|
],
|
|
270
|
+
cancelHref = '/gallery/homepage',
|
|
268
271
|
}: ContactFormProps) {
|
|
269
272
|
return (
|
|
270
273
|
<>
|
|
@@ -349,7 +352,7 @@ export function ContactForm({
|
|
|
349
352
|
<Button type="submit" variant="primary">
|
|
350
353
|
Send message
|
|
351
354
|
</Button>
|
|
352
|
-
<ButtonLink href=
|
|
355
|
+
<ButtonLink href={cancelHref} variant="ghost">
|
|
353
356
|
Cancel
|
|
354
357
|
</ButtonLink>
|
|
355
358
|
</FormActions>
|