@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,441 @@
|
|
|
1
|
+
# Checkbox
|
|
2
|
+
|
|
3
|
+
A flexible and customizable checkbox component built with Vue 3 Composition API and TypeScript. The Checkbox component provides multiple visual styles with smooth animations and supports both light and dark themes.
|
|
4
|
+
|
|
5
|
+
## Installation/Import
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { Checkbox } from "@umbra-ui/core";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Dependencies:**
|
|
12
|
+
|
|
13
|
+
- Vue 3.x
|
|
14
|
+
- @umbra-ui/icons (for check and X mark icons)
|
|
15
|
+
|
|
16
|
+
## Basic Usage
|
|
17
|
+
|
|
18
|
+
```vue
|
|
19
|
+
<script setup lang="ts">
|
|
20
|
+
import { ref } from "vue";
|
|
21
|
+
import { Checkbox } from "@umbra-ui/core";
|
|
22
|
+
|
|
23
|
+
const isChecked = ref(false);
|
|
24
|
+
|
|
25
|
+
const handleCheckboxChange = (checked: boolean) => {
|
|
26
|
+
console.log("Checkbox state:", checked);
|
|
27
|
+
isChecked.value = checked;
|
|
28
|
+
};
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<Checkbox
|
|
33
|
+
:is-checked="isChecked"
|
|
34
|
+
checkbox-type="circle"
|
|
35
|
+
@update:is-checked="handleCheckboxChange"
|
|
36
|
+
/>
|
|
37
|
+
</template>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Props
|
|
41
|
+
|
|
42
|
+
| Prop Name | Type | Required | Default | Description |
|
|
43
|
+
| -------------- | --------------------------------- | -------- | ---------- | ------------------------------------- |
|
|
44
|
+
| `checkboxType` | `"circle" \| "square" \| "plain"` | No | `"circle"` | Visual style variant of the checkbox |
|
|
45
|
+
| `isChecked` | `boolean` | No | `false` | Current checked state of the checkbox |
|
|
46
|
+
| `size` | `number` | No | `24` | Size of the checkbox in pixels |
|
|
47
|
+
|
|
48
|
+
### Checkbox Types
|
|
49
|
+
|
|
50
|
+
- **`circle`**: Circular checkbox with a filled circle when checked
|
|
51
|
+
- **`square`**: Square checkbox with rounded corners and a check icon when checked
|
|
52
|
+
- **`plain`**: Minimal checkbox that toggles between X mark (unchecked) and check mark (checked)
|
|
53
|
+
|
|
54
|
+
## Events
|
|
55
|
+
|
|
56
|
+
| Event Name | Payload Type | Description |
|
|
57
|
+
| ------------------ | ------------ | --------------------------------------- |
|
|
58
|
+
| `update:isChecked` | `boolean` | Emitted when the checkbox state changes |
|
|
59
|
+
|
|
60
|
+
### Event Examples
|
|
61
|
+
|
|
62
|
+
```vue
|
|
63
|
+
<script setup lang="ts">
|
|
64
|
+
import { ref } from "vue";
|
|
65
|
+
import { Checkbox } from "@umbra-ui/core";
|
|
66
|
+
|
|
67
|
+
const checkboxState = ref(false);
|
|
68
|
+
|
|
69
|
+
const handleCheckboxChange = (checked: boolean) => {
|
|
70
|
+
console.log("Checkbox toggled to:", checked);
|
|
71
|
+
checkboxState.value = checked;
|
|
72
|
+
};
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<template>
|
|
76
|
+
<Checkbox
|
|
77
|
+
:is-checked="checkboxState"
|
|
78
|
+
@update:is-checked="handleCheckboxChange"
|
|
79
|
+
/>
|
|
80
|
+
</template>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Slots
|
|
84
|
+
|
|
85
|
+
This component does not use slots. The checkbox content is controlled via the `checkboxType` prop.
|
|
86
|
+
|
|
87
|
+
## Exposed Methods/Refs
|
|
88
|
+
|
|
89
|
+
This component does not expose any methods or refs via `defineExpose`.
|
|
90
|
+
|
|
91
|
+
## CSS Customization
|
|
92
|
+
|
|
93
|
+
The Checkbox component uses CSS custom properties that can be overridden to customize the appearance:
|
|
94
|
+
|
|
95
|
+
### Color Variables
|
|
96
|
+
|
|
97
|
+
```css
|
|
98
|
+
/* Checkbox outer colors */
|
|
99
|
+
--checkbox-border: #cecece;
|
|
100
|
+
--checkbox-bg: #fcfcfc;
|
|
101
|
+
|
|
102
|
+
/* Checkbox checked state colors */
|
|
103
|
+
--checkbox-checked-border: #0090ff;
|
|
104
|
+
--checkbox-checked-bg: #0090ff;
|
|
105
|
+
|
|
106
|
+
/* Plain checkbox colors */
|
|
107
|
+
--checkbox-plain-unchecked: #e5484d;
|
|
108
|
+
--checkbox-plain-checked: #0090ff;
|
|
109
|
+
|
|
110
|
+
/* Square checkbox icon color */
|
|
111
|
+
--checkbox-square-icon: #ffffff;
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Custom Styling Example
|
|
115
|
+
|
|
116
|
+
```vue
|
|
117
|
+
<template>
|
|
118
|
+
<Checkbox
|
|
119
|
+
:is-checked="isChecked"
|
|
120
|
+
checkbox-type="circle"
|
|
121
|
+
class="custom-checkbox"
|
|
122
|
+
/>
|
|
123
|
+
</template>
|
|
124
|
+
|
|
125
|
+
<style>
|
|
126
|
+
.custom-checkbox {
|
|
127
|
+
--checkbox-checked-bg: #ff6b6b;
|
|
128
|
+
--checkbox-checked-border: #ff5252;
|
|
129
|
+
}
|
|
130
|
+
</style>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Examples
|
|
134
|
+
|
|
135
|
+
### Different Checkbox Types
|
|
136
|
+
|
|
137
|
+
```vue
|
|
138
|
+
<script setup lang="ts">
|
|
139
|
+
import { ref } from "vue";
|
|
140
|
+
import { Checkbox } from "@umbra-ui/core";
|
|
141
|
+
|
|
142
|
+
const circleChecked = ref(false);
|
|
143
|
+
const squareChecked = ref(false);
|
|
144
|
+
const plainChecked = ref(false);
|
|
145
|
+
</script>
|
|
146
|
+
|
|
147
|
+
<template>
|
|
148
|
+
<div class="checkbox-examples">
|
|
149
|
+
<div class="checkbox-item">
|
|
150
|
+
<label>Circle Checkbox:</label>
|
|
151
|
+
<Checkbox
|
|
152
|
+
:is-checked="circleChecked"
|
|
153
|
+
checkbox-type="circle"
|
|
154
|
+
@update:is-checked="circleChecked = $event"
|
|
155
|
+
/>
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
<div class="checkbox-item">
|
|
159
|
+
<label>Square Checkbox:</label>
|
|
160
|
+
<Checkbox
|
|
161
|
+
:is-checked="squareChecked"
|
|
162
|
+
checkbox-type="square"
|
|
163
|
+
@update:is-checked="squareChecked = $event"
|
|
164
|
+
/>
|
|
165
|
+
</div>
|
|
166
|
+
|
|
167
|
+
<div class="checkbox-item">
|
|
168
|
+
<label>Plain Checkbox:</label>
|
|
169
|
+
<Checkbox
|
|
170
|
+
:is-checked="plainChecked"
|
|
171
|
+
checkbox-type="plain"
|
|
172
|
+
@update:is-checked="plainChecked = $event"
|
|
173
|
+
/>
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
</template>
|
|
177
|
+
|
|
178
|
+
<style module>
|
|
179
|
+
.checkbox-examples {
|
|
180
|
+
display: flex;
|
|
181
|
+
flex-direction: column;
|
|
182
|
+
gap: 1rem;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.checkbox-item {
|
|
186
|
+
display: flex;
|
|
187
|
+
align-items: center;
|
|
188
|
+
gap: 0.5rem;
|
|
189
|
+
}
|
|
190
|
+
</style>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Different Sizes
|
|
194
|
+
|
|
195
|
+
```vue
|
|
196
|
+
<script setup lang="ts">
|
|
197
|
+
import { ref } from "vue";
|
|
198
|
+
import { Checkbox } from "@umbra-ui/core";
|
|
199
|
+
|
|
200
|
+
const smallChecked = ref(false);
|
|
201
|
+
const mediumChecked = ref(false);
|
|
202
|
+
const largeChecked = ref(false);
|
|
203
|
+
</script>
|
|
204
|
+
|
|
205
|
+
<template>
|
|
206
|
+
<div class="size-examples">
|
|
207
|
+
<div class="checkbox-item">
|
|
208
|
+
<label>Small (16px):</label>
|
|
209
|
+
<Checkbox
|
|
210
|
+
:is-checked="smallChecked"
|
|
211
|
+
:size="16"
|
|
212
|
+
@update:is-checked="smallChecked = $event"
|
|
213
|
+
/>
|
|
214
|
+
</div>
|
|
215
|
+
|
|
216
|
+
<div class="checkbox-item">
|
|
217
|
+
<label>Medium (24px):</label>
|
|
218
|
+
<Checkbox
|
|
219
|
+
:is-checked="mediumChecked"
|
|
220
|
+
:size="24"
|
|
221
|
+
@update:is-checked="mediumChecked = $event"
|
|
222
|
+
/>
|
|
223
|
+
</div>
|
|
224
|
+
|
|
225
|
+
<div class="checkbox-item">
|
|
226
|
+
<label>Large (32px):</label>
|
|
227
|
+
<Checkbox
|
|
228
|
+
:is-checked="largeChecked"
|
|
229
|
+
:size="32"
|
|
230
|
+
@update:is-checked="largeChecked = $event"
|
|
231
|
+
/>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
</template>
|
|
235
|
+
|
|
236
|
+
<style module>
|
|
237
|
+
.size-examples {
|
|
238
|
+
display: flex;
|
|
239
|
+
flex-direction: column;
|
|
240
|
+
gap: 1rem;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.checkbox-item {
|
|
244
|
+
display: flex;
|
|
245
|
+
align-items: center;
|
|
246
|
+
gap: 0.5rem;
|
|
247
|
+
}
|
|
248
|
+
</style>
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Form Integration
|
|
252
|
+
|
|
253
|
+
```vue
|
|
254
|
+
<script setup lang="ts">
|
|
255
|
+
import { ref } from "vue";
|
|
256
|
+
import { Checkbox } from "@umbra-ui/core";
|
|
257
|
+
|
|
258
|
+
interface FormData {
|
|
259
|
+
termsAccepted: boolean;
|
|
260
|
+
newsletter: boolean;
|
|
261
|
+
notifications: boolean;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const formData = ref<FormData>({
|
|
265
|
+
termsAccepted: false,
|
|
266
|
+
newsletter: false,
|
|
267
|
+
notifications: true,
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
const handleCheckboxChange = (field: keyof FormData, value: boolean) => {
|
|
271
|
+
formData.value[field] = value;
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
const submitForm = () => {
|
|
275
|
+
if (!formData.value.termsAccepted) {
|
|
276
|
+
alert("Please accept the terms and conditions");
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
console.log("Form submitted:", formData.value);
|
|
281
|
+
};
|
|
282
|
+
</script>
|
|
283
|
+
|
|
284
|
+
<template>
|
|
285
|
+
<form class="form-example" @submit.prevent="submitForm">
|
|
286
|
+
<div class="form-group">
|
|
287
|
+
<Checkbox
|
|
288
|
+
:is-checked="formData.termsAccepted"
|
|
289
|
+
checkbox-type="square"
|
|
290
|
+
@update:is-checked="handleCheckboxChange('termsAccepted', $event)"
|
|
291
|
+
/>
|
|
292
|
+
<label>I accept the terms and conditions</label>
|
|
293
|
+
</div>
|
|
294
|
+
|
|
295
|
+
<div class="form-group">
|
|
296
|
+
<Checkbox
|
|
297
|
+
:is-checked="formData.newsletter"
|
|
298
|
+
checkbox-type="circle"
|
|
299
|
+
@update:is-checked="handleCheckboxChange('newsletter', $event)"
|
|
300
|
+
/>
|
|
301
|
+
<label>Subscribe to newsletter</label>
|
|
302
|
+
</div>
|
|
303
|
+
|
|
304
|
+
<div class="form-group">
|
|
305
|
+
<Checkbox
|
|
306
|
+
:is-checked="formData.notifications"
|
|
307
|
+
checkbox-type="plain"
|
|
308
|
+
@update:is-checked="handleCheckboxChange('notifications', $event)"
|
|
309
|
+
/>
|
|
310
|
+
<label>Enable notifications</label>
|
|
311
|
+
</div>
|
|
312
|
+
|
|
313
|
+
<button type="submit">Submit</button>
|
|
314
|
+
</form>
|
|
315
|
+
</template>
|
|
316
|
+
|
|
317
|
+
<style module>
|
|
318
|
+
.form-example {
|
|
319
|
+
display: flex;
|
|
320
|
+
flex-direction: column;
|
|
321
|
+
gap: 1rem;
|
|
322
|
+
max-width: 300px;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.form-group {
|
|
326
|
+
display: flex;
|
|
327
|
+
align-items: center;
|
|
328
|
+
gap: 0.5rem;
|
|
329
|
+
}
|
|
330
|
+
</style>
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### Checkbox List
|
|
334
|
+
|
|
335
|
+
```vue
|
|
336
|
+
<script setup lang="ts">
|
|
337
|
+
import { ref } from "vue";
|
|
338
|
+
import { Checkbox } from "@umbra-ui/core";
|
|
339
|
+
|
|
340
|
+
interface CheckboxItem {
|
|
341
|
+
id: string;
|
|
342
|
+
label: string;
|
|
343
|
+
checked: boolean;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
const checkboxItems = ref<CheckboxItem[]>([
|
|
347
|
+
{ id: "1", label: "Option 1", checked: false },
|
|
348
|
+
{ id: "2", label: "Option 2", checked: true },
|
|
349
|
+
{ id: "3", label: "Option 3", checked: false },
|
|
350
|
+
{ id: "4", label: "Option 4", checked: false },
|
|
351
|
+
]);
|
|
352
|
+
|
|
353
|
+
const handleItemChange = (id: string, checked: boolean) => {
|
|
354
|
+
const item = checkboxItems.value.find((item) => item.id === id);
|
|
355
|
+
if (item) {
|
|
356
|
+
item.checked = checked;
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
const selectAll = () => {
|
|
361
|
+
checkboxItems.value.forEach((item) => {
|
|
362
|
+
item.checked = true;
|
|
363
|
+
});
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
const selectNone = () => {
|
|
367
|
+
checkboxItems.value.forEach((item) => {
|
|
368
|
+
item.checked = false;
|
|
369
|
+
});
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
const selectedCount = computed(() => {
|
|
373
|
+
return checkboxItems.value.filter((item) => item.checked).length;
|
|
374
|
+
});
|
|
375
|
+
</script>
|
|
376
|
+
|
|
377
|
+
<template>
|
|
378
|
+
<div class="checkbox-list">
|
|
379
|
+
<div class="list-header">
|
|
380
|
+
<h3>Select Options ({{ selectedCount }}/{{ checkboxItems.length }})</h3>
|
|
381
|
+
<div class="list-actions">
|
|
382
|
+
<button @click="selectAll">Select All</button>
|
|
383
|
+
<button @click="selectNone">Select None</button>
|
|
384
|
+
</div>
|
|
385
|
+
</div>
|
|
386
|
+
|
|
387
|
+
<div class="list-items">
|
|
388
|
+
<div v-for="item in checkboxItems" :key="item.id" class="list-item">
|
|
389
|
+
<Checkbox
|
|
390
|
+
:is-checked="item.checked"
|
|
391
|
+
checkbox-type="square"
|
|
392
|
+
@update:is-checked="handleItemChange(item.id, $event)"
|
|
393
|
+
/>
|
|
394
|
+
<label>{{ item.label }}</label>
|
|
395
|
+
</div>
|
|
396
|
+
</div>
|
|
397
|
+
</div>
|
|
398
|
+
</template>
|
|
399
|
+
|
|
400
|
+
<style module>
|
|
401
|
+
.checkbox-list {
|
|
402
|
+
display: flex;
|
|
403
|
+
flex-direction: column;
|
|
404
|
+
gap: 1rem;
|
|
405
|
+
max-width: 300px;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.list-header {
|
|
409
|
+
display: flex;
|
|
410
|
+
justify-content: space-between;
|
|
411
|
+
align-items: center;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.list-actions {
|
|
415
|
+
display: flex;
|
|
416
|
+
gap: 0.5rem;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.list-items {
|
|
420
|
+
display: flex;
|
|
421
|
+
flex-direction: column;
|
|
422
|
+
gap: 0.5rem;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.list-item {
|
|
426
|
+
display: flex;
|
|
427
|
+
align-items: center;
|
|
428
|
+
gap: 0.5rem;
|
|
429
|
+
}
|
|
430
|
+
</style>
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
## Notes
|
|
434
|
+
|
|
435
|
+
- The checkbox includes smooth scale and opacity transitions for checked/unchecked states
|
|
436
|
+
- Circle and square checkboxes use a scale animation for the inner element
|
|
437
|
+
- Plain checkboxes use opacity transitions to switch between X and check icons
|
|
438
|
+
- All checkbox types support both light and dark themes
|
|
439
|
+
- The component is fully accessible with proper click handling
|
|
440
|
+
- Size is calculated in rem units based on a 17px base font size
|
|
441
|
+
- The component automatically handles the visual state based on the `isChecked` prop
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* Light theme using Colors */
|
|
2
|
+
:root {
|
|
3
|
+
/* Checkbox outer colors */
|
|
4
|
+
--checkbox-border: #cecece; /* gray8 - lighter border for light mode */
|
|
5
|
+
--checkbox-bg: #fcfcfc; /* gray3 - light background for light mode */
|
|
6
|
+
|
|
7
|
+
/* Checkbox checked state colors */
|
|
8
|
+
--checkbox-checked-border: #0090ff; /* blue9 - same as button primary */
|
|
9
|
+
--checkbox-checked-bg: #0090ff; /* blue9 - same as button primary */
|
|
10
|
+
|
|
11
|
+
/* Plain checkbox colors */
|
|
12
|
+
--checkbox-plain-unchecked: #e5484d; /* red9 - for X mark */
|
|
13
|
+
--checkbox-plain-checked: #0090ff; /* blue9 - for check mark */
|
|
14
|
+
|
|
15
|
+
/* Square checkbox icon color */
|
|
16
|
+
--checkbox-square-icon: #ffffff; /* white - for check icon in square checkbox */
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* Dark theme */
|
|
20
|
+
.dark,
|
|
21
|
+
.dark-theme {
|
|
22
|
+
/* Checkbox outer colors */
|
|
23
|
+
--checkbox-border: #606060; /* Original dark mode value */
|
|
24
|
+
--checkbox-bg: #313131; /* Original dark mode value */
|
|
25
|
+
|
|
26
|
+
/* Checkbox checked state colors */
|
|
27
|
+
--checkbox-checked-border: #0090ff; /* blue9 - same as button primary */
|
|
28
|
+
--checkbox-checked-bg: #0090ff; /* blue9 - same as button primary */
|
|
29
|
+
|
|
30
|
+
/* Plain checkbox colors */
|
|
31
|
+
--checkbox-plain-unchecked: #e5484d; /* red9 - for X mark */
|
|
32
|
+
--checkbox-plain-checked: #0090ff; /* blue9 - for check mark */
|
|
33
|
+
|
|
34
|
+
/* Square checkbox icon color */
|
|
35
|
+
--checkbox-square-icon: #ffffff; /* white - for check icon in square checkbox */
|
|
36
|
+
}
|