@refraction-ui/astro 0.4.7 → 0.4.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/dist/astro-callout/Callout.astro +18 -1
- package/dist/astro-callout/CalloutContent.astro +17 -0
- package/dist/astro-callout/CalloutDescription.astro +17 -0
- package/dist/astro-callout/CalloutIcon.astro +17 -0
- package/dist/astro-callout/CalloutTitle.astro +17 -0
- package/dist/astro-callout/index.ts +5 -1
- package/dist/astro-code-block/CodeBlock.astro +15 -1
- package/dist/callout/callout.styles.ts +25 -0
- package/dist/callout/callout.ts +43 -1
- package/dist/callout/index.ts +15 -1
- package/dist/code-block/code-block.styles.ts +13 -0
- package/dist/code-block/code-block.ts +15 -1
- package/dist/code-block/index.ts +12 -1
- package/dist/skip-to-content/skip-to-content.ts +13 -1
- package/dist/steps/steps.ts +78 -1
- package/package.json +2 -2
|
@@ -1,3 +1,20 @@
|
|
|
1
1
|
---
|
|
2
|
+
import { createCallout, calloutVariants } from '../callout/index.ts'
|
|
3
|
+
import { cn } from '../shared/index.ts'
|
|
4
|
+
|
|
5
|
+
interface Props extends astroHTML.JSX.HTMLAttributes {
|
|
6
|
+
variant?: 'default' | 'destructive' | 'success' | 'warning' | 'info'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { variant = 'default', class: className, ...props } = Astro.props
|
|
10
|
+
const api = createCallout({ role: variant === 'destructive' ? 'alert' : 'region' })
|
|
2
11
|
---
|
|
3
|
-
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
class={cn(calloutVariants({ variant }), className)}
|
|
15
|
+
{...api.ariaProps}
|
|
16
|
+
{...api.dataAttributes}
|
|
17
|
+
{...props}
|
|
18
|
+
>
|
|
19
|
+
<slot />
|
|
20
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { createCalloutContent } from '../callout/index.ts'
|
|
3
|
+
import { cn } from '../shared/index.ts'
|
|
4
|
+
|
|
5
|
+
interface Props extends astroHTML.JSX.HTMLAttributes {}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...props } = Astro.props
|
|
8
|
+
const api = createCalloutContent()
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<div
|
|
12
|
+
class={cn('flex-1', className)}
|
|
13
|
+
{...api.dataAttributes}
|
|
14
|
+
{...props}
|
|
15
|
+
>
|
|
16
|
+
<slot />
|
|
17
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { createCalloutDescription, calloutDescriptionVariants } from '../callout/index.ts'
|
|
3
|
+
import { cn } from '../shared/index.ts'
|
|
4
|
+
|
|
5
|
+
interface Props extends astroHTML.JSX.HTMLAttributes {}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...props } = Astro.props
|
|
8
|
+
const api = createCalloutDescription()
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<div
|
|
12
|
+
class={cn(calloutDescriptionVariants(), className)}
|
|
13
|
+
{...api.dataAttributes}
|
|
14
|
+
{...props}
|
|
15
|
+
>
|
|
16
|
+
<slot />
|
|
17
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { createCalloutIcon } from '../callout/index.ts'
|
|
3
|
+
import { cn } from '../shared/index.ts'
|
|
4
|
+
|
|
5
|
+
interface Props extends astroHTML.JSX.HTMLAttributes {}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...props } = Astro.props
|
|
8
|
+
const api = createCalloutIcon()
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<div
|
|
12
|
+
class={cn('flex-shrink-0 mt-0.5', className)}
|
|
13
|
+
{...api.dataAttributes}
|
|
14
|
+
{...props}
|
|
15
|
+
>
|
|
16
|
+
<slot />
|
|
17
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { createCalloutTitle, calloutTitleVariants } from '../callout/index.ts'
|
|
3
|
+
import { cn } from '../shared/index.ts'
|
|
4
|
+
|
|
5
|
+
interface Props extends astroHTML.JSX.HTMLAttributes {}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...props } = Astro.props
|
|
8
|
+
const api = createCalloutTitle()
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<h5
|
|
12
|
+
class={cn(calloutTitleVariants(), className)}
|
|
13
|
+
{...api.dataAttributes}
|
|
14
|
+
{...props}
|
|
15
|
+
>
|
|
16
|
+
<slot />
|
|
17
|
+
</h5>
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
export { default as Callout } from './Callout.astro'
|
|
1
|
+
export { default as Callout } from './Callout.astro'
|
|
2
|
+
export { default as CalloutIcon } from './CalloutIcon.astro'
|
|
3
|
+
export { default as CalloutContent } from './CalloutContent.astro'
|
|
4
|
+
export { default as CalloutTitle } from './CalloutTitle.astro'
|
|
5
|
+
export { default as CalloutDescription } from './CalloutDescription.astro'
|
|
@@ -1,3 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
+
import { createCodeBlock, codeBlockVariants } from '../code-block/index.ts'
|
|
3
|
+
import { cn } from '../shared/index.ts'
|
|
4
|
+
|
|
5
|
+
interface Props extends astroHTML.JSX.HTMLAttributes {}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...props } = Astro.props
|
|
8
|
+
const api = createCodeBlock()
|
|
2
9
|
---
|
|
3
|
-
|
|
10
|
+
|
|
11
|
+
<div
|
|
12
|
+
class={cn(codeBlockVariants(), className)}
|
|
13
|
+
{...api.dataAttributes}
|
|
14
|
+
{...props}
|
|
15
|
+
>
|
|
16
|
+
<slot />
|
|
17
|
+
</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { cva } from '../shared/index.ts'
|
|
2
|
+
|
|
3
|
+
export const calloutVariants = cva({
|
|
4
|
+
base: 'relative w-full rounded-lg border p-4 text-sm flex gap-3',
|
|
5
|
+
variants: {
|
|
6
|
+
variant: {
|
|
7
|
+
default: 'bg-muted/50 border-border text-foreground',
|
|
8
|
+
destructive: 'bg-destructive/10 border-destructive/20 text-destructive',
|
|
9
|
+
success: 'bg-green-500/10 border-green-500/20 text-green-700 dark:text-green-400',
|
|
10
|
+
warning: 'bg-yellow-500/10 border-yellow-500/20 text-yellow-700 dark:text-yellow-400',
|
|
11
|
+
info: 'bg-blue-500/10 border-blue-500/20 text-blue-700 dark:text-blue-400',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
variant: 'default',
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export const calloutTitleVariants = cva({
|
|
20
|
+
base: 'font-semibold leading-none tracking-tight mb-1',
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
export const calloutDescriptionVariants = cva({
|
|
24
|
+
base: 'text-sm opacity-90 leading-relaxed',
|
|
25
|
+
})
|
package/dist/callout/callout.ts
CHANGED
|
@@ -1 +1,43 @@
|
|
|
1
|
-
|
|
1
|
+
import type { AccessibilityProps } from '../shared/index.ts'
|
|
2
|
+
|
|
3
|
+
export interface CalloutProps {
|
|
4
|
+
/** Optional accessible role override */
|
|
5
|
+
role?: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface CalloutAPI {
|
|
9
|
+
ariaProps: Partial<AccessibilityProps>
|
|
10
|
+
dataAttributes: Record<string, string>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function createCallout(props: CalloutProps = {}): CalloutAPI {
|
|
14
|
+
const ariaProps: Partial<AccessibilityProps> = {}
|
|
15
|
+
|
|
16
|
+
// Callouts are usually alert or region depending on severity
|
|
17
|
+
if (props.role) {
|
|
18
|
+
ariaProps.role = props.role
|
|
19
|
+
} else {
|
|
20
|
+
ariaProps.role = 'region'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
ariaProps,
|
|
25
|
+
dataAttributes: { 'data-slot': 'callout' },
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function createCalloutIcon(): { dataAttributes: Record<string, string> } {
|
|
30
|
+
return { dataAttributes: { 'data-slot': 'callout-icon' } }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function createCalloutContent(): { dataAttributes: Record<string, string> } {
|
|
34
|
+
return { dataAttributes: { 'data-slot': 'callout-content' } }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function createCalloutTitle(): { dataAttributes: Record<string, string> } {
|
|
38
|
+
return { dataAttributes: { 'data-slot': 'callout-title' } }
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function createCalloutDescription(): { dataAttributes: Record<string, string> } {
|
|
42
|
+
return { dataAttributes: { 'data-slot': 'callout-description' } }
|
|
43
|
+
}
|
package/dist/callout/index.ts
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
export
|
|
1
|
+
export {
|
|
2
|
+
createCallout,
|
|
3
|
+
createCalloutIcon,
|
|
4
|
+
createCalloutContent,
|
|
5
|
+
createCalloutTitle,
|
|
6
|
+
createCalloutDescription,
|
|
7
|
+
type CalloutProps,
|
|
8
|
+
type CalloutAPI,
|
|
9
|
+
} from './callout.js'
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
calloutVariants,
|
|
13
|
+
calloutTitleVariants,
|
|
14
|
+
calloutDescriptionVariants,
|
|
15
|
+
} from './callout.styles.js'
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cva } from '../shared/index.ts'
|
|
2
|
+
|
|
3
|
+
export const codeBlockVariants = cva({
|
|
4
|
+
base: 'relative overflow-hidden rounded-lg border bg-zinc-950 text-zinc-50 dark:bg-zinc-900',
|
|
5
|
+
})
|
|
6
|
+
|
|
7
|
+
export const codeBlockHeaderVariants = cva({
|
|
8
|
+
base: 'flex items-center justify-between border-b border-zinc-800 bg-zinc-900/50 px-4 py-2 text-xs text-zinc-400',
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export const codeBlockContentVariants = cva({
|
|
12
|
+
base: 'overflow-x-auto p-4 text-sm font-mono leading-relaxed',
|
|
13
|
+
})
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export interface CodeBlockAPI {
|
|
2
|
+
dataAttributes: Record<string, string>
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function createCodeBlock(): CodeBlockAPI {
|
|
6
|
+
return { dataAttributes: { 'data-slot': 'code-block' } }
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function createCodeBlockHeader(): CodeBlockAPI {
|
|
10
|
+
return { dataAttributes: { 'data-slot': 'code-block-header' } }
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function createCodeBlockContent(): CodeBlockAPI {
|
|
14
|
+
return { dataAttributes: { 'data-slot': 'code-block-content' } }
|
|
15
|
+
}
|
package/dist/code-block/index.ts
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
export
|
|
1
|
+
export {
|
|
2
|
+
createCodeBlock,
|
|
3
|
+
createCodeBlockHeader,
|
|
4
|
+
createCodeBlockContent,
|
|
5
|
+
type CodeBlockAPI,
|
|
6
|
+
} from './code-block.js'
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
codeBlockVariants,
|
|
10
|
+
codeBlockHeaderVariants,
|
|
11
|
+
codeBlockContentVariants,
|
|
12
|
+
} from './code-block.styles.js'
|
|
@@ -1 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { cva } from '../shared/index.ts'
|
|
2
|
+
|
|
3
|
+
export interface SkipToContentAPI {
|
|
4
|
+
dataAttributes: Record<string, string>
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function createSkipToContent(): SkipToContentAPI {
|
|
8
|
+
return { dataAttributes: { 'data-slot': 'skip-to-content' } }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const skipToContentVariants = cva({
|
|
12
|
+
base: 'fixed left-4 top-4 z-[100] -translate-y-16 rounded-md border bg-background px-4 py-2 text-sm font-medium shadow-md transition-transform focus:translate-y-0 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
|
|
13
|
+
})
|
package/dist/steps/steps.ts
CHANGED
|
@@ -1 +1,78 @@
|
|
|
1
|
-
|
|
1
|
+
import { cva } from '../shared/index.ts'
|
|
2
|
+
|
|
3
|
+
export interface StepsAPI {
|
|
4
|
+
dataAttributes: Record<string, string>
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function createSteps(): StepsAPI {
|
|
8
|
+
return { dataAttributes: { 'data-slot': 'steps' } }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function createStep(): StepsAPI {
|
|
12
|
+
return { dataAttributes: { 'data-slot': 'step' } }
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function createStepIndicator(): StepsAPI {
|
|
16
|
+
return { dataAttributes: { 'data-slot': 'step-indicator' } }
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function createStepContent(): StepsAPI {
|
|
20
|
+
return { dataAttributes: { 'data-slot': 'step-content' } }
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function createStepTitle(): StepsAPI {
|
|
24
|
+
return { dataAttributes: { 'data-slot': 'step-title' } }
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function createStepDescription(): StepsAPI {
|
|
28
|
+
return { dataAttributes: { 'data-slot': 'step-description' } }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const stepsVariants = cva({
|
|
32
|
+
base: 'flex flex-col gap-0',
|
|
33
|
+
variants: {
|
|
34
|
+
orientation: {
|
|
35
|
+
vertical: 'flex-col',
|
|
36
|
+
horizontal: 'flex-row',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
orientation: 'vertical',
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
export const stepVariants = cva({
|
|
45
|
+
base: 'flex gap-3',
|
|
46
|
+
variants: {
|
|
47
|
+
status: {
|
|
48
|
+
completed: 'text-foreground',
|
|
49
|
+
active: 'text-foreground',
|
|
50
|
+
upcoming: 'text-muted-foreground',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
defaultVariants: {
|
|
54
|
+
status: 'upcoming',
|
|
55
|
+
},
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
export const stepIndicatorVariants = cva({
|
|
59
|
+
base: 'flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full border-2 text-sm font-semibold',
|
|
60
|
+
variants: {
|
|
61
|
+
status: {
|
|
62
|
+
completed: 'border-primary bg-primary text-primary-foreground',
|
|
63
|
+
active: 'border-primary bg-background text-primary',
|
|
64
|
+
upcoming: 'border-muted bg-background text-muted-foreground',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
defaultVariants: {
|
|
68
|
+
status: 'upcoming',
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
export const stepTitleVariants = cva({
|
|
73
|
+
base: 'font-semibold leading-none tracking-tight',
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
export const stepDescriptionVariants = cva({
|
|
77
|
+
base: 'text-sm text-muted-foreground mt-1',
|
|
78
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refraction-ui/astro",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.10",
|
|
4
4
|
"description": "All Refraction UI Astro components in one package",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -104,4 +104,4 @@
|
|
|
104
104
|
"directory": "packages/astro-meta"
|
|
105
105
|
},
|
|
106
106
|
"homepage": "https://elloloop.github.io/refraction-ui/"
|
|
107
|
-
}
|
|
107
|
+
}
|