@layers-app/shared 0.3.9 → 0.4.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/components/AnimatedFigurePage/AnimatedFigurePage.module.css.js +10 -10
- package/dist/components/AnimatedFigurePage/useParallax.d.ts +2 -2
- package/dist/components/AppContainer/AppContainer.module.css.js +1 -1
- package/dist/components/AppContainer/components/AppSidebarButton.d.ts +1 -4
- package/dist/components/AppContainer/components/AppSidebarButton.d.ts.map +1 -1
- package/dist/components/AppContainer/components/AppSidebarButton.js +15 -22
- package/dist/components/AppContainer/components/AppsSidebar/AppsSection.d.ts.map +1 -1
- package/dist/components/AppContainer/components/AppsSidebar/AppsSection.js +21 -22
- package/dist/components/AppContainer/components/AppsSidebar/UserSection.d.ts.map +1 -1
- package/dist/components/AppContainer/components/AppsSidebar/UserSection.js +91 -48
- package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.module.css.js +1 -1
- package/dist/components/AppShell/AppShell.module.css.js +5 -5
- package/dist/components/AttachmentsGalleryModal/components/GallerySlide.d.ts +1 -3
- package/dist/components/AttachmentsGalleryModal/components/GallerySlide.d.ts.map +1 -1
- package/dist/components/AttachmentsGalleryModal/components/GallerySlide.js +63 -89
- package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/ShakaPlayer.d.ts +1 -1
- package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/ShakaPlayer.d.ts.map +1 -1
- package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/ShakaPlayer.js +26 -35
- package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/ShakaPlayer.module.css.js +4 -4
- package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/useShakePlayer.d.ts +1 -1
- package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/useShakePlayer.d.ts.map +1 -1
- package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/useShakePlayer.js +36 -43
- package/dist/components/AttachmentsGalleryModal/hooks/useGetPreviewUrl.d.ts +0 -4
- package/dist/components/AttachmentsGalleryModal/hooks/useGetPreviewUrl.d.ts.map +1 -1
- package/dist/components/AttachmentsGalleryModal/hooks/useGetPreviewUrl.js +20 -59
- package/dist/components/AttachmentsGalleryModal/styles.module.css.js +18 -28
- package/dist/components/AttachmentsPreview/AttachmentsPreview.d.ts.map +1 -1
- package/dist/components/AttachmentsPreview/AttachmentsPreview.js +18 -22
- package/dist/components/AttachmentsPreview/AttachmentsPreview.module.css.js +1 -1
- package/dist/components/BouncingLogo/BouncingLogo.module.css.js +8 -8
- package/dist/components/CollapsibleContainer/CollapsibleContainer.module.css.js +1 -1
- package/dist/components/ColorPicker/ColorPicker.d.ts +18 -23
- package/dist/components/ColorPicker/ColorPicker.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPicker.js +139 -145
- package/dist/components/ColorPicker/ColorPicker.module.css.js +8 -8
- package/dist/components/ColorPicker/ColorPickerToolbar.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPickerToolbar.js +88 -71
- package/dist/components/ColorPicker/icons.js +4 -4
- package/dist/components/CommentComposer/CommentComposer.module.css.js +4 -4
- package/dist/components/CommentComposer/CommentEditorHotkeys.d.ts.map +1 -1
- package/dist/components/CommentComposer/CommentEditorHotkeys.js +4 -3
- package/dist/components/CommentComposer/index.js +1 -1
- package/dist/components/CommentComposer/useVirtualAnchor.d.ts +1 -1
- package/dist/components/CommentComposer/useVirtualAnchor.d.ts.map +1 -1
- package/dist/components/CommunitiesDialog/styles.module.css.js +1 -1
- package/dist/components/Copyright/Copyright.module.css.js +1 -1
- package/dist/components/CustomKBD/CustomKBD.module.css.js +1 -1
- package/dist/components/EmojiPicker/EmojiPanel.d.ts.map +1 -1
- package/dist/components/EmojiPicker/EmojiPanel.js +22 -22
- package/dist/components/EmojiPicker/EmojiPicker.d.ts +1 -1
- package/dist/components/EmojiPicker/EmojiPicker.d.ts.map +1 -1
- package/dist/components/EmojiPicker/EmojiPicker.js +1 -0
- package/dist/components/EmojiPicker/EmojiPicker.module.css.js +8 -8
- package/dist/components/EmojiPicker/IconsPanel.js +13 -13
- package/dist/components/EntityIcon.d.ts.map +1 -1
- package/dist/components/EntityIcon.js +33 -43
- package/dist/components/EntityTitle/EntityTitle.module.css.js +1 -1
- package/dist/components/ErrorPage/components/Error404.d.ts.map +1 -1
- package/dist/components/FeatureProgress/FeatureProgress.module.css.js +49 -49
- package/dist/components/FilePicker/FilePicker.d.ts +4 -2
- package/dist/components/FilePicker/FilePicker.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePicker.js +241 -226
- package/dist/components/FilePicker/FilePicker.module.css.js +14 -12
- package/dist/components/FilePicker/FilePickerGallery.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePickerGallery.js +60 -34
- package/dist/components/FilePicker/FilePickerGiphy.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePickerGiphy.js +38 -39
- package/dist/components/FilePicker/FilePickerLink.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePickerLink.js +29 -26
- package/dist/components/FilePicker/FilePickerUnsplash.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePickerUnsplash.js +42 -43
- package/dist/components/FilePicker/FilePickerUpload.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePickerUpload.js +51 -35
- package/dist/components/FilePicker/coverCollections.d.ts +4 -0
- package/dist/components/FilePicker/coverCollections.d.ts.map +1 -0
- package/dist/components/FilePicker/coverCollections.js +164 -0
- package/dist/components/FilePicker/index.d.ts +1 -0
- package/dist/components/FilePicker/index.d.ts.map +1 -1
- package/dist/components/FormViewer/FormViewer.module.css.js +20 -20
- package/dist/components/FormViewer/components/fields/DragOptions/DragOptions.module.css.js +1 -1
- package/dist/components/FormViewer/components/fields/DropdownField/DropdownField.module.css.js +1 -1
- package/dist/components/FormViewer/components/fields/EditableContent/EditableContent.module.css.js +1 -1
- package/dist/components/FormViewer/components/fields/SelectableCard/SelectableCard.module.css.js +8 -8
- package/dist/components/FormViewer/components/fields/UploadField/UploadFile/UploadFile.module.css.js +4 -4
- package/dist/components/FormViewer/helpers/conditions.d.ts +38 -38
- package/dist/components/FormViewer/helpers/helpers.d.ts +38 -38
- package/dist/components/FormViewer/helpers/steps.d.ts +38 -38
- package/dist/components/FormViewer/hooks/useActiveControl.d.ts +19 -19
- package/dist/components/FormViewer/hooks/useActiveStep.d.ts +38 -38
- package/dist/components/FormViewer/hooks/useFormGlobalTheme.d.ts +0 -6
- package/dist/components/FormViewer/hooks/useFormGlobalTheme.d.ts.map +1 -1
- package/dist/components/FormViewer/hooks/useFormGlobalTheme.js +3 -4
- package/dist/components/FormViewer/hooks/useFormMobile.d.ts +1 -1
- package/dist/components/FormViewer/hooks/useFormMobile.d.ts.map +1 -1
- package/dist/components/FormViewer/store/formStore.d.ts +248 -248
- package/dist/components/FormViewer/store/formStore.d.ts.map +1 -1
- package/dist/components/FormViewer/store/formStoreApi.d.ts +124 -124
- package/dist/components/FormViewer/store/selectors.d.ts +11655 -11655
- package/dist/components/FormViewer/types/form.d.ts +1 -1
- package/dist/components/FormViewer/types/form.d.ts.map +1 -1
- package/dist/components/FormViewer/types/schemes.d.ts +6358 -381
- package/dist/components/FormViewer/types/schemes.d.ts.map +1 -1
- package/dist/components/FormViewer/types/schemes.js +1 -1
- package/dist/components/GroupAvatar/index.d.ts +1 -3
- package/dist/components/GroupAvatar/index.d.ts.map +1 -1
- package/dist/components/GroupAvatar/index.js +21 -24
- package/dist/components/ImageCropper/ImageCropper.module.css.js +38 -38
- package/dist/components/IntegrationFlowAnimation/IntegrationFlowAnimation.module.css.js +11 -11
- package/dist/components/LanguagePicker/LanguagePicker.module.css.js +1 -1
- package/dist/components/Loaders/styles.module.css.js +6 -6
- package/dist/components/MediaLibrary/MediaLibrary.module.css.js +2 -2
- package/dist/components/MediaLibrary/MediaLibraryRow.js +7 -7
- package/dist/components/NavMenu/NavMenu.d.ts +1 -3
- package/dist/components/NavMenu/NavMenu.d.ts.map +1 -1
- package/dist/components/NavMenu/NavMenu.module.css.js +12 -12
- package/dist/components/NavMenu/components/DnDProvider.d.ts +1 -1
- package/dist/components/NavMenu/components/DnDProvider.d.ts.map +1 -1
- package/dist/components/NavMenu/components/NavMenuActionIcon.d.ts +1 -7
- package/dist/components/NavMenu/components/NavMenuActionIcon.d.ts.map +1 -1
- package/dist/components/NavMenu/components/NavMenuActionIcon.js +23 -21
- package/dist/components/NavbarResizer/NavbarResizer.module.css.js +2 -2
- package/dist/components/NewColorPicker/components/Target.d.ts +1 -3
- package/dist/components/NewColorPicker/components/Target.d.ts.map +1 -1
- package/dist/components/NewColorPicker/components/Target.js +43 -48
- package/dist/components/NotPublicPanel/NotPublicPanel.module.css.js +11 -11
- package/dist/components/Notification/Notification.js +1 -3
- package/dist/components/Notification/Notification.module.css.js +1 -1
- package/dist/components/Notification/NotificationCard.d.ts +1 -3
- package/dist/components/Notification/NotificationCard.d.ts.map +1 -1
- package/dist/components/Notification/NotificationCard.js +86 -87
- package/dist/components/OnBoarding/steps/DifferentLayouts/styles.module.css.js +3 -3
- package/dist/components/OnBoarding/steps/styles.module.css.js +9 -9
- package/dist/components/OnBoarding/styles.module.css.js +7 -7
- package/dist/components/OnboardingTour/OnboardingTourWrapper.d.ts +1 -1
- package/dist/components/OnboardingTour/OnboardingTourWrapper.d.ts.map +1 -1
- package/dist/components/OnboardingTour/OnboardingTourWrapper.js +74 -70
- package/dist/components/ProjectIcon/ProjectIcon.d.ts +12 -7
- package/dist/components/ProjectIcon/ProjectIcon.d.ts.map +1 -1
- package/dist/components/ProjectIcon/ProjectIcon.js +60 -58
- package/dist/components/SearchFilters/SearchFilters.module.css.js +1 -1
- package/dist/components/SettingsSection/styles.module.css.js +1 -1
- package/dist/components/StorageUsageProgress/StorageUsageProgress.module.css.js +1 -1
- package/dist/components/TreeIndent/TreeIndent.module.css.js +4 -4
- package/dist/components/UserAvatar/index.d.ts +1 -2
- package/dist/components/UserAvatar/index.d.ts.map +1 -1
- package/dist/components/UserAvatar/index.js +35 -38
- package/dist/components/WorkspaceAvatar/WorkspaceAvatar.d.ts +3 -3
- package/dist/components/WorkspaceAvatar/WorkspaceAvatar.d.ts.map +1 -1
- package/dist/components/WorkspaceAvatar/WorkspaceAvatar.js +18 -19
- package/dist/components/WorkspaceMenu/WorkspaceItem.js +17 -17
- package/dist/components/WorkspaceMenu/WorkspaceMenu.js +7 -7
- package/dist/components/table/FrontTable.d.ts.map +1 -1
- package/dist/components/table/hooks/useColumnsResizing.d.ts.map +1 -1
- package/dist/config/envConfig.d.ts +0 -8
- package/dist/config/envConfig.d.ts.map +1 -1
- package/dist/config/envConfig.js +13 -21
- package/dist/helpers/getFileIcons.d.ts.map +1 -1
- package/dist/helpers/getFileIcons.js +45 -63
- package/dist/helpers/getFileType.d.ts +1 -1
- package/dist/helpers/getFileType.d.ts.map +1 -1
- package/dist/helpers/getFileType.js +8 -29
- package/dist/helpers/getPartOfTheDay.d.ts +1 -1
- package/dist/helpers/platform.d.ts +1 -1
- package/dist/helpers/platform.d.ts.map +1 -1
- package/dist/helpers/platform.js +4 -5
- package/dist/helpers/showFeatureFeedback.module.css.js +4 -4
- package/dist/helpers/showNotifications.d.ts.map +1 -1
- package/dist/helpers/showNotifications.js +29 -30
- package/dist/helpers/showNotifications.module.css.js +1 -1
- package/dist/hooks/useOutsideClick.d.ts +1 -1
- package/dist/hooks/useOutsideClick.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +465 -467
- package/dist/lang/locales/ui_en.json.js +20 -18
- package/dist/lang/locales/ui_es.json.js +14 -12
- package/dist/lang/locales/ui_ru.json.js +15 -13
- package/dist/node_modules/countries-and-timezones/esm/index.js +4011 -281
- package/docs/README.md +499 -499
- package/package.json +75 -75
- package/dist/components/AttachmentsGalleryModal/components/UnsupportedSection.d.ts +0 -6
- package/dist/components/AttachmentsGalleryModal/components/UnsupportedSection.d.ts.map +0 -1
- package/dist/components/AttachmentsGalleryModal/components/UnsupportedSection.js +0 -16
- package/dist/components/TextColorIcon.d.ts +0 -8
- package/dist/components/TextColorIcon.d.ts.map +0 -1
- package/dist/components/TextColorIcon.js +0 -60
- package/dist/helpers/offlineSuppression.d.ts +0 -3
- package/dist/helpers/offlineSuppression.d.ts.map +0 -1
- package/dist/helpers/offlineSuppression.js +0 -8
package/docs/README.md
CHANGED
|
@@ -1,499 +1,499 @@
|
|
|
1
|
-
# @layers-app/shared - Usage Guide
|
|
2
|
-
|
|
3
|
-
**Version:** 0.2.0
|
|
4
|
-
**Type:** ESM Library for React applications
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## 📦 Installation
|
|
9
|
-
|
|
10
|
-
```bash
|
|
11
|
-
npm install @layers-app/shared
|
|
12
|
-
# or
|
|
13
|
-
yarn add @layers-app/shared
|
|
14
|
-
# or
|
|
15
|
-
pnpm add @layers-app/shared
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## 🚀 Quick Start
|
|
21
|
-
|
|
22
|
-
### 1. Import Styles (Required)
|
|
23
|
-
|
|
24
|
-
Import styles **once** in your application entry point:
|
|
25
|
-
|
|
26
|
-
```typescript
|
|
27
|
-
// main.tsx or App.tsx
|
|
28
|
-
import '@layers-app/shared/styles';
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### 2. Use Components
|
|
32
|
-
|
|
33
|
-
```typescript
|
|
34
|
-
import {
|
|
35
|
-
CustomKBD,
|
|
36
|
-
FilePicker,
|
|
37
|
-
EmojiPicker,
|
|
38
|
-
SearchFilters,
|
|
39
|
-
// ... other components
|
|
40
|
-
} from '@layers-app/shared';
|
|
41
|
-
|
|
42
|
-
function App() {
|
|
43
|
-
return (
|
|
44
|
-
<>
|
|
45
|
-
<CustomKBD value="Ctrl" />
|
|
46
|
-
<FilePicker onSelect={(file) => console.log(file)} />
|
|
47
|
-
<EmojiPicker onSelect={(emoji) => console.log(emoji)} />
|
|
48
|
-
</>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
## 📚 Available Exports
|
|
56
|
-
|
|
57
|
-
### Components
|
|
58
|
-
|
|
59
|
-
- `NoData` - Empty state component
|
|
60
|
-
- `FilePicker` / `FilePickerUpload` - File selection and upload
|
|
61
|
-
- `EmojiPicker` - Emoji selector
|
|
62
|
-
- `AppContainer` - Application container
|
|
63
|
-
- `CustomKBD` - Keyboard key display
|
|
64
|
-
- `SubmitModal` - Submission modal
|
|
65
|
-
- `UserAvatar` - User avatar component
|
|
66
|
-
- `WorkspaceMenu` / `WorkspaceAvatar` - Workspace components
|
|
67
|
-
- `NavbarResizer` - Resizable navbar
|
|
68
|
-
- `ErrorPage` / `ErrorAlert` - Error displays
|
|
69
|
-
- `OnBoarding` - Onboarding flow
|
|
70
|
-
- `ProjectIcon` - Project icon display
|
|
71
|
-
- `ColorPicker` / `ColorPickerPopover` / `NewColorPicker` - Color pickers
|
|
72
|
-
- `AnimationWrapper` - Animation container
|
|
73
|
-
- `SearchFilters` - Search filter components
|
|
74
|
-
- `AttachmentsGalleryModal` - Attachment gallery
|
|
75
|
-
- `ImageModal` - Image modal viewer
|
|
76
|
-
- `Logotype` - Logo component
|
|
77
|
-
- `SortableList` - Drag-and-drop sortable list
|
|
78
|
-
- `ThemeIndicator` - Theme indicator
|
|
79
|
-
- `CommentsPanel` / `CommentComposer` - Comments system
|
|
80
|
-
- `PinModal` - Pin modal
|
|
81
|
-
- `PaymentSuccess` / `PaymentError` / `PaymentCancel` - Payment status pages
|
|
82
|
-
- `StorageUsageProgress` / `StorageUsageEntityList` - Storage components
|
|
83
|
-
- `LanguagePicker` - Language selector
|
|
84
|
-
- `FrontTable` - Table component
|
|
85
|
-
- `CommunitiesDialog` - Communities dialog
|
|
86
|
-
- `NotPublicPanel` - Not public panel
|
|
87
|
-
- `BottomDrawerWithoutHeader` - Bottom drawer
|
|
88
|
-
- `Copyright` - Copyright notice
|
|
89
|
-
- `EntityTitle` - Entity title
|
|
90
|
-
- `CircleColorPicker` - Circle color picker
|
|
91
|
-
- `FormViewer` - Form viewer
|
|
92
|
-
- `BouncingLogo` - Animated logo
|
|
93
|
-
- `CommentFilterMenu` - Comment filter
|
|
94
|
-
- `RemoveConfirmModal` - Confirmation modal
|
|
95
|
-
- `AppSidebarButton` - Sidebar button
|
|
96
|
-
- `NavMenu` - Navigation menu
|
|
97
|
-
- `EntityIcon` - Entity icon
|
|
98
|
-
|
|
99
|
-
### Helpers
|
|
100
|
-
|
|
101
|
-
- `showNotifications` - Show notifications
|
|
102
|
-
- `pickRandomEmoji` - Random emoji selector
|
|
103
|
-
- `themeUtils` - Theme utilities
|
|
104
|
-
- `combineStatuses` - Combine statuses
|
|
105
|
-
- `download` - Download helper
|
|
106
|
-
- `generateLink` - Link generator
|
|
107
|
-
- `feature` - Feature flags
|
|
108
|
-
- `fileUtils` - File utilities
|
|
109
|
-
- `formatBytes` - Format bytes
|
|
110
|
-
- `filterHierarchyByTypes` - Filter hierarchy
|
|
111
|
-
- `getRandomIconColor` - Random icon color
|
|
112
|
-
- `getFileIcons` - File icons
|
|
113
|
-
- `getFileType` - File type detection
|
|
114
|
-
- `getPartOfTheDay` - Time of day
|
|
115
|
-
- `isAppMode` - App mode detection
|
|
116
|
-
- `dates` - Date utilities
|
|
117
|
-
- `hotjar` - Hotjar integration
|
|
118
|
-
|
|
119
|
-
### Hooks
|
|
120
|
-
|
|
121
|
-
- `useMenu` - Menu hook
|
|
122
|
-
- `useDateFnsLocale` - Date-fns locale
|
|
123
|
-
- `useFormatDistance` - Format distance
|
|
124
|
-
- `useSwipeDetect` - Swipe detection
|
|
125
|
-
- `useOAuthErrorParams` - OAuth error params
|
|
126
|
-
- `useDateUtils` - Date utilities
|
|
127
|
-
- `useNumberQueryParam` - Number query param
|
|
128
|
-
- `useDisableWindowScroll` - Disable scroll
|
|
129
|
-
- `useAsyncStatus` - Async status
|
|
130
|
-
- `useAppContainer` - App container
|
|
131
|
-
- `useAppContainerStore` - App container store
|
|
132
|
-
- `useAppContainerDataStore` - App container data store
|
|
133
|
-
|
|
134
|
-
### Store
|
|
135
|
-
|
|
136
|
-
- `searchModal` - Search modal store
|
|
137
|
-
- `onboarding` - Onboarding store
|
|
138
|
-
- `workspacesOrder` - Workspaces order
|
|
139
|
-
- `timezoneStore` - Timezone store
|
|
140
|
-
- `plansModal` - Plans modal store
|
|
141
|
-
- `discordDialogStore` - Discord dialog store
|
|
142
|
-
- `accessOptionsControl` - Access options control
|
|
143
|
-
|
|
144
|
-
### Utils
|
|
145
|
-
|
|
146
|
-
- `formatStorage` - Format storage
|
|
147
|
-
- `getPlanBadgeColor` - Plan badge color
|
|
148
|
-
- `queryParams` - Query params utilities
|
|
149
|
-
|
|
150
|
-
---
|
|
151
|
-
|
|
152
|
-
## 🎨 Styling
|
|
153
|
-
|
|
154
|
-
### CSS Modules
|
|
155
|
-
|
|
156
|
-
This library uses **CSS Modules** for component styling. All styles are bundled into a single `index.css` file.
|
|
157
|
-
|
|
158
|
-
**Structure:**
|
|
159
|
-
|
|
160
|
-
```
|
|
161
|
-
dist/
|
|
162
|
-
├── index.css ← All styles (54 KB)
|
|
163
|
-
├── index.js ← JavaScript
|
|
164
|
-
└── components/
|
|
165
|
-
└── CustomKBD/
|
|
166
|
-
├── index.js
|
|
167
|
-
└── CustomKBD.module.css.js ← CSS classes mapping
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### How It Works
|
|
171
|
-
|
|
172
|
-
1. **Import styles once:**
|
|
173
|
-
|
|
174
|
-
```typescript
|
|
175
|
-
import '@layers-app/shared/styles';
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
2. **All components automatically get correct CSS classes**
|
|
179
|
-
|
|
180
|
-
```typescript
|
|
181
|
-
// Component uses CSS Modules internally
|
|
182
|
-
import styles from './CustomKBD.module.css';
|
|
183
|
-
<Box className={styles.root} /> // ✅ Scoped class applied
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
3. **No naming conflicts** - classes are scoped (e.g., `_root_195do_1`)
|
|
187
|
-
|
|
188
|
-
---
|
|
189
|
-
|
|
190
|
-
## ⚙️ Peer Dependencies
|
|
191
|
-
|
|
192
|
-
Install these dependencies in your project:
|
|
193
|
-
|
|
194
|
-
### Required
|
|
195
|
-
|
|
196
|
-
```json
|
|
197
|
-
{
|
|
198
|
-
"react": "^18.3.1",
|
|
199
|
-
"react-dom": "^18.3.1",
|
|
200
|
-
"@mantine/core": "8.3.5",
|
|
201
|
-
"@mantine/hooks": "8.3.5",
|
|
202
|
-
"@mantine/form": "8.3.5",
|
|
203
|
-
"@mantine/modals": "8.3.5",
|
|
204
|
-
"@mantine/notifications": "8.3.5"
|
|
205
|
-
}
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
### Optional (based on usage)
|
|
209
|
-
|
|
210
|
-
```json
|
|
211
|
-
{
|
|
212
|
-
"@dnd-kit/core": "^6.0.0",
|
|
213
|
-
"@dnd-kit/sortable": "^8.0.0",
|
|
214
|
-
"@tabler/icons-react": "^3.7.0",
|
|
215
|
-
"framer-motion": "^11.3.24",
|
|
216
|
-
"date-fns": "^4.1.0",
|
|
217
|
-
"i18next": "^25.5.2",
|
|
218
|
-
"react-i18next": "^15.7.3",
|
|
219
|
-
"react-router-dom": "^7.5.2",
|
|
220
|
-
"zustand": "^5.0.3",
|
|
221
|
-
"@reduxjs/toolkit": "^2.2.7",
|
|
222
|
-
"@tanstack/react-query": "^5.52.2"
|
|
223
|
-
}
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
Full list available in `package.json` `peerDependencies`.
|
|
227
|
-
|
|
228
|
-
---
|
|
229
|
-
|
|
230
|
-
## 🔧 Configuration
|
|
231
|
-
|
|
232
|
-
### TypeScript
|
|
233
|
-
|
|
234
|
-
Types are included. No additional configuration needed.
|
|
235
|
-
|
|
236
|
-
```typescript
|
|
237
|
-
import { CustomKBD } from '@layers-app/shared';
|
|
238
|
-
|
|
239
|
-
// ✅ Full TypeScript support
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
### Vite
|
|
243
|
-
|
|
244
|
-
```typescript
|
|
245
|
-
// vite.config.ts
|
|
246
|
-
export default defineConfig({
|
|
247
|
-
// No special configuration needed
|
|
248
|
-
// Styles are auto-loaded via import '@layers-app/shared/styles'
|
|
249
|
-
});
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
### Webpack
|
|
253
|
-
|
|
254
|
-
```javascript
|
|
255
|
-
// webpack.config.js
|
|
256
|
-
module.exports = {
|
|
257
|
-
module: {
|
|
258
|
-
rules: [
|
|
259
|
-
{
|
|
260
|
-
test: /\.css$/,
|
|
261
|
-
use: ['style-loader', 'css-loader'],
|
|
262
|
-
},
|
|
263
|
-
],
|
|
264
|
-
},
|
|
265
|
-
};
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
---
|
|
269
|
-
|
|
270
|
-
## 📖 Usage Examples
|
|
271
|
-
|
|
272
|
-
### Using FilePicker
|
|
273
|
-
|
|
274
|
-
```typescript
|
|
275
|
-
import { FilePicker } from '@layers-app/shared';
|
|
276
|
-
|
|
277
|
-
function MyComponent() {
|
|
278
|
-
const handleFileSelect = (file: File) => {
|
|
279
|
-
console.log('Selected file:', file);
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
return (
|
|
283
|
-
<FilePicker
|
|
284
|
-
onSelect={handleFileSelect}
|
|
285
|
-
accept="image/*"
|
|
286
|
-
maxSize={5 * 1024 * 1024} // 5MB
|
|
287
|
-
/>
|
|
288
|
-
);
|
|
289
|
-
}
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
### Using EmojiPicker
|
|
293
|
-
|
|
294
|
-
```typescript
|
|
295
|
-
import { EmojiPicker } from '@layers-app/shared';
|
|
296
|
-
|
|
297
|
-
function MyComponent() {
|
|
298
|
-
const handleEmojiSelect = (emoji: string) => {
|
|
299
|
-
console.log('Selected emoji:', emoji);
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
return (
|
|
303
|
-
<EmojiPicker
|
|
304
|
-
onSelect={handleEmojiSelect}
|
|
305
|
-
position="bottom-start"
|
|
306
|
-
/>
|
|
307
|
-
);
|
|
308
|
-
}
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
### Using SearchFilters
|
|
312
|
-
|
|
313
|
-
```typescript
|
|
314
|
-
import { SearchFilters } from '@layers-app/shared';
|
|
315
|
-
|
|
316
|
-
function MyComponent() {
|
|
317
|
-
const [filters, setFilters] = useState({});
|
|
318
|
-
|
|
319
|
-
return (
|
|
320
|
-
<SearchFilters
|
|
321
|
-
value={filters}
|
|
322
|
-
onChange={setFilters}
|
|
323
|
-
fields={[
|
|
324
|
-
{ name: 'status', type: 'select', options: [...] },
|
|
325
|
-
{ name: 'date', type: 'date' },
|
|
326
|
-
]}
|
|
327
|
-
/>
|
|
328
|
-
);
|
|
329
|
-
}
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
### Using SortableList
|
|
333
|
-
|
|
334
|
-
```typescript
|
|
335
|
-
import { SortableList } from '@layers-app/shared';
|
|
336
|
-
|
|
337
|
-
function MyComponent() {
|
|
338
|
-
const [items, setItems] = useState([...]);
|
|
339
|
-
|
|
340
|
-
return (
|
|
341
|
-
<SortableList
|
|
342
|
-
items={items}
|
|
343
|
-
onReorder={setItems}
|
|
344
|
-
renderItem={(item) => <div>{item.name}</div>}
|
|
345
|
-
/>
|
|
346
|
-
);
|
|
347
|
-
}
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
---
|
|
351
|
-
|
|
352
|
-
## 🏗️ Build Information
|
|
353
|
-
|
|
354
|
-
### Output Structure
|
|
355
|
-
|
|
356
|
-
```
|
|
357
|
-
dist/
|
|
358
|
-
├── index.js # Main entry point (ESM)
|
|
359
|
-
├── index.d.ts # TypeScript types
|
|
360
|
-
├── index.css # All styles (54 KB)
|
|
361
|
-
├── components/ # Component modules
|
|
362
|
-
├── hooks/ # Hooks modules
|
|
363
|
-
├── helpers/ # Helper modules
|
|
364
|
-
└── assets/ # Asset files
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
### Bundle Characteristics
|
|
368
|
-
|
|
369
|
-
- **Format:** ESM only
|
|
370
|
-
- **Tree-shaking:** Full support
|
|
371
|
-
- **CSS:** Scoped CSS Modules
|
|
372
|
-
- **TypeScript:** Full type definitions
|
|
373
|
-
- **Size:** ~457 KB total (400 KB JS + 54 KB CSS + 3 KB CSS mappings)
|
|
374
|
-
|
|
375
|
-
---
|
|
376
|
-
|
|
377
|
-
## 🔍 Advanced Usage
|
|
378
|
-
|
|
379
|
-
### Accessing Individual CSS
|
|
380
|
-
|
|
381
|
-
If you need specific component styles:
|
|
382
|
-
|
|
383
|
-
```typescript
|
|
384
|
-
// Import individual component CSS (rarely needed)
|
|
385
|
-
import '@layers-app/shared/dist/components/CustomKBD/CustomKBD.module.css.js';
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
### Using Assets
|
|
389
|
-
|
|
390
|
-
```typescript
|
|
391
|
-
// Access assets directly
|
|
392
|
-
import logo from '@layers-app/shared/assets/logo.svg';
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
### Custom Theme
|
|
396
|
-
|
|
397
|
-
```typescript
|
|
398
|
-
// Apply Mantine theme
|
|
399
|
-
import { MantineProvider } from '@mantine/core';
|
|
400
|
-
|
|
401
|
-
function App() {
|
|
402
|
-
return (
|
|
403
|
-
<MantineProvider theme={{ /* your theme */ }}>
|
|
404
|
-
{/* Your app */}
|
|
405
|
-
</MantineProvider>
|
|
406
|
-
);
|
|
407
|
-
}
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
---
|
|
411
|
-
|
|
412
|
-
## 📊 Performance
|
|
413
|
-
|
|
414
|
-
### Optimization Tips
|
|
415
|
-
|
|
416
|
-
1. **Import only what you need:**
|
|
417
|
-
|
|
418
|
-
```typescript
|
|
419
|
-
// ✅ Good - tree-shaking works
|
|
420
|
-
import { CustomKBD } from '@layers-app/shared';
|
|
421
|
-
// ❌ Bad - imports everything
|
|
422
|
-
import * as Shared from '@layers-app/shared';
|
|
423
|
-
```
|
|
424
|
-
|
|
425
|
-
2. **Styles are loaded once:**
|
|
426
|
-
|
|
427
|
-
```typescript
|
|
428
|
-
// Import in main.tsx only
|
|
429
|
-
import '@layers-app/shared/styles';
|
|
430
|
-
```
|
|
431
|
-
|
|
432
|
-
3. **Use lazy loading for heavy components:**
|
|
433
|
-
```typescript
|
|
434
|
-
const FormViewer = lazy(() =>
|
|
435
|
-
import('@layers-app/shared').then((m) => ({ default: m.FormViewer })),
|
|
436
|
-
);
|
|
437
|
-
```
|
|
438
|
-
|
|
439
|
-
---
|
|
440
|
-
|
|
441
|
-
## 🐛 Troubleshooting
|
|
442
|
-
|
|
443
|
-
### Styles not applied
|
|
444
|
-
|
|
445
|
-
**Solution:** Ensure you imported styles:
|
|
446
|
-
|
|
447
|
-
```typescript
|
|
448
|
-
import '@layers-app/shared/styles';
|
|
449
|
-
```
|
|
450
|
-
|
|
451
|
-
### TypeScript errors
|
|
452
|
-
|
|
453
|
-
**Solution:** Check peer dependencies are installed:
|
|
454
|
-
|
|
455
|
-
```bash
|
|
456
|
-
npm install react react-dom @mantine/core @mantine/hooks
|
|
457
|
-
```
|
|
458
|
-
|
|
459
|
-
### Build errors
|
|
460
|
-
|
|
461
|
-
**Solution:** Ensure you're using ESM-compatible bundler (Vite, Webpack 5+, etc.)
|
|
462
|
-
|
|
463
|
-
---
|
|
464
|
-
|
|
465
|
-
## 📝 Notes
|
|
466
|
-
|
|
467
|
-
### CSS Modules Explained
|
|
468
|
-
|
|
469
|
-
Files like `CustomKBD.module.css.js` are **JavaScript mappings** for CSS Modules:
|
|
470
|
-
|
|
471
|
-
```javascript
|
|
472
|
-
// CustomKBD.module.css.js
|
|
473
|
-
export default { root: '_root_195do_1' };
|
|
474
|
-
```
|
|
475
|
-
|
|
476
|
-
**This is correct behavior!** Actual styles are in `index.css`.
|
|
477
|
-
|
|
478
|
-
### Internal vs External Packages
|
|
479
|
-
|
|
480
|
-
- All `@layers-app/*` packages are internal monorepo packages
|
|
481
|
-
- External dependencies should be managed through package.json
|
|
482
|
-
|
|
483
|
-
---
|
|
484
|
-
|
|
485
|
-
## 🔗 Links
|
|
486
|
-
|
|
487
|
-
- **Repository:** [GitHub](https://github.com/yourusername/layers)
|
|
488
|
-
- **Issues:** [Report a bug](https://github.com/yourusername/layers/issues)
|
|
489
|
-
- **Documentation:** See `/docs` folder
|
|
490
|
-
|
|
491
|
-
---
|
|
492
|
-
|
|
493
|
-
## 📄 License
|
|
494
|
-
|
|
495
|
-
See LICENSE file in the repository.
|
|
496
|
-
|
|
497
|
-
---
|
|
498
|
-
|
|
499
|
-
**Made with ❤️ by the Layers team**
|
|
1
|
+
# @layers-app/shared - Usage Guide
|
|
2
|
+
|
|
3
|
+
**Version:** 0.2.0
|
|
4
|
+
**Type:** ESM Library for React applications
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 📦 Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @layers-app/shared
|
|
12
|
+
# or
|
|
13
|
+
yarn add @layers-app/shared
|
|
14
|
+
# or
|
|
15
|
+
pnpm add @layers-app/shared
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 🚀 Quick Start
|
|
21
|
+
|
|
22
|
+
### 1. Import Styles (Required)
|
|
23
|
+
|
|
24
|
+
Import styles **once** in your application entry point:
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
// main.tsx or App.tsx
|
|
28
|
+
import '@layers-app/shared/styles';
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 2. Use Components
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import {
|
|
35
|
+
CustomKBD,
|
|
36
|
+
FilePicker,
|
|
37
|
+
EmojiPicker,
|
|
38
|
+
SearchFilters,
|
|
39
|
+
// ... other components
|
|
40
|
+
} from '@layers-app/shared';
|
|
41
|
+
|
|
42
|
+
function App() {
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
<CustomKBD value="Ctrl" />
|
|
46
|
+
<FilePicker onSelect={(file) => console.log(file)} />
|
|
47
|
+
<EmojiPicker onSelect={(emoji) => console.log(emoji)} />
|
|
48
|
+
</>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 📚 Available Exports
|
|
56
|
+
|
|
57
|
+
### Components
|
|
58
|
+
|
|
59
|
+
- `NoData` - Empty state component
|
|
60
|
+
- `FilePicker` / `FilePickerUpload` - File selection and upload
|
|
61
|
+
- `EmojiPicker` - Emoji selector
|
|
62
|
+
- `AppContainer` - Application container
|
|
63
|
+
- `CustomKBD` - Keyboard key display
|
|
64
|
+
- `SubmitModal` - Submission modal
|
|
65
|
+
- `UserAvatar` - User avatar component
|
|
66
|
+
- `WorkspaceMenu` / `WorkspaceAvatar` - Workspace components
|
|
67
|
+
- `NavbarResizer` - Resizable navbar
|
|
68
|
+
- `ErrorPage` / `ErrorAlert` - Error displays
|
|
69
|
+
- `OnBoarding` - Onboarding flow
|
|
70
|
+
- `ProjectIcon` - Project icon display
|
|
71
|
+
- `ColorPicker` / `ColorPickerPopover` / `NewColorPicker` - Color pickers
|
|
72
|
+
- `AnimationWrapper` - Animation container
|
|
73
|
+
- `SearchFilters` - Search filter components
|
|
74
|
+
- `AttachmentsGalleryModal` - Attachment gallery
|
|
75
|
+
- `ImageModal` - Image modal viewer
|
|
76
|
+
- `Logotype` - Logo component
|
|
77
|
+
- `SortableList` - Drag-and-drop sortable list
|
|
78
|
+
- `ThemeIndicator` - Theme indicator
|
|
79
|
+
- `CommentsPanel` / `CommentComposer` - Comments system
|
|
80
|
+
- `PinModal` - Pin modal
|
|
81
|
+
- `PaymentSuccess` / `PaymentError` / `PaymentCancel` - Payment status pages
|
|
82
|
+
- `StorageUsageProgress` / `StorageUsageEntityList` - Storage components
|
|
83
|
+
- `LanguagePicker` - Language selector
|
|
84
|
+
- `FrontTable` - Table component
|
|
85
|
+
- `CommunitiesDialog` - Communities dialog
|
|
86
|
+
- `NotPublicPanel` - Not public panel
|
|
87
|
+
- `BottomDrawerWithoutHeader` - Bottom drawer
|
|
88
|
+
- `Copyright` - Copyright notice
|
|
89
|
+
- `EntityTitle` - Entity title
|
|
90
|
+
- `CircleColorPicker` - Circle color picker
|
|
91
|
+
- `FormViewer` - Form viewer
|
|
92
|
+
- `BouncingLogo` - Animated logo
|
|
93
|
+
- `CommentFilterMenu` - Comment filter
|
|
94
|
+
- `RemoveConfirmModal` - Confirmation modal
|
|
95
|
+
- `AppSidebarButton` - Sidebar button
|
|
96
|
+
- `NavMenu` - Navigation menu
|
|
97
|
+
- `EntityIcon` - Entity icon
|
|
98
|
+
|
|
99
|
+
### Helpers
|
|
100
|
+
|
|
101
|
+
- `showNotifications` - Show notifications
|
|
102
|
+
- `pickRandomEmoji` - Random emoji selector
|
|
103
|
+
- `themeUtils` - Theme utilities
|
|
104
|
+
- `combineStatuses` - Combine statuses
|
|
105
|
+
- `download` - Download helper
|
|
106
|
+
- `generateLink` - Link generator
|
|
107
|
+
- `feature` - Feature flags
|
|
108
|
+
- `fileUtils` - File utilities
|
|
109
|
+
- `formatBytes` - Format bytes
|
|
110
|
+
- `filterHierarchyByTypes` - Filter hierarchy
|
|
111
|
+
- `getRandomIconColor` - Random icon color
|
|
112
|
+
- `getFileIcons` - File icons
|
|
113
|
+
- `getFileType` - File type detection
|
|
114
|
+
- `getPartOfTheDay` - Time of day
|
|
115
|
+
- `isAppMode` - App mode detection
|
|
116
|
+
- `dates` - Date utilities
|
|
117
|
+
- `hotjar` - Hotjar integration
|
|
118
|
+
|
|
119
|
+
### Hooks
|
|
120
|
+
|
|
121
|
+
- `useMenu` - Menu hook
|
|
122
|
+
- `useDateFnsLocale` - Date-fns locale
|
|
123
|
+
- `useFormatDistance` - Format distance
|
|
124
|
+
- `useSwipeDetect` - Swipe detection
|
|
125
|
+
- `useOAuthErrorParams` - OAuth error params
|
|
126
|
+
- `useDateUtils` - Date utilities
|
|
127
|
+
- `useNumberQueryParam` - Number query param
|
|
128
|
+
- `useDisableWindowScroll` - Disable scroll
|
|
129
|
+
- `useAsyncStatus` - Async status
|
|
130
|
+
- `useAppContainer` - App container
|
|
131
|
+
- `useAppContainerStore` - App container store
|
|
132
|
+
- `useAppContainerDataStore` - App container data store
|
|
133
|
+
|
|
134
|
+
### Store
|
|
135
|
+
|
|
136
|
+
- `searchModal` - Search modal store
|
|
137
|
+
- `onboarding` - Onboarding store
|
|
138
|
+
- `workspacesOrder` - Workspaces order
|
|
139
|
+
- `timezoneStore` - Timezone store
|
|
140
|
+
- `plansModal` - Plans modal store
|
|
141
|
+
- `discordDialogStore` - Discord dialog store
|
|
142
|
+
- `accessOptionsControl` - Access options control
|
|
143
|
+
|
|
144
|
+
### Utils
|
|
145
|
+
|
|
146
|
+
- `formatStorage` - Format storage
|
|
147
|
+
- `getPlanBadgeColor` - Plan badge color
|
|
148
|
+
- `queryParams` - Query params utilities
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 🎨 Styling
|
|
153
|
+
|
|
154
|
+
### CSS Modules
|
|
155
|
+
|
|
156
|
+
This library uses **CSS Modules** for component styling. All styles are bundled into a single `index.css` file.
|
|
157
|
+
|
|
158
|
+
**Structure:**
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
dist/
|
|
162
|
+
├── index.css ← All styles (54 KB)
|
|
163
|
+
├── index.js ← JavaScript
|
|
164
|
+
└── components/
|
|
165
|
+
└── CustomKBD/
|
|
166
|
+
├── index.js
|
|
167
|
+
└── CustomKBD.module.css.js ← CSS classes mapping
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### How It Works
|
|
171
|
+
|
|
172
|
+
1. **Import styles once:**
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
import '@layers-app/shared/styles';
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
2. **All components automatically get correct CSS classes**
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
// Component uses CSS Modules internally
|
|
182
|
+
import styles from './CustomKBD.module.css';
|
|
183
|
+
<Box className={styles.root} /> // ✅ Scoped class applied
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
3. **No naming conflicts** - classes are scoped (e.g., `_root_195do_1`)
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## ⚙️ Peer Dependencies
|
|
191
|
+
|
|
192
|
+
Install these dependencies in your project:
|
|
193
|
+
|
|
194
|
+
### Required
|
|
195
|
+
|
|
196
|
+
```json
|
|
197
|
+
{
|
|
198
|
+
"react": "^18.3.1",
|
|
199
|
+
"react-dom": "^18.3.1",
|
|
200
|
+
"@mantine/core": "8.3.5",
|
|
201
|
+
"@mantine/hooks": "8.3.5",
|
|
202
|
+
"@mantine/form": "8.3.5",
|
|
203
|
+
"@mantine/modals": "8.3.5",
|
|
204
|
+
"@mantine/notifications": "8.3.5"
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Optional (based on usage)
|
|
209
|
+
|
|
210
|
+
```json
|
|
211
|
+
{
|
|
212
|
+
"@dnd-kit/core": "^6.0.0",
|
|
213
|
+
"@dnd-kit/sortable": "^8.0.0",
|
|
214
|
+
"@tabler/icons-react": "^3.7.0",
|
|
215
|
+
"framer-motion": "^11.3.24",
|
|
216
|
+
"date-fns": "^4.1.0",
|
|
217
|
+
"i18next": "^25.5.2",
|
|
218
|
+
"react-i18next": "^15.7.3",
|
|
219
|
+
"react-router-dom": "^7.5.2",
|
|
220
|
+
"zustand": "^5.0.3",
|
|
221
|
+
"@reduxjs/toolkit": "^2.2.7",
|
|
222
|
+
"@tanstack/react-query": "^5.52.2"
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Full list available in `package.json` `peerDependencies`.
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## 🔧 Configuration
|
|
231
|
+
|
|
232
|
+
### TypeScript
|
|
233
|
+
|
|
234
|
+
Types are included. No additional configuration needed.
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
import { CustomKBD } from '@layers-app/shared';
|
|
238
|
+
|
|
239
|
+
// ✅ Full TypeScript support
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Vite
|
|
243
|
+
|
|
244
|
+
```typescript
|
|
245
|
+
// vite.config.ts
|
|
246
|
+
export default defineConfig({
|
|
247
|
+
// No special configuration needed
|
|
248
|
+
// Styles are auto-loaded via import '@layers-app/shared/styles'
|
|
249
|
+
});
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Webpack
|
|
253
|
+
|
|
254
|
+
```javascript
|
|
255
|
+
// webpack.config.js
|
|
256
|
+
module.exports = {
|
|
257
|
+
module: {
|
|
258
|
+
rules: [
|
|
259
|
+
{
|
|
260
|
+
test: /\.css$/,
|
|
261
|
+
use: ['style-loader', 'css-loader'],
|
|
262
|
+
},
|
|
263
|
+
],
|
|
264
|
+
},
|
|
265
|
+
};
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## 📖 Usage Examples
|
|
271
|
+
|
|
272
|
+
### Using FilePicker
|
|
273
|
+
|
|
274
|
+
```typescript
|
|
275
|
+
import { FilePicker } from '@layers-app/shared';
|
|
276
|
+
|
|
277
|
+
function MyComponent() {
|
|
278
|
+
const handleFileSelect = (file: File) => {
|
|
279
|
+
console.log('Selected file:', file);
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
return (
|
|
283
|
+
<FilePicker
|
|
284
|
+
onSelect={handleFileSelect}
|
|
285
|
+
accept="image/*"
|
|
286
|
+
maxSize={5 * 1024 * 1024} // 5MB
|
|
287
|
+
/>
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Using EmojiPicker
|
|
293
|
+
|
|
294
|
+
```typescript
|
|
295
|
+
import { EmojiPicker } from '@layers-app/shared';
|
|
296
|
+
|
|
297
|
+
function MyComponent() {
|
|
298
|
+
const handleEmojiSelect = (emoji: string) => {
|
|
299
|
+
console.log('Selected emoji:', emoji);
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
return (
|
|
303
|
+
<EmojiPicker
|
|
304
|
+
onSelect={handleEmojiSelect}
|
|
305
|
+
position="bottom-start"
|
|
306
|
+
/>
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### Using SearchFilters
|
|
312
|
+
|
|
313
|
+
```typescript
|
|
314
|
+
import { SearchFilters } from '@layers-app/shared';
|
|
315
|
+
|
|
316
|
+
function MyComponent() {
|
|
317
|
+
const [filters, setFilters] = useState({});
|
|
318
|
+
|
|
319
|
+
return (
|
|
320
|
+
<SearchFilters
|
|
321
|
+
value={filters}
|
|
322
|
+
onChange={setFilters}
|
|
323
|
+
fields={[
|
|
324
|
+
{ name: 'status', type: 'select', options: [...] },
|
|
325
|
+
{ name: 'date', type: 'date' },
|
|
326
|
+
]}
|
|
327
|
+
/>
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### Using SortableList
|
|
333
|
+
|
|
334
|
+
```typescript
|
|
335
|
+
import { SortableList } from '@layers-app/shared';
|
|
336
|
+
|
|
337
|
+
function MyComponent() {
|
|
338
|
+
const [items, setItems] = useState([...]);
|
|
339
|
+
|
|
340
|
+
return (
|
|
341
|
+
<SortableList
|
|
342
|
+
items={items}
|
|
343
|
+
onReorder={setItems}
|
|
344
|
+
renderItem={(item) => <div>{item.name}</div>}
|
|
345
|
+
/>
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## 🏗️ Build Information
|
|
353
|
+
|
|
354
|
+
### Output Structure
|
|
355
|
+
|
|
356
|
+
```
|
|
357
|
+
dist/
|
|
358
|
+
├── index.js # Main entry point (ESM)
|
|
359
|
+
├── index.d.ts # TypeScript types
|
|
360
|
+
├── index.css # All styles (54 KB)
|
|
361
|
+
├── components/ # Component modules
|
|
362
|
+
├── hooks/ # Hooks modules
|
|
363
|
+
├── helpers/ # Helper modules
|
|
364
|
+
└── assets/ # Asset files
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### Bundle Characteristics
|
|
368
|
+
|
|
369
|
+
- **Format:** ESM only
|
|
370
|
+
- **Tree-shaking:** Full support
|
|
371
|
+
- **CSS:** Scoped CSS Modules
|
|
372
|
+
- **TypeScript:** Full type definitions
|
|
373
|
+
- **Size:** ~457 KB total (400 KB JS + 54 KB CSS + 3 KB CSS mappings)
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
377
|
+
## 🔍 Advanced Usage
|
|
378
|
+
|
|
379
|
+
### Accessing Individual CSS
|
|
380
|
+
|
|
381
|
+
If you need specific component styles:
|
|
382
|
+
|
|
383
|
+
```typescript
|
|
384
|
+
// Import individual component CSS (rarely needed)
|
|
385
|
+
import '@layers-app/shared/dist/components/CustomKBD/CustomKBD.module.css.js';
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### Using Assets
|
|
389
|
+
|
|
390
|
+
```typescript
|
|
391
|
+
// Access assets directly
|
|
392
|
+
import logo from '@layers-app/shared/assets/logo.svg';
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### Custom Theme
|
|
396
|
+
|
|
397
|
+
```typescript
|
|
398
|
+
// Apply Mantine theme
|
|
399
|
+
import { MantineProvider } from '@mantine/core';
|
|
400
|
+
|
|
401
|
+
function App() {
|
|
402
|
+
return (
|
|
403
|
+
<MantineProvider theme={{ /* your theme */ }}>
|
|
404
|
+
{/* Your app */}
|
|
405
|
+
</MantineProvider>
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
## 📊 Performance
|
|
413
|
+
|
|
414
|
+
### Optimization Tips
|
|
415
|
+
|
|
416
|
+
1. **Import only what you need:**
|
|
417
|
+
|
|
418
|
+
```typescript
|
|
419
|
+
// ✅ Good - tree-shaking works
|
|
420
|
+
import { CustomKBD } from '@layers-app/shared';
|
|
421
|
+
// ❌ Bad - imports everything
|
|
422
|
+
import * as Shared from '@layers-app/shared';
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
2. **Styles are loaded once:**
|
|
426
|
+
|
|
427
|
+
```typescript
|
|
428
|
+
// Import in main.tsx only
|
|
429
|
+
import '@layers-app/shared/styles';
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
3. **Use lazy loading for heavy components:**
|
|
433
|
+
```typescript
|
|
434
|
+
const FormViewer = lazy(() =>
|
|
435
|
+
import('@layers-app/shared').then((m) => ({ default: m.FormViewer })),
|
|
436
|
+
);
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
---
|
|
440
|
+
|
|
441
|
+
## 🐛 Troubleshooting
|
|
442
|
+
|
|
443
|
+
### Styles not applied
|
|
444
|
+
|
|
445
|
+
**Solution:** Ensure you imported styles:
|
|
446
|
+
|
|
447
|
+
```typescript
|
|
448
|
+
import '@layers-app/shared/styles';
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### TypeScript errors
|
|
452
|
+
|
|
453
|
+
**Solution:** Check peer dependencies are installed:
|
|
454
|
+
|
|
455
|
+
```bash
|
|
456
|
+
npm install react react-dom @mantine/core @mantine/hooks
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
### Build errors
|
|
460
|
+
|
|
461
|
+
**Solution:** Ensure you're using ESM-compatible bundler (Vite, Webpack 5+, etc.)
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
## 📝 Notes
|
|
466
|
+
|
|
467
|
+
### CSS Modules Explained
|
|
468
|
+
|
|
469
|
+
Files like `CustomKBD.module.css.js` are **JavaScript mappings** for CSS Modules:
|
|
470
|
+
|
|
471
|
+
```javascript
|
|
472
|
+
// CustomKBD.module.css.js
|
|
473
|
+
export default { root: '_root_195do_1' };
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
**This is correct behavior!** Actual styles are in `index.css`.
|
|
477
|
+
|
|
478
|
+
### Internal vs External Packages
|
|
479
|
+
|
|
480
|
+
- All `@layers-app/*` packages are internal monorepo packages
|
|
481
|
+
- External dependencies should be managed through package.json
|
|
482
|
+
|
|
483
|
+
---
|
|
484
|
+
|
|
485
|
+
## 🔗 Links
|
|
486
|
+
|
|
487
|
+
- **Repository:** [GitHub](https://github.com/yourusername/layers)
|
|
488
|
+
- **Issues:** [Report a bug](https://github.com/yourusername/layers/issues)
|
|
489
|
+
- **Documentation:** See `/docs` folder
|
|
490
|
+
|
|
491
|
+
---
|
|
492
|
+
|
|
493
|
+
## 📄 License
|
|
494
|
+
|
|
495
|
+
See LICENSE file in the repository.
|
|
496
|
+
|
|
497
|
+
---
|
|
498
|
+
|
|
499
|
+
**Made with ❤️ by the Layers team**
|