nitro-web 0.0.162 → 0.0.164
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 +1 -1
- package/components/partials/element/button.tsx +5 -1
- package/components/partials/element/message.tsx +169 -65
- package/components/partials/styleguide.tsx +38 -12
- package/package.json +1 -1
- package/types/util.d.ts +10 -3
- package/types/util.d.ts.map +1 -1
- package/types.ts +1 -1
- package/util.js +15 -4
package/client/index.ts
CHANGED
|
@@ -29,7 +29,7 @@ export { Dropdown, type DropdownProps, type DropdownOption } from '../components
|
|
|
29
29
|
export { Filters, type FilterType, usePushChangesToPath } from '../components/partials/element/filters'
|
|
30
30
|
export { GithubLink } from '../components/partials/element/github-link'
|
|
31
31
|
export { Initials } from '../components/partials/element/initials'
|
|
32
|
-
export { Message } from '../components/partials/element/message'
|
|
32
|
+
export { Message, type MessageIcons } from '../components/partials/element/message'
|
|
33
33
|
export { Modal } from '../components/partials/element/modal'
|
|
34
34
|
export { Sidebar, type SidebarProps } from '../components/partials/element/sidebar'
|
|
35
35
|
export { TimePicker, type TimePickerProps } from '../components/partials/element/timepicker'
|
|
@@ -2,7 +2,7 @@ import { twMerge } from 'nitro-web'
|
|
|
2
2
|
import { ChevronDown, ChevronUp } from 'lucide-react'
|
|
3
3
|
|
|
4
4
|
interface Button extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5
|
-
color?: 'primary'|'secondary'|'black'|'dark'|'white'|'clear'|'custom'
|
|
5
|
+
color?: 'primary'|'secondary'|'black'|'dark'|'white'|'clear'|'danger'|'warning'|'info'|'success'|'custom'
|
|
6
6
|
size?: 'xs'|'sm'|'md'|'lg'|'custom'
|
|
7
7
|
customColor?: string
|
|
8
8
|
customSize?: string
|
|
@@ -47,6 +47,10 @@ export function Button({
|
|
|
47
47
|
'dark': 'bg-gray-800 hover:bg-gray-700 ring-transparent text-white [&>.loader]:border-white',
|
|
48
48
|
'white': 'bg-white hover:bg-gray-50 ring-gray-300 text-gray-900 [&>.loader]:border-black', // maybe change to text-foreground
|
|
49
49
|
'clear': 'hover:bg-gray-50 ring-gray-300 hover:text-foreground [&>.loader]:border-foreground !shadow-none',
|
|
50
|
+
'danger': 'bg-danger hover:bg-danger-hover ring-transparent text-white [&>.loader]:border-white',
|
|
51
|
+
'warning': 'bg-warning hover:bg-warning-hover ring-transparent text-white [&>.loader]:border-white',
|
|
52
|
+
'info': 'bg-info hover:bg-info-hover ring-transparent text-white [&>.loader]:border-white',
|
|
53
|
+
'success': 'bg-success hover:bg-success-hover ring-transparent text-white [&>.loader]:border-white',
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
// Button sizes (px is better for height consistency)
|
|
@@ -1,40 +1,76 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { X, CircleCheck } from 'lucide-react'
|
|
1
|
+
import { queryObject, twMerge } from 'nitro-web/util'
|
|
2
|
+
import { IsFirstRender } from 'nitro-web'
|
|
3
|
+
import { X, CircleCheck, Info, TriangleAlert, CircleX } from 'lucide-react'
|
|
4
4
|
import { MessageObject } from 'nitro-web/types'
|
|
5
|
-
import {
|
|
5
|
+
import React, { useMemo } from 'react'
|
|
6
|
+
|
|
7
|
+
let messageInstanceCount = 0
|
|
8
|
+
|
|
9
|
+
type MessagePosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'
|
|
10
|
+
|
|
11
|
+
type MessageIcon = {
|
|
12
|
+
color: string
|
|
13
|
+
icon: React.ComponentType<{ size?: number; className?: string; 'aria-hidden'?: boolean }>
|
|
14
|
+
position: MessagePosition
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type MessageIcons = Partial<{[key: string]: Partial<MessageIcon>}>
|
|
6
18
|
|
|
7
19
|
type MessageProps = {
|
|
8
20
|
className?: string
|
|
9
21
|
classNameWrapper?: string
|
|
10
|
-
|
|
22
|
+
icons?: MessageIcons
|
|
23
|
+
position?: MessagePosition
|
|
11
24
|
}
|
|
25
|
+
|
|
12
26
|
/**
|
|
13
|
-
* Shows a message
|
|
14
|
-
*
|
|
27
|
+
* Shows a message by store.message or query param.
|
|
28
|
+
* - A tilde ~ is appended so we can keep clicking links and seeing the message again
|
|
29
|
+
*
|
|
30
|
+
* Showing a message by store.message:
|
|
31
|
+
*
|
|
32
|
+
* The store.message value can be a string or an object with the following properties:
|
|
33
|
+
* - @param {string} text - The text of the message
|
|
34
|
+
* - @param {'error' | 'warning' | 'info' | 'success'} [type]
|
|
35
|
+
* - @param {number} [timeout] - The timeout in milliseconds to hide the message
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* setStore({ message: 'Added successfully.' })
|
|
39
|
+
* setStore({ message: { type: 'error', default: 'Sorry, there was an error.' } })
|
|
40
|
+
* setStore({ message: { type: 'success', text: 'Added successfully.', timeout: 5000 } })
|
|
41
|
+
* setStore({ message: '' }) (Clears the message)
|
|
42
|
+
*
|
|
43
|
+
* Showing a message by query param:
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* /?error (Shows 'Sorry, there was an error.')
|
|
47
|
+
* /?error=Woops (Shows 'Woops'
|
|
48
|
+
* /?added (Shows the default text for the 'added' message type)
|
|
15
49
|
**/
|
|
16
|
-
export function Message({ className, classNameWrapper, position
|
|
17
|
-
const devDontHide = false
|
|
50
|
+
export function Message({ className, classNameWrapper, icons: iconsProp, position }: MessageProps) {
|
|
18
51
|
const [store, setStore] = useTracked()
|
|
19
52
|
const [visible, setVisible] = useState(false)
|
|
53
|
+
const [messageObject, setMessageObject] = useState<MessageObject>()
|
|
20
54
|
const location = useLocation()
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
'
|
|
55
|
+
const navigate = useNavigate()
|
|
56
|
+
const isFirstRender = IsFirstRender()
|
|
57
|
+
|
|
58
|
+
const queryDefaultMap: Record<string, MessageObject> = {
|
|
59
|
+
// Primary message types:
|
|
60
|
+
'error': { type: 'error', text: 'Sorry, there was an error.' },
|
|
61
|
+
'warning': { type: 'warning', text: '' },
|
|
62
|
+
'info': { type: 'info', text: '' },
|
|
63
|
+
'success': { type: 'success', text: '' },
|
|
64
|
+
// Predefined message types:
|
|
65
|
+
'added': { type: 'success', text: 'Added successfully.' },
|
|
66
|
+
'created': { type: 'success', text: 'Created successfully.' },
|
|
67
|
+
'oauth-error': { type: 'error', text: 'There was an error trying to signin, please try again.' },
|
|
68
|
+
'removed': { type: 'success', text: 'Removed.' },
|
|
27
69
|
'signin': { type: 'error', text: 'Please sign in to access this page' },
|
|
28
|
-
'
|
|
29
|
-
'
|
|
70
|
+
'unauth': { type: 'error', text: 'You are unauthorised.' },
|
|
71
|
+
'updated': { type: 'success', text: 'Updated successfully.' },
|
|
30
72
|
}
|
|
31
|
-
const
|
|
32
|
-
'error': 'text-danger',
|
|
33
|
-
'warning': 'text-warning',
|
|
34
|
-
'info': 'text-info',
|
|
35
|
-
'success': 'text-success',
|
|
36
|
-
}
|
|
37
|
-
const positionMap = {
|
|
73
|
+
const positionMap: Record<MessagePosition, [string, string]> = {
|
|
38
74
|
'top-left': ['sm:items-start sm:justify-start', 'sm:translate-y-0 sm:translate-x-[-0.5rem]'],
|
|
39
75
|
'top-center': ['sm:items-start sm:justify-center', 'sm:translate-y-[-0.5rem]'],
|
|
40
76
|
'top-right': ['sm:items-start sm:justify-end', 'sm:translate-y-0 sm:translate-x-1'],
|
|
@@ -42,69 +78,115 @@ export function Message({ className, classNameWrapper, position='top-right' }: M
|
|
|
42
78
|
'bottom-center': ['sm:items-end sm:justify-center', 'sm:translate-y-1'],
|
|
43
79
|
'bottom-right': ['sm:items-end sm:justify-end', 'sm:translate-y-0 sm:translate-x-1'],
|
|
44
80
|
}
|
|
45
|
-
const color = colorMap[(store.message as MessageObject)?.type || 'success']
|
|
46
|
-
const positionArr = positionMap[(position as keyof typeof positionMap)]
|
|
47
81
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
82
|
+
const defaultIcons: Record<string, MessageIcon> = {
|
|
83
|
+
error: { color: 'text-danger', icon: CircleX, position: 'top-right' },
|
|
84
|
+
warning: { color: 'text-warning', icon: TriangleAlert, position: 'top-right' },
|
|
85
|
+
info: { color: 'text-info', icon: Info, position: 'top-right' },
|
|
86
|
+
success: { color: 'text-success', icon: CircleCheck, position: 'top-right' },
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const icons = useMemo(() => {
|
|
90
|
+
const result: Record<string, MessageIcon> = { ...defaultIcons }
|
|
91
|
+
if (iconsProp) {
|
|
92
|
+
for (const type in iconsProp) {
|
|
93
|
+
result[type] = {
|
|
94
|
+
color: iconsProp[type]?.color ?? result[type]?.color,
|
|
95
|
+
icon: iconsProp[type]?.icon ?? result[type]?.icon,
|
|
96
|
+
position: iconsProp[type]?.position ?? result[type]?.position,
|
|
97
|
+
}
|
|
98
|
+
}
|
|
51
99
|
}
|
|
52
|
-
|
|
100
|
+
return result
|
|
101
|
+
}, [iconsProp])
|
|
102
|
+
|
|
103
|
+
const icon = icons[messageObject?.type || 'success']
|
|
104
|
+
const positionArr = positionMap[position ?? icon?.position ?? 'top-right']
|
|
53
105
|
|
|
54
106
|
useEffect(() => {
|
|
55
|
-
//
|
|
56
|
-
|
|
57
|
-
|
|
107
|
+
// Listen for query changes
|
|
108
|
+
const query = queryObject(location.search, { emptyStringAsTrue: false })
|
|
109
|
+
|
|
110
|
+
// Show the first found message from a query string
|
|
58
111
|
for (const key in query) {
|
|
59
112
|
if (!query.hasOwnProperty(key)) continue
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
113
|
+
if (!Object.keys(queryDefaultMap).includes(key)) continue
|
|
114
|
+
const defaultMessageObject = queryDefaultMap[key as keyof typeof queryDefaultMap]
|
|
115
|
+
if (Array.isArray(query[key])) continue
|
|
116
|
+
const rawQueryValue = query[key] as string
|
|
117
|
+
|
|
118
|
+
if (rawQueryValue.match(/=$/) && !isFirstRender) {
|
|
119
|
+
// Only show if first render, otherwise skip internal tracking of the message
|
|
120
|
+
continue
|
|
65
121
|
}
|
|
122
|
+
|
|
123
|
+
// Parse the raw text value into a message object (remove the bust '~' if present)
|
|
124
|
+
const queryValueDecoded = decodeURIComponent(rawQueryValue).replace(/~$/, '') // replaces + => ' '
|
|
125
|
+
const newMessageObject = parseRawValue(queryValueDecoded, defaultMessageObject)
|
|
126
|
+
setStore(s => ({ ...s, message: newMessageObject }))
|
|
127
|
+
setMessageObject(() => newMessageObject)
|
|
128
|
+
|
|
129
|
+
// Add the bust '~' value in the query param, so the user can see the message again when clicking the same link
|
|
130
|
+
const newQuery = new URLSearchParams(location.search)
|
|
131
|
+
newQuery.set(key, queryValueDecoded + '~')
|
|
132
|
+
|
|
133
|
+
// Build query string with encodeURIComponent to preserve %20 for spaces
|
|
134
|
+
const parts = []
|
|
135
|
+
for (const [k, v] of newQuery.entries()) {
|
|
136
|
+
parts.push(encodeURIComponent(k) + '=' + encodeURIComponent(v))
|
|
137
|
+
}
|
|
138
|
+
navigate(
|
|
139
|
+
{ pathname: location.pathname, search: parts.length ? '?' + parts.join('&') : '' },
|
|
140
|
+
{ replace: true }
|
|
141
|
+
)
|
|
142
|
+
break
|
|
66
143
|
}
|
|
67
|
-
if (message) setStore(s => ({ ...s, message: message }))
|
|
68
144
|
}, [location.search])
|
|
69
145
|
|
|
70
146
|
useEffect(() => {
|
|
71
|
-
//
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
} else if (isString(store.message)) {
|
|
79
|
-
setStore(s => ({ ...s, message: { type: 'success', text: store.message as string, date: now }}))
|
|
80
|
-
// Add a date to the message
|
|
81
|
-
} else if (!messageObject.date) {
|
|
82
|
-
setStore(s => ({ ...s, message: { ...messageObject, date: now }}))
|
|
83
|
-
// Show message and hide it again after some time. Send back cleanup if store.message changes
|
|
84
|
-
} else if (messageObject && now - 500 < messageObject.date) {
|
|
85
|
-
const timeout1 = setTimeout(() => setVisible(true), 50)
|
|
86
|
-
if (messageObject.timeout !== 0 && !devDontHide) var timeout2 = setTimeout(hide, messageObject.timeout || 5000)
|
|
87
|
-
return () => {
|
|
88
|
-
clearTimeout(timeout1)
|
|
89
|
-
clearTimeout(timeout2)
|
|
90
|
-
}
|
|
147
|
+
// Listen for store.message changes (onload this may be )
|
|
148
|
+
if (!isAlreadyShown(store.message)) {
|
|
149
|
+
// If not skipped on first render, this will override the query param message above onload
|
|
150
|
+
if (isFirstRender) return
|
|
151
|
+
const newMessageObject = parseRawValue(store.message || '')
|
|
152
|
+
setMessageObject(() => newMessageObject)
|
|
153
|
+
setStore(s => ({ ...s, message: newMessageObject }))
|
|
91
154
|
}
|
|
92
155
|
}, [JSON.stringify(store.message)])
|
|
93
156
|
|
|
157
|
+
useEffect(() => {
|
|
158
|
+
// Listen for internal messageObject changes, and show and hide message
|
|
159
|
+
if (!messageObject) return
|
|
160
|
+
const timeout1 = setTimeout(() => setVisible(true), 20)
|
|
161
|
+
const timeout2 = messageObject.timeout !== 0 ? setTimeout(() => setVisible(false), messageObject.timeout || 5000) : undefined
|
|
162
|
+
return () => {
|
|
163
|
+
clearTimeout(timeout1)
|
|
164
|
+
clearTimeout(timeout2)
|
|
165
|
+
}
|
|
166
|
+
}, [JSON.stringify(messageObject)])
|
|
167
|
+
|
|
168
|
+
useEffect(() => {
|
|
169
|
+
messageInstanceCount++
|
|
170
|
+
if (messageInstanceCount > 1) console.error('Nitro: Multiple <Message /> instances can show duplicate notifications.')
|
|
171
|
+
return () => {
|
|
172
|
+
messageInstanceCount--
|
|
173
|
+
}
|
|
174
|
+
}, [])
|
|
175
|
+
|
|
94
176
|
function hide() {
|
|
95
177
|
setVisible(false)
|
|
96
|
-
setTimeout(() =>
|
|
178
|
+
setTimeout(() => setMessageObject(undefined), 250)
|
|
97
179
|
}
|
|
98
180
|
|
|
99
181
|
return (
|
|
100
|
-
|
|
182
|
+
<React.Fragment>
|
|
101
183
|
{/* Global notification live region, render this permanently at the end of the document */}
|
|
102
184
|
<div
|
|
103
185
|
aria-live="assertive"
|
|
104
186
|
className={`${twMerge(`pointer-events-none items-end justify-center fixed inset-0 flex px-4 py-6 sm:p-6 z-[101] nitro-message ${positionArr[0]} ${classNameWrapper || ''}`)}`}
|
|
105
187
|
>
|
|
106
188
|
<div className="flex flex-col items-center space-y-4">
|
|
107
|
-
{
|
|
189
|
+
{messageObject && (
|
|
108
190
|
<div className={twMerge(
|
|
109
191
|
'overflow-hidden translate-y-[0.5rem] opacity-0 pointer-events-auto max-w-[350px] rounded-md bg-white shadow-lg ring-1 ring-black/5 transition text-sm font-medium text-gray-900',
|
|
110
192
|
positionArr[1],
|
|
@@ -114,10 +196,14 @@ export function Message({ className, classNameWrapper, position='top-right' }: M
|
|
|
114
196
|
<div className="p-3">
|
|
115
197
|
<div className="flex items-start gap-3 leading-[1.4em]">
|
|
116
198
|
<div className="flex items-center shrink-0 min-h-[1.4em]">
|
|
117
|
-
|
|
199
|
+
{React.createElement(icon.icon, {
|
|
200
|
+
'aria-hidden': true,
|
|
201
|
+
size: 19,
|
|
202
|
+
className: icon.color,
|
|
203
|
+
})}
|
|
118
204
|
</div>
|
|
119
205
|
<div className="flex flex-1 items-center min-h-[1.4em]">
|
|
120
|
-
<p>{
|
|
206
|
+
<p>{messageObject.text}</p>
|
|
121
207
|
</div>
|
|
122
208
|
<div className="flex items-center shrink-0 min-h-[1.4em]">
|
|
123
209
|
<button
|
|
@@ -136,6 +222,24 @@ export function Message({ className, classNameWrapper, position='top-right' }: M
|
|
|
136
222
|
)}
|
|
137
223
|
</div>
|
|
138
224
|
</div>
|
|
139
|
-
|
|
225
|
+
</React.Fragment>
|
|
140
226
|
)
|
|
141
227
|
}
|
|
228
|
+
|
|
229
|
+
function isAlreadyShown(value?: string | MessageObject) {
|
|
230
|
+
if (!value) return false
|
|
231
|
+
if (typeof value === 'string') return false
|
|
232
|
+
if (typeof value === 'object' && value._date) return true
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function parseRawValue(value: string | MessageObject, defaultMessageObject?: MessageObject): MessageObject | undefined {
|
|
236
|
+
if (typeof value === 'string') {
|
|
237
|
+
if (!value && !defaultMessageObject?.text) return
|
|
238
|
+
if (defaultMessageObject) return { ...defaultMessageObject, text: value || defaultMessageObject.text, _date: Date.now() }
|
|
239
|
+
return { type: 'success', text: value, _date: Date.now() }
|
|
240
|
+
}
|
|
241
|
+
if (typeof value === 'object') {
|
|
242
|
+
if (!value.text) return
|
|
243
|
+
return { ...value, _date: Date.now() }
|
|
244
|
+
}
|
|
245
|
+
}
|
|
@@ -42,14 +42,15 @@ export function Styleguide({ className, elements, children, currencies }: Styleg
|
|
|
42
42
|
'Links',
|
|
43
43
|
'Dropdowns',
|
|
44
44
|
'Filters',
|
|
45
|
-
'
|
|
45
|
+
'Button Colors & Sizes',
|
|
46
|
+
'Button Icons',
|
|
46
47
|
'Varients',
|
|
47
48
|
'Selects',
|
|
48
49
|
'Inputs',
|
|
49
50
|
'Date Inputs',
|
|
50
51
|
'File Inputs & Calendar & Time',
|
|
51
52
|
'Tables',
|
|
52
|
-
'Modals',
|
|
53
|
+
'Modals & Notifications',
|
|
53
54
|
'Custom Components',
|
|
54
55
|
]
|
|
55
56
|
const [state, setState] = useState(() => getState())
|
|
@@ -322,20 +323,35 @@ export function Styleguide({ className, elements, children, currencies }: Styleg
|
|
|
322
323
|
</div>
|
|
323
324
|
)}
|
|
324
325
|
|
|
325
|
-
{groups.includes('
|
|
326
|
+
{groups.includes('Button Colors & Sizes') && (
|
|
326
327
|
<div>
|
|
327
|
-
<h2 class="h3">
|
|
328
|
+
<h2 class="h3">Button Colors & Sizes</h2>
|
|
328
329
|
<div class="flex flex-wrap gap-x-6 gap-y-4 mb-6">
|
|
330
|
+
{/* Colors */}
|
|
329
331
|
<div><Button color="primary">primary (default)</Button></div>
|
|
330
332
|
<div><Button color="secondary">secondary button</Button></div>
|
|
331
333
|
<div><Button color="black">black button</Button></div>
|
|
332
334
|
<div><Button color="dark">dark button</Button></div>
|
|
333
335
|
<div><Button color="white">white button</Button></div>
|
|
334
336
|
<div><Button color="clear">clear button</Button></div>
|
|
335
|
-
<div><Button color="
|
|
336
|
-
<div><Button color="
|
|
337
|
-
<div><Button color="
|
|
337
|
+
<div><Button color="danger">danger button</Button></div>
|
|
338
|
+
<div><Button color="warning">warning button</Button></div>
|
|
339
|
+
<div><Button color="info">info button</Button></div>
|
|
340
|
+
<div><Button color="success">success button</Button></div>
|
|
341
|
+
{/* Sizes */}
|
|
338
342
|
<div><Button color="primary" size="lg">*-lg button</Button></div>
|
|
343
|
+
<div><Button color="primary">*-md (default)</Button></div>
|
|
344
|
+
<div><Button color="primary" size="sm">*-sm button</Button></div>
|
|
345
|
+
<div><Button color="primary" size="xs">*-xs button</Button></div>
|
|
346
|
+
</div>
|
|
347
|
+
</div>
|
|
348
|
+
)}
|
|
349
|
+
|
|
350
|
+
{groups.includes('Button Icons') && (
|
|
351
|
+
<div>
|
|
352
|
+
<h2 class="h3">Button Icons</h2>
|
|
353
|
+
<div class="flex flex-wrap gap-x-6 gap-y-4 mb-6">
|
|
354
|
+
{/* Icons */}
|
|
339
355
|
<div><Button IconLeft={<Check size={19} className="-my-5" />}>IconLeft</Button></div>
|
|
340
356
|
<div><Button IconLeft={<Check size={19} className="-my-5" />}
|
|
341
357
|
className="w-[160px]">IconLeft 160px</Button></div>
|
|
@@ -343,7 +359,7 @@ export function Styleguide({ className, elements, children, currencies }: Styleg
|
|
|
343
359
|
className="w-[190px]">IconLeftEnd 190px</Button></div>
|
|
344
360
|
<div><Button IconRight="v">IconRight</Button></div>
|
|
345
361
|
<div><Button IconRightEnd="v" className="w-[190px]">IconRightEnd 190px</Button></div>
|
|
346
|
-
<div><Button color="primary" IconRight="v" isLoading
|
|
362
|
+
<div><Button color="primary" IconRight="v" isLoading></Button></div>
|
|
347
363
|
<div><Button IconCenter={<FileEditIcon size={18}/>}></Button></div>
|
|
348
364
|
<div><Button size="sm" IconCenter={<FileEditIcon size={16}/>}></Button></div>
|
|
349
365
|
<div><Button size="xs" IconCenter={<FileEditIcon size={14}/>}></Button></div>
|
|
@@ -665,13 +681,23 @@ export function Styleguide({ className, elements, children, currencies }: Styleg
|
|
|
665
681
|
</div>
|
|
666
682
|
)}
|
|
667
683
|
|
|
668
|
-
{groups.includes('Modals') && (
|
|
684
|
+
{groups.includes('Modals & Notifications') && (
|
|
669
685
|
<React.Fragment>
|
|
670
686
|
<div>
|
|
671
|
-
<h2 class="h3">Modals</h2>
|
|
672
|
-
<div class="mb-6"
|
|
687
|
+
<h2 class="h3">Modals & Notifications</h2>
|
|
688
|
+
<div class="flex flex-wrap gap-x-6 gap-y-4 mb-6">
|
|
689
|
+
<Button color="primary" onClick={() => setShowModal1(true)}>Modal (default)</Button>
|
|
690
|
+
<Button color="danger" onClick={() => setStore({ message: { text: 'Error.', type: 'error' }}) }>Notification error</Button>
|
|
691
|
+
<Button color="warning" onClick={() => setStore({ message: { text: 'Warning.', type: 'warning' }}) }>Notification warning</Button>{/*eslint-disable-line*/}
|
|
692
|
+
<Button color="info" onClick={() => setStore({ message: { text: 'Info.', type: 'info' }}) }>Notification info</Button>
|
|
693
|
+
<Button color="success" onClick={() => setStore({ message: 'Success.' })}>Notification success</Button>
|
|
694
|
+
</div>
|
|
673
695
|
</div>
|
|
674
|
-
|
|
696
|
+
|
|
697
|
+
{/* Create a Message instance (setup once in the layout file, recommended approach) */}
|
|
698
|
+
{/* <Message position="top-right" />*/}
|
|
699
|
+
|
|
700
|
+
{/* Create a Modal instance */}
|
|
675
701
|
<Modal show={showModal1} setShow={setShowModal1}>
|
|
676
702
|
<h3 class="h3">Edit Profile</h3>
|
|
677
703
|
<p class="mb-5">An example modal containing a basic form for editing profiles.</p>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitro-web",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.164",
|
|
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 🚀",
|
package/types/util.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export function addressSchema(): {
|
|
|
51
51
|
/**
|
|
52
52
|
* Returns an axios instance for the client
|
|
53
53
|
* @param {object} [options] - Options for the axios instance
|
|
54
|
-
* @param {import('axios').CreateAxiosDefaults} [options.
|
|
54
|
+
* @param {import('axios').CreateAxiosDefaults} [options.createConfig] - Options for the axios instance creation on the server,
|
|
55
55
|
* e.g. { httpsAgent: new https.Agent({ keepAlive: true }) }
|
|
56
56
|
* @returns {AxiosInstanceWithRetry}
|
|
57
57
|
*
|
|
@@ -61,8 +61,8 @@ export function addressSchema(): {
|
|
|
61
61
|
* axios().defaults.baseURL = 'https://example.com'
|
|
62
62
|
* ```
|
|
63
63
|
*/
|
|
64
|
-
export function axios({
|
|
65
|
-
|
|
64
|
+
export function axios({ createConfig }?: {
|
|
65
|
+
createConfig?: import("axios").CreateAxiosDefaults;
|
|
66
66
|
}): AxiosInstanceWithRetry;
|
|
67
67
|
/**
|
|
68
68
|
* Builds the url with params
|
|
@@ -94,6 +94,13 @@ export function camelCaseToTitle(str: string, captialiseFirstOnly?: boolean): st
|
|
|
94
94
|
* @returns {string}
|
|
95
95
|
*/
|
|
96
96
|
export function camelCaseToHypen(str: string): string;
|
|
97
|
+
/**
|
|
98
|
+
* Converts hypen case to title case
|
|
99
|
+
* @param {string} str
|
|
100
|
+
* @param {boolean} [justCapitaliseFirst] - Just capitalise the first letter
|
|
101
|
+
* @returns {string}
|
|
102
|
+
*/
|
|
103
|
+
export function hypenCaseToTitle(str: string, justCapitaliseFirst?: boolean): string;
|
|
97
104
|
/**
|
|
98
105
|
* Capitalises a string
|
|
99
106
|
* @param {string} [str]
|
package/types/util.d.ts.map
CHANGED
|
@@ -1 +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;iCAC7B,OAAO,OAAO,EAAE,kBAAkB;;;;4BAClC,OAAO,OAAO,EAAE,aAAa;;;;wCAC7B,OAAO,aAAa,EAAE,yBAAyB;;;;0CAG/C,kBAAkB,GAAG;IAAE,aAAa,CAAC,EAAE,yBAAyB,CAAA;CAAE;;;;qCAGlE,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,GAAG;IACrC,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,aAAa,EAAE,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,2BAA2B,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;CACzG;uBAGW,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
|
@@ -44,10 +44,10 @@ export type MonasteryImage = {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
export type MessageObject = {
|
|
47
|
-
date?: number
|
|
48
47
|
text: string | React.ReactNode
|
|
49
48
|
type?: 'error' | 'info' | 'success' | 'warning'
|
|
50
49
|
timeout?: number
|
|
50
|
+
_date?: number // internal usage only
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
export type Store = {
|
package/util.js
CHANGED
|
@@ -88,7 +88,7 @@ export function addressSchema () {
|
|
|
88
88
|
/**
|
|
89
89
|
* Returns an axios instance for the client
|
|
90
90
|
* @param {object} [options] - Options for the axios instance
|
|
91
|
-
* @param {import('axios').CreateAxiosDefaults} [options.
|
|
91
|
+
* @param {import('axios').CreateAxiosDefaults} [options.createConfig] - Options for the axios instance creation on the server,
|
|
92
92
|
* e.g. { httpsAgent: new https.Agent({ keepAlive: true }) }
|
|
93
93
|
* @returns {AxiosInstanceWithRetry}
|
|
94
94
|
*
|
|
@@ -98,7 +98,7 @@ export function addressSchema () {
|
|
|
98
98
|
* axios().defaults.baseURL = 'https://example.com'
|
|
99
99
|
* ```
|
|
100
100
|
*/
|
|
101
|
-
export function axios ({
|
|
101
|
+
export function axios ({ createConfig } = {}) {
|
|
102
102
|
// On the client, add retries and set the baseURL
|
|
103
103
|
if (typeof window !== 'undefined') {
|
|
104
104
|
if (!axiosNonce) {
|
|
@@ -114,9 +114,9 @@ export function axios ({ serverConfig } = {}) {
|
|
|
114
114
|
return _axios
|
|
115
115
|
|
|
116
116
|
// On the server, we can create an axios instance if we want to maintain keep-alive (for Azure SNAT Port Exhaustion / speed up requests)
|
|
117
|
-
// E.g. axios({
|
|
117
|
+
// E.g. axios({ createConfig: { httpsAgent: new https.Agent({ keepAlive: true }) } })
|
|
118
118
|
} else {
|
|
119
|
-
if (!axiosInstance &&
|
|
119
|
+
if (!axiosInstance && createConfig) axiosInstance = _axios.create(createConfig)
|
|
120
120
|
return axiosInstance || _axios
|
|
121
121
|
}
|
|
122
122
|
}
|
|
@@ -175,6 +175,17 @@ export function camelCaseToHypen (str) {
|
|
|
175
175
|
return str.replace(/[A-Z]|[0-9]+/g, m => '-' + m.toLowerCase())
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
+
/**
|
|
179
|
+
* Converts hypen case to title case
|
|
180
|
+
* @param {string} str
|
|
181
|
+
* @param {boolean} [justCapitaliseFirst] - Just capitalise the first letter
|
|
182
|
+
* @returns {string}
|
|
183
|
+
*/
|
|
184
|
+
export function hypenCaseToTitle (str, justCapitaliseFirst) {
|
|
185
|
+
if (justCapitaliseFirst) return ucFirst(str.replace(/-/g, ' '))
|
|
186
|
+
else return str.replace(/-/g, ' ').replace(/\b\w/g, char => char.toUpperCase())
|
|
187
|
+
}
|
|
188
|
+
|
|
178
189
|
/**
|
|
179
190
|
* Capitalises a string
|
|
180
191
|
* @param {string} [str]
|