fulldev-ui 0.3.8 → 0.3.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fulldev-ui",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "description": "A component library built for Astro",
5
5
  "homepage": "https://ui.full.dev",
6
6
  "bugs": "https://github.com/fulldotdev/ui/issues",
@@ -31,9 +31,12 @@
31
31
  "devDependencies": {
32
32
  "@astrojs/check": "^0.5.9",
33
33
  "@types/flat": "^5.0.5",
34
- "astro": "^4.5.5",
35
34
  "unocss": "^0.61.0"
36
35
  },
36
+ "peerDependencies": {
37
+ "astro": "^4.5.5",
38
+ "typescript": "^5.4.3"
39
+ },
37
40
  "dependencies": {
38
41
  "@iconify-json/tabler": "^1.1.109",
39
42
  "astro-seo": "^0.8.3",
@@ -5,21 +5,22 @@ import Icon from './Icon.astro'
5
5
 
6
6
  type Props<As extends HTMLTag = 'div'> = Polymorphic<{ as: As }> & {
7
7
  variant?: 'solid' | 'surface' | 'soft' | 'outline' | 'ghost'
8
+ radius?: 'none' | 'auto' | 'full'
8
9
  size?: 'sm' | 'md' | 'lg'
9
10
  color?: 'base' | 'brand'
10
11
  contrast?: boolean
11
- compact?: boolean
12
12
  html?: string
13
13
  text?: string
14
14
  icon?: string
15
15
  }
16
16
 
17
- const { variant = 'outline', icon, ...rest } = Astro.props
17
+ const { variant = 'outline', radius = 'auto', icon, ...rest } = Astro.props
18
18
  ---
19
19
 
20
20
  <Component
21
21
  class:list={['badge']}
22
22
  {variant}
23
+ {radius}
23
24
  {...rest}
24
25
  >
25
26
  <slot />
@@ -38,7 +39,6 @@ const { variant = 'outline', icon, ...rest } = Astro.props
38
39
  gap: var(--space-2);
39
40
  transition: var(--transition);
40
41
  border: 1px solid var(--border);
41
- border-radius: var(--radius-1);
42
42
  background-color: var(--background);
43
43
  padding-right: var(--space-3);
44
44
  padding-left: var(--space-3);
@@ -51,5 +51,17 @@ const { variant = 'outline', icon, ...rest } = Astro.props
51
51
  text-align: center;
52
52
  text-decoration: none;
53
53
  white-space: nowrap;
54
+
55
+ &.radius-none {
56
+ border-radius: 0;
57
+ }
58
+
59
+ &.radius-auto {
60
+ border-radius: var(--radius-1);
61
+ }
62
+
63
+ &.radius-full {
64
+ border-radius: 9999px;
65
+ }
54
66
  }
55
67
  </style>
@@ -1,20 +1,27 @@
1
1
  ---
2
- import type { ComponentProps, HTMLTag, Polymorphic } from 'astro/types'
2
+ import type { HTMLTag, Polymorphic } from 'astro/types'
3
3
  import Component from '../_Component.astro'
4
4
  import Icon from './Icon.astro'
5
5
 
6
6
  type Props<As extends HTMLTag = 'a'> = Polymorphic<{ as: As }> & {
7
+ variant?: 'solid' | 'soft' | 'surface' | 'outline' | 'ghost' | 'link'
7
8
  size?: 'sm' | 'md' | 'lg'
8
9
  color?: 'base' | 'brand'
9
- radius?: 'small' | 'medium' | 'large' | 'full'
10
+ radius?: 'none' | 'auto' | 'full'
10
11
  contrast?: boolean
11
12
  html?: string
12
13
  text?: string
13
- variant?: 'solid' | 'soft' | 'surface' | 'outline' | 'ghost' | 'link'
14
- icon?: ComponentProps<typeof Icon> | ComponentProps<typeof Icon>['name']
14
+ icon?: string
15
15
  }
