@easyteam/auto-scheduler-modal-ui 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.txt +3 -0
- package/README.md +87 -0
- package/dist/index.cjs +2543 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +432 -0
- package/dist/index.d.ts +432 -0
- package/dist/index.js +2534 -0
- package/dist/index.js.map +1 -0
- package/package.json +82 -0
package/LICENSE.txt
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# @easyteam/auto-scheduler-modal-ui
|
|
2
|
+
|
|
3
|
+
Standalone React modal component for configuring auto-scheduler options.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# npm
|
|
9
|
+
npm i @easyteam/auto-scheduler-modal-ui
|
|
10
|
+
|
|
11
|
+
# yarn
|
|
12
|
+
yarn add @easyteam/auto-scheduler-modal-ui
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { AutoSchedulerModalWithProvider } from "@easyteam/auto-scheduler-modal-ui";
|
|
19
|
+
|
|
20
|
+
const jurisdictions = [
|
|
21
|
+
{
|
|
22
|
+
id: "paga",
|
|
23
|
+
title: "California (PAGA)",
|
|
24
|
+
locations: [
|
|
25
|
+
{ id: "sf-hq", name: "San Francisco HQ" },
|
|
26
|
+
{ id: "oakland", name: "Oakland Warehouse" },
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: "nyll",
|
|
31
|
+
title: "New York (NYLL)",
|
|
32
|
+
locations: [
|
|
33
|
+
{ id: "brooklyn", name: "Brooklyn Office" },
|
|
34
|
+
{ id: "manhattan", name: "Manhattan Store" },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
const themeOverride = {
|
|
40
|
+
tokens: {
|
|
41
|
+
colors: {
|
|
42
|
+
brand: {
|
|
43
|
+
500: "#303030",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
autoSchedulerModal: {
|
|
48
|
+
banner: { bg: "#f2f9f6" },
|
|
49
|
+
primaryButton: { bg: "#1f2937" },
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
<AutoSchedulerModalWithProvider
|
|
54
|
+
isOpen={isOpen}
|
|
55
|
+
onClose={() => setOpen(false)}
|
|
56
|
+
title="Auto-scheduling"
|
|
57
|
+
jurisdictions={jurisdictions}
|
|
58
|
+
selectedLocationIds={selectedLocationIds}
|
|
59
|
+
onSelectedLocationIdsChange={setSelectedLocationIds}
|
|
60
|
+
theme={themeOverride}
|
|
61
|
+
/>;
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`AutoSchedulerModalWithProvider` bundles its own `ChakraProvider`, so you don't need to wrap it yourself. This avoids "Cannot read properties of null (reading 'useContext')" errors that can occur when the host app has multiple React instances (e.g. local packages in Next.js).
|
|
65
|
+
|
|
66
|
+
If your app already provides a `ChakraProvider`, you can use the bare `AutoSchedulerModal` import instead.
|
|
67
|
+
|
|
68
|
+
## Props
|
|
69
|
+
|
|
70
|
+
The component is fully controlled and exposes typed props for:
|
|
71
|
+
|
|
72
|
+
- modal open/close
|
|
73
|
+
- jurisdictions + selected locations
|
|
74
|
+
- primary/cancel labels
|
|
75
|
+
- optional theme overrides
|
|
76
|
+
- hard constraints dropdown with internal numeric inputs
|
|
77
|
+
|
|
78
|
+
### Theme prop
|
|
79
|
+
|
|
80
|
+
The `theme` prop accepts either:
|
|
81
|
+
|
|
82
|
+
- EasyTeam-style overrides: `{ tokens?: { colors?: ... }, ...componentOverrides }`
|
|
83
|
+
- Chakra v2 `ThemeOverride`
|
|
84
|
+
|
|
85
|
+
When provided, the component merges the override into the active Chakra theme and wraps itself in a nested `ChakraProvider` to scope the overrides.
|
|
86
|
+
|
|
87
|
+
See `AutoSchedulerModalProps` for full type definitions.
|