nitro-web 0.0.190 β 0.0.192
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 +2 -2
- package/components/partials/element/dropdown.tsx +3 -3
- package/components/partials/element/initials.tsx +20 -48
- package/components/partials/element/table.tsx +9 -2
- package/components/partials/form/select.tsx +85 -89
- package/components/partials/styleguide.tsx +26 -9
- package/package.json +1 -1
- package/server/constants.js +2 -0
- package/types/server/constants.d.ts +9 -0
- package/types/server/constants.d.ts.map +1 -1
- package/types/util.d.ts +3 -0
- package/types/util.d.ts.map +1 -1
- package/util.js +9 -0
package/client/index.ts
CHANGED
|
@@ -30,7 +30,7 @@ export { Calendar, type CalendarProps } from '../components/partials/element/cal
|
|
|
30
30
|
export { Dropdown, type DropdownProps, type DropdownOption } from '../components/partials/element/dropdown'
|
|
31
31
|
export { Filters, type FilterType, usePushChangesToPath } from '../components/partials/element/filters'
|
|
32
32
|
export { GithubLink } from '../components/partials/element/github-link'
|
|
33
|
-
export { Initials } from '../components/partials/element/initials'
|
|
33
|
+
export { Initials, getColorByLetter } from '../components/partials/element/initials'
|
|
34
34
|
export { Message, type MessageIcons } from '../components/partials/element/message'
|
|
35
35
|
export { Modal } from '../components/partials/element/modal'
|
|
36
36
|
export { Sidebar, type SidebarProps } from '../components/partials/element/sidebar'
|
|
@@ -50,7 +50,7 @@ export { type FieldColorProps } from '../components/partials/form/field-color'
|
|
|
50
50
|
export { type FieldCurrencyProps } from '../components/partials/form/field-currency'
|
|
51
51
|
export { type FieldDateProps } from '../components/partials/form/field-date'
|
|
52
52
|
export { Location } from '../components/partials/form/location'
|
|
53
|
-
export { Select,
|
|
53
|
+
export { Select, getSelectClassName, type SelectProps, type SelectOption } from '../components/partials/form/select'
|
|
54
54
|
|
|
55
55
|
// Component Other Components
|
|
56
56
|
export { IsFirstRender } from '../components/partials/is-first-render'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css } from 'twin.macro'
|
|
2
2
|
import { forwardRef, cloneElement } from 'react'
|
|
3
|
-
import {
|
|
3
|
+
import { getSelectClassName, twMerge } from 'nitro-web'
|
|
4
4
|
import { CheckCircleIcon } from '@heroicons/react/24/solid'
|
|
5
5
|
|
|
6
6
|
export type DropdownOption = {
|
|
@@ -61,7 +61,7 @@ export const Dropdown = forwardRef(function Dropdown({
|
|
|
61
61
|
isHoverable = isHoverable && !menuIsOpen
|
|
62
62
|
const dropdownRef = useRef<HTMLDivElement|null>(null)
|
|
63
63
|
const [isActive, setIsActive] = useState(!!menuIsOpen)
|
|
64
|
-
const menuStyle =
|
|
64
|
+
const menuStyle = getSelectClassName({ name: 'menu' })
|
|
65
65
|
const [direction, setDirection] = useState<null | 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'>(null)
|
|
66
66
|
const [ready, setReady] = useState(false)
|
|
67
67
|
|
|
@@ -187,7 +187,7 @@ export const Dropdown = forwardRef(function Dropdown({
|
|
|
187
187
|
{menuContent}
|
|
188
188
|
{
|
|
189
189
|
options && options.map((option, i) => {
|
|
190
|
-
const optionStyle =
|
|
190
|
+
const optionStyle = getSelectClassName({ name: 'option', usePrefixes: true, isSelected: option.isSelected })
|
|
191
191
|
return (
|
|
192
192
|
<li
|
|
193
193
|
key={i}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { twMerge } from 'nitro-web/util'
|
|
2
2
|
|
|
3
3
|
type InitialsProps = {
|
|
4
|
-
icon?: { initials: string, hex
|
|
4
|
+
icon?: { initials: string, hex?: string }
|
|
5
5
|
isBig?: boolean
|
|
6
6
|
isMedium?: boolean
|
|
7
7
|
isSmall?: boolean
|
|
@@ -10,57 +10,29 @@ type InitialsProps = {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export function Initials({ icon, isBig, isMedium, isSmall, isRound, className }: InitialsProps) {
|
|
13
|
+
const color = icon?.hex || icon?.initials && getColorByLetter(icon?.initials) || '#000000'
|
|
13
14
|
return (
|
|
14
15
|
<span
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
'
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
style={icon ? {backgroundColor: icon?.hex + '15', color: icon?.hex} : {}}
|
|
16
|
+
className={twMerge(
|
|
17
|
+
'nitro-initials flex items-center justify-center rounded-[5px] font-bold text-[11px] size-[24px]',
|
|
18
|
+
isBig && 'size-[40px] text-sm',
|
|
19
|
+
isMedium && 'size-[30px] text-xs',
|
|
20
|
+
isSmall && 'size-[22px]',
|
|
21
|
+
isRound && 'rounded-full',
|
|
22
|
+
!icon && 'w-0',
|
|
23
|
+
className
|
|
24
|
+
)}
|
|
25
|
+
style={icon ? {backgroundColor: color + '18', color: color} : {}}
|
|
27
26
|
>
|
|
28
27
|
{icon?.initials}
|
|
29
28
|
</span>
|
|
30
29
|
)
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
font-size: 11px;
|
|
41
|
-
width: 24px;
|
|
42
|
-
height: 24px;
|
|
43
|
-
// new
|
|
44
|
-
&.is-medium {
|
|
45
|
-
width: 30px;
|
|
46
|
-
height: 30px;
|
|
47
|
-
font-size: 12px;
|
|
48
|
-
}
|
|
49
|
-
// seen in select.jsx
|
|
50
|
-
&.is-small {
|
|
51
|
-
width: 22px;
|
|
52
|
-
height: 22px;
|
|
53
|
-
font-size: 11px;
|
|
54
|
-
}
|
|
55
|
-
&.is-big {
|
|
56
|
-
width: 48px;
|
|
57
|
-
height: 48px;
|
|
58
|
-
font-size: 14px;
|
|
59
|
-
}
|
|
60
|
-
&.is-round {
|
|
61
|
-
border-radius: 50%;
|
|
62
|
-
}
|
|
63
|
-
&.is-empty {
|
|
64
|
-
width: 0;
|
|
65
|
-
}
|
|
66
|
-
`
|
|
32
|
+
export function getColorByLetter(letter: string) {
|
|
33
|
+
const colors = ['#067306', '#AA33FF', '#FF54AF', '#F44336', '#c03c3c', '#5451e0', '#d88c1b']
|
|
34
|
+
const charIndex = letter.toLowerCase().charCodeAt(0) - 97
|
|
35
|
+
const charIndexLimited = (charIndex < 0 || charIndex > 25) ? 25 : charIndex
|
|
36
|
+
const index = Math.round(charIndexLimited / 25 * (colors.length-1))
|
|
37
|
+
return colors[index]
|
|
38
|
+
}
|
|
@@ -28,7 +28,7 @@ export type TableProps<T> = {
|
|
|
28
28
|
columns: TableColumn[]
|
|
29
29
|
rows: T[]
|
|
30
30
|
generateTd: (col: TableColumn, row: T, i: number, isLast: boolean) => JSX.Element | null
|
|
31
|
-
generateCheckboxActions?: (selectedRowIds: string[]) => JSX.Element | null
|
|
31
|
+
generateCheckboxActions?: (selectedRowIds: string[], setSelectedRowIds: (selectedRowIds: string[]) => void) => JSX.Element | null
|
|
32
32
|
headerHeightMin?: number
|
|
33
33
|
rowHeightMin?: number
|
|
34
34
|
rowContentHeightMax?: number
|
|
@@ -128,6 +128,12 @@ export function Table<T extends TableRow>({
|
|
|
128
128
|
// Reset selected rows when the location changes, or the number of rows changed (e.g. when a row is removed)
|
|
129
129
|
useEffect(() => setSelectedRowIds([]), [location.key, (rows ?? []).map(row => row._id || '').join(',')])
|
|
130
130
|
|
|
131
|
+
// Drive the header checkbox's indeterminate state when some (but not all) rows are selected
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
const input = document.querySelector<HTMLInputElement>(`input[name="checkbox-all-${rand}"]`)
|
|
134
|
+
if (input) input.indeterminate = selectedRowIds.length > 0 && selectedRowIds.length < rows.length
|
|
135
|
+
}, [selectedRowIds, rows, rand])
|
|
136
|
+
|
|
131
137
|
// --- Sorting ---
|
|
132
138
|
|
|
133
139
|
const navigate = useNavigate()
|
|
@@ -201,6 +207,7 @@ export function Table<T extends TableRow>({
|
|
|
201
207
|
size={checkboxSize}
|
|
202
208
|
name={`checkbox-all-${rand}`}
|
|
203
209
|
hitboxPadding={5}
|
|
210
|
+
checked={rows.length > 0 && selectedRowIds.length === rows.length}
|
|
204
211
|
className='!m-0 py-[5px]' // py-5 is required for hitbox (restricted to tabel cell height)
|
|
205
212
|
checkboxClassName={twMerge('border-foreground shadow-[0_1px_2px_0px_#0000001c]', checkboxClassName)}
|
|
206
213
|
onChange={(e) => onSelect('all', e.target.checked)}
|
|
@@ -208,7 +215,7 @@ export function Table<T extends TableRow>({
|
|
|
208
215
|
<div
|
|
209
216
|
className={`${selectedRowIds.length ? 'block' : 'hidden'} [&>*]:absolute [&>*]:inset-y-0 [&>*]:left-[35px] [&>*]:z-10 whitespace-nowrap`}
|
|
210
217
|
>
|
|
211
|
-
{generateCheckboxActions && generateCheckboxActions(selectedRowIds)}
|
|
218
|
+
{generateCheckboxActions && generateCheckboxActions(selectedRowIds, setSelectedRowIds)}
|
|
212
219
|
</div>
|
|
213
220
|
</Fragment>
|
|
214
221
|
: <span className={twMerge(
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
import { css } from 'twin.macro'
|
|
3
|
-
import { memo } from 'react'
|
|
3
|
+
import { memo, useMemo, Fragment } from 'react'
|
|
4
4
|
import ReactSelect, {
|
|
5
5
|
components, ControlProps, createFilter, OptionProps, SingleValueProps, ClearIndicatorProps,
|
|
6
|
-
DropdownIndicatorProps, MultiValueRemoveProps,
|
|
6
|
+
DropdownIndicatorProps, MultiValueRemoveProps, ClassNamesConfig,
|
|
7
|
+
ValueContainerProps,
|
|
7
8
|
} from 'react-select'
|
|
8
9
|
import { CheckCircleIcon } from '@heroicons/react/20/solid'
|
|
9
10
|
import { ChevronsUpDownIcon, XIcon } from 'lucide-react'
|
|
@@ -13,7 +14,8 @@ import { Errors } from 'nitro-web/types'
|
|
|
13
14
|
|
|
14
15
|
const filterFn = createFilter()
|
|
15
16
|
|
|
16
|
-
type
|
|
17
|
+
type NitroClassNamesConfig = ClassNamesConfig & { flag?: () => string }
|
|
18
|
+
type GetSelectClassName = {
|
|
17
19
|
name: string
|
|
18
20
|
isFocused?: boolean
|
|
19
21
|
isSelected?: boolean
|
|
@@ -24,7 +26,9 @@ type GetSelectStyle = {
|
|
|
24
26
|
export type SelectOption = {
|
|
25
27
|
value: unknown,
|
|
26
28
|
label: string | React.ReactNode,
|
|
27
|
-
fixed?: boolean,
|
|
29
|
+
fixed?: boolean,
|
|
30
|
+
IconLeft?: React.ReactNode,
|
|
31
|
+
flag?: string | React.ReactNode,
|
|
28
32
|
data?: { [key: string]: unknown }
|
|
29
33
|
}
|
|
30
34
|
/** Select (all other props are passed to react-select) **/
|
|
@@ -46,11 +50,13 @@ export type SelectProps = {
|
|
|
46
50
|
/** The state object to get the value and check errors from **/
|
|
47
51
|
state?: { errors?: Errors, [key: string]: any } // was unknown|unknown[]
|
|
48
52
|
/** Select variations **/
|
|
49
|
-
mode?:
|
|
53
|
+
mode?: string
|
|
50
54
|
/** Pass dependencies to break memoization, handy for onChange/onInputChange **/
|
|
51
55
|
deps?: unknown[]
|
|
52
56
|
/** title used to find related error messages */
|
|
53
57
|
errorTitle?: string|RegExp
|
|
58
|
+
/** Extend or override individual react-select part class names β merged with defaults via twMerge **/
|
|
59
|
+
classNames?: NitroClassNamesConfig
|
|
54
60
|
/** All other props are passed to react-select **/
|
|
55
61
|
[key: string]: unknown
|
|
56
62
|
}
|
|
@@ -60,7 +66,7 @@ export const Select = memo(SelectBase, (prev, next) => {
|
|
|
60
66
|
})
|
|
61
67
|
|
|
62
68
|
function SelectBase({
|
|
63
|
-
id, containerId, minMenuWidth, name, prefix='', onChange, options, state, mode='', errorTitle, ...props
|
|
69
|
+
id, containerId, minMenuWidth, name, prefix='', onChange, options, state, mode='', errorTitle, classNames, ...props
|
|
64
70
|
}: SelectProps) {
|
|
65
71
|
let value: unknown|unknown[]
|
|
66
72
|
const error = getErrorFromState(state, errorTitle || name)
|
|
@@ -77,8 +83,33 @@ function SelectBase({
|
|
|
77
83
|
// Input is always controlled if state is passed in
|
|
78
84
|
if (typeof state == 'object' && typeof value == 'undefined') value = ''
|
|
79
85
|
|
|
86
|
+
const mergedClassNames = useMemo(() => mergeClassNames({
|
|
87
|
+
// Input container
|
|
88
|
+
control: (p) => getSelectClassName({ name: 'control', hasError: !!error, ...p }),
|
|
89
|
+
valueContainer: () => getSelectClassName({ name: 'valueContainer' }),
|
|
90
|
+
// Input container objects
|
|
91
|
+
input: () => getSelectClassName({ name: 'input', hasError: !!error }),
|
|
92
|
+
multiValue: () => getSelectClassName({ name: 'multiValue' }),
|
|
93
|
+
multiValueLabel: () => '',
|
|
94
|
+
multiValueRemove: () => getSelectClassName({ name: 'multiValueRemove' }),
|
|
95
|
+
placeholder: () => getSelectClassName({ name: 'placeholder' }),
|
|
96
|
+
singleValue: (p) => getSelectClassName({ name: 'singleValue', hasError: !!error, isDisabled: p.isDisabled }),
|
|
97
|
+
// Indicators
|
|
98
|
+
clearIndicator: () => getSelectClassName({ name: 'clearIndicator' }),
|
|
99
|
+
dropdownIndicator: () => getSelectClassName({ name: 'dropdownIndicator' }),
|
|
100
|
+
indicatorsContainer: () => getSelectClassName({ name: 'indicatorsContainer' }),
|
|
101
|
+
indicatorSeparator: () => getSelectClassName({ name: 'indicatorSeparator' }),
|
|
102
|
+
// Dropmenu
|
|
103
|
+
menu: () => getSelectClassName({ name: 'menu' }),
|
|
104
|
+
groupHeading: () => getSelectClassName({ name: 'groupHeading' }),
|
|
105
|
+
noOptionsMessage: () => getSelectClassName({ name: 'noOptionsMessage' }),
|
|
106
|
+
option: (p) => getSelectClassName({ name: 'option', ...p }),
|
|
107
|
+
// Nitro specific
|
|
108
|
+
flag: () => getSelectClassName({ name: 'flag' }),
|
|
109
|
+
}, classNames), [!!error, classNames])
|
|
110
|
+
|
|
80
111
|
return (
|
|
81
|
-
<div css={style} class={'mt-2.5 mb-6 ' + twMerge(`mt-input-before mb-input-after nitro-select ${props.className||''}`)}>
|
|
112
|
+
<div css={style} class={'mt-2.5 mb-6 ' + twMerge(`mt-input-before mb-input-after nitro-select ${props.className || ''}`)}>
|
|
82
113
|
<ReactSelect
|
|
83
114
|
/**
|
|
84
115
|
* react-select prop quick reference (https://react-select.com/props#api):
|
|
@@ -113,28 +144,7 @@ function SelectBase({
|
|
|
113
144
|
}}
|
|
114
145
|
options={options}
|
|
115
146
|
value={value}
|
|
116
|
-
classNames={
|
|
117
|
-
// Input container
|
|
118
|
-
control: (p) => getSelectStyle({ name: 'control', hasError: !!error, ...p }),
|
|
119
|
-
valueContainer: () => getSelectStyle({ name: 'valueContainer' }),
|
|
120
|
-
// Input container objects
|
|
121
|
-
input: () => getSelectStyle({ name: 'input', hasError: !!error }),
|
|
122
|
-
multiValue: () => getSelectStyle({ name: 'multiValue' }),
|
|
123
|
-
multiValueLabel: () => '',
|
|
124
|
-
multiValueRemove: () => getSelectStyle({ name: 'multiValueRemove' }),
|
|
125
|
-
placeholder: () => getSelectStyle({ name: 'placeholder' }),
|
|
126
|
-
singleValue: (p) => getSelectStyle({ name: 'singleValue', hasError: !!error, isDisabled: p.isDisabled }),
|
|
127
|
-
// Indicators
|
|
128
|
-
clearIndicator: () => getSelectStyle({ name: 'clearIndicator' }),
|
|
129
|
-
dropdownIndicator: () => getSelectStyle({ name: 'dropdownIndicator' }),
|
|
130
|
-
indicatorsContainer: () => getSelectStyle({ name: 'indicatorsContainer' }),
|
|
131
|
-
indicatorSeparator: () => getSelectStyle({ name: 'indicatorSeparator' }),
|
|
132
|
-
// Dropmenu
|
|
133
|
-
menu: () => getSelectStyle({ name: 'menu' }),
|
|
134
|
-
groupHeading: () => getSelectStyle({ name: 'groupHeading' }),
|
|
135
|
-
noOptionsMessage: () => getSelectStyle({ name: 'noOptionsMessage' }),
|
|
136
|
-
option: (p) => getSelectStyle({ name: 'option', ...p }),
|
|
137
|
-
}}
|
|
147
|
+
classNames={mergedClassNames}
|
|
138
148
|
components={{
|
|
139
149
|
Control,
|
|
140
150
|
SingleValue,
|
|
@@ -142,6 +152,7 @@ function SelectBase({
|
|
|
142
152
|
DropdownIndicator,
|
|
143
153
|
ClearIndicator,
|
|
144
154
|
MultiValueRemove,
|
|
155
|
+
ValueContainer,
|
|
145
156
|
}}
|
|
146
157
|
styles={{
|
|
147
158
|
menu: (base) => ({
|
|
@@ -173,55 +184,55 @@ function SelectBase({
|
|
|
173
184
|
}
|
|
174
185
|
|
|
175
186
|
function Control({ children, ...props }: ControlProps) {
|
|
176
|
-
//
|
|
177
|
-
// todo: check that the flag/prefix looks okay
|
|
178
|
-
const selectedOption = props.getValue()[0]
|
|
179
|
-
const optionFlag = (selectedOption as { flag?: string })?.flag
|
|
187
|
+
// const selectedOption = props.getValue()[0]
|
|
180
188
|
const _nitro = (props.selectProps as { _nitro?: { prefix?: string, mode?: string } })?._nitro
|
|
181
189
|
return (
|
|
182
190
|
<components.Control {...props}>
|
|
183
|
-
{
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
return (
|
|
187
|
-
<>
|
|
188
|
-
<span class="relative right-[2px]">{_nitro?.prefix}</span>
|
|
189
|
-
{children}
|
|
190
|
-
</>
|
|
191
|
-
)
|
|
192
|
-
} else if (_nitro?.mode == 'country') {
|
|
193
|
-
return (
|
|
194
|
-
<>
|
|
195
|
-
{ optionFlag && <Flag flag={optionFlag} /> }
|
|
196
|
-
{children}
|
|
197
|
-
</>
|
|
198
|
-
)
|
|
199
|
-
} else {
|
|
200
|
-
return children
|
|
201
|
-
}
|
|
202
|
-
})()
|
|
191
|
+
{_nitro?.prefix
|
|
192
|
+
? <Fragment><span class="relative right-[2px]">{_nitro.prefix}</span>{children}</Fragment>
|
|
193
|
+
: children
|
|
203
194
|
}
|
|
204
195
|
</components.Control>
|
|
205
196
|
)
|
|
206
197
|
}
|
|
207
198
|
|
|
208
|
-
|
|
209
|
-
|
|
199
|
+
|
|
200
|
+
function ValueContainer({ children, ...props}: ValueContainerProps) {
|
|
210
201
|
return (
|
|
202
|
+
// <div class="cat-tre">
|
|
203
|
+
<components.ValueContainer {...props}>{children}</components.ValueContainer>
|
|
204
|
+
// </div>
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function SingleValue({ children, ...props }: SingleValueProps) {
|
|
209
|
+
const selectedOption = props.getValue()[0] as { labelControl?: string, flag?: string | React.ReactNode, IconLeft?: React.ReactNode }
|
|
210
|
+
// @ts-expect-error
|
|
211
|
+
const flagClassName = props.getClassNames('flag')
|
|
212
|
+
|
|
213
|
+
return (
|
|
211
214
|
<components.SingleValue {...props}>
|
|
212
|
-
|
|
215
|
+
{
|
|
216
|
+
selectedOption?.labelControl
|
|
217
|
+
? <Fragment>{selectedOption.labelControl}</Fragment>
|
|
218
|
+
: <Fragment>
|
|
219
|
+
{selectedOption?.flag && <span className={flagClassName}>{selectedOption.flag}</span>}
|
|
220
|
+
{selectedOption?.IconLeft}
|
|
221
|
+
<span class="overflow-hidden text-ellipsis whitespace-nowrap">{children}</span>
|
|
222
|
+
</Fragment>
|
|
223
|
+
}
|
|
213
224
|
</components.SingleValue>
|
|
214
225
|
)
|
|
215
226
|
}
|
|
216
227
|
|
|
217
228
|
function Option(props: OptionProps) {
|
|
218
|
-
|
|
219
|
-
const
|
|
220
|
-
|
|
229
|
+
const data = props.data as { className?: string, flag?: string | React.ReactNode, IconLeft?: React.ReactNode }
|
|
230
|
+
// const _nitro = (props.selectProps as { _nitro?: { mode?: string } })?._nitro
|
|
231
|
+
// @ts-expect-error
|
|
232
|
+
const flagClassName = props.getClassNames('flag')
|
|
221
233
|
return (
|
|
222
234
|
<components.Option className={data.className} {...props}>
|
|
223
|
-
|
|
224
|
-
<span class="flex-auto">{props.label}</span>
|
|
235
|
+
<span class="flex-auto min-w-0">{data.flag && <span className={flagClassName}>{data.flag}</span>}{data.IconLeft}{props.label}</span>
|
|
225
236
|
{props.isSelected && <CheckCircleIcon className="size-[22px] text-primary -my-1 -mx-0.5" />}
|
|
226
237
|
</components.Option>
|
|
227
238
|
)
|
|
@@ -251,16 +262,7 @@ const MultiValueRemove = (props: MultiValueRemoveProps) => {
|
|
|
251
262
|
)
|
|
252
263
|
}
|
|
253
264
|
|
|
254
|
-
|
|
255
|
-
if (!flag) return null
|
|
256
|
-
// todo: public needs to come from webpack
|
|
257
|
-
const publicPath = '/'
|
|
258
|
-
return (
|
|
259
|
-
<span class="flag" style={{ backgroundImage: `url(${publicPath}assets/imgs/flags/${flag}.svg)` }} />
|
|
260
|
-
)
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
const selectStyles = {
|
|
265
|
+
const selectClassNames = {
|
|
264
266
|
// Based off https://www.jussivirtanen.fi/writing/styling-react-select-with-tailwind
|
|
265
267
|
// Input container
|
|
266
268
|
control: {
|
|
@@ -270,7 +272,7 @@ const selectStyles = {
|
|
|
270
272
|
error: 'outline-danger',
|
|
271
273
|
disabled: 'cursor-not-allowed bg-input-disabled-bg',
|
|
272
274
|
},
|
|
273
|
-
valueContainer: 'py-[9px] px-[12px] py-input-y px-input-x
|
|
275
|
+
valueContainer: 'gap-1 py-[9px] px-[12px] py-input-y px-input-x', // dont twMerge (input-x is optional)
|
|
274
276
|
// Input container objects
|
|
275
277
|
input: {
|
|
276
278
|
base: 'text-input',
|
|
@@ -281,14 +283,14 @@ const selectStyles = {
|
|
|
281
283
|
multiValueRemove: 'border border-black/10 bg-clip-content bg-white rounded-md text-foreground hover:bg-red-50',
|
|
282
284
|
placeholder: 'text-input-placeholder',
|
|
283
285
|
singleValue: {
|
|
284
|
-
base: 'text-input',
|
|
286
|
+
base: 'text-input !overflow-visible min-w-0 flex items-center',
|
|
285
287
|
error: 'text-danger-foreground',
|
|
286
288
|
disabled: 'text-input-disabled',
|
|
287
289
|
},
|
|
288
290
|
// Icon indicators
|
|
289
291
|
clearIndicator: 'text-gray-500 p-1 rounded-md hover:bg-red-50 hover:text-danger-foreground',
|
|
290
292
|
dropdownIndicator: 'p-1 hover:bg-gray-100 text-gray-500 rounded-md hover:text-black',
|
|
291
|
-
indicatorsContainer: 'p-1
|
|
293
|
+
indicatorsContainer: 'p-1 pl-0 pr-2 gap-1',
|
|
292
294
|
indicatorSeparator: 'py-0.5 before:content-[""] before:block before:bg-gray-100 before:w-px before:h-full',
|
|
293
295
|
// Dropdown menu
|
|
294
296
|
menu: 'mt-1.5 border border-dropdown-ul-border bg-white rounded-md text-input-base overflow-hidden shadow-dropdown-ul',
|
|
@@ -299,12 +301,14 @@ const selectStyles = {
|
|
|
299
301
|
hover: 'bg-gray-50',
|
|
300
302
|
selected: '!bg-gray-100 text-dropdown-selected-foreground',
|
|
301
303
|
},
|
|
304
|
+
// Nitro specific
|
|
305
|
+
flag: 'align-middle text-[1.2em] leading-[1em] mr-1.5 flex-shrink-0',
|
|
302
306
|
}
|
|
303
307
|
|
|
304
|
-
export function
|
|
308
|
+
export function getSelectClassName({ name, isFocused, isSelected, isDisabled, hasError, usePrefixes }: GetSelectClassName) {
|
|
305
309
|
// Returns a class list that conditionally includes hover/focus modifier classes, or uses CSS modifiers, e.g. hover:, focus:
|
|
306
310
|
// @ts-expect-error
|
|
307
|
-
const obj =
|
|
311
|
+
const obj = selectClassNames[name]
|
|
308
312
|
let output = obj?.base
|
|
309
313
|
if (typeof obj == 'string') return obj // no modifiers
|
|
310
314
|
|
|
@@ -322,6 +326,11 @@ export function getSelectStyle({ name, isFocused, isSelected, isDisabled, hasErr
|
|
|
322
326
|
return twMerge(output)
|
|
323
327
|
}
|
|
324
328
|
|
|
329
|
+
function mergeClassNames(defaults: NitroClassNamesConfig, custom?: NitroClassNamesConfig): NitroClassNamesConfig {
|
|
330
|
+
if (!custom) return defaults
|
|
331
|
+
return { ...defaults, ...custom }
|
|
332
|
+
}
|
|
333
|
+
|
|
325
334
|
const style = css`
|
|
326
335
|
/*
|
|
327
336
|
todo: add these as tailwind classes
|
|
@@ -353,17 +362,4 @@ const style = css`
|
|
|
353
362
|
}
|
|
354
363
|
} */
|
|
355
364
|
|
|
356
|
-
/*
|
|
357
|
-
.flag {
|
|
358
|
-
// https://github.com/lipis/flag-icons
|
|
359
|
-
flex-shrink: 0;
|
|
360
|
-
margin-right: 10px;
|
|
361
|
-
width: 21px;
|
|
362
|
-
height: 14px;
|
|
363
|
-
background-size: cover;
|
|
364
|
-
background-repeat: no-repeat;
|
|
365
|
-
background-position: center;
|
|
366
|
-
border-radius: 3px;
|
|
367
|
-
overflow: hidden;
|
|
368
|
-
}*/
|
|
369
365
|
`
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Drop, Dropdown, Field, Select, Button as ButtonNitro, Checkbox, GithubLink, Modal, Calendar, injectedConfig, TimePicker,
|
|
3
3
|
Filters, FilterType, Table, TableColumn, usePushChangesToPath, Spinner, LoadingWithDots,
|
|
4
|
+
Initials,
|
|
4
5
|
} from 'nitro-web'
|
|
6
|
+
import { countryOptions } from 'nitro-web/constants'
|
|
5
7
|
import { date, getCurrencyOptions, onChange, ucFirst } from 'nitro-web/util'
|
|
6
8
|
import { Check, EllipsisVerticalIcon, FileEditIcon } from 'lucide-react'
|
|
7
9
|
import React from 'react'
|
|
@@ -62,8 +64,9 @@ export function Styleguide({ className, elements, children, currencies }: Styleg
|
|
|
62
64
|
amount: 100,
|
|
63
65
|
brandColor: '#F3CA5F',
|
|
64
66
|
colorsMulti: ['blue', 'green'],
|
|
65
|
-
country: '
|
|
67
|
+
country: 'cd',
|
|
66
68
|
currency: 'nzd',
|
|
69
|
+
customer: '1',
|
|
67
70
|
date: Date.now(),
|
|
68
71
|
dateRange: [Date.now(), Date.now() + 1000 * 60 * 60 * 24 * 33],
|
|
69
72
|
dateMultiple: [Date.now(), Date.now() + 1000 * 60 * 60 * 24 * 2],
|
|
@@ -242,8 +245,8 @@ export function Styleguide({ className, elements, children, currencies }: Styleg
|
|
|
242
245
|
Components are styled using
|
|
243
246
|
<a href="https://v3.tailwindcss.com/docs/configuration" class="underline" target="_blank" rel="noreferrer">TailwindCSS</a>.
|
|
244
247
|
{injectedConfig.isDemo &&
|
|
245
|
-
<React.Fragment>
|
|
246
|
-
|
|
248
|
+
<React.Fragment>
|
|
249
|
+
<a href="#" class="underline" onClick={indirectlyChangeTheState}>Click here</a> to indirectly change the state
|
|
247
250
|
</React.Fragment>
|
|
248
251
|
}
|
|
249
252
|
</p>
|
|
@@ -448,10 +451,12 @@ export function Styleguide({ className, elements, children, currencies }: Styleg
|
|
|
448
451
|
<Select
|
|
449
452
|
// https://github.com/lipis/flag-icons
|
|
450
453
|
name="country"
|
|
451
|
-
mode="country"
|
|
452
454
|
state={state}
|
|
453
|
-
options={
|
|
455
|
+
options={countryOptions}
|
|
454
456
|
onChange={(e) => onChange(e, setState)}
|
|
457
|
+
// menuIsOpen={true}
|
|
458
|
+
// useMemo(() => [{ value: 'nz', label: 'New Zealand' }, { value: 'au', label: 'Australia' }], [])}
|
|
459
|
+
// classNames={{ flag: () => 'mr-4' }}
|
|
455
460
|
/>
|
|
456
461
|
</div>
|
|
457
462
|
<div>
|
|
@@ -466,7 +471,7 @@ export function Styleguide({ className, elements, children, currencies }: Styleg
|
|
|
466
471
|
onInputChange={onCustomerSearch}
|
|
467
472
|
options={useMemo(() => [
|
|
468
473
|
{
|
|
469
|
-
className: '
|
|
474
|
+
className: 'border-bottom-with-space',
|
|
470
475
|
fixed: true,
|
|
471
476
|
value: '0',
|
|
472
477
|
label: (
|
|
@@ -476,9 +481,21 @@ export function Styleguide({ className, elements, children, currencies }: Styleg
|
|
|
476
481
|
</React.Fragment>
|
|
477
482
|
),
|
|
478
483
|
},
|
|
479
|
-
{
|
|
480
|
-
|
|
481
|
-
|
|
484
|
+
{
|
|
485
|
+
value: '1',
|
|
486
|
+
label: 'Wayne Enterprises',
|
|
487
|
+
IconLeft: <Initials icon={{ initials: 'WE' }} className="inline-flex my-[-3px] mr-2 flex-shrink-0" />,
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
value: '2',
|
|
491
|
+
label: 'Iceberg Lounge Limited',
|
|
492
|
+
IconLeft: <Initials icon={{ initials: 'IL' }} className="inline-flex my-[-3px] mr-2 flex-shrink-0" />,
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
value: '3',
|
|
496
|
+
label: 'Ace Chemicals Company',
|
|
497
|
+
IconLeft: <Initials icon={{ initials: 'AC' }} className="inline-flex my-[-3px] mr-2 flex-shrink-0" />,
|
|
498
|
+
},
|
|
482
499
|
], [customerSearch])}
|
|
483
500
|
/>
|
|
484
501
|
</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitro-web",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.192",
|
|
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/server/constants.js
CHANGED
|
@@ -266,3 +266,5 @@ export const countries = {
|
|
|
266
266
|
zm: { name: 'Zambia', flag: 'πΏπ²' },
|
|
267
267
|
zw: { name: 'Zimbabwe', flag: 'πΏπΌ' },
|
|
268
268
|
}
|
|
269
|
+
export const countryOptions = Object.entries(countries).map(([k, c]) => ({ value: /**@type {Country}*/(k), label: c.name, flag: c.flag }))
|
|
270
|
+
export const currencyOptions = Object.entries(currencies).map(([k, c]) => ({ value: /**@type {Currency}*/(k), label: c.name }))
|
|
@@ -22,6 +22,15 @@ export const countries: { [key in Country]: {
|
|
|
22
22
|
name: string;
|
|
23
23
|
flag: string;
|
|
24
24
|
}; };
|
|
25
|
+
export const countryOptions: {
|
|
26
|
+
value: Country;
|
|
27
|
+
label: string;
|
|
28
|
+
flag: string;
|
|
29
|
+
}[];
|
|
30
|
+
export const currencyOptions: {
|
|
31
|
+
value: Currency;
|
|
32
|
+
label: string;
|
|
33
|
+
}[];
|
|
25
34
|
export type Country = "af" | "al" | "dz" | "ad" | "ao" | "ag" | "ar" | "am" | "au" | "at" | "az" | "bs" | "bh" | "bd" | "bb" | "by" | "be" | "bz" | "bj" | "bt" | "bo" | "ba" | "bw" | "br" | "bn" | "bg" | "bf" | "bi" | "cv" | "kh" | "cm" | "ca" | "cf" | "td" | "cl" | "cn" | "co" | "km" | "cg" | "cr" | "hr" | "cu" | "cy" | "cz" | "cd" | "dk" | "dj" | "dm" | "do" | "ec" | "eg" | "sv" | "gq" | "er" | "ee" | "sz" | "et" | "fj" | "fi" | "fr" | "ga" | "gm" | "ge" | "de" | "gh" | "gr" | "gd" | "gt" | "gn" | "gw" | "gy" | "ht" | "hn" | "hu" | "is" | "in" | "id" | "ir" | "iq" | "ie" | "il" | "it" | "jm" | "jp" | "jo" | "kz" | "ke" | "ki" | "kw" | "kg" | "la" | "lv" | "lb" | "ls" | "lr" | "ly" | "li" | "lt" | "lu" | "mg" | "mw" | "my" | "mv" | "ml" | "mt" | "mh" | "mr" | "mu" | "mx" | "fm" | "md" | "mc" | "mn" | "me" | "ma" | "mz" | "mm" | "na" | "nr" | "np" | "nl" | "nz" | "ni" | "ne" | "ng" | "kp" | "mk" | "no" | "om" | "pk" | "pw" | "pa" | "pg" | "py" | "pe" | "ph" | "pl" | "pt" | "qa" | "ro" | "ru" | "rw" | "kn" | "lc" | "vc" | "ws" | "sm" | "st" | "sa" | "sn" | "rs" | "sc" | "sl" | "sg" | "sk" | "si" | "sb" | "so" | "za" | "kr" | "ss" | "es" | "lk" | "sd" | "sr" | "se" | "ch" | "sy" | "tj" | "tz" | "th" | "tl" | "tg" | "to" | "tt" | "tn" | "tr" | "tm" | "tv" | "ug" | "ua" | "ae" | "gb" | "us" | "uy" | "uz" | "vu" | "va" | "ve" | "vn" | "ye" | "zm" | "zw";
|
|
26
35
|
export type Currency = "nzd" | "aud" | "usd" | "gbp" | "btc" | "aed" | "ars" | "bdt" | "bhd" | "brl" | "cad" | "chf" | "clp" | "cny" | "cop" | "czk" | "dkk" | "egp" | "eur" | "hkd" | "huf" | "idr" | "ils" | "inr" | "jod" | "jpy" | "kes" | "krw" | "kwd" | "lkr" | "mad" | "mxn" | "myr" | "ngn" | "nok" | "omr" | "pen" | "php" | "pkt" | "pln" | "qar" | "ron" | "rub" | "sar" | "sek" | "sgd" | "thb" | "try" | "twd" | "uah" | "vnd" | "zar";
|
|
27
36
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../server/constants.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,sFAAsF;AACtF,yBADW,GAAG,GAAG,IAAI,QAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAE,CAsDjF;AAED,mEAAmE;AACnE,wBADW,GAAG,GAAG,IAAI,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAE,CAmM9D;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../server/constants.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,sFAAsF;AACtF,yBADW,GAAG,GAAG,IAAI,QAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAE,CAsDjF;AAED,mEAAmE;AACnE,wBADW,GAAG,GAAG,IAAI,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAE,CAmM9D;AACD;WAA4F,OAAO;;;IAAuC;AAC1I;WAA8F,QAAQ;;IAAyB;sBA1QlH,IAAI,GAAC,IAAI,GAAC,IAAI,GAAC,IAAI,GAAC,IAAI,GAAC,IAAI,GAAC,IAAI,GAAC,IAAI,GAAC,IAAI,GAAC,IAAI,GAAC,IAAI,GAAC,IA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AK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAC1H,KAAQ,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK,GAAC,KAAK"}
|
package/types/util.d.ts
CHANGED
|
@@ -871,6 +871,9 @@ export function twMerge(...args: (string | null | undefined | false | 0 | 0n)[])
|
|
|
871
871
|
*/
|
|
872
872
|
export function ucFirst(string: string): string;
|
|
873
873
|
export { TZDate } from "@date-fns/tz";
|
|
874
|
+
export function getIdFromObject(object: {
|
|
875
|
+
_id?: string;
|
|
876
|
+
} | string | undefined): string;
|
|
874
877
|
/**
|
|
875
878
|
* Returns a list of response errors
|
|
876
879
|
*/
|
package/types/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../util.js"],"names":[],"mappings":"AAmDA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BC;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,s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E;;;;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/util.js
CHANGED
|
@@ -855,6 +855,15 @@ export function getErrorFromState (state, path) {
|
|
|
855
855
|
}
|
|
856
856
|
}
|
|
857
857
|
|
|
858
|
+
/**
|
|
859
|
+
* Get the id from an object
|
|
860
|
+
* @param {{_id?: string}|string|undefined} object - The object to get the id from
|
|
861
|
+
* @returns {string} The id from the object
|
|
862
|
+
*/
|
|
863
|
+
export const getIdFromObject = (object) => {
|
|
864
|
+
return typeof object === 'object' && object?._id ? object._id : ''
|
|
865
|
+
}
|
|
866
|
+
|
|
858
867
|
/**
|
|
859
868
|
* Get the width of a prefix
|
|
860
869
|
* @param {string} prefix
|