16
16
 
17
- const { as = 'a', variant = 'solid', contrast, icon, ...rest } = Astro.props
17
+ const {
18
+ as = 'a',
19
+ variant = 'solid',
20
+ radius = 'auto',
21
+ contrast,
22
+ icon,
23
+ ...rest
24
+ } = Astro.props
18
25
  ---
19
26
 
20
27
  <Component
@@ -22,10 +29,11 @@ const { as = 'a', variant = 'solid', contrast, icon, ...rest } = Astro.props
22
29
  {as}
23
30
  {variant}
24
31
  {contrast}
32
+ {radius}
25
33
  {...rest}
26
34
  >
27
35
  <slot />
28
- {typeof icon === 'string' ? <Icon name={icon} /> : <Icon {...icon} />}
36
+ <Icon name={icon} />
29
37
  </Component>
30
38
 
31
39
  <style is:global lang="scss">
@@ -42,7 +50,6 @@ const { as = 'a', variant = 'solid', contrast, icon, ...rest } = Astro.props
42
50
  cursor: pointer;
43
51
  outline: none !important;
44
52
  border: 1px solid var(--border);
45
- border-radius: var(--radius-1);
46
53
  background-color: var(--background);
47
54
  padding-right: var(--space-4);
48
55
  padding-left: var(--space-4);
@@ -79,16 +86,12 @@ const { as = 'a', variant = 'solid', contrast, icon, ...rest } = Astro.props
79
86
  }
80
87
  }
81
88
 
