@yuzu-jobs/ui-components 0.0.1

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 ADDED
@@ -0,0 +1,40 @@
1
+ # Astro Starter Kit: Component Package
2
+
3
+ This is a template for an Astro component library. Use this template for writing components to use in multiple projects or publish to NPM.
4
+
5
+ ```sh
6
+ npm create astro@latest -- --template component
7
+ ```
8
+
9
+ [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/non-html-pages)
10
+ [![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/non-html-pages)
11
+ [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/component/devcontainer.json)
12
+
13
+ ## 🚀 Project Structure
14
+
15
+ Inside of your Astro project, you'll see the following folders and files:
16
+
17
+ ```text
18
+ /
19
+ ├── index.ts
20
+ ├── src
21
+ │ └── MyComponent.astro
22
+ ├── tsconfig.json
23
+ ├── package.json
24
+ ```
25
+
26
+ The `index.ts` file is the "entry point" for your package. Export your components in `index.ts` to make them importable from your package.
27
+
28
+ ## 🧞 Commands
29
+
30
+ All commands are run from the root of the project, from a terminal:
31
+
32
+ | Command | Action |
33
+ | :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
34
+ | `npm link` | Registers this package locally. Run `npm link my-component-library` in an Astro project to install your components |
35
+ | `npm publish` | [Publishes](https://docs.npmjs.com/creating-and-publishing-unscoped-public-packages#publishing-unscoped-public-packages) this package to NPM. Requires you to be [logged in](https://docs.npmjs.com/cli/v8/commands/npm-adduser) |
36
+
37
+ ## Publishing
38
+
39
+ - `npm login`
40
+ - `npm run release patch` (or `minor` or `major` depending on the type of release)
package/index.ts ADDED
@@ -0,0 +1,9 @@
1
+ // Do not write code directly here, instead use the `src` folder!
2
+ // Then, use this file to export everything you want your user to access.
3
+
4
+ import InputText from "./src/InputText.astro";
5
+ import InputContainer from "./src/InputContainer.astro";
6
+ import InputLabel from "./src/InputLabel.astro";
7
+ import Alert from "./src/Alert.astro";
8
+
9
+ export { InputText, InputContainer, InputLabel, Alert };
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@yuzu-jobs/ui-components",
3
+ "engines": {
4
+ "node": ">=22.12.0"
5
+ },
6
+ "version": "0.0.1",
7
+ "type": "module",
8
+ "exports": {
9
+ ".": "./index.ts"
10
+ },
11
+ "files": [
12
+ "src",
13
+ "index.ts"
14
+ ],
15
+ "keywords": [
16
+ "astro-component"
17
+ ],
18
+ "scripts": {
19
+ "release:patch": "npm version patch --no-git-tag-version && npm publish --access public",
20
+ "release:minor": "npm version minor --no-git-tag-version && npm publish --access public",
21
+ "release:major": "npm version major --no-git-tag-version && npm publish --access public"
22
+ },
23
+ "devDependencies": {
24
+ "@lucide/astro": "^1.6.0",
25
+ "@tailwindcss/vite": "^4.2.2",
26
+ "astro": "^6.1.3",
27
+ "tailwindcss": "^4.2.2"
28
+ },
29
+ "peerDependencies": {
30
+ "astro": "^5.0.0 || ^6.0.0",
31
+ "tailwindcss": "^4.0.0"
32
+ }
33
+ }
@@ -0,0 +1,52 @@
1
+ ---
2
+ import { CircleCheck, CircleAlert, Info, TriangleAlert } from "@lucide/astro";
3
+
4
+ type Variant = "success" | "error" | "warning" | "info";
5
+
6
+ interface Props {
7
+ variant: Variant;
8
+ class?: string;
9
+ id?: string;
10
+ }
11
+
12
+ const { variant, class: className, id } = Astro.props;
13
+
14
+ const variantClasses: Record<Variant, string> = {
15
+ success: "bg-emerald-50 border-emerald-500 text-emerald-800",
16
+ error: "bg-red-50 border-red-500 text-red-800",
17
+ warning: "bg-amber-50 border-amber-500 text-amber-800",
18
+ info: "bg-indigo-50 border-indigo-500 text-indigo-800",
19
+ };
20
+
21
+ const iconClasses: Record<Variant, string> = {
22
+ success: "text-emerald-500",
23
+ error: "text-red-500",
24
+ warning: "text-amber-500",
25
+ info: "text-indigo-500",
26
+ };
27
+
28
+ const icons: Record<Variant, typeof CircleCheck> = {
29
+ success: CircleCheck,
30
+ error: CircleAlert,
31
+ warning: TriangleAlert,
32
+ info: Info,
33
+ };
34
+
35
+ const Icon = icons[variant];
36
+ ---
37
+
38
+ <div
39
+ id={id}
40
+ class:list={[
41
+ "flex items-start gap-3 border border-transparent border-l-4 px-4 py-3 rounded-lg text-sm font-sans shadow-sm",
42
+ variantClasses[variant],
43
+ className,
44
+ ]}
45
+ >
46
+ <span class:list={["mt-0.5 shrink-0", iconClasses[variant]]}>
47
+ <Icon size={16} />
48
+ </span>
49
+ <span class="leading-relaxed">
50
+ <slot />
51
+ </span>
52
+ </div>
@@ -0,0 +1,3 @@
1
+ <div class="flex flex-col mb-6">
2
+ <slot />
3
+ </div>
@@ -0,0 +1,14 @@
1
+ ---
2
+ interface Props {
3
+ text: string;
4
+ inputId: string;
5
+ required?: boolean;
6
+ }
7
+
8
+ const { text, inputId, required } = Astro.props;
9
+ ---
10
+
11
+ <label class="text-sm font-semibold" for={inputId}>
12
+ {text}
13
+ {required && <span class="text-red-500 text-lg">*</span>}
14
+ </label>
@@ -0,0 +1,61 @@
1
+ ---
2
+ interface Props {
3
+ id: string;
4
+ name: string;
5
+ placeholder?: string;
6
+ required?: boolean;
7
+ type?: "text" | "email" | "password" | "number" | "tel" | "url";
8
+ value?: string;
9
+ maxLength?: number;
10
+ minLength?: number;
11
+ autocomplete?: string;
12
+ }
13
+
14
+ const {
15
+ id,
16
+ name,
17
+ placeholder,
18
+ required,
19
+ type,
20
+ value,
21
+ maxLength,
22
+ minLength,
23
+ autocomplete,
24
+ } = Astro.props;
25
+
26
+ const className =
27
+ "p-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent";
28
+ ---
29
+
30
+ {
31
+ type == "number" && (
32
+ <input
33
+ class={className}
34
+ type={type ?? "text"}
35
+ step="0.01"
36
+ id={id}
37
+ name={name}
38
+ placeholder={placeholder ?? ""}
39
+ required={required ?? false}
40
+ value={value ?? ""}
41
+ autocomplete={autocomplete}
42
+ />
43
+ )
44
+ }
45
+
46
+ {
47
+ type != "number" && (
48
+ <input
49
+ class={className}
50
+ type={type ?? "text"}
51
+ id={id}
52
+ name={name}
53
+ placeholder={placeholder ?? ""}
54
+ required={required ?? false}
55
+ value={value ?? ""}
56
+ maxlength={maxLength ?? 500}
57
+ minlength={minLength ?? 0}
58
+ autocomplete={autocomplete}
59
+ />
60
+ )
61
+ }