@lerianstudio/sindarian-ui 1.0.0-beta.1
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 +235 -0
- package/dist/components/breadcrumb/get-breadcrumb-paths.d.ts +10 -0
- package/dist/components/breadcrumb/get-breadcrumb-paths.d.ts.map +1 -0
- package/dist/components/breadcrumb/get-breadcrumb-paths.js +15 -0
- package/dist/components/breadcrumb/index.d.ts +10 -0
- package/dist/components/breadcrumb/index.d.ts.map +1 -0
- package/dist/components/breadcrumb/index.js +13 -0
- package/dist/components/entity-box/index.d.ts +17 -0
- package/dist/components/entity-box/index.d.ts.map +1 -0
- package/dist/components/entity-box/index.js +39 -0
- package/dist/components/entity-data-table/index.d.ts +17 -0
- package/dist/components/entity-data-table/index.d.ts.map +1 -0
- package/dist/components/entity-data-table/index.js +20 -0
- package/dist/components/form/combo-box-field/index.d.ts +14 -0
- package/dist/components/form/combo-box-field/index.d.ts.map +1 -0
- package/dist/components/form/combo-box-field/index.js +35 -0
- package/dist/components/form/country-field/index.d.ts +4 -0
- package/dist/components/form/country-field/index.d.ts.map +1 -0
- package/dist/components/form/country-field/index.js +11 -0
- package/dist/components/form/index.d.ts +8 -0
- package/dist/components/form/index.d.ts.map +1 -0
- package/dist/components/form/index.js +23 -0
- package/dist/components/form/input-field/index.d.ts +23 -0
- package/dist/components/form/input-field/index.d.ts.map +1 -0
- package/dist/components/form/input-field/index.js +14 -0
- package/dist/components/form/pagination-limit-field/index.d.ts +8 -0
- package/dist/components/form/pagination-limit-field/index.d.ts.map +1 -0
- package/dist/components/form/pagination-limit-field/index.js +10 -0
- package/dist/components/form/password-field/index.d.ts +12 -0
- package/dist/components/form/password-field/index.d.ts.map +1 -0
- package/dist/components/form/password-field/index.js +15 -0
- package/dist/components/form/select-field/index.d.ts +18 -0
- package/dist/components/form/select-field/index.d.ts.map +1 -0
- package/dist/components/form/select-field/index.js +14 -0
- package/dist/components/form/state-field/index.d.ts +8 -0
- package/dist/components/form/state-field/index.d.ts.map +1 -0
- package/dist/components/form/state-field/index.js +42 -0
- package/dist/components/form/switch-field/index.d.ts +14 -0
- package/dist/components/form/switch-field/index.d.ts.map +1 -0
- package/dist/components/form/switch-field/index.js +11 -0
- package/dist/components/page/index.d.ts +4 -0
- package/dist/components/page/index.d.ts.map +1 -0
- package/dist/components/page/index.js +16 -0
- package/dist/components/page-header/index.d.ts +33 -0
- package/dist/components/page-header/index.d.ts.map +1 -0
- package/dist/components/page-header/index.js +47 -0
- package/dist/components/pagination/index.d.ts +8 -0
- package/dist/components/pagination/index.d.ts.map +1 -0
- package/dist/components/pagination/index.js +10 -0
- package/dist/components/table/id-table-cell.d.ts +6 -0
- package/dist/components/table/id-table-cell.d.ts.map +1 -0
- package/dist/components/table/id-table-cell.js +16 -0
- package/dist/components/table/index.d.ts +3 -0
- package/dist/components/table/index.d.ts.map +1 -0
- package/dist/components/table/index.js +18 -0
- package/dist/components/table/locked-table-actions.d.ts +6 -0
- package/dist/components/table/locked-table-actions.d.ts.map +1 -0
- package/dist/components/table/locked-table-actions.js +11 -0
- package/dist/components/table/name-table-cell.d.ts +6 -0
- package/dist/components/table/name-table-cell.d.ts.map +1 -0
- package/dist/components/table/name-table-cell.js +10 -0
- package/dist/components/ui/alert/index.d.ts +11 -0
- package/dist/components/ui/alert/index.d.ts.map +1 -0
- package/dist/components/ui/alert/index.js +31 -0
- package/dist/components/ui/autocomplete/index.d.ts +54 -0
- package/dist/components/ui/autocomplete/index.d.ts.map +1 -0
- package/dist/components/ui/autocomplete/index.js +324 -0
- package/dist/components/ui/autosize-textarea/index.d.ts +15 -0
- package/dist/components/ui/autosize-textarea/index.d.ts.map +1 -0
- package/dist/components/ui/autosize-textarea/index.js +89 -0
- package/dist/components/ui/avatar/index.d.ts +7 -0
- package/dist/components/ui/avatar/index.d.ts.map +1 -0
- package/dist/components/ui/avatar/index.js +51 -0
- package/dist/components/ui/badge/index.d.ts +11 -0
- package/dist/components/ui/badge/index.d.ts.map +1 -0
- package/dist/components/ui/badge/index.js +28 -0
- package/dist/components/ui/breadcrumb/index.d.ts +12 -0
- package/dist/components/ui/breadcrumb/index.d.ts.map +1 -0
- package/dist/components/ui/breadcrumb/index.js +35 -0
- package/dist/components/ui/button/index.d.ts +17 -0
- package/dist/components/ui/button/index.d.ts.map +1 -0
- package/dist/components/ui/button/index.js +72 -0
- package/dist/components/ui/card/index.d.ts +10 -0
- package/dist/components/ui/card/index.d.ts.map +1 -0
- package/dist/components/ui/card/index.js +32 -0
- package/dist/components/ui/checkbox/index.d.ts +5 -0
- package/dist/components/ui/checkbox/index.d.ts.map +1 -0
- package/dist/components/ui/checkbox/index.js +44 -0
- package/dist/components/ui/collapsible/index.d.ts +6 -0
- package/dist/components/ui/collapsible/index.d.ts.map +1 -0
- package/dist/components/ui/collapsible/index.js +50 -0
- package/dist/components/ui/command/index.d.ts +14 -0
- package/dist/components/ui/command/index.d.ts.map +1 -0
- package/dist/components/ui/command/index.js +45 -0
- package/dist/components/ui/dialog/index.d.ts +16 -0
- package/dist/components/ui/dialog/index.d.ts.map +1 -0
- package/dist/components/ui/dialog/index.js +80 -0
- package/dist/components/ui/dropdown-menu/index.d.ts +27 -0
- package/dist/components/ui/dropdown-menu/index.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu/index.js +107 -0
- package/dist/components/ui/form.d.ts +37 -0
- package/dist/components/ui/form.d.ts.map +1 -0
- package/dist/components/ui/form.js +110 -0
- package/dist/components/ui/input/index.d.ts +4 -0
- package/dist/components/ui/input/index.d.ts.map +1 -0
- package/dist/components/ui/input/index.js +10 -0
- package/dist/components/ui/input-with-icon/index.d.ts +12 -0
- package/dist/components/ui/input-with-icon/index.d.ts.map +1 -0
- package/dist/components/ui/input-with-icon/index.js +57 -0
- package/dist/components/ui/label/index.d.ts +7 -0
- package/dist/components/ui/label/index.d.ts.map +1 -0
- package/dist/components/ui/label/index.js +45 -0
- package/dist/components/ui/label/label.stories.d.ts +5 -0
- package/dist/components/ui/label/label.stories.d.ts.map +1 -0
- package/dist/components/ui/label/label.stories.js +24 -0
- package/dist/components/ui/loading-button/index.d.ts +7 -0
- package/dist/components/ui/loading-button/index.d.ts.map +1 -0
- package/dist/components/ui/loading-button/index.js +9 -0
- package/dist/components/ui/multiple-select/index.d.ts +91 -0
- package/dist/components/ui/multiple-select/index.d.ts.map +1 -0
- package/dist/components/ui/multiple-select/index.js +233 -0
- package/dist/components/ui/paper/index.d.ts +4 -0
- package/dist/components/ui/paper/index.d.ts.map +1 -0
- package/dist/components/ui/paper/index.js +8 -0
- package/dist/components/ui/popover/index.d.ts +8 -0
- package/dist/components/ui/popover/index.d.ts.map +1 -0
- package/dist/components/ui/popover/index.js +55 -0
- package/dist/components/ui/progress/index.d.ts +8 -0
- package/dist/components/ui/progress/index.d.ts.map +1 -0
- package/dist/components/ui/progress/index.js +43 -0
- package/dist/components/ui/select/index.d.ts +19 -0
- package/dist/components/ui/select/index.d.ts.map +1 -0
- package/dist/components/ui/select/index.js +101 -0
- package/dist/components/ui/separator/index.d.ts +5 -0
- package/dist/components/ui/separator/index.d.ts.map +1 -0
- package/dist/components/ui/separator/index.js +43 -0
- package/dist/components/ui/sheet/index.d.ts +19 -0
- package/dist/components/ui/sheet/index.d.ts.map +1 -0
- package/dist/components/ui/sheet/index.js +94 -0
- package/dist/components/ui/skeleton/index.d.ts +3 -0
- package/dist/components/ui/skeleton/index.d.ts.map +1 -0
- package/dist/components/ui/skeleton/index.js +8 -0
- package/dist/components/ui/stepper/index.d.ts +18 -0
- package/dist/components/ui/stepper/index.d.ts.map +1 -0
- package/dist/components/ui/stepper/index.js +29 -0
- package/dist/components/ui/switch/index.d.ts +5 -0
- package/dist/components/ui/switch/index.d.ts.map +1 -0
- package/dist/components/ui/switch/index.js +43 -0
- package/dist/components/ui/table/index.d.ts +21 -0
- package/dist/components/ui/table/index.d.ts.map +1 -0
- package/dist/components/ui/table/index.js +56 -0
- package/dist/components/ui/tabs/index.d.ts +8 -0
- package/dist/components/ui/tabs/index.d.ts.map +1 -0
- package/dist/components/ui/tabs/index.js +55 -0
- package/dist/components/ui/textarea/index.d.ts +4 -0
- package/dist/components/ui/textarea/index.d.ts.map +1 -0
- package/dist/components/ui/textarea/index.js +8 -0
- package/dist/components/ui/toast/index.d.ts +17 -0
- package/dist/components/ui/toast/index.d.ts.map +1 -0
- package/dist/components/ui/toast/index.js +80 -0
- package/dist/components/ui/toast/toaster.d.ts +2 -0
- package/dist/components/ui/toast/toaster.d.ts.map +1 -0
- package/dist/components/ui/toast/toaster.js +13 -0
- package/dist/components/ui/tooltip/index.d.ts +11 -0
- package/dist/components/ui/tooltip/index.d.ts.map +1 -0
- package/dist/components/ui/tooltip/index.js +66 -0
- package/dist/hooks/use-click-away.d.ts +9 -0
- package/dist/hooks/use-click-away.d.ts.map +1 -0
- package/dist/hooks/use-click-away.js +29 -0
- package/dist/hooks/use-click-away.test.d.ts +2 -0
- package/dist/hooks/use-click-away.test.d.ts.map +1 -0
- package/dist/hooks/use-click-away.test.js +39 -0
- package/dist/hooks/use-pagination.d.ts +13 -0
- package/dist/hooks/use-pagination.d.ts.map +1 -0
- package/dist/hooks/use-pagination.js +41 -0
- package/dist/hooks/use-stepper.d.ts +11 -0
- package/dist/hooks/use-stepper.d.ts.map +1 -0
- package/dist/hooks/use-stepper.js +26 -0
- package/dist/hooks/use-stepper.test.d.ts +2 -0
- package/dist/hooks/use-stepper.test.d.ts.map +1 -0
- package/dist/hooks/use-stepper.test.js +45 -0
- package/dist/hooks/use-toast.d.ts +45 -0
- package/dist/hooks/use-toast.d.ts.map +1 -0
- package/dist/hooks/use-toast.js +164 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +64 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +8 -0
- package/dist/public/countries.json +21210 -0
- package/dist/types/metadata-type.d.ts +2 -0
- package/dist/types/metadata-type.d.ts.map +1 -0
- package/dist/types/metadata-type.js +2 -0
- package/dist/utils/country-utils.d.ts +17 -0
- package/dist/utils/country-utils.d.ts.map +1 -0
- package/dist/utils/country-utils.js +25 -0
- package/dist/utils/currency-codes.d.ts +5 -0
- package/dist/utils/currency-codes.d.ts.map +1 -0
- package/dist/utils/currency-codes.js +184 -0
- package/package.json +76 -0
package/README.md
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
# Sindarian UI
|
|
2
|
+
|
|
3
|
+
A modern, accessible React component library built on top of [Radix UI](https://www.radix-ui.com/) and [ShadCN](https://ui.shadcn.com/) design system, providing a comprehensive set of customizable components with full TypeScript support and Storybook documentation.
|
|
4
|
+
|
|
5
|
+
## ✨ Features
|
|
6
|
+
|
|
7
|
+
- 🎨 **35+ High-quality Components** - Complete set of UI primitives and application-specific components
|
|
8
|
+
- 🔧 **Built on Radix UI** - Leveraging the power of headless, accessible component primitives
|
|
9
|
+
- 🎯 **ShadCN Compatible** - Following ShadCN design patterns and conventions
|
|
10
|
+
- 📖 **Comprehensive Storybook** - Interactive documentation with live examples and controls
|
|
11
|
+
- 🔍 **TypeScript First** - Full type safety with detailed prop interfaces
|
|
12
|
+
- 🎭 **Tailwind CSS** - Utility-first styling with customizable design tokens
|
|
13
|
+
- ♿ **Accessibility** - WAI-ARIA compliant components with keyboard navigation
|
|
14
|
+
- 🧪 **Thoroughly Tested** - Jest test coverage for reliability
|
|
15
|
+
- 🎨 **Customizable** - Flexible theming and styling options
|
|
16
|
+
- 📱 **Responsive** - Mobile-first design approach
|
|
17
|
+
|
|
18
|
+
## 📦 Installation
|
|
19
|
+
|
|
20
|
+
Install the package using your preferred package manager:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @lerianstudio/sindarian-ui
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
yarn add @lerianstudio/sindarian-ui
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pnpm add @lerianstudio/sindarian-ui
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Peer Dependencies
|
|
35
|
+
|
|
36
|
+
Make sure you have the required peer dependencies installed:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install react@>=19.0.0 react-dom@>=19.0.0 react-hook-form@>=7.60.0 lucide-react@>=0.536.0 lodash@>=4.17.0
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Tailwind CSS Setup
|
|
43
|
+
|
|
44
|
+
Add the package path to your `tailwind.config.js` to ensure proper styling:
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
module.exports = {
|
|
48
|
+
content: [
|
|
49
|
+
'./src/**/*.{js,ts,jsx,tsx}',
|
|
50
|
+
'./node_modules/sindarian-ui/**/*.{js,ts,jsx,tsx}' // Add this line
|
|
51
|
+
]
|
|
52
|
+
// ... rest of your config
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## 🚀 Quick Start
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
import {
|
|
60
|
+
Button,
|
|
61
|
+
Input,
|
|
62
|
+
Card,
|
|
63
|
+
CardContent,
|
|
64
|
+
CardHeader,
|
|
65
|
+
CardTitle
|
|
66
|
+
} from 'sindarian-ui'
|
|
67
|
+
|
|
68
|
+
function App() {
|
|
69
|
+
return (
|
|
70
|
+
<Card className="w-96">
|
|
71
|
+
<CardHeader>
|
|
72
|
+
<CardTitle>Welcome to Sindarian UI</CardTitle>
|
|
73
|
+
</CardHeader>
|
|
74
|
+
<CardContent className="space-y-4">
|
|
75
|
+
<Input placeholder="Enter your name" />
|
|
76
|
+
<Button>Get Started</Button>
|
|
77
|
+
</CardContent>
|
|
78
|
+
</Card>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## 📚 Component Categories
|
|
84
|
+
|
|
85
|
+
### UI Primitives
|
|
86
|
+
|
|
87
|
+
Core building blocks based on Radix UI:
|
|
88
|
+
|
|
89
|
+
- **Layout**: `Card`, `Paper`, `Separator`, `Sheet`
|
|
90
|
+
- **Typography**: `Label`, `Badge`
|
|
91
|
+
- **Form Controls**: `Button`, `Input`, `Textarea`, `Select`, `Checkbox`, `Switch`
|
|
92
|
+
- **Navigation**: `Breadcrumb`, `Tabs`, `Dropdown Menu`
|
|
93
|
+
- **Feedback**: `Alert`, `Toast`, `Progress`, `Skeleton`, `Loading Button`
|
|
94
|
+
- **Overlay**: `Dialog`, `Popover`, `Tooltip`
|
|
95
|
+
- **Data Display**: `Avatar`, `Table`, `Stepper`
|
|
96
|
+
- **Advanced**: `Autocomplete`, `Command`, `Multiple Select`, `Collapsible`
|
|
97
|
+
|
|
98
|
+
### Application Components
|
|
99
|
+
|
|
100
|
+
Higher-level components for common use cases:
|
|
101
|
+
|
|
102
|
+
- **Layout**: `Page` - Complete page layout structure
|
|
103
|
+
- **Data**: `Entity Box`, `Entity Data Table` - Entity display and management
|
|
104
|
+
- **Navigation**: `Application Breadcrumb` - Enhanced breadcrumb with path generation
|
|
105
|
+
- **Pagination**: `Pagination` - Data pagination controls
|
|
106
|
+
- **Table**: `ID Table Cell`, `Name Table Cell`, `Locked Table Actions` - Specialized table components
|
|
107
|
+
|
|
108
|
+
### Form Components
|
|
109
|
+
|
|
110
|
+
Enhanced form fields with validation:
|
|
111
|
+
|
|
112
|
+
- `Input Field`, `Password Field`, `Select Field`, `Switch Field`
|
|
113
|
+
- `Combo Box Field`, `Country Field`, `State Field`
|
|
114
|
+
- `Pagination Limit Field`
|
|
115
|
+
|
|
116
|
+
### Hooks
|
|
117
|
+
|
|
118
|
+
Custom React hooks for common functionality:
|
|
119
|
+
|
|
120
|
+
- `useToast` - Toast notification management
|
|
121
|
+
- `useStepper` - Step-by-step navigation
|
|
122
|
+
- `useClickAway` - Click outside detection
|
|
123
|
+
- `usePagination` - Pagination logic
|
|
124
|
+
|
|
125
|
+
## 📖 Documentation
|
|
126
|
+
|
|
127
|
+
### Storybook
|
|
128
|
+
|
|
129
|
+
Explore all components interactively with Storybook:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Clone the repository and navigate to the package
|
|
133
|
+
cd packages/sindarian-ui
|
|
134
|
+
|
|
135
|
+
# Install dependencies
|
|
136
|
+
npm install
|
|
137
|
+
|
|
138
|
+
# Start Storybook
|
|
139
|
+
npm run storybook
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Storybook will be available at `http://localhost:6007` with:
|
|
143
|
+
|
|
144
|
+
- **Interactive examples** for every component
|
|
145
|
+
- **Props documentation** with controls
|
|
146
|
+
- **Usage guidelines** and best practices
|
|
147
|
+
- **Accessibility information**
|
|
148
|
+
- **Design tokens** and theming options
|
|
149
|
+
|
|
150
|
+
### Component Documentation
|
|
151
|
+
|
|
152
|
+
Each component includes comprehensive documentation:
|
|
153
|
+
|
|
154
|
+
- Type definitions with detailed prop descriptions
|
|
155
|
+
- Usage examples and common patterns
|
|
156
|
+
- Accessibility guidelines
|
|
157
|
+
- Styling customization options
|
|
158
|
+
|
|
159
|
+
## 🛠️ Development
|
|
160
|
+
|
|
161
|
+
### Prerequisites
|
|
162
|
+
|
|
163
|
+
- Node.js 18+
|
|
164
|
+
- npm/yarn/pnpm
|
|
165
|
+
|
|
166
|
+
### Setup
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Install dependencies
|
|
170
|
+
npm install
|
|
171
|
+
|
|
172
|
+
# Run tests
|
|
173
|
+
npm test
|
|
174
|
+
|
|
175
|
+
# Build the library
|
|
176
|
+
npm run build
|
|
177
|
+
|
|
178
|
+
# Start development with Storybook
|
|
179
|
+
npm run storybook
|
|
180
|
+
|
|
181
|
+
# Type checking
|
|
182
|
+
npm run check-types
|
|
183
|
+
|
|
184
|
+
# Linting
|
|
185
|
+
npm run lint
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Testing
|
|
189
|
+
|
|
190
|
+
The library includes comprehensive test coverage:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
# Run tests
|
|
194
|
+
npm test
|
|
195
|
+
|
|
196
|
+
# Run tests with coverage
|
|
197
|
+
npm run test:cov
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Building
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
# Build for production
|
|
204
|
+
npm run build
|
|
205
|
+
|
|
206
|
+
# Build Storybook for deployment
|
|
207
|
+
npm run build-storybook
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## 🤝 Contributing
|
|
211
|
+
|
|
212
|
+
1. Fork the repository
|
|
213
|
+
2. Create a feature branch: `git checkout -b feature/amazing-feature`
|
|
214
|
+
3. Commit your changes: `git commit -m 'Add amazing feature'`
|
|
215
|
+
4. Push to the branch: `git push origin feature/amazing-feature`
|
|
216
|
+
5. Open a Pull Request
|
|
217
|
+
|
|
218
|
+
Please ensure your code follows the project's coding standards and includes appropriate tests.
|
|
219
|
+
|
|
220
|
+
## 📝 Changelog
|
|
221
|
+
|
|
222
|
+
See [CHANGELOG.md](../../CHANGELOG.md) for a detailed history of changes.
|
|
223
|
+
|
|
224
|
+
## 📄 License
|
|
225
|
+
|
|
226
|
+
This project is licensed under the ISC License.
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
**Sindarian UI** is developed and maintained by [**Lerian Studio**](https://lerian.studio).
|
|
231
|
+
|
|
232
|
+
**Contact**: [contato@lerian.studio](mailto:contato@lerian.studio)
|
|
233
|
+
**Website**: [https://lerian.studio](https://lerian.studio)
|
|
234
|
+
|
|
235
|
+
---
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BreadcrumbPath } from '.';
|
|
2
|
+
type BreadcrumbPathTabs = (BreadcrumbPath & {
|
|
3
|
+
active?: () => boolean;
|
|
4
|
+
})[];
|
|
5
|
+
export declare function getBreadcrumbPaths(paths: BreadcrumbPathTabs): {
|
|
6
|
+
name: string;
|
|
7
|
+
href?: string;
|
|
8
|
+
}[];
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=get-breadcrumb-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-breadcrumb-paths.d.ts","sourceRoot":"","sources":["../../../src/components/breadcrumb/get-breadcrumb-paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,CAAA;AAGlC,KAAK,kBAAkB,GAAG,CAAC,cAAc,GAAG;IAC1C,MAAM,CAAC,EAAE,MAAM,OAAO,CAAA;CACvB,CAAC,EAAE,CAAA;AAEJ,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,kBAAkB;;;IAa3D"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBreadcrumbPaths = getBreadcrumbPaths;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
function getBreadcrumbPaths(paths) {
|
|
6
|
+
return (paths
|
|
7
|
+
.filter((path) => {
|
|
8
|
+
if ((0, lodash_1.isNil)(path.active)) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
return path.active();
|
|
12
|
+
})
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14
|
+
.map(({ active, ...path }) => path));
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type BreadcrumbPath = {
|
|
2
|
+
name: string;
|
|
3
|
+
href?: string;
|
|
4
|
+
};
|
|
5
|
+
type BreadcrumbProps = {
|
|
6
|
+
paths: BreadcrumbPath[];
|
|
7
|
+
};
|
|
8
|
+
export declare const Breadcrumb: ({ paths }: BreadcrumbProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/breadcrumb/index.tsx"],"names":[],"mappings":"AAUA,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,cAAc,EAAE,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,WAAW,eAAe,4CAoBpD,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Breadcrumb = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const breadcrumb_1 = require("../../components/ui/breadcrumb");
|
|
9
|
+
const react_1 = __importDefault(require("react"));
|
|
10
|
+
const Breadcrumb = ({ paths }) => {
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(breadcrumb_1.Breadcrumb, { children: (0, jsx_runtime_1.jsx)(breadcrumb_1.BreadcrumbList, { children: paths.map((path, index) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(breadcrumb_1.BreadcrumbItem, { children: path.href ? ((0, jsx_runtime_1.jsx)(breadcrumb_1.BreadcrumbLink, { href: path.href, children: path.name })) : ((0, jsx_runtime_1.jsx)(breadcrumb_1.BreadcrumbPage, { children: path.name })) }), index < paths.length - 1 && (0, jsx_runtime_1.jsx)(breadcrumb_1.BreadcrumbSeparator, {})] }, index))) }) }));
|
|
12
|
+
};
|
|
13
|
+
exports.Breadcrumb = Breadcrumb;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CollapsibleContentProps, CollapsibleProps, CollapsibleTriggerProps } from '@radix-ui/react-collapsible';
|
|
3
|
+
declare function EntityBox({ className, children, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function EntityBoxCollapsible({ className, ...props }: CollapsibleProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function EntityBoxCollapsibleTrigger(props: CollapsibleTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function EntityBoxCollapsibleContent({ children, ...props }: CollapsibleContentProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
interface EntityBoxHeaderProps extends React.ComponentProps<'div'> {
|
|
8
|
+
title: string;
|
|
9
|
+
subtitle?: string;
|
|
10
|
+
tooltip?: string;
|
|
11
|
+
tooltipWidth?: string | number;
|
|
12
|
+
}
|
|
13
|
+
declare function EntityBoxHeaderTitle({ title, subtitle, tooltip, tooltipWidth, className, ...props }: EntityBoxHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function EntityBoxBanner({ className, children, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare function EntityBoxActions({ className, children, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export { EntityBox, EntityBoxCollapsible, EntityBoxCollapsibleTrigger, EntityBoxCollapsibleContent, EntityBoxHeaderTitle, EntityBoxBanner, EntityBoxActions };
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/entity-box/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAczB,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,6BAA6B,CAAA;AAIpC,iBAAS,SAAS,CAAC,EACjB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAa7B;AAED,iBAAS,oBAAoB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAUtE;AAED,iBAAS,2BAA2B,CAAC,KAAK,EAAE,uBAAuB,2CAQlE;AAED,iBAAS,2BAA2B,CAAC,EACnC,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,uBAAuB,2CAOzB;AAED,UAAU,oBAAqB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAChE,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC/B;AAED,iBAAS,oBAAoB,CAAC,EAC5B,KAAK,EACL,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,SAAS,EACT,GAAG,KAAK,EACT,EAAE,oBAAoB,2CAgCtB;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAU7B;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAa7B;AAED,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,2BAA2B,EAC3B,2BAA2B,EAC3B,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EACjB,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EntityBox = EntityBox;
|
|
4
|
+
exports.EntityBoxCollapsible = EntityBoxCollapsible;
|
|
5
|
+
exports.EntityBoxCollapsibleTrigger = EntityBoxCollapsibleTrigger;
|
|
6
|
+
exports.EntityBoxCollapsibleContent = EntityBoxCollapsibleContent;
|
|
7
|
+
exports.EntityBoxHeaderTitle = EntityBoxHeaderTitle;
|
|
8
|
+
exports.EntityBoxBanner = EntityBoxBanner;
|
|
9
|
+
exports.EntityBoxActions = EntityBoxActions;
|
|
10
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
11
|
+
const utils_1 = require("../../lib/utils");
|
|
12
|
+
const tooltip_1 = require("../ui/tooltip");
|
|
13
|
+
const lucide_react_1 = require("lucide-react");
|
|
14
|
+
const collapsible_1 = require("../ui/collapsible");
|
|
15
|
+
const button_1 = require("../ui/button");
|
|
16
|
+
const separator_1 = require("../ui/separator");
|
|
17
|
+
function EntityBox({ className, children, ...props }) {
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)("div", { "data-slot": "entity-box", className: (0, utils_1.cn)('shadow-entity-box mb-2 flex items-center justify-between rounded-lg bg-white p-6', className), ...props, children: children }));
|
|
19
|
+
}
|
|
20
|
+
function EntityBoxCollapsible({ className, ...props }) {
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)(collapsible_1.Collapsible, { className: (0, utils_1.cn)('shadow-entity-box mb-2 flex flex-col rounded-lg bg-white', className), ...props }));
|
|
22
|
+
}
|
|
23
|
+
function EntityBoxCollapsibleTrigger(props) {
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(collapsible_1.CollapsibleTrigger, { ...props, asChild: true, children: (0, jsx_runtime_1.jsx)(button_1.Button, { variant: "secondary", className: "h-[34px] w-[34px] p-2", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Settings2, { size: 16 }) }) }));
|
|
25
|
+
}
|
|
26
|
+
function EntityBoxCollapsibleContent({ children, ...props }) {
|
|
27
|
+
return ((0, jsx_runtime_1.jsxs)(collapsible_1.CollapsibleContent, { ...props, children: [(0, jsx_runtime_1.jsx)(separator_1.Separator, { orientation: "horizontal" }), (0, jsx_runtime_1.jsx)("div", { className: "grid w-full grid-cols-3 p-6", children: children })] }));
|
|
28
|
+
}
|
|
29
|
+
function EntityBoxHeaderTitle({ title, subtitle, tooltip, tooltipWidth, className, ...props }) {
|
|
30
|
+
return ((0, jsx_runtime_1.jsxs)("div", { "data-slot": "entity-box-header", className: (0, utils_1.cn)('flex flex-col items-start', className), ...props, children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-[10px]", children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-lg font-medium text-zinc-600", children: title }), tooltip && ((0, jsx_runtime_1.jsx)(tooltip_1.TooltipProvider, { children: (0, jsx_runtime_1.jsxs)(tooltip_1.Tooltip, { children: [(0, jsx_runtime_1.jsx)(tooltip_1.TooltipTrigger, { asChild: true, children: (0, jsx_runtime_1.jsx)(lucide_react_1.CircleHelp, { className: "pointer text-shadcn-400 h-5 w-5" }) }), (0, jsx_runtime_1.jsx)(tooltip_1.TooltipContent, { side: "right", style: tooltipWidth
|
|
31
|
+
? { width: tooltipWidth, maxWidth: tooltipWidth }
|
|
32
|
+
: undefined, children: tooltip })] }) }))] }), subtitle && (0, jsx_runtime_1.jsx)("p", { className: "text-shadcn-400 text-sm", children: subtitle })] }));
|
|
33
|
+
}
|
|
34
|
+
function EntityBoxBanner({ className, children, ...props }) {
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)("div", { "data-slot": "entity-box-banner", className: (0, utils_1.cn)('grid grid-cols-3 p-6', className), ...props, children: children }));
|
|
36
|
+
}
|
|
37
|
+
function EntityBoxActions({ className, children, ...props }) {
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)("div", { "data-slot": "entity-box-actions", className: (0, utils_1.cn)('col-start-3 flex flex-row items-center justify-end gap-4', className), ...props, children: children }));
|
|
39
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Paper } from '../ui/paper';
|
|
3
|
+
declare function EntityDataTableRoot({ className, ...props }: React.ComponentProps<typeof Paper>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function EntityDataTableFooter({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function EntityDataTableFooterText({ className, ...props }: React.ComponentProps<'p'>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export type EntityDataTableFooterLabelProps = React.PropsWithChildren & {
|
|
7
|
+
label: React.ReactNode;
|
|
8
|
+
empty?: boolean;
|
|
9
|
+
emptyLabel?: React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export declare const EntityDataTable: {
|
|
12
|
+
Root: typeof EntityDataTableRoot;
|
|
13
|
+
Footer: typeof EntityDataTableFooter;
|
|
14
|
+
FooterText: typeof EntityDataTableFooterText;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/entity-data-table/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC,iBAAS,mBAAmB,CAAC,EAC3B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,2CAEpC;AAED,iBAAS,qBAAqB,CAAC,EAC7B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAW7B;AAED,iBAAS,yBAAyB,CAAC,EACjC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,2CAQ3B;AAED,MAAM,MAAM,+BAA+B,GAAG,KAAK,CAAC,iBAAiB,GAAG;IACtE,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC7B,CAAA;AAED,eAAO,MAAM,eAAe;;;;CAI3B,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EntityDataTable = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const utils_1 = require("../../lib/utils");
|
|
6
|
+
const paper_1 = require("../ui/paper");
|
|
7
|
+
function EntityDataTableRoot({ className, ...props }) {
|
|
8
|
+
return (0, jsx_runtime_1.jsx)(paper_1.Paper, { className: className, ...props });
|
|
9
|
+
}
|
|
10
|
+
function EntityDataTableFooter({ className, ...props }) {
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)("div", { "data-slot": "data-table-footer", className: (0, utils_1.cn)('flex flex-row items-center justify-between px-6 py-3', className), ...props }));
|
|
12
|
+
}
|
|
13
|
+
function EntityDataTableFooterText({ className, ...props }) {
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)("p", { "data-slot": "data-table-footer-text", className: (0, utils_1.cn)('text-shadcn-400 text-sm leading-8 italic', className), ...props }));
|
|
15
|
+
}
|
|
16
|
+
exports.EntityDataTable = {
|
|
17
|
+
Root: EntityDataTableRoot,
|
|
18
|
+
Footer: EntityDataTableFooter,
|
|
19
|
+
FooterText: EntityDataTableFooterText
|
|
20
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Control } from 'react-hook-form';
|
|
3
|
+
export type ComboBoxFieldProps = React.PropsWithChildren & {
|
|
4
|
+
name: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
emptyMessage?: string;
|
|
8
|
+
control: Control<any>;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
readOnly?: boolean;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare const ComboBoxField: ({ name, label, placeholder, emptyMessage, required, children, readOnly, ...others }: ComboBoxFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/form/combo-box-field/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAiBzC,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,iBAAiB,GAAG;IACzD,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,qFAS3B,kBAAkB,4CA0FpB,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ComboBoxField = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const form_1 = require("../../../components/ui/form");
|
|
10
|
+
const popover_1 = require("../../../components/ui/popover");
|
|
11
|
+
const command_1 = require("../../../components/ui/command");
|
|
12
|
+
const button_1 = require("../../../components/ui/button");
|
|
13
|
+
const utils_1 = require("../../../lib/utils");
|
|
14
|
+
const lucide_react_1 = require("lucide-react");
|
|
15
|
+
const ComboBoxField = ({ name, label, placeholder, emptyMessage, required, children, readOnly, ...others }) => {
|
|
16
|
+
const [open, setOpen] = react_1.default.useState(false);
|
|
17
|
+
// with the value and label
|
|
18
|
+
const options = react_1.default.useMemo(() => react_1.default.Children.map(react_1.default.Children.toArray(children), (child) => react_1.default.isValidElement(child) && {
|
|
19
|
+
value: child.props.value,
|
|
20
|
+
label: child.props.children
|
|
21
|
+
}), [children]);
|
|
22
|
+
const getDisplayValue = react_1.default.useCallback((value) => {
|
|
23
|
+
return options.find((option) => option.value === value)?.label ?? null;
|
|
24
|
+
}, [options]);
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)(form_1.FormField, { name: name, ...others, render: ({ field }) => ((0, jsx_runtime_1.jsxs)(form_1.FormItem, { required: required, children: [label && (0, jsx_runtime_1.jsx)(form_1.FormLabel, { children: label }), (0, jsx_runtime_1.jsxs)(popover_1.Popover, { open: readOnly ? false : open, onOpenChange: readOnly ? () => { } : setOpen, children: [(0, jsx_runtime_1.jsx)(popover_1.PopoverTrigger, { asChild: true, children: (0, jsx_runtime_1.jsxs)(button_1.Button, { variant: "outline", role: "combobox", "aria-expanded": readOnly ? false : open, readOnly: readOnly, tabIndex: 0, className: (0, utils_1.cn)('w-full justify-between', !field.value && 'text-muted-foreground'), children: [getDisplayValue(field.value) ?? placeholder, !readOnly && ((0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsUpDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" }))] }) }), (0, jsx_runtime_1.jsx)(popover_1.PopoverContent, { className: "w-(--radix-popover-trigger-width) p-0", children: (0, jsx_runtime_1.jsxs)(command_1.Command, { children: [(0, jsx_runtime_1.jsx)(command_1.CommandInput, { placeholder: placeholder }), (0, jsx_runtime_1.jsxs)(command_1.CommandList, { children: [(0, jsx_runtime_1.jsx)(command_1.CommandEmpty, { children: emptyMessage }), (0, jsx_runtime_1.jsx)(command_1.CommandGroup, { children: react_1.default.Children.map(react_1.default.Children.toArray(children), (child) => react_1.default.isValidElement(child)
|
|
26
|
+
? react_1.default.cloneElement(child, {
|
|
27
|
+
keywords: [child.props.children],
|
|
28
|
+
onSelect: (value) => {
|
|
29
|
+
field.onChange(field.value !== value ? value : '');
|
|
30
|
+
setOpen(false);
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
: child) })] })] }) })] }), (0, jsx_runtime_1.jsx)(form_1.FormMessage, {})] })) }));
|
|
34
|
+
};
|
|
35
|
+
exports.ComboBoxField = ComboBoxField;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ComboBoxFieldProps } from '../combo-box-field';
|
|
2
|
+
export type CountryFieldProps = Omit<ComboBoxFieldProps, 'children'> & {};
|
|
3
|
+
export declare const CountryField: ({ ...others }: CountryFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/form/country-field/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAiB,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAGtE,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC,GAAG,EAAE,CAAA;AAEzE,eAAO,MAAM,YAAY,GAAI,eAAe,iBAAiB,4CAU5D,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CountryField = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const command_1 = require("../../../components/ui/command");
|
|
6
|
+
const combo_box_field_1 = require("../combo-box-field");
|
|
7
|
+
const country_utils_1 = require("../../../utils/country-utils");
|
|
8
|
+
const CountryField = ({ ...others }) => {
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)(combo_box_field_1.ComboBoxField, { ...others, children: (0, country_utils_1.getCountries)().map((country) => ((0, jsx_runtime_1.jsx)(command_1.CommandItem, { value: country.code, children: country.name }, country.code))) }));
|
|
10
|
+
};
|
|
11
|
+
exports.CountryField = CountryField;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './input-field';
|
|
2
|
+
export * from './select-field';
|
|
3
|
+
export * from './switch-field';
|
|
4
|
+
export * from './pagination-limit-field';
|
|
5
|
+
export * from './combo-box-field';
|
|
6
|
+
export * from './country-field';
|
|
7
|
+
export * from './state-field';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/form/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./input-field"), exports);
|
|
18
|
+
__exportStar(require("./select-field"), exports);
|
|
19
|
+
__exportStar(require("./switch-field"), exports);
|
|
20
|
+
__exportStar(require("./pagination-limit-field"), exports);
|
|
21
|
+
__exportStar(require("./combo-box-field"), exports);
|
|
22
|
+
__exportStar(require("./country-field"), exports);
|
|
23
|
+
__exportStar(require("./state-field"), exports);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { HTMLInputTypeAttribute, ReactNode } from 'react';
|
|
2
|
+
import { Control } from 'react-hook-form';
|
|
3
|
+
export type InputFieldProps = {
|
|
4
|
+
className?: string;
|
|
5
|
+
name: string;
|
|
6
|
+
type?: HTMLInputTypeAttribute;
|
|
7
|
+
label?: ReactNode;
|
|
8
|
+
tooltip?: string;
|
|
9
|
+
labelExtra?: ReactNode;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
description?: ReactNode;
|
|
12
|
+
control: Control<any>;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
readOnly?: boolean;
|
|
15
|
+
minHeight?: number;
|
|
16
|
+
maxHeight?: number;
|
|
17
|
+
textArea?: boolean;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
defaultValue?: string;
|
|
20
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
21
|
+
};
|
|
22
|
+
export declare const InputField: ({ className, type, label, tooltip, labelExtra, placeholder, description, required, readOnly, minHeight, maxHeight, textArea, defaultValue, onChange, ...others }: InputFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/form/input-field/index.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEzC,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,sBAAsB,CAAA;IAC7B,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,CACT,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,KACzD,IAAI,CAAA;CACV,CAAA;AACD,eAAO,MAAM,UAAU,GAAI,kKAgBxB,eAAe,4CA8CjB,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InputField = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const autosize_textarea_1 = require("../../../components/ui/autosize-textarea");
|
|
6
|
+
const form_1 = require("../../../components/ui/form");
|
|
7
|
+
const input_1 = require("../../../components/ui/input");
|
|
8
|
+
const InputField = ({ className, type, label, tooltip, labelExtra, placeholder, description, required, readOnly, minHeight, maxHeight, textArea, defaultValue, onChange, ...others }) => {
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)(form_1.FormField, { ...others, render: ({ field }) => ((0, jsx_runtime_1.jsxs)(form_1.FormItem, { required: required, children: [label && ((0, jsx_runtime_1.jsx)(form_1.FormLabel, { extra: tooltip ? (0, jsx_runtime_1.jsx)(form_1.FormTooltip, { children: tooltip }) : labelExtra, children: label })), (0, jsx_runtime_1.jsx)(form_1.FormControl, { children: textArea ? ((0, jsx_runtime_1.jsx)(autosize_textarea_1.AutosizeTextarea, { className: className, placeholder: placeholder, readOnly: readOnly, minHeight: minHeight, maxHeight: maxHeight, defaultValue: defaultValue, ...field, onChange: (e) => {
|
|
10
|
+
field.onChange(e);
|
|
11
|
+
onChange?.(e);
|
|
12
|
+
} })) : ((0, jsx_runtime_1.jsx)(input_1.Input, { className: className, type: type, placeholder: placeholder, readOnly: readOnly, ...field })) }), (0, jsx_runtime_1.jsx)(form_1.FormMessage, {}), description && (0, jsx_runtime_1.jsx)(form_1.FormDescription, { children: description })] })) }));
|
|
13
|
+
};
|
|
14
|
+
exports.InputField = InputField;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Control } from 'react-hook-form';
|
|
2
|
+
export type PaginationLimitFieldProps = {
|
|
3
|
+
label?: string;
|
|
4
|
+
options?: number[];
|
|
5
|
+
control: Control<any>;
|
|
6
|
+
};
|
|
7
|
+
export declare const PaginationLimitField: ({ options, label, control }: PaginationLimitFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/form/pagination-limit-field/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAIzC,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,oBAAoB,GAAI,6BAIlC,yBAAyB,4CAe3B,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaginationLimitField = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const select_field_1 = require("../select-field");
|
|
6
|
+
const select_1 = require("../../../components/ui/select");
|
|
7
|
+
const PaginationLimitField = ({ options = [10, 50, 100], label = 'Items per page', control }) => {
|
|
8
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-4", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-sm font-medium whitespace-nowrap text-gray-600", children: label }), (0, jsx_runtime_1.jsx)(select_field_1.SelectField, { name: "limit", control: control, children: options.map((pageSize) => ((0, jsx_runtime_1.jsx)(select_1.SelectItem, { value: String(pageSize), children: pageSize }, pageSize))) })] }));
|
|
9
|
+
};
|
|
10
|
+
exports.PaginationLimitField = PaginationLimitField;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Control, FieldPath, FieldValues } from 'react-hook-form';
|
|
2
|
+
interface PasswordFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> {
|
|
3
|
+
name: TName;
|
|
4
|
+
label: string;
|
|
5
|
+
tooltip?: string;
|
|
6
|
+
control: Control<TFieldValues>;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function PasswordField<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, label, tooltip, control, required, disabled }: PasswordFieldProps<TFieldValues, TName>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/form/password-field/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAYjE,UAAU,kBAAkB,CAC1B,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,KAAK,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC;IAE/D,IAAI,EAAE,KAAK,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,wBAAgB,aAAa,CAC3B,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,KAAK,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,EAC/D,EACA,IAAI,EACJ,KAAK,EACL,OAAO,EACP,OAAO,EACP,QAAgB,EAChB,QAAgB,EACjB,EAAE,kBAAkB,CAAC,YAAY,EAAE,KAAK,CAAC,2CAwCzC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PasswordField = PasswordField;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const form_1 = require("../../../components/ui/form");
|
|
7
|
+
const input_1 = require("../../../components/ui/input");
|
|
8
|
+
const lucide_react_1 = require("lucide-react");
|
|
9
|
+
function PasswordField({ name, label, tooltip, control, required = false, disabled = false }) {
|
|
10
|
+
const [showPassword, setShowPassword] = (0, react_1.useState)(false);
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(form_1.FormField, { control: control, name: name, render: ({ field }) => ((0, jsx_runtime_1.jsxs)(form_1.FormItem, { required: required, children: [(0, jsx_runtime_1.jsx)(form_1.FormLabel, { extra: tooltip ? (0, jsx_runtime_1.jsx)(form_1.FormTooltip, { children: tooltip }) : undefined, children: label }), (0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [(0, jsx_runtime_1.jsx)(form_1.FormControl, { children: (0, jsx_runtime_1.jsx)(input_1.Input, { ...field, type: showPassword ? 'text' : 'password', disabled: disabled, className: "pr-10" }) }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "absolute inset-y-0 right-0 flex items-center px-3 text-gray-400 hover:text-gray-500 focus:outline-hidden", tabIndex: -1, onMouseDown: (e) => {
|
|
12
|
+
e.preventDefault();
|
|
13
|
+
setShowPassword(!showPassword);
|
|
14
|
+
}, children: showPassword ? (0, jsx_runtime_1.jsx)(lucide_react_1.EyeOffIcon, { size: 20 }) : (0, jsx_runtime_1.jsx)(lucide_react_1.EyeIcon, { size: 20 }) })] }), (0, jsx_runtime_1.jsx)(form_1.FormMessage, {})] })) }));
|
|
15
|
+
}
|