uisv 0.0.6 → 0.0.9

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.
Files changed (48) hide show
  1. package/README.md +1 -1
  2. package/package.json +38 -37
  3. package/dist/components/alert.svelte +0 -274
  4. package/dist/components/alert.svelte.d.ts +0 -24
  5. package/dist/components/badge.svelte +0 -227
  6. package/dist/components/badge.svelte.d.ts +0 -19
  7. package/dist/components/banner.svelte +0 -257
  8. package/dist/components/banner.svelte.d.ts +0 -24
  9. package/dist/components/button.svelte +0 -385
  10. package/dist/components/button.svelte.d.ts +0 -49
  11. package/dist/components/card.svelte +0 -70
  12. package/dist/components/card.svelte.d.ts +0 -17
  13. package/dist/components/checkbox.svelte +0 -176
  14. package/dist/components/checkbox.svelte.d.ts +0 -27
  15. package/dist/components/checkboxgroup.svelte +0 -260
  16. package/dist/components/checkboxgroup.svelte.d.ts +0 -26
  17. package/dist/components/chip.svelte +0 -82
  18. package/dist/components/chip.svelte.d.ts +0 -17
  19. package/dist/components/h1.svelte +0 -28
  20. package/dist/components/h1.svelte.d.ts +0 -11
  21. package/dist/components/h2.svelte +0 -30
  22. package/dist/components/h2.svelte.d.ts +0 -11
  23. package/dist/components/index.d.ts +0 -30
  24. package/dist/components/index.js +0 -30
  25. package/dist/components/p.svelte +0 -22
  26. package/dist/components/p.svelte.d.ts +0 -11
  27. package/dist/components/pin-input.svelte +0 -162
  28. package/dist/components/pin-input.svelte.d.ts +0 -25
  29. package/dist/components/placeholder.svelte +0 -32
  30. package/dist/components/placeholder.svelte.d.ts +0 -7
  31. package/dist/components/progress.svelte +0 -124
  32. package/dist/components/progress.svelte.d.ts +0 -21
  33. package/dist/components/slider.svelte +0 -172
  34. package/dist/components/slider.svelte.d.ts +0 -44
  35. package/dist/components/switch.svelte +0 -181
  36. package/dist/components/switch.svelte.d.ts +0 -27
  37. package/dist/index.d.ts +0 -2
  38. package/dist/index.js +0 -2
  39. package/dist/types.d.ts +0 -7
  40. package/dist/types.js +0 -1
  41. package/dist/utils/common.d.ts +0 -14
  42. package/dist/utils/common.js +0 -18
  43. package/dist/utils/keys.d.ts +0 -8
  44. package/dist/utils/keys.js +0 -8
  45. package/dist/utils/types.d.ts +0 -1
  46. package/dist/utils/types.js +0 -1
  47. package/dist/vite.d.ts +0 -38
  48. package/dist/vite.js +0 -57
