nitro-web 0.3.1 → 0.3.2

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.
@@ -2,7 +2,7 @@ import { useEffect, useRef, useState } from 'react'
2
2
  import { ImageIcon } from 'lucide-react'
3
3
  import { DropHandler } from 'nitro-web'
4
4
  import { deepFind, getErrorFromState, s3Image, twMerge } from 'nitro-web/util'
5
- import type { Errors, MonasteryImage } from 'nitro-web/types'
5
+ import type { Errors, MonasteryFile } from 'nitro-web/types'
6
6
 
7
7
  type ImageDropProps = {
8
8
  awsUrl?: string
@@ -20,7 +20,7 @@ type ImageDropProps = {
20
20
  inheritedNote?: string
21
21
  }
22
22
 
23
- type ImageValue = File | MonasteryImage | null
23
+ type ImageValue = File | MonasteryFile | null
24
24
 
25
25
  export function ImageDrop({ awsUrl, className, id, name, onChange, state, inheritedUrl, inheritedNote }: ImageDropProps) {
26
26
  // A friendlier Drop for images: the whole area is clickable, with an outlined image icon and a preview
@@ -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, MonasteryImage } from 'nitro-web/types'
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 | MonasteryImage | null
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 | MonasteryImage | null)))()
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 | MonasteryImage | null) {
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.1",
3
+ "version": "0.3.2",
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.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": "",
@@ -4,7 +4,7 @@ import { ucFirst, fullName } from 'nitro-web/util'
4
4
  export default {
5
5
 
6
6
  fields: {
7
- avatar: { type: 'image' },
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/types.ts CHANGED
@@ -29,14 +29,14 @@ export type User = {
29
29
  firstName?: string
30
30
  lastName?: string
31
31
  name?: string
32
- avatar?: MonasteryImage
32
+ avatar?: MonasteryFile
33
33
  isAdmin?: boolean
34
34
  }
35
35
 
36
36
  export type Error = { title: string, detail: string }
37
37
  export type Errors = Error[]
38
38
 
39
- export type MonasteryImage = {
39
+ export type MonasteryFile = {
40
40
  url: string
41
41
  filename: string
42
42
  path: string