@julianelda/domos 2.0.0 → 2.1.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.
@@ -1,16 +1,25 @@
1
1
  <script lang="ts">
2
+ import { clsx } from "clsx";
3
+ import { twMerge } from "tailwind-merge";
4
+
2
5
  import type { ButtonProps } from "./button.types.js";
3
6
 
4
- const { children, variant = "primary", ...rest }: ButtonProps = $props();
7
+ const {
8
+ children,
9
+ class: className,
10
+ variant = "primary",
11
+ ...rest
12
+ }: ButtonProps = $props();
5
13
  </script>
6
14
 
7
15
  <button
8
16
  {...rest}
9
- class={[
17
+ class={twMerge(
10
18
  "cursor-pointer appearance-none rounded-lg p-2 text-lg shadow-sm hover:border-primary-500 hover:bg-primary-500 focus:ring-primary-300 focus-visible:outline focus-visible:outline-offset-2 focus-visible:outline-primary-300 active:bg-primary-700 dark:hover:bg-primary-500",
11
19
  variant === "primary"
12
20
  ? "border-primary-700 bg-primary-700 text-ink-white"
13
21
  : "border border-ink-500 bg-card-background-light text-ink-black hover:text-white dark:bg-slate dark:text-ink-white",
14
- ]}>
22
+ clsx(className),
23
+ )}>
15
24
  {@render children?.()}
16
25
  </button>
@@ -1,8 +1,17 @@
1
1
  <script lang="ts">
2
- const { children } = $props();
2
+ import { clsx } from "clsx";
3
+ import { twMerge } from "tailwind-merge";
4
+
5
+ import type { CardProps } from "./card.types.js";
6
+
7
+ const { children, class: className, ...rest }: CardProps = $props();
3
8
  </script>
4
9
 
5
10
  <div
6
- class="rounded-md bg-card-background-light p-1 shadow-sm sm:p-4 dark:bg-card-background-dark">
11
+ {...rest}
12
+ class={twMerge(
13
+ "rounded-md bg-card-background-light p-1 shadow-sm sm:p-4 dark:bg-card-background-dark",
14
+ clsx(className),
15
+ )}>
7
16
  {@render children?.()}
8
17
  </div>
@@ -1,5 +1,4 @@
1
- declare const Card: import("svelte").Component<{
2
- children: any;
3
- }, {}, "">;
1
+ import type { CardProps } from "./card.types.ts";
2
+ declare const Card: import("svelte").Component<CardProps, {}, "">;
4
3
  type Card = ReturnType<typeof Card>;
5
4
  export default Card;
