@umbra.ui/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/controls/Dropdown/types.d.ts +5 -0
- package/dist/components/controls/Dropdown/types.d.ts.map +1 -0
- package/dist/components/controls/Dropdown/types.js +1 -0
- package/dist/components/controls/SegmentedControl/types.d.ts +6 -0
- package/dist/components/controls/SegmentedControl/types.d.ts.map +1 -0
- package/dist/components/controls/SegmentedControl/types.js +1 -0
- package/dist/components/dialogs/Alert/types.d.ts +7 -0
- package/dist/components/dialogs/Alert/types.d.ts.map +1 -0
- package/dist/components/dialogs/Alert/types.js +1 -0
- package/dist/components/dialogs/Toast/types.d.ts +34 -0
- package/dist/components/dialogs/Toast/types.d.ts.map +1 -0
- package/dist/components/dialogs/Toast/types.js +10 -0
- package/dist/components/dialogs/Toast/useToast.d.ts +36 -0
- package/dist/components/dialogs/Toast/useToast.d.ts.map +1 -0
- package/dist/components/dialogs/Toast/useToast.js +90 -0
- package/dist/components/indicators/Tooltip/tooltip.d.ts +3 -0
- package/dist/components/indicators/Tooltip/tooltip.d.ts.map +1 -0
- package/dist/components/indicators/Tooltip/tooltip.js +33 -0
- package/dist/components/indicators/Tooltip/types.d.ts +14 -0
- package/dist/components/indicators/Tooltip/types.d.ts.map +1 -0
- package/dist/components/indicators/Tooltip/types.js +1 -0
- package/dist/components/indicators/Tooltip/useTooltip.d.ts +18 -0
- package/dist/components/indicators/Tooltip/useTooltip.d.ts.map +1 -0
- package/dist/components/indicators/Tooltip/useTooltip.js +57 -0
- package/dist/components/inputs/Tags/tag-bar-styles.d.ts +14 -0
- package/dist/components/inputs/Tags/tag-bar-styles.d.ts.map +1 -0
- package/dist/components/inputs/Tags/tag-bar-styles.js +313 -0
- package/dist/components/inputs/Tags/types.d.ts +93 -0
- package/dist/components/inputs/Tags/types.d.ts.map +1 -0
- package/dist/components/inputs/Tags/types.js +216 -0
- package/dist/components/inputs/search/types.d.ts +9 -0
- package/dist/components/inputs/search/types.d.ts.map +1 -0
- package/dist/components/inputs/search/types.js +1 -0
- package/dist/components/navigation/adaptive/types.d.ts +16 -0
- package/dist/components/navigation/adaptive/types.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/types.js +1 -0
- package/dist/components/navigation/adaptive/useAdaptiveLayout.d.ts +27 -0
- package/dist/components/navigation/adaptive/useAdaptiveLayout.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useAdaptiveLayout.js +40 -0
- package/dist/components/navigation/adaptive/useBreakpoints.d.ts +6 -0
- package/dist/components/navigation/adaptive/useBreakpoints.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useBreakpoints.js +37 -0
- package/dist/components/navigation/adaptive/useContainerMonitor.d.ts +93 -0
- package/dist/components/navigation/adaptive/useContainerMonitor.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useContainerMonitor.js +145 -0
- package/dist/components/navigation/adaptive/useViewAnimation.d.ts +31 -0
- package/dist/components/navigation/adaptive/useViewAnimation.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useViewAnimation.js +591 -0
- package/dist/components/navigation/adaptive/useViewResize.d.ts +52 -0
- package/dist/components/navigation/adaptive/useViewResize.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useViewResize.js +146 -0
- package/dist/components/navigation/navstack/useNavigationStack.d.ts +25 -0
- package/dist/components/navigation/navstack/useNavigationStack.d.ts.map +1 -0
- package/dist/components/navigation/navstack/useNavigationStack.js +133 -0
- package/dist/components/navigation/slideover/useSlideoverController.d.ts +20 -0
- package/dist/components/navigation/slideover/useSlideoverController.d.ts.map +1 -0
- package/dist/components/navigation/slideover/useSlideoverController.js +267 -0
- package/dist/components/navigation/splitview/useSplitViewController.d.ts +20 -0
- package/dist/components/navigation/splitview/useSplitViewController.d.ts.map +1 -0
- package/dist/components/navigation/splitview/useSplitViewController.js +325 -0
- package/dist/components/navigation/tabcontroller/types.d.ts +21 -0
- package/dist/components/navigation/tabcontroller/types.d.ts.map +1 -0
- package/dist/components/navigation/tabcontroller/types.js +1 -0
- package/dist/components/navigation/tabcontroller/useTabController.d.ts +5 -0
- package/dist/components/navigation/tabcontroller/useTabController.d.ts.map +1 -0
- package/dist/components/navigation/tabcontroller/useTabController.js +10 -0
- package/dist/components/navigation/types.d.ts +8 -0
- package/dist/components/navigation/types.d.ts.map +1 -0
- package/dist/components/navigation/types.js +1 -0
- package/dist/components/pickers/CollectionPicker/types.d.ts +11 -0
- package/dist/components/pickers/CollectionPicker/types.d.ts.map +1 -0
- package/dist/components/pickers/CollectionPicker/types.js +1 -0
- package/dist/components/pickers/ColorPicker/colors.d.ts +13 -0
- package/dist/components/pickers/ColorPicker/colors.d.ts.map +1 -0
- package/dist/components/pickers/ColorPicker/colors.js +266 -0
- package/dist/components/pickers/FilePicker/types.d.ts +10 -0
- package/dist/components/pickers/FilePicker/types.d.ts.map +1 -0
- package/dist/components/pickers/FilePicker/types.js +1 -0
- package/dist/index.d.ts +91 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +196 -0
- package/dist/theme.d.ts +73 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +279 -0
- package/dist/themes/blank.d.ts +7 -0
- package/dist/themes/blank.d.ts.map +1 -0
- package/dist/themes/blank.js +543 -0
- package/dist/themes/crimson-dark.d.ts +4 -0
- package/dist/themes/crimson-dark.d.ts.map +1 -0
- package/dist/themes/crimson-dark.js +552 -0
- package/dist/themes/cyan-light.d.ts +4 -0
- package/dist/themes/cyan-light.d.ts.map +1 -0
- package/dist/themes/cyan-light.js +552 -0
- package/dist/themes/dark.d.ts +4 -0
- package/dist/themes/dark.d.ts.map +1 -0
- package/dist/themes/dark.js +551 -0
- package/dist/themes/gold-dark.d.ts +4 -0
- package/dist/themes/gold-dark.d.ts.map +1 -0
- package/dist/themes/gold-dark.js +552 -0
- package/dist/themes/grass-dark.d.ts +4 -0
- package/dist/themes/grass-dark.d.ts.map +1 -0
- package/dist/themes/grass-dark.js +552 -0
- package/dist/themes/indigo.d.ts +4 -0
- package/dist/themes/indigo.d.ts.map +1 -0
- package/dist/themes/indigo.js +552 -0
- package/dist/themes/light.d.ts +4 -0
- package/dist/themes/light.d.ts.map +1 -0
- package/dist/themes/light.js +551 -0
- package/dist/themes/orange-dark.d.ts +4 -0
- package/dist/themes/orange-dark.d.ts.map +1 -0
- package/dist/themes/orange-dark.js +551 -0
- package/dist/themes/orange-light.d.ts +4 -0
- package/dist/themes/orange-light.d.ts.map +1 -0
- package/dist/themes/orange-light.js +551 -0
- package/package.json +62 -0
- package/src/components/controls/Button/Button.vue +417 -0
- package/src/components/controls/Button/README.md +348 -0
- package/src/components/controls/Button/theme.css +200 -0
- package/src/components/controls/Checkbox/Checkbox.vue +164 -0
- package/src/components/controls/Checkbox/README.md +441 -0
- package/src/components/controls/Checkbox/theme.css +36 -0
- package/src/components/controls/Dropdown/Dropdown.vue +476 -0
- package/src/components/controls/Dropdown/README.md +370 -0
- package/src/components/controls/Dropdown/theme.css +50 -0
- package/src/components/controls/Dropdown/types.ts +6 -0
- package/src/components/controls/IconButton/IconButton.vue +267 -0
- package/src/components/controls/IconButton/README.md +502 -0
- package/src/components/controls/IconButton/theme.css +89 -0
- package/src/components/controls/Radio/README.md +591 -0
- package/src/components/controls/Radio/Radio.vue +89 -0
- package/src/components/controls/Radio/theme.css +14 -0
- package/src/components/controls/RangeSlider/README.md +608 -0
- package/src/components/controls/RangeSlider/RangeSlider.vue +535 -0
- package/src/components/controls/RangeSlider/theme.css +80 -0
- package/src/components/controls/SegmentedControl/README.md +587 -0
- package/src/components/controls/SegmentedControl/SegmentedControl.vue +284 -0
- package/src/components/controls/SegmentedControl/theme.css +60 -0
- package/src/components/controls/SegmentedControl/types.ts +5 -0
- package/src/components/controls/Slider/README.md +627 -0
- package/src/components/controls/Slider/Slider.vue +260 -0
- package/src/components/controls/Slider/theme.css +74 -0
- package/src/components/controls/Stepper/README.md +601 -0
- package/src/components/controls/Stepper/Stepper.vue +103 -0
- package/src/components/controls/Stepper/theme.css +53 -0
- package/src/components/controls/Switch/README.md +667 -0
- package/src/components/controls/Switch/Switch.vue +127 -0
- package/src/components/controls/Switch/theme.css +42 -0
- package/src/components/dialogs/Alert/Alert.vue +218 -0
- package/src/components/dialogs/Alert/README.md +450 -0
- package/src/components/dialogs/Alert/theme.css +44 -0
- package/src/components/dialogs/Alert/types.ts +11 -0
- package/src/components/dialogs/Toast/README.md +522 -0
- package/src/components/dialogs/Toast/Toast.vue +296 -0
- package/src/components/dialogs/Toast/ToastContainer.vue +330 -0
- package/src/components/dialogs/Toast/theme.css +44 -0
- package/src/components/dialogs/Toast/types.ts +46 -0
- package/src/components/dialogs/Toast/useToast.ts +127 -0
- package/src/components/indicators/ProgressBar/ProgressBar.vue +98 -0
- package/src/components/indicators/ProgressBar/README.md +744 -0
- package/src/components/indicators/ProgressBar/theme.css +36 -0
- package/src/components/indicators/Tooltip/README.md +723 -0
- package/src/components/indicators/Tooltip/TooltipProvider.vue +142 -0
- package/src/components/indicators/Tooltip/theme.css +18 -0
- package/src/components/indicators/Tooltip/tooltip.ts +48 -0
- package/src/components/indicators/Tooltip/types.ts +15 -0
- package/src/components/indicators/Tooltip/useTooltip.ts +71 -0
- package/src/components/inputs/AutogrowTextView/AutogrowTextView.vue +110 -0
- package/src/components/inputs/AutogrowTextView/README.md +643 -0
- package/src/components/inputs/AutogrowTextView/theme.css +28 -0
- package/src/components/inputs/InputCard/InputCard.vue +600 -0
- package/src/components/inputs/InputCard/README.md +636 -0
- package/src/components/inputs/InputEmail/InputEmail.vue +698 -0
- package/src/components/inputs/InputEmail/README.md +764 -0
- package/src/components/inputs/InputNumber/InputNumber.vue +300 -0
- package/src/components/inputs/InputNumber/README.md +749 -0
- package/src/components/inputs/InputPhone/InputPhone.vue +645 -0
- package/src/components/inputs/InputPhone/README.md +636 -0
- package/src/components/inputs/InputSecure/InputSecure.vue +646 -0
- package/src/components/inputs/InputSecure/README.md +771 -0
- package/src/components/inputs/InputText/InputText.vue +225 -0
- package/src/components/inputs/InputText/README.md +844 -0
- package/src/components/inputs/OTP/OTP.vue +349 -0
- package/src/components/inputs/OTP/README.md +736 -0
- package/src/components/inputs/OTP/theme.css +50 -0
- package/src/components/inputs/StringCapture/README.md +718 -0
- package/src/components/inputs/StringCapture/StringCapture.vue +315 -0
- package/src/components/inputs/StringCapture/theme.css +86 -0
- package/src/components/inputs/Tags/README.md +897 -0
- package/src/components/inputs/Tags/TagBar.vue +793 -0
- package/src/components/inputs/Tags/TagCreation.vue +219 -0
- package/src/components/inputs/Tags/TagPicker.vue +380 -0
- package/src/components/inputs/Tags/tag-bar-styles.ts +354 -0
- package/src/components/inputs/Tags/theme.css +121 -0
- package/src/components/inputs/Tags/types.ts +346 -0
- package/src/components/inputs/search/README.md +759 -0
- package/src/components/inputs/search/SearchBar.vue +394 -0
- package/src/components/inputs/search/SearchResults.vue +310 -0
- package/src/components/inputs/search/theme.css +187 -0
- package/src/components/inputs/search/types.ts +8 -0
- package/src/components/inputs/theme.css +102 -0
- package/src/components/menus/ActionMenu/ActionMenu.vue +383 -0
- package/src/components/menus/ActionMenu/README.md +825 -0
- package/src/components/menus/ActionMenu/theme.css +93 -0
- package/src/components/models/Popover/Popover.vue +551 -0
- package/src/components/models/Popover/README.md +885 -0
- package/src/components/models/Popover/theme.css +52 -0
- package/src/components/models/Sheet/README.md +1159 -0
- package/src/components/models/Sheet/Sheet.vue +465 -0
- package/src/components/models/Sheet/theme.css +72 -0
- package/src/components/models/Sidebar/README.md +1228 -0
- package/src/components/models/Sidebar/Sidebar.vue +480 -0
- package/src/components/models/Sidebar/theme.css +90 -0
- package/src/components/navigation/adaptive/AdaptiveLayout.vue +779 -0
- package/src/components/navigation/adaptive/AdaptiveLayoutBreadcrumbs.vue +192 -0
- package/src/components/navigation/adaptive/AdaptiveLayoutMenuButton.vue +149 -0
- package/src/components/navigation/adaptive/README.md +768 -0
- package/src/components/navigation/adaptive/types.ts +19 -0
- package/src/components/navigation/adaptive/useAdaptiveLayout.ts +89 -0
- package/src/components/navigation/adaptive/useBreakpoints.ts +41 -0
- package/src/components/navigation/adaptive/useContainerMonitor.ts +214 -0
- package/src/components/navigation/adaptive/useViewAnimation.ts +721 -0
- package/src/components/navigation/adaptive/useViewResize.ts +211 -0
- package/src/components/navigation/navstack/NavigationStack.vue +180 -0
- package/src/components/navigation/navstack/README.md +994 -0
- package/src/components/navigation/navstack/useNavigationStack.ts +164 -0
- package/src/components/navigation/slideover/README.md +1275 -0
- package/src/components/navigation/slideover/SlideoverController.vue +287 -0
- package/src/components/navigation/slideover/useSlideoverController.ts +320 -0
- package/src/components/navigation/splitview/README.md +1115 -0
- package/src/components/navigation/splitview/SplitViewController.vue +176 -0
- package/src/components/navigation/splitview/useSplitViewController.ts +388 -0
- package/src/components/navigation/tabcontroller/README.md +919 -0
- package/src/components/navigation/tabcontroller/TabController.vue +307 -0
- package/src/components/navigation/tabcontroller/TabItem.vue +57 -0
- package/src/components/navigation/tabcontroller/types.ts +24 -0
- package/src/components/navigation/tabcontroller/useTabController.ts +18 -0
- package/src/components/navigation/theme.css +91 -0
- package/src/components/navigation/types.ts +7 -0
- package/src/components/pickers/CollectionPicker/CollectionPicker.vue +398 -0
- package/src/components/pickers/CollectionPicker/README.md +1115 -0
- package/src/components/pickers/CollectionPicker/theme.css +14 -0
- package/src/components/pickers/CollectionPicker/types.ts +11 -0
- package/src/components/pickers/ColorPicker/ColorPicker.vue +376 -0
- package/src/components/pickers/ColorPicker/README.md +1439 -0
- package/src/components/pickers/ColorPicker/colors.ts +299 -0
- package/src/components/pickers/ColorPicker/theme.css +32 -0
- package/src/components/pickers/DatePicker/DatePicker.vue +660 -0
- package/src/components/pickers/DatePicker/README.md +1195 -0
- package/src/components/pickers/DatePicker/theme.css +22 -0
- package/src/components/pickers/FilePicker/FilePicker.vue +534 -0
- package/src/components/pickers/FilePicker/README.md +1542 -0
- package/src/components/pickers/FilePicker/theme.css +48 -0
- package/src/components/pickers/FilePicker/types.ts +10 -0
- package/src/components/pickers/IconPicker/IconPicker.vue +327 -0
- package/src/components/pickers/IconPicker/README.md +1161 -0
- package/src/components/pickers/IconPicker/theme.css +28 -0
- package/src/components/pickers/theme.css +82 -0
- package/src/components/views/MarkdownViewer/MarkdownViewer.vue +442 -0
- package/src/components/views/MarkdownViewer/README.md +833 -0
- package/src/components/views/MarkdownViewer/theme.css +130 -0
- package/src/index.ts +263 -0
- package/src/theme.ts +378 -0
- package/src/themes/crimson-dark.ts +556 -0
- package/src/themes/cyan-light.ts +556 -0
- package/src/themes/dark.ts +557 -0
- package/src/themes/gold-dark.ts +556 -0
- package/src/themes/grass-dark.ts +556 -0
- package/src/themes/indigo.ts +556 -0
- package/src/themes/light.ts +557 -0
- package/src/themes/orange-dark.ts +557 -0
- package/src/themes/orange-light.ts +557 -0
- package/src/vue.d.ts +45 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
# Button
|
|
2
|
+
|
|
3
|
+
A versatile and customizable button component built with Vue 3 Composition API and TypeScript. The Button component provides multiple visual styles, sizes, and states with built-in animations and accessibility features.
|
|
4
|
+
|
|
5
|
+
## Installation/Import
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { Button } from "@umbra-ui/core";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Dependencies:**
|
|
12
|
+
|
|
13
|
+
- Vue 3.x
|
|
14
|
+
- @umbra-ui/icons (for active state animation)
|
|
15
|
+
|
|
16
|
+
## Basic Usage
|
|
17
|
+
|
|
18
|
+
```vue
|
|
19
|
+
<script setup lang="ts">
|
|
20
|
+
import { Button } from "@umbra-ui/core";
|
|
21
|
+
|
|
22
|
+
const handleClick = (event: MouseEvent) => {
|
|
23
|
+
console.log("Button clicked!", event);
|
|
24
|
+
};
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<Button
|
|
29
|
+
title="Click me"
|
|
30
|
+
button-style="primary"
|
|
31
|
+
button-type="default"
|
|
32
|
+
@click="handleClick"
|
|
33
|
+
/>
|
|
34
|
+
</template>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Props
|
|
38
|
+
|
|
39
|
+
| Prop Name | Type | Required | Default | Description |
|
|
40
|
+
| ------------- | -------------------------------------------------------------------------------------------------------- | -------- | ---------------- | ------------------------------------ |
|
|
41
|
+
| `buttonType` | `"default" \| "outline" \| "capsule" \| "capline" \| "plain"` | No | `"default"` | Visual style variant of the button |
|
|
42
|
+
| `buttonStyle` | `"primary" \| "secondary" \| "tertiary" \| "quaternary" \| "warning" \| "danger" \| "info" \| "success"` | No | `"primary"` | Color scheme for the button |
|
|
43
|
+
| `buttonSize` | `"compact" \| "regular" \| "large"` | No | `"regular"` | Size variant of the button |
|
|
44
|
+
| `state` | `"normal" \| "active" \| "disabled"` | No | `"normal"` | Current state of the button |
|
|
45
|
+
| `title` | `string` | No | `"Button Title"` | Text content displayed in the button |
|
|
46
|
+
| `tooltip` | `string \| TooltipConfig` | No | - | Tooltip text or configuration object |
|
|
47
|
+
|
|
48
|
+
### Button Types
|
|
49
|
+
|
|
50
|
+
- **`default`**: Standard button with background color and rounded corners
|
|
51
|
+
- **`outline`**: Button with transparent background and colored border
|
|
52
|
+
- **`capsule`**: Fully rounded button with background color
|
|
53
|
+
- **`capline`**: Fully rounded button with transparent background and border
|
|
54
|
+
- **`plain`**: Minimal button with no background, border, or padding
|
|
55
|
+
|
|
56
|
+
### Button Styles
|
|
57
|
+
|
|
58
|
+
- **`primary`**: Blue color scheme (default)
|
|
59
|
+
- **`secondary`**: Gray color scheme
|
|
60
|
+
- **`tertiary`**: Light gray color scheme
|
|
61
|
+
- **`quaternary`**: Very light gray color scheme
|
|
62
|
+
- **`warning`**: Yellow color scheme
|
|
63
|
+
- **`danger`**: Red color scheme
|
|
64
|
+
- **`info`**: Purple color scheme
|
|
65
|
+
- **`success`**: Green color scheme
|
|
66
|
+
|
|
67
|
+
### Button Sizes
|
|
68
|
+
|
|
69
|
+
- **`compact`**: Small padding, smaller font size
|
|
70
|
+
- **`regular`**: Standard padding and font size
|
|
71
|
+
- **`large`**: Larger padding and font size
|
|
72
|
+
|
|
73
|
+
## Events
|
|
74
|
+
|
|
75
|
+
| Event Name | Payload Type | Description |
|
|
76
|
+
| -------------- | ------------------------------------ | ------------------------------------- |
|
|
77
|
+
| `click` | `MouseEvent` | Emitted when the button is clicked |
|
|
78
|
+
| `update:state` | `"normal" \| "active" \| "disabled"` | Emitted when the button state changes |
|
|
79
|
+
|
|
80
|
+
### Event Examples
|
|
81
|
+
|
|
82
|
+
```vue
|
|
83
|
+
<script setup lang="ts">
|
|
84
|
+
const handleClick = (event: MouseEvent) => {
|
|
85
|
+
console.log("Button clicked at:", event.clientX, event.clientY);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const handleStateChange = (newState: "normal" | "active" | "disabled") => {
|
|
89
|
+
console.log("Button state changed to:", newState);
|
|
90
|
+
};
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<template>
|
|
94
|
+
<Button
|
|
95
|
+
title="Click me"
|
|
96
|
+
@click="handleClick"
|
|
97
|
+
@update:state="handleStateChange"
|
|
98
|
+
/>
|
|
99
|
+
</template>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Slots
|
|
103
|
+
|
|
104
|
+
This component does not use slots. The button content is controlled via the `title` prop.
|
|
105
|
+
|
|
106
|
+
## Exposed Methods/Refs
|
|
107
|
+
|
|
108
|
+
This component does not expose any methods or refs via `defineExpose`.
|
|
109
|
+
|
|
110
|
+
## CSS Customization
|
|
111
|
+
|
|
112
|
+
The Button component uses CSS custom properties that can be overridden to customize the appearance:
|
|
113
|
+
|
|
114
|
+
### Color Variables
|
|
115
|
+
|
|
116
|
+
```css
|
|
117
|
+
/* Primary button colors */
|
|
118
|
+
--button-primary-bg: #0090ff;
|
|
119
|
+
--button-primary-text: #ffffff;
|
|
120
|
+
--button-primary-hover-bg: #0588f0;
|
|
121
|
+
|
|
122
|
+
/* Secondary button colors */
|
|
123
|
+
--button-secondary-bg: #8b8d98;
|
|
124
|
+
--button-secondary-text: #ffffff;
|
|
125
|
+
--button-secondary-hover-bg: #7e8087;
|
|
126
|
+
|
|
127
|
+
/* Tertiary button colors */
|
|
128
|
+
--button-tertiary-bg: #e3e5e8;
|
|
129
|
+
--button-tertiary-text: #1a1d23;
|
|
130
|
+
--button-tertiary-hover-bg: #d7d9dd;
|
|
131
|
+
|
|
132
|
+
/* Quaternary button colors */
|
|
133
|
+
--button-quaternary-bg: #f0f2f4;
|
|
134
|
+
--button-quaternary-text: #60646c;
|
|
135
|
+
--button-quaternary-hover-bg: #e8eaed;
|
|
136
|
+
|
|
137
|
+
/* Warning button colors */
|
|
138
|
+
--button-warning-bg: #ffe629;
|
|
139
|
+
--button-warning-text: #1a1d23;
|
|
140
|
+
--button-warning-hover-bg: #f5dc1f;
|
|
141
|
+
|
|
142
|
+
/* Danger button colors */
|
|
143
|
+
--button-danger-bg: #e5484d;
|
|
144
|
+
--button-danger-text: #ffffff;
|
|
145
|
+
--button-danger-hover-bg: #d73a3f;
|
|
146
|
+
|
|
147
|
+
/* Info button colors */
|
|
148
|
+
--button-info-bg: #5b5bd6;
|
|
149
|
+
--button-info-text: #ffffff;
|
|
150
|
+
--button-info-hover-bg: #4f4fc7;
|
|
151
|
+
|
|
152
|
+
/* Success button colors */
|
|
153
|
+
--button-success-bg: #30a46c;
|
|
154
|
+
--button-success-text: #ffffff;
|
|
155
|
+
--button-success-hover-bg: #2a8f5f;
|
|
156
|
+
|
|
157
|
+
/* State variables */
|
|
158
|
+
--button-active-opacity: 0.9;
|
|
159
|
+
--button-disabled-opacity: 0.5;
|
|
160
|
+
--button-active-overlay: rgba(0, 0, 0, 0.08);
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Custom Styling Example
|
|
164
|
+
|
|
165
|
+
```vue
|
|
166
|
+
<template>
|
|
167
|
+
<Button title="Custom Button" button-style="primary" class="custom-button" />
|
|
168
|
+
</template>
|
|
169
|
+
|
|
170
|
+
<style>
|
|
171
|
+
.custom-button {
|
|
172
|
+
--button-primary-bg: #ff6b6b;
|
|
173
|
+
--button-primary-hover-bg: #ff5252;
|
|
174
|
+
border-radius: 20px;
|
|
175
|
+
}
|
|
176
|
+
</style>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Examples
|
|
180
|
+
|
|
181
|
+
### Different Button Types
|
|
182
|
+
|
|
183
|
+
```vue
|
|
184
|
+
<script setup lang="ts">
|
|
185
|
+
import { Button } from "@umbra-ui/core";
|
|
186
|
+
</script>
|
|
187
|
+
|
|
188
|
+
<template>
|
|
189
|
+
<div class="button-examples">
|
|
190
|
+
<Button title="Default" button-type="default" />
|
|
191
|
+
<Button title="Outline" button-type="outline" />
|
|
192
|
+
<Button title="Capsule" button-type="capsule" />
|
|
193
|
+
<Button title="Capline" button-type="capline" />
|
|
194
|
+
<Button title="Plain" button-type="plain" />
|
|
195
|
+
</div>
|
|
196
|
+
</template>
|
|
197
|
+
|
|
198
|
+
<style module>
|
|
199
|
+
.button-examples {
|
|
200
|
+
display: flex;
|
|
201
|
+
gap: 1rem;
|
|
202
|
+
flex-wrap: wrap;
|
|
203
|
+
}
|
|
204
|
+
</style>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Different Button Styles
|
|
208
|
+
|
|
209
|
+
```vue
|
|
210
|
+
<script setup lang="ts">
|
|
211
|
+
import { Button } from "@umbra-ui/core";
|
|
212
|
+
</script>
|
|
213
|
+
|
|
214
|
+
<template>
|
|
215
|
+
<div class="style-examples">
|
|
216
|
+
<Button title="Primary" button-style="primary" />
|
|
217
|
+
<Button title="Secondary" button-style="secondary" />
|
|
218
|
+
<Button title="Tertiary" button-style="tertiary" />
|
|
219
|
+
<Button title="Warning" button-style="warning" />
|
|
220
|
+
<Button title="Danger" button-style="danger" />
|
|
221
|
+
<Button title="Info" button-style="info" />
|
|
222
|
+
<Button title="Success" button-style="success" />
|
|
223
|
+
</div>
|
|
224
|
+
</template>
|
|
225
|
+
|
|
226
|
+
<style module>
|
|
227
|
+
.style-examples {
|
|
228
|
+
display: flex;
|
|
229
|
+
gap: 1rem;
|
|
230
|
+
flex-wrap: wrap;
|
|
231
|
+
}
|
|
232
|
+
</style>
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Button States and Event Handling
|
|
236
|
+
|
|
237
|
+
```vue
|
|
238
|
+
<script setup lang="ts">
|
|
239
|
+
import { ref } from "vue";
|
|
240
|
+
import { Button } from "@umbra-ui/core";
|
|
241
|
+
|
|
242
|
+
const buttonState = ref<"normal" | "active" | "disabled">("normal");
|
|
243
|
+
const clickCount = ref(0);
|
|
244
|
+
|
|
245
|
+
const handleClick = (event: MouseEvent) => {
|
|
246
|
+
clickCount.value++;
|
|
247
|
+
console.log(`Button clicked ${clickCount.value} times`);
|
|
248
|
+
|
|
249
|
+
// Simulate loading state
|
|
250
|
+
buttonState.value = "active";
|
|
251
|
+
setTimeout(() => {
|
|
252
|
+
buttonState.value = "normal";
|
|
253
|
+
}, 2000);
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
const toggleDisabled = () => {
|
|
257
|
+
buttonState.value = buttonState.value === "disabled" ? "normal" : "disabled";
|
|
258
|
+
};
|
|
259
|
+
</script>
|
|
260
|
+
|
|
261
|
+
<template>
|
|
262
|
+
<div class="state-examples">
|
|
263
|
+
<Button
|
|
264
|
+
:title="`Clicked ${clickCount} times`"
|
|
265
|
+
:state="buttonState"
|
|
266
|
+
button-style="primary"
|
|
267
|
+
@click="handleClick"
|
|
268
|
+
/>
|
|
269
|
+
|
|
270
|
+
<Button
|
|
271
|
+
title="Toggle Disabled"
|
|
272
|
+
button-style="secondary"
|
|
273
|
+
@click="toggleDisabled"
|
|
274
|
+
/>
|
|
275
|
+
</div>
|
|
276
|
+
</template>
|
|
277
|
+
|
|
278
|
+
<style module>
|
|
279
|
+
.state-examples {
|
|
280
|
+
display: flex;
|
|
281
|
+
gap: 1rem;
|
|
282
|
+
align-items: center;
|
|
283
|
+
}
|
|
284
|
+
</style>
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Different Sizes
|
|
288
|
+
|
|
289
|
+
```vue
|
|
290
|
+
<script setup lang="ts">
|
|
291
|
+
import { Button } from "@umbra-ui/core";
|
|
292
|
+
</script>
|
|
293
|
+
|
|
294
|
+
<template>
|
|
295
|
+
<div class="size-examples">
|
|
296
|
+
<Button title="Compact" button-size="compact" />
|
|
297
|
+
<Button title="Regular" button-size="regular" />
|
|
298
|
+
<Button title="Large" button-size="large" />
|
|
299
|
+
</div>
|
|
300
|
+
</template>
|
|
301
|
+
|
|
302
|
+
<style module>
|
|
303
|
+
.size-examples {
|
|
304
|
+
display: flex;
|
|
305
|
+
gap: 1rem;
|
|
306
|
+
align-items: center;
|
|
307
|
+
}
|
|
308
|
+
</style>
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### With Tooltips
|
|
312
|
+
|
|
313
|
+
```vue
|
|
314
|
+
<script setup lang="ts">
|
|
315
|
+
import { Button } from "@umbra-ui/core";
|
|
316
|
+
</script>
|
|
317
|
+
|
|
318
|
+
<template>
|
|
319
|
+
<div class="tooltip-examples">
|
|
320
|
+
<Button title="Simple Tooltip" tooltip="This is a simple tooltip" />
|
|
321
|
+
|
|
322
|
+
<Button
|
|
323
|
+
title="Advanced Tooltip"
|
|
324
|
+
:tooltip="{
|
|
325
|
+
content: 'This is an advanced tooltip',
|
|
326
|
+
placement: 'top',
|
|
327
|
+
delay: 500,
|
|
328
|
+
}"
|
|
329
|
+
/>
|
|
330
|
+
</div>
|
|
331
|
+
</template>
|
|
332
|
+
|
|
333
|
+
<style module>
|
|
334
|
+
.tooltip-examples {
|
|
335
|
+
display: flex;
|
|
336
|
+
gap: 1rem;
|
|
337
|
+
}
|
|
338
|
+
</style>
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
## Notes
|
|
342
|
+
|
|
343
|
+
- The button includes smooth hover animations with scale transforms
|
|
344
|
+
- Active state shows a ripple animation using the `RippleAnimOutlineIcon`
|
|
345
|
+
- Disabled state applies grayscale filter and prevents pointer events
|
|
346
|
+
- All color schemes support both light and dark themes
|
|
347
|
+
- The component is fully accessible with proper ARIA attributes
|
|
348
|
+
- Box shadows are automatically applied for depth and visual hierarchy
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/* Light theme using Colors */
|
|
2
|
+
:root {
|
|
3
|
+
/* Primary button colors (using Blue) */
|
|
4
|
+
--button-primary-bg: #0090ff; /* blue9 */
|
|
5
|
+
--button-primary-text: #ffffff;
|
|
6
|
+
--button-primary-border: #0090ff; /* blue9 */
|
|
7
|
+
--button-primary-hover-bg: #0588f0; /* blue10 */
|
|
8
|
+
--button-primary-hover-text: #ffffff;
|
|
9
|
+
|
|
10
|
+
/* Secondary button colors (using Gray) */
|
|
11
|
+
--button-secondary-bg: #8b8d98; /* gray9 */
|
|
12
|
+
--button-secondary-text: #ffffff;
|
|
13
|
+
--button-secondary-border: #8b8d98; /* gray9 */
|
|
14
|
+
--button-secondary-hover-bg: #7e8087; /* gray10 */
|
|
15
|
+
--button-secondary-hover-text: #ffffff;
|
|
16
|
+
|
|
17
|
+
/* Tertiary button colors (using Gray lighter) */
|
|
18
|
+
--button-tertiary-bg: #e3e5e8; /* gray5 */
|
|
19
|
+
--button-tertiary-text: #1a1d23; /* gray12 */
|
|
20
|
+
--button-tertiary-border: #e3e5e8; /* gray5 */
|
|
21
|
+
--button-tertiary-hover-bg: #d7d9dd; /* gray6 */
|
|
22
|
+
--button-tertiary-hover-text: #1a1d23; /* gray12 */
|
|
23
|
+
|
|
24
|
+
/* Quaternary button colors (using Gray lightest) */
|
|
25
|
+
--button-quaternary-bg: #f0f2f4; /* gray3 */
|
|
26
|
+
--button-quaternary-text: #60646c; /* gray11 */
|
|
27
|
+
--button-quaternary-border: #f0f2f4; /* gray3 */
|
|
28
|
+
--button-quaternary-hover-bg: #e8eaed; /* gray4 */
|
|
29
|
+
--button-quaternary-hover-text: #3e4149; /* gray12 */
|
|
30
|
+
|
|
31
|
+
/* Warning button colors */
|
|
32
|
+
--button-warning-bg: #ffe629;
|
|
33
|
+
--button-warning-text: #1a1d23;
|
|
34
|
+
--button-warning-border: #ffe629;
|
|
35
|
+
--button-warning-hover-bg: #f5dc1f;
|
|
36
|
+
--button-warning-hover-text: #1a1d23;
|
|
37
|
+
|
|
38
|
+
/* Danger button colors */
|
|
39
|
+
--button-danger-bg: #e5484d;
|
|
40
|
+
--button-danger-text: #ffffff;
|
|
41
|
+
--button-danger-border: #e5484d;
|
|
42
|
+
--button-danger-hover-bg: #d73a3f;
|
|
43
|
+
--button-danger-hover-text: #ffffff;
|
|
44
|
+
|
|
45
|
+
/* Info button colors */
|
|
46
|
+
--button-info-bg: #5b5bd6;
|
|
47
|
+
--button-info-text: #ffffff;
|
|
48
|
+
--button-info-border: #5b5bd6;
|
|
49
|
+
--button-info-hover-bg: #4f4fc7;
|
|
50
|
+
--button-info-hover-text: #ffffff;
|
|
51
|
+
|
|
52
|
+
/* Success button colors */
|
|
53
|
+
--button-success-bg: #30a46c;
|
|
54
|
+
--button-success-text: #ffffff;
|
|
55
|
+
--button-success-border: #30a46c;
|
|
56
|
+
--button-success-hover-bg: #2a8f5f;
|
|
57
|
+
--button-success-hover-text: #ffffff;
|
|
58
|
+
|
|
59
|
+
/* Outline specific colors */
|
|
60
|
+
--button-outline-primary-color: #0090ff; /* blue9 */
|
|
61
|
+
--button-outline-secondary-color: #8b8d98; /* gray9 */
|
|
62
|
+
--button-outline-tertiary-color: #9b9ea6; /* gray8 */
|
|
63
|
+
--button-outline-quaternary-color: #b2b5bd; /* gray7 */
|
|
64
|
+
--button-outline-warning-color: #ab6400;
|
|
65
|
+
--button-outline-danger-color: #e54d2e;
|
|
66
|
+
--button-outline-info-color: #5b5bd6;
|
|
67
|
+
--button-outline-success-color: #30a46c;
|
|
68
|
+
|
|
69
|
+
/* Capline specific colors */
|
|
70
|
+
--button-capline-primary-color: #0090ff; /* blue9 */
|
|
71
|
+
--button-capline-secondary-color: #8b8d98; /* gray9 */
|
|
72
|
+
--button-capline-tertiary-color: #9b9ea6; /* gray8 */
|
|
73
|
+
--button-capline-quaternary-color: #b2b5bd; /* gray7 */
|
|
74
|
+
--button-capline-warning-color: #ab6400;
|
|
75
|
+
--button-capline-danger-color: #e54d2e;
|
|
76
|
+
--button-capline-info-color: #5b5bd6;
|
|
77
|
+
--button-capline-success-color: #30a46c;
|
|
78
|
+
|
|
79
|
+
/* Plain specific colors */
|
|
80
|
+
--button-plain-primary-color: #0090ff; /* blue9 */
|
|
81
|
+
--button-plain-secondary-color: #60646c; /* gray11 */
|
|
82
|
+
--button-plain-tertiary-color: #8b8d98; /* gray9 */
|
|
83
|
+
--button-plain-quaternary-color: #9b9ea6; /* gray8 */
|
|
84
|
+
--button-plain-warning-color: #ab6400;
|
|
85
|
+
--button-plain-danger-color: #e54d2e;
|
|
86
|
+
--button-plain-info-color: #5b5bd6;
|
|
87
|
+
--button-plain-success-color: #30a46c;
|
|
88
|
+
|
|
89
|
+
/* Active state colors */
|
|
90
|
+
--button-active-overlay: rgba(0, 0, 0, 0.08); /* blackA3 */
|
|
91
|
+
--button-active-opacity: 0.9;
|
|
92
|
+
|
|
93
|
+
/* Disabled state colors */
|
|
94
|
+
--button-disabled-opacity: 0.5;
|
|
95
|
+
|
|
96
|
+
/* Box shadow colors (using blackA for transparency) */
|
|
97
|
+
--button-shadow-dark: rgba(255, 255, 255, 0.7); /* ~whiteA11 */
|
|
98
|
+
--button-shadow-light: rgba(255, 255, 255, 0.7); /* ~whiteA11 */
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* Dark theme */
|
|
102
|
+
.dark,
|
|
103
|
+
.dark-theme {
|
|
104
|
+
/* Primary button colors */
|
|
105
|
+
--button-primary-bg: #0090ff;
|
|
106
|
+
--button-primary-text: #ffffff;
|
|
107
|
+
--button-primary-border: #0090ff;
|
|
108
|
+
--button-primary-hover-bg: #0090ff;
|
|
109
|
+
--button-primary-hover-text: #ffffff;
|
|
110
|
+
|
|
111
|
+
/* Secondary button colors */
|
|
112
|
+
--button-secondary-bg: #484848;
|
|
113
|
+
--button-secondary-text: #ffffff;
|
|
114
|
+
--button-secondary-border: #484848;
|
|
115
|
+
--button-secondary-hover-bg: #484848;
|
|
116
|
+
--button-secondary-hover-text: #ffffff;
|
|
117
|
+
|
|
118
|
+
/* Tertiary button colors */
|
|
119
|
+
--button-tertiary-bg: #313131;
|
|
120
|
+
--button-tertiary-text: #ffffff;
|
|
121
|
+
--button-tertiary-border: #313131;
|
|
122
|
+
--button-tertiary-hover-bg: #313131;
|
|
123
|
+
--button-tertiary-hover-text: #ffffff;
|
|
124
|
+
|
|
125
|
+
/* Quaternary button colors */
|
|
126
|
+
--button-quaternary-bg: #222222;
|
|
127
|
+
--button-quaternary-text: #ffffff;
|
|
128
|
+
--button-quaternary-border: #222222;
|
|
129
|
+
--button-quaternary-hover-bg: #222222;
|
|
130
|
+
--button-quaternary-hover-text: #ffffff;
|
|
131
|
+
|
|
132
|
+
/* Warning button colors */
|
|
133
|
+
--button-warning-bg: #ffe629;
|
|
134
|
+
--button-warning-text: #1a1d23;
|
|
135
|
+
--button-warning-border: #ffe629;
|
|
136
|
+
--button-warning-hover-bg: #f5dc1f;
|
|
137
|
+
--button-warning-hover-text: #1a1d23;
|
|
138
|
+
|
|
139
|
+
/* Danger button colors */
|
|
140
|
+
--button-danger-bg: #e5484d;
|
|
141
|
+
--button-danger-text: #ffffff;
|
|
142
|
+
--button-danger-border: #e5484d;
|
|
143
|
+
--button-danger-hover-bg: #d73a3f;
|
|
144
|
+
--button-danger-hover-text: #ffffff;
|
|
145
|
+
|
|
146
|
+
/* Info button colors */
|
|
147
|
+
--button-info-bg: #5b5bd6;
|
|
148
|
+
--button-info-text: #ffffff;
|
|
149
|
+
--button-info-border: #5b5bd6;
|
|
150
|
+
--button-info-hover-bg: #4f4fc7;
|
|
151
|
+
--button-info-hover-text: #ffffff;
|
|
152
|
+
|
|
153
|
+
/* Success button colors */
|
|
154
|
+
--button-success-bg: #30a46c;
|
|
155
|
+
--button-success-text: #ffffff;
|
|
156
|
+
--button-success-border: #30a46c;
|
|
157
|
+
--button-success-hover-bg: #2a8f5f;
|
|
158
|
+
--button-success-hover-text: #ffffff;
|
|
159
|
+
|
|
160
|
+
/* Outline specific colors */
|
|
161
|
+
--button-outline-primary-color: #0090ff;
|
|
162
|
+
--button-outline-secondary-color: #eeeeee;
|
|
163
|
+
--button-outline-tertiary-color: #b4b4b4;
|
|
164
|
+
--button-outline-quaternary-color: #7b7b7b;
|
|
165
|
+
--button-outline-warning-color: #ffe629;
|
|
166
|
+
--button-outline-danger-color: #e5484d;
|
|
167
|
+
--button-outline-info-color: #5b5bd6;
|
|
168
|
+
--button-outline-success-color: #30a46c;
|
|
169
|
+
|
|
170
|
+
/* Capline specific colors */
|
|
171
|
+
--button-capline-primary-color: #0090ff;
|
|
172
|
+
--button-capline-secondary-color: #eeeeee;
|
|
173
|
+
--button-capline-tertiary-color: #b4b4b4;
|
|
174
|
+
--button-capline-quaternary-color: #7b7b7b;
|
|
175
|
+
--button-capline-warning-color: #ffe629;
|
|
176
|
+
--button-capline-danger-color: #e5484d;
|
|
177
|
+
--button-capline-info-color: #5b5bd6;
|
|
178
|
+
--button-capline-success-color: #30a46c;
|
|
179
|
+
|
|
180
|
+
/* Plain specific colors */
|
|
181
|
+
--button-plain-primary-color: #0090ff;
|
|
182
|
+
--button-plain-secondary-color: #eeeeee;
|
|
183
|
+
--button-plain-tertiary-color: #b4b4b4;
|
|
184
|
+
--button-plain-quaternary-color: #7b7b7b;
|
|
185
|
+
--button-plain-warning-color: #ffe629;
|
|
186
|
+
--button-plain-danger-color: #e5484d;
|
|
187
|
+
--button-plain-info-color: #5b5bd6;
|
|
188
|
+
--button-plain-success-color: #30a46c;
|
|
189
|
+
|
|
190
|
+
/* Active state colors */
|
|
191
|
+
--button-active-overlay: rgba(0, 0, 0, 0.5);
|
|
192
|
+
--button-active-opacity: 0.8;
|
|
193
|
+
|
|
194
|
+
/* Disabled state colors */
|
|
195
|
+
--button-disabled-opacity: 0.5;
|
|
196
|
+
|
|
197
|
+
/* Box shadow colors */
|
|
198
|
+
--button-shadow-dark: rgba(0, 0, 0, 0.21);
|
|
199
|
+
--button-shadow-light: rgba(255, 255, 255, 0.1);
|
|
200
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
import { CheckIcon, XmarkIcon } from "@umbra-ui/icons";
|
|
4
|
+
import "./theme.css";
|
|
5
|
+
|
|
6
|
+
export interface Props {
|
|
7
|
+
checkboxType?: "circle" | "square" | "plain";
|
|
8
|
+
isChecked?: boolean;
|
|
9
|
+
size?: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const emit = defineEmits(["update:isChecked"]);
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
15
|
+
checkboxType: "circle",
|
|
16
|
+
isChecked: false,
|
|
17
|
+
size: 24,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const onClick = () => {
|
|
21
|
+
emit("update:isChecked", !props.isChecked);
|
|
22
|
+
};
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<!-- Circle or Square -->
|
|
27
|
+
<div v-if="checkboxType !== 'plain'" :class="$style.checkbox">
|
|
28
|
+
<div
|
|
29
|
+
:class="[$style.checkbox_outer, $style[`checkbox_outer_${checkboxType}`]]"
|
|
30
|
+
@click="onClick"
|
|
31
|
+
:data-checked="isChecked"
|
|
32
|
+
:style="{
|
|
33
|
+
'--size': `${size! / 17}rem`,
|
|
34
|
+
}"
|
|
35
|
+
>
|
|
36
|
+
<div
|
|
37
|
+
:class="[
|
|
38
|
+
$style.checkbox_inner,
|
|
39
|
+
$style[`checkbox_inner_${checkboxType}`],
|
|
40
|
+
]"
|
|
41
|
+
>
|
|
42
|
+
<CheckIcon
|
|
43
|
+
v-if="checkboxType !== 'circle'"
|
|
44
|
+
:size="size! * 0.6"
|
|
45
|
+
:style="{ opacity: isChecked ? 1 : 0 }"
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
<!-- Plain -->
|
|
51
|
+
<div v-else :class="$style.plain_checkbox" @click="onClick">
|
|
52
|
+
<XmarkIcon :size="size" :style="{ opacity: isChecked ? 0 : 1 }" />
|
|
53
|
+
<CheckIcon :size="size" :style="{ opacity: isChecked ? 1 : 0 }" />
|
|
54
|
+
</div>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<style module>
|
|
58
|
+
.checkbox {
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
gap: 0.882rem;
|
|
62
|
+
cursor: default;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Shared outer styles */
|
|
66
|
+
.checkbox_outer {
|
|
67
|
+
/* Calculate inner size based on total size */
|
|
68
|
+
/* Original: inner was 15/17rem, padding was 4px, border was 1px */
|
|
69
|
+
/* Total was ~25px (15 + 4*2 + 1*2) at base size */
|
|
70
|
+
--inner-size: calc(var(--size) * 0.6); /* 15/25 = 0.6 */
|
|
71
|
+
--padding: calc(var(--size) * 0.16); /* 4/25 = 0.16 */
|
|
72
|
+
--border-width: max(1px, calc(var(--size) * 0.04)); /* 1/25 = 0.04 */
|
|
73
|
+
|
|
74
|
+
width: var(--size);
|
|
75
|
+
height: var(--size);
|
|
76
|
+
box-sizing: border-box;
|
|
77
|
+
border-width: var(--border-width);
|
|
78
|
+
border-style: solid;
|
|
79
|
+
border-color: var(--checkbox-border);
|
|
80
|
+
background-color: var(--checkbox-bg);
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
transition: 0.3s ease-in-out scale, 0.3s ease-in-out opacity,
|
|
83
|
+
0.3s ease-in-out background-color, 0.3s ease-in-out border-color;
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* Circle-specific outer styles */
|
|
90
|
+
.checkbox_outer_circle {
|
|
91
|
+
padding: var(--padding);
|
|
92
|
+
border-radius: 999px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* Square-specific outer styles */
|
|
96
|
+
.checkbox_outer_square {
|
|
97
|
+
--border-width: max(1.5px, calc(var(--size) * 0.06)); /* 1.5/25 = 0.06 */
|
|
98
|
+
border-radius: 0.4rem;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* Checked state for outer */
|
|
102
|
+
.checkbox_outer[data-checked="true"] {
|
|
103
|
+
border-color: var(--checkbox-checked-border);
|
|
104
|
+
background-color: transparent;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* Shared inner styles */
|
|
108
|
+
.checkbox_inner {
|
|
109
|
+
background-color: transparent;
|
|
110
|
+
transform: scale(0.5);
|
|
111
|
+
transition: 0.3s ease-in-out transform, 0.3s ease-in-out opacity,
|
|
112
|
+
0.3s ease-in-out background-color;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* Circle-specific inner styles */
|
|
116
|
+
.checkbox_inner_circle {
|
|
117
|
+
width: var(--inner-size);
|
|
118
|
+
height: var(--inner-size);
|
|
119
|
+
border-radius: 999px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/* Square-specific inner styles */
|
|
123
|
+
.checkbox_inner_square {
|
|
124
|
+
width: var(--size);
|
|
125
|
+
height: var(--size);
|
|
126
|
+
border-radius: 0.4rem;
|
|
127
|
+
display: flex;
|
|
128
|
+
align-items: center;
|
|
129
|
+
justify-content: center;
|
|
130
|
+
color: var(--checkbox-square-icon);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.checkbox_inner_square > :first-child {
|
|
134
|
+
transition: 0.5s ease-in-out opacity;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* Checked state for inner */
|
|
138
|
+
.checkbox_outer[data-checked="true"] .checkbox_inner {
|
|
139
|
+
background-color: var(--checkbox-checked-bg);
|
|
140
|
+
transform: scale(1);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/* Plain checkbox styles */
|
|
144
|
+
.plain_checkbox {
|
|
145
|
+
display: grid;
|
|
146
|
+
grid-template-columns: 1fr;
|
|
147
|
+
grid-template-rows: 1fr;
|
|
148
|
+
grid-template-areas: "content";
|
|
149
|
+
cursor: default;
|
|
150
|
+
width: var(--size);
|
|
151
|
+
height: var(--size);
|
|
152
|
+
padding: 0.1rem;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.plain_checkbox > :first-child {
|
|
156
|
+
grid-area: content;
|
|
157
|
+
color: var(--checkbox-plain-unchecked);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.plain_checkbox > :last-child {
|
|
161
|
+
grid-area: content;
|
|
162
|
+
color: var(--checkbox-plain-checked);
|
|
163
|
+
}
|
|
164
|
+
</style>
|