nitro-web 0.0.132 → 0.0.134
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
CHANGED
|
@@ -25,7 +25,7 @@ export { Accordion } from '../components/partials/element/accordion'
|
|
|
25
25
|
export { Avatar } from '../components/partials/element/avatar'
|
|
26
26
|
export { Button } from '../components/partials/element/button'
|
|
27
27
|
export { Calendar, type CalendarProps } from '../components/partials/element/calendar'
|
|
28
|
-
export { Dropdown, type DropdownProps } from '../components/partials/element/dropdown'
|
|
28
|
+
export { Dropdown, type DropdownProps, type DropdownOption } from '../components/partials/element/dropdown'
|
|
29
29
|
export { Filters, type FiltersHandleType, type FilterType } from '../components/partials/element/filters'
|
|
30
30
|
export { GithubLink } from '../components/partials/element/github-link'
|
|
31
31
|
export { Initials } from '../components/partials/element/initials'
|
|
@@ -47,7 +47,7 @@ export { FieldCurrency, type FieldCurrencyProps } from '../components/partials/f
|
|
|
47
47
|
export { FieldDate, type FieldDateProps } from '../components/partials/form/field-date'
|
|
48
48
|
export { FieldTime, type FieldTimeProps } from '../components/partials/form/field-time'
|
|
49
49
|
export { Location } from '../components/partials/form/location'
|
|
50
|
-
export { Select, getSelectStyle, type SelectProps } from '../components/partials/form/select'
|
|
50
|
+
export { Select, getSelectStyle, type SelectProps, type SelectOption } from '../components/partials/form/select'
|
|
51
51
|
|
|
52
52
|
// Component Other Components
|
|
53
53
|
export { IsFirstRender } from '../components/partials/is-first-render'
|
|
@@ -3,6 +3,16 @@ import { forwardRef, cloneElement } from 'react'
|
|
|
3
3
|
import { getSelectStyle, twMerge } from 'nitro-web'
|
|
4
4
|
import { CheckCircleIcon } from '@heroicons/react/24/solid'
|
|
5
5
|
|
|
6
|
+
export type DropdownOption = {
|
|
7
|
+
label: string|React.ReactNode,
|
|
8
|
+
onClick?: Function,
|
|
9
|
+
isSelected?: boolean,
|
|
10
|
+
icon?: React.ReactNode,
|
|
11
|
+
iconLeft?: React.ReactNode,
|
|
12
|
+
/** Prevent the dropdown from closing when the option is clicked */
|
|
13
|
+
preventCloseOnClick?: boolean,
|
|
14
|
+
className?: string
|
|
15
|
+
}
|
|
6
16
|
export type DropdownProps = {
|
|
7
17
|
allowOverflow?: boolean
|
|
8
18
|
animate?: boolean
|
|
@@ -11,16 +21,7 @@ export type DropdownProps = {
|
|
|
11
21
|
css?: string
|
|
12
22
|
/** The direction of the menu **/
|
|
13
23
|
dir?: 'bottom-left'|'bottom-right'|'top-left'|'top-right'
|
|
14
|
-
options?:
|
|
15
|
-
label: string|React.ReactNode,
|
|
16
|
-
onClick?: Function,
|
|
17
|
-
isSelected?: boolean,
|
|
18
|
-
icon?: React.ReactNode,
|
|
19
|
-
iconLeft?: React.ReactNode,
|
|
20
|
-
/** Prevent the dropdown from closing when the option is clicked */
|
|
21
|
-
preventCloseOnClick?: boolean,
|
|
22
|
-
className?: string
|
|
23
|
-
}[]
|
|
24
|
+
options?: DropdownOption[]
|
|
24
25
|
/** Whether the dropdown is hoverable **/
|
|
25
26
|
isHoverable?: boolean
|
|
26
27
|
/** The content to render inside the top of the dropdown **/
|
|
@@ -208,7 +208,7 @@ export function Table<T extends TableRow>({
|
|
|
208
208
|
</div>
|
|
209
209
|
{/* Tbody rows */}
|
|
210
210
|
{
|
|
211
|
-
rows.map((row: T, i: number) => {
|
|
211
|
+
!isLoading && rows.map((row: T, i: number) => {
|
|
212
212
|
const isSelected = selectedRowIds.includes(row?._id||'')
|
|
213
213
|
return (
|
|
214
214
|
<div
|
|
@@ -282,7 +282,7 @@ export function Table<T extends TableRow>({
|
|
|
282
282
|
})
|
|
283
283
|
}
|
|
284
284
|
{
|
|
285
|
-
rows.length == 0 &&
|
|
285
|
+
(isLoading || rows.length == 0) &&
|
|
286
286
|
<div className='table-row relative'>
|
|
287
287
|
{
|
|
288
288
|
columns.map((col, j) => {
|
|
@@ -296,8 +296,7 @@ export function Table<T extends TableRow>({
|
|
|
296
296
|
>
|
|
297
297
|
<div
|
|
298
298
|
className={twMerge(
|
|
299
|
-
'absolute top-0 h-full flex items-center justify-center text-sm',
|
|
300
|
-
isLoading ? '' : 'text-gray-500',
|
|
299
|
+
'absolute top-0 h-full flex items-center justify-center text-sm text-gray-500',
|
|
301
300
|
col.innerClassName
|
|
302
301
|
)}
|
|
303
302
|
>
|
|
@@ -20,7 +20,12 @@ type GetSelectStyle = {
|
|
|
20
20
|
hasError?: boolean
|
|
21
21
|
usePrefixes?: boolean
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
export type SelectOption = {
|
|
24
|
+
value: unknown,
|
|
25
|
+
label: string | React.ReactNode,
|
|
26
|
+
fixed?: boolean,
|
|
27
|
+
data?: { [key: string]: unknown }
|
|
28
|
+
}
|
|
24
29
|
/** Select (all other props are passed to react-select) **/
|
|
25
30
|
export type SelectProps = {
|
|
26
31
|
/** field name or path on state (used to match errors), e.g. 'date', 'company.email' **/
|
|
@@ -36,7 +41,7 @@ export type SelectProps = {
|
|
|
36
41
|
/** The onChange handler **/
|
|
37
42
|
onChange?: (event: { target: { name: string, value: unknown } }) => void
|
|
38
43
|
/** The options to display in the dropdown, data is used to pass additional data to the option **/
|
|
39
|
-
options:
|
|
44
|
+
options: SelectOption[]
|
|
40
45
|
/** The state object to get the value and check errors from **/
|
|
41
46
|
state?: { errors?: Errors, [key: string]: any } // was unknown|unknown[]
|
|
42
47
|
/** Select variations **/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitro-web",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.134",
|
|
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 🚀",
|