tera-system-ui 0.1.64 → 0.1.66
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/COMPONENT_API.md +2 -539
- package/dist/components/accordion/Accordion.d.ts +24 -0
- package/dist/components/accordion/Accordion.js +4 -0
- package/dist/components/accordion/components/Accordion.svelte +2 -8
- package/dist/components/accordion/components/AccordionContent.svelte +5 -12
- package/dist/components/accordion/components/AccordionItem.svelte +3 -9
- package/dist/components/accordion/components/AccordionTrigger.svelte +5 -15
- package/dist/components/ai/ChatBubble.svelte +35 -0
- package/dist/components/ai/ChatBubble.svelte.d.ts +12 -0
- package/dist/components/ai/PromptInput.svelte +58 -0
- package/dist/components/ai/PromptInput.svelte.d.ts +13 -0
- package/dist/components/ai/StreamText.svelte +41 -0
- package/dist/components/ai/StreamText.svelte.d.ts +11 -0
- package/dist/components/ai/SuggestionChips.svelte +34 -0
- package/dist/components/ai/SuggestionChips.svelte.d.ts +10 -0
- package/dist/components/ai/ThinkingLoader.svelte +34 -0
- package/dist/components/ai/ThinkingLoader.svelte.d.ts +11 -0
- package/dist/components/ai/index.d.ts +5 -0
- package/dist/components/ai/index.js +5 -0
- package/dist/components/alert/Alert.svelte +47 -0
- package/dist/components/alert/Alert.svelte.d.ts +15 -0
- package/dist/components/alert/index.d.ts +1 -0
- package/dist/components/alert/index.js +1 -0
- package/dist/components/avatar/Avatar.svelte +9 -25
- package/dist/components/badge/Badge.d.ts +52 -0
- package/dist/components/badge/Badge.js +22 -0
- package/dist/components/badge/Badge.svelte +22 -0
- package/dist/components/badge/Badge.svelte.d.ts +4 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/index.js +1 -0
- package/dist/components/brand-logo/BrandLogo.svelte +12 -10
- package/dist/components/button/Button.d.ts +2 -2
- package/dist/components/button/Button.js +12 -12
- package/dist/components/button/Button.svelte +7 -34
- package/dist/components/card/Card.d.ts +68 -0
- package/dist/components/card/Card.js +28 -0
- package/dist/components/card/Card.svelte +33 -0
- package/dist/components/card/Card.svelte.d.ts +4 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/index.js +1 -0
- package/dist/components/checkbox/Checkbox.d.ts +25 -4
- package/dist/components/checkbox/Checkbox.js +4 -0
- package/dist/components/checkbox/Checkbox.svelte +13 -16
- package/dist/components/checkbox/Checkbox.svelte.d.ts +2 -2
- package/dist/components/combobox/Combobox.d.ts +45 -9
- package/dist/components/combobox/Combobox.js +5 -7
- package/dist/components/combobox/Combobox.svelte +226 -8
- package/dist/components/combobox/Combobox.svelte.d.ts +2 -2
- package/dist/components/combobox/index.d.ts +1 -1
- package/dist/components/command/components/command-empty.svelte +3 -8
- package/dist/components/command/components/command-group.svelte +3 -13
- package/dist/components/command/components/command-input.svelte +5 -13
- package/dist/components/command/components/command-item.svelte +3 -9
- package/dist/components/command/components/command-link-item.svelte +3 -8
- package/dist/components/command/components/command-list.svelte +3 -8
- package/dist/components/command/components/command-separator.svelte +3 -8
- package/dist/components/command/components/command-shortcut.svelte +2 -10
- package/dist/components/command/components/command.svelte +29 -42
- package/dist/components/date-range-picker/DateRangePicker.svelte +490 -0
- package/dist/components/date-range-picker/DateRangePicker.svelte.d.ts +4 -0
- package/dist/components/date-range-picker/DateRangePicker.types.d.ts +38 -0
- package/dist/components/date-range-picker/DateRangePicker.types.js +1 -0
- package/dist/components/date-range-picker/index.d.ts +2 -0
- package/dist/components/date-range-picker/index.js +1 -0
- package/dist/components/dialog/Dialog.d.ts +43 -121
- package/dist/components/dialog/Dialog.js +1 -39
- package/dist/components/dialog/Dialog.svelte +103 -113
- package/dist/components/dialog/Dialog.svelte.d.ts +1 -2
- package/dist/components/dialog/dialog.scss +21 -24
- package/dist/components/drawer/Drawer.svelte +63 -0
- package/dist/components/drawer/Drawer.svelte.d.ts +16 -0
- package/dist/components/drawer/index.d.ts +1 -0
- package/dist/components/drawer/index.js +1 -0
- package/dist/components/dropdown-menu/DropdownMenu.d.ts +51 -24
- package/dist/components/dropdown-menu/DropdownMenu.js +1 -15
- package/dist/components/dropdown-menu/components/DropdownMenu.svelte +36 -34
- package/dist/components/dropdown-menu/components/DropdownMenu.svelte.d.ts +1 -1
- package/dist/components/dropdown-menu/components/DropdownMenuGroup.svelte +8 -12
- package/dist/components/dropdown-menu/components/DropdownMenuGroup.svelte.d.ts +2 -4
- package/dist/components/dropdown-menu/components/DropdownMenuHeader.svelte +11 -12
- package/dist/components/dropdown-menu/components/DropdownMenuHeader.svelte.d.ts +2 -4
- package/dist/components/dropdown-menu/components/DropdownMenuItem.svelte +27 -30
- package/dist/components/dropdown-menu/components/DropdownMenuItem.svelte.d.ts +1 -1
- package/dist/components/dropdown-menu/components/DropdownMenuSeparator.svelte +9 -11
- package/dist/components/dropdown-menu/components/DropdownMenuSeparator.svelte.d.ts +2 -4
- package/dist/components/fonts/TeraFontMono.svelte +4 -4
- package/dist/components/fonts/TeraFontMono.svelte.d.ts +1 -0
- package/dist/components/fonts/TeraFontSansSerif.svelte +4 -4
- package/dist/components/fonts/TeraFontSansSerif.svelte.d.ts +1 -1
- package/dist/components/header/Header.svelte +6 -9
- package/dist/components/header/header.scss +1 -1
- package/dist/components/icons/IconArrowBigRightFilled.svelte +3 -7
- package/dist/components/icons/IconBook.svelte +3 -6
- package/dist/components/icons/IconBookmarkPlus.svelte +3 -6
- package/dist/components/icons/IconCalculator.svelte +3 -6
- package/dist/components/icons/IconCheck.svelte +3 -6
- package/dist/components/icons/IconChevronDown.svelte +3 -6
- package/dist/components/icons/IconCoin.svelte +3 -6
- package/dist/components/icons/IconCoinConvert.svelte +2 -5
- package/dist/components/icons/IconCopy.svelte +3 -6
- package/dist/components/icons/IconCopyCheckFilled.svelte +3 -6
- package/dist/components/icons/IconHamburger.svelte +3 -6
- package/dist/components/icons/IconLanguage.svelte +3 -6
- package/dist/components/icons/IconLoader2.svelte +3 -6
- package/dist/components/icons/IconLogout.svelte +3 -6
- package/dist/components/icons/IconMoon.svelte +3 -6
- package/dist/components/icons/IconPointFilled.svelte +3 -6
- package/dist/components/icons/IconSearch.svelte +3 -6
- package/dist/components/icons/IconSettings.svelte +3 -6
- package/dist/components/icons/IconSun.svelte +3 -6
- package/dist/components/icons/IconSwitchHorizontal.svelte +3 -6
- package/dist/components/icons/IconSwitchVertical.svelte +3 -6
- package/dist/components/icons/IconTransform.svelte +3 -6
- package/dist/components/icons/IconX.svelte +3 -6
- package/dist/components/input/Input.d.ts +2 -2
- package/dist/components/input/Input.js +10 -10
- package/dist/components/input/Input.svelte +10 -26
- package/dist/components/label/Label.d.ts +2 -2
- package/dist/components/label/Label.js +2 -2
- package/dist/components/label/Label.svelte +4 -12
- package/dist/components/language-picker-button/LanguagePickerButton.svelte +23 -42
- package/dist/components/light-dark-toggle/LightDarkToggle.svelte +21 -26
- package/dist/components/marketing/FeatureCard.svelte +37 -0
- package/dist/components/marketing/FeatureCard.svelte.d.ts +13 -0
- package/dist/components/marketing/PricingCard.svelte +48 -0
- package/dist/components/marketing/PricingCard.svelte.d.ts +15 -0
- package/dist/components/marketing/StatBlock.svelte +14 -0
- package/dist/components/marketing/StatBlock.svelte.d.ts +10 -0
- package/dist/components/marketing/TestimonialCard.svelte +24 -0
- package/dist/components/marketing/TestimonialCard.svelte.d.ts +12 -0
- package/dist/components/marketing/index.d.ts +4 -0
- package/dist/components/marketing/index.js +4 -0
- package/dist/components/popover/Popover.d.ts +32 -13
- package/dist/components/popover/Popover.js +1 -7
- package/dist/components/popover/Popover.svelte +40 -158
- package/dist/components/popover/Popover.svelte.d.ts +2 -2
- package/dist/components/popover-responsive/PopoverResponsive.d.ts +18 -7
- package/dist/components/popover-responsive/PopoverResponsive.js +1 -7
- package/dist/components/popover-responsive/PopoverResponsive.svelte +25 -87
- package/dist/components/popover-responsive/PopoverResponsive.svelte.d.ts +2 -11
- package/dist/components/select/Select.d.ts +60 -23
- package/dist/components/select/Select.js +14 -35
- package/dist/components/select/Select.svelte +157 -28
- package/dist/components/select/Select.svelte.d.ts +2 -3
- package/dist/components/select/index.d.ts +1 -1
- package/dist/components/side-navigation/SideNavigation.svelte +73 -96
- package/dist/components/side-navigation/SideNavigationItem.svelte +2 -2
- package/dist/components/side-navigation/SideNavigationLayout.svelte +3 -5
- package/dist/components/side-navigation/sidenav.scss +17 -13
- package/dist/components/skeleton/Skeleton.svelte +48 -0
- package/dist/components/skeleton/Skeleton.svelte.d.ts +12 -0
- package/dist/components/skeleton/index.d.ts +1 -0
- package/dist/components/skeleton/index.js +1 -0
- package/dist/components/slider/Slider.d.ts +25 -15
- package/dist/components/slider/Slider.js +1 -7
- package/dist/components/slider/Slider.svelte +38 -164
- package/dist/components/slider/Slider.svelte.d.ts +1 -1
- package/dist/components/spinner/Spinner.svelte +39 -0
- package/dist/components/spinner/Spinner.svelte.d.ts +10 -0
- package/dist/components/spinner/index.d.ts +1 -0
- package/dist/components/spinner/index.js +1 -0
- package/dist/components/star-rating/StarRating.svelte +33 -49
- package/dist/components/switch/Switch.d.ts +19 -4
- package/dist/components/switch/Switch.js +4 -0
- package/dist/components/switch/Switch.svelte +13 -17
- package/dist/components/switch/Switch.svelte.d.ts +2 -2
- package/dist/components/table/Table.svelte +68 -0
- package/dist/components/table/Table.svelte.d.ts +40 -0
- package/dist/components/table/index.d.ts +1 -0
- package/dist/components/table/index.js +1 -0
- package/dist/components/tabs/Tabs.svelte.d.ts +45 -16
- package/dist/components/tabs/Tabs.svelte.js +8 -18
- package/dist/components/tabs/components/Tabs.svelte +27 -33
- package/dist/components/tabs/components/Tabs.svelte.d.ts +1 -1
- package/dist/components/tabs/components/TabsContent.svelte +13 -36
- package/dist/components/tabs/components/TabsContent.svelte.d.ts +2 -5
- package/dist/components/tabs/components/TabsItem.svelte +43 -32
- package/dist/components/tabs/components/TabsItem.svelte.d.ts +2 -5
- package/dist/components/tabs/components/TabsList.svelte +90 -58
- package/dist/components/tabs/components/TabsList.svelte.d.ts +2 -4
- package/dist/components/tera-ui-context/TeraUiContext.svelte +13 -26
- package/dist/components/text-area/TextArea.d.ts +2 -2
- package/dist/components/text-area/TextArea.js +9 -9
- package/dist/components/text-area/TextArea.svelte +41 -65
- package/dist/components/toast/ToastContainer.svelte +50 -0
- package/dist/components/toast/ToastContainer.svelte.d.ts +18 -0
- package/dist/components/toast/index.d.ts +3 -0
- package/dist/components/toast/index.js +2 -0
- package/dist/components/toast/toast.svelte.d.ts +22 -0
- package/dist/components/toast/toast.svelte.js +18 -0
- package/dist/components/tooltip/Tooltip.d.ts +23 -0
- package/dist/components/tooltip/Tooltip.js +1 -0
- package/dist/components/tooltip/Tooltip.svelte +30 -0
- package/dist/components/tooltip/Tooltip.svelte.d.ts +4 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/components/user-avatar-with-menu/UserAvatarWithMenu.svelte +48 -69
- package/dist/index.d.ts +19 -2
- package/dist/index.js +12 -0
- package/dist/llms/accordion.md +90 -0
- package/dist/llms/ai.md +110 -0
- package/dist/llms/alert.md +29 -0
- package/dist/llms/avatar.md +34 -0
- package/dist/llms/badge.md +31 -0
- package/dist/llms/brand-logo.md +30 -0
- package/dist/llms/button.md +37 -0
- package/dist/llms/card.md +32 -0
- package/dist/llms/checkbox.md +35 -0
- package/dist/llms/colors.md +161 -0
- package/dist/llms/combobox.md +40 -0
- package/dist/llms/command.md +7 -0
- package/dist/llms/date-range-picker.md +36 -0
- package/dist/llms/dialog.md +45 -0
- package/dist/llms/drawer.md +30 -0
- package/dist/llms/dropdown-menu.md +112 -0
- package/dist/llms/fonts.md +7 -0
- package/dist/llms/header.md +26 -0
- package/dist/llms/icons.md +43 -0
- package/dist/llms/index.md +65 -0
- package/dist/llms/input.md +37 -0
- package/dist/llms/label.md +30 -0
- package/dist/llms/language-picker-button.md +30 -0
- package/dist/llms/light-dark-toggle.md +26 -0
- package/dist/llms/marketing.md +95 -0
- package/dist/llms/popover-responsive.md +32 -0
- package/dist/llms/popover.md +40 -0
- package/dist/llms/select.md +44 -0
- package/dist/llms/side-navigation.md +30 -0
- package/dist/llms/skeleton.md +28 -0
- package/dist/llms/slider.md +36 -0
- package/dist/llms/spinner.md +25 -0
- package/dist/llms/star-rating.md +31 -0
- package/dist/llms/switch.md +33 -0
- package/dist/llms/table.md +30 -0
- package/dist/llms/tabs.md +92 -0
- package/dist/llms/tera-ui-context.md +30 -0
- package/dist/llms/text-area.md +39 -0
- package/dist/llms/toast.md +7 -0
- package/dist/llms/tooltip.md +32 -0
- package/dist/llms/user-avatar-with-menu.md +28 -0
- package/dist/paraglide/README.md +72 -3
- package/dist/paraglide/messages/text_account_settings.d.ts +14 -2
- package/dist/paraglide/messages/text_account_settings.js +53 -58
- package/dist/paraglide/messages/text_calces_documentation.d.ts +14 -2
- package/dist/paraglide/messages/text_calces_documentation.js +53 -58
- package/dist/paraglide/messages/text_calces_scientific_calculator.d.ts +14 -2
- package/dist/paraglide/messages/text_calces_scientific_calculator.js +53 -58
- package/dist/paraglide/messages/text_currency_converter.d.ts +14 -2
- package/dist/paraglide/messages/text_currency_converter.js +53 -58
- package/dist/paraglide/messages/text_logout.d.ts +14 -2
- package/dist/paraglide/messages/text_logout.js +53 -58
- package/dist/paraglide/messages/text_select_language.d.ts +14 -2
- package/dist/paraglide/messages/text_select_language.js +53 -58
- package/dist/paraglide/messages/text_unit_converter.d.ts +14 -2
- package/dist/paraglide/messages/text_unit_converter.js +53 -58
- package/dist/paraglide/registry.d.ts +13 -0
- package/dist/paraglide/registry.js +15 -0
- package/dist/paraglide/runtime.d.ts +243 -126
- package/dist/paraglide/runtime.js +473 -148
- package/dist/paraglide/server.d.ts +13 -20
- package/dist/paraglide/server.js +92 -40
- package/dist/stories/ComponentOverview.stories.svelte +533 -0
- package/dist/stories/ComponentOverview.stories.svelte.d.ts +6 -0
- package/dist/themes/tera-ui-base.css +242 -77
- package/dist/themes/theme-ai.css +100 -0
- package/dist/themes/theme-marketing.css +91 -0
- package/dist/themes/theme-professional.css +41 -0
- package/package.json +35 -29
- package/dist/tera-i18n/projects/tera-system-ui/project.inlang/.meta.json +0 -3
- package/dist/tera-i18n/projects/tera-system-ui/project.inlang/README.md +0 -103
- package/dist/tera-i18n/projects/tera-system-ui/project.inlang/project_id +0 -1
- package/dist/themes/tw-preset.cjs +0 -160
- package/dist/themes/tw-preset.d.cts +0 -157
|
@@ -1,19 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @component Tabs - Tabbed content panels with line and iOS segmented variants.
|
|
3
|
+
* Parts: Tabs, TabsList, TabsItem, TabsContent.
|
|
4
|
+
* Built on BitsUI Tabs primitive.
|
|
5
|
+
*/
|
|
1
6
|
import { getContext, setContext } from "svelte";
|
|
2
|
-
const
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
setContext(CONTEXT_KEY, {
|
|
6
|
-
get currentTab() {
|
|
7
|
-
return currentTab;
|
|
8
|
-
},
|
|
9
|
-
set currentTab(value) {
|
|
10
|
-
if (currentTab !== value) {
|
|
11
|
-
currentTab = value;
|
|
12
|
-
props.onchange?.(value);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
export function getCtx() {
|
|
18
|
-
return getContext(CONTEXT_KEY);
|
|
19
|
-
}
|
|
7
|
+
const TABS_CTX = 'tera-tabs-ctx';
|
|
8
|
+
export const setTabsContext = (ctx) => setContext(TABS_CTX, ctx);
|
|
9
|
+
export const getTabsContext = () => getContext(TABS_CTX) ?? { variant: 'line', orientation: 'horizontal' };
|
|
@@ -1,33 +1,27 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</script>
|
|
29
|
-
|
|
30
|
-
<div data-tabs-root
|
|
31
|
-
class={cn("grid grid-rows-[auto_1fr] max-h-full gap-2", className)}>
|
|
32
|
-
{@render children?.()}
|
|
33
|
-
</div>
|
|
1
|
+
<script lang="ts">import { Tabs as TabsPrimitive } from 'bits-ui';
|
|
2
|
+
import { cn } from '../../../utils/utils.js';
|
|
3
|
+
import { setTabsContext } from '../Tabs.svelte.js';
|
|
4
|
+
let { children, value = $bindable(null), class: className, variant = 'line', onchange, activationMode, orientation = 'horizontal', loop, ...props } = $props();
|
|
5
|
+
// Pass getter objects so consumers read the current value reactively
|
|
6
|
+
setTabsContext({
|
|
7
|
+
get variant() { return variant; },
|
|
8
|
+
get orientation() { return orientation; }
|
|
9
|
+
});
|
|
10
|
+
const isVertical = $derived(orientation === 'vertical');
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<TabsPrimitive.Root
|
|
14
|
+
bind:value
|
|
15
|
+
onValueChange={onchange}
|
|
16
|
+
{activationMode}
|
|
17
|
+
{orientation}
|
|
18
|
+
{loop}
|
|
19
|
+
class={cn(
|
|
20
|
+
isVertical ? 'grid grid-cols-[auto_1fr]' : 'grid grid-rows-[auto_1fr]',
|
|
21
|
+
'max-h-full gap-2',
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
{...props}
|
|
25
|
+
>
|
|
26
|
+
{@render children?.()}
|
|
27
|
+
</TabsPrimitive.Root>
|
|
@@ -1,36 +1,13 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
$effect(() => {
|
|
15
|
-
// console.log(context.state.currentTab)
|
|
16
|
-
})
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<div
|
|
20
|
-
role="tabpanel"
|
|
21
|
-
data-value={value}
|
|
22
|
-
data-state={context.currentTab === value ? 'active' : 'inactive'}
|
|
23
|
-
class={cn("bg-neutral-token-1 overflow-auto", className)}>
|
|
24
|
-
{@render children?.()}
|
|
25
|
-
</div>
|
|
26
|
-
|
|
27
|
-
<style>
|
|
28
|
-
[data-state="active"] {
|
|
29
|
-
display: block;
|
|
30
|
-
}
|
|
31
|
-
[data-state="inactive"] {
|
|
32
|
-
display: none;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
</style>
|
|
36
|
-
|
|
1
|
+
<script lang="ts">import { Tabs as TabsPrimitive } from 'bits-ui';
|
|
2
|
+
import { cn } from '../../../utils/utils.js';
|
|
3
|
+
let { children, class: className, value, ref = $bindable(null), ...props } = $props();
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<TabsPrimitive.Content
|
|
7
|
+
bind:ref
|
|
8
|
+
{value}
|
|
9
|
+
class={cn('overflow-auto', className)}
|
|
10
|
+
{...props}
|
|
11
|
+
>
|
|
12
|
+
{@render children?.()}
|
|
13
|
+
</TabsPrimitive.Content>
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
class: any;
|
|
4
|
-
value: any;
|
|
5
|
-
} & Record<string, any>, {}, "">;
|
|
1
|
+
import type { TabsContentProps } from '../Tabs.svelte.js';
|
|
2
|
+
declare const TabsContent: import("svelte").Component<TabsContentProps, {}, "ref">;
|
|
6
3
|
type TabsContent = ReturnType<typeof TabsContent>;
|
|
7
4
|
export default TabsContent;
|
|
@@ -1,32 +1,43 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
>
|
|
24
|
-
{@render children?.()}
|
|
25
|
-
</
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
<script lang="ts">import { Tabs as TabsPrimitive } from 'bits-ui';
|
|
2
|
+
import { cn } from '../../../utils/utils.js';
|
|
3
|
+
import { getTabsContext } from '../Tabs.svelte.js';
|
|
4
|
+
let { children, class: className, value, ref = $bindable(null), ...props } = $props();
|
|
5
|
+
const ctx = getTabsContext();
|
|
6
|
+
const variant = $derived(ctx.variant);
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
{#if variant === 'ios'}
|
|
10
|
+
<!-- iOS: flex-1 equal width, no bg hover (pill handles visual feedback) -->
|
|
11
|
+
<TabsPrimitive.Trigger
|
|
12
|
+
bind:ref
|
|
13
|
+
{value}
|
|
14
|
+
class={cn(
|
|
15
|
+
'relative z-10 flex-1 px-4 py-1.5 text-sm font-semibold text-center rounded-full select-none',
|
|
16
|
+
'text-text-secondary',
|
|
17
|
+
'data-[state=active]:text-text-primary',
|
|
18
|
+
'transition-colors ease-ui duration-150',
|
|
19
|
+
'outline-none focus-visible:shadow-focus',
|
|
20
|
+
className
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
>
|
|
24
|
+
{@render children?.()}
|
|
25
|
+
</TabsPrimitive.Trigger>
|
|
26
|
+
{:else}
|
|
27
|
+
<!-- Default line style -->
|
|
28
|
+
<TabsPrimitive.Trigger
|
|
29
|
+
bind:ref
|
|
30
|
+
{value}
|
|
31
|
+
class={cn(
|
|
32
|
+
'tab-button font-semibold px-2.5 py-1.5 rounded',
|
|
33
|
+
'text-text-secondary hover:text-primary-token-4 hover:bg-surface-hover',
|
|
34
|
+
'transition-[color,background-color] ease-ui duration-150',
|
|
35
|
+
'data-[state=active]:text-primary-token-7',
|
|
36
|
+
'outline-none focus-visible:shadow-focus',
|
|
37
|
+
className
|
|
38
|
+
)}
|
|
39
|
+
{...props}
|
|
40
|
+
>
|
|
41
|
+
{@render children?.()}
|
|
42
|
+
</TabsPrimitive.Trigger>
|
|
43
|
+
{/if}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
class: any;
|
|
4
|
-
value: any;
|
|
5
|
-
} & Record<string, any>, {}, "">;
|
|
1
|
+
import { type TabsItemProps } from '../Tabs.svelte.js';
|
|
2
|
+
declare const TabsItem: import("svelte").Component<TabsItemProps, {}, "ref">;
|
|
6
3
|
type TabsItem = ReturnType<typeof TabsItem>;
|
|
7
4
|
export default TabsItem;
|
|
@@ -1,58 +1,90 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
tabIndicator.style.left = `${left}px`;
|
|
27
|
-
tabIndicator.style.width = `${width}px`;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
</script>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
1
|
+
<script lang="ts">import { Tabs as TabsPrimitive } from 'bits-ui';
|
|
2
|
+
import { cn } from '../../../utils/utils.js';
|
|
3
|
+
import { getTabsContext } from '../Tabs.svelte.js';
|
|
4
|
+
let { children, class: className, ref = $bindable(null), ...props } = $props();
|
|
5
|
+
const ctx = getTabsContext();
|
|
6
|
+
const variant = $derived(ctx.variant);
|
|
7
|
+
const orientation = $derived(ctx.orientation);
|
|
8
|
+
const isVertical = $derived(orientation === 'vertical');
|
|
9
|
+
let tabsList = $state(null);
|
|
10
|
+
let tabIndicator = $state(null);
|
|
11
|
+
function updateIndicator() {
|
|
12
|
+
if (!tabsList || !tabIndicator)
|
|
13
|
+
return;
|
|
14
|
+
const active = tabsList.querySelector('[data-state="active"]');
|
|
15
|
+
if (!active)
|
|
16
|
+
return;
|
|
17
|
+
const containerRect = tabsList.getBoundingClientRect();
|
|
18
|
+
const rect = active.getBoundingClientRect();
|
|
19
|
+
if (isVertical) {
|
|
20
|
+
tabIndicator.style.top = `${rect.top - containerRect.top}px`;
|
|
21
|
+
tabIndicator.style.height = `${rect.height}px`;
|
|
22
|
+
tabIndicator.style.left = '';
|
|
23
|
+
tabIndicator.style.width = '';
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
tabIndicator.style.left = `${rect.left - containerRect.left}px`;
|
|
27
|
+
tabIndicator.style.width = `${rect.width}px`;
|
|
28
|
+
tabIndicator.style.top = '';
|
|
29
|
+
tabIndicator.style.height = '';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
$effect(() => {
|
|
33
|
+
if (!tabsList)
|
|
34
|
+
return;
|
|
35
|
+
// Initial position (rAF lets the browser settle before measuring)
|
|
36
|
+
requestAnimationFrame(updateIndicator);
|
|
37
|
+
// React to BitsUI's data-state attribute changes on trigger buttons
|
|
38
|
+
const mo = new MutationObserver(() => requestAnimationFrame(updateIndicator));
|
|
39
|
+
mo.observe(tabsList, { attributes: true, attributeFilter: ['data-state'], subtree: true });
|
|
40
|
+
// Reposition on container resize (e.g. responsive layout shift)
|
|
41
|
+
const ro = new ResizeObserver(() => requestAnimationFrame(updateIndicator));
|
|
42
|
+
ro.observe(tabsList);
|
|
43
|
+
return () => {
|
|
44
|
+
mo.disconnect();
|
|
45
|
+
ro.disconnect();
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
{#if variant === 'ios'}
|
|
51
|
+
<!-- iOS segmented control: gray pill container, sliding white background — horizontal only -->
|
|
52
|
+
<TabsPrimitive.List
|
|
53
|
+
bind:ref={tabsList}
|
|
54
|
+
class={cn('relative flex bg-neutral-token-3 p-1 rounded-full', className)}
|
|
55
|
+
{...props}
|
|
56
|
+
>
|
|
57
|
+
{@render children?.()}
|
|
58
|
+
<!-- Sliding white pill (background layer) -->
|
|
59
|
+
<div
|
|
60
|
+
bind:this={tabIndicator}
|
|
61
|
+
class="absolute inset-y-1 rounded-full bg-surface shadow-sm transition-[left,width] duration-200 ease-spring pointer-events-none"
|
|
62
|
+
></div>
|
|
63
|
+
</TabsPrimitive.List>
|
|
64
|
+
{:else if isVertical}
|
|
65
|
+
<!-- Vertical line style: right-side accent bar indicator -->
|
|
66
|
+
<TabsPrimitive.List
|
|
67
|
+
bind:ref={tabsList}
|
|
68
|
+
class={cn('relative flex flex-col gap-1 border-r border-border-default', className)}
|
|
69
|
+
{...props}
|
|
70
|
+
>
|
|
71
|
+
{@render children?.()}
|
|
72
|
+
<div
|
|
73
|
+
bind:this={tabIndicator}
|
|
74
|
+
class="absolute right-0 w-0.5 rounded-full bg-primary-token-5 transition-[top,height] duration-150 ease-ui pointer-events-none"
|
|
75
|
+
></div>
|
|
76
|
+
</TabsPrimitive.List>
|
|
77
|
+
{:else}
|
|
78
|
+
<!-- Default horizontal line style: underline indicator -->
|
|
79
|
+
<TabsPrimitive.List
|
|
80
|
+
bind:ref={tabsList}
|
|
81
|
+
class={cn('relative flex gap-2 items-end border-b border-border-default', className)}
|
|
82
|
+
{...props}
|
|
83
|
+
>
|
|
84
|
+
{@render children?.()}
|
|
85
|
+
<div
|
|
86
|
+
bind:this={tabIndicator}
|
|
87
|
+
class="absolute bottom-0 h-0.5 rounded-full bg-primary-token-5 transition-[left,width] duration-150 ease-ui pointer-events-none"
|
|
88
|
+
></div>
|
|
89
|
+
</TabsPrimitive.List>
|
|
90
|
+
{/if}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
class: any;
|
|
4
|
-
} & Record<string, any>, {}, "">;
|
|
1
|
+
import { type TabsListProps } from '../Tabs.svelte.js';
|
|
2
|
+
declare const TabsList: import("svelte").Component<TabsListProps, {}, "ref">;
|
|
5
3
|
type TabsList = ReturnType<typeof TabsList>;
|
|
6
4
|
export default TabsList;
|
|
@@ -1,26 +1,13 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
language,
|
|
15
|
-
...props
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
// console.log('tera-system-ui', 'TeraUIContext props', {
|
|
19
|
-
// supportLanguages,
|
|
20
|
-
// language,
|
|
21
|
-
// ...props
|
|
22
|
-
// })
|
|
23
|
-
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
{@render children()}
|
|
1
|
+
<script lang="ts">import { untrack } from 'svelte';
|
|
2
|
+
import {} from "./TeraUiContext";
|
|
3
|
+
import { setGlobalContext } from "./global-context";
|
|
4
|
+
let { children, supportLanguages = ['en'], language = 'en', ...props } = $props();
|
|
5
|
+
// setContext must be called once during init — untrack signals this is intentional
|
|
6
|
+
setGlobalContext(untrack(() => ({
|
|
7
|
+
supportLanguages,
|
|
8
|
+
language,
|
|
9
|
+
...props
|
|
10
|
+
})));
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
{@render children()}
|
|
@@ -23,7 +23,7 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
|
23
23
|
error: string;
|
|
24
24
|
warning: string;
|
|
25
25
|
};
|
|
26
|
-
}, undefined, "w-full inline-flex items-start rounded-md outline-none font-normal text-
|
|
26
|
+
}, undefined, "w-full inline-flex items-start rounded-md outline-none font-normal text-text-primary placeholder:text-text-tertiary resize-y transition-[border-color,box-shadow,background-color,height] ease-ui duration-150", {
|
|
27
27
|
variant: {
|
|
28
28
|
outlined: string;
|
|
29
29
|
filled: string;
|
|
@@ -67,7 +67,7 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
|
67
67
|
error: string;
|
|
68
68
|
warning: string;
|
|
69
69
|
};
|
|
70
|
-
}, undefined, "w-full inline-flex items-start rounded-md outline-none font-normal text-
|
|
70
|
+
}, undefined, "w-full inline-flex items-start rounded-md outline-none font-normal text-text-primary placeholder:text-text-tertiary resize-y transition-[border-color,box-shadow,background-color,height] ease-ui duration-150", unknown, unknown, undefined>>;
|
|
71
71
|
type TextAreaVariants = VariantProps<typeof styles>;
|
|
72
72
|
export type AutoSizeConfig = boolean | {
|
|
73
73
|
minRows?: number;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { tv } from "tailwind-variants";
|
|
2
2
|
export const styles = tv({
|
|
3
|
-
base: 'w-full inline-flex items-start rounded-md outline-none font-normal text-
|
|
3
|
+
base: 'w-full inline-flex items-start rounded-md outline-none font-normal text-text-primary placeholder:text-text-tertiary resize-y transition-[border-color,box-shadow,background-color,height] ease-ui duration-150',
|
|
4
4
|
variants: {
|
|
5
5
|
variant: {
|
|
6
|
-
outlined: 'border border-
|
|
7
|
-
filled: 'bg-
|
|
8
|
-
borderless: 'bg-transparent border-0 hover:bg-
|
|
6
|
+
outlined: 'border border-border-default bg-surface hover:border-interactive focus:border-interactive-hover focus:shadow-focus',
|
|
7
|
+
filled: 'bg-surface-sunken border border-transparent hover:bg-surface-hover focus:bg-surface focus:border-interactive-hover focus:shadow-focus',
|
|
8
|
+
borderless: 'bg-transparent border-0 hover:bg-surface-raised focus:bg-surface-raised',
|
|
9
9
|
},
|
|
10
10
|
disabled: {
|
|
11
|
-
true: 'cursor-not-allowed bg-
|
|
11
|
+
true: 'cursor-not-allowed bg-surface-sunken text-text-disabled border-border-default resize-none',
|
|
12
12
|
false: 'cursor-text',
|
|
13
13
|
},
|
|
14
14
|
size: {
|
|
@@ -20,20 +20,20 @@ export const styles = tv({
|
|
|
20
20
|
true: 'pr-9'
|
|
21
21
|
},
|
|
22
22
|
status: {
|
|
23
|
-
error: 'border-error-
|
|
24
|
-
warning: 'border-warning-
|
|
23
|
+
error: 'border-error-default hover:border-error-hover focus:border-error-default focus:shadow-focus-error',
|
|
24
|
+
warning: 'border-warning-default hover:border-warning-hover focus:border-warning-default focus:shadow-focus-warning',
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
compoundVariants: [
|
|
28
28
|
{
|
|
29
29
|
variant: 'outlined',
|
|
30
30
|
disabled: true,
|
|
31
|
-
class: 'hover:border-
|
|
31
|
+
class: 'hover:border-border-default'
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
variant: 'filled',
|
|
35
35
|
disabled: true,
|
|
36
|
-
class: 'hover:bg-
|
|
36
|
+
class: 'hover:bg-surface-sunken'
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
variant: 'borderless',
|
|
@@ -1,80 +1,56 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const computedStyle = window.getComputedStyle(node);
|
|
41
|
-
const borderTopWidth = parseFloat(computedStyle.borderTopWidth);
|
|
42
|
-
const borderBottomWidth = parseFloat(computedStyle.borderBottomWidth);
|
|
43
|
-
const offset = borderTopWidth + borderBottomWidth;
|
|
44
|
-
const scrollHeight = node.scrollHeight + 4;
|
|
45
|
-
|
|
46
|
-
const lineHeight = parseFloat(computedStyle.lineHeight);
|
|
47
|
-
const minHeight = minRows! * lineHeight + offset;
|
|
48
|
-
const maxHeight = maxRows ? maxRows * lineHeight : null;
|
|
49
|
-
|
|
50
|
-
node.style.height = `${Math.max(minHeight, Math.min(scrollHeight, maxHeight ?? scrollHeight))}px`;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
$effect(() => {
|
|
54
|
-
value;
|
|
55
|
-
updateSize();
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function clearText() {
|
|
60
|
-
value = '';
|
|
61
|
-
ref?.focus();
|
|
62
|
-
}
|
|
1
|
+
<script lang="ts">import {} from "./TextArea";
|
|
2
|
+
import { styles } from "./TextArea";
|
|
3
|
+
import { IconX } from "../icons";
|
|
4
|
+
let { children, class: className, value = $bindable(), ref = $bindable(), size = 'md', disabled, variant = 'outlined', autoSize, rows, allowClear, showCount, maxLength, status, ...props } = $props();
|
|
5
|
+
let textLength = $derived(value?.length || 0);
|
|
6
|
+
function createAutoSizeTextarea(node, autoSize) {
|
|
7
|
+
if (!autoSize) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
let minRows = null;
|
|
11
|
+
let maxRows = null;
|
|
12
|
+
if (autoSize === true) {
|
|
13
|
+
minRows = 1;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
minRows = Math.max(autoSize.minRows || 0, 1);
|
|
17
|
+
maxRows = autoSize.maxRows || null;
|
|
18
|
+
}
|
|
19
|
+
const updateSize = () => {
|
|
20
|
+
node.style.height = 'auto';
|
|
21
|
+
const computedStyle = window.getComputedStyle(node);
|
|
22
|
+
const borderTopWidth = parseFloat(computedStyle.borderTopWidth);
|
|
23
|
+
const borderBottomWidth = parseFloat(computedStyle.borderBottomWidth);
|
|
24
|
+
const offset = borderTopWidth + borderBottomWidth;
|
|
25
|
+
const scrollHeight = node.scrollHeight;
|
|
26
|
+
const lineHeight = parseFloat(computedStyle.lineHeight);
|
|
27
|
+
const minHeight = minRows * lineHeight + offset;
|
|
28
|
+
const maxHeight = maxRows ? maxRows * lineHeight : null;
|
|
29
|
+
node.style.height = `${Math.max(minHeight, Math.min(scrollHeight, maxHeight ?? scrollHeight))}px`;
|
|
30
|
+
};
|
|
31
|
+
$effect(() => {
|
|
32
|
+
value;
|
|
33
|
+
updateSize();
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function clearText() {
|
|
37
|
+
value = '';
|
|
38
|
+
ref?.focus();
|
|
39
|
+
}
|
|
63
40
|
</script>
|
|
64
41
|
|
|
65
42
|
<div class="relative w-full">
|
|
66
43
|
<textarea
|
|
67
44
|
bind:this={ref}
|
|
68
45
|
use:createAutoSizeTextarea={autoSize}
|
|
69
|
-
style={autoSize ? "resize: none;" : ''}
|
|
46
|
+
style={autoSize ? "resize: none; transition-property: border-color, box-shadow, background-color;" : ''}
|
|
70
47
|
class={styles({ variant, disabled , size, className, allowClear, status })}
|
|
71
48
|
{disabled}
|
|
72
49
|
rows={autoSize ? 1 : rows}
|
|
73
50
|
maxlength={maxLength}
|
|
74
51
|
{...props}
|
|
75
52
|
bind:value
|
|
76
|
-
>
|
|
77
|
-
</textarea>
|
|
53
|
+
></textarea>
|
|
78
54
|
|
|
79
55
|
{#if allowClear && value && !disabled}
|
|
80
56
|
<button
|