@@ -0,0 +1,5 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { HTMLAttributes } from "svelte/elements";
3
+ export interface CardProps extends HTMLAttributes<HTMLDivElement> {
4
+ children?: Snippet;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,9 +1,17 @@
1
1
  <script lang="ts">
2
2
  import InputLabel from "../input-label/input-label.svelte";
3
+ import { clsx } from "clsx";
4
+ import { twMerge } from "tailwind-merge";
3
5
 
4
6
  import type { CheckboxProps } from "./checkbox.types.js";
5
7
 
6
- const { hideLabel, id, label, ...rest }: CheckboxProps = $props();
8
+ const {
9
+ class: className,
10
+ hideLabel,
11
+ id,
12
+ label,
13
+ ...rest
14
+ }: CheckboxProps = $props();
7
15
  </script>
8
16
 
9
17
  <div class="relative flex items-start gap-1">
@@ -11,7 +19,10 @@
11
19
  <input
12
20
  {...rest}
13
21
  {id}
14
- class="form-checkbox inline-block size-4 rounded-md border-0 bg-white p-1 text-primary-500 accent-primary-500 ring-1 ring-ink-500 ring-inset focus:border-primary-300 focus:ring-1 focus:ring-primary-300 focus:ring-inset dark:bg-ink-500"
22
+ class={twMerge(
23
+ "form-checkbox inline-block size-4 rounded-md border-0 bg-white p-1 text-primary-500 accent-primary-500 ring-1 ring-ink-500 ring-inset focus:border-primary-300 focus:ring-1 focus:ring-primary-300 focus:ring-inset dark:bg-ink-500",
24
+ clsx(className),
25
+ )}
15
26
  type="checkbox" />
16
27
  </div>
17
28
  <div class="leading-6">
@@ -1,5 +1,6 @@
1
1
  import type { HTMLInputAttributes } from "svelte/elements";
2
2
  export interface CheckboxProps extends HTMLInputAttributes {
3
3
  hideLabel?: boolean;
4
+ id: string;
4
5
  label: string;
5
6
  }
@@ -1,13 +1,21 @@
1
1
  <script lang="ts">
2
2
  import InputField from "../input-field/input-field.svelte";
3
3
  import InputLabel from "../input-label/input-label.svelte";
4
+ import { clsx } from "clsx";
5
+ import { twMerge } from "tailwind-merge";
4
6
 
5
7
  import type { InputProps } from "./input.types.js";
6
8
 
7
- const { hideLabel, id, label, ...rest }: InputProps = $props();
9
+ const {
10
+ class: className,
11
+ hideLabel,
12
+ id,
13
+ label,
14
+ ...rest
15
+ }: InputProps = $props();
8
16
  </script>
9
17
 
10
- <div class="flex flex-1 flex-col gap-1">
18
+ <div class={twMerge("flex flex-1 flex-col gap-1", clsx(className))}>
11
19
  <InputLabel
12
20
  {hideLabel}
13
21
  {id}
@@ -1,11 +1,14 @@
1
1
  <script lang="ts">
2
2
  import InputField from "../input-field/input-field.svelte";
3
3
  import InputLabel from "../input-label/input-label.svelte";
4
+ import { clsx } from "clsx";
5
+ import { twMerge } from "tailwind-merge";
4
6
 
5
7
  import type { InputButtonProps } from "./input-button.types.js";
6
8
 
7
9
  const {
8
10
  buttonAriaLabel,
11
+ class: className,
9
12
  hideLabel,
10
13
  icon,
11
14
  id,
@@ -15,7 +18,7 @@
15
18
  }: InputButtonProps = $props();
16
19
  </script>
17
20
 
18
- <div class="flex flex-1 flex-col gap-1">
21
+ <div class={twMerge("flex flex-1 flex-col gap-1", clsx(className))}>
19
22
  <InputLabel
20
23
  hideLabel={Boolean(hideLabel)}
21
24
  {id}
@@ -1,8 +1,12 @@
1
1
  <script lang="ts">
2
+ import { clsx } from "clsx";
3
+ import { twMerge } from "tailwind-merge";
4
+
2
5
  import type { InputFieldProps } from "./input-field.types.js";
3
6
 
4
7
  const {
5
8
  borderless = false,
9
+ class: className,
6
10
  withIconLeft = false,
7
11
  ...rest
8
12
  }: InputFieldProps = $props();
@@ -10,13 +14,14 @@
10
14
 
11
15
  <input
12
16
  {...rest}
13
- class={[
17
+ class={twMerge(
14
18
  "form-input block w-full appearance-none border text-ink-black dark:text-app-text-dark",
15
19
  borderless === true
16
20
  ? "border-0 bg-transparent p-0 ring-0 outline-none focus:ring-0 focus:outline-none"
17
21
  : "border-ink-gray bg-white p-2 px-3 ring-inset focus:border-primary-300 focus:ring-1 focus:ring-primary-300 focus:ring-inset dark:bg-slate",
18
22
  withIconLeft === true ? "rounded-l-md" : "rounded-md",
19
- ]} />
23
+ clsx(className),
24
+ )} />
20
25
 
21
26
  <style>
22
27
  input[type="number"]::-webkit-inner-spin-button,
@@ -1,16 +1,26 @@
1
1
  <script lang="ts">
2
+ import { clsx } from "clsx";
3
+ import { twMerge } from "tailwind-merge";
4
+
2
5
  import type { InputLabelProps } from "./input-label.types.js";
3
6
 
4
7
  const {
8
+ class: className,
5
9
  hideLabel = false,
6
10
  id,
7
11
  label,
8
12
  value = "",
13
+ ...rest
9
14
  }: InputLabelProps = $props();
10
15
  </script>
11
16
 
12
17
  <label
13
- class={["font-heading mr-auto font-bold", hideLabel && "sr-only"]}
18
+ {...rest}
19
+ class={twMerge(
20
+ "font-heading mr-auto font-bold",
21
+ hideLabel && "sr-only",
22
+ clsx(className),
23
+ )}
14
24
  for={id}>
15
25
  {label}
16
26
  {#if value !== ""}
@@ -1,4 +1,5 @@
1
- export interface InputLabelProps {
1
+ import type { HTMLLabelAttributes } from "svelte/elements";
2
+ export interface InputLabelProps extends HTMLLabelAttributes {
2
3
  hideLabel?: boolean;
3
4
  id: string;
4
5
  label: string;
@@ -2,10 +2,16 @@
2
2
  import InputField from "../input-field/input-field.svelte";
3
3
  import InputLabel from "../input-label/input-label.svelte";
4
4
  import SelectField from "../select-field/select-field.svelte";
5
+ import { twMerge } from "tailwind-merge";
5
6
 
6
7
  import type { InputSelectProps } from "./input-select.types.js";
7
8
 
8
- const { hideLabel, inputProps, selectProps }: InputSelectProps = $props();
9
+ const {
10
+ class: className,
11
+ hideLabel,
12
+ inputProps,
13
+ selectProps,
14
+ }: InputSelectProps = $props();
9
15
 
10
16
  const inputFieldProps = $derived.by(() => {
11
17
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -20,7 +26,7 @@
20
26
  });
21
27
  </script>
22
28
 
23
- <div class="flex flex-1 flex-col gap-1">
29
+ <div class={twMerge("flex flex-1 flex-col gap-1", className)}>
24
30
  <InputLabel
25
31
  {hideLabel}
26
32
  id={inputProps.id}
@@ -4,6 +4,7 @@ export interface InputSelectInputProps extends InputFieldProps {
4
4
  label: string;
5
5
  }
6
6
  export interface InputSelectProps {
7
+ class?: string;
7
8
  hideLabel?: boolean;
8
9
  inputProps: InputSelectInputProps;
9
10
  selectProps: InputSelectSelectProps;
@@ -1,13 +1,21 @@
1
1
  <script lang="ts">
2
2
  import InputLabel from "../input-label/input-label.svelte";
3
3
  import SelectField from "../select-field/select-field.svelte";
4
+ import { clsx } from "clsx";
5
+ import { twMerge } from "tailwind-merge";
4
6
 
5
7
  import type { SelectProps } from "./select.types.js";
6
8
 
7
- const { hideLabel, id, label, ...rest }: SelectProps = $props();
9
+ const {
10
+ class: className,
11
+ hideLabel,
12
+ id,
13
+ label,
14
+ ...rest
15
+ }: SelectProps = $props();
8
16
  </script>
9
17
 
10
- <div class="flex flex-1 flex-col gap-1">
18
+ <div class={twMerge("flex flex-1 flex-col gap-1", clsx(className))}>
11
19
  <InputLabel
12
20
  {hideLabel}
13
21
  {id}
@@ -1,8 +1,12 @@
1
1
  <script lang="ts">
2
+ import { clsx } from "clsx";
3
+ import { twMerge } from "tailwind-merge";
4
+
2
5
  import type { SelectFieldProps } from "./select-field.types.js";
3
6
 
4
7
  const {
5
8
  borderless = false,
9
+ class: className,
6
10
  inInputField = false,
7
11
  options,
8
12
  ...rest
@@ -11,7 +15,7 @@
11
15
 
12
16
  <select
13
17
  {...rest}
14
- class={[
18
+ class={twMerge(
15
19
  "form-select w-full appearance-none rounded-md text-ink-black dark:bg-slate dark:text-ink-white",
16
20
  borderless === true
17
21
  ? "border-0 bg-transparent p-0 ring-0 outline-none focus:ring-0 focus:outline-none"
@@ -19,7 +23,8 @@
19
23
  inInputField === true
20
24
  ? "h-full rounded-l-none bg-transparent"
21
25
  : "block pl-3",
22
- ]}>
26
+ clsx(className),
27
+ )}>
23
28
  {#each options as option (option.value)}
24
29
  <option value={option.value}>
25
30
  {option.label}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@julianelda/domos",
3
- "version": "2.0.0",
3
+ "version": "2.1.1",
4
4
  "keywords": [
5
5
  "svelte"
6
6
  ],
@@ -30,6 +30,9 @@
30
30
  "./tailwind": "./dist/tailwind.css",
31
31
  "./background": "./dist/assets/background.css"
32
32
  },
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
33
36
  "scripts": {
34
37
  "build": "vite build && bun run prepack",
35
38
  "build-storybook": "storybook build",
@@ -46,29 +49,31 @@
46
49
  },
47
50
  "dependencies": {
48
51
  "@julianelda/chroma": "^1.0.0",
49
- "@julianelda/stilo": "^1.0.2"
52
+ "@julianelda/stilo": "^1.0.2",
53
+ "clsx": "^2.1.1",
54
+ "tailwind-merge": "^3.6.0"
50
55
  },
51
56
  "devDependencies": {
52
57
  "@eslint/js": "^10.0.1",
53
- "@lucide/svelte": "^1.16.0",
54
- "@playwright/test": "^1.58.1",
58
+ "@lucide/svelte": "^1.21.0",
59
+ "@playwright/test": "^1.61.1",
55
60
  "@storybook/addon-svelte-csf": "^5.0.10",
56
- "@storybook/sveltekit": "^10.2.7",
57
- "@sveltejs/kit": "^2.50.2",
61
+ "@storybook/sveltekit": "^10.4.6",
62
+ "@sveltejs/kit": "^2.68.0",
58
63
  "@sveltejs/package": "^2.5.7",
59
64
  "@sveltejs/vite-plugin-svelte": "^7.1.2",
60
65
  "@tailwindcss/forms": "^0.5.11",
61
- "@tailwindcss/typography": "^0.5.19",
62
- "eslint": "^10.4.0",
63
- "eslint-plugin-oxlint": "^1.66.0",
64
- "eslint-plugin-svelte": "^3.14.0",
66
+ "@tailwindcss/typography": "^0.5.20",
67
+ "eslint": "^10.5.0",
68
+ "eslint-plugin-oxlint": "^1.76.0",
69
+ "eslint-plugin-svelte": "^3.19.0",
65
70
  "publint": "^0.3.17",
66
- "svelte": "^5.55.9",
67
- "svelte-check": "^4.3.6",
68
- "typescript-eslint": "^8.54.0",
71
+ "svelte": "^5.56.4",
72
+ "svelte-check": "^4.7.1",
73
+ "typescript-eslint": "^8.62.0",
69
74
  "vitest-browser-svelte": "^2.1.1"
70
75
  },
71
76
  "peerDependencies": {
72
- "svelte": "^5.0.0"
77
+ "svelte": "^5.56.4"
73
78
  }
74
79
  }