nitro-web 0.3.1 → 0.3.3
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/client/index.ts +6 -2
- package/client/use-fetch.ts +164 -0
- package/components/auth/auth.api.js +10 -1
- package/components/partials/element/content-wrapper.tsx +52 -0
- package/components/partials/element/form-modal.tsx +154 -0
- package/components/partials/element/image-drop.tsx +2 -2
- package/components/partials/element/pagination.tsx +61 -0
- package/components/partials/element/sidebar.tsx +30 -27
- package/components/partials/element/tooltip.tsx +157 -145
- package/components/partials/form/drop.tsx +4 -4
- package/package.json +2 -2
- package/server/email/invite-user.html +2 -2
- package/server/models/user.js +1 -1
- package/tsconfig.json +0 -1
- package/types/components/auth/auth.api.d.ts +6 -0
- package/types/components/auth/auth.api.d.ts.map +1 -1
- package/types/globals.d.ts +3 -0
- package/types/util.d.ts +24 -20
- package/types/util.d.ts.map +1 -1
- package/types.ts +16 -2
- package/util.js +45 -16
|
@@ -1,154 +1,166 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import { useEffect, useLayoutEffect, useRef, useState } from 'react'
|
|
2
|
+
import { twMerge } from 'nitro-web'
|
|
3
|
+
import { Info } from 'lucide-react'
|
|
3
4
|
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
type Side = 'top' | 'bottom' | 'left' | 'right'
|
|
6
|
+
type IconProps = { size?: number; className?: string; tabIndex?: number; onClick?: () => void }
|
|
7
|
+
|
|
8
|
+
// Position the bubble relative to the trigger (spacing adds the gap)
|
|
9
|
+
const pos = {
|
|
10
|
+
top: 'bottom-full left-1/2 -translate-x-1/2',
|
|
11
|
+
bottom: 'top-full left-1/2 -translate-x-1/2',
|
|
12
|
+
left: 'right-full top-1/2 -translate-y-1/2',
|
|
13
|
+
right: 'left-full top-1/2 -translate-y-1/2',
|
|
10
14
|
}
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
{
|
|
16
|
-
text
|
|
17
|
-
? <>
|
|
18
|
-
<div class="tooltip-trigger ">{children}</div>
|
|
19
|
-
<div class={`tooltip-popup ${classNamePopup||''} ${isSmall ? 'is-small' : ''}`}>{text}</div>
|
|
20
|
-
</>
|
|
21
|
-
: children
|
|
22
|
-
}
|
|
23
|
-
</div>
|
|
24
|
-
)
|
|
16
|
+
const opposite: Record<Side, Side> = { top: 'bottom', bottom: 'top', left: 'right', right: 'left' }
|
|
17
|
+
const perp: Record<Side, Side[]> = {
|
|
18
|
+
top: ['right', 'left'], bottom: ['right', 'left'], left: ['bottom', 'top'], right: ['bottom', 'top'],
|
|
25
19
|
}
|
|
26
20
|
|
|
27
|
-
|
|
28
|
-
.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
left: 50%;
|
|
85
|
-
transform: translateX(-50%) translateY(15px) ;
|
|
86
|
-
&:after {
|
|
87
|
-
bottom: 100%;
|
|
88
|
-
left: 50%;
|
|
89
|
-
margin-left: -6px;
|
|
90
|
-
border-color: transparent transparent black transparent;
|
|
91
|
-
}
|
|
92
|
-
&.is-bottom-left {
|
|
93
|
-
left: 0px;
|
|
94
|
-
transform: translateX(0%) translateY(15px);
|
|
95
|
-
&:after {
|
|
96
|
-
left: 28px;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
&.is-left {
|
|
101
|
-
top: 50%;
|
|
102
|
-
right: 100%;
|
|
103
|
-
transform: translateX(-15px) translateY(-50%);
|
|
104
|
-
&:after {
|
|
105
|
-
top: 50%;
|
|
106
|
-
right: -12px;
|
|
107
|
-
margin-top: -6px;
|
|
108
|
-
border-color: transparent transparent transparent black;
|
|
109
|
-
}
|
|
21
|
+
export type TooltipProps = {
|
|
22
|
+
content: React.ReactNode
|
|
23
|
+
/** let the mouse move onto the bubble without closing */
|
|
24
|
+
contentHoverable?: boolean
|
|
25
|
+
children?: React.ReactNode
|
|
26
|
+
className?: string
|
|
27
|
+
/** trigger used when no children, click pins it open */
|
|
28
|
+
DefaultIcon?: React.ComponentType<IconProps>
|
|
29
|
+
/** px the invisible trigger area extends past the icon/children */
|
|
30
|
+
hitbox?: number
|
|
31
|
+
/** class for the default icon, e.g. to change its colour */
|
|
32
|
+
iconClassName?: string
|
|
33
|
+
maxWidth?: number
|
|
34
|
+
/** force open, ignoring hover/focus */
|
|
35
|
+
open?: boolean
|
|
36
|
+
side?: Side
|
|
37
|
+
/** px gap between trigger and bubble */
|
|
38
|
+
spacing?: number
|
|
39
|
+
// Anything else lands on the wrapper, so a parent like Dropdown can attach its handlers to a wrapped trigger
|
|
40
|
+
} & Omit<React.HTMLAttributes<HTMLSpanElement>, 'content' | 'className' | 'children'>
|
|
41
|
+
|
|
42
|
+
// Hover/focus tooltip that flips to the side with room, and stays placed while scrolling
|
|
43
|
+
export function Tooltip({
|
|
44
|
+
content, contentHoverable, hitbox = 5, DefaultIcon = Info, maxWidth = 245, open, side = 'top', spacing = 6, className, iconClassName,
|
|
45
|
+
children,
|
|
46
|
+
...rest
|
|
47
|
+
}: TooltipProps) {
|
|
48
|
+
const [hover, setHover] = useState(false)
|
|
49
|
+
const [pinned, setPinned] = useState(false) // kept open by clicking the default icon
|
|
50
|
+
const [actualSide, setActualSide] = useState(side)
|
|
51
|
+
const wrapRef = useRef<HTMLSpanElement>(null)
|
|
52
|
+
const bubbleRef = useRef<HTMLSpanElement>(null)
|
|
53
|
+
const closeTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)
|
|
54
|
+
const isOpen = open ?? (pinned || hover)
|
|
55
|
+
const gap = {
|
|
56
|
+
top: { marginBottom: spacing },
|
|
57
|
+
bottom: { marginTop: spacing },
|
|
58
|
+
left: { marginRight: spacing },
|
|
59
|
+
right: { marginLeft: spacing },
|
|
60
|
+
}[actualSide]
|
|
61
|
+
|
|
62
|
+
useEffect(() => () => clearTimeout(closeTimer.current), [])
|
|
63
|
+
|
|
64
|
+
// Close the pinned tooltip when clicking outside the component
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (!pinned) return
|
|
67
|
+
const onDown = (e: MouseEvent) => { if (!wrapRef.current?.contains(e.target as Node)) setPinned(false) }
|
|
68
|
+
addEventListener('mousedown', onDown)
|
|
69
|
+
return () => removeEventListener('mousedown', onDown)
|
|
70
|
+
}, [pinned])
|
|
71
|
+
|
|
72
|
+
// Place on show, and keep placed while scrolling/resizing
|
|
73
|
+
useLayoutEffect(() => {
|
|
74
|
+
if (!isOpen) return
|
|
75
|
+
const place = () => {
|
|
76
|
+
const wrap = wrapRef.current, bubble = bubbleRef.current
|
|
77
|
+
if (wrap && bubble) setActualSide(pick(side, spacing, wrap.getBoundingClientRect(), bubble.getBoundingClientRect(), getClip(wrap)))
|
|
110
78
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
79
|
+
place()
|
|
80
|
+
// rAF throttle so each open tooltip only reflows once per frame while scrolling
|
|
81
|
+
let raf = 0
|
|
82
|
+
const onMove = () => { cancelAnimationFrame(raf); raf = requestAnimationFrame(place) }
|
|
83
|
+
addEventListener('scroll', onMove, true)
|
|
84
|
+
addEventListener('resize', onMove)
|
|
85
|
+
return () => {
|
|
86
|
+
cancelAnimationFrame(raf)
|
|
87
|
+
removeEventListener('scroll', onMove, true)
|
|
88
|
+
removeEventListener('resize', onMove)
|
|
121
89
|
}
|
|
90
|
+
}, [isOpen, side, spacing])
|
|
91
|
+
|
|
92
|
+
// Hover handlers; when contentHoverable, delay close so the mouse can cross the gap onto the bubble.
|
|
93
|
+
// Hover is tracked even while `open` controls the bubble, so handing control back doesn't restore a stale hover
|
|
94
|
+
const show = () => { clearTimeout(closeTimer.current); setHover(true) }
|
|
95
|
+
const hide = () => {
|
|
96
|
+
if (contentHoverable) closeTimer.current = setTimeout(() => setHover(false), 100)
|
|
97
|
+
else setHover(false)
|
|
122
98
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<span
|
|
102
|
+
{...rest}
|
|
103
|
+
ref={wrapRef}
|
|
104
|
+
className="relative inline-flex nitro-tooltip"
|
|
105
|
+
onMouseEnter={show}
|
|
106
|
+
onMouseLeave={hide}
|
|
107
|
+
onFocus={show}
|
|
108
|
+
onBlur={hide}
|
|
109
|
+
>
|
|
110
|
+
{/* invisible hitbox so the trigger is easier to hover/click */}
|
|
111
|
+
<span
|
|
112
|
+
aria-hidden
|
|
113
|
+
style={{ inset: -hitbox }}
|
|
114
|
+
className={`absolute ${children ? '' : 'cursor-help'}`}
|
|
115
|
+
onClick={children ? undefined : () => setPinned(p => !p)}
|
|
116
|
+
/>
|
|
117
|
+
{children ?? (
|
|
118
|
+
<DefaultIcon
|
|
119
|
+
size={14}
|
|
120
|
+
tabIndex={0}
|
|
121
|
+
className={twMerge('cursor-help outline-none', pinned ? 'text-primary' : 'text-[#9A9A9A]', iconClassName)}
|
|
122
|
+
onClick={() => setPinned(p => !p)}
|
|
123
|
+
/>
|
|
124
|
+
)}
|
|
125
|
+
{isOpen && (
|
|
126
|
+
<span
|
|
127
|
+
ref={bubbleRef}
|
|
128
|
+
role="tooltip"
|
|
129
|
+
style={{ maxWidth, ...gap }}
|
|
130
|
+
className={twMerge(
|
|
131
|
+
'absolute z-50 w-max px-4 py-3 rounded-lg bg-black text-white text-xs font-medium shadow-md',
|
|
132
|
+
// interactive when pinned or hoverable so links/text/hover work, else click-through
|
|
133
|
+
pinned || contentHoverable ? 'pointer-events-auto' : 'pointer-events-none',
|
|
134
|
+
pos[actualSide],
|
|
135
|
+
className
|
|
136
|
+
)}
|
|
137
|
+
>
|
|
138
|
+
{content}
|
|
139
|
+
</span>
|
|
140
|
+
)}
|
|
141
|
+
</span>
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Tightest clipping bounds: viewport intersected with scrollable/clipped ancestors
|
|
146
|
+
function getClip(el: HTMLElement) {
|
|
147
|
+
const clip = { left: 0, top: 0, right: innerWidth, bottom: innerHeight }
|
|
148
|
+
for (let p = el.parentElement; p; p = p.parentElement) {
|
|
149
|
+
const s = getComputedStyle(p)
|
|
150
|
+
if (!/auto|scroll|hidden|clip/.test(s.overflow + s.overflowX + s.overflowY)) continue
|
|
151
|
+
const r = p.getBoundingClientRect()
|
|
152
|
+
clip.left = Math.max(clip.left, r.left)
|
|
153
|
+
clip.top = Math.max(clip.top, r.top)
|
|
154
|
+
clip.right = Math.min(clip.right, r.right)
|
|
155
|
+
clip.bottom = Math.min(clip.bottom, r.bottom)
|
|
153
156
|
}
|
|
154
|
-
|
|
157
|
+
return clip
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Pick the first side that fits within clip, else the one with the most spare space
|
|
161
|
+
function pick(side: Side, gap: number, t: DOMRect, b: DOMRect, clip: ReturnType<typeof getClip>): Side {
|
|
162
|
+
const space = { top: t.top - clip.top, bottom: clip.bottom - t.bottom, left: t.left - clip.left, right: clip.right - t.right }
|
|
163
|
+
const need = { top: b.height + gap, bottom: b.height + gap, left: b.width + gap, right: b.width + gap }
|
|
164
|
+
const order: Side[] = [side, opposite[side], ...perp[side]]
|
|
165
|
+
return order.find(s => space[s] >= need[s]) || order.sort((a, c) => (space[c] - need[c]) - (space[a] - need[a]))[0]
|
|
166
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { deepFind, s3Image, getErrorFromState } from 'nitro-web/util'
|
|
3
3
|
import { DropHandler } from 'nitro-web'
|
|
4
4
|
import noImage from 'nitro-web/client/imgs/no-image.svg'
|
|
5
|
-
import { Errors,
|
|
5
|
+
import { Errors, MonasteryFile } from 'nitro-web/types'
|
|
6
6
|
import { twMerge } from 'nitro-web/util'
|
|
7
7
|
|
|
8
8
|
type DropProps = {
|
|
@@ -27,7 +27,7 @@ type DropProps = {
|
|
|
27
27
|
[key: string]: unknown
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
type Image = File | FileList |
|
|
30
|
+
type Image = File | FileList | MonasteryFile | null
|
|
31
31
|
|
|
32
32
|
export function Drop({ awsUrl, className, id, name, onChange, multiple, state, errorTitle, ...props }: DropProps) {
|
|
33
33
|
if (!name) throw new Error('Drop component requires a `name` prop')
|
|
@@ -44,7 +44,7 @@ export function Drop({ awsUrl, className, id, name, onChange, multiple, state, e
|
|
|
44
44
|
if (typeof value == 'undefined') value = null
|
|
45
45
|
|
|
46
46
|
useEffect(() => {
|
|
47
|
-
(async () => setUrls(await getUrls(value as File | FileList |
|
|
47
|
+
(async () => setUrls(await getUrls(value as File | FileList | MonasteryFile | null)))()
|
|
48
48
|
}, [value])
|
|
49
49
|
|
|
50
50
|
function tryAgain (e: { preventDefault: Function }) {
|
|
@@ -68,7 +68,7 @@ export function Drop({ awsUrl, className, id, name, onChange, multiple, state, e
|
|
|
68
68
|
if (onChange) onChange({ target: { name: name, value: multiple ? files : files[0] } })
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
async function getUrls(objectOrFileListItem: File | FileList |
|
|
71
|
+
async function getUrls(objectOrFileListItem: File | FileList | MonasteryFile | null) {
|
|
72
72
|
/**
|
|
73
73
|
* @param {object|FileList} objectOrFileListItem - FileList object or monastery image object
|
|
74
74
|
* @returns {Promise} - Resolves to an array of image URLs
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitro-web",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"repository": "github:boycce/nitro-web",
|
|
5
5
|
"homepage": "https://boycce.github.io/nitro-web/",
|
|
6
6
|
"description": "Nitro is a battle-tested, modular base project to turbocharge your projects, styled using Tailwind 🚀",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"@stripe/stripe-js": "^1.34.0",
|
|
68
|
-
"monastery": "^5.0.
|
|
68
|
+
"monastery": "^5.0.1",
|
|
69
69
|
"stripe": "^9.16.0"
|
|
70
70
|
},
|
|
71
71
|
"_peers-are-packages-that-will-be-used-in-the-host-repo-too": "",
|
|
@@ -12,10 +12,10 @@ todo: change naming to:
|
|
|
12
12
|
<!-- block content is the content of the email -->
|
|
13
13
|
{% block content %}
|
|
14
14
|
|
|
15
|
-
[[ subject = You've been invited to join
|
|
15
|
+
[[ subject = You've been invited to join %recipient.companyName% ]]
|
|
16
16
|
<b>%recipient.greet%</b>,<br/>
|
|
17
17
|
<br/>
|
|
18
|
-
You've been invited to join <b>%recipient.
|
|
18
|
+
You've been invited to join <b>%recipient.companyName%</b>.<br/>
|
|
19
19
|
<br/>
|
|
20
20
|
If you didn't expect to receive this email, feel free to disregard this email.<br/>
|
|
21
21
|
<br/>
|
package/server/models/user.js
CHANGED
|
@@ -4,7 +4,7 @@ import { ucFirst, fullName } from 'nitro-web/util'
|
|
|
4
4
|
export default {
|
|
5
5
|
|
|
6
6
|
fields: {
|
|
7
|
-
avatar: { type: '
|
|
7
|
+
avatar: { type: 'file' },
|
|
8
8
|
company: { model: 'company', required: true }, // AKA "active company"
|
|
9
9
|
email: { type: 'email', required: true, index: 'unique' },
|
|
10
10
|
isAdmin: { type: 'boolean', default: false },
|
package/tsconfig.json
CHANGED
|
@@ -14,6 +14,12 @@ export function userSigninGetStore(user: any, isDesktop: any): Promise<{
|
|
|
14
14
|
export function getStore(user: any, _req: any): Promise<{
|
|
15
15
|
user: any;
|
|
16
16
|
}>;
|
|
17
|
+
/**
|
|
18
|
+
* The user's role in their active company (expects user.company to be populated)
|
|
19
|
+
* @param {object} user
|
|
20
|
+
* @returns {string|undefined}
|
|
21
|
+
*/
|
|
22
|
+
export function getCompanyRole(user: object): string | undefined;
|
|
17
23
|
/**
|
|
18
24
|
* Creates a new user and company (if multi tenant and `user.company` is not an id)
|
|
19
25
|
* @param {object} userData - user data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.api.d.ts","sourceRoot":"","sources":["../../../components/auth/auth.api.js"],"names":[],"mappings":"AAqLA,qEAUC;AAED,qEAwEC;AAED,qEAGC;AAED,gEAMC;AAED,iEAgBC;AAED,oEAGC;AAED,oEA8BC;AAED,gEAgCC;AAID,qGAkDC;AAED;;;GAOC;AAED;;GAKC;AAID;;;;;;;;;GASG;AACH,8EAPG;IAA0B,QAAQ,GAA1B,MAAM;IACY,SAAS,GAA3B,MAAM;IACY,OAAO,GAAzB,MAAM;CACd,YAAQ,MAAM,+BACN,OAAO,GACL,OAAO,CAAC,MAAM,CAAC,CAqE3B;AAED,kFAiBC;AAED,mEAOC;AAED,+EAWC;AAED,sHAiBC;AAED;;;GAEC;AAED;;;GA0BC;AAED;;;;;;;;;GAmCC;AAED;;;;;;;;;;;;;;GAcG;AACH,mGAZG;IAAsD,IAAI,EAAlD,OAAO,GAAG,QAAQ,GAAG,eAAe;IACpB,EAAE,EAAlB,MAAM;IAKH,OAAO,EAJV;QACN,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;QACtB,CAAK,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB;IAC0B,YAAY;IACZ,eAAe;IACjB,OAAO,GAAxB,MAAM;CACd,GAAU,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;CAAC,CAAC,CAmEtE;AAED,0CAEC;AAED,8DA8BC;AAED,gFAKC;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"auth.api.d.ts","sourceRoot":"","sources":["../../../components/auth/auth.api.js"],"names":[],"mappings":"AAqLA,qEAUC;AAED,qEAwEC;AAED,qEAGC;AAED,gEAMC;AAED,iEAgBC;AAED,oEAGC;AAED,oEA8BC;AAED,gEAgCC;AAID,qGAkDC;AAED;;;GAOC;AAED;;GAKC;AAED;;;;GAIG;AACH,qCAHW,MAAM,GACJ,MAAM,GAAC,SAAS,CAI5B;AAID;;;;;;;;;GASG;AACH,8EAPG;IAA0B,QAAQ,GAA1B,MAAM;IACY,SAAS,GAA3B,MAAM;IACY,OAAO,GAAzB,MAAM;CACd,YAAQ,MAAM,+BACN,OAAO,GACL,OAAO,CAAC,MAAM,CAAC,CAqE3B;AAED,kFAiBC;AAED,mEAOC;AAED,+EAWC;AAED,sHAiBC;AAED;;;GAEC;AAED;;;GA0BC;AAED;;;;;;;;;GAmCC;AAED;;;;;;;;;;;;;;GAcG;AACH,mGAZG;IAAsD,IAAI,EAAlD,OAAO,GAAG,QAAQ,GAAG,eAAe;IACpB,EAAE,EAAlB,MAAM;IAKH,OAAO,EAJV;QACN,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;QACtB,CAAK,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB;IAC0B,YAAY;IACZ,eAAe;IACjB,OAAO,GAAxB,MAAM;CACd,GAAU,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;CAAC,CAAC,CAmEtE;AAED,0CAEC;AAED,8DA8BC;AAED,gFAKC;;;;;;;;;;;;;;;;;;;;AAnvBD;;;;;;;;;;;;;;;EAiBC;AA0ED,0DAEC;AAgCD,mDAEC;AAtBD,iDAkBC;AA5BD,2DAQC;AA0BD,2DAwBC;AAtID,0EAsEC"}
|
package/types/globals.d.ts
CHANGED
package/types/util.d.ts
CHANGED
|
@@ -571,6 +571,12 @@ export function onChange<T>(eventOrPathValue: EventOrPathValue, setState: React.
|
|
|
571
571
|
* @returns {string}
|
|
572
572
|
*/
|
|
573
573
|
export function pad(num?: number, padLeft?: number, fixedRight?: number): string;
|
|
574
|
+
/**
|
|
575
|
+
* Escape user input before it is interpolated into html, e.g. email templates
|
|
576
|
+
* @param {any} str
|
|
577
|
+
* @returns {string}
|
|
578
|
+
*/
|
|
579
|
+
export function escapeHtml(str: any): string;
|
|
574
580
|
/**
|
|
575
581
|
* Escapes a string for use in a regex
|
|
576
582
|
* @param {string} str
|
|
@@ -901,6 +907,20 @@ export function twMerge(...args: (string | null | undefined | false | 0 | 0n)[])
|
|
|
901
907
|
* @returns {string}
|
|
902
908
|
*/
|
|
903
909
|
export function ucFirst(string: string): string;
|
|
910
|
+
/**
|
|
911
|
+
* Ensures the saved document is in the select options, adding a "(Saved)" sentinel option when it's missing.
|
|
912
|
+
* Handy when the options list is filtered/paginated, but the form state still references a document.
|
|
913
|
+
* @template {{ value: any, label?: any }} T
|
|
914
|
+
* @param {T[]} [options]
|
|
915
|
+
* @param {{ [key: string]: any } | null} [optionToEnsure] - document to ensure is in the options list
|
|
916
|
+
* @returns {T[]}
|
|
917
|
+
*/
|
|
918
|
+
export function addSentinel<T extends {
|
|
919
|
+
value: any;
|
|
920
|
+
label?: any;
|
|
921
|
+
}>(options?: T[], optionToEnsure?: {
|
|
922
|
+
[key: string]: any;
|
|
923
|
+
} | null): T[];
|
|
904
924
|
export { TZDate } from "@date-fns/tz";
|
|
905
925
|
export function getIdFromObject(object: {
|
|
906
926
|
_id?: string;
|
|
@@ -937,33 +957,17 @@ export type Image = {
|
|
|
937
957
|
};
|
|
938
958
|
export type SetState = import("react").Dispatch<import("react").SetStateAction<any>>;
|
|
939
959
|
/**
|
|
940
|
-
*
|
|
960
|
+
* Axios types, `axios-retry` augments AxiosRequestConfig with the 'axios-retry' key itself
|
|
941
961
|
*/
|
|
942
962
|
export type AxiosInstance = import("axios").AxiosInstance;
|
|
943
963
|
/**
|
|
944
|
-
*
|
|
964
|
+
* Axios types, `axios-retry` augments AxiosRequestConfig with the 'axios-retry' key itself
|
|
945
965
|
*/
|
|
946
966
|
export type AxiosRequestConfig = import("axios").AxiosRequestConfig;
|
|
947
967
|
/**
|
|
948
|
-
*
|
|
949
|
-
*/
|
|
950
|
-
export type AxiosResponse = import("axios").AxiosResponse;
|
|
951
|
-
/**
|
|
952
|
-
* Extend the config to be used below
|
|
968
|
+
* Axios types, `axios-retry` augments AxiosRequestConfig with the 'axios-retry' key itself
|
|
953
969
|
*/
|
|
954
|
-
export type
|
|
955
|
-
/**
|
|
956
|
-
* We only need to fix the `get` method, the rest of the methods inherit the new extended config...
|
|
957
|
-
*/
|
|
958
|
-
export type AxiosRequestConfigWithRetry = AxiosRequestConfig & {
|
|
959
|
-
"axios-retry"?: IAxiosRetryConfigExtended;
|
|
960
|
-
};
|
|
961
|
-
/**
|
|
962
|
-
* Create an `axios` instance type that contains the `axios-retry` global declarations.
|
|
963
|
-
*/
|
|
964
|
-
export type AxiosInstanceWithRetry = Omit<AxiosInstance, "get"> & {
|
|
965
|
-
get<T = any, R = AxiosResponse, D = any>(url: string, config?: AxiosRequestConfigWithRetry): Promise<R>;
|
|
966
|
-
};
|
|
970
|
+
export type AxiosInstanceWithRetry = AxiosInstance;
|
|
967
971
|
export type ObjectId = object;
|
|
968
972
|
export type parseId = (value: string) => ObjectId;
|
|
969
973
|
/**
|
package/types/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../util.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../util.js"],"names":[],"mappings":"AA2CA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCC;AAED;;;;;;;;;;;;GAYG;AACH,yCAVG;IAAsD,YAAY,GAA1D,OAAO,OAAO,EAAE,mBAAmB;CAE3C,GAAU,sBAAsB,CA6BlC;AAED;;;;;GAKG;AACH,8BAJW,MAAM,cACN;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAC,GACrB,MAAM,CAKlB;AAED;;;;;;GAMG;AACH,+BALW,MAAM,oBACN,OAAO,gBACP,OAAO,GACL,MAAM,CAelB;AAED;;;;;GAKG;AACH,sCAJW,MAAM,wBACN,OAAO,GACL,MAAM,CAMlB;AAED;;;;GAIG;AACH,sCAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;GAKG;AACH,sCAJW,MAAM,wBACN,OAAO,GACL,MAAM,CAKlB;AAED;;;;GAIG;AACH,iCAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;GAIG;AACH,sCAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAsB5B;AA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;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAC;uBA51D7D,OAAO,OAAO,EAAE,QAAQ,CAAC,OAAO,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;;;;4BAI9D,OAAO,OAAO,EAAE,aAAa;;;;iCAC7B,OAAO,OAAO,EAAE,kBAAkB;;;;qCAClC,aAAa;uBAGZ,MAAM;sBACN,CAAC,KAAK,EAAE,MAAM,KAAK,QAAQ;;;;wBAC3B,CAAC,MAAM,GAAC,MAAM,GAAC,OAAO,CAAC,EAAE;;;;8BACzB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE;yBACtB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;yBACjC;IAAE,MAAM,EAAE,MAAM;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE;8BACrC;IAAE,QAAQ,EAAE;QAAE,IAAI,EAAE;YAAE,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE"}
|
package/types.ts
CHANGED
|
@@ -29,14 +29,24 @@ export type User = {
|
|
|
29
29
|
firstName?: string
|
|
30
30
|
lastName?: string
|
|
31
31
|
name?: string
|
|
32
|
-
avatar?:
|
|
32
|
+
avatar?: MonasteryFile
|
|
33
33
|
isAdmin?: boolean
|
|
34
|
+
companyRole?: 'owner' | 'manager' // role in the active company, set by getStore
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// A collection cached on the store (see the example project's client/use-fetch.ts)
|
|
38
|
+
export type SharedCollection<T> = {
|
|
39
|
+
rows: T[]
|
|
40
|
+
total: number
|
|
41
|
+
errors?: Errors
|
|
42
|
+
isLoading?: boolean
|
|
43
|
+
lastFetched?: number
|
|
34
44
|
}
|
|
35
45
|
|
|
36
46
|
export type Error = { title: string, detail: string }
|
|
37
47
|
export type Errors = Error[]
|
|
38
48
|
|
|
39
|
-
export type
|
|
49
|
+
export type MonasteryFile = {
|
|
40
50
|
url: string
|
|
41
51
|
filename: string
|
|
42
52
|
path: string
|
|
@@ -56,8 +66,12 @@ export type Store = {
|
|
|
56
66
|
jwt?: string
|
|
57
67
|
message?: MessageObject | string
|
|
58
68
|
user: User,
|
|
69
|
+
sharedCollections?: SharedCollections
|
|
59
70
|
}
|
|
60
71
|
|
|
72
|
+
// Collections cached on the store, fetched with useFetchSharedCol(). Extend this on your project's Store
|
|
73
|
+
export interface SharedCollections {} // eslint-disable-line @typescript-eslint/no-empty-object-type
|
|
74
|
+
|
|
61
75
|
// util.addressSchema
|
|
62
76
|
export type Address = {
|
|
63
77
|
city?: string
|