82
- &.radius-small {
83
- border-radius: var(--radius-1);
84
- }
85
-
86
- &.radius-medium {
87
- border-radius: var(--radius-2);
89
+ &.radius-none {
90
+ border-radius: 0;
88
91
  }
89
92
 
90
- &.radius-large {
91
- border-radius: var(--radius-3);
93
+ &.radius-auto {
94
+ border-radius: var(--radius-1);
92
95
  }
93
96
 
94
97
  &.radius-full {
@@ -9,7 +9,7 @@ type Props = HTMLAttributes<'img'> & {
9
9
  frame?: 'inset'
10
10
  width?: number | 1920
11
11
  height?: number | 1920
12
- radius?: 'small' | 'medium' | 'large' | 'full'
12
+ radius?: 'none' | 'auto' | 'full'
13
13
  }
14
14
 
15
15
  function getAltBySrc(): string {
@@ -27,8 +27,8 @@ const {
27
27
  position,
28
28
  frame,
29
29
  width,
30
+ radius = 'none',
30
31
  height,
31
- radius,
32
32
  ...rest
33
33
  } = Astro.props
34
34
  ---
@@ -82,17 +82,14 @@ const {
82
82
  mask-image: linear-gradient(to top, transparent 0%, black 100%);
83
83
  }
84
84
 
85
- &.radius-small {
86
- border-radius: var(--radius-1);
85
+ &.radius-none {
86
+ border-radius: 0;
87
87
  }
88
88
 
89
- &.radius-medium {
90
- border-radius: var(--radius-2);
89
+ &.radius-auto {
90
+ border-radius: var(--radius-1);
91
91
  }
92
92
 
93
- &.radius-large {
94
- border-radius: var(--radius-3);
95
- }
96
93
 
97
94
  &.radius-full {
98
95
  border-radius: 9999px;
@@ -5,6 +5,7 @@ import Component from '../_Component.astro'
5
5
  type Props<As extends HTMLTag = 'a'> = Polymorphic<{ as: As }> & {
6
6
  structure?: 'column' | 'group' | 'split' | 'spread' | 'row'
7
7
  align?: 'start' | 'center' | 'end' | 'stretch'
8
+ radius?: 'none' | 'auto'
8
9
  frame?: 'panel' | 'none'
9
10
  color?: 'base' | 'brand'
10
11
  contrast?: boolean
@@ -25,6 +26,7 @@ const {
25
26
  frame = 'panel',
26
27
  structure = 'column',
27
28
  compact = true,
29
+ radius = 'auto',
28
30
  variant = 'subtle',
29
31
  ...rest
30
32
  } = Astro.props
@@ -34,6 +36,7 @@ const {
34
36
  class:list={['card']}
35
37
  {compact}
36
38
  {href}
39
+ {radius}
37
40
  {structure}
38
41
  {variant}
39
42
  {frame}
@@ -82,9 +85,16 @@ const {
82
85
  --inner-y: var(--space-7);
83
86
 
84
87
  border: 1px solid var(--border);
85
- border-radius: var(--radius-3);
86
88
  background-color: var(--background);
87
89
  padding: var(--inner-y) var(--inner-x);
88
90
  }
91
+
92
+ &.radius-none {
93
+ border-radius: 0;
94
+ }
95
+
96
+ &.radius-auto {
97
+ border-radius: var(--radius-2);
98
+ }
89
99
  }
90
100
  </style>
@@ -6,6 +6,7 @@ type Props<As extends HTMLTag = 'header'> = Polymorphic<{ as: As }> & {
6
6
  structure?: 'spread' | 'row' | 'column'
7
7
  position?: 'relative' | 'sticky' | 'fixed' | 'absolute'
8
8
  variant?: 'ghost' | 'subtle' | 'soft' | 'surface' | 'outline'
9
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
9
10
  frame?: 'fill' | 'panel'
10
11
  align?: 'start' | 'center' | 'end'
11
12
  compact?: boolean
@@ -25,8 +25,6 @@ const { align = 'start', ...rest } = Astro.props
25
25
  @import '../../css/space.scss';
26
26
 
27
27
  @include component('column') {
28
- @include space-y;
29
-
30
28
  display: flex;
31
29
  position: relative;
32
30
  flex-direction: column;
@@ -47,5 +45,7 @@ const { align = 'start', ...rest } = Astro.props
47
45
  &.align-end {
48
46
  align-items: flex-end;
49
47
  }
48
+
49
+ @include space-y;
50
50
  }
51
51
  </style>
@@ -25,10 +25,10 @@ const { align = 'center', ...rest } = Astro.props
25
25
  @import '../../css/space.scss';
26
26
 
27
27
  @include component('row') {
28
- @include space-x;
29
-
30
28
  display: flex;
31
29
 
30
+ @include space-x;
31
+
32
32
  &.align-start {
33
33
  align-items: flex-start;
34
34
  }
package/src/index.ts CHANGED
@@ -1,6 +1,3 @@
1
- // Schemas and utils
2
- export * from './schemas/schemas'
3
-
4
1
  // Base components
5
2
  export { default as Badge } from './components/base/Badge.astro'
6
3
  export { default as Button } from './components/base/Button.astro'
@@ -13,6 +10,7 @@ export { default as Checkbox } from './components/base/checkbox/Checkbox.astro'
13
10
  export { default as Input } from './components/base/input/Input.astro'
14
11
  export { default as InputElement } from './components/base/input/InputElement.astro'
15
12
  // export { default as Radio } from './components/base/radio/Radio.astro'
13
+ export { default as Avatar } from './components/base/Avatar.astro'
16
14
  export { default as Select } from './components/base/select/Select.astro'
17
15
  export { default as SelectElement } from './components/base/select/SelectElement.astro'
18
16
  export { default as SelectOption } from './components/base/select/SelectOption.astro'
@@ -1,90 +0,0 @@
1
- import type { ZodRawShape } from 'astro/zod'
2
- import {
3
- reference,
4
- z,
5
- type AnyEntryMap,
6
- type ContentEntryMap,
7
- type DataEntryMap,
8
- type ValidContentEntrySlug,
9
- } from 'astro:content'
10
-
11
- export const pathSchema = <C extends keyof AnyEntryMap>(collection: C) =>
12
- z
13
- .string()
14
- .transform((value) => {
15
- const fullpath = value.split(`${collection}/`).pop()
16
- const slug = fullpath?.split('.').shift()
17
- return slug
18
- })
19
- .pipe(reference(collection))
20
-
21
- const buttonSchema = z
22
- .object({
23
- text: z.string(),
24
- html: z.string(),
25
- href: z.string(),
26
- })
27
- .partial()
28
- .passthrough()
29
-
30
- const baseSchema = z
31
- .object({
32
- image: z.string(),
33
- images: z.string().array(),
34
- rating: z.number(),
35
- badge: z.string(),
36
- tagline: z.string(),
37
- heading: z.string(),
38
- paragraph: z.string(),
39
- list: z.string().array(),
40
- price: z.string().or(z.number()),
41
- button: buttonSchema,
42
- buttons: buttonSchema.array(),
43
- })
44
- .partial()
45
- .passthrough()
46
-
47
- const blockSchema = <R extends ZodRawShape>(references: R) =>
48
- baseSchema
49
- .extend({
50
- card: baseSchema,
51
- cards: baseSchema.array(),
52
- })
53
- .extend(references)
54
- .partial()
55
- .passthrough()
56
-
57
- export const pageSchema = <R extends ZodRawShape>(references: R) =>
58
- baseSchema
59
- .extend({
60
- title: z.string(),
61
- description: z.string(),
62
- block: blockSchema(references),
63
- hero: blockSchema(references),
64
- cta: blockSchema(references),
65
- blocks: blockSchema(references).array(),
66
- main: z.object({}).catchall(blockSchema(references)).partial(),
67
- head: z
68
- .object({
69
- title: z.string(),
70
- description: z.string(),
71
- image: z.string().optional(),
72
- })
73
- .partial(),
74
- })
75
- .extend(references)
76
- .partial()
77
- .passthrough()
78
-
79
- export type Reference<C extends keyof AnyEntryMap> =
80
- C extends keyof ContentEntryMap
81
- ? {
82
- collection: C
83
- slug: ValidContentEntrySlug<C>
84
- }
85
- : C extends keyof DataEntryMap
86
- ? {
87
- collection: C
88
- id: keyof DataEntryMap[C]
89
- }
90
- : never
@@ -1,57 +0,0 @@
1
- import { z } from 'astro/zod'
2
-
3
- export const pathSchema = z.string().transform((value) => {
4
- const path = value.split(`content`).pop()
5
- const slug = path?.split('/').pop()?.split('.').shift()
6
- return slug
7
- })
8
-
9
- export const buttonSchema = z
10
- .object({
11
- text: z.string(),
12
- html: z.string(),
13
- href: z.string(),
14
- })
15
- .partial()
16
- .passthrough()
17
-
18
- const baseSchema = z
19
- .object({
20
- image: z.string(),
21
- images: z.string().array(),
22
- icon: z.string(),
23
- rating: z.number(),
24
- badge: z.string(),
25
- tagline: z.string(),
26
- heading: z.string(),
27
- text: z.string(),
28
- list: z.string().array(),
29
- price: z.string().or(z.number()),
30
- button: buttonSchema,
31
- buttons: buttonSchema.array(),
32
- })
33
- .partial()
34
- .passthrough()
35
-
36
- export const blockSchema = baseSchema
37
- .extend({
38
- card: baseSchema,
39
- cards: baseSchema.array(),
40
- })
41
- .partial()
42
- .passthrough()
43
-
44
- export const pageSchema = baseSchema
45
- .extend({
46
- title: z.string(),
47
- description: z.string(),
48
- head: z
49
- .object({
50
- title: z.string(),
51
- description: z.string(),
52
- image: z.string().optional(),
53
- })
54
- .partial(),
55
- })
56
- .partial()
57
- .passthrough()