fulldev-ui 0.1.64
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/.astro/types.d.ts +156 -0
- package/README.md +29 -0
- package/astro.config.mjs +7 -0
- package/package.json +45 -0
- package/src/blocks/todo.md +12 -0
- package/src/components/_Block.astro +20 -0
- package/src/components/_Blocks.astro +26 -0
- package/src/components/_Children.astro +38 -0
- package/src/components/_Plural.astro +27 -0
- package/src/components/_Tag.astro +53 -0
- package/src/components/base/Badge.astro +53 -0
- package/src/components/base/Button.astro +85 -0
- package/src/components/base/Buttons.astro +15 -0
- package/src/components/base/Checkbox.astro +39 -0
- package/src/components/base/Icon.astro +46 -0
- package/src/components/base/Image.astro +123 -0
- package/src/components/base/Images.astro +15 -0
- package/src/components/base/Input.astro +52 -0
- package/src/components/base/Logo.astro +33 -0
- package/src/components/base/Radio.astro +38 -0
- package/src/components/base/Rating.astro +45 -0
- package/src/components/base/Select.astro +65 -0
- package/src/components/base/SelectOption.astro +27 -0
- package/src/components/base/Switch.astro +82 -0
- package/src/components/base/Textarea.astro +31 -0
- package/src/components/base/Video.astro +32 -0
- package/src/components/base/todo.md +8 -0
- package/src/components/typography/Heading.astro +41 -0
- package/src/components/typography/Label.astro +36 -0
- package/src/components/typography/Link.astro +38 -0
- package/src/components/typography/Links.astro +15 -0
- package/src/components/typography/List.astro +42 -0
- package/src/components/typography/ListItem.astro +30 -0
- package/src/components/typography/Paragraph.astro +38 -0
- package/src/components/typography/Tagline.astro +39 -0
- package/src/components/typography/_Typography.astro +28 -0
- package/src/components/typography/todo.md +15 -0
- package/src/components/utility/DecorativeBox.astro +22 -0
- package/src/components/utility/Head.astro +81 -0
- package/src/components/wrapper/Body.astro +32 -0
- package/src/components/wrapper/Card.astro +144 -0
- package/src/components/wrapper/Cards.astro +15 -0
- package/src/components/wrapper/Deck.astro +133 -0
- package/src/components/wrapper/Footer.astro +14 -0
- package/src/components/wrapper/Form.astro +26 -0
- package/src/components/wrapper/Group.astro +26 -0
- package/src/components/wrapper/Header.astro +76 -0
- package/src/components/wrapper/Main.astro +25 -0
- package/src/components/wrapper/Nav.astro +32 -0
- package/src/components/wrapper/Prose.astro +108 -0
- package/src/components/wrapper/Section.astro +110 -0
- package/src/components/wrapper/Sections.astro +15 -0
- package/src/components/wrapper/Writeup.astro +23 -0
- package/src/components/wrapper/_Wrapper.astro +333 -0
- package/src/components/wrapper/todo.md +20 -0
- package/src/content/pages/index.md +2 -0
- package/src/css/border.css +23 -0
- package/src/css/colors.css +328 -0
- package/src/css/font.css +15 -0
- package/src/css/main.css +4 -0
- package/src/css/reset.css +388 -0
- package/src/css/sizes.css +273 -0
- package/src/env.d.ts +2 -0
- package/src/index.ts +63 -0
- package/src/integration/integration.ts +61 -0
- package/src/layouts/Layout.astro +39 -0
- package/src/layouts/todo.md +2 -0
- package/src/schemas/attributesSchema.ts +125 -0
- package/src/schemas/htmlAttributesSchema.ts +126 -0
- package/src/schemas/pageSchema.ts +185 -0
- package/src/schemas/staticPageSchema.ts +124 -0
- package/src/types/Childmorphic.ts +8 -0
- package/src/types/Pluralmorphic.ts +7 -0
- package/src/utils/getAllCollections.ts +10 -0
- package/src/utils/getCollectionCascade.ts +33 -0
- package/src/utils/getPathname.ts +18 -0
- package/src/utils/transform/transform.ts +25 -0
- package/src/utils/transform/transformCasing.ts +24 -0
- package/src/utils/transform/transformReferences.ts +54 -0
- package/src/utils/transform/transformSelfs.ts +20 -0
- package/src/utils/transform/transformUnderscores.ts +19 -0
- package/tsconfig.json +6 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
declare module 'astro:content' {
|
|
2
|
+
interface Render {
|
|
3
|
+
'.md': Promise<{
|
|
4
|
+
Content: import('astro').MarkdownInstance<{}>['Content'];
|
|
5
|
+
headings: import('astro').MarkdownHeading[];
|
|
6
|
+
remarkPluginFrontmatter: Record<string, any>;
|
|
7
|
+
}>;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare module 'astro:content' {
|
|
12
|
+
type Flatten<T> = T extends { [K: string]: infer U } ? U : never;
|
|
13
|
+
|
|
14
|
+
export type CollectionKey = keyof AnyEntryMap;
|
|
15
|
+
export type CollectionEntry<C extends CollectionKey> = Flatten<AnyEntryMap[C]>;
|
|
16
|
+
|
|
17
|
+
export type ContentCollectionKey = keyof ContentEntryMap;
|
|
18
|
+
export type DataCollectionKey = keyof DataEntryMap;
|
|
19
|
+
|
|
20
|
+
type AllValuesOf<T> = T extends any ? T[keyof T] : never;
|
|
21
|
+
type ValidContentEntrySlug<C extends keyof ContentEntryMap> = AllValuesOf<
|
|
22
|
+
ContentEntryMap[C]
|
|
23
|
+
>['slug'];
|
|
24
|
+
|
|
25
|
+
export function getEntryBySlug<
|
|
26
|
+
C extends keyof ContentEntryMap,
|
|
27
|
+
E extends ValidContentEntrySlug<C> | (string & {}),
|
|
28
|
+
>(
|
|
29
|
+
collection: C,
|
|
30
|
+
// Note that this has to accept a regular string too, for SSR
|
|
31
|
+
entrySlug: E
|
|
32
|
+
): E extends ValidContentEntrySlug<C>
|
|
33
|
+
? Promise<CollectionEntry<C>>
|
|
34
|
+
: Promise<CollectionEntry<C> | undefined>;
|
|
35
|
+
|
|
36
|
+
export function getDataEntryById<C extends keyof DataEntryMap, E extends keyof DataEntryMap[C]>(
|
|
37
|
+
collection: C,
|
|
38
|
+
entryId: E
|
|
39
|
+
): Promise<CollectionEntry<C>>;
|
|
40
|
+
|
|
41
|
+
export function getCollection<C extends keyof AnyEntryMap, E extends CollectionEntry<C>>(
|
|
42
|
+
collection: C,
|
|
43
|
+
filter?: (entry: CollectionEntry<C>) => entry is E
|
|
44
|
+
): Promise<E[]>;
|
|
45
|
+
export function getCollection<C extends keyof AnyEntryMap>(
|
|
46
|
+
collection: C,
|
|
47
|
+
filter?: (entry: CollectionEntry<C>) => unknown
|
|
48
|
+
): Promise<CollectionEntry<C>[]>;
|
|
49
|
+
|
|
50
|
+
export function getEntry<
|
|
51
|
+
C extends keyof ContentEntryMap,
|
|
52
|
+
E extends ValidContentEntrySlug<C> | (string & {}),
|
|
53
|
+
>(entry: {
|
|
54
|
+
collection: C;
|
|
55
|
+
slug: E;
|
|
56
|
+
}): E extends ValidContentEntrySlug<C>
|
|
57
|
+
? Promise<CollectionEntry<C>>
|
|
58
|
+
: Promise<CollectionEntry<C> | undefined>;
|
|
59
|
+
export function getEntry<
|
|
60
|
+
C extends keyof DataEntryMap,
|
|
61
|
+
E extends keyof DataEntryMap[C] | (string & {}),
|
|
62
|
+
>(entry: {
|
|
63
|
+
collection: C;
|
|
64
|
+
id: E;
|
|
65
|
+
}): E extends keyof DataEntryMap[C]
|
|
66
|
+
? Promise<DataEntryMap[C][E]>
|
|
67
|
+
: Promise<CollectionEntry<C> | undefined>;
|
|
68
|
+
export function getEntry<
|
|
69
|
+
C extends keyof ContentEntryMap,
|
|
70
|
+
E extends ValidContentEntrySlug<C> | (string & {}),
|
|
71
|
+
>(
|
|
72
|
+
collection: C,
|
|
73
|
+
slug: E
|
|
74
|
+
): E extends ValidContentEntrySlug<C>
|
|
75
|
+
? Promise<CollectionEntry<C>>
|
|
76
|
+
: Promise<CollectionEntry<C> | undefined>;
|
|
77
|
+
export function getEntry<
|
|
78
|
+
C extends keyof DataEntryMap,
|
|
79
|
+
E extends keyof DataEntryMap[C] | (string & {}),
|
|
80
|
+
>(
|
|
81
|
+
collection: C,
|
|
82
|
+
id: E
|
|
83
|
+
): E extends keyof DataEntryMap[C]
|
|
84
|
+
? Promise<DataEntryMap[C][E]>
|
|
85
|
+
: Promise<CollectionEntry<C> | undefined>;
|
|
86
|
+
|
|
87
|
+
/** Resolve an array of entry references from the same collection */
|
|
88
|
+
export function getEntries<C extends keyof ContentEntryMap>(
|
|
89
|
+
entries: {
|
|
90
|
+
collection: C;
|
|
91
|
+
slug: ValidContentEntrySlug<C>;
|
|
92
|
+
}[]
|
|
93
|
+
): Promise<CollectionEntry<C>[]>;
|
|
94
|
+
export function getEntries<C extends keyof DataEntryMap>(
|
|
95
|
+
entries: {
|
|
96
|
+
collection: C;
|
|
97
|
+
id: keyof DataEntryMap[C];
|
|
98
|
+
}[]
|
|
99
|
+
): Promise<CollectionEntry<C>[]>;
|
|
100
|
+
|
|
101
|
+
export function reference<C extends keyof AnyEntryMap>(
|
|
102
|
+
collection: C
|
|
103
|
+
): import('astro/zod').ZodEffects<
|
|
104
|
+
import('astro/zod').ZodString,
|
|
105
|
+
C extends keyof ContentEntryMap
|
|
106
|
+
? {
|
|
107
|
+
collection: C;
|
|
108
|
+
slug: ValidContentEntrySlug<C>;
|
|
109
|
+
}
|
|
110
|
+
: {
|
|
111
|
+
collection: C;
|
|
112
|
+
id: keyof DataEntryMap[C];
|
|
113
|
+
}
|
|
114
|
+
>;
|
|
115
|
+
// Allow generic `string` to avoid excessive type errors in the config
|
|
116
|
+
// if `dev` is not running to update as you edit.
|
|
117
|
+
// Invalid collection names will be caught at build time.
|
|
118
|
+
export function reference<C extends string>(
|
|
119
|
+
collection: C
|
|
120
|
+
): import('astro/zod').ZodEffects<import('astro/zod').ZodString, never>;
|
|
121
|
+
|
|
122
|
+
type ReturnTypeOrOriginal<T> = T extends (...args: any[]) => infer R ? R : T;
|
|
123
|
+
type InferEntrySchema<C extends keyof AnyEntryMap> = import('astro/zod').infer<
|
|
124
|
+
ReturnTypeOrOriginal<Required<ContentConfig['collections'][C]>['schema']>
|
|
125
|
+
>;
|
|
126
|
+
|
|
127
|
+
type ContentEntryMap = {
|
|
128
|
+
"layouts": {
|
|
129
|
+
"index.md": {
|
|
130
|
+
id: "index.md";
|
|
131
|
+
slug: "index";
|
|
132
|
+
body: string;
|
|
133
|
+
collection: "layouts";
|
|
134
|
+
data: any
|
|
135
|
+
} & { render(): Render[".md"] };
|
|
136
|
+
};
|
|
137
|
+
"pages": {
|
|
138
|
+
"index.md": {
|
|
139
|
+
id: "index.md";
|
|
140
|
+
slug: "index";
|
|
141
|
+
body: string;
|
|
142
|
+
collection: "pages";
|
|
143
|
+
data: any
|
|
144
|
+
} & { render(): Render[".md"] };
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
type DataEntryMap = {
|
|
150
|
+
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
type AnyEntryMap = ContentEntryMap & DataEntryMap;
|
|
154
|
+
|
|
155
|
+
export type ContentConfig = never;
|
|
156
|
+
}
|
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Fulldev UI
|
|
2
|
+
|
|
3
|
+
The [Astro][astro] UI library for content-driven websites
|
|
4
|
+
|
|
5
|
+
Rapidly build content-driven websites, with the power of modern design,
|
|
6
|
+
static / server rendering, and CSS cascading styles.
|
|
7
|
+
|
|
8
|
+
## Documentation
|
|
9
|
+
|
|
10
|
+
Please visit the [documentaion site][docs]
|
|
11
|
+
|
|
12
|
+
## Support
|
|
13
|
+
|
|
14
|
+
Please [create a Github issue ][issues] for things that cross your mind; feature requests, bug reports or feedback.
|
|
15
|
+
|
|
16
|
+
## Older versions
|
|
17
|
+
This package has moved to here. See [this package](https://www.npmjs.com/package/@fullui/ui) for older versions.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## License
|
|
21
|
+
|
|
22
|
+
MIT
|
|
23
|
+
|
|
24
|
+
Copyright (c) 2024–present [Fulldev][fulldev]
|
|
25
|
+
|
|
26
|
+
[astro]: https://astro.build/
|
|
27
|
+
[docs]: https://ui.full.dev/
|
|
28
|
+
[fulldev]: https://full.dev/
|
|
29
|
+
[issues]: https://github.com/fulldotdev/ui/issues/
|
package/astro.config.mjs
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fulldev-ui",
|
|
3
|
+
"version": "0.1.64",
|
|
4
|
+
"description": "A component library built for Astro",
|
|
5
|
+
"homepage": "https://ui.full.dev",
|
|
6
|
+
"bugs": "https://github.com/fulldotdev/ui/issues",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"author": "Fulldev <contact@full.dev> (https://full.dev)",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"withastro",
|
|
11
|
+
"astro",
|
|
12
|
+
"astro-component",
|
|
13
|
+
"astro-component-library",
|
|
14
|
+
"astro-ui-library",
|
|
15
|
+
"astro-ui"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"test": "astro check",
|
|
19
|
+
"check": "astro check"
|
|
20
|
+
},
|
|
21
|
+
"type": "module",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": "./src/index.ts",
|
|
24
|
+
"./css": "./src/css/main.css",
|
|
25
|
+
"./colors": "./src/css/colors.css"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@astrojs/check": "^0.5.9",
|
|
29
|
+
"@types/flat": "^5.0.5",
|
|
30
|
+
"astro": "^4.5.5"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@iconify-json/tabler": "^1.1.109",
|
|
34
|
+
"astro-icon": "^1.1.0",
|
|
35
|
+
"astro-seo": "^0.8.3",
|
|
36
|
+
"autoprefixer": "^10.4.19",
|
|
37
|
+
"cheerio": "1.0.0-rc.12",
|
|
38
|
+
"flat": "^6.0.1",
|
|
39
|
+
"radash": "^12.1.0",
|
|
40
|
+
"remeda": "1.61.0",
|
|
41
|
+
"sass": "^1.77.0",
|
|
42
|
+
"typescript": "^5.4.3",
|
|
43
|
+
"vite-plugin-virtual": "^0.3.0"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Add config files here for blocks. These should contain the following things:
|
|
2
|
+
|
|
3
|
+
- schema for in CMS
|
|
4
|
+
- default values
|
|
5
|
+
- schema for all possible props, cms and defaults combined
|
|
6
|
+
|
|
7
|
+
Each block should have it's own config file, because this aligns with how astro and markdown workk; they utilize folder structure.
|
|
8
|
+
We might need a folder for 'hero' for example, to add all possible hero's.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
example:
|
|
12
|
+
Hero component should choose which hero. Could also be a local hero. similar behaviour as blocks, but then only hero's.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
block?: string
|
|
4
|
+
[key: string | number | symbol]: any
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const libraryComponents = await Astro.glob('../**/*.astro')
|
|
8
|
+
const userComponents = await Astro.glob('/src/**/*.astro')
|
|
9
|
+
const components = [...userComponents, ...libraryComponents]
|
|
10
|
+
|
|
11
|
+
const { block, ...rest } = Astro.props
|
|
12
|
+
|
|
13
|
+
const Component = components.find((component) => {
|
|
14
|
+
const fileName = component.default.moduleId?.split('/').pop()
|
|
15
|
+
const componentName = fileName?.split('.')[0]
|
|
16
|
+
return componentName === block
|
|
17
|
+
})?.default
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
{Component && <Component {...rest} />}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { pascal } from 'radash'
|
|
3
|
+
import Block from './_Block.astro'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
[key: string | number | symbol]: {
|
|
7
|
+
block?: string
|
|
8
|
+
[key: string | number | symbol]: any
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
{
|
|
14
|
+
Object.entries(Astro.props).map(([key, value]) => {
|
|
15
|
+
const { block, ...rest } = value
|
|
16
|
+
const keyPart = key.split(/(?=[A-Z])/).pop()
|
|
17
|
+
const keyBlock = keyPart ? pascal(keyPart) : ''
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Block
|
|
21
|
+
block={block ?? keyBlock}
|
|
22
|
+
{...rest}
|
|
23
|
+
/>
|
|
24
|
+
)
|
|
25
|
+
})
|
|
26
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { isObject, pascal } from 'radash'
|
|
3
|
+
import { isArray, isString } from 'remeda'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
render?: () => any
|
|
7
|
+
[key: string]: any
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const components = await Astro.glob('../**/*.astro')
|
|
11
|
+
// const userComponents = await Astro.glob('/src/**/*.astro')
|
|
12
|
+
// const components = [...userComponents, ...libraryComponents]
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
{
|
|
16
|
+
Object.entries(Astro.props).map(([key, value]) => {
|
|
17
|
+
const lastPart = key.split(/(?=[A-Z])/).pop()
|
|
18
|
+
if (!lastPart) return null
|
|
19
|
+
const part = pascal(lastPart)
|
|
20
|
+
|
|
21
|
+
if (part === 'Text' && isString(value)) return value
|
|
22
|
+
if (part === 'Html') return <Fragment set:html={value} />
|
|
23
|
+
if (part === 'Content' && Astro.props.render) {
|
|
24
|
+
const { Content } = Astro.props.render()
|
|
25
|
+
return <Content />
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const Component: any = components.find((component) => {
|
|
29
|
+
const fileName = component.default.moduleId?.split('/').pop()
|
|
30
|
+
const componentName = fileName?.split('.')[0]
|
|
31
|
+
return componentName === part
|
|
32
|
+
})?.default
|
|
33
|
+
|
|
34
|
+
if (!Component) return null
|
|
35
|
+
if (isObject(value) || isArray(value)) return <Component {...value} />
|
|
36
|
+
return <Component html={value} />
|
|
37
|
+
})
|
|
38
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { listify } from 'radash'
|
|
3
|
+
import { isNumber, isString, pickBy } from 'remeda'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
component: any
|
|
7
|
+
[defaults: string]: any
|
|
8
|
+
[items: number]: object | string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { component: Component, ...rest } = Astro.props
|
|
12
|
+
|
|
13
|
+
const defaults = pickBy(rest, (v, key) => !isNumber(parseInt(key as string)))
|
|
14
|
+
|
|
15
|
+
const items = pickBy(rest, (v, key) => isNumber(parseInt(key as string)))
|
|
16
|
+
const array = listify(items, (k, value) => value)
|
|
17
|
+
const mapped = array.map((item) => (isString(item) ? { html: item } : item))
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
{
|
|
21
|
+
mapped.map((item) => (
|
|
22
|
+
<Component
|
|
23
|
+
{...defaults}
|
|
24
|
+
{...item}
|
|
25
|
+
/>
|
|
26
|
+
))
|
|
27
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
theme?: 'light' | 'dark' | string
|
|
4
|
+
size?: 'sm' | 'md' | 'lg' | string
|
|
5
|
+
density?: 'base' | 'compact' | string
|
|
6
|
+
slot?: any
|
|
7
|
+
if?: 'slot' | any
|
|
8
|
+
[key: string | number | symbol]: any
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
as: As = 'div',
|
|
13
|
+
if: ifProp = 'slot',
|
|
14
|
+
theme,
|
|
15
|
+
variant,
|
|
16
|
+
density,
|
|
17
|
+
size,
|
|
18
|
+
...rest
|
|
19
|
+
} = Astro.props
|
|
20
|
+
|
|
21
|
+
const slot = await Astro.slots.render('default')
|
|
22
|
+
const render = ifProp === 'slot' ? slot?.trim().length > 0 : ifProp
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
{
|
|
26
|
+
render && (
|
|
27
|
+
<As
|
|
28
|
+
class:list={[
|
|
29
|
+
'full-tag',
|
|
30
|
+
{
|
|
31
|
+
[`full-theme-${theme}`]: theme,
|
|
32
|
+
[`full-variant-${variant}`]: variant,
|
|
33
|
+
[`full-density-${density}`]: density,
|
|
34
|
+
[`full-size-${size}`]: size,
|
|
35
|
+
},
|
|
36
|
+
]}
|
|
37
|
+
{...rest}
|
|
38
|
+
>
|
|
39
|
+
<Fragment set:html={slot} />
|
|
40
|
+
</As>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
<style is:global>
|
|
45
|
+
@import '../css/main.css';
|
|
46
|
+
</style>
|
|
47
|
+
|
|
48
|
+
<style is:global>
|
|
49
|
+
.full-tag {
|
|
50
|
+
z-index: 0;
|
|
51
|
+
box-sizing: border-box;
|
|
52
|
+
}
|
|
53
|
+
</style>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { ComponentProps, HTMLTag, Polymorphic } from 'astro/types'
|
|
3
|
+
import type { Childmorphic } from '../../types/Childmorphic'
|
|
4
|
+
import Children from '../_Children.astro'
|
|
5
|
+
import Tag from '../_Tag.astro'
|
|
6
|
+
|
|
7
|
+
type Props<As extends HTMLTag = 'div'> = Polymorphic<{ as: As }> &
|
|
8
|
+
ComponentProps<typeof Tag> &
|
|
9
|
+
Childmorphic<{
|
|
10
|
+
html: string
|
|
11
|
+
text: string
|
|
12
|
+
}>
|
|
13
|
+
|
|
14
|
+
const { as = 'div', variant, ...rest } = Astro.props
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<Tag
|
|
18
|
+
class:list={['full-badge']}
|
|
19
|
+
{as}
|
|
20
|
+
{variant}
|
|
21
|
+
{...rest}
|
|
22
|
+
>
|
|
23
|
+
<slot name="before" />
|
|
24
|
+
<Children {...rest} />
|
|
25
|
+
<slot />
|
|
26
|
+
</Tag>
|
|
27
|
+
|
|
28
|
+
<style is:global lang="scss">
|
|
29
|
+
.full-badge {
|
|
30
|
+
display: inline-flex;
|
|
31
|
+
flex-shrink: 0;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
align-items: center;
|
|
34
|
+
vertical-align: top;
|
|
35
|
+
gap: var(--space-2);
|
|
36
|
+
transition: var(--full-transition);
|
|
37
|
+
box-shadow: inset 0 0 0 1px var(--border);
|
|
38
|
+
border-radius: var(--full-border-radius-2);
|
|
39
|
+
background-color: var(--background);
|
|
40
|
+
padding-right: var(--space-element-2);
|
|
41
|
+
padding-left: var(--space-element-2);
|
|
42
|
+
height: calc(var(--text-element) + 2 * var(--space-element-1));
|
|
43
|
+
color: var(--foreground);
|
|
44
|
+
font-weight: var(--full-button-font-weight);
|
|
45
|
+
font-size: var(--text-element);
|
|
46
|
+
line-height: 1.625;
|
|
47
|
+
font-family: var(--full-button-font-family);
|
|
48
|
+
user-select: none;
|
|
49
|
+
text-align: center;
|
|
50
|
+
text-decoration: none;
|
|
51
|
+
white-space: nowrap;
|
|
52
|
+
}
|
|
53
|
+
</style>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { ComponentProps, HTMLTag, Polymorphic } from 'astro/types'
|
|
3
|
+
import type { Childmorphic } from '../../types/Childmorphic'
|
|
4
|
+
import Children from '../_Children.astro'
|
|
5
|
+
import Tag from '../_Tag.astro'
|
|
6
|
+
import type Icon from './Icon.astro'
|
|
7
|
+
|
|
8
|
+
type Props<As extends HTMLTag = 'a'> = Polymorphic<{ as: As }> &
|
|
9
|
+
ComponentProps<typeof Tag> &
|
|
10
|
+
Childmorphic<{
|
|
11
|
+
html: string
|
|
12
|
+
text: string
|
|
13
|
+
variant?: 'primary' | 'secondary' | 'ghost'
|
|
14
|
+
icon: ComponentProps<typeof Icon> | ComponentProps<typeof Icon>['name']
|
|
15
|
+
}>
|
|
16
|
+
|
|
17
|
+
// TODO: variants: link, filled, outline, ghost. Deze zijn independent van de color prop. Betekent dus dat je een outline variant hebt van elke color.
|
|
18
|
+
// Let wel op, dit werkt niet met de Primary variant, omdat deze kleuren dan niet kloppen.
|
|
19
|
+
|
|
20
|
+
const { as = 'a', variant = 'primary', ...rest } = Astro.props
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
<Tag
|
|
24
|
+
class:list={['full-button']}
|
|
25
|
+
{as}
|
|
26
|
+
{variant}
|
|
27
|
+
{...rest}
|
|
28
|
+
>
|
|
29
|
+
<slot name="before" />
|
|
30
|
+
<Children {...rest} />
|
|
31
|
+
<slot />
|
|
32
|
+
</Tag>
|
|
33
|
+
|
|
34
|
+
<style is:global lang="scss">
|
|
35
|
+
.full-button {
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
flex-shrink: 0;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
align-items: center;
|
|
40
|
+
vertical-align: top;
|
|
41
|
+
gap: var(--space-2);
|
|
42
|
+
transition: background-color var(--full-transition);
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
outline: none !important;
|
|
45
|
+
box-shadow: inset 0 0 0 1px var(--color-border);
|
|
46
|
+
border: none;
|
|
47
|
+
border-radius: var(--full-border-radius-2);
|
|
48
|
+
background-color: var(--background);
|
|
49
|
+
padding-right: var(--space-element-3);
|
|
50
|
+
padding-left: var(--space-element-3);
|
|
51
|
+
height: calc(var(--text-element) + 2 * var(--space-element-3));
|
|
52
|
+
color: var(--foreground);
|
|
53
|
+
font-weight: var(--full-button-font-weight);
|
|
54
|
+
font-size: var(--text-element);
|
|
55
|
+
line-height: 1.625;
|
|
56
|
+
font-family: var(--full-button-font-family);
|
|
57
|
+
user-select: none;
|
|
58
|
+
text-align: center;
|
|
59
|
+
text-decoration: none;
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
|
|
62
|
+
&:hover {
|
|
63
|
+
background-color: var(--hover);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&:focus-visible {
|
|
67
|
+
outline: 2px solid var(--focus) !important;
|
|
68
|
+
outline-offset: 2px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&:disabled {
|
|
72
|
+
opacity: 0.5;
|
|
73
|
+
cursor: not-allowed;
|
|
74
|
+
pointer-events: none;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.full-tag + & {
|
|
78
|
+
--my-spacer: var(--space-4);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
& + & {
|
|
82
|
+
--my-spacer: var(--space-2);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { ComponentProps } from 'astro/types'
|
|
3
|
+
import type { Pluralmorphic } from '../../types/Pluralmorphic'
|
|
4
|
+
import Plural from '../_Plural.astro'
|
|
5
|
+
import Button from './Button.astro'
|
|
6
|
+
|
|
7
|
+
type Props = Pluralmorphic<ComponentProps<typeof Button>>
|
|
8
|
+
|
|
9
|
+
const { props } = Astro
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<Plural
|
|
13
|
+
component={Button}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { ComponentProps, HTMLTag } from 'astro/types'
|
|
3
|
+
import Tag from '../_Tag.astro'
|
|
4
|
+
|
|
5
|
+
type Props<As extends HTMLTag = 'input'> = ComponentProps<typeof Tag<As>>
|
|
6
|
+
|
|
7
|
+
const { as = 'input', type = 'checkbox', name, ...rest } = Astro.props
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<Tag
|
|
11
|
+
class:list={['full-checkbox']}
|
|
12
|
+
if={name}
|
|
13
|
+
{name}
|
|
14
|
+
{as}
|
|
15
|
+
{type}
|
|
16
|
+
{...rest}
|
|
17
|
+
/>
|
|
18
|
+
|
|
19
|
+
<style is:global lang="scss">
|
|
20
|
+
.full-checkbox {
|
|
21
|
+
border-width: var(--border-width);
|
|
22
|
+
border-color: var(--border-color);
|
|
23
|
+
border-radius: var(--full-border-radius-2);
|
|
24
|
+
background: var(--background);
|
|
25
|
+
color: var(--color);
|
|
26
|
+
accent-color: var(--10);
|
|
27
|
+
font-size: var(--text);
|
|
28
|
+
|
|
29
|
+
&:hover {
|
|
30
|
+
border: var(--border-color-hover);
|
|
31
|
+
background: var(--background-hover);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:active {
|
|
35
|
+
border: var(--border-color-active);
|
|
36
|
+
background: var(--background-active);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
</style>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
import tablerIcons from '@iconify-json/tabler/icons.json'
|
|
3
|
+
import type { ComponentProps, HTMLTag } from 'astro/types'
|
|
4
|
+
import Tag from '../_Tag.astro'
|
|
5
|
+
|
|
6
|
+
type Props<As extends HTMLTag = 'i'> = ComponentProps<typeof Tag> & {
|
|
7
|
+
name?: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { as = 'i', name = Astro.props.html, ...rest } = Astro.props
|
|
11
|
+
|
|
12
|
+
const trimmedName = name?.trim() as string | undefined
|
|
13
|
+
const icon = trimmedName && (tablerIcons as any)?.icons[trimmedName]?.body
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
<Tag
|
|
17
|
+
class:list={['full-icon']}
|
|
18
|
+
if={icon}
|
|
19
|
+
{as}
|
|
20
|
+
{...rest}
|
|
21
|
+
>
|
|
22
|
+
<svg
|
|
23
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
24
|
+
viewBox="0 0 24 24"
|
|
25
|
+
set:html={icon}
|
|
26
|
+
/>
|
|
27
|
+
</Tag>
|
|
28
|
+
|
|
29
|
+
<style is:global lang="scss">
|
|
30
|
+
.full-icon {
|
|
31
|
+
display: inline-flex;
|
|
32
|
+
position: relative;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
align-items: center;
|
|
35
|
+
width: 1em;
|
|
36
|
+
height: 1em;
|
|
37
|
+
color: var(--foreground);
|
|
38
|
+
font-size: var(--text);
|
|
39
|
+
|
|
40
|
+
svg {
|
|
41
|
+
position: absolute;
|
|
42
|
+
width: 120%;
|
|
43
|
+
height: 120%;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
</style>
|