tera-system-ui 0.1.50 → 0.1.61
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/dist/components/accordion/Accordion.d.ts +15 -13
- package/dist/components/accordion/index.d.ts +1 -0
- package/dist/components/avatar/Avatar.d.ts +5 -3
- package/dist/components/avatar/index.d.ts +1 -0
- package/dist/components/brand-logo/BrandLogo.d.ts +5 -2
- package/dist/components/brand-logo/index.d.ts +1 -0
- package/dist/components/button/Button.d.ts +58 -14
- package/dist/components/button/Button.js +90 -27
- package/dist/components/button/Button.svelte +35 -30
- package/dist/components/button/Button.svelte.d.ts +1 -4
- package/dist/components/button/index.d.ts +1 -0
- package/dist/components/checkbox/Checkbox.d.ts +5 -2
- package/dist/components/checkbox/Checkbox.svelte +15 -8
- package/dist/components/checkbox/index.d.ts +1 -0
- package/dist/components/combobox/Combobox.d.ts +5 -2
- package/dist/components/combobox/index.d.ts +1 -0
- package/dist/components/dialog/Dialog.d.ts +8 -6
- package/dist/components/dialog/index.d.ts +1 -0
- package/dist/components/dropdown-menu/DropdownMenu.d.ts +26 -8
- package/dist/components/dropdown-menu/index.d.ts +1 -0
- package/dist/components/header/Header.d.ts +6 -3
- package/dist/components/header/Header.svelte.d.ts +1 -1
- package/dist/components/header/index.d.ts +1 -0
- package/dist/components/input/Input.d.ts +22 -6
- package/dist/components/input/Input.js +19 -10
- package/dist/components/input/Input.svelte +42 -9
- package/dist/components/input/index.d.ts +1 -0
- package/dist/components/label/Label.d.ts +33 -3
- package/dist/components/label/Label.js +14 -3
- package/dist/components/label/Label.svelte +7 -7
- package/dist/components/label/Label.svelte.d.ts +2 -2
- package/dist/components/label/index.d.ts +1 -0
- package/dist/components/language-picker-button/LanguagePickerButton.d.ts +5 -2
- package/dist/components/language-picker-button/index.d.ts +1 -0
- package/dist/components/light-dark-toggle/LightDarkToggle.d.ts +5 -2
- package/dist/components/light-dark-toggle/index.d.ts +1 -0
- package/dist/components/popover/Popover.d.ts +6 -3
- package/dist/components/popover/Popover.js +0 -1
- package/dist/components/popover/index.d.ts +1 -0
- package/dist/components/popover-responsive/PopoverResponsive.d.ts +5 -2
- package/dist/components/popover-responsive/index.d.ts +1 -0
- package/dist/components/select/Select.d.ts +19 -5
- package/dist/components/select/Select.js +18 -9
- package/dist/components/select/Select.svelte +17 -4
- package/dist/components/select/Select.svelte.d.ts +1 -1
- package/dist/components/select/index.d.ts +1 -0
- package/dist/components/side-navigation/SideNavigation.d.ts +6 -3
- package/dist/components/side-navigation/index.d.ts +1 -1
- package/dist/components/slider/Slider.d.ts +7 -4
- package/dist/components/slider/Slider.svelte +26 -51
- package/dist/components/slider/index.d.ts +1 -0
- package/dist/components/star-rating/StarRating.d.ts +5 -2
- package/dist/components/star-rating/StarRating.svelte +5 -5
- package/dist/components/star-rating/index.d.ts +1 -0
- package/dist/components/switch/Switch.d.ts +6 -2
- package/dist/components/switch/Switch.svelte +13 -7
- package/dist/components/switch/index.d.ts +1 -0
- package/dist/components/tabs/Tabs.svelte.d.ts +23 -3
- package/dist/components/tabs/index.d.ts +1 -0
- package/dist/components/tera-ui-context/TeraUiContext.d.ts +4 -6
- package/dist/components/tera-ui-context/index.d.ts +1 -0
- package/dist/components/text-area/TextArea.d.ts +22 -8
- package/dist/components/text-area/TextArea.js +19 -10
- package/dist/components/text-area/TextArea.svelte +35 -29
- package/dist/components/text-area/index.d.ts +1 -0
- package/dist/components/user-avatar-with-menu/UserAvatarWithMenu.d.ts +5 -2
- package/dist/components/user-avatar-with-menu/index.d.ts +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/paraglide/README.md +93 -0
- package/dist/paraglide/messages/_index.d.ts +22 -7
- package/dist/paraglide/messages/_index.js +487 -8
- package/dist/paraglide/messages/ar.d.ts +9 -0
- package/dist/paraglide/messages/ar.js +31 -0
- package/dist/paraglide/messages/bg.d.ts +9 -0
- package/dist/paraglide/messages/bg.js +31 -0
- package/dist/paraglide/messages/bn.d.ts +9 -0
- package/dist/paraglide/messages/bn.js +31 -0
- package/dist/paraglide/messages/ca.d.ts +9 -0
- package/dist/paraglide/messages/ca.js +31 -0
- package/dist/paraglide/messages/cs.d.ts +9 -0
- package/dist/paraglide/messages/cs.js +31 -0
- package/dist/paraglide/messages/da.d.ts +9 -0
- package/dist/paraglide/messages/da.js +31 -0
- package/dist/paraglide/messages/de.d.ts +9 -0
- package/dist/paraglide/messages/de.js +31 -0
- package/dist/paraglide/messages/el.d.ts +9 -0
- package/dist/paraglide/messages/el.js +31 -0
- package/dist/paraglide/messages/en.d.ts +9 -0
- package/dist/paraglide/messages/en.js +31 -0
- package/dist/paraglide/messages/es.d.ts +9 -0
- package/dist/paraglide/messages/es.js +31 -0
- package/dist/paraglide/messages/fi.d.ts +9 -0
- package/dist/paraglide/messages/fi.js +31 -0
- package/dist/paraglide/messages/fr.d.ts +9 -0
- package/dist/paraglide/messages/fr.js +31 -0
- package/dist/paraglide/messages/he.d.ts +9 -0
- package/dist/paraglide/messages/he.js +31 -0
- package/dist/paraglide/messages/hi.d.ts +9 -0
- package/dist/paraglide/messages/hi.js +31 -0
- package/dist/paraglide/messages/hu.d.ts +9 -0
- package/dist/paraglide/messages/hu.js +31 -0
- package/dist/paraglide/messages/id.d.ts +9 -0
- package/dist/paraglide/messages/id.js +31 -0
- package/dist/paraglide/messages/it.d.ts +9 -0
- package/dist/paraglide/messages/it.js +31 -0
- package/dist/paraglide/messages/ja.d.ts +9 -0
- package/dist/paraglide/messages/ja.js +31 -0
- package/dist/paraglide/messages/ko.d.ts +9 -0
- package/dist/paraglide/messages/ko.js +31 -0
- package/dist/paraglide/messages/lt.d.ts +9 -0
- package/dist/paraglide/messages/lt.js +31 -0
- package/dist/paraglide/messages/lv.d.ts +9 -0
- package/dist/paraglide/messages/lv.js +31 -0
- package/dist/paraglide/messages/ms.d.ts +9 -0
- package/dist/paraglide/messages/ms.js +31 -0
- package/dist/paraglide/messages/nl.d.ts +9 -0
- package/dist/paraglide/messages/nl.js +31 -0
- package/dist/paraglide/messages/no.d.ts +9 -0
- package/dist/paraglide/messages/no.js +31 -0
- package/dist/paraglide/messages/pl.d.ts +9 -0
- package/dist/paraglide/messages/pl.js +31 -0
- package/dist/paraglide/messages/pt.d.ts +9 -0
- package/dist/paraglide/messages/pt.js +31 -0
- package/dist/paraglide/messages/ro.d.ts +9 -0
- package/dist/paraglide/messages/ro.js +31 -0
- package/dist/paraglide/messages/ru.d.ts +9 -0
- package/dist/paraglide/messages/ru.js +31 -0
- package/dist/paraglide/messages/sk.d.ts +9 -0
- package/dist/paraglide/messages/sk.js +31 -0
- package/dist/paraglide/messages/sl.d.ts +9 -0
- package/dist/paraglide/messages/sl.js +31 -0
- package/dist/paraglide/messages/sq.d.ts +9 -0
- package/dist/paraglide/messages/sq.js +31 -0
- package/dist/paraglide/messages/sr.d.ts +9 -0
- package/dist/paraglide/messages/sr.js +31 -0
- package/dist/paraglide/messages/sv.d.ts +9 -0
- package/dist/paraglide/messages/sv.js +31 -0
- package/dist/paraglide/messages/sw.d.ts +9 -0
- package/dist/paraglide/messages/sw.js +31 -0
- package/dist/paraglide/messages/ta.d.ts +9 -0
- package/dist/paraglide/messages/ta.js +31 -0
- package/dist/paraglide/messages/te.d.ts +9 -0
- package/dist/paraglide/messages/te.js +31 -0
- package/dist/paraglide/messages/th.d.ts +9 -0
- package/dist/paraglide/messages/th.js +31 -0
- package/dist/paraglide/messages/tl.d.ts +9 -0
- package/dist/paraglide/messages/tl.js +31 -0
- package/dist/paraglide/messages/tr.d.ts +9 -0
- package/dist/paraglide/messages/tr.js +31 -0
- package/dist/paraglide/messages/uk.d.ts +9 -0
- package/dist/paraglide/messages/uk.js +31 -0
- package/dist/paraglide/messages/vi.d.ts +9 -0
- package/dist/paraglide/messages/vi.js +31 -0
- package/dist/paraglide/messages/zh-CN.d.ts +9 -0
- package/dist/paraglide/messages/zh-CN.js +31 -0
- package/dist/paraglide/messages/zh-TW.d.ts +9 -0
- package/dist/paraglide/messages/zh-TW.js +31 -0
- package/dist/paraglide/messages.js +1 -1
- package/dist/paraglide/registry.js +1 -1
- package/dist/paraglide/runtime.d.ts +221 -45
- package/dist/paraglide/runtime.js +378 -65
- package/dist/paraglide/server.d.ts +40 -4
- package/dist/paraglide/server.js +83 -46
- package/dist/tera-i18n/projects/tera-system-ui/project.inlang/.meta.json +3 -0
- package/dist/tera-i18n/projects/tera-system-ui/project.inlang/README.md +103 -0
- package/dist/themes/tera-ui-base.css +70 -7
- package/dist/types/index.d.ts +25 -0
- package/dist/types/index.js +3 -0
- package/package.json +150 -36
- package/scripts/add-component-template.js +1 -1
- package/scripts/generate-ts-index.js +38 -12
- package/dist/paraglide/messages/text_account_settings.d.ts +0 -3
- package/dist/paraglide/messages/text_account_settings.js +0 -238
- package/dist/paraglide/messages/text_calces_documentation.d.ts +0 -3
- package/dist/paraglide/messages/text_calces_documentation.js +0 -238
- package/dist/paraglide/messages/text_calces_scientific_calculator.d.ts +0 -3
- package/dist/paraglide/messages/text_calces_scientific_calculator.js +0 -238
- package/dist/paraglide/messages/text_currency_converter.d.ts +0 -3
- package/dist/paraglide/messages/text_currency_converter.js +0 -238
- package/dist/paraglide/messages/text_logout.d.ts +0 -3
- package/dist/paraglide/messages/text_logout.js +0 -238
- package/dist/paraglide/messages/text_select_language.d.ts +0 -3
- package/dist/paraglide/messages/text_select_language.js +0 -238
- package/dist/paraglide/messages/text_unit_converter.d.ts +0 -3
- package/dist/paraglide/messages/text_unit_converter.js +0 -238
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
|
|
62
62
|
})
|
|
63
63
|
|
|
64
|
-
let tooltipInterval
|
|
64
|
+
let tooltipInterval: ReturnType<typeof setTimeout> | undefined;
|
|
65
65
|
|
|
66
|
-
function toggleToolTip(open) {
|
|
66
|
+
function toggleToolTip(open: boolean) {
|
|
67
67
|
if (tooltipInterval) clearInterval(tooltipInterval)
|
|
68
68
|
|
|
69
69
|
if (open) {
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
const calculateValue = (position) => {
|
|
80
|
-
const sliderWidth = sliderRail
|
|
79
|
+
const calculateValue = (position: number) => {
|
|
80
|
+
const sliderWidth = sliderRail?.offsetWidth || 0;
|
|
81
81
|
const totalSteps = (max - min) / step;
|
|
82
82
|
const stepSize = sliderWidth / totalSteps;
|
|
83
83
|
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
return Number(value.toFixed(10));
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
const onDrag = (event) => {
|
|
95
|
+
const onDrag = (event: PointerEvent | TouchEvent) => {
|
|
96
96
|
event.preventDefault();
|
|
97
97
|
event.stopPropagation();
|
|
98
98
|
toggleToolTip(true)
|
|
@@ -100,10 +100,10 @@
|
|
|
100
100
|
let position
|
|
101
101
|
|
|
102
102
|
if (event.type.startsWith('touch')) {
|
|
103
|
-
const touch = event.touches[0];
|
|
104
|
-
position = touch.clientX - slider
|
|
103
|
+
const touch = (event as TouchEvent).touches[0];
|
|
104
|
+
position = touch.clientX - (slider?.getBoundingClientRect().left || 0);
|
|
105
105
|
} else {
|
|
106
|
-
position = event.clientX - slider
|
|
106
|
+
position = (event as PointerEvent).clientX - (slider?.getBoundingClientRect().left || 0);
|
|
107
107
|
}
|
|
108
108
|
let newValue = calculateValue(position);
|
|
109
109
|
|
|
@@ -123,67 +123,42 @@
|
|
|
123
123
|
updateSliderByValue(value)
|
|
124
124
|
})
|
|
125
125
|
|
|
126
|
-
function updateSliderByValue(
|
|
126
|
+
function updateSliderByValue(_v: number) {
|
|
127
127
|
const percentage = ((value - min) / (max - min)) * 100
|
|
128
128
|
|
|
129
129
|
// Update the position of the handle and track width
|
|
130
|
-
sliderHandle.style.left = `${percentage}%`;
|
|
131
|
-
sliderTooltip.style.left = `${percentage}%`;
|
|
132
|
-
sliderTrack.style.width = `${percentage}%`;
|
|
130
|
+
if (sliderHandle) sliderHandle.style.left = `${percentage}%`;
|
|
131
|
+
if (sliderTooltip) sliderTooltip.style.left = `${percentage}%`;
|
|
132
|
+
if (sliderTrack) sliderTrack.style.width = `${percentage}%`;
|
|
133
133
|
}
|
|
134
134
|
</script>
|
|
135
135
|
|
|
136
136
|
|
|
137
137
|
<div bind:this={slider} class="cursor-pointer w-full relative mx-1 py-2.5">
|
|
138
|
-
<div data-slider-rail bind:this={sliderRail} class="w-full h-1.5 bg-neutral-token-4 rounded-full overflow-hidden">
|
|
139
|
-
<div data-slider-track bind:this={sliderTrack} class="rounded-full w-full h-full bg-
|
|
138
|
+
<div data-slider-rail bind:this={sliderRail} class="w-full h-1.5 bg-neutral-token-4 rounded-full overflow-hidden hover:bg-neutral-token-5 transition-colors duration-200">
|
|
139
|
+
<div data-slider-track bind:this={sliderTrack} class="rounded-full w-full h-full bg-neutral-token-13"></div>
|
|
140
140
|
</div>
|
|
141
141
|
|
|
142
142
|
<div
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
143
|
+
bind:this={sliderHandle}
|
|
144
|
+
data-slider-handle
|
|
145
|
+
tabindex="0"
|
|
146
|
+
role="slider"
|
|
147
|
+
aria-valuemin={`${(min ?? 0)}`}
|
|
148
|
+
aria-valuemax={`${(max ?? 0)}`}
|
|
149
|
+
aria-valuenow={`${(value ?? 0)}`}
|
|
150
|
+
aria-orientation="horizontal"
|
|
151
|
+
class="slider-handle -translate-x-1/2 absolute top-1/2 -translate-y-1/2 rounded-full bg-neutral-token-1 border-2 outline-1 outline-neutral-token-1 border-neutral-token-13 size-4 shadow-sm"
|
|
152
152
|
>
|
|
153
153
|
|
|
154
154
|
</div>
|
|
155
155
|
|
|
156
156
|
<div bind:this={sliderTooltip} data-slider-tooltip class="">
|
|
157
|
-
<span class="z-10 relative">
|
|
157
|
+
<span class="z-10 relative text-xs">
|
|
158
158
|
{value}
|
|
159
159
|
</span>
|
|
160
160
|
</div>
|
|
161
|
-
|
|
162
|
-
<!-- <input-->
|
|
163
|
-
<!-- type="range"-->
|
|
164
|
-
<!-- min={min}-->
|
|
165
|
-
<!-- max={max}-->
|
|
166
|
-
<!-- step={step}-->
|
|
167
|
-
<!-- oninput={(event) => {-->
|
|
168
|
-
<!-- value = event.target.value;-->
|
|
169
|
-
<!-- handleChange(event);-->
|
|
170
|
-
<!-- }}-->
|
|
171
|
-
<!-- class="w-full appearance-none bg-gray-300 rounded-lg h-2 focus:outline-none focus:ring-2 focus:ring-blue-500 transition"-->
|
|
172
|
-
<!-- />-->
|
|
173
|
-
|
|
174
|
-
<!-- {#if showTicks}-->
|
|
175
|
-
<!-- <div class="relative mt-2 flex justify-between text-xs text-gray-500">-->
|
|
176
|
-
<!-- {#each ticks as tick}-->
|
|
177
|
-
<!-- <div class="flex-1">-->
|
|
178
|
-
<!-- <div-->
|
|
179
|
-
<!-- class="h-2 w-0.5 bg-gray-400 mx-auto"-->
|
|
180
|
-
<!-- style="transform: translateX(-50%);"-->
|
|
181
|
-
<!-- ></div>-->
|
|
182
|
-
<!-- </div>-->
|
|
183
|
-
<!-- {/each}-->
|
|
184
|
-
<!-- </div>-->
|
|
185
|
-
<!-- {/if}-->
|
|
186
161
|
</div>
|
|
187
162
|
|
|
188
|
-
<style>/*! tailwindcss v4.1.
|
|
189
|
-
.slider-handle{transition:all .2s
|
|
163
|
+
<style>/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */
|
|
164
|
+
.slider-handle{transition:all .2s cubic-bezier(.645,.045,.355,1),left}:is(.slider-handle:global([data-state="dragging"]),.slider-handle:hover,.slider-handle:focus,.slider-handle:active,.slider-handle:focus-visible){border-width:2px;transform:scale(1.2);box-shadow:0 0 0 4px #3b82f61f}.slider-handle:focus-visible{outline:none}[data-slider-tooltip]{pointer-events:none;background-color:var(--color-neutral-token-12);width:fit-content;color:var(--color-neutral-token-1);z-index:10;border-radius:6px;padding:4px 8px;font-size:12px;line-height:1.5;position:absolute;left:50%}[data-slider-tooltip]:after{content:"";background-color:var(--color-neutral-token-12);border-radius:2px;width:8px;height:8px;position:absolute;bottom:-3px;left:50%;transform:translate(-50%)rotate(45deg)}[data-slider-tooltip]{opacity:0;transition:all .2s cubic-bezier(.645,.045,.355,1),left;transform:translateY(-2.5rem)translate(-50%)scale(.9)}[data-slider-tooltip]:global(.show){opacity:1;transform:translateY(-3rem)translate(-50%)scale(1)}</style>
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type VariantProps } from "tailwind-variants";
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
2
4
|
export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
3
5
|
size: {
|
|
4
6
|
sm: string;
|
|
@@ -19,10 +21,11 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
|
19
21
|
};
|
|
20
22
|
}, undefined, "", unknown, unknown, undefined>>;
|
|
21
23
|
type StarRatingVariants = VariantProps<typeof styles>;
|
|
22
|
-
export interface StarRatingProps extends StarRatingVariants {
|
|
23
|
-
children?:
|
|
24
|
+
export interface StarRatingProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onchange'>, StarRatingVariants {
|
|
25
|
+
children?: Snippet;
|
|
24
26
|
class?: string;
|
|
25
27
|
value?: number;
|
|
26
28
|
onchange?: (value: number) => void;
|
|
29
|
+
ref?: HTMLDivElement | null;
|
|
27
30
|
}
|
|
28
31
|
export {};
|
|
@@ -78,16 +78,16 @@
|
|
|
78
78
|
</div>
|
|
79
79
|
|
|
80
80
|
|
|
81
|
-
<style>[data-rating-icon] {
|
|
82
|
-
fill: var(--color-neutral-token-5);
|
|
83
|
-
transition: all var(--duration-element-react);
|
|
84
|
-
}
|
|
85
|
-
[data-rating-icon]:first-child {
|
|
81
|
+
<style>[data-rating-icon]:first-child {
|
|
86
82
|
padding-left: 0;
|
|
87
83
|
}
|
|
88
84
|
[data-rating-icon]:last-child {
|
|
89
85
|
padding-right: 0;
|
|
90
86
|
}
|
|
87
|
+
[data-rating-icon] {
|
|
88
|
+
fill: var(--color-neutral-token-5);
|
|
89
|
+
transition: all var(--duration-element-react);
|
|
90
|
+
}
|
|
91
91
|
[data-rating-icon][aria-checked=true] {
|
|
92
92
|
fill: var(--color-yellow-400);
|
|
93
93
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { type VariantProps } from "tailwind-variants";
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
2
4
|
export declare const styles: import("tailwind-variants").TVReturnType<{}, undefined, "", {}, undefined, import("tailwind-variants").TVReturnType<{}, undefined, "", unknown, unknown, undefined>>;
|
|
3
5
|
type SwitchVariants = VariantProps<typeof styles>;
|
|
4
|
-
export interface SwitchProps extends SwitchVariants {
|
|
5
|
-
children?:
|
|
6
|
+
export interface SwitchProps extends HTMLButtonAttributes, SwitchVariants {
|
|
7
|
+
children?: Snippet;
|
|
6
8
|
class?: string;
|
|
9
|
+
checked?: boolean;
|
|
10
|
+
ref?: HTMLButtonElement | null;
|
|
7
11
|
}
|
|
8
12
|
export {};
|
|
@@ -17,19 +17,25 @@
|
|
|
17
17
|
bind:checked
|
|
18
18
|
bind:ref
|
|
19
19
|
class={cn(
|
|
20
|
-
"relative
|
|
21
|
-
|
|
20
|
+
"relative group peer h-[22px] w-11 shrink-0 cursor-pointer items-center rounded-full transition-all duration-200",
|
|
21
|
+
"focus-visible:outline-none focus-visible:shadow-[0_0_0_2px_rgba(59,130,246,0.1)]",
|
|
22
|
+
"data-[state=checked]:bg-primary-600",
|
|
23
|
+
"data-[state=unchecked]:bg-neutral-token-5",
|
|
24
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
25
|
+
"overflow-hidden",
|
|
22
26
|
className
|
|
23
27
|
)}
|
|
24
28
|
>
|
|
25
|
-
|
|
26
|
-
<div class="
|
|
29
|
+
<!-- Internal line indicator (like Ant Design) -->
|
|
30
|
+
<div class="h-[10px] w-[1px] bg-neutral-1 absolute top-[6px] left-[9px] transition-all duration-200 group-data-[state=unchecked]:opacity-0 group-data-[state=checked]:opacity-100"></div>
|
|
31
|
+
<div class="size-[6px] border border-neutral-1/30 absolute top-2 right-[9px] rounded-full transition-all duration-200 group-data-[state=unchecked]:opacity-100 group-data-[state=checked]:opacity-0"></div>
|
|
32
|
+
|
|
27
33
|
<SwitchPrimitive.Thumb
|
|
28
34
|
class={cn(
|
|
29
|
-
"
|
|
30
|
-
"shadow-[0_2px_4px_rgba(0,0,0,0.2)
|
|
35
|
+
"pointer-events-none block size-[18px] rounded-full bg-neutral-1 transition-transform duration-200",
|
|
36
|
+
"shadow-[0_2px_4px_rgba(0,0,0,0.2)]",
|
|
37
|
+
"data-[state=checked]:translate-x-[23px] data-[state=unchecked]:translate-x-[2px]"
|
|
31
38
|
)}
|
|
32
39
|
/>
|
|
33
40
|
</SwitchPrimitive.Root>
|
|
34
41
|
|
|
35
|
-
|
|
@@ -1,11 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLAttributes, HTMLButtonAttributes } from "svelte/elements";
|
|
3
|
+
export type TabsProps = HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
children?: Snippet;
|
|
3
5
|
value?: string;
|
|
4
6
|
onchange?: (newTab: string) => void;
|
|
5
7
|
class?: string;
|
|
8
|
+
ref?: HTMLDivElement | null;
|
|
9
|
+
};
|
|
10
|
+
export type TabsListProps = HTMLAttributes<HTMLDivElement> & {
|
|
11
|
+
children?: Snippet;
|
|
12
|
+
class?: string;
|
|
13
|
+
ref?: HTMLDivElement | null;
|
|
14
|
+
};
|
|
15
|
+
export type TabsItemProps = HTMLButtonAttributes & {
|
|
16
|
+
children?: Snippet;
|
|
17
|
+
value: string;
|
|
18
|
+
class?: string;
|
|
19
|
+
ref?: HTMLButtonElement | null;
|
|
20
|
+
};
|
|
21
|
+
export type TabsContentProps = HTMLAttributes<HTMLDivElement> & {
|
|
22
|
+
children?: Snippet;
|
|
23
|
+
value: string;
|
|
24
|
+
class?: string;
|
|
25
|
+
ref?: HTMLDivElement | null;
|
|
6
26
|
};
|
|
7
27
|
export type TabsContext = {
|
|
8
|
-
currentTab: string;
|
|
28
|
+
currentTab: string | undefined;
|
|
9
29
|
};
|
|
10
30
|
export declare function createContext(props: {
|
|
11
31
|
currentTab?: string;
|
|
@@ -2,3 +2,4 @@ export { default as Tabs } from './components/Tabs.svelte';
|
|
|
2
2
|
export { default as TabsList } from './components/TabsList.svelte';
|
|
3
3
|
export { default as TabsItem } from './components/TabsItem.svelte';
|
|
4
4
|
export { default as TabsContent } from './components/TabsContent.svelte';
|
|
5
|
+
export type { TabsProps, TabsListProps, TabsItemProps, TabsContentProps } from './Tabs.svelte.js';
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import type { AvailableLanguageTag } from "../../i18n/language";
|
|
2
|
-
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
export interface TeraUiContextProps {
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
class?: string;
|
|
3
6
|
basePath?: string;
|
|
4
7
|
supportLanguages?: AvailableLanguageTag[];
|
|
5
8
|
language?: AvailableLanguageTag;
|
|
6
9
|
sideNavHref?: string;
|
|
7
10
|
apiUrl?: string;
|
|
8
|
-
isAstroEnv?: boolean;
|
|
9
|
-
};
|
|
10
|
-
export interface TeraUiContextProps extends TeraUiContext {
|
|
11
|
-
children?: any;
|
|
12
|
-
class?: string;
|
|
13
11
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type VariantProps } from "tailwind-variants";
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLTextareaAttributes } from "svelte/elements";
|
|
2
4
|
export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
3
5
|
variant: {
|
|
4
6
|
outlined: string;
|
|
@@ -17,7 +19,11 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
|
17
19
|
allowClear: {
|
|
18
20
|
true: string;
|
|
19
21
|
};
|
|
20
|
-
|
|
22
|
+
status: {
|
|
23
|
+
error: string;
|
|
24
|
+
warning: string;
|
|
25
|
+
};
|
|
26
|
+
}, undefined, "w-full inline-flex items-start rounded-md outline-none font-normal text-neutral-token-13 placeholder:text-neutral-token-7 resize-y", {
|
|
21
27
|
variant: {
|
|
22
28
|
outlined: string;
|
|
23
29
|
filled: string;
|
|
@@ -35,6 +41,10 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
|
35
41
|
allowClear: {
|
|
36
42
|
true: string;
|
|
37
43
|
};
|
|
44
|
+
status: {
|
|
45
|
+
error: string;
|
|
46
|
+
warning: string;
|
|
47
|
+
};
|
|
38
48
|
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
39
49
|
variant: {
|
|
40
50
|
outlined: string;
|
|
@@ -53,21 +63,25 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
|
53
63
|
allowClear: {
|
|
54
64
|
true: string;
|
|
55
65
|
};
|
|
56
|
-
|
|
66
|
+
status: {
|
|
67
|
+
error: string;
|
|
68
|
+
warning: string;
|
|
69
|
+
};
|
|
70
|
+
}, undefined, "w-full inline-flex items-start rounded-md outline-none font-normal text-neutral-token-13 placeholder:text-neutral-token-7 resize-y", unknown, unknown, undefined>>;
|
|
57
71
|
type TextAreaVariants = VariantProps<typeof styles>;
|
|
58
72
|
export type AutoSizeConfig = boolean | {
|
|
59
73
|
minRows?: number;
|
|
60
74
|
maxRows?: number;
|
|
61
75
|
};
|
|
62
|
-
export interface TextAreaProps extends TextAreaVariants {
|
|
63
|
-
children?:
|
|
76
|
+
export interface TextAreaProps extends Omit<HTMLTextareaAttributes, 'disabled' | 'rows' | 'prefix'>, TextAreaVariants {
|
|
77
|
+
children?: Snippet;
|
|
64
78
|
class?: string;
|
|
65
79
|
value?: string;
|
|
66
|
-
ref?:
|
|
67
|
-
prefix?: any;
|
|
68
|
-
onchange?: (event: any) => void;
|
|
80
|
+
ref?: HTMLTextAreaElement | null;
|
|
69
81
|
autoSize?: AutoSizeConfig;
|
|
70
|
-
rows?:
|
|
82
|
+
rows?: number;
|
|
71
83
|
allowClear?: boolean;
|
|
84
|
+
showCount?: boolean;
|
|
85
|
+
maxLength?: number;
|
|
72
86
|
}
|
|
73
87
|
export {};
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
import { tv } from "tailwind-variants";
|
|
2
2
|
export const styles = tv({
|
|
3
|
-
base: '
|
|
3
|
+
base: 'w-full inline-flex items-start rounded-md outline-none font-normal text-neutral-token-13 placeholder:text-neutral-token-7 resize-y',
|
|
4
4
|
variants: {
|
|
5
5
|
variant: {
|
|
6
|
-
outlined: 'border border-neutral-token-5 bg-
|
|
7
|
-
filled: 'bg-neutral-token-3 border border-neutral-token-
|
|
8
|
-
borderless: 'bg-transparent border-0',
|
|
6
|
+
outlined: 'border border-neutral-token-5 bg-neutral-token-1 hover:border-primary-500 focus:border-primary-600 focus:shadow-[0_0_0_2px_rgba(59,130,246,0.1)] transition-all duration-200',
|
|
7
|
+
filled: 'bg-neutral-token-3 border border-transparent hover:bg-neutral-token-4 focus:bg-neutral-token-1 focus:border-primary-600 focus:shadow-[0_0_0_2px_rgba(59,130,246,0.1)] transition-all duration-200',
|
|
8
|
+
borderless: 'bg-transparent border-0 hover:bg-neutral-token-2 focus:bg-neutral-token-2 transition-all duration-200',
|
|
9
9
|
},
|
|
10
10
|
disabled: {
|
|
11
|
-
true: 'cursor-not-allowed
|
|
11
|
+
true: 'cursor-not-allowed bg-neutral-token-3 text-neutral-token-7 border-neutral-token-5 resize-none',
|
|
12
12
|
false: 'cursor-text',
|
|
13
13
|
},
|
|
14
14
|
size: {
|
|
15
|
-
sm: 'px-
|
|
16
|
-
md: 'px-3
|
|
17
|
-
lg: 'px-3
|
|
15
|
+
sm: 'px-3 py-1 text-sm min-h-[60px]',
|
|
16
|
+
md: 'px-3 py-1.5 text-sm min-h-[80px]',
|
|
17
|
+
lg: 'px-3 py-2 text-base min-h-[100px]',
|
|
18
18
|
},
|
|
19
19
|
allowClear: {
|
|
20
|
-
true: 'pr-
|
|
21
|
-
}
|
|
20
|
+
true: 'pr-9'
|
|
21
|
+
},
|
|
22
|
+
status: {
|
|
23
|
+
error: 'border-error-500 hover:border-error-400 focus:border-error-500 focus:shadow-[0_0_0_2px_rgba(239,68,68,0.1)]',
|
|
24
|
+
warning: 'border-warning-500 hover:border-warning-400 focus:border-warning-500 focus:shadow-[0_0_0_2px_rgba(249,115,22,0.1)]',
|
|
25
|
+
},
|
|
22
26
|
},
|
|
23
27
|
compoundVariants: [
|
|
24
28
|
{
|
|
@@ -30,6 +34,11 @@ export const styles = tv({
|
|
|
30
34
|
variant: 'filled',
|
|
31
35
|
disabled: true,
|
|
32
36
|
class: 'hover:bg-neutral-token-3'
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
variant: 'borderless',
|
|
40
|
+
disabled: true,
|
|
41
|
+
class: 'hover:bg-transparent'
|
|
33
42
|
}
|
|
34
43
|
],
|
|
35
44
|
defaultVariants: {
|
|
@@ -8,30 +8,31 @@
|
|
|
8
8
|
class: className,
|
|
9
9
|
value = $bindable(),
|
|
10
10
|
ref = $bindable(),
|
|
11
|
-
size,
|
|
11
|
+
size = 'md',
|
|
12
12
|
disabled,
|
|
13
13
|
variant = 'outlined',
|
|
14
14
|
autoSize,
|
|
15
|
-
onchange,
|
|
16
|
-
prefix,
|
|
17
15
|
rows,
|
|
18
16
|
allowClear,
|
|
17
|
+
showCount,
|
|
18
|
+
maxLength,
|
|
19
|
+
status,
|
|
19
20
|
...props
|
|
20
21
|
}: TextAreaProps = $props();
|
|
21
22
|
|
|
23
|
+
let textLength = $derived(value?.length || 0);
|
|
22
24
|
|
|
23
25
|
function createAutoSizeTextarea(node: HTMLTextAreaElement, autoSize?: AutoSizeConfig) {
|
|
24
26
|
if (!autoSize) {
|
|
25
|
-
return
|
|
27
|
+
return;
|
|
26
28
|
}
|
|
27
|
-
let minRows: number | null = null
|
|
28
|
-
let maxRows: number | null = null
|
|
29
|
+
let minRows: number | null = null;
|
|
30
|
+
let maxRows: number | null = null;
|
|
29
31
|
if (autoSize === true) {
|
|
30
|
-
minRows = 1
|
|
32
|
+
minRows = 1;
|
|
31
33
|
} else {
|
|
32
|
-
minRows = Math.max(autoSize.minRows || 0, 1)
|
|
33
|
-
maxRows = autoSize.maxRows || null
|
|
34
|
-
|
|
34
|
+
minRows = Math.max(autoSize.minRows || 0, 1);
|
|
35
|
+
maxRows = autoSize.maxRows || null;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
const updateSize = () => {
|
|
@@ -40,50 +41,55 @@
|
|
|
40
41
|
const borderTopWidth = parseFloat(computedStyle.borderTopWidth);
|
|
41
42
|
const borderBottomWidth = parseFloat(computedStyle.borderBottomWidth);
|
|
42
43
|
const offset = borderTopWidth + borderBottomWidth;
|
|
43
|
-
const scrollHeight = node.scrollHeight + 4
|
|
44
|
+
const scrollHeight = node.scrollHeight + 4;
|
|
44
45
|
|
|
45
46
|
const lineHeight = parseFloat(computedStyle.lineHeight);
|
|
46
|
-
const minHeight = minRows * lineHeight + offset;
|
|
47
|
+
const minHeight = minRows! * lineHeight + offset;
|
|
47
48
|
const maxHeight = maxRows ? maxRows * lineHeight : null;
|
|
48
49
|
|
|
49
50
|
node.style.height = `${Math.max(minHeight, Math.min(scrollHeight, maxHeight ?? scrollHeight))}px`;
|
|
50
51
|
};
|
|
51
52
|
|
|
52
53
|
$effect(() => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
// updateSize();
|
|
56
|
-
|
|
57
|
-
return () => {
|
|
58
|
-
// teardown goes here
|
|
59
|
-
};
|
|
54
|
+
value;
|
|
55
|
+
updateSize();
|
|
60
56
|
});
|
|
61
57
|
}
|
|
62
58
|
|
|
63
59
|
function clearText() {
|
|
64
|
-
value = ''
|
|
60
|
+
value = '';
|
|
61
|
+
ref?.focus();
|
|
65
62
|
}
|
|
66
|
-
|
|
67
|
-
$inspect('text-area', {value})
|
|
68
|
-
|
|
69
63
|
</script>
|
|
70
64
|
|
|
71
|
-
<div class="relative">
|
|
65
|
+
<div class="relative w-full">
|
|
72
66
|
<textarea
|
|
73
67
|
bind:this={ref}
|
|
68
|
+
use:createAutoSizeTextarea={autoSize}
|
|
74
69
|
style={autoSize ? "resize: none;" : ''}
|
|
75
|
-
class={styles({ variant, disabled , size, className, allowClear })}
|
|
70
|
+
class={styles({ variant, disabled , size, className, allowClear, status })}
|
|
76
71
|
{disabled}
|
|
77
72
|
rows={autoSize ? 1 : rows}
|
|
73
|
+
maxlength={maxLength}
|
|
78
74
|
{...props}
|
|
79
75
|
bind:value
|
|
80
76
|
>
|
|
81
77
|
</textarea>
|
|
82
78
|
|
|
83
|
-
{#if allowClear && value}
|
|
84
|
-
<button
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
{#if allowClear && value && !disabled}
|
|
80
|
+
<button
|
|
81
|
+
type="button"
|
|
82
|
+
onclick={clearText}
|
|
83
|
+
class="absolute top-2 right-2 text-neutral-token-7 hover:text-neutral-token-10 transition-colors z-10"
|
|
84
|
+
tabindex="-1"
|
|
85
|
+
>
|
|
86
|
+
<IconX class="size-3.5"/>
|
|
87
87
|
</button>
|
|
88
88
|
{/if}
|
|
89
|
+
|
|
90
|
+
{#if showCount}
|
|
91
|
+
<div class="absolute bottom-1 right-2 text-xs text-neutral-token-7 pointer-events-none">
|
|
92
|
+
{textLength}{#if maxLength}/{maxLength}{/if}
|
|
93
|
+
</div>
|
|
94
|
+
{/if}
|
|
89
95
|
</div>
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { type VariantProps } from "tailwind-variants";
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
2
4
|
import type { UserData } from "../../types/user-data";
|
|
3
5
|
export declare const styles: import("tailwind-variants").TVReturnType<{}, undefined, "", {}, undefined, import("tailwind-variants").TVReturnType<{}, undefined, "", unknown, unknown, undefined>>;
|
|
4
6
|
type UserAvatarWithMenuVariants = VariantProps<typeof styles>;
|
|
5
|
-
export interface UserAvatarWithMenuProps extends UserAvatarWithMenuVariants {
|
|
6
|
-
children?:
|
|
7
|
+
export interface UserAvatarWithMenuProps extends HTMLAttributes<HTMLDivElement>, UserAvatarWithMenuVariants {
|
|
8
|
+
children?: Snippet;
|
|
7
9
|
class?: string;
|
|
8
10
|
user?: UserData;
|
|
9
11
|
onLogout?: () => void;
|
|
12
|
+
ref?: HTMLDivElement | null;
|
|
10
13
|
}
|
|
11
14
|
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -24,3 +24,27 @@ export { Tabs, TabsList, TabsItem, TabsContent } from './components/tabs/index.j
|
|
|
24
24
|
export { TeraUiContext } from './components/tera-ui-context/index.js';
|
|
25
25
|
export { TextArea } from './components/text-area/index.js';
|
|
26
26
|
export { UserAvatarWithMenu } from './components/user-avatar-with-menu/index.js';
|
|
27
|
+
export type { AccordionProps, AccordionItemProps, AccordionContentProps, AccordionTriggerProps } from './components/accordion/index.js';
|
|
28
|
+
export type { AvatarProps } from './components/avatar/index.js';
|
|
29
|
+
export type { BrandLogoProps } from './components/brand-logo/index.js';
|
|
30
|
+
export type { ButtonProps } from './components/button/index.js';
|
|
31
|
+
export type { CheckboxProps } from './components/checkbox/index.js';
|
|
32
|
+
export type { ComboboxProps } from './components/combobox/index.js';
|
|
33
|
+
export type { DialogProps, DialogPropsAstro } from './components/dialog/index.js';
|
|
34
|
+
export type { DropdownMenuProps, DropdownMenuItemProps, DropdownMenuGroupProps, DropdownMenuHeaderProps, DropdownMenuSeparatorProps } from './components/dropdown-menu/index.js';
|
|
35
|
+
export type { HeaderProps } from './components/header/index.js';
|
|
36
|
+
export type { InputProps } from './components/input/index.js';
|
|
37
|
+
export type { LabelProps } from './components/label/index.js';
|
|
38
|
+
export type { LanguagePickerButtonProps } from './components/language-picker-button/index.js';
|
|
39
|
+
export type { LightDarkToggleProps } from './components/light-dark-toggle/index.js';
|
|
40
|
+
export type { PopoverProps } from './components/popover/index.js';
|
|
41
|
+
export type { PopoverResponsiveProps } from './components/popover-responsive/index.js';
|
|
42
|
+
export type { SelectProps } from './components/select/index.js';
|
|
43
|
+
export type { SideNavigationItem, SideNavigationProps } from './components/side-navigation/index.js';
|
|
44
|
+
export type { SliderProps } from './components/slider/index.js';
|
|
45
|
+
export type { StarRatingProps } from './components/star-rating/index.js';
|
|
46
|
+
export type { SwitchProps } from './components/switch/index.js';
|
|
47
|
+
export type { TabsProps, TabsListProps, TabsItemProps, TabsContentProps } from './components/tabs/index.js';
|
|
48
|
+
export type { TeraUiContextProps } from './components/tera-ui-context/index.js';
|
|
49
|
+
export type { TextAreaProps, AutoSizeConfig } from './components/text-area/index.js';
|
|
50
|
+
export type { UserAvatarWithMenuProps } from './components/user-avatar-with-menu/index.js';
|