@@ -1,11 +0,0 @@
1
- import type { Snippet } from 'svelte';
2
- import type { ClassNameValue } from 'tailwind-merge';
3
- export type H1Props = {
4
- children: Snippet;
5
- ui?: {
6
- root?: ClassNameValue;
7
- };
8
- };
9
- declare const H1: import("svelte").Component<H1Props, {}, "">;
10
- type H1 = ReturnType<typeof H1>;
11
- export default H1;
@@ -1,30 +0,0 @@
1
- <script module lang="ts">
2
- import type { Snippet } from 'svelte';
3
- import type { ClassNameValue } from 'tailwind-merge';
4
- import { tv } from 'tailwind-variants';
5
-
6
- export type H2Props = {
7
- children: Snippet;
8
- ui?: { root?: ClassNameValue };
9
- };
10
- </script>
11
-
12
- <script lang="ts">
13
- const { children, ui = {} }: H2Props = $props();
14
-
15
- const classes = $derived(
16
- tv({
17
- base: [
18
- 'relative text-2xl text-highlighted font-bold mt-12 mb-6',
19
- 'scroll-mt-[calc(48px+45px+var(--ui-header-height))] lg:scroll-mt-[calc(48px+var(--ui-header-height))]',
20
- 'hover:[&>a>code]:(border-primary text-primary)',
21
- '[&>a>code]:(transition-colors text-xl/7 font-bold border-dashed)',
22
- '[&>a]:focus-visible:outline-primary'
23
- ]
24
- })({ class: ui.root })
25
- );
26
- </script>
27
-
28
- <h1 class={classes}>
29
- {@render children()}
30
- </h1>
@@ -1,11 +0,0 @@
1
- import type { Snippet } from 'svelte';
2
- import type { ClassNameValue } from 'tailwind-merge';
3
- export type H2Props = {
4
- children: Snippet;
5
- ui?: {
6
- root?: ClassNameValue;
7
- };
8
- };
9
- declare const H2: import("svelte").Component<H2Props, {}, "">;
10
- type H2 = ReturnType<typeof H2>;
11
- export default H2;
@@ -1,30 +0,0 @@
1
- export * from './button.svelte';
2
- export { default as Button } from './button.svelte';
3
- export * from './badge.svelte';
4
- export { default as Badge } from './badge.svelte';
5
- export * from './alert.svelte';
6
- export { default as Alert } from './alert.svelte';
7
- export * from './banner.svelte';
8
- export { default as Banner } from './banner.svelte';
9
- export * from './progress.svelte';
10
- export { default as Progress } from './progress.svelte';
11
- export * from './card.svelte';
12
- export { default as Card } from './card.svelte';
13
- export * from './chip.svelte';
14
- export { default as Chip } from './chip.svelte';
15
- export * from './switch.svelte';
16
- export { default as Switch } from './switch.svelte';
17
- export * from './slider.svelte';
18
- export { default as Slider } from './slider.svelte';
19
- export * from './checkbox.svelte';
20
- export { default as Checkbox } from './checkbox.svelte';
21
- export * from './checkboxgroup.svelte';
22
- export { default as CheckboxGroup } from './checkboxgroup.svelte';
23
- export * from './h1.svelte';
24
- export { default as H1 } from './h1.svelte';
25
- export * from './h2.svelte';
26
- export { default as H2 } from './h2.svelte';
27
- export * from './p.svelte';
28
- export { default as P } from './p.svelte';
29
- export * from './pin-input.svelte';
30
- export { default as PinInput } from './pin-input.svelte';
@@ -1,30 +0,0 @@
1
- export * from './button.svelte';
2
- export { default as Button } from './button.svelte';
3
- export * from './badge.svelte';
4
- export { default as Badge } from './badge.svelte';
5
- export * from './alert.svelte';
6
- export { default as Alert } from './alert.svelte';
7
- export * from './banner.svelte';
8
- export { default as Banner } from './banner.svelte';
9
- export * from './progress.svelte';
10
- export { default as Progress } from './progress.svelte';
11
- export * from './card.svelte';
12
- export { default as Card } from './card.svelte';
13
- export * from './chip.svelte';
14
- export { default as Chip } from './chip.svelte';
15
- export * from './switch.svelte';
16
- export { default as Switch } from './switch.svelte';
17
- export * from './slider.svelte';
18
- export { default as Slider } from './slider.svelte';
19
- export * from './checkbox.svelte';
20
- export { default as Checkbox } from './checkbox.svelte';
21
- export * from './checkboxgroup.svelte';
22
- export { default as CheckboxGroup } from './checkboxgroup.svelte';
23
- export * from './h1.svelte';
24
- export { default as H1 } from './h1.svelte';
25
- export * from './h2.svelte';
26
- export { default as H2 } from './h2.svelte';
27
- export * from './p.svelte';
28
- export { default as P } from './p.svelte';
29
- export * from './pin-input.svelte';
30
- export { default as PinInput } from './pin-input.svelte';
@@ -1,22 +0,0 @@
1
- <script module lang="ts">
2
- import type { Snippet } from 'svelte';
3
- import type { ClassNameValue } from 'tailwind-merge';
4
- import { tv } from 'tailwind-variants';
5
-
6
- export type ParagraphProps = {
7
- children: Snippet;
8
- ui?: { root?: ClassNameValue };
9
- };
10
- </script>
11
-
12
- <script lang="ts">
13
- const { children, ui = {} }: ParagraphProps = $props();
14
- </script>
15
-
16
- <p
17
- class={tv({
18
- base: 'my-5 leading-7 text-pretty'
19
- })({ class: ui.root })}
20
- >
21
- {@render children()}
22
- </p>
@@ -1,11 +0,0 @@
1
- import type { Snippet } from 'svelte';
2
- import type { ClassNameValue } from 'tailwind-merge';
3
- export type ParagraphProps = {
4
- children: Snippet;
5
- ui?: {
6
- root?: ClassNameValue;
7
- };
8
- };
9
- declare const P: import("svelte").Component<ParagraphProps, {}, "">;
10
- type P = ReturnType<typeof P>;
11
- export default P;
@@ -1,162 +0,0 @@
1
- <script module lang="ts">
2
- import type { PropColor } from '../types.js';
3
- import { onMount } from 'svelte';
4
- import type { ClassNameValue } from 'tailwind-merge';
5
- import { tv } from 'tailwind-variants';
6
-
7
- export type PinInputProps = {
8
- value?: number[] | string[];
9
- color?: PropColor;
10
- variant?: 'outline' | 'soft' | 'subtle' | 'ghost' | 'none';
11
- size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
12
- length?: number;
13
- autofocus?: boolean | number;
14
- id?: string;
15
- mask?: boolean;
16
- name?: string;
17
- disabled?: boolean;
18
- otp?: boolean;
19
- placeholder?: string;
20
- required?: boolean;
21
- type?: 'text' | 'number';
22
- ui?: { root?: ClassNameValue; cell?: ClassNameValue };
23
- };
24
- </script>
25
-
26
- <script lang="ts">
27
- const KEYS_TO_IGNORE = [
28
- 'ArrowLeft',
29
- 'ArrowRight',
30
- 'ArrowUp',
31
- 'ArrowDown',
32
- 'Home',
33
- 'End',
34
- 'Escape',
35
- 'Enter',
36
- 'Tab',
37
- 'Shift',
38
- 'Control',
39
- 'Meta'
40
- ];
41
-
42
- let {
43
- value = $bindable([]),
44
- color = 'primary',
45
- variant = 'outline',
46
- size = 'md',
47
- length = 5,
48
- autofocus,
49
- id,
50
- mask,
51
- name,
52
- disabled,
53
- otp,
54
- placeholder,
55
- required,
56
- type = 'text',
57
- ui = {}
58
- }: PinInputProps = $props();
59
- const internal_id = $props.id();
60
- let input_els = $state<HTMLInputElement[]>([]);
61
-
62
- const classes = $derived(
63
- tv({
64
- slots: { root: 'flex gap-2', cell: 'rounded text-center outline-none transition relative' },
65
- variants: {
66
- color: {
67
- primary: '',
68
- secondary: '',
69
- info: '',
70
- success: '',
71
- warning: '',
72
- error: ''
73
- },
74
- size: {
75
- xs: { root: '', cell: 'size-6' },
76
- sm: { root: '', cell: 'size-7' },
77
- md: { root: '', cell: 'size-8' },
78
- lg: { root: '', cell: 'size-9' },
79
- xl: { root: '', cell: 'size-10' }
80
- },
81
- variant: {
82
- outline: {
83
- cell: 'border border-secondary-300 focus:(border-2)'
84
- },
85
- soft: {
86
- cell: 'bg-secondary-50 hover:(bg-secondary-100) focus:(bg-secondary-100)'
87
- },
88
- subtle: { cell: 'border border-secondary-300 bg-secondary-100 focus:(border-2)' },
89
- ghost: { cell: 'hover:(bg-secondary-100) focus:(bg-secondary-100)' },
90
- none: { cell: '' }
91
- }
92
- },
93
- compoundVariants: [
94
- {
95
- variant: ['outline', 'subtle'],
96
- color: 'primary',
97
- class: { cell: 'focus:(border-primary-500)' }
98
- },
99
- {
100
- variant: ['outline', 'subtle'],
101
- color: 'secondary',
102
- class: { cell: 'focus:(border-secondary-900)' }
103
- },
104
- {
105
- variant: ['outline', 'subtle'],
106
- color: 'info',
107
- class: { cell: 'focus:(border-info-500)' }
108
- },
109
- {
110
- variant: ['outline', 'subtle'],
111
- color: 'success',
112
- class: { cell: 'focus:(border-success-500)' }
113
- },
114
- {
115
- variant: ['outline', 'subtle'],
116
- color: 'warning',
117
- class: { cell: 'focus:(border-warning-500)' }
118
- },
119
- {
120
- variant: ['outline', 'subtle'],
121
- color: 'error',
122
- class: { cell: 'focus:(border-error-500)' }
123
- }
124
- ]
125
- })({ size, color, variant, class: ui.root })
126
- );
127
-
128
- onMount(() => {
129
- if (!autofocus || input_els.length === 0) return;
130
-
131
- input_els[0].focus();
132
- });
133
- </script>
134
-
135
- <div id={id || internal_id} class={classes.root({ class: ui.root })}>
136
- {#each { length }, i (i)}
137
- <input
138
- bind:this={input_els[i]}
139
- bind:value={
140
- () => (mask ? '•' : value[i]?.toString()?.slice(-1)),
141
- (v: string) => {
142
- try {
143
- value[i] = type === 'text' ? v.slice(-1) : parseInt(v.slice(-1));
144
-
145
- if (value[i] && input_els[i + 1]) input_els[i + 1].focus();
146
- } catch {
147
- return;
148
- }
149
- }
150
- }
151
- class={classes.cell({ class: ui.cell })}
152
- onkeydown={(e) => {
153
- if (KEYS_TO_IGNORE.includes(e.key)) e.preventDefault();
154
- if (type === 'number' && isNaN(parseInt(e.key))) e.preventDefault();
155
- const DIR: Record<string, number> = { ArrowLeft: -1, ArrowRight: 1 };
156
- if (!DIR[e.key] || !input_els[i + DIR[e.key]]) return;
157
- input_els[i + DIR[e.key]].focus();
158
- }}
159
- {placeholder}
160
- />
161
- {/each}
162
- </div>
@@ -1,25 +0,0 @@
1
- import type { PropColor } from '../types.js';
2
- import type { ClassNameValue } from 'tailwind-merge';
3
- export type PinInputProps = {
4
- value?: number[] | string[];
5
- color?: PropColor;
6
- variant?: 'outline' | 'soft' | 'subtle' | 'ghost' | 'none';
7
- size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
8
- length?: number;
9
- autofocus?: boolean | number;
10
- id?: string;
11
- mask?: boolean;
12
- name?: string;
13
- disabled?: boolean;
14
- otp?: boolean;
15
- placeholder?: string;
16
- required?: boolean;
17
- type?: 'text' | 'number';
18
- ui?: {
19
- root?: ClassNameValue;
20
- cell?: ClassNameValue;
21
- };
22
- };
23
- declare const PinInput: import("svelte").Component<PinInputProps, {}, "value">;
24
- type PinInput = ReturnType<typeof PinInput>;
25
- export default PinInput;
@@ -1,32 +0,0 @@
1
- <script lang="ts">
2
- import type { ClassNameValue } from 'tailwind-merge';
3
-
4
- let { class: klass }: { class?: ClassNameValue } = $props();
5
- </script>
6
-
7
- <svg
8
- class={[
9
- 'inset-0 w-full stroke-secondary/10 border border-dashed border-secondary rounded-md',
10
- klass
11
- ]}
12
- fill="none"
13
- >
14
- <defs>
15
- <pattern
16
- id="pattern-5c1e4f0e-62d5-498b-8ff0-cf77bb448c8e"
17
- x="0"
18
- y="0"
19
- width="10"
20
- height="10"
21
- patternUnits="userSpaceOnUse"
22
- >
23
- <path d="M-3 13 15-5M-5 5l18-18M-1 21 17 3"> </path>
24
- </pattern>
25
- </defs>
26
- <rect
27
- stroke="none"
28
- fill="url(#pattern-5c1e4f0e-62d5-498b-8ff0-cf77bb448c8e)"
29
- width="100%"
30
- height="100%"
31
- ></rect>
32
- </svg>
@@ -1,7 +0,0 @@
1
- import type { ClassNameValue } from 'tailwind-merge';
2
- type $$ComponentProps = {
3
- class?: ClassNameValue;
4
- };
5
- declare const Placeholder: import("svelte").Component<$$ComponentProps, {}, "">;
6
- type Placeholder = ReturnType<typeof Placeholder>;
7
- export default Placeholder;
@@ -1,124 +0,0 @@
1
- <script module lang="ts">
2
- import type { PropColor } from '../types.js';
3
- import type { ClassNameValue } from 'tailwind-merge';
4
- import { tv } from 'tailwind-variants';
5
-
6
- export type ProgressProps = {
7
- value?: number;
8
- max?: number | string[];
9
- animation?: 'swing' | 'carousel' | 'carousel-inverse' | 'elastic';
10
- orientation?: 'horizontal' | 'veritcal';
11
- color?: PropColor;
12
- height?: number;
13
- inverted?: boolean;
14
- status?: boolean;
15
- ui?: {
16
- base?: ClassNameValue;
17
- header?: ClassNameValue;
18
- content?: ClassNameValue;
19
- footer?: ClassNameValue;
20
- };
21
- };
22
- </script>
23
-
24
- <script lang="ts">
25
- let {
26
- max,
27
- animation,
28
- inverted,
29
- status,
30
- value,
31
- orientation = 'horizontal',
32
- color = 'primary',
33
- height = '',
34
- ui = {}
35
- }: ProgressProps = $props();
36
-
37
- const percentage = $derived.by(() => {
38
- if (value === undefined) return null;
39
- if (Array.isArray(max)) return (value / (max.length - 1)) * 100;
40
-
41
- return (value / (max || 100)) * 100;
42
- });
43
- const indeterminate = $derived.by(() => {
44
- if (value === undefined || percentage === null) return true;
45
- if (value < 0) return true;
46
- if (percentage > 100) return true;
47
-
48
- return false;
49
- });
50
- const classes = $derived.by(() =>
51
- tv({
52
- slots: {
53
- root: 'relative w-full rounded-full overflow-hidden bg-secondary-300',
54
- status: '',
55
- indicator: 'absolute transition-all rounded-full',
56
- steps: ''
57
- },
58
- variants: {
59
- color: {
60
- primary: {
61
- indicator: 'bg-primary-500'
62
- },
63
- secondary: {
64
- indicator: 'bg-secondary-500'
65
- },
66
- info: {
67
- indicator: 'bg-info-500'
68
- },
69
- success: {
70
- indicator: 'bg-success-500'
71
- },
72
- warning: {
73
- indicator: 'bg-warning-500'
74
- },
75
- error: {
76
- indicator: 'bg-error-500'
77
- }
78
- },
79
- animation: {
80
- swing: [indeterminate ? 'animate-[swing_2s_ease-in-out_infinite' : ''],
81
- carousel: [indeterminate ? '' : ''],
82
- 'carousel-inverse': [indeterminate ? '' : ''],
83
- elastic: [indeterminate ? '' : '']
84
- }
85
- },
86
- compoundVariants: []
87
- })({
88
- color,
89
- animation: animation ?? 'swing'
90
- })
91
- );
92
- </script>
93
-
94
- <div data-state-indeterminate={indeterminate}>
95
- <div class={classes.root({ class: [ui.base] })} style:height={`${height || 8}px`}>
96
- <span class={classes.indicator({ class: ['h-full left-0'] })} style:width={`${percentage}%`}>
97
- </span>
98
- </div>
99
-
100
- {#if Array.isArray(max)}
101
- <p
102
- class={[
103
- 'text-right transition',
104
- value && value > 0 && max[value] ? 'text-primary-500' : 'text-secondary-500'
105
- ]}
106
- >
107
- {(value && max[value]) || max[0]}
108
- </p>
109
- {/if}
110
- </div>
111
-
112
- <style>
113
- @keyframe swing {
114
- 0% {
115
- width: 0%;
116
- }
117
- 50% {
118
- width: 100%;
119
- }
120
- 100% {
121
- width: 0%;
122
- }
123
- }
124
- </style>
@@ -1,21 +0,0 @@
1
- import type { PropColor } from '../types.js';
2
- import type { ClassNameValue } from 'tailwind-merge';
3
- export type ProgressProps = {
4
- value?: number;
5
- max?: number | string[];
6
- animation?: 'swing' | 'carousel' | 'carousel-inverse' | 'elastic';
7
- orientation?: 'horizontal' | 'veritcal';
8
- color?: PropColor;
9
- height?: number;
10
- inverted?: boolean;
11
- status?: boolean;
12
- ui?: {
13
- base?: ClassNameValue;
14
- header?: ClassNameValue;
15
- content?: ClassNameValue;
16
- footer?: ClassNameValue;
17
- };
18
- };
19
- declare const Progress: import("svelte").Component<ProgressProps, {}, "">;
20
- type Progress = ReturnType<typeof Progress>;
21
- export default Progress;