@stacksjs/components 0.2.3
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/README.md +477 -0
- package/dist/Accordion-x2gjedap.stx +108 -0
- package/dist/Audio-0fk6p9tn.stx +50 -0
- package/dist/Avatar-5m0v0s4x.stx +88 -0
- package/dist/Badge-ynes82vv.stx +70 -0
- package/dist/Breadcrumb-h9n427sk.stx +79 -0
- package/dist/Button-7xtrzn14.stx +89 -0
- package/dist/Calendar-egvx1pma.stx +232 -0
- package/dist/Card-r9w7vy1a.stx +74 -0
- package/dist/Checkbox-m8v46pmx.stx +92 -0
- package/dist/Checkout-vcnnr176.stx +39 -0
- package/dist/CodeBlock-mwex82cm.stx +57 -0
- package/dist/Combobox-npb08vkp.stx +13 -0
- package/dist/ComboboxButton-vcdyq4zw.stx +13 -0
- package/dist/ComboboxInput-c9d2p02m.stx +25 -0
- package/dist/ComboboxOption-7d0h9ash.stx +52 -0
- package/dist/ComboboxOptions-4dtqc0qa.stx +12 -0
- package/dist/CommandPalette-ah00bf8v.stx +39 -0
- package/dist/CommandPaletteItem-2yx0gvtj.stx +32 -0
- package/dist/DefaultPaymentMethod-emw5fg8s.stx +62 -0
- package/dist/Dialog-1w4rz7x0.stx +19 -0
- package/dist/DialogBackdrop-qbm3y5ab.stx +9 -0
- package/dist/DialogDescription-01w5j74b.stx +11 -0
- package/dist/DialogPanel-brsszrrs.stx +16 -0
- package/dist/DialogTitle-3rxhwg21.stx +11 -0
- package/dist/Drawer-yfaz8q7f.stx +137 -0
- package/dist/Dropdown-ng7nx556.stx +24 -0
- package/dist/DropdownButton-vc4zpyrb.stx +23 -0
- package/dist/DropdownItem-z491y23c.stx +43 -0
- package/dist/DropdownItems-7ykf29sj.stx +18 -0
- package/dist/EmailInput-bfshpj92.stx +41 -0
- package/dist/Footer-xdaf02nr.stx +66 -0
- package/dist/Form-z4f7w6r1.stx +209 -0
- package/dist/Hero-9vvp7pxf.stx +25 -0
- package/dist/Image-ktk0451c.stx +197 -0
- package/dist/Installation-33bj4rm7.stx +39 -0
- package/dist/Listbox-xcejcmyc.stx +14 -0
- package/dist/ListboxButton-nx5kmw19.stx +17 -0
- package/dist/ListboxLabel-aky8a73n.stx +11 -0
- package/dist/ListboxOption-6h4hsdz5.stx +57 -0
- package/dist/ListboxOptions-2sacdtm5.stx +16 -0
- package/dist/Login-s2jkvd9y.stx +163 -0
- package/dist/Navigator-tqqdgdkw.stx +138 -0
- package/dist/Notification-sry8egea.stx +71 -0
- package/dist/NumberInput-zm93ddfw.stx +138 -0
- package/dist/Pagination-yza9v4qw.stx +183 -0
- package/dist/PasswordInput-4xnndp5y.stx +155 -0
- package/dist/PaymentMethods-jxba6kek.stx +113 -0
- package/dist/Popover-scbqatjq.stx +24 -0
- package/dist/PopoverButton-rbxhzj4k.stx +23 -0
- package/dist/PopoverPanel-9ng1rm6e.stx +23 -0
- package/dist/Portal-j111yvqp.stx +74 -0
- package/dist/Progress-gbmw3akr.stx +142 -0
- package/dist/Radio-1n9qamv1.stx +81 -0
- package/dist/RadioGroup-12dw2vhk.stx +13 -0
- package/dist/RadioGroupDescription-bjm3mdht.stx +11 -0
- package/dist/RadioGroupLabel-aky8a73n.stx +11 -0
- package/dist/RadioGroupOption-9pcxgwmd.stx +51 -0
- package/dist/SearchInput-g240e2nq.stx +63 -0
- package/dist/Select-p9f94b20.stx +89 -0
- package/dist/Sidebar-gwxw8q38.stx +288 -0
- package/dist/SidebarFooter-887kxret.stx +95 -0
- package/dist/SidebarHeader-qjeyx0hv.stx +100 -0
- package/dist/SidebarItem-4dpwtmb4.stx +118 -0
- package/dist/SidebarSection-kh92fk4m.stx +108 -0
- package/dist/Signup-3nxq5zag.stx +161 -0
- package/dist/Skeleton-g0nx1njm.stx +48 -0
- package/dist/Spinner-w4zj58xp.stx +109 -0
- package/dist/Stepper-rwc5actp.stx +17 -0
- package/dist/StepperStep-h0k657nm.stx +53 -0
- package/dist/SubscriptionCheckout-4cbxdg7w.stx +353 -0
- package/dist/Switch-kjq8qd2p.stx +74 -0
- package/dist/Table-59j9qwp0.stx +14 -0
- package/dist/TableBody-reka2gwv.stx +10 -0
- package/dist/TableCell-j7nh4sgr.stx +10 -0
- package/dist/TableHead-ecbrwpqm.stx +10 -0
- package/dist/TableHeader-jn2shwsv.stx +13 -0
- package/dist/TableRow-xz8rrxhc.stx +11 -0
- package/dist/Tabs-kb6ex6m7.stx +145 -0
- package/dist/Teleport-819cg9zm.stx +101 -0
- package/dist/TextInput-zx9kgr79.stx +146 -0
- package/dist/Textarea-5xvmrb0z.stx +119 -0
- package/dist/Tooltip-5ehqsy49.stx +76 -0
- package/dist/Transition-2j39s044.stx +174 -0
- package/dist/TwoFactorChallenge-2q4gg89m.stx +125 -0
- package/dist/Video-6aq4shh4.stx +45 -0
- package/dist/VirtualList-weh5qtm1.stx +83 -0
- package/dist/VirtualTable-59a1eskc.stx +113 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/composables/index.d.ts +4 -0
- package/dist/composables/index.js +3 -0
- package/dist/composables/useCopyCode.d.ts +19 -0
- package/dist/composables/useDarkMode.d.ts +25 -0
- package/dist/composables/useSEO.d.ts +36 -0
- package/dist/composables/utilities/index.d.ts +5 -0
- package/dist/composables/utilities/useClickOutside.d.ts +28 -0
- package/dist/composables/utilities/useFocusTrap.d.ts +34 -0
- package/dist/composables/utilities/useKeyboard.d.ts +55 -0
- package/dist/composables/utilities/useLocalStorage.d.ts +33 -0
- package/dist/composables/utilities/useMediaQuery.d.ts +64 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.js +19 -0
- package/dist/ui/accordion/index.d.ts +12 -0
- package/dist/ui/audio/index.d.ts +12 -0
- package/dist/ui/auth/index.d.ts +29 -0
- package/dist/ui/avatar/index.d.ts +11 -0
- package/dist/ui/badge/index.d.ts +9 -0
- package/dist/ui/breadcrumb/index.d.ts +13 -0
- package/dist/ui/button/index.d.ts +45 -0
- package/dist/ui/calendar/index.d.ts +13 -0
- package/dist/ui/card/index.d.ts +12 -0
- package/dist/ui/checkbox/index.d.ts +15 -0
- package/dist/ui/combobox/index.d.ts +35 -0
- package/dist/ui/command-palette/index.d.ts +13 -0
- package/dist/ui/dialog/index.d.ts +27 -0
- package/dist/ui/drawer/index.d.ts +8 -0
- package/dist/ui/dropdown/index.d.ts +25 -0
- package/dist/ui/form/index.d.ts +48 -0
- package/dist/ui/image/index.d.ts +21 -0
- package/dist/ui/input/index.d.ts +73 -0
- package/dist/ui/listbox/index.d.ts +34 -0
- package/dist/ui/navigator/index.d.ts +18 -0
- package/dist/ui/notification/index.d.ts +11 -0
- package/dist/ui/pagination/index.d.ts +10 -0
- package/dist/ui/payment/index.d.ts +53 -0
- package/dist/ui/popover/index.d.ts +19 -0
- package/dist/ui/portal/index.d.ts +5 -0
- package/dist/ui/progress/index.d.ts +11 -0
- package/dist/ui/radio/index.d.ts +14 -0
- package/dist/ui/radio-group/index.d.ts +26 -0
- package/dist/ui/select/index.d.ts +19 -0
- package/dist/ui/sidebar/index.d.ts +129 -0
- package/dist/ui/skeleton/index.d.ts +10 -0
- package/dist/ui/spinner/index.d.ts +8 -0
- package/dist/ui/stepper/index.d.ts +17 -0
- package/dist/ui/storage/index.d.ts +40 -0
- package/dist/ui/switch/index.d.ts +9 -0
- package/dist/ui/table/index.d.ts +29 -0
- package/dist/ui/tabs/index.d.ts +14 -0
- package/dist/ui/teleport/index.d.ts +6 -0
- package/dist/ui/textarea/index.d.ts +19 -0
- package/dist/ui/tooltip/index.d.ts +9 -0
- package/dist/ui/transition/index.d.ts +24 -0
- package/dist/ui/video/index.d.ts +15 -0
- package/dist/ui/virtual-list/index.d.ts +9 -0
- package/dist/ui/virtual-table/index.d.ts +19 -0
- package/dist/utils/accessibility.d.ts +285 -0
- package/dist/utils/animation/easing.d.ts +112 -0
- package/dist/utils/animation/helpers.d.ts +119 -0
- package/dist/utils/animation/index.d.ts +3 -0
- package/dist/utils/animation/keyframes.d.ts +334 -0
- package/dist/utils/error-handling.d.ts +182 -0
- package/dist/utils/highlighter.d.ts +27 -0
- package/dist/utils/highlighter.js +2 -0
- package/dist/utils/i18n.d.ts +245 -0
- package/dist/utils/keep-alive.d.ts +171 -0
- package/dist/utils/lazy-loading.d.ts +174 -0
- package/dist/utils/prop-validation.d.ts +106 -0
- package/dist/utils/theme.d.ts +234 -0
- package/package.json +69 -0
- package/src/components/CodeBlock.stx +57 -0
- package/src/components/Footer.stx +66 -0
- package/src/components/Hero.stx +25 -0
- package/src/components/Installation.stx +39 -0
- package/src/components/index.ts +4 -0
- package/src/composables/index.ts +4 -0
- package/src/composables/useCopyCode.ts +73 -0
- package/src/composables/useDarkMode.ts +100 -0
- package/src/composables/useSEO.ts +229 -0
- package/src/composables/utilities/index.ts +7 -0
- package/src/composables/utilities/useClickOutside.ts +72 -0
- package/src/composables/utilities/useFocusTrap.ts +159 -0
- package/src/composables/utilities/useKeyboard.ts +124 -0
- package/src/composables/utilities/useLocalStorage.ts +132 -0
- package/src/composables/utilities/useMediaQuery.ts +118 -0
- package/src/index.ts +99 -0
- package/src/stx.d.ts +4 -0
- package/src/ui/accordion/Accordion.stx +108 -0
- package/src/ui/accordion/index.ts +14 -0
- package/src/ui/audio/Audio.stx +50 -0
- package/src/ui/audio/README.md +42 -0
- package/src/ui/audio/index.ts +13 -0
- package/src/ui/auth/Login.stx +163 -0
- package/src/ui/auth/README.md +145 -0
- package/src/ui/auth/Signup.stx +161 -0
- package/src/ui/auth/TwoFactorChallenge.stx +125 -0
- package/src/ui/auth/index.ts +32 -0
- package/src/ui/avatar/Avatar.stx +88 -0
- package/src/ui/avatar/index.ts +12 -0
- package/src/ui/badge/Badge.stx +70 -0
- package/src/ui/badge/index.ts +10 -0
- package/src/ui/breadcrumb/Breadcrumb.stx +79 -0
- package/src/ui/breadcrumb/index.ts +15 -0
- package/src/ui/button/Button.stx +89 -0
- package/src/ui/button/README.md +100 -0
- package/src/ui/button/index.ts +85 -0
- package/src/ui/calendar/Calendar.stx +232 -0
- package/src/ui/calendar/README.md +254 -0
- package/src/ui/calendar/index.ts +14 -0
- package/src/ui/card/Card.stx +74 -0
- package/src/ui/card/index.ts +13 -0
- package/src/ui/checkbox/Checkbox.stx +92 -0
- package/src/ui/checkbox/index.ts +16 -0
- package/src/ui/combobox/Combobox.stx +13 -0
- package/src/ui/combobox/ComboboxButton.stx +13 -0
- package/src/ui/combobox/ComboboxInput.stx +25 -0
- package/src/ui/combobox/ComboboxOption.stx +52 -0
- package/src/ui/combobox/ComboboxOptions.stx +12 -0
- package/src/ui/combobox/README.md +154 -0
- package/src/ui/combobox/index.ts +40 -0
- package/src/ui/command-palette/CommandPalette.stx +39 -0
- package/src/ui/command-palette/CommandPaletteItem.stx +32 -0
- package/src/ui/command-palette/README.md +42 -0
- package/src/ui/command-palette/index.ts +15 -0
- package/src/ui/dialog/Dialog.stx +19 -0
- package/src/ui/dialog/DialogBackdrop.stx +9 -0
- package/src/ui/dialog/DialogDescription.stx +11 -0
- package/src/ui/dialog/DialogPanel.stx +16 -0
- package/src/ui/dialog/DialogTitle.stx +11 -0
- package/src/ui/dialog/README.md +133 -0
- package/src/ui/dialog/index.ts +32 -0
- package/src/ui/drawer/Drawer.stx +137 -0
- package/src/ui/drawer/README.md +110 -0
- package/src/ui/drawer/index.ts +9 -0
- package/src/ui/dropdown/Dropdown.stx +24 -0
- package/src/ui/dropdown/DropdownButton.stx +23 -0
- package/src/ui/dropdown/DropdownItem.stx +43 -0
- package/src/ui/dropdown/DropdownItems.stx +18 -0
- package/src/ui/dropdown/README.md +142 -0
- package/src/ui/dropdown/index.ts +29 -0
- package/src/ui/form/Form.stx +209 -0
- package/src/ui/form/index.ts +67 -0
- package/src/ui/heatmap/Heatmap.stx +315 -0
- package/src/ui/image/Image.stx +197 -0
- package/src/ui/image/README.md +171 -0
- package/src/ui/image/index.ts +22 -0
- package/src/ui/input/EmailInput.stx +41 -0
- package/src/ui/input/NumberInput.stx +138 -0
- package/src/ui/input/PasswordInput.stx +155 -0
- package/src/ui/input/SearchInput.stx +63 -0
- package/src/ui/input/TextInput.stx +146 -0
- package/src/ui/input/index.ts +180 -0
- package/src/ui/listbox/Listbox.stx +14 -0
- package/src/ui/listbox/ListboxButton.stx +17 -0
- package/src/ui/listbox/ListboxLabel.stx +11 -0
- package/src/ui/listbox/ListboxOption.stx +57 -0
- package/src/ui/listbox/ListboxOptions.stx +16 -0
- package/src/ui/listbox/README.md +143 -0
- package/src/ui/listbox/index.ts +39 -0
- package/src/ui/navigator/Navigator.stx +138 -0
- package/src/ui/navigator/README.md +352 -0
- package/src/ui/navigator/index.ts +20 -0
- package/src/ui/notification/Notification.stx +71 -0
- package/src/ui/notification/README.md +118 -0
- package/src/ui/notification/index.ts +12 -0
- package/src/ui/pagination/Pagination.stx +183 -0
- package/src/ui/pagination/index.ts +11 -0
- package/src/ui/payment/Checkout.stx +39 -0
- package/src/ui/payment/DefaultPaymentMethod.stx +62 -0
- package/src/ui/payment/PaymentMethods.stx +113 -0
- package/src/ui/payment/README.md +427 -0
- package/src/ui/payment/SubscriptionCheckout.stx +353 -0
- package/src/ui/payment/index.ts +59 -0
- package/src/ui/popover/Popover.stx +24 -0
- package/src/ui/popover/PopoverButton.stx +23 -0
- package/src/ui/popover/PopoverPanel.stx +23 -0
- package/src/ui/popover/README.md +95 -0
- package/src/ui/popover/index.ts +22 -0
- package/src/ui/portal/Portal.stx +74 -0
- package/src/ui/portal/index.ts +6 -0
- package/src/ui/progress/Progress.stx +142 -0
- package/src/ui/progress/index.ts +12 -0
- package/src/ui/radio/Radio.stx +81 -0
- package/src/ui/radio/index.ts +15 -0
- package/src/ui/radio-group/README.md +145 -0
- package/src/ui/radio-group/RadioGroup.stx +13 -0
- package/src/ui/radio-group/RadioGroupDescription.stx +11 -0
- package/src/ui/radio-group/RadioGroupLabel.stx +11 -0
- package/src/ui/radio-group/RadioGroupOption.stx +51 -0
- package/src/ui/radio-group/index.ts +30 -0
- package/src/ui/select/README.md +204 -0
- package/src/ui/select/Select.stx +89 -0
- package/src/ui/select/index.ts +21 -0
- package/src/ui/sidebar/Sidebar.stx +288 -0
- package/src/ui/sidebar/SidebarFooter.stx +95 -0
- package/src/ui/sidebar/SidebarHeader.stx +100 -0
- package/src/ui/sidebar/SidebarItem.stx +118 -0
- package/src/ui/sidebar/SidebarSection.stx +108 -0
- package/src/ui/sidebar/index.ts +175 -0
- package/src/ui/skeleton/Skeleton.stx +48 -0
- package/src/ui/skeleton/index.ts +11 -0
- package/src/ui/spinner/Spinner.stx +109 -0
- package/src/ui/spinner/index.ts +9 -0
- package/src/ui/stepper/README.md +36 -0
- package/src/ui/stepper/Stepper.stx +17 -0
- package/src/ui/stepper/StepperStep.stx +53 -0
- package/src/ui/stepper/index.ts +19 -0
- package/src/ui/storage/README.md +193 -0
- package/src/ui/storage/index.ts +347 -0
- package/src/ui/switch/README.md +133 -0
- package/src/ui/switch/Switch.stx +74 -0
- package/src/ui/switch/index.ts +10 -0
- package/src/ui/table/README.md +39 -0
- package/src/ui/table/Table.stx +14 -0
- package/src/ui/table/TableBody.stx +10 -0
- package/src/ui/table/TableCell.stx +10 -0
- package/src/ui/table/TableHead.stx +10 -0
- package/src/ui/table/TableHeader.stx +13 -0
- package/src/ui/table/TableRow.stx +11 -0
- package/src/ui/table/index.ts +35 -0
- package/src/ui/tabs/Tabs.stx +145 -0
- package/src/ui/tabs/index.ts +16 -0
- package/src/ui/teleport/Teleport.stx +101 -0
- package/src/ui/teleport/index.ts +7 -0
- package/src/ui/textarea/Textarea.stx +119 -0
- package/src/ui/textarea/index.ts +20 -0
- package/src/ui/tooltip/Tooltip.stx +76 -0
- package/src/ui/tooltip/index.ts +10 -0
- package/src/ui/transition/README.md +30 -0
- package/src/ui/transition/Transition.stx +174 -0
- package/src/ui/transition/index.ts +25 -0
- package/src/ui/video/README.md +48 -0
- package/src/ui/video/Video.stx +45 -0
- package/src/ui/video/index.ts +16 -0
- package/src/ui/virtual-list/VirtualList.stx +83 -0
- package/src/ui/virtual-list/index.ts +10 -0
- package/src/ui/virtual-table/VirtualTable.stx +113 -0
- package/src/ui/virtual-table/index.ts +21 -0
- package/src/utils/PROP_VALIDATION.md +458 -0
- package/src/utils/THEME_SYSTEM.md +702 -0
- package/src/utils/accessibility.ts +841 -0
- package/src/utils/animation/easing.ts +368 -0
- package/src/utils/animation/helpers.ts +223 -0
- package/src/utils/animation/index.ts +5 -0
- package/src/utils/animation/keyframes.ts +230 -0
- package/src/utils/error-handling.ts +473 -0
- package/src/utils/highlighter.ts +93 -0
- package/src/utils/i18n.ts +634 -0
- package/src/utils/keep-alive.ts +818 -0
- package/src/utils/lazy-loading.ts +530 -0
- package/src/utils/prop-validation.ts +478 -0
- package/src/utils/theme.ts +626 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export const value = $props.value || 0
|
|
3
|
+
export const max = $props.max || 100
|
|
4
|
+
export const variant = $props.variant || 'linear'
|
|
5
|
+
export const size = $props.size || 'md'
|
|
6
|
+
export const color = $props.color || 'primary'
|
|
7
|
+
export const showLabel = $props.showLabel ?? false
|
|
8
|
+
export const indeterminate = $props.indeterminate || false
|
|
9
|
+
export const className = $props.className || ''
|
|
10
|
+
|
|
11
|
+
// Calculate percentage
|
|
12
|
+
const percentage = Math.min(Math.max((value / max) * 100, 0), 100)
|
|
13
|
+
|
|
14
|
+
// Size classes for linear
|
|
15
|
+
const linearSizeClasses = {
|
|
16
|
+
sm: 'h-1',
|
|
17
|
+
md: 'h-2',
|
|
18
|
+
lg: 'h-3',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Size classes for circular
|
|
22
|
+
const circularSizeClasses = {
|
|
23
|
+
sm: 'w-12 h-12',
|
|
24
|
+
md: 'w-16 h-16',
|
|
25
|
+
lg: 'w-24 h-24',
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Color classes
|
|
29
|
+
const colorClasses = {
|
|
30
|
+
primary: 'bg-blue-600 dark:bg-blue-500',
|
|
31
|
+
secondary: 'bg-purple-600 dark:bg-purple-500',
|
|
32
|
+
success: 'bg-green-600 dark:bg-green-500',
|
|
33
|
+
warning: 'bg-yellow-600 dark:bg-yellow-500',
|
|
34
|
+
danger: 'bg-red-600 dark:bg-red-500',
|
|
35
|
+
info: 'bg-cyan-600 dark:bg-cyan-500',
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Circular SVG values
|
|
39
|
+
const circularSize = size === 'sm' ? 48 : size === 'md' ? 64 : 96
|
|
40
|
+
const strokeWidth = size === 'sm' ? 4 : size === 'md' ? 6 : 8
|
|
41
|
+
const radius = (circularSize - strokeWidth) / 2
|
|
42
|
+
const circumference = 2 * Math.PI * radius
|
|
43
|
+
const strokeDashoffset = indeterminate ? 0 : circumference - (percentage / 100) * circumference
|
|
44
|
+
|
|
45
|
+
export const containerClasses = variant === 'linear'
|
|
46
|
+
? `w-full ${className}`.trim()
|
|
47
|
+
: `inline-flex items-center justify-center ${className}`.trim()
|
|
48
|
+
|
|
49
|
+
export const linearTrackClasses = `w-full ${linearSizeClasses[size]} bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden`.trim()
|
|
50
|
+
export const linearBarClasses = `h-full ${colorClasses[color]} transition-all duration-300 ease-in-out ${indeterminate ? 'animate-progress-indeterminate' : ''}`.trim()
|
|
51
|
+
export const labelClasses = `text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`.trim()
|
|
52
|
+
export const circularTrackColor = 'stroke-gray-200 dark:stroke-gray-700'
|
|
53
|
+
export const circularBarColor = color === 'primary' ? 'stroke-blue-600 dark:stroke-blue-500' :
|
|
54
|
+
color === 'secondary' ? 'stroke-purple-600 dark:stroke-purple-500' :
|
|
55
|
+
color === 'success' ? 'stroke-green-600 dark:stroke-green-500' :
|
|
56
|
+
color === 'warning' ? 'stroke-yellow-600 dark:stroke-yellow-500' :
|
|
57
|
+
color === 'danger' ? 'stroke-red-600 dark:stroke-red-500' :
|
|
58
|
+
'stroke-cyan-600 dark:stroke-cyan-500'
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
@if(variant === 'linear')
|
|
62
|
+
<div class="{{ containerClasses }}">
|
|
63
|
+
@if(showLabel)
|
|
64
|
+
<div class="flex items-center justify-between mb-2">
|
|
65
|
+
<span class="{{ labelClasses }}">{{ Math.round(percentage) }}%</span>
|
|
66
|
+
</div>
|
|
67
|
+
@endif
|
|
68
|
+
|
|
69
|
+
<div
|
|
70
|
+
class="{{ linearTrackClasses }}"
|
|
71
|
+
role="progressbar"
|
|
72
|
+
aria-valuenow="{{ value }}"
|
|
73
|
+
aria-valuemin="0"
|
|
74
|
+
aria-valuemax="{{ max }}"
|
|
75
|
+
>
|
|
76
|
+
<div
|
|
77
|
+
class="{{ linearBarClasses }}"
|
|
78
|
+
style="width: {{ indeterminate ? '30%' : percentage + '%' }}"
|
|
79
|
+
></div>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
@else
|
|
83
|
+
<!-- Circular Progress -->
|
|
84
|
+
<div class="{{ containerClasses }}">
|
|
85
|
+
<div class="{{ circularSizeClasses[size] }} relative">
|
|
86
|
+
<svg
|
|
87
|
+
class="transform -rotate-90"
|
|
88
|
+
width="{{ circularSize }}"
|
|
89
|
+
height="{{ circularSize }}"
|
|
90
|
+
role="progressbar"
|
|
91
|
+
aria-valuenow="{{ value }}"
|
|
92
|
+
aria-valuemin="0"
|
|
93
|
+
aria-valuemax="{{ max }}"
|
|
94
|
+
>
|
|
95
|
+
<!-- Background circle -->
|
|
96
|
+
<circle
|
|
97
|
+
class="{{ circularTrackColor }}"
|
|
98
|
+
cx="{{ circularSize / 2 }}"
|
|
99
|
+
cy="{{ circularSize / 2 }}"
|
|
100
|
+
r="{{ radius }}"
|
|
101
|
+
stroke-width="{{ strokeWidth }}"
|
|
102
|
+
fill="none"
|
|
103
|
+
/>
|
|
104
|
+
<!-- Progress circle -->
|
|
105
|
+
<circle
|
|
106
|
+
class="{{ circularBarColor }} transition-all duration-300 ease-in-out {{ indeterminate ? 'animate-spin' : '' }}"
|
|
107
|
+
cx="{{ circularSize / 2 }}"
|
|
108
|
+
cy="{{ circularSize / 2 }}"
|
|
109
|
+
r="{{ radius }}"
|
|
110
|
+
stroke-width="{{ strokeWidth }}"
|
|
111
|
+
fill="none"
|
|
112
|
+
stroke-dasharray="{{ circumference }}"
|
|
113
|
+
stroke-dashoffset="{{ strokeDashoffset }}"
|
|
114
|
+
stroke-linecap="round"
|
|
115
|
+
/>
|
|
116
|
+
</svg>
|
|
117
|
+
|
|
118
|
+
@if(showLabel)
|
|
119
|
+
<div class="absolute inset-0 flex items-center justify-center">
|
|
120
|
+
<span class="text-sm font-semibold text-gray-700 dark:text-gray-300">
|
|
121
|
+
{{ Math.round(percentage) }}%
|
|
122
|
+
</span>
|
|
123
|
+
</div>
|
|
124
|
+
@endif
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
@endif
|
|
128
|
+
|
|
129
|
+
<style>
|
|
130
|
+
@keyframes progress-indeterminate {
|
|
131
|
+
0% {
|
|
132
|
+
transform: translateX(-100%);
|
|
133
|
+
}
|
|
134
|
+
100% {
|
|
135
|
+
transform: translateX(400%);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.animate-progress-indeterminate {
|
|
140
|
+
animation: progress-indeterminate 1.5s ease-in-out infinite;
|
|
141
|
+
}
|
|
142
|
+
</style>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export const checked = $props.checked || false
|
|
3
|
+
export const onChange = $props.onChange || (() => {})
|
|
4
|
+
export const disabled = $props.disabled || false
|
|
5
|
+
export const size = $props.size || 'md'
|
|
6
|
+
export const label = $props.label || ''
|
|
7
|
+
export const description = $props.description || ''
|
|
8
|
+
export const error = $props.error || false
|
|
9
|
+
export const required = $props.required || false
|
|
10
|
+
export const value = $props.value || ''
|
|
11
|
+
export const name = $props.name || ''
|
|
12
|
+
export const className = $props.className || ''
|
|
13
|
+
|
|
14
|
+
// Size classes
|
|
15
|
+
const sizeClasses = {
|
|
16
|
+
sm: 'h-4 w-4',
|
|
17
|
+
md: 'h-5 w-5',
|
|
18
|
+
lg: 'h-6 w-6',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Base classes for radio
|
|
22
|
+
const baseClasses = 'border-gray-300 dark:border-gray-600 text-indigo-600 dark:text-indigo-500 focus:ring-indigo-600 dark:focus:ring-indigo-500 focus:ring-2 focus:ring-offset-2 dark:focus:ring-offset-gray-900 transition-colors'
|
|
23
|
+
|
|
24
|
+
const stateClasses = error
|
|
25
|
+
? 'border-red-300 dark:border-red-600 text-red-600 dark:text-red-500 focus:ring-red-500 dark:focus:ring-red-400'
|
|
26
|
+
: ''
|
|
27
|
+
|
|
28
|
+
const disabledClasses = disabled
|
|
29
|
+
? 'opacity-50 cursor-not-allowed'
|
|
30
|
+
: 'cursor-pointer'
|
|
31
|
+
|
|
32
|
+
export const radioClasses = `${baseClasses} ${sizeClasses[size]} ${stateClasses} ${disabledClasses}`.trim()
|
|
33
|
+
export const labelClasses = `text-sm font-medium ${error ? 'text-red-600 dark:text-red-400' : 'text-gray-900 dark:text-gray-100'} ${disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'}`.trim()
|
|
34
|
+
export const descriptionClasses = `text-sm ${error ? 'text-red-500 dark:text-red-400' : 'text-gray-500 dark:text-gray-400'}`.trim()
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<div class="relative flex items-start {{ className }}">
|
|
38
|
+
<div class="flex h-6 items-center">
|
|
39
|
+
<input
|
|
40
|
+
id="radio-{{ value || label }}"
|
|
41
|
+
type="radio"
|
|
42
|
+
name="{{ name }}"
|
|
43
|
+
value="{{ value }}"
|
|
44
|
+
checked="{{ checked }}"
|
|
45
|
+
disabled="{{ disabled }}"
|
|
46
|
+
required="{{ required }}"
|
|
47
|
+
class="{{ radioClasses }}"
|
|
48
|
+
onchange="handleChange(event)"
|
|
49
|
+
aria-invalid="{{ error ? 'true' : 'false' }}"
|
|
50
|
+
@if(description)aria-describedby="radio-description"@endif
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
@if(label || description)
|
|
55
|
+
<div class="ml-3 text-sm leading-6">
|
|
56
|
+
@if(label)
|
|
57
|
+
<label for="radio-{{ value || label }}" class="{{ labelClasses }}">
|
|
58
|
+
{{ label }}
|
|
59
|
+
@if(required)
|
|
60
|
+
<span class="text-red-500 ml-1">*</span>
|
|
61
|
+
@endif
|
|
62
|
+
</label>
|
|
63
|
+
@endif
|
|
64
|
+
@if(description)
|
|
65
|
+
<p id="radio-description" class="{{ descriptionClasses }}">
|
|
66
|
+
{{ description }}
|
|
67
|
+
</p>
|
|
68
|
+
@endif
|
|
69
|
+
</div>
|
|
70
|
+
@endif
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<script>
|
|
74
|
+
function handleChange(event) {
|
|
75
|
+
const isChecked = event.target.checked
|
|
76
|
+
|
|
77
|
+
if (!disabled && onChange) {
|
|
78
|
+
onChange(value, isChecked)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
</script>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export const value = $props.value
|
|
3
|
+
export const onChange = $props.onChange
|
|
4
|
+
export const className = $props.className || ''
|
|
5
|
+
export const as = $props.as || 'div'
|
|
6
|
+
|
|
7
|
+
const baseClasses = 'w-full'
|
|
8
|
+
const groupClasses = `${baseClasses} ${className}`.trim()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<component :is="{{ as }}" class="{{ groupClasses }}" role="radiogroup">
|
|
12
|
+
<slot :value="value" :onChange="onChange" />
|
|
13
|
+
</component>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export const className = $props.className || ''
|
|
3
|
+
export const as = $props.as || 'span'
|
|
4
|
+
|
|
5
|
+
const baseClasses = 'inline text-sm text-neutral-500 dark:text-neutral-400'
|
|
6
|
+
const descriptionClasses = `${baseClasses} ${className}`.trim()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<component :is="{{ as }}" class="{{ descriptionClasses }}">
|
|
10
|
+
<slot />
|
|
11
|
+
</component>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export const className = $props.className || ''
|
|
3
|
+
export const as = $props.as || 'label'
|
|
4
|
+
|
|
5
|
+
const baseClasses = 'block text-sm font-medium text-neutral-900 dark:text-white'
|
|
6
|
+
const labelClasses = `${baseClasses} ${className}`.trim()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<component :is="{{ as }}" class="{{ labelClasses }}">
|
|
10
|
+
<slot />
|
|
11
|
+
</component>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export const value = $props.value
|
|
3
|
+
export const disabled = $props.disabled || false
|
|
4
|
+
export const className = $props.className || ''
|
|
5
|
+
export const as = $props.as || 'div'
|
|
6
|
+
export const currentValue = $props.currentValue
|
|
7
|
+
export const onChange = $props.onChange
|
|
8
|
+
|
|
9
|
+
export let active = false
|
|
10
|
+
export const checked = currentValue === value
|
|
11
|
+
|
|
12
|
+
const baseClasses = 'relative flex cursor-pointer rounded-lg px-5 py-4 shadow-md focus:outline-none transition-all'
|
|
13
|
+
const stateClasses = checked
|
|
14
|
+
? 'bg-blue-900 bg-opacity-75 text-white dark:bg-blue-800'
|
|
15
|
+
: 'bg-white dark:bg-neutral-800'
|
|
16
|
+
const activeClasses = active
|
|
17
|
+
? 'ring-2 ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-300 dark:ring-offset-blue-700'
|
|
18
|
+
: ''
|
|
19
|
+
const disabledClasses = disabled
|
|
20
|
+
? 'opacity-50 cursor-not-allowed'
|
|
21
|
+
: ''
|
|
22
|
+
|
|
23
|
+
const optionClasses = `${baseClasses} ${stateClasses} ${activeClasses} ${disabledClasses} ${className}`.trim()
|
|
24
|
+
|
|
25
|
+
export function handleClick() {
|
|
26
|
+
if (disabled) return
|
|
27
|
+
onChange?.(value)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function handleFocus() {
|
|
31
|
+
if (!disabled) active = true
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function handleBlur() {
|
|
35
|
+
active = false
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<component
|
|
40
|
+
:is="{{ as }}"
|
|
41
|
+
class="{{ optionClasses }}"
|
|
42
|
+
role="radio"
|
|
43
|
+
aria-checked="{{ checked ? 'true' : 'false' }}"
|
|
44
|
+
@if(disabled)aria-disabled="true"@endif
|
|
45
|
+
tabindex="{{ disabled ? '-1' : '0' }}"
|
|
46
|
+
@click="handleClick"
|
|
47
|
+
@focus="handleFocus"
|
|
48
|
+
@blur="handleBlur"
|
|
49
|
+
>
|
|
50
|
+
<slot :active="active" :checked="checked" :disabled="disabled" />
|
|
51
|
+
</component>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export const value = $props.value || ''
|
|
3
|
+
export const onChange = $props.onChange || (() => {})
|
|
4
|
+
export const onSearch = $props.onSearch || (() => {})
|
|
5
|
+
export const placeholder = $props.placeholder || 'Search...'
|
|
6
|
+
export const disabled = $props.disabled || false
|
|
7
|
+
export const size = $props.size || 'md'
|
|
8
|
+
export const error = $props.error || false
|
|
9
|
+
export const label = $props.label || ''
|
|
10
|
+
export const helperText = $props.helperText || ''
|
|
11
|
+
export const loading = $props.loading || false
|
|
12
|
+
export const className = $props.className || ''
|
|
13
|
+
|
|
14
|
+
// Search icon SVG
|
|
15
|
+
const searchIcon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" /></svg>'
|
|
16
|
+
|
|
17
|
+
// Loading spinner SVG
|
|
18
|
+
const spinnerIcon = '<svg class="animate-spin" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg>'
|
|
19
|
+
|
|
20
|
+
export const rightIcon = loading ? spinnerIcon : undefined
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
@component('TextInput', {
|
|
24
|
+
value,
|
|
25
|
+
onChange,
|
|
26
|
+
placeholder,
|
|
27
|
+
disabled,
|
|
28
|
+
size,
|
|
29
|
+
error,
|
|
30
|
+
label,
|
|
31
|
+
helperText,
|
|
32
|
+
leftIcon: searchIcon,
|
|
33
|
+
rightIcon,
|
|
34
|
+
clearable: !loading,
|
|
35
|
+
className,
|
|
36
|
+
inputClassName: 'pr-20'
|
|
37
|
+
})
|
|
38
|
+
@endcomponent
|
|
39
|
+
|
|
40
|
+
<script>
|
|
41
|
+
// Debounce search to avoid excessive calls
|
|
42
|
+
let searchTimeout = null
|
|
43
|
+
|
|
44
|
+
function handleSearchInput(newValue) {
|
|
45
|
+
if (onChange) {
|
|
46
|
+
onChange(newValue)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Debounce the onSearch callback
|
|
50
|
+
if (searchTimeout) {
|
|
51
|
+
clearTimeout(searchTimeout)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
searchTimeout = setTimeout(() => {
|
|
55
|
+
if (onSearch) {
|
|
56
|
+
onSearch(newValue)
|
|
57
|
+
}
|
|
58
|
+
}, 300) // 300ms debounce
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Expose enhanced onChange handler
|
|
62
|
+
export const enhancedOnChange = handleSearchInput
|
|
63
|
+
</script>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export const value = $props.value || ''
|
|
3
|
+
export const onChange = $props.onChange || (() => {})
|
|
4
|
+
export const options = $props.options || []
|
|
5
|
+
export const placeholder = $props.placeholder || 'Select an option'
|
|
6
|
+
export const disabled = $props.disabled || false
|
|
7
|
+
export const size = $props.size || 'md'
|
|
8
|
+
export const error = $props.error || false
|
|
9
|
+
export const label = $props.label || ''
|
|
10
|
+
export const helperText = $props.helperText || ''
|
|
11
|
+
export const required = $props.required || false
|
|
12
|
+
export const className = $props.className || ''
|
|
13
|
+
|
|
14
|
+
// Size classes
|
|
15
|
+
const sizeClasses = {
|
|
16
|
+
sm: 'px-3 py-1.5 text-sm h-8',
|
|
17
|
+
md: 'px-4 py-2 text-base h-10',
|
|
18
|
+
lg: 'px-5 py-3 text-lg h-12',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Base and state classes
|
|
22
|
+
const baseClasses = 'block w-full border-0 rounded-md shadow-sm ring-1 ring-inset transition-colors duration-200 focus:ring-2 focus:ring-inset dark:bg-blue-gray-700 dark:text-gray-100'
|
|
23
|
+
|
|
24
|
+
const stateClasses = error
|
|
25
|
+
? 'ring-red-300 dark:ring-red-600 text-red-900 dark:text-red-300 placeholder-red-300 dark:placeholder-red-500 focus:ring-red-500 dark:focus:ring-red-400'
|
|
26
|
+
: 'ring-gray-300 dark:ring-gray-600 text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-indigo-600 dark:focus:ring-indigo-400'
|
|
27
|
+
|
|
28
|
+
const disabledClasses = disabled
|
|
29
|
+
? 'opacity-50 cursor-not-allowed bg-gray-50 dark:bg-gray-800'
|
|
30
|
+
: 'bg-white dark:bg-blue-gray-700 cursor-pointer hover:ring-gray-400 dark:hover:ring-gray-500'
|
|
31
|
+
|
|
32
|
+
export const selectClasses = `${baseClasses} ${sizeClasses[size]} ${stateClasses} ${disabledClasses} ${className}`.trim()
|
|
33
|
+
export const labelClasses = `block text-sm font-medium leading-6 ${error ? 'text-red-600 dark:text-red-400' : 'text-gray-900 dark:text-gray-100'}`.trim()
|
|
34
|
+
export const helperClasses = `mt-2 text-sm ${error ? 'text-red-600 dark:text-red-400' : 'text-gray-500 dark:text-gray-400'}`.trim()
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<div class="w-full">
|
|
38
|
+
@if(label)
|
|
39
|
+
<label for="select-{{ value }}" class="{{ labelClasses }}">
|
|
40
|
+
{{ label }}
|
|
41
|
+
@if(required)
|
|
42
|
+
<span class="text-red-500 ml-1">*</span>
|
|
43
|
+
@endif
|
|
44
|
+
</label>
|
|
45
|
+
@endif
|
|
46
|
+
|
|
47
|
+
<div class="{{ label ? 'mt-2' : '' }}">
|
|
48
|
+
<select
|
|
49
|
+
id="select-{{ value }}"
|
|
50
|
+
class="{{ selectClasses }}"
|
|
51
|
+
value="{{ value }}"
|
|
52
|
+
disabled="{{ disabled }}"
|
|
53
|
+
required="{{ required }}"
|
|
54
|
+
onchange="handleChange(event)"
|
|
55
|
+
aria-invalid="{{ error ? 'true' : 'false' }}"
|
|
56
|
+
aria-describedby="{{ helperText ? 'helper-text' : '' }}"
|
|
57
|
+
>
|
|
58
|
+
@if(placeholder)
|
|
59
|
+
<option value="" disabled selected>{{ placeholder }}</option>
|
|
60
|
+
@endif
|
|
61
|
+
|
|
62
|
+
@foreach(option in options)
|
|
63
|
+
<option
|
|
64
|
+
value="{{ option.value }}"
|
|
65
|
+
selected="{{ option.value === value }}"
|
|
66
|
+
disabled="{{ option.disabled }}"
|
|
67
|
+
>
|
|
68
|
+
{{ option.label }}
|
|
69
|
+
</option>
|
|
70
|
+
@endforeach
|
|
71
|
+
</select>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
@if(helperText)
|
|
75
|
+
<p id="helper-text" class="{{ helperClasses }}">
|
|
76
|
+
{{ helperText }}
|
|
77
|
+
</p>
|
|
78
|
+
@endif
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<script>
|
|
82
|
+
function handleChange(event) {
|
|
83
|
+
const newValue = event.target.value
|
|
84
|
+
|
|
85
|
+
if (onChange) {
|
|
86
|
+
onChange(newValue)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
</script>
|