@nautui/core 0.1.0
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/README.md +148 -0
- package/package.json +35 -0
- package/src/components/Accordion.astro +24 -0
- package/src/components/AccordionItem.astro +172 -0
- package/src/components/Background.astro +75 -0
- package/src/components/Badge.astro +140 -0
- package/src/components/Bento.astro +37 -0
- package/src/components/BentoItem.astro +26 -0
- package/src/components/Box.astro +189 -0
- package/src/components/Breadcrumb.astro +62 -0
- package/src/components/Button.astro +273 -0
- package/src/components/Card.astro +228 -0
- package/src/components/Container.astro +76 -0
- package/src/components/Divider.astro +85 -0
- package/src/components/Drawer.astro +139 -0
- package/src/components/Flex.astro +150 -0
- package/src/components/Flow.astro +119 -0
- package/src/components/Grid.astro +335 -0
- package/src/components/GridItem.astro +225 -0
- package/src/components/Group.astro +106 -0
- package/src/components/Image.astro +191 -0
- package/src/components/Link.astro +118 -0
- package/src/components/List.astro +57 -0
- package/src/components/ListItem.astro +31 -0
- package/src/components/Mark.astro +161 -0
- package/src/components/Marquee.astro +193 -0
- package/src/components/Masonry.astro +75 -0
- package/src/components/MasonryItem.astro +28 -0
- package/src/components/Menu.astro +71 -0
- package/src/components/MenuItem.astro +93 -0
- package/src/components/NavBar.astro +211 -0
- package/src/components/Section.astro +108 -0
- package/src/components/Space.astro +400 -0
- package/src/components/Stack.astro +237 -0
- package/src/components/Text.astro +270 -0
- package/src/components/Theme.astro +37 -0
- package/src/components/ThemeToggle.astro +141 -0
- package/src/components/Title.astro +141 -0
- package/src/index.d.ts +80 -0
- package/src/index.ts +77 -0
- package/src/lib/border.ts +92 -0
- package/src/lib/pattern.ts +37 -0
- package/src/lib/spacing.ts +48 -0
- package/src/styles/border.css +180 -0
- package/src/styles/colors.css +99 -0
- package/src/styles/global.css +57 -0
- package/src/styles/radius.css +22 -0
- package/src/styles/shadow.css +11 -0
- package/src/styles/spacing/display.css +198 -0
- package/src/styles/spacing/gap.css +19 -0
- package/src/styles/spacing/margin.css +157 -0
- package/src/styles/spacing/padding.css +154 -0
- package/src/styles/spacing/spacing.css +2 -0
- package/src/types.ts +10 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
---
|
|
2
|
+
import "../styles/spacing/margin.css";
|
|
3
|
+
import {
|
|
4
|
+
extractSpacingProps,
|
|
5
|
+
getSpacingClasses,
|
|
6
|
+
MarginProps,
|
|
7
|
+
} from "../lib/spacing";
|
|
8
|
+
import type { Base } from "../types";
|
|
9
|
+
|
|
10
|
+
export interface TitleProps extends Base, MarginProps {
|
|
11
|
+
align?: "left" | "center" | "right" | "justify";
|
|
12
|
+
gradient?: { colors: string[]; deg?: number };
|
|
13
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
14
|
+
size?: "default" | "display" | "display-lg" | "display-xl" | "display-xxl";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { spacing, nonSpacing } = extractSpacingProps(Astro.props as TitleProps);
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
level = 2,
|
|
21
|
+
class: className,
|
|
22
|
+
size = "default",
|
|
23
|
+
gradient,
|
|
24
|
+
align,
|
|
25
|
+
...rest
|
|
26
|
+
} = nonSpacing;
|
|
27
|
+
|
|
28
|
+
const spacingClasses = getSpacingClasses(spacing);
|
|
29
|
+
|
|
30
|
+
const classlist = [
|
|
31
|
+
"naut-title",
|
|
32
|
+
`l-${level}`,
|
|
33
|
+
align && `align-${align}`,
|
|
34
|
+
size && `size-${size}`,
|
|
35
|
+
gradient && "color--gradient",
|
|
36
|
+
...spacingClasses,
|
|
37
|
+
className,
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
const gradientBg = gradient
|
|
41
|
+
? `linear-gradient(${gradient.deg || 45}deg, ${gradient.colors.join(", ")})`
|
|
42
|
+
: undefined;
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
{level === 1 && <h1 class:list={classlist} {...rest}><slot /></h1>}
|
|
46
|
+
{level === 2 && <h2 class:list={classlist} {...rest}><slot /></h2>}
|
|
47
|
+
{level === 3 && <h3 class:list={classlist} {...rest}><slot /></h3>}
|
|
48
|
+
{level === 4 && <h4 class:list={classlist} {...rest}><slot /></h4>}
|
|
49
|
+
{level === 5 && <h5 class:list={classlist} {...rest}><slot /></h5>}
|
|
50
|
+
{level === 6 && <h6 class:list={classlist} {...rest}><slot /></h6>}
|
|
51
|
+
|
|
52
|
+
<style define:vars={{ gradientBg }}>
|
|
53
|
+
.naut-title {
|
|
54
|
+
font-weight: bold;
|
|
55
|
+
|
|
56
|
+
&.align-left {
|
|
57
|
+
text-align: left;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&.align-center {
|
|
61
|
+
text-align: center;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&.align-right {
|
|
65
|
+
text-align: right;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&.align-justify {
|
|
69
|
+
text-align: justify;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&.l-1 {
|
|
73
|
+
font-size: 2.5rem;
|
|
74
|
+
line-height: calc(2.05rem * var(--naut-line-height-ratio));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&.l-2 {
|
|
78
|
+
font-size: 1.8rem;
|
|
79
|
+
line-height: calc(1.45rem * var(--naut-line-height-ratio));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&.l-3 {
|
|
83
|
+
font-size: 1.6rem;
|
|
84
|
+
line-height: calc(1.3rem * var(--naut-line-height-ratio));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&.l-4 {
|
|
88
|
+
font-size: 1.5rem;
|
|
89
|
+
line-height: calc(1.25rem * var(--naut-line-height-ratio));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&.l-5 {
|
|
93
|
+
font-size: 1.3rem;
|
|
94
|
+
line-height: calc(1.085rem * var(--naut-line-height-ratio));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&.l-6 {
|
|
98
|
+
font-size: 1.2rem;
|
|
99
|
+
line-height: calc(1.025rem * var(--naut-line-height-ratio));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* Size display: ;*/
|
|
103
|
+
&.size-display-sm {
|
|
104
|
+
font-size: clamp(2rem, 2.2vw + 1rem, 2.8rem);
|
|
105
|
+
line-height: clamp(2.5rem, 3.2vw + 1rem, 3.5rem);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&.size-display {
|
|
109
|
+
font-size: clamp(2.2rem, 2.5vw + 1rem, 3.2rem);
|
|
110
|
+
line-height: clamp(2.8rem, 3.2vw + 1rem, 3.95rem);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&.size-display-lg {
|
|
114
|
+
font-size: clamp(2.8rem, 4vw + 1rem, 4.2rem);
|
|
115
|
+
line-height: clamp(3rem, 4.5vw + 1rem, 4.5rem);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&.size-display-xl {
|
|
119
|
+
font-size: clamp(3rem, 5vw + 1rem, 4.5rem);
|
|
120
|
+
line-height: clamp(3.2rem, 5vw + 1rem, 5rem);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
&.size-display-xxl {
|
|
124
|
+
font-size: clamp(3.2rem, 6vw + 1rem, 5rem);
|
|
125
|
+
line-height: clamp(3.5rem, 6vw + 1rem, 5.5rem);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* Color */
|
|
129
|
+
&.color--gradient {
|
|
130
|
+
color: transparent;
|
|
131
|
+
-webkit-text-fill-color: transparent;
|
|
132
|
+
background-image: var(--gradientBg);
|
|
133
|
+
-webkit-background-clip: text;
|
|
134
|
+
&::selection {
|
|
135
|
+
color: var(--naut-color-content);
|
|
136
|
+
-webkit-text-fill-color: var(--naut-color-content);
|
|
137
|
+
background-color: var(--naut-color-selection);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
</style>
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { AccordionProps } from "./components/Accordion.astro";
|
|
2
|
+
import type { AccordionItemProps } from "./components/AccordionItem.astro";
|
|
3
|
+
import type { BackgroundProps } from "./components/Background.astro";
|
|
4
|
+
import type { BadgeProps } from "./components/Badge.astro";
|
|
5
|
+
import type { BentoProps } from "./components/Bento.astro";
|
|
6
|
+
import type { BentoItemProps } from "./components/BentoItem.astro";
|
|
7
|
+
import type { BoxProps } from "./components/Box.astro";
|
|
8
|
+
import type { BreadcrumbProps } from "./components/Breadcrumb.astro";
|
|
9
|
+
import type { ButtonProps } from "./components/Button.astro";
|
|
10
|
+
import type { CardProps } from "./components/Card.astro";
|
|
11
|
+
import type { ContainerProps } from "./components/Container.astro";
|
|
12
|
+
import type { DividerProps } from "./components/Divider.astro";
|
|
13
|
+
import type { DrawerProps } from "./components/Drawer.astro";
|
|
14
|
+
import type { FlexProps } from "./components/Flex.astro";
|
|
15
|
+
import type { FlowProps } from "./components/Flow.astro";
|
|
16
|
+
import type { GridProps } from "./components/Grid.astro";
|
|
17
|
+
import type { GridItemProps } from "./components/GridItem.astro";
|
|
18
|
+
import type { GroupProps } from "./components/Group.astro";
|
|
19
|
+
import type { ImageProps } from "./components/Image.astro";
|
|
20
|
+
import type { LinkProps } from "./components/Link.astro";
|
|
21
|
+
import type { ListProps } from "./components/List.astro";
|
|
22
|
+
import type { ListItemProps } from "./components/ListItem.astro";
|
|
23
|
+
import type { MarkProps } from "./components/Mark.astro";
|
|
24
|
+
import type { MarqueeProps } from "./components/Marquee.astro";
|
|
25
|
+
import type { MasonryProps } from "./components/Masonry.astro";
|
|
26
|
+
import type { MasonryItemProps } from "./components/MasonryItem.astro";
|
|
27
|
+
import type { NavBarProps } from "./components/NavBar.astro";
|
|
28
|
+
import type { SectionProps } from "./components/Section.astro";
|
|
29
|
+
import type { SpaceProps } from "./components/Space.astro";
|
|
30
|
+
import type { TextProps } from "./components/Text.astro";
|
|
31
|
+
import type { ThemeProps } from "./components/Theme.astro";
|
|
32
|
+
import type { ThemeToggleProps } from "./components/ThemeToggle.astro";
|
|
33
|
+
import type { TitleProps } from "./components/Title.astro";
|
|
34
|
+
|
|
35
|
+
export type AstroComponent = () => Promise<{ Content: unknown }>;
|
|
36
|
+
|
|
37
|
+
// Theme
|
|
38
|
+
export declare const Theme: (props: ThemeProps) => AstroComponent;
|
|
39
|
+
export declare const ThemeToggle: (props: ThemeToggleProps) => AstroComponent;
|
|
40
|
+
|
|
41
|
+
// Layout
|
|
42
|
+
export declare const Container: (props: ContainerProps) => AstroComponent;
|
|
43
|
+
export declare const Section: (props: SectionProps) => AstroComponent;
|
|
44
|
+
export declare const Box: (props: BoxProps) => AstroComponent;
|
|
45
|
+
export declare const Group: (props: GroupProps) => AstroComponent;
|
|
46
|
+
export declare const Grid: (props: GridProps) => AstroComponent;
|
|
47
|
+
export declare const GridItem: (props: GridItemProps) => AstroComponent;
|
|
48
|
+
export declare const Marquee: (props: MarqueeProps) => AstroComponent;
|
|
49
|
+
export declare const Masonry: (props: MasonryProps) => AstroComponent;
|
|
50
|
+
export declare const MasonryItem: (props: MasonryItemProps) => AstroComponent;
|
|
51
|
+
export declare const Flow: (props: FlowProps) => AstroComponent;
|
|
52
|
+
export declare const Space: (props: SpaceProps) => AstroComponent;
|
|
53
|
+
export declare const Flex: (props: FlexProps) => AstroComponent;
|
|
54
|
+
export declare const Bento: (props: BentoProps) => AstroComponent;
|
|
55
|
+
export declare const BentoItem: (props: BentoItemProps) => AstroComponent;
|
|
56
|
+
|
|
57
|
+
// Typography
|
|
58
|
+
export declare const Text: (props: TextProps) => AstroComponent;
|
|
59
|
+
export declare const Title: (props: TitleProps) => AstroComponent;
|
|
60
|
+
export declare const Link: (props: LinkProps) => AstroComponent;
|
|
61
|
+
export declare const Mark: (props: MarkProps) => AstroComponent;
|
|
62
|
+
export declare const List: (props: ListProps) => AstroComponent;
|
|
63
|
+
export declare const ListItem: (props: ListItemProps) => AstroComponent;
|
|
64
|
+
|
|
65
|
+
// UI
|
|
66
|
+
export declare const Accordion: (props: AccordionProps) => AstroComponent;
|
|
67
|
+
export declare const AccordionItem: (
|
|
68
|
+
props: AccordionItemProps
|
|
69
|
+
) => AstroComponent;
|
|
70
|
+
export declare const Button: (props: ButtonProps) => AstroComponent;
|
|
71
|
+
export declare const Badge: (props: BadgeProps) => AstroComponent;
|
|
72
|
+
export declare const Card: (props: CardProps) => AstroComponent;
|
|
73
|
+
export declare const Divider: (props: DividerProps) => AstroComponent;
|
|
74
|
+
export declare const Image: (props: ImageProps) => AstroComponent;
|
|
75
|
+
export declare const Background: (props: BackgroundProps) => AstroComponent;
|
|
76
|
+
|
|
77
|
+
// Navigation
|
|
78
|
+
export declare const Breadcrumb: (props: BreadcrumbProps) => AstroComponent;
|
|
79
|
+
export declare const Drawer: (props: DrawerProps) => AstroComponent;
|
|
80
|
+
export declare const NavBar: (props: NavBarProps) => AstroComponent;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// biome-ignore-all lint/style/noExportedImports: DX
|
|
2
|
+
|
|
3
|
+
import Accordion from "./components/Accordion.astro";
|
|
4
|
+
import AccordionItem from "./components/AccordionItem.astro";
|
|
5
|
+
import Background from "./components/Background.astro";
|
|
6
|
+
import Badge from "./components/Badge.astro";
|
|
7
|
+
import Bento from "./components/Bento.astro";
|
|
8
|
+
import BentoItem from "./components/BentoItem.astro";
|
|
9
|
+
import Box from "./components/Box.astro";
|
|
10
|
+
import Breadcrumb from "./components/Breadcrumb.astro";
|
|
11
|
+
import Button from "./components/Button.astro";
|
|
12
|
+
import Card from "./components/Card.astro";
|
|
13
|
+
import Container from "./components/Container.astro";
|
|
14
|
+
import Divider from "./components/Divider.astro";
|
|
15
|
+
import Drawer from "./components/Drawer.astro";
|
|
16
|
+
import Flex from "./components/Flex.astro";
|
|
17
|
+
import Flow from "./components/Flow.astro";
|
|
18
|
+
import Grid from "./components/Grid.astro";
|
|
19
|
+
import GridItem from "./components/GridItem.astro";
|
|
20
|
+
import Group from "./components/Group.astro";
|
|
21
|
+
import Image from "./components/Image.astro";
|
|
22
|
+
import Link from "./components/Link.astro";
|
|
23
|
+
import List from "./components/List.astro";
|
|
24
|
+
import ListItem from "./components/ListItem.astro";
|
|
25
|
+
import Mark from "./components/Mark.astro";
|
|
26
|
+
import Marquee from "./components/Marquee.astro";
|
|
27
|
+
import Masonry from "./components/Masonry.astro";
|
|
28
|
+
import MasonryItem from "./components/MasonryItem.astro";
|
|
29
|
+
import Menu from "./components/Menu.astro";
|
|
30
|
+
import MenuItem from "./components/MenuItem.astro";
|
|
31
|
+
import NavBar from "./components/NavBar.astro";
|
|
32
|
+
import Section from "./components/Section.astro";
|
|
33
|
+
import Space from "./components/Space.astro";
|
|
34
|
+
import Stack from "./components/Stack.astro";
|
|
35
|
+
import Text from "./components/Text.astro";
|
|
36
|
+
import Theme from "./components/Theme.astro";
|
|
37
|
+
import ThemeToggle from "./components/ThemeToggle.astro";
|
|
38
|
+
import Title from "./components/Title.astro";
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
Accordion,
|
|
42
|
+
AccordionItem,
|
|
43
|
+
Background,
|
|
44
|
+
Badge,
|
|
45
|
+
Bento,
|
|
46
|
+
BentoItem,
|
|
47
|
+
Box,
|
|
48
|
+
Breadcrumb,
|
|
49
|
+
Button,
|
|
50
|
+
Card,
|
|
51
|
+
Container,
|
|
52
|
+
Divider,
|
|
53
|
+
Drawer,
|
|
54
|
+
Flex,
|
|
55
|
+
Flow,
|
|
56
|
+
Grid,
|
|
57
|
+
GridItem,
|
|
58
|
+
Group,
|
|
59
|
+
Image,
|
|
60
|
+
Link,
|
|
61
|
+
List,
|
|
62
|
+
ListItem,
|
|
63
|
+
Mark,
|
|
64
|
+
Marquee,
|
|
65
|
+
Masonry,
|
|
66
|
+
MasonryItem,
|
|
67
|
+
Menu,
|
|
68
|
+
MenuItem,
|
|
69
|
+
NavBar,
|
|
70
|
+
Section,
|
|
71
|
+
Space,
|
|
72
|
+
Stack,
|
|
73
|
+
Text,
|
|
74
|
+
Theme,
|
|
75
|
+
ThemeToggle,
|
|
76
|
+
Title,
|
|
77
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export type BorderStyle = "solid" | "dashed" | "dotted";
|
|
2
|
+
export type BorderWidth = "sm" | "md" | "lg" | "xl";
|
|
3
|
+
|
|
4
|
+
export interface BorderObject {
|
|
5
|
+
color?: string;
|
|
6
|
+
style?: BorderStyle;
|
|
7
|
+
width?: BorderWidth;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface BorderProps {
|
|
11
|
+
bottom?: BorderWidth | BorderObject;
|
|
12
|
+
color?: string;
|
|
13
|
+
left?: BorderWidth | BorderObject;
|
|
14
|
+
right?: BorderWidth | BorderObject;
|
|
15
|
+
style?: BorderStyle;
|
|
16
|
+
top?: BorderWidth | BorderObject;
|
|
17
|
+
width?: BorderWidth;
|
|
18
|
+
x?: BorderWidth | BorderObject;
|
|
19
|
+
y?: BorderWidth | BorderObject;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type Border = BorderWidth | BorderProps;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Helper to add border classes and color variables for a given prefix.
|
|
26
|
+
*/
|
|
27
|
+
function applyBorderConfig(
|
|
28
|
+
prefix: string,
|
|
29
|
+
config: BorderObject,
|
|
30
|
+
classes: string[],
|
|
31
|
+
colorVar: Record<string, string>
|
|
32
|
+
) {
|
|
33
|
+
const { width, style, color } = config;
|
|
34
|
+
if (width) {
|
|
35
|
+
classes.push(`${prefix}-${width}`);
|
|
36
|
+
}
|
|
37
|
+
if (style) {
|
|
38
|
+
classes.push(`${prefix}-${style}`);
|
|
39
|
+
}
|
|
40
|
+
if (color) {
|
|
41
|
+
// colorVars.push(`--naut-color-${prefix}: ${color}`);
|
|
42
|
+
colorVar[`naut-color-${prefix}`] = color;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Creates border classes and CSS variables from border props.
|
|
48
|
+
* Supports global and side-specific configurations.
|
|
49
|
+
*/
|
|
50
|
+
export function createBorder(props: BorderProps) {
|
|
51
|
+
const borderClasses: string[] = [];
|
|
52
|
+
const borderColors = {};
|
|
53
|
+
|
|
54
|
+
if (Object.keys(props).length > 0) {
|
|
55
|
+
borderClasses.push("border");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const { width, style, color, x, y, top, right, bottom, left } = props;
|
|
59
|
+
|
|
60
|
+
// 1. Global Props
|
|
61
|
+
applyBorderConfig(
|
|
62
|
+
"border",
|
|
63
|
+
{ width, style, color },
|
|
64
|
+
borderClasses,
|
|
65
|
+
borderColors
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
// 2. Side-specific Processing
|
|
69
|
+
const sideSpecs: Record<string, BorderObject> = {};
|
|
70
|
+
|
|
71
|
+
const collect = (side: string, value?: BorderWidth | BorderObject) => {
|
|
72
|
+
if (value) {
|
|
73
|
+
const obj = typeof value === "string" ? { width: value } : value;
|
|
74
|
+
sideSpecs[side] = { ...sideSpecs[side], ...obj };
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
collect("left", x);
|
|
79
|
+
collect("right", x);
|
|
80
|
+
collect("top", y);
|
|
81
|
+
collect("bottom", y);
|
|
82
|
+
collect("top", top);
|
|
83
|
+
collect("right", right);
|
|
84
|
+
collect("bottom", bottom);
|
|
85
|
+
collect("left", left);
|
|
86
|
+
|
|
87
|
+
for (const [side, spec] of Object.entries(sideSpecs)) {
|
|
88
|
+
applyBorderConfig(`border-${side}`, spec, borderClasses, borderColors);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return { borderClasses, borderColors };
|
|
92
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface PatternProps {
|
|
2
|
+
color?: string;
|
|
3
|
+
deg?: number;
|
|
4
|
+
gap?: number;
|
|
5
|
+
size?: number;
|
|
6
|
+
type: "dots" | "dots-x" | "grid" | "stripes";
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function getGradientPattern(props?: PatternProps) {
|
|
10
|
+
const color = props?.color || "var(--naut-color-base-300)";
|
|
11
|
+
const size = props?.size || 1;
|
|
12
|
+
|
|
13
|
+
switch (props?.type) {
|
|
14
|
+
case "dots": {
|
|
15
|
+
const gap = props.gap || 15;
|
|
16
|
+
return `radial-gradient(circle, ${color} ${size}px, transparent ${size}px) 0 0 / ${gap}px ${gap}px`;
|
|
17
|
+
}
|
|
18
|
+
case "dots-x": {
|
|
19
|
+
const gap = props.gap || 24;
|
|
20
|
+
return `radial-gradient(${color} ${size}px, transparent ${size}px) 0 0 / ${gap}px ${gap}px, radial-gradient(${color} ${size}px, transparent ${size}px) ${gap / 2}px ${gap / 2}px / ${gap}px ${gap}px`;
|
|
21
|
+
}
|
|
22
|
+
case "grid": {
|
|
23
|
+
const deg = props.deg || 90;
|
|
24
|
+
const gap = props.gap || 24;
|
|
25
|
+
return `linear-gradient(${deg}deg, ${color} ${size}px, transparent ${size}px) 0 0 / ${gap}px ${gap}px repeat, linear-gradient(${color} ${size}px, transparent ${size}px) 0 0 / ${gap}px ${gap}px repeat`;
|
|
26
|
+
}
|
|
27
|
+
case "stripes": {
|
|
28
|
+
const deg = props.deg || 130;
|
|
29
|
+
const gap = props.gap || 10;
|
|
30
|
+
const size = props.size || 5;
|
|
31
|
+
const color = props.color || "var(--naut-color-base-100)";
|
|
32
|
+
return `repeating-linear-gradient(${deg}deg, ${color} 0, ${color} ${size}px,transparent ${size}px,transparent ${gap}px)`;
|
|
33
|
+
}
|
|
34
|
+
default:
|
|
35
|
+
return "none";
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Size } from "../types";
|
|
2
|
+
|
|
3
|
+
export type Spacing = Size | "0";
|
|
4
|
+
|
|
5
|
+
export interface PaddingProps {
|
|
6
|
+
p?: Spacing; // all sides
|
|
7
|
+
pb?: Spacing; // bottom only
|
|
8
|
+
pl?: Spacing; // left only
|
|
9
|
+
pr?: Spacing; // right only
|
|
10
|
+
pt?: Spacing; // top only
|
|
11
|
+
px?: Spacing; // left + right
|
|
12
|
+
py?: Spacing; // top + bottom
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface MarginProps {
|
|
16
|
+
m?: Spacing; // all sides
|
|
17
|
+
mb?: Spacing; // bottom only
|
|
18
|
+
ml?: Spacing; // left only
|
|
19
|
+
mr?: Spacing; // right only
|
|
20
|
+
mt?: Spacing; // top only
|
|
21
|
+
mx?: Spacing; // left + right
|
|
22
|
+
my?: Spacing; // top + bottom
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface SpacingProps extends PaddingProps, MarginProps {}
|
|
26
|
+
|
|
27
|
+
// Extracts spacing props from a component's props
|
|
28
|
+
export function extractSpacingProps<T extends SpacingProps>(props: T) {
|
|
29
|
+
const { p, px, py, pt, pr, pb, pl, m, mx, my, mt, mr, mb, ml, ...rest } =
|
|
30
|
+
props;
|
|
31
|
+
|
|
32
|
+
const filterUndefined = (obj: Record<string, Spacing | undefined>) =>
|
|
33
|
+
Object.fromEntries(
|
|
34
|
+
Object.entries(obj).filter(([, v]) => v !== undefined)
|
|
35
|
+
) as Partial<SpacingProps>;
|
|
36
|
+
|
|
37
|
+
const padding = filterUndefined({ p, px, py, pt, pr, pb, pl });
|
|
38
|
+
const margin = filterUndefined({ m, mx, my, mt, mr, mb, ml });
|
|
39
|
+
const spacing = { ...padding, ...margin };
|
|
40
|
+
return { padding, margin, spacing, nonSpacing: rest as T };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// spacing classes
|
|
44
|
+
export function getSpacingClasses(props: SpacingProps): string[] {
|
|
45
|
+
return Object.entries(props)
|
|
46
|
+
.filter(([, value]) => value !== undefined)
|
|
47
|
+
.map(([key, value]) => `${key}-${value}`);
|
|
48
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--naut-border-width-sm: 0.031rem;
|
|
3
|
+
--naut-border-width-md: 0.063rem;
|
|
4
|
+
--naut-border-width-lg: 0.125rem;
|
|
5
|
+
--naut-border-width-xl: 0.195rem;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.border {
|
|
9
|
+
border-color: var(--naut-color-border);
|
|
10
|
+
border-style: solid;
|
|
11
|
+
border-width: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* Global Border Widths */
|
|
15
|
+
.border-sm {
|
|
16
|
+
border-width: var(--naut-border-width-sm);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.border-md {
|
|
20
|
+
border-width: var(--naut-border-width-md);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.border-lg {
|
|
24
|
+
border-width: var(--naut-border-width-lg);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.border-xl {
|
|
28
|
+
border-width: var(--naut-border-width-xl);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Global Border Styles */
|
|
32
|
+
.border-solid {
|
|
33
|
+
border-style: solid;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.border-dashed {
|
|
37
|
+
border-style: dashed;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.border-dotted {
|
|
41
|
+
border-style: dotted;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Side Border Widths */
|
|
45
|
+
|
|
46
|
+
/* Top */
|
|
47
|
+
.border-top-sm {
|
|
48
|
+
border-top-color: var(--naut-color-border-top, var(--naut-color-border));
|
|
49
|
+
border-top-width: var(--naut-border-width-sm);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.border-top-md {
|
|
53
|
+
border-top-color: var(--naut-color-border-top, var(--naut-color-border));
|
|
54
|
+
border-top-width: var(--naut-border-width-md);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.border-top-lg {
|
|
58
|
+
border-top-color: var(--naut-color-border-top, var(--naut-color-border));
|
|
59
|
+
border-top-width: var(--naut-border-width-lg);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.border-top-xl {
|
|
63
|
+
border-top-color: var(--naut-color-border-top, var(--naut-color-border));
|
|
64
|
+
border-top-width: var(--naut-border-width-xl);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.border-top-solid {
|
|
68
|
+
border-top-style: solid;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.border-top-dashed {
|
|
72
|
+
border-top-style: dashed;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.border-top-dotted {
|
|
76
|
+
border-top-style: dotted;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* Right */
|
|
80
|
+
.border-right-sm {
|
|
81
|
+
border-right-color: var(--naut-color-border-right, var(--naut-color-border));
|
|
82
|
+
border-right-width: var(--naut-border-width-sm);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.border-right-md {
|
|
86
|
+
border-right-color: var(--naut-color-border-right, var(--naut-color-border));
|
|
87
|
+
border-right-width: var(--naut-border-width-md);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.border-right-lg {
|
|
91
|
+
border-right-color: var(--naut-color-border-right, var(--naut-color-border));
|
|
92
|
+
border-right-width: var(--naut-border-width-lg);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.border-right-xl {
|
|
96
|
+
border-right-color: var(--naut-color-border-right, var(--naut-color-border));
|
|
97
|
+
border-right-width: var(--naut-border-width-xl);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.border-right-solid {
|
|
101
|
+
border-right-style: solid;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.border-right-dashed {
|
|
105
|
+
border-right-style: dashed;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.border-right-dotted {
|
|
109
|
+
border-right-style: dotted;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Bottom */
|
|
113
|
+
.border-bottom-sm {
|
|
114
|
+
border-bottom-color: var(--naut-color-border-bottom,
|
|
115
|
+
var(--naut-color-border));
|
|
116
|
+
border-bottom-width: var(--naut-border-width-sm);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.border-bottom-md {
|
|
120
|
+
border-bottom-color: var(--naut-color-border-bottom,
|
|
121
|
+
var(--naut-color-border));
|
|
122
|
+
border-bottom-width: var(--naut-border-width-md);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.border-bottom-lg {
|
|
126
|
+
border-bottom-color: var(--naut-color-border-bottom,
|
|
127
|
+
var(--naut-color-border));
|
|
128
|
+
border-bottom-width: var(--naut-border-width-lg);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.border-bottom-xl {
|
|
132
|
+
border-bottom-color: var(--naut-color-border-bottom,
|
|
133
|
+
var(--naut-color-border));
|
|
134
|
+
border-bottom-width: var(--naut-border-width-xl);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.border-bottom-solid {
|
|
138
|
+
border-bottom-style: solid;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.border-bottom-dashed {
|
|
142
|
+
border-bottom-style: dashed;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.border-bottom-dotted {
|
|
146
|
+
border-bottom-style: dotted;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* Left */
|
|
150
|
+
.border-left-sm {
|
|
151
|
+
border-left-color: var(--naut-color-border-left, var(--naut-color-border));
|
|
152
|
+
border-left-width: var(--naut-border-width-sm);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.border-left-md {
|
|
156
|
+
border-left-color: var(--naut-color-border-left, var(--naut-color-border));
|
|
157
|
+
border-left-width: var(--naut-border-width-md);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.border-left-lg {
|
|
161
|
+
border-left-color: var(--naut-color-border-left, var(--naut-color-border));
|
|
162
|
+
border-left-width: var(--naut-border-width-lg);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.border-left-xl {
|
|
166
|
+
border-left-color: var(--naut-color-border-left, var(--naut-color-border));
|
|
167
|
+
border-left-width: var(--naut-border-width-xl);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.border-left-solid {
|
|
171
|
+
border-left-style: solid;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.border-left-dashed {
|
|
175
|
+
border-left-style: dashed;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.border-left-dotted {
|
|
179
|
+
border-left-style: dotted;
|
|
180
|
+
}
|