@nuykon/basecoat-react 0.0.0-stage → 1.0.2

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.
@@ -0,0 +1,145 @@
1
+ /** Composition adapter for Basecoat's semantic markup. Frameworks own mount/unmount. */
2
+ declare function attachWidget(root: HTMLElement): () => void;
3
+
4
+ type Variant = 'default' | 'secondary' | 'outline' | 'ghost' | 'destructive' | 'link';
5
+ type Size = 'default' | 'xs' | 'sm' | 'lg' | 'icon' | 'icon-xs' | 'icon-sm' | 'icon-lg';
6
+ type Side = 'top' | 'bottom' | 'left' | 'right';
7
+ type Align = 'start' | 'center' | 'end';
8
+ type StylePack = 'vega' | 'nova' | 'maia' | 'lyra' | 'mira' | 'luma' | 'sera' | 'rhea';
9
+ interface Option {
10
+ value: string;
11
+ label: string;
12
+ disabled?: boolean;
13
+ group?: string;
14
+ }
15
+ interface TabItem extends Option {
16
+ }
17
+ interface AccordionItem extends Option {
18
+ }
19
+ interface MenuItem extends Option {
20
+ href?: string;
21
+ shortcut?: string;
22
+ separator?: boolean;
23
+ onSelect?: () => void;
24
+ }
25
+ interface ToastMessage {
26
+ id: string;
27
+ title: string;
28
+ description?: string;
29
+ variant?: 'default' | 'destructive';
30
+ duration?: number;
31
+ }
32
+ interface ChartPoint {
33
+ label: string;
34
+ value: number;
35
+ }
36
+ declare const stylePacks: readonly StylePack[];
37
+ declare function cx(...values: (string | undefined | false | null)[]): string;
38
+ declare function percentage(value: number, min?: number, max?: number): number;
39
+ declare function nextIndex(items: readonly {
40
+ disabled?: boolean;
41
+ }[], current: number, key: string, loop?: boolean): number;
42
+ declare function createTypeahead(): (key: string, items: readonly Option[], current: number) => number;
43
+ type Layer = {
44
+ elements: () => (HTMLElement | null)[];
45
+ dismiss: (reason: 'escape' | 'outside') => void;
46
+ };
47
+ declare function dismissableLayer(doc: Document, layer: Layer): () => void;
48
+ interface FloatingOptions {
49
+ side?: Side;
50
+ align?: Align;
51
+ offset?: number;
52
+ matchWidth?: boolean;
53
+ }
54
+ declare function floatingPosition(anchor: DOMRect, popup: DOMRect, width: number, height: number, options?: FloatingOptions): {
55
+ x: number;
56
+ y: number;
57
+ side: Side;
58
+ maxHeight: number;
59
+ };
60
+ declare function attachFloating(anchor: HTMLElement, popup: HTMLElement, options?: FloatingOptions): () => void;
61
+ declare function lockScroll(doc: Document): () => void;
62
+ declare function focusFirst(root: HTMLElement): void;
63
+ declare function scrollWithin(container: HTMLElement, item: HTMLElement): void;
64
+ declare function formReset(element: HTMLElement, reset: () => void): () => void;
65
+ declare const primitiveDefinitions: {
66
+ readonly ChartRoot: readonly ["canvas", "chart-canvas"];
67
+ readonly SelectRoot: readonly ["div", "select"];
68
+ readonly ComboboxRoot: readonly ["div", "combobox"];
69
+ readonly DropdownMenuRoot: readonly ["div", "dropdown-menu"];
70
+ readonly PopoverRoot: readonly ["div", "popover"];
71
+ readonly TabsRoot: readonly ["div", "tabs"];
72
+ readonly AccordionRoot: readonly ["div", "accordion"];
73
+ readonly CommandRoot: readonly ["div", "command"];
74
+ readonly SidebarRoot: readonly ["div", "sidebar"];
75
+ readonly DialogRoot: readonly ["dialog", "dialog"];
76
+ readonly DrawerRoot: readonly ["dialog", "drawer"];
77
+ readonly AlertDialogRoot: readonly ["dialog", "alert-dialog"];
78
+ readonly Button: readonly ["button", "btn"];
79
+ readonly Badge: readonly ["span", "badge"];
80
+ readonly Card: readonly ["article", "card"];
81
+ readonly CardHeader: readonly ["header", ""];
82
+ readonly CardTitle: readonly ["h3", "card-title"];
83
+ readonly CardDescription: readonly ["p", ""];
84
+ readonly CardContent: readonly ["section", ""];
85
+ readonly CardFooter: readonly ["footer", ""];
86
+ readonly CardAction: readonly ["div", "card-action"];
87
+ readonly Alert: readonly ["div", "alert"];
88
+ readonly AlertTitle: readonly ["h2", ""];
89
+ readonly AlertDescription: readonly ["section", ""];
90
+ readonly Avatar: readonly ["span", "avatar"];
91
+ readonly AvatarImage: readonly ["img", ""];
92
+ readonly AvatarFallback: readonly ["span", ""];
93
+ readonly Breadcrumb: readonly ["nav", "breadcrumb"];
94
+ readonly BreadcrumbList: readonly ["ol", ""];
95
+ readonly BreadcrumbItem: readonly ["li", ""];
96
+ readonly BreadcrumbLink: readonly ["a", ""];
97
+ readonly BreadcrumbSeparator: readonly ["li", ""];
98
+ readonly ButtonGroup: readonly ["div", "button-group"];
99
+ readonly Field: readonly ["div", "field"];
100
+ readonly FieldLabel: readonly ["label", "label"];
101
+ readonly FieldDescription: readonly ["p", ""];
102
+ readonly FieldError: readonly ["p", ""];
103
+ readonly Label: readonly ["label", "label"];
104
+ readonly Input: readonly ["input", "input"];
105
+ readonly Textarea: readonly ["textarea", "textarea"];
106
+ readonly NativeSelect: readonly ["select", "select"];
107
+ readonly InputGroup: readonly ["div", "input-group"];
108
+ readonly InputGroupAddon: readonly ["div", ""];
109
+ readonly Empty: readonly ["div", "empty"];
110
+ readonly EmptyHeader: readonly ["header", ""];
111
+ readonly EmptyTitle: readonly ["h3", ""];
112
+ readonly EmptyDescription: readonly ["p", ""];
113
+ readonly EmptyContent: readonly ["section", ""];
114
+ readonly Item: readonly ["div", "item"];
115
+ readonly ItemContent: readonly ["section", ""];
116
+ readonly ItemTitle: readonly ["h3", ""];
117
+ readonly ItemDescription: readonly ["p", ""];
118
+ readonly ItemActions: readonly ["div", ""];
119
+ readonly Kbd: readonly ["kbd", "kbd"];
120
+ readonly ScrollArea: readonly ["div", "scrollbar"];
121
+ readonly Skeleton: readonly ["div", "skeleton"];
122
+ readonly Spinner: readonly ["span", "bc-spinner"];
123
+ readonly Separator: readonly ["hr", ""];
124
+ readonly Table: readonly ["table", "table"];
125
+ readonly TableHeader: readonly ["thead", ""];
126
+ readonly TableBody: readonly ["tbody", ""];
127
+ readonly TableFooter: readonly ["tfoot", ""];
128
+ readonly TableRow: readonly ["tr", ""];
129
+ readonly TableHead: readonly ["th", ""];
130
+ readonly TableCell: readonly ["td", ""];
131
+ readonly TableCaption: readonly ["caption", ""];
132
+ readonly DialogHeader: readonly ["header", ""];
133
+ readonly DialogTitle: readonly ["h2", ""];
134
+ readonly DialogDescription: readonly ["p", ""];
135
+ readonly DialogContent: readonly ["section", ""];
136
+ readonly DialogFooter: readonly ["footer", ""];
137
+ readonly SidebarHeader: readonly ["header", ""];
138
+ readonly SidebarContent: readonly ["section", ""];
139
+ readonly SidebarFooter: readonly ["footer", ""];
140
+ readonly SidebarGroup: readonly ["section", ""];
141
+ readonly SidebarItem: readonly ["a", ""];
142
+ };
143
+ type PrimitiveName = keyof typeof primitiveDefinitions;
144
+
145
+ export { type AccordionItem, type Align, type ChartPoint, type FloatingOptions, type MenuItem, type Option, type PrimitiveName, type Side, type Size, type StylePack, type TabItem, type ToastMessage, type Variant, attachFloating, attachWidget, createTypeahead, cx, dismissableLayer, floatingPosition, focusFirst, formReset, lockScroll, nextIndex, percentage, primitiveDefinitions, scrollWithin, stylePacks };
@@ -0,0 +1,145 @@
1
+ /** Composition adapter for Basecoat's semantic markup. Frameworks own mount/unmount. */
2
+ declare function attachWidget(root: HTMLElement): () => void;
3
+
4
+ type Variant = 'default' | 'secondary' | 'outline' | 'ghost' | 'destructive' | 'link';
5
+ type Size = 'default' | 'xs' | 'sm' | 'lg' | 'icon' | 'icon-xs' | 'icon-sm' | 'icon-lg';
6
+ type Side = 'top' | 'bottom' | 'left' | 'right';
7
+ type Align = 'start' | 'center' | 'end';
8
+ type StylePack = 'vega' | 'nova' | 'maia' | 'lyra' | 'mira' | 'luma' | 'sera' | 'rhea';
9
+ interface Option {
10
+ value: string;
11
+ label: string;
12
+ disabled?: boolean;
13
+ group?: string;
14
+ }
15
+ interface TabItem extends Option {
16
+ }
17
+ interface AccordionItem extends Option {
18
+ }
19
+ interface MenuItem extends Option {
20
+ href?: string;
21
+ shortcut?: string;
22
+ separator?: boolean;
23
+ onSelect?: () => void;
24
+ }
25
+ interface ToastMessage {
26
+ id: string;
27
+ title: string;
28
+ description?: string;
29
+ variant?: 'default' | 'destructive';
30
+ duration?: number;
31
+ }
32
+ interface ChartPoint {
33
+ label: string;
34
+ value: number;
35
+ }
36
+ declare const stylePacks: readonly StylePack[];
37
+ declare function cx(...values: (string | undefined | false | null)[]): string;
38
+ declare function percentage(value: number, min?: number, max?: number): number;
39
+ declare function nextIndex(items: readonly {
40
+ disabled?: boolean;
41
+ }[], current: number, key: string, loop?: boolean): number;
42
+ declare function createTypeahead(): (key: string, items: readonly Option[], current: number) => number;
43
+ type Layer = {
44
+ elements: () => (HTMLElement | null)[];
45
+ dismiss: (reason: 'escape' | 'outside') => void;
46
+ };
47
+ declare function dismissableLayer(doc: Document, layer: Layer): () => void;
48
+ interface FloatingOptions {
49
+ side?: Side;
50
+ align?: Align;
51
+ offset?: number;
52
+ matchWidth?: boolean;
53
+ }
54
+ declare function floatingPosition(anchor: DOMRect, popup: DOMRect, width: number, height: number, options?: FloatingOptions): {
55
+ x: number;
56
+ y: number;
57
+ side: Side;
58
+ maxHeight: number;
59
+ };
60
+ declare function attachFloating(anchor: HTMLElement, popup: HTMLElement, options?: FloatingOptions): () => void;
61
+ declare function lockScroll(doc: Document): () => void;
62
+ declare function focusFirst(root: HTMLElement): void;
63
+ declare function scrollWithin(container: HTMLElement, item: HTMLElement): void;
64
+ declare function formReset(element: HTMLElement, reset: () => void): () => void;
65
+ declare const primitiveDefinitions: {
66
+ readonly ChartRoot: readonly ["canvas", "chart-canvas"];
67
+ readonly SelectRoot: readonly ["div", "select"];
68
+ readonly ComboboxRoot: readonly ["div", "combobox"];
69
+ readonly DropdownMenuRoot: readonly ["div", "dropdown-menu"];
70
+ readonly PopoverRoot: readonly ["div", "popover"];
71
+ readonly TabsRoot: readonly ["div", "tabs"];
72
+ readonly AccordionRoot: readonly ["div", "accordion"];
73
+ readonly CommandRoot: readonly ["div", "command"];
74
+ readonly SidebarRoot: readonly ["div", "sidebar"];
75
+ readonly DialogRoot: readonly ["dialog", "dialog"];
76
+ readonly DrawerRoot: readonly ["dialog", "drawer"];
77
+ readonly AlertDialogRoot: readonly ["dialog", "alert-dialog"];
78
+ readonly Button: readonly ["button", "btn"];
79
+ readonly Badge: readonly ["span", "badge"];
80
+ readonly Card: readonly ["article", "card"];
81
+ readonly CardHeader: readonly ["header", ""];
82
+ readonly CardTitle: readonly ["h3", "card-title"];
83
+ readonly CardDescription: readonly ["p", ""];
84
+ readonly CardContent: readonly ["section", ""];
85
+ readonly CardFooter: readonly ["footer", ""];
86
+ readonly CardAction: readonly ["div", "card-action"];
87
+ readonly Alert: readonly ["div", "alert"];
88
+ readonly AlertTitle: readonly ["h2", ""];
89
+ readonly AlertDescription: readonly ["section", ""];
90
+ readonly Avatar: readonly ["span", "avatar"];
91
+ readonly AvatarImage: readonly ["img", ""];
92
+ readonly AvatarFallback: readonly ["span", ""];
93
+ readonly Breadcrumb: readonly ["nav", "breadcrumb"];
94
+ readonly BreadcrumbList: readonly ["ol", ""];
95
+ readonly BreadcrumbItem: readonly ["li", ""];
96
+ readonly BreadcrumbLink: readonly ["a", ""];
97
+ readonly BreadcrumbSeparator: readonly ["li", ""];
98
+ readonly ButtonGroup: readonly ["div", "button-group"];
99
+ readonly Field: readonly ["div", "field"];
100
+ readonly FieldLabel: readonly ["label", "label"];
101
+ readonly FieldDescription: readonly ["p", ""];
102
+ readonly FieldError: readonly ["p", ""];
103
+ readonly Label: readonly ["label", "label"];
104
+ readonly Input: readonly ["input", "input"];
105
+ readonly Textarea: readonly ["textarea", "textarea"];
106
+ readonly NativeSelect: readonly ["select", "select"];
107
+ readonly InputGroup: readonly ["div", "input-group"];
108
+ readonly InputGroupAddon: readonly ["div", ""];
109
+ readonly Empty: readonly ["div", "empty"];
110
+ readonly EmptyHeader: readonly ["header", ""];
111
+ readonly EmptyTitle: readonly ["h3", ""];
112
+ readonly EmptyDescription: readonly ["p", ""];
113
+ readonly EmptyContent: readonly ["section", ""];
114
+ readonly Item: readonly ["div", "item"];
115
+ readonly ItemContent: readonly ["section", ""];
116
+ readonly ItemTitle: readonly ["h3", ""];
117
+ readonly ItemDescription: readonly ["p", ""];
118
+ readonly ItemActions: readonly ["div", ""];
119
+ readonly Kbd: readonly ["kbd", "kbd"];
120
+ readonly ScrollArea: readonly ["div", "scrollbar"];
121
+ readonly Skeleton: readonly ["div", "skeleton"];
122
+ readonly Spinner: readonly ["span", "bc-spinner"];
123
+ readonly Separator: readonly ["hr", ""];
124
+ readonly Table: readonly ["table", "table"];
125
+ readonly TableHeader: readonly ["thead", ""];
126
+ readonly TableBody: readonly ["tbody", ""];
127
+ readonly TableFooter: readonly ["tfoot", ""];
128
+ readonly TableRow: readonly ["tr", ""];
129
+ readonly TableHead: readonly ["th", ""];
130
+ readonly TableCell: readonly ["td", ""];
131
+ readonly TableCaption: readonly ["caption", ""];
132
+ readonly DialogHeader: readonly ["header", ""];
133
+ readonly DialogTitle: readonly ["h2", ""];
134
+ readonly DialogDescription: readonly ["p", ""];
135
+ readonly DialogContent: readonly ["section", ""];
136
+ readonly DialogFooter: readonly ["footer", ""];
137
+ readonly SidebarHeader: readonly ["header", ""];
138
+ readonly SidebarContent: readonly ["section", ""];
139
+ readonly SidebarFooter: readonly ["footer", ""];
140
+ readonly SidebarGroup: readonly ["section", ""];
141
+ readonly SidebarItem: readonly ["a", ""];
142
+ };
143
+ type PrimitiveName = keyof typeof primitiveDefinitions;
144
+
145
+ export { type AccordionItem, type Align, type ChartPoint, type FloatingOptions, type MenuItem, type Option, type PrimitiveName, type Side, type Size, type StylePack, type TabItem, type ToastMessage, type Variant, attachFloating, attachWidget, createTypeahead, cx, dismissableLayer, floatingPosition, focusFirst, formReset, lockScroll, nextIndex, percentage, primitiveDefinitions, scrollWithin, stylePacks };