twintrinsic 0.0.1
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 +674 -0
- package/README.md +150 -0
- package/dist/App/App.svelte +54 -0
- package/dist/App/App.svelte.d.ts +65 -0
- package/dist/Section.svelte +25 -0
- package/dist/Section.svelte.d.ts +34 -0
- package/dist/actions/clickOutside.d.ts +9 -0
- package/dist/actions/clickOutside.js +19 -0
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/index.js +1 -0
- package/dist/components/Accordion/Accordion.svelte +75 -0
- package/dist/components/Accordion/Accordion.svelte.d.ts +39 -0
- package/dist/components/Accordion/AccordionItem.svelte +150 -0
- package/dist/components/Accordion/AccordionItem.svelte.d.ts +30 -0
- package/dist/components/App/App.story.md +8 -0
- package/dist/components/App/App.story.svelte +170 -0
- package/dist/components/App/App.story.svelte.d.ts +22 -0
- package/dist/components/App/App.svelte +77 -0
- package/dist/components/App/App.svelte.d.ts +66 -0
- package/dist/components/App/Split.svelte +346 -0
- package/dist/components/App/Split.svelte.d.ts +54 -0
- package/dist/components/App/index.d.ts +2 -0
- package/dist/components/App/index.js +3 -0
- package/dist/components/AppHeader/AppHeader.svelte +439 -0
- package/dist/components/AppHeader/AppHeader.svelte.d.ts +24 -0
- package/dist/components/Avatar/Avatar.svelte +300 -0
- package/dist/components/Avatar/Avatar.svelte.d.ts +48 -0
- package/dist/components/Avatar/AvatarGroup.svelte +185 -0
- package/dist/components/Avatar/AvatarGroup.svelte.d.ts +46 -0
- package/dist/components/Badge/Badge.svelte +186 -0
- package/dist/components/Badge/Badge.svelte.d.ts +51 -0
- package/dist/components/BottomBar/BottomBar.svelte +146 -0
- package/dist/components/BottomBar/BottomBar.svelte.d.ts +38 -0
- package/dist/components/Breadcrumb/Breadcrumb.svelte +77 -0
- package/dist/components/Breadcrumb/Breadcrumb.svelte.d.ts +42 -0
- package/dist/components/Breadcrumb/BreadcrumbItem.svelte +171 -0
- package/dist/components/Breadcrumb/BreadcrumbItem.svelte.d.ts +38 -0
- package/dist/components/Button/Button.svelte +252 -0
- package/dist/components/Button/Button.svelte.d.ts +80 -0
- package/dist/components/Button/ButtonGroup.svelte +127 -0
- package/dist/components/Button/ButtonGroup.svelte.d.ts +44 -0
- package/dist/components/Card/Card.svelte +152 -0
- package/dist/components/Card/Card.svelte.d.ts +55 -0
- package/dist/components/Carousel/Carousel.svelte +461 -0
- package/dist/components/Carousel/Carousel.svelte.d.ts +79 -0
- package/dist/components/Carousel/CarouselItem.svelte +149 -0
- package/dist/components/Carousel/CarouselItem.svelte.d.ts +35 -0
- package/dist/components/Chip/Chip.svelte +288 -0
- package/dist/components/Chip/Chip.svelte.d.ts +71 -0
- package/dist/components/Chip/ChipGroup.svelte +190 -0
- package/dist/components/Chip/ChipGroup.svelte.d.ts +71 -0
- package/dist/components/CodeBlock/CodeBlock.svelte +356 -0
- package/dist/components/CodeBlock/CodeBlock.svelte.d.ts +44 -0
- package/dist/components/CodeBlock/index.d.ts +1 -0
- package/dist/components/CodeBlock/index.js +1 -0
- package/dist/components/CodeBlockSpeed/CodeBlockSpeed.svelte +145 -0
- package/dist/components/CodeBlockSpeed/CodeBlockSpeed.svelte.d.ts +44 -0
- package/dist/components/CodeEditor/CodeEditor.svelte +229 -0
- package/dist/components/CodeEditor/CodeEditor.svelte.d.ts +23 -0
- package/dist/components/Combobox/Combobox.svelte +279 -0
- package/dist/components/Combobox/Combobox.svelte.d.ts +34 -0
- package/dist/components/Container/Container.svelte +45 -0
- package/dist/components/Container/Container.svelte.d.ts +36 -0
- package/dist/components/DataTable/DataTable.svelte +879 -0
- package/dist/components/DataTable/DataTable.svelte.d.ts +102 -0
- package/dist/components/Form/AutoComplete.svelte +357 -0
- package/dist/components/Form/AutoComplete.svelte.d.ts +73 -0
- package/dist/components/Form/Calendar.svelte +429 -0
- package/dist/components/Form/Calendar.svelte.d.ts +53 -0
- package/dist/components/Form/Checkbox.svelte +196 -0
- package/dist/components/Form/Checkbox.svelte.d.ts +50 -0
- package/dist/components/Form/ColorPicker.svelte +396 -0
- package/dist/components/Form/ColorPicker.svelte.d.ts +43 -0
- package/dist/components/Form/Combobox.svelte +645 -0
- package/dist/components/Form/Combobox.svelte.d.ts +93 -0
- package/dist/components/Form/Dropdown.svelte +773 -0
- package/dist/components/Form/Dropdown.svelte.d.ts +81 -0
- package/dist/components/Form/FileUpload.svelte +796 -0
- package/dist/components/Form/FileUpload.svelte.d.ts +78 -0
- package/dist/components/Form/FloatLabel.svelte +245 -0
- package/dist/components/Form/FloatLabel.svelte.d.ts +44 -0
- package/dist/components/Form/Form.svelte +281 -0
- package/dist/components/Form/Form.svelte.d.ts +54 -0
- package/dist/components/Form/FormField.svelte +218 -0
- package/dist/components/Form/FormField.svelte.d.ts +47 -0
- package/dist/components/Form/Input.svelte +340 -0
- package/dist/components/Form/Input.svelte.d.ts +79 -0
- package/dist/components/Form/InputSwitch.svelte +189 -0
- package/dist/components/Form/InputSwitch.svelte.d.ts +46 -0
- package/dist/components/Form/InvalidState.svelte +97 -0
- package/dist/components/Form/InvalidState.svelte.d.ts +37 -0
- package/dist/components/Form/Knob.svelte +537 -0
- package/dist/components/Form/Knob.svelte.d.ts +78 -0
- package/dist/components/Form/ListInput.svelte +469 -0
- package/dist/components/Form/ListInput.svelte.d.ts +70 -0
- package/dist/components/Form/Listbox.svelte +513 -0
- package/dist/components/Form/Listbox.svelte.d.ts +74 -0
- package/dist/components/Form/NumberInput.svelte +452 -0
- package/dist/components/Form/NumberInput.svelte.d.ts +82 -0
- package/dist/components/Form/Radio.svelte +192 -0
- package/dist/components/Form/Radio.svelte.d.ts +53 -0
- package/dist/components/Form/RadioGroup.svelte +155 -0
- package/dist/components/Form/RadioGroup.svelte.d.ts +48 -0
- package/dist/components/Form/Rating.svelte +380 -0
- package/dist/components/Form/Rating.svelte.d.ts +64 -0
- package/dist/components/Form/Select.svelte +436 -0
- package/dist/components/Form/Select.svelte.d.ts +49 -0
- package/dist/components/Form/SelectGroup.svelte +34 -0
- package/dist/components/Form/SelectGroup.svelte.d.ts +33 -0
- package/dist/components/Form/Slider.svelte +622 -0
- package/dist/components/Form/Slider.svelte.d.ts +73 -0
- package/dist/components/Form/Switch.svelte +192 -0
- package/dist/components/Form/Switch.svelte.d.ts +46 -0
- package/dist/components/Form/TextInput.svelte +274 -0
- package/dist/components/Form/TextInput.svelte.d.ts +74 -0
- package/dist/components/Form/Textarea.svelte +207 -0
- package/dist/components/Form/Textarea.svelte.d.ts +62 -0
- package/dist/components/Icon/Icon.svelte +140 -0
- package/dist/components/Icon/Icon.svelte.d.ts +25 -0
- package/dist/components/Icon/index.d.ts +1 -0
- package/dist/components/Icon/index.js +1 -0
- package/dist/components/Lazy/Lazy.svelte +158 -0
- package/dist/components/Lazy/Lazy.svelte.d.ts +42 -0
- package/dist/components/Masonry/Masonry.svelte +299 -0
- package/dist/components/Masonry/Masonry.svelte.d.ts +55 -0
- package/dist/components/Menu/Menu/Menu.svelte +65 -0
- package/dist/components/Menu/Menu/Menu.svelte.d.ts +17 -0
- package/dist/components/Menu/Menu/MenuItem.svelte +90 -0
- package/dist/components/Menu/Menu/MenuItem.svelte.d.ts +27 -0
- package/dist/components/Modal/Modal.svelte +334 -0
- package/dist/components/Modal/Modal.svelte.d.ts +55 -0
- package/dist/components/Panel/Card.svelte +141 -0
- package/dist/components/Panel/Card.svelte.d.ts +52 -0
- package/dist/components/Panel/Hero/Hero.story.md +9 -0
- package/dist/components/Panel/Hero/Hero.story.svelte +49 -0
- package/dist/components/Panel/Hero/Hero.story.svelte.d.ts +21 -0
- package/dist/components/Panel/Hero/Hero.svelte +24 -0
- package/dist/components/Panel/Hero/Hero.svelte.d.ts +32 -0
- package/dist/components/Panel/LazyPanel.svelte +110 -0
- package/dist/components/Panel/LazyPanel.svelte.d.ts +46 -0
- package/dist/components/Panel/Panel.svelte +205 -0
- package/dist/components/Panel/Panel.svelte.d.ts +23 -0
- package/dist/components/Progress/Progress.svelte +220 -0
- package/dist/components/Progress/Progress.svelte.d.ts +61 -0
- package/dist/components/Separator/Separator.svelte +109 -0
- package/dist/components/Separator/Separator.svelte.d.ts +35 -0
- package/dist/components/Sidebar/Sidebar.svelte +213 -0
- package/dist/components/Sidebar/Sidebar.svelte.d.ts +60 -0
- package/dist/components/Skeleton/Skeleton.svelte +170 -0
- package/dist/components/Skeleton/Skeleton.svelte.d.ts +48 -0
- package/dist/components/Stepper/Stepper.svelte +111 -0
- package/dist/components/Stepper/Stepper.svelte.d.ts +54 -0
- package/dist/components/Stepper/StepperStep.svelte +369 -0
- package/dist/components/Stepper/StepperStep.svelte.d.ts +63 -0
- package/dist/components/Table/Table.svelte +167 -0
- package/dist/components/Table/Table.svelte.d.ts +56 -0
- package/dist/components/Table/TableBody.svelte +41 -0
- package/dist/components/Table/TableBody.svelte.d.ts +33 -0
- package/dist/components/Table/TableCell.svelte +76 -0
- package/dist/components/Table/TableCell.svelte.d.ts +36 -0
- package/dist/components/Table/TableHead.svelte +41 -0
- package/dist/components/Table/TableHead.svelte.d.ts +32 -0
- package/dist/components/Table/TableHeader.svelte +148 -0
- package/dist/components/Table/TableHeader.svelte.d.ts +42 -0
- package/dist/components/Table/TableRow.svelte +99 -0
- package/dist/components/Table/TableRow.svelte.d.ts +40 -0
- package/dist/components/Tabs/Tab.svelte +145 -0
- package/dist/components/Tabs/Tab.svelte.d.ts +36 -0
- package/dist/components/Tabs/TabList.svelte +60 -0
- package/dist/components/Tabs/TabList.svelte.d.ts +32 -0
- package/dist/components/Tabs/TabPanel.svelte +118 -0
- package/dist/components/Tabs/TabPanel.svelte.d.ts +38 -0
- package/dist/components/Tabs/Tabs.svelte +287 -0
- package/dist/components/Tabs/Tabs.svelte.d.ts +50 -0
- package/dist/components/Tag/Tag.svelte +260 -0
- package/dist/components/Tag/Tag.svelte.d.ts +54 -0
- package/dist/components/Tag/TagGroup.svelte +147 -0
- package/dist/components/Tag/TagGroup.svelte.d.ts +62 -0
- package/dist/components/ThemeToggle/ThemeToggle.svelte +93 -0
- package/dist/components/ThemeToggle/ThemeToggle.svelte.d.ts +12 -0
- package/dist/components/Timeline/Timeline.svelte +144 -0
- package/dist/components/Timeline/Timeline.svelte.d.ts +48 -0
- package/dist/components/Timeline/TimelineItem.svelte +391 -0
- package/dist/components/Timeline/TimelineItem.svelte.d.ts +63 -0
- package/dist/components/Toast/Toast.svelte +313 -0
- package/dist/components/Toast/Toast.svelte.d.ts +44 -0
- package/dist/components/Toast/toastStore.d.ts +40 -0
- package/dist/components/Toast/toastStore.js +293 -0
- package/dist/components/Tooltip/Tooltip.svelte +282 -0
- package/dist/components/Tooltip/Tooltip.svelte.d.ts +55 -0
- package/dist/components/Tree/Tree.svelte +129 -0
- package/dist/components/Tree/Tree.svelte.d.ts +61 -0
- package/dist/components/Tree/TreeNode.svelte +332 -0
- package/dist/components/Tree/TreeNode.svelte.d.ts +55 -0
- package/dist/components/icons/TwintrinsicLogo.svelte +73 -0
- package/dist/components/icons/TwintrinsicLogo.svelte.d.ts +17 -0
- package/dist/components/icons/twintrinsic-source.svg +73 -0
- package/dist/components/icons/twintrinsic.svg +38 -0
- package/dist/docs/EventsTable.svelte +86 -0
- package/dist/docs/EventsTable.svelte.d.ts +27 -0
- package/dist/docs/PropsTable.svelte +103 -0
- package/dist/docs/PropsTable.svelte.d.ts +28 -0
- package/dist/docs/index.d.ts +2 -0
- package/dist/docs/index.js +2 -0
- package/dist/helpers/detectLanguage.d.ts +6 -0
- package/dist/helpers/detectLanguage.js +60 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.js +1 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.js +94 -0
- package/dist/twintrinsic.css +347 -0
- package/package.json +98 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export default BreadcrumbItem;
|
|
2
|
+
type BreadcrumbItem = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* BreadcrumbItem - An individual item within a Breadcrumb component.
|
|
8
|
+
* Renders as a link when href is provided, otherwise as a span for the current page.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* ```svelte
|
|
12
|
+
* <BreadcrumbItem href="/">Home</BreadcrumbItem>
|
|
13
|
+
*
|
|
14
|
+
* <BreadcrumbItem href="/products" icon="<svg>...</svg>">
|
|
15
|
+
* Products
|
|
16
|
+
* </BreadcrumbItem>
|
|
17
|
+
*
|
|
18
|
+
* <BreadcrumbItem>Current Page</BreadcrumbItem>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
declare const BreadcrumbItem: import("svelte").Component<{
|
|
22
|
+
class?: string;
|
|
23
|
+
href: any;
|
|
24
|
+
target: any;
|
|
25
|
+
icon: any;
|
|
26
|
+
current?: boolean;
|
|
27
|
+
collapsible?: boolean;
|
|
28
|
+
children: any;
|
|
29
|
+
}, {}, "">;
|
|
30
|
+
type $$ComponentProps = {
|
|
31
|
+
class?: string;
|
|
32
|
+
href: any;
|
|
33
|
+
target: any;
|
|
34
|
+
icon: any;
|
|
35
|
+
current?: boolean;
|
|
36
|
+
collapsible?: boolean;
|
|
37
|
+
children: any;
|
|
38
|
+
};
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
Button - A styled button component with various variants and sizes.
|
|
4
|
+
Provides consistent styling, accessibility features, and loading states.
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
```svelte
|
|
8
|
+
<Button>Default Button</Button>
|
|
9
|
+
|
|
10
|
+
<Button variant="primary" size="lg">
|
|
11
|
+
Primary Button
|
|
12
|
+
</Button>
|
|
13
|
+
|
|
14
|
+
<Button variant="outline" icon="settings">
|
|
15
|
+
Settings
|
|
16
|
+
</Button>
|
|
17
|
+
|
|
18
|
+
<Button variant="link" href="/about">
|
|
19
|
+
About Us
|
|
20
|
+
</Button>
|
|
21
|
+
```
|
|
22
|
+
-->
|
|
23
|
+
<script>
|
|
24
|
+
const {
|
|
25
|
+
/** @type {string} - Additional CSS classes */
|
|
26
|
+
class: className = "",
|
|
27
|
+
|
|
28
|
+
/** @type {string} - HTML id for accessibility */
|
|
29
|
+
id = crypto.randomUUID(),
|
|
30
|
+
|
|
31
|
+
/** @type {string} - Button type (button, submit, reset) */
|
|
32
|
+
type = "button",
|
|
33
|
+
|
|
34
|
+
/** @type {string} - Button variant (default, primary, secondary, outline, ghost, link) */
|
|
35
|
+
variant = "default",
|
|
36
|
+
|
|
37
|
+
/** @type {string} - Button size (xs, sm, md, lg, xl) */
|
|
38
|
+
size = "md",
|
|
39
|
+
|
|
40
|
+
/** @type {boolean} - Whether the button is disabled */
|
|
41
|
+
disabled = false,
|
|
42
|
+
|
|
43
|
+
/** @type {boolean} - Whether the button is in a loading state */
|
|
44
|
+
loading = false,
|
|
45
|
+
|
|
46
|
+
/** @type {string} - Icon to display (HTML or SVG string) */
|
|
47
|
+
icon,
|
|
48
|
+
|
|
49
|
+
/** @type {string} - Icon position (left or right) */
|
|
50
|
+
iconPosition = "left",
|
|
51
|
+
|
|
52
|
+
/** @type {boolean} - Whether the button is full width */
|
|
53
|
+
fullWidth = false,
|
|
54
|
+
|
|
55
|
+
/** @type {string} - Link URL (renders as <a> instead of <button>) */
|
|
56
|
+
href,
|
|
57
|
+
|
|
58
|
+
/** @type {string} - Link target (_blank, _self, etc.) */
|
|
59
|
+
target,
|
|
60
|
+
|
|
61
|
+
/** @type {string} - ARIA label for accessibility */
|
|
62
|
+
ariaLabel,
|
|
63
|
+
|
|
64
|
+
/** @type {string} - Form ID that this button is associated with */
|
|
65
|
+
form,
|
|
66
|
+
|
|
67
|
+
/** @type {string} - Name attribute for form buttons */
|
|
68
|
+
name,
|
|
69
|
+
|
|
70
|
+
/** @type {string} - Value attribute for form buttons */
|
|
71
|
+
value,
|
|
72
|
+
|
|
73
|
+
/** @type {boolean} - Whether the button should be autofocused */
|
|
74
|
+
autofocus = false,
|
|
75
|
+
|
|
76
|
+
/** @type {string} - Form submission method (post, get, etc.) */
|
|
77
|
+
formmethod,
|
|
78
|
+
|
|
79
|
+
/** @type {string} - Form submission encoding */
|
|
80
|
+
formenctype,
|
|
81
|
+
|
|
82
|
+
/** @type {string} - Form validation mode */
|
|
83
|
+
formnovalidate,
|
|
84
|
+
|
|
85
|
+
/** @type {string} - Form target */
|
|
86
|
+
formtarget,
|
|
87
|
+
|
|
88
|
+
/** @type {string} - Relationship attribute for links */
|
|
89
|
+
rel,
|
|
90
|
+
|
|
91
|
+
/** @type {string} - Download attribute for links */
|
|
92
|
+
download,
|
|
93
|
+
|
|
94
|
+
/** @type {(event: CustomEvent) => void} - Click event handler */
|
|
95
|
+
onclick,
|
|
96
|
+
|
|
97
|
+
children,
|
|
98
|
+
} = $props()
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Handles button click
|
|
102
|
+
* @param {Event} event - Click event
|
|
103
|
+
*/
|
|
104
|
+
function handleClick(event) {
|
|
105
|
+
if (disabled || loading) {
|
|
106
|
+
event.preventDefault()
|
|
107
|
+
return
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
onclick?.(new CustomEvent("click", { detail: event }))
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Determine if button should render as a link
|
|
114
|
+
const isLink = $derived(!!href && !disabled && !loading)
|
|
115
|
+
|
|
116
|
+
// Determine element type
|
|
117
|
+
const elementType = $derived(isLink ? "a" : "button")
|
|
118
|
+
|
|
119
|
+
// Determine variant classes
|
|
120
|
+
const variantClasses = $derived(
|
|
121
|
+
{
|
|
122
|
+
default:
|
|
123
|
+
"bg-surface dark:bg-surface text-text dark:text-text border border-border dark:border-border hover:bg-hover dark:hover:bg-hover",
|
|
124
|
+
primary:
|
|
125
|
+
"bg-primary-500 dark:bg-primary-500 text-white dark:text-white hover:bg-primary-600 dark:hover:bg-primary-600",
|
|
126
|
+
secondary:
|
|
127
|
+
"bg-secondary-500 dark:bg-secondary-500 text-white dark:text-white hover:bg-secondary-600 dark:hover:bg-secondary-600",
|
|
128
|
+
outline:
|
|
129
|
+
"bg-transparent dark:bg-transparent text-text dark:text-text border border-border dark:border-border hover:bg-hover dark:hover:bg-hover",
|
|
130
|
+
ghost:
|
|
131
|
+
"bg-transparent dark:bg-transparent text-text dark:text-text hover:bg-hover dark:hover:bg-hover",
|
|
132
|
+
link: "bg-transparent dark:bg-transparent text-primary-500 dark:text-primary-400 hover:underline p-0 h-auto",
|
|
133
|
+
}[variant] ||
|
|
134
|
+
"bg-surface dark:bg-surface text-text dark:text-text border border-border dark:border-border hover:bg-hover dark:hover:bg-hover"
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
// Determine size classes
|
|
138
|
+
const sizeClasses = $derived(
|
|
139
|
+
variant === "link"
|
|
140
|
+
? ""
|
|
141
|
+
: {
|
|
142
|
+
xs: "text-xs h-6 px-2",
|
|
143
|
+
sm: "text-sm h-8 px-3",
|
|
144
|
+
md: "text-base h-10 px-4",
|
|
145
|
+
lg: "text-lg h-12 px-5",
|
|
146
|
+
xl: "text-xl h-14 px-6",
|
|
147
|
+
}[size] || "text-base h-10 px-4"
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
// Determine icon size based on button size
|
|
151
|
+
const iconSize = $derived(
|
|
152
|
+
{
|
|
153
|
+
xs: "w-3 h-3",
|
|
154
|
+
sm: "w-4 h-4",
|
|
155
|
+
md: "w-5 h-5",
|
|
156
|
+
lg: "w-6 h-6",
|
|
157
|
+
xl: "w-7 h-7",
|
|
158
|
+
}[size] || "w-5 h-5"
|
|
159
|
+
)
|
|
160
|
+
</script>
|
|
161
|
+
|
|
162
|
+
<svelte:element
|
|
163
|
+
this={elementType}
|
|
164
|
+
{id}
|
|
165
|
+
class="
|
|
166
|
+
button
|
|
167
|
+
{variantClasses}
|
|
168
|
+
{sizeClasses}
|
|
169
|
+
{fullWidth ? 'w-full' : ''}
|
|
170
|
+
{loading ? 'opacity-80 pointer-events-none' : ''}
|
|
171
|
+
{className}
|
|
172
|
+
"
|
|
173
|
+
{type}
|
|
174
|
+
{href}
|
|
175
|
+
{target}
|
|
176
|
+
{disabled}
|
|
177
|
+
aria-disabled={disabled || loading ? 'true' : undefined}
|
|
178
|
+
aria-label={ariaLabel}
|
|
179
|
+
onclick={handleClick}
|
|
180
|
+
{form}
|
|
181
|
+
{name}
|
|
182
|
+
{value}
|
|
183
|
+
{autofocus}
|
|
184
|
+
{formmethod}
|
|
185
|
+
{formenctype}
|
|
186
|
+
{formnovalidate}
|
|
187
|
+
{formtarget}
|
|
188
|
+
{rel}
|
|
189
|
+
{download}
|
|
190
|
+
>
|
|
191
|
+
{#if loading}
|
|
192
|
+
<span class="button-loader {iconSize}" aria-hidden="true"></span>
|
|
193
|
+
<span class="sr-only">Loading</span>
|
|
194
|
+
{:else}
|
|
195
|
+
{#if icon && iconPosition === 'left'}
|
|
196
|
+
<span class="button-icon button-icon-left {iconSize}" aria-hidden="true">
|
|
197
|
+
{@html icon}
|
|
198
|
+
</span>
|
|
199
|
+
{/if}
|
|
200
|
+
|
|
201
|
+
{#if children}
|
|
202
|
+
<span class="button-content">
|
|
203
|
+
{@render children?.()}
|
|
204
|
+
</span>
|
|
205
|
+
{/if}
|
|
206
|
+
|
|
207
|
+
{#if icon && iconPosition === 'right'}
|
|
208
|
+
<span class="button-icon button-icon-right {iconSize}" aria-hidden="true">
|
|
209
|
+
{@html icon}
|
|
210
|
+
</span>
|
|
211
|
+
{/if}
|
|
212
|
+
{/if}
|
|
213
|
+
</svelte:element>
|
|
214
|
+
|
|
215
|
+
<style>
|
|
216
|
+
@reference "../../twintrinsic.css";
|
|
217
|
+
|
|
218
|
+
.button {
|
|
219
|
+
@apply inline-flex items-center justify-center;
|
|
220
|
+
@apply font-medium rounded-md;
|
|
221
|
+
@apply transition-colors duration-200;
|
|
222
|
+
@apply focus:outline-none focus:ring-2 focus:ring-primary-500 dark:focus:ring-primary-400 focus:ring-offset-2 dark:focus:ring-offset-background;
|
|
223
|
+
@apply disabled:opacity-50 disabled:cursor-not-allowed;
|
|
224
|
+
@apply whitespace-nowrap;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.button-content {
|
|
228
|
+
@apply flex-grow;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.button-icon-left {
|
|
232
|
+
@apply mr-2 -ml-1;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.button-icon-right {
|
|
236
|
+
@apply ml-2 -mr-1;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.button-loader {
|
|
240
|
+
@apply rounded-full border-2 border-transparent border-t-current border-r-current;
|
|
241
|
+
animation: button-spin 0.6s linear infinite;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
@keyframes button-spin {
|
|
245
|
+
from {
|
|
246
|
+
transform: rotate(0deg);
|
|
247
|
+
}
|
|
248
|
+
to {
|
|
249
|
+
transform: rotate(360deg);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
</style>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export default Button;
|
|
2
|
+
type Button = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Button - A styled button component with various variants and sizes.
|
|
8
|
+
* Provides consistent styling, accessibility features, and loading states.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* ```svelte
|
|
12
|
+
* <Button>Default Button</Button>
|
|
13
|
+
*
|
|
14
|
+
* <Button variant="primary" size="lg">
|
|
15
|
+
* Primary Button
|
|
16
|
+
* </Button>
|
|
17
|
+
*
|
|
18
|
+
* <Button variant="outline" icon="settings">
|
|
19
|
+
* Settings
|
|
20
|
+
* </Button>
|
|
21
|
+
*
|
|
22
|
+
* <Button variant="link" href="/about">
|
|
23
|
+
* About Us
|
|
24
|
+
* </Button>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
declare const Button: import("svelte").Component<{
|
|
28
|
+
class?: string;
|
|
29
|
+
id?: any;
|
|
30
|
+
type?: string;
|
|
31
|
+
variant?: string;
|
|
32
|
+
size?: string;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
loading?: boolean;
|
|
35
|
+
icon: any;
|
|
36
|
+
iconPosition?: string;
|
|
37
|
+
fullWidth?: boolean;
|
|
38
|
+
href: any;
|
|
39
|
+
target: any;
|
|
40
|
+
ariaLabel: any;
|
|
41
|
+
form: any;
|
|
42
|
+
name: any;
|
|
43
|
+
value: any;
|
|
44
|
+
autofocus?: boolean;
|
|
45
|
+
formmethod: any;
|
|
46
|
+
formenctype: any;
|
|
47
|
+
formnovalidate: any;
|
|
48
|
+
formtarget: any;
|
|
49
|
+
rel: any;
|
|
50
|
+
download: any;
|
|
51
|
+
onclick: any;
|
|
52
|
+
children: any;
|
|
53
|
+
}, {}, "">;
|
|
54
|
+
type $$ComponentProps = {
|
|
55
|
+
class?: string;
|
|
56
|
+
id?: any;
|
|
57
|
+
type?: string;
|
|
58
|
+
variant?: string;
|
|
59
|
+
size?: string;
|
|
60
|
+
disabled?: boolean;
|
|
61
|
+
loading?: boolean;
|
|
62
|
+
icon: any;
|
|
63
|
+
iconPosition?: string;
|
|
64
|
+
fullWidth?: boolean;
|
|
65
|
+
href: any;
|
|
66
|
+
target: any;
|
|
67
|
+
ariaLabel: any;
|
|
68
|
+
form: any;
|
|
69
|
+
name: any;
|
|
70
|
+
value: any;
|
|
71
|
+
autofocus?: boolean;
|
|
72
|
+
formmethod: any;
|
|
73
|
+
formenctype: any;
|
|
74
|
+
formnovalidate: any;
|
|
75
|
+
formtarget: any;
|
|
76
|
+
rel: any;
|
|
77
|
+
download: any;
|
|
78
|
+
onclick: any;
|
|
79
|
+
children: any;
|
|
80
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
ButtonGroup - A component for grouping related buttons together.
|
|
4
|
+
Provides consistent styling and spacing for button collections.
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
```svelte
|
|
8
|
+
<ButtonGroup>
|
|
9
|
+
<Button>Left</Button>
|
|
10
|
+
<Button>Middle</Button>
|
|
11
|
+
<Button>Right</Button>
|
|
12
|
+
</ButtonGroup>
|
|
13
|
+
|
|
14
|
+
<ButtonGroup variant="outline" size="sm" vertical>
|
|
15
|
+
<Button>Top</Button>
|
|
16
|
+
<Button>Middle</Button>
|
|
17
|
+
<Button>Bottom</Button>
|
|
18
|
+
</ButtonGroup>
|
|
19
|
+
```
|
|
20
|
+
-->
|
|
21
|
+
<script>
|
|
22
|
+
import { setContext } from "svelte"
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
/** @type {string} - Additional CSS classes */
|
|
26
|
+
class: className = "",
|
|
27
|
+
|
|
28
|
+
/** @type {string} - HTML id for accessibility */
|
|
29
|
+
id = crypto.randomUUID(),
|
|
30
|
+
|
|
31
|
+
/** @type {string} - Button variant to apply to all children (default, primary, secondary, outline, ghost) */
|
|
32
|
+
variant,
|
|
33
|
+
|
|
34
|
+
/** @type {string} - Button size to apply to all children (xs, sm, md, lg, xl) */
|
|
35
|
+
size,
|
|
36
|
+
|
|
37
|
+
/** @type {boolean} - Whether the buttons should be arranged vertically */
|
|
38
|
+
vertical = false,
|
|
39
|
+
|
|
40
|
+
/** @type {boolean} - Whether the button group should take full width */
|
|
41
|
+
fullWidth = false,
|
|
42
|
+
|
|
43
|
+
/** @type {string} - ARIA label for the button group */
|
|
44
|
+
ariaLabel,
|
|
45
|
+
|
|
46
|
+
children,
|
|
47
|
+
} = $props()
|
|
48
|
+
|
|
49
|
+
// Provide context for child buttons
|
|
50
|
+
setContext("buttonGroup", {
|
|
51
|
+
variant,
|
|
52
|
+
size,
|
|
53
|
+
inGroup: true,
|
|
54
|
+
})
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<div
|
|
58
|
+
{id}
|
|
59
|
+
class="
|
|
60
|
+
button-group
|
|
61
|
+
{vertical ? 'button-group-vertical' : 'button-group-horizontal'}
|
|
62
|
+
{fullWidth ? 'w-full' : ''}
|
|
63
|
+
{className}
|
|
64
|
+
"
|
|
65
|
+
role="group"
|
|
66
|
+
aria-label={ariaLabel}
|
|
67
|
+
>
|
|
68
|
+
{@render children?.()}
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<style>
|
|
72
|
+
@reference "../../twintrinsic.css";
|
|
73
|
+
|
|
74
|
+
.button-group {
|
|
75
|
+
@apply inline-flex;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.button-group-horizontal {
|
|
79
|
+
@apply flex-row;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.button-group-vertical {
|
|
83
|
+
@apply flex-col;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* Style child buttons to create connected appearance */
|
|
87
|
+
.button-group-horizontal :global(.button) {
|
|
88
|
+
@apply rounded-none;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.button-group-horizontal :global(.button:first-child) {
|
|
92
|
+
@apply rounded-l-md;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.button-group-horizontal :global(.button:last-child) {
|
|
96
|
+
@apply rounded-r-md;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.button-group-horizontal :global(.button:not(:first-child)) {
|
|
100
|
+
@apply -ml-px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.button-group-vertical :global(.button) {
|
|
104
|
+
@apply rounded-none;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.button-group-vertical :global(.button:first-child) {
|
|
108
|
+
@apply rounded-t-md;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.button-group-vertical :global(.button:last-child) {
|
|
112
|
+
@apply rounded-b-md;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.button-group-vertical :global(.button:not(:first-child)) {
|
|
116
|
+
@apply -mt-px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* Full width styles */
|
|
120
|
+
.button-group.w-full {
|
|
121
|
+
@apply w-full;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.button-group.w-full :global(.button) {
|
|
125
|
+
@apply flex-1;
|
|
126
|
+
}
|
|
127
|
+
</style>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export default ButtonGroup;
|
|
2
|
+
type ButtonGroup = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* ButtonGroup - A component for grouping related buttons together.
|
|
8
|
+
* Provides consistent styling and spacing for button collections.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* ```svelte
|
|
12
|
+
* <ButtonGroup>
|
|
13
|
+
* <Button>Left</Button>
|
|
14
|
+
* <Button>Middle</Button>
|
|
15
|
+
* <Button>Right</Button>
|
|
16
|
+
* </ButtonGroup>
|
|
17
|
+
*
|
|
18
|
+
* <ButtonGroup variant="outline" size="sm" vertical>
|
|
19
|
+
* <Button>Top</Button>
|
|
20
|
+
* <Button>Middle</Button>
|
|
21
|
+
* <Button>Bottom</Button>
|
|
22
|
+
* </ButtonGroup>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare const ButtonGroup: import("svelte").Component<{
|
|
26
|
+
class?: string;
|
|
27
|
+
id?: any;
|
|
28
|
+
variant: any;
|
|
29
|
+
size: any;
|
|
30
|
+
vertical?: boolean;
|
|
31
|
+
fullWidth?: boolean;
|
|
32
|
+
ariaLabel: any;
|
|
33
|
+
children: any;
|
|
34
|
+
}, {}, "">;
|
|
35
|
+
type $$ComponentProps = {
|
|
36
|
+
class?: string;
|
|
37
|
+
id?: any;
|
|
38
|
+
variant: any;
|
|
39
|
+
size: any;
|
|
40
|
+
vertical?: boolean;
|
|
41
|
+
fullWidth?: boolean;
|
|
42
|
+
ariaLabel: any;
|
|
43
|
+
children: any;
|
|
44
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
Card - A container for content with optional header, footer, and media sections.
|
|
4
|
+
Provides a consistent visual style for displaying grouped information.
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
```svelte
|
|
8
|
+
<Card>
|
|
9
|
+
<svelte:fragment slot="header">Card Title</svelte:fragment>
|
|
10
|
+
<p>Card content goes here</p>
|
|
11
|
+
<svelte:fragment slot="footer">Footer content</svelte:fragment>
|
|
12
|
+
</Card>
|
|
13
|
+
|
|
14
|
+
<Card
|
|
15
|
+
href="/some-link"
|
|
16
|
+
image="/path/to/image.jpg"
|
|
17
|
+
imageAlt="Description of image"
|
|
18
|
+
>
|
|
19
|
+
<svelte:fragment slot="header">Linked Card</svelte:fragment>
|
|
20
|
+
This card is clickable
|
|
21
|
+
</Card>
|
|
22
|
+
```
|
|
23
|
+
-->
|
|
24
|
+
<script>
|
|
25
|
+
const {
|
|
26
|
+
/** @type {string} - Additional CSS classes */
|
|
27
|
+
class: className = "",
|
|
28
|
+
|
|
29
|
+
/** @type {string} - HTML id for accessibility */
|
|
30
|
+
id = crypto.randomUUID(),
|
|
31
|
+
|
|
32
|
+
/** @type {string} - Link URL if the card is clickable */
|
|
33
|
+
href,
|
|
34
|
+
|
|
35
|
+
/** @type {string} - Image URL for card media */
|
|
36
|
+
image,
|
|
37
|
+
|
|
38
|
+
/** @type {string} - Alt text for the image */
|
|
39
|
+
imageAlt = "",
|
|
40
|
+
|
|
41
|
+
/** @type {boolean} - Whether to show a border */
|
|
42
|
+
bordered = true,
|
|
43
|
+
|
|
44
|
+
/** @type {boolean} - Whether to add a shadow */
|
|
45
|
+
shadowed = false,
|
|
46
|
+
|
|
47
|
+
/** @type {boolean} - Whether to make the card compact (less padding) */
|
|
48
|
+
compact = false,
|
|
49
|
+
|
|
50
|
+
/** @type {boolean} - Whether to add hover effects */
|
|
51
|
+
hoverable = false,
|
|
52
|
+
|
|
53
|
+
children,
|
|
54
|
+
header,
|
|
55
|
+
footer,
|
|
56
|
+
} = $props()
|
|
57
|
+
|
|
58
|
+
// Determine if card has clickable behavior
|
|
59
|
+
const isClickable = !!href
|
|
60
|
+
|
|
61
|
+
// Determine element type based on href
|
|
62
|
+
const elementType = href ? "a" : "div"
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<svelte:element
|
|
66
|
+
this={elementType}
|
|
67
|
+
{id}
|
|
68
|
+
class="
|
|
69
|
+
card
|
|
70
|
+
{bordered ? 'border border-border dark:border-border' : ''}
|
|
71
|
+
{shadowed ? 'shadow-md dark:shadow-lg' : ''}
|
|
72
|
+
{compact ? 'card-compact' : ''}
|
|
73
|
+
{hoverable || isClickable ? 'card-hoverable' : ''}
|
|
74
|
+
{className}
|
|
75
|
+
"
|
|
76
|
+
{href}
|
|
77
|
+
tabindex={isClickable ? 0 : undefined}
|
|
78
|
+
>
|
|
79
|
+
{#if image}
|
|
80
|
+
<div class="card-media">
|
|
81
|
+
<img src={image} alt={imageAlt} />
|
|
82
|
+
</div>
|
|
83
|
+
{/if}
|
|
84
|
+
|
|
85
|
+
{#if header}
|
|
86
|
+
<div class="card-header">
|
|
87
|
+
{@render header()}
|
|
88
|
+
</div>
|
|
89
|
+
{/if}
|
|
90
|
+
|
|
91
|
+
<div class="card-body">
|
|
92
|
+
{@render children?.()}
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
{#if footer}
|
|
96
|
+
<div class="card-footer">
|
|
97
|
+
{@render footer()}
|
|
98
|
+
</div>
|
|
99
|
+
{/if}
|
|
100
|
+
</svelte:element>
|
|
101
|
+
|
|
102
|
+
<style>
|
|
103
|
+
@reference "../../twintrinsic.css";
|
|
104
|
+
|
|
105
|
+
.card {
|
|
106
|
+
@apply bg-background dark:bg-background text-text dark:text-text rounded-lg overflow-hidden flex flex-col;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.card-media {
|
|
110
|
+
@apply w-full;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.card-media img {
|
|
114
|
+
@apply w-full h-auto object-cover;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.card-header {
|
|
118
|
+
@apply px-6 py-4 border-b border-border dark:border-border font-medium;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.card-body {
|
|
122
|
+
@apply px-6 py-4 flex-grow;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.card-footer {
|
|
126
|
+
@apply px-6 py-4 border-t border-border dark:border-border bg-surface dark:bg-surface;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.card-compact .card-header {
|
|
130
|
+
@apply px-4 py-2;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.card-compact .card-body {
|
|
134
|
+
@apply px-4 py-2;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.card-compact .card-footer {
|
|
138
|
+
@apply px-4 py-2;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.card-hoverable {
|
|
142
|
+
@apply transition-all duration-200;
|
|
143
|
+
@apply hover:shadow-lg dark:hover:shadow-xl focus:shadow-lg dark:focus:shadow-xl;
|
|
144
|
+
@apply hover:border-primary-300 dark:hover:border-primary-600 focus:border-primary-300 dark:focus:border-primary-600;
|
|
145
|
+
@apply focus:outline-none focus:ring-2 focus:ring-primary-500 dark:focus:ring-primary-400;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/* Add cursor pointer only for clickable cards */
|
|
149
|
+
a.card {
|
|
150
|
+
@apply cursor-pointer;
|
|
151
|
+
}
|
|
152
|
+
</style>
|