nitro-web 0.0.111 → 0.0.113

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.
@@ -309,6 +309,7 @@ export async function getStore(user) {
309
309
 
310
310
  export async function signinAndGetStore(user, isDesktop, getStore) {
311
311
  if (user.loginActive === false) throw 'This user is not available.'
312
+ if (!getStore) throw new Error('Please provide a getStore function')
312
313
  user.desktop = isDesktop
313
314
 
314
315
  const jwt = jsonwebtoken.sign({ _id: user._id }, JWT_SECRET, { expiresIn: '30d' })
@@ -11,7 +11,14 @@ type DropdownProps = {
11
11
  css?: string
12
12
  /** The direction of the menu **/
13
13
  dir?: 'bottom-left'|'bottom-right'|'top-left'|'top-right'
14
- options?: { label: string|React.ReactNode, onClick?: Function, isSelected?: boolean, icon?: React.ReactNode, className?: string }[]
14
+ options?: {
15
+ label: string|React.ReactNode,
16
+ onClick?: Function,
17
+ isSelected?: boolean,
18
+ icon?: React.ReactNode,
19
+ iconLeft?: React.ReactNode,
20
+ className?: string
21
+ }[]
15
22
  /** Whether the dropdown is hoverable **/
16
23
  isHoverable?: boolean
17
24
  /** The content to render inside the top of the dropdown **/
@@ -22,6 +29,7 @@ type DropdownProps = {
22
29
  menuToggles?: boolean
23
30
  /** The minimum width of the menu **/
24
31
  minWidth?: number | string
32
+ maxHeight?: number | string
25
33
  toggleCallback?: (isActive: boolean) => void
26
34
  }
27
35
 
@@ -39,6 +47,7 @@ export const Dropdown = forwardRef(function Dropdown({
39
47
  menuIsOpen,
40
48
  menuToggles=true,
41
49
  minWidth,
50
+ maxHeight,
42
51
  toggleCallback,
43
52
  }: DropdownProps, ref) {
44
53
  // https://letsbuildui.dev/articles/building-a-dropdown-menu-component-with-react-hooks
@@ -156,7 +165,11 @@ export const Dropdown = forwardRef(function Dropdown({
156
165
  })
157
166
  }
158
167
  <ul
159
- style={{ minWidth }}
168
+ style={{
169
+ minWidth: minWidth,
170
+ maxHeight: maxHeight,
171
+ ...(maxHeight ? { overflow: 'auto' } : {}),
172
+ }}
160
173
  class={
161
174
  twMerge(`${menuStyle} ${ready ? 'is-ready' : ''} absolute invisible opacity-0 select-none min-w-full z-[1] ${menuClassName||''}`)}
162
175
  >
@@ -170,6 +183,7 @@ export const Dropdown = forwardRef(function Dropdown({
170
183
  className={twMerge(`${optionStyle} ${option.className} ${menuOptionClassName}`)}
171
184
  onClick={(e: React.MouseEvent) => onClick(option, e)}
172
185
  >
186
+ { !!option.iconLeft && option.iconLeft }
173
187
  <span class="flex-auto">{option.label}</span>
174
188
  { !!option.icon && option.icon }
175
189
  { option.isSelected && <CheckCircleIcon className="size-[22px] text-primary -my-1 -mx-0.5" /> }
@@ -14,6 +14,7 @@ export interface TableColumn {
14
14
  /** Use if the value is different from the sortBy */
15
15
  sortByValue?: string
16
16
  align?: 'left' | 'center' | 'right'
17
+ isHidden?: boolean
17
18
  }
18
19
 
19
20
  export type TableRow = {
@@ -83,6 +84,7 @@ export function Table<T extends TableRow>({
83
84
  rowLinesMax: typeof col.rowLinesMax != 'undefined' ? col.rowLinesMax : rowLinesMax,
84
85
  sortByValue: col.sortByValue || col.value,
85
86
  align: col.align || 'left',
87
+ isHidden: col.isHidden ?? false,
86
88
  }))
87
89
  return cols
88
90
  }, [columnsProp])
@@ -124,7 +126,7 @@ export function Table<T extends TableRow>({
124
126
  return (
125
127
  <div
126
128
  style={{ marginTop: -rowGap }}
127
- className={twMerge('overflow-x-auto thin-scrollbar', className)}
129
+ className={twMerge('overflow-x-auto thin-scrollbar min-h-full', className)}
128
130
  >
129
131
  <div
130
132
  style={{ borderSpacing: `0 ${rowGap}px` }}
@@ -139,6 +141,8 @@ export function Table<T extends TableRow>({
139
141
  const sideColorPadding = sideColor && rows.length > 0 ? sideColor.width + 5 : 0
140
142
  const pl = sideColorPadding + (j == 0 ? columnPaddingX : columnGap)
141
143
  const pr = j == columns.length - 1 ? columnPaddingX : columnGap
144
+
145
+ if(col.isHidden) return <></>
142
146
  return (
143
147
  <div
144
148
  key={j}
@@ -219,6 +223,8 @@ export function Table<T extends TableRow>({
219
223
  const sideColor = j == 0 && rowSideColor ? rowSideColor(row) : undefined
220
224
  const pl = j == 0 ? columnPaddingX : columnGap
221
225
  const pr = j == columns.length - 1 ? columnPaddingX : columnGap
226
+
227
+ if(col.isHidden) return <></>
222
228
  return (
223
229
  <div
224
230
  key={j}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitro-web",
3
- "version": "0.0.111",
3
+ "version": "0.0.113",
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 🚀",
@@ -1 +1 @@
1
- {"version":3,"file":"auth.api.d.ts","sourceRoot":"","sources":["../../../components/auth/auth.api.js"],"names":[],"mappings":"AAmQA,qGAyCC;AAED;;GAKC;AAED,0FAOC;AAED;;;;iBAkDC;AAED,mDAOC;AAED,4CAYC;AAED,kFAiBC;AA5YD;;;;;;;;;;;;;;;;;;EAqBC;AAmED,0DAEC;AAkCD,mDAEC;AAnBD,iDAeC;AA9BD,2DAaC;AAuBD,sEAuBC;AAED,kEAuBC;AAED,sEAqCC;AAED,2DAwBC;AA1ND,4DA+DC"}
1
+ {"version":3,"file":"auth.api.d.ts","sourceRoot":"","sources":["../../../components/auth/auth.api.js"],"names":[],"mappings":"AAmQA,qGAyCC;AAED;;GAKC;AAED,0FAQC;AAED;;;;iBAkDC;AAED,mDAOC;AAED,4CAYC;AAED,kFAiBC;AA7YD;;;;;;;;;;;;;;;;;;EAqBC;AAmED,0DAEC;AAkCD,mDAEC;AAnBD,iDAeC;AA9BD,2DAaC;AAuBD,sEAuBC;AAED,kEAuBC;AAED,sEAqCC;AAED,2DAwBC;AA1ND,4DA+DC"}