@julianelda/domos 0.0.1 → 1.0.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 +0 -65
- package/dist/assets/styles.css +36 -0
- package/dist/button/button.stories.svelte +1 -2
- package/dist/card/card.svelte +1 -3
- package/dist/checkbox/checkbox.stories.svelte +44 -0
- package/dist/checkbox/checkbox.stories.svelte.d.ts +27 -0
- package/dist/checkbox/checkbox.svelte +25 -0
- package/dist/checkbox/checkbox.svelte.d.ts +4 -0
- package/dist/checkbox/checkbox.types.d.ts +7 -0
- package/dist/checkbox/checkbox.types.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/input-button/input-button.svelte +51 -0
- package/dist/input-button/input-button.svelte.d.ts +4 -0
- package/dist/input-button/input-button.types.d.ts +10 -0
- package/dist/input-button/input-button.types.js +1 -0
- package/dist/input-select/input-select.svelte +52 -0
- package/dist/input-select/input-select.svelte.d.ts +4 -0
- package/dist/input-select/input-select.types.d.ts +19 -0
- package/dist/input-select/input-select.types.js +1 -0
- package/dist/tailwind.css +7 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# Svelte library
|
|
2
|
-
|
|
3
|
-
Everything you need to build a Svelte library, powered by [`sv`](https://npmjs.com/package/sv).
|
|
4
|
-
|
|
5
|
-
Read more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).
|
|
6
|
-
|
|
7
|
-
## Creating a project
|
|
8
|
-
|
|
9
|
-
If you're seeing this, you've probably already done this step. Congrats!
|
|
10
|
-
|
|
11
|
-
```sh
|
|
12
|
-
# create a new project in the current directory
|
|
13
|
-
npx sv create
|
|
14
|
-
|
|
15
|
-
# create a new project in my-app
|
|
16
|
-
npx sv create my-app
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
To recreate this project with the same configuration:
|
|
20
|
-
|
|
21
|
-
```sh
|
|
22
|
-
# recreate this project
|
|
23
|
-
bun x sv create --template library --types ts --add prettier eslint vitest="usages:unit,component" playwright tailwindcss="plugins:typography,forms" storybook --install bun domos
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Developing
|
|
27
|
-
|
|
28
|
-
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
|
29
|
-
|
|
30
|
-
```sh
|
|
31
|
-
npm run dev
|
|
32
|
-
|
|
33
|
-
# or start the server and open the app in a new browser tab
|
|
34
|
-
npm run dev -- --open
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
|
|
38
|
-
|
|
39
|
-
## Building
|
|
40
|
-
|
|
41
|
-
To build your library:
|
|
42
|
-
|
|
43
|
-
```sh
|
|
44
|
-
npm pack
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
To create a production version of your showcase app:
|
|
48
|
-
|
|
49
|
-
```sh
|
|
50
|
-
npm run build
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
You can preview the production build with `npm run preview`.
|
|
54
|
-
|
|
55
|
-
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
|
|
56
|
-
|
|
57
|
-
## Publishing
|
|
58
|
-
|
|
59
|
-
Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
|
|
60
|
-
|
|
61
|
-
To publish your library to [npm](https://www.npmjs.com):
|
|
62
|
-
|
|
63
|
-
```sh
|
|
64
|
-
npm publish
|
|
65
|
-
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
body {
|
|
2
|
+
--grid-color: 150;
|
|
3
|
+
background-size: 1.75rem 1.75rem;
|
|
4
|
+
background-image:
|
|
5
|
+
linear-gradient(
|
|
6
|
+
to right,
|
|
7
|
+
rgba(var(--grid-color), var(--grid-color), var(--grid-color), 0.03) 1px,
|
|
8
|
+
transparent 1px
|
|
9
|
+
),
|
|
10
|
+
linear-gradient(
|
|
11
|
+
to bottom,
|
|
12
|
+
rgba(var(--grid-color), var(--grid-color), var(--grid-color), 0.03) 1px,
|
|
13
|
+
transparent 1px
|
|
14
|
+
),
|
|
15
|
+
linear-gradient(
|
|
16
|
+
to top,
|
|
17
|
+
rgba(var(--grid-color), var(--grid-color), var(--grid-color), 0.03) 1px,
|
|
18
|
+
transparent 1px
|
|
19
|
+
),
|
|
20
|
+
linear-gradient(
|
|
21
|
+
to left,
|
|
22
|
+
rgba(var(--grid-color), var(--grid-color), var(--grid-color), 0.03) 1px,
|
|
23
|
+
transparent 1px
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
input[type="number"]::-webkit-inner-spin-button,
|
|
28
|
+
input[type="number"]::-webkit-outer-spin-button {
|
|
29
|
+
-webkit-appearance: none;
|
|
30
|
+
margin: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
input[type="number"] {
|
|
34
|
+
-moz-appearance: textfield;
|
|
35
|
+
appearance: textfield;
|
|
36
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
<script module>
|
|
2
2
|
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
|
-
import Button from "./button.svelte";
|
|
4
3
|
import { fn } from "storybook/test";
|
|
4
|
+
import Button from "./button.svelte";
|
|
5
5
|
|
|
6
|
-
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
6
|
const { Story } = defineMeta({
|
|
8
7
|
title: "Button",
|
|
9
8
|
component: Button,
|
package/dist/card/card.svelte
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
|
+
import { fn } from "storybook/test";
|
|
4
|
+
import Checkbox from "./checkbox.svelte";
|
|
5
|
+
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
title: "Checkbox",
|
|
8
|
+
component: Checkbox,
|
|
9
|
+
argTypes: {
|
|
10
|
+
id: { control: "text" },
|
|
11
|
+
label: { control: "text" },
|
|
12
|
+
value: { control: "boolean" },
|
|
13
|
+
hideLabel: { control: "boolean" },
|
|
14
|
+
},
|
|
15
|
+
args: {
|
|
16
|
+
onChange: fn(),
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<Story
|
|
22
|
+
name="Checked"
|
|
23
|
+
args={{
|
|
24
|
+
id: "checkbox-checked",
|
|
25
|
+
label: "Checked Checkbox",
|
|
26
|
+
value: true,
|
|
27
|
+
}} />
|
|
28
|
+
|
|
29
|
+
<Story
|
|
30
|
+
name="Unchecked"
|
|
31
|
+
args={{
|
|
32
|
+
id: "checkbox-unchecked",
|
|
33
|
+
label: "Unchecked Checkbox",
|
|
34
|
+
value: false,
|
|
35
|
+
}} />
|
|
36
|
+
|
|
37
|
+
<Story
|
|
38
|
+
name="Hidden Label"
|
|
39
|
+
args={{
|
|
40
|
+
id: "checkbox-hidden-label",
|
|
41
|
+
label: "Hidden Label Checkbox",
|
|
42
|
+
value: false,
|
|
43
|
+
hideLabel: true,
|
|
44
|
+
}} />
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default Checkbox;
|
|
2
|
+
type Checkbox = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Checkbox: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
import Checkbox from "./checkbox.svelte";
|
|
15
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
16
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
17
|
+
$$bindings?: Bindings;
|
|
18
|
+
} & Exports;
|
|
19
|
+
(internal: unknown, props: {
|
|
20
|
+
$$events?: Events;
|
|
21
|
+
$$slots?: Slots;
|
|
22
|
+
}): Exports & {
|
|
23
|
+
$set?: any;
|
|
24
|
+
$on?: any;
|
|
25
|
+
};
|
|
26
|
+
z_$$bindings?: Bindings;
|
|
27
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import InputLabel from "../input-label/input-label.svelte";
|
|
3
|
+
import type { CheckboxProps } from "./checkbox.types.js";
|
|
4
|
+
|
|
5
|
+
const { hideLabel, id, label, onChange, value }: CheckboxProps = $props();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<div class="relative flex items-start gap-1">
|
|
9
|
+
<div class="flex h-6 items-center">
|
|
10
|
+
<input
|
|
11
|
+
checked={value}
|
|
12
|
+
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"
|
|
13
|
+
data-testid={id}
|
|
14
|
+
{id}
|
|
15
|
+
name={id}
|
|
16
|
+
onchange={(event) => onChange((event.target as HTMLInputElement).checked)}
|
|
17
|
+
type="checkbox" />
|
|
18
|
+
</div>
|
|
19
|
+
<div class="leading-6">
|
|
20
|
+
<InputLabel
|
|
21
|
+
hideLabel={Boolean(hideLabel)}
|
|
22
|
+
{id}
|
|
23
|
+
{label} />
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import InputField from "../input-field/input-field.svelte";
|
|
3
|
+
import InputLabel from "../input-label/input-label.svelte";
|
|
4
|
+
import type { InputButtonProps } from "./input-button.types.js";
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
buttonAriaLabel,
|
|
8
|
+
disabled,
|
|
9
|
+
hideLabel,
|
|
10
|
+
icon,
|
|
11
|
+
id,
|
|
12
|
+
label,
|
|
13
|
+
onButtonClick,
|
|
14
|
+
onChange,
|
|
15
|
+
onKeyDown,
|
|
16
|
+
placeholder,
|
|
17
|
+
type,
|
|
18
|
+
value,
|
|
19
|
+
}: InputButtonProps = $props();
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<div class="flex-1">
|
|
23
|
+
<InputLabel
|
|
24
|
+
hideLabel={Boolean(hideLabel)}
|
|
25
|
+
{id}
|
|
26
|
+
{label} />
|
|
27
|
+
<div class="mt-1 flex">
|
|
28
|
+
<div class="relative flex grow items-stretch focus-within:z-10">
|
|
29
|
+
<InputField
|
|
30
|
+
{disabled}
|
|
31
|
+
{id}
|
|
32
|
+
onChange={(value) => onChange?.(value)}
|
|
33
|
+
onKeyDown={(value) => onKeyDown?.(value)}
|
|
34
|
+
{placeholder}
|
|
35
|
+
{type}
|
|
36
|
+
{value}
|
|
37
|
+
withIconLeft={true} />
|
|
38
|
+
</div>
|
|
39
|
+
<button
|
|
40
|
+
aria-label={buttonAriaLabel}
|
|
41
|
+
class="relative -ml-px inline-flex cursor-pointer appearance-none items-center gap-x-1.5 rounded-r-md border border-l-0 border-ink-gray px-3 py-2 text-sm font-bold ring-inset hover:bg-primary-500 hover:text-ink-white focus:border-primary-300 focus:ring-1 focus:ring-primary-300 focus:ring-inset active:bg-primary-700"
|
|
42
|
+
data-testid={id + "-button"}
|
|
43
|
+
onclick={() => onButtonClick()}
|
|
44
|
+
type="button">
|
|
45
|
+
{#if icon}
|
|
46
|
+
{@const Component = icon}
|
|
47
|
+
<Component />
|
|
48
|
+
{/if}
|
|
49
|
+
</button>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Component } from "svelte";
|
|
2
|
+
import type { InputFieldProps } from "./../input-field/input-field.types.ts";
|
|
3
|
+
import type { InputLabelProps } from "./../input-label/input-label.types.ts";
|
|
4
|
+
export type InputButtonProps = IconButtonProps & InputFieldProps & InputLabelProps;
|
|
5
|
+
interface IconButtonProps {
|
|
6
|
+
buttonAriaLabel: string;
|
|
7
|
+
icon?: Component;
|
|
8
|
+
onButtonClick: () => void;
|
|
9
|
+
}
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import InputField from "../input-field/input-field.svelte";
|
|
3
|
+
import InputLabel from "../input-label/input-label.svelte";
|
|
4
|
+
import SelectField from "../select-field/select-field.svelte";
|
|
5
|
+
import type { InputSelectProps } from "./input-select.types.js";
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
hideLabel,
|
|
9
|
+
inputDisabled,
|
|
10
|
+
inputId,
|
|
11
|
+
inputLabel,
|
|
12
|
+
inputPlaceholder,
|
|
13
|
+
inputValue,
|
|
14
|
+
onInputChange,
|
|
15
|
+
onInputKeydown,
|
|
16
|
+
onSelectChange,
|
|
17
|
+
options,
|
|
18
|
+
selectId,
|
|
19
|
+
selectLabel,
|
|
20
|
+
selectValue,
|
|
21
|
+
type,
|
|
22
|
+
}: InputSelectProps = $props();
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<div class="flex-1">
|
|
26
|
+
<InputLabel
|
|
27
|
+
{hideLabel}
|
|
28
|
+
id={inputId}
|
|
29
|
+
label={inputLabel} />
|
|
30
|
+
<div class="relative mt-1 rounded-md shadow-xs">
|
|
31
|
+
<InputField
|
|
32
|
+
disabled={inputDisabled}
|
|
33
|
+
id={inputId}
|
|
34
|
+
onChange={(value) => onInputChange?.(value)}
|
|
35
|
+
onKeyDown={(value) => onInputKeydown?.(value)}
|
|
36
|
+
placeholder={inputPlaceholder}
|
|
37
|
+
{type}
|
|
38
|
+
value={inputValue} />
|
|
39
|
+
<div class="absolute inset-y-0 right-0 flex items-center">
|
|
40
|
+
<InputLabel
|
|
41
|
+
hideLabel={true}
|
|
42
|
+
id={selectId}
|
|
43
|
+
label={selectLabel} />
|
|
44
|
+
<SelectField
|
|
45
|
+
id={selectId}
|
|
46
|
+
inInputField={true}
|
|
47
|
+
onChange={(value) => onSelectChange?.(value)}
|
|
48
|
+
{options}
|
|
49
|
+
value={selectValue} />
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface InputSelectProps {
|
|
2
|
+
hideLabel?: boolean;
|
|
3
|
+
inputDisabled?: boolean;
|
|
4
|
+
inputId: string;
|
|
5
|
+
inputLabel: string;
|
|
6
|
+
inputPlaceholder?: string;
|
|
7
|
+
inputValue: number | string;
|
|
8
|
+
onInputChange?: (value: number | string) => void;
|
|
9
|
+
onInputKeydown?: (key: number | string) => void;
|
|
10
|
+
onSelectChange?: (value: string) => void;
|
|
11
|
+
options: {
|
|
12
|
+
label: string;
|
|
13
|
+
value: string;
|
|
14
|
+
}[];
|
|
15
|
+
selectId: string;
|
|
16
|
+
selectLabel: string;
|
|
17
|
+
selectValue: string;
|
|
18
|
+
type: "number" | "search" | "text";
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@julianelda/domos",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite dev",
|
|
6
6
|
"build": "vite build && npm run prepack",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@eslint/compat": "^2.0.2",
|
|
43
43
|
"@eslint/js": "^9.39.2",
|
|
44
|
+
"@lucide/svelte": "^0.563.1",
|
|
44
45
|
"@playwright/test": "^1.58.1",
|
|
45
46
|
"@prettier/plugin-oxc": "^0.1.3",
|
|
46
47
|
"@storybook/addon-a11y": "^10.2.7",
|
|
@@ -81,7 +82,6 @@
|
|
|
81
82
|
],
|
|
82
83
|
"dependencies": {
|
|
83
84
|
"@julianelda/chroma": "^1.0.0",
|
|
84
|
-
"@julianelda/stilo": "^1.0.2"
|
|
85
|
-
"clsx": "^2.1.1"
|
|
85
|
+
"@julianelda/stilo": "^1.0.2"
|
|
86
86
|
}
|
|
87
87
|
}
|