@foundrykit/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/.turbo/turbo-build.log +18 -0
- package/.turbo/turbo-type-check.log +5 -0
- package/README.md +183 -0
- package/components.json +20 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.js +636 -0
- package/dist/index.js.map +1 -0
- package/eslint.config.js +4 -0
- package/package.json +53 -0
- package/src/components/calendar/config.ts +50 -0
- package/src/components/calendar/index.tsx +213 -0
- package/src/components/command/config.ts +764 -0
- package/src/components/command/index.tsx +184 -0
- package/src/components/date-picker/config.ts +54 -0
- package/src/components/date-picker/index.tsx +139 -0
- package/src/components/pagination/config.ts +192 -0
- package/src/components/pagination/index.tsx +127 -0
- package/src/components/search-bar/config.ts +57 -0
- package/src/components/search-bar/index.tsx +64 -0
- package/src/index.ts +19 -0
- package/tsconfig.json +11 -0
- package/tsconfig.lint.json +8 -0
- package/tsup.config.ts +11 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @foundrykit/components@0.1.0 build /Users/isaacsneddon-jenkins/Desktop/projects/umi/projects/foundrykit/packages/components
|
|
4
|
+
> tsup
|
|
5
|
+
|
|
6
|
+
[34mCLI[39m Building entry: src/index.ts
|
|
7
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
8
|
+
[34mCLI[39m tsup v8.5.0
|
|
9
|
+
[34mCLI[39m Using tsup config: /Users/isaacsneddon-jenkins/Desktop/projects/umi/projects/foundrykit/packages/components/tsup.config.ts
|
|
10
|
+
[34mCLI[39m Target: es2022
|
|
11
|
+
[34mCLI[39m Cleaning output folder
|
|
12
|
+
[34mESM[39m Build start
|
|
13
|
+
[32mESM[39m [1mdist/index.js [22m[32m18.65 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m29.95 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 12ms
|
|
16
|
+
DTS Build start
|
|
17
|
+
DTS ⚡️ Build success in 1329ms
|
|
18
|
+
DTS dist/index.d.ts 2.65 KB
|
package/README.md
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# @foundrykit/components
|
|
2
|
+
|
|
3
|
+
A collection of pre-built, styled React components built on top of `@foundrykit/primitives`. These components provide ready-to-use UI elements with consistent styling and behavior.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Pre-styled components** - Ready-to-use with consistent design
|
|
8
|
+
- **Built on primitives** - Leverages `@foundrykit/primitives` for accessibility
|
|
9
|
+
- **TypeScript support** - Full type safety with comprehensive definitions
|
|
10
|
+
- **Customizable** - Easy to override styles and behavior
|
|
11
|
+
- **Consistent API** - Uniform component patterns across the library
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @foundrykit/components
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Available Components
|
|
20
|
+
|
|
21
|
+
### Data Entry
|
|
22
|
+
- **Calendar** - Date picker calendar component
|
|
23
|
+
- **Date Picker** - Complete date selection interface
|
|
24
|
+
- **Search Bar** - Search input with suggestions and filters
|
|
25
|
+
|
|
26
|
+
### Navigation
|
|
27
|
+
- **Command** - Command palette interface for keyboard navigation
|
|
28
|
+
- **Pagination** - Page navigation with configurable page sizes
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
### Basic Example
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { Calendar } from '@foundrykit/components/calendar'
|
|
36
|
+
import { DatePicker } from '@foundrykit/components/date-picker'
|
|
37
|
+
import { SearchBar } from '@foundrykit/components/search-bar'
|
|
38
|
+
|
|
39
|
+
function MyApp() {
|
|
40
|
+
return (
|
|
41
|
+
<div>
|
|
42
|
+
<SearchBar
|
|
43
|
+
placeholder="Search..."
|
|
44
|
+
onSearch={(query) => console.log(query)}
|
|
45
|
+
/>
|
|
46
|
+
|
|
47
|
+
<DatePicker
|
|
48
|
+
onDateSelect={(date) => console.log(date)}
|
|
49
|
+
/>
|
|
50
|
+
|
|
51
|
+
<Calendar
|
|
52
|
+
mode="single"
|
|
53
|
+
onSelect={(date) => console.log(date)}
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Component Configuration
|
|
61
|
+
|
|
62
|
+
Each component can be configured through its config file:
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
import { Calendar } from '@foundrykit/components/calendar'
|
|
66
|
+
|
|
67
|
+
// Use default configuration
|
|
68
|
+
<Calendar />
|
|
69
|
+
|
|
70
|
+
// Override with custom configuration
|
|
71
|
+
<Calendar
|
|
72
|
+
className="custom-calendar"
|
|
73
|
+
disabled={false}
|
|
74
|
+
mode="range"
|
|
75
|
+
/>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Styling
|
|
79
|
+
|
|
80
|
+
Components come with default styling but can be customized:
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
import { SearchBar } from '@foundrykit/components/search-bar'
|
|
84
|
+
import { cn } from '@foundrykit/utils'
|
|
85
|
+
|
|
86
|
+
function CustomSearchBar({ className, ...props }) {
|
|
87
|
+
return (
|
|
88
|
+
<SearchBar
|
|
89
|
+
className={cn(
|
|
90
|
+
"border-2 border-blue-500 rounded-lg",
|
|
91
|
+
className
|
|
92
|
+
)}
|
|
93
|
+
{...props}
|
|
94
|
+
/>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Component Structure
|
|
100
|
+
|
|
101
|
+
Each component is organized as follows:
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
component/
|
|
105
|
+
├── config.ts # Component configuration and variants
|
|
106
|
+
├── index.tsx # Main component exports
|
|
107
|
+
├── variants-grid.tsx # Component variants for documentation
|
|
108
|
+
└── README.md # Component-specific documentation
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Dependencies
|
|
112
|
+
|
|
113
|
+
- **@foundrykit/primitives** - Base UI primitives
|
|
114
|
+
- **@foundrykit/types** - TypeScript type definitions
|
|
115
|
+
- **@foundrykit/utils** - Utility functions
|
|
116
|
+
- **React** - UI framework
|
|
117
|
+
- **date-fns** - Date manipulation utilities
|
|
118
|
+
- **cmdk** - Command palette functionality
|
|
119
|
+
|
|
120
|
+
## Integration with Primitives
|
|
121
|
+
|
|
122
|
+
Components are built on top of primitives for maximum flexibility:
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
import { Calendar } from '@foundrykit/components/calendar'
|
|
126
|
+
import { Calendar as CalendarPrimitive } from '@foundrykit/primitives/calendar'
|
|
127
|
+
|
|
128
|
+
// Use the pre-styled component
|
|
129
|
+
<Calendar />
|
|
130
|
+
|
|
131
|
+
// Or use the primitive directly for custom styling
|
|
132
|
+
<CalendarPrimitive className="my-custom-styles" />
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Customization
|
|
136
|
+
|
|
137
|
+
### Theme Integration
|
|
138
|
+
|
|
139
|
+
Components work with your existing theme system:
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
import { SearchBar } from '@foundrykit/components/search-bar'
|
|
143
|
+
|
|
144
|
+
// Components automatically use your theme tokens
|
|
145
|
+
<SearchBar className="bg-background text-foreground" />
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Variant System
|
|
149
|
+
|
|
150
|
+
Many components support variants for different use cases:
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
import { SearchBar } from '@foundrykit/components/search-bar'
|
|
154
|
+
|
|
155
|
+
<SearchBar variant="default" />
|
|
156
|
+
<SearchBar variant="outline" />
|
|
157
|
+
<SearchBar variant="ghost" />
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Accessibility
|
|
161
|
+
|
|
162
|
+
All components inherit accessibility features from their underlying primitives:
|
|
163
|
+
|
|
164
|
+
- Keyboard navigation
|
|
165
|
+
- Screen reader support
|
|
166
|
+
- Focus management
|
|
167
|
+
- ARIA attributes
|
|
168
|
+
- Color contrast compliance
|
|
169
|
+
|
|
170
|
+
## Contributing
|
|
171
|
+
|
|
172
|
+
When adding new components:
|
|
173
|
+
|
|
174
|
+
1. Build on existing primitives when possible
|
|
175
|
+
2. Follow the established component structure
|
|
176
|
+
3. Include comprehensive TypeScript definitions
|
|
177
|
+
4. Add usage examples and documentation
|
|
178
|
+
5. Ensure accessibility compliance
|
|
179
|
+
6. Update this README
|
|
180
|
+
|
|
181
|
+
## License
|
|
182
|
+
|
|
183
|
+
MIT
|
package/components.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
+
"style": "new-york",
|
|
4
|
+
"rsc": true,
|
|
5
|
+
"tsx": true,
|
|
6
|
+
"tailwind": {
|
|
7
|
+
"config": "",
|
|
8
|
+
"css": "src/styles/globals.css",
|
|
9
|
+
"baseColor": "neutral",
|
|
10
|
+
"cssVariables": true
|
|
11
|
+
},
|
|
12
|
+
"iconLibrary": "lucide",
|
|
13
|
+
"aliases": {
|
|
14
|
+
"components": "@workspace/ui/components",
|
|
15
|
+
"utils": "@workspace/ui/lib/utils",
|
|
16
|
+
"hooks": "@workspace/ui/hooks",
|
|
17
|
+
"lib": "@workspace/ui/lib",
|
|
18
|
+
"ui": "@workspace/ui/components"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { DayPicker } from 'react-day-picker';
|
|
4
|
+
import { Button, Dialog } from '@foundrykit/primitives';
|
|
5
|
+
import { Command as Command$1 } from 'cmdk';
|
|
6
|
+
export { cn } from '@foundrykit/utils';
|
|
7
|
+
|
|
8
|
+
interface SearchBarProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
9
|
+
onSearch?: (query: string) => void;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
value?: string;
|
|
13
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
14
|
+
}
|
|
15
|
+
declare const SearchBar: React.ForwardRefExoticComponent<SearchBarProps & React.RefAttributes<HTMLInputElement>>;
|
|
16
|
+
|
|
17
|
+
interface DatePickerProps {
|
|
18
|
+
value?: Date;
|
|
19
|
+
onValueChange?: (date: Date | undefined) => void;
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
className?: string;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
}
|
|
24
|
+
declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
+
|
|
26
|
+
declare function Calendar({ className, classNames, showOutsideDays, captionLayout, buttonVariant, formatters, components, ...props }: React.ComponentProps<typeof DayPicker> & {
|
|
27
|
+
buttonVariant?: React.ComponentProps<typeof Button>['variant'];
|
|
28
|
+
}): react_jsx_runtime.JSX.Element;
|
|
29
|
+
|
|
30
|
+
declare function Pagination({ className, ...props }: React.ComponentProps<'nav'>): react_jsx_runtime.JSX.Element;
|
|
31
|
+
declare function PaginationContent({ className, ...props }: React.ComponentProps<'ul'>): react_jsx_runtime.JSX.Element;
|
|
32
|
+
declare function PaginationItem({ ...props }: React.ComponentProps<'li'>): react_jsx_runtime.JSX.Element;
|
|
33
|
+
type PaginationLinkProps = {
|
|
34
|
+
isActive?: boolean;
|
|
35
|
+
} & Pick<React.ComponentProps<typeof Button>, 'size'> & React.ComponentProps<'a'>;
|
|
36
|
+
declare function PaginationLink({ className, isActive, size, ...props }: PaginationLinkProps): react_jsx_runtime.JSX.Element;
|
|
37
|
+
declare function PaginationPrevious({ className, ...props }: React.ComponentProps<typeof PaginationLink>): react_jsx_runtime.JSX.Element;
|
|
38
|
+
declare function PaginationNext({ className, ...props }: React.ComponentProps<typeof PaginationLink>): react_jsx_runtime.JSX.Element;
|
|
39
|
+
declare function PaginationEllipsis({ className, ...props }: React.ComponentProps<'span'>): react_jsx_runtime.JSX.Element;
|
|
40
|
+
|
|
41
|
+
declare function Command({ className, ...props }: React.ComponentProps<typeof Command$1>): react_jsx_runtime.JSX.Element;
|
|
42
|
+
declare function CommandDialog({ title, description, children, className, showCloseButton, ...props }: React.ComponentProps<typeof Dialog> & {
|
|
43
|
+
title?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
className?: string;
|
|
46
|
+
showCloseButton?: boolean;
|
|
47
|
+
}): react_jsx_runtime.JSX.Element;
|
|
48
|
+
declare function CommandInput({ className, ...props }: React.ComponentProps<typeof Command$1.Input>): react_jsx_runtime.JSX.Element;
|
|
49
|
+
declare function CommandList({ className, ...props }: React.ComponentProps<typeof Command$1.List>): react_jsx_runtime.JSX.Element;
|
|
50
|
+
declare function CommandEmpty({ ...props }: React.ComponentProps<typeof Command$1.Empty>): react_jsx_runtime.JSX.Element;
|
|
51
|
+
declare function CommandGroup({ className, ...props }: React.ComponentProps<typeof Command$1.Group>): react_jsx_runtime.JSX.Element;
|
|
52
|
+
declare function CommandSeparator({ className, ...props }: React.ComponentProps<typeof Command$1.Separator>): react_jsx_runtime.JSX.Element;
|
|
53
|
+
declare function CommandItem({ className, ...props }: React.ComponentProps<typeof Command$1.Item>): react_jsx_runtime.JSX.Element;
|
|
54
|
+
declare function CommandShortcut({ className, ...props }: React.ComponentProps<"span">): react_jsx_runtime.JSX.Element;
|
|
55
|
+
|
|
56
|
+
export { Calendar, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, DatePicker, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, SearchBar };
|