@foxui/core 0.4.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/LICENSE +21 -0
- package/README.md +42 -0
- package/dist/components/accordion/accordion-content.svelte +22 -0
- package/dist/components/accordion/accordion-content.svelte.d.ts +4 -0
- package/dist/components/accordion/accordion-item.svelte +35 -0
- package/dist/components/accordion/accordion-item.svelte.d.ts +9 -0
- package/dist/components/accordion/accordion-trigger.svelte +40 -0
- package/dist/components/accordion/accordion-trigger.svelte.d.ts +7 -0
- package/dist/components/accordion/index.d.ts +6 -0
- package/dist/components/accordion/index.js +6 -0
- package/dist/components/alert/alert-description.svelte +16 -0
- package/dist/components/alert/alert-description.svelte.d.ts +5 -0
- package/dist/components/alert/alert-title.svelte +25 -0
- package/dist/components/alert/alert-title.svelte.d.ts +8 -0
- package/dist/components/alert/alert.svelte +122 -0
- package/dist/components/alert/alert.svelte.d.ts +79 -0
- package/dist/components/alert/index.d.ts +5 -0
- package/dist/components/alert/index.js +5 -0
- package/dist/components/avatar/Avatar.svelte +73 -0
- package/dist/components/avatar/Avatar.svelte.d.ts +14 -0
- package/dist/components/avatar/AvatarGroup.svelte +43 -0
- package/dist/components/avatar/AvatarGroup.svelte.d.ts +16 -0
- package/dist/components/avatar/index.d.ts +3 -0
- package/dist/components/avatar/index.js +3 -0
- package/dist/components/badge/Badge.svelte +80 -0
- package/dist/components/badge/Badge.svelte.d.ts +100 -0
- package/dist/components/badge/index.d.ts +1 -0
- package/dist/components/badge/index.js +1 -0
- package/dist/components/box/Box.svelte +23 -0
- package/dist/components/box/Box.svelte.d.ts +5 -0
- package/dist/components/box/index.d.ts +1 -0
- package/dist/components/box/index.js +1 -0
- package/dist/components/button/Button.svelte +103 -0
- package/dist/components/button/Button.svelte.d.ts +110 -0
- package/dist/components/button/index.d.ts +1 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/card/ImageCard.svelte +62 -0
- package/dist/components/card/ImageCard.svelte.d.ts +12 -0
- package/dist/components/card/index.d.ts +1 -0
- package/dist/components/card/index.js +1 -0
- package/dist/components/chat-bubble/ChatBubble.svelte +96 -0
- package/dist/components/chat-bubble/ChatBubble.svelte.d.ts +95 -0
- package/dist/components/chat-bubble/index.d.ts +1 -0
- package/dist/components/chat-bubble/index.js +1 -0
- package/dist/components/checkbox/checkbox.svelte +91 -0
- package/dist/components/checkbox/checkbox.svelte.d.ts +42 -0
- package/dist/components/checkbox/index.d.ts +1 -0
- package/dist/components/checkbox/index.js +1 -0
- package/dist/components/copy-code-button/AddCopyCodeButtons.svelte +35 -0
- package/dist/components/copy-code-button/AddCopyCodeButtons.svelte.d.ts +6 -0
- package/dist/components/copy-code-button/CopyCodeButton.svelte +69 -0
- package/dist/components/copy-code-button/CopyCodeButton.svelte.d.ts +7 -0
- package/dist/components/copy-code-button/index.d.ts +2 -0
- package/dist/components/copy-code-button/index.js +2 -0
- package/dist/components/head/Head.svelte +49 -0
- package/dist/components/head/Head.svelte.d.ts +10 -0
- package/dist/components/head/index.d.ts +1 -0
- package/dist/components/head/index.js +1 -0
- package/dist/components/heading/Heading.svelte +24 -0
- package/dist/components/heading/Heading.svelte.d.ts +8 -0
- package/dist/components/heading/Subheading.svelte +24 -0
- package/dist/components/heading/Subheading.svelte.d.ts +8 -0
- package/dist/components/heading/index.d.ts +3 -0
- package/dist/components/heading/index.js +3 -0
- package/dist/components/image/Image.svelte +80 -0
- package/dist/components/image/Image.svelte.d.ts +12 -0
- package/dist/components/image/index.d.ts +2 -0
- package/dist/components/image/index.js +1 -0
- package/dist/components/image-container/ImageContainer.svelte +15 -0
- package/dist/components/image-container/ImageContainer.svelte.d.ts +4 -0
- package/dist/components/image-container/index.d.ts +1 -0
- package/dist/components/image-container/index.js +1 -0
- package/dist/components/index.d.ts +34 -0
- package/dist/components/index.js +34 -0
- package/dist/components/input/Input.svelte +60 -0
- package/dist/components/input/Input.svelte.d.ts +46 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/index.js +2 -0
- package/dist/components/label/Label.svelte +19 -0
- package/dist/components/label/Label.svelte.d.ts +4 -0
- package/dist/components/label/index.d.ts +1 -0
- package/dist/components/label/index.js +1 -0
- package/dist/components/modal/Modal.svelte +167 -0
- package/dist/components/modal/Modal.svelte.d.ts +33 -0
- package/dist/components/modal/index.d.ts +2 -0
- package/dist/components/modal/index.js +1 -0
- package/dist/components/navbar/Navbar.svelte +63 -0
- package/dist/components/navbar/Navbar.svelte.d.ts +8 -0
- package/dist/components/navbar/index.d.ts +1 -0
- package/dist/components/navbar/index.js +1 -0
- package/dist/components/number-input/NumberInput.svelte +201 -0
- package/dist/components/number-input/NumberInput.svelte.d.ts +98 -0
- package/dist/components/number-input/index.d.ts +2 -0
- package/dist/components/number-input/index.js +1 -0
- package/dist/components/paragraph/Paragraph.svelte +20 -0
- package/dist/components/paragraph/Paragraph.svelte.d.ts +5 -0
- package/dist/components/paragraph/index.d.ts +2 -0
- package/dist/components/paragraph/index.js +2 -0
- package/dist/components/popover/Popover.svelte +63 -0
- package/dist/components/popover/Popover.svelte.d.ts +14 -0
- package/dist/components/popover/index.d.ts +8 -0
- package/dist/components/popover/index.js +7 -0
- package/dist/components/popover/popover-content.svelte +28 -0
- package/dist/components/popover/popover-content.svelte.d.ts +7 -0
- package/dist/components/prose/Prose.svelte +107 -0
- package/dist/components/prose/Prose.svelte.d.ts +35 -0
- package/dist/components/prose/ProseCopyButton.svelte +12 -0
- package/dist/components/prose/ProseCopyButton.svelte.d.ts +8 -0
- package/dist/components/prose/index.d.ts +4 -0
- package/dist/components/prose/index.js +2 -0
- package/dist/components/scroll-area/BodyScrollArea.svelte +3 -0
- package/dist/components/scroll-area/BodyScrollArea.svelte.d.ts +19 -0
- package/dist/components/scroll-area/ScrollArea.svelte +71 -0
- package/dist/components/scroll-area/ScrollArea.svelte.d.ts +8 -0
- package/dist/components/scroll-area/index.d.ts +1 -0
- package/dist/components/scroll-area/index.js +1 -0
- package/dist/components/scroll-area/style.css +41 -0
- package/dist/components/select/Select.svelte +88 -0
- package/dist/components/select/Select.svelte.d.ts +13 -0
- package/dist/components/select/SelectChildren.svelte +29 -0
- package/dist/components/select/SelectChildren.svelte.d.ts +8 -0
- package/dist/components/select/SelectItem.svelte +31 -0
- package/dist/components/select/SelectItem.svelte.d.ts +4 -0
- package/dist/components/select/index.d.ts +3 -0
- package/dist/components/select/index.js +3 -0
- package/dist/components/select-2/Select.svelte +46 -0
- package/dist/components/select-2/Select.svelte.d.ts +12 -0
- package/dist/components/select-2/index.d.ts +1 -0
- package/dist/components/select-2/index.js +1 -0
- package/dist/components/sidebar/Sidebar.svelte +69 -0
- package/dist/components/sidebar/Sidebar.svelte.d.ts +9 -0
- package/dist/components/sidebar/index.d.ts +1 -0
- package/dist/components/sidebar/index.js +1 -0
- package/dist/components/slider/Slider.svelte +65 -0
- package/dist/components/slider/Slider.svelte.d.ts +4 -0
- package/dist/components/slider/SliderNumber.svelte +40 -0
- package/dist/components/slider/SliderNumber.svelte.d.ts +4 -0
- package/dist/components/slider/index.d.ts +3 -0
- package/dist/components/slider/index.js +3 -0
- package/dist/components/sonner/Toaster.svelte +73 -0
- package/dist/components/sonner/Toaster.svelte.d.ts +10 -0
- package/dist/components/sonner/index.d.ts +2 -0
- package/dist/components/sonner/index.js +2 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +2 -0
- package/dist/components/switch/switch.svelte +27 -0
- package/dist/components/switch/switch.svelte.d.ts +4 -0
- package/dist/components/tabs/TabItem.svelte +56 -0
- package/dist/components/tabs/TabItem.svelte.d.ts +9 -0
- package/dist/components/tabs/Tabs.svelte +29 -0
- package/dist/components/tabs/Tabs.svelte.d.ts +12 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/index.js +2 -0
- package/dist/components/textarea/index.d.ts +19 -0
- package/dist/components/textarea/index.js +2 -0
- package/dist/components/textarea/textarea.svelte +57 -0
- package/dist/components/textarea/textarea.svelte.d.ts +47 -0
- package/dist/components/theme-toggle/ThemeToggle.svelte +105 -0
- package/dist/components/theme-toggle/ThemeToggle.svelte.d.ts +7 -0
- package/dist/components/theme-toggle/index.d.ts +2 -0
- package/dist/components/theme-toggle/index.js +2 -0
- package/dist/components/toggle/index.d.ts +3 -0
- package/dist/components/toggle/index.js +3 -0
- package/dist/components/toggle/toggle.svelte +49 -0
- package/dist/components/toggle/toggle.svelte.d.ts +40 -0
- package/dist/components/toggle-group/index.d.ts +3 -0
- package/dist/components/toggle-group/index.js +3 -0
- package/dist/components/toggle-group/toggle-group-item.svelte +30 -0
- package/dist/components/toggle-group/toggle-group-item.svelte.d.ts +6 -0
- package/dist/components/toggle-group/toggle-group.svelte +41 -0
- package/dist/components/toggle-group/toggle-group.svelte.d.ts +8 -0
- package/dist/components/tooltip/index.d.ts +7 -0
- package/dist/components/tooltip/index.js +9 -0
- package/dist/components/tooltip/tooltip-content.svelte +21 -0
- package/dist/components/tooltip/tooltip-content.svelte.d.ts +4 -0
- package/dist/components/tooltip/tooltip.svelte +62 -0
- package/dist/components/tooltip/tooltip.svelte.d.ts +12 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/types.d.ts +1 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +5 -0
- package/package.json +82 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { WithElementRef } from 'bits-ui';
|
|
3
|
+
import { type VariantProps, tv } from 'tailwind-variants';
|
|
4
|
+
import { cn } from '../../utils';
|
|
5
|
+
|
|
6
|
+
export const numberInputVariants = tv({
|
|
7
|
+
base: 'group flex w-full max-w-44 touch-manipulation items-stretch justify-between rounded-2xl ring focus-within:ring-2',
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
primary:
|
|
11
|
+
'bg-accent-500/5 focus-within:ring-accent-400 dark:focus-within:ring-accent-600 text-accent-500 ring-accent-500/20 dark:ring-accent-500/20',
|
|
12
|
+
secondary: ''
|
|
13
|
+
},
|
|
14
|
+
size: {
|
|
15
|
+
default: 'text-base font-medium max-w-32',
|
|
16
|
+
sm: 'text-sm',
|
|
17
|
+
lg: 'text-3xl font-semibold max-w-44'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: {
|
|
21
|
+
variant: 'primary',
|
|
22
|
+
size: 'default'
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const numberInputButtonVariants = tv({
|
|
27
|
+
base: 'button-number-input flex cursor-pointer items-center pr-[.5em] pl-[.5em] transition-colors disabled:cursor-not-allowed disabled:opacity-50',
|
|
28
|
+
variants: {
|
|
29
|
+
variant: {
|
|
30
|
+
primary:
|
|
31
|
+
'hover:text-accent-600 dark:hover:text-accent-400 disabled:hover:text-accent-500 dark:disabled:hover:text-accent-500',
|
|
32
|
+
secondary:
|
|
33
|
+
'hover:text-base-600 dark:hover:text-base-400 disabled:hover:text-base-500 dark:disabled:hover:text-base-500'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const numberInputInputVariants = tv({
|
|
39
|
+
base: 'number-input w-full [appearance:textfield] border-0 bg-transparent text-center font-[inherit] font-semibold text-transparent outline-none [-moz-appearance:_textfield] focus-visible:ring-0 [&::-webkit-inner-spin-button]:m-0 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none',
|
|
40
|
+
variants: {
|
|
41
|
+
variant: {
|
|
42
|
+
primary: '',
|
|
43
|
+
secondary: ''
|
|
44
|
+
},
|
|
45
|
+
size: {
|
|
46
|
+
default: 'p-1',
|
|
47
|
+
sm: '',
|
|
48
|
+
lg: 'p-2'
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
export type NumberInputVariant = VariantProps<typeof numberInputVariants>['variant'];
|
|
53
|
+
export type NumberInputSize = VariantProps<typeof numberInputVariants>['size'];
|
|
54
|
+
|
|
55
|
+
export type NumberInputProps = WithElementRef<
|
|
56
|
+
WithoutChildrenOrChild<HTMLAttributes<HTMLDivElement>>
|
|
57
|
+
> & {
|
|
58
|
+
variant?: NumberInputVariant;
|
|
59
|
+
size?: NumberInputSize;
|
|
60
|
+
min?: number;
|
|
61
|
+
value?: number;
|
|
62
|
+
max?: number;
|
|
63
|
+
defaultValue?: number;
|
|
64
|
+
class?: string;
|
|
65
|
+
step?: number;
|
|
66
|
+
inputRef?: HTMLInputElement | null;
|
|
67
|
+
};
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<script lang="ts">
|
|
71
|
+
import NumberFlow from '@number-flow/svelte';
|
|
72
|
+
import type { WithoutChildrenOrChild } from 'bits-ui';
|
|
73
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
74
|
+
|
|
75
|
+
let {
|
|
76
|
+
min = 0,
|
|
77
|
+
value = $bindable(50),
|
|
78
|
+
max = 999,
|
|
79
|
+
defaultValue = 0,
|
|
80
|
+
step = 1,
|
|
81
|
+
class: className,
|
|
82
|
+
ref = $bindable(null),
|
|
83
|
+
inputRef = $bindable(null),
|
|
84
|
+
tabindex = undefined,
|
|
85
|
+
variant = 'primary',
|
|
86
|
+
size = 'default',
|
|
87
|
+
...restProps
|
|
88
|
+
}: NumberInputProps = $props();
|
|
89
|
+
|
|
90
|
+
let animated = $state(true);
|
|
91
|
+
let showCaret = $state(true);
|
|
92
|
+
|
|
93
|
+
function handleInput() {
|
|
94
|
+
if (!inputRef) return;
|
|
95
|
+
animated = false;
|
|
96
|
+
let next = value;
|
|
97
|
+
if (inputRef.value === '') {
|
|
98
|
+
next = defaultValue;
|
|
99
|
+
} else {
|
|
100
|
+
const num = parseInt(inputRef.value);
|
|
101
|
+
if (!isNaN(num) && min <= num && num <= max) next = num;
|
|
102
|
+
}
|
|
103
|
+
inputRef.value = String(next);
|
|
104
|
+
value = next;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function handlePointerDown(event: PointerEvent, diff: number) {
|
|
108
|
+
animated = true;
|
|
109
|
+
if (event.pointerType === 'mouse') {
|
|
110
|
+
event?.preventDefault();
|
|
111
|
+
inputRef?.focus();
|
|
112
|
+
}
|
|
113
|
+
const newVal = Math.min(Math.max(value + diff, min), max);
|
|
114
|
+
value = newVal;
|
|
115
|
+
}
|
|
116
|
+
</script>
|
|
117
|
+
|
|
118
|
+
<div class={cn(numberInputVariants({ variant, size }), className)} bind:this={ref} {...restProps}>
|
|
119
|
+
<button
|
|
120
|
+
aria-hidden="true"
|
|
121
|
+
tabindex={-1}
|
|
122
|
+
class={numberInputButtonVariants({ variant })}
|
|
123
|
+
disabled={min != null && value <= min}
|
|
124
|
+
onpointerdown={(event) => handlePointerDown(event, -step)}
|
|
125
|
+
>
|
|
126
|
+
<svg
|
|
127
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
128
|
+
fill="none"
|
|
129
|
+
viewBox="0 0 24 24"
|
|
130
|
+
stroke-width="3.5"
|
|
131
|
+
stroke="currentColor"
|
|
132
|
+
class="size-4"
|
|
133
|
+
>
|
|
134
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14" />
|
|
135
|
+
</svg>
|
|
136
|
+
</button>
|
|
137
|
+
<div
|
|
138
|
+
class="relative grid w-full items-center justify-items-center text-center [grid-template-areas:'overlap'] *:[grid-area:overlap]"
|
|
139
|
+
>
|
|
140
|
+
<input
|
|
141
|
+
class={cn(
|
|
142
|
+
numberInputInputVariants({ variant, size }),
|
|
143
|
+
showCaret ? 'caret-accent-500' : 'caret-transparent'
|
|
144
|
+
)}
|
|
145
|
+
style="font-kerning: none"
|
|
146
|
+
type="number"
|
|
147
|
+
{min}
|
|
148
|
+
step="1"
|
|
149
|
+
autocomplete="off"
|
|
150
|
+
inputmode="numeric"
|
|
151
|
+
{max}
|
|
152
|
+
{value}
|
|
153
|
+
oninput={handleInput}
|
|
154
|
+
bind:this={inputRef}
|
|
155
|
+
{tabindex}
|
|
156
|
+
/>
|
|
157
|
+
<NumberFlow
|
|
158
|
+
{value}
|
|
159
|
+
locales="en-US"
|
|
160
|
+
format={{ useGrouping: false }}
|
|
161
|
+
aria-hidden="true"
|
|
162
|
+
{animated}
|
|
163
|
+
on:animationsstart={() => (showCaret = false)}
|
|
164
|
+
on:animationsfinish={() => (showCaret = true)}
|
|
165
|
+
class="number-flow pointer-events-none"
|
|
166
|
+
willChange
|
|
167
|
+
/>
|
|
168
|
+
</div>
|
|
169
|
+
<button
|
|
170
|
+
aria-hidden="true"
|
|
171
|
+
tabindex="-1"
|
|
172
|
+
class={numberInputButtonVariants({ variant })}
|
|
173
|
+
disabled={max != null && value >= max}
|
|
174
|
+
onpointerdown={(event) => handlePointerDown(event, step)}
|
|
175
|
+
>
|
|
176
|
+
<svg
|
|
177
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
178
|
+
fill="none"
|
|
179
|
+
viewBox="0 0 24 24"
|
|
180
|
+
stroke-width="3.5"
|
|
181
|
+
stroke="currentColor"
|
|
182
|
+
class="size-4"
|
|
183
|
+
>
|
|
184
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" />
|
|
185
|
+
</svg>
|
|
186
|
+
</button>
|
|
187
|
+
</div>
|
|
188
|
+
|
|
189
|
+
<noscript>
|
|
190
|
+
<style>
|
|
191
|
+
.button-number-input {
|
|
192
|
+
display: none;
|
|
193
|
+
}
|
|
194
|
+
.number-input {
|
|
195
|
+
color: var(--color-accent-500);
|
|
196
|
+
}
|
|
197
|
+
.number-flow {
|
|
198
|
+
display: none;
|
|
199
|
+
}
|
|
200
|
+
</style>
|
|
201
|
+
</noscript>
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { WithElementRef } from 'bits-ui';
|
|
2
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
3
|
+
export declare const numberInputVariants: import("tailwind-variants").TVReturnType<{
|
|
4
|
+
variant: {
|
|
5
|
+
primary: string;
|
|
6
|
+
secondary: string;
|
|
7
|
+
};
|
|
8
|
+
size: {
|
|
9
|
+
default: string;
|
|
10
|
+
sm: string;
|
|
11
|
+
lg: string;
|
|
12
|
+
};
|
|
13
|
+
}, undefined, "group flex w-full max-w-44 touch-manipulation items-stretch justify-between rounded-2xl ring focus-within:ring-2", {
|
|
14
|
+
variant: {
|
|
15
|
+
primary: string;
|
|
16
|
+
secondary: string;
|
|
17
|
+
};
|
|
18
|
+
size: {
|
|
19
|
+
default: string;
|
|
20
|
+
sm: string;
|
|
21
|
+
lg: string;
|
|
22
|
+
};
|
|
23
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
24
|
+
variant: {
|
|
25
|
+
primary: string;
|
|
26
|
+
secondary: string;
|
|
27
|
+
};
|
|
28
|
+
size: {
|
|
29
|
+
default: string;
|
|
30
|
+
sm: string;
|
|
31
|
+
lg: string;
|
|
32
|
+
};
|
|
33
|
+
}, undefined, "group flex w-full max-w-44 touch-manipulation items-stretch justify-between rounded-2xl ring focus-within:ring-2", unknown, unknown, undefined>>;
|
|
34
|
+
export declare const numberInputButtonVariants: import("tailwind-variants").TVReturnType<{
|
|
35
|
+
variant: {
|
|
36
|
+
primary: string;
|
|
37
|
+
secondary: string;
|
|
38
|
+
};
|
|
39
|
+
}, undefined, "button-number-input flex cursor-pointer items-center pr-[.5em] pl-[.5em] transition-colors disabled:cursor-not-allowed disabled:opacity-50", {
|
|
40
|
+
variant: {
|
|
41
|
+
primary: string;
|
|
42
|
+
secondary: string;
|
|
43
|
+
};
|
|
44
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
45
|
+
variant: {
|
|
46
|
+
primary: string;
|
|
47
|
+
secondary: string;
|
|
48
|
+
};
|
|
49
|
+
}, undefined, "button-number-input flex cursor-pointer items-center pr-[.5em] pl-[.5em] transition-colors disabled:cursor-not-allowed disabled:opacity-50", unknown, unknown, undefined>>;
|
|
50
|
+
export declare const numberInputInputVariants: import("tailwind-variants").TVReturnType<{
|
|
51
|
+
variant: {
|
|
52
|
+
primary: string;
|
|
53
|
+
secondary: string;
|
|
54
|
+
};
|
|
55
|
+
size: {
|
|
56
|
+
default: string;
|
|
57
|
+
sm: string;
|
|
58
|
+
lg: string;
|
|
59
|
+
};
|
|
60
|
+
}, undefined, "number-input w-full [appearance:textfield] border-0 bg-transparent text-center font-[inherit] font-semibold text-transparent outline-none [-moz-appearance:_textfield] focus-visible:ring-0 [&::-webkit-inner-spin-button]:m-0 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none", {
|
|
61
|
+
variant: {
|
|
62
|
+
primary: string;
|
|
63
|
+
secondary: string;
|
|
64
|
+
};
|
|
65
|
+
size: {
|
|
66
|
+
default: string;
|
|
67
|
+
sm: string;
|
|
68
|
+
lg: string;
|
|
69
|
+
};
|
|
70
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
71
|
+
variant: {
|
|
72
|
+
primary: string;
|
|
73
|
+
secondary: string;
|
|
74
|
+
};
|
|
75
|
+
size: {
|
|
76
|
+
default: string;
|
|
77
|
+
sm: string;
|
|
78
|
+
lg: string;
|
|
79
|
+
};
|
|
80
|
+
}, undefined, "number-input w-full [appearance:textfield] border-0 bg-transparent text-center font-[inherit] font-semibold text-transparent outline-none [-moz-appearance:_textfield] focus-visible:ring-0 [&::-webkit-inner-spin-button]:m-0 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none", unknown, unknown, undefined>>;
|
|
81
|
+
export type NumberInputVariant = VariantProps<typeof numberInputVariants>['variant'];
|
|
82
|
+
export type NumberInputSize = VariantProps<typeof numberInputVariants>['size'];
|
|
83
|
+
export type NumberInputProps = WithElementRef<WithoutChildrenOrChild<HTMLAttributes<HTMLDivElement>>> & {
|
|
84
|
+
variant?: NumberInputVariant;
|
|
85
|
+
size?: NumberInputSize;
|
|
86
|
+
min?: number;
|
|
87
|
+
value?: number;
|
|
88
|
+
max?: number;
|
|
89
|
+
defaultValue?: number;
|
|
90
|
+
class?: string;
|
|
91
|
+
step?: number;
|
|
92
|
+
inputRef?: HTMLInputElement | null;
|
|
93
|
+
};
|
|
94
|
+
import type { WithoutChildrenOrChild } from 'bits-ui';
|
|
95
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
96
|
+
declare const NumberInput: import("svelte").Component<NumberInputProps, {}, "ref" | "value" | "inputRef">;
|
|
97
|
+
type NumberInput = ReturnType<typeof NumberInput>;
|
|
98
|
+
export default NumberInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as NumberInput } from './NumberInput.svelte';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { WithElementRef } from 'bits-ui';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import { cn } from '../../utils';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
children,
|
|
10
|
+
...restProps
|
|
11
|
+
}: WithElementRef<HTMLAttributes<HTMLParagraphElement>> = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<p
|
|
15
|
+
bind:this={ref}
|
|
16
|
+
class={cn('text-base-700 dark:text-base-200 text-sm font-medium', className)}
|
|
17
|
+
{...restProps}
|
|
18
|
+
>
|
|
19
|
+
{@render children?.()}
|
|
20
|
+
</p>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { WithElementRef } from 'bits-ui';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
declare const Paragraph: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLParagraphElement>>, {}, "ref">;
|
|
4
|
+
type Paragraph = ReturnType<typeof Paragraph>;
|
|
5
|
+
export default Paragraph;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
const Root = PopoverPrimitive.Root;
|
|
3
|
+
const Trigger = PopoverPrimitive.Trigger;
|
|
4
|
+
|
|
5
|
+
export type PopoverProps = PopoverPrimitive.RootProps & {
|
|
6
|
+
triggerProps?: PopoverPrimitive.TriggerProps;
|
|
7
|
+
text?: string;
|
|
8
|
+
|
|
9
|
+
triggerText?: string;
|
|
10
|
+
triggerClasses?: string;
|
|
11
|
+
triggerVariant?: ButtonVariant;
|
|
12
|
+
triggerSize?: ButtonSize;
|
|
13
|
+
|
|
14
|
+
triggerRef?: HTMLButtonElement | null;
|
|
15
|
+
} & PopoverPrimitive.ContentProps &
|
|
16
|
+
PopoverPrimitive.TriggerProps;
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<script lang="ts">
|
|
20
|
+
import { buttonVariants, type ButtonSize, type ButtonVariant } from '../button';
|
|
21
|
+
import { Popover as PopoverPrimitive } from 'bits-ui';
|
|
22
|
+
import { PopoverContent } from '.';
|
|
23
|
+
import { cn } from '../../utils';
|
|
24
|
+
|
|
25
|
+
let {
|
|
26
|
+
open = $bindable(false),
|
|
27
|
+
onOpenChange,
|
|
28
|
+
children,
|
|
29
|
+
|
|
30
|
+
triggerText,
|
|
31
|
+
triggerClasses = '',
|
|
32
|
+
triggerVariant = 'primary',
|
|
33
|
+
triggerSize = 'default',
|
|
34
|
+
triggerRef = $bindable(null),
|
|
35
|
+
|
|
36
|
+
side = 'top',
|
|
37
|
+
sideOffset = 10,
|
|
38
|
+
|
|
39
|
+
child: myChild,
|
|
40
|
+
class: className,
|
|
41
|
+
...restProps
|
|
42
|
+
}: PopoverProps = $props();
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<Root bind:open {onOpenChange}>
|
|
46
|
+
{#if myChild}
|
|
47
|
+
<Trigger class={triggerClasses} bind:ref={triggerRef}>
|
|
48
|
+
{#snippet child({ props })}
|
|
49
|
+
{@render myChild?.({ props })}
|
|
50
|
+
{/snippet}
|
|
51
|
+
</Trigger>
|
|
52
|
+
{:else}
|
|
53
|
+
<Trigger
|
|
54
|
+
class={cn(buttonVariants({ variant: triggerVariant, size: triggerSize }), triggerClasses)}
|
|
55
|
+
bind:ref={triggerRef}
|
|
56
|
+
>
|
|
57
|
+
{triggerText}
|
|
58
|
+
</Trigger>
|
|
59
|
+
{/if}
|
|
60
|
+
<PopoverContent {side} {sideOffset} class={className} {...restProps}>
|
|
61
|
+
{@render children?.()}
|
|
62
|
+
</PopoverContent>
|
|
63
|
+
</Root>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type PopoverProps = PopoverPrimitive.RootProps & {
|
|
2
|
+
triggerProps?: PopoverPrimitive.TriggerProps;
|
|
3
|
+
text?: string;
|
|
4
|
+
triggerText?: string;
|
|
5
|
+
triggerClasses?: string;
|
|
6
|
+
triggerVariant?: ButtonVariant;
|
|
7
|
+
triggerSize?: ButtonSize;
|
|
8
|
+
triggerRef?: HTMLButtonElement | null;
|
|
9
|
+
} & PopoverPrimitive.ContentProps & PopoverPrimitive.TriggerProps;
|
|
10
|
+
import { type ButtonSize, type ButtonVariant } from '../button';
|
|
11
|
+
import { Popover as PopoverPrimitive } from 'bits-ui';
|
|
12
|
+
declare const Popover: import("svelte").Component<PopoverProps, {}, "open" | "triggerRef">;
|
|
13
|
+
type Popover = ReturnType<typeof Popover>;
|
|
14
|
+
export default Popover;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Popover as PopoverPrimitive } from 'bits-ui';
|
|
2
|
+
import Content from './popover-content.svelte';
|
|
3
|
+
declare const Root: import("svelte").Component<import("bits-ui").PopoverRootPropsWithoutHTML, {}, "open">;
|
|
4
|
+
declare const Trigger: import("svelte").Component<PopoverPrimitive.TriggerProps, {}, "ref">;
|
|
5
|
+
declare const Close: import("svelte").Component<PopoverPrimitive.CloseProps, {}, "ref">;
|
|
6
|
+
export { Root as PopoverRoot, Content as PopoverContent, Trigger as PopoverTrigger, Close as PopoverClose };
|
|
7
|
+
export { default as Popover } from './Popover.svelte';
|
|
8
|
+
export type { PopoverProps } from './Popover.svelte';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Popover as PopoverPrimitive } from 'bits-ui';
|
|
2
|
+
import Content from './popover-content.svelte';
|
|
3
|
+
const Root = PopoverPrimitive.Root;
|
|
4
|
+
const Trigger = PopoverPrimitive.Trigger;
|
|
5
|
+
const Close = PopoverPrimitive.Close;
|
|
6
|
+
export { Root as PopoverRoot, Content as PopoverContent, Trigger as PopoverTrigger, Close as PopoverClose };
|
|
7
|
+
export { default as Popover } from './Popover.svelte';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../utils';
|
|
3
|
+
import { Popover as PopoverPrimitive } from 'bits-ui';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
sideOffset = 4,
|
|
9
|
+
align = 'center',
|
|
10
|
+
portalProps,
|
|
11
|
+
...restProps
|
|
12
|
+
}: PopoverPrimitive.ContentProps & {
|
|
13
|
+
portalProps?: PopoverPrimitive.PortalProps;
|
|
14
|
+
} = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<PopoverPrimitive.Portal {...portalProps}>
|
|
18
|
+
<PopoverPrimitive.Content
|
|
19
|
+
bind:ref
|
|
20
|
+
{sideOffset}
|
|
21
|
+
{align}
|
|
22
|
+
class={cn(
|
|
23
|
+
'bg-base-100/70 dark:bg-base-900/50 backdrop-blur-xl border-base-200 dark:border-base-800 text-base-900 dark:text-base-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit rounded-2xl border p-4 shadow-md outline-none',
|
|
24
|
+
className
|
|
25
|
+
)}
|
|
26
|
+
{...restProps}
|
|
27
|
+
/>
|
|
28
|
+
</PopoverPrimitive.Portal>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Popover as PopoverPrimitive } from 'bits-ui';
|
|
2
|
+
type $$ComponentProps = PopoverPrimitive.ContentProps & {
|
|
3
|
+
portalProps?: PopoverPrimitive.PortalProps;
|
|
4
|
+
};
|
|
5
|
+
declare const PopoverContent: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
6
|
+
type PopoverContent = ReturnType<typeof PopoverContent>;
|
|
7
|
+
export default PopoverContent;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { WithElementRef } from 'bits-ui';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import { type VariantProps, tv } from 'tailwind-variants';
|
|
5
|
+
import { cn } from '../../utils';
|
|
6
|
+
|
|
7
|
+
export const proseVariants = tv({
|
|
8
|
+
base: 'prose dark:prose-invert prose-a:no-underline prose-a:text-accent-600 dark:prose-a:text-accent-400 prose-pre:rounded-2xl w-full max-w-none',
|
|
9
|
+
variants: {
|
|
10
|
+
size: {
|
|
11
|
+
default: 'prose-sm',
|
|
12
|
+
md: 'prose-base',
|
|
13
|
+
lg: 'prose-lg',
|
|
14
|
+
xl: 'prose-xl',
|
|
15
|
+
'2xl': 'prose-2xl'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
size: 'default'
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export type ProseSize = VariantProps<typeof proseVariants>['size'];
|
|
24
|
+
|
|
25
|
+
export type ProseProps = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
26
|
+
size?: ProseSize;
|
|
27
|
+
};
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<script lang="ts">
|
|
31
|
+
let {
|
|
32
|
+
children,
|
|
33
|
+
ref = $bindable(null),
|
|
34
|
+
class: className,
|
|
35
|
+
size = 'default',
|
|
36
|
+
...restProps
|
|
37
|
+
}: ProseProps = $props();
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<div bind:this={ref} class={cn(proseVariants({ size }), className)} {...restProps}>
|
|
41
|
+
{@render children?.()}
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<!-- TODO: this is not actually used right now, we have to fix that -->
|
|
45
|
+
<style>
|
|
46
|
+
.prose-base-colors {
|
|
47
|
+
--tw-prose-body: var(--color-base-700);
|
|
48
|
+
--tw-prose-headings: var(--color-base-900);
|
|
49
|
+
--tw-prose-lead: var(--color-base-600);
|
|
50
|
+
--tw-prose-links: var(--color-base-900);
|
|
51
|
+
--tw-prose-bold: var(--color-base-900);
|
|
52
|
+
--tw-prose-counters: var(--color-base-500);
|
|
53
|
+
--tw-prose-bullets: var(--color-base-300);
|
|
54
|
+
--tw-prose-hr: var(--color-base-200);
|
|
55
|
+
--tw-prose-quotes: var(--color-base-900);
|
|
56
|
+
--tw-prose-quote-borders: var(--color-base-200);
|
|
57
|
+
--tw-prose-captions: var(--color-base-500);
|
|
58
|
+
--tw-prose-kbd: var(--color-base-900);
|
|
59
|
+
--tw-prose-kbd-shadows: var(--color-base-900);
|
|
60
|
+
--tw-prose-code: var(--color-base-900);
|
|
61
|
+
--tw-prose-pre-code: var(--color-base-200);
|
|
62
|
+
--tw-prose-pre-bg: var(--color-base-800);
|
|
63
|
+
--tw-prose-th-borders: var(--color-base-300);
|
|
64
|
+
--tw-prose-td-borders: var(--color-base-200);
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
--tw-prose-invert-body: var(--color-base-300);
|
|
68
|
+
--tw-prose-invert-headings: var(--color-white);
|
|
69
|
+
--tw-prose-invert-lead: var(--color-base-400);
|
|
70
|
+
--tw-prose-invert-links: var(--color-white);
|
|
71
|
+
--tw-prose-invert-bold: var(--color-white);
|
|
72
|
+
--tw-prose-invert-counters: var(--color-base-400);
|
|
73
|
+
--tw-prose-invert-bullets: var(--color-base-600);
|
|
74
|
+
--tw-prose-invert-hr: var(--color-base-700);
|
|
75
|
+
--tw-prose-invert-quotes: var(--color-base-100);
|
|
76
|
+
--tw-prose-invert-quote-borders: var(--color-base-700);
|
|
77
|
+
--tw-prose-invert-captions: var(--color-base-400);
|
|
78
|
+
--tw-prose-invert-kbd: var(--color-white);
|
|
79
|
+
--tw-prose-invert-kbd-shadows: var(--color-white);
|
|
80
|
+
--tw-prose-invert-code: var(--color-white);
|
|
81
|
+
--tw-prose-invert-pre-code: var(--color-base-300);
|
|
82
|
+
--tw-prose-invert-pre-bg: rgb(0 0 0 / 50%);
|
|
83
|
+
--tw-prose-invert-th-borders: var(--color-base-600);
|
|
84
|
+
--tw-prose-invert-td-borders: var(--color-base-700);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.prose-base-colors-dark {
|
|
88
|
+
--tw-prose-invert-body: var(--color-base-300);
|
|
89
|
+
--tw-prose-invert-headings: var(--color-white);
|
|
90
|
+
--tw-prose-invert-lead: var(--color-base-400);
|
|
91
|
+
--tw-prose-invert-links: var(--color-white);
|
|
92
|
+
--tw-prose-invert-bold: var(--color-white);
|
|
93
|
+
--tw-prose-invert-counters: var(--color-base-400);
|
|
94
|
+
--tw-prose-invert-bullets: var(--color-base-600);
|
|
95
|
+
--tw-prose-invert-hr: var(--color-base-700);
|
|
96
|
+
--tw-prose-invert-quotes: var(--color-base-100);
|
|
97
|
+
--tw-prose-invert-quote-borders: var(--color-base-700);
|
|
98
|
+
--tw-prose-invert-captions: var(--color-base-400);
|
|
99
|
+
--tw-prose-invert-kbd: var(--color-white);
|
|
100
|
+
--tw-prose-invert-kbd-shadows: var(--color-white);
|
|
101
|
+
--tw-prose-invert-code: var(--color-white);
|
|
102
|
+
--tw-prose-invert-pre-code: var(--color-base-300);
|
|
103
|
+
--tw-prose-invert-pre-bg: rgb(0 0 0 / 50%);
|
|
104
|
+
--tw-prose-invert-th-borders: var(--color-base-600);
|
|
105
|
+
--tw-prose-invert-td-borders: var(--color-base-700);
|
|
106
|
+
}
|
|
107
|
+
</style>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { WithElementRef } from 'bits-ui';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
4
|
+
export declare const proseVariants: import("tailwind-variants").TVReturnType<{
|
|
5
|
+
size: {
|
|
6
|
+
default: string;
|
|
7
|
+
md: string;
|
|
8
|
+
lg: string;
|
|
9
|
+
xl: string;
|
|
10
|
+
'2xl': string;
|
|
11
|
+
};
|
|
12
|
+
}, undefined, "prose dark:prose-invert prose-a:no-underline prose-a:text-accent-600 dark:prose-a:text-accent-400 prose-pre:rounded-2xl w-full max-w-none", {
|
|
13
|
+
size: {
|
|
14
|
+
default: string;
|
|
15
|
+
md: string;
|
|
16
|
+
lg: string;
|
|
17
|
+
xl: string;
|
|
18
|
+
'2xl': string;
|
|
19
|
+
};
|
|
20
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
21
|
+
size: {
|
|
22
|
+
default: string;
|
|
23
|
+
md: string;
|
|
24
|
+
lg: string;
|
|
25
|
+
xl: string;
|
|
26
|
+
'2xl': string;
|
|
27
|
+
};
|
|
28
|
+
}, undefined, "prose dark:prose-invert prose-a:no-underline prose-a:text-accent-600 dark:prose-a:text-accent-400 prose-pre:rounded-2xl w-full max-w-none", unknown, unknown, undefined>>;
|
|
29
|
+
export type ProseSize = VariantProps<typeof proseVariants>['size'];
|
|
30
|
+
export type ProseProps = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
31
|
+
size?: ProseSize;
|
|
32
|
+
};
|
|
33
|
+
declare const Prose: import("svelte").Component<ProseProps, {}, "ref">;
|
|
34
|
+
type Prose = ReturnType<typeof Prose>;
|
|
35
|
+
export default Prose;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { AddCopyCodeButtons } from "../copy-code-button";
|
|
3
|
+
import Prose from "./Prose.svelte";
|
|
4
|
+
import type { Snippet } from "svelte";
|
|
5
|
+
|
|
6
|
+
let { children, class: className }: { children: Snippet; class?: string } = $props();
|
|
7
|
+
</script>
|
|
8
|
+
<Prose class={className}>
|
|
9
|
+
{@render children?.()}
|
|
10
|
+
</Prose>
|
|
11
|
+
|
|
12
|
+
<AddCopyCodeButtons />
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
children: Snippet;
|
|
4
|
+
class?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const ProseCopyButton: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type ProseCopyButton = ReturnType<typeof ProseCopyButton>;
|
|
8
|
+
export default ProseCopyButton;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import './style.css';
|
|
2
|
+
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> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const BodyScrollArea: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type BodyScrollArea = InstanceType<typeof BodyScrollArea>;
|
|
19
|
+
export default BodyScrollArea;
|