@oxcide-ui/schema 0.0.3
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/.turbo/turbo-build.log +58 -0
- package/CHANGELOG.md +15 -0
- package/dist/index.cjs +436 -0
- package/dist/index.d.cts +884 -0
- package/dist/index.d.ts +884 -0
- package/dist/index.js +381 -0
- package/package.json +43 -0
- package/scripts/sync-types.ts +105 -0
- package/src/components/badge.ts +31 -0
- package/src/components/box.ts +18 -0
- package/src/components/button.ts +1333 -0
- package/src/components/checkbox.ts +715 -0
- package/src/components/dialog.ts +720 -0
- package/src/components/icon.ts +665 -0
- package/src/components/index.ts +12 -0
- package/src/components/input.ts +1330 -0
- package/src/components/radiobutton.ts +67 -0
- package/src/components/stack.ts +38 -0
- package/src/components/switch.ts +1326 -0
- package/src/components/tag.ts +670 -0
- package/src/components/toast.ts +69 -0
- package/src/index.ts +2 -0
- package/src/registry.ts +52 -0
- package/tsconfig.json +7 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { IconName } from '@oxcide-ui/icons'
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
export const toastSeveritySchema = z.enum([
|
|
5
|
+
'success',
|
|
6
|
+
'info',
|
|
7
|
+
'warning',
|
|
8
|
+
'danger',
|
|
9
|
+
'secondary',
|
|
10
|
+
'help',
|
|
11
|
+
'contrast',
|
|
12
|
+
'primary'
|
|
13
|
+
])
|
|
14
|
+
|
|
15
|
+
export const toastMessageSchema = z.object({
|
|
16
|
+
id: z.string().optional(),
|
|
17
|
+
severity: toastSeveritySchema.default('info'),
|
|
18
|
+
summary: z.string().optional(),
|
|
19
|
+
detail: z.string().optional(),
|
|
20
|
+
life: z.number().optional().default(3000),
|
|
21
|
+
sticky: z.boolean().optional().default(false),
|
|
22
|
+
closable: z.boolean().optional().default(true),
|
|
23
|
+
icon: z.string().optional() as z.ZodType<IconName | undefined>,
|
|
24
|
+
group: z.string().optional()
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export const toastPropsSchema = z.object({
|
|
28
|
+
position: z
|
|
29
|
+
.enum(['top-left', 'top-center', 'top-right', 'bottom-left', 'bottom-center', 'bottom-right', 'center'])
|
|
30
|
+
.default('top-right'),
|
|
31
|
+
group: z.string().optional(),
|
|
32
|
+
baseZIndex: z.number().optional().default(0),
|
|
33
|
+
autoZIndex: z.boolean().optional().default(true),
|
|
34
|
+
/** Teleport target selector or element */
|
|
35
|
+
appendTo: z.any().default('#teleports')
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
export type ToastSeverity = z.infer<typeof toastSeveritySchema>
|
|
39
|
+
export type ToastMessage = z.infer<typeof toastMessageSchema>
|
|
40
|
+
/* @oxcide-sync:source
|
|
41
|
+
export type ToastProps = z.input<typeof toastPropsSchema>
|
|
42
|
+
export type ToastResolvedProps = z.infer<typeof toastPropsSchema>
|
|
43
|
+
@oxcide-sync:end */
|
|
44
|
+
export interface ToastProps {
|
|
45
|
+
position?:
|
|
46
|
+
| 'top-left'
|
|
47
|
+
| 'top-center'
|
|
48
|
+
| 'top-right'
|
|
49
|
+
| 'bottom-left'
|
|
50
|
+
| 'bottom-center'
|
|
51
|
+
| 'bottom-right'
|
|
52
|
+
| 'center'
|
|
53
|
+
| undefined
|
|
54
|
+
group?: string | undefined
|
|
55
|
+
baseZIndex?: number | undefined
|
|
56
|
+
autoZIndex?: boolean | undefined
|
|
57
|
+
appendTo?: any
|
|
58
|
+
}
|
|
59
|
+
export type ToastResolvedProps = {
|
|
60
|
+
position: 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'center'
|
|
61
|
+
baseZIndex: number
|
|
62
|
+
autoZIndex: boolean
|
|
63
|
+
group?: string | undefined
|
|
64
|
+
appendTo?: any
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function getToastDefaults(props: ToastProps = {}): ToastResolvedProps {
|
|
68
|
+
return toastPropsSchema.parse(props) as ToastResolvedProps
|
|
69
|
+
}
|
package/src/index.ts
ADDED
package/src/registry.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Schema for a single file in a registry item.
|
|
5
|
+
*/
|
|
6
|
+
export const registryItemFileSchema = z.object({
|
|
7
|
+
/** Relative file path */
|
|
8
|
+
path: z.string(),
|
|
9
|
+
/** File content as string */
|
|
10
|
+
content: z.string(),
|
|
11
|
+
/** File type hint */
|
|
12
|
+
type: z.enum(['component', 'style', 'schema', 'composable', 'util']).optional()
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Schema for a registry item (component metadata + source).
|
|
17
|
+
* Used to validate the JSON output of the registry build process.
|
|
18
|
+
*/
|
|
19
|
+
export const registryItemSchema = z.object({
|
|
20
|
+
/** Component name (kebab-case) */
|
|
21
|
+
name: z.string(),
|
|
22
|
+
/** Component type */
|
|
23
|
+
type: z.enum(['component', 'primitive', 'composable', 'util']).default('component'),
|
|
24
|
+
/** Human-readable description */
|
|
25
|
+
description: z.string().optional(),
|
|
26
|
+
/** Source files */
|
|
27
|
+
files: z.array(registryItemFileSchema),
|
|
28
|
+
/** npm dependencies required by this component */
|
|
29
|
+
dependencies: z.array(z.string()).default([]),
|
|
30
|
+
/** Other registry components this one depends on */
|
|
31
|
+
registryDependencies: z.array(z.string()).default([]),
|
|
32
|
+
/** CSS file paths (if separately bundled) */
|
|
33
|
+
cssFiles: z.array(z.string()).default([])
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
export type RegistryItem = z.infer<typeof registryItemSchema>
|
|
37
|
+
export type RegistryItemFile = z.infer<typeof registryItemFileSchema>
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Schema for the full registry index.
|
|
41
|
+
*/
|
|
42
|
+
export const registryIndexSchema = z.array(
|
|
43
|
+
z.object({
|
|
44
|
+
name: z.string(),
|
|
45
|
+
type: z.string(),
|
|
46
|
+
description: z.string().optional(),
|
|
47
|
+
dependencies: z.array(z.string()).default([]),
|
|
48
|
+
registryDependencies: z.array(z.string()).default([])
|
|
49
|
+
})
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
export type RegistryIndex = z.infer<typeof registryIndexSchema>
|