fermmap-shared 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +180 -0
- package/dist/main.cjs +2907 -0
- package/dist/main.cjs.map +1 -0
- package/dist/main.css +1388 -0
- package/dist/main.css.map +1 -0
- package/dist/module.css +1388 -0
- package/dist/module.css.map +1 -0
- package/dist/module.mjs +2899 -0
- package/dist/module.mjs.map +1 -0
- package/dist/types.d.ts +693 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +73 -0
- package/src/components/Checkbox.css +22 -0
- package/src/components/DisclosureGroup.css +37 -0
- package/src/components/ProgressBar.css +18 -0
- package/src/styles/variables.css +77 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 FermMap
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# @fermmap/shared
|
|
2
|
+
|
|
3
|
+
**Public (private)** deploy of FermMap-specific React components built using [React Aria Components](https://react-spectrum.adobe.com/react-aria/) and [React Spectrum S2 style-macros](https://react-spectrum.adobe.com/beta/s2/styling.html).
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This package contains a collection of accessible, themeable React components designed for the FermMap application. All components are built on top of React Aria Components for accessibility and use React Spectrum S2 style-macros for consistent, type-safe styling.
|
|
8
|
+
|
|
9
|
+
## Publishing to npm
|
|
10
|
+
|
|
11
|
+
### Prerequisites
|
|
12
|
+
- npm account with publishing rights
|
|
13
|
+
- Logged in via `npm login`
|
|
14
|
+
- **Granular Access Token**: For automated publishing, you'll need a granular access token with publish permissions
|
|
15
|
+
|
|
16
|
+
### Before Publishing
|
|
17
|
+
|
|
18
|
+
1. **Update version** in `package.json`:
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"version": "0.2.0" // Increment appropriately
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
2. **Set package to public** (if first time publishing):
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"private": false // Change from true
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
3. **Update repository URL** in `package.json`:
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/your-actual-username/fermmap.git",
|
|
38
|
+
"directory": "packages/shared"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Publishing
|
|
44
|
+
|
|
45
|
+
The package uses **Parcel** to build optimized CommonJS and ESM bundles with CSS extracted from style macros.
|
|
46
|
+
|
|
47
|
+
To publish:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Build and publish (prepublishOnly script runs automatically)
|
|
51
|
+
npm publish
|
|
52
|
+
|
|
53
|
+
# Or manually:
|
|
54
|
+
yarn build
|
|
55
|
+
npm publish
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The `prepublishOnly` script automatically cleans and builds before publishing.
|
|
59
|
+
|
|
60
|
+
### Important Notes
|
|
61
|
+
|
|
62
|
+
- **Build Process**: Uses Parcel to compile TypeScript and extract/optimize CSS from S2 style-macros
|
|
63
|
+
- **Output**: CommonJS (`dist/main.cjs`), ESM (`dist/module.mjs`), TypeScript types (`dist/types.d.ts`), and optimized CSS
|
|
64
|
+
- **CSS Files**: Style macro CSS is automatically extracted and optimized during build
|
|
65
|
+
- **Granular Token**: For CI/CD, create a granular access token at https://www.npmjs.com/settings/YOUR-USERNAME/tokens
|
|
66
|
+
- **Peer Dependencies**: Consuming apps must install:
|
|
67
|
+
- `react` ^18.2.0
|
|
68
|
+
- `react-dom` ^18.2.0
|
|
69
|
+
- `react-aria-components` ^1.13.0
|
|
70
|
+
- `@react-spectrum/s2` ^0.12.0
|
|
71
|
+
- `react-intl` ^6.0.0
|
|
72
|
+
- `next` ^14.0.0 (optional, only for SegmentedControl)
|
|
73
|
+
- `@axe-core/react` ^4.0.0 (optional, only for dev tools)
|
|
74
|
+
|
|
75
|
+
## Installation
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npm install @fermmap/shared
|
|
79
|
+
# or
|
|
80
|
+
yarn add @fermmap/shared
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Importing Components
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
import { Button, TextField, Table } from '@fermmap/shared';
|
|
87
|
+
import type { ColumnDef } from '@fermmap/shared';
|
|
88
|
+
|
|
89
|
+
// CSS is imported automatically from the built bundle
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Available Components
|
|
93
|
+
|
|
94
|
+
### UI Components
|
|
95
|
+
- `AlertDialog`, `PromptDialog` - Accessible dialogs
|
|
96
|
+
- `Autocomplete`, `AutocompleteTable` - Searchable inputs
|
|
97
|
+
- `Badge` - Status and category badges
|
|
98
|
+
- `Button`, `CloseButton` - Button components
|
|
99
|
+
- `Checkbox`, `RadioGroup`, `Switch` - Form inputs
|
|
100
|
+
- `ComboBox`, `Select` - Dropdown inputs
|
|
101
|
+
- `DisclosureGroup` - Expandable panels
|
|
102
|
+
- `FilterTabs` - Tab-style filters with counts
|
|
103
|
+
- `LabeledValue`, `StatCard` - Data display
|
|
104
|
+
- `Link` - Styled links
|
|
105
|
+
- `ProgressBar` - Progress indicators
|
|
106
|
+
- `SearchField` - Search inputs
|
|
107
|
+
- `SegmentedControl` - iOS-style segmented control
|
|
108
|
+
- `Table` - Data tables with sorting/selection
|
|
109
|
+
- `Tabs`, `TabList`, `Tab`, `TabPanel` - Tabbed interfaces
|
|
110
|
+
- `TextArea`, `TextField` - Text inputs
|
|
111
|
+
|
|
112
|
+
### Hooks & Utilities
|
|
113
|
+
- Custom hooks for common patterns
|
|
114
|
+
- Shared utility functions
|
|
115
|
+
- Style utilities
|
|
116
|
+
|
|
117
|
+
## Usage
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
import { Button, TextField, Table } from '@fermmap/shared';
|
|
121
|
+
import type { ColumnDef } from '@fermmap/shared';
|
|
122
|
+
|
|
123
|
+
function MyComponent() {
|
|
124
|
+
return (
|
|
125
|
+
<div>
|
|
126
|
+
<TextField
|
|
127
|
+
label="Name"
|
|
128
|
+
value={name}
|
|
129
|
+
onChange={setName}
|
|
130
|
+
/>
|
|
131
|
+
<Button onPress={handleSubmit}>
|
|
132
|
+
Submit
|
|
133
|
+
</Button>
|
|
134
|
+
</div>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Importing Styles
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
import '@fermmap/shared/styles/variables.css';
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Development
|
|
146
|
+
|
|
147
|
+
### Building
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
yarn build
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
This uses Parcel to build the package, generating both CommonJS and ESM outputs with TypeScript definitions.
|
|
154
|
+
|
|
155
|
+
### Publishing
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# Update version in package.json first
|
|
159
|
+
yarn publish
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The `prepublishOnly` script will automatically clean and build the package before publishing.
|
|
163
|
+
|
|
164
|
+
## Features
|
|
165
|
+
|
|
166
|
+
- ✅ Fully accessible components (WCAG 2.0 AA)
|
|
167
|
+
- ✅ Dark mode support via React Spectrum S2 tokens
|
|
168
|
+
- ✅ Type-safe with TypeScript
|
|
169
|
+
- ✅ Tree-shakeable ESM builds
|
|
170
|
+
- ✅ Consistent styling with S2 style-macros
|
|
171
|
+
- ✅ Responsive and mobile-friendly
|
|
172
|
+
- ✅ RTL (Right-to-Left) language support
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
|
|
176
|
+
MIT
|
|
177
|
+
|
|
178
|
+
## Contributing
|
|
179
|
+
|
|
180
|
+
This is a private package for the FermMap project. For internal use only.
|