@bwui/vue 0.0.0-stage → 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/dist/pages.js ADDED
@@ -0,0 +1,149 @@
1
+ import { defineComponent, h } from 'vue';
2
+ import { Combobox } from './combobox';
3
+ import { DatePicker, DateRangePicker } from './date-picker';
4
+ import { Button, ButtonLink, Card, Checkbox, Cluster, Field, Form, FormActions, Hint, Input, Label, SkipLink, Stack, Textarea, ThemeToggle, TimeInput, } from './primitives';
5
+ export const Homepage = defineComponent({
6
+ name: 'BwHomepage',
7
+ props: {
8
+ brand: { type: String, default: 'Brickwork' },
9
+ title: { type: String, default: 'Beautiful interfaces, out of the box' },
10
+ description: {
11
+ type: String,
12
+ default: 'Install a Brickwork delivery, copy a gallery template, brand with tokens, ship.',
13
+ },
14
+ },
15
+ setup(props) {
16
+ return () => [
17
+ h(SkipLink),
18
+ h('header', { class: 'bw-shell-marketing__header' }, [
19
+ h(Cluster, { style: { justifyContent: 'space-between', padding: 'var(--bw-space-4) var(--bw-space-6)' } }, () => [
20
+ h('strong', { class: 'bw-text-title-md' }, props.brand),
21
+ h('nav', { class: 'bw-cluster', 'aria-label': 'Primary' }, [
22
+ h(ButtonLink, { href: '#features', variant: 'ghost' }, () => 'Features'),
23
+ h(ButtonLink, { href: '/gallery/landing', variant: 'ghost' }, () => 'Landing'),
24
+ h(ButtonLink, { href: '/gallery/forms', variant: 'primary' }, () => 'Contact'),
25
+ h(ThemeToggle),
26
+ ]),
27
+ ]),
28
+ ]),
29
+ h('main', { id: 'main' }, [
30
+ h('section', { class: 'bw-hero', style: { padding: 'var(--bw-space-12) var(--bw-space-6)' } }, [
31
+ h(Stack, { style: { maxWidth: '40rem' } }, () => [
32
+ h('h1', { class: 'bw-text-display-md' }, props.title),
33
+ h('p', { class: 'bw-text-body-lg', style: { color: 'var(--bw-color-fg-muted)' } }, props.description),
34
+ h(Cluster, () => [
35
+ h(ButtonLink, { href: '/gallery/forms', variant: 'primary', size: 'lg' }, () => 'Get started'),
36
+ h(ButtonLink, { href: '/gallery/landing', variant: 'ghost', size: 'lg' }, () => 'See landing'),
37
+ ]),
38
+ ]),
39
+ ]),
40
+ h('section', {
41
+ id: 'features',
42
+ style: { padding: 'var(--bw-space-10) var(--bw-space-6)', background: 'var(--bw-color-surface-2)' },
43
+ }, [
44
+ h('div', { class: 'bw-grid' }, [
45
+ h(Card, () => [h('h2', { class: 'bw-text-title-sm' }, 'Tokens'), h('p', 'One --bw-* source.')]),
46
+ h(Card, () => [h('h2', { class: 'bw-text-title-sm' }, 'Components'), h('p', 'Same chrome on every stack.')]),
47
+ h(Card, () => [h('h2', { class: 'bw-text-title-sm' }, 'Gallery'), h('p', 'Homepage, landing, forms.')]),
48
+ ]),
49
+ ]),
50
+ ]),
51
+ ];
52
+ },
53
+ });
54
+ export const Landing = defineComponent({
55
+ name: 'BwLanding',
56
+ props: {
57
+ brand: { type: String, default: 'Brickwork' },
58
+ title: { type: String, default: 'Ship your next interface this afternoon' },
59
+ description: {
60
+ type: String,
61
+ default: 'One primary offer. One CTA. Gallery landings stay focused on conversion.',
62
+ },
63
+ },
64
+ setup(props) {
65
+ return () => [
66
+ h(SkipLink),
67
+ h('header', { style: { padding: 'var(--bw-space-4) var(--bw-space-6)' } }, [
68
+ h(Cluster, { style: { justifyContent: 'space-between' } }, () => [
69
+ h('strong', { class: 'bw-text-title-md' }, props.brand),
70
+ h(ThemeToggle),
71
+ ]),
72
+ ]),
73
+ h('main', { id: 'main', style: { padding: 'var(--bw-space-12) var(--bw-space-6)' } }, [
74
+ h(Stack, { class: 'bw-centre', style: { textAlign: 'center' } }, () => [
75
+ h('h1', { class: 'bw-text-display-sm' }, props.title),
76
+ h('p', { class: 'bw-text-body-lg', style: { color: 'var(--bw-color-fg-muted)' } }, props.description),
77
+ h(Cluster, { style: { justifyContent: 'center' } }, () => [
78
+ h(ButtonLink, { href: '/gallery/forms', variant: 'primary', size: 'lg' }, () => 'Start free'),
79
+ h(ButtonLink, { href: '/gallery/homepage', variant: 'ghost', size: 'lg' }, () => 'Back to homepage'),
80
+ ]),
81
+ ]),
82
+ ]),
83
+ ];
84
+ },
85
+ });
86
+ export const ContactForm = defineComponent({
87
+ name: 'BwContactForm',
88
+ props: {
89
+ topics: {
90
+ type: Array,
91
+ default: () => [
92
+ { value: 'product', label: 'Product question' },
93
+ { value: 'partnership', label: 'Partnership' },
94
+ { value: 'support', label: 'Support' },
95
+ ],
96
+ },
97
+ },
98
+ setup(props) {
99
+ return () => [
100
+ h(SkipLink),
101
+ h('main', { id: 'main', style: { padding: 'var(--bw-space-10) var(--bw-space-6)', maxWidth: '32rem', marginInline: 'auto' } }, [
102
+ h(Stack, () => [
103
+ h('h1', { class: 'bw-text-title-lg' }, 'Contact'),
104
+ h(Form, { onSubmit: (e) => e.preventDefault() }, () => [
105
+ h(Field, () => [
106
+ h(Label, { for: 'bw-contact-name' }, () => 'Name'),
107
+ h(Input, { id: 'bw-contact-name', name: 'name', required: true }),
108
+ ]),
109
+ h(Field, () => [
110
+ h(Label, { for: 'bw-contact-email' }, () => 'Email'),
111
+ h(Input, { id: 'bw-contact-email', name: 'email', type: 'email', required: true }),
112
+ h(Hint, () => 'We only use this to reply.'),
113
+ ]),
114
+ h(Field, () => [
115
+ h(Label, { for: 'bw-contact-topic' }, () => 'Topic'),
116
+ h(Combobox, { id: 'bw-contact-topic', name: 'topic', options: props.topics, placeholder: 'Search topics' }),
117
+ ]),
118
+ h(Field, () => [
119
+ h(Label, { for: 'bw-contact-date' }, () => 'Preferred date'),
120
+ h(DatePicker, { id: 'bw-contact-date', name: 'date' }),
121
+ ]),
122
+ h(Field, () => [
123
+ h(Label, () => 'Availability'),
124
+ h(DateRangePicker, { startName: 'from', endName: 'to' }),
125
+ ]),
126
+ h(Field, () => [
127
+ h(Label, { for: 'bw-contact-time' }, () => 'Call time'),
128
+ h(TimeInput, { id: 'bw-contact-time', name: 'time' }),
129
+ ]),
130
+ h(Field, () => [
131
+ h(Label, { for: 'bw-contact-message' }, () => 'Message'),
132
+ h(Textarea, { id: 'bw-contact-message', name: 'message', rows: 5, required: true }),
133
+ ]),
134
+ h(Field, () => [
135
+ h(Cluster, () => [
136
+ h(Checkbox, { id: 'bw-contact-copy', name: 'copy' }),
137
+ h(Label, { for: 'bw-contact-copy' }, () => 'Send me a copy'),
138
+ ]),
139
+ ]),
140
+ h(FormActions, () => [
141
+ h(Button, { type: 'submit', variant: 'primary' }, () => 'Send message'),
142
+ h(ButtonLink, { href: '/gallery/homepage', variant: 'ghost' }, () => 'Cancel'),
143
+ ]),
144
+ ]),
145
+ ]),
146
+ ]),
147
+ ];
148
+ },
149
+ });
@@ -0,0 +1,171 @@
1
+ import { type PropType } from 'vue';
2
+ type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger' | 'solid';
3
+ type ButtonSize = 'sm' | 'md' | 'lg';
4
+ export declare const Button: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
5
+ variant: {
6
+ type: PropType<ButtonVariant>;
7
+ default: string;
8
+ };
9
+ size: {
10
+ type: PropType<ButtonSize>;
11
+ default: string;
12
+ };
13
+ type: {
14
+ type: PropType<"button" | "submit" | "reset">;
15
+ default: string;
16
+ };
17
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
18
+ [key: string]: any;
19
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
20
+ variant: {
21
+ type: PropType<ButtonVariant>;
22
+ default: string;
23
+ };
24
+ size: {
25
+ type: PropType<ButtonSize>;
26
+ default: string;
27
+ };
28
+ type: {
29
+ type: PropType<"button" | "submit" | "reset">;
30
+ default: string;
31
+ };
32
+ }>> & Readonly<{}>, {
33
+ type: "button" | "reset" | "submit";
34
+ variant: ButtonVariant;
35
+ size: ButtonSize;
36
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
37
+ export declare const ButtonLink: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
38
+ href: {
39
+ type: StringConstructor;
40
+ required: true;
41
+ };
42
+ variant: {
43
+ type: PropType<ButtonVariant>;
44
+ default: string;
45
+ };
46
+ size: {
47
+ type: PropType<ButtonSize>;
48
+ default: string;
49
+ };
50
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
51
+ [key: string]: any;
52
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
53
+ href: {
54
+ type: StringConstructor;
55
+ required: true;
56
+ };
57
+ variant: {
58
+ type: PropType<ButtonVariant>;
59
+ default: string;
60
+ };
61
+ size: {
62
+ type: PropType<ButtonSize>;
63
+ default: string;
64
+ };
65
+ }>> & Readonly<{}>, {
66
+ variant: ButtonVariant;
67
+ size: ButtonSize;
68
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
69
+ export declare const Badge: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
70
+ variant: {
71
+ type: StringConstructor;
72
+ default: string;
73
+ };
74
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
75
+ [key: string]: any;
76
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
77
+ variant: {
78
+ type: StringConstructor;
79
+ default: string;
80
+ };
81
+ }>> & Readonly<{}>, {
82
+ variant: string;
83
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
84
+ export declare const Card: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
85
+ [key: string]: any;
86
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
87
+ export declare const Alert: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
88
+ variant: {
89
+ type: StringConstructor;
90
+ default: string;
91
+ };
92
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
93
+ [key: string]: any;
94
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
95
+ variant: {
96
+ type: StringConstructor;
97
+ default: string;
98
+ };
99
+ }>> & Readonly<{}>, {
100
+ variant: string;
101
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
102
+ export declare const Stack: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
103
+ [key: string]: any;
104
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
105
+ export declare const Cluster: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
106
+ [key: string]: any;
107
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
108
+ export declare const Grid: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
109
+ [key: string]: any;
110
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
111
+ export declare const Container: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
112
+ [key: string]: any;
113
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
114
+ export declare const Field: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
115
+ [key: string]: any;
116
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
117
+ export declare const FormActions: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
118
+ [key: string]: any;
119
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
120
+ export declare const Form: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
121
+ [key: string]: any;
122
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
123
+ export declare const Label: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
124
+ [key: string]: any;
125
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
126
+ export declare const Hint: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
127
+ [key: string]: any;
128
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
129
+ export declare const FieldError: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
130
+ [key: string]: any;
131
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
132
+ export declare const Input: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
133
+ [key: string]: any;
134
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
135
+ export declare const Textarea: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
136
+ [key: string]: any;
137
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
138
+ export declare const Select: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
139
+ [key: string]: any;
140
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
141
+ export declare const Checkbox: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
142
+ [key: string]: any;
143
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
144
+ export declare const Radio: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
145
+ [key: string]: any;
146
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
147
+ export declare const TimeInput: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
148
+ [key: string]: any;
149
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
150
+ export declare const DateTimeInput: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
151
+ [key: string]: any;
152
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
153
+ export declare const SkipLink: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
154
+ href: {
155
+ type: StringConstructor;
156
+ default: string;
157
+ };
158
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
159
+ [key: string]: any;
160
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
161
+ href: {
162
+ type: StringConstructor;
163
+ default: string;
164
+ };
165
+ }>> & Readonly<{}>, {
166
+ href: string;
167
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
168
+ export declare const ThemeToggle: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
169
+ [key: string]: any;
170
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
171
+ export {};
@@ -0,0 +1,173 @@
1
+ import { defineComponent, h } from 'vue';
2
+ import { cn } from './cn';
3
+ export const Button = defineComponent({
4
+ name: 'BwButton',
5
+ props: {
6
+ variant: { type: String, default: 'primary' },
7
+ size: { type: String, default: 'md' },
8
+ type: { type: String, default: 'button' },
9
+ },
10
+ setup(props, { slots, attrs }) {
11
+ return () => h('button', {
12
+ ...attrs,
13
+ type: props.type,
14
+ class: cn('bw-btn', `bw-btn--${props.variant}`, props.size !== 'md' && `bw-btn--${props.size}`, String(attrs.class || '')),
15
+ }, slots.default?.());
16
+ },
17
+ });
18
+ export const ButtonLink = defineComponent({
19
+ name: 'BwButtonLink',
20
+ props: {
21
+ href: { type: String, required: true },
22
+ variant: { type: String, default: 'primary' },
23
+ size: { type: String, default: 'md' },
24
+ },
25
+ setup(props, { slots, attrs }) {
26
+ return () => h('a', {
27
+ ...attrs,
28
+ href: props.href,
29
+ class: cn('bw-btn', `bw-btn--${props.variant}`, props.size !== 'md' && `bw-btn--${props.size}`, String(attrs.class || '')),
30
+ }, slots.default?.());
31
+ },
32
+ });
33
+ export const Badge = defineComponent({
34
+ name: 'BwBadge',
35
+ props: {
36
+ variant: { type: String, default: 'default' },
37
+ },
38
+ setup(props, { slots, attrs }) {
39
+ return () => h('span', { ...attrs, class: cn('bw-badge', `bw-badge--${props.variant}`, String(attrs.class || '')) }, slots.default?.());
40
+ },
41
+ });
42
+ export const Card = defineComponent({
43
+ name: 'BwCard',
44
+ setup(_, { slots, attrs }) {
45
+ return () => h('div', { ...attrs, class: cn('bw-card', String(attrs.class || '')) }, slots.default?.());
46
+ },
47
+ });
48
+ export const Alert = defineComponent({
49
+ name: 'BwAlert',
50
+ props: { variant: { type: String, default: 'default' } },
51
+ setup(props, { slots, attrs }) {
52
+ return () => h('div', {
53
+ ...attrs,
54
+ role: 'alert',
55
+ class: cn('bw-alert', props.variant !== 'default' && `bw-alert--${props.variant}`, String(attrs.class || '')),
56
+ }, slots.default?.());
57
+ },
58
+ });
59
+ function div(name, className) {
60
+ return defineComponent({
61
+ name,
62
+ setup(_, { slots, attrs }) {
63
+ return () => h('div', { ...attrs, class: cn(className, String(attrs.class || '')) }, slots.default?.());
64
+ },
65
+ });
66
+ }
67
+ export const Stack = div('BwStack', 'bw-stack');
68
+ export const Cluster = div('BwCluster', 'bw-cluster');
69
+ export const Grid = div('BwGrid', 'bw-grid');
70
+ export const Container = div('BwContainer', 'bw-container');
71
+ export const Field = div('BwField', 'bw-field');
72
+ export const FormActions = div('BwFormActions', 'bw-form__actions bw-cluster');
73
+ export const Form = defineComponent({
74
+ name: 'BwForm',
75
+ setup(_, { slots, attrs }) {
76
+ return () => h('form', { ...attrs, class: cn('bw-form', 'bw-stack', String(attrs.class || '')) }, slots.default?.());
77
+ },
78
+ });
79
+ export const Label = defineComponent({
80
+ name: 'BwLabel',
81
+ setup(_, { slots, attrs }) {
82
+ return () => h('label', { ...attrs, class: cn('bw-field__label', String(attrs.class || '')) }, slots.default?.());
83
+ },
84
+ });
85
+ export const Hint = defineComponent({
86
+ name: 'BwHint',
87
+ setup(_, { slots, attrs }) {
88
+ return () => h('p', { ...attrs, class: cn('bw-field__hint', String(attrs.class || '')) }, slots.default?.());
89
+ },
90
+ });
91
+ export const FieldError = defineComponent({
92
+ name: 'BwFieldError',
93
+ setup(_, { slots, attrs }) {
94
+ return () => h('p', { ...attrs, class: cn('bw-field__error', String(attrs.class || '')) }, slots.default?.());
95
+ },
96
+ });
97
+ export const Input = defineComponent({
98
+ name: 'BwInput',
99
+ inheritAttrs: false,
100
+ setup(_, { attrs }) {
101
+ return () => h('input', { ...attrs, class: cn('bw-input', String(attrs.class || '')) });
102
+ },
103
+ });
104
+ export const Textarea = defineComponent({
105
+ name: 'BwTextarea',
106
+ inheritAttrs: false,
107
+ setup(_, { attrs }) {
108
+ return () => h('textarea', { ...attrs, class: cn('bw-textarea', String(attrs.class || '')) });
109
+ },
110
+ });
111
+ export const Select = defineComponent({
112
+ name: 'BwSelect',
113
+ inheritAttrs: false,
114
+ setup(_, { slots, attrs }) {
115
+ return () => h('select', { ...attrs, class: cn('bw-select', String(attrs.class || '')) }, slots.default?.());
116
+ },
117
+ });
118
+ export const Checkbox = defineComponent({
119
+ name: 'BwCheckbox',
120
+ inheritAttrs: false,
121
+ setup(_, { attrs }) {
122
+ return () => h('input', { ...attrs, type: 'checkbox', class: cn('bw-checkbox', String(attrs.class || '')) });
123
+ },
124
+ });
125
+ export const Radio = defineComponent({
126
+ name: 'BwRadio',
127
+ inheritAttrs: false,
128
+ setup(_, { attrs }) {
129
+ return () => h('input', { ...attrs, type: 'radio', class: cn('bw-radio', String(attrs.class || '')) });
130
+ },
131
+ });
132
+ export const TimeInput = defineComponent({
133
+ name: 'BwTimeInput',
134
+ inheritAttrs: false,
135
+ setup(_, { attrs }) {
136
+ return () => h('input', { ...attrs, type: 'time', class: cn('bw-input', String(attrs.class || '')) });
137
+ },
138
+ });
139
+ export const DateTimeInput = defineComponent({
140
+ name: 'BwDateTimeInput',
141
+ inheritAttrs: false,
142
+ setup(_, { attrs }) {
143
+ return () => h('input', {
144
+ ...attrs,
145
+ type: 'datetime-local',
146
+ class: cn('bw-input', String(attrs.class || '')),
147
+ });
148
+ },
149
+ });
150
+ export const SkipLink = defineComponent({
151
+ name: 'BwSkipLink',
152
+ props: { href: { type: String, default: '#main' } },
153
+ setup(props, { slots, attrs }) {
154
+ return () => h('a', { ...attrs, href: props.href, class: cn('bw-skip-link', String(attrs.class || '')) }, slots.default?.() ?? 'Skip to content');
155
+ },
156
+ });
157
+ export const ThemeToggle = defineComponent({
158
+ name: 'BwThemeToggle',
159
+ setup(_, { attrs }) {
160
+ return () => h('button', {
161
+ ...attrs,
162
+ type: 'button',
163
+ class: cn('bw-btn', 'bw-btn--ghost', String(attrs.class || '')),
164
+ 'data-bw-theme-toggle': '',
165
+ onClick: () => {
166
+ const root = document.body;
167
+ const next = root.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';
168
+ root.setAttribute('data-theme', next);
169
+ document.documentElement.setAttribute('data-theme', next);
170
+ },
171
+ }, 'Theme');
172
+ },
173
+ });
package/package.json CHANGED
@@ -1,6 +1,45 @@
1
1
  {
2
2
  "name": "@bwui/vue",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Vue 3 adapter for Brickwork: typed components bound to the Brickwork token substrate and bw-* class contract.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "files": [
9
+ "dist",
10
+ "src",
11
+ "LICENSE",
12
+ "README.md"
13
+ ],
14
+ "main": "./dist/index.js",
15
+ "module": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "import": "./dist/index.js",
21
+ "default": "./dist/index.js"
22
+ }
23
+ },
24
+ "peerDependencies": {
25
+ "vue": "^3.4.0"
26
+ },
27
+ "dependencies": {
28
+ "@bwui/css": "0.1.0",
29
+ "@bwui/tokens": "0.1.0"
30
+ },
31
+ "devDependencies": {
32
+ "typescript": "^5",
33
+ "vue": "^3.5.0"
34
+ },
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://github.com/icvoss/brickwork.git"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "scripts": {
43
+ "build": "tsc -p tsconfig.json"
44
+ }
6
45
  }
package/src/cn.ts ADDED
@@ -0,0 +1,3 @@
1
+ export function cn(...parts: Array<string | false | null | undefined>): string {
2
+ return parts.filter(Boolean).join(' ')
3